@justifi/webcomponents 6.5.1-rc.3 → 6.5.1-rc.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (520) hide show
  1. package/dist/cjs/{GooglePay-40aEKdDF.js → Refund-Blquw3jZ.js} +0 -446
  2. package/dist/cjs/bank-account-document-form-inputs_6.cjs.entry.js +4 -5
  3. package/dist/cjs/bank-account-form.cjs.entry.js +2 -2
  4. package/dist/cjs/{business.service-BggHdPOV.js → business.service-DrBmfEbR.js} +1 -1
  5. package/dist/cjs/card-form.cjs.entry.js +2 -2
  6. package/dist/cjs/{check-pkg-version-DuPkU5qI.js → check-pkg-version-Bj0XkWnL.js} +2 -2
  7. package/dist/cjs/{checkout.service-BUcIs9az.js → checkout.service-BEU6CI0t.js} +1 -1
  8. package/dist/cjs/checkout.store-BA6h-dp2.js +107 -0
  9. package/dist/cjs/checkouts-list-core.cjs.entry.js +2 -3
  10. package/dist/cjs/custom-popper.cjs.entry.js +2 -2
  11. package/dist/cjs/{dispute.service-CxWqivLc.js → dispute.service-c0CZxPpe.js} +1 -1
  12. package/dist/cjs/form-control-checkbox.cjs.entry.js +2 -2
  13. package/dist/cjs/form-control-date.cjs.entry.js +2 -2
  14. package/dist/cjs/form-control-file-v2_2.cjs.entry.js +3 -3
  15. package/dist/cjs/form-control-monetary.cjs.entry.js +2 -2
  16. package/dist/cjs/form-control-number-masked_3.cjs.entry.js +2 -2
  17. package/dist/cjs/form-control-number.cjs.entry.js +2 -2
  18. package/dist/cjs/form-control-radio.cjs.entry.js +2 -2
  19. package/dist/cjs/form-control-select_3.cjs.entry.js +4 -4
  20. package/dist/cjs/{get-payment-details-D_dDxsPG.js → get-payment-details-D8UQRtX1.js} +2 -2
  21. package/dist/cjs/{get-subaccounts-_D9lzD5O.js → get-subaccounts-fKcKqvrx.js} +2 -2
  22. package/dist/cjs/gross-payment-chart-core.cjs.entry.js +1 -1
  23. package/dist/cjs/hidden-input_2.cjs.entry.js +5 -5
  24. package/dist/cjs/{index-CajjbB9t.js → index-C2ITzalN.js} +0 -1
  25. package/dist/cjs/index.cjs.js +1 -1
  26. package/dist/cjs/internal-tokenize-payment-method_7.cjs.entry.js +23 -22
  27. package/dist/cjs/justifi-additional-questions-form-step-core_6.cjs.entry.js +5 -6
  28. package/dist/cjs/justifi-additional-questions-form-step_9.cjs.entry.js +2 -3
  29. package/dist/cjs/justifi-additional-statement_8.cjs.entry.js +8 -8
  30. package/dist/cjs/{justifi-apple-pay_8.cjs.entry.js → justifi-apple-pay_7.cjs.entry.js} +253 -1124
  31. package/dist/cjs/justifi-bank-account-billing-form-simple_3.cjs.entry.js +2 -2
  32. package/dist/cjs/justifi-business-details.cjs.entry.js +4 -5
  33. package/dist/cjs/justifi-business-form.cjs.entry.js +4 -5
  34. package/dist/cjs/justifi-checkout.cjs.entry.js +15 -14
  35. package/dist/cjs/justifi-checkouts-list-filters.cjs.entry.js +9 -10
  36. package/dist/cjs/justifi-checkouts-list.cjs.entry.js +7 -8
  37. package/dist/cjs/justifi-dispute-management-core.cjs.entry.js +1 -1
  38. package/dist/cjs/justifi-dispute-management.cjs.entry.js +5 -6
  39. package/dist/cjs/justifi-dispute-notification_3.cjs.entry.js +8 -9
  40. package/dist/cjs/justifi-gross-payment-chart.cjs.entry.js +3 -4
  41. package/dist/cjs/justifi-order-terminals.cjs.entry.js +9 -10
  42. package/dist/cjs/justifi-owner-form_3.cjs.entry.js +2 -3
  43. package/dist/cjs/justifi-payment-details.cjs.entry.js +5 -6
  44. package/dist/cjs/justifi-payment-provisioning.cjs.entry.js +4 -5
  45. package/dist/cjs/justifi-payment-transactions-list.cjs.entry.js +6 -7
  46. package/dist/cjs/justifi-payments-list-filters.cjs.entry.js +2 -2
  47. package/dist/cjs/justifi-payments-list.cjs.entry.js +6 -7
  48. package/dist/cjs/justifi-payout-details.cjs.entry.js +5 -6
  49. package/dist/cjs/justifi-payout-transactions-list.cjs.entry.js +6 -7
  50. package/dist/cjs/justifi-payouts-list-filters.cjs.entry.js +2 -2
  51. package/dist/cjs/justifi-payouts-list.cjs.entry.js +7 -8
  52. package/dist/cjs/justifi-refund-payment.cjs.entry.js +9 -10
  53. package/dist/cjs/justifi-saved-payment-method.cjs.entry.js +1 -1
  54. package/dist/cjs/justifi-season-interruption-insurance.cjs.entry.js +8 -7
  55. package/dist/cjs/justifi-skeleton.cjs.entry.js +1 -1
  56. package/dist/cjs/justifi-terminal-orders-list-filters.cjs.entry.js +11 -12
  57. package/dist/cjs/justifi-terminal-orders-list.cjs.entry.js +6 -7
  58. package/dist/cjs/justifi-terminals-list-filters.cjs.entry.js +7 -8
  59. package/dist/cjs/justifi-terminals-list.cjs.entry.js +7 -8
  60. package/dist/cjs/justifi-tokenize-payment-method.cjs.entry.js +1 -1
  61. package/dist/cjs/loader.cjs.js +1 -1
  62. package/dist/cjs/{package-C6nOTkVV.js → package-Dptg-P5y.js} +1 -1
  63. package/dist/cjs/pagination-menu.cjs.entry.js +3 -3
  64. package/dist/cjs/payment-details-core.cjs.entry.js +10 -11
  65. package/dist/cjs/payment-method-option.cjs.entry.js +1 -1
  66. package/dist/cjs/{payment.service-wWZTmyFv.js → payment.service-DXbR13Kq.js} +1 -1
  67. package/dist/cjs/payments-list-core.cjs.entry.js +2 -3
  68. package/dist/cjs/payout-details-core.cjs.entry.js +3 -3
  69. package/dist/cjs/{payout.service-CWAem5VG.js → payout.service-D0U6kzXJ.js} +1 -1
  70. package/dist/cjs/payouts-list-core.cjs.entry.js +2 -3
  71. package/dist/cjs/table-filters-menu.cjs.entry.js +1 -1
  72. package/dist/cjs/terminal-orders-list-core.cjs.entry.js +3 -4
  73. package/dist/cjs/{terminal-orders-table-DBNG4K5I.js → terminal-orders-table-BByfBAEK.js} +3 -3
  74. package/dist/cjs/terminal-quantity-selector.cjs.entry.js +1 -1
  75. package/dist/cjs/{terminal.service-DSlqCGxE.js → terminal.service-BqXeiERV.js} +1 -1
  76. package/dist/cjs/terminals-list-core.cjs.entry.js +2 -3
  77. package/dist/cjs/webcomponents.cjs.js +1 -1
  78. package/dist/collection/api/index.js +0 -2
  79. package/dist/collection/collection-manifest.json +0 -1
  80. package/dist/collection/components/checkout/bank-account-form/bank-account-form.js +2 -2
  81. package/dist/collection/components/checkout/card-form/card-form.js +2 -2
  82. package/dist/collection/components/checkout/checkout.js +2 -2
  83. package/dist/collection/components/checkout/save-new-payment-method.js +1 -1
  84. package/dist/collection/components/checkout/saved-payment-method.js +1 -1
  85. package/dist/collection/components/checkouts-list/checkouts-list-core.js +1 -1
  86. package/dist/collection/components/checkouts-list/checkouts-list-filters.js +1 -1
  87. package/dist/collection/components/checkouts-list/checkouts-list.js +1 -1
  88. package/dist/collection/components/dispute-management/dispute-management-core.js +1 -1
  89. package/dist/collection/components/dispute-management/dispute-management.js +1 -1
  90. package/dist/collection/components/dispute-management/dispute-notification.js +2 -2
  91. package/dist/collection/components/dispute-management/dispute-response/additional-statement.js +1 -1
  92. package/dist/collection/components/dispute-management/dispute-response/cancellation-policy.js +1 -1
  93. package/dist/collection/components/dispute-management/dispute-response/customer-details.js +1 -1
  94. package/dist/collection/components/dispute-management/dispute-response/dispute-response-core.js +1 -1
  95. package/dist/collection/components/dispute-management/dispute-response/dispute-response.js +1 -1
  96. package/dist/collection/components/dispute-management/dispute-response/duplicate-charge.js +1 -1
  97. package/dist/collection/components/dispute-management/dispute-response/electronic-evidence.js +1 -1
  98. package/dist/collection/components/dispute-management/dispute-response/product-or-service.js +1 -1
  99. package/dist/collection/components/dispute-management/dispute-response/refund-policy.js +1 -1
  100. package/dist/collection/components/dispute-management/dispute-response/shipping-details.js +1 -1
  101. package/dist/collection/components/filters/table-filters-menu.js +1 -1
  102. package/dist/collection/components/gross-payment-chart/gross-payment-chart-core.js +1 -1
  103. package/dist/collection/components/modular-checkout/ModularCheckout.js +0 -1
  104. package/dist/collection/components/modular-checkout/modular-checkout.js +6 -44
  105. package/dist/collection/components/modular-checkout/sub-components/bank-account-billing-form-simple.js +1 -1
  106. package/dist/collection/components/modular-checkout/sub-components/bank-account.js +2 -2
  107. package/dist/collection/components/modular-checkout/sub-components/card-billing-form-simple.js +1 -1
  108. package/dist/collection/components/modular-checkout/sub-components/card-form.js +2 -2
  109. package/dist/collection/components/modular-checkout/sub-components/payment-method-option.js +1 -1
  110. package/dist/collection/components/modular-checkout/sub-components/summary.js +1 -1
  111. package/dist/collection/components/order-terminals/order-terminals.js +1 -1
  112. package/dist/collection/components/order-terminals/terminal-quantity-selector/terminal-quantity-selector.js +1 -1
  113. package/dist/collection/components/payment-details/payment-details-core.js +8 -8
  114. package/dist/collection/components/payment-transactions-list/payment-transactions-list.js +1 -1
  115. package/dist/collection/components/payments-list/payments-list-core.js +1 -1
  116. package/dist/collection/components/payments-list/payments-list-filters.js +2 -2
  117. package/dist/collection/components/payments-list/payments-list.js +1 -1
  118. package/dist/collection/components/payout-details/payout-details-core.js +3 -3
  119. package/dist/collection/components/payout-transactions-list/payout-transactions-list.js +1 -1
  120. package/dist/collection/components/payouts-list/payouts-list-core.js +1 -1
  121. package/dist/collection/components/payouts-list/payouts-list-filters.js +2 -2
  122. package/dist/collection/components/payouts-list/payouts-list.js +1 -1
  123. package/dist/collection/components/terminal-orders-list/terminal-orders-list-core.js +1 -1
  124. package/dist/collection/components/terminal-orders-list/terminal-orders-list-filters.js +2 -2
  125. package/dist/collection/components/terminal-orders-list/terminal-orders-list.js +1 -1
  126. package/dist/collection/components/terminals-list/terminals-list-core.js +1 -1
  127. package/dist/collection/components/terminals-list/terminals-list-filters.js +1 -1
  128. package/dist/collection/components/terminals-list/terminals-list.js +1 -1
  129. package/dist/collection/components/tokenize-payment-method/internal-tokenize-payment-method.js +1 -1
  130. package/dist/collection/components/tokenize-payment-method/tokenize-payment-method.js +1 -1
  131. package/dist/collection/store/checkout.store.js +0 -4
  132. package/dist/collection/ui-components/custom-popper/custom-popper.js +2 -2
  133. package/dist/collection/ui-components/form/form-control-checkbox.js +2 -2
  134. package/dist/collection/ui-components/form/form-control-date.js +2 -2
  135. package/dist/collection/ui-components/form/form-control-file-v2.js +1 -1
  136. package/dist/collection/ui-components/form/form-control-file.js +2 -2
  137. package/dist/collection/ui-components/form/form-control-monetary.js +2 -2
  138. package/dist/collection/ui-components/form/form-control-number-masked.js +2 -2
  139. package/dist/collection/ui-components/form/form-control-number.js +2 -2
  140. package/dist/collection/ui-components/form/form-control-radio.js +2 -2
  141. package/dist/collection/ui-components/form/form-control-select.js +2 -2
  142. package/dist/collection/ui-components/form/form-control-text.js +2 -2
  143. package/dist/collection/ui-components/form/form-control-textarea.js +2 -2
  144. package/dist/collection/ui-components/form/hidden-input.js +1 -1
  145. package/dist/collection/ui-components/form/iframe-input.js +3 -3
  146. package/dist/collection/ui-components/pagination-menu/pagination-menu.js +3 -3
  147. package/dist/collection/ui-components/shadow-dom-components/justifi-button.js +1 -1
  148. package/dist/collection/ui-components/shadow-dom-components/justifi-header.js +1 -1
  149. package/dist/collection/ui-components/shadow-dom-components/justifi-skeleton.js +1 -1
  150. package/dist/docs.json +3 -540
  151. package/dist/esm/{GooglePay-f7mYX17c.js → Refund-BugCdfRo.js} +1 -436
  152. package/dist/esm/bank-account-document-form-inputs_6.entry.js +3 -4
  153. package/dist/esm/bank-account-form.entry.js +2 -2
  154. package/dist/esm/{business.service-CzHfftZk.js → business.service-pWcc3kfX.js} +1 -1
  155. package/dist/esm/card-form.entry.js +2 -2
  156. package/dist/esm/{check-pkg-version-Cqb7EhvC.js → check-pkg-version-D6a-vvrO.js} +2 -2
  157. package/dist/esm/{checkout.service-BWdnJLVG.js → checkout.service-B4xSV2-X.js} +1 -1
  158. package/dist/esm/checkout.store-CaS_htQd.js +101 -0
  159. package/dist/esm/checkouts-list-core.entry.js +2 -3
  160. package/dist/esm/custom-popper.entry.js +2 -2
  161. package/dist/esm/{dispute.service-CqX5HR5o.js → dispute.service-3Kbbh1J9.js} +1 -1
  162. package/dist/esm/form-control-checkbox.entry.js +2 -2
  163. package/dist/esm/form-control-date.entry.js +2 -2
  164. package/dist/esm/form-control-file-v2_2.entry.js +3 -3
  165. package/dist/esm/form-control-monetary.entry.js +2 -2
  166. package/dist/esm/form-control-number-masked_3.entry.js +2 -2
  167. package/dist/esm/form-control-number.entry.js +2 -2
  168. package/dist/esm/form-control-radio.entry.js +2 -2
  169. package/dist/esm/form-control-select_3.entry.js +4 -4
  170. package/dist/esm/{get-payment-details-D0T7bd_-.js → get-payment-details-CakzKvOr.js} +1 -1
  171. package/dist/esm/{get-subaccounts-Gil-SOoF.js → get-subaccounts-Cw1Adtmo.js} +1 -1
  172. package/dist/esm/gross-payment-chart-core.entry.js +1 -1
  173. package/dist/esm/hidden-input_2.entry.js +5 -5
  174. package/dist/esm/{index-DkoufM1t.js → index-DCIW8z1f.js} +0 -1
  175. package/dist/esm/index.js +1 -1
  176. package/dist/esm/internal-tokenize-payment-method_7.entry.js +12 -11
  177. package/dist/esm/justifi-additional-questions-form-step-core_6.entry.js +1 -2
  178. package/dist/esm/justifi-additional-questions-form-step_9.entry.js +2 -3
  179. package/dist/esm/justifi-additional-statement_8.entry.js +8 -8
  180. package/dist/esm/{justifi-apple-pay_8.entry.js → justifi-apple-pay_7.entry.js} +137 -1007
  181. package/dist/esm/justifi-bank-account-billing-form-simple_3.entry.js +2 -2
  182. package/dist/esm/justifi-business-details.entry.js +4 -5
  183. package/dist/esm/justifi-business-form.entry.js +4 -5
  184. package/dist/esm/justifi-checkout.entry.js +8 -7
  185. package/dist/esm/justifi-checkouts-list-filters.entry.js +2 -3
  186. package/dist/esm/justifi-checkouts-list.entry.js +6 -7
  187. package/dist/esm/justifi-dispute-management-core.entry.js +1 -1
  188. package/dist/esm/justifi-dispute-management.entry.js +5 -6
  189. package/dist/esm/justifi-dispute-notification_3.entry.js +8 -9
  190. package/dist/esm/justifi-gross-payment-chart.entry.js +3 -4
  191. package/dist/esm/justifi-order-terminals.entry.js +6 -7
  192. package/dist/esm/justifi-owner-form_3.entry.js +2 -3
  193. package/dist/esm/justifi-payment-details.entry.js +5 -6
  194. package/dist/esm/justifi-payment-provisioning.entry.js +4 -5
  195. package/dist/esm/justifi-payment-transactions-list.entry.js +5 -6
  196. package/dist/esm/justifi-payments-list-filters.entry.js +2 -2
  197. package/dist/esm/justifi-payments-list.entry.js +5 -6
  198. package/dist/esm/justifi-payout-details.entry.js +4 -5
  199. package/dist/esm/justifi-payout-transactions-list.entry.js +5 -6
  200. package/dist/esm/justifi-payouts-list-filters.entry.js +2 -2
  201. package/dist/esm/justifi-payouts-list.entry.js +6 -7
  202. package/dist/esm/justifi-refund-payment.entry.js +5 -6
  203. package/dist/esm/justifi-saved-payment-method.entry.js +1 -1
  204. package/dist/esm/justifi-season-interruption-insurance.entry.js +5 -4
  205. package/dist/esm/justifi-skeleton.entry.js +1 -1
  206. package/dist/esm/justifi-terminal-orders-list-filters.entry.js +3 -4
  207. package/dist/esm/justifi-terminal-orders-list.entry.js +5 -6
  208. package/dist/esm/justifi-terminals-list-filters.entry.js +2 -3
  209. package/dist/esm/justifi-terminals-list.entry.js +6 -7
  210. package/dist/esm/justifi-tokenize-payment-method.entry.js +1 -1
  211. package/dist/esm/loader.js +1 -1
  212. package/dist/esm/{package-CzedYX3W.js → package-czPIvHxt.js} +1 -1
  213. package/dist/esm/pagination-menu.entry.js +3 -3
  214. package/dist/esm/payment-details-core.entry.js +9 -10
  215. package/dist/esm/payment-method-option.entry.js +1 -1
  216. package/dist/esm/{payment.service-CWyZF34P.js → payment.service-nExZY_sU.js} +1 -1
  217. package/dist/esm/payments-list-core.entry.js +2 -3
  218. package/dist/esm/payout-details-core.entry.js +3 -3
  219. package/dist/esm/{payout.service-CkTievFG.js → payout.service-B9-JQqU6.js} +1 -1
  220. package/dist/esm/payouts-list-core.entry.js +2 -3
  221. package/dist/esm/table-filters-menu.entry.js +1 -1
  222. package/dist/esm/terminal-orders-list-core.entry.js +3 -4
  223. package/dist/esm/{terminal-orders-table-OX3ZvzZy.js → terminal-orders-table-DsrpmD9F.js} +1 -1
  224. package/dist/esm/terminal-quantity-selector.entry.js +1 -1
  225. package/dist/esm/{terminal.service-Bu5-dhum.js → terminal.service-DvFiKAKV.js} +1 -1
  226. package/dist/esm/terminals-list-core.entry.js +2 -3
  227. package/dist/esm/webcomponents.js +1 -1
  228. package/dist/module/Analytics.js +0 -2
  229. package/dist/module/ModularCheckout.js +0 -1
  230. package/dist/module/additional-statement.js +1 -1
  231. package/dist/module/apple-pay.js +120 -1
  232. package/dist/module/bank-account-billing-form-simple.js +1 -1
  233. package/dist/module/bank-account-document-inputs.js +0 -2
  234. package/dist/module/bank-account-form.js +2 -2
  235. package/dist/module/bank-account.js +2 -2
  236. package/dist/module/business-bank-account-form-step-core.js +0 -2
  237. package/dist/module/business-bank-account-form-step.js +0 -2
  238. package/dist/module/business-terms-conditions-form-step.js +0 -2
  239. package/dist/module/business.service.js +0 -2
  240. package/dist/module/cancellation-policy.js +1 -1
  241. package/dist/module/card-billing-form-simple.js +1 -1
  242. package/dist/module/card-form.js +2 -2
  243. package/dist/module/card-form2.js +2 -2
  244. package/dist/module/checkout.service.js +0 -2
  245. package/dist/module/checkout.store.js +0 -4
  246. package/dist/module/checkouts-list-core2.js +1 -3
  247. package/dist/module/custom-popper2.js +2 -2
  248. package/dist/module/customer-details.js +1 -1
  249. package/dist/module/dispute-management-core.js +1 -1
  250. package/dist/module/dispute-notification.js +2 -2
  251. package/dist/module/dispute-response-actions.js +0 -2
  252. package/dist/module/dispute-response-core.js +1 -1
  253. package/dist/module/dispute-response.js +1 -1
  254. package/dist/module/duplicate-charge.js +1 -1
  255. package/dist/module/electronic-evidence.js +1 -1
  256. package/dist/module/form-control-checkbox2.js +2 -2
  257. package/dist/module/form-control-date2.js +2 -2
  258. package/dist/module/form-control-file-v22.js +1 -1
  259. package/dist/module/form-control-file2.js +2 -2
  260. package/dist/module/form-control-monetary2.js +2 -2
  261. package/dist/module/form-control-number-masked2.js +2 -2
  262. package/dist/module/form-control-number.js +2 -2
  263. package/dist/module/form-control-radio2.js +2 -2
  264. package/dist/module/form-control-select2.js +2 -2
  265. package/dist/module/form-control-text2.js +2 -2
  266. package/dist/module/form-control-textarea2.js +2 -2
  267. package/dist/module/get-payment-details.js +0 -2
  268. package/dist/module/get-subaccounts.js +0 -2
  269. package/dist/module/gross-payment-chart-core2.js +1 -1
  270. package/dist/module/hidden-input2.js +1 -1
  271. package/dist/module/iframe-input2.js +3 -3
  272. package/dist/module/internal-tokenize-payment-method2.js +1 -3
  273. package/dist/module/justifi-business-form.js +0 -2
  274. package/dist/module/justifi-button2.js +1 -1
  275. package/dist/module/justifi-checkout.js +40 -46
  276. package/dist/module/justifi-checkouts-list-filters.js +1 -3
  277. package/dist/module/justifi-checkouts-list.js +1 -3
  278. package/dist/module/justifi-dispute-management.js +1 -1
  279. package/dist/module/justifi-gross-payment-chart.js +0 -2
  280. package/dist/module/justifi-header2.js +1 -1
  281. package/dist/module/justifi-order-terminals.js +1 -3
  282. package/dist/module/justifi-payment-provisioning.js +0 -2
  283. package/dist/module/justifi-payment-transactions-list.js +1 -3
  284. package/dist/module/justifi-payments-list-filters.js +2 -2
  285. package/dist/module/justifi-payments-list.js +1 -3
  286. package/dist/module/justifi-payout-details.js +0 -2
  287. package/dist/module/justifi-payout-transactions-list.js +1 -3
  288. package/dist/module/justifi-payouts-list-filters.js +2 -2
  289. package/dist/module/justifi-payouts-list.js +1 -3
  290. package/dist/module/justifi-refund-payment.js +0 -2
  291. package/dist/module/justifi-saved-payment-method.js +1 -1
  292. package/dist/module/justifi-season-interruption-insurance.js +0 -2
  293. package/dist/module/justifi-skeleton.js +1 -1
  294. package/dist/module/justifi-terminal-orders-list-filters.js +2 -4
  295. package/dist/module/justifi-terminal-orders-list.js +1 -3
  296. package/dist/module/justifi-terminals-list-filters.js +1 -3
  297. package/dist/module/justifi-terminals-list.js +1 -3
  298. package/dist/module/justifi-tokenize-payment-method.js +1 -1
  299. package/dist/module/modular-checkout.js +6 -46
  300. package/dist/module/package.js +1 -1
  301. package/dist/module/pagination-menu2.js +3 -3
  302. package/dist/module/payment-details-core2.js +8 -10
  303. package/dist/module/payment-method-option.js +1 -1
  304. package/dist/module/payment.service.js +0 -2
  305. package/dist/module/payments-list-core2.js +1 -3
  306. package/dist/module/payout-details-core2.js +3 -3
  307. package/dist/module/payout.service.js +0 -2
  308. package/dist/module/payouts-list-core2.js +1 -3
  309. package/dist/module/plaid.service.js +0 -2
  310. package/dist/module/product-or-service.js +1 -1
  311. package/dist/module/refund-policy.js +1 -1
  312. package/dist/module/save-new-payment-method.js +1 -1
  313. package/dist/module/shipping-details.js +1 -1
  314. package/dist/module/summary.js +1 -1
  315. package/dist/module/table-filters-menu2.js +1 -1
  316. package/dist/module/terminal-orders-list-core2.js +1 -3
  317. package/dist/module/terminal-quantity-selector2.js +1 -1
  318. package/dist/module/terminal.service.js +0 -2
  319. package/dist/module/terminals-list-core2.js +1 -3
  320. package/dist/types/api/Checkout.d.ts +0 -2
  321. package/dist/types/api/index.d.ts +0 -2
  322. package/dist/types/components/checkout/checkout.d.ts +0 -1
  323. package/dist/types/components/modular-checkout/ModularCheckout.d.ts +1 -2
  324. package/dist/types/components/modular-checkout/modular-checkout.d.ts +0 -5
  325. package/dist/types/components.d.ts +0 -140
  326. package/dist/types/store/checkout.store.d.ts +0 -1
  327. package/dist/webcomponents/index.esm.js +1 -1
  328. package/dist/webcomponents/{p-a22d1078.entry.js → p-0082f428.entry.js} +1 -1
  329. package/dist/webcomponents/p-0b760c4f.entry.js +1 -0
  330. package/dist/webcomponents/{p-19dabeab.entry.js → p-1193a1ac.entry.js} +1 -1
  331. package/dist/webcomponents/p-159d8ae7.entry.js +1 -0
  332. package/dist/webcomponents/{p-86111a0a.entry.js → p-1edec396.entry.js} +1 -1
  333. package/dist/webcomponents/p-21c060ce.entry.js +1 -0
  334. package/dist/webcomponents/p-26e95adb.entry.js +1 -0
  335. package/dist/webcomponents/p-2bd821a8.entry.js +1 -0
  336. package/dist/webcomponents/p-306c7c33.entry.js +1 -0
  337. package/dist/webcomponents/p-30f61f44.entry.js +1 -0
  338. package/dist/webcomponents/p-34aa9298.entry.js +1 -0
  339. package/dist/webcomponents/p-38ff97ea.entry.js +1 -0
  340. package/dist/webcomponents/p-3aaedf9d.entry.js +1 -0
  341. package/dist/webcomponents/p-3c38cec5.entry.js +1 -0
  342. package/dist/webcomponents/p-3c40eefe.entry.js +1 -0
  343. package/dist/webcomponents/p-44a94dac.entry.js +1 -0
  344. package/dist/webcomponents/p-4dcbc0af.entry.js +1 -0
  345. package/dist/webcomponents/{p-f2650bfc.entry.js → p-4e23116c.entry.js} +1 -1
  346. package/dist/webcomponents/p-50a4d4c4.entry.js +1 -0
  347. package/dist/webcomponents/{p-3bacf834.entry.js → p-58ae4f9e.entry.js} +1 -1
  348. package/dist/webcomponents/p-5981869a.entry.js +1 -0
  349. package/dist/webcomponents/p-5c8c88c6.entry.js +1 -0
  350. package/dist/webcomponents/p-614b0adc.entry.js +1 -0
  351. package/dist/webcomponents/p-7081eb35.entry.js +1 -0
  352. package/dist/webcomponents/p-7218c312.entry.js +1 -0
  353. package/dist/webcomponents/p-75f3161c.entry.js +1 -0
  354. package/dist/webcomponents/p-7661c41a.entry.js +1 -0
  355. package/dist/webcomponents/p-77b76007.entry.js +1 -0
  356. package/dist/webcomponents/p-77bd4fb0.entry.js +1 -0
  357. package/dist/webcomponents/p-92a43706.entry.js +1 -0
  358. package/dist/webcomponents/p-98b8028e.entry.js +1 -0
  359. package/dist/webcomponents/p-9d67209d.entry.js +1 -0
  360. package/dist/webcomponents/p-9ef4288b.entry.js +1 -0
  361. package/dist/webcomponents/{p-DUs94fK3.js → p-B4ZUYyNh.js} +1 -1
  362. package/dist/webcomponents/{p-B4W3my_D.js → p-BCPutgAi.js} +1 -1
  363. package/dist/webcomponents/p-BojLBYsY.js +1 -0
  364. package/dist/webcomponents/p-BpaE8q5f.js +1 -0
  365. package/dist/webcomponents/{p-DeX_cIoV.js → p-C8QOezo8.js} +1 -1
  366. package/dist/webcomponents/{p-DXnwIxTB.js → p-CApezhx9.js} +1 -1
  367. package/dist/webcomponents/{p-aZ8YkDMZ.js → p-CFevTCAJ.js} +1 -1
  368. package/dist/webcomponents/{p-CPRPR6fJ.js → p-CPtsjcdm.js} +1 -1
  369. package/dist/webcomponents/p-Ch9cTPyq.js +1 -0
  370. package/dist/webcomponents/p-DCIW8z1f.js +1 -0
  371. package/dist/webcomponents/p-DU8dqq9U.js +1 -0
  372. package/dist/webcomponents/{p-TKWqvm_A.js → p-D_IJC4HG.js} +1 -1
  373. package/dist/webcomponents/p-MQxr_LMC.js +1 -0
  374. package/dist/webcomponents/p-a54b8901.entry.js +1 -0
  375. package/dist/webcomponents/p-a655b996.entry.js +1 -0
  376. package/dist/webcomponents/p-a7f8cacb.entry.js +1 -0
  377. package/dist/webcomponents/p-aec7a3c8.entry.js +1 -0
  378. package/dist/webcomponents/{p-03c8c754.entry.js → p-aec9185f.entry.js} +1 -1
  379. package/dist/webcomponents/{p-4e71de94.entry.js → p-af48a6bb.entry.js} +1 -1
  380. package/dist/webcomponents/p-b24a2971.entry.js +1 -0
  381. package/dist/webcomponents/p-bf8cf72d.entry.js +1 -0
  382. package/dist/webcomponents/p-c3b71a1f.entry.js +1 -0
  383. package/dist/webcomponents/p-c9b50493.entry.js +1 -0
  384. package/dist/webcomponents/{p-f528da70.entry.js → p-cd10cd05.entry.js} +1 -1
  385. package/dist/webcomponents/p-czPIvHxt.js +1 -0
  386. package/dist/webcomponents/p-d39598e4.entry.js +1 -0
  387. package/dist/webcomponents/p-d7a06b34.entry.js +1 -0
  388. package/dist/webcomponents/p-db17bc59.entry.js +1 -0
  389. package/dist/webcomponents/p-dc0d3484.entry.js +1 -0
  390. package/dist/webcomponents/p-deda2e9d.entry.js +1 -0
  391. package/dist/webcomponents/p-e00fb7b1.entry.js +1 -0
  392. package/dist/webcomponents/p-e07bf523.entry.js +1 -0
  393. package/dist/webcomponents/p-eb56ba9b.entry.js +1 -0
  394. package/dist/webcomponents/{p-e7e5fee9.entry.js → p-ed55d333.entry.js} +1 -1
  395. package/dist/webcomponents/p-edcb84bf.entry.js +1 -0
  396. package/dist/webcomponents/{p-aaed4997.entry.js → p-f0957fca.entry.js} +1 -1
  397. package/dist/webcomponents/p-f0fc86ce.entry.js +1 -0
  398. package/dist/webcomponents/p-f223fabb.entry.js +1 -0
  399. package/dist/webcomponents/p-f26db2e6.entry.js +1 -0
  400. package/dist/webcomponents/{p-88074dd7.entry.js → p-f6ec50c9.entry.js} +1 -1
  401. package/dist/webcomponents/p-fab28b02.entry.js +1 -0
  402. package/dist/webcomponents/webcomponents.esm.js +1 -1
  403. package/docs/.eslintrc.cjs +17 -0
  404. package/docs/changelog/index.mdx +17 -0
  405. package/docs/entities/businessdetails/index.mdx +155 -0
  406. package/docs/entities/businessform/index.mdx +242 -0
  407. package/docs/entities/index.mdx +19 -0
  408. package/docs/entities/payment-provisioning/index.mdx +131 -0
  409. package/docs/frameworks/angular/index.mdx +112 -0
  410. package/docs/frameworks/index.mdx +18 -0
  411. package/docs/frameworks/react/index.mdx +125 -0
  412. package/docs/frameworks/vue/index.mdx +102 -0
  413. package/docs/helpers/PartsTable.ts +55 -0
  414. package/docs/helpers/PropsTable.ts +63 -0
  415. package/docs/helpers/index.ts +3 -0
  416. package/docs/helpers/version.ts +32 -0
  417. package/docs/introduction/index.mdx +125 -0
  418. package/docs/merchant-tools/checkouts-list/index.mdx +107 -0
  419. package/docs/merchant-tools/gross-payments-chart/index.mdx +81 -0
  420. package/docs/merchant-tools/index.mdx +25 -0
  421. package/docs/merchant-tools/order-terminals/index.mdx +84 -0
  422. package/docs/merchant-tools/payment-details/index.mdx +131 -0
  423. package/docs/merchant-tools/payment-transactions-list/index.mdx +85 -0
  424. package/docs/merchant-tools/payments-list/index.mdx +111 -0
  425. package/docs/merchant-tools/payout-details/index.mdx +90 -0
  426. package/docs/merchant-tools/payout-transactions-list/index.mdx +84 -0
  427. package/docs/merchant-tools/payouts-list/index.mdx +94 -0
  428. package/docs/merchant-tools/terminal-orders-list/index.mdx +85 -0
  429. package/docs/merchant-tools/terminals-list/index.mdx +93 -0
  430. package/docs/modular-checkout/complete-examples/index.mdx +20 -0
  431. package/docs/modular-checkout/docs/index.mdx +32 -0
  432. package/docs/modular-checkout/example/index.mdx +25 -0
  433. package/docs/modular-checkout/index.mdx +25 -0
  434. package/docs/modular-checkout/introduction/index.mdx +100 -0
  435. package/docs/modular-checkout/sub-components/apple-pay.mdx +97 -0
  436. package/docs/modular-checkout/sub-components/bank-account-form.mdx +163 -0
  437. package/docs/modular-checkout/sub-components/card-form.mdx +178 -0
  438. package/docs/modular-checkout/sub-components/index.mdx +23 -0
  439. package/docs/modular-checkout/sub-components/payment-method-options.mdx +85 -0
  440. package/docs/modular-checkout/sub-components/plaid-payment-method.mdx +176 -0
  441. package/docs/modular-checkout/sub-components/saved-payment-methods.mdx +178 -0
  442. package/docs/modular-checkout/sub-components/season-interruption-insurance.mdx +220 -0
  443. package/docs/modular-checkout/sub-components/sezzle-payment-method.mdx +184 -0
  444. package/docs/modular-checkout/sub-components/summary.mdx +108 -0
  445. package/docs/payment-facilitation/dispute-management/index.mdx +98 -0
  446. package/docs/payment-facilitation/index.mdx +21 -0
  447. package/docs/payment-facilitation/refund-payment/index.mdx +230 -0
  448. package/docs/payment-facilitation/tokenize-payment-method/index.mdx +362 -0
  449. package/docs/payment-facilitation/unified-fintech-checkout/342/204/242/index.mdx +164 -0
  450. package/package.json +21 -6
  451. package/dist/collection/api/GooglePay.js +0 -212
  452. package/dist/collection/api/services/google-pay.service.js +0 -368
  453. package/dist/collection/components/modular-checkout/sub-components/google-pay-skeleton.js +0 -10
  454. package/dist/collection/components/modular-checkout/sub-components/google-pay.js +0 -706
  455. package/dist/collection/ui-components/google-pay-button.js +0 -251
  456. package/dist/module/ApplePay.js +0 -121
  457. package/dist/module/GooglePay.js +0 -215
  458. package/dist/module/google-pay.js +0 -1006
  459. package/dist/module/justifi-google-pay.d.ts +0 -11
  460. package/dist/module/justifi-google-pay.js +0 -6
  461. package/dist/types/api/GooglePay.d.ts +0 -271
  462. package/dist/types/api/services/google-pay.service.d.ts +0 -60
  463. package/dist/types/components/modular-checkout/sub-components/google-pay-skeleton.d.ts +0 -6
  464. package/dist/types/components/modular-checkout/sub-components/google-pay.d.ts +0 -59
  465. package/dist/types/ui-components/google-pay-button.d.ts +0 -18
  466. package/dist/webcomponents/p-0437c330.entry.js +0 -1
  467. package/dist/webcomponents/p-065b24c3.entry.js +0 -1
  468. package/dist/webcomponents/p-0772719b.entry.js +0 -1
  469. package/dist/webcomponents/p-136b29e3.entry.js +0 -1
  470. package/dist/webcomponents/p-14cbf366.entry.js +0 -1
  471. package/dist/webcomponents/p-1e014ee7.entry.js +0 -1
  472. package/dist/webcomponents/p-1f196690.entry.js +0 -1
  473. package/dist/webcomponents/p-20e66fc0.entry.js +0 -1
  474. package/dist/webcomponents/p-22fdf7a4.entry.js +0 -1
  475. package/dist/webcomponents/p-25755af4.entry.js +0 -1
  476. package/dist/webcomponents/p-270bf699.entry.js +0 -1
  477. package/dist/webcomponents/p-2da4e6ca.entry.js +0 -1
  478. package/dist/webcomponents/p-2eb123a3.entry.js +0 -1
  479. package/dist/webcomponents/p-3ae12b98.entry.js +0 -1
  480. package/dist/webcomponents/p-3d3a65ca.entry.js +0 -1
  481. package/dist/webcomponents/p-3f291e6b.entry.js +0 -1
  482. package/dist/webcomponents/p-44011a41.entry.js +0 -1
  483. package/dist/webcomponents/p-4ccd753b.entry.js +0 -1
  484. package/dist/webcomponents/p-4f102cfd.entry.js +0 -1
  485. package/dist/webcomponents/p-4f16a3ce.entry.js +0 -1
  486. package/dist/webcomponents/p-50a32503.entry.js +0 -1
  487. package/dist/webcomponents/p-57ed105e.entry.js +0 -1
  488. package/dist/webcomponents/p-5e3bc1dc.entry.js +0 -1
  489. package/dist/webcomponents/p-62cfe9b6.entry.js +0 -1
  490. package/dist/webcomponents/p-6a075da4.entry.js +0 -1
  491. package/dist/webcomponents/p-8c16e4aa.entry.js +0 -1
  492. package/dist/webcomponents/p-8ee61443.entry.js +0 -1
  493. package/dist/webcomponents/p-8efea1e4.entry.js +0 -1
  494. package/dist/webcomponents/p-914b590d.entry.js +0 -1
  495. package/dist/webcomponents/p-A2FbmAEt.js +0 -1
  496. package/dist/webcomponents/p-BrazW3nF.js +0 -1
  497. package/dist/webcomponents/p-CIOILVyM.js +0 -1
  498. package/dist/webcomponents/p-CzedYX3W.js +0 -1
  499. package/dist/webcomponents/p-DkoufM1t.js +0 -1
  500. package/dist/webcomponents/p-Yp5v6wmS.js +0 -1
  501. package/dist/webcomponents/p-a020c889.entry.js +0 -1
  502. package/dist/webcomponents/p-a6e816f6.entry.js +0 -1
  503. package/dist/webcomponents/p-aa42e3c1.entry.js +0 -1
  504. package/dist/webcomponents/p-ad0f8d85.entry.js +0 -1
  505. package/dist/webcomponents/p-ad9307c1.entry.js +0 -1
  506. package/dist/webcomponents/p-b8c47cb1.entry.js +0 -1
  507. package/dist/webcomponents/p-c11e6c03.entry.js +0 -1
  508. package/dist/webcomponents/p-c41191e7.entry.js +0 -1
  509. package/dist/webcomponents/p-c5af7149.entry.js +0 -1
  510. package/dist/webcomponents/p-c621e7af.entry.js +0 -1
  511. package/dist/webcomponents/p-c7df4370.entry.js +0 -1
  512. package/dist/webcomponents/p-cf9d8e1a.entry.js +0 -1
  513. package/dist/webcomponents/p-d3663663.entry.js +0 -1
  514. package/dist/webcomponents/p-daedfe82.entry.js +0 -1
  515. package/dist/webcomponents/p-dd11e67b.entry.js +0 -1
  516. package/dist/webcomponents/p-e3ab5fe2.entry.js +0 -1
  517. package/dist/webcomponents/p-e95e27af.entry.js +0 -1
  518. package/dist/webcomponents/p-f4cb581f.entry.js +0 -1
  519. package/dist/webcomponents/p-f66778b8.entry.js +0 -1
  520. package/dist/webcomponents/p-ff212635.entry.js +0 -1
@@ -17,4 +17,4 @@ import{r as t,c as i,h as e,H as s}from"./p-DwYM91AU.js";import{f as n,l as r}fr
17
17
  * (c) 2025 Chart.js Contributors
18
18
  * Released under the MIT License
19
19
  */
20
- class Qi{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,i,e,s){const n=i.duration;i.listeners[s].forEach((s=>s({chart:t,initial:i.initial,numSteps:n,currentStep:Math.min(e-i.start,n)})))}_refresh(){this._request||(this._running=!0,this._request=Ct.call(window,(()=>{this._update(),this._request=null,this._running&&this._refresh()})))}_update(t=Date.now()){let i=0;this._charts.forEach(((e,s)=>{if(!e.running||!e.items.length)return;const n=e.items;let r,o=n.length-1,h=!1;for(;o>=0;--o)r=n[o],r._active?(r._total>e.duration&&(e.duration=r._total),r.tick(t),h=!0):(n[o]=n[n.length-1],n.pop());h&&(s.draw(),this._notify(s,e,t,"progress")),n.length||(e.running=!1,this._notify(s,e,t,"complete"),e.initial=!1),i+=n.length})),this._lastDate=t,0===i&&(this._running=!1)}_getAnims(t){const i=this._charts;let e=i.get(t);return e||(e={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},i.set(t,e)),e}listen(t,i,e){this._getAnims(t).listeners[i].push(e)}add(t,i){i&&i.length&&this._getAnims(t).items.push(...i)}has(t){return this._getAnims(t).items.length>0}start(t){const i=this._charts.get(t);i&&(i.running=!0,i.start=Date.now(),i.duration=i.items.reduce(((t,i)=>Math.max(t,i._duration)),0),this._refresh())}running(t){if(!this._running)return!1;const i=this._charts.get(t);return!!(i&&i.running&&i.items.length)}stop(t){const i=this._charts.get(t);if(!i||!i.items.length)return;const e=i.items;let s=e.length-1;for(;s>=0;--s)e[s].cancel();i.items=[],this._notify(t,i,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var qi=new Qi;const Gi="transparent",Ji={boolean:(t,i,e)=>e>.5?i:t,color(t,i,e){const s=Wt(t||Gi),n=s.valid&&Wt(i||Gi);return n&&n.valid?n.mix(s,e).hexString():i},number:(t,i,e)=>t+(i-t)*e};class te{constructor(t,i,e,s){const n=i[e];s=vi([t.to,s,n,t.from]);const r=vi([t.from,n,s]);this._active=!0,this._fn=t.fn||Ji[t.type||typeof r],this._easing=Bt[t.easing]||Bt.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=i,this._prop=e,this._from=r,this._to=s,this._promises=void 0}active(){return this._active}update(t,i,e){if(this._active){this._notify(!1);const s=this._target[this._prop],n=e-this._start,r=this._duration-n;this._start=e,this._duration=Math.floor(Math.max(r,t.duration)),this._total+=n,this._loop=!!t.loop,this._to=vi([t.to,i,s,t.from]),this._from=vi([t.from,s,i])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const i=t-this._start,e=this._duration,s=this._prop,n=this._from,r=this._loop,o=this._to;let h;if(this._active=n!==o&&(r||i<e),!this._active)return this._target[s]=o,void this._notify(!0);i<0?this._target[s]=n:(h=i/e%2,h=r&&h>1?2-h:h,h=this._easing(Math.min(1,Math.max(0,h))),this._target[s]=this._fn(n,o,h))}wait(){const t=this._promises||(this._promises=[]);return new Promise(((i,e)=>{t.push({res:i,rej:e})}))}_notify(t){const i=t?"res":"rej",e=this._promises||[];for(let t=0;t<e.length;t++)e[t][i]()}}class ie{constructor(t,i){this._chart=t,this._properties=new Map,this.configure(i)}configure(t){if(!H(t))return;const i=Object.keys(Gt.animation),e=this._properties;Object.getOwnPropertyNames(t).forEach((s=>{const n=t[s];if(!H(n))return;const r={};for(const t of i)r[t]=n[t];(z(n.properties)&&n.properties||[s]).forEach((t=>{t!==s&&e.has(t)||e.set(t,r)}))}))}_animateOptions(t,i){const e=i.options,s=function(t,i){if(!i)return;let e=t.options;if(e)return e.$shared&&(t.options=e=Object.assign({},e,{$shared:!1,$animations:{}})),e;t.options=i}(t,e);if(!s)return[];const n=this._createAnimations(s,e);return e.$shared&&function(t,i){const e=[],s=Object.keys(i);for(let i=0;i<s.length;i++){const n=t[s[i]];n&&n.active()&&e.push(n.wait())}return Promise.all(e)}(t.options.$animations,e).then((()=>{t.options=e}),(()=>{})),n}_createAnimations(t,i){const e=this._properties,s=[],n=t.$animations||(t.$animations={}),r=Object.keys(i),o=Date.now();let h;for(h=r.length-1;h>=0;--h){const a=r[h];if("$"===a.charAt(0))continue;if("options"===a){s.push(...this._animateOptions(t,i));continue}const c=i[a];let l=n[a];const u=e.get(a);if(l){if(u&&l.active()){l.update(u,c,o);continue}l.cancel()}u&&u.duration?(n[a]=l=new te(u,t,a,c),s.push(l)):t[a]=c}return s}update(t,i){if(0===this._properties.size)return void Object.assign(t,i);const e=this._createAnimations(t,i);return e.length?(qi.add(this._chart,e),!0):void 0}}function ee(t,i){const e=t&&t.options||{},s=e.reverse,n=void 0===e.min?i:0,r=void 0===e.max?i:0;return{start:s?r:n,end:s?n:r}}function se(t,i){const e=[],s=t._getSortedDatasetMetas(i);let n,r;for(n=0,r=s.length;n<r;++n)e.push(s[n].index);return e}function ne(t,i,e,s={}){const n=t.keys,r="single"===s.mode;let o,h,a,c;if(null===i)return;let l=!1;for(o=0,h=n.length;o<h;++o){if(a=+n[o],a===e){if(l=!0,s.all)continue;break}c=t.values[a],$(c)&&(r||0===i||pt(i)===pt(c))&&(i+=c)}return l||s.all?i:0}function re(t,i){const e=t&&t.options.stacked;return e||void 0===e&&void 0!==i.stack}function oe(t,i,e){const s=t[i]||(t[i]={});return s[e]||(s[e]={})}function he(t,i,e,s){for(const n of i.getMatchingVisibleMetas(s).reverse()){const i=t[n.index];if(e&&i>0||!e&&i<0)return n.index}return null}function ae(t,i){const{chart:e,_cachedMeta:s}=t,n=e._stacks||(e._stacks={}),{iScale:r,vScale:o,index:h}=s,a=r.axis,c=o.axis,l=function(t,i,e){return`${t.id}.${i.id}.${e.stack||e.type}`}(r,o,s),u=i.length;let f;for(let t=0;t<u;++t){const e=i[t],{[a]:r,[c]:u}=e;f=(e._stacks||(e._stacks={}))[c]=oe(n,l,r),f[h]=u,f._top=he(f,o,!0,s.type),f._bottom=he(f,o,!1,s.type),(f._visualValues||(f._visualValues={}))[h]=u}}function ce(t,i){const e=t.scales;return Object.keys(e).filter((t=>e[t].axis===i)).shift()}function le(t,i){const e=t.controller.index,s=t.vScale&&t.vScale.axis;if(s){i=i||t._parsed;for(const t of i){const i=t._stacks;if(!i||void 0===i[s]||void 0===i[s][e])return;delete i[s][e],void 0!==i[s]._visualValues&&void 0!==i[s]._visualValues[e]&&delete i[s]._visualValues[e]}}}const ue=t=>"reset"===t||"none"===t,fe=(t,i)=>i?t:Object.assign({},t);class de{static defaults={};static datasetElementType=null;static dataElementType=null;constructor(t,i){this.chart=t,this._ctx=t.ctx,this.index=i,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.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=re(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&le(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,i=this._cachedMeta,e=this.getDataset(),s=(t,i,e,s)=>"x"===t?i:"r"===t?s:e,n=i.xAxisID=V(e.xAxisID,ce(t,"x")),r=i.yAxisID=V(e.yAxisID,ce(t,"y")),o=i.rAxisID=V(e.rAxisID,ce(t,"r")),h=i.indexAxis,a=i.iAxisID=s(h,n,r,o),c=i.vAxisID=s(h,r,n,o);i.xScale=this.getScaleForId(n),i.yScale=this.getScaleForId(r),i.rScale=this.getScaleForId(o),i.iScale=this.getScaleForId(a),i.vScale=this.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){const i=this._cachedMeta;return t===i.iScale?i.vScale:i.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&Rt(this._data,this),t._stacked&&le(t)}_dataCheck(){const t=this.getDataset(),i=t.data||(t.data=[]),e=this._data;if(H(i))this._data=function(t,i){const{iScale:e,vScale:s}=i,n="x"===e.axis?"x":"y",r="x"===s.axis?"x":"y",o=Object.keys(t),h=new Array(o.length);let a,c,l;for(a=0,c=o.length;a<c;++a)l=o[a],h[a]={[n]:l,[r]:t[l]};return h}(i,this._cachedMeta);else if(e!==i){if(e){Rt(e,this);const t=this._cachedMeta;le(t),t._parsed=[]}i&&Object.isExtensible(i)&&((s=i)._chartjs?s._chartjs.listeners.push(this):(Object.defineProperty(s,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[this]}}),jt.forEach((t=>{const i="_onData"+nt(t),e=s[t];Object.defineProperty(s,t,{configurable:!0,enumerable:!1,value(...t){const n=e.apply(this,t);return s._chartjs.listeners.forEach((e=>{"function"==typeof e[i]&&e[i](...t)})),n}})})))),this._syncList=[],this._data=i}var s}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const i=this._cachedMeta,e=this.getDataset();let s=!1;this._dataCheck();const n=i._stacked;i._stacked=re(i.vScale,i),i.stack!==e.stack&&(s=!0,le(i),i.stack=e.stack),this._resyncElements(t),(s||n!==i._stacked)&&(ae(this,i._parsed),i._stacked=re(i.vScale,i))}configure(){const t=this.chart.config,i=t.datasetScopeKeys(this._type),e=t.getOptionScopes(this.getDataset(),i,!0);this.options=t.createResolver(e,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,i){const{_cachedMeta:e,_data:s}=this,{iScale:n,_stacked:r}=e,o=n.axis;let h,a,c,l=0===t&&i===s.length||e._sorted,u=t>0&&e._parsed[t-1];if(!1===this._parsing)e._parsed=s,e._sorted=!0,c=s;else{c=z(s[t])?this.parseArrayData(e,s,t,i):H(s[t])?this.parseObjectData(e,s,t,i):this.parsePrimitiveData(e,s,t,i);const n=()=>null===a[o]||u&&a[o]<u[o];for(h=0;h<i;++h)e._parsed[h+t]=a=c[h],l&&(n()&&(l=!1),u=a);e._sorted=l}r&&ae(this,c)}parsePrimitiveData(t,i,e,s){const{iScale:n,vScale:r}=t,o=n.axis,h=r.axis,a=n.getLabels(),c=n===r,l=new Array(s);let u,f,d;for(u=0,f=s;u<f;++u)d=u+e,l[u]={[o]:c||n.parse(a[d],d),[h]:r.parse(i[d],d)};return l}parseArrayData(t,i,e,s){const{xScale:n,yScale:r}=t,o=new Array(s);let h,a,c,l;for(h=0,a=s;h<a;++h)c=h+e,l=i[c],o[h]={x:n.parse(l[0],c),y:r.parse(l[1],c)};return o}parseObjectData(t,i,e,s){const{xScale:n,yScale:r}=t,{xAxisKey:o="x",yAxisKey:h="y"}=this._parsing,a=new Array(s);let c,l,u,f;for(c=0,l=s;c<l;++c)u=c+e,f=i[u],a[c]={x:n.parse(st(f,o),u),y:r.parse(st(f,h),u)};return a}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,i,e){const s=this._cachedMeta,n=i[t.axis];return ne({keys:se(this.chart,!0),values:i._stacks[t.axis]._visualValues},n,s.index,{mode:e})}updateRangeFromParsed(t,i,e,s){const n=e[i.axis];let r=null===n?NaN:n;const o=s&&e._stacks[i.axis];s&&o&&(s.values=o,r=ne(s,n,this._cachedMeta.index)),t.min=Math.min(t.min,r),t.max=Math.max(t.max,r)}getMinMax(t,i){const e=this._cachedMeta,s=e._parsed,n=e._sorted&&t===e.iScale,r=s.length,o=this._getOtherScale(t),h=((t,i)=>t&&!i.hidden&&i._stacked&&{keys:se(this.chart,!0),values:null})(i,e),a={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:c,max:l}=function(t){const{min:i,max:e,minDefined:s,maxDefined:n}=t.getUserBounds();return{min:s?i:Number.NEGATIVE_INFINITY,max:n?e:Number.POSITIVE_INFINITY}}(o);let u,f;function d(){f=s[u];const i=f[o.axis];return!$(f[t.axis])||c>i||l<i}for(u=0;u<r&&(d()||(this.updateRangeFromParsed(a,t,f,h),!n));++u);if(n)for(u=r-1;u>=0;--u)if(!d()){this.updateRangeFromParsed(a,t,f,h);break}return a}getAllParsedValues(t){const i=this._cachedMeta._parsed,e=[];let s,n,r;for(s=0,n=i.length;s<n;++s)r=i[s][t.axis],$(r)&&e.push(r);return e}getMaxOverflow(){return!1}getLabelAndValue(t){const i=this._cachedMeta,e=i.iScale,s=i.vScale,n=this.getParsed(t);return{label:e?""+e.getLabelForValue(n[e.axis]):"",value:s?""+s.getLabelForValue(n[s.axis]):""}}_update(t){const i=this._cachedMeta;this.update(t||"default"),i._clip=function(t){let i,e,s,n;return H(t)?(i=t.top,e=t.right,s=t.bottom,n=t.left):i=e=s=n=t,{top:i,right:e,bottom:s,left:n,disabled:!1===t}}(V(this.options.clip,function(t,i,e){if(!1===e)return!1;const s=ee(t,e),n=ee(i,e);return{top:n.end,right:s.end,bottom:n.start,left:s.start}}(i.xScale,i.yScale,this.getMaxOverflow())))}update(t){}draw(){const t=this._ctx,i=this._cachedMeta,e=i.data||[],s=this.chart.chartArea,n=[],r=this._drawStart||0,o=this._drawCount||e.length-r,h=this.options.drawActiveElementsOnTop;let a;for(i.dataset&&i.dataset.draw(t,s,r,o),a=r;a<r+o;++a){const i=e[a];i.hidden||(i.active&&h?n.push(i):i.draw(t,s))}for(a=0;a<n.length;++a)n[a].draw(t,s)}getStyle(t,i){const e=i?"active":"default";return void 0===t&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(e):this.resolveDataElementOptions(t||0,e)}getContext(t,i,e){const s=this.getDataset();let n;if(t>=0&&t<this._cachedMeta.data.length){const i=this._cachedMeta.data[t];n=i.$context||(i.$context=function(t,i,e){return yi(t,{active:!1,dataIndex:i,parsed:void 0,raw:void 0,element:e,index:i,mode:"default",type:"data"})}(this.getContext(),t,i)),n.parsed=this.getParsed(t),n.raw=s.data[t],n.index=n.dataIndex=t}else n=this.$context||(this.$context=function(t,i){return yi(t,{active:!1,dataset:void 0,datasetIndex:i,index:i,mode:"default",type:"dataset"})}(this.chart.getContext(),this.index)),n.dataset=s,n.index=n.datasetIndex=this.index;return n.active=!!i,n.mode=e,n}resolveDatasetElementOptions(t){return this._resolveElementOptions(this.datasetElementType.id,t)}resolveDataElementOptions(t,i){return this._resolveElementOptions(this.dataElementType.id,i,t)}_resolveElementOptions(t,i="default",e){const s="active"===i,n=this._cachedDataOpts,r=t+"-"+i,o=n[r],h=this.enableOptionSharing&&rt(e);if(o)return fe(o,h);const a=this.chart.config,c=a.datasetElementScopeKeys(this._type,t),l=s?[`${t}Hover`,"hover",t,""]:[t,""],u=a.getOptionScopes(this.getDataset(),c),f=Object.keys(Gt.elements[t]),d=a.resolveNamedOptions(u,f,(()=>this.getContext(e,s,i)),l);return d.$shared&&(d.$shared=h,n[r]=Object.freeze(fe(d,h))),d}_resolveAnimations(t,i,e){const s=this.chart,n=this._cachedDataOpts,r=`animation-${i}`,o=n[r];if(o)return o;let h;if(!1!==s.options.animation){const s=this.chart.config,n=s.datasetAnimationScopeKeys(this._type,i),r=s.getOptionScopes(this.getDataset(),n);h=s.createResolver(r,this.getContext(t,e,i))}const a=new ie(s,h&&h.animations);return h&&h._cacheable&&(n[r]=Object.freeze(a)),a}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,i){return!i||ue(t)||this.chart._animationsDisabled}_getSharedOptions(t,i){const e=this.resolveDataElementOptions(t,i),s=this._sharedOptions,n=this.getSharedOptions(e),r=this.includeOptions(i,n)||n!==s;return this.updateSharedOptions(n,i,e),{sharedOptions:n,includeOptions:r}}updateElement(t,i,e,s){ue(s)?Object.assign(t,e):this._resolveAnimations(i,s).update(t,e)}updateSharedOptions(t,i,e){t&&!ue(i)&&this._resolveAnimations(void 0,i).update(t,e)}_setStyle(t,i,e,s){t.active=s;const n=this.getStyle(i,s);this._resolveAnimations(i,e,s).update(t,{options:!s&&this.getSharedOptions(n)||n})}removeHoverStyle(t,i,e){this._setStyle(t,e,"active",!1)}setHoverStyle(t,i,e){this._setStyle(t,e,"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 i=this._data,e=this._cachedMeta.data;for(const[t,i,e]of this._syncList)this[t](i,e);this._syncList=[];const s=e.length,n=i.length,r=Math.min(n,s);r&&this.parse(0,r),n>s?this._insertElements(s,n-s,t):n<s&&this._removeElements(n,s-n)}_insertElements(t,i,e=!0){const s=this._cachedMeta,n=s.data,r=t+i;let o;const h=t=>{for(t.length+=i,o=t.length-1;o>=r;o--)t[o]=t[o-i]};for(h(n),o=t;o<r;++o)n[o]=new this.dataElementType;this._parsing&&h(s._parsed),this.parse(t,i),e&&this.updateElements(n,t,i,"reset")}updateElements(t,i,e,s){}_removeElements(t,i){const e=this._cachedMeta;if(this._parsing){const s=e._parsed.splice(t,i);e._stacked&&le(e,s)}e.data.splice(t,i)}_sync(t){if(this._parsing)this._syncList.push(t);else{const[i,e,s]=t;this[i](e,s)}this.chart._dataChanges.push([this.index,...t])}_onDataPush(){const t=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-t,t])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(t,i){i&&this._sync(["_removeElements",t,i]);const e=arguments.length-2;e&&this._sync(["_insertElements",t,e])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}function be(t,i,e,s){return z(t)?function(t,i,e,s){const n=e.parse(t[0],s),r=e.parse(t[1],s),o=Math.min(n,r),h=Math.max(n,r);let a=o,c=h;Math.abs(o)>Math.abs(h)&&(a=h,c=o),i[e.axis]=c,i._custom={barStart:a,barEnd:c,start:n,end:r,min:o,max:h}}(t,i,e,s):i[e.axis]=e.parse(t,s),i}function ge(t,i,e,s){const n=t.iScale,r=t.vScale,o=n.getLabels(),h=n===r,a=[];let c,l,u,f;for(c=e,l=e+s;c<l;++c)f=i[c],u={},u[n.axis]=h||n.parse(o[c],c),a.push(be(f,u,r,c));return a}function pe(t){return t&&void 0!==t.barStart&&void 0!==t.barEnd}function me(t,i,e,s){let n=i.borderSkipped;const r={};if(!n)return void(t.borderSkipped=r);if(!0===n)return void(t.borderSkipped={top:!0,right:!0,bottom:!0,left:!0});const{start:o,end:h,reverse:a,top:c,bottom:l}=function(t){let i,e,s,n,r;return t.horizontal?(i=t.base>t.x,e="left",s="right"):(i=t.base<t.y,e="bottom",s="top"),i?(n="end",r="start"):(n="start",r="end"),{start:e,end:s,reverse:i,top:n,bottom:r}}(t);"middle"===n&&e&&(t.enableBorderRadius=!0,(e._top||0)===s?n=c:(e._bottom||0)===s?n=l:(r[xe(l,o,h,a)]=!0,n=c)),r[xe(n,o,h,a)]=!0,t.borderSkipped=r}function xe(t,i,e,s){var n,r,o;return s?(o=e,t=ve(t=(n=t)===(r=i)?o:n===o?r:n,e,i)):t=ve(t,i,e),t}function ve(t,i,e){return"start"===t?i:"end"===t?e:t}function ye(t,{inflateAmount:i},e){t.inflateAmount="auto"===i?1===e?.33:0:i}class Me extends de{static id="doughnut";static defaults={datasetElementType:!1,dataElementType:"arc",animation:{animateRotate:!0,animateScale:!1},animations:{numbers:{type:"number",properties:["circumference","endAngle","innerRadius","outerRadius","startAngle","x","y","offset","borderWidth","spacing"]}},cutout:"50%",rotation:0,circumference:360,radius:"100%",spacing:0,indexAxis:"r"};static descriptors={_scriptable:t=>"spacing"!==t,_indexable:t=>"spacing"!==t&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const i=t.data,{labels:{pointStyle:e,textAlign:s,color:n,useBorderRadius:r,borderRadius:o}}=t.legend.options;return i.labels.length&&i.datasets.length?i.labels.map(((i,h)=>{const a=t.getDatasetMeta(0).controller.getStyle(h);return{text:i,fillStyle:a.backgroundColor,fontColor:n,hidden:!t.getDataVisibility(h),lineDash:a.borderDash,lineDashOffset:a.borderDashOffset,lineJoin:a.borderJoinStyle,lineWidth:a.borderWidth,strokeStyle:a.borderColor,textAlign:s,pointStyle:e,borderRadius:r&&(o||a.borderRadius),index:h}})):[]}},onClick(t,i,e){e.chart.toggleDataVisibility(i.index),e.chart.update()}}}};constructor(t,i){super(t,i),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,i){const e=this.getDataset().data,s=this._cachedMeta;if(!1===this._parsing)s._parsed=e;else{let n,r,o=t=>+e[t];if(H(e[t])){const{key:t="value"}=this._parsing;o=i=>+st(e[i],t)}for(n=t,r=t+i;n<r;++n)s._parsed[n]=o(n)}}_getRotation(){return yt(this.options.rotation-90)}_getCircumference(){return yt(this.options.circumference)}_getRotationExtents(){let t=ct,i=-ct;for(let e=0;e<this.chart.data.datasets.length;++e)if(this.chart.isDatasetVisible(e)&&this.chart.getDatasetMeta(e).type===this._type){const s=this.chart.getDatasetMeta(e).controller,n=s._getRotation(),r=s._getCircumference();t=Math.min(t,n),i=Math.max(i,n+r)}return{rotation:t,circumference:i-t}}update(t){const i=this.chart,{chartArea:e}=i,s=this._cachedMeta,n=s.data,r=this.getMaxBorderWidth()+this.getMaxOffset(n)+this.options.spacing,o=Math.max((Math.min(e.width,e.height)-r)/2,0),h=Math.min((c=o,"string"==typeof(a=this.options.cutout)&&a.endsWith("%")?parseFloat(a)/100:+a/c),1);var a,c;const l=this._getRingWeight(this.index),{circumference:u,rotation:f}=this._getRotationExtents(),{ratioX:d,ratioY:b,offsetX:g,offsetY:p}=function(t,i,e){let s=1,n=1,r=0,o=0;if(i<ct){const h=t,a=h+i,c=Math.cos(h),l=Math.sin(h),u=Math.cos(a),f=Math.sin(a),d=(t,i,s)=>_t(t,h,a,!0)?1:Math.max(i,i*e,s,s*e),b=(t,i,s)=>_t(t,h,a,!0)?-1:Math.min(i,i*e,s,s*e),g=d(0,c,u),p=d(ft,l,f),m=b(at,c,u),x=b(at+ft,l,f);s=(g-m)/2,n=(p-x)/2,r=-(g+m)/2,o=-(p+x)/2}return{ratioX:s,ratioY:n,offsetX:r,offsetY:o}}(f,u,h),m=Math.max(Math.min((e.width-r)/d,(e.height-r)/b)/2,0),x=X(this.options.radius,m),v=(x-Math.max(x*h,0))/this._getVisibleDatasetWeightTotal();this.offsetX=g*x,this.offsetY=p*x,s.total=this.calculateTotal(),this.outerRadius=x-v*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-v*l,0),this.updateElements(n,0,n.length,t)}_circumference(t,i){const e=this.options,s=this._cachedMeta,n=this._getCircumference();return i&&e.animation.animateRotate||!this.chart.getDataVisibility(t)||null===s._parsed[t]||s.data[t].hidden?0:this.calculateCircumference(s._parsed[t]*n/ct)}updateElements(t,i,e,s){const n="reset"===s,r=this.chart,o=r.chartArea,h=(o.left+o.right)/2,a=(o.top+o.bottom)/2,c=n&&r.options.animation.animateScale,l=c?0:this.innerRadius,u=c?0:this.outerRadius,{sharedOptions:f,includeOptions:d}=this._getSharedOptions(i,s);let b,g=this._getRotation();for(b=0;b<i;++b)g+=this._circumference(b,n);for(b=i;b<i+e;++b){const i=this._circumference(b,n),e=t[b],r={x:h+this.offsetX,y:a+this.offsetY,startAngle:g,endAngle:g+i,circumference:i,outerRadius:u,innerRadius:l};d&&(r.options=f||this.resolveDataElementOptions(b,e.active?"active":s)),g+=i,this.updateElement(e,b,r,s)}}calculateTotal(){const t=this._cachedMeta,i=t.data;let e,s=0;for(e=0;e<i.length;e++){const n=t._parsed[e];null===n||isNaN(n)||!this.chart.getDataVisibility(e)||i[e].hidden||(s+=Math.abs(n))}return s}calculateCircumference(t){const i=this._cachedMeta.total;return i>0&&!isNaN(t)?ct*(Math.abs(t)/i):0}getLabelAndValue(t){const i=this.chart,e=i.data.labels||[],s=Vt(this._cachedMeta._parsed[t],i.options.locale);return{label:e[t]||"",value:s}}getMaxBorderWidth(t){let i=0;const e=this.chart;let s,n,r,o,h;if(!t)for(s=0,n=e.data.datasets.length;s<n;++s)if(e.isDatasetVisible(s)){r=e.getDatasetMeta(s),t=r.data,o=r.controller;break}if(!t)return 0;for(s=0,n=t.length;s<n;++s)h=o.resolveDataElementOptions(s),"inner"!==h.borderAlign&&(i=Math.max(i,h.borderWidth||0,h.hoverBorderWidth||0));return i}getMaxOffset(t){let i=0;for(let e=0,s=t.length;e<s;++e){const t=this.resolveDataElementOptions(e);i=Math.max(i,t.offset||0,t.hoverOffset||0)}return i}_getRingWeightOffset(t){let i=0;for(let e=0;e<t;++e)this.chart.isDatasetVisible(e)&&(i+=this._getRingWeight(e));return i}_getRingWeight(t){return Math.max(V(this.chart.data.datasets[t].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}class we extends de{static id="polarArea";static defaults={dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const i=t.data;if(i.labels.length&&i.datasets.length){const{labels:{pointStyle:e,color:s}}=t.legend.options;return i.labels.map(((i,n)=>{const r=t.getDatasetMeta(0).controller.getStyle(n);return{text:i,fillStyle:r.backgroundColor,strokeStyle:r.borderColor,fontColor:s,lineWidth:r.borderWidth,pointStyle:e,hidden:!t.getDataVisibility(n),index:n}}))}return[]}},onClick(t,i,e){e.chart.toggleDataVisibility(i.index),e.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}};constructor(t,i){super(t,i),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){const i=this.chart,e=i.data.labels||[],s=Vt(this._cachedMeta._parsed[t].r,i.options.locale);return{label:e[t]||"",value:s}}parseObjectData(t,i,e,s){return Pi.bind(this)(t,i,e,s)}update(t){const i=this._cachedMeta.data;this._updateRadius(),this.updateElements(i,0,i.length,t)}getMinMax(){const t={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return this._cachedMeta.data.forEach(((i,e)=>{const s=this.getParsed(e).r;!isNaN(s)&&this.chart.getDataVisibility(e)&&(s<t.min&&(t.min=s),s>t.max&&(t.max=s))})),t}_updateRadius(){const t=this.chart,i=t.chartArea,e=t.options,s=Math.min(i.right-i.left,i.bottom-i.top),n=Math.max(s/2,0),r=(n-Math.max(e.cutoutPercentage?n/100*e.cutoutPercentage:1,0))/t.getVisibleDatasetCount();this.outerRadius=n-r*this.index,this.innerRadius=this.outerRadius-r}updateElements(t,i,e,s){const n="reset"===s,r=this.chart,o=r.options.animation,h=this._cachedMeta.rScale,a=h.xCenter,c=h.yCenter,l=h.getIndexAngle(0)-.5*at;let u,f=l;const d=360/this.countVisibleElements();for(u=0;u<i;++u)f+=this._computeAngle(u,s,d);for(u=i;u<i+e;u++){const i=t[u];let e=f,b=f+this._computeAngle(u,s,d),g=r.getDataVisibility(u)?h.getDistanceFromCenterForValue(this.getParsed(u).r):0;f=b,n&&(o.animateScale&&(g=0),o.animateRotate&&(e=b=l));const p={x:a,y:c,innerRadius:0,outerRadius:g,startAngle:e,endAngle:b,options:this.resolveDataElementOptions(u,i.active?"active":s)};this.updateElement(i,u,p,s)}}countVisibleElements(){let t=0;return this._cachedMeta.data.forEach(((i,e)=>{!isNaN(this.getParsed(e).r)&&this.chart.getDataVisibility(e)&&t++})),t}_computeAngle(t,i,e){return this.chart.getDataVisibility(t)?yt(this.resolveDataElementOptions(t,i).angle||e):0}}function _e(t,i,e,s){const{controller:n,data:r,_sorted:o}=t,h=n._cachedMeta.iScale,a=t.dataset&&t.dataset.options?t.dataset.options.spanGaps:null;if(h&&i===h.axis&&"r"!==i&&o&&r.length){const o=h._reversePixels?Dt:At;if(!s){const s=o(r,i,e);if(a){const{vScale:i}=n._cachedMeta,{_parsed:e}=t,r=e.slice(0,s.lo+1).reverse().findIndex((t=>!W(t[i.axis])));s.lo-=Math.max(0,r);const o=e.slice(s.hi).findIndex((t=>!W(t[i.axis])));s.hi+=Math.max(0,o)}return s}if(n._sharedOptions){const t=r[0],s="function"==typeof t.getRange&&t.getRange(i);if(s){const t=o(r,i,e-s),n=o(r,i,e+s);return{lo:t.lo,hi:n.hi}}}}return{lo:0,hi:r.length-1}}function ke(t,i,e,s,n){const r=t.getSortedVisibleDatasetMetas(),o=e[i];for(let t=0,e=r.length;t<e;++t){const{index:e,data:h}=r[t],{lo:a,hi:c}=_e(r[t],i,o,n);for(let t=a;t<=c;++t){const i=h[t];i.skip||s(i,e,t)}}}function Oe(t,i,e,s,n){const r=[];return n||t.isPointInArea(i)?(ke(t,e,i,(function(e,o,h){(n||ni(e,t.chartArea,0))&&e.inRange(i.x,i.y,s)&&r.push({element:e,datasetIndex:o,index:h})}),!0),r):r}function Se(t,i,e,s,n,r){return r||t.isPointInArea(i)?"r"!==e||s?function(t,i,e,s,n,r){let o=[];const h=function(t){const i=-1!==t.indexOf("x"),e=-1!==t.indexOf("y");return function(t,s){const n=i?Math.abs(t.x-s.x):0,r=e?Math.abs(t.y-s.y):0;return Math.sqrt(Math.pow(n,2)+Math.pow(r,2))}}(e);let a=Number.POSITIVE_INFINITY;return ke(t,e,i,(function(e,c,l){const u=e.inRange(i.x,i.y,n);if(s&&!u)return;const f=e.getCenterPoint(n);if(!r&&!t.isPointInArea(f)&&!u)return;const d=h(i,f);d<a?(o=[{element:e,datasetIndex:c,index:l}],a=d):d===a&&o.push({element:e,datasetIndex:c,index:l})})),o}(t,i,e,s,n,r):function(t,i,e,s){let n=[];return ke(t,e,i,(function(t,e,r){const{startAngle:o,endAngle:h}=t.getProps(["startAngle","endAngle"],s),{angle:a}=function(t,i){const e=i.x-t.x,s=i.y-t.y,n=Math.sqrt(e*e+s*s);let r=Math.atan2(s,e);return r<-.5*at&&(r+=ct),{angle:r,distance:n}}(t,{x:i.x,y:i.y});_t(a,o,h)&&n.push({element:t,datasetIndex:e,index:r})})),n}(t,i,e,n):[]}function Ae(t,i,e,s,n){const r=[],o="x"===e?"inXRange":"inYRange";let h=!1;return ke(t,e,i,((t,s,a)=>{t[o]&&t[o](i[e],n)&&(r.push({element:t,datasetIndex:s,index:a}),h=h||t.inRange(i.x,i.y,n))})),s&&!h?[]:r}var De={modes:{index(t,i,e,s){const n=zi(i,t),r=e.axis||"x",o=e.includeInvisible||!1,h=e.intersect?Oe(t,n,r,s,o):Se(t,n,r,!1,s,o),a=[];return h.length?(t.getSortedVisibleDatasetMetas().forEach((t=>{const i=h[0].index,e=t.data[i];e&&!e.skip&&a.push({element:e,datasetIndex:t.index,index:i})})),a):[]},dataset(t,i,e,s){const n=zi(i,t),r=e.axis||"xy",o=e.includeInvisible||!1;let h=e.intersect?Oe(t,n,r,s,o):Se(t,n,r,!1,s,o);if(h.length>0){const i=h[0].datasetIndex,e=t.getDatasetMeta(i).data;h=[];for(let t=0;t<e.length;++t)h.push({element:e[t],datasetIndex:i,index:t})}return h},point:(t,i,e,s)=>Oe(t,zi(i,t),e.axis||"xy",s,e.includeInvisible||!1),nearest:(t,i,e,s)=>Se(t,zi(i,t),e.axis||"xy",e.intersect,s,e.includeInvisible||!1),x:(t,i,e,s)=>Ae(t,zi(i,t),"x",e.intersect,s),y:(t,i,e,s)=>Ae(t,zi(i,t),"y",e.intersect,s)}};const je=["left","top","right","bottom"];function Re(t,i){return t.filter((t=>t.pos===i))}function Ce(t,i){return t.filter((t=>-1===je.indexOf(t.pos)&&t.box.axis===i))}function Ee(t,i){return t.sort(((t,e)=>{const s=i?e:t,n=i?t:e;return s.weight===n.weight?s.index-n.index:s.weight-n.weight}))}function Le(t,i,e,s){return Math.max(t[e],i[e])+Math.max(t[s],i[s])}function Pe(t,i){t.top=Math.max(t.top,i.top),t.left=Math.max(t.left,i.left),t.bottom=Math.max(t.bottom,i.bottom),t.right=Math.max(t.right,i.right)}function Te(t,i,e,s){const{pos:n,box:r}=e,o=t.maxPadding;if(!H(n)){e.size&&(t[n]-=e.size);const i=s[e.stack]||{size:0,count:1};i.size=Math.max(i.size,e.horizontal?r.height:r.width),e.size=i.size/i.count,t[n]+=e.size}r.getPadding&&Pe(o,r.getPadding());const h=Math.max(0,i.outerWidth-Le(o,t,"left","right")),a=Math.max(0,i.outerHeight-Le(o,t,"top","bottom")),c=h!==t.w,l=a!==t.h;return t.w=h,t.h=a,e.horizontal?{same:c,other:l}:{same:l,other:c}}function Ie(t,i){const e=i.maxPadding;return function(t){const s={left:0,top:0,right:0,bottom:0};return t.forEach((t=>{s[t]=Math.max(i[t],e[t])})),s}(t?["left","right"]:["top","bottom"])}function Fe(t,i,e,s){const n=[];let r,o,h,a,c,l;for(r=0,o=t.length,c=0;r<o;++r){h=t[r],a=h.box,a.update(h.width||i.w,h.height||i.h,Ie(h.horizontal,i));const{same:o,other:u}=Te(i,e,h,s);c|=o&&n.length,l=l||u,a.fullSize||n.push(h)}return c&&Fe(n,i,e,s)||l}function Be(t,i,e,s,n){t.top=e,t.left=i,t.right=i+s,t.bottom=e+n,t.width=s,t.height=n}function Ne(t,i,e,s){const n=e.padding;let{x:r,y:o}=i;for(const h of t){const t=h.box,a=s[h.stack]||{placed:0,weight:1},c=h.stackWeight/a.weight||1;if(h.horizontal){const s=i.w*c,r=a.size||t.height;rt(a.start)&&(o=a.start),t.fullSize?Be(t,n.left,o,e.outerWidth-n.right-n.left,r):Be(t,i.left+a.placed,o,s,r),a.start=o,a.placed+=s,o=t.bottom}else{const s=i.h*c,o=a.size||t.width;rt(a.start)&&(r=a.start),t.fullSize?Be(t,r,n.top,o,e.outerHeight-n.bottom-n.top):Be(t,r,i.top+a.placed,o,s),a.start=r,a.placed+=s,r=t.right}}i.x=r,i.y=o}var We={addBox(t,i){t.boxes||(t.boxes=[]),i.fullSize=i.fullSize||!1,i.position=i.position||"top",i.weight=i.weight||0,i._layers=i._layers||function(){return[{z:0,draw(t){i.draw(t)}}]},t.boxes.push(i)},removeBox(t,i){const e=t.boxes?t.boxes.indexOf(i):-1;-1!==e&&t.boxes.splice(e,1)},configure(t,i,e){i.fullSize=e.fullSize,i.position=e.position,i.weight=e.weight},update(t,i,e,s){if(!t)return;const n=mi(t.options.layout.padding),r=Math.max(i-n.width,0),o=Math.max(e-n.height,0),h=function(t){const i=function(t){const i=[];let e,s,n,r,o,h;for(e=0,s=(t||[]).length;e<s;++e)n=t[e],({position:r,options:{stack:o,stackWeight:h=1}}=n),i.push({index:e,box:n,pos:r,horizontal:n.isHorizontal(),weight:n.weight,stack:o&&r+o,stackWeight:h});return i}(t),e=Ee(i.filter((t=>t.box.fullSize)),!0),s=Ee(Re(i,"left"),!0),n=Ee(Re(i,"right")),r=Ee(Re(i,"top"),!0),o=Ee(Re(i,"bottom")),h=Ce(i,"x"),a=Ce(i,"y");return{fullSize:e,leftAndTop:s.concat(r),rightAndBottom:n.concat(a).concat(o).concat(h),chartArea:Re(i,"chartArea"),vertical:s.concat(n).concat(a),horizontal:r.concat(o).concat(h)}}(t.boxes),a=h.vertical,c=h.horizontal;Z(t.boxes,(t=>{"function"==typeof t.beforeLayout&&t.beforeLayout()}));const l=a.reduce(((t,i)=>i.box.options&&!1===i.box.options.display?t:t+1),0)||1,u=Object.freeze({outerWidth:i,outerHeight:e,padding:n,availableWidth:r,availableHeight:o,vBoxMaxWidth:r/2/l,hBoxMaxHeight:o/2}),f=Object.assign({},n);Pe(f,mi(s));const d=Object.assign({maxPadding:f,w:r,h:o,x:n.left,y:n.top},n),b=function(t,i){const e=function(t){const i={};for(const e of t){const{stack:t,pos:s,stackWeight:n}=e;if(!t||!je.includes(s))continue;const r=i[t]||(i[t]={count:0,placed:0,weight:0,size:0});r.count++,r.weight+=n}return i}(t),{vBoxMaxWidth:s,hBoxMaxHeight:n}=i;let r,o,h;for(r=0,o=t.length;r<o;++r){h=t[r];const{fullSize:o}=h.box,a=e[h.stack],c=a&&h.stackWeight/a.weight;h.horizontal?(h.width=c?c*s:o&&i.availableWidth,h.height=n):(h.width=s,h.height=c?c*n:o&&i.availableHeight)}return e}(a.concat(c),u);Fe(h.fullSize,d,u,b),Fe(a,d,u,b),Fe(c,d,u,b)&&Fe(a,d,u,b),function(t){const i=t.maxPadding;function e(e){const s=Math.max(i[e]-t[e],0);return t[e]+=s,s}t.y+=e("top"),t.x+=e("left"),e("right"),e("bottom")}(d),Ne(h.leftAndTop,d,u,b),d.x+=d.w,d.y+=d.h,Ne(h.rightAndBottom,d,u,b),t.chartArea={left:d.left,top:d.top,right:d.left+d.w,bottom:d.top+d.h,height:d.h,width:d.w},Z(h.chartArea,(i=>{const e=i.box;Object.assign(e,t.chartArea),e.update(d.w,d.h,{left:0,top:0,right:0,bottom:0})}))}};class ze{acquireContext(t,i){}releaseContext(t){return!1}addEventListener(t,i,e){}removeEventListener(t,i,e){}getDevicePixelRatio(){return 1}getMaximumSize(t,i,e,s){return i=Math.max(0,i||t.width),e=e||t.height,{width:i,height:Math.max(0,s?Math.floor(i/s):e)}}isAttached(t){return!0}updateConfig(t){}}class He extends ze{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const $e="$chartjs",Ye={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Ve=t=>null===t||""===t,Xe=!!Yi&&{passive:!0};function Ue(t,i,e){t&&t.canvas&&t.canvas.removeEventListener(i,e,Xe)}function Ze(t,i){for(const e of t)if(e===i||e.contains(i))return!0}function Ke(t,i,e){const s=t.canvas,n=new MutationObserver((t=>{let i=!1;for(const e of t)i=i||Ze(e.addedNodes,s),i=i&&!Ze(e.removedNodes,s);i&&e()}));return n.observe(document,{childList:!0,subtree:!0}),n}function Qe(t,i,e){const s=t.canvas,n=new MutationObserver((t=>{let i=!1;for(const e of t)i=i||Ze(e.removedNodes,s),i=i&&!Ze(e.addedNodes,s);i&&e()}));return n.observe(document,{childList:!0,subtree:!0}),n}const qe=new Map;let Ge=0;function Je(){const t=window.devicePixelRatio;t!==Ge&&(Ge=t,qe.forEach(((i,e)=>{e.currentDevicePixelRatio!==t&&i()})))}function ts(t,i,e){const s=t.canvas,n=s&&Ii(s);if(!n)return;const r=Et(((t,i)=>{const s=n.clientWidth;e(t,i),s<n.clientWidth&&e()}),window),o=new ResizeObserver((t=>{const i=t[0],e=i.contentRect.width,s=i.contentRect.height;0===e&&0===s||r(e,s)}));return o.observe(n),function(t,i){qe.size||window.addEventListener("resize",Je),qe.set(t,i)}(t,r),o}function is(t,i,e){e&&e.disconnect(),"resize"===i&&function(t){qe.delete(t),qe.size||window.removeEventListener("resize",Je)}(t)}function es(t,i,e){const s=t.canvas,n=Et((i=>{null!==t.ctx&&e(function(t,i){const e=Ye[t.type]||t.type,{x:s,y:n}=zi(t,i);return{type:e,chart:i,native:t,x:void 0!==s?s:null,y:void 0!==n?n:null}}(i,t))}),t);return function(t,i,e){t&&t.addEventListener(i,e,Xe)}(s,i,n),n}class ss extends ze{acquireContext(t,i){const e=t&&t.getContext&&t.getContext("2d");return e&&e.canvas===t?(function(t,i){const e=t.style,s=t.getAttribute("height"),n=t.getAttribute("width");if(t[$e]={initial:{height:s,width:n,style:{display:e.display,height:e.height,width:e.width}}},e.display=e.display||"block",e.boxSizing=e.boxSizing||"border-box",Ve(n)){const i=Vi(t,"width");void 0!==i&&(t.width=i)}if(Ve(s))if(""===t.style.height)t.height=t.width/(i||2);else{const i=Vi(t,"height");void 0!==i&&(t.height=i)}}(t,i),e):null}releaseContext(t){const i=t.canvas;if(!i[$e])return!1;const e=i[$e].initial;["height","width"].forEach((t=>{const s=e[t];W(s)?i.removeAttribute(t):i.setAttribute(t,s)}));const s=e.style||{};return Object.keys(s).forEach((t=>{i.style[t]=s[t]})),i.width=i.width,delete i[$e],!0}addEventListener(t,i,e){this.removeEventListener(t,i),(t.$proxies||(t.$proxies={}))[i]=({attach:Ke,detach:Qe,resize:ts}[i]||es)(t,i,e)}removeEventListener(t,i){const e=t.$proxies||(t.$proxies={}),s=e[i];s&&(({attach:is,detach:is,resize:is}[i]||Ue)(t,i,s),e[i]=void 0)}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,i,e,s){return function(t,i,e,s){const n=Bi(t),r=Wi(n,"margin"),o=Fi(n.maxWidth,t,"clientWidth")||lt,h=Fi(n.maxHeight,t,"clientHeight")||lt,a=function(t,i,e){let s,n;if(void 0===i||void 0===e){const r=t&&Ii(t);if(r){const t=r.getBoundingClientRect(),o=Bi(r),h=Wi(o,"border","width"),a=Wi(o,"padding");i=t.width-a.width-h.width,e=t.height-a.height-h.height,s=Fi(o.maxWidth,r,"clientWidth"),n=Fi(o.maxHeight,r,"clientHeight")}else i=t.clientWidth,e=t.clientHeight}return{width:i,height:e,maxWidth:s||lt,maxHeight:n||lt}}(t,i,e);let{width:c,height:l}=a;if("content-box"===n.boxSizing){const t=Wi(n,"border","width"),i=Wi(n,"padding");c-=i.width+t.width,l-=i.height+t.height}return c=Math.max(0,c-r.width),l=Math.max(0,s?c/s:l-r.height),c=Hi(Math.min(c,o,a.maxWidth)),l=Hi(Math.min(l,h,a.maxHeight)),c&&!l&&(l=Hi(c/2)),(void 0!==i||void 0!==e)&&s&&a.height&&l>a.height&&(l=a.height,c=Hi(Math.floor(l*s))),{width:c,height:l}}(t,i,e,s)}isAttached(t){const i=t&&Ii(t);return!(!i||!i.isConnected)}}class ns{static defaults={};static defaultRoutes=void 0;x;y;active=!1;options;$animations;tooltipPosition(t){const{x:i,y:e}=this.getProps(["x","y"],t);return{x:i,y:e}}hasValue(){return vt(this.x)&&vt(this.y)}getProps(t,i){const e=this.$animations;if(!i||!e)return this;const s={};return t.forEach((t=>{s[t]=e[t]&&e[t].active()?e[t]._to:this[t]})),s}}function rs(t,i,e,s,n){const r=V(s,0),o=Math.min(V(n,t.length),t.length);let h,a,c,l=0;for(e=Math.ceil(e),n&&(h=n-s,e=h/Math.floor(h/e)),c=r;c<0;)l++,c=Math.round(r+l*e);for(a=Math.max(r,0);a<o;a++)a===c&&(i.push(t[a]),l++,c=Math.round(r+l*e))}const os=(t,i,e)=>"top"===i||"left"===i?t[i]+e:t[i]-e,hs=(t,i)=>Math.min(i||t,t);function as(t,i){const e=[],s=t.length/i,n=t.length;let r=0;for(;r<n;r+=s)e.push(t[Math.floor(r)]);return e}function cs(t,i,e){const s=t.ticks.length,n=Math.min(i,s-1),r=t._startPixel,o=t._endPixel,h=1e-6;let a,c=t.getPixelForTick(n);if(!(e&&(a=1===s?Math.max(c-r,o-c):0===i?(t.getPixelForTick(1)-c)/2:(c-t.getPixelForTick(n-1))/2,c+=n<i?a:-a,c<r-h||c>o+h)))return c}function ls(t){return t.drawTicks?t.tickLength:0}function us(t,i){if(!t.display)return 0;const e=xi(t.font,i),s=mi(t.padding);return(z(t.text)?t.text.length:1)*e.lineHeight+s.height}function fs(t,i,e){let s=Lt(t);return(e&&"right"!==i||!e&&"right"===i)&&(s=(t=>"left"===t?"right":"right"===t?"left":t)(s)),s}class ds extends ns{constructor(t){super(),this.id=t.id,this.type=t.type,this.options=void 0,this.ctx=t.ctx,this.chart=t.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(t){this.options=t.setContext(this.getContext()),this.axis=t.axis,this._userMin=this.parse(t.min),this._userMax=this.parse(t.max),this._suggestedMin=this.parse(t.suggestedMin),this._suggestedMax=this.parse(t.suggestedMax)}parse(t,i){return t}getUserBounds(){let{_userMin:t,_userMax:i,_suggestedMin:e,_suggestedMax:s}=this;return t=Y(t,Number.POSITIVE_INFINITY),i=Y(i,Number.NEGATIVE_INFINITY),e=Y(e,Number.POSITIVE_INFINITY),s=Y(s,Number.NEGATIVE_INFINITY),{min:Y(t,e),max:Y(i,s),minDefined:$(t),maxDefined:$(i)}}getMinMax(t){let i,{min:e,max:s,minDefined:n,maxDefined:r}=this.getUserBounds();if(n&&r)return{min:e,max:s};const o=this.getMatchingVisibleMetas();for(let h=0,a=o.length;h<a;++h)i=o[h].controller.getMinMax(this,t),n||(e=Math.min(e,i.min)),r||(s=Math.max(s,i.max));return e=r&&e>s?s:e,s=n&&e>s?e:s,{min:Y(e,Y(s,e)),max:Y(s,Y(e,s))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){U(this.options.beforeUpdate,[this])}update(t,i,e){const{beginAtZero:s,grace:n,ticks:r}=this.options,o=r.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=i,this._margins=e=Object.assign({left:0,right:0,top:0,bottom:0},e),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+e.left+e.right:this.height+e.top+e.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=function(t,i,e){const{min:s,max:n}=t,r=X(i,(n-s)/2),o=(t,i)=>e&&0===t?0:t+i;return{min:o(s,-Math.abs(r)),max:o(n,r)}}(this,n,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const h=o<this.ticks.length;this._convertTicksToLabels(h?as(this.ticks,o):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),r.display&&(r.autoSkip||"auto"===r.source)&&(this.ticks=function(t,i){const e=t.options.ticks,s=function(t){const i=t.options.offset,e=t._tickSize();return Math.floor(Math.min(t._length/e+(i?0:1),t._maxLength/e))}(t),n=Math.min(e.maxTicksLimit||s,s),r=e.major.enabled?function(t){const i=[];let e,s;for(e=0,s=t.length;e<s;e++)t[e].major&&i.push(e);return i}(i):[],o=r.length,h=r[0],a=r[o-1],c=[];if(o>n)return function(t,i,e,s){let n,r=0,o=e[0];for(s=Math.ceil(s),n=0;n<t.length;n++)n===o&&(i.push(t[n]),r++,o=e[r*s])}(i,c,r,o/n),c;const l=function(t,i,e){const s=function(t){const i=t.length;let e,s;if(i<2)return!1;for(s=t[0],e=1;e<i;++e)if(t[e]-t[e-1]!==s)return!1;return s}(t),n=i.length/e;if(!s)return Math.max(n,1);const r=function(t){const i=[],e=Math.sqrt(t);let s;for(s=1;s<e;s++)t%s==0&&(i.push(s),i.push(t/s));return e===(0|e)&&i.push(e),i.sort(((t,i)=>t-i)).pop(),i}(s);for(let t=0,i=r.length-1;t<i;t++){const i=r[t];if(i>n)return i}return Math.max(n,1)}(r,i,n);if(o>0){let t,e;const s=o>1?Math.round((a-h)/(o-1)):null;for(rs(i,c,l,W(s)?0:h-s,h),t=0,e=o-1;t<e;t++)rs(i,c,l,r[t],r[t+1]);return rs(i,c,l,a,W(s)?i.length:a+s),c}return rs(i,c,l),c}(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),h&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let t,i,e=this.options.reverse;this.isHorizontal()?(t=this.left,i=this.right):(t=this.top,i=this.bottom,e=!e),this._startPixel=t,this._endPixel=i,this._reversePixels=e,this._length=i-t,this._alignToPixels=this.options.alignToPixels}afterUpdate(){U(this.options.afterUpdate,[this])}beforeSetDimensions(){U(this.options.beforeSetDimensions,[this])}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=0,this.right=this.width):(this.height=this.maxHeight,this.top=0,this.bottom=this.height),this.paddingLeft=0,this.paddingTop=0,this.paddingRight=0,this.paddingBottom=0}afterSetDimensions(){U(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),U(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){U(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(t){const i=this.options.ticks;let e,s,n;for(e=0,s=t.length;e<s;e++)n=t[e],n.label=U(i.callback,[n.value,e,t],this)}afterTickToLabelConversion(){U(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){U(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const t=this.options,i=t.ticks,e=hs(this.ticks.length,t.ticks.maxTicksLimit),s=i.minRotation||0,n=i.maxRotation;let r,o,h,a=s;if(!this._isVisible()||!i.display||s>=n||e<=1||!this.isHorizontal())return void(this.labelRotation=s);const c=this._getLabelSizes(),l=c.widest.width,u=c.highest.height,f=kt(this.chart.width-l,0,this.maxWidth);r=t.offset?this.maxWidth/e:f/(e-1),l+6>r&&(r=f/(e-(t.offset?.5:1)),o=this.maxHeight-ls(t.grid)-i.padding-us(t.title,this.chart.options.font),h=Math.sqrt(l*l+u*u),a=Math.min(Math.asin(kt((c.highest.height+6)/r,-1,1)),Math.asin(kt(o/h,-1,1))-Math.asin(kt(u/h,-1,1)))*(180/at),a=Math.max(s,Math.min(n,a))),this.labelRotation=a}afterCalculateLabelRotation(){U(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){U(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:i,options:{ticks:e,title:s,grid:n}}=this,r=this._isVisible(),o=this.isHorizontal();if(r){const r=us(s,i.options.font);if(o?(t.width=this.maxWidth,t.height=ls(n)+r):(t.height=this.maxHeight,t.width=ls(n)+r),e.display&&this.ticks.length){const{first:i,last:s,widest:n,highest:r}=this._getLabelSizes(),h=2*e.padding,a=yt(this.labelRotation),c=Math.cos(a),l=Math.sin(a);o?t.height=Math.min(this.maxHeight,t.height+(e.mirror?0:l*n.width+c*r.height)+h):t.width=Math.min(this.maxWidth,t.width+(e.mirror?0:c*n.width+l*r.height)+h),this._calculatePadding(i,s,l,c)}}this._handleMargins(),o?(this.width=this._length=i.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=i.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,i,e,s){const{ticks:{align:n,padding:r},position:o}=this.options,h=0!==this.labelRotation,a="top"!==o&&"x"===this.axis;if(this.isHorizontal()){const o=this.getPixelForTick(0)-this.left,c=this.right-this.getPixelForTick(this.ticks.length-1);let l=0,u=0;h?a?(l=s*t.width,u=e*i.height):(l=e*t.height,u=s*i.width):"start"===n?u=i.width:"end"===n?l=t.width:"inner"!==n&&(l=t.width/2,u=i.width/2),this.paddingLeft=Math.max((l-o+r)*this.width/(this.width-o),0),this.paddingRight=Math.max((u-c+r)*this.width/(this.width-c),0)}else{let e=i.height/2,s=t.height/2;"start"===n?(e=0,s=t.height):"end"===n&&(e=i.height,s=0),this.paddingTop=e+r,this.paddingBottom=s+r}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){U(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:i}=this.options;return"top"===i||"bottom"===i||"x"===t}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){let i,e;for(this.beforeTickToLabelConversion(),this.generateTickLabels(t),i=0,e=t.length;i<e;i++)W(t[i].label)&&(t.splice(i,1),e--,i--);this.afterTickToLabelConversion()}_getLabelSizes(){let t=this._labelSizes;if(!t){const i=this.options.ticks.sampleSize;let e=this.ticks;i<e.length&&(e=as(e,i)),this._labelSizes=t=this._computeLabelSizes(e,e.length,this.options.ticks.maxTicksLimit)}return t}_computeLabelSizes(t,i,e){const{ctx:s,_longestTextCache:n}=this,r=[],o=[],h=Math.floor(i/hs(i,e));let a,c,l,u,f,d,b,g,p,m,x,v=0,y=0;for(a=0;a<i;a+=h){if(u=t[a].label,f=this._resolveTickFontOptions(a),s.font=d=f.string,b=n[d]=n[d]||{data:{},gc:[]},g=f.lineHeight,p=m=0,W(u)||z(u)){if(z(u))for(c=0,l=u.length;c<l;++c)x=u[c],W(x)||z(x)||(p=Jt(s,b.data,b.gc,p,x),m+=g)}else p=Jt(s,b.data,b.gc,p,u),m=g;r.push(p),o.push(m),v=Math.max(p,v),y=Math.max(m,y)}!function(t,i){Z(t,(t=>{const e=t.gc,s=e.length/2;let n;if(s>i){for(n=0;n<s;++n)delete t.data[e[n]];e.splice(0,s)}}))}(n,i);const M=r.indexOf(v),w=o.indexOf(y),_=t=>({width:r[t]||0,height:o[t]||0});return{first:_(0),last:_(i-1),widest:_(M),highest:_(w),widths:r,heights:o}}getLabelForValue(t){return t}getPixelForValue(t,i){return NaN}getValueForPixel(t){}getPixelForTick(t){const i=this.ticks;return t<0||t>i.length-1?null:this.getPixelForValue(i[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const i=this._startPixel+t*this._length;return kt(this._alignToPixels?ti(this.chart,i,0):i,-32768,32767)}getDecimalForPixel(t){const i=(t-this._startPixel)/this._length;return this._reversePixels?1-i:i}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:i}=this;return t<0&&i<0?i:t>0&&i>0?t:0}getContext(t){const i=this.ticks||[];if(t>=0&&t<i.length){const e=i[t];return e.$context||(e.$context=function(t,i,e){return yi(t,{tick:e,index:i,type:"tick"})}(this.getContext(),t,e))}return this.$context||(this.$context=yi(this.chart.getContext(),{scale:this,type:"scale"}))}_tickSize(){const t=this.options.ticks,i=yt(this.labelRotation),e=Math.abs(Math.cos(i)),s=Math.abs(Math.sin(i)),n=this._getLabelSizes(),r=t.autoSkipPadding||0,o=n?n.widest.width+r:0,h=n?n.highest.height+r:0;return this.isHorizontal()?h*e>o*s?o/e:h/s:h*s<o*e?h/e:o/s}_isVisible(){const t=this.options.display;return"auto"!==t?!!t:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(t){const i=this.axis,e=this.chart,s=this.options,{grid:n,position:r,border:o}=s,h=n.offset,a=this.isHorizontal(),c=this.ticks.length+(h?1:0),l=ls(n),u=[],f=o.setContext(this.getContext()),d=f.display?f.width:0,b=d/2,g=function(t){return ti(e,t,d)};let p,m,x,v,y,M,w,_,k,O,S,A;if("top"===r)p=g(this.bottom),M=this.bottom-l,_=p-b,O=g(t.top)+b,A=t.bottom;else if("bottom"===r)p=g(this.top),O=t.top,A=g(t.bottom)-b,M=p+b,_=this.top+l;else if("left"===r)p=g(this.right),y=this.right-l,w=p-b,k=g(t.left)+b,S=t.right;else if("right"===r)p=g(this.left),k=t.left,S=g(t.right)-b,y=p+b,w=this.left+l;else if("x"===i){if("center"===r)p=g((t.top+t.bottom)/2+.5);else if(H(r)){const t=Object.keys(r)[0];p=g(this.chart.scales[t].getPixelForValue(r[t]))}O=t.top,A=t.bottom,M=p+b,_=M+l}else if("y"===i){if("center"===r)p=g((t.left+t.right)/2);else if(H(r)){const t=Object.keys(r)[0];p=g(this.chart.scales[t].getPixelForValue(r[t]))}y=p-b,w=y-l,k=t.left,S=t.right}const D=V(s.ticks.maxTicksLimit,c),j=Math.max(1,Math.ceil(c/D));for(m=0;m<c;m+=j){const t=this.getContext(m),i=n.setContext(t),s=o.setContext(t),r=i.lineWidth,c=i.color,l=s.dash||[],f=s.dashOffset,d=i.tickWidth,b=i.tickColor,g=i.tickBorderDash||[],p=i.tickBorderDashOffset;x=cs(this,m,h),void 0!==x&&(v=ti(e,x,r),a?y=w=k=S=v:M=_=O=A=v,u.push({tx1:y,ty1:M,tx2:w,ty2:_,x1:k,y1:O,x2:S,y2:A,width:r,color:c,borderDash:l,borderDashOffset:f,tickWidth:d,tickColor:b,tickBorderDash:g,tickBorderDashOffset:p}))}return this._ticksLength=c,this._borderValue=p,u}_computeLabelItems(t){const i=this.axis,e=this.options,{position:s,ticks:n}=e,r=this.isHorizontal(),o=this.ticks,{align:h,crossAlign:a,padding:c,mirror:l}=n,u=ls(e.grid),f=u+c,d=l?-c:f,b=-yt(this.labelRotation),g=[];let p,m,x,v,y,M,w,_,k,O,S,A,D="middle";if("top"===s)M=this.bottom-d,w=this._getXAxisLabelAlignment();else if("bottom"===s)M=this.top+d,w=this._getXAxisLabelAlignment();else if("left"===s){const t=this._getYAxisLabelAlignment(u);w=t.textAlign,y=t.x}else if("right"===s){const t=this._getYAxisLabelAlignment(u);w=t.textAlign,y=t.x}else if("x"===i){if("center"===s)M=(t.top+t.bottom)/2+f;else if(H(s)){const t=Object.keys(s)[0];M=this.chart.scales[t].getPixelForValue(s[t])+f}w=this._getXAxisLabelAlignment()}else if("y"===i){if("center"===s)y=(t.left+t.right)/2-f;else if(H(s)){const t=Object.keys(s)[0];y=this.chart.scales[t].getPixelForValue(s[t])}w=this._getYAxisLabelAlignment(u).textAlign}"y"===i&&("start"===h?D="top":"end"===h&&(D="bottom"));const j=this._getLabelSizes();for(p=0,m=o.length;p<m;++p){x=o[p],v=x.label;const t=n.setContext(this.getContext(p));_=this.getPixelForTick(p)+n.labelOffset,k=this._resolveTickFontOptions(p),O=k.lineHeight,S=z(v)?v.length:1;const i=S/2,e=t.color,h=t.textStrokeColor,c=t.textStrokeWidth;let u,f=w;if(r?(y=_,"inner"===w&&(f=p===m-1?this.options.reverse?"left":"right":0===p?this.options.reverse?"right":"left":"center"),A="top"===s?"near"===a||0!==b?-S*O+O/2:"center"===a?-j.highest.height/2-i*O+O:O/2-j.highest.height:"near"===a||0!==b?O/2:"center"===a?j.highest.height/2-i*O:j.highest.height-S*O,l&&(A*=-1),0===b||t.showLabelBackdrop||(y+=O/2*Math.sin(b))):(M=_,A=(1-S)*O/2),t.showLabelBackdrop){const i=mi(t.backdropPadding),e=j.heights[p],s=j.widths[p];let n=A-i.top,r=0-i.left;switch(D){case"middle":n-=e/2;break;case"bottom":n-=e}switch(w){case"center":r-=s/2;break;case"right":r-=s;break;case"inner":p===m-1?r-=s:p>0&&(r-=s/2)}u={left:r,top:n,width:s+i.width,height:e+i.height,color:t.backdropColor}}g.push({label:v,font:k,textOffset:A,options:{rotation:b,color:e,strokeColor:h,strokeWidth:c,textAlign:f,textBaseline:D,translation:[y,M],backdrop:u}})}return g}_getXAxisLabelAlignment(){const{position:t,ticks:i}=this.options;if(-yt(this.labelRotation))return"top"===t?"left":"right";let e="center";return"start"===i.align?e="left":"end"===i.align?e="right":"inner"===i.align&&(e="inner"),e}_getYAxisLabelAlignment(t){const{position:i,ticks:{crossAlign:e,mirror:s,padding:n}}=this.options,r=t+n,o=this._getLabelSizes().widest.width;let h,a;return"left"===i?s?(a=this.right+n,"near"===e?h="left":"center"===e?(h="center",a+=o/2):(h="right",a+=o)):(a=this.right-r,"near"===e?h="right":"center"===e?(h="center",a-=o/2):(h="left",a=this.left)):"right"===i?s?(a=this.left+n,"near"===e?h="right":"center"===e?(h="center",a-=o/2):(h="left",a-=o)):(a=this.left+r,"near"===e?h="left":"center"===e?(h="center",a+=o/2):(h="right",a=this.right)):h="right",{textAlign:h,x:a}}_computeLabelArea(){if(this.options.ticks.mirror)return;const t=this.chart,i=this.options.position;return"left"===i||"right"===i?{top:0,left:this.left,bottom:t.height,right:this.right}:"top"===i||"bottom"===i?{top:this.top,left:0,bottom:this.bottom,right:t.width}:void 0}drawBackground(){const{ctx:t,options:{backgroundColor:i},left:e,top:s,width:n,height:r}=this;i&&(t.save(),t.fillStyle=i,t.fillRect(e,s,n,r),t.restore())}getLineWidthForValue(t){const i=this.options.grid;if(!this._isVisible()||!i.display)return 0;const e=this.ticks.findIndex((i=>i.value===t));return e>=0?i.setContext(this.getContext(e)).lineWidth:0}drawGrid(t){const i=this.options.grid,e=this.ctx,s=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let n,r;const o=(t,i,s)=>{s.width&&s.color&&(e.save(),e.lineWidth=s.width,e.strokeStyle=s.color,e.setLineDash(s.borderDash||[]),e.lineDashOffset=s.borderDashOffset,e.beginPath(),e.moveTo(t.x,t.y),e.lineTo(i.x,i.y),e.stroke(),e.restore())};if(i.display)for(n=0,r=s.length;n<r;++n){const t=s[n];i.drawOnChartArea&&o({x:t.x1,y:t.y1},{x:t.x2,y:t.y2},t),i.drawTicks&&o({x:t.tx1,y:t.ty1},{x:t.tx2,y:t.ty2},{color:t.tickColor,width:t.tickWidth,borderDash:t.tickBorderDash,borderDashOffset:t.tickBorderDashOffset})}}drawBorder(){const{chart:t,ctx:i,options:{border:e,grid:s}}=this,n=e.setContext(this.getContext()),r=e.display?n.width:0;if(!r)return;const o=s.setContext(this.getContext(0)).lineWidth,h=this._borderValue;let a,c,l,u;this.isHorizontal()?(a=ti(t,this.left,r)-r/2,c=ti(t,this.right,o)+o/2,l=u=h):(l=ti(t,this.top,r)-r/2,u=ti(t,this.bottom,o)+o/2,a=c=h),i.save(),i.lineWidth=n.width,i.strokeStyle=n.color,i.beginPath(),i.moveTo(a,l),i.lineTo(c,u),i.stroke(),i.restore()}drawLabels(t){if(!this.options.ticks.display)return;const i=this.ctx,e=this._computeLabelArea();e&&ri(i,e);const s=this.getLabelItems(t);for(const t of s)ci(i,t.label,0,t.textOffset,t.font,t.options);e&&oi(i)}drawTitle(){const{ctx:t,options:{position:i,title:e,reverse:s}}=this;if(!e.display)return;const n=xi(e.font),r=mi(e.padding),o=e.align;let h=n.lineHeight/2;"bottom"===i||"center"===i||H(i)?(h+=r.bottom,z(e.text)&&(h+=n.lineHeight*(e.text.length-1))):h+=r.top;const{titleX:a,titleY:c,maxWidth:l,rotation:u}=function(t,i,e,s){const{top:n,left:r,bottom:o,right:h,chart:a}=t,{chartArea:c,scales:l}=a;let u,f,d,b=0;const g=o-n,p=h-r;if(t.isHorizontal()){if(f=Pt(s,r,h),H(e)){const t=Object.keys(e)[0];d=l[t].getPixelForValue(e[t])+g-i}else d="center"===e?(c.bottom+c.top)/2+g-i:os(t,e,i);u=h-r}else{if(H(e)){const t=Object.keys(e)[0];f=l[t].getPixelForValue(e[t])-p+i}else f="center"===e?(c.left+c.right)/2-p+i:os(t,e,i);d=Pt(s,o,n),b="left"===e?-ft:ft}return{titleX:f,titleY:d,maxWidth:u,rotation:b}}(this,h,i,o);ci(t,e.text,0,0,n,{color:e.color,maxWidth:l,rotation:u,textAlign:fs(o,i,s),textBaseline:"middle",translation:[a,c]})}draw(t){this._isVisible()&&(this.drawBackground(),this.drawGrid(t),this.drawBorder(),this.drawTitle(),this.drawLabels(t))}_layers(){const t=this.options,i=t.ticks&&t.ticks.z||0,e=V(t.grid&&t.grid.z,-1),s=V(t.border&&t.border.z,0);return this._isVisible()&&this.draw===ds.prototype.draw?[{z:e,draw:t=>{this.drawBackground(),this.drawGrid(t),this.drawTitle()}},{z:s,draw:()=>{this.drawBorder()}},{z:i,draw:t=>{this.drawLabels(t)}}]:[{z:i,draw:t=>{this.draw(t)}}]}getMatchingVisibleMetas(t){const i=this.chart.getSortedVisibleDatasetMetas(),e=this.axis+"AxisID",s=[];let n,r;for(n=0,r=i.length;n<r;++n){const r=i[n];r[e]!==this.id||t&&r.type!==t||s.push(r)}return s}_resolveTickFontOptions(t){return xi(this.options.ticks.setContext(this.getContext(t)).font)}_maxDigits(){const t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}}class bs{constructor(t,i,e){this.type=t,this.scope=i,this.override=e,this.items=Object.create(null)}isForType(t){return Object.prototype.isPrototypeOf.call(this.type.prototype,t.prototype)}register(t){const i=Object.getPrototypeOf(t);let e;(function(t){return"id"in t&&"defaults"in t})(i)&&(e=this.register(i));const s=this.items,n=t.id,r=this.scope+"."+n;if(!n)throw new Error("class does not have id: "+t);return n in s||(s[n]=t,function(t,i,e){const s=J(Object.create(null),[e?Gt.get(e):{},Gt.get(i),t.defaults]);Gt.set(i,s),t.defaultRoutes&&function(t,i){Object.keys(i).forEach((e=>{const s=e.split("."),n=s.pop(),r=[t].concat(s).join("."),o=i[e].split("."),h=o.pop(),a=o.join(".");Gt.route(r,n,a,h)}))}(i,t.defaultRoutes),t.descriptors&&Gt.describe(i,t.descriptors)}(t,r,e),this.override&&Gt.override(t.id,t.overrides)),r}get(t){return this.items[t]}unregister(t){const i=this.items,e=t.id,s=this.scope;e in i&&delete i[e],s&&e in Gt[s]&&(delete Gt[s][e],this.override&&delete Ut[e])}}class gs{constructor(){this.controllers=new bs(de,"datasets",!0),this.elements=new bs(ns,"elements"),this.plugins=new bs(Object,"plugins"),this.scales=new bs(ds,"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,i,e){[...i].forEach((i=>{const s=e||this._getRegistryForType(i);e||s.isForType(i)||s===this.plugins&&i.id?this._exec(t,s,i):Z(i,(i=>{const s=e||this._getRegistryForType(i);this._exec(t,s,i)}))}))}_exec(t,i,e){const s=nt(t);U(e["before"+s],[],e),i[t](e),U(e["after"+s],[],e)}_getRegistryForType(t){for(let i=0;i<this._typedRegistries.length;i++){const e=this._typedRegistries[i];if(e.isForType(t))return e}return this.plugins}_get(t,i,e){const s=i.get(t);if(void 0===s)throw new Error('"'+t+'" is not a registered '+e+".");return s}}var ps=new gs;class ms{constructor(){this._init=void 0}notify(t,i,e,s){if("beforeInit"===i&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install")),void 0===this._init)return;const n=s?this._descriptors(t).filter(s):this._descriptors(t),r=this._notify(n,t,i,e);return"afterDestroy"===i&&(this._notify(n,t,"stop"),this._notify(this._init,t,"uninstall"),this._init=void 0),r}_notify(t,i,e,s){s=s||{};for(const n of t){const t=n.plugin;if(!1===U(t[e],[i,s,n.options],t)&&s.cancelable)return!1}return!0}invalidate(){W(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;const i=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),i}_createDescriptors(t,i){const e=t&&t.config,s=V(e.options&&e.options.plugins,{}),n=function(t){const i={},e=[],s=Object.keys(ps.plugins.items);for(let t=0;t<s.length;t++)e.push(ps.getPlugin(s[t]));const n=t.plugins||[];for(let t=0;t<n.length;t++){const s=n[t];-1===e.indexOf(s)&&(e.push(s),i[s.id]=!0)}return{plugins:e,localIds:i}}(e);return!1!==s||i?function(t,{plugins:i,localIds:e},s,n){const r=[],o=t.getContext();for(const h of i){const i=h.id,a=xs(s[i],n);null!==a&&r.push({plugin:h,options:vs(t.config,{plugin:h,local:e[i]},a,o)})}return r}(t,n,s,i):[]}_notifyStateChanges(t){const i=this._oldCache||[],e=this._cache,s=(t,i)=>t.filter((t=>!i.some((i=>t.plugin.id===i.plugin.id))));this._notify(s(i,e),t,"stop"),this._notify(s(e,i),t,"start")}}function xs(t,i){return i||!1!==t?!0===t?{}:t:null}function vs(t,{plugin:i,local:e},s,n){const r=t.pluginScopeKeys(i),o=t.getOptionScopes(s,r);return e&&i.defaults&&o.push(i.defaults),t.createResolver(o,n,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function ys(t,i){return((i.datasets||{})[t]||{}).indexAxis||i.indexAxis||(Gt.datasets[t]||{}).indexAxis||"x"}function Ms(t){if("x"===t||"y"===t||"r"===t)return t}function ws(t,...i){if(Ms(t))return t;for(const s of i){const i=s.axis||("top"===(e=s.position)||"bottom"===e?"x":"left"===e||"right"===e?"y":void 0)||t.length>1&&Ms(t[0].toLowerCase());if(i)return i}var e;throw new Error(`Cannot determine type of '${t}' axis. Please provide 'axis' or 'position' option.`)}function _s(t,i,e){if(e[i+"AxisID"]===t)return{axis:i}}function ks(t){const i=t.options||(t.options={});i.plugins=V(i.plugins,{}),i.scales=function(t,i){const e=Ut[t.type]||{scales:{}},s=i.scales||{},n=ys(t.type,i),r=Object.create(null);return Object.keys(s).forEach((i=>{const o=s[i];if(!H(o))return console.error(`Invalid scale configuration for scale: ${i}`);if(o._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${i}`);const h=ws(i,o,function(t,i){if(i.data&&i.data.datasets){const e=i.data.datasets.filter((i=>i.xAxisID===t||i.yAxisID===t));if(e.length)return _s(t,"x",e[0])||_s(t,"y",e[0])}return{}}(i,t),Gt.scales[o.type]),a=function(t,i){return t===i?"_index_":"_value_"}(h,n),c=e.scales||{};r[i]=tt(Object.create(null),[{axis:h},o,c[h],c[a]])})),t.data.datasets.forEach((e=>{const n=e.type||t.type,o=e.indexAxis||ys(n,i),h=(Ut[n]||{}).scales||{};Object.keys(h).forEach((t=>{const i=function(t,i){let e=t;return"_index_"===t?e=i:"_value_"===t&&(e="x"===i?"y":"x"),e}(t,o),n=e[i+"AxisID"]||i;r[n]=r[n]||Object.create(null),tt(r[n],[{axis:i},s[n],h[t]])}))})),Object.keys(r).forEach((t=>{const i=r[t];tt(i,[Gt.scales[i.type],Gt.scale])})),r}(t,i)}function Os(t){return(t=t||{}).datasets=t.datasets||[],t.labels=t.labels||[],t}const Ss=new Map,As=new Set;function Ds(t,i){let e=Ss.get(t);return e||(e=i(),Ss.set(t,e),As.add(e)),e}const js=(t,i,e)=>{const s=st(i,e);void 0!==s&&t.add(s)};class Rs{constructor(t){this._config=function(t){return(t=t||{}).data=Os(t.data),ks(t),t}(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=Os(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(),ks(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return Ds(t,(()=>[[`datasets.${t}`,""]]))}datasetAnimationScopeKeys(t,i){return Ds(`${t}.transition.${i}`,(()=>[[`datasets.${t}.transitions.${i}`,`transitions.${i}`],[`datasets.${t}`,""]]))}datasetElementScopeKeys(t,i){return Ds(`${t}-${i}`,(()=>[[`datasets.${t}.elements.${i}`,`datasets.${t}`,`elements.${i}`,""]]))}pluginScopeKeys(t){const i=t.id;return Ds(`${this.type}-plugin-${i}`,(()=>[[`plugins.${i}`,...t.additionalOptionScopes||[]]]))}_cachedScopes(t,i){const e=this._scopeCache;let s=e.get(t);return s&&!i||(s=new Map,e.set(t,s)),s}getOptionScopes(t,i,e){const{options:s,type:n}=this,r=this._cachedScopes(t,e),o=r.get(i);if(o)return o;const h=new Set;i.forEach((i=>{t&&(h.add(t),i.forEach((i=>js(h,t,i)))),i.forEach((t=>js(h,s,t))),i.forEach((t=>js(h,Ut[n]||{},t))),i.forEach((t=>js(h,Gt,t))),i.forEach((t=>js(h,Zt,t)))}));const a=Array.from(h);return 0===a.length&&a.push(Object.create(null)),As.has(i)&&r.set(i,a),a}chartOptionScopes(){const{options:t,type:i}=this;return[t,Ut[i]||{},Gt.datasets[i]||{},{type:i},Gt,Zt]}resolveNamedOptions(t,i,e,s=[""]){const n={$shared:!0},{resolver:r,subPrefixes:o}=Cs(this._resolverCache,t,s);let h=r;(function(t,i){const{isScriptable:e,isIndexable:s}=_i(t);for(const n of i){const i=e(n),r=s(n),o=(r||i)&&t[n];if(i&&(ot(o)||Es(o))||r&&z(o))return!0}return!1})(r,i)&&(n.$shared=!1,h=wi(r,e=ot(e)?e():e,this.createResolver(t,e,o)));for(const t of i)n[t]=h[t];return n}createResolver(t,i,e=[""],s){const{resolver:n}=Cs(this._resolverCache,t,e);return H(i)?wi(n,i,void 0,s):n}}function Cs(t,i,e){let s=t.get(i);s||(s=new Map,t.set(i,s));const n=e.join();let r=s.get(n);return r||(r={resolver:Mi(i,e),subPrefixes:e.filter((t=>!t.toLowerCase().includes("hover")))},s.set(n,r)),r}const Es=t=>H(t)&&Object.getOwnPropertyNames(t).some((i=>ot(t[i]))),Ls=["top","bottom","left","right","chartArea"];function Ps(t,i){return"top"===t||"bottom"===t||-1===Ls.indexOf(t)&&"x"===i}function Ts(t,i){return function(e,s){return e[t]===s[t]?e[i]-s[i]:e[t]-s[t]}}function Is(t){const i=t.chart,e=i.options.animation;i.notifyPlugins("afterRender"),U(e&&e.onComplete,[t],i)}function Fs(t){const i=t.chart,e=i.options.animation;U(e&&e.onProgress,[t],i)}function Bs(t){return Ti()&&"string"==typeof t?t=document.getElementById(t):t&&t.length&&(t=t[0]),t&&t.canvas&&(t=t.canvas),t}const Ns={},Ws=t=>{const i=Bs(t);return Object.values(Ns).filter((t=>t.canvas===i)).pop()};function zs(t,i,e){const s=Object.keys(t);for(const n of s){const s=+n;if(s>=i){const r=t[n];delete t[n],(e>0||s>i)&&(t[s+e]=r)}}}class Hs{static defaults=Gt;static instances=Ns;static overrides=Ut;static registry=ps;static version="4.5.1";static getChart=Ws;static register(...t){ps.add(...t),$s()}static unregister(...t){ps.remove(...t),$s()}constructor(t,i){const e=this.config=new Rs(i),s=Bs(t),n=Ws(s);if(n)throw new Error("Canvas is already in use. Chart with ID '"+n.id+"' must be destroyed before the canvas with ID '"+n.canvas.id+"' can be reused.");const r=e.createResolver(e.chartOptionScopes(),this.getContext());this.platform=new(e.platform||function(t){return!Ti()||"undefined"!=typeof OffscreenCanvas&&t instanceof OffscreenCanvas?He:ss}(s)),this.platform.updateConfig(e);const o=this.platform.acquireContext(s,r.aspectRatio),h=o&&o.canvas,a=h&&h.height,c=h&&h.width;this.id=N(),this.ctx=o,this.canvas=h,this.width=c,this.height=a,this._options=r,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new ms,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=function(t,i){let e;return function(...s){return i?(clearTimeout(e),e=setTimeout(t,i,s)):t.apply(this,s),i}}((t=>this.update(t)),r.resizeDelay||0),this._dataChanges=[],Ns[this.id]=this,o&&h?(qi.listen(this,"complete",Is),qi.listen(this,"progress",Fs),this._initialize(),this.attached&&this.update()):console.error("Failed to create chart: can't acquire context from the given item")}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:i},width:e,height:s,_aspectRatio:n}=this;return W(t)?i&&n?n:s?e/s:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return ps}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():$i(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return ii(this.canvas,this.ctx),this}stop(){return qi.stop(this),this}resize(t,i){qi.running(this)?this._resizeBeforeDraw={width:t,height:i}:this._resize(t,i)}_resize(t,i){const e=this.options,s=this.platform.getMaximumSize(this.canvas,t,i,e.maintainAspectRatio&&this.aspectRatio),n=e.devicePixelRatio||this.platform.getDevicePixelRatio(),r=this.width?"resize":"attach";this.width=s.width,this.height=s.height,this._aspectRatio=this.aspectRatio,$i(this,n,!0)&&(this.notifyPlugins("resize",{size:s}),U(e.onResize,[this,s],this),this.attached&&this._doResize(r)&&this.render())}ensureScalesHaveIDs(){Z(this.options.scales||{},((t,i)=>{t.id=i}))}buildOrUpdateScales(){const t=this.options,i=t.scales,e=this.scales,s=Object.keys(e).reduce(((t,i)=>(t[i]=!1,t)),{});let n=[];i&&(n=n.concat(Object.keys(i).map((t=>{const e=i[t],s=ws(t,e),n="r"===s,r="x"===s;return{options:e,dposition:n?"chartArea":r?"bottom":"left",dtype:n?"radialLinear":r?"category":"linear"}})))),Z(n,(i=>{const n=i.options,r=n.id,o=ws(r,n),h=V(n.type,i.dtype);void 0!==n.position&&Ps(n.position,o)===Ps(i.dposition)||(n.position=i.dposition),s[r]=!0;let a=null;r in e&&e[r].type===h?a=e[r]:(a=new(ps.getScale(h))({id:r,type:h,ctx:this.ctx,chart:this}),e[a.id]=a),a.init(n,t)})),Z(s,((t,i)=>{t||delete e[i]})),Z(e,(t=>{We.configure(this,t,t.options),We.addBox(this,t)}))}_updateMetasets(){const t=this._metasets,i=this.data.datasets.length,e=t.length;if(t.sort(((t,i)=>t.index-i.index)),e>i){for(let t=i;t<e;++t)this._destroyDatasetMeta(t);t.splice(i,e-i)}this._sortedMetasets=t.slice(0).sort(Ts("order","index"))}_removeUnreferencedMetasets(){const{_metasets:t,data:{datasets:i}}=this;t.length>i.length&&delete this._stacks,t.forEach(((t,e)=>{0===i.filter((i=>i===t._dataset)).length&&this._destroyDatasetMeta(e)}))}buildOrUpdateControllers(){const t=[],i=this.data.datasets;let e,s;for(this._removeUnreferencedMetasets(),e=0,s=i.length;e<s;e++){const s=i[e];let n=this.getDatasetMeta(e);const r=s.type||this.config.type;if(n.type&&n.type!==r&&(this._destroyDatasetMeta(e),n=this.getDatasetMeta(e)),n.type=r,n.indexAxis=s.indexAxis||ys(r,this.options),n.order=s.order||0,n.index=e,n.label=""+s.label,n.visible=this.isDatasetVisible(e),n.controller)n.controller.updateIndex(e),n.controller.linkScales();else{const i=ps.getController(r),{datasetElementType:s,dataElementType:o}=Gt.datasets[r];Object.assign(i,{dataElementType:ps.getElement(o),datasetElementType:s&&ps.getElement(s)}),n.controller=new i(this,e),t.push(n.controller)}}return this._updateMetasets(),t}_resetElements(){Z(this.data.datasets,((t,i)=>{this.getDatasetMeta(i).controller.reset()}),this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const i=this.config;i.update();const e=this._options=i.createResolver(i.chartOptionScopes(),this.getContext()),s=this._animationsDisabled=!e.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),!1===this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0}))return;const n=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let r=0;for(let t=0,i=this.data.datasets.length;t<i;t++){const{controller:i}=this.getDatasetMeta(t),e=!s&&-1===n.indexOf(i);i.buildOrUpdateElements(e),r=Math.max(+i.getMaxOverflow(),r)}r=this._minPadding=e.layout.autoPadding?r:0,this._updateLayout(r),s||Z(n,(t=>{t.reset()})),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(Ts("z","_idx"));const{_active:o,_lastEvent:h}=this;h?this._eventHandler(h,!0):o.length&&this._updateHoverStyles(o,o,!0),this.render()}_updateScales(){Z(this.scales,(t=>{We.removeBox(this,t)})),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,i=new Set(Object.keys(this._listeners)),e=new Set(t.events);ht(i,e)&&!!this._responsiveListeners===t.responsive||(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,i=this._getUniformDataChanges()||[];for(const{method:e,start:s,count:n}of i)zs(t,s,"_removeElements"===e?-n:n)}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const i=this.data.datasets.length,e=i=>new Set(t.filter((t=>t[0]===i)).map(((t,i)=>i+","+t.splice(1).join(",")))),s=e(0);for(let t=1;t<i;t++)if(!ht(s,e(t)))return;return Array.from(s).map((t=>t.split(","))).map((t=>({method:t[1],start:+t[2],count:+t[3]})))}_updateLayout(t){if(!1===this.notifyPlugins("beforeLayout",{cancelable:!0}))return;We.update(this,this.width,this.height,t);const i=this.chartArea,e=i.width<=0||i.height<=0;this._layers=[],Z(this.boxes,(t=>{e&&"chartArea"===t.position||(t.configure&&t.configure(),this._layers.push(...t._layers()))}),this),this._layers.forEach(((t,i)=>{t._idx=i})),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(!1!==this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})){for(let t=0,i=this.data.datasets.length;t<i;++t)this.getDatasetMeta(t).controller.configure();for(let i=0,e=this.data.datasets.length;i<e;++i)this._updateDataset(i,ot(t)?t({datasetIndex:i}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,i){const e=this.getDatasetMeta(t),s={meta:e,index:t,mode:i,cancelable:!0};!1!==this.notifyPlugins("beforeDatasetUpdate",s)&&(e.controller._update(i),s.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",s))}render(){!1!==this.notifyPlugins("beforeRender",{cancelable:!0})&&(qi.has(this)?this.attached&&!qi.running(this)&&qi.start(this):(this.draw(),Is({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){const{width:t,height:i}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(t,i)}if(this.clear(),this.width<=0||this.height<=0)return;if(!1===this.notifyPlugins("beforeDraw",{cancelable:!0}))return;const i=this._layers;for(t=0;t<i.length&&i[t].z<=0;++t)i[t].draw(this.chartArea);for(this._drawDatasets();t<i.length;++t)i[t].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(t){const i=this._sortedMetasets,e=[];let s,n;for(s=0,n=i.length;s<n;++s){const n=i[s];t&&!n.visible||e.push(n)}return e}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(!1===this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0}))return;const t=this.getSortedVisibleDatasetMetas();for(let i=t.length-1;i>=0;--i)this._drawDataset(t[i]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const i=this.ctx,e={meta:t,index:t.index,cancelable:!0},s=function(t,i){const e=i._clip;if(e.disabled)return!1;const s=function(t,i){const{xScale:e,yScale:s}=t;return e&&s?{left:Ki(e,i,"left"),right:Ki(e,i,"right"),top:Ki(s,i,"top"),bottom:Ki(s,i,"bottom")}:i}(i,t.chartArea);return{left:!1===e.left?0:s.left-(!0===e.left?0:e.left),right:!1===e.right?t.width:s.right+(!0===e.right?0:e.right),top:!1===e.top?0:s.top-(!0===e.top?0:e.top),bottom:!1===e.bottom?t.height:s.bottom+(!0===e.bottom?0:e.bottom)}}(this,t);!1!==this.notifyPlugins("beforeDatasetDraw",e)&&(s&&ri(i,s),t.controller.draw(),s&&oi(i),e.cancelable=!1,this.notifyPlugins("afterDatasetDraw",e))}isPointInArea(t){return ni(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,i,e,s){const n=De.modes[i];return"function"==typeof n?n(this,t,e,s):[]}getDatasetMeta(t){const i=this.data.datasets[t],e=this._metasets;let s=e.filter((t=>t&&t._dataset===i)).pop();return s||(s={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:i&&i.order||0,index:t,_dataset:i,_parsed:[],_sorted:!1},e.push(s)),s}getContext(){return this.$context||(this.$context=yi(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const i=this.data.datasets[t];if(!i)return!1;const e=this.getDatasetMeta(t);return"boolean"==typeof e.hidden?!e.hidden:!i.hidden}setDatasetVisibility(t,i){this.getDatasetMeta(t).hidden=!i}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,i,e){const s=e?"show":"hide",n=this.getDatasetMeta(t),r=n.controller._resolveAnimations(void 0,s);rt(i)?(n.data[i].hidden=!e,this.update()):(this.setDatasetVisibility(t,e),r.update(n,{visible:e}),this.update((i=>i.datasetIndex===t?s:void 0)))}hide(t,i){this._updateVisibility(t,i,!1)}show(t,i){this._updateVisibility(t,i,!0)}_destroyDatasetMeta(t){const i=this._metasets[t];i&&i.controller&&i.controller._destroy(),delete this._metasets[t]}_stop(){let t,i;for(this.stop(),qi.remove(this),t=0,i=this.data.datasets.length;t<i;++t)this._destroyDatasetMeta(t)}destroy(){this.notifyPlugins("beforeDestroy");const{canvas:t,ctx:i}=this;this._stop(),this.config.clearCache(),t&&(this.unbindEvents(),ii(t,i),this.platform.releaseContext(i),this.canvas=null,this.ctx=null),delete Ns[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...t){return this.canvas.toDataURL(...t)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){const t=this._listeners,i=this.platform,e=(e,s)=>{i.addEventListener(this,e,s),t[e]=s},s=(t,i,e)=>{t.offsetX=i,t.offsetY=e,this._eventHandler(t)};Z(this.options.events,(t=>e(t,s)))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,i=this.platform,e=(e,s)=>{i.addEventListener(this,e,s),t[e]=s},s=(e,s)=>{t[e]&&(i.removeEventListener(this,e,s),delete t[e])},n=(t,i)=>{this.canvas&&this.resize(t,i)};let r;const o=()=>{s("attach",o),this.attached=!0,this.resize(),e("resize",n),e("detach",r)};r=()=>{this.attached=!1,s("resize",n),this._stop(),this._resize(0,0),e("attach",o)},i.isAttached(this.canvas)?o():r()}unbindEvents(){Z(this._listeners,((t,i)=>{this.platform.removeEventListener(this,i,t)})),this._listeners={},Z(this._responsiveListeners,((t,i)=>{this.platform.removeEventListener(this,i,t)})),this._responsiveListeners=void 0}updateHoverStyle(t,i,e){const s=e?"set":"remove";let n,r,o,h;for("dataset"===i&&(n=this.getDatasetMeta(t[0].datasetIndex),n.controller["_"+s+"DatasetHoverStyle"]()),o=0,h=t.length;o<h;++o){r=t[o];const i=r&&this.getDatasetMeta(r.datasetIndex).controller;i&&i[s+"HoverStyle"](r.element,r.datasetIndex,r.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){const i=this._active||[],e=t.map((({datasetIndex:t,index:i})=>{const e=this.getDatasetMeta(t);if(!e)throw new Error("No dataset found at index "+t);return{datasetIndex:t,element:e.data[i],index:i}}));!K(e,i)&&(this._active=e,this._lastEvent=null,this._updateHoverStyles(e,i))}notifyPlugins(t,i,e){return this._plugins.notify(this,t,i,e)}isPluginEnabled(t){return 1===this._plugins._cache.filter((i=>i.plugin.id===t)).length}_updateHoverStyles(t,i,e){const s=this.options.hover,n=(t,i)=>t.filter((t=>!i.some((i=>t.datasetIndex===i.datasetIndex&&t.index===i.index)))),r=n(i,t),o=e?t:n(t,i);r.length&&this.updateHoverStyle(r,s.mode,!1),o.length&&s.mode&&this.updateHoverStyle(o,s.mode,!0)}_eventHandler(t,i){const e={event:t,replay:i,cancelable:!0,inChartArea:this.isPointInArea(t)},s=i=>(i.options.events||this.options.events).includes(t.native.type);if(!1===this.notifyPlugins("beforeEvent",e,s))return;const n=this._handleEvent(t,i,e.inChartArea);return e.cancelable=!1,this.notifyPlugins("afterEvent",e,s),(n||e.changed)&&this.render(),this}_handleEvent(t,i,e){const{_active:s=[],options:n}=this,r=this._getActiveElements(t,s,e,i),o=function(t){return"mouseup"===t.type||"click"===t.type||"contextmenu"===t.type}(t),h=function(t,i,e,s){return e&&"mouseout"!==t.type?s?i:t:null}(t,this._lastEvent,e,o);e&&(this._lastEvent=null,U(n.onHover,[t,r,this],this),o&&U(n.onClick,[t,r,this],this));const a=!K(r,s);return(a||i)&&(this._active=r,this._updateHoverStyles(r,s,i)),this._lastEvent=h,a}_getActiveElements(t,i,e,s){if("mouseout"===t.type)return[];if(!e)return i;const n=this.options.hover;return this.getElementsAtEventForMode(t,n.mode,n,s)}}function $s(){return Z(Hs.instances,(t=>t._plugins.invalidate()))}function Ys(t,i){const{x:e,y:s,base:n,width:r,height:o}=t.getProps(["x","y","base","width","height"],i);let h,a,c,l,u;return t.horizontal?(u=o/2,h=Math.min(e,n),a=Math.max(e,n),c=s-u,l=s+u):(u=r/2,h=e-u,a=e+u,c=Math.min(s,n),l=Math.max(s,n)),{left:h,top:c,right:a,bottom:l}}function Vs(t,i,e,s){return t?0:kt(i,e,s)}function Xs(t,i,e,s){const n=null===i,r=null===e,o=t&&!(n&&r)&&Ys(t,s);return o&&(n||Ot(i,o.left,o.right))&&(r||Ot(e,o.top,o.bottom))}function Us(t,i){t.rect(i.x,i.y,i.w,i.h)}function Zs(t,i,e={}){const s=t.x!==e.x?-i:0,n=t.y!==e.y?-i:0;return{x:t.x+s,y:t.y+n,w:t.w+((t.x+t.w!==e.x+e.w?i:0)-s),h:t.h+((t.y+t.h!==e.y+e.h?i:0)-n),radius:t.radius}}const Ks=["rgb(54, 162, 235)","rgb(255, 99, 132)","rgb(255, 159, 64)","rgb(255, 205, 86)","rgb(75, 192, 192)","rgb(153, 102, 255)","rgb(201, 203, 207)"],Qs=Ks.map((t=>t.replace("rgb(","rgba(").replace(")",", 0.5)")));function qs(t){return Ks[t%Ks.length]}function Gs(t){return Qs[t%Qs.length]}function Js(t){let i;for(i in t)if(t[i].borderColor||t[i].backgroundColor)return!0;return!1}var tn={id:"colors",defaults:{enabled:!0,forceOverride:!1},beforeLayout(t,i,e){if(!e.enabled)return;const{data:{datasets:s},options:n}=t.config,{elements:r}=n,o=Js(s)||(h=n)&&(h.borderColor||h.backgroundColor)||r&&Js(r)||"rgba(0,0,0,0.1)"!==Gt.borderColor||"rgba(0,0,0,0.1)"!==Gt.backgroundColor;var h;if(!e.forceOverride&&o)return;const a=function(t){let i=0;return(e,s)=>{const n=t.getDatasetMeta(s).controller;n instanceof Me?i=function(t,i){return t.backgroundColor=t.data.map((()=>qs(i++))),i}(e,i):n instanceof we?i=function(t,i){return t.backgroundColor=t.data.map((()=>Gs(i++))),i}(e,i):n&&(i=function(t,i){return t.borderColor=qs(i),t.backgroundColor=Gs(i),++i}(e,i))}}(t);s.forEach(a)}};const en=(t,i)=>{let{boxHeight:e=i,boxWidth:s=i}=t;return t.usePointStyle&&(e=Math.min(e,i),s=t.pointStyleWidth||Math.min(s,i)),{boxWidth:s,boxHeight:e,itemHeight:Math.max(i,e)}};class sn extends ns{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,i,e){this.maxWidth=t,this.maxHeight=i,this._margins=e,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const t=this.options.labels||{};let i=U(t.generateLabels,[this.chart],this)||[];t.filter&&(i=i.filter((i=>t.filter(i,this.chart.data)))),t.sort&&(i=i.sort(((i,e)=>t.sort(i,e,this.chart.data)))),this.options.reverse&&i.reverse(),this.legendItems=i}fit(){const{options:t,ctx:i}=this;if(!t.display)return void(this.width=this.height=0);const e=t.labels,s=xi(e.font),n=s.size,r=this._computeTitleHeight(),{boxWidth:o,itemHeight:h}=en(e,n);let a,c;i.font=s.string,this.isHorizontal()?(a=this.maxWidth,c=this._fitRows(r,n,o,h)+10):(c=this.maxHeight,a=this._fitCols(r,s,o,h)+10),this.width=Math.min(a,t.maxWidth||this.maxWidth),this.height=Math.min(c,t.maxHeight||this.maxHeight)}_fitRows(t,i,e,s){const{ctx:n,maxWidth:r,options:{labels:{padding:o}}}=this,h=this.legendHitBoxes=[],a=this.lineWidths=[0],c=s+o;let l=t;n.textAlign="left",n.textBaseline="middle";let u=-1,f=-c;return this.legendItems.forEach(((t,d)=>{const b=e+i/2+n.measureText(t.text).width;(0===d||a[a.length-1]+b+2*o>r)&&(l+=c,a[a.length-(d>0?0:1)]=0,f+=c,u++),h[d]={left:0,top:f,row:u,width:b,height:s},a[a.length-1]+=b+o})),l}_fitCols(t,i,e,s){const{ctx:n,maxHeight:r,options:{labels:{padding:o}}}=this,h=this.legendHitBoxes=[],a=this.columnSizes=[],c=r-t;let l=o,u=0,f=0,d=0,b=0;return this.legendItems.forEach(((t,r)=>{const{itemWidth:g,itemHeight:p}=function(t,i,e,s,n){const r=function(t,i,e,s){let n=t.text;return n&&"string"!=typeof n&&(n=n.reduce(((t,i)=>t.length>i.length?t:i))),i+e.size/2+s.measureText(n).width}(s,t,i,e),o=function(t,i,e){let s=t;return"string"!=typeof i.text&&(s=nn(i,e)),s}(n,s,i.lineHeight);return{itemWidth:r,itemHeight:o}}(e,i,n,t,s);r>0&&f+p+2*o>c&&(l+=u+o,a.push({width:u,height:f}),d+=u+o,b++,u=f=0),h[r]={left:d,top:f,col:b,width:g,height:p},u=Math.max(u,g),f+=p+o})),l+=u,a.push({width:u,height:f}),l}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:i,options:{align:e,labels:{padding:s},rtl:n}}=this,r=Xi(n,this.left,this.width);if(this.isHorizontal()){let n=0,o=Pt(e,this.left+s,this.right-this.lineWidths[n]);for(const h of i)n!==h.row&&(n=h.row,o=Pt(e,this.left+s,this.right-this.lineWidths[n])),h.top+=this.top+t+s,h.left=r.leftForLtr(r.x(o),h.width),o+=h.width+s}else{let n=0,o=Pt(e,this.top+t+s,this.bottom-this.columnSizes[n].height);for(const h of i)h.col!==n&&(n=h.col,o=Pt(e,this.top+t+s,this.bottom-this.columnSizes[n].height)),h.top=o,h.left+=this.left+s,h.left=r.leftForLtr(r.x(h.left),h.width),o+=h.height+s}}isHorizontal(){return"top"===this.options.position||"bottom"===this.options.position}draw(){if(this.options.display){const t=this.ctx;ri(t,this),this._draw(),oi(t)}}_draw(){const{options:t,columnSizes:i,lineWidths:e,ctx:s}=this,{align:n,labels:r}=t,o=Gt.color,h=Xi(t.rtl,this.left,this.width),a=xi(r.font),{padding:c}=r,l=a.size,u=l/2;let f;this.drawTitle(),s.textAlign=h.textAlign("left"),s.textBaseline="middle",s.lineWidth=.5,s.font=a.string;const{boxWidth:d,boxHeight:b,itemHeight:g}=en(r,l),p=this.isHorizontal(),m=this._computeTitleHeight();f=p?{x:Pt(n,this.left+c,this.right-e[0]),y:this.top+c+m,line:0}:{x:this.left+c,y:Pt(n,this.top+m+c,this.bottom-i[0].height),line:0},Ui(this.ctx,t.textDirection);const x=g+c;this.legendItems.forEach(((v,y)=>{s.strokeStyle=v.fontColor,s.fillStyle=v.fontColor;const M=s.measureText(v.text).width,w=h.textAlign(v.textAlign||(v.textAlign=r.textAlign)),_=d+u+M;let k=f.x,O=f.y;h.setWidth(this.width),p?y>0&&k+_+c>this.right&&(O=f.y+=x,f.line++,k=f.x=Pt(n,this.left+c,this.right-e[f.line])):y>0&&O+x>this.bottom&&(k=f.x=k+i[f.line].width+c,f.line++,O=f.y=Pt(n,this.top+m+c,this.bottom-i[f.line].height)),function(t,i,e){if(isNaN(d)||d<=0||isNaN(b)||b<0)return;s.save();const n=V(e.lineWidth,1);if(s.fillStyle=V(e.fillStyle,o),s.lineCap=V(e.lineCap,"butt"),s.lineDashOffset=V(e.lineDashOffset,0),s.lineJoin=V(e.lineJoin,"miter"),s.lineWidth=n,s.strokeStyle=V(e.strokeStyle,o),s.setLineDash(V(e.lineDash,[])),r.usePointStyle){const o={radius:b*Math.SQRT2/2,pointStyle:e.pointStyle,rotation:e.rotation,borderWidth:n},a=h.xPlus(t,d/2);si(s,o,a,i+u,r.pointStyleWidth&&d)}else{const r=i+Math.max((l-b)/2,0),o=h.leftForLtr(t,d),a=pi(e.borderRadius);s.beginPath(),Object.values(a).some((t=>0!==t))?li(s,{x:o,y:r,w:d,h:b,radius:a}):s.rect(o,r,d,b),s.fill(),0!==n&&s.stroke()}s.restore()}(h.x(k),O,v),k=((t,i,e,s)=>t===(s?"left":"right")?e:"center"===t?(i+e)/2:i)(w,k+d+u,p?k+_:this.right,t.rtl),function(t,i,e){ci(s,e.text,t,i+g/2,a,{strikethrough:e.hidden,textAlign:h.textAlign(e.textAlign)})}(h.x(k),O,v),p?f.x+=_+c:f.y+="string"!=typeof v.text?nn(v,a.lineHeight)+c:x})),Zi(this.ctx,t.textDirection)}drawTitle(){const t=this.options,i=t.title,e=xi(i.font),s=mi(i.padding);if(!i.display)return;const n=Xi(t.rtl,this.left,this.width),r=this.ctx,o=i.position,h=s.top+e.size/2;let a,c=this.left,l=this.width;if(this.isHorizontal())l=Math.max(...this.lineWidths),a=this.top+h,c=Pt(t.align,c,this.right-l);else{const i=this.columnSizes.reduce(((t,i)=>Math.max(t,i.height)),0);a=h+Pt(t.align,this.top,this.bottom-i-t.labels.padding-this._computeTitleHeight())}const u=Pt(o,c,c+l);r.textAlign=n.textAlign(Lt(o)),r.textBaseline="middle",r.strokeStyle=i.color,r.fillStyle=i.color,r.font=e.string,ci(r,i.text,u,a,e)}_computeTitleHeight(){const t=this.options.title,i=xi(t.font),e=mi(t.padding);return t.display?i.lineHeight+e.height:0}_getLegendItemAt(t,i){let e,s,n;if(Ot(t,this.left,this.right)&&Ot(i,this.top,this.bottom))for(n=this.legendHitBoxes,e=0;e<n.length;++e)if(s=n[e],Ot(t,s.left,s.left+s.width)&&Ot(i,s.top,s.top+s.height))return this.legendItems[e];return null}handleEvent(t){const i=this.options;if(!function(t,i){return!("mousemove"!==t&&"mouseout"!==t||!i.onHover&&!i.onLeave)||!(!i.onClick||"click"!==t&&"mouseup"!==t)}(t.type,i))return;const e=this._getLegendItemAt(t.x,t.y);if("mousemove"===t.type||"mouseout"===t.type){const r=this._hoveredItem,o=(n=e,null!==(s=r)&&null!==n&&s.datasetIndex===n.datasetIndex&&s.index===n.index);r&&!o&&U(i.onLeave,[t,r,this],this),this._hoveredItem=e,e&&!o&&U(i.onHover,[t,e,this],this)}else e&&U(i.onClick,[t,e,this],this);var s,n}}function nn(t,i){return i*(t.text?t.text.length:0)}var rn={id:"legend",_element:sn,start(t,i,e){const s=t.legend=new sn({ctx:t.ctx,options:e,chart:t});We.configure(t,s,e),We.addBox(t,s)},stop(t){We.removeBox(t,t.legend),delete t.legend},beforeUpdate(t,i,e){const s=t.legend;We.configure(t,s,e),s.options=e},afterUpdate(t){const i=t.legend;i.buildLabels(),i.adjustHitBoxes()},afterEvent(t,i){i.replay||t.legend.handleEvent(i.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(t,i,e){const s=i.datasetIndex,n=e.chart;n.isDatasetVisible(s)?(n.hide(s),i.hidden=!0):(n.show(s),i.hidden=!1)},onHover:null,onLeave:null,labels:{color:t=>t.chart.options.color,boxWidth:40,padding:10,generateLabels(t){const i=t.data.datasets,{labels:{usePointStyle:e,pointStyle:s,textAlign:n,color:r,useBorderRadius:o,borderRadius:h}}=t.legend.options;return t._getSortedDatasetMetas().map((t=>{const a=t.controller.getStyle(e?0:void 0),c=mi(a.borderWidth);return{text:i[t.index].label,fillStyle:a.backgroundColor,fontColor:r,hidden:!t.visible,lineCap:a.borderCapStyle,lineDash:a.borderDash,lineDashOffset:a.borderDashOffset,lineJoin:a.borderJoinStyle,lineWidth:(c.width+c.height)/4,strokeStyle:a.borderColor,pointStyle:s||a.pointStyle,rotation:a.rotation,textAlign:n||a.textAlign,borderRadius:o&&(h||a.borderRadius),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 on extends ns{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,i){const e=this.options;if(this.left=0,this.top=0,!e.display)return void(this.width=this.height=this.right=this.bottom=0);this.width=this.right=t,this.height=this.bottom=i;const s=z(e.text)?e.text.length:1;this._padding=mi(e.padding);const n=s*xi(e.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=n:this.width=n}isHorizontal(){const t=this.options.position;return"top"===t||"bottom"===t}_drawArgs(t){const{top:i,left:e,bottom:s,right:n,options:r}=this,o=r.align;let h,a,c,l=0;return this.isHorizontal()?(a=Pt(o,e,n),c=i+t,h=n-e):("left"===r.position?(a=e+t,c=Pt(o,s,i),l=-.5*at):(a=n-t,c=Pt(o,i,s),l=.5*at),h=s-i),{titleX:a,titleY:c,maxWidth:h,rotation:l}}draw(){const t=this.ctx,i=this.options;if(!i.display)return;const e=xi(i.font),s=e.lineHeight/2+this._padding.top,{titleX:n,titleY:r,maxWidth:o,rotation:h}=this._drawArgs(s);ci(t,i.text,0,0,e,{color:i.color,maxWidth:o,rotation:h,textAlign:Lt(i.align),textBaseline:"middle",translation:[n,r]})}}var hn={id:"title",_element:on,start(t,i,e){!function(t,i){const e=new on({ctx:t.ctx,options:i,chart:t});We.configure(t,e,i),We.addBox(t,e),t.titleBlock=e}(t,e)},stop(t){We.removeBox(t,t.titleBlock),delete t.titleBlock},beforeUpdate(t,i,e){const s=t.titleBlock;We.configure(t,s,e),s.options=e},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 an={average(t){if(!t.length)return!1;let i,e,s=new Set,n=0,r=0;for(i=0,e=t.length;i<e;++i){const e=t[i].element;if(e&&e.hasValue()){const t=e.tooltipPosition();s.add(t.x),n+=t.y,++r}}return 0!==r&&0!==s.size&&{x:[...s].reduce(((t,i)=>t+i))/s.size,y:n/r}},nearest(t,i){if(!t.length)return!1;let e,s,n,r=i.x,o=i.y,h=Number.POSITIVE_INFINITY;for(e=0,s=t.length;e<s;++e){const s=t[e].element;if(s&&s.hasValue()){const t=(a=i,c=s.getCenterPoint(),Math.sqrt(Math.pow(c.x-a.x,2)+Math.pow(c.y-a.y,2)));t<h&&(h=t,n=s)}}var a,c;if(n){const t=n.tooltipPosition();r=t.x,o=t.y}return{x:r,y:o}}};function cn(t,i){return i&&(z(i)?Array.prototype.push.apply(t,i):t.push(i)),t}function ln(t){return("string"==typeof t||t instanceof String)&&t.indexOf("\n")>-1?t.split("\n"):t}function un(t,i){const{element:e,datasetIndex:s,index:n}=i,r=t.getDatasetMeta(s).controller,{label:o,value:h}=r.getLabelAndValue(n);return{chart:t,label:o,parsed:r.getParsed(n),raw:t.data.datasets[s].data[n],formattedValue:h,dataset:r.getDataset(),dataIndex:n,datasetIndex:s,element:e}}function fn(t,i){const e=t.chart.ctx,{body:s,footer:n,title:r}=t,{boxWidth:o,boxHeight:h}=i,a=xi(i.bodyFont),c=xi(i.titleFont),l=xi(i.footerFont),u=r.length,f=n.length,d=s.length,b=mi(i.padding);let g=b.height,p=0,m=s.reduce(((t,i)=>t+i.before.length+i.lines.length+i.after.length),0);m+=t.beforeBody.length+t.afterBody.length,u&&(g+=u*c.lineHeight+(u-1)*i.titleSpacing+i.titleMarginBottom),m&&(g+=d*(i.displayColors?Math.max(h,a.lineHeight):a.lineHeight)+(m-d)*a.lineHeight+(m-1)*i.bodySpacing),f&&(g+=i.footerMarginTop+f*l.lineHeight+(f-1)*i.footerSpacing);let x=0;const v=function(t){p=Math.max(p,e.measureText(t).width+x)};return e.save(),e.font=c.string,Z(t.title,v),e.font=a.string,Z(t.beforeBody.concat(t.afterBody),v),x=i.displayColors?o+2+i.boxPadding:0,Z(s,(t=>{Z(t.before,v),Z(t.lines,v),Z(t.after,v)})),x=0,e.font=l.string,Z(t.footer,v),e.restore(),p+=b.width,{width:p,height:g}}function dn(t,i,e,s){const{x:n,width:r}=e,{width:o,chartArea:{left:h,right:a}}=t;let c="center";return"center"===s?c=n<=(h+a)/2?"left":"right":n<=r/2?c="left":n>=o-r/2&&(c="right"),function(t,i,e,s){const{x:n,width:r}=s,o=e.caretSize+e.caretPadding;return"left"===t&&n+r+o>i.width||"right"===t&&n-r-o<0||void 0}(c,t,i,e)&&(c="center"),c}function bn(t,i,e){const s=e.yAlign||i.yAlign||function(t,i){const{y:e,height:s}=i;return e<s/2?"top":e>t.height-s/2?"bottom":"center"}(t,e);return{xAlign:e.xAlign||i.xAlign||dn(t,i,e,s),yAlign:s}}function gn(t,i,e,s){const{caretSize:n,caretPadding:r,cornerRadius:o}=t,{xAlign:h,yAlign:a}=e,c=n+r,{topLeft:l,topRight:u,bottomLeft:f,bottomRight:d}=pi(o);let b=function(t,i){let{x:e,width:s}=t;return"right"===i?e-=s:"center"===i&&(e-=s/2),e}(i,h);const g=function(t,i,e){let{y:s,height:n}=t;return"top"===i?s+=e:s-="bottom"===i?n+e:n/2,s}(i,a,c);return"center"===a?"left"===h?b+=c:"right"===h&&(b-=c):"left"===h?b-=Math.max(l,f)+n:"right"===h&&(b+=Math.max(u,d)+n),{x:kt(b,0,s.width-i.width),y:kt(g,0,s.height-i.height)}}function pn(t,i,e){const s=mi(e.padding);return"center"===i?t.x+t.width/2:"right"===i?t.x+t.width-s.right:t.x+s.left}function mn(t){return cn([],ln(t))}function xn(t,i){const e=i&&i.dataset&&i.dataset.tooltip&&i.dataset.tooltip.callbacks;return e?t.override(e):t}const vn={beforeTitle:B,title(t){if(t.length>0){const i=t[0],e=i.chart.data.labels,s=e?e.length:0;if(this&&this.options&&"dataset"===this.options.mode)return i.dataset.label||"";if(i.label)return i.label;if(s>0&&i.dataIndex<s)return e[i.dataIndex]}return""},afterTitle:B,beforeBody:B,beforeLabel:B,label(t){if(this&&this.options&&"dataset"===this.options.mode)return t.label+": "+t.formattedValue||t.formattedValue;let i=t.dataset.label||"";i&&(i+=": ");const e=t.formattedValue;return W(e)||(i+=e),i},labelColor(t){const i=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{borderColor:i.borderColor,backgroundColor:i.backgroundColor,borderWidth:i.borderWidth,borderDash:i.borderDash,borderDashOffset:i.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(t){const i=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{pointStyle:i.pointStyle,rotation:i.rotation}},afterLabel:B,afterBody:B,beforeFooter:B,footer:B,afterFooter:B};function yn(t,i,e,s){const n=t[i].call(e,s);return void 0===n?vn[i].call(e,s):n}class Mn extends ns{static positioners=an;constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const i=this.chart,e=this.options.setContext(this.getContext()),s=e.enabled&&i.options.animation&&e.animations,n=new ie(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(n)),n}getContext(){return this.$context||(this.$context=yi(this.chart.getContext(),{tooltip:this,tooltipItems:this._tooltipItems,type:"tooltip"}))}getTitle(t,i){const{callbacks:e}=i,s=yn(e,"beforeTitle",this,t),n=yn(e,"title",this,t),r=yn(e,"afterTitle",this,t);let o=[];return o=cn(o,ln(s)),o=cn(o,ln(n)),o=cn(o,ln(r)),o}getBeforeBody(t,i){return mn(yn(i.callbacks,"beforeBody",this,t))}getBody(t,i){const{callbacks:e}=i,s=[];return Z(t,(t=>{const i={before:[],lines:[],after:[]},n=xn(e,t);cn(i.before,ln(yn(n,"beforeLabel",this,t))),cn(i.lines,yn(n,"label",this,t)),cn(i.after,ln(yn(n,"afterLabel",this,t))),s.push(i)})),s}getAfterBody(t,i){return mn(yn(i.callbacks,"afterBody",this,t))}getFooter(t,i){const{callbacks:e}=i,s=yn(e,"beforeFooter",this,t),n=yn(e,"footer",this,t),r=yn(e,"afterFooter",this,t);let o=[];return o=cn(o,ln(s)),o=cn(o,ln(n)),o=cn(o,ln(r)),o}_createItems(t){const i=this._active,e=this.chart.data,s=[],n=[],r=[];let o,h,a=[];for(o=0,h=i.length;o<h;++o)a.push(un(this.chart,i[o]));return t.filter&&(a=a.filter(((i,s,n)=>t.filter(i,s,n,e)))),t.itemSort&&(a=a.sort(((i,s)=>t.itemSort(i,s,e)))),Z(a,(i=>{const e=xn(t.callbacks,i);s.push(yn(e,"labelColor",this,i)),n.push(yn(e,"labelPointStyle",this,i)),r.push(yn(e,"labelTextColor",this,i))})),this.labelColors=s,this.labelPointStyles=n,this.labelTextColors=r,this.dataPoints=a,a}update(t,i){const e=this.options.setContext(this.getContext()),s=this._active;let n,r=[];if(s.length){const t=an[e.position].call(this,s,this._eventPosition);r=this._createItems(e),this.title=this.getTitle(r,e),this.beforeBody=this.getBeforeBody(r,e),this.body=this.getBody(r,e),this.afterBody=this.getAfterBody(r,e),this.footer=this.getFooter(r,e);const i=this._size=fn(this,e),o=Object.assign({},t,i),h=bn(this.chart,e,o),a=gn(e,o,h,this.chart);this.xAlign=h.xAlign,this.yAlign=h.yAlign,n={opacity:1,x:a.x,y:a.y,width:i.width,height:i.height,caretX:t.x,caretY:t.y}}else 0!==this.opacity&&(n={opacity:0});this._tooltipItems=r,this.$context=void 0,n&&this._resolveAnimations().update(this,n),t&&e.external&&e.external.call(this,{chart:this.chart,tooltip:this,replay:i})}drawCaret(t,i,e,s){const n=this.getCaretPosition(t,e,s);i.lineTo(n.x1,n.y1),i.lineTo(n.x2,n.y2),i.lineTo(n.x3,n.y3)}getCaretPosition(t,i,e){const{xAlign:s,yAlign:n}=this,{caretSize:r,cornerRadius:o}=e,{topLeft:h,topRight:a,bottomLeft:c,bottomRight:l}=pi(o),{x:u,y:f}=t,{width:d,height:b}=i;let g,p,m,x,v,y;return"center"===n?(v=f+b/2,"left"===s?(g=u,p=g-r,x=v+r,y=v-r):(g=u+d,p=g+r,x=v-r,y=v+r),m=g):(p="left"===s?u+Math.max(h,c)+r:"right"===s?u+d-Math.max(a,l)-r:this.caretX,"top"===n?(x=f,v=x-r,g=p-r,m=p+r):(x=f+b,v=x+r,g=p+r,m=p-r),y=x),{x1:g,x2:p,x3:m,y1:x,y2:v,y3:y}}drawTitle(t,i,e){const s=this.title,n=s.length;let r,o,h;if(n){const a=Xi(e.rtl,this.x,this.width);for(t.x=pn(this,e.titleAlign,e),i.textAlign=a.textAlign(e.titleAlign),i.textBaseline="middle",r=xi(e.titleFont),o=e.titleSpacing,i.fillStyle=e.titleColor,i.font=r.string,h=0;h<n;++h)i.fillText(s[h],a.x(t.x),t.y+r.lineHeight/2),t.y+=r.lineHeight+o,h+1===n&&(t.y+=e.titleMarginBottom-o)}}_drawColorBox(t,i,e,s,n){const r=this.labelColors[e],o=this.labelPointStyles[e],{boxHeight:h,boxWidth:a}=n,c=xi(n.bodyFont),l=pn(this,"left",n),u=s.x(l),f=i.y+(h<c.lineHeight?(c.lineHeight-h)/2:0);if(n.usePointStyle){const i={radius:Math.min(a,h)/2,pointStyle:o.pointStyle,rotation:o.rotation,borderWidth:1},e=s.leftForLtr(u,a)+a/2,c=f+h/2;t.strokeStyle=n.multiKeyBackground,t.fillStyle=n.multiKeyBackground,ei(t,i,e,c),t.strokeStyle=r.borderColor,t.fillStyle=r.backgroundColor,ei(t,i,e,c)}else{t.lineWidth=H(r.borderWidth)?Math.max(...Object.values(r.borderWidth)):r.borderWidth||1,t.strokeStyle=r.borderColor,t.setLineDash(r.borderDash||[]),t.lineDashOffset=r.borderDashOffset||0;const i=s.leftForLtr(u,a),e=s.leftForLtr(s.xPlus(u,1),a-2),o=pi(r.borderRadius);Object.values(o).some((t=>0!==t))?(t.beginPath(),t.fillStyle=n.multiKeyBackground,li(t,{x:i,y:f,w:a,h,radius:o}),t.fill(),t.stroke(),t.fillStyle=r.backgroundColor,t.beginPath(),li(t,{x:e,y:f+1,w:a-2,h:h-2,radius:o}),t.fill()):(t.fillStyle=n.multiKeyBackground,t.fillRect(i,f,a,h),t.strokeRect(i,f,a,h),t.fillStyle=r.backgroundColor,t.fillRect(e,f+1,a-2,h-2))}t.fillStyle=this.labelTextColors[e]}drawBody(t,i,e){const{body:s}=this,{bodySpacing:n,bodyAlign:r,displayColors:o,boxHeight:h,boxWidth:a,boxPadding:c}=e,l=xi(e.bodyFont);let u=l.lineHeight,f=0;const d=Xi(e.rtl,this.x,this.width),b=function(e){i.fillText(e,d.x(t.x+f),t.y+u/2),t.y+=u+n},g=d.textAlign(r);let p,m,x,v,y,M,w;for(i.textAlign=r,i.textBaseline="middle",i.font=l.string,t.x=pn(this,g,e),i.fillStyle=e.bodyColor,Z(this.beforeBody,b),f=o&&"right"!==g?"center"===r?a/2+c:a+2+c:0,v=0,M=s.length;v<M;++v){for(p=s[v],m=this.labelTextColors[v],i.fillStyle=m,Z(p.before,b),x=p.lines,o&&x.length&&(this._drawColorBox(i,t,v,d,e),u=Math.max(l.lineHeight,h)),y=0,w=x.length;y<w;++y)b(x[y]),u=l.lineHeight;Z(p.after,b)}f=0,u=l.lineHeight,Z(this.afterBody,b),t.y-=n}drawFooter(t,i,e){const s=this.footer,n=s.length;let r,o;if(n){const h=Xi(e.rtl,this.x,this.width);for(t.x=pn(this,e.footerAlign,e),t.y+=e.footerMarginTop,i.textAlign=h.textAlign(e.footerAlign),i.textBaseline="middle",r=xi(e.footerFont),i.fillStyle=e.footerColor,i.font=r.string,o=0;o<n;++o)i.fillText(s[o],h.x(t.x),t.y+r.lineHeight/2),t.y+=r.lineHeight+e.footerSpacing}}drawBackground(t,i,e,s){const{xAlign:n,yAlign:r}=this,{x:o,y:h}=t,{width:a,height:c}=e,{topLeft:l,topRight:u,bottomLeft:f,bottomRight:d}=pi(s.cornerRadius);i.fillStyle=s.backgroundColor,i.strokeStyle=s.borderColor,i.lineWidth=s.borderWidth,i.beginPath(),i.moveTo(o+l,h),"top"===r&&this.drawCaret(t,i,e,s),i.lineTo(o+a-u,h),i.quadraticCurveTo(o+a,h,o+a,h+u),"center"===r&&"right"===n&&this.drawCaret(t,i,e,s),i.lineTo(o+a,h+c-d),i.quadraticCurveTo(o+a,h+c,o+a-d,h+c),"bottom"===r&&this.drawCaret(t,i,e,s),i.lineTo(o+f,h+c),i.quadraticCurveTo(o,h+c,o,h+c-f),"center"===r&&"left"===n&&this.drawCaret(t,i,e,s),i.lineTo(o,h+l),i.quadraticCurveTo(o,h,o+l,h),i.closePath(),i.fill(),s.borderWidth>0&&i.stroke()}_updateAnimationTarget(t){const i=this.chart,e=this.$animations,s=e&&e.x,n=e&&e.y;if(s||n){const e=an[t.position].call(this,this._active,this._eventPosition);if(!e)return;const r=this._size=fn(this,t),o=Object.assign({},e,this._size),h=bn(i,t,o),a=gn(t,o,h,i);s._to===a.x&&n._to===a.y||(this.xAlign=h.xAlign,this.yAlign=h.yAlign,this.width=r.width,this.height=r.height,this.caretX=e.x,this.caretY=e.y,this._resolveAnimations().update(this,a))}}_willRender(){return!!this.opacity}draw(t){const i=this.options.setContext(this.getContext());let e=this.opacity;if(!e)return;this._updateAnimationTarget(i);const s={width:this.width,height:this.height},n={x:this.x,y:this.y};e=Math.abs(e)<.001?0:e;const r=mi(i.padding);i.enabled&&(this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length)&&(t.save(),t.globalAlpha=e,this.drawBackground(n,t,s,i),Ui(t,i.textDirection),n.y+=r.top,this.drawTitle(n,t,i),this.drawBody(n,t,i),this.drawFooter(n,t,i),Zi(t,i.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,i){const e=this._active,s=t.map((({datasetIndex:t,index:i})=>{const e=this.chart.getDatasetMeta(t);if(!e)throw new Error("Cannot find a dataset at index "+t);return{datasetIndex:t,element:e.data[i],index:i}})),n=!K(e,s),r=this._positionChanged(s,i);(n||r)&&(this._active=s,this._eventPosition=i,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,i,e=!0){if(i&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const s=this.options,n=this._active||[],r=this._getActiveElements(t,n,i,e),o=this._positionChanged(r,t),h=i||!K(r,n)||o;return h&&(this._active=r,(s.enabled||s.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,i))),h}_getActiveElements(t,i,e,s){const n=this.options;if("mouseout"===t.type)return[];if(!s)return i.filter((t=>this.chart.data.datasets[t.datasetIndex]&&void 0!==this.chart.getDatasetMeta(t.datasetIndex).controller.getParsed(t.index)));const r=this.chart.getElementsAtEventForMode(t,n.mode,n,e);return n.reverse&&r.reverse(),r}_positionChanged(t,i){const{caretX:e,caretY:s,options:n}=this,r=an[n.position].call(this,t,i);return!1!==r&&(e!==r.x||s!==r.y)}}var wn={id:"tooltip",_element:Mn,positioners:an,afterInit(t,i,e){e&&(t.tooltip=new Mn({chart:t,options:e}))},beforeUpdate(t,i,e){t.tooltip&&t.tooltip.initialize(e)},reset(t,i,e){t.tooltip&&t.tooltip.initialize(e)},afterDraw(t){const i=t.tooltip;if(i&&i._willRender()){const e={tooltip:i};if(!1===t.notifyPlugins("beforeTooltipDraw",{...e,cancelable:!0}))return;i.draw(t.ctx),t.notifyPlugins("afterTooltipDraw",e)}},afterEvent(t,i){t.tooltip&&t.tooltip.handleEvent(i.event,i.replay,i.inChartArea)&&(i.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,i)=>i.bodyFont.size,boxWidth:(t,i)=>i.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:vn},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"]};function _n(t){const i=this.getLabels();return t>=0&&t<i.length?i[t]:t}function kn(t,i,{horizontal:e,minRotation:s}){const n=yt(s),r=(e?Math.sin(n):Math.cos(n))||.001;return Math.min(i/r,.75*i*(""+t).length)}class On extends ds{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,i){return W(t)||("number"==typeof t||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:i,maxDefined:e}=this.getUserBounds();let{min:s,max:n}=this;const r=t=>s=i?s:t,o=t=>n=e?n:t;if(t){const t=pt(s),i=pt(n);t<0&&i<0?o(0):t>0&&i>0&&r(0)}if(s===n){let i=0===n?1:Math.abs(.05*n);o(n+i),t||r(s-i)}this.min=s,this.max=n}getTickLimit(){const t=this.options.ticks;let i,{maxTicksLimit:e,stepSize:s}=t;return s?(i=Math.ceil(this.max/s)-Math.floor(this.min/s)+1,i>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${s} would result generating up to ${i} ticks. Limiting to 1000.`),i=1e3)):(i=this.computeTickLimit(),e=e||11),e&&(i=Math.min(e,i)),i}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,i=t.ticks;let e=this.getTickLimit();e=Math.max(2,e);const s=function(t,i){const e=[],{bounds:s,step:n,min:r,max:o,precision:h,count:a,maxTicks:c,maxDigits:l,includeBounds:u}=t,f=n||1,d=c-1,{min:b,max:g}=i,p=!W(r),m=!W(o),x=!W(a),v=(g-b)/(l+1);let y,M,w,_,k=xt((g-b)/d/f)*f;if(k<1e-14&&!p&&!m)return[{value:b},{value:g}];_=Math.ceil(g/k)-Math.floor(b/k),_>d&&(k=xt(_*k/d/f)*f),W(h)||(y=Math.pow(10,h),k=Math.ceil(k*y)/y),"ticks"===s?(M=Math.floor(b/k)*k,w=Math.ceil(g/k)*k):(M=b,w=g),p&&m&&n&&function(t,i){const e=Math.round(t);return e-i<=t&&e+i>=t}((o-r)/n,k/1e3)?(_=Math.round(Math.min((o-r)/k,c)),k=(o-r)/_,M=r,w=o):x?(M=p?r:M,w=m?o:w,_=a-1,k=(w-M)/_):(_=(w-M)/k,_=mt(_,Math.round(_),k/1e3)?Math.round(_):Math.ceil(_));const O=Math.max(Mt(k),Mt(M));y=Math.pow(10,W(h)?O:h),M=Math.round(M*y)/y,w=Math.round(w*y)/y;let S=0;for(p&&(u&&M!==r?(e.push({value:r}),M<r&&S++,mt(Math.round((M+S*k)*y)/y,r,kn(r,v,t))&&S++):M<r&&S++);S<_;++S){const t=Math.round((M+S*k)*y)/y;if(m&&t>o)break;e.push({value:t})}return m&&u&&w!==o?e.length&&mt(e[e.length-1].value,o,kn(o,v,t))?e[e.length-1].value=o:e.push({value:o}):m&&w!==o||e.push({value:w}),e}({maxTicks:e,bounds:t.bounds,min:t.min,max:t.max,precision:i.precision,step:i.stepSize,count:i.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:i.minRotation||0,includeBounds:!1!==i.includeBounds},this._range||this);return"ticks"===t.bounds&&function(t,i){let e,s,n;for(e=0,s=t.length;e<s;e++)n=t[e].value,isNaN(n)||(i.min=Math.min(i.min,n),i.max=Math.max(i.max,n))}(s,this),t.reverse?(s.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),s}configure(){const t=this.ticks;let i=this.min,e=this.max;if(super.configure(),this.options.offset&&t.length){const s=(e-i)/Math.max(t.length-1,1)/2;i-=s,e+=s}this._startValue=i,this._endValue=e,this._valueRange=e-i}getLabelForValue(t){return Vt(t,this.chart.options.locale,this.options.ticks.format)}}Hs.register(tn,class extends de{static id="bar";static defaults={datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}};static overrides={scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}};parsePrimitiveData(t,i,e,s){return ge(t,i,e,s)}parseArrayData(t,i,e,s){return ge(t,i,e,s)}parseObjectData(t,i,e,s){const{iScale:n,vScale:r}=t,{xAxisKey:o="x",yAxisKey:h="y"}=this._parsing,a="x"===n.axis?o:h,c="x"===r.axis?o:h,l=[];let u,f,d,b;for(u=e,f=e+s;u<f;++u)b=i[u],d={},d[n.axis]=n.parse(st(b,a),u),l.push(be(st(b,c),d,r,u));return l}updateRangeFromParsed(t,i,e,s){super.updateRangeFromParsed(t,i,e,s);const n=e._custom;n&&i===this._cachedMeta.vScale&&(t.min=Math.min(t.min,n.min),t.max=Math.max(t.max,n.max))}getMaxOverflow(){return 0}getLabelAndValue(t){const i=this._cachedMeta,{iScale:e,vScale:s}=i,n=this.getParsed(t),r=n._custom,o=pe(r)?"["+r.start+", "+r.end+"]":""+s.getLabelForValue(n[s.axis]);return{label:""+e.getLabelForValue(n[e.axis]),value:o}}initialize(){this.enableOptionSharing=!0,super.initialize(),this._cachedMeta.stack=this.getDataset().stack}update(t){const i=this._cachedMeta;this.updateElements(i.data,0,i.data.length,t)}updateElements(t,i,e,s){const n="reset"===s,{index:r,_cachedMeta:{vScale:o}}=this,h=o.getBasePixel(),a=o.isHorizontal(),c=this._getRuler(),{sharedOptions:l,includeOptions:u}=this._getSharedOptions(i,s);for(let f=i;f<i+e;f++){const i=this.getParsed(f),e=n||W(i[o.axis])?{base:h,head:h}:this._calculateBarValuePixels(f),d=this._calculateBarIndexPixels(f,c),b=(i._stacks||{})[o.axis],g={horizontal:a,base:e.base,enableBorderRadius:!b||pe(i._custom)||r===b._top||r===b._bottom,x:a?e.head:d.center,y:a?d.center:e.head,height:a?d.size:Math.abs(e.size),width:a?Math.abs(e.size):d.size};u&&(g.options=l||this.resolveDataElementOptions(f,t[f].active?"active":s));const p=g.options||t[f].options;me(g,p,b,r),ye(g,p,c.ratio),this.updateElement(t[f],f,g,s)}}_getStacks(t,i){const{iScale:e}=this._cachedMeta,s=e.getMatchingVisibleMetas(this._type).filter((t=>t.controller.options.grouped)),n=e.options.stacked,r=[],o=this._cachedMeta.controller.getParsed(i),h=o&&o[e.axis],a=t=>{const i=t._parsed.find((t=>t[e.axis]===h)),s=i&&i[t.vScale.axis];if(W(s)||isNaN(s))return!0};for(const e of s)if((void 0===i||!a(e))&&((!1===n||-1===r.indexOf(e.stack)||void 0===n&&void 0===e.stack)&&r.push(e.stack),e.index===t))break;return r.length||r.push(void 0),r}_getStackCount(t){return this._getStacks(void 0,t).length}_getAxisCount(){return this._getAxis().length}getFirstScaleIdForIndexAxis(){const t=this.chart.scales,i=this.chart.options.indexAxis;return Object.keys(t).filter((e=>t[e].axis===i)).shift()}_getAxis(){const t={},i=this.getFirstScaleIdForIndexAxis();for(const e of this.chart.data.datasets)t[V("x"===this.chart.options.indexAxis?e.xAxisID:e.yAxisID,i)]=!0;return Object.keys(t)}_getStackIndex(t,i,e){const s=this._getStacks(t,e),n=void 0!==i?s.indexOf(i):-1;return-1===n?s.length-1:n}_getRuler(){const t=this.options,i=this._cachedMeta,e=i.iScale,s=[];let n,r;for(n=0,r=i.data.length;n<r;++n)s.push(e.getPixelForValue(this.getParsed(n)[e.axis],n));const o=t.barThickness,h=o||function(t){const i=t.iScale,e=function(t,i){if(!t._cache.$bar){const e=t.getMatchingVisibleMetas(i);let s=[];for(let i=0,n=e.length;i<n;i++)s=s.concat(e[i].controller.getAllParsedValues(t));t._cache.$bar=function(t){const i=new Set(t);return i.size===t.length?t:Array.from(i)}(s.sort(((t,i)=>t-i)))}return t._cache.$bar}(i,t.type);let s,n,r,o,h=i._length;const a=()=>{32767!==r&&-32768!==r&&(rt(o)&&(h=Math.min(h,Math.abs(r-o)||h)),o=r)};for(s=0,n=e.length;s<n;++s)r=i.getPixelForValue(e[s]),a();for(o=void 0,s=0,n=i.ticks.length;s<n;++s)r=i.getPixelForTick(s),a();return h}(i);return{min:h,pixels:s,start:e._startPixel,end:e._endPixel,stackCount:this._getStackCount(),scale:e,grouped:t.grouped,ratio:o?1:t.categoryPercentage*t.barPercentage}}_calculateBarValuePixels(t){const{_cachedMeta:{vScale:i,_stacked:e,index:s},options:{base:n,minBarLength:r}}=this,o=n||0,h=this.getParsed(t),a=h._custom,c=pe(a);let l,u,f=h[i.axis],d=0,b=e?this.applyStack(i,h,e):f;b!==f&&(d=b-f,b=f),c&&(f=a.barStart,b=a.barEnd-a.barStart,0!==f&&pt(f)!==pt(a.barEnd)&&(d=0),d+=f);const g=W(n)||c?d:n;let p=i.getPixelForValue(g);if(l=this.chart.getDataVisibility(t)?i.getPixelForValue(d+b):p,u=l-p,Math.abs(u)<r){u=function(t,i,e){return 0!==t?pt(t):(i.isHorizontal()?1:-1)*(i.min>=e?1:-1)}(u,i,o)*r,f===o&&(p-=u/2);const t=i.getPixelForDecimal(0),n=i.getPixelForDecimal(1),a=Math.min(t,n),d=Math.max(t,n);p=Math.max(Math.min(p,d),a),l=p+u,e&&!c&&(h._stacks[i.axis]._visualValues[s]=i.getValueForPixel(l)-i.getValueForPixel(p))}if(p===i.getPixelForValue(o)){const t=pt(u)*i.getLineWidthForValue(o)/2;p+=t,u-=t}return{size:u,base:p,head:l,center:l+u/2}}_calculateBarIndexPixels(t,i){const e=i.scale,s=this.options,n=s.skipNull,r=V(s.maxBarThickness,1/0);let o,h;const a=this._getAxisCount();if(i.grouped){const e=n?this._getStackCount(t):i.stackCount,c="flex"===s.barThickness?function(t,i,e,s){const n=i.pixels,r=n[t];let o=t>0?n[t-1]:null,h=t<n.length-1?n[t+1]:null;const a=e.categoryPercentage;null===o&&(o=r-(null===h?i.end-i.start:h-r)),null===h&&(h=r+r-o);const c=r-(r-Math.min(o,h))/2*a;return{chunk:Math.abs(h-o)/2*a/s,ratio:e.barPercentage,start:c}}(t,i,s,e*a):function(t,i,e,s){const n=e.barThickness;let r,o;return W(n)?(r=i.min*e.categoryPercentage,o=e.barPercentage):(r=n*s,o=1),{chunk:r/s,ratio:o,start:i.pixels[t]-r/2}}(t,i,s,e*a),l="x"===this.chart.options.indexAxis?this.getDataset().xAxisID:this.getDataset().yAxisID,u=this._getAxis().indexOf(V(l,this.getFirstScaleIdForIndexAxis())),f=this._getStackIndex(this.index,this._cachedMeta.stack,n?t:void 0)+u;o=c.start+c.chunk*f+c.chunk/2,h=Math.min(r,c.chunk*c.ratio)}else o=e.getPixelForValue(this.getParsed(t)[e.axis],t),h=Math.min(r,i.min*i.ratio);return{base:o-h/2,head:o+h/2,center:o,size:h}}draw(){const t=this._cachedMeta,i=t.vScale,e=t.data,s=e.length;let n=0;for(;n<s;++n)null===this.getParsed(n)[i.axis]||e[n].hidden||e[n].draw(this._ctx)}},class extends ns{static id="bar";static defaults={borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(t){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,t&&Object.assign(this,t)}draw(t){const{inflateAmount:i,options:{borderColor:e,backgroundColor:s}}=this,{inner:n,outer:r}=function(t){const i=Ys(t),e=i.right-i.left,s=i.bottom-i.top,n=function(t,i,e){const s=t.borderSkipped,n=gi(t.options.borderWidth);return{t:Vs(s.top,n.top,0,e),r:Vs(s.right,n.right,0,i),b:Vs(s.bottom,n.bottom,0,e),l:Vs(s.left,n.left,0,i)}}(t,e/2,s/2),r=function(t,i,e){const{enableBorderRadius:s}=t.getProps(["enableBorderRadius"]),n=t.options.borderRadius,r=pi(n),o=Math.min(i,e),h=t.borderSkipped,a=s||H(n);return{topLeft:Vs(!a||h.top||h.left,r.topLeft,0,o),topRight:Vs(!a||h.top||h.right,r.topRight,0,o),bottomLeft:Vs(!a||h.bottom||h.left,r.bottomLeft,0,o),bottomRight:Vs(!a||h.bottom||h.right,r.bottomRight,0,o)}}(t,e/2,s/2);return{outer:{x:i.left,y:i.top,w:e,h:s,radius:r},inner:{x:i.left+n.l,y:i.top+n.t,w:e-n.l-n.r,h:s-n.t-n.b,radius:{topLeft:Math.max(0,r.topLeft-Math.max(n.t,n.l)),topRight:Math.max(0,r.topRight-Math.max(n.t,n.r)),bottomLeft:Math.max(0,r.bottomLeft-Math.max(n.b,n.l)),bottomRight:Math.max(0,r.bottomRight-Math.max(n.b,n.r))}}}}(this),o=(h=r.radius).topLeft||h.topRight||h.bottomLeft||h.bottomRight?li:Us;var h;t.save(),r.w===n.w&&r.h===n.h||(t.beginPath(),o(t,Zs(r,i,n)),t.clip(),o(t,Zs(n,-i,r)),t.fillStyle=e,t.fill("evenodd")),t.beginPath(),o(t,Zs(n,i)),t.fillStyle=s,t.fill(),t.restore()}inRange(t,i,e){return Xs(this,t,i,e)}inXRange(t,i){return Xs(this,t,null,i)}inYRange(t,i){return Xs(this,null,t,i)}getCenterPoint(t){const{x:i,y:e,base:s,horizontal:n}=this.getProps(["x","y","base","horizontal"],t);return{x:n?(i+s)/2:i,y:n?e:(e+s)/2}}getRange(t){return"x"===t?this.width/2:this.height/2}},class extends ds{static id="category";static defaults={ticks:{callback:_n}};constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){const i=this._addedLabels;if(i.length){const t=this.getLabels();for(const{index:e,label:s}of i)t[e]===s&&t.splice(e,1);this._addedLabels=[]}super.init(t)}parse(t,i){if(W(t))return null;const e=this.getLabels();return((t,i)=>null===t?null:kt(Math.round(t),0,i))(i=isFinite(i)&&e[i]===t?i:function(t,i,e,s){const n=t.indexOf(i);return-1===n?((t,i,e,s)=>("string"==typeof i?(e=t.push(i)-1,s.unshift({index:e,label:i})):isNaN(i)&&(e=null),e))(t,i,e,s):n!==t.lastIndexOf(i)?e:n}(e,t,V(i,t),this._addedLabels),e.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:i}=this.getUserBounds();let{min:e,max:s}=this.getMinMax(!0);"ticks"===this.options.bounds&&(t||(e=0),i||(s=this.getLabels().length-1)),this.min=e,this.max=s}buildTicks(){const t=this.min,i=this.max,e=this.options.offset,s=[];let n=this.getLabels();n=0===t&&i===n.length-1?n:n.slice(t,i+1),this._valueRange=Math.max(n.length-(e?0:1),1),this._startValue=this.min-(e?.5:0);for(let e=t;e<=i;e++)s.push({value:e});return s}getLabelForValue(t){return _n.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return"number"!=typeof t&&(t=this.parse(t)),null===t?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){const i=this.ticks;return t<0||t>i.length-1?null:this.getPixelForValue(i[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}},class extends On{static id="linear";static defaults={ticks:{callback:Xt.formatters.numeric}};determineDataLimits(){const{min:t,max:i}=this.getMinMax(!0);this.min=$(t)?t:0,this.max=$(i)?i:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),i=t?this.width:this.height,e=yt(this.options.ticks.minRotation),s=(t?Math.sin(e):Math.cos(e))||.001,n=this._resolveTickFontOptions(0);return Math.ceil(i/Math.min(40,n.lineHeight/s))}getPixelForValue(t){return null===t?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}},rn,wn,hn);const Sn=class{constructor(e){t(this,e),this.errorEvent=i(this,"error-event"),this.loading=!0,this.errorMessage=""}componentDidLoad(){this.getGrossPayment&&this.fetchData()}propChanged(){this.getGrossPayment&&this.fetchData()}grossVolumeReportChanged(t){t&&(this.chart?this.updateChartData(t):this.initChart(t))}async fetchData(){this.loading=!0,this.getGrossPayment({onSuccess:t=>{this.loading=!1,this.grossVolumeReport=t},onError:({error:t,code:i,severity:e})=>{this.loading=!1,this.errorMessage=t,this.errorEvent.emit({errorCode:i,message:t,severity:e})}})}initChart(t){const{dates:i,total:e}=t,s=i.reverse(),o=((t,i,e)=>({type:"bar",options:{plugins:{legend:{display:!1},title:{display:!0,text:["Trailing 30 Days","Gross Payments",n(t)],position:"top",align:"start"},tooltip:{displayColors:!1,intersect:!1,callbacks:{label:t=>{let s=t.dataIndex;return[r(i[s].date,e),n(i[s].value)]}}}},scales:{x:{grid:{drawOnChartArea:!1,drawTicks:!1},ticks:{callback:t=>{if(0===t||t===i.length-1)return r(i[t].date,e)}}},y:{display:!1}}},data:{labels:i.map((()=>"")),datasets:[{label:"Gross Volume by Date",data:i.map((t=>t.value))}]}}))(e,s,s[i.length-1].date);this.chart=new Hs(this.chartRef.getContext("2d"),o)}updateChartData(t){const i=t.dates.map((t=>t.value));this.chart.data.datasets.forEach((t=>{t.data=i})),this.chart.update()}disconnectedCallback(){this.chart&&this.chart.destroy()}render(){return e(s,{key:"b336dc186a34b6624d415cb072819b4dfe10620f"},this.loading&&e(h,{key:"5a2ca3c4efd9f5acd2bac804490877654d44b39c"}),this.errorMessage?o(this.errorMessage):e("canvas",{id:"chart",ref:t=>this.chartRef=t}))}static get watchers(){return{getGrossPayment:["propChanged"],grossVolumeReport:["grossVolumeReportChanged"]}}};export{Sn as gross_payment_chart_core}
20
+ class Qi{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,i,e,s){const n=i.duration;i.listeners[s].forEach((s=>s({chart:t,initial:i.initial,numSteps:n,currentStep:Math.min(e-i.start,n)})))}_refresh(){this._request||(this._running=!0,this._request=Ct.call(window,(()=>{this._update(),this._request=null,this._running&&this._refresh()})))}_update(t=Date.now()){let i=0;this._charts.forEach(((e,s)=>{if(!e.running||!e.items.length)return;const n=e.items;let r,o=n.length-1,h=!1;for(;o>=0;--o)r=n[o],r._active?(r._total>e.duration&&(e.duration=r._total),r.tick(t),h=!0):(n[o]=n[n.length-1],n.pop());h&&(s.draw(),this._notify(s,e,t,"progress")),n.length||(e.running=!1,this._notify(s,e,t,"complete"),e.initial=!1),i+=n.length})),this._lastDate=t,0===i&&(this._running=!1)}_getAnims(t){const i=this._charts;let e=i.get(t);return e||(e={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},i.set(t,e)),e}listen(t,i,e){this._getAnims(t).listeners[i].push(e)}add(t,i){i&&i.length&&this._getAnims(t).items.push(...i)}has(t){return this._getAnims(t).items.length>0}start(t){const i=this._charts.get(t);i&&(i.running=!0,i.start=Date.now(),i.duration=i.items.reduce(((t,i)=>Math.max(t,i._duration)),0),this._refresh())}running(t){if(!this._running)return!1;const i=this._charts.get(t);return!!(i&&i.running&&i.items.length)}stop(t){const i=this._charts.get(t);if(!i||!i.items.length)return;const e=i.items;let s=e.length-1;for(;s>=0;--s)e[s].cancel();i.items=[],this._notify(t,i,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var qi=new Qi;const Gi="transparent",Ji={boolean:(t,i,e)=>e>.5?i:t,color(t,i,e){const s=Wt(t||Gi),n=s.valid&&Wt(i||Gi);return n&&n.valid?n.mix(s,e).hexString():i},number:(t,i,e)=>t+(i-t)*e};class te{constructor(t,i,e,s){const n=i[e];s=vi([t.to,s,n,t.from]);const r=vi([t.from,n,s]);this._active=!0,this._fn=t.fn||Ji[t.type||typeof r],this._easing=Bt[t.easing]||Bt.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=i,this._prop=e,this._from=r,this._to=s,this._promises=void 0}active(){return this._active}update(t,i,e){if(this._active){this._notify(!1);const s=this._target[this._prop],n=e-this._start,r=this._duration-n;this._start=e,this._duration=Math.floor(Math.max(r,t.duration)),this._total+=n,this._loop=!!t.loop,this._to=vi([t.to,i,s,t.from]),this._from=vi([t.from,s,i])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const i=t-this._start,e=this._duration,s=this._prop,n=this._from,r=this._loop,o=this._to;let h;if(this._active=n!==o&&(r||i<e),!this._active)return this._target[s]=o,void this._notify(!0);i<0?this._target[s]=n:(h=i/e%2,h=r&&h>1?2-h:h,h=this._easing(Math.min(1,Math.max(0,h))),this._target[s]=this._fn(n,o,h))}wait(){const t=this._promises||(this._promises=[]);return new Promise(((i,e)=>{t.push({res:i,rej:e})}))}_notify(t){const i=t?"res":"rej",e=this._promises||[];for(let t=0;t<e.length;t++)e[t][i]()}}class ie{constructor(t,i){this._chart=t,this._properties=new Map,this.configure(i)}configure(t){if(!H(t))return;const i=Object.keys(Gt.animation),e=this._properties;Object.getOwnPropertyNames(t).forEach((s=>{const n=t[s];if(!H(n))return;const r={};for(const t of i)r[t]=n[t];(z(n.properties)&&n.properties||[s]).forEach((t=>{t!==s&&e.has(t)||e.set(t,r)}))}))}_animateOptions(t,i){const e=i.options,s=function(t,i){if(!i)return;let e=t.options;if(e)return e.$shared&&(t.options=e=Object.assign({},e,{$shared:!1,$animations:{}})),e;t.options=i}(t,e);if(!s)return[];const n=this._createAnimations(s,e);return e.$shared&&function(t,i){const e=[],s=Object.keys(i);for(let i=0;i<s.length;i++){const n=t[s[i]];n&&n.active()&&e.push(n.wait())}return Promise.all(e)}(t.options.$animations,e).then((()=>{t.options=e}),(()=>{})),n}_createAnimations(t,i){const e=this._properties,s=[],n=t.$animations||(t.$animations={}),r=Object.keys(i),o=Date.now();let h;for(h=r.length-1;h>=0;--h){const a=r[h];if("$"===a.charAt(0))continue;if("options"===a){s.push(...this._animateOptions(t,i));continue}const c=i[a];let l=n[a];const u=e.get(a);if(l){if(u&&l.active()){l.update(u,c,o);continue}l.cancel()}u&&u.duration?(n[a]=l=new te(u,t,a,c),s.push(l)):t[a]=c}return s}update(t,i){if(0===this._properties.size)return void Object.assign(t,i);const e=this._createAnimations(t,i);return e.length?(qi.add(this._chart,e),!0):void 0}}function ee(t,i){const e=t&&t.options||{},s=e.reverse,n=void 0===e.min?i:0,r=void 0===e.max?i:0;return{start:s?r:n,end:s?n:r}}function se(t,i){const e=[],s=t._getSortedDatasetMetas(i);let n,r;for(n=0,r=s.length;n<r;++n)e.push(s[n].index);return e}function ne(t,i,e,s={}){const n=t.keys,r="single"===s.mode;let o,h,a,c;if(null===i)return;let l=!1;for(o=0,h=n.length;o<h;++o){if(a=+n[o],a===e){if(l=!0,s.all)continue;break}c=t.values[a],$(c)&&(r||0===i||pt(i)===pt(c))&&(i+=c)}return l||s.all?i:0}function re(t,i){const e=t&&t.options.stacked;return e||void 0===e&&void 0!==i.stack}function oe(t,i,e){const s=t[i]||(t[i]={});return s[e]||(s[e]={})}function he(t,i,e,s){for(const n of i.getMatchingVisibleMetas(s).reverse()){const i=t[n.index];if(e&&i>0||!e&&i<0)return n.index}return null}function ae(t,i){const{chart:e,_cachedMeta:s}=t,n=e._stacks||(e._stacks={}),{iScale:r,vScale:o,index:h}=s,a=r.axis,c=o.axis,l=function(t,i,e){return`${t.id}.${i.id}.${e.stack||e.type}`}(r,o,s),u=i.length;let f;for(let t=0;t<u;++t){const e=i[t],{[a]:r,[c]:u}=e;f=(e._stacks||(e._stacks={}))[c]=oe(n,l,r),f[h]=u,f._top=he(f,o,!0,s.type),f._bottom=he(f,o,!1,s.type),(f._visualValues||(f._visualValues={}))[h]=u}}function ce(t,i){const e=t.scales;return Object.keys(e).filter((t=>e[t].axis===i)).shift()}function le(t,i){const e=t.controller.index,s=t.vScale&&t.vScale.axis;if(s){i=i||t._parsed;for(const t of i){const i=t._stacks;if(!i||void 0===i[s]||void 0===i[s][e])return;delete i[s][e],void 0!==i[s]._visualValues&&void 0!==i[s]._visualValues[e]&&delete i[s]._visualValues[e]}}}const ue=t=>"reset"===t||"none"===t,fe=(t,i)=>i?t:Object.assign({},t);class de{static defaults={};static datasetElementType=null;static dataElementType=null;constructor(t,i){this.chart=t,this._ctx=t.ctx,this.index=i,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.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=re(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&le(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,i=this._cachedMeta,e=this.getDataset(),s=(t,i,e,s)=>"x"===t?i:"r"===t?s:e,n=i.xAxisID=V(e.xAxisID,ce(t,"x")),r=i.yAxisID=V(e.yAxisID,ce(t,"y")),o=i.rAxisID=V(e.rAxisID,ce(t,"r")),h=i.indexAxis,a=i.iAxisID=s(h,n,r,o),c=i.vAxisID=s(h,r,n,o);i.xScale=this.getScaleForId(n),i.yScale=this.getScaleForId(r),i.rScale=this.getScaleForId(o),i.iScale=this.getScaleForId(a),i.vScale=this.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){const i=this._cachedMeta;return t===i.iScale?i.vScale:i.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&Rt(this._data,this),t._stacked&&le(t)}_dataCheck(){const t=this.getDataset(),i=t.data||(t.data=[]),e=this._data;if(H(i))this._data=function(t,i){const{iScale:e,vScale:s}=i,n="x"===e.axis?"x":"y",r="x"===s.axis?"x":"y",o=Object.keys(t),h=new Array(o.length);let a,c,l;for(a=0,c=o.length;a<c;++a)l=o[a],h[a]={[n]:l,[r]:t[l]};return h}(i,this._cachedMeta);else if(e!==i){if(e){Rt(e,this);const t=this._cachedMeta;le(t),t._parsed=[]}i&&Object.isExtensible(i)&&((s=i)._chartjs?s._chartjs.listeners.push(this):(Object.defineProperty(s,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[this]}}),jt.forEach((t=>{const i="_onData"+nt(t),e=s[t];Object.defineProperty(s,t,{configurable:!0,enumerable:!1,value(...t){const n=e.apply(this,t);return s._chartjs.listeners.forEach((e=>{"function"==typeof e[i]&&e[i](...t)})),n}})})))),this._syncList=[],this._data=i}var s}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const i=this._cachedMeta,e=this.getDataset();let s=!1;this._dataCheck();const n=i._stacked;i._stacked=re(i.vScale,i),i.stack!==e.stack&&(s=!0,le(i),i.stack=e.stack),this._resyncElements(t),(s||n!==i._stacked)&&(ae(this,i._parsed),i._stacked=re(i.vScale,i))}configure(){const t=this.chart.config,i=t.datasetScopeKeys(this._type),e=t.getOptionScopes(this.getDataset(),i,!0);this.options=t.createResolver(e,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,i){const{_cachedMeta:e,_data:s}=this,{iScale:n,_stacked:r}=e,o=n.axis;let h,a,c,l=0===t&&i===s.length||e._sorted,u=t>0&&e._parsed[t-1];if(!1===this._parsing)e._parsed=s,e._sorted=!0,c=s;else{c=z(s[t])?this.parseArrayData(e,s,t,i):H(s[t])?this.parseObjectData(e,s,t,i):this.parsePrimitiveData(e,s,t,i);const n=()=>null===a[o]||u&&a[o]<u[o];for(h=0;h<i;++h)e._parsed[h+t]=a=c[h],l&&(n()&&(l=!1),u=a);e._sorted=l}r&&ae(this,c)}parsePrimitiveData(t,i,e,s){const{iScale:n,vScale:r}=t,o=n.axis,h=r.axis,a=n.getLabels(),c=n===r,l=new Array(s);let u,f,d;for(u=0,f=s;u<f;++u)d=u+e,l[u]={[o]:c||n.parse(a[d],d),[h]:r.parse(i[d],d)};return l}parseArrayData(t,i,e,s){const{xScale:n,yScale:r}=t,o=new Array(s);let h,a,c,l;for(h=0,a=s;h<a;++h)c=h+e,l=i[c],o[h]={x:n.parse(l[0],c),y:r.parse(l[1],c)};return o}parseObjectData(t,i,e,s){const{xScale:n,yScale:r}=t,{xAxisKey:o="x",yAxisKey:h="y"}=this._parsing,a=new Array(s);let c,l,u,f;for(c=0,l=s;c<l;++c)u=c+e,f=i[u],a[c]={x:n.parse(st(f,o),u),y:r.parse(st(f,h),u)};return a}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,i,e){const s=this._cachedMeta,n=i[t.axis];return ne({keys:se(this.chart,!0),values:i._stacks[t.axis]._visualValues},n,s.index,{mode:e})}updateRangeFromParsed(t,i,e,s){const n=e[i.axis];let r=null===n?NaN:n;const o=s&&e._stacks[i.axis];s&&o&&(s.values=o,r=ne(s,n,this._cachedMeta.index)),t.min=Math.min(t.min,r),t.max=Math.max(t.max,r)}getMinMax(t,i){const e=this._cachedMeta,s=e._parsed,n=e._sorted&&t===e.iScale,r=s.length,o=this._getOtherScale(t),h=((t,i)=>t&&!i.hidden&&i._stacked&&{keys:se(this.chart,!0),values:null})(i,e),a={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:c,max:l}=function(t){const{min:i,max:e,minDefined:s,maxDefined:n}=t.getUserBounds();return{min:s?i:Number.NEGATIVE_INFINITY,max:n?e:Number.POSITIVE_INFINITY}}(o);let u,f;function d(){f=s[u];const i=f[o.axis];return!$(f[t.axis])||c>i||l<i}for(u=0;u<r&&(d()||(this.updateRangeFromParsed(a,t,f,h),!n));++u);if(n)for(u=r-1;u>=0;--u)if(!d()){this.updateRangeFromParsed(a,t,f,h);break}return a}getAllParsedValues(t){const i=this._cachedMeta._parsed,e=[];let s,n,r;for(s=0,n=i.length;s<n;++s)r=i[s][t.axis],$(r)&&e.push(r);return e}getMaxOverflow(){return!1}getLabelAndValue(t){const i=this._cachedMeta,e=i.iScale,s=i.vScale,n=this.getParsed(t);return{label:e?""+e.getLabelForValue(n[e.axis]):"",value:s?""+s.getLabelForValue(n[s.axis]):""}}_update(t){const i=this._cachedMeta;this.update(t||"default"),i._clip=function(t){let i,e,s,n;return H(t)?(i=t.top,e=t.right,s=t.bottom,n=t.left):i=e=s=n=t,{top:i,right:e,bottom:s,left:n,disabled:!1===t}}(V(this.options.clip,function(t,i,e){if(!1===e)return!1;const s=ee(t,e),n=ee(i,e);return{top:n.end,right:s.end,bottom:n.start,left:s.start}}(i.xScale,i.yScale,this.getMaxOverflow())))}update(t){}draw(){const t=this._ctx,i=this._cachedMeta,e=i.data||[],s=this.chart.chartArea,n=[],r=this._drawStart||0,o=this._drawCount||e.length-r,h=this.options.drawActiveElementsOnTop;let a;for(i.dataset&&i.dataset.draw(t,s,r,o),a=r;a<r+o;++a){const i=e[a];i.hidden||(i.active&&h?n.push(i):i.draw(t,s))}for(a=0;a<n.length;++a)n[a].draw(t,s)}getStyle(t,i){const e=i?"active":"default";return void 0===t&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(e):this.resolveDataElementOptions(t||0,e)}getContext(t,i,e){const s=this.getDataset();let n;if(t>=0&&t<this._cachedMeta.data.length){const i=this._cachedMeta.data[t];n=i.$context||(i.$context=function(t,i,e){return yi(t,{active:!1,dataIndex:i,parsed:void 0,raw:void 0,element:e,index:i,mode:"default",type:"data"})}(this.getContext(),t,i)),n.parsed=this.getParsed(t),n.raw=s.data[t],n.index=n.dataIndex=t}else n=this.$context||(this.$context=function(t,i){return yi(t,{active:!1,dataset:void 0,datasetIndex:i,index:i,mode:"default",type:"dataset"})}(this.chart.getContext(),this.index)),n.dataset=s,n.index=n.datasetIndex=this.index;return n.active=!!i,n.mode=e,n}resolveDatasetElementOptions(t){return this._resolveElementOptions(this.datasetElementType.id,t)}resolveDataElementOptions(t,i){return this._resolveElementOptions(this.dataElementType.id,i,t)}_resolveElementOptions(t,i="default",e){const s="active"===i,n=this._cachedDataOpts,r=t+"-"+i,o=n[r],h=this.enableOptionSharing&&rt(e);if(o)return fe(o,h);const a=this.chart.config,c=a.datasetElementScopeKeys(this._type,t),l=s?[`${t}Hover`,"hover",t,""]:[t,""],u=a.getOptionScopes(this.getDataset(),c),f=Object.keys(Gt.elements[t]),d=a.resolveNamedOptions(u,f,(()=>this.getContext(e,s,i)),l);return d.$shared&&(d.$shared=h,n[r]=Object.freeze(fe(d,h))),d}_resolveAnimations(t,i,e){const s=this.chart,n=this._cachedDataOpts,r=`animation-${i}`,o=n[r];if(o)return o;let h;if(!1!==s.options.animation){const s=this.chart.config,n=s.datasetAnimationScopeKeys(this._type,i),r=s.getOptionScopes(this.getDataset(),n);h=s.createResolver(r,this.getContext(t,e,i))}const a=new ie(s,h&&h.animations);return h&&h._cacheable&&(n[r]=Object.freeze(a)),a}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,i){return!i||ue(t)||this.chart._animationsDisabled}_getSharedOptions(t,i){const e=this.resolveDataElementOptions(t,i),s=this._sharedOptions,n=this.getSharedOptions(e),r=this.includeOptions(i,n)||n!==s;return this.updateSharedOptions(n,i,e),{sharedOptions:n,includeOptions:r}}updateElement(t,i,e,s){ue(s)?Object.assign(t,e):this._resolveAnimations(i,s).update(t,e)}updateSharedOptions(t,i,e){t&&!ue(i)&&this._resolveAnimations(void 0,i).update(t,e)}_setStyle(t,i,e,s){t.active=s;const n=this.getStyle(i,s);this._resolveAnimations(i,e,s).update(t,{options:!s&&this.getSharedOptions(n)||n})}removeHoverStyle(t,i,e){this._setStyle(t,e,"active",!1)}setHoverStyle(t,i,e){this._setStyle(t,e,"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 i=this._data,e=this._cachedMeta.data;for(const[t,i,e]of this._syncList)this[t](i,e);this._syncList=[];const s=e.length,n=i.length,r=Math.min(n,s);r&&this.parse(0,r),n>s?this._insertElements(s,n-s,t):n<s&&this._removeElements(n,s-n)}_insertElements(t,i,e=!0){const s=this._cachedMeta,n=s.data,r=t+i;let o;const h=t=>{for(t.length+=i,o=t.length-1;o>=r;o--)t[o]=t[o-i]};for(h(n),o=t;o<r;++o)n[o]=new this.dataElementType;this._parsing&&h(s._parsed),this.parse(t,i),e&&this.updateElements(n,t,i,"reset")}updateElements(t,i,e,s){}_removeElements(t,i){const e=this._cachedMeta;if(this._parsing){const s=e._parsed.splice(t,i);e._stacked&&le(e,s)}e.data.splice(t,i)}_sync(t){if(this._parsing)this._syncList.push(t);else{const[i,e,s]=t;this[i](e,s)}this.chart._dataChanges.push([this.index,...t])}_onDataPush(){const t=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-t,t])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(t,i){i&&this._sync(["_removeElements",t,i]);const e=arguments.length-2;e&&this._sync(["_insertElements",t,e])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}function be(t,i,e,s){return z(t)?function(t,i,e,s){const n=e.parse(t[0],s),r=e.parse(t[1],s),o=Math.min(n,r),h=Math.max(n,r);let a=o,c=h;Math.abs(o)>Math.abs(h)&&(a=h,c=o),i[e.axis]=c,i._custom={barStart:a,barEnd:c,start:n,end:r,min:o,max:h}}(t,i,e,s):i[e.axis]=e.parse(t,s),i}function ge(t,i,e,s){const n=t.iScale,r=t.vScale,o=n.getLabels(),h=n===r,a=[];let c,l,u,f;for(c=e,l=e+s;c<l;++c)f=i[c],u={},u[n.axis]=h||n.parse(o[c],c),a.push(be(f,u,r,c));return a}function pe(t){return t&&void 0!==t.barStart&&void 0!==t.barEnd}function me(t,i,e,s){let n=i.borderSkipped;const r={};if(!n)return void(t.borderSkipped=r);if(!0===n)return void(t.borderSkipped={top:!0,right:!0,bottom:!0,left:!0});const{start:o,end:h,reverse:a,top:c,bottom:l}=function(t){let i,e,s,n,r;return t.horizontal?(i=t.base>t.x,e="left",s="right"):(i=t.base<t.y,e="bottom",s="top"),i?(n="end",r="start"):(n="start",r="end"),{start:e,end:s,reverse:i,top:n,bottom:r}}(t);"middle"===n&&e&&(t.enableBorderRadius=!0,(e._top||0)===s?n=c:(e._bottom||0)===s?n=l:(r[xe(l,o,h,a)]=!0,n=c)),r[xe(n,o,h,a)]=!0,t.borderSkipped=r}function xe(t,i,e,s){var n,r,o;return s?(o=e,t=ve(t=(n=t)===(r=i)?o:n===o?r:n,e,i)):t=ve(t,i,e),t}function ve(t,i,e){return"start"===t?i:"end"===t?e:t}function ye(t,{inflateAmount:i},e){t.inflateAmount="auto"===i?1===e?.33:0:i}class Me extends de{static id="doughnut";static defaults={datasetElementType:!1,dataElementType:"arc",animation:{animateRotate:!0,animateScale:!1},animations:{numbers:{type:"number",properties:["circumference","endAngle","innerRadius","outerRadius","startAngle","x","y","offset","borderWidth","spacing"]}},cutout:"50%",rotation:0,circumference:360,radius:"100%",spacing:0,indexAxis:"r"};static descriptors={_scriptable:t=>"spacing"!==t,_indexable:t=>"spacing"!==t&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const i=t.data,{labels:{pointStyle:e,textAlign:s,color:n,useBorderRadius:r,borderRadius:o}}=t.legend.options;return i.labels.length&&i.datasets.length?i.labels.map(((i,h)=>{const a=t.getDatasetMeta(0).controller.getStyle(h);return{text:i,fillStyle:a.backgroundColor,fontColor:n,hidden:!t.getDataVisibility(h),lineDash:a.borderDash,lineDashOffset:a.borderDashOffset,lineJoin:a.borderJoinStyle,lineWidth:a.borderWidth,strokeStyle:a.borderColor,textAlign:s,pointStyle:e,borderRadius:r&&(o||a.borderRadius),index:h}})):[]}},onClick(t,i,e){e.chart.toggleDataVisibility(i.index),e.chart.update()}}}};constructor(t,i){super(t,i),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,i){const e=this.getDataset().data,s=this._cachedMeta;if(!1===this._parsing)s._parsed=e;else{let n,r,o=t=>+e[t];if(H(e[t])){const{key:t="value"}=this._parsing;o=i=>+st(e[i],t)}for(n=t,r=t+i;n<r;++n)s._parsed[n]=o(n)}}_getRotation(){return yt(this.options.rotation-90)}_getCircumference(){return yt(this.options.circumference)}_getRotationExtents(){let t=ct,i=-ct;for(let e=0;e<this.chart.data.datasets.length;++e)if(this.chart.isDatasetVisible(e)&&this.chart.getDatasetMeta(e).type===this._type){const s=this.chart.getDatasetMeta(e).controller,n=s._getRotation(),r=s._getCircumference();t=Math.min(t,n),i=Math.max(i,n+r)}return{rotation:t,circumference:i-t}}update(t){const i=this.chart,{chartArea:e}=i,s=this._cachedMeta,n=s.data,r=this.getMaxBorderWidth()+this.getMaxOffset(n)+this.options.spacing,o=Math.max((Math.min(e.width,e.height)-r)/2,0),h=Math.min((c=o,"string"==typeof(a=this.options.cutout)&&a.endsWith("%")?parseFloat(a)/100:+a/c),1);var a,c;const l=this._getRingWeight(this.index),{circumference:u,rotation:f}=this._getRotationExtents(),{ratioX:d,ratioY:b,offsetX:g,offsetY:p}=function(t,i,e){let s=1,n=1,r=0,o=0;if(i<ct){const h=t,a=h+i,c=Math.cos(h),l=Math.sin(h),u=Math.cos(a),f=Math.sin(a),d=(t,i,s)=>_t(t,h,a,!0)?1:Math.max(i,i*e,s,s*e),b=(t,i,s)=>_t(t,h,a,!0)?-1:Math.min(i,i*e,s,s*e),g=d(0,c,u),p=d(ft,l,f),m=b(at,c,u),x=b(at+ft,l,f);s=(g-m)/2,n=(p-x)/2,r=-(g+m)/2,o=-(p+x)/2}return{ratioX:s,ratioY:n,offsetX:r,offsetY:o}}(f,u,h),m=Math.max(Math.min((e.width-r)/d,(e.height-r)/b)/2,0),x=X(this.options.radius,m),v=(x-Math.max(x*h,0))/this._getVisibleDatasetWeightTotal();this.offsetX=g*x,this.offsetY=p*x,s.total=this.calculateTotal(),this.outerRadius=x-v*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-v*l,0),this.updateElements(n,0,n.length,t)}_circumference(t,i){const e=this.options,s=this._cachedMeta,n=this._getCircumference();return i&&e.animation.animateRotate||!this.chart.getDataVisibility(t)||null===s._parsed[t]||s.data[t].hidden?0:this.calculateCircumference(s._parsed[t]*n/ct)}updateElements(t,i,e,s){const n="reset"===s,r=this.chart,o=r.chartArea,h=(o.left+o.right)/2,a=(o.top+o.bottom)/2,c=n&&r.options.animation.animateScale,l=c?0:this.innerRadius,u=c?0:this.outerRadius,{sharedOptions:f,includeOptions:d}=this._getSharedOptions(i,s);let b,g=this._getRotation();for(b=0;b<i;++b)g+=this._circumference(b,n);for(b=i;b<i+e;++b){const i=this._circumference(b,n),e=t[b],r={x:h+this.offsetX,y:a+this.offsetY,startAngle:g,endAngle:g+i,circumference:i,outerRadius:u,innerRadius:l};d&&(r.options=f||this.resolveDataElementOptions(b,e.active?"active":s)),g+=i,this.updateElement(e,b,r,s)}}calculateTotal(){const t=this._cachedMeta,i=t.data;let e,s=0;for(e=0;e<i.length;e++){const n=t._parsed[e];null===n||isNaN(n)||!this.chart.getDataVisibility(e)||i[e].hidden||(s+=Math.abs(n))}return s}calculateCircumference(t){const i=this._cachedMeta.total;return i>0&&!isNaN(t)?ct*(Math.abs(t)/i):0}getLabelAndValue(t){const i=this.chart,e=i.data.labels||[],s=Vt(this._cachedMeta._parsed[t],i.options.locale);return{label:e[t]||"",value:s}}getMaxBorderWidth(t){let i=0;const e=this.chart;let s,n,r,o,h;if(!t)for(s=0,n=e.data.datasets.length;s<n;++s)if(e.isDatasetVisible(s)){r=e.getDatasetMeta(s),t=r.data,o=r.controller;break}if(!t)return 0;for(s=0,n=t.length;s<n;++s)h=o.resolveDataElementOptions(s),"inner"!==h.borderAlign&&(i=Math.max(i,h.borderWidth||0,h.hoverBorderWidth||0));return i}getMaxOffset(t){let i=0;for(let e=0,s=t.length;e<s;++e){const t=this.resolveDataElementOptions(e);i=Math.max(i,t.offset||0,t.hoverOffset||0)}return i}_getRingWeightOffset(t){let i=0;for(let e=0;e<t;++e)this.chart.isDatasetVisible(e)&&(i+=this._getRingWeight(e));return i}_getRingWeight(t){return Math.max(V(this.chart.data.datasets[t].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}class we extends de{static id="polarArea";static defaults={dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const i=t.data;if(i.labels.length&&i.datasets.length){const{labels:{pointStyle:e,color:s}}=t.legend.options;return i.labels.map(((i,n)=>{const r=t.getDatasetMeta(0).controller.getStyle(n);return{text:i,fillStyle:r.backgroundColor,strokeStyle:r.borderColor,fontColor:s,lineWidth:r.borderWidth,pointStyle:e,hidden:!t.getDataVisibility(n),index:n}}))}return[]}},onClick(t,i,e){e.chart.toggleDataVisibility(i.index),e.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}};constructor(t,i){super(t,i),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){const i=this.chart,e=i.data.labels||[],s=Vt(this._cachedMeta._parsed[t].r,i.options.locale);return{label:e[t]||"",value:s}}parseObjectData(t,i,e,s){return Pi.bind(this)(t,i,e,s)}update(t){const i=this._cachedMeta.data;this._updateRadius(),this.updateElements(i,0,i.length,t)}getMinMax(){const t={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return this._cachedMeta.data.forEach(((i,e)=>{const s=this.getParsed(e).r;!isNaN(s)&&this.chart.getDataVisibility(e)&&(s<t.min&&(t.min=s),s>t.max&&(t.max=s))})),t}_updateRadius(){const t=this.chart,i=t.chartArea,e=t.options,s=Math.min(i.right-i.left,i.bottom-i.top),n=Math.max(s/2,0),r=(n-Math.max(e.cutoutPercentage?n/100*e.cutoutPercentage:1,0))/t.getVisibleDatasetCount();this.outerRadius=n-r*this.index,this.innerRadius=this.outerRadius-r}updateElements(t,i,e,s){const n="reset"===s,r=this.chart,o=r.options.animation,h=this._cachedMeta.rScale,a=h.xCenter,c=h.yCenter,l=h.getIndexAngle(0)-.5*at;let u,f=l;const d=360/this.countVisibleElements();for(u=0;u<i;++u)f+=this._computeAngle(u,s,d);for(u=i;u<i+e;u++){const i=t[u];let e=f,b=f+this._computeAngle(u,s,d),g=r.getDataVisibility(u)?h.getDistanceFromCenterForValue(this.getParsed(u).r):0;f=b,n&&(o.animateScale&&(g=0),o.animateRotate&&(e=b=l));const p={x:a,y:c,innerRadius:0,outerRadius:g,startAngle:e,endAngle:b,options:this.resolveDataElementOptions(u,i.active?"active":s)};this.updateElement(i,u,p,s)}}countVisibleElements(){let t=0;return this._cachedMeta.data.forEach(((i,e)=>{!isNaN(this.getParsed(e).r)&&this.chart.getDataVisibility(e)&&t++})),t}_computeAngle(t,i,e){return this.chart.getDataVisibility(t)?yt(this.resolveDataElementOptions(t,i).angle||e):0}}function _e(t,i,e,s){const{controller:n,data:r,_sorted:o}=t,h=n._cachedMeta.iScale,a=t.dataset&&t.dataset.options?t.dataset.options.spanGaps:null;if(h&&i===h.axis&&"r"!==i&&o&&r.length){const o=h._reversePixels?Dt:At;if(!s){const s=o(r,i,e);if(a){const{vScale:i}=n._cachedMeta,{_parsed:e}=t,r=e.slice(0,s.lo+1).reverse().findIndex((t=>!W(t[i.axis])));s.lo-=Math.max(0,r);const o=e.slice(s.hi).findIndex((t=>!W(t[i.axis])));s.hi+=Math.max(0,o)}return s}if(n._sharedOptions){const t=r[0],s="function"==typeof t.getRange&&t.getRange(i);if(s){const t=o(r,i,e-s),n=o(r,i,e+s);return{lo:t.lo,hi:n.hi}}}}return{lo:0,hi:r.length-1}}function ke(t,i,e,s,n){const r=t.getSortedVisibleDatasetMetas(),o=e[i];for(let t=0,e=r.length;t<e;++t){const{index:e,data:h}=r[t],{lo:a,hi:c}=_e(r[t],i,o,n);for(let t=a;t<=c;++t){const i=h[t];i.skip||s(i,e,t)}}}function Oe(t,i,e,s,n){const r=[];return n||t.isPointInArea(i)?(ke(t,e,i,(function(e,o,h){(n||ni(e,t.chartArea,0))&&e.inRange(i.x,i.y,s)&&r.push({element:e,datasetIndex:o,index:h})}),!0),r):r}function Se(t,i,e,s,n,r){return r||t.isPointInArea(i)?"r"!==e||s?function(t,i,e,s,n,r){let o=[];const h=function(t){const i=-1!==t.indexOf("x"),e=-1!==t.indexOf("y");return function(t,s){const n=i?Math.abs(t.x-s.x):0,r=e?Math.abs(t.y-s.y):0;return Math.sqrt(Math.pow(n,2)+Math.pow(r,2))}}(e);let a=Number.POSITIVE_INFINITY;return ke(t,e,i,(function(e,c,l){const u=e.inRange(i.x,i.y,n);if(s&&!u)return;const f=e.getCenterPoint(n);if(!r&&!t.isPointInArea(f)&&!u)return;const d=h(i,f);d<a?(o=[{element:e,datasetIndex:c,index:l}],a=d):d===a&&o.push({element:e,datasetIndex:c,index:l})})),o}(t,i,e,s,n,r):function(t,i,e,s){let n=[];return ke(t,e,i,(function(t,e,r){const{startAngle:o,endAngle:h}=t.getProps(["startAngle","endAngle"],s),{angle:a}=function(t,i){const e=i.x-t.x,s=i.y-t.y,n=Math.sqrt(e*e+s*s);let r=Math.atan2(s,e);return r<-.5*at&&(r+=ct),{angle:r,distance:n}}(t,{x:i.x,y:i.y});_t(a,o,h)&&n.push({element:t,datasetIndex:e,index:r})})),n}(t,i,e,n):[]}function Ae(t,i,e,s,n){const r=[],o="x"===e?"inXRange":"inYRange";let h=!1;return ke(t,e,i,((t,s,a)=>{t[o]&&t[o](i[e],n)&&(r.push({element:t,datasetIndex:s,index:a}),h=h||t.inRange(i.x,i.y,n))})),s&&!h?[]:r}var De={modes:{index(t,i,e,s){const n=zi(i,t),r=e.axis||"x",o=e.includeInvisible||!1,h=e.intersect?Oe(t,n,r,s,o):Se(t,n,r,!1,s,o),a=[];return h.length?(t.getSortedVisibleDatasetMetas().forEach((t=>{const i=h[0].index,e=t.data[i];e&&!e.skip&&a.push({element:e,datasetIndex:t.index,index:i})})),a):[]},dataset(t,i,e,s){const n=zi(i,t),r=e.axis||"xy",o=e.includeInvisible||!1;let h=e.intersect?Oe(t,n,r,s,o):Se(t,n,r,!1,s,o);if(h.length>0){const i=h[0].datasetIndex,e=t.getDatasetMeta(i).data;h=[];for(let t=0;t<e.length;++t)h.push({element:e[t],datasetIndex:i,index:t})}return h},point:(t,i,e,s)=>Oe(t,zi(i,t),e.axis||"xy",s,e.includeInvisible||!1),nearest:(t,i,e,s)=>Se(t,zi(i,t),e.axis||"xy",e.intersect,s,e.includeInvisible||!1),x:(t,i,e,s)=>Ae(t,zi(i,t),"x",e.intersect,s),y:(t,i,e,s)=>Ae(t,zi(i,t),"y",e.intersect,s)}};const je=["left","top","right","bottom"];function Re(t,i){return t.filter((t=>t.pos===i))}function Ce(t,i){return t.filter((t=>-1===je.indexOf(t.pos)&&t.box.axis===i))}function Ee(t,i){return t.sort(((t,e)=>{const s=i?e:t,n=i?t:e;return s.weight===n.weight?s.index-n.index:s.weight-n.weight}))}function Le(t,i,e,s){return Math.max(t[e],i[e])+Math.max(t[s],i[s])}function Pe(t,i){t.top=Math.max(t.top,i.top),t.left=Math.max(t.left,i.left),t.bottom=Math.max(t.bottom,i.bottom),t.right=Math.max(t.right,i.right)}function Te(t,i,e,s){const{pos:n,box:r}=e,o=t.maxPadding;if(!H(n)){e.size&&(t[n]-=e.size);const i=s[e.stack]||{size:0,count:1};i.size=Math.max(i.size,e.horizontal?r.height:r.width),e.size=i.size/i.count,t[n]+=e.size}r.getPadding&&Pe(o,r.getPadding());const h=Math.max(0,i.outerWidth-Le(o,t,"left","right")),a=Math.max(0,i.outerHeight-Le(o,t,"top","bottom")),c=h!==t.w,l=a!==t.h;return t.w=h,t.h=a,e.horizontal?{same:c,other:l}:{same:l,other:c}}function Ie(t,i){const e=i.maxPadding;return function(t){const s={left:0,top:0,right:0,bottom:0};return t.forEach((t=>{s[t]=Math.max(i[t],e[t])})),s}(t?["left","right"]:["top","bottom"])}function Fe(t,i,e,s){const n=[];let r,o,h,a,c,l;for(r=0,o=t.length,c=0;r<o;++r){h=t[r],a=h.box,a.update(h.width||i.w,h.height||i.h,Ie(h.horizontal,i));const{same:o,other:u}=Te(i,e,h,s);c|=o&&n.length,l=l||u,a.fullSize||n.push(h)}return c&&Fe(n,i,e,s)||l}function Be(t,i,e,s,n){t.top=e,t.left=i,t.right=i+s,t.bottom=e+n,t.width=s,t.height=n}function Ne(t,i,e,s){const n=e.padding;let{x:r,y:o}=i;for(const h of t){const t=h.box,a=s[h.stack]||{placed:0,weight:1},c=h.stackWeight/a.weight||1;if(h.horizontal){const s=i.w*c,r=a.size||t.height;rt(a.start)&&(o=a.start),t.fullSize?Be(t,n.left,o,e.outerWidth-n.right-n.left,r):Be(t,i.left+a.placed,o,s,r),a.start=o,a.placed+=s,o=t.bottom}else{const s=i.h*c,o=a.size||t.width;rt(a.start)&&(r=a.start),t.fullSize?Be(t,r,n.top,o,e.outerHeight-n.bottom-n.top):Be(t,r,i.top+a.placed,o,s),a.start=r,a.placed+=s,r=t.right}}i.x=r,i.y=o}var We={addBox(t,i){t.boxes||(t.boxes=[]),i.fullSize=i.fullSize||!1,i.position=i.position||"top",i.weight=i.weight||0,i._layers=i._layers||function(){return[{z:0,draw(t){i.draw(t)}}]},t.boxes.push(i)},removeBox(t,i){const e=t.boxes?t.boxes.indexOf(i):-1;-1!==e&&t.boxes.splice(e,1)},configure(t,i,e){i.fullSize=e.fullSize,i.position=e.position,i.weight=e.weight},update(t,i,e,s){if(!t)return;const n=mi(t.options.layout.padding),r=Math.max(i-n.width,0),o=Math.max(e-n.height,0),h=function(t){const i=function(t){const i=[];let e,s,n,r,o,h;for(e=0,s=(t||[]).length;e<s;++e)n=t[e],({position:r,options:{stack:o,stackWeight:h=1}}=n),i.push({index:e,box:n,pos:r,horizontal:n.isHorizontal(),weight:n.weight,stack:o&&r+o,stackWeight:h});return i}(t),e=Ee(i.filter((t=>t.box.fullSize)),!0),s=Ee(Re(i,"left"),!0),n=Ee(Re(i,"right")),r=Ee(Re(i,"top"),!0),o=Ee(Re(i,"bottom")),h=Ce(i,"x"),a=Ce(i,"y");return{fullSize:e,leftAndTop:s.concat(r),rightAndBottom:n.concat(a).concat(o).concat(h),chartArea:Re(i,"chartArea"),vertical:s.concat(n).concat(a),horizontal:r.concat(o).concat(h)}}(t.boxes),a=h.vertical,c=h.horizontal;Z(t.boxes,(t=>{"function"==typeof t.beforeLayout&&t.beforeLayout()}));const l=a.reduce(((t,i)=>i.box.options&&!1===i.box.options.display?t:t+1),0)||1,u=Object.freeze({outerWidth:i,outerHeight:e,padding:n,availableWidth:r,availableHeight:o,vBoxMaxWidth:r/2/l,hBoxMaxHeight:o/2}),f=Object.assign({},n);Pe(f,mi(s));const d=Object.assign({maxPadding:f,w:r,h:o,x:n.left,y:n.top},n),b=function(t,i){const e=function(t){const i={};for(const e of t){const{stack:t,pos:s,stackWeight:n}=e;if(!t||!je.includes(s))continue;const r=i[t]||(i[t]={count:0,placed:0,weight:0,size:0});r.count++,r.weight+=n}return i}(t),{vBoxMaxWidth:s,hBoxMaxHeight:n}=i;let r,o,h;for(r=0,o=t.length;r<o;++r){h=t[r];const{fullSize:o}=h.box,a=e[h.stack],c=a&&h.stackWeight/a.weight;h.horizontal?(h.width=c?c*s:o&&i.availableWidth,h.height=n):(h.width=s,h.height=c?c*n:o&&i.availableHeight)}return e}(a.concat(c),u);Fe(h.fullSize,d,u,b),Fe(a,d,u,b),Fe(c,d,u,b)&&Fe(a,d,u,b),function(t){const i=t.maxPadding;function e(e){const s=Math.max(i[e]-t[e],0);return t[e]+=s,s}t.y+=e("top"),t.x+=e("left"),e("right"),e("bottom")}(d),Ne(h.leftAndTop,d,u,b),d.x+=d.w,d.y+=d.h,Ne(h.rightAndBottom,d,u,b),t.chartArea={left:d.left,top:d.top,right:d.left+d.w,bottom:d.top+d.h,height:d.h,width:d.w},Z(h.chartArea,(i=>{const e=i.box;Object.assign(e,t.chartArea),e.update(d.w,d.h,{left:0,top:0,right:0,bottom:0})}))}};class ze{acquireContext(t,i){}releaseContext(t){return!1}addEventListener(t,i,e){}removeEventListener(t,i,e){}getDevicePixelRatio(){return 1}getMaximumSize(t,i,e,s){return i=Math.max(0,i||t.width),e=e||t.height,{width:i,height:Math.max(0,s?Math.floor(i/s):e)}}isAttached(t){return!0}updateConfig(t){}}class He extends ze{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const $e="$chartjs",Ye={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Ve=t=>null===t||""===t,Xe=!!Yi&&{passive:!0};function Ue(t,i,e){t&&t.canvas&&t.canvas.removeEventListener(i,e,Xe)}function Ze(t,i){for(const e of t)if(e===i||e.contains(i))return!0}function Ke(t,i,e){const s=t.canvas,n=new MutationObserver((t=>{let i=!1;for(const e of t)i=i||Ze(e.addedNodes,s),i=i&&!Ze(e.removedNodes,s);i&&e()}));return n.observe(document,{childList:!0,subtree:!0}),n}function Qe(t,i,e){const s=t.canvas,n=new MutationObserver((t=>{let i=!1;for(const e of t)i=i||Ze(e.removedNodes,s),i=i&&!Ze(e.addedNodes,s);i&&e()}));return n.observe(document,{childList:!0,subtree:!0}),n}const qe=new Map;let Ge=0;function Je(){const t=window.devicePixelRatio;t!==Ge&&(Ge=t,qe.forEach(((i,e)=>{e.currentDevicePixelRatio!==t&&i()})))}function ts(t,i,e){const s=t.canvas,n=s&&Ii(s);if(!n)return;const r=Et(((t,i)=>{const s=n.clientWidth;e(t,i),s<n.clientWidth&&e()}),window),o=new ResizeObserver((t=>{const i=t[0],e=i.contentRect.width,s=i.contentRect.height;0===e&&0===s||r(e,s)}));return o.observe(n),function(t,i){qe.size||window.addEventListener("resize",Je),qe.set(t,i)}(t,r),o}function is(t,i,e){e&&e.disconnect(),"resize"===i&&function(t){qe.delete(t),qe.size||window.removeEventListener("resize",Je)}(t)}function es(t,i,e){const s=t.canvas,n=Et((i=>{null!==t.ctx&&e(function(t,i){const e=Ye[t.type]||t.type,{x:s,y:n}=zi(t,i);return{type:e,chart:i,native:t,x:void 0!==s?s:null,y:void 0!==n?n:null}}(i,t))}),t);return function(t,i,e){t&&t.addEventListener(i,e,Xe)}(s,i,n),n}class ss extends ze{acquireContext(t,i){const e=t&&t.getContext&&t.getContext("2d");return e&&e.canvas===t?(function(t,i){const e=t.style,s=t.getAttribute("height"),n=t.getAttribute("width");if(t[$e]={initial:{height:s,width:n,style:{display:e.display,height:e.height,width:e.width}}},e.display=e.display||"block",e.boxSizing=e.boxSizing||"border-box",Ve(n)){const i=Vi(t,"width");void 0!==i&&(t.width=i)}if(Ve(s))if(""===t.style.height)t.height=t.width/(i||2);else{const i=Vi(t,"height");void 0!==i&&(t.height=i)}}(t,i),e):null}releaseContext(t){const i=t.canvas;if(!i[$e])return!1;const e=i[$e].initial;["height","width"].forEach((t=>{const s=e[t];W(s)?i.removeAttribute(t):i.setAttribute(t,s)}));const s=e.style||{};return Object.keys(s).forEach((t=>{i.style[t]=s[t]})),i.width=i.width,delete i[$e],!0}addEventListener(t,i,e){this.removeEventListener(t,i),(t.$proxies||(t.$proxies={}))[i]=({attach:Ke,detach:Qe,resize:ts}[i]||es)(t,i,e)}removeEventListener(t,i){const e=t.$proxies||(t.$proxies={}),s=e[i];s&&(({attach:is,detach:is,resize:is}[i]||Ue)(t,i,s),e[i]=void 0)}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,i,e,s){return function(t,i,e,s){const n=Bi(t),r=Wi(n,"margin"),o=Fi(n.maxWidth,t,"clientWidth")||lt,h=Fi(n.maxHeight,t,"clientHeight")||lt,a=function(t,i,e){let s,n;if(void 0===i||void 0===e){const r=t&&Ii(t);if(r){const t=r.getBoundingClientRect(),o=Bi(r),h=Wi(o,"border","width"),a=Wi(o,"padding");i=t.width-a.width-h.width,e=t.height-a.height-h.height,s=Fi(o.maxWidth,r,"clientWidth"),n=Fi(o.maxHeight,r,"clientHeight")}else i=t.clientWidth,e=t.clientHeight}return{width:i,height:e,maxWidth:s||lt,maxHeight:n||lt}}(t,i,e);let{width:c,height:l}=a;if("content-box"===n.boxSizing){const t=Wi(n,"border","width"),i=Wi(n,"padding");c-=i.width+t.width,l-=i.height+t.height}return c=Math.max(0,c-r.width),l=Math.max(0,s?c/s:l-r.height),c=Hi(Math.min(c,o,a.maxWidth)),l=Hi(Math.min(l,h,a.maxHeight)),c&&!l&&(l=Hi(c/2)),(void 0!==i||void 0!==e)&&s&&a.height&&l>a.height&&(l=a.height,c=Hi(Math.floor(l*s))),{width:c,height:l}}(t,i,e,s)}isAttached(t){const i=t&&Ii(t);return!(!i||!i.isConnected)}}class ns{static defaults={};static defaultRoutes=void 0;x;y;active=!1;options;$animations;tooltipPosition(t){const{x:i,y:e}=this.getProps(["x","y"],t);return{x:i,y:e}}hasValue(){return vt(this.x)&&vt(this.y)}getProps(t,i){const e=this.$animations;if(!i||!e)return this;const s={};return t.forEach((t=>{s[t]=e[t]&&e[t].active()?e[t]._to:this[t]})),s}}function rs(t,i,e,s,n){const r=V(s,0),o=Math.min(V(n,t.length),t.length);let h,a,c,l=0;for(e=Math.ceil(e),n&&(h=n-s,e=h/Math.floor(h/e)),c=r;c<0;)l++,c=Math.round(r+l*e);for(a=Math.max(r,0);a<o;a++)a===c&&(i.push(t[a]),l++,c=Math.round(r+l*e))}const os=(t,i,e)=>"top"===i||"left"===i?t[i]+e:t[i]-e,hs=(t,i)=>Math.min(i||t,t);function as(t,i){const e=[],s=t.length/i,n=t.length;let r=0;for(;r<n;r+=s)e.push(t[Math.floor(r)]);return e}function cs(t,i,e){const s=t.ticks.length,n=Math.min(i,s-1),r=t._startPixel,o=t._endPixel,h=1e-6;let a,c=t.getPixelForTick(n);if(!(e&&(a=1===s?Math.max(c-r,o-c):0===i?(t.getPixelForTick(1)-c)/2:(c-t.getPixelForTick(n-1))/2,c+=n<i?a:-a,c<r-h||c>o+h)))return c}function ls(t){return t.drawTicks?t.tickLength:0}function us(t,i){if(!t.display)return 0;const e=xi(t.font,i),s=mi(t.padding);return(z(t.text)?t.text.length:1)*e.lineHeight+s.height}function fs(t,i,e){let s=Lt(t);return(e&&"right"!==i||!e&&"right"===i)&&(s=(t=>"left"===t?"right":"right"===t?"left":t)(s)),s}class ds extends ns{constructor(t){super(),this.id=t.id,this.type=t.type,this.options=void 0,this.ctx=t.ctx,this.chart=t.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(t){this.options=t.setContext(this.getContext()),this.axis=t.axis,this._userMin=this.parse(t.min),this._userMax=this.parse(t.max),this._suggestedMin=this.parse(t.suggestedMin),this._suggestedMax=this.parse(t.suggestedMax)}parse(t,i){return t}getUserBounds(){let{_userMin:t,_userMax:i,_suggestedMin:e,_suggestedMax:s}=this;return t=Y(t,Number.POSITIVE_INFINITY),i=Y(i,Number.NEGATIVE_INFINITY),e=Y(e,Number.POSITIVE_INFINITY),s=Y(s,Number.NEGATIVE_INFINITY),{min:Y(t,e),max:Y(i,s),minDefined:$(t),maxDefined:$(i)}}getMinMax(t){let i,{min:e,max:s,minDefined:n,maxDefined:r}=this.getUserBounds();if(n&&r)return{min:e,max:s};const o=this.getMatchingVisibleMetas();for(let h=0,a=o.length;h<a;++h)i=o[h].controller.getMinMax(this,t),n||(e=Math.min(e,i.min)),r||(s=Math.max(s,i.max));return e=r&&e>s?s:e,s=n&&e>s?e:s,{min:Y(e,Y(s,e)),max:Y(s,Y(e,s))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){U(this.options.beforeUpdate,[this])}update(t,i,e){const{beginAtZero:s,grace:n,ticks:r}=this.options,o=r.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=i,this._margins=e=Object.assign({left:0,right:0,top:0,bottom:0},e),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+e.left+e.right:this.height+e.top+e.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=function(t,i,e){const{min:s,max:n}=t,r=X(i,(n-s)/2),o=(t,i)=>e&&0===t?0:t+i;return{min:o(s,-Math.abs(r)),max:o(n,r)}}(this,n,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const h=o<this.ticks.length;this._convertTicksToLabels(h?as(this.ticks,o):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),r.display&&(r.autoSkip||"auto"===r.source)&&(this.ticks=function(t,i){const e=t.options.ticks,s=function(t){const i=t.options.offset,e=t._tickSize();return Math.floor(Math.min(t._length/e+(i?0:1),t._maxLength/e))}(t),n=Math.min(e.maxTicksLimit||s,s),r=e.major.enabled?function(t){const i=[];let e,s;for(e=0,s=t.length;e<s;e++)t[e].major&&i.push(e);return i}(i):[],o=r.length,h=r[0],a=r[o-1],c=[];if(o>n)return function(t,i,e,s){let n,r=0,o=e[0];for(s=Math.ceil(s),n=0;n<t.length;n++)n===o&&(i.push(t[n]),r++,o=e[r*s])}(i,c,r,o/n),c;const l=function(t,i,e){const s=function(t){const i=t.length;let e,s;if(i<2)return!1;for(s=t[0],e=1;e<i;++e)if(t[e]-t[e-1]!==s)return!1;return s}(t),n=i.length/e;if(!s)return Math.max(n,1);const r=function(t){const i=[],e=Math.sqrt(t);let s;for(s=1;s<e;s++)t%s==0&&(i.push(s),i.push(t/s));return e===(0|e)&&i.push(e),i.sort(((t,i)=>t-i)).pop(),i}(s);for(let t=0,i=r.length-1;t<i;t++){const i=r[t];if(i>n)return i}return Math.max(n,1)}(r,i,n);if(o>0){let t,e;const s=o>1?Math.round((a-h)/(o-1)):null;for(rs(i,c,l,W(s)?0:h-s,h),t=0,e=o-1;t<e;t++)rs(i,c,l,r[t],r[t+1]);return rs(i,c,l,a,W(s)?i.length:a+s),c}return rs(i,c,l),c}(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),h&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let t,i,e=this.options.reverse;this.isHorizontal()?(t=this.left,i=this.right):(t=this.top,i=this.bottom,e=!e),this._startPixel=t,this._endPixel=i,this._reversePixels=e,this._length=i-t,this._alignToPixels=this.options.alignToPixels}afterUpdate(){U(this.options.afterUpdate,[this])}beforeSetDimensions(){U(this.options.beforeSetDimensions,[this])}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=0,this.right=this.width):(this.height=this.maxHeight,this.top=0,this.bottom=this.height),this.paddingLeft=0,this.paddingTop=0,this.paddingRight=0,this.paddingBottom=0}afterSetDimensions(){U(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),U(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){U(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(t){const i=this.options.ticks;let e,s,n;for(e=0,s=t.length;e<s;e++)n=t[e],n.label=U(i.callback,[n.value,e,t],this)}afterTickToLabelConversion(){U(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){U(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const t=this.options,i=t.ticks,e=hs(this.ticks.length,t.ticks.maxTicksLimit),s=i.minRotation||0,n=i.maxRotation;let r,o,h,a=s;if(!this._isVisible()||!i.display||s>=n||e<=1||!this.isHorizontal())return void(this.labelRotation=s);const c=this._getLabelSizes(),l=c.widest.width,u=c.highest.height,f=kt(this.chart.width-l,0,this.maxWidth);r=t.offset?this.maxWidth/e:f/(e-1),l+6>r&&(r=f/(e-(t.offset?.5:1)),o=this.maxHeight-ls(t.grid)-i.padding-us(t.title,this.chart.options.font),h=Math.sqrt(l*l+u*u),a=Math.min(Math.asin(kt((c.highest.height+6)/r,-1,1)),Math.asin(kt(o/h,-1,1))-Math.asin(kt(u/h,-1,1)))*(180/at),a=Math.max(s,Math.min(n,a))),this.labelRotation=a}afterCalculateLabelRotation(){U(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){U(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:i,options:{ticks:e,title:s,grid:n}}=this,r=this._isVisible(),o=this.isHorizontal();if(r){const r=us(s,i.options.font);if(o?(t.width=this.maxWidth,t.height=ls(n)+r):(t.height=this.maxHeight,t.width=ls(n)+r),e.display&&this.ticks.length){const{first:i,last:s,widest:n,highest:r}=this._getLabelSizes(),h=2*e.padding,a=yt(this.labelRotation),c=Math.cos(a),l=Math.sin(a);o?t.height=Math.min(this.maxHeight,t.height+(e.mirror?0:l*n.width+c*r.height)+h):t.width=Math.min(this.maxWidth,t.width+(e.mirror?0:c*n.width+l*r.height)+h),this._calculatePadding(i,s,l,c)}}this._handleMargins(),o?(this.width=this._length=i.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=i.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,i,e,s){const{ticks:{align:n,padding:r},position:o}=this.options,h=0!==this.labelRotation,a="top"!==o&&"x"===this.axis;if(this.isHorizontal()){const o=this.getPixelForTick(0)-this.left,c=this.right-this.getPixelForTick(this.ticks.length-1);let l=0,u=0;h?a?(l=s*t.width,u=e*i.height):(l=e*t.height,u=s*i.width):"start"===n?u=i.width:"end"===n?l=t.width:"inner"!==n&&(l=t.width/2,u=i.width/2),this.paddingLeft=Math.max((l-o+r)*this.width/(this.width-o),0),this.paddingRight=Math.max((u-c+r)*this.width/(this.width-c),0)}else{let e=i.height/2,s=t.height/2;"start"===n?(e=0,s=t.height):"end"===n&&(e=i.height,s=0),this.paddingTop=e+r,this.paddingBottom=s+r}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){U(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:i}=this.options;return"top"===i||"bottom"===i||"x"===t}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){let i,e;for(this.beforeTickToLabelConversion(),this.generateTickLabels(t),i=0,e=t.length;i<e;i++)W(t[i].label)&&(t.splice(i,1),e--,i--);this.afterTickToLabelConversion()}_getLabelSizes(){let t=this._labelSizes;if(!t){const i=this.options.ticks.sampleSize;let e=this.ticks;i<e.length&&(e=as(e,i)),this._labelSizes=t=this._computeLabelSizes(e,e.length,this.options.ticks.maxTicksLimit)}return t}_computeLabelSizes(t,i,e){const{ctx:s,_longestTextCache:n}=this,r=[],o=[],h=Math.floor(i/hs(i,e));let a,c,l,u,f,d,b,g,p,m,x,v=0,y=0;for(a=0;a<i;a+=h){if(u=t[a].label,f=this._resolveTickFontOptions(a),s.font=d=f.string,b=n[d]=n[d]||{data:{},gc:[]},g=f.lineHeight,p=m=0,W(u)||z(u)){if(z(u))for(c=0,l=u.length;c<l;++c)x=u[c],W(x)||z(x)||(p=Jt(s,b.data,b.gc,p,x),m+=g)}else p=Jt(s,b.data,b.gc,p,u),m=g;r.push(p),o.push(m),v=Math.max(p,v),y=Math.max(m,y)}!function(t,i){Z(t,(t=>{const e=t.gc,s=e.length/2;let n;if(s>i){for(n=0;n<s;++n)delete t.data[e[n]];e.splice(0,s)}}))}(n,i);const M=r.indexOf(v),w=o.indexOf(y),_=t=>({width:r[t]||0,height:o[t]||0});return{first:_(0),last:_(i-1),widest:_(M),highest:_(w),widths:r,heights:o}}getLabelForValue(t){return t}getPixelForValue(t,i){return NaN}getValueForPixel(t){}getPixelForTick(t){const i=this.ticks;return t<0||t>i.length-1?null:this.getPixelForValue(i[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const i=this._startPixel+t*this._length;return kt(this._alignToPixels?ti(this.chart,i,0):i,-32768,32767)}getDecimalForPixel(t){const i=(t-this._startPixel)/this._length;return this._reversePixels?1-i:i}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:i}=this;return t<0&&i<0?i:t>0&&i>0?t:0}getContext(t){const i=this.ticks||[];if(t>=0&&t<i.length){const e=i[t];return e.$context||(e.$context=function(t,i,e){return yi(t,{tick:e,index:i,type:"tick"})}(this.getContext(),t,e))}return this.$context||(this.$context=yi(this.chart.getContext(),{scale:this,type:"scale"}))}_tickSize(){const t=this.options.ticks,i=yt(this.labelRotation),e=Math.abs(Math.cos(i)),s=Math.abs(Math.sin(i)),n=this._getLabelSizes(),r=t.autoSkipPadding||0,o=n?n.widest.width+r:0,h=n?n.highest.height+r:0;return this.isHorizontal()?h*e>o*s?o/e:h/s:h*s<o*e?h/e:o/s}_isVisible(){const t=this.options.display;return"auto"!==t?!!t:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(t){const i=this.axis,e=this.chart,s=this.options,{grid:n,position:r,border:o}=s,h=n.offset,a=this.isHorizontal(),c=this.ticks.length+(h?1:0),l=ls(n),u=[],f=o.setContext(this.getContext()),d=f.display?f.width:0,b=d/2,g=function(t){return ti(e,t,d)};let p,m,x,v,y,M,w,_,k,O,S,A;if("top"===r)p=g(this.bottom),M=this.bottom-l,_=p-b,O=g(t.top)+b,A=t.bottom;else if("bottom"===r)p=g(this.top),O=t.top,A=g(t.bottom)-b,M=p+b,_=this.top+l;else if("left"===r)p=g(this.right),y=this.right-l,w=p-b,k=g(t.left)+b,S=t.right;else if("right"===r)p=g(this.left),k=t.left,S=g(t.right)-b,y=p+b,w=this.left+l;else if("x"===i){if("center"===r)p=g((t.top+t.bottom)/2+.5);else if(H(r)){const t=Object.keys(r)[0];p=g(this.chart.scales[t].getPixelForValue(r[t]))}O=t.top,A=t.bottom,M=p+b,_=M+l}else if("y"===i){if("center"===r)p=g((t.left+t.right)/2);else if(H(r)){const t=Object.keys(r)[0];p=g(this.chart.scales[t].getPixelForValue(r[t]))}y=p-b,w=y-l,k=t.left,S=t.right}const D=V(s.ticks.maxTicksLimit,c),j=Math.max(1,Math.ceil(c/D));for(m=0;m<c;m+=j){const t=this.getContext(m),i=n.setContext(t),s=o.setContext(t),r=i.lineWidth,c=i.color,l=s.dash||[],f=s.dashOffset,d=i.tickWidth,b=i.tickColor,g=i.tickBorderDash||[],p=i.tickBorderDashOffset;x=cs(this,m,h),void 0!==x&&(v=ti(e,x,r),a?y=w=k=S=v:M=_=O=A=v,u.push({tx1:y,ty1:M,tx2:w,ty2:_,x1:k,y1:O,x2:S,y2:A,width:r,color:c,borderDash:l,borderDashOffset:f,tickWidth:d,tickColor:b,tickBorderDash:g,tickBorderDashOffset:p}))}return this._ticksLength=c,this._borderValue=p,u}_computeLabelItems(t){const i=this.axis,e=this.options,{position:s,ticks:n}=e,r=this.isHorizontal(),o=this.ticks,{align:h,crossAlign:a,padding:c,mirror:l}=n,u=ls(e.grid),f=u+c,d=l?-c:f,b=-yt(this.labelRotation),g=[];let p,m,x,v,y,M,w,_,k,O,S,A,D="middle";if("top"===s)M=this.bottom-d,w=this._getXAxisLabelAlignment();else if("bottom"===s)M=this.top+d,w=this._getXAxisLabelAlignment();else if("left"===s){const t=this._getYAxisLabelAlignment(u);w=t.textAlign,y=t.x}else if("right"===s){const t=this._getYAxisLabelAlignment(u);w=t.textAlign,y=t.x}else if("x"===i){if("center"===s)M=(t.top+t.bottom)/2+f;else if(H(s)){const t=Object.keys(s)[0];M=this.chart.scales[t].getPixelForValue(s[t])+f}w=this._getXAxisLabelAlignment()}else if("y"===i){if("center"===s)y=(t.left+t.right)/2-f;else if(H(s)){const t=Object.keys(s)[0];y=this.chart.scales[t].getPixelForValue(s[t])}w=this._getYAxisLabelAlignment(u).textAlign}"y"===i&&("start"===h?D="top":"end"===h&&(D="bottom"));const j=this._getLabelSizes();for(p=0,m=o.length;p<m;++p){x=o[p],v=x.label;const t=n.setContext(this.getContext(p));_=this.getPixelForTick(p)+n.labelOffset,k=this._resolveTickFontOptions(p),O=k.lineHeight,S=z(v)?v.length:1;const i=S/2,e=t.color,h=t.textStrokeColor,c=t.textStrokeWidth;let u,f=w;if(r?(y=_,"inner"===w&&(f=p===m-1?this.options.reverse?"left":"right":0===p?this.options.reverse?"right":"left":"center"),A="top"===s?"near"===a||0!==b?-S*O+O/2:"center"===a?-j.highest.height/2-i*O+O:O/2-j.highest.height:"near"===a||0!==b?O/2:"center"===a?j.highest.height/2-i*O:j.highest.height-S*O,l&&(A*=-1),0===b||t.showLabelBackdrop||(y+=O/2*Math.sin(b))):(M=_,A=(1-S)*O/2),t.showLabelBackdrop){const i=mi(t.backdropPadding),e=j.heights[p],s=j.widths[p];let n=A-i.top,r=0-i.left;switch(D){case"middle":n-=e/2;break;case"bottom":n-=e}switch(w){case"center":r-=s/2;break;case"right":r-=s;break;case"inner":p===m-1?r-=s:p>0&&(r-=s/2)}u={left:r,top:n,width:s+i.width,height:e+i.height,color:t.backdropColor}}g.push({label:v,font:k,textOffset:A,options:{rotation:b,color:e,strokeColor:h,strokeWidth:c,textAlign:f,textBaseline:D,translation:[y,M],backdrop:u}})}return g}_getXAxisLabelAlignment(){const{position:t,ticks:i}=this.options;if(-yt(this.labelRotation))return"top"===t?"left":"right";let e="center";return"start"===i.align?e="left":"end"===i.align?e="right":"inner"===i.align&&(e="inner"),e}_getYAxisLabelAlignment(t){const{position:i,ticks:{crossAlign:e,mirror:s,padding:n}}=this.options,r=t+n,o=this._getLabelSizes().widest.width;let h,a;return"left"===i?s?(a=this.right+n,"near"===e?h="left":"center"===e?(h="center",a+=o/2):(h="right",a+=o)):(a=this.right-r,"near"===e?h="right":"center"===e?(h="center",a-=o/2):(h="left",a=this.left)):"right"===i?s?(a=this.left+n,"near"===e?h="right":"center"===e?(h="center",a-=o/2):(h="left",a-=o)):(a=this.left+r,"near"===e?h="left":"center"===e?(h="center",a+=o/2):(h="right",a=this.right)):h="right",{textAlign:h,x:a}}_computeLabelArea(){if(this.options.ticks.mirror)return;const t=this.chart,i=this.options.position;return"left"===i||"right"===i?{top:0,left:this.left,bottom:t.height,right:this.right}:"top"===i||"bottom"===i?{top:this.top,left:0,bottom:this.bottom,right:t.width}:void 0}drawBackground(){const{ctx:t,options:{backgroundColor:i},left:e,top:s,width:n,height:r}=this;i&&(t.save(),t.fillStyle=i,t.fillRect(e,s,n,r),t.restore())}getLineWidthForValue(t){const i=this.options.grid;if(!this._isVisible()||!i.display)return 0;const e=this.ticks.findIndex((i=>i.value===t));return e>=0?i.setContext(this.getContext(e)).lineWidth:0}drawGrid(t){const i=this.options.grid,e=this.ctx,s=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let n,r;const o=(t,i,s)=>{s.width&&s.color&&(e.save(),e.lineWidth=s.width,e.strokeStyle=s.color,e.setLineDash(s.borderDash||[]),e.lineDashOffset=s.borderDashOffset,e.beginPath(),e.moveTo(t.x,t.y),e.lineTo(i.x,i.y),e.stroke(),e.restore())};if(i.display)for(n=0,r=s.length;n<r;++n){const t=s[n];i.drawOnChartArea&&o({x:t.x1,y:t.y1},{x:t.x2,y:t.y2},t),i.drawTicks&&o({x:t.tx1,y:t.ty1},{x:t.tx2,y:t.ty2},{color:t.tickColor,width:t.tickWidth,borderDash:t.tickBorderDash,borderDashOffset:t.tickBorderDashOffset})}}drawBorder(){const{chart:t,ctx:i,options:{border:e,grid:s}}=this,n=e.setContext(this.getContext()),r=e.display?n.width:0;if(!r)return;const o=s.setContext(this.getContext(0)).lineWidth,h=this._borderValue;let a,c,l,u;this.isHorizontal()?(a=ti(t,this.left,r)-r/2,c=ti(t,this.right,o)+o/2,l=u=h):(l=ti(t,this.top,r)-r/2,u=ti(t,this.bottom,o)+o/2,a=c=h),i.save(),i.lineWidth=n.width,i.strokeStyle=n.color,i.beginPath(),i.moveTo(a,l),i.lineTo(c,u),i.stroke(),i.restore()}drawLabels(t){if(!this.options.ticks.display)return;const i=this.ctx,e=this._computeLabelArea();e&&ri(i,e);const s=this.getLabelItems(t);for(const t of s)ci(i,t.label,0,t.textOffset,t.font,t.options);e&&oi(i)}drawTitle(){const{ctx:t,options:{position:i,title:e,reverse:s}}=this;if(!e.display)return;const n=xi(e.font),r=mi(e.padding),o=e.align;let h=n.lineHeight/2;"bottom"===i||"center"===i||H(i)?(h+=r.bottom,z(e.text)&&(h+=n.lineHeight*(e.text.length-1))):h+=r.top;const{titleX:a,titleY:c,maxWidth:l,rotation:u}=function(t,i,e,s){const{top:n,left:r,bottom:o,right:h,chart:a}=t,{chartArea:c,scales:l}=a;let u,f,d,b=0;const g=o-n,p=h-r;if(t.isHorizontal()){if(f=Pt(s,r,h),H(e)){const t=Object.keys(e)[0];d=l[t].getPixelForValue(e[t])+g-i}else d="center"===e?(c.bottom+c.top)/2+g-i:os(t,e,i);u=h-r}else{if(H(e)){const t=Object.keys(e)[0];f=l[t].getPixelForValue(e[t])-p+i}else f="center"===e?(c.left+c.right)/2-p+i:os(t,e,i);d=Pt(s,o,n),b="left"===e?-ft:ft}return{titleX:f,titleY:d,maxWidth:u,rotation:b}}(this,h,i,o);ci(t,e.text,0,0,n,{color:e.color,maxWidth:l,rotation:u,textAlign:fs(o,i,s),textBaseline:"middle",translation:[a,c]})}draw(t){this._isVisible()&&(this.drawBackground(),this.drawGrid(t),this.drawBorder(),this.drawTitle(),this.drawLabels(t))}_layers(){const t=this.options,i=t.ticks&&t.ticks.z||0,e=V(t.grid&&t.grid.z,-1),s=V(t.border&&t.border.z,0);return this._isVisible()&&this.draw===ds.prototype.draw?[{z:e,draw:t=>{this.drawBackground(),this.drawGrid(t),this.drawTitle()}},{z:s,draw:()=>{this.drawBorder()}},{z:i,draw:t=>{this.drawLabels(t)}}]:[{z:i,draw:t=>{this.draw(t)}}]}getMatchingVisibleMetas(t){const i=this.chart.getSortedVisibleDatasetMetas(),e=this.axis+"AxisID",s=[];let n,r;for(n=0,r=i.length;n<r;++n){const r=i[n];r[e]!==this.id||t&&r.type!==t||s.push(r)}return s}_resolveTickFontOptions(t){return xi(this.options.ticks.setContext(this.getContext(t)).font)}_maxDigits(){const t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}}class bs{constructor(t,i,e){this.type=t,this.scope=i,this.override=e,this.items=Object.create(null)}isForType(t){return Object.prototype.isPrototypeOf.call(this.type.prototype,t.prototype)}register(t){const i=Object.getPrototypeOf(t);let e;(function(t){return"id"in t&&"defaults"in t})(i)&&(e=this.register(i));const s=this.items,n=t.id,r=this.scope+"."+n;if(!n)throw new Error("class does not have id: "+t);return n in s||(s[n]=t,function(t,i,e){const s=J(Object.create(null),[e?Gt.get(e):{},Gt.get(i),t.defaults]);Gt.set(i,s),t.defaultRoutes&&function(t,i){Object.keys(i).forEach((e=>{const s=e.split("."),n=s.pop(),r=[t].concat(s).join("."),o=i[e].split("."),h=o.pop(),a=o.join(".");Gt.route(r,n,a,h)}))}(i,t.defaultRoutes),t.descriptors&&Gt.describe(i,t.descriptors)}(t,r,e),this.override&&Gt.override(t.id,t.overrides)),r}get(t){return this.items[t]}unregister(t){const i=this.items,e=t.id,s=this.scope;e in i&&delete i[e],s&&e in Gt[s]&&(delete Gt[s][e],this.override&&delete Ut[e])}}class gs{constructor(){this.controllers=new bs(de,"datasets",!0),this.elements=new bs(ns,"elements"),this.plugins=new bs(Object,"plugins"),this.scales=new bs(ds,"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,i,e){[...i].forEach((i=>{const s=e||this._getRegistryForType(i);e||s.isForType(i)||s===this.plugins&&i.id?this._exec(t,s,i):Z(i,(i=>{const s=e||this._getRegistryForType(i);this._exec(t,s,i)}))}))}_exec(t,i,e){const s=nt(t);U(e["before"+s],[],e),i[t](e),U(e["after"+s],[],e)}_getRegistryForType(t){for(let i=0;i<this._typedRegistries.length;i++){const e=this._typedRegistries[i];if(e.isForType(t))return e}return this.plugins}_get(t,i,e){const s=i.get(t);if(void 0===s)throw new Error('"'+t+'" is not a registered '+e+".");return s}}var ps=new gs;class ms{constructor(){this._init=void 0}notify(t,i,e,s){if("beforeInit"===i&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install")),void 0===this._init)return;const n=s?this._descriptors(t).filter(s):this._descriptors(t),r=this._notify(n,t,i,e);return"afterDestroy"===i&&(this._notify(n,t,"stop"),this._notify(this._init,t,"uninstall"),this._init=void 0),r}_notify(t,i,e,s){s=s||{};for(const n of t){const t=n.plugin;if(!1===U(t[e],[i,s,n.options],t)&&s.cancelable)return!1}return!0}invalidate(){W(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;const i=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),i}_createDescriptors(t,i){const e=t&&t.config,s=V(e.options&&e.options.plugins,{}),n=function(t){const i={},e=[],s=Object.keys(ps.plugins.items);for(let t=0;t<s.length;t++)e.push(ps.getPlugin(s[t]));const n=t.plugins||[];for(let t=0;t<n.length;t++){const s=n[t];-1===e.indexOf(s)&&(e.push(s),i[s.id]=!0)}return{plugins:e,localIds:i}}(e);return!1!==s||i?function(t,{plugins:i,localIds:e},s,n){const r=[],o=t.getContext();for(const h of i){const i=h.id,a=xs(s[i],n);null!==a&&r.push({plugin:h,options:vs(t.config,{plugin:h,local:e[i]},a,o)})}return r}(t,n,s,i):[]}_notifyStateChanges(t){const i=this._oldCache||[],e=this._cache,s=(t,i)=>t.filter((t=>!i.some((i=>t.plugin.id===i.plugin.id))));this._notify(s(i,e),t,"stop"),this._notify(s(e,i),t,"start")}}function xs(t,i){return i||!1!==t?!0===t?{}:t:null}function vs(t,{plugin:i,local:e},s,n){const r=t.pluginScopeKeys(i),o=t.getOptionScopes(s,r);return e&&i.defaults&&o.push(i.defaults),t.createResolver(o,n,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function ys(t,i){return((i.datasets||{})[t]||{}).indexAxis||i.indexAxis||(Gt.datasets[t]||{}).indexAxis||"x"}function Ms(t){if("x"===t||"y"===t||"r"===t)return t}function ws(t,...i){if(Ms(t))return t;for(const s of i){const i=s.axis||("top"===(e=s.position)||"bottom"===e?"x":"left"===e||"right"===e?"y":void 0)||t.length>1&&Ms(t[0].toLowerCase());if(i)return i}var e;throw new Error(`Cannot determine type of '${t}' axis. Please provide 'axis' or 'position' option.`)}function _s(t,i,e){if(e[i+"AxisID"]===t)return{axis:i}}function ks(t){const i=t.options||(t.options={});i.plugins=V(i.plugins,{}),i.scales=function(t,i){const e=Ut[t.type]||{scales:{}},s=i.scales||{},n=ys(t.type,i),r=Object.create(null);return Object.keys(s).forEach((i=>{const o=s[i];if(!H(o))return console.error(`Invalid scale configuration for scale: ${i}`);if(o._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${i}`);const h=ws(i,o,function(t,i){if(i.data&&i.data.datasets){const e=i.data.datasets.filter((i=>i.xAxisID===t||i.yAxisID===t));if(e.length)return _s(t,"x",e[0])||_s(t,"y",e[0])}return{}}(i,t),Gt.scales[o.type]),a=function(t,i){return t===i?"_index_":"_value_"}(h,n),c=e.scales||{};r[i]=tt(Object.create(null),[{axis:h},o,c[h],c[a]])})),t.data.datasets.forEach((e=>{const n=e.type||t.type,o=e.indexAxis||ys(n,i),h=(Ut[n]||{}).scales||{};Object.keys(h).forEach((t=>{const i=function(t,i){let e=t;return"_index_"===t?e=i:"_value_"===t&&(e="x"===i?"y":"x"),e}(t,o),n=e[i+"AxisID"]||i;r[n]=r[n]||Object.create(null),tt(r[n],[{axis:i},s[n],h[t]])}))})),Object.keys(r).forEach((t=>{const i=r[t];tt(i,[Gt.scales[i.type],Gt.scale])})),r}(t,i)}function Os(t){return(t=t||{}).datasets=t.datasets||[],t.labels=t.labels||[],t}const Ss=new Map,As=new Set;function Ds(t,i){let e=Ss.get(t);return e||(e=i(),Ss.set(t,e),As.add(e)),e}const js=(t,i,e)=>{const s=st(i,e);void 0!==s&&t.add(s)};class Rs{constructor(t){this._config=function(t){return(t=t||{}).data=Os(t.data),ks(t),t}(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=Os(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(),ks(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return Ds(t,(()=>[[`datasets.${t}`,""]]))}datasetAnimationScopeKeys(t,i){return Ds(`${t}.transition.${i}`,(()=>[[`datasets.${t}.transitions.${i}`,`transitions.${i}`],[`datasets.${t}`,""]]))}datasetElementScopeKeys(t,i){return Ds(`${t}-${i}`,(()=>[[`datasets.${t}.elements.${i}`,`datasets.${t}`,`elements.${i}`,""]]))}pluginScopeKeys(t){const i=t.id;return Ds(`${this.type}-plugin-${i}`,(()=>[[`plugins.${i}`,...t.additionalOptionScopes||[]]]))}_cachedScopes(t,i){const e=this._scopeCache;let s=e.get(t);return s&&!i||(s=new Map,e.set(t,s)),s}getOptionScopes(t,i,e){const{options:s,type:n}=this,r=this._cachedScopes(t,e),o=r.get(i);if(o)return o;const h=new Set;i.forEach((i=>{t&&(h.add(t),i.forEach((i=>js(h,t,i)))),i.forEach((t=>js(h,s,t))),i.forEach((t=>js(h,Ut[n]||{},t))),i.forEach((t=>js(h,Gt,t))),i.forEach((t=>js(h,Zt,t)))}));const a=Array.from(h);return 0===a.length&&a.push(Object.create(null)),As.has(i)&&r.set(i,a),a}chartOptionScopes(){const{options:t,type:i}=this;return[t,Ut[i]||{},Gt.datasets[i]||{},{type:i},Gt,Zt]}resolveNamedOptions(t,i,e,s=[""]){const n={$shared:!0},{resolver:r,subPrefixes:o}=Cs(this._resolverCache,t,s);let h=r;(function(t,i){const{isScriptable:e,isIndexable:s}=_i(t);for(const n of i){const i=e(n),r=s(n),o=(r||i)&&t[n];if(i&&(ot(o)||Es(o))||r&&z(o))return!0}return!1})(r,i)&&(n.$shared=!1,h=wi(r,e=ot(e)?e():e,this.createResolver(t,e,o)));for(const t of i)n[t]=h[t];return n}createResolver(t,i,e=[""],s){const{resolver:n}=Cs(this._resolverCache,t,e);return H(i)?wi(n,i,void 0,s):n}}function Cs(t,i,e){let s=t.get(i);s||(s=new Map,t.set(i,s));const n=e.join();let r=s.get(n);return r||(r={resolver:Mi(i,e),subPrefixes:e.filter((t=>!t.toLowerCase().includes("hover")))},s.set(n,r)),r}const Es=t=>H(t)&&Object.getOwnPropertyNames(t).some((i=>ot(t[i]))),Ls=["top","bottom","left","right","chartArea"];function Ps(t,i){return"top"===t||"bottom"===t||-1===Ls.indexOf(t)&&"x"===i}function Ts(t,i){return function(e,s){return e[t]===s[t]?e[i]-s[i]:e[t]-s[t]}}function Is(t){const i=t.chart,e=i.options.animation;i.notifyPlugins("afterRender"),U(e&&e.onComplete,[t],i)}function Fs(t){const i=t.chart,e=i.options.animation;U(e&&e.onProgress,[t],i)}function Bs(t){return Ti()&&"string"==typeof t?t=document.getElementById(t):t&&t.length&&(t=t[0]),t&&t.canvas&&(t=t.canvas),t}const Ns={},Ws=t=>{const i=Bs(t);return Object.values(Ns).filter((t=>t.canvas===i)).pop()};function zs(t,i,e){const s=Object.keys(t);for(const n of s){const s=+n;if(s>=i){const r=t[n];delete t[n],(e>0||s>i)&&(t[s+e]=r)}}}class Hs{static defaults=Gt;static instances=Ns;static overrides=Ut;static registry=ps;static version="4.5.1";static getChart=Ws;static register(...t){ps.add(...t),$s()}static unregister(...t){ps.remove(...t),$s()}constructor(t,i){const e=this.config=new Rs(i),s=Bs(t),n=Ws(s);if(n)throw new Error("Canvas is already in use. Chart with ID '"+n.id+"' must be destroyed before the canvas with ID '"+n.canvas.id+"' can be reused.");const r=e.createResolver(e.chartOptionScopes(),this.getContext());this.platform=new(e.platform||function(t){return!Ti()||"undefined"!=typeof OffscreenCanvas&&t instanceof OffscreenCanvas?He:ss}(s)),this.platform.updateConfig(e);const o=this.platform.acquireContext(s,r.aspectRatio),h=o&&o.canvas,a=h&&h.height,c=h&&h.width;this.id=N(),this.ctx=o,this.canvas=h,this.width=c,this.height=a,this._options=r,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new ms,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=function(t,i){let e;return function(...s){return i?(clearTimeout(e),e=setTimeout(t,i,s)):t.apply(this,s),i}}((t=>this.update(t)),r.resizeDelay||0),this._dataChanges=[],Ns[this.id]=this,o&&h?(qi.listen(this,"complete",Is),qi.listen(this,"progress",Fs),this._initialize(),this.attached&&this.update()):console.error("Failed to create chart: can't acquire context from the given item")}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:i},width:e,height:s,_aspectRatio:n}=this;return W(t)?i&&n?n:s?e/s:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return ps}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():$i(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return ii(this.canvas,this.ctx),this}stop(){return qi.stop(this),this}resize(t,i){qi.running(this)?this._resizeBeforeDraw={width:t,height:i}:this._resize(t,i)}_resize(t,i){const e=this.options,s=this.platform.getMaximumSize(this.canvas,t,i,e.maintainAspectRatio&&this.aspectRatio),n=e.devicePixelRatio||this.platform.getDevicePixelRatio(),r=this.width?"resize":"attach";this.width=s.width,this.height=s.height,this._aspectRatio=this.aspectRatio,$i(this,n,!0)&&(this.notifyPlugins("resize",{size:s}),U(e.onResize,[this,s],this),this.attached&&this._doResize(r)&&this.render())}ensureScalesHaveIDs(){Z(this.options.scales||{},((t,i)=>{t.id=i}))}buildOrUpdateScales(){const t=this.options,i=t.scales,e=this.scales,s=Object.keys(e).reduce(((t,i)=>(t[i]=!1,t)),{});let n=[];i&&(n=n.concat(Object.keys(i).map((t=>{const e=i[t],s=ws(t,e),n="r"===s,r="x"===s;return{options:e,dposition:n?"chartArea":r?"bottom":"left",dtype:n?"radialLinear":r?"category":"linear"}})))),Z(n,(i=>{const n=i.options,r=n.id,o=ws(r,n),h=V(n.type,i.dtype);void 0!==n.position&&Ps(n.position,o)===Ps(i.dposition)||(n.position=i.dposition),s[r]=!0;let a=null;r in e&&e[r].type===h?a=e[r]:(a=new(ps.getScale(h))({id:r,type:h,ctx:this.ctx,chart:this}),e[a.id]=a),a.init(n,t)})),Z(s,((t,i)=>{t||delete e[i]})),Z(e,(t=>{We.configure(this,t,t.options),We.addBox(this,t)}))}_updateMetasets(){const t=this._metasets,i=this.data.datasets.length,e=t.length;if(t.sort(((t,i)=>t.index-i.index)),e>i){for(let t=i;t<e;++t)this._destroyDatasetMeta(t);t.splice(i,e-i)}this._sortedMetasets=t.slice(0).sort(Ts("order","index"))}_removeUnreferencedMetasets(){const{_metasets:t,data:{datasets:i}}=this;t.length>i.length&&delete this._stacks,t.forEach(((t,e)=>{0===i.filter((i=>i===t._dataset)).length&&this._destroyDatasetMeta(e)}))}buildOrUpdateControllers(){const t=[],i=this.data.datasets;let e,s;for(this._removeUnreferencedMetasets(),e=0,s=i.length;e<s;e++){const s=i[e];let n=this.getDatasetMeta(e);const r=s.type||this.config.type;if(n.type&&n.type!==r&&(this._destroyDatasetMeta(e),n=this.getDatasetMeta(e)),n.type=r,n.indexAxis=s.indexAxis||ys(r,this.options),n.order=s.order||0,n.index=e,n.label=""+s.label,n.visible=this.isDatasetVisible(e),n.controller)n.controller.updateIndex(e),n.controller.linkScales();else{const i=ps.getController(r),{datasetElementType:s,dataElementType:o}=Gt.datasets[r];Object.assign(i,{dataElementType:ps.getElement(o),datasetElementType:s&&ps.getElement(s)}),n.controller=new i(this,e),t.push(n.controller)}}return this._updateMetasets(),t}_resetElements(){Z(this.data.datasets,((t,i)=>{this.getDatasetMeta(i).controller.reset()}),this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const i=this.config;i.update();const e=this._options=i.createResolver(i.chartOptionScopes(),this.getContext()),s=this._animationsDisabled=!e.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),!1===this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0}))return;const n=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let r=0;for(let t=0,i=this.data.datasets.length;t<i;t++){const{controller:i}=this.getDatasetMeta(t),e=!s&&-1===n.indexOf(i);i.buildOrUpdateElements(e),r=Math.max(+i.getMaxOverflow(),r)}r=this._minPadding=e.layout.autoPadding?r:0,this._updateLayout(r),s||Z(n,(t=>{t.reset()})),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(Ts("z","_idx"));const{_active:o,_lastEvent:h}=this;h?this._eventHandler(h,!0):o.length&&this._updateHoverStyles(o,o,!0),this.render()}_updateScales(){Z(this.scales,(t=>{We.removeBox(this,t)})),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,i=new Set(Object.keys(this._listeners)),e=new Set(t.events);ht(i,e)&&!!this._responsiveListeners===t.responsive||(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,i=this._getUniformDataChanges()||[];for(const{method:e,start:s,count:n}of i)zs(t,s,"_removeElements"===e?-n:n)}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const i=this.data.datasets.length,e=i=>new Set(t.filter((t=>t[0]===i)).map(((t,i)=>i+","+t.splice(1).join(",")))),s=e(0);for(let t=1;t<i;t++)if(!ht(s,e(t)))return;return Array.from(s).map((t=>t.split(","))).map((t=>({method:t[1],start:+t[2],count:+t[3]})))}_updateLayout(t){if(!1===this.notifyPlugins("beforeLayout",{cancelable:!0}))return;We.update(this,this.width,this.height,t);const i=this.chartArea,e=i.width<=0||i.height<=0;this._layers=[],Z(this.boxes,(t=>{e&&"chartArea"===t.position||(t.configure&&t.configure(),this._layers.push(...t._layers()))}),this),this._layers.forEach(((t,i)=>{t._idx=i})),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(!1!==this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})){for(let t=0,i=this.data.datasets.length;t<i;++t)this.getDatasetMeta(t).controller.configure();for(let i=0,e=this.data.datasets.length;i<e;++i)this._updateDataset(i,ot(t)?t({datasetIndex:i}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,i){const e=this.getDatasetMeta(t),s={meta:e,index:t,mode:i,cancelable:!0};!1!==this.notifyPlugins("beforeDatasetUpdate",s)&&(e.controller._update(i),s.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",s))}render(){!1!==this.notifyPlugins("beforeRender",{cancelable:!0})&&(qi.has(this)?this.attached&&!qi.running(this)&&qi.start(this):(this.draw(),Is({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){const{width:t,height:i}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(t,i)}if(this.clear(),this.width<=0||this.height<=0)return;if(!1===this.notifyPlugins("beforeDraw",{cancelable:!0}))return;const i=this._layers;for(t=0;t<i.length&&i[t].z<=0;++t)i[t].draw(this.chartArea);for(this._drawDatasets();t<i.length;++t)i[t].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(t){const i=this._sortedMetasets,e=[];let s,n;for(s=0,n=i.length;s<n;++s){const n=i[s];t&&!n.visible||e.push(n)}return e}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(!1===this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0}))return;const t=this.getSortedVisibleDatasetMetas();for(let i=t.length-1;i>=0;--i)this._drawDataset(t[i]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const i=this.ctx,e={meta:t,index:t.index,cancelable:!0},s=function(t,i){const e=i._clip;if(e.disabled)return!1;const s=function(t,i){const{xScale:e,yScale:s}=t;return e&&s?{left:Ki(e,i,"left"),right:Ki(e,i,"right"),top:Ki(s,i,"top"),bottom:Ki(s,i,"bottom")}:i}(i,t.chartArea);return{left:!1===e.left?0:s.left-(!0===e.left?0:e.left),right:!1===e.right?t.width:s.right+(!0===e.right?0:e.right),top:!1===e.top?0:s.top-(!0===e.top?0:e.top),bottom:!1===e.bottom?t.height:s.bottom+(!0===e.bottom?0:e.bottom)}}(this,t);!1!==this.notifyPlugins("beforeDatasetDraw",e)&&(s&&ri(i,s),t.controller.draw(),s&&oi(i),e.cancelable=!1,this.notifyPlugins("afterDatasetDraw",e))}isPointInArea(t){return ni(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,i,e,s){const n=De.modes[i];return"function"==typeof n?n(this,t,e,s):[]}getDatasetMeta(t){const i=this.data.datasets[t],e=this._metasets;let s=e.filter((t=>t&&t._dataset===i)).pop();return s||(s={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:i&&i.order||0,index:t,_dataset:i,_parsed:[],_sorted:!1},e.push(s)),s}getContext(){return this.$context||(this.$context=yi(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const i=this.data.datasets[t];if(!i)return!1;const e=this.getDatasetMeta(t);return"boolean"==typeof e.hidden?!e.hidden:!i.hidden}setDatasetVisibility(t,i){this.getDatasetMeta(t).hidden=!i}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,i,e){const s=e?"show":"hide",n=this.getDatasetMeta(t),r=n.controller._resolveAnimations(void 0,s);rt(i)?(n.data[i].hidden=!e,this.update()):(this.setDatasetVisibility(t,e),r.update(n,{visible:e}),this.update((i=>i.datasetIndex===t?s:void 0)))}hide(t,i){this._updateVisibility(t,i,!1)}show(t,i){this._updateVisibility(t,i,!0)}_destroyDatasetMeta(t){const i=this._metasets[t];i&&i.controller&&i.controller._destroy(),delete this._metasets[t]}_stop(){let t,i;for(this.stop(),qi.remove(this),t=0,i=this.data.datasets.length;t<i;++t)this._destroyDatasetMeta(t)}destroy(){this.notifyPlugins("beforeDestroy");const{canvas:t,ctx:i}=this;this._stop(),this.config.clearCache(),t&&(this.unbindEvents(),ii(t,i),this.platform.releaseContext(i),this.canvas=null,this.ctx=null),delete Ns[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...t){return this.canvas.toDataURL(...t)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){const t=this._listeners,i=this.platform,e=(e,s)=>{i.addEventListener(this,e,s),t[e]=s},s=(t,i,e)=>{t.offsetX=i,t.offsetY=e,this._eventHandler(t)};Z(this.options.events,(t=>e(t,s)))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,i=this.platform,e=(e,s)=>{i.addEventListener(this,e,s),t[e]=s},s=(e,s)=>{t[e]&&(i.removeEventListener(this,e,s),delete t[e])},n=(t,i)=>{this.canvas&&this.resize(t,i)};let r;const o=()=>{s("attach",o),this.attached=!0,this.resize(),e("resize",n),e("detach",r)};r=()=>{this.attached=!1,s("resize",n),this._stop(),this._resize(0,0),e("attach",o)},i.isAttached(this.canvas)?o():r()}unbindEvents(){Z(this._listeners,((t,i)=>{this.platform.removeEventListener(this,i,t)})),this._listeners={},Z(this._responsiveListeners,((t,i)=>{this.platform.removeEventListener(this,i,t)})),this._responsiveListeners=void 0}updateHoverStyle(t,i,e){const s=e?"set":"remove";let n,r,o,h;for("dataset"===i&&(n=this.getDatasetMeta(t[0].datasetIndex),n.controller["_"+s+"DatasetHoverStyle"]()),o=0,h=t.length;o<h;++o){r=t[o];const i=r&&this.getDatasetMeta(r.datasetIndex).controller;i&&i[s+"HoverStyle"](r.element,r.datasetIndex,r.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){const i=this._active||[],e=t.map((({datasetIndex:t,index:i})=>{const e=this.getDatasetMeta(t);if(!e)throw new Error("No dataset found at index "+t);return{datasetIndex:t,element:e.data[i],index:i}}));!K(e,i)&&(this._active=e,this._lastEvent=null,this._updateHoverStyles(e,i))}notifyPlugins(t,i,e){return this._plugins.notify(this,t,i,e)}isPluginEnabled(t){return 1===this._plugins._cache.filter((i=>i.plugin.id===t)).length}_updateHoverStyles(t,i,e){const s=this.options.hover,n=(t,i)=>t.filter((t=>!i.some((i=>t.datasetIndex===i.datasetIndex&&t.index===i.index)))),r=n(i,t),o=e?t:n(t,i);r.length&&this.updateHoverStyle(r,s.mode,!1),o.length&&s.mode&&this.updateHoverStyle(o,s.mode,!0)}_eventHandler(t,i){const e={event:t,replay:i,cancelable:!0,inChartArea:this.isPointInArea(t)},s=i=>(i.options.events||this.options.events).includes(t.native.type);if(!1===this.notifyPlugins("beforeEvent",e,s))return;const n=this._handleEvent(t,i,e.inChartArea);return e.cancelable=!1,this.notifyPlugins("afterEvent",e,s),(n||e.changed)&&this.render(),this}_handleEvent(t,i,e){const{_active:s=[],options:n}=this,r=this._getActiveElements(t,s,e,i),o=function(t){return"mouseup"===t.type||"click"===t.type||"contextmenu"===t.type}(t),h=function(t,i,e,s){return e&&"mouseout"!==t.type?s?i:t:null}(t,this._lastEvent,e,o);e&&(this._lastEvent=null,U(n.onHover,[t,r,this],this),o&&U(n.onClick,[t,r,this],this));const a=!K(r,s);return(a||i)&&(this._active=r,this._updateHoverStyles(r,s,i)),this._lastEvent=h,a}_getActiveElements(t,i,e,s){if("mouseout"===t.type)return[];if(!e)return i;const n=this.options.hover;return this.getElementsAtEventForMode(t,n.mode,n,s)}}function $s(){return Z(Hs.instances,(t=>t._plugins.invalidate()))}function Ys(t,i){const{x:e,y:s,base:n,width:r,height:o}=t.getProps(["x","y","base","width","height"],i);let h,a,c,l,u;return t.horizontal?(u=o/2,h=Math.min(e,n),a=Math.max(e,n),c=s-u,l=s+u):(u=r/2,h=e-u,a=e+u,c=Math.min(s,n),l=Math.max(s,n)),{left:h,top:c,right:a,bottom:l}}function Vs(t,i,e,s){return t?0:kt(i,e,s)}function Xs(t,i,e,s){const n=null===i,r=null===e,o=t&&!(n&&r)&&Ys(t,s);return o&&(n||Ot(i,o.left,o.right))&&(r||Ot(e,o.top,o.bottom))}function Us(t,i){t.rect(i.x,i.y,i.w,i.h)}function Zs(t,i,e={}){const s=t.x!==e.x?-i:0,n=t.y!==e.y?-i:0;return{x:t.x+s,y:t.y+n,w:t.w+((t.x+t.w!==e.x+e.w?i:0)-s),h:t.h+((t.y+t.h!==e.y+e.h?i:0)-n),radius:t.radius}}const Ks=["rgb(54, 162, 235)","rgb(255, 99, 132)","rgb(255, 159, 64)","rgb(255, 205, 86)","rgb(75, 192, 192)","rgb(153, 102, 255)","rgb(201, 203, 207)"],Qs=Ks.map((t=>t.replace("rgb(","rgba(").replace(")",", 0.5)")));function qs(t){return Ks[t%Ks.length]}function Gs(t){return Qs[t%Qs.length]}function Js(t){let i;for(i in t)if(t[i].borderColor||t[i].backgroundColor)return!0;return!1}var tn={id:"colors",defaults:{enabled:!0,forceOverride:!1},beforeLayout(t,i,e){if(!e.enabled)return;const{data:{datasets:s},options:n}=t.config,{elements:r}=n,o=Js(s)||(h=n)&&(h.borderColor||h.backgroundColor)||r&&Js(r)||"rgba(0,0,0,0.1)"!==Gt.borderColor||"rgba(0,0,0,0.1)"!==Gt.backgroundColor;var h;if(!e.forceOverride&&o)return;const a=function(t){let i=0;return(e,s)=>{const n=t.getDatasetMeta(s).controller;n instanceof Me?i=function(t,i){return t.backgroundColor=t.data.map((()=>qs(i++))),i}(e,i):n instanceof we?i=function(t,i){return t.backgroundColor=t.data.map((()=>Gs(i++))),i}(e,i):n&&(i=function(t,i){return t.borderColor=qs(i),t.backgroundColor=Gs(i),++i}(e,i))}}(t);s.forEach(a)}};const en=(t,i)=>{let{boxHeight:e=i,boxWidth:s=i}=t;return t.usePointStyle&&(e=Math.min(e,i),s=t.pointStyleWidth||Math.min(s,i)),{boxWidth:s,boxHeight:e,itemHeight:Math.max(i,e)}};class sn extends ns{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,i,e){this.maxWidth=t,this.maxHeight=i,this._margins=e,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const t=this.options.labels||{};let i=U(t.generateLabels,[this.chart],this)||[];t.filter&&(i=i.filter((i=>t.filter(i,this.chart.data)))),t.sort&&(i=i.sort(((i,e)=>t.sort(i,e,this.chart.data)))),this.options.reverse&&i.reverse(),this.legendItems=i}fit(){const{options:t,ctx:i}=this;if(!t.display)return void(this.width=this.height=0);const e=t.labels,s=xi(e.font),n=s.size,r=this._computeTitleHeight(),{boxWidth:o,itemHeight:h}=en(e,n);let a,c;i.font=s.string,this.isHorizontal()?(a=this.maxWidth,c=this._fitRows(r,n,o,h)+10):(c=this.maxHeight,a=this._fitCols(r,s,o,h)+10),this.width=Math.min(a,t.maxWidth||this.maxWidth),this.height=Math.min(c,t.maxHeight||this.maxHeight)}_fitRows(t,i,e,s){const{ctx:n,maxWidth:r,options:{labels:{padding:o}}}=this,h=this.legendHitBoxes=[],a=this.lineWidths=[0],c=s+o;let l=t;n.textAlign="left",n.textBaseline="middle";let u=-1,f=-c;return this.legendItems.forEach(((t,d)=>{const b=e+i/2+n.measureText(t.text).width;(0===d||a[a.length-1]+b+2*o>r)&&(l+=c,a[a.length-(d>0?0:1)]=0,f+=c,u++),h[d]={left:0,top:f,row:u,width:b,height:s},a[a.length-1]+=b+o})),l}_fitCols(t,i,e,s){const{ctx:n,maxHeight:r,options:{labels:{padding:o}}}=this,h=this.legendHitBoxes=[],a=this.columnSizes=[],c=r-t;let l=o,u=0,f=0,d=0,b=0;return this.legendItems.forEach(((t,r)=>{const{itemWidth:g,itemHeight:p}=function(t,i,e,s,n){const r=function(t,i,e,s){let n=t.text;return n&&"string"!=typeof n&&(n=n.reduce(((t,i)=>t.length>i.length?t:i))),i+e.size/2+s.measureText(n).width}(s,t,i,e),o=function(t,i,e){let s=t;return"string"!=typeof i.text&&(s=nn(i,e)),s}(n,s,i.lineHeight);return{itemWidth:r,itemHeight:o}}(e,i,n,t,s);r>0&&f+p+2*o>c&&(l+=u+o,a.push({width:u,height:f}),d+=u+o,b++,u=f=0),h[r]={left:d,top:f,col:b,width:g,height:p},u=Math.max(u,g),f+=p+o})),l+=u,a.push({width:u,height:f}),l}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:i,options:{align:e,labels:{padding:s},rtl:n}}=this,r=Xi(n,this.left,this.width);if(this.isHorizontal()){let n=0,o=Pt(e,this.left+s,this.right-this.lineWidths[n]);for(const h of i)n!==h.row&&(n=h.row,o=Pt(e,this.left+s,this.right-this.lineWidths[n])),h.top+=this.top+t+s,h.left=r.leftForLtr(r.x(o),h.width),o+=h.width+s}else{let n=0,o=Pt(e,this.top+t+s,this.bottom-this.columnSizes[n].height);for(const h of i)h.col!==n&&(n=h.col,o=Pt(e,this.top+t+s,this.bottom-this.columnSizes[n].height)),h.top=o,h.left+=this.left+s,h.left=r.leftForLtr(r.x(h.left),h.width),o+=h.height+s}}isHorizontal(){return"top"===this.options.position||"bottom"===this.options.position}draw(){if(this.options.display){const t=this.ctx;ri(t,this),this._draw(),oi(t)}}_draw(){const{options:t,columnSizes:i,lineWidths:e,ctx:s}=this,{align:n,labels:r}=t,o=Gt.color,h=Xi(t.rtl,this.left,this.width),a=xi(r.font),{padding:c}=r,l=a.size,u=l/2;let f;this.drawTitle(),s.textAlign=h.textAlign("left"),s.textBaseline="middle",s.lineWidth=.5,s.font=a.string;const{boxWidth:d,boxHeight:b,itemHeight:g}=en(r,l),p=this.isHorizontal(),m=this._computeTitleHeight();f=p?{x:Pt(n,this.left+c,this.right-e[0]),y:this.top+c+m,line:0}:{x:this.left+c,y:Pt(n,this.top+m+c,this.bottom-i[0].height),line:0},Ui(this.ctx,t.textDirection);const x=g+c;this.legendItems.forEach(((v,y)=>{s.strokeStyle=v.fontColor,s.fillStyle=v.fontColor;const M=s.measureText(v.text).width,w=h.textAlign(v.textAlign||(v.textAlign=r.textAlign)),_=d+u+M;let k=f.x,O=f.y;h.setWidth(this.width),p?y>0&&k+_+c>this.right&&(O=f.y+=x,f.line++,k=f.x=Pt(n,this.left+c,this.right-e[f.line])):y>0&&O+x>this.bottom&&(k=f.x=k+i[f.line].width+c,f.line++,O=f.y=Pt(n,this.top+m+c,this.bottom-i[f.line].height)),function(t,i,e){if(isNaN(d)||d<=0||isNaN(b)||b<0)return;s.save();const n=V(e.lineWidth,1);if(s.fillStyle=V(e.fillStyle,o),s.lineCap=V(e.lineCap,"butt"),s.lineDashOffset=V(e.lineDashOffset,0),s.lineJoin=V(e.lineJoin,"miter"),s.lineWidth=n,s.strokeStyle=V(e.strokeStyle,o),s.setLineDash(V(e.lineDash,[])),r.usePointStyle){const o={radius:b*Math.SQRT2/2,pointStyle:e.pointStyle,rotation:e.rotation,borderWidth:n},a=h.xPlus(t,d/2);si(s,o,a,i+u,r.pointStyleWidth&&d)}else{const r=i+Math.max((l-b)/2,0),o=h.leftForLtr(t,d),a=pi(e.borderRadius);s.beginPath(),Object.values(a).some((t=>0!==t))?li(s,{x:o,y:r,w:d,h:b,radius:a}):s.rect(o,r,d,b),s.fill(),0!==n&&s.stroke()}s.restore()}(h.x(k),O,v),k=((t,i,e,s)=>t===(s?"left":"right")?e:"center"===t?(i+e)/2:i)(w,k+d+u,p?k+_:this.right,t.rtl),function(t,i,e){ci(s,e.text,t,i+g/2,a,{strikethrough:e.hidden,textAlign:h.textAlign(e.textAlign)})}(h.x(k),O,v),p?f.x+=_+c:f.y+="string"!=typeof v.text?nn(v,a.lineHeight)+c:x})),Zi(this.ctx,t.textDirection)}drawTitle(){const t=this.options,i=t.title,e=xi(i.font),s=mi(i.padding);if(!i.display)return;const n=Xi(t.rtl,this.left,this.width),r=this.ctx,o=i.position,h=s.top+e.size/2;let a,c=this.left,l=this.width;if(this.isHorizontal())l=Math.max(...this.lineWidths),a=this.top+h,c=Pt(t.align,c,this.right-l);else{const i=this.columnSizes.reduce(((t,i)=>Math.max(t,i.height)),0);a=h+Pt(t.align,this.top,this.bottom-i-t.labels.padding-this._computeTitleHeight())}const u=Pt(o,c,c+l);r.textAlign=n.textAlign(Lt(o)),r.textBaseline="middle",r.strokeStyle=i.color,r.fillStyle=i.color,r.font=e.string,ci(r,i.text,u,a,e)}_computeTitleHeight(){const t=this.options.title,i=xi(t.font),e=mi(t.padding);return t.display?i.lineHeight+e.height:0}_getLegendItemAt(t,i){let e,s,n;if(Ot(t,this.left,this.right)&&Ot(i,this.top,this.bottom))for(n=this.legendHitBoxes,e=0;e<n.length;++e)if(s=n[e],Ot(t,s.left,s.left+s.width)&&Ot(i,s.top,s.top+s.height))return this.legendItems[e];return null}handleEvent(t){const i=this.options;if(!function(t,i){return!("mousemove"!==t&&"mouseout"!==t||!i.onHover&&!i.onLeave)||!(!i.onClick||"click"!==t&&"mouseup"!==t)}(t.type,i))return;const e=this._getLegendItemAt(t.x,t.y);if("mousemove"===t.type||"mouseout"===t.type){const r=this._hoveredItem,o=(n=e,null!==(s=r)&&null!==n&&s.datasetIndex===n.datasetIndex&&s.index===n.index);r&&!o&&U(i.onLeave,[t,r,this],this),this._hoveredItem=e,e&&!o&&U(i.onHover,[t,e,this],this)}else e&&U(i.onClick,[t,e,this],this);var s,n}}function nn(t,i){return i*(t.text?t.text.length:0)}var rn={id:"legend",_element:sn,start(t,i,e){const s=t.legend=new sn({ctx:t.ctx,options:e,chart:t});We.configure(t,s,e),We.addBox(t,s)},stop(t){We.removeBox(t,t.legend),delete t.legend},beforeUpdate(t,i,e){const s=t.legend;We.configure(t,s,e),s.options=e},afterUpdate(t){const i=t.legend;i.buildLabels(),i.adjustHitBoxes()},afterEvent(t,i){i.replay||t.legend.handleEvent(i.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(t,i,e){const s=i.datasetIndex,n=e.chart;n.isDatasetVisible(s)?(n.hide(s),i.hidden=!0):(n.show(s),i.hidden=!1)},onHover:null,onLeave:null,labels:{color:t=>t.chart.options.color,boxWidth:40,padding:10,generateLabels(t){const i=t.data.datasets,{labels:{usePointStyle:e,pointStyle:s,textAlign:n,color:r,useBorderRadius:o,borderRadius:h}}=t.legend.options;return t._getSortedDatasetMetas().map((t=>{const a=t.controller.getStyle(e?0:void 0),c=mi(a.borderWidth);return{text:i[t.index].label,fillStyle:a.backgroundColor,fontColor:r,hidden:!t.visible,lineCap:a.borderCapStyle,lineDash:a.borderDash,lineDashOffset:a.borderDashOffset,lineJoin:a.borderJoinStyle,lineWidth:(c.width+c.height)/4,strokeStyle:a.borderColor,pointStyle:s||a.pointStyle,rotation:a.rotation,textAlign:n||a.textAlign,borderRadius:o&&(h||a.borderRadius),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 on extends ns{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,i){const e=this.options;if(this.left=0,this.top=0,!e.display)return void(this.width=this.height=this.right=this.bottom=0);this.width=this.right=t,this.height=this.bottom=i;const s=z(e.text)?e.text.length:1;this._padding=mi(e.padding);const n=s*xi(e.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=n:this.width=n}isHorizontal(){const t=this.options.position;return"top"===t||"bottom"===t}_drawArgs(t){const{top:i,left:e,bottom:s,right:n,options:r}=this,o=r.align;let h,a,c,l=0;return this.isHorizontal()?(a=Pt(o,e,n),c=i+t,h=n-e):("left"===r.position?(a=e+t,c=Pt(o,s,i),l=-.5*at):(a=n-t,c=Pt(o,i,s),l=.5*at),h=s-i),{titleX:a,titleY:c,maxWidth:h,rotation:l}}draw(){const t=this.ctx,i=this.options;if(!i.display)return;const e=xi(i.font),s=e.lineHeight/2+this._padding.top,{titleX:n,titleY:r,maxWidth:o,rotation:h}=this._drawArgs(s);ci(t,i.text,0,0,e,{color:i.color,maxWidth:o,rotation:h,textAlign:Lt(i.align),textBaseline:"middle",translation:[n,r]})}}var hn={id:"title",_element:on,start(t,i,e){!function(t,i){const e=new on({ctx:t.ctx,options:i,chart:t});We.configure(t,e,i),We.addBox(t,e),t.titleBlock=e}(t,e)},stop(t){We.removeBox(t,t.titleBlock),delete t.titleBlock},beforeUpdate(t,i,e){const s=t.titleBlock;We.configure(t,s,e),s.options=e},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 an={average(t){if(!t.length)return!1;let i,e,s=new Set,n=0,r=0;for(i=0,e=t.length;i<e;++i){const e=t[i].element;if(e&&e.hasValue()){const t=e.tooltipPosition();s.add(t.x),n+=t.y,++r}}return 0!==r&&0!==s.size&&{x:[...s].reduce(((t,i)=>t+i))/s.size,y:n/r}},nearest(t,i){if(!t.length)return!1;let e,s,n,r=i.x,o=i.y,h=Number.POSITIVE_INFINITY;for(e=0,s=t.length;e<s;++e){const s=t[e].element;if(s&&s.hasValue()){const t=(a=i,c=s.getCenterPoint(),Math.sqrt(Math.pow(c.x-a.x,2)+Math.pow(c.y-a.y,2)));t<h&&(h=t,n=s)}}var a,c;if(n){const t=n.tooltipPosition();r=t.x,o=t.y}return{x:r,y:o}}};function cn(t,i){return i&&(z(i)?Array.prototype.push.apply(t,i):t.push(i)),t}function ln(t){return("string"==typeof t||t instanceof String)&&t.indexOf("\n")>-1?t.split("\n"):t}function un(t,i){const{element:e,datasetIndex:s,index:n}=i,r=t.getDatasetMeta(s).controller,{label:o,value:h}=r.getLabelAndValue(n);return{chart:t,label:o,parsed:r.getParsed(n),raw:t.data.datasets[s].data[n],formattedValue:h,dataset:r.getDataset(),dataIndex:n,datasetIndex:s,element:e}}function fn(t,i){const e=t.chart.ctx,{body:s,footer:n,title:r}=t,{boxWidth:o,boxHeight:h}=i,a=xi(i.bodyFont),c=xi(i.titleFont),l=xi(i.footerFont),u=r.length,f=n.length,d=s.length,b=mi(i.padding);let g=b.height,p=0,m=s.reduce(((t,i)=>t+i.before.length+i.lines.length+i.after.length),0);m+=t.beforeBody.length+t.afterBody.length,u&&(g+=u*c.lineHeight+(u-1)*i.titleSpacing+i.titleMarginBottom),m&&(g+=d*(i.displayColors?Math.max(h,a.lineHeight):a.lineHeight)+(m-d)*a.lineHeight+(m-1)*i.bodySpacing),f&&(g+=i.footerMarginTop+f*l.lineHeight+(f-1)*i.footerSpacing);let x=0;const v=function(t){p=Math.max(p,e.measureText(t).width+x)};return e.save(),e.font=c.string,Z(t.title,v),e.font=a.string,Z(t.beforeBody.concat(t.afterBody),v),x=i.displayColors?o+2+i.boxPadding:0,Z(s,(t=>{Z(t.before,v),Z(t.lines,v),Z(t.after,v)})),x=0,e.font=l.string,Z(t.footer,v),e.restore(),p+=b.width,{width:p,height:g}}function dn(t,i,e,s){const{x:n,width:r}=e,{width:o,chartArea:{left:h,right:a}}=t;let c="center";return"center"===s?c=n<=(h+a)/2?"left":"right":n<=r/2?c="left":n>=o-r/2&&(c="right"),function(t,i,e,s){const{x:n,width:r}=s,o=e.caretSize+e.caretPadding;return"left"===t&&n+r+o>i.width||"right"===t&&n-r-o<0||void 0}(c,t,i,e)&&(c="center"),c}function bn(t,i,e){const s=e.yAlign||i.yAlign||function(t,i){const{y:e,height:s}=i;return e<s/2?"top":e>t.height-s/2?"bottom":"center"}(t,e);return{xAlign:e.xAlign||i.xAlign||dn(t,i,e,s),yAlign:s}}function gn(t,i,e,s){const{caretSize:n,caretPadding:r,cornerRadius:o}=t,{xAlign:h,yAlign:a}=e,c=n+r,{topLeft:l,topRight:u,bottomLeft:f,bottomRight:d}=pi(o);let b=function(t,i){let{x:e,width:s}=t;return"right"===i?e-=s:"center"===i&&(e-=s/2),e}(i,h);const g=function(t,i,e){let{y:s,height:n}=t;return"top"===i?s+=e:s-="bottom"===i?n+e:n/2,s}(i,a,c);return"center"===a?"left"===h?b+=c:"right"===h&&(b-=c):"left"===h?b-=Math.max(l,f)+n:"right"===h&&(b+=Math.max(u,d)+n),{x:kt(b,0,s.width-i.width),y:kt(g,0,s.height-i.height)}}function pn(t,i,e){const s=mi(e.padding);return"center"===i?t.x+t.width/2:"right"===i?t.x+t.width-s.right:t.x+s.left}function mn(t){return cn([],ln(t))}function xn(t,i){const e=i&&i.dataset&&i.dataset.tooltip&&i.dataset.tooltip.callbacks;return e?t.override(e):t}const vn={beforeTitle:B,title(t){if(t.length>0){const i=t[0],e=i.chart.data.labels,s=e?e.length:0;if(this&&this.options&&"dataset"===this.options.mode)return i.dataset.label||"";if(i.label)return i.label;if(s>0&&i.dataIndex<s)return e[i.dataIndex]}return""},afterTitle:B,beforeBody:B,beforeLabel:B,label(t){if(this&&this.options&&"dataset"===this.options.mode)return t.label+": "+t.formattedValue||t.formattedValue;let i=t.dataset.label||"";i&&(i+=": ");const e=t.formattedValue;return W(e)||(i+=e),i},labelColor(t){const i=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{borderColor:i.borderColor,backgroundColor:i.backgroundColor,borderWidth:i.borderWidth,borderDash:i.borderDash,borderDashOffset:i.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(t){const i=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{pointStyle:i.pointStyle,rotation:i.rotation}},afterLabel:B,afterBody:B,beforeFooter:B,footer:B,afterFooter:B};function yn(t,i,e,s){const n=t[i].call(e,s);return void 0===n?vn[i].call(e,s):n}class Mn extends ns{static positioners=an;constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const i=this.chart,e=this.options.setContext(this.getContext()),s=e.enabled&&i.options.animation&&e.animations,n=new ie(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(n)),n}getContext(){return this.$context||(this.$context=yi(this.chart.getContext(),{tooltip:this,tooltipItems:this._tooltipItems,type:"tooltip"}))}getTitle(t,i){const{callbacks:e}=i,s=yn(e,"beforeTitle",this,t),n=yn(e,"title",this,t),r=yn(e,"afterTitle",this,t);let o=[];return o=cn(o,ln(s)),o=cn(o,ln(n)),o=cn(o,ln(r)),o}getBeforeBody(t,i){return mn(yn(i.callbacks,"beforeBody",this,t))}getBody(t,i){const{callbacks:e}=i,s=[];return Z(t,(t=>{const i={before:[],lines:[],after:[]},n=xn(e,t);cn(i.before,ln(yn(n,"beforeLabel",this,t))),cn(i.lines,yn(n,"label",this,t)),cn(i.after,ln(yn(n,"afterLabel",this,t))),s.push(i)})),s}getAfterBody(t,i){return mn(yn(i.callbacks,"afterBody",this,t))}getFooter(t,i){const{callbacks:e}=i,s=yn(e,"beforeFooter",this,t),n=yn(e,"footer",this,t),r=yn(e,"afterFooter",this,t);let o=[];return o=cn(o,ln(s)),o=cn(o,ln(n)),o=cn(o,ln(r)),o}_createItems(t){const i=this._active,e=this.chart.data,s=[],n=[],r=[];let o,h,a=[];for(o=0,h=i.length;o<h;++o)a.push(un(this.chart,i[o]));return t.filter&&(a=a.filter(((i,s,n)=>t.filter(i,s,n,e)))),t.itemSort&&(a=a.sort(((i,s)=>t.itemSort(i,s,e)))),Z(a,(i=>{const e=xn(t.callbacks,i);s.push(yn(e,"labelColor",this,i)),n.push(yn(e,"labelPointStyle",this,i)),r.push(yn(e,"labelTextColor",this,i))})),this.labelColors=s,this.labelPointStyles=n,this.labelTextColors=r,this.dataPoints=a,a}update(t,i){const e=this.options.setContext(this.getContext()),s=this._active;let n,r=[];if(s.length){const t=an[e.position].call(this,s,this._eventPosition);r=this._createItems(e),this.title=this.getTitle(r,e),this.beforeBody=this.getBeforeBody(r,e),this.body=this.getBody(r,e),this.afterBody=this.getAfterBody(r,e),this.footer=this.getFooter(r,e);const i=this._size=fn(this,e),o=Object.assign({},t,i),h=bn(this.chart,e,o),a=gn(e,o,h,this.chart);this.xAlign=h.xAlign,this.yAlign=h.yAlign,n={opacity:1,x:a.x,y:a.y,width:i.width,height:i.height,caretX:t.x,caretY:t.y}}else 0!==this.opacity&&(n={opacity:0});this._tooltipItems=r,this.$context=void 0,n&&this._resolveAnimations().update(this,n),t&&e.external&&e.external.call(this,{chart:this.chart,tooltip:this,replay:i})}drawCaret(t,i,e,s){const n=this.getCaretPosition(t,e,s);i.lineTo(n.x1,n.y1),i.lineTo(n.x2,n.y2),i.lineTo(n.x3,n.y3)}getCaretPosition(t,i,e){const{xAlign:s,yAlign:n}=this,{caretSize:r,cornerRadius:o}=e,{topLeft:h,topRight:a,bottomLeft:c,bottomRight:l}=pi(o),{x:u,y:f}=t,{width:d,height:b}=i;let g,p,m,x,v,y;return"center"===n?(v=f+b/2,"left"===s?(g=u,p=g-r,x=v+r,y=v-r):(g=u+d,p=g+r,x=v-r,y=v+r),m=g):(p="left"===s?u+Math.max(h,c)+r:"right"===s?u+d-Math.max(a,l)-r:this.caretX,"top"===n?(x=f,v=x-r,g=p-r,m=p+r):(x=f+b,v=x+r,g=p+r,m=p-r),y=x),{x1:g,x2:p,x3:m,y1:x,y2:v,y3:y}}drawTitle(t,i,e){const s=this.title,n=s.length;let r,o,h;if(n){const a=Xi(e.rtl,this.x,this.width);for(t.x=pn(this,e.titleAlign,e),i.textAlign=a.textAlign(e.titleAlign),i.textBaseline="middle",r=xi(e.titleFont),o=e.titleSpacing,i.fillStyle=e.titleColor,i.font=r.string,h=0;h<n;++h)i.fillText(s[h],a.x(t.x),t.y+r.lineHeight/2),t.y+=r.lineHeight+o,h+1===n&&(t.y+=e.titleMarginBottom-o)}}_drawColorBox(t,i,e,s,n){const r=this.labelColors[e],o=this.labelPointStyles[e],{boxHeight:h,boxWidth:a}=n,c=xi(n.bodyFont),l=pn(this,"left",n),u=s.x(l),f=i.y+(h<c.lineHeight?(c.lineHeight-h)/2:0);if(n.usePointStyle){const i={radius:Math.min(a,h)/2,pointStyle:o.pointStyle,rotation:o.rotation,borderWidth:1},e=s.leftForLtr(u,a)+a/2,c=f+h/2;t.strokeStyle=n.multiKeyBackground,t.fillStyle=n.multiKeyBackground,ei(t,i,e,c),t.strokeStyle=r.borderColor,t.fillStyle=r.backgroundColor,ei(t,i,e,c)}else{t.lineWidth=H(r.borderWidth)?Math.max(...Object.values(r.borderWidth)):r.borderWidth||1,t.strokeStyle=r.borderColor,t.setLineDash(r.borderDash||[]),t.lineDashOffset=r.borderDashOffset||0;const i=s.leftForLtr(u,a),e=s.leftForLtr(s.xPlus(u,1),a-2),o=pi(r.borderRadius);Object.values(o).some((t=>0!==t))?(t.beginPath(),t.fillStyle=n.multiKeyBackground,li(t,{x:i,y:f,w:a,h,radius:o}),t.fill(),t.stroke(),t.fillStyle=r.backgroundColor,t.beginPath(),li(t,{x:e,y:f+1,w:a-2,h:h-2,radius:o}),t.fill()):(t.fillStyle=n.multiKeyBackground,t.fillRect(i,f,a,h),t.strokeRect(i,f,a,h),t.fillStyle=r.backgroundColor,t.fillRect(e,f+1,a-2,h-2))}t.fillStyle=this.labelTextColors[e]}drawBody(t,i,e){const{body:s}=this,{bodySpacing:n,bodyAlign:r,displayColors:o,boxHeight:h,boxWidth:a,boxPadding:c}=e,l=xi(e.bodyFont);let u=l.lineHeight,f=0;const d=Xi(e.rtl,this.x,this.width),b=function(e){i.fillText(e,d.x(t.x+f),t.y+u/2),t.y+=u+n},g=d.textAlign(r);let p,m,x,v,y,M,w;for(i.textAlign=r,i.textBaseline="middle",i.font=l.string,t.x=pn(this,g,e),i.fillStyle=e.bodyColor,Z(this.beforeBody,b),f=o&&"right"!==g?"center"===r?a/2+c:a+2+c:0,v=0,M=s.length;v<M;++v){for(p=s[v],m=this.labelTextColors[v],i.fillStyle=m,Z(p.before,b),x=p.lines,o&&x.length&&(this._drawColorBox(i,t,v,d,e),u=Math.max(l.lineHeight,h)),y=0,w=x.length;y<w;++y)b(x[y]),u=l.lineHeight;Z(p.after,b)}f=0,u=l.lineHeight,Z(this.afterBody,b),t.y-=n}drawFooter(t,i,e){const s=this.footer,n=s.length;let r,o;if(n){const h=Xi(e.rtl,this.x,this.width);for(t.x=pn(this,e.footerAlign,e),t.y+=e.footerMarginTop,i.textAlign=h.textAlign(e.footerAlign),i.textBaseline="middle",r=xi(e.footerFont),i.fillStyle=e.footerColor,i.font=r.string,o=0;o<n;++o)i.fillText(s[o],h.x(t.x),t.y+r.lineHeight/2),t.y+=r.lineHeight+e.footerSpacing}}drawBackground(t,i,e,s){const{xAlign:n,yAlign:r}=this,{x:o,y:h}=t,{width:a,height:c}=e,{topLeft:l,topRight:u,bottomLeft:f,bottomRight:d}=pi(s.cornerRadius);i.fillStyle=s.backgroundColor,i.strokeStyle=s.borderColor,i.lineWidth=s.borderWidth,i.beginPath(),i.moveTo(o+l,h),"top"===r&&this.drawCaret(t,i,e,s),i.lineTo(o+a-u,h),i.quadraticCurveTo(o+a,h,o+a,h+u),"center"===r&&"right"===n&&this.drawCaret(t,i,e,s),i.lineTo(o+a,h+c-d),i.quadraticCurveTo(o+a,h+c,o+a-d,h+c),"bottom"===r&&this.drawCaret(t,i,e,s),i.lineTo(o+f,h+c),i.quadraticCurveTo(o,h+c,o,h+c-f),"center"===r&&"left"===n&&this.drawCaret(t,i,e,s),i.lineTo(o,h+l),i.quadraticCurveTo(o,h,o+l,h),i.closePath(),i.fill(),s.borderWidth>0&&i.stroke()}_updateAnimationTarget(t){const i=this.chart,e=this.$animations,s=e&&e.x,n=e&&e.y;if(s||n){const e=an[t.position].call(this,this._active,this._eventPosition);if(!e)return;const r=this._size=fn(this,t),o=Object.assign({},e,this._size),h=bn(i,t,o),a=gn(t,o,h,i);s._to===a.x&&n._to===a.y||(this.xAlign=h.xAlign,this.yAlign=h.yAlign,this.width=r.width,this.height=r.height,this.caretX=e.x,this.caretY=e.y,this._resolveAnimations().update(this,a))}}_willRender(){return!!this.opacity}draw(t){const i=this.options.setContext(this.getContext());let e=this.opacity;if(!e)return;this._updateAnimationTarget(i);const s={width:this.width,height:this.height},n={x:this.x,y:this.y};e=Math.abs(e)<.001?0:e;const r=mi(i.padding);i.enabled&&(this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length)&&(t.save(),t.globalAlpha=e,this.drawBackground(n,t,s,i),Ui(t,i.textDirection),n.y+=r.top,this.drawTitle(n,t,i),this.drawBody(n,t,i),this.drawFooter(n,t,i),Zi(t,i.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,i){const e=this._active,s=t.map((({datasetIndex:t,index:i})=>{const e=this.chart.getDatasetMeta(t);if(!e)throw new Error("Cannot find a dataset at index "+t);return{datasetIndex:t,element:e.data[i],index:i}})),n=!K(e,s),r=this._positionChanged(s,i);(n||r)&&(this._active=s,this._eventPosition=i,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,i,e=!0){if(i&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const s=this.options,n=this._active||[],r=this._getActiveElements(t,n,i,e),o=this._positionChanged(r,t),h=i||!K(r,n)||o;return h&&(this._active=r,(s.enabled||s.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,i))),h}_getActiveElements(t,i,e,s){const n=this.options;if("mouseout"===t.type)return[];if(!s)return i.filter((t=>this.chart.data.datasets[t.datasetIndex]&&void 0!==this.chart.getDatasetMeta(t.datasetIndex).controller.getParsed(t.index)));const r=this.chart.getElementsAtEventForMode(t,n.mode,n,e);return n.reverse&&r.reverse(),r}_positionChanged(t,i){const{caretX:e,caretY:s,options:n}=this,r=an[n.position].call(this,t,i);return!1!==r&&(e!==r.x||s!==r.y)}}var wn={id:"tooltip",_element:Mn,positioners:an,afterInit(t,i,e){e&&(t.tooltip=new Mn({chart:t,options:e}))},beforeUpdate(t,i,e){t.tooltip&&t.tooltip.initialize(e)},reset(t,i,e){t.tooltip&&t.tooltip.initialize(e)},afterDraw(t){const i=t.tooltip;if(i&&i._willRender()){const e={tooltip:i};if(!1===t.notifyPlugins("beforeTooltipDraw",{...e,cancelable:!0}))return;i.draw(t.ctx),t.notifyPlugins("afterTooltipDraw",e)}},afterEvent(t,i){t.tooltip&&t.tooltip.handleEvent(i.event,i.replay,i.inChartArea)&&(i.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,i)=>i.bodyFont.size,boxWidth:(t,i)=>i.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:vn},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"]};function _n(t){const i=this.getLabels();return t>=0&&t<i.length?i[t]:t}function kn(t,i,{horizontal:e,minRotation:s}){const n=yt(s),r=(e?Math.sin(n):Math.cos(n))||.001;return Math.min(i/r,.75*i*(""+t).length)}class On extends ds{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,i){return W(t)||("number"==typeof t||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:i,maxDefined:e}=this.getUserBounds();let{min:s,max:n}=this;const r=t=>s=i?s:t,o=t=>n=e?n:t;if(t){const t=pt(s),i=pt(n);t<0&&i<0?o(0):t>0&&i>0&&r(0)}if(s===n){let i=0===n?1:Math.abs(.05*n);o(n+i),t||r(s-i)}this.min=s,this.max=n}getTickLimit(){const t=this.options.ticks;let i,{maxTicksLimit:e,stepSize:s}=t;return s?(i=Math.ceil(this.max/s)-Math.floor(this.min/s)+1,i>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${s} would result generating up to ${i} ticks. Limiting to 1000.`),i=1e3)):(i=this.computeTickLimit(),e=e||11),e&&(i=Math.min(e,i)),i}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,i=t.ticks;let e=this.getTickLimit();e=Math.max(2,e);const s=function(t,i){const e=[],{bounds:s,step:n,min:r,max:o,precision:h,count:a,maxTicks:c,maxDigits:l,includeBounds:u}=t,f=n||1,d=c-1,{min:b,max:g}=i,p=!W(r),m=!W(o),x=!W(a),v=(g-b)/(l+1);let y,M,w,_,k=xt((g-b)/d/f)*f;if(k<1e-14&&!p&&!m)return[{value:b},{value:g}];_=Math.ceil(g/k)-Math.floor(b/k),_>d&&(k=xt(_*k/d/f)*f),W(h)||(y=Math.pow(10,h),k=Math.ceil(k*y)/y),"ticks"===s?(M=Math.floor(b/k)*k,w=Math.ceil(g/k)*k):(M=b,w=g),p&&m&&n&&function(t,i){const e=Math.round(t);return e-i<=t&&e+i>=t}((o-r)/n,k/1e3)?(_=Math.round(Math.min((o-r)/k,c)),k=(o-r)/_,M=r,w=o):x?(M=p?r:M,w=m?o:w,_=a-1,k=(w-M)/_):(_=(w-M)/k,_=mt(_,Math.round(_),k/1e3)?Math.round(_):Math.ceil(_));const O=Math.max(Mt(k),Mt(M));y=Math.pow(10,W(h)?O:h),M=Math.round(M*y)/y,w=Math.round(w*y)/y;let S=0;for(p&&(u&&M!==r?(e.push({value:r}),M<r&&S++,mt(Math.round((M+S*k)*y)/y,r,kn(r,v,t))&&S++):M<r&&S++);S<_;++S){const t=Math.round((M+S*k)*y)/y;if(m&&t>o)break;e.push({value:t})}return m&&u&&w!==o?e.length&&mt(e[e.length-1].value,o,kn(o,v,t))?e[e.length-1].value=o:e.push({value:o}):m&&w!==o||e.push({value:w}),e}({maxTicks:e,bounds:t.bounds,min:t.min,max:t.max,precision:i.precision,step:i.stepSize,count:i.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:i.minRotation||0,includeBounds:!1!==i.includeBounds},this._range||this);return"ticks"===t.bounds&&function(t,i){let e,s,n;for(e=0,s=t.length;e<s;e++)n=t[e].value,isNaN(n)||(i.min=Math.min(i.min,n),i.max=Math.max(i.max,n))}(s,this),t.reverse?(s.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),s}configure(){const t=this.ticks;let i=this.min,e=this.max;if(super.configure(),this.options.offset&&t.length){const s=(e-i)/Math.max(t.length-1,1)/2;i-=s,e+=s}this._startValue=i,this._endValue=e,this._valueRange=e-i}getLabelForValue(t){return Vt(t,this.chart.options.locale,this.options.ticks.format)}}Hs.register(tn,class extends de{static id="bar";static defaults={datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}};static overrides={scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}};parsePrimitiveData(t,i,e,s){return ge(t,i,e,s)}parseArrayData(t,i,e,s){return ge(t,i,e,s)}parseObjectData(t,i,e,s){const{iScale:n,vScale:r}=t,{xAxisKey:o="x",yAxisKey:h="y"}=this._parsing,a="x"===n.axis?o:h,c="x"===r.axis?o:h,l=[];let u,f,d,b;for(u=e,f=e+s;u<f;++u)b=i[u],d={},d[n.axis]=n.parse(st(b,a),u),l.push(be(st(b,c),d,r,u));return l}updateRangeFromParsed(t,i,e,s){super.updateRangeFromParsed(t,i,e,s);const n=e._custom;n&&i===this._cachedMeta.vScale&&(t.min=Math.min(t.min,n.min),t.max=Math.max(t.max,n.max))}getMaxOverflow(){return 0}getLabelAndValue(t){const i=this._cachedMeta,{iScale:e,vScale:s}=i,n=this.getParsed(t),r=n._custom,o=pe(r)?"["+r.start+", "+r.end+"]":""+s.getLabelForValue(n[s.axis]);return{label:""+e.getLabelForValue(n[e.axis]),value:o}}initialize(){this.enableOptionSharing=!0,super.initialize(),this._cachedMeta.stack=this.getDataset().stack}update(t){const i=this._cachedMeta;this.updateElements(i.data,0,i.data.length,t)}updateElements(t,i,e,s){const n="reset"===s,{index:r,_cachedMeta:{vScale:o}}=this,h=o.getBasePixel(),a=o.isHorizontal(),c=this._getRuler(),{sharedOptions:l,includeOptions:u}=this._getSharedOptions(i,s);for(let f=i;f<i+e;f++){const i=this.getParsed(f),e=n||W(i[o.axis])?{base:h,head:h}:this._calculateBarValuePixels(f),d=this._calculateBarIndexPixels(f,c),b=(i._stacks||{})[o.axis],g={horizontal:a,base:e.base,enableBorderRadius:!b||pe(i._custom)||r===b._top||r===b._bottom,x:a?e.head:d.center,y:a?d.center:e.head,height:a?d.size:Math.abs(e.size),width:a?Math.abs(e.size):d.size};u&&(g.options=l||this.resolveDataElementOptions(f,t[f].active?"active":s));const p=g.options||t[f].options;me(g,p,b,r),ye(g,p,c.ratio),this.updateElement(t[f],f,g,s)}}_getStacks(t,i){const{iScale:e}=this._cachedMeta,s=e.getMatchingVisibleMetas(this._type).filter((t=>t.controller.options.grouped)),n=e.options.stacked,r=[],o=this._cachedMeta.controller.getParsed(i),h=o&&o[e.axis],a=t=>{const i=t._parsed.find((t=>t[e.axis]===h)),s=i&&i[t.vScale.axis];if(W(s)||isNaN(s))return!0};for(const e of s)if((void 0===i||!a(e))&&((!1===n||-1===r.indexOf(e.stack)||void 0===n&&void 0===e.stack)&&r.push(e.stack),e.index===t))break;return r.length||r.push(void 0),r}_getStackCount(t){return this._getStacks(void 0,t).length}_getAxisCount(){return this._getAxis().length}getFirstScaleIdForIndexAxis(){const t=this.chart.scales,i=this.chart.options.indexAxis;return Object.keys(t).filter((e=>t[e].axis===i)).shift()}_getAxis(){const t={},i=this.getFirstScaleIdForIndexAxis();for(const e of this.chart.data.datasets)t[V("x"===this.chart.options.indexAxis?e.xAxisID:e.yAxisID,i)]=!0;return Object.keys(t)}_getStackIndex(t,i,e){const s=this._getStacks(t,e),n=void 0!==i?s.indexOf(i):-1;return-1===n?s.length-1:n}_getRuler(){const t=this.options,i=this._cachedMeta,e=i.iScale,s=[];let n,r;for(n=0,r=i.data.length;n<r;++n)s.push(e.getPixelForValue(this.getParsed(n)[e.axis],n));const o=t.barThickness,h=o||function(t){const i=t.iScale,e=function(t,i){if(!t._cache.$bar){const e=t.getMatchingVisibleMetas(i);let s=[];for(let i=0,n=e.length;i<n;i++)s=s.concat(e[i].controller.getAllParsedValues(t));t._cache.$bar=function(t){const i=new Set(t);return i.size===t.length?t:Array.from(i)}(s.sort(((t,i)=>t-i)))}return t._cache.$bar}(i,t.type);let s,n,r,o,h=i._length;const a=()=>{32767!==r&&-32768!==r&&(rt(o)&&(h=Math.min(h,Math.abs(r-o)||h)),o=r)};for(s=0,n=e.length;s<n;++s)r=i.getPixelForValue(e[s]),a();for(o=void 0,s=0,n=i.ticks.length;s<n;++s)r=i.getPixelForTick(s),a();return h}(i);return{min:h,pixels:s,start:e._startPixel,end:e._endPixel,stackCount:this._getStackCount(),scale:e,grouped:t.grouped,ratio:o?1:t.categoryPercentage*t.barPercentage}}_calculateBarValuePixels(t){const{_cachedMeta:{vScale:i,_stacked:e,index:s},options:{base:n,minBarLength:r}}=this,o=n||0,h=this.getParsed(t),a=h._custom,c=pe(a);let l,u,f=h[i.axis],d=0,b=e?this.applyStack(i,h,e):f;b!==f&&(d=b-f,b=f),c&&(f=a.barStart,b=a.barEnd-a.barStart,0!==f&&pt(f)!==pt(a.barEnd)&&(d=0),d+=f);const g=W(n)||c?d:n;let p=i.getPixelForValue(g);if(l=this.chart.getDataVisibility(t)?i.getPixelForValue(d+b):p,u=l-p,Math.abs(u)<r){u=function(t,i,e){return 0!==t?pt(t):(i.isHorizontal()?1:-1)*(i.min>=e?1:-1)}(u,i,o)*r,f===o&&(p-=u/2);const t=i.getPixelForDecimal(0),n=i.getPixelForDecimal(1),a=Math.min(t,n),d=Math.max(t,n);p=Math.max(Math.min(p,d),a),l=p+u,e&&!c&&(h._stacks[i.axis]._visualValues[s]=i.getValueForPixel(l)-i.getValueForPixel(p))}if(p===i.getPixelForValue(o)){const t=pt(u)*i.getLineWidthForValue(o)/2;p+=t,u-=t}return{size:u,base:p,head:l,center:l+u/2}}_calculateBarIndexPixels(t,i){const e=i.scale,s=this.options,n=s.skipNull,r=V(s.maxBarThickness,1/0);let o,h;const a=this._getAxisCount();if(i.grouped){const e=n?this._getStackCount(t):i.stackCount,c="flex"===s.barThickness?function(t,i,e,s){const n=i.pixels,r=n[t];let o=t>0?n[t-1]:null,h=t<n.length-1?n[t+1]:null;const a=e.categoryPercentage;null===o&&(o=r-(null===h?i.end-i.start:h-r)),null===h&&(h=r+r-o);const c=r-(r-Math.min(o,h))/2*a;return{chunk:Math.abs(h-o)/2*a/s,ratio:e.barPercentage,start:c}}(t,i,s,e*a):function(t,i,e,s){const n=e.barThickness;let r,o;return W(n)?(r=i.min*e.categoryPercentage,o=e.barPercentage):(r=n*s,o=1),{chunk:r/s,ratio:o,start:i.pixels[t]-r/2}}(t,i,s,e*a),l="x"===this.chart.options.indexAxis?this.getDataset().xAxisID:this.getDataset().yAxisID,u=this._getAxis().indexOf(V(l,this.getFirstScaleIdForIndexAxis())),f=this._getStackIndex(this.index,this._cachedMeta.stack,n?t:void 0)+u;o=c.start+c.chunk*f+c.chunk/2,h=Math.min(r,c.chunk*c.ratio)}else o=e.getPixelForValue(this.getParsed(t)[e.axis],t),h=Math.min(r,i.min*i.ratio);return{base:o-h/2,head:o+h/2,center:o,size:h}}draw(){const t=this._cachedMeta,i=t.vScale,e=t.data,s=e.length;let n=0;for(;n<s;++n)null===this.getParsed(n)[i.axis]||e[n].hidden||e[n].draw(this._ctx)}},class extends ns{static id="bar";static defaults={borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(t){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,t&&Object.assign(this,t)}draw(t){const{inflateAmount:i,options:{borderColor:e,backgroundColor:s}}=this,{inner:n,outer:r}=function(t){const i=Ys(t),e=i.right-i.left,s=i.bottom-i.top,n=function(t,i,e){const s=t.borderSkipped,n=gi(t.options.borderWidth);return{t:Vs(s.top,n.top,0,e),r:Vs(s.right,n.right,0,i),b:Vs(s.bottom,n.bottom,0,e),l:Vs(s.left,n.left,0,i)}}(t,e/2,s/2),r=function(t,i,e){const{enableBorderRadius:s}=t.getProps(["enableBorderRadius"]),n=t.options.borderRadius,r=pi(n),o=Math.min(i,e),h=t.borderSkipped,a=s||H(n);return{topLeft:Vs(!a||h.top||h.left,r.topLeft,0,o),topRight:Vs(!a||h.top||h.right,r.topRight,0,o),bottomLeft:Vs(!a||h.bottom||h.left,r.bottomLeft,0,o),bottomRight:Vs(!a||h.bottom||h.right,r.bottomRight,0,o)}}(t,e/2,s/2);return{outer:{x:i.left,y:i.top,w:e,h:s,radius:r},inner:{x:i.left+n.l,y:i.top+n.t,w:e-n.l-n.r,h:s-n.t-n.b,radius:{topLeft:Math.max(0,r.topLeft-Math.max(n.t,n.l)),topRight:Math.max(0,r.topRight-Math.max(n.t,n.r)),bottomLeft:Math.max(0,r.bottomLeft-Math.max(n.b,n.l)),bottomRight:Math.max(0,r.bottomRight-Math.max(n.b,n.r))}}}}(this),o=(h=r.radius).topLeft||h.topRight||h.bottomLeft||h.bottomRight?li:Us;var h;t.save(),r.w===n.w&&r.h===n.h||(t.beginPath(),o(t,Zs(r,i,n)),t.clip(),o(t,Zs(n,-i,r)),t.fillStyle=e,t.fill("evenodd")),t.beginPath(),o(t,Zs(n,i)),t.fillStyle=s,t.fill(),t.restore()}inRange(t,i,e){return Xs(this,t,i,e)}inXRange(t,i){return Xs(this,t,null,i)}inYRange(t,i){return Xs(this,null,t,i)}getCenterPoint(t){const{x:i,y:e,base:s,horizontal:n}=this.getProps(["x","y","base","horizontal"],t);return{x:n?(i+s)/2:i,y:n?e:(e+s)/2}}getRange(t){return"x"===t?this.width/2:this.height/2}},class extends ds{static id="category";static defaults={ticks:{callback:_n}};constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){const i=this._addedLabels;if(i.length){const t=this.getLabels();for(const{index:e,label:s}of i)t[e]===s&&t.splice(e,1);this._addedLabels=[]}super.init(t)}parse(t,i){if(W(t))return null;const e=this.getLabels();return((t,i)=>null===t?null:kt(Math.round(t),0,i))(i=isFinite(i)&&e[i]===t?i:function(t,i,e,s){const n=t.indexOf(i);return-1===n?((t,i,e,s)=>("string"==typeof i?(e=t.push(i)-1,s.unshift({index:e,label:i})):isNaN(i)&&(e=null),e))(t,i,e,s):n!==t.lastIndexOf(i)?e:n}(e,t,V(i,t),this._addedLabels),e.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:i}=this.getUserBounds();let{min:e,max:s}=this.getMinMax(!0);"ticks"===this.options.bounds&&(t||(e=0),i||(s=this.getLabels().length-1)),this.min=e,this.max=s}buildTicks(){const t=this.min,i=this.max,e=this.options.offset,s=[];let n=this.getLabels();n=0===t&&i===n.length-1?n:n.slice(t,i+1),this._valueRange=Math.max(n.length-(e?0:1),1),this._startValue=this.min-(e?.5:0);for(let e=t;e<=i;e++)s.push({value:e});return s}getLabelForValue(t){return _n.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return"number"!=typeof t&&(t=this.parse(t)),null===t?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){const i=this.ticks;return t<0||t>i.length-1?null:this.getPixelForValue(i[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}},class extends On{static id="linear";static defaults={ticks:{callback:Xt.formatters.numeric}};determineDataLimits(){const{min:t,max:i}=this.getMinMax(!0);this.min=$(t)?t:0,this.max=$(i)?i:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),i=t?this.width:this.height,e=yt(this.options.ticks.minRotation),s=(t?Math.sin(e):Math.cos(e))||.001,n=this._resolveTickFontOptions(0);return Math.ceil(i/Math.min(40,n.lineHeight/s))}getPixelForValue(t){return null===t?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}},rn,wn,hn);const Sn=class{constructor(e){t(this,e),this.errorEvent=i(this,"error-event"),this.loading=!0,this.errorMessage=""}componentDidLoad(){this.getGrossPayment&&this.fetchData()}propChanged(){this.getGrossPayment&&this.fetchData()}grossVolumeReportChanged(t){t&&(this.chart?this.updateChartData(t):this.initChart(t))}async fetchData(){this.loading=!0,this.getGrossPayment({onSuccess:t=>{this.loading=!1,this.grossVolumeReport=t},onError:({error:t,code:i,severity:e})=>{this.loading=!1,this.errorMessage=t,this.errorEvent.emit({errorCode:i,message:t,severity:e})}})}initChart(t){const{dates:i,total:e}=t,s=i.reverse(),o=((t,i,e)=>({type:"bar",options:{plugins:{legend:{display:!1},title:{display:!0,text:["Trailing 30 Days","Gross Payments",n(t)],position:"top",align:"start"},tooltip:{displayColors:!1,intersect:!1,callbacks:{label:t=>{let s=t.dataIndex;return[r(i[s].date,e),n(i[s].value)]}}}},scales:{x:{grid:{drawOnChartArea:!1,drawTicks:!1},ticks:{callback:t=>{if(0===t||t===i.length-1)return r(i[t].date,e)}}},y:{display:!1}}},data:{labels:i.map((()=>"")),datasets:[{label:"Gross Volume by Date",data:i.map((t=>t.value))}]}}))(e,s,s[i.length-1].date);this.chart=new Hs(this.chartRef.getContext("2d"),o)}updateChartData(t){const i=t.dates.map((t=>t.value));this.chart.data.datasets.forEach((t=>{t.data=i})),this.chart.update()}disconnectedCallback(){this.chart&&this.chart.destroy()}render(){return e(s,{key:"0432a1c141cd1ea91ebcb3f975a220e5127164c8"},this.loading&&e(h,{key:"0261cca24232d936418d305f60f3857a502dcb11"}),this.errorMessage?o(this.errorMessage):e("canvas",{id:"chart",ref:t=>this.chartRef=t}))}static get watchers(){return{getGrossPayment:["propChanged"],grossVolumeReport:["grossVolumeReportChanged"]}}};export{Sn as gross_payment_chart_core}