@nyaruka/temba-components 0.122.0 → 0.123.0

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 (224) hide show
  1. package/.github/copilot-instructions.md +163 -0
  2. package/.github/workflows/build.yml +3 -3
  3. package/.github/workflows/cla.yml +6 -6
  4. package/.github/workflows/copilot-setup-steps.yml +86 -0
  5. package/CHANGELOG.md +33 -0
  6. package/demo/index.html +42 -0
  7. package/dist/locales/es.js +1 -0
  8. package/dist/locales/es.js.map +1 -1
  9. package/dist/locales/fr.js +1 -0
  10. package/dist/locales/fr.js.map +1 -1
  11. package/dist/locales/pt.js +1 -0
  12. package/dist/locales/pt.js.map +1 -1
  13. package/dist/temba-components.js +59 -72
  14. package/dist/temba-components.js.map +1 -1
  15. package/out-tsc/src/chart/TembaChart.js +81 -14
  16. package/out-tsc/src/chart/TembaChart.js.map +1 -1
  17. package/out-tsc/src/list/RunList.js +13 -8
  18. package/out-tsc/src/list/RunList.js.map +1 -1
  19. package/out-tsc/src/locales/es.js +1 -0
  20. package/out-tsc/src/locales/es.js.map +1 -1
  21. package/out-tsc/src/locales/fr.js +1 -0
  22. package/out-tsc/src/locales/fr.js.map +1 -1
  23. package/out-tsc/src/locales/pt.js +1 -0
  24. package/out-tsc/src/locales/pt.js.map +1 -1
  25. package/out-tsc/src/options/Options.js +36 -13
  26. package/out-tsc/src/options/Options.js.map +1 -1
  27. package/out-tsc/src/select/Select.js +28 -5
  28. package/out-tsc/src/select/Select.js.map +1 -1
  29. package/out-tsc/src/store/AppState.js +3 -3
  30. package/out-tsc/src/store/AppState.js.map +1 -1
  31. package/out-tsc/src/utils/index.js +6 -1
  32. package/out-tsc/src/utils/index.js.map +1 -1
  33. package/out-tsc/src/vectoricon/VectorIcon.js +2 -1
  34. package/out-tsc/src/vectoricon/VectorIcon.js.map +1 -1
  35. package/out-tsc/temba-modules.js +0 -2
  36. package/out-tsc/temba-modules.js.map +1 -1
  37. package/out-tsc/test/temba-appstate-language.test.js +176 -0
  38. package/out-tsc/test/temba-appstate-language.test.js.map +1 -0
  39. package/out-tsc/test/temba-chart.test.js +125 -0
  40. package/out-tsc/test/temba-chart.test.js.map +1 -1
  41. package/out-tsc/test/temba-dropdown.test.js +317 -0
  42. package/out-tsc/test/temba-dropdown.test.js.map +1 -0
  43. package/out-tsc/test/temba-run-list.test.js +588 -0
  44. package/out-tsc/test/temba-run-list.test.js.map +1 -0
  45. package/out-tsc/test/temba-select.test.js +16 -0
  46. package/out-tsc/test/temba-select.test.js.map +1 -1
  47. package/out-tsc/test/temba-toast.test.js +299 -0
  48. package/out-tsc/test/temba-toast.test.js.map +1 -0
  49. package/out-tsc/test/temba-utils-index.test.js +1178 -0
  50. package/out-tsc/test/temba-utils-index.test.js.map +1 -0
  51. package/out-tsc/test/temba-webchat.test.js +816 -0
  52. package/out-tsc/test/temba-webchat.test.js.map +1 -0
  53. package/out-tsc/test/utils.test.js +3 -1
  54. package/out-tsc/test/utils.test.js.map +1 -1
  55. package/package.json +6 -8
  56. package/screenshots/truth/alert/error.png +0 -0
  57. package/screenshots/truth/alert/info.png +0 -0
  58. package/screenshots/truth/alert/warning.png +0 -0
  59. package/screenshots/truth/checkbox/checkbox-label-background-hover.png +0 -0
  60. package/screenshots/truth/checkbox/checked.png +0 -0
  61. package/screenshots/truth/checkbox/default.png +0 -0
  62. package/screenshots/truth/colorpicker/default.png +0 -0
  63. package/screenshots/truth/colorpicker/focused.png +0 -0
  64. package/screenshots/truth/colorpicker/initialized.png +0 -0
  65. package/screenshots/truth/colorpicker/selected.png +0 -0
  66. package/screenshots/truth/compose/attachments-tab.png +0 -0
  67. package/screenshots/truth/compose/attachments-with-files-focused.png +0 -0
  68. package/screenshots/truth/compose/attachments-with-files.png +0 -0
  69. package/screenshots/truth/compose/intial-text.png +0 -0
  70. package/screenshots/truth/compose/no-counter.png +0 -0
  71. package/screenshots/truth/compose/wraps-text-and-spaces.png +0 -0
  72. package/screenshots/truth/compose/wraps-text-and-url.png +0 -0
  73. package/screenshots/truth/compose/wraps-text-no-spaces.png +0 -0
  74. package/screenshots/truth/contacts/badges.png +0 -0
  75. package/screenshots/truth/contacts/chat-failure.png +0 -0
  76. package/screenshots/truth/contacts/chat-for-active-contact.png +0 -0
  77. package/screenshots/truth/contacts/chat-for-archived-contact.png +0 -0
  78. package/screenshots/truth/contacts/chat-for-blocked-contact.png +0 -0
  79. package/screenshots/truth/contacts/chat-for-stopped-contact.png +0 -0
  80. package/screenshots/truth/contacts/chat-sends-attachments-only.png +0 -0
  81. package/screenshots/truth/contacts/chat-sends-text-and-attachments.png +0 -0
  82. package/screenshots/truth/contacts/chat-sends-text-only.png +0 -0
  83. package/screenshots/truth/content-menu/button-no-items.png +0 -0
  84. package/screenshots/truth/content-menu/items-and-buttons.png +0 -0
  85. package/screenshots/truth/counter/summary.png +0 -0
  86. package/screenshots/truth/counter/text.png +0 -0
  87. package/screenshots/truth/counter/unicode-variables.png +0 -0
  88. package/screenshots/truth/counter/unicode.png +0 -0
  89. package/screenshots/truth/counter/variable.png +0 -0
  90. package/screenshots/truth/date/date-inline.png +0 -0
  91. package/screenshots/truth/date/date.png +0 -0
  92. package/screenshots/truth/date/datetime.png +0 -0
  93. package/screenshots/truth/date/duration.png +0 -0
  94. package/screenshots/truth/date/timedate.png +0 -0
  95. package/screenshots/truth/datepicker/date-truncated-time.png +0 -0
  96. package/screenshots/truth/datepicker/date.png +0 -0
  97. package/screenshots/truth/datepicker/initial-timezone.png +0 -0
  98. package/screenshots/truth/datepicker/updated-keyboard-date.png +0 -0
  99. package/screenshots/truth/dialog/focused.png +0 -0
  100. package/screenshots/truth/dropdown/after-blur.png +0 -0
  101. package/screenshots/truth/dropdown/bottom-edge-collision.png +0 -0
  102. package/screenshots/truth/dropdown/custom-arrow-size.png +0 -0
  103. package/screenshots/truth/dropdown/default.png +0 -0
  104. package/screenshots/truth/dropdown/narrow-toggle.png +0 -0
  105. package/screenshots/truth/dropdown/no-mask.png +0 -0
  106. package/screenshots/truth/dropdown/opened.png +0 -0
  107. package/screenshots/truth/dropdown/positioned.png +0 -0
  108. package/screenshots/truth/dropdown/right-edge-collision.png +0 -0
  109. package/screenshots/truth/dropdown/with-mask.png +0 -0
  110. package/screenshots/truth/label/custom.png +0 -0
  111. package/screenshots/truth/label/danger.png +0 -0
  112. package/screenshots/truth/label/dark.png +0 -0
  113. package/screenshots/truth/label/default-icon.png +0 -0
  114. package/screenshots/truth/label/no-icon.png +0 -0
  115. package/screenshots/truth/label/primary.png +0 -0
  116. package/screenshots/truth/label/secondary.png +0 -0
  117. package/screenshots/truth/label/shadow.png +0 -0
  118. package/screenshots/truth/label/tertiary.png +0 -0
  119. package/screenshots/truth/lightbox/img-zoomed.png +0 -0
  120. package/screenshots/truth/list/fields-dragging.png +0 -0
  121. package/screenshots/truth/list/fields-filtered.png +0 -0
  122. package/screenshots/truth/list/fields-hovered.png +0 -0
  123. package/screenshots/truth/list/fields.png +0 -0
  124. package/screenshots/truth/list/items-selected.png +0 -0
  125. package/screenshots/truth/list/items-updated.png +0 -0
  126. package/screenshots/truth/list/items.png +0 -0
  127. package/screenshots/truth/list/sortable-dragging.png +0 -0
  128. package/screenshots/truth/list/sortable-dropped.png +0 -0
  129. package/screenshots/truth/list/sortable.png +0 -0
  130. package/screenshots/truth/menu/menu-focused-with items.png +0 -0
  131. package/screenshots/truth/menu/menu-refresh-1.png +0 -0
  132. package/screenshots/truth/menu/menu-refresh-2.png +0 -0
  133. package/screenshots/truth/menu/menu-root.png +0 -0
  134. package/screenshots/truth/menu/menu-submenu.png +0 -0
  135. package/screenshots/truth/menu/menu-tasks-nextup.png +0 -0
  136. package/screenshots/truth/menu/menu-tasks.png +0 -0
  137. package/screenshots/truth/modax/form.png +0 -0
  138. package/screenshots/truth/modax/simple.png +0 -0
  139. package/screenshots/truth/omnibox/selected.png +0 -0
  140. package/screenshots/truth/options/block.png +0 -0
  141. package/screenshots/truth/run-list/basic.png +0 -0
  142. package/screenshots/truth/select/disabled-multi-selection.png +0 -0
  143. package/screenshots/truth/select/disabled-selection.png +0 -0
  144. package/screenshots/truth/select/disabled.png +0 -0
  145. package/screenshots/truth/select/embedded.png +0 -0
  146. package/screenshots/truth/select/empty-options.png +0 -0
  147. package/screenshots/truth/select/expression-selected.png +0 -0
  148. package/screenshots/truth/select/expressions.png +0 -0
  149. package/screenshots/truth/select/functions.png +0 -0
  150. package/screenshots/truth/select/local-options.png +0 -0
  151. package/screenshots/truth/select/multi-with-endpoint.png +0 -0
  152. package/screenshots/truth/select/multiple-initial-values.png +0 -0
  153. package/screenshots/truth/select/remote-options.png +0 -0
  154. package/screenshots/truth/select/search-enabled.png +0 -0
  155. package/screenshots/truth/select/search-multi-no-matches.png +0 -0
  156. package/screenshots/truth/select/search-selected-focus.png +0 -0
  157. package/screenshots/truth/select/search-selected.png +0 -0
  158. package/screenshots/truth/select/search-with-selected.png +0 -0
  159. package/screenshots/truth/select/searching.png +0 -0
  160. package/screenshots/truth/select/selected-multi-maxitems-reached.png +0 -0
  161. package/screenshots/truth/select/selected-multi.png +0 -0
  162. package/screenshots/truth/select/selected-single.png +0 -0
  163. package/screenshots/truth/select/selection-clearable.png +0 -0
  164. package/screenshots/truth/select/static-initial-value.png +0 -0
  165. package/screenshots/truth/select/static-initial-via-selected.png +0 -0
  166. package/screenshots/truth/select/truncated-selection.png +0 -0
  167. package/screenshots/truth/select/with-placeholder.png +0 -0
  168. package/screenshots/truth/select/without-placeholder.png +0 -0
  169. package/screenshots/truth/slider/custom-min-custom-max-valid-value.png +0 -0
  170. package/screenshots/truth/slider/custom-min-default-max-no-value.png +0 -0
  171. package/screenshots/truth/slider/default-min-custom-max-no-value.png +0 -0
  172. package/screenshots/truth/slider/default-min-default-max-invalid-value.png +0 -0
  173. package/screenshots/truth/slider/default-min-default-max-valid-value.png +0 -0
  174. package/screenshots/truth/slider/update-slider-on-value-change.png +0 -0
  175. package/screenshots/truth/templates/default.png +0 -0
  176. package/screenshots/truth/templates/unapproved.png +0 -0
  177. package/screenshots/truth/textinput/input-disabled.png +0 -0
  178. package/screenshots/truth/textinput/input-focused.png +0 -0
  179. package/screenshots/truth/textinput/input-form.png +0 -0
  180. package/screenshots/truth/textinput/input-inserted.png +0 -0
  181. package/screenshots/truth/textinput/input-placeholder.png +0 -0
  182. package/screenshots/truth/textinput/input-updated.png +0 -0
  183. package/screenshots/truth/textinput/input.png +0 -0
  184. package/screenshots/truth/textinput/textarea-focused.png +0 -0
  185. package/screenshots/truth/textinput/textarea.png +0 -0
  186. package/screenshots/truth/tip/bottom.png +0 -0
  187. package/screenshots/truth/tip/left.png +0 -0
  188. package/screenshots/truth/tip/right.png +0 -0
  189. package/screenshots/truth/tip/top.png +0 -0
  190. package/screenshots/truth/webchat/closed-widget.png +0 -0
  191. package/screenshots/truth/webchat/connected-state.png +0 -0
  192. package/screenshots/truth/webchat/connecting-state.png +0 -0
  193. package/screenshots/truth/webchat/disconnected-state.png +0 -0
  194. package/screenshots/truth/webchat/opened-widget.png +0 -0
  195. package/src/chart/TembaChart.ts +86 -15
  196. package/src/list/RunList.ts +11 -8
  197. package/src/locales/es.ts +1 -0
  198. package/src/locales/fr.ts +1 -0
  199. package/src/locales/pt.ts +1 -0
  200. package/src/options/Options.ts +38 -13
  201. package/src/select/Select.ts +32 -5
  202. package/src/store/AppState.ts +3 -3
  203. package/src/utils/index.ts +17 -5
  204. package/src/vectoricon/VectorIcon.ts +2 -1
  205. package/temba-modules.ts +0 -2
  206. package/test/temba-appstate-language.test.ts +218 -0
  207. package/test/temba-chart.test.ts +161 -1
  208. package/test/temba-dropdown.test.ts +444 -0
  209. package/test/temba-run-list.test.ts +774 -0
  210. package/test/temba-select.test.ts +27 -0
  211. package/test/temba-toast.test.ts +386 -0
  212. package/test/temba-utils-index.test.ts +1547 -0
  213. package/test/temba-webchat.test.ts +1095 -0
  214. package/test/utils.test.ts +4 -2
  215. package/test-assets/list/flow-results.json +17 -0
  216. package/test-assets/list/runs.json +126 -0
  217. package/test-assets/style.css +23 -0
  218. package/web-test-runner.config.mjs +33 -7
  219. package/xliff/es.xlf +3 -0
  220. package/xliff/fr.xlf +3 -0
  221. package/xliff/pt.xlf +3 -0
  222. package/out-tsc/src/outboxmonitor/OutboxMonitor.js +0 -136
  223. package/out-tsc/src/outboxmonitor/OutboxMonitor.js.map +0 -1
  224. package/src/outboxmonitor/OutboxMonitor.ts +0 -148
@@ -21,7 +21,7 @@ const S=globalThis,C=S.trustedTypes,E=C?C.createPolicy("lit-html",{createHTML:t=
21
21
  * Copyright 2017 Google LLC
22
22
  * SPDX-License-Identifier: BSD-3-Clause
23
23
  */
24
- let ct=class extends k{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=((t,e,i)=>{const n=i?.renderBefore??e;let o=n._$litPart$;if(void 0===o){const t=i?.renderBefore??null;n._$litPart$=o=new et(e.insertBefore(D(),t),t,void 0,i??{})}return o._$AI(t),o})(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return W}};ct._$litElement$=!0,ct.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:ct});const ht=globalThis.litElementPolyfillSupport;ht?.({LitElement:ct}),(globalThis.litElementVersions??=[]).push("4.0.4");var dt,ut,pt,mt,ft,gt,vt,yt,bt,_t,xt,wt,kt,St,Ct,Et,At,Mt,Tt=function(t,e,i){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,i),i},Pt=function(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)};const Ot=function(t){var e=0;t+="x";var i=Math.floor(65745979961613.07);for(let n=0;n<t.length;n++)e>i&&(e=Math.floor(e/137)),e=131*e+t.charCodeAt(n);return e},Dt="0123456789abcdef".split(""),It=[-2147483648,8388608,32768,128],Lt=[24,16,8,0],$t=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],zt=[];class Rt{constructor(t=!1,e=!1){dt.set(this,void 0),ut.set(this,void 0),pt.set(this,void 0),mt.set(this,void 0),ft.set(this,void 0),gt.set(this,void 0),vt.set(this,void 0),yt.set(this,void 0),bt.set(this,void 0),_t.set(this,void 0),xt.set(this,void 0),wt.set(this,void 0),kt.set(this,void 0),St.set(this,void 0),Ct.set(this,void 0),Et.set(this,void 0),At.set(this,0),Mt.set(this,void 0),this.init(t,e)}init(t,e){e?(zt[0]=zt[16]=zt[1]=zt[2]=zt[3]=zt[4]=zt[5]=zt[6]=zt[7]=zt[8]=zt[9]=zt[10]=zt[11]=zt[12]=zt[13]=zt[14]=zt[15]=0,Tt(this,ut,zt)):Tt(this,ut,[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),t?(Tt(this,gt,3238371032),Tt(this,vt,914150663),Tt(this,yt,812702999),Tt(this,bt,4144912697),Tt(this,_t,4290775857),Tt(this,xt,1750603025),Tt(this,wt,1694076839),Tt(this,kt,3204075428)):(Tt(this,gt,1779033703),Tt(this,vt,3144134277),Tt(this,yt,1013904242),Tt(this,bt,2773480762),Tt(this,_t,1359893119),Tt(this,xt,2600822924),Tt(this,wt,528734635),Tt(this,kt,1541459225)),Tt(this,dt,Tt(this,Mt,Tt(this,pt,Tt(this,Ct,0)))),Tt(this,mt,Tt(this,St,!1)),Tt(this,ft,!0),Tt(this,Et,t)}update(t){if(Pt(this,mt))return this;let e;e=t instanceof ArrayBuffer?new Uint8Array(t):t;let i=0;const n=e.length,o=Pt(this,ut);for(;i<n;){let t;if(Pt(this,St)&&(Tt(this,St,!1),o[0]=Pt(this,dt),o[16]=o[1]=o[2]=o[3]=o[4]=o[5]=o[6]=o[7]=o[8]=o[9]=o[10]=o[11]=o[12]=o[13]=o[14]=o[15]=0),"string"!=typeof e)for(t=Pt(this,Mt);i<n&&t<64;++i)o[t>>2]|=e[i]<<Lt[3&t++];else for(t=Pt(this,Mt);i<n&&t<64;++i){let n=e.charCodeAt(i);n<128?o[t>>2]|=n<<Lt[3&t++]:n<2048?(o[t>>2]|=(192|n>>6)<<Lt[3&t++],o[t>>2]|=(128|63&n)<<Lt[3&t++]):n<55296||n>=57344?(o[t>>2]|=(224|n>>12)<<Lt[3&t++],o[t>>2]|=(128|n>>6&63)<<Lt[3&t++],o[t>>2]|=(128|63&n)<<Lt[3&t++]):(n=65536+((1023&n)<<10|1023&e.charCodeAt(++i)),o[t>>2]|=(240|n>>18)<<Lt[3&t++],o[t>>2]|=(128|n>>12&63)<<Lt[3&t++],o[t>>2]|=(128|n>>6&63)<<Lt[3&t++],o[t>>2]|=(128|63&n)<<Lt[3&t++])}Tt(this,At,t),Tt(this,pt,Pt(this,pt)+(t-Pt(this,Mt))),t>=64?(Tt(this,dt,o[16]),Tt(this,Mt,t-64),this.hash(),Tt(this,St,!0)):Tt(this,Mt,t)}return Pt(this,pt)>4294967295&&(Tt(this,Ct,Pt(this,Ct)+(Pt(this,pt)/4294967296|0)),Tt(this,pt,Pt(this,pt)%4294967296)),this}finalize(){if(Pt(this,mt))return;Tt(this,mt,!0);const t=Pt(this,ut),e=Pt(this,At);t[16]=Pt(this,dt),t[e>>2]|=It[3&e],Tt(this,dt,t[16]),e>=56&&(Pt(this,St)||this.hash(),t[0]=Pt(this,dt),t[16]=t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=0),t[14]=Pt(this,Ct)<<3|Pt(this,pt)>>>29,t[15]=Pt(this,pt)<<3,this.hash()}hash(){let t=Pt(this,gt),e=Pt(this,vt),i=Pt(this,yt),n=Pt(this,bt),o=Pt(this,_t),s=Pt(this,xt),r=Pt(this,wt),a=Pt(this,kt);const l=Pt(this,ut);let c,h,d,u,p,m,f,g,v,y;for(let t=16;t<64;++t)u=l[t-15],c=(u>>>7|u<<25)^(u>>>18|u<<14)^u>>>3,u=l[t-2],h=(u>>>17|u<<15)^(u>>>19|u<<13)^u>>>10,l[t]=l[t-16]+c+l[t-7]+h|0;y=e&i;for(let b=0;b<64;b+=4)Pt(this,ft)?(Pt(this,Et)?(f=300032,u=l[0]-1413257819,a=u-150054599|0,n=u+24177077|0):(f=704751109,u=l[0]-210244248,a=u-1521486534|0,n=u+143694565|0),Tt(this,ft,!1)):(c=(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10),h=(o>>>6|o<<26)^(o>>>11|o<<21)^(o>>>25|o<<7),f=t&e,d=f^t&i^y,m=o&s^~o&r,u=a+h+m+$t[b]+l[b],p=c+d,a=n+u|0,n=u+p|0),c=(n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10),h=(a>>>6|a<<26)^(a>>>11|a<<21)^(a>>>25|a<<7),g=n&t,d=g^n&e^f,m=a&o^~a&s,u=r+h+m+$t[b+1]+l[b+1],p=c+d,r=i+u|0,i=u+p|0,c=(i>>>2|i<<30)^(i>>>13|i<<19)^(i>>>22|i<<10),h=(r>>>6|r<<26)^(r>>>11|r<<21)^(r>>>25|r<<7),v=i&n,d=v^i&t^g,m=r&a^~r&o,u=s+h+m+$t[b+2]+l[b+2],p=c+d,s=e+u|0,e=u+p|0,c=(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10),h=(s>>>6|s<<26)^(s>>>11|s<<21)^(s>>>25|s<<7),y=e&i,d=y^e&n^v,m=s&r^~s&a,u=o+h+m+$t[b+3]+l[b+3],p=c+d,o=t+u|0,t=u+p|0;Tt(this,gt,Pt(this,gt)+t|0),Tt(this,vt,Pt(this,vt)+e|0),Tt(this,yt,Pt(this,yt)+i|0),Tt(this,bt,Pt(this,bt)+n|0),Tt(this,_t,Pt(this,_t)+o|0),Tt(this,xt,Pt(this,xt)+s|0),Tt(this,wt,Pt(this,wt)+r|0),Tt(this,kt,Pt(this,kt)+a|0)}hex(){this.finalize();const t=Pt(this,gt),e=Pt(this,vt),i=Pt(this,yt),n=Pt(this,bt),o=Pt(this,_t),s=Pt(this,xt),r=Pt(this,wt),a=Pt(this,kt);let l=Dt[t>>28&15]+Dt[t>>24&15]+Dt[t>>20&15]+Dt[t>>16&15]+Dt[t>>12&15]+Dt[t>>8&15]+Dt[t>>4&15]+Dt[15&t]+Dt[e>>28&15]+Dt[e>>24&15]+Dt[e>>20&15]+Dt[e>>16&15]+Dt[e>>12&15]+Dt[e>>8&15]+Dt[e>>4&15]+Dt[15&e]+Dt[i>>28&15]+Dt[i>>24&15]+Dt[i>>20&15]+Dt[i>>16&15]+Dt[i>>12&15]+Dt[i>>8&15]+Dt[i>>4&15]+Dt[15&i]+Dt[n>>28&15]+Dt[n>>24&15]+Dt[n>>20&15]+Dt[n>>16&15]+Dt[n>>12&15]+Dt[n>>8&15]+Dt[n>>4&15]+Dt[15&n]+Dt[o>>28&15]+Dt[o>>24&15]+Dt[o>>20&15]+Dt[o>>16&15]+Dt[o>>12&15]+Dt[o>>8&15]+Dt[o>>4&15]+Dt[15&o]+Dt[s>>28&15]+Dt[s>>24&15]+Dt[s>>20&15]+Dt[s>>16&15]+Dt[s>>12&15]+Dt[s>>8&15]+Dt[s>>4&15]+Dt[15&s]+Dt[r>>28&15]+Dt[r>>24&15]+Dt[r>>20&15]+Dt[r>>16&15]+Dt[r>>12&15]+Dt[r>>8&15]+Dt[r>>4&15]+Dt[15&r];return Pt(this,Et)||(l+=Dt[a>>28&15]+Dt[a>>24&15]+Dt[a>>20&15]+Dt[a>>16&15]+Dt[a>>12&15]+Dt[a>>8&15]+Dt[a>>4&15]+Dt[15&a]),l}toString(){return this.hex()}digest(){this.finalize();const t=Pt(this,gt),e=Pt(this,vt),i=Pt(this,yt),n=Pt(this,bt),o=Pt(this,_t),s=Pt(this,xt),r=Pt(this,wt),a=Pt(this,kt),l=[t>>24&255,t>>16&255,t>>8&255,255&t,e>>24&255,e>>16&255,e>>8&255,255&e,i>>24&255,i>>16&255,i>>8&255,255&i,n>>24&255,n>>16&255,n>>8&255,255&n,o>>24&255,o>>16&255,o>>8&255,255&o,s>>24&255,s>>16&255,s>>8&255,255&s,r>>24&255,r>>16&255,r>>8&255,255&r];return Pt(this,Et)||l.push(a>>24&255,a>>16&255,a>>8&255,255&a),l}array(){return this.digest()}arrayBuffer(){this.finalize();const t=new ArrayBuffer(Pt(this,Et)?28:32),e=new DataView(t);return e.setUint32(0,Pt(this,gt)),e.setUint32(4,Pt(this,vt)),e.setUint32(8,Pt(this,yt)),e.setUint32(12,Pt(this,bt)),e.setUint32(16,Pt(this,_t)),e.setUint32(20,Pt(this,xt)),e.setUint32(24,Pt(this,wt)),Pt(this,Et)||e.setUint32(28,Pt(this,kt)),t}}function Nt(t){const e=new Rt;return e.update(t),parseInt(e.hex().substring(0,8),16)}dt=new WeakMap,ut=new WeakMap,pt=new WeakMap,mt=new WeakMap,ft=new WeakMap,gt=new WeakMap,vt=new WeakMap,yt=new WeakMap,bt=new WeakMap,_t=new WeakMap,xt=new WeakMap,wt=new WeakMap,kt=new WeakMap,St=new WeakMap,Ct=new WeakMap,Et=new WeakMap,At=new WeakMap,Mt=new WeakMap;const jt=function(t,e,i){var n=i<.5?i*(1+e):i+e-i*e,o=2*i-n;return[(t/=360)+1/3,t,t-1/3].map((function(t){return t<0&&t++,t>1&&t--,t=t<1/6?o+6*(n-o)*t:t<.5?n:t<2/3?o+6*(n-o)*(2/3-t):o,Math.round(255*t)}))};const Bt="/api/v2/media.json",Ft=new class{constructor(t={}){const[e,i]=[t.lightness,t.saturation].map((function(t){return t=void 0!==t?t:[.35,.5,.65],Array.isArray(t)?t.concat():[t]}));this.L=e,this.S=i,"number"==typeof t.hue&&(t.hue={min:t.hue,max:t.hue}),"object"!=typeof t.hue||Array.isArray(t.hue)||(t.hue=[t.hue]),void 0===t.hue&&(t.hue=[]),this.hueRanges=t.hue.map((function(t){return{min:void 0===t.min?0:t.min,max:void 0===t.max?360:t.max}})),this.hash=Nt,"function"==typeof t.hash&&(this.hash=t.hash),"bkdr"===t.hash&&(this.hash=Ot)}hsl(t){var e,i,n=this.hash(t);if(this.hueRanges.length){const t=this.hueRanges[n%this.hueRanges.length];e=n/this.hueRanges.length%727*(t.max-t.min)/727+t.min}else e=n%359;return n=Math.ceil(n/360),i=this.S[n%this.S.length],n=Math.ceil(n/this.S.length),[e,i,this.L[n%this.L.length]]}rgb(t){var e=this.hsl(t);return jt.apply(this,e)}hex(t){return function(t){var e="#";return t.forEach((function(t){t<16&&(e+=0),e+=t.toString(16)})),e}(this.rgb(t))}};var qt;!function(t){t.BLUE="color:#5078b5;",t.GREEN="color:#62bd6a;",t.RED="color:#e36049;",t.PURPLE="color:#a626a4;"}(qt||(qt={}));const Vt=(t,e="",i=[])=>{""!==e?"object"!=typeof t?console.log("%c"+t,e,...i):console.log("%c"+JSON.stringify(t,null,2),e):console.log(t)},Ht=(t={})=>{let e=(t=>{for(const e of document.cookie.split(";")){const i=e.indexOf("=");let n=e.substr(0,i),o=e.substr(i+1);if(n=n.trim(),o=o.trim(),n===t)return o}return null})("csrftoken");if(!e){const t=document.querySelector("[name=csrfmiddlewaretoken]");t&&(e=t.value)}const i=e?{"X-CSRFToken":e}:{},n=window.org_id;return n&&(i["X-Temba-Org"]=n),i["X-Requested-With"]="XMLHttpRequest",Object.keys(t).forEach((e=>{"X-Temba-Service-Org"===e&&delete i["X-Temba-Org"],i[e]=t[e]})),i},Ut=(t,e=null,i={})=>new Promise(((n,o)=>{const s={method:"GET",headers:Ht(i)};e&&(s.signal=e.signal),fetch(t,s).then((t=>{t.status<200||t.status>=300?o(t):t.text().then((i=>{let o={};try{o=JSON.parse(i)}catch(t){}n({controller:e,body:i,json:o,url:t.url,headers:t.headers,status:t.status})}))})).catch((t=>{o(t)}))})),Wt=t=>{const e=[];Object.keys(t).forEach((i=>{t[i]&&e.push(i)}));let i=e.join(" ");return i.trim().length>0&&(i=" "+i),i.trim()},Gt=(t,e=null,i={})=>new Promise(((n,o)=>{Ut(t,e,i).then((t=>{n({results:t.json.results,next:t.json.next})})).catch((t=>o(t)))})),Zt=async(t,e={})=>{if(!t)return new Promise((t=>t([])));let i=[],n=t;for(;n;){const t=await Gt(n,null,e);t.results&&(i=i.concat(t.results)),n=t.next}return i},Yt=t=>new Promise(((e,i)=>{Ut(t).then((t=>{t.status>=200&&t.status<300?e({assets:t.json.results,next:t.json.next}):i(t)})).catch((t=>i(t)))})),Xt=async t=>{if(!t)return new Promise((t=>t([])));let e=[],i=t;for(;i;){const t=await Yt(i);t.assets?(e=e.concat(t.assets),i=t.next):i=null}return e},Kt=(t,e,i={},n=null)=>{const o=Ht(i);n&&(o["Content-Type"]=n);const s={method:"POST",headers:o,body:e};return new Promise(((e,i)=>{fetch(t,s).then((async t=>{if(t.status>=500)return void i(t);const n=t.headers.get("X-Temba-Toasts");if(n){const t=document.querySelector("temba-toast");t&&t.addMessages(JSON.parse(n))}t.text().then((i=>{let n={};try{n=JSON.parse(i)}catch(t){}e({body:i,json:n,headers:t.headers,status:t.status,redirected:t.redirected,url:t.url})}))})).catch((t=>{i(t)}))}))},Qt=(t,e)=>Kt(t,JSON.stringify(e),!1,"application/json"),Jt=(t,e,i={})=>new Promise(((n,o)=>{Kt(t,e,i).then((e=>{e.status>=200&&e.status<400?n(e):o(t===Bt?e:"Server failure")})).catch((t=>{o(t)}))})),te=t=>{const e=t.parentNode||t.host;if(e){const t=e instanceof HTMLElement&&window.getComputedStyle(e).overflowY,i=t&&!(t.includes("hidden")||t.includes("visible"));return e?i&&e.scrollHeight>=e.clientHeight?e:te(e):null}return null},ee=(t,e,i=!1)=>{let n;return function(...o){const s=this,r=i&&!n;clearTimeout(n),n=setTimeout((function(){n=null,i||t.apply(s,o)}),e),r&&t.apply(s,o)}},ie=(t,e)=>{let i=!0;return function(...n){i&&(i=!1,t.apply(this,n),setTimeout((()=>{i=!0}),e))}},ne=(t,e="and")=>1===t.length?t[0]:2===t.length?"object"==typeof t[0]?U`${t[0]} ${e} ${t[1]}`:t.join(" "+e+" "):"object"==typeof t[0]?t.map(((i,n)=>n<t.length-1?U`${i}, `:U`${e} ${i}`)):t.join(", ")+e+t[t.length-1],oe=t=>{let e=null;if(document.cookie&&""!=document.cookie){const i=document.cookie.split(";");for(let n=0;n<i.length;n++){const o=i[n].trim();if(o.substring(0,t.length+1)==t+"="){e=decodeURIComponent(o.substring(t.length+1));break}}}return e};var se;!function(t){t.SETTINGS="settings",t.MENU_COLLAPSED="menu-collapsed",t.TICKET_SHOW_DETAILS="tickets.show-details"}(se||(se={}));const re=([t,...e],i=navigator.language)=>void 0===t?"":t.toLocaleUpperCase(i)+e.join(""),ae=t=>{let e=(t=t.trim()).match(/(([\p{L}\p{N}]+-[\p{L}\p{N}]+)|([\p{L}\p{N}]+))/gu)||[];if(1==e.length&&(e=t.match(/[\p{L}\p{N}]+/gu)),0==e.length)return"?";if(1==e.length)return e[0].substring(0,2).toUpperCase();const i=e.map((t=>t.substring(0,1))),n=i.filter(((t,e)=>t==t.toUpperCase()||0==e));return n.length>=2?(n[0]+n[1]).toUpperCase():(i[0]+i[1]).toUpperCase()},le=(t,e,i)=>{i/=100;const n=e*Math.min(i,1-i)/100,o=e=>{const o=(e+t/30)%12,s=i-n*Math.max(Math.min(o-3,9-o,1),-1);return Math.round(255*s).toString(16).padStart(2,"0")};return`#${o(0)}${o(8)}${o(4)}`},ce={attribute:!0,type:String,converter:_,reflect:!1,hasChanged:x},he=(t=ce,e,i)=>{const{kind:n,metadata:o}=i;let s=globalThis.litPropertyMetadata.get(o);if(void 0===s&&globalThis.litPropertyMetadata.set(o,s=new Map),s.set(i.name,t),"accessor"===n){const{name:n}=i;return{set(i){const o=e.get.call(this);e.set.call(this,i),this.requestUpdate(n,o,t)},init(e){return void 0!==e&&this.P(n,void 0,t),e}}}if("setter"===n){const{name:n}=i;return function(i){const o=this[n];e.call(this,i),this.requestUpdate(n,o,t)}}throw Error("Unsupported decorator location: "+n)};function de(t){return(e,i)=>"object"==typeof i?he(t,e,i):((t,e,i)=>{const n=e.hasOwnProperty(i);return e.constructor.createProperty(i,n?{...t,wrapped:!0}:t),n?Object.getOwnPropertyDescriptor(e,i):void 0})(t,e,i)
24
+ let ct=class extends k{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=((t,e,i)=>{const n=i?.renderBefore??e;let o=n._$litPart$;if(void 0===o){const t=i?.renderBefore??null;n._$litPart$=o=new et(e.insertBefore(D(),t),t,void 0,i??{})}return o._$AI(t),o})(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return W}};ct._$litElement$=!0,ct.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:ct});const ht=globalThis.litElementPolyfillSupport;ht?.({LitElement:ct}),(globalThis.litElementVersions??=[]).push("4.0.4");var dt,ut,pt,mt,ft,gt,vt,yt,bt,_t,xt,wt,kt,St,Ct,Et,At,Mt,Tt=function(t,e,i){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,i),i},Pt=function(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)};const Ot=function(t){var e=0;t+="x";var i=Math.floor(65745979961613.07);for(let n=0;n<t.length;n++)e>i&&(e=Math.floor(e/137)),e=131*e+t.charCodeAt(n);return e},Dt="0123456789abcdef".split(""),It=[-2147483648,8388608,32768,128],Lt=[24,16,8,0],$t=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],zt=[];class Rt{constructor(t=!1,e=!1){dt.set(this,void 0),ut.set(this,void 0),pt.set(this,void 0),mt.set(this,void 0),ft.set(this,void 0),gt.set(this,void 0),vt.set(this,void 0),yt.set(this,void 0),bt.set(this,void 0),_t.set(this,void 0),xt.set(this,void 0),wt.set(this,void 0),kt.set(this,void 0),St.set(this,void 0),Ct.set(this,void 0),Et.set(this,void 0),At.set(this,0),Mt.set(this,void 0),this.init(t,e)}init(t,e){e?(zt[0]=zt[16]=zt[1]=zt[2]=zt[3]=zt[4]=zt[5]=zt[6]=zt[7]=zt[8]=zt[9]=zt[10]=zt[11]=zt[12]=zt[13]=zt[14]=zt[15]=0,Tt(this,ut,zt)):Tt(this,ut,[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),t?(Tt(this,gt,3238371032),Tt(this,vt,914150663),Tt(this,yt,812702999),Tt(this,bt,4144912697),Tt(this,_t,4290775857),Tt(this,xt,1750603025),Tt(this,wt,1694076839),Tt(this,kt,3204075428)):(Tt(this,gt,1779033703),Tt(this,vt,3144134277),Tt(this,yt,1013904242),Tt(this,bt,2773480762),Tt(this,_t,1359893119),Tt(this,xt,2600822924),Tt(this,wt,528734635),Tt(this,kt,1541459225)),Tt(this,dt,Tt(this,Mt,Tt(this,pt,Tt(this,Ct,0)))),Tt(this,mt,Tt(this,St,!1)),Tt(this,ft,!0),Tt(this,Et,t)}update(t){if(Pt(this,mt))return this;let e;e=t instanceof ArrayBuffer?new Uint8Array(t):t;let i=0;const n=e.length,o=Pt(this,ut);for(;i<n;){let t;if(Pt(this,St)&&(Tt(this,St,!1),o[0]=Pt(this,dt),o[16]=o[1]=o[2]=o[3]=o[4]=o[5]=o[6]=o[7]=o[8]=o[9]=o[10]=o[11]=o[12]=o[13]=o[14]=o[15]=0),"string"!=typeof e)for(t=Pt(this,Mt);i<n&&t<64;++i)o[t>>2]|=e[i]<<Lt[3&t++];else for(t=Pt(this,Mt);i<n&&t<64;++i){let n=e.charCodeAt(i);n<128?o[t>>2]|=n<<Lt[3&t++]:n<2048?(o[t>>2]|=(192|n>>6)<<Lt[3&t++],o[t>>2]|=(128|63&n)<<Lt[3&t++]):n<55296||n>=57344?(o[t>>2]|=(224|n>>12)<<Lt[3&t++],o[t>>2]|=(128|n>>6&63)<<Lt[3&t++],o[t>>2]|=(128|63&n)<<Lt[3&t++]):(n=65536+((1023&n)<<10|1023&e.charCodeAt(++i)),o[t>>2]|=(240|n>>18)<<Lt[3&t++],o[t>>2]|=(128|n>>12&63)<<Lt[3&t++],o[t>>2]|=(128|n>>6&63)<<Lt[3&t++],o[t>>2]|=(128|63&n)<<Lt[3&t++])}Tt(this,At,t),Tt(this,pt,Pt(this,pt)+(t-Pt(this,Mt))),t>=64?(Tt(this,dt,o[16]),Tt(this,Mt,t-64),this.hash(),Tt(this,St,!0)):Tt(this,Mt,t)}return Pt(this,pt)>4294967295&&(Tt(this,Ct,Pt(this,Ct)+(Pt(this,pt)/4294967296|0)),Tt(this,pt,Pt(this,pt)%4294967296)),this}finalize(){if(Pt(this,mt))return;Tt(this,mt,!0);const t=Pt(this,ut),e=Pt(this,At);t[16]=Pt(this,dt),t[e>>2]|=It[3&e],Tt(this,dt,t[16]),e>=56&&(Pt(this,St)||this.hash(),t[0]=Pt(this,dt),t[16]=t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=0),t[14]=Pt(this,Ct)<<3|Pt(this,pt)>>>29,t[15]=Pt(this,pt)<<3,this.hash()}hash(){let t=Pt(this,gt),e=Pt(this,vt),i=Pt(this,yt),n=Pt(this,bt),o=Pt(this,_t),s=Pt(this,xt),r=Pt(this,wt),a=Pt(this,kt);const l=Pt(this,ut);let c,h,d,u,p,m,f,g,v,y;for(let t=16;t<64;++t)u=l[t-15],c=(u>>>7|u<<25)^(u>>>18|u<<14)^u>>>3,u=l[t-2],h=(u>>>17|u<<15)^(u>>>19|u<<13)^u>>>10,l[t]=l[t-16]+c+l[t-7]+h|0;y=e&i;for(let b=0;b<64;b+=4)Pt(this,ft)?(Pt(this,Et)?(f=300032,u=l[0]-1413257819,a=u-150054599|0,n=u+24177077|0):(f=704751109,u=l[0]-210244248,a=u-1521486534|0,n=u+143694565|0),Tt(this,ft,!1)):(c=(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10),h=(o>>>6|o<<26)^(o>>>11|o<<21)^(o>>>25|o<<7),f=t&e,d=f^t&i^y,m=o&s^~o&r,u=a+h+m+$t[b]+l[b],p=c+d,a=n+u|0,n=u+p|0),c=(n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10),h=(a>>>6|a<<26)^(a>>>11|a<<21)^(a>>>25|a<<7),g=n&t,d=g^n&e^f,m=a&o^~a&s,u=r+h+m+$t[b+1]+l[b+1],p=c+d,r=i+u|0,i=u+p|0,c=(i>>>2|i<<30)^(i>>>13|i<<19)^(i>>>22|i<<10),h=(r>>>6|r<<26)^(r>>>11|r<<21)^(r>>>25|r<<7),v=i&n,d=v^i&t^g,m=r&a^~r&o,u=s+h+m+$t[b+2]+l[b+2],p=c+d,s=e+u|0,e=u+p|0,c=(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10),h=(s>>>6|s<<26)^(s>>>11|s<<21)^(s>>>25|s<<7),y=e&i,d=y^e&n^v,m=s&r^~s&a,u=o+h+m+$t[b+3]+l[b+3],p=c+d,o=t+u|0,t=u+p|0;Tt(this,gt,Pt(this,gt)+t|0),Tt(this,vt,Pt(this,vt)+e|0),Tt(this,yt,Pt(this,yt)+i|0),Tt(this,bt,Pt(this,bt)+n|0),Tt(this,_t,Pt(this,_t)+o|0),Tt(this,xt,Pt(this,xt)+s|0),Tt(this,wt,Pt(this,wt)+r|0),Tt(this,kt,Pt(this,kt)+a|0)}hex(){this.finalize();const t=Pt(this,gt),e=Pt(this,vt),i=Pt(this,yt),n=Pt(this,bt),o=Pt(this,_t),s=Pt(this,xt),r=Pt(this,wt),a=Pt(this,kt);let l=Dt[t>>28&15]+Dt[t>>24&15]+Dt[t>>20&15]+Dt[t>>16&15]+Dt[t>>12&15]+Dt[t>>8&15]+Dt[t>>4&15]+Dt[15&t]+Dt[e>>28&15]+Dt[e>>24&15]+Dt[e>>20&15]+Dt[e>>16&15]+Dt[e>>12&15]+Dt[e>>8&15]+Dt[e>>4&15]+Dt[15&e]+Dt[i>>28&15]+Dt[i>>24&15]+Dt[i>>20&15]+Dt[i>>16&15]+Dt[i>>12&15]+Dt[i>>8&15]+Dt[i>>4&15]+Dt[15&i]+Dt[n>>28&15]+Dt[n>>24&15]+Dt[n>>20&15]+Dt[n>>16&15]+Dt[n>>12&15]+Dt[n>>8&15]+Dt[n>>4&15]+Dt[15&n]+Dt[o>>28&15]+Dt[o>>24&15]+Dt[o>>20&15]+Dt[o>>16&15]+Dt[o>>12&15]+Dt[o>>8&15]+Dt[o>>4&15]+Dt[15&o]+Dt[s>>28&15]+Dt[s>>24&15]+Dt[s>>20&15]+Dt[s>>16&15]+Dt[s>>12&15]+Dt[s>>8&15]+Dt[s>>4&15]+Dt[15&s]+Dt[r>>28&15]+Dt[r>>24&15]+Dt[r>>20&15]+Dt[r>>16&15]+Dt[r>>12&15]+Dt[r>>8&15]+Dt[r>>4&15]+Dt[15&r];return Pt(this,Et)||(l+=Dt[a>>28&15]+Dt[a>>24&15]+Dt[a>>20&15]+Dt[a>>16&15]+Dt[a>>12&15]+Dt[a>>8&15]+Dt[a>>4&15]+Dt[15&a]),l}toString(){return this.hex()}digest(){this.finalize();const t=Pt(this,gt),e=Pt(this,vt),i=Pt(this,yt),n=Pt(this,bt),o=Pt(this,_t),s=Pt(this,xt),r=Pt(this,wt),a=Pt(this,kt),l=[t>>24&255,t>>16&255,t>>8&255,255&t,e>>24&255,e>>16&255,e>>8&255,255&e,i>>24&255,i>>16&255,i>>8&255,255&i,n>>24&255,n>>16&255,n>>8&255,255&n,o>>24&255,o>>16&255,o>>8&255,255&o,s>>24&255,s>>16&255,s>>8&255,255&s,r>>24&255,r>>16&255,r>>8&255,255&r];return Pt(this,Et)||l.push(a>>24&255,a>>16&255,a>>8&255,255&a),l}array(){return this.digest()}arrayBuffer(){this.finalize();const t=new ArrayBuffer(Pt(this,Et)?28:32),e=new DataView(t);return e.setUint32(0,Pt(this,gt)),e.setUint32(4,Pt(this,vt)),e.setUint32(8,Pt(this,yt)),e.setUint32(12,Pt(this,bt)),e.setUint32(16,Pt(this,_t)),e.setUint32(20,Pt(this,xt)),e.setUint32(24,Pt(this,wt)),Pt(this,Et)||e.setUint32(28,Pt(this,kt)),t}}function Nt(t){const e=new Rt;return e.update(t),parseInt(e.hex().substring(0,8),16)}dt=new WeakMap,ut=new WeakMap,pt=new WeakMap,mt=new WeakMap,ft=new WeakMap,gt=new WeakMap,vt=new WeakMap,yt=new WeakMap,bt=new WeakMap,_t=new WeakMap,xt=new WeakMap,wt=new WeakMap,kt=new WeakMap,St=new WeakMap,Ct=new WeakMap,Et=new WeakMap,At=new WeakMap,Mt=new WeakMap;const jt=function(t,e,i){var n=i<.5?i*(1+e):i+e-i*e,o=2*i-n;return[(t/=360)+1/3,t,t-1/3].map((function(t){return t<0&&t++,t>1&&t--,t=t<1/6?o+6*(n-o)*t:t<.5?n:t<2/3?o+6*(n-o)*(2/3-t):o,Math.round(255*t)}))};const Bt="/api/v2/media.json",Ft=new class{constructor(t={}){const[e,i]=[t.lightness,t.saturation].map((function(t){return t=void 0!==t?t:[.35,.5,.65],Array.isArray(t)?t.concat():[t]}));this.L=e,this.S=i,"number"==typeof t.hue&&(t.hue={min:t.hue,max:t.hue}),"object"!=typeof t.hue||Array.isArray(t.hue)||(t.hue=[t.hue]),void 0===t.hue&&(t.hue=[]),this.hueRanges=t.hue.map((function(t){return{min:void 0===t.min?0:t.min,max:void 0===t.max?360:t.max}})),this.hash=Nt,"function"==typeof t.hash&&(this.hash=t.hash),"bkdr"===t.hash&&(this.hash=Ot)}hsl(t){var e,i,n=this.hash(t);if(this.hueRanges.length){const t=this.hueRanges[n%this.hueRanges.length];e=n/this.hueRanges.length%727*(t.max-t.min)/727+t.min}else e=n%359;return n=Math.ceil(n/360),i=this.S[n%this.S.length],n=Math.ceil(n/this.S.length),[e,i,this.L[n%this.L.length]]}rgb(t){var e=this.hsl(t);return jt.apply(this,e)}hex(t){return function(t){var e="#";return t.forEach((function(t){t<16&&(e+=0),e+=t.toString(16)})),e}(this.rgb(t))}};var qt;!function(t){t.BLUE="color:#5078b5;",t.GREEN="color:#62bd6a;",t.RED="color:#e36049;",t.PURPLE="color:#a626a4;"}(qt||(qt={}));const Vt=(t,e="",i=[])=>{""!==e?"object"!=typeof t?console.log("%c"+t,e,...i):console.log("%c"+JSON.stringify(t,null,2),e):console.log(t)},Ht=(t={})=>{let e=(t=>{for(const e of document.cookie.split(";")){const i=e.indexOf("=");let n=e.substr(0,i),o=e.substr(i+1);if(n=n.trim(),o=o.trim(),n===t)return o}return null})("csrftoken");if(!e){const t=document.querySelector("[name=csrfmiddlewaretoken]");t&&(e=t.value)}const i=e?{"X-CSRFToken":e}:{},n=window.org_id;return n&&(i["X-Temba-Org"]=n),i["X-Requested-With"]="XMLHttpRequest",Object.keys(t).forEach((e=>{"X-Temba-Service-Org"===e&&delete i["X-Temba-Org"],i[e]=t[e]})),i},Ut=(t,e=null,i={})=>new Promise(((n,o)=>{const s={method:"GET",headers:Ht(i)};e&&(s.signal=e.signal),fetch(t,s).then((t=>{t.status<200||t.status>=300?o(t):t.text().then((i=>{let o={};try{o=JSON.parse(i)}catch(t){}n({controller:e,body:i,json:o,url:t.url,headers:t.headers,status:t.status})}))})).catch((t=>{o(t)}))})),Wt=t=>{const e=[];Object.keys(t).forEach((i=>{t[i]&&e.push(i)}));let i=e.join(" ");return i.trim().length>0&&(i=" "+i),i.trim()},Gt=(t,e=null,i={})=>new Promise(((n,o)=>{Ut(t,e,i).then((t=>{n({results:t.json.results,next:t.json.next})})).catch((t=>o(t)))})),Zt=async(t,e={})=>{if(!t)return new Promise((t=>t([])));let i=[],n=t;for(;n;){const t=await Gt(n,null,e);t.results&&(i=i.concat(t.results)),n=t.next}return i},Yt=t=>new Promise(((e,i)=>{Ut(t).then((t=>{t.status>=200&&t.status<300?e({assets:t.json.results,next:t.json.next}):i(t)})).catch((t=>i(t)))})),Xt=async t=>{if(!t)return new Promise((t=>t([])));let e=[],i=t;for(;i;){const t=await Yt(i);t.assets?(e=e.concat(t.assets),i=t.next):i=null}return e},Kt=(t,e,i={},n=null)=>{const o=Ht(i);n&&(o["Content-Type"]=n);const s={method:"POST",headers:o,body:e};return new Promise(((e,i)=>{fetch(t,s).then((async t=>{if(t.status>=500)return void i(t);const n=t.headers.get("X-Temba-Toasts");if(n){const t=document.querySelector("temba-toast");t&&t.addMessages(JSON.parse(n))}t.text().then((i=>{let n={};try{n=JSON.parse(i)}catch(t){}e({body:i,json:n,headers:t.headers,status:t.status,redirected:t.redirected,url:t.url})}))})).catch((t=>{i(t)}))}))},Qt=(t,e)=>Kt(t,JSON.stringify(e),!1,"application/json"),Jt=(t,e,i={})=>new Promise(((n,o)=>{Kt(t,e,i).then((e=>{e.status>=200&&e.status<400?n(e):o(t===Bt?e:"Server failure")})).catch((t=>{o(t)}))})),te=t=>{const e=t.parentNode||t.host;if(e){const t=e instanceof HTMLElement&&window.getComputedStyle(e).overflowY,i=t&&!(t.includes("hidden")||t.includes("visible"));return e?i&&e.scrollHeight>=e.clientHeight?e:te(e):null}return null},ee=(t,e,i=!1)=>{let n;return function(...o){const s=this,r=i&&!n;clearTimeout(n),n=setTimeout((function(){n=null,i||t.apply(s,o)}),e),r&&t.apply(s,o)}},ie=(t,e)=>{let i=!0;return function(...n){i&&(i=!1,t.apply(this,n),setTimeout((()=>{i=!0}),e))}},ne=(t,e="and")=>{if(0===t.length)return"";if(1===t.length)return t[0];if(2===t.length)return"object"==typeof t[0]?U`${t[0]} ${e} ${t[1]}`:t.join(" "+e+" ");if("object"==typeof t[0])return t.map(((i,n)=>n<t.length-1?U`${i}, `:U`${e} ${i}`));const i=t.slice(0,-1),n=t[t.length-1];return i.join(", ")+", "+e+" "+n},oe=t=>{let e=null;if(document.cookie&&""!=document.cookie){const i=document.cookie.split(";");for(let n=0;n<i.length;n++){const o=i[n].trim();if(o.substring(0,t.length+1)==t+"="){e=decodeURIComponent(o.substring(t.length+1));break}}}return e};var se;!function(t){t.SETTINGS="settings",t.MENU_COLLAPSED="menu-collapsed",t.TICKET_SHOW_DETAILS="tickets.show-details"}(se||(se={}));const re=([t,...e],i=navigator.language)=>void 0===t?"":t.toLocaleUpperCase(i)+e.join(""),ae=t=>{let e=(t=t.trim()).match(/(([\p{L}\p{N}]+-[\p{L}\p{N}]+)|([\p{L}\p{N}]+))/gu)||[];if(1==e.length&&(e=t.match(/[\p{L}\p{N}]+/gu)),0==e.length)return"?";if(1==e.length)return e[0].substring(0,2).toUpperCase();const i=e.map((t=>t.substring(0,1))),n=i.filter(((t,e)=>t==t.toUpperCase()||0==e));return n.length>=2?(n[0]+n[1]).toUpperCase():(i[0]+i[1]).toUpperCase()},le=(t,e,i)=>{i/=100;const n=e*Math.min(i,1-i)/100,o=e=>{const o=(e+t/30)%12,s=i-n*Math.max(Math.min(o-3,9-o,1),-1);return Math.round(255*s).toString(16).padStart(2,"0")};return`#${o(0)}${o(8)}${o(4)}`},ce={attribute:!0,type:String,converter:_,reflect:!1,hasChanged:x},he=(t=ce,e,i)=>{const{kind:n,metadata:o}=i;let s=globalThis.litPropertyMetadata.get(o);if(void 0===s&&globalThis.litPropertyMetadata.set(o,s=new Map),s.set(i.name,t),"accessor"===n){const{name:n}=i;return{set(i){const o=e.get.call(this);e.set.call(this,i),this.requestUpdate(n,o,t)},init(e){return void 0!==e&&this.P(n,void 0,t),e}}}if("setter"===n){const{name:n}=i;return function(i){const o=this[n];e.call(this,i),this.requestUpdate(n,o,t)}}throw Error("Unsupported decorator location: "+n)};function de(t){return(e,i)=>"object"==typeof i?he(t,e,i):((t,e,i)=>{const n=e.hasOwnProperty(i);return e.constructor.createProperty(i,n?{...t,wrapped:!0}:t),n?Object.getOwnPropertyDescriptor(e,i):void 0})(t,e,i)
25
25
  /**
26
26
  * @license
27
27
  * Copyright 2017 Google LLC
@@ -391,7 +391,7 @@ let yr=Ks,br=!1;const _r=["es","fr","pt"],xr="data:image/png;base64,iVBORw0KGgoA
391
391
  -webkit-box-orient: vertical;
392
392
  overflow: hidden;
393
393
  }
394
- `,t([de({type:Number})],kr.prototype,"scale",void 0),t([de({type:Boolean})],kr.prototype,"showName",void 0),t([de({type:Boolean})],kr.prototype,"system",void 0),t([de({type:String,attribute:!1})],kr.prototype,"bgimage",void 0),t([de({type:String,attribute:!1})],kr.prototype,"bgcolor",void 0),t([de({type:String,attribute:!1})],kr.prototype,"initials",void 0),t([de({type:String})],kr.prototype,"name",void 0),t([de({type:String})],kr.prototype,"email",void 0),t([de({type:String})],kr.prototype,"avatar",void 0);const Sr=t=>{let e;const i=new Set,n=(t,n)=>{const o="function"==typeof t?t(e):t;if(!Object.is(o,e)){const t=e;e=(null!=n?n:"object"!=typeof o||null===o)?o:Object.assign({},e,o),i.forEach((i=>i(e,t)))}},o=()=>e,s={setState:n,getState:o,getInitialState:()=>r,subscribe:t=>(i.add(t),()=>i.delete(t))},r=e=t(n,o,s);return s};var Cr=Symbol.for("immer-nothing"),Er=Symbol.for("immer-draftable"),Ar=Symbol.for("immer-state"),Mr=[function(t){return`The plugin for '${t}' has not been loaded into Immer. To enable the plugin, import and call \`enable${t}()\` when initializing your application.`},function(t){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${t}'`},"This object has been frozen and should not be mutated",function(t){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+t},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(t){return`'current' expects a draft, got: ${t}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(t){return`'original' expects a draft, got: ${t}`}];function Tr(t,...e){{const i=Mr[t],n="function"==typeof i?i.apply(null,e):i;throw new Error(`[Immer] ${n}`)}}var Pr=Object.getPrototypeOf;function Or(t){return!!t&&!!t[Ar]}function Dr(t){return!!t&&(Lr(t)||Array.isArray(t)||!!t[Er]||!!t.constructor?.[Er]||jr(t)||Br(t))}var Ir=Object.prototype.constructor.toString();function Lr(t){if(!t||"object"!=typeof t)return!1;const e=Pr(t);if(null===e)return!0;const i=Object.hasOwnProperty.call(e,"constructor")&&e.constructor;return i===Object||"function"==typeof i&&Function.toString.call(i)===Ir}function $r(t,e){0===zr(t)?Reflect.ownKeys(t).forEach((i=>{e(i,t[i],t)})):t.forEach(((i,n)=>e(n,i,t)))}function zr(t){const e=t[Ar];return e?e.type_:Array.isArray(t)?1:jr(t)?2:Br(t)?3:0}function Rr(t,e){return 2===zr(t)?t.has(e):Object.prototype.hasOwnProperty.call(t,e)}function Nr(t,e,i){const n=zr(t);2===n?t.set(e,i):3===n?t.add(i):t[e]=i}function jr(t){return t instanceof Map}function Br(t){return t instanceof Set}function Fr(t){return t.copy_||t.base_}function qr(t,e){if(jr(t))return new Map(t);if(Br(t))return new Set(t);if(Array.isArray(t))return Array.prototype.slice.call(t);const i=Lr(t);if(!0===e||"class_only"===e&&!i){const e=Object.getOwnPropertyDescriptors(t);delete e[Ar];let i=Reflect.ownKeys(e);for(let n=0;n<i.length;n++){const o=i[n],s=e[o];!1===s.writable&&(s.writable=!0,s.configurable=!0),(s.get||s.set)&&(e[o]={configurable:!0,writable:!0,enumerable:s.enumerable,value:t[o]})}return Object.create(Pr(t),e)}{const e=Pr(t);if(null!==e&&i)return{...t};const n=Object.create(e);return Object.assign(n,t)}}function Vr(t,e=!1){return Ur(t)||Or(t)||!Dr(t)||(zr(t)>1&&(t.set=t.add=t.clear=t.delete=Hr),Object.freeze(t),e&&Object.entries(t).forEach((([t,e])=>Vr(e,!0)))),t}function Hr(){Tr(2)}function Ur(t){return Object.isFrozen(t)}var Wr,Gr={};function Zr(t){const e=Gr[t];return e||Tr(0,t),e}function Yr(){return Wr}function Xr(t,e){e&&(Zr("Patches"),t.patches_=[],t.inversePatches_=[],t.patchListener_=e)}function Kr(t){Qr(t),t.drafts_.forEach(ta),t.drafts_=null}function Qr(t){t===Wr&&(Wr=t.parent_)}function Jr(t){return Wr={drafts_:[],parent_:Wr,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function ta(t){const e=t[Ar];0===e.type_||1===e.type_?e.revoke_():e.revoked_=!0}function ea(t,e){e.unfinalizedDrafts_=e.drafts_.length;const i=e.drafts_[0];return void 0!==t&&t!==i?(i[Ar].modified_&&(Kr(e),Tr(4)),Dr(t)&&(t=ia(e,t),e.parent_||oa(e,t)),e.patches_&&Zr("Patches").generateReplacementPatches_(i[Ar].base_,t,e.patches_,e.inversePatches_)):t=ia(e,i,[]),Kr(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),t!==Cr?t:void 0}function ia(t,e,i){if(Ur(e))return e;const n=e[Ar];if(!n)return $r(e,((o,s)=>na(t,n,e,o,s,i))),e;if(n.scope_!==t)return e;if(!n.modified_)return oa(t,n.base_,!0),n.base_;if(!n.finalized_){n.finalized_=!0,n.scope_.unfinalizedDrafts_--;const e=n.copy_;let o=e,s=!1;3===n.type_&&(o=new Set(e),e.clear(),s=!0),$r(o,((o,r)=>na(t,n,e,o,r,i,s))),oa(t,e,!1),i&&t.patches_&&Zr("Patches").generatePatches_(n,i,t.patches_,t.inversePatches_)}return n.copy_}function na(t,e,i,n,o,s,r){if(o===i&&Tr(5),Or(o)){const r=ia(t,o,s&&e&&3!==e.type_&&!Rr(e.assigned_,n)?s.concat(n):void 0);if(Nr(i,n,r),!Or(r))return;t.canAutoFreeze_=!1}else r&&i.add(o);if(Dr(o)&&!Ur(o)){if(!t.immer_.autoFreeze_&&t.unfinalizedDrafts_<1)return;ia(t,o),e&&e.scope_.parent_||"symbol"==typeof n||!Object.prototype.propertyIsEnumerable.call(i,n)||oa(t,o)}}function oa(t,e,i=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&Vr(e,i)}var sa={get(t,e){if(e===Ar)return t;const i=Fr(t);if(!Rr(i,e))return function(t,e,i){const n=la(e,i);return n?"value"in n?n.value:n.get?.call(t.draft_):void 0}(t,i,e);const n=i[e];return t.finalized_||!Dr(n)?n:n===aa(t.base_,e)?(ha(t),t.copy_[e]=da(n,t)):n},has:(t,e)=>e in Fr(t),ownKeys:t=>Reflect.ownKeys(Fr(t)),set(t,e,i){const n=la(Fr(t),e);if(n?.set)return n.set.call(t.draft_,i),!0;if(!t.modified_){const n=aa(Fr(t),e),o=n?.[Ar];if(o&&o.base_===i)return t.copy_[e]=i,t.assigned_[e]=!1,!0;if(function(t,e){return t===e?0!==t||1/t==1/e:t!=t&&e!=e}(i,n)&&(void 0!==i||Rr(t.base_,e)))return!0;ha(t),ca(t)}return t.copy_[e]===i&&(void 0!==i||e in t.copy_)||Number.isNaN(i)&&Number.isNaN(t.copy_[e])||(t.copy_[e]=i,t.assigned_[e]=!0),!0},deleteProperty:(t,e)=>(void 0!==aa(t.base_,e)||e in t.base_?(t.assigned_[e]=!1,ha(t),ca(t)):delete t.assigned_[e],t.copy_&&delete t.copy_[e],!0),getOwnPropertyDescriptor(t,e){const i=Fr(t),n=Reflect.getOwnPropertyDescriptor(i,e);return n?{writable:!0,configurable:1!==t.type_||"length"!==e,enumerable:n.enumerable,value:i[e]}:n},defineProperty(){Tr(11)},getPrototypeOf:t=>Pr(t.base_),setPrototypeOf(){Tr(12)}},ra={};function aa(t,e){const i=t[Ar];return(i?Fr(i):t)[e]}function la(t,e){if(!(e in t))return;let i=Pr(t);for(;i;){const t=Object.getOwnPropertyDescriptor(i,e);if(t)return t;i=Pr(i)}}function ca(t){t.modified_||(t.modified_=!0,t.parent_&&ca(t.parent_))}function ha(t){t.copy_||(t.copy_=qr(t.base_,t.scope_.immer_.useStrictShallowCopy_))}$r(sa,((t,e)=>{ra[t]=function(){return arguments[0]=arguments[0][0],e.apply(this,arguments)}})),ra.deleteProperty=function(t,e){return isNaN(parseInt(e))&&Tr(13),ra.set.call(this,t,e,void 0)},ra.set=function(t,e,i){return"length"!==e&&isNaN(parseInt(e))&&Tr(14),sa.set.call(this,t[0],e,i,t[0])};function da(t,e){const i=jr(t)?Zr("MapSet").proxyMap_(t,e):Br(t)?Zr("MapSet").proxySet_(t,e):function(t,e){const i=Array.isArray(t),n={type_:i?1:0,scope_:e?e.scope_:Yr(),modified_:!1,finalized_:!1,assigned_:{},parent_:e,base_:t,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=n,s=sa;i&&(o=[n],s=ra);const{revoke:r,proxy:a}=Proxy.revocable(o,s);return n.draft_=a,n.revoke_=r,a}(t,e);return(e?e.scope_:Yr()).drafts_.push(i),i}function ua(t){if(!Dr(t)||Ur(t))return t;const e=t[Ar];let i;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,i=qr(t,e.scope_.immer_.useStrictShallowCopy_)}else i=qr(t,!0);return $r(i,((t,e)=>{Nr(i,t,ua(e))})),e&&(e.finalized_=!1),i}var pa=new class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,e,i)=>{if("function"==typeof t&&"function"!=typeof e){const i=e;e=t;const n=this;return function(t=i,...o){return n.produce(t,(t=>e.call(this,t,...o)))}}let n;if("function"!=typeof e&&Tr(6),void 0!==i&&"function"!=typeof i&&Tr(7),Dr(t)){const o=Jr(this),s=da(t,void 0);let r=!0;try{n=e(s),r=!1}finally{r?Kr(o):Qr(o)}return Xr(o,i),ea(n,o)}if(!t||"object"!=typeof t){if(n=e(t),void 0===n&&(n=t),n===Cr&&(n=void 0),this.autoFreeze_&&Vr(n,!0),i){const e=[],o=[];Zr("Patches").generateReplacementPatches_(t,n,e,o),i(e,o)}return n}Tr(1,t)},this.produceWithPatches=(t,e)=>{if("function"==typeof t)return(e,...i)=>this.produceWithPatches(e,(e=>t(e,...i)));let i,n;const o=this.produce(t,e,((t,e)=>{i=t,n=e}));return[o,i,n]},"boolean"==typeof t?.autoFreeze&&this.setAutoFreeze(t.autoFreeze),"boolean"==typeof t?.useStrictShallowCopy&&this.setUseStrictShallowCopy(t.useStrictShallowCopy)}createDraft(t){Dr(t)||Tr(8),Or(t)&&(t=function(t){Or(t)||Tr(10,t);return ua(t)}(t));const e=Jr(this),i=da(t,void 0);return i[Ar].isManual_=!0,Qr(e),i}finishDraft(t,e){const i=t&&t[Ar];i&&i.isManual_||Tr(9);const{scope_:n}=i;return Xr(n,e),ea(void 0,n)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}applyPatches(t,e){let i;for(i=e.length-1;i>=0;i--){const n=e[i];if(0===n.path.length&&"replace"===n.op){t=n.value;break}}i>-1&&(e=e.slice(i+1));const n=Zr("Patches").applyPatches_;return Or(t)?n(t,e):this.produce(t,(t=>n(t,e)))}},ma=pa.produce;pa.produceWithPatches.bind(pa),pa.setAutoFreeze.bind(pa),pa.setUseStrictShallowCopy.bind(pa),pa.applyPatches.bind(pa),pa.createDraft.bind(pa),pa.finishDraft.bind(pa);const fa=t=>(e,i,n)=>(n.setState=(t,i,...n)=>{const o="function"==typeof t?ma(t):t;return e(o,i,...n)},t(n.setState,i,n)),ga=t=>(e,i,n)=>{const o=n.subscribe;n.subscribe=(t,e,i)=>{let s=t;if(e){const o=(null==i?void 0:i.equalityFn)||Object.is;let r=t(n.getState());s=i=>{const n=t(i);if(!o(r,n)){const t=r;e(r=n,t)}},(null==i?void 0:i.fireImmediately)&&e(r,r)}return o(s)};return t(e,i,n)},va=Sr(ga(fa(((t,e)=>({languageNames:{},canvasSize:{width:0,height:0},languageCode:"",workspace:null,flowDefinition:null,flowInfo:null,isTranslating:!1,fetchRevision:async(e,i=null)=>{i||(i="latest");const n=await fetch(`${e}/${i}/?version=14.3`);if(!n.ok)throw new Error("Network response was not ok");const o=await n.json();t({flowInfo:o.info,flowDefinition:o.definition})},fetchWorkspace:async e=>{const i=await fetch(e);if(!i.ok)throw new Error("Network response was not ok");const n=await i.json();t({workspace:n})},fetchAllLanguages:async e=>{const i=(await Zt(e)).reduce((function(t,e){return t[e.value]=e.name,t}),{});t({languageNames:i})},getFlowResults:()=>e().flowInfo.results,getResultByKey:t=>e().flowInfo.results.find((e=>e.key===t)),getLanguage:()=>{const t=e(),i=t.languageCode;return{name:t.languageNames[i],code:i}},setFlowContents:e=>{t((t=>{const i=e.definition.language,n=t.languageCode||i;t.flowDefinition=e.definition,t.flowInfo=e.info,t.isTranslating=i!==n,t.languageCode=n||i}))},setFlowInfo:e=>{t((t=>{t.flowInfo=e}))},setLanguageCode:e=>{t((t=>{t.languageCode=e,t.isTranslating=t.flowDefinition.language!==e}))},setTestUpdate:()=>{t((t=>{t.flowDefinition.name="Bloop!"}))},expandCanvas:(e,i)=>{t((t=>{const n=Math.max(t.canvasSize.width,e+800),o=Math.max(t.canvasSize.height,i+800);t.canvasSize.width=n,t.canvasSize.height=o}))},updateCanvasPositions:e=>{t((t=>{for(const i in e)t.flowDefinition._ui.nodes[i]&&(t.flowDefinition._ui.nodes[i].position=e[i])}))},removeNodes:e=>{t((t=>{for(const i of e)delete t.flowDefinition._ui.nodes[i];t.flowDefinition.nodes=t.flowDefinition.nodes.filter((t=>!e.includes(t.uuid)))}))}})))));function ya(t,e){return(i,n)=>{de()(i,n);const o="connectedCallback",s="disconnectedCallback",r=i[o],a=i[s];i[o]=function(){var i;null!==(i=this._zustandUnsubscribe)&&void 0!==i||(this._zustandUnsubscribe={}),this[n]=e(t.getState()),this._zustandUnsubscribe[n]=t.subscribe(e,(t=>{this[n]=t})),r&&r.call(this)},i[s]=function(){var t,e;null===(e=null===(t=this._zustandUnsubscribe)||void 0===t?void 0:t[n])||void 0===e||e.call(t),a&&a.call(this)}}}const{setLocale:ba}=(t=>(function(t){if(br)throw new Error("lit-localize can only be configured once");yr=t,br=!0}(((t,e)=>rr(ur,t,e))),pr=cr=t.sourceLocale,hr=new Set(t.targetLocales),hr.add(t.sourceLocale),dr=t.loadLocale,{getLocale:gr,setLocale:vr}))({sourceLocale:"en",targetLocales:_r,loadLocale:t=>import(`./locales/${t}.js`)}),_a=()=>document.querySelector("temba-store");class xa extends fe{constructor(){super(...arguments),this.settings={},this.ttl=6e4,this.max=20,this.ready=!1,this.loader=!1,this.keyedAssets={},this.locale=[...navigator.languages],this.fields={},this.groups={},this.shortcuts=[],this.languages={},this.featuredFields=[],this.dirtyElements=[],this.pendingResolves={},this.fetching={}}static get styles(){return a`
394
+ `,t([de({type:Number})],kr.prototype,"scale",void 0),t([de({type:Boolean})],kr.prototype,"showName",void 0),t([de({type:Boolean})],kr.prototype,"system",void 0),t([de({type:String,attribute:!1})],kr.prototype,"bgimage",void 0),t([de({type:String,attribute:!1})],kr.prototype,"bgcolor",void 0),t([de({type:String,attribute:!1})],kr.prototype,"initials",void 0),t([de({type:String})],kr.prototype,"name",void 0),t([de({type:String})],kr.prototype,"email",void 0),t([de({type:String})],kr.prototype,"avatar",void 0);const Sr=t=>{let e;const i=new Set,n=(t,n)=>{const o="function"==typeof t?t(e):t;if(!Object.is(o,e)){const t=e;e=(null!=n?n:"object"!=typeof o||null===o)?o:Object.assign({},e,o),i.forEach((i=>i(e,t)))}},o=()=>e,s={setState:n,getState:o,getInitialState:()=>r,subscribe:t=>(i.add(t),()=>i.delete(t))},r=e=t(n,o,s);return s};var Cr=Symbol.for("immer-nothing"),Er=Symbol.for("immer-draftable"),Ar=Symbol.for("immer-state"),Mr=[function(t){return`The plugin for '${t}' has not been loaded into Immer. To enable the plugin, import and call \`enable${t}()\` when initializing your application.`},function(t){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${t}'`},"This object has been frozen and should not be mutated",function(t){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+t},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(t){return`'current' expects a draft, got: ${t}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(t){return`'original' expects a draft, got: ${t}`}];function Tr(t,...e){{const i=Mr[t],n="function"==typeof i?i.apply(null,e):i;throw new Error(`[Immer] ${n}`)}}var Pr=Object.getPrototypeOf;function Or(t){return!!t&&!!t[Ar]}function Dr(t){return!!t&&(Lr(t)||Array.isArray(t)||!!t[Er]||!!t.constructor?.[Er]||jr(t)||Br(t))}var Ir=Object.prototype.constructor.toString();function Lr(t){if(!t||"object"!=typeof t)return!1;const e=Pr(t);if(null===e)return!0;const i=Object.hasOwnProperty.call(e,"constructor")&&e.constructor;return i===Object||"function"==typeof i&&Function.toString.call(i)===Ir}function $r(t,e){0===zr(t)?Reflect.ownKeys(t).forEach((i=>{e(i,t[i],t)})):t.forEach(((i,n)=>e(n,i,t)))}function zr(t){const e=t[Ar];return e?e.type_:Array.isArray(t)?1:jr(t)?2:Br(t)?3:0}function Rr(t,e){return 2===zr(t)?t.has(e):Object.prototype.hasOwnProperty.call(t,e)}function Nr(t,e,i){const n=zr(t);2===n?t.set(e,i):3===n?t.add(i):t[e]=i}function jr(t){return t instanceof Map}function Br(t){return t instanceof Set}function Fr(t){return t.copy_||t.base_}function qr(t,e){if(jr(t))return new Map(t);if(Br(t))return new Set(t);if(Array.isArray(t))return Array.prototype.slice.call(t);const i=Lr(t);if(!0===e||"class_only"===e&&!i){const e=Object.getOwnPropertyDescriptors(t);delete e[Ar];let i=Reflect.ownKeys(e);for(let n=0;n<i.length;n++){const o=i[n],s=e[o];!1===s.writable&&(s.writable=!0,s.configurable=!0),(s.get||s.set)&&(e[o]={configurable:!0,writable:!0,enumerable:s.enumerable,value:t[o]})}return Object.create(Pr(t),e)}{const e=Pr(t);if(null!==e&&i)return{...t};const n=Object.create(e);return Object.assign(n,t)}}function Vr(t,e=!1){return Ur(t)||Or(t)||!Dr(t)||(zr(t)>1&&(t.set=t.add=t.clear=t.delete=Hr),Object.freeze(t),e&&Object.entries(t).forEach((([t,e])=>Vr(e,!0)))),t}function Hr(){Tr(2)}function Ur(t){return Object.isFrozen(t)}var Wr,Gr={};function Zr(t){const e=Gr[t];return e||Tr(0,t),e}function Yr(){return Wr}function Xr(t,e){e&&(Zr("Patches"),t.patches_=[],t.inversePatches_=[],t.patchListener_=e)}function Kr(t){Qr(t),t.drafts_.forEach(ta),t.drafts_=null}function Qr(t){t===Wr&&(Wr=t.parent_)}function Jr(t){return Wr={drafts_:[],parent_:Wr,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function ta(t){const e=t[Ar];0===e.type_||1===e.type_?e.revoke_():e.revoked_=!0}function ea(t,e){e.unfinalizedDrafts_=e.drafts_.length;const i=e.drafts_[0];return void 0!==t&&t!==i?(i[Ar].modified_&&(Kr(e),Tr(4)),Dr(t)&&(t=ia(e,t),e.parent_||oa(e,t)),e.patches_&&Zr("Patches").generateReplacementPatches_(i[Ar].base_,t,e.patches_,e.inversePatches_)):t=ia(e,i,[]),Kr(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),t!==Cr?t:void 0}function ia(t,e,i){if(Ur(e))return e;const n=e[Ar];if(!n)return $r(e,((o,s)=>na(t,n,e,o,s,i))),e;if(n.scope_!==t)return e;if(!n.modified_)return oa(t,n.base_,!0),n.base_;if(!n.finalized_){n.finalized_=!0,n.scope_.unfinalizedDrafts_--;const e=n.copy_;let o=e,s=!1;3===n.type_&&(o=new Set(e),e.clear(),s=!0),$r(o,((o,r)=>na(t,n,e,o,r,i,s))),oa(t,e,!1),i&&t.patches_&&Zr("Patches").generatePatches_(n,i,t.patches_,t.inversePatches_)}return n.copy_}function na(t,e,i,n,o,s,r){if(o===i&&Tr(5),Or(o)){const r=ia(t,o,s&&e&&3!==e.type_&&!Rr(e.assigned_,n)?s.concat(n):void 0);if(Nr(i,n,r),!Or(r))return;t.canAutoFreeze_=!1}else r&&i.add(o);if(Dr(o)&&!Ur(o)){if(!t.immer_.autoFreeze_&&t.unfinalizedDrafts_<1)return;ia(t,o),e&&e.scope_.parent_||"symbol"==typeof n||!Object.prototype.propertyIsEnumerable.call(i,n)||oa(t,o)}}function oa(t,e,i=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&Vr(e,i)}var sa={get(t,e){if(e===Ar)return t;const i=Fr(t);if(!Rr(i,e))return function(t,e,i){const n=la(e,i);return n?"value"in n?n.value:n.get?.call(t.draft_):void 0}(t,i,e);const n=i[e];return t.finalized_||!Dr(n)?n:n===aa(t.base_,e)?(ha(t),t.copy_[e]=da(n,t)):n},has:(t,e)=>e in Fr(t),ownKeys:t=>Reflect.ownKeys(Fr(t)),set(t,e,i){const n=la(Fr(t),e);if(n?.set)return n.set.call(t.draft_,i),!0;if(!t.modified_){const n=aa(Fr(t),e),o=n?.[Ar];if(o&&o.base_===i)return t.copy_[e]=i,t.assigned_[e]=!1,!0;if(function(t,e){return t===e?0!==t||1/t==1/e:t!=t&&e!=e}(i,n)&&(void 0!==i||Rr(t.base_,e)))return!0;ha(t),ca(t)}return t.copy_[e]===i&&(void 0!==i||e in t.copy_)||Number.isNaN(i)&&Number.isNaN(t.copy_[e])||(t.copy_[e]=i,t.assigned_[e]=!0),!0},deleteProperty:(t,e)=>(void 0!==aa(t.base_,e)||e in t.base_?(t.assigned_[e]=!1,ha(t),ca(t)):delete t.assigned_[e],t.copy_&&delete t.copy_[e],!0),getOwnPropertyDescriptor(t,e){const i=Fr(t),n=Reflect.getOwnPropertyDescriptor(i,e);return n?{writable:!0,configurable:1!==t.type_||"length"!==e,enumerable:n.enumerable,value:i[e]}:n},defineProperty(){Tr(11)},getPrototypeOf:t=>Pr(t.base_),setPrototypeOf(){Tr(12)}},ra={};function aa(t,e){const i=t[Ar];return(i?Fr(i):t)[e]}function la(t,e){if(!(e in t))return;let i=Pr(t);for(;i;){const t=Object.getOwnPropertyDescriptor(i,e);if(t)return t;i=Pr(i)}}function ca(t){t.modified_||(t.modified_=!0,t.parent_&&ca(t.parent_))}function ha(t){t.copy_||(t.copy_=qr(t.base_,t.scope_.immer_.useStrictShallowCopy_))}$r(sa,((t,e)=>{ra[t]=function(){return arguments[0]=arguments[0][0],e.apply(this,arguments)}})),ra.deleteProperty=function(t,e){return isNaN(parseInt(e))&&Tr(13),ra.set.call(this,t,e,void 0)},ra.set=function(t,e,i){return"length"!==e&&isNaN(parseInt(e))&&Tr(14),sa.set.call(this,t[0],e,i,t[0])};function da(t,e){const i=jr(t)?Zr("MapSet").proxyMap_(t,e):Br(t)?Zr("MapSet").proxySet_(t,e):function(t,e){const i=Array.isArray(t),n={type_:i?1:0,scope_:e?e.scope_:Yr(),modified_:!1,finalized_:!1,assigned_:{},parent_:e,base_:t,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=n,s=sa;i&&(o=[n],s=ra);const{revoke:r,proxy:a}=Proxy.revocable(o,s);return n.draft_=a,n.revoke_=r,a}(t,e);return(e?e.scope_:Yr()).drafts_.push(i),i}function ua(t){if(!Dr(t)||Ur(t))return t;const e=t[Ar];let i;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,i=qr(t,e.scope_.immer_.useStrictShallowCopy_)}else i=qr(t,!0);return $r(i,((t,e)=>{Nr(i,t,ua(e))})),e&&(e.finalized_=!1),i}var pa=new class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,e,i)=>{if("function"==typeof t&&"function"!=typeof e){const i=e;e=t;const n=this;return function(t=i,...o){return n.produce(t,(t=>e.call(this,t,...o)))}}let n;if("function"!=typeof e&&Tr(6),void 0!==i&&"function"!=typeof i&&Tr(7),Dr(t)){const o=Jr(this),s=da(t,void 0);let r=!0;try{n=e(s),r=!1}finally{r?Kr(o):Qr(o)}return Xr(o,i),ea(n,o)}if(!t||"object"!=typeof t){if(n=e(t),void 0===n&&(n=t),n===Cr&&(n=void 0),this.autoFreeze_&&Vr(n,!0),i){const e=[],o=[];Zr("Patches").generateReplacementPatches_(t,n,e,o),i(e,o)}return n}Tr(1,t)},this.produceWithPatches=(t,e)=>{if("function"==typeof t)return(e,...i)=>this.produceWithPatches(e,(e=>t(e,...i)));let i,n;const o=this.produce(t,e,((t,e)=>{i=t,n=e}));return[o,i,n]},"boolean"==typeof t?.autoFreeze&&this.setAutoFreeze(t.autoFreeze),"boolean"==typeof t?.useStrictShallowCopy&&this.setUseStrictShallowCopy(t.useStrictShallowCopy)}createDraft(t){Dr(t)||Tr(8),Or(t)&&(t=function(t){Or(t)||Tr(10,t);return ua(t)}(t));const e=Jr(this),i=da(t,void 0);return i[Ar].isManual_=!0,Qr(e),i}finishDraft(t,e){const i=t&&t[Ar];i&&i.isManual_||Tr(9);const{scope_:n}=i;return Xr(n,e),ea(void 0,n)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}applyPatches(t,e){let i;for(i=e.length-1;i>=0;i--){const n=e[i];if(0===n.path.length&&"replace"===n.op){t=n.value;break}}i>-1&&(e=e.slice(i+1));const n=Zr("Patches").applyPatches_;return Or(t)?n(t,e):this.produce(t,(t=>n(t,e)))}},ma=pa.produce;pa.produceWithPatches.bind(pa),pa.setAutoFreeze.bind(pa),pa.setUseStrictShallowCopy.bind(pa),pa.applyPatches.bind(pa),pa.createDraft.bind(pa),pa.finishDraft.bind(pa);const fa=t=>(e,i,n)=>(n.setState=(t,i,...n)=>{const o="function"==typeof t?ma(t):t;return e(o,i,...n)},t(n.setState,i,n)),ga=t=>(e,i,n)=>{const o=n.subscribe;n.subscribe=(t,e,i)=>{let s=t;if(e){const o=(null==i?void 0:i.equalityFn)||Object.is;let r=t(n.getState());s=i=>{const n=t(i);if(!o(r,n)){const t=r;e(r=n,t)}},(null==i?void 0:i.fireImmediately)&&e(r,r)}return o(s)};return t(e,i,n)},va=Sr(ga(fa(((t,e)=>({languageNames:{},canvasSize:{width:0,height:0},languageCode:"",workspace:null,flowDefinition:null,flowInfo:null,isTranslating:!1,fetchRevision:async(e,i=null)=>{i||(i="latest");const n=await fetch(`${e}/${i}/?version=14.3`);if(!n.ok)throw new Error("Network response was not ok");const o=await n.json();t({flowInfo:o.info,flowDefinition:o.definition})},fetchWorkspace:async e=>{const i=await fetch(e);if(!i.ok)throw new Error("Network response was not ok");const n=await i.json();t({workspace:n})},fetchAllLanguages:async e=>{const i=(await Zt(e)).reduce((function(t,e){return t[e.value]=e.name,t}),{});t({languageNames:i})},getFlowResults:()=>e().flowInfo.results,getResultByKey:t=>e().flowInfo.results.find((e=>e.key===t)),getLanguage:()=>{const t=e(),i=t.languageCode;return{name:t.languageNames[i],code:i}},setFlowContents:e=>{t((t=>{const i=e.definition.language;t.flowDefinition=e.definition,t.flowInfo=e.info,t.languageCode=i,t.isTranslating=!1}))},setFlowInfo:e=>{t((t=>{t.flowInfo=e}))},setLanguageCode:e=>{t((t=>{t.languageCode=e,t.isTranslating=t.flowDefinition.language!==e}))},setTestUpdate:()=>{t((t=>{t.flowDefinition.name="Bloop!"}))},expandCanvas:(e,i)=>{t((t=>{const n=Math.max(t.canvasSize.width,e+800),o=Math.max(t.canvasSize.height,i+800);t.canvasSize.width=n,t.canvasSize.height=o}))},updateCanvasPositions:e=>{t((t=>{for(const i in e)t.flowDefinition._ui.nodes[i]&&(t.flowDefinition._ui.nodes[i].position=e[i])}))},removeNodes:e=>{t((t=>{for(const i of e)delete t.flowDefinition._ui.nodes[i];t.flowDefinition.nodes=t.flowDefinition.nodes.filter((t=>!e.includes(t.uuid)))}))}})))));function ya(t,e){return(i,n)=>{de()(i,n);const o="connectedCallback",s="disconnectedCallback",r=i[o],a=i[s];i[o]=function(){var i;null!==(i=this._zustandUnsubscribe)&&void 0!==i||(this._zustandUnsubscribe={}),this[n]=e(t.getState()),this._zustandUnsubscribe[n]=t.subscribe(e,(t=>{this[n]=t})),r&&r.call(this)},i[s]=function(){var t,e;null===(e=null===(t=this._zustandUnsubscribe)||void 0===t?void 0:t[n])||void 0===e||e.call(t),a&&a.call(this)}}}const{setLocale:ba}=(t=>(function(t){if(br)throw new Error("lit-localize can only be configured once");yr=t,br=!0}(((t,e)=>rr(ur,t,e))),pr=cr=t.sourceLocale,hr=new Set(t.targetLocales),hr.add(t.sourceLocale),dr=t.loadLocale,{getLocale:gr,setLocale:vr}))({sourceLocale:"en",targetLocales:_r,loadLocale:t=>import(`./locales/${t}.js`)}),_a=()=>document.querySelector("temba-store");class xa extends fe{constructor(){super(...arguments),this.settings={},this.ttl=6e4,this.max=20,this.ready=!1,this.loader=!1,this.keyedAssets={},this.locale=[...navigator.languages],this.fields={},this.groups={},this.shortcuts=[],this.languages={},this.featuredFields=[],this.dirtyElements=[],this.pendingResolves={},this.fetching={}}static get styles(){return a`
395
395
  :host {
396
396
  position: fixed;
397
397
  z-index: 1000;
@@ -402,7 +402,7 @@ let yr=Ks,br=!1;const _r=["es","fr","pt"],xr="data:image/png;base64,iVBORw0KGgoA
402
402
  width: 100%;
403
403
  top: 0.5em;
404
404
  }
405
- `}markDirty(t){this.dirtyElements.includes(t)||this.dirtyElements.push(t)}cleanAll(){this.dirtyElements.forEach((t=>t.markClean())),this.dirtyElements=[]}markClean(t){this.dirtyElements=this.dirtyElements.filter((e=>e!==t))}getDirtyMessage(){if(this.dirtyElements.length>0)return this.dirtyElements[0].dirtyMessage||"You have unsaved changes, are you sure you want to continue?"}getLocale(){return this.locale[0]}clearCache(){this.cache=Le(this.max,this.ttl)}reset(){const t=this.getState();this.ready=!1,this.clearCache(),this.settings=JSON.parse(oe("settings")||"{}");const e=[];this.completionEndpoint&&e.push(Ut(this.completionEndpoint).then((t=>{this.schema=t.json.context,this.fnOptions=t.json.functions}))),this.fieldsEndpoint&&e.push(this.refreshFields()),this.globalsEndpoint&&e.push(Xt(this.globalsEndpoint).then((t=>{this.keyedAssets.globals=t.map((t=>t.key))}))),this.languagesEndpoint&&(t.fetchAllLanguages(this.languagesEndpoint),e.push(Xt(this.languagesEndpoint).then((t=>{this.languages=t.reduce((function(t,e){return t[e.value]=e.name,t}),{})})))),this.groupsEndpoint&&e.push(Xt(this.groupsEndpoint).then((t=>{t.forEach((t=>{this.groups[t.uuid]=t}))}))),this.workspaceEndpoint&&(t.fetchWorkspace(this.workspaceEndpoint),e.push(Ut(this.workspaceEndpoint).then((t=>{this.workspace=t.json;const e=t.headers.get("content-language");e&&(this.locale=[e,...this.locale])})))),this.shortcutsEndpoint&&e.push(this.refreshShortcuts()),this.initialHttpComplete=Promise.all(e),this.initialHttpComplete.then((()=>{this.ready=!0}))}getShortcuts(){return this.shortcuts||[]}firstUpdated(){this.reset()}getLanguageCode(){return this.locale.length>0?this.locale[0].split("-")[0]:"en"}async refreshGlobals(){return Xt(this.globalsEndpoint).then((t=>{this.keyedAssets.globals=t.map((t=>t.key))}))}async refreshShortcuts(){return Xt(this.shortcutsEndpoint).then((t=>{this.shortcuts=t}))}async refreshFields(){return Xt(this.fieldsEndpoint).then((t=>{this.keyedAssets.fields=[],this.featuredFields=[],t.forEach((t=>{this.keyedAssets.fields.push(t.key),this.fields[t.key]=t,t.featured&&this.featuredFields.push(t)})),this.featuredFields.sort(((t,e)=>e.priority-t.priority)),this.keyedAssets.fields.sort(),this.fireCustomEvent(Oe.StoreUpdated,{url:this.fieldsEndpoint,data:this.keyedAssets.fields})}))}shiftAndRound(t,e,i){const n=Math.round(t.shiftTo(e).get(e));return 1==n?`1 ${i}`:`${n} ${e}`}getCountdown(t){const e=t.diff(Zs.now()).rescale();return e.months>0?"> 1 month":e.days>1?`~ ${this.shiftAndRound(e,"days","day")}`:e.hours>0?`~ ${this.shiftAndRound(e,"hours","hour")}`:`~ ${this.shiftAndRound(e,"minutes","minute")}`}getShortDuration(t,e=null){const i=e||Zs.now();return t.setLocale(this.locale[0]).toRelative({base:i,style:"long"})}getShortDurationFromIso(t,e=null){const i=Zs.fromISO(t),n=e?Zs.fromISO(e):Zs.now();return this.getShortDuration(i,n)}setKeyedAssets(t,e){this.keyedAssets[t]=e}updated(t){if(super.updated(t),t.has("ready")&&this.ready){const t=this.getLanguageCode(),e=_r.find((e=>e===t));e&&ba(e)}}getCompletionSchema(){return this.schema}getFunctions(){return this.fnOptions}getKeyedAssets(){return this.keyedAssets}getFieldKeys(){return this.keyedAssets.fields||[]}getContactField(t){return this.fields[t]}getFeaturedFields(){return this.featuredFields}getLanguageName(t){return this.languages[t]}isDynamicGroup(t){const e=this.groups[t];return!(e&&!e.query)}getWorkspace(){return this.workspace}formatDate(t){return Zs.fromISO(t).setLocale(this.getLocale()).toLocaleString(Zs.DATETIME_SHORT)}postJSON(t,e=""){return Qt(t,e)}postForm(t,e,i={}){return((t,e,i={})=>{const n=new FormData;return Object.keys(e).forEach((t=>{n.append(t,e[t])})),Jt(t,n,i)})(t,e,i)}postUrl(t,e="",i={},n=null){return Kt(t,e,i,n)}getUrl(t,e){return!(e=e||{}).force&&this.cache.has(t)?new Promise((e=>{e(this.cache.get(t))})):Ut(t,e.controller,e.headers||{}).then((i=>new Promise(((n,o)=>{i.status>=200&&i.status<=300?(e.skipCache||this.cache.set(t,i),n(i)):o("Status: "+i.status)}))))}getResults(t,e){e=e||{};const i="results_"+t,n=this.cache.get(i);return!e.force&&n?new Promise((t=>{t(n)})):new Promise((e=>{const n=this.pendingResolves[t]||[];n.push(e),this.pendingResolves[t]=n,n.length<=1&&Zt(t).then((e=>{this.cache.set(i,e);const n=this.pendingResolves[t]||[];for(;n.length>0;){n.pop()(e)}}))}))}updateCache(t,e){this.cache.set(t,e),this.fireCustomEvent(Oe.StoreUpdated,{url:t,data:e})}removeFromCache(t){this.cache.delete(t)}resolveUsers(t,e){return new Promise((i=>{const n=new Set;t.forEach((t=>{e.forEach((e=>{const i=e.split(".");let o=t;for(let t=0;t<i.length&&(o=o[i[t]],o);t++);o&&o.email&&n.add(o.email)}))}));const o=[];n.forEach((t=>{o.push(this.getUrl(`/api/v2/users.json?email=${encodeURIComponent(t)}`,{force:!0}))})),Promise.all(o).then((n=>{n.forEach((i=>{if(i&&i.json){const n=i.json.results;if(n&&1===n.length){const i=n[0];t.forEach((t=>{e.forEach((e=>{const n=e.split(".");let o=t,s=o;for(let t=0;t<n.length&&(s=o,o=o[n[t]],o);t++);if(o&&o.email===i.email){const t=s[n[n.length-1]];t.avatar=i.avatar,t.name=wr(i),s[n[n.length-1]].avatar=i.avatar}}))}))}}})),i()}))}))}makeRequest(t,e){const i=this.fetching[t],n=(new Date).getTime();if(i)return void setTimeout((()=>{this.makeRequest(t,e)}),500);let o=this.cache.get(t);o&&!e.force?(o=e.prepareData?e.prepareData(o):o,this.fireCustomEvent(Oe.StoreUpdated,{url:t,data:o})):(e=e||{},this.fetching[t]=n,Zt(t).then((i=>{i?(this.cache.set(t,i),delete this.fetching[t],i=e.prepareData?e.prepareData(i):i,this.fireCustomEvent(Oe.StoreUpdated,{url:t,data:i})):delete this.fetching[t]})))}get(t,e=null){return this.settings[t]||e}set(t,e){this.settings[t]=e}render(){if(!this.ready&&this.loader)return U`<temba-loading size="10" units="8"></temba-loading>`}getCompletions(t){const e=this.getState().flowInfo;return"results"===t?e.results.map((t=>t.key)):"locals"===t?e.locals:this.keyedAssets[t]||[]}getApp(){return va}getState(){return va.getState()}}t([de({type:Number})],xa.prototype,"ttl",void 0),t([de({type:Number})],xa.prototype,"max",void 0),t([de({type:Boolean})],xa.prototype,"ready",void 0),t([de({type:Boolean})],xa.prototype,"loader",void 0),t([de({type:String,attribute:"completion"})],xa.prototype,"completionEndpoint",void 0),t([de({type:String,attribute:"fields"})],xa.prototype,"fieldsEndpoint",void 0),t([de({type:String,attribute:"groups"})],xa.prototype,"groupsEndpoint",void 0),t([de({type:String,attribute:"globals"})],xa.prototype,"globalsEndpoint",void 0),t([de({type:String,attribute:"languages"})],xa.prototype,"languagesEndpoint",void 0),t([de({type:String,attribute:"workspace"})],xa.prototype,"workspaceEndpoint",void 0),t([de({type:String,attribute:"shortcuts"})],xa.prototype,"shortcutsEndpoint",void 0),t([de({type:Object,attribute:!1})],xa.prototype,"schema",void 0),t([de({type:Object,attribute:!1})],xa.prototype,"fnOptions",void 0),t([de({type:Object,attribute:!1})],xa.prototype,"keyedAssets",void 0);class wa extends fe{constructor(){super(...arguments),this.marginHorizontal=0,this.marginVertical=7,this.scrollPct=75,this.cursorIndex=-1,this.internalFocusDisabled=!1,this.nameKey="name",this.loading=!1,this.hideShadow=!1,this.getName=function(t){return t[this.nameKey||"name"]},this.renderInputOption=function(){return null},this.scrollHeight=0,this.triggerScroll=!1,this.scrollParent=null,this.setCursor=ie((function(t){this.internalFocusDisabled||t!==this.cursorIndex&&(this.cursorIndex=t)}),50)}static get styles(){return a`
405
+ `}markDirty(t){this.dirtyElements.includes(t)||this.dirtyElements.push(t)}cleanAll(){this.dirtyElements.forEach((t=>t.markClean())),this.dirtyElements=[]}markClean(t){this.dirtyElements=this.dirtyElements.filter((e=>e!==t))}getDirtyMessage(){if(this.dirtyElements.length>0)return this.dirtyElements[0].dirtyMessage||"You have unsaved changes, are you sure you want to continue?"}getLocale(){return this.locale[0]}clearCache(){this.cache=Le(this.max,this.ttl)}reset(){const t=this.getState();this.ready=!1,this.clearCache(),this.settings=JSON.parse(oe("settings")||"{}");const e=[];this.completionEndpoint&&e.push(Ut(this.completionEndpoint).then((t=>{this.schema=t.json.context,this.fnOptions=t.json.functions}))),this.fieldsEndpoint&&e.push(this.refreshFields()),this.globalsEndpoint&&e.push(Xt(this.globalsEndpoint).then((t=>{this.keyedAssets.globals=t.map((t=>t.key))}))),this.languagesEndpoint&&(t.fetchAllLanguages(this.languagesEndpoint),e.push(Xt(this.languagesEndpoint).then((t=>{this.languages=t.reduce((function(t,e){return t[e.value]=e.name,t}),{})})))),this.groupsEndpoint&&e.push(Xt(this.groupsEndpoint).then((t=>{t.forEach((t=>{this.groups[t.uuid]=t}))}))),this.workspaceEndpoint&&(t.fetchWorkspace(this.workspaceEndpoint),e.push(Ut(this.workspaceEndpoint).then((t=>{this.workspace=t.json;const e=t.headers.get("content-language");e&&(this.locale=[e,...this.locale])})))),this.shortcutsEndpoint&&e.push(this.refreshShortcuts()),this.initialHttpComplete=Promise.all(e),this.initialHttpComplete.then((()=>{this.ready=!0}))}getShortcuts(){return this.shortcuts||[]}firstUpdated(){this.reset()}getLanguageCode(){return this.locale.length>0?this.locale[0].split("-")[0]:"en"}async refreshGlobals(){return Xt(this.globalsEndpoint).then((t=>{this.keyedAssets.globals=t.map((t=>t.key))}))}async refreshShortcuts(){return Xt(this.shortcutsEndpoint).then((t=>{this.shortcuts=t}))}async refreshFields(){return Xt(this.fieldsEndpoint).then((t=>{this.keyedAssets.fields=[],this.featuredFields=[],t.forEach((t=>{this.keyedAssets.fields.push(t.key),this.fields[t.key]=t,t.featured&&this.featuredFields.push(t)})),this.featuredFields.sort(((t,e)=>e.priority-t.priority)),this.keyedAssets.fields.sort(),this.fireCustomEvent(Oe.StoreUpdated,{url:this.fieldsEndpoint,data:this.keyedAssets.fields})}))}shiftAndRound(t,e,i){const n=Math.round(t.shiftTo(e).get(e));return 1==n?`1 ${i}`:`${n} ${e}`}getCountdown(t){const e=t.diff(Zs.now()).rescale();return e.months>0?"> 1 month":e.days>1?`~ ${this.shiftAndRound(e,"days","day")}`:e.hours>0?`~ ${this.shiftAndRound(e,"hours","hour")}`:`~ ${this.shiftAndRound(e,"minutes","minute")}`}getShortDuration(t,e=null){const i=e||Zs.now();return t.setLocale(this.locale[0]).toRelative({base:i,style:"long"})}getShortDurationFromIso(t,e=null){const i=Zs.fromISO(t),n=e?Zs.fromISO(e):Zs.now();return this.getShortDuration(i,n)}setKeyedAssets(t,e){this.keyedAssets[t]=e}updated(t){if(super.updated(t),t.has("ready")&&this.ready){const t=this.getLanguageCode(),e=_r.find((e=>e===t));e&&ba(e)}}getCompletionSchema(){return this.schema}getFunctions(){return this.fnOptions}getKeyedAssets(){return this.keyedAssets}getFieldKeys(){return this.keyedAssets.fields||[]}getContactField(t){return this.fields[t]}getFeaturedFields(){return this.featuredFields}getLanguageName(t){return this.languages[t]}isDynamicGroup(t){const e=this.groups[t];return!(e&&!e.query)}getWorkspace(){return this.workspace}formatDate(t){return Zs.fromISO(t).setLocale(this.getLocale()).toLocaleString(Zs.DATETIME_SHORT)}postJSON(t,e=""){return Qt(t,e)}postForm(t,e,i={}){return((t,e,i={})=>{const n=new FormData;return Object.keys(e).forEach((t=>{n.append(t,e[t])})),Jt(t,n,i)})(t,e,i)}postUrl(t,e="",i={},n=null){return Kt(t,e,i,n)}getUrl(t,e){return!(e=e||{}).force&&this.cache.has(t)?new Promise((e=>{e(this.cache.get(t))})):Ut(t,e.controller,e.headers||{}).then((i=>new Promise(((n,o)=>{i.status>=200&&i.status<=300?(e.skipCache||this.cache.set(t,i),n(i)):o("Status: "+i.status)}))))}getResults(t,e){e=e||{};const i="results_"+t,n=this.cache.get(i);return!e.force&&n?new Promise((t=>{t(n)})):new Promise((e=>{const n=this.pendingResolves[t]||[];n.push(e),this.pendingResolves[t]=n,n.length<=1&&Zt(t).then((e=>{this.cache.set(i,e);const n=this.pendingResolves[t]||[];for(;n.length>0;){n.pop()(e)}}))}))}updateCache(t,e){this.cache.set(t,e),this.fireCustomEvent(Oe.StoreUpdated,{url:t,data:e})}removeFromCache(t){this.cache.delete(t)}resolveUsers(t,e){return new Promise((i=>{const n=new Set;t.forEach((t=>{e.forEach((e=>{const i=e.split(".");let o=t;for(let t=0;t<i.length&&(o=o[i[t]],o);t++);o&&o.email&&n.add(o.email)}))}));const o=[];n.forEach((t=>{o.push(this.getUrl(`/api/v2/users.json?email=${encodeURIComponent(t)}`,{force:!0}))})),Promise.all(o).then((n=>{n.forEach((i=>{if(i&&i.json){const n=i.json.results;if(n&&1===n.length){const i=n[0];t.forEach((t=>{e.forEach((e=>{const n=e.split(".");let o=t,s=o;for(let t=0;t<n.length&&(s=o,o=o[n[t]],o);t++);if(o&&o.email===i.email){const t=s[n[n.length-1]];t.avatar=i.avatar,t.name=wr(i),s[n[n.length-1]].avatar=i.avatar}}))}))}}})),i()}))}))}makeRequest(t,e){const i=this.fetching[t],n=(new Date).getTime();if(i)return void setTimeout((()=>{this.makeRequest(t,e)}),500);let o=this.cache.get(t);o&&!e.force?(o=e.prepareData?e.prepareData(o):o,this.fireCustomEvent(Oe.StoreUpdated,{url:t,data:o})):(e=e||{},this.fetching[t]=n,Zt(t).then((i=>{i?(this.cache.set(t,i),delete this.fetching[t],i=e.prepareData?e.prepareData(i):i,this.fireCustomEvent(Oe.StoreUpdated,{url:t,data:i})):delete this.fetching[t]})))}get(t,e=null){return this.settings[t]||e}set(t,e){this.settings[t]=e}render(){if(!this.ready&&this.loader)return U`<temba-loading size="10" units="8"></temba-loading>`}getCompletions(t){const e=this.getState().flowInfo;return"results"===t?e.results.map((t=>t.key)):"locals"===t?e.locals:this.keyedAssets[t]||[]}getApp(){return va}getState(){return va.getState()}}t([de({type:Number})],xa.prototype,"ttl",void 0),t([de({type:Number})],xa.prototype,"max",void 0),t([de({type:Boolean})],xa.prototype,"ready",void 0),t([de({type:Boolean})],xa.prototype,"loader",void 0),t([de({type:String,attribute:"completion"})],xa.prototype,"completionEndpoint",void 0),t([de({type:String,attribute:"fields"})],xa.prototype,"fieldsEndpoint",void 0),t([de({type:String,attribute:"groups"})],xa.prototype,"groupsEndpoint",void 0),t([de({type:String,attribute:"globals"})],xa.prototype,"globalsEndpoint",void 0),t([de({type:String,attribute:"languages"})],xa.prototype,"languagesEndpoint",void 0),t([de({type:String,attribute:"workspace"})],xa.prototype,"workspaceEndpoint",void 0),t([de({type:String,attribute:"shortcuts"})],xa.prototype,"shortcutsEndpoint",void 0),t([de({type:Object,attribute:!1})],xa.prototype,"schema",void 0),t([de({type:Object,attribute:!1})],xa.prototype,"fnOptions",void 0),t([de({type:Object,attribute:!1})],xa.prototype,"keyedAssets",void 0);class wa extends fe{constructor(){super(...arguments),this.marginHorizontal=0,this.marginVertical=7,this.scrollPct=75,this.cursorIndex=-1,this.internalFocusDisabled=!1,this.nameKey="name",this.loading=!1,this.hideShadow=!1,this.getName=function(t){return t[this.nameKey||"name"]},this.renderInputOption=function(){return null},this.scrollHeight=0,this.triggerScroll=!1,this.showEmptyMessage=!1,this.scrollParent=null,this.setCursor=ie((function(t){this.internalFocusDisabled||t!==this.cursorIndex&&(this.cursorIndex=t)}),50)}static get styles(){return a`
406
406
  :host {
407
407
  --transition-speed: 0;
408
408
  }
@@ -572,6 +572,15 @@ let yr=Ks,br=!1;const _r=["es","fr","pt"],xr="data:image/png;base64,iVBORw0KGgoA
572
572
  background: var(--color-selection);
573
573
  color: var(--color-text-dark);
574
574
  }
575
+
576
+ .option.no-options {
577
+ pointer-events: none;
578
+ }
579
+
580
+ .option.no-options:hover {
581
+ background: transparent;
582
+ color: var(--color-text-dark-secondary);
583
+ }
575
584
  `}firstUpdated(t){super.firstUpdated(t),this.block||(this.scrollParent=te(this),this.calculatePosition=this.calculatePosition.bind(this),this.scrollParent&&this.scrollParent.addEventListener("scroll",this.calculatePosition)),this.resolvedRenderOption=(this.renderOption||this.renderOptionDefault).bind(this)}disconnectedCallback(){this.block||this.scrollParent&&this.scrollParent.removeEventListener("scroll",this.calculatePosition),this.resizeObserver&&this.resizeObserver.disconnect()}isFocused(){return this.closestElement(document.activeElement.tagName)===document.activeElement}updated(t){if(super.updated(t),t.has("anchorTo")&&this.anchorTo){const t=this.shadowRoot.querySelector(".options-container");this.resizeObserver||(this.resizeObserver=new ResizeObserver((t=>{window.requestAnimationFrame((()=>{Array.isArray(t)&&t.length&&(this.calculatePosition(),this.adjustWidth())}))})),this.resizeObserver.observe(t))}if(!this.internalFocusDisabled&&t.has("cursorIndex")&&this.fireCustomEvent(Oe.CursorChanged,{index:this.cursorIndex}),t.has("visible")&&t.has("options")&&(this.visible||0!=this.options.length||(this.tempOptions=t.get("options"),window.setTimeout((()=>{this.tempOptions=[]}),200))),t.has("options")){this.adjustWidth(),this.calculatePosition(),this.triggerScroll=!0;const e=t.get("options"),i=e?e.length:0,n=this.options?this.options.length:0;(-1===this.cursorIndex||n<i||0===i&&n>0&&!t.has("cursorIndex"))&&(this.internalFocusDisabled||(this.block?this.cursorIndex>=n&&(this.cursorIndex=n-1):this.cursorIndex=0,this.cursorSelection&&this.handleSelection(!1)));const o=this.shadowRoot.querySelector(".options");o&&o.scrollHeight==o.clientHeight&&this.fireCustomEvent(Oe.ScrollThreshold)}}renderOptionDefault(t,e){const i=(this.renderOptionName||this.renderOptionNameDefault).bind(this),n=(this.renderOptionDetail||this.renderOptionDetailDefault).bind(this);return e?U`
576
585
  <div class="name">${i(t,e)}</div>
577
586
  <div class="detail">${n(t,e)}</div>
@@ -587,14 +596,19 @@ let yr=Ks,br=!1;const _r=["es","fr","pt"],xr="data:image/png;base64,iVBORw0KGgoA
587
596
  <div class=${n} style=${Ee(e)}>
588
597
  <div class="options-scroll" @scroll=${this.handleInnerScroll}>
589
598
  <div class="${o}" style=${Ee(i)}>
590
- ${s.map(((t,e)=>U`<div
591
- data-option-index="${e}"
592
- @mousemove=${this.handleMouseMove}
593
- @mousedown=${this.handleOptionClick}
594
- class="option ${e!==this.cursorIndex||this.internalFocusDisabled?"":"focused"}"
595
- >
596
- ${this.resolvedRenderOption(t,e===this.cursorIndex)}
597
- </div>`))}
599
+ ${s.length>0?s.map(((t,e)=>U`<div
600
+ data-option-index="${e}"
601
+ @mousemove=${this.handleMouseMove}
602
+ @mousedown=${this.handleOptionClick}
603
+ class="option ${e!==this.cursorIndex||this.internalFocusDisabled?"":"focused"}"
604
+ >
605
+ ${this.resolvedRenderOption(t,e===this.cursorIndex)}
606
+ </div>`)):this.visible&&this.showEmptyMessage?U`<div
607
+ class="option no-options"
608
+ style="color: var(--color-text-dark-secondary); cursor: default;"
609
+ >
610
+ ${yr("No options")}
611
+ </div>`:null}
598
612
  ${this.block?U`<div style="height:0.1em"></div>`:null}
599
613
  </div>
600
614
  <slot></slot>
@@ -604,7 +618,7 @@ let yr=Ks,br=!1;const _r=["es","fr","pt"],xr="data:image/png;base64,iVBORw0KGgoA
604
618
  <temba-loading></temba-loading>
605
619
  </div>
606
620
  </div>
607
- `}}t([de({type:Number})],wa.prototype,"top",void 0),t([de({type:Number})],wa.prototype,"left",void 0),t([de({type:Number})],wa.prototype,"width",void 0),t([de({type:Number,attribute:"static-width"})],wa.prototype,"staticWidth",void 0),t([de({type:Boolean,attribute:"anchor-right"})],wa.prototype,"anchorRight",void 0),t([de({type:Number})],wa.prototype,"marginHorizontal",void 0),t([de({type:Number})],wa.prototype,"marginVertical",void 0),t([de({type:Object})],wa.prototype,"anchorTo",void 0),t([de({type:Boolean})],wa.prototype,"visible",void 0),t([de({type:Boolean})],wa.prototype,"block",void 0),t([de({type:Boolean})],wa.prototype,"cursorHover",void 0),t([de({type:Boolean})],wa.prototype,"cursorSelection",void 0),t([de({type:Number})],wa.prototype,"scrollPct",void 0),t([de({type:Number})],wa.prototype,"cursorIndex",void 0),t([de({type:Boolean})],wa.prototype,"internalFocusDisabled",void 0),t([de({type:Array})],wa.prototype,"options",void 0),t([de({type:Array})],wa.prototype,"tempOptions",void 0),t([de({type:Boolean})],wa.prototype,"poppedTop",void 0),t([de({type:Boolean})],wa.prototype,"spaceSelect",void 0),t([de({type:String})],wa.prototype,"nameKey",void 0),t([de({type:Boolean})],wa.prototype,"loading",void 0),t([de({type:Boolean})],wa.prototype,"collapsed",void 0),t([de({type:Boolean})],wa.prototype,"hideShadow",void 0),t([de({attribute:!1})],wa.prototype,"getName",void 0),t([de({attribute:!1})],wa.prototype,"renderInputOption",void 0),t([de({attribute:!1})],wa.prototype,"renderOption",void 0),t([de({attribute:!1})],wa.prototype,"renderOptionName",void 0),t([de({attribute:!1})],wa.prototype,"renderOptionDetail",void 0),t([de({type:Number})],wa.prototype,"scrollHeight",void 0),t([de({type:Boolean})],wa.prototype,"triggerScroll",void 0);const ka=(t,e,i)=>{const n=t.substring(1);if("("===n[0])return!0;{const t=n.split(".")[0].toLowerCase();if(!i)return e.indexOf(t)>=0;for(const i of e)if(o=t,0===i.indexOf(o,0))return!0;return!1}var o},Sa=t=>t>="a"&&t<="z"||t>="A"&&t<="Z"||t>="0"&&t<="9"||"_"===t,Ca=t=>{let e=0;for(const i of t)'"'===i&&e++;return e%2!=0};class Ea{constructor(t,e){this.expressionPrefix=t,this.allowedTopLevels=e}expressionContext(t){const e=this.findExpressions(t);if(0===e.length)return null;const i=e[e.length-1];return i.end<t.length||i.closed?null:i.text.substring(1)}autoCompleteContext(t){if(Ca(t))return null;const e=[];let i="",n=!1,o=!1,s="";for(let r=t.length-1;r>=0;r--){const a=t[r];if(" "===a&&(n=!0),","===a&&(n=!0,"("!==e[e.length-1]&&e.push("(")),")"!==a||o||(n=!0,e.push("("),e.push("(")),'"'===a&&(o=!o),n&&("("!==a||o||("("===e[e.length-1]&&e.pop(),0===e.length&&(n=!1))),"("===a&&""===i&&(s="#"),!(n||o||"("===a&&""===i)){if(!Sa(a)&&"."!==a)break;i=a+i}}return i.match(/[A-Za-z][\w]*(\.[\w]+)*/)?s+i:null}functionContext(t){let e=Ca(t)?4:6,i="",n="("===t[-1]?0:1;for(let o=t.length-1;o>=0;o--){const s=t[o];if("@"===s)return"";if(6===e)0!==n||!Sa(s)&&"."!==s?'"'===s?e=4:"("===s?n--:")"===s&&n++:(e=2,i=s+i);else if(2===e){if(!Sa(s)&&"."!==s)return i;i=s+i}else 4===e&&'"'===s&&(e=6)}return""}getContactFields(t){const e={},i=/((parent|child\.)*contact\.)*fields\.([a-z0-9_]+)/g,n=this.findExpressions(t);for(const t of n){let n;for(;n=i.exec(t.text);)e[n[3]]=!0}return Object.keys(e)}findExpressions(t){const e=[];let i=0,n=null,o=0;for(let s=0;s<t.length;s++){const r=t[s],a=s<t.length-1?t[s+1]:0,l=s<t.length-2?t[s+2]:0;if(0===i?r!==this.expressionPrefix||!Sa(a)&&"("!==a?r===this.expressionPrefix&&a===this.expressionPrefix&&(i=5):(i=1,n={start:s,end:null,text:r,closed:!1}):1===i?(Sa(r)?i=2:"("===r&&(i=3,o+=1),n.text+=r):2===i?n.text+=r:3===i?("("===r?o+=1:")"===r?o-=1:'"'===r&&(i=4),n.text+=r,0===o&&(n.end=s+1)):4===i?('"'===r&&(i=3),n.text+=r):5===i&&(i=0),2===i&&(!Sa(a)&&"."!==a||"."===a&&!Sa(l))&&(n.end=s+1),null!=n&&(null!=n.end||0===a)){const t=0===a;ka(n.text,this.allowedTopLevels,t)&&(n.closed="("===n.text[1]&&0===o,n.end=s+1,e.push(n)),n=null,i=0}}return e}}
621
+ `}}t([de({type:Number})],wa.prototype,"top",void 0),t([de({type:Number})],wa.prototype,"left",void 0),t([de({type:Number})],wa.prototype,"width",void 0),t([de({type:Number,attribute:"static-width"})],wa.prototype,"staticWidth",void 0),t([de({type:Boolean,attribute:"anchor-right"})],wa.prototype,"anchorRight",void 0),t([de({type:Number})],wa.prototype,"marginHorizontal",void 0),t([de({type:Number})],wa.prototype,"marginVertical",void 0),t([de({type:Object})],wa.prototype,"anchorTo",void 0),t([de({type:Boolean})],wa.prototype,"visible",void 0),t([de({type:Boolean})],wa.prototype,"block",void 0),t([de({type:Boolean})],wa.prototype,"cursorHover",void 0),t([de({type:Boolean})],wa.prototype,"cursorSelection",void 0),t([de({type:Number})],wa.prototype,"scrollPct",void 0),t([de({type:Number})],wa.prototype,"cursorIndex",void 0),t([de({type:Boolean})],wa.prototype,"internalFocusDisabled",void 0),t([de({type:Array})],wa.prototype,"options",void 0),t([de({type:Array})],wa.prototype,"tempOptions",void 0),t([de({type:Boolean})],wa.prototype,"poppedTop",void 0),t([de({type:Boolean})],wa.prototype,"spaceSelect",void 0),t([de({type:String})],wa.prototype,"nameKey",void 0),t([de({type:Boolean})],wa.prototype,"loading",void 0),t([de({type:Boolean})],wa.prototype,"collapsed",void 0),t([de({type:Boolean})],wa.prototype,"hideShadow",void 0),t([de({attribute:!1})],wa.prototype,"getName",void 0),t([de({attribute:!1})],wa.prototype,"renderInputOption",void 0),t([de({attribute:!1})],wa.prototype,"renderOption",void 0),t([de({attribute:!1})],wa.prototype,"renderOptionName",void 0),t([de({attribute:!1})],wa.prototype,"renderOptionDetail",void 0),t([de({type:Number})],wa.prototype,"scrollHeight",void 0),t([de({type:Boolean})],wa.prototype,"triggerScroll",void 0),t([de({type:Boolean})],wa.prototype,"showEmptyMessage",void 0);const ka=(t,e,i)=>{const n=t.substring(1);if("("===n[0])return!0;{const t=n.split(".")[0].toLowerCase();if(!i)return e.indexOf(t)>=0;for(const i of e)if(o=t,0===i.indexOf(o,0))return!0;return!1}var o},Sa=t=>t>="a"&&t<="z"||t>="A"&&t<="Z"||t>="0"&&t<="9"||"_"===t,Ca=t=>{let e=0;for(const i of t)'"'===i&&e++;return e%2!=0};class Ea{constructor(t,e){this.expressionPrefix=t,this.allowedTopLevels=e}expressionContext(t){const e=this.findExpressions(t);if(0===e.length)return null;const i=e[e.length-1];return i.end<t.length||i.closed?null:i.text.substring(1)}autoCompleteContext(t){if(Ca(t))return null;const e=[];let i="",n=!1,o=!1,s="";for(let r=t.length-1;r>=0;r--){const a=t[r];if(" "===a&&(n=!0),","===a&&(n=!0,"("!==e[e.length-1]&&e.push("(")),")"!==a||o||(n=!0,e.push("("),e.push("(")),'"'===a&&(o=!o),n&&("("!==a||o||("("===e[e.length-1]&&e.pop(),0===e.length&&(n=!1))),"("===a&&""===i&&(s="#"),!(n||o||"("===a&&""===i)){if(!Sa(a)&&"."!==a)break;i=a+i}}return i.match(/[A-Za-z][\w]*(\.[\w]+)*/)?s+i:null}functionContext(t){let e=Ca(t)?4:6,i="",n="("===t[-1]?0:1;for(let o=t.length-1;o>=0;o--){const s=t[o];if("@"===s)return"";if(6===e)0!==n||!Sa(s)&&"."!==s?'"'===s?e=4:"("===s?n--:")"===s&&n++:(e=2,i=s+i);else if(2===e){if(!Sa(s)&&"."!==s)return i;i=s+i}else 4===e&&'"'===s&&(e=6)}return""}getContactFields(t){const e={},i=/((parent|child\.)*contact\.)*fields\.([a-z0-9_]+)/g,n=this.findExpressions(t);for(const t of n){let n;for(;n=i.exec(t.text);)e[n[3]]=!0}return Object.keys(e)}findExpressions(t){const e=[];let i=0,n=null,o=0;for(let s=0;s<t.length;s++){const r=t[s],a=s<t.length-1?t[s+1]:0,l=s<t.length-2?t[s+2]:0;if(0===i?r!==this.expressionPrefix||!Sa(a)&&"("!==a?r===this.expressionPrefix&&a===this.expressionPrefix&&(i=5):(i=1,n={start:s,end:null,text:r,closed:!1}):1===i?(Sa(r)?i=2:"("===r&&(i=3,o+=1),n.text+=r):2===i?n.text+=r:3===i?("("===r?o+=1:")"===r?o-=1:'"'===r&&(i=4),n.text+=r,0===o&&(n.end=s+1)):4===i?('"'===r&&(i=3),n.text+=r):5===i&&(i=0),2===i&&(!Sa(a)&&"."!==a||"."===a&&!Sa(l))&&(n.end=s+1),null!=n&&(null!=n.end||0===a)){const t=0===a;ka(n.text,this.allowedTopLevels,t)&&(n.closed="("===n.text[1]&&0===o,n.end=s+1,e.push(n)),n=null,i=0}}return e}}
608
622
  /**
609
623
  * @license
610
624
  * Copyright 2017 Google LLC
@@ -921,14 +935,14 @@ let yr=Ks,br=!1;const _r=["es","fr","pt"],xr="data:image/png;base64,iVBORw0KGgoA
921
935
  pointer-events: none;
922
936
  padding: 0px;
923
937
  }
924
- `}constructor(){super(),this.hiddenInputs=[],this.inputStyle={},this.multi=!1,this.searchOnFocus=!1,this.placeholder="",this.name="",this.allowCreate=!1,this.nameKey="name",this.valueKey="value",this.maxItems=0,this.maxItemsText="Maximum items reached",this.queryParam=null,this.input="",this.visibleOptions=[],this.completionOptions=[],this.quietMillis=0,this.searchable=!1,this.cache=!0,this.cacheKey="",this.focused=!1,this.disabled=!1,this.selectedIndex=-1,this.anchorPosition={left:0,top:0},this.tags=!1,this.flavor="default",this.infoText="",this.values=[],this.getName=t=>t[this.nameKey||"name"],this.isMatch=this.isMatchDefault,this.getValue=t=>t[this.valueKey||"value"]||t.id,this.sortFunction=null,this.renderOptionDetail=()=>U``,this.renderSelectedItem=this.renderSelectedItemDefault,this.createArbitraryOption=this.createArbitraryOptionDefault,this.getOptions=this.getOptionsDefault,this.prepareOptions=this.prepareOptionsDefault,this.isComplete=this.isCompleteDefault,this.staticOptions=[],this.allowAnchor=!0,this.alphaSort=(t,e)=>this.endpoint?this.getName(t).localeCompare(this.getName(e)):0,this.next=null,this.lruCache=Le(20,6e4),this.getNameInternal=t=>this.getName(t),this.renderOptionDefault=this.renderOptionDefault.bind(this),this.renderSelectedItemDefault=this.renderSelectedItemDefault.bind(this),this.prepareOptionsDefault=this.prepareOptionsDefault.bind(this),this.isMatchDefault=this.isMatchDefault.bind(this)}prepareOptionsDefault(t){return t}isMatchDefault(t,e){return(this.getName(t)||"").toLowerCase().indexOf(e)>-1}handleSlotChange(){if(this.staticOptions&&0===this.staticOptions.length)for(const t of this.children)if("TEMBA-OPTION"===t.tagName){const e={};for(const i of t.attributes)e[i.name]=i.value;if(e){let t=!1;void 0!==e.selected&&(delete e.selected,t=!0);const i=this.value||this.getAttribute("value");if(i){this.getValue(e)==i&&(t=!0)}this.staticOptions.push(e),t&&(this.multi?this.addValue(e):this.setValues([e]))}}this.searchable&&0===this.staticOptions.length&&(this.quietMillis=200)}checkSelectedOption(){if(this.value&&0==this.values.length&&0==this.staticOptions.length&&this.endpoint){const t=this.value;this.resolving=!0,Zt(this.endpoint).then((e=>{if(e&&e.length>0){if(t){const i=e.find((e=>this.getValue(e)===t));if(i)return this.resolving=!1,this.fetching=!1,void this.setValues([i])}this.setValues([e[0]]),this.resolving=!1}}))}else this.staticOptions.length>0&&(null!==this.getAttribute("multi")?this.addValue(this.staticOptions[0]):this.getAttribute("value")?this.setSelectedValue(this.getAttribute("value")):this.setValues([this.staticOptions[0]]))}firstUpdated(t){super.firstUpdated(t),this.anchorElement=this.shadowRoot.querySelector(".select-container"),this.anchorExpressions=this.shadowRoot.querySelector("#anchor"),this.shadowRoot.addEventListener("slotchange",this.handleSlotChange.bind(this))}async createOptionPost(t){return Qt(this.endpoint,t).then((e=>{if(e.status>=200&&e.status<300)return{json:e.json,payload:t}}))}updated(t){if(super.updated(t),t.has("sorted")&&(this.sortFunction=this.sorted?this.alphaSort:null),t.has("value")&&this.value&&!this.values.length&&this.setSelectedValue(this.value),t.has("values")&&(this.updateInputs(),this.hasChanges(t.get("values")))){const t=[];if(this.allowCreate){const e=this.values.filter((t=>t.arbitrary));for(const i of e)i.arbitrary&&t.push(this.createOptionPost(i));Promise.all(t).then((t=>{for(const i of t)if(i){const t=e.find((t=>t===i.payload));if(t&&(delete t.arbitrary,i.json))for(const e in i.json)t[e]=i.json[e]}this.values=this.values.filter((t=>!t.arbitrary)),this.cacheKey=(new Date).getTime().toString(),this.fireEvent("change")}))}else this.fireEvent("change")}t.has("cacheKey")&&this.lruCache.clear(),t.has("input")&&!t.has("values")&&!t.has("options")&&this.focused&&(this.lastQuery&&window.clearTimeout(this.lastQuery),this.lastQuery=window.setTimeout((()=>{this.expressions&&this.input.indexOf("@")>-1?this.fetchExpressions():this.fetchOptions(this.input)}),this.quietMillis)),this.endpoint&&t.has("fetching")&&(this.fetching||this.isPastFetchThreshold()||this.fireCustomEvent(Oe.FetchComplete)),(t.has("cursorIndex")||t.has("visibleOptions"))&&this.endpoint&&!this.fetching&&this.isPastFetchThreshold()&&(this.next?this.fetchOptions(null,null,this.next):this.fetchOptions(this.query,this.page+1)),0===this.values.length&&!this.placeholder&&this.staticOptions.length>0&&this.setValues([this.staticOptions[0]])}hasChanges(t){if(void 0===t)return!1;let e;void 0!==t&&(e=(t||[]).map((t=>this.getValue(t))).join(","));return e!==(this.values||[]).map((t=>t.arbitrary||this.getValue(t))).join(",")}setSelectedValue(t){if(this.staticOptions.length>0){const e=this.staticOptions.find((e=>this.getValue(e)===t));e&&this.setValues([e])}else this.checkSelectedOption()}updateInputs(){for(let t=null;t=this.hiddenInputs.pop();)t.remove();if(0===this.values.length)this.value=null;else{const t=this.getAttribute("name");t&&(this.multi||1!==this.values.length?this.inputRoot.parentElement&&this.values.forEach((e=>{const i=document.createElement("input");i.setAttribute("type","hidden"),i.setAttribute("name",t),i.setAttribute("value",this.serializeValue(e)),this.hiddenInputs.push(i),this.inputRoot.parentElement.appendChild(i)})):(this.selection=this.values[0],this.value=this.serializeValue(this.values[0])))}}setSelectedOption(t){this.multi?this.addValue(t):this.setValues([t]),this.multi&&this.searchable||(this.blur(),this.focused=!1),this.visibleOptions=[],this.input="",this.next=null,this.complete=!0,this.selectedIndex=-1}isPastFetchThreshold(){return(this.visibleOptions.length>0||this.next)&&!this.complete&&(this.cursorIndex||0)>this.visibleOptions.length-20}handleOptionSelection(t){if(this.multi&&this.maxItems>0&&this.values.length>=this.maxItems)return void(this.infoText=this.maxItemsText);this.infoText="";const e=t.detail.selected;e.post&&this.endpoint?Qt(this.endpoint,e).then((t=>{t.status>=200&&t.status<300?(this.setSelectedOption(t.json),this.lruCache=Le(20,6e4)):this.blur()})):this.setSelectedOption(e)}handleExpressionSelection(t){const e=t.detail.selected,i=t.detail.tabbed,n=this.shadowRoot.querySelector(".searchbox");lc(this.query,n,e),this.query="",this.completionOptions=[],i?this.fetchExpressions():-1===this.input.indexOf("(")&&this.addInputAsValue()}getOptionsDefault(t){return t.json.results}isCompleteDefault(t,e){const i=e.json;return!i.more&&!i.next}handleRemoveSelection(t){this.removeValue(t),this.visibleOptions=[]}createArbitraryOptionDefault(){return null}open(){this.shadowRoot.querySelector(".select-container").click()}isOpen(){return this.visibleOptions.length>0}setOptions(t){this.staticOptions=t}setVisibleOptions(t){if(t=t.filter((t=>!!this.getNameInternal(t)&&(!this.shouldExclude||!this.shouldExclude(t)))),this.input){if(this.searchable&&!this.queryParam){const e=this.input.trim().toLowerCase();t=t.filter((t=>this.isMatch(t,e)))}const e=this.createArbitraryOption(this.input,t);if(e){e.arbitrary=!0;t.find((t=>this.getValue(t)===this.getValue(e)))||(t.length>0&&t[0].arbitrary?t[0]=e:t.unshift(e))}}this.values.length>0&&(this.multi?t=t.filter((t=>!this.values.find((e=>this.getValue(e)===this.getValue(t))))):(this.input?this.cursorIndex=0:this.cursorIndex=t.findIndex((t=>this.getValue(t)===this.getValue(this.values[0]))),this.requestUpdate("cursorIndex"))),this.multi&&this.maxItems>0&&this.values.length>=this.maxItems&&(t=[],this.infoText=this.maxItemsText),this.sortFunction&&t.sort(this.sortFunction),this.visibleOptions=t,this.fireCustomEvent(Oe.ContentChanged,{options:this.visibleOptions})}fetchExpressions(){const t=document.querySelector("temba-store");if(this.expressions&&t){const t=this.shadowRoot.querySelector(".searchbox"),e=cc(t,"session"===this.expressions);return this.query=e.query,this.completionOptions=e.options,this.visibleOptions=[],this.anchorPosition=e.anchorPosition,void this.fireCustomEvent(Oe.FetchComplete)}}fetchOptions(t,e=0,i=null){if(this.completionOptions=[],!this.fetching){this.fetching=!0;const n=[...this.staticOptions],o=(t||"").trim().toLowerCase();if(this.tags&&o&&(n.find((t=>this.getValue(t)&&this.getValue(t).toLowerCase()===o))||n.splice(0,0,{name:t,value:t})),this.endpoint){let s=this.endpoint;i?s=i:(t&&this.queryParam&&(s.indexOf("?")>-1?s+="&":s+="?",s+=this.queryParam+"="+encodeURIComponent(t)),e&&(s.indexOf("?")>-1?s+="&":s+="?",s+="page="+e));const r=this.lruCache.get(s);if(this.cache&&!this.tags&&r)return 0!==e||this.next?this.setVisibleOptions([...this.visibleOptions,...r.options]):(this.cursorIndex=0,this.setVisibleOptions([...n,...r.options])),this.complete=r.complete,this.next=r.next,void(this.fetching=!1);this.searchable&&!this.queryParam?Zt(s).then((t=>{t=this.prepareOptions(t),this.cache&&!this.tags&&(this.lruCache.set(s,{options:t,complete:!0,next:null}),this.complete=!0,this.next=null,this.setVisibleOptions([...n,...t]),this.fetching=!1)})):Ut(s).then((i=>{let r=this.getOptions(i).filter((t=>this.isMatch(t,o)));r=this.prepareOptions(r),this.next=null;const a=i.json;a.next&&(this.next=a.next),0!==e||this.next?(r.length>0&&this.setVisibleOptions([...this.visibleOptions,...r]),this.complete=this.isComplete(r,i)):(this.cursorIndex=0,this.setVisibleOptions([...n,...r]),this.query=t,this.complete=this.isComplete(this.visibleOptions,i)),this.cache&&!this.tags&&this.lruCache.set(s,{options:r,complete:this.complete,next:this.next}),this.fetching=!1,this.page=e})).catch((t=>{this.fetching=!1,console.error(t)}))}else this.fetching=!1,this.setVisibleOptions(n)}}handleFocus(){this.focused||0!==this.visibleOptions.length||(this.focused=!0)}handleBlur(){this.focused=!1,this.visibleOptions.length>0&&(this.input="",this.next=null,this.complete=!0,this.visibleOptions=[],this.cursorIndex=0),this.multi&&this.maxItems>0&&this.values.length>=this.maxItems&&(this.infoText="")}handleClick(){this.selectedIndex=-1,this.requestUpdate("input")}addInputAsValue(){const t=this.shadowRoot.querySelector(".searchbox"),e={name:t.value,value:t.value,expression:!0};this.multi?this.values.find((t=>t.expression&&t.value&&e.value&&t.value.toLowerCase().trim()==e.value.toLowerCase().trim()))||this.addValue(e):this.setValues([e]),this.input="",this.multi||this.blur()}handleKeyDown(t){if("Enter"===t.key&&this.expressions&&0===this.completionOptions.length&&this.input.indexOf("@")>-1&&this.addInputAsValue(),("Enter"===t.key||"ArrowDown"===t.key||"n"===t.key&&t.ctrlKey)&&0===this.visibleOptions.length&&0===this.completionOptions.length)this.requestUpdate("input");else if(this.multi&&"Backspace"===t.key&&!this.input){if(this.visibleOptions.length>0)return void(this.visibleOptions=[]);-1===this.selectedIndex?(this.selectedIndex=this.values.length-1,this.visibleOptions=[]):(this.popValue(),this.selectedIndex=-1)}else this.selectedIndex=-1}getStaticOptions(){return this.staticOptions}handleInput(t){const e=t.currentTarget;this.input=e.value}handleCancel(){this.visibleOptions=[]}handleCursorChanged(t){this.cursorIndex=t.detail.index}handleContainerClick(t){if(t.stopPropagation(),t.preventDefault(),this.focused=!0,"INPUT"!==t.target.tagName){const t=this.shadowRoot.querySelector("input");if(t)return t.click(),void t.focus();this.visibleOptions.length>0?this.visibleOptions=[]:this.requestUpdate("input")}}getEventHandlers(){return[{event:Oe.Canceled,method:this.handleCancel},{event:Oe.CursorChanged,method:this.handleCursorChanged},{event:"blur",method:this.handleBlur},{event:"focus",method:this.handleFocus}]}handleArrowClick(t){this.isOpen()&&(t.preventDefault(),t.stopPropagation(),this.blur())}renderOptionDefault(t){if(!t)return null;const e=t.icon;return U`
938
+ `}constructor(){super(),this.hiddenInputs=[],this.inputStyle={},this.multi=!1,this.searchOnFocus=!1,this.placeholder="",this.name="",this.allowCreate=!1,this.nameKey="name",this.valueKey="value",this.maxItems=0,this.maxItemsText="Maximum items reached",this.queryParam=null,this.input="",this.visibleOptions=[],this.completionOptions=[],this.quietMillis=0,this.searchable=!1,this.cache=!0,this.cacheKey="",this.focused=!1,this.disabled=!1,this.attemptedOpen=!1,this.selectedIndex=-1,this.anchorPosition={left:0,top:0},this.tags=!1,this.flavor="default",this.infoText="",this.values=[],this.getName=t=>t[this.nameKey||"name"],this.isMatch=this.isMatchDefault,this.getValue=t=>t[this.valueKey||"value"]||t.id,this.sortFunction=null,this.renderOptionDetail=()=>U``,this.renderSelectedItem=this.renderSelectedItemDefault,this.createArbitraryOption=this.createArbitraryOptionDefault,this.getOptions=this.getOptionsDefault,this.prepareOptions=this.prepareOptionsDefault,this.isComplete=this.isCompleteDefault,this.staticOptions=[],this.allowAnchor=!0,this.alphaSort=(t,e)=>this.endpoint?this.getName(t).localeCompare(this.getName(e)):0,this.next=null,this.lruCache=Le(20,6e4),this.getNameInternal=t=>this.getName(t),this.renderOptionDefault=this.renderOptionDefault.bind(this),this.renderSelectedItemDefault=this.renderSelectedItemDefault.bind(this),this.prepareOptionsDefault=this.prepareOptionsDefault.bind(this),this.isMatchDefault=this.isMatchDefault.bind(this)}prepareOptionsDefault(t){return t}isMatchDefault(t,e){return(this.getName(t)||"").toLowerCase().indexOf(e)>-1}handleSlotChange(){if(this.staticOptions&&0===this.staticOptions.length)for(const t of this.children)if("TEMBA-OPTION"===t.tagName){const e={};for(const i of t.attributes)e[i.name]=i.value;if(e){let t=!1;void 0!==e.selected&&(delete e.selected,t=!0);const i=this.value||this.getAttribute("value");if(i){this.getValue(e)==i&&(t=!0)}this.staticOptions.push(e),t&&(this.multi?this.addValue(e):this.setValues([e]))}}this.searchable&&0===this.staticOptions.length&&(this.quietMillis=200)}checkSelectedOption(){if(this.value&&0==this.values.length&&0==this.staticOptions.length&&this.endpoint){const t=this.value;this.resolving=!0,Zt(this.endpoint).then((e=>{if(e&&e.length>0){if(t){const i=e.find((e=>this.getValue(e)===t));if(i)return this.resolving=!1,this.fetching=!1,void this.setValues([i])}this.setValues([e[0]]),this.resolving=!1}}))}else this.staticOptions.length>0&&(null!==this.getAttribute("multi")?this.addValue(this.staticOptions[0]):this.getAttribute("value")?this.setSelectedValue(this.getAttribute("value")):this.setValues([this.staticOptions[0]]))}firstUpdated(t){super.firstUpdated(t),this.anchorElement=this.shadowRoot.querySelector(".select-container"),this.anchorExpressions=this.shadowRoot.querySelector("#anchor"),this.shadowRoot.addEventListener("slotchange",this.handleSlotChange.bind(this))}async createOptionPost(t){return Qt(this.endpoint,t).then((e=>{if(e.status>=200&&e.status<300)return{json:e.json,payload:t}}))}updated(t){if(super.updated(t),t.has("sorted")&&(this.sortFunction=this.sorted?this.alphaSort:null),t.has("value")&&this.value&&!this.values.length&&this.setSelectedValue(this.value),t.has("values")&&(this.updateInputs(),this.hasChanges(t.get("values")))){const t=[];if(this.allowCreate){const e=this.values.filter((t=>t.arbitrary));for(const i of e)i.arbitrary&&t.push(this.createOptionPost(i));Promise.all(t).then((t=>{for(const i of t)if(i){const t=e.find((t=>t===i.payload));if(t&&(delete t.arbitrary,i.json))for(const e in i.json)t[e]=i.json[e]}this.values=this.values.filter((t=>!t.arbitrary)),this.cacheKey=(new Date).getTime().toString(),this.fireEvent("change")}))}else this.fireEvent("change")}t.has("cacheKey")&&this.lruCache.clear(),t.has("input")&&!t.has("values")&&!t.has("options")&&this.focused&&(this.lastQuery&&window.clearTimeout(this.lastQuery),this.lastQuery=window.setTimeout((()=>{this.expressions&&this.input.indexOf("@")>-1?this.fetchExpressions():this.fetchOptions(this.input)}),this.quietMillis)),this.endpoint&&t.has("fetching")&&(this.fetching||this.isPastFetchThreshold()||this.fireCustomEvent(Oe.FetchComplete)),(t.has("cursorIndex")||t.has("visibleOptions"))&&this.endpoint&&!this.fetching&&this.isPastFetchThreshold()&&(this.next?this.fetchOptions(null,null,this.next):this.fetchOptions(this.query,this.page+1)),0===this.values.length&&!this.placeholder&&this.staticOptions.length>0&&this.setValues([this.staticOptions[0]])}hasChanges(t){if(void 0===t)return!1;let e;void 0!==t&&(e=(t||[]).map((t=>this.getValue(t))).join(","));return e!==(this.values||[]).map((t=>t.arbitrary||this.getValue(t))).join(",")}setSelectedValue(t){if(this.staticOptions.length>0){const e=this.staticOptions.find((e=>this.getValue(e)===t));e&&this.setValues([e])}else this.checkSelectedOption()}updateInputs(){for(let t=null;t=this.hiddenInputs.pop();)t.remove();if(0===this.values.length)this.value=null;else{const t=this.getAttribute("name");t&&(this.multi||1!==this.values.length?this.inputRoot.parentElement&&this.values.forEach((e=>{const i=document.createElement("input");i.setAttribute("type","hidden"),i.setAttribute("name",t),i.setAttribute("value",this.serializeValue(e)),this.hiddenInputs.push(i),this.inputRoot.parentElement.appendChild(i)})):(this.selection=this.values[0],this.value=this.serializeValue(this.values[0])))}}setSelectedOption(t){this.multi?this.addValue(t):this.setValues([t]),this.multi&&this.searchable||(this.blur(),this.focused=!1),this.visibleOptions=[],this.attemptedOpen=!1,this.input="",this.next=null,this.complete=!0,this.selectedIndex=-1}isPastFetchThreshold(){return(this.visibleOptions.length>0||this.next)&&!this.complete&&(this.cursorIndex||0)>this.visibleOptions.length-20}handleOptionSelection(t){if(this.multi&&this.maxItems>0&&this.values.length>=this.maxItems)return void(this.infoText=this.maxItemsText);this.infoText="";const e=t.detail.selected;e.post&&this.endpoint?Qt(this.endpoint,e).then((t=>{t.status>=200&&t.status<300?(this.setSelectedOption(t.json),this.lruCache=Le(20,6e4)):this.blur()})):this.setSelectedOption(e)}handleExpressionSelection(t){const e=t.detail.selected,i=t.detail.tabbed,n=this.shadowRoot.querySelector(".searchbox");lc(this.query,n,e),this.query="",this.completionOptions=[],i?this.fetchExpressions():-1===this.input.indexOf("(")&&this.addInputAsValue()}getOptionsDefault(t){return t.json.results}isCompleteDefault(t,e){const i=e.json;return!i.more&&!i.next}handleRemoveSelection(t){this.removeValue(t),this.visibleOptions=[]}createArbitraryOptionDefault(){return null}open(){this.shadowRoot.querySelector(".select-container").click()}isOpen(){return this.visibleOptions.length>0||this.attemptedOpen&&this.focused}setOptions(t){this.staticOptions=t}setVisibleOptions(t){if(t=t.filter((t=>!!this.getNameInternal(t)&&(!this.shouldExclude||!this.shouldExclude(t)))),this.input){if(this.searchable&&!this.queryParam){const e=this.input.trim().toLowerCase();t=t.filter((t=>this.isMatch(t,e)))}const e=this.createArbitraryOption(this.input,t);if(e){e.arbitrary=!0;t.find((t=>this.getValue(t)===this.getValue(e)))||(t.length>0&&t[0].arbitrary?t[0]=e:t.unshift(e))}}this.values.length>0&&(this.multi?t=t.filter((t=>!this.values.find((e=>this.getValue(e)===this.getValue(t))))):(this.input?this.cursorIndex=0:this.cursorIndex=t.findIndex((t=>this.getValue(t)===this.getValue(this.values[0]))),this.requestUpdate("cursorIndex"))),this.multi&&this.maxItems>0&&this.values.length>=this.maxItems&&(t=[],this.infoText=this.maxItemsText),this.sortFunction&&t.sort(this.sortFunction),this.visibleOptions=t,this.fireCustomEvent(Oe.ContentChanged,{options:this.visibleOptions})}fetchExpressions(){const t=document.querySelector("temba-store");if(this.expressions&&t){const t=this.shadowRoot.querySelector(".searchbox"),e=cc(t,"session"===this.expressions);return this.query=e.query,this.completionOptions=e.options,this.visibleOptions=[],this.anchorPosition=e.anchorPosition,void this.fireCustomEvent(Oe.FetchComplete)}}fetchOptions(t,e=0,i=null){if(this.completionOptions=[],!this.fetching){this.fetching=!0;const n=[...this.staticOptions],o=(t||"").trim().toLowerCase();if(this.tags&&o&&(n.find((t=>this.getValue(t)&&this.getValue(t).toLowerCase()===o))||n.splice(0,0,{name:t,value:t})),this.endpoint){let s=this.endpoint;i?s=i:(t&&this.queryParam&&(s.indexOf("?")>-1?s+="&":s+="?",s+=this.queryParam+"="+encodeURIComponent(t)),e&&(s.indexOf("?")>-1?s+="&":s+="?",s+="page="+e));const r=this.lruCache.get(s);if(this.cache&&!this.tags&&r)return 0!==e||this.next?this.setVisibleOptions([...this.visibleOptions,...r.options]):(this.cursorIndex=0,this.setVisibleOptions([...n,...r.options])),this.complete=r.complete,this.next=r.next,void(this.fetching=!1);this.searchable&&!this.queryParam?Zt(s).then((t=>{t=this.prepareOptions(t),this.cache&&!this.tags&&(this.lruCache.set(s,{options:t,complete:!0,next:null}),this.complete=!0,this.next=null,this.setVisibleOptions([...n,...t]),this.fetching=!1)})):Ut(s).then((i=>{let r=this.getOptions(i).filter((t=>this.isMatch(t,o)));r=this.prepareOptions(r),this.next=null;const a=i.json;a.next&&(this.next=a.next),0!==e||this.next?(r.length>0&&this.setVisibleOptions([...this.visibleOptions,...r]),this.complete=this.isComplete(r,i)):(this.cursorIndex=0,this.setVisibleOptions([...n,...r]),this.query=t,this.complete=this.isComplete(this.visibleOptions,i)),this.cache&&!this.tags&&this.lruCache.set(s,{options:r,complete:this.complete,next:this.next}),this.fetching=!1,this.page=e})).catch((t=>{this.fetching=!1,console.error(t)}))}else this.fetching=!1,this.setVisibleOptions(n)}}handleFocus(){this.focused||0!==this.visibleOptions.length||(this.focused=!0)}handleBlur(){this.focused=!1,this.attemptedOpen=!1,this.visibleOptions.length>0&&(this.input="",this.next=null,this.complete=!0,this.visibleOptions=[],this.cursorIndex=0),this.multi&&this.maxItems>0&&this.values.length>=this.maxItems&&(this.infoText="")}handleClick(){this.selectedIndex=-1,this.requestUpdate("input")}addInputAsValue(){const t=this.shadowRoot.querySelector(".searchbox"),e={name:t.value,value:t.value,expression:!0};this.multi?this.values.find((t=>t.expression&&t.value&&e.value&&t.value.toLowerCase().trim()==e.value.toLowerCase().trim()))||this.addValue(e):this.setValues([e]),this.input="",this.multi||this.blur()}handleKeyDown(t){if("Enter"===t.key&&this.expressions&&0===this.completionOptions.length&&this.input.indexOf("@")>-1&&this.addInputAsValue(),("Enter"===t.key||"ArrowDown"===t.key||"n"===t.key&&t.ctrlKey)&&0===this.visibleOptions.length&&0===this.completionOptions.length&&!this.input)return this.attemptedOpen=!0,void this.requestUpdate("input");if(this.multi&&"Backspace"===t.key&&!this.input){if(this.visibleOptions.length>0)return void(this.visibleOptions=[]);-1===this.selectedIndex?(this.selectedIndex=this.values.length-1,this.visibleOptions=[]):(this.popValue(),this.selectedIndex=-1)}else this.selectedIndex=-1}getStaticOptions(){return this.staticOptions}handleInput(t){const e=t.currentTarget;this.input=e.value}handleCancel(){this.visibleOptions=[],this.attemptedOpen=!1}handleCursorChanged(t){this.cursorIndex=t.detail.index}handleContainerClick(t){if(t.stopPropagation(),t.preventDefault(),this.focused=!0,"INPUT"!==t.target.tagName){const t=this.shadowRoot.querySelector("input");if(t)return t.click(),void t.focus();this.isOpen()?(this.visibleOptions=[],this.attemptedOpen=!1):(this.attemptedOpen=!0,this.requestUpdate("input"),this.requestUpdate())}}getEventHandlers(){return[{event:Oe.Canceled,method:this.handleCancel},{event:Oe.CursorChanged,method:this.handleCursorChanged},{event:"blur",method:this.handleBlur},{event:"focus",method:this.handleFocus}]}handleArrowClick(t){this.isOpen()&&(t.preventDefault(),t.stopPropagation(),this.blur())}renderOptionDefault(t){if(!t)return null;const e=t.icon;return U`
925
939
  <div class="option-name" style="display:flex">
926
940
  ${e?U`<temba-icon
927
941
  name="${e}"
928
942
  style="margin-right:0.5em;"
929
943
  ></temba-icon>`:null}<span>${this.getName(t)}</span>
930
944
  </div>
931
- `}renderSelectedItemDefault(t){return(this.renderOption||this.renderOptionDefault)(t,!0)}serializeValue(t){return!this.jsonValue&&(this.staticOptions.length>0||this.tags)?t.value:super.serializeValue(t)}setSelection(t){for(const e of this.staticOptions)if(this.getValue(e)===t)return void(0!==this.values.length&&this.values[0].value==""+t||this.setValues([e]))}handleClear(t){t.preventDefault(),t.stopPropagation(),this.setValues([]),this.visibleOptions.length>0&&(this.visibleOptions=[],this.requestUpdate()),this.fireCustomEvent(Oe.Selection,{selected:null})}setValues(t){const e=this.values;this.values=t,this.requestUpdate("values",e)}addValue(t){const e=[...this.values];this.values.push(t),this.requestUpdate("values",e)}removeValue(t){const e=[...this.values],i=this.values.indexOf(t);i>-1&&this.values.splice(i,1),this.requestUpdate("values",e),this.infoText=""}popValue(){const t=[...this.values];this.values.pop(),this.requestUpdate("values",t),this.infoText=""}clear(){const t=this.values;this.values=[],this.requestUpdate("values",t)}render(){const t=0===this.values.length?this.placeholder:"",e=U`
945
+ `}renderSelectedItemDefault(t){return(this.renderOption||this.renderOptionDefault)(t,!0)}serializeValue(t){return!this.jsonValue&&(this.staticOptions.length>0||this.tags)?t.value:super.serializeValue(t)}setSelection(t){for(const e of this.staticOptions)if(this.getValue(e)===t)return void(0!==this.values.length&&this.values[0].value==""+t||this.setValues([e]))}handleClear(t){t.preventDefault(),t.stopPropagation(),this.setValues([]),this.visibleOptions.length>0&&(this.visibleOptions=[],this.requestUpdate()),this.fireCustomEvent(Oe.Selection,{selected:null})}setValues(t){const e=this.values;this.values=t,this.requestUpdate("values",e)}addValue(t){const e=[...this.values];this.values.push(t),this.requestUpdate("values",e)}removeValue(t){const e=[...this.values],i=this.values.indexOf(t);i>-1&&this.values.splice(i,1),this.requestUpdate("values",e),this.infoText=""}popValue(){const t=[...this.values];this.values.pop(),this.requestUpdate("values",t),this.infoText=""}clear(){const t=this.values;this.values=[],this.requestUpdate("values",t)}shouldShowEmptyMessage(){return this.attemptedOpen&&this.focused&&0===this.visibleOptions.length&&!this.input&&0===this.staticOptions.length&&!this.endpoint}render(){const t=0===this.values.length?this.placeholder:"",e=U`
932
946
  <div class="placeholder">${t}</div>
933
947
  `,i=this.clearable&&this.values.length>0&&!this.multi?U`<temba-icon
934
948
  name="${ve.select_clear}"
@@ -1032,7 +1046,8 @@ let yr=Ks,br=!1;const _r=["es","fr","pt"],xr="data:image/png;base64,iVBORw0KGgoA
1032
1046
  .getName=${this.getNameInternal}
1033
1047
  ?static-width=${this.optionWidth}
1034
1048
  ?anchor-right=${this.anchorRight}
1035
- ?visible=${this.visibleOptions.length>0}
1049
+ ?visible=${this.visibleOptions.length>0||this.shouldShowEmptyMessage()}
1050
+ ?showEmptyMessage=${this.shouldShowEmptyMessage()}
1036
1051
  ></temba-options>
1037
1052
 
1038
1053
  <temba-options
@@ -1053,7 +1068,7 @@ let yr=Ks,br=!1;const _r=["es","fr","pt"],xr="data:image/png;base64,iVBORw0KGgoA
1053
1068
  </div>`:null}
1054
1069
  </temba-options>
1055
1070
  </temba-field>
1056
- `}}t([de({type:Object})],hc.prototype,"inputStyle",void 0),t([de({type:Boolean})],hc.prototype,"multi",void 0),t([de({type:Boolean})],hc.prototype,"searchOnFocus",void 0),t([de({type:String})],hc.prototype,"placeholder",void 0),t([de()],hc.prototype,"name",void 0),t([de()],hc.prototype,"endpoint",void 0),t([de({type:Boolean})],hc.prototype,"allowCreate",void 0),t([de({type:String})],hc.prototype,"nameKey",void 0),t([de({type:String})],hc.prototype,"valueKey",void 0),t([de({type:Number})],hc.prototype,"maxItems",void 0),t([de({type:String})],hc.prototype,"maxItemsText",void 0),t([de({attribute:!1})],hc.prototype,"currentFunction",void 0),t([de({type:String})],hc.prototype,"queryParam",void 0),t([de({type:String})],hc.prototype,"input",void 0),t([de({type:Array})],hc.prototype,"visibleOptions",void 0),t([de({type:Array})],hc.prototype,"completionOptions",void 0),t([de({type:Number})],hc.prototype,"quietMillis",void 0),t([de({type:Boolean})],hc.prototype,"fetching",void 0),t([de({type:Boolean})],hc.prototype,"resolving",void 0),t([de({type:Boolean})],hc.prototype,"searchable",void 0),t([de({type:String})],hc.prototype,"expressions",void 0),t([de({type:Boolean})],hc.prototype,"cache",void 0),t([de({type:String})],hc.prototype,"cacheKey",void 0),t([de({type:Boolean})],hc.prototype,"focused",void 0),t([de({type:Boolean})],hc.prototype,"disabled",void 0),t([de({attribute:!1})],hc.prototype,"selectedIndex",void 0),t([de({type:Number})],hc.prototype,"cursorIndex",void 0),t([de({attribute:!1})],hc.prototype,"anchorElement",void 0),t([de({attribute:!1})],hc.prototype,"anchorExpressions",void 0),t([de({type:Object})],hc.prototype,"anchorPosition",void 0),t([de({type:Boolean})],hc.prototype,"tags",void 0),t([de({type:Boolean,attribute:"space_select"})],hc.prototype,"spaceSelect",void 0),t([de({type:Boolean})],hc.prototype,"jsonValue",void 0),t([de({type:Boolean})],hc.prototype,"hideErrors",void 0),t([de({type:Boolean})],hc.prototype,"clearable",void 0),t([de({type:Boolean})],hc.prototype,"sorted",void 0),t([de({type:String})],hc.prototype,"flavor",void 0),t([de({type:String,attribute:"info_text"})],hc.prototype,"infoText",void 0),t([de({type:Array})],hc.prototype,"values",void 0),t([de({type:Object})],hc.prototype,"selection",void 0),t([de({attribute:!1})],hc.prototype,"getName",void 0),t([de({attribute:!1})],hc.prototype,"isMatch",void 0),t([de({attribute:!1})],hc.prototype,"getValue",void 0),t([de({type:Number,attribute:"option-width"})],hc.prototype,"optionWidth",void 0),t([de({type:Boolean,attribute:"anchor-right"})],hc.prototype,"anchorRight",void 0),t([de({attribute:!1})],hc.prototype,"shouldExclude",void 0),t([de({attribute:!1})],hc.prototype,"sortFunction",void 0),t([de({attribute:!1})],hc.prototype,"renderOption",void 0),t([de({attribute:!1})],hc.prototype,"renderOptionName",void 0),t([de({attribute:!1})],hc.prototype,"renderOptionDetail",void 0),t([de({attribute:!1})],hc.prototype,"renderSelectedItem",void 0),t([de({attribute:!1})],hc.prototype,"createArbitraryOption",void 0),t([de({attribute:!1})],hc.prototype,"getOptions",void 0),t([de({attribute:!1})],hc.prototype,"prepareOptions",void 0),t([de({attribute:!1})],hc.prototype,"isComplete",void 0),t([de({type:Array,attribute:"options"})],hc.prototype,"staticOptions",void 0),t([de({type:Boolean})],hc.prototype,"allowAnchor",void 0);class dc extends ge{constructor(){super(...arguments),this.submitOnEnter=!1,this.anchorPosition={left:0,top:0},this.placeholder="",this.options=[],this.name="",this.value="",this.autogrow=!1}static get styles(){return a`
1071
+ `}}t([de({type:Object})],hc.prototype,"inputStyle",void 0),t([de({type:Boolean})],hc.prototype,"multi",void 0),t([de({type:Boolean})],hc.prototype,"searchOnFocus",void 0),t([de({type:String})],hc.prototype,"placeholder",void 0),t([de()],hc.prototype,"name",void 0),t([de()],hc.prototype,"endpoint",void 0),t([de({type:Boolean})],hc.prototype,"allowCreate",void 0),t([de({type:String})],hc.prototype,"nameKey",void 0),t([de({type:String})],hc.prototype,"valueKey",void 0),t([de({type:Number})],hc.prototype,"maxItems",void 0),t([de({type:String})],hc.prototype,"maxItemsText",void 0),t([de({attribute:!1})],hc.prototype,"currentFunction",void 0),t([de({type:String})],hc.prototype,"queryParam",void 0),t([de({type:String})],hc.prototype,"input",void 0),t([de({type:Array})],hc.prototype,"visibleOptions",void 0),t([de({type:Array})],hc.prototype,"completionOptions",void 0),t([de({type:Number})],hc.prototype,"quietMillis",void 0),t([de({type:Boolean})],hc.prototype,"fetching",void 0),t([de({type:Boolean})],hc.prototype,"resolving",void 0),t([de({type:Boolean})],hc.prototype,"searchable",void 0),t([de({type:String})],hc.prototype,"expressions",void 0),t([de({type:Boolean})],hc.prototype,"cache",void 0),t([de({type:String})],hc.prototype,"cacheKey",void 0),t([de({type:Boolean})],hc.prototype,"focused",void 0),t([de({type:Boolean})],hc.prototype,"disabled",void 0),t([ue()],hc.prototype,"attemptedOpen",void 0),t([de({attribute:!1})],hc.prototype,"selectedIndex",void 0),t([de({type:Number})],hc.prototype,"cursorIndex",void 0),t([de({attribute:!1})],hc.prototype,"anchorElement",void 0),t([de({attribute:!1})],hc.prototype,"anchorExpressions",void 0),t([de({type:Object})],hc.prototype,"anchorPosition",void 0),t([de({type:Boolean})],hc.prototype,"tags",void 0),t([de({type:Boolean,attribute:"space_select"})],hc.prototype,"spaceSelect",void 0),t([de({type:Boolean})],hc.prototype,"jsonValue",void 0),t([de({type:Boolean})],hc.prototype,"hideErrors",void 0),t([de({type:Boolean})],hc.prototype,"clearable",void 0),t([de({type:Boolean})],hc.prototype,"sorted",void 0),t([de({type:String})],hc.prototype,"flavor",void 0),t([de({type:String,attribute:"info_text"})],hc.prototype,"infoText",void 0),t([de({type:Array})],hc.prototype,"values",void 0),t([de({type:Object})],hc.prototype,"selection",void 0),t([de({attribute:!1})],hc.prototype,"getName",void 0),t([de({attribute:!1})],hc.prototype,"isMatch",void 0),t([de({attribute:!1})],hc.prototype,"getValue",void 0),t([de({type:Number,attribute:"option-width"})],hc.prototype,"optionWidth",void 0),t([de({type:Boolean,attribute:"anchor-right"})],hc.prototype,"anchorRight",void 0),t([de({attribute:!1})],hc.prototype,"shouldExclude",void 0),t([de({attribute:!1})],hc.prototype,"sortFunction",void 0),t([de({attribute:!1})],hc.prototype,"renderOption",void 0),t([de({attribute:!1})],hc.prototype,"renderOptionName",void 0),t([de({attribute:!1})],hc.prototype,"renderOptionDetail",void 0),t([de({attribute:!1})],hc.prototype,"renderSelectedItem",void 0),t([de({attribute:!1})],hc.prototype,"createArbitraryOption",void 0),t([de({attribute:!1})],hc.prototype,"getOptions",void 0),t([de({attribute:!1})],hc.prototype,"prepareOptions",void 0),t([de({attribute:!1})],hc.prototype,"isComplete",void 0),t([de({type:Array,attribute:"options"})],hc.prototype,"staticOptions",void 0),t([de({type:Boolean})],hc.prototype,"allowAnchor",void 0);class dc extends ge{constructor(){super(...arguments),this.submitOnEnter=!1,this.anchorPosition={left:0,top:0},this.placeholder="",this.options=[],this.name="",this.value="",this.autogrow=!1}static get styles(){return a`
1057
1072
  :host {
1058
1073
  display: block;
1059
1074
  }
@@ -3275,9 +3290,10 @@ let yr=Ks,br=!1;const _r=["es","fr","pt"],xr="data:image/png;base64,iVBORw0KGgoA
3275
3290
 
3276
3291
  .spin-forever {
3277
3292
  animation-name: spin;
3278
- animation-duration: 2000ms;
3293
+ animation-duration: var(--test-animation-duration, 2000ms);
3279
3294
  animation-iteration-count: infinite;
3280
3295
  animation-timing-function: linear;
3296
+ animation-play-state: var(--test-animation-play-state, running);
3281
3297
  }
3282
3298
 
3283
3299
  @keyframes spin {
@@ -5491,14 +5507,14 @@ let yr=Ks,br=!1;const _r=["es","fr","pt"],xr="data:image/png;base64,iVBORw0KGgoA
5491
5507
  />`:U`<temba-icon
5492
5508
  name="hourglass"
5493
5509
  style="--icon-color:var(--color-primary-dark);margin-left:0.5em"
5494
- />`),e}createRenderOption(){this.renderOption=t=>{let e="";return t.exited_on||(e="font-weight:400;"),t.responded||(e+=""),U`
5495
- <div class="row" style="${e}display:flex;align-items:center">
5510
+ />`),e}createRenderOption(){this.renderOption=t=>{var e,i,n;let o="";return t.exited_on||(o="font-weight:400;"),t.responded||(o+=""),U`
5511
+ <div class="row" style="${o}display:flex;align-items:center">
5496
5512
  <div
5497
5513
  style="width:16em;white-space:nowrap;overflow: hidden; text-overflow: ellipsis;"
5498
5514
  >
5499
5515
  <temba-contact-name
5500
- name=${t.contact.name||t.contact.anon_display}
5501
- urn=${t.contact.urn}
5516
+ name=${(null===(e=t.contact)||void 0===e?void 0:e.name)||(null===(i=t.contact)||void 0===i?void 0:i.anon_display)||""}
5517
+ urn=${(null===(n=t.contact)||void 0===n?void 0:n.urn)||""}
5502
5518
  icon-size="15"
5503
5519
  />
5504
5520
  </div>
@@ -5552,7 +5568,7 @@ let yr=Ks,br=!1;const _r=["es","fr","pt"],xr="data:image/png;base64,iVBORw0KGgoA
5552
5568
  >
5553
5569
  Last Updated
5554
5570
  </div>
5555
- `}renderFooter(){if(!this.selectedRun||!this.resultKeys)return null;const t=Object.keys(this.selectedRun.values);return U` <div
5571
+ `}renderFooter(){var t,e,i,n;if(!this.selectedRun||!this.resultKeys)return null;const o=Object.keys(this.selectedRun.values||{});return U` <div
5556
5572
  style="margin-top: 1.5em; margin-bottom:0.5em;flex-grow:1;border-radius:var(--curvature); border: 1px solid var(--color-widget-border);"
5557
5573
  >
5558
5574
  <div style="display:flex;flex-direction:column;">
@@ -5562,10 +5578,10 @@ let yr=Ks,br=!1;const _r=["es","fr","pt"],xr="data:image/png;base64,iVBORw0KGgoA
5562
5578
  <div>
5563
5579
  <temba-contact-name
5564
5580
  style="cursor:pointer"
5565
- name=${this.selectedRun.contact.name||this.selectedRun.contact.anon_display}
5566
- urn=${this.selectedRun.contact.urn}
5581
+ name=${(null===(t=this.selectedRun.contact)||void 0===t?void 0:t.name)||(null===(e=this.selectedRun.contact)||void 0===e?void 0:e.anon_display)||""}
5582
+ urn=${(null===(i=this.selectedRun.contact)||void 0===i?void 0:i.urn)||""}
5567
5583
  onclick="goto(event, this)"
5568
- href="/contact/read/${this.selectedRun.contact.uuid}/"
5584
+ href="/contact/read/${(null===(n=this.selectedRun.contact)||void 0===n?void 0:n.uuid)||""}/"
5569
5585
  ></temba-contact-name>
5570
5586
  <div
5571
5587
  style="display:flex;margin-left:-0.2em;margin-top:0.25em;font-size: 0.65em"
@@ -5595,7 +5611,7 @@ let yr=Ks,br=!1;const _r=["es","fr","pt"],xr="data:image/png;base64,iVBORw0KGgoA
5595
5611
  <div style="flex-grow:1"></div>
5596
5612
  <div style="display:flex;flex-direction: column">
5597
5613
  <div style="font-size:0.75em">
5598
- ${new Date(this.selectedRun.created_on).toLocaleString()}
5614
+ ${this.selectedRun.created_on?new Date(this.selectedRun.created_on).toLocaleString():""}
5599
5615
  </div>
5600
5616
  <div
5601
5617
  style="font-size:0.6em;align-self:flex-end;color:#888;line-height:0.75em"
@@ -5611,7 +5627,7 @@ let yr=Ks,br=!1;const _r=["es","fr","pt"],xr="data:image/png;base64,iVBORw0KGgoA
5611
5627
  ></temba-icon>`:null}
5612
5628
  </div>
5613
5629
 
5614
- ${t.length>0?U`
5630
+ ${o.length>0?U`
5615
5631
  <div style="padding:1em;">
5616
5632
  <div
5617
5633
  style="display:flex;font-size:1.2em;position:relative;right:0px"
@@ -8216,36 +8232,7 @@ const{I:cd}=at,hd=()=>document.createComment(""),dd=(t,e,i)=>{const n=t._$AA.par
8216
8232
  `:null}
8217
8233
  </div>
8218
8234
  </div>
8219
- `:super.render()}}t([de({type:Object,attribute:!1})],ob.prototype,"note",void 0),t([de({type:String})],ob.prototype,"dirtyMessage",void 0);class sb extends uc{constructor(){super(...arguments),this.backlogSize=0,this.endpoint="/msg/menu/",this.folders={},this.fetches=0,this.msgsPerSecond=0}static get styles(){return a`
8220
- .monitor {
8221
- margin: 1rem;
8222
- margin-bottom: -0.5rem;
8223
- }
8224
-
8225
- .header {
8226
- font-weight: bold;
8227
- }
8228
-
8229
- .estimate {
8230
- font-size: 0.9em;
8231
- }
8232
- `}fetchFolders(){Zt(this.endpoint).then((t=>{t.filter((t=>"outbox"===t.id||"sent"===t.id||"failed"===t.id)).forEach((t=>{this.folders[t.id]?this.folders[t.id].current=t.count:this.folders[t.id]={start:t.count,current:t.count}})),this.firstFetch?this.lastFetch=new Date:this.firstFetch=new Date,this.fetches++,this.scheduleRefresh(Math.min(5e3*this.fetches,6e4));const e=this.folders.outbox;this.backlogSize=e.current,e.current>1&&this.estimateCompletion()}))}estimateCompletion(){if(this.lastFetch){const t=(this.lastFetch.getTime()-this.firstFetch.getTime())/1e3,e=this.folders.sent,i=this.folders.failed,n=e.current+i.current-(e.start+i.start);this.msgsPerSecond=n/t;const o=this.folders.outbox.current/this.msgsPerSecond;this.estimatedCompletionDate=new Date((new Date).getTime()+1e3*o)}}scheduleRefresh(t){setTimeout((()=>{this.fetchFolders()}),t)}firstUpdated(t){t.has("endpoint")&&this.endpoint&&this.fetchFolders()}hasBacklog(){return this.backlogSize>5e5}render(){const t=Math.round(this.msgsPerSecond);return this.hasBacklog()&&this.estimatedCompletionDate&&!this.isMobile()?U`<div class="monitor">
8233
- <temba-alert
8234
- ><div class="header">Outbox Notice</div>
8235
- <div class="estimate">
8236
- If your outbox becomes too full, you won't be able to send new flows
8237
- or broadcasts. Your channels are currently sending at
8238
- ${t.toLocaleString()}
8239
- message${1==t?"":"s"} per second. At that rate, your
8240
- outbox will clear
8241
- <temba-date
8242
- value="${this.estimatedCompletionDate.toISOString()}"
8243
- display="duration"
8244
- ></temba-date
8245
- >.
8246
- </div></temba-alert
8247
- >
8248
- </div>`:null}}t([de({type:Number})],sb.prototype,"backlogSize",void 0),t([de({type:String})],sb.prototype,"endpoint",void 0),t([de({type:Object})],sb.prototype,"firstFetch",void 0),t([de({type:Object})],sb.prototype,"lastFetch",void 0),t([de({type:Number})],sb.prototype,"fetches",void 0),t([de({type:Number})],sb.prototype,"msgsPerSecond",void 0),t([de({type:Object})],sb.prototype,"estimatedCompletionDate",void 0);class rb extends fe{constructor(){super(...arguments),this.total=100,this.current=0,this.pct=0,this.done=!1,this.showEstimatedCompletion=!1,this.showPercentage=!1}updated(t){if(t.has("eta")&&this.eta&&(this.estimatedCompletionDate=new Date(this.eta),this.showEstimatedCompletion=this.estimatedCompletionDate>new Date),t.has("current")){const t=Math.floor(Math.min(this.current/this.total*100,100));Number.isNaN(t)?this.showPercentage=!1:(this.pct=t,this.showPercentage=!0),this.done=this.pct>=100}}render(){return U`<div class="wrapper ${this.done?"complete":""}">
8235
+ `:super.render()}}t([de({type:Object,attribute:!1})],ob.prototype,"note",void 0),t([de({type:String})],ob.prototype,"dirtyMessage",void 0);class sb extends fe{constructor(){super(...arguments),this.total=100,this.current=0,this.pct=0,this.done=!1,this.showEstimatedCompletion=!1,this.showPercentage=!1}updated(t){if(t.has("eta")&&this.eta&&(this.estimatedCompletionDate=new Date(this.eta),this.showEstimatedCompletion=this.estimatedCompletionDate>new Date),t.has("current")){const t=Math.floor(Math.min(this.current/this.total*100,100));Number.isNaN(t)?this.showPercentage=!1:(this.pct=t,this.showPercentage=!0),this.done=this.pct>=100}}render(){return U`<div class="wrapper ${this.done?"complete":""}">
8249
8236
  <div class="meter ${this.done?"done":""}">
8250
8237
  ${this.message?U`<div class="message">${this.message}</div>`:null}
8251
8238
  <span class="complete" style="flex-basis: ${this.pct}%"></span>
@@ -8262,7 +8249,7 @@ const{I:cd}=at,hd=()=>document.createComment(""),dd=(t,e,i)=>{const n=t._$AA.par
8262
8249
  </div>`:null}
8263
8250
 
8264
8251
  <slot></slot>
8265
- </div>`}}rb.styles=a`
8252
+ </div>`}}sb.styles=a`
8266
8253
  .wrapper {
8267
8254
  display: flex;
8268
8255
  box-sizing: content-box;
@@ -8384,7 +8371,7 @@ const{I:cd}=at,hd=()=>document.createComment(""),dd=(t,e,i)=>{const n=t._$AA.par
8384
8371
  .meter.done > span {
8385
8372
  background: rgb(var(--success-rgb));
8386
8373
  }
8387
- `,t([de({type:Number})],rb.prototype,"total",void 0),t([de({type:Number})],rb.prototype,"current",void 0),t([de({type:Number})],rb.prototype,"pct",void 0),t([de({type:Boolean})],rb.prototype,"done",void 0),t([de({type:String})],rb.prototype,"eta",void 0),t([de({type:String,attribute:!1})],rb.prototype,"estimatedCompletionDate",void 0),t([de({type:Boolean})],rb.prototype,"showEstimatedCompletion",void 0),t([de({type:Boolean})],rb.prototype,"showPercentage",void 0),t([de({type:String})],rb.prototype,"message",void 0);class ab extends fe{constructor(){super(...arguments),this.refreshes=0,this.complete=!1,this.running=!1}updated(t){super.updated(t),t.has("id")&&this.refresh()}interruptStart(){var t,e;t=this.interruptTitle,e=this.interruptEndpoint,window.showModax(t,e)}refresh(){Zt(this.statusEndpoint,this.getHeaders()).then((t=>{if(t.length>0){this.refreshes++;const e=t[0];if(this.current=e.progress.current,this.total=e.progress.total,this.complete="Completed"==e.status||"Failed"==e.status||"Interrupted"==e.status,this.running="Started"===e.status,"Pending"===e.status?this.message="Preparing to start..":"Queued"===e.status?this.message="Waiting..":this.message=null,"Started"===e.status){const t=(new Date).getTime()-new Date(e.modified_on).getTime(),i=this.current/t;if(i>.1){const t=new Date((new Date).getTime()+(this.total-this.current)/i),e=new Date;e.setMonth(e.getMonth()+2),this.eta=t>e?null:t.toISOString()}}!this.complete&&this.current<this.total&&setTimeout((()=>{this.refresh()}),Math.min(1e3*this.refreshes,6e4)),this.complete&&this.scheduleRemoval()}}))}scheduleRemoval(){setTimeout((()=>{this.remove()}),5e3)}render(){return U`<temba-progress
8374
+ `,t([de({type:Number})],sb.prototype,"total",void 0),t([de({type:Number})],sb.prototype,"current",void 0),t([de({type:Number})],sb.prototype,"pct",void 0),t([de({type:Boolean})],sb.prototype,"done",void 0),t([de({type:String})],sb.prototype,"eta",void 0),t([de({type:String,attribute:!1})],sb.prototype,"estimatedCompletionDate",void 0),t([de({type:Boolean})],sb.prototype,"showEstimatedCompletion",void 0),t([de({type:Boolean})],sb.prototype,"showPercentage",void 0),t([de({type:String})],sb.prototype,"message",void 0);class rb extends fe{constructor(){super(...arguments),this.refreshes=0,this.complete=!1,this.running=!1}updated(t){super.updated(t),t.has("id")&&this.refresh()}interruptStart(){var t,e;t=this.interruptTitle,e=this.interruptEndpoint,window.showModax(t,e)}refresh(){Zt(this.statusEndpoint,this.getHeaders()).then((t=>{if(t.length>0){this.refreshes++;const e=t[0];if(this.current=e.progress.current,this.total=e.progress.total,this.complete="Completed"==e.status||"Failed"==e.status||"Interrupted"==e.status,this.running="Started"===e.status,"Pending"===e.status?this.message="Preparing to start..":"Queued"===e.status?this.message="Waiting..":this.message=null,"Started"===e.status){const t=(new Date).getTime()-new Date(e.modified_on).getTime(),i=this.current/t;if(i>.1){const t=new Date((new Date).getTime()+(this.total-this.current)/i),e=new Date;e.setMonth(e.getMonth()+2),this.eta=t>e?null:t.toISOString()}}!this.complete&&this.current<this.total&&setTimeout((()=>{this.refresh()}),Math.min(1e3*this.refreshes,6e4)),this.complete&&this.scheduleRemoval()}}))}scheduleRemoval(){setTimeout((()=>{this.remove()}),5e3)}render(){return U`<temba-progress
8388
8375
  total=${this.total}
8389
8376
  current=${this.current}
8390
8377
  eta=${this.eta}
@@ -8394,7 +8381,7 @@ const{I:cd}=at,hd=()=>document.createComment(""),dd=(t,e,i)=>{const n=t._$AA.par
8394
8381
  name="close"
8395
8382
  @click=${this.interruptStart}
8396
8383
  ></temba-icon>`:null}
8397
- </temba-progress>`}}ab.styles=a`
8384
+ </temba-progress>`}}rb.styles=a`
8398
8385
  temba-icon[name='close'] {
8399
8386
  cursor: pointer;
8400
8387
  margin: 0 4px;
@@ -8403,7 +8390,7 @@ const{I:cd}=at,hd=()=>document.createComment(""),dd=(t,e,i)=>{const n=t._$AA.par
8403
8390
  temba-icon[name='close']:hover {
8404
8391
  color: var(--color-primary-dark);
8405
8392
  }
8406
- `,t([de({type:String})],ab.prototype,"id",void 0),t([de({type:Number})],ab.prototype,"current",void 0),t([de({type:Number})],ab.prototype,"total",void 0),t([de({type:Number})],ab.prototype,"refreshes",void 0),t([de({type:String})],ab.prototype,"eta",void 0),t([de({type:Boolean})],ab.prototype,"complete",void 0),t([de({type:Boolean})],ab.prototype,"running",void 0),t([de({type:String})],ab.prototype,"message",void 0),t([de({type:String})],ab.prototype,"statusEndpoint",void 0),t([de({type:String})],ab.prototype,"interruptTitle",void 0),t([de({type:String})],ab.prototype,"interruptEndpoint",void 0);class lb extends Mc{static get styles(){return a`
8393
+ `,t([de({type:String})],rb.prototype,"id",void 0),t([de({type:Number})],rb.prototype,"current",void 0),t([de({type:Number})],rb.prototype,"total",void 0),t([de({type:Number})],rb.prototype,"refreshes",void 0),t([de({type:String})],rb.prototype,"eta",void 0),t([de({type:Boolean})],rb.prototype,"complete",void 0),t([de({type:Boolean})],rb.prototype,"running",void 0),t([de({type:String})],rb.prototype,"message",void 0),t([de({type:String})],rb.prototype,"statusEndpoint",void 0),t([de({type:String})],rb.prototype,"interruptTitle",void 0),t([de({type:String})],rb.prototype,"interruptEndpoint",void 0);class ab extends Mc{static get styles(){return a`
8407
8394
  temba-options {
8408
8395
  display: block;
8409
8396
  width: 100%;
@@ -8468,7 +8455,7 @@ const{I:cd}=at,hd=()=>document.createComment(""),dd=(t,e,i)=>{const n=t._$AA.par
8468
8455
  .cursorIndex=${this.cursorIndex}
8469
8456
  .options=${this.filteredShortcuts}
8470
8457
  ></temba-options>
8471
- `}}t([de({type:String})],lb.prototype,"filter",void 0),t([de({type:Array})],lb.prototype,"filteredShortcuts",void 0),t([de({type:Number})],lb.prototype,"cursorIndex",void 0);class cb extends fe{constructor(){super(...arguments),this.placeholder="",this.endpoint=""}handleChange(){this.blur()}render(){return U`
8458
+ `}}t([de({type:String})],ab.prototype,"filter",void 0),t([de({type:Array})],ab.prototype,"filteredShortcuts",void 0),t([de({type:Number})],ab.prototype,"cursorIndex",void 0);class lb extends fe{constructor(){super(...arguments),this.placeholder="",this.endpoint=""}handleChange(){this.blur()}render(){return U`
8472
8459
  <div>
8473
8460
  <temba-dropdown>
8474
8461
  <div slot="toggle"><slot name="toggle"></slot></div>
@@ -8483,7 +8470,7 @@ const{I:cd}=at,hd=()=>document.createComment(""),dd=(t,e,i)=>{const n=t._$AA.par
8483
8470
  </div>
8484
8471
  </temba-dropdown>
8485
8472
  </div>
8486
- `}}cb.styles=a`
8473
+ `}}lb.styles=a`
8487
8474
  :host {
8488
8475
  }
8489
8476
 
@@ -8500,7 +8487,7 @@ const{I:cd}=at,hd=()=>document.createComment(""),dd=(t,e,i)=>{const n=t._$AA.par
8500
8487
  --color-widget-border: transparent;
8501
8488
  --widget-box-shadow: none;
8502
8489
  }
8503
- `,t([de({type:String})],cb.prototype,"placeholder",void 0),t([de({type:String})],cb.prototype,"endpoint",void 0);class hb extends hc{static get styles(){return[super.styles,a`
8490
+ `,t([de({type:String})],lb.prototype,"placeholder",void 0),t([de({type:String})],lb.prototype,"endpoint",void 0);class cb extends hc{static get styles(){return[super.styles,a`
8504
8491
  :host {
8505
8492
  width: 150px;
8506
8493
  display: block;
@@ -8510,7 +8497,7 @@ const{I:cd}=at,hd=()=>document.createComment(""),dd=(t,e,i)=>{const n=t._$AA.par
8510
8497
  name=${t.name}
8511
8498
  avatar=${t.avatar}
8512
8499
  showname
8513
- ></temba-user>`:U``}}t([de({type:String})],hb.prototype,"endpoint",void 0),t([de({type:String})],hb.prototype,"nameKey",void 0),t([de({type:String})],hb.prototype,"valueKey",void 0),t([de({type:String})],hb.prototype,"placeholder",void 0),t([de({type:Boolean})],hb.prototype,"sorted",void 0),t([de({type:Object})],hb.prototype,"user",void 0);class db extends hc{static get styles(){return[super.styles,a`
8500
+ ></temba-user>`:U``}}t([de({type:String})],cb.prototype,"endpoint",void 0),t([de({type:String})],cb.prototype,"nameKey",void 0),t([de({type:String})],cb.prototype,"valueKey",void 0),t([de({type:String})],cb.prototype,"placeholder",void 0),t([de({type:Boolean})],cb.prototype,"sorted",void 0),t([de({type:Object})],cb.prototype,"user",void 0);class hb extends hc{static get styles(){return[super.styles,a`
8514
8501
  :host {
8515
8502
  border: 0px solid blue;
8516
8503
  }
@@ -8521,26 +8508,26 @@ const{I:cd}=at,hd=()=>document.createComment(""),dd=(t,e,i)=>{const n=t._$AA.par
8521
8508
  * (c) 2024 Jukka Kurkela
8522
8509
  * Released under the MIT License
8523
8510
  */
8524
- function ub(t){return t+.5|0}t([de({type:String})],db.prototype,"endpoint",void 0),t([de({type:String})],db.prototype,"nameKey",void 0),t([de({type:String})],db.prototype,"valueKey",void 0),t([de({type:String})],db.prototype,"placeholder",void 0),t([de({type:Boolean})],db.prototype,"sorted",void 0),t([de({type:Object})],db.prototype,"workspace",void 0);const pb=(t,e,i)=>Math.max(Math.min(t,i),e);function mb(t){return pb(ub(2.55*t),0,255)}function fb(t){return pb(ub(255*t),0,255)}function gb(t){return pb(ub(t/2.55)/100,0,1)}function vb(t){return pb(ub(100*t),0,100)}const yb={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},bb=[..."0123456789ABCDEF"],_b=t=>bb[15&t],xb=t=>bb[(240&t)>>4]+bb[15&t],wb=t=>(240&t)>>4==(15&t);function kb(t){var e=(t=>wb(t.r)&&wb(t.g)&&wb(t.b)&&wb(t.a))(t)?_b:xb;return t?"#"+e(t.r)+e(t.g)+e(t.b)+((t,e)=>t<255?e(t):"")(t.a,e):void 0}const Sb=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function Cb(t,e,i){const n=e*Math.min(i,1-i),o=(e,o=(e+t/30)%12)=>i-n*Math.max(Math.min(o-3,9-o,1),-1);return[o(0),o(8),o(4)]}function Eb(t,e,i){const n=(n,o=(n+t/60)%6)=>i-i*e*Math.max(Math.min(o,4-o,1),0);return[n(5),n(3),n(1)]}function Ab(t,e,i){const n=Cb(t,1,.5);let o;for(e+i>1&&(o=1/(e+i),e*=o,i*=o),o=0;o<3;o++)n[o]*=1-e-i,n[o]+=e;return n}function Mb(t){const e=t.r/255,i=t.g/255,n=t.b/255,o=Math.max(e,i,n),s=Math.min(e,i,n),r=(o+s)/2;let a,l,c;return o!==s&&(c=o-s,l=r>.5?c/(2-o-s):c/(o+s),a=function(t,e,i,n,o){return t===o?(e-i)/n+(e<i?6:0):e===o?(i-t)/n+2:(t-e)/n+4}(e,i,n,c,o),a=60*a+.5),[0|a,l||0,r]}function Tb(t,e,i,n){return(Array.isArray(e)?t(e[0],e[1],e[2]):t(e,i,n)).map(fb)}function Pb(t,e,i){return Tb(Cb,t,e,i)}function Ob(t){return(t%360+360)%360}function Db(t){const e=Sb.exec(t);let i,n=255;if(!e)return;e[5]!==i&&(n=e[6]?mb(+e[5]):fb(+e[5]));const o=Ob(+e[2]),s=+e[3]/100,r=+e[4]/100;return i="hwb"===e[1]?function(t,e,i){return Tb(Ab,t,e,i)}(o,s,r):"hsv"===e[1]?function(t,e,i){return Tb(Eb,t,e,i)}(o,s,r):Pb(o,s,r),{r:i[0],g:i[1],b:i[2],a:n}}const Ib={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},Lb={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};let $b;function zb(t){$b||($b=function(){const t={},e=Object.keys(Lb),i=Object.keys(Ib);let n,o,s,r,a;for(n=0;n<e.length;n++){for(r=a=e[n],o=0;o<i.length;o++)s=i[o],a=a.replace(s,Ib[s]);s=parseInt(Lb[r],16),t[a]=[s>>16&255,s>>8&255,255&s]}return t}(),$b.transparent=[0,0,0,0]);const e=$b[t.toLowerCase()];return e&&{r:e[0],g:e[1],b:e[2],a:4===e.length?e[3]:255}}const Rb=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;const Nb=t=>t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055,jb=t=>t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4);function Bb(t,e,i){if(t){let n=Mb(t);n[e]=Math.max(0,Math.min(n[e]+n[e]*i,0===e?360:1)),n=Pb(n),t.r=n[0],t.g=n[1],t.b=n[2]}}function Fb(t,e){return t?Object.assign(e||{},t):t}function qb(t){var e={r:0,g:0,b:0,a:255};return Array.isArray(t)?t.length>=3&&(e={r:t[0],g:t[1],b:t[2],a:255},t.length>3&&(e.a=fb(t[3]))):(e=Fb(t,{r:0,g:0,b:0,a:1})).a=fb(e.a),e}function Vb(t){return"r"===t.charAt(0)?function(t){const e=Rb.exec(t);let i,n,o,s=255;if(e){if(e[7]!==i){const t=+e[7];s=e[8]?mb(t):pb(255*t,0,255)}return i=+e[1],n=+e[3],o=+e[5],i=255&(e[2]?mb(i):pb(i,0,255)),n=255&(e[4]?mb(n):pb(n,0,255)),o=255&(e[6]?mb(o):pb(o,0,255)),{r:i,g:n,b:o,a:s}}}(t):Db(t)}class Hb{constructor(t){if(t instanceof Hb)return t;const e=typeof t;let i;var n,o,s;"object"===e?i=qb(t):"string"===e&&(s=(n=t).length,"#"===n[0]&&(4===s||5===s?o={r:255&17*yb[n[1]],g:255&17*yb[n[2]],b:255&17*yb[n[3]],a:5===s?17*yb[n[4]]:255}:7!==s&&9!==s||(o={r:yb[n[1]]<<4|yb[n[2]],g:yb[n[3]]<<4|yb[n[4]],b:yb[n[5]]<<4|yb[n[6]],a:9===s?yb[n[7]]<<4|yb[n[8]]:255})),i=o||zb(t)||Vb(t)),this._rgb=i,this._valid=!!i}get valid(){return this._valid}get rgb(){var t=Fb(this._rgb);return t&&(t.a=gb(t.a)),t}set rgb(t){this._rgb=qb(t)}rgbString(){return this._valid?function(t){return t&&(t.a<255?`rgba(${t.r}, ${t.g}, ${t.b}, ${gb(t.a)})`:`rgb(${t.r}, ${t.g}, ${t.b})`)}(this._rgb):void 0}hexString(){return this._valid?kb(this._rgb):void 0}hslString(){return this._valid?function(t){if(!t)return;const e=Mb(t),i=e[0],n=vb(e[1]),o=vb(e[2]);return t.a<255?`hsla(${i}, ${n}%, ${o}%, ${gb(t.a)})`:`hsl(${i}, ${n}%, ${o}%)`}(this._rgb):void 0}mix(t,e){if(t){const i=this.rgb,n=t.rgb;let o;const s=e===o?.5:e,r=2*s-1,a=i.a-n.a,l=((r*a==-1?r:(r+a)/(1+r*a))+1)/2;o=1-l,i.r=255&l*i.r+o*n.r+.5,i.g=255&l*i.g+o*n.g+.5,i.b=255&l*i.b+o*n.b+.5,i.a=s*i.a+(1-s)*n.a,this.rgb=i}return this}interpolate(t,e){return t&&(this._rgb=function(t,e,i){const n=jb(gb(t.r)),o=jb(gb(t.g)),s=jb(gb(t.b));return{r:fb(Nb(n+i*(jb(gb(e.r))-n))),g:fb(Nb(o+i*(jb(gb(e.g))-o))),b:fb(Nb(s+i*(jb(gb(e.b))-s))),a:t.a+i*(e.a-t.a)}}(this._rgb,t._rgb,e)),this}clone(){return new Hb(this.rgb)}alpha(t){return this._rgb.a=fb(t),this}clearer(t){return this._rgb.a*=1-t,this}greyscale(){const t=this._rgb,e=ub(.3*t.r+.59*t.g+.11*t.b);return t.r=t.g=t.b=e,this}opaquer(t){return this._rgb.a*=1+t,this}negate(){const t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return Bb(this._rgb,2,t),this}darken(t){return Bb(this._rgb,2,-t),this}saturate(t){return Bb(this._rgb,1,t),this}desaturate(t){return Bb(this._rgb,1,-t),this}rotate(t){return function(t,e){var i=Mb(t);i[0]=Ob(i[0]+e),i=Pb(i),t.r=i[0],t.g=i[1],t.b=i[2]}(this._rgb,t),this}}
8511
+ function db(t){return t+.5|0}t([de({type:String})],hb.prototype,"endpoint",void 0),t([de({type:String})],hb.prototype,"nameKey",void 0),t([de({type:String})],hb.prototype,"valueKey",void 0),t([de({type:String})],hb.prototype,"placeholder",void 0),t([de({type:Boolean})],hb.prototype,"sorted",void 0),t([de({type:Object})],hb.prototype,"workspace",void 0);const ub=(t,e,i)=>Math.max(Math.min(t,i),e);function pb(t){return ub(db(2.55*t),0,255)}function mb(t){return ub(db(255*t),0,255)}function fb(t){return ub(db(t/2.55)/100,0,1)}function gb(t){return ub(db(100*t),0,100)}const vb={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},yb=[..."0123456789ABCDEF"],bb=t=>yb[15&t],_b=t=>yb[(240&t)>>4]+yb[15&t],xb=t=>(240&t)>>4==(15&t);function wb(t){var e=(t=>xb(t.r)&&xb(t.g)&&xb(t.b)&&xb(t.a))(t)?bb:_b;return t?"#"+e(t.r)+e(t.g)+e(t.b)+((t,e)=>t<255?e(t):"")(t.a,e):void 0}const kb=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function Sb(t,e,i){const n=e*Math.min(i,1-i),o=(e,o=(e+t/30)%12)=>i-n*Math.max(Math.min(o-3,9-o,1),-1);return[o(0),o(8),o(4)]}function Cb(t,e,i){const n=(n,o=(n+t/60)%6)=>i-i*e*Math.max(Math.min(o,4-o,1),0);return[n(5),n(3),n(1)]}function Eb(t,e,i){const n=Sb(t,1,.5);let o;for(e+i>1&&(o=1/(e+i),e*=o,i*=o),o=0;o<3;o++)n[o]*=1-e-i,n[o]+=e;return n}function Ab(t){const e=t.r/255,i=t.g/255,n=t.b/255,o=Math.max(e,i,n),s=Math.min(e,i,n),r=(o+s)/2;let a,l,c;return o!==s&&(c=o-s,l=r>.5?c/(2-o-s):c/(o+s),a=function(t,e,i,n,o){return t===o?(e-i)/n+(e<i?6:0):e===o?(i-t)/n+2:(t-e)/n+4}(e,i,n,c,o),a=60*a+.5),[0|a,l||0,r]}function Mb(t,e,i,n){return(Array.isArray(e)?t(e[0],e[1],e[2]):t(e,i,n)).map(mb)}function Tb(t,e,i){return Mb(Sb,t,e,i)}function Pb(t){return(t%360+360)%360}function Ob(t){const e=kb.exec(t);let i,n=255;if(!e)return;e[5]!==i&&(n=e[6]?pb(+e[5]):mb(+e[5]));const o=Pb(+e[2]),s=+e[3]/100,r=+e[4]/100;return i="hwb"===e[1]?function(t,e,i){return Mb(Eb,t,e,i)}(o,s,r):"hsv"===e[1]?function(t,e,i){return Mb(Cb,t,e,i)}(o,s,r):Tb(o,s,r),{r:i[0],g:i[1],b:i[2],a:n}}const Db={x:"dark",Z:"light",Y:"re",X:"blu",W:"gr",V:"medium",U:"slate",A:"ee",T:"ol",S:"or",B:"ra",C:"lateg",D:"ights",R:"in",Q:"turquois",E:"hi",P:"ro",O:"al",N:"le",M:"de",L:"yello",F:"en",K:"ch",G:"arks",H:"ea",I:"ightg",J:"wh"},Ib={OiceXe:"f0f8ff",antiquewEte:"faebd7",aqua:"ffff",aquamarRe:"7fffd4",azuY:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"0",blanKedOmond:"ffebcd",Xe:"ff",XeviTet:"8a2be2",bPwn:"a52a2a",burlywood:"deb887",caMtXe:"5f9ea0",KartYuse:"7fff00",KocTate:"d2691e",cSO:"ff7f50",cSnflowerXe:"6495ed",cSnsilk:"fff8dc",crimson:"dc143c",cyan:"ffff",xXe:"8b",xcyan:"8b8b",xgTMnPd:"b8860b",xWay:"a9a9a9",xgYF:"6400",xgYy:"a9a9a9",xkhaki:"bdb76b",xmagFta:"8b008b",xTivegYF:"556b2f",xSange:"ff8c00",xScEd:"9932cc",xYd:"8b0000",xsOmon:"e9967a",xsHgYF:"8fbc8f",xUXe:"483d8b",xUWay:"2f4f4f",xUgYy:"2f4f4f",xQe:"ced1",xviTet:"9400d3",dAppRk:"ff1493",dApskyXe:"bfff",dimWay:"696969",dimgYy:"696969",dodgerXe:"1e90ff",fiYbrick:"b22222",flSOwEte:"fffaf0",foYstWAn:"228b22",fuKsia:"ff00ff",gaRsbSo:"dcdcdc",ghostwEte:"f8f8ff",gTd:"ffd700",gTMnPd:"daa520",Way:"808080",gYF:"8000",gYFLw:"adff2f",gYy:"808080",honeyMw:"f0fff0",hotpRk:"ff69b4",RdianYd:"cd5c5c",Rdigo:"4b0082",ivSy:"fffff0",khaki:"f0e68c",lavFMr:"e6e6fa",lavFMrXsh:"fff0f5",lawngYF:"7cfc00",NmoncEffon:"fffacd",ZXe:"add8e6",ZcSO:"f08080",Zcyan:"e0ffff",ZgTMnPdLw:"fafad2",ZWay:"d3d3d3",ZgYF:"90ee90",ZgYy:"d3d3d3",ZpRk:"ffb6c1",ZsOmon:"ffa07a",ZsHgYF:"20b2aa",ZskyXe:"87cefa",ZUWay:"778899",ZUgYy:"778899",ZstAlXe:"b0c4de",ZLw:"ffffe0",lime:"ff00",limegYF:"32cd32",lRF:"faf0e6",magFta:"ff00ff",maPon:"800000",VaquamarRe:"66cdaa",VXe:"cd",VScEd:"ba55d3",VpurpN:"9370db",VsHgYF:"3cb371",VUXe:"7b68ee",VsprRggYF:"fa9a",VQe:"48d1cc",VviTetYd:"c71585",midnightXe:"191970",mRtcYam:"f5fffa",mistyPse:"ffe4e1",moccasR:"ffe4b5",navajowEte:"ffdead",navy:"80",Tdlace:"fdf5e6",Tive:"808000",TivedBb:"6b8e23",Sange:"ffa500",SangeYd:"ff4500",ScEd:"da70d6",pOegTMnPd:"eee8aa",pOegYF:"98fb98",pOeQe:"afeeee",pOeviTetYd:"db7093",papayawEp:"ffefd5",pHKpuff:"ffdab9",peru:"cd853f",pRk:"ffc0cb",plum:"dda0dd",powMrXe:"b0e0e6",purpN:"800080",YbeccapurpN:"663399",Yd:"ff0000",Psybrown:"bc8f8f",PyOXe:"4169e1",saddNbPwn:"8b4513",sOmon:"fa8072",sandybPwn:"f4a460",sHgYF:"2e8b57",sHshell:"fff5ee",siFna:"a0522d",silver:"c0c0c0",skyXe:"87ceeb",UXe:"6a5acd",UWay:"708090",UgYy:"708090",snow:"fffafa",sprRggYF:"ff7f",stAlXe:"4682b4",tan:"d2b48c",teO:"8080",tEstN:"d8bfd8",tomato:"ff6347",Qe:"40e0d0",viTet:"ee82ee",JHt:"f5deb3",wEte:"ffffff",wEtesmoke:"f5f5f5",Lw:"ffff00",LwgYF:"9acd32"};let Lb;function $b(t){Lb||(Lb=function(){const t={},e=Object.keys(Ib),i=Object.keys(Db);let n,o,s,r,a;for(n=0;n<e.length;n++){for(r=a=e[n],o=0;o<i.length;o++)s=i[o],a=a.replace(s,Db[s]);s=parseInt(Ib[r],16),t[a]=[s>>16&255,s>>8&255,255&s]}return t}(),Lb.transparent=[0,0,0,0]);const e=Lb[t.toLowerCase()];return e&&{r:e[0],g:e[1],b:e[2],a:4===e.length?e[3]:255}}const zb=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;const Rb=t=>t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055,Nb=t=>t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4);function jb(t,e,i){if(t){let n=Ab(t);n[e]=Math.max(0,Math.min(n[e]+n[e]*i,0===e?360:1)),n=Tb(n),t.r=n[0],t.g=n[1],t.b=n[2]}}function Bb(t,e){return t?Object.assign(e||{},t):t}function Fb(t){var e={r:0,g:0,b:0,a:255};return Array.isArray(t)?t.length>=3&&(e={r:t[0],g:t[1],b:t[2],a:255},t.length>3&&(e.a=mb(t[3]))):(e=Bb(t,{r:0,g:0,b:0,a:1})).a=mb(e.a),e}function qb(t){return"r"===t.charAt(0)?function(t){const e=zb.exec(t);let i,n,o,s=255;if(e){if(e[7]!==i){const t=+e[7];s=e[8]?pb(t):ub(255*t,0,255)}return i=+e[1],n=+e[3],o=+e[5],i=255&(e[2]?pb(i):ub(i,0,255)),n=255&(e[4]?pb(n):ub(n,0,255)),o=255&(e[6]?pb(o):ub(o,0,255)),{r:i,g:n,b:o,a:s}}}(t):Ob(t)}class Vb{constructor(t){if(t instanceof Vb)return t;const e=typeof t;let i;var n,o,s;"object"===e?i=Fb(t):"string"===e&&(s=(n=t).length,"#"===n[0]&&(4===s||5===s?o={r:255&17*vb[n[1]],g:255&17*vb[n[2]],b:255&17*vb[n[3]],a:5===s?17*vb[n[4]]:255}:7!==s&&9!==s||(o={r:vb[n[1]]<<4|vb[n[2]],g:vb[n[3]]<<4|vb[n[4]],b:vb[n[5]]<<4|vb[n[6]],a:9===s?vb[n[7]]<<4|vb[n[8]]:255})),i=o||$b(t)||qb(t)),this._rgb=i,this._valid=!!i}get valid(){return this._valid}get rgb(){var t=Bb(this._rgb);return t&&(t.a=fb(t.a)),t}set rgb(t){this._rgb=Fb(t)}rgbString(){return this._valid?function(t){return t&&(t.a<255?`rgba(${t.r}, ${t.g}, ${t.b}, ${fb(t.a)})`:`rgb(${t.r}, ${t.g}, ${t.b})`)}(this._rgb):void 0}hexString(){return this._valid?wb(this._rgb):void 0}hslString(){return this._valid?function(t){if(!t)return;const e=Ab(t),i=e[0],n=gb(e[1]),o=gb(e[2]);return t.a<255?`hsla(${i}, ${n}%, ${o}%, ${fb(t.a)})`:`hsl(${i}, ${n}%, ${o}%)`}(this._rgb):void 0}mix(t,e){if(t){const i=this.rgb,n=t.rgb;let o;const s=e===o?.5:e,r=2*s-1,a=i.a-n.a,l=((r*a==-1?r:(r+a)/(1+r*a))+1)/2;o=1-l,i.r=255&l*i.r+o*n.r+.5,i.g=255&l*i.g+o*n.g+.5,i.b=255&l*i.b+o*n.b+.5,i.a=s*i.a+(1-s)*n.a,this.rgb=i}return this}interpolate(t,e){return t&&(this._rgb=function(t,e,i){const n=Nb(fb(t.r)),o=Nb(fb(t.g)),s=Nb(fb(t.b));return{r:mb(Rb(n+i*(Nb(fb(e.r))-n))),g:mb(Rb(o+i*(Nb(fb(e.g))-o))),b:mb(Rb(s+i*(Nb(fb(e.b))-s))),a:t.a+i*(e.a-t.a)}}(this._rgb,t._rgb,e)),this}clone(){return new Vb(this.rgb)}alpha(t){return this._rgb.a=mb(t),this}clearer(t){return this._rgb.a*=1-t,this}greyscale(){const t=this._rgb,e=db(.3*t.r+.59*t.g+.11*t.b);return t.r=t.g=t.b=e,this}opaquer(t){return this._rgb.a*=1+t,this}negate(){const t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return jb(this._rgb,2,t),this}darken(t){return jb(this._rgb,2,-t),this}saturate(t){return jb(this._rgb,1,t),this}desaturate(t){return jb(this._rgb,1,-t),this}rotate(t){return function(t,e){var i=Ab(t);i[0]=Pb(i[0]+e),i=Tb(i),t.r=i[0],t.g=i[1],t.b=i[2]}(this._rgb,t),this}}
8525
8512
  /*!
8526
8513
  * Chart.js v4.4.8
8527
8514
  * https://www.chartjs.org
8528
8515
  * (c) 2025 Chart.js Contributors
8529
8516
  * Released under the MIT License
8530
- */function Ub(){}const Wb=(()=>{let t=0;return()=>t++})();function Gb(t){return null==t}function Zb(t){if(Array.isArray&&Array.isArray(t))return!0;const e=Object.prototype.toString.call(t);return"[object"===e.slice(0,7)&&"Array]"===e.slice(-6)}function Yb(t){return null!==t&&"[object Object]"===Object.prototype.toString.call(t)}function Xb(t){return("number"==typeof t||t instanceof Number)&&isFinite(+t)}function Kb(t,e){return Xb(t)?t:e}function Qb(t,e){return void 0===t?e:t}const Jb=(t,e)=>"string"==typeof t&&t.endsWith("%")?parseFloat(t)/100*e:+t;function t_(t,e,i){if(t&&"function"==typeof t.call)return t.apply(i,e)}function e_(t,e,i,n){let o,s,r;if(Zb(t))for(s=t.length,o=0;o<s;o++)e.call(i,t[o],o);else if(Yb(t))for(r=Object.keys(t),s=r.length,o=0;o<s;o++)e.call(i,t[r[o]],r[o])}function i_(t,e){let i,n,o,s;if(!t||!e||t.length!==e.length)return!1;for(i=0,n=t.length;i<n;++i)if(o=t[i],s=e[i],o.datasetIndex!==s.datasetIndex||o.index!==s.index)return!1;return!0}function n_(t){if(Zb(t))return t.map(n_);if(Yb(t)){const e=Object.create(null),i=Object.keys(t),n=i.length;let o=0;for(;o<n;++o)e[i[o]]=n_(t[i[o]]);return e}return t}function o_(t){return-1===["__proto__","prototype","constructor"].indexOf(t)}function s_(t,e,i,n){if(!o_(t))return;const o=e[t],s=i[t];Yb(o)&&Yb(s)?r_(o,s,n):e[t]=n_(s)}function r_(t,e,i){const n=Zb(e)?e:[e],o=n.length;if(!Yb(t))return t;const s=(i=i||{}).merger||s_;let r;for(let e=0;e<o;++e){if(r=n[e],!Yb(r))continue;const o=Object.keys(r);for(let e=0,n=o.length;e<n;++e)s(o[e],t,r,i)}return t}function a_(t,e){return r_(t,e,{merger:l_})}function l_(t,e,i){if(!o_(t))return;const n=e[t],o=i[t];Yb(n)&&Yb(o)?a_(n,o):Object.prototype.hasOwnProperty.call(e,t)||(e[t]=n_(o))}const c_={"":t=>t,x:t=>t.x,y:t=>t.y};function h_(t,e){const i=c_[e]||(c_[e]=function(t){const e=function(t){const e=t.split("."),i=[];let n="";for(const t of e)n+=t,n.endsWith("\\")?n=n.slice(0,-1)+".":(i.push(n),n="");return i}(t);return t=>{for(const i of e){if(""===i)break;t=t&&t[i]}return t}}(e));return i(t)}function d_(t){return t.charAt(0).toUpperCase()+t.slice(1)}const u_=t=>void 0!==t,p_=t=>"function"==typeof t,m_=(t,e)=>{if(t.size!==e.size)return!1;for(const i of t)if(!e.has(i))return!1;return!0};const f_=Math.PI,g_=2*f_,v_=g_+f_,y_=Number.POSITIVE_INFINITY,b_=f_/180,__=f_/2,x_=f_/4,w_=2*f_/3,k_=Math.log10,S_=Math.sign;function C_(t,e,i){return Math.abs(t-e)<i}function E_(t){const e=Math.round(t);t=C_(t,e,t/1e3)?e:t;const i=Math.pow(10,Math.floor(k_(t))),n=t/i;return(n<=1?1:n<=2?2:n<=5?5:10)*i}function A_(t){return!function(t){return"symbol"==typeof t||"object"==typeof t&&null!==t&&!(Symbol.toPrimitive in t||"toString"in t||"valueOf"in t)}(t)&&!isNaN(parseFloat(t))&&isFinite(t)}function M_(t,e,i){let n,o,s;for(n=0,o=t.length;n<o;n++)s=t[n][i],isNaN(s)||(e.min=Math.min(e.min,s),e.max=Math.max(e.max,s))}function T_(t){return t*(f_/180)}function P_(t){return t*(180/f_)}function O_(t){if(!Xb(t))return;let e=1,i=0;for(;Math.round(t*e)/e!==t;)e*=10,i++;return i}function D_(t,e){const i=e.x-t.x,n=e.y-t.y,o=Math.sqrt(i*i+n*n);let s=Math.atan2(n,i);return s<-.5*f_&&(s+=g_),{angle:s,distance:o}}function I_(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function L_(t,e){return(t-e+v_)%g_-f_}function $_(t){return(t%g_+g_)%g_}function z_(t,e,i,n){const o=$_(t),s=$_(e),r=$_(i),a=$_(s-o),l=$_(r-o),c=$_(o-s),h=$_(o-r);return o===s||o===r||n&&s===r||a>l&&c<h}function R_(t,e,i){return Math.max(e,Math.min(i,t))}function N_(t,e,i,n=1e-6){return t>=Math.min(e,i)-n&&t<=Math.max(e,i)+n}function j_(t,e,i){i=i||(i=>t[i]<e);let n,o=t.length-1,s=0;for(;o-s>1;)n=s+o>>1,i(n)?s=n:o=n;return{lo:s,hi:o}}const B_=(t,e,i,n)=>j_(t,i,n?n=>{const o=t[n][e];return o<i||o===i&&t[n+1][e]===i}:n=>t[n][e]<i),F_=(t,e,i)=>j_(t,i,(n=>t[n][e]>=i));const q_=["push","pop","shift","splice","unshift"];function V_(t,e){const i=t._chartjs;if(!i)return;const n=i.listeners,o=n.indexOf(e);-1!==o&&n.splice(o,1),n.length>0||(q_.forEach((e=>{delete t[e]})),delete t._chartjs)}function H_(t){const e=new Set(t);return e.size===t.length?t:Array.from(e)}const U_="undefined"==typeof window?function(t){return t()}:window.requestAnimationFrame;function W_(t,e){let i=[],n=!1;return function(...o){i=o,n||(n=!0,U_.call(window,(()=>{n=!1,t.apply(e,i)})))}}const G_=t=>"start"===t?"left":"end"===t?"right":"center",Z_=(t,e,i)=>"start"===t?e:"end"===t?i:(e+i)/2;function Y_(t,e,i){const n=e.length;let o=0,s=n;if(t._sorted){const{iScale:r,vScale:a,_parsed:l}=t,c=t.dataset&&t.dataset.options?t.dataset.options.spanGaps:null,h=r.axis,{min:d,max:u,minDefined:p,maxDefined:m}=r.getUserBounds();if(p){if(o=Math.min(B_(l,h,d).lo,i?n:B_(e,h,r.getPixelForValue(d)).lo),c){const t=l.slice(0,o+1).reverse().findIndex((t=>!Gb(t[a.axis])));o-=Math.max(0,t)}o=R_(o,0,n-1)}if(m){let t=Math.max(B_(l,r.axis,u,!0).hi+1,i?0:B_(e,h,r.getPixelForValue(u),!0).hi+1);if(c){const e=l.slice(t-1).findIndex((t=>!Gb(t[a.axis])));t+=Math.max(0,e)}s=R_(t,o,n)-o}else s=n-o}return{start:o,count:s}}function X_(t){const{xScale:e,yScale:i,_scaleRanges:n}=t,o={xmin:e.min,xmax:e.max,ymin:i.min,ymax:i.max};if(!n)return t._scaleRanges=o,!0;const s=n.xmin!==e.min||n.xmax!==e.max||n.ymin!==i.min||n.ymax!==i.max;return Object.assign(n,o),s}const K_=t=>0===t||1===t,Q_=(t,e,i)=>-Math.pow(2,10*(t-=1))*Math.sin((t-e)*g_/i),J_=(t,e,i)=>Math.pow(2,-10*t)*Math.sin((t-e)*g_/i)+1,tx={linear:t=>t,easeInQuad:t=>t*t,easeOutQuad:t=>-t*(t-2),easeInOutQuad:t=>(t/=.5)<1?.5*t*t:-.5*(--t*(t-2)-1),easeInCubic:t=>t*t*t,easeOutCubic:t=>(t-=1)*t*t+1,easeInOutCubic:t=>(t/=.5)<1?.5*t*t*t:.5*((t-=2)*t*t+2),easeInQuart:t=>t*t*t*t,easeOutQuart:t=>-((t-=1)*t*t*t-1),easeInOutQuart:t=>(t/=.5)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2),easeInQuint:t=>t*t*t*t*t,easeOutQuint:t=>(t-=1)*t*t*t*t+1,easeInOutQuint:t=>(t/=.5)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2),easeInSine:t=>1-Math.cos(t*__),easeOutSine:t=>Math.sin(t*__),easeInOutSine:t=>-.5*(Math.cos(f_*t)-1),easeInExpo:t=>0===t?0:Math.pow(2,10*(t-1)),easeOutExpo:t=>1===t?1:1-Math.pow(2,-10*t),easeInOutExpo:t=>K_(t)?t:t<.5?.5*Math.pow(2,10*(2*t-1)):.5*(2-Math.pow(2,-10*(2*t-1))),easeInCirc:t=>t>=1?t:-(Math.sqrt(1-t*t)-1),easeOutCirc:t=>Math.sqrt(1-(t-=1)*t),easeInOutCirc:t=>(t/=.5)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1),easeInElastic:t=>K_(t)?t:Q_(t,.075,.3),easeOutElastic:t=>K_(t)?t:J_(t,.075,.3),easeInOutElastic(t){const e=.1125;return K_(t)?t:t<.5?.5*Q_(2*t,e,.45):.5+.5*J_(2*t-1,e,.45)},easeInBack(t){const e=1.70158;return t*t*((e+1)*t-e)},easeOutBack(t){const e=1.70158;return(t-=1)*t*((e+1)*t+e)+1},easeInOutBack(t){let e=1.70158;return(t/=.5)<1?t*t*((1+(e*=1.525))*t-e)*.5:.5*((t-=2)*t*((1+(e*=1.525))*t+e)+2)},easeInBounce:t=>1-tx.easeOutBounce(1-t),easeOutBounce(t){const e=7.5625,i=2.75;return t<1/i?e*t*t:t<2/i?e*(t-=1.5/i)*t+.75:t<2.5/i?e*(t-=2.25/i)*t+.9375:e*(t-=2.625/i)*t+.984375},easeInOutBounce:t=>t<.5?.5*tx.easeInBounce(2*t):.5*tx.easeOutBounce(2*t-1)+.5};function ex(t){if(t&&"object"==typeof t){const e=t.toString();return"[object CanvasPattern]"===e||"[object CanvasGradient]"===e}return!1}function ix(t){return ex(t)?t:new Hb(t)}function nx(t){return ex(t)?t:new Hb(t).saturate(.5).darken(.1).hexString()}const ox=["x","y","borderWidth","radius","tension"],sx=["color","borderColor","backgroundColor"];const rx=new Map;function ax(t,e,i){return function(t,e){e=e||{};const i=t+JSON.stringify(e);let n=rx.get(i);return n||(n=new Intl.NumberFormat(t,e),rx.set(i,n)),n}(e,i).format(t)}const lx={values:t=>Zb(t)?t:""+t,numeric(t,e,i){if(0===t)return"0";const n=this.chart.options.locale;let o,s=t;if(i.length>1){const e=Math.max(Math.abs(i[0].value),Math.abs(i[i.length-1].value));(e<1e-4||e>1e15)&&(o="scientific"),s=function(t,e){let i=e.length>3?e[2].value-e[1].value:e[1].value-e[0].value;Math.abs(i)>=1&&t!==Math.floor(t)&&(i=t-Math.floor(t));return i}(t,i)}const r=k_(Math.abs(s)),a=isNaN(r)?1:Math.max(Math.min(-1*Math.floor(r),20),0),l={notation:o,minimumFractionDigits:a,maximumFractionDigits:a};return Object.assign(l,this.options.ticks.format),ax(t,n,l)},logarithmic(t,e,i){if(0===t)return"0";const n=i[e].significand||t/Math.pow(10,Math.floor(k_(t)));return[1,2,3,5,10,15].includes(n)||e>.8*i.length?lx.numeric.call(this,t,e,i):""}};var cx={formatters:lx};const hx=Object.create(null),dx=Object.create(null);function ux(t,e){if(!e)return t;const i=e.split(".");for(let e=0,n=i.length;e<n;++e){const n=i[e];t=t[n]||(t[n]=Object.create(null))}return t}function px(t,e,i){return"string"==typeof e?r_(ux(t,e),i):r_(ux(t,""),e)}class mx{constructor(t,e){this.animation=void 0,this.backgroundColor="rgba(0,0,0,0.1)",this.borderColor="rgba(0,0,0,0.1)",this.color="#666",this.datasets={},this.devicePixelRatio=t=>t.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(t,e)=>nx(e.backgroundColor),this.hoverBorderColor=(t,e)=>nx(e.borderColor),this.hoverColor=(t,e)=>nx(e.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t),this.apply(e)}set(t,e){return px(this,t,e)}get(t){return ux(this,t)}describe(t,e){return px(dx,t,e)}override(t,e){return px(hx,t,e)}route(t,e,i,n){const o=ux(this,t),s=ux(this,i),r="_"+e;Object.defineProperties(o,{[r]:{value:o[e],writable:!0},[e]:{enumerable:!0,get(){const t=this[r],e=s[n];return Yb(t)?Object.assign({},e,t):Qb(t,e)},set(t){this[r]=t}}})}apply(t){t.forEach((t=>t(this)))}}var fx=new mx({_scriptable:t=>!t.startsWith("on"),_indexable:t=>"events"!==t,hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[function(t){t.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),t.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>"onProgress"!==t&&"onComplete"!==t&&"fn"!==t}),t.set("animations",{colors:{type:"color",properties:sx},numbers:{type:"number",properties:ox}}),t.describe("animations",{_fallback:"animation"}),t.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>0|t}}}})},function(t){t.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})},function(t){t.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(t,e)=>e.lineWidth,tickColor:(t,e)=>e.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:cx.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),t.route("scale.ticks","color","","color"),t.route("scale.grid","color","","borderColor"),t.route("scale.border","color","","borderColor"),t.route("scale.title","color","","color"),t.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&"callback"!==t&&"parser"!==t,_indexable:t=>"borderDash"!==t&&"tickBorderDash"!==t&&"dash"!==t}),t.describe("scales",{_fallback:"scale"}),t.describe("scale.ticks",{_scriptable:t=>"backdropPadding"!==t&&"callback"!==t,_indexable:t=>"backdropPadding"!==t})}]);function gx(t,e,i,n,o){let s=e[o];return s||(s=e[o]=t.measureText(o).width,i.push(o)),s>n&&(n=s),n}function vx(t,e,i,n){let o=(n=n||{}).data=n.data||{},s=n.garbageCollect=n.garbageCollect||[];n.font!==e&&(o=n.data={},s=n.garbageCollect=[],n.font=e),t.save(),t.font=e;let r=0;const a=i.length;let l,c,h,d,u;for(l=0;l<a;l++)if(d=i[l],null==d||Zb(d)){if(Zb(d))for(c=0,h=d.length;c<h;c++)u=d[c],null==u||Zb(u)||(r=gx(t,o,s,r,u))}else r=gx(t,o,s,r,d);t.restore();const p=s.length/2;if(p>i.length){for(l=0;l<p;l++)delete o[s[l]];s.splice(0,p)}return r}function yx(t,e,i){const n=t.currentDevicePixelRatio,o=0!==i?Math.max(i/2,.5):0;return Math.round((e-o)*n)/n+o}function bx(t,e){(e||t)&&((e=e||t.getContext("2d")).save(),e.resetTransform(),e.clearRect(0,0,t.width,t.height),e.restore())}function _x(t,e,i,n){xx(t,e,i,n,null)}function xx(t,e,i,n,o){let s,r,a,l,c,h,d,u;const p=e.pointStyle,m=e.rotation,f=e.radius;let g=(m||0)*b_;if(p&&"object"==typeof p&&(s=p.toString(),"[object HTMLImageElement]"===s||"[object HTMLCanvasElement]"===s))return t.save(),t.translate(i,n),t.rotate(g),t.drawImage(p,-p.width/2,-p.height/2,p.width,p.height),void t.restore();if(!(isNaN(f)||f<=0)){switch(t.beginPath(),p){default:o?t.ellipse(i,n,o/2,f,0,0,g_):t.arc(i,n,f,0,g_),t.closePath();break;case"triangle":h=o?o/2:f,t.moveTo(i+Math.sin(g)*h,n-Math.cos(g)*f),g+=w_,t.lineTo(i+Math.sin(g)*h,n-Math.cos(g)*f),g+=w_,t.lineTo(i+Math.sin(g)*h,n-Math.cos(g)*f),t.closePath();break;case"rectRounded":c=.516*f,l=f-c,r=Math.cos(g+x_)*l,d=Math.cos(g+x_)*(o?o/2-c:l),a=Math.sin(g+x_)*l,u=Math.sin(g+x_)*(o?o/2-c:l),t.arc(i-d,n-a,c,g-f_,g-__),t.arc(i+u,n-r,c,g-__,g),t.arc(i+d,n+a,c,g,g+__),t.arc(i-u,n+r,c,g+__,g+f_),t.closePath();break;case"rect":if(!m){l=Math.SQRT1_2*f,h=o?o/2:l,t.rect(i-h,n-l,2*h,2*l);break}g+=x_;case"rectRot":d=Math.cos(g)*(o?o/2:f),r=Math.cos(g)*f,a=Math.sin(g)*f,u=Math.sin(g)*(o?o/2:f),t.moveTo(i-d,n-a),t.lineTo(i+u,n-r),t.lineTo(i+d,n+a),t.lineTo(i-u,n+r),t.closePath();break;case"crossRot":g+=x_;case"cross":d=Math.cos(g)*(o?o/2:f),r=Math.cos(g)*f,a=Math.sin(g)*f,u=Math.sin(g)*(o?o/2:f),t.moveTo(i-d,n-a),t.lineTo(i+d,n+a),t.moveTo(i+u,n-r),t.lineTo(i-u,n+r);break;case"star":d=Math.cos(g)*(o?o/2:f),r=Math.cos(g)*f,a=Math.sin(g)*f,u=Math.sin(g)*(o?o/2:f),t.moveTo(i-d,n-a),t.lineTo(i+d,n+a),t.moveTo(i+u,n-r),t.lineTo(i-u,n+r),g+=x_,d=Math.cos(g)*(o?o/2:f),r=Math.cos(g)*f,a=Math.sin(g)*f,u=Math.sin(g)*(o?o/2:f),t.moveTo(i-d,n-a),t.lineTo(i+d,n+a),t.moveTo(i+u,n-r),t.lineTo(i-u,n+r);break;case"line":r=o?o/2:Math.cos(g)*f,a=Math.sin(g)*f,t.moveTo(i-r,n-a),t.lineTo(i+r,n+a);break;case"dash":t.moveTo(i,n),t.lineTo(i+Math.cos(g)*(o?o/2:f),n+Math.sin(g)*f);break;case!1:t.closePath()}t.fill(),e.borderWidth>0&&t.stroke()}}function wx(t,e,i){return i=i||.5,!e||t&&t.x>e.left-i&&t.x<e.right+i&&t.y>e.top-i&&t.y<e.bottom+i}function kx(t,e){t.save(),t.beginPath(),t.rect(e.left,e.top,e.right-e.left,e.bottom-e.top),t.clip()}function Sx(t){t.restore()}function Cx(t,e,i,n,o){if(!e)return t.lineTo(i.x,i.y);if("middle"===o){const n=(e.x+i.x)/2;t.lineTo(n,e.y),t.lineTo(n,i.y)}else"after"===o!=!!n?t.lineTo(e.x,i.y):t.lineTo(i.x,e.y);t.lineTo(i.x,i.y)}function Ex(t,e,i,n){if(!e)return t.lineTo(i.x,i.y);t.bezierCurveTo(n?e.cp1x:e.cp2x,n?e.cp1y:e.cp2y,n?i.cp2x:i.cp1x,n?i.cp2y:i.cp1y,i.x,i.y)}function Ax(t,e,i,n,o){if(o.strikethrough||o.underline){const s=t.measureText(n),r=e-s.actualBoundingBoxLeft,a=e+s.actualBoundingBoxRight,l=i-s.actualBoundingBoxAscent,c=i+s.actualBoundingBoxDescent,h=o.strikethrough?(l+c)/2:c;t.strokeStyle=t.fillStyle,t.beginPath(),t.lineWidth=o.decorationWidth||2,t.moveTo(r,h),t.lineTo(a,h),t.stroke()}}function Mx(t,e){const i=t.fillStyle;t.fillStyle=e.color,t.fillRect(e.left,e.top,e.width,e.height),t.fillStyle=i}function Tx(t,e,i,n,o,s={}){const r=Zb(e)?e:[e],a=s.strokeWidth>0&&""!==s.strokeColor;let l,c;for(t.save(),t.font=o.string,function(t,e){e.translation&&t.translate(e.translation[0],e.translation[1]),Gb(e.rotation)||t.rotate(e.rotation),e.color&&(t.fillStyle=e.color),e.textAlign&&(t.textAlign=e.textAlign),e.textBaseline&&(t.textBaseline=e.textBaseline)}(t,s),l=0;l<r.length;++l)c=r[l],s.backdrop&&Mx(t,s.backdrop),a&&(s.strokeColor&&(t.strokeStyle=s.strokeColor),Gb(s.strokeWidth)||(t.lineWidth=s.strokeWidth),t.strokeText(c,i,n,s.maxWidth)),t.fillText(c,i,n,s.maxWidth),Ax(t,i,n,c,s),n+=Number(o.lineHeight);t.restore()}function Px(t,e){const{x:i,y:n,w:o,h:s,radius:r}=e;t.arc(i+r.topLeft,n+r.topLeft,r.topLeft,1.5*f_,f_,!0),t.lineTo(i,n+s-r.bottomLeft),t.arc(i+r.bottomLeft,n+s-r.bottomLeft,r.bottomLeft,f_,__,!0),t.lineTo(i+o-r.bottomRight,n+s),t.arc(i+o-r.bottomRight,n+s-r.bottomRight,r.bottomRight,__,0,!0),t.lineTo(i+o,n+r.topRight),t.arc(i+o-r.topRight,n+r.topRight,r.topRight,0,-__,!0),t.lineTo(i+r.topLeft,n)}const Ox=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,Dx=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function Ix(t,e){const i=(""+t).match(Ox);if(!i||"normal"===i[1])return 1.2*e;switch(t=+i[2],i[3]){case"px":return t;case"%":t/=100}return e*t}const Lx=t=>+t||0;function $x(t,e){const i={},n=Yb(e),o=n?Object.keys(e):e,s=Yb(t)?n?i=>Qb(t[i],t[e[i]]):e=>t[e]:()=>t;for(const t of o)i[t]=Lx(s(t));return i}function zx(t){return $x(t,{top:"y",right:"x",bottom:"y",left:"x"})}function Rx(t){return $x(t,["topLeft","topRight","bottomLeft","bottomRight"])}function Nx(t){const e=zx(t);return e.width=e.left+e.right,e.height=e.top+e.bottom,e}function jx(t,e){t=t||{},e=e||fx.font;let i=Qb(t.size,e.size);"string"==typeof i&&(i=parseInt(i,10));let n=Qb(t.style,e.style);n&&!(""+n).match(Dx)&&(console.warn('Invalid font style specified: "'+n+'"'),n=void 0);const o={family:Qb(t.family,e.family),lineHeight:Ix(Qb(t.lineHeight,e.lineHeight),i),size:i,style:n,weight:Qb(t.weight,e.weight),string:""};return o.string=function(t){return!t||Gb(t.size)||Gb(t.family)?null:(t.style?t.style+" ":"")+(t.weight?t.weight+" ":"")+t.size+"px "+t.family}(o),o}function Bx(t,e,i,n){let o,s,r;for(o=0,s=t.length;o<s;++o)if(r=t[o],void 0!==r&&void 0!==r)return r}function Fx(t,e){return Object.assign(Object.create(t),e)}function qx(t,e=[""],i,n,o=(()=>t[0])){const s=i||t;void 0===n&&(n=Jx("_fallback",t));const r={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:t,_rootScopes:s,_fallback:n,_getTarget:o,override:i=>qx([i,...t],e,s,n)};return new Proxy(r,{deleteProperty:(e,i)=>(delete e[i],delete e._keys,delete t[0][i],!0),get:(i,n)=>Gx(i,n,(()=>function(t,e,i,n){let o;for(const s of e)if(o=Jx(Ux(s,t),i),void 0!==o)return Wx(t,o)?Kx(i,n,t,o):o}(n,e,t,i))),getOwnPropertyDescriptor:(t,e)=>Reflect.getOwnPropertyDescriptor(t._scopes[0],e),getPrototypeOf:()=>Reflect.getPrototypeOf(t[0]),has:(t,e)=>tw(t).includes(e),ownKeys:t=>tw(t),set(t,e,i){const n=t._storage||(t._storage=o());return t[e]=n[e]=i,delete t._keys,!0}})}function Vx(t,e,i,n){const o={_cacheable:!1,_proxy:t,_context:e,_subProxy:i,_stack:new Set,_descriptors:Hx(t,n),setContext:e=>Vx(t,e,i,n),override:o=>Vx(t.override(o),e,i,n)};return new Proxy(o,{deleteProperty:(e,i)=>(delete e[i],delete t[i],!0),get:(t,e,i)=>Gx(t,e,(()=>function(t,e,i){const{_proxy:n,_context:o,_subProxy:s,_descriptors:r}=t;let a=n[e];p_(a)&&r.isScriptable(e)&&(a=function(t,e,i,n){const{_proxy:o,_context:s,_subProxy:r,_stack:a}=i;if(a.has(t))throw new Error("Recursion detected: "+Array.from(a).join("->")+"->"+t);a.add(t);let l=e(s,r||n);a.delete(t),Wx(t,l)&&(l=Kx(o._scopes,o,t,l));return l}(e,a,t,i));Zb(a)&&a.length&&(a=function(t,e,i,n){const{_proxy:o,_context:s,_subProxy:r,_descriptors:a}=i;if(void 0!==s.index&&n(t))return e[s.index%e.length];if(Yb(e[0])){const i=e,n=o._scopes.filter((t=>t!==i));e=[];for(const l of i){const i=Kx(n,o,t,l);e.push(Vx(i,s,r&&r[t],a))}}return e}(e,a,t,r.isIndexable));Wx(e,a)&&(a=Vx(a,o,s&&s[e],r));return a}(t,e,i))),getOwnPropertyDescriptor:(e,i)=>e._descriptors.allKeys?Reflect.has(t,i)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(t,i),getPrototypeOf:()=>Reflect.getPrototypeOf(t),has:(e,i)=>Reflect.has(t,i),ownKeys:()=>Reflect.ownKeys(t),set:(e,i,n)=>(t[i]=n,delete e[i],!0)})}function Hx(t,e={scriptable:!0,indexable:!0}){const{_scriptable:i=e.scriptable,_indexable:n=e.indexable,_allKeys:o=e.allKeys}=t;return{allKeys:o,scriptable:i,indexable:n,isScriptable:p_(i)?i:()=>i,isIndexable:p_(n)?n:()=>n}}const Ux=(t,e)=>t?t+d_(e):e,Wx=(t,e)=>Yb(e)&&"adapters"!==t&&(null===Object.getPrototypeOf(e)||e.constructor===Object);function Gx(t,e,i){if(Object.prototype.hasOwnProperty.call(t,e)||"constructor"===e)return t[e];const n=i();return t[e]=n,n}function Zx(t,e,i){return p_(t)?t(e,i):t}const Yx=(t,e)=>!0===t?e:"string"==typeof t?h_(e,t):void 0;function Xx(t,e,i,n,o){for(const s of e){const e=Yx(i,s);if(e){t.add(e);const s=Zx(e._fallback,i,o);if(void 0!==s&&s!==i&&s!==n)return s}else if(!1===e&&void 0!==n&&i!==n)return null}return!1}function Kx(t,e,i,n){const o=e._rootScopes,s=Zx(e._fallback,i,n),r=[...t,...o],a=new Set;a.add(n);let l=Qx(a,r,i,s||i,n);return null!==l&&((void 0===s||s===i||(l=Qx(a,r,s,l,n),null!==l))&&qx(Array.from(a),[""],o,s,(()=>function(t,e,i){const n=t._getTarget();e in n||(n[e]={});const o=n[e];if(Zb(o)&&Yb(i))return i;return o||{}}(e,i,n))))}function Qx(t,e,i,n,o){for(;i;)i=Xx(t,e,i,n,o);return i}function Jx(t,e){for(const i of e){if(!i)continue;const e=i[t];if(void 0!==e)return e}}function tw(t){let e=t._keys;return e||(e=t._keys=function(t){const e=new Set;for(const i of t)for(const t of Object.keys(i).filter((t=>!t.startsWith("_"))))e.add(t);return Array.from(e)}(t._scopes)),e}function ew(t,e,i,n){const{iScale:o}=t,{key:s="r"}=this._parsing,r=new Array(n);let a,l,c,h;for(a=0,l=n;a<l;++a)c=a+i,h=e[c],r[a]={r:o.parse(h_(h,s),c)};return r}const iw=Number.EPSILON||1e-14,nw=(t,e)=>e<t.length&&!t[e].skip&&t[e],ow=t=>"x"===t?"y":"x";function sw(t,e,i,n){const o=t.skip?e:t,s=e,r=i.skip?e:i,a=I_(s,o),l=I_(r,s);let c=a/(a+l),h=l/(a+l);c=isNaN(c)?0:c,h=isNaN(h)?0:h;const d=n*c,u=n*h;return{previous:{x:s.x-d*(r.x-o.x),y:s.y-d*(r.y-o.y)},next:{x:s.x+u*(r.x-o.x),y:s.y+u*(r.y-o.y)}}}function rw(t,e="x"){const i=ow(e),n=t.length,o=Array(n).fill(0),s=Array(n);let r,a,l,c=nw(t,0);for(r=0;r<n;++r)if(a=l,l=c,c=nw(t,r+1),l){if(c){const t=c[e]-l[e];o[r]=0!==t?(c[i]-l[i])/t:0}s[r]=a?c?S_(o[r-1])!==S_(o[r])?0:(o[r-1]+o[r])/2:o[r-1]:o[r]}!function(t,e,i){const n=t.length;let o,s,r,a,l,c=nw(t,0);for(let h=0;h<n-1;++h)l=c,c=nw(t,h+1),l&&c&&(C_(e[h],0,iw)?i[h]=i[h+1]=0:(o=i[h]/e[h],s=i[h+1]/e[h],a=Math.pow(o,2)+Math.pow(s,2),a<=9||(r=3/Math.sqrt(a),i[h]=o*r*e[h],i[h+1]=s*r*e[h])))}(t,o,s),function(t,e,i="x"){const n=ow(i),o=t.length;let s,r,a,l=nw(t,0);for(let c=0;c<o;++c){if(r=a,a=l,l=nw(t,c+1),!a)continue;const o=a[i],h=a[n];r&&(s=(o-r[i])/3,a[`cp1${i}`]=o-s,a[`cp1${n}`]=h-s*e[c]),l&&(s=(l[i]-o)/3,a[`cp2${i}`]=o+s,a[`cp2${n}`]=h+s*e[c])}}(t,s,e)}function aw(t,e,i){return Math.max(Math.min(t,i),e)}function lw(t,e,i,n,o){let s,r,a,l;if(e.spanGaps&&(t=t.filter((t=>!t.skip))),"monotone"===e.cubicInterpolationMode)rw(t,o);else{let i=n?t[t.length-1]:t[0];for(s=0,r=t.length;s<r;++s)a=t[s],l=sw(i,a,t[Math.min(s+1,r-(n?0:1))%r],e.tension),a.cp1x=l.previous.x,a.cp1y=l.previous.y,a.cp2x=l.next.x,a.cp2y=l.next.y,i=a}e.capBezierPoints&&function(t,e){let i,n,o,s,r,a=wx(t[0],e);for(i=0,n=t.length;i<n;++i)r=s,s=a,a=i<n-1&&wx(t[i+1],e),s&&(o=t[i],r&&(o.cp1x=aw(o.cp1x,e.left,e.right),o.cp1y=aw(o.cp1y,e.top,e.bottom)),a&&(o.cp2x=aw(o.cp2x,e.left,e.right),o.cp2y=aw(o.cp2y,e.top,e.bottom)))}(t,i)}function cw(){return"undefined"!=typeof window&&"undefined"!=typeof document}function hw(t){let e=t.parentNode;return e&&"[object ShadowRoot]"===e.toString()&&(e=e.host),e}function dw(t,e,i){let n;return"string"==typeof t?(n=parseInt(t,10),-1!==t.indexOf("%")&&(n=n/100*e.parentNode[i])):n=t,n}const uw=t=>t.ownerDocument.defaultView.getComputedStyle(t,null);const pw=["top","right","bottom","left"];function mw(t,e,i){const n={};i=i?"-"+i:"";for(let o=0;o<4;o++){const s=pw[o];n[s]=parseFloat(t[e+"-"+s+i])||0}return n.width=n.left+n.right,n.height=n.top+n.bottom,n}const fw=(t,e,i)=>(t>0||e>0)&&(!i||!i.shadowRoot);function gw(t,e){if("native"in t)return t;const{canvas:i,currentDevicePixelRatio:n}=e,o=uw(i),s="border-box"===o.boxSizing,r=mw(o,"padding"),a=mw(o,"border","width"),{x:l,y:c,box:h}=function(t,e){const i=t.touches,n=i&&i.length?i[0]:t,{offsetX:o,offsetY:s}=n;let r,a,l=!1;if(fw(o,s,t.target))r=o,a=s;else{const t=e.getBoundingClientRect();r=n.clientX-t.left,a=n.clientY-t.top,l=!0}return{x:r,y:a,box:l}}(t,i),d=r.left+(h&&a.left),u=r.top+(h&&a.top);let{width:p,height:m}=e;return s&&(p-=r.width+a.width,m-=r.height+a.height),{x:Math.round((l-d)/p*i.width/n),y:Math.round((c-u)/m*i.height/n)}}const vw=t=>Math.round(10*t)/10;function yw(t,e,i,n){const o=uw(t),s=mw(o,"margin"),r=dw(o.maxWidth,t,"clientWidth")||y_,a=dw(o.maxHeight,t,"clientHeight")||y_,l=function(t,e,i){let n,o;if(void 0===e||void 0===i){const s=t&&hw(t);if(s){const t=s.getBoundingClientRect(),r=uw(s),a=mw(r,"border","width"),l=mw(r,"padding");e=t.width-l.width-a.width,i=t.height-l.height-a.height,n=dw(r.maxWidth,s,"clientWidth"),o=dw(r.maxHeight,s,"clientHeight")}else e=t.clientWidth,i=t.clientHeight}return{width:e,height:i,maxWidth:n||y_,maxHeight:o||y_}}(t,e,i);let{width:c,height:h}=l;if("content-box"===o.boxSizing){const t=mw(o,"border","width"),e=mw(o,"padding");c-=e.width+t.width,h-=e.height+t.height}c=Math.max(0,c-s.width),h=Math.max(0,n?c/n:h-s.height),c=vw(Math.min(c,r,l.maxWidth)),h=vw(Math.min(h,a,l.maxHeight)),c&&!h&&(h=vw(c/2));return(void 0!==e||void 0!==i)&&n&&l.height&&h>l.height&&(h=l.height,c=vw(Math.floor(h*n))),{width:c,height:h}}function bw(t,e,i){const n=e||1,o=Math.floor(t.height*n),s=Math.floor(t.width*n);t.height=Math.floor(t.height),t.width=Math.floor(t.width);const r=t.canvas;return r.style&&(i||!r.style.height&&!r.style.width)&&(r.style.height=`${t.height}px`,r.style.width=`${t.width}px`),(t.currentDevicePixelRatio!==n||r.height!==o||r.width!==s)&&(t.currentDevicePixelRatio=n,r.height=o,r.width=s,t.ctx.setTransform(n,0,0,n,0,0),!0)}const _w=function(){let t=!1;try{const e={get passive(){return t=!0,!1}};cw()&&(window.addEventListener("test",null,e),window.removeEventListener("test",null,e))}catch(t){}return t}();function xw(t,e){const i=function(t,e){return uw(t).getPropertyValue(e)}(t,e),n=i&&i.match(/^(\d+)(\.\d+)?px$/);return n?+n[1]:void 0}function ww(t,e,i,n){return{x:t.x+i*(e.x-t.x),y:t.y+i*(e.y-t.y)}}function kw(t,e,i,n){return{x:t.x+i*(e.x-t.x),y:"middle"===n?i<.5?t.y:e.y:"after"===n?i<1?t.y:e.y:i>0?e.y:t.y}}function Sw(t,e,i,n){const o={x:t.cp2x,y:t.cp2y},s={x:e.cp1x,y:e.cp1y},r=ww(t,o,i),a=ww(o,s,i),l=ww(s,e,i),c=ww(r,a,i),h=ww(a,l,i);return ww(c,h,i)}function Cw(t,e,i){return t?function(t,e){return{x:i=>t+t+e-i,setWidth(t){e=t},textAlign:t=>"center"===t?t:"right"===t?"left":"right",xPlus:(t,e)=>t-e,leftForLtr:(t,e)=>t-e}}(e,i):{x:t=>t,setWidth(t){},textAlign:t=>t,xPlus:(t,e)=>t+e,leftForLtr:(t,e)=>t}}function Ew(t,e){let i,n;"ltr"!==e&&"rtl"!==e||(i=t.canvas.style,n=[i.getPropertyValue("direction"),i.getPropertyPriority("direction")],i.setProperty("direction",e,"important"),t.prevTextDirection=n)}function Aw(t,e){void 0!==e&&(delete t.prevTextDirection,t.canvas.style.setProperty("direction",e[0],e[1]))}function Mw(t){return"angle"===t?{between:z_,compare:L_,normalize:$_}:{between:N_,compare:(t,e)=>t-e,normalize:t=>t}}function Tw({start:t,end:e,count:i,loop:n,style:o}){return{start:t%i,end:e%i,loop:n&&(e-t+1)%i==0,style:o}}function Pw(t,e,i){if(!i)return[t];const{property:n,start:o,end:s}=i,r=e.length,{compare:a,between:l,normalize:c}=Mw(n),{start:h,end:d,loop:u,style:p}=function(t,e,i){const{property:n,start:o,end:s}=i,{between:r,normalize:a}=Mw(n),l=e.length;let c,h,{start:d,end:u,loop:p}=t;if(p){for(d+=l,u+=l,c=0,h=l;c<h&&r(a(e[d%l][n]),o,s);++c)d--,u--;d%=l,u%=l}return u<d&&(u+=l),{start:d,end:u,loop:p,style:t.style}}(t,e,i),m=[];let f,g,v,y=!1,b=null;const _=()=>y||l(o,v,f)&&0!==a(o,v),x=()=>!y||0===a(s,f)||l(s,v,f);for(let t=h,i=h;t<=d;++t)g=e[t%r],g.skip||(f=c(g[n]),f!==v&&(y=l(f,o,s),null===b&&_()&&(b=0===a(f,o)?t:i),null!==b&&x()&&(m.push(Tw({start:b,end:t,loop:u,count:r,style:p})),b=null),i=t,v=f));return null!==b&&m.push(Tw({start:b,end:d,loop:u,count:r,style:p})),m}function Ow(t,e){const i=[],n=t.segments;for(let o=0;o<n.length;o++){const s=Pw(n[o],t.points,e);s.length&&i.push(...s)}return i}function Dw(t,e,i,n){return n&&n.setContext&&i?function(t,e,i,n){const o=t._chart.getContext(),s=Iw(t.options),{_datasetIndex:r,options:{spanGaps:a}}=t,l=i.length,c=[];let h=s,d=e[0].start,u=d;function p(t,e,n,o){const s=a?-1:1;if(t!==e){for(t+=l;i[t%l].skip;)t-=s;for(;i[e%l].skip;)e+=s;t%l!=e%l&&(c.push({start:t%l,end:e%l,loop:n,style:o}),h=o,d=e%l)}}for(const t of e){d=a?d:t.start;let e,s=i[d%l];for(u=d+1;u<=t.end;u++){const a=i[u%l];e=Iw(n.setContext(Fx(o,{type:"segment",p0:s,p1:a,p0DataIndex:(u-1)%l,p1DataIndex:u%l,datasetIndex:r}))),Lw(e,h)&&p(d,u-1,t.loop,h),s=a,h=e}d<u-1&&p(d,u-1,t.loop,h)}return c}(t,e,i,n):e}function Iw(t){return{backgroundColor:t.backgroundColor,borderCapStyle:t.borderCapStyle,borderDash:t.borderDash,borderDashOffset:t.borderDashOffset,borderJoinStyle:t.borderJoinStyle,borderWidth:t.borderWidth,borderColor:t.borderColor}}function Lw(t,e){if(!e)return!1;const i=[],n=function(t,e){return ex(e)?(i.includes(e)||i.push(e),i.indexOf(e)):e};return JSON.stringify(t,n)!==JSON.stringify(e,n)}
8517
+ */function Hb(){}const Ub=(()=>{let t=0;return()=>t++})();function Wb(t){return null==t}function Gb(t){if(Array.isArray&&Array.isArray(t))return!0;const e=Object.prototype.toString.call(t);return"[object"===e.slice(0,7)&&"Array]"===e.slice(-6)}function Zb(t){return null!==t&&"[object Object]"===Object.prototype.toString.call(t)}function Yb(t){return("number"==typeof t||t instanceof Number)&&isFinite(+t)}function Xb(t,e){return Yb(t)?t:e}function Kb(t,e){return void 0===t?e:t}const Qb=(t,e)=>"string"==typeof t&&t.endsWith("%")?parseFloat(t)/100*e:+t;function Jb(t,e,i){if(t&&"function"==typeof t.call)return t.apply(i,e)}function t_(t,e,i,n){let o,s,r;if(Gb(t))for(s=t.length,o=0;o<s;o++)e.call(i,t[o],o);else if(Zb(t))for(r=Object.keys(t),s=r.length,o=0;o<s;o++)e.call(i,t[r[o]],r[o])}function e_(t,e){let i,n,o,s;if(!t||!e||t.length!==e.length)return!1;for(i=0,n=t.length;i<n;++i)if(o=t[i],s=e[i],o.datasetIndex!==s.datasetIndex||o.index!==s.index)return!1;return!0}function i_(t){if(Gb(t))return t.map(i_);if(Zb(t)){const e=Object.create(null),i=Object.keys(t),n=i.length;let o=0;for(;o<n;++o)e[i[o]]=i_(t[i[o]]);return e}return t}function n_(t){return-1===["__proto__","prototype","constructor"].indexOf(t)}function o_(t,e,i,n){if(!n_(t))return;const o=e[t],s=i[t];Zb(o)&&Zb(s)?s_(o,s,n):e[t]=i_(s)}function s_(t,e,i){const n=Gb(e)?e:[e],o=n.length;if(!Zb(t))return t;const s=(i=i||{}).merger||o_;let r;for(let e=0;e<o;++e){if(r=n[e],!Zb(r))continue;const o=Object.keys(r);for(let e=0,n=o.length;e<n;++e)s(o[e],t,r,i)}return t}function r_(t,e){return s_(t,e,{merger:a_})}function a_(t,e,i){if(!n_(t))return;const n=e[t],o=i[t];Zb(n)&&Zb(o)?r_(n,o):Object.prototype.hasOwnProperty.call(e,t)||(e[t]=i_(o))}const l_={"":t=>t,x:t=>t.x,y:t=>t.y};function c_(t,e){const i=l_[e]||(l_[e]=function(t){const e=function(t){const e=t.split("."),i=[];let n="";for(const t of e)n+=t,n.endsWith("\\")?n=n.slice(0,-1)+".":(i.push(n),n="");return i}(t);return t=>{for(const i of e){if(""===i)break;t=t&&t[i]}return t}}(e));return i(t)}function h_(t){return t.charAt(0).toUpperCase()+t.slice(1)}const d_=t=>void 0!==t,u_=t=>"function"==typeof t,p_=(t,e)=>{if(t.size!==e.size)return!1;for(const i of t)if(!e.has(i))return!1;return!0};const m_=Math.PI,f_=2*m_,g_=f_+m_,v_=Number.POSITIVE_INFINITY,y_=m_/180,b_=m_/2,__=m_/4,x_=2*m_/3,w_=Math.log10,k_=Math.sign;function S_(t,e,i){return Math.abs(t-e)<i}function C_(t){const e=Math.round(t);t=S_(t,e,t/1e3)?e:t;const i=Math.pow(10,Math.floor(w_(t))),n=t/i;return(n<=1?1:n<=2?2:n<=5?5:10)*i}function E_(t){return!function(t){return"symbol"==typeof t||"object"==typeof t&&null!==t&&!(Symbol.toPrimitive in t||"toString"in t||"valueOf"in t)}(t)&&!isNaN(parseFloat(t))&&isFinite(t)}function A_(t,e,i){let n,o,s;for(n=0,o=t.length;n<o;n++)s=t[n][i],isNaN(s)||(e.min=Math.min(e.min,s),e.max=Math.max(e.max,s))}function M_(t){return t*(m_/180)}function T_(t){return t*(180/m_)}function P_(t){if(!Yb(t))return;let e=1,i=0;for(;Math.round(t*e)/e!==t;)e*=10,i++;return i}function O_(t,e){const i=e.x-t.x,n=e.y-t.y,o=Math.sqrt(i*i+n*n);let s=Math.atan2(n,i);return s<-.5*m_&&(s+=f_),{angle:s,distance:o}}function D_(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function I_(t,e){return(t-e+g_)%f_-m_}function L_(t){return(t%f_+f_)%f_}function $_(t,e,i,n){const o=L_(t),s=L_(e),r=L_(i),a=L_(s-o),l=L_(r-o),c=L_(o-s),h=L_(o-r);return o===s||o===r||n&&s===r||a>l&&c<h}function z_(t,e,i){return Math.max(e,Math.min(i,t))}function R_(t,e,i,n=1e-6){return t>=Math.min(e,i)-n&&t<=Math.max(e,i)+n}function N_(t,e,i){i=i||(i=>t[i]<e);let n,o=t.length-1,s=0;for(;o-s>1;)n=s+o>>1,i(n)?s=n:o=n;return{lo:s,hi:o}}const j_=(t,e,i,n)=>N_(t,i,n?n=>{const o=t[n][e];return o<i||o===i&&t[n+1][e]===i}:n=>t[n][e]<i),B_=(t,e,i)=>N_(t,i,(n=>t[n][e]>=i));const F_=["push","pop","shift","splice","unshift"];function q_(t,e){const i=t._chartjs;if(!i)return;const n=i.listeners,o=n.indexOf(e);-1!==o&&n.splice(o,1),n.length>0||(F_.forEach((e=>{delete t[e]})),delete t._chartjs)}function V_(t){const e=new Set(t);return e.size===t.length?t:Array.from(e)}const H_="undefined"==typeof window?function(t){return t()}:window.requestAnimationFrame;function U_(t,e){let i=[],n=!1;return function(...o){i=o,n||(n=!0,H_.call(window,(()=>{n=!1,t.apply(e,i)})))}}const W_=t=>"start"===t?"left":"end"===t?"right":"center",G_=(t,e,i)=>"start"===t?e:"end"===t?i:(e+i)/2;function Z_(t,e,i){const n=e.length;let o=0,s=n;if(t._sorted){const{iScale:r,vScale:a,_parsed:l}=t,c=t.dataset&&t.dataset.options?t.dataset.options.spanGaps:null,h=r.axis,{min:d,max:u,minDefined:p,maxDefined:m}=r.getUserBounds();if(p){if(o=Math.min(j_(l,h,d).lo,i?n:j_(e,h,r.getPixelForValue(d)).lo),c){const t=l.slice(0,o+1).reverse().findIndex((t=>!Wb(t[a.axis])));o-=Math.max(0,t)}o=z_(o,0,n-1)}if(m){let t=Math.max(j_(l,r.axis,u,!0).hi+1,i?0:j_(e,h,r.getPixelForValue(u),!0).hi+1);if(c){const e=l.slice(t-1).findIndex((t=>!Wb(t[a.axis])));t+=Math.max(0,e)}s=z_(t,o,n)-o}else s=n-o}return{start:o,count:s}}function Y_(t){const{xScale:e,yScale:i,_scaleRanges:n}=t,o={xmin:e.min,xmax:e.max,ymin:i.min,ymax:i.max};if(!n)return t._scaleRanges=o,!0;const s=n.xmin!==e.min||n.xmax!==e.max||n.ymin!==i.min||n.ymax!==i.max;return Object.assign(n,o),s}const X_=t=>0===t||1===t,K_=(t,e,i)=>-Math.pow(2,10*(t-=1))*Math.sin((t-e)*f_/i),Q_=(t,e,i)=>Math.pow(2,-10*t)*Math.sin((t-e)*f_/i)+1,J_={linear:t=>t,easeInQuad:t=>t*t,easeOutQuad:t=>-t*(t-2),easeInOutQuad:t=>(t/=.5)<1?.5*t*t:-.5*(--t*(t-2)-1),easeInCubic:t=>t*t*t,easeOutCubic:t=>(t-=1)*t*t+1,easeInOutCubic:t=>(t/=.5)<1?.5*t*t*t:.5*((t-=2)*t*t+2),easeInQuart:t=>t*t*t*t,easeOutQuart:t=>-((t-=1)*t*t*t-1),easeInOutQuart:t=>(t/=.5)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2),easeInQuint:t=>t*t*t*t*t,easeOutQuint:t=>(t-=1)*t*t*t*t+1,easeInOutQuint:t=>(t/=.5)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2),easeInSine:t=>1-Math.cos(t*b_),easeOutSine:t=>Math.sin(t*b_),easeInOutSine:t=>-.5*(Math.cos(m_*t)-1),easeInExpo:t=>0===t?0:Math.pow(2,10*(t-1)),easeOutExpo:t=>1===t?1:1-Math.pow(2,-10*t),easeInOutExpo:t=>X_(t)?t:t<.5?.5*Math.pow(2,10*(2*t-1)):.5*(2-Math.pow(2,-10*(2*t-1))),easeInCirc:t=>t>=1?t:-(Math.sqrt(1-t*t)-1),easeOutCirc:t=>Math.sqrt(1-(t-=1)*t),easeInOutCirc:t=>(t/=.5)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1),easeInElastic:t=>X_(t)?t:K_(t,.075,.3),easeOutElastic:t=>X_(t)?t:Q_(t,.075,.3),easeInOutElastic(t){const e=.1125;return X_(t)?t:t<.5?.5*K_(2*t,e,.45):.5+.5*Q_(2*t-1,e,.45)},easeInBack(t){const e=1.70158;return t*t*((e+1)*t-e)},easeOutBack(t){const e=1.70158;return(t-=1)*t*((e+1)*t+e)+1},easeInOutBack(t){let e=1.70158;return(t/=.5)<1?t*t*((1+(e*=1.525))*t-e)*.5:.5*((t-=2)*t*((1+(e*=1.525))*t+e)+2)},easeInBounce:t=>1-J_.easeOutBounce(1-t),easeOutBounce(t){const e=7.5625,i=2.75;return t<1/i?e*t*t:t<2/i?e*(t-=1.5/i)*t+.75:t<2.5/i?e*(t-=2.25/i)*t+.9375:e*(t-=2.625/i)*t+.984375},easeInOutBounce:t=>t<.5?.5*J_.easeInBounce(2*t):.5*J_.easeOutBounce(2*t-1)+.5};function tx(t){if(t&&"object"==typeof t){const e=t.toString();return"[object CanvasPattern]"===e||"[object CanvasGradient]"===e}return!1}function ex(t){return tx(t)?t:new Vb(t)}function ix(t){return tx(t)?t:new Vb(t).saturate(.5).darken(.1).hexString()}const nx=["x","y","borderWidth","radius","tension"],ox=["color","borderColor","backgroundColor"];const sx=new Map;function rx(t,e,i){return function(t,e){e=e||{};const i=t+JSON.stringify(e);let n=sx.get(i);return n||(n=new Intl.NumberFormat(t,e),sx.set(i,n)),n}(e,i).format(t)}const ax={values:t=>Gb(t)?t:""+t,numeric(t,e,i){if(0===t)return"0";const n=this.chart.options.locale;let o,s=t;if(i.length>1){const e=Math.max(Math.abs(i[0].value),Math.abs(i[i.length-1].value));(e<1e-4||e>1e15)&&(o="scientific"),s=function(t,e){let i=e.length>3?e[2].value-e[1].value:e[1].value-e[0].value;Math.abs(i)>=1&&t!==Math.floor(t)&&(i=t-Math.floor(t));return i}(t,i)}const r=w_(Math.abs(s)),a=isNaN(r)?1:Math.max(Math.min(-1*Math.floor(r),20),0),l={notation:o,minimumFractionDigits:a,maximumFractionDigits:a};return Object.assign(l,this.options.ticks.format),rx(t,n,l)},logarithmic(t,e,i){if(0===t)return"0";const n=i[e].significand||t/Math.pow(10,Math.floor(w_(t)));return[1,2,3,5,10,15].includes(n)||e>.8*i.length?ax.numeric.call(this,t,e,i):""}};var lx={formatters:ax};const cx=Object.create(null),hx=Object.create(null);function dx(t,e){if(!e)return t;const i=e.split(".");for(let e=0,n=i.length;e<n;++e){const n=i[e];t=t[n]||(t[n]=Object.create(null))}return t}function ux(t,e,i){return"string"==typeof e?s_(dx(t,e),i):s_(dx(t,""),e)}class px{constructor(t,e){this.animation=void 0,this.backgroundColor="rgba(0,0,0,0.1)",this.borderColor="rgba(0,0,0,0.1)",this.color="#666",this.datasets={},this.devicePixelRatio=t=>t.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(t,e)=>ix(e.backgroundColor),this.hoverBorderColor=(t,e)=>ix(e.borderColor),this.hoverColor=(t,e)=>ix(e.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t),this.apply(e)}set(t,e){return ux(this,t,e)}get(t){return dx(this,t)}describe(t,e){return ux(hx,t,e)}override(t,e){return ux(cx,t,e)}route(t,e,i,n){const o=dx(this,t),s=dx(this,i),r="_"+e;Object.defineProperties(o,{[r]:{value:o[e],writable:!0},[e]:{enumerable:!0,get(){const t=this[r],e=s[n];return Zb(t)?Object.assign({},e,t):Kb(t,e)},set(t){this[r]=t}}})}apply(t){t.forEach((t=>t(this)))}}var mx=new px({_scriptable:t=>!t.startsWith("on"),_indexable:t=>"events"!==t,hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[function(t){t.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),t.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>"onProgress"!==t&&"onComplete"!==t&&"fn"!==t}),t.set("animations",{colors:{type:"color",properties:ox},numbers:{type:"number",properties:nx}}),t.describe("animations",{_fallback:"animation"}),t.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>0|t}}}})},function(t){t.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})},function(t){t.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(t,e)=>e.lineWidth,tickColor:(t,e)=>e.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:lx.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),t.route("scale.ticks","color","","color"),t.route("scale.grid","color","","borderColor"),t.route("scale.border","color","","borderColor"),t.route("scale.title","color","","color"),t.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&"callback"!==t&&"parser"!==t,_indexable:t=>"borderDash"!==t&&"tickBorderDash"!==t&&"dash"!==t}),t.describe("scales",{_fallback:"scale"}),t.describe("scale.ticks",{_scriptable:t=>"backdropPadding"!==t&&"callback"!==t,_indexable:t=>"backdropPadding"!==t})}]);function fx(t,e,i,n,o){let s=e[o];return s||(s=e[o]=t.measureText(o).width,i.push(o)),s>n&&(n=s),n}function gx(t,e,i,n){let o=(n=n||{}).data=n.data||{},s=n.garbageCollect=n.garbageCollect||[];n.font!==e&&(o=n.data={},s=n.garbageCollect=[],n.font=e),t.save(),t.font=e;let r=0;const a=i.length;let l,c,h,d,u;for(l=0;l<a;l++)if(d=i[l],null==d||Gb(d)){if(Gb(d))for(c=0,h=d.length;c<h;c++)u=d[c],null==u||Gb(u)||(r=fx(t,o,s,r,u))}else r=fx(t,o,s,r,d);t.restore();const p=s.length/2;if(p>i.length){for(l=0;l<p;l++)delete o[s[l]];s.splice(0,p)}return r}function vx(t,e,i){const n=t.currentDevicePixelRatio,o=0!==i?Math.max(i/2,.5):0;return Math.round((e-o)*n)/n+o}function yx(t,e){(e||t)&&((e=e||t.getContext("2d")).save(),e.resetTransform(),e.clearRect(0,0,t.width,t.height),e.restore())}function bx(t,e,i,n){_x(t,e,i,n,null)}function _x(t,e,i,n,o){let s,r,a,l,c,h,d,u;const p=e.pointStyle,m=e.rotation,f=e.radius;let g=(m||0)*y_;if(p&&"object"==typeof p&&(s=p.toString(),"[object HTMLImageElement]"===s||"[object HTMLCanvasElement]"===s))return t.save(),t.translate(i,n),t.rotate(g),t.drawImage(p,-p.width/2,-p.height/2,p.width,p.height),void t.restore();if(!(isNaN(f)||f<=0)){switch(t.beginPath(),p){default:o?t.ellipse(i,n,o/2,f,0,0,f_):t.arc(i,n,f,0,f_),t.closePath();break;case"triangle":h=o?o/2:f,t.moveTo(i+Math.sin(g)*h,n-Math.cos(g)*f),g+=x_,t.lineTo(i+Math.sin(g)*h,n-Math.cos(g)*f),g+=x_,t.lineTo(i+Math.sin(g)*h,n-Math.cos(g)*f),t.closePath();break;case"rectRounded":c=.516*f,l=f-c,r=Math.cos(g+__)*l,d=Math.cos(g+__)*(o?o/2-c:l),a=Math.sin(g+__)*l,u=Math.sin(g+__)*(o?o/2-c:l),t.arc(i-d,n-a,c,g-m_,g-b_),t.arc(i+u,n-r,c,g-b_,g),t.arc(i+d,n+a,c,g,g+b_),t.arc(i-u,n+r,c,g+b_,g+m_),t.closePath();break;case"rect":if(!m){l=Math.SQRT1_2*f,h=o?o/2:l,t.rect(i-h,n-l,2*h,2*l);break}g+=__;case"rectRot":d=Math.cos(g)*(o?o/2:f),r=Math.cos(g)*f,a=Math.sin(g)*f,u=Math.sin(g)*(o?o/2:f),t.moveTo(i-d,n-a),t.lineTo(i+u,n-r),t.lineTo(i+d,n+a),t.lineTo(i-u,n+r),t.closePath();break;case"crossRot":g+=__;case"cross":d=Math.cos(g)*(o?o/2:f),r=Math.cos(g)*f,a=Math.sin(g)*f,u=Math.sin(g)*(o?o/2:f),t.moveTo(i-d,n-a),t.lineTo(i+d,n+a),t.moveTo(i+u,n-r),t.lineTo(i-u,n+r);break;case"star":d=Math.cos(g)*(o?o/2:f),r=Math.cos(g)*f,a=Math.sin(g)*f,u=Math.sin(g)*(o?o/2:f),t.moveTo(i-d,n-a),t.lineTo(i+d,n+a),t.moveTo(i+u,n-r),t.lineTo(i-u,n+r),g+=__,d=Math.cos(g)*(o?o/2:f),r=Math.cos(g)*f,a=Math.sin(g)*f,u=Math.sin(g)*(o?o/2:f),t.moveTo(i-d,n-a),t.lineTo(i+d,n+a),t.moveTo(i+u,n-r),t.lineTo(i-u,n+r);break;case"line":r=o?o/2:Math.cos(g)*f,a=Math.sin(g)*f,t.moveTo(i-r,n-a),t.lineTo(i+r,n+a);break;case"dash":t.moveTo(i,n),t.lineTo(i+Math.cos(g)*(o?o/2:f),n+Math.sin(g)*f);break;case!1:t.closePath()}t.fill(),e.borderWidth>0&&t.stroke()}}function xx(t,e,i){return i=i||.5,!e||t&&t.x>e.left-i&&t.x<e.right+i&&t.y>e.top-i&&t.y<e.bottom+i}function wx(t,e){t.save(),t.beginPath(),t.rect(e.left,e.top,e.right-e.left,e.bottom-e.top),t.clip()}function kx(t){t.restore()}function Sx(t,e,i,n,o){if(!e)return t.lineTo(i.x,i.y);if("middle"===o){const n=(e.x+i.x)/2;t.lineTo(n,e.y),t.lineTo(n,i.y)}else"after"===o!=!!n?t.lineTo(e.x,i.y):t.lineTo(i.x,e.y);t.lineTo(i.x,i.y)}function Cx(t,e,i,n){if(!e)return t.lineTo(i.x,i.y);t.bezierCurveTo(n?e.cp1x:e.cp2x,n?e.cp1y:e.cp2y,n?i.cp2x:i.cp1x,n?i.cp2y:i.cp1y,i.x,i.y)}function Ex(t,e,i,n,o){if(o.strikethrough||o.underline){const s=t.measureText(n),r=e-s.actualBoundingBoxLeft,a=e+s.actualBoundingBoxRight,l=i-s.actualBoundingBoxAscent,c=i+s.actualBoundingBoxDescent,h=o.strikethrough?(l+c)/2:c;t.strokeStyle=t.fillStyle,t.beginPath(),t.lineWidth=o.decorationWidth||2,t.moveTo(r,h),t.lineTo(a,h),t.stroke()}}function Ax(t,e){const i=t.fillStyle;t.fillStyle=e.color,t.fillRect(e.left,e.top,e.width,e.height),t.fillStyle=i}function Mx(t,e,i,n,o,s={}){const r=Gb(e)?e:[e],a=s.strokeWidth>0&&""!==s.strokeColor;let l,c;for(t.save(),t.font=o.string,function(t,e){e.translation&&t.translate(e.translation[0],e.translation[1]),Wb(e.rotation)||t.rotate(e.rotation),e.color&&(t.fillStyle=e.color),e.textAlign&&(t.textAlign=e.textAlign),e.textBaseline&&(t.textBaseline=e.textBaseline)}(t,s),l=0;l<r.length;++l)c=r[l],s.backdrop&&Ax(t,s.backdrop),a&&(s.strokeColor&&(t.strokeStyle=s.strokeColor),Wb(s.strokeWidth)||(t.lineWidth=s.strokeWidth),t.strokeText(c,i,n,s.maxWidth)),t.fillText(c,i,n,s.maxWidth),Ex(t,i,n,c,s),n+=Number(o.lineHeight);t.restore()}function Tx(t,e){const{x:i,y:n,w:o,h:s,radius:r}=e;t.arc(i+r.topLeft,n+r.topLeft,r.topLeft,1.5*m_,m_,!0),t.lineTo(i,n+s-r.bottomLeft),t.arc(i+r.bottomLeft,n+s-r.bottomLeft,r.bottomLeft,m_,b_,!0),t.lineTo(i+o-r.bottomRight,n+s),t.arc(i+o-r.bottomRight,n+s-r.bottomRight,r.bottomRight,b_,0,!0),t.lineTo(i+o,n+r.topRight),t.arc(i+o-r.topRight,n+r.topRight,r.topRight,0,-b_,!0),t.lineTo(i+r.topLeft,n)}const Px=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,Ox=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function Dx(t,e){const i=(""+t).match(Px);if(!i||"normal"===i[1])return 1.2*e;switch(t=+i[2],i[3]){case"px":return t;case"%":t/=100}return e*t}const Ix=t=>+t||0;function Lx(t,e){const i={},n=Zb(e),o=n?Object.keys(e):e,s=Zb(t)?n?i=>Kb(t[i],t[e[i]]):e=>t[e]:()=>t;for(const t of o)i[t]=Ix(s(t));return i}function $x(t){return Lx(t,{top:"y",right:"x",bottom:"y",left:"x"})}function zx(t){return Lx(t,["topLeft","topRight","bottomLeft","bottomRight"])}function Rx(t){const e=$x(t);return e.width=e.left+e.right,e.height=e.top+e.bottom,e}function Nx(t,e){t=t||{},e=e||mx.font;let i=Kb(t.size,e.size);"string"==typeof i&&(i=parseInt(i,10));let n=Kb(t.style,e.style);n&&!(""+n).match(Ox)&&(console.warn('Invalid font style specified: "'+n+'"'),n=void 0);const o={family:Kb(t.family,e.family),lineHeight:Dx(Kb(t.lineHeight,e.lineHeight),i),size:i,style:n,weight:Kb(t.weight,e.weight),string:""};return o.string=function(t){return!t||Wb(t.size)||Wb(t.family)?null:(t.style?t.style+" ":"")+(t.weight?t.weight+" ":"")+t.size+"px "+t.family}(o),o}function jx(t,e,i,n){let o,s,r;for(o=0,s=t.length;o<s;++o)if(r=t[o],void 0!==r&&void 0!==r)return r}function Bx(t,e){return Object.assign(Object.create(t),e)}function Fx(t,e=[""],i,n,o=(()=>t[0])){const s=i||t;void 0===n&&(n=Qx("_fallback",t));const r={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:t,_rootScopes:s,_fallback:n,_getTarget:o,override:i=>Fx([i,...t],e,s,n)};return new Proxy(r,{deleteProperty:(e,i)=>(delete e[i],delete e._keys,delete t[0][i],!0),get:(i,n)=>Wx(i,n,(()=>function(t,e,i,n){let o;for(const s of e)if(o=Qx(Hx(s,t),i),void 0!==o)return Ux(t,o)?Xx(i,n,t,o):o}(n,e,t,i))),getOwnPropertyDescriptor:(t,e)=>Reflect.getOwnPropertyDescriptor(t._scopes[0],e),getPrototypeOf:()=>Reflect.getPrototypeOf(t[0]),has:(t,e)=>Jx(t).includes(e),ownKeys:t=>Jx(t),set(t,e,i){const n=t._storage||(t._storage=o());return t[e]=n[e]=i,delete t._keys,!0}})}function qx(t,e,i,n){const o={_cacheable:!1,_proxy:t,_context:e,_subProxy:i,_stack:new Set,_descriptors:Vx(t,n),setContext:e=>qx(t,e,i,n),override:o=>qx(t.override(o),e,i,n)};return new Proxy(o,{deleteProperty:(e,i)=>(delete e[i],delete t[i],!0),get:(t,e,i)=>Wx(t,e,(()=>function(t,e,i){const{_proxy:n,_context:o,_subProxy:s,_descriptors:r}=t;let a=n[e];u_(a)&&r.isScriptable(e)&&(a=function(t,e,i,n){const{_proxy:o,_context:s,_subProxy:r,_stack:a}=i;if(a.has(t))throw new Error("Recursion detected: "+Array.from(a).join("->")+"->"+t);a.add(t);let l=e(s,r||n);a.delete(t),Ux(t,l)&&(l=Xx(o._scopes,o,t,l));return l}(e,a,t,i));Gb(a)&&a.length&&(a=function(t,e,i,n){const{_proxy:o,_context:s,_subProxy:r,_descriptors:a}=i;if(void 0!==s.index&&n(t))return e[s.index%e.length];if(Zb(e[0])){const i=e,n=o._scopes.filter((t=>t!==i));e=[];for(const l of i){const i=Xx(n,o,t,l);e.push(qx(i,s,r&&r[t],a))}}return e}(e,a,t,r.isIndexable));Ux(e,a)&&(a=qx(a,o,s&&s[e],r));return a}(t,e,i))),getOwnPropertyDescriptor:(e,i)=>e._descriptors.allKeys?Reflect.has(t,i)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(t,i),getPrototypeOf:()=>Reflect.getPrototypeOf(t),has:(e,i)=>Reflect.has(t,i),ownKeys:()=>Reflect.ownKeys(t),set:(e,i,n)=>(t[i]=n,delete e[i],!0)})}function Vx(t,e={scriptable:!0,indexable:!0}){const{_scriptable:i=e.scriptable,_indexable:n=e.indexable,_allKeys:o=e.allKeys}=t;return{allKeys:o,scriptable:i,indexable:n,isScriptable:u_(i)?i:()=>i,isIndexable:u_(n)?n:()=>n}}const Hx=(t,e)=>t?t+h_(e):e,Ux=(t,e)=>Zb(e)&&"adapters"!==t&&(null===Object.getPrototypeOf(e)||e.constructor===Object);function Wx(t,e,i){if(Object.prototype.hasOwnProperty.call(t,e)||"constructor"===e)return t[e];const n=i();return t[e]=n,n}function Gx(t,e,i){return u_(t)?t(e,i):t}const Zx=(t,e)=>!0===t?e:"string"==typeof t?c_(e,t):void 0;function Yx(t,e,i,n,o){for(const s of e){const e=Zx(i,s);if(e){t.add(e);const s=Gx(e._fallback,i,o);if(void 0!==s&&s!==i&&s!==n)return s}else if(!1===e&&void 0!==n&&i!==n)return null}return!1}function Xx(t,e,i,n){const o=e._rootScopes,s=Gx(e._fallback,i,n),r=[...t,...o],a=new Set;a.add(n);let l=Kx(a,r,i,s||i,n);return null!==l&&((void 0===s||s===i||(l=Kx(a,r,s,l,n),null!==l))&&Fx(Array.from(a),[""],o,s,(()=>function(t,e,i){const n=t._getTarget();e in n||(n[e]={});const o=n[e];if(Gb(o)&&Zb(i))return i;return o||{}}(e,i,n))))}function Kx(t,e,i,n,o){for(;i;)i=Yx(t,e,i,n,o);return i}function Qx(t,e){for(const i of e){if(!i)continue;const e=i[t];if(void 0!==e)return e}}function Jx(t){let e=t._keys;return e||(e=t._keys=function(t){const e=new Set;for(const i of t)for(const t of Object.keys(i).filter((t=>!t.startsWith("_"))))e.add(t);return Array.from(e)}(t._scopes)),e}function tw(t,e,i,n){const{iScale:o}=t,{key:s="r"}=this._parsing,r=new Array(n);let a,l,c,h;for(a=0,l=n;a<l;++a)c=a+i,h=e[c],r[a]={r:o.parse(c_(h,s),c)};return r}const ew=Number.EPSILON||1e-14,iw=(t,e)=>e<t.length&&!t[e].skip&&t[e],nw=t=>"x"===t?"y":"x";function ow(t,e,i,n){const o=t.skip?e:t,s=e,r=i.skip?e:i,a=D_(s,o),l=D_(r,s);let c=a/(a+l),h=l/(a+l);c=isNaN(c)?0:c,h=isNaN(h)?0:h;const d=n*c,u=n*h;return{previous:{x:s.x-d*(r.x-o.x),y:s.y-d*(r.y-o.y)},next:{x:s.x+u*(r.x-o.x),y:s.y+u*(r.y-o.y)}}}function sw(t,e="x"){const i=nw(e),n=t.length,o=Array(n).fill(0),s=Array(n);let r,a,l,c=iw(t,0);for(r=0;r<n;++r)if(a=l,l=c,c=iw(t,r+1),l){if(c){const t=c[e]-l[e];o[r]=0!==t?(c[i]-l[i])/t:0}s[r]=a?c?k_(o[r-1])!==k_(o[r])?0:(o[r-1]+o[r])/2:o[r-1]:o[r]}!function(t,e,i){const n=t.length;let o,s,r,a,l,c=iw(t,0);for(let h=0;h<n-1;++h)l=c,c=iw(t,h+1),l&&c&&(S_(e[h],0,ew)?i[h]=i[h+1]=0:(o=i[h]/e[h],s=i[h+1]/e[h],a=Math.pow(o,2)+Math.pow(s,2),a<=9||(r=3/Math.sqrt(a),i[h]=o*r*e[h],i[h+1]=s*r*e[h])))}(t,o,s),function(t,e,i="x"){const n=nw(i),o=t.length;let s,r,a,l=iw(t,0);for(let c=0;c<o;++c){if(r=a,a=l,l=iw(t,c+1),!a)continue;const o=a[i],h=a[n];r&&(s=(o-r[i])/3,a[`cp1${i}`]=o-s,a[`cp1${n}`]=h-s*e[c]),l&&(s=(l[i]-o)/3,a[`cp2${i}`]=o+s,a[`cp2${n}`]=h+s*e[c])}}(t,s,e)}function rw(t,e,i){return Math.max(Math.min(t,i),e)}function aw(t,e,i,n,o){let s,r,a,l;if(e.spanGaps&&(t=t.filter((t=>!t.skip))),"monotone"===e.cubicInterpolationMode)sw(t,o);else{let i=n?t[t.length-1]:t[0];for(s=0,r=t.length;s<r;++s)a=t[s],l=ow(i,a,t[Math.min(s+1,r-(n?0:1))%r],e.tension),a.cp1x=l.previous.x,a.cp1y=l.previous.y,a.cp2x=l.next.x,a.cp2y=l.next.y,i=a}e.capBezierPoints&&function(t,e){let i,n,o,s,r,a=xx(t[0],e);for(i=0,n=t.length;i<n;++i)r=s,s=a,a=i<n-1&&xx(t[i+1],e),s&&(o=t[i],r&&(o.cp1x=rw(o.cp1x,e.left,e.right),o.cp1y=rw(o.cp1y,e.top,e.bottom)),a&&(o.cp2x=rw(o.cp2x,e.left,e.right),o.cp2y=rw(o.cp2y,e.top,e.bottom)))}(t,i)}function lw(){return"undefined"!=typeof window&&"undefined"!=typeof document}function cw(t){let e=t.parentNode;return e&&"[object ShadowRoot]"===e.toString()&&(e=e.host),e}function hw(t,e,i){let n;return"string"==typeof t?(n=parseInt(t,10),-1!==t.indexOf("%")&&(n=n/100*e.parentNode[i])):n=t,n}const dw=t=>t.ownerDocument.defaultView.getComputedStyle(t,null);const uw=["top","right","bottom","left"];function pw(t,e,i){const n={};i=i?"-"+i:"";for(let o=0;o<4;o++){const s=uw[o];n[s]=parseFloat(t[e+"-"+s+i])||0}return n.width=n.left+n.right,n.height=n.top+n.bottom,n}const mw=(t,e,i)=>(t>0||e>0)&&(!i||!i.shadowRoot);function fw(t,e){if("native"in t)return t;const{canvas:i,currentDevicePixelRatio:n}=e,o=dw(i),s="border-box"===o.boxSizing,r=pw(o,"padding"),a=pw(o,"border","width"),{x:l,y:c,box:h}=function(t,e){const i=t.touches,n=i&&i.length?i[0]:t,{offsetX:o,offsetY:s}=n;let r,a,l=!1;if(mw(o,s,t.target))r=o,a=s;else{const t=e.getBoundingClientRect();r=n.clientX-t.left,a=n.clientY-t.top,l=!0}return{x:r,y:a,box:l}}(t,i),d=r.left+(h&&a.left),u=r.top+(h&&a.top);let{width:p,height:m}=e;return s&&(p-=r.width+a.width,m-=r.height+a.height),{x:Math.round((l-d)/p*i.width/n),y:Math.round((c-u)/m*i.height/n)}}const gw=t=>Math.round(10*t)/10;function vw(t,e,i,n){const o=dw(t),s=pw(o,"margin"),r=hw(o.maxWidth,t,"clientWidth")||v_,a=hw(o.maxHeight,t,"clientHeight")||v_,l=function(t,e,i){let n,o;if(void 0===e||void 0===i){const s=t&&cw(t);if(s){const t=s.getBoundingClientRect(),r=dw(s),a=pw(r,"border","width"),l=pw(r,"padding");e=t.width-l.width-a.width,i=t.height-l.height-a.height,n=hw(r.maxWidth,s,"clientWidth"),o=hw(r.maxHeight,s,"clientHeight")}else e=t.clientWidth,i=t.clientHeight}return{width:e,height:i,maxWidth:n||v_,maxHeight:o||v_}}(t,e,i);let{width:c,height:h}=l;if("content-box"===o.boxSizing){const t=pw(o,"border","width"),e=pw(o,"padding");c-=e.width+t.width,h-=e.height+t.height}c=Math.max(0,c-s.width),h=Math.max(0,n?c/n:h-s.height),c=gw(Math.min(c,r,l.maxWidth)),h=gw(Math.min(h,a,l.maxHeight)),c&&!h&&(h=gw(c/2));return(void 0!==e||void 0!==i)&&n&&l.height&&h>l.height&&(h=l.height,c=gw(Math.floor(h*n))),{width:c,height:h}}function yw(t,e,i){const n=e||1,o=Math.floor(t.height*n),s=Math.floor(t.width*n);t.height=Math.floor(t.height),t.width=Math.floor(t.width);const r=t.canvas;return r.style&&(i||!r.style.height&&!r.style.width)&&(r.style.height=`${t.height}px`,r.style.width=`${t.width}px`),(t.currentDevicePixelRatio!==n||r.height!==o||r.width!==s)&&(t.currentDevicePixelRatio=n,r.height=o,r.width=s,t.ctx.setTransform(n,0,0,n,0,0),!0)}const bw=function(){let t=!1;try{const e={get passive(){return t=!0,!1}};lw()&&(window.addEventListener("test",null,e),window.removeEventListener("test",null,e))}catch(t){}return t}();function _w(t,e){const i=function(t,e){return dw(t).getPropertyValue(e)}(t,e),n=i&&i.match(/^(\d+)(\.\d+)?px$/);return n?+n[1]:void 0}function xw(t,e,i,n){return{x:t.x+i*(e.x-t.x),y:t.y+i*(e.y-t.y)}}function ww(t,e,i,n){return{x:t.x+i*(e.x-t.x),y:"middle"===n?i<.5?t.y:e.y:"after"===n?i<1?t.y:e.y:i>0?e.y:t.y}}function kw(t,e,i,n){const o={x:t.cp2x,y:t.cp2y},s={x:e.cp1x,y:e.cp1y},r=xw(t,o,i),a=xw(o,s,i),l=xw(s,e,i),c=xw(r,a,i),h=xw(a,l,i);return xw(c,h,i)}function Sw(t,e,i){return t?function(t,e){return{x:i=>t+t+e-i,setWidth(t){e=t},textAlign:t=>"center"===t?t:"right"===t?"left":"right",xPlus:(t,e)=>t-e,leftForLtr:(t,e)=>t-e}}(e,i):{x:t=>t,setWidth(t){},textAlign:t=>t,xPlus:(t,e)=>t+e,leftForLtr:(t,e)=>t}}function Cw(t,e){let i,n;"ltr"!==e&&"rtl"!==e||(i=t.canvas.style,n=[i.getPropertyValue("direction"),i.getPropertyPriority("direction")],i.setProperty("direction",e,"important"),t.prevTextDirection=n)}function Ew(t,e){void 0!==e&&(delete t.prevTextDirection,t.canvas.style.setProperty("direction",e[0],e[1]))}function Aw(t){return"angle"===t?{between:$_,compare:I_,normalize:L_}:{between:R_,compare:(t,e)=>t-e,normalize:t=>t}}function Mw({start:t,end:e,count:i,loop:n,style:o}){return{start:t%i,end:e%i,loop:n&&(e-t+1)%i==0,style:o}}function Tw(t,e,i){if(!i)return[t];const{property:n,start:o,end:s}=i,r=e.length,{compare:a,between:l,normalize:c}=Aw(n),{start:h,end:d,loop:u,style:p}=function(t,e,i){const{property:n,start:o,end:s}=i,{between:r,normalize:a}=Aw(n),l=e.length;let c,h,{start:d,end:u,loop:p}=t;if(p){for(d+=l,u+=l,c=0,h=l;c<h&&r(a(e[d%l][n]),o,s);++c)d--,u--;d%=l,u%=l}return u<d&&(u+=l),{start:d,end:u,loop:p,style:t.style}}(t,e,i),m=[];let f,g,v,y=!1,b=null;const _=()=>y||l(o,v,f)&&0!==a(o,v),x=()=>!y||0===a(s,f)||l(s,v,f);for(let t=h,i=h;t<=d;++t)g=e[t%r],g.skip||(f=c(g[n]),f!==v&&(y=l(f,o,s),null===b&&_()&&(b=0===a(f,o)?t:i),null!==b&&x()&&(m.push(Mw({start:b,end:t,loop:u,count:r,style:p})),b=null),i=t,v=f));return null!==b&&m.push(Mw({start:b,end:d,loop:u,count:r,style:p})),m}function Pw(t,e){const i=[],n=t.segments;for(let o=0;o<n.length;o++){const s=Tw(n[o],t.points,e);s.length&&i.push(...s)}return i}function Ow(t,e,i,n){return n&&n.setContext&&i?function(t,e,i,n){const o=t._chart.getContext(),s=Dw(t.options),{_datasetIndex:r,options:{spanGaps:a}}=t,l=i.length,c=[];let h=s,d=e[0].start,u=d;function p(t,e,n,o){const s=a?-1:1;if(t!==e){for(t+=l;i[t%l].skip;)t-=s;for(;i[e%l].skip;)e+=s;t%l!=e%l&&(c.push({start:t%l,end:e%l,loop:n,style:o}),h=o,d=e%l)}}for(const t of e){d=a?d:t.start;let e,s=i[d%l];for(u=d+1;u<=t.end;u++){const a=i[u%l];e=Dw(n.setContext(Bx(o,{type:"segment",p0:s,p1:a,p0DataIndex:(u-1)%l,p1DataIndex:u%l,datasetIndex:r}))),Iw(e,h)&&p(d,u-1,t.loop,h),s=a,h=e}d<u-1&&p(d,u-1,t.loop,h)}return c}(t,e,i,n):e}function Dw(t){return{backgroundColor:t.backgroundColor,borderCapStyle:t.borderCapStyle,borderDash:t.borderDash,borderDashOffset:t.borderDashOffset,borderJoinStyle:t.borderJoinStyle,borderWidth:t.borderWidth,borderColor:t.borderColor}}function Iw(t,e){if(!e)return!1;const i=[],n=function(t,e){return tx(e)?(i.includes(e)||i.push(e),i.indexOf(e)):e};return JSON.stringify(t,n)!==JSON.stringify(e,n)}
8531
8518
  /*!
8532
8519
  * Chart.js v4.4.8
8533
8520
  * https://www.chartjs.org
8534
8521
  * (c) 2025 Chart.js Contributors
8535
8522
  * Released under the MIT License
8536
- */class $w{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,e,i,n){const o=e.listeners[n],s=e.duration;o.forEach((n=>n({chart:t,initial:e.initial,numSteps:s,currentStep:Math.min(i-e.start,s)})))}_refresh(){this._request||(this._running=!0,this._request=U_.call(window,(()=>{this._update(),this._request=null,this._running&&this._refresh()})))}_update(t=Date.now()){let e=0;this._charts.forEach(((i,n)=>{if(!i.running||!i.items.length)return;const o=i.items;let s,r=o.length-1,a=!1;for(;r>=0;--r)s=o[r],s._active?(s._total>i.duration&&(i.duration=s._total),s.tick(t),a=!0):(o[r]=o[o.length-1],o.pop());a&&(n.draw(),this._notify(n,i,t,"progress")),o.length||(i.running=!1,this._notify(n,i,t,"complete"),i.initial=!1),e+=o.length})),this._lastDate=t,0===e&&(this._running=!1)}_getAnims(t){const e=this._charts;let i=e.get(t);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,i)),i}listen(t,e,i){this._getAnims(t).listeners[e].push(i)}add(t,e){e&&e.length&&this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){const e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce(((t,e)=>Math.max(t,e._duration)),0),this._refresh())}running(t){if(!this._running)return!1;const e=this._charts.get(t);return!!(e&&e.running&&e.items.length)}stop(t){const e=this._charts.get(t);if(!e||!e.items.length)return;const i=e.items;let n=i.length-1;for(;n>=0;--n)i[n].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var zw=new $w;const Rw="transparent",Nw={boolean:(t,e,i)=>i>.5?e:t,color(t,e,i){const n=ix(t||Rw),o=n.valid&&ix(e||Rw);return o&&o.valid?o.mix(n,i).hexString():e},number:(t,e,i)=>t+(e-t)*i};class jw{constructor(t,e,i,n){const o=e[i];n=Bx([t.to,n,o,t.from]);const s=Bx([t.from,o,n]);this._active=!0,this._fn=t.fn||Nw[t.type||typeof s],this._easing=tx[t.easing]||tx.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=e,this._prop=i,this._from=s,this._to=n,this._promises=void 0}active(){return this._active}update(t,e,i){if(this._active){this._notify(!1);const n=this._target[this._prop],o=i-this._start,s=this._duration-o;this._start=i,this._duration=Math.floor(Math.max(s,t.duration)),this._total+=o,this._loop=!!t.loop,this._to=Bx([t.to,e,n,t.from]),this._from=Bx([t.from,n,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const e=t-this._start,i=this._duration,n=this._prop,o=this._from,s=this._loop,r=this._to;let a;if(this._active=o!==r&&(s||e<i),!this._active)return this._target[n]=r,void this._notify(!0);e<0?this._target[n]=o:(a=e/i%2,a=s&&a>1?2-a:a,a=this._easing(Math.min(1,Math.max(0,a))),this._target[n]=this._fn(o,r,a))}wait(){const t=this._promises||(this._promises=[]);return new Promise(((e,i)=>{t.push({res:e,rej:i})}))}_notify(t){const e=t?"res":"rej",i=this._promises||[];for(let t=0;t<i.length;t++)i[t][e]()}}class Bw{constructor(t,e){this._chart=t,this._properties=new Map,this.configure(e)}configure(t){if(!Yb(t))return;const e=Object.keys(fx.animation),i=this._properties;Object.getOwnPropertyNames(t).forEach((n=>{const o=t[n];if(!Yb(o))return;const s={};for(const t of e)s[t]=o[t];(Zb(o.properties)&&o.properties||[n]).forEach((t=>{t!==n&&i.has(t)||i.set(t,s)}))}))}_animateOptions(t,e){const i=e.options,n=function(t,e){if(!e)return;let i=t.options;if(!i)return void(t.options=e);i.$shared&&(t.options=i=Object.assign({},i,{$shared:!1,$animations:{}}));return i}(t,i);if(!n)return[];const o=this._createAnimations(n,i);return i.$shared&&function(t,e){const i=[],n=Object.keys(e);for(let e=0;e<n.length;e++){const o=t[n[e]];o&&o.active()&&i.push(o.wait())}return Promise.all(i)}(t.options.$animations,i).then((()=>{t.options=i}),(()=>{})),o}_createAnimations(t,e){const i=this._properties,n=[],o=t.$animations||(t.$animations={}),s=Object.keys(e),r=Date.now();let a;for(a=s.length-1;a>=0;--a){const l=s[a];if("$"===l.charAt(0))continue;if("options"===l){n.push(...this._animateOptions(t,e));continue}const c=e[l];let h=o[l];const d=i.get(l);if(h){if(d&&h.active()){h.update(d,c,r);continue}h.cancel()}d&&d.duration?(o[l]=h=new jw(d,t,l,c),n.push(h)):t[l]=c}return n}update(t,e){if(0===this._properties.size)return void Object.assign(t,e);const i=this._createAnimations(t,e);return i.length?(zw.add(this._chart,i),!0):void 0}}function Fw(t,e){const i=t&&t.options||{},n=i.reverse,o=void 0===i.min?e:0,s=void 0===i.max?e:0;return{start:n?s:o,end:n?o:s}}function qw(t,e){const i=[],n=t._getSortedDatasetMetas(e);let o,s;for(o=0,s=n.length;o<s;++o)i.push(n[o].index);return i}function Vw(t,e,i,n={}){const o=t.keys,s="single"===n.mode;let r,a,l,c;if(null===e)return;let h=!1;for(r=0,a=o.length;r<a;++r){if(l=+o[r],l===i){if(h=!0,n.all)continue;break}c=t.values[l],Xb(c)&&(s||0===e||S_(e)===S_(c))&&(e+=c)}return h||n.all?e:0}function Hw(t,e){const i=t&&t.options.stacked;return i||void 0===i&&void 0!==e.stack}function Uw(t,e,i){const n=t[e]||(t[e]={});return n[i]||(n[i]={})}function Ww(t,e,i,n){for(const o of e.getMatchingVisibleMetas(n).reverse()){const e=t[o.index];if(i&&e>0||!i&&e<0)return o.index}return null}function Gw(t,e){const{chart:i,_cachedMeta:n}=t,o=i._stacks||(i._stacks={}),{iScale:s,vScale:r,index:a}=n,l=s.axis,c=r.axis,h=function(t,e,i){return`${t.id}.${e.id}.${i.stack||i.type}`}(s,r,n),d=e.length;let u;for(let t=0;t<d;++t){const i=e[t],{[l]:s,[c]:d}=i;u=(i._stacks||(i._stacks={}))[c]=Uw(o,h,s),u[a]=d,u._top=Ww(u,r,!0,n.type),u._bottom=Ww(u,r,!1,n.type);(u._visualValues||(u._visualValues={}))[a]=d}}function Zw(t,e){const i=t.scales;return Object.keys(i).filter((t=>i[t].axis===e)).shift()}function Yw(t,e){const i=t.controller.index,n=t.vScale&&t.vScale.axis;if(n){e=e||t._parsed;for(const t of e){const e=t._stacks;if(!e||void 0===e[n]||void 0===e[n][i])return;delete e[n][i],void 0!==e[n]._visualValues&&void 0!==e[n]._visualValues[i]&&delete e[n]._visualValues[i]}}}const Xw=t=>"reset"===t||"none"===t,Kw=(t,e)=>e?t:Object.assign({},t);class Qw{static defaults={};static datasetElementType=null;static dataElementType=null;constructor(t,e){this.chart=t,this._ctx=t.ctx,this.index=e,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.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=Hw(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&&Yw(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,e=this._cachedMeta,i=this.getDataset(),n=(t,e,i,n)=>"x"===t?e:"r"===t?n:i,o=e.xAxisID=Qb(i.xAxisID,Zw(t,"x")),s=e.yAxisID=Qb(i.yAxisID,Zw(t,"y")),r=e.rAxisID=Qb(i.rAxisID,Zw(t,"r")),a=e.indexAxis,l=e.iAxisID=n(a,o,s,r),c=e.vAxisID=n(a,s,o,r);e.xScale=this.getScaleForId(o),e.yScale=this.getScaleForId(s),e.rScale=this.getScaleForId(r),e.iScale=this.getScaleForId(l),e.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 e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&V_(this._data,this),t._stacked&&Yw(t)}_dataCheck(){const t=this.getDataset(),e=t.data||(t.data=[]),i=this._data;if(Yb(e)){const t=this._cachedMeta;this._data=function(t,e){const{iScale:i,vScale:n}=e,o="x"===i.axis?"x":"y",s="x"===n.axis?"x":"y",r=Object.keys(t),a=new Array(r.length);let l,c,h;for(l=0,c=r.length;l<c;++l)h=r[l],a[l]={[o]:h,[s]:t[h]};return a}(e,t)}else if(i!==e){if(i){V_(i,this);const t=this._cachedMeta;Yw(t),t._parsed=[]}e&&Object.isExtensible(e)&&(o=this,(n=e)._chartjs?n._chartjs.listeners.push(o):(Object.defineProperty(n,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[o]}}),q_.forEach((t=>{const e="_onData"+d_(t),i=n[t];Object.defineProperty(n,t,{configurable:!0,enumerable:!1,value(...t){const o=i.apply(this,t);return n._chartjs.listeners.forEach((i=>{"function"==typeof i[e]&&i[e](...t)})),o}})})))),this._syncList=[],this._data=e}var n,o}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const e=this._cachedMeta,i=this.getDataset();let n=!1;this._dataCheck();const o=e._stacked;e._stacked=Hw(e.vScale,e),e.stack!==i.stack&&(n=!0,Yw(e),e.stack=i.stack),this._resyncElements(t),(n||o!==e._stacked)&&(Gw(this,e._parsed),e._stacked=Hw(e.vScale,e))}configure(){const t=this.chart.config,e=t.datasetScopeKeys(this._type),i=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(i,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){const{_cachedMeta:i,_data:n}=this,{iScale:o,_stacked:s}=i,r=o.axis;let a,l,c,h=0===t&&e===n.length||i._sorted,d=t>0&&i._parsed[t-1];if(!1===this._parsing)i._parsed=n,i._sorted=!0,c=n;else{c=Zb(n[t])?this.parseArrayData(i,n,t,e):Yb(n[t])?this.parseObjectData(i,n,t,e):this.parsePrimitiveData(i,n,t,e);const o=()=>null===l[r]||d&&l[r]<d[r];for(a=0;a<e;++a)i._parsed[a+t]=l=c[a],h&&(o()&&(h=!1),d=l);i._sorted=h}s&&Gw(this,c)}parsePrimitiveData(t,e,i,n){const{iScale:o,vScale:s}=t,r=o.axis,a=s.axis,l=o.getLabels(),c=o===s,h=new Array(n);let d,u,p;for(d=0,u=n;d<u;++d)p=d+i,h[d]={[r]:c||o.parse(l[p],p),[a]:s.parse(e[p],p)};return h}parseArrayData(t,e,i,n){const{xScale:o,yScale:s}=t,r=new Array(n);let a,l,c,h;for(a=0,l=n;a<l;++a)c=a+i,h=e[c],r[a]={x:o.parse(h[0],c),y:s.parse(h[1],c)};return r}parseObjectData(t,e,i,n){const{xScale:o,yScale:s}=t,{xAxisKey:r="x",yAxisKey:a="y"}=this._parsing,l=new Array(n);let c,h,d,u;for(c=0,h=n;c<h;++c)d=c+i,u=e[d],l[c]={x:o.parse(h_(u,r),d),y:s.parse(h_(u,a),d)};return l}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,e,i){const n=this.chart,o=this._cachedMeta,s=e[t.axis];return Vw({keys:qw(n,!0),values:e._stacks[t.axis]._visualValues},s,o.index,{mode:i})}updateRangeFromParsed(t,e,i,n){const o=i[e.axis];let s=null===o?NaN:o;const r=n&&i._stacks[e.axis];n&&r&&(n.values=r,s=Vw(n,o,this._cachedMeta.index)),t.min=Math.min(t.min,s),t.max=Math.max(t.max,s)}getMinMax(t,e){const i=this._cachedMeta,n=i._parsed,o=i._sorted&&t===i.iScale,s=n.length,r=this._getOtherScale(t),a=((t,e,i)=>t&&!e.hidden&&e._stacked&&{keys:qw(i,!0),values:null})(e,i,this.chart),l={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:c,max:h}=function(t){const{min:e,max:i,minDefined:n,maxDefined:o}=t.getUserBounds();return{min:n?e:Number.NEGATIVE_INFINITY,max:o?i:Number.POSITIVE_INFINITY}}(r);let d,u;function p(){u=n[d];const e=u[r.axis];return!Xb(u[t.axis])||c>e||h<e}for(d=0;d<s&&(p()||(this.updateRangeFromParsed(l,t,u,a),!o));++d);if(o)for(d=s-1;d>=0;--d)if(!p()){this.updateRangeFromParsed(l,t,u,a);break}return l}getAllParsedValues(t){const e=this._cachedMeta._parsed,i=[];let n,o,s;for(n=0,o=e.length;n<o;++n)s=e[n][t.axis],Xb(s)&&i.push(s);return i}getMaxOverflow(){return!1}getLabelAndValue(t){const e=this._cachedMeta,i=e.iScale,n=e.vScale,o=this.getParsed(t);return{label:i?""+i.getLabelForValue(o[i.axis]):"",value:n?""+n.getLabelForValue(o[n.axis]):""}}_update(t){const e=this._cachedMeta;this.update(t||"default"),e._clip=function(t){let e,i,n,o;return Yb(t)?(e=t.top,i=t.right,n=t.bottom,o=t.left):e=i=n=o=t,{top:e,right:i,bottom:n,left:o,disabled:!1===t}}(Qb(this.options.clip,function(t,e,i){if(!1===i)return!1;const n=Fw(t,i),o=Fw(e,i);return{top:o.end,right:n.end,bottom:o.start,left:n.start}}(e.xScale,e.yScale,this.getMaxOverflow())))}update(t){}draw(){const t=this._ctx,e=this.chart,i=this._cachedMeta,n=i.data||[],o=e.chartArea,s=[],r=this._drawStart||0,a=this._drawCount||n.length-r,l=this.options.drawActiveElementsOnTop;let c;for(i.dataset&&i.dataset.draw(t,o,r,a),c=r;c<r+a;++c){const e=n[c];e.hidden||(e.active&&l?s.push(e):e.draw(t,o))}for(c=0;c<s.length;++c)s[c].draw(t,o)}getStyle(t,e){const i=e?"active":"default";return void 0===t&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(i):this.resolveDataElementOptions(t||0,i)}getContext(t,e,i){const n=this.getDataset();let o;if(t>=0&&t<this._cachedMeta.data.length){const e=this._cachedMeta.data[t];o=e.$context||(e.$context=function(t,e,i){return Fx(t,{active:!1,dataIndex:e,parsed:void 0,raw:void 0,element:i,index:e,mode:"default",type:"data"})}(this.getContext(),t,e)),o.parsed=this.getParsed(t),o.raw=n.data[t],o.index=o.dataIndex=t}else o=this.$context||(this.$context=function(t,e){return Fx(t,{active:!1,dataset:void 0,datasetIndex:e,index:e,mode:"default",type:"dataset"})}(this.chart.getContext(),this.index)),o.dataset=n,o.index=o.datasetIndex=this.index;return o.active=!!e,o.mode=i,o}resolveDatasetElementOptions(t){return this._resolveElementOptions(this.datasetElementType.id,t)}resolveDataElementOptions(t,e){return this._resolveElementOptions(this.dataElementType.id,e,t)}_resolveElementOptions(t,e="default",i){const n="active"===e,o=this._cachedDataOpts,s=t+"-"+e,r=o[s],a=this.enableOptionSharing&&u_(i);if(r)return Kw(r,a);const l=this.chart.config,c=l.datasetElementScopeKeys(this._type,t),h=n?[`${t}Hover`,"hover",t,""]:[t,""],d=l.getOptionScopes(this.getDataset(),c),u=Object.keys(fx.elements[t]),p=l.resolveNamedOptions(d,u,(()=>this.getContext(i,n,e)),h);return p.$shared&&(p.$shared=a,o[s]=Object.freeze(Kw(p,a))),p}_resolveAnimations(t,e,i){const n=this.chart,o=this._cachedDataOpts,s=`animation-${e}`,r=o[s];if(r)return r;let a;if(!1!==n.options.animation){const n=this.chart.config,o=n.datasetAnimationScopeKeys(this._type,e),s=n.getOptionScopes(this.getDataset(),o);a=n.createResolver(s,this.getContext(t,i,e))}const l=new Bw(n,a&&a.animations);return a&&a._cacheable&&(o[s]=Object.freeze(l)),l}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||Xw(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){const i=this.resolveDataElementOptions(t,e),n=this._sharedOptions,o=this.getSharedOptions(i),s=this.includeOptions(e,o)||o!==n;return this.updateSharedOptions(o,e,i),{sharedOptions:o,includeOptions:s}}updateElement(t,e,i,n){Xw(n)?Object.assign(t,i):this._resolveAnimations(e,n).update(t,i)}updateSharedOptions(t,e,i){t&&!Xw(e)&&this._resolveAnimations(void 0,e).update(t,i)}_setStyle(t,e,i,n){t.active=n;const o=this.getStyle(e,n);this._resolveAnimations(e,i,n).update(t,{options:!n&&this.getSharedOptions(o)||o})}removeHoverStyle(t,e,i){this._setStyle(t,i,"active",!1)}setHoverStyle(t,e,i){this._setStyle(t,i,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const e=this._data,i=this._cachedMeta.data;for(const[t,e,i]of this._syncList)this[t](e,i);this._syncList=[];const n=i.length,o=e.length,s=Math.min(o,n);s&&this.parse(0,s),o>n?this._insertElements(n,o-n,t):o<n&&this._removeElements(o,n-o)}_insertElements(t,e,i=!0){const n=this._cachedMeta,o=n.data,s=t+e;let r;const a=t=>{for(t.length+=e,r=t.length-1;r>=s;r--)t[r]=t[r-e]};for(a(o),r=t;r<s;++r)o[r]=new this.dataElementType;this._parsing&&a(n._parsed),this.parse(t,e),i&&this.updateElements(o,t,e,"reset")}updateElements(t,e,i,n){}_removeElements(t,e){const i=this._cachedMeta;if(this._parsing){const n=i._parsed.splice(t,e);i._stacked&&Yw(i,n)}i.data.splice(t,e)}_sync(t){if(this._parsing)this._syncList.push(t);else{const[e,i,n]=t;this[e](i,n)}this.chart._dataChanges.push([this.index,...t])}_onDataPush(){const t=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-t,t])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(t,e){e&&this._sync(["_removeElements",t,e]);const i=arguments.length-2;i&&this._sync(["_insertElements",t,i])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}function Jw(t){const e=t.iScale,i=function(t,e){if(!t._cache.$bar){const i=t.getMatchingVisibleMetas(e);let n=[];for(let e=0,o=i.length;e<o;e++)n=n.concat(i[e].controller.getAllParsedValues(t));t._cache.$bar=H_(n.sort(((t,e)=>t-e)))}return t._cache.$bar}(e,t.type);let n,o,s,r,a=e._length;const l=()=>{32767!==s&&-32768!==s&&(u_(r)&&(a=Math.min(a,Math.abs(s-r)||a)),r=s)};for(n=0,o=i.length;n<o;++n)s=e.getPixelForValue(i[n]),l();for(r=void 0,n=0,o=e.ticks.length;n<o;++n)s=e.getPixelForTick(n),l();return a}function tk(t,e,i,n){return Zb(t)?function(t,e,i,n){const o=i.parse(t[0],n),s=i.parse(t[1],n),r=Math.min(o,s),a=Math.max(o,s);let l=r,c=a;Math.abs(r)>Math.abs(a)&&(l=a,c=r),e[i.axis]=c,e._custom={barStart:l,barEnd:c,start:o,end:s,min:r,max:a}}(t,e,i,n):e[i.axis]=i.parse(t,n),e}function ek(t,e,i,n){const o=t.iScale,s=t.vScale,r=o.getLabels(),a=o===s,l=[];let c,h,d,u;for(c=i,h=i+n;c<h;++c)u=e[c],d={},d[o.axis]=a||o.parse(r[c],c),l.push(tk(u,d,s,c));return l}function ik(t){return t&&void 0!==t.barStart&&void 0!==t.barEnd}function nk(t,e,i,n){let o=e.borderSkipped;const s={};if(!o)return void(t.borderSkipped=s);if(!0===o)return void(t.borderSkipped={top:!0,right:!0,bottom:!0,left:!0});const{start:r,end:a,reverse:l,top:c,bottom:h}=function(t){let e,i,n,o,s;return t.horizontal?(e=t.base>t.x,i="left",n="right"):(e=t.base<t.y,i="bottom",n="top"),e?(o="end",s="start"):(o="start",s="end"),{start:i,end:n,reverse:e,top:o,bottom:s}}(t);"middle"===o&&i&&(t.enableBorderRadius=!0,(i._top||0)===n?o=c:(i._bottom||0)===n?o=h:(s[ok(h,r,a,l)]=!0,o=c)),s[ok(o,r,a,l)]=!0,t.borderSkipped=s}function ok(t,e,i,n){var o,s,r;return n?(r=i,t=sk(t=(o=t)===(s=e)?r:o===r?s:o,i,e)):t=sk(t,e,i),t}function sk(t,e,i){return"start"===t?e:"end"===t?i:t}function rk(t,{inflateAmount:e},i){t.inflateAmount="auto"===e?1===i?.33:0:e}class ak extends Qw{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 e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:i,color:n}}=t.legend.options;return e.labels.map(((e,o)=>{const s=t.getDatasetMeta(0).controller.getStyle(o);return{text:e,fillStyle:s.backgroundColor,strokeStyle:s.borderColor,fontColor:n,lineWidth:s.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(o),index:o}}))}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}}};constructor(t,e){super(t,e),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,e){const i=this.getDataset().data,n=this._cachedMeta;if(!1===this._parsing)n._parsed=i;else{let o,s,r=t=>+i[t];if(Yb(i[t])){const{key:t="value"}=this._parsing;r=e=>+h_(i[e],t)}for(o=t,s=t+e;o<s;++o)n._parsed[o]=r(o)}}_getRotation(){return T_(this.options.rotation-90)}_getCircumference(){return T_(this.options.circumference)}_getRotationExtents(){let t=g_,e=-g_;for(let i=0;i<this.chart.data.datasets.length;++i)if(this.chart.isDatasetVisible(i)&&this.chart.getDatasetMeta(i).type===this._type){const n=this.chart.getDatasetMeta(i).controller,o=n._getRotation(),s=n._getCircumference();t=Math.min(t,o),e=Math.max(e,o+s)}return{rotation:t,circumference:e-t}}update(t){const e=this.chart,{chartArea:i}=e,n=this._cachedMeta,o=n.data,s=this.getMaxBorderWidth()+this.getMaxOffset(o)+this.options.spacing,r=Math.max((Math.min(i.width,i.height)-s)/2,0),a=Math.min((l=this.options.cutout,c=r,"string"==typeof l&&l.endsWith("%")?parseFloat(l)/100:+l/c),1);var l,c;const h=this._getRingWeight(this.index),{circumference:d,rotation:u}=this._getRotationExtents(),{ratioX:p,ratioY:m,offsetX:f,offsetY:g}=function(t,e,i){let n=1,o=1,s=0,r=0;if(e<g_){const a=t,l=a+e,c=Math.cos(a),h=Math.sin(a),d=Math.cos(l),u=Math.sin(l),p=(t,e,n)=>z_(t,a,l,!0)?1:Math.max(e,e*i,n,n*i),m=(t,e,n)=>z_(t,a,l,!0)?-1:Math.min(e,e*i,n,n*i),f=p(0,c,d),g=p(__,h,u),v=m(f_,c,d),y=m(f_+__,h,u);n=(f-v)/2,o=(g-y)/2,s=-(f+v)/2,r=-(g+y)/2}return{ratioX:n,ratioY:o,offsetX:s,offsetY:r}}(u,d,a),v=(i.width-s)/p,y=(i.height-s)/m,b=Math.max(Math.min(v,y)/2,0),_=Jb(this.options.radius,b),x=(_-Math.max(_*a,0))/this._getVisibleDatasetWeightTotal();this.offsetX=f*_,this.offsetY=g*_,n.total=this.calculateTotal(),this.outerRadius=_-x*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-x*h,0),this.updateElements(o,0,o.length,t)}_circumference(t,e){const i=this.options,n=this._cachedMeta,o=this._getCircumference();return e&&i.animation.animateRotate||!this.chart.getDataVisibility(t)||null===n._parsed[t]||n.data[t].hidden?0:this.calculateCircumference(n._parsed[t]*o/g_)}updateElements(t,e,i,n){const o="reset"===n,s=this.chart,r=s.chartArea,a=s.options.animation,l=(r.left+r.right)/2,c=(r.top+r.bottom)/2,h=o&&a.animateScale,d=h?0:this.innerRadius,u=h?0:this.outerRadius,{sharedOptions:p,includeOptions:m}=this._getSharedOptions(e,n);let f,g=this._getRotation();for(f=0;f<e;++f)g+=this._circumference(f,o);for(f=e;f<e+i;++f){const e=this._circumference(f,o),i=t[f],s={x:l+this.offsetX,y:c+this.offsetY,startAngle:g,endAngle:g+e,circumference:e,outerRadius:u,innerRadius:d};m&&(s.options=p||this.resolveDataElementOptions(f,i.active?"active":n)),g+=e,this.updateElement(i,f,s,n)}}calculateTotal(){const t=this._cachedMeta,e=t.data;let i,n=0;for(i=0;i<e.length;i++){const o=t._parsed[i];null===o||isNaN(o)||!this.chart.getDataVisibility(i)||e[i].hidden||(n+=Math.abs(o))}return n}calculateCircumference(t){const e=this._cachedMeta.total;return e>0&&!isNaN(t)?g_*(Math.abs(t)/e):0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,n=i.data.labels||[],o=ax(e._parsed[t],i.options.locale);return{label:n[t]||"",value:o}}getMaxBorderWidth(t){let e=0;const i=this.chart;let n,o,s,r,a;if(!t)for(n=0,o=i.data.datasets.length;n<o;++n)if(i.isDatasetVisible(n)){s=i.getDatasetMeta(n),t=s.data,r=s.controller;break}if(!t)return 0;for(n=0,o=t.length;n<o;++n)a=r.resolveDataElementOptions(n),"inner"!==a.borderAlign&&(e=Math.max(e,a.borderWidth||0,a.hoverBorderWidth||0));return e}getMaxOffset(t){let e=0;for(let i=0,n=t.length;i<n;++i){const t=this.resolveDataElementOptions(i);e=Math.max(e,t.offset||0,t.hoverOffset||0)}return e}_getRingWeightOffset(t){let e=0;for(let i=0;i<t;++i)this.chart.isDatasetVisible(i)&&(e+=this._getRingWeight(i));return e}_getRingWeight(t){return Math.max(Qb(this.chart.data.datasets[t].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}class lk extends Qw{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 e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:i,color:n}}=t.legend.options;return e.labels.map(((e,o)=>{const s=t.getDatasetMeta(0).controller.getStyle(o);return{text:e,fillStyle:s.backgroundColor,strokeStyle:s.borderColor,fontColor:n,lineWidth:s.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(o),index:o}}))}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}};constructor(t,e){super(t,e),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,n=i.data.labels||[],o=ax(e._parsed[t].r,i.options.locale);return{label:n[t]||"",value:o}}parseObjectData(t,e,i,n){return ew.bind(this)(t,e,i,n)}update(t){const e=this._cachedMeta.data;this._updateRadius(),this.updateElements(e,0,e.length,t)}getMinMax(){const t=this._cachedMeta,e={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach(((t,i)=>{const n=this.getParsed(i).r;!isNaN(n)&&this.chart.getDataVisibility(i)&&(n<e.min&&(e.min=n),n>e.max&&(e.max=n))})),e}_updateRadius(){const t=this.chart,e=t.chartArea,i=t.options,n=Math.min(e.right-e.left,e.bottom-e.top),o=Math.max(n/2,0),s=(o-Math.max(i.cutoutPercentage?o/100*i.cutoutPercentage:1,0))/t.getVisibleDatasetCount();this.outerRadius=o-s*this.index,this.innerRadius=this.outerRadius-s}updateElements(t,e,i,n){const o="reset"===n,s=this.chart,r=s.options.animation,a=this._cachedMeta.rScale,l=a.xCenter,c=a.yCenter,h=a.getIndexAngle(0)-.5*f_;let d,u=h;const p=360/this.countVisibleElements();for(d=0;d<e;++d)u+=this._computeAngle(d,n,p);for(d=e;d<e+i;d++){const e=t[d];let i=u,m=u+this._computeAngle(d,n,p),f=s.getDataVisibility(d)?a.getDistanceFromCenterForValue(this.getParsed(d).r):0;u=m,o&&(r.animateScale&&(f=0),r.animateRotate&&(i=m=h));const g={x:l,y:c,innerRadius:0,outerRadius:f,startAngle:i,endAngle:m,options:this.resolveDataElementOptions(d,e.active?"active":n)};this.updateElement(e,d,g,n)}}countVisibleElements(){const t=this._cachedMeta;let e=0;return t.data.forEach(((t,i)=>{!isNaN(this.getParsed(i).r)&&this.chart.getDataVisibility(i)&&e++})),e}_computeAngle(t,e,i){return this.chart.getDataVisibility(t)?T_(this.resolveDataElementOptions(t,e).angle||i):0}}var ck=Object.freeze({__proto__:null,BarController:class extends Qw{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,e,i,n){return ek(t,e,i,n)}parseArrayData(t,e,i,n){return ek(t,e,i,n)}parseObjectData(t,e,i,n){const{iScale:o,vScale:s}=t,{xAxisKey:r="x",yAxisKey:a="y"}=this._parsing,l="x"===o.axis?r:a,c="x"===s.axis?r:a,h=[];let d,u,p,m;for(d=i,u=i+n;d<u;++d)m=e[d],p={},p[o.axis]=o.parse(h_(m,l),d),h.push(tk(h_(m,c),p,s,d));return h}updateRangeFromParsed(t,e,i,n){super.updateRangeFromParsed(t,e,i,n);const o=i._custom;o&&e===this._cachedMeta.vScale&&(t.min=Math.min(t.min,o.min),t.max=Math.max(t.max,o.max))}getMaxOverflow(){return 0}getLabelAndValue(t){const e=this._cachedMeta,{iScale:i,vScale:n}=e,o=this.getParsed(t),s=o._custom,r=ik(s)?"["+s.start+", "+s.end+"]":""+n.getLabelForValue(o[n.axis]);return{label:""+i.getLabelForValue(o[i.axis]),value:r}}initialize(){this.enableOptionSharing=!0,super.initialize();this._cachedMeta.stack=this.getDataset().stack}update(t){const e=this._cachedMeta;this.updateElements(e.data,0,e.data.length,t)}updateElements(t,e,i,n){const o="reset"===n,{index:s,_cachedMeta:{vScale:r}}=this,a=r.getBasePixel(),l=r.isHorizontal(),c=this._getRuler(),{sharedOptions:h,includeOptions:d}=this._getSharedOptions(e,n);for(let u=e;u<e+i;u++){const e=this.getParsed(u),i=o||Gb(e[r.axis])?{base:a,head:a}:this._calculateBarValuePixels(u),p=this._calculateBarIndexPixels(u,c),m=(e._stacks||{})[r.axis],f={horizontal:l,base:i.base,enableBorderRadius:!m||ik(e._custom)||s===m._top||s===m._bottom,x:l?i.head:p.center,y:l?p.center:i.head,height:l?p.size:Math.abs(i.size),width:l?Math.abs(i.size):p.size};d&&(f.options=h||this.resolveDataElementOptions(u,t[u].active?"active":n));const g=f.options||t[u].options;nk(f,g,m,s),rk(f,g,c.ratio),this.updateElement(t[u],u,f,n)}}_getStacks(t,e){const{iScale:i}=this._cachedMeta,n=i.getMatchingVisibleMetas(this._type).filter((t=>t.controller.options.grouped)),o=i.options.stacked,s=[],r=this._cachedMeta.controller.getParsed(e),a=r&&r[i.axis],l=t=>{const e=t._parsed.find((t=>t[i.axis]===a)),n=e&&e[t.vScale.axis];if(Gb(n)||isNaN(n))return!0};for(const i of n)if((void 0===e||!l(i))&&((!1===o||-1===s.indexOf(i.stack)||void 0===o&&void 0===i.stack)&&s.push(i.stack),i.index===t))break;return s.length||s.push(void 0),s}_getStackCount(t){return this._getStacks(void 0,t).length}_getStackIndex(t,e,i){const n=this._getStacks(t,i),o=void 0!==e?n.indexOf(e):-1;return-1===o?n.length-1:o}_getRuler(){const t=this.options,e=this._cachedMeta,i=e.iScale,n=[];let o,s;for(o=0,s=e.data.length;o<s;++o)n.push(i.getPixelForValue(this.getParsed(o)[i.axis],o));const r=t.barThickness;return{min:r||Jw(e),pixels:n,start:i._startPixel,end:i._endPixel,stackCount:this._getStackCount(),scale:i,grouped:t.grouped,ratio:r?1:t.categoryPercentage*t.barPercentage}}_calculateBarValuePixels(t){const{_cachedMeta:{vScale:e,_stacked:i,index:n},options:{base:o,minBarLength:s}}=this,r=o||0,a=this.getParsed(t),l=a._custom,c=ik(l);let h,d,u=a[e.axis],p=0,m=i?this.applyStack(e,a,i):u;m!==u&&(p=m-u,m=u),c&&(u=l.barStart,m=l.barEnd-l.barStart,0!==u&&S_(u)!==S_(l.barEnd)&&(p=0),p+=u);const f=Gb(o)||c?p:o;let g=e.getPixelForValue(f);if(h=this.chart.getDataVisibility(t)?e.getPixelForValue(p+m):g,d=h-g,Math.abs(d)<s){d=function(t,e,i){return 0!==t?S_(t):(e.isHorizontal()?1:-1)*(e.min>=i?1:-1)}(d,e,r)*s,u===r&&(g-=d/2);const t=e.getPixelForDecimal(0),o=e.getPixelForDecimal(1),l=Math.min(t,o),p=Math.max(t,o);g=Math.max(Math.min(g,p),l),h=g+d,i&&!c&&(a._stacks[e.axis]._visualValues[n]=e.getValueForPixel(h)-e.getValueForPixel(g))}if(g===e.getPixelForValue(r)){const t=S_(d)*e.getLineWidthForValue(r)/2;g+=t,d-=t}return{size:d,base:g,head:h,center:h+d/2}}_calculateBarIndexPixels(t,e){const i=e.scale,n=this.options,o=n.skipNull,s=Qb(n.maxBarThickness,1/0);let r,a;if(e.grouped){const i=o?this._getStackCount(t):e.stackCount,l="flex"===n.barThickness?function(t,e,i,n){const o=e.pixels,s=o[t];let r=t>0?o[t-1]:null,a=t<o.length-1?o[t+1]:null;const l=i.categoryPercentage;null===r&&(r=s-(null===a?e.end-e.start:a-s)),null===a&&(a=s+s-r);const c=s-(s-Math.min(r,a))/2*l;return{chunk:Math.abs(a-r)/2*l/n,ratio:i.barPercentage,start:c}}(t,e,n,i):function(t,e,i,n){const o=i.barThickness;let s,r;return Gb(o)?(s=e.min*i.categoryPercentage,r=i.barPercentage):(s=o*n,r=1),{chunk:s/n,ratio:r,start:e.pixels[t]-s/2}}(t,e,n,i),c=this._getStackIndex(this.index,this._cachedMeta.stack,o?t:void 0);r=l.start+l.chunk*c+l.chunk/2,a=Math.min(s,l.chunk*l.ratio)}else r=i.getPixelForValue(this.getParsed(t)[i.axis],t),a=Math.min(s,e.min*e.ratio);return{base:r-a/2,head:r+a/2,center:r,size:a}}draw(){const t=this._cachedMeta,e=t.vScale,i=t.data,n=i.length;let o=0;for(;o<n;++o)null===this.getParsed(o)[e.axis]||i[o].hidden||i[o].draw(this._ctx)}},BubbleController:class extends Qw{static id="bubble";static defaults={datasetElementType:!1,dataElementType:"point",animations:{numbers:{type:"number",properties:["x","y","borderWidth","radius"]}}};static overrides={scales:{x:{type:"linear"},y:{type:"linear"}}};initialize(){this.enableOptionSharing=!0,super.initialize()}parsePrimitiveData(t,e,i,n){const o=super.parsePrimitiveData(t,e,i,n);for(let t=0;t<o.length;t++)o[t]._custom=this.resolveDataElementOptions(t+i).radius;return o}parseArrayData(t,e,i,n){const o=super.parseArrayData(t,e,i,n);for(let t=0;t<o.length;t++){const n=e[i+t];o[t]._custom=Qb(n[2],this.resolveDataElementOptions(t+i).radius)}return o}parseObjectData(t,e,i,n){const o=super.parseObjectData(t,e,i,n);for(let t=0;t<o.length;t++){const n=e[i+t];o[t]._custom=Qb(n&&n.r&&+n.r,this.resolveDataElementOptions(t+i).radius)}return o}getMaxOverflow(){const t=this._cachedMeta.data;let e=0;for(let i=t.length-1;i>=0;--i)e=Math.max(e,t[i].size(this.resolveDataElementOptions(i))/2);return e>0&&e}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart.data.labels||[],{xScale:n,yScale:o}=e,s=this.getParsed(t),r=n.getLabelForValue(s.x),a=o.getLabelForValue(s.y),l=s._custom;return{label:i[t]||"",value:"("+r+", "+a+(l?", "+l:"")+")"}}update(t){const e=this._cachedMeta.data;this.updateElements(e,0,e.length,t)}updateElements(t,e,i,n){const o="reset"===n,{iScale:s,vScale:r}=this._cachedMeta,{sharedOptions:a,includeOptions:l}=this._getSharedOptions(e,n),c=s.axis,h=r.axis;for(let d=e;d<e+i;d++){const e=t[d],i=!o&&this.getParsed(d),u={},p=u[c]=o?s.getPixelForDecimal(.5):s.getPixelForValue(i[c]),m=u[h]=o?r.getBasePixel():r.getPixelForValue(i[h]);u.skip=isNaN(p)||isNaN(m),l&&(u.options=a||this.resolveDataElementOptions(d,e.active?"active":n),o&&(u.options.radius=0)),this.updateElement(e,d,u,n)}}resolveDataElementOptions(t,e){const i=this.getParsed(t);let n=super.resolveDataElementOptions(t,e);n.$shared&&(n=Object.assign({},n,{$shared:!1}));const o=n.radius;return"active"!==e&&(n.radius=0),n.radius+=Qb(i&&i._custom,o),n}},DoughnutController:ak,LineController:class extends Qw{static id="line";static defaults={datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1};static overrides={scales:{_index_:{type:"category"},_value_:{type:"linear"}}};initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){const e=this._cachedMeta,{dataset:i,data:n=[],_dataset:o}=e,s=this.chart._animationsDisabled;let{start:r,count:a}=Y_(e,n,s);this._drawStart=r,this._drawCount=a,X_(e)&&(r=0,a=n.length),i._chart=this.chart,i._datasetIndex=this.index,i._decimated=!!o._decimated,i.points=n;const l=this.resolveDatasetElementOptions(t);this.options.showLine||(l.borderWidth=0),l.segment=this.options.segment,this.updateElement(i,void 0,{animated:!s,options:l},t),this.updateElements(n,r,a,t)}updateElements(t,e,i,n){const o="reset"===n,{iScale:s,vScale:r,_stacked:a,_dataset:l}=this._cachedMeta,{sharedOptions:c,includeOptions:h}=this._getSharedOptions(e,n),d=s.axis,u=r.axis,{spanGaps:p,segment:m}=this.options,f=A_(p)?p:Number.POSITIVE_INFINITY,g=this.chart._animationsDisabled||o||"none"===n,v=e+i,y=t.length;let b=e>0&&this.getParsed(e-1);for(let i=0;i<y;++i){const p=t[i],y=g?p:{};if(i<e||i>=v){y.skip=!0;continue}const _=this.getParsed(i),x=Gb(_[u]),w=y[d]=s.getPixelForValue(_[d],i),k=y[u]=o||x?r.getBasePixel():r.getPixelForValue(a?this.applyStack(r,_,a):_[u],i);y.skip=isNaN(w)||isNaN(k)||x,y.stop=i>0&&Math.abs(_[d]-b[d])>f,m&&(y.parsed=_,y.raw=l.data[i]),h&&(y.options=c||this.resolveDataElementOptions(i,p.active?"active":n)),g||this.updateElement(p,i,y,n),b=_}}getMaxOverflow(){const t=this._cachedMeta,e=t.dataset,i=e.options&&e.options.borderWidth||0,n=t.data||[];if(!n.length)return i;const o=n[0].size(this.resolveDataElementOptions(0)),s=n[n.length-1].size(this.resolveDataElementOptions(n.length-1));return Math.max(i,o,s)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}},PieController:class extends ak{static id="pie";static defaults={cutout:0,rotation:0,circumference:360,radius:"100%"}},PolarAreaController:lk,RadarController:class extends Qw{static id="radar";static defaults={datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:!0,elements:{line:{fill:"start"}}};static overrides={aspectRatio:1,scales:{r:{type:"radialLinear"}}};getLabelAndValue(t){const e=this._cachedMeta.vScale,i=this.getParsed(t);return{label:e.getLabels()[t],value:""+e.getLabelForValue(i[e.axis])}}parseObjectData(t,e,i,n){return ew.bind(this)(t,e,i,n)}update(t){const e=this._cachedMeta,i=e.dataset,n=e.data||[],o=e.iScale.getLabels();if(i.points=n,"resize"!==t){const e=this.resolveDatasetElementOptions(t);this.options.showLine||(e.borderWidth=0);const s={_loop:!0,_fullLoop:o.length===n.length,options:e};this.updateElement(i,void 0,s,t)}this.updateElements(n,0,n.length,t)}updateElements(t,e,i,n){const o=this._cachedMeta.rScale,s="reset"===n;for(let r=e;r<e+i;r++){const e=t[r],i=this.resolveDataElementOptions(r,e.active?"active":n),a=o.getPointPositionForValue(r,this.getParsed(r).r),l=s?o.xCenter:a.x,c=s?o.yCenter:a.y,h={x:l,y:c,angle:a.angle,skip:isNaN(l)||isNaN(c),options:i};this.updateElement(e,r,h,n)}}},ScatterController:class extends Qw{static id="scatter";static defaults={datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1};static overrides={interaction:{mode:"point"},scales:{x:{type:"linear"},y:{type:"linear"}}};getLabelAndValue(t){const e=this._cachedMeta,i=this.chart.data.labels||[],{xScale:n,yScale:o}=e,s=this.getParsed(t),r=n.getLabelForValue(s.x),a=o.getLabelForValue(s.y);return{label:i[t]||"",value:"("+r+", "+a+")"}}update(t){const e=this._cachedMeta,{data:i=[]}=e,n=this.chart._animationsDisabled;let{start:o,count:s}=Y_(e,i,n);if(this._drawStart=o,this._drawCount=s,X_(e)&&(o=0,s=i.length),this.options.showLine){this.datasetElementType||this.addElements();const{dataset:o,_dataset:s}=e;o._chart=this.chart,o._datasetIndex=this.index,o._decimated=!!s._decimated,o.points=i;const r=this.resolveDatasetElementOptions(t);r.segment=this.options.segment,this.updateElement(o,void 0,{animated:!n,options:r},t)}else this.datasetElementType&&(delete e.dataset,this.datasetElementType=!1);this.updateElements(i,o,s,t)}addElements(){const{showLine:t}=this.options;!this.datasetElementType&&t&&(this.datasetElementType=this.chart.registry.getElement("line")),super.addElements()}updateElements(t,e,i,n){const o="reset"===n,{iScale:s,vScale:r,_stacked:a,_dataset:l}=this._cachedMeta,c=this.resolveDataElementOptions(e,n),h=this.getSharedOptions(c),d=this.includeOptions(n,h),u=s.axis,p=r.axis,{spanGaps:m,segment:f}=this.options,g=A_(m)?m:Number.POSITIVE_INFINITY,v=this.chart._animationsDisabled||o||"none"===n;let y=e>0&&this.getParsed(e-1);for(let c=e;c<e+i;++c){const e=t[c],i=this.getParsed(c),m=v?e:{},b=Gb(i[p]),_=m[u]=s.getPixelForValue(i[u],c),x=m[p]=o||b?r.getBasePixel():r.getPixelForValue(a?this.applyStack(r,i,a):i[p],c);m.skip=isNaN(_)||isNaN(x)||b,m.stop=c>0&&Math.abs(i[u]-y[u])>g,f&&(m.parsed=i,m.raw=l.data[c]),d&&(m.options=h||this.resolveDataElementOptions(c,e.active?"active":n)),v||this.updateElement(e,c,m,n),y=i}this.updateSharedOptions(h,n,c)}getMaxOverflow(){const t=this._cachedMeta,e=t.data||[];if(!this.options.showLine){let t=0;for(let i=e.length-1;i>=0;--i)t=Math.max(t,e[i].size(this.resolveDataElementOptions(i))/2);return t>0&&t}const i=t.dataset,n=i.options&&i.options.borderWidth||0;if(!e.length)return n;const o=e[0].size(this.resolveDataElementOptions(0)),s=e[e.length-1].size(this.resolveDataElementOptions(e.length-1));return Math.max(n,o,s)/2}}});function hk(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class dk{static override(t){Object.assign(dk.prototype,t)}options;constructor(t){this.options=t||{}}init(){}formats(){return hk()}parse(){return hk()}format(){return hk()}add(){return hk()}diff(){return hk()}startOf(){return hk()}endOf(){return hk()}}var uk={_date:dk};function pk(t,e,i,n){const{controller:o,data:s,_sorted:r}=t,a=o._cachedMeta.iScale,l=t.dataset&&t.dataset.options?t.dataset.options.spanGaps:null;if(a&&e===a.axis&&"r"!==e&&r&&s.length){const r=a._reversePixels?F_:B_;if(!n){const n=r(s,e,i);if(l){const{vScale:e}=o._cachedMeta,{_parsed:i}=t,s=i.slice(0,n.lo+1).reverse().findIndex((t=>!Gb(t[e.axis])));n.lo-=Math.max(0,s);const r=i.slice(n.hi).findIndex((t=>!Gb(t[e.axis])));n.hi+=Math.max(0,r)}return n}if(o._sharedOptions){const t=s[0],n="function"==typeof t.getRange&&t.getRange(e);if(n){const t=r(s,e,i-n),o=r(s,e,i+n);return{lo:t.lo,hi:o.hi}}}}return{lo:0,hi:s.length-1}}function mk(t,e,i,n,o){const s=t.getSortedVisibleDatasetMetas(),r=i[e];for(let t=0,i=s.length;t<i;++t){const{index:i,data:a}=s[t],{lo:l,hi:c}=pk(s[t],e,r,o);for(let t=l;t<=c;++t){const e=a[t];e.skip||n(e,i,t)}}}function fk(t,e,i,n,o){const s=[];if(!o&&!t.isPointInArea(e))return s;return mk(t,i,e,(function(i,r,a){(o||wx(i,t.chartArea,0))&&i.inRange(e.x,e.y,n)&&s.push({element:i,datasetIndex:r,index:a})}),!0),s}function gk(t,e,i,n,o,s){let r=[];const a=function(t){const e=-1!==t.indexOf("x"),i=-1!==t.indexOf("y");return function(t,n){const o=e?Math.abs(t.x-n.x):0,s=i?Math.abs(t.y-n.y):0;return Math.sqrt(Math.pow(o,2)+Math.pow(s,2))}}(i);let l=Number.POSITIVE_INFINITY;return mk(t,i,e,(function(i,c,h){const d=i.inRange(e.x,e.y,o);if(n&&!d)return;const u=i.getCenterPoint(o);if(!(!!s||t.isPointInArea(u))&&!d)return;const p=a(e,u);p<l?(r=[{element:i,datasetIndex:c,index:h}],l=p):p===l&&r.push({element:i,datasetIndex:c,index:h})})),r}function vk(t,e,i,n,o,s){return s||t.isPointInArea(e)?"r"!==i||n?gk(t,e,i,n,o,s):function(t,e,i,n){let o=[];return mk(t,i,e,(function(t,i,s){const{startAngle:r,endAngle:a}=t.getProps(["startAngle","endAngle"],n),{angle:l}=D_(t,{x:e.x,y:e.y});z_(l,r,a)&&o.push({element:t,datasetIndex:i,index:s})})),o}(t,e,i,o):[]}function yk(t,e,i,n,o){const s=[],r="x"===i?"inXRange":"inYRange";let a=!1;return mk(t,i,e,((t,n,l)=>{t[r]&&t[r](e[i],o)&&(s.push({element:t,datasetIndex:n,index:l}),a=a||t.inRange(e.x,e.y,o))})),n&&!a?[]:s}var bk={evaluateInteractionItems:mk,modes:{index(t,e,i,n){const o=gw(e,t),s=i.axis||"x",r=i.includeInvisible||!1,a=i.intersect?fk(t,o,s,n,r):vk(t,o,s,!1,n,r),l=[];return a.length?(t.getSortedVisibleDatasetMetas().forEach((t=>{const e=a[0].index,i=t.data[e];i&&!i.skip&&l.push({element:i,datasetIndex:t.index,index:e})})),l):[]},dataset(t,e,i,n){const o=gw(e,t),s=i.axis||"xy",r=i.includeInvisible||!1;let a=i.intersect?fk(t,o,s,n,r):vk(t,o,s,!1,n,r);if(a.length>0){const e=a[0].datasetIndex,i=t.getDatasetMeta(e).data;a=[];for(let t=0;t<i.length;++t)a.push({element:i[t],datasetIndex:e,index:t})}return a},point:(t,e,i,n)=>fk(t,gw(e,t),i.axis||"xy",n,i.includeInvisible||!1),nearest(t,e,i,n){const o=gw(e,t),s=i.axis||"xy",r=i.includeInvisible||!1;return vk(t,o,s,i.intersect,n,r)},x:(t,e,i,n)=>yk(t,gw(e,t),"x",i.intersect,n),y:(t,e,i,n)=>yk(t,gw(e,t),"y",i.intersect,n)}};const _k=["left","top","right","bottom"];function xk(t,e){return t.filter((t=>t.pos===e))}function wk(t,e){return t.filter((t=>-1===_k.indexOf(t.pos)&&t.box.axis===e))}function kk(t,e){return t.sort(((t,i)=>{const n=e?i:t,o=e?t:i;return n.weight===o.weight?n.index-o.index:n.weight-o.weight}))}function Sk(t,e){const i=function(t){const e={};for(const i of t){const{stack:t,pos:n,stackWeight:o}=i;if(!t||!_k.includes(n))continue;const s=e[t]||(e[t]={count:0,placed:0,weight:0,size:0});s.count++,s.weight+=o}return e}(t),{vBoxMaxWidth:n,hBoxMaxHeight:o}=e;let s,r,a;for(s=0,r=t.length;s<r;++s){a=t[s];const{fullSize:r}=a.box,l=i[a.stack],c=l&&a.stackWeight/l.weight;a.horizontal?(a.width=c?c*n:r&&e.availableWidth,a.height=o):(a.width=n,a.height=c?c*o:r&&e.availableHeight)}return i}function Ck(t,e,i,n){return Math.max(t[i],e[i])+Math.max(t[n],e[n])}function Ek(t,e){t.top=Math.max(t.top,e.top),t.left=Math.max(t.left,e.left),t.bottom=Math.max(t.bottom,e.bottom),t.right=Math.max(t.right,e.right)}function Ak(t,e,i,n){const{pos:o,box:s}=i,r=t.maxPadding;if(!Yb(o)){i.size&&(t[o]-=i.size);const e=n[i.stack]||{size:0,count:1};e.size=Math.max(e.size,i.horizontal?s.height:s.width),i.size=e.size/e.count,t[o]+=i.size}s.getPadding&&Ek(r,s.getPadding());const a=Math.max(0,e.outerWidth-Ck(r,t,"left","right")),l=Math.max(0,e.outerHeight-Ck(r,t,"top","bottom")),c=a!==t.w,h=l!==t.h;return t.w=a,t.h=l,i.horizontal?{same:c,other:h}:{same:h,other:c}}function Mk(t,e){const i=e.maxPadding;function n(t){const n={left:0,top:0,right:0,bottom:0};return t.forEach((t=>{n[t]=Math.max(e[t],i[t])})),n}return n(t?["left","right"]:["top","bottom"])}function Tk(t,e,i,n){const o=[];let s,r,a,l,c,h;for(s=0,r=t.length,c=0;s<r;++s){a=t[s],l=a.box,l.update(a.width||e.w,a.height||e.h,Mk(a.horizontal,e));const{same:r,other:d}=Ak(e,i,a,n);c|=r&&o.length,h=h||d,l.fullSize||o.push(a)}return c&&Tk(o,e,i,n)||h}function Pk(t,e,i,n,o){t.top=i,t.left=e,t.right=e+n,t.bottom=i+o,t.width=n,t.height=o}function Ok(t,e,i,n){const o=i.padding;let{x:s,y:r}=e;for(const a of t){const t=a.box,l=n[a.stack]||{count:1,placed:0,weight:1},c=a.stackWeight/l.weight||1;if(a.horizontal){const n=e.w*c,s=l.size||t.height;u_(l.start)&&(r=l.start),t.fullSize?Pk(t,o.left,r,i.outerWidth-o.right-o.left,s):Pk(t,e.left+l.placed,r,n,s),l.start=r,l.placed+=n,r=t.bottom}else{const n=e.h*c,r=l.size||t.width;u_(l.start)&&(s=l.start),t.fullSize?Pk(t,s,o.top,r,i.outerHeight-o.bottom-o.top):Pk(t,s,e.top+l.placed,r,n),l.start=s,l.placed+=n,s=t.right}}e.x=s,e.y=r}var Dk={addBox(t,e){t.boxes||(t.boxes=[]),e.fullSize=e.fullSize||!1,e.position=e.position||"top",e.weight=e.weight||0,e._layers=e._layers||function(){return[{z:0,draw(t){e.draw(t)}}]},t.boxes.push(e)},removeBox(t,e){const i=t.boxes?t.boxes.indexOf(e):-1;-1!==i&&t.boxes.splice(i,1)},configure(t,e,i){e.fullSize=i.fullSize,e.position=i.position,e.weight=i.weight},update(t,e,i,n){if(!t)return;const o=Nx(t.options.layout.padding),s=Math.max(e-o.width,0),r=Math.max(i-o.height,0),a=function(t){const e=function(t){const e=[];let i,n,o,s,r,a;for(i=0,n=(t||[]).length;i<n;++i)o=t[i],({position:s,options:{stack:r,stackWeight:a=1}}=o),e.push({index:i,box:o,pos:s,horizontal:o.isHorizontal(),weight:o.weight,stack:r&&s+r,stackWeight:a});return e}(t),i=kk(e.filter((t=>t.box.fullSize)),!0),n=kk(xk(e,"left"),!0),o=kk(xk(e,"right")),s=kk(xk(e,"top"),!0),r=kk(xk(e,"bottom")),a=wk(e,"x"),l=wk(e,"y");return{fullSize:i,leftAndTop:n.concat(s),rightAndBottom:o.concat(l).concat(r).concat(a),chartArea:xk(e,"chartArea"),vertical:n.concat(o).concat(l),horizontal:s.concat(r).concat(a)}}(t.boxes),l=a.vertical,c=a.horizontal;e_(t.boxes,(t=>{"function"==typeof t.beforeLayout&&t.beforeLayout()}));const h=l.reduce(((t,e)=>e.box.options&&!1===e.box.options.display?t:t+1),0)||1,d=Object.freeze({outerWidth:e,outerHeight:i,padding:o,availableWidth:s,availableHeight:r,vBoxMaxWidth:s/2/h,hBoxMaxHeight:r/2}),u=Object.assign({},o);Ek(u,Nx(n));const p=Object.assign({maxPadding:u,w:s,h:r,x:o.left,y:o.top},o),m=Sk(l.concat(c),d);Tk(a.fullSize,p,d,m),Tk(l,p,d,m),Tk(c,p,d,m)&&Tk(l,p,d,m),function(t){const e=t.maxPadding;function i(i){const n=Math.max(e[i]-t[i],0);return t[i]+=n,n}t.y+=i("top"),t.x+=i("left"),i("right"),i("bottom")}(p),Ok(a.leftAndTop,p,d,m),p.x+=p.w,p.y+=p.h,Ok(a.rightAndBottom,p,d,m),t.chartArea={left:p.left,top:p.top,right:p.left+p.w,bottom:p.top+p.h,height:p.h,width:p.w},e_(a.chartArea,(e=>{const i=e.box;Object.assign(i,t.chartArea),i.update(p.w,p.h,{left:0,top:0,right:0,bottom:0})}))}};class Ik{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,i){}removeEventListener(t,e,i){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,i,n){return e=Math.max(0,e||t.width),i=i||t.height,{width:e,height:Math.max(0,n?Math.floor(e/n):i)}}isAttached(t){return!0}updateConfig(t){}}class Lk extends Ik{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const $k="$chartjs",zk={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},Rk=t=>null===t||""===t;const Nk=!!_w&&{passive:!0};function jk(t,e,i){t&&t.canvas&&t.canvas.removeEventListener(e,i,Nk)}function Bk(t,e){for(const i of t)if(i===e||i.contains(e))return!0}function Fk(t,e,i){const n=t.canvas,o=new MutationObserver((t=>{let e=!1;for(const i of t)e=e||Bk(i.addedNodes,n),e=e&&!Bk(i.removedNodes,n);e&&i()}));return o.observe(document,{childList:!0,subtree:!0}),o}function qk(t,e,i){const n=t.canvas,o=new MutationObserver((t=>{let e=!1;for(const i of t)e=e||Bk(i.removedNodes,n),e=e&&!Bk(i.addedNodes,n);e&&i()}));return o.observe(document,{childList:!0,subtree:!0}),o}const Vk=new Map;let Hk=0;function Uk(){const t=window.devicePixelRatio;t!==Hk&&(Hk=t,Vk.forEach(((e,i)=>{i.currentDevicePixelRatio!==t&&e()})))}function Wk(t,e,i){const n=t.canvas,o=n&&hw(n);if(!o)return;const s=W_(((t,e)=>{const n=o.clientWidth;i(t,e),n<o.clientWidth&&i()}),window),r=new ResizeObserver((t=>{const e=t[0],i=e.contentRect.width,n=e.contentRect.height;0===i&&0===n||s(i,n)}));return r.observe(o),function(t,e){Vk.size||window.addEventListener("resize",Uk),Vk.set(t,e)}(t,s),r}function Gk(t,e,i){i&&i.disconnect(),"resize"===e&&function(t){Vk.delete(t),Vk.size||window.removeEventListener("resize",Uk)}(t)}function Zk(t,e,i){const n=t.canvas,o=W_((e=>{null!==t.ctx&&i(function(t,e){const i=zk[t.type]||t.type,{x:n,y:o}=gw(t,e);return{type:i,chart:e,native:t,x:void 0!==n?n:null,y:void 0!==o?o:null}}(e,t))}),t);return function(t,e,i){t&&t.addEventListener(e,i,Nk)}(n,e,o),o}class Yk extends Ik{acquireContext(t,e){const i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(function(t,e){const i=t.style,n=t.getAttribute("height"),o=t.getAttribute("width");if(t[$k]={initial:{height:n,width:o,style:{display:i.display,height:i.height,width:i.width}}},i.display=i.display||"block",i.boxSizing=i.boxSizing||"border-box",Rk(o)){const e=xw(t,"width");void 0!==e&&(t.width=e)}if(Rk(n))if(""===t.style.height)t.height=t.width/(e||2);else{const e=xw(t,"height");void 0!==e&&(t.height=e)}}(t,e),i):null}releaseContext(t){const e=t.canvas;if(!e[$k])return!1;const i=e[$k].initial;["height","width"].forEach((t=>{const n=i[t];Gb(n)?e.removeAttribute(t):e.setAttribute(t,n)}));const n=i.style||{};return Object.keys(n).forEach((t=>{e.style[t]=n[t]})),e.width=e.width,delete e[$k],!0}addEventListener(t,e,i){this.removeEventListener(t,e);const n=t.$proxies||(t.$proxies={}),o={attach:Fk,detach:qk,resize:Wk}[e]||Zk;n[e]=o(t,e,i)}removeEventListener(t,e){const i=t.$proxies||(t.$proxies={}),n=i[e];if(!n)return;({attach:Gk,detach:Gk,resize:Gk}[e]||jk)(t,e,n),i[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,i,n){return yw(t,e,i,n)}isAttached(t){const e=t&&hw(t);return!(!e||!e.isConnected)}}let Xk=class{static defaults={};static defaultRoutes=void 0;x;y;active=!1;options;$animations;tooltipPosition(t){const{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}hasValue(){return A_(this.x)&&A_(this.y)}getProps(t,e){const i=this.$animations;if(!e||!i)return this;const n={};return t.forEach((t=>{n[t]=i[t]&&i[t].active()?i[t]._to:this[t]})),n}};function Kk(t,e){const i=t.options.ticks,n=function(t){const e=t.options.offset,i=t._tickSize(),n=t._length/i+(e?0:1),o=t._maxLength/i;return Math.floor(Math.min(n,o))}(t),o=Math.min(i.maxTicksLimit||n,n),s=i.major.enabled?function(t){const e=[];let i,n;for(i=0,n=t.length;i<n;i++)t[i].major&&e.push(i);return e}(e):[],r=s.length,a=s[0],l=s[r-1],c=[];if(r>o)return function(t,e,i,n){let o,s=0,r=i[0];for(n=Math.ceil(n),o=0;o<t.length;o++)o===r&&(e.push(t[o]),s++,r=i[s*n])}(e,c,s,r/o),c;const h=function(t,e,i){const n=function(t){const e=t.length;let i,n;if(e<2)return!1;for(n=t[0],i=1;i<e;++i)if(t[i]-t[i-1]!==n)return!1;return n}(t),o=e.length/i;if(!n)return Math.max(o,1);const s=function(t){const e=[],i=Math.sqrt(t);let n;for(n=1;n<i;n++)t%n==0&&(e.push(n),e.push(t/n));return i===(0|i)&&e.push(i),e.sort(((t,e)=>t-e)).pop(),e}(n);for(let t=0,e=s.length-1;t<e;t++){const e=s[t];if(e>o)return e}return Math.max(o,1)}(s,e,o);if(r>0){let t,i;const n=r>1?Math.round((l-a)/(r-1)):null;for(Qk(e,c,h,Gb(n)?0:a-n,a),t=0,i=r-1;t<i;t++)Qk(e,c,h,s[t],s[t+1]);return Qk(e,c,h,l,Gb(n)?e.length:l+n),c}return Qk(e,c,h),c}function Qk(t,e,i,n,o){const s=Qb(n,0),r=Math.min(Qb(o,t.length),t.length);let a,l,c,h=0;for(i=Math.ceil(i),o&&(a=o-n,i=a/Math.floor(a/i)),c=s;c<0;)h++,c=Math.round(s+h*i);for(l=Math.max(s,0);l<r;l++)l===c&&(e.push(t[l]),h++,c=Math.round(s+h*i))}const Jk=(t,e,i)=>"top"===e||"left"===e?t[e]+i:t[e]-i,tS=(t,e)=>Math.min(e||t,t);function eS(t,e){const i=[],n=t.length/e,o=t.length;let s=0;for(;s<o;s+=n)i.push(t[Math.floor(s)]);return i}function iS(t,e,i){const n=t.ticks.length,o=Math.min(e,n-1),s=t._startPixel,r=t._endPixel,a=1e-6;let l,c=t.getPixelForTick(o);if(!(i&&(l=1===n?Math.max(c-s,r-c):0===e?(t.getPixelForTick(1)-c)/2:(c-t.getPixelForTick(o-1))/2,c+=o<e?l:-l,c<s-a||c>r+a)))return c}function nS(t){return t.drawTicks?t.tickLength:0}function oS(t,e){if(!t.display)return 0;const i=jx(t.font,e),n=Nx(t.padding);return(Zb(t.text)?t.text.length:1)*i.lineHeight+n.height}function sS(t,e,i){let n=G_(t);return(i&&"right"!==e||!i&&"right"===e)&&(n=(t=>"left"===t?"right":"right"===t?"left":t)(n)),n}class rS extends Xk{constructor(t){super(),this.id=t.id,this.type=t.type,this.options=void 0,this.ctx=t.ctx,this.chart=t.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(t){this.options=t.setContext(this.getContext()),this.axis=t.axis,this._userMin=this.parse(t.min),this._userMax=this.parse(t.max),this._suggestedMin=this.parse(t.suggestedMin),this._suggestedMax=this.parse(t.suggestedMax)}parse(t,e){return t}getUserBounds(){let{_userMin:t,_userMax:e,_suggestedMin:i,_suggestedMax:n}=this;return t=Kb(t,Number.POSITIVE_INFINITY),e=Kb(e,Number.NEGATIVE_INFINITY),i=Kb(i,Number.POSITIVE_INFINITY),n=Kb(n,Number.NEGATIVE_INFINITY),{min:Kb(t,i),max:Kb(e,n),minDefined:Xb(t),maxDefined:Xb(e)}}getMinMax(t){let e,{min:i,max:n,minDefined:o,maxDefined:s}=this.getUserBounds();if(o&&s)return{min:i,max:n};const r=this.getMatchingVisibleMetas();for(let a=0,l=r.length;a<l;++a)e=r[a].controller.getMinMax(this,t),o||(i=Math.min(i,e.min)),s||(n=Math.max(n,e.max));return i=s&&i>n?n:i,n=o&&i>n?i:n,{min:Kb(i,Kb(n,i)),max:Kb(n,Kb(i,n))}}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(){t_(this.options.beforeUpdate,[this])}update(t,e,i){const{beginAtZero:n,grace:o,ticks:s}=this.options,r=s.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=i=Object.assign({left:0,right:0,top:0,bottom:0},i),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+i.left+i.right:this.height+i.top+i.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=function(t,e,i){const{min:n,max:o}=t,s=Jb(e,(o-n)/2),r=(t,e)=>i&&0===t?0:t+e;return{min:r(n,-Math.abs(s)),max:r(o,s)}}(this,o,n),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const a=r<this.ticks.length;this._convertTicksToLabels(a?eS(this.ticks,r):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),s.display&&(s.autoSkip||"auto"===s.source)&&(this.ticks=Kk(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),a&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let t,e,i=this.options.reverse;this.isHorizontal()?(t=this.left,e=this.right):(t=this.top,e=this.bottom,i=!i),this._startPixel=t,this._endPixel=e,this._reversePixels=i,this._length=e-t,this._alignToPixels=this.options.alignToPixels}afterUpdate(){t_(this.options.afterUpdate,[this])}beforeSetDimensions(){t_(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(){t_(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),t_(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){t_(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(t){const e=this.options.ticks;let i,n,o;for(i=0,n=t.length;i<n;i++)o=t[i],o.label=t_(e.callback,[o.value,i,t],this)}afterTickToLabelConversion(){t_(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){t_(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const t=this.options,e=t.ticks,i=tS(this.ticks.length,t.ticks.maxTicksLimit),n=e.minRotation||0,o=e.maxRotation;let s,r,a,l=n;if(!this._isVisible()||!e.display||n>=o||i<=1||!this.isHorizontal())return void(this.labelRotation=n);const c=this._getLabelSizes(),h=c.widest.width,d=c.highest.height,u=R_(this.chart.width-h,0,this.maxWidth);s=t.offset?this.maxWidth/i:u/(i-1),h+6>s&&(s=u/(i-(t.offset?.5:1)),r=this.maxHeight-nS(t.grid)-e.padding-oS(t.title,this.chart.options.font),a=Math.sqrt(h*h+d*d),l=P_(Math.min(Math.asin(R_((c.highest.height+6)/s,-1,1)),Math.asin(R_(r/a,-1,1))-Math.asin(R_(d/a,-1,1)))),l=Math.max(n,Math.min(o,l))),this.labelRotation=l}afterCalculateLabelRotation(){t_(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){t_(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:e,options:{ticks:i,title:n,grid:o}}=this,s=this._isVisible(),r=this.isHorizontal();if(s){const s=oS(n,e.options.font);if(r?(t.width=this.maxWidth,t.height=nS(o)+s):(t.height=this.maxHeight,t.width=nS(o)+s),i.display&&this.ticks.length){const{first:e,last:n,widest:o,highest:s}=this._getLabelSizes(),a=2*i.padding,l=T_(this.labelRotation),c=Math.cos(l),h=Math.sin(l);if(r){const e=i.mirror?0:h*o.width+c*s.height;t.height=Math.min(this.maxHeight,t.height+e+a)}else{const e=i.mirror?0:c*o.width+h*s.height;t.width=Math.min(this.maxWidth,t.width+e+a)}this._calculatePadding(e,n,h,c)}}this._handleMargins(),r?(this.width=this._length=e.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=e.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,e,i,n){const{ticks:{align:o,padding:s},position:r}=this.options,a=0!==this.labelRotation,l="top"!==r&&"x"===this.axis;if(this.isHorizontal()){const r=this.getPixelForTick(0)-this.left,c=this.right-this.getPixelForTick(this.ticks.length-1);let h=0,d=0;a?l?(h=n*t.width,d=i*e.height):(h=i*t.height,d=n*e.width):"start"===o?d=e.width:"end"===o?h=t.width:"inner"!==o&&(h=t.width/2,d=e.width/2),this.paddingLeft=Math.max((h-r+s)*this.width/(this.width-r),0),this.paddingRight=Math.max((d-c+s)*this.width/(this.width-c),0)}else{let i=e.height/2,n=t.height/2;"start"===o?(i=0,n=t.height):"end"===o&&(i=e.height,n=0),this.paddingTop=i+s,this.paddingBottom=n+s}}_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(){t_(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:e}=this.options;return"top"===e||"bottom"===e||"x"===t}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){let e,i;for(this.beforeTickToLabelConversion(),this.generateTickLabels(t),e=0,i=t.length;e<i;e++)Gb(t[e].label)&&(t.splice(e,1),i--,e--);this.afterTickToLabelConversion()}_getLabelSizes(){let t=this._labelSizes;if(!t){const e=this.options.ticks.sampleSize;let i=this.ticks;e<i.length&&(i=eS(i,e)),this._labelSizes=t=this._computeLabelSizes(i,i.length,this.options.ticks.maxTicksLimit)}return t}_computeLabelSizes(t,e,i){const{ctx:n,_longestTextCache:o}=this,s=[],r=[],a=Math.floor(e/tS(e,i));let l,c,h,d,u,p,m,f,g,v,y,b=0,_=0;for(l=0;l<e;l+=a){if(d=t[l].label,u=this._resolveTickFontOptions(l),n.font=p=u.string,m=o[p]=o[p]||{data:{},gc:[]},f=u.lineHeight,g=v=0,Gb(d)||Zb(d)){if(Zb(d))for(c=0,h=d.length;c<h;++c)y=d[c],Gb(y)||Zb(y)||(g=gx(n,m.data,m.gc,g,y),v+=f)}else g=gx(n,m.data,m.gc,g,d),v=f;s.push(g),r.push(v),b=Math.max(g,b),_=Math.max(v,_)}!function(t,e){e_(t,(t=>{const i=t.gc,n=i.length/2;let o;if(n>e){for(o=0;o<n;++o)delete t.data[i[o]];i.splice(0,n)}}))}(o,e);const x=s.indexOf(b),w=r.indexOf(_),k=t=>({width:s[t]||0,height:r[t]||0});return{first:k(0),last:k(e-1),widest:k(x),highest:k(w),widths:s,heights:r}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const e=this._startPixel+t*this._length;return R_(this._alignToPixels?yx(this.chart,e,0):e,-32768,32767)}getDecimalForPixel(t){const e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:e}=this;return t<0&&e<0?e:t>0&&e>0?t:0}getContext(t){const e=this.ticks||[];if(t>=0&&t<e.length){const i=e[t];return i.$context||(i.$context=function(t,e,i){return Fx(t,{tick:i,index:e,type:"tick"})}(this.getContext(),t,i))}return this.$context||(this.$context=Fx(this.chart.getContext(),{scale:this,type:"scale"}))}_tickSize(){const t=this.options.ticks,e=T_(this.labelRotation),i=Math.abs(Math.cos(e)),n=Math.abs(Math.sin(e)),o=this._getLabelSizes(),s=t.autoSkipPadding||0,r=o?o.widest.width+s:0,a=o?o.highest.height+s:0;return this.isHorizontal()?a*i>r*n?r/i:a/n:a*n<r*i?a/i:r/n}_isVisible(){const t=this.options.display;return"auto"!==t?!!t:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(t){const e=this.axis,i=this.chart,n=this.options,{grid:o,position:s,border:r}=n,a=o.offset,l=this.isHorizontal(),c=this.ticks.length+(a?1:0),h=nS(o),d=[],u=r.setContext(this.getContext()),p=u.display?u.width:0,m=p/2,f=function(t){return yx(i,t,p)};let g,v,y,b,_,x,w,k,S,C,E,A;if("top"===s)g=f(this.bottom),x=this.bottom-h,k=g-m,C=f(t.top)+m,A=t.bottom;else if("bottom"===s)g=f(this.top),C=t.top,A=f(t.bottom)-m,x=g+m,k=this.top+h;else if("left"===s)g=f(this.right),_=this.right-h,w=g-m,S=f(t.left)+m,E=t.right;else if("right"===s)g=f(this.left),S=t.left,E=f(t.right)-m,_=g+m,w=this.left+h;else if("x"===e){if("center"===s)g=f((t.top+t.bottom)/2+.5);else if(Yb(s)){const t=Object.keys(s)[0],e=s[t];g=f(this.chart.scales[t].getPixelForValue(e))}C=t.top,A=t.bottom,x=g+m,k=x+h}else if("y"===e){if("center"===s)g=f((t.left+t.right)/2);else if(Yb(s)){const t=Object.keys(s)[0],e=s[t];g=f(this.chart.scales[t].getPixelForValue(e))}_=g-m,w=_-h,S=t.left,E=t.right}const M=Qb(n.ticks.maxTicksLimit,c),T=Math.max(1,Math.ceil(c/M));for(v=0;v<c;v+=T){const t=this.getContext(v),e=o.setContext(t),n=r.setContext(t),s=e.lineWidth,c=e.color,h=n.dash||[],u=n.dashOffset,p=e.tickWidth,m=e.tickColor,f=e.tickBorderDash||[],g=e.tickBorderDashOffset;y=iS(this,v,a),void 0!==y&&(b=yx(i,y,s),l?_=w=S=E=b:x=k=C=A=b,d.push({tx1:_,ty1:x,tx2:w,ty2:k,x1:S,y1:C,x2:E,y2:A,width:s,color:c,borderDash:h,borderDashOffset:u,tickWidth:p,tickColor:m,tickBorderDash:f,tickBorderDashOffset:g}))}return this._ticksLength=c,this._borderValue=g,d}_computeLabelItems(t){const e=this.axis,i=this.options,{position:n,ticks:o}=i,s=this.isHorizontal(),r=this.ticks,{align:a,crossAlign:l,padding:c,mirror:h}=o,d=nS(i.grid),u=d+c,p=h?-c:u,m=-T_(this.labelRotation),f=[];let g,v,y,b,_,x,w,k,S,C,E,A,M="middle";if("top"===n)x=this.bottom-p,w=this._getXAxisLabelAlignment();else if("bottom"===n)x=this.top+p,w=this._getXAxisLabelAlignment();else if("left"===n){const t=this._getYAxisLabelAlignment(d);w=t.textAlign,_=t.x}else if("right"===n){const t=this._getYAxisLabelAlignment(d);w=t.textAlign,_=t.x}else if("x"===e){if("center"===n)x=(t.top+t.bottom)/2+u;else if(Yb(n)){const t=Object.keys(n)[0],e=n[t];x=this.chart.scales[t].getPixelForValue(e)+u}w=this._getXAxisLabelAlignment()}else if("y"===e){if("center"===n)_=(t.left+t.right)/2-u;else if(Yb(n)){const t=Object.keys(n)[0],e=n[t];_=this.chart.scales[t].getPixelForValue(e)}w=this._getYAxisLabelAlignment(d).textAlign}"y"===e&&("start"===a?M="top":"end"===a&&(M="bottom"));const T=this._getLabelSizes();for(g=0,v=r.length;g<v;++g){y=r[g],b=y.label;const t=o.setContext(this.getContext(g));k=this.getPixelForTick(g)+o.labelOffset,S=this._resolveTickFontOptions(g),C=S.lineHeight,E=Zb(b)?b.length:1;const e=E/2,i=t.color,a=t.textStrokeColor,c=t.textStrokeWidth;let d,u=w;if(s?(_=k,"inner"===w&&(u=g===v-1?this.options.reverse?"left":"right":0===g?this.options.reverse?"right":"left":"center"),A="top"===n?"near"===l||0!==m?-E*C+C/2:"center"===l?-T.highest.height/2-e*C+C:-T.highest.height+C/2:"near"===l||0!==m?C/2:"center"===l?T.highest.height/2-e*C:T.highest.height-E*C,h&&(A*=-1),0===m||t.showLabelBackdrop||(_+=C/2*Math.sin(m))):(x=k,A=(1-E)*C/2),t.showLabelBackdrop){const e=Nx(t.backdropPadding),i=T.heights[g],n=T.widths[g];let o=A-e.top,s=0-e.left;switch(M){case"middle":o-=i/2;break;case"bottom":o-=i}switch(w){case"center":s-=n/2;break;case"right":s-=n;break;case"inner":g===v-1?s-=n:g>0&&(s-=n/2)}d={left:s,top:o,width:n+e.width,height:i+e.height,color:t.backdropColor}}f.push({label:b,font:S,textOffset:A,options:{rotation:m,color:i,strokeColor:a,strokeWidth:c,textAlign:u,textBaseline:M,translation:[_,x],backdrop:d}})}return f}_getXAxisLabelAlignment(){const{position:t,ticks:e}=this.options;if(-T_(this.labelRotation))return"top"===t?"left":"right";let i="center";return"start"===e.align?i="left":"end"===e.align?i="right":"inner"===e.align&&(i="inner"),i}_getYAxisLabelAlignment(t){const{position:e,ticks:{crossAlign:i,mirror:n,padding:o}}=this.options,s=t+o,r=this._getLabelSizes().widest.width;let a,l;return"left"===e?n?(l=this.right+o,"near"===i?a="left":"center"===i?(a="center",l+=r/2):(a="right",l+=r)):(l=this.right-s,"near"===i?a="right":"center"===i?(a="center",l-=r/2):(a="left",l=this.left)):"right"===e?n?(l=this.left+o,"near"===i?a="right":"center"===i?(a="center",l-=r/2):(a="left",l-=r)):(l=this.left+s,"near"===i?a="left":"center"===i?(a="center",l+=r/2):(a="right",l=this.right)):a="right",{textAlign:a,x:l}}_computeLabelArea(){if(this.options.ticks.mirror)return;const t=this.chart,e=this.options.position;return"left"===e||"right"===e?{top:0,left:this.left,bottom:t.height,right:this.right}:"top"===e||"bottom"===e?{top:this.top,left:0,bottom:this.bottom,right:t.width}:void 0}drawBackground(){const{ctx:t,options:{backgroundColor:e},left:i,top:n,width:o,height:s}=this;e&&(t.save(),t.fillStyle=e,t.fillRect(i,n,o,s),t.restore())}getLineWidthForValue(t){const e=this.options.grid;if(!this._isVisible()||!e.display)return 0;const i=this.ticks.findIndex((e=>e.value===t));if(i>=0){return e.setContext(this.getContext(i)).lineWidth}return 0}drawGrid(t){const e=this.options.grid,i=this.ctx,n=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let o,s;const r=(t,e,n)=>{n.width&&n.color&&(i.save(),i.lineWidth=n.width,i.strokeStyle=n.color,i.setLineDash(n.borderDash||[]),i.lineDashOffset=n.borderDashOffset,i.beginPath(),i.moveTo(t.x,t.y),i.lineTo(e.x,e.y),i.stroke(),i.restore())};if(e.display)for(o=0,s=n.length;o<s;++o){const t=n[o];e.drawOnChartArea&&r({x:t.x1,y:t.y1},{x:t.x2,y:t.y2},t),e.drawTicks&&r({x:t.tx1,y:t.ty1},{x:t.tx2,y:t.ty2},{color:t.tickColor,width:t.tickWidth,borderDash:t.tickBorderDash,borderDashOffset:t.tickBorderDashOffset})}}drawBorder(){const{chart:t,ctx:e,options:{border:i,grid:n}}=this,o=i.setContext(this.getContext()),s=i.display?o.width:0;if(!s)return;const r=n.setContext(this.getContext(0)).lineWidth,a=this._borderValue;let l,c,h,d;this.isHorizontal()?(l=yx(t,this.left,s)-s/2,c=yx(t,this.right,r)+r/2,h=d=a):(h=yx(t,this.top,s)-s/2,d=yx(t,this.bottom,r)+r/2,l=c=a),e.save(),e.lineWidth=o.width,e.strokeStyle=o.color,e.beginPath(),e.moveTo(l,h),e.lineTo(c,d),e.stroke(),e.restore()}drawLabels(t){if(!this.options.ticks.display)return;const e=this.ctx,i=this._computeLabelArea();i&&kx(e,i);const n=this.getLabelItems(t);for(const t of n){const i=t.options,n=t.font;Tx(e,t.label,0,t.textOffset,n,i)}i&&Sx(e)}drawTitle(){const{ctx:t,options:{position:e,title:i,reverse:n}}=this;if(!i.display)return;const o=jx(i.font),s=Nx(i.padding),r=i.align;let a=o.lineHeight/2;"bottom"===e||"center"===e||Yb(e)?(a+=s.bottom,Zb(i.text)&&(a+=o.lineHeight*(i.text.length-1))):a+=s.top;const{titleX:l,titleY:c,maxWidth:h,rotation:d}=function(t,e,i,n){const{top:o,left:s,bottom:r,right:a,chart:l}=t,{chartArea:c,scales:h}=l;let d,u,p,m=0;const f=r-o,g=a-s;if(t.isHorizontal()){if(u=Z_(n,s,a),Yb(i)){const t=Object.keys(i)[0],n=i[t];p=h[t].getPixelForValue(n)+f-e}else p="center"===i?(c.bottom+c.top)/2+f-e:Jk(t,i,e);d=a-s}else{if(Yb(i)){const t=Object.keys(i)[0],n=i[t];u=h[t].getPixelForValue(n)-g+e}else u="center"===i?(c.left+c.right)/2-g+e:Jk(t,i,e);p=Z_(n,r,o),m="left"===i?-__:__}return{titleX:u,titleY:p,maxWidth:d,rotation:m}}(this,a,e,r);Tx(t,i.text,0,0,o,{color:i.color,maxWidth:h,rotation:d,textAlign:sS(r,e,n),textBaseline:"middle",translation:[l,c]})}draw(t){this._isVisible()&&(this.drawBackground(),this.drawGrid(t),this.drawBorder(),this.drawTitle(),this.drawLabels(t))}_layers(){const t=this.options,e=t.ticks&&t.ticks.z||0,i=Qb(t.grid&&t.grid.z,-1),n=Qb(t.border&&t.border.z,0);return this._isVisible()&&this.draw===rS.prototype.draw?[{z:i,draw:t=>{this.drawBackground(),this.drawGrid(t),this.drawTitle()}},{z:n,draw:()=>{this.drawBorder()}},{z:e,draw:t=>{this.drawLabels(t)}}]:[{z:e,draw:t=>{this.draw(t)}}]}getMatchingVisibleMetas(t){const e=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID",n=[];let o,s;for(o=0,s=e.length;o<s;++o){const s=e[o];s[i]!==this.id||t&&s.type!==t||n.push(s)}return n}_resolveTickFontOptions(t){return jx(this.options.ticks.setContext(this.getContext(t)).font)}_maxDigits(){const t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}}class aS{constructor(t,e,i){this.type=t,this.scope=e,this.override=i,this.items=Object.create(null)}isForType(t){return Object.prototype.isPrototypeOf.call(this.type.prototype,t.prototype)}register(t){const e=Object.getPrototypeOf(t);let i;(function(t){return"id"in t&&"defaults"in t})(e)&&(i=this.register(e));const n=this.items,o=t.id,s=this.scope+"."+o;if(!o)throw new Error("class does not have id: "+t);return o in n||(n[o]=t,function(t,e,i){const n=r_(Object.create(null),[i?fx.get(i):{},fx.get(e),t.defaults]);fx.set(e,n),t.defaultRoutes&&function(t,e){Object.keys(e).forEach((i=>{const n=i.split("."),o=n.pop(),s=[t].concat(n).join("."),r=e[i].split("."),a=r.pop(),l=r.join(".");fx.route(s,o,l,a)}))}(e,t.defaultRoutes);t.descriptors&&fx.describe(e,t.descriptors)}(t,s,i),this.override&&fx.override(t.id,t.overrides)),s}get(t){return this.items[t]}unregister(t){const e=this.items,i=t.id,n=this.scope;i in e&&delete e[i],n&&i in fx[n]&&(delete fx[n][i],this.override&&delete hx[i])}}class lS{constructor(){this.controllers=new aS(Qw,"datasets",!0),this.elements=new aS(Xk,"elements"),this.plugins=new aS(Object,"plugins"),this.scales=new aS(rS,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,e,i){[...e].forEach((e=>{const n=i||this._getRegistryForType(e);i||n.isForType(e)||n===this.plugins&&e.id?this._exec(t,n,e):e_(e,(e=>{const n=i||this._getRegistryForType(e);this._exec(t,n,e)}))}))}_exec(t,e,i){const n=d_(t);t_(i["before"+n],[],i),e[t](i),t_(i["after"+n],[],i)}_getRegistryForType(t){for(let e=0;e<this._typedRegistries.length;e++){const i=this._typedRegistries[e];if(i.isForType(t))return i}return this.plugins}_get(t,e,i){const n=e.get(t);if(void 0===n)throw new Error('"'+t+'" is not a registered '+i+".");return n}}var cS=new lS;class hS{constructor(){this._init=[]}notify(t,e,i,n){"beforeInit"===e&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install"));const o=n?this._descriptors(t).filter(n):this._descriptors(t),s=this._notify(o,t,e,i);return"afterDestroy"===e&&(this._notify(o,t,"stop"),this._notify(this._init,t,"uninstall")),s}_notify(t,e,i,n){n=n||{};for(const o of t){const t=o.plugin;if(!1===t_(t[i],[e,n,o.options],t)&&n.cancelable)return!1}return!0}invalidate(){Gb(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;const e=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),e}_createDescriptors(t,e){const i=t&&t.config,n=Qb(i.options&&i.options.plugins,{}),o=function(t){const e={},i=[],n=Object.keys(cS.plugins.items);for(let t=0;t<n.length;t++)i.push(cS.getPlugin(n[t]));const o=t.plugins||[];for(let t=0;t<o.length;t++){const n=o[t];-1===i.indexOf(n)&&(i.push(n),e[n.id]=!0)}return{plugins:i,localIds:e}}(i);return!1!==n||e?function(t,{plugins:e,localIds:i},n,o){const s=[],r=t.getContext();for(const a of e){const e=a.id,l=dS(n[e],o);null!==l&&s.push({plugin:a,options:uS(t.config,{plugin:a,local:i[e]},l,r)})}return s}(t,o,n,e):[]}_notifyStateChanges(t){const e=this._oldCache||[],i=this._cache,n=(t,e)=>t.filter((t=>!e.some((e=>t.plugin.id===e.plugin.id))));this._notify(n(e,i),t,"stop"),this._notify(n(i,e),t,"start")}}function dS(t,e){return e||!1!==t?!0===t?{}:t:null}function uS(t,{plugin:e,local:i},n,o){const s=t.pluginScopeKeys(e),r=t.getOptionScopes(n,s);return i&&e.defaults&&r.push(e.defaults),t.createResolver(r,o,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function pS(t,e){const i=fx.datasets[t]||{};return((e.datasets||{})[t]||{}).indexAxis||e.indexAxis||i.indexAxis||"x"}function mS(t){if("x"===t||"y"===t||"r"===t)return t}function fS(t,...e){if(mS(t))return t;for(const n of e){const e=n.axis||("top"===(i=n.position)||"bottom"===i?"x":"left"===i||"right"===i?"y":void 0)||t.length>1&&mS(t[0].toLowerCase());if(e)return e}var i;throw new Error(`Cannot determine type of '${t}' axis. Please provide 'axis' or 'position' option.`)}function gS(t,e,i){if(i[e+"AxisID"]===t)return{axis:e}}function vS(t,e){const i=hx[t.type]||{scales:{}},n=e.scales||{},o=pS(t.type,e),s=Object.create(null);return Object.keys(n).forEach((e=>{const r=n[e];if(!Yb(r))return console.error(`Invalid scale configuration for scale: ${e}`);if(r._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${e}`);const a=fS(e,r,function(t,e){if(e.data&&e.data.datasets){const i=e.data.datasets.filter((e=>e.xAxisID===t||e.yAxisID===t));if(i.length)return gS(t,"x",i[0])||gS(t,"y",i[0])}return{}}(e,t),fx.scales[r.type]),l=function(t,e){return t===e?"_index_":"_value_"}(a,o),c=i.scales||{};s[e]=a_(Object.create(null),[{axis:a},r,c[a],c[l]])})),t.data.datasets.forEach((i=>{const o=i.type||t.type,r=i.indexAxis||pS(o,e),a=(hx[o]||{}).scales||{};Object.keys(a).forEach((t=>{const e=function(t,e){let i=t;return"_index_"===t?i=e:"_value_"===t&&(i="x"===e?"y":"x"),i}(t,r),o=i[e+"AxisID"]||e;s[o]=s[o]||Object.create(null),a_(s[o],[{axis:e},n[o],a[t]])}))})),Object.keys(s).forEach((t=>{const e=s[t];a_(e,[fx.scales[e.type],fx.scale])})),s}function yS(t){const e=t.options||(t.options={});e.plugins=Qb(e.plugins,{}),e.scales=vS(t,e)}function bS(t){return(t=t||{}).datasets=t.datasets||[],t.labels=t.labels||[],t}const _S=new Map,xS=new Set;function wS(t,e){let i=_S.get(t);return i||(i=e(),_S.set(t,i),xS.add(i)),i}const kS=(t,e,i)=>{const n=h_(e,i);void 0!==n&&t.add(n)};class SS{constructor(t){this._config=function(t){return(t=t||{}).data=bS(t.data),yS(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=bS(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(),yS(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return wS(t,(()=>[[`datasets.${t}`,""]]))}datasetAnimationScopeKeys(t,e){return wS(`${t}.transition.${e}`,(()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]]))}datasetElementScopeKeys(t,e){return wS(`${t}-${e}`,(()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]]))}pluginScopeKeys(t){const e=t.id;return wS(`${this.type}-plugin-${e}`,(()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]]))}_cachedScopes(t,e){const i=this._scopeCache;let n=i.get(t);return n&&!e||(n=new Map,i.set(t,n)),n}getOptionScopes(t,e,i){const{options:n,type:o}=this,s=this._cachedScopes(t,i),r=s.get(e);if(r)return r;const a=new Set;e.forEach((e=>{t&&(a.add(t),e.forEach((e=>kS(a,t,e)))),e.forEach((t=>kS(a,n,t))),e.forEach((t=>kS(a,hx[o]||{},t))),e.forEach((t=>kS(a,fx,t))),e.forEach((t=>kS(a,dx,t)))}));const l=Array.from(a);return 0===l.length&&l.push(Object.create(null)),xS.has(e)&&s.set(e,l),l}chartOptionScopes(){const{options:t,type:e}=this;return[t,hx[e]||{},fx.datasets[e]||{},{type:e},fx,dx]}resolveNamedOptions(t,e,i,n=[""]){const o={$shared:!0},{resolver:s,subPrefixes:r}=CS(this._resolverCache,t,n);let a=s;if(function(t,e){const{isScriptable:i,isIndexable:n}=Hx(t);for(const o of e){const e=i(o),s=n(o),r=(s||e)&&t[o];if(e&&(p_(r)||ES(r))||s&&Zb(r))return!0}return!1}(s,e)){o.$shared=!1;a=Vx(s,i=p_(i)?i():i,this.createResolver(t,i,r))}for(const t of e)o[t]=a[t];return o}createResolver(t,e,i=[""],n){const{resolver:o}=CS(this._resolverCache,t,i);return Yb(e)?Vx(o,e,void 0,n):o}}function CS(t,e,i){let n=t.get(e);n||(n=new Map,t.set(e,n));const o=i.join();let s=n.get(o);if(!s){s={resolver:qx(e,i),subPrefixes:i.filter((t=>!t.toLowerCase().includes("hover")))},n.set(o,s)}return s}const ES=t=>Yb(t)&&Object.getOwnPropertyNames(t).some((e=>p_(t[e])));const AS=["top","bottom","left","right","chartArea"];function MS(t,e){return"top"===t||"bottom"===t||-1===AS.indexOf(t)&&"x"===e}function TS(t,e){return function(i,n){return i[t]===n[t]?i[e]-n[e]:i[t]-n[t]}}function PS(t){const e=t.chart,i=e.options.animation;e.notifyPlugins("afterRender"),t_(i&&i.onComplete,[t],e)}function OS(t){const e=t.chart,i=e.options.animation;t_(i&&i.onProgress,[t],e)}function DS(t){return cw()&&"string"==typeof t?t=document.getElementById(t):t&&t.length&&(t=t[0]),t&&t.canvas&&(t=t.canvas),t}const IS={},LS=t=>{const e=DS(t);return Object.values(IS).filter((t=>t.canvas===e)).pop()};function $S(t,e,i){const n=Object.keys(t);for(const o of n){const n=+o;if(n>=e){const s=t[o];delete t[o],(i>0||n>e)&&(t[n+i]=s)}}}function zS(t,e,i){return t.options.clip?t[i]:e[i]}class RS{static defaults=fx;static instances=IS;static overrides=hx;static registry=cS;static version="4.4.8";static getChart=LS;static register(...t){cS.add(...t),NS()}static unregister(...t){cS.remove(...t),NS()}constructor(t,e){const i=this.config=new SS(e),n=DS(t),o=LS(n);if(o)throw new Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas with ID '"+o.canvas.id+"' can be reused.");const s=i.createResolver(i.chartOptionScopes(),this.getContext());this.platform=new(i.platform||function(t){return!cw()||"undefined"!=typeof OffscreenCanvas&&t instanceof OffscreenCanvas?Lk:Yk}(n)),this.platform.updateConfig(i);const r=this.platform.acquireContext(n,s.aspectRatio),a=r&&r.canvas,l=a&&a.height,c=a&&a.width;this.id=Wb(),this.ctx=r,this.canvas=a,this.width=c,this.height=l,this._options=s,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 hS,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=function(t,e){let i;return function(...n){return e?(clearTimeout(i),i=setTimeout(t,e,n)):t.apply(this,n),e}}((t=>this.update(t)),s.resizeDelay||0),this._dataChanges=[],IS[this.id]=this,r&&a?(zw.listen(this,"complete",PS),zw.listen(this,"progress",OS),this._initialize(),this.attached&&this.update()):console.error("Failed to create chart: can't acquire context from the given item")}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:e},width:i,height:n,_aspectRatio:o}=this;return Gb(t)?e&&o?o:n?i/n:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return cS}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():bw(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return bx(this.canvas,this.ctx),this}stop(){return zw.stop(this),this}resize(t,e){zw.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){const i=this.options,n=this.canvas,o=i.maintainAspectRatio&&this.aspectRatio,s=this.platform.getMaximumSize(n,t,e,o),r=i.devicePixelRatio||this.platform.getDevicePixelRatio(),a=this.width?"resize":"attach";this.width=s.width,this.height=s.height,this._aspectRatio=this.aspectRatio,bw(this,r,!0)&&(this.notifyPlugins("resize",{size:s}),t_(i.onResize,[this,s],this),this.attached&&this._doResize(a)&&this.render())}ensureScalesHaveIDs(){e_(this.options.scales||{},((t,e)=>{t.id=e}))}buildOrUpdateScales(){const t=this.options,e=t.scales,i=this.scales,n=Object.keys(i).reduce(((t,e)=>(t[e]=!1,t)),{});let o=[];e&&(o=o.concat(Object.keys(e).map((t=>{const i=e[t],n=fS(t,i),o="r"===n,s="x"===n;return{options:i,dposition:o?"chartArea":s?"bottom":"left",dtype:o?"radialLinear":s?"category":"linear"}})))),e_(o,(e=>{const o=e.options,s=o.id,r=fS(s,o),a=Qb(o.type,e.dtype);void 0!==o.position&&MS(o.position,r)===MS(e.dposition)||(o.position=e.dposition),n[s]=!0;let l=null;if(s in i&&i[s].type===a)l=i[s];else{l=new(cS.getScale(a))({id:s,type:a,ctx:this.ctx,chart:this}),i[l.id]=l}l.init(o,t)})),e_(n,((t,e)=>{t||delete i[e]})),e_(i,(t=>{Dk.configure(this,t,t.options),Dk.addBox(this,t)}))}_updateMetasets(){const t=this._metasets,e=this.data.datasets.length,i=t.length;if(t.sort(((t,e)=>t.index-e.index)),i>e){for(let t=e;t<i;++t)this._destroyDatasetMeta(t);t.splice(e,i-e)}this._sortedMetasets=t.slice(0).sort(TS("order","index"))}_removeUnreferencedMetasets(){const{_metasets:t,data:{datasets:e}}=this;t.length>e.length&&delete this._stacks,t.forEach(((t,i)=>{0===e.filter((e=>e===t._dataset)).length&&this._destroyDatasetMeta(i)}))}buildOrUpdateControllers(){const t=[],e=this.data.datasets;let i,n;for(this._removeUnreferencedMetasets(),i=0,n=e.length;i<n;i++){const n=e[i];let o=this.getDatasetMeta(i);const s=n.type||this.config.type;if(o.type&&o.type!==s&&(this._destroyDatasetMeta(i),o=this.getDatasetMeta(i)),o.type=s,o.indexAxis=n.indexAxis||pS(s,this.options),o.order=n.order||0,o.index=i,o.label=""+n.label,o.visible=this.isDatasetVisible(i),o.controller)o.controller.updateIndex(i),o.controller.linkScales();else{const e=cS.getController(s),{datasetElementType:n,dataElementType:r}=fx.datasets[s];Object.assign(e,{dataElementType:cS.getElement(r),datasetElementType:n&&cS.getElement(n)}),o.controller=new e(this,i),t.push(o.controller)}}return this._updateMetasets(),t}_resetElements(){e_(this.data.datasets,((t,e)=>{this.getDatasetMeta(e).controller.reset()}),this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const e=this.config;e.update();const i=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),n=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),!1===this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0}))return;const o=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let s=0;for(let t=0,e=this.data.datasets.length;t<e;t++){const{controller:e}=this.getDatasetMeta(t),i=!n&&-1===o.indexOf(e);e.buildOrUpdateElements(i),s=Math.max(+e.getMaxOverflow(),s)}s=this._minPadding=i.layout.autoPadding?s:0,this._updateLayout(s),n||e_(o,(t=>{t.reset()})),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(TS("z","_idx"));const{_active:r,_lastEvent:a}=this;a?this._eventHandler(a,!0):r.length&&this._updateHoverStyles(r,r,!0),this.render()}_updateScales(){e_(this.scales,(t=>{Dk.removeBox(this,t)})),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,e=new Set(Object.keys(this._listeners)),i=new Set(t.events);m_(e,i)&&!!this._responsiveListeners===t.responsive||(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(const{method:i,start:n,count:o}of e){$S(t,n,"_removeElements"===i?-o:o)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const e=this.data.datasets.length,i=e=>new Set(t.filter((t=>t[0]===e)).map(((t,e)=>e+","+t.splice(1).join(",")))),n=i(0);for(let t=1;t<e;t++)if(!m_(n,i(t)))return;return Array.from(n).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;Dk.update(this,this.width,this.height,t);const e=this.chartArea,i=e.width<=0||e.height<=0;this._layers=[],e_(this.boxes,(t=>{i&&"chartArea"===t.position||(t.configure&&t.configure(),this._layers.push(...t._layers()))}),this),this._layers.forEach(((t,e)=>{t._idx=e})),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(!1!==this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})){for(let t=0,e=this.data.datasets.length;t<e;++t)this.getDatasetMeta(t).controller.configure();for(let e=0,i=this.data.datasets.length;e<i;++e)this._updateDataset(e,p_(t)?t({datasetIndex:e}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,e){const i=this.getDatasetMeta(t),n={meta:i,index:t,mode:e,cancelable:!0};!1!==this.notifyPlugins("beforeDatasetUpdate",n)&&(i.controller._update(e),n.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",n))}render(){!1!==this.notifyPlugins("beforeRender",{cancelable:!0})&&(zw.has(this)?this.attached&&!zw.running(this)&&zw.start(this):(this.draw(),PS({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){const{width:t,height:e}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(t,e)}if(this.clear(),this.width<=0||this.height<=0)return;if(!1===this.notifyPlugins("beforeDraw",{cancelable:!0}))return;const e=this._layers;for(t=0;t<e.length&&e[t].z<=0;++t)e[t].draw(this.chartArea);for(this._drawDatasets();t<e.length;++t)e[t].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(t){const e=this._sortedMetasets,i=[];let n,o;for(n=0,o=e.length;n<o;++n){const o=e[n];t&&!o.visible||i.push(o)}return i}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(!1===this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0}))return;const t=this.getSortedVisibleDatasetMetas();for(let e=t.length-1;e>=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const e=this.ctx,i=t._clip,n=!i.disabled,o=function(t,e){const{xScale:i,yScale:n}=t;return i&&n?{left:zS(i,e,"left"),right:zS(i,e,"right"),top:zS(n,e,"top"),bottom:zS(n,e,"bottom")}:e}(t,this.chartArea),s={meta:t,index:t.index,cancelable:!0};!1!==this.notifyPlugins("beforeDatasetDraw",s)&&(n&&kx(e,{left:!1===i.left?0:o.left-i.left,right:!1===i.right?this.width:o.right+i.right,top:!1===i.top?0:o.top-i.top,bottom:!1===i.bottom?this.height:o.bottom+i.bottom}),t.controller.draw(),n&&Sx(e),s.cancelable=!1,this.notifyPlugins("afterDatasetDraw",s))}isPointInArea(t){return wx(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,i,n){const o=bk.modes[e];return"function"==typeof o?o(this,t,i,n):[]}getDatasetMeta(t){const e=this.data.datasets[t],i=this._metasets;let n=i.filter((t=>t&&t._dataset===e)).pop();return n||(n={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:e&&e.order||0,index:t,_dataset:e,_parsed:[],_sorted:!1},i.push(n)),n}getContext(){return this.$context||(this.$context=Fx(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const e=this.data.datasets[t];if(!e)return!1;const i=this.getDatasetMeta(t);return"boolean"==typeof i.hidden?!i.hidden:!e.hidden}setDatasetVisibility(t,e){this.getDatasetMeta(t).hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,i){const n=i?"show":"hide",o=this.getDatasetMeta(t),s=o.controller._resolveAnimations(void 0,n);u_(e)?(o.data[e].hidden=!i,this.update()):(this.setDatasetVisibility(t,i),s.update(o,{visible:i}),this.update((e=>e.datasetIndex===t?n:void 0)))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){const e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),zw.remove(this),t=0,e=this.data.datasets.length;t<e;++t)this._destroyDatasetMeta(t)}destroy(){this.notifyPlugins("beforeDestroy");const{canvas:t,ctx:e}=this;this._stop(),this.config.clearCache(),t&&(this.unbindEvents(),bx(t,e),this.platform.releaseContext(e),this.canvas=null,this.ctx=null),delete IS[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...t){return this.canvas.toDataURL(...t)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){const t=this._listeners,e=this.platform,i=(i,n)=>{e.addEventListener(this,i,n),t[i]=n},n=(t,e,i)=>{t.offsetX=e,t.offsetY=i,this._eventHandler(t)};e_(this.options.events,(t=>i(t,n)))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,e=this.platform,i=(i,n)=>{e.addEventListener(this,i,n),t[i]=n},n=(i,n)=>{t[i]&&(e.removeEventListener(this,i,n),delete t[i])},o=(t,e)=>{this.canvas&&this.resize(t,e)};let s;const r=()=>{n("attach",r),this.attached=!0,this.resize(),i("resize",o),i("detach",s)};s=()=>{this.attached=!1,n("resize",o),this._stop(),this._resize(0,0),i("attach",r)},e.isAttached(this.canvas)?r():s()}unbindEvents(){e_(this._listeners,((t,e)=>{this.platform.removeEventListener(this,e,t)})),this._listeners={},e_(this._responsiveListeners,((t,e)=>{this.platform.removeEventListener(this,e,t)})),this._responsiveListeners=void 0}updateHoverStyle(t,e,i){const n=i?"set":"remove";let o,s,r,a;for("dataset"===e&&(o=this.getDatasetMeta(t[0].datasetIndex),o.controller["_"+n+"DatasetHoverStyle"]()),r=0,a=t.length;r<a;++r){s=t[r];const e=s&&this.getDatasetMeta(s.datasetIndex).controller;e&&e[n+"HoverStyle"](s.element,s.datasetIndex,s.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){const e=this._active||[],i=t.map((({datasetIndex:t,index:e})=>{const i=this.getDatasetMeta(t);if(!i)throw new Error("No dataset found at index "+t);return{datasetIndex:t,element:i.data[e],index:e}}));!i_(i,e)&&(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,e))}notifyPlugins(t,e,i){return this._plugins.notify(this,t,e,i)}isPluginEnabled(t){return 1===this._plugins._cache.filter((e=>e.plugin.id===t)).length}_updateHoverStyles(t,e,i){const n=this.options.hover,o=(t,e)=>t.filter((t=>!e.some((e=>t.datasetIndex===e.datasetIndex&&t.index===e.index)))),s=o(e,t),r=i?t:o(t,e);s.length&&this.updateHoverStyle(s,n.mode,!1),r.length&&n.mode&&this.updateHoverStyle(r,n.mode,!0)}_eventHandler(t,e){const i={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},n=e=>(e.options.events||this.options.events).includes(t.native.type);if(!1===this.notifyPlugins("beforeEvent",i,n))return;const o=this._handleEvent(t,e,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,n),(o||i.changed)&&this.render(),this}_handleEvent(t,e,i){const{_active:n=[],options:o}=this,s=e,r=this._getActiveElements(t,n,i,s),a=function(t){return"mouseup"===t.type||"click"===t.type||"contextmenu"===t.type}(t),l=function(t,e,i,n){return i&&"mouseout"!==t.type?n?e:t:null}(t,this._lastEvent,i,a);i&&(this._lastEvent=null,t_(o.onHover,[t,r,this],this),a&&t_(o.onClick,[t,r,this],this));const c=!i_(r,n);return(c||e)&&(this._active=r,this._updateHoverStyles(r,n,e)),this._lastEvent=l,c}_getActiveElements(t,e,i,n){if("mouseout"===t.type)return[];if(!i)return e;const o=this.options.hover;return this.getElementsAtEventForMode(t,o.mode,o,n)}}function NS(){return e_(RS.instances,(t=>t._plugins.invalidate()))}function jS(t,e,i,n){const o=$x(t.options.borderRadius,["outerStart","outerEnd","innerStart","innerEnd"]);const s=(i-e)/2,r=Math.min(s,n*e/2),a=t=>{const e=(i-Math.min(s,t))*n/2;return R_(t,0,Math.min(s,e))};return{outerStart:a(o.outerStart),outerEnd:a(o.outerEnd),innerStart:R_(o.innerStart,0,r),innerEnd:R_(o.innerEnd,0,r)}}function BS(t,e,i,n){return{x:i+t*Math.cos(e),y:n+t*Math.sin(e)}}function FS(t,e,i,n,o,s){const{x:r,y:a,startAngle:l,pixelMargin:c,innerRadius:h}=e,d=Math.max(e.outerRadius+n+i-c,0),u=h>0?h+n+i+c:0;let p=0;const m=o-l;if(n){const t=((h>0?h-n:0)+(d>0?d-n:0))/2;p=(m-(0!==t?m*t/(t+n):m))/2}const f=(m-Math.max(.001,m*d-i/f_)/d)/2,g=l+f+p,v=o-f-p,{outerStart:y,outerEnd:b,innerStart:_,innerEnd:x}=jS(e,u,d,v-g),w=d-y,k=d-b,S=g+y/w,C=v-b/k,E=u+_,A=u+x,M=g+_/E,T=v-x/A;if(t.beginPath(),s){const e=(S+C)/2;if(t.arc(r,a,d,S,e),t.arc(r,a,d,e,C),b>0){const e=BS(k,C,r,a);t.arc(e.x,e.y,b,C,v+__)}const i=BS(A,v,r,a);if(t.lineTo(i.x,i.y),x>0){const e=BS(A,T,r,a);t.arc(e.x,e.y,x,v+__,T+Math.PI)}const n=(v-x/u+(g+_/u))/2;if(t.arc(r,a,u,v-x/u,n,!0),t.arc(r,a,u,n,g+_/u,!0),_>0){const e=BS(E,M,r,a);t.arc(e.x,e.y,_,M+Math.PI,g-__)}const o=BS(w,g,r,a);if(t.lineTo(o.x,o.y),y>0){const e=BS(w,S,r,a);t.arc(e.x,e.y,y,g-__,S)}}else{t.moveTo(r,a);const e=Math.cos(S)*d+r,i=Math.sin(S)*d+a;t.lineTo(e,i);const n=Math.cos(C)*d+r,o=Math.sin(C)*d+a;t.lineTo(n,o)}t.closePath()}function qS(t,e,i,n,o){const{fullCircles:s,startAngle:r,circumference:a,options:l}=e,{borderWidth:c,borderJoinStyle:h,borderDash:d,borderDashOffset:u}=l,p="inner"===l.borderAlign;if(!c)return;t.setLineDash(d||[]),t.lineDashOffset=u,p?(t.lineWidth=2*c,t.lineJoin=h||"round"):(t.lineWidth=c,t.lineJoin=h||"bevel");let m=e.endAngle;if(s){FS(t,e,i,n,m,o);for(let e=0;e<s;++e)t.stroke();isNaN(a)||(m=r+(a%g_||g_))}p&&function(t,e,i){const{startAngle:n,pixelMargin:o,x:s,y:r,outerRadius:a,innerRadius:l}=e;let c=o/a;t.beginPath(),t.arc(s,r,a,n-c,i+c),l>o?(c=o/l,t.arc(s,r,l,i+c,n-c,!0)):t.arc(s,r,o,i+__,n-__),t.closePath(),t.clip()}(t,e,m),s||(FS(t,e,i,n,m,o),t.stroke())}function VS(t,e,i=e){t.lineCap=Qb(i.borderCapStyle,e.borderCapStyle),t.setLineDash(Qb(i.borderDash,e.borderDash)),t.lineDashOffset=Qb(i.borderDashOffset,e.borderDashOffset),t.lineJoin=Qb(i.borderJoinStyle,e.borderJoinStyle),t.lineWidth=Qb(i.borderWidth,e.borderWidth),t.strokeStyle=Qb(i.borderColor,e.borderColor)}function HS(t,e,i){t.lineTo(i.x,i.y)}function US(t,e,i={}){const n=t.length,{start:o=0,end:s=n-1}=i,{start:r,end:a}=e,l=Math.max(o,r),c=Math.min(s,a),h=o<r&&s<r||o>a&&s>a;return{count:n,start:l,loop:e.loop,ilen:c<l&&!h?n+c-l:c-l}}function WS(t,e,i,n){const{points:o,options:s}=e,{count:r,start:a,loop:l,ilen:c}=US(o,i,n),h=function(t){return t.stepped?Cx:t.tension||"monotone"===t.cubicInterpolationMode?Ex:HS}(s);let d,u,p,{move:m=!0,reverse:f}=n||{};for(d=0;d<=c;++d)u=o[(a+(f?c-d:d))%r],u.skip||(m?(t.moveTo(u.x,u.y),m=!1):h(t,p,u,f,s.stepped),p=u);return l&&(u=o[(a+(f?c:0))%r],h(t,p,u,f,s.stepped)),!!l}function GS(t,e,i,n){const o=e.points,{count:s,start:r,ilen:a}=US(o,i,n),{move:l=!0,reverse:c}=n||{};let h,d,u,p,m,f,g=0,v=0;const y=t=>(r+(c?a-t:t))%s,b=()=>{p!==m&&(t.lineTo(g,m),t.lineTo(g,p),t.lineTo(g,f))};for(l&&(d=o[y(0)],t.moveTo(d.x,d.y)),h=0;h<=a;++h){if(d=o[y(h)],d.skip)continue;const e=d.x,i=d.y,n=0|e;n===u?(i<p?p=i:i>m&&(m=i),g=(v*g+e)/++v):(b(),t.lineTo(e,i),u=n,v=0,p=m=i),f=i}b()}function ZS(t){const e=t.options,i=e.borderDash&&e.borderDash.length;return!(t._decimated||t._loop||e.tension||"monotone"===e.cubicInterpolationMode||e.stepped||i)?GS:WS}const YS="function"==typeof Path2D;function XS(t,e,i,n){YS&&!e.options.segment?function(t,e,i,n){let o=e._path;o||(o=e._path=new Path2D,e.path(o,i,n)&&o.closePath()),VS(t,e.options),t.stroke(o)}(t,e,i,n):function(t,e,i,n){const{segments:o,options:s}=e,r=ZS(e);for(const a of o)VS(t,s,a.style),t.beginPath(),r(t,e,a,{start:i,end:i+n-1})&&t.closePath(),t.stroke()}(t,e,i,n)}class KS extends Xk{static id="line";static defaults={borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};static descriptors={_scriptable:!0,_indexable:t=>"borderDash"!==t&&"fill"!==t};constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,e){const i=this.options;if((i.tension||"monotone"===i.cubicInterpolationMode)&&!i.stepped&&!this._pointsUpdated){const n=i.spanGaps?this._loop:this._fullLoop;lw(this._points,i,t,n,e),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=function(t,e){const i=t.points,n=t.options.spanGaps,o=i.length;if(!o)return[];const s=!!t._loop,{start:r,end:a}=function(t,e,i,n){let o=0,s=e-1;if(i&&!n)for(;o<e&&!t[o].skip;)o++;for(;o<e&&t[o].skip;)o++;for(o%=e,i&&(s+=o);s>o&&t[s%e].skip;)s--;return s%=e,{start:o,end:s}}(i,o,s,n);return Dw(t,!0===n?[{start:r,end:a,loop:s}]:function(t,e,i,n){const o=t.length,s=[];let r,a=e,l=t[e];for(r=e+1;r<=i;++r){const i=t[r%o];i.skip||i.stop?l.skip||(n=!1,s.push({start:e%o,end:(r-1)%o,loop:n}),e=a=i.stop?r:null):(a=r,l.skip&&(e=r)),l=i}return null!==a&&s.push({start:e%o,end:a%o,loop:n}),s}(i,r,a<r?a+o:a,!!t._fullLoop&&0===r&&a===o-1),i,e)}(this,this.options.segment))}first(){const t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){const t=this.segments,e=this.points,i=t.length;return i&&e[t[i-1].end]}interpolate(t,e){const i=this.options,n=t[e],o=this.points,s=Ow(this,{property:e,start:n,end:n});if(!s.length)return;const r=[],a=function(t){return t.stepped?kw:t.tension||"monotone"===t.cubicInterpolationMode?Sw:ww}(i);let l,c;for(l=0,c=s.length;l<c;++l){const{start:c,end:h}=s[l],d=o[c],u=o[h];if(d===u){r.push(d);continue}const p=a(d,u,Math.abs((n-d[e])/(u[e]-d[e])),i.stepped);p[e]=t[e],r.push(p)}return 1===r.length?r[0]:r}pathSegment(t,e,i){return ZS(this)(t,this,e,i)}path(t,e,i){const n=this.segments,o=ZS(this);let s=this._loop;e=e||0,i=i||this.points.length-e;for(const r of n)s&=o(t,this,r,{start:e,end:e+i-1});return!!s}draw(t,e,i,n){const o=this.options||{};(this.points||[]).length&&o.borderWidth&&(t.save(),XS(t,this,i,n),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}function QS(t,e,i,n){const o=t.options,{[i]:s}=t.getProps([i],n);return Math.abs(e-s)<o.radius+o.hitRadius}function JS(t,e){const{x:i,y:n,base:o,width:s,height:r}=t.getProps(["x","y","base","width","height"],e);let a,l,c,h,d;return t.horizontal?(d=r/2,a=Math.min(i,o),l=Math.max(i,o),c=n-d,h=n+d):(d=s/2,a=i-d,l=i+d,c=Math.min(n,o),h=Math.max(n,o)),{left:a,top:c,right:l,bottom:h}}function tC(t,e,i,n){return t?0:R_(e,i,n)}function eC(t){const e=JS(t),i=e.right-e.left,n=e.bottom-e.top,o=function(t,e,i){const n=t.options.borderWidth,o=t.borderSkipped,s=zx(n);return{t:tC(o.top,s.top,0,i),r:tC(o.right,s.right,0,e),b:tC(o.bottom,s.bottom,0,i),l:tC(o.left,s.left,0,e)}}(t,i/2,n/2),s=function(t,e,i){const{enableBorderRadius:n}=t.getProps(["enableBorderRadius"]),o=t.options.borderRadius,s=Rx(o),r=Math.min(e,i),a=t.borderSkipped,l=n||Yb(o);return{topLeft:tC(!l||a.top||a.left,s.topLeft,0,r),topRight:tC(!l||a.top||a.right,s.topRight,0,r),bottomLeft:tC(!l||a.bottom||a.left,s.bottomLeft,0,r),bottomRight:tC(!l||a.bottom||a.right,s.bottomRight,0,r)}}(t,i/2,n/2);return{outer:{x:e.left,y:e.top,w:i,h:n,radius:s},inner:{x:e.left+o.l,y:e.top+o.t,w:i-o.l-o.r,h:n-o.t-o.b,radius:{topLeft:Math.max(0,s.topLeft-Math.max(o.t,o.l)),topRight:Math.max(0,s.topRight-Math.max(o.t,o.r)),bottomLeft:Math.max(0,s.bottomLeft-Math.max(o.b,o.l)),bottomRight:Math.max(0,s.bottomRight-Math.max(o.b,o.r))}}}}function iC(t,e,i,n){const o=null===e,s=null===i,r=t&&!(o&&s)&&JS(t,n);return r&&(o||N_(e,r.left,r.right))&&(s||N_(i,r.top,r.bottom))}function nC(t,e){t.rect(e.x,e.y,e.w,e.h)}function oC(t,e,i={}){const n=t.x!==i.x?-e:0,o=t.y!==i.y?-e:0,s=(t.x+t.w!==i.x+i.w?e:0)-n,r=(t.y+t.h!==i.y+i.h?e:0)-o;return{x:t.x+n,y:t.y+o,w:t.w+s,h:t.h+r,radius:t.radius}}var sC=Object.freeze({__proto__:null,ArcElement:class extends Xk{static id="arc";static defaults={borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0};static defaultRoutes={backgroundColor:"backgroundColor"};static descriptors={_scriptable:!0,_indexable:t=>"borderDash"!==t};circumference;endAngle;fullCircles;innerRadius;outerRadius;pixelMargin;startAngle;constructor(t){super(),this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,t&&Object.assign(this,t)}inRange(t,e,i){const n=this.getProps(["x","y"],i),{angle:o,distance:s}=D_(n,{x:t,y:e}),{startAngle:r,endAngle:a,innerRadius:l,outerRadius:c,circumference:h}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],i),d=(this.options.spacing+this.options.borderWidth)/2,u=Qb(h,a-r),p=z_(o,r,a)&&r!==a,m=u>=g_||p,f=N_(s,l+d,c+d);return m&&f}getCenterPoint(t){const{x:e,y:i,startAngle:n,endAngle:o,innerRadius:s,outerRadius:r}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],t),{offset:a,spacing:l}=this.options,c=(n+o)/2,h=(s+r+l+a)/2;return{x:e+Math.cos(c)*h,y:i+Math.sin(c)*h}}tooltipPosition(t){return this.getCenterPoint(t)}draw(t){const{options:e,circumference:i}=this,n=(e.offset||0)/4,o=(e.spacing||0)/2,s=e.circular;if(this.pixelMargin="inner"===e.borderAlign?.33:0,this.fullCircles=i>g_?Math.floor(i/g_):0,0===i||this.innerRadius<0||this.outerRadius<0)return;t.save();const r=(this.startAngle+this.endAngle)/2;t.translate(Math.cos(r)*n,Math.sin(r)*n);const a=n*(1-Math.sin(Math.min(f_,i||0)));t.fillStyle=e.backgroundColor,t.strokeStyle=e.borderColor,function(t,e,i,n,o){const{fullCircles:s,startAngle:r,circumference:a}=e;let l=e.endAngle;if(s){FS(t,e,i,n,l,o);for(let e=0;e<s;++e)t.fill();isNaN(a)||(l=r+(a%g_||g_))}FS(t,e,i,n,l,o),t.fill()}(t,this,a,o,s),qS(t,this,a,o,s),t.restore()}},BarElement:class extends Xk{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:e,options:{borderColor:i,backgroundColor:n}}=this,{inner:o,outer:s}=eC(this),r=(a=s.radius).topLeft||a.topRight||a.bottomLeft||a.bottomRight?Px:nC;var a;t.save(),s.w===o.w&&s.h===o.h||(t.beginPath(),r(t,oC(s,e,o)),t.clip(),r(t,oC(o,-e,s)),t.fillStyle=i,t.fill("evenodd")),t.beginPath(),r(t,oC(o,e)),t.fillStyle=n,t.fill(),t.restore()}inRange(t,e,i){return iC(this,t,e,i)}inXRange(t,e){return iC(this,t,null,e)}inYRange(t,e){return iC(this,null,t,e)}getCenterPoint(t){const{x:e,y:i,base:n,horizontal:o}=this.getProps(["x","y","base","horizontal"],t);return{x:o?(e+n)/2:e,y:o?i:(i+n)/2}}getRange(t){return"x"===t?this.width/2:this.height/2}},LineElement:KS,PointElement:class extends Xk{static id="point";parsed;skip;stop;static defaults={borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(t){super(),this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,t&&Object.assign(this,t)}inRange(t,e,i){const n=this.options,{x:o,y:s}=this.getProps(["x","y"],i);return Math.pow(t-o,2)+Math.pow(e-s,2)<Math.pow(n.hitRadius+n.radius,2)}inXRange(t,e){return QS(this,t,"x",e)}inYRange(t,e){return QS(this,t,"y",e)}getCenterPoint(t){const{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}size(t){let e=(t=t||this.options||{}).radius||0;e=Math.max(e,e&&t.hoverRadius||0);return 2*(e+(e&&t.borderWidth||0))}draw(t,e){const i=this.options;this.skip||i.radius<.1||!wx(this,e,this.size(i)/2)||(t.strokeStyle=i.borderColor,t.lineWidth=i.borderWidth,t.fillStyle=i.backgroundColor,_x(t,i,this.x,this.y))}getRange(){const t=this.options||{};return t.radius+t.hitRadius}}});const rC=["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)"],aC=rC.map((t=>t.replace("rgb(","rgba(").replace(")",", 0.5)")));function lC(t){return rC[t%rC.length]}function cC(t){return aC[t%aC.length]}function hC(t){let e=0;return(i,n)=>{const o=t.getDatasetMeta(n).controller;o instanceof ak?e=function(t,e){return t.backgroundColor=t.data.map((()=>lC(e++))),e}(i,e):o instanceof lk?e=function(t,e){return t.backgroundColor=t.data.map((()=>cC(e++))),e}(i,e):o&&(e=function(t,e){return t.borderColor=lC(e),t.backgroundColor=cC(e),++e}(i,e))}}function dC(t){let e;for(e in t)if(t[e].borderColor||t[e].backgroundColor)return!0;return!1}var uC={id:"colors",defaults:{enabled:!0,forceOverride:!1},beforeLayout(t,e,i){if(!i.enabled)return;const{data:{datasets:n},options:o}=t.config,{elements:s}=o,r=dC(n)||(a=o)&&(a.borderColor||a.backgroundColor)||s&&dC(s)||"rgba(0,0,0,0.1)"!==fx.borderColor||"rgba(0,0,0,0.1)"!==fx.backgroundColor;var a;if(!i.forceOverride&&r)return;const l=hC(t);n.forEach(l)}};function pC(t){if(t._decimated){const e=t._data;delete t._decimated,delete t._data,Object.defineProperty(t,"data",{configurable:!0,enumerable:!0,writable:!0,value:e})}}function mC(t){t.data.datasets.forEach((t=>{pC(t)}))}var fC={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(t,e,i)=>{if(!i.enabled)return void mC(t);const n=t.width;t.data.datasets.forEach(((e,o)=>{const{_data:s,indexAxis:r}=e,a=t.getDatasetMeta(o),l=s||e.data;if("y"===Bx([r,t.options.indexAxis]))return;if(!a.controller.supportsDecimation)return;const c=t.scales[a.xAxisID];if("linear"!==c.type&&"time"!==c.type)return;if(t.options.parsing)return;let{start:h,count:d}=function(t,e){const i=e.length;let n,o=0;const{iScale:s}=t,{min:r,max:a,minDefined:l,maxDefined:c}=s.getUserBounds();return l&&(o=R_(B_(e,s.axis,r).lo,0,i-1)),n=c?R_(B_(e,s.axis,a).hi+1,o,i)-o:i-o,{start:o,count:n}}(a,l);if(d<=(i.threshold||4*n))return void pC(e);let u;switch(Gb(s)&&(e._data=l,delete e.data,Object.defineProperty(e,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(t){this._data=t}})),i.algorithm){case"lttb":u=function(t,e,i,n,o){const s=o.samples||n;if(s>=i)return t.slice(e,e+i);const r=[],a=(i-2)/(s-2);let l=0;const c=e+i-1;let h,d,u,p,m,f=e;for(r[l++]=t[f],h=0;h<s-2;h++){let n,o=0,s=0;const c=Math.floor((h+1)*a)+1+e,g=Math.min(Math.floor((h+2)*a)+1,i)+e,v=g-c;for(n=c;n<g;n++)o+=t[n].x,s+=t[n].y;o/=v,s/=v;const y=Math.floor(h*a)+1+e,b=Math.min(Math.floor((h+1)*a)+1,i)+e,{x:_,y:x}=t[f];for(u=p=-1,n=y;n<b;n++)p=.5*Math.abs((_-o)*(t[n].y-x)-(_-t[n].x)*(s-x)),p>u&&(u=p,d=t[n],m=n);r[l++]=d,f=m}return r[l++]=t[c],r}(l,h,d,n,i);break;case"min-max":u=function(t,e,i,n){let o,s,r,a,l,c,h,d,u,p,m=0,f=0;const g=[],v=e+i-1,y=t[e].x,b=t[v].x-y;for(o=e;o<e+i;++o){s=t[o],r=(s.x-y)/b*n,a=s.y;const e=0|r;if(e===l)a<u?(u=a,c=o):a>p&&(p=a,h=o),m=(f*m+s.x)/++f;else{const i=o-1;if(!Gb(c)&&!Gb(h)){const e=Math.min(c,h),n=Math.max(c,h);e!==d&&e!==i&&g.push({...t[e],x:m}),n!==d&&n!==i&&g.push({...t[n],x:m})}o>0&&i!==d&&g.push(t[i]),g.push(s),l=e,f=0,u=p=a,c=h=d=o}}return g}(l,h,d,n);break;default:throw new Error(`Unsupported decimation algorithm '${i.algorithm}'`)}e._decimated=u}))},destroy(t){mC(t)}};function gC(t,e,i,n){if(n)return;let o=e[t],s=i[t];return"angle"===t&&(o=$_(o),s=$_(s)),{property:t,start:o,end:s}}function vC(t,e,i){for(;e>t;e--){const t=i[e];if(!isNaN(t.x)&&!isNaN(t.y))break}return e}function yC(t,e,i,n){return t&&e?n(t[i],e[i]):t?t[i]:e?e[i]:0}function bC(t,e){let i=[],n=!1;return Zb(t)?(n=!0,i=t):i=function(t,e){const{x:i=null,y:n=null}=t||{},o=e.points,s=[];return e.segments.forEach((({start:t,end:e})=>{e=vC(t,e,o);const r=o[t],a=o[e];null!==n?(s.push({x:r.x,y:n}),s.push({x:a.x,y:n})):null!==i&&(s.push({x:i,y:r.y}),s.push({x:i,y:a.y}))})),s}(t,e),i.length?new KS({points:i,options:{tension:0},_loop:n,_fullLoop:n}):null}function _C(t){return t&&!1!==t.fill}function xC(t,e,i){let n=t[e].fill;const o=[e];let s;if(!i)return n;for(;!1!==n&&-1===o.indexOf(n);){if(!Xb(n))return n;if(s=t[n],!s)return!1;if(s.visible)return n;o.push(n),n=s.fill}return!1}function wC(t,e,i){const n=function(t){const e=t.options,i=e.fill;let n=Qb(i&&i.target,i);void 0===n&&(n=!!e.backgroundColor);if(!1===n||null===n)return!1;if(!0===n)return"origin";return n}(t);if(Yb(n))return!isNaN(n.value)&&n;let o=parseFloat(n);return Xb(o)&&Math.floor(o)===o?function(t,e,i,n){"-"!==t&&"+"!==t||(i=e+i);if(i===e||i<0||i>=n)return!1;return i}(n[0],e,o,i):["origin","start","end","stack","shape"].indexOf(n)>=0&&n}function kC(t,e,i){const n=[];for(let o=0;o<i.length;o++){const s=i[o],{first:r,last:a,point:l}=SC(s,e,"x");if(!(!l||r&&a))if(r)n.unshift(l);else if(t.push(l),!a)break}t.push(...n)}function SC(t,e,i){const n=t.interpolate(e,i);if(!n)return{};const o=n[i],s=t.segments,r=t.points;let a=!1,l=!1;for(let t=0;t<s.length;t++){const e=s[t],n=r[e.start][i],c=r[e.end][i];if(N_(o,n,c)){a=o===n,l=o===c;break}}return{first:a,last:l,point:n}}class CC{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius}pathSegment(t,e,i){const{x:n,y:o,radius:s}=this;return e=e||{start:0,end:g_},t.arc(n,o,s,e.end,e.start,!0),!i.bounds}interpolate(t){const{x:e,y:i,radius:n}=this,o=t.angle;return{x:e+Math.cos(o)*n,y:i+Math.sin(o)*n,angle:o}}}function EC(t){const{chart:e,fill:i,line:n}=t;if(Xb(i))return function(t,e){const i=t.getDatasetMeta(e),n=i&&t.isDatasetVisible(e);return n?i.dataset:null}(e,i);if("stack"===i)return function(t){const{scale:e,index:i,line:n}=t,o=[],s=n.segments,r=n.points,a=function(t,e){const i=[],n=t.getMatchingVisibleMetas("line");for(let t=0;t<n.length;t++){const o=n[t];if(o.index===e)break;o.hidden||i.unshift(o.dataset)}return i}(e,i);a.push(bC({x:null,y:e.bottom},n));for(let t=0;t<s.length;t++){const e=s[t];for(let t=e.start;t<=e.end;t++)kC(o,r[t],a)}return new KS({points:o,options:{}})}(t);if("shape"===i)return!0;const o=function(t){const e=t.scale||{};if(e.getPointPositionForValue)return function(t){const{scale:e,fill:i}=t,n=e.options,o=e.getLabels().length,s=n.reverse?e.max:e.min,r=function(t,e,i){let n;return n="start"===t?i:"end"===t?e.options.reverse?e.min:e.max:Yb(t)?t.value:e.getBaseValue(),n}(i,e,s),a=[];if(n.grid.circular){const t=e.getPointPositionForValue(0,s);return new CC({x:t.x,y:t.y,radius:e.getDistanceFromCenterForValue(r)})}for(let t=0;t<o;++t)a.push(e.getPointPositionForValue(t,r));return a}(t);return function(t){const{scale:e={},fill:i}=t,n=function(t,e){let i=null;return"start"===t?i=e.bottom:"end"===t?i=e.top:Yb(t)?i=e.getPixelForValue(t.value):e.getBasePixel&&(i=e.getBasePixel()),i}(i,e);if(Xb(n)){const t=e.isHorizontal();return{x:t?n:null,y:t?null:n}}return null}(t)}(t);return o instanceof CC?o:bC(o,n)}function AC(t,e,i){const n=EC(e),{line:o,scale:s,axis:r}=e,a=o.options,l=a.fill,c=a.backgroundColor,{above:h=c,below:d=c}=l||{};n&&o.points.length&&(kx(t,i),function(t,e){const{line:i,target:n,above:o,below:s,area:r,scale:a}=e,l=i._loop?"angle":e.axis;t.save(),"x"===l&&s!==o&&(MC(t,n,r.top),TC(t,{line:i,target:n,color:o,scale:a,property:l}),t.restore(),t.save(),MC(t,n,r.bottom));TC(t,{line:i,target:n,color:s,scale:a,property:l}),t.restore()}(t,{line:o,target:n,above:h,below:d,area:i,scale:s,axis:r}),Sx(t))}function MC(t,e,i){const{segments:n,points:o}=e;let s=!0,r=!1;t.beginPath();for(const a of n){const{start:n,end:l}=a,c=o[n],h=o[vC(n,l,o)];s?(t.moveTo(c.x,c.y),s=!1):(t.lineTo(c.x,i),t.lineTo(c.x,c.y)),r=!!e.pathSegment(t,a,{move:r}),r?t.closePath():t.lineTo(h.x,i)}t.lineTo(e.first().x,i),t.closePath(),t.clip()}function TC(t,e){const{line:i,target:n,property:o,color:s,scale:r}=e,a=function(t,e,i){const n=t.segments,o=t.points,s=e.points,r=[];for(const t of n){let{start:n,end:a}=t;a=vC(n,a,o);const l=gC(i,o[n],o[a],t.loop);if(!e.segments){r.push({source:t,target:l,start:o[n],end:o[a]});continue}const c=Ow(e,l);for(const e of c){const n=gC(i,s[e.start],s[e.end],e.loop),a=Pw(t,o,n);for(const t of a)r.push({source:t,target:e,start:{[i]:yC(l,n,"start",Math.max)},end:{[i]:yC(l,n,"end",Math.min)}})}}return r}(i,n,o);for(const{source:e,target:l,start:c,end:h}of a){const{style:{backgroundColor:a=s}={}}=e,d=!0!==n;t.save(),t.fillStyle=a,PC(t,r,d&&gC(o,c,h)),t.beginPath();const u=!!i.pathSegment(t,e);let p;if(d){u?t.closePath():OC(t,n,h,o);const e=!!n.pathSegment(t,l,{move:u,reverse:!0});p=u&&e,p||OC(t,n,c,o)}t.closePath(),t.fill(p?"evenodd":"nonzero"),t.restore()}}function PC(t,e,i){const{top:n,bottom:o}=e.chart.chartArea,{property:s,start:r,end:a}=i||{};"x"===s&&(t.beginPath(),t.rect(r,n,a-r,o-n),t.clip())}function OC(t,e,i,n){const o=e.interpolate(i,n);o&&t.lineTo(o.x,o.y)}var DC={id:"filler",afterDatasetsUpdate(t,e,i){const n=(t.data.datasets||[]).length,o=[];let s,r,a,l;for(r=0;r<n;++r)s=t.getDatasetMeta(r),a=s.dataset,l=null,a&&a.options&&a instanceof KS&&(l={visible:t.isDatasetVisible(r),index:r,fill:wC(a,r,n),chart:t,axis:s.controller.options.indexAxis,scale:s.vScale,line:a}),s.$filler=l,o.push(l);for(r=0;r<n;++r)l=o[r],l&&!1!==l.fill&&(l.fill=xC(o,r,i.propagate))},beforeDraw(t,e,i){const n="beforeDraw"===i.drawTime,o=t.getSortedVisibleDatasetMetas(),s=t.chartArea;for(let e=o.length-1;e>=0;--e){const i=o[e].$filler;i&&(i.line.updateControlPoints(s,i.axis),n&&i.fill&&AC(t.ctx,i,s))}},beforeDatasetsDraw(t,e,i){if("beforeDatasetsDraw"!==i.drawTime)return;const n=t.getSortedVisibleDatasetMetas();for(let e=n.length-1;e>=0;--e){const i=n[e].$filler;_C(i)&&AC(t.ctx,i,t.chartArea)}},beforeDatasetDraw(t,e,i){const n=e.meta.$filler;_C(n)&&"beforeDatasetDraw"===i.drawTime&&AC(t.ctx,n,t.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const IC=(t,e)=>{let{boxHeight:i=e,boxWidth:n=e}=t;return t.usePointStyle&&(i=Math.min(i,e),n=t.pointStyleWidth||Math.min(n,e)),{boxWidth:n,boxHeight:i,itemHeight:Math.max(e,i)}};class LC extends Xk{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e,i){this.maxWidth=t,this.maxHeight=e,this._margins=i,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const t=this.options.labels||{};let e=t_(t.generateLabels,[this.chart],this)||[];t.filter&&(e=e.filter((e=>t.filter(e,this.chart.data)))),t.sort&&(e=e.sort(((e,i)=>t.sort(e,i,this.chart.data)))),this.options.reverse&&e.reverse(),this.legendItems=e}fit(){const{options:t,ctx:e}=this;if(!t.display)return void(this.width=this.height=0);const i=t.labels,n=jx(i.font),o=n.size,s=this._computeTitleHeight(),{boxWidth:r,itemHeight:a}=IC(i,o);let l,c;e.font=n.string,this.isHorizontal()?(l=this.maxWidth,c=this._fitRows(s,o,r,a)+10):(c=this.maxHeight,l=this._fitCols(s,n,r,a)+10),this.width=Math.min(l,t.maxWidth||this.maxWidth),this.height=Math.min(c,t.maxHeight||this.maxHeight)}_fitRows(t,e,i,n){const{ctx:o,maxWidth:s,options:{labels:{padding:r}}}=this,a=this.legendHitBoxes=[],l=this.lineWidths=[0],c=n+r;let h=t;o.textAlign="left",o.textBaseline="middle";let d=-1,u=-c;return this.legendItems.forEach(((t,p)=>{const m=i+e/2+o.measureText(t.text).width;(0===p||l[l.length-1]+m+2*r>s)&&(h+=c,l[l.length-(p>0?0:1)]=0,u+=c,d++),a[p]={left:0,top:u,row:d,width:m,height:n},l[l.length-1]+=m+r})),h}_fitCols(t,e,i,n){const{ctx:o,maxHeight:s,options:{labels:{padding:r}}}=this,a=this.legendHitBoxes=[],l=this.columnSizes=[],c=s-t;let h=r,d=0,u=0,p=0,m=0;return this.legendItems.forEach(((t,s)=>{const{itemWidth:f,itemHeight:g}=function(t,e,i,n,o){const s=function(t,e,i,n){let o=t.text;o&&"string"!=typeof o&&(o=o.reduce(((t,e)=>t.length>e.length?t:e)));return e+i.size/2+n.measureText(o).width}(n,t,e,i),r=function(t,e,i){let n=t;"string"!=typeof e.text&&(n=$C(e,i));return n}(o,n,e.lineHeight);return{itemWidth:s,itemHeight:r}}(i,e,o,t,n);s>0&&u+g+2*r>c&&(h+=d+r,l.push({width:d,height:u}),p+=d+r,m++,d=u=0),a[s]={left:p,top:u,col:m,width:f,height:g},d=Math.max(d,f),u+=g+r})),h+=d,l.push({width:d,height:u}),h}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:e,options:{align:i,labels:{padding:n},rtl:o}}=this,s=Cw(o,this.left,this.width);if(this.isHorizontal()){let o=0,r=Z_(i,this.left+n,this.right-this.lineWidths[o]);for(const a of e)o!==a.row&&(o=a.row,r=Z_(i,this.left+n,this.right-this.lineWidths[o])),a.top+=this.top+t+n,a.left=s.leftForLtr(s.x(r),a.width),r+=a.width+n}else{let o=0,r=Z_(i,this.top+t+n,this.bottom-this.columnSizes[o].height);for(const a of e)a.col!==o&&(o=a.col,r=Z_(i,this.top+t+n,this.bottom-this.columnSizes[o].height)),a.top=r,a.left+=this.left+n,a.left=s.leftForLtr(s.x(a.left),a.width),r+=a.height+n}}isHorizontal(){return"top"===this.options.position||"bottom"===this.options.position}draw(){if(this.options.display){const t=this.ctx;kx(t,this),this._draw(),Sx(t)}}_draw(){const{options:t,columnSizes:e,lineWidths:i,ctx:n}=this,{align:o,labels:s}=t,r=fx.color,a=Cw(t.rtl,this.left,this.width),l=jx(s.font),{padding:c}=s,h=l.size,d=h/2;let u;this.drawTitle(),n.textAlign=a.textAlign("left"),n.textBaseline="middle",n.lineWidth=.5,n.font=l.string;const{boxWidth:p,boxHeight:m,itemHeight:f}=IC(s,h),g=this.isHorizontal(),v=this._computeTitleHeight();u=g?{x:Z_(o,this.left+c,this.right-i[0]),y:this.top+c+v,line:0}:{x:this.left+c,y:Z_(o,this.top+v+c,this.bottom-e[0].height),line:0},Ew(this.ctx,t.textDirection);const y=f+c;this.legendItems.forEach(((b,_)=>{n.strokeStyle=b.fontColor,n.fillStyle=b.fontColor;const x=n.measureText(b.text).width,w=a.textAlign(b.textAlign||(b.textAlign=s.textAlign)),k=p+d+x;let S=u.x,C=u.y;a.setWidth(this.width),g?_>0&&S+k+c>this.right&&(C=u.y+=y,u.line++,S=u.x=Z_(o,this.left+c,this.right-i[u.line])):_>0&&C+y>this.bottom&&(S=u.x=S+e[u.line].width+c,u.line++,C=u.y=Z_(o,this.top+v+c,this.bottom-e[u.line].height));if(function(t,e,i){if(isNaN(p)||p<=0||isNaN(m)||m<0)return;n.save();const o=Qb(i.lineWidth,1);if(n.fillStyle=Qb(i.fillStyle,r),n.lineCap=Qb(i.lineCap,"butt"),n.lineDashOffset=Qb(i.lineDashOffset,0),n.lineJoin=Qb(i.lineJoin,"miter"),n.lineWidth=o,n.strokeStyle=Qb(i.strokeStyle,r),n.setLineDash(Qb(i.lineDash,[])),s.usePointStyle){const r={radius:m*Math.SQRT2/2,pointStyle:i.pointStyle,rotation:i.rotation,borderWidth:o},l=a.xPlus(t,p/2);xx(n,r,l,e+d,s.pointStyleWidth&&p)}else{const s=e+Math.max((h-m)/2,0),r=a.leftForLtr(t,p),l=Rx(i.borderRadius);n.beginPath(),Object.values(l).some((t=>0!==t))?Px(n,{x:r,y:s,w:p,h:m,radius:l}):n.rect(r,s,p,m),n.fill(),0!==o&&n.stroke()}n.restore()}(a.x(S),C,b),S=((t,e,i,n)=>t===(n?"left":"right")?i:"center"===t?(e+i)/2:e)(w,S+p+d,g?S+k:this.right,t.rtl),function(t,e,i){Tx(n,i.text,t,e+f/2,l,{strikethrough:i.hidden,textAlign:a.textAlign(i.textAlign)})}(a.x(S),C,b),g)u.x+=k+c;else if("string"!=typeof b.text){const t=l.lineHeight;u.y+=$C(b,t)+c}else u.y+=y})),Aw(this.ctx,t.textDirection)}drawTitle(){const t=this.options,e=t.title,i=jx(e.font),n=Nx(e.padding);if(!e.display)return;const o=Cw(t.rtl,this.left,this.width),s=this.ctx,r=e.position,a=i.size/2,l=n.top+a;let c,h=this.left,d=this.width;if(this.isHorizontal())d=Math.max(...this.lineWidths),c=this.top+l,h=Z_(t.align,h,this.right-d);else{const e=this.columnSizes.reduce(((t,e)=>Math.max(t,e.height)),0);c=l+Z_(t.align,this.top,this.bottom-e-t.labels.padding-this._computeTitleHeight())}const u=Z_(r,h,h+d);s.textAlign=o.textAlign(G_(r)),s.textBaseline="middle",s.strokeStyle=e.color,s.fillStyle=e.color,s.font=i.string,Tx(s,e.text,u,c,i)}_computeTitleHeight(){const t=this.options.title,e=jx(t.font),i=Nx(t.padding);return t.display?e.lineHeight+i.height:0}_getLegendItemAt(t,e){let i,n,o;if(N_(t,this.left,this.right)&&N_(e,this.top,this.bottom))for(o=this.legendHitBoxes,i=0;i<o.length;++i)if(n=o[i],N_(t,n.left,n.left+n.width)&&N_(e,n.top,n.top+n.height))return this.legendItems[i];return null}handleEvent(t){const e=this.options;if(!function(t,e){if(("mousemove"===t||"mouseout"===t)&&(e.onHover||e.onLeave))return!0;if(e.onClick&&("click"===t||"mouseup"===t))return!0;return!1}(t.type,e))return;const i=this._getLegendItemAt(t.x,t.y);if("mousemove"===t.type||"mouseout"===t.type){const n=this._hoveredItem,o=((t,e)=>null!==t&&null!==e&&t.datasetIndex===e.datasetIndex&&t.index===e.index)(n,i);n&&!o&&t_(e.onLeave,[t,n,this],this),this._hoveredItem=i,i&&!o&&t_(e.onHover,[t,i,this],this)}else i&&t_(e.onClick,[t,i,this],this)}}function $C(t,e){return e*(t.text?t.text.length:0)}var zC={id:"legend",_element:LC,start(t,e,i){const n=t.legend=new LC({ctx:t.ctx,options:i,chart:t});Dk.configure(t,n,i),Dk.addBox(t,n)},stop(t){Dk.removeBox(t,t.legend),delete t.legend},beforeUpdate(t,e,i){const n=t.legend;Dk.configure(t,n,i),n.options=i},afterUpdate(t){const e=t.legend;e.buildLabels(),e.adjustHitBoxes()},afterEvent(t,e){e.replay||t.legend.handleEvent(e.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(t,e,i){const n=e.datasetIndex,o=i.chart;o.isDatasetVisible(n)?(o.hide(n),e.hidden=!0):(o.show(n),e.hidden=!1)},onHover:null,onLeave:null,labels:{color:t=>t.chart.options.color,boxWidth:40,padding:10,generateLabels(t){const e=t.data.datasets,{labels:{usePointStyle:i,pointStyle:n,textAlign:o,color:s,useBorderRadius:r,borderRadius:a}}=t.legend.options;return t._getSortedDatasetMetas().map((t=>{const l=t.controller.getStyle(i?0:void 0),c=Nx(l.borderWidth);return{text:e[t.index].label,fillStyle:l.backgroundColor,fontColor:s,hidden:!t.visible,lineCap:l.borderCapStyle,lineDash:l.borderDash,lineDashOffset:l.borderDashOffset,lineJoin:l.borderJoinStyle,lineWidth:(c.width+c.height)/4,strokeStyle:l.borderColor,pointStyle:n||l.pointStyle,rotation:l.rotation,textAlign:o||l.textAlign,borderRadius:r&&(a||l.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 RC extends Xk{constructor(t){super(),this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e){const i=this.options;if(this.left=0,this.top=0,!i.display)return void(this.width=this.height=this.right=this.bottom=0);this.width=this.right=t,this.height=this.bottom=e;const n=Zb(i.text)?i.text.length:1;this._padding=Nx(i.padding);const o=n*jx(i.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=o:this.width=o}isHorizontal(){const t=this.options.position;return"top"===t||"bottom"===t}_drawArgs(t){const{top:e,left:i,bottom:n,right:o,options:s}=this,r=s.align;let a,l,c,h=0;return this.isHorizontal()?(l=Z_(r,i,o),c=e+t,a=o-i):("left"===s.position?(l=i+t,c=Z_(r,n,e),h=-.5*f_):(l=o-t,c=Z_(r,e,n),h=.5*f_),a=n-e),{titleX:l,titleY:c,maxWidth:a,rotation:h}}draw(){const t=this.ctx,e=this.options;if(!e.display)return;const i=jx(e.font),n=i.lineHeight/2+this._padding.top,{titleX:o,titleY:s,maxWidth:r,rotation:a}=this._drawArgs(n);Tx(t,e.text,0,0,i,{color:e.color,maxWidth:r,rotation:a,textAlign:G_(e.align),textBaseline:"middle",translation:[o,s]})}}var NC={id:"title",_element:RC,start(t,e,i){!function(t,e){const i=new RC({ctx:t.ctx,options:e,chart:t});Dk.configure(t,i,e),Dk.addBox(t,i),t.titleBlock=i}(t,i)},stop(t){const e=t.titleBlock;Dk.removeBox(t,e),delete t.titleBlock},beforeUpdate(t,e,i){const n=t.titleBlock;Dk.configure(t,n,i),n.options=i},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const jC=new WeakMap;var BC={id:"subtitle",start(t,e,i){const n=new RC({ctx:t.ctx,options:i,chart:t});Dk.configure(t,n,i),Dk.addBox(t,n),jC.set(t,n)},stop(t){Dk.removeBox(t,jC.get(t)),jC.delete(t)},beforeUpdate(t,e,i){const n=jC.get(t);Dk.configure(t,n,i),n.options=i},defaults:{align:"center",display:!1,font:{weight:"normal"},fullSize:!0,padding:0,position:"top",text:"",weight:1500},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const FC={average(t){if(!t.length)return!1;let e,i,n=new Set,o=0,s=0;for(e=0,i=t.length;e<i;++e){const i=t[e].element;if(i&&i.hasValue()){const t=i.tooltipPosition();n.add(t.x),o+=t.y,++s}}if(0===s||0===n.size)return!1;const r=[...n].reduce(((t,e)=>t+e))/n.size;return{x:r,y:o/s}},nearest(t,e){if(!t.length)return!1;let i,n,o,s=e.x,r=e.y,a=Number.POSITIVE_INFINITY;for(i=0,n=t.length;i<n;++i){const n=t[i].element;if(n&&n.hasValue()){const t=I_(e,n.getCenterPoint());t<a&&(a=t,o=n)}}if(o){const t=o.tooltipPosition();s=t.x,r=t.y}return{x:s,y:r}}};function qC(t,e){return e&&(Zb(e)?Array.prototype.push.apply(t,e):t.push(e)),t}function VC(t){return("string"==typeof t||t instanceof String)&&t.indexOf("\n")>-1?t.split("\n"):t}function HC(t,e){const{element:i,datasetIndex:n,index:o}=e,s=t.getDatasetMeta(n).controller,{label:r,value:a}=s.getLabelAndValue(o);return{chart:t,label:r,parsed:s.getParsed(o),raw:t.data.datasets[n].data[o],formattedValue:a,dataset:s.getDataset(),dataIndex:o,datasetIndex:n,element:i}}function UC(t,e){const i=t.chart.ctx,{body:n,footer:o,title:s}=t,{boxWidth:r,boxHeight:a}=e,l=jx(e.bodyFont),c=jx(e.titleFont),h=jx(e.footerFont),d=s.length,u=o.length,p=n.length,m=Nx(e.padding);let f=m.height,g=0,v=n.reduce(((t,e)=>t+e.before.length+e.lines.length+e.after.length),0);if(v+=t.beforeBody.length+t.afterBody.length,d&&(f+=d*c.lineHeight+(d-1)*e.titleSpacing+e.titleMarginBottom),v){f+=p*(e.displayColors?Math.max(a,l.lineHeight):l.lineHeight)+(v-p)*l.lineHeight+(v-1)*e.bodySpacing}u&&(f+=e.footerMarginTop+u*h.lineHeight+(u-1)*e.footerSpacing);let y=0;const b=function(t){g=Math.max(g,i.measureText(t).width+y)};return i.save(),i.font=c.string,e_(t.title,b),i.font=l.string,e_(t.beforeBody.concat(t.afterBody),b),y=e.displayColors?r+2+e.boxPadding:0,e_(n,(t=>{e_(t.before,b),e_(t.lines,b),e_(t.after,b)})),y=0,i.font=h.string,e_(t.footer,b),i.restore(),g+=m.width,{width:g,height:f}}function WC(t,e,i,n){const{x:o,width:s}=i,{width:r,chartArea:{left:a,right:l}}=t;let c="center";return"center"===n?c=o<=(a+l)/2?"left":"right":o<=s/2?c="left":o>=r-s/2&&(c="right"),function(t,e,i,n){const{x:o,width:s}=n,r=i.caretSize+i.caretPadding;return"left"===t&&o+s+r>e.width||"right"===t&&o-s-r<0||void 0}(c,t,e,i)&&(c="center"),c}function GC(t,e,i){const n=i.yAlign||e.yAlign||function(t,e){const{y:i,height:n}=e;return i<n/2?"top":i>t.height-n/2?"bottom":"center"}(t,i);return{xAlign:i.xAlign||e.xAlign||WC(t,e,i,n),yAlign:n}}function ZC(t,e,i,n){const{caretSize:o,caretPadding:s,cornerRadius:r}=t,{xAlign:a,yAlign:l}=i,c=o+s,{topLeft:h,topRight:d,bottomLeft:u,bottomRight:p}=Rx(r);let m=function(t,e){let{x:i,width:n}=t;return"right"===e?i-=n:"center"===e&&(i-=n/2),i}(e,a);const f=function(t,e,i){let{y:n,height:o}=t;return"top"===e?n+=i:n-="bottom"===e?o+i:o/2,n}(e,l,c);return"center"===l?"left"===a?m+=c:"right"===a&&(m-=c):"left"===a?m-=Math.max(h,u)+o:"right"===a&&(m+=Math.max(d,p)+o),{x:R_(m,0,n.width-e.width),y:R_(f,0,n.height-e.height)}}function YC(t,e,i){const n=Nx(i.padding);return"center"===e?t.x+t.width/2:"right"===e?t.x+t.width-n.right:t.x+n.left}function XC(t){return qC([],VC(t))}function KC(t,e){const i=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return i?t.override(i):t}const QC={beforeTitle:Ub,title(t){if(t.length>0){const e=t[0],i=e.chart.data.labels,n=i?i.length:0;if(this&&this.options&&"dataset"===this.options.mode)return e.dataset.label||"";if(e.label)return e.label;if(n>0&&e.dataIndex<n)return i[e.dataIndex]}return""},afterTitle:Ub,beforeBody:Ub,beforeLabel:Ub,label(t){if(this&&this.options&&"dataset"===this.options.mode)return t.label+": "+t.formattedValue||t.formattedValue;let e=t.dataset.label||"";e&&(e+=": ");const i=t.formattedValue;return Gb(i)||(e+=i),e},labelColor(t){const e=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{borderColor:e.borderColor,backgroundColor:e.backgroundColor,borderWidth:e.borderWidth,borderDash:e.borderDash,borderDashOffset:e.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(t){const e=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{pointStyle:e.pointStyle,rotation:e.rotation}},afterLabel:Ub,afterBody:Ub,beforeFooter:Ub,footer:Ub,afterFooter:Ub};function JC(t,e,i,n){const o=t[e].call(i,n);return void 0===o?QC[e].call(i,n):o}class tE extends Xk{static positioners=FC;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 e=this.chart,i=this.options.setContext(this.getContext()),n=i.enabled&&e.options.animation&&i.animations,o=new Bw(this.chart,n);return n._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=(t=this.chart.getContext(),e=this,i=this._tooltipItems,Fx(t,{tooltip:e,tooltipItems:i,type:"tooltip"})));var t,e,i}getTitle(t,e){const{callbacks:i}=e,n=JC(i,"beforeTitle",this,t),o=JC(i,"title",this,t),s=JC(i,"afterTitle",this,t);let r=[];return r=qC(r,VC(n)),r=qC(r,VC(o)),r=qC(r,VC(s)),r}getBeforeBody(t,e){return XC(JC(e.callbacks,"beforeBody",this,t))}getBody(t,e){const{callbacks:i}=e,n=[];return e_(t,(t=>{const e={before:[],lines:[],after:[]},o=KC(i,t);qC(e.before,VC(JC(o,"beforeLabel",this,t))),qC(e.lines,JC(o,"label",this,t)),qC(e.after,VC(JC(o,"afterLabel",this,t))),n.push(e)})),n}getAfterBody(t,e){return XC(JC(e.callbacks,"afterBody",this,t))}getFooter(t,e){const{callbacks:i}=e,n=JC(i,"beforeFooter",this,t),o=JC(i,"footer",this,t),s=JC(i,"afterFooter",this,t);let r=[];return r=qC(r,VC(n)),r=qC(r,VC(o)),r=qC(r,VC(s)),r}_createItems(t){const e=this._active,i=this.chart.data,n=[],o=[],s=[];let r,a,l=[];for(r=0,a=e.length;r<a;++r)l.push(HC(this.chart,e[r]));return t.filter&&(l=l.filter(((e,n,o)=>t.filter(e,n,o,i)))),t.itemSort&&(l=l.sort(((e,n)=>t.itemSort(e,n,i)))),e_(l,(e=>{const i=KC(t.callbacks,e);n.push(JC(i,"labelColor",this,e)),o.push(JC(i,"labelPointStyle",this,e)),s.push(JC(i,"labelTextColor",this,e))})),this.labelColors=n,this.labelPointStyles=o,this.labelTextColors=s,this.dataPoints=l,l}update(t,e){const i=this.options.setContext(this.getContext()),n=this._active;let o,s=[];if(n.length){const t=FC[i.position].call(this,n,this._eventPosition);s=this._createItems(i),this.title=this.getTitle(s,i),this.beforeBody=this.getBeforeBody(s,i),this.body=this.getBody(s,i),this.afterBody=this.getAfterBody(s,i),this.footer=this.getFooter(s,i);const e=this._size=UC(this,i),r=Object.assign({},t,e),a=GC(this.chart,i,r),l=ZC(i,r,a,this.chart);this.xAlign=a.xAlign,this.yAlign=a.yAlign,o={opacity:1,x:l.x,y:l.y,width:e.width,height:e.height,caretX:t.x,caretY:t.y}}else 0!==this.opacity&&(o={opacity:0});this._tooltipItems=s,this.$context=void 0,o&&this._resolveAnimations().update(this,o),t&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,i,n){const o=this.getCaretPosition(t,i,n);e.lineTo(o.x1,o.y1),e.lineTo(o.x2,o.y2),e.lineTo(o.x3,o.y3)}getCaretPosition(t,e,i){const{xAlign:n,yAlign:o}=this,{caretSize:s,cornerRadius:r}=i,{topLeft:a,topRight:l,bottomLeft:c,bottomRight:h}=Rx(r),{x:d,y:u}=t,{width:p,height:m}=e;let f,g,v,y,b,_;return"center"===o?(b=u+m/2,"left"===n?(f=d,g=f-s,y=b+s,_=b-s):(f=d+p,g=f+s,y=b-s,_=b+s),v=f):(g="left"===n?d+Math.max(a,c)+s:"right"===n?d+p-Math.max(l,h)-s:this.caretX,"top"===o?(y=u,b=y-s,f=g-s,v=g+s):(y=u+m,b=y+s,f=g+s,v=g-s),_=y),{x1:f,x2:g,x3:v,y1:y,y2:b,y3:_}}drawTitle(t,e,i){const n=this.title,o=n.length;let s,r,a;if(o){const l=Cw(i.rtl,this.x,this.width);for(t.x=YC(this,i.titleAlign,i),e.textAlign=l.textAlign(i.titleAlign),e.textBaseline="middle",s=jx(i.titleFont),r=i.titleSpacing,e.fillStyle=i.titleColor,e.font=s.string,a=0;a<o;++a)e.fillText(n[a],l.x(t.x),t.y+s.lineHeight/2),t.y+=s.lineHeight+r,a+1===o&&(t.y+=i.titleMarginBottom-r)}}_drawColorBox(t,e,i,n,o){const s=this.labelColors[i],r=this.labelPointStyles[i],{boxHeight:a,boxWidth:l}=o,c=jx(o.bodyFont),h=YC(this,"left",o),d=n.x(h),u=a<c.lineHeight?(c.lineHeight-a)/2:0,p=e.y+u;if(o.usePointStyle){const e={radius:Math.min(l,a)/2,pointStyle:r.pointStyle,rotation:r.rotation,borderWidth:1},i=n.leftForLtr(d,l)+l/2,c=p+a/2;t.strokeStyle=o.multiKeyBackground,t.fillStyle=o.multiKeyBackground,_x(t,e,i,c),t.strokeStyle=s.borderColor,t.fillStyle=s.backgroundColor,_x(t,e,i,c)}else{t.lineWidth=Yb(s.borderWidth)?Math.max(...Object.values(s.borderWidth)):s.borderWidth||1,t.strokeStyle=s.borderColor,t.setLineDash(s.borderDash||[]),t.lineDashOffset=s.borderDashOffset||0;const e=n.leftForLtr(d,l),i=n.leftForLtr(n.xPlus(d,1),l-2),r=Rx(s.borderRadius);Object.values(r).some((t=>0!==t))?(t.beginPath(),t.fillStyle=o.multiKeyBackground,Px(t,{x:e,y:p,w:l,h:a,radius:r}),t.fill(),t.stroke(),t.fillStyle=s.backgroundColor,t.beginPath(),Px(t,{x:i,y:p+1,w:l-2,h:a-2,radius:r}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(e,p,l,a),t.strokeRect(e,p,l,a),t.fillStyle=s.backgroundColor,t.fillRect(i,p+1,l-2,a-2))}t.fillStyle=this.labelTextColors[i]}drawBody(t,e,i){const{body:n}=this,{bodySpacing:o,bodyAlign:s,displayColors:r,boxHeight:a,boxWidth:l,boxPadding:c}=i,h=jx(i.bodyFont);let d=h.lineHeight,u=0;const p=Cw(i.rtl,this.x,this.width),m=function(i){e.fillText(i,p.x(t.x+u),t.y+d/2),t.y+=d+o},f=p.textAlign(s);let g,v,y,b,_,x,w;for(e.textAlign=s,e.textBaseline="middle",e.font=h.string,t.x=YC(this,f,i),e.fillStyle=i.bodyColor,e_(this.beforeBody,m),u=r&&"right"!==f?"center"===s?l/2+c:l+2+c:0,b=0,x=n.length;b<x;++b){for(g=n[b],v=this.labelTextColors[b],e.fillStyle=v,e_(g.before,m),y=g.lines,r&&y.length&&(this._drawColorBox(e,t,b,p,i),d=Math.max(h.lineHeight,a)),_=0,w=y.length;_<w;++_)m(y[_]),d=h.lineHeight;e_(g.after,m)}u=0,d=h.lineHeight,e_(this.afterBody,m),t.y-=o}drawFooter(t,e,i){const n=this.footer,o=n.length;let s,r;if(o){const a=Cw(i.rtl,this.x,this.width);for(t.x=YC(this,i.footerAlign,i),t.y+=i.footerMarginTop,e.textAlign=a.textAlign(i.footerAlign),e.textBaseline="middle",s=jx(i.footerFont),e.fillStyle=i.footerColor,e.font=s.string,r=0;r<o;++r)e.fillText(n[r],a.x(t.x),t.y+s.lineHeight/2),t.y+=s.lineHeight+i.footerSpacing}}drawBackground(t,e,i,n){const{xAlign:o,yAlign:s}=this,{x:r,y:a}=t,{width:l,height:c}=i,{topLeft:h,topRight:d,bottomLeft:u,bottomRight:p}=Rx(n.cornerRadius);e.fillStyle=n.backgroundColor,e.strokeStyle=n.borderColor,e.lineWidth=n.borderWidth,e.beginPath(),e.moveTo(r+h,a),"top"===s&&this.drawCaret(t,e,i,n),e.lineTo(r+l-d,a),e.quadraticCurveTo(r+l,a,r+l,a+d),"center"===s&&"right"===o&&this.drawCaret(t,e,i,n),e.lineTo(r+l,a+c-p),e.quadraticCurveTo(r+l,a+c,r+l-p,a+c),"bottom"===s&&this.drawCaret(t,e,i,n),e.lineTo(r+u,a+c),e.quadraticCurveTo(r,a+c,r,a+c-u),"center"===s&&"left"===o&&this.drawCaret(t,e,i,n),e.lineTo(r,a+h),e.quadraticCurveTo(r,a,r+h,a),e.closePath(),e.fill(),n.borderWidth>0&&e.stroke()}_updateAnimationTarget(t){const e=this.chart,i=this.$animations,n=i&&i.x,o=i&&i.y;if(n||o){const i=FC[t.position].call(this,this._active,this._eventPosition);if(!i)return;const s=this._size=UC(this,t),r=Object.assign({},i,this._size),a=GC(e,t,r),l=ZC(t,r,a,e);n._to===l.x&&o._to===l.y||(this.xAlign=a.xAlign,this.yAlign=a.yAlign,this.width=s.width,this.height=s.height,this.caretX=i.x,this.caretY=i.y,this._resolveAnimations().update(this,l))}}_willRender(){return!!this.opacity}draw(t){const e=this.options.setContext(this.getContext());let i=this.opacity;if(!i)return;this._updateAnimationTarget(e);const n={width:this.width,height:this.height},o={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;const s=Nx(e.padding),r=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&r&&(t.save(),t.globalAlpha=i,this.drawBackground(o,t,n,e),Ew(t,e.textDirection),o.y+=s.top,this.drawTitle(o,t,e),this.drawBody(o,t,e),this.drawFooter(o,t,e),Aw(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){const i=this._active,n=t.map((({datasetIndex:t,index:e})=>{const i=this.chart.getDatasetMeta(t);if(!i)throw new Error("Cannot find a dataset at index "+t);return{datasetIndex:t,element:i.data[e],index:e}})),o=!i_(i,n),s=this._positionChanged(n,e);(o||s)&&(this._active=n,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,i=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const n=this.options,o=this._active||[],s=this._getActiveElements(t,o,e,i),r=this._positionChanged(s,t),a=e||!i_(s,o)||r;return a&&(this._active=s,(n.enabled||n.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),a}_getActiveElements(t,e,i,n){const o=this.options;if("mouseout"===t.type)return[];if(!n)return e.filter((t=>this.chart.data.datasets[t.datasetIndex]&&void 0!==this.chart.getDatasetMeta(t.datasetIndex).controller.getParsed(t.index)));const s=this.chart.getElementsAtEventForMode(t,o.mode,o,i);return o.reverse&&s.reverse(),s}_positionChanged(t,e){const{caretX:i,caretY:n,options:o}=this,s=FC[o.position].call(this,t,e);return!1!==s&&(i!==s.x||n!==s.y)}}var eE={id:"tooltip",_element:tE,positioners:FC,afterInit(t,e,i){i&&(t.tooltip=new tE({chart:t,options:i}))},beforeUpdate(t,e,i){t.tooltip&&t.tooltip.initialize(i)},reset(t,e,i){t.tooltip&&t.tooltip.initialize(i)},afterDraw(t){const e=t.tooltip;if(e&&e._willRender()){const i={tooltip:e};if(!1===t.notifyPlugins("beforeTooltipDraw",{...i,cancelable:!0}))return;e.draw(t.ctx),t.notifyPlugins("afterTooltipDraw",i)}},afterEvent(t,e){if(t.tooltip){const i=e.replay;t.tooltip.handleEvent(e.event,i,e.inChartArea)&&(e.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(t,e)=>e.bodyFont.size,boxWidth:(t,e)=>e.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:QC},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"]},iE=Object.freeze({__proto__:null,Colors:uC,Decimation:fC,Filler:DC,Legend:zC,SubTitle:BC,Title:NC,Tooltip:eE});function nE(t,e,i,n){const o=t.indexOf(e);if(-1===o)return((t,e,i,n)=>("string"==typeof e?(i=t.push(e)-1,n.unshift({index:i,label:e})):isNaN(e)&&(i=null),i))(t,e,i,n);return o!==t.lastIndexOf(e)?i:o}function oE(t){const e=this.getLabels();return t>=0&&t<e.length?e[t]:t}function sE(t,e){const i=[],{bounds:n,step:o,min:s,max:r,precision:a,count:l,maxTicks:c,maxDigits:h,includeBounds:d}=t,u=o||1,p=c-1,{min:m,max:f}=e,g=!Gb(s),v=!Gb(r),y=!Gb(l),b=(f-m)/(h+1);let _,x,w,k,S=E_((f-m)/p/u)*u;if(S<1e-14&&!g&&!v)return[{value:m},{value:f}];k=Math.ceil(f/S)-Math.floor(m/S),k>p&&(S=E_(k*S/p/u)*u),Gb(a)||(_=Math.pow(10,a),S=Math.ceil(S*_)/_),"ticks"===n?(x=Math.floor(m/S)*S,w=Math.ceil(f/S)*S):(x=m,w=f),g&&v&&o&&function(t,e){const i=Math.round(t);return i-e<=t&&i+e>=t}((r-s)/o,S/1e3)?(k=Math.round(Math.min((r-s)/S,c)),S=(r-s)/k,x=s,w=r):y?(x=g?s:x,w=v?r:w,k=l-1,S=(w-x)/k):(k=(w-x)/S,k=C_(k,Math.round(k),S/1e3)?Math.round(k):Math.ceil(k));const C=Math.max(O_(S),O_(x));_=Math.pow(10,Gb(a)?C:a),x=Math.round(x*_)/_,w=Math.round(w*_)/_;let E=0;for(g&&(d&&x!==s?(i.push({value:s}),x<s&&E++,C_(Math.round((x+E*S)*_)/_,s,rE(s,b,t))&&E++):x<s&&E++);E<k;++E){const t=Math.round((x+E*S)*_)/_;if(v&&t>r)break;i.push({value:t})}return v&&d&&w!==r?i.length&&C_(i[i.length-1].value,r,rE(r,b,t))?i[i.length-1].value=r:i.push({value:r}):v&&w!==r||i.push({value:w}),i}function rE(t,e,{horizontal:i,minRotation:n}){const o=T_(n),s=(i?Math.sin(o):Math.cos(o))||.001,r=.75*e*(""+t).length;return Math.min(e/s,r)}class aE extends rS{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,e){return Gb(t)||("number"==typeof t||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:e,maxDefined:i}=this.getUserBounds();let{min:n,max:o}=this;const s=t=>n=e?n:t,r=t=>o=i?o:t;if(t){const t=S_(n),e=S_(o);t<0&&e<0?r(0):t>0&&e>0&&s(0)}if(n===o){let e=0===o?1:Math.abs(.05*o);r(o+e),t||s(n-e)}this.min=n,this.max=o}getTickLimit(){const t=this.options.ticks;let e,{maxTicksLimit:i,stepSize:n}=t;return n?(e=Math.ceil(this.max/n)-Math.floor(this.min/n)+1,e>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${n} would result generating up to ${e} ticks. Limiting to 1000.`),e=1e3)):(e=this.computeTickLimit(),i=i||11),i&&(e=Math.min(i,e)),e}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,e=t.ticks;let i=this.getTickLimit();i=Math.max(2,i);const n=sE({maxTicks:i,bounds:t.bounds,min:t.min,max:t.max,precision:e.precision,step:e.stepSize,count:e.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:e.minRotation||0,includeBounds:!1!==e.includeBounds},this._range||this);return"ticks"===t.bounds&&M_(n,this,"value"),t.reverse?(n.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),n}configure(){const t=this.ticks;let e=this.min,i=this.max;if(super.configure(),this.options.offset&&t.length){const n=(i-e)/Math.max(t.length-1,1)/2;e-=n,i+=n}this._startValue=e,this._endValue=i,this._valueRange=i-e}getLabelForValue(t){return ax(t,this.chart.options.locale,this.options.ticks.format)}}class lE extends aE{static id="linear";static defaults={ticks:{callback:cx.formatters.numeric}};determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=Xb(t)?t:0,this.max=Xb(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),e=t?this.width:this.height,i=T_(this.options.ticks.minRotation),n=(t?Math.sin(i):Math.cos(i))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(e/Math.min(40,o.lineHeight/n))}getPixelForValue(t){return null===t?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}const cE=t=>Math.floor(k_(t)),hE=(t,e)=>Math.pow(10,cE(t)+e);function dE(t){return 1===t/Math.pow(10,cE(t))}function uE(t,e,i){const n=Math.pow(10,i),o=Math.floor(t/n);return Math.ceil(e/n)-o}function pE(t,{min:e,max:i}){e=Kb(t.min,e);const n=[],o=cE(e);let s=function(t,e){let i=cE(e-t);for(;uE(t,e,i)>10;)i++;for(;uE(t,e,i)<10;)i--;return Math.min(i,cE(t))}(e,i),r=s<0?Math.pow(10,Math.abs(s)):1;const a=Math.pow(10,s),l=o>s?Math.pow(10,o):0,c=Math.round((e-l)*r)/r,h=Math.floor((e-l)/a/10)*a*10;let d=Math.floor((c-h)/Math.pow(10,s)),u=Kb(t.min,Math.round((l+h+d*Math.pow(10,s))*r)/r);for(;u<i;)n.push({value:u,major:dE(u),significand:d}),d>=10?d=d<15?15:20:d++,d>=20&&(s++,d=2,r=s>=0?1:r),u=Math.round((l+h+d*Math.pow(10,s))*r)/r;const p=Kb(t.max,u);return n.push({value:p,major:dE(p),significand:d}),n}class mE extends rS{static id="logarithmic";static defaults={ticks:{callback:cx.formatters.logarithmic,major:{enabled:!0}}};constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,e){const i=aE.prototype.parse.apply(this,[t,e]);if(0!==i)return Xb(i)&&i>0?i:null;this._zero=!0}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=Xb(t)?Math.max(0,t):null,this.max=Xb(e)?Math.max(0,e):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!Xb(this._userMin)&&(this.min=t===hE(this.min,0)?hE(this.min,-1):hE(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let i=this.min,n=this.max;const o=e=>i=t?i:e,s=t=>n=e?n:t;i===n&&(i<=0?(o(1),s(10)):(o(hE(i,-1)),s(hE(n,1)))),i<=0&&o(hE(n,-1)),n<=0&&s(hE(i,1)),this.min=i,this.max=n}buildTicks(){const t=this.options,e=pE({min:this._userMin,max:this._userMax},this);return"ticks"===t.bounds&&M_(e,this,"value"),t.reverse?(e.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),e}getLabelForValue(t){return void 0===t?"0":ax(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=k_(t),this._valueRange=k_(this.max)-k_(t)}getPixelForValue(t){return void 0!==t&&0!==t||(t=this.min),null===t||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(k_(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const e=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+e*this._valueRange)}}function fE(t){const e=t.ticks;if(e.display&&t.display){const t=Nx(e.backdropPadding);return Qb(e.font&&e.font.size,fx.font.size)+t.height}return 0}function gE(t,e,i,n,o){return t===n||t===o?{start:e-i/2,end:e+i/2}:t<n||t>o?{start:e-i,end:e}:{start:e,end:e+i}}function vE(t){const e={l:t.left+t._padding.left,r:t.right-t._padding.right,t:t.top+t._padding.top,b:t.bottom-t._padding.bottom},i=Object.assign({},e),n=[],o=[],s=t._pointLabels.length,r=t.options.pointLabels,a=r.centerPointLabels?f_/s:0;for(let d=0;d<s;d++){const s=r.setContext(t.getPointLabelContext(d));o[d]=s.padding;const u=t.getPointPosition(d,t.drawingArea+o[d],a),p=jx(s.font),m=(l=t.ctx,c=p,h=Zb(h=t._pointLabels[d])?h:[h],{w:vx(l,c.string,h),h:h.length*c.lineHeight});n[d]=m;const f=$_(t.getIndexAngle(d)+a),g=Math.round(P_(f));yE(i,e,f,gE(g,u.x,m.w,0,180),gE(g,u.y,m.h,90,270))}var l,c,h;t.setCenterPoint(e.l-i.l,i.r-e.r,e.t-i.t,i.b-e.b),t._pointLabelItems=function(t,e,i){const n=[],o=t._pointLabels.length,s=t.options,{centerPointLabels:r,display:a}=s.pointLabels,l={extra:fE(s)/2,additionalAngle:r?f_/o:0};let c;for(let s=0;s<o;s++){l.padding=i[s],l.size=e[s];const o=bE(t,s,l);n.push(o),"auto"===a&&(o.visible=_E(o,c),o.visible&&(c=o))}return n}(t,n,o)}function yE(t,e,i,n,o){const s=Math.abs(Math.sin(i)),r=Math.abs(Math.cos(i));let a=0,l=0;n.start<e.l?(a=(e.l-n.start)/s,t.l=Math.min(t.l,e.l-a)):n.end>e.r&&(a=(n.end-e.r)/s,t.r=Math.max(t.r,e.r+a)),o.start<e.t?(l=(e.t-o.start)/r,t.t=Math.min(t.t,e.t-l)):o.end>e.b&&(l=(o.end-e.b)/r,t.b=Math.max(t.b,e.b+l))}function bE(t,e,i){const n=t.drawingArea,{extra:o,additionalAngle:s,padding:r,size:a}=i,l=t.getPointPosition(e,n+o+r,s),c=Math.round(P_($_(l.angle+__))),h=function(t,e,i){90===i||270===i?t-=e/2:(i>270||i<90)&&(t-=e);return t}(l.y,a.h,c),d=function(t){if(0===t||180===t)return"center";if(t<180)return"left";return"right"}(c),u=function(t,e,i){"right"===i?t-=e:"center"===i&&(t-=e/2);return t}(l.x,a.w,d);return{visible:!0,x:l.x,y:h,textAlign:d,left:u,top:h,right:u+a.w,bottom:h+a.h}}function _E(t,e){if(!e)return!0;const{left:i,top:n,right:o,bottom:s}=t;return!(wx({x:i,y:n},e)||wx({x:i,y:s},e)||wx({x:o,y:n},e)||wx({x:o,y:s},e))}function xE(t,e,i){const{left:n,top:o,right:s,bottom:r}=i,{backdropColor:a}=e;if(!Gb(a)){const i=Rx(e.borderRadius),l=Nx(e.backdropPadding);t.fillStyle=a;const c=n-l.left,h=o-l.top,d=s-n+l.width,u=r-o+l.height;Object.values(i).some((t=>0!==t))?(t.beginPath(),Px(t,{x:c,y:h,w:d,h:u,radius:i}),t.fill()):t.fillRect(c,h,d,u)}}function wE(t,e,i,n){const{ctx:o}=t;if(i)o.arc(t.xCenter,t.yCenter,e,0,g_);else{let i=t.getPointPosition(0,e);o.moveTo(i.x,i.y);for(let s=1;s<n;s++)i=t.getPointPosition(s,e),o.lineTo(i.x,i.y)}}class kE extends aE{static id="radialLinear";static defaults={display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:cx.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback:t=>t,padding:5,centerPointLabels:!1}};static defaultRoutes={"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"};static descriptors={angleLines:{_fallback:"grid"}};constructor(t){super(t),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){const t=this._padding=Nx(fE(this.options)/2),e=this.width=this.maxWidth-t.width,i=this.height=this.maxHeight-t.height;this.xCenter=Math.floor(this.left+e/2+t.left),this.yCenter=Math.floor(this.top+i/2+t.top),this.drawingArea=Math.floor(Math.min(e,i)/2)}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!1);this.min=Xb(t)&&!isNaN(t)?t:0,this.max=Xb(e)&&!isNaN(e)?e:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/fE(this.options))}generateTickLabels(t){aE.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map(((t,e)=>{const i=t_(this.options.pointLabels.callback,[t,e],this);return i||0===i?i:""})).filter(((t,e)=>this.chart.getDataVisibility(e)))}fit(){const t=this.options;t.display&&t.pointLabels.display?vE(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,i,n){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((i-n)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,i,n))}getIndexAngle(t){return $_(t*(g_/(this._pointLabels.length||1))+T_(this.options.startAngle||0))}getDistanceFromCenterForValue(t){if(Gb(t))return NaN;const e=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*e:(t-this.min)*e}getValueForDistanceFromCenter(t){if(Gb(t))return NaN;const e=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-e:this.min+e}getPointLabelContext(t){const e=this._pointLabels||[];if(t>=0&&t<e.length){const i=e[t];return function(t,e,i){return Fx(t,{label:i,index:e,type:"pointLabel"})}(this.getContext(),t,i)}}getPointPosition(t,e,i=0){const n=this.getIndexAngle(t)-__+i;return{x:Math.cos(n)*e+this.xCenter,y:Math.sin(n)*e+this.yCenter,angle:n}}getPointPositionForValue(t,e){return this.getPointPosition(t,this.getDistanceFromCenterForValue(e))}getBasePosition(t){return this.getPointPositionForValue(t||0,this.getBaseValue())}getPointLabelPosition(t){const{left:e,top:i,right:n,bottom:o}=this._pointLabelItems[t];return{left:e,top:i,right:n,bottom:o}}drawBackground(){const{backgroundColor:t,grid:{circular:e}}=this.options;if(t){const i=this.ctx;i.save(),i.beginPath(),wE(this,this.getDistanceFromCenterForValue(this._endValue),e,this._pointLabels.length),i.closePath(),i.fillStyle=t,i.fill(),i.restore()}}drawGrid(){const t=this.ctx,e=this.options,{angleLines:i,grid:n,border:o}=e,s=this._pointLabels.length;let r,a,l;if(e.pointLabels.display&&function(t,e){const{ctx:i,options:{pointLabels:n}}=t;for(let o=e-1;o>=0;o--){const e=t._pointLabelItems[o];if(!e.visible)continue;const s=n.setContext(t.getPointLabelContext(o));xE(i,s,e);const r=jx(s.font),{x:a,y:l,textAlign:c}=e;Tx(i,t._pointLabels[o],a,l+r.lineHeight/2,r,{color:s.color,textAlign:c,textBaseline:"middle"})}}(this,s),n.display&&this.ticks.forEach(((t,e)=>{if(0!==e||0===e&&this.min<0){a=this.getDistanceFromCenterForValue(t.value);const i=this.getContext(e),r=n.setContext(i),l=o.setContext(i);!function(t,e,i,n,o){const s=t.ctx,r=e.circular,{color:a,lineWidth:l}=e;!r&&!n||!a||!l||i<0||(s.save(),s.strokeStyle=a,s.lineWidth=l,s.setLineDash(o.dash||[]),s.lineDashOffset=o.dashOffset,s.beginPath(),wE(t,i,r,n),s.closePath(),s.stroke(),s.restore())}(this,r,a,s,l)}})),i.display){for(t.save(),r=s-1;r>=0;r--){const n=i.setContext(this.getPointLabelContext(r)),{color:o,lineWidth:s}=n;s&&o&&(t.lineWidth=s,t.strokeStyle=o,t.setLineDash(n.borderDash),t.lineDashOffset=n.borderDashOffset,a=this.getDistanceFromCenterForValue(e.reverse?this.min:this.max),l=this.getPointPosition(r,a),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(l.x,l.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const t=this.ctx,e=this.options,i=e.ticks;if(!i.display)return;const n=this.getIndexAngle(0);let o,s;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(n),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach(((n,r)=>{if(0===r&&this.min>=0&&!e.reverse)return;const a=i.setContext(this.getContext(r)),l=jx(a.font);if(o=this.getDistanceFromCenterForValue(this.ticks[r].value),a.showLabelBackdrop){t.font=l.string,s=t.measureText(n.label).width,t.fillStyle=a.backdropColor;const e=Nx(a.backdropPadding);t.fillRect(-s/2-e.left,-o-l.size/2-e.top,s+e.width,l.size+e.height)}Tx(t,n.label,0,-o,l,{color:a.color,strokeColor:a.textStrokeColor,strokeWidth:a.textStrokeWidth})})),t.restore()}drawTitle(){}}const SE={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},CE=Object.keys(SE);function EE(t,e){return t-e}function AE(t,e){if(Gb(e))return null;const i=t._adapter,{parser:n,round:o,isoWeekday:s}=t._parseOpts;let r=e;return"function"==typeof n&&(r=n(r)),Xb(r)||(r="string"==typeof n?i.parse(r,n):i.parse(r)),null===r?null:(o&&(r="week"!==o||!A_(s)&&!0!==s?i.startOf(r,o):i.startOf(r,"isoWeek",s)),+r)}function ME(t,e,i,n){const o=CE.length;for(let s=CE.indexOf(t);s<o-1;++s){const t=SE[CE[s]],o=t.steps?t.steps:Number.MAX_SAFE_INTEGER;if(t.common&&Math.ceil((i-e)/(o*t.size))<=n)return CE[s]}return CE[o-1]}function TE(t,e,i){if(i){if(i.length){const{lo:n,hi:o}=j_(i,e);t[i[n]>=e?i[n]:i[o]]=!0}}else t[e]=!0}function PE(t,e,i){const n=[],o={},s=e.length;let r,a;for(r=0;r<s;++r)a=e[r],o[a]=r,n.push({value:a,major:!1});return 0!==s&&i?function(t,e,i,n){const o=t._adapter,s=+o.startOf(e[0].value,n),r=e[e.length-1].value;let a,l;for(a=s;a<=r;a=+o.add(a,1,n))l=i[a],l>=0&&(e[l].major=!0);return e}(t,n,o,i):n}class OE extends rS{static id="time";static defaults={bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}};constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,e={}){const i=t.time||(t.time={}),n=this._adapter=new uk._date(t.adapters.date);n.init(e),a_(i.displayFormats,n.formats()),this._parseOpts={parser:i.parser,round:i.round,isoWeekday:i.isoWeekday},super.init(t),this._normalized=e.normalized}parse(t,e){return void 0===t?null:AE(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const t=this.options,e=this._adapter,i=t.time.unit||"day";let{min:n,max:o,minDefined:s,maxDefined:r}=this.getUserBounds();function a(t){s||isNaN(t.min)||(n=Math.min(n,t.min)),r||isNaN(t.max)||(o=Math.max(o,t.max))}s&&r||(a(this._getLabelBounds()),"ticks"===t.bounds&&"labels"===t.ticks.source||a(this.getMinMax(!1))),n=Xb(n)&&!isNaN(n)?n:+e.startOf(Date.now(),i),o=Xb(o)&&!isNaN(o)?o:+e.endOf(Date.now(),i)+1,this.min=Math.min(n,o-1),this.max=Math.max(n+1,o)}_getLabelBounds(){const t=this.getLabelTimestamps();let e=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;return t.length&&(e=t[0],i=t[t.length-1]),{min:e,max:i}}buildTicks(){const t=this.options,e=t.time,i=t.ticks,n="labels"===i.source?this.getLabelTimestamps():this._generate();"ticks"===t.bounds&&n.length&&(this.min=this._userMin||n[0],this.max=this._userMax||n[n.length-1]);const o=this.min,s=function(t,e,i){let n=0,o=t.length;for(;n<o&&t[n]<e;)n++;for(;o>n&&t[o-1]>i;)o--;return n>0||o<t.length?t.slice(n,o):t}(n,o,this.max);return this._unit=e.unit||(i.autoSkip?ME(e.minUnit,this.min,this.max,this._getLabelCapacity(o)):function(t,e,i,n,o){for(let s=CE.length-1;s>=CE.indexOf(i);s--){const i=CE[s];if(SE[i].common&&t._adapter.diff(o,n,i)>=e-1)return i}return CE[i?CE.indexOf(i):0]}(this,s.length,e.minUnit,this.min,this.max)),this._majorUnit=i.major.enabled&&"year"!==this._unit?function(t){for(let e=CE.indexOf(t)+1,i=CE.length;e<i;++e)if(SE[CE[e]].common)return CE[e]}(this._unit):void 0,this.initOffsets(n),t.reverse&&s.reverse(),PE(this,s,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map((t=>+t.value)))}initOffsets(t=[]){let e,i,n=0,o=0;this.options.offset&&t.length&&(e=this.getDecimalForValue(t[0]),n=1===t.length?1-e:(this.getDecimalForValue(t[1])-e)/2,i=this.getDecimalForValue(t[t.length-1]),o=1===t.length?i:(i-this.getDecimalForValue(t[t.length-2]))/2);const s=t.length<3?.5:.25;n=R_(n,0,s),o=R_(o,0,s),this._offsets={start:n,end:o,factor:1/(n+1+o)}}_generate(){const t=this._adapter,e=this.min,i=this.max,n=this.options,o=n.time,s=o.unit||ME(o.minUnit,e,i,this._getLabelCapacity(e)),r=Qb(n.ticks.stepSize,1),a="week"===s&&o.isoWeekday,l=A_(a)||!0===a,c={};let h,d,u=e;if(l&&(u=+t.startOf(u,"isoWeek",a)),u=+t.startOf(u,l?"day":s),t.diff(i,e,s)>1e5*r)throw new Error(e+" and "+i+" are too far apart with stepSize of "+r+" "+s);const p="data"===n.ticks.source&&this.getDataTimestamps();for(h=u,d=0;h<i;h=+t.add(h,r,s),d++)TE(c,h,p);return h!==i&&"ticks"!==n.bounds&&1!==d||TE(c,h,p),Object.keys(c).sort(EE).map((t=>+t))}getLabelForValue(t){const e=this._adapter,i=this.options.time;return i.tooltipFormat?e.format(t,i.tooltipFormat):e.format(t,i.displayFormats.datetime)}format(t,e){const i=this.options.time.displayFormats,n=this._unit,o=e||i[n];return this._adapter.format(t,o)}_tickFormatFunction(t,e,i,n){const o=this.options,s=o.ticks.callback;if(s)return t_(s,[t,e,i],this);const r=o.time.displayFormats,a=this._unit,l=this._majorUnit,c=a&&r[a],h=l&&r[l],d=i[e],u=l&&h&&d&&d.major;return this._adapter.format(t,n||(u?h:c))}generateTickLabels(t){let e,i,n;for(e=0,i=t.length;e<i;++e)n=t[e],n.label=this._tickFormatFunction(n.value,e,t)}getDecimalForValue(t){return null===t?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){const e=this._offsets,i=this.getDecimalForValue(t);return this.getPixelForDecimal((e.start+i)*e.factor)}getValueForPixel(t){const e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return this.min+i*(this.max-this.min)}_getLabelSize(t){const e=this.options.ticks,i=this.ctx.measureText(t).width,n=T_(this.isHorizontal()?e.maxRotation:e.minRotation),o=Math.cos(n),s=Math.sin(n),r=this._resolveTickFontOptions(0).size;return{w:i*o+r*s,h:i*s+r*o}}_getLabelCapacity(t){const e=this.options.time,i=e.displayFormats,n=i[e.unit]||i.millisecond,o=this._tickFormatFunction(t,0,PE(this,[t],this._majorUnit),n),s=this._getLabelSize(o),r=Math.floor(this.isHorizontal()?this.width/s.w:this.height/s.h)-1;return r>0?r:1}getDataTimestamps(){let t,e,i=this._cache.data||[];if(i.length)return i;const n=this.getMatchingVisibleMetas();if(this._normalized&&n.length)return this._cache.data=n[0].controller.getAllParsedValues(this);for(t=0,e=n.length;t<e;++t)i=i.concat(n[t].controller.getAllParsedValues(this));return this._cache.data=this.normalize(i)}getLabelTimestamps(){const t=this._cache.labels||[];let e,i;if(t.length)return t;const n=this.getLabels();for(e=0,i=n.length;e<i;++e)t.push(AE(this,n[e]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return H_(t.sort(EE))}}function DE(t,e,i){let n,o,s,r,a=0,l=t.length-1;i?(e>=t[a].pos&&e<=t[l].pos&&({lo:a,hi:l}=B_(t,"pos",e)),({pos:n,time:s}=t[a]),({pos:o,time:r}=t[l])):(e>=t[a].time&&e<=t[l].time&&({lo:a,hi:l}=B_(t,"time",e)),({time:n,pos:s}=t[a]),({time:o,pos:r}=t[l]));const c=o-n;return c?s+(r-s)*(e-n)/c:s}var IE=Object.freeze({__proto__:null,CategoryScale:class extends rS{static id="category";static defaults={ticks:{callback:oE}};constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){const e=this._addedLabels;if(e.length){const t=this.getLabels();for(const{index:i,label:n}of e)t[i]===n&&t.splice(i,1);this._addedLabels=[]}super.init(t)}parse(t,e){if(Gb(t))return null;const i=this.getLabels();return((t,e)=>null===t?null:R_(Math.round(t),0,e))(e=isFinite(e)&&i[e]===t?e:nE(i,t,Qb(e,t),this._addedLabels),i.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let{min:i,max:n}=this.getMinMax(!0);"ticks"===this.options.bounds&&(t||(i=0),e||(n=this.getLabels().length-1)),this.min=i,this.max=n}buildTicks(){const t=this.min,e=this.max,i=this.options.offset,n=[];let o=this.getLabels();o=0===t&&e===o.length-1?o:o.slice(t,e+1),this._valueRange=Math.max(o.length-(i?0:1),1),this._startValue=this.min-(i?.5:0);for(let i=t;i<=e;i++)n.push({value:i});return n}getLabelForValue(t){return oE.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 e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}},LinearScale:lE,LogarithmicScale:mE,RadialLinearScale:kE,TimeScale:OE,TimeSeriesScale:class extends OE{static id="timeseries";static defaults=OE.defaults;constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),e=this._table=this.buildLookupTable(t);this._minPos=DE(e,this.min),this._tableRange=DE(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:e,max:i}=this,n=[],o=[];let s,r,a,l,c;for(s=0,r=t.length;s<r;++s)l=t[s],l>=e&&l<=i&&n.push(l);if(n.length<2)return[{time:e,pos:0},{time:i,pos:1}];for(s=0,r=n.length;s<r;++s)c=n[s+1],a=n[s-1],l=n[s],Math.round((c+a)/2)!==l&&o.push({time:l,pos:s/(r-1)});return o}_generate(){const t=this.min,e=this.max;let i=super.getDataTimestamps();return i.includes(t)&&i.length||i.splice(0,0,t),i.includes(e)&&1!==i.length||i.push(e),i.sort(((t,e)=>t-e))}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const e=this.getDataTimestamps(),i=this.getLabelTimestamps();return t=e.length&&i.length?this.normalize(e.concat(i)):e.length?e:i,t=this._cache.all=t,t}getDecimalForValue(t){return(DE(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return DE(this._table,i*this._tableRange+this._minPos,!0)}}});const LE=[ck,sC,iE,IE];RS.register(...LE);
8523
+ */class Lw{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,e,i,n){const o=e.listeners[n],s=e.duration;o.forEach((n=>n({chart:t,initial:e.initial,numSteps:s,currentStep:Math.min(i-e.start,s)})))}_refresh(){this._request||(this._running=!0,this._request=H_.call(window,(()=>{this._update(),this._request=null,this._running&&this._refresh()})))}_update(t=Date.now()){let e=0;this._charts.forEach(((i,n)=>{if(!i.running||!i.items.length)return;const o=i.items;let s,r=o.length-1,a=!1;for(;r>=0;--r)s=o[r],s._active?(s._total>i.duration&&(i.duration=s._total),s.tick(t),a=!0):(o[r]=o[o.length-1],o.pop());a&&(n.draw(),this._notify(n,i,t,"progress")),o.length||(i.running=!1,this._notify(n,i,t,"complete"),i.initial=!1),e+=o.length})),this._lastDate=t,0===e&&(this._running=!1)}_getAnims(t){const e=this._charts;let i=e.get(t);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,i)),i}listen(t,e,i){this._getAnims(t).listeners[e].push(i)}add(t,e){e&&e.length&&this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){const e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce(((t,e)=>Math.max(t,e._duration)),0),this._refresh())}running(t){if(!this._running)return!1;const e=this._charts.get(t);return!!(e&&e.running&&e.items.length)}stop(t){const e=this._charts.get(t);if(!e||!e.items.length)return;const i=e.items;let n=i.length-1;for(;n>=0;--n)i[n].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var $w=new Lw;const zw="transparent",Rw={boolean:(t,e,i)=>i>.5?e:t,color(t,e,i){const n=ex(t||zw),o=n.valid&&ex(e||zw);return o&&o.valid?o.mix(n,i).hexString():e},number:(t,e,i)=>t+(e-t)*i};class Nw{constructor(t,e,i,n){const o=e[i];n=jx([t.to,n,o,t.from]);const s=jx([t.from,o,n]);this._active=!0,this._fn=t.fn||Rw[t.type||typeof s],this._easing=J_[t.easing]||J_.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=e,this._prop=i,this._from=s,this._to=n,this._promises=void 0}active(){return this._active}update(t,e,i){if(this._active){this._notify(!1);const n=this._target[this._prop],o=i-this._start,s=this._duration-o;this._start=i,this._duration=Math.floor(Math.max(s,t.duration)),this._total+=o,this._loop=!!t.loop,this._to=jx([t.to,e,n,t.from]),this._from=jx([t.from,n,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const e=t-this._start,i=this._duration,n=this._prop,o=this._from,s=this._loop,r=this._to;let a;if(this._active=o!==r&&(s||e<i),!this._active)return this._target[n]=r,void this._notify(!0);e<0?this._target[n]=o:(a=e/i%2,a=s&&a>1?2-a:a,a=this._easing(Math.min(1,Math.max(0,a))),this._target[n]=this._fn(o,r,a))}wait(){const t=this._promises||(this._promises=[]);return new Promise(((e,i)=>{t.push({res:e,rej:i})}))}_notify(t){const e=t?"res":"rej",i=this._promises||[];for(let t=0;t<i.length;t++)i[t][e]()}}class jw{constructor(t,e){this._chart=t,this._properties=new Map,this.configure(e)}configure(t){if(!Zb(t))return;const e=Object.keys(mx.animation),i=this._properties;Object.getOwnPropertyNames(t).forEach((n=>{const o=t[n];if(!Zb(o))return;const s={};for(const t of e)s[t]=o[t];(Gb(o.properties)&&o.properties||[n]).forEach((t=>{t!==n&&i.has(t)||i.set(t,s)}))}))}_animateOptions(t,e){const i=e.options,n=function(t,e){if(!e)return;let i=t.options;if(!i)return void(t.options=e);i.$shared&&(t.options=i=Object.assign({},i,{$shared:!1,$animations:{}}));return i}(t,i);if(!n)return[];const o=this._createAnimations(n,i);return i.$shared&&function(t,e){const i=[],n=Object.keys(e);for(let e=0;e<n.length;e++){const o=t[n[e]];o&&o.active()&&i.push(o.wait())}return Promise.all(i)}(t.options.$animations,i).then((()=>{t.options=i}),(()=>{})),o}_createAnimations(t,e){const i=this._properties,n=[],o=t.$animations||(t.$animations={}),s=Object.keys(e),r=Date.now();let a;for(a=s.length-1;a>=0;--a){const l=s[a];if("$"===l.charAt(0))continue;if("options"===l){n.push(...this._animateOptions(t,e));continue}const c=e[l];let h=o[l];const d=i.get(l);if(h){if(d&&h.active()){h.update(d,c,r);continue}h.cancel()}d&&d.duration?(o[l]=h=new Nw(d,t,l,c),n.push(h)):t[l]=c}return n}update(t,e){if(0===this._properties.size)return void Object.assign(t,e);const i=this._createAnimations(t,e);return i.length?($w.add(this._chart,i),!0):void 0}}function Bw(t,e){const i=t&&t.options||{},n=i.reverse,o=void 0===i.min?e:0,s=void 0===i.max?e:0;return{start:n?s:o,end:n?o:s}}function Fw(t,e){const i=[],n=t._getSortedDatasetMetas(e);let o,s;for(o=0,s=n.length;o<s;++o)i.push(n[o].index);return i}function qw(t,e,i,n={}){const o=t.keys,s="single"===n.mode;let r,a,l,c;if(null===e)return;let h=!1;for(r=0,a=o.length;r<a;++r){if(l=+o[r],l===i){if(h=!0,n.all)continue;break}c=t.values[l],Yb(c)&&(s||0===e||k_(e)===k_(c))&&(e+=c)}return h||n.all?e:0}function Vw(t,e){const i=t&&t.options.stacked;return i||void 0===i&&void 0!==e.stack}function Hw(t,e,i){const n=t[e]||(t[e]={});return n[i]||(n[i]={})}function Uw(t,e,i,n){for(const o of e.getMatchingVisibleMetas(n).reverse()){const e=t[o.index];if(i&&e>0||!i&&e<0)return o.index}return null}function Ww(t,e){const{chart:i,_cachedMeta:n}=t,o=i._stacks||(i._stacks={}),{iScale:s,vScale:r,index:a}=n,l=s.axis,c=r.axis,h=function(t,e,i){return`${t.id}.${e.id}.${i.stack||i.type}`}(s,r,n),d=e.length;let u;for(let t=0;t<d;++t){const i=e[t],{[l]:s,[c]:d}=i;u=(i._stacks||(i._stacks={}))[c]=Hw(o,h,s),u[a]=d,u._top=Uw(u,r,!0,n.type),u._bottom=Uw(u,r,!1,n.type);(u._visualValues||(u._visualValues={}))[a]=d}}function Gw(t,e){const i=t.scales;return Object.keys(i).filter((t=>i[t].axis===e)).shift()}function Zw(t,e){const i=t.controller.index,n=t.vScale&&t.vScale.axis;if(n){e=e||t._parsed;for(const t of e){const e=t._stacks;if(!e||void 0===e[n]||void 0===e[n][i])return;delete e[n][i],void 0!==e[n]._visualValues&&void 0!==e[n]._visualValues[i]&&delete e[n]._visualValues[i]}}}const Yw=t=>"reset"===t||"none"===t,Xw=(t,e)=>e?t:Object.assign({},t);class Kw{static defaults={};static datasetElementType=null;static dataElementType=null;constructor(t,e){this.chart=t,this._ctx=t.ctx,this.index=e,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.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=Vw(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&&Zw(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,e=this._cachedMeta,i=this.getDataset(),n=(t,e,i,n)=>"x"===t?e:"r"===t?n:i,o=e.xAxisID=Kb(i.xAxisID,Gw(t,"x")),s=e.yAxisID=Kb(i.yAxisID,Gw(t,"y")),r=e.rAxisID=Kb(i.rAxisID,Gw(t,"r")),a=e.indexAxis,l=e.iAxisID=n(a,o,s,r),c=e.vAxisID=n(a,s,o,r);e.xScale=this.getScaleForId(o),e.yScale=this.getScaleForId(s),e.rScale=this.getScaleForId(r),e.iScale=this.getScaleForId(l),e.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 e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&q_(this._data,this),t._stacked&&Zw(t)}_dataCheck(){const t=this.getDataset(),e=t.data||(t.data=[]),i=this._data;if(Zb(e)){const t=this._cachedMeta;this._data=function(t,e){const{iScale:i,vScale:n}=e,o="x"===i.axis?"x":"y",s="x"===n.axis?"x":"y",r=Object.keys(t),a=new Array(r.length);let l,c,h;for(l=0,c=r.length;l<c;++l)h=r[l],a[l]={[o]:h,[s]:t[h]};return a}(e,t)}else if(i!==e){if(i){q_(i,this);const t=this._cachedMeta;Zw(t),t._parsed=[]}e&&Object.isExtensible(e)&&(o=this,(n=e)._chartjs?n._chartjs.listeners.push(o):(Object.defineProperty(n,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[o]}}),F_.forEach((t=>{const e="_onData"+h_(t),i=n[t];Object.defineProperty(n,t,{configurable:!0,enumerable:!1,value(...t){const o=i.apply(this,t);return n._chartjs.listeners.forEach((i=>{"function"==typeof i[e]&&i[e](...t)})),o}})})))),this._syncList=[],this._data=e}var n,o}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const e=this._cachedMeta,i=this.getDataset();let n=!1;this._dataCheck();const o=e._stacked;e._stacked=Vw(e.vScale,e),e.stack!==i.stack&&(n=!0,Zw(e),e.stack=i.stack),this._resyncElements(t),(n||o!==e._stacked)&&(Ww(this,e._parsed),e._stacked=Vw(e.vScale,e))}configure(){const t=this.chart.config,e=t.datasetScopeKeys(this._type),i=t.getOptionScopes(this.getDataset(),e,!0);this.options=t.createResolver(i,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,e){const{_cachedMeta:i,_data:n}=this,{iScale:o,_stacked:s}=i,r=o.axis;let a,l,c,h=0===t&&e===n.length||i._sorted,d=t>0&&i._parsed[t-1];if(!1===this._parsing)i._parsed=n,i._sorted=!0,c=n;else{c=Gb(n[t])?this.parseArrayData(i,n,t,e):Zb(n[t])?this.parseObjectData(i,n,t,e):this.parsePrimitiveData(i,n,t,e);const o=()=>null===l[r]||d&&l[r]<d[r];for(a=0;a<e;++a)i._parsed[a+t]=l=c[a],h&&(o()&&(h=!1),d=l);i._sorted=h}s&&Ww(this,c)}parsePrimitiveData(t,e,i,n){const{iScale:o,vScale:s}=t,r=o.axis,a=s.axis,l=o.getLabels(),c=o===s,h=new Array(n);let d,u,p;for(d=0,u=n;d<u;++d)p=d+i,h[d]={[r]:c||o.parse(l[p],p),[a]:s.parse(e[p],p)};return h}parseArrayData(t,e,i,n){const{xScale:o,yScale:s}=t,r=new Array(n);let a,l,c,h;for(a=0,l=n;a<l;++a)c=a+i,h=e[c],r[a]={x:o.parse(h[0],c),y:s.parse(h[1],c)};return r}parseObjectData(t,e,i,n){const{xScale:o,yScale:s}=t,{xAxisKey:r="x",yAxisKey:a="y"}=this._parsing,l=new Array(n);let c,h,d,u;for(c=0,h=n;c<h;++c)d=c+i,u=e[d],l[c]={x:o.parse(c_(u,r),d),y:s.parse(c_(u,a),d)};return l}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,e,i){const n=this.chart,o=this._cachedMeta,s=e[t.axis];return qw({keys:Fw(n,!0),values:e._stacks[t.axis]._visualValues},s,o.index,{mode:i})}updateRangeFromParsed(t,e,i,n){const o=i[e.axis];let s=null===o?NaN:o;const r=n&&i._stacks[e.axis];n&&r&&(n.values=r,s=qw(n,o,this._cachedMeta.index)),t.min=Math.min(t.min,s),t.max=Math.max(t.max,s)}getMinMax(t,e){const i=this._cachedMeta,n=i._parsed,o=i._sorted&&t===i.iScale,s=n.length,r=this._getOtherScale(t),a=((t,e,i)=>t&&!e.hidden&&e._stacked&&{keys:Fw(i,!0),values:null})(e,i,this.chart),l={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:c,max:h}=function(t){const{min:e,max:i,minDefined:n,maxDefined:o}=t.getUserBounds();return{min:n?e:Number.NEGATIVE_INFINITY,max:o?i:Number.POSITIVE_INFINITY}}(r);let d,u;function p(){u=n[d];const e=u[r.axis];return!Yb(u[t.axis])||c>e||h<e}for(d=0;d<s&&(p()||(this.updateRangeFromParsed(l,t,u,a),!o));++d);if(o)for(d=s-1;d>=0;--d)if(!p()){this.updateRangeFromParsed(l,t,u,a);break}return l}getAllParsedValues(t){const e=this._cachedMeta._parsed,i=[];let n,o,s;for(n=0,o=e.length;n<o;++n)s=e[n][t.axis],Yb(s)&&i.push(s);return i}getMaxOverflow(){return!1}getLabelAndValue(t){const e=this._cachedMeta,i=e.iScale,n=e.vScale,o=this.getParsed(t);return{label:i?""+i.getLabelForValue(o[i.axis]):"",value:n?""+n.getLabelForValue(o[n.axis]):""}}_update(t){const e=this._cachedMeta;this.update(t||"default"),e._clip=function(t){let e,i,n,o;return Zb(t)?(e=t.top,i=t.right,n=t.bottom,o=t.left):e=i=n=o=t,{top:e,right:i,bottom:n,left:o,disabled:!1===t}}(Kb(this.options.clip,function(t,e,i){if(!1===i)return!1;const n=Bw(t,i),o=Bw(e,i);return{top:o.end,right:n.end,bottom:o.start,left:n.start}}(e.xScale,e.yScale,this.getMaxOverflow())))}update(t){}draw(){const t=this._ctx,e=this.chart,i=this._cachedMeta,n=i.data||[],o=e.chartArea,s=[],r=this._drawStart||0,a=this._drawCount||n.length-r,l=this.options.drawActiveElementsOnTop;let c;for(i.dataset&&i.dataset.draw(t,o,r,a),c=r;c<r+a;++c){const e=n[c];e.hidden||(e.active&&l?s.push(e):e.draw(t,o))}for(c=0;c<s.length;++c)s[c].draw(t,o)}getStyle(t,e){const i=e?"active":"default";return void 0===t&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(i):this.resolveDataElementOptions(t||0,i)}getContext(t,e,i){const n=this.getDataset();let o;if(t>=0&&t<this._cachedMeta.data.length){const e=this._cachedMeta.data[t];o=e.$context||(e.$context=function(t,e,i){return Bx(t,{active:!1,dataIndex:e,parsed:void 0,raw:void 0,element:i,index:e,mode:"default",type:"data"})}(this.getContext(),t,e)),o.parsed=this.getParsed(t),o.raw=n.data[t],o.index=o.dataIndex=t}else o=this.$context||(this.$context=function(t,e){return Bx(t,{active:!1,dataset:void 0,datasetIndex:e,index:e,mode:"default",type:"dataset"})}(this.chart.getContext(),this.index)),o.dataset=n,o.index=o.datasetIndex=this.index;return o.active=!!e,o.mode=i,o}resolveDatasetElementOptions(t){return this._resolveElementOptions(this.datasetElementType.id,t)}resolveDataElementOptions(t,e){return this._resolveElementOptions(this.dataElementType.id,e,t)}_resolveElementOptions(t,e="default",i){const n="active"===e,o=this._cachedDataOpts,s=t+"-"+e,r=o[s],a=this.enableOptionSharing&&d_(i);if(r)return Xw(r,a);const l=this.chart.config,c=l.datasetElementScopeKeys(this._type,t),h=n?[`${t}Hover`,"hover",t,""]:[t,""],d=l.getOptionScopes(this.getDataset(),c),u=Object.keys(mx.elements[t]),p=l.resolveNamedOptions(d,u,(()=>this.getContext(i,n,e)),h);return p.$shared&&(p.$shared=a,o[s]=Object.freeze(Xw(p,a))),p}_resolveAnimations(t,e,i){const n=this.chart,o=this._cachedDataOpts,s=`animation-${e}`,r=o[s];if(r)return r;let a;if(!1!==n.options.animation){const n=this.chart.config,o=n.datasetAnimationScopeKeys(this._type,e),s=n.getOptionScopes(this.getDataset(),o);a=n.createResolver(s,this.getContext(t,i,e))}const l=new jw(n,a&&a.animations);return a&&a._cacheable&&(o[s]=Object.freeze(l)),l}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||Yw(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){const i=this.resolveDataElementOptions(t,e),n=this._sharedOptions,o=this.getSharedOptions(i),s=this.includeOptions(e,o)||o!==n;return this.updateSharedOptions(o,e,i),{sharedOptions:o,includeOptions:s}}updateElement(t,e,i,n){Yw(n)?Object.assign(t,i):this._resolveAnimations(e,n).update(t,i)}updateSharedOptions(t,e,i){t&&!Yw(e)&&this._resolveAnimations(void 0,e).update(t,i)}_setStyle(t,e,i,n){t.active=n;const o=this.getStyle(e,n);this._resolveAnimations(e,i,n).update(t,{options:!n&&this.getSharedOptions(o)||o})}removeHoverStyle(t,e,i){this._setStyle(t,i,"active",!1)}setHoverStyle(t,e,i){this._setStyle(t,i,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const e=this._data,i=this._cachedMeta.data;for(const[t,e,i]of this._syncList)this[t](e,i);this._syncList=[];const n=i.length,o=e.length,s=Math.min(o,n);s&&this.parse(0,s),o>n?this._insertElements(n,o-n,t):o<n&&this._removeElements(o,n-o)}_insertElements(t,e,i=!0){const n=this._cachedMeta,o=n.data,s=t+e;let r;const a=t=>{for(t.length+=e,r=t.length-1;r>=s;r--)t[r]=t[r-e]};for(a(o),r=t;r<s;++r)o[r]=new this.dataElementType;this._parsing&&a(n._parsed),this.parse(t,e),i&&this.updateElements(o,t,e,"reset")}updateElements(t,e,i,n){}_removeElements(t,e){const i=this._cachedMeta;if(this._parsing){const n=i._parsed.splice(t,e);i._stacked&&Zw(i,n)}i.data.splice(t,e)}_sync(t){if(this._parsing)this._syncList.push(t);else{const[e,i,n]=t;this[e](i,n)}this.chart._dataChanges.push([this.index,...t])}_onDataPush(){const t=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-t,t])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(t,e){e&&this._sync(["_removeElements",t,e]);const i=arguments.length-2;i&&this._sync(["_insertElements",t,i])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}function Qw(t){const e=t.iScale,i=function(t,e){if(!t._cache.$bar){const i=t.getMatchingVisibleMetas(e);let n=[];for(let e=0,o=i.length;e<o;e++)n=n.concat(i[e].controller.getAllParsedValues(t));t._cache.$bar=V_(n.sort(((t,e)=>t-e)))}return t._cache.$bar}(e,t.type);let n,o,s,r,a=e._length;const l=()=>{32767!==s&&-32768!==s&&(d_(r)&&(a=Math.min(a,Math.abs(s-r)||a)),r=s)};for(n=0,o=i.length;n<o;++n)s=e.getPixelForValue(i[n]),l();for(r=void 0,n=0,o=e.ticks.length;n<o;++n)s=e.getPixelForTick(n),l();return a}function Jw(t,e,i,n){return Gb(t)?function(t,e,i,n){const o=i.parse(t[0],n),s=i.parse(t[1],n),r=Math.min(o,s),a=Math.max(o,s);let l=r,c=a;Math.abs(r)>Math.abs(a)&&(l=a,c=r),e[i.axis]=c,e._custom={barStart:l,barEnd:c,start:o,end:s,min:r,max:a}}(t,e,i,n):e[i.axis]=i.parse(t,n),e}function tk(t,e,i,n){const o=t.iScale,s=t.vScale,r=o.getLabels(),a=o===s,l=[];let c,h,d,u;for(c=i,h=i+n;c<h;++c)u=e[c],d={},d[o.axis]=a||o.parse(r[c],c),l.push(Jw(u,d,s,c));return l}function ek(t){return t&&void 0!==t.barStart&&void 0!==t.barEnd}function ik(t,e,i,n){let o=e.borderSkipped;const s={};if(!o)return void(t.borderSkipped=s);if(!0===o)return void(t.borderSkipped={top:!0,right:!0,bottom:!0,left:!0});const{start:r,end:a,reverse:l,top:c,bottom:h}=function(t){let e,i,n,o,s;return t.horizontal?(e=t.base>t.x,i="left",n="right"):(e=t.base<t.y,i="bottom",n="top"),e?(o="end",s="start"):(o="start",s="end"),{start:i,end:n,reverse:e,top:o,bottom:s}}(t);"middle"===o&&i&&(t.enableBorderRadius=!0,(i._top||0)===n?o=c:(i._bottom||0)===n?o=h:(s[nk(h,r,a,l)]=!0,o=c)),s[nk(o,r,a,l)]=!0,t.borderSkipped=s}function nk(t,e,i,n){var o,s,r;return n?(r=i,t=ok(t=(o=t)===(s=e)?r:o===r?s:o,i,e)):t=ok(t,e,i),t}function ok(t,e,i){return"start"===t?e:"end"===t?i:t}function sk(t,{inflateAmount:e},i){t.inflateAmount="auto"===e?1===i?.33:0:e}class rk extends Kw{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 e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:i,color:n}}=t.legend.options;return e.labels.map(((e,o)=>{const s=t.getDatasetMeta(0).controller.getStyle(o);return{text:e,fillStyle:s.backgroundColor,strokeStyle:s.borderColor,fontColor:n,lineWidth:s.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(o),index:o}}))}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}}};constructor(t,e){super(t,e),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,e){const i=this.getDataset().data,n=this._cachedMeta;if(!1===this._parsing)n._parsed=i;else{let o,s,r=t=>+i[t];if(Zb(i[t])){const{key:t="value"}=this._parsing;r=e=>+c_(i[e],t)}for(o=t,s=t+e;o<s;++o)n._parsed[o]=r(o)}}_getRotation(){return M_(this.options.rotation-90)}_getCircumference(){return M_(this.options.circumference)}_getRotationExtents(){let t=f_,e=-f_;for(let i=0;i<this.chart.data.datasets.length;++i)if(this.chart.isDatasetVisible(i)&&this.chart.getDatasetMeta(i).type===this._type){const n=this.chart.getDatasetMeta(i).controller,o=n._getRotation(),s=n._getCircumference();t=Math.min(t,o),e=Math.max(e,o+s)}return{rotation:t,circumference:e-t}}update(t){const e=this.chart,{chartArea:i}=e,n=this._cachedMeta,o=n.data,s=this.getMaxBorderWidth()+this.getMaxOffset(o)+this.options.spacing,r=Math.max((Math.min(i.width,i.height)-s)/2,0),a=Math.min((l=this.options.cutout,c=r,"string"==typeof l&&l.endsWith("%")?parseFloat(l)/100:+l/c),1);var l,c;const h=this._getRingWeight(this.index),{circumference:d,rotation:u}=this._getRotationExtents(),{ratioX:p,ratioY:m,offsetX:f,offsetY:g}=function(t,e,i){let n=1,o=1,s=0,r=0;if(e<f_){const a=t,l=a+e,c=Math.cos(a),h=Math.sin(a),d=Math.cos(l),u=Math.sin(l),p=(t,e,n)=>$_(t,a,l,!0)?1:Math.max(e,e*i,n,n*i),m=(t,e,n)=>$_(t,a,l,!0)?-1:Math.min(e,e*i,n,n*i),f=p(0,c,d),g=p(b_,h,u),v=m(m_,c,d),y=m(m_+b_,h,u);n=(f-v)/2,o=(g-y)/2,s=-(f+v)/2,r=-(g+y)/2}return{ratioX:n,ratioY:o,offsetX:s,offsetY:r}}(u,d,a),v=(i.width-s)/p,y=(i.height-s)/m,b=Math.max(Math.min(v,y)/2,0),_=Qb(this.options.radius,b),x=(_-Math.max(_*a,0))/this._getVisibleDatasetWeightTotal();this.offsetX=f*_,this.offsetY=g*_,n.total=this.calculateTotal(),this.outerRadius=_-x*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-x*h,0),this.updateElements(o,0,o.length,t)}_circumference(t,e){const i=this.options,n=this._cachedMeta,o=this._getCircumference();return e&&i.animation.animateRotate||!this.chart.getDataVisibility(t)||null===n._parsed[t]||n.data[t].hidden?0:this.calculateCircumference(n._parsed[t]*o/f_)}updateElements(t,e,i,n){const o="reset"===n,s=this.chart,r=s.chartArea,a=s.options.animation,l=(r.left+r.right)/2,c=(r.top+r.bottom)/2,h=o&&a.animateScale,d=h?0:this.innerRadius,u=h?0:this.outerRadius,{sharedOptions:p,includeOptions:m}=this._getSharedOptions(e,n);let f,g=this._getRotation();for(f=0;f<e;++f)g+=this._circumference(f,o);for(f=e;f<e+i;++f){const e=this._circumference(f,o),i=t[f],s={x:l+this.offsetX,y:c+this.offsetY,startAngle:g,endAngle:g+e,circumference:e,outerRadius:u,innerRadius:d};m&&(s.options=p||this.resolveDataElementOptions(f,i.active?"active":n)),g+=e,this.updateElement(i,f,s,n)}}calculateTotal(){const t=this._cachedMeta,e=t.data;let i,n=0;for(i=0;i<e.length;i++){const o=t._parsed[i];null===o||isNaN(o)||!this.chart.getDataVisibility(i)||e[i].hidden||(n+=Math.abs(o))}return n}calculateCircumference(t){const e=this._cachedMeta.total;return e>0&&!isNaN(t)?f_*(Math.abs(t)/e):0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,n=i.data.labels||[],o=rx(e._parsed[t],i.options.locale);return{label:n[t]||"",value:o}}getMaxBorderWidth(t){let e=0;const i=this.chart;let n,o,s,r,a;if(!t)for(n=0,o=i.data.datasets.length;n<o;++n)if(i.isDatasetVisible(n)){s=i.getDatasetMeta(n),t=s.data,r=s.controller;break}if(!t)return 0;for(n=0,o=t.length;n<o;++n)a=r.resolveDataElementOptions(n),"inner"!==a.borderAlign&&(e=Math.max(e,a.borderWidth||0,a.hoverBorderWidth||0));return e}getMaxOffset(t){let e=0;for(let i=0,n=t.length;i<n;++i){const t=this.resolveDataElementOptions(i);e=Math.max(e,t.offset||0,t.hoverOffset||0)}return e}_getRingWeightOffset(t){let e=0;for(let i=0;i<t;++i)this.chart.isDatasetVisible(i)&&(e+=this._getRingWeight(i));return e}_getRingWeight(t){return Math.max(Kb(this.chart.data.datasets[t].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}class ak extends Kw{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 e=t.data;if(e.labels.length&&e.datasets.length){const{labels:{pointStyle:i,color:n}}=t.legend.options;return e.labels.map(((e,o)=>{const s=t.getDatasetMeta(0).controller.getStyle(o);return{text:e,fillStyle:s.backgroundColor,strokeStyle:s.borderColor,fontColor:n,lineWidth:s.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(o),index:o}}))}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}};constructor(t,e){super(t,e),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,n=i.data.labels||[],o=rx(e._parsed[t].r,i.options.locale);return{label:n[t]||"",value:o}}parseObjectData(t,e,i,n){return tw.bind(this)(t,e,i,n)}update(t){const e=this._cachedMeta.data;this._updateRadius(),this.updateElements(e,0,e.length,t)}getMinMax(){const t=this._cachedMeta,e={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach(((t,i)=>{const n=this.getParsed(i).r;!isNaN(n)&&this.chart.getDataVisibility(i)&&(n<e.min&&(e.min=n),n>e.max&&(e.max=n))})),e}_updateRadius(){const t=this.chart,e=t.chartArea,i=t.options,n=Math.min(e.right-e.left,e.bottom-e.top),o=Math.max(n/2,0),s=(o-Math.max(i.cutoutPercentage?o/100*i.cutoutPercentage:1,0))/t.getVisibleDatasetCount();this.outerRadius=o-s*this.index,this.innerRadius=this.outerRadius-s}updateElements(t,e,i,n){const o="reset"===n,s=this.chart,r=s.options.animation,a=this._cachedMeta.rScale,l=a.xCenter,c=a.yCenter,h=a.getIndexAngle(0)-.5*m_;let d,u=h;const p=360/this.countVisibleElements();for(d=0;d<e;++d)u+=this._computeAngle(d,n,p);for(d=e;d<e+i;d++){const e=t[d];let i=u,m=u+this._computeAngle(d,n,p),f=s.getDataVisibility(d)?a.getDistanceFromCenterForValue(this.getParsed(d).r):0;u=m,o&&(r.animateScale&&(f=0),r.animateRotate&&(i=m=h));const g={x:l,y:c,innerRadius:0,outerRadius:f,startAngle:i,endAngle:m,options:this.resolveDataElementOptions(d,e.active?"active":n)};this.updateElement(e,d,g,n)}}countVisibleElements(){const t=this._cachedMeta;let e=0;return t.data.forEach(((t,i)=>{!isNaN(this.getParsed(i).r)&&this.chart.getDataVisibility(i)&&e++})),e}_computeAngle(t,e,i){return this.chart.getDataVisibility(t)?M_(this.resolveDataElementOptions(t,e).angle||i):0}}var lk=Object.freeze({__proto__:null,BarController:class extends Kw{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,e,i,n){return tk(t,e,i,n)}parseArrayData(t,e,i,n){return tk(t,e,i,n)}parseObjectData(t,e,i,n){const{iScale:o,vScale:s}=t,{xAxisKey:r="x",yAxisKey:a="y"}=this._parsing,l="x"===o.axis?r:a,c="x"===s.axis?r:a,h=[];let d,u,p,m;for(d=i,u=i+n;d<u;++d)m=e[d],p={},p[o.axis]=o.parse(c_(m,l),d),h.push(Jw(c_(m,c),p,s,d));return h}updateRangeFromParsed(t,e,i,n){super.updateRangeFromParsed(t,e,i,n);const o=i._custom;o&&e===this._cachedMeta.vScale&&(t.min=Math.min(t.min,o.min),t.max=Math.max(t.max,o.max))}getMaxOverflow(){return 0}getLabelAndValue(t){const e=this._cachedMeta,{iScale:i,vScale:n}=e,o=this.getParsed(t),s=o._custom,r=ek(s)?"["+s.start+", "+s.end+"]":""+n.getLabelForValue(o[n.axis]);return{label:""+i.getLabelForValue(o[i.axis]),value:r}}initialize(){this.enableOptionSharing=!0,super.initialize();this._cachedMeta.stack=this.getDataset().stack}update(t){const e=this._cachedMeta;this.updateElements(e.data,0,e.data.length,t)}updateElements(t,e,i,n){const o="reset"===n,{index:s,_cachedMeta:{vScale:r}}=this,a=r.getBasePixel(),l=r.isHorizontal(),c=this._getRuler(),{sharedOptions:h,includeOptions:d}=this._getSharedOptions(e,n);for(let u=e;u<e+i;u++){const e=this.getParsed(u),i=o||Wb(e[r.axis])?{base:a,head:a}:this._calculateBarValuePixels(u),p=this._calculateBarIndexPixels(u,c),m=(e._stacks||{})[r.axis],f={horizontal:l,base:i.base,enableBorderRadius:!m||ek(e._custom)||s===m._top||s===m._bottom,x:l?i.head:p.center,y:l?p.center:i.head,height:l?p.size:Math.abs(i.size),width:l?Math.abs(i.size):p.size};d&&(f.options=h||this.resolveDataElementOptions(u,t[u].active?"active":n));const g=f.options||t[u].options;ik(f,g,m,s),sk(f,g,c.ratio),this.updateElement(t[u],u,f,n)}}_getStacks(t,e){const{iScale:i}=this._cachedMeta,n=i.getMatchingVisibleMetas(this._type).filter((t=>t.controller.options.grouped)),o=i.options.stacked,s=[],r=this._cachedMeta.controller.getParsed(e),a=r&&r[i.axis],l=t=>{const e=t._parsed.find((t=>t[i.axis]===a)),n=e&&e[t.vScale.axis];if(Wb(n)||isNaN(n))return!0};for(const i of n)if((void 0===e||!l(i))&&((!1===o||-1===s.indexOf(i.stack)||void 0===o&&void 0===i.stack)&&s.push(i.stack),i.index===t))break;return s.length||s.push(void 0),s}_getStackCount(t){return this._getStacks(void 0,t).length}_getStackIndex(t,e,i){const n=this._getStacks(t,i),o=void 0!==e?n.indexOf(e):-1;return-1===o?n.length-1:o}_getRuler(){const t=this.options,e=this._cachedMeta,i=e.iScale,n=[];let o,s;for(o=0,s=e.data.length;o<s;++o)n.push(i.getPixelForValue(this.getParsed(o)[i.axis],o));const r=t.barThickness;return{min:r||Qw(e),pixels:n,start:i._startPixel,end:i._endPixel,stackCount:this._getStackCount(),scale:i,grouped:t.grouped,ratio:r?1:t.categoryPercentage*t.barPercentage}}_calculateBarValuePixels(t){const{_cachedMeta:{vScale:e,_stacked:i,index:n},options:{base:o,minBarLength:s}}=this,r=o||0,a=this.getParsed(t),l=a._custom,c=ek(l);let h,d,u=a[e.axis],p=0,m=i?this.applyStack(e,a,i):u;m!==u&&(p=m-u,m=u),c&&(u=l.barStart,m=l.barEnd-l.barStart,0!==u&&k_(u)!==k_(l.barEnd)&&(p=0),p+=u);const f=Wb(o)||c?p:o;let g=e.getPixelForValue(f);if(h=this.chart.getDataVisibility(t)?e.getPixelForValue(p+m):g,d=h-g,Math.abs(d)<s){d=function(t,e,i){return 0!==t?k_(t):(e.isHorizontal()?1:-1)*(e.min>=i?1:-1)}(d,e,r)*s,u===r&&(g-=d/2);const t=e.getPixelForDecimal(0),o=e.getPixelForDecimal(1),l=Math.min(t,o),p=Math.max(t,o);g=Math.max(Math.min(g,p),l),h=g+d,i&&!c&&(a._stacks[e.axis]._visualValues[n]=e.getValueForPixel(h)-e.getValueForPixel(g))}if(g===e.getPixelForValue(r)){const t=k_(d)*e.getLineWidthForValue(r)/2;g+=t,d-=t}return{size:d,base:g,head:h,center:h+d/2}}_calculateBarIndexPixels(t,e){const i=e.scale,n=this.options,o=n.skipNull,s=Kb(n.maxBarThickness,1/0);let r,a;if(e.grouped){const i=o?this._getStackCount(t):e.stackCount,l="flex"===n.barThickness?function(t,e,i,n){const o=e.pixels,s=o[t];let r=t>0?o[t-1]:null,a=t<o.length-1?o[t+1]:null;const l=i.categoryPercentage;null===r&&(r=s-(null===a?e.end-e.start:a-s)),null===a&&(a=s+s-r);const c=s-(s-Math.min(r,a))/2*l;return{chunk:Math.abs(a-r)/2*l/n,ratio:i.barPercentage,start:c}}(t,e,n,i):function(t,e,i,n){const o=i.barThickness;let s,r;return Wb(o)?(s=e.min*i.categoryPercentage,r=i.barPercentage):(s=o*n,r=1),{chunk:s/n,ratio:r,start:e.pixels[t]-s/2}}(t,e,n,i),c=this._getStackIndex(this.index,this._cachedMeta.stack,o?t:void 0);r=l.start+l.chunk*c+l.chunk/2,a=Math.min(s,l.chunk*l.ratio)}else r=i.getPixelForValue(this.getParsed(t)[i.axis],t),a=Math.min(s,e.min*e.ratio);return{base:r-a/2,head:r+a/2,center:r,size:a}}draw(){const t=this._cachedMeta,e=t.vScale,i=t.data,n=i.length;let o=0;for(;o<n;++o)null===this.getParsed(o)[e.axis]||i[o].hidden||i[o].draw(this._ctx)}},BubbleController:class extends Kw{static id="bubble";static defaults={datasetElementType:!1,dataElementType:"point",animations:{numbers:{type:"number",properties:["x","y","borderWidth","radius"]}}};static overrides={scales:{x:{type:"linear"},y:{type:"linear"}}};initialize(){this.enableOptionSharing=!0,super.initialize()}parsePrimitiveData(t,e,i,n){const o=super.parsePrimitiveData(t,e,i,n);for(let t=0;t<o.length;t++)o[t]._custom=this.resolveDataElementOptions(t+i).radius;return o}parseArrayData(t,e,i,n){const o=super.parseArrayData(t,e,i,n);for(let t=0;t<o.length;t++){const n=e[i+t];o[t]._custom=Kb(n[2],this.resolveDataElementOptions(t+i).radius)}return o}parseObjectData(t,e,i,n){const o=super.parseObjectData(t,e,i,n);for(let t=0;t<o.length;t++){const n=e[i+t];o[t]._custom=Kb(n&&n.r&&+n.r,this.resolveDataElementOptions(t+i).radius)}return o}getMaxOverflow(){const t=this._cachedMeta.data;let e=0;for(let i=t.length-1;i>=0;--i)e=Math.max(e,t[i].size(this.resolveDataElementOptions(i))/2);return e>0&&e}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart.data.labels||[],{xScale:n,yScale:o}=e,s=this.getParsed(t),r=n.getLabelForValue(s.x),a=o.getLabelForValue(s.y),l=s._custom;return{label:i[t]||"",value:"("+r+", "+a+(l?", "+l:"")+")"}}update(t){const e=this._cachedMeta.data;this.updateElements(e,0,e.length,t)}updateElements(t,e,i,n){const o="reset"===n,{iScale:s,vScale:r}=this._cachedMeta,{sharedOptions:a,includeOptions:l}=this._getSharedOptions(e,n),c=s.axis,h=r.axis;for(let d=e;d<e+i;d++){const e=t[d],i=!o&&this.getParsed(d),u={},p=u[c]=o?s.getPixelForDecimal(.5):s.getPixelForValue(i[c]),m=u[h]=o?r.getBasePixel():r.getPixelForValue(i[h]);u.skip=isNaN(p)||isNaN(m),l&&(u.options=a||this.resolveDataElementOptions(d,e.active?"active":n),o&&(u.options.radius=0)),this.updateElement(e,d,u,n)}}resolveDataElementOptions(t,e){const i=this.getParsed(t);let n=super.resolveDataElementOptions(t,e);n.$shared&&(n=Object.assign({},n,{$shared:!1}));const o=n.radius;return"active"!==e&&(n.radius=0),n.radius+=Kb(i&&i._custom,o),n}},DoughnutController:rk,LineController:class extends Kw{static id="line";static defaults={datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1};static overrides={scales:{_index_:{type:"category"},_value_:{type:"linear"}}};initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){const e=this._cachedMeta,{dataset:i,data:n=[],_dataset:o}=e,s=this.chart._animationsDisabled;let{start:r,count:a}=Z_(e,n,s);this._drawStart=r,this._drawCount=a,Y_(e)&&(r=0,a=n.length),i._chart=this.chart,i._datasetIndex=this.index,i._decimated=!!o._decimated,i.points=n;const l=this.resolveDatasetElementOptions(t);this.options.showLine||(l.borderWidth=0),l.segment=this.options.segment,this.updateElement(i,void 0,{animated:!s,options:l},t),this.updateElements(n,r,a,t)}updateElements(t,e,i,n){const o="reset"===n,{iScale:s,vScale:r,_stacked:a,_dataset:l}=this._cachedMeta,{sharedOptions:c,includeOptions:h}=this._getSharedOptions(e,n),d=s.axis,u=r.axis,{spanGaps:p,segment:m}=this.options,f=E_(p)?p:Number.POSITIVE_INFINITY,g=this.chart._animationsDisabled||o||"none"===n,v=e+i,y=t.length;let b=e>0&&this.getParsed(e-1);for(let i=0;i<y;++i){const p=t[i],y=g?p:{};if(i<e||i>=v){y.skip=!0;continue}const _=this.getParsed(i),x=Wb(_[u]),w=y[d]=s.getPixelForValue(_[d],i),k=y[u]=o||x?r.getBasePixel():r.getPixelForValue(a?this.applyStack(r,_,a):_[u],i);y.skip=isNaN(w)||isNaN(k)||x,y.stop=i>0&&Math.abs(_[d]-b[d])>f,m&&(y.parsed=_,y.raw=l.data[i]),h&&(y.options=c||this.resolveDataElementOptions(i,p.active?"active":n)),g||this.updateElement(p,i,y,n),b=_}}getMaxOverflow(){const t=this._cachedMeta,e=t.dataset,i=e.options&&e.options.borderWidth||0,n=t.data||[];if(!n.length)return i;const o=n[0].size(this.resolveDataElementOptions(0)),s=n[n.length-1].size(this.resolveDataElementOptions(n.length-1));return Math.max(i,o,s)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}},PieController:class extends rk{static id="pie";static defaults={cutout:0,rotation:0,circumference:360,radius:"100%"}},PolarAreaController:ak,RadarController:class extends Kw{static id="radar";static defaults={datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:!0,elements:{line:{fill:"start"}}};static overrides={aspectRatio:1,scales:{r:{type:"radialLinear"}}};getLabelAndValue(t){const e=this._cachedMeta.vScale,i=this.getParsed(t);return{label:e.getLabels()[t],value:""+e.getLabelForValue(i[e.axis])}}parseObjectData(t,e,i,n){return tw.bind(this)(t,e,i,n)}update(t){const e=this._cachedMeta,i=e.dataset,n=e.data||[],o=e.iScale.getLabels();if(i.points=n,"resize"!==t){const e=this.resolveDatasetElementOptions(t);this.options.showLine||(e.borderWidth=0);const s={_loop:!0,_fullLoop:o.length===n.length,options:e};this.updateElement(i,void 0,s,t)}this.updateElements(n,0,n.length,t)}updateElements(t,e,i,n){const o=this._cachedMeta.rScale,s="reset"===n;for(let r=e;r<e+i;r++){const e=t[r],i=this.resolveDataElementOptions(r,e.active?"active":n),a=o.getPointPositionForValue(r,this.getParsed(r).r),l=s?o.xCenter:a.x,c=s?o.yCenter:a.y,h={x:l,y:c,angle:a.angle,skip:isNaN(l)||isNaN(c),options:i};this.updateElement(e,r,h,n)}}},ScatterController:class extends Kw{static id="scatter";static defaults={datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1};static overrides={interaction:{mode:"point"},scales:{x:{type:"linear"},y:{type:"linear"}}};getLabelAndValue(t){const e=this._cachedMeta,i=this.chart.data.labels||[],{xScale:n,yScale:o}=e,s=this.getParsed(t),r=n.getLabelForValue(s.x),a=o.getLabelForValue(s.y);return{label:i[t]||"",value:"("+r+", "+a+")"}}update(t){const e=this._cachedMeta,{data:i=[]}=e,n=this.chart._animationsDisabled;let{start:o,count:s}=Z_(e,i,n);if(this._drawStart=o,this._drawCount=s,Y_(e)&&(o=0,s=i.length),this.options.showLine){this.datasetElementType||this.addElements();const{dataset:o,_dataset:s}=e;o._chart=this.chart,o._datasetIndex=this.index,o._decimated=!!s._decimated,o.points=i;const r=this.resolveDatasetElementOptions(t);r.segment=this.options.segment,this.updateElement(o,void 0,{animated:!n,options:r},t)}else this.datasetElementType&&(delete e.dataset,this.datasetElementType=!1);this.updateElements(i,o,s,t)}addElements(){const{showLine:t}=this.options;!this.datasetElementType&&t&&(this.datasetElementType=this.chart.registry.getElement("line")),super.addElements()}updateElements(t,e,i,n){const o="reset"===n,{iScale:s,vScale:r,_stacked:a,_dataset:l}=this._cachedMeta,c=this.resolveDataElementOptions(e,n),h=this.getSharedOptions(c),d=this.includeOptions(n,h),u=s.axis,p=r.axis,{spanGaps:m,segment:f}=this.options,g=E_(m)?m:Number.POSITIVE_INFINITY,v=this.chart._animationsDisabled||o||"none"===n;let y=e>0&&this.getParsed(e-1);for(let c=e;c<e+i;++c){const e=t[c],i=this.getParsed(c),m=v?e:{},b=Wb(i[p]),_=m[u]=s.getPixelForValue(i[u],c),x=m[p]=o||b?r.getBasePixel():r.getPixelForValue(a?this.applyStack(r,i,a):i[p],c);m.skip=isNaN(_)||isNaN(x)||b,m.stop=c>0&&Math.abs(i[u]-y[u])>g,f&&(m.parsed=i,m.raw=l.data[c]),d&&(m.options=h||this.resolveDataElementOptions(c,e.active?"active":n)),v||this.updateElement(e,c,m,n),y=i}this.updateSharedOptions(h,n,c)}getMaxOverflow(){const t=this._cachedMeta,e=t.data||[];if(!this.options.showLine){let t=0;for(let i=e.length-1;i>=0;--i)t=Math.max(t,e[i].size(this.resolveDataElementOptions(i))/2);return t>0&&t}const i=t.dataset,n=i.options&&i.options.borderWidth||0;if(!e.length)return n;const o=e[0].size(this.resolveDataElementOptions(0)),s=e[e.length-1].size(this.resolveDataElementOptions(e.length-1));return Math.max(n,o,s)/2}}});function ck(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class hk{static override(t){Object.assign(hk.prototype,t)}options;constructor(t){this.options=t||{}}init(){}formats(){return ck()}parse(){return ck()}format(){return ck()}add(){return ck()}diff(){return ck()}startOf(){return ck()}endOf(){return ck()}}var dk={_date:hk};function uk(t,e,i,n){const{controller:o,data:s,_sorted:r}=t,a=o._cachedMeta.iScale,l=t.dataset&&t.dataset.options?t.dataset.options.spanGaps:null;if(a&&e===a.axis&&"r"!==e&&r&&s.length){const r=a._reversePixels?B_:j_;if(!n){const n=r(s,e,i);if(l){const{vScale:e}=o._cachedMeta,{_parsed:i}=t,s=i.slice(0,n.lo+1).reverse().findIndex((t=>!Wb(t[e.axis])));n.lo-=Math.max(0,s);const r=i.slice(n.hi).findIndex((t=>!Wb(t[e.axis])));n.hi+=Math.max(0,r)}return n}if(o._sharedOptions){const t=s[0],n="function"==typeof t.getRange&&t.getRange(e);if(n){const t=r(s,e,i-n),o=r(s,e,i+n);return{lo:t.lo,hi:o.hi}}}}return{lo:0,hi:s.length-1}}function pk(t,e,i,n,o){const s=t.getSortedVisibleDatasetMetas(),r=i[e];for(let t=0,i=s.length;t<i;++t){const{index:i,data:a}=s[t],{lo:l,hi:c}=uk(s[t],e,r,o);for(let t=l;t<=c;++t){const e=a[t];e.skip||n(e,i,t)}}}function mk(t,e,i,n,o){const s=[];if(!o&&!t.isPointInArea(e))return s;return pk(t,i,e,(function(i,r,a){(o||xx(i,t.chartArea,0))&&i.inRange(e.x,e.y,n)&&s.push({element:i,datasetIndex:r,index:a})}),!0),s}function fk(t,e,i,n,o,s){let r=[];const a=function(t){const e=-1!==t.indexOf("x"),i=-1!==t.indexOf("y");return function(t,n){const o=e?Math.abs(t.x-n.x):0,s=i?Math.abs(t.y-n.y):0;return Math.sqrt(Math.pow(o,2)+Math.pow(s,2))}}(i);let l=Number.POSITIVE_INFINITY;return pk(t,i,e,(function(i,c,h){const d=i.inRange(e.x,e.y,o);if(n&&!d)return;const u=i.getCenterPoint(o);if(!(!!s||t.isPointInArea(u))&&!d)return;const p=a(e,u);p<l?(r=[{element:i,datasetIndex:c,index:h}],l=p):p===l&&r.push({element:i,datasetIndex:c,index:h})})),r}function gk(t,e,i,n,o,s){return s||t.isPointInArea(e)?"r"!==i||n?fk(t,e,i,n,o,s):function(t,e,i,n){let o=[];return pk(t,i,e,(function(t,i,s){const{startAngle:r,endAngle:a}=t.getProps(["startAngle","endAngle"],n),{angle:l}=O_(t,{x:e.x,y:e.y});$_(l,r,a)&&o.push({element:t,datasetIndex:i,index:s})})),o}(t,e,i,o):[]}function vk(t,e,i,n,o){const s=[],r="x"===i?"inXRange":"inYRange";let a=!1;return pk(t,i,e,((t,n,l)=>{t[r]&&t[r](e[i],o)&&(s.push({element:t,datasetIndex:n,index:l}),a=a||t.inRange(e.x,e.y,o))})),n&&!a?[]:s}var yk={evaluateInteractionItems:pk,modes:{index(t,e,i,n){const o=fw(e,t),s=i.axis||"x",r=i.includeInvisible||!1,a=i.intersect?mk(t,o,s,n,r):gk(t,o,s,!1,n,r),l=[];return a.length?(t.getSortedVisibleDatasetMetas().forEach((t=>{const e=a[0].index,i=t.data[e];i&&!i.skip&&l.push({element:i,datasetIndex:t.index,index:e})})),l):[]},dataset(t,e,i,n){const o=fw(e,t),s=i.axis||"xy",r=i.includeInvisible||!1;let a=i.intersect?mk(t,o,s,n,r):gk(t,o,s,!1,n,r);if(a.length>0){const e=a[0].datasetIndex,i=t.getDatasetMeta(e).data;a=[];for(let t=0;t<i.length;++t)a.push({element:i[t],datasetIndex:e,index:t})}return a},point:(t,e,i,n)=>mk(t,fw(e,t),i.axis||"xy",n,i.includeInvisible||!1),nearest(t,e,i,n){const o=fw(e,t),s=i.axis||"xy",r=i.includeInvisible||!1;return gk(t,o,s,i.intersect,n,r)},x:(t,e,i,n)=>vk(t,fw(e,t),"x",i.intersect,n),y:(t,e,i,n)=>vk(t,fw(e,t),"y",i.intersect,n)}};const bk=["left","top","right","bottom"];function _k(t,e){return t.filter((t=>t.pos===e))}function xk(t,e){return t.filter((t=>-1===bk.indexOf(t.pos)&&t.box.axis===e))}function wk(t,e){return t.sort(((t,i)=>{const n=e?i:t,o=e?t:i;return n.weight===o.weight?n.index-o.index:n.weight-o.weight}))}function kk(t,e){const i=function(t){const e={};for(const i of t){const{stack:t,pos:n,stackWeight:o}=i;if(!t||!bk.includes(n))continue;const s=e[t]||(e[t]={count:0,placed:0,weight:0,size:0});s.count++,s.weight+=o}return e}(t),{vBoxMaxWidth:n,hBoxMaxHeight:o}=e;let s,r,a;for(s=0,r=t.length;s<r;++s){a=t[s];const{fullSize:r}=a.box,l=i[a.stack],c=l&&a.stackWeight/l.weight;a.horizontal?(a.width=c?c*n:r&&e.availableWidth,a.height=o):(a.width=n,a.height=c?c*o:r&&e.availableHeight)}return i}function Sk(t,e,i,n){return Math.max(t[i],e[i])+Math.max(t[n],e[n])}function Ck(t,e){t.top=Math.max(t.top,e.top),t.left=Math.max(t.left,e.left),t.bottom=Math.max(t.bottom,e.bottom),t.right=Math.max(t.right,e.right)}function Ek(t,e,i,n){const{pos:o,box:s}=i,r=t.maxPadding;if(!Zb(o)){i.size&&(t[o]-=i.size);const e=n[i.stack]||{size:0,count:1};e.size=Math.max(e.size,i.horizontal?s.height:s.width),i.size=e.size/e.count,t[o]+=i.size}s.getPadding&&Ck(r,s.getPadding());const a=Math.max(0,e.outerWidth-Sk(r,t,"left","right")),l=Math.max(0,e.outerHeight-Sk(r,t,"top","bottom")),c=a!==t.w,h=l!==t.h;return t.w=a,t.h=l,i.horizontal?{same:c,other:h}:{same:h,other:c}}function Ak(t,e){const i=e.maxPadding;function n(t){const n={left:0,top:0,right:0,bottom:0};return t.forEach((t=>{n[t]=Math.max(e[t],i[t])})),n}return n(t?["left","right"]:["top","bottom"])}function Mk(t,e,i,n){const o=[];let s,r,a,l,c,h;for(s=0,r=t.length,c=0;s<r;++s){a=t[s],l=a.box,l.update(a.width||e.w,a.height||e.h,Ak(a.horizontal,e));const{same:r,other:d}=Ek(e,i,a,n);c|=r&&o.length,h=h||d,l.fullSize||o.push(a)}return c&&Mk(o,e,i,n)||h}function Tk(t,e,i,n,o){t.top=i,t.left=e,t.right=e+n,t.bottom=i+o,t.width=n,t.height=o}function Pk(t,e,i,n){const o=i.padding;let{x:s,y:r}=e;for(const a of t){const t=a.box,l=n[a.stack]||{count:1,placed:0,weight:1},c=a.stackWeight/l.weight||1;if(a.horizontal){const n=e.w*c,s=l.size||t.height;d_(l.start)&&(r=l.start),t.fullSize?Tk(t,o.left,r,i.outerWidth-o.right-o.left,s):Tk(t,e.left+l.placed,r,n,s),l.start=r,l.placed+=n,r=t.bottom}else{const n=e.h*c,r=l.size||t.width;d_(l.start)&&(s=l.start),t.fullSize?Tk(t,s,o.top,r,i.outerHeight-o.bottom-o.top):Tk(t,s,e.top+l.placed,r,n),l.start=s,l.placed+=n,s=t.right}}e.x=s,e.y=r}var Ok={addBox(t,e){t.boxes||(t.boxes=[]),e.fullSize=e.fullSize||!1,e.position=e.position||"top",e.weight=e.weight||0,e._layers=e._layers||function(){return[{z:0,draw(t){e.draw(t)}}]},t.boxes.push(e)},removeBox(t,e){const i=t.boxes?t.boxes.indexOf(e):-1;-1!==i&&t.boxes.splice(i,1)},configure(t,e,i){e.fullSize=i.fullSize,e.position=i.position,e.weight=i.weight},update(t,e,i,n){if(!t)return;const o=Rx(t.options.layout.padding),s=Math.max(e-o.width,0),r=Math.max(i-o.height,0),a=function(t){const e=function(t){const e=[];let i,n,o,s,r,a;for(i=0,n=(t||[]).length;i<n;++i)o=t[i],({position:s,options:{stack:r,stackWeight:a=1}}=o),e.push({index:i,box:o,pos:s,horizontal:o.isHorizontal(),weight:o.weight,stack:r&&s+r,stackWeight:a});return e}(t),i=wk(e.filter((t=>t.box.fullSize)),!0),n=wk(_k(e,"left"),!0),o=wk(_k(e,"right")),s=wk(_k(e,"top"),!0),r=wk(_k(e,"bottom")),a=xk(e,"x"),l=xk(e,"y");return{fullSize:i,leftAndTop:n.concat(s),rightAndBottom:o.concat(l).concat(r).concat(a),chartArea:_k(e,"chartArea"),vertical:n.concat(o).concat(l),horizontal:s.concat(r).concat(a)}}(t.boxes),l=a.vertical,c=a.horizontal;t_(t.boxes,(t=>{"function"==typeof t.beforeLayout&&t.beforeLayout()}));const h=l.reduce(((t,e)=>e.box.options&&!1===e.box.options.display?t:t+1),0)||1,d=Object.freeze({outerWidth:e,outerHeight:i,padding:o,availableWidth:s,availableHeight:r,vBoxMaxWidth:s/2/h,hBoxMaxHeight:r/2}),u=Object.assign({},o);Ck(u,Rx(n));const p=Object.assign({maxPadding:u,w:s,h:r,x:o.left,y:o.top},o),m=kk(l.concat(c),d);Mk(a.fullSize,p,d,m),Mk(l,p,d,m),Mk(c,p,d,m)&&Mk(l,p,d,m),function(t){const e=t.maxPadding;function i(i){const n=Math.max(e[i]-t[i],0);return t[i]+=n,n}t.y+=i("top"),t.x+=i("left"),i("right"),i("bottom")}(p),Pk(a.leftAndTop,p,d,m),p.x+=p.w,p.y+=p.h,Pk(a.rightAndBottom,p,d,m),t.chartArea={left:p.left,top:p.top,right:p.left+p.w,bottom:p.top+p.h,height:p.h,width:p.w},t_(a.chartArea,(e=>{const i=e.box;Object.assign(i,t.chartArea),i.update(p.w,p.h,{left:0,top:0,right:0,bottom:0})}))}};class Dk{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,i){}removeEventListener(t,e,i){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,i,n){return e=Math.max(0,e||t.width),i=i||t.height,{width:e,height:Math.max(0,n?Math.floor(e/n):i)}}isAttached(t){return!0}updateConfig(t){}}class Ik extends Dk{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const Lk="$chartjs",$k={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},zk=t=>null===t||""===t;const Rk=!!bw&&{passive:!0};function Nk(t,e,i){t&&t.canvas&&t.canvas.removeEventListener(e,i,Rk)}function jk(t,e){for(const i of t)if(i===e||i.contains(e))return!0}function Bk(t,e,i){const n=t.canvas,o=new MutationObserver((t=>{let e=!1;for(const i of t)e=e||jk(i.addedNodes,n),e=e&&!jk(i.removedNodes,n);e&&i()}));return o.observe(document,{childList:!0,subtree:!0}),o}function Fk(t,e,i){const n=t.canvas,o=new MutationObserver((t=>{let e=!1;for(const i of t)e=e||jk(i.removedNodes,n),e=e&&!jk(i.addedNodes,n);e&&i()}));return o.observe(document,{childList:!0,subtree:!0}),o}const qk=new Map;let Vk=0;function Hk(){const t=window.devicePixelRatio;t!==Vk&&(Vk=t,qk.forEach(((e,i)=>{i.currentDevicePixelRatio!==t&&e()})))}function Uk(t,e,i){const n=t.canvas,o=n&&cw(n);if(!o)return;const s=U_(((t,e)=>{const n=o.clientWidth;i(t,e),n<o.clientWidth&&i()}),window),r=new ResizeObserver((t=>{const e=t[0],i=e.contentRect.width,n=e.contentRect.height;0===i&&0===n||s(i,n)}));return r.observe(o),function(t,e){qk.size||window.addEventListener("resize",Hk),qk.set(t,e)}(t,s),r}function Wk(t,e,i){i&&i.disconnect(),"resize"===e&&function(t){qk.delete(t),qk.size||window.removeEventListener("resize",Hk)}(t)}function Gk(t,e,i){const n=t.canvas,o=U_((e=>{null!==t.ctx&&i(function(t,e){const i=$k[t.type]||t.type,{x:n,y:o}=fw(t,e);return{type:i,chart:e,native:t,x:void 0!==n?n:null,y:void 0!==o?o:null}}(e,t))}),t);return function(t,e,i){t&&t.addEventListener(e,i,Rk)}(n,e,o),o}class Zk extends Dk{acquireContext(t,e){const i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(function(t,e){const i=t.style,n=t.getAttribute("height"),o=t.getAttribute("width");if(t[Lk]={initial:{height:n,width:o,style:{display:i.display,height:i.height,width:i.width}}},i.display=i.display||"block",i.boxSizing=i.boxSizing||"border-box",zk(o)){const e=_w(t,"width");void 0!==e&&(t.width=e)}if(zk(n))if(""===t.style.height)t.height=t.width/(e||2);else{const e=_w(t,"height");void 0!==e&&(t.height=e)}}(t,e),i):null}releaseContext(t){const e=t.canvas;if(!e[Lk])return!1;const i=e[Lk].initial;["height","width"].forEach((t=>{const n=i[t];Wb(n)?e.removeAttribute(t):e.setAttribute(t,n)}));const n=i.style||{};return Object.keys(n).forEach((t=>{e.style[t]=n[t]})),e.width=e.width,delete e[Lk],!0}addEventListener(t,e,i){this.removeEventListener(t,e);const n=t.$proxies||(t.$proxies={}),o={attach:Bk,detach:Fk,resize:Uk}[e]||Gk;n[e]=o(t,e,i)}removeEventListener(t,e){const i=t.$proxies||(t.$proxies={}),n=i[e];if(!n)return;({attach:Wk,detach:Wk,resize:Wk}[e]||Nk)(t,e,n),i[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,i,n){return vw(t,e,i,n)}isAttached(t){const e=t&&cw(t);return!(!e||!e.isConnected)}}let Yk=class{static defaults={};static defaultRoutes=void 0;x;y;active=!1;options;$animations;tooltipPosition(t){const{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}hasValue(){return E_(this.x)&&E_(this.y)}getProps(t,e){const i=this.$animations;if(!e||!i)return this;const n={};return t.forEach((t=>{n[t]=i[t]&&i[t].active()?i[t]._to:this[t]})),n}};function Xk(t,e){const i=t.options.ticks,n=function(t){const e=t.options.offset,i=t._tickSize(),n=t._length/i+(e?0:1),o=t._maxLength/i;return Math.floor(Math.min(n,o))}(t),o=Math.min(i.maxTicksLimit||n,n),s=i.major.enabled?function(t){const e=[];let i,n;for(i=0,n=t.length;i<n;i++)t[i].major&&e.push(i);return e}(e):[],r=s.length,a=s[0],l=s[r-1],c=[];if(r>o)return function(t,e,i,n){let o,s=0,r=i[0];for(n=Math.ceil(n),o=0;o<t.length;o++)o===r&&(e.push(t[o]),s++,r=i[s*n])}(e,c,s,r/o),c;const h=function(t,e,i){const n=function(t){const e=t.length;let i,n;if(e<2)return!1;for(n=t[0],i=1;i<e;++i)if(t[i]-t[i-1]!==n)return!1;return n}(t),o=e.length/i;if(!n)return Math.max(o,1);const s=function(t){const e=[],i=Math.sqrt(t);let n;for(n=1;n<i;n++)t%n==0&&(e.push(n),e.push(t/n));return i===(0|i)&&e.push(i),e.sort(((t,e)=>t-e)).pop(),e}(n);for(let t=0,e=s.length-1;t<e;t++){const e=s[t];if(e>o)return e}return Math.max(o,1)}(s,e,o);if(r>0){let t,i;const n=r>1?Math.round((l-a)/(r-1)):null;for(Kk(e,c,h,Wb(n)?0:a-n,a),t=0,i=r-1;t<i;t++)Kk(e,c,h,s[t],s[t+1]);return Kk(e,c,h,l,Wb(n)?e.length:l+n),c}return Kk(e,c,h),c}function Kk(t,e,i,n,o){const s=Kb(n,0),r=Math.min(Kb(o,t.length),t.length);let a,l,c,h=0;for(i=Math.ceil(i),o&&(a=o-n,i=a/Math.floor(a/i)),c=s;c<0;)h++,c=Math.round(s+h*i);for(l=Math.max(s,0);l<r;l++)l===c&&(e.push(t[l]),h++,c=Math.round(s+h*i))}const Qk=(t,e,i)=>"top"===e||"left"===e?t[e]+i:t[e]-i,Jk=(t,e)=>Math.min(e||t,t);function tS(t,e){const i=[],n=t.length/e,o=t.length;let s=0;for(;s<o;s+=n)i.push(t[Math.floor(s)]);return i}function eS(t,e,i){const n=t.ticks.length,o=Math.min(e,n-1),s=t._startPixel,r=t._endPixel,a=1e-6;let l,c=t.getPixelForTick(o);if(!(i&&(l=1===n?Math.max(c-s,r-c):0===e?(t.getPixelForTick(1)-c)/2:(c-t.getPixelForTick(o-1))/2,c+=o<e?l:-l,c<s-a||c>r+a)))return c}function iS(t){return t.drawTicks?t.tickLength:0}function nS(t,e){if(!t.display)return 0;const i=Nx(t.font,e),n=Rx(t.padding);return(Gb(t.text)?t.text.length:1)*i.lineHeight+n.height}function oS(t,e,i){let n=W_(t);return(i&&"right"!==e||!i&&"right"===e)&&(n=(t=>"left"===t?"right":"right"===t?"left":t)(n)),n}class sS extends Yk{constructor(t){super(),this.id=t.id,this.type=t.type,this.options=void 0,this.ctx=t.ctx,this.chart=t.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(t){this.options=t.setContext(this.getContext()),this.axis=t.axis,this._userMin=this.parse(t.min),this._userMax=this.parse(t.max),this._suggestedMin=this.parse(t.suggestedMin),this._suggestedMax=this.parse(t.suggestedMax)}parse(t,e){return t}getUserBounds(){let{_userMin:t,_userMax:e,_suggestedMin:i,_suggestedMax:n}=this;return t=Xb(t,Number.POSITIVE_INFINITY),e=Xb(e,Number.NEGATIVE_INFINITY),i=Xb(i,Number.POSITIVE_INFINITY),n=Xb(n,Number.NEGATIVE_INFINITY),{min:Xb(t,i),max:Xb(e,n),minDefined:Yb(t),maxDefined:Yb(e)}}getMinMax(t){let e,{min:i,max:n,minDefined:o,maxDefined:s}=this.getUserBounds();if(o&&s)return{min:i,max:n};const r=this.getMatchingVisibleMetas();for(let a=0,l=r.length;a<l;++a)e=r[a].controller.getMinMax(this,t),o||(i=Math.min(i,e.min)),s||(n=Math.max(n,e.max));return i=s&&i>n?n:i,n=o&&i>n?i:n,{min:Xb(i,Xb(n,i)),max:Xb(n,Xb(i,n))}}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(){Jb(this.options.beforeUpdate,[this])}update(t,e,i){const{beginAtZero:n,grace:o,ticks:s}=this.options,r=s.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=i=Object.assign({left:0,right:0,top:0,bottom:0},i),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+i.left+i.right:this.height+i.top+i.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=function(t,e,i){const{min:n,max:o}=t,s=Qb(e,(o-n)/2),r=(t,e)=>i&&0===t?0:t+e;return{min:r(n,-Math.abs(s)),max:r(o,s)}}(this,o,n),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const a=r<this.ticks.length;this._convertTicksToLabels(a?tS(this.ticks,r):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),s.display&&(s.autoSkip||"auto"===s.source)&&(this.ticks=Xk(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),a&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let t,e,i=this.options.reverse;this.isHorizontal()?(t=this.left,e=this.right):(t=this.top,e=this.bottom,i=!i),this._startPixel=t,this._endPixel=e,this._reversePixels=i,this._length=e-t,this._alignToPixels=this.options.alignToPixels}afterUpdate(){Jb(this.options.afterUpdate,[this])}beforeSetDimensions(){Jb(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(){Jb(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),Jb(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){Jb(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(t){const e=this.options.ticks;let i,n,o;for(i=0,n=t.length;i<n;i++)o=t[i],o.label=Jb(e.callback,[o.value,i,t],this)}afterTickToLabelConversion(){Jb(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){Jb(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const t=this.options,e=t.ticks,i=Jk(this.ticks.length,t.ticks.maxTicksLimit),n=e.minRotation||0,o=e.maxRotation;let s,r,a,l=n;if(!this._isVisible()||!e.display||n>=o||i<=1||!this.isHorizontal())return void(this.labelRotation=n);const c=this._getLabelSizes(),h=c.widest.width,d=c.highest.height,u=z_(this.chart.width-h,0,this.maxWidth);s=t.offset?this.maxWidth/i:u/(i-1),h+6>s&&(s=u/(i-(t.offset?.5:1)),r=this.maxHeight-iS(t.grid)-e.padding-nS(t.title,this.chart.options.font),a=Math.sqrt(h*h+d*d),l=T_(Math.min(Math.asin(z_((c.highest.height+6)/s,-1,1)),Math.asin(z_(r/a,-1,1))-Math.asin(z_(d/a,-1,1)))),l=Math.max(n,Math.min(o,l))),this.labelRotation=l}afterCalculateLabelRotation(){Jb(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){Jb(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:e,options:{ticks:i,title:n,grid:o}}=this,s=this._isVisible(),r=this.isHorizontal();if(s){const s=nS(n,e.options.font);if(r?(t.width=this.maxWidth,t.height=iS(o)+s):(t.height=this.maxHeight,t.width=iS(o)+s),i.display&&this.ticks.length){const{first:e,last:n,widest:o,highest:s}=this._getLabelSizes(),a=2*i.padding,l=M_(this.labelRotation),c=Math.cos(l),h=Math.sin(l);if(r){const e=i.mirror?0:h*o.width+c*s.height;t.height=Math.min(this.maxHeight,t.height+e+a)}else{const e=i.mirror?0:c*o.width+h*s.height;t.width=Math.min(this.maxWidth,t.width+e+a)}this._calculatePadding(e,n,h,c)}}this._handleMargins(),r?(this.width=this._length=e.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=e.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,e,i,n){const{ticks:{align:o,padding:s},position:r}=this.options,a=0!==this.labelRotation,l="top"!==r&&"x"===this.axis;if(this.isHorizontal()){const r=this.getPixelForTick(0)-this.left,c=this.right-this.getPixelForTick(this.ticks.length-1);let h=0,d=0;a?l?(h=n*t.width,d=i*e.height):(h=i*t.height,d=n*e.width):"start"===o?d=e.width:"end"===o?h=t.width:"inner"!==o&&(h=t.width/2,d=e.width/2),this.paddingLeft=Math.max((h-r+s)*this.width/(this.width-r),0),this.paddingRight=Math.max((d-c+s)*this.width/(this.width-c),0)}else{let i=e.height/2,n=t.height/2;"start"===o?(i=0,n=t.height):"end"===o&&(i=e.height,n=0),this.paddingTop=i+s,this.paddingBottom=n+s}}_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(){Jb(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:e}=this.options;return"top"===e||"bottom"===e||"x"===t}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){let e,i;for(this.beforeTickToLabelConversion(),this.generateTickLabels(t),e=0,i=t.length;e<i;e++)Wb(t[e].label)&&(t.splice(e,1),i--,e--);this.afterTickToLabelConversion()}_getLabelSizes(){let t=this._labelSizes;if(!t){const e=this.options.ticks.sampleSize;let i=this.ticks;e<i.length&&(i=tS(i,e)),this._labelSizes=t=this._computeLabelSizes(i,i.length,this.options.ticks.maxTicksLimit)}return t}_computeLabelSizes(t,e,i){const{ctx:n,_longestTextCache:o}=this,s=[],r=[],a=Math.floor(e/Jk(e,i));let l,c,h,d,u,p,m,f,g,v,y,b=0,_=0;for(l=0;l<e;l+=a){if(d=t[l].label,u=this._resolveTickFontOptions(l),n.font=p=u.string,m=o[p]=o[p]||{data:{},gc:[]},f=u.lineHeight,g=v=0,Wb(d)||Gb(d)){if(Gb(d))for(c=0,h=d.length;c<h;++c)y=d[c],Wb(y)||Gb(y)||(g=fx(n,m.data,m.gc,g,y),v+=f)}else g=fx(n,m.data,m.gc,g,d),v=f;s.push(g),r.push(v),b=Math.max(g,b),_=Math.max(v,_)}!function(t,e){t_(t,(t=>{const i=t.gc,n=i.length/2;let o;if(n>e){for(o=0;o<n;++o)delete t.data[i[o]];i.splice(0,n)}}))}(o,e);const x=s.indexOf(b),w=r.indexOf(_),k=t=>({width:s[t]||0,height:r[t]||0});return{first:k(0),last:k(e-1),widest:k(x),highest:k(w),widths:s,heights:r}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const e=this._startPixel+t*this._length;return z_(this._alignToPixels?vx(this.chart,e,0):e,-32768,32767)}getDecimalForPixel(t){const e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:e}=this;return t<0&&e<0?e:t>0&&e>0?t:0}getContext(t){const e=this.ticks||[];if(t>=0&&t<e.length){const i=e[t];return i.$context||(i.$context=function(t,e,i){return Bx(t,{tick:i,index:e,type:"tick"})}(this.getContext(),t,i))}return this.$context||(this.$context=Bx(this.chart.getContext(),{scale:this,type:"scale"}))}_tickSize(){const t=this.options.ticks,e=M_(this.labelRotation),i=Math.abs(Math.cos(e)),n=Math.abs(Math.sin(e)),o=this._getLabelSizes(),s=t.autoSkipPadding||0,r=o?o.widest.width+s:0,a=o?o.highest.height+s:0;return this.isHorizontal()?a*i>r*n?r/i:a/n:a*n<r*i?a/i:r/n}_isVisible(){const t=this.options.display;return"auto"!==t?!!t:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(t){const e=this.axis,i=this.chart,n=this.options,{grid:o,position:s,border:r}=n,a=o.offset,l=this.isHorizontal(),c=this.ticks.length+(a?1:0),h=iS(o),d=[],u=r.setContext(this.getContext()),p=u.display?u.width:0,m=p/2,f=function(t){return vx(i,t,p)};let g,v,y,b,_,x,w,k,S,C,E,A;if("top"===s)g=f(this.bottom),x=this.bottom-h,k=g-m,C=f(t.top)+m,A=t.bottom;else if("bottom"===s)g=f(this.top),C=t.top,A=f(t.bottom)-m,x=g+m,k=this.top+h;else if("left"===s)g=f(this.right),_=this.right-h,w=g-m,S=f(t.left)+m,E=t.right;else if("right"===s)g=f(this.left),S=t.left,E=f(t.right)-m,_=g+m,w=this.left+h;else if("x"===e){if("center"===s)g=f((t.top+t.bottom)/2+.5);else if(Zb(s)){const t=Object.keys(s)[0],e=s[t];g=f(this.chart.scales[t].getPixelForValue(e))}C=t.top,A=t.bottom,x=g+m,k=x+h}else if("y"===e){if("center"===s)g=f((t.left+t.right)/2);else if(Zb(s)){const t=Object.keys(s)[0],e=s[t];g=f(this.chart.scales[t].getPixelForValue(e))}_=g-m,w=_-h,S=t.left,E=t.right}const M=Kb(n.ticks.maxTicksLimit,c),T=Math.max(1,Math.ceil(c/M));for(v=0;v<c;v+=T){const t=this.getContext(v),e=o.setContext(t),n=r.setContext(t),s=e.lineWidth,c=e.color,h=n.dash||[],u=n.dashOffset,p=e.tickWidth,m=e.tickColor,f=e.tickBorderDash||[],g=e.tickBorderDashOffset;y=eS(this,v,a),void 0!==y&&(b=vx(i,y,s),l?_=w=S=E=b:x=k=C=A=b,d.push({tx1:_,ty1:x,tx2:w,ty2:k,x1:S,y1:C,x2:E,y2:A,width:s,color:c,borderDash:h,borderDashOffset:u,tickWidth:p,tickColor:m,tickBorderDash:f,tickBorderDashOffset:g}))}return this._ticksLength=c,this._borderValue=g,d}_computeLabelItems(t){const e=this.axis,i=this.options,{position:n,ticks:o}=i,s=this.isHorizontal(),r=this.ticks,{align:a,crossAlign:l,padding:c,mirror:h}=o,d=iS(i.grid),u=d+c,p=h?-c:u,m=-M_(this.labelRotation),f=[];let g,v,y,b,_,x,w,k,S,C,E,A,M="middle";if("top"===n)x=this.bottom-p,w=this._getXAxisLabelAlignment();else if("bottom"===n)x=this.top+p,w=this._getXAxisLabelAlignment();else if("left"===n){const t=this._getYAxisLabelAlignment(d);w=t.textAlign,_=t.x}else if("right"===n){const t=this._getYAxisLabelAlignment(d);w=t.textAlign,_=t.x}else if("x"===e){if("center"===n)x=(t.top+t.bottom)/2+u;else if(Zb(n)){const t=Object.keys(n)[0],e=n[t];x=this.chart.scales[t].getPixelForValue(e)+u}w=this._getXAxisLabelAlignment()}else if("y"===e){if("center"===n)_=(t.left+t.right)/2-u;else if(Zb(n)){const t=Object.keys(n)[0],e=n[t];_=this.chart.scales[t].getPixelForValue(e)}w=this._getYAxisLabelAlignment(d).textAlign}"y"===e&&("start"===a?M="top":"end"===a&&(M="bottom"));const T=this._getLabelSizes();for(g=0,v=r.length;g<v;++g){y=r[g],b=y.label;const t=o.setContext(this.getContext(g));k=this.getPixelForTick(g)+o.labelOffset,S=this._resolveTickFontOptions(g),C=S.lineHeight,E=Gb(b)?b.length:1;const e=E/2,i=t.color,a=t.textStrokeColor,c=t.textStrokeWidth;let d,u=w;if(s?(_=k,"inner"===w&&(u=g===v-1?this.options.reverse?"left":"right":0===g?this.options.reverse?"right":"left":"center"),A="top"===n?"near"===l||0!==m?-E*C+C/2:"center"===l?-T.highest.height/2-e*C+C:-T.highest.height+C/2:"near"===l||0!==m?C/2:"center"===l?T.highest.height/2-e*C:T.highest.height-E*C,h&&(A*=-1),0===m||t.showLabelBackdrop||(_+=C/2*Math.sin(m))):(x=k,A=(1-E)*C/2),t.showLabelBackdrop){const e=Rx(t.backdropPadding),i=T.heights[g],n=T.widths[g];let o=A-e.top,s=0-e.left;switch(M){case"middle":o-=i/2;break;case"bottom":o-=i}switch(w){case"center":s-=n/2;break;case"right":s-=n;break;case"inner":g===v-1?s-=n:g>0&&(s-=n/2)}d={left:s,top:o,width:n+e.width,height:i+e.height,color:t.backdropColor}}f.push({label:b,font:S,textOffset:A,options:{rotation:m,color:i,strokeColor:a,strokeWidth:c,textAlign:u,textBaseline:M,translation:[_,x],backdrop:d}})}return f}_getXAxisLabelAlignment(){const{position:t,ticks:e}=this.options;if(-M_(this.labelRotation))return"top"===t?"left":"right";let i="center";return"start"===e.align?i="left":"end"===e.align?i="right":"inner"===e.align&&(i="inner"),i}_getYAxisLabelAlignment(t){const{position:e,ticks:{crossAlign:i,mirror:n,padding:o}}=this.options,s=t+o,r=this._getLabelSizes().widest.width;let a,l;return"left"===e?n?(l=this.right+o,"near"===i?a="left":"center"===i?(a="center",l+=r/2):(a="right",l+=r)):(l=this.right-s,"near"===i?a="right":"center"===i?(a="center",l-=r/2):(a="left",l=this.left)):"right"===e?n?(l=this.left+o,"near"===i?a="right":"center"===i?(a="center",l-=r/2):(a="left",l-=r)):(l=this.left+s,"near"===i?a="left":"center"===i?(a="center",l+=r/2):(a="right",l=this.right)):a="right",{textAlign:a,x:l}}_computeLabelArea(){if(this.options.ticks.mirror)return;const t=this.chart,e=this.options.position;return"left"===e||"right"===e?{top:0,left:this.left,bottom:t.height,right:this.right}:"top"===e||"bottom"===e?{top:this.top,left:0,bottom:this.bottom,right:t.width}:void 0}drawBackground(){const{ctx:t,options:{backgroundColor:e},left:i,top:n,width:o,height:s}=this;e&&(t.save(),t.fillStyle=e,t.fillRect(i,n,o,s),t.restore())}getLineWidthForValue(t){const e=this.options.grid;if(!this._isVisible()||!e.display)return 0;const i=this.ticks.findIndex((e=>e.value===t));if(i>=0){return e.setContext(this.getContext(i)).lineWidth}return 0}drawGrid(t){const e=this.options.grid,i=this.ctx,n=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let o,s;const r=(t,e,n)=>{n.width&&n.color&&(i.save(),i.lineWidth=n.width,i.strokeStyle=n.color,i.setLineDash(n.borderDash||[]),i.lineDashOffset=n.borderDashOffset,i.beginPath(),i.moveTo(t.x,t.y),i.lineTo(e.x,e.y),i.stroke(),i.restore())};if(e.display)for(o=0,s=n.length;o<s;++o){const t=n[o];e.drawOnChartArea&&r({x:t.x1,y:t.y1},{x:t.x2,y:t.y2},t),e.drawTicks&&r({x:t.tx1,y:t.ty1},{x:t.tx2,y:t.ty2},{color:t.tickColor,width:t.tickWidth,borderDash:t.tickBorderDash,borderDashOffset:t.tickBorderDashOffset})}}drawBorder(){const{chart:t,ctx:e,options:{border:i,grid:n}}=this,o=i.setContext(this.getContext()),s=i.display?o.width:0;if(!s)return;const r=n.setContext(this.getContext(0)).lineWidth,a=this._borderValue;let l,c,h,d;this.isHorizontal()?(l=vx(t,this.left,s)-s/2,c=vx(t,this.right,r)+r/2,h=d=a):(h=vx(t,this.top,s)-s/2,d=vx(t,this.bottom,r)+r/2,l=c=a),e.save(),e.lineWidth=o.width,e.strokeStyle=o.color,e.beginPath(),e.moveTo(l,h),e.lineTo(c,d),e.stroke(),e.restore()}drawLabels(t){if(!this.options.ticks.display)return;const e=this.ctx,i=this._computeLabelArea();i&&wx(e,i);const n=this.getLabelItems(t);for(const t of n){const i=t.options,n=t.font;Mx(e,t.label,0,t.textOffset,n,i)}i&&kx(e)}drawTitle(){const{ctx:t,options:{position:e,title:i,reverse:n}}=this;if(!i.display)return;const o=Nx(i.font),s=Rx(i.padding),r=i.align;let a=o.lineHeight/2;"bottom"===e||"center"===e||Zb(e)?(a+=s.bottom,Gb(i.text)&&(a+=o.lineHeight*(i.text.length-1))):a+=s.top;const{titleX:l,titleY:c,maxWidth:h,rotation:d}=function(t,e,i,n){const{top:o,left:s,bottom:r,right:a,chart:l}=t,{chartArea:c,scales:h}=l;let d,u,p,m=0;const f=r-o,g=a-s;if(t.isHorizontal()){if(u=G_(n,s,a),Zb(i)){const t=Object.keys(i)[0],n=i[t];p=h[t].getPixelForValue(n)+f-e}else p="center"===i?(c.bottom+c.top)/2+f-e:Qk(t,i,e);d=a-s}else{if(Zb(i)){const t=Object.keys(i)[0],n=i[t];u=h[t].getPixelForValue(n)-g+e}else u="center"===i?(c.left+c.right)/2-g+e:Qk(t,i,e);p=G_(n,r,o),m="left"===i?-b_:b_}return{titleX:u,titleY:p,maxWidth:d,rotation:m}}(this,a,e,r);Mx(t,i.text,0,0,o,{color:i.color,maxWidth:h,rotation:d,textAlign:oS(r,e,n),textBaseline:"middle",translation:[l,c]})}draw(t){this._isVisible()&&(this.drawBackground(),this.drawGrid(t),this.drawBorder(),this.drawTitle(),this.drawLabels(t))}_layers(){const t=this.options,e=t.ticks&&t.ticks.z||0,i=Kb(t.grid&&t.grid.z,-1),n=Kb(t.border&&t.border.z,0);return this._isVisible()&&this.draw===sS.prototype.draw?[{z:i,draw:t=>{this.drawBackground(),this.drawGrid(t),this.drawTitle()}},{z:n,draw:()=>{this.drawBorder()}},{z:e,draw:t=>{this.drawLabels(t)}}]:[{z:e,draw:t=>{this.draw(t)}}]}getMatchingVisibleMetas(t){const e=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID",n=[];let o,s;for(o=0,s=e.length;o<s;++o){const s=e[o];s[i]!==this.id||t&&s.type!==t||n.push(s)}return n}_resolveTickFontOptions(t){return Nx(this.options.ticks.setContext(this.getContext(t)).font)}_maxDigits(){const t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}}class rS{constructor(t,e,i){this.type=t,this.scope=e,this.override=i,this.items=Object.create(null)}isForType(t){return Object.prototype.isPrototypeOf.call(this.type.prototype,t.prototype)}register(t){const e=Object.getPrototypeOf(t);let i;(function(t){return"id"in t&&"defaults"in t})(e)&&(i=this.register(e));const n=this.items,o=t.id,s=this.scope+"."+o;if(!o)throw new Error("class does not have id: "+t);return o in n||(n[o]=t,function(t,e,i){const n=s_(Object.create(null),[i?mx.get(i):{},mx.get(e),t.defaults]);mx.set(e,n),t.defaultRoutes&&function(t,e){Object.keys(e).forEach((i=>{const n=i.split("."),o=n.pop(),s=[t].concat(n).join("."),r=e[i].split("."),a=r.pop(),l=r.join(".");mx.route(s,o,l,a)}))}(e,t.defaultRoutes);t.descriptors&&mx.describe(e,t.descriptors)}(t,s,i),this.override&&mx.override(t.id,t.overrides)),s}get(t){return this.items[t]}unregister(t){const e=this.items,i=t.id,n=this.scope;i in e&&delete e[i],n&&i in mx[n]&&(delete mx[n][i],this.override&&delete cx[i])}}class aS{constructor(){this.controllers=new rS(Kw,"datasets",!0),this.elements=new rS(Yk,"elements"),this.plugins=new rS(Object,"plugins"),this.scales=new rS(sS,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,e,i){[...e].forEach((e=>{const n=i||this._getRegistryForType(e);i||n.isForType(e)||n===this.plugins&&e.id?this._exec(t,n,e):t_(e,(e=>{const n=i||this._getRegistryForType(e);this._exec(t,n,e)}))}))}_exec(t,e,i){const n=h_(t);Jb(i["before"+n],[],i),e[t](i),Jb(i["after"+n],[],i)}_getRegistryForType(t){for(let e=0;e<this._typedRegistries.length;e++){const i=this._typedRegistries[e];if(i.isForType(t))return i}return this.plugins}_get(t,e,i){const n=e.get(t);if(void 0===n)throw new Error('"'+t+'" is not a registered '+i+".");return n}}var lS=new aS;class cS{constructor(){this._init=[]}notify(t,e,i,n){"beforeInit"===e&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install"));const o=n?this._descriptors(t).filter(n):this._descriptors(t),s=this._notify(o,t,e,i);return"afterDestroy"===e&&(this._notify(o,t,"stop"),this._notify(this._init,t,"uninstall")),s}_notify(t,e,i,n){n=n||{};for(const o of t){const t=o.plugin;if(!1===Jb(t[i],[e,n,o.options],t)&&n.cancelable)return!1}return!0}invalidate(){Wb(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;const e=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),e}_createDescriptors(t,e){const i=t&&t.config,n=Kb(i.options&&i.options.plugins,{}),o=function(t){const e={},i=[],n=Object.keys(lS.plugins.items);for(let t=0;t<n.length;t++)i.push(lS.getPlugin(n[t]));const o=t.plugins||[];for(let t=0;t<o.length;t++){const n=o[t];-1===i.indexOf(n)&&(i.push(n),e[n.id]=!0)}return{plugins:i,localIds:e}}(i);return!1!==n||e?function(t,{plugins:e,localIds:i},n,o){const s=[],r=t.getContext();for(const a of e){const e=a.id,l=hS(n[e],o);null!==l&&s.push({plugin:a,options:dS(t.config,{plugin:a,local:i[e]},l,r)})}return s}(t,o,n,e):[]}_notifyStateChanges(t){const e=this._oldCache||[],i=this._cache,n=(t,e)=>t.filter((t=>!e.some((e=>t.plugin.id===e.plugin.id))));this._notify(n(e,i),t,"stop"),this._notify(n(i,e),t,"start")}}function hS(t,e){return e||!1!==t?!0===t?{}:t:null}function dS(t,{plugin:e,local:i},n,o){const s=t.pluginScopeKeys(e),r=t.getOptionScopes(n,s);return i&&e.defaults&&r.push(e.defaults),t.createResolver(r,o,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function uS(t,e){const i=mx.datasets[t]||{};return((e.datasets||{})[t]||{}).indexAxis||e.indexAxis||i.indexAxis||"x"}function pS(t){if("x"===t||"y"===t||"r"===t)return t}function mS(t,...e){if(pS(t))return t;for(const n of e){const e=n.axis||("top"===(i=n.position)||"bottom"===i?"x":"left"===i||"right"===i?"y":void 0)||t.length>1&&pS(t[0].toLowerCase());if(e)return e}var i;throw new Error(`Cannot determine type of '${t}' axis. Please provide 'axis' or 'position' option.`)}function fS(t,e,i){if(i[e+"AxisID"]===t)return{axis:e}}function gS(t,e){const i=cx[t.type]||{scales:{}},n=e.scales||{},o=uS(t.type,e),s=Object.create(null);return Object.keys(n).forEach((e=>{const r=n[e];if(!Zb(r))return console.error(`Invalid scale configuration for scale: ${e}`);if(r._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${e}`);const a=mS(e,r,function(t,e){if(e.data&&e.data.datasets){const i=e.data.datasets.filter((e=>e.xAxisID===t||e.yAxisID===t));if(i.length)return fS(t,"x",i[0])||fS(t,"y",i[0])}return{}}(e,t),mx.scales[r.type]),l=function(t,e){return t===e?"_index_":"_value_"}(a,o),c=i.scales||{};s[e]=r_(Object.create(null),[{axis:a},r,c[a],c[l]])})),t.data.datasets.forEach((i=>{const o=i.type||t.type,r=i.indexAxis||uS(o,e),a=(cx[o]||{}).scales||{};Object.keys(a).forEach((t=>{const e=function(t,e){let i=t;return"_index_"===t?i=e:"_value_"===t&&(i="x"===e?"y":"x"),i}(t,r),o=i[e+"AxisID"]||e;s[o]=s[o]||Object.create(null),r_(s[o],[{axis:e},n[o],a[t]])}))})),Object.keys(s).forEach((t=>{const e=s[t];r_(e,[mx.scales[e.type],mx.scale])})),s}function vS(t){const e=t.options||(t.options={});e.plugins=Kb(e.plugins,{}),e.scales=gS(t,e)}function yS(t){return(t=t||{}).datasets=t.datasets||[],t.labels=t.labels||[],t}const bS=new Map,_S=new Set;function xS(t,e){let i=bS.get(t);return i||(i=e(),bS.set(t,i),_S.add(i)),i}const wS=(t,e,i)=>{const n=c_(e,i);void 0!==n&&t.add(n)};class kS{constructor(t){this._config=function(t){return(t=t||{}).data=yS(t.data),vS(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=yS(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(),vS(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return xS(t,(()=>[[`datasets.${t}`,""]]))}datasetAnimationScopeKeys(t,e){return xS(`${t}.transition.${e}`,(()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]]))}datasetElementScopeKeys(t,e){return xS(`${t}-${e}`,(()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]]))}pluginScopeKeys(t){const e=t.id;return xS(`${this.type}-plugin-${e}`,(()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]]))}_cachedScopes(t,e){const i=this._scopeCache;let n=i.get(t);return n&&!e||(n=new Map,i.set(t,n)),n}getOptionScopes(t,e,i){const{options:n,type:o}=this,s=this._cachedScopes(t,i),r=s.get(e);if(r)return r;const a=new Set;e.forEach((e=>{t&&(a.add(t),e.forEach((e=>wS(a,t,e)))),e.forEach((t=>wS(a,n,t))),e.forEach((t=>wS(a,cx[o]||{},t))),e.forEach((t=>wS(a,mx,t))),e.forEach((t=>wS(a,hx,t)))}));const l=Array.from(a);return 0===l.length&&l.push(Object.create(null)),_S.has(e)&&s.set(e,l),l}chartOptionScopes(){const{options:t,type:e}=this;return[t,cx[e]||{},mx.datasets[e]||{},{type:e},mx,hx]}resolveNamedOptions(t,e,i,n=[""]){const o={$shared:!0},{resolver:s,subPrefixes:r}=SS(this._resolverCache,t,n);let a=s;if(function(t,e){const{isScriptable:i,isIndexable:n}=Vx(t);for(const o of e){const e=i(o),s=n(o),r=(s||e)&&t[o];if(e&&(u_(r)||CS(r))||s&&Gb(r))return!0}return!1}(s,e)){o.$shared=!1;a=qx(s,i=u_(i)?i():i,this.createResolver(t,i,r))}for(const t of e)o[t]=a[t];return o}createResolver(t,e,i=[""],n){const{resolver:o}=SS(this._resolverCache,t,i);return Zb(e)?qx(o,e,void 0,n):o}}function SS(t,e,i){let n=t.get(e);n||(n=new Map,t.set(e,n));const o=i.join();let s=n.get(o);if(!s){s={resolver:Fx(e,i),subPrefixes:i.filter((t=>!t.toLowerCase().includes("hover")))},n.set(o,s)}return s}const CS=t=>Zb(t)&&Object.getOwnPropertyNames(t).some((e=>u_(t[e])));const ES=["top","bottom","left","right","chartArea"];function AS(t,e){return"top"===t||"bottom"===t||-1===ES.indexOf(t)&&"x"===e}function MS(t,e){return function(i,n){return i[t]===n[t]?i[e]-n[e]:i[t]-n[t]}}function TS(t){const e=t.chart,i=e.options.animation;e.notifyPlugins("afterRender"),Jb(i&&i.onComplete,[t],e)}function PS(t){const e=t.chart,i=e.options.animation;Jb(i&&i.onProgress,[t],e)}function OS(t){return lw()&&"string"==typeof t?t=document.getElementById(t):t&&t.length&&(t=t[0]),t&&t.canvas&&(t=t.canvas),t}const DS={},IS=t=>{const e=OS(t);return Object.values(DS).filter((t=>t.canvas===e)).pop()};function LS(t,e,i){const n=Object.keys(t);for(const o of n){const n=+o;if(n>=e){const s=t[o];delete t[o],(i>0||n>e)&&(t[n+i]=s)}}}function $S(t,e,i){return t.options.clip?t[i]:e[i]}class zS{static defaults=mx;static instances=DS;static overrides=cx;static registry=lS;static version="4.4.8";static getChart=IS;static register(...t){lS.add(...t),RS()}static unregister(...t){lS.remove(...t),RS()}constructor(t,e){const i=this.config=new kS(e),n=OS(t),o=IS(n);if(o)throw new Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas with ID '"+o.canvas.id+"' can be reused.");const s=i.createResolver(i.chartOptionScopes(),this.getContext());this.platform=new(i.platform||function(t){return!lw()||"undefined"!=typeof OffscreenCanvas&&t instanceof OffscreenCanvas?Ik:Zk}(n)),this.platform.updateConfig(i);const r=this.platform.acquireContext(n,s.aspectRatio),a=r&&r.canvas,l=a&&a.height,c=a&&a.width;this.id=Ub(),this.ctx=r,this.canvas=a,this.width=c,this.height=l,this._options=s,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 cS,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=function(t,e){let i;return function(...n){return e?(clearTimeout(i),i=setTimeout(t,e,n)):t.apply(this,n),e}}((t=>this.update(t)),s.resizeDelay||0),this._dataChanges=[],DS[this.id]=this,r&&a?($w.listen(this,"complete",TS),$w.listen(this,"progress",PS),this._initialize(),this.attached&&this.update()):console.error("Failed to create chart: can't acquire context from the given item")}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:e},width:i,height:n,_aspectRatio:o}=this;return Wb(t)?e&&o?o:n?i/n:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return lS}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():yw(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return yx(this.canvas,this.ctx),this}stop(){return $w.stop(this),this}resize(t,e){$w.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){const i=this.options,n=this.canvas,o=i.maintainAspectRatio&&this.aspectRatio,s=this.platform.getMaximumSize(n,t,e,o),r=i.devicePixelRatio||this.platform.getDevicePixelRatio(),a=this.width?"resize":"attach";this.width=s.width,this.height=s.height,this._aspectRatio=this.aspectRatio,yw(this,r,!0)&&(this.notifyPlugins("resize",{size:s}),Jb(i.onResize,[this,s],this),this.attached&&this._doResize(a)&&this.render())}ensureScalesHaveIDs(){t_(this.options.scales||{},((t,e)=>{t.id=e}))}buildOrUpdateScales(){const t=this.options,e=t.scales,i=this.scales,n=Object.keys(i).reduce(((t,e)=>(t[e]=!1,t)),{});let o=[];e&&(o=o.concat(Object.keys(e).map((t=>{const i=e[t],n=mS(t,i),o="r"===n,s="x"===n;return{options:i,dposition:o?"chartArea":s?"bottom":"left",dtype:o?"radialLinear":s?"category":"linear"}})))),t_(o,(e=>{const o=e.options,s=o.id,r=mS(s,o),a=Kb(o.type,e.dtype);void 0!==o.position&&AS(o.position,r)===AS(e.dposition)||(o.position=e.dposition),n[s]=!0;let l=null;if(s in i&&i[s].type===a)l=i[s];else{l=new(lS.getScale(a))({id:s,type:a,ctx:this.ctx,chart:this}),i[l.id]=l}l.init(o,t)})),t_(n,((t,e)=>{t||delete i[e]})),t_(i,(t=>{Ok.configure(this,t,t.options),Ok.addBox(this,t)}))}_updateMetasets(){const t=this._metasets,e=this.data.datasets.length,i=t.length;if(t.sort(((t,e)=>t.index-e.index)),i>e){for(let t=e;t<i;++t)this._destroyDatasetMeta(t);t.splice(e,i-e)}this._sortedMetasets=t.slice(0).sort(MS("order","index"))}_removeUnreferencedMetasets(){const{_metasets:t,data:{datasets:e}}=this;t.length>e.length&&delete this._stacks,t.forEach(((t,i)=>{0===e.filter((e=>e===t._dataset)).length&&this._destroyDatasetMeta(i)}))}buildOrUpdateControllers(){const t=[],e=this.data.datasets;let i,n;for(this._removeUnreferencedMetasets(),i=0,n=e.length;i<n;i++){const n=e[i];let o=this.getDatasetMeta(i);const s=n.type||this.config.type;if(o.type&&o.type!==s&&(this._destroyDatasetMeta(i),o=this.getDatasetMeta(i)),o.type=s,o.indexAxis=n.indexAxis||uS(s,this.options),o.order=n.order||0,o.index=i,o.label=""+n.label,o.visible=this.isDatasetVisible(i),o.controller)o.controller.updateIndex(i),o.controller.linkScales();else{const e=lS.getController(s),{datasetElementType:n,dataElementType:r}=mx.datasets[s];Object.assign(e,{dataElementType:lS.getElement(r),datasetElementType:n&&lS.getElement(n)}),o.controller=new e(this,i),t.push(o.controller)}}return this._updateMetasets(),t}_resetElements(){t_(this.data.datasets,((t,e)=>{this.getDatasetMeta(e).controller.reset()}),this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const e=this.config;e.update();const i=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),n=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),!1===this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0}))return;const o=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let s=0;for(let t=0,e=this.data.datasets.length;t<e;t++){const{controller:e}=this.getDatasetMeta(t),i=!n&&-1===o.indexOf(e);e.buildOrUpdateElements(i),s=Math.max(+e.getMaxOverflow(),s)}s=this._minPadding=i.layout.autoPadding?s:0,this._updateLayout(s),n||t_(o,(t=>{t.reset()})),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(MS("z","_idx"));const{_active:r,_lastEvent:a}=this;a?this._eventHandler(a,!0):r.length&&this._updateHoverStyles(r,r,!0),this.render()}_updateScales(){t_(this.scales,(t=>{Ok.removeBox(this,t)})),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,e=new Set(Object.keys(this._listeners)),i=new Set(t.events);p_(e,i)&&!!this._responsiveListeners===t.responsive||(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(const{method:i,start:n,count:o}of e){LS(t,n,"_removeElements"===i?-o:o)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const e=this.data.datasets.length,i=e=>new Set(t.filter((t=>t[0]===e)).map(((t,e)=>e+","+t.splice(1).join(",")))),n=i(0);for(let t=1;t<e;t++)if(!p_(n,i(t)))return;return Array.from(n).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;Ok.update(this,this.width,this.height,t);const e=this.chartArea,i=e.width<=0||e.height<=0;this._layers=[],t_(this.boxes,(t=>{i&&"chartArea"===t.position||(t.configure&&t.configure(),this._layers.push(...t._layers()))}),this),this._layers.forEach(((t,e)=>{t._idx=e})),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(!1!==this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})){for(let t=0,e=this.data.datasets.length;t<e;++t)this.getDatasetMeta(t).controller.configure();for(let e=0,i=this.data.datasets.length;e<i;++e)this._updateDataset(e,u_(t)?t({datasetIndex:e}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,e){const i=this.getDatasetMeta(t),n={meta:i,index:t,mode:e,cancelable:!0};!1!==this.notifyPlugins("beforeDatasetUpdate",n)&&(i.controller._update(e),n.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",n))}render(){!1!==this.notifyPlugins("beforeRender",{cancelable:!0})&&($w.has(this)?this.attached&&!$w.running(this)&&$w.start(this):(this.draw(),TS({chart:this})))}draw(){let t;if(this._resizeBeforeDraw){const{width:t,height:e}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(t,e)}if(this.clear(),this.width<=0||this.height<=0)return;if(!1===this.notifyPlugins("beforeDraw",{cancelable:!0}))return;const e=this._layers;for(t=0;t<e.length&&e[t].z<=0;++t)e[t].draw(this.chartArea);for(this._drawDatasets();t<e.length;++t)e[t].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(t){const e=this._sortedMetasets,i=[];let n,o;for(n=0,o=e.length;n<o;++n){const o=e[n];t&&!o.visible||i.push(o)}return i}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(!1===this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0}))return;const t=this.getSortedVisibleDatasetMetas();for(let e=t.length-1;e>=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const e=this.ctx,i=t._clip,n=!i.disabled,o=function(t,e){const{xScale:i,yScale:n}=t;return i&&n?{left:$S(i,e,"left"),right:$S(i,e,"right"),top:$S(n,e,"top"),bottom:$S(n,e,"bottom")}:e}(t,this.chartArea),s={meta:t,index:t.index,cancelable:!0};!1!==this.notifyPlugins("beforeDatasetDraw",s)&&(n&&wx(e,{left:!1===i.left?0:o.left-i.left,right:!1===i.right?this.width:o.right+i.right,top:!1===i.top?0:o.top-i.top,bottom:!1===i.bottom?this.height:o.bottom+i.bottom}),t.controller.draw(),n&&kx(e),s.cancelable=!1,this.notifyPlugins("afterDatasetDraw",s))}isPointInArea(t){return xx(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,i,n){const o=yk.modes[e];return"function"==typeof o?o(this,t,i,n):[]}getDatasetMeta(t){const e=this.data.datasets[t],i=this._metasets;let n=i.filter((t=>t&&t._dataset===e)).pop();return n||(n={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:e&&e.order||0,index:t,_dataset:e,_parsed:[],_sorted:!1},i.push(n)),n}getContext(){return this.$context||(this.$context=Bx(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const e=this.data.datasets[t];if(!e)return!1;const i=this.getDatasetMeta(t);return"boolean"==typeof i.hidden?!i.hidden:!e.hidden}setDatasetVisibility(t,e){this.getDatasetMeta(t).hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,i){const n=i?"show":"hide",o=this.getDatasetMeta(t),s=o.controller._resolveAnimations(void 0,n);d_(e)?(o.data[e].hidden=!i,this.update()):(this.setDatasetVisibility(t,i),s.update(o,{visible:i}),this.update((e=>e.datasetIndex===t?n:void 0)))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){const e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),$w.remove(this),t=0,e=this.data.datasets.length;t<e;++t)this._destroyDatasetMeta(t)}destroy(){this.notifyPlugins("beforeDestroy");const{canvas:t,ctx:e}=this;this._stop(),this.config.clearCache(),t&&(this.unbindEvents(),yx(t,e),this.platform.releaseContext(e),this.canvas=null,this.ctx=null),delete DS[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...t){return this.canvas.toDataURL(...t)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){const t=this._listeners,e=this.platform,i=(i,n)=>{e.addEventListener(this,i,n),t[i]=n},n=(t,e,i)=>{t.offsetX=e,t.offsetY=i,this._eventHandler(t)};t_(this.options.events,(t=>i(t,n)))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,e=this.platform,i=(i,n)=>{e.addEventListener(this,i,n),t[i]=n},n=(i,n)=>{t[i]&&(e.removeEventListener(this,i,n),delete t[i])},o=(t,e)=>{this.canvas&&this.resize(t,e)};let s;const r=()=>{n("attach",r),this.attached=!0,this.resize(),i("resize",o),i("detach",s)};s=()=>{this.attached=!1,n("resize",o),this._stop(),this._resize(0,0),i("attach",r)},e.isAttached(this.canvas)?r():s()}unbindEvents(){t_(this._listeners,((t,e)=>{this.platform.removeEventListener(this,e,t)})),this._listeners={},t_(this._responsiveListeners,((t,e)=>{this.platform.removeEventListener(this,e,t)})),this._responsiveListeners=void 0}updateHoverStyle(t,e,i){const n=i?"set":"remove";let o,s,r,a;for("dataset"===e&&(o=this.getDatasetMeta(t[0].datasetIndex),o.controller["_"+n+"DatasetHoverStyle"]()),r=0,a=t.length;r<a;++r){s=t[r];const e=s&&this.getDatasetMeta(s.datasetIndex).controller;e&&e[n+"HoverStyle"](s.element,s.datasetIndex,s.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){const e=this._active||[],i=t.map((({datasetIndex:t,index:e})=>{const i=this.getDatasetMeta(t);if(!i)throw new Error("No dataset found at index "+t);return{datasetIndex:t,element:i.data[e],index:e}}));!e_(i,e)&&(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,e))}notifyPlugins(t,e,i){return this._plugins.notify(this,t,e,i)}isPluginEnabled(t){return 1===this._plugins._cache.filter((e=>e.plugin.id===t)).length}_updateHoverStyles(t,e,i){const n=this.options.hover,o=(t,e)=>t.filter((t=>!e.some((e=>t.datasetIndex===e.datasetIndex&&t.index===e.index)))),s=o(e,t),r=i?t:o(t,e);s.length&&this.updateHoverStyle(s,n.mode,!1),r.length&&n.mode&&this.updateHoverStyle(r,n.mode,!0)}_eventHandler(t,e){const i={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},n=e=>(e.options.events||this.options.events).includes(t.native.type);if(!1===this.notifyPlugins("beforeEvent",i,n))return;const o=this._handleEvent(t,e,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,n),(o||i.changed)&&this.render(),this}_handleEvent(t,e,i){const{_active:n=[],options:o}=this,s=e,r=this._getActiveElements(t,n,i,s),a=function(t){return"mouseup"===t.type||"click"===t.type||"contextmenu"===t.type}(t),l=function(t,e,i,n){return i&&"mouseout"!==t.type?n?e:t:null}(t,this._lastEvent,i,a);i&&(this._lastEvent=null,Jb(o.onHover,[t,r,this],this),a&&Jb(o.onClick,[t,r,this],this));const c=!e_(r,n);return(c||e)&&(this._active=r,this._updateHoverStyles(r,n,e)),this._lastEvent=l,c}_getActiveElements(t,e,i,n){if("mouseout"===t.type)return[];if(!i)return e;const o=this.options.hover;return this.getElementsAtEventForMode(t,o.mode,o,n)}}function RS(){return t_(zS.instances,(t=>t._plugins.invalidate()))}function NS(t,e,i,n){const o=Lx(t.options.borderRadius,["outerStart","outerEnd","innerStart","innerEnd"]);const s=(i-e)/2,r=Math.min(s,n*e/2),a=t=>{const e=(i-Math.min(s,t))*n/2;return z_(t,0,Math.min(s,e))};return{outerStart:a(o.outerStart),outerEnd:a(o.outerEnd),innerStart:z_(o.innerStart,0,r),innerEnd:z_(o.innerEnd,0,r)}}function jS(t,e,i,n){return{x:i+t*Math.cos(e),y:n+t*Math.sin(e)}}function BS(t,e,i,n,o,s){const{x:r,y:a,startAngle:l,pixelMargin:c,innerRadius:h}=e,d=Math.max(e.outerRadius+n+i-c,0),u=h>0?h+n+i+c:0;let p=0;const m=o-l;if(n){const t=((h>0?h-n:0)+(d>0?d-n:0))/2;p=(m-(0!==t?m*t/(t+n):m))/2}const f=(m-Math.max(.001,m*d-i/m_)/d)/2,g=l+f+p,v=o-f-p,{outerStart:y,outerEnd:b,innerStart:_,innerEnd:x}=NS(e,u,d,v-g),w=d-y,k=d-b,S=g+y/w,C=v-b/k,E=u+_,A=u+x,M=g+_/E,T=v-x/A;if(t.beginPath(),s){const e=(S+C)/2;if(t.arc(r,a,d,S,e),t.arc(r,a,d,e,C),b>0){const e=jS(k,C,r,a);t.arc(e.x,e.y,b,C,v+b_)}const i=jS(A,v,r,a);if(t.lineTo(i.x,i.y),x>0){const e=jS(A,T,r,a);t.arc(e.x,e.y,x,v+b_,T+Math.PI)}const n=(v-x/u+(g+_/u))/2;if(t.arc(r,a,u,v-x/u,n,!0),t.arc(r,a,u,n,g+_/u,!0),_>0){const e=jS(E,M,r,a);t.arc(e.x,e.y,_,M+Math.PI,g-b_)}const o=jS(w,g,r,a);if(t.lineTo(o.x,o.y),y>0){const e=jS(w,S,r,a);t.arc(e.x,e.y,y,g-b_,S)}}else{t.moveTo(r,a);const e=Math.cos(S)*d+r,i=Math.sin(S)*d+a;t.lineTo(e,i);const n=Math.cos(C)*d+r,o=Math.sin(C)*d+a;t.lineTo(n,o)}t.closePath()}function FS(t,e,i,n,o){const{fullCircles:s,startAngle:r,circumference:a,options:l}=e,{borderWidth:c,borderJoinStyle:h,borderDash:d,borderDashOffset:u}=l,p="inner"===l.borderAlign;if(!c)return;t.setLineDash(d||[]),t.lineDashOffset=u,p?(t.lineWidth=2*c,t.lineJoin=h||"round"):(t.lineWidth=c,t.lineJoin=h||"bevel");let m=e.endAngle;if(s){BS(t,e,i,n,m,o);for(let e=0;e<s;++e)t.stroke();isNaN(a)||(m=r+(a%f_||f_))}p&&function(t,e,i){const{startAngle:n,pixelMargin:o,x:s,y:r,outerRadius:a,innerRadius:l}=e;let c=o/a;t.beginPath(),t.arc(s,r,a,n-c,i+c),l>o?(c=o/l,t.arc(s,r,l,i+c,n-c,!0)):t.arc(s,r,o,i+b_,n-b_),t.closePath(),t.clip()}(t,e,m),s||(BS(t,e,i,n,m,o),t.stroke())}function qS(t,e,i=e){t.lineCap=Kb(i.borderCapStyle,e.borderCapStyle),t.setLineDash(Kb(i.borderDash,e.borderDash)),t.lineDashOffset=Kb(i.borderDashOffset,e.borderDashOffset),t.lineJoin=Kb(i.borderJoinStyle,e.borderJoinStyle),t.lineWidth=Kb(i.borderWidth,e.borderWidth),t.strokeStyle=Kb(i.borderColor,e.borderColor)}function VS(t,e,i){t.lineTo(i.x,i.y)}function HS(t,e,i={}){const n=t.length,{start:o=0,end:s=n-1}=i,{start:r,end:a}=e,l=Math.max(o,r),c=Math.min(s,a),h=o<r&&s<r||o>a&&s>a;return{count:n,start:l,loop:e.loop,ilen:c<l&&!h?n+c-l:c-l}}function US(t,e,i,n){const{points:o,options:s}=e,{count:r,start:a,loop:l,ilen:c}=HS(o,i,n),h=function(t){return t.stepped?Sx:t.tension||"monotone"===t.cubicInterpolationMode?Cx:VS}(s);let d,u,p,{move:m=!0,reverse:f}=n||{};for(d=0;d<=c;++d)u=o[(a+(f?c-d:d))%r],u.skip||(m?(t.moveTo(u.x,u.y),m=!1):h(t,p,u,f,s.stepped),p=u);return l&&(u=o[(a+(f?c:0))%r],h(t,p,u,f,s.stepped)),!!l}function WS(t,e,i,n){const o=e.points,{count:s,start:r,ilen:a}=HS(o,i,n),{move:l=!0,reverse:c}=n||{};let h,d,u,p,m,f,g=0,v=0;const y=t=>(r+(c?a-t:t))%s,b=()=>{p!==m&&(t.lineTo(g,m),t.lineTo(g,p),t.lineTo(g,f))};for(l&&(d=o[y(0)],t.moveTo(d.x,d.y)),h=0;h<=a;++h){if(d=o[y(h)],d.skip)continue;const e=d.x,i=d.y,n=0|e;n===u?(i<p?p=i:i>m&&(m=i),g=(v*g+e)/++v):(b(),t.lineTo(e,i),u=n,v=0,p=m=i),f=i}b()}function GS(t){const e=t.options,i=e.borderDash&&e.borderDash.length;return!(t._decimated||t._loop||e.tension||"monotone"===e.cubicInterpolationMode||e.stepped||i)?WS:US}const ZS="function"==typeof Path2D;function YS(t,e,i,n){ZS&&!e.options.segment?function(t,e,i,n){let o=e._path;o||(o=e._path=new Path2D,e.path(o,i,n)&&o.closePath()),qS(t,e.options),t.stroke(o)}(t,e,i,n):function(t,e,i,n){const{segments:o,options:s}=e,r=GS(e);for(const a of o)qS(t,s,a.style),t.beginPath(),r(t,e,a,{start:i,end:i+n-1})&&t.closePath(),t.stroke()}(t,e,i,n)}class XS extends Yk{static id="line";static defaults={borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};static descriptors={_scriptable:!0,_indexable:t=>"borderDash"!==t&&"fill"!==t};constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,e){const i=this.options;if((i.tension||"monotone"===i.cubicInterpolationMode)&&!i.stepped&&!this._pointsUpdated){const n=i.spanGaps?this._loop:this._fullLoop;aw(this._points,i,t,n,e),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=function(t,e){const i=t.points,n=t.options.spanGaps,o=i.length;if(!o)return[];const s=!!t._loop,{start:r,end:a}=function(t,e,i,n){let o=0,s=e-1;if(i&&!n)for(;o<e&&!t[o].skip;)o++;for(;o<e&&t[o].skip;)o++;for(o%=e,i&&(s+=o);s>o&&t[s%e].skip;)s--;return s%=e,{start:o,end:s}}(i,o,s,n);return Ow(t,!0===n?[{start:r,end:a,loop:s}]:function(t,e,i,n){const o=t.length,s=[];let r,a=e,l=t[e];for(r=e+1;r<=i;++r){const i=t[r%o];i.skip||i.stop?l.skip||(n=!1,s.push({start:e%o,end:(r-1)%o,loop:n}),e=a=i.stop?r:null):(a=r,l.skip&&(e=r)),l=i}return null!==a&&s.push({start:e%o,end:a%o,loop:n}),s}(i,r,a<r?a+o:a,!!t._fullLoop&&0===r&&a===o-1),i,e)}(this,this.options.segment))}first(){const t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){const t=this.segments,e=this.points,i=t.length;return i&&e[t[i-1].end]}interpolate(t,e){const i=this.options,n=t[e],o=this.points,s=Pw(this,{property:e,start:n,end:n});if(!s.length)return;const r=[],a=function(t){return t.stepped?ww:t.tension||"monotone"===t.cubicInterpolationMode?kw:xw}(i);let l,c;for(l=0,c=s.length;l<c;++l){const{start:c,end:h}=s[l],d=o[c],u=o[h];if(d===u){r.push(d);continue}const p=a(d,u,Math.abs((n-d[e])/(u[e]-d[e])),i.stepped);p[e]=t[e],r.push(p)}return 1===r.length?r[0]:r}pathSegment(t,e,i){return GS(this)(t,this,e,i)}path(t,e,i){const n=this.segments,o=GS(this);let s=this._loop;e=e||0,i=i||this.points.length-e;for(const r of n)s&=o(t,this,r,{start:e,end:e+i-1});return!!s}draw(t,e,i,n){const o=this.options||{};(this.points||[]).length&&o.borderWidth&&(t.save(),YS(t,this,i,n),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}function KS(t,e,i,n){const o=t.options,{[i]:s}=t.getProps([i],n);return Math.abs(e-s)<o.radius+o.hitRadius}function QS(t,e){const{x:i,y:n,base:o,width:s,height:r}=t.getProps(["x","y","base","width","height"],e);let a,l,c,h,d;return t.horizontal?(d=r/2,a=Math.min(i,o),l=Math.max(i,o),c=n-d,h=n+d):(d=s/2,a=i-d,l=i+d,c=Math.min(n,o),h=Math.max(n,o)),{left:a,top:c,right:l,bottom:h}}function JS(t,e,i,n){return t?0:z_(e,i,n)}function tC(t){const e=QS(t),i=e.right-e.left,n=e.bottom-e.top,o=function(t,e,i){const n=t.options.borderWidth,o=t.borderSkipped,s=$x(n);return{t:JS(o.top,s.top,0,i),r:JS(o.right,s.right,0,e),b:JS(o.bottom,s.bottom,0,i),l:JS(o.left,s.left,0,e)}}(t,i/2,n/2),s=function(t,e,i){const{enableBorderRadius:n}=t.getProps(["enableBorderRadius"]),o=t.options.borderRadius,s=zx(o),r=Math.min(e,i),a=t.borderSkipped,l=n||Zb(o);return{topLeft:JS(!l||a.top||a.left,s.topLeft,0,r),topRight:JS(!l||a.top||a.right,s.topRight,0,r),bottomLeft:JS(!l||a.bottom||a.left,s.bottomLeft,0,r),bottomRight:JS(!l||a.bottom||a.right,s.bottomRight,0,r)}}(t,i/2,n/2);return{outer:{x:e.left,y:e.top,w:i,h:n,radius:s},inner:{x:e.left+o.l,y:e.top+o.t,w:i-o.l-o.r,h:n-o.t-o.b,radius:{topLeft:Math.max(0,s.topLeft-Math.max(o.t,o.l)),topRight:Math.max(0,s.topRight-Math.max(o.t,o.r)),bottomLeft:Math.max(0,s.bottomLeft-Math.max(o.b,o.l)),bottomRight:Math.max(0,s.bottomRight-Math.max(o.b,o.r))}}}}function eC(t,e,i,n){const o=null===e,s=null===i,r=t&&!(o&&s)&&QS(t,n);return r&&(o||R_(e,r.left,r.right))&&(s||R_(i,r.top,r.bottom))}function iC(t,e){t.rect(e.x,e.y,e.w,e.h)}function nC(t,e,i={}){const n=t.x!==i.x?-e:0,o=t.y!==i.y?-e:0,s=(t.x+t.w!==i.x+i.w?e:0)-n,r=(t.y+t.h!==i.y+i.h?e:0)-o;return{x:t.x+n,y:t.y+o,w:t.w+s,h:t.h+r,radius:t.radius}}var oC=Object.freeze({__proto__:null,ArcElement:class extends Yk{static id="arc";static defaults={borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0};static defaultRoutes={backgroundColor:"backgroundColor"};static descriptors={_scriptable:!0,_indexable:t=>"borderDash"!==t};circumference;endAngle;fullCircles;innerRadius;outerRadius;pixelMargin;startAngle;constructor(t){super(),this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,t&&Object.assign(this,t)}inRange(t,e,i){const n=this.getProps(["x","y"],i),{angle:o,distance:s}=O_(n,{x:t,y:e}),{startAngle:r,endAngle:a,innerRadius:l,outerRadius:c,circumference:h}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],i),d=(this.options.spacing+this.options.borderWidth)/2,u=Kb(h,a-r),p=$_(o,r,a)&&r!==a,m=u>=f_||p,f=R_(s,l+d,c+d);return m&&f}getCenterPoint(t){const{x:e,y:i,startAngle:n,endAngle:o,innerRadius:s,outerRadius:r}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],t),{offset:a,spacing:l}=this.options,c=(n+o)/2,h=(s+r+l+a)/2;return{x:e+Math.cos(c)*h,y:i+Math.sin(c)*h}}tooltipPosition(t){return this.getCenterPoint(t)}draw(t){const{options:e,circumference:i}=this,n=(e.offset||0)/4,o=(e.spacing||0)/2,s=e.circular;if(this.pixelMargin="inner"===e.borderAlign?.33:0,this.fullCircles=i>f_?Math.floor(i/f_):0,0===i||this.innerRadius<0||this.outerRadius<0)return;t.save();const r=(this.startAngle+this.endAngle)/2;t.translate(Math.cos(r)*n,Math.sin(r)*n);const a=n*(1-Math.sin(Math.min(m_,i||0)));t.fillStyle=e.backgroundColor,t.strokeStyle=e.borderColor,function(t,e,i,n,o){const{fullCircles:s,startAngle:r,circumference:a}=e;let l=e.endAngle;if(s){BS(t,e,i,n,l,o);for(let e=0;e<s;++e)t.fill();isNaN(a)||(l=r+(a%f_||f_))}BS(t,e,i,n,l,o),t.fill()}(t,this,a,o,s),FS(t,this,a,o,s),t.restore()}},BarElement:class extends Yk{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:e,options:{borderColor:i,backgroundColor:n}}=this,{inner:o,outer:s}=tC(this),r=(a=s.radius).topLeft||a.topRight||a.bottomLeft||a.bottomRight?Tx:iC;var a;t.save(),s.w===o.w&&s.h===o.h||(t.beginPath(),r(t,nC(s,e,o)),t.clip(),r(t,nC(o,-e,s)),t.fillStyle=i,t.fill("evenodd")),t.beginPath(),r(t,nC(o,e)),t.fillStyle=n,t.fill(),t.restore()}inRange(t,e,i){return eC(this,t,e,i)}inXRange(t,e){return eC(this,t,null,e)}inYRange(t,e){return eC(this,null,t,e)}getCenterPoint(t){const{x:e,y:i,base:n,horizontal:o}=this.getProps(["x","y","base","horizontal"],t);return{x:o?(e+n)/2:e,y:o?i:(i+n)/2}}getRange(t){return"x"===t?this.width/2:this.height/2}},LineElement:XS,PointElement:class extends Yk{static id="point";parsed;skip;stop;static defaults={borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(t){super(),this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,t&&Object.assign(this,t)}inRange(t,e,i){const n=this.options,{x:o,y:s}=this.getProps(["x","y"],i);return Math.pow(t-o,2)+Math.pow(e-s,2)<Math.pow(n.hitRadius+n.radius,2)}inXRange(t,e){return KS(this,t,"x",e)}inYRange(t,e){return KS(this,t,"y",e)}getCenterPoint(t){const{x:e,y:i}=this.getProps(["x","y"],t);return{x:e,y:i}}size(t){let e=(t=t||this.options||{}).radius||0;e=Math.max(e,e&&t.hoverRadius||0);return 2*(e+(e&&t.borderWidth||0))}draw(t,e){const i=this.options;this.skip||i.radius<.1||!xx(this,e,this.size(i)/2)||(t.strokeStyle=i.borderColor,t.lineWidth=i.borderWidth,t.fillStyle=i.backgroundColor,bx(t,i,this.x,this.y))}getRange(){const t=this.options||{};return t.radius+t.hitRadius}}});const sC=["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)"],rC=sC.map((t=>t.replace("rgb(","rgba(").replace(")",", 0.5)")));function aC(t){return sC[t%sC.length]}function lC(t){return rC[t%rC.length]}function cC(t){let e=0;return(i,n)=>{const o=t.getDatasetMeta(n).controller;o instanceof rk?e=function(t,e){return t.backgroundColor=t.data.map((()=>aC(e++))),e}(i,e):o instanceof ak?e=function(t,e){return t.backgroundColor=t.data.map((()=>lC(e++))),e}(i,e):o&&(e=function(t,e){return t.borderColor=aC(e),t.backgroundColor=lC(e),++e}(i,e))}}function hC(t){let e;for(e in t)if(t[e].borderColor||t[e].backgroundColor)return!0;return!1}var dC={id:"colors",defaults:{enabled:!0,forceOverride:!1},beforeLayout(t,e,i){if(!i.enabled)return;const{data:{datasets:n},options:o}=t.config,{elements:s}=o,r=hC(n)||(a=o)&&(a.borderColor||a.backgroundColor)||s&&hC(s)||"rgba(0,0,0,0.1)"!==mx.borderColor||"rgba(0,0,0,0.1)"!==mx.backgroundColor;var a;if(!i.forceOverride&&r)return;const l=cC(t);n.forEach(l)}};function uC(t){if(t._decimated){const e=t._data;delete t._decimated,delete t._data,Object.defineProperty(t,"data",{configurable:!0,enumerable:!0,writable:!0,value:e})}}function pC(t){t.data.datasets.forEach((t=>{uC(t)}))}var mC={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(t,e,i)=>{if(!i.enabled)return void pC(t);const n=t.width;t.data.datasets.forEach(((e,o)=>{const{_data:s,indexAxis:r}=e,a=t.getDatasetMeta(o),l=s||e.data;if("y"===jx([r,t.options.indexAxis]))return;if(!a.controller.supportsDecimation)return;const c=t.scales[a.xAxisID];if("linear"!==c.type&&"time"!==c.type)return;if(t.options.parsing)return;let{start:h,count:d}=function(t,e){const i=e.length;let n,o=0;const{iScale:s}=t,{min:r,max:a,minDefined:l,maxDefined:c}=s.getUserBounds();return l&&(o=z_(j_(e,s.axis,r).lo,0,i-1)),n=c?z_(j_(e,s.axis,a).hi+1,o,i)-o:i-o,{start:o,count:n}}(a,l);if(d<=(i.threshold||4*n))return void uC(e);let u;switch(Wb(s)&&(e._data=l,delete e.data,Object.defineProperty(e,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(t){this._data=t}})),i.algorithm){case"lttb":u=function(t,e,i,n,o){const s=o.samples||n;if(s>=i)return t.slice(e,e+i);const r=[],a=(i-2)/(s-2);let l=0;const c=e+i-1;let h,d,u,p,m,f=e;for(r[l++]=t[f],h=0;h<s-2;h++){let n,o=0,s=0;const c=Math.floor((h+1)*a)+1+e,g=Math.min(Math.floor((h+2)*a)+1,i)+e,v=g-c;for(n=c;n<g;n++)o+=t[n].x,s+=t[n].y;o/=v,s/=v;const y=Math.floor(h*a)+1+e,b=Math.min(Math.floor((h+1)*a)+1,i)+e,{x:_,y:x}=t[f];for(u=p=-1,n=y;n<b;n++)p=.5*Math.abs((_-o)*(t[n].y-x)-(_-t[n].x)*(s-x)),p>u&&(u=p,d=t[n],m=n);r[l++]=d,f=m}return r[l++]=t[c],r}(l,h,d,n,i);break;case"min-max":u=function(t,e,i,n){let o,s,r,a,l,c,h,d,u,p,m=0,f=0;const g=[],v=e+i-1,y=t[e].x,b=t[v].x-y;for(o=e;o<e+i;++o){s=t[o],r=(s.x-y)/b*n,a=s.y;const e=0|r;if(e===l)a<u?(u=a,c=o):a>p&&(p=a,h=o),m=(f*m+s.x)/++f;else{const i=o-1;if(!Wb(c)&&!Wb(h)){const e=Math.min(c,h),n=Math.max(c,h);e!==d&&e!==i&&g.push({...t[e],x:m}),n!==d&&n!==i&&g.push({...t[n],x:m})}o>0&&i!==d&&g.push(t[i]),g.push(s),l=e,f=0,u=p=a,c=h=d=o}}return g}(l,h,d,n);break;default:throw new Error(`Unsupported decimation algorithm '${i.algorithm}'`)}e._decimated=u}))},destroy(t){pC(t)}};function fC(t,e,i,n){if(n)return;let o=e[t],s=i[t];return"angle"===t&&(o=L_(o),s=L_(s)),{property:t,start:o,end:s}}function gC(t,e,i){for(;e>t;e--){const t=i[e];if(!isNaN(t.x)&&!isNaN(t.y))break}return e}function vC(t,e,i,n){return t&&e?n(t[i],e[i]):t?t[i]:e?e[i]:0}function yC(t,e){let i=[],n=!1;return Gb(t)?(n=!0,i=t):i=function(t,e){const{x:i=null,y:n=null}=t||{},o=e.points,s=[];return e.segments.forEach((({start:t,end:e})=>{e=gC(t,e,o);const r=o[t],a=o[e];null!==n?(s.push({x:r.x,y:n}),s.push({x:a.x,y:n})):null!==i&&(s.push({x:i,y:r.y}),s.push({x:i,y:a.y}))})),s}(t,e),i.length?new XS({points:i,options:{tension:0},_loop:n,_fullLoop:n}):null}function bC(t){return t&&!1!==t.fill}function _C(t,e,i){let n=t[e].fill;const o=[e];let s;if(!i)return n;for(;!1!==n&&-1===o.indexOf(n);){if(!Yb(n))return n;if(s=t[n],!s)return!1;if(s.visible)return n;o.push(n),n=s.fill}return!1}function xC(t,e,i){const n=function(t){const e=t.options,i=e.fill;let n=Kb(i&&i.target,i);void 0===n&&(n=!!e.backgroundColor);if(!1===n||null===n)return!1;if(!0===n)return"origin";return n}(t);if(Zb(n))return!isNaN(n.value)&&n;let o=parseFloat(n);return Yb(o)&&Math.floor(o)===o?function(t,e,i,n){"-"!==t&&"+"!==t||(i=e+i);if(i===e||i<0||i>=n)return!1;return i}(n[0],e,o,i):["origin","start","end","stack","shape"].indexOf(n)>=0&&n}function wC(t,e,i){const n=[];for(let o=0;o<i.length;o++){const s=i[o],{first:r,last:a,point:l}=kC(s,e,"x");if(!(!l||r&&a))if(r)n.unshift(l);else if(t.push(l),!a)break}t.push(...n)}function kC(t,e,i){const n=t.interpolate(e,i);if(!n)return{};const o=n[i],s=t.segments,r=t.points;let a=!1,l=!1;for(let t=0;t<s.length;t++){const e=s[t],n=r[e.start][i],c=r[e.end][i];if(R_(o,n,c)){a=o===n,l=o===c;break}}return{first:a,last:l,point:n}}class SC{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius}pathSegment(t,e,i){const{x:n,y:o,radius:s}=this;return e=e||{start:0,end:f_},t.arc(n,o,s,e.end,e.start,!0),!i.bounds}interpolate(t){const{x:e,y:i,radius:n}=this,o=t.angle;return{x:e+Math.cos(o)*n,y:i+Math.sin(o)*n,angle:o}}}function CC(t){const{chart:e,fill:i,line:n}=t;if(Yb(i))return function(t,e){const i=t.getDatasetMeta(e),n=i&&t.isDatasetVisible(e);return n?i.dataset:null}(e,i);if("stack"===i)return function(t){const{scale:e,index:i,line:n}=t,o=[],s=n.segments,r=n.points,a=function(t,e){const i=[],n=t.getMatchingVisibleMetas("line");for(let t=0;t<n.length;t++){const o=n[t];if(o.index===e)break;o.hidden||i.unshift(o.dataset)}return i}(e,i);a.push(yC({x:null,y:e.bottom},n));for(let t=0;t<s.length;t++){const e=s[t];for(let t=e.start;t<=e.end;t++)wC(o,r[t],a)}return new XS({points:o,options:{}})}(t);if("shape"===i)return!0;const o=function(t){const e=t.scale||{};if(e.getPointPositionForValue)return function(t){const{scale:e,fill:i}=t,n=e.options,o=e.getLabels().length,s=n.reverse?e.max:e.min,r=function(t,e,i){let n;return n="start"===t?i:"end"===t?e.options.reverse?e.min:e.max:Zb(t)?t.value:e.getBaseValue(),n}(i,e,s),a=[];if(n.grid.circular){const t=e.getPointPositionForValue(0,s);return new SC({x:t.x,y:t.y,radius:e.getDistanceFromCenterForValue(r)})}for(let t=0;t<o;++t)a.push(e.getPointPositionForValue(t,r));return a}(t);return function(t){const{scale:e={},fill:i}=t,n=function(t,e){let i=null;return"start"===t?i=e.bottom:"end"===t?i=e.top:Zb(t)?i=e.getPixelForValue(t.value):e.getBasePixel&&(i=e.getBasePixel()),i}(i,e);if(Yb(n)){const t=e.isHorizontal();return{x:t?n:null,y:t?null:n}}return null}(t)}(t);return o instanceof SC?o:yC(o,n)}function EC(t,e,i){const n=CC(e),{line:o,scale:s,axis:r}=e,a=o.options,l=a.fill,c=a.backgroundColor,{above:h=c,below:d=c}=l||{};n&&o.points.length&&(wx(t,i),function(t,e){const{line:i,target:n,above:o,below:s,area:r,scale:a}=e,l=i._loop?"angle":e.axis;t.save(),"x"===l&&s!==o&&(AC(t,n,r.top),MC(t,{line:i,target:n,color:o,scale:a,property:l}),t.restore(),t.save(),AC(t,n,r.bottom));MC(t,{line:i,target:n,color:s,scale:a,property:l}),t.restore()}(t,{line:o,target:n,above:h,below:d,area:i,scale:s,axis:r}),kx(t))}function AC(t,e,i){const{segments:n,points:o}=e;let s=!0,r=!1;t.beginPath();for(const a of n){const{start:n,end:l}=a,c=o[n],h=o[gC(n,l,o)];s?(t.moveTo(c.x,c.y),s=!1):(t.lineTo(c.x,i),t.lineTo(c.x,c.y)),r=!!e.pathSegment(t,a,{move:r}),r?t.closePath():t.lineTo(h.x,i)}t.lineTo(e.first().x,i),t.closePath(),t.clip()}function MC(t,e){const{line:i,target:n,property:o,color:s,scale:r}=e,a=function(t,e,i){const n=t.segments,o=t.points,s=e.points,r=[];for(const t of n){let{start:n,end:a}=t;a=gC(n,a,o);const l=fC(i,o[n],o[a],t.loop);if(!e.segments){r.push({source:t,target:l,start:o[n],end:o[a]});continue}const c=Pw(e,l);for(const e of c){const n=fC(i,s[e.start],s[e.end],e.loop),a=Tw(t,o,n);for(const t of a)r.push({source:t,target:e,start:{[i]:vC(l,n,"start",Math.max)},end:{[i]:vC(l,n,"end",Math.min)}})}}return r}(i,n,o);for(const{source:e,target:l,start:c,end:h}of a){const{style:{backgroundColor:a=s}={}}=e,d=!0!==n;t.save(),t.fillStyle=a,TC(t,r,d&&fC(o,c,h)),t.beginPath();const u=!!i.pathSegment(t,e);let p;if(d){u?t.closePath():PC(t,n,h,o);const e=!!n.pathSegment(t,l,{move:u,reverse:!0});p=u&&e,p||PC(t,n,c,o)}t.closePath(),t.fill(p?"evenodd":"nonzero"),t.restore()}}function TC(t,e,i){const{top:n,bottom:o}=e.chart.chartArea,{property:s,start:r,end:a}=i||{};"x"===s&&(t.beginPath(),t.rect(r,n,a-r,o-n),t.clip())}function PC(t,e,i,n){const o=e.interpolate(i,n);o&&t.lineTo(o.x,o.y)}var OC={id:"filler",afterDatasetsUpdate(t,e,i){const n=(t.data.datasets||[]).length,o=[];let s,r,a,l;for(r=0;r<n;++r)s=t.getDatasetMeta(r),a=s.dataset,l=null,a&&a.options&&a instanceof XS&&(l={visible:t.isDatasetVisible(r),index:r,fill:xC(a,r,n),chart:t,axis:s.controller.options.indexAxis,scale:s.vScale,line:a}),s.$filler=l,o.push(l);for(r=0;r<n;++r)l=o[r],l&&!1!==l.fill&&(l.fill=_C(o,r,i.propagate))},beforeDraw(t,e,i){const n="beforeDraw"===i.drawTime,o=t.getSortedVisibleDatasetMetas(),s=t.chartArea;for(let e=o.length-1;e>=0;--e){const i=o[e].$filler;i&&(i.line.updateControlPoints(s,i.axis),n&&i.fill&&EC(t.ctx,i,s))}},beforeDatasetsDraw(t,e,i){if("beforeDatasetsDraw"!==i.drawTime)return;const n=t.getSortedVisibleDatasetMetas();for(let e=n.length-1;e>=0;--e){const i=n[e].$filler;bC(i)&&EC(t.ctx,i,t.chartArea)}},beforeDatasetDraw(t,e,i){const n=e.meta.$filler;bC(n)&&"beforeDatasetDraw"===i.drawTime&&EC(t.ctx,n,t.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const DC=(t,e)=>{let{boxHeight:i=e,boxWidth:n=e}=t;return t.usePointStyle&&(i=Math.min(i,e),n=t.pointStyleWidth||Math.min(n,e)),{boxWidth:n,boxHeight:i,itemHeight:Math.max(e,i)}};class IC extends Yk{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e,i){this.maxWidth=t,this.maxHeight=e,this._margins=i,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const t=this.options.labels||{};let e=Jb(t.generateLabels,[this.chart],this)||[];t.filter&&(e=e.filter((e=>t.filter(e,this.chart.data)))),t.sort&&(e=e.sort(((e,i)=>t.sort(e,i,this.chart.data)))),this.options.reverse&&e.reverse(),this.legendItems=e}fit(){const{options:t,ctx:e}=this;if(!t.display)return void(this.width=this.height=0);const i=t.labels,n=Nx(i.font),o=n.size,s=this._computeTitleHeight(),{boxWidth:r,itemHeight:a}=DC(i,o);let l,c;e.font=n.string,this.isHorizontal()?(l=this.maxWidth,c=this._fitRows(s,o,r,a)+10):(c=this.maxHeight,l=this._fitCols(s,n,r,a)+10),this.width=Math.min(l,t.maxWidth||this.maxWidth),this.height=Math.min(c,t.maxHeight||this.maxHeight)}_fitRows(t,e,i,n){const{ctx:o,maxWidth:s,options:{labels:{padding:r}}}=this,a=this.legendHitBoxes=[],l=this.lineWidths=[0],c=n+r;let h=t;o.textAlign="left",o.textBaseline="middle";let d=-1,u=-c;return this.legendItems.forEach(((t,p)=>{const m=i+e/2+o.measureText(t.text).width;(0===p||l[l.length-1]+m+2*r>s)&&(h+=c,l[l.length-(p>0?0:1)]=0,u+=c,d++),a[p]={left:0,top:u,row:d,width:m,height:n},l[l.length-1]+=m+r})),h}_fitCols(t,e,i,n){const{ctx:o,maxHeight:s,options:{labels:{padding:r}}}=this,a=this.legendHitBoxes=[],l=this.columnSizes=[],c=s-t;let h=r,d=0,u=0,p=0,m=0;return this.legendItems.forEach(((t,s)=>{const{itemWidth:f,itemHeight:g}=function(t,e,i,n,o){const s=function(t,e,i,n){let o=t.text;o&&"string"!=typeof o&&(o=o.reduce(((t,e)=>t.length>e.length?t:e)));return e+i.size/2+n.measureText(o).width}(n,t,e,i),r=function(t,e,i){let n=t;"string"!=typeof e.text&&(n=LC(e,i));return n}(o,n,e.lineHeight);return{itemWidth:s,itemHeight:r}}(i,e,o,t,n);s>0&&u+g+2*r>c&&(h+=d+r,l.push({width:d,height:u}),p+=d+r,m++,d=u=0),a[s]={left:p,top:u,col:m,width:f,height:g},d=Math.max(d,f),u+=g+r})),h+=d,l.push({width:d,height:u}),h}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:e,options:{align:i,labels:{padding:n},rtl:o}}=this,s=Sw(o,this.left,this.width);if(this.isHorizontal()){let o=0,r=G_(i,this.left+n,this.right-this.lineWidths[o]);for(const a of e)o!==a.row&&(o=a.row,r=G_(i,this.left+n,this.right-this.lineWidths[o])),a.top+=this.top+t+n,a.left=s.leftForLtr(s.x(r),a.width),r+=a.width+n}else{let o=0,r=G_(i,this.top+t+n,this.bottom-this.columnSizes[o].height);for(const a of e)a.col!==o&&(o=a.col,r=G_(i,this.top+t+n,this.bottom-this.columnSizes[o].height)),a.top=r,a.left+=this.left+n,a.left=s.leftForLtr(s.x(a.left),a.width),r+=a.height+n}}isHorizontal(){return"top"===this.options.position||"bottom"===this.options.position}draw(){if(this.options.display){const t=this.ctx;wx(t,this),this._draw(),kx(t)}}_draw(){const{options:t,columnSizes:e,lineWidths:i,ctx:n}=this,{align:o,labels:s}=t,r=mx.color,a=Sw(t.rtl,this.left,this.width),l=Nx(s.font),{padding:c}=s,h=l.size,d=h/2;let u;this.drawTitle(),n.textAlign=a.textAlign("left"),n.textBaseline="middle",n.lineWidth=.5,n.font=l.string;const{boxWidth:p,boxHeight:m,itemHeight:f}=DC(s,h),g=this.isHorizontal(),v=this._computeTitleHeight();u=g?{x:G_(o,this.left+c,this.right-i[0]),y:this.top+c+v,line:0}:{x:this.left+c,y:G_(o,this.top+v+c,this.bottom-e[0].height),line:0},Cw(this.ctx,t.textDirection);const y=f+c;this.legendItems.forEach(((b,_)=>{n.strokeStyle=b.fontColor,n.fillStyle=b.fontColor;const x=n.measureText(b.text).width,w=a.textAlign(b.textAlign||(b.textAlign=s.textAlign)),k=p+d+x;let S=u.x,C=u.y;a.setWidth(this.width),g?_>0&&S+k+c>this.right&&(C=u.y+=y,u.line++,S=u.x=G_(o,this.left+c,this.right-i[u.line])):_>0&&C+y>this.bottom&&(S=u.x=S+e[u.line].width+c,u.line++,C=u.y=G_(o,this.top+v+c,this.bottom-e[u.line].height));if(function(t,e,i){if(isNaN(p)||p<=0||isNaN(m)||m<0)return;n.save();const o=Kb(i.lineWidth,1);if(n.fillStyle=Kb(i.fillStyle,r),n.lineCap=Kb(i.lineCap,"butt"),n.lineDashOffset=Kb(i.lineDashOffset,0),n.lineJoin=Kb(i.lineJoin,"miter"),n.lineWidth=o,n.strokeStyle=Kb(i.strokeStyle,r),n.setLineDash(Kb(i.lineDash,[])),s.usePointStyle){const r={radius:m*Math.SQRT2/2,pointStyle:i.pointStyle,rotation:i.rotation,borderWidth:o},l=a.xPlus(t,p/2);_x(n,r,l,e+d,s.pointStyleWidth&&p)}else{const s=e+Math.max((h-m)/2,0),r=a.leftForLtr(t,p),l=zx(i.borderRadius);n.beginPath(),Object.values(l).some((t=>0!==t))?Tx(n,{x:r,y:s,w:p,h:m,radius:l}):n.rect(r,s,p,m),n.fill(),0!==o&&n.stroke()}n.restore()}(a.x(S),C,b),S=((t,e,i,n)=>t===(n?"left":"right")?i:"center"===t?(e+i)/2:e)(w,S+p+d,g?S+k:this.right,t.rtl),function(t,e,i){Mx(n,i.text,t,e+f/2,l,{strikethrough:i.hidden,textAlign:a.textAlign(i.textAlign)})}(a.x(S),C,b),g)u.x+=k+c;else if("string"!=typeof b.text){const t=l.lineHeight;u.y+=LC(b,t)+c}else u.y+=y})),Ew(this.ctx,t.textDirection)}drawTitle(){const t=this.options,e=t.title,i=Nx(e.font),n=Rx(e.padding);if(!e.display)return;const o=Sw(t.rtl,this.left,this.width),s=this.ctx,r=e.position,a=i.size/2,l=n.top+a;let c,h=this.left,d=this.width;if(this.isHorizontal())d=Math.max(...this.lineWidths),c=this.top+l,h=G_(t.align,h,this.right-d);else{const e=this.columnSizes.reduce(((t,e)=>Math.max(t,e.height)),0);c=l+G_(t.align,this.top,this.bottom-e-t.labels.padding-this._computeTitleHeight())}const u=G_(r,h,h+d);s.textAlign=o.textAlign(W_(r)),s.textBaseline="middle",s.strokeStyle=e.color,s.fillStyle=e.color,s.font=i.string,Mx(s,e.text,u,c,i)}_computeTitleHeight(){const t=this.options.title,e=Nx(t.font),i=Rx(t.padding);return t.display?e.lineHeight+i.height:0}_getLegendItemAt(t,e){let i,n,o;if(R_(t,this.left,this.right)&&R_(e,this.top,this.bottom))for(o=this.legendHitBoxes,i=0;i<o.length;++i)if(n=o[i],R_(t,n.left,n.left+n.width)&&R_(e,n.top,n.top+n.height))return this.legendItems[i];return null}handleEvent(t){const e=this.options;if(!function(t,e){if(("mousemove"===t||"mouseout"===t)&&(e.onHover||e.onLeave))return!0;if(e.onClick&&("click"===t||"mouseup"===t))return!0;return!1}(t.type,e))return;const i=this._getLegendItemAt(t.x,t.y);if("mousemove"===t.type||"mouseout"===t.type){const n=this._hoveredItem,o=((t,e)=>null!==t&&null!==e&&t.datasetIndex===e.datasetIndex&&t.index===e.index)(n,i);n&&!o&&Jb(e.onLeave,[t,n,this],this),this._hoveredItem=i,i&&!o&&Jb(e.onHover,[t,i,this],this)}else i&&Jb(e.onClick,[t,i,this],this)}}function LC(t,e){return e*(t.text?t.text.length:0)}var $C={id:"legend",_element:IC,start(t,e,i){const n=t.legend=new IC({ctx:t.ctx,options:i,chart:t});Ok.configure(t,n,i),Ok.addBox(t,n)},stop(t){Ok.removeBox(t,t.legend),delete t.legend},beforeUpdate(t,e,i){const n=t.legend;Ok.configure(t,n,i),n.options=i},afterUpdate(t){const e=t.legend;e.buildLabels(),e.adjustHitBoxes()},afterEvent(t,e){e.replay||t.legend.handleEvent(e.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(t,e,i){const n=e.datasetIndex,o=i.chart;o.isDatasetVisible(n)?(o.hide(n),e.hidden=!0):(o.show(n),e.hidden=!1)},onHover:null,onLeave:null,labels:{color:t=>t.chart.options.color,boxWidth:40,padding:10,generateLabels(t){const e=t.data.datasets,{labels:{usePointStyle:i,pointStyle:n,textAlign:o,color:s,useBorderRadius:r,borderRadius:a}}=t.legend.options;return t._getSortedDatasetMetas().map((t=>{const l=t.controller.getStyle(i?0:void 0),c=Rx(l.borderWidth);return{text:e[t.index].label,fillStyle:l.backgroundColor,fontColor:s,hidden:!t.visible,lineCap:l.borderCapStyle,lineDash:l.borderDash,lineDashOffset:l.borderDashOffset,lineJoin:l.borderJoinStyle,lineWidth:(c.width+c.height)/4,strokeStyle:l.borderColor,pointStyle:n||l.pointStyle,rotation:l.rotation,textAlign:o||l.textAlign,borderRadius:r&&(a||l.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 zC extends Yk{constructor(t){super(),this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e){const i=this.options;if(this.left=0,this.top=0,!i.display)return void(this.width=this.height=this.right=this.bottom=0);this.width=this.right=t,this.height=this.bottom=e;const n=Gb(i.text)?i.text.length:1;this._padding=Rx(i.padding);const o=n*Nx(i.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=o:this.width=o}isHorizontal(){const t=this.options.position;return"top"===t||"bottom"===t}_drawArgs(t){const{top:e,left:i,bottom:n,right:o,options:s}=this,r=s.align;let a,l,c,h=0;return this.isHorizontal()?(l=G_(r,i,o),c=e+t,a=o-i):("left"===s.position?(l=i+t,c=G_(r,n,e),h=-.5*m_):(l=o-t,c=G_(r,e,n),h=.5*m_),a=n-e),{titleX:l,titleY:c,maxWidth:a,rotation:h}}draw(){const t=this.ctx,e=this.options;if(!e.display)return;const i=Nx(e.font),n=i.lineHeight/2+this._padding.top,{titleX:o,titleY:s,maxWidth:r,rotation:a}=this._drawArgs(n);Mx(t,e.text,0,0,i,{color:e.color,maxWidth:r,rotation:a,textAlign:W_(e.align),textBaseline:"middle",translation:[o,s]})}}var RC={id:"title",_element:zC,start(t,e,i){!function(t,e){const i=new zC({ctx:t.ctx,options:e,chart:t});Ok.configure(t,i,e),Ok.addBox(t,i),t.titleBlock=i}(t,i)},stop(t){const e=t.titleBlock;Ok.removeBox(t,e),delete t.titleBlock},beforeUpdate(t,e,i){const n=t.titleBlock;Ok.configure(t,n,i),n.options=i},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const NC=new WeakMap;var jC={id:"subtitle",start(t,e,i){const n=new zC({ctx:t.ctx,options:i,chart:t});Ok.configure(t,n,i),Ok.addBox(t,n),NC.set(t,n)},stop(t){Ok.removeBox(t,NC.get(t)),NC.delete(t)},beforeUpdate(t,e,i){const n=NC.get(t);Ok.configure(t,n,i),n.options=i},defaults:{align:"center",display:!1,font:{weight:"normal"},fullSize:!0,padding:0,position:"top",text:"",weight:1500},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const BC={average(t){if(!t.length)return!1;let e,i,n=new Set,o=0,s=0;for(e=0,i=t.length;e<i;++e){const i=t[e].element;if(i&&i.hasValue()){const t=i.tooltipPosition();n.add(t.x),o+=t.y,++s}}if(0===s||0===n.size)return!1;const r=[...n].reduce(((t,e)=>t+e))/n.size;return{x:r,y:o/s}},nearest(t,e){if(!t.length)return!1;let i,n,o,s=e.x,r=e.y,a=Number.POSITIVE_INFINITY;for(i=0,n=t.length;i<n;++i){const n=t[i].element;if(n&&n.hasValue()){const t=D_(e,n.getCenterPoint());t<a&&(a=t,o=n)}}if(o){const t=o.tooltipPosition();s=t.x,r=t.y}return{x:s,y:r}}};function FC(t,e){return e&&(Gb(e)?Array.prototype.push.apply(t,e):t.push(e)),t}function qC(t){return("string"==typeof t||t instanceof String)&&t.indexOf("\n")>-1?t.split("\n"):t}function VC(t,e){const{element:i,datasetIndex:n,index:o}=e,s=t.getDatasetMeta(n).controller,{label:r,value:a}=s.getLabelAndValue(o);return{chart:t,label:r,parsed:s.getParsed(o),raw:t.data.datasets[n].data[o],formattedValue:a,dataset:s.getDataset(),dataIndex:o,datasetIndex:n,element:i}}function HC(t,e){const i=t.chart.ctx,{body:n,footer:o,title:s}=t,{boxWidth:r,boxHeight:a}=e,l=Nx(e.bodyFont),c=Nx(e.titleFont),h=Nx(e.footerFont),d=s.length,u=o.length,p=n.length,m=Rx(e.padding);let f=m.height,g=0,v=n.reduce(((t,e)=>t+e.before.length+e.lines.length+e.after.length),0);if(v+=t.beforeBody.length+t.afterBody.length,d&&(f+=d*c.lineHeight+(d-1)*e.titleSpacing+e.titleMarginBottom),v){f+=p*(e.displayColors?Math.max(a,l.lineHeight):l.lineHeight)+(v-p)*l.lineHeight+(v-1)*e.bodySpacing}u&&(f+=e.footerMarginTop+u*h.lineHeight+(u-1)*e.footerSpacing);let y=0;const b=function(t){g=Math.max(g,i.measureText(t).width+y)};return i.save(),i.font=c.string,t_(t.title,b),i.font=l.string,t_(t.beforeBody.concat(t.afterBody),b),y=e.displayColors?r+2+e.boxPadding:0,t_(n,(t=>{t_(t.before,b),t_(t.lines,b),t_(t.after,b)})),y=0,i.font=h.string,t_(t.footer,b),i.restore(),g+=m.width,{width:g,height:f}}function UC(t,e,i,n){const{x:o,width:s}=i,{width:r,chartArea:{left:a,right:l}}=t;let c="center";return"center"===n?c=o<=(a+l)/2?"left":"right":o<=s/2?c="left":o>=r-s/2&&(c="right"),function(t,e,i,n){const{x:o,width:s}=n,r=i.caretSize+i.caretPadding;return"left"===t&&o+s+r>e.width||"right"===t&&o-s-r<0||void 0}(c,t,e,i)&&(c="center"),c}function WC(t,e,i){const n=i.yAlign||e.yAlign||function(t,e){const{y:i,height:n}=e;return i<n/2?"top":i>t.height-n/2?"bottom":"center"}(t,i);return{xAlign:i.xAlign||e.xAlign||UC(t,e,i,n),yAlign:n}}function GC(t,e,i,n){const{caretSize:o,caretPadding:s,cornerRadius:r}=t,{xAlign:a,yAlign:l}=i,c=o+s,{topLeft:h,topRight:d,bottomLeft:u,bottomRight:p}=zx(r);let m=function(t,e){let{x:i,width:n}=t;return"right"===e?i-=n:"center"===e&&(i-=n/2),i}(e,a);const f=function(t,e,i){let{y:n,height:o}=t;return"top"===e?n+=i:n-="bottom"===e?o+i:o/2,n}(e,l,c);return"center"===l?"left"===a?m+=c:"right"===a&&(m-=c):"left"===a?m-=Math.max(h,u)+o:"right"===a&&(m+=Math.max(d,p)+o),{x:z_(m,0,n.width-e.width),y:z_(f,0,n.height-e.height)}}function ZC(t,e,i){const n=Rx(i.padding);return"center"===e?t.x+t.width/2:"right"===e?t.x+t.width-n.right:t.x+n.left}function YC(t){return FC([],qC(t))}function XC(t,e){const i=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return i?t.override(i):t}const KC={beforeTitle:Hb,title(t){if(t.length>0){const e=t[0],i=e.chart.data.labels,n=i?i.length:0;if(this&&this.options&&"dataset"===this.options.mode)return e.dataset.label||"";if(e.label)return e.label;if(n>0&&e.dataIndex<n)return i[e.dataIndex]}return""},afterTitle:Hb,beforeBody:Hb,beforeLabel:Hb,label(t){if(this&&this.options&&"dataset"===this.options.mode)return t.label+": "+t.formattedValue||t.formattedValue;let e=t.dataset.label||"";e&&(e+=": ");const i=t.formattedValue;return Wb(i)||(e+=i),e},labelColor(t){const e=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{borderColor:e.borderColor,backgroundColor:e.backgroundColor,borderWidth:e.borderWidth,borderDash:e.borderDash,borderDashOffset:e.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(t){const e=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{pointStyle:e.pointStyle,rotation:e.rotation}},afterLabel:Hb,afterBody:Hb,beforeFooter:Hb,footer:Hb,afterFooter:Hb};function QC(t,e,i,n){const o=t[e].call(i,n);return void 0===o?KC[e].call(i,n):o}class JC extends Yk{static positioners=BC;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 e=this.chart,i=this.options.setContext(this.getContext()),n=i.enabled&&e.options.animation&&i.animations,o=new jw(this.chart,n);return n._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=(t=this.chart.getContext(),e=this,i=this._tooltipItems,Bx(t,{tooltip:e,tooltipItems:i,type:"tooltip"})));var t,e,i}getTitle(t,e){const{callbacks:i}=e,n=QC(i,"beforeTitle",this,t),o=QC(i,"title",this,t),s=QC(i,"afterTitle",this,t);let r=[];return r=FC(r,qC(n)),r=FC(r,qC(o)),r=FC(r,qC(s)),r}getBeforeBody(t,e){return YC(QC(e.callbacks,"beforeBody",this,t))}getBody(t,e){const{callbacks:i}=e,n=[];return t_(t,(t=>{const e={before:[],lines:[],after:[]},o=XC(i,t);FC(e.before,qC(QC(o,"beforeLabel",this,t))),FC(e.lines,QC(o,"label",this,t)),FC(e.after,qC(QC(o,"afterLabel",this,t))),n.push(e)})),n}getAfterBody(t,e){return YC(QC(e.callbacks,"afterBody",this,t))}getFooter(t,e){const{callbacks:i}=e,n=QC(i,"beforeFooter",this,t),o=QC(i,"footer",this,t),s=QC(i,"afterFooter",this,t);let r=[];return r=FC(r,qC(n)),r=FC(r,qC(o)),r=FC(r,qC(s)),r}_createItems(t){const e=this._active,i=this.chart.data,n=[],o=[],s=[];let r,a,l=[];for(r=0,a=e.length;r<a;++r)l.push(VC(this.chart,e[r]));return t.filter&&(l=l.filter(((e,n,o)=>t.filter(e,n,o,i)))),t.itemSort&&(l=l.sort(((e,n)=>t.itemSort(e,n,i)))),t_(l,(e=>{const i=XC(t.callbacks,e);n.push(QC(i,"labelColor",this,e)),o.push(QC(i,"labelPointStyle",this,e)),s.push(QC(i,"labelTextColor",this,e))})),this.labelColors=n,this.labelPointStyles=o,this.labelTextColors=s,this.dataPoints=l,l}update(t,e){const i=this.options.setContext(this.getContext()),n=this._active;let o,s=[];if(n.length){const t=BC[i.position].call(this,n,this._eventPosition);s=this._createItems(i),this.title=this.getTitle(s,i),this.beforeBody=this.getBeforeBody(s,i),this.body=this.getBody(s,i),this.afterBody=this.getAfterBody(s,i),this.footer=this.getFooter(s,i);const e=this._size=HC(this,i),r=Object.assign({},t,e),a=WC(this.chart,i,r),l=GC(i,r,a,this.chart);this.xAlign=a.xAlign,this.yAlign=a.yAlign,o={opacity:1,x:l.x,y:l.y,width:e.width,height:e.height,caretX:t.x,caretY:t.y}}else 0!==this.opacity&&(o={opacity:0});this._tooltipItems=s,this.$context=void 0,o&&this._resolveAnimations().update(this,o),t&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,i,n){const o=this.getCaretPosition(t,i,n);e.lineTo(o.x1,o.y1),e.lineTo(o.x2,o.y2),e.lineTo(o.x3,o.y3)}getCaretPosition(t,e,i){const{xAlign:n,yAlign:o}=this,{caretSize:s,cornerRadius:r}=i,{topLeft:a,topRight:l,bottomLeft:c,bottomRight:h}=zx(r),{x:d,y:u}=t,{width:p,height:m}=e;let f,g,v,y,b,_;return"center"===o?(b=u+m/2,"left"===n?(f=d,g=f-s,y=b+s,_=b-s):(f=d+p,g=f+s,y=b-s,_=b+s),v=f):(g="left"===n?d+Math.max(a,c)+s:"right"===n?d+p-Math.max(l,h)-s:this.caretX,"top"===o?(y=u,b=y-s,f=g-s,v=g+s):(y=u+m,b=y+s,f=g+s,v=g-s),_=y),{x1:f,x2:g,x3:v,y1:y,y2:b,y3:_}}drawTitle(t,e,i){const n=this.title,o=n.length;let s,r,a;if(o){const l=Sw(i.rtl,this.x,this.width);for(t.x=ZC(this,i.titleAlign,i),e.textAlign=l.textAlign(i.titleAlign),e.textBaseline="middle",s=Nx(i.titleFont),r=i.titleSpacing,e.fillStyle=i.titleColor,e.font=s.string,a=0;a<o;++a)e.fillText(n[a],l.x(t.x),t.y+s.lineHeight/2),t.y+=s.lineHeight+r,a+1===o&&(t.y+=i.titleMarginBottom-r)}}_drawColorBox(t,e,i,n,o){const s=this.labelColors[i],r=this.labelPointStyles[i],{boxHeight:a,boxWidth:l}=o,c=Nx(o.bodyFont),h=ZC(this,"left",o),d=n.x(h),u=a<c.lineHeight?(c.lineHeight-a)/2:0,p=e.y+u;if(o.usePointStyle){const e={radius:Math.min(l,a)/2,pointStyle:r.pointStyle,rotation:r.rotation,borderWidth:1},i=n.leftForLtr(d,l)+l/2,c=p+a/2;t.strokeStyle=o.multiKeyBackground,t.fillStyle=o.multiKeyBackground,bx(t,e,i,c),t.strokeStyle=s.borderColor,t.fillStyle=s.backgroundColor,bx(t,e,i,c)}else{t.lineWidth=Zb(s.borderWidth)?Math.max(...Object.values(s.borderWidth)):s.borderWidth||1,t.strokeStyle=s.borderColor,t.setLineDash(s.borderDash||[]),t.lineDashOffset=s.borderDashOffset||0;const e=n.leftForLtr(d,l),i=n.leftForLtr(n.xPlus(d,1),l-2),r=zx(s.borderRadius);Object.values(r).some((t=>0!==t))?(t.beginPath(),t.fillStyle=o.multiKeyBackground,Tx(t,{x:e,y:p,w:l,h:a,radius:r}),t.fill(),t.stroke(),t.fillStyle=s.backgroundColor,t.beginPath(),Tx(t,{x:i,y:p+1,w:l-2,h:a-2,radius:r}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(e,p,l,a),t.strokeRect(e,p,l,a),t.fillStyle=s.backgroundColor,t.fillRect(i,p+1,l-2,a-2))}t.fillStyle=this.labelTextColors[i]}drawBody(t,e,i){const{body:n}=this,{bodySpacing:o,bodyAlign:s,displayColors:r,boxHeight:a,boxWidth:l,boxPadding:c}=i,h=Nx(i.bodyFont);let d=h.lineHeight,u=0;const p=Sw(i.rtl,this.x,this.width),m=function(i){e.fillText(i,p.x(t.x+u),t.y+d/2),t.y+=d+o},f=p.textAlign(s);let g,v,y,b,_,x,w;for(e.textAlign=s,e.textBaseline="middle",e.font=h.string,t.x=ZC(this,f,i),e.fillStyle=i.bodyColor,t_(this.beforeBody,m),u=r&&"right"!==f?"center"===s?l/2+c:l+2+c:0,b=0,x=n.length;b<x;++b){for(g=n[b],v=this.labelTextColors[b],e.fillStyle=v,t_(g.before,m),y=g.lines,r&&y.length&&(this._drawColorBox(e,t,b,p,i),d=Math.max(h.lineHeight,a)),_=0,w=y.length;_<w;++_)m(y[_]),d=h.lineHeight;t_(g.after,m)}u=0,d=h.lineHeight,t_(this.afterBody,m),t.y-=o}drawFooter(t,e,i){const n=this.footer,o=n.length;let s,r;if(o){const a=Sw(i.rtl,this.x,this.width);for(t.x=ZC(this,i.footerAlign,i),t.y+=i.footerMarginTop,e.textAlign=a.textAlign(i.footerAlign),e.textBaseline="middle",s=Nx(i.footerFont),e.fillStyle=i.footerColor,e.font=s.string,r=0;r<o;++r)e.fillText(n[r],a.x(t.x),t.y+s.lineHeight/2),t.y+=s.lineHeight+i.footerSpacing}}drawBackground(t,e,i,n){const{xAlign:o,yAlign:s}=this,{x:r,y:a}=t,{width:l,height:c}=i,{topLeft:h,topRight:d,bottomLeft:u,bottomRight:p}=zx(n.cornerRadius);e.fillStyle=n.backgroundColor,e.strokeStyle=n.borderColor,e.lineWidth=n.borderWidth,e.beginPath(),e.moveTo(r+h,a),"top"===s&&this.drawCaret(t,e,i,n),e.lineTo(r+l-d,a),e.quadraticCurveTo(r+l,a,r+l,a+d),"center"===s&&"right"===o&&this.drawCaret(t,e,i,n),e.lineTo(r+l,a+c-p),e.quadraticCurveTo(r+l,a+c,r+l-p,a+c),"bottom"===s&&this.drawCaret(t,e,i,n),e.lineTo(r+u,a+c),e.quadraticCurveTo(r,a+c,r,a+c-u),"center"===s&&"left"===o&&this.drawCaret(t,e,i,n),e.lineTo(r,a+h),e.quadraticCurveTo(r,a,r+h,a),e.closePath(),e.fill(),n.borderWidth>0&&e.stroke()}_updateAnimationTarget(t){const e=this.chart,i=this.$animations,n=i&&i.x,o=i&&i.y;if(n||o){const i=BC[t.position].call(this,this._active,this._eventPosition);if(!i)return;const s=this._size=HC(this,t),r=Object.assign({},i,this._size),a=WC(e,t,r),l=GC(t,r,a,e);n._to===l.x&&o._to===l.y||(this.xAlign=a.xAlign,this.yAlign=a.yAlign,this.width=s.width,this.height=s.height,this.caretX=i.x,this.caretY=i.y,this._resolveAnimations().update(this,l))}}_willRender(){return!!this.opacity}draw(t){const e=this.options.setContext(this.getContext());let i=this.opacity;if(!i)return;this._updateAnimationTarget(e);const n={width:this.width,height:this.height},o={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;const s=Rx(e.padding),r=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&r&&(t.save(),t.globalAlpha=i,this.drawBackground(o,t,n,e),Cw(t,e.textDirection),o.y+=s.top,this.drawTitle(o,t,e),this.drawBody(o,t,e),this.drawFooter(o,t,e),Ew(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){const i=this._active,n=t.map((({datasetIndex:t,index:e})=>{const i=this.chart.getDatasetMeta(t);if(!i)throw new Error("Cannot find a dataset at index "+t);return{datasetIndex:t,element:i.data[e],index:e}})),o=!e_(i,n),s=this._positionChanged(n,e);(o||s)&&(this._active=n,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,i=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const n=this.options,o=this._active||[],s=this._getActiveElements(t,o,e,i),r=this._positionChanged(s,t),a=e||!e_(s,o)||r;return a&&(this._active=s,(n.enabled||n.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),a}_getActiveElements(t,e,i,n){const o=this.options;if("mouseout"===t.type)return[];if(!n)return e.filter((t=>this.chart.data.datasets[t.datasetIndex]&&void 0!==this.chart.getDatasetMeta(t.datasetIndex).controller.getParsed(t.index)));const s=this.chart.getElementsAtEventForMode(t,o.mode,o,i);return o.reverse&&s.reverse(),s}_positionChanged(t,e){const{caretX:i,caretY:n,options:o}=this,s=BC[o.position].call(this,t,e);return!1!==s&&(i!==s.x||n!==s.y)}}var tE={id:"tooltip",_element:JC,positioners:BC,afterInit(t,e,i){i&&(t.tooltip=new JC({chart:t,options:i}))},beforeUpdate(t,e,i){t.tooltip&&t.tooltip.initialize(i)},reset(t,e,i){t.tooltip&&t.tooltip.initialize(i)},afterDraw(t){const e=t.tooltip;if(e&&e._willRender()){const i={tooltip:e};if(!1===t.notifyPlugins("beforeTooltipDraw",{...i,cancelable:!0}))return;e.draw(t.ctx),t.notifyPlugins("afterTooltipDraw",i)}},afterEvent(t,e){if(t.tooltip){const i=e.replay;t.tooltip.handleEvent(e.event,i,e.inChartArea)&&(e.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(t,e)=>e.bodyFont.size,boxWidth:(t,e)=>e.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:KC},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"]},eE=Object.freeze({__proto__:null,Colors:dC,Decimation:mC,Filler:OC,Legend:$C,SubTitle:jC,Title:RC,Tooltip:tE});function iE(t,e,i,n){const o=t.indexOf(e);if(-1===o)return((t,e,i,n)=>("string"==typeof e?(i=t.push(e)-1,n.unshift({index:i,label:e})):isNaN(e)&&(i=null),i))(t,e,i,n);return o!==t.lastIndexOf(e)?i:o}function nE(t){const e=this.getLabels();return t>=0&&t<e.length?e[t]:t}function oE(t,e){const i=[],{bounds:n,step:o,min:s,max:r,precision:a,count:l,maxTicks:c,maxDigits:h,includeBounds:d}=t,u=o||1,p=c-1,{min:m,max:f}=e,g=!Wb(s),v=!Wb(r),y=!Wb(l),b=(f-m)/(h+1);let _,x,w,k,S=C_((f-m)/p/u)*u;if(S<1e-14&&!g&&!v)return[{value:m},{value:f}];k=Math.ceil(f/S)-Math.floor(m/S),k>p&&(S=C_(k*S/p/u)*u),Wb(a)||(_=Math.pow(10,a),S=Math.ceil(S*_)/_),"ticks"===n?(x=Math.floor(m/S)*S,w=Math.ceil(f/S)*S):(x=m,w=f),g&&v&&o&&function(t,e){const i=Math.round(t);return i-e<=t&&i+e>=t}((r-s)/o,S/1e3)?(k=Math.round(Math.min((r-s)/S,c)),S=(r-s)/k,x=s,w=r):y?(x=g?s:x,w=v?r:w,k=l-1,S=(w-x)/k):(k=(w-x)/S,k=S_(k,Math.round(k),S/1e3)?Math.round(k):Math.ceil(k));const C=Math.max(P_(S),P_(x));_=Math.pow(10,Wb(a)?C:a),x=Math.round(x*_)/_,w=Math.round(w*_)/_;let E=0;for(g&&(d&&x!==s?(i.push({value:s}),x<s&&E++,S_(Math.round((x+E*S)*_)/_,s,sE(s,b,t))&&E++):x<s&&E++);E<k;++E){const t=Math.round((x+E*S)*_)/_;if(v&&t>r)break;i.push({value:t})}return v&&d&&w!==r?i.length&&S_(i[i.length-1].value,r,sE(r,b,t))?i[i.length-1].value=r:i.push({value:r}):v&&w!==r||i.push({value:w}),i}function sE(t,e,{horizontal:i,minRotation:n}){const o=M_(n),s=(i?Math.sin(o):Math.cos(o))||.001,r=.75*e*(""+t).length;return Math.min(e/s,r)}class rE extends sS{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,e){return Wb(t)||("number"==typeof t||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:e,maxDefined:i}=this.getUserBounds();let{min:n,max:o}=this;const s=t=>n=e?n:t,r=t=>o=i?o:t;if(t){const t=k_(n),e=k_(o);t<0&&e<0?r(0):t>0&&e>0&&s(0)}if(n===o){let e=0===o?1:Math.abs(.05*o);r(o+e),t||s(n-e)}this.min=n,this.max=o}getTickLimit(){const t=this.options.ticks;let e,{maxTicksLimit:i,stepSize:n}=t;return n?(e=Math.ceil(this.max/n)-Math.floor(this.min/n)+1,e>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${n} would result generating up to ${e} ticks. Limiting to 1000.`),e=1e3)):(e=this.computeTickLimit(),i=i||11),i&&(e=Math.min(i,e)),e}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,e=t.ticks;let i=this.getTickLimit();i=Math.max(2,i);const n=oE({maxTicks:i,bounds:t.bounds,min:t.min,max:t.max,precision:e.precision,step:e.stepSize,count:e.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:e.minRotation||0,includeBounds:!1!==e.includeBounds},this._range||this);return"ticks"===t.bounds&&A_(n,this,"value"),t.reverse?(n.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),n}configure(){const t=this.ticks;let e=this.min,i=this.max;if(super.configure(),this.options.offset&&t.length){const n=(i-e)/Math.max(t.length-1,1)/2;e-=n,i+=n}this._startValue=e,this._endValue=i,this._valueRange=i-e}getLabelForValue(t){return rx(t,this.chart.options.locale,this.options.ticks.format)}}class aE extends rE{static id="linear";static defaults={ticks:{callback:lx.formatters.numeric}};determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=Yb(t)?t:0,this.max=Yb(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),e=t?this.width:this.height,i=M_(this.options.ticks.minRotation),n=(t?Math.sin(i):Math.cos(i))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(e/Math.min(40,o.lineHeight/n))}getPixelForValue(t){return null===t?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}const lE=t=>Math.floor(w_(t)),cE=(t,e)=>Math.pow(10,lE(t)+e);function hE(t){return 1===t/Math.pow(10,lE(t))}function dE(t,e,i){const n=Math.pow(10,i),o=Math.floor(t/n);return Math.ceil(e/n)-o}function uE(t,{min:e,max:i}){e=Xb(t.min,e);const n=[],o=lE(e);let s=function(t,e){let i=lE(e-t);for(;dE(t,e,i)>10;)i++;for(;dE(t,e,i)<10;)i--;return Math.min(i,lE(t))}(e,i),r=s<0?Math.pow(10,Math.abs(s)):1;const a=Math.pow(10,s),l=o>s?Math.pow(10,o):0,c=Math.round((e-l)*r)/r,h=Math.floor((e-l)/a/10)*a*10;let d=Math.floor((c-h)/Math.pow(10,s)),u=Xb(t.min,Math.round((l+h+d*Math.pow(10,s))*r)/r);for(;u<i;)n.push({value:u,major:hE(u),significand:d}),d>=10?d=d<15?15:20:d++,d>=20&&(s++,d=2,r=s>=0?1:r),u=Math.round((l+h+d*Math.pow(10,s))*r)/r;const p=Xb(t.max,u);return n.push({value:p,major:hE(p),significand:d}),n}class pE extends sS{static id="logarithmic";static defaults={ticks:{callback:lx.formatters.logarithmic,major:{enabled:!0}}};constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,e){const i=rE.prototype.parse.apply(this,[t,e]);if(0!==i)return Yb(i)&&i>0?i:null;this._zero=!0}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=Yb(t)?Math.max(0,t):null,this.max=Yb(e)?Math.max(0,e):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!Yb(this._userMin)&&(this.min=t===cE(this.min,0)?cE(this.min,-1):cE(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let i=this.min,n=this.max;const o=e=>i=t?i:e,s=t=>n=e?n:t;i===n&&(i<=0?(o(1),s(10)):(o(cE(i,-1)),s(cE(n,1)))),i<=0&&o(cE(n,-1)),n<=0&&s(cE(i,1)),this.min=i,this.max=n}buildTicks(){const t=this.options,e=uE({min:this._userMin,max:this._userMax},this);return"ticks"===t.bounds&&A_(e,this,"value"),t.reverse?(e.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),e}getLabelForValue(t){return void 0===t?"0":rx(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=w_(t),this._valueRange=w_(this.max)-w_(t)}getPixelForValue(t){return void 0!==t&&0!==t||(t=this.min),null===t||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(w_(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const e=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+e*this._valueRange)}}function mE(t){const e=t.ticks;if(e.display&&t.display){const t=Rx(e.backdropPadding);return Kb(e.font&&e.font.size,mx.font.size)+t.height}return 0}function fE(t,e,i,n,o){return t===n||t===o?{start:e-i/2,end:e+i/2}:t<n||t>o?{start:e-i,end:e}:{start:e,end:e+i}}function gE(t){const e={l:t.left+t._padding.left,r:t.right-t._padding.right,t:t.top+t._padding.top,b:t.bottom-t._padding.bottom},i=Object.assign({},e),n=[],o=[],s=t._pointLabels.length,r=t.options.pointLabels,a=r.centerPointLabels?m_/s:0;for(let d=0;d<s;d++){const s=r.setContext(t.getPointLabelContext(d));o[d]=s.padding;const u=t.getPointPosition(d,t.drawingArea+o[d],a),p=Nx(s.font),m=(l=t.ctx,c=p,h=Gb(h=t._pointLabels[d])?h:[h],{w:gx(l,c.string,h),h:h.length*c.lineHeight});n[d]=m;const f=L_(t.getIndexAngle(d)+a),g=Math.round(T_(f));vE(i,e,f,fE(g,u.x,m.w,0,180),fE(g,u.y,m.h,90,270))}var l,c,h;t.setCenterPoint(e.l-i.l,i.r-e.r,e.t-i.t,i.b-e.b),t._pointLabelItems=function(t,e,i){const n=[],o=t._pointLabels.length,s=t.options,{centerPointLabels:r,display:a}=s.pointLabels,l={extra:mE(s)/2,additionalAngle:r?m_/o:0};let c;for(let s=0;s<o;s++){l.padding=i[s],l.size=e[s];const o=yE(t,s,l);n.push(o),"auto"===a&&(o.visible=bE(o,c),o.visible&&(c=o))}return n}(t,n,o)}function vE(t,e,i,n,o){const s=Math.abs(Math.sin(i)),r=Math.abs(Math.cos(i));let a=0,l=0;n.start<e.l?(a=(e.l-n.start)/s,t.l=Math.min(t.l,e.l-a)):n.end>e.r&&(a=(n.end-e.r)/s,t.r=Math.max(t.r,e.r+a)),o.start<e.t?(l=(e.t-o.start)/r,t.t=Math.min(t.t,e.t-l)):o.end>e.b&&(l=(o.end-e.b)/r,t.b=Math.max(t.b,e.b+l))}function yE(t,e,i){const n=t.drawingArea,{extra:o,additionalAngle:s,padding:r,size:a}=i,l=t.getPointPosition(e,n+o+r,s),c=Math.round(T_(L_(l.angle+b_))),h=function(t,e,i){90===i||270===i?t-=e/2:(i>270||i<90)&&(t-=e);return t}(l.y,a.h,c),d=function(t){if(0===t||180===t)return"center";if(t<180)return"left";return"right"}(c),u=function(t,e,i){"right"===i?t-=e:"center"===i&&(t-=e/2);return t}(l.x,a.w,d);return{visible:!0,x:l.x,y:h,textAlign:d,left:u,top:h,right:u+a.w,bottom:h+a.h}}function bE(t,e){if(!e)return!0;const{left:i,top:n,right:o,bottom:s}=t;return!(xx({x:i,y:n},e)||xx({x:i,y:s},e)||xx({x:o,y:n},e)||xx({x:o,y:s},e))}function _E(t,e,i){const{left:n,top:o,right:s,bottom:r}=i,{backdropColor:a}=e;if(!Wb(a)){const i=zx(e.borderRadius),l=Rx(e.backdropPadding);t.fillStyle=a;const c=n-l.left,h=o-l.top,d=s-n+l.width,u=r-o+l.height;Object.values(i).some((t=>0!==t))?(t.beginPath(),Tx(t,{x:c,y:h,w:d,h:u,radius:i}),t.fill()):t.fillRect(c,h,d,u)}}function xE(t,e,i,n){const{ctx:o}=t;if(i)o.arc(t.xCenter,t.yCenter,e,0,f_);else{let i=t.getPointPosition(0,e);o.moveTo(i.x,i.y);for(let s=1;s<n;s++)i=t.getPointPosition(s,e),o.lineTo(i.x,i.y)}}class wE extends rE{static id="radialLinear";static defaults={display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:lx.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback:t=>t,padding:5,centerPointLabels:!1}};static defaultRoutes={"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"};static descriptors={angleLines:{_fallback:"grid"}};constructor(t){super(t),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){const t=this._padding=Rx(mE(this.options)/2),e=this.width=this.maxWidth-t.width,i=this.height=this.maxHeight-t.height;this.xCenter=Math.floor(this.left+e/2+t.left),this.yCenter=Math.floor(this.top+i/2+t.top),this.drawingArea=Math.floor(Math.min(e,i)/2)}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!1);this.min=Yb(t)&&!isNaN(t)?t:0,this.max=Yb(e)&&!isNaN(e)?e:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/mE(this.options))}generateTickLabels(t){rE.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map(((t,e)=>{const i=Jb(this.options.pointLabels.callback,[t,e],this);return i||0===i?i:""})).filter(((t,e)=>this.chart.getDataVisibility(e)))}fit(){const t=this.options;t.display&&t.pointLabels.display?gE(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,i,n){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((i-n)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,i,n))}getIndexAngle(t){return L_(t*(f_/(this._pointLabels.length||1))+M_(this.options.startAngle||0))}getDistanceFromCenterForValue(t){if(Wb(t))return NaN;const e=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*e:(t-this.min)*e}getValueForDistanceFromCenter(t){if(Wb(t))return NaN;const e=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-e:this.min+e}getPointLabelContext(t){const e=this._pointLabels||[];if(t>=0&&t<e.length){const i=e[t];return function(t,e,i){return Bx(t,{label:i,index:e,type:"pointLabel"})}(this.getContext(),t,i)}}getPointPosition(t,e,i=0){const n=this.getIndexAngle(t)-b_+i;return{x:Math.cos(n)*e+this.xCenter,y:Math.sin(n)*e+this.yCenter,angle:n}}getPointPositionForValue(t,e){return this.getPointPosition(t,this.getDistanceFromCenterForValue(e))}getBasePosition(t){return this.getPointPositionForValue(t||0,this.getBaseValue())}getPointLabelPosition(t){const{left:e,top:i,right:n,bottom:o}=this._pointLabelItems[t];return{left:e,top:i,right:n,bottom:o}}drawBackground(){const{backgroundColor:t,grid:{circular:e}}=this.options;if(t){const i=this.ctx;i.save(),i.beginPath(),xE(this,this.getDistanceFromCenterForValue(this._endValue),e,this._pointLabels.length),i.closePath(),i.fillStyle=t,i.fill(),i.restore()}}drawGrid(){const t=this.ctx,e=this.options,{angleLines:i,grid:n,border:o}=e,s=this._pointLabels.length;let r,a,l;if(e.pointLabels.display&&function(t,e){const{ctx:i,options:{pointLabels:n}}=t;for(let o=e-1;o>=0;o--){const e=t._pointLabelItems[o];if(!e.visible)continue;const s=n.setContext(t.getPointLabelContext(o));_E(i,s,e);const r=Nx(s.font),{x:a,y:l,textAlign:c}=e;Mx(i,t._pointLabels[o],a,l+r.lineHeight/2,r,{color:s.color,textAlign:c,textBaseline:"middle"})}}(this,s),n.display&&this.ticks.forEach(((t,e)=>{if(0!==e||0===e&&this.min<0){a=this.getDistanceFromCenterForValue(t.value);const i=this.getContext(e),r=n.setContext(i),l=o.setContext(i);!function(t,e,i,n,o){const s=t.ctx,r=e.circular,{color:a,lineWidth:l}=e;!r&&!n||!a||!l||i<0||(s.save(),s.strokeStyle=a,s.lineWidth=l,s.setLineDash(o.dash||[]),s.lineDashOffset=o.dashOffset,s.beginPath(),xE(t,i,r,n),s.closePath(),s.stroke(),s.restore())}(this,r,a,s,l)}})),i.display){for(t.save(),r=s-1;r>=0;r--){const n=i.setContext(this.getPointLabelContext(r)),{color:o,lineWidth:s}=n;s&&o&&(t.lineWidth=s,t.strokeStyle=o,t.setLineDash(n.borderDash),t.lineDashOffset=n.borderDashOffset,a=this.getDistanceFromCenterForValue(e.reverse?this.min:this.max),l=this.getPointPosition(r,a),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(l.x,l.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const t=this.ctx,e=this.options,i=e.ticks;if(!i.display)return;const n=this.getIndexAngle(0);let o,s;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(n),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach(((n,r)=>{if(0===r&&this.min>=0&&!e.reverse)return;const a=i.setContext(this.getContext(r)),l=Nx(a.font);if(o=this.getDistanceFromCenterForValue(this.ticks[r].value),a.showLabelBackdrop){t.font=l.string,s=t.measureText(n.label).width,t.fillStyle=a.backdropColor;const e=Rx(a.backdropPadding);t.fillRect(-s/2-e.left,-o-l.size/2-e.top,s+e.width,l.size+e.height)}Mx(t,n.label,0,-o,l,{color:a.color,strokeColor:a.textStrokeColor,strokeWidth:a.textStrokeWidth})})),t.restore()}drawTitle(){}}const kE={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},SE=Object.keys(kE);function CE(t,e){return t-e}function EE(t,e){if(Wb(e))return null;const i=t._adapter,{parser:n,round:o,isoWeekday:s}=t._parseOpts;let r=e;return"function"==typeof n&&(r=n(r)),Yb(r)||(r="string"==typeof n?i.parse(r,n):i.parse(r)),null===r?null:(o&&(r="week"!==o||!E_(s)&&!0!==s?i.startOf(r,o):i.startOf(r,"isoWeek",s)),+r)}function AE(t,e,i,n){const o=SE.length;for(let s=SE.indexOf(t);s<o-1;++s){const t=kE[SE[s]],o=t.steps?t.steps:Number.MAX_SAFE_INTEGER;if(t.common&&Math.ceil((i-e)/(o*t.size))<=n)return SE[s]}return SE[o-1]}function ME(t,e,i){if(i){if(i.length){const{lo:n,hi:o}=N_(i,e);t[i[n]>=e?i[n]:i[o]]=!0}}else t[e]=!0}function TE(t,e,i){const n=[],o={},s=e.length;let r,a;for(r=0;r<s;++r)a=e[r],o[a]=r,n.push({value:a,major:!1});return 0!==s&&i?function(t,e,i,n){const o=t._adapter,s=+o.startOf(e[0].value,n),r=e[e.length-1].value;let a,l;for(a=s;a<=r;a=+o.add(a,1,n))l=i[a],l>=0&&(e[l].major=!0);return e}(t,n,o,i):n}class PE extends sS{static id="time";static defaults={bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}};constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,e={}){const i=t.time||(t.time={}),n=this._adapter=new dk._date(t.adapters.date);n.init(e),r_(i.displayFormats,n.formats()),this._parseOpts={parser:i.parser,round:i.round,isoWeekday:i.isoWeekday},super.init(t),this._normalized=e.normalized}parse(t,e){return void 0===t?null:EE(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const t=this.options,e=this._adapter,i=t.time.unit||"day";let{min:n,max:o,minDefined:s,maxDefined:r}=this.getUserBounds();function a(t){s||isNaN(t.min)||(n=Math.min(n,t.min)),r||isNaN(t.max)||(o=Math.max(o,t.max))}s&&r||(a(this._getLabelBounds()),"ticks"===t.bounds&&"labels"===t.ticks.source||a(this.getMinMax(!1))),n=Yb(n)&&!isNaN(n)?n:+e.startOf(Date.now(),i),o=Yb(o)&&!isNaN(o)?o:+e.endOf(Date.now(),i)+1,this.min=Math.min(n,o-1),this.max=Math.max(n+1,o)}_getLabelBounds(){const t=this.getLabelTimestamps();let e=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;return t.length&&(e=t[0],i=t[t.length-1]),{min:e,max:i}}buildTicks(){const t=this.options,e=t.time,i=t.ticks,n="labels"===i.source?this.getLabelTimestamps():this._generate();"ticks"===t.bounds&&n.length&&(this.min=this._userMin||n[0],this.max=this._userMax||n[n.length-1]);const o=this.min,s=function(t,e,i){let n=0,o=t.length;for(;n<o&&t[n]<e;)n++;for(;o>n&&t[o-1]>i;)o--;return n>0||o<t.length?t.slice(n,o):t}(n,o,this.max);return this._unit=e.unit||(i.autoSkip?AE(e.minUnit,this.min,this.max,this._getLabelCapacity(o)):function(t,e,i,n,o){for(let s=SE.length-1;s>=SE.indexOf(i);s--){const i=SE[s];if(kE[i].common&&t._adapter.diff(o,n,i)>=e-1)return i}return SE[i?SE.indexOf(i):0]}(this,s.length,e.minUnit,this.min,this.max)),this._majorUnit=i.major.enabled&&"year"!==this._unit?function(t){for(let e=SE.indexOf(t)+1,i=SE.length;e<i;++e)if(kE[SE[e]].common)return SE[e]}(this._unit):void 0,this.initOffsets(n),t.reverse&&s.reverse(),TE(this,s,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map((t=>+t.value)))}initOffsets(t=[]){let e,i,n=0,o=0;this.options.offset&&t.length&&(e=this.getDecimalForValue(t[0]),n=1===t.length?1-e:(this.getDecimalForValue(t[1])-e)/2,i=this.getDecimalForValue(t[t.length-1]),o=1===t.length?i:(i-this.getDecimalForValue(t[t.length-2]))/2);const s=t.length<3?.5:.25;n=z_(n,0,s),o=z_(o,0,s),this._offsets={start:n,end:o,factor:1/(n+1+o)}}_generate(){const t=this._adapter,e=this.min,i=this.max,n=this.options,o=n.time,s=o.unit||AE(o.minUnit,e,i,this._getLabelCapacity(e)),r=Kb(n.ticks.stepSize,1),a="week"===s&&o.isoWeekday,l=E_(a)||!0===a,c={};let h,d,u=e;if(l&&(u=+t.startOf(u,"isoWeek",a)),u=+t.startOf(u,l?"day":s),t.diff(i,e,s)>1e5*r)throw new Error(e+" and "+i+" are too far apart with stepSize of "+r+" "+s);const p="data"===n.ticks.source&&this.getDataTimestamps();for(h=u,d=0;h<i;h=+t.add(h,r,s),d++)ME(c,h,p);return h!==i&&"ticks"!==n.bounds&&1!==d||ME(c,h,p),Object.keys(c).sort(CE).map((t=>+t))}getLabelForValue(t){const e=this._adapter,i=this.options.time;return i.tooltipFormat?e.format(t,i.tooltipFormat):e.format(t,i.displayFormats.datetime)}format(t,e){const i=this.options.time.displayFormats,n=this._unit,o=e||i[n];return this._adapter.format(t,o)}_tickFormatFunction(t,e,i,n){const o=this.options,s=o.ticks.callback;if(s)return Jb(s,[t,e,i],this);const r=o.time.displayFormats,a=this._unit,l=this._majorUnit,c=a&&r[a],h=l&&r[l],d=i[e],u=l&&h&&d&&d.major;return this._adapter.format(t,n||(u?h:c))}generateTickLabels(t){let e,i,n;for(e=0,i=t.length;e<i;++e)n=t[e],n.label=this._tickFormatFunction(n.value,e,t)}getDecimalForValue(t){return null===t?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){const e=this._offsets,i=this.getDecimalForValue(t);return this.getPixelForDecimal((e.start+i)*e.factor)}getValueForPixel(t){const e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return this.min+i*(this.max-this.min)}_getLabelSize(t){const e=this.options.ticks,i=this.ctx.measureText(t).width,n=M_(this.isHorizontal()?e.maxRotation:e.minRotation),o=Math.cos(n),s=Math.sin(n),r=this._resolveTickFontOptions(0).size;return{w:i*o+r*s,h:i*s+r*o}}_getLabelCapacity(t){const e=this.options.time,i=e.displayFormats,n=i[e.unit]||i.millisecond,o=this._tickFormatFunction(t,0,TE(this,[t],this._majorUnit),n),s=this._getLabelSize(o),r=Math.floor(this.isHorizontal()?this.width/s.w:this.height/s.h)-1;return r>0?r:1}getDataTimestamps(){let t,e,i=this._cache.data||[];if(i.length)return i;const n=this.getMatchingVisibleMetas();if(this._normalized&&n.length)return this._cache.data=n[0].controller.getAllParsedValues(this);for(t=0,e=n.length;t<e;++t)i=i.concat(n[t].controller.getAllParsedValues(this));return this._cache.data=this.normalize(i)}getLabelTimestamps(){const t=this._cache.labels||[];let e,i;if(t.length)return t;const n=this.getLabels();for(e=0,i=n.length;e<i;++e)t.push(EE(this,n[e]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return V_(t.sort(CE))}}function OE(t,e,i){let n,o,s,r,a=0,l=t.length-1;i?(e>=t[a].pos&&e<=t[l].pos&&({lo:a,hi:l}=j_(t,"pos",e)),({pos:n,time:s}=t[a]),({pos:o,time:r}=t[l])):(e>=t[a].time&&e<=t[l].time&&({lo:a,hi:l}=j_(t,"time",e)),({time:n,pos:s}=t[a]),({time:o,pos:r}=t[l]));const c=o-n;return c?s+(r-s)*(e-n)/c:s}var DE=Object.freeze({__proto__:null,CategoryScale:class extends sS{static id="category";static defaults={ticks:{callback:nE}};constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){const e=this._addedLabels;if(e.length){const t=this.getLabels();for(const{index:i,label:n}of e)t[i]===n&&t.splice(i,1);this._addedLabels=[]}super.init(t)}parse(t,e){if(Wb(t))return null;const i=this.getLabels();return((t,e)=>null===t?null:z_(Math.round(t),0,e))(e=isFinite(e)&&i[e]===t?e:iE(i,t,Kb(e,t),this._addedLabels),i.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let{min:i,max:n}=this.getMinMax(!0);"ticks"===this.options.bounds&&(t||(i=0),e||(n=this.getLabels().length-1)),this.min=i,this.max=n}buildTicks(){const t=this.min,e=this.max,i=this.options.offset,n=[];let o=this.getLabels();o=0===t&&e===o.length-1?o:o.slice(t,e+1),this._valueRange=Math.max(o.length-(i?0:1),1),this._startValue=this.min-(i?.5:0);for(let i=t;i<=e;i++)n.push({value:i});return n}getLabelForValue(t){return nE.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 e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}},LinearScale:aE,LogarithmicScale:pE,RadialLinearScale:wE,TimeScale:PE,TimeSeriesScale:class extends PE{static id="timeseries";static defaults=PE.defaults;constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),e=this._table=this.buildLookupTable(t);this._minPos=OE(e,this.min),this._tableRange=OE(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:e,max:i}=this,n=[],o=[];let s,r,a,l,c;for(s=0,r=t.length;s<r;++s)l=t[s],l>=e&&l<=i&&n.push(l);if(n.length<2)return[{time:e,pos:0},{time:i,pos:1}];for(s=0,r=n.length;s<r;++s)c=n[s+1],a=n[s-1],l=n[s],Math.round((c+a)/2)!==l&&o.push({time:l,pos:s/(r-1)});return o}_generate(){const t=this.min,e=this.max;let i=super.getDataTimestamps();return i.includes(t)&&i.length||i.splice(0,0,t),i.includes(e)&&1!==i.length||i.push(e),i.sort(((t,e)=>t-e))}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const e=this.getDataTimestamps(),i=this.getLabelTimestamps();return t=e.length&&i.length?this.normalize(e.concat(i)):e.length?e:i,t=this._cache.all=t,t}getDecimalForValue(t){return(OE(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return OE(this._table,i*this._tableRange+this._minPos,!0)}}});const IE=[lk,oC,eE,DE];zS.register(...IE);
8537
8524
  /*!
8538
8525
  * chartjs-adapter-luxon v1.3.1
8539
8526
  * https://www.chartjs.org
8540
8527
  * (c) 2023 chartjs-adapter-luxon Contributors
8541
8528
  * Released under the MIT license
8542
8529
  */
8543
- const $E={datetime:Zs.DATETIME_MED_WITH_SECONDS,millisecond:"h:mm:ss.SSS a",second:Zs.TIME_WITH_SECONDS,minute:Zs.TIME_SIMPLE,hour:{hour:"numeric"},day:{day:"numeric",month:"short"},week:"DD",month:{month:"short",year:"numeric"},quarter:"'Q'q - yyyy",year:{year:"numeric"}};uk._date.override({_id:"luxon",_create:function(t){return Zs.fromMillis(t,this.options)},init(t){this.options.locale||(this.options.locale=t.locale)},formats:function(){return $E},parse:function(t,e){const i=this.options,n=typeof t;return null===t||"undefined"===n?null:("number"===n?t=this._create(t):"string"===n?t="string"==typeof e?Zs.fromFormat(t,e,i):Zs.fromISO(t,i):t instanceof Date?t=Zs.fromJSDate(t,i):"object"!==n||t instanceof Zs||(t=Zs.fromObject(t,i)),t.isValid?t.valueOf():null)},format:function(t,e){const i=this._create(t);return"string"==typeof e?i.toFormat(e):i.toLocaleString(e)},add:function(t,e,i){const n={};return n[i]=e,this._create(t).plus(n).valueOf()},diff:function(t,e,i){return this._create(t).diff(this._create(e)).as(i).valueOf()},startOf:function(t,e,i){if("isoWeek"===e){i=Math.trunc(Math.min(Math.max(0,i),6));const e=this._create(t);return e.minus({days:(e.weekday-i+7)%7}).startOf("day").valueOf()}return e?this._create(t).startOf(e).valueOf():t},endOf:function(t,e){return this._create(t).endOf(e).valueOf()}});const zE=["rgba(255, 159, 64, 0.2)","rgba(75, 192, 192, 0.2)","rgba(54, 162, 235, 0.2)","rgba(153, 102, 255, 0.2)","rgba(255, 205, 86, 0.2)","rgba(255, 99, 132, 0.2)","rgba(201, 203, 207, 0.2)"],RE=["rgb(255, 159, 64)","rgb(75, 192, 192)","rgb(54, 162, 235)","rgb(153, 102, 255)","rgb(255, 205, 86)","rgb(255, 99, 132)","rgb(201, 203, 207)"];class NE extends fe{static get styles(){return a`
8530
+ const LE={datetime:Zs.DATETIME_MED_WITH_SECONDS,millisecond:"h:mm:ss.SSS a",second:Zs.TIME_WITH_SECONDS,minute:Zs.TIME_SIMPLE,hour:{hour:"numeric"},day:{day:"numeric",month:"short"},week:"DD",month:{month:"short",year:"numeric"},quarter:"'Q'q - yyyy",year:{year:"numeric"}};dk._date.override({_id:"luxon",_create:function(t){return Zs.fromMillis(t,this.options)},init(t){this.options.locale||(this.options.locale=t.locale)},formats:function(){return LE},parse:function(t,e){const i=this.options,n=typeof t;return null===t||"undefined"===n?null:("number"===n?t=this._create(t):"string"===n?t="string"==typeof e?Zs.fromFormat(t,e,i):Zs.fromISO(t,i):t instanceof Date?t=Zs.fromJSDate(t,i):"object"!==n||t instanceof Zs||(t=Zs.fromObject(t,i)),t.isValid?t.valueOf():null)},format:function(t,e){const i=this._create(t);return"string"==typeof e?i.toFormat(e):i.toLocaleString(e)},add:function(t,e,i){const n={};return n[i]=e,this._create(t).plus(n).valueOf()},diff:function(t,e,i){return this._create(t).diff(this._create(e)).as(i).valueOf()},startOf:function(t,e,i){if("isoWeek"===e){i=Math.trunc(Math.min(Math.max(0,i),6));const e=this._create(t);return e.minus({days:(e.weekday-i+7)%7}).startOf("day").valueOf()}return e?this._create(t).startOf(e).valueOf():t},endOf:function(t,e){return this._create(t).endOf(e).valueOf()}});const $E=["rgba(54, 162, 235, 0.2)","rgba(255, 159, 64, 0.2)","rgba(75, 192, 192, 0.2)","rgba(153, 102, 255, 0.2)","rgba(255, 205, 86, 0.2)","rgba(255, 99, 132, 0.2)"],zE=["rgb(54, 162, 235)","rgb(255, 159, 64)","rgb(75, 192, 192)","rgb(153, 102, 255)","rgb(255, 205, 86)","rgb(255, 99, 132)"];function RE(t){if(0===t)return"0s";const e=Math.floor(t/86400),i=t%86400,n=Math.floor(i/3600),o=i%3600,s=Math.floor(o/60),r=o%60,a=[];return e>0&&a.push(`${e}d`),n>0&&a.push(`${n}h`),s>0&&a.length<2&&a.push(`${s}m`),r>0&&a.length<2&&a.push(`${r}s`),a.slice(0,2).join(" ")}class NE extends fe{static get styles(){return a`
8544
8531
  .chart-title {
8545
8532
  font-size: 1.2em;
8546
8533
  font-weight: 600;
@@ -8584,7 +8571,7 @@ const $E={datetime:Zs.DATETIME_MED_WITH_SECONDS,millisecond:"h:mm:ss.SSS a",seco
8584
8571
  background: rgba(0, 0, 0, 0.02);
8585
8572
  border: 1px solid rgba(0, 0, 0, 0.09);
8586
8573
  }
8587
- `}constructor(){super(),this.chartType="bar",this.header="",this.other=!1,this.datasets=[],this.maxSplits=2,this.splits=[],this.dataname="Counts",this.config=!1,this.showConfig=!1}firstUpdated(t){super.firstUpdated(t);const e=this.shadowRoot.querySelector("#canvas-wrapper");this.canvas=document.createElement("canvas"),this.canvas.setAttribute("height","300px"),e.appendChild(this.canvas),this.ctx=this.canvas.getContext("2d")}updated(t){if(super.updated(t),(t.has("data")||t.has("splits"))&&this.calculateSplits(),t.has("datasets")&&this.updateChart(),t.has("url")){_a().getUrl(this.url).then((t=>{this.data=t.json.data}))}}calculateSplits(){if(this.data){const t=[],e=[];for(const i of this.data.datasets)if(void 0===this.splits.find((t=>t===i.label)))for(let t=0;t<i.data.length;t++)void 0===e[t]?e[t]=i.data[t]:e[t]+=i.data[t];else t.push({...i,backgroundColor:zE[t.length%zE.length],borderColor:RE[t.length%RE.length],borderWidth:1});0===t.length?t.push({label:`All ${this.dataname}`,data:e,backgroundColor:"rgba(54, 162, 235, 0.2)",borderColor:"rgb(54, 162, 235)",borderWidth:1}):t.push({label:"Other",data:e,backgroundColor:"rgba(201, 203, 207, 0.2)",borderColor:"rgb(201, 203, 207)",borderWidth:1}),this.datasets=t}}updateChart(){var t;if((null===(t=this.datasets)||void 0===t?void 0:t.length)>0)if(this.chart)this.chart.data.labels=this.data.labels,this.chart.data.datasets=this.datasets,this.chart.update();else{const t={type:this.chartType,data:{labels:this.data.labels,datasets:this.datasets},options:{responsive:!0,maintainAspectRatio:!1,animation:{x:{from:500},y:{from:500}},animations:{tension:{duration:1e3,easing:"linear",from:1,to:0,loop:!0}},scales:{y:{min:0,stacked:!0},x:{type:"time",time:{unit:"day",tooltipFormat:"DDD",displayFormats:{day:"MMM dd"}},grid:{display:!1},stacked:!0}}}};this.chart=new RS(this.ctx,t)}}handleSplitsChanged(t){const e=t.target;this.splits=e.values.map((t=>t.value))}handleToggleConfig(){this.showConfig=!this.showConfig,this.showConfig||(this.splits=[])}render(){var t,e,i;return U`<div>
8574
+ `}constructor(){super(),this.chartType="bar",this.header="",this.other=!1,this.datasets=[],this.maxSplits=2,this.splits=[],this.dataname="Counts",this.single=!1,this.legend=!1,this.config=!1,this.formatDuration=!1,this.colorIndex=0,this.showConfig=!1}firstUpdated(t){super.firstUpdated(t);const e=this.shadowRoot.querySelector("#canvas-wrapper");this.canvas=document.createElement("canvas"),this.canvas.setAttribute("height","300px"),e.appendChild(this.canvas),this.ctx=this.canvas.getContext("2d")}updated(t){if(super.updated(t),(t.has("data")||t.has("splits"))&&this.calculateSplits(),t.has("datasets")&&this.updateChart(),t.has("url")){_a().getUrl(this.url).then((t=>{this.data=t.json.data}))}}calculateSplits(){if(this.data){const t=[],e=[];for(const i of this.data.datasets)if(void 0===this.splits.find((t=>t===i.label)))for(let t=0;t<i.data.length;t++)void 0===e[t]?e[t]=i.data[t]:e[t]+=i.data[t];else t.push({...i,backgroundColor:$E[(t.length+this.colorIndex)%$E.length],borderColor:zE[(t.length+this.colorIndex)%zE.length],borderWidth:1});0===t.length?t.push({label:this.single?this.dataname:`All ${this.dataname}`,data:e,backgroundColor:$E[this.colorIndex%$E.length],borderColor:zE[this.colorIndex%zE.length],borderWidth:1}):t.push({label:"Other",data:e,backgroundColor:"rgba(201, 203, 207, 0.2)",borderColor:"rgb(201, 203, 207)",borderWidth:1}),this.datasets=t}}updateChart(){var t;if((null===(t=this.datasets)||void 0===t?void 0:t.length)>0)if(this.chart)this.chart.data.labels=this.data.labels,this.chart.data.datasets=this.datasets,this.chart.update();else{const t={type:this.chartType,data:{labels:this.data.labels,datasets:this.datasets},options:{plugins:{legend:{display:this.legend},...this.formatDuration&&{tooltip:{callbacks:{label:t=>`${t.dataset.label||""}: ${RE(t.parsed.y)}`}}}},responsive:!0,maintainAspectRatio:!1,animation:{x:{from:500},y:{from:500}},animations:{tension:{duration:1e3,easing:"linear",from:1,to:0,loop:!0}},scales:{y:{min:0,stacked:!0,...this.formatDuration&&{ticks:{callback:t=>RE(t)}}},x:{type:"time",time:{unit:"day",tooltipFormat:"DDD",displayFormats:{day:"MMM dd"}},grid:{display:!1},stacked:!0}}}};this.chart=new zS(this.ctx,t)}}handleSplitsChanged(t){const e=t.target;this.splits=e.values.map((t=>t.value))}handleToggleConfig(){this.showConfig=!this.showConfig,this.showConfig||(this.splits=[])}render(){var t,e,i;return U`<div>
8588
8575
  ${this.header?U`<div class="chart-title">${this.header}</div>`:null}
8589
8576
  <div id="canvas-wrapper"></div>
8590
8577
  ${this.config&&this.data?U`
@@ -8616,7 +8603,7 @@ const $E={datetime:Zs.DATETIME_MED_WITH_SECONDS,millisecond:"h:mm:ss.SSS a",seco
8616
8603
  </temba-select>
8617
8604
  <div></div>
8618
8605
  </div>
8619
- </div>`}}function jE(t,e){window.customElements.get(t)||window.customElements.define(t,e)}t([de({type:String})],NE.prototype,"chartType",void 0),t([de({type:String})],NE.prototype,"url",void 0),t([de({type:String})],NE.prototype,"header",void 0),t([de({type:Boolean})],NE.prototype,"other",void 0),t([de({type:Object})],NE.prototype,"data",void 0),t([ue()],NE.prototype,"datasets",void 0),t([de({type:Number})],NE.prototype,"maxSplits",void 0),t([ue()],NE.prototype,"splits",void 0),t([de({type:String})],NE.prototype,"dataname",void 0),t([de({type:Boolean})],NE.prototype,"config",void 0),t([ue()],NE.prototype,"showConfig",void 0),jE("temba-anchor",_h),jE("temba-alert",ch),jE("temba-store",xa),jE("temba-textinput",De),jE("temba-datepicker",jh),jE("temba-date",Zh),jE("temba-completion",dc),jE("temba-checkbox",ye),jE("temba-select",hc),jE("temba-options",wa),jE("temba-loading",yc),jE("temba-lightbox",Xh),jE("temba-button",gc),jE("temba-omnibox",mh),jE("temba-tip",vh),jE("temba-contact-name",Ch),jE("temba-contact-name-fetch",Nh),jE("temba-contact-field",Th),jE("temba-contact-fields",Ah),jE("temba-field-manager",qh),jE("temba-urn",Eh),jE("temba-content-menu",Wh),jE("temba-field",vc),jE("temba-dialog",mc),jE("temba-modax",fc),jE("temba-charcount",Ac),jE("temba-contact-chat",oh),jE("temba-contact-details",class extends Pc{static get styles(){return a`
8606
+ </div>`}}function jE(t,e){window.customElements.get(t)||window.customElements.define(t,e)}t([de({type:String})],NE.prototype,"chartType",void 0),t([de({type:String})],NE.prototype,"url",void 0),t([de({type:String})],NE.prototype,"header",void 0),t([de({type:Boolean})],NE.prototype,"other",void 0),t([de({type:Object})],NE.prototype,"data",void 0),t([ue()],NE.prototype,"datasets",void 0),t([de({type:Number})],NE.prototype,"maxSplits",void 0),t([ue()],NE.prototype,"splits",void 0),t([de({type:String})],NE.prototype,"dataname",void 0),t([de({type:Boolean})],NE.prototype,"single",void 0),t([de({type:Boolean})],NE.prototype,"legend",void 0),t([de({type:Boolean})],NE.prototype,"config",void 0),t([de({type:Boolean})],NE.prototype,"formatDuration",void 0),t([de({type:Number})],NE.prototype,"colorIndex",void 0),t([ue()],NE.prototype,"showConfig",void 0),jE("temba-anchor",_h),jE("temba-alert",ch),jE("temba-store",xa),jE("temba-textinput",De),jE("temba-datepicker",jh),jE("temba-date",Zh),jE("temba-completion",dc),jE("temba-checkbox",ye),jE("temba-select",hc),jE("temba-options",wa),jE("temba-loading",yc),jE("temba-lightbox",Xh),jE("temba-button",gc),jE("temba-omnibox",mh),jE("temba-tip",vh),jE("temba-contact-name",Ch),jE("temba-contact-name-fetch",Nh),jE("temba-contact-field",Th),jE("temba-contact-fields",Ah),jE("temba-field-manager",qh),jE("temba-urn",Eh),jE("temba-content-menu",Wh),jE("temba-field",vc),jE("temba-dialog",mc),jE("temba-modax",fc),jE("temba-charcount",Ac),jE("temba-contact-chat",oh),jE("temba-contact-details",class extends Pc{static get styles(){return a`
8620
8607
  .urn {
8621
8608
  display: flex;
8622
8609
  padding: 0.4em 1em 0.8em 1em;
@@ -8735,7 +8722,7 @@ const $E={datetime:Zs.DATETIME_MED_WITH_SECONDS,millisecond:"h:mm:ss.SSS a",seco
8735
8722
  </div>`}}renderHeader(){return U`<div class="header">
8736
8723
  <temba-icon name="notification"></temba-icon>
8737
8724
  <div class="title">Notifications</div>
8738
- </div>`}scrollToTop(){window.setTimeout((()=>{this.shadowRoot.querySelector("temba-options").scrollToTop()}),1e3)}}),jE("temba-list",sh),jE("temba-sortable-list",Vh),jE("temba-run-list",zh),jE("temba-flow-details",Rh),jE("temba-label",Sh),jE("temba-menu",bh),jE("temba-contact-search",hh),jE("temba-icon",dh),jE("temba-dropdown",xh),jE("temba-tabs",wh),jE("temba-tab",kh),jE("temba-contact-badges",Oh),jE("temba-contact-pending",Ih),jE("temba-slider",Lh),jE("temba-content-menu",Wh),jE("temba-compose",Yh),jE("temba-color-picker",Kh),jE("temba-resizer",Qh),jE("temba-thumbnail",ed),jE("temba-webchat",od),jE("temba-image-picker",rd),jE("temba-mask",ad),jE("temba-user",kr),jE("temba-template-editor",ld),jE("temba-toast",vd),jE("temba-chat",Nc),jE("temba-media-picker",bd),jE("temba-flow-editor",nb),jE("temba-flow-node",ib),jE("temba-contact-notepad",ob),jE("temba-outbox-monitor",sb),jE("temba-progress",rb),jE("temba-start-progress",ab),jE("temba-shortcuts",lb),jE("temba-popup-select",cb),jE("temba-user-select",hb),jE("temba-workspace-select",db),jE("temba-chart",NE);class BE extends ct{static get styles(){return a`
8725
+ </div>`}scrollToTop(){window.setTimeout((()=>{this.shadowRoot.querySelector("temba-options").scrollToTop()}),1e3)}}),jE("temba-list",sh),jE("temba-sortable-list",Vh),jE("temba-run-list",zh),jE("temba-flow-details",Rh),jE("temba-label",Sh),jE("temba-menu",bh),jE("temba-contact-search",hh),jE("temba-icon",dh),jE("temba-dropdown",xh),jE("temba-tabs",wh),jE("temba-tab",kh),jE("temba-contact-badges",Oh),jE("temba-contact-pending",Ih),jE("temba-slider",Lh),jE("temba-content-menu",Wh),jE("temba-compose",Yh),jE("temba-color-picker",Kh),jE("temba-resizer",Qh),jE("temba-thumbnail",ed),jE("temba-webchat",od),jE("temba-image-picker",rd),jE("temba-mask",ad),jE("temba-user",kr),jE("temba-template-editor",ld),jE("temba-toast",vd),jE("temba-chat",Nc),jE("temba-media-picker",bd),jE("temba-flow-editor",nb),jE("temba-flow-node",ib),jE("temba-contact-notepad",ob),jE("temba-progress",sb),jE("temba-start-progress",rb),jE("temba-shortcuts",ab),jE("temba-popup-select",lb),jE("temba-user-select",cb),jE("temba-workspace-select",hb),jE("temba-chart",NE);class BE extends ct{static get styles(){return a`
8739
8726
  :host {
8740
8727
  line-height: normal;
8741
8728
  }