unleash-server 7.0.2 → 7.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (227) hide show
  1. package/dist/lib/addons/slack-app-definition.js +6 -6
  2. package/dist/lib/addons/slack-app-definition.js.map +1 -1
  3. package/dist/lib/addons/slack-definition.js +2 -2
  4. package/dist/lib/addons/slack-definition.js.map +1 -1
  5. package/dist/lib/create-config.d.ts.map +1 -1
  6. package/dist/lib/create-config.js +3 -0
  7. package/dist/lib/create-config.js.map +1 -1
  8. package/dist/lib/db/client-instance-store.d.ts +0 -5
  9. package/dist/lib/db/client-instance-store.d.ts.map +1 -1
  10. package/dist/lib/db/client-instance-store.js +0 -21
  11. package/dist/lib/db/client-instance-store.js.map +1 -1
  12. package/dist/lib/db/event-store.d.ts +1 -1
  13. package/dist/lib/db/event-store.d.ts.map +1 -1
  14. package/dist/lib/db/event-store.js +1 -1
  15. package/dist/lib/db/event-store.js.map +1 -1
  16. package/dist/lib/db/index.js +1 -1
  17. package/dist/lib/db/index.js.map +1 -1
  18. package/dist/lib/db/transaction.d.ts +5 -1
  19. package/dist/lib/db/transaction.d.ts.map +1 -1
  20. package/dist/lib/db/transaction.js +10 -4
  21. package/dist/lib/db/transaction.js.map +1 -1
  22. package/dist/lib/db/transaction.test.d.ts +2 -0
  23. package/dist/lib/db/transaction.test.d.ts.map +1 -0
  24. package/dist/lib/db/transaction.test.js +161 -0
  25. package/dist/lib/db/transaction.test.js.map +1 -0
  26. package/dist/lib/events/index.d.ts +4 -1
  27. package/dist/lib/events/index.d.ts.map +1 -1
  28. package/dist/lib/events/index.js +2 -0
  29. package/dist/lib/events/index.js.map +1 -1
  30. package/dist/lib/features/client-feature-toggles/delta/createClientFeatureToggleDelta.js +1 -1
  31. package/dist/lib/features/client-feature-toggles/delta/createClientFeatureToggleDelta.js.map +1 -1
  32. package/dist/lib/features/events/createEventsService.js +1 -1
  33. package/dist/lib/features/events/createEventsService.js.map +1 -1
  34. package/dist/lib/features/events/event-created-by-migration.test.js +1 -1
  35. package/dist/lib/features/events/event-created-by-migration.test.js.map +1 -1
  36. package/dist/lib/features/events/event-service.d.ts.map +1 -1
  37. package/dist/lib/features/events/event-service.js +6 -1
  38. package/dist/lib/features/events/event-service.js.map +1 -1
  39. package/dist/lib/features/events/event-store.d.ts +3 -1
  40. package/dist/lib/features/events/event-store.d.ts.map +1 -1
  41. package/dist/lib/features/events/event-store.js +10 -3
  42. package/dist/lib/features/events/event-store.js.map +1 -1
  43. package/dist/lib/features/events/event-store.test.js +1 -1
  44. package/dist/lib/features/events/event-store.test.js.map +1 -1
  45. package/dist/lib/features/feature-lifecycle/createFeatureLifecycle.js +1 -1
  46. package/dist/lib/features/feature-lifecycle/createFeatureLifecycle.js.map +1 -1
  47. package/dist/lib/features/feature-links/feature-link-service.d.ts +2 -1
  48. package/dist/lib/features/feature-links/feature-link-service.d.ts.map +1 -1
  49. package/dist/lib/features/feature-links/feature-link-service.js +4 -1
  50. package/dist/lib/features/feature-links/feature-link-service.js.map +1 -1
  51. package/dist/lib/features/feature-links/feature-link-service.test.js +11 -0
  52. package/dist/lib/features/feature-links/feature-link-service.test.js.map +1 -1
  53. package/dist/lib/features/feature-links/feature-link.e2e.test.js +1 -7
  54. package/dist/lib/features/feature-links/feature-link.e2e.test.js.map +1 -1
  55. package/dist/lib/features/feature-toggle/feature-toggle-controller.d.ts.map +1 -1
  56. package/dist/lib/features/feature-toggle/feature-toggle-controller.js +0 -8
  57. package/dist/lib/features/feature-toggle/feature-toggle-controller.js.map +1 -1
  58. package/dist/lib/features/instance-stats/createInstanceStatsService.js +1 -1
  59. package/dist/lib/features/instance-stats/createInstanceStatsService.js.map +1 -1
  60. package/dist/lib/features/metrics/client-metrics/metrics-service-v2.d.ts +3 -0
  61. package/dist/lib/features/metrics/client-metrics/metrics-service-v2.d.ts.map +1 -1
  62. package/dist/lib/features/metrics/client-metrics/metrics-service-v2.js +21 -18
  63. package/dist/lib/features/metrics/client-metrics/metrics-service-v2.js.map +1 -1
  64. package/dist/lib/features/metrics/impact/define-impact-metrics.d.ts +7 -0
  65. package/dist/lib/features/metrics/impact/define-impact-metrics.d.ts.map +1 -0
  66. package/dist/lib/features/metrics/impact/define-impact-metrics.js +11 -0
  67. package/dist/lib/features/metrics/impact/define-impact-metrics.js.map +1 -0
  68. package/dist/lib/features/metrics/impact/impact-metrics.e2e.test.d.ts +2 -0
  69. package/dist/lib/features/metrics/impact/impact-metrics.e2e.test.d.ts.map +1 -0
  70. package/dist/lib/features/metrics/impact/impact-metrics.e2e.test.js +131 -0
  71. package/dist/lib/features/metrics/impact/impact-metrics.e2e.test.js.map +1 -0
  72. package/dist/lib/features/metrics/impact/metrics-translator.d.ts +2 -3
  73. package/dist/lib/features/metrics/impact/metrics-translator.d.ts.map +1 -1
  74. package/dist/lib/features/metrics/instance/instance-service.d.ts.map +1 -1
  75. package/dist/lib/features/metrics/instance/instance-service.js +6 -16
  76. package/dist/lib/features/metrics/instance/instance-service.js.map +1 -1
  77. package/dist/lib/features/metrics/instance/metrics.d.ts +2 -0
  78. package/dist/lib/features/metrics/instance/metrics.d.ts.map +1 -1
  79. package/dist/lib/features/metrics/instance/metrics.js +15 -4
  80. package/dist/lib/features/metrics/instance/metrics.js.map +1 -1
  81. package/dist/lib/features/metrics/shared/schema.d.ts +3 -0
  82. package/dist/lib/features/metrics/shared/schema.d.ts.map +1 -1
  83. package/dist/lib/features/metrics/shared/schema.js +23 -0
  84. package/dist/lib/features/metrics/shared/schema.js.map +1 -1
  85. package/dist/lib/features/personal-dashboard/createPersonalDashboardService.js +1 -1
  86. package/dist/lib/features/personal-dashboard/createPersonalDashboardService.js.map +1 -1
  87. package/dist/lib/features/private-project/privateProjectStore.d.ts.map +1 -1
  88. package/dist/lib/features/private-project/privateProjectStore.js +10 -0
  89. package/dist/lib/features/private-project/privateProjectStore.js.map +1 -1
  90. package/dist/lib/features/project/createProjectService.js +1 -1
  91. package/dist/lib/features/project/createProjectService.js.map +1 -1
  92. package/dist/lib/features/project-status/createProjectStatusService.js +1 -1
  93. package/dist/lib/features/project-status/createProjectStatusService.js.map +1 -1
  94. package/dist/lib/features/scheduler/schedule-services.js +2 -2
  95. package/dist/lib/features/scheduler/schedule-services.js.map +1 -1
  96. package/dist/lib/metrics.d.ts.map +1 -1
  97. package/dist/lib/metrics.js +2 -0
  98. package/dist/lib/metrics.js.map +1 -1
  99. package/dist/lib/middleware/request-logger.d.ts.map +1 -1
  100. package/dist/lib/middleware/request-logger.js +8 -0
  101. package/dist/lib/middleware/request-logger.js.map +1 -1
  102. package/dist/lib/openapi/spec/addon-type-schema.d.ts +4 -4
  103. package/dist/lib/openapi/spec/addon-type-schema.js +4 -4
  104. package/dist/lib/openapi/spec/addon-type-schema.js.map +1 -1
  105. package/dist/lib/openapi/spec/addons-schema.d.ts +4 -4
  106. package/dist/lib/openapi/spec/bulk-metrics-schema.d.ts +61 -0
  107. package/dist/lib/openapi/spec/bulk-metrics-schema.d.ts.map +1 -1
  108. package/dist/lib/openapi/spec/bulk-metrics-schema.js +9 -0
  109. package/dist/lib/openapi/spec/bulk-metrics-schema.js.map +1 -1
  110. package/dist/lib/openapi/spec/event-schema.d.ts +11 -1
  111. package/dist/lib/openapi/spec/event-schema.d.ts.map +1 -1
  112. package/dist/lib/openapi/spec/event-schema.js +10 -0
  113. package/dist/lib/openapi/spec/event-schema.js.map +1 -1
  114. package/dist/lib/openapi/spec/event-search-query-parameters.d.ts +18 -0
  115. package/dist/lib/openapi/spec/event-search-query-parameters.d.ts.map +1 -1
  116. package/dist/lib/openapi/spec/event-search-query-parameters.js +20 -0
  117. package/dist/lib/openapi/spec/event-search-query-parameters.js.map +1 -1
  118. package/dist/lib/openapi/spec/event-search-response-schema.d.ts +11 -1
  119. package/dist/lib/openapi/spec/event-search-response-schema.d.ts.map +1 -1
  120. package/dist/lib/openapi/spec/events-schema.d.ts +11 -1
  121. package/dist/lib/openapi/spec/events-schema.d.ts.map +1 -1
  122. package/dist/lib/openapi/spec/feature-events-schema.d.ts +11 -1
  123. package/dist/lib/openapi/spec/feature-events-schema.d.ts.map +1 -1
  124. package/dist/lib/openapi/spec/impact-metrics-schema.d.ts +57 -0
  125. package/dist/lib/openapi/spec/impact-metrics-schema.d.ts.map +1 -0
  126. package/dist/lib/openapi/spec/impact-metrics-schema.js +55 -0
  127. package/dist/lib/openapi/spec/impact-metrics-schema.js.map +1 -0
  128. package/dist/lib/openapi/spec/index.d.ts +1 -0
  129. package/dist/lib/openapi/spec/index.d.ts.map +1 -1
  130. package/dist/lib/openapi/spec/index.js +1 -0
  131. package/dist/lib/openapi/spec/index.js.map +1 -1
  132. package/dist/lib/openapi/spec/integration-event-schema.d.ts +11 -1
  133. package/dist/lib/openapi/spec/integration-event-schema.d.ts.map +1 -1
  134. package/dist/lib/openapi/spec/integration-events-schema.d.ts +22 -2
  135. package/dist/lib/openapi/spec/integration-events-schema.d.ts.map +1 -1
  136. package/dist/lib/server-impl.d.ts +1 -1
  137. package/dist/lib/server-impl.d.ts.map +1 -1
  138. package/dist/lib/server-impl.js +21 -14
  139. package/dist/lib/server-impl.js.map +1 -1
  140. package/dist/lib/services/email-service.d.ts +7 -0
  141. package/dist/lib/services/email-service.d.ts.map +1 -1
  142. package/dist/lib/services/email-service.js +35 -0
  143. package/dist/lib/services/email-service.js.map +1 -1
  144. package/dist/lib/types/experimental.d.ts +9 -1
  145. package/dist/lib/types/experimental.d.ts.map +1 -1
  146. package/dist/lib/types/experimental.js +3 -2
  147. package/dist/lib/types/experimental.js.map +1 -1
  148. package/dist/lib/types/option.d.ts +2 -0
  149. package/dist/lib/types/option.d.ts.map +1 -1
  150. package/dist/lib/types/stores/client-instance-store.d.ts +0 -5
  151. package/dist/lib/types/stores/client-instance-store.d.ts.map +1 -1
  152. package/dist/lib/types/stores/event-store.d.ts +3 -0
  153. package/dist/lib/types/stores/event-store.d.ts.map +1 -1
  154. package/dist/lib/util/flag-resolver.d.ts +2 -1
  155. package/dist/lib/util/flag-resolver.d.ts.map +1 -1
  156. package/dist/lib/util/flag-resolver.js +3 -0
  157. package/dist/lib/util/flag-resolver.js.map +1 -1
  158. package/dist/mailtemplates/requested-cr-approval/requested-cr-approval.html.mustache +39 -0
  159. package/dist/mailtemplates/requested-cr-approval/requested-cr-approval.plain.mustache +3 -0
  160. package/dist/migrations/20250618090103-create-cr-requested-approvals.d.ts +6 -0
  161. package/dist/migrations/20250618090103-create-cr-requested-approvals.d.ts.map +1 -0
  162. package/dist/migrations/20250618090103-create-cr-requested-approvals.js +19 -0
  163. package/dist/migrations/20250618090103-create-cr-requested-approvals.js.map +1 -0
  164. package/dist/migrations/20250623100820-cr-requested-approvals-add-notified-at-column.d.ts +3 -0
  165. package/dist/migrations/20250623100820-cr-requested-approvals-add-notified-at-column.d.ts.map +1 -0
  166. package/dist/migrations/20250623100820-cr-requested-approvals-add-notified-at-column.js +11 -0
  167. package/dist/migrations/20250623100820-cr-requested-approvals-add-notified-at-column.js.map +1 -0
  168. package/dist/migrations/20250630114145-add-transaction-context-to-events.d.ts +3 -0
  169. package/dist/migrations/20250630114145-add-transaction-context-to-events.d.ts.map +1 -0
  170. package/dist/migrations/20250630114145-add-transaction-context-to-events.js +16 -0
  171. package/dist/migrations/20250630114145-add-transaction-context-to-events.js.map +1 -0
  172. package/dist/migrator.d.ts +1 -0
  173. package/dist/migrator.d.ts.map +1 -1
  174. package/dist/migrator.js +17 -0
  175. package/dist/migrator.js.map +1 -1
  176. package/dist/server-dev.js +4 -0
  177. package/dist/server-dev.js.map +1 -1
  178. package/dist/test/e2e/api/admin/event-search.e2e.test.js +175 -0
  179. package/dist/test/e2e/api/admin/event-search.e2e.test.js.map +1 -1
  180. package/dist/test/e2e/stores/event-store.e2e.test.js +224 -0
  181. package/dist/test/e2e/stores/event-store.e2e.test.js.map +1 -1
  182. package/dist/test/fixtures/fake-client-instance-store.d.ts +0 -1
  183. package/dist/test/fixtures/fake-client-instance-store.d.ts.map +1 -1
  184. package/dist/test/fixtures/fake-client-instance-store.js +0 -3
  185. package/dist/test/fixtures/fake-client-instance-store.js.map +1 -1
  186. package/dist/test/fixtures/fake-impact-metrics.d.ts +15 -0
  187. package/dist/test/fixtures/fake-impact-metrics.d.ts.map +1 -0
  188. package/dist/test/fixtures/fake-impact-metrics.js +27 -0
  189. package/dist/test/fixtures/fake-impact-metrics.js.map +1 -0
  190. package/frontend/build/index.html +1 -1
  191. package/frontend/build/static/AdvancedPlayground-D-6uZDZr.js +3 -0
  192. package/frontend/build/static/BackendConnections-C-DXtgIJ.js +1 -0
  193. package/frontend/build/static/{CreateProject-9XUQN1SU.js → CreateProject-C8ofwZq1.js} +1 -1
  194. package/frontend/build/static/FeatureMetricsChart-uzxl5gXR.js +2 -0
  195. package/frontend/build/static/{FeatureStaleDialog-Q5amMPCM.js → FeatureStaleDialog-BKCmTzFV.js} +2 -2
  196. package/frontend/build/static/FeatureViewLazyExport-CobGy6XS.js +10 -0
  197. package/frontend/build/static/{FlagMetricsChart-d-DcBEd3.js → FlagMetricsChart-VYTYbbQS.js} +2 -2
  198. package/frontend/build/static/FrontendNetworkTrafficUsage-CFIzAiX3.js +1 -0
  199. package/frontend/build/static/{LazyAdminExport-6l0-2zFb.js → LazyAdminExport-CRoU3u-1.js} +12 -12
  200. package/frontend/build/static/{LazyProjectExport-CPe5in4-.js → LazyProjectExport-DwhYVXhl.js} +35 -35
  201. package/frontend/build/static/{LifecycleChartComponent-B2yYCoKI.js → LifecycleChartComponent-CqpS04x5.js} +2 -2
  202. package/frontend/build/static/{LineChartComponent-D27zBmU-.js → LineChartComponent-B4SCTZZg.js} +1 -1
  203. package/frontend/build/static/MarkCompletedDialogue-BKJahqUx.js +1 -0
  204. package/frontend/build/static/{NetworkConnectedEdges-1WVw8Eu8.js → NetworkConnectedEdges-Ki1G9nG8.js} +1 -1
  205. package/frontend/build/static/{NetworkOverview-CVDK-eSI.js → NetworkOverview-CDZIrvNW.js} +1 -1
  206. package/frontend/build/static/{NetworkPrometheusAPIWarning-DmpG0G0j.js → NetworkPrometheusAPIWarning-DPJmw0yM.js} +1 -1
  207. package/frontend/build/static/{NetworkTraffic-CyPjdgMv.js → NetworkTraffic-Sq_m8XpD.js} +1 -1
  208. package/frontend/build/static/{NetworkTrafficUsage-C8VwLm0h.js → NetworkTrafficUsage-D8jRHO10.js} +1 -1
  209. package/frontend/build/static/{ReactJSONEditor-DseXcTHD.js → ReactJSONEditor-BCSMMPUN.js} +32 -32
  210. package/frontend/build/static/RoleCell-ndjYcZ1T.js +1 -0
  211. package/frontend/build/static/{aggregateFeatureMetrics-COQ_COHJ.js → aggregateFeatureMetrics-CFI2n6i7.js} +1 -1
  212. package/frontend/build/static/{formatTickValue-D_CAvIVf.js → formatTickValue-D9avlj7O.js} +2 -2
  213. package/frontend/build/static/{index-CKXZ0XnY.js → index-Bj8wwcOa.js} +10 -10
  214. package/frontend/build/static/index-DvDCZTAu.js +538 -0
  215. package/frontend/build/static/useApiTokens-BZGgHseg.js +1 -0
  216. package/frontend/build/static/{useChartDataSelection-BfTrFKbU.js → useChartDataSelection-OwfBPL7x.js} +1 -1
  217. package/frontend/package.json +10 -10
  218. package/package.json +13 -13
  219. package/frontend/build/static/AdvancedPlayground-BoqY20Mb.js +0 -3
  220. package/frontend/build/static/BackendConnections-BspEzNo_.js +0 -1
  221. package/frontend/build/static/FeatureMetricsChart-LENYZ5kx.js +0 -2
  222. package/frontend/build/static/FeatureViewLazyExport-BU9aw-MC.js +0 -10
  223. package/frontend/build/static/FrontendNetworkTrafficUsage-7YK-sjpZ.js +0 -1
  224. package/frontend/build/static/MarkCompletedDialogue-SyWeA6AL.js +0 -1
  225. package/frontend/build/static/RoleCell-DJbKzxr1.js +0 -4
  226. package/frontend/build/static/index-Yy9_7TKN.js +0 -535
  227. package/frontend/build/static/useApiTokens-DE54gK5i.js +0 -1
