LearnPress – WordPress LMS Plugin - Version 4.0.2

Version Description

~ Upgrade library chart.js to v3.2.1 ~ Optimize query with cache get list questions on a quiz ~ Show content(description) on page LP Profile, LP Archive ~ Fixed: errors when activated "Metabox" plugin ~ Fixed: broken layout profile page when activated "All in one seo" plugin ~ Removed: tool "Remove current Data" ~ Removed: tool "Remove outdated Data" ~ Removed: tool "Repair database"

Download this release

Release Info

Developer ThimPress
Plugin Icon 128x128 LearnPress – WordPress LMS Plugin
Version 4.0.2
Comparing to
See all releases

Code changes from version 4.0.1 to 4.0.2

Files changed (60) hide show
  1. assets/css/learnpress.css +6 -0
  2. assets/js/admin/pages/search-lp-addons-themes.min.js +0 -1
  3. assets/js/admin/pages/setup.min.js +0 -1
  4. assets/js/admin/pages/statistic.min.js +0 -1
  5. assets/js/admin/pages/sync-data.min.js +0 -1
  6. assets/js/admin/pages/tools.min.js +0 -1
  7. assets/js/admin/pages/tools/database/upgrade.min.js +0 -1
  8. assets/js/dist/frontend/quiz.js +1 -1
  9. assets/js/dist/frontend/quiz.min.js +2 -2
  10. assets/js/dist/frontend/single-curriculum.js +64 -2
  11. assets/js/dist/frontend/single-curriculum.min.js +1 -1
  12. assets/js/vendor/chart.js +11 -8
  13. assets/js/vendor/chart.min.js +1 -1
  14. assets/src/apps/js/frontend/single-curriculum.js +2 -0
  15. assets/src/apps/js/frontend/single-curriculum/components/compatible.js +1 -1
  16. assets/src/apps/js/frontend/single-curriculum/scrolltoitem.js +47 -0
  17. assets/src/apps/js/ultils/handle-ajax-api.js +0 -21
  18. assets/src/apps/js/ultils/lp-modal-overlay.js +0 -54
  19. assets/src/js/admin/pages/search-lp-addons-themes.js +0 -50
  20. assets/src/js/admin/pages/setup.js +0 -164
  21. assets/src/js/admin/pages/statistic.js +0 -271
  22. assets/src/js/admin/pages/sync-data.js +0 -262
  23. assets/src/js/admin/pages/tools.js +0 -117
  24. assets/src/js/admin/pages/tools/database/upgrade.js +0 -287
  25. assets/src/js/vendor/chart.min.js +11 -8
  26. inc/admin/class-lp-admin-assets.php +4 -4
  27. inc/admin/class-lp-admin-tools.php +4 -4
  28. inc/admin/class-lp-updater.php +109 -80
  29. inc/admin/sub-menus/class-lp-submenu-statistics.php +3 -3
  30. inc/admin/sub-menus/class-lp-submenu-tools.php +6 -6
  31. inc/admin/views/tools/database/html-rollback-db.php +13 -0
  32. inc/admin/views/tools/html-database.php +4 -3
  33. inc/class-lp-cache.php +12 -0
  34. inc/class-lp-global.php +21 -11
  35. inc/class-lp-helper.php +14 -0
  36. inc/class-lp-install.php +15 -17
  37. inc/class-lp-shortcodes.php +1 -5
  38. inc/curds/class-lp-quiz-curd.php +16 -30
  39. inc/curds/class-lp-user-curd.php +15 -2
  40. inc/custom-post-types/quiz.php +15 -0
  41. inc/databases/class-lp-db.php +36 -13
  42. inc/databases/class-lp-question-db.php +79 -14
  43. inc/databases/class-lp-quiz-db.php +6 -4
  44. inc/filters/class-lp-question-filter.php +13 -0
  45. inc/interfaces/interface-curd.php +3 -2
  46. inc/jwt/rest-api/version1/class-lp-rest-users-v1-controller.php +15 -7
  47. inc/lp-core-functions.php +71 -63
  48. inc/lp-custom-hooks.php +3 -0
  49. inc/lp-template-functions.php +102 -28
  50. inc/quiz/class-lp-quiz.php +17 -22
  51. inc/rest-api/class-lp-rest-users-controller.php +1 -1
  52. inc/templates/class-lp-template-course.php +36 -7
  53. inc/updates/learnpress-upgrade-4.php +42 -29
  54. languages/learnpress.pot +1 -1
  55. learnpress.php +1 -2
  56. readme.txt +11 -1
  57. templates/archive-course.php +2 -0
  58. templates/pages/profile.php +2 -0
  59. templates/profile/header.php +2 -1
  60. templates/single-course/content-protected.php +1 -1
assets/css/learnpress.css CHANGED
@@ -5163,6 +5163,12 @@ a {
5163
  }
5164
  }
5165
 
 
 
 
 
 
 
5166
  .lp-archive-courses.loading ul.learn-press-courses {
5167
  position: relative;
5168
  }
5163
  }
5164
  }
5165
 
5166
+ .lp-content-area:after, .lp-content-area:before {
5167
+ content: "";
5168
+ display: table;
5169
+ clear: both;
5170
+ }
5171
+
5172
  .lp-archive-courses.loading ul.learn-press-courses {
5173
  position: relative;
5174
  }
assets/js/admin/pages/search-lp-addons-themes.min.js DELETED
@@ -1 +0,0 @@
1
- !function(n){let t=null,e=null,o=null;const i=function(t){o||(o=e.clone());const i=t.toLowerCase().split(/\s+/).filter((function(n,t){return n.length>=3})),c=function(t,e){return t.find(".plugin-card").each((function(){const t=n(this),o=t.find(".item-title").text().toLowerCase(),c=t.find(".column-description, .theme-description").text();if(i.length){if(function(){const n=new RegExp(i.join("|"),"ig");return o.match(n)||c.match(n)}()){const n=t.clone();e.append(n)}}else e.append(t.clone())}))};e.each((function(t){const e=n(this).html(""),i=(c(o.eq(t),e),e.children().length);e.prev("h2").find("span").html(i)}))};n(document).on("keyup",".lp-search-addon",(function(n){t&&clearTimeout(t),t=setTimeout(i,300,n.target.value)})),jQuery((function(){e=n(".addons-browse")}))}(jQuery);
 
assets/js/admin/pages/setup.min.js DELETED
@@ -1 +0,0 @@
1
- !function(e){"use strict";let t,s;const a=function(e){t.toggleClass("loading",void 0===e||e)},n=function(t){s=e("#learn-press-setup-form");const a=s.serializeJSON();return e.extend(a,t||{})},c=function(s){const a=e(s);t.replaceWith(a),t=a},r=function(a){if(a.preventDefault(),!function(t){const s=t.find('input[type="email"]');let a=!0;return s.each((function(){const t=e(this);switch(t.css("border-color",""),t.attr("name")){case"settings[paypal][paypal_email]":case"settings[paypal][paypal_sandbox_email]":if(!t.closest("tr").prev().find('input[type="checkbox"]').is(":checked"))return}var s;s=this.value,/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(s)||(a=!1,t.css("border-color","#FF0000"))})),a}(s))return;const r=e(this).attr("href");t.addClass("loading"),e.post({url:r,data:n(),success(s){const a=e(s);c(a.contents().filter("#main")),LP.setUrl(r),e(".learn-press-dropdown-pages").LP("DropdownPages"),e(".learn-press-tip").LP("QuickTip"),t.removeClass("loading")}})},i=function(){const t=e(this).children(":selected").html().match(/\((.*)\)/),s=t?t[1]:"";e("#currency-pos").children().each((function(){const t=e(this);let a=t.html();switch(t.val()){case"left":a=a.replace(/\( (.*)69/,"( "+s+"69");break;case"right":a=a.replace(/9([^0-9]*) \)/,"9"+s+" )");break;case"left_with_space":a=a.replace(/\( (.*) 6/,"( "+s+" 6");break;case"right_with_space":a=a.replace(/9 (.*) \)/,"9 "+s+" )")}t.html(a)}))},l=function(){e.post({url:"",dataType:"html",data:n({"lp-ajax":"get-price-format"}),success(t){e("#preview-price").html(t)}})},o=function(t){t.preventDefault(),a(),e.post({url:e(this).attr("href"),dataType:"html",data:n({"lp-ajax":"setup-create-pages"}),success(t){c(e(t).contents().filter("#main")),e(".learn-press-dropdown-pages").LP("DropdownPages"),a(!1)}})},p=function(t){t.preventDefault();const s=e(this);a(),e.post({url:e(this).attr("href"),dataType:"html",data:{},success(t){a(!1),s.replaceWith(e(t).find("a:first").addClass("button button-primary"))}})};e((function(){t=e("#main"),s=e("#learn-press-setup-form"),e(".learn-press-select2").select2(),e(document).on("click",".buttons .button",r).on("change","#currency",i).on("change","input, select",l).on("click","#create-pages",o).on("click","#install-sample-course",p)}))}(jQuery);
 
assets/js/admin/pages/statistic.min.js DELETED
@@ -1 +0,0 @@
1
- !function(t){t.fn.LP_Chart_Line=function(e,a){return t.each(this,(function(){const r=t(this),n=t("<canvas />");r.html(""),n.appendTo(r),new Chart(n.get(0).getContext("2d")).Line(e,a)}))},t.fn.LP_Statistic_Users=function(){if(0!==parseInt(t(this).length))return t.each(this,(function(){const e=t(".chart-buttons button").on("click",(function(){const a=t(this),r=a.data("type");let n="",s="";if(e.not(this).not('[data-type="user-custom-time"]').prop("disabled",!1),"user-custom-time"==r){if(n=t('#user-custom-time input[name="from"]').val(),s=t('#user-custom-time input[name="to"]').val(),""==n||""==s)return!1}else a.prop("disabled",!0);const o=t("#learn-press-chart");return o.addClass("loading"),t.ajax({url:"admin-ajax.php",data:{action:"learnpress_load_chart",type:r,range:[n,s]},dataType:"text",success(t){t=LP.parseJSON(t),o.LP_Chart_Line(t,LP_Chart_Config),o.removeClass("loading")}}),!1})),a=t('.chart-buttons #user-custom-time input[type="text"]').on("change",(function(){e.filter('[data-type="user-custom-time"]').prop("disabled",a.filter((function(){return""==this.value})).get().length||!function(){if(new Date(a[0].value)<new Date(a[1].value))return!0}())}))}))},t.fn.LP_Statistic_Courses=function(){if(0!==parseInt(t(this).length))return t.each(this,(function(){var e=t(".chart-buttons button").on("click",(function(){let a=t(this),r=a.data("type"),n="",s="",o=t("#learn-press-chart");if(e.not(this).not('[data-type="course-custom-time"]').prop("disabled",!1),"course-custom-time"==r){if(n=t('#course-custom-time input[name="from"]').val(),s=t('#course-custom-time input[name="to"]').val(),""==n||""==s)return!1}else a.prop("disabled",!0);return o.addClass("loading"),t.ajax({url:"admin-ajax.php",data:{action:"learnpress_load_chart",type:r,range:[n,s]},dataType:"text",success(t){t=LP.parseJSON(t),o.LP_Chart_Line(t,LP_Chart_Config),o.removeClass("loading")}}),!1})),a=t('.chart-buttons #course-custom-time input[type="text"]').on("change",(function(){e.filter('[data-type="course-custom-time"]').prop("disabled",a.filter((function(){return""==this.value})).get().length||!function(){if(new Date(a[0].value)<new Date(a[1].value))return!0}())}))}))},t.fn.LP_Statistic_Orders=function(){if(0!==parseInt(t(this).length)){t(".panel_report_option").hide(),t("#panel_report_sales_by_"+t("#report_sales_by").val()).show(),t("#report_sales_by").on("change",(function(){t(".panel_report_option").hide(),t("#panel_report_sales_by_"+t(this).val()).show(),"date"==t(this).val()&&e()}));var e=function(){let e="",a="",r="",n="date",s=0,o=0;n=t("#report_sales_by").val(),$container=t("#learn-press-chart"),$container.addClass("loading");const i=t(".chart-buttons button:disabled").not('[data-type="order-custom-time"]');if(parseInt(i.length)>0)e=t(i[0]).data("type");else if(e="order-custom-time",a=t('#order-custom-time input[name="from"]').val(),r=t('#order-custom-time input[name="to"]').val(),""==a||""==r)return!1;"course"===n?o=t("#report-by-course-id").val():"category"===n&&(s=t("#report-by-course-category-id").val()),t.ajax({url:"admin-ajax.php",data:{action:"learnpress_load_chart",type:e,range:[a,r],report_sales_by:n,course_id:o,cat_id:s},dataType:"text",success(t){t=LP.parseJSON(t),$container.LP_Chart_Line(t,LP_Chart_Config),$container.removeClass("loading")}})};t("#report-by-course-id").select2({placeholder:"Select a course",minimumInputLength:1,ajax:{url:ajaxurl+"?action=learnpress_search_course",dataType:"json",quietMillis:250,data:(t,e)=>({q:t}),results:(t,e)=>({results:t.items}),cache:!0}}),t("#report-by-course-id").on("change",(function(){e()})),t("#report-by-course-category-id").select2({placeholder:"Select a course",minimumInputLength:1,ajax:{url:ajaxurl+"?action=learnpress_search_course_category",dataType:"json",quietMillis:250,data:(t,e)=>({q:t}),results:(t,e)=>({results:t.items}),cache:!0}}),t("#report-by-course-category-id").on("change",(function(){e()}));var a=t(".chart-buttons button").on("click",(function(){const r=t(this),n=r.data("type");t("#learn-press-chart");return a.not(this).not('[data-type="order-custom-time"]').prop("disabled",!1),"order-custom-time"!==n&&(r.prop("disabled",!0),t('#order-custom-time input[name="from"]').val(""),t('#order-custom-time input[name="to"]').val("")),e(),!1})),r=t('.chart-buttons #order-custom-time input[type="text"]').on("change",(function(){a.filter('[data-type="order-custom-time"]').prop("disabled",r.filter((function(){return""==this.value})).get().length||!function(){if(new Date(r[0].value)<new Date(r[1].value))return!0}())}))}},t((function(){void 0!==t.fn.datepicker&&t(".date-picker").datepicker({dateFormat:"yy/mm/dd"}),t(".learn-press-statistic-users").LP_Statistic_Users(),t(".learn-press-statistic-courses").LP_Statistic_Courses(),t(".learn-press-statistic-orders").LP_Statistic_Orders()}))}(jQuery);
 
assets/js/admin/pages/sync-data.min.js DELETED
@@ -1 +0,0 @@
1
- !function(s){const e={id:"sync-base",syncing:!1,items:!1,completed:!1,callback:null,methodGetItems:"",itemsKey:"",chunkSize:50,sync(s){if(!this.syncing){if(this.callback=s,!1===this.items)this.get_items();else if(!this.dispatch())return this.completed=!0,void this.callToCallback();this.syncing=!0}},init(){this.syncing=!1,this.items=!1,this.completed=!1},is_completed(){return this.completed},dispatch(){const e=this,t=!!this.items&&this.items.splice(0,this.chunkSize);return!(!t||0===t.length)&&(s.ajax({url:"",data:{"lp-ajax":this.id,sync:t},method:"post",success(s){s=LP.parseJSON(s),e.syncing=!1,"success"!==s.result&&(e.completed=!0),e.callToCallback(),e.is_completed()||e.sync(e.callback)}}),!0)},callToCallback(){this.callback&&this.callback.call(this)},get_items(){const e=this;s.ajax({url:"",data:{"lp-ajax":this.id,sync:this.methodGetItems},success(s){e.syncing=!1,(s=LP.parseJSON(s))[e.itemsKey]?(e.items=s[e.itemsKey],e.sync(e.callback)):(e.completed=!0,e.items=[],e.callToCallback())}})}},t=s.extend({},e,{id:"sync-course-orders",methodGetItems:"get-courses",itemsKey:"courses"}),n=s.extend({},e,{id:"sync-user-courses",methodGetItems:"get-users",itemsKey:"users",chunkSize:500}),c=s.extend({},e,{id:"sync-user-orders",methodGetItems:"get-users",itemsKey:"users",chunkSize:500}),i=s.extend({},e,{id:"sync-course-final-quiz",methodGetItems:"get-courses",itemsKey:"courses",chunkSize:500}),l=s.extend({},e,{id:"sync-remove-older-data",methodGetItems:"remove-older-data",itemsKey:"_nothing_here",chunkSize:500}),o=s.extend({},e,{id:"sync-calculate-course-results",methodGetItems:"get-users",itemsKey:"users",chunkSize:1});window.LP_Sync_Data={syncs:[],syncing:0,options:{},start(e){if(this.syncs=[],this.options=s.extend({onInit(){},onStart(){},onCompleted(){},onCompletedAll(){}},e||{}),this.get_syncs()){this.reset(),this.options.onInit.call(this);var t=this,n=0,c=this.syncs.length,i=function(s){if(s.is_completed()){if(n++,t.options.onCompleted.call(t,s),n>=c)return void t.options.onCompletedAll.call(t);t.sync(n,i)}};this.sync(n,i)}},reset(){for(const s in this.syncs)try{this[this.syncs[s]].init()}catch(s){}},sync(s,e){const t=this,n=this[this.syncs[s]];t.options.onStart.call(t,n),n.sync((function(){e.call(t,n)}))},get_syncs(){const e=s('input[name^="lp-repair"]:checked').serializeJSON()["lp-repair"];if(!e)return!1;for(let s in e)"yes"===e[s]&&(s=s.replace(/[-]+/g,"_"),this[s]&&this.syncs.push(s));return this.syncs},get_sync(s){return this[s=s.replace(/[-]+/g,"_")]},sync_course_orders:t,sync_user_orders:c,sync_user_courses:n,sync_course_final_quiz:i,sync_remove_older_data:l,sync_calculate_course_results:o},s(document).ready((function(){!function(){const e=s("#learn-press-check-all-syncs"),t=s("#learn-press-syncs").find('[name^="lp-repair"]');e.on("click",(function(){t.prop("checked",this.checked)})),t.on("click",(function(){e.prop("checked",t.filter(":checked").length===t.length)}))}()})).on("click",".lp-button-repair",(function(){function e(e){return s("ul#learn-press-syncs").find('input[name*="'+e+'"]')}LP_Sync_Data.start({onInit(){s("ul#learn-press-syncs").children().removeClass("syncing synced"),s(".lp-button-repair").prop("disabled",!0)},onStart(s){e(s.id).closest("li").addClass("syncing")},onCompleted(s){e(s.id).closest("li").removeClass("syncing").addClass("synced")},onCompletedAll(){s("ul#learn-press-syncs").children().removeClass("syncing synced"),s(".lp-button-repair").prop("disabled",!1)}})}))}(jQuery);
 
assets/js/admin/pages/tools.min.js DELETED
@@ -1 +0,0 @@
1
- import getStepsUpgradeStatus from"./tools/database/upgrade";!function(e){const t=e(document);let a=!1;const s=function(t){t.preventDefault();const s=e(this);a||confirm(lpGlobalSettings.i18n.confirm_install_sample_data)&&(s.addClass("disabled").html(s.data("installing-text")),e(".lp-install-sample__response").remove(),a=!0,e.ajax({url:s.attr("href"),data:e(".lp-install-sample__options").serializeJSON(),success(t){s.removeClass("disabled").html(s.data("text")),a=!1,e(t).insertBefore(s.parent())},error(){s.removeClass("disabled").html(s.data("text")),a=!1,e(response).insertBefore(s.parent())}}))},l=function(t){t.preventDefault();const s=e(this);a||confirm(lpGlobalSettings.i18n.confirm_uninstall_sample_data)&&(s.addClass("disabled").html(s.data("uninstalling-text")),a=!0,e.ajax({url:s.attr("href"),success(t){s.removeClass("disabled").html(s.data("text")),a=!1,e(t).insertBefore(s.parent())},error(){s.removeClass("disabled").html(s.data("text")),a=!1,e(response).insertBefore(s.parent())}}))},n=function(t){t.preventDefault();const a=e(this);a.hasClass("disabled")||(a.addClass("disabled").html(a.data("cleaning-text")),e.ajax({url:a.attr("href"),data:{},success(e){a.removeClass("disabled").html(a.data("text"))},error(){a.removeClass("disabled").html(a.data("text"))}}))},i=function(){e.ajax({url:"admin.php?page=lp-toggle-hard-cache-option",data:{v:this.checked?"yes":"no"},success(e){},error(){}})},r=function(t){t.preventDefault(),e(".lp-install-sample__options").toggleClass("hide-if-js")};e((function(){getStepsUpgradeStatus(),t.on("click",".lp-install-sample__install",s).on("click",".lp-install-sample__uninstall",l).on("click","#learn-press-clear-cache",n).on("click",'input[name="enable_hard_cache"]',i).on("click",".lp-install-sample__toggle-options",r)}))}(jQuery);
 
assets/js/admin/pages/tools/database/upgrade.min.js DELETED
@@ -1 +0,0 @@
1
- import{elLPOverlay,lpModalOverlay}from"../../../../utils/lp-modal-overlay";import handleAjax from"../../../../utils/handle-ajax-api";const $=jQuery,elToolUpgradeDB=$("#lp-tool-upgrade-db"),upgradeDB=()=>{let e=0;const l=elToolUpgradeDB.find(".wrapper-terms-upgrade"),a=elToolUpgradeDB.find(".wrapper-lp-status-upgrade"),t=elToolUpgradeDB.find(".wrapper-lp-upgrade-message");let s=null;if(l.length){lpModalOverlay.setContentModal(l.html());const e=elLPOverlay.find(".terms-upgrade"),t=e.find("input[name=lp-agree-term]"),o=e.find(".error"),n=$("input[name=message-when-upgrading]").val();s=function(){return o.hide(),o.removeClass("learn-press-message"),t.is(":checked")?(handleAjax("/lp/v1/database/agree_terms",{agree_terms:1},{}),lpModalOverlay.elFooter.find(".learn-press-notice").remove(),lpModalOverlay.elFooter.prepend('<span class="learn-press-notice">'+n+"</span>"),lpModalOverlay.setContentModal(a.html()),!0):(o.show(),o.addClass("learn-press-message"),lpModalOverlay.elMainContent.animate({scrollTop:o.offset().top}),!1)}}else lpModalOverlay.setContentModal(a.html()),s=function(){return!0};lpModalOverlay.setTitleModal(elToolUpgradeDB.find("h2").html()),lpModalOverlay.elBtnYes.text("Upgrade"),lpModalOverlay.elBtnYes.show(),lpModalOverlay.elBtnNo.text("close"),lpModalOverlay.callBackYes=function(){if(!s())return;e=1,lpModalOverlay.elBtnYes.hide(),lpModalOverlay.elBtnNo.hide();const l=elLPOverlay.find(".lp-group-step"),a=elToolUpgradeDB.find(".lp-item-step"),o=[];$.each(a,(function(e,l){const a=$(l);if(!a.hasClass("completed")){const e=a.find("input").val();o.push(e)}}));const n={steps:o,step:o[0]};let r=null;const p=(e,a)=>{r=l.find("input[value="+e+"]").closest(".lp-item-step"),r.addClass("running"),100===a&&r.removeClass("running").addClass("completed"),r.find(".progress-bar").css("width",a+"%"),r.find(".percent").text(a+"%")};p(o[0],.1);const d={success:a=>{p(n.step,a.percent),n.step!==a.name&&p(a.name,.1),(e=>{r=l.find("input[value="+e+"]").closest(".lp-item-step");const a=r.offset().top-lpModalOverlay.elMainContent.offset().top+lpModalOverlay.elMainContent.scrollTop();lpModalOverlay.elMainContent.stop().animate({scrollTop:a},600)})(n.step),"success"===a.status?(n.step=a.name,n.data=a.data,setTimeout(()=>{handleAjax("/lp/v1/database/upgrade",n,d)},800)):"finished"===a.status?(e=0,r.removeClass("running").addClass("completed"),setTimeout(()=>{lpModalOverlay.setContentModal(t.html())},1e3),lpModalOverlay.elFooter.find(".learn-press-notice").remove(),lpModalOverlay.elBtnNo.show(),lpModalOverlay.elBtnNo.on("click",()=>{window.location.reload()})):(e=0,lpModalOverlay.elFooter.find(".learn-press-notice").remove(),r.removeClass("running").addClass("error"),lpModalOverlay.setContentModal(t.html(),(function(){lpModalOverlay.elBtnYes.text("Retry").show(),lpModalOverlay.elBtnNo.show(),a.message||(a.message="Upgrade not success! Please clear cache, restart sever then retry or contact to LP to help"),lpModalOverlay.elMainContent.find(".learn-press-message").addClass("error").html(a.message)})))},error:l=>{e=0,lpModalOverlay.setContentModal(t.html(),(function(){lpModalOverlay.elBtnYes.text("Retry").show(),lpModalOverlay.elBtnNo.show(),l.message||(l.message="Upgrade not success! Something wrong. Please clear cache, restart sever then retry or contact to LP to help"),lpModalOverlay.elMainContent.find(".learn-press-message").addClass("error").html(l.message)}))},completed:()=>{}};handleAjax("/lp/v1/database/upgrade",n,d)},window.onbeforeunload=function(){if(e)return"LP is upgrading Database. Are you want to reload page?"},window.onclose=function(){if(e)return"LP is upgrading Database. Are you want to close page?"}},getStepsUpgradeStatus=()=>{if(!elToolUpgradeDB.length)return;const e=$(".wrapper-lp-status-upgrade"),l=window.location.search,a=new URLSearchParams(l).get("action");"upgrade-db"===a&&(elLPOverlay.show(),lpModalOverlay.instance||lpModalOverlay.init(),lpModalOverlay.setTitleModal(elToolUpgradeDB.find("h2").html()),lpModalOverlay.setContentModal($(".wrapper-lp-loading").html()));handleAjax("/lp/v1/database/get_steps",{},{success:l=>{const{steps_completed:t,steps_default:s}=l;if(void 0===t||void 0===s)return console.log("invalid steps_completed and steps_default"),!1;let o="";for(const l in s){const n=s[l],r=n.steps;o='<div class="lp-group-step">',o+="<h3>"+n.label+"</h3>";for(const e in r){const l=r[e];let a="";void 0!==t[e]&&(a="completed"),o+='<div class="lp-item-step '+a+'">',o+='<div class="lp-item-step-left"><input type="hidden" name="lp_steps_upgrade_db[]" value="'+l.name+'" /></div>',o+='<div class="lp-item-step-right">',o+='<label for=""><strong></strong>'+l.label+"</label>",o+='<div class="description">'+l.description+"</div>",o+='<div class="percent"></div>',o+='<span class="progress-bar"></span>',o+="</div>",o+="</div>"}o+="</div>",e.append(o);const p=$(".lp-btn-upgrade-db");"upgrade-db"===a&&upgradeDB(),p.on("click",(function(){lpModalOverlay.instance||lpModalOverlay.init(),elLPOverlay.show(),upgradeDB()}))}},error:e=>{},completed:()=>{}})};export default getStepsUpgradeStatus;
 
assets/js/dist/frontend/quiz.js CHANGED
@@ -3238,7 +3238,7 @@ LP.Hook.addAction('lp-compatible-builder', function () {
3238
  });
3239
  }
3240
 
3241
- if (typeof vc_js !== 'undefined') {
3242
  _toConsumableArray(document.querySelectorAll('#popup-content'))[0].addEventListener('scroll', function () {
3243
  VcWaypoint.refreshAll();
3244
  });
3238
  });
3239
  }
3240
 
3241
+ if (typeof vc_js !== 'undefined' && typeof VcWaypoint !== 'undefined') {
3242
  _toConsumableArray(document.querySelectorAll('#popup-content'))[0].addEventListener('scroll', function () {
3243
  VcWaypoint.refreshAll();
3244
  });
assets/js/dist/frontend/quiz.min.js CHANGED
@@ -1,6 +1,6 @@
1
- this.LP=this.LP||{},this.LP.quiz=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=18)}([function(e,t){e.exports=window.wp.i18n},function(e,t){e.exports=window.wp.data},function(e,t){e.exports=window.wp.element},function(e,t){e.exports=window.wp.compose},function(e,t,n){"use strict";e.exports=function(e){var t,n={};return function e(t,n){var r;if(Array.isArray(n))for(r=0;r<n.length;r++)e(t,n[r]);else for(r in n)t[r]=(t[r]||[]).concat(n[r])}(n,e),(t=function(e){return function(t){return function(r){var o,i,a=n[r.type],u=t(r);if(a)for(o=0;o<a.length;o++)(i=a[o](r,e))&&e.dispatch(i);return u}}}).effects=n,t}},,,function(e,t){!function(){e.exports=this.LP.dataControls}()},function(e,t){function n(e){return function(e){if(Array.isArray(e))return r(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return r(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}LP.Hook.addAction("lp-compatible-builder",(function(){LP.Hook.removeAction("lp-compatible-builder"),"undefined"!=typeof elementorFrontend&&n(document.querySelectorAll("#popup-content"))[0].addEventListener("scroll",(function(){Waypoint.refreshAll(),window.dispatchEvent(new Event("resize"))})),"undefined"!=typeof vc_js&&n(document.querySelectorAll("#popup-content"))[0].addEventListener("scroll",(function(){VcWaypoint.refreshAll()}))})),LP.Hook.addAction("lp-quiz-compatible-builder",(function(){return LP.Hook.removeAction("lp-quiz-compatible-builder"),LP.Hook.doAction("lp-compatible-builder"),"undefined"!=typeof elementorFrontend?window.elementorFrontend.init():"undefined"!=typeof vc_js?("undefined"!=typeof vc_round_charts&&vc_round_charts(),"undefined"!=typeof vc_pieChart&&vc_pieChart(),"undefined"!=typeof vc_line_charts&&vc_line_charts(),window.vc_js()):void 0})),LP.Hook.addAction("lp-question-compatible-builder",(function(){return LP.Hook.removeAction("lp-question-compatible-builder"),LP.Hook.removeAction("lp-quiz-compatible-builder"),LP.Hook.doAction("lp-compatible-builder"),"undefined"!=typeof elementorFrontend?window.elementorFrontend.init():"undefined"!=typeof vc_js?("undefined"!=typeof vc_round_charts&&vc_round_charts(),"undefined"!=typeof vc_pieChart&&vc_pieChart(),"undefined"!=typeof vc_line_charts&&vc_line_charts(),window.vc_js()):void 0}))},,,function(e,t,n){var r;
2
  /*!
3
  Copyright (c) 2018 Jed Watson.
4
  Licensed under the MIT License (MIT), see
5
  http://jedwatson.github.io/classnames
6
- */!function(){"use strict";var n={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var i=typeof r;if("string"===i||"number"===i)e.push(r);else if(Array.isArray(r)){if(r.length){var a=o.apply(null,r);a&&e.push(a)}}else if("object"===i)if(r.toString===Object.prototype.toString)for(var u in r)n.call(r,u)&&r[u]&&e.push(u);else e.push(r.toString())}}return e.join(" ")}e.exports?(o.default=o,e.exports=o):void 0===(r=function(){return o}.apply(t,[]))||(e.exports=r)}()},,,,,,,function(e,t,n){"use strict";n.r(t),n.d(t,"init",(function(){return qn}));var r={};n.r(r),n.d(r,"setQuizData",(function(){return vt})),n.d(r,"setCurrentQuestion",(function(){return Ot})),n.d(r,"setCurrentPage",(function(){return wt})),n.d(r,"__requestBeforeStartQuiz",(function(){return _t})),n.d(r,"__requestStartQuizSuccess",(function(){return jt})),n.d(r,"startQuiz",(function(){return Rt})),n.d(r,"__requestSubmitQuiz",(function(){return qt})),n.d(r,"__requestSubmitQuizSuccess",(function(){return St})),n.d(r,"submitQuiz",(function(){return Et})),n.d(r,"updateUserQuestionAnswers",(function(){return Pt})),n.d(r,"__requestShowHintSuccess",(function(){return kt})),n.d(r,"showHint",(function(){return zt})),n.d(r,"__requestCheckAnswerSuccess",(function(){return Qt})),n.d(r,"checkAnswer",(function(){return At})),n.d(r,"markQuestionRendered",(function(){return It})),n.d(r,"setQuizMode",(function(){return Nt})),n.d(r,"sendKey",(function(){return Ct}));var o={};n.r(o),n.d(o,"getQuestionOptions",(function(){return Ut})),n.d(o,"getItemStatus",(function(){return Mt})),n.d(o,"getProp",(function(){return Lt})),n.d(o,"getQuizAttempts",(function(){return Ht})),n.d(o,"getQuizAnswered",(function(){return Ft})),n.d(o,"getQuestions",(function(){return Bt})),n.d(o,"getData",(function(){return Kt})),n.d(o,"getDefaultRestArgs",(function(){return Wt})),n.d(o,"getQuestionAnswered",(function(){return Jt})),n.d(o,"getQuestionMark",(function(){return Zt})),n.d(o,"getCurrentQuestion",(function(){return $t})),n.d(o,"getQuestion",(function(){return Gt})),n.d(o,"isCheckedAnswer",(function(){return Yt})),n.d(o,"isCorrect",(function(){return Vt})),n.d(o,"getQuestionsSelectedAnswers",(function(){return Xt})),n.d(o,"getUserMark",(function(){return en}));var i=n(2),a=n(3),u=n(1),s=function(){var e=Object(u.select)("learnpress/quiz").getData("content");return React.createElement("div",{className:"quiz-content",dangerouslySetInnerHTML:{__html:e}})},c=n(0),l=function(e){var t;if(e>86400)t=(e-e%86400)/86400,e%=86400;else if(86400==e)return"24:00";var n=new Date(1e3*e).toUTCString().match(/\d{2}:\d{2}:\d{2}/)[0].split(":");return t&&(n[0]=parseInt(n[0])+24*t),n.join(":")},f=LP.Hook,p=function(){var e=function(e){return Object(u.select)("learnpress/quiz").getData(e)},t=f.applyFilters("quiz-meta-fields",{duration:{title:Object(c.__)("Duration:","learnpress"),name:"duration",content:l(e("duration"))||"--"},passingGrade:{title:Object(c.__)("Passing grade:","learnpress"),name:"passing-grade",content:e("passingGrade")||"--"},questionsCount:{title:Object(c.__)("Questions:","learnpress"),name:"questions-count",content:e("questionIds")?e("questionIds").length:0}});return t&&React.createElement(React.Fragment,null,React.createElement("ul",{className:"quiz-intro"},Object.values(t).map((function(e,t){var n=e.name||t;return React.createElement("li",{key:"quiz-intro-field-".concat(t),className:"quiz-intro-item quiz-intro-item--".concat(n)},React.createElement("div",{className:"quiz-intro-item__title",dangerouslySetInnerHTML:{__html:e.title}}),React.createElement("span",{className:"quiz-intro-item__content",dangerouslySetInnerHTML:{__html:e.content}}))}))))};function d(e){return(d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function m(e){return function(e){if(Array.isArray(e))return b(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return b(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return b(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function b(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function y(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function h(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function g(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function v(e,t){return(v=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function O(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=j(e);if(t){var o=j(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return w(this,n)}}function w(e,t){return!t||"object"!==d(t)&&"function"!=typeof t?_(e):t}function _(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function j(e){return(j=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function R(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var q=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&v(e,t)}(i,e);var t,n,r,o=O(i);function i(){var e;h(this,i);for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return R(_(e=o.call.apply(o,[this].concat(n))),"startQuiz",(function(t){t&&t.preventDefault();var n=document.querySelector(".lp-button.start");n&&n.setAttribute("disabled","disabled");var r=e.props,o=r.startQuiz;if("completed"===r.status){var i=Object(u.select)("learnpress/modal"),a=i.confirm,s=i.isOpen;if("no"===a("Are you sure you want to retry quiz?",e.startQuiz))return void(!s()&&n&&n.removeAttribute("disabled"))}o()})),R(_(e),"nav",(function(t){return function(n){var r=e.props,o=r.questionNav,i=r.currentPage,a=r.numPages,u=r.setCurrentPage;switch(t){case"prev":i>1?i-=1:i="infinity"===o?a:1;break;default:i<a?i+=1:i="infinity"===o?1:a}u(i)}})),R(_(e),"moveTo",(function(t){return function(n){n.preventDefault();var r=e.props,o=r.numPages,i=r.setCurrentPage;t<1||t>o||i(t)}})),R(_(e),"isLast",(function(){var t=e.props;return t.currentPage===t.numPages})),R(_(e),"isFirst",(function(){return 1===e.props.currentPage})),R(_(e),"submit",(function(){var t=e.props.submitQuiz;"no"!==(0,Object(u.select)("learnpress/modal").confirm)(Object(c.__)("Are you sure to submit quiz?","learnpress"),e.submit)&&t()})),R(_(e),"setQuizMode",(function(t){return function(){(0,e.props.setQuizMode)(t)}})),R(_(e),"isReviewing",(function(){return e.props.isReviewing})),e}return t=i,(n=[{key:"pageNumbers",value:function(e){var t=this,n=this.props,r=n.numPages,o=n.currentPage;if(r<2)return"";(e=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?y(Object(n),!0).forEach((function(t){R(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):y(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({numPages:r,currentPage:o,midSize:1,endSize:1,prevNext:!0},e||{})).endSize<1&&(e.endSize=1),e.midSize<0&&(e.midSize=1);var i=m(Array(r).keys()),a=!1;return React.createElement("div",{className:"nav-links"},e.prevNext&&!this.isFirst()&&React.createElement("button",{className:"page-numbers prev","data-type":"question-navx",onClick:this.nav("prev")},Object(c.__)("Prev","learnpress")),i.map((function(n){return(n+=1)===e.currentPage?(a=!0,React.createElement("span",{key:"page-number-".concat(n),className:"page-numbers current"},n)):n<=e.endSize||e.currentPage&&n>=e.currentPage-e.midSize&&n<=e.currentPage+e.midSize||n>e.numPages-e.endSize?(a=!0,React.createElement("button",{key:"page-number-".concat(n),className:"page-numbers",onClick:t.moveTo(n)},n)):a?(a=!1,React.createElement("span",{key:"page-number-".concat(n),className:"page-numbers dots"},"…")):""})),e.prevNext&&!this.isLast()&&React.createElement("button",{className:"page-numbers next","data-type":"question-navx",onClick:this.nav("next")},Object(c.__)("Next","learnpress")))}},{key:"render",value:function(){var e=this.props,t=e.status,n=e.questionNav,r=e.isReviewing,o=e.showReview,i=e.numPages,a=(e.question,e.questionsPerPage,e.canRetry),u=e.retakeNumber,s=["quiz-buttons"];("started"===t||r)&&s.push("align-center"),"questionNav"===n&&s.push("infinity"),this.isFirst()&&s.push("is-first"),this.isLast()&&s.push("is-last");var l=document.querySelector("#popup-sidebar"),f=document.querySelector("#learn-press-quiz-app"),p="";return p="started"===t||r?{marginLeft:l&&l.offsetWidth/2,width:f&&f.offsetWidth}:null,React.createElement(React.Fragment,null,React.createElement("div",{className:s.join(" ")},React.createElement("div",{className:"button-left"+("started"===t||r?" fixed":""),style:p},("completed"===t&&a||-1!==["","viewed"].indexOf(t))&&!r&&React.createElement("button",{className:"lp-button start",onClick:this.startQuiz},"completed"===t?"".concat(Object(c._x)("Retake","label button retry quiz","learnpress")).concat(u?" (".concat(u,")"):""):Object(c._x)("Start","label button start quiz","learnpress")),("started"===t||r)&&i>1&&React.createElement(React.Fragment,null,React.createElement("div",{className:"questions-pagination"},this.pageNumbers()))),React.createElement("div",{className:"button-right"},"started"===t&&React.createElement(React.Fragment,null,("infinity"===n||this.isLast())&&!r&&React.createElement("button",{className:"lp-button submit-quiz",onClick:this.submit},Object(c.__)("Finish Quiz","learnpress"))),r&&o&&React.createElement("button",{className:"lp-button back-quiz",onClick:this.setQuizMode("")},Object(c.__)("Result","learnpress")),"completed"===t&&o&&!r&&React.createElement("button",{className:"lp-button review-quiz",onClick:this.setQuizMode("reviewing")},Object(c.__)("Review","learnpress")))),this.props.message&&!0!==this.props.success&&React.createElement("div",{className:"learn-press-message error"},this.props.message))}}])&&g(t.prototype,n),r&&g(t,r),i}(i.Component),S=Object(a.compose)(Object(u.withSelect)((function(e){var t=e("learnpress/quiz").getData;return{status:t("status"),showCheck:t("instantCheck"),checkedQuestions:t("checkedQuestions"),hintedQuestions:t("hintedQuestions"),questionsPerPage:t("questionsPerPage")}})))((function(e){var t=e.showCheck,n=e.checkedQuestions,r=e.hintedQuestions,o=e.question,i=e.status,a=e.type,u=e.Button;if("started"!==i)return!1;var s=React.createElement(u,{question:o});switch(a){case"hint":return r?!!o.hasHint&&(-1===r.indexOf(o.id)&&s):s;case"check":return!!t&&(n?-1===n.indexOf(o.id)&&s:s)}})),E=Object(a.compose)([Object(u.withSelect)((function(e){var t=e("learnpress/quiz"),n=t.getData,r=t.getCurrentQuestion,o={id:n("id"),status:n("status"),questionIds:n("questionIds"),questionNav:n("questionNav"),isReviewing:n("reviewQuestions")&&"reviewing"===n("mode"),showReview:n("reviewQuestions"),showCheck:n("instantCheck"),checkedQuestions:n("checkedQuestions"),hintedQuestions:n("hintedQuestions"),numPages:n("numPages"),pages:n("pages"),currentPage:n("currentPage"),questionsPerPage:n("questionsPerPage"),pageNumbers:n("pageNumbers"),keyPressed:n("keyPressed"),canRetry:n("retakeCount")>0&&n("retaken")<n("retakeCount"),retakeNumber:n("retakeCount")>0&&n("retaken")<n("retakeCount")?n("retakeCount")-n("retaken"):null,message:n("messageResponse")||!1,success:void 0===n("successResponse")||n("successResponse")};return 1===o.questionsPerPage&&(o.question=r("object")),o})),Object(u.withDispatch)((function(e,t){t.id;var n=e("learnpress/quiz"),r=n.startQuiz,o=n.setCurrentQuestion,i=n.submitQuiz,a=n.setQuizMode,u=n.showHint,s=n.checkAnswer;return{startQuiz:r,setCurrentQuestion:o,setQuizMode:a,setCurrentPage:n.setCurrentPage,submitQuiz:function(e){i(e)},showHint:function(e){u(e)},checkAnswer:function(e){s(e)}}}))])(q);function P(e){return(P="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function k(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function z(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Q(e,t){return(Q=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function A(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=C(e);if(t){var o=C(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return I(this,n)}}function I(e,t){return!t||"object"!==P(t)&&"function"!=typeof t?N(e):t}function N(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function C(e){return(C=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function T(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var x=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Q(e,t)}(i,e);var t,n,r,o=A(i);function i(){var e;k(this,i);for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return T(N(e=o.call.apply(o,[this].concat(n))),"showHint",(function(){var t=e.props,n=t.showHint,r=t.question;n(r.id,!r.showHint)})),e}return t=i,(n=[{key:"render",value:function(){return this.props.question.hint?React.createElement("button",{className:"btn-show-hint",onClick:this.showHint},React.createElement("span",null,Object(c.__)("Hint","learnpress"))):""}}])&&z(t.prototype,n),r&&z(t,r),i}(i.Component),D=Object(a.compose)(Object(u.withDispatch)((function(e,t){t.id;var n=e("learnpress/quiz").showHint;return{showHint:function(e,t){n(e,t)}}})))(x),U=n(11),M=n.n(U);function L(e){return(L="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function H(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function F(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function B(e,t){return(B=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function K(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=Z(e);if(t){var o=Z(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return W(this,n)}}function W(e,t){return!t||"object"!==L(t)&&"function"!=typeof t?J(e):t}function J(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Z(e){return(Z=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function $(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var G=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&B(e,t)}(i,e);var t,n,r,o=K(i);function i(){var e;return H(this,i),$(J(e=o.apply(this,arguments)),"checkAnswer",(function(){var t=e.props,n=t.checkAnswer,r=t.question;t.answered&&(n(r.id),e.setState({loading:!0}))})),e.state={loading:!1},e}return t=i,(n=[{key:"render",value:function(){var e=this.props.answered;return React.createElement(React.Fragment,null,React.createElement("button",{className:M()("lp-button","instant-check",{loading:this.state.loading,disable:!e}),onClick:this.checkAnswer},React.createElement("span",{className:"instant-check__icon"}),Object(c._x)("Check answer","label of button check answer","learnpress"),!e&&React.createElement("div",{className:"instant-check__info",dangerouslySetInnerHTML:{__html:Object(c.__)("You need to answer the question before check answer.","learnpress")}})))}}])&&F(t.prototype,n),r&&F(t,r),i}(i.Component),Y=Object(a.compose)(Object(u.withSelect)((function(e,t){var n=t.question.id;return{answered:(0,e("learnpress/quiz").getQuestionAnswered)(n)}})),Object(u.withDispatch)((function(e,t){t.id;var n=e("learnpress/quiz").checkAnswer;return{checkAnswer:function(e){n(e)}}})))(G),V=function(e){var t=e.question,n={"instant-check":function(){return React.createElement(S,{type:"check",Button:Y,question:t})},hint:function(){return React.createElement(S,{type:"hint",Button:D,question:t})}};return React.createElement(React.Fragment,null,LP.config.questionFooterButtons().map((function(e){return React.createElement(i.Fragment,{key:"button-".concat(e)},n[e]&&n[e]())})))};function X(e){return(X="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ee(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function te(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ee(Object(n),!0).forEach((function(t){ce(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ee(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ne(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function re(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function oe(e,t){return(oe=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ie(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=se(e);if(t){var o=se(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return ae(this,n)}}function ae(e,t){return!t||"object"!==X(t)&&"function"!=typeof t?ue(e):t}function ue(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function se(e){return(se=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ce(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var le=window.jQuery,fe=lodash,pe=(fe.uniqueId,fe.isArray),de=(fe.isNumber,fe.bind,function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&oe(e,t)}(a,e);var t,n,r,o=ie(a);function a(){var e;return ne(this,a),ce(ue(e=o.apply(this,arguments)),"setRef",(function(t){e.$wrap=le(t)})),ce(ue(e),"parseOptions",(function(e){return e&&(e=pe(e)?e:JSON.parse(CryptoJS.AES.decrypt(e.data,e.key,{format:CryptoJSAesJson}).toString(CryptoJS.enc.Utf8)),e=pe(e)?e:JSON.parse(e)),e||[]})),ce(ue(e),"getWrapperClass",(function(){var t=e.props,n=t.question,r=(t.answered,["question","question-"+n.type]),o=e.parseOptions(n.options);return o.length&&void 0!==o[0].isTrue&&r.push("question-answered"),r})),ce(ue(e),"getEditLink",(function(){var t=e.props,n=t.question,r=t.editPermalink;return r?r.replace(/post=([0-9]{3,4})/,"post=".concat(n.id)):""})),ce(ue(e),"editPermalink",(function(e){return Object(c.sprintf)('<a href="%s">%s</a>',e,Object(c.__)("Edit","learnpress"))})),e.state={time:null,showHint:!1},e.$wrap=null,e}return t=a,(n=[{key:"componentDidMount",value:function(e){var t=this.props,n=t.question,r=t.isCurrent,o=t.markQuestionRendered;return r&&o(n.id),this.state.time||this.setState({time:new Date}),LP.Hook.doAction("lp-question-compatible-builder"),e}},{key:"render",value:function(){var e=this,t=this.props,n=t.question,r=t.isShow,o=t.isShowIndex,a=(t.isShowHint,t.status),u=LP.questionTypes.default,s=this.getEditLink();s&&jQuery("#wp-admin-bar-edit-lp_question").find(".ab-item").attr("href",s);var l={index:function(){return o?React.createElement("span",{className:"question-index"},o,"."):""},title:function(){return n.title},hint:function(){return React.createElement(D,{question:n})},"edit-permalink":function(){return s&&React.createElement("span",{dangerouslySetInnerHTML:{__html:e.editPermalink(s)},className:"edit-link"})}},f={title:function(){return React.createElement("h4",{className:"question-title"},LP.config.questionTitleParts().map((function(e){return React.createElement(i.Fragment,{key:"title-part-".concat(e)},l[e]&&l[e]())})))},content:function(){return React.createElement("div",{className:"question-content",dangerouslySetInnerHTML:{__html:n.content}})},"answer-options":function(){return e.$wrap&&React.createElement(u,te(te({},e.props),{},{$wrap:e.$wrap}))},explanation:function(){return n.explanation&&React.createElement(React.Fragment,null,React.createElement("div",{className:"question-explanation-content"},React.createElement("strong",{className:"explanation-title"},Object(c.__)("Explanation:","learnpress")),React.createElement("div",{dangerouslySetInnerHTML:{__html:n.explanation}})))},hint:function(){return n.hint&&!n.explanation&&n.showHint&&React.createElement(React.Fragment,null,React.createElement("div",{className:"question-hint-content"},React.createElement("strong",{className:"hint-title"},Object(c.__)("Hint:","learnpress")),React.createElement("div",{dangerouslySetInnerHTML:{__html:n.hint}})))},buttons:function(){return"started"===a&&React.createElement(V,{question:n})}},p=LP.config.questionBlocks();return React.createElement(React.Fragment,null,React.createElement("div",{className:this.getWrapperClass().join(" "),style:{display:r?"":"none"},"data-id":n.id,ref:this.setRef},p.map((function(e){return React.createElement(i.Fragment,{key:"block-".concat(e)},f[e]?f[e]():"")}))))}}])&&re(t.prototype,n),r&&re(t,r),a}(i.Component)),me=Object(a.compose)([Object(u.withSelect)((function(e,t){var n=t.question.id,r=e("learnpress/quiz"),o=r.getData,i=r.getQuestionAnswered,a=r.getQuestionMark;return{status:o("status"),questions:o("question"),answered:i(n),questionsRendered:o("questionsRendered"),editPermalink:o("editPermalink"),numPages:o("numPages"),mark:a(n)||""}})),Object(u.withDispatch)((function(e){var t=e("learnpress/quiz"),n=t.updateUserQuestionAnswers;return{markQuestionRendered:t.markQuestionRendered,updateUserQuestionAnswers:n}}))])(de);function be(e){return(be="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ye(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function he(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ge(e,t){return(ge=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ve(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=_e(e);if(t){var o=_e(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return Oe(this,n)}}function Oe(e,t){return!t||"object"!==be(t)&&"function"!=typeof t?we(e):t}function we(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _e(e){return(_e=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function je(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Re=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ge(e,t)}(i,e);var t,n,r,o=ve(i);function i(e){var t;return ye(this,i),je(we(t=o.apply(this,arguments)),"startQuiz",(function(e){e.preventDefault(),(0,t.props.startQuiz)()})),je(we(t),"isInVisibleRange",(function(e,n){var r=t.props,o=r.currentPage,i=r.questionsPerPage;return o===Math.ceil(n/i)})),je(we(t),"nav",(function(e){var n=t.props.sendKey;switch(e.keyCode){case 37:return n("left");case 38:return;case 39:return n("right");case 40:return;default:e.keyCode>=49&&e.keyCode<=57&&n(e.keyCode-48)}})),t.needToTop=!1,t.state={isReviewing:null,currentPage:0,self:we(t)},t}return t=i,r=[{key:"getDerivedStateFromProps",value:function(e,t){for(var n=["isReviewing","currentPage"],r={},o=0;o<n.length;o++)e[n[o]]!==t[n[o]]&&(r[n[o]]=e[n[o]]);return Object.values(r).length?(t.self.needToTop=!0,r):null}}],(n=[{key:"componentDidUpdate",value:function(){this.needToTop&&(jQuery("#popup-content").animate({scrollTop:0}).find(".content-item-scrollable:last").animate({scrollTop:0}),this.needToTop=!1)}},{key:"render",value:function(){var e=this,t=this.props,n=t.status,r=t.currentQuestion,o=t.questions,i=t.questionsRendered,a=t.isReviewing,u=t.questionsPerPage,s=!0;return"completed"!==n||a||(s=!1),React.createElement(React.Fragment,null,React.createElement("div",{tabIndex:100,onKeyUp:this.nav},React.createElement("div",{className:"quiz-questions",style:{display:s?"":"none"}},o.map((function(t,n){var o=!u&&r===t.id,a=i&&-1!==i.indexOf(t.id),s=e.isInVisibleRange(t.id,n+1);return a||!a||s?React.createElement(me,{key:"loop-question-".concat(t.id),isCurrent:o,isShow:s,isShowIndex:!!u&&n+1,questionsPerPage:u,question:t}):""})))))}}])&&he(t.prototype,n),r&&he(t,r),i}(i.Component),qe=Object(a.compose)(Object(u.withSelect)((function(e,t,n){var r=e("learnpress/quiz"),o=r.getData,i=r.getQuestions;return{status:o("status"),currentQuestion:o("currentQuestion"),questions:i(),questionsRendered:o("questionsRendered"),isReviewing:"reviewing"===o("mode"),numPages:o("numPages"),currentPage:o("currentPage"),questionsPerPage:o("questionsPerPage")||1}})),Object(u.withDispatch)((function(e){var t=e("learnpress/quiz");return{startQuiz:t.startQuiz,sendKey:t.sendKey}})))(Re),Se=function(){var e=Object(u.select)("learnpress/quiz").getData("attempts")||[],t=e&&!!e.length;return!!t&&React.createElement(React.Fragment,null,React.createElement("div",{className:"quiz-attempts"},React.createElement("h4",{className:"attempts-heading"},Object(c.__)("Last Attempted","learnpress")),t&&React.createElement("table",null,React.createElement("thead",null,React.createElement("tr",null,React.createElement("th",{className:"quiz-attempts__questions"},Object(c.__)("Questions","learnpress")),React.createElement("th",{className:"quiz-attempts__spend"},Object(c.__)("Time spend","learnpress")),React.createElement("th",{className:"quiz-attempts__marks"},Object(c.__)("Marks","learnpress")),React.createElement("th",{className:"quiz-attempts__grade"},Object(c.__)("Passing grade","learnpress")),React.createElement("th",{className:"quiz-attempts__result"},Object(c.__)("Result","learnpress")))),React.createElement("tbody",null,e.map((function(e,t){return React.createElement("tr",{key:"attempt-".concat(t)},React.createElement("td",{className:"quiz-attempts__questions"},"".concat(e.questionCorrect," / ").concat(e.questionCount)),React.createElement("td",{className:"quiz-attempts__spend"},e.timeSpend||"--"),React.createElement("td",{className:"quiz-attempts__marks"},"".concat(e.userMark," / ").concat(e.mark)),React.createElement("td",{className:"quiz-attempts__grade"},e.passingGrade||Object(c._x)("-","unknown passing grade value","learnpress")),React.createElement("td",{className:"quiz-attempts__result"},"".concat(parseFloat(e.result).toFixed(2),"%")," ",React.createElement("span",null,e.graduationText)))}))))))};function Ee(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,o=!1,i=void 0;try{for(var a,u=e[Symbol.iterator]();!(r=(a=u.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{r||null==u.return||u.return()}finally{if(o)throw i}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Pe(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Pe(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Pe(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var ke=function(){var e=Object(u.select)("learnpress/quiz").getData,t=Object(u.dispatch)("learnpress/quiz").submitQuiz,n=e("totalTime")?e("totalTime"):e("duration"),r=e("endTime"),o=new Date(r.replace(/-/g,"/")),a=new Date,s=(new Date).getTimezoneOffset(),c=parseInt(o.getTime()/1e3-(a.getTime()/1e3+60*s)),l=Ee(Object(i.useState)(c>0?c:0),2),f=l[0],p=l[1];Object(i.useEffect)((function(){var e=setInterval((function(){var n=f;(n-=1)>0?p(n):(clearInterval(e),t())}),1e3);return function(){return clearInterval(e)}}),[f]);return React.createElement("div",{className:"countdown"},React.createElement("i",{className:"fas fa-stopwatch"}),React.createElement("span",null,function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:":",r=[];return n<3600?(r.push((f-f%60)/60),r.push(f%60)):n&&(r.push((f-f%3600)/3600),e=f%3600,r.push((e-e%60)/60),r.push(e%60)),r.map((function(e){return e<10?"0".concat(e):e})).join(t)}()))};function ze(e){return function(e){if(Array.isArray(e))return Ie(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||Ae(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Qe(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,o=!1,i=void 0;try{for(var a,u=e[Symbol.iterator]();!(r=(a=u.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{r||null==u.return||u.return()}finally{if(o)throw i}}return n}(e,t)||Ae(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ae(e,t){if(e){if("string"==typeof e)return Ie(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ie(e,t):void 0}}function Ie(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Ne=lodash.debounce,Ce=function(){var e=Qe(Object(i.useState)(0),2),t=e[0],n=e[1],r=Qe(Object(i.useState)(!1),2),o=r[0],a=r[1],s=Object(u.useSelect)((function(e){return e("learnpress/quiz").getData("results")}),[]),l=Object(u.useSelect)((function(e){return e("learnpress/quiz").getData("passingGrade")}),[]),f=Object(u.useSelect)((function(e){return e("learnpress/quiz").getData("id")}),[]);Object(i.useEffect)((function(){p();var e="";if(e=s.graduation?s.graduation:s.result>=h.replace(/[^0-9\.]+/g,"")?"passed":"failed"){var t=document.querySelector(".course-curriculum .course-item.course-item-".concat(f));t&&(t.classList.remove("failed","passed"),t.classList.add("has-status","status-completed",e))}var n=ze(document.querySelectorAll("#popup-header .items-progress"))[0];if(n){var r=n.querySelector(".items-completed");if(r){parseInt(r.textContent);var o=document.querySelectorAll("#popup-sidebar .course-curriculum .course-item.status-completed");r.textContent=parseInt(o.length)}}}),[s]);var p=function(){n(0),a(!1),jQuery.easing._customEasing=function(e,t,n,r,o){return r*Math.sqrt(1-(t=t/o-1)*t)+n},Ne((function(){var e=jQuery("<span />").css({width:1,height:1}).appendTo(document.body);e.css("left",0).animate({left:s.result},{duration:1500,step:function(e,t){n(e)},done:function(){a(!0),e.remove(),jQuery("#quizResultGrade").css({transform:"scale(1.3)",transition:"all 0.25s"}),Ne((function(){jQuery("#quizResultGrade").css({transform:"scale(1)"})}),500)()},easing:"_customEasing"})}),s.result>0?1e3:10)()},d=t;Number.isInteger(t)||(d=parseFloat(t).toFixed(2));var m=190*Math.PI,b=m-d/100*m,y={strokeDasharray:"".concat(m," ").concat(m),strokeDashoffset:b},h=s.passingGrade||l,g="";g=s.graduation?s.graduation:d>=h.replace(/[^0-9\.]+/g,"")?"passed":"failed";var v="";v=s.graduationText?s.graduationText:"passed"===g?Object(c.__)("Passed","learnpress"):Object(c.__)("Failed","learnpress");var O=["quiz-result",g];return React.createElement("div",{className:O.join(" ")},React.createElement("h3",{className:"result-heading"},Object(c.__)("Your Result","learnpress")),React.createElement("div",{id:"quizResultGrade",className:"result-grade"},React.createElement("svg",{className:"circle-progress-bar",width:200,height:200},React.createElement("circle",{className:"circle-progress-bar__circle",stroke:"",strokeWidth:10,style:y,fill:"transparent",r:95,cx:100,cy:100})),React.createElement("span",{className:"result-achieved"},"".concat(d,"%")),React.createElement("span",{className:"result-require"},h||Object(c._x)("-","unknown passing grade value","learnpress"))),o&&React.createElement("p",{className:"result-message"},v),React.createElement("ul",{className:"result-statistic"},React.createElement("li",{className:"result-statistic-field result-time-spend"},React.createElement("span",null,Object(c.__)("Time spend","learnpress")),React.createElement("p",null,s.timeSpend)),React.createElement("li",{className:"result-statistic-field result-point"},React.createElement("span",null,Object(c.__)("Point","learnpress")),React.createElement("p",null,s.userMark," / ",s.mark)),React.createElement("li",{className:"result-statistic-field result-questions"},React.createElement("span",null,Object(c.__)("Questions","learnpress")),React.createElement("p",null,s.questionCount)),React.createElement("li",{className:"result-statistic-field result-questions-correct"},React.createElement("span",null,Object(c.__)("Correct","learnpress")),React.createElement("p",null,s.questionCorrect)),React.createElement("li",{className:"result-statistic-field result-questions-wrong"},React.createElement("span",null,Object(c.__)("Wrong","learnpress")),React.createElement("p",null,s.questionWrong)),React.createElement("li",{className:"result-statistic-field result-questions-skipped"},React.createElement("span",null,Object(c.__)("Skipped","learnpress")),React.createElement("p",null,s.questionEmpty))))},Te=jQuery,xe=lodash.debounce,De=function(){var e=Object(u.dispatch)("learnpress/quiz").submitQuiz;Object(i.useEffect)((function(){var e=Te("#popup-content");if(e.length){var t=e.find(".content-item-scrollable:eq(1)"),n=e.find(".content-item-wrap"),r=e.find(".quiz-status"),o=r.offset().top-92,i=!1,a="-"+n.css("margin-left");Te(window).on("resize.refresh-quiz-stauts-bar",xe((function(){a="-"+n.css("margin-left"),r.css({"margin-left":a,"margin-right":a})}),100)).trigger("resize.refresh-quiz-stauts-bar"),t.on("scroll",(function(){if(t.scrollTop()>=o){if(i)return;i=!0}else{if(!i)return;i=!1}i?e.addClass("fixed-quiz-status"):e.removeClass("fixed-quiz-status")}))}}),[]);var t=Object(u.select)("learnpress/quiz"),n=t.getData,r=t.getUserMark,o=n("currentPage"),a=n("questionsPerPage"),s=n("questionIds").length,l=n("submitting"),f=n("totalTime"),p=n("duration"),d=r(),m=["quiz-status"],b=(o-1)*a+1,y=b+a-1,h="";return y=Math.min(y,s),l&&m.push("submitting"),h=y<s?a>1?Object(c.sprintf)(Object(c.__)("Question <span>%d to %d of %d</span>","learnpress"),b,y,s):Object(c.sprintf)(Object(c.__)("Question <span>%d of %d</span>","learnpress"),b,s):Object(c.sprintf)(Object(c.__)("Question <span>%d to %d</span>","learnpress"),b,y),React.createElement("div",{className:m.join(" ")},React.createElement("div",null,React.createElement("div",{className:"questions-index",dangerouslySetInnerHTML:{__html:h}}),React.createElement("div",{className:"current-point"},Object(c.sprintf)(Object(c.__)("Earned Point: %s","learnpress"),d)),React.createElement("div",null,React.createElement("div",{className:"submit-quiz"},React.createElement("button",{className:"lp-button",id:"button-submit-quiz",onClick:function t(){"no"!==(0,Object(u.select)("learnpress/modal").confirm)(Object(c.__)("Are you sure to submit quiz?","learnpress"),t)&&e()}},l?Object(c.__)("Submitting...","learnpress"):Object(c.__)("Finish Quiz","learnpress"))),f&&p&&React.createElement(ke,null))))};function Ue(e){return function(e){if(Array.isArray(e))return Me(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return Me(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Me(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Me(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Le(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function He(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Le(Object(n),!0).forEach((function(t){Fe(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Le(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Fe(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Be=lodash,Ke=(Be.omit,Be.flow),We=Be.isArray,Je=Be.chunk,Ze=(LP.camelCaseDashObjectKeys,LP.localStorage),$e=Ze.get,Ge=Ze.set,Ye={},Ve=function(e,t){var n=He(He({},e.answered[t.questionId]||{}),{},{answered:t.answers,temp:!0});return He(He({},e),{},{answered:He(He({},e.answered),{},Fe({},t.questionId,n))})},Xe=function(e,t){var n=e.questionsRendered;return We(n)?(n.push(t.questionId),He(He({},e),{},{questionsRendered:Ue(n)})):He(He({},e),{},{questionsRendered:[t.questionId]})},et=function(e,t){return t.currentPage&&Ge("Q".concat(e.id,".currentPage"),t.currentPage),He(He({},e),t)},tt=function(e,t){var n=e.questions.map((function(e){return e.id==t.questionId?He(He({},e),{},{showHint:t.showHint}):e}));return He(He({},e),{},{questions:Ue(n)})},nt=function(e,t){var n=e.questions.map((function(e){if(e.id!==t.questionId)return e;var n={explanation:t.explanation};return t.options&&(n.options=t.options),He(He({},e),n)}));return He(He({},e),{},{questions:Ue(n),answered:He(He({},e.answered),{},Fe({},t.questionId,t.result)),checkedQuestions:[].concat(Ue(e.checkedQuestions),[t.questionId])})},rt=function(e,t){var n=e.questions.map((function(n){var r={};return e.reviewQuestions&&(t.results.questions[n.id].explanation&&(r.explanation=t.results.questions[n.id].explanation),t.results.questions[n.id].options&&(r.options=t.results.questions[n.id].options)),He(He({},n),r)}));return et(e,He(He({submitting:!1,currentPage:1},t.results),{},{questions:Ue(n)}))},ot=function(e,t){var n=void 0!==t.results.success&&t.results.success,r=t.results.message||!1;return et(e,He(He({checkedQuestions:[],hintedQuestions:[],mode:"",currentPage:1},t.results.results),{},{successResponse:n,messageResponse:r}))},it=Ke(u.combineReducers,(function(e){return function(t,n){return e(t,n)}}),(function(e){return function(t,n){return e(t,n)}}),(function(e){return function(t,n){return e(t,n)}}))({a:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{a:1};return e},b:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{b:2};return e}}),at=Object(u.combineReducers)({blocks:it,userQuiz:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ye,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"SET_QUIZ_DATA":1>t.data.questionsPerPage&&(t.data.questionsPerPage=1);var n=Je(e.questionIds||t.data.questionIds,t.data.questionsPerPage);return t.data.numPages=n.length,t.data.pages=n,He(He(He({},e),t.data),{},{currentPage:$e("Q".concat(t.data.id,".currentPage"))||t.data.currentPage});case"SUBMIT_QUIZ":return He(He({},e),{},{submitting:!0});case"START_QUIZ":case"START_QUIZ_SUCCESS":return ot(e,t);case"SET_CURRENT_QUESTION":return Ge("Q".concat(e.id,".currentQuestion"),t.questionId),He(He({},e),{},{currentQuestion:t.questionId});case"SET_CURRENT_PAGE":return Ge("Q".concat(e.id,".currentPage"),t.currentPage),He(He({},e),{},{currentPage:t.currentPage});case"SUBMIT_QUIZ_SUCCESS":return rt(e,t);case"UPDATE_USER_QUESTION_ANSWERS":return"started"===e.status?Ve(e,t):e;case"MARK_QUESTION_RENDERED":return Xe(e,t);case"SET_QUIZ_MODE":return"reviewing"==t.mode?et(e,{mode:t.mode}):He(He({},e),{},{mode:t.mode});case"SET_QUESTION_HINT":return tt(e,t);case"CHECK_ANSWER":return nt(e,t);case"SEND_KEY":return He(He({},e),{},{keyPressed:t.keyPressed})}return e}}),ut=n(7);function st(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}var ct=regeneratorRuntime.mark(Et),lt=regeneratorRuntime.mark(zt),ft=regeneratorRuntime.mark(At);function pt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function dt(e){return function(e){if(Array.isArray(e))return mt(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return mt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return mt(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function mt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function bt(){var e=[].slice.call(arguments,2),t=Object(u.dispatch)(arguments[0]),n=arguments[1];t[n].apply(t,dt(e))}var yt=LP,ht=yt.camelCaseDashObjectKeys,gt=yt.Hook;function vt(e,t){return t="string"==typeof e?pt({},e,t):e,{type:"SET_QUIZ_DATA",data:ht(t)}}function Ot(e){return{type:"SET_CURRENT_QUESTION",questionId:e}}function wt(e){return{type:"SET_CURRENT_PAGE",currentPage:e}}function _t(e,t,n){return{type:"BEFORE_START_QUIZ"}}function jt(e,t,n,r){return gt.doAction("quiz-started",e,t,n,r),{type:"START_QUIZ_SUCCESS",quizId:t,courseId:n,userId:r,results:e}}var Rt=regeneratorRuntime.mark((function e(){var t,n,r,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=Object(u.select)("learnpress/quiz").getDefaultRestArgs(),n=t.itemId,r=t.courseId,!0===gt.applyFilters("before-start-quiz",!0,n,r)){e.next=4;break}return e.abrupt("return");case 4:return e.next=6,Object(ut.apiFetch)({path:"lp/v1/users/start-quiz",method:"POST",data:{item_id:n,course_id:r}});case 6:return o=e.sent,o=gt.applyFilters("request-start-quiz-response",o,n,r),e.next=10,bt("learnpress/quiz","__requestStartQuizSuccess",ht(o),n,r);case 10:case"end":return e.stop()}}),e)}));function qt(){return{type:"SUBMIT_QUIZ"}}function St(e,t,n){return gt.doAction("quiz-submitted",e,t,n),{type:"SUBMIT_QUIZ_SUCCESS",results:e}}function Et(){var e,t,n,r,o,i,a,s;return regeneratorRuntime.wrap((function(c){for(;;)switch(c.prev=c.next){case 0:if(e=Object(u.select)("learnpress/quiz"),t=e.getDefaultRestArgs,n=e.getQuestionsSelectedAnswers,r=t(),o=r.itemId,i=r.courseId,!0===gt.applyFilters("before-submit-quiz",!0)){c.next=5;break}return c.abrupt("return");case 5:return a=n(),c.next=8,Object(ut.apiFetch)({path:"lp/v1/users/submit-quiz",method:"POST",data:{item_id:o,course_id:i,answered:a}});case 8:if(s=c.sent,!(s=gt.applyFilters("request-submit-quiz-response",s,o,i)).success){c.next=13;break}return c.next=13,bt("learnpress/quiz","__requestSubmitQuizSuccess",ht(s.results),o,i);case 13:case"end":return c.stop()}}),ct)}function Pt(e,t,n){return{type:"UPDATE_USER_QUESTION_ANSWERS",questionId:e,answers:t}}function kt(e,t){return{type:"SET_QUESTION_HINT",questionId:e,showHint:t}}function zt(e,t){return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,bt("learnpress/quiz","__requestShowHintSuccess",e,t);case 2:case"end":return n.stop()}}),lt)}function Qt(e,t){return function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?st(Object(n),!0).forEach((function(t){pt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):st(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({type:"CHECK_ANSWER",questionId:e},t)}function At(e){var t,n,r,o,i,a,s;return regeneratorRuntime.wrap((function(c){for(;;)switch(c.prev=c.next){case 0:return t=Object(u.select)("learnpress/quiz"),n=t.getDefaultRestArgs,r=t.getQuestionAnswered,o=n(),i=o.itemId,a=o.courseId,c.next=4,Object(ut.apiFetch)({path:"lp/v1/users/check-answer",method:"POST",data:{item_id:i,course_id:a,question_id:e,answered:r(e)||""}});case 4:return s=c.sent,c.next=7,bt("learnpress/quiz","__requestCheckAnswerSuccess",e,ht(s));case 7:case"end":return c.stop()}}),ft)}function It(e){return{type:"MARK_QUESTION_RENDERED",questionId:e}}function Nt(e){return{type:"SET_QUIZ_MODE",mode:e}}function Ct(e){return setTimeout((function(){bt("learnpress/quiz","sendKey","")}),300),{type:"SEND_KEY",keyPressed:e}}var Tt=lodash,xt=Tt.get,Dt=Tt.isArray,Ut=function(e,t){console.time("parseOptions");var n=Gt(e,t).options;return n=Dt(n)?n:JSON.parse(CryptoJS.AES.decrypt(n.data,n.key,{format:CryptoJSAesJson}).toString(CryptoJS.enc.Utf8)),n=Dt(n)?n:JSON.parse(n),console.timeEnd("parseOptions"),n};function Mt(e,t){var n=Object(u.select)("course-learner/user").getItemById(t);return n?xt(n,"userSettings.status"):""}function Lt(e,t,n){return e[t]||n}function Ht(e,t){var n=Object(u.select)("course-learner/user").getItemById(t);return n?xt(n,"userSettings.attempts"):[]}function Ft(e,t){var n=Object(u.select)("course-learner/user").getItemById(t);return n?xt(n,"userSettings.answered",{}):{}}function Bt(e){var t=e.userQuiz,n=xt(t,"questions");return n?Object.values(n):[]}function Kt(e,t){var n=e.userQuiz;return t?xt(n,t):n}function Wt(e){var t=e.userQuiz;return{itemId:t.id,courseId:t.courseId}}function Jt(e,t){var n=e.userQuiz;return xt(n,"answered.".concat(t,".answered"))||void 0}function Zt(e,t){var n=e.userQuiz;return xt(n,"answered.".concat(t,".mark"))||void 0}function $t(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=xt(e,"userQuiz.questionsPerPage")||1;if(n>1)return!1;var r=xt(e,"userQuiz.currentPage")||1;return xt(e,"object"===t?"userQuiz.questions[".concat(r-1,"]"):"userQuiz.questionIds[".concat(r-1,"]"))}var Gt=function(e,t){e.userQuiz;return Object(u.select)("learnpress/quiz").getQuestions().find((function(e){return e.id==t}))};function Yt(e,t){return-1!==(xt(e,"userQuiz.checkedQuestions")||[]).indexOf(t)}function Vt(e,t){}var Xt=function(e,t){var n=xt(e,"userQuiz.answered"),r={};for(var o in n)if(n.hasOwnProperty(o)&&(n[o].temp||n[o].blanks)){if(t&&o===t)return n[o].answered;r[o]=n[o].answered}return r};function en(e){var t=e.userQuiz||{},n=t.answered,r=t.negativeMarking,o=t.questions,i=t.checkedQuestions,a=0,u=function(e){if(!n.hasOwnProperty(e))return s=e,"continue";e=parseInt(e);var t,u=n[e],c=u.questionMark?u.questionMark:(t=o.find((function(t){return s=e,t.id===e})),s=e,t?t.point:0);i.indexOf(e);if(u.temp)return s=e,"continue";r?u.answered&&(a=u.correct?a+u.mark:a-c):u.answered&&u.correct&&(a+=u.mark),s=e};for(var s in n)u(s);return a>0?a:0}var tn=n(4),nn=n.n(tn),rn={ENROLL_COURSE_X:function(e,t){}};var on=function(e){var t=function(){throw new Error("Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")},n={getState:e.getState,dispatch:function(){return t.apply(void 0,arguments)}};return t=nn()(rn)(n)(e.dispatch),e.dispatch=t,e};function an(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function un(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var sn=LP.dataControls.controls,cn=Object(u.registerStore)("learnpress/quiz",{reducer:at,selectors:o,actions:r,controls:function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?an(Object(n),!0).forEach((function(t){un(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):an(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},sn)});on(cn);function ln(e){return(ln="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function fn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function pn(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function dn(e,t){return(dn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function mn(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=hn(e);if(t){var o=hn(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return bn(this,n)}}function bn(e,t){return!t||"object"!==ln(t)&&"function"!=typeof t?yn(e):t}function yn(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function hn(e){return(hn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function gn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var vn=lodash.chunk,On=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&dn(e,t)}(i,e);var t,n,r,o=mn(i);function i(e){var t;return fn(this,i),gn(yn(t=o.apply(this,arguments)),"startQuiz",(function(e){t.props.startQuiz()})),t.state={currentPage:1,numPages:0,pages:[]},t}return t=i,(n=[{key:"componentDidMount",value:function(){var e=this.props,t=e.settings,n=e.setQuizData,r=t.question_ids,o=t.questions_per_page,i=vn(r,o);t.currentPage=1,t.numPages=i.length,t.pages=i,n(t)}},{key:"render",value:function(){var e=this.props,t=e.status,n=e.isReviewing,r=-1!==["","completed","viewed"].indexOf(t)||!t,o=-1!==["","viewed",void 0].indexOf(t)||!t;return void 0!==t&&React.createElement(React.Fragment,null,React.createElement("div",null,!n&&"completed"===t&&React.createElement(Ce,null),!n&&o&&React.createElement(p,null),!n&&o&&React.createElement(s,null),"started"===t&&React.createElement(De,null),(-1!==["completed","started"].indexOf(t)||n)&&React.createElement(qe,null),React.createElement(E,null),r&&!n&&React.createElement(Se,null)))}}])&&pn(t.prototype,n),r&&pn(t,r),i}(i.Component),wn=Object(a.compose)([Object(u.withSelect)((function(e){var t=e("learnpress/quiz"),n=t.getQuestions,r=t.getData;return{questions:n(),status:r("status"),store:r(),answered:r("answered"),isReviewing:"reviewing"===r("mode"),questionIds:r("questionIds"),checkCount:r("instantCheck"),questionsPerPage:r("questionsPerPage")||1}})),Object(u.withDispatch)((function(e){var t=e("learnpress/quiz");return{setQuizData:t.setQuizData,startQuiz:t.startQuiz}}))])(On);n(8);function _n(e){return function(e){if(Array.isArray(e))return jn(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return jn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return jn(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function jn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Rn=LP.modal.default,qn=(t.default=wn,function(e,t){wp.element.render(React.createElement(Rn,null,React.createElement(wn,{settings:t})),_n(document.querySelectorAll(e))[0]),LP.Hook.doAction("lp-quiz-compatible-builder")})}]);
1
+ this.LP=this.LP||{},this.LP.quiz=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=18)}([function(e,t){e.exports=window.wp.i18n},function(e,t){e.exports=window.wp.data},function(e,t){e.exports=window.wp.element},function(e,t){e.exports=window.wp.compose},function(e,t,n){"use strict";e.exports=function(e){var t,n={};return function e(t,n){var r;if(Array.isArray(n))for(r=0;r<n.length;r++)e(t,n[r]);else for(r in n)t[r]=(t[r]||[]).concat(n[r])}(n,e),(t=function(e){return function(t){return function(r){var o,i,a=n[r.type],u=t(r);if(a)for(o=0;o<a.length;o++)(i=a[o](r,e))&&e.dispatch(i);return u}}}).effects=n,t}},,,function(e,t){!function(){e.exports=this.LP.dataControls}()},function(e,t){function n(e){return function(e){if(Array.isArray(e))return r(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return r(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}LP.Hook.addAction("lp-compatible-builder",(function(){LP.Hook.removeAction("lp-compatible-builder"),"undefined"!=typeof elementorFrontend&&n(document.querySelectorAll("#popup-content"))[0].addEventListener("scroll",(function(){Waypoint.refreshAll(),window.dispatchEvent(new Event("resize"))})),"undefined"!=typeof vc_js&&"undefined"!=typeof VcWaypoint&&n(document.querySelectorAll("#popup-content"))[0].addEventListener("scroll",(function(){VcWaypoint.refreshAll()}))})),LP.Hook.addAction("lp-quiz-compatible-builder",(function(){return LP.Hook.removeAction("lp-quiz-compatible-builder"),LP.Hook.doAction("lp-compatible-builder"),"undefined"!=typeof elementorFrontend?window.elementorFrontend.init():"undefined"!=typeof vc_js?("undefined"!=typeof vc_round_charts&&vc_round_charts(),"undefined"!=typeof vc_pieChart&&vc_pieChart(),"undefined"!=typeof vc_line_charts&&vc_line_charts(),window.vc_js()):void 0})),LP.Hook.addAction("lp-question-compatible-builder",(function(){return LP.Hook.removeAction("lp-question-compatible-builder"),LP.Hook.removeAction("lp-quiz-compatible-builder"),LP.Hook.doAction("lp-compatible-builder"),"undefined"!=typeof elementorFrontend?window.elementorFrontend.init():"undefined"!=typeof vc_js?("undefined"!=typeof vc_round_charts&&vc_round_charts(),"undefined"!=typeof vc_pieChart&&vc_pieChart(),"undefined"!=typeof vc_line_charts&&vc_line_charts(),window.vc_js()):void 0}))},,,function(e,t,n){var r;
2
  /*!
3
  Copyright (c) 2018 Jed Watson.
4
  Licensed under the MIT License (MIT), see
5
  http://jedwatson.github.io/classnames
6
+ */!function(){"use strict";var n={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var i=typeof r;if("string"===i||"number"===i)e.push(r);else if(Array.isArray(r)){if(r.length){var a=o.apply(null,r);a&&e.push(a)}}else if("object"===i)if(r.toString===Object.prototype.toString)for(var u in r)n.call(r,u)&&r[u]&&e.push(u);else e.push(r.toString())}}return e.join(" ")}e.exports?(o.default=o,e.exports=o):void 0===(r=function(){return o}.apply(t,[]))||(e.exports=r)}()},,,,,,,function(e,t,n){"use strict";n.r(t),n.d(t,"init",(function(){return qn}));var r={};n.r(r),n.d(r,"setQuizData",(function(){return vt})),n.d(r,"setCurrentQuestion",(function(){return Ot})),n.d(r,"setCurrentPage",(function(){return wt})),n.d(r,"__requestBeforeStartQuiz",(function(){return _t})),n.d(r,"__requestStartQuizSuccess",(function(){return jt})),n.d(r,"startQuiz",(function(){return Rt})),n.d(r,"__requestSubmitQuiz",(function(){return qt})),n.d(r,"__requestSubmitQuizSuccess",(function(){return St})),n.d(r,"submitQuiz",(function(){return Et})),n.d(r,"updateUserQuestionAnswers",(function(){return Pt})),n.d(r,"__requestShowHintSuccess",(function(){return kt})),n.d(r,"showHint",(function(){return zt})),n.d(r,"__requestCheckAnswerSuccess",(function(){return Qt})),n.d(r,"checkAnswer",(function(){return At})),n.d(r,"markQuestionRendered",(function(){return It})),n.d(r,"setQuizMode",(function(){return Nt})),n.d(r,"sendKey",(function(){return Ct}));var o={};n.r(o),n.d(o,"getQuestionOptions",(function(){return Ut})),n.d(o,"getItemStatus",(function(){return Mt})),n.d(o,"getProp",(function(){return Lt})),n.d(o,"getQuizAttempts",(function(){return Ht})),n.d(o,"getQuizAnswered",(function(){return Ft})),n.d(o,"getQuestions",(function(){return Bt})),n.d(o,"getData",(function(){return Kt})),n.d(o,"getDefaultRestArgs",(function(){return Wt})),n.d(o,"getQuestionAnswered",(function(){return Jt})),n.d(o,"getQuestionMark",(function(){return Zt})),n.d(o,"getCurrentQuestion",(function(){return $t})),n.d(o,"getQuestion",(function(){return Gt})),n.d(o,"isCheckedAnswer",(function(){return Vt})),n.d(o,"isCorrect",(function(){return Yt})),n.d(o,"getQuestionsSelectedAnswers",(function(){return Xt})),n.d(o,"getUserMark",(function(){return en}));var i=n(2),a=n(3),u=n(1),s=function(){var e=Object(u.select)("learnpress/quiz").getData("content");return React.createElement("div",{className:"quiz-content",dangerouslySetInnerHTML:{__html:e}})},c=n(0),l=function(e){var t;if(e>86400)t=(e-e%86400)/86400,e%=86400;else if(86400==e)return"24:00";var n=new Date(1e3*e).toUTCString().match(/\d{2}:\d{2}:\d{2}/)[0].split(":");return t&&(n[0]=parseInt(n[0])+24*t),n.join(":")},f=LP.Hook,p=function(){var e=function(e){return Object(u.select)("learnpress/quiz").getData(e)},t=f.applyFilters("quiz-meta-fields",{duration:{title:Object(c.__)("Duration:","learnpress"),name:"duration",content:l(e("duration"))||"--"},passingGrade:{title:Object(c.__)("Passing grade:","learnpress"),name:"passing-grade",content:e("passingGrade")||"--"},questionsCount:{title:Object(c.__)("Questions:","learnpress"),name:"questions-count",content:e("questionIds")?e("questionIds").length:0}});return t&&React.createElement(React.Fragment,null,React.createElement("ul",{className:"quiz-intro"},Object.values(t).map((function(e,t){var n=e.name||t;return React.createElement("li",{key:"quiz-intro-field-".concat(t),className:"quiz-intro-item quiz-intro-item--".concat(n)},React.createElement("div",{className:"quiz-intro-item__title",dangerouslySetInnerHTML:{__html:e.title}}),React.createElement("span",{className:"quiz-intro-item__content",dangerouslySetInnerHTML:{__html:e.content}}))}))))};function d(e){return(d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function m(e){return function(e){if(Array.isArray(e))return b(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return b(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return b(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function b(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function y(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function h(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function g(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function v(e,t){return(v=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function O(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=j(e);if(t){var o=j(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return w(this,n)}}function w(e,t){return!t||"object"!==d(t)&&"function"!=typeof t?_(e):t}function _(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function j(e){return(j=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function R(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var q=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&v(e,t)}(i,e);var t,n,r,o=O(i);function i(){var e;h(this,i);for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return R(_(e=o.call.apply(o,[this].concat(n))),"startQuiz",(function(t){t&&t.preventDefault();var n=document.querySelector(".lp-button.start");n&&n.setAttribute("disabled","disabled");var r=e.props,o=r.startQuiz;if("completed"===r.status){var i=Object(u.select)("learnpress/modal"),a=i.confirm,s=i.isOpen;if("no"===a("Are you sure you want to retry quiz?",e.startQuiz))return void(!s()&&n&&n.removeAttribute("disabled"))}o()})),R(_(e),"nav",(function(t){return function(n){var r=e.props,o=r.questionNav,i=r.currentPage,a=r.numPages,u=r.setCurrentPage;switch(t){case"prev":i>1?i-=1:i="infinity"===o?a:1;break;default:i<a?i+=1:i="infinity"===o?1:a}u(i)}})),R(_(e),"moveTo",(function(t){return function(n){n.preventDefault();var r=e.props,o=r.numPages,i=r.setCurrentPage;t<1||t>o||i(t)}})),R(_(e),"isLast",(function(){var t=e.props;return t.currentPage===t.numPages})),R(_(e),"isFirst",(function(){return 1===e.props.currentPage})),R(_(e),"submit",(function(){var t=e.props.submitQuiz;"no"!==(0,Object(u.select)("learnpress/modal").confirm)(Object(c.__)("Are you sure to submit quiz?","learnpress"),e.submit)&&t()})),R(_(e),"setQuizMode",(function(t){return function(){(0,e.props.setQuizMode)(t)}})),R(_(e),"isReviewing",(function(){return e.props.isReviewing})),e}return t=i,(n=[{key:"pageNumbers",value:function(e){var t=this,n=this.props,r=n.numPages,o=n.currentPage;if(r<2)return"";(e=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?y(Object(n),!0).forEach((function(t){R(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):y(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({numPages:r,currentPage:o,midSize:1,endSize:1,prevNext:!0},e||{})).endSize<1&&(e.endSize=1),e.midSize<0&&(e.midSize=1);var i=m(Array(r).keys()),a=!1;return React.createElement("div",{className:"nav-links"},e.prevNext&&!this.isFirst()&&React.createElement("button",{className:"page-numbers prev","data-type":"question-navx",onClick:this.nav("prev")},Object(c.__)("Prev","learnpress")),i.map((function(n){return(n+=1)===e.currentPage?(a=!0,React.createElement("span",{key:"page-number-".concat(n),className:"page-numbers current"},n)):n<=e.endSize||e.currentPage&&n>=e.currentPage-e.midSize&&n<=e.currentPage+e.midSize||n>e.numPages-e.endSize?(a=!0,React.createElement("button",{key:"page-number-".concat(n),className:"page-numbers",onClick:t.moveTo(n)},n)):a?(a=!1,React.createElement("span",{key:"page-number-".concat(n),className:"page-numbers dots"},"…")):""})),e.prevNext&&!this.isLast()&&React.createElement("button",{className:"page-numbers next","data-type":"question-navx",onClick:this.nav("next")},Object(c.__)("Next","learnpress")))}},{key:"render",value:function(){var e=this.props,t=e.status,n=e.questionNav,r=e.isReviewing,o=e.showReview,i=e.numPages,a=(e.question,e.questionsPerPage,e.canRetry),u=e.retakeNumber,s=["quiz-buttons"];("started"===t||r)&&s.push("align-center"),"questionNav"===n&&s.push("infinity"),this.isFirst()&&s.push("is-first"),this.isLast()&&s.push("is-last");var l=document.querySelector("#popup-sidebar"),f=document.querySelector("#learn-press-quiz-app"),p="";return p="started"===t||r?{marginLeft:l&&l.offsetWidth/2,width:f&&f.offsetWidth}:null,React.createElement(React.Fragment,null,React.createElement("div",{className:s.join(" ")},React.createElement("div",{className:"button-left"+("started"===t||r?" fixed":""),style:p},("completed"===t&&a||-1!==["","viewed"].indexOf(t))&&!r&&React.createElement("button",{className:"lp-button start",onClick:this.startQuiz},"completed"===t?"".concat(Object(c._x)("Retake","label button retry quiz","learnpress")).concat(u?" (".concat(u,")"):""):Object(c._x)("Start","label button start quiz","learnpress")),("started"===t||r)&&i>1&&React.createElement(React.Fragment,null,React.createElement("div",{className:"questions-pagination"},this.pageNumbers()))),React.createElement("div",{className:"button-right"},"started"===t&&React.createElement(React.Fragment,null,("infinity"===n||this.isLast())&&!r&&React.createElement("button",{className:"lp-button submit-quiz",onClick:this.submit},Object(c.__)("Finish Quiz","learnpress"))),r&&o&&React.createElement("button",{className:"lp-button back-quiz",onClick:this.setQuizMode("")},Object(c.__)("Result","learnpress")),"completed"===t&&o&&!r&&React.createElement("button",{className:"lp-button review-quiz",onClick:this.setQuizMode("reviewing")},Object(c.__)("Review","learnpress")))),this.props.message&&!0!==this.props.success&&React.createElement("div",{className:"learn-press-message error"},this.props.message))}}])&&g(t.prototype,n),r&&g(t,r),i}(i.Component),S=Object(a.compose)(Object(u.withSelect)((function(e){var t=e("learnpress/quiz").getData;return{status:t("status"),showCheck:t("instantCheck"),checkedQuestions:t("checkedQuestions"),hintedQuestions:t("hintedQuestions"),questionsPerPage:t("questionsPerPage")}})))((function(e){var t=e.showCheck,n=e.checkedQuestions,r=e.hintedQuestions,o=e.question,i=e.status,a=e.type,u=e.Button;if("started"!==i)return!1;var s=React.createElement(u,{question:o});switch(a){case"hint":return r?!!o.hasHint&&(-1===r.indexOf(o.id)&&s):s;case"check":return!!t&&(n?-1===n.indexOf(o.id)&&s:s)}})),E=Object(a.compose)([Object(u.withSelect)((function(e){var t=e("learnpress/quiz"),n=t.getData,r=t.getCurrentQuestion,o={id:n("id"),status:n("status"),questionIds:n("questionIds"),questionNav:n("questionNav"),isReviewing:n("reviewQuestions")&&"reviewing"===n("mode"),showReview:n("reviewQuestions"),showCheck:n("instantCheck"),checkedQuestions:n("checkedQuestions"),hintedQuestions:n("hintedQuestions"),numPages:n("numPages"),pages:n("pages"),currentPage:n("currentPage"),questionsPerPage:n("questionsPerPage"),pageNumbers:n("pageNumbers"),keyPressed:n("keyPressed"),canRetry:n("retakeCount")>0&&n("retaken")<n("retakeCount"),retakeNumber:n("retakeCount")>0&&n("retaken")<n("retakeCount")?n("retakeCount")-n("retaken"):null,message:n("messageResponse")||!1,success:void 0===n("successResponse")||n("successResponse")};return 1===o.questionsPerPage&&(o.question=r("object")),o})),Object(u.withDispatch)((function(e,t){t.id;var n=e("learnpress/quiz"),r=n.startQuiz,o=n.setCurrentQuestion,i=n.submitQuiz,a=n.setQuizMode,u=n.showHint,s=n.checkAnswer;return{startQuiz:r,setCurrentQuestion:o,setQuizMode:a,setCurrentPage:n.setCurrentPage,submitQuiz:function(e){i(e)},showHint:function(e){u(e)},checkAnswer:function(e){s(e)}}}))])(q);function P(e){return(P="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function k(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function z(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Q(e,t){return(Q=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function A(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=C(e);if(t){var o=C(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return I(this,n)}}function I(e,t){return!t||"object"!==P(t)&&"function"!=typeof t?N(e):t}function N(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function C(e){return(C=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function T(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var x=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Q(e,t)}(i,e);var t,n,r,o=A(i);function i(){var e;k(this,i);for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return T(N(e=o.call.apply(o,[this].concat(n))),"showHint",(function(){var t=e.props,n=t.showHint,r=t.question;n(r.id,!r.showHint)})),e}return t=i,(n=[{key:"render",value:function(){return this.props.question.hint?React.createElement("button",{className:"btn-show-hint",onClick:this.showHint},React.createElement("span",null,Object(c.__)("Hint","learnpress"))):""}}])&&z(t.prototype,n),r&&z(t,r),i}(i.Component),D=Object(a.compose)(Object(u.withDispatch)((function(e,t){t.id;var n=e("learnpress/quiz").showHint;return{showHint:function(e,t){n(e,t)}}})))(x),U=n(11),M=n.n(U);function L(e){return(L="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function H(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function F(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function B(e,t){return(B=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function K(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=Z(e);if(t){var o=Z(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return W(this,n)}}function W(e,t){return!t||"object"!==L(t)&&"function"!=typeof t?J(e):t}function J(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Z(e){return(Z=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function $(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var G=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&B(e,t)}(i,e);var t,n,r,o=K(i);function i(){var e;return H(this,i),$(J(e=o.apply(this,arguments)),"checkAnswer",(function(){var t=e.props,n=t.checkAnswer,r=t.question;t.answered&&(n(r.id),e.setState({loading:!0}))})),e.state={loading:!1},e}return t=i,(n=[{key:"render",value:function(){var e=this.props.answered;return React.createElement(React.Fragment,null,React.createElement("button",{className:M()("lp-button","instant-check",{loading:this.state.loading,disable:!e}),onClick:this.checkAnswer},React.createElement("span",{className:"instant-check__icon"}),Object(c._x)("Check answer","label of button check answer","learnpress"),!e&&React.createElement("div",{className:"instant-check__info",dangerouslySetInnerHTML:{__html:Object(c.__)("You need to answer the question before check answer.","learnpress")}})))}}])&&F(t.prototype,n),r&&F(t,r),i}(i.Component),V=Object(a.compose)(Object(u.withSelect)((function(e,t){var n=t.question.id;return{answered:(0,e("learnpress/quiz").getQuestionAnswered)(n)}})),Object(u.withDispatch)((function(e,t){t.id;var n=e("learnpress/quiz").checkAnswer;return{checkAnswer:function(e){n(e)}}})))(G),Y=function(e){var t=e.question,n={"instant-check":function(){return React.createElement(S,{type:"check",Button:V,question:t})},hint:function(){return React.createElement(S,{type:"hint",Button:D,question:t})}};return React.createElement(React.Fragment,null,LP.config.questionFooterButtons().map((function(e){return React.createElement(i.Fragment,{key:"button-".concat(e)},n[e]&&n[e]())})))};function X(e){return(X="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ee(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function te(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ee(Object(n),!0).forEach((function(t){ce(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ee(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ne(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function re(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function oe(e,t){return(oe=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ie(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=se(e);if(t){var o=se(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return ae(this,n)}}function ae(e,t){return!t||"object"!==X(t)&&"function"!=typeof t?ue(e):t}function ue(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function se(e){return(se=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ce(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var le=window.jQuery,fe=lodash,pe=(fe.uniqueId,fe.isArray),de=(fe.isNumber,fe.bind,function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&oe(e,t)}(a,e);var t,n,r,o=ie(a);function a(){var e;return ne(this,a),ce(ue(e=o.apply(this,arguments)),"setRef",(function(t){e.$wrap=le(t)})),ce(ue(e),"parseOptions",(function(e){return e&&(e=pe(e)?e:JSON.parse(CryptoJS.AES.decrypt(e.data,e.key,{format:CryptoJSAesJson}).toString(CryptoJS.enc.Utf8)),e=pe(e)?e:JSON.parse(e)),e||[]})),ce(ue(e),"getWrapperClass",(function(){var t=e.props,n=t.question,r=(t.answered,["question","question-"+n.type]),o=e.parseOptions(n.options);return o.length&&void 0!==o[0].isTrue&&r.push("question-answered"),r})),ce(ue(e),"getEditLink",(function(){var t=e.props,n=t.question,r=t.editPermalink;return r?r.replace(/post=([0-9]{3,4})/,"post=".concat(n.id)):""})),ce(ue(e),"editPermalink",(function(e){return Object(c.sprintf)('<a href="%s">%s</a>',e,Object(c.__)("Edit","learnpress"))})),e.state={time:null,showHint:!1},e.$wrap=null,e}return t=a,(n=[{key:"componentDidMount",value:function(e){var t=this.props,n=t.question,r=t.isCurrent,o=t.markQuestionRendered;return r&&o(n.id),this.state.time||this.setState({time:new Date}),LP.Hook.doAction("lp-question-compatible-builder"),e}},{key:"render",value:function(){var e=this,t=this.props,n=t.question,r=t.isShow,o=t.isShowIndex,a=(t.isShowHint,t.status),u=LP.questionTypes.default,s=this.getEditLink();s&&jQuery("#wp-admin-bar-edit-lp_question").find(".ab-item").attr("href",s);var l={index:function(){return o?React.createElement("span",{className:"question-index"},o,"."):""},title:function(){return n.title},hint:function(){return React.createElement(D,{question:n})},"edit-permalink":function(){return s&&React.createElement("span",{dangerouslySetInnerHTML:{__html:e.editPermalink(s)},className:"edit-link"})}},f={title:function(){return React.createElement("h4",{className:"question-title"},LP.config.questionTitleParts().map((function(e){return React.createElement(i.Fragment,{key:"title-part-".concat(e)},l[e]&&l[e]())})))},content:function(){return React.createElement("div",{className:"question-content",dangerouslySetInnerHTML:{__html:n.content}})},"answer-options":function(){return e.$wrap&&React.createElement(u,te(te({},e.props),{},{$wrap:e.$wrap}))},explanation:function(){return n.explanation&&React.createElement(React.Fragment,null,React.createElement("div",{className:"question-explanation-content"},React.createElement("strong",{className:"explanation-title"},Object(c.__)("Explanation:","learnpress")),React.createElement("div",{dangerouslySetInnerHTML:{__html:n.explanation}})))},hint:function(){return n.hint&&!n.explanation&&n.showHint&&React.createElement(React.Fragment,null,React.createElement("div",{className:"question-hint-content"},React.createElement("strong",{className:"hint-title"},Object(c.__)("Hint:","learnpress")),React.createElement("div",{dangerouslySetInnerHTML:{__html:n.hint}})))},buttons:function(){return"started"===a&&React.createElement(Y,{question:n})}},p=LP.config.questionBlocks();return React.createElement(React.Fragment,null,React.createElement("div",{className:this.getWrapperClass().join(" "),style:{display:r?"":"none"},"data-id":n.id,ref:this.setRef},p.map((function(e){return React.createElement(i.Fragment,{key:"block-".concat(e)},f[e]?f[e]():"")}))))}}])&&re(t.prototype,n),r&&re(t,r),a}(i.Component)),me=Object(a.compose)([Object(u.withSelect)((function(e,t){var n=t.question.id,r=e("learnpress/quiz"),o=r.getData,i=r.getQuestionAnswered,a=r.getQuestionMark;return{status:o("status"),questions:o("question"),answered:i(n),questionsRendered:o("questionsRendered"),editPermalink:o("editPermalink"),numPages:o("numPages"),mark:a(n)||""}})),Object(u.withDispatch)((function(e){var t=e("learnpress/quiz"),n=t.updateUserQuestionAnswers;return{markQuestionRendered:t.markQuestionRendered,updateUserQuestionAnswers:n}}))])(de);function be(e){return(be="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ye(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function he(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ge(e,t){return(ge=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ve(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=_e(e);if(t){var o=_e(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return Oe(this,n)}}function Oe(e,t){return!t||"object"!==be(t)&&"function"!=typeof t?we(e):t}function we(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _e(e){return(_e=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function je(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Re=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ge(e,t)}(i,e);var t,n,r,o=ve(i);function i(e){var t;return ye(this,i),je(we(t=o.apply(this,arguments)),"startQuiz",(function(e){e.preventDefault(),(0,t.props.startQuiz)()})),je(we(t),"isInVisibleRange",(function(e,n){var r=t.props,o=r.currentPage,i=r.questionsPerPage;return o===Math.ceil(n/i)})),je(we(t),"nav",(function(e){var n=t.props.sendKey;switch(e.keyCode){case 37:return n("left");case 38:return;case 39:return n("right");case 40:return;default:e.keyCode>=49&&e.keyCode<=57&&n(e.keyCode-48)}})),t.needToTop=!1,t.state={isReviewing:null,currentPage:0,self:we(t)},t}return t=i,r=[{key:"getDerivedStateFromProps",value:function(e,t){for(var n=["isReviewing","currentPage"],r={},o=0;o<n.length;o++)e[n[o]]!==t[n[o]]&&(r[n[o]]=e[n[o]]);return Object.values(r).length?(t.self.needToTop=!0,r):null}}],(n=[{key:"componentDidUpdate",value:function(){this.needToTop&&(jQuery("#popup-content").animate({scrollTop:0}).find(".content-item-scrollable:last").animate({scrollTop:0}),this.needToTop=!1)}},{key:"render",value:function(){var e=this,t=this.props,n=t.status,r=t.currentQuestion,o=t.questions,i=t.questionsRendered,a=t.isReviewing,u=t.questionsPerPage,s=!0;return"completed"!==n||a||(s=!1),React.createElement(React.Fragment,null,React.createElement("div",{tabIndex:100,onKeyUp:this.nav},React.createElement("div",{className:"quiz-questions",style:{display:s?"":"none"}},o.map((function(t,n){var o=!u&&r===t.id,a=i&&-1!==i.indexOf(t.id),s=e.isInVisibleRange(t.id,n+1);return a||!a||s?React.createElement(me,{key:"loop-question-".concat(t.id),isCurrent:o,isShow:s,isShowIndex:!!u&&n+1,questionsPerPage:u,question:t}):""})))))}}])&&he(t.prototype,n),r&&he(t,r),i}(i.Component),qe=Object(a.compose)(Object(u.withSelect)((function(e,t,n){var r=e("learnpress/quiz"),o=r.getData,i=r.getQuestions;return{status:o("status"),currentQuestion:o("currentQuestion"),questions:i(),questionsRendered:o("questionsRendered"),isReviewing:"reviewing"===o("mode"),numPages:o("numPages"),currentPage:o("currentPage"),questionsPerPage:o("questionsPerPage")||1}})),Object(u.withDispatch)((function(e){var t=e("learnpress/quiz");return{startQuiz:t.startQuiz,sendKey:t.sendKey}})))(Re),Se=function(){var e=Object(u.select)("learnpress/quiz").getData("attempts")||[],t=e&&!!e.length;return!!t&&React.createElement(React.Fragment,null,React.createElement("div",{className:"quiz-attempts"},React.createElement("h4",{className:"attempts-heading"},Object(c.__)("Last Attempted","learnpress")),t&&React.createElement("table",null,React.createElement("thead",null,React.createElement("tr",null,React.createElement("th",{className:"quiz-attempts__questions"},Object(c.__)("Questions","learnpress")),React.createElement("th",{className:"quiz-attempts__spend"},Object(c.__)("Time spend","learnpress")),React.createElement("th",{className:"quiz-attempts__marks"},Object(c.__)("Marks","learnpress")),React.createElement("th",{className:"quiz-attempts__grade"},Object(c.__)("Passing grade","learnpress")),React.createElement("th",{className:"quiz-attempts__result"},Object(c.__)("Result","learnpress")))),React.createElement("tbody",null,e.map((function(e,t){return React.createElement("tr",{key:"attempt-".concat(t)},React.createElement("td",{className:"quiz-attempts__questions"},"".concat(e.questionCorrect," / ").concat(e.questionCount)),React.createElement("td",{className:"quiz-attempts__spend"},e.timeSpend||"--"),React.createElement("td",{className:"quiz-attempts__marks"},"".concat(e.userMark," / ").concat(e.mark)),React.createElement("td",{className:"quiz-attempts__grade"},e.passingGrade||Object(c._x)("-","unknown passing grade value","learnpress")),React.createElement("td",{className:"quiz-attempts__result"},"".concat(parseFloat(e.result).toFixed(2),"%")," ",React.createElement("span",null,e.graduationText)))}))))))};function Ee(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,o=!1,i=void 0;try{for(var a,u=e[Symbol.iterator]();!(r=(a=u.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{r||null==u.return||u.return()}finally{if(o)throw i}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Pe(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Pe(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Pe(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var ke=function(){var e=Object(u.select)("learnpress/quiz").getData,t=Object(u.dispatch)("learnpress/quiz").submitQuiz,n=e("totalTime")?e("totalTime"):e("duration"),r=e("endTime"),o=new Date(r.replace(/-/g,"/")),a=new Date,s=(new Date).getTimezoneOffset(),c=parseInt(o.getTime()/1e3-(a.getTime()/1e3+60*s)),l=Ee(Object(i.useState)(c>0?c:0),2),f=l[0],p=l[1];Object(i.useEffect)((function(){var e=setInterval((function(){var n=f;(n-=1)>0?p(n):(clearInterval(e),t())}),1e3);return function(){return clearInterval(e)}}),[f]);return React.createElement("div",{className:"countdown"},React.createElement("i",{className:"fas fa-stopwatch"}),React.createElement("span",null,function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:":",r=[];return n<3600?(r.push((f-f%60)/60),r.push(f%60)):n&&(r.push((f-f%3600)/3600),e=f%3600,r.push((e-e%60)/60),r.push(e%60)),r.map((function(e){return e<10?"0".concat(e):e})).join(t)}()))};function ze(e){return function(e){if(Array.isArray(e))return Ie(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||Ae(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Qe(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,o=!1,i=void 0;try{for(var a,u=e[Symbol.iterator]();!(r=(a=u.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{r||null==u.return||u.return()}finally{if(o)throw i}}return n}(e,t)||Ae(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ae(e,t){if(e){if("string"==typeof e)return Ie(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ie(e,t):void 0}}function Ie(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Ne=lodash.debounce,Ce=function(){var e=Qe(Object(i.useState)(0),2),t=e[0],n=e[1],r=Qe(Object(i.useState)(!1),2),o=r[0],a=r[1],s=Object(u.useSelect)((function(e){return e("learnpress/quiz").getData("results")}),[]),l=Object(u.useSelect)((function(e){return e("learnpress/quiz").getData("passingGrade")}),[]),f=Object(u.useSelect)((function(e){return e("learnpress/quiz").getData("id")}),[]);Object(i.useEffect)((function(){p();var e="";if(e=s.graduation?s.graduation:s.result>=h.replace(/[^0-9\.]+/g,"")?"passed":"failed"){var t=document.querySelector(".course-curriculum .course-item.course-item-".concat(f));t&&(t.classList.remove("failed","passed"),t.classList.add("has-status","status-completed",e))}var n=ze(document.querySelectorAll("#popup-header .items-progress"))[0];if(n){var r=n.querySelector(".items-completed");if(r){parseInt(r.textContent);var o=document.querySelectorAll("#popup-sidebar .course-curriculum .course-item.status-completed");r.textContent=parseInt(o.length)}}}),[s]);var p=function(){n(0),a(!1),jQuery.easing._customEasing=function(e,t,n,r,o){return r*Math.sqrt(1-(t=t/o-1)*t)+n},Ne((function(){var e=jQuery("<span />").css({width:1,height:1}).appendTo(document.body);e.css("left",0).animate({left:s.result},{duration:1500,step:function(e,t){n(e)},done:function(){a(!0),e.remove(),jQuery("#quizResultGrade").css({transform:"scale(1.3)",transition:"all 0.25s"}),Ne((function(){jQuery("#quizResultGrade").css({transform:"scale(1)"})}),500)()},easing:"_customEasing"})}),s.result>0?1e3:10)()},d=t;Number.isInteger(t)||(d=parseFloat(t).toFixed(2));var m=190*Math.PI,b=m-d/100*m,y={strokeDasharray:"".concat(m," ").concat(m),strokeDashoffset:b},h=s.passingGrade||l,g="";g=s.graduation?s.graduation:d>=h.replace(/[^0-9\.]+/g,"")?"passed":"failed";var v="";v=s.graduationText?s.graduationText:"passed"===g?Object(c.__)("Passed","learnpress"):Object(c.__)("Failed","learnpress");var O=["quiz-result",g];return React.createElement("div",{className:O.join(" ")},React.createElement("h3",{className:"result-heading"},Object(c.__)("Your Result","learnpress")),React.createElement("div",{id:"quizResultGrade",className:"result-grade"},React.createElement("svg",{className:"circle-progress-bar",width:200,height:200},React.createElement("circle",{className:"circle-progress-bar__circle",stroke:"",strokeWidth:10,style:y,fill:"transparent",r:95,cx:100,cy:100})),React.createElement("span",{className:"result-achieved"},"".concat(d,"%")),React.createElement("span",{className:"result-require"},h||Object(c._x)("-","unknown passing grade value","learnpress"))),o&&React.createElement("p",{className:"result-message"},v),React.createElement("ul",{className:"result-statistic"},React.createElement("li",{className:"result-statistic-field result-time-spend"},React.createElement("span",null,Object(c.__)("Time spend","learnpress")),React.createElement("p",null,s.timeSpend)),React.createElement("li",{className:"result-statistic-field result-point"},React.createElement("span",null,Object(c.__)("Point","learnpress")),React.createElement("p",null,s.userMark," / ",s.mark)),React.createElement("li",{className:"result-statistic-field result-questions"},React.createElement("span",null,Object(c.__)("Questions","learnpress")),React.createElement("p",null,s.questionCount)),React.createElement("li",{className:"result-statistic-field result-questions-correct"},React.createElement("span",null,Object(c.__)("Correct","learnpress")),React.createElement("p",null,s.questionCorrect)),React.createElement("li",{className:"result-statistic-field result-questions-wrong"},React.createElement("span",null,Object(c.__)("Wrong","learnpress")),React.createElement("p",null,s.questionWrong)),React.createElement("li",{className:"result-statistic-field result-questions-skipped"},React.createElement("span",null,Object(c.__)("Skipped","learnpress")),React.createElement("p",null,s.questionEmpty))))},Te=jQuery,xe=lodash.debounce,De=function(){var e=Object(u.dispatch)("learnpress/quiz").submitQuiz;Object(i.useEffect)((function(){var e=Te("#popup-content");if(e.length){var t=e.find(".content-item-scrollable:eq(1)"),n=e.find(".content-item-wrap"),r=e.find(".quiz-status"),o=r.offset().top-92,i=!1,a="-"+n.css("margin-left");Te(window).on("resize.refresh-quiz-stauts-bar",xe((function(){a="-"+n.css("margin-left"),r.css({"margin-left":a,"margin-right":a})}),100)).trigger("resize.refresh-quiz-stauts-bar"),t.on("scroll",(function(){if(t.scrollTop()>=o){if(i)return;i=!0}else{if(!i)return;i=!1}i?e.addClass("fixed-quiz-status"):e.removeClass("fixed-quiz-status")}))}}),[]);var t=Object(u.select)("learnpress/quiz"),n=t.getData,r=t.getUserMark,o=n("currentPage"),a=n("questionsPerPage"),s=n("questionIds").length,l=n("submitting"),f=n("totalTime"),p=n("duration"),d=r(),m=["quiz-status"],b=(o-1)*a+1,y=b+a-1,h="";return y=Math.min(y,s),l&&m.push("submitting"),h=y<s?a>1?Object(c.sprintf)(Object(c.__)("Question <span>%d to %d of %d</span>","learnpress"),b,y,s):Object(c.sprintf)(Object(c.__)("Question <span>%d of %d</span>","learnpress"),b,s):Object(c.sprintf)(Object(c.__)("Question <span>%d to %d</span>","learnpress"),b,y),React.createElement("div",{className:m.join(" ")},React.createElement("div",null,React.createElement("div",{className:"questions-index",dangerouslySetInnerHTML:{__html:h}}),React.createElement("div",{className:"current-point"},Object(c.sprintf)(Object(c.__)("Earned Point: %s","learnpress"),d)),React.createElement("div",null,React.createElement("div",{className:"submit-quiz"},React.createElement("button",{className:"lp-button",id:"button-submit-quiz",onClick:function t(){"no"!==(0,Object(u.select)("learnpress/modal").confirm)(Object(c.__)("Are you sure to submit quiz?","learnpress"),t)&&e()}},l?Object(c.__)("Submitting...","learnpress"):Object(c.__)("Finish Quiz","learnpress"))),f&&p&&React.createElement(ke,null))))};function Ue(e){return function(e){if(Array.isArray(e))return Me(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return Me(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Me(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Me(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Le(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function He(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Le(Object(n),!0).forEach((function(t){Fe(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Le(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Fe(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Be=lodash,Ke=(Be.omit,Be.flow),We=Be.isArray,Je=Be.chunk,Ze=(LP.camelCaseDashObjectKeys,LP.localStorage),$e=Ze.get,Ge=Ze.set,Ve={},Ye=function(e,t){var n=He(He({},e.answered[t.questionId]||{}),{},{answered:t.answers,temp:!0});return He(He({},e),{},{answered:He(He({},e.answered),{},Fe({},t.questionId,n))})},Xe=function(e,t){var n=e.questionsRendered;return We(n)?(n.push(t.questionId),He(He({},e),{},{questionsRendered:Ue(n)})):He(He({},e),{},{questionsRendered:[t.questionId]})},et=function(e,t){return t.currentPage&&Ge("Q".concat(e.id,".currentPage"),t.currentPage),He(He({},e),t)},tt=function(e,t){var n=e.questions.map((function(e){return e.id==t.questionId?He(He({},e),{},{showHint:t.showHint}):e}));return He(He({},e),{},{questions:Ue(n)})},nt=function(e,t){var n=e.questions.map((function(e){if(e.id!==t.questionId)return e;var n={explanation:t.explanation};return t.options&&(n.options=t.options),He(He({},e),n)}));return He(He({},e),{},{questions:Ue(n),answered:He(He({},e.answered),{},Fe({},t.questionId,t.result)),checkedQuestions:[].concat(Ue(e.checkedQuestions),[t.questionId])})},rt=function(e,t){var n=e.questions.map((function(n){var r={};return e.reviewQuestions&&(t.results.questions[n.id].explanation&&(r.explanation=t.results.questions[n.id].explanation),t.results.questions[n.id].options&&(r.options=t.results.questions[n.id].options)),He(He({},n),r)}));return et(e,He(He({submitting:!1,currentPage:1},t.results),{},{questions:Ue(n)}))},ot=function(e,t){var n=void 0!==t.results.success&&t.results.success,r=t.results.message||!1;return et(e,He(He({checkedQuestions:[],hintedQuestions:[],mode:"",currentPage:1},t.results.results),{},{successResponse:n,messageResponse:r}))},it=Ke(u.combineReducers,(function(e){return function(t,n){return e(t,n)}}),(function(e){return function(t,n){return e(t,n)}}),(function(e){return function(t,n){return e(t,n)}}))({a:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{a:1};return e},b:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{b:2};return e}}),at=Object(u.combineReducers)({blocks:it,userQuiz:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ve,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"SET_QUIZ_DATA":1>t.data.questionsPerPage&&(t.data.questionsPerPage=1);var n=Je(e.questionIds||t.data.questionIds,t.data.questionsPerPage);return t.data.numPages=n.length,t.data.pages=n,He(He(He({},e),t.data),{},{currentPage:$e("Q".concat(t.data.id,".currentPage"))||t.data.currentPage});case"SUBMIT_QUIZ":return He(He({},e),{},{submitting:!0});case"START_QUIZ":case"START_QUIZ_SUCCESS":return ot(e,t);case"SET_CURRENT_QUESTION":return Ge("Q".concat(e.id,".currentQuestion"),t.questionId),He(He({},e),{},{currentQuestion:t.questionId});case"SET_CURRENT_PAGE":return Ge("Q".concat(e.id,".currentPage"),t.currentPage),He(He({},e),{},{currentPage:t.currentPage});case"SUBMIT_QUIZ_SUCCESS":return rt(e,t);case"UPDATE_USER_QUESTION_ANSWERS":return"started"===e.status?Ye(e,t):e;case"MARK_QUESTION_RENDERED":return Xe(e,t);case"SET_QUIZ_MODE":return"reviewing"==t.mode?et(e,{mode:t.mode}):He(He({},e),{},{mode:t.mode});case"SET_QUESTION_HINT":return tt(e,t);case"CHECK_ANSWER":return nt(e,t);case"SEND_KEY":return He(He({},e),{},{keyPressed:t.keyPressed})}return e}}),ut=n(7);function st(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}var ct=regeneratorRuntime.mark(Et),lt=regeneratorRuntime.mark(zt),ft=regeneratorRuntime.mark(At);function pt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function dt(e){return function(e){if(Array.isArray(e))return mt(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return mt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return mt(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function mt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function bt(){var e=[].slice.call(arguments,2),t=Object(u.dispatch)(arguments[0]),n=arguments[1];t[n].apply(t,dt(e))}var yt=LP,ht=yt.camelCaseDashObjectKeys,gt=yt.Hook;function vt(e,t){return t="string"==typeof e?pt({},e,t):e,{type:"SET_QUIZ_DATA",data:ht(t)}}function Ot(e){return{type:"SET_CURRENT_QUESTION",questionId:e}}function wt(e){return{type:"SET_CURRENT_PAGE",currentPage:e}}function _t(e,t,n){return{type:"BEFORE_START_QUIZ"}}function jt(e,t,n,r){return gt.doAction("quiz-started",e,t,n,r),{type:"START_QUIZ_SUCCESS",quizId:t,courseId:n,userId:r,results:e}}var Rt=regeneratorRuntime.mark((function e(){var t,n,r,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=Object(u.select)("learnpress/quiz").getDefaultRestArgs(),n=t.itemId,r=t.courseId,!0===gt.applyFilters("before-start-quiz",!0,n,r)){e.next=4;break}return e.abrupt("return");case 4:return e.next=6,Object(ut.apiFetch)({path:"lp/v1/users/start-quiz",method:"POST",data:{item_id:n,course_id:r}});case 6:return o=e.sent,o=gt.applyFilters("request-start-quiz-response",o,n,r),e.next=10,bt("learnpress/quiz","__requestStartQuizSuccess",ht(o),n,r);case 10:case"end":return e.stop()}}),e)}));function qt(){return{type:"SUBMIT_QUIZ"}}function St(e,t,n){return gt.doAction("quiz-submitted",e,t,n),{type:"SUBMIT_QUIZ_SUCCESS",results:e}}function Et(){var e,t,n,r,o,i,a,s;return regeneratorRuntime.wrap((function(c){for(;;)switch(c.prev=c.next){case 0:if(e=Object(u.select)("learnpress/quiz"),t=e.getDefaultRestArgs,n=e.getQuestionsSelectedAnswers,r=t(),o=r.itemId,i=r.courseId,!0===gt.applyFilters("before-submit-quiz",!0)){c.next=5;break}return c.abrupt("return");case 5:return a=n(),c.next=8,Object(ut.apiFetch)({path:"lp/v1/users/submit-quiz",method:"POST",data:{item_id:o,course_id:i,answered:a}});case 8:if(s=c.sent,!(s=gt.applyFilters("request-submit-quiz-response",s,o,i)).success){c.next=13;break}return c.next=13,bt("learnpress/quiz","__requestSubmitQuizSuccess",ht(s.results),o,i);case 13:case"end":return c.stop()}}),ct)}function Pt(e,t,n){return{type:"UPDATE_USER_QUESTION_ANSWERS",questionId:e,answers:t}}function kt(e,t){return{type:"SET_QUESTION_HINT",questionId:e,showHint:t}}function zt(e,t){return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,bt("learnpress/quiz","__requestShowHintSuccess",e,t);case 2:case"end":return n.stop()}}),lt)}function Qt(e,t){return function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?st(Object(n),!0).forEach((function(t){pt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):st(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({type:"CHECK_ANSWER",questionId:e},t)}function At(e){var t,n,r,o,i,a,s;return regeneratorRuntime.wrap((function(c){for(;;)switch(c.prev=c.next){case 0:return t=Object(u.select)("learnpress/quiz"),n=t.getDefaultRestArgs,r=t.getQuestionAnswered,o=n(),i=o.itemId,a=o.courseId,c.next=4,Object(ut.apiFetch)({path:"lp/v1/users/check-answer",method:"POST",data:{item_id:i,course_id:a,question_id:e,answered:r(e)||""}});case 4:return s=c.sent,c.next=7,bt("learnpress/quiz","__requestCheckAnswerSuccess",e,ht(s));case 7:case"end":return c.stop()}}),ft)}function It(e){return{type:"MARK_QUESTION_RENDERED",questionId:e}}function Nt(e){return{type:"SET_QUIZ_MODE",mode:e}}function Ct(e){return setTimeout((function(){bt("learnpress/quiz","sendKey","")}),300),{type:"SEND_KEY",keyPressed:e}}var Tt=lodash,xt=Tt.get,Dt=Tt.isArray,Ut=function(e,t){console.time("parseOptions");var n=Gt(e,t).options;return n=Dt(n)?n:JSON.parse(CryptoJS.AES.decrypt(n.data,n.key,{format:CryptoJSAesJson}).toString(CryptoJS.enc.Utf8)),n=Dt(n)?n:JSON.parse(n),console.timeEnd("parseOptions"),n};function Mt(e,t){var n=Object(u.select)("course-learner/user").getItemById(t);return n?xt(n,"userSettings.status"):""}function Lt(e,t,n){return e[t]||n}function Ht(e,t){var n=Object(u.select)("course-learner/user").getItemById(t);return n?xt(n,"userSettings.attempts"):[]}function Ft(e,t){var n=Object(u.select)("course-learner/user").getItemById(t);return n?xt(n,"userSettings.answered",{}):{}}function Bt(e){var t=e.userQuiz,n=xt(t,"questions");return n?Object.values(n):[]}function Kt(e,t){var n=e.userQuiz;return t?xt(n,t):n}function Wt(e){var t=e.userQuiz;return{itemId:t.id,courseId:t.courseId}}function Jt(e,t){var n=e.userQuiz;return xt(n,"answered.".concat(t,".answered"))||void 0}function Zt(e,t){var n=e.userQuiz;return xt(n,"answered.".concat(t,".mark"))||void 0}function $t(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=xt(e,"userQuiz.questionsPerPage")||1;if(n>1)return!1;var r=xt(e,"userQuiz.currentPage")||1;return xt(e,"object"===t?"userQuiz.questions[".concat(r-1,"]"):"userQuiz.questionIds[".concat(r-1,"]"))}var Gt=function(e,t){e.userQuiz;return Object(u.select)("learnpress/quiz").getQuestions().find((function(e){return e.id==t}))};function Vt(e,t){return-1!==(xt(e,"userQuiz.checkedQuestions")||[]).indexOf(t)}function Yt(e,t){}var Xt=function(e,t){var n=xt(e,"userQuiz.answered"),r={};for(var o in n)if(n.hasOwnProperty(o)&&(n[o].temp||n[o].blanks)){if(t&&o===t)return n[o].answered;r[o]=n[o].answered}return r};function en(e){var t=e.userQuiz||{},n=t.answered,r=t.negativeMarking,o=t.questions,i=t.checkedQuestions,a=0,u=function(e){if(!n.hasOwnProperty(e))return s=e,"continue";e=parseInt(e);var t,u=n[e],c=u.questionMark?u.questionMark:(t=o.find((function(t){return s=e,t.id===e})),s=e,t?t.point:0);i.indexOf(e);if(u.temp)return s=e,"continue";r?u.answered&&(a=u.correct?a+u.mark:a-c):u.answered&&u.correct&&(a+=u.mark),s=e};for(var s in n)u(s);return a>0?a:0}var tn=n(4),nn=n.n(tn),rn={ENROLL_COURSE_X:function(e,t){}};var on=function(e){var t=function(){throw new Error("Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")},n={getState:e.getState,dispatch:function(){return t.apply(void 0,arguments)}};return t=nn()(rn)(n)(e.dispatch),e.dispatch=t,e};function an(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function un(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var sn=LP.dataControls.controls,cn=Object(u.registerStore)("learnpress/quiz",{reducer:at,selectors:o,actions:r,controls:function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?an(Object(n),!0).forEach((function(t){un(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):an(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},sn)});on(cn);function ln(e){return(ln="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function fn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function pn(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function dn(e,t){return(dn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function mn(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=hn(e);if(t){var o=hn(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return bn(this,n)}}function bn(e,t){return!t||"object"!==ln(t)&&"function"!=typeof t?yn(e):t}function yn(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function hn(e){return(hn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function gn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var vn=lodash.chunk,On=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&dn(e,t)}(i,e);var t,n,r,o=mn(i);function i(e){var t;return fn(this,i),gn(yn(t=o.apply(this,arguments)),"startQuiz",(function(e){t.props.startQuiz()})),t.state={currentPage:1,numPages:0,pages:[]},t}return t=i,(n=[{key:"componentDidMount",value:function(){var e=this.props,t=e.settings,n=e.setQuizData,r=t.question_ids,o=t.questions_per_page,i=vn(r,o);t.currentPage=1,t.numPages=i.length,t.pages=i,n(t)}},{key:"render",value:function(){var e=this.props,t=e.status,n=e.isReviewing,r=-1!==["","completed","viewed"].indexOf(t)||!t,o=-1!==["","viewed",void 0].indexOf(t)||!t;return void 0!==t&&React.createElement(React.Fragment,null,React.createElement("div",null,!n&&"completed"===t&&React.createElement(Ce,null),!n&&o&&React.createElement(p,null),!n&&o&&React.createElement(s,null),"started"===t&&React.createElement(De,null),(-1!==["completed","started"].indexOf(t)||n)&&React.createElement(qe,null),React.createElement(E,null),r&&!n&&React.createElement(Se,null)))}}])&&pn(t.prototype,n),r&&pn(t,r),i}(i.Component),wn=Object(a.compose)([Object(u.withSelect)((function(e){var t=e("learnpress/quiz"),n=t.getQuestions,r=t.getData;return{questions:n(),status:r("status"),store:r(),answered:r("answered"),isReviewing:"reviewing"===r("mode"),questionIds:r("questionIds"),checkCount:r("instantCheck"),questionsPerPage:r("questionsPerPage")||1}})),Object(u.withDispatch)((function(e){var t=e("learnpress/quiz");return{setQuizData:t.setQuizData,startQuiz:t.startQuiz}}))])(On);n(8);function _n(e){return function(e){if(Array.isArray(e))return jn(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return jn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return jn(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function jn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Rn=LP.modal.default,qn=(t.default=wn,function(e,t){wp.element.render(React.createElement(Rn,null,React.createElement(wn,{settings:t})),_n(document.querySelectorAll(e))[0]),LP.Hook.doAction("lp-quiz-compatible-builder")})}]);
assets/js/dist/frontend/single-curriculum.js CHANGED
@@ -161,16 +161,19 @@ __webpack_require__.r(__webpack_exports__);
161
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "init", function() { return init; });
162
  /* harmony import */ var _single_curriculum_index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./single-curriculum/index */ "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/frontend/single-curriculum/index.js");
163
  /* harmony import */ var _show_lp_overlay_complete_item__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./show-lp-overlay-complete-item */ "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/frontend/show-lp-overlay-complete-item.js");
 
164
  var $ = jQuery;
165
 
166
 
 
167
  /* harmony default export */ __webpack_exports__["default"] = (_single_curriculum_index__WEBPACK_IMPORTED_MODULE_0__["default"]);
168
  var init = function init() {
169
  wp.element.render( /*#__PURE__*/React.createElement(_single_curriculum_index__WEBPACK_IMPORTED_MODULE_0__["default"], null), document.getElementById('learn-press-course-curriculum'));
170
  };
171
  document.addEventListener('DOMContentLoaded', function (event) {
172
  LP.Hook.doAction('course-ready');
173
- _show_lp_overlay_complete_item__WEBPACK_IMPORTED_MODULE_1__["default"].init(); //init();
 
174
  });
175
 
176
  /***/ }),
@@ -267,7 +270,7 @@ LP.Hook.addAction('lp-compatible-builder', function () {
267
  });
268
  }
269
 
270
- if (typeof vc_js !== 'undefined') {
271
  _toConsumableArray(document.querySelectorAll('#popup-content'))[0].addEventListener('scroll', function () {
272
  VcWaypoint.refreshAll();
273
  });
@@ -635,6 +638,65 @@ window.addEventListener('DOMContentLoaded', function () {
635
 
636
  /***/ }),
637
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
638
  /***/ "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/utils/lp-modal-overlay.js":
639
  /*!*********************************************************************************************************************************************************************!*\
640
  !*** E:/Work/Webs/WP/Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/utils/lp-modal-overlay.js ***!
161
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "init", function() { return init; });
162
  /* harmony import */ var _single_curriculum_index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./single-curriculum/index */ "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/frontend/single-curriculum/index.js");
163
  /* harmony import */ var _show_lp_overlay_complete_item__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./show-lp-overlay-complete-item */ "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/frontend/show-lp-overlay-complete-item.js");
164
+ /* harmony import */ var _single_curriculum_scrolltoitem__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./single-curriculum/scrolltoitem */ "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/frontend/single-curriculum/scrolltoitem.js");
165
  var $ = jQuery;
166
 
167
 
168
+
169
  /* harmony default export */ __webpack_exports__["default"] = (_single_curriculum_index__WEBPACK_IMPORTED_MODULE_0__["default"]);
170
  var init = function init() {
171
  wp.element.render( /*#__PURE__*/React.createElement(_single_curriculum_index__WEBPACK_IMPORTED_MODULE_0__["default"], null), document.getElementById('learn-press-course-curriculum'));
172
  };
173
  document.addEventListener('DOMContentLoaded', function (event) {
174
  LP.Hook.doAction('course-ready');
175
+ _show_lp_overlay_complete_item__WEBPACK_IMPORTED_MODULE_1__["default"].init();
176
+ _single_curriculum_scrolltoitem__WEBPACK_IMPORTED_MODULE_2__["default"].init(); //init();
177
  });
178
 
179
  /***/ }),
270
  });
271
  }
272
 
273
+ if (typeof vc_js !== 'undefined' && typeof VcWaypoint !== 'undefined') {
274
  _toConsumableArray(document.querySelectorAll('#popup-content'))[0].addEventListener('scroll', function () {
275
  VcWaypoint.refreshAll();
276
  });
638
 
639
  /***/ }),
640
 
641
+ /***/ "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/frontend/single-curriculum/scrolltoitem.js":
642
+ /*!**************************************************************************************************************************************************************************************!*\
643
+ !*** E:/Work/Webs/WP/Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/frontend/single-curriculum/scrolltoitem.js ***!
644
+ \**************************************************************************************************************************************************************************************/
645
+ /*! exports provided: default */
646
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
647
+
648
+ "use strict";
649
+ __webpack_require__.r(__webpack_exports__);
650
+ var $ = jQuery;
651
+ var scrollToItemCurrent = {
652
+ init: function init() {
653
+ this.scrollToItemViewing = function () {
654
+ var elItemViewing = $('.viewing-course-item');
655
+
656
+ if (elItemViewing.length) {
657
+ var heightCourseItemContentHeader = $('#popup-sidebar').outerHeight();
658
+ var heightSectionTitle = $('.section-title').outerHeight();
659
+ var heightSectionHeader = $('.section-header').outerHeight();
660
+ var regex = new RegExp('^viewing-course-item-([0-9].*)');
661
+ var classList = elItemViewing.attr('class');
662
+ var classArr = classList.split(/\s+/);
663
+ var idItem = 0;
664
+ $.each(classArr, function (i, className) {
665
+ var compare = regex.exec(className);
666
+
667
+ if (compare) {
668
+ idItem = compare[1];
669
+ return false;
670
+ }
671
+ });
672
+
673
+ if (0 === idItem) {
674
+ return;
675
+ }
676
+
677
+ var elItemCurrent = $('.course-item-' + idItem);
678
+ var offSetTop = elItemCurrent.offset().top;
679
+ var numberOffSetTop = offSetTop - heightCourseItemContentHeader;
680
+
681
+ if (undefined === heightSectionTitle) {
682
+ numberOffSetTop = numberOffSetTop - heightSectionHeader + 20;
683
+ } else {
684
+ numberOffSetTop = numberOffSetTop - heightSectionTitle;
685
+ }
686
+
687
+ $('#learn-press-course-curriculum').animate({
688
+ scrollTop: numberOffSetTop + 300
689
+ }, 800);
690
+ }
691
+ };
692
+
693
+ this.scrollToItemViewing();
694
+ }
695
+ };
696
+ /* harmony default export */ __webpack_exports__["default"] = (scrollToItemCurrent);
697
+
698
+ /***/ }),
699
+
700
  /***/ "../../../Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/utils/lp-modal-overlay.js":
701
  /*!*********************************************************************************************************************************************************************!*\
702
  !*** E:/Work/Webs/WP/Clouds/Thimpress/Plugins/github.com/learnpress_v4_modify_step_install_after_activated/learnpress/assets/src/apps/js/utils/lp-modal-overlay.js ***!
assets/js/dist/frontend/single-curriculum.min.js CHANGED
@@ -1 +1 @@
1
- this.LP=this.LP||{},this.LP.singleCurriculum=function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=21)}({2:function(e,t){e.exports=window.wp.element},21:function(e,t,n){"use strict";n.r(t),n.d(t,"init",(function(){return v}));var o=n(2),r=n(5),i=jQuery;n(8);function l(e){return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function a(e,t){return(a=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function s(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=f(e);if(t){var r=f(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return d(this,n)}}function d(e,t){return!t||"object"!==l(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function f(e){return(f=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}jQuery;var p=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&a(e,t)}(i,e);var t,n,o,r=s(i);function i(){return c(this,i),r.apply(this,arguments)}return t=i,(n=[{key:"checkCourseDurationExpire",value:function(){var e=document.getElementsByName("lp-course-timestamp-remaining");if(e.length){var t=e[0].value;t<86400&&setTimeout((function(){window.location.reload(!0)}),1e3*t)}}},{key:"render",value:function(){return React.createElement("div",null)}}])&&u(t.prototype,n),o&&u(t,o),i}(o.Component),m=p;window.addEventListener("DOMContentLoaded",(function(){LP.Hook.doAction("lp-compatible-builder"),function(){var e=document.querySelector("#popup-course"),t=document.querySelector("#learn-press-course-curriculum");if(e&&t){var n=t.querySelector(".curriculum-sections"),o=e.querySelector(".search-course"),r=e.querySelector('.search-course input[type="text"]');if(!r||!n||!o)return;var i=n.querySelectorAll("li.section"),l=n.querySelectorAll("li.course-item"),c=[];l.forEach((function(e){var t=e.dataset.id,n=e.querySelector(".item-name");c.push({id:t,name:n?n.textContent.toLowerCase():""})}));var u=function(e){e.preventDefault();var t=r.value;o.classList.add("searching"),t||o.classList.remove("searching");var n=[];c.forEach((function(e){t&&!e.name.match(t.toLowerCase())||(n.push(e.id),l.forEach((function(e){-1!==n.indexOf(e.dataset.id)?e.classList.remove("hide-if-js"):e.classList.add("hide-if-js")})))})),i.forEach((function(e){var t=e.querySelectorAll(".course-item"),o=[];t.forEach((function(e){n.includes(e.dataset.id)&&o.push(e.dataset.id)})),0===o.length?e.classList.add("hide-if-js"):e.classList.remove("hide-if-js")}))},a=o.querySelector(".clear");a&&a.addEventListener("click",(function(e){e.preventDefault(),r.value="",u(e)})),o.addEventListener("submit",u),r.addEventListener("keyup",u)}}(),Object(r.a)(),i(".learn-press-progress").each((function(){var e=i(this).find(".learn-press-progress__active"),t=e.data("value");void 0!==t&&e.css("left",-(100-parseInt(t))+"%")})),function(){var e=document.querySelector(".lp-lesson-comment-btn");if(e){var t=e.textContent,n=e.dataset.close;window.location.hash.includes("comment")&&e.parentNode.classList.add("open-comments");var o=function(e,o){o.classList.contains("open-comments")?e.textContent=n:e.textContent=t};o(e,e.parentNode),e.addEventListener("click",(function(t){t.preventDefault(),e.parentNode.classList.toggle("open-comments"),o(e,e.parentNode)}))}}(),(new p).checkCourseDurationExpire()}));var y=n(6),v=(jQuery,t.default=m,function(){wp.element.render(React.createElement(m,null),document.getElementById("learn-press-course-curriculum"))});document.addEventListener("DOMContentLoaded",(function(e){LP.Hook.doAction("course-ready"),y.a.init()}))},5:function(e,t,n){"use strict";function o(e){return function(e){if(Array.isArray(e))return r(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return r(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}n.d(t,"a",(function(){return c}));var i=jQuery,l=lodash.throttle,c=function(){var e,t=i("#popup-course"),n=i("#learn-press-course-curriculum");i("#sidebar-toggle").on("change",(function(e){LP.Cookies.set("sidebar-toggle",e.target.checked),r(e.target.checked)}));var r=function(e){i("body").removeClass("lp-sidebar-toggle__open"),i("body").removeClass("lp-sidebar-toggle__close"),e?i("body").addClass("lp-sidebar-toggle__close"):i("body").addClass("lp-sidebar-toggle__open")};r(LP.Cookies.get("sidebar-toggle")),n.find(".section-desc").each((function(e,t){var n=i('<span class="show-desc"></span>').on("click",(function(){o.toggleClass("c")})),o=i(t).siblings(".section-title").append(n)})),i(".section").each((function(){var e=i(this);e.find(".section-left").on("click",(function(){var t=e.toggleClass("closed").hasClass("closed"),n=LP.Cookies.get("closed-section-"+lpGlobalSettings.post_id)||[],r=parseInt(e.data("section-id")),i=n.findIndex((function(e){return e==r}));t?n.push(parseInt(e.data("section-id"))):n.splice(i,1),LP.Cookies.remove("closed-section-(.*)"),LP.Cookies.set("closed-section-"+lpGlobalSettings.post_id,o(new Set(n)))}))})),t.length&&(n.on("scroll",l((function(){var t=i(this);t.addClass("scrolling"),e&&clearTimeout(e),e=setTimeout((function(){t.removeClass("scrolling")}),1e3)}),500)),LP.toElement(".course-item.current",{container:".curriculum-scrollable:eq(1)",offset:100,duration:1}))}},6:function(e,t,n){"use strict";var o=jQuery,r=null,i={elLPOverlay:null,elMainContent:null,elTitle:null,elBtnYes:null,elBtnNo:null,elFooter:null,elCalledModal:null,callBackYes:null,init:function(){return this.elLPOverlay=o(".lp-overlay"),!!this.elLPOverlay.length&&(r=this.elLPOverlay,this.elMainContent=r.find(".main-content"),this.elTitle=r.find(".modal-title"),this.elBtnYes=r.find(".btn-yes"),this.elBtnNo=r.find(".btn-no"),this.elFooter=r.find(".lp-modal-footer"),o(document).on("click",".close, .btn-no",(function(){r.hide()})),o(document).on("click",".btn-yes",(function(){"function"==typeof i.callBackYes&&i.callBackYes()})),!0)},setElCalledModal:function(e){this.elCalledModal=e},setContentModal:function(e,t){this.elMainContent.html(e),"function"==typeof t&&t()},setTitleModal:function(e){this.elTitle.html(e)}},l=i,c=(jQuery,{elBtnFinishCourse:null,elBtnCompleteItem:null,init:function(){l.init()&&void 0!==lpGlobalSettings&&"yes"===lpGlobalSettings.option_enable_popup_confirm_finish&&(this.elBtnFinishCourse=document.querySelectorAll(".lp-btn-finish-course"),this.elBtnCompleteItem=document.querySelector(".lp-btn-complete-item"),this.elBtnCompleteItem&&this.elBtnCompleteItem.addEventListener("click",(function(e){e.preventDefault();var t=e.target.closest("form");l.elLPOverlay.show(),l.setTitleModal(t.dataset.title),l.setContentModal('<div class="pd-2em">'+t.dataset.confirm+"</div>"),l.callBackYes=function(){t.submit()}})),this.elBtnFinishCourse&&this.elBtnFinishCourse.forEach((function(e){return e.addEventListener("click",(function(e){e.preventDefault();var t=e.target.closest("form");l.elLPOverlay.show(),l.setTitleModal(t.dataset.title),l.setContentModal('<div class="pd-2em">'+t.dataset.confirm+"</div>"),l.callBackYes=function(){t.submit()}}))})))}});t.a=c},8:function(e,t){function n(e){return function(e){if(Array.isArray(e))return o(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return o(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return o(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}LP.Hook.addAction("lp-compatible-builder",(function(){LP.Hook.removeAction("lp-compatible-builder"),"undefined"!=typeof elementorFrontend&&n(document.querySelectorAll("#popup-content"))[0].addEventListener("scroll",(function(){Waypoint.refreshAll(),window.dispatchEvent(new Event("resize"))})),"undefined"!=typeof vc_js&&n(document.querySelectorAll("#popup-content"))[0].addEventListener("scroll",(function(){VcWaypoint.refreshAll()}))})),LP.Hook.addAction("lp-quiz-compatible-builder",(function(){return LP.Hook.removeAction("lp-quiz-compatible-builder"),LP.Hook.doAction("lp-compatible-builder"),"undefined"!=typeof elementorFrontend?window.elementorFrontend.init():"undefined"!=typeof vc_js?("undefined"!=typeof vc_round_charts&&vc_round_charts(),"undefined"!=typeof vc_pieChart&&vc_pieChart(),"undefined"!=typeof vc_line_charts&&vc_line_charts(),window.vc_js()):void 0})),LP.Hook.addAction("lp-question-compatible-builder",(function(){return LP.Hook.removeAction("lp-question-compatible-builder"),LP.Hook.removeAction("lp-quiz-compatible-builder"),LP.Hook.doAction("lp-compatible-builder"),"undefined"!=typeof elementorFrontend?window.elementorFrontend.init():"undefined"!=typeof vc_js?("undefined"!=typeof vc_round_charts&&vc_round_charts(),"undefined"!=typeof vc_pieChart&&vc_pieChart(),"undefined"!=typeof vc_line_charts&&vc_line_charts(),window.vc_js()):void 0}))}});
1
+ this.LP=this.LP||{},this.LP.singleCurriculum=function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=21)}({2:function(e,t){e.exports=window.wp.element},21:function(e,t,n){"use strict";n.r(t),n.d(t,"init",(function(){return b}));var o=n(2),r=n(5),i=jQuery;n(8);function l(e){return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function a(e,t){return(a=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function s(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=f(e);if(t){var r=f(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return d(this,n)}}function d(e,t){return!t||"object"!==l(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function f(e){return(f=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}jQuery;var p=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&a(e,t)}(i,e);var t,n,o,r=s(i);function i(){return c(this,i),r.apply(this,arguments)}return t=i,(n=[{key:"checkCourseDurationExpire",value:function(){var e=document.getElementsByName("lp-course-timestamp-remaining");if(e.length){var t=e[0].value;t<86400&&setTimeout((function(){window.location.reload(!0)}),1e3*t)}}},{key:"render",value:function(){return React.createElement("div",null)}}])&&u(t.prototype,n),o&&u(t,o),i}(o.Component),m=p;window.addEventListener("DOMContentLoaded",(function(){LP.Hook.doAction("lp-compatible-builder"),function(){var e=document.querySelector("#popup-course"),t=document.querySelector("#learn-press-course-curriculum");if(e&&t){var n=t.querySelector(".curriculum-sections"),o=e.querySelector(".search-course"),r=e.querySelector('.search-course input[type="text"]');if(!r||!n||!o)return;var i=n.querySelectorAll("li.section"),l=n.querySelectorAll("li.course-item"),c=[];l.forEach((function(e){var t=e.dataset.id,n=e.querySelector(".item-name");c.push({id:t,name:n?n.textContent.toLowerCase():""})}));var u=function(e){e.preventDefault();var t=r.value;o.classList.add("searching"),t||o.classList.remove("searching");var n=[];c.forEach((function(e){t&&!e.name.match(t.toLowerCase())||(n.push(e.id),l.forEach((function(e){-1!==n.indexOf(e.dataset.id)?e.classList.remove("hide-if-js"):e.classList.add("hide-if-js")})))})),i.forEach((function(e){var t=e.querySelectorAll(".course-item"),o=[];t.forEach((function(e){n.includes(e.dataset.id)&&o.push(e.dataset.id)})),0===o.length?e.classList.add("hide-if-js"):e.classList.remove("hide-if-js")}))},a=o.querySelector(".clear");a&&a.addEventListener("click",(function(e){e.preventDefault(),r.value="",u(e)})),o.addEventListener("submit",u),r.addEventListener("keyup",u)}}(),Object(r.a)(),i(".learn-press-progress").each((function(){var e=i(this).find(".learn-press-progress__active"),t=e.data("value");void 0!==t&&e.css("left",-(100-parseInt(t))+"%")})),function(){var e=document.querySelector(".lp-lesson-comment-btn");if(e){var t=e.textContent,n=e.dataset.close;window.location.hash.includes("comment")&&e.parentNode.classList.add("open-comments");var o=function(e,o){o.classList.contains("open-comments")?e.textContent=n:e.textContent=t};o(e,e.parentNode),e.addEventListener("click",(function(t){t.preventDefault(),e.parentNode.classList.toggle("open-comments"),o(e,e.parentNode)}))}}(),(new p).checkCourseDurationExpire()}));var y=n(6),v=jQuery,h={init:function(){this.scrollToItemViewing=function(){var e=v(".viewing-course-item");if(e.length){var t=v("#popup-sidebar").outerHeight(),n=v(".section-title").outerHeight(),o=v(".section-header").outerHeight(),r=new RegExp("^viewing-course-item-([0-9].*)"),i=e.attr("class").split(/\s+/),l=0;if(v.each(i,(function(e,t){var n=r.exec(t);if(n)return l=n[1],!1})),0===l)return;var c=v(".course-item-"+l).offset().top-t;void 0===n?c=c-o+20:c-=n,v("#learn-press-course-curriculum").animate({scrollTop:c+7},800)}},this.scrollToItemViewing()}},b=(jQuery,t.default=m,function(){wp.element.render(React.createElement(m,null),document.getElementById("learn-press-course-curriculum"))});document.addEventListener("DOMContentLoaded",(function(e){LP.Hook.doAction("course-ready"),y.a.init(),h.init()}))},5:function(e,t,n){"use strict";function o(e){return function(e){if(Array.isArray(e))return r(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return r(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}n.d(t,"a",(function(){return c}));var i=jQuery,l=lodash.throttle,c=function(){var e,t=i("#popup-course"),n=i("#learn-press-course-curriculum");i("#sidebar-toggle").on("change",(function(e){LP.Cookies.set("sidebar-toggle",e.target.checked),r(e.target.checked)}));var r=function(e){i("body").removeClass("lp-sidebar-toggle__open"),i("body").removeClass("lp-sidebar-toggle__close"),e?i("body").addClass("lp-sidebar-toggle__close"):i("body").addClass("lp-sidebar-toggle__open")};r(LP.Cookies.get("sidebar-toggle")),n.find(".section-desc").each((function(e,t){var n=i('<span class="show-desc"></span>').on("click",(function(){o.toggleClass("c")})),o=i(t).siblings(".section-title").append(n)})),i(".section").each((function(){var e=i(this);e.find(".section-left").on("click",(function(){var t=e.toggleClass("closed").hasClass("closed"),n=LP.Cookies.get("closed-section-"+lpGlobalSettings.post_id)||[],r=parseInt(e.data("section-id")),i=n.findIndex((function(e){return e==r}));t?n.push(parseInt(e.data("section-id"))):n.splice(i,1),LP.Cookies.remove("closed-section-(.*)"),LP.Cookies.set("closed-section-"+lpGlobalSettings.post_id,o(new Set(n)))}))})),t.length&&(n.on("scroll",l((function(){var t=i(this);t.addClass("scrolling"),e&&clearTimeout(e),e=setTimeout((function(){t.removeClass("scrolling")}),1e3)}),500)),LP.toElement(".course-item.current",{container:".curriculum-scrollable:eq(1)",offset:100,duration:1}))}},6:function(e,t,n){"use strict";var o=jQuery,r=null,i={elLPOverlay:null,elMainContent:null,elTitle:null,elBtnYes:null,elBtnNo:null,elFooter:null,elCalledModal:null,callBackYes:null,init:function(){return this.elLPOverlay=o(".lp-overlay"),!!this.elLPOverlay.length&&(r=this.elLPOverlay,this.elMainContent=r.find(".main-content"),this.elTitle=r.find(".modal-title"),this.elBtnYes=r.find(".btn-yes"),this.elBtnNo=r.find(".btn-no"),this.elFooter=r.find(".lp-modal-footer"),o(document).on("click",".close, .btn-no",(function(){r.hide()})),o(document).on("click",".btn-yes",(function(){"function"==typeof i.callBackYes&&i.callBackYes()})),!0)},setElCalledModal:function(e){this.elCalledModal=e},setContentModal:function(e,t){this.elMainContent.html(e),"function"==typeof t&&t()},setTitleModal:function(e){this.elTitle.html(e)}},l=i,c=(jQuery,{elBtnFinishCourse:null,elBtnCompleteItem:null,init:function(){l.init()&&void 0!==lpGlobalSettings&&"yes"===lpGlobalSettings.option_enable_popup_confirm_finish&&(this.elBtnFinishCourse=document.querySelectorAll(".lp-btn-finish-course"),this.elBtnCompleteItem=document.querySelector(".lp-btn-complete-item"),this.elBtnCompleteItem&&this.elBtnCompleteItem.addEventListener("click",(function(e){e.preventDefault();var t=e.target.closest("form");l.elLPOverlay.show(),l.setTitleModal(t.dataset.title),l.setContentModal('<div class="pd-2em">'+t.dataset.confirm+"</div>"),l.callBackYes=function(){t.submit()}})),this.elBtnFinishCourse&&this.elBtnFinishCourse.forEach((function(e){return e.addEventListener("click",(function(e){e.preventDefault();var t=e.target.closest("form");l.elLPOverlay.show(),l.setTitleModal(t.dataset.title),l.setContentModal('<div class="pd-2em">'+t.dataset.confirm+"</div>"),l.callBackYes=function(){t.submit()}}))})))}});t.a=c},8:function(e,t){function n(e){return function(e){if(Array.isArray(e))return o(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return o(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return o(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}LP.Hook.addAction("lp-compatible-builder",(function(){LP.Hook.removeAction("lp-compatible-builder"),"undefined"!=typeof elementorFrontend&&n(document.querySelectorAll("#popup-content"))[0].addEventListener("scroll",(function(){Waypoint.refreshAll(),window.dispatchEvent(new Event("resize"))})),"undefined"!=typeof vc_js&&"undefined"!=typeof VcWaypoint&&n(document.querySelectorAll("#popup-content"))[0].addEventListener("scroll",(function(){VcWaypoint.refreshAll()}))})),LP.Hook.addAction("lp-quiz-compatible-builder",(function(){return LP.Hook.removeAction("lp-quiz-compatible-builder"),LP.Hook.doAction("lp-compatible-builder"),"undefined"!=typeof elementorFrontend?window.elementorFrontend.init():"undefined"!=typeof vc_js?("undefined"!=typeof vc_round_charts&&vc_round_charts(),"undefined"!=typeof vc_pieChart&&vc_pieChart(),"undefined"!=typeof vc_line_charts&&vc_line_charts(),window.vc_js()):void 0})),LP.Hook.addAction("lp-question-compatible-builder",(function(){return LP.Hook.removeAction("lp-question-compatible-builder"),LP.Hook.removeAction("lp-quiz-compatible-builder"),LP.Hook.doAction("lp-compatible-builder"),"undefined"!=typeof elementorFrontend?window.elementorFrontend.init():"undefined"!=typeof vc_js?("undefined"!=typeof vc_round_charts&&vc_round_charts(),"undefined"!=typeof vc_pieChart&&vc_pieChart(),"undefined"!=typeof vc_line_charts&&vc_line_charts(),window.vc_js()):void 0}))}});
assets/js/vendor/chart.js CHANGED
@@ -1,10 +1,13 @@
1
  /*!
2
- * Chart.js
3
- * http://chartjs.org/
4
- * Version: 1.0.2
5
- *
6
- * Copyright 2015 Nick Downie
7
- * Released under the MIT license
8
- * https://github.com/nnnick/Chart.js/blob/master/LICENSE.md
9
  */
10
- (function(){"use strict";var t=this,i=t.Chart,e=function(t){this.canvas=t.canvas,this.ctx=t;var i=function(t,i){return t["offset"+i]?t["offset"+i]:document.defaultView.getComputedStyle(t).getPropertyValue(i)},e=this.width=i(t.canvas,"Width"),n=this.height=i(t.canvas,"Height");t.canvas.width=e,t.canvas.height=n;var e=this.width=t.canvas.width,n=this.height=t.canvas.height;return this.aspectRatio=this.width/this.height,s.retinaScale(this),this};e.defaults={global:{animation:!0,animationSteps:60,animationEasing:"easeOutQuart",showScale:!0,scaleOverride:!1,scaleSteps:null,scaleStepWidth:null,scaleStartValue:null,scaleLineColor:"rgba(0,0,0,.1)",scaleLineWidth:1,scaleShowLabels:!0,scaleLabel:"<%=value%>",scaleIntegersOnly:!0,scaleBeginAtZero:!1,scaleFontFamily:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",scaleFontSize:12,scaleFontStyle:"normal",scaleFontColor:"#666",responsive:!1,maintainAspectRatio:!0,showTooltips:!0,customTooltips:!1,tooltipEvents:["mousemove","touchstart","touchmove","mouseout"],tooltipFillColor:"rgba(0,0,0,0.8)",tooltipFontFamily:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",tooltipFontSize:14,tooltipFontStyle:"normal",tooltipFontColor:"#fff",tooltipTitleFontFamily:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",tooltipTitleFontSize:14,tooltipTitleFontStyle:"bold",tooltipTitleFontColor:"#fff",tooltipYPadding:6,tooltipXPadding:6,tooltipCaretSize:8,tooltipCornerRadius:6,tooltipXOffset:10,tooltipTemplate:"<%if (label){%><%=label%>: <%}%><%= value %>",multiTooltipTemplate:"<%= value %>",multiTooltipKeyBackground:"#fff",onAnimationProgress:function(){},onAnimationComplete:function(){}}},e.types={};var s=e.helpers={},n=s.each=function(t,i,e){var s=Array.prototype.slice.call(arguments,3);if(t)if(t.length===+t.length){var n;for(n=0;n<t.length;n++)i.apply(e,[t[n],n].concat(s))}else for(var o in t)i.apply(e,[t[o],o].concat(s))},o=s.clone=function(t){var i={};return n(t,function(e,s){t.hasOwnProperty(s)&&(i[s]=e)}),i},a=s.extend=function(t){return n(Array.prototype.slice.call(arguments,1),function(i){n(i,function(e,s){i.hasOwnProperty(s)&&(t[s]=e)})}),t},h=s.merge=function(){var t=Array.prototype.slice.call(arguments,0);return t.unshift({}),a.apply(null,t)},l=s.indexOf=function(t,i){if(Array.prototype.indexOf)return t.indexOf(i);for(var e=0;e<t.length;e++)if(t[e]===i)return e;return-1},r=(s.where=function(t,i){var e=[];return s.each(t,function(t){i(t)&&e.push(t)}),e},s.findNextWhere=function(t,i,e){e||(e=-1);for(var s=e+1;s<t.length;s++){var n=t[s];if(i(n))return n}},s.findPreviousWhere=function(t,i,e){e||(e=t.length);for(var s=e-1;s>=0;s--){var n=t[s];if(i(n))return n}},s.inherits=function(t){var i=this,e=t&&t.hasOwnProperty("constructor")?t.constructor:function(){return i.apply(this,arguments)},s=function(){this.constructor=e};return s.prototype=i.prototype,e.prototype=new s,e.extend=r,t&&a(e.prototype,t),e.__super__=i.prototype,e}),c=s.noop=function(){},u=s.uid=function(){var t=0;return function(){return"chart-"+t++}}(),d=s.warn=function(t){window.console&&"function"==typeof window.console.warn&&console.warn(t)},p=s.amd="function"==typeof define&&define.amd,f=s.isNumber=function(t){return!isNaN(parseFloat(t))&&isFinite(t)},g=s.max=function(t){return Math.max.apply(Math,t)},m=s.min=function(t){return Math.min.apply(Math,t)},v=(s.cap=function(t,i,e){if(f(i)){if(t>i)return i}else if(f(e)&&e>t)return e;return t},s.getDecimalPlaces=function(t){return t%1!==0&&f(t)?t.toString().split(".")[1].length:0}),S=s.radians=function(t){return t*(Math.PI/180)},x=(s.getAngleFromPoint=function(t,i){var e=i.x-t.x,s=i.y-t.y,n=Math.sqrt(e*e+s*s),o=2*Math.PI+Math.atan2(s,e);return 0>e&&0>s&&(o+=2*Math.PI),{angle:o,distance:n}},s.aliasPixel=function(t){return t%2===0?0:.5}),y=(s.splineCurve=function(t,i,e,s){var n=Math.sqrt(Math.pow(i.x-t.x,2)+Math.pow(i.y-t.y,2)),o=Math.sqrt(Math.pow(e.x-i.x,2)+Math.pow(e.y-i.y,2)),a=s*n/(n+o),h=s*o/(n+o);return{inner:{x:i.x-a*(e.x-t.x),y:i.y-a*(e.y-t.y)},outer:{x:i.x+h*(e.x-t.x),y:i.y+h*(e.y-t.y)}}},s.calculateOrderOfMagnitude=function(t){return Math.floor(Math.log(t)/Math.LN10)}),C=(s.calculateScaleRange=function(t,i,e,s,n){var o=2,a=Math.floor(i/(1.5*e)),h=o>=a,l=g(t),r=m(t);l===r&&(l+=.5,r>=.5&&!s?r-=.5:l+=.5);for(var c=Math.abs(l-r),u=y(c),d=Math.ceil(l/(1*Math.pow(10,u)))*Math.pow(10,u),p=s?0:Math.floor(r/(1*Math.pow(10,u)))*Math.pow(10,u),f=d-p,v=Math.pow(10,u),S=Math.round(f/v);(S>a||a>2*S)&&!h;)if(S>a)v*=2,S=Math.round(f/v),S%1!==0&&(h=!0);else if(n&&u>=0){if(v/2%1!==0)break;v/=2,S=Math.round(f/v)}else v/=2,S=Math.round(f/v);return h&&(S=o,v=f/S),{steps:S,stepValue:v,min:p,max:p+S*v}},s.template=function(t,i){function e(t,i){var e=/\W/.test(t)?new Function("obj","var p=[],print=function(){p.push.apply(p,arguments);};with(obj){p.push('"+t.replace(/[\r\t\n]/g," ").split("<%").join(" ").replace(/((^|%>)[^\t]*)'/g,"$1\r").replace(/\t=(.*?)%>/g,"',$1,'").split(" ").join("');").split("%>").join("p.push('").split("\r").join("\\'")+"');}return p.join('');"):s[t]=s[t];return i?e(i):e}if(t instanceof Function)return t(i);var s={};return e(t,i)}),w=(s.generateLabels=function(t,i,e,s){var o=new Array(i);return labelTemplateString&&n(o,function(i,n){o[n]=C(t,{value:e+s*(n+1)})}),o},s.easingEffects={linear:function(t){return t},easeInQuad:function(t){return t*t},easeOutQuad:function(t){return-1*t*(t-2)},easeInOutQuad:function(t){return(t/=.5)<1?.5*t*t:-0.5*(--t*(t-2)-1)},easeInCubic:function(t){return t*t*t},easeOutCubic:function(t){return 1*((t=t/1-1)*t*t+1)},easeInOutCubic:function(t){return(t/=.5)<1?.5*t*t*t:.5*((t-=2)*t*t+2)},easeInQuart:function(t){return t*t*t*t},easeOutQuart:function(t){return-1*((t=t/1-1)*t*t*t-1)},easeInOutQuart:function(t){return(t/=.5)<1?.5*t*t*t*t:-0.5*((t-=2)*t*t*t-2)},easeInQuint:function(t){return 1*(t/=1)*t*t*t*t},easeOutQuint:function(t){return 1*((t=t/1-1)*t*t*t*t+1)},easeInOutQuint:function(t){return(t/=.5)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)},easeInSine:function(t){return-1*Math.cos(t/1*(Math.PI/2))+1},easeOutSine:function(t){return 1*Math.sin(t/1*(Math.PI/2))},easeInOutSine:function(t){return-0.5*(Math.cos(Math.PI*t/1)-1)},easeInExpo:function(t){return 0===t?1:1*Math.pow(2,10*(t/1-1))},easeOutExpo:function(t){return 1===t?1:1*(-Math.pow(2,-10*t/1)+1)},easeInOutExpo:function(t){return 0===t?0:1===t?1:(t/=.5)<1?.5*Math.pow(2,10*(t-1)):.5*(-Math.pow(2,-10*--t)+2)},easeInCirc:function(t){return t>=1?t:-1*(Math.sqrt(1-(t/=1)*t)-1)},easeOutCirc:function(t){return 1*Math.sqrt(1-(t=t/1-1)*t)},easeInOutCirc:function(t){return(t/=.5)<1?-0.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)},easeInElastic:function(t){var i=1.70158,e=0,s=1;return 0===t?0:1==(t/=1)?1:(e||(e=.3),s<Math.abs(1)?(s=1,i=e/4):i=e/(2*Math.PI)*Math.asin(1/s),-(s*Math.pow(2,10*(t-=1))*Math.sin(2*(1*t-i)*Math.PI/e)))},easeOutElastic:function(t){var i=1.70158,e=0,s=1;return 0===t?0:1==(t/=1)?1:(e||(e=.3),s<Math.abs(1)?(s=1,i=e/4):i=e/(2*Math.PI)*Math.asin(1/s),s*Math.pow(2,-10*t)*Math.sin(2*(1*t-i)*Math.PI/e)+1)},easeInOutElastic:function(t){var i=1.70158,e=0,s=1;return 0===t?0:2==(t/=.5)?1:(e||(e=.3*1.5),s<Math.abs(1)?(s=1,i=e/4):i=e/(2*Math.PI)*Math.asin(1/s),1>t?-.5*s*Math.pow(2,10*(t-=1))*Math.sin(2*(1*t-i)*Math.PI/e):s*Math.pow(2,-10*(t-=1))*Math.sin(2*(1*t-i)*Math.PI/e)*.5+1)},easeInBack:function(t){var i=1.70158;return 1*(t/=1)*t*((i+1)*t-i)},easeOutBack:function(t){var i=1.70158;return 1*((t=t/1-1)*t*((i+1)*t+i)+1)},easeInOutBack:function(t){var i=1.70158;return(t/=.5)<1?.5*t*t*(((i*=1.525)+1)*t-i):.5*((t-=2)*t*(((i*=1.525)+1)*t+i)+2)},easeInBounce:function(t){return 1-w.easeOutBounce(1-t)},easeOutBounce:function(t){return(t/=1)<1/2.75?7.5625*t*t:2/2.75>t?1*(7.5625*(t-=1.5/2.75)*t+.75):2.5/2.75>t?1*(7.5625*(t-=2.25/2.75)*t+.9375):1*(7.5625*(t-=2.625/2.75)*t+.984375)},easeInOutBounce:function(t){return.5>t?.5*w.easeInBounce(2*t):.5*w.easeOutBounce(2*t-1)+.5}}),b=s.requestAnimFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(t){return window.setTimeout(t,1e3/60)}}(),P=s.cancelAnimFrame=function(){return window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.oCancelAnimationFrame||window.msCancelAnimationFrame||function(t){return window.clearTimeout(t,1e3/60)}}(),L=(s.animationLoop=function(t,i,e,s,n,o){var a=0,h=w[e]||w.linear,l=function(){a++;var e=a/i,r=h(e);t.call(o,r,e,a),s.call(o,r,e),i>a?o.animationFrame=b(l):n.apply(o)};b(l)},s.getRelativePosition=function(t){var i,e,s=t.originalEvent||t,n=t.currentTarget||t.srcElement,o=n.getBoundingClientRect();return s.touches?(i=s.touches[0].clientX-o.left,e=s.touches[0].clientY-o.top):(i=s.clientX-o.left,e=s.clientY-o.top),{x:i,y:e}},s.addEvent=function(t,i,e){t.addEventListener?t.addEventListener(i,e):t.attachEvent?t.attachEvent("on"+i,e):t["on"+i]=e}),k=s.removeEvent=function(t,i,e){t.removeEventListener?t.removeEventListener(i,e,!1):t.detachEvent?t.detachEvent("on"+i,e):t["on"+i]=c},F=(s.bindEvents=function(t,i,e){t.events||(t.events={}),n(i,function(i){t.events[i]=function(){e.apply(t,arguments)},L(t.chart.canvas,i,t.events[i])})},s.unbindEvents=function(t,i){n(i,function(i,e){k(t.chart.canvas,e,i)})}),R=s.getMaximumWidth=function(t){var i=t.parentNode;return i.clientWidth},T=s.getMaximumHeight=function(t){var i=t.parentNode;return i.clientHeight},A=(s.getMaximumSize=s.getMaximumWidth,s.retinaScale=function(t){var i=t.ctx,e=t.canvas.width,s=t.canvas.height;window.devicePixelRatio&&(i.canvas.style.width=e+"px",i.canvas.style.height=s+"px",i.canvas.height=s*window.devicePixelRatio,i.canvas.width=e*window.devicePixelRatio,i.scale(window.devicePixelRatio,window.devicePixelRatio))}),M=s.clear=function(t){t.ctx.clearRect(0,0,t.width,t.height)},W=s.fontString=function(t,i,e){return i+" "+t+"px "+e},z=s.longestText=function(t,i,e){t.font=i;var s=0;return n(e,function(i){var e=t.measureText(i).width;s=e>s?e:s}),s},B=s.drawRoundedRectangle=function(t,i,e,s,n,o){t.beginPath(),t.moveTo(i+o,e),t.lineTo(i+s-o,e),t.quadraticCurveTo(i+s,e,i+s,e+o),t.lineTo(i+s,e+n-o),t.quadraticCurveTo(i+s,e+n,i+s-o,e+n),t.lineTo(i+o,e+n),t.quadraticCurveTo(i,e+n,i,e+n-o),t.lineTo(i,e+o),t.quadraticCurveTo(i,e,i+o,e),t.closePath()};e.instances={},e.Type=function(t,i,s){this.options=i,this.chart=s,this.id=u(),e.instances[this.id]=this,i.responsive&&this.resize(),this.initialize.call(this,t)},a(e.Type.prototype,{initialize:function(){return this},clear:function(){return M(this.chart),this},stop:function(){return P(this.animationFrame),this},resize:function(t){this.stop();var i=this.chart.canvas,e=R(this.chart.canvas),s=this.options.maintainAspectRatio?e/this.chart.aspectRatio:T(this.chart.canvas);return i.width=this.chart.width=e,i.height=this.chart.height=s,A(this.chart),"function"==typeof t&&t.apply(this,Array.prototype.slice.call(arguments,1)),this},reflow:c,render:function(t){return t&&this.reflow(),this.options.animation&&!t?s.animationLoop(this.draw,this.options.animationSteps,this.options.animationEasing,this.options.onAnimationProgress,this.options.onAnimationComplete,this):(this.draw(),this.options.onAnimationComplete.call(this)),this},generateLegend:function(){return C(this.options.legendTemplate,this)},destroy:function(){this.clear(),F(this,this.events);var t=this.chart.canvas;t.width=this.chart.width,t.height=this.chart.height,t.style.removeProperty?(t.style.removeProperty("width"),t.style.removeProperty("height")):(t.style.removeAttribute("width"),t.style.removeAttribute("height")),delete e.instances[this.id]},showTooltip:function(t,i){"undefined"==typeof this.activeElements&&(this.activeElements=[]);var o=function(t){var i=!1;return t.length!==this.activeElements.length?i=!0:(n(t,function(t,e){t!==this.activeElements[e]&&(i=!0)},this),i)}.call(this,t);if(o||i){if(this.activeElements=t,this.draw(),this.options.customTooltips&&this.options.customTooltips(!1),t.length>0)if(this.datasets&&this.datasets.length>1){for(var a,h,r=this.datasets.length-1;r>=0&&(a=this.datasets[r].points||this.datasets[r].bars||this.datasets[r].segments,h=l(a,t[0]),-1===h);r--);var c=[],u=[],d=function(){var t,i,e,n,o,a=[],l=[],r=[];return s.each(this.datasets,function(i){t=i.points||i.bars||i.segments,t[h]&&t[h].hasValue()&&a.push(t[h])}),s.each(a,function(t){l.push(t.x),r.push(t.y),c.push(s.template(this.options.multiTooltipTemplate,t)),u.push({fill:t._saved.fillColor||t.fillColor,stroke:t._saved.strokeColor||t.strokeColor})},this),o=m(r),e=g(r),n=m(l),i=g(l),{x:n>this.chart.width/2?n:i,y:(o+e)/2}}.call(this,h);new e.MultiTooltip({x:d.x,y:d.y,xPadding:this.options.tooltipXPadding,yPadding:this.options.tooltipYPadding,xOffset:this.options.tooltipXOffset,fillColor:this.options.tooltipFillColor,textColor:this.options.tooltipFontColor,fontFamily:this.options.tooltipFontFamily,fontStyle:this.options.tooltipFontStyle,fontSize:this.options.tooltipFontSize,titleTextColor:this.options.tooltipTitleFontColor,titleFontFamily:this.options.tooltipTitleFontFamily,titleFontStyle:this.options.tooltipTitleFontStyle,titleFontSize:this.options.tooltipTitleFontSize,cornerRadius:this.options.tooltipCornerRadius,labels:c,legendColors:u,legendColorBackground:this.options.multiTooltipKeyBackground,title:t[0].label,chart:this.chart,ctx:this.chart.ctx,custom:this.options.customTooltips}).draw()}else n(t,function(t){var i=t.tooltipPosition();new e.Tooltip({x:Math.round(i.x),y:Math.round(i.y),xPadding:this.options.tooltipXPadding,yPadding:this.options.tooltipYPadding,fillColor:this.options.tooltipFillColor,textColor:this.options.tooltipFontColor,fontFamily:this.options.tooltipFontFamily,fontStyle:this.options.tooltipFontStyle,fontSize:this.options.tooltipFontSize,caretHeight:this.options.tooltipCaretSize,cornerRadius:this.options.tooltipCornerRadius,text:C(this.options.tooltipTemplate,t),chart:this.chart,custom:this.options.customTooltips}).draw()},this);return this}},toBase64Image:function(){return this.chart.canvas.toDataURL.apply(this.chart.canvas,arguments)}}),e.Type.extend=function(t){var i=this,s=function(){return i.apply(this,arguments)};if(s.prototype=o(i.prototype),a(s.prototype,t),s.extend=e.Type.extend,t.name||i.prototype.name){var n=t.name||i.prototype.name,l=e.defaults[i.prototype.name]?o(e.defaults[i.prototype.name]):{};e.defaults[n]=a(l,t.defaults),e.types[n]=s,e.prototype[n]=function(t,i){var o=h(e.defaults.global,e.defaults[n],i||{});return new s(t,o,this)}}else d("Name not provided for this chart, so it hasn't been registered");return i},e.Element=function(t){a(this,t),this.initialize.apply(this,arguments),this.save()},a(e.Element.prototype,{initialize:function(){},restore:function(t){return t?n(t,function(t){this[t]=this._saved[t]},this):a(this,this._saved),this},save:function(){return this._saved=o(this),delete this._saved._saved,this},update:function(t){return n(t,function(t,i){this._saved[i]=this[i],this[i]=t},this),this},transition:function(t,i){return n(t,function(t,e){this[e]=(t-this._saved[e])*i+this._saved[e]},this),this},tooltipPosition:function(){return{x:this.x,y:this.y}},hasValue:function(){return f(this.value)}}),e.Element.extend=r,e.Point=e.Element.extend({display:!0,inRange:function(t,i){var e=this.hitDetectionRadius+this.radius;return Math.pow(t-this.x,2)+Math.pow(i-this.y,2)<Math.pow(e,2)},draw:function(){if(this.display){var t=this.ctx;t.beginPath(),t.arc(this.x,this.y,this.radius,0,2*Math.PI),t.closePath(),t.strokeStyle=this.strokeColor,t.lineWidth=this.strokeWidth,t.fillStyle=this.fillColor,t.fill(),t.stroke()}}}),e.Arc=e.Element.extend({inRange:function(t,i){var e=s.getAngleFromPoint(this,{x:t,y:i}),n=e.angle>=this.startAngle&&e.angle<=this.endAngle,o=e.distance>=this.innerRadius&&e.distance<=this.outerRadius;return n&&o},tooltipPosition:function(){var t=this.startAngle+(this.endAngle-this.startAngle)/2,i=(this.outerRadius-this.innerRadius)/2+this.innerRadius;return{x:this.x+Math.cos(t)*i,y:this.y+Math.sin(t)*i}},draw:function(t){var i=this.ctx;i.beginPath(),i.arc(this.x,this.y,this.outerRadius,this.startAngle,this.endAngle),i.arc(this.x,this.y,this.innerRadius,this.endAngle,this.startAngle,!0),i.closePath(),i.strokeStyle=this.strokeColor,i.lineWidth=this.strokeWidth,i.fillStyle=this.fillColor,i.fill(),i.lineJoin="bevel",this.showStroke&&i.stroke()}}),e.Rectangle=e.Element.extend({draw:function(){var t=this.ctx,i=this.width/2,e=this.x-i,s=this.x+i,n=this.base-(this.base-this.y),o=this.strokeWidth/2;this.showStroke&&(e+=o,s-=o,n+=o),t.beginPath(),t.fillStyle=this.fillColor,t.strokeStyle=this.strokeColor,t.lineWidth=this.strokeWidth,t.moveTo(e,this.base),t.lineTo(e,n),t.lineTo(s,n),t.lineTo(s,this.base),t.fill(),this.showStroke&&t.stroke()},height:function(){return this.base-this.y},inRange:function(t,i){return t>=this.x-this.width/2&&t<=this.x+this.width/2&&i>=this.y&&i<=this.base}}),e.Tooltip=e.Element.extend({draw:function(){var t=this.chart.ctx;t.font=W(this.fontSize,this.fontStyle,this.fontFamily),this.xAlign="center",this.yAlign="above";var i=this.caretPadding=2,e=t.measureText(this.text).width+2*this.xPadding,s=this.fontSize+2*this.yPadding,n=s+this.caretHeight+i;this.x+e/2>this.chart.width?this.xAlign="left":this.x-e/2<0&&(this.xAlign="right"),this.y-n<0&&(this.yAlign="below");var o=this.x-e/2,a=this.y-n;if(t.fillStyle=this.fillColor,this.custom)this.custom(this);else{switch(this.yAlign){case"above":t.beginPath(),t.moveTo(this.x,this.y-i),t.lineTo(this.x+this.caretHeight,this.y-(i+this.caretHeight)),t.lineTo(this.x-this.caretHeight,this.y-(i+this.caretHeight)),t.closePath(),t.fill();break;case"below":a=this.y+i+this.caretHeight,t.beginPath(),t.moveTo(this.x,this.y+i),t.lineTo(this.x+this.caretHeight,this.y+i+this.caretHeight),t.lineTo(this.x-this.caretHeight,this.y+i+this.caretHeight),t.closePath(),t.fill()}switch(this.xAlign){case"left":o=this.x-e+(this.cornerRadius+this.caretHeight);break;case"right":o=this.x-(this.cornerRadius+this.caretHeight)}B(t,o,a,e,s,this.cornerRadius),t.fill(),t.fillStyle=this.textColor,t.textAlign="center",t.textBaseline="middle",t.fillText(this.text,o+e/2,a+s/2)}}}),e.MultiTooltip=e.Element.extend({initialize:function(){this.font=W(this.fontSize,this.fontStyle,this.fontFamily),this.titleFont=W(this.titleFontSize,this.titleFontStyle,this.titleFontFamily),this.height=this.labels.length*this.fontSize+(this.labels.length-1)*(this.fontSize/2)+2*this.yPadding+1.5*this.titleFontSize,this.ctx.font=this.titleFont;var t=this.ctx.measureText(this.title).width,i=z(this.ctx,this.font,this.labels)+this.fontSize+3,e=g([i,t]);this.width=e+2*this.xPadding;var s=this.height/2;this.y-s<0?this.y=s:this.y+s>this.chart.height&&(this.y=this.chart.height-s),this.x>this.chart.width/2?this.x-=this.xOffset+this.width:this.x+=this.xOffset},getLineHeight:function(t){var i=this.y-this.height/2+this.yPadding,e=t-1;return 0===t?i+this.titleFontSize/2:i+(1.5*this.fontSize*e+this.fontSize/2)+1.5*this.titleFontSize},draw:function(){if(this.custom)this.custom(this);else{B(this.ctx,this.x,this.y-this.height/2,this.width,this.height,this.cornerRadius);var t=this.ctx;t.fillStyle=this.fillColor,t.fill(),t.closePath(),t.textAlign="left",t.textBaseline="middle",t.fillStyle=this.titleTextColor,t.font=this.titleFont,t.fillText(this.title,this.x+this.xPadding,this.getLineHeight(0)),t.font=this.font,s.each(this.labels,function(i,e){t.fillStyle=this.textColor,t.fillText(i,this.x+this.xPadding+this.fontSize+3,this.getLineHeight(e+1)),t.fillStyle=this.legendColorBackground,t.fillRect(this.x+this.xPadding,this.getLineHeight(e+1)-this.fontSize/2,this.fontSize,this.fontSize),t.fillStyle=this.legendColors[e].fill,t.fillRect(this.x+this.xPadding,this.getLineHeight(e+1)-this.fontSize/2,this.fontSize,this.fontSize)},this)}}}),e.Scale=e.Element.extend({initialize:function(){this.fit()},buildYLabels:function(){this.yLabels=[];for(var t=v(this.stepValue),i=0;i<=this.steps;i++)this.yLabels.push(C(this.templateString,{value:(this.min+i*this.stepValue).toFixed(t)}));this.yLabelWidth=this.display&&this.showLabels?z(this.ctx,this.font,this.yLabels):0},addXLabel:function(t){this.xLabels.push(t),this.valuesCount++,this.fit()},removeXLabel:function(){this.xLabels.shift(),this.valuesCount--,this.fit()},fit:function(){this.startPoint=this.display?this.fontSize:0,this.endPoint=this.display?this.height-1.5*this.fontSize-5:this.height,this.startPoint+=this.padding,this.endPoint-=this.padding;var t,i=this.endPoint-this.startPoint;for(this.calculateYRange(i),this.buildYLabels(),this.calculateXLabelRotation();i>this.endPoint-this.startPoint;)i=this.endPoint-this.startPoint,t=this.yLabelWidth,this.calculateYRange(i),this.buildYLabels(),t<this.yLabelWidth&&this.calculateXLabelRotation()},calculateXLabelRotation:function(){this.ctx.font=this.font;var t,i,e=this.ctx.measureText(this.xLabels[0]).width,s=this.ctx.measureText(this.xLabels[this.xLabels.length-1]).width;if(this.xScalePaddingRight=s/2+3,this.xScalePaddingLeft=e/2>this.yLabelWidth+10?e/2:this.yLabelWidth+10,this.xLabelRotation=0,this.display){var n,o=z(this.ctx,this.font,this.xLabels);this.xLabelWidth=o;for(var a=Math.floor(this.calculateX(1)-this.calculateX(0))-6;this.xLabelWidth>a&&0===this.xLabelRotation||this.xLabelWidth>a&&this.xLabelRotation<=90&&this.xLabelRotation>0;)n=Math.cos(S(this.xLabelRotation)),t=n*e,i=n*s,t+this.fontSize/2>this.yLabelWidth+8&&(this.xScalePaddingLeft=t+this.fontSize/2),this.xScalePaddingRight=this.fontSize/2,this.xLabelRotation++,this.xLabelWidth=n*o;this.xLabelRotation>0&&(this.endPoint-=Math.sin(S(this.xLabelRotation))*o+3)}else this.xLabelWidth=0,this.xScalePaddingRight=this.padding,this.xScalePaddingLeft=this.padding},calculateYRange:c,drawingArea:function(){return this.startPoint-this.endPoint},calculateY:function(t){var i=this.drawingArea()/(this.min-this.max);return this.endPoint-i*(t-this.min)},calculateX:function(t){var i=(this.xLabelRotation>0,this.width-(this.xScalePaddingLeft+this.xScalePaddingRight)),e=i/Math.max(this.valuesCount-(this.offsetGridLines?0:1),1),s=e*t+this.xScalePaddingLeft;return this.offsetGridLines&&(s+=e/2),Math.round(s)},update:function(t){s.extend(this,t),this.fit()},draw:function(){var t=this.ctx,i=(this.endPoint-this.startPoint)/this.steps,e=Math.round(this.xScalePaddingLeft);this.display&&(t.fillStyle=this.textColor,t.font=this.font,n(this.yLabels,function(n,o){var a=this.endPoint-i*o,h=Math.round(a),l=this.showHorizontalLines;t.textAlign="right",t.textBaseline="middle",this.showLabels&&t.fillText(n,e-10,a),0!==o||l||(l=!0),l&&t.beginPath(),o>0?(t.lineWidth=this.gridLineWidth,t.strokeStyle=this.gridLineColor):(t.lineWidth=this.lineWidth,t.strokeStyle=this.lineColor),h+=s.aliasPixel(t.lineWidth),l&&(t.moveTo(e,h),t.lineTo(this.width,h),t.stroke(),t.closePath()),t.lineWidth=this.lineWidth,t.strokeStyle=this.lineColor,t.beginPath(),t.moveTo(e-5,h),t.lineTo(e,h),t.stroke(),t.closePath()},this),n(this.xLabels,function(i,e){var s=this.calculateX(e)+x(this.lineWidth),n=this.calculateX(e-(this.offsetGridLines?.5:0))+x(this.lineWidth),o=this.xLabelRotation>0,a=this.showVerticalLines;0!==e||a||(a=!0),a&&t.beginPath(),e>0?(t.lineWidth=this.gridLineWidth,t.strokeStyle=this.gridLineColor):(t.lineWidth=this.lineWidth,t.strokeStyle=this.lineColor),a&&(t.moveTo(n,this.endPoint),t.lineTo(n,this.startPoint-3),t.stroke(),t.closePath()),t.lineWidth=this.lineWidth,t.strokeStyle=this.lineColor,t.beginPath(),t.moveTo(n,this.endPoint),t.lineTo(n,this.endPoint+5),t.stroke(),t.closePath(),t.save(),t.translate(s,o?this.endPoint+12:this.endPoint+8),t.rotate(-1*S(this.xLabelRotation)),t.font=this.font,t.textAlign=o?"right":"center",t.textBaseline=o?"middle":"top",t.fillText(i,0,0),t.restore()},this))}}),e.RadialScale=e.Element.extend({initialize:function(){this.size=m([this.height,this.width]),this.drawingArea=this.display?this.size/2-(this.fontSize/2+this.backdropPaddingY):this.size/2},calculateCenterOffset:function(t){var i=this.drawingArea/(this.max-this.min);return(t-this.min)*i},update:function(){this.lineArc?this.drawingArea=this.display?this.size/2-(this.fontSize/2+this.backdropPaddingY):this.size/2:this.setScaleSize(),this.buildYLabels()},buildYLabels:function(){this.yLabels=[];for(var t=v(this.stepValue),i=0;i<=this.steps;i++)this.yLabels.push(C(this.templateString,{value:(this.min+i*this.stepValue).toFixed(t)}))},getCircumference:function(){return 2*Math.PI/this.valuesCount},setScaleSize:function(){var t,i,e,s,n,o,a,h,l,r,c,u,d=m([this.height/2-this.pointLabelFontSize-5,this.width/2]),p=this.width,g=0;for(this.ctx.font=W(this.pointLabelFontSize,this.pointLabelFontStyle,this.pointLabelFontFamily),i=0;i<this.valuesCount;i++)t=this.getPointPosition(i,d),e=this.ctx.measureText(C(this.templateString,{value:this.labels[i]})).width+5,0===i||i===this.valuesCount/2?(s=e/2,t.x+s>p&&(p=t.x+s,n=i),t.x-s<g&&(g=t.x-s,a=i)):i<this.valuesCount/2?t.x+e>p&&(p=t.x+e,n=i):i>this.valuesCount/2&&t.x-e<g&&(g=t.x-e,a=i);l=g,r=Math.ceil(p-this.width),o=this.getIndexAngle(n),h=this.getIndexAngle(a),c=r/Math.sin(o+Math.PI/2),u=l/Math.sin(h+Math.PI/2),c=f(c)?c:0,u=f(u)?u:0,this.drawingArea=d-(u+c)/2,this.setCenterPoint(u,c)},setCenterPoint:function(t,i){var e=this.width-i-this.drawingArea,s=t+this.drawingArea;this.xCenter=(s+e)/2,this.yCenter=this.height/2},getIndexAngle:function(t){var i=2*Math.PI/this.valuesCount;return t*i-Math.PI/2},getPointPosition:function(t,i){var e=this.getIndexAngle(t);return{x:Math.cos(e)*i+this.xCenter,y:Math.sin(e)*i+this.yCenter}},draw:function(){if(this.display){var t=this.ctx;if(n(this.yLabels,function(i,e){if(e>0){var s,n=e*(this.drawingArea/this.steps),o=this.yCenter-n;if(this.lineWidth>0)if(t.strokeStyle=this.lineColor,t.lineWidth=this.lineWidth,this.lineArc)t.beginPath(),t.arc(this.xCenter,this.yCenter,n,0,2*Math.PI),t.closePath(),t.stroke();else{t.beginPath();for(var a=0;a<this.valuesCount;a++)s=this.getPointPosition(a,this.calculateCenterOffset(this.min+e*this.stepValue)),0===a?t.moveTo(s.x,s.y):t.lineTo(s.x,s.y);t.closePath(),t.stroke()}if(this.showLabels){if(t.font=W(this.fontSize,this.fontStyle,this.fontFamily),this.showLabelBackdrop){var h=t.measureText(i).width;t.fillStyle=this.backdropColor,t.fillRect(this.xCenter-h/2-this.backdropPaddingX,o-this.fontSize/2-this.backdropPaddingY,h+2*this.backdropPaddingX,this.fontSize+2*this.backdropPaddingY)}t.textAlign="center",t.textBaseline="middle",t.fillStyle=this.fontColor,t.fillText(i,this.xCenter,o)}}},this),!this.lineArc){t.lineWidth=this.angleLineWidth,t.strokeStyle=this.angleLineColor;for(var i=this.valuesCount-1;i>=0;i--){if(this.angleLineWidth>0){var e=this.getPointPosition(i,this.calculateCenterOffset(this.max));t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(e.x,e.y),t.stroke(),t.closePath()}var s=this.getPointPosition(i,this.calculateCenterOffset(this.max)+5);t.font=W(this.pointLabelFontSize,this.pointLabelFontStyle,this.pointLabelFontFamily),t.fillStyle=this.pointLabelFontColor;var o=this.labels.length,a=this.labels.length/2,h=a/2,l=h>i||i>o-h,r=i===h||i===o-h;t.textAlign=0===i?"center":i===a?"center":a>i?"left":"right",t.textBaseline=r?"middle":l?"bottom":"top",t.fillText(this.labels[i],s.x,s.y)}}}}}),s.addEvent(window,"resize",function(){var t;return function(){clearTimeout(t),t=setTimeout(function(){n(e.instances,function(t){t.options.responsive&&t.resize(t.render,!0)})},50)}}()),p?define(function(){return e}):"object"==typeof module&&module.exports&&(module.exports=e),t.Chart=e,e.noConflict=function(){return t.Chart=i,e}}).call(this),function(){"use strict";var t=this,i=t.Chart,e=i.helpers,s={scaleBeginAtZero:!0,scaleShowGridLines:!0,scaleGridLineColor:"rgba(0,0,0,.05)",scaleGridLineWidth:1,scaleShowHorizontalLines:!0,scaleShowVerticalLines:!0,barShowStroke:!0,barStrokeWidth:2,barValueSpacing:5,barDatasetSpacing:1,legendTemplate:'<ul class="<%=name.toLowerCase()%>-legend"><% for (var i=0; i<datasets.length; i++){%><li><span style="background-color:<%=datasets[i].fillColor%>"></span><%if(datasets[i].label){%><%=datasets[i].label%><%}%></li><%}%></ul>'};i.Type.extend({name:"Bar",defaults:s,initialize:function(t){var s=this.options;this.ScaleClass=i.Scale.extend({offsetGridLines:!0,calculateBarX:function(t,i,e){var n=this.calculateBaseWidth(),o=this.calculateX(e)-n/2,a=this.calculateBarWidth(t);return o+a*i+i*s.barDatasetSpacing+a/2},calculateBaseWidth:function(){return this.calculateX(1)-this.calculateX(0)-2*s.barValueSpacing},calculateBarWidth:function(t){var i=this.calculateBaseWidth()-(t-1)*s.barDatasetSpacing;return i/t}}),this.datasets=[],this.options.showTooltips&&e.bindEvents(this,this.options.tooltipEvents,function(t){var i="mouseout"!==t.type?this.getBarsAtEvent(t):[];this.eachBars(function(t){t.restore(["fillColor","strokeColor"])}),e.each(i,function(t){t.fillColor=t.highlightFill,t.strokeColor=t.highlightStroke}),this.showTooltip(i)}),this.BarClass=i.Rectangle.extend({strokeWidth:this.options.barStrokeWidth,showStroke:this.options.barShowStroke,ctx:this.chart.ctx}),e.each(t.datasets,function(i){var s={label:i.label||null,fillColor:i.fillColor,strokeColor:i.strokeColor,bars:[]};this.datasets.push(s),e.each(i.data,function(e,n){s.bars.push(new this.BarClass({value:e,label:t.labels[n],datasetLabel:i.label,strokeColor:i.strokeColor,fillColor:i.fillColor,highlightFill:i.highlightFill||i.fillColor,highlightStroke:i.highlightStroke||i.strokeColor}))},this)},this),this.buildScale(t.labels),this.BarClass.prototype.base=this.scale.endPoint,this.eachBars(function(t,i,s){e.extend(t,{width:this.scale.calculateBarWidth(this.datasets.length),x:this.scale.calculateBarX(this.datasets.length,s,i),y:this.scale.endPoint}),t.save()},this),this.render()},update:function(){this.scale.update(),e.each(this.activeElements,function(t){t.restore(["fillColor","strokeColor"])}),this.eachBars(function(t){t.save()}),this.render()},eachBars:function(t){e.each(this.datasets,function(i,s){e.each(i.bars,t,this,s)},this)},getBarsAtEvent:function(t){for(var i,s=[],n=e.getRelativePosition(t),o=function(t){s.push(t.bars[i])},a=0;a<this.datasets.length;a++)for(i=0;i<this.datasets[a].bars.length;i++)if(this.datasets[a].bars[i].inRange(n.x,n.y))return e.each(this.datasets,o),s;return s},buildScale:function(t){var i=this,s=function(){var t=[];return i.eachBars(function(i){t.push(i.value)}),t},n={templateString:this.options.scaleLabel,height:this.chart.height,width:this.chart.width,ctx:this.chart.ctx,textColor:this.options.scaleFontColor,fontSize:this.options.scaleFontSize,fontStyle:this.options.scaleFontStyle,fontFamily:this.options.scaleFontFamily,valuesCount:t.length,beginAtZero:this.options.scaleBeginAtZero,integersOnly:this.options.scaleIntegersOnly,calculateYRange:function(t){var i=e.calculateScaleRange(s(),t,this.fontSize,this.beginAtZero,this.integersOnly);e.extend(this,i)},xLabels:t,font:e.fontString(this.options.scaleFontSize,this.options.scaleFontStyle,this.options.scaleFontFamily),lineWidth:this.options.scaleLineWidth,lineColor:this.options.scaleLineColor,showHorizontalLines:this.options.scaleShowHorizontalLines,showVerticalLines:this.options.scaleShowVerticalLines,gridLineWidth:this.options.scaleShowGridLines?this.options.scaleGridLineWidth:0,gridLineColor:this.options.scaleShowGridLines?this.options.scaleGridLineColor:"rgba(0,0,0,0)",padding:this.options.showScale?0:this.options.barShowStroke?this.options.barStrokeWidth:0,showLabels:this.options.scaleShowLabels,display:this.options.showScale};this.options.scaleOverride&&e.extend(n,{calculateYRange:e.noop,steps:this.options.scaleSteps,stepValue:this.options.scaleStepWidth,min:this.options.scaleStartValue,max:this.options.scaleStartValue+this.options.scaleSteps*this.options.scaleStepWidth}),this.scale=new this.ScaleClass(n)},addData:function(t,i){e.each(t,function(t,e){this.datasets[e].bars.push(new this.BarClass({value:t,label:i,x:this.scale.calculateBarX(this.datasets.length,e,this.scale.valuesCount+1),y:this.scale.endPoint,width:this.scale.calculateBarWidth(this.datasets.length),base:this.scale.endPoint,strokeColor:this.datasets[e].strokeColor,fillColor:this.datasets[e].fillColor}))},this),this.scale.addXLabel(i),this.update()},removeData:function(){this.scale.removeXLabel(),e.each(this.datasets,function(t){t.bars.shift()},this),this.update()},reflow:function(){e.extend(this.BarClass.prototype,{y:this.scale.endPoint,base:this.scale.endPoint});var t=e.extend({height:this.chart.height,width:this.chart.width});this.scale.update(t)},draw:function(t){var i=t||1;this.clear();this.chart.ctx;this.scale.draw(i),e.each(this.datasets,function(t,s){e.each(t.bars,function(t,e){t.hasValue()&&(t.base=this.scale.endPoint,t.transition({x:this.scale.calculateBarX(this.datasets.length,s,e),y:this.scale.calculateY(t.value),width:this.scale.calculateBarWidth(this.datasets.length)},i).draw())},this)},this)}})}.call(this),function(){"use strict";var t=this,i=t.Chart,e=i.helpers,s={segmentShowStroke:!0,segmentStrokeColor:"#fff",segmentStrokeWidth:2,percentageInnerCutout:50,animationSteps:100,animationEasing:"easeOutBounce",animateRotate:!0,animateScale:!1,legendTemplate:'<ul class="<%=name.toLowerCase()%>-legend"><% for (var i=0; i<segments.length; i++){%><li><span style="background-color:<%=segments[i].fillColor%>"></span><%if(segments[i].label){%><%=segments[i].label%><%}%></li><%}%></ul>'};i.Type.extend({name:"Doughnut",defaults:s,initialize:function(t){this.segments=[],this.outerRadius=(e.min([this.chart.width,this.chart.height])-this.options.segmentStrokeWidth/2)/2,this.SegmentArc=i.Arc.extend({ctx:this.chart.ctx,x:this.chart.width/2,y:this.chart.height/2}),this.options.showTooltips&&e.bindEvents(this,this.options.tooltipEvents,function(t){var i="mouseout"!==t.type?this.getSegmentsAtEvent(t):[];e.each(this.segments,function(t){t.restore(["fillColor"])}),e.each(i,function(t){t.fillColor=t.highlightColor}),this.showTooltip(i)}),this.calculateTotal(t),e.each(t,function(t,i){this.addData(t,i,!0)},this),this.render()},getSegmentsAtEvent:function(t){var i=[],s=e.getRelativePosition(t);return e.each(this.segments,function(t){t.inRange(s.x,s.y)&&i.push(t)},this),i},addData:function(t,i,e){var s=i||this.segments.length;this.segments.splice(s,0,new this.SegmentArc({value:t.value,outerRadius:this.options.animateScale?0:this.outerRadius,innerRadius:this.options.animateScale?0:this.outerRadius/100*this.options.percentageInnerCutout,fillColor:t.color,highlightColor:t.highlight||t.color,showStroke:this.options.segmentShowStroke,strokeWidth:this.options.segmentStrokeWidth,strokeColor:this.options.segmentStrokeColor,startAngle:1.5*Math.PI,circumference:this.options.animateRotate?0:this.calculateCircumference(t.value),label:t.label})),e||(this.reflow(),this.update())},calculateCircumference:function(t){return 2*Math.PI*(Math.abs(t)/this.total)},calculateTotal:function(t){this.total=0,e.each(t,function(t){this.total+=Math.abs(t.value)},this)},update:function(){this.calculateTotal(this.segments),e.each(this.activeElements,function(t){t.restore(["fillColor"])}),e.each(this.segments,function(t){t.save()}),this.render()},removeData:function(t){var i=e.isNumber(t)?t:this.segments.length-1;this.segments.splice(i,1),this.reflow(),this.update()},reflow:function(){e.extend(this.SegmentArc.prototype,{x:this.chart.width/2,y:this.chart.height/2}),this.outerRadius=(e.min([this.chart.width,this.chart.height])-this.options.segmentStrokeWidth/2)/2,e.each(this.segments,function(t){t.update({outerRadius:this.outerRadius,innerRadius:this.outerRadius/100*this.options.percentageInnerCutout})},this)},draw:function(t){var i=t?t:1;this.clear(),e.each(this.segments,function(t,e){t.transition({circumference:this.calculateCircumference(t.value),outerRadius:this.outerRadius,innerRadius:this.outerRadius/100*this.options.percentageInnerCutout},i),t.endAngle=t.startAngle+t.circumference,t.draw(),0===e&&(t.startAngle=1.5*Math.PI),e<this.segments.length-1&&(this.segments[e+1].startAngle=t.endAngle)},this)}}),i.types.Doughnut.extend({name:"Pie",defaults:e.merge(s,{percentageInnerCutout:0})})}.call(this),function(){"use strict";var t=this,i=t.Chart,e=i.helpers,s={scaleShowGridLines:!0,scaleGridLineColor:"rgba(0,0,0,.05)",scaleGridLineWidth:1,scaleShowHorizontalLines:!0,scaleShowVerticalLines:!0,bezierCurve:!0,bezierCurveTension:.4,pointDot:!0,pointDotRadius:4,pointDotStrokeWidth:1,pointHitDetectionRadius:20,datasetStroke:!0,datasetStrokeWidth:2,datasetFill:!0,legendTemplate:'<ul class="<%=name.toLowerCase()%>-legend"><% for (var i=0; i<datasets.length; i++){%><li><span style="background-color:<%=datasets[i].strokeColor%>"></span><%if(datasets[i].label){%><%=datasets[i].label%><%}%></li><%}%></ul>'};i.Type.extend({name:"Line",defaults:s,initialize:function(t){this.PointClass=i.Point.extend({strokeWidth:this.options.pointDotStrokeWidth,radius:this.options.pointDotRadius,display:this.options.pointDot,hitDetectionRadius:this.options.pointHitDetectionRadius,ctx:this.chart.ctx,inRange:function(t){return Math.pow(t-this.x,2)<Math.pow(this.radius+this.hitDetectionRadius,2)}}),this.datasets=[],this.options.showTooltips&&e.bindEvents(this,this.options.tooltipEvents,function(t){var i="mouseout"!==t.type?this.getPointsAtEvent(t):[];this.eachPoints(function(t){t.restore(["fillColor","strokeColor"])}),e.each(i,function(t){t.fillColor=t.highlightFill,t.strokeColor=t.highlightStroke}),this.showTooltip(i)}),e.each(t.datasets,function(i){var s={label:i.label||null,fillColor:i.fillColor,strokeColor:i.strokeColor,pointColor:i.pointColor,pointStrokeColor:i.pointStrokeColor,points:[]};this.datasets.push(s),e.each(i.data,function(e,n){s.points.push(new this.PointClass({value:e,label:t.labels[n],datasetLabel:i.label,strokeColor:i.pointStrokeColor,fillColor:i.pointColor,highlightFill:i.pointHighlightFill||i.pointColor,highlightStroke:i.pointHighlightStroke||i.pointStrokeColor}))},this),this.buildScale(t.labels),this.eachPoints(function(t,i){e.extend(t,{x:this.scale.calculateX(i),y:this.scale.endPoint}),t.save()},this)},this),this.render()},update:function(){this.scale.update(),e.each(this.activeElements,function(t){t.restore(["fillColor","strokeColor"])}),this.eachPoints(function(t){t.save()}),this.render()},eachPoints:function(t){e.each(this.datasets,function(i){e.each(i.points,t,this)},this)},getPointsAtEvent:function(t){var i=[],s=e.getRelativePosition(t);return e.each(this.datasets,function(t){e.each(t.points,function(t){t.inRange(s.x,s.y)&&i.push(t)})},this),i},buildScale:function(t){var s=this,n=function(){var t=[];return s.eachPoints(function(i){t.push(i.value)}),t},o={templateString:this.options.scaleLabel,height:this.chart.height,width:this.chart.width,ctx:this.chart.ctx,textColor:this.options.scaleFontColor,fontSize:this.options.scaleFontSize,fontStyle:this.options.scaleFontStyle,fontFamily:this.options.scaleFontFamily,valuesCount:t.length,beginAtZero:this.options.scaleBeginAtZero,integersOnly:this.options.scaleIntegersOnly,calculateYRange:function(t){var i=e.calculateScaleRange(n(),t,this.fontSize,this.beginAtZero,this.integersOnly);e.extend(this,i)},xLabels:t,font:e.fontString(this.options.scaleFontSize,this.options.scaleFontStyle,this.options.scaleFontFamily),lineWidth:this.options.scaleLineWidth,lineColor:this.options.scaleLineColor,showHorizontalLines:this.options.scaleShowHorizontalLines,showVerticalLines:this.options.scaleShowVerticalLines,gridLineWidth:this.options.scaleShowGridLines?this.options.scaleGridLineWidth:0,gridLineColor:this.options.scaleShowGridLines?this.options.scaleGridLineColor:"rgba(0,0,0,0)",padding:this.options.showScale?0:this.options.pointDotRadius+this.options.pointDotStrokeWidth,showLabels:this.options.scaleShowLabels,display:this.options.showScale};this.options.scaleOverride&&e.extend(o,{calculateYRange:e.noop,steps:this.options.scaleSteps,stepValue:this.options.scaleStepWidth,min:this.options.scaleStartValue,max:this.options.scaleStartValue+this.options.scaleSteps*this.options.scaleStepWidth}),this.scale=new i.Scale(o)},addData:function(t,i){e.each(t,function(t,e){this.datasets[e].points.push(new this.PointClass({value:t,label:i,x:this.scale.calculateX(this.scale.valuesCount+1),y:this.scale.endPoint,strokeColor:this.datasets[e].pointStrokeColor,fillColor:this.datasets[e].pointColor}))},this),this.scale.addXLabel(i),this.update()},removeData:function(){this.scale.removeXLabel(),e.each(this.datasets,function(t){t.points.shift()},this),this.update()},reflow:function(){var t=e.extend({height:this.chart.height,width:this.chart.width});this.scale.update(t)},draw:function(t){var i=t||1;this.clear();var s=this.chart.ctx,n=function(t){return null!==t.value},o=function(t,i,s){return e.findNextWhere(i,n,s)||t},a=function(t,i,s){return e.findPreviousWhere(i,n,s)||t};this.scale.draw(i),e.each(this.datasets,function(t){var h=e.where(t.points,n);e.each(t.points,function(t,e){t.hasValue()&&t.transition({y:this.scale.calculateY(t.value),x:this.scale.calculateX(e)},i)},this),this.options.bezierCurve&&e.each(h,function(t,i){var s=i>0&&i<h.length-1?this.options.bezierCurveTension:0;t.controlPoints=e.splineCurve(a(t,h,i),t,o(t,h,i),s),t.controlPoints.outer.y>this.scale.endPoint?t.controlPoints.outer.y=this.scale.endPoint:t.controlPoints.outer.y<this.scale.startPoint&&(t.controlPoints.outer.y=this.scale.startPoint),t.controlPoints.inner.y>this.scale.endPoint?t.controlPoints.inner.y=this.scale.endPoint:t.controlPoints.inner.y<this.scale.startPoint&&(t.controlPoints.inner.y=this.scale.startPoint)},this),s.lineWidth=this.options.datasetStrokeWidth,s.strokeStyle=t.strokeColor,s.beginPath(),e.each(h,function(t,i){if(0===i)s.moveTo(t.x,t.y);else if(this.options.bezierCurve){var e=a(t,h,i);s.bezierCurveTo(e.controlPoints.outer.x,e.controlPoints.outer.y,t.controlPoints.inner.x,t.controlPoints.inner.y,t.x,t.y)}else s.lineTo(t.x,t.y)},this),s.stroke(),this.options.datasetFill&&h.length>0&&(s.lineTo(h[h.length-1].x,this.scale.endPoint),s.lineTo(h[0].x,this.scale.endPoint),s.fillStyle=t.fillColor,s.closePath(),s.fill()),e.each(h,function(t){t.draw()})},this)}})}.call(this),function(){"use strict";var t=this,i=t.Chart,e=i.helpers,s={scaleShowLabelBackdrop:!0,scaleBackdropColor:"rgba(255,255,255,0.75)",scaleBeginAtZero:!0,scaleBackdropPaddingY:2,scaleBackdropPaddingX:2,scaleShowLine:!0,segmentShowStroke:!0,segmentStrokeColor:"#fff",segmentStrokeWidth:2,animationSteps:100,animationEasing:"easeOutBounce",animateRotate:!0,animateScale:!1,legendTemplate:'<ul class="<%=name.toLowerCase()%>-legend"><% for (var i=0; i<segments.length; i++){%><li><span style="background-color:<%=segments[i].fillColor%>"></span><%if(segments[i].label){%><%=segments[i].label%><%}%></li><%}%></ul>'};i.Type.extend({name:"PolarArea",defaults:s,initialize:function(t){this.segments=[],this.SegmentArc=i.Arc.extend({showStroke:this.options.segmentShowStroke,strokeWidth:this.options.segmentStrokeWidth,strokeColor:this.options.segmentStrokeColor,ctx:this.chart.ctx,innerRadius:0,x:this.chart.width/2,y:this.chart.height/2}),this.scale=new i.RadialScale({display:this.options.showScale,fontStyle:this.options.scaleFontStyle,fontSize:this.options.scaleFontSize,fontFamily:this.options.scaleFontFamily,fontColor:this.options.scaleFontColor,showLabels:this.options.scaleShowLabels,showLabelBackdrop:this.options.scaleShowLabelBackdrop,backdropColor:this.options.scaleBackdropColor,backdropPaddingY:this.options.scaleBackdropPaddingY,backdropPaddingX:this.options.scaleBackdropPaddingX,lineWidth:this.options.scaleShowLine?this.options.scaleLineWidth:0,lineColor:this.options.scaleLineColor,lineArc:!0,width:this.chart.width,height:this.chart.height,xCenter:this.chart.width/2,yCenter:this.chart.height/2,ctx:this.chart.ctx,templateString:this.options.scaleLabel,valuesCount:t.length}),this.updateScaleRange(t),this.scale.update(),e.each(t,function(t,i){this.addData(t,i,!0)},this),this.options.showTooltips&&e.bindEvents(this,this.options.tooltipEvents,function(t){var i="mouseout"!==t.type?this.getSegmentsAtEvent(t):[];e.each(this.segments,function(t){t.restore(["fillColor"])}),e.each(i,function(t){t.fillColor=t.highlightColor}),this.showTooltip(i)}),this.render()},getSegmentsAtEvent:function(t){var i=[],s=e.getRelativePosition(t);return e.each(this.segments,function(t){t.inRange(s.x,s.y)&&i.push(t)},this),i},addData:function(t,i,e){var s=i||this.segments.length;this.segments.splice(s,0,new this.SegmentArc({fillColor:t.color,highlightColor:t.highlight||t.color,label:t.label,value:t.value,outerRadius:this.options.animateScale?0:this.scale.calculateCenterOffset(t.value),circumference:this.options.animateRotate?0:this.scale.getCircumference(),startAngle:1.5*Math.PI})),e||(this.reflow(),this.update())},removeData:function(t){var i=e.isNumber(t)?t:this.segments.length-1;this.segments.splice(i,1),this.reflow(),this.update()},calculateTotal:function(t){this.total=0,e.each(t,function(t){this.total+=t.value},this),this.scale.valuesCount=this.segments.length},updateScaleRange:function(t){var i=[];e.each(t,function(t){i.push(t.value)});var s=this.options.scaleOverride?{steps:this.options.scaleSteps,stepValue:this.options.scaleStepWidth,min:this.options.scaleStartValue,max:this.options.scaleStartValue+this.options.scaleSteps*this.options.scaleStepWidth}:e.calculateScaleRange(i,e.min([this.chart.width,this.chart.height])/2,this.options.scaleFontSize,this.options.scaleBeginAtZero,this.options.scaleIntegersOnly);e.extend(this.scale,s,{size:e.min([this.chart.width,this.chart.height]),xCenter:this.chart.width/2,yCenter:this.chart.height/2})},update:function(){this.calculateTotal(this.segments),e.each(this.segments,function(t){t.save()}),this.reflow(),this.render()},reflow:function(){e.extend(this.SegmentArc.prototype,{x:this.chart.width/2,y:this.chart.height/2}),this.updateScaleRange(this.segments),this.scale.update(),e.extend(this.scale,{xCenter:this.chart.width/2,yCenter:this.chart.height/2}),e.each(this.segments,function(t){t.update({outerRadius:this.scale.calculateCenterOffset(t.value)})},this)},draw:function(t){var i=t||1;this.clear(),e.each(this.segments,function(t,e){t.transition({circumference:this.scale.getCircumference(),outerRadius:this.scale.calculateCenterOffset(t.value)},i),t.endAngle=t.startAngle+t.circumference,0===e&&(t.startAngle=1.5*Math.PI),e<this.segments.length-1&&(this.segments[e+1].startAngle=t.endAngle),t.draw()},this),this.scale.draw()}})}.call(this),function(){"use strict";var t=this,i=t.Chart,e=i.helpers;i.Type.extend({name:"Radar",defaults:{scaleShowLine:!0,angleShowLineOut:!0,scaleShowLabels:!1,scaleBeginAtZero:!0,angleLineColor:"rgba(0,0,0,.1)",angleLineWidth:1,pointLabelFontFamily:"'Arial'",pointLabelFontStyle:"normal",pointLabelFontSize:10,pointLabelFontColor:"#666",pointDot:!0,pointDotRadius:3,pointDotStrokeWidth:1,pointHitDetectionRadius:20,datasetStroke:!0,datasetStrokeWidth:2,datasetFill:!0,legendTemplate:'<ul class="<%=name.toLowerCase()%>-legend"><% for (var i=0; i<datasets.length; i++){%><li><span style="background-color:<%=datasets[i].strokeColor%>"></span><%if(datasets[i].label){%><%=datasets[i].label%><%}%></li><%}%></ul>'},initialize:function(t){this.PointClass=i.Point.extend({strokeWidth:this.options.pointDotStrokeWidth,radius:this.options.pointDotRadius,display:this.options.pointDot,hitDetectionRadius:this.options.pointHitDetectionRadius,ctx:this.chart.ctx}),this.datasets=[],this.buildScale(t),this.options.showTooltips&&e.bindEvents(this,this.options.tooltipEvents,function(t){var i="mouseout"!==t.type?this.getPointsAtEvent(t):[];this.eachPoints(function(t){t.restore(["fillColor","strokeColor"])}),e.each(i,function(t){t.fillColor=t.highlightFill,t.strokeColor=t.highlightStroke}),this.showTooltip(i)}),e.each(t.datasets,function(i){var s={label:i.label||null,fillColor:i.fillColor,strokeColor:i.strokeColor,pointColor:i.pointColor,pointStrokeColor:i.pointStrokeColor,points:[]};this.datasets.push(s),e.each(i.data,function(e,n){var o;this.scale.animation||(o=this.scale.getPointPosition(n,this.scale.calculateCenterOffset(e))),s.points.push(new this.PointClass({value:e,label:t.labels[n],datasetLabel:i.label,x:this.options.animation?this.scale.xCenter:o.x,y:this.options.animation?this.scale.yCenter:o.y,strokeColor:i.pointStrokeColor,fillColor:i.pointColor,highlightFill:i.pointHighlightFill||i.pointColor,highlightStroke:i.pointHighlightStroke||i.pointStrokeColor}))},this)},this),this.render()},eachPoints:function(t){e.each(this.datasets,function(i){e.each(i.points,t,this)},this)},getPointsAtEvent:function(t){var i=e.getRelativePosition(t),s=e.getAngleFromPoint({x:this.scale.xCenter,y:this.scale.yCenter},i),n=2*Math.PI/this.scale.valuesCount,o=Math.round((s.angle-1.5*Math.PI)/n),a=[];return(o>=this.scale.valuesCount||0>o)&&(o=0),s.distance<=this.scale.drawingArea&&e.each(this.datasets,function(t){a.push(t.points[o])}),a},buildScale:function(t){this.scale=new i.RadialScale({display:this.options.showScale,fontStyle:this.options.scaleFontStyle,fontSize:this.options.scaleFontSize,fontFamily:this.options.scaleFontFamily,fontColor:this.options.scaleFontColor,showLabels:this.options.scaleShowLabels,showLabelBackdrop:this.options.scaleShowLabelBackdrop,backdropColor:this.options.scaleBackdropColor,backdropPaddingY:this.options.scaleBackdropPaddingY,backdropPaddingX:this.options.scaleBackdropPaddingX,lineWidth:this.options.scaleShowLine?this.options.scaleLineWidth:0,lineColor:this.options.scaleLineColor,angleLineColor:this.options.angleLineColor,angleLineWidth:this.options.angleShowLineOut?this.options.angleLineWidth:0,pointLabelFontColor:this.options.pointLabelFontColor,pointLabelFontSize:this.options.pointLabelFontSize,pointLabelFontFamily:this.options.pointLabelFontFamily,pointLabelFontStyle:this.options.pointLabelFontStyle,height:this.chart.height,width:this.chart.width,xCenter:this.chart.width/2,yCenter:this.chart.height/2,ctx:this.chart.ctx,templateString:this.options.scaleLabel,labels:t.labels,valuesCount:t.datasets[0].data.length}),this.scale.setScaleSize(),this.updateScaleRange(t.datasets),this.scale.buildYLabels()},updateScaleRange:function(t){var i=function(){var i=[];return e.each(t,function(t){t.data?i=i.concat(t.data):e.each(t.points,function(t){i.push(t.value)})}),i}(),s=this.options.scaleOverride?{steps:this.options.scaleSteps,stepValue:this.options.scaleStepWidth,min:this.options.scaleStartValue,max:this.options.scaleStartValue+this.options.scaleSteps*this.options.scaleStepWidth}:e.calculateScaleRange(i,e.min([this.chart.width,this.chart.height])/2,this.options.scaleFontSize,this.options.scaleBeginAtZero,this.options.scaleIntegersOnly);e.extend(this.scale,s)},addData:function(t,i){this.scale.valuesCount++,e.each(t,function(t,e){var s=this.scale.getPointPosition(this.scale.valuesCount,this.scale.calculateCenterOffset(t));this.datasets[e].points.push(new this.PointClass({value:t,label:i,x:s.x,y:s.y,strokeColor:this.datasets[e].pointStrokeColor,fillColor:this.datasets[e].pointColor}))},this),this.scale.labels.push(i),this.reflow(),this.update()},removeData:function(){this.scale.valuesCount--,this.scale.labels.shift(),e.each(this.datasets,function(t){t.points.shift()},this),this.reflow(),this.update()},update:function(){this.eachPoints(function(t){t.save()}),this.reflow(),this.render()},reflow:function(){e.extend(this.scale,{width:this.chart.width,height:this.chart.height,size:e.min([this.chart.width,this.chart.height]),xCenter:this.chart.width/2,yCenter:this.chart.height/2}),this.updateScaleRange(this.datasets),this.scale.setScaleSize(),this.scale.buildYLabels()},draw:function(t){var i=t||1,s=this.chart.ctx;this.clear(),this.scale.draw(),e.each(this.datasets,function(t){e.each(t.points,function(t,e){t.hasValue()&&t.transition(this.scale.getPointPosition(e,this.scale.calculateCenterOffset(t.value)),i)},this),s.lineWidth=this.options.datasetStrokeWidth,s.strokeStyle=t.strokeColor,s.beginPath(),e.each(t.points,function(t,i){0===i?s.moveTo(t.x,t.y):s.lineTo(t.x,t.y)},this),s.closePath(),s.stroke(),s.fillStyle=t.fillColor,s.fill(),e.each(t.points,function(t){t.hasValue()&&t.draw()})},this)}})}.call(this);
 
 
 
 
 
 
1
  /*!
2
+ * Chart.js v3.2.1
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,initial:e.initial,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"),n.initial=!1),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,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 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 z(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 F{constructor(t){if(t instanceof F)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)||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],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 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 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 F(t)}const B=t=>t instanceof CanvasGradient||t instanceof CanvasPattern;function W(t){return B(t)?t:V(t)}function H(t){return B(t)?t:V(t).saturate(.5).darken(.1).hexString()}function N(){}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=(t,e)=>{if(t.size!==e.size)return!1;for(const i of t)if(!e.has(i))return!1;return!0},ft=Object.create(null),gt=Object.create(null);function pt(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 mt(t,e,i){return"string"==typeof e?ot(pt(t,e),i):ot(pt(t,""),e)}var xt=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)=>H(e.backgroundColor),this.hoverBorderColor=(t,e)=>H(e.borderColor),this.hoverColor=(t,e)=>H(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 mt(this,t,e)}get(t){return pt(this,t)}describe(t,e){return mt(gt,t,e)}override(t,e){return mt(ft,t,e)}route(t,e,i,n){const o=pt(this,t),s=pt(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 bt=Math.PI,_t=2*bt,yt=_t+bt,vt=Number.POSITIVE_INFINITY,wt=bt/180,Mt=bt/2,kt=bt/4,St=2*bt/3,Pt=Math.log10,Dt=Math.sign;function Ct(t){const e=Math.pow(10,Math.floor(Pt(t))),i=t/e;return(i<=1?1:i<=2?2:i<=5?5:10)*e}function Ot(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 At(t){return!isNaN(parseFloat(t))&&isFinite(t)}function Tt(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 Lt(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 Et(t){return t*(bt/180)}function It(t){return t*(180/bt)}function zt(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*bt&&(s+=_t),{angle:s,distance:o}}function Vt(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Bt(t,e){return(t-e+yt)%_t-bt}function Wt(t){return(t%_t+_t)%_t}function Ht(t,e,i){const n=Wt(t),o=Wt(e),s=Wt(i),a=Wt(o-n),r=Wt(s-n),l=Wt(n-o),c=Wt(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 jt(t){return Nt(t,-32768,32767)}function $t(t){return!t||$(t.size)||$(t.family)?null:(t.style?t.style+" ":"")+(t.weight?t.weight+" ":"")+t.size+"px "+t.family}function Yt(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 Ut(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=Yt(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=Yt(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 Xt(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 qt(t,e){(e=e||t.getContext("2d")).save(),e.resetTransform(),e.clearRect(0,0,t.width,t.height),e.restore()}function Kt(t,e,i,n){let o,s,a,r,l;const c=e.pointStyle,h=e.rotation,d=e.radius;let u=(h||0)*wt;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,_t),t.closePath();break;case"triangle":t.moveTo(i+Math.sin(u)*d,n-Math.cos(u)*d),u+=St,t.lineTo(i+Math.sin(u)*d,n-Math.cos(u)*d),u+=St,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+kt)*r,a=Math.sin(u+kt)*r,t.arc(i-s,n-a,l,u-bt,u-Mt),t.arc(i+a,n-s,l,u-Mt,u),t.arc(i+s,n+a,l,u,u+Mt),t.arc(i-a,n+s,l,u+Mt,u+bt),t.closePath();break;case"rect":if(!h){r=Math.SQRT1_2*d,t.rect(i-r,n-r,2*r,2*r);break}u+=kt;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+=kt;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+=kt,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 Gt(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 Zt(t,e){t.save(),t.beginPath(),t.rect(e.left,e.top,e.right-e.left,e.bottom-e.top),t.clip()}function Qt(t){t.restore()}function Jt(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 te(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 ee(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 ie(t,e){const{x:i,y:n,w:o,h:s,radius:a}=e;t.arc(i+a.topLeft,n+a.topLeft,a.topLeft,-Mt,bt,!0),t.lineTo(i,n+s-a.bottomLeft),t.arc(i+a.bottomLeft,n+s-a.bottomLeft,a.bottomLeft,bt,Mt,!0),t.lineTo(i+o-a.bottomRight,n+s),t.arc(i+o-a.bottomRight,n+s-a.bottomRight,a.bottomRight,Mt,0,!0),t.lineTo(i+o,n+a.topRight),t.arc(i+o-a.topRight,n+a.topRight,a.topRight,0,-Mt,!0),t.lineTo(i+a.topLeft,n)}function ne(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 oe=(t,e,i)=>ne(t,i,(n=>t[n][e]<i)),se=(t,e,i)=>ne(t,i,(n=>t[n][e]>=i));function ae(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 re=["push","pop","shift","splice","unshift"];function le(t,e){t._chartjs?t._chartjs.listeners.push(e):(Object.defineProperty(t,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[e]}}),re.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 ce(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||(re.forEach((e=>{delete t[e]})),delete t._chartjs)}function he(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 de(t){let e=t.parentNode;return e&&"[object ShadowRoot]"===e.toString()&&(e=e.host),e}function ue(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 fe=t=>window.getComputedStyle(t,null);function ge(t,e){return fe(t).getPropertyValue(e)}const pe=["top","right","bottom","left"];function me(t,e,i){const n={};i=i?"-"+i:"";for(let o=0;o<4;o++){const s=pe[o];n[s]=parseFloat(t[e+"-"+s+i])||0}return n.width=n.left+n.right,n.height=n.top+n.bottom,n}function xe(t,e){const{canvas:i,currentDevicePixelRatio:n}=e,o=fe(i),s="border-box"===o.boxSizing,a=me(o,"padding"),r=me(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 be=t=>Math.round(10*t)/10;function _e(t,e,i,n){const o=fe(t),s=me(o,"margin"),a=ue(o.maxWidth,t,"clientWidth")||vt,r=ue(o.maxHeight,t,"clientHeight")||vt,l=function(t,e,i){let n,o;if(void 0===e||void 0===i){const s=de(t);if(s){const t=s.getBoundingClientRect(),a=fe(s),r=me(a,"border","width"),l=me(a,"padding");e=t.width-l.width-r.width,i=t.height-l.height-r.height,n=ue(a.maxWidth,s,"clientWidth"),o=ue(a.maxHeight,s,"clientHeight")}else e=t.clientWidth,i=t.clientHeight}return{width:e,height:i,maxWidth:n||vt,maxHeight:o||vt}}(t,e,i);let{width:c,height:h}=l;if("content-box"===o.boxSizing){const t=me(o,"border","width"),e=me(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=be(Math.min(c,a,l.maxWidth)),h=be(Math.min(h,r,l.maxHeight)),c&&!h&&(h=be(c/2)),{width:c,height:h}}function ye(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 ve=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 we(t,e){const i=ge(t,e),n=i&&i.match(/^(\d+)(\.\d+)?px$/);return n?+n[1]:void 0}function Me(t,e){return"native"in t?{x:t.x,y:t.y}:xe(t,e)}function ke(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?se:oe;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 Se(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}=ke(s[t],e,a,o);for(let t=l;t<=c;++t){const e=r[t];e.skip||n(e,i,t)}}}function Pe(t,e,i,n){const o=[];if(!Gt(e,t.chartArea,t._minPadding))return o;return Se(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 De(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(!Gt(e,t.chartArea,t._minPadding))return r;return Se(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 Ce(t,e,i,n){const o=Me(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 Oe={modes:{index(t,e,i,n){const o=Me(e,t),s=i.axis||"x",a=i.intersect?Pe(t,o,s,n):De(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=Me(e,t),s=i.axis||"xy";let a=i.intersect?Pe(t,o,s,n):De(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)=>Pe(t,Me(e,t),i.axis||"xy",n),nearest:(t,e,i,n)=>De(t,Me(e,t),i.axis||"xy",i.intersect,n),x:(t,e,i,n)=>(i.axis="x",Ce(t,e,i,n)),y:(t,e,i,n)=>(i.axis="y",Ce(t,e,i,n))}};const Ae=new RegExp(/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/),Te=new RegExp(/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/);function Re(t,e){const i=(""+t).match(Ae);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 Le(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 Ee(t){return Le(t,{top:"y",right:"x",bottom:"y",left:"x"})}function Ie(t){return Le(t,["topLeft","topRight","bottomLeft","bottomRight"])}function ze(t){const e=Ee(t);return e.width=e.left+e.right,e.height=e.top+e.bottom,e}function Fe(t,e){t=t||{},e=e||xt.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(Te)&&(console.warn('Invalid font style specified: "'+n+'"'),n="");const o={family:K(t.family,e.family),lineHeight:Re(K(t.lineHeight,e.lineHeight),i),size:i,style:n,weight:K(t.weight,e.weight),string:""};return o.string=$t(o),o}function Ve(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 Be(t,e){const{min:i,max:n}=t;return{min:i-Math.abs(Z(e,i)),max:n+Z(e,n)}}const We=["left","top","right","bottom"];function He(t,e){return t.filter((t=>t.pos===e))}function Ne(t,e){return t.filter((t=>-1===We.indexOf(t.pos)&&t.box.axis===e))}function je(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 $e(t,e,i,n){return Math.max(t[i],e[i])+Math.max(t[n],e[n])}function Ye(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 Ue(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&&Ye(o,n.getPadding());const s=Math.max(0,e.outerWidth-$e(o,t,"left","right")),a=Math.max(0,e.outerHeight-$e(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 Xe(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 qe(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,Xe(a.horizontal,e));const{same:s,other:h}=Ue(e,i,a);l|=s&&n.length,c=c||h,r.fullSize||n.push(a)}return l&&qe(n,e,i)||c}function Ke(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}xt.set("layout",{padding:{top:0,right:0,bottom:0,left:0}});var Ge={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=ze(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=je(e.filter((t=>t.box.fullSize)),!0),n=je(He(e,"left"),!0),o=je(He(e,"right")),s=je(He(e,"top"),!0),a=je(He(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:He(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);Ye(u,ze(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),qe(r.fullSize,f,d),qe(l,f,d),qe(c,f,d)&&qe(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),Ke(r.leftAndTop,f,d),f.x+=f.w,f.y+=f.h,Ke(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 Ze{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 Qe extends Ze{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}}const Je={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},ti=t=>null===t||""===t;const ei=!!ve&&{passive:!0};function ii(t,e,i){t.canvas.removeEventListener(e,i,ei)}function ni(t,e,i){const n=t.canvas,o=n&&de(n)||n,s=new MutationObserver((t=>{const e=de(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 oi(t,e,i){const n=t.canvas,o=n&&de(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 si=new Map;let ai=0;function ri(){const t=window.devicePixelRatio;t!==ai&&(ai=t,si.forEach(((e,i)=>{i.currentDevicePixelRatio!==t&&e()})))}function li(t,i,n){const o=t.canvas,s=o&&de(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){si.size||window.addEventListener("resize",ri),si.set(t,e)}(t,a),r}function ci(t,e,i){i&&i.disconnect(),"resize"===e&&function(t){si.delete(t),si.size||window.removeEventListener("resize",ri)}(t)}function hi(t,i,n){const o=t.canvas,s=e((e=>{null!==t.ctx&&n(function(t,e){const i=Je[t.type]||t.type,{x:n,y:o}=xe(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,ei)}(o,i,s),s}class di extends Ze{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",ti(o)){const e=we(t,"width");void 0!==e&&(t.width=e)}if(ti(n))if(""===t.style.height)t.height=t.width/(e||2);else{const e=we(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:ni,detach:oi,resize:li}[e]||hi;n[e]=o(t,e,i)}removeEventListener(t,e){const i=t.$proxies||(t.$proxies={}),n=i[e];if(!n)return;({attach:ci,detach:ci,resize:ci}[e]||ii)(t,e,n),i[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,i,n){return _e(t,e,i,n)}isAttached(t){const e=de(t);return!(!e||!de(e))}}var ui=Object.freeze({__proto__:null,BasePlatform:Ze,BasicPlatform:Qe,DomPlatform:di});const fi=t=>0===t||1===t,gi=(t,e,i)=>-Math.pow(2,10*(t-=1))*Math.sin((t-e)*_t/i),pi=(t,e,i)=>Math.pow(2,-10*t)*Math.sin((t-e)*_t/i)+1,mi={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*Mt),easeOutSine:t=>Math.sin(t*Mt),easeInOutSine:t=>-.5*(Math.cos(bt*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=>fi(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=>fi(t)?t:gi(t,.075,.3),easeOutElastic:t=>fi(t)?t:pi(t,.075,.3),easeInOutElastic(t){const e=.1125;return fi(t)?t:t<.5?.5*gi(2*t,e,.45):.5+.5*pi(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-mi.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*mi.easeInBounce(2*t):.5*mi.easeOutBounce(2*t-1)+.5},xi="transparent",bi={boolean:(t,e,i)=>i>.5?e:t,color(t,e,i){const n=W(t||xi),o=n.valid&&W(e||xi);return o&&o.valid?o.mix(n,i).hexString():e},number:(t,e,i)=>t+(e-t)*i};class _i{constructor(t,e,i,n){const o=e[i];n=Ve([t.to,n,o,t.from]);const s=Ve([t.from,o,n]);this._active=!0,this._fn=t.fn||bi[t.type||typeof s],this._easing=mi[t.easing]||mi.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=Ve([t.to,e,o,t.from]),n._from=Ve([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]()}}xt.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 yi=Object.keys(xt.animation);xt.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>"onProgress"!==t&&"onComplete"!==t&&"fn"!==t}),xt.set("animations",{colors:{type:"color",properties:["color","borderColor","backgroundColor"]},numbers:{type:"number",properties:["x","y","borderWidth","radius","tension"]}}),xt.describe("animations",{_fallback:"animation"}),xt.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 vi{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 yi)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 _i(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 wi(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 Mi(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 ki(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||Dt(e)===Dt(c))&&(e+=c)}return e}}function Si(t,e){const i=t&&t.options.stacked;return i||void 0===i&&void 0!==e.stack}function Pi(t,e,i){const n=t[e]||(t[e]={});return n[i]||(n[i]={})}function Di(t,e,i){for(const n of e.getMatchingVisibleMetas("bar").reverse()){const e=t[n.index];if(i&&e>0||!i&&e<0)return n.index}return null}function Ci(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]=Pi(o,h,n),u[r]=s,u._top=Di(u,a,!0),u._bottom=Di(u,a,!1)}}function Oi(t,e){const i=t.scales;return Object.keys(i).filter((t=>i[t].axis===e)).shift()}function Ai(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 Ti=t=>"reset"===t||"none"===t,Ri=(t,e)=>e?t:Object.assign({},t);class Li{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=Si(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,Oi(e,"x")),a=i.yAxisID=K(n.yAxisID,Oi(e,"y")),r=i.rAxisID=K(n.rAxisID,Oi(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&&ce(this._data,this),t._stacked&&Ai(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&&(ce(t._data,t),Ai(t._cachedMeta)),i&&Object.isExtensible(i)&&le(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=Si(i.vScale,i),i.stack!==n.stack&&(o=!0,Ai(i),i.stack=n.stack),e._resyncElements(t),o&&Ci(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,h=o;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&&Ci(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 ki({keys:Mi(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=ki(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:Mi(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=wi(t,i),o=wi(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 Ri(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(xt.elements[t]),g=c.resolveNamedOptions(u,f,(()=>n.getContext(i,o)),d);return g.$shared&&(g.$shared=l,s[a]=Object.freeze(Ri(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 vi(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||Ti(t)||this.chart._animationsDisabled}updateElement(t,e,i,n){Ti(n)?Object.assign(t,i):this._resolveAnimations(e,n).update(t,i)}updateSharedOptions(t,e,i){t&&!Ti(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&&Ai(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)}}Li.defaults={},Li.prototype.datasetElementType=null,Li.prototype.dataElementType=null;class Ei{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 At(this.x)&&At(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}}Ei.defaults={},Ei.defaultRoutes=void 0;const Ii=new Map;function zi(t,e,i){return function(t,e){e=e||{};const i=t+JSON.stringify(e);let n=Ii.get(i);return n||(n=new Intl.NumberFormat(t,e),Ii.set(i,n)),n}(e,i).format(t)}const Fi={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=Pt(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),zi(t,n,l)},logarithmic(t,e,i){if(0===t)return"0";const n=t/Math.pow(10,Math.floor(Pt(t)));return 1===n||2===n||5===n?Fi.numeric.call(this,t,e,i):""}};var Vi={formatters:Fi};function Bi(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=Ot(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(Wi(e,l,c,$(n)?0:a-n,a),t=0,i=s-1;t<i;t++)Wi(e,l,c,o[t],o[t+1]);return Wi(e,l,c,r,$(n)?e.length:r+n),l}return Wi(e,l,c),l}function Wi(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))}xt.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:Vi.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),xt.route("scale.ticks","color","","color"),xt.route("scale.grid","color","","borderColor"),xt.route("scale.grid","borderColor","","borderColor"),xt.route("scale.title","color","","color"),xt.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&"callback"!==t&&"parser"!==t,_indexable:t=>"borderDash"!==t&&"tickBorderDash"!==t}),xt.describe("scales",{_fallback:"scale"});const Hi=(t,e,i)=>"top"===e||"left"===e?t[e]+i:t[e]-i;function Ni(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 ji(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 $i(t){return t.drawTicks?t.tickLength:0}function Yi(t,e){if(!t.display)return 0;const i=Fe(t.font,e),n=ze(t.padding);return(Y(t.text)?t.text.length:1)*i.lineHeight+n.height}function Ui(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 Xi extends Ei{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){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._range=Be(n,n.options.grace),n._dataLimitsCached=!0),n.beforeBuildTicks(),n.ticks=n.buildTicks()||[],n.afterBuildTicks();const a=s<n.ticks.length;n._convertTicksToLabels(a?Ni(n.ticks,s):n.ticks),n.configure(),n.beforeCalculateLabelRotation(),n.calculateLabelRotation(),n.afterCalculateLabelRotation(),o.display&&(o.autoSkip||"auto"===o.source)&&(n.ticks=Bi(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);for(n=0;n<o;n++)$(t[n].label)&&(t.splice(n,1),o--,n--)}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-$i(e.grid)-i.padding-Yi(e.title,t.chart.options.font),l=Math.sqrt(d*d+u*u),c=It(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=Yi(o,i.options.font);if(r?(e.width=t.maxWidth,e.height=$i(s)+a):(e.height=t.maxHeight,e.width=$i(s)+a),n.display&&t.ticks.length){const{first:i,last:o,widest:s,highest:a}=t._getLabelSizes(),l=2*n.padding,c=Et(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=Ni(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=Yt(i,u.data,u.gc,g,m),p+=f)}else g=Yt(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),widths:o,heights:s}}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 jt(e._alignToPixels?Xt(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=Et(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=$i(s),d=[],u=s.setContext(e.getContext()),f=u.drawBorder?u.borderWidth:0,g=f/2,p=function(t){return Xt(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=ji(e,x,r),void 0!==b&&(_=Xt(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=$i(n.grid),f=u+h,g=d?-h:f,p=-Et(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;let u;if(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),t.showLabelBackdrop){const e=ze(t.backdropPadding),i=A.heights[x],n=A.widths[x];let o=w+C-e.top,s=v-e.left;switch(O){case"middle":o-=i/2;break;case"bottom":o-=i}switch(M){case"center":s-=n/2;break;case"right":s-=n}u={left:s,top:o,width:n+e.width,height:i+e.height,color:t.backdropColor}}m.push({rotation:p,label:y,font:S,color:n,strokeColor:l,strokeWidth:h,textOffset:C,textAlign:M,textBaseline:O,translation:[v,w],backdrop:u})}return m}_getXAxisLabelAlignment(){const{position:t,ticks:e}=this.options;if(-Et(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._gridLineItems||(e._gridLineItems=e._computeGridLineItems(t));let s,a;const r=(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(s=0,a=o.length;s<a;++s){const t=o[s];i.drawOnChartArea&&r({x:t.x1,y:t.y1},{x:t.x2,y:t.y2},t),i.drawTicks&&r({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 t=this,{chart:e,ctx:i,options:{grid:n}}=t,o=n.setContext(t.getContext()),s=n.drawBorder?o.borderWidth:0;if(!s)return;const a=n.setContext(t.getContext(0)).lineWidth,r=t._borderValue;let l,c,h,d;t.isHorizontal()?(l=Xt(e,t.left,s)-s/2,c=Xt(e,t.right,a)+a/2,h=d=r):(h=Xt(e,t.top,s)-s/2,d=Xt(e,t.bottom,a)+a/2,l=c=r),i.save(),i.lineWidth=o.borderWidth,i.strokeStyle=o.borderColor,i.beginPath(),i.moveTo(l,h),i.lineTo(c,d),i.stroke(),i.restore()}drawLabels(t){const e=this;if(!e.options.ticks.display)return;const i=e.ctx,n=e._computeLabelArea();n&&Zt(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,n=t.label;t.backdrop&&(i.fillStyle=t.backdrop.color,i.fillRect(t.backdrop.left,t.backdrop.top,t.backdrop.width,t.backdrop.height)),ee(i,n,0,t.textOffset,e,t)}n&&Qt(i)}drawTitle(){const{ctx:t,options:{position:e,title:i,reverse:n}}=this;if(!i.display)return;const s=Fe(i.font),a=ze(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=Hi(t,i,e),c=l-a):(h=Hi(t,i,e),d=o(n,r,s),u="left"===i?-Mt:Mt),{titleX:h,titleY:d,maxWidth:c,rotation:u}}(this,l,e,r);ee(t,i.text,0,0,s,{color:i.color,maxWidth:d,rotation:u,textAlign:Ui(r,e,n),textBaseline:"middle",translation:[c,h]})}draw(t){const e=this;e._isVisible()&&(e.drawBackground(),e.drawGrid(t),e.drawBorder(),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()&&t.draw===Xi.prototype.draw?[{z:n,draw(e){t.drawBackground(),t.drawGrid(e),t.drawTitle()}},{z:n+1,draw(){t.drawBorder()}},{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)}_maxDigits(){const t=this,e=t._resolveTickFontOptions(0).lineHeight;return t.isHorizontal()?t.width/e/.7:t.height/e}}function qi(t,e=[""],i=t,n,o=(()=>t[0])){ht(n)||(n=an("_fallback",t));const s={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:t,_rootScopes:i,_fallback:n,_getTarget:o,override:o=>qi([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)=>Ji(i,n,(()=>function(t,e,i,n){let o;for(const s of e)if(o=an(Zi(s,t),i),ht(o))return Qi(t,o)?on(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)=>rn(t).includes(e),ownKeys:t=>rn(t),set:(t,e,i)=>((t._storage||(t._storage=o()))[e]=i,delete t[e],delete t._keys,!0)})}function Ki(t,e,i,n){const o={_cacheable:!1,_proxy:t,_context:e,_subProxy:i,_stack:new Set,_descriptors:Gi(t,n),setContext:e=>Ki(t,e,i,n),override:o=>Ki(t.override(o),e,i,n)};return new Proxy(o,{deleteProperty:(e,i)=>(delete e[i],delete t[i],!0),get:(t,e,i)=>Ji(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=on(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=on(n,o,t,l);e.push(Ki(i,s,a&&a[t],r))}}return e}(e,r,t,a.isIndexable));Qi(e,r)&&(r=Ki(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 Gi(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 Zi=(t,e)=>t?t+ct(e):e,Qi=(t,e)=>U(e)&&"adapters"!==t;function Ji(t,e,i){let n=t[e];return ht(n)||(n=i(),ht(n)&&(t[e]=n)),n}function tn(t,e,i){return dt(t)?t(e,i):t}const en=(t,e)=>!0===t?e:"string"==typeof t?lt(e,t):void 0;function nn(t,e,i,n){for(const o of e){const e=en(i,o);if(e){t.add(e);const o=tn(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 on(t,e,i,n){const o=e._rootScopes,s=tn(e._fallback,i,n),a=[...t,...o],r=new Set;r.add(n);let l=sn(r,a,i,s||i);return null!==l&&((!ht(s)||s===i||(l=sn(r,a,s,l),null!==l))&&qi([...r],[""],o,s,(()=>{const t=e._getTarget();return i in t||(t[i]={}),t[i]})))}function sn(t,e,i,n){for(;i;)i=nn(t,e,i,n);return i}function an(t,e){for(const i of e){if(!i)continue;const e=i[t];if(ht(e))return e}}function rn(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 ln=Number.EPSILON||1e-14,cn=(t,e)=>e<t.length&&!t[e].skip&&t[e];function hn(t,e,i,n){const o=t.skip?e:t,s=e,a=i.skip?e:i,r=Vt(s,o),l=Vt(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 dn(t){const e=t.length,i=Array(e).fill(0),n=Array(e);let o,s,a,r=cn(t,0);for(o=0;o<e;++o)if(s=a,a=r,r=cn(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?Dt(i[o-1])!==Dt(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=cn(t,0);for(let h=0;h<n-1;++h)l=c,c=cn(t,h+1),l&&c&&(Tt(e[h],0,ln)?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=cn(t,0);for(let r=0;r<i;++r){if(o=s,s=a,a=cn(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 un(t,e,i){return Math.max(Math.min(t,i),e)}function fn(t,e,i,n){let o,s,a,r;if(e.spanGaps&&(t=t.filter((t=>!t.skip))),"monotone"===e.cubicInterpolationMode)dn(t);else{let i=n?t[t.length-1]:t[0];for(o=0,s=t.length;o<s;++o)a=t[o],r=hn(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=Gt(t[0],e);for(i=0,n=t.length;i<n;++i)a=s,s=r,r=i<n-1&&Gt(t[i+1],e),s&&(o=t[i],a&&(o.cp1x=un(o.cp1x,e.left,e.right),o.cp1y=un(o.cp1y,e.top,e.bottom)),r&&(o.cp2x=un(o.cp2x,e.left,e.right),o.cp2y=un(o.cp2y,e.top,e.bottom)))}(t,i)}function gn(t,e,i,n){return{x:t.x+i*(e.x-t.x),y:t.y+i*(e.y-t.y)}}function pn(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 mn(t,e,i,n){const o={x:t.cp2x,y:t.cp2y},s={x:e.cp1x,y:e.cp1y},a=gn(t,o,i),r=gn(o,s,i),l=gn(s,e,i),c=gn(a,r,i),h=gn(r,l,i);return gn(c,h,i)}function xn(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 bn(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 _n(t,e){void 0!==e&&(delete t.prevTextDirection,t.canvas.style.setProperty("direction",e[0],e[1]))}function yn(t){return"angle"===t?{between:Ht,compare:Bt,normalize:Wt}:{between:(t,e,i)=>t>=Math.min(e,i)&&t<=Math.max(i,e),compare:(t,e)=>t-e,normalize:t=>t}}function vn({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 wn(t,e,i){if(!i)return[t];const{property:n,start:o,end:s}=i,a=e.length,{compare:r,between:l,normalize:c}=yn(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}=yn(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(vn({start:_,end:t,loop:u,count:a,style:f})),_=null),i=t,x=p);return null!==_&&g.push(vn({start:_,end:d,loop:u,count:a,style:f})),g}function Mn(t,e){const i=[],n=t.segments;for(let o=0;o<n.length;o++){const s=wn(n[o],t.points,e);s.length&&i.push(...s)}return i}function kn(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 Sn([{start:a,end:r,loop:s}],i,e);return Sn(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 Sn(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=Pn(i.setContext({type:"segment",p0:c,p1:h})),Dn(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 Pn(t){return{backgroundColor:t.backgroundColor,borderCapStyle:t.borderCapStyle,borderDash:t.borderDash,borderDashOffset:t.borderDashOffset,borderJoinStyle:t.borderJoinStyle,borderWidth:t.borderWidth,borderColor:t.borderColor}}function Dn(t,e){return e&&JSON.stringify(t)!==JSON.stringify(e)}var Cn=Object.freeze({__proto__:null,easingEffects:mi,color:W,getHoverColor:H,noop:N,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,setsEqual:ut,toFontString:$t,_measureText:Yt,_longestText:Ut,_alignPixel:Xt,clearCanvas:qt,drawPoint:Kt,_isPointInArea:Gt,clipArea:Zt,unclipArea:Qt,_steppedLineTo:Jt,_bezierCurveTo:te,renderText:ee,addRoundedRectPath:ie,_lookup:ne,_lookupByKey:oe,_rlookupByKey:se,_filterBetween:ae,listenArrayEvents:le,unlistenArrayEvents:ce,_arrayUnique:he,_createResolver:qi,_attachContext:Ki,_descriptors:Gi,splineCurve:hn,splineCurveMonotone:dn,_updateBezierControlPoints:fn,_getParentNode:de,getStyle:ge,getRelativePosition:xe,getMaximumSize:_e,retinaScale:ye,supportsEventListenerOptions:ve,readUsedSize:we,fontString:function(t,e,i){return e+" "+t+"px "+i},requestAnimFrame:t,throttled:e,debounce:i,_toLeftRightCenter:n,_alignStartEnd:o,_textX:s,_pointInLine:gn,_steppedInterpolation:pn,_bezierInterpolation:mn,formatNumber:zi,toLineHeight:Re,_readValueToProps:Le,toTRBL:Ee,toTRBLCorners:Ie,toPadding:ze,toFont:Fe,resolve:Ve,_addGrace:Be,PI:bt,TAU:_t,PITAU:yt,INFINITY:vt,RAD_PER_DEG:wt,HALF_PI:Mt,QUARTER_PI:kt,TWO_THIRDS_PI:St,log10:Pt,sign:Dt,niceNum:Ct,_factorize:Ot,isNumber:At,almostEquals:Tt,almostWhole:Rt,_setMinAndMaxByKey:Lt,toRadians:Et,toDegrees:It,_decimalPlaces:zt,getAngleFromPoint:Ft,distanceBetweenPoints:Vt,_angleDiff:Bt,_normalizeAngle:Wt,_angleBetween:Ht,_limitValue:Nt,_int16Range:jt,getRtlAdapter:xn,overrideTextDirection:bn,restoreTextDirection:_n,_boundSegment:wn,_boundSegments:Mn,_computeSegments:kn});class On{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?xt.get(i):{},xt.get(e),t.defaults]);xt.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(".");xt.route(s,o,l,r)}))}(e,t.defaultRoutes);t.descriptors&&xt.describe(e,t.descriptors)}(t,a,n),e.override&&xt.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 xt[n]&&(delete xt[n][i],this.override&&delete ft[i])}}var An=new class{constructor(){this.controllers=new On(Li,"datasets",!0),this.elements=new On(Ei,"elements"),this.plugins=new On(Object,"plugins"),this.scales=new On(Xi,"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 Tn{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(An.plugins.items);for(let t=0;t<i.length;t++)e.push(An.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=Rn(i[r.id],n);null!==l&&o.push({plugin:r,options:Ln(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 Rn(t,e){return e||!1!==t?!0===t?{}:t:null}function Ln(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 En(t,e){const i=xt.datasets[t]||{};return((e.datasets||{})[t]||{}).indexAxis||e.indexAxis||i.indexAxis||"x"}function In(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 zn(t){const e=t.options||(t.options={});e.plugins=K(e.plugins,{}),e.scales=function(t,e){const i=ft[t.type]||{scales:{}},n=e.scales||{},o=En(t.type,e),s=Object.create(null),a=Object.create(null);return Object.keys(n).forEach((t=>{const e=n[t],r=In(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||En(o,e),l=(ft[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,[xt.scales[e.type],xt.scale])})),a}(t,e)}function Fn(t){return(t=t||{}).datasets=t.datasets||[],t.labels=t.labels||[],t}const Vn=new Map,Bn=new Set;function Wn(t,e){let i=Vn.get(t);return i||(i=e(),Vn.set(t,i),Bn.add(i)),i}const Hn=(t,e,i)=>{const n=lt(e,i);void 0!==n&&t.add(n)};class Nn{constructor(t){this._config=function(t){return(t=t||{}).data=Fn(t.data),zn(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=Fn(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(),zn(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return Wn(t,(()=>[["datasets."+t,""]]))}datasetAnimationScopeKeys(t,e){return Wn(`${t}.transition.${e}`,(()=>[[`datasets.${t}.transitions.${e}`,"transitions."+e],["datasets."+t,""]]))}datasetElementScopeKeys(t,e){return Wn(`${t}-${e}`,(()=>[[`datasets.${t}.elements.${e}`,"datasets."+t,"elements."+e,""]]))}pluginScopeKeys(t){const e=t.id;return Wn(`${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=>Hn(r,t,e)))),e.forEach((t=>Hn(r,n,t))),e.forEach((t=>Hn(r,ft[o]||{},t))),e.forEach((t=>Hn(r,xt,t))),e.forEach((t=>Hn(r,gt,t)))}));const l=[...r];return Bn.has(e)&&s.set(e,l),l}chartOptionScopes(){const{options:t,type:e}=this;return[t,ft[e]||{},xt.datasets[e]||{},{type:e},xt,gt]}resolveNamedOptions(t,e,i,n=[""]){const o={$shared:!0},{resolver:s,subPrefixes:a}=jn(this._resolverCache,t,n);let r=s;if(function(t,e){const{isScriptable:i,isIndexable:n}=Gi(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=Ki(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}=jn(this._resolverCache,t,i);return U(e)?Ki(o,e,void 0,n):o}}function jn(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:qi(e,i),subPrefixes:i.filter((t=>!t.toLowerCase().includes("hover")))},n.set(o,s)}return s}const $n=["top","bottom","left","right","chartArea"];function Yn(t,e){return"top"===t||"bottom"===t||-1===$n.indexOf(t)&&"x"===e}function Un(t,e){return function(i,n){return i[t]===n[t]?i[e]-n[e]:i[t]-n[t]}}function Xn(t){const e=t.chart,i=e.options.animation;e.notifyPlugins("afterRender"),Q(i&&i.onComplete,[t],e)}function qn(t){const e=t.chart,i=e.options.animation;Q(i&&i.onProgress,[t],e)}function Kn(){return"undefined"!=typeof window&&"undefined"!=typeof document}function Gn(t){return Kn()&&"string"==typeof t?t=document.getElementById(t):t&&t.length&&(t=t[0]),t&&t.canvas&&(t=t.canvas),t}const Zn={},Qn=t=>{const e=Gn(t);return Object.values(Zn).filter((t=>t.canvas===e)).pop()};class Jn{constructor(t,e){const n=this;this.config=e=new Nn(e);const o=Gn(t),s=Qn(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 Tn,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=i((()=>this.update("resize")),r.resizeDelay||0),Zn[n.id]=n,l&&c?(a.listen(n,"complete",Xn),a.listen(n,"progress",qn),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():ye(t,t.options.devicePixelRatio),t.bindEvents(),t.notifyPlugins("afterInit"),t}_initializePlatform(t,e){return e.platform?new e.platform:!Kn()||"undefined"!=typeof OffscreenCanvas&&t instanceof OffscreenCanvas?new Qe:new di}clear(){return qt(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,ye(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=In(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=In(a,s),l=K(s.type,i.dtype);void 0!==s.position&&Yn(s.position,r)===Yn(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(An.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=>{Ge.configure(t,e,e.options),Ge.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(Un("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||En(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=An.getController(a),{datasetElementType:o,dataElementType:r}=xt.datasets[a];Object.assign(i.prototype,{dataElementType:An.getElement(r),datasetElementType:o&&An.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=>{Ge.removeBox(e,t)}));const n=e._animationsDisabled=!e.options.animation;e.ensureScalesHaveIDs(),e.buildOrUpdateScales();const o=new Set(Object.keys(e._listeners)),s=new Set(e.options.events);if(ut(o,s)||(e.unbindEvents(),e.bindEvents()),e._plugins.invalidate(),!1===e.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0}))return;const a=e.buildOrUpdateControllers();e.notifyPlugins("beforeElementsUpdate");let r=0;for(let t=0,i=e.data.datasets.length;t<i;t++){const{controller:i}=e.getDatasetMeta(t),o=!n&&-1===a.indexOf(i);i.buildOrUpdateElements(o),r=Math.max(+i.getMaxOverflow(),r)}e._minPadding=r,e._updateLayout(r),n||J(a,(t=>{t.reset()})),e._updateDatasets(t),e.notifyPlugins("afterUpdate",{mode:t}),e._layers.sort(Un("z","_idx")),e._lastEvent&&e._eventHandler(e._lastEvent,!0),e.render()}_updateLayout(t){const e=this;if(!1===e.notifyPlugins("beforeLayout",{cancelable:!0}))return;Ge.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(),Xn({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)&&(Zt(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(),Qt(i),s.cancelable=!1,e.notifyPlugins("afterDatasetDraw",s))}getElementsAtEventForMode(t,e,i,n){const o=Oe.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(),qt(e,i),t.platform.releaseContext(i),t.canvas=null,t.ctx=null),t.notifyPlugins("destroy"),delete Zn[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&&(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,Gt(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 to=()=>J(Jn.instances,(t=>t._plugins.invalidate())),eo=!0;function io(){throw new Error("This method is not implemented: either no adapter can be found or an incomplete integration was provided.")}Object.defineProperties(Jn,{defaults:{enumerable:eo,value:xt},instances:{enumerable:eo,value:Zn},overrides:{enumerable:eo,value:ft},registry:{enumerable:eo,value:An},version:{enumerable:eo,value:"3.2.1"},getChart:{enumerable:eo,value:Qn},register:{enumerable:eo,value:(...t)=>{An.add(...t),to()}},unregister:{enumerable:eo,value:(...t)=>{An.remove(...t),to()}}});class no{constructor(t){this.options=t||{}}formats(){return io()}parse(t,e){return io()}format(t,e){return io()}add(t,e,i){return io()}diff(t,e,i){return io()}startOf(t,e,i){return io()}endOf(t,e){return io()}}no.override=function(t){Object.assign(no.prototype,t)};var oo={_date:no};function so(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=he(i.sort(((t,e)=>t-e)))}return t._cache.$bar}(t);let i,n,o,s,a=t._length;const r=()=>{32767!==o&&-32768!==o&&(ht(s)&&(a=Math.min(a,Math.abs(o-s)||a)),s=o)};for(i=0,n=e.length;i<n;++i)o=t.getPixelForValue(e[i]),r();for(s=void 0,i=0,n=t.ticks.length;i<n;++i)o=t.getPixelForTick(i),r();return a}function ao(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 ro(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(ao(u,d,s,c));return l}function lo(t){return t&&void 0!==t.barStart&&void 0!==t.barEnd}class co extends Li{parsePrimitiveData(t,e,i,n){return ro(t,e,i,n)}parseArrayData(t,e,i,n){return ro(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(ao(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=lo(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=(e._stacks||{})[a.axis],p={horizontal:l,base:i.base,enableBorderRadius:!g||lo(e._custom)||o.index===g._top||o.index===g._bottom,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&&(p.options=d||o.resolveDataElementOptions(h,n)),o.updateElement(t[h],h,p,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,i){const n=this._getStacks(t,i),o=void 0!==e?n.indexOf(e):-1;return-1===o?n.length-1:o}_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||so(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=lo(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&&Dt(d)!==Dt(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=o.skipNull,a=K(o.maxBarThickness,1/0);let r,l;if(e.grouped){const n=s?i._getStackCount(t):e.stackCount,c="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),h=i._getStackIndex(i.index,i._cachedMeta.stack,s?t:void 0);r=c.start+c.chunk*h+c.chunk/2,l=Math.min(a,c.chunk*c.ratio)}else r=n.getPixelForValue(i.getParsed(t)[n.axis],t),l=Math.min(a,e.min*e.ratio);return{base:r-l/2,head:r+l/2,center:r,size:l}}draw(){const t=this,e=t.chart,i=t._cachedMeta,n=i.vScale,o=i.data,s=o.length;let a=0;for(Zt(e.ctx,e.chartArea);a<s;++a)null!==t.getParsed(a)[n.axis]&&o[a].draw(t._ctx);Qt(e.ctx)}}co.id="bar",co.defaults={datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}},co.overrides={interaction:{mode:"index"},scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}};class ho extends Li{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}}ho.id="bubble",ho.defaults={datasetElementType:!1,dataElementType:"point",animations:{numbers:{type:"number",properties:["x","y","borderWidth","radius"]}}},ho.overrides={scales:{x:{type:"linear"},y:{type:"linear"}},plugins:{tooltip:{callbacks:{title:()=>""}}}};class uo extends Li{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 Et(this.options.rotation-90)}_getCircumference(){return Et(this.options.circumference)}_getRotationExtents(){let t=_t,e=-_t;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<_t){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)=>Ht(t,r,l)?1:Math.max(e,e*i,n,n*i),g=(t,e,n)=>Ht(t,r,l)?-1:Math.min(e,e*i,n,n*i),p=f(0,c,d),m=f(Mt,h,u),x=g(bt,c,d),b=g(bt+Mt,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/_t)}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)?_t*(Math.abs(t)/e):0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,n=i.data.labels||[],o=zi(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}}uo.id="doughnut",uo.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"},uo.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 fo extends Li{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(oe(r,a.axis,c).lo,i?n:oe(e,l,a.getPixelForValue(c)).lo),0,n-1)),s=u?Nt(Math.max(oe(r,a.axis,h).hi+1,i?0:oe(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=At(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()}}fo.id="line",fo.defaults={datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1},fo.overrides={scales:{_index_:{type:"category"},_value_:{type:"linear"}}};class go extends Li{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*bt;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)?Et(this.resolveDataElementOptions(t,e).angle||i):0}}go.id="polarArea",go.defaults={dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0},go.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 po extends uo{}po.id="pie",po.defaults={cutout:0,rotation:0,circumference:360,radius:"100%"};class mo extends Li{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)}}}mo.id="radar",mo.defaults={datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:!0,elements:{line:{fill:"start"}}},mo.overrides={aspectRatio:1,scales:{r:{type:"radialLinear"}}};class xo extends fo{}xo.id="scatter",xo.defaults={showLine:!1,fill:!1},xo.overrides={interaction:{mode:"point"},plugins:{tooltip:{callbacks:{title:()=>"",label:t=>"("+t.label+", "+t.formattedValue+")"}}},scales:{x:{type:"linear"},y:{type:"linear"}}};var bo=Object.freeze({__proto__:null,BarController:co,BubbleController:ho,DoughnutController:uo,LineController:fo,PolarAreaController:go,PieController:po,RadarController:mo,ScatterController:xo});function _o(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+Mt,i-Mt),t.closePath(),t.clip()}function yo(t,e,i,n){const o=Le(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 vo(t,e,i,n){return{x:i+t*Math.cos(e),y:n+t*Math.sin(e)}}function wo(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}=yo(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=vo(g,m,i,n);t.arc(e.x,e.y,h,m,s+Mt)}const v=vo(b,s,i,n);if(t.lineTo(v.x,v.y),u>0){const e=vo(b,y,i,n);t.arc(e.x,e.y,u,s+Mt,y+Math.PI)}if(t.arc(i,n,l,s-u/l,o+d/l,!0),d>0){const e=vo(x,_,i,n);t.arc(e.x,e.y,d,_+Math.PI,o-Mt)}const w=vo(f,o,i,n);if(t.lineTo(w.x,w.y),c>0){const e=vo(f,p,i,n);t.arc(e.x,e.y,c,o-Mt,p)}t.closePath()}function Mo(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+_t,_o(t,e),e.endAngle=a,e.endAngle===e.startAngle&&(e.endAngle+=_t,e.fullCircles--)),t.beginPath(),t.arc(n,o,c,s+_t,s,!0),h=0;h<e.fullCircles;++h)t.stroke();for(t.beginPath(),t.arc(n,o,l,s,s+_t),h=0;h<e.fullCircles;++h)t.stroke()}(t,e,n),n&&_o(t,e),wo(t,e),t.stroke())}class ko extends Ei{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>=_t||Ht(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/_t),!(0===e.circumference||e.innerRadius<0||e.outerRadius<0)){if(t.save(),n&&e.circumference<_t){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+_t,wo(t,e);for(let i=0;i<e.fullCircles;++i)t.fill()}isNaN(e.circumference)||(e.endAngle=e.startAngle+e.circumference%_t),wo(t,e),t.fill()}(t,e),Mo(t,e),t.restore()}}}function So(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 Po(t,e,i){t.lineTo(i.x,i.y)}function Do(t,e,i={}){const n=t.length,{start:o=0,end:s=n-1}=i,{start:a,end:r}=e,l=Math.max(o,a),c=Math.min(s,r),h=o<a&&s<a||o>r&&s>r;return{count:n,start:l,loop:e.loop,ilen:c<l&&!h?n+c-l:c-l}}function Co(t,e,i,n){const{points:o,options:s}=e,{count:a,start:r,loop:l,ilen:c}=Do(o,i,n),h=function(t){return t.stepped?Jt:t.tension||"monotone"===t.cubicInterpolationMode?te:Po}(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 Oo(t,e,i,n){const o=e.points,{count:s,start:a,ilen:r}=Do(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 Ao(t){const e=t.options,i=e.borderDash&&e.borderDash.length;return!(t._decimated||t._loop||e.tension||"monotone"===e.cubicInterpolationMode||e.stepped||i)?Oo:Co}ko.id="arc",ko.defaults={borderAlign:"center",borderColor:"#fff",borderRadius:0,borderWidth:2,offset:0,angle:void 0},ko.defaultRoutes={backgroundColor:"backgroundColor"};const To="function"==typeof Path2D;function Ro(t,e,i,n){To&&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()),So(t,e.options),t.stroke(o)}(t,e,i,n):function(t,e,i,n){const{segments:o,options:s}=e,a=Ao(e);for(const r of o)So(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 Lo extends Ei{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||"monotone"===i.cubicInterpolationMode)&&!i.stepped&&!e._pointsUpdated){const n=i.spanGaps?e._loop:e._fullLoop;fn(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=kn(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=Mn(i,{property:e,start:o,end:o});if(!a.length)return;const r=[],l=function(t){return t.stepped?pn:t.tension||"monotone"===t.cubicInterpolationMode?mn:gn}(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 Ao(this)(t,this,e,i)}path(t,e,i){const n=this,o=n.segments,s=Ao(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(),Ro(t,o,i,n),t.restore(),o.animated&&(o._pointsUpdated=!1,o._path=void 0))}}function Eo(t,e,i,n){const o=t.options,{[i]:s}=t.getProps([i],n);return Math.abs(e-s)<o.radius+o.hitRadius}Lo.id="line",Lo.defaults={borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0},Lo.defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"},Lo.descriptors={_scriptable:!0,_indexable:t=>"borderDash"!==t&&"fill"!==t};class Io extends Ei{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 Eo(this,t,"x",e)}inYRange(t,e){return Eo(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,Kt(t,i,e.x,e.y))}getRange(){const t=this.options||{};return t.radius+t.hitRadius}}function zo(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 Fo(t){let e=t.options.borderSkipped;const i={};return e?(e=t.horizontal?Vo(e,"left","right",t.base>t.x):Vo(e,"bottom","top",t.base<t.y),i[e]=!0,i):i}function Vo(t,e,i,n){var o,s,a;return n?(a=i,t=Bo(t=(o=t)===(s=e)?a:o===a?s:o,i,e)):t=Bo(t,e,i),t}function Bo(t,e,i){return"start"===t?e:"end"===t?i:t}function Wo(t,e,i,n){return t?0:Math.max(Math.min(e,n),i)}function Ho(t){const e=zo(t),i=e.right-e.left,n=e.bottom-e.top,o=function(t,e,i){const n=t.options.borderWidth,o=Fo(t),s=Ee(n);return{t:Wo(o.top,s.top,0,i),r:Wo(o.right,s.right,0,e),b:Wo(o.bottom,s.bottom,0,i),l:Wo(o.left,s.left,0,e)}}(t,i/2,n/2),s=function(t,e,i){const{enableBorderRadius:n}=t.getProps(["enableBorderRadius"]),o=t.options.borderRadius,s=Ie(o),a=Math.min(e,i),r=Fo(t),l=n||U(o);return{topLeft:Wo(!l||r.top||r.left,s.topLeft,0,a),topRight:Wo(!l||r.top||r.right,s.topRight,0,a),bottomLeft:Wo(!l||r.bottom||r.left,s.bottomLeft,0,a),bottomRight:Wo(!l||r.bottom||r.right,s.bottomRight,0,a)}}(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 No(t,e,i,n){const o=null===e,s=null===i,a=t&&!(o&&s)&&zo(t,n);return a&&(o||e>=a.left&&e<=a.right)&&(s||i>=a.top&&i<=a.bottom)}function jo(t,e){t.rect(e.x,e.y,e.w,e.h)}Io.id="point",Io.defaults={borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0},Io.defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};class $o extends Ei{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}=Ho(this),o=(s=n.radius).topLeft||s.topRight||s.bottomLeft||s.bottomRight?ie:jo;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 No(this,t,e,i)}inXRange(t,e){return No(this,t,null,e)}inYRange(t,e){return No(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}}$o.id="bar",$o.defaults={borderSkipped:"start",borderWidth:0,borderRadius:0,enableBorderRadius:!0,pointStyle:void 0},$o.defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};var Yo=Object.freeze({__proto__:null,ArcElement:ko,LineElement:Lo,PointElement:Io,BarElement:$o});function Uo(t){if(t._decimated){const e=t._data;delete t._decimated,delete t._data,Object.defineProperty(t,"data",{value:e})}}function Xo(t){t.data.datasets.forEach((t=>{Uo(t)}))}var qo={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(t,e,i)=>{if(!i.enabled)return void Xo(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"===Ve([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(oe(e,s.axis,a).lo,0,i-1)),n=c?Nt(oe(e,s.axis,r).hi+1,o,i)-o:i-o,{start:o,count:n}}(r,l);if(u<=4*n)Uo(e);else{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){Xo(t)}};function Ko(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 Go{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:_t},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 Zo(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 Go({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;Jo(o)&&i.unshift(o.dataset)}return i}(e,n);l.push(is({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++)ts(s,r[t],l)}return new Lo({points:s,options:{}})}const Jo=t=>"line"===t.type&&!t.hidden;function ts(t,e,i){const n=[];for(let o=0;o<i.length;o++){const s=i[o],{first:a,last:r,point:l}=es(s,e,"x");if(!(!l||a&&r))if(a)n.unshift(l);else if(t.push(l),!r)break}t.push(...n)}function es(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 is(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 Lo({points:i,options:{tension:0},_loop:n,_fullLoop:n}):null}function ns(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 os(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 ss(t,e,i,n){if(n)return;let o=e[t],s=i[t];return"angle"===t&&(o=Wt(o),s=Wt(s)),{property:t,start:o,end:s}}function as(t,e,i,n){return t&&e?n(t[i],e[i]):t?t[i]:e?e[i]:0}function rs(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 ls(t,e,i,n){const o=e.interpolate(i,n);o&&t.lineTo(o.x,o.y)}function cs(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=ss(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=Mn(e,n);for(const e of r){const r=ss(i,s[e.start],s[e.end],e.loop),l=wn(t,o,r);for(const t of l)a.push({source:t,target:e,start:{[i]:as(n,r,"start",Math.max)},end:{[i]:as(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,rs(t,a,ss(o,c,h)),t.beginPath();const d=!!i.pathSegment(t,e);d?t.closePath():ls(t,n,h,o);const u=!!n.pathSegment(t,l,{move:d,reverse:!0}),f=d&&u;f||ls(t,n,c,o),t.closePath(),t.fill(f?"evenodd":"nonzero"),t.restore()}}function hs(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=Zo(t);return o instanceof Go?o:is(o,n)}(e),{line:o,scale:s,axis:a}=e,r=o.options,l=r.fill,c=r.backgroundColor,{above:h=c,below:d=c}=l||{};n&&o.points.length&&(Zt(t,i),function(t,e){const{line:i,target:n,above:o,below:s,area:a,scale:r}=e,l=i._loop?"angle":e.axis;t.save(),"x"===l&&s!==o&&(os(t,n,a.top),cs(t,{line:i,target:n,color:o,scale:r,property:l}),t.restore(),t.save(),os(t,n,a.bottom)),cs(t,{line:i,target:n,color:s,scale:r,property:l}),t.restore()}(t,{line:o,target:n,above:h,below:d,area:i,scale:s,axis:a}),Qt(t))}var ds={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 Lo&&(l={visible:t.isDatasetVisible(a),index:a,fill:Ko(r,a,n),chart:t,axis:s.controller.options.indexAxis,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=ns(o,a,i.propagate))},beforeDraw(t,e,i){const n="beforeDraw"===i.drawTime,o=t.getSortedVisibleDatasetMetas(),s=t.chartArea;for(let e=o.length-1;e>=0;--e){const i=o[e].$filler;i&&(i.line.updateControlPoints(s),n&&hs(t.ctx,i,s))}},beforeDatasetsDraw(t,e,i){if("beforeDatasetsDraw"!==i.drawTime)return;const n=t.getSortedVisibleDatasetMetas();for(let e=n.length-1;e>=0;--e){const i=n[e].$filler;i&&hs(t.ctx,i,t.chartArea)}},beforeDatasetDraw(t,e,i){const n=e.meta.$filler;n&&!1!==n.fill&&"beforeDatasetDraw"===i.drawTime&&hs(t.ctx,n,t.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const us=(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 fs extends Ei{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}=us(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;Zt(e,t),t._draw(),Qt(e)}}_draw(){const t=this,{options:e,columnSizes:i,lineWidths:n,ctx:a}=t,{align:r,labels:l}=e,c=xt.color,h=xn(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:_}=us(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},bn(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);Kt(a,o,s,e+p)}else{const o=e+Math.max((g-b)/2,0),s=h.leftForLtr(t,x),r=Ie(i.borderRadius);a.beginPath(),Object.values(r).some((t=>0!==t))?ie(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){ee(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})),_n(t.ctx,e.textDirection)}drawTitle(){const t=this,e=t.options,i=e.title,s=Fe(i.font),a=ze(i.padding);if(!i.display)return;const r=xn(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,ee(l,i.text,p,u,s)}_computeTitleHeight(){const t=this.options.title,e=Fe(t.font),i=ze(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 gs={id:"legend",_element:fs,start(t,e,i){const n=t.legend=new fs({ctx:t.ctx,options:i,chart:t});Ge.configure(t,n,i),Ge.addBox(t,n)},stop(t){Ge.removeBox(t,t.legend),delete t.legend},beforeUpdate(t,e,i){const n=t.legend;Ge.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=ze(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 ps extends Ei{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=ze(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*bt):(c=s-t,h=o(r,e,n),d=.5*bt),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);ee(e,i.text,0,0,o,{color:i.color,maxWidth:l,rotation:c,textAlign:n(i.align),textBaseline:"middle",translation:[a,r]})}}var ms={id:"title",_element:ps,start(t,e,i){!function(t,e){const i=new ps({ctx:t.ctx,options:e,chart:t});Ge.configure(t,i,e),Ge.addBox(t,i),t.titleBlock=i}(t,i)},stop(t){const e=t.titleBlock;Ge.removeBox(t,e),delete t.titleBlock},beforeUpdate(t,e,i){const n=t.titleBlock;Ge.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 xs={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){if(!t.length)return!1;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=Vt(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 bs(t,e){return e&&(Y(e)?Array.prototype.push.apply(t,e):t.push(e)),t}function _s(t){return("string"==typeof t||t instanceof String)&&t.indexOf("\n")>-1?t.split("\n"):t}function ys(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 vs(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=ze(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 ws(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 Ms(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||ws(t,e,i,n),yAlign:n}}function ks(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 Ss(t,e,i){const n=ze(i.padding);return"center"===e?t.x+t.width/2:"right"===e?t.x+t.width-n.right:t.x+n.left}function Ps(t){return bs([],_s(t))}function Ds(t,e){const i=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return i?t.override(i):t}class Cs extends Ei{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 vi(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=bs(r,_s(o)),r=bs(r,_s(s)),r=bs(r,_s(a)),r}getBeforeBody(t,e){return Ps(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=Ds(n,t);bs(e.before,_s(s.beforeLabel.call(i,t))),bs(e.lines,s.label.call(i,t)),bs(e.after,_s(s.afterLabel.call(i,t))),o.push(e)})),o}getAfterBody(t,e){return Ps(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=bs(r,_s(o)),r=bs(r,_s(s)),r=bs(r,_s(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(ys(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=Ds(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=xs[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=vs(i,n),r=Object.assign({},t,e),l=Ms(i._chart,n,r),c=ks(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=xn(i.rtl,n.x,n.width);for(t.x=Ss(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=Ss(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,Kt(t,e,i,s),t.strokeStyle=a.borderColor,t.fillStyle=a.backgroundColor,Kt(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=Ie(a.borderRadius);Object.values(s).some((t=>0!==t))?(t.beginPath(),t.fillStyle=o.multiKeyBackground,ie(t,{x:e,y:g,w:c,h:l,radius:s}),t.fill(),t.stroke(),t.fillStyle=a.backgroundColor,t.beginPath(),ie(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=xn(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=Ss(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=xn(i.rtl,n.x,n.width);for(t.x=Ss(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=xs[t.position].call(e,e._active,e._eventPosition);if(!n)return;const a=e._size=vs(e,t),r=Object.assign({},n,e._size),l=Ms(i,t,r),c=ks(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=ze(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),bn(t,i.textDirection),s.y+=a.top,e.drawTitle(s,t,i),e.drawBody(s,t,i),e.drawFooter(s,t,i),_n(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{caretX:i,caretY:n,options:o}=this,s=xs[o.position].call(this,t,e);return!1!==s&&(i!==s.x||n!==s.y)}}Cs.positioners=xs;var Os={id:"tooltip",_element:Cs,positioners:xs,afterInit(t,e,i){i&&(t.tooltip=new Cs({_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:N,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:N,beforeBody:N,beforeLabel:N,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:N,afterBody:N,beforeFooter:N,footer:N,afterFooter:N}},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"]},As=Object.freeze({__proto__:null,Decimation:qo,Filler:ds,Legend:gs,Title:ms,Tooltip:Os});function Ts(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 Rs extends Xi{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:Ts(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}}Rs.id="category",Rs.defaults={ticks:{callback:Rs.prototype.getLabelForValue}};class Ls extends Xi{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=Dt(s),e=Dt(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,maxDigits:c,horizontal:h}=t,d=n||1,u=l-1,{min:f,max:g}=e,p=!$(o),m=!$(s),x=!$(r),b=(g-f)/c;let _,y,v,w,M=Ct((g-f)/u/d)*d;if(M<1e-14&&!p&&!m)return[{value:f},{value:g}];w=Math.ceil(g/M)-Math.floor(f/M),w>u&&(M=Ct(w*M/u/d)*d),$(a)||(_=Math.pow(10,a),M=Math.ceil(M*_)/_),y=Math.floor(f/M)*M,v=Math.ceil(g/M)*M,p&&m&&n&&Rt((s-o)/n,M/1e3)?(w=Math.min((s-o)/M,l),M=(s-o)/w,y=o,v=s):x?(y=p?o:y,v=m?s:v,w=r-1,M=(v-y)/w):(w=(v-y)/M,w=Tt(w,Math.round(w),M/1e3)?Math.round(w):Math.ceil(w)),_=Math.pow(10,$(a)?zt(M):a),y=Math.round(y*_)/_,v=Math.round(v*_)/_;let k=0;for(p&&(i.push({value:o}),y<=o&&k++,Tt(Math.round((y+k*M)*_)/_,o,b*(h?(""+o).length:1))&&k++);k<w;++k)i.push({value:Math.round((y+k*M)*_)/_});return m?Tt(i[i.length-1].value,s,b*(h?(""+s).length:1))?i[i.length-1].value=s:i.push({value:s}):i.push({value:v}),i}({maxTicks:n,min:e.min,max:e.max,precision:i.precision,step:i.stepSize,count:i.count,maxDigits:t._maxDigits(),horizontal:t.isHorizontal()},t._range||t);return"ticks"===e.bounds&&Lt(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 zi(t,this.chart.options.locale)}}class Es extends Ls{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 Is(t){return 1===t/Math.pow(10,Math.floor(Pt(t)))}Es.id="linear",Es.defaults={ticks:{callback:Vi.formatters.numeric}};class zs extends Xi{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,e){const i=Ls.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(Pt(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(Pt(e.max)),n=Math.ceil(e.max/Math.pow(10,i)),o=[];let s=q(t.min,Math.pow(10,Math.floor(Pt(e.min)))),a=Math.floor(Pt(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:Is(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:Is(s)}),o}({min:t._userMin,max:t._userMax},t);return"ticks"===e.bounds&&Lt(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":zi(t,this.chart.options.locale)}configure(){const t=this,e=t.min;super.configure(),t._startValue=Pt(e),t._valueRange=Pt(t.max)-Pt(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:(Pt(t)-e._startValue)/e._valueRange)}getValueForPixel(t){const e=this,i=e.getDecimalForPixel(t);return Math.pow(10,e._startValue+i*e._valueRange)}}function Fs(t){const e=t.ticks;if(e.display&&t.display){const t=ze(e.backdropPadding);return K(e.font&&e.font.size,xt.font.size)+t.height}return 0}function Vs(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 Bs(t){return 0===t||180===t?"center":t<180?"left":"right"}function Ws(t,e,i){90===t||270===t?i.y-=e.h/2:(t>270||t<90)&&(i.y-=e.h)}function Hs(t,e,i,n){const{ctx:o}=t;if(i)o.arc(t.xCenter,t.yCenter,e,0,_t);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 Ns(t){return At(t)?t:0}zs.id="logarithmic",zs.defaults={ticks:{callback:Vi.formatters.logarithmic,major:{enabled:!0}}};class js extends Ls{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=Fs(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/Fs(this.options))}generateTickLabels(t){const e=this;Ls.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:Ut(c,c.font,d),h:d.length*h}:{w:c.measureText(d).width,h:h},a[n]=o;const f=t.getIndexAngle(n),g=It(f),p=Vs(g,s.x,o.w,0,180),m=Vs(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=Fs(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=It(t.getIndexAngle(n)),s=a[n];Ws(o,s,i);const l=Bs(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=Ns(o),s=Ns(s),a=Ns(a),r=Ns(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 Wt(t*(_t/this.getLabels().length)+Et(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)-Mt;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(),Hs(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=ze(e.backdropPadding);i.fillStyle=f,i.fillRect(c-t.left,h-t.top,d-c+t.width,u-h+t.height)}ee(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(),Hs(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()}}drawBorder(){}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=ze(l.backdropPadding);e.fillRect(-a/2-t.left,-s-c.size/2-t.top,a+t.width,c.size+t.height)}ee(e,o.label,0,-s,c,{color:l.color})})),e.restore()}drawTitle(){}}js.id="radialLinear",js.defaults={display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:Vi.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback:t=>t,padding:5}},js.defaultRoutes={"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"},js.descriptors={angleLines:{_fallback:"grid"}};const $s={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}},Ys=Object.keys($s);function Us(t,e){return t-e}function Xs(t,e){if($(e))return null;const i=t._adapter,{parser:n,round:o,isoWeekday:s}=t._parseOpts;let a=e;return"function"==typeof n&&(a=n(a)),X(a)||(a="string"==typeof n?i.parse(a,n):i.parse(a)),null===a?null:(o&&(a="week"!==o||!At(s)&&!0!==s?i.startOf(a,o):i.startOf(a,"isoWeek",s)),+a)}function qs(t,e,i,n){const o=Ys.length;for(let s=Ys.indexOf(t);s<o-1;++s){const t=$s[Ys[s]],o=t.steps?t.steps:Number.MAX_SAFE_INTEGER;if(t.common&&Math.ceil((i-e)/(o*t.size))<=n)return Ys[s]}return Ys[o-1]}function Ks(t,e,i){if(i){if(i.length){const{lo:n,hi:o}=ne(i,e);t[i[n]>=e?i[n]:i[o]]=!0}}else t[e]=!0}function Gs(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 Zs extends Xi{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={}),n=this._adapter=new oo._date(t.adapters.date);st(i.displayFormats,n.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:Xs(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=ae(o,s,t.max);return t._unit=i.unit||(n.autoSkip?qs(i.minUnit,t.min,t.max,t._getLabelCapacity(s)):function(t,e,i,n,o){for(let s=Ys.length-1;s>=Ys.indexOf(i);s--){const i=Ys[s];if($s[i].common&&t._adapter.diff(o,n,i)>=e-1)return i}return Ys[i?Ys.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=Ys.indexOf(t)+1,i=Ys.length;e<i;++e)if($s[Ys[e]].common)return Ys[e]}(t._unit):void 0,t.initOffsets(o),e.reverse&&a.reverse(),Gs(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||qs(s.minUnit,i,n,t._getLabelCapacity(i)),r=K(s.stepSize,1),l="week"===a&&s.isoWeekday,c=At(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++)Ks(h,d,g);return d!==n&&"ticks"!==o.bounds&&1!==u||Ks(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=Et(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,Gs(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(Xs(t,o[i]));return t._cache.labels=t._normalized?e:t.normalize(e)}normalize(t){return he(t.sort(Us))}}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=ne(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}Zs.id="time",Zs.defaults={bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",major:{enabled:!1}}};class Js extends Zs{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)}}Js.id="timeseries",Js.defaults=Zs.defaults;var ta=Object.freeze({__proto__:null,CategoryScale:Rs,LinearScale:Es,LogarithmicScale:zs,RadialLinearScale:js,TimeScale:Zs,TimeSeriesScale:Js});return Jn.register(bo,ta,Yo,As),Jn.helpers={...Cn},Jn._adapters=oo,Jn.Animation=_i,Jn.Animations=vi,Jn.animator=a,Jn.controllers=An.controllers.items,Jn.DatasetController=Li,Jn.Element=Ei,Jn.elements=Yo,Jn.Interaction=Oe,Jn.layouts=Ge,Jn.platforms=ui,Jn.Scale=Xi,Jn.Ticks=Vi,Object.assign(Jn,bo,ta,Yo,As,ui),Jn.Chart=Jn,"undefined"!=typeof window&&(window.Chart=Jn),Jn}));
assets/js/vendor/chart.min.js CHANGED
@@ -1 +1 @@
1
- (function(){"use strict";function o(t){this.canvas=t.canvas,this.ctx=t;var i=function(t,i){return t["offset"+i]||document.defaultView.getComputedStyle(t).getPropertyValue(i)},e=this.width=i(t.canvas,"Width"),i=this.height=i(t.canvas,"Height");return t.canvas.width=e,t.canvas.height=i,e=this.width=t.canvas.width,i=this.height=t.canvas.height,this.aspectRatio=this.width/this.height,u.retinaScale(this),this}var t=this,i=t.Chart;o.defaults={global:{animation:!0,animationSteps:60,animationEasing:"easeOutQuart",showScale:!0,scaleOverride:!1,scaleSteps:null,scaleStepWidth:null,scaleStartValue:null,scaleLineColor:"rgba(0,0,0,.1)",scaleLineWidth:1,scaleShowLabels:!0,scaleLabel:"<%=value%>",scaleIntegersOnly:!0,scaleBeginAtZero:!1,scaleFontFamily:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",scaleFontSize:12,scaleFontStyle:"normal",scaleFontColor:"#666",responsive:!1,maintainAspectRatio:!0,showTooltips:!0,customTooltips:!1,tooltipEvents:["mousemove","touchstart","touchmove","mouseout"],tooltipFillColor:"rgba(0,0,0,0.8)",tooltipFontFamily:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",tooltipFontSize:14,tooltipFontStyle:"normal",tooltipFontColor:"#fff",tooltipTitleFontFamily:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",tooltipTitleFontSize:14,tooltipTitleFontStyle:"bold",tooltipTitleFontColor:"#fff",tooltipYPadding:6,tooltipXPadding:6,tooltipCaretSize:8,tooltipCornerRadius:6,tooltipXOffset:10,tooltipTemplate:"<%if (label){%><%=label%>: <%}%><%= value %>",multiTooltipTemplate:"<%= value %>",multiTooltipKeyBackground:"#fff",onAnimationProgress:function(){},onAnimationComplete:function(){}}},o.types={};var e,s,u=o.helpers={},d=u.each=function(t,i,e){var s=Array.prototype.slice.call(arguments,3);if(t)if(t.length===+t.length)for(var n=0;n<t.length;n++)i.apply(e,[t[n],n].concat(s));else for(var o in t)i.apply(e,[t[o],o].concat(s))},a=u.clone=function(e){var s={};return d(e,function(t,i){e.hasOwnProperty(i)&&(s[i]=t)}),s},h=u.extend=function(s){return d(Array.prototype.slice.call(arguments,1),function(e){d(e,function(t,i){e.hasOwnProperty(i)&&(s[i]=t)})}),s},l=u.merge=function(){var t=Array.prototype.slice.call(arguments,0);return t.unshift({}),h.apply(null,t)},n=u.indexOf=function(t,i){if(Array.prototype.indexOf)return t.indexOf(i);for(var e=0;e<t.length;e++)if(t[e]===i)return e;return-1},r=(u.where=function(t,i){var e=[];return u.each(t,function(t){i(t)&&e.push(t)}),e},u.findNextWhere=function(t,i,e){for(var s=(e=e||-1)+1;s<t.length;s++){var n=t[s];if(i(n))return n}},u.findPreviousWhere=function(t,i,e){for(var s=(e=e||t.length)-1;0<=s;s--){var n=t[s];if(i(n))return n}},u.inherits=function(t){function i(){this.constructor=s}var e=this,s=t&&t.hasOwnProperty("constructor")?t.constructor:function(){return e.apply(this,arguments)};return i.prototype=e.prototype,s.prototype=new i,s.extend=r,t&&h(s.prototype,t),s.__super__=e.prototype,s}),c=u.noop=function(){},p=u.uid=(e=0,function(){return"chart-"+e++}),f=u.warn=function(t){window.console&&"function"==typeof window.console.warn&&console.warn(t)},g=u.amd="function"==typeof define&&define.amd,m=u.isNumber=function(t){return!isNaN(parseFloat(t))&&isFinite(t)},S=u.max=function(t){return Math.max.apply(Math,t)},v=u.min=function(t){return Math.min.apply(Math,t)},x=(u.cap=function(t,i,e){if(m(i)){if(i<t)return i}else if(m(e)&&t<e)return e;return t},u.getDecimalPlaces=function(t){return t%1!=0&&m(t)?t.toString().split(".")[1].length:0}),y=u.radians=function(t){return t*(Math.PI/180)},C=(u.getAngleFromPoint=function(t,i){var e=i.x-t.x,s=i.y-t.y,i=Math.sqrt(e*e+s*s),t=2*Math.PI+Math.atan2(s,e);return e<0&&s<0&&(t+=2*Math.PI),{angle:t,distance:i}},u.aliasPixel=function(t){return t%2==0?0:.5}),w=(u.splineCurve=function(t,i,e,s){var n=Math.sqrt(Math.pow(i.x-t.x,2)+Math.pow(i.y-t.y,2)),o=Math.sqrt(Math.pow(e.x-i.x,2)+Math.pow(e.y-i.y,2)),a=s*n/(n+o),o=s*o/(n+o);return{inner:{x:i.x-a*(e.x-t.x),y:i.y-a*(e.y-t.y)},outer:{x:i.x+o*(e.x-t.x),y:i.y+o*(e.y-t.y)}}},u.calculateOrderOfMagnitude=function(t){return Math.floor(Math.log(t)/Math.LN10)}),b=(u.calculateScaleRange=function(t,i,e,s,n){var o=Math.floor(i/(1.5*e)),a=o<=2,i=S(t),e=v(t);i===e&&(i+=.5,.5<=e&&!s?e-=.5:i+=.5);for(var t=Math.abs(i-e),h=w(t),i=Math.ceil(i/+Math.pow(10,h))*Math.pow(10,h),e=s?0:Math.floor(e/+Math.pow(10,h))*Math.pow(10,h),l=i-e,r=Math.pow(10,h),c=Math.round(l/r);(o<c||2*c<o)&&!a;)if(o<c)r*=2,(c=Math.round(l/r))%1!=0&&(a=!0);else if(n&&0<=h){if(r/2%1!=0)break;r/=2,c=Math.round(l/r)}else r/=2,c=Math.round(l/r);return a&&(r=l/(c=2)),{steps:c,stepValue:r,min:e,max:e+c*r}},u.template=function(t,i){if(t instanceof Function)return t(i);var e,s,n={};return s=i,e=/\W/.test(e=t)?new Function("obj","var p=[],print=function(){p.push.apply(p,arguments);};with(obj){p.push('"+e.replace(/[\r\t\n]/g," ").split("<%").join("\t").replace(/((^|%>)[^\t]*)'/g,"$1\r").replace(/\t=(.*?)%>/g,"',$1,'").split("\t").join("');").split("%>").join("p.push('").split("\r").join("\\'")+"');}return p.join('');"):n[e],s?e(s):e}),P=(u.generateLabels=function(e,t,s,n){var o=new Array(t);return labelTemplateString&&d(o,function(t,i){o[i]=b(e,{value:s+n*(i+1)})}),o},u.easingEffects={linear:function(t){return t},easeInQuad:function(t){return t*t},easeOutQuad:function(t){return-1*t*(t-2)},easeInOutQuad:function(t){return(t/=.5)<1?.5*t*t:-.5*(--t*(t-2)-1)},easeInCubic:function(t){return t*t*t},easeOutCubic:function(t){return(t=+t-1)*t*t+1},easeInOutCubic:function(t){return(t/=.5)<1?.5*t*t*t:.5*((t-=2)*t*t+2)},easeInQuart:function(t){return t*t*t*t},easeOutQuart:function(t){return-1*((t=+t-1)*t*t*t-1)},easeInOutQuart:function(t){return(t/=.5)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)},easeInQuint:function(t){return(t/=1)*t*t*t*t},easeOutQuint:function(t){return(t=+t-1)*t*t*t*t+1},easeInOutQuint:function(t){return(t/=.5)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)},easeInSine:function(t){return-1*Math.cos(+t*(Math.PI/2))+1},easeOutSine:function(t){return+Math.sin(+t*(Math.PI/2))},easeInOutSine:function(t){return-.5*(Math.cos(Math.PI*t)-1)},easeInExpo:function(t){return 0===t?1:+Math.pow(2,10*(+t-1))},easeOutExpo:function(t){return 1===t?1:1-Math.pow(2,-10*t)},easeInOutExpo:function(t){return 0===t?0:1===t?1:(t/=.5)<1?.5*Math.pow(2,10*(t-1)):.5*(2-Math.pow(2,-10*--t))},easeInCirc:function(t){return 1<=t?t:-1*(Math.sqrt(1-(t/=1)*t)-1)},easeOutCirc:function(t){return+Math.sqrt(1-(t=+t-1)*t)},easeInOutCirc:function(t){return(t/=.5)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)},easeInElastic:function(t){var i=1.70158,e=0,s=1;return 0===t?0:1==(t/=1)?1:(e=e||.3,i=s<Math.abs(1)?(s=1,e/4):e/(2*Math.PI)*Math.asin(1/s),-(s*Math.pow(2,10*--t)*Math.sin(2*(+t-i)*Math.PI/e)))},easeOutElastic:function(t){var i=1.70158,e=0,s=1;return 0===t?0:1==(t/=1)?1:(e=e||.3,i=s<Math.abs(1)?(s=1,e/4):e/(2*Math.PI)*Math.asin(1/s),s*Math.pow(2,-10*t)*Math.sin(2*(+t-i)*Math.PI/e)+1)},easeInOutElastic:function(t){var i=1.70158,e=0,s=1;return 0===t?0:2==(t/=.5)?1:(e=e||.3*1.5,i=s<Math.abs(1)?(s=1,e/4):e/(2*Math.PI)*Math.asin(1/s),t<1?-.5*s*Math.pow(2,10*--t)*Math.sin(2*(+t-i)*Math.PI/e):s*Math.pow(2,-10*--t)*Math.sin(2*(+t-i)*Math.PI/e)*.5+1)},easeInBack:function(t){return(t/=1)*t*(2.70158*t-1.70158)},easeOutBack:function(t){return(t=+t-1)*t*(2.70158*t+1.70158)+1},easeInOutBack:function(t){var i=1.70158;return(t/=.5)<1?.5*t*t*((1+(i*=1.525))*t-i):.5*((t-=2)*t*((1+(i*=1.525))*t+i)+2)},easeInBounce:function(t){return 1-P.easeOutBounce(1-t)},easeOutBounce:function(t){return(t/=1)<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},easeInOutBounce:function(t){return t<.5?.5*P.easeInBounce(2*t):.5*P.easeOutBounce(2*t-1)+.5}}),L=u.requestAnimFrame=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(t){return window.setTimeout(t,1e3/60)},k=u.cancelAnimFrame=window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.oCancelAnimationFrame||window.msCancelAnimationFrame||function(t){return window.clearTimeout(t,1e3/60)},F=(u.animationLoop=function(e,s,t,n,o,a){var h=0,l=P[t]||P.linear,r=function(){var t=++h/s,i=l(t);e.call(a,i,t,h),n.call(a,i,t),h<s?a.animationFrame=L(r):o.apply(a)};L(r)},u.getRelativePosition=function(t){var i,e=t.originalEvent||t,t=(t.currentTarget||t.srcElement).getBoundingClientRect(),t=e.touches?(i=e.touches[0].clientX-t.left,e.touches[0].clientY-t.top):(i=e.clientX-t.left,e.clientY-t.top);return{x:i,y:t}},u.addEvent=function(t,i,e){t.addEventListener?t.addEventListener(i,e):t.attachEvent?t.attachEvent("on"+i,e):t["on"+i]=e}),R=u.removeEvent=function(t,i,e){t.removeEventListener?t.removeEventListener(i,e,!1):t.detachEvent?t.detachEvent("on"+i,e):t["on"+i]=c},T=(u.bindEvents=function(i,t,e){i.events||(i.events={}),d(t,function(t){i.events[t]=function(){e.apply(i,arguments)},F(i.chart.canvas,t,i.events[t])})},u.unbindEvents=function(e,t){d(t,function(t,i){R(e.chart.canvas,i,t)})}),A=u.getMaximumWidth=function(t){return t.parentNode.clientWidth},M=u.getMaximumHeight=function(t){return t.parentNode.clientHeight},W=(u.getMaximumSize=u.getMaximumWidth,u.retinaScale=function(t){var i=t.ctx,e=t.canvas.width,t=t.canvas.height;window.devicePixelRatio&&(i.canvas.style.width=e+"px",i.canvas.style.height=t+"px",i.canvas.height=t*window.devicePixelRatio,i.canvas.width=e*window.devicePixelRatio,i.scale(window.devicePixelRatio,window.devicePixelRatio))}),z=u.clear=function(t){t.ctx.clearRect(0,0,t.width,t.height)},B=u.fontString=function(t,i,e){return i+" "+t+"px "+e},E=u.longestText=function(i,t,e){i.font=t;var s=0;return d(e,function(t){t=i.measureText(t).width;s=s<t?t:s}),s},O=u.drawRoundedRectangle=function(t,i,e,s,n,o){t.beginPath(),t.moveTo(i+o,e),t.lineTo(i+s-o,e),t.quadraticCurveTo(i+s,e,i+s,e+o),t.lineTo(i+s,e+n-o),t.quadraticCurveTo(i+s,e+n,i+s-o,e+n),t.lineTo(i+o,e+n),t.quadraticCurveTo(i,e+n,i,e+n-o),t.lineTo(i,e+o),t.quadraticCurveTo(i,e,i+o,e),t.closePath()};o.instances={},h((o.Type=function(t,i,e){this.options=i,this.chart=e,this.id=p(),o.instances[this.id]=this,i.responsive&&this.resize(),this.initialize.call(this,t)}).prototype,{initialize:function(){return this},clear:function(){return z(this.chart),this},stop:function(){return k(this.animationFrame),this},resize:function(t){this.stop();var i=this.chart.canvas,e=A(this.chart.canvas),s=this.options.maintainAspectRatio?e/this.chart.aspectRatio:M(this.chart.canvas);return i.width=this.chart.width=e,i.height=this.chart.height=s,W(this.chart),"function"==typeof t&&t.apply(this,Array.prototype.slice.call(arguments,1)),this},reflow:c,render:function(t){return t&&this.reflow(),this.options.animation&&!t?u.animationLoop(this.draw,this.options.animationSteps,this.options.animationEasing,this.options.onAnimationProgress,this.options.onAnimationComplete,this):(this.draw(),this.options.onAnimationComplete.call(this)),this},generateLegend:function(){return b(this.options.legendTemplate,this)},destroy:function(){this.clear(),T(this,this.events);var t=this.chart.canvas;t.width=this.chart.width,t.height=this.chart.height,t.style.removeProperty?(t.style.removeProperty("width"),t.style.removeProperty("height")):(t.style.removeAttribute("width"),t.style.removeAttribute("height")),delete o.instances[this.id]},showTooltip:function(t,i){if(void 0===this.activeElements&&(this.activeElements=[]),function(t){var e=!1;return t.length!==this.activeElements.length?e=!0:(d(t,function(t,i){t!==this.activeElements[i]&&(e=!0)},this),e)}.call(this,t)||i){if(this.activeElements=t,this.draw(),this.options.customTooltips&&this.options.customTooltips(!1),0<t.length)if(this.datasets&&1<this.datasets.length){for(var e,l,s=this.datasets.length-1;0<=s&&(e=this.datasets[s].points||this.datasets[s].bars||this.datasets[s].segments,-1===(l=n(e,t[0])));s--);var r=[],c=[],i=function(){var i,t,e,s,n,o=[],a=[],h=[];return u.each(this.datasets,function(t){(i=t.points||t.bars||t.segments)[l]&&i[l].hasValue()&&o.push(i[l])}),u.each(o,function(t){a.push(t.x),h.push(t.y),r.push(u.template(this.options.multiTooltipTemplate,t)),c.push({fill:t._saved.fillColor||t.fillColor,stroke:t._saved.strokeColor||t.strokeColor})},this),n=v(h),e=S(h),s=v(a),t=S(a),{x:s>this.chart.width/2?s:t,y:(n+e)/2}}.call(this,l);new o.MultiTooltip({x:i.x,y:i.y,xPadding:this.options.tooltipXPadding,yPadding:this.options.tooltipYPadding,xOffset:this.options.tooltipXOffset,fillColor:this.options.tooltipFillColor,textColor:this.options.tooltipFontColor,fontFamily:this.options.tooltipFontFamily,fontStyle:this.options.tooltipFontStyle,fontSize:this.options.tooltipFontSize,titleTextColor:this.options.tooltipTitleFontColor,titleFontFamily:this.options.tooltipTitleFontFamily,titleFontStyle:this.options.tooltipTitleFontStyle,titleFontSize:this.options.tooltipTitleFontSize,cornerRadius:this.options.tooltipCornerRadius,labels:r,legendColors:c,legendColorBackground:this.options.multiTooltipKeyBackground,title:t[0].label,chart:this.chart,ctx:this.chart.ctx,custom:this.options.customTooltips}).draw()}else d(t,function(t){var i=t.tooltipPosition();new o.Tooltip({x:Math.round(i.x),y:Math.round(i.y),xPadding:this.options.tooltipXPadding,yPadding:this.options.tooltipYPadding,fillColor:this.options.tooltipFillColor,textColor:this.options.tooltipFontColor,fontFamily:this.options.tooltipFontFamily,fontStyle:this.options.tooltipFontStyle,fontSize:this.options.tooltipFontSize,caretHeight:this.options.tooltipCaretSize,cornerRadius:this.options.tooltipCornerRadius,text:b(this.options.tooltipTemplate,t),chart:this.chart,custom:this.options.customTooltips}).draw()},this);return this}},toBase64Image:function(){return this.chart.canvas.toDataURL.apply(this.chart.canvas,arguments)}}),o.Type.extend=function(t){function e(){return n.apply(this,arguments)}var s,i,n=this;return e.prototype=a(n.prototype),h(e.prototype,t),e.extend=o.Type.extend,t.name||n.prototype.name?(s=t.name||n.prototype.name,i=o.defaults[n.prototype.name]?a(o.defaults[n.prototype.name]):{},o.defaults[s]=h(i,t.defaults),o.types[s]=e,o.prototype[s]=function(t,i){i=l(o.defaults.global,o.defaults[s],i||{});return new e(t,i,this)}):f("Name not provided for this chart, so it hasn't been registered"),n},o.Element=function(t){h(this,t),this.initialize.apply(this,arguments),this.save()},h(o.Element.prototype,{initialize:function(){},restore:function(t){return t?d(t,function(t){this[t]=this._saved[t]},this):h(this,this._saved),this},save:function(){return this._saved=a(this),delete this._saved._saved,this},update:function(t){return d(t,function(t,i){this._saved[i]=this[i],this[i]=t},this),this},transition:function(t,e){return d(t,function(t,i){this[i]=(t-this._saved[i])*e+this._saved[i]},this),this},tooltipPosition:function(){return{x:this.x,y:this.y}},hasValue:function(){return m(this.value)}}),o.Element.extend=r,o.Point=o.Element.extend({display:!0,inRange:function(t,i){var e=this.hitDetectionRadius+this.radius;return Math.pow(t-this.x,2)+Math.pow(i-this.y,2)<Math.pow(e,2)},draw:function(){var t;this.display&&((t=this.ctx).beginPath(),t.arc(this.x,this.y,this.radius,0,2*Math.PI),t.closePath(),t.strokeStyle=this.strokeColor,t.lineWidth=this.strokeWidth,t.fillStyle=this.fillColor,t.fill(),t.stroke())}}),o.Arc=o.Element.extend({inRange:function(t,i){t=u.getAngleFromPoint(this,{x:t,y:i}),i=t.angle>=this.startAngle&&t.angle<=this.endAngle,t=t.distance>=this.innerRadius&&t.distance<=this.outerRadius;return i&&t},tooltipPosition:function(){var t=this.startAngle+(this.endAngle-this.startAngle)/2,i=(this.outerRadius-this.innerRadius)/2+this.innerRadius;return{x:this.x+Math.cos(t)*i,y:this.y+Math.sin(t)*i}},draw:function(t){var i=this.ctx;i.beginPath(),i.arc(this.x,this.y,this.outerRadius,this.startAngle,this.endAngle),i.arc(this.x,this.y,this.innerRadius,this.endAngle,this.startAngle,!0),i.closePath(),i.strokeStyle=this.strokeColor,i.lineWidth=this.strokeWidth,i.fillStyle=this.fillColor,i.fill(),i.lineJoin="bevel",this.showStroke&&i.stroke()}}),o.Rectangle=o.Element.extend({draw:function(){var t=this.ctx,i=this.width/2,e=this.x-i,s=this.x+i,n=this.base-(this.base-this.y),i=this.strokeWidth/2;this.showStroke&&(e+=i,s-=i,n+=i),t.beginPath(),t.fillStyle=this.fillColor,t.strokeStyle=this.strokeColor,t.lineWidth=this.strokeWidth,t.moveTo(e,this.base),t.lineTo(e,n),t.lineTo(s,n),t.lineTo(s,this.base),t.fill(),this.showStroke&&t.stroke()},height:function(){return this.base-this.y},inRange:function(t,i){return t>=this.x-this.width/2&&t<=this.x+this.width/2&&i>=this.y&&i<=this.base}}),o.Tooltip=o.Element.extend({draw:function(){var t=this.chart.ctx;t.font=B(this.fontSize,this.fontStyle,this.fontFamily),this.xAlign="center",this.yAlign="above";this.caretPadding=2;var i=t.measureText(this.text).width+2*this.xPadding,e=this.fontSize+2*this.yPadding,s=e+this.caretHeight+2;this.x+i/2>this.chart.width?this.xAlign="left":this.x-i/2<0&&(this.xAlign="right"),this.y-s<0&&(this.yAlign="below");var n=this.x-i/2,o=this.y-s;if(t.fillStyle=this.fillColor,this.custom)this.custom(this);else{switch(this.yAlign){case"above":t.beginPath(),t.moveTo(this.x,this.y-2),t.lineTo(this.x+this.caretHeight,this.y-(2+this.caretHeight)),t.lineTo(this.x-this.caretHeight,this.y-(2+this.caretHeight)),t.closePath(),t.fill();break;case"below":o=this.y+2+this.caretHeight,t.beginPath(),t.moveTo(this.x,this.y+2),t.lineTo(this.x+this.caretHeight,this.y+2+this.caretHeight),t.lineTo(this.x-this.caretHeight,this.y+2+this.caretHeight),t.closePath(),t.fill()}switch(this.xAlign){case"left":n=this.x-i+(this.cornerRadius+this.caretHeight);break;case"right":n=this.x-(this.cornerRadius+this.caretHeight)}O(t,n,o,i,e,this.cornerRadius),t.fill(),t.fillStyle=this.textColor,t.textAlign="center",t.textBaseline="middle",t.fillText(this.text,n+i/2,o+e/2)}}}),o.MultiTooltip=o.Element.extend({initialize:function(){this.font=B(this.fontSize,this.fontStyle,this.fontFamily),this.titleFont=B(this.titleFontSize,this.titleFontStyle,this.titleFontFamily),this.height=this.labels.length*this.fontSize+(this.labels.length-1)*(this.fontSize/2)+2*this.yPadding+1.5*this.titleFontSize,this.ctx.font=this.titleFont;var t=this.ctx.measureText(this.title).width,i=E(this.ctx,this.font,this.labels)+this.fontSize+3,t=S([i,t]);this.width=t+2*this.xPadding;t=this.height/2;this.y-t<0?this.y=t:this.y+t>this.chart.height&&(this.y=this.chart.height-t),this.x>this.chart.width/2?this.x-=this.xOffset+this.width:this.x+=this.xOffset},getLineHeight:function(t){var i=this.y-this.height/2+this.yPadding;return 0===t?i+this.titleFontSize/2:i+(1.5*this.fontSize*(t-1)+this.fontSize/2)+1.5*this.titleFontSize},draw:function(){var e;this.custom?this.custom(this):(O(this.ctx,this.x,this.y-this.height/2,this.width,this.height,this.cornerRadius),(e=this.ctx).fillStyle=this.fillColor,e.fill(),e.closePath(),e.textAlign="left",e.textBaseline="middle",e.fillStyle=this.titleTextColor,e.font=this.titleFont,e.fillText(this.title,this.x+this.xPadding,this.getLineHeight(0)),e.font=this.font,u.each(this.labels,function(t,i){e.fillStyle=this.textColor,e.fillText(t,this.x+this.xPadding+this.fontSize+3,this.getLineHeight(i+1)),e.fillStyle=this.legendColorBackground,e.fillRect(this.x+this.xPadding,this.getLineHeight(i+1)-this.fontSize/2,this.fontSize,this.fontSize),e.fillStyle=this.legendColors[i].fill,e.fillRect(this.x+this.xPadding,this.getLineHeight(i+1)-this.fontSize/2,this.fontSize,this.fontSize)},this))}}),o.Scale=o.Element.extend({initialize:function(){this.fit()},buildYLabels:function(){this.yLabels=[];for(var t=x(this.stepValue),i=0;i<=this.steps;i++)this.yLabels.push(b(this.templateString,{value:(this.min+i*this.stepValue).toFixed(t)}));this.yLabelWidth=this.display&&this.showLabels?E(this.ctx,this.font,this.yLabels):0},addXLabel:function(t){this.xLabels.push(t),this.valuesCount++,this.fit()},removeXLabel:function(){this.xLabels.shift(),this.valuesCount--,this.fit()},fit:function(){this.startPoint=this.display?this.fontSize:0,this.endPoint=this.display?this.height-1.5*this.fontSize-5:this.height,this.startPoint+=this.padding,this.endPoint-=this.padding;var t,i=this.endPoint-this.startPoint;for(this.calculateYRange(i),this.buildYLabels(),this.calculateXLabelRotation();i>this.endPoint-this.startPoint;)i=this.endPoint-this.startPoint,t=this.yLabelWidth,this.calculateYRange(i),this.buildYLabels(),t<this.yLabelWidth&&this.calculateXLabelRotation()},calculateXLabelRotation:function(){this.ctx.font=this.font;var t,i=this.ctx.measureText(this.xLabels[0]).width,e=this.ctx.measureText(this.xLabels[this.xLabels.length-1]).width;if(this.xScalePaddingRight=e/2+3,this.xScalePaddingLeft=i/2>this.yLabelWidth+10?i/2:this.yLabelWidth+10,this.xLabelRotation=0,this.display){var s,n=E(this.ctx,this.font,this.xLabels);this.xLabelWidth=n;for(var o=Math.floor(this.calculateX(1)-this.calculateX(0))-6;this.xLabelWidth>o&&0===this.xLabelRotation||this.xLabelWidth>o&&this.xLabelRotation<=90&&0<this.xLabelRotation;)s=Math.cos(y(this.xLabelRotation)),(t=s*i)+this.fontSize/2>this.yLabelWidth+8&&(this.xScalePaddingLeft=t+this.fontSize/2),this.xScalePaddingRight=this.fontSize/2,this.xLabelRotation++,this.xLabelWidth=s*n;0<this.xLabelRotation&&(this.endPoint-=Math.sin(y(this.xLabelRotation))*n+3)}else this.xLabelWidth=0,this.xScalePaddingRight=this.padding,this.xScalePaddingLeft=this.padding},calculateYRange:c,drawingArea:function(){return this.startPoint-this.endPoint},calculateY:function(t){var i=this.drawingArea()/(this.min-this.max);return this.endPoint-i*(t-this.min)},calculateX:function(t){var i=(this.xLabelRotation,this.width-(this.xScalePaddingLeft+this.xScalePaddingRight))/Math.max(this.valuesCount-(this.offsetGridLines?0:1),1),t=i*t+this.xScalePaddingLeft;return this.offsetGridLines&&(t+=i/2),Math.round(t)},update:function(t){u.extend(this,t),this.fit()},draw:function(){var a=this.ctx,o=(this.endPoint-this.startPoint)/this.steps,h=Math.round(this.xScalePaddingLeft);this.display&&(a.fillStyle=this.textColor,a.font=this.font,d(this.yLabels,function(t,i){var e=this.endPoint-o*i,s=Math.round(e),n=this.showHorizontalLines;a.textAlign="right",a.textBaseline="middle",this.showLabels&&a.fillText(t,h-10,e),(n=0===i&&!n?!0:n)&&a.beginPath(),0<i?(a.lineWidth=this.gridLineWidth,a.strokeStyle=this.gridLineColor):(a.lineWidth=this.lineWidth,a.strokeStyle=this.lineColor),s+=u.aliasPixel(a.lineWidth),n&&(a.moveTo(h,s),a.lineTo(this.width,s),a.stroke(),a.closePath()),a.lineWidth=this.lineWidth,a.strokeStyle=this.lineColor,a.beginPath(),a.moveTo(h-5,s),a.lineTo(h,s),a.stroke(),a.closePath()},this),d(this.xLabels,function(t,i){var e=this.calculateX(i)+C(this.lineWidth),s=this.calculateX(i-(this.offsetGridLines?.5:0))+C(this.lineWidth),n=0<this.xLabelRotation,o=this.showVerticalLines;(o=0===i&&!o?!0:o)&&a.beginPath(),0<i?(a.lineWidth=this.gridLineWidth,a.strokeStyle=this.gridLineColor):(a.lineWidth=this.lineWidth,a.strokeStyle=this.lineColor),o&&(a.moveTo(s,this.endPoint),a.lineTo(s,this.startPoint-3),a.stroke(),a.closePath()),a.lineWidth=this.lineWidth,a.strokeStyle=this.lineColor,a.beginPath(),a.moveTo(s,this.endPoint),a.lineTo(s,this.endPoint+5),a.stroke(),a.closePath(),a.save(),a.translate(e,n?this.endPoint+12:this.endPoint+8),a.rotate(-1*y(this.xLabelRotation)),a.font=this.font,a.textAlign=n?"right":"center",a.textBaseline=n?"middle":"top",a.fillText(t,0,0),a.restore()},this))}}),o.RadialScale=o.Element.extend({initialize:function(){this.size=v([this.height,this.width]),this.drawingArea=this.display?this.size/2-(this.fontSize/2+this.backdropPaddingY):this.size/2},calculateCenterOffset:function(t){var i=this.drawingArea/(this.max-this.min);return(t-this.min)*i},update:function(){this.lineArc?this.drawingArea=this.display?this.size/2-(this.fontSize/2+this.backdropPaddingY):this.size/2:this.setScaleSize(),this.buildYLabels()},buildYLabels:function(){this.yLabels=[];for(var t=x(this.stepValue),i=0;i<=this.steps;i++)this.yLabels.push(b(this.templateString,{value:(this.min+i*this.stepValue).toFixed(t)}))},getCircumference:function(){return 2*Math.PI/this.valuesCount},setScaleSize:function(){var t,i,e,s,n,o,a,h,l,r,c=v([this.height/2-this.pointLabelFontSize-5,this.width/2]),u=this.width,d=0;for(this.ctx.font=B(this.pointLabelFontSize,this.pointLabelFontStyle,this.pointLabelFontFamily),i=0;i<this.valuesCount;i++)t=this.getPointPosition(i,c),e=this.ctx.measureText(b(this.templateString,{value:this.labels[i]})).width+5,0===i||i===this.valuesCount/2?(t.x+(s=e/2)>u&&(u=t.x+s,n=i),t.x-s<d&&(d=t.x-s,o=i)):i<this.valuesCount/2?t.x+e>u&&(u=t.x+e,n=i):i>this.valuesCount/2&&t.x-e<d&&(d=t.x-e,o=i);a=d,h=Math.ceil(u-this.width),l=this.getIndexAngle(n),r=this.getIndexAngle(o),l=h/Math.sin(l+Math.PI/2),r=a/Math.sin(r+Math.PI/2),l=m(l)?l:0,r=m(r)?r:0,this.drawingArea=c-(r+l)/2,this.setCenterPoint(r,l)},setCenterPoint:function(t,i){i=this.width-i-this.drawingArea,t+=this.drawingArea;this.xCenter=(t+i)/2,this.yCenter=this.height/2},getIndexAngle:function(t){return t*(2*Math.PI/this.valuesCount)-Math.PI/2},getPointPosition:function(t,i){t=this.getIndexAngle(t);return{x:Math.cos(t)*i+this.xCenter,y:Math.sin(t)*i+this.yCenter}},draw:function(){if(this.display){var a=this.ctx;if(d(this.yLabels,function(t,i){if(0<i){var e,s=i*(this.drawingArea/this.steps),n=this.yCenter-s;if(0<this.lineWidth)if(a.strokeStyle=this.lineColor,a.lineWidth=this.lineWidth,this.lineArc)a.beginPath(),a.arc(this.xCenter,this.yCenter,s,0,2*Math.PI),a.closePath(),a.stroke();else{a.beginPath();for(var o=0;o<this.valuesCount;o++)e=this.getPointPosition(o,this.calculateCenterOffset(this.min+i*this.stepValue)),0===o?a.moveTo(e.x,e.y):a.lineTo(e.x,e.y);a.closePath(),a.stroke()}this.showLabels&&(a.font=B(this.fontSize,this.fontStyle,this.fontFamily),this.showLabelBackdrop&&(s=a.measureText(t).width,a.fillStyle=this.backdropColor,a.fillRect(this.xCenter-s/2-this.backdropPaddingX,n-this.fontSize/2-this.backdropPaddingY,s+2*this.backdropPaddingX,this.fontSize+2*this.backdropPaddingY)),a.textAlign="center",a.textBaseline="middle",a.fillStyle=this.fontColor,a.fillText(t,this.xCenter,n))}},this),!this.lineArc){a.lineWidth=this.angleLineWidth,a.strokeStyle=this.angleLineColor;for(var t=this.valuesCount-1;0<=t;t--){0<this.angleLineWidth&&(o=this.getPointPosition(t,this.calculateCenterOffset(this.max)),a.beginPath(),a.moveTo(this.xCenter,this.yCenter),a.lineTo(o.x,o.y),a.stroke(),a.closePath());var i=this.getPointPosition(t,this.calculateCenterOffset(this.max)+5);a.font=B(this.pointLabelFontSize,this.pointLabelFontStyle,this.pointLabelFontFamily),a.fillStyle=this.pointLabelFontColor;var e=this.labels.length,s=this.labels.length/2,n=s/2,o=t<n||e-n<t,n=t===n||t===e-n;a.textAlign=0===t||t===s?"center":t<s?"left":"right",a.textBaseline=n?"middle":o?"bottom":"top",a.fillText(this.labels[t],i.x,i.y)}}}}}),u.addEvent(window,"resize",function(){clearTimeout(s),s=setTimeout(function(){d(o.instances,function(t){t.options.responsive&&t.resize(t.render,!0)})},50)}),g?define(function(){return o}):"object"==typeof module&&module.exports&&(module.exports=o),(t.Chart=o).noConflict=function(){return t.Chart=i,o}}).call(this),function(){"use strict";var t=this.Chart,a=t.helpers;t.Type.extend({name:"Bar",defaults:{scaleBeginAtZero:!0,scaleShowGridLines:!0,scaleGridLineColor:"rgba(0,0,0,.05)",scaleGridLineWidth:1,scaleShowHorizontalLines:!0,scaleShowVerticalLines:!0,barShowStroke:!0,barStrokeWidth:2,barValueSpacing:5,barDatasetSpacing:1,legendTemplate:'<ul class="<%=name.toLowerCase()%>-legend"><% for (var i=0; i<datasets.length; i++){%><li><span style="background-color:<%=datasets[i].fillColor%>"></span><%if(datasets[i].label){%><%=datasets[i].label%><%}%></li><%}%></ul>'},initialize:function(n){var o=this.options;this.ScaleClass=t.Scale.extend({offsetGridLines:!0,calculateBarX:function(t,i,e){var s=this.calculateBaseWidth(),s=this.calculateX(e)-s/2,t=this.calculateBarWidth(t);return s+t*i+i*o.barDatasetSpacing+t/2},calculateBaseWidth:function(){return this.calculateX(1)-this.calculateX(0)-2*o.barValueSpacing},calculateBarWidth:function(t){return(this.calculateBaseWidth()-(t-1)*o.barDatasetSpacing)/t}}),this.datasets=[],this.options.showTooltips&&a.bindEvents(this,this.options.tooltipEvents,function(t){t="mouseout"!==t.type?this.getBarsAtEvent(t):[];this.eachBars(function(t){t.restore(["fillColor","strokeColor"])}),a.each(t,function(t){t.fillColor=t.highlightFill,t.strokeColor=t.highlightStroke}),this.showTooltip(t)}),this.BarClass=t.Rectangle.extend({strokeWidth:this.options.barStrokeWidth,showStroke:this.options.barShowStroke,ctx:this.chart.ctx}),a.each(n.datasets,function(e){var s={label:e.label||null,fillColor:e.fillColor,strokeColor:e.strokeColor,bars:[]};this.datasets.push(s),a.each(e.data,function(t,i){s.bars.push(new this.BarClass({value:t,label:n.labels[i],datasetLabel:e.label,strokeColor:e.strokeColor,fillColor:e.fillColor,highlightFill:e.highlightFill||e.fillColor,highlightStroke:e.highlightStroke||e.strokeColor}))},this)},this),this.buildScale(n.labels),this.BarClass.prototype.base=this.scale.endPoint,this.eachBars(function(t,i,e){a.extend(t,{width:this.scale.calculateBarWidth(this.datasets.length),x:this.scale.calculateBarX(this.datasets.length,e,i),y:this.scale.endPoint}),t.save()},this),this.render()},update:function(){this.scale.update(),a.each(this.activeElements,function(t){t.restore(["fillColor","strokeColor"])}),this.eachBars(function(t){t.save()}),this.render()},eachBars:function(e){a.each(this.datasets,function(t,i){a.each(t.bars,e,this,i)},this)},getBarsAtEvent:function(t){for(var i,e=[],s=a.getRelativePosition(t),n=function(t){e.push(t.bars[i])},o=0;o<this.datasets.length;o++)for(i=0;i<this.datasets[o].bars.length;i++)if(this.datasets[o].bars[i].inRange(s.x,s.y))return a.each(this.datasets,n),e;return e},buildScale:function(t){var e=this,t={templateString:this.options.scaleLabel,height:this.chart.height,width:this.chart.width,ctx:this.chart.ctx,textColor:this.options.scaleFontColor,fontSize:this.options.scaleFontSize,fontStyle:this.options.scaleFontStyle,fontFamily:this.options.scaleFontFamily,valuesCount:t.length,beginAtZero:this.options.scaleBeginAtZero,integersOnly:this.options.scaleIntegersOnly,calculateYRange:function(t){var i,t=a.calculateScaleRange((i=[],e.eachBars(function(t){i.push(t.value)}),i),t,this.fontSize,this.beginAtZero,this.integersOnly);a.extend(this,t)},xLabels:t,font:a.fontString(this.options.scaleFontSize,this.options.scaleFontStyle,this.options.scaleFontFamily),lineWidth:this.options.scaleLineWidth,lineColor:this.options.scaleLineColor,showHorizontalLines:this.options.scaleShowHorizontalLines,showVerticalLines:this.options.scaleShowVerticalLines,gridLineWidth:this.options.scaleShowGridLines?this.options.scaleGridLineWidth:0,gridLineColor:this.options.scaleShowGridLines?this.options.scaleGridLineColor:"rgba(0,0,0,0)",padding:!this.options.showScale&&this.options.barShowStroke?this.options.barStrokeWidth:0,showLabels:this.options.scaleShowLabels,display:this.options.showScale};this.options.scaleOverride&&a.extend(t,{calculateYRange:a.noop,steps:this.options.scaleSteps,stepValue:this.options.scaleStepWidth,min:this.options.scaleStartValue,max:this.options.scaleStartValue+this.options.scaleSteps*this.options.scaleStepWidth}),this.scale=new this.ScaleClass(t)},addData:function(t,e){a.each(t,function(t,i){this.datasets[i].bars.push(new this.BarClass({value:t,label:e,x:this.scale.calculateBarX(this.datasets.length,i,this.scale.valuesCount+1),y:this.scale.endPoint,width:this.scale.calculateBarWidth(this.datasets.length),base:this.scale.endPoint,strokeColor:this.datasets[i].strokeColor,fillColor:this.datasets[i].fillColor}))},this),this.scale.addXLabel(e),this.update()},removeData:function(){this.scale.removeXLabel(),a.each(this.datasets,function(t){t.bars.shift()},this),this.update()},reflow:function(){a.extend(this.BarClass.prototype,{y:this.scale.endPoint,base:this.scale.endPoint});var t=a.extend({height:this.chart.height,width:this.chart.width});this.scale.update(t)},draw:function(t){var s=t||1;this.clear(),this.chart.ctx,this.scale.draw(s),a.each(this.datasets,function(t,e){a.each(t.bars,function(t,i){t.hasValue()&&(t.base=this.scale.endPoint,t.transition({x:this.scale.calculateBarX(this.datasets.length,e,i),y:this.scale.calculateY(t.value),width:this.scale.calculateBarWidth(this.datasets.length)},s).draw())},this)},this)}})}.call(this),function(){"use strict";var i=this.Chart,s=i.helpers,t={segmentShowStroke:!0,segmentStrokeColor:"#fff",segmentStrokeWidth:2,percentageInnerCutout:50,animationSteps:100,animationEasing:"easeOutBounce",animateRotate:!0,animateScale:!1,legendTemplate:'<ul class="<%=name.toLowerCase()%>-legend"><% for (var i=0; i<segments.length; i++){%><li><span style="background-color:<%=segments[i].fillColor%>"></span><%if(segments[i].label){%><%=segments[i].label%><%}%></li><%}%></ul>'};i.Type.extend({name:"Doughnut",defaults:t,initialize:function(t){this.segments=[],this.outerRadius=(s.min([this.chart.width,this.chart.height])-this.options.segmentStrokeWidth/2)/2,this.SegmentArc=i.Arc.extend({ctx:this.chart.ctx,x:this.chart.width/2,y:this.chart.height/2}),this.options.showTooltips&&s.bindEvents(this,this.options.tooltipEvents,function(t){t="mouseout"!==t.type?this.getSegmentsAtEvent(t):[];s.each(this.segments,function(t){t.restore(["fillColor"])}),s.each(t,function(t){t.fillColor=t.highlightColor}),this.showTooltip(t)}),this.calculateTotal(t),s.each(t,function(t,i){this.addData(t,i,!0)},this),this.render()},getSegmentsAtEvent:function(t){var i=[],e=s.getRelativePosition(t);return s.each(this.segments,function(t){t.inRange(e.x,e.y)&&i.push(t)},this),i},addData:function(t,i,e){i=i||this.segments.length;this.segments.splice(i,0,new this.SegmentArc({value:t.value,outerRadius:this.options.animateScale?0:this.outerRadius,innerRadius:this.options.animateScale?0:this.outerRadius/100*this.options.percentageInnerCutout,fillColor:t.color,highlightColor:t.highlight||t.color,showStroke:this.options.segmentShowStroke,strokeWidth:this.options.segmentStrokeWidth,strokeColor:this.options.segmentStrokeColor,startAngle:1.5*Math.PI,circumference:this.options.animateRotate?0:this.calculateCircumference(t.value),label:t.label})),e||(this.reflow(),this.update())},calculateCircumference:function(t){return 2*Math.PI*(Math.abs(t)/this.total)},calculateTotal:function(t){this.total=0,s.each(t,function(t){this.total+=Math.abs(t.value)},this)},update:function(){this.calculateTotal(this.segments),s.each(this.activeElements,function(t){t.restore(["fillColor"])}),s.each(this.segments,function(t){t.save()}),this.render()},removeData:function(t){t=s.isNumber(t)?t:this.segments.length-1;this.segments.splice(t,1),this.reflow(),this.update()},reflow:function(){s.extend(this.SegmentArc.prototype,{x:this.chart.width/2,y:this.chart.height/2}),this.outerRadius=(s.min([this.chart.width,this.chart.height])-this.options.segmentStrokeWidth/2)/2,s.each(this.segments,function(t){t.update({outerRadius:this.outerRadius,innerRadius:this.outerRadius/100*this.options.percentageInnerCutout})},this)},draw:function(t){var e=t||1;this.clear(),s.each(this.segments,function(t,i){t.transition({circumference:this.calculateCircumference(t.value),outerRadius:this.outerRadius,innerRadius:this.outerRadius/100*this.options.percentageInnerCutout},e),t.endAngle=t.startAngle+t.circumference,t.draw(),0===i&&(t.startAngle=1.5*Math.PI),i<this.segments.length-1&&(this.segments[i+1].startAngle=t.endAngle)},this)}}),i.types.Doughnut.extend({name:"Pie",defaults:s.merge(t,{percentageInnerCutout:0})})}.call(this),function(){"use strict";var i=this.Chart,l=i.helpers;i.Type.extend({name:"Line",defaults:{scaleShowGridLines:!0,scaleGridLineColor:"rgba(0,0,0,.05)",scaleGridLineWidth:1,scaleShowHorizontalLines:!0,scaleShowVerticalLines:!0,bezierCurve:!0,bezierCurveTension:.4,pointDot:!0,pointDotRadius:4,pointDotStrokeWidth:1,pointHitDetectionRadius:20,datasetStroke:!0,datasetStrokeWidth:2,datasetFill:!0,legendTemplate:'<ul class="<%=name.toLowerCase()%>-legend"><% for (var i=0; i<datasets.length; i++){%><li><span style="background-color:<%=datasets[i].strokeColor%>"></span><%if(datasets[i].label){%><%=datasets[i].label%><%}%></li><%}%></ul>'},initialize:function(n){this.PointClass=i.Point.extend({strokeWidth:this.options.pointDotStrokeWidth,radius:this.options.pointDotRadius,display:this.options.pointDot,hitDetectionRadius:this.options.pointHitDetectionRadius,ctx:this.chart.ctx,inRange:function(t){return Math.pow(t-this.x,2)<Math.pow(this.radius+this.hitDetectionRadius,2)}}),this.datasets=[],this.options.showTooltips&&l.bindEvents(this,this.options.tooltipEvents,function(t){t="mouseout"!==t.type?this.getPointsAtEvent(t):[];this.eachPoints(function(t){t.restore(["fillColor","strokeColor"])}),l.each(t,function(t){t.fillColor=t.highlightFill,t.strokeColor=t.highlightStroke}),this.showTooltip(t)}),l.each(n.datasets,function(e){var s={label:e.label||null,fillColor:e.fillColor,strokeColor:e.strokeColor,pointColor:e.pointColor,pointStrokeColor:e.pointStrokeColor,points:[]};this.datasets.push(s),l.each(e.data,function(t,i){s.points.push(new this.PointClass({value:t,label:n.labels[i],datasetLabel:e.label,strokeColor:e.pointStrokeColor,fillColor:e.pointColor,highlightFill:e.pointHighlightFill||e.pointColor,highlightStroke:e.pointHighlightStroke||e.pointStrokeColor}))},this),this.buildScale(n.labels),this.eachPoints(function(t,i){l.extend(t,{x:this.scale.calculateX(i),y:this.scale.endPoint}),t.save()},this)},this),this.render()},update:function(){this.scale.update(),l.each(this.activeElements,function(t){t.restore(["fillColor","strokeColor"])}),this.eachPoints(function(t){t.save()}),this.render()},eachPoints:function(i){l.each(this.datasets,function(t){l.each(t.points,i,this)},this)},getPointsAtEvent:function(t){var i=[],e=l.getRelativePosition(t);return l.each(this.datasets,function(t){l.each(t.points,function(t){t.inRange(e.x,e.y)&&i.push(t)})},this),i},buildScale:function(t){var e=this,t={templateString:this.options.scaleLabel,height:this.chart.height,width:this.chart.width,ctx:this.chart.ctx,textColor:this.options.scaleFontColor,fontSize:this.options.scaleFontSize,fontStyle:this.options.scaleFontStyle,fontFamily:this.options.scaleFontFamily,valuesCount:t.length,beginAtZero:this.options.scaleBeginAtZero,integersOnly:this.options.scaleIntegersOnly,calculateYRange:function(t){var i,t=l.calculateScaleRange((i=[],e.eachPoints(function(t){i.push(t.value)}),i),t,this.fontSize,this.beginAtZero,this.integersOnly);l.extend(this,t)},xLabels:t,font:l.fontString(this.options.scaleFontSize,this.options.scaleFontStyle,this.options.scaleFontFamily),lineWidth:this.options.scaleLineWidth,lineColor:this.options.scaleLineColor,showHorizontalLines:this.options.scaleShowHorizontalLines,showVerticalLines:this.options.scaleShowVerticalLines,gridLineWidth:this.options.scaleShowGridLines?this.options.scaleGridLineWidth:0,gridLineColor:this.options.scaleShowGridLines?this.options.scaleGridLineColor:"rgba(0,0,0,0)",padding:this.options.showScale?0:this.options.pointDotRadius+this.options.pointDotStrokeWidth,showLabels:this.options.scaleShowLabels,display:this.options.showScale};this.options.scaleOverride&&l.extend(t,{calculateYRange:l.noop,steps:this.options.scaleSteps,stepValue:this.options.scaleStepWidth,min:this.options.scaleStartValue,max:this.options.scaleStartValue+this.options.scaleSteps*this.options.scaleStepWidth}),this.scale=new i.Scale(t)},addData:function(t,e){l.each(t,function(t,i){this.datasets[i].points.push(new this.PointClass({value:t,label:e,x:this.scale.calculateX(this.scale.valuesCount+1),y:this.scale.endPoint,strokeColor:this.datasets[i].pointStrokeColor,fillColor:this.datasets[i].pointColor}))},this),this.scale.addXLabel(e),this.update()},removeData:function(){this.scale.removeXLabel(),l.each(this.datasets,function(t){t.points.shift()},this),this.update()},reflow:function(){var t=l.extend({height:this.chart.height,width:this.chart.width});this.scale.update(t)},draw:function(t){var e=t||1;this.clear();function a(t){return null!==t.value}function h(t,i,e){return l.findPreviousWhere(i,a,e)||t}var s=this.chart.ctx;this.scale.draw(e),l.each(this.datasets,function(t){var o=l.where(t.points,a);l.each(t.points,function(t,i){t.hasValue()&&t.transition({y:this.scale.calculateY(t.value),x:this.scale.calculateX(i)},e)},this),this.options.bezierCurve&&l.each(o,function(t,i){var e,s,n=0<i&&i<o.length-1?this.options.bezierCurveTension:0;t.controlPoints=l.splineCurve(h(t,o,i),t,(e=t,s=o,i=i,l.findNextWhere(s,a,i)||e),n),t.controlPoints.outer.y>this.scale.endPoint?t.controlPoints.outer.y=this.scale.endPoint:t.controlPoints.outer.y<this.scale.startPoint&&(t.controlPoints.outer.y=this.scale.startPoint),t.controlPoints.inner.y>this.scale.endPoint?t.controlPoints.inner.y=this.scale.endPoint:t.controlPoints.inner.y<this.scale.startPoint&&(t.controlPoints.inner.y=this.scale.startPoint)},this),s.lineWidth=this.options.datasetStrokeWidth,s.strokeStyle=t.strokeColor,s.beginPath(),l.each(o,function(t,i){0===i?s.moveTo(t.x,t.y):this.options.bezierCurve?(i=h(t,o,i),s.bezierCurveTo(i.controlPoints.outer.x,i.controlPoints.outer.y,t.controlPoints.inner.x,t.controlPoints.inner.y,t.x,t.y)):s.lineTo(t.x,t.y)},this),s.stroke(),this.options.datasetFill&&0<o.length&&(s.lineTo(o[o.length-1].x,this.scale.endPoint),s.lineTo(o[0].x,this.scale.endPoint),s.fillStyle=t.fillColor,s.closePath(),s.fill()),l.each(o,function(t){t.draw()})},this)}})}.call(this),function(){"use strict";var i=this.Chart,s=i.helpers;i.Type.extend({name:"PolarArea",defaults:{scaleShowLabelBackdrop:!0,scaleBackdropColor:"rgba(255,255,255,0.75)",scaleBeginAtZero:!0,scaleBackdropPaddingY:2,scaleBackdropPaddingX:2,scaleShowLine:!0,segmentShowStroke:!0,segmentStrokeColor:"#fff",segmentStrokeWidth:2,animationSteps:100,animationEasing:"easeOutBounce",animateRotate:!0,animateScale:!1,legendTemplate:'<ul class="<%=name.toLowerCase()%>-legend"><% for (var i=0; i<segments.length; i++){%><li><span style="background-color:<%=segments[i].fillColor%>"></span><%if(segments[i].label){%><%=segments[i].label%><%}%></li><%}%></ul>'},initialize:function(t){this.segments=[],this.SegmentArc=i.Arc.extend({showStroke:this.options.segmentShowStroke,strokeWidth:this.options.segmentStrokeWidth,strokeColor:this.options.segmentStrokeColor,ctx:this.chart.ctx,innerRadius:0,x:this.chart.width/2,y:this.chart.height/2}),this.scale=new i.RadialScale({display:this.options.showScale,fontStyle:this.options.scaleFontStyle,fontSize:this.options.scaleFontSize,fontFamily:this.options.scaleFontFamily,fontColor:this.options.scaleFontColor,showLabels:this.options.scaleShowLabels,showLabelBackdrop:this.options.scaleShowLabelBackdrop,backdropColor:this.options.scaleBackdropColor,backdropPaddingY:this.options.scaleBackdropPaddingY,backdropPaddingX:this.options.scaleBackdropPaddingX,lineWidth:this.options.scaleShowLine?this.options.scaleLineWidth:0,lineColor:this.options.scaleLineColor,lineArc:!0,width:this.chart.width,height:this.chart.height,xCenter:this.chart.width/2,yCenter:this.chart.height/2,ctx:this.chart.ctx,templateString:this.options.scaleLabel,valuesCount:t.length}),this.updateScaleRange(t),this.scale.update(),s.each(t,function(t,i){this.addData(t,i,!0)},this),this.options.showTooltips&&s.bindEvents(this,this.options.tooltipEvents,function(t){t="mouseout"!==t.type?this.getSegmentsAtEvent(t):[];s.each(this.segments,function(t){t.restore(["fillColor"])}),s.each(t,function(t){t.fillColor=t.highlightColor}),this.showTooltip(t)}),this.render()},getSegmentsAtEvent:function(t){var i=[],e=s.getRelativePosition(t);return s.each(this.segments,function(t){t.inRange(e.x,e.y)&&i.push(t)},this),i},addData:function(t,i,e){i=i||this.segments.length;this.segments.splice(i,0,new this.SegmentArc({fillColor:t.color,highlightColor:t.highlight||t.color,label:t.label,value:t.value,outerRadius:this.options.animateScale?0:this.scale.calculateCenterOffset(t.value),circumference:this.options.animateRotate?0:this.scale.getCircumference(),startAngle:1.5*Math.PI})),e||(this.reflow(),this.update())},removeData:function(t){t=s.isNumber(t)?t:this.segments.length-1;this.segments.splice(t,1),this.reflow(),this.update()},calculateTotal:function(t){this.total=0,s.each(t,function(t){this.total+=t.value},this),this.scale.valuesCount=this.segments.length},updateScaleRange:function(t){var i=[];s.each(t,function(t){i.push(t.value)});t=this.options.scaleOverride?{steps:this.options.scaleSteps,stepValue:this.options.scaleStepWidth,min:this.options.scaleStartValue,max:this.options.scaleStartValue+this.options.scaleSteps*this.options.scaleStepWidth}:s.calculateScaleRange(i,s.min([this.chart.width,this.chart.height])/2,this.options.scaleFontSize,this.options.scaleBeginAtZero,this.options.scaleIntegersOnly);s.extend(this.scale,t,{size:s.min([this.chart.width,this.chart.height]),xCenter:this.chart.width/2,yCenter:this.chart.height/2})},update:function(){this.calculateTotal(this.segments),s.each(this.segments,function(t){t.save()}),this.reflow(),this.render()},reflow:function(){s.extend(this.SegmentArc.prototype,{x:this.chart.width/2,y:this.chart.height/2}),this.updateScaleRange(this.segments),this.scale.update(),s.extend(this.scale,{xCenter:this.chart.width/2,yCenter:this.chart.height/2}),s.each(this.segments,function(t){t.update({outerRadius:this.scale.calculateCenterOffset(t.value)})},this)},draw:function(t){var e=t||1;this.clear(),s.each(this.segments,function(t,i){t.transition({circumference:this.scale.getCircumference(),outerRadius:this.scale.calculateCenterOffset(t.value)},e),t.endAngle=t.startAngle+t.circumference,0===i&&(t.startAngle=1.5*Math.PI),i<this.segments.length-1&&(this.segments[i+1].startAngle=t.endAngle),t.draw()},this),this.scale.draw()}})}.call(this),function(){"use strict";var i=this.Chart,a=i.helpers;i.Type.extend({name:"Radar",defaults:{scaleShowLine:!0,angleShowLineOut:!0,scaleShowLabels:!1,scaleBeginAtZero:!0,angleLineColor:"rgba(0,0,0,.1)",angleLineWidth:1,pointLabelFontFamily:"'Arial'",pointLabelFontStyle:"normal",pointLabelFontSize:10,pointLabelFontColor:"#666",pointDot:!0,pointDotRadius:3,pointDotStrokeWidth:1,pointHitDetectionRadius:20,datasetStroke:!0,datasetStrokeWidth:2,datasetFill:!0,legendTemplate:'<ul class="<%=name.toLowerCase()%>-legend"><% for (var i=0; i<datasets.length; i++){%><li><span style="background-color:<%=datasets[i].strokeColor%>"></span><%if(datasets[i].label){%><%=datasets[i].label%><%}%></li><%}%></ul>'},initialize:function(o){this.PointClass=i.Point.extend({strokeWidth:this.options.pointDotStrokeWidth,radius:this.options.pointDotRadius,display:this.options.pointDot,hitDetectionRadius:this.options.pointHitDetectionRadius,ctx:this.chart.ctx}),this.datasets=[],this.buildScale(o),this.options.showTooltips&&a.bindEvents(this,this.options.tooltipEvents,function(t){t="mouseout"!==t.type?this.getPointsAtEvent(t):[];this.eachPoints(function(t){t.restore(["fillColor","strokeColor"])}),a.each(t,function(t){t.fillColor=t.highlightFill,t.strokeColor=t.highlightStroke}),this.showTooltip(t)}),a.each(o.datasets,function(s){var n={label:s.label||null,fillColor:s.fillColor,strokeColor:s.strokeColor,pointColor:s.pointColor,pointStrokeColor:s.pointStrokeColor,points:[]};this.datasets.push(n),a.each(s.data,function(t,i){var e;this.scale.animation||(e=this.scale.getPointPosition(i,this.scale.calculateCenterOffset(t))),n.points.push(new this.PointClass({value:t,label:o.labels[i],datasetLabel:s.label,x:this.options.animation?this.scale.xCenter:e.x,y:this.options.animation?this.scale.yCenter:e.y,strokeColor:s.pointStrokeColor,fillColor:s.pointColor,highlightFill:s.pointHighlightFill||s.pointColor,highlightStroke:s.pointHighlightStroke||s.pointStrokeColor}))},this)},this),this.render()},eachPoints:function(i){a.each(this.datasets,function(t){a.each(t.points,i,this)},this)},getPointsAtEvent:function(t){var i=a.getRelativePosition(t),t=a.getAngleFromPoint({x:this.scale.xCenter,y:this.scale.yCenter},i),i=2*Math.PI/this.scale.valuesCount,e=Math.round((t.angle-1.5*Math.PI)/i),s=[];return(e>=this.scale.valuesCount||e<0)&&(e=0),t.distance<=this.scale.drawingArea&&a.each(this.datasets,function(t){s.push(t.points[e])}),s},buildScale:function(t){this.scale=new i.RadialScale({display:this.options.showScale,fontStyle:this.options.scaleFontStyle,fontSize:this.options.scaleFontSize,fontFamily:this.options.scaleFontFamily,fontColor:this.options.scaleFontColor,showLabels:this.options.scaleShowLabels,showLabelBackdrop:this.options.scaleShowLabelBackdrop,backdropColor:this.options.scaleBackdropColor,backdropPaddingY:this.options.scaleBackdropPaddingY,backdropPaddingX:this.options.scaleBackdropPaddingX,lineWidth:this.options.scaleShowLine?this.options.scaleLineWidth:0,lineColor:this.options.scaleLineColor,angleLineColor:this.options.angleLineColor,angleLineWidth:this.options.angleShowLineOut?this.options.angleLineWidth:0,pointLabelFontColor:this.options.pointLabelFontColor,pointLabelFontSize:this.options.pointLabelFontSize,pointLabelFontFamily:this.options.pointLabelFontFamily,pointLabelFontStyle:this.options.pointLabelFontStyle,height:this.chart.height,width:this.chart.width,xCenter:this.chart.width/2,yCenter:this.chart.height/2,ctx:this.chart.ctx,templateString:this.options.scaleLabel,labels:t.labels,valuesCount:t.datasets[0].data.length}),this.scale.setScaleSize(),this.updateScaleRange(t.datasets),this.scale.buildYLabels()},updateScaleRange:function(t){var i,t=(i=[],a.each(t,function(t){t.data?i=i.concat(t.data):a.each(t.points,function(t){i.push(t.value)})}),i),t=this.options.scaleOverride?{steps:this.options.scaleSteps,stepValue:this.options.scaleStepWidth,min:this.options.scaleStartValue,max:this.options.scaleStartValue+this.options.scaleSteps*this.options.scaleStepWidth}:a.calculateScaleRange(t,a.min([this.chart.width,this.chart.height])/2,this.options.scaleFontSize,this.options.scaleBeginAtZero,this.options.scaleIntegersOnly);a.extend(this.scale,t)},addData:function(t,s){this.scale.valuesCount++,a.each(t,function(t,i){var e=this.scale.getPointPosition(this.scale.valuesCount,this.scale.calculateCenterOffset(t));this.datasets[i].points.push(new this.PointClass({value:t,label:s,x:e.x,y:e.y,strokeColor:this.datasets[i].pointStrokeColor,fillColor:this.datasets[i].pointColor}))},this),this.scale.labels.push(s),this.reflow(),this.update()},removeData:function(){this.scale.valuesCount--,this.scale.labels.shift(),a.each(this.datasets,function(t){t.points.shift()},this),this.reflow(),this.update()},update:function(){this.eachPoints(function(t){t.save()}),this.reflow(),this.render()},reflow:function(){a.extend(this.scale,{width:this.chart.width,height:this.chart.height,size:a.min([this.chart.width,this.chart.height]),xCenter:this.chart.width/2,yCenter:this.chart.height/2}),this.updateScaleRange(this.datasets),this.scale.setScaleSize(),this.scale.buildYLabels()},draw:function(t){var e=t||1,s=this.chart.ctx;this.clear(),this.scale.draw(),a.each(this.datasets,function(t){a.each(t.points,function(t,i){t.hasValue()&&t.transition(this.scale.getPointPosition(i,this.scale.calculateCenterOffset(t.value)),e)},this),s.lineWidth=this.options.datasetStrokeWidth,s.strokeStyle=t.strokeColor,s.beginPath(),a.each(t.points,function(t,i){0===i?s.moveTo(t.x,t.y):s.lineTo(t.x,t.y)},this),s.closePath(),s.stroke(),s.fillStyle=t.fillColor,s.fill(),a.each(t.points,function(t){t.hasValue()&&t.draw()})},this)}})}.call(this);
1
+ !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 r="undefined"==typeof window?function(t){return t()}:window.requestAnimationFrame;function l(e,i,t){const a=t||(t=>Array.prototype.slice.call(t));let n=!1,o;return function(...t){o=a(t),n||(n=!0,r.call(window,()=>{n=!1,e.apply(i,o)}))}}function s(t,e){let i;return function(){return e?(clearTimeout(i),i=setTimeout(t,e)):t(),e}}const f=t=>"start"===t?"left":"end"===t?"right":"center",T=(t,e,i)=>"start"===t?e:"end"===t?i:(e+i)/2,R=(t,e,i)=>"right"===t?i:"center"===t?(e+i)/2:e;var h=new class{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(e,i,a,t){const n=i.listeners[t],o=i.duration;n.forEach(t=>t({chart:e,initial:i.initial,numSteps:o,currentStep:Math.min(a-i.start,o)}))}_refresh(){const t=this;t._request||(t._running=!0,t._request=r.call(window,()=>{t._update(),t._request=null,t._running&&t._refresh()}))}_update(r=Date.now()){const s=this;let l=0;s._charts.forEach((a,n)=>{if(a.running&&a.items.length){const o=a.items;let t,e=o.length-1,i=!1;for(;0<=e;--e)t=o[e],t._active?(t._total>a.duration&&(a.duration=t._total),t.tick(r),i=!0):(o[e]=o[o.length-1],o.pop());i&&(n.draw(),s._notify(n,a,r,"progress")),o.length||(a.running=!1,s._notify(n,a,r,"complete"),a.initial=!1),l+=o.length}}),s._lastDate=r,0===l&&(s._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 0<this._getAnims(t).items.length}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;t=this._charts.get(t);return!!(t&&t.running&&t.items.length)}stop(e){const i=this._charts.get(e);if(i&&i.items.length){const a=i.items;let t=a.length-1;for(;0<=t;--t)a[t].cancel();i.items=[],this._notify(e,i,Date.now(),"complete")}}remove(t){return this._charts.delete(t)}};const o={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},e="0123456789ABCDEF",i=t=>e[15&t],a=t=>e[(240&t)>>4]+e[15&t],n=t=>(240&t)>>4==(15&t);function c(t){return t+.5|0}const d=(t,e,i)=>Math.max(Math.min(t,i),e);function u(t){return d(c(2.55*t),0,255)}function g(t){return d(c(255*t),0,255)}function p(t){return d(c(t/2.55)/100,0,1)}function m(t){return d(c(100*t),0,100)}const x=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/,b=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function v(i,t,a){const n=t*Math.min(a,1-a),e=(t,e=(t+i/30)%12)=>a-n*Math.max(Math.min(e-3,9-e,1),-1);return[e(0),e(8),e(4)]}function _(i,a,n){i=(t,e=(t+i/60)%6)=>n-n*a*Math.max(Math.min(e,4-e,1),0);return[i(5),i(3),i(1)]}function y(t,e,i){const a=v(t,1,.5);let n;for(1<e+i&&(n=1/(e+i),e*=n,i*=n),n=0;n<3;n++)a[n]*=1-e-i,a[n]+=e;return a}function w(t){var e=t.r/255,i=t.g/255,a=t.b/255,n=Math.max(e,i,a),o=Math.min(e,i,a),t=(n+o)/2;let r,s,l;return n!==o&&(l=n-o,s=.5<t?l/(2-n-o):l/(n+o),r=n===e?(i-a)/l+(i<a?6:0):n===i?(a-e)/l+2:(e-i)/l+4,r=60*r+.5),[0|r,s||0,t]}function M(t,e,i,a){return(Array.isArray(e)?t(e[0],e[1],e[2]):t(e,i,a)).map(g)}function k(t,e,i){return M(v,t,e,i)}function S(t){return(t%360+360)%360}const P={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"},D={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 C;function O(e,i,a){if(e){let t=w(e);t[i]=Math.max(0,Math.min(t[i]+t[i]*a,0===i?360:1)),t=k(t),e.r=t[0],e.g=t[1],e.b=t[2]}}function A(t,e){return t&&Object.assign(e||{},t)}function L(t){var e={r:0,g:0,b:0,a:255};return Array.isArray(t)?3<=t.length&&(e={r:t[0],g:t[1],b:t[2],a:255},3<t.length&&(e.a=g(t[3]))):(e=A(t,{r:0,g:0,b:0,a:1})).a=g(e.a),e}function E(t){return("r"===t.charAt(0)?function(t){t=x.exec(t);let e,i,a,n=255;if(t){if(t[7]!==e){const o=+t[7];n=255&(t[8]?u(o):255*o)}return e=+t[1],i=+t[3],a=+t[5],e=255&(t[2]?u(e):e),i=255&(t[4]?u(i):i),a=255&(t[6]?u(a):a),{r:e,g:i,b:a,a:n}}}:function(t){var e=b.exec(t);let i,a=255;if(e){void 0!==e[5]&&(a=(e[6]?u:g)(+e[5]));var n=S(+e[2]),o=+e[3]/100,t=+e[4]/100;return{r:(i="hwb"===e[1]?M(y,n,o,t):"hsv"===e[1]?M(_,n,o,t):k(n,o,t))[0],g:i[1],b:i[2],a:a}}})(t)}class I{constructor(t){if(t instanceof I)return t;var e,i,a=typeof t;let n;"object"==a?n=L(t):"string"==a&&(a=(e=t).length,"#"===e[0]&&(4===a||5===a?i={r:255&17*o[e[1]],g:255&17*o[e[2]],b:255&17*o[e[3]],a:5===a?17*o[e[4]]:255}:7!==a&&9!==a||(i={r:o[e[1]]<<4|o[e[2]],g:o[e[3]]<<4|o[e[4]],b:o[e[5]]<<4|o[e[6]],a:9===a?o[e[7]]<<4|o[e[8]]:255})),n=i||(i=t,C||(C=function(){const t={},e=Object.keys(D),i=Object.keys(P);let a,n,o,r,s;for(a=0;a<e.length;a++){for(r=s=e[a],n=0;n<i.length;n++)o=i[n],s=s.replace(o,P[o]);o=parseInt(D[r],16),t[s]=[o>>16&255,o>>8&255,255&o]}return t}(),C.transparent=[0,0,0,0]),(i=C[i.toLowerCase()])&&{r:i[0],g:i[1],b:i[2],a:4===i.length?i[3]:255})||E(t)),this._rgb=n,this._valid=!!n}get valid(){return this._valid}get rgb(){var t=A(this._rgb);return t&&(t.a=p(t.a)),t}set rgb(t){this._rgb=L(t)}rgbString(){return this._valid?(t=this._rgb)&&(t.a<255?`rgba(${t.r}, ${t.g}, ${t.b}, ${p(t.a)})`:`rgb(${t.r}, ${t.g}, ${t.b})`):this._rgb;var t}hexString(){return this._valid?(t=this._rgb,e=t,e=n(e.r)&&n(e.g)&&n(e.b)&&n(e.a)?i:a,t&&"#"+e(t.r)+e(t.g)+e(t.b)+(t.a<255?e(t.a):"")):this._rgb;var t,e}hslString(){return this._valid?function(t){if(t){var e=w(t),i=e[0],a=m(e[1]),e=m(e[2]);return t.a<255?`hsla(${i}, ${a}%, ${e}%, ${p(t.a)})`:`hsl(${i}, ${a}%, ${e}%)`}}(this._rgb):this._rgb}mix(t,e){if(t){const a=this.rgb,n=t.rgb;var i=void 0===e?.5:e,t=2*i-1,e=a.a-n.a,t=(1+(t*e==-1?t:(t+e)/(1+t*e)))/2,e=1-t;a.r=255&t*a.r+e*n.r+.5,a.g=255&t*a.g+e*n.g+.5,a.b=255&t*a.b+e*n.b+.5,a.a=i*a.a+(1-i)*n.a,this.rgb=a}return this}clone(){return new I(this.rgb)}alpha(t){return this._rgb.a=g(t),this}clearer(t){return this._rgb.a*=1-t,this}greyscale(){const t=this._rgb,e=c(.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 O(this._rgb,2,t),this}darken(t){return O(this._rgb,2,-t),this}saturate(t){return O(this._rgb,1,t),this}desaturate(t){return O(this._rgb,1,-t),this}rotate(t){return e=this._rgb,i=t,(t=w(e))[0]=S(t[0]+i),t=k(t),e.r=t[0],e.g=t[1],e.b=t[2],this;var e,i}}function z(t){return new I(t)}const F=t=>t instanceof CanvasGradient||t instanceof CanvasPattern;function V(t){return F(t)?t:z(t)}function B(t){return F(t)?t:z(t).saturate(.5).darken(.1).hexString()}function t(){}const W=function(){let t=0;return function(){return t++}}();function H(t){return null==t}function N(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 j(t){return null!==t&&"[object Object]"===Object.prototype.toString.call(t)}const $=t=>("number"==typeof t||t instanceof Number)&&isFinite(+t);function Y(t,e){return $(t)?t:e}function U(t,e){return void 0===t?e:t}const X=(t,e)=>"string"==typeof t&&t.endsWith("%")?parseFloat(t)/100:t/e,q=(t,e)=>"string"==typeof t&&t.endsWith("%")?parseFloat(t)/100*e:+t;function K(t,e,i){if(t&&"function"==typeof t.call)return t.apply(i,e)}function G(t,e,i,a){let n,o,r;if(N(t))if(o=t.length,a)for(n=o-1;0<=n;n--)e.call(i,t[n],n);else for(n=0;n<o;n++)e.call(i,t[n],n);else if(j(t))for(r=Object.keys(t),o=r.length,n=0;n<o;n++)e.call(i,t[r[n]],r[n])}function Z(t,e){let i,a,n,o;if(!t||!e||t.length!==e.length)return!1;for(i=0,a=t.length;i<a;++i)if(n=t[i],o=e[i],n.datasetIndex!==o.datasetIndex||n.index!==o.index)return!1;return!0}function Q(e){if(N(e))return e.map(Q);if(j(e)){const i=Object.create(null),a=Object.keys(e),n=a.length;let t=0;for(;t<n;++t)i[a[t]]=Q(e[a[t]]);return i}return e}function J(t){return-1===["__proto__","prototype","constructor"].indexOf(t)}function tt(t,e,i,a){var n;J(t)&&(n=e[t],i=i[t],j(n)&&j(i)?et(n,i,a):e[t]=Q(i))}function et(i,a,n){const e=N(a)?a:[a],o=e.length;if(!j(i))return i;const r=(n=n||{}).merger||tt;for(let t=0;t<o;++t)if(j(a=e[t])){const o=Object.keys(a);for(let t=0,e=o.length;t<e;++t)r(o[t],i,a,n)}return i}function it(t,e){return et(t,e,{merger:at})}function at(t,e,i){var a;J(t)&&(a=e[t],i=i[t],j(a)&&j(i)?it(a,i):Object.prototype.hasOwnProperty.call(e,t)||(e[t]=Q(i)))}function nt(t,e){e=t.indexOf(".",e);return-1===e?t.length:e}function ot(t,e){if(""===e)return t;let i=0,a=nt(e,i);for(;t&&a>i;)t=t[e.substr(i,a-i)],i=a+1,a=nt(e,i);return t}function rt(t){return t.charAt(0).toUpperCase()+t.slice(1)}const st=t=>void 0!==t,lt=t=>"function"==typeof t,ht=(t,e)=>{if(t.size!==e.size)return!1;for(const i of t)if(!e.has(i))return!1;return!0},ct=Object.create(null),dt=Object.create(null);function ut(i,t){if(!t)return i;var a=t.split(".");for(let t=0,e=a.length;t<e;++t){var n=a[t];i=i[n]||(i[n]=Object.create(null))}return i}function gt(t,e,i){return"string"==typeof e?et(ut(t,e),i):et(ut(t,""),e)}var ft=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)=>B(e.backgroundColor),this.hoverBorderColor=(t,e)=>B(e.borderColor),this.hoverColor=(t,e)=>B(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 gt(this,t,e)}get(t){return ut(this,t)}describe(t,e){return gt(dt,t,e)}override(t,e){return gt(ct,t,e)}route(t,e,i,a){const n=ut(this,t),o=ut(this,i),r="_"+e;Object.defineProperties(n,{[r]:{value:n[e],writable:!0},[e]:{enumerable:!0,get(){var t=this[r],e=o[a];return j(t)?Object.assign({},e,t):U(t,e)},set(t){this[r]=t}}})}}({_scriptable:t=>!t.startsWith("on"),_indexable:t=>"events"!==t,hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}});const pt=Math.PI,mt=2*pt,xt=mt+pt,bt=Number.POSITIVE_INFINITY,vt=pt/180,_t=pt/2,yt=pt/4,wt=2*pt/3,Mt=Math.log10,kt=Math.sign;function St(t){var e=Math.pow(10,Math.floor(Mt(t))),t=t/e;return(t<=1?1:t<=2?2:t<=5?5:10)*e}function Pt(t){const e=[],i=Math.sqrt(t);let a;for(a=1;a<i;a++)t%a==0&&(e.push(a),e.push(t/a));return i===(0|i)&&e.push(i),e.sort((t,e)=>t-e).pop(),e}function Dt(t){return!isNaN(parseFloat(t))&&isFinite(t)}function Ct(t,e,i){return Math.abs(t-e)<i}function Ot(t,e){var i=Math.round(t);return i-e<=t&&t<=i+e}function At(t,e,i){let a,n,o;for(a=0,n=t.length;a<n;a++)o=t[a][i],isNaN(o)||(e.min=Math.min(e.min,o),e.max=Math.max(e.max,o))}function Tt(t){return t*(pt/180)}function Rt(t){return t*(180/pt)}function Lt(i){if($(i)){let t=1,e=0;for(;Math.round(i*t)/t!==i;)t*=10,e++;return e}}function Et(t,e){var i=e.x-t.x,e=e.y-t.y,t=Math.sqrt(i*i+e*e);let a=Math.atan2(e,i);return a<-.5*pt&&(a+=mt),{angle:a,distance:t}}function It(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function zt(t,e){return(t-e+xt)%mt-pt}function Ft(t){return(t%mt+mt)%mt}function Vt(t,e,i){var a=Ft(t),n=Ft(e),o=Ft(i),r=Ft(n-a),t=Ft(o-a),e=Ft(a-n),i=Ft(a-o);return a===n||a===o||t<r&&e<i}function Bt(t,e,i){return Math.max(e,Math.min(i,t))}function Wt(t){return Bt(t,-32768,32767)}function Ht(t){return!t||H(t.size)||H(t.family)?null:(t.style?t.style+" ":"")+(t.weight?t.weight+" ":"")+t.size+"px "+t.family}function Nt(t,e,i,a,n){let o=e[n];return o||(o=e[n]=t.measureText(n).width,i.push(n)),a=o>a?o:a}function jt(t,e,i,a){let n=(a=a||{}).data=a.data||{},o=a.garbageCollect=a.garbageCollect||[];a.font!==e&&(n=a.data={},o=a.garbageCollect=[],a.font=e),t.save(),t.font=e;let r=0;var s=i.length;let l,h,c,d,u;for(l=0;l<s;l++)if(null!=(d=i[l])&&!0!==N(d))r=Nt(t,n,o,r,d);else if(N(d))for(h=0,c=d.length;h<c;h++)null==(u=d[h])||N(u)||(r=Nt(t,n,o,r,u));t.restore();var g=o.length/2;if(g>i.length){for(l=0;l<g;l++)delete n[o[l]];o.splice(0,g)}return r}function $t(t,e,i){t=t.currentDevicePixelRatio,i=0!==i?Math.max(i/2,.5):0;return Math.round((e-i)*t)/t+i}function Yt(t,e){(e=e||t.getContext("2d")).save(),e.resetTransform(),e.clearRect(0,0,t.width,t.height),e.restore()}function Ut(t,e,i,a){let n,o,r,s,l;const h=e.pointStyle,c=e.rotation,d=e.radius;let u=(c||0)*vt;if(h&&"object"==typeof h&&("[object HTMLImageElement]"===(n=h.toString())||"[object HTMLCanvasElement]"===n))return t.save(),t.translate(i,a),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,a,d,0,mt),t.closePath();break;case"triangle":t.moveTo(i+Math.sin(u)*d,a-Math.cos(u)*d),u+=wt,t.lineTo(i+Math.sin(u)*d,a-Math.cos(u)*d),u+=wt,t.lineTo(i+Math.sin(u)*d,a-Math.cos(u)*d),t.closePath();break;case"rectRounded":l=.516*d,s=d-l,o=Math.cos(u+yt)*s,r=Math.sin(u+yt)*s,t.arc(i-o,a-r,l,u-pt,u-_t),t.arc(i+r,a-o,l,u-_t,u),t.arc(i+o,a+r,l,u,u+_t),t.arc(i-r,a+o,l,u+_t,u+pt),t.closePath();break;case"rect":if(!c){s=Math.SQRT1_2*d,t.rect(i-s,a-s,2*s,2*s);break}u+=yt;case"rectRot":o=Math.cos(u)*d,r=Math.sin(u)*d,t.moveTo(i-o,a-r),t.lineTo(i+r,a-o),t.lineTo(i+o,a+r),t.lineTo(i-r,a+o),t.closePath();break;case"crossRot":u+=yt;case"cross":o=Math.cos(u)*d,r=Math.sin(u)*d,t.moveTo(i-o,a-r),t.lineTo(i+o,a+r),t.moveTo(i+r,a-o),t.lineTo(i-r,a+o);break;case"star":o=Math.cos(u)*d,r=Math.sin(u)*d,t.moveTo(i-o,a-r),t.lineTo(i+o,a+r),t.moveTo(i+r,a-o),t.lineTo(i-r,a+o),u+=yt,o=Math.cos(u)*d,r=Math.sin(u)*d,t.moveTo(i-o,a-r),t.lineTo(i+o,a+r),t.moveTo(i+r,a-o),t.lineTo(i-r,a+o);break;case"line":o=Math.cos(u)*d,r=Math.sin(u)*d,t.moveTo(i-o,a-r),t.lineTo(i+o,a+r);break;case"dash":t.moveTo(i,a),t.lineTo(i+Math.cos(u)*d,a+Math.sin(u)*d)}t.fill(),0<e.borderWidth&&t.stroke()}}function Xt(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 qt(t,e){t.save(),t.beginPath(),t.rect(e.left,e.top,e.right-e.left,e.bottom-e.top),t.clip()}function Kt(t){t.restore()}function Gt(t,e,i,a,n){if(!e)return t.lineTo(i.x,i.y);if("middle"===n){const a=(e.x+i.x)/2;t.lineTo(a,e.y),t.lineTo(a,i.y)}else"after"===n!=!!a?t.lineTo(e.x,i.y):t.lineTo(i.x,e.y);t.lineTo(i.x,i.y)}function Zt(t,e,i,a){if(!e)return t.lineTo(i.x,i.y);t.bezierCurveTo(a?e.cp1x:e.cp2x,a?e.cp1y:e.cp2y,a?i.cp2x:i.cp1x,a?i.cp2y:i.cp1y,i.x,i.y)}function Qt(t,e,i,a,n,o={}){const r=N(e)?e:[e],s=0<o.strokeWidth&&""!==o.strokeColor;let l,h;for(t.save(),o.translation&&t.translate(o.translation[0],o.translation[1]),H(o.rotation)||t.rotate(o.rotation),t.font=n.string,o.color&&(t.fillStyle=o.color),o.textAlign&&(t.textAlign=o.textAlign),o.textBaseline&&(t.textBaseline=o.textBaseline),l=0;l<r.length;++l){if(h=r[l],s&&(o.strokeColor&&(t.strokeStyle=o.strokeColor),H(o.strokeWidth)||(t.lineWidth=o.strokeWidth),t.strokeText(h,i,a,o.maxWidth)),t.fillText(h,i,a,o.maxWidth),o.strikethrough||o.underline){const e=t.measureText(h),n=i-e.actualBoundingBoxLeft,r=i+e.actualBoundingBoxRight,s=a-e.actualBoundingBoxAscent,l=a+e.actualBoundingBoxDescent,c=o.strikethrough?(s+l)/2:l;t.strokeStyle=t.fillStyle,t.beginPath(),t.lineWidth=o.decorationWidth||2,t.moveTo(n,c),t.lineTo(r,c),t.stroke()}a+=n.lineHeight}t.restore()}function Jt(t,e){var{x:i,y:a,w:n,h:o,radius:e}=e;t.arc(i+e.topLeft,a+e.topLeft,e.topLeft,-_t,pt,!0),t.lineTo(i,a+o-e.bottomLeft),t.arc(i+e.bottomLeft,a+o-e.bottomLeft,e.bottomLeft,pt,_t,!0),t.lineTo(i+n-e.bottomRight,a+o),t.arc(i+n-e.bottomRight,a+o-e.bottomRight,e.bottomRight,_t,0,!0),t.lineTo(i+n,a+e.topRight),t.arc(i+n-e.topRight,a+e.topRight,e.topRight,0,-_t,!0),t.lineTo(i+e.topLeft,a)}function te(e,i,t){t=t||(t=>e[t]<i);let a,n=e.length-1,o=0;for(;1<n-o;)t(a=o+n>>1)?o=a:n=a;return{lo:o,hi:n}}const ee=(e,i,a)=>te(e,a,t=>e[t][i]<a),ie=(e,i,a)=>te(e,a,t=>e[t][i]>=a);function ae(t,e,i){let a=0,n=t.length;for(;a<n&&t[a]<e;)a++;for(;n>a&&t[n-1]>i;)n--;return 0<a||n<t.length?t.slice(a,n):t}const ne=["push","pop","shift","splice","unshift"];function oe(n,t){n._chartjs?n._chartjs.listeners.push(t):(Object.defineProperty(n,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[t]}}),ne.forEach(t=>{const i="_onData"+rt(t),a=n[t];Object.defineProperty(n,t,{configurable:!0,enumerable:!1,value(...e){var t=a.apply(this,e);return n._chartjs.listeners.forEach(t=>{"function"==typeof t[i]&&t[i](...e)}),t}})}))}function re(e,t){var i=e._chartjs;if(i){const a=i.listeners,n=a.indexOf(t);-1!==n&&a.splice(n,1),0<a.length||(ne.forEach(t=>{delete e[t]}),delete e._chartjs)}}function se(t){const e=new Set;let i,a;for(i=0,a=t.length;i<a;++i)e.add(t[i]);if(e.size===a)return t;const n=[];return e.forEach(t=>{n.push(t)}),n}function le(t){let e=t.parentNode;return e&&"[object ShadowRoot]"===e.toString()&&(e=e.host),e}function he(t,e,i){let a;return"string"==typeof t?(a=parseInt(t,10),-1!==t.indexOf("%")&&(a=a/100*e.parentNode[i])):a=t,a}const ce=t=>window.getComputedStyle(t,null);function de(t,e){return ce(t).getPropertyValue(e)}const ue=["top","right","bottom","left"];function ge(e,i,a){const n={};a=a?"-"+a:"";for(let t=0;t<4;t++){var o=ue[t];n[o]=parseFloat(e[i+"-"+o+a])||0}return n.width=n.left+n.right,n.height=n.top+n.bottom,n}function fe(t,e){var{canvas:l,currentDevicePixelRatio:i}=e,a=ce(l),n="border-box"===a.boxSizing,o=ge(a,"padding"),r=ge(a,"border","width"),{x:s,y:h,box:a}=function(t){var e=t.native||t,i=e.touches,a=i&&i.length?i[0]:e,{offsetX:t,offsetY:i}=a;let n,o,r=!1;if(e=e.target,!(0<t||0<i)||e&&e.shadowRoot){const s=l.getBoundingClientRect();n=a.clientX-s.left,o=a.clientY-s.top,r=!0}else n=t,o=i;return{x:n,y:o,box:r}}(t),t=o.left+(a&&r.left),a=o.top+(a&&r.top);let{width:c,height:d}=e;return n&&(c-=o.width+r.width,d-=o.height+r.height),{x:Math.round((s-t)/c*l.width/i),y:Math.round((h-a)/d*l.height/i)}}const pe=t=>Math.round(10*t)/10;function me(t,e,i,a){var n=ce(t),o=ge(n,"margin"),r=he(n.maxWidth,t,"clientWidth")||bt,s=he(n.maxHeight,t,"clientHeight")||bt,i=function(t,e,i){let a,n;if(void 0===e||void 0===i){const o=le(t);if(o){const t=o.getBoundingClientRect(),r=ce(o),s=ge(r,"border","width"),l=ge(r,"padding");e=t.width-l.width-s.width,i=t.height-l.height-s.height,a=he(r.maxWidth,o,"clientWidth"),n=he(r.maxHeight,o,"clientHeight")}else e=t.clientWidth,i=t.clientHeight}return{width:e,height:i,maxWidth:a||bt,maxHeight:n||bt}}(t,e,i);let{width:l,height:h}=i;if("content-box"===n.boxSizing){const t=ge(n,"border","width"),e=ge(n,"padding");l-=e.width+t.width,h-=e.height+t.height}return l=Math.max(0,l-o.width),h=Math.max(0,a?Math.floor(l/a):h-o.height),l=pe(Math.min(l,r,i.maxWidth)),h=pe(Math.min(h,s,i.maxHeight)),l&&!h&&(h=pe(l/2)),{width:l,height:h}}function xe(t,e,i){const a=t.currentDevicePixelRatio=e||1,{canvas:n,width:o,height:r}=t;n.height=r*a,n.width=o*a,t.ctx.setTransform(a,0,0,a,0,0),n.style&&(i||!n.style.height&&!n.style.width)&&(n.style.height=r+"px",n.style.width=o+"px")}var be=function(){let t=!1;try{var e={get passive(){return!(t=!0)}};window.addEventListener("test",null,e),window.removeEventListener("test",null,e)}catch(t){}return t}();function ve(t,e){const i=de(t,e),a=i&&i.match(/^(\d+)(\.\d+)?px$/);return a?+a[1]:void 0}function _e(t,e){return"native"in t?{x:t.x,y:t.y}:fe(t,e)}function ye(t,i,a,n,o){var r=t.getSortedVisibleDatasetMetas(),s=a[i];for(let t=0,e=r.length;t<e;++t){const{index:a,data:l}=r[t],{lo:h,hi:c}=function(t,e,i,a){const{controller:n,data:o,_sorted:r}=t,s=n._cachedMeta.iScale;if(s&&e===s.axis&&r&&o.length){const t=s._reversePixels?ie:ee;if(!a)return t(o,e,i);if(n._sharedOptions){const a=o[0],n="function"==typeof a.getRange&&a.getRange(e);if(n){const a=t(o,e,i-n),r=t(o,e,i+n);return{lo:a.lo,hi:r.hi}}}}return{lo:0,hi:o.length-1}}(r[t],i,s,o);for(let t=h;t<=c;++t){const i=l[t];i.skip||n(i,a,t)}}}function we(t,a,e,n){const o=[];return Xt(a,t.chartArea,t._minPadding)&&ye(t,e,a,function(t,e,i){t.inRange(a.x,a.y,n)&&o.push({element:t,datasetIndex:e,index:i})},!0),o}function Me(t,n,e,o,r){const s=function(t){const a=-1!==t.indexOf("x"),n=-1!==t.indexOf("y");return function(t,e){var i=a?Math.abs(t.x-e.x):0,e=n?Math.abs(t.y-e.y):0;return Math.sqrt(Math.pow(i,2)+Math.pow(e,2))}}(e);let l=Number.POSITIVE_INFINITY,h=[];return Xt(n,t.chartArea,t._minPadding)&&ye(t,e,n,function(t,e,i){var a;o&&!t.inRange(n.x,n.y,r)||(a=t.getCenterPoint(r),(a=s(n,a))<l?(h=[{element:t,datasetIndex:e,index:i}],l=a):a===l&&h.push({element:t,datasetIndex:e,index:i}))}),h}function ke(t,e,i,l){const h=_e(e,t),c=[],d=i.axis,u="x"===d?"inXRange":"inYRange";let g=!1;return function(){var i,a,n,o,r,s=t.getSortedVisibleDatasetMetas();for(let t=0,e=s.length;t<e;++t){({index:i,data:a}=s[t]);for(let t=0,e=a.length;t<e;++t)(r=a[t]).skip||(n=r,o=i,r=t,n[u](h[d],l)&&c.push({element:n,datasetIndex:o,index:r}),n.inRange(h.x,h.y,l)&&(g=!0))}}(),i.intersect&&!g?[]:c}var Se={modes:{index(t,e,i,a){const n=_e(e,t),o=i.axis||"x",r=i.intersect?we(t,n,o,a):Me(t,n,o,!1,a),s=[];return r.length?(t.getSortedVisibleDatasetMetas().forEach(t=>{var e=r[0].index,i=t.data[e];i&&!i.skip&&s.push({element:i,datasetIndex:t.index,index:e})}),s):[]},dataset(t,e,i,a){var n=_e(e,t),e=i.axis||"xy";let o=i.intersect?we(t,n,e,a):Me(t,n,e,!1,a);if(0<o.length){const r=o[0].datasetIndex,i=t.getDatasetMeta(r).data;o=[];for(let t=0;t<i.length;++t)o.push({element:i[t],datasetIndex:r,index:t})}return o},point:(t,e,i,a)=>we(t,_e(e,t),i.axis||"xy",a),nearest:(t,e,i,a)=>Me(t,_e(e,t),i.axis||"xy",i.intersect,a),x:(t,e,i,a)=>(i.axis="x",ke(t,e,i,a)),y:(t,e,i,a)=>(i.axis="y",ke(t,e,i,a))}};const Pe=new RegExp(/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/),De=new RegExp(/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/);function Ce(t,e){var i=(""+t).match(Pe);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 Oe(e,i){const t={},a=j(i),n=a?Object.keys(i):i,o=j(e)?a?t=>U(e[t],e[i[t]]):t=>e[t]:()=>e;for(const e of n)t[e]=+o(e)||0;return t}function Ae(t){return Oe(t,{top:"y",right:"x",bottom:"y",left:"x"})}function Te(t){return Oe(t,["topLeft","topRight","bottomLeft","bottomRight"])}function Re(t){const e=Ae(t);return e.width=e.left+e.right,e.height=e.top+e.bottom,e}function Le(t,e){e=e||ft.font;let i=U((t=t||{}).size,e.size);"string"==typeof i&&(i=parseInt(i,10));let a=U(t.style,e.style);a&&!(""+a).match(De)&&(console.warn('Invalid font style specified: "'+a+'"'),a="");const n={family:U(t.family,e.family),lineHeight:Ce(U(t.lineHeight,e.lineHeight),i),size:i,style:a,weight:U(t.weight,e.weight),string:""};return n.string=Ht(n),n}function Ee(t,e,i,a){let n,o,r,s=!0;for(n=0,o=t.length;n<o;++n)if(r=t[n],void 0!==r&&(void 0!==e&&"function"==typeof r&&(r=r(e),s=!1),void 0!==i&&N(r)&&(r=r[i%r.length],s=!1),void 0!==r))return a&&!s&&(a.cacheable=!1),r}function Ie(t,e){var{min:i,max:t}=t;return{min:i-Math.abs(q(e,i)),max:t+q(e,t)}}const ze=["left","top","right","bottom"];function Fe(t,e){return t.filter(t=>t.pos===e)}function Ve(t,e){return t.filter(t=>-1===ze.indexOf(t.pos)&&t.box.axis===e)}function Be(t,a){return t.sort((t,e)=>{var i=a?e:t,e=a?t:e;return i.weight===e.weight?i.index-e.index:i.weight-e.weight})}function We(t,e,i,a){return Math.max(t[i],e[i])+Math.max(t[a],e[a])}function He(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 Ne(t,i){const a=i.maxPadding;return function(t){const e={left:0,top:0,right:0,bottom:0};return t.forEach(t=>{e[t]=Math.max(i[t],a[t])}),e}(t?["left","right"]:["top","bottom"])}function je(t,e,i){const a=[];let n,o,r,s,l,h;for(n=0,o=t.length,l=0;n<o;++n){r=t[n],s=r.box,s.update(r.width||e.w,r.height||e.h,Ne(r.horizontal,e));const{same:o,other:c}=function(t,e,i){const a=i.box,n=t.maxPadding;j(i.pos)||(i.size&&(t[i.pos]-=i.size),i.size=i.horizontal?a.height:a.width,t[i.pos]+=i.size),a.getPadding&&He(n,a.getPadding());var o=Math.max(0,e.outerWidth-We(n,t,"left","right")),r=Math.max(0,e.outerHeight-We(n,t,"top","bottom")),s=o!==t.w,e=r!==t.h;return t.w=o,t.h=r,i.horizontal?{same:s,other:e}:{same:e,other:s}}(e,i,r);l|=o&&a.length,h=h||c,s.fullSize||a.push(r)}return l&&je(a,e,i)||h}function $e(t,e,i){var a=i.padding;let n,o,r,s,l=e.x,h=e.y;for(n=0,o=t.length;n<o;++n)r=t[n],s=r.box,r.horizontal?(s.left=(s.fullSize?a:e).left,s.right=s.fullSize?i.outerWidth-a.right:e.left+e.w,s.top=h,s.bottom=h+s.height,s.width=s.right-s.left,h=s.bottom):(s.left=l,s.right=l+s.width,s.top=(s.fullSize?a:e).top,s.bottom=s.fullSize?i.outerHeight-a.right:e.top+e.h,s.height=s.bottom-s.top,l=s.right);e.x=l,e.y=h}ft.set("layout",{padding:{top:0,right:0,bottom:0,left:0}});var Ye={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){e=t.boxes?t.boxes.indexOf(e):-1;-1!==e&&t.boxes.splice(e,1)},configure(t,e,i){e.fullSize=i.fullSize,e.position=i.position,e.weight=i.weight},update(l,t,e,i){if(l){const n=Re(l.options.layout.padding),o=t-n.width,r=e-n.height,s=function(){const t=function(t){const e=[];let i,a,n;for(i=0,a=(t||[]).length;i<a;++i)n=t[i],e.push({index:i,box:n,pos:n.position,horizontal:n.isHorizontal(),weight:n.weight});return e}(l.boxes),e=Be(t.filter(t=>t.box.fullSize),!0),i=Be(Fe(t,"left"),!0),a=Be(Fe(t,"right")),n=Be(Fe(t,"top"),!0),o=Be(Fe(t,"bottom")),r=Ve(t,"x"),s=Ve(t,"y");return{fullSize:e,leftAndTop:i.concat(n),rightAndBottom:a.concat(s).concat(o).concat(r),chartArea:Fe(t,"chartArea"),vertical:i.concat(a).concat(s),horizontal:n.concat(o).concat(r)}}(),h=s.vertical,c=s.horizontal;G(l.boxes,t=>{"function"==typeof t.beforeLayout&&t.beforeLayout()});var a=h.reduce((t,e)=>e.box.options&&!1===e.box.options.display?t:t+1,0)||1,e=Object.freeze({outerWidth:t,outerHeight:e,padding:n,availableWidth:o,availableHeight:r,vBoxMaxWidth:o/2/a,hBoxMaxHeight:r/2}),a=Object.assign({},n);He(a,Re(i));const d=Object.assign({maxPadding:a,w:o,h:r,x:n.left,y:n.top},n);!function(t,e){let i,a,n;for(i=0,a=t.length;i<a;++i)n=t[i],n.horizontal?(n.width=n.box.fullSize&&e.availableWidth,n.height=e.hBoxMaxHeight):(n.width=e.vBoxMaxWidth,n.height=n.box.fullSize&&e.availableHeight)}(h.concat(c),e),je(s.fullSize,d,e),je(h,d,e),je(c,d,e)&&je(h,d,e),function(i){const a=i.maxPadding;function t(t){var e=Math.max(a[t]-i[t],0);return i[t]+=e,e}i.y+=t("top"),i.x+=t("left"),t("right"),t("bottom")}(d),$e(s.leftAndTop,d,e),d.x+=d.w,d.y+=d.h,$e(s.rightAndBottom,d,e),l.chartArea={left:d.left,top:d.top,right:d.left+d.w,bottom:d.top+d.h,height:d.h,width:d.w},G(s.chartArea,t=>{const e=t.box;Object.assign(e,l.chartArea),e.update(d.w,d.h)})}}};class Ue{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,i){}removeEventListener(t,e,i){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,i,a){return e=Math.max(0,e||t.width),i=i||t.height,{width:e,height:Math.max(0,a?Math.floor(e/a):i)}}isAttached(t){return!0}}class Xe extends Ue{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"},Ke=t=>null===t||""===t,Ge=!!be&&{passive:!0};function Ze(t,e,n){const i=t.canvas,o=i&&le(i)||i,a=new MutationObserver(t=>{const a=le(o);t.forEach(e=>{for(let t=0;t<e.addedNodes.length;t++){var i=e.addedNodes[t];i!==o&&i!==a||n(e.target)}})});return a.observe(document,{childList:!0,subtree:!0}),a}function Qe(t,e,i){const a=t.canvas,n=a&&le(a);if(n){const o=new MutationObserver(t=>{t.forEach(e=>{for(let t=0;t<e.removedNodes.length;t++)if(e.removedNodes[t]===a){i();break}})});return o.observe(n,{childList:!0}),o}}const Je=new Map;let ti=0;function ei(){const i=window.devicePixelRatio;i!==ti&&(ti=i,Je.forEach((t,e)=>{e.currentDevicePixelRatio!==i&&t()}))}function ii(t,e,a){const i=t.canvas,n=i&&le(i);if(n){const r=l((t,e)=>{var i=n.clientWidth;a(t,e),i<n.clientWidth&&a()},window),s=new ResizeObserver(t=>{var e=t[0],t=e.contentRect.width,e=e.contentRect.height;0===t&&0===e||r(t,e)});return s.observe(n),o=t,t=r,Je.size||window.addEventListener("resize",ei),Je.set(o,t),s;var o}}function ai(t,e,i){i&&i.disconnect(),"resize"===e&&(t=t,Je.delete(t),Je.size||window.removeEventListener("resize",ei))}function ni(e,t,i){var a=e.canvas,n=l(t=>{null!==e.ctx&&i(function(t,e){var i=qe[t.type]||t.type,{x:a,y:n}=fe(t,e);return{type:i,chart:e,native:t,x:void 0!==a?a:null,y:void 0!==n?n:null}}(t,e))},e,t=>{t=t[0];return[t,t.offsetX,t.offsetY]});return a.addEventListener(t,n,Ge),n}class oi extends Ue{acquireContext(t,e){var i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(function(t,e){const i=t.style,a=t.getAttribute("height"),n=t.getAttribute("width");if(t.$chartjs={initial:{height:a,width:n,style:{display:i.display,height:i.height,width:i.width}}},i.display=i.display||"block",i.boxSizing=i.boxSizing||"border-box",Ke(n)){const e=ve(t,"width");void 0!==e&&(t.width=e)}if(Ke(a))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 i=t.canvas;if(!i.$chartjs)return!1;const a=i.$chartjs.initial;["height","width"].forEach(t=>{var e=a[t];H(e)?i.removeAttribute(t):i.setAttribute(t,e)});const e=a.style||{};return Object.keys(e).forEach(t=>{i.style[t]=e[t]}),i.width=i.width,delete i.$chartjs,!0}addEventListener(t,e,i){this.removeEventListener(t,e);const a=t.$proxies||(t.$proxies={}),n={attach:Ze,detach:Qe,resize:ii}[e]||ni;a[e]=n(t,e,i)}removeEventListener(t,e){const i=t.$proxies||(t.$proxies={}),a=i[e];a&&(({attach:ai,detach:ai,resize:ai}[e]||function(t,e,i){t.canvas.removeEventListener(e,i,Ge)})(t,e,a),i[e]=void 0)}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,i,a){return me(t,e,i,a)}isAttached(t){t=le(t);return!(!t||!le(t))}}var ri=Object.freeze({__proto__:null,BasePlatform:Ue,BasicPlatform:Xe,DomPlatform:oi});const si=t=>0===t||1===t,li=(t,e,i)=>-Math.pow(2,10*--t)*Math.sin((t-e)*mt/i),hi=(t,e,i)=>Math.pow(2,-10*t)*Math.sin((t-e)*mt/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*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*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*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*_t),easeOutSine:t=>Math.sin(t*_t),easeInOutSine:t=>-.5*(Math.cos(pt*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=>1<=t?t:-(Math.sqrt(1-t*t)-1),easeOutCirc:t=>Math.sqrt(1- --t*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:li(t,.075,.3),easeOutElastic:t=>si(t)?t:hi(t,.075,.3),easeInOutElastic(t){return si(t)?t:t<.5?.5*li(2*t,.1125,.45):.5+.5*hi(2*t-1,.1125,.45)},easeInBack(t){return t*t*(2.70158*t-1.70158)},easeOutBack(t){return--t*t*(2.70158*t+1.70158)+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){var 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},di="transparent",ui={boolean:(t,e,i)=>.5<i?e:t,color(t,e,i){const a=V(t||di),n=a.valid&&V(e||di);return n&&n.valid?n.mix(a,i).hexString():e},number:(t,e,i)=>t+(e-t)*i};class gi{constructor(t,e,i,a){var n=e[i];a=Ee([t.to,a,n,t.from]);n=Ee([t.from,n,a]);this._active=!0,this._fn=t.fn||ui[t.type||typeof n],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=n,this._to=a,this._promises=void 0}active(){return this._active}update(t,e,i){var a,n,o,r=this;r._active&&(r._notify(!1),a=r._target[r._prop],n=i-r._start,o=r._duration-n,r._start=i,r._duration=Math.floor(Math.max(o,t.duration)),r._total+=n,r._loop=!!t.loop,r._to=Ee([t.to,e,a,t.from]),r._from=Ee([t.from,a,e]))}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){var e=this,i=t-e._start,a=e._duration,n=e._prop,o=e._from,r=e._loop,t=e._to;let s;if(e._active=o!==t&&(r||i<a),!e._active)return e._target[n]=t,void e._notify(!0);i<0?e._target[n]=o:(s=i/a%2,s=r&&1<s?2-s:s,s=e._easing(Math.min(1,Math.max(0,s))),e._target[n]=e._fn(o,t,s))}wait(){const i=this._promises||(this._promises=[]);return new Promise((t,e)=>{i.push({res:t,rej:e})})}_notify(t){const e=t?"res":"rej",i=this._promises||[];for(let t=0;t<i.length;t++)i[t][e]()}}ft.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 fi=Object.keys(ft.animation);ft.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>"onProgress"!==t&&"onComplete"!==t&&"fn"!==t}),ft.set("animations",{colors:{type:"color",properties:["color","borderColor","backgroundColor"]},numbers:{type:"number",properties:["x","y","borderWidth","radius","tension"]}}),ft.describe("animations",{_fallback:"animation"}),ft.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 pi{constructor(t,e){this._chart=t,this._properties=new Map,this.configure(e)}configure(a){if(j(a)){const n=this._properties;Object.getOwnPropertyNames(a).forEach(e=>{const t=a[e];if(j(t)){const i={};for(const a of fi)i[a]=t[a];(N(t.properties)&&t.properties||[e]).forEach(t=>{t!==e&&n.has(t)||n.set(t,i)})}})}}_animateOptions(t,e){const i=e.options,a=function(e,i){if(i){let t=e.options;if(t)return t.$shared&&(e.options=t=Object.assign({},t,{$shared:!1,$animations:{}})),t;e.options=i}}(t,i);if(!a)return[];e=this._createAnimations(a,i);return i.$shared&&function(e,t){const i=[],a=Object.keys(t);for(let t=0;t<a.length;t++){const n=e[a[t]];n&&n.active()&&i.push(n.wait())}return Promise.all(i)}(t.options.$animations,i).then(()=>{t.options=i},()=>{}),e}_createAnimations(e,i){const a=this._properties,n=[],o=e.$animations||(e.$animations={}),t=Object.keys(i),r=Date.now();let s;for(s=t.length-1;0<=s;--s){const c=t[s];if("$"!==c.charAt(0))if("options"!==c){var l=i[c];let t=o[c];var h=a.get(c);if(t){if(h&&t.active()){t.update(h,l,r);continue}t.cancel()}h&&h.duration?(o[c]=t=new gi(h,e,c,l),n.push(t)):e[c]=l}else n.push(...this._animateOptions(e,i))}return n}update(t,e){if(0!==this._properties.size){var i=this._createAnimations(t,e);return i.length?(h.add(this._chart,i),!0):void 0}Object.assign(t,e)}}function mi(t,e){var i=t&&t.options||{},a=i.reverse,t=void 0===i.min?e:0,e=void 0===i.max?e:0;return{start:a?e:t,end:a?t:e}}function xi(t,e){const i=[],a=t._getSortedDatasetMetas(e);let n,o;for(n=0,o=a.length;n<o;++n)i.push(a[n].index);return i}function bi(t,e,i,a){var n=t.keys,o="single"===a.mode;let r,s,l,h;if(null!==e){for(r=0,s=n.length;r<s;++r){if((l=+n[r])===i){if(a.all)continue;break}h=t.values[l],$(h)&&(o||0===e||kt(e)===kt(h))&&(e+=h)}return e}}function vi(t,e){t=t&&t.options.stacked;return t||void 0===t&&void 0!==e.stack}function _i(t,e,i){for(const a of e.getMatchingVisibleMetas("bar").reverse()){const e=t[a.index];if(i&&0<e||!i&&e<0)return a.index}return null}function yi(t,e){const{chart:i,_cachedMeta:a}=t,n=i._stacks||(i._stacks={}),{iScale:o,vScale:r,index:s}=a,l=o.axis,h=r.axis,c=(u=o,g=r,t=a,`${u.id}.${g.id}.${t.stack||t.type}`),d=e.length;var u,g;let f;for(let t=0;t<d;++t){const i=e[t],{[l]:a,[h]:o}=i;f=(i._stacks||(i._stacks={}))[h]=function(t,e,i){const a=t[e]||(t[e]={});return a[i]||(a[i]={})}(n,c,a),f[s]=o,f._top=_i(f,r,!0),f._bottom=_i(f,r,!1)}}function wi(t,e){const i=t.scales;return Object.keys(i).filter(t=>i[t].axis===e).shift()}function Mi(t,e){for(const i of e=e||t._parsed){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 ki=t=>"reset"===t||"none"===t,Si=(t,e)=>e?t:Object.assign({},t);class Pi{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._cachedMeta;this.configure(),this.linkScales(),t._stacked=vi(t.vScale,t),this.addElements()}updateIndex(t){this.index=t}linkScales(){const t=this,e=t.chart,i=t._cachedMeta,a=t.getDataset(),n=(t,e,i,a)=>"x"===t?e:"r"===t?a:i,o=i.xAxisID=U(a.xAxisID,wi(e,"x")),r=i.yAxisID=U(a.yAxisID,wi(e,"y")),s=i.rAxisID=U(a.rAxisID,wi(e,"r")),l=i.indexAxis,h=i.iAxisID=n(l,o,r,s),c=i.vAxisID=n(l,r,o,s);i.xScale=t.getScaleForId(o),i.yScale=t.getScaleForId(r),i.rScale=t.getScaleForId(s),i.iScale=t.getScaleForId(h),i.vScale=t.getScaleForId(c)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){var e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){var t=this._cachedMeta;this._data&&re(this._data,this),t._stacked&&Mi(t)}_dataCheck(){const t=this,e=t.getDataset(),i=e.data||(e.data=[]);j(i)?t._data=function(t){const e=Object.keys(t),i=new Array(e.length);let a,n,o;for(a=0,n=e.length;a<n;++a)o=e[a],i[a]={x:o,y:t[o]};return i}(i):t._data!==i&&(t._data&&(re(t._data,t),Mi(t._cachedMeta)),i&&Object.isExtensible(i)&&oe(i,t),t._data=i)}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const e=this,i=e._cachedMeta,a=e.getDataset();let n=!1;e._dataCheck(),i._stacked=vi(i.vScale,i),i.stack!==a.stack&&(n=!0,Mi(i),i.stack=a.stack),e._resyncElements(t),n&&yi(e,i._parsed)}configure(){const t=this,e=t.chart.config,i=e.datasetScopeKeys(t._type),a=e.getOptionScopes(t.getDataset(),i,!0);t.options=e.createResolver(a,t.getContext()),t._parsing=t.options.parsing}parse(t,e){const i=this,{_cachedMeta:a,_data:n}=i,{iScale:o,_stacked:r}=a,s=o.axis;let l,h,c,d=0===t&&e===n.length||a._sorted,u=0<t&&a._parsed[t-1];if(!1===i._parsing)a._parsed=n,a._sorted=!0,c=n;else{c=N(n[t])?i.parseArrayData(a,n,t,e):j(n[t])?i.parseObjectData(a,n,t,e):i.parsePrimitiveData(a,n,t,e);const o=()=>null===h[s]||u&&h[s]<u[s];for(l=0;l<e;++l)a._parsed[l+t]=h=c[l],d&&(o()&&(d=!1),u=h);a._sorted=d}r&&yi(i,c)}parsePrimitiveData(t,e,i,a){const{iScale:n,vScale:o}=t,r=n.axis,s=o.axis,l=n.getLabels(),h=n===o,c=new Array(a);let d,u,g;for(d=0,u=a;d<u;++d)g=d+i,c[d]={[r]:h||n.parse(l[g],g),[s]:o.parse(e[g],g)};return c}parseArrayData(t,e,i,a){const{xScale:n,yScale:o}=t,r=new Array(a);let s,l,h,c;for(s=0,l=a;s<l;++s)c=e[h=s+i],r[s]={x:n.parse(c[0],h),y:o.parse(c[1],h)};return r}parseObjectData(t,e,i,a){const{xScale:n,yScale:o}=t,{xAxisKey:r="x",yAxisKey:s="y"}=this._parsing,l=new Array(a);let h,c,d,u;for(h=0,c=a;h<c;++h)u=e[d=h+i],l[h]={x:n.parse(ot(u,r),d),y:o.parse(ot(u,s),d)};return l}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,e,i){var a=this.chart,n=this._cachedMeta,o=e[t.axis];return bi({keys:xi(a,!0),values:e._stacks[t.axis]},o,n.index,{mode:i})}updateRangeFromParsed(t,e,i,a){var n=i[e.axis];let o=null===n?NaN:n;e=a&&i._stacks[e.axis];a&&e&&(a.values=e,t.min=Math.min(t.min,o),t.max=Math.max(t.max,o),o=bi(a,n,this._cachedMeta.index,{all:!0})),t.min=Math.min(t.min,o),t.max=Math.max(t.max,o)}getMinMax(t,e){const i=this,a=i._cachedMeta,n=a._parsed,o=a._sorted&&t===a.iScale,r=n.length,s=i._getOtherScale(t),l=e&&a._stacked&&{keys:xi(i.chart,!0),values:null},h={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:c,max:d}=function(){var{min:t,max:e,minDefined:i,maxDefined:a}=s.getUserBounds();return{min:i?t:Number.NEGATIVE_INFINITY,max:a?e:Number.POSITIVE_INFINITY}}();let u,g,f,p;function m(){return f=n[u],g=f[t.axis],p=f[s.axis],!$(g)||c>p||d<p}for(u=0;u<r&&(m()||(i.updateRangeFromParsed(h,t,f,l),!o));++u);if(o)for(u=r-1;0<=u;--u)if(!m()){i.updateRangeFromParsed(h,t,f,l);break}return h}getAllParsedValues(t){const e=this._cachedMeta._parsed,i=[];let a,n,o;for(a=0,n=e.length;a<n;++a)o=e[a][t.axis],$(o)&&i.push(o);return i}getMaxOverflow(){return!1}getLabelAndValue(t){const e=this._cachedMeta,i=e.iScale,a=e.vScale,n=this.getParsed(t);return{label:i?""+i.getLabelForValue(n[i.axis]):"",value:a?""+a.getLabelForValue(n[a.axis]):""}}_update(t){const e=this,i=e._cachedMeta;e.configure(),e._cachedDataOpts={},e.update(t||"default"),i._clip=function(t){let e,i,a,n;return j(t)?(e=t.top,i=t.right,a=t.bottom,n=t.left):e=i=a=n=t,{top:e,right:i,bottom:a,left:n}}(U(e.options.clip,function(t,e,i){if(!1===i)return!1;t=mi(t,i),i=mi(e,i);return{top:i.end,right:t.end,bottom:i.start,left:t.start}}(i.xScale,i.yScale,e.getMaxOverflow())))}update(t){}draw(){const t=this,e=t._ctx,i=t.chart,a=t._cachedMeta,n=a.data||[],o=i.chartArea,r=[],s=t._drawStart||0,l=t._drawCount||n.length-s;let h;for(a.dataset&&a.dataset.draw(e,o,s,l),h=s;h<s+l;++h){const t=n[h];t.active?r.push(t):t.draw(e,o)}for(h=0;h<r.length;++h)r[h].draw(e,o)}getStyle(t,e){e=e?"active":"default";return void 0===t&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(e):this.resolveDataElementOptions(t||0,e)}getContext(t,e,i){var a,n,o,r=this,s=r.getDataset();let l;if(0<=t&&t<r._cachedMeta.data.length){const e=r._cachedMeta.data[t];l=e.$context||(e.$context=(a=r.getContext(),n=t,o=e,Object.assign(Object.create(a),{active:!1,dataIndex:n,parsed:void 0,raw:void 0,element:o,index:n,mode:"default",type:"data"}))),l.parsed=r.getParsed(t),l.raw=s.data[t]}else l=r.$context||(r.$context=(t=r.chart.getContext(),r=r.index,Object.assign(Object.create(t),{active:!1,dataset:void 0,datasetIndex:r,index:r,mode:"default",type:"dataset"}))),l.dataset=s;return l.active=!!e,l.mode=i,l}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 a=this,n="active"===e,o=a._cachedDataOpts,r=t+"-"+e,s=o[r],l=a.enableOptionSharing&&st(i);if(s)return Si(s,l);const h=a.chart.config,c=h.datasetElementScopeKeys(a._type,t),d=n?[t+"Hover","hover",t,""]:[t,""],u=h.getOptionScopes(a.getDataset(),c),g=Object.keys(ft.elements[t]),f=h.resolveNamedOptions(u,g,()=>a.getContext(i,n),d);return f.$shared&&(f.$shared=l,o[r]=Object.freeze(Si(f,l))),f}_resolveAnimations(t,e,i){const a=this,n=a.chart,o=a._cachedDataOpts,r="animation-"+e,s=o[r];if(s)return s;let l;if(!1!==n.options.animation){const n=a.chart.config,o=n.datasetAnimationScopeKeys(a._type,e),r=n.getOptionScopes(a.getDataset(),o);l=n.createResolver(r,a.getContext(t,i,e))}e=new pi(n,l&&l.animations);return l&&l._cacheable&&(o[r]=Object.freeze(e)),e}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||ki(t)||this.chart._animationsDisabled}updateElement(t,e,i,a){ki(a)?Object.assign(t,i):this._resolveAnimations(e,a).update(t,i)}updateSharedOptions(t,e,i){t&&!ki(e)&&this._resolveAnimations(void 0,e).update(t,i)}_setStyle(t,e,i,a){t.active=a;var n=this.getStyle(e,a);this._resolveAnimations(e,i,a).update(t,{options:!a&&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(){var t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){var t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){var e=this,i=e._cachedMeta.data.length,a=e._data.length;i<a?e._insertElements(i,a-i,t):a<i&&e._removeElements(a,i-a);i=Math.min(a,i);i&&e.parse(0,i)}_insertElements(t,e,i=!0){const a=this,n=a._cachedMeta,o=n.data,r=t+e;let s;var l=t=>{for(t.length+=e,s=t.length-1;s>=r;s--)t[s]=t[s-e]};for(l(o),s=t;s<r;++s)o[s]=new a.dataElementType;a._parsing&&l(n._parsed),a.parse(t,e),i&&a.updateElements(o,t,e,"reset")}updateElements(t,e,i,a){}_removeElements(t,e){const i=this._cachedMeta;var a;this._parsing&&(a=i._parsed.splice(t,e),i._stacked&&Mi(i,a)),i.data.splice(t,e)}_onDataPush(){var 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)}}Pi.defaults={},Pi.prototype.datasetElementType=null,Pi.prototype.dataElementType=null;class Di{constructor(){this.x=void 0,this.y=void 0,this.active=!1,this.options=void 0,this.$animations=void 0}tooltipPosition(t){var{x:e,y:t}=this.getProps(["x","y"],t);return{x:e,y:t}}hasValue(){return Dt(this.x)&&Dt(this.y)}getProps(t,e){const i=this,a=this.$animations;if(!e||!a)return i;const n={};return t.forEach(t=>{n[t]=a[t]&&a[t].active()?a[t]._to:i[t]}),n}}Di.defaults={},Di.defaultRoutes=void 0;const Ci=new Map;function Oi(t,e,i){return function(t,e){e=e||{};var i=t+JSON.stringify(e);let a=Ci.get(i);return a||(a=new Intl.NumberFormat(t,e),Ci.set(i,a)),a}(e,i).format(t)}const Ai={values:t=>N(t)?t:""+t,numeric(t,e,i){if(0===t)return"0";var a=this.chart.options.locale;let n,o=t;if(1<i.length){const e=Math.max(Math.abs(i[0].value),Math.abs(i[i.length-1].value));(e<1e-4||1e15<e)&&(n="scientific"),o=function(t){let e=3<i.length?i[2].value-i[1].value:i[1].value-i[0].value;return 1<Math.abs(e)&&t!==Math.floor(t)&&(e=t-Math.floor(t)),e}(t)}var r=Mt(Math.abs(o)),r=Math.max(Math.min(-1*Math.floor(r),20),0),r={notation:n,minimumFractionDigits:r,maximumFractionDigits:r};return Object.assign(r,this.options.ticks.format),Oi(t,a,r)},logarithmic(t,e,i){if(0===t)return"0";var a=t/Math.pow(10,Math.floor(Mt(t)));return 1==a||2==a||5==a?Ai.numeric.call(this,t,e,i):""}};var Ti={formatters:Ai};function Ri(t,i){const e=t.options.ticks,a=e.maxTicksLimit||(c=(h=t).options.offset,t=h._tickSize(),c=h._length/t+(c?0:1),t=h._maxLength/t,Math.floor(Math.min(c,t))),n=e.major.enabled?function(t){const e=[];let i,a;for(i=0,a=t.length;i<a;i++)t[i].major&&e.push(i);return e}(i):[],o=n.length,r=n[0],s=n[o-1],l=[];var h,c;if(o>a)return function(t,e,i,a){let n,o=0,r=i[0];for(a=Math.ceil(a),n=0;n<t.length;n++)n===r&&(e.push(t[n]),o++,r=i[o*a])}(i,l,n,o/a),l;var d=function(t,i,e){var t=function(t){var e=t.length;let i,a;if(e<2)return!1;for(a=t[0],i=1;i<e;++i)if(t[i]-t[i-1]!==a)return!1;return a}(t),a=i.length/e;if(!t)return Math.max(a,1);var n=Pt(t);for(let t=0,e=n.length-1;t<e;t++){const i=n[t];if(i>a)return i}return Math.max(a,1)}(n,i,a);if(0<o){let t,e;const a=1<o?Math.round((s-r)/(o-1)):null;for(Li(i,l,d,H(a)?0:r-a,r),t=0,e=o-1;t<e;t++)Li(i,l,d,n[t],n[t+1]);return Li(i,l,d,s,H(a)?i.length:s+a),l}return Li(i,l,d),l}function Li(t,e,i,a,n){var o=U(a,0),r=Math.min(U(n,t.length),t.length);let s,l,h,c=0;for(i=Math.ceil(i),n&&(i=(s=n-a)/Math.floor(s/i)),h=o;h<0;)c++,h=Math.round(o+c*i);for(l=Math.max(o,0);l<r;l++)l===h&&(e.push(t[l]),c++,h=Math.round(o+c*i))}ft.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:Ti.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),ft.route("scale.ticks","color","","color"),ft.route("scale.grid","color","","borderColor"),ft.route("scale.grid","borderColor","","borderColor"),ft.route("scale.title","color","","color"),ft.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&"callback"!==t&&"parser"!==t,_indexable:t=>"borderDash"!==t&&"tickBorderDash"!==t}),ft.describe("scales",{_fallback:"scale"});const Ei=(t,e,i)=>"top"===e||"left"===e?t[e]+i:t[e]-i;function Ii(t,e){const i=[],a=t.length/e,n=t.length;let o=0;for(;o<n;o+=a)i.push(t[Math.floor(o)]);return i}function zi(t){return t.drawTicks?t.tickLength:0}function Fi(t,e){if(!t.display)return 0;var i=Le(t.font,e),e=Re(t.padding);return(N(t.text)?t.text.length:1)*i.lineHeight+e.height}class Vi extends Di{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){var 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(){var{_userMin:t,_userMax:e,_suggestedMin:i,_suggestedMax:a}=this,t=Y(t,Number.POSITIVE_INFINITY),e=Y(e,Number.NEGATIVE_INFINITY),i=Y(i,Number.POSITIVE_INFINITY),a=Y(a,Number.NEGATIVE_INFINITY);return{min:Y(t,i),max:Y(e,a),minDefined:$(t),maxDefined:$(e)}}getMinMax(i){let a,{min:n,max:o,minDefined:r,maxDefined:s}=this.getUserBounds();if(r&&s)return{min:n,max:o};const l=this.getMatchingVisibleMetas();for(let t=0,e=l.length;t<e;++t)a=l[t].controller.getMinMax(this,i),r||(n=Math.min(n,a.min)),s||(o=Math.max(o,a.max));return{min:Y(n,Y(o,n)),max:Y(o,Y(n,o))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){var t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){K(this.options.beforeUpdate,[this])}update(t,e,i){var a=this,n=a.options.ticks,o=n.sampleSize;a.beforeUpdate(),a.maxWidth=t,a.maxHeight=e,a._margins=i=Object.assign({left:0,right:0,top:0,bottom:0},i),a.ticks=null,a._labelSizes=null,a._gridLineItems=null,a._labelItems=null,a.beforeSetDimensions(),a.setDimensions(),a.afterSetDimensions(),a._maxLength=a.isHorizontal()?a.width+i.left+i.right:a.height+i.top+i.bottom,a._dataLimitsCached||(a.beforeDataLimits(),a.determineDataLimits(),a.afterDataLimits(),a._range=Ie(a,a.options.grace),a._dataLimitsCached=!0),a.beforeBuildTicks(),a.ticks=a.buildTicks()||[],a.afterBuildTicks();i=o<a.ticks.length;a._convertTicksToLabels(i?Ii(a.ticks,o):a.ticks),a.configure(),a.beforeCalculateLabelRotation(),a.calculateLabelRotation(),a.afterCalculateLabelRotation(),n.display&&(n.autoSkip||"auto"===n.source)&&(a.ticks=Ri(a,a.ticks),a._labelSizes=null),i&&a._convertTicksToLabels(a.ticks),a.beforeFit(),a.fit(),a.afterFit(),a.afterUpdate()}configure(){var t=this;let e,i,a=t.options.reverse;t.isHorizontal()?(e=t.left,i=t.right):(e=t.top,i=t.bottom,a=!a),t._startPixel=e,t._endPixel=i,t._reversePixels=a,t._length=i-e,t._alignToPixels=t.options.alignToPixels}afterUpdate(){K(this.options.afterUpdate,[this])}beforeSetDimensions(){K(this.options.beforeSetDimensions,[this])}setDimensions(){var 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(){K(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),K(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){K(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(t){var e=this.options.ticks;let i,a,n;for(i=0,a=t.length;i<a;i++)n=t[i],n.label=K(e.callback,[n.value,i,t],this);for(i=0;i<a;i++)H(t[i].label)&&(t.splice(i,1),a--,i--)}afterTickToLabelConversion(){K(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){K(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){var t,e,i,a,n=this,o=n.options,r=o.ticks,s=n.ticks.length,l=r.minRotation||0,h=r.maxRotation;let c,d,u,g=l;!n._isVisible()||!r.display||h<=l||s<=1||!n.isHorizontal()?n.labelRotation=l:(e=(t=n._getLabelSizes()).widest.width,i=t.highest.height,a=Bt(n.chart.width-e,0,n.maxWidth),(o.offset?n.maxWidth/s:a/(s-1))<e+6&&(c=a/(s-(o.offset?.5:1)),d=n.maxHeight-zi(o.grid)-r.padding-Fi(o.title,n.chart.options.font),u=Math.sqrt(e*e+i*i),g=Rt(Math.min(Math.asin(Math.min((t.highest.height+6)/c,1)),Math.asin(Math.min(d/u,1))-Math.asin(i/u))),g=Math.max(l,Math.min(h,g))),n.labelRotation=g)}afterCalculateLabelRotation(){K(this.options.afterCalculateLabelRotation,[this])}beforeFit(){K(this.options.beforeFit,[this])}fit(){const t=this,e={width:0,height:0},{chart:i,options:{ticks:a,title:n,grid:o}}=t,r=t._isVisible(),s=t.isHorizontal();if(r){const r=Fi(n,i.options.font);if(s?(e.width=t.maxWidth,e.height=zi(o)+r):(e.height=t.maxHeight,e.width=zi(o)+r),a.display&&t.ticks.length){const{first:i,last:n,widest:o,highest:r}=t._getLabelSizes(),l=2*a.padding,h=Tt(t.labelRotation),c=Math.cos(h),d=Math.sin(h);if(s){const i=a.mirror?0:d*o.width+c*r.height;e.height=Math.min(t.maxHeight,e.height+i+l)}else{const i=a.mirror?0:c*o.width+d*r.height;e.width=Math.min(t.maxWidth,e.width+i+l)}t._calculatePadding(i,n,d,c)}}t._handleMargins(),s?(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(i,a,n,o){const r=this,{ticks:{align:s,padding:l},position:h}=r.options,c=0!==r.labelRotation,d="top"!==h&&"x"===r.axis;if(r.isHorizontal()){const h=r.getPixelForTick(0)-r.left,u=r.right-r.getPixelForTick(r.ticks.length-1);let t=0,e=0;c?e=d?(t=o*i.width,n*a.height):(t=n*i.height,o*a.width):"start"===s?e=a.width:"end"===s?t=i.width:(t=i.width/2,e=a.width/2),r.paddingLeft=Math.max((t-h+l)*r.width/(r.width-h),0),r.paddingRight=Math.max((e-u+l)*r.width/(r.width-u),0)}else{let t=a.height/2,e=i.height/2;"start"===s?(t=0,e=i.height):"end"===s&&(t=a.height,e=0),r.paddingTop=t+l,r.paddingBottom=e+l}}_handleMargins(){var 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(){K(this.options.afterFit,[this])}isHorizontal(){var{axis:t,position:e}=this.options;return"top"===e||"bottom"===e||"x"===t}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t),this.afterTickToLabelConversion()}_getLabelSizes(){var e=this;let i=e._labelSizes;if(!i){var a=e.options.ticks.sampleSize;let t=e.ticks;a<t.length&&(t=Ii(t,a)),e._labelSizes=i=e._computeLabelSizes(t,t.length)}return i}_computeLabelSizes(t,e){const{ctx:i,_longestTextCache:a}=this,n=[],o=[];let r,s,l,h,c,d,u,g,f,p,m,x=0,b=0;for(r=0;r<e;++r){if(h=t[r].label,c=this._resolveTickFontOptions(r),i.font=d=c.string,u=a[d]=a[d]||{data:{},gc:[]},g=c.lineHeight,f=p=0,H(h)||N(h)){if(N(h))for(s=0,l=h.length;s<l;++s)H(m=h[s])||N(m)||(f=Nt(i,u.data,u.gc,f,m),p+=g)}else f=Nt(i,u.data,u.gc,f,h),p=g;n.push(f),o.push(p),x=Math.max(f,x),b=Math.max(p,b)}var v;w=a,v=e,G(w,t=>{const e=t.gc,i=e.length/2;let a;if(v<i){for(a=0;a<i;++a)delete t.data[e[a]];e.splice(0,i)}});var _=n.indexOf(x),y=o.indexOf(b),w=t=>({width:n[t]||0,height:o[t]||0});return{first:w(0),last:w(e-1),widest:w(_),highest:w(y),widths:n,heights:o}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){var e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){var e=this;e._reversePixels&&(t=1-t);t=e._startPixel+t*e._length;return Wt(e._alignToPixels?$t(e.chart,t,0):t)}getDecimalForPixel(t){t=(t-this._startPixel)/this._length;return this._reversePixels?1-t:t}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){var{min:t,max:e}=this;return t<0&&e<0?e:0<t&&0<e?t:0}getContext(t){var e,i,a=this,n=a.ticks||[];if(0<=t&&t<n.length){const i=n[t];return i.$context||(i.$context=(e=a.getContext(),n=t,t=i,Object.assign(Object.create(e),{tick:t,index:n,type:"tick"})))}return a.$context||(a.$context=(i=a.chart.getContext(),a=a,Object.assign(Object.create(i),{scale:a,type:"scale"})))}_tickSize(){var t=this.options.ticks,e=Tt(this.labelRotation),i=Math.abs(Math.cos(e)),a=Math.abs(Math.sin(e)),n=this._getLabelSizes(),e=t.autoSkipPadding||0,t=n?n.widest.width+e:0,e=n?n.highest.height+e:0;return this.isHorizontal()?t*a<e*i?t/i:e/a:e*a<t*i?e/i:t/a}_isVisible(){var t=this.options.display;return"auto"!==t?!!t:0<this.getMatchingVisibleMetas().length}_computeGridLineItems(t){const e=this,i=e.axis,a=e.chart,n=e.options,{grid:o,position:r}=n,s=o.offset,l=e.isHorizontal(),h=e.ticks.length+(s?1:0),c=zi(o),d=[],u=o.setContext(e.getContext()),g=u.drawBorder?u.borderWidth:0,f=g/2,p=function(t){return $t(a,t,g)};let m,x,b,v,_,y,w,M,k,S,P,D;if("top"===r)m=p(e.bottom),y=e.bottom-c,M=m-f,S=p(t.top)+f,D=t.bottom;else if("bottom"===r)m=p(e.top),S=t.top,D=p(t.bottom)-f,y=m+f,M=e.top+c;else if("left"===r)m=p(e.right),_=e.right-c,w=m-f,k=p(t.left)+f,P=t.right;else if("right"===r)m=p(e.left),k=t.left,P=p(t.right)-f,_=m+f,w=e.left+c;else if("x"===i){if("center"===r)m=p((t.top+t.bottom)/2+.5);else if(j(r)){const t=Object.keys(r)[0],i=r[t];m=p(e.chart.scales[t].getPixelForValue(i))}S=t.top,D=t.bottom,y=m+f,M=y+c}else if("y"===i){if("center"===r)m=p((t.left+t.right)/2);else if(j(r)){const t=Object.keys(r)[0],i=r[t];m=p(e.chart.scales[t].getPixelForValue(i))}_=m-f,w=_-c,k=t.left,P=t.right}for(x=0;x<h;++x){const t=o.setContext(e.getContext(x)),i=t.lineWidth,n=t.color,r=o.borderDash||[],h=t.borderDashOffset,c=t.tickWidth,u=t.tickColor,g=t.tickBorderDash||[],f=t.tickBorderDashOffset;void 0!==(b=function(t,e,i){var a=t.ticks.length,n=Math.min(e,a-1),o=t._startPixel,r=t._endPixel;let s,l=t.getPixelForTick(n);if(!(i&&(s=1===a?Math.max(l-o,r-l):0===e?(t.getPixelForTick(1)-l)/2:(l-t.getPixelForTick(n-1))/2,l+=n<e?s:-s,l<o-1e-6||l>r+1e-6)))return l}(e,x,s))&&(v=$t(a,b,i),l?_=w=k=P=v:y=M=S=D=v,d.push({tx1:_,ty1:y,tx2:w,ty2:M,x1:k,y1:S,x2:P,y2:D,width:i,color:n,borderDash:r,borderDashOffset:h,tickWidth:c,tickColor:u,tickBorderDash:g,tickBorderDashOffset:f}))}return e._ticksLength=h,e._borderValue=m,d}_computeLabelItems(a){const n=this,o=n.axis,r=n.options,{position:t,ticks:e}=r,s=n.isHorizontal(),l=n.ticks,{align:h,crossAlign:c,padding:d,mirror:u}=e,i=zi(r.grid),g=i+d,f=u?-d:g,p=-Tt(n.labelRotation),m=[];let x,b,v,_,y,w,M,k,S,P,D,C="middle";if("top"===t)y=n.bottom-f,w=n._getXAxisLabelAlignment();else if("bottom"===t)y=n.top+f,w=n._getXAxisLabelAlignment();else if("left"===t){const a=n._getYAxisLabelAlignment(i);w=a.textAlign,_=a.x}else if("right"===t){const a=n._getYAxisLabelAlignment(i);w=a.textAlign,_=a.x}else if("x"===o){if("center"===t)y=(a.top+a.bottom)/2+g;else if(j(t)){const a=Object.keys(t)[0],o=t[a];y=n.chart.scales[a].getPixelForValue(o)+g}w=n._getXAxisLabelAlignment()}else if("y"===o){if("center"===t)_=(a.left+a.right)/2-g;else if(j(t)){const a=Object.keys(t)[0],o=t[a];_=n.chart.scales[a].getPixelForValue(o)}w=n._getYAxisLabelAlignment(i).textAlign}"y"===o&&("start"===h?C="top":"end"===h&&(C="bottom"));var O=n._getLabelSizes();for(x=0,b=l.length;x<b;++x){v=l[x].label;const a=e.setContext(n.getContext(x));M=n.getPixelForTick(x)+e.labelOffset,S=(k=n._resolveTickFontOptions(x)).lineHeight;const o=(P=N(v)?v.length:1)/2,r=a.color,h=a.textStrokeColor,d=a.textStrokeWidth;let i;if(s?(_=M,D="top"===t?"near"===c||0!=p?-P*S+S/2:"center"===c?-O.highest.height/2-o*S+S:-O.highest.height+S/2:"near"===c||0!=p?S/2:"center"===c?O.highest.height/2-o*S:O.highest.height-P*S,u&&(D*=-1)):(y=M,D=(1-P)*S/2),a.showLabelBackdrop){const n=Re(a.backdropPadding),o=O.heights[x],r=O.widths[x];let t=y+D-n.top,e=_-n.left;switch(C){case"middle":t-=o/2;break;case"bottom":t-=o}switch(w){case"center":e-=r/2;break;case"right":e-=r}i={left:e,top:t,width:r+n.width,height:o+n.height,color:a.backdropColor}}m.push({rotation:p,label:v,font:k,color:r,strokeColor:h,strokeWidth:d,textOffset:D,textAlign:w,textBaseline:C,translation:[_,y],backdrop:i})}return m}_getXAxisLabelAlignment(){var{position:t,ticks:e}=this.options;if(-Tt(this.labelRotation))return"top"===t?"left":"right";let i="center";return"start"===e.align?i="left":"end"===e.align&&(i="right"),i}_getYAxisLabelAlignment(t){var e=this,{position:i,ticks:{crossAlign:a,mirror:n,padding:o}}=e.options,r=t+o,t=e._getLabelSizes().widest.width;let s,l;return"left"===i?n?(s="left",l=e.right+o):(l=e.right-r,"near"===a?s="right":"center"===a?(s="center",l-=t/2):(s="left",l=e.left)):"right"===i?n?(s="right",l=e.left+o):(l=e.left+r,"near"===a?s="left":"center"===a?(s="center",l+=t/2):(s="right",l=e.right)):s="right",{textAlign:s,x:l}}_computeLabelArea(){var t=this;if(!t.options.ticks.mirror){var 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:a,width:n,height:o}=this;e&&(t.save(),t.fillStyle=e,t.fillRect(i,a,n,o),t.restore())}getLineWidthForValue(e){const t=this.options.grid;if(!this._isVisible()||!t.display)return 0;var i=this.ticks.findIndex(t=>t.value===e);return 0<=i?t.setContext(this.getContext(i)).lineWidth:0}drawGrid(t){const e=this,i=e.options.grid,a=e.ctx,n=e._gridLineItems||(e._gridLineItems=e._computeGridLineItems(t));let o,r;var s=(t,e,i)=>{i.width&&i.color&&(a.save(),a.lineWidth=i.width,a.strokeStyle=i.color,a.setLineDash(i.borderDash||[]),a.lineDashOffset=i.borderDashOffset,a.beginPath(),a.moveTo(t.x,t.y),a.lineTo(e.x,e.y),a.stroke(),a.restore())};if(i.display)for(o=0,r=n.length;o<r;++o){const t=n[o];i.drawOnChartArea&&s({x:t.x1,y:t.y1},{x:t.x2,y:t.y2},t),i.drawTicks&&s({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 n=this,{chart:o,ctx:r,options:{grid:s}}=n,l=s.setContext(n.getContext()),h=s.drawBorder?l.borderWidth:0;if(h){var c=s.setContext(n.getContext(0)).lineWidth,d=n._borderValue;let t,e,i,a;n.isHorizontal()?(t=$t(o,n.left,h)-h/2,e=$t(o,n.right,c)+c/2,i=a=d):(i=$t(o,n.top,h)-h/2,a=$t(o,n.bottom,c)+c/2,t=e=d),r.save(),r.lineWidth=l.borderWidth,r.strokeStyle=l.borderColor,r.beginPath(),r.moveTo(t,i),r.lineTo(e,a),r.stroke(),r.restore()}}drawLabels(i){const a=this;if(a.options.ticks.display){const o=a.ctx,r=a._computeLabelArea();r&&qt(o,r);var n=a._labelItems||(a._labelItems=a._computeLabelItems(i));let t,e;for(t=0,e=n.length;t<e;++t){const i=n[t],a=i.font,r=i.label;i.backdrop&&(o.fillStyle=i.backdrop.color,o.fillRect(i.backdrop.left,i.backdrop.top,i.backdrop.width,i.backdrop.height)),Qt(o,r,0,i.textOffset,a,i)}r&&Kt(o)}}drawTitle(){var{ctx:e,options:{position:i,title:a,reverse:n}}=this;if(a.display){var o=Le(a.font),r=Re(a.padding),s=a.align;let t=o.lineHeight/2;"bottom"===i?(t+=r.bottom,N(a.text)&&(t+=o.lineHeight*(a.text.length-1))):t+=r.top;var{titleX:l,titleY:h,maxWidth:c,rotation:r}=function(t,e,i,a){var{top:n,left:o,bottom:r,right:s}=t;let l,h,c,d=0;return t.isHorizontal()?(h=T(a,o,s),c=Ei(t,i,e),l=s-o):(h=Ei(t,i,e),c=T(a,r,n),d="left"===i?-_t:_t),{titleX:h,titleY:c,maxWidth:l,rotation:d}}(this,t,i,s);Qt(e,a.text,0,0,o,{color:a.color,maxWidth:c,rotation:r,textAlign:function(t,e,i){let a=f(t);return(i&&"right"!==e||!i&&"right"===e)&&(a="left"===(e=a)?"right":"right"===e?"left":e),a}(s,i,n),textBaseline:"middle",translation:[l,h]})}}draw(t){var e=this;e._isVisible()&&(e.drawBackground(),e.drawGrid(t),e.drawBorder(),e.drawTitle(),e.drawLabels(t))}_layers(){const e=this,t=e.options,i=t.ticks&&t.ticks.z||0,a=t.grid&&t.grid.z||0;return e._isVisible()&&e.draw===Vi.prototype.draw?[{z:a,draw(t){e.drawBackground(),e.drawGrid(t),e.drawTitle()}},{z:a+1,draw(){e.drawBorder()}},{z:i,draw(t){e.drawLabels(t)}}]:[{z:i,draw(t){e.draw(t)}}]}getMatchingVisibleMetas(t){const e=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID",a=[];let n,o;for(n=0,o=e.length;n<o;++n){const o=e[n];o[i]!==this.id||t&&o.type!==t||a.push(o)}return a}_resolveTickFontOptions(t){return Le(this.options.ticks.setContext(this.getContext(t)).font)}_maxDigits(){var t=this._resolveTickFontOptions(0).lineHeight;return this.isHorizontal()?this.width/t/.7:this.height/t}}function Bi(i,o=[""],e=i,a,n=()=>i[0]){st(a)||(a=Ki("_fallback",i));var t={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:i,_rootScopes:e,_fallback:a,_getTarget:n,override:t=>Bi([t,...i],o,e,a)};return new Proxy(t,{deleteProperty:(t,e)=>(delete t[e],delete t._keys,delete i[0][e],!0),get:(t,e)=>$i(t,e,()=>function(t,e,i){var a;for(const n of o)if(a=Ki(Ni(n,t),e),st(a))return ji(t,a)?Xi(e,i,t,a):a}(e,i,t)),getOwnPropertyDescriptor:(t,e)=>Reflect.getOwnPropertyDescriptor(t._scopes[0],e),getPrototypeOf:()=>Reflect.getPrototypeOf(i[0]),has:(t,e)=>Gi(t).includes(e),ownKeys:t=>Gi(t),set:(t,e,i)=>((t._storage||(t._storage=n()))[e]=i,delete t[e],delete t._keys,!0)})}function Wi(a,e,i,n){var t={_cacheable:!1,_proxy:a,_context:e,_subProxy:i,_stack:new Set,_descriptors:Hi(a,n),setContext:t=>Wi(a,t,i,n),override:t=>Wi(a.override(t),e,i,n)};return new Proxy(t,{deleteProperty:(t,e)=>(delete t[e],delete a[e],!0),get:(t,e,i)=>$i(t,e,()=>function(s,t,e){const{_proxy:i,_context:a,_subProxy:n,_descriptors:o}=s;let r=i[t];return lt(r)&&o.isScriptable(t)&&(r=function(t,e,i){const{_proxy:a,_context:n,_subProxy:o,_stack:r}=s;if(r.has(t))throw new Error("Recursion detected: "+[...r].join("->")+"->"+t);return r.add(t),e=e(n,o||i),r.delete(t),e=j(e)?Xi(a._scopes,a,t,e):e}(t,r,e)),N(r)&&r.length&&(r=function(t,e,i,a){const{_proxy:n,_context:o,_subProxy:r,_descriptors:s}=i;if(st(o.index)&&a(t))e=e[o.index%e.length];else if(j(e[0])){const i=e,a=n._scopes.filter(t=>t!==i);e=[];for(const l of i){const i=Xi(a,n,t,l);e.push(Wi(i,o,r&&r[t],s))}}return e}(t,r,s,o.isIndexable)),ji(t,r)&&(r=Wi(r,a,n&&n[t],o)),r}(t,e,i)),getOwnPropertyDescriptor:(t,e)=>t._descriptors.allKeys?Reflect.has(a,e)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(a,e),getPrototypeOf:()=>Reflect.getPrototypeOf(a),has:(t,e)=>Reflect.has(a,e),ownKeys:()=>Reflect.ownKeys(a),set:(t,e,i)=>(a[e]=i,delete t[e],!0)})}function Hi(t,e={scriptable:!0,indexable:!0}){const{_scriptable:i=e.scriptable,_indexable:a=e.indexable,_allKeys:n=e.allKeys}=t;return{allKeys:n,scriptable:i,indexable:a,isScriptable:lt(i)?i:()=>i,isIndexable:lt(a)?a:()=>a}}const Ni=(t,e)=>t?t+rt(e):e,ji=(t,e)=>j(e)&&"adapters"!==t;function $i(t,e,i){let a=t[e];return st(a)||(a=i(),st(a)&&(t[e]=a)),a}function Yi(t,e,i){return lt(t)?t(e,i):t}const Ui=(t,e)=>!0===t?e:"string"==typeof t?ot(e,t):void 0;function Xi(t,e,i,a){const n=e._rootScopes,o=Yi(e._fallback,i,a),r=[...t,...n],s=new Set;s.add(a);a=qi(s,r,i,o||i);return null!==a&&(!st(o)||o===i||null!==(a=qi(s,r,o,a)))&&Bi([...s],[""],n,o,()=>{const t=e._getTarget();return i in t||(t[i]={}),t[i]})}function qi(t,e,i,a){for(;i;)i=function(t,e,i,a){for(const o of e){const e=Ui(i,o);if(e){t.add(e);var n=Yi(e._fallback,i,e);if(st(n)&&n!==i&&n!==a)return n}else if(!1===e&&st(a)&&i!==a)return null}return!1}(t,e,i,a);return i}function Ki(t,e){for(const i of e)if(i){const e=i[t];if(st(e))return e}}function Gi(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 Zi=Number.EPSILON||1e-14,Qi=(t,e)=>e<t.length&&!t[e].skip&&t[e];function Ji(t,e,i,a){var n=t.skip?e:t,o=e,t=i.skip?e:i,e=It(o,n),i=It(t,o);let r=e/(e+i),s=i/(e+i);r=isNaN(r)?0:r,s=isNaN(s)?0:s;i=a*r,a*=s;return{previous:{x:o.x-i*(t.x-n.x),y:o.y-i*(t.y-n.y)},next:{x:o.x+a*(t.x-n.x),y:o.y+a*(t.y-n.y)}}}function ta(t){const e=t.length,i=Array(e).fill(0),a=Array(e);let n,o,r,s=Qi(t,0);for(n=0;n<e;++n)if(o=r,r=s,s=Qi(t,n+1),r){if(s){const t=s.x-r.x;i[n]=0!=t?(s.y-r.y)/t:0}a[n]=o?s?kt(i[n-1])!==kt(i[n])?0:(i[n-1]+i[n])/2:i[n-1]:i[n]}!function(e,i,a){var n=e.length;let o,r,s,l,h,c=Qi(e,0);for(let t=0;t<n-1;++t)h=c,c=Qi(e,t+1),h&&c&&(Ct(i[t],0,Zi)?a[t]=a[t+1]=0:(o=a[t]/i[t],r=a[t+1]/i[t],(l=Math.pow(o,2)+Math.pow(r,2))<=9||(s=3/Math.sqrt(l),a[t]=o*s*i[t],a[t+1]=r*s*i[t])))}(t,i,a),function(e,i){const a=e.length;let n,o,r,s=Qi(e,0);for(let t=0;t<a;++t)if(o=r,r=s,s=Qi(e,t+1),r){const{x:a,y:l}=r;o&&(n=(a-o.x)/3,r.cp1x=a-n,r.cp1y=l-n*i[t]),s&&(n=(s.x-a)/3,r.cp2x=a+n,r.cp2y=l+n*i[t])}}(t,a)}function ea(t,e,i){return Math.max(Math.min(t,i),e)}function ia(e,i,t,a){let n,o,r,s;if(i.spanGaps&&(e=e.filter(t=>!t.skip)),"monotone"===i.cubicInterpolationMode)ta(e);else{let t=a?e[e.length-1]:e[0];for(n=0,o=e.length;n<o;++n)r=e[n],s=Ji(t,r,e[Math.min(n+1,o-(a?0:1))%o],i.tension),r.cp1x=s.previous.x,r.cp1y=s.previous.y,r.cp2x=s.next.x,r.cp2y=s.next.y,t=r}i.capBezierPoints&&function(t,e){let i,a,n,o,r,s=Xt(t[0],e);for(i=0,a=t.length;i<a;++i)r=o,o=s,s=i<a-1&&Xt(t[i+1],e),o&&(n=t[i],r&&(n.cp1x=ea(n.cp1x,e.left,e.right),n.cp1y=ea(n.cp1y,e.top,e.bottom)),s&&(n.cp2x=ea(n.cp2x,e.left,e.right),n.cp2y=ea(n.cp2y,e.top,e.bottom)))}(e,t)}function aa(t,e,i,a){return{x:t.x+i*(e.x-t.x),y:t.y+i*(e.y-t.y)}}function na(t,e,i,a){return{x:t.x+i*(e.x-t.x),y:("middle"===a?i<.5?t:e:"after"===a?i<1?t:e:0<i?e:t).y}}function oa(t,e,i,a){var n={x:t.cp2x,y:t.cp2y},o={x:e.cp1x,y:e.cp1y},t=aa(t,n,i),n=aa(n,o,i),e=aa(o,e,i),t=aa(t,n,i),e=aa(n,e,i);return aa(t,e,i)}function ra(t,e,i){return t?(a=e,n=i,{x:t=>a+a+n-t,setWidth(t){n=t},textAlign:t=>"center"===t?t:"right"===t?"left":"right",xPlus:(t,e)=>t-e,leftForLtr:(t,e)=>t-e}):{x:t=>t,setWidth(t){},textAlign:t=>t,xPlus:(t,e)=>t+e,leftForLtr:(t,e)=>t};var a,n}function sa(t,e){let i,a;"ltr"!==e&&"rtl"!==e||(i=t.canvas.style,a=[i.getPropertyValue("direction"),i.getPropertyPriority("direction")],i.setProperty("direction",e,"important"),t.prevTextDirection=a)}function la(t,e){void 0!==e&&(delete t.prevTextDirection,t.canvas.style.setProperty("direction",e[0],e[1]))}function ha(t){return"angle"===t?{between:Vt,compare:zt,normalize:Ft}:{between:(t,e,i)=>t>=Math.min(e,i)&&t<=Math.max(i,e),compare:(t,e)=>t-e,normalize:t=>t}}function ca({start:t,end:e,count:i,loop:a,style:n}){return{start:t%i,end:e%i,loop:a&&(e-t+1)%i==0,style:n}}function da(t,i,g){if(!g)return[t];const{property:a,start:n,end:o}=g,r=i.length,{compare:s,between:l,normalize:h}=ha(a),{start:c,end:d,loop:u,style:f}=function(t,e){const{property:i,start:a,end:n}=g,{between:o,normalize:r}=ha(i),s=e.length;let l,h,{start:c,end:d,loop:u}=t;if(u){for(c+=s,d+=s,l=0,h=s;l<h&&o(r(e[c%s][i]),a,n);++l)c--,d--;c%=s,d%=s}return d<c&&(d+=s),{start:c,end:d,loop:u,style:t.style}}(t,i),p=[];let m,x,b,v=!1,_=null;for(let t=c,e=c;t<=d;++t)(x=i[t%r]).skip||(m=h(x[a]),v=l(m,n,o),null===_&&(v||l(n,b,m)&&0!==s(n,b))&&(_=0===s(m,n)?t:e),null===_||v&&0!==s(o,m)&&!l(o,b,m)||(p.push(ca({start:_,end:t,loop:u,count:r,style:f})),_=null),e=t,b=m);return null!==_&&p.push(ca({start:_,end:d,loop:u,count:r,style:f})),p}function ua(e,i){const a=[],n=e.segments;for(let t=0;t<n.length;t++){var o=da(n[t],e.points,i);o.length&&a.push(...o)}return a}function ga(t,e){var i=t.points,o=t.options.spanGaps,a=i.length;if(!a)return[];var n=!!t._loop,{start:r,end:s}=function(t,e,i){let a=0,n=e-1;if(i&&!o)for(;a<e&&!t[a].skip;)a++;for(;a<e&&t[a].skip;)a++;for(a%=e,i&&(n+=a);n>a&&t[n%e].skip;)n--;return n%=e,{start:a,end:n}}(i,a,n);return fa(!0===o?[{start:r,end:s,loop:n}]:function(t,e,i,a){const n=t.length,o=[];let r,s=e,l=t[e];for(r=e+1;r<=i;++r){const i=t[r%n];i.skip||i.stop?l.skip||(a=!1,o.push({start:e%n,end:(r-1)%n,loop:a}),e=s=i.stop?r:null):(s=r,l.skip&&(e=r)),l=i}return null!==s&&o.push({start:e%n,end:s%n,loop:a}),o}(i,r,s<r?s+a:s,!!t._fullLoop&&0===r&&s===a-1),i,e)}function fa(t,e,i){return i&&i.setContext&&e?function(a,n){const o=a.length,r=[];let s=t[0].start,l=s;for(const u of t){let t,e,i=a[s%o];for(l=s+1;l<=u.end;l++){var h=a[l%o];e={backgroundColor:(d=n.setContext({type:"segment",p0:i,p1:h})).backgroundColor,borderCapStyle:d.borderCapStyle,borderDash:d.borderDash,borderDashOffset:d.borderDashOffset,borderJoinStyle:d.borderJoinStyle,borderWidth:d.borderWidth,borderColor:d.borderColor},c=e,(d=t)&&JSON.stringify(c)!==JSON.stringify(d)&&(r.push({start:s,end:l-1,loop:u.loop,style:t}),t=e,s=l-1),i=h,t=e}s<l-1&&(r.push({start:s,end:l-1,loop:u.loop,style:e}),s=l-1)}var c,d;return r}(e,i):t}var pa=Object.freeze({__proto__:null,easingEffects:ci,color:V,getHoverColor:B,noop:t,uid:W,isNullOrUndef:H,isArray:N,isObject:j,isFinite:$,finiteOrDefault:Y,valueOrDefault:U,toPercentage:X,toDimension:q,callback:K,each:G,_elementsEqual:Z,clone:Q,_merger:tt,merge:et,mergeIf:it,_mergerIf:at,_deprecated:function(t,e,i,a){void 0!==e&&console.warn(t+': "'+i+'" is deprecated. Please use "'+a+'" instead')},resolveObjectKey:ot,_capitalize:rt,defined:st,isFunction:lt,setsEqual:ht,toFontString:Ht,_measureText:Nt,_longestText:jt,_alignPixel:$t,clearCanvas:Yt,drawPoint:Ut,_isPointInArea:Xt,clipArea:qt,unclipArea:Kt,_steppedLineTo:Gt,_bezierCurveTo:Zt,renderText:Qt,addRoundedRectPath:Jt,_lookup:te,_lookupByKey:ee,_rlookupByKey:ie,_filterBetween:ae,listenArrayEvents:oe,unlistenArrayEvents:re,_arrayUnique:se,_createResolver:Bi,_attachContext:Wi,_descriptors:Hi,splineCurve:Ji,splineCurveMonotone:ta,_updateBezierControlPoints:ia,_getParentNode:le,getStyle:de,getRelativePosition:fe,getMaximumSize:me,retinaScale:xe,supportsEventListenerOptions:be,readUsedSize:ve,fontString:function(t,e,i){return e+" "+t+"px "+i},requestAnimFrame:r,throttled:l,debounce:s,_toLeftRightCenter:f,_alignStartEnd:T,_textX:R,_pointInLine:aa,_steppedInterpolation:na,_bezierInterpolation:oa,formatNumber:Oi,toLineHeight:Ce,_readValueToProps:Oe,toTRBL:Ae,toTRBLCorners:Te,toPadding:Re,toFont:Le,resolve:Ee,_addGrace:Ie,PI:pt,TAU:mt,PITAU:xt,INFINITY:bt,RAD_PER_DEG:vt,HALF_PI:_t,QUARTER_PI:yt,TWO_THIRDS_PI:wt,log10:Mt,sign:kt,niceNum:St,_factorize:Pt,isNumber:Dt,almostEquals:Ct,almostWhole:Ot,_setMinAndMaxByKey:At,toRadians:Tt,toDegrees:Rt,_decimalPlaces:Lt,getAngleFromPoint:Et,distanceBetweenPoints:It,_angleDiff:zt,_normalizeAngle:Ft,_angleBetween:Vt,_limitValue:Bt,_int16Range:Wt,getRtlAdapter:ra,overrideTextDirection:sa,restoreTextDirection:la,_boundSegment:da,_boundSegments:ua,_computeSegments:ga});class ma{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){var e,i,s,l,a=Object.getPrototypeOf(t);let n;"id"in(i=a)&&"defaults"in i&&(n=this.register(a));const o=this.items,r=t.id,h=this.scope+"."+r;if(!r)throw new Error("class does not have id: "+t);return r in o||(o[r]=t,e=t,i=h,a=n,a=et(Object.create(null),[a?ft.get(a):{},ft.get(i),e.defaults]),ft.set(i,a),e.defaultRoutes&&(s=i,l=e.defaultRoutes,Object.keys(l).forEach(t=>{const e=t.split("."),i=e.pop(),a=[s].concat(e).join("."),n=l[t].split("."),o=n.pop(),r=n.join(".");ft.route(a,i,r,o)})),e.descriptors&&ft.describe(i,e.descriptors),this.override&&ft.override(t.id,t.overrides)),h}get(t){return this.items[t]}unregister(t){const e=this.items,i=t.id,a=this.scope;i in e&&delete e[i],a&&i in ft[a]&&(delete ft[a][i],this.override&&delete ct[i])}}var xa=new class{constructor(){this.controllers=new ma(Pi,"datasets",!0),this.elements=new ma(Di,"elements"),this.plugins=new ma(Object,"plugins"),this.scales=new ma(Vi,"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(i,t,a){const n=this;[...t].forEach(t=>{const e=a||n._getRegistryForType(t);a||e.isForType(t)||e===n.plugins&&t.id?n._exec(i,e,t):G(t,t=>{var e=a||n._getRegistryForType(t);n._exec(i,e,t)})})}_exec(t,e,i){var a=rt(t);K(i["before"+a],[],i),e[t](i),K(i["after"+a],[],i)}_getRegistryForType(e){for(let t=0;t<this._typedRegistries.length;t++){const i=this._typedRegistries[t];if(i.isForType(e))return i}return this.plugins}_get(t,e,i){e=e.get(t);if(void 0===e)throw new Error('"'+t+'" is not a registered '+i+".");return e}};class ba{constructor(){this._init=[]}notify(t,e,i,a){var n=this;"beforeInit"===e&&(n._init=n._createDescriptors(t,!0),n._notify(n._init,t,"install"));a=a?n._descriptors(t).filter(a):n._descriptors(t),i=n._notify(a,t,e,i);return"destroy"===e&&(n._notify(a,t,"stop"),n._notify(n._init,t,"uninstall")),i}_notify(t,e,i,a){a=a||{};for(const n of t){const t=n.plugin;if(!1===K(t[i],[e,a,n.options],t)&&a.cancelable)return!1}return!0}invalidate(){H(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;var e=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),e}_createDescriptors(t,e){var i=t&&t.config,a=U(i.options&&i.options.plugins,{}),i=function(t){const e=[],i=Object.keys(xa.plugins.items);for(let t=0;t<i.length;t++)e.push(xa.getPlugin(i[t]));var a=t.plugins||[];for(let t=0;t<a.length;t++){const i=a[t];-1===e.indexOf(i)&&e.push(i)}return e}(i);return!1!==a||e?function(e,i,a,n){const o=[],r=e.getContext();for(let t=0;t<i.length;t++){var s=i[t],l=(l=a[s.id],n||!1!==l?!0===l?{}:l:null);null!==l&&o.push({plugin:s,options:function(t,e,i,a){e=t.pluginScopeKeys(e),e=t.getOptionScopes(i,e);return t.createResolver(e,a,[""],{scriptable:!1,indexable:!1,allKeys:!0})}(e.config,s,l,r)})}var l;return o}(t,i,a,e):[]}_notifyStateChanges(t){var e=this._oldCache||[],i=this._cache,a=(t,i)=>t.filter(e=>!i.some(t=>e.plugin.id===t.plugin.id));this._notify(a(e,i),t,"stop"),this._notify(a(i,e),t,"start")}}function va(t,e){var i=ft.datasets[t]||{};return((e.datasets||{})[t]||{}).indexAxis||e.indexAxis||i.indexAxis||"x"}function _a(t,e){return"x"===t||"y"===t?t:e.axis||("top"===(e=e.position)||"bottom"===e?"x":"left"===e||"right"===e?"y":void 0)||t.charAt(0).toLowerCase()}function ya(t){const e=t.options||(t.options={});e.plugins=U(e.plugins,{}),e.scales=function(e,i){const o=ct[e.type]||{scales:{}},r=i.scales||{},s=va(e.type,i),l=Object.create(null),h=Object.create(null);return Object.keys(r).forEach(t=>{var e=r[t],i=_a(t,e),a=i===s?"_index_":"_value_",n=o.scales||{};l[i]=l[i]||t,h[t]=it(Object.create(null),[{axis:i},e,n[i],n[a]])}),e.data.datasets.forEach(a=>{const t=a.type||e.type,n=a.indexAxis||va(t,i),o=(ct[t]||{}).scales||{};Object.keys(o).forEach(t=>{var e=function(t,e){let i=t;return"_index_"===t?i=e:"_value_"===t&&(i="x"===e?"y":"x"),i}(t,n),i=a[e+"AxisID"]||l[e]||e;h[i]=h[i]||Object.create(null),it(h[i],[{axis:e},r[i],o[t]])})}),Object.keys(h).forEach(t=>{t=h[t];it(t,[ft.scales[t.type],ft.scale])}),h}(t,e)}function wa(t){return(t=t||{}).datasets=t.datasets||[],t.labels=t.labels||[],t}const Ma=new Map,ka=new Set;function Sa(t,e){let i=Ma.get(t);return i||(i=e(),Ma.set(t,i),ka.add(i)),i}const Pa=(t,e,i)=>{i=ot(e,i);void 0!==i&&t.add(i)};class Da{constructor(t){this._config=((t=(t=t)||{}).data=wa(t.data),ya(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=wa(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){var t=this._config;this.clearCache(),ya(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return Sa(t,()=>[["datasets."+t,""]])}datasetAnimationScopeKeys(t,e){return Sa(`${t}.transition.${e}`,()=>[[`datasets.${t}.transitions.${e}`,"transitions."+e],["datasets."+t,""]])}datasetElementScopeKeys(t,e){return Sa(`${t}-${e}`,()=>[[`datasets.${t}.elements.${e}`,"datasets."+t,"elements."+e,""]])}pluginScopeKeys(t){const e=t.id;return Sa(`${this.type}-plugin-${e}`,()=>[["plugins."+e,...t.additionalOptionScopes||[]]])}_cachedScopes(t,e){const i=this._scopeCache;let a=i.get(t);return a&&!e||(a=new Map,i.set(t,a)),a}getOptionScopes(e,t,i){const{options:a,type:n}=this,o=this._cachedScopes(e,i),r=o.get(t);if(r)return r;const s=new Set;t.forEach(t=>{e&&(s.add(e),t.forEach(t=>Pa(s,e,t))),t.forEach(t=>Pa(s,a,t)),t.forEach(t=>Pa(s,ct[n]||{},t)),t.forEach(t=>Pa(s,ft,t)),t.forEach(t=>Pa(s,dt,t))});i=[...s];return ka.has(t)&&o.set(t,i),i}chartOptionScopes(){var{options:t,type:e}=this;return[t,ct[e]||{},ft.datasets[e]||{},{type:e},ft,dt]}resolveNamedOptions(t,e,i,a=[""]){const n={$shared:!0},{resolver:o,subPrefixes:r}=Ca(this._resolverCache,t,a);let s=o;!function(t,e){const{isScriptable:i,isIndexable:a}=Hi(t);for(const n of e)if(i(n)&&lt(t[n])||a(n)&&N(t[n]))return 1}(o,e)||(n.$shared=!1,s=Wi(o,i=lt(i)?i():i,this.createResolver(t,i,r)));for(const t of e)n[t]=s[t];return n}createResolver(t,e,i=[""],a){var{resolver:i}=Ca(this._resolverCache,t,i);return j(e)?Wi(i,e,void 0,a):i}}function Ca(t,e,i){let a=t.get(e);a||(a=new Map,t.set(e,a));t=i.join();let n=a.get(t);return n||(n={resolver:Bi(e,i),subPrefixes:i.filter(t=>!t.toLowerCase().includes("hover"))},a.set(t,n)),n}const Oa=["top","bottom","left","right","chartArea"];function Aa(t,e){return"top"===t||"bottom"===t||-1===Oa.indexOf(t)&&"x"===e}function Ta(i,a){return function(t,e){return t[i]===e[i]?t[a]-e[a]:t[i]-e[i]}}function Ra(t){const e=t.chart,i=e.options.animation;e.notifyPlugins("afterRender"),K(i&&i.onComplete,[t],e)}function La(t){var e=t.chart,i=e.options.animation;K(i&&i.onProgress,[t],e)}function Ea(){return"undefined"!=typeof window&&"undefined"!=typeof document}function Ia(t){return Ea()&&"string"==typeof t?t=document.getElementById(t):t&&t.length&&(t=t[0]),t=t&&t.canvas?t.canvas:t}const za={},Fa=t=>{const e=Ia(t);return Object.values(za).filter(t=>t.canvas===e).pop()};class Va{constructor(t,e){var i=this;this.config=e=new Da(e);var a=Ia(t),n=Fa(a);if(n)throw new Error("Canvas is already in use. Chart with ID '"+n.id+"' must be destroyed before the canvas can be reused.");var o=e.createResolver(e.chartOptionScopes(),i.getContext());this.platform=i._initializePlatform(a,e);t=i.platform.acquireContext(a,o.aspectRatio),n=t&&t.canvas,e=n&&n.height,a=n&&n.width;this.id=W(),this.ctx=t,this.canvas=n,this.width=a,this.height=e,this._options=o,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 ba,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=s(()=>this.update("resize"),o.resizeDelay||0),za[i.id]=i,t&&n?(h.listen(i,"complete",Ra),h.listen(i,"progress",La),i._initialize(),i.attached&&i.update()):console.error("Failed to create chart: can't acquire context from the given item")}get aspectRatio(){var{options:{aspectRatio:t,maintainAspectRatio:e},width:i,height:a,_aspectRatio:n}=this;return H(t)?e&&n?n:a?i/a: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(){var t=this;return t.notifyPlugins("beforeInit"),t.options.responsive?t.resize():xe(t,t.options.devicePixelRatio),t.bindEvents(),t.notifyPlugins("afterInit"),t}_initializePlatform(t,e){return new(e.platform||(!Ea()||"undefined"!=typeof OffscreenCanvas&&t instanceof OffscreenCanvas?Xe:oi))}clear(){return Yt(this.canvas,this.ctx),this}stop(){return h.stop(this),this}resize(t,e){h.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){var i=this,a=i.options,n=i.canvas,o=a.maintainAspectRatio&&i.aspectRatio,t=i.platform.getMaximumSize(n,t,e,o),e=i.currentDevicePixelRatio,o=a.devicePixelRatio||i.platform.getDevicePixelRatio();i.width===t.width&&i.height===t.height&&e===o||(i.width=t.width,i.height=t.height,i._aspectRatio=i.aspectRatio,xe(i,o,!0),i.notifyPlugins("resize",{size:t}),K(a.onResize,[i,t],i),i.attached&&i._doResize()&&i.render())}ensureScalesHaveIDs(){G(this.options.scales||{},(t,e)=>{t.id=e})}buildOrUpdateScales(){const r=this,s=r.options,a=s.scales,l=r.scales,h=Object.keys(l).reduce((t,e)=>(t[e]=!1,t),{});let t=[];a&&(t=t.concat(Object.keys(a).map(t=>{var e=a[t],i=_a(t,e),t="r"===i,i="x"===i;return{options:e,dposition:t?"chartArea":i?"bottom":"left",dtype:t?"radialLinear":i?"category":"linear"}}))),G(t,t=>{const e=t.options,i=e.id,a=_a(i,e),n=U(e.type,t.dtype);void 0!==e.position&&Aa(e.position,a)===Aa(t.dposition)||(e.position=t.dposition),h[i]=!0;let o=null;i in l&&l[i].type===n?o=l[i]:(o=new(xa.getScale(n))({id:i,type:n,ctx:r.ctx,chart:r}),l[o.id]=o),o.init(e,s)}),G(h,(t,e)=>{t||delete l[e]}),G(l,t=>{Ye.configure(r,t,t.options),Ye.addBox(r,t)})}_updateMetasetIndex(t,e){const i=this._metasets,a=t.index;a!==e&&(i[a]=i[e],(i[e]=t).index=e)}_updateMetasets(){const t=this._metasets,e=this.data.datasets.length,i=t.length;if(e<i){for(let t=e;t<i;++t)this._destroyDatasetMeta(t);t.splice(e,i-e)}this._sortedMetasets=t.slice(0).sort(Ta("order","index"))}_removeUnreferencedMetasets(){const i=this,{_metasets:t,data:{datasets:a}}=i;t.length>a.length&&delete i._stacks,t.forEach((e,t)=>{0===a.filter(t=>t===e._dataset).length&&i._destroyDatasetMeta(t)})}buildOrUpdateControllers(){const e=this,i=[],a=e.data.datasets;let n,o;for(e._removeUnreferencedMetasets(),n=0,o=a.length;n<o;n++){const o=a[n];let t=e.getDatasetMeta(n);var r=o.type||e.config.type;if(t.type&&t.type!==r&&(e._destroyDatasetMeta(n),t=e.getDatasetMeta(n)),t.type=r,t.indexAxis=o.indexAxis||va(r,e.options),t.order=o.order||0,e._updateMetasetIndex(t,n),t.label=""+o.label,t.visible=e.isDatasetVisible(n),t.controller)t.controller.updateIndex(n),t.controller.linkScales();else{const a=xa.getController(r),{datasetElementType:o,dataElementType:s}=ft.datasets[r];Object.assign(a.prototype,{dataElementType:xa.getElement(s),datasetElementType:o&&xa.getElement(o)}),t.controller=new a(e,n),i.push(t.controller)}}return e._updateMetasets(),i}_resetElements(){const i=this;G(i.data.datasets,(t,e)=>{i.getDatasetMeta(e).controller.reset()},i)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const a=this,n=a.config;n.update(),a._options=n.createResolver(n.chartOptionScopes(),a.getContext()),G(a.scales,t=>{Ye.removeBox(a,t)});var o=a._animationsDisabled=!a.options.animation;a.ensureScalesHaveIDs(),a.buildOrUpdateScales();const r=new Set(Object.keys(a._listeners)),e=new Set(a.options.events);if(ht(r,e)||(a.unbindEvents(),a.bindEvents()),a._plugins.invalidate(),!1!==a.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0})){const s=a.buildOrUpdateControllers();a.notifyPlugins("beforeElementsUpdate");let i=0;for(let t=0,e=a.data.datasets.length;t<e;t++){const{controller:n}=a.getDatasetMeta(t),r=!o&&-1===s.indexOf(n);n.buildOrUpdateElements(r),i=Math.max(+n.getMaxOverflow(),i)}a._minPadding=i,a._updateLayout(i),o||G(s,t=>{t.reset()}),a._updateDatasets(t),a.notifyPlugins("afterUpdate",{mode:t}),a._layers.sort(Ta("z","_idx")),a._lastEvent&&a._eventHandler(a._lastEvent,!0),a.render()}}_updateLayout(t){const e=this;if(!1!==e.notifyPlugins("beforeLayout",{cancelable:!0})){Ye.update(e,e.width,e.height,t);const i=e.chartArea,a=i.width<=0||i.height<=0;e._layers=[],G(e.boxes,t=>{a&&"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(i){var a="function"==typeof i;if(!1!==this.notifyPlugins("beforeDatasetsUpdate",{mode:i,cancelable:!0})){for(let t=0,e=this.data.datasets.length;t<e;++t)this._updateDataset(t,a?i({datasetIndex:t}):i);this.notifyPlugins("afterDatasetsUpdate",{mode:i})}}_updateDataset(t,e){const i=this.getDatasetMeta(t),a={meta:i,index:t,mode:e,cancelable:!0};!1!==this.notifyPlugins("beforeDatasetUpdate",a)&&(i.controller._update(e),a.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",a))}render(){var t=this;!1!==t.notifyPlugins("beforeRender",{cancelable:!0})&&(h.has(t)?t.attached&&!h.running(t)&&h.start(t):(t.draw(),Ra({chart:t})))}draw(){var 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)&&!1!==t.notifyPlugins("beforeDraw",{cancelable:!0})){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 a,n;for(a=0,n=e.length;a<n;++a){const n=e[a];t&&!n.visible||i.push(n)}return i}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(!1!==this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0})){var e=this.getSortedVisibleDatasetMetas();for(let t=e.length-1;0<=t;--t)this._drawDataset(e[t]);this.notifyPlugins("afterDatasetsDraw")}}_drawDataset(t){const e=this,i=e.ctx,a=t._clip,n=e.chartArea,o={meta:t,index:t.index,cancelable:!0};!1!==e.notifyPlugins("beforeDatasetDraw",o)&&(qt(i,{left:!1===a.left?0:n.left-a.left,right:!1===a.right?e.width:n.right+a.right,top:!1===a.top?0:n.top-a.top,bottom:!1===a.bottom?e.height:n.bottom+a.bottom}),t.controller.draw(),Kt(i),o.cancelable=!1,e.notifyPlugins("afterDatasetDraw",o))}getElementsAtEventForMode(t,e,i,a){const n=Se.modes[e];return"function"==typeof n?n(this,t,i,a):[]}getDatasetMeta(t){const e=this.data.datasets[t],i=this._metasets;let a=i.filter(t=>t&&t._dataset===e).pop();return a=a||(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}),a}getContext(){return this.$context||(this.$context={chart:this,type:"chart"})}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){var e=this.data.datasets[t];if(!e)return!1;t=this.getDatasetMeta(t);return"boolean"==typeof t.hidden?!t.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(e,t){const i=t?"show":"hide",a=this.getDatasetMeta(e),n=a.controller._resolveAnimations(void 0,i);this.setDatasetVisibility(e,t),n.update(a,{visible:t}),this.update(t=>t.datasetIndex===e?i:void 0)}hide(t){this._updateDatasetVisibility(t,!1)}show(t){this._updateDatasetVisibility(t,!0)}_destroyDatasetMeta(t){const e=this._metasets&&this._metasets[t];e&&e.controller&&(e.controller._destroy(),delete this._metasets[t])}destroy(){var t=this,{canvas:e,ctx:i}=t;let a,n;for(t.stop(),h.remove(t),a=0,n=t.data.datasets.length;a<n;++a)t._destroyDatasetMeta(a);t.config.clearCache(),e&&(t.unbindEvents(),Yt(e,i),t.platform.releaseContext(i),t.canvas=null,t.ctx=null),t.notifyPlugins("destroy"),delete za[t.id]}toBase64Image(...t){return this.canvas.toDataURL(...t)}bindEvents(){const a=this,i=a._listeners,n=a.platform,e=(t,e)=>{n.addEventListener(a,t,e),i[t]=e},o=(t,e)=>{i[t]&&(n.removeEventListener(a,t,e),delete i[t])};let r=function(t,e,i){t.offsetX=e,t.offsetY=i,a._eventHandler(t)};if(G(a.options.events,t=>e(t,r)),a.options.responsive){let t;r=(t,e)=>{a.canvas&&a.resize(t,e)};const s=()=>{o("attach",s),a.attached=!0,a.resize(),e("resize",r),e("detach",t)};t=()=>{a.attached=!1,o("resize",r),e("attach",s)},(n.isAttached(a.canvas)?s:t)()}else a.attached=!0}unbindEvents(){const i=this,t=i._listeners;t&&(i._listeners={},G(t,(t,e)=>{i.platform.removeEventListener(i,e,t)}))}updateHoverStyle(t,e,i){var a=i?"set":"remove";let n,o,r,s;for("dataset"===e&&(n=this.getDatasetMeta(t[0].datasetIndex),n.controller["_"+a+"DatasetHoverStyle"]()),r=0,s=t.length;r<s;++r){const e=(o=t[r])&&this.getDatasetMeta(o.datasetIndex).controller;e&&e[a+"HoverStyle"](o.element,o.datasetIndex,o.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){const a=this,e=a._active||[],i=t.map(({datasetIndex:t,index:e})=>{var i=a.getDatasetMeta(t);if(!i)throw new Error("No dataset found at index "+t);return{datasetIndex:t,element:i.data[e],index:e}});Z(i,e)||(a._active=i,a._updateHoverStyles(i,e))}notifyPlugins(t,e,i){return this._plugins.notify(this,t,e,i)}_updateHoverStyles(t,e,i){var a=this.options.hover,n=(t,i)=>t.filter(e=>!i.some(t=>e.datasetIndex===t.datasetIndex&&e.index===t.index)),o=n(e,t),e=i?t:n(t,e);o.length&&this.updateHoverStyle(o,a.mode,!1),e.length&&a.mode&&this.updateHoverStyle(e,a.mode,!0)}_eventHandler(e,t){const i=this,a={event:e,replay:t,cancelable:!0},n=t=>(t.options.events||this.options.events).includes(e.type);if(!1!==i.notifyPlugins("beforeEvent",a,n)){t=i._handleEvent(e,t);return a.cancelable=!1,i.notifyPlugins("afterEvent",a,n),(t||a.changed)&&i.render(),i}}_handleEvent(t,e){var i=this,{_active:a=[],options:n}=i,o=n.hover;let r=[],s,l=null;return"mouseout"!==t.type&&(r=i.getElementsAtEventForMode(t,o.mode,o,e),l="click"===t.type?i._lastEvent:t),i._lastEvent=null,Xt(t,i.chartArea,i._minPadding)&&(K(n.onHover,[t,r,i],i),"mouseup"!==t.type&&"click"!==t.type&&"contextmenu"!==t.type||K(n.onClick,[t,r,i],i)),((s=!Z(r,a))||e)&&(i._active=r,i._updateHoverStyles(r,a,e)),i._lastEvent=l,s}}const Ba=()=>G(Va.instances,t=>t._plugins.invalidate());function Wa(){throw new Error("This method is not implemented: either no adapter can be found or an incomplete integration was provided.")}Object.defineProperties(Va,{defaults:{enumerable:!0,value:ft},instances:{enumerable:!0,value:za},overrides:{enumerable:!0,value:ct},registry:{enumerable:!0,value:xa},version:{enumerable:!0,value:"3.2.1"},getChart:{enumerable:!0,value:Fa},register:{enumerable:!0,value:(...t)=>{xa.add(...t),Ba()}},unregister:{enumerable:!0,value:(...t)=>{xa.remove(...t),Ba()}}});class Ha{constructor(t){this.options=t||{}}formats(){return Wa()}parse(t,e){return Wa()}format(t,e){return Wa()}add(t,e,i){return Wa()}diff(t,e,i){return Wa()}startOf(t,e,i){return Wa()}endOf(t,e){return Wa()}}Ha.override=function(t){Object.assign(Ha.prototype,t)};var Na={_date:Ha};function ja(t,e,i,a){return N(t)?function(t,e,i,a){var n=i.parse(t[0],a),o=i.parse(t[1],a),t=Math.min(n,o),a=Math.max(n,o);let r=t,s=a;Math.abs(t)>Math.abs(a)&&(r=a,s=t),e[i.axis]=s,e._custom={barStart:r,barEnd:s,start:n,end:o,min:t,max:a}}(t,e,i,a):e[i.axis]=i.parse(t,a),e}function $a(t,e,i,a){const n=t.iScale,o=t.vScale,r=n.getLabels(),s=n===o,l=[];let h,c,d,u;for(c=(h=i)+a;h<c;++h)u=e[h],d={},d[n.axis]=s||n.parse(r[h],h),l.push(ja(u,d,o,h));return l}function Ya(t){return t&&void 0!==t.barStart&&void 0!==t.barEnd}class Ua extends Pi{parsePrimitiveData(t,e,i,a){return $a(t,e,i,a)}parseArrayData(t,e,i,a){return $a(t,e,i,a)}parseObjectData(t,e,i,a){const{iScale:n,vScale:o}=t,{xAxisKey:r="x",yAxisKey:s="y"}=this._parsing,l="x"===n.axis?r:s,h="x"===o.axis?r:s,c=[];let d,u,g,f;for(u=(d=i)+a;d<u;++d)f=e[d],g={},g[n.axis]=n.parse(ot(f,l),d),c.push(ja(ot(f,h),g,o,d));return c}updateRangeFromParsed(t,e,i,a){super.updateRangeFromParsed(t,e,i,a);i=i._custom;i&&e===this._cachedMeta.vScale&&(t.min=Math.min(t.min,i.min),t.max=Math.max(t.max,i.max))}getLabelAndValue(t){const e=this._cachedMeta,{iScale:i,vScale:a}=e,n=this.getParsed(t),o=n._custom,r=Ya(o)?"["+o.start+", "+o.end+"]":""+a.getLabelForValue(n[a.axis]);return{label:""+i.getLabelForValue(n[i.axis]),value:r}}initialize(){this.enableOptionSharing=!0,super.initialize(),this._cachedMeta.stack=this.getDataset().stack}update(t){var e=this._cachedMeta;this.updateElements(e.data,0,e.data.length,t)}updateElements(e,i,a,n){const o=this,r="reset"===n,s=o._cachedMeta.vScale,l=s.getBasePixel(),h=s.isHorizontal(),c=o._getRuler(),t=o.resolveDataElementOptions(i,n),d=o.getSharedOptions(t),u=o.includeOptions(n,d);o.updateSharedOptions(d,n,t);for(let t=i;t<i+a;t++){const i=o.getParsed(t),a=r||H(i[s.axis])?{base:l,head:l}:o._calculateBarValuePixels(t),g=o._calculateBarIndexPixels(t,c),f=(i._stacks||{})[s.axis],p={horizontal:h,base:a.base,enableBorderRadius:!f||Ya(i._custom)||o.index===f._top||o.index===f._bottom,x:h?a.head:g.center,y:h?g.center:a.head,height:h?g.size:void 0,width:h?void 0:g.size};u&&(p.options=d||o.resolveDataElementOptions(t,n)),o.updateElement(e[t],t,p,n)}}_getStacks(t,e){const i=this._cachedMeta.iScale,a=i.getMatchingVisibleMetas(this._type),n=i.options.stacked,o=a.length,r=[];let s,l;for(s=0;s<o;++s){if(l=a[s],void 0!==e){const t=l.controller.getParsed(e)[l.controller._cachedMeta.vScale.axis];if(H(t)||isNaN(t))continue}if((!1===n||-1===r.indexOf(l.stack)||void 0===n&&void 0===l.stack)&&r.push(l.stack),l.index===t)break}return r.length||r.push(void 0),r}_getStackCount(t){return this._getStacks(void 0,t).length}_getStackIndex(t,e,i){const a=this._getStacks(t,i),n=void 0!==e?a.indexOf(e):-1;return-1===n?a.length-1:n}_getRuler(){const t=this.options,e=this._cachedMeta,i=e.iScale,a=[];let n,o;for(n=0,o=e.data.length;n<o;++n)a.push(i.getPixelForValue(this.getParsed(n)[i.axis],n));var r=t.barThickness;return{min:r||function(t){var e=function(a){if(!a._cache.$bar){const n=a.getMatchingVisibleMetas("bar");let i=[];for(let t=0,e=n.length;t<e;t++)i=i.concat(n[t].controller.getAllParsedValues(a));a._cache.$bar=se(i.sort((t,e)=>t-e))}return a._cache.$bar}(t);let i,a,n,o,r=t._length;var s=()=>{32767!==n&&-32768!==n&&(st(o)&&(r=Math.min(r,Math.abs(n-o)||r)),o=n)};for(i=0,a=e.length;i<a;++i)n=t.getPixelForValue(e[i]),s();for(o=void 0,i=0,a=t.ticks.length;i<a;++i)n=t.getPixelForTick(i),s();return r}(i),pixels:a,start:i._startPixel,end:i._endPixel,stackCount:this._getStackCount(),scale:i,grouped:t.grouped,ratio:r?1:t.categoryPercentage*t.barPercentage}}_calculateBarValuePixels(t){const{vScale:e,_stacked:i}=this._cachedMeta,{base:a,minBarLength:n}=this.options,o=this.getParsed(t),r=o._custom,s=Ya(r);let l,h,c=o[e.axis],d=0,u=i?this.applyStack(e,o,i):c;u!==c&&(d=u-c,u=c),s&&(c=r.barStart,u=r.barEnd-r.barStart,0!==c&&kt(c)!==kt(r.barEnd)&&(d=0),d+=c);var g=H(a)||s?d:a;let f=e.getPixelForValue(g);l=this.chart.getDataVisibility(t)?e.getPixelForValue(d+u):f,h=l-f,void 0!==n&&Math.abs(h)<n&&(h=h<0?-n:n,0===c&&(f-=h/2),l=f+h);t=a||0;if(f===e.getPixelForValue(t)){const p=e.getLineWidthForValue(t)/2;0<h?(f+=p,h-=p):h<0&&(f-=p,h+=p)}return{size:h,base:f,head:l,center:l+h/2}}_calculateBarIndexPixels(t,e){const i=this,a=e.scale,n=i.options,o=n.skipNull,r=U(n.maxBarThickness,1/0);let s,l;if(e.grouped){const a=o?i._getStackCount(t):e.stackCount,h=("flex"===n.barThickness?function(t,e,i,a){var n=e.pixels,o=n[t];let r=0<t?n[t-1]:null,s=t<n.length-1?n[t+1]:null;t=i.categoryPercentage;null===r&&(r=o-(null===s?e.end-e.start:s-o)),null===s&&(s=o+o-r);o-=(o-Math.min(r,s))/2*t;return{chunk:Math.abs(s-r)/2*t/a,ratio:i.barPercentage,start:o}}:function(t,e,i,a){var n=i.barThickness;let o,r;return r=H(n)?(o=e.min*i.categoryPercentage,i.barPercentage):(o=n*a,1),{chunk:o/a,ratio:r,start:e.pixels[t]-o/2}})(t,e,n,a),c=i._getStackIndex(i.index,i._cachedMeta.stack,o?t:void 0);s=h.start+h.chunk*c+h.chunk/2,l=Math.min(r,h.chunk*h.ratio)}else s=a.getPixelForValue(i.getParsed(t)[a.axis],t),l=Math.min(r,e.min*e.ratio);return{base:s-l/2,head:s+l/2,center:s,size:l}}draw(){const t=this.chart,e=this._cachedMeta,i=e.vScale,a=e.data,n=a.length;let o=0;for(qt(t.ctx,t.chartArea);o<n;++o)null!==this.getParsed(o)[i.axis]&&a[o].draw(this._ctx);Kt(t.ctx)}}Ua.id="bar",Ua.defaults={datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}},Ua.overrides={interaction:{mode:"index"},scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}};class Xa extends Pi{initialize(){this.enableOptionSharing=!0,super.initialize()}parseObjectData(t,e,i,a){const{xScale:n,yScale:o}=t,{xAxisKey:r="x",yAxisKey:s="y"}=this._parsing,l=[];let h,c,d;for(c=(h=i)+a;h<c;++h)d=e[h],l.push({x:n.parse(ot(d,r),h),y:o.parse(ot(d,s),h),_custom:d&&d.r&&+d.r});return l}getMaxOverflow(){const{data:e,_parsed:i}=this._cachedMeta;let a=0;for(let t=e.length-1;0<=t;--t)a=Math.max(a,e[t].size()/2,i[t]._custom);return 0<a&&a}getLabelAndValue(t){const e=this._cachedMeta,{xScale:i,yScale:a}=e,n=this.getParsed(t),o=i.getLabelForValue(n.x),r=a.getLabelForValue(n.y),s=n._custom;return{label:e.label,value:"("+o+", "+r+(s?", "+s:"")+")"}}update(t){var e=this._cachedMeta.data;this.updateElements(e,0,e.length,t)}updateElements(e,i,a,n){const o=this,r="reset"===n,{xScale:s,yScale:l}=o._cachedMeta,t=o.resolveDataElementOptions(i,n),h=o.getSharedOptions(t),c=o.includeOptions(n,h);for(let t=i;t<i+a;t++){const i=e[t],a=!r&&o.getParsed(t),h=r?s.getPixelForDecimal(.5):s.getPixelForValue(a.x),d=r?l.getBasePixel():l.getPixelForValue(a.y),u={x:h,y:d,skip:isNaN(h)||isNaN(d)};c&&(u.options=o.resolveDataElementOptions(t,n),r&&(u.options.radius=0)),o.updateElement(i,t,u,n)}o.updateSharedOptions(h,n,t)}resolveDataElementOptions(t,e){var i=this.getParsed(t);let a=super.resolveDataElementOptions(t,e);a.$shared&&(a=Object.assign({},a,{$shared:!1}));t=a.radius;return"active"!==e&&(a.radius=0),a.radius+=U(i&&i._custom,t),a}}Xa.id="bubble",Xa.defaults={datasetElementType:!1,dataElementType:"point",animations:{numbers:{type:"number",properties:["x","y","borderWidth","radius"]}}},Xa.overrides={scales:{x:{type:"linear"},y:{type:"linear"}},plugins:{tooltip:{callbacks:{title:()=>""}}}};class qa extends Pi{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,a=this._cachedMeta;let n,o;for(o=(n=t)+e;n<o;++n)a._parsed[n]=+i[n]}_getRotation(){return Tt(this.options.rotation-90)}_getCircumference(){return Tt(this.options.circumference)}_getRotationExtents(){let e=mt,i=-mt;for(let t=0;t<this.chart.data.datasets.length;++t)if(this.chart.isDatasetVisible(t)){const a=this.chart.getDatasetMeta(t).controller,n=a._getRotation(),o=a._getCircumference();e=Math.min(e,n),i=Math.max(i,n+o)}return{rotation:e,circumference:i-e}}update(t){const e=this,i=e.chart,{chartArea:a}=i,n=e._cachedMeta,o=n.data,r=e.getMaxBorderWidth()+e.getMaxOffset(o),s=Math.max((Math.min(a.width,a.height)-r)/2,0),l=Math.min(X(e.options.cutout,s),1),h=e._getRingWeight(e.index),{circumference:c,rotation:d}=e._getRotationExtents(),{ratioX:u,ratioY:g,offsetX:f,offsetY:p}=function(t,e,a){let i=1,n=1,o=0,r=0;if(e<mt){const s=t,l=s+e,h=Math.cos(s),c=Math.sin(s),d=Math.cos(l),u=Math.sin(l),g=(t,e,i)=>Vt(t,s,l)?1:Math.max(e,e*a,i,i*a),f=(t,e,i)=>Vt(t,s,l)?-1:Math.min(e,e*a,i,i*a),p=g(0,h,d),m=g(_t,c,u),x=f(pt,h,d),b=f(pt+_t,c,u);i=(p-x)/2,n=(m-b)/2,o=-(p+x)/2,r=-(m+b)/2}return{ratioX:i,ratioY:n,offsetX:o,offsetY:r}}(d,c,l),m=(a.width-r)/u,x=(a.height-r)/g,b=Math.max(Math.min(m,x)/2,0),v=q(e.options.radius,b),_=(v-Math.max(v*l,0))/e._getVisibleDatasetWeightTotal();e.offsetX=f*v,e.offsetY=p*v,n.total=e.calculateTotal(),e.outerRadius=v-_*e._getRingWeightOffset(e.index),e.innerRadius=Math.max(e.outerRadius-_*h,0),e.updateElements(o,0,o.length,t)}_circumference(t,e){var i=this.options,a=this._cachedMeta,n=this._getCircumference();return e&&i.animation.animateRotate||!this.chart.getDataVisibility(t)||null===a._parsed[t]?0:this.calculateCircumference(a._parsed[t]*n/mt)}updateElements(t,e,i,a){const n=this,o="reset"===a,r=n.chart,s=r.chartArea,l=r.options.animation,h=(s.left+s.right)/2,c=(s.top+s.bottom)/2,d=o&&l.animateScale,u=d?0:n.innerRadius,g=d?0:n.outerRadius,f=n.resolveDataElementOptions(e,a),p=n.getSharedOptions(f),m=n.includeOptions(a,p);let x,b=n._getRotation();for(x=0;x<e;++x)b+=n._circumference(x,o);for(x=e;x<e+i;++x){const e=n._circumference(x,o),i=t[x],r={x:h+n.offsetX,y:c+n.offsetY,startAngle:b,endAngle:b+e,circumference:e,outerRadius:g,innerRadius:u};m&&(r.options=p||n.resolveDataElementOptions(x,a)),b+=e,n.updateElement(i,x,r,a)}n.updateSharedOptions(p,a,f)}calculateTotal(){const t=this._cachedMeta,e=t.data;let i,a=0;for(i=0;i<e.length;i++){const e=t._parsed[i];null!==e&&!isNaN(e)&&this.chart.getDataVisibility(i)&&(a+=Math.abs(e))}return a}calculateCircumference(t){var e=this._cachedMeta.total;return 0<e&&!isNaN(t)?mt*(Math.abs(t)/e):0}getLabelAndValue(t){var e=this._cachedMeta,i=this.chart,a=i.data.labels||[],i=Oi(e._parsed[t],i.options.locale);return{label:a[t]||"",value:i}}getMaxBorderWidth(t){let e=0;const i=this.chart;let a,n,o,r,s;if(!t)for(a=0,n=i.data.datasets.length;a<n;++a)if(i.isDatasetVisible(a)){t=(o=i.getDatasetMeta(a)).data,r=o.controller,r!==this&&r.configure();break}if(!t)return 0;for(a=0,n=t.length;a<n;++a)"inner"!==(s=r.resolveDataElementOptions(a)).borderAlign&&(e=Math.max(e,s.borderWidth||0,s.hoverBorderWidth||0));return e}getMaxOffset(i){let a=0;for(let t=0,e=i.length;t<e;++t){const i=this.resolveDataElementOptions(t);a=Math.max(a,i.offset||0,i.hoverOffset||0)}return a}_getRingWeightOffset(e){let i=0;for(let t=0;t<e;++t)this.chart.isDatasetVisible(t)&&(i+=this._getRingWeight(t));return i}_getRingWeight(t){return Math.max(U(this.chart.data.datasets[t].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}qa.id="doughnut",qa.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"},qa.overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(a){const t=a.data;return t.labels.length&&t.datasets.length?t.labels.map((t,e)=>{var i=a.getDatasetMeta(0).controller.getStyle(e);return{text:t,fillStyle:i.backgroundColor,strokeStyle:i.borderColor,lineWidth:i.borderWidth,hidden:!a.getDataVisibility(e),index:e}}):[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}},tooltip:{callbacks:{title:()=>"",label(t){let e=t.label;t=": "+t.formattedValue;return N(e)?(e=e.slice(),e[0]+=t):e+=t,e}}}}};class Ka extends Pi{initialize(){this.enableOptionSharing=!0,super.initialize()}update(t){const e=this,n=e._cachedMeta,{dataset:i,data:a=[],_dataset:o}=n,r=e.chart._animationsDisabled;let{start:s,count:l}=function(t,e,i){var a=e.length;let n=0,o=a;if(t._sorted){const{iScale:r,_parsed:s}=t,l=r.axis,{min:h,max:c,minDefined:d,maxDefined:u}=r.getUserBounds();d&&(n=Bt(Math.min(ee(s,r.axis,h).lo,i?a:ee(e,l,r.getPixelForValue(h)).lo),0,a-1)),o=u?Bt(Math.max(ee(s,r.axis,c).hi+1,i?0:ee(e,l,r.getPixelForValue(c)).hi+1),n,a)-n:a-n}return{start:n,count:o}}(n,a,r);e._drawStart=s,e._drawCount=l,function(){var{xScale:t,yScale:e,_scaleRanges:i}=n,a={xmin:t.min,xmax:t.max,ymin:e.min,ymax:e.max};if(!i)return n._scaleRanges=a,1;e=i.xmin!==t.min||i.xmax!==t.max||i.ymin!==e.min||i.ymax!==e.max;return Object.assign(i,a),e}()&&(s=0,l=a.length),i._decimated=!!o._decimated,i.points=a;const h=e.resolveDatasetElementOptions(t);e.options.showLine||(h.borderWidth=0),h.segment=e.options.segment,e.updateElement(i,void 0,{animated:!r,options:h},t),e.updateElements(a,s,l,t)}updateElements(e,i,a,n){const o=this,r="reset"===n,{xScale:s,yScale:l,_stacked:h}=o._cachedMeta,t=o.resolveDataElementOptions(i,n),c=o.getSharedOptions(t),d=o.includeOptions(n,c),u=o.options.spanGaps,g=Dt(u)?u:Number.POSITIVE_INFINITY,f=o.chart._animationsDisabled||r||"none"===n;let p=0<i&&o.getParsed(i-1);for(let t=i;t<i+a;++t){const i=e[t],a=o.getParsed(t),u=f?i:{},m=H(a.y),x=u.x=s.getPixelForValue(a.x,t),b=u.y=r||m?l.getBasePixel():l.getPixelForValue(h?o.applyStack(l,a,h):a.y,t);u.skip=isNaN(x)||isNaN(b)||m,u.stop=0<t&&a.x-p.x>g,u.parsed=a,d&&(u.options=c||o.resolveDataElementOptions(t,n)),f||o.updateElement(i,t,u,n),p=a}o.updateSharedOptions(c,n,t)}getMaxOverflow(){const t=this._cachedMeta,e=t.dataset,i=e.options&&e.options.borderWidth||0,a=t.data||[];if(!a.length)return i;var n=a[0].size(this.resolveDataElementOptions(0)),o=a[a.length-1].size(this.resolveDataElementOptions(a.length-1));return Math.max(i,n,o)/2}draw(){this._cachedMeta.dataset.updateControlPoints(this.chart.chartArea),super.draw()}}Ka.id="line",Ka.defaults={datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1},Ka.overrides={scales:{_index_:{type:"category"},_value_:{type:"linear"}}};class Ga extends Pi{constructor(t,e){super(t,e),this.innerRadius=void 0,this.outerRadius=void 0}update(t){var e=this._cachedMeta.data;this._updateRadius(),this.updateElements(e,0,e.length,t)}_updateRadius(){const t=this,e=t.chart,i=e.chartArea,a=e.options,n=Math.min(i.right-i.left,i.bottom-i.top),o=Math.max(n/2,0),r=(o-Math.max(a.cutoutPercentage?o/100*a.cutoutPercentage:1,0))/e.getVisibleDatasetCount();t.outerRadius=o-r*t.index,t.innerRadius=t.outerRadius-r}updateElements(a,n,t,o){const r=this,s="reset"===o,l=r.chart,h=r.getDataset(),c=l.options.animation,d=r._cachedMeta.rScale,u=d.xCenter,g=d.yCenter,f=d.getIndexAngle(0)-.5*pt;let p,m=f;var x=360/r.countVisibleElements();for(p=0;p<n;++p)m+=r._computeAngle(p,o,x);for(p=n;p<n+t;p++){const n=a[p];let t=m,e=m+r._computeAngle(p,o,x),i=l.getDataVisibility(p)?d.getDistanceFromCenterForValue(h.data[p]):0;m=e,s&&(c.animateScale&&(i=0),c.animateRotate&&(t=e=f));var b={x:u,y:g,innerRadius:0,outerRadius:i,startAngle:t,endAngle:e,options:r.resolveDataElementOptions(p,o)};r.updateElement(n,p,b,o)}}countVisibleElements(){const i=this.getDataset(),t=this._cachedMeta;let a=0;return t.data.forEach((t,e)=>{!isNaN(i.data[e])&&this.chart.getDataVisibility(e)&&a++}),a}_computeAngle(t,e,i){return this.chart.getDataVisibility(t)?Tt(this.resolveDataElementOptions(t,e).angle||i):0}}Ga.id="polarArea",Ga.defaults={dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0},Ga.overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(a){const t=a.data;return t.labels.length&&t.datasets.length?t.labels.map((t,e)=>{var i=a.getDatasetMeta(0).controller.getStyle(e);return{text:t,fillStyle:i.backgroundColor,strokeStyle:i.borderColor,lineWidth:i.borderWidth,hidden:!a.getDataVisibility(e),index:e}}):[]}},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 Za extends qa{}Za.id="pie",Za.defaults={cutout:0,rotation:0,circumference:360,radius:"100%"};class Qa extends Pi{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,a=i.dataset,n=i.data||[],o=i.iScale.getLabels();if(a.points=n,"resize"!==t){const i=e.resolveDatasetElementOptions(t);e.options.showLine||(i.borderWidth=0);var r={_loop:!0,_fullLoop:o.length===n.length,options:i};e.updateElement(a,void 0,r,t)}e.updateElements(n,0,n.length,t)}updateElements(e,i,a,n){const o=this.getDataset(),r=this._cachedMeta.rScale,s="reset"===n;for(let t=i;t<i+a;t++){const i=e[t],a=this.resolveDataElementOptions(t,n),l=r.getPointPositionForValue(t,o.data[t]),h=s?r.xCenter:l.x,c=s?r.yCenter:l.y,d={x:h,y:c,angle:l.angle,skip:isNaN(h)||isNaN(c),options:a};this.updateElement(i,t,d,n)}}}Qa.id="radar",Qa.defaults={datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:!0,elements:{line:{fill:"start"}}},Qa.overrides={aspectRatio:1,scales:{r:{type:"radialLinear"}}};class Ja extends Ka{}Ja.id="scatter",Ja.defaults={showLine:!1,fill:!1},Ja.overrides={interaction:{mode:"point"},plugins:{tooltip:{callbacks:{title:()=>"",label:t=>"("+t.label+", "+t.formattedValue+")"}}},scales:{x:{type:"linear"},y:{type:"linear"}}};var tn=Object.freeze({__proto__:null,BarController:Ua,BubbleController:Xa,DoughnutController:qa,LineController:Ka,PolarAreaController:Ga,PieController:Za,RadarController:Qa,ScatterController:Ja});function en(t,e){var{startAngle:i,endAngle:a,pixelMargin:n,x:o,y:r,outerRadius:s,innerRadius:l}=e,e=n/s;t.beginPath(),t.arc(o,r,s,i-e,a+e),n<l?t.arc(o,r,l,a+(e=n/l),i-e,!0):t.arc(o,r,n,a+_t,i-_t),t.closePath(),t.clip()}function an(t,e,i,a){return{x:i+t*Math.cos(e),y:a+t*Math.sin(e)}}function nn(t,e){var{x:i,y:a,startAngle:n,endAngle:o,pixelMargin:r}=e,s=Math.max(e.outerRadius-r,0),l=e.innerRadius+r,{outerStart:h,outerEnd:c,innerStart:d,innerEnd:u}=function(t,e,i,a){t=Oe(t.options.borderRadius,["outerStart","outerEnd","innerStart","innerEnd"]);const n=(i-e)/2,o=Math.min(n,a*e/2),r=t=>{var e=(i-Math.min(n,t))*a/2;return Bt(t,0,Math.min(n,e))};return{outerStart:r(t.outerStart),outerEnd:r(t.outerEnd),innerStart:Bt(t.innerStart,0,o),innerEnd:Bt(t.innerEnd,0,o)}}(e,l,s,o-n),g=s-h,f=s-c,p=n+h/g,m=o-c/f,x=l+d,b=l+u,r=n+d/x,e=o-u/b;if(t.beginPath(),t.arc(i,a,s,p,m),0<c){const v=an(f,m,i,a);t.arc(v.x,v.y,c,m,o+_t)}m=an(b,o,i,a);if(t.lineTo(m.x,m.y),0<u){const v=an(b,e,i,a);t.arc(v.x,v.y,u,o+_t,e+Math.PI)}if(t.arc(i,a,l,o-u/l,n+d/l,!0),0<d){const v=an(x,r,i,a);t.arc(v.x,v.y,d,r+Math.PI,n-_t)}r=an(g,n,i,a);if(t.lineTo(r.x,r.y),0<h){const v=an(g,p,i,a);t.arc(v.x,v.y,h,n-_t,p)}t.closePath()}function on(t,e){var{options:i}=e,a="inner"===i.borderAlign;i.borderWidth&&(a?(t.lineWidth=2*i.borderWidth,t.lineJoin="round"):(t.lineWidth=i.borderWidth,t.lineJoin="bevel"),e.fullCircles&&function(t,e,i){var{x:a,y:n,startAngle:o,endAngle:r,pixelMargin:s}=e,l=Math.max(e.outerRadius-s,0),s=e.innerRadius+s;let h;for(i&&(e.endAngle=e.startAngle+mt,en(t,e),e.endAngle=r,e.endAngle===e.startAngle&&(e.endAngle+=mt,e.fullCircles--)),t.beginPath(),t.arc(a,n,s,o+mt,o,!0),h=0;h<e.fullCircles;++h)t.stroke();for(t.beginPath(),t.arc(a,n,l,o,o+mt),h=0;h<e.fullCircles;++h)t.stroke()}(t,e,a),a&&en(t,e),nn(t,e),t.stroke())}class rn extends Di{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){var{angle:a,distance:n}=Et(this.getProps(["x","y"],i),{x:t,y:e}),{startAngle:o,endAngle:r,innerRadius:t,outerRadius:e,circumference:i}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],i);return(i>=mt||Vt(a,o,r))&&t<=n&&n<=e}getCenterPoint(t){var{x:e,y:i,startAngle:a,endAngle:n,innerRadius:o,outerRadius:t}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],t),n=(a+n)/2,t=(o+t)/2;return{x:e+Math.cos(n)*t,y:i+Math.sin(n)*t}}tooltipPosition(t){return this.getCenterPoint(t)}draw(t){const e=this,i=e.options,a=i.offset||0;if(e.pixelMargin="inner"===i.borderAlign?.33:0,e.fullCircles=Math.floor(e.circumference/mt),!(0===e.circumference||e.innerRadius<0||e.outerRadius<0)){if(t.save(),a&&e.circumference<mt){const i=(e.startAngle+e.endAngle)/2;t.translate(Math.cos(i)*a,Math.sin(i)*a)}t.fillStyle=i.backgroundColor,t.strokeStyle=i.borderColor,function(e,i){if(i.fullCircles){i.endAngle=i.startAngle+mt,nn(e,i);for(let t=0;t<i.fullCircles;++t)e.fill()}isNaN(i.circumference)||(i.endAngle=i.startAngle+i.circumference%mt),nn(e,i),e.fill()}(t,e),on(t,e),t.restore()}}}function sn(t,e,i=e){t.lineCap=U(i.borderCapStyle,e.borderCapStyle),t.setLineDash(U(i.borderDash,e.borderDash)),t.lineDashOffset=U(i.borderDashOffset,e.borderDashOffset),t.lineJoin=U(i.borderJoinStyle,e.borderJoinStyle),t.lineWidth=U(i.borderWidth,e.borderWidth),t.strokeStyle=U(i.borderColor,e.borderColor)}function ln(t,e,i){t.lineTo(i.x,i.y)}function hn(t,e,i={}){var a=t.length,{start:n=0,end:o=a-1}=i,{start:r,end:s}=e,t=Math.max(n,r),i=Math.min(o,s);return{count:a,start:t,loop:e.loop,ilen:i<t&&!(n<r&&o<r||s<n&&s<o)?a+i-t:i-t}}function cn(t,e,i,a){const{points:n,options:o}=e,{count:r,start:s,loop:l,ilen:h}=hn(n,i,a),c=o.stepped?Gt:o.tension||"monotone"===o.cubicInterpolationMode?Zt:ln;let d,u,g,{move:f=!0,reverse:p}=a||{};for(d=0;d<=h;++d)u=n[(s+(p?h-d:d))%r],u.skip||(f?(t.moveTo(u.x,u.y),f=!1):c(t,g,u,p,o.stepped),g=u);return l&&(u=n[(s+(p?h:0))%r],c(t,g,u,p,o.stepped)),!!l}function dn(t,e,i,a){const n=e.points,{count:o,start:r,ilen:s}=hn(n,i,a),{move:l=!0,reverse:h}=a||{};let c,d,u,g,f,p,m=0,x=0;var b=t=>(r+(h?s-t:t))%o,v=()=>{g!==f&&(t.lineTo(m,f),t.lineTo(m,g),t.lineTo(m,p))};for(l&&(d=n[b(0)],t.moveTo(d.x,d.y)),c=0;c<=s;++c)if(d=n[b(c)],!d.skip){const e=d.x,i=d.y,a=0|e;a===u?(i<g?g=i:i>f&&(f=i),m=(x*m+e)/++x):(v(),t.lineTo(e,i),u=a,x=0,g=f=i),p=i}v()}function un(t){var e=t.options,i=e.borderDash&&e.borderDash.length;return t._decimated||t._loop||e.tension||"monotone"===e.cubicInterpolationMode||e.stepped||i?cn:dn}rn.id="arc",rn.defaults={borderAlign:"center",borderColor:"#fff",borderRadius:0,borderWidth:2,offset:0,angle:void 0},rn.defaultRoutes={backgroundColor:"backgroundColor"};const gn="function"==typeof Path2D;class fn extends Di{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){var e,i=this.options;!i.tension&&"monotone"!==i.cubicInterpolationMode||i.stepped||this._pointsUpdated||(e=i.spanGaps?this._loop:this._fullLoop,ia(this._points,i,t,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=ga(this,this.options.segment))}first(){var t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){var t=this.segments,e=this.points,i=t.length;return i&&e[t[i-1].end]}interpolate(i,a){const n=this,o=n.options,r=i[a],s=n.points,l=ua(n,{property:a,start:r,end:r});if(l.length){const h=[],c=o.stepped?na:o.tension||"monotone"===o.cubicInterpolationMode?oa:aa;let e,t;for(e=0,t=l.length;e<t;++e){const{start:n,end:t}=l[e],d=s[n],u=s[t];if(d!==u){const g=c(d,u,Math.abs((r-d[a])/(u[a]-d[a])),o.stepped);g[a]=i[a],h.push(g)}else h.push(d)}return 1===h.length?h[0]:h}}pathSegment(t,e,i){return un(this)(t,this,e,i)}path(t,e,i){const a=this.segments,n=un(this);let o=this._loop;e=e||0,i=i||this.points.length-e;for(const r of a)o&=n(t,this,r,{start:e,end:e+i-1});return!!o}draw(t,e,i,a){var n,o=this.options||{};(this.points||[]).length&&o.borderWidth&&(t.save(),n=t,o=this,i=i,a=a,(gn&&1===o.segments.length?function(t,e,i,a){let n=e._path;n||(n=e._path=new Path2D,e.path(n,i,a)&&n.closePath()),sn(t,e.options),t.stroke(n)}:function(t,e,i,a){const{segments:n,options:o}=e,r=un(e);for(const s of n)sn(t,o,s.style),t.beginPath(),r(t,e,s,{start:i,end:i+a-1})&&t.closePath(),t.stroke()})(n,o,i,a),t.restore(),this.animated&&(this._pointsUpdated=!1,this._path=void 0))}}function pn(t,e,i,a){var n=t.options,{[i]:i}=t.getProps([i],a);return Math.abs(e-i)<n.radius+n.hitRadius}fn.id="line",fn.defaults={borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0},fn.defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"},fn.descriptors={_scriptable:!0,_indexable:t=>"borderDash"!==t&&"fill"!==t};class mn extends Di{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){var a=this.options,{x:n,y:i}=this.getProps(["x","y"],i);return Math.pow(t-n,2)+Math.pow(e-i,2)<Math.pow(a.hitRadius+a.radius,2)}inXRange(t,e){return pn(this,t,"x",e)}inYRange(t,e){return pn(this,t,"y",e)}getCenterPoint(t){var{x:e,y:t}=this.getProps(["x","y"],t);return{x:e,y:t}}size(t){var e=(t=t||this.options||{}).radius||0;return 2*((e=Math.max(e,e&&t.hoverRadius||0))+(e&&t.borderWidth||0))}draw(t){var e=this.options;this.skip||e.radius<.1||(t.strokeStyle=e.borderColor,t.lineWidth=e.borderWidth,t.fillStyle=e.backgroundColor,Ut(t,e,this.x,this.y))}getRange(){var t=this.options||{};return t.radius+t.hitRadius}}function xn(t,e){var{x:i,y:a,base:n,width:o,height:e}=t.getProps(["x","y","base","width","height"],e);let r,s,l,h,c;return h=t.horizontal?(c=e/2,r=Math.min(i,n),s=Math.max(i,n),l=a-c,a+c):(c=o/2,r=i-c,s=i+c,l=Math.min(a,n),Math.max(a,n)),{left:r,top:l,right:s,bottom:h}}function bn(t){let e=t.options.borderSkipped;const i={};return e&&(e=t.horizontal?vn(e,"left","right",t.base>t.x):vn(e,"bottom","top",t.base<t.y),i[e]=!0),i}function vn(t,e,i,a){return t=a?_n(t=t===e?i:t===i?e:t,i,e):_n(t,e,i)}function _n(t,e,i){return"start"===t?e:"end"===t?i:t}function yn(t,e,i,a){return t?0:Math.max(Math.min(e,a),i)}function wn(t,e,i,a){var n=null===e,o=null===i,a=t&&!(n&&o)&&xn(t,a);return a&&(n||e>=a.left&&e<=a.right)&&(o||i>=a.top&&i<=a.bottom)}function Mn(t,e){t.rect(e.x,e.y,e.w,e.h)}mn.id="point",mn.defaults={borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0},mn.defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};class kn extends Di{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:a}=(h=xn(o=this),c=h.right-h.left,d=h.bottom-h.top,u=c/2,s=d/2,l=(r=o).options.borderWidth,r=bn(r),l=Ae(l),u={t:yn(r.top,l.top,0,s),r:yn(r.right,l.right,0,u),b:yn(r.bottom,l.bottom,0,s),l:yn(r.left,l.left,0,u)},o=function(t,e,i){var{enableBorderRadius:a}=t.getProps(["enableBorderRadius"]),n=t.options.borderRadius,o=Te(n),i=Math.min(e,i),t=bn(t),n=a||j(n);return{topLeft:yn(!n||t.top||t.left,o.topLeft,0,i),topRight:yn(!n||t.top||t.right,o.topRight,0,i),bottomLeft:yn(!n||t.bottom||t.left,o.bottomLeft,0,i),bottomRight:yn(!n||t.bottom||t.right,o.bottomRight,0,i)}}(o,c/2,d/2),{outer:{x:h.left,y:h.top,w:c,h:d,radius:o},inner:{x:h.left+u.l,y:h.top+u.t,w:c-u.l-u.r,h:d-u.t-u.b,radius:{topLeft:Math.max(0,o.topLeft-Math.max(u.t,u.l)),topRight:Math.max(0,o.topRight-Math.max(u.t,u.r)),bottomLeft:Math.max(0,o.bottomLeft-Math.max(u.b,u.l)),bottomRight:Math.max(0,o.bottomRight-Math.max(u.b,u.r))}}}),n=(u=a.radius).topLeft||u.topRight||u.bottomLeft||u.bottomRight?Jt:Mn;var o,r,s,l,h,c,d,u;t.save(),a.w===i.w&&a.h===i.h||(t.beginPath(),n(t,a),t.clip(),n(t,i),t.fillStyle=e.borderColor,t.fill("evenodd")),t.beginPath(),n(t,i),t.fillStyle=e.backgroundColor,t.fill(),t.restore()}inRange(t,e,i){return wn(this,t,e,i)}inXRange(t,e){return wn(this,t,null,e)}inYRange(t,e){return wn(this,null,t,e)}getCenterPoint(t){var{x:e,y:i,base:a,horizontal:t}=this.getProps(["x","y","base","horizontal"],t);return{x:t?(e+a)/2:e,y:t?i:(i+a)/2}}getRange(t){return"x"===t?this.width/2:this.height/2}}kn.id="bar",kn.defaults={borderSkipped:"start",borderWidth:0,borderRadius:0,enableBorderRadius:!0,pointStyle:void 0},kn.defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};var Sn=Object.freeze({__proto__:null,ArcElement:rn,LineElement:fn,PointElement:mn,BarElement:kn});function Pn(t){var e;t._decimated&&(e=t._data,delete t._decimated,delete t._data,Object.defineProperty(t,"data",{value:e}))}function Dn(t){t.data.datasets.forEach(t=>{Pn(t)})}var Cn={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(i,t,w)=>{if(w.enabled){const r=i.width;i.data.datasets.forEach((a,t)=>{var{_data:n,indexAxis:e}=a,h=i.getDatasetMeta(t),o=n||a.data;if("y"!==Ee([e,i.options.indexAxis])&&"line"===h.type){e=i.scales[h.xAxisID];if(("linear"===e.type||"time"===e.type)&&!i.options.parsing){let t,{start:e,count:i}=function(t){var e=t.length;let i,a=0;const{iScale:n}=h,{min:o,max:r,minDefined:s,maxDefined:l}=n.getUserBounds();return s&&(a=Bt(ee(t,n.axis,o).lo,0,e-1)),i=l?Bt(ee(t,n.axis,r).hi+1,a,e)-a:e-a,{start:a,count:i}}(o);if(i<=4*r)Pn(a);else{switch(H(n)&&(a._data=o,delete a.data,Object.defineProperty(a,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(t){this._data=t}})),w.algorithm){case"lttb":t=function(a,n,o,t){var e=w.samples||t;if(o<=e)return a.slice(n,n+o);const r=[],s=(o-2)/(e-2);let l=0;const h=n+o-1;let c,d,u,g,f,p=n;for(r[l++]=a[p],c=0;c<e-2;c++){let t,e=0,i=0;const h=Math.floor((c+1)*s)+1+n,_=Math.min(Math.floor((c+2)*s)+1,o)+n,y=_-h;for(t=h;t<_;t++)e+=a[t].x,i+=a[t].y;e/=y,i/=y;var m=Math.floor(c*s)+1+n,x=Math.floor((c+1)*s)+1+n,{x:b,y:v}=a[p];for(u=-1,t=m;t<x;t++)(g=.5*Math.abs((b-e)*(a[t].y-v)-(b-a[t].x)*(i-v)))>u&&(u=g,d=a[t],f=t);r[l++]=d,p=f}return r[l++]=a[h],r}(o,e,i,r);break;case"min-max":t=function(t,e,i,a){let n,o,r,s,l,h,c,d,u,g,f=0,p=0;const m=[],x=e+i-1,b=t[e].x,v=t[x].x-b;for(n=e;n<e+i;++n){r=((o=t[n]).x-b)/v*a,s=o.y;const e=0|r;if(e===l)s<u?(u=s,h=n):s>g&&(g=s,c=n),f=(p*f+o.x)/++p;else{const i=n-1;if(!H(h)&&!H(c)){const e=Math.min(h,c),a=Math.max(h,c);e!==d&&e!==i&&m.push({...t[e],x:f}),a!==d&&a!==i&&m.push({...t[a],x:f})}0<n&&i!==d&&m.push(t[i]),m.push(o),l=e,p=0,u=g=s,h=c=d=n}}return m}(o,e,i,r);break;default:throw new Error(`Unsupported decimation algorithm '${w.algorithm}'`)}a._decimated=t}}}})}else Dn(i)},destroy(t){Dn(t)}};class On{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius}pathSegment(t,e,i){var{x:a,y:n,radius:o}=this;return e=e||{start:0,end:mt},t.arc(a,n,o,e.end,e.start,!0),!i.bounds}interpolate(t){var{x:e,y:i,radius:a}=this,t=t.angle;return{x:e+Math.cos(t)*a,y:i+Math.sin(t)*a,angle:t}}}function An(t){const{chart:e,scale:i,index:a,line:n}=t,o=[],r=n.segments,s=n.points,l=function(t,e){const i=[],a=t.getSortedVisibleDatasetMetas();for(let t=0;t<a.length;t++){var n=a[t];if(n.index===e)break;Tn(n)&&i.unshift(n.dataset)}return i}(e,a);l.push(Rn({x:null,y:i.bottom},n));for(let t=0;t<r.length;t++){const e=r[t];for(let t=e.start;t<=e.end;t++)!function(e,i,a){const n=[];for(let t=0;t<a.length;t++){var{first:o,last:r,point:s}=function(t,e,i){const a=t.interpolate(e,i);if(!a)return{};var n=a[i],o=t.segments,r=t.points;let s=!1,l=!1;for(let t=0;t<o.length;t++){const e=o[t],a=r[e.start][i],h=r[e.end][i];if(n>=a&&n<=h){s=n===a,l=n===h;break}}return{first:s,last:l,point:a}}(a[t],i,"x");if(!(!s||o&&r))if(o)n.unshift(s);else if(e.push(s),!r)break}e.push(...n)}(o,s[t],l)}return new fn({points:o,options:{}})}const Tn=t=>"line"===t.type&&!t.hidden;function Rn(t,e){let i=[],a=!1;return i=N(t)?(a=!0,t):function(){const{x:i=null,y:a=null}=t||{},n=e.points,o=[];return e.segments.forEach(t=>{var e=n[t.start],t=n[t.end];null!==a?(o.push({x:e.x,y:a}),o.push({x:t.x,y:a})):null!==i&&(o.push({x:i,y:e.y}),o.push({x:i,y:t.y}))}),o}(),i.length?new fn({points:i,options:{tension:0},_loop:a,_fullLoop:a}):null}function Ln(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 En(i,a,n,t){if(!t){let t=a[i],e=n[i];return"angle"===i&&(t=Ft(t),e=Ft(e)),{property:i,start:t,end:e}}}function In(t,e,i,a){return t&&e?a(t[i],e[i]):t?t[i]:e?e[i]:0}function zn(t,e,i,a){a=e.interpolate(i,a);a&&t.lineTo(a.x,a.y)}function Fn(t,e){const{line:i,target:a,property:n,color:o,scale:r}=e,s=function(t,e,i){const a=t.segments,n=t.points,o=e.points,r=[];for(const t of a){const a=En(i,n[t.start],n[t.end],t.loop);if(e.segments){var s=ua(e,a);for(const e of s){var l=En(i,o[e.start],o[e.end],e.loop),h=da(t,n,l);for(const t of h)r.push({source:t,target:e,start:{[i]:In(a,l,"start",Math.max)},end:{[i]:In(a,l,"end",Math.min)}})}}else r.push({source:t,target:a,start:n[t.start],end:n[t.end]})}return r}(i,a,n);for(const{source:e,target:c,start:d,end:u}of s){const{style:{backgroundColor:s=o}={}}=e;t.save(),t.fillStyle=s,function(t,e,i){var{top:a,bottom:n}=e.chart.chartArea,{property:o,start:e,end:i}=i||{};"x"===o&&(t.beginPath(),t.rect(e,a,i-e,n-a),t.clip())}(t,r,En(n,d,u)),t.beginPath();var l=!!i.pathSegment(t,e);l?t.closePath():zn(t,a,u,n);var h=!!a.pathSegment(t,c,{move:l,reverse:!0}),h=l&&h;h||zn(t,a,d,n),t.closePath(),t.fill(h?"evenodd":"nonzero"),t.restore()}}function Vn(t,e,i){var a=function(t){var e,i,{chart:a,fill:n,line:o}=t;if($(n))return i=n,(a=(e=a).getDatasetMeta(i))&&e.isDatasetVisible(i)?a.dataset:null;if("stack"===n)return An(t);var c,t=(((c=t).scale||{}).getPointPositionForValue?function(){const{scale:t,fill:e}=c,i=t.options,a=t.getLabels().length,n=[],o=i.reverse?t.max:t.min,r=i.reverse?t.min:t.max;let s,l,h;if(h="start"===e?o:"end"===e?r:j(e)?e.value:t.getBaseValue(),i.grid.circular)return l=t.getPointPositionForValue(0,o),new On({x:l.x,y:l.y,radius:t.getDistanceFromCenterForValue(h)});for(s=0;s<a;++s)n.push(t.getPointPositionForValue(s,h));return n}:function(){const{scale:t={},fill:e}=c;let i,a=null;return"start"===e?a=t.bottom:"end"===e?a=t.top:j(e)?a=t.getPixelForValue(e.value):t.getBasePixel&&(a=t.getBasePixel()),$(a)?{x:(i=t.isHorizontal())?a:null,y:i?null:a}:null})();return t instanceof On?t:Rn(t,o)}(e),{line:n,scale:o,axis:r}=e,s=n.options,e=s.fill,s=s.backgroundColor,{above:e=s,below:s=s}=e||{};a&&n.points.length&&(qt(t,i),function(t,e){var{line:i,target:a,above:n,below:o,area:r,scale:s}=e,e=i._loop?"angle":e.axis;t.save(),"x"===e&&o!==n&&(Ln(t,a,r.top),Fn(t,{line:i,target:a,color:n,scale:s,property:e}),t.restore(),t.save(),Ln(t,a,r.bottom)),Fn(t,{line:i,target:a,color:o,scale:s,property:e}),t.restore()}(t,{line:n,target:a,above:e,below:s,area:i,scale:o,axis:r}),Kt(t))}var Bn={id:"filler",afterDatasetsUpdate(t,e,i){const a=(t.data.datasets||[]).length,n=[];let o,r,s,l;for(r=0;r<a;++r)o=t.getDatasetMeta(r),s=o.dataset,l=null,s&&s.options&&s instanceof fn&&(l={visible:t.isDatasetVisible(r),index:r,fill:function(a,t,e){var i=function(){var t=a.options,e=t.fill;let i=U(e&&e.target,e);return void 0===i&&(i=!!t.backgroundColor),!1!==i&&null!==i&&(!0===i?"origin":i)}();if(j(i))return!isNaN(i.value)&&i;let n=parseFloat(i);return $(n)&&Math.floor(n)===n?("-"!==i[0]&&"+"!==i[0]||(n=t+n),!(n===t||n<0||n>=e)&&n):0<=["origin","start","end","stack"].indexOf(i)&&i}(s,r,a),chart:t,axis:o.controller.options.indexAxis,scale:o.vScale,line:s}),o.$filler=l,n.push(l);for(r=0;r<a;++r)l=n[r],l&&!1!==l.fill&&(l.fill=function(t,e,i){let a=t[e].fill;const n=[e];var o;if(!i)return a;for(;!1!==a&&-1===n.indexOf(a);){if(!$(a))return a;if(!(o=t[a]))return!1;if(o.visible)return a;n.push(a),a=o.fill}return!1}(n,r,i.propagate))},beforeDraw(e,t,i){var a="beforeDraw"===i.drawTime,n=e.getSortedVisibleDatasetMetas(),o=e.chartArea;for(let t=n.length-1;0<=t;--t){const i=n[t].$filler;i&&(i.line.updateControlPoints(o),a&&Vn(e.ctx,i,o))}},beforeDatasetsDraw(e,t,i){if("beforeDatasetsDraw"===i.drawTime){var a=e.getSortedVisibleDatasetMetas();for(let t=a.length-1;0<=t;--t){const i=a[t].$filler;i&&Vn(e.ctx,i,e.chartArea)}}},beforeDatasetDraw(t,e,i){e=e.meta.$filler;e&&!1!==e.fill&&"beforeDatasetDraw"===i.drawTime&&Vn(t.ctx,e,t.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const Wn=(t,e)=>{let{boxHeight:i=e,boxWidth:a=e}=t;return t.usePointStyle&&(i=Math.min(i,e),a=Math.min(a,e)),{boxWidth:a,boxHeight:i,itemHeight:Math.max(e,i)}};class Hn extends Di{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(){var 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 i=this,a=i.options.labels||{};let t=K(a.generateLabels,[i.chart],i)||[];a.filter&&(t=t.filter(t=>a.filter(t,i.chart.data))),a.sort&&(t=t.sort((t,e)=>a.sort(t,e,i.chart.data))),i.options.reverse&&t.reverse(),i.legendItems=t}fit(){const i=this,{options:a,ctx:n}=i;if(a.display){var o=a.labels,r=Le(o.font),s=r.size,l=i._computeTitleHeight(),{boxWidth:h,itemHeight:o}=Wn(o,s);let t,e;n.font=r.string,i.isHorizontal()?(t=i.maxWidth,e=i._fitRows(l,s,h,o)+10):(e=i.maxHeight,t=i._fitCols(l,s,h,o)+10),i.width=Math.min(t,a.maxWidth||i.maxWidth),i.height=Math.min(e,a.maxHeight||i.maxHeight)}else i.width=i.height=0}_fitRows(t,i,a,n){const{ctx:o,maxWidth:r,options:{labels:{padding:s}}}=this,l=this.legendHitBoxes=[],h=this.lineWidths=[0],c=n+s;let d=t;o.textAlign="left",o.textBaseline="middle";let u=-1,g=-c;return this.legendItems.forEach((t,e)=>{t=a+i/2+o.measureText(t.text).width;(0===e||h[h.length-1]+t+2*s>r)&&(d+=c,h[h.length-(0<e?0:1)]=0,g+=c,u++),l[e]={left:0,top:g,row:u,width:t,height:n},h[h.length-1]+=t+s}),d}_fitCols(t,i,a,n){const{ctx:o,maxHeight:e,options:{labels:{padding:r}}}=this,s=this.legendHitBoxes=[],l=this.columnSizes=[],h=e-t;let c=r,d=0,u=0,g=0,f=0,p=0;return this.legendItems.forEach((t,e)=>{t=a+i/2+o.measureText(t.text).width;0<e&&u+i+2*r>h&&(c+=d+r,l.push({width:d,height:u}),g+=d+r,p++,f=0,d=u=0),d=Math.max(d,t),u+=i+r,s[e]={left:g,top:f,col:p,width:t,height:n},f+=n+r}),c+=d,l.push({width:d,height:u}),c}adjustHitBoxes(){var i=this;if(i.options.display){var a=i._computeTitleHeight(),{legendHitBoxes:n,options:{align:o,labels:{padding:r}}}=i;if(this.isHorizontal()){let t=0,e=T(o,i.left+r,i.right-i.lineWidths[t]);for(const s of n)t!==s.row&&(t=s.row,e=T(o,i.left+r,i.right-i.lineWidths[t])),s.top+=i.top+a+r,s.left=e,e+=s.width+r}else{let t=0,e=T(o,i.top+a+r,i.bottom-i.columnSizes[t].height);for(const l of n)l.col!==t&&(t=l.col,e=T(o,i.top+a+r,i.bottom-i.columnSizes[t].height)),l.top=e,l.left+=i.left+r,e+=l.height+r}}}isHorizontal(){return"top"===this.options.position||"bottom"===this.options.position}draw(){var t;this.options.display&&(qt(t=this.ctx,this),this._draw(),Kt(t))}_draw(){const d=this,{options:t,columnSizes:u,lineWidths:g,ctx:f}=d,{align:p,labels:m}=t,x=ft.color,b=ra(t.rtl,d.left,d.width),v=Le(m.font),{color:_,padding:y}=m,w=v.size,M=w/2;let k;d.drawTitle(),f.textAlign=b.textAlign("left"),f.textBaseline="middle",f.lineWidth=.5,f.font=v.string;const{boxWidth:S,boxHeight:P,itemHeight:D}=Wn(m,w),C=d.isHorizontal(),O=this._computeTitleHeight();k=C?{x:T(p,d.left+y,d.right-g[0]),y:d.top+y+O,line:0}:{x:d.left+y,y:T(p,d.top+O+y,d.bottom-u[0].height),line:0},sa(d.ctx,t.textDirection);const A=D+y;d.legendItems.forEach((t,e)=>{f.strokeStyle=t.fontColor||_,f.fillStyle=t.fontColor||_;var i,a,n,o,r=f.measureText(t.text).width,s=b.textAlign(t.textAlign||(t.textAlign=m.textAlign)),l=S+w/2+r;let h=k.x,c=k.y;b.setWidth(d.width),C?0<e&&h+l+y>d.right&&(c=k.y+=A,k.line++,h=k.x=T(p,d.left+y,d.right-g[k.line])):0<e&&c+A>d.bottom&&(h=k.x=h+u[k.line].width+y,k.line++,c=k.y=T(p,d.top+O+y,d.bottom-u[k.line].height)),i=b.x(h),a=c,n=t,isNaN(S)||S<=0||isNaN(P)||P<0||(f.save(),o=U(n.lineWidth,1),f.fillStyle=U(n.fillStyle,x),f.lineCap=U(n.lineCap,"butt"),f.lineDashOffset=U(n.lineDashOffset,0),f.lineJoin=U(n.lineJoin,"miter"),f.lineWidth=o,f.strokeStyle=U(n.strokeStyle,x),f.setLineDash(U(n.lineDash,[])),m.usePointStyle?(r={radius:S*Math.SQRT2/2,pointStyle:n.pointStyle,rotation:n.rotation,borderWidth:o},e=b.xPlus(i,S/2),Ut(f,r,e,a+M)):(a=a+Math.max((w-P)/2,0),i=b.leftForLtr(i,S),n=Te(n.borderRadius),f.beginPath(),Object.values(n).some(t=>0!==t)?Jt(f,{x:i,y:a,w:S,h:P,radius:n}):f.rect(i,a,S,P),f.fill(),0!==o&&f.stroke()),f.restore()),h=R(s,h+S+M,d.right),o=b.x(h),s=c,t=t,Qt(f,t.text,o,s+D/2,v,{strikethrough:t.hidden,textAlign:t.textAlign}),C?k.x+=l+y:k.y+=A}),la(d.ctx,t.textDirection)}drawTitle(){const a=this,n=a.options,o=n.title,r=Le(o.font),s=Re(o.padding);if(o.display){const h=ra(n.rtl,a.left,a.width),c=a.ctx,d=o.position,u=r.size/2,g=s.top+u;let t,e=a.left,i=a.width;if(this.isHorizontal())i=Math.max(...a.lineWidths),t=a.top+g,e=T(n.align,e,a.right-i);else{const o=a.columnSizes.reduce((t,e)=>Math.max(t,e.height),0);t=g+T(n.align,a.top,a.bottom-o-n.labels.padding-a._computeTitleHeight())}var l=T(d,e,e+i);c.textAlign=h.textAlign(f(d)),c.textBaseline="middle",c.strokeStyle=o.color,c.fillStyle=o.color,c.font=r.string,Qt(c,o.text,l,t,r)}}_computeTitleHeight(){var t=this.options.title,e=Le(t.font),i=Re(t.padding);return t.display?e.lineHeight+i.height:0}_getLegendItemAt(t,e){let i,a,n;if(t>=this.left&&t<=this.right&&e>=this.top&&e<=this.bottom)for(n=this.legendHitBoxes,i=0;i<n.length;++i)if(t>=(a=n[i]).left&&t<=a.left+a.width&&e>=a.top&&e<=a.top+a.height)return this.legendItems[i];return null}handleEvent(t){var e,i,a,n=this,o=n.options;("mousemove"===(a=t.type)&&(o.onHover||o.onLeave)||o.onClick&&("click"===a||"mouseup"===a))&&(e=n._getLegendItemAt(t.x,t.y),"mousemove"===t.type?(a=null!==(i=n._hoveredItem)&&null!==e&&i.datasetIndex===e.datasetIndex&&i.index===e.index,i&&!a&&K(o.onLeave,[t,i,n],n),(n._hoveredItem=e)&&!a&&K(o.onHover,[t,e,n],n)):e&&K(o.onClick,[t,e,n],n))}}var Nn={id:"legend",_element:Hn,start(t,e,i){var a=t.legend=new Hn({ctx:t.ctx,options:i,chart:t});Ye.configure(t,a,i),Ye.addBox(t,a)},stop(t){Ye.removeBox(t,t.legend),delete t.legend},beforeUpdate(t,e,i){const a=t.legend;Ye.configure(t,a,i),a.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 a=e.datasetIndex,n=i.chart;n.isDatasetVisible(a)?(n.hide(a),e.hidden=!0):(n.show(a),e.hidden=!1)},onHover:null,onLeave:null,labels:{color:t=>t.chart.options.color,boxWidth:40,padding:10,generateLabels(t){const a=t.data.datasets,{labels:{usePointStyle:n,pointStyle:o,textAlign:r,color:s}}=t.legend.options;return t._getSortedDatasetMetas().map(t=>{var e=t.controller.getStyle(n?0:void 0),i=Re(e.borderWidth);return{text:a[t.index].label,fillStyle:e.backgroundColor,fontColor:s,hidden:!t.visible,lineCap:e.borderCapStyle,lineDash:e.borderDash,lineDashOffset:e.borderDashOffset,lineJoin:e.borderJoinStyle,lineWidth:(i.width+i.height)/4,strokeStyle:e.borderColor,pointStyle:o||e.pointStyle,rotation:e.rotation,textAlign:r||e.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 jn extends Di{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){var i=this,a=i.options;i.left=0,i.top=0,a.display?(i.width=i.right=t,i.height=i.bottom=e,e=N(a.text)?a.text.length:1,i._padding=Re(a.padding),a=e*Le(a.font).lineHeight+i._padding.height,i.isHorizontal()?i.height=a:i.width=a):i.width=i.height=i.right=i.bottom=0}isHorizontal(){var t=this.options.position;return"top"===t||"bottom"===t}_drawArgs(t){var{top:e,left:i,bottom:a,right:n,options:o}=this,r=o.align;let s,l,h,c=0;return s=this.isHorizontal()?(l=T(r,i,n),h=e+t,n-i):(c="left"===o.position?(l=i+t,h=T(r,a,e),-.5*pt):(l=n-t,h=T(r,e,a),.5*pt),a-e),{titleX:l,titleY:h,maxWidth:s,rotation:c}}draw(){var t,e,i,a,n,o=this.ctx,r=this.options;r.display&&(n=(t=Le(r.font)).lineHeight/2+this._padding.top,{titleX:e,titleY:i,maxWidth:a,rotation:n}=this._drawArgs(n),Qt(o,r.text,0,0,t,{color:r.color,maxWidth:a,rotation:n,textAlign:f(r.align),textBaseline:"middle",translation:[e,i]}))}}var $n={id:"title",_element:jn,start(t,e,i){var a;a=t,t=i,i=new jn({ctx:a.ctx,options:t,chart:a}),Ye.configure(a,i,t),Ye.addBox(a,i),a.titleBlock=i},stop(t){var e=t.titleBlock;Ye.removeBox(t,e),delete t.titleBlock},beforeUpdate(t,e,i){const a=t.titleBlock;Ye.configure(t,a,i),a.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 Yn={average(t){if(!t.length)return!1;let e,i,a=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();a+=t.x,n+=t.y,++o}}return{x:a/o,y:n/o}},nearest(t,e){if(!t.length)return!1;let i,a,n,o=e.x,r=e.y,s=Number.POSITIVE_INFINITY;for(i=0,a=t.length;i<a;++i){const a=t[i].element;if(a&&a.hasValue()){const t=It(e,a.getCenterPoint());t<s&&(s=t,n=a)}}if(n){const t=n.tooltipPosition();o=t.x,r=t.y}return{x:o,y:r}}};function Un(t,e){return e&&(N(e)?Array.prototype.push.apply(t,e):t.push(e)),t}function Xn(t){return("string"==typeof t||t instanceof String)&&-1<t.indexOf("\n")?t.split("\n"):t}function qn(t,e){const i=t._chart.ctx,{body:a,footer:n,title:o}=t,{boxWidth:r,boxHeight:s}=e,l=Le(e.bodyFont),h=Le(e.titleFont),c=Le(e.footerFont),d=o.length,u=n.length,g=a.length,f=Re(e.padding);let p=f.height,m=0,x=a.reduce((t,e)=>t+e.before.length+e.lines.length+e.after.length,0);x+=t.beforeBody.length+t.afterBody.length,d&&(p+=d*h.lineHeight+(d-1)*e.titleSpacing+e.titleMarginBottom),x&&(p+=g*(e.displayColors?Math.max(s,l.lineHeight):l.lineHeight)+(x-g)*l.lineHeight+(x-1)*e.bodySpacing),u&&(p+=e.footerMarginTop+u*c.lineHeight+(u-1)*e.footerSpacing);let b=0;const v=function(t){m=Math.max(m,i.measureText(t).width+b)};return i.save(),i.font=h.string,G(t.title,v),i.font=l.string,G(t.beforeBody.concat(t.afterBody),v),b=e.displayColors?r+2:0,G(a,t=>{G(t.before,v),G(t.lines,v),G(t.after,v)}),b=0,i.font=c.string,G(t.footer,v),i.restore(),m+=f.width,{width:m,height:p}}function Kn(i,t,a){var e=t.yAlign||function(){var{y:t,height:e}=a;return t<e/2?"top":t>i.height-e/2?"bottom":"center"}();return{xAlign:t.xAlign||function(n,o,r,t){var{x:e,width:i}=r,{width:a,chartArea:{left:s,right:l}}=n;let h="center";return"center"===t?h=e<=(s+l)/2?"left":"right":e<=i/2?h="left":a-i/2<=e&&(h="right"),function(t){var{x:e,width:i}=r,a=o.caretSize+o.caretPadding;return"left"===t&&e+i+a>n.width||"right"===t&&e-i-a<0}(h)&&(h="center"),h}(i,t,a,e),yAlign:e}}function Gn(t,i,e,a){var{caretSize:n,caretPadding:o,cornerRadius:t}=t,{xAlign:r,yAlign:s}=e,l=n+o,t=t+o;let h=function(){let{x:t,width:e}=i;return"right"===r?t-=e:"center"===r&&(t-=e/2),t}();o=function(){let{y:t,height:e}=i;return"top"===s?t+=l:t-="bottom"===s?e+l:e/2,t}();return"center"===s?"left"===r?h+=l:"right"===r&&(h-=l):"left"===r?h-=t:"right"===r&&(h+=t),{x:Bt(h,0,a.width-i.width),y:Bt(o,0,a.height-i.height)}}function Zn(t,e,i){i=Re(i.padding);return"center"===e?t.x+t.width/2:"right"===e?t.x+t.width-i.right:t.x+i.left}function Qn(t){return Un([],Xn(t))}function Jn(t,e){e=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return e?t.override(e):t}class to extends Di{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(){var t=this._cachedAnimations;if(t)return t;var e=this._chart,t=this.options.setContext(this.getContext()),e=t.enabled&&e.options.animation&&t.animations,t=new pi(this._chart,e);return e._cacheable&&(this._cachedAnimations=Object.freeze(t)),t}getContext(){var t,e;return this.$context||(this.$context=(t=this._chart.getContext(),e=this._tooltipItems,Object.assign(Object.create(t),{tooltip:this,tooltipItems:e,type:"tooltip"})))}getTitle(t,e){const{callbacks:i}=e,a=i.beforeTitle.apply(this,[t]),n=i.title.apply(this,[t]),o=i.afterTitle.apply(this,[t]);t=Un(t=[],Xn(a));return t=Un(t,Xn(n)),t=Un(t,Xn(o))}getBeforeBody(t,e){return Qn(e.callbacks.beforeBody.apply(this,[t]))}getBody(t,e){const a=this,{callbacks:n}=e,o=[];return G(t,t=>{const e={before:[],lines:[],after:[]},i=Jn(n,t);Un(e.before,Xn(i.beforeLabel.call(a,t))),Un(e.lines,i.label.call(a,t)),Un(e.after,Xn(i.afterLabel.call(a,t))),o.push(e)}),o}getAfterBody(t,e){return Qn(e.callbacks.afterBody.apply(this,[t]))}getFooter(t,e){const{callbacks:i}=e,a=i.beforeFooter.apply(this,[t]),n=i.footer.apply(this,[t]),o=i.afterFooter.apply(this,[t]);t=Un(t=[],Xn(a));return t=Un(t,Xn(n)),t=Un(t,Xn(o))}_createItems(a){const i=this,t=i._active,n=i._chart.data,o=[],r=[],s=[];let e,l,h=[];for(e=0,l=t.length;e<l;++e)h.push(function(t,e){const{element:i,datasetIndex:a,index:n}=e,o=t.getDatasetMeta(a).controller,{label:r,value:s}=o.getLabelAndValue(n);return{chart:t,label:r,parsed:o.getParsed(n),raw:t.data.datasets[a].data[n],formattedValue:s,dataset:o.getDataset(),dataIndex:n,datasetIndex:a,element:i}}(i._chart,t[e]));return a.filter&&(h=h.filter((t,e,i)=>a.filter(t,e,i,n))),a.itemSort&&(h=h.sort((t,e)=>a.itemSort(t,e,n))),G(h,t=>{const e=Jn(a.callbacks,t);o.push(e.labelColor.call(i,t)),r.push(e.labelPointStyle.call(i,t)),s.push(e.labelTextColor.call(i,t))}),i.labelColors=o,i.labelPointStyles=r,i.labelTextColors=s,i.dataPoints=h,h}update(t,e){const i=this,a=i.options.setContext(i.getContext()),n=i._active;let o,r=[];if(n.length){const t=Yn[a.position].call(i,n,i._eventPosition);r=i._createItems(a),i.title=i.getTitle(r,a),i.beforeBody=i.getBeforeBody(r,a),i.body=i.getBody(r,a),i.afterBody=i.getAfterBody(r,a),i.footer=i.getFooter(r,a);const e=i._size=qn(i,a),s=Object.assign({},t,e),l=Kn(i._chart,a,s),h=Gn(a,s,l,i._chart);i.xAlign=l.xAlign,i.yAlign=l.yAlign,o={opacity:1,x:h.x,y:h.y,width:e.width,height:e.height,caretX:t.x,caretY:t.y}}else 0!==i.opacity&&(o={opacity:0});i._tooltipItems=r,i.$context=void 0,o&&i._resolveAnimations().update(i,o),t&&a.external&&a.external.call(i,{chart:i._chart,tooltip:i,replay:e})}drawCaret(t,e,i,a){a=this.getCaretPosition(t,i,a);e.lineTo(a.x1,a.y1),e.lineTo(a.x2,a.y2),e.lineTo(a.x3,a.y3)}getCaretPosition(t,e,i){var{xAlign:a,yAlign:n}=this,{cornerRadius:o,caretSize:r}=i,{x:s,y:i}=t,{width:t,height:e}=e;let l,h,c,d,u,g;return"center"===n?(u=i+e/2,g="left"===a?(l=s,h=l-r,d=u+r,u-r):(l=s+t,h=l+r,d=u-r,u+r),c=l):(h="left"===a?s+o+r:"right"===a?s+t-o-r:this.caretX,c="top"===n?(d=i,u=d-r,l=h-r,h+r):(d=i+e,u=d+r,l=h+r,h-r),g=d),{x1:l,x2:h,x3:c,y1:d,y2:u,y3:g}}drawTitle(t,e,i){var a=this.title,n=a.length;let o,r,s;if(n){const l=ra(i.rtl,this.x,this.width);for(t.x=Zn(this,i.titleAlign,i),e.textAlign=l.textAlign(i.titleAlign),e.textBaseline="middle",o=Le(i.titleFont),r=i.titleSpacing,e.fillStyle=i.titleColor,e.font=o.string,s=0;s<n;++s)e.fillText(a[s],l.x(t.x),t.y+o.lineHeight/2),t.y+=o.lineHeight+r,s+1===n&&(t.y+=i.titleMarginBottom-r)}}_drawColorBox(t,e,i,a,n){const o=this,r=o.labelColors[i],s=o.labelPointStyles[i],{boxHeight:l,boxWidth:h}=n,c=Le(n.bodyFont),d=Zn(o,"left",n),u=a.x(d),g=l<c.lineHeight?(c.lineHeight-l)/2:0,f=e.y+g;if(n.usePointStyle){const e={radius:Math.min(h,l)/2,pointStyle:s.pointStyle,rotation:s.rotation,borderWidth:1},i=a.leftForLtr(u,h)+h/2,o=f+l/2;t.strokeStyle=n.multiKeyBackground,t.fillStyle=n.multiKeyBackground,Ut(t,e,i,o),t.strokeStyle=r.borderColor,t.fillStyle=r.backgroundColor,Ut(t,e,i,o)}else{t.lineWidth=r.borderWidth||1,t.strokeStyle=r.borderColor,t.setLineDash(r.borderDash||[]),t.lineDashOffset=r.borderDashOffset||0;const e=a.leftForLtr(u,h),i=a.leftForLtr(a.xPlus(u,1),h-2),o=Te(r.borderRadius);Object.values(o).some(t=>0!==t)?(t.beginPath(),t.fillStyle=n.multiKeyBackground,Jt(t,{x:e,y:f,w:h,h:l,radius:o}),t.fill(),t.stroke(),t.fillStyle=r.backgroundColor,t.beginPath(),Jt(t,{x:i,y:f+1,w:h-2,h:l-2,radius:o}),t.fill()):(t.fillStyle=n.multiKeyBackground,t.fillRect(e,f,h,l),t.strokeRect(e,f,h,l),t.fillStyle=r.backgroundColor,t.fillRect(i,f+1,h-2,l-2))}t.fillStyle=o.labelTextColors[i]}drawBody(e,i,t){const{body:a}=this,{bodySpacing:n,bodyAlign:o,displayColors:r,boxHeight:s,boxWidth:l}=t,h=Le(t.bodyFont);let c=h.lineHeight,d=0;const u=ra(t.rtl,this.x,this.width),g=function(t){i.fillText(t,u.x(e.x+d),e.y+c/2),e.y+=c+n},f=u.textAlign(o);let p,m,x,b,v,_,y;for(i.textAlign=o,i.textBaseline="middle",i.font=h.string,e.x=Zn(this,f,t),i.fillStyle=t.bodyColor,G(this.beforeBody,g),d=r&&"right"!==f?"center"===o?l/2+1:l+2:0,b=0,_=a.length;b<_;++b){for(p=a[b],m=this.labelTextColors[b],i.fillStyle=m,G(p.before,g),x=p.lines,r&&x.length&&(this._drawColorBox(i,e,b,u,t),c=Math.max(h.lineHeight,s)),v=0,y=x.length;v<y;++v)g(x[v]),c=h.lineHeight;G(p.after,g)}d=0,c=h.lineHeight,G(this.afterBody,g),e.y-=n}drawFooter(t,e,i){var a=this.footer,n=a.length;let o,r;if(n){const s=ra(i.rtl,this.x,this.width);for(t.x=Zn(this,i.footerAlign,i),t.y+=i.footerMarginTop,e.textAlign=s.textAlign(i.footerAlign),e.textBaseline="middle",o=Le(i.footerFont),e.fillStyle=i.footerColor,e.font=o.string,r=0;r<n;++r)e.fillText(a[r],s.x(t.x),t.y+o.lineHeight/2),t.y+=o.lineHeight+i.footerSpacing}}drawBackground(t,e,i,a){var{xAlign:n,yAlign:o}=this,{x:r,y:s}=t,{width:l,height:h}=i,c=a.cornerRadius;e.fillStyle=a.backgroundColor,e.strokeStyle=a.borderColor,e.lineWidth=a.borderWidth,e.beginPath(),e.moveTo(r+c,s),"top"===o&&this.drawCaret(t,e,i,a),e.lineTo(r+l-c,s),e.quadraticCurveTo(r+l,s,r+l,s+c),"center"===o&&"right"===n&&this.drawCaret(t,e,i,a),e.lineTo(r+l,s+h-c),e.quadraticCurveTo(r+l,s+h,r+l-c,s+h),"bottom"===o&&this.drawCaret(t,e,i,a),e.lineTo(r+c,s+h),e.quadraticCurveTo(r,s+h,r,s+h-c),"center"===o&&"left"===n&&this.drawCaret(t,e,i,a),e.lineTo(r,s+c),e.quadraticCurveTo(r,s,r+c,s),e.closePath(),e.fill(),0<a.borderWidth&&e.stroke()}_updateAnimationTarget(t){const e=this,i=e._chart,a=e.$animations,n=a&&a.x,o=a&&a.y;if(n||o){const a=Yn[t.position].call(e,e._active,e._eventPosition);var r,s;a&&(r=e._size=qn(e,t),s=Gn(t,s=Object.assign({},a,e._size),t=Kn(i,t,s),i),n._to===s.x&&o._to===s.y||(e.xAlign=t.xAlign,e.yAlign=t.yAlign,e.width=r.width,e.height=r.height,e.caretX=a.x,e.caretY=a.y,e._resolveAnimations().update(e,s)))}}draw(t){var e=this,i=e.options.setContext(e.getContext());let a=e.opacity;if(a){e._updateAnimationTarget(i);const r={width:e.width,height:e.height},s={x:e.x,y:e.y};a=Math.abs(a)<.001?0:a;var n=Re(i.padding),o=e.title.length||e.beforeBody.length||e.body.length||e.afterBody.length||e.footer.length;i.enabled&&o&&(t.save(),t.globalAlpha=a,e.drawBackground(s,t,r,i),sa(t,i.textDirection),s.y+=n.top,e.drawTitle(s,t,i),e.drawBody(s,t,i),e.drawFooter(s,t,i),la(t,i.textDirection),t.restore())}}getActiveElements(){return this._active||[]}setActiveElements(t,e){const a=this,i=a._active,n=t.map(({datasetIndex:t,index:e})=>{var i=a._chart.getDatasetMeta(t);if(!i)throw new Error("Cannot find a dataset at index "+t);return{datasetIndex:t,element:i.data[e],index:e}}),o=!Z(i,n),r=a._positionChanged(n,e);(o||r)&&(a._active=n,a._eventPosition=e,a.update(!0))}handleEvent(t,e){var i=this.options,a=this._active||[];let n,o=[];"mouseout"!==t.type&&(o=this._chart.getElementsAtEventForMode(t,i.mode,i,e),i.reverse&&o.reverse());var r=this._positionChanged(o,t);return(n=e||!Z(o,a)||r)&&(this._active=o,(i.enabled||i.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),n}_positionChanged(t,e){var{caretX:i,caretY:a,options:n}=this,e=Yn[n.position].call(this,t,e);return!1!==e&&(i!==e.x||a!==e.y)}}to.positioners=Yn;be={id:"tooltip",_element:to,positioners:Yn,afterInit(t,e,i){i&&(t.tooltip=new to({_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){var i;t.tooltip&&(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:t,title(t){if(0<t.length){var e=t[0],i=e.chart.data.labels,t=i?i.length:0;if(this&&this.options&&"dataset"===this.options.mode)return e.dataset.label||"";if(e.label)return e.label;if(0<t&&e.dataIndex<t)return i[e.dataIndex]}return""},afterTitle:t,beforeBody:t,beforeLabel:t,label(t){if(this&&this.options&&"dataset"===this.options.mode)return t.label+": "+t.formattedValue||t.formattedValue;let e=t.dataset.label||"";e&&(e+=": ");t=t.formattedValue;return H(t)||(e+=t),e},labelColor(t){t=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{borderColor:t.borderColor,backgroundColor:t.backgroundColor,borderWidth:t.borderWidth,borderDash:t.borderDash,borderDashOffset:t.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(t){t=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{pointStyle:t.pointStyle,rotation:t.rotation}},afterLabel:t,afterBody:t,beforeFooter:t,footer:t,afterFooter:t}},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"]},$n=Object.freeze({__proto__:null,Decimation:Cn,Filler:Bn,Legend:Nn,Title:$n,Tooltip:be});class eo extends Vi{constructor(t){super(t),this._startValue=void 0,this._valueRange=0}parse(t,e){if(H(t))return null;var i,a,n,o,r,s=this.getLabels();return e=e=isFinite(e)&&s[e]===t?e:(n=U(e,a=t),-1===(r=(i=s).indexOf(a))?(o=n,"string"==typeof(t=a)?i.push(t)-1:isNaN(t)?null:o):r!==i.lastIndexOf(a)?n:r),s=s.length-1,null===e?null:Bt(Math.round(e),0,s)}determineDataLimits(){var{minDefined:t,maxDefined:e}=this.getUserBounds();let{min:i,max:a}=this.getMinMax(!0);"ticks"===this.options.bounds&&(t||(i=0),e||(a=this.getLabels().length-1)),this.min=i,this.max=a}buildTicks(){const e=this.min,i=this.max,t=this.options.offset,a=[];let n=this.getLabels();n=0===e&&i===n.length-1?n:n.slice(e,i+1),this._valueRange=Math.max(n.length-(t?0:1),1),this._startValue=this.min-(t?.5:0);for(let t=e;t<=i;t++)a.push({value:t});return a}getLabelForValue(t){var e=this.getLabels();return 0<=t&&t<e.length?e[t]:t}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return null===(t="number"!=typeof t?this.parse(t):t)?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){var 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}}eo.id="category",eo.defaults={ticks:{callback:eo.prototype.getLabelForValue}};class io extends Vi{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 H(t)||("number"==typeof t||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const t=this,{beginAtZero:e,stacked:i}=t.options,{minDefined:a,maxDefined:n}=t.getUserBounds();let{min:o,max:r}=t;var s=t=>o=a?o:t,l=t=>r=n?r:t;if(e||i){const t=kt(o),e=kt(r);t<0&&e<0?l(0):0<t&&0<e&&s(0)}o===r&&(l(r+1),e||s(o-1)),t.min=o,t.max=r}getTickLimit(){let t,{maxTicksLimit:e,stepSize:i}=this.options.ticks;return i?t=Math.ceil(this.max/i)-Math.floor(this.min/i)+1:(t=this.computeTickLimit(),e=e||11),e&&(t=Math.min(e,t)),t}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){var M=this,k=M.options,S=k.ticks,P=M.getTickLimit(),P=Math.max(2,P);const t=function(){const t=[],{step:e,min:i,max:a,precision:n,count:o,maxTicks:r,maxDigits:s,horizontal:l}={maxTicks:P,min:k.min,max:k.max,precision:S.precision,step:S.stepSize,count:S.count,maxDigits:M._maxDigits(),horizontal:M.isHorizontal()},h=e||1,c=r-1,{min:d,max:u}=M._range||M,g=!H(i),f=!H(a),p=!H(o),m=(u-d)/s;let x,b,v,_,y=St((u-d)/c/h)*h;if(y<1e-14&&!g&&!f)return[{value:d},{value:u}];_=Math.ceil(u/y)-Math.floor(d/y),_>c&&(y=St(_*y/c/h)*h),H(n)||(x=Math.pow(10,n),y=Math.ceil(y*x)/x),b=Math.floor(d/y)*y,v=Math.ceil(u/y)*y,g&&f&&e&&Ot((a-i)/e,y/1e3)?(_=Math.min((a-i)/y,r),y=(a-i)/_,b=i,v=a):p?(b=g?i:b,v=f?a:v,_=o-1,y=(v-b)/_):(_=(v-b)/y,_=Ct(_,Math.round(_),y/1e3)?Math.round(_):Math.ceil(_)),x=Math.pow(10,H(n)?Lt(y):n),b=Math.round(b*x)/x,v=Math.round(v*x)/x;let w=0;for(g&&(t.push({value:i}),b<=i&&w++,Ct(Math.round((b+w*y)*x)/x,i,m*(l?(""+i).length:1))&&w++);w<_;++w)t.push({value:Math.round((b+w*y)*x)/x});return f?Ct(t[t.length-1].value,a,m*(l?(""+a).length:1))?t[t.length-1].value=a:t.push({value:a}):t.push({value:v}),t}();return"ticks"===k.bounds&&At(t,M,"value"),k.reverse?(t.reverse(),M.start=M.max,M.end=M.min):(M.start=M.min,M.end=M.max),t}configure(){const t=this,e=t.ticks;let i=t.min,a=t.max;if(super.configure(),t.options.offset&&e.length){const t=(a-i)/Math.max(e.length-1,1)/2;i-=t,a+=t}t._startValue=i,t._endValue=a,t._valueRange=a-i}getLabelForValue(t){return Oi(t,this.chart.options.locale)}}class ao extends io{determineDataLimits(){var{min:t,max:e}=this.getMinMax(!0);this.min=$(t)?t:0,this.max=$(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){if(this.isHorizontal())return Math.ceil(this.width/40);var t=this._resolveTickFontOptions(0);return Math.ceil(this.height/t.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 no(t){return 1==t/Math.pow(10,Math.floor(Mt(t)))}ao.id="linear",ao.defaults={ticks:{callback:Ti.formatters.numeric}};class oo extends Vi{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,e){e=io.prototype.parse.apply(this,[t,e]);if(0!==e)return $(e)&&0<e?e:null;this._zero=!0}determineDataLimits(){var{min:t,max:e}=this.getMinMax(!0);this.min=$(t)?Math.max(0,t):null,this.max=$(e)?Math.max(0,e):null,this.options.beginAtZero&&(this._zero=!0),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:e,maxDefined:i}=this.getUserBounds();let a=this.min,n=this.max;var t=t=>a=e?a:t,o=t=>n=i?n:t,r=(t,e)=>Math.pow(10,Math.floor(Mt(t))+e);a===n&&(a<=0?(t(1),o(10)):(t(r(a,-1)),o(r(n,1)))),a<=0&&t(r(n,-1)),n<=0&&o(r(a,1)),this._zero&&this.min!==this._suggestedMin&&a===r(this.min,0)&&t(r(a,-1)),this.min=a,this.max=n}buildTicks(){const t=this,e=t.options,i=function(t,e){const i=Math.floor(Mt(e.max)),a=Math.ceil(e.max/Math.pow(10,i)),n=[];let o=Y(t.min,Math.pow(10,Math.floor(Mt(e.min)))),r=Math.floor(Mt(o)),s=Math.floor(o/Math.pow(10,r)),l=r<0?Math.pow(10,Math.abs(r)):1;for(;n.push({value:o,major:no(o)}),++s,10===s&&(s=1,++r,l=0<=r?1:l),o=Math.round(s*Math.pow(10,r)*l)/l,r<i||r===i&&s<a;);t=Y(t.max,o);return n.push({value:t,major:no(o)}),n}({min:t._userMin,max:t._userMax},t);return"ticks"===e.bounds&&At(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":Oi(t,this.chart.options.locale)}configure(){var t=this.min;super.configure(),this._startValue=Mt(t),this._valueRange=Mt(this.max)-Mt(t)}getPixelForValue(t){return null===(t=void 0===t||0===t?this.min:t)||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(Mt(t)-this._startValue)/this._valueRange)}getValueForPixel(t){t=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+t*this._valueRange)}}function ro(t){var e=t.ticks;if(e.display&&t.display){const t=Re(e.backdropPadding);return U(e.font&&e.font.size,ft.font.size)+t.height}return 0}function so(t,e,i,a,n){return t===a||t===n?{start:e-i/2,end:e+i/2}:t<a||n<t?{start:e-i,end:e}:{start:e,end:e+i}}function lo(e,i,t,a){const{ctx:n}=e;if(t)n.arc(e.xCenter,e.yCenter,i,0,mt);else{var o=e.getPointPosition(0,i);n.moveTo(o.x,o.y);for(let t=1;t<a;t++)o=e.getPointPosition(t,i),n.lineTo(o.x,o.y)}}function ho(t){return Dt(t)?t:0}oo.id="logarithmic",oo.defaults={ticks:{callback:Ti.formatters.logarithmic,major:{enabled:!0}}};class co extends io{constructor(t){super(t),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){var t=this;t.width=t.maxWidth,t.height=t.maxHeight,t.paddingTop=ro(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(){var{min:t,max:e}=this.getMinMax(!1);this.min=$(t)&&!isNaN(t)?t:0,this.max=$(e)&&!isNaN(e)?e:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/ro(this.options))}generateTickLabels(t){const i=this;io.prototype.generateTickLabels.call(i,t),i._pointLabels=i.getLabels().map((t,e)=>{e=K(i.options.pointLabels.callback,[t,e],i);return e||0===e?e:""})}fit(){var t=this.options;t.display&&t.pointLabels.display?function(t){const e={l:0,r:t.width,t:0,b:t.height-t.paddingTop},i={};let a,n,o;const r=[],s=[],l=t.getLabels().length;for(a=0;a<l;a++){const l=t.options.pointLabels.setContext(t.getContext(a));s[a]=l.padding,o=t.getPointPosition(a,t.drawingArea+s[a]);const f=Le(l.font);t.ctx.font=f.string,h=t.ctx,c=f.lineHeight,n=N(d=t._pointLabels[a])?{w:jt(h,h.font,d),h:d.length*c}:{w:h.measureText(d).width,h:c},r[a]=n;const p=t.getIndexAngle(a),m=Rt(p),b=so(m,o.x,n.w,0,180),v=so(m,o.y,n.h,90,270);b.start<e.l&&(e.l=b.start,i.l=p),b.end>e.r&&(e.r=b.end,i.r=p),v.start<e.t&&(e.t=v.start,i.t=p),v.end>e.b&&(e.b=v.end,i.b=p)}var h,c,d,u,g;t._setReductions(t.drawingArea,e,i),t._pointLabelItems=[];const f=t.options,p=ro(f),m=t.getDistanceFromCenterForValue(f.ticks.reverse?t.min:t.max);for(a=0;a<l;a++){const e=0===a?p/2:0,i=t.getPointPosition(a,m+e+s[a]),n=Rt(t.getIndexAngle(a)),o=r[a];u=n,x=o,g=i,90===u||270===u?g.y-=x.h/2:(270<u||u<90)&&(g.y-=x.h);const l=0===(x=n)||180===x?"center":x<180?"left":"right";var x="left"==l?i.x:"center"==l?i.x-o.w/2:i.x-o.w;const c=x+o.w;t._pointLabelItems[a]={x:i.x,y:i.y,textAlign:l,left:x,top:i.y,right:c,bottom:i.y+o.h}}}(this):this.setCenterPoint(0,0,0,0)}_setReductions(t,e,i){var a=e.l/Math.sin(i.l),n=Math.max(e.r-this.width,0)/Math.sin(i.r),o=-e.t/Math.cos(i.t),i=-Math.max(e.b-(this.height-this.paddingTop),0)/Math.cos(i.b),a=ho(a),n=ho(n),o=ho(o),i=ho(i);this.drawingArea=Math.max(t/2,Math.min(Math.floor(t-(a+n)/2),Math.floor(t-(o+i)/2))),this.setCenterPoint(a,n,o,i)}setCenterPoint(t,e,i,a){var n=this,e=n.width-e-n.drawingArea,t=t+n.drawingArea,i=i+n.drawingArea,a=n.height-n.paddingTop-a-n.drawingArea;n.xCenter=Math.floor((t+e)/2+n.left),n.yCenter=Math.floor((i+a)/2+n.top+n.paddingTop)}getIndexAngle(t){return Ft(t*(mt/this.getLabels().length)+Tt(this.options.startAngle||0))}getDistanceFromCenterForValue(t){if(H(t))return NaN;var e=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*e:(t-this.min)*e}getValueForDistanceFromCenter(t){if(H(t))return NaN;t/=this.drawingArea/(this.max-this.min);return this.options.reverse?this.max-t:this.min+t}getPointPosition(t,e){t=this.getIndexAngle(t)-_t;return{x:Math.cos(t)*e+this.xCenter,y:Math.sin(t)*e+this.yCenter,angle:t}}getPointPositionForValue(t,e){return this.getPointPosition(t,this.getDistanceFromCenterForValue(e))}getBasePosition(t){return this.getPointPositionForValue(t||0,this.getBaseValue())}getPointLabelPosition(t){var{left:e,top:i,right:a,bottom:t}=this._pointLabelItems[t];return{left:e,top:i,right:a,bottom:t}}drawBackground(){var{backgroundColor:t,grid:{circular:e}}=this.options;if(t){const i=this.ctx;i.save(),i.beginPath(),lo(this,this.getDistanceFromCenterForValue(this._endValue),e,this.getLabels().length),i.closePath(),i.fillStyle=t,i.fill(),i.restore()}}drawGrid(){const i=this,t=i.ctx,e=i.options,{angleLines:a,grid:n}=e,o=i.getLabels().length;let r,s,l;if(e.pointLabels.display&&function(e,i){const{ctx:a,options:{pointLabels:n}}=e;for(let t=i-1;0<=t;t--){const i=n.setContext(e.getContext(t)),o=Le(i.font),{x:r,y:s,textAlign:l,left:h,top:c,right:d,bottom:u}=e._pointLabelItems[t],{backdropColor:g}=i;if(!H(g)){const e=Re(i.backdropPadding);a.fillStyle=g,a.fillRect(h-e.left,c-e.top,d-h+e.width,u-c+e.height)}Qt(a,e._pointLabels[t],r,s+o.lineHeight/2,o,{color:i.color,textAlign:l,textBaseline:"middle"})}}(i,o),n.display&&i.ticks.forEach((t,e)=>{0!==e&&(s=i.getDistanceFromCenterForValue(t.value),e=n.setContext(i.getContext(e-1)),function(t,e,i,a){const n=t.ctx,o=e.circular,{color:r,lineWidth:s}=e;!o&&!a||!r||!s||i<0||(n.save(),n.strokeStyle=r,n.lineWidth=s,n.setLineDash(e.borderDash),n.lineDashOffset=e.borderDashOffset,n.beginPath(),lo(t,i,o,a),n.closePath(),n.stroke(),n.restore())}(i,e,s,o))}),a.display){for(t.save(),r=i.getLabels().length-1;0<=r;r--){const n=a.setContext(i.getContext(r)),{color:o,lineWidth:h}=n;h&&o&&(t.lineWidth=h,t.strokeStyle=o,t.setLineDash(n.borderDash),t.lineDashOffset=n.borderDashOffset,s=i.getDistanceFromCenterForValue(e.ticks.reverse?i.min:i.max),l=i.getPointPosition(r,s),t.beginPath(),t.moveTo(i.xCenter,i.yCenter),t.lineTo(l.x,l.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const r=this,s=r.ctx,l=r.options,h=l.ticks;if(h.display){var t=r.getIndexAngle(0);let n,o;s.save(),s.translate(r.xCenter,r.yCenter),s.rotate(t),s.textAlign="center",s.textBaseline="middle",r.ticks.forEach((t,e)=>{if(0!==e||l.reverse){var i=h.setContext(r.getContext(e)),a=Le(i.font);if(n=r.getDistanceFromCenterForValue(r.ticks[e].value),i.showLabelBackdrop){o=s.measureText(t.label).width,s.fillStyle=i.backdropColor;const r=Re(i.backdropPadding);s.fillRect(-o/2-r.left,-n-a.size/2-r.top,o+r.width,a.size+r.height)}Qt(s,t.label,0,-n,a,{color:i.color})}}),s.restore()}}drawTitle(){}}co.id="radialLinear",co.defaults={display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:Ti.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback:t=>t,padding:5}},co.defaultRoutes={"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"};const uo={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:!(co.descriptors={angleLines:{_fallback:"grid"}}),size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},go=Object.keys(uo);function fo(t,e){return t-e}function po(t,e){if(H(e))return null;const i=t._adapter,{parser:a,round:n,isoWeekday:o}=t._parseOpts;let r=e;return"function"==typeof a&&(r=a(r)),$(r)||(r="string"==typeof a?i.parse(r,a):i.parse(r)),null===r?null:(n&&(r="week"!==n||!Dt(o)&&!0!==o?i.startOf(r,n):i.startOf(r,"isoWeek",o)),+r)}function mo(e,i,a,n){const o=go.length;for(let t=go.indexOf(e);t<o-1;++t){const e=uo[go[t]],o=e.steps||Number.MAX_SAFE_INTEGER;if(e.common&&Math.ceil((a-i)/(o*e.size))<=n)return go[t]}return go[o-1]}function xo(t,e,i){var a,n;i?i.length&&({lo:a,hi:n}=te(i,e),t[i[a]>=e?i[a]:i[n]]=!0):t[e]=!0}function bo(t,e,i){const a=[],n={},o=e.length;let r,s;for(r=0;r<o;++r)s=e[r],n[s]=r,a.push({value:s,major:!1});return 0!==o&&i?function(t,e,i,a){const n=t._adapter,o=+n.startOf(e[0].value,a),r=e[e.length-1].value;let s,l;for(s=o;s<=r;s=+n.add(s,1,a))0<=(l=i[s])&&(e[l].major=!0);return e}(t,a,n,i):a}class vo extends Vi{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={}),a=this._adapter=new Na._date(t.adapters.date);it(i.displayFormats,a.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:po(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:a,max:n,minDefined:o,maxDefined:r}=this.getUserBounds();function s(t){o||isNaN(t.min)||(a=Math.min(a,t.min)),r||isNaN(t.max)||(n=Math.max(n,t.max))}o&&r||(s(this._getLabelBounds()),"ticks"===t.bounds&&"labels"===t.ticks.source||s(this.getMinMax(!1))),a=$(a)&&!isNaN(a)?a:+e.startOf(Date.now(),i),n=$(n)&&!isNaN(n)?n:+e.endOf(Date.now(),i)+1,this.min=Math.min(a,n-1),this.max=Math.max(a+1,n)}_getLabelBounds(){var 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(){var t=this,e=t.options,i=e.time,a=e.ticks,n="labels"===a.source?t.getLabelTimestamps():t._generate();"ticks"===e.bounds&&n.length&&(t.min=t._userMin||n[0],t.max=t._userMax||n[n.length-1]);const o=t.min,r=ae(n,o,t.max);return t._unit=i.unit||(a.autoSkip?mo(i.minUnit,t.min,t.max,t._getLabelCapacity(o)):function(e,i,a,n,o){for(let t=go.length-1;t>=go.indexOf(a);t--){const a=go[t];if(uo[a].common&&e._adapter.diff(o,n,a)>=i-1)return a}return go[a?go.indexOf(a):0]}(t,r.length,i.minUnit,t.min,t.max)),t._majorUnit=a.major.enabled&&"year"!==t._unit?function(i){for(let t=go.indexOf(i)+1,e=go.length;t<e;++t)if(uo[go[t]].common)return go[t]}(t._unit):void 0,t.initOffsets(n),e.reverse&&r.reverse(),bo(t,r,t._majorUnit)}initOffsets(t){let e,i,a=0,n=0;this.options.offset&&t.length&&(e=this.getDecimalForValue(t[0]),a=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);t=t.length<3?.5:.25;a=Bt(a,0,t),n=Bt(n,0,t),this._offsets={start:a,end:n,factor:1/(a+1+n)}}_generate(){const t=this._adapter,e=this.min,i=this.max,a=this.options,n=a.time,o=n.unit||mo(n.minUnit,e,i,this._getLabelCapacity(e)),r=U(n.stepSize,1),s="week"===o&&n.isoWeekday,l=Dt(s)||!0===s,h={};let c,d,u=e;if(l&&(u=+t.startOf(u,"isoWeek",s)),u=+t.startOf(u,l?"day":o),t.diff(i,e,o)>1e5*r)throw new Error(e+" and "+i+" are too far apart with stepSize of "+r+" "+o);var g="data"===a.ticks.source&&this.getDataTimestamps();for(c=u,d=0;c<i;c=+t.add(c,r,o),d++)xo(h,c,g);return c!==i&&"ticks"!==a.bounds&&1!==d||xo(h,c,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,a){var n=this.options,o=n.time.displayFormats,r=this._unit,s=this._majorUnit,l=r&&o[r],r=s&&o[s],o=i[e],o=s&&r&&o&&o.major,l=this._adapter.format(t,a||(o?r:l)),n=n.ticks.callback;return n?K(n,[l,e,i],this):l}generateTickLabels(t){let e,i,a;for(e=0,i=t.length;e<i;++e)a=t[e],a.label=this._tickFormatFunction(a.value,e,t)}getDecimalForValue(t){return null===t?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){var e=this._offsets,t=this.getDecimalForValue(t);return this.getPixelForDecimal((e.start+t)*e.factor)}getValueForPixel(t){var e=this._offsets,e=this.getDecimalForPixel(t)/e.factor-e.end;return this.min+e*(this.max-this.min)}_getLabelSize(t){var e=this.options.ticks,i=this.ctx.measureText(t).width,a=Tt(this.isHorizontal()?e.maxRotation:e.minRotation),t=Math.cos(a),e=Math.sin(a),a=this._resolveTickFontOptions(0).size;return{w:i*t+a*e,h:i*e+a*t}}_getLabelCapacity(t){var e=this.options.time,i=e.displayFormats,i=i[e.unit]||i.millisecond,i=this._tickFormatFunction(t,0,bo(this,[t],this._majorUnit),i),i=this._getLabelSize(i),i=Math.floor(this.isHorizontal()?this.width/i.w:this.height/i.h)-1;return 0<i?i:1}getDataTimestamps(){let t,e,i=this._cache.data||[];if(i.length)return i;const a=this.getMatchingVisibleMetas();if(this._normalized&&a.length)return this._cache.data=a[0].controller.getAllParsedValues(this);for(t=0,e=a.length;t<e;++t)i=i.concat(a[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;var a=this.getLabels();for(e=0,i=a.length;e<i;++e)t.push(po(this,a[e]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return se(t.sort(fo))}}function _o(t,e,i){let a,n,o,r;if(i)a=Math.floor(e),n=Math.ceil(e),o=t[a],r=t[n];else{const i=te(t,e);o=i.lo,r=i.hi,a=t[o],n=t[r]}t=n-a;return t?o+(r-o)*(e-a)/t:o}vo.id="time",vo.defaults={bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",major:{enabled:!1}}};class yo extends vo{constructor(t){super(t),this._table=[],this._maxIndex=void 0}initOffsets(){var t=this._getTimestampsForTable();this._table=this.buildLookupTable(t),this._maxIndex=this._table.length-1,super.initOffsets(t)}buildLookupTable(t){var{min:e,max:i}=this;if(!t.length)return[{time:e,pos:0},{time:i,pos:1}];const a=[e];let n,o,r;for(n=0,o=t.length;n<o;++n)e<(r=t[n])&&r<i&&a.push(r);return a.push(i),a}_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}getPixelForValue(t,e){var i=this._offsets,t=this._normalized&&0<this._maxIndex&&!H(e)?e/this._maxIndex:this.getDecimalForValue(t);return this.getPixelForDecimal((i.start+t)*i.factor)}getDecimalForValue(t){return _o(this._table,t)/this._maxIndex}getValueForPixel(t){var e=this._offsets,e=this.getDecimalForPixel(t)/e.factor-e.end;return _o(this._table,e*this._maxIndex,!0)}}yo.id="timeseries",yo.defaults=vo.defaults;be=Object.freeze({__proto__:null,CategoryScale:eo,LinearScale:ao,LogarithmicScale:oo,RadialLinearScale:co,TimeScale:vo,TimeSeriesScale:yo});return Va.register(tn,be,Sn,$n),Va.helpers={...pa},Va._adapters=Na,Va.Animation=gi,Va.Animations=pi,Va.animator=h,Va.controllers=xa.controllers.items,Va.DatasetController=Pi,Va.Element=Di,Va.elements=Sn,Va.Interaction=Se,Va.layouts=Ye,Va.platforms=ri,Va.Scale=Vi,Va.Ticks=Ti,Object.assign(Va,tn,be,Sn,$n,ri),Va.Chart=Va,"undefined"!=typeof window&&(window.Chart=Va),Va});
assets/src/apps/js/frontend/single-curriculum.js CHANGED
@@ -1,6 +1,7 @@
1
  const $ = jQuery;
2
  import SingleCurriculums from './single-curriculum/index';
3
  import lpModalOverlayCompleteItem from './show-lp-overlay-complete-item';
 
4
 
5
  export default SingleCurriculums;
6
 
@@ -14,5 +15,6 @@ export const init = () => {
14
  document.addEventListener( 'DOMContentLoaded', function( event ) {
15
  LP.Hook.doAction( 'course-ready' );
16
  lpModalOverlayCompleteItem.init();
 
17
  //init();
18
  } );
1
  const $ = jQuery;
2
  import SingleCurriculums from './single-curriculum/index';
3
  import lpModalOverlayCompleteItem from './show-lp-overlay-complete-item';
4
+ import scrollToItemCurrent from './single-curriculum/scrolltoitem';
5
 
6
  export default SingleCurriculums;
7
 
15
  document.addEventListener( 'DOMContentLoaded', function( event ) {
16
  LP.Hook.doAction( 'course-ready' );
17
  lpModalOverlayCompleteItem.init();
18
+ scrollToItemCurrent.init();
19
  //init();
20
  } );
assets/src/apps/js/frontend/single-curriculum/components/compatible.js CHANGED
@@ -14,7 +14,7 @@ LP.Hook.addAction( 'lp-compatible-builder', () => {
14
  } );
15
  }
16
 
17
- if ( typeof vc_js !== 'undefined' ) {
18
  [ ...document.querySelectorAll( '#popup-content' ) ][ 0 ].addEventListener( 'scroll', () => {
19
  VcWaypoint.refreshAll();
20
  } );
14
  } );
15
  }
16
 
17
+ if ( typeof vc_js !== 'undefined' && typeof VcWaypoint !== 'undefined' ) {
18
  [ ...document.querySelectorAll( '#popup-content' ) ][ 0 ].addEventListener( 'scroll', () => {
19
  VcWaypoint.refreshAll();
20
  } );
assets/src/apps/js/frontend/single-curriculum/scrolltoitem.js ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ const $ = jQuery;
2
+
3
+ const scrollToItemCurrent = {
4
+ init() {
5
+ this.scrollToItemViewing = function() {
6
+ const elItemViewing = $( '.viewing-course-item' );
7
+ if ( elItemViewing.length ) {
8
+ const heightCourseItemContentHeader = $( '#popup-sidebar' ).outerHeight();
9
+ const heightSectionTitle = $( '.section-title' ).outerHeight();
10
+ const heightSectionHeader = $( '.section-header' ).outerHeight();
11
+ const regex = new RegExp( '^viewing-course-item-([0-9].*)' );
12
+ const classList = elItemViewing.attr( 'class' );
13
+ const classArr = classList.split( /\s+/ );
14
+ let idItem = 0;
15
+
16
+ $.each( classArr, function( i, className ) {
17
+ const compare = regex.exec( className );
18
+
19
+ if ( compare ) {
20
+ idItem = compare[ 1 ];
21
+ return false;
22
+ }
23
+ } );
24
+
25
+ if ( 0 === idItem ) {
26
+ return;
27
+ }
28
+
29
+ const elItemCurrent = $( '.course-item-' + idItem );
30
+ const offSetTop = elItemCurrent.offset().top;
31
+ let numberOffSetTop = offSetTop - heightCourseItemContentHeader;
32
+
33
+ if ( undefined === heightSectionTitle ) {
34
+ numberOffSetTop = numberOffSetTop - heightSectionHeader + 20;
35
+ } else {
36
+ numberOffSetTop = numberOffSetTop - heightSectionTitle;
37
+ }
38
+ $( '#learn-press-course-curriculum' ).animate( {
39
+ scrollTop: numberOffSetTop + 300,
40
+ }, 800 );
41
+ }
42
+ };
43
+ this.scrollToItemViewing();
44
+ },
45
+ };
46
+
47
+ export default scrollToItemCurrent;
assets/src/apps/js/ultils/handle-ajax-api.js DELETED
@@ -1,21 +0,0 @@
1
- const handleAjax = function( url, params, functions ) {
2
- wp.apiFetch( {
3
- path: url,
4
- method: 'POST',
5
- data: params,
6
- } ).then( ( res ) => {
7
- if ( 'function' === typeof functions.success ) {
8
- functions.success( res );
9
- }
10
- } ).catch( ( err ) => {
11
- if ( 'function' === typeof functions.error ) {
12
- functions.error( err );
13
- }
14
- } ).then( () => {
15
- if ( 'function' === typeof functions.completed ) {
16
- functions.completed();
17
- }
18
- } );
19
- };
20
-
21
- export default handleAjax;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/src/apps/js/ultils/lp-modal-overlay.js DELETED
@@ -1,54 +0,0 @@
1
- const $ = jQuery;
2
- let elLPOverlay = null;
3
- const lpModalOverlay = {
4
- elLPOverlay: null,
5
- elMainContent: null,
6
- elTitle: null,
7
- elBtnYes: null,
8
- elBtnNo: null,
9
- elFooter: null,
10
- elCalledModal: null,
11
- callBackYes: null,
12
- instance: null,
13
- init() {
14
- this.instance = this;
15
- this.elLPOverlay = $( '.lp-overlay' );
16
-
17
- if ( ! this.elLPOverlay.length ) {
18
- return false;
19
- }
20
- elLPOverlay = this.elLPOverlay;
21
-
22
- this.elMainContent = elLPOverlay.find( '.main-content' );
23
- this.elTitle = elLPOverlay.find( '.modal-title' );
24
- this.elBtnYes = elLPOverlay.find( '.btn-yes' );
25
- this.elBtnNo = elLPOverlay.find( '.btn-no' );
26
- this.elFooter = elLPOverlay.find( '.lp-modal-footer' );
27
-
28
- $( document ).on( 'click', '.close, .btn-no', function() {
29
- elLPOverlay.hide();
30
- } );
31
-
32
- $( document ).on( 'click', '.btn-yes', function() {
33
- if ( 'function' === typeof lpModalOverlay.callBackYes ) {
34
- lpModalOverlay.callBackYes();
35
- }
36
- } );
37
-
38
- return true;
39
- },
40
- setElCalledModal( elCalledModal ) {
41
- this.elCalledModal = elCalledModal;
42
- },
43
- setContentModal( content, event ) {
44
- this.elMainContent.html( content );
45
- if ( 'function' === typeof event ) {
46
- event();
47
- }
48
- },
49
- setTitleModal( content ) {
50
- this.elTitle.html( content );
51
- },
52
- };
53
-
54
- export default lpModalOverlay;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/src/js/admin/pages/search-lp-addons-themes.js DELETED
@@ -1,50 +0,0 @@
1
- ( function( $ ) {
2
- let timer = null,
3
- $wraps = null,
4
- $cloneWraps = null;
5
-
6
- const onSearch = function( keyword ) {
7
- if ( ! $cloneWraps ) {
8
- $cloneWraps = $wraps.clone();
9
- }
10
- const keywords = keyword.toLowerCase().split( /\s+/ ).filter( function( a, b ) {
11
- return a.length >= 3;
12
- } );
13
- const foundItems = function( $w1, $w2 ) {
14
- return $w1.find( '.plugin-card' ).each( function() {
15
- const $item = $( this ),
16
- itemText = $item.find( '.item-title' ).text().toLowerCase(),
17
- itemDesc = $item.find( '.column-description, .theme-description' ).text();
18
- const found = function() {
19
- const reg = new RegExp( keywords.join( '|' ), 'ig' );
20
- return itemText.match( reg ) || itemDesc.match( reg );
21
- };
22
- if ( keywords.length ) {
23
- if ( found() ) {
24
- const $clone = $item.clone();
25
- $w2.append( $clone );
26
- }
27
- } else {
28
- $w2.append( $item.clone() );
29
- }
30
- } );
31
- };
32
-
33
- $wraps.each( function( i ) {
34
- const $this = $( this ).html( '' ),
35
- $items = foundItems( $cloneWraps.eq( i ), $this ),
36
- count = $this.children().length;
37
-
38
- $this.prev( 'h2' ).find( 'span' ).html( count );
39
- } );
40
- };
41
-
42
- $( document ).on( 'keyup', '.lp-search-addon', function( e ) {
43
- timer && clearTimeout( timer );
44
- timer = setTimeout( onSearch, 300, e.target.value );
45
- } );
46
-
47
- jQuery( function() {
48
- $wraps = $( '.addons-browse' );
49
- } );
50
- }( jQuery ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/src/js/admin/pages/setup.js DELETED
@@ -1,164 +0,0 @@
1
- ( function( $ ) {
2
- 'use strict';
3
- let $main, $setupForm;
4
-
5
- const checkForm = function checkForm( $form ) {
6
- const $emails = $form.find( 'input[type="email"]' );
7
- let valid = true;
8
-
9
- $emails.each( function() {
10
- const $this = $( this );
11
- $this.css( 'border-color', '' );
12
-
13
- switch ( $this.attr( 'name' ) ) {
14
- case 'settings[paypal][paypal_email]':
15
- case 'settings[paypal][paypal_sandbox_email]':
16
- if ( ! $this.closest( 'tr' ).prev().find( 'input[type="checkbox"]' ).is( ':checked' ) ) {
17
- return;
18
- }
19
- break;
20
- }
21
-
22
- if ( ! isEmail( this.value ) ) {
23
- valid = false;
24
- $this.css( 'border-color', '#FF0000' );
25
- }
26
- } );
27
-
28
- return valid;
29
- };
30
-
31
- const blockContent = function blockContent( block ) {
32
- $main.toggleClass( 'loading', block === undefined ? true : block );
33
- };
34
-
35
- const getFormData = function getFormData( more ) {
36
- $setupForm = $( '#learn-press-setup-form' );
37
- const data = $setupForm.serializeJSON();
38
-
39
- return $.extend( data, more || {} );
40
- };
41
-
42
- const replaceMainContent = function replaceMainContent( newContent ) {
43
- const $newContent = $( newContent );
44
- $main.replaceWith( $newContent );
45
- $main = $newContent;
46
- };
47
-
48
- const navPages = function navPages( e ) {
49
- e.preventDefault();
50
-
51
- if ( ! checkForm( $setupForm ) ) {
52
- return;
53
- }
54
-
55
- const loadUrl = $( this ).attr( 'href' );
56
-
57
- $main.addClass( 'loading' );
58
- $.post( {
59
- url: loadUrl,
60
- data: getFormData(),
61
- success( res ) {
62
- const $html = $( res );
63
- replaceMainContent( $html.contents().filter( '#main' ) );
64
-
65
- LP.setUrl( loadUrl );
66
-
67
- $( '.learn-press-dropdown-pages' ).LP( 'DropdownPages' );
68
- $( '.learn-press-tip' ).LP( 'QuickTip' );
69
- $main.removeClass( 'loading' );
70
- },
71
- } );
72
- };
73
-
74
- const updateCurrency = function updateCurrency() {
75
- const m = $( this ).children( ':selected' ).html().match( /\((.*)\)/ ),
76
- symbol = m ? m[ 1 ] : '';
77
- $( '#currency-pos' ).children().each( function() {
78
- const $option = $( this );
79
- let text = $option.html();
80
-
81
- switch ( $option.val() ) {
82
- case 'left':
83
- text = text.replace( /\( (.*)69/, '( ' + symbol + '69' );
84
- break;
85
- case 'right':
86
- text = text.replace( /9([^0-9]*) \)/, '9' + symbol + ' )' );
87
- break;
88
- case 'left_with_space':
89
- text = text.replace( /\( (.*) 6/, '( ' + symbol + ' 6' );
90
- break;
91
- case 'right_with_space':
92
- text = text.replace( /9 (.*) \)/, '9 ' + symbol + ' )' );
93
- break;
94
- }
95
- $option.html( text );
96
- } );
97
- };
98
-
99
- const updatePrice = function updatePrice() {
100
- $.post( {
101
- url: '',
102
- dataType: 'html',
103
- data: getFormData( {
104
- 'lp-ajax': 'get-price-format',
105
- } ),
106
- success( res ) {
107
- $( '#preview-price' ).html( res );
108
- },
109
- } );
110
- };
111
-
112
- const createPages = function createPages( e ) {
113
- e.preventDefault();
114
- blockContent();
115
-
116
- $.post( {
117
- url: $( this ).attr( 'href' ),
118
- dataType: 'html',
119
- data: getFormData( {
120
- 'lp-ajax': 'setup-create-pages',
121
- } ),
122
- success( res ) {
123
- replaceMainContent( $( res ).contents().filter( '#main' ) );
124
- $( '.learn-press-dropdown-pages' ).LP( 'DropdownPages' );
125
- blockContent( false );
126
- },
127