@@ -0,0 +1 @@
1
+ import{s as c,bc as T,e as D,j as e,V as L,y as H,D as $,fF as I,B as f,du as z,al as se,dd as ne,ao as oe,C as b,az as re,ap as ae,ay as G,c0 as P,bt as ie,ew as le,bh as ce,iM as de,L as q,em as ue,ak as A,g4 as S,r as d,en as w,av as he,G as pe,H as xe,aj as W,fl as me,an as E,ec as je,eF as ge,ac as k,ad as fe,cB as V,b3 as ye,aY as Y,h as be,w as Te,aT as Ce,i as ke,aA as J,iN as N,hG as Ae,dJ as ve,dI as we,T as R,dZ as Ee,F as Ne,f7 as Ie,dW as Se,f8 as Re,gJ as De,ch as Le,b9 as Q,bb as X,ba as Pe,b8 as _e,b4 as Be,dS as Fe}from"./index-DvDCZTAu.js";import{u as Oe}from"./useApiTokens-BZGgHseg.js";const Ue=c("div")(({theme:t})=>({display:"grid",gridTemplateColumns:"auto auto 1fr",gridAutoRows:"min-content",alignItems:"center",gap:t.spacing(1),marginTop:t.spacing(1.5)})),g=f,Me=()=>{const{uiConfig:t}=T(),{setToastData:s}=D(),n=a=>()=>{z(a),s({type:"success",text:"Copied to clipboard"})},o=`${t.unleashUrl}/api/`,r=`${t.unleashUrl}/api/frontend/`;return e.jsxs(L,{severity:"info",children:[e.jsxs("p",{children:["Read the"," ",e.jsx("a",{href:"https://docs.getunleash.io/reference/sdks",target:"_blank",rel:"noreferrer",children:"SDK overview"})," ","to connect Unleash to your application. Please note it can take up to ",e.jsx("strong",{children:"1 minute"})," before a new API key is activated."]}),e.jsxs(Ue,{children:[e.jsx(g,{children:e.jsx("strong",{children:"CLIENT API URL: "})}),e.jsx(g,{children:e.jsx("pre",{style:{display:"inline"},children:o})}),e.jsx(g,{children:e.jsx(H,{title:"Copy URL",arrow:!0,children:e.jsx($,{onClick:n(o),size:"small",children:e.jsx(I,{})})})}),e.jsx(g,{children:e.jsx("strong",{children:"FRONTEND API URL: "})}),e.jsx(g,{children:e.jsx("pre",{style:{display:"inline"},children:r})}),e.jsx(g,{children:e.jsx(H,{title:"Copy URL",arrow:!0,children:e.jsx($,{onClick:n(r),size:"small",children:e.jsx(I,{})})})})]})]})},He=["Icon","createdAt","seenAt"],$e=["Icon","project","seenAt"],ft=({compact:t=!1,setHiddenColumns:s,columns:n,loading:o,rows:r,headerGroups:a,globalFilter:i,prepareRow:x})=>{const u=se(ne.breakpoints.down("xl"));return oe([{condition:u,columns:He},{condition:t,columns:$e}],s,n),e.jsxs(e.Fragment,{children:[e.jsx(b,{condition:r.length>0,show:e.jsx(f,{sx:{mb:4},children:e.jsx(Me,{})})}),e.jsx(f,{sx:{overflowX:"auto"},children:e.jsx(re,{value:i,children:e.jsx(ae,{rows:r,headerGroups:a,prepareRow:x})})}),e.jsx(b,{condition:r.length===0&&!o,show:e.jsx(b,{condition:(i==null?void 0:i.length)>0,show:e.jsxs(G,{children:["No tokens found matching “",i,"”"]}),elseShow:e.jsx(G,{children:e.jsxs("span",{children:["No tokens available. Read ",e.jsx(P,{href:"https://docs.getunleash.io/how-to/api",target:"_blank",rel:"noreferrer",children:"API How-to guides"})," "," to learn more."]})})})})]})},Ge=(t,s)=>{const n=s>=t;return{limitReached:n,limitMessage:n?`You have reached the limit of ${t} API tokens`:void 0}},yt=({path:t,permission:s,project:n})=>{const o=ie(),{tokens:r,loading:a}=Oe(),{uiConfig:i}=T(),{limitReached:x,limitMessage:u}=Ge(i.resourceLimits.apiTokens,r.length);return e.jsx(le,{Icon:ce,onClick:()=>o(t),"data-testid":de,permission:s,projectId:n,maxWidth:"700px",disabled:a||x,tooltipProps:{title:u},children:"New API token"})},We=c(q)(({theme:t})=>({textDecoration:"none",color:t.palette.links,"&:hover, &:focus":{textDecoration:"underline"}})),Ke=c("div")({display:"flex",alignItems:"center"}),ze=({projects:t,project:s})=>{const{searchQuery:n}=ue(),o=t&&Array.isArray(t)&&t.length>1?t:[];if(o.length>0)return e.jsx(A,{children:e.jsx(S,{title:o.map((r,a)=>e.jsxs(d.Fragment,{children:[a>0&&", ",!r||r==="*"?e.jsx(w,{search:n,children:"*"}):e.jsx(We,{to:`/projects/${r}`,children:e.jsx(w,{search:n,children:r})})]},r)),placement:"bottom-start",arrow:!0,tabIndex:0,children:e.jsxs("span",{children:[`${o.length}`," projects"]})})});if(o.length===1&&o[0]!=="*"||s&&s!=="*"){const r=s||o[0];return e.jsx(he,{to:`/projects/${r}`,title:r})}return e.jsx(A,{children:e.jsx(S,{title:"ALL current and future projects.",placement:"bottom",arrow:!0,children:e.jsx(Ke,{children:e.jsx(w,{search:n,children:"*"})})})})};var _={},qe=xe;Object.defineProperty(_,"__esModule",{value:!0});var Z=_.default=void 0,Ve=qe(pe()),Ye=e,Je=(0,Ve.default)((0,Ye.jsx)("path",{d:"M21 10h-8.35C11.83 7.67 9.61 6 7 6c-3.31 0-6 2.69-6 6s2.69 6 6 6c2.61 0 4.83-1.67 5.65-4H13l2 2 2-2 2 2 4-4.04L21 10zM7 15c-1.65 0-3-1.35-3-3s1.35-3 3-3 3 1.35 3 3-1.35 3-3 3z"}),"Key");Z=_.default=Je;const Qe=({secret:t,project:s,projects:n})=>{const o=t!=null&&t.includes(":")?"v2":"v1",r=t==null?void 0:t.startsWith("*:"),a=n&&(n==null?void 0:n.length)>1||(n==null?void 0:n.length)===1&&n[0]!=="*"||s&&s!=="*";return o==="v2"&&!r&&!a},Xe=({...t})=>Qe(t)?e.jsx(W,{icon:e.jsx(S,{title:e.jsxs("p",{children:["This is an orphaned token. All of its original projects have been deleted and it now has access to all current and future projects. You should stop using this token and delete it. Read more in"," ",e.jsx(P,{target:"_blank",rel:"noopener noreferrer",href:"https://github.com/Unleash/unleash/releases/tag/v6.1.0",children:"release notes"}),"."]}),placement:"bottom-start",arrow:!0,children:e.jsx(me,{"aria-label":"Orphaned token",color:"warning","data-testid":"orphaned-token-icon"})})}):e.jsx(W,{icon:e.jsx(Z,{color:"disabled"})}),bt=(t,s)=>{const n=d.useMemo(()=>({sortBy:[{id:"createdAt",desc:!0}]}),[]),o=d.useMemo(()=>[{id:"Icon",Cell:h=>e.jsx(Xe,{secret:h.row.original.secret,project:h.row.original.project,projects:h.row.original.projects}),disableSortBy:!0,disableGlobalFilter:!0,width:50},{Header:"Token name",accessor:"tokenName",Cell:E,minWidth:35},{Header:"Type",accessor:"type",Cell:({value:h})=>e.jsx(E,{value:K[h.toLowerCase()].label,subtitle:K[h.toLowerCase()].title,subtitleTooltip:!0}),width:180},{Header:"Project",accessor:"project",Cell:h=>e.jsx(ze,{project:h.row.original.project,projects:h.row.original.projects}),width:160},{Header:"Environment",accessor:"environment",Cell:E,width:120},{Header:"Created",accessor:"createdAt",Cell:je,width:150,disableGlobalFilter:!0},{Header:"Last seen",accessor:"seenAt",Cell:ge,width:140,disableGlobalFilter:!0},{Header:"Actions",width:120,id:"Actions",align:"center",disableSortBy:!0,disableGlobalFilter:!0,Cell:s}],[]),{getTableProps:r,getTableBodyProps:a,headerGroups:i,rows:x,prepareRow:u,state:j,setGlobalFilter:m,setHiddenColumns:y}=k.useTable({columns:o,data:t,initialState:n,sortTypes:fe,autoResetHiddenColumns:!1,disableSortRemove:!0},k.useGlobalFilter,k.useSortBy,k.useFlexLayout);return{getTableProps:r,getTableBodyProps:a,headerGroups:i,rows:x,prepareRow:u,state:j,setGlobalFilter:m,setHiddenColumns:y,columns:o}},K={client:{label:"CLIENT",title:"Connect server-side SDK or Unleash Proxy/Edge"},frontend:{label:"FRONTEND",title:"Connect web and mobile SDK"},admin:{label:"ADMIN",title:"Full access for managing Unleash"}},Tt=({token:t,project:s,permission:n,track:o})=>{const{setToastData:r}=D(),a=i=>{z(i)&&(r({type:"success",text:"Token copied to clipboard"}),o&&typeof o=="function"&&o())};return e.jsx(V,{permission:n,projectId:s,tooltipProps:{title:"Copy token",arrow:!0},onClick:()=>a(t.secret),size:"large",children:e.jsx(I,{})})},Ze=c("ul")({marginBottom:0}),Ct=({token:t,permission:s,onRemove:n,project:o})=>{const[r,a]=d.useState(!1),{setToastData:i,setToastApiError:x}=D(),u=async()=>{try{await n(),a(!1),i({type:"success",text:"API token removed"})}catch(j){x(be(j))}};return e.jsxs(e.Fragment,{children:[e.jsx(V,{permission:s,projectId:o,tooltipProps:{title:"Delete token",arrow:!0},onClick:()=>a(!0),size:"large",children:e.jsx(ye,{})}),e.jsx(Y,{open:r,onClick:u,onClose:()=>a(!1),title:"Confirm deletion",children:e.jsxs("div",{children:["Are you sure you want to delete the following API token?",e.jsx("br",{}),e.jsxs(Ze,{children:[e.jsxs("li",{children:[e.jsx("strong",{children:"name"}),":"," ",e.jsx("code",{children:t.tokenName})]}),e.jsxs("li",{children:[e.jsx("strong",{children:"type"}),": ",e.jsx("code",{children:t.type})]}),e.jsxs("li",{children:[e.jsx("strong",{children:"environment"}),":"," ",e.jsx("code",{children:t.environment})]})]})]})})]})},et=c("div")(()=>({maxWidth:"400px"})),tt=c("form")(()=>({display:"flex",flexDirection:"column",height:"100%"})),st=c(Te)(({theme:t})=>({width:"100%",marginBottom:t.spacing(2)})),nt=c(Ce)(({theme:t})=>({marginBottom:t.spacing(2),minWidth:"400px",[t.breakpoints.down("sm")]:{minWidth:"379px"}})),ee=c("p")(({theme:t})=>({marginBottom:t.spacing(1)})),ot=c("label")(({theme:t})=>({marginBottom:t.spacing(1)})),rt=c(ke)(({theme:t})=>({marginLeft:t.spacing(3)})),at=c(f)({marginTop:"auto",display:"flex",justifyContent:"flex-end"}),kt=({children:t,actions:s,handleSubmit:n,handleCancel:o})=>{var i;const{uiConfig:r}=T(),a=!!((i=r==null?void 0:r.flags)!=null&&i.UNLEASH_CLOUD);return e.jsxs(tt,{onSubmit:n,children:[e.jsx(b,{condition:a,show:e.jsxs(L,{severity:"info",sx:{mb:4},children:["Please be aware of our"," ",e.jsx(P,{href:"https://www.getunleash.io/fair-use-policy",children:"fair use policy"}),"."]})}),t,e.jsxs(at,{children:[s,e.jsx(rt,{onClick:o,children:"Cancel"})]})]})};var p=(t=>(t.ADMIN="ADMIN",t.CLIENT="CLIENT",t.FRONTEND="FRONTEND",t))(p||{});const At=t=>{var O,U;const{environments:s}=J(),n=(O=s==null?void 0:s.find(l=>l.enabled))==null?void 0:O.name,o=N(Ae,t),r=[{key:p.CLIENT,label:`Server-side SDK (${p.CLIENT})`,title:"Connect server-side SDK or Unleash Proxy/Edge",enabled:N(ve)||o},{key:p.FRONTEND,label:`Client-side SDK (${p.FRONTEND})`,title:"Connect web and mobile SDK directly to Unleash",enabled:N(we)||o}],a=(U=r.find(l=>l.enabled))==null?void 0:U.key,[i,x]=d.useState(""),[u,j]=d.useState(a||p.CLIENT),[m,y]=d.useState([t||"*"]),[h,te]=d.useState(m),[B,C]=d.useState(),[F,v]=d.useState({});return d.useEffect(()=>{C(u==="ADMIN"?"*":n)},[u,n]),{tokenName:i,type:u,apiTokenTypes:r,projects:m,environment:B,setTokenName:x,setTokenType:l=>{l==="ADMIN"?(j(p.ADMIN),te(m),y(["*"]),C("*")):(j(l),y(h),C(n))},setProjects:y,setEnvironment:C,getApiTokenPayload:()=>({tokenName:i,type:u,environment:B,projects:m}),isValid:()=>{const l={};return i||(l.tokenName="Token name is required"),m.length===0&&(l.projects="At least one project is required"),v(l),Object.keys(l).length===0},clearErrors:l=>{if(l){const M={...F};delete M[l],v(M)}else v({})},errors:F}},vt=({open:t,setOpen:s,closeConfirm:n,token:o,type:r})=>e.jsxs(Y,{open:t,setOpen:s,onClick:n,primaryButtonText:"Close",title:"New token created",children:[e.jsx(R,{variant:"body1",children:"Your new token has been created successfully."}),e.jsx(Ee,{token:o}),e.jsx(b,{condition:r===p.FRONTEND,show:e.jsxs(L,{sx:{mt:2},severity:"info",children:["By default, all ",p.FRONTEND," tokens may be used from any CORS origin. If you'd like to configure a strict set of origins, please use the"," ",e.jsx(q,{to:"/admin/cors",target:"_blank",rel:"noreferrer",children:"CORS origins configuration page"}),"."]})})]}),wt=({tokenName:t,setTokenName:s,errors:n,clearErrors:o})=>e.jsxs(e.Fragment,{children:[e.jsx(ee,{children:"What would you like to call this token?"}),e.jsx(st,{value:t,name:"tokenName",onChange:r=>s(r.target.value),label:"Token name",error:n.tokenName!==void 0,errorText:n.tokenName,onFocus:()=>o("tokenName"),autoFocus:!0})]}),Et=({type:t,setType:s,apiTokenTypes:n})=>e.jsx(et,{children:e.jsxs(Ne,{sx:{mb:2,width:"100%"},children:[e.jsx(ot,{id:"token-type",children:"What do you want to connect?"}),e.jsx(Ie,{"aria-labelledby":"token-type",defaultValue:"CLIENT",name:"radio-buttons-group",value:t,onChange:(o,r)=>s(r),children:n.map(({key:o,label:r,title:a,enabled:i})=>e.jsx(Se,{value:o,sx:{mb:1},disabled:!i,control:e.jsx(Re,{sx:{ml:.75,alignSelf:"flex-start"}}),label:e.jsx(f,{children:e.jsxs(f,{children:[e.jsx(R,{children:r}),e.jsx(R,{variant:"body2",color:"text.secondary",children:a})]})})},o))})]})}),Nt=({type:t,environment:s,setEnvironment:n})=>{const{environments:o}=J(),r=t===p.ADMIN?[{key:"*",label:"ALL"}]:o.map(a=>({key:a.name,label:`${a.name.concat(a.enabled?"":" - deprecated")}`,title:a.name,disabled:!1}));return e.jsxs(e.Fragment,{children:[e.jsx(ee,{children:"Which environment should the token have access to?"}),e.jsx(nt,{disabled:t===p.ADMIN,options:r,value:s,onChange:n,label:"Environment",id:"api_key_environment",name:"environment",IconComponent:De,fullWidth:!0})]})},it=t=>t.map(s=>({...s.user,joinedAt:new Date(s.joinedAt),createdBy:s.createdBy})),It=t=>{const{data:s,error:n,mutate:o}=Le(Q(`api/admin/groups/${t}`),lt);return d.useMemo(()=>({group:s&&{...s,users:it((s==null?void 0:s.users)??[])},loading:!n&&!s,refetchGroup:()=>o(),error:n}),[s,n,o])},lt=t=>fetch(t).then(X("Group")).then(s=>s.json()),St=()=>{const{isEnterprise:t}=T(),{data:s,error:n,mutate:o}=Pe(t(),{serviceAccounts:[],rootRoles:[]},Q("api/admin/service-account"),ct);return d.useMemo(()=>({serviceAccounts:(s==null?void 0:s.serviceAccounts)??[],roles:(s==null?void 0:s.rootRoles)??[],loading:!n&&!s,refetch:()=>o(),error:n}),[s,n,o])},ct=t=>fetch(t).then(X("Service Accounts")).then(s=>s.json()),dt=c("div")(({theme:t})=>({display:"flex",flexDirection:"column",gap:t.spacing(.5),"& > *:not(:last-child)":{borderBottom:`1px solid ${t.palette.divider}`,paddingBottom:t.spacing(1)}})),ut=c(_e)(()=>({display:"block"})),Rt=({role:t,roles:s,value:n})=>{const{isEnterprise:o}=T();if(o()){const r=s||[t];return e.jsx(A,{children:e.jsx(Be,{tooltip:e.jsx(dt,{children:r.map(a=>e.jsx(Fe,{roleId:a,tooltip:!0},a))}),children:e.jsx(ut,{children:n})})})}return e.jsx(A,{children:n})};export{ft as A,yt as C,Nt as E,Ct as R,ee as S,p as T,Tt as a,At as b,kt as c,wt as d,Et as e,vt as f,St as g,It as h,Rt as i,Z as j,it as m,bt as u};
@@ -1 +1 @@
1
- import{s as h,L as f,j as n,aY as m,b9 as p,cg as y,r as d,bd as g,bb as v,as as b,bc as k,aT as x}from"./index-Yy9_7TKN.js";const E=h(f)(({theme:a})=>({textDecoration:"none",color:a.palette.primary.main,fontWeight:a.fontWeight.bold})),w=({isOpen:a,onClose:r,features:e,project:t})=>n.jsxs(m,{title:"You can't archive a feature that other features depend on",open:a,primaryButtonText:"OK",onClick:r,children:[n.jsx("p",{children:"The following features depend on your feature:"}),n.jsx("ul",{children:e.map(s=>n.jsx("li",{children:n.jsx(E,{to:`/projects/${t}/features/${s}`,target:"_blank",rel:"noopener noreferrer",children:s})},s))})]}),F=p("api/admin/client-metrics/features"),A=(a,r)=>{const e=p(`api/admin/client-metrics/features/${a}/raw?hoursBack=${r}`),{data:t,error:s}=y(e,()=>L(e)),o=d.useCallback(()=>{g(F).catch(console.warn)},[]);return{featureMetrics:t==null?void 0:t.data,loading:!s&&!t,refetchFeatureMetrics:o,error:s}},L=a=>fetch(a).then(v("Features")).then(r=>r.json()).then(),M=48,j=({hoursBack:a,setHoursBack:r,label:e="Period"})=>{const{trackEvent:t}=b(),s=i=>{r(Number.parseInt(i)),t("feature-metrics",{props:{eventType:"change-period",hoursBack:i}})},{isEnterprise:o}=k(),l=o()?[...u,...R]:u,c=l.map(i=>Number(i.key)).includes(a)?a:M;return d.useEffect(()=>{a!==c&&r(c)},[a]),n.jsx("div",{children:n.jsx(x,{name:"feature-metrics-period",label:e,id:"feature-metrics-period",options:l,value:String(c),onChange:s,fullWidth:!0})})},u=[{key:"1",label:"Last hour"},{key:"24",label:"Last 24 hours"},{key:"48",label:"Last 48 hours"}],R=[{key:`${7*24}`,label:"Last 7 days"},{key:`${30*24}`,label:"Last 30 days"},{key:`${90*24}`,label:"Last 90 days"}],$=a=>{const r=new Map;return a.forEach(e=>{let t=r.get(e.timestamp);if(t||(t={...e,yes:0,no:0,variants:{}},r.set(e.timestamp,t)),t.yes+=e.yes,t.no+=e.no,e.variants){t.variants=t.variants||{};for(const[s,o]of Object.entries(e.variants))t.variants[s]=(t.variants[s]||0)+o}}),Array.from(r.values()).map(e=>({...e,variants:e.variants&&Object.keys(e.variants).length===0?void 0:e.variants}))};export{w as F,M as a,$ as b,j as c,A as u};
1
+ import{s as h,L as f,j as n,aY as m,b9 as p,ch as y,r as d,bd as v,bb as g,as as b,bc as k,aT as x}from"./index-DvDCZTAu.js";const E=h(f)(({theme:a})=>({textDecoration:"none",color:a.palette.primary.main,fontWeight:a.fontWeight.bold})),w=({isOpen:a,onClose:r,features:e,project:t})=>n.jsxs(m,{title:"You can't archive a feature that other features depend on",open:a,primaryButtonText:"OK",onClick:r,children:[n.jsx("p",{children:"The following features depend on your feature:"}),n.jsx("ul",{children:e.map(s=>n.jsx("li",{children:n.jsx(E,{to:`/projects/${t}/features/${s}`,target:"_blank",rel:"noopener noreferrer",children:s})},s))})]}),F=p("api/admin/client-metrics/features"),A=(a,r)=>{const e=p(`api/admin/client-metrics/features/${a}/raw?hoursBack=${r}`),{data:t,error:s}=y(e,()=>L(e)),o=d.useCallback(()=>{v(F).catch(console.warn)},[]);return{featureMetrics:t==null?void 0:t.data,loading:!s&&!t,refetchFeatureMetrics:o,error:s}},L=a=>fetch(a).then(g("Features")).then(r=>r.json()).then(),M=48,j=({hoursBack:a,setHoursBack:r,label:e="Period"})=>{const{trackEvent:t}=b(),s=i=>{r(Number.parseInt(i)),t("feature-metrics",{props:{eventType:"change-period",hoursBack:i}})},{isEnterprise:o}=k(),l=o()?[...u,...R]:u,c=l.map(i=>Number(i.key)).includes(a)?a:M;return d.useEffect(()=>{a!==c&&r(c)},[a]),n.jsx("div",{children:n.jsx(x,{name:"feature-metrics-period",label:e,id:"feature-metrics-period",options:l,value:String(c),onChange:s,fullWidth:!0})})},u=[{key:"1",label:"Last hour"},{key:"24",label:"Last 24 hours"},{key:"48",label:"Last 48 hours"}],R=[{key:`${7*24}`,label:"Last 7 days"},{key:`${30*24}`,label:"Last 30 days"},{key:`${90*24}`,label:"Last 90 days"}],$=a=>{const r=new Map;return a.forEach(e=>{let t=r.get(e.timestamp);if(t||(t={...e,yes:0,no:0,variants:{}},r.set(e.timestamp,t)),t.yes+=e.yes,t.no+=e.no,e.variants){t.variants=t.variants||{};for(const[s,o]of Object.entries(e.variants))t.variants[s]=(t.variants[s]||0)+o}}),Array.from(r.values()).map(e=>({...e,variants:e.variants&&Object.keys(e.variants).length===0?void 0:e.variants}))};export{w as F,M as a,$ as b,j as c,A as u};
@@ -1,6 +1,6 @@
1
- import{i_ as ct,jl as E,jm as w,jn as p,i$ as Q,jo as fe,jp as ut,jq as b,iN as oe,j6 as B,jr as A,js as ft,jt as ht,j0 as _,j1 as he,iY as K,ju as yt,jv as bt,jw as z,jx as J,jy as Ce,jz as gt,jA as Pe,jB as T,jC as $e,jD as Ve,jE as mt}from"./index-Yy9_7TKN.js";/*!
1
+ import{j1 as ct,jo as E,jp as w,jq as p,j2 as Q,jr as fe,js as ut,jt as b,iQ as oe,j9 as B,ju as A,jv as ft,jw as ht,j3 as _,j4 as he,i$ as G,jx as yt,jy as bt,jz as z,jA as J,jB as Ce,jC as gt,jD as Pe,jE as T,jF as $e,jG as Ve,jH as mt}from"./index-DvDCZTAu.js";/*!
2
2
  * chartjs-plugin-annotation v2.2.1
3
3
  * https://www.chartjs.org/chartjs-plugin-annotation/index
4
4
  * (c) 2023 chartjs-plugin-annotation Contributors
5
5
  * Released under the MIT License
6
- */const ke={modes:{point(t,e){return q(t,e,{intersect:!0})},nearest(t,e,n){return xt(t,e,n)},x(t,e,n){return q(t,e,{intersect:n.intersect,axis:"x"})},y(t,e,n){return q(t,e,{intersect:n.intersect,axis:"y"})}}};function ye(t,e,n){return(ke.modes[n.mode]||ke.modes.nearest)(t,e,n)}function pt(t,e,n){return n!=="x"&&n!=="y"?t.inRange(e.x,e.y,"x",!0)||t.inRange(e.x,e.y,"y",!0):t.inRange(e.x,e.y,n,!0)}function wt(t,e,n){return n==="x"?{x:t.x,y:e.y}:n==="y"?{x:e.x,y:t.y}:e}function q(t,e,n){return t.visibleElements.filter(o=>n.intersect?o.inRange(e.x,e.y):pt(o,e,n.axis))}function xt(t,e,n){let o=Number.POSITIVE_INFINITY;return q(t,e,n).reduce((r,i)=>{const s=i.getCenterPoint(),a=wt(e,s,n.axis),d=fe(e,a);return d<o?(r=[i],o=d):d===o&&r.push(i),r},[]).sort((r,i)=>r._index-i._index).slice(0,1)}const St=(t,e)=>e>t||t.length>e.length&&t.slice(0,e.length)===e,j=.001,F=(t,e,n)=>Math.min(n,Math.max(e,t));function Mt(t,e,n){for(const o of Object.keys(t))t[o]=F(t[o],e,n);return t}function Ct(t,e,n,o){if(!t||!e||n<=0)return!1;const r=o/2;return Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)<=Math.pow(n+r,2)}function Je(t,{x:e,y:n,x2:o,y2:r},i,s){const a=s/2,d=t.x>=e-a-j&&t.x<=o+a+j,l=t.y>=n-a-j&&t.y<=r+a+j;return i==="x"?d:(i==="y"||d)&&l}function R(t,e){const{centerX:n,centerY:o}=t.getProps(["centerX","centerY"],e);return{x:n,y:o}}function Pt(t,e,n,o=!0){const r=n.split(".");let i=0;for(const s of e.split(".")){const a=r[i++];if(parseInt(s,10)<parseInt(a,10))break;if(St(a,s)){if(o)throw new Error(`${t} v${n} is not supported. v${e} or newer is required.`);return!1}}return!0}const Ue=t=>typeof t=="string"&&t.endsWith("%"),qe=t=>parseFloat(t)/100,Ke=t=>F(qe(t),0,1);function be(t,e){return e==="start"?0:e==="end"?t:Ue(e)?Ke(e)*t:t/2}function C(t,e,n=!0){return typeof e=="number"?e:Ue(e)?(n?Ke(e):qe(e))*t:t}function kt(t,e){const{x:n,width:o}=t,r=e.textAlign;return r==="center"?n+o/2:r==="end"||r==="right"?n+o:n}function ge(t,e="center"){return B(t)?{x:_(t.x,e),y:_(t.y,e)}:(t=_(t,e),{x:t,y:t})}function Ge(t){return t&&(p(t.xValue)||p(t.yValue))}function H(t,e,n,o=!1){const r=n.init;if(r){if(r===!0)return Fe(e,o)}else return;return vt(e,o,he(r,[{chart:t,properties:e,options:n}]))}function Qe(t,e,n){let o=!1;return e.forEach(r=>{T(t[r])?(o=!0,n[r]=t[r]):p(n[r])&&delete n[r]}),o}function Fe({centerX:t,centerY:e},n){return n?{centerX:t,centerY:e,radius:0,width:0,height:0}:{x:t,y:e,x2:t,y2:e,width:0,height:0}}function vt(t,e,n){if(n===!0)return Fe(t,e);if(B(n))return n}const re=new Map,jt=t=>isNaN(t)||t<=0,At=t=>t.reduce(function(e,n){return e+=n.string,e},"");function Z(t){if(t&&typeof t=="object"){const e=t.toString();return e==="[object HTMLImageElement]"||e==="[object HTMLCanvasElement]"}}function me(t,{x:e,y:n},o){o&&(t.translate(e,n),t.rotate(w(o)),t.translate(-e,-n))}function P(t,e){if(e&&e.borderWidth)return t.lineCap=e.borderCapStyle,t.setLineDash(e.borderDash),t.lineDashOffset=e.borderDashOffset,t.lineJoin=e.borderJoinStyle,t.lineWidth=e.borderWidth,t.strokeStyle=e.borderColor,!0}function W(t,e){t.shadowColor=e.backgroundShadowColor,t.shadowBlur=e.shadowBlur,t.shadowOffsetX=e.shadowOffsetX,t.shadowOffsetY=e.shadowOffsetY}function pe(t,e){const n=e.content;if(Z(n))return{width:C(n.width,e.width),height:C(n.height,e.height)};const o=e.font,r=A(o)?o.map(d=>K(d)):[K(o)],i=e.textStrokeWidth,s=A(n)?n:[n],a=s.join()+At(r)+i+(t._measureText?"-spriting":"");return re.has(a)||re.set(a,Et(t,s,r,i)),re.get(a)}function Ze(t,e,n){const{x:o,y:r,width:i,height:s}=e;t.save(),W(t,n);const a=P(t,n);t.fillStyle=n.backgroundColor,t.beginPath(),yt(t,{x:o,y:r,w:i,h:s,radius:Mt(bt(n.borderRadius),0,Math.min(i,s)/2)}),t.closePath(),t.fill(),a&&(t.shadowColor=n.borderShadowColor,t.stroke()),t.restore()}function Dt(t,e,n){const o=n.content;if(Z(o)){t.save(),t.globalAlpha=Lt(n.opacity,o.style.opacity),t.drawImage(o,e.x,e.y,e.width,e.height),t.restore();return}const r=A(o)?o:[o],i=n.font,s=A(i)?i.map(u=>K(u)):[K(i)],a=n.color,d=A(a)?a:[a],l=kt(e,n),c=e.y+n.textStrokeWidth/2;t.save(),t.textBaseline="middle",t.textAlign=n.textAlign,It(t,n)&&Rt(t,{x:l,y:c},r,s),Wt(t,{x:l,y:c},r,{fonts:s,colors:d}),t.restore()}function It(t,e){if(e.textStrokeWidth>0)return t.lineJoin="round",t.miterLimit=2,t.lineWidth=e.textStrokeWidth,t.strokeStyle=e.textStrokeColor,!0}function Tt(t,e,n,o){const{radius:r,options:i}=e,s=i.pointStyle,a=i.rotation;let d=(a||0)*Ve;if(Z(s)){t.save(),t.translate(n,o),t.rotate(d),t.drawImage(s,-s.width/2,-s.height/2,s.width,s.height),t.restore();return}jt(r)||Ot(t,{x:n,y:o,radius:r,rotation:a,style:s,rad:d})}function Ot(t,{x:e,y:n,radius:o,rotation:r,style:i,rad:s}){let a,d,l,c;switch(t.beginPath(),i){default:t.arc(e,n,o,0,gt),t.closePath();break;case"triangle":t.moveTo(e+Math.sin(s)*o,n-Math.cos(s)*o),s+=Ce,t.lineTo(e+Math.sin(s)*o,n-Math.cos(s)*o),s+=Ce,t.lineTo(e+Math.sin(s)*o,n-Math.cos(s)*o),t.closePath();break;case"rectRounded":c=o*.516,l=o-c,a=Math.cos(s+z)*l,d=Math.sin(s+z)*l,t.arc(e-a,n-d,c,s-b,s-J),t.arc(e+d,n-a,c,s-J,s),t.arc(e+a,n+d,c,s,s+J),t.arc(e-d,n+a,c,s+J,s+b),t.closePath();break;case"rect":if(!r){l=Math.SQRT1_2*o,t.rect(e-l,n-l,2*l,2*l);break}s+=z;case"rectRot":a=Math.cos(s)*o,d=Math.sin(s)*o,t.moveTo(e-a,n-d),t.lineTo(e+d,n-a),t.lineTo(e+a,n+d),t.lineTo(e-d,n+a),t.closePath();break;case"crossRot":s+=z;case"cross":a=Math.cos(s)*o,d=Math.sin(s)*o,t.moveTo(e-a,n-d),t.lineTo(e+a,n+d),t.moveTo(e+d,n-a),t.lineTo(e-d,n+a);break;case"star":a=Math.cos(s)*o,d=Math.sin(s)*o,t.moveTo(e-a,n-d),t.lineTo(e+a,n+d),t.moveTo(e+d,n-a),t.lineTo(e-d,n+a),s+=z,a=Math.cos(s)*o,d=Math.sin(s)*o,t.moveTo(e-a,n-d),t.lineTo(e+a,n+d),t.moveTo(e+d,n-a),t.lineTo(e-d,n+a);break;case"line":a=Math.cos(s)*o,d=Math.sin(s)*o,t.moveTo(e-a,n-d),t.lineTo(e+a,n+d);break;case"dash":t.moveTo(e,n),t.lineTo(e+Math.cos(s)*o,n+Math.sin(s)*o);break}t.fill()}function Et(t,e,n,o){t.save();const r=e.length;let i=0,s=o;for(let a=0;a<r;a++){const d=n[Math.min(a,n.length-1)];t.font=d.string;const l=e[a];i=Math.max(i,t.measureText(l).width+o),s+=d.lineHeight}return t.restore(),{width:i,height:s}}function Rt(t,{x:e,y:n},o,r){t.beginPath();let i=0;o.forEach(function(s,a){const d=r[Math.min(a,r.length-1)],l=d.lineHeight;t.font=d.string,t.strokeText(s,e,n+l/2+i),i+=l}),t.stroke()}function Wt(t,{x:e,y:n},o,{fonts:r,colors:i}){let s=0;o.forEach(function(a,d){const l=i[Math.min(d,i.length-1)],c=r[Math.min(d,r.length-1)],u=c.lineHeight;t.beginPath(),t.font=c.string,t.fillStyle=l,t.fillText(a,e,n+u/2+s),s+=u,t.fill()})}function Lt(t,e){const n=Pe(t)?t:e;return Pe(n)?F(n,0,1):1}const ve={xScaleID:{min:"xMin",max:"xMax",start:"left",end:"right",startProp:"x",endProp:"x2"},yScaleID:{min:"yMin",max:"yMax",start:"bottom",end:"top",startProp:"y",endProp:"y2"}};function O(t,e,n){return e=typeof e=="number"?e:t.parse(e),$e(e)?t.getPixelForValue(e):n}function D(t,e,n){const o=e[n];if(o||n==="scaleID")return o;const r=n.charAt(0),i=Object.values(t).filter(s=>s.axis&&s.axis===r);return i.length?i[0].id:r}function et(t,e){if(t){const n=t.options.reverse,o=O(t,e.min,n?e.end:e.start),r=O(t,e.max,n?e.start:e.end);return{start:o,end:r}}}function tt(t,e){const{chartArea:n,scales:o}=t,r=o[D(o,e,"xScaleID")],i=o[D(o,e,"yScaleID")];let s=n.width/2,a=n.height/2;return r&&(s=O(r,e.xValue,r.left+r.width/2)),i&&(a=O(i,e.yValue,i.top+i.height/2)),{x:s,y:a}}function we(t,e){const n=t.scales,o=n[D(n,e,"xScaleID")],r=n[D(n,e,"yScaleID")];if(!o&&!r)return{};let{left:i,right:s}=o||t.chartArea,{top:a,bottom:d}=r||t.chartArea;const l=je(o,{min:e.xMin,max:e.xMax,start:i,end:s});i=l.start,s=l.end;const c=je(r,{min:e.yMin,max:e.yMax,start:d,end:a});return a=c.start,d=c.end,{x:i,y:a,x2:s,y2:d,width:s-i,height:d-a,centerX:i+(s-i)/2,centerY:a+(d-a)/2}}function nt(t,e){if(!Ge(e)){const n=we(t,e);let o=e.radius;(!o||isNaN(o))&&(o=Math.min(n.width,n.height)/2,e.radius=o);const r=o*2,i=n.centerX+e.xAdjust,s=n.centerY+e.yAdjust;return{x:i-o,y:s-o,x2:i+o,y2:s+o,centerX:i,centerY:s,width:r,height:r,radius:o}}return zt(t,e)}function Yt(t,e){const{scales:n,chartArea:o}=t,r=n[e.scaleID],i={x:o.left,y:o.top,x2:o.right,y2:o.bottom};return r?Xt(r,i,e):_t(n,i,e),i}function ot(t,e,n){const o=we(t,e);return o.initProperties=H(t,o,e,n),o.elements=[{type:"label",optionScope:"label",properties:Nt(t,o,e),initProperties:o.initProperties}],o}function zt(t,e){const n=tt(t,e),o=e.radius*2;return{x:n.x-e.radius+e.xAdjust,y:n.y-e.radius+e.yAdjust,x2:n.x+e.radius+e.xAdjust,y2:n.y+e.radius+e.yAdjust,centerX:n.x+e.xAdjust,centerY:n.y+e.yAdjust,radius:e.radius,width:o,height:o}}function je(t,e){const n=et(t,e)||e;return{start:Math.min(n.start,n.end),end:Math.max(n.start,n.end)}}function Xt(t,e,n){const o=O(t,n.value,NaN),r=O(t,n.endValue,o);t.isHorizontal()?(e.x=o,e.x2=r):(e.y=o,e.y2=r)}function _t(t,e,n){for(const o of Object.keys(ve)){const r=t[D(t,n,o)];if(r){const{min:i,max:s,start:a,end:d,startProp:l,endProp:c}=ve[o],u=et(r,{min:n[i],max:n[s],start:r[a],end:r[d]});e[l]=u.start,e[c]=u.end}}}function Bt({properties:t,options:e},n,o,r){const{x:i,x2:s,width:a}=t;return rt({start:i,end:s,size:a,borderWidth:e.borderWidth},{position:o.x,padding:{start:r.left,end:r.right},adjust:e.label.xAdjust,size:n.width})}function Ht({properties:t,options:e},n,o,r){const{y:i,y2:s,height:a}=t;return rt({start:i,end:s,size:a,borderWidth:e.borderWidth},{position:o.y,padding:{start:r.top,end:r.bottom},adjust:e.label.yAdjust,size:n.height})}function rt(t,e){const{start:n,end:o,borderWidth:r}=t,{position:i,padding:{start:s,end:a},adjust:d}=e,l=o-r-n-s-a-e.size;return n+r/2+d+be(l,i)}function Nt(t,e,n){const o=n.label;o.backgroundColor="transparent",o.callout.display=!1;const r=ge(o.position),i=Q(o.padding),s=pe(t.ctx,o),a=Bt({properties:e,options:n},s,r,i),d=Ht({properties:e,options:n},s,r,i),l=s.width+i.width,c=s.height+i.height;return{x:a,y:d,x2:a+l,y2:d+c,width:l,height:c,centerX:a+l/2,centerY:d+c/2,rotation:o.rotation}}function I(t,e,n){const o=Math.cos(n),r=Math.sin(n),i=e.x,s=e.y;return{x:i+o*(t.x-i)-r*(t.y-s),y:s+r*(t.x-i)+o*(t.y-s)}}const ie=["enter","leave"],xe=ie.concat("click");function $t(t,e,n){e.listened=Qe(n,xe,e.listeners),e.moveListened=!1,e._getElements=ye,ie.forEach(o=>{T(n[o])&&(e.moveListened=!0)}),(!e.listened||!e.moveListened)&&e.annotations.forEach(o=>{!e.listened&&T(o.click)&&(e.listened=!0),e.moveListened||ie.forEach(r=>{T(o[r])&&(e.listened=!0,e.moveListened=!0)})})}function Vt(t,e,n){if(t.listened)switch(e.type){case"mousemove":case"mouseout":return Jt(t,e,n);case"click":return Ut(t,e,n)}}function Jt(t,e,n){if(!t.moveListened)return;let o;e.type==="mousemove"?o=ye(t,e,n.interaction):o=[];const r=t.hovered;t.hovered=o;const i={state:t,event:e};let s=Ae(i,"leave",r,o);return Ae(i,"enter",o,r)||s}function Ae({state:t,event:e},n,o,r){let i;for(const s of o)r.indexOf(s)<0&&(i=it(s.options[n]||t.listeners[n],s,e)||i);return i}function Ut(t,e,n){const o=t.listeners,r=ye(t,e,n.interaction);let i;for(const s of r)i=it(s.options.click||o.click,s,e)||i;return i}function it(t,e,n){return he(t,[e.$context,n])===!0}const G=["afterDraw","beforeDraw"];function qt(t,e,n){const o=e.visibleElements;e.hooked=Qe(n,G,e.hooks),e.hooked||o.forEach(r=>{e.hooked||G.forEach(i=>{T(r.options[i])&&(e.hooked=!0)})})}function De(t,e,n){if(t.hooked){const o=e.options[n]||t.hooks[n];return he(o,[e.$context])}}function Kt(t,e,n){const o=en(t.scales,e,n);let r=Ie(e,o,"min","suggestedMin");r=Ie(e,o,"max","suggestedMax")||r,r&&T(e.handleTickRangeOptions)&&e.handleTickRangeOptions()}function Gt(t,e){for(const n of t)Ft(n,e)}function Ie(t,e,n,o){if($e(e[n])&&!Qt(t.options,n,o)){const r=t[n]!==e[n];return t[n]=e[n],r}}function Qt(t,e,n){return p(t[e])||p(t[n])}function Ft(t,e){for(const n of["scaleID","xScaleID","yScaleID"]){const o=D(e,t,n);o&&!e[o]&&Zt(t,n)&&console.warn(`No scale found with id '${o}' for annotation '${t.id}'`)}}function Zt(t,e){if(e==="scaleID")return!0;const n=e.charAt(0);for(const o of["Min","Max","Value"])if(p(t[n+o]))return!0;return!1}function en(t,e,n){const o=e.axis,r=e.id,i=o+"ScaleID",s={min:_(e.min,Number.NEGATIVE_INFINITY),max:_(e.max,Number.POSITIVE_INFINITY)};for(const a of n)a.scaleID===r?Te(a,e,["value","endValue"],s):D(t,a,i)===r&&Te(a,e,[o+"Min",o+"Max",o+"Value"],s);return s}function Te(t,e,n,o){for(const r of n){const i=t[r];if(p(i)){const s=e.parse(i);o.min=Math.min(o.min,s),o.max=Math.max(o.max,s)}}}class L extends E{inRange(e,n,o,r){const{x:i,y:s}=I({x:e,y:n},this.getCenterPoint(r),w(-this.options.rotation));return Je({x:i,y:s},this.getProps(["x","y","x2","y2"],r),o,this.options.borderWidth)}getCenterPoint(e){return R(this,e)}draw(e){e.save(),me(e,this.getCenterPoint(),this.options.rotation),Ze(e,this,this.options),e.restore()}get label(){return this.elements&&this.elements[0]}resolveElementProperties(e,n){return ot(e,n)}}L.id="boxAnnotation";L.defaults={adjustScaleRange:!0,backgroundShadowColor:"transparent",borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderRadius:0,borderShadowColor:"transparent",borderWidth:1,display:!0,init:void 0,label:{backgroundColor:"transparent",borderWidth:0,callout:{display:!1},color:"black",content:null,display:!1,drawTime:void 0,font:{family:void 0,lineHeight:void 0,size:void 0,style:void 0,weight:"bold"},height:void 0,opacity:void 0,padding:6,position:"center",rotation:void 0,textAlign:"start",textStrokeColor:void 0,textStrokeWidth:0,width:void 0,xAdjust:0,yAdjust:0,z:void 0},rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,xMax:void 0,xMin:void 0,xScaleID:void 0,yMax:void 0,yMin:void 0,yScaleID:void 0,z:0};L.defaultRoutes={borderColor:"color",backgroundColor:"color"};L.descriptors={label:{_fallback:!0}};const st=["left","bottom","top","right"];class N extends E{inRange(e,n,o,r){const{x:i,y:s}=I({x:e,y:n},this.getCenterPoint(r),w(-this.rotation));return Je({x:i,y:s},this.getProps(["x","y","x2","y2"],r),o,this.options.borderWidth)}getCenterPoint(e){return R(this,e)}draw(e){const n=this.options,o=!p(this._visible)||this._visible;!n.display||!n.content||!o||(e.save(),me(e,this.getCenterPoint(),this.rotation),nn(e,this),Ze(e,this,n),Dt(e,cn(this),n),e.restore())}resolveElementProperties(e,n){let o;if(Ge(n))o=tt(e,n);else{const{centerX:a,centerY:d}=we(e,n);o={x:a,y:d}}const r=Q(n.padding),i=pe(e.ctx,n),s=tn(o,i,n,r);return{initProperties:H(e,s,n),pointX:o.x,pointY:o.y,...s,rotation:n.rotation}}}N.id="labelAnnotation";N.defaults={adjustScaleRange:!0,backgroundColor:"transparent",backgroundShadowColor:"transparent",borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderRadius:0,borderShadowColor:"transparent",borderWidth:0,callout:{borderCapStyle:"butt",borderColor:void 0,borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:1,display:!1,margin:5,position:"auto",side:5,start:"50%"},color:"black",content:null,display:!0,font:{family:void 0,lineHeight:void 0,size:void 0,style:void 0,weight:void 0},height:void 0,init:void 0,opacity:void 0,padding:6,position:"center",rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,textAlign:"center",textStrokeColor:void 0,textStrokeWidth:0,width:void 0,xAdjust:0,xMax:void 0,xMin:void 0,xScaleID:void 0,xValue:void 0,yAdjust:0,yMax:void 0,yMin:void 0,yScaleID:void 0,yValue:void 0,z:0};N.defaultRoutes={borderColor:"color"};function tn(t,e,n,o){const r=e.width+o.width+n.borderWidth,i=e.height+o.height+n.borderWidth,s=ge(n.position,"center"),a=Oe(t.x,r,n.xAdjust,s.x),d=Oe(t.y,i,n.yAdjust,s.y);return{x:a,y:d,x2:a+r,y2:d+i,width:r,height:i,centerX:a+r/2,centerY:d+i/2}}function Oe(t,e,n=0,o){return t-be(e,o)+n}function nn(t,e){const{pointX:n,pointY:o,options:r}=e,i=r.callout,s=i&&i.display&&dn(e,i);if(!s||un(e,i,s))return;if(t.save(),t.beginPath(),!P(t,i))return t.restore();const{separatorStart:d,separatorEnd:l}=on(e,s),{sideStart:c,sideEnd:u}=sn(e,s,d);(i.margin>0||r.borderWidth===0)&&(t.moveTo(d.x,d.y),t.lineTo(l.x,l.y)),t.moveTo(c.x,c.y),t.lineTo(u.x,u.y);const f=I({x:n,y:o},e.getCenterPoint(),w(-e.rotation));t.lineTo(f.x,f.y),t.stroke(),t.restore()}function on(t,e){const{x:n,y:o,x2:r,y2:i}=t,s=rn(t,e);let a,d;return e==="left"||e==="right"?(a={x:n+s,y:o},d={x:a.x,y:i}):(a={x:n,y:o+s},d={x:r,y:a.y}),{separatorStart:a,separatorEnd:d}}function rn(t,e){const{width:n,height:o,options:r}=t,i=r.callout.margin+r.borderWidth/2;return e==="right"?n+i:e==="bottom"?o+i:-i}function sn(t,e,n){const{y:o,width:r,height:i,options:s}=t,a=s.callout.start,d=an(e,s.callout);let l,c;return e==="left"||e==="right"?(l={x:n.x,y:o+C(i,a)},c={x:l.x+d,y:l.y}):(l={x:n.x+C(r,a),y:n.y},c={x:l.x,y:l.y+d}),{sideStart:l,sideEnd:c}}function an(t,e){const n=e.side;return t==="left"||t==="top"?-n:n}function dn(t,e){const n=e.position;return st.includes(n)?n:ln(t,e)}function ln(t,e){const{x:n,y:o,x2:r,y2:i,width:s,height:a,pointX:d,pointY:l,centerX:c,centerY:u,rotation:f}=t,h={x:c,y:u},y=e.start,x=C(s,y),Y=C(a,y),g=[n,n+x,n+x,r],m=[o+Y,i,o,i],k=[];for(let v=0;v<4;v++){const ne=I({x:g[v],y:m[v]},h,w(f));k.push({position:st[v],distance:fe(ne,{x:d,y:l})})}return k.sort((v,ne)=>v.distance-ne.distance)[0].position}function cn({x:t,y:e,width:n,height:o,options:r}){const i=r.borderWidth/2,s=Q(r.padding);return{x:t+s.left+i,y:e+s.top+i,width:n-s.left-s.right-r.borderWidth,height:o-s.top-s.bottom-r.borderWidth}}function un(t,e,n){const{pointX:o,pointY:r}=t,i=e.margin;let s=o,a=r;return n==="left"?s+=i:n==="right"?s-=i:n==="top"?a+=i:n==="bottom"&&(a-=i),t.inRange(s,a)}const Se=(t,e,n)=>({x:t.x+n*(e.x-t.x),y:t.y+n*(e.y-t.y)}),se=(t,e,n)=>Se(e,n,Math.abs((t-e.y)/(n.y-e.y))).x,Ee=(t,e,n)=>Se(e,n,Math.abs((t-e.x)/(n.x-e.x))).y,X=t=>t*t,fn=(t,e,{x:n,y:o,x2:r,y2:i},s)=>s==="y"?{start:Math.min(o,i),end:Math.max(o,i),value:e}:{start:Math.min(n,r),end:Math.max(n,r),value:t},Re=(t,e,n,o)=>(1-o)*(1-o)*t+2*(1-o)*o*e+o*o*n,ae=(t,e,n,o)=>({x:Re(t.x,e.x,n.x,o),y:Re(t.y,e.y,n.y,o)}),We=(t,e,n,o)=>2*(1-o)*(e-t)+2*o*(n-e),Le=(t,e,n,o)=>-Math.atan2(We(t.x,e.x,n.x,o),We(t.y,e.y,n.y,o))+.5*b;class $ extends E{inRange(e,n,o,r){const i=this.options.borderWidth/2;if(o!=="x"&&o!=="y"){const s={mouseX:e,mouseY:n},{path:a,ctx:d}=this;if(a){P(d,this.options);const{chart:c}=this.$context,u=e*c.currentDevicePixelRatio,f=n*c.currentDevicePixelRatio,h=d.isPointInStroke(a,u,f)||de(this,s,r);return d.restore(),h}const l=X(i);return gn(this,s,l,r)||de(this,s,r)}return hn(this,{mouseX:e,mouseY:n},o,{hBorderWidth:i,useFinalPosition:r})}getCenterPoint(e){return R(this,e)}draw(e){const{x:n,y:o,x2:r,y2:i,cp:s,options:a}=this;if(e.save(),!P(e,a))return e.restore();W(e,a);const d=Math.sqrt(Math.pow(r-n,2)+Math.pow(i-o,2));if(a.curve&&s)return Pn(e,this,s,d),e.restore();const{startOpts:l,endOpts:c,startAdjust:u,endAdjust:f}=at(this),h=Math.atan2(i-o,r-n);e.translate(n,o),e.rotate(h),e.beginPath(),e.moveTo(0+u,0),e.lineTo(d-f,0),e.shadowColor=a.borderShadowColor,e.stroke(),le(e,0,u,l),le(e,d,-f,c),e.restore()}get label(){return this.elements&&this.elements[0]}resolveElementProperties(e,n){const o=Yt(e,n),{x:r,y:i,x2:s,y2:a}=o,d=yn(o,e.chartArea),l=d?bn({x:r,y:i},{x:s,y:a},e.chartArea):{x:r,y:i,x2:s,y2:a,width:Math.abs(s-r),height:Math.abs(a-i)};if(l.centerX=(s+r)/2,l.centerY=(a+i)/2,l.initProperties=H(e,l,n),n.curve){const u={x:l.x,y:l.y},f={x:l.x2,y:l.y2};l.cp=Cn(l,n,fe(u,f))}const c=mn(e,l,n.label);return c._visible=d,l.elements=[{type:"label",optionScope:"label",properties:c,initProperties:l.initProperties}],l}}$.id="lineAnnotation";const Ye={backgroundColor:void 0,backgroundShadowColor:void 0,borderColor:void 0,borderDash:void 0,borderDashOffset:void 0,borderShadowColor:void 0,borderWidth:void 0,display:void 0,fill:void 0,length:void 0,shadowBlur:void 0,shadowOffsetX:void 0,shadowOffsetY:void 0,width:void 0};$.defaults={adjustScaleRange:!0,arrowHeads:{display:!1,end:Object.assign({},Ye),fill:!1,length:12,start:Object.assign({},Ye),width:6},borderDash:[],borderDashOffset:0,borderShadowColor:"transparent",borderWidth:2,curve:!1,controlPoint:{y:"-50%"},display:!0,endValue:void 0,init:void 0,label:{backgroundColor:"rgba(0,0,0,0.8)",backgroundShadowColor:"transparent",borderCapStyle:"butt",borderColor:"black",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderRadius:6,borderShadowColor:"transparent",borderWidth:0,callout:Object.assign({},N.defaults.callout),color:"#fff",content:null,display:!1,drawTime:void 0,font:{family:void 0,lineHeight:void 0,size:void 0,style:void 0,weight:"bold"},height:void 0,opacity:void 0,padding:6,position:"center",rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,textAlign:"center",textStrokeColor:void 0,textStrokeWidth:0,width:void 0,xAdjust:0,yAdjust:0,z:void 0},scaleID:void 0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,value:void 0,xMax:void 0,xMin:void 0,xScaleID:void 0,yMax:void 0,yMin:void 0,yScaleID:void 0,z:0};$.descriptors={arrowHeads:{start:{_fallback:!0},end:{_fallback:!0},_fallback:!0}};$.defaultRoutes={borderColor:"color"};function hn(t,{mouseX:e,mouseY:n},o,{hBorderWidth:r,useFinalPosition:i}){const s=fn(e,n,t.getProps(["x","y","x2","y2"],i),o);return s.value>=s.start-r&&s.value<=s.end+r||de(t,{mouseX:e,mouseY:n},i,o)}function yn({x:t,y:e,x2:n,y2:o},{top:r,right:i,bottom:s,left:a}){return!(t<a&&n<a||t>i&&n>i||e<r&&o<r||e>s&&o>s)}function ze({x:t,y:e},n,{top:o,right:r,bottom:i,left:s}){return t<s&&(e=Ee(s,{x:t,y:e},n),t=s),t>r&&(e=Ee(r,{x:t,y:e},n),t=r),e<o&&(t=se(o,{x:t,y:e},n),e=o),e>i&&(t=se(i,{x:t,y:e},n),e=i),{x:t,y:e}}function bn(t,e,n){const{x:o,y:r}=ze(t,e,n),{x:i,y:s}=ze(e,t,n);return{x:o,y:r,x2:i,y2:s,width:Math.abs(i-o),height:Math.abs(s-r)}}function gn(t,{mouseX:e,mouseY:n},o=j,r){const{x:i,y:s,x2:a,y2:d}=t.getProps(["x","y","x2","y2"],r),l=a-i,c=d-s,u=X(l)+X(c),f=u===0?-1:((e-i)*l+(n-s)*c)/u;let h,y;return f<0?(h=i,y=s):f>1?(h=a,y=d):(h=i+f*l,y=s+f*c),X(e-h)+X(n-y)<=o}function de(t,{mouseX:e,mouseY:n},o,r){const i=t.label;return i.options.display&&i.inRange(e,n,r,o)}function mn(t,e,n){const o=n.borderWidth,r=Q(n.padding),i=pe(t.ctx,n),s=i.width+r.width+o,a=i.height+r.height+o;return wn(e,n,{width:s,height:a,padding:r},t.chartArea)}function pn(t){const{x:e,y:n,x2:o,y2:r}=t,i=Math.atan2(r-n,o-e);return i>b/2?i-b:i<b/-2?i+b:i}function wn(t,e,n,o){const{width:r,height:i,padding:s}=n,{xAdjust:a,yAdjust:d}=e,l={x:t.x,y:t.y},c={x:t.x2,y:t.y2},u=e.rotation==="auto"?pn(t):w(e.rotation),f=xn(r,i,u),h=Sn(t,e,{labelSize:f,padding:s},o),y=t.cp?ae(l,t.cp,c,h):Se(l,c,h),x={size:f.w,min:o.left,max:o.right,padding:s.left},Y={size:f.h,min:o.top,max:o.bottom,padding:s.top},g=_e(y.x,x)+a,m=_e(y.y,Y)+d;return{x:g-r/2,y:m-i/2,x2:g+r/2,y2:m+i/2,centerX:g,centerY:m,pointX:y.x,pointY:y.y,width:r,height:i,rotation:ut(u)}}function xn(t,e,n){const o=Math.cos(n),r=Math.sin(n);return{w:Math.abs(t*o)+Math.abs(e*r),h:Math.abs(t*r)+Math.abs(e*o)}}function Sn(t,e,n,o){let r;const i=Mn(t,o);return e.position==="start"?r=Xe({w:t.x2-t.x,h:t.y2-t.y},n,e,i):e.position==="end"?r=1-Xe({w:t.x-t.x2,h:t.y-t.y2},n,e,i):r=be(1,e.position),r}function Xe(t,e,n,o){const{labelSize:r,padding:i}=e,s=t.w*o.dx,a=t.h*o.dy,d=s>0&&(r.w/2+i.left-o.x)/s,l=a>0&&(r.h/2+i.top-o.y)/a;return F(Math.max(d,l),0,.25)}function Mn(t,e){const{x:n,x2:o,y:r,y2:i}=t,s=Math.min(r,i)-e.top,a=Math.min(n,o)-e.left,d=e.bottom-Math.max(r,i),l=e.right-Math.max(n,o);return{x:Math.min(a,l),y:Math.min(s,d),dx:a<=l?1:-1,dy:s<=d?1:-1}}function _e(t,e){const{size:n,min:o,max:r,padding:i}=e,s=n/2;return n>r-o?(r+o)/2:(o>=t-i-s&&(t=o+i+s),r<=t+i+s&&(t=r-i-s),t)}function at(t){const e=t.options,n=e.arrowHeads&&e.arrowHeads.start,o=e.arrowHeads&&e.arrowHeads.end;return{startOpts:n,endOpts:o,startAdjust:Be(t,n),endAdjust:Be(t,o)}}function Be(t,e){if(!e||!e.display)return 0;const{length:n,width:o}=e,r=t.options.borderWidth/2,i={x:n,y:o+r};return Math.abs(se(0,i,{x:0,y:r}))}function le(t,e,n,o){if(!o||!o.display)return;const{length:r,width:i,fill:s,backgroundColor:a,borderColor:d}=o,l=Math.abs(e-r)+n;t.beginPath(),W(t,o),P(t,o),t.moveTo(l,-i),t.lineTo(e+n,0),t.lineTo(l,i),s===!0?(t.fillStyle=a||d,t.closePath(),t.fill(),t.shadowColor="transparent"):t.shadowColor=o.borderShadowColor,t.stroke()}function Cn(t,e,n){const{x:o,y:r,x2:i,y2:s,centerX:a,centerY:d}=t,l=Math.atan2(s-r,i-o),c=ge(e.controlPoint,0),u={x:a+C(n,c.x,!1),y:d+C(n,c.y,!1)};return I(u,{x:a,y:d},l)}function He(t,{x:e,y:n},{angle:o,adjust:r},i){!i||!i.display||(t.save(),t.translate(e,n),t.rotate(o),le(t,0,-r,i),t.restore())}function Pn(t,e,n,o){const{x:r,y:i,x2:s,y2:a,options:d}=e,{startOpts:l,endOpts:c,startAdjust:u,endAdjust:f}=at(e),h={x:r,y:i},y={x:s,y:a},x=Le(h,n,y,0),Y=Le(h,n,y,1)-b,g=ae(h,n,y,u/o),m=ae(h,n,y,1-f/o),k=new Path2D;t.beginPath(),k.moveTo(g.x,g.y),k.quadraticCurveTo(n.x,n.y,m.x,m.y),t.shadowColor=d.borderShadowColor,t.stroke(k),e.path=k,e.ctx=t,He(t,g,{angle:x,adjust:u},l),He(t,m,{angle:Y,adjust:f},c)}class V extends E{inRange(e,n,o,r){const i=this.options.rotation,s=this.options.borderWidth;if(o!=="x"&&o!=="y")return kn({x:e,y:n},this.getProps(["width","height","centerX","centerY"],r),i,s);const{x:a,y:d,x2:l,y2:c}=this.getProps(["x","y","x2","y2"],r),u=s/2,f=o==="y"?{start:d,end:c}:{start:a,end:l},h=I({x:e,y:n},this.getCenterPoint(r),w(-i));return h[o]>=f.start-u-j&&h[o]<=f.end+u+j}getCenterPoint(e){return R(this,e)}draw(e){const{width:n,height:o,centerX:r,centerY:i,options:s}=this;e.save(),me(e,this.getCenterPoint(),s.rotation),W(e,this.options),e.beginPath(),e.fillStyle=s.backgroundColor;const a=P(e,s);e.ellipse(r,i,o/2,n/2,b/2,0,2*b),e.fill(),a&&(e.shadowColor=s.borderShadowColor,e.stroke()),e.restore()}get label(){return this.elements&&this.elements[0]}resolveElementProperties(e,n){return ot(e,n,!0)}}V.id="ellipseAnnotation";V.defaults={adjustScaleRange:!0,backgroundShadowColor:"transparent",borderDash:[],borderDashOffset:0,borderShadowColor:"transparent",borderWidth:1,display:!0,init:void 0,label:Object.assign({},L.defaults.label),rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,xMax:void 0,xMin:void 0,xScaleID:void 0,yMax:void 0,yMin:void 0,yScaleID:void 0,z:0};V.defaultRoutes={borderColor:"color",backgroundColor:"color"};V.descriptors={label:{_fallback:!0}};function kn(t,e,n,o){const{width:r,height:i,centerX:s,centerY:a}=e,d=r/2,l=i/2;if(d<=0||l<=0)return!1;const c=w(n||0),u=o/2||0,f=Math.cos(c),h=Math.sin(c),y=Math.pow(f*(t.x-s)+h*(t.y-a),2),x=Math.pow(h*(t.x-s)-f*(t.y-a),2);return y/Math.pow(d+u,2)+x/Math.pow(l+u,2)<=1.0001}class ee extends E{inRange(e,n,o,r){const{x:i,y:s,x2:a,y2:d,width:l}=this.getProps(["x","y","x2","y2","width"],r),c=this.options.borderWidth;if(o!=="x"&&o!=="y")return Ct({x:e,y:n},this.getCenterPoint(r),l/2,c);const u=c/2,f=o==="y"?{start:s,end:d,value:n}:{start:i,end:a,value:e};return f.value>=f.start-u&&f.value<=f.end+u}getCenterPoint(e){return R(this,e)}draw(e){const n=this.options,o=n.borderWidth;if(n.radius<.1)return;e.save(),e.fillStyle=n.backgroundColor,W(e,n);const r=P(e,n);Tt(e,this,this.centerX,this.centerY),r&&!Z(n.pointStyle)&&(e.shadowColor=n.borderShadowColor,e.stroke()),e.restore(),n.borderWidth=o}resolveElementProperties(e,n){const o=nt(e,n);return o.initProperties=H(e,o,n,!0),o}}ee.id="pointAnnotation";ee.defaults={adjustScaleRange:!0,backgroundShadowColor:"transparent",borderDash:[],borderDashOffset:0,borderShadowColor:"transparent",borderWidth:1,display:!0,init:void 0,pointStyle:"circle",radius:10,rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,xAdjust:0,xMax:void 0,xMin:void 0,xScaleID:void 0,xValue:void 0,yAdjust:0,yMax:void 0,yMin:void 0,yScaleID:void 0,yValue:void 0,z:0};ee.defaultRoutes={borderColor:"color",backgroundColor:"color"};class te extends E{inRange(e,n,o,r){if(o!=="x"&&o!=="y")return this.options.radius>=.1&&this.elements.length>1&&jn(this.elements,e,n,r);const i=I({x:e,y:n},this.getCenterPoint(r),w(-this.options.rotation)),s=this.elements.map(l=>o==="y"?l.bY:l.bX),a=Math.min(...s),d=Math.max(...s);return i[o]>=a&&i[o]<=d}getCenterPoint(e){return R(this,e)}draw(e){const{elements:n,options:o}=this;e.save(),e.beginPath(),e.fillStyle=o.backgroundColor,W(e,o);const r=P(e,o);let i=!0;for(const s of n)i?(e.moveTo(s.x,s.y),i=!1):e.lineTo(s.x,s.y);e.closePath(),e.fill(),r&&(e.shadowColor=o.borderShadowColor,e.stroke()),e.restore()}resolveElementProperties(e,n){const o=nt(e,n),{sides:r,rotation:i}=n,s=[],a=2*b/r;let d=i*Ve;for(let l=0;l<r;l++,d+=a){const c=vn(o,n,d);c.initProperties=H(e,o,n),s.push(c)}return o.elements=s,o}}te.id="polygonAnnotation";te.defaults={adjustScaleRange:!0,backgroundShadowColor:"transparent",borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderShadowColor:"transparent",borderWidth:1,display:!0,init:void 0,point:{radius:0},radius:10,rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,sides:3,xAdjust:0,xMax:void 0,xMin:void 0,xScaleID:void 0,xValue:void 0,yAdjust:0,yMax:void 0,yMin:void 0,yScaleID:void 0,yValue:void 0,z:0};te.defaultRoutes={borderColor:"color",backgroundColor:"color"};function vn({centerX:t,centerY:e},{radius:n,borderWidth:o},r){const i=o/2,s=Math.sin(r),a=Math.cos(r),d={x:t+s*n,y:e-a*n};return{type:"point",optionScope:"point",properties:{x:d.x,y:d.y,centerX:d.x,centerY:d.y,bX:t+s*(n+i),bY:e-a*(n+i)}}}function jn(t,e,n,o){let r=!1,i=t[t.length-1].getProps(["bX","bY"],o);for(const s of t){const a=s.getProps(["bX","bY"],o);a.bY>n!=i.bY>n&&e<(i.bX-a.bX)*(n-a.bY)/(i.bY-a.bY)+a.bX&&(r=!r),i=a}return r}const M={box:L,ellipse:V,label:N,line:$,point:ee,polygon:te};Object.keys(M).forEach(t=>{ct.describe(`elements.${M[t].id}`,{_fallback:"plugins.annotation.common"})});const An={update:Object.assign},Dn=xe.concat(G),Ne=(t,e)=>B(e)?ue(t,e):t,ce=t=>t==="color"||t==="font";function Me(t="line"){return M[t]?t:(console.warn(`Unknown annotation type: '${t}', defaulting to 'line'`),"line")}function In(t,e,n,o){const r=On(t,n.animations,o),i=e.annotations,s=Wn(e.elements,i);for(let a=0;a<i.length;a++){const d=i[a],l=dt(s,a,d.type),c=d.setContext(Rn(t,l,d)),u=l.resolveElementProperties(t,c);u.skip=Tn(u),"elements"in u&&(En(l,u.elements,c,r),delete u.elements),p(l.x)||Object.assign(l,u),Object.assign(l,u.initProperties),u.options=lt(c),r.update(l,u)}}function Tn(t){return isNaN(t.x)||isNaN(t.y)}function On(t,e,n){return n==="reset"||n==="none"||n==="resize"?An:new mt(t,e)}function En(t,e,n,o){const r=t.elements||(t.elements=[]);r.length=e.length;for(let i=0;i<e.length;i++){const s=e[i],a=s.properties,d=dt(r,i,s.type,s.initProperties),l=n[s.optionScope].override(s);a.options=lt(l),o.update(d,a)}}function dt(t,e,n,o){const r=M[Me(n)];let i=t[e];return(!i||!(i instanceof r))&&(i=t[e]=new r,Object.assign(i,o)),i}function lt(t){const e=M[Me(t.type)],n={};n.id=t.id,n.type=t.type,n.drawTime=t.drawTime,Object.assign(n,ue(t,e.defaults),ue(t,e.defaultRoutes));for(const o of Dn)n[o]=t[o];return n}function ue(t,e){const n={};for(const o of Object.keys(e)){const r=e[o],i=t[o];ce(o)&&A(i)?n[o]=i.map(s=>Ne(s,r)):n[o]=Ne(i,r)}return n}function Rn(t,e,n){return e.$context||(e.$context=Object.assign(Object.create(t.getContext()),{element:e,id:n.id,type:"annotation"}))}function Wn(t,e){const n=e.length,o=t.length;if(o<n){const r=n-o;t.splice(o,0,...new Array(r))}else o>n&&t.splice(n,o-n);return t}var Ln="2.2.1";const S=new Map,Yn=xe.concat(G);var Bn={id:"annotation",version:Ln,beforeRegister(){Pt("chart.js","3.7",oe.version)},afterRegister(){oe.register(M)},afterUnregister(){oe.unregister(M)},beforeInit(t){S.set(t,{annotations:[],elements:[],visibleElements:[],listeners:{},listened:!1,moveListened:!1,hooks:{},hooked:!1,hovered:[]})},beforeUpdate(t,e,n){const o=S.get(t),r=o.annotations=[];let i=n.annotations;B(i)?Object.keys(i).forEach(s=>{const a=i[s];B(a)&&(a.id=s,r.push(a))}):A(i)&&r.push(...i),Gt(r,t.scales)},afterDataLimits(t,e){const n=S.get(t);Kt(t,e.scale,n.annotations.filter(o=>o.display&&o.adjustScaleRange))},afterUpdate(t,e,n){const o=S.get(t);$t(t,o,n),In(t,o,n,e.mode),o.visibleElements=o.elements.filter(r=>!r.skip&&r.options.display),qt(t,o,n)},beforeDatasetsDraw(t,e,n){U(t,"beforeDatasetsDraw",n.clip)},afterDatasetsDraw(t,e,n){U(t,"afterDatasetsDraw",n.clip)},beforeDraw(t,e,n){U(t,"beforeDraw",n.clip)},afterDraw(t,e,n){U(t,"afterDraw",n.clip)},beforeEvent(t,e,n){const o=S.get(t);Vt(o,e.event,n)&&(e.changed=!0)},afterDestroy(t){S.delete(t)},_getState(t){return S.get(t)},defaults:{animations:{numbers:{properties:["x","y","x2","y2","width","height","centerX","centerY","pointX","pointY","radius"],type:"number"}},clip:!0,interaction:{mode:void 0,axis:void 0,intersect:void 0},common:{drawTime:"afterDatasetsDraw",init:!1,label:{}}},descriptors:{_indexable:!1,_scriptable:t=>!Yn.includes(t)&&t!=="init",annotations:{_allKeys:!1,_fallback:(t,e)=>`elements.${M[Me(e.type)].id}`},interaction:{_fallback:!0},common:{label:{_indexable:ce,_fallback:!0},_indexable:ce}},additionalOptionScopes:[""]};function U(t,e,n){const{ctx:o,chartArea:r}=t,i=S.get(t);n&&ft(o,r);const s=zn(i.visibleElements,e).sort((a,d)=>a.element.options.z-d.element.options.z);for(const a of s)Xn(o,r,i,a);n&&ht(o)}function zn(t,e){const n=[];for(const o of t)if(o.options.drawTime===e&&n.push({element:o,main:!0}),o.elements&&o.elements.length)for(const r of o.elements)r.options.display&&r.options.drawTime===e&&n.push({element:r});return n}function Xn(t,e,n,o){const r=o.element;o.main?(De(n,r,"beforeDraw"),r.draw(t,e),De(n,r,"afterDraw")):r.draw(t,e)}const Hn=(t,e,n)=>{if(typeof t=="string")return t;const o=Number.parseInt(t.toString());return o>999999?`${o/1e6}M`:o>999?`${o/1e3}k`:o};export{Bn as a,Hn as f};
6
+ */const ke={modes:{point(t,e){return q(t,e,{intersect:!0})},nearest(t,e,n){return xt(t,e,n)},x(t,e,n){return q(t,e,{intersect:n.intersect,axis:"x"})},y(t,e,n){return q(t,e,{intersect:n.intersect,axis:"y"})}}};function ye(t,e,n){return(ke.modes[n.mode]||ke.modes.nearest)(t,e,n)}function pt(t,e,n){return n!=="x"&&n!=="y"?t.inRange(e.x,e.y,"x",!0)||t.inRange(e.x,e.y,"y",!0):t.inRange(e.x,e.y,n,!0)}function wt(t,e,n){return n==="x"?{x:t.x,y:e.y}:n==="y"?{x:e.x,y:t.y}:e}function q(t,e,n){return t.visibleElements.filter(o=>n.intersect?o.inRange(e.x,e.y):pt(o,e,n.axis))}function xt(t,e,n){let o=Number.POSITIVE_INFINITY;return q(t,e,n).reduce((r,i)=>{const s=i.getCenterPoint(),a=wt(e,s,n.axis),d=fe(e,a);return d<o?(r=[i],o=d):d===o&&r.push(i),r},[]).sort((r,i)=>r._index-i._index).slice(0,1)}const St=(t,e)=>e>t||t.length>e.length&&t.slice(0,e.length)===e,v=.001,F=(t,e,n)=>Math.min(n,Math.max(e,t));function Mt(t,e,n){for(const o of Object.keys(t))t[o]=F(t[o],e,n);return t}function Ct(t,e,n,o){if(!t||!e||n<=0)return!1;const r=o/2;return Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)<=Math.pow(n+r,2)}function Je(t,{x:e,y:n,x2:o,y2:r},i,s){const a=s/2,d=t.x>=e-a-v&&t.x<=o+a+v,l=t.y>=n-a-v&&t.y<=r+a+v;return i==="x"?d:(i==="y"||d)&&l}function R(t,e){const{centerX:n,centerY:o}=t.getProps(["centerX","centerY"],e);return{x:n,y:o}}function Pt(t,e,n,o=!0){const r=n.split(".");let i=0;for(const s of e.split(".")){const a=r[i++];if(parseInt(s,10)<parseInt(a,10))break;if(St(a,s)){if(o)throw new Error(`${t} v${n} is not supported. v${e} or newer is required.`);return!1}}return!0}const Ue=t=>typeof t=="string"&&t.endsWith("%"),qe=t=>parseFloat(t)/100,Ge=t=>F(qe(t),0,1);function be(t,e){return e==="start"?0:e==="end"?t:Ue(e)?Ge(e)*t:t/2}function C(t,e,n=!0){return typeof e=="number"?e:Ue(e)?(n?Ge(e):qe(e))*t:t}function kt(t,e){const{x:n,width:o}=t,r=e.textAlign;return r==="center"?n+o/2:r==="end"||r==="right"?n+o:n}function ge(t,e="center"){return B(t)?{x:_(t.x,e),y:_(t.y,e)}:(t=_(t,e),{x:t,y:t})}function Ke(t){return t&&(p(t.xValue)||p(t.yValue))}function H(t,e,n,o=!1){const r=n.init;if(r){if(r===!0)return Fe(e,o)}else return;return jt(e,o,he(r,[{chart:t,properties:e,options:n}]))}function Qe(t,e,n){let o=!1;return e.forEach(r=>{T(t[r])?(o=!0,n[r]=t[r]):p(n[r])&&delete n[r]}),o}function Fe({centerX:t,centerY:e},n){return n?{centerX:t,centerY:e,radius:0,width:0,height:0}:{x:t,y:e,x2:t,y2:e,width:0,height:0}}function jt(t,e,n){if(n===!0)return Fe(t,e);if(B(n))return n}const re=new Map,vt=t=>isNaN(t)||t<=0,At=t=>t.reduce(function(e,n){return e+=n.string,e},"");function Z(t){if(t&&typeof t=="object"){const e=t.toString();return e==="[object HTMLImageElement]"||e==="[object HTMLCanvasElement]"}}function me(t,{x:e,y:n},o){o&&(t.translate(e,n),t.rotate(w(o)),t.translate(-e,-n))}function P(t,e){if(e&&e.borderWidth)return t.lineCap=e.borderCapStyle,t.setLineDash(e.borderDash),t.lineDashOffset=e.borderDashOffset,t.lineJoin=e.borderJoinStyle,t.lineWidth=e.borderWidth,t.strokeStyle=e.borderColor,!0}function W(t,e){t.shadowColor=e.backgroundShadowColor,t.shadowBlur=e.shadowBlur,t.shadowOffsetX=e.shadowOffsetX,t.shadowOffsetY=e.shadowOffsetY}function pe(t,e){const n=e.content;if(Z(n))return{width:C(n.width,e.width),height:C(n.height,e.height)};const o=e.font,r=A(o)?o.map(d=>G(d)):[G(o)],i=e.textStrokeWidth,s=A(n)?n:[n],a=s.join()+At(r)+i+(t._measureText?"-spriting":"");return re.has(a)||re.set(a,Et(t,s,r,i)),re.get(a)}function Ze(t,e,n){const{x:o,y:r,width:i,height:s}=e;t.save(),W(t,n);const a=P(t,n);t.fillStyle=n.backgroundColor,t.beginPath(),yt(t,{x:o,y:r,w:i,h:s,radius:Mt(bt(n.borderRadius),0,Math.min(i,s)/2)}),t.closePath(),t.fill(),a&&(t.shadowColor=n.borderShadowColor,t.stroke()),t.restore()}function Dt(t,e,n){const o=n.content;if(Z(o)){t.save(),t.globalAlpha=Lt(n.opacity,o.style.opacity),t.drawImage(o,e.x,e.y,e.width,e.height),t.restore();return}const r=A(o)?o:[o],i=n.font,s=A(i)?i.map(u=>G(u)):[G(i)],a=n.color,d=A(a)?a:[a],l=kt(e,n),c=e.y+n.textStrokeWidth/2;t.save(),t.textBaseline="middle",t.textAlign=n.textAlign,It(t,n)&&Rt(t,{x:l,y:c},r,s),Wt(t,{x:l,y:c},r,{fonts:s,colors:d}),t.restore()}function It(t,e){if(e.textStrokeWidth>0)return t.lineJoin="round",t.miterLimit=2,t.lineWidth=e.textStrokeWidth,t.strokeStyle=e.textStrokeColor,!0}function Tt(t,e,n,o){const{radius:r,options:i}=e,s=i.pointStyle,a=i.rotation;let d=(a||0)*Ve;if(Z(s)){t.save(),t.translate(n,o),t.rotate(d),t.drawImage(s,-s.width/2,-s.height/2,s.width,s.height),t.restore();return}vt(r)||Ot(t,{x:n,y:o,radius:r,rotation:a,style:s,rad:d})}function Ot(t,{x:e,y:n,radius:o,rotation:r,style:i,rad:s}){let a,d,l,c;switch(t.beginPath(),i){default:t.arc(e,n,o,0,gt),t.closePath();break;case"triangle":t.moveTo(e+Math.sin(s)*o,n-Math.cos(s)*o),s+=Ce,t.lineTo(e+Math.sin(s)*o,n-Math.cos(s)*o),s+=Ce,t.lineTo(e+Math.sin(s)*o,n-Math.cos(s)*o),t.closePath();break;case"rectRounded":c=o*.516,l=o-c,a=Math.cos(s+z)*l,d=Math.sin(s+z)*l,t.arc(e-a,n-d,c,s-b,s-J),t.arc(e+d,n-a,c,s-J,s),t.arc(e+a,n+d,c,s,s+J),t.arc(e-d,n+a,c,s+J,s+b),t.closePath();break;case"rect":if(!r){l=Math.SQRT1_2*o,t.rect(e-l,n-l,2*l,2*l);break}s+=z;case"rectRot":a=Math.cos(s)*o,d=Math.sin(s)*o,t.moveTo(e-a,n-d),t.lineTo(e+d,n-a),t.lineTo(e+a,n+d),t.lineTo(e-d,n+a),t.closePath();break;case"crossRot":s+=z;case"cross":a=Math.cos(s)*o,d=Math.sin(s)*o,t.moveTo(e-a,n-d),t.lineTo(e+a,n+d),t.moveTo(e+d,n-a),t.lineTo(e-d,n+a);break;case"star":a=Math.cos(s)*o,d=Math.sin(s)*o,t.moveTo(e-a,n-d),t.lineTo(e+a,n+d),t.moveTo(e+d,n-a),t.lineTo(e-d,n+a),s+=z,a=Math.cos(s)*o,d=Math.sin(s)*o,t.moveTo(e-a,n-d),t.lineTo(e+a,n+d),t.moveTo(e+d,n-a),t.lineTo(e-d,n+a);break;case"line":a=Math.cos(s)*o,d=Math.sin(s)*o,t.moveTo(e-a,n-d),t.lineTo(e+a,n+d);break;case"dash":t.moveTo(e,n),t.lineTo(e+Math.cos(s)*o,n+Math.sin(s)*o);break}t.fill()}function Et(t,e,n,o){t.save();const r=e.length;let i=0,s=o;for(let a=0;a<r;a++){const d=n[Math.min(a,n.length-1)];t.font=d.string;const l=e[a];i=Math.max(i,t.measureText(l).width+o),s+=d.lineHeight}return t.restore(),{width:i,height:s}}function Rt(t,{x:e,y:n},o,r){t.beginPath();let i=0;o.forEach(function(s,a){const d=r[Math.min(a,r.length-1)],l=d.lineHeight;t.font=d.string,t.strokeText(s,e,n+l/2+i),i+=l}),t.stroke()}function Wt(t,{x:e,y:n},o,{fonts:r,colors:i}){let s=0;o.forEach(function(a,d){const l=i[Math.min(d,i.length-1)],c=r[Math.min(d,r.length-1)],u=c.lineHeight;t.beginPath(),t.font=c.string,t.fillStyle=l,t.fillText(a,e,n+u/2+s),s+=u,t.fill()})}function Lt(t,e){const n=Pe(t)?t:e;return Pe(n)?F(n,0,1):1}const je={xScaleID:{min:"xMin",max:"xMax",start:"left",end:"right",startProp:"x",endProp:"x2"},yScaleID:{min:"yMin",max:"yMax",start:"bottom",end:"top",startProp:"y",endProp:"y2"}};function O(t,e,n){return e=typeof e=="number"?e:t.parse(e),$e(e)?t.getPixelForValue(e):n}function D(t,e,n){const o=e[n];if(o||n==="scaleID")return o;const r=n.charAt(0),i=Object.values(t).filter(s=>s.axis&&s.axis===r);return i.length?i[0].id:r}function et(t,e){if(t){const n=t.options.reverse,o=O(t,e.min,n?e.end:e.start),r=O(t,e.max,n?e.start:e.end);return{start:o,end:r}}}function tt(t,e){const{chartArea:n,scales:o}=t,r=o[D(o,e,"xScaleID")],i=o[D(o,e,"yScaleID")];let s=n.width/2,a=n.height/2;return r&&(s=O(r,e.xValue,r.left+r.width/2)),i&&(a=O(i,e.yValue,i.top+i.height/2)),{x:s,y:a}}function we(t,e){const n=t.scales,o=n[D(n,e,"xScaleID")],r=n[D(n,e,"yScaleID")];if(!o&&!r)return{};let{left:i,right:s}=o||t.chartArea,{top:a,bottom:d}=r||t.chartArea;const l=ve(o,{min:e.xMin,max:e.xMax,start:i,end:s});i=l.start,s=l.end;const c=ve(r,{min:e.yMin,max:e.yMax,start:d,end:a});return a=c.start,d=c.end,{x:i,y:a,x2:s,y2:d,width:s-i,height:d-a,centerX:i+(s-i)/2,centerY:a+(d-a)/2}}function nt(t,e){if(!Ke(e)){const n=we(t,e);let o=e.radius;(!o||isNaN(o))&&(o=Math.min(n.width,n.height)/2,e.radius=o);const r=o*2,i=n.centerX+e.xAdjust,s=n.centerY+e.yAdjust;return{x:i-o,y:s-o,x2:i+o,y2:s+o,centerX:i,centerY:s,width:r,height:r,radius:o}}return zt(t,e)}function Yt(t,e){const{scales:n,chartArea:o}=t,r=n[e.scaleID],i={x:o.left,y:o.top,x2:o.right,y2:o.bottom};return r?Xt(r,i,e):_t(n,i,e),i}function ot(t,e,n){const o=we(t,e);return o.initProperties=H(t,o,e,n),o.elements=[{type:"label",optionScope:"label",properties:Nt(t,o,e),initProperties:o.initProperties}],o}function zt(t,e){const n=tt(t,e),o=e.radius*2;return{x:n.x-e.radius+e.xAdjust,y:n.y-e.radius+e.yAdjust,x2:n.x+e.radius+e.xAdjust,y2:n.y+e.radius+e.yAdjust,centerX:n.x+e.xAdjust,centerY:n.y+e.yAdjust,radius:e.radius,width:o,height:o}}function ve(t,e){const n=et(t,e)||e;return{start:Math.min(n.start,n.end),end:Math.max(n.start,n.end)}}function Xt(t,e,n){const o=O(t,n.value,NaN),r=O(t,n.endValue,o);t.isHorizontal()?(e.x=o,e.x2=r):(e.y=o,e.y2=r)}function _t(t,e,n){for(const o of Object.keys(je)){const r=t[D(t,n,o)];if(r){const{min:i,max:s,start:a,end:d,startProp:l,endProp:c}=je[o],u=et(r,{min:n[i],max:n[s],start:r[a],end:r[d]});e[l]=u.start,e[c]=u.end}}}function Bt({properties:t,options:e},n,o,r){const{x:i,x2:s,width:a}=t;return rt({start:i,end:s,size:a,borderWidth:e.borderWidth},{position:o.x,padding:{start:r.left,end:r.right},adjust:e.label.xAdjust,size:n.width})}function Ht({properties:t,options:e},n,o,r){const{y:i,y2:s,height:a}=t;return rt({start:i,end:s,size:a,borderWidth:e.borderWidth},{position:o.y,padding:{start:r.top,end:r.bottom},adjust:e.label.yAdjust,size:n.height})}function rt(t,e){const{start:n,end:o,borderWidth:r}=t,{position:i,padding:{start:s,end:a},adjust:d}=e,l=o-r-n-s-a-e.size;return n+r/2+d+be(l,i)}function Nt(t,e,n){const o=n.label;o.backgroundColor="transparent",o.callout.display=!1;const r=ge(o.position),i=Q(o.padding),s=pe(t.ctx,o),a=Bt({properties:e,options:n},s,r,i),d=Ht({properties:e,options:n},s,r,i),l=s.width+i.width,c=s.height+i.height;return{x:a,y:d,x2:a+l,y2:d+c,width:l,height:c,centerX:a+l/2,centerY:d+c/2,rotation:o.rotation}}function I(t,e,n){const o=Math.cos(n),r=Math.sin(n),i=e.x,s=e.y;return{x:i+o*(t.x-i)-r*(t.y-s),y:s+r*(t.x-i)+o*(t.y-s)}}const ie=["enter","leave"],xe=ie.concat("click");function $t(t,e,n){e.listened=Qe(n,xe,e.listeners),e.moveListened=!1,e._getElements=ye,ie.forEach(o=>{T(n[o])&&(e.moveListened=!0)}),(!e.listened||!e.moveListened)&&e.annotations.forEach(o=>{!e.listened&&T(o.click)&&(e.listened=!0),e.moveListened||ie.forEach(r=>{T(o[r])&&(e.listened=!0,e.moveListened=!0)})})}function Vt(t,e,n){if(t.listened)switch(e.type){case"mousemove":case"mouseout":return Jt(t,e,n);case"click":return Ut(t,e,n)}}function Jt(t,e,n){if(!t.moveListened)return;let o;e.type==="mousemove"?o=ye(t,e,n.interaction):o=[];const r=t.hovered;t.hovered=o;const i={state:t,event:e};let s=Ae(i,"leave",r,o);return Ae(i,"enter",o,r)||s}function Ae({state:t,event:e},n,o,r){let i;for(const s of o)r.indexOf(s)<0&&(i=it(s.options[n]||t.listeners[n],s,e)||i);return i}function Ut(t,e,n){const o=t.listeners,r=ye(t,e,n.interaction);let i;for(const s of r)i=it(s.options.click||o.click,s,e)||i;return i}function it(t,e,n){return he(t,[e.$context,n])===!0}const K=["afterDraw","beforeDraw"];function qt(t,e,n){const o=e.visibleElements;e.hooked=Qe(n,K,e.hooks),e.hooked||o.forEach(r=>{e.hooked||K.forEach(i=>{T(r.options[i])&&(e.hooked=!0)})})}function De(t,e,n){if(t.hooked){const o=e.options[n]||t.hooks[n];return he(o,[e.$context])}}function Gt(t,e,n){const o=en(t.scales,e,n);let r=Ie(e,o,"min","suggestedMin");r=Ie(e,o,"max","suggestedMax")||r,r&&T(e.handleTickRangeOptions)&&e.handleTickRangeOptions()}function Kt(t,e){for(const n of t)Ft(n,e)}function Ie(t,e,n,o){if($e(e[n])&&!Qt(t.options,n,o)){const r=t[n]!==e[n];return t[n]=e[n],r}}function Qt(t,e,n){return p(t[e])||p(t[n])}function Ft(t,e){for(const n of["scaleID","xScaleID","yScaleID"]){const o=D(e,t,n);o&&!e[o]&&Zt(t,n)&&console.warn(`No scale found with id '${o}' for annotation '${t.id}'`)}}function Zt(t,e){if(e==="scaleID")return!0;const n=e.charAt(0);for(const o of["Min","Max","Value"])if(p(t[n+o]))return!0;return!1}function en(t,e,n){const o=e.axis,r=e.id,i=o+"ScaleID",s={min:_(e.min,Number.NEGATIVE_INFINITY),max:_(e.max,Number.POSITIVE_INFINITY)};for(const a of n)a.scaleID===r?Te(a,e,["value","endValue"],s):D(t,a,i)===r&&Te(a,e,[o+"Min",o+"Max",o+"Value"],s);return s}function Te(t,e,n,o){for(const r of n){const i=t[r];if(p(i)){const s=e.parse(i);o.min=Math.min(o.min,s),o.max=Math.max(o.max,s)}}}class L extends E{inRange(e,n,o,r){const{x:i,y:s}=I({x:e,y:n},this.getCenterPoint(r),w(-this.options.rotation));return Je({x:i,y:s},this.getProps(["x","y","x2","y2"],r),o,this.options.borderWidth)}getCenterPoint(e){return R(this,e)}draw(e){e.save(),me(e,this.getCenterPoint(),this.options.rotation),Ze(e,this,this.options),e.restore()}get label(){return this.elements&&this.elements[0]}resolveElementProperties(e,n){return ot(e,n)}}L.id="boxAnnotation";L.defaults={adjustScaleRange:!0,backgroundShadowColor:"transparent",borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderRadius:0,borderShadowColor:"transparent",borderWidth:1,display:!0,init:void 0,label:{backgroundColor:"transparent",borderWidth:0,callout:{display:!1},color:"black",content:null,display:!1,drawTime:void 0,font:{family:void 0,lineHeight:void 0,size:void 0,style:void 0,weight:"bold"},height:void 0,opacity:void 0,padding:6,position:"center",rotation:void 0,textAlign:"start",textStrokeColor:void 0,textStrokeWidth:0,width:void 0,xAdjust:0,yAdjust:0,z:void 0},rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,xMax:void 0,xMin:void 0,xScaleID:void 0,yMax:void 0,yMin:void 0,yScaleID:void 0,z:0};L.defaultRoutes={borderColor:"color",backgroundColor:"color"};L.descriptors={label:{_fallback:!0}};const st=["left","bottom","top","right"];class N extends E{inRange(e,n,o,r){const{x:i,y:s}=I({x:e,y:n},this.getCenterPoint(r),w(-this.rotation));return Je({x:i,y:s},this.getProps(["x","y","x2","y2"],r),o,this.options.borderWidth)}getCenterPoint(e){return R(this,e)}draw(e){const n=this.options,o=!p(this._visible)||this._visible;!n.display||!n.content||!o||(e.save(),me(e,this.getCenterPoint(),this.rotation),nn(e,this),Ze(e,this,n),Dt(e,cn(this),n),e.restore())}resolveElementProperties(e,n){let o;if(Ke(n))o=tt(e,n);else{const{centerX:a,centerY:d}=we(e,n);o={x:a,y:d}}const r=Q(n.padding),i=pe(e.ctx,n),s=tn(o,i,n,r);return{initProperties:H(e,s,n),pointX:o.x,pointY:o.y,...s,rotation:n.rotation}}}N.id="labelAnnotation";N.defaults={adjustScaleRange:!0,backgroundColor:"transparent",backgroundShadowColor:"transparent",borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderRadius:0,borderShadowColor:"transparent",borderWidth:0,callout:{borderCapStyle:"butt",borderColor:void 0,borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:1,display:!1,margin:5,position:"auto",side:5,start:"50%"},color:"black",content:null,display:!0,font:{family:void 0,lineHeight:void 0,size:void 0,style:void 0,weight:void 0},height:void 0,init:void 0,opacity:void 0,padding:6,position:"center",rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,textAlign:"center",textStrokeColor:void 0,textStrokeWidth:0,width:void 0,xAdjust:0,xMax:void 0,xMin:void 0,xScaleID:void 0,xValue:void 0,yAdjust:0,yMax:void 0,yMin:void 0,yScaleID:void 0,yValue:void 0,z:0};N.defaultRoutes={borderColor:"color"};function tn(t,e,n,o){const r=e.width+o.width+n.borderWidth,i=e.height+o.height+n.borderWidth,s=ge(n.position,"center"),a=Oe(t.x,r,n.xAdjust,s.x),d=Oe(t.y,i,n.yAdjust,s.y);return{x:a,y:d,x2:a+r,y2:d+i,width:r,height:i,centerX:a+r/2,centerY:d+i/2}}function Oe(t,e,n=0,o){return t-be(e,o)+n}function nn(t,e){const{pointX:n,pointY:o,options:r}=e,i=r.callout,s=i&&i.display&&dn(e,i);if(!s||un(e,i,s))return;if(t.save(),t.beginPath(),!P(t,i))return t.restore();const{separatorStart:d,separatorEnd:l}=on(e,s),{sideStart:c,sideEnd:u}=sn(e,s,d);(i.margin>0||r.borderWidth===0)&&(t.moveTo(d.x,d.y),t.lineTo(l.x,l.y)),t.moveTo(c.x,c.y),t.lineTo(u.x,u.y);const f=I({x:n,y:o},e.getCenterPoint(),w(-e.rotation));t.lineTo(f.x,f.y),t.stroke(),t.restore()}function on(t,e){const{x:n,y:o,x2:r,y2:i}=t,s=rn(t,e);let a,d;return e==="left"||e==="right"?(a={x:n+s,y:o},d={x:a.x,y:i}):(a={x:n,y:o+s},d={x:r,y:a.y}),{separatorStart:a,separatorEnd:d}}function rn(t,e){const{width:n,height:o,options:r}=t,i=r.callout.margin+r.borderWidth/2;return e==="right"?n+i:e==="bottom"?o+i:-i}function sn(t,e,n){const{y:o,width:r,height:i,options:s}=t,a=s.callout.start,d=an(e,s.callout);let l,c;return e==="left"||e==="right"?(l={x:n.x,y:o+C(i,a)},c={x:l.x+d,y:l.y}):(l={x:n.x+C(r,a),y:n.y},c={x:l.x,y:l.y+d}),{sideStart:l,sideEnd:c}}function an(t,e){const n=e.side;return t==="left"||t==="top"?-n:n}function dn(t,e){const n=e.position;return st.includes(n)?n:ln(t,e)}function ln(t,e){const{x:n,y:o,x2:r,y2:i,width:s,height:a,pointX:d,pointY:l,centerX:c,centerY:u,rotation:f}=t,h={x:c,y:u},y=e.start,x=C(s,y),Y=C(a,y),g=[n,n+x,n+x,r],m=[o+Y,i,o,i],k=[];for(let j=0;j<4;j++){const ne=I({x:g[j],y:m[j]},h,w(f));k.push({position:st[j],distance:fe(ne,{x:d,y:l})})}return k.sort((j,ne)=>j.distance-ne.distance)[0].position}function cn({x:t,y:e,width:n,height:o,options:r}){const i=r.borderWidth/2,s=Q(r.padding);return{x:t+s.left+i,y:e+s.top+i,width:n-s.left-s.right-r.borderWidth,height:o-s.top-s.bottom-r.borderWidth}}function un(t,e,n){const{pointX:o,pointY:r}=t,i=e.margin;let s=o,a=r;return n==="left"?s+=i:n==="right"?s-=i:n==="top"?a+=i:n==="bottom"&&(a-=i),t.inRange(s,a)}const Se=(t,e,n)=>({x:t.x+n*(e.x-t.x),y:t.y+n*(e.y-t.y)}),se=(t,e,n)=>Se(e,n,Math.abs((t-e.y)/(n.y-e.y))).x,Ee=(t,e,n)=>Se(e,n,Math.abs((t-e.x)/(n.x-e.x))).y,X=t=>t*t,fn=(t,e,{x:n,y:o,x2:r,y2:i},s)=>s==="y"?{start:Math.min(o,i),end:Math.max(o,i),value:e}:{start:Math.min(n,r),end:Math.max(n,r),value:t},Re=(t,e,n,o)=>(1-o)*(1-o)*t+2*(1-o)*o*e+o*o*n,ae=(t,e,n,o)=>({x:Re(t.x,e.x,n.x,o),y:Re(t.y,e.y,n.y,o)}),We=(t,e,n,o)=>2*(1-o)*(e-t)+2*o*(n-e),Le=(t,e,n,o)=>-Math.atan2(We(t.x,e.x,n.x,o),We(t.y,e.y,n.y,o))+.5*b;class $ extends E{inRange(e,n,o,r){const i=this.options.borderWidth/2;if(o!=="x"&&o!=="y"){const s={mouseX:e,mouseY:n},{path:a,ctx:d}=this;if(a){P(d,this.options);const{chart:c}=this.$context,u=e*c.currentDevicePixelRatio,f=n*c.currentDevicePixelRatio,h=d.isPointInStroke(a,u,f)||de(this,s,r);return d.restore(),h}const l=X(i);return gn(this,s,l,r)||de(this,s,r)}return hn(this,{mouseX:e,mouseY:n},o,{hBorderWidth:i,useFinalPosition:r})}getCenterPoint(e){return R(this,e)}draw(e){const{x:n,y:o,x2:r,y2:i,cp:s,options:a}=this;if(e.save(),!P(e,a))return e.restore();W(e,a);const d=Math.sqrt(Math.pow(r-n,2)+Math.pow(i-o,2));if(a.curve&&s)return Pn(e,this,s,d),e.restore();const{startOpts:l,endOpts:c,startAdjust:u,endAdjust:f}=at(this),h=Math.atan2(i-o,r-n);e.translate(n,o),e.rotate(h),e.beginPath(),e.moveTo(0+u,0),e.lineTo(d-f,0),e.shadowColor=a.borderShadowColor,e.stroke(),le(e,0,u,l),le(e,d,-f,c),e.restore()}get label(){return this.elements&&this.elements[0]}resolveElementProperties(e,n){const o=Yt(e,n),{x:r,y:i,x2:s,y2:a}=o,d=yn(o,e.chartArea),l=d?bn({x:r,y:i},{x:s,y:a},e.chartArea):{x:r,y:i,x2:s,y2:a,width:Math.abs(s-r),height:Math.abs(a-i)};if(l.centerX=(s+r)/2,l.centerY=(a+i)/2,l.initProperties=H(e,l,n),n.curve){const u={x:l.x,y:l.y},f={x:l.x2,y:l.y2};l.cp=Cn(l,n,fe(u,f))}const c=mn(e,l,n.label);return c._visible=d,l.elements=[{type:"label",optionScope:"label",properties:c,initProperties:l.initProperties}],l}}$.id="lineAnnotation";const Ye={backgroundColor:void 0,backgroundShadowColor:void 0,borderColor:void 0,borderDash:void 0,borderDashOffset:void 0,borderShadowColor:void 0,borderWidth:void 0,display:void 0,fill:void 0,length:void 0,shadowBlur:void 0,shadowOffsetX:void 0,shadowOffsetY:void 0,width:void 0};$.defaults={adjustScaleRange:!0,arrowHeads:{display:!1,end:Object.assign({},Ye),fill:!1,length:12,start:Object.assign({},Ye),width:6},borderDash:[],borderDashOffset:0,borderShadowColor:"transparent",borderWidth:2,curve:!1,controlPoint:{y:"-50%"},display:!0,endValue:void 0,init:void 0,label:{backgroundColor:"rgba(0,0,0,0.8)",backgroundShadowColor:"transparent",borderCapStyle:"butt",borderColor:"black",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderRadius:6,borderShadowColor:"transparent",borderWidth:0,callout:Object.assign({},N.defaults.callout),color:"#fff",content:null,display:!1,drawTime:void 0,font:{family:void 0,lineHeight:void 0,size:void 0,style:void 0,weight:"bold"},height:void 0,opacity:void 0,padding:6,position:"center",rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,textAlign:"center",textStrokeColor:void 0,textStrokeWidth:0,width:void 0,xAdjust:0,yAdjust:0,z:void 0},scaleID:void 0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,value:void 0,xMax:void 0,xMin:void 0,xScaleID:void 0,yMax:void 0,yMin:void 0,yScaleID:void 0,z:0};$.descriptors={arrowHeads:{start:{_fallback:!0},end:{_fallback:!0},_fallback:!0}};$.defaultRoutes={borderColor:"color"};function hn(t,{mouseX:e,mouseY:n},o,{hBorderWidth:r,useFinalPosition:i}){const s=fn(e,n,t.getProps(["x","y","x2","y2"],i),o);return s.value>=s.start-r&&s.value<=s.end+r||de(t,{mouseX:e,mouseY:n},i,o)}function yn({x:t,y:e,x2:n,y2:o},{top:r,right:i,bottom:s,left:a}){return!(t<a&&n<a||t>i&&n>i||e<r&&o<r||e>s&&o>s)}function ze({x:t,y:e},n,{top:o,right:r,bottom:i,left:s}){return t<s&&(e=Ee(s,{x:t,y:e},n),t=s),t>r&&(e=Ee(r,{x:t,y:e},n),t=r),e<o&&(t=se(o,{x:t,y:e},n),e=o),e>i&&(t=se(i,{x:t,y:e},n),e=i),{x:t,y:e}}function bn(t,e,n){const{x:o,y:r}=ze(t,e,n),{x:i,y:s}=ze(e,t,n);return{x:o,y:r,x2:i,y2:s,width:Math.abs(i-o),height:Math.abs(s-r)}}function gn(t,{mouseX:e,mouseY:n},o=v,r){const{x:i,y:s,x2:a,y2:d}=t.getProps(["x","y","x2","y2"],r),l=a-i,c=d-s,u=X(l)+X(c),f=u===0?-1:((e-i)*l+(n-s)*c)/u;let h,y;return f<0?(h=i,y=s):f>1?(h=a,y=d):(h=i+f*l,y=s+f*c),X(e-h)+X(n-y)<=o}function de(t,{mouseX:e,mouseY:n},o,r){const i=t.label;return i.options.display&&i.inRange(e,n,r,o)}function mn(t,e,n){const o=n.borderWidth,r=Q(n.padding),i=pe(t.ctx,n),s=i.width+r.width+o,a=i.height+r.height+o;return wn(e,n,{width:s,height:a,padding:r},t.chartArea)}function pn(t){const{x:e,y:n,x2:o,y2:r}=t,i=Math.atan2(r-n,o-e);return i>b/2?i-b:i<b/-2?i+b:i}function wn(t,e,n,o){const{width:r,height:i,padding:s}=n,{xAdjust:a,yAdjust:d}=e,l={x:t.x,y:t.y},c={x:t.x2,y:t.y2},u=e.rotation==="auto"?pn(t):w(e.rotation),f=xn(r,i,u),h=Sn(t,e,{labelSize:f,padding:s},o),y=t.cp?ae(l,t.cp,c,h):Se(l,c,h),x={size:f.w,min:o.left,max:o.right,padding:s.left},Y={size:f.h,min:o.top,max:o.bottom,padding:s.top},g=_e(y.x,x)+a,m=_e(y.y,Y)+d;return{x:g-r/2,y:m-i/2,x2:g+r/2,y2:m+i/2,centerX:g,centerY:m,pointX:y.x,pointY:y.y,width:r,height:i,rotation:ut(u)}}function xn(t,e,n){const o=Math.cos(n),r=Math.sin(n);return{w:Math.abs(t*o)+Math.abs(e*r),h:Math.abs(t*r)+Math.abs(e*o)}}function Sn(t,e,n,o){let r;const i=Mn(t,o);return e.position==="start"?r=Xe({w:t.x2-t.x,h:t.y2-t.y},n,e,i):e.position==="end"?r=1-Xe({w:t.x-t.x2,h:t.y-t.y2},n,e,i):r=be(1,e.position),r}function Xe(t,e,n,o){const{labelSize:r,padding:i}=e,s=t.w*o.dx,a=t.h*o.dy,d=s>0&&(r.w/2+i.left-o.x)/s,l=a>0&&(r.h/2+i.top-o.y)/a;return F(Math.max(d,l),0,.25)}function Mn(t,e){const{x:n,x2:o,y:r,y2:i}=t,s=Math.min(r,i)-e.top,a=Math.min(n,o)-e.left,d=e.bottom-Math.max(r,i),l=e.right-Math.max(n,o);return{x:Math.min(a,l),y:Math.min(s,d),dx:a<=l?1:-1,dy:s<=d?1:-1}}function _e(t,e){const{size:n,min:o,max:r,padding:i}=e,s=n/2;return n>r-o?(r+o)/2:(o>=t-i-s&&(t=o+i+s),r<=t+i+s&&(t=r-i-s),t)}function at(t){const e=t.options,n=e.arrowHeads&&e.arrowHeads.start,o=e.arrowHeads&&e.arrowHeads.end;return{startOpts:n,endOpts:o,startAdjust:Be(t,n),endAdjust:Be(t,o)}}function Be(t,e){if(!e||!e.display)return 0;const{length:n,width:o}=e,r=t.options.borderWidth/2,i={x:n,y:o+r};return Math.abs(se(0,i,{x:0,y:r}))}function le(t,e,n,o){if(!o||!o.display)return;const{length:r,width:i,fill:s,backgroundColor:a,borderColor:d}=o,l=Math.abs(e-r)+n;t.beginPath(),W(t,o),P(t,o),t.moveTo(l,-i),t.lineTo(e+n,0),t.lineTo(l,i),s===!0?(t.fillStyle=a||d,t.closePath(),t.fill(),t.shadowColor="transparent"):t.shadowColor=o.borderShadowColor,t.stroke()}function Cn(t,e,n){const{x:o,y:r,x2:i,y2:s,centerX:a,centerY:d}=t,l=Math.atan2(s-r,i-o),c=ge(e.controlPoint,0),u={x:a+C(n,c.x,!1),y:d+C(n,c.y,!1)};return I(u,{x:a,y:d},l)}function He(t,{x:e,y:n},{angle:o,adjust:r},i){!i||!i.display||(t.save(),t.translate(e,n),t.rotate(o),le(t,0,-r,i),t.restore())}function Pn(t,e,n,o){const{x:r,y:i,x2:s,y2:a,options:d}=e,{startOpts:l,endOpts:c,startAdjust:u,endAdjust:f}=at(e),h={x:r,y:i},y={x:s,y:a},x=Le(h,n,y,0),Y=Le(h,n,y,1)-b,g=ae(h,n,y,u/o),m=ae(h,n,y,1-f/o),k=new Path2D;t.beginPath(),k.moveTo(g.x,g.y),k.quadraticCurveTo(n.x,n.y,m.x,m.y),t.shadowColor=d.borderShadowColor,t.stroke(k),e.path=k,e.ctx=t,He(t,g,{angle:x,adjust:u},l),He(t,m,{angle:Y,adjust:f},c)}class V extends E{inRange(e,n,o,r){const i=this.options.rotation,s=this.options.borderWidth;if(o!=="x"&&o!=="y")return kn({x:e,y:n},this.getProps(["width","height","centerX","centerY"],r),i,s);const{x:a,y:d,x2:l,y2:c}=this.getProps(["x","y","x2","y2"],r),u=s/2,f=o==="y"?{start:d,end:c}:{start:a,end:l},h=I({x:e,y:n},this.getCenterPoint(r),w(-i));return h[o]>=f.start-u-v&&h[o]<=f.end+u+v}getCenterPoint(e){return R(this,e)}draw(e){const{width:n,height:o,centerX:r,centerY:i,options:s}=this;e.save(),me(e,this.getCenterPoint(),s.rotation),W(e,this.options),e.beginPath(),e.fillStyle=s.backgroundColor;const a=P(e,s);e.ellipse(r,i,o/2,n/2,b/2,0,2*b),e.fill(),a&&(e.shadowColor=s.borderShadowColor,e.stroke()),e.restore()}get label(){return this.elements&&this.elements[0]}resolveElementProperties(e,n){return ot(e,n,!0)}}V.id="ellipseAnnotation";V.defaults={adjustScaleRange:!0,backgroundShadowColor:"transparent",borderDash:[],borderDashOffset:0,borderShadowColor:"transparent",borderWidth:1,display:!0,init:void 0,label:Object.assign({},L.defaults.label),rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,xMax:void 0,xMin:void 0,xScaleID:void 0,yMax:void 0,yMin:void 0,yScaleID:void 0,z:0};V.defaultRoutes={borderColor:"color",backgroundColor:"color"};V.descriptors={label:{_fallback:!0}};function kn(t,e,n,o){const{width:r,height:i,centerX:s,centerY:a}=e,d=r/2,l=i/2;if(d<=0||l<=0)return!1;const c=w(n||0),u=o/2||0,f=Math.cos(c),h=Math.sin(c),y=Math.pow(f*(t.x-s)+h*(t.y-a),2),x=Math.pow(h*(t.x-s)-f*(t.y-a),2);return y/Math.pow(d+u,2)+x/Math.pow(l+u,2)<=1.0001}class ee extends E{inRange(e,n,o,r){const{x:i,y:s,x2:a,y2:d,width:l}=this.getProps(["x","y","x2","y2","width"],r),c=this.options.borderWidth;if(o!=="x"&&o!=="y")return Ct({x:e,y:n},this.getCenterPoint(r),l/2,c);const u=c/2,f=o==="y"?{start:s,end:d,value:n}:{start:i,end:a,value:e};return f.value>=f.start-u&&f.value<=f.end+u}getCenterPoint(e){return R(this,e)}draw(e){const n=this.options,o=n.borderWidth;if(n.radius<.1)return;e.save(),e.fillStyle=n.backgroundColor,W(e,n);const r=P(e,n);Tt(e,this,this.centerX,this.centerY),r&&!Z(n.pointStyle)&&(e.shadowColor=n.borderShadowColor,e.stroke()),e.restore(),n.borderWidth=o}resolveElementProperties(e,n){const o=nt(e,n);return o.initProperties=H(e,o,n,!0),o}}ee.id="pointAnnotation";ee.defaults={adjustScaleRange:!0,backgroundShadowColor:"transparent",borderDash:[],borderDashOffset:0,borderShadowColor:"transparent",borderWidth:1,display:!0,init:void 0,pointStyle:"circle",radius:10,rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,xAdjust:0,xMax:void 0,xMin:void 0,xScaleID:void 0,xValue:void 0,yAdjust:0,yMax:void 0,yMin:void 0,yScaleID:void 0,yValue:void 0,z:0};ee.defaultRoutes={borderColor:"color",backgroundColor:"color"};class te extends E{inRange(e,n,o,r){if(o!=="x"&&o!=="y")return this.options.radius>=.1&&this.elements.length>1&&vn(this.elements,e,n,r);const i=I({x:e,y:n},this.getCenterPoint(r),w(-this.options.rotation)),s=this.elements.map(l=>o==="y"?l.bY:l.bX),a=Math.min(...s),d=Math.max(...s);return i[o]>=a&&i[o]<=d}getCenterPoint(e){return R(this,e)}draw(e){const{elements:n,options:o}=this;e.save(),e.beginPath(),e.fillStyle=o.backgroundColor,W(e,o);const r=P(e,o);let i=!0;for(const s of n)i?(e.moveTo(s.x,s.y),i=!1):e.lineTo(s.x,s.y);e.closePath(),e.fill(),r&&(e.shadowColor=o.borderShadowColor,e.stroke()),e.restore()}resolveElementProperties(e,n){const o=nt(e,n),{sides:r,rotation:i}=n,s=[],a=2*b/r;let d=i*Ve;for(let l=0;l<r;l++,d+=a){const c=jn(o,n,d);c.initProperties=H(e,o,n),s.push(c)}return o.elements=s,o}}te.id="polygonAnnotation";te.defaults={adjustScaleRange:!0,backgroundShadowColor:"transparent",borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderShadowColor:"transparent",borderWidth:1,display:!0,init:void 0,point:{radius:0},radius:10,rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,sides:3,xAdjust:0,xMax:void 0,xMin:void 0,xScaleID:void 0,xValue:void 0,yAdjust:0,yMax:void 0,yMin:void 0,yScaleID:void 0,yValue:void 0,z:0};te.defaultRoutes={borderColor:"color",backgroundColor:"color"};function jn({centerX:t,centerY:e},{radius:n,borderWidth:o},r){const i=o/2,s=Math.sin(r),a=Math.cos(r),d={x:t+s*n,y:e-a*n};return{type:"point",optionScope:"point",properties:{x:d.x,y:d.y,centerX:d.x,centerY:d.y,bX:t+s*(n+i),bY:e-a*(n+i)}}}function vn(t,e,n,o){let r=!1,i=t[t.length-1].getProps(["bX","bY"],o);for(const s of t){const a=s.getProps(["bX","bY"],o);a.bY>n!=i.bY>n&&e<(i.bX-a.bX)*(n-a.bY)/(i.bY-a.bY)+a.bX&&(r=!r),i=a}return r}const M={box:L,ellipse:V,label:N,line:$,point:ee,polygon:te};Object.keys(M).forEach(t=>{ct.describe(`elements.${M[t].id}`,{_fallback:"plugins.annotation.common"})});const An={update:Object.assign},Dn=xe.concat(K),Ne=(t,e)=>B(e)?ue(t,e):t,ce=t=>t==="color"||t==="font";function Me(t="line"){return M[t]?t:(console.warn(`Unknown annotation type: '${t}', defaulting to 'line'`),"line")}function In(t,e,n,o){const r=On(t,n.animations,o),i=e.annotations,s=Wn(e.elements,i);for(let a=0;a<i.length;a++){const d=i[a],l=dt(s,a,d.type),c=d.setContext(Rn(t,l,d)),u=l.resolveElementProperties(t,c);u.skip=Tn(u),"elements"in u&&(En(l,u.elements,c,r),delete u.elements),p(l.x)||Object.assign(l,u),Object.assign(l,u.initProperties),u.options=lt(c),r.update(l,u)}}function Tn(t){return isNaN(t.x)||isNaN(t.y)}function On(t,e,n){return n==="reset"||n==="none"||n==="resize"?An:new mt(t,e)}function En(t,e,n,o){const r=t.elements||(t.elements=[]);r.length=e.length;for(let i=0;i<e.length;i++){const s=e[i],a=s.properties,d=dt(r,i,s.type,s.initProperties),l=n[s.optionScope].override(s);a.options=lt(l),o.update(d,a)}}function dt(t,e,n,o){const r=M[Me(n)];let i=t[e];return(!i||!(i instanceof r))&&(i=t[e]=new r,Object.assign(i,o)),i}function lt(t){const e=M[Me(t.type)],n={};n.id=t.id,n.type=t.type,n.drawTime=t.drawTime,Object.assign(n,ue(t,e.defaults),ue(t,e.defaultRoutes));for(const o of Dn)n[o]=t[o];return n}function ue(t,e){const n={};for(const o of Object.keys(e)){const r=e[o],i=t[o];ce(o)&&A(i)?n[o]=i.map(s=>Ne(s,r)):n[o]=Ne(i,r)}return n}function Rn(t,e,n){return e.$context||(e.$context=Object.assign(Object.create(t.getContext()),{element:e,id:n.id,type:"annotation"}))}function Wn(t,e){const n=e.length,o=t.length;if(o<n){const r=n-o;t.splice(o,0,...new Array(r))}else o>n&&t.splice(n,o-n);return t}var Ln="2.2.1";const S=new Map,Yn=xe.concat(K);var Bn={id:"annotation",version:Ln,beforeRegister(){Pt("chart.js","3.7",oe.version)},afterRegister(){oe.register(M)},afterUnregister(){oe.unregister(M)},beforeInit(t){S.set(t,{annotations:[],elements:[],visibleElements:[],listeners:{},listened:!1,moveListened:!1,hooks:{},hooked:!1,hovered:[]})},beforeUpdate(t,e,n){const o=S.get(t),r=o.annotations=[];let i=n.annotations;B(i)?Object.keys(i).forEach(s=>{const a=i[s];B(a)&&(a.id=s,r.push(a))}):A(i)&&r.push(...i),Kt(r,t.scales)},afterDataLimits(t,e){const n=S.get(t);Gt(t,e.scale,n.annotations.filter(o=>o.display&&o.adjustScaleRange))},afterUpdate(t,e,n){const o=S.get(t);$t(t,o,n),In(t,o,n,e.mode),o.visibleElements=o.elements.filter(r=>!r.skip&&r.options.display),qt(t,o,n)},beforeDatasetsDraw(t,e,n){U(t,"beforeDatasetsDraw",n.clip)},afterDatasetsDraw(t,e,n){U(t,"afterDatasetsDraw",n.clip)},beforeDraw(t,e,n){U(t,"beforeDraw",n.clip)},afterDraw(t,e,n){U(t,"afterDraw",n.clip)},beforeEvent(t,e,n){const o=S.get(t);Vt(o,e.event,n)&&(e.changed=!0)},afterDestroy(t){S.delete(t)},_getState(t){return S.get(t)},defaults:{animations:{numbers:{properties:["x","y","x2","y2","width","height","centerX","centerY","pointX","pointY","radius"],type:"number"}},clip:!0,interaction:{mode:void 0,axis:void 0,intersect:void 0},common:{drawTime:"afterDatasetsDraw",init:!1,label:{}}},descriptors:{_indexable:!1,_scriptable:t=>!Yn.includes(t)&&t!=="init",annotations:{_allKeys:!1,_fallback:(t,e)=>`elements.${M[Me(e.type)].id}`},interaction:{_fallback:!0},common:{label:{_indexable:ce,_fallback:!0},_indexable:ce}},additionalOptionScopes:[""]};function U(t,e,n){const{ctx:o,chartArea:r}=t,i=S.get(t);n&&ft(o,r);const s=zn(i.visibleElements,e).sort((a,d)=>a.element.options.z-d.element.options.z);for(const a of s)Xn(o,r,i,a);n&&ht(o)}function zn(t,e){const n=[];for(const o of t)if(o.options.drawTime===e&&n.push({element:o,main:!0}),o.elements&&o.elements.length)for(const r of o.elements)r.options.display&&r.options.drawTime===e&&n.push({element:r});return n}function Xn(t,e,n,o){const r=o.element;o.main?(De(n,r,"beforeDraw"),r.draw(t,e),De(n,r,"afterDraw")):r.draw(t,e)}const Hn=(t,e,n)=>{if(typeof t=="string")return t;const o=Number.parseInt(t.toString());return o>999999?`${o/1e6}M`:o>999?`${o/1e3}k`:o};export{Bn as a,Hn as f};