unleash-server 7.4.1 → 7.4.3

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 (478) hide show
  1. package/README.md +6 -1
  2. package/dist/lib/addons/feature-event-formatter-md.d.ts.map +1 -1
  3. package/dist/lib/addons/feature-event-formatter-md.js +1 -0
  4. package/dist/lib/addons/feature-event-formatter-md.js.map +1 -1
  5. package/dist/lib/addons/feature-event-formatter-md.test.js +45 -2
  6. package/dist/lib/addons/feature-event-formatter-md.test.js.map +1 -1
  7. package/dist/lib/create-config.d.ts.map +1 -1
  8. package/dist/lib/create-config.js +6 -1
  9. package/dist/lib/create-config.js.map +1 -1
  10. package/dist/lib/db/feature-environment-store.d.ts.map +1 -1
  11. package/dist/lib/db/feature-environment-store.js.map +1 -1
  12. package/dist/lib/db/index.d.ts.map +1 -1
  13. package/dist/lib/db/index.js +5 -2
  14. package/dist/lib/db/index.js.map +1 -1
  15. package/dist/lib/{routes/admin-api/constraints.d.ts → features/constraints/constraints-controller.d.ts} +5 -5
  16. package/dist/lib/features/constraints/constraints-controller.d.ts.map +1 -0
  17. package/dist/lib/{routes/admin-api/constraints.js → features/constraints/constraints-controller.js} +6 -6
  18. package/dist/lib/features/constraints/constraints-controller.js.map +1 -0
  19. package/dist/lib/features/constraints/constraints-read-model-type.d.ts +6 -0
  20. package/dist/lib/features/constraints/constraints-read-model-type.d.ts.map +1 -0
  21. package/dist/lib/features/constraints/constraints-read-model-type.js +2 -0
  22. package/dist/lib/features/constraints/constraints-read-model-type.js.map +1 -0
  23. package/dist/lib/features/constraints/constraints-read-model.d.ts +11 -0
  24. package/dist/lib/features/constraints/constraints-read-model.d.ts.map +1 -0
  25. package/dist/lib/features/constraints/constraints-read-model.js +55 -0
  26. package/dist/lib/features/constraints/constraints-read-model.js.map +1 -0
  27. package/dist/lib/features/constraints/constraints-read-model.test.d.ts +2 -0
  28. package/dist/lib/features/constraints/constraints-read-model.test.d.ts.map +1 -0
  29. package/dist/lib/features/constraints/constraints-read-model.test.js +388 -0
  30. package/dist/lib/features/constraints/constraints-read-model.test.js.map +1 -0
  31. package/dist/lib/features/constraints/constraints.e2e.test.d.ts.map +1 -0
  32. package/dist/{test/e2e/api/admin → lib/features/constraints}/constraints.e2e.test.js +4 -4
  33. package/dist/lib/features/constraints/constraints.e2e.test.js.map +1 -0
  34. package/dist/lib/features/constraints/createConstraintsReadModel.d.ts +5 -0
  35. package/dist/lib/features/constraints/createConstraintsReadModel.d.ts.map +1 -0
  36. package/dist/lib/features/constraints/createConstraintsReadModel.js +9 -0
  37. package/dist/lib/features/constraints/createConstraintsReadModel.js.map +1 -0
  38. package/dist/lib/features/constraints/fake-constraints-read-model.d.ts +7 -0
  39. package/dist/lib/features/constraints/fake-constraints-read-model.d.ts.map +1 -0
  40. package/dist/lib/features/constraints/fake-constraints-read-model.js +11 -0
  41. package/dist/lib/features/constraints/fake-constraints-read-model.js.map +1 -0
  42. package/dist/lib/features/context/context.d.ts.map +1 -1
  43. package/dist/lib/features/context/context.js +16 -10
  44. package/dist/lib/features/context/context.js.map +1 -1
  45. package/dist/lib/features/context/createContextService.js +1 -1
  46. package/dist/lib/features/context/createContextService.js.map +1 -1
  47. package/dist/lib/features/dependent-features/dependent-features-controller.d.ts.map +1 -1
  48. package/dist/lib/features/dependent-features/dependent-features-controller.js +0 -1
  49. package/dist/lib/features/dependent-features/dependent-features-controller.js.map +1 -1
  50. package/dist/lib/features/edgetokens/edge-hmac-verifier.d.ts +4 -0
  51. package/dist/lib/features/edgetokens/edge-hmac-verifier.d.ts.map +1 -0
  52. package/dist/lib/features/edgetokens/edge-hmac-verifier.js +83 -0
  53. package/dist/lib/features/edgetokens/edge-hmac-verifier.js.map +1 -0
  54. package/dist/lib/features/edgetokens/edge-token-store.d.ts +16 -0
  55. package/dist/lib/features/edgetokens/edge-token-store.d.ts.map +1 -0
  56. package/dist/lib/features/edgetokens/edge-token-store.js +101 -0
  57. package/dist/lib/features/edgetokens/edge-token-store.js.map +1 -0
  58. package/dist/lib/features/edgetokens/edge-tokens.d.ts +2 -0
  59. package/dist/lib/features/edgetokens/edge-tokens.d.ts.map +1 -0
  60. package/dist/lib/features/edgetokens/edge-tokens.js +16 -0
  61. package/dist/lib/features/edgetokens/edge-tokens.js.map +1 -0
  62. package/dist/lib/features/edgetokens/edge-tokens.test.d.ts +2 -0
  63. package/dist/lib/features/edgetokens/edge-tokens.test.d.ts.map +1 -0
  64. package/dist/lib/features/edgetokens/edge-tokens.test.js +22 -0
  65. package/dist/lib/features/edgetokens/edge-tokens.test.js.map +1 -0
  66. package/dist/lib/features/edgetokens/edge-verification.d.ts +3 -0
  67. package/dist/lib/features/edgetokens/edge-verification.d.ts.map +1 -0
  68. package/dist/lib/features/edgetokens/edge-verification.js +25 -0
  69. package/dist/lib/features/edgetokens/edge-verification.js.map +1 -0
  70. package/dist/lib/features/edgetokens/edge-verification.test.d.ts +2 -0
  71. package/dist/lib/features/edgetokens/edge-verification.test.d.ts.map +1 -0
  72. package/dist/lib/features/edgetokens/edge-verification.test.js +18 -0
  73. package/dist/lib/features/edgetokens/edge-verification.test.js.map +1 -0
  74. package/dist/lib/features/edgetokens/fake-edge-token-store.d.ts +11 -0
  75. package/dist/lib/features/edgetokens/fake-edge-token-store.d.ts.map +1 -0
  76. package/dist/lib/features/edgetokens/fake-edge-token-store.js +21 -0
  77. package/dist/lib/features/edgetokens/fake-edge-token-store.js.map +1 -0
  78. package/dist/lib/features/feature-lifecycle/feature-lifecycle-controller.d.ts.map +1 -1
  79. package/dist/lib/features/feature-lifecycle/feature-lifecycle-controller.js +6 -3
  80. package/dist/lib/features/feature-lifecycle/feature-lifecycle-controller.js.map +1 -1
  81. package/dist/lib/features/feature-lifecycle/feature-lifecycle-count-controller.d.ts.map +1 -1
  82. package/dist/lib/features/feature-lifecycle/feature-lifecycle-count-controller.js +2 -1
  83. package/dist/lib/features/feature-lifecycle/feature-lifecycle-count-controller.js.map +1 -1
  84. package/dist/lib/features/feature-links/feature-link-controller.d.ts.map +1 -1
  85. package/dist/lib/features/feature-links/feature-link-controller.js +6 -3
  86. package/dist/lib/features/feature-links/feature-link-controller.js.map +1 -1
  87. package/dist/lib/features/feature-search/feature.search.e2e.test.js +3 -3
  88. package/dist/lib/features/feature-search/feature.search.e2e.test.js.map +1 -1
  89. package/dist/lib/features/feature-toggle/converters/feature-toggle-row-converter.d.ts +1 -1
  90. package/dist/lib/features/feature-toggle/createFeatureToggleService.d.ts +2 -0
  91. package/dist/lib/features/feature-toggle/createFeatureToggleService.d.ts.map +1 -1
  92. package/dist/lib/features/feature-toggle/createFeatureToggleService.js +8 -2
  93. package/dist/lib/features/feature-toggle/createFeatureToggleService.js.map +1 -1
  94. package/dist/lib/features/feature-toggle/feature-toggle-service.d.ts +6 -6
  95. package/dist/lib/features/feature-toggle/feature-toggle-service.d.ts.map +1 -1
  96. package/dist/lib/features/feature-toggle/feature-toggle-service.js +6 -44
  97. package/dist/lib/features/feature-toggle/feature-toggle-service.js.map +1 -1
  98. package/dist/lib/features/feature-toggle/feature-toggle-strategies-store.d.ts.map +1 -1
  99. package/dist/lib/features/feature-toggle/feature-toggle-strategies-store.js +6 -0
  100. package/dist/lib/features/feature-toggle/feature-toggle-strategies-store.js.map +1 -1
  101. package/dist/lib/features/feature-toggle/tests/feature-toggle-service.constraint-validation.test.d.ts +2 -0
  102. package/dist/lib/features/feature-toggle/tests/feature-toggle-service.constraint-validation.test.d.ts.map +1 -0
  103. package/dist/lib/features/feature-toggle/tests/feature-toggle-service.constraint-validation.test.js +185 -0
  104. package/dist/lib/features/feature-toggle/tests/feature-toggle-service.constraint-validation.test.js.map +1 -0
  105. package/dist/lib/features/frontend-api/createFrontendApiService.d.ts.map +1 -1
  106. package/dist/lib/features/frontend-api/createFrontendApiService.js +2 -0
  107. package/dist/lib/features/frontend-api/createFrontendApiService.js.map +1 -1
  108. package/dist/lib/features/index.d.ts +2 -0
  109. package/dist/lib/features/index.d.ts.map +1 -1
  110. package/dist/lib/features/index.js +2 -0
  111. package/dist/lib/features/index.js.map +1 -1
  112. package/dist/lib/features/instance-stats/createInstanceStatsService.d.ts.map +1 -1
  113. package/dist/lib/features/instance-stats/createInstanceStatsService.js +0 -1
  114. package/dist/lib/features/instance-stats/createInstanceStatsService.js.map +1 -1
  115. package/dist/lib/features/metrics/last-seen/tests/last-seen-service.test.js +2 -2
  116. package/dist/lib/features/metrics/last-seen/tests/last-seen-service.test.js.map +1 -1
  117. package/dist/lib/features/metrics/shared/schema.d.ts.map +1 -1
  118. package/dist/lib/features/metrics/shared/schema.js +10 -2
  119. package/dist/lib/features/metrics/shared/schema.js.map +1 -1
  120. package/dist/lib/features/metrics/shared/schema.test.js +18 -0
  121. package/dist/lib/features/metrics/shared/schema.test.js.map +1 -1
  122. package/dist/lib/features/pat/createPatService.d.ts +6 -0
  123. package/dist/lib/features/pat/createPatService.d.ts.map +1 -0
  124. package/dist/lib/features/pat/createPatService.js +15 -0
  125. package/dist/lib/features/pat/createPatService.js.map +1 -0
  126. package/dist/lib/features/pat/fake-pat-store.d.ts +18 -0
  127. package/dist/lib/features/pat/fake-pat-store.d.ts.map +1 -0
  128. package/dist/lib/features/pat/fake-pat-store.js +52 -0
  129. package/dist/lib/features/pat/fake-pat-store.js.map +1 -0
  130. package/dist/lib/{services → features/pat}/pat-service.d.ts +3 -3
  131. package/dist/lib/features/pat/pat-service.d.ts.map +1 -0
  132. package/dist/lib/{services → features/pat}/pat-service.js +5 -5
  133. package/dist/lib/features/pat/pat-service.js.map +1 -0
  134. package/dist/lib/{types/stores/pat-store.d.ts → features/pat/pat-store-type.d.ts} +2 -2
  135. package/dist/lib/features/pat/pat-store-type.d.ts.map +1 -0
  136. package/dist/lib/features/pat/pat-store-type.js +2 -0
  137. package/dist/lib/features/pat/pat-store-type.js.map +1 -0
  138. package/dist/lib/{db → features/pat}/pat-store.d.ts +4 -4
  139. package/dist/lib/features/pat/pat-store.d.ts.map +1 -0
  140. package/dist/lib/{db → features/pat}/pat-store.js +1 -1
  141. package/dist/lib/features/pat/pat-store.js.map +1 -0
  142. package/dist/lib/features/personal-dashboard/personal-dashboard-controller.d.ts.map +1 -1
  143. package/dist/lib/features/personal-dashboard/personal-dashboard-controller.js +4 -2
  144. package/dist/lib/features/personal-dashboard/personal-dashboard-controller.js.map +1 -1
  145. package/dist/lib/features/playground/feature-evaluator/constraint.d.ts +2 -1
  146. package/dist/lib/features/playground/feature-evaluator/constraint.d.ts.map +1 -1
  147. package/dist/lib/features/playground/feature-evaluator/constraint.js +18 -0
  148. package/dist/lib/features/playground/feature-evaluator/constraint.js.map +1 -1
  149. package/dist/lib/features/playground/offline-unleash-client.test.js +105 -0
  150. package/dist/lib/features/playground/offline-unleash-client.test.js.map +1 -1
  151. package/dist/lib/features/project-status/project-status-controller.d.ts.map +1 -1
  152. package/dist/lib/features/project-status/project-status-controller.js +2 -1
  153. package/dist/lib/features/project-status/project-status-controller.js.map +1 -1
  154. package/dist/lib/features/release-plans/createReleasePlanMilestoneStrategyService.d.ts +12 -0
  155. package/dist/lib/features/release-plans/createReleasePlanMilestoneStrategyService.d.ts.map +1 -0
  156. package/dist/lib/features/release-plans/createReleasePlanMilestoneStrategyService.js +26 -0
  157. package/dist/lib/features/release-plans/createReleasePlanMilestoneStrategyService.js.map +1 -0
  158. package/dist/lib/features/release-plans/release-plan-milestone-strategy-service.d.ts +20 -0
  159. package/dist/lib/features/release-plans/release-plan-milestone-strategy-service.d.ts.map +1 -0
  160. package/dist/lib/features/release-plans/release-plan-milestone-strategy-service.js +37 -0
  161. package/dist/lib/features/release-plans/release-plan-milestone-strategy-service.js.map +1 -0
  162. package/dist/lib/features/release-plans/release-plan-milestone-strategy-service.test.d.ts +2 -0
  163. package/dist/lib/features/release-plans/release-plan-milestone-strategy-service.test.d.ts.map +1 -0
  164. package/dist/lib/features/release-plans/release-plan-milestone-strategy-service.test.js +69 -0
  165. package/dist/lib/features/release-plans/release-plan-milestone-strategy-service.test.js.map +1 -0
  166. package/dist/lib/features/release-plans/release-plan-milestone-strategy-store.d.ts +10 -2
  167. package/dist/lib/features/release-plans/release-plan-milestone-strategy-store.d.ts.map +1 -1
  168. package/dist/lib/features/release-plans/release-plan-milestone-strategy-store.js +0 -1
  169. package/dist/lib/features/release-plans/release-plan-milestone-strategy-store.js.map +1 -1
  170. package/dist/lib/features/scheduler/schedule-services.d.ts.map +1 -1
  171. package/dist/lib/features/scheduler/schedule-services.js +3 -2
  172. package/dist/lib/features/scheduler/schedule-services.js.map +1 -1
  173. package/dist/lib/features/segment/admin-segment.e2e.test.js +117 -0
  174. package/dist/lib/features/segment/admin-segment.e2e.test.js.map +1 -1
  175. package/dist/lib/features/segment/createSegmentService.d.ts.map +1 -1
  176. package/dist/lib/features/segment/createSegmentService.js +7 -2
  177. package/dist/lib/features/segment/createSegmentService.js.map +1 -1
  178. package/dist/lib/features/segment/segment-controller.d.ts.map +1 -1
  179. package/dist/lib/features/segment/segment-controller.js +1 -1
  180. package/dist/lib/features/segment/segment-controller.js.map +1 -1
  181. package/dist/lib/features/segment/segment-service.d.ts +3 -1
  182. package/dist/lib/features/segment/segment-service.d.ts.map +1 -1
  183. package/dist/lib/features/segment/segment-service.js +4 -1
  184. package/dist/lib/features/segment/segment-service.js.map +1 -1
  185. package/dist/lib/features/users/user-store.d.ts.map +1 -1
  186. package/dist/lib/features/users/user-store.js +6 -0
  187. package/dist/lib/features/users/user-store.js.map +1 -1
  188. package/dist/lib/features/users/user-updates-read-model.d.ts +2 -0
  189. package/dist/lib/features/users/user-updates-read-model.d.ts.map +1 -1
  190. package/dist/lib/features/users/user-updates-read-model.js +2 -0
  191. package/dist/lib/features/users/user-updates-read-model.js.map +1 -1
  192. package/dist/lib/middleware/conditional-middleware.d.ts +1 -1
  193. package/dist/lib/middleware/conditional-middleware.d.ts.map +1 -1
  194. package/dist/lib/middleware/response-time-metrics.test.js +4 -0
  195. package/dist/lib/middleware/response-time-metrics.test.js.map +1 -1
  196. package/dist/lib/openapi/spec/admin-segment-schema.d.ts +1 -1
  197. package/dist/lib/openapi/spec/advanced-playground-environment-feature-schema.d.ts +4 -4
  198. package/dist/lib/openapi/spec/advanced-playground-feature-schema.d.ts +8 -8
  199. package/dist/lib/openapi/spec/advanced-playground-response-schema.d.ts +17 -17
  200. package/dist/lib/openapi/spec/client-feature-schema.d.ts +2 -2
  201. package/dist/lib/openapi/spec/client-features-delta-schema.d.ts +5 -5
  202. package/dist/lib/openapi/spec/client-features-schema.d.ts +5 -5
  203. package/dist/lib/openapi/spec/client-features-schema.test.js +12 -0
  204. package/dist/lib/openapi/spec/client-features-schema.test.js.map +1 -1
  205. package/dist/lib/openapi/spec/client-metrics-schema.d.ts +1 -0
  206. package/dist/lib/openapi/spec/client-metrics-schema.d.ts.map +1 -1
  207. package/dist/lib/openapi/spec/client-metrics-schema.js +1 -0
  208. package/dist/lib/openapi/spec/client-metrics-schema.js.map +1 -1
  209. package/dist/lib/openapi/spec/client-segment-schema.d.ts +1 -1
  210. package/dist/lib/openapi/spec/constraint-schema.d.ts +2 -2
  211. package/dist/lib/openapi/spec/create-feature-strategy-schema.d.ts +1 -1
  212. package/dist/lib/openapi/spec/create-user-response-schema.d.ts +12 -0
  213. package/dist/lib/openapi/spec/create-user-response-schema.d.ts.map +1 -1
  214. package/dist/lib/openapi/spec/edge-environment-projects-list-schema.d.ts +41 -0
  215. package/dist/lib/openapi/spec/edge-environment-projects-list-schema.d.ts.map +1 -0
  216. package/dist/lib/openapi/spec/edge-environment-projects-list-schema.js +39 -0
  217. package/dist/lib/openapi/spec/edge-environment-projects-list-schema.js.map +1 -0
  218. package/dist/lib/openapi/spec/edge-token-schema.d.ts +6 -1
  219. package/dist/lib/openapi/spec/edge-token-schema.d.ts.map +1 -1
  220. package/dist/lib/openapi/spec/edge-token-schema.js +6 -1
  221. package/dist/lib/openapi/spec/edge-token-schema.js.map +1 -1
  222. package/dist/lib/openapi/spec/environment-project-schema.d.ts +2 -2
  223. package/dist/lib/openapi/spec/environments-project-schema.d.ts +4 -4
  224. package/dist/lib/openapi/spec/export-result-schema.d.ts +68 -68
  225. package/dist/lib/openapi/spec/feature-environment-schema.d.ts +17 -17
  226. package/dist/lib/openapi/spec/feature-schema.d.ts +34 -34
  227. package/dist/lib/openapi/spec/feature-search-environment-schema.d.ts +34 -34
  228. package/dist/lib/openapi/spec/feature-search-response-schema.d.ts +36 -36
  229. package/dist/lib/openapi/spec/feature-strategy-schema.d.ts +1 -1
  230. package/dist/lib/openapi/spec/group-schema.d.ts +24 -0
  231. package/dist/lib/openapi/spec/group-schema.d.ts.map +1 -1
  232. package/dist/lib/openapi/spec/group-user-model-schema.d.ts +12 -0
  233. package/dist/lib/openapi/spec/group-user-model-schema.d.ts.map +1 -1
  234. package/dist/lib/openapi/spec/groups-schema.d.ts +48 -0
  235. package/dist/lib/openapi/spec/groups-schema.d.ts.map +1 -1
  236. package/dist/lib/openapi/spec/health-overview-schema.d.ts +69 -69
  237. package/dist/lib/openapi/spec/health-report-schema.d.ts +69 -69
  238. package/dist/lib/openapi/spec/index.d.ts +3 -0
  239. package/dist/lib/openapi/spec/index.d.ts.map +1 -1
  240. package/dist/lib/openapi/spec/index.js +3 -0
  241. package/dist/lib/openapi/spec/index.js.map +1 -1
  242. package/dist/lib/openapi/spec/me-schema.d.ts +12 -0
  243. package/dist/lib/openapi/spec/me-schema.d.ts.map +1 -1
  244. package/dist/lib/openapi/spec/playground-constraint-schema.d.ts +1 -1
  245. package/dist/lib/openapi/spec/playground-feature-schema.d.ts +4 -4
  246. package/dist/lib/openapi/spec/playground-response-schema.d.ts +9 -9
  247. package/dist/lib/openapi/spec/playground-segment-schema.d.ts +1 -1
  248. package/dist/lib/openapi/spec/playground-strategy-schema.d.ts +2 -2
  249. package/dist/lib/openapi/spec/profile-schema.d.ts +34 -34
  250. package/dist/lib/openapi/spec/project-environment-schema.d.ts +1 -1
  251. package/dist/lib/openapi/spec/project-overview-schema.d.ts +69 -69
  252. package/dist/lib/openapi/spec/public-signup-token-schema.d.ts +12 -0
  253. package/dist/lib/openapi/spec/public-signup-token-schema.d.ts.map +1 -1
  254. package/dist/lib/openapi/spec/public-signup-tokens-schema.d.ts +24 -0
  255. package/dist/lib/openapi/spec/public-signup-tokens-schema.d.ts.map +1 -1
  256. package/dist/lib/openapi/spec/release-plan-milestone-schema.d.ts +4 -4
  257. package/dist/lib/openapi/spec/release-plan-milestone-strategy-schema.d.ts +2 -2
  258. package/dist/lib/openapi/spec/release-plan-schema.d.ts +8 -8
  259. package/dist/lib/openapi/spec/release-plan-template-schema.d.ts +8 -8
  260. package/dist/lib/openapi/spec/search-features-schema.d.ts +72 -72
  261. package/dist/lib/openapi/spec/segment-schema.d.ts +1 -1
  262. package/dist/lib/openapi/spec/segments-schema.d.ts +2 -2
  263. package/dist/lib/openapi/spec/signup-data-schema.d.ts +42 -0
  264. package/dist/lib/openapi/spec/signup-data-schema.d.ts.map +1 -0
  265. package/dist/lib/openapi/spec/signup-data-schema.js +40 -0
  266. package/dist/lib/openapi/spec/signup-data-schema.js.map +1 -0
  267. package/dist/lib/openapi/spec/submit-signup-data-schema.d.ts +50 -0
  268. package/dist/lib/openapi/spec/submit-signup-data-schema.d.ts.map +1 -0
  269. package/dist/lib/openapi/spec/submit-signup-data-schema.js +26 -0
  270. package/dist/lib/openapi/spec/submit-signup-data-schema.js.map +1 -0
  271. package/dist/lib/openapi/spec/ui-config-schema.d.ts +5 -0
  272. package/dist/lib/openapi/spec/ui-config-schema.d.ts.map +1 -1
  273. package/dist/lib/openapi/spec/ui-config-schema.js +5 -0
  274. package/dist/lib/openapi/spec/ui-config-schema.js.map +1 -1
  275. package/dist/lib/openapi/spec/update-feature-schema.d.ts +1 -1
  276. package/dist/lib/openapi/spec/update-feature-strategy-schema.d.ts +18 -2
  277. package/dist/lib/openapi/spec/update-feature-strategy-schema.d.ts.map +1 -1
  278. package/dist/lib/openapi/spec/update-feature-strategy-schema.js +17 -1
  279. package/dist/lib/openapi/spec/update-feature-strategy-schema.js.map +1 -1
  280. package/dist/lib/openapi/spec/upsert-segment-schema.d.ts +1 -1
  281. package/dist/lib/openapi/spec/user-access-overview-schema.d.ts +12 -0
  282. package/dist/lib/openapi/spec/user-access-overview-schema.d.ts.map +1 -1
  283. package/dist/lib/openapi/spec/user-schema.d.ts +12 -0
  284. package/dist/lib/openapi/spec/user-schema.d.ts.map +1 -1
  285. package/dist/lib/openapi/spec/user-schema.js +12 -0
  286. package/dist/lib/openapi/spec/user-schema.js.map +1 -1
  287. package/dist/lib/openapi/spec/users-groups-base-schema.d.ts +48 -0
  288. package/dist/lib/openapi/spec/users-groups-base-schema.d.ts.map +1 -1
  289. package/dist/lib/openapi/spec/users-schema.d.ts +12 -0
  290. package/dist/lib/openapi/spec/users-schema.d.ts.map +1 -1
  291. package/dist/lib/openapi/spec/users-search-schema.d.ts +12 -0
  292. package/dist/lib/openapi/spec/users-search-schema.d.ts.map +1 -1
  293. package/dist/lib/openapi/spec/validated-edge-tokens-schema.d.ts +6 -1
  294. package/dist/lib/openapi/spec/validated-edge-tokens-schema.d.ts.map +1 -1
  295. package/dist/lib/openapi/util/api-operation.d.ts +23 -3
  296. package/dist/lib/openapi/util/api-operation.d.ts.map +1 -1
  297. package/dist/lib/openapi/util/api-stability.d.ts +3 -0
  298. package/dist/lib/openapi/util/api-stability.d.ts.map +1 -0
  299. package/dist/lib/openapi/util/api-stability.js +49 -0
  300. package/dist/lib/openapi/util/api-stability.js.map +1 -0
  301. package/dist/lib/openapi/util/api-stability.test.d.ts +2 -0
  302. package/dist/lib/openapi/util/api-stability.test.d.ts.map +1 -0
  303. package/dist/lib/openapi/util/api-stability.test.js +140 -0
  304. package/dist/lib/openapi/util/api-stability.test.js.map +1 -0
  305. package/dist/lib/openapi/util/openapi-tags.d.ts +6 -6
  306. package/dist/lib/openapi/util/openapi-tags.d.ts.map +1 -1
  307. package/dist/lib/openapi/util/openapi-tags.js +4 -4
  308. package/dist/lib/openapi/util/openapi-tags.js.map +1 -1
  309. package/dist/lib/routes/admin-api/index.js +1 -1
  310. package/dist/lib/routes/admin-api/index.js.map +1 -1
  311. package/dist/lib/routes/admin-api/project/variants.d.ts.map +1 -1
  312. package/dist/lib/routes/admin-api/project/variants.js +5 -1
  313. package/dist/lib/routes/admin-api/project/variants.js.map +1 -1
  314. package/dist/lib/routes/admin-api/user/user.d.ts +1 -0
  315. package/dist/lib/routes/admin-api/user/user.d.ts.map +1 -1
  316. package/dist/lib/routes/admin-api/user/user.js +12 -1
  317. package/dist/lib/routes/admin-api/user/user.js.map +1 -1
  318. package/dist/lib/routes/admin-api/user-admin.d.ts.map +1 -1
  319. package/dist/lib/routes/admin-api/user-admin.js +4 -4
  320. package/dist/lib/routes/admin-api/user-admin.js.map +1 -1
  321. package/dist/lib/routes/edge-api/index.d.ts +4 -3
  322. package/dist/lib/routes/edge-api/index.d.ts.map +1 -1
  323. package/dist/lib/routes/edge-api/index.js +39 -7
  324. package/dist/lib/routes/edge-api/index.js.map +1 -1
  325. package/dist/lib/schema/feature-schema.test.js +1 -1
  326. package/dist/lib/schema/feature-schema.test.js.map +1 -1
  327. package/dist/lib/server-impl.d.ts +5 -4
  328. package/dist/lib/server-impl.d.ts.map +1 -1
  329. package/dist/lib/server-impl.js +6 -3
  330. package/dist/lib/server-impl.js.map +1 -1
  331. package/dist/lib/services/api-token-service.d.ts.map +1 -1
  332. package/dist/lib/services/api-token-service.js.map +1 -1
  333. package/dist/lib/services/edge-service.d.ts +22 -7
  334. package/dist/lib/services/edge-service.d.ts.map +1 -1
  335. package/dist/lib/services/edge-service.js +87 -9
  336. package/dist/lib/services/edge-service.js.map +1 -1
  337. package/dist/lib/services/index.d.ts +8 -3
  338. package/dist/lib/services/index.d.ts.map +1 -1
  339. package/dist/lib/services/index.js +23 -6
  340. package/dist/lib/services/index.js.map +1 -1
  341. package/dist/lib/services/openapi-service.d.ts +8 -2
  342. package/dist/lib/services/openapi-service.d.ts.map +1 -1
  343. package/dist/lib/services/openapi-service.js +49 -7
  344. package/dist/lib/services/openapi-service.js.map +1 -1
  345. package/dist/lib/services/openapi-service.test.d.ts +2 -0
  346. package/dist/lib/services/openapi-service.test.d.ts.map +1 -0
  347. package/dist/lib/services/openapi-service.test.js +41 -0
  348. package/dist/lib/services/openapi-service.test.js.map +1 -0
  349. package/dist/lib/services/user-service.d.ts +3 -1
  350. package/dist/lib/services/user-service.d.ts.map +1 -1
  351. package/dist/lib/services/user-service.js +7 -2
  352. package/dist/lib/services/user-service.js.map +1 -1
  353. package/dist/lib/services/user-service.test.js +4 -28
  354. package/dist/lib/services/user-service.test.js.map +1 -1
  355. package/dist/lib/types/experimental.d.ts +1 -1
  356. package/dist/lib/types/experimental.d.ts.map +1 -1
  357. package/dist/lib/types/experimental.js +6 -0
  358. package/dist/lib/types/experimental.js.map +1 -1
  359. package/dist/lib/types/model.d.ts +4 -0
  360. package/dist/lib/types/model.d.ts.map +1 -1
  361. package/dist/lib/types/model.js.map +1 -1
  362. package/dist/lib/types/option.d.ts +5 -0
  363. package/dist/lib/types/option.d.ts.map +1 -1
  364. package/dist/lib/types/stores/edge-store.d.ts +14 -0
  365. package/dist/lib/types/stores/edge-store.d.ts.map +1 -0
  366. package/dist/lib/types/stores/edge-store.js +2 -0
  367. package/dist/lib/types/stores/edge-store.js.map +1 -0
  368. package/dist/lib/types/stores/user-store.d.ts +4 -0
  369. package/dist/lib/types/stores/user-store.d.ts.map +1 -1
  370. package/dist/lib/types/stores.d.ts +6 -4
  371. package/dist/lib/types/stores.d.ts.map +1 -1
  372. package/dist/lib/types/stores.js +1 -1
  373. package/dist/lib/types/stores.js.map +1 -1
  374. package/dist/lib/types/user.d.ts +8 -1
  375. package/dist/lib/types/user.d.ts.map +1 -1
  376. package/dist/lib/types/user.js +3 -1
  377. package/dist/lib/types/user.js.map +1 -1
  378. package/dist/lib/ui-config/ui-config-service.d.ts.map +1 -1
  379. package/dist/lib/ui-config/ui-config-service.js +1 -0
  380. package/dist/lib/ui-config/ui-config-service.js.map +1 -1
  381. package/dist/lib/ui-config/ui-config.test.js +5 -1
  382. package/dist/lib/ui-config/ui-config.test.js.map +1 -1
  383. package/dist/lib/util/constants.d.ts +2 -1
  384. package/dist/lib/util/constants.d.ts.map +1 -1
  385. package/dist/lib/util/constants.js +2 -0
  386. package/dist/lib/util/constants.js.map +1 -1
  387. package/dist/lib/util/validators/constraint-types.d.ts +1 -0
  388. package/dist/lib/util/validators/constraint-types.d.ts.map +1 -1
  389. package/dist/lib/util/validators/constraint-types.js +12 -0
  390. package/dist/lib/util/validators/constraint-types.js.map +1 -1
  391. package/dist/lib/util/validators/constraint-types.test.js +25 -1
  392. package/dist/lib/util/validators/constraint-types.test.js.map +1 -1
  393. package/dist/mailtemplates/getting-started/getting-started.html.mustache +7 -2
  394. package/dist/mailtemplates/getting-started/getting-started.plain.mustache +6 -1
  395. package/dist/migrations/20260204150900-add-edge-hmac-verification-tables.d.ts +3 -0
  396. package/dist/migrations/20260204150900-add-edge-hmac-verification-tables.d.ts.map +1 -0
  397. package/dist/migrations/20260204150900-add-edge-hmac-verification-tables.js +39 -0
  398. package/dist/migrations/20260204150900-add-edge-hmac-verification-tables.js.map +1 -0
  399. package/dist/migrations/20260213095258-users-company-role-and-email-consent.d.ts +3 -0
  400. package/dist/migrations/20260213095258-users-company-role-and-email-consent.d.ts.map +1 -0
  401. package/dist/migrations/20260213095258-users-company-role-and-email-consent.js +12 -0
  402. package/dist/migrations/20260213095258-users-company-role-and-email-consent.js.map +1 -0
  403. package/dist/server-dev.js +3 -0
  404. package/dist/server-dev.js.map +1 -1
  405. package/dist/test/arbitraries.test.d.ts.map +1 -1
  406. package/dist/test/arbitraries.test.js +3 -9
  407. package/dist/test/arbitraries.test.js.map +1 -1
  408. package/dist/test/e2e/api/admin/context.e2e.test.js +1 -1
  409. package/dist/test/e2e/api/admin/context.e2e.test.js.map +1 -1
  410. package/dist/test/e2e/api/admin/project/variants.e2e.test.js +19 -0
  411. package/dist/test/e2e/api/admin/project/variants.e2e.test.js.map +1 -1
  412. package/dist/test/e2e/api/edge/create-token-request.test.d.ts +2 -0
  413. package/dist/test/e2e/api/edge/create-token-request.test.d.ts.map +1 -0
  414. package/dist/test/e2e/api/edge/create-token-request.test.js +215 -0
  415. package/dist/test/e2e/api/edge/create-token-request.test.js.map +1 -0
  416. package/dist/test/e2e/services/edge-service.e2e.test.js +106 -3
  417. package/dist/test/e2e/services/edge-service.e2e.test.js.map +1 -1
  418. package/dist/test/fixtures/fake-release-plan-milestone-strategy-store.d.ts +17 -0
  419. package/dist/test/fixtures/fake-release-plan-milestone-strategy-store.d.ts.map +1 -0
  420. package/dist/test/fixtures/fake-release-plan-milestone-strategy-store.js +44 -0
  421. package/dist/test/fixtures/fake-release-plan-milestone-strategy-store.js.map +1 -0
  422. package/dist/test/fixtures/store.d.ts.map +1 -1
  423. package/dist/test/fixtures/store.js +5 -2
  424. package/dist/test/fixtures/store.js.map +1 -1
  425. package/frontend/build/index.html +1 -1
  426. package/frontend/build/static/{AdvancedPlayground-B70Djk8B.js → AdvancedPlayground-BVQjoHnr.js} +2 -2
  427. package/frontend/build/static/BackendConnections-bRvUo06H.js +1 -0
  428. package/frontend/build/static/{CreateProject-Dnggz6io.js → CreateProject-z7K5-k8g.js} +1 -1
  429. package/frontend/build/static/{EnterpriseEdge-Dnk6MbDj.js → EnterpriseEdge-CAkbmuGs.js} +2 -2
  430. package/frontend/build/static/{FeatureMetricsChart-CFEixeGp.js → FeatureMetricsChart-TPw8l2qi.js} +2 -2
  431. package/frontend/build/static/FeatureStaleDialog-DwV5Mzh6.js +7 -0
  432. package/frontend/build/static/{FeatureViewLazyExport-CUnXEEwm.js → FeatureViewLazyExport-CBpSqVMU.js} +3 -3
  433. package/frontend/build/static/{FlagMetricsChart-ujKp_v58.js → FlagMetricsChart-DLcy8CzE.js} +2 -2
  434. package/frontend/build/static/FrontendNetworkTrafficUsage-CYJZFmkc.js +1 -0
  435. package/frontend/build/static/{GridLayoutWrapper-Cg_xypvQ.js → GridLayoutWrapper-CixVvIgD.js} +1 -1
  436. package/frontend/build/static/{ImpactMetricsPage-ZRSvDBg4.js → ImpactMetricsPage-AS6DHn5C.js} +1 -1
  437. package/frontend/build/static/{LazyAdminExport-B8GV3V8t.js → LazyAdminExport-dyqU9IvB.js} +14 -14
  438. package/frontend/build/static/{LazyProjectExport-B9SJl4_L.js → LazyProjectExport-B1vRaljX.js} +19 -19
  439. package/frontend/build/static/{LifecycleChartComponent-DulnIgCV.js → LifecycleChartComponent-BGuUP9oF.js} +3 -3
  440. package/frontend/build/static/{LineChartComponent-BVdLj0q6.js → LineChartComponent-DA6kG8Ei.js} +1 -1
  441. package/frontend/build/static/{MarkCompletedDialogue-Cu7y0hRZ.js → MarkCompletedDialogue-D2TM3HgS.js} +1 -1
  442. package/frontend/build/static/{NetworkOverview-CUmX-taY.js → NetworkOverview-aNdwr7xF.js} +1 -1
  443. package/frontend/build/static/{NetworkPrometheusAPIWarning-BwnVz0CY.js → NetworkPrometheusAPIWarning-f1m-ZHgX.js} +1 -1
  444. package/frontend/build/static/{NetworkTraffic-DCMn8UWo.js → NetworkTraffic-CzH9_YqS.js} +1 -1
  445. package/frontend/build/static/{NetworkTrafficUsage-DSZK447X.js → NetworkTrafficUsage-BqpcQ4JO.js} +1 -1
  446. package/frontend/build/static/{PercentageDonut-B2OwM0Er.js → PercentageDonut-cKg6eF-p.js} +1 -1
  447. package/frontend/build/static/{ReactJSONEditor-BPlzE1Zx.js → ReactJSONEditor-BH7GX57b.js} +1 -1
  448. package/frontend/build/static/RoleCell-D01N1lHV.js +1 -0
  449. package/frontend/build/static/{aggregateFeatureMetrics-Bcfo39hn.js → aggregateFeatureMetrics-DJ_IwcyH.js} +1 -1
  450. package/frontend/build/static/{formatTickValue-CqTJlzJZ.js → formatTickValue-ClJtK_xN.js} +2 -2
  451. package/frontend/build/static/index-Cz4lAJ3Y.js +568 -0
  452. package/frontend/build/static/{networkTrafficUsageHighlightPlugin-Dmm54dMG.js → networkTrafficUsageHighlightPlugin-Ce-A3Xr6.js} +1 -1
  453. package/frontend/build/static/unleash_logo_dark_no_label-DHgOj_XN.svg +6 -0
  454. package/frontend/build/static/unleash_logo_white_no_label-BazgWvcx.svg +6 -0
  455. package/frontend/build/static/{useApiTokens-D1XvAIIA.js → useApiTokens-Dx2wjhgw.js} +1 -1
  456. package/frontend/package.json +9 -7
  457. package/package.json +16 -13
  458. package/dist/lib/db/pat-store.d.ts.map +0 -1
  459. package/dist/lib/db/pat-store.js.map +0 -1
  460. package/dist/lib/routes/admin-api/constraints.d.ts.map +0 -1
  461. package/dist/lib/routes/admin-api/constraints.js.map +0 -1
  462. package/dist/lib/services/pat-service.d.ts.map +0 -1
  463. package/dist/lib/services/pat-service.js.map +0 -1
  464. package/dist/lib/types/stores/pat-store.d.ts.map +0 -1
  465. package/dist/lib/types/stores/pat-store.js +0 -2
  466. package/dist/lib/types/stores/pat-store.js.map +0 -1
  467. package/dist/test/e2e/api/admin/constraints.e2e.test.d.ts.map +0 -1
  468. package/dist/test/e2e/api/admin/constraints.e2e.test.js.map +0 -1
  469. package/dist/test/fixtures/fake-pat-store.d.ts +0 -16
  470. package/dist/test/fixtures/fake-pat-store.d.ts.map +0 -1
  471. package/dist/test/fixtures/fake-pat-store.js +0 -35
  472. package/dist/test/fixtures/fake-pat-store.js.map +0 -1
  473. package/frontend/build/static/BackendConnections-mlK6EAYQ.js +0 -1
  474. package/frontend/build/static/FeatureStaleDialog-DZoiwwdR.js +0 -7
  475. package/frontend/build/static/FrontendNetworkTrafficUsage-Dq8wwaXR.js +0 -1
  476. package/frontend/build/static/RoleCell-D5skjCJn.js +0 -1
  477. package/frontend/build/static/index-g9pKMnOR.js +0 -542
  478. /package/dist/{test/e2e/api/admin → lib/features/constraints}/constraints.e2e.test.d.ts +0 -0
@@ -1,7 +1,7 @@
1
- import{js as w,jt as K,ju as v,jv as V,jw as Y,jx as Z,jy as D,jz as p,jA as Q,jB as W,jl as O,jC as ee,jD as re,b as te,bq as ae,r as ie,j as ne,jp as oe,ji as se,jj as le,jk as ue,jE as de,jn as fe,jo as ve,jF as he,jG as ye}from"./index-g9pKMnOR.js";/*!
1
+ import{jv as w,jw as K,jx as v,jy as V,jz as Y,jA as Z,jB as D,jC as p,jD as Q,jE as W,jo as O,jF as ee,jG as re,b as te,bq as ae,r as ie,j as ne,js as oe,jl as se,jm as le,jn as ue,jH as de,jq as fe,jr as ve,jI as he,jJ as ye}from"./index-Cz4lAJ3Y.js";/*!
2
2
  * chartjs-plugin-datalabels v2.2.0
3
3
  * https://chartjs-plugin-datalabels.netlify.app
4
4
  * (c) 2017-2022 chartjs-plugin-datalabels contributors
5
5
  * Released under the MIT license
6
- */var $=function(){if(typeof window<"u"){if(window.devicePixelRatio)return window.devicePixelRatio;var e=window.screen;if(e)return(e.deviceXDPI||1)/(e.logicalXDPI||1)}return 1}(),g={toTextLines:function(e){var a=[],r;for(e=[].concat(e);e.length;)r=e.pop(),typeof r=="string"?a.unshift.apply(a,r.split(`
7
- `)):Array.isArray(r)?e.push.apply(e,r):p(e)||a.unshift(""+r);return a},textSize:function(e,a,r){var t=[].concat(a),i=t.length,n=e.font,o=0,s;for(e.font=r.string,s=0;s<i;++s)o=Math.max(e.measureText(t[s]).width,o);return e.font=n,{height:i*r.lineHeight,width:o}},bound:function(e,a,r){return Math.max(e,Math.min(a,r))},arrayDiff:function(e,a){var r=e.slice(),t=[],i,n,o,s;for(i=0,o=a.length;i<o;++i)s=a[i],n=r.indexOf(s),n===-1?t.push([s,1]):r.splice(n,1);for(i=0,o=r.length;i<o;++i)t.push([r[i],-1]);return t},rasterize:function(e){return Math.round(e*$)/$}};function I(e,a){var r=a.x,t=a.y;if(r===null)return{x:0,y:-1};if(t===null)return{x:1,y:0};var i=e.x-r,n=e.y-t,o=Math.sqrt(i*i+n*n);return{x:o?i/o:0,y:o?n/o:-1}}function ce(e,a,r,t,i){switch(i){case"center":r=t=0;break;case"bottom":r=0,t=1;break;case"right":r=1,t=0;break;case"left":r=-1,t=0;break;case"top":r=0,t=-1;break;case"start":r=-r,t=-t;break;case"end":break;default:i*=Math.PI/180,r=Math.cos(i),t=Math.sin(i);break}return{x:e,y:a,vx:r,vy:t}}var xe=0,N=1,L=2,F=4,G=8;function M(e,a,r){var t=xe;return e<r.left?t|=N:e>r.right&&(t|=L),a<r.top?t|=G:a>r.bottom&&(t|=F),t}function be(e,a){for(var r=e.x0,t=e.y0,i=e.x1,n=e.y1,o=M(r,t,a),s=M(i,n,a),l,u,d;!(!(o|s)||o&s);)l=o||s,l&G?(u=r+(i-r)*(a.top-t)/(n-t),d=a.top):l&F?(u=r+(i-r)*(a.bottom-t)/(n-t),d=a.bottom):l&L?(d=t+(n-t)*(a.right-r)/(i-r),u=a.right):l&N&&(d=t+(n-t)*(a.left-r)/(i-r),u=a.left),l===o?(r=u,t=d,o=M(r,t,a)):(i=u,n=d,s=M(i,n,a));return{x0:r,x1:i,y0:t,y1:n}}function S(e,a){var r=a.anchor,t=e,i,n;return a.clamp&&(t=be(t,a.area)),r==="start"?(i=t.x0,n=t.y0):r==="end"?(i=t.x1,n=t.y1):(i=(t.x0+t.x1)/2,n=(t.y0+t.y1)/2),ce(i,n,e.vx,e.vy,a.align)}var j={arc:function(e,a){var r=(e.startAngle+e.endAngle)/2,t=Math.cos(r),i=Math.sin(r),n=e.innerRadius,o=e.outerRadius;return S({x0:e.x+t*n,y0:e.y+i*n,x1:e.x+t*o,y1:e.y+i*o,vx:t,vy:i},a)},point:function(e,a){var r=I(e,a.origin),t=r.x*e.options.radius,i=r.y*e.options.radius;return S({x0:e.x-t,y0:e.y-i,x1:e.x+t,y1:e.y+i,vx:r.x,vy:r.y},a)},bar:function(e,a){var r=I(e,a.origin),t=e.x,i=e.y,n=0,o=0;return e.horizontal?(t=Math.min(e.x,e.base),n=Math.abs(e.base-e.x)):(i=Math.min(e.y,e.base),o=Math.abs(e.base-e.y)),S({x0:t,y0:i+o,x1:t+n,y1:i,vx:r.x,vy:r.y},a)},fallback:function(e,a){var r=I(e,a.origin);return S({x0:e.x,y0:e.y,x1:e.x+(e.width||0),y1:e.y+(e.height||0),vx:r.x,vy:r.y},a)}},c=g.rasterize;function _e(e){var a=e.borderWidth||0,r=e.padding,t=e.size.height,i=e.size.width,n=-i/2,o=-t/2;return{frame:{x:n-r.left-a,y:o-r.top-a,w:i+r.width+a*2,h:t+r.height+a*2},text:{x:n,y:o,w:i,h:t}}}function pe(e,a){var r=a.chart.getDatasetMeta(a.datasetIndex).vScale;if(!r)return null;if(r.xCenter!==void 0&&r.yCenter!==void 0)return{x:r.xCenter,y:r.yCenter};var t=r.getBasePixel();return e.horizontal?{x:t,y:null}:{x:null,y:t}}function ge(e){return e instanceof Q?j.arc:e instanceof W?j.point:e instanceof O?j.bar:j.fallback}function me(e,a,r,t,i,n){var o=Math.PI/2;if(n){var s=Math.min(n,i/2,t/2),l=a+s,u=r+s,d=a+t-s,f=r+i-s;e.moveTo(a,u),l<d&&u<f?(e.arc(l,u,s,-Math.PI,-o),e.arc(d,u,s,-o,0),e.arc(d,f,s,0,o),e.arc(l,f,s,o,Math.PI)):l<d?(e.moveTo(l,r),e.arc(d,u,s,-o,o),e.arc(l,u,s,o,Math.PI+o)):u<f?(e.arc(l,u,s,-Math.PI,0),e.arc(l,f,s,0,Math.PI)):e.arc(l,u,s,-Math.PI,Math.PI),e.closePath(),e.moveTo(a,r)}else e.rect(a,r,t,i)}function we(e,a,r){var t=r.backgroundColor,i=r.borderColor,n=r.borderWidth;!t&&(!i||!n)||(e.beginPath(),me(e,c(a.x)+n/2,c(a.y)+n/2,c(a.w)-n,c(a.h)-n,r.borderRadius),e.closePath(),t&&(e.fillStyle=t,e.fill()),i&&n&&(e.strokeStyle=i,e.lineWidth=n,e.lineJoin="miter",e.stroke()))}function ke(e,a,r){var t=r.lineHeight,i=e.w,n=e.x,o=e.y+t/2;return a==="center"?n+=i/2:(a==="end"||a==="right")&&(n+=i),{h:t,w:i,x:n,y:o}}function Me(e,a,r){var t=e.shadowBlur,i=r.stroked,n=c(r.x),o=c(r.y),s=c(r.w);i&&e.strokeText(a,n,o,s),r.filled&&(t&&i&&(e.shadowBlur=0),e.fillText(a,n,o,s),t&&i&&(e.shadowBlur=t))}function Se(e,a,r,t){var i=t.textAlign,n=t.color,o=!!n,s=t.font,l=a.length,u=t.textStrokeColor,d=t.textStrokeWidth,f=u&&d,y;if(!(!l||!o&&!f))for(r=ke(r,i,s),e.font=s.string,e.textAlign=i,e.textBaseline="middle",e.shadowBlur=t.textShadowBlur,e.shadowColor=t.textShadowColor,o&&(e.fillStyle=n),f&&(e.lineJoin="round",e.lineWidth=d,e.strokeStyle=u),y=0,l=a.length;y<l;++y)Me(e,a[y],{stroked:f,filled:o,w:r.w,x:r.x,y:r.y+r.h*y})}var H=function(e,a,r,t){var i=this;i._config=e,i._index=t,i._model=null,i._rects=null,i._ctx=a,i._el=r};w(H.prototype,{_modelize:function(e,a,r,t){var i=this,n=i._index,o=K(v([r.font,{}],t,n)),s=v([r.color,V.color],t,n);return{align:v([r.align,"center"],t,n),anchor:v([r.anchor,"center"],t,n),area:t.chart.chartArea,backgroundColor:v([r.backgroundColor,null],t,n),borderColor:v([r.borderColor,null],t,n),borderRadius:v([r.borderRadius,0],t,n),borderWidth:v([r.borderWidth,0],t,n),clamp:v([r.clamp,!1],t,n),clip:v([r.clip,!1],t,n),color:s,display:e,font:o,lines:a,offset:v([r.offset,4],t,n),opacity:v([r.opacity,1],t,n),origin:pe(i._el,t),padding:Y(v([r.padding,4],t,n)),positioner:ge(i._el),rotation:v([r.rotation,0],t,n)*(Math.PI/180),size:g.textSize(i._ctx,a,o),textAlign:v([r.textAlign,"start"],t,n),textShadowBlur:v([r.textShadowBlur,0],t,n),textShadowColor:v([r.textShadowColor,s],t,n),textStrokeColor:v([r.textStrokeColor,s],t,n),textStrokeWidth:v([r.textStrokeWidth,0],t,n)}},update:function(e){var a=this,r=null,t=null,i=a._index,n=a._config,o,s,l,u=v([n.display,!0],e,i);u&&(o=e.dataset.data[i],s=Z(D(n.formatter,[o,e]),o),l=p(s)?[]:g.toTextLines(s),l.length&&(r=a._modelize(u,l,n,e),t=_e(r))),a._model=r,a._rects=t},geometry:function(){return this._rects?this._rects.frame:{}},rotation:function(){return this._model?this._model.rotation:0},visible:function(){return this._model&&this._model.opacity},model:function(){return this._model},draw:function(e,a){var r=this,t=e.ctx,i=r._model,n=r._rects,o;this.visible()&&(t.save(),i.clip&&(o=i.area,t.beginPath(),t.rect(o.left,o.top,o.right-o.left,o.bottom-o.top),t.clip()),t.globalAlpha=g.bound(0,i.opacity,1),t.translate(c(a.x),c(a.y)),t.rotate(i.rotation),we(t,n.frame,i),Se(t,i.lines,n.text,i),t.restore())}});var je=Number.MIN_SAFE_INTEGER||-9007199254740991,Ce=Number.MAX_SAFE_INTEGER||9007199254740991;function _(e,a,r){var t=Math.cos(r),i=Math.sin(r),n=a.x,o=a.y;return{x:n+t*(e.x-n)-i*(e.y-o),y:o+i*(e.x-n)+t*(e.y-o)}}function B(e,a){var r=Ce,t=je,i=a.origin,n,o,s,l,u;for(n=0;n<e.length;++n)o=e[n],s=o.x-i.x,l=o.y-i.y,u=a.vx*s+a.vy*l,r=Math.min(r,u),t=Math.max(t,u);return{min:r,max:t}}function C(e,a){var r=a.x-e.x,t=a.y-e.y,i=Math.sqrt(r*r+t*t);return{vx:(a.x-e.x)/i,vy:(a.y-e.y)/i,origin:e,ln:i}}var U=function(){this._rotation=0,this._rect={x:0,y:0,w:0,h:0}};w(U.prototype,{center:function(){var e=this._rect;return{x:e.x+e.w/2,y:e.y+e.h/2}},update:function(e,a,r){this._rotation=r,this._rect={x:a.x+e.x,y:a.y+e.y,w:a.w,h:a.h}},contains:function(e){var a=this,r=1,t=a._rect;return e=_(e,a.center(),-a._rotation),!(e.x<t.x-r||e.y<t.y-r||e.x>t.x+t.w+r*2||e.y>t.y+t.h+r*2)},intersects:function(e){var a=this._points(),r=e._points(),t=[C(a[0],a[1]),C(a[0],a[3])],i,n,o;for(this._rotation!==e._rotation&&t.push(C(r[0],r[1]),C(r[0],r[3])),i=0;i<t.length;++i)if(n=B(a,t[i]),o=B(r,t[i]),n.max<o.min||o.max<n.min)return!1;return!0},_points:function(){var e=this,a=e._rect,r=e._rotation,t=e.center();return[_({x:a.x,y:a.y},t,r),_({x:a.x+a.w,y:a.y},t,r),_({x:a.x+a.w,y:a.y+a.h},t,r),_({x:a.x,y:a.y+a.h},t,r)]}});function X(e,a,r){var t=a.positioner(e,a),i=t.vx,n=t.vy;if(!i&&!n)return{x:t.x,y:t.y};var o=r.w,s=r.h,l=a.rotation,u=Math.abs(o/2*Math.cos(l))+Math.abs(s/2*Math.sin(l)),d=Math.abs(o/2*Math.sin(l))+Math.abs(s/2*Math.cos(l)),f=1/Math.max(Math.abs(i),Math.abs(n));return u*=i*f,d*=n*f,u+=a.offset*i,d+=a.offset*n,{x:t.x+u,y:t.y+d}}function Ee(e,a){var r,t,i,n;for(r=e.length-1;r>=0;--r)for(i=e[r].$layout,t=r-1;t>=0&&i._visible;--t)n=e[t].$layout,n._visible&&i._box.intersects(n._box)&&a(i,n);return e}function Pe(e){var a,r,t,i,n,o,s;for(a=0,r=e.length;a<r;++a)t=e[a],i=t.$layout,i._visible&&(s=new Proxy(t._el,{get:(l,u)=>l.getProps([u],!0)[u]}),n=t.geometry(),o=X(s,t.model(),n),i._box.update(o,n,t.rotation()));return Ee(e,function(l,u){var d=l._hidable,f=u._hidable;d&&f||f?u._visible=!1:d&&(l._visible=!1)})}var m={prepare:function(e){var a=[],r,t,i,n,o;for(r=0,i=e.length;r<i;++r)for(t=0,n=e[r].length;t<n;++t)o=e[r][t],a.push(o),o.$layout={_box:new U,_hidable:!1,_visible:!0,_set:r,_idx:o._index};return a.sort(function(s,l){var u=s.$layout,d=l.$layout;return u._idx===d._idx?d._set-u._set:d._idx-u._idx}),this.update(a),a},update:function(e){var a=!1,r,t,i,n,o;for(r=0,t=e.length;r<t;++r)i=e[r],n=i.model(),o=i.$layout,o._hidable=n&&n.display==="auto",o._visible=i.visible(),a|=o._hidable;a&&Pe(e)},lookup:function(e,a){var r,t;for(r=e.length-1;r>=0;--r)if(t=e[r].$layout,t&&t._visible&&t._box.contains(a))return e[r];return null},draw:function(e,a){var r,t,i,n,o,s;for(r=0,t=a.length;r<t;++r)i=a[r],n=i.$layout,n._visible&&(o=i.geometry(),s=X(i._el,i.model(),o),n._box.update(s,o,i.rotation()),i.draw(e,s))}},Ie=function(e){if(p(e))return null;var a=e,r,t,i;if(re(e))if(!p(e.label))a=e.label;else if(!p(e.r))a=e.r;else for(a="",r=Object.keys(e),i=0,t=r.length;i<t;++i)a+=(i!==0?", ":"")+r[i]+": "+e[r[i]];return""+a},Ae={align:"center",anchor:"center",backgroundColor:null,borderColor:null,borderRadius:0,borderWidth:0,clamp:!1,clip:!1,color:void 0,display:!0,font:{family:void 0,lineHeight:1.2,size:void 0,style:void 0,weight:null},formatter:Ie,labels:void 0,listeners:{},offset:4,opacity:1,padding:{top:4,right:4,bottom:4,left:4},rotation:0,textAlign:"start",textStrokeColor:void 0,textStrokeWidth:0,textShadowBlur:0,textShadowColor:void 0},h="$datalabels",q="$default";function ze(e,a){var r=e.datalabels,t={},i=[],n,o;return r===!1?null:(r===!0&&(r={}),a=w({},[a,r]),n=a.labels||{},o=Object.keys(n),delete a.labels,o.length?o.forEach(function(s){n[s]&&i.push(w({},[a,n[s],{_key:s}]))}):i.push(a),t=i.reduce(function(s,l){return ee(l.listeners||{},function(u,d){s[d]=s[d]||{},s[d][l._key||q]=u}),delete l.listeners,s},{}),{labels:i,listeners:t})}function A(e,a,r,t){if(a){var i=r.$context,n=r.$groups,o;a[n._set]&&(o=a[n._set][n._key],o&&D(o,[i,t])===!0&&(e[h]._dirty=!0,r.update(i)))}}function Re(e,a,r,t,i){var n,o;!r&&!t||(r?t?r!==t&&(o=n=!0):o=!0:n=!0,o&&A(e,a.leave,r,i),n&&A(e,a.enter,t,i))}function Te(e,a){var r=e[h],t=r._listeners,i,n;if(!(!t.enter&&!t.leave)){if(a.type==="mousemove")n=m.lookup(r._labels,a);else if(a.type!=="mouseout")return;i=r._hovered,r._hovered=n,Re(e,t,i,n,a)}}function $e(e,a){var r=e[h],t=r._listeners.click,i=t&&m.lookup(r._labels,a);i&&A(e,t,i,a)}var Be={id:"datalabels",defaults:Ae,beforeInit:function(e){e[h]={_actives:[]}},beforeUpdate:function(e){var a=e[h];a._listened=!1,a._listeners={},a._datasets=[],a._labels=[]},afterDatasetUpdate:function(e,a,r){var t=a.index,i=e[h],n=i._datasets[t]=[],o=e.isDatasetVisible(t),s=e.data.datasets[t],l=ze(s,r),u=a.meta.data||[],d=e.ctx,f,y,z,R,E,T,b,x;for(d.save(),f=0,z=u.length;f<z;++f)if(b=u[f],b[h]=[],o&&b&&e.getDataVisibility(f)&&!b.skip)for(y=0,R=l.labels.length;y<R;++y)E=l.labels[y],T=E._key,x=new H(E,d,b,f),x.$groups={_set:t,_key:T||q},x.$context={active:!1,chart:e,dataIndex:f,dataset:s,datasetIndex:t},x.update(x.$context),b[h].push(x),n.push(x);d.restore(),w(i._listeners,l.listeners,{merger:function(k,P,J){P[k]=P[k]||{},P[k][a.index]=J[k],i._listened=!0}})},afterUpdate:function(e){e[h]._labels=m.prepare(e[h]._datasets)},afterDatasetsDraw:function(e){m.draw(e,e[h]._labels)},beforeEvent:function(e,a){if(e[h]._listened){var r=a.event;switch(r.type){case"mousemove":case"mouseout":Te(e,r);break;case"click":$e(e,r);break}}},afterEvent:function(e){var a=e[h],r=a._actives,t=a._actives=e.getActiveElements(),i=g.arrayDiff(r,t),n,o,s,l,u,d,f;for(n=0,o=i.length;n<o;++n)if(u=i[n],u[1])for(f=u[0].element[h]||[],s=0,l=f.length;s<l;++s)d=f[s],d.$context.active=u[1]===1,d.update(d.$context);(a._dirty||i.length)&&(m.update(a._labels),e.render()),delete a._dirty}};const De=e=>({plugins:{legend:{position:"right",maxWidth:150,align:"start",labels:{color:e.palette.text.secondary,usePointStyle:!0,padding:21,boxHeight:8,font:{size:10}}},datalabels:{color:e.palette.text.primary,font:{weight:"bold",size:10},anchor:"end",align:"top",offset:-6}},responsive:!0,maintainAspectRatio:!1,color:e.palette.text.secondary,scales:{y:{beginAtZero:!0,grid:{color:e.palette.divider,borderColor:e.palette.divider,drawBorder:!1},ticks:{stepSize:1,color:e.palette.text.disabled,font:{size:10}}},x:{grid:{display:!1},ticks:{color:e.palette.text.primary,font:{size:10}}}}});function We(e){return ye.all(e.filter(a=>a))}const Ne=({data:e,ariaLabel:a,ariaDescription:r,overrideOptions:t})=>{const i=te(),{locationSettings:n}=ae(),o=ie.useMemo(()=>We([De(i)]),[i,n,t]);return ne.jsx(oe,{options:o,data:e,"aria-label":a,"aria-description":r,plugins:[Be]})};se.register(le,ue,W,O,de,fe,ve,he);export{De as createOptions,Ne as default};
6
+ */var $=function(){if(typeof window<"u"){if(window.devicePixelRatio)return window.devicePixelRatio;var e=window.screen;if(e)return(e.deviceXDPI||1)/(e.logicalXDPI||1)}return 1}(),m={toTextLines:function(e){var a=[],r;for(e=[].concat(e);e.length;)r=e.pop(),typeof r=="string"?a.unshift.apply(a,r.split(`
7
+ `)):Array.isArray(r)?e.push.apply(e,r):p(e)||a.unshift(""+r);return a},textSize:function(e,a,r){var t=[].concat(a),i=t.length,n=e.font,o=0,s;for(e.font=r.string,s=0;s<i;++s)o=Math.max(e.measureText(t[s]).width,o);return e.font=n,{height:i*r.lineHeight,width:o}},bound:function(e,a,r){return Math.max(e,Math.min(a,r))},arrayDiff:function(e,a){var r=e.slice(),t=[],i,n,o,s;for(i=0,o=a.length;i<o;++i)s=a[i],n=r.indexOf(s),n===-1?t.push([s,1]):r.splice(n,1);for(i=0,o=r.length;i<o;++i)t.push([r[i],-1]);return t},rasterize:function(e){return Math.round(e*$)/$}};function I(e,a){var r=a.x,t=a.y;if(r===null)return{x:0,y:-1};if(t===null)return{x:1,y:0};var i=e.x-r,n=e.y-t,o=Math.sqrt(i*i+n*n);return{x:o?i/o:0,y:o?n/o:-1}}function ce(e,a,r,t,i){switch(i){case"center":r=t=0;break;case"bottom":r=0,t=1;break;case"right":r=1,t=0;break;case"left":r=-1,t=0;break;case"top":r=0,t=-1;break;case"start":r=-r,t=-t;break;case"end":break;default:i*=Math.PI/180,r=Math.cos(i),t=Math.sin(i);break}return{x:e,y:a,vx:r,vy:t}}var xe=0,N=1,L=2,F=4,H=8;function M(e,a,r){var t=xe;return e<r.left?t|=N:e>r.right&&(t|=L),a<r.top?t|=H:a>r.bottom&&(t|=F),t}function be(e,a){for(var r=e.x0,t=e.y0,i=e.x1,n=e.y1,o=M(r,t,a),s=M(i,n,a),l,u,d;!(!(o|s)||o&s);)l=o||s,l&H?(u=r+(i-r)*(a.top-t)/(n-t),d=a.top):l&F?(u=r+(i-r)*(a.bottom-t)/(n-t),d=a.bottom):l&L?(d=t+(n-t)*(a.right-r)/(i-r),u=a.right):l&N&&(d=t+(n-t)*(a.left-r)/(i-r),u=a.left),l===o?(r=u,t=d,o=M(r,t,a)):(i=u,n=d,s=M(i,n,a));return{x0:r,x1:i,y0:t,y1:n}}function S(e,a){var r=a.anchor,t=e,i,n;return a.clamp&&(t=be(t,a.area)),r==="start"?(i=t.x0,n=t.y0):r==="end"?(i=t.x1,n=t.y1):(i=(t.x0+t.x1)/2,n=(t.y0+t.y1)/2),ce(i,n,e.vx,e.vy,a.align)}var j={arc:function(e,a){var r=(e.startAngle+e.endAngle)/2,t=Math.cos(r),i=Math.sin(r),n=e.innerRadius,o=e.outerRadius;return S({x0:e.x+t*n,y0:e.y+i*n,x1:e.x+t*o,y1:e.y+i*o,vx:t,vy:i},a)},point:function(e,a){var r=I(e,a.origin),t=r.x*e.options.radius,i=r.y*e.options.radius;return S({x0:e.x-t,y0:e.y-i,x1:e.x+t,y1:e.y+i,vx:r.x,vy:r.y},a)},bar:function(e,a){var r=I(e,a.origin),t=e.x,i=e.y,n=0,o=0;return e.horizontal?(t=Math.min(e.x,e.base),n=Math.abs(e.base-e.x)):(i=Math.min(e.y,e.base),o=Math.abs(e.base-e.y)),S({x0:t,y0:i+o,x1:t+n,y1:i,vx:r.x,vy:r.y},a)},fallback:function(e,a){var r=I(e,a.origin);return S({x0:e.x,y0:e.y,x1:e.x+(e.width||0),y1:e.y+(e.height||0),vx:r.x,vy:r.y},a)}},c=m.rasterize;function _e(e){var a=e.borderWidth||0,r=e.padding,t=e.size.height,i=e.size.width,n=-i/2,o=-t/2;return{frame:{x:n-r.left-a,y:o-r.top-a,w:i+r.width+a*2,h:t+r.height+a*2},text:{x:n,y:o,w:i,h:t}}}function pe(e,a){var r=a.chart.getDatasetMeta(a.datasetIndex).vScale;if(!r)return null;if(r.xCenter!==void 0&&r.yCenter!==void 0)return{x:r.xCenter,y:r.yCenter};var t=r.getBasePixel();return e.horizontal?{x:t,y:null}:{x:null,y:t}}function me(e){return e instanceof Q?j.arc:e instanceof W?j.point:e instanceof O?j.bar:j.fallback}function ge(e,a,r,t,i,n){var o=Math.PI/2;if(n){var s=Math.min(n,i/2,t/2),l=a+s,u=r+s,d=a+t-s,f=r+i-s;e.moveTo(a,u),l<d&&u<f?(e.arc(l,u,s,-Math.PI,-o),e.arc(d,u,s,-o,0),e.arc(d,f,s,0,o),e.arc(l,f,s,o,Math.PI)):l<d?(e.moveTo(l,r),e.arc(d,u,s,-o,o),e.arc(l,u,s,o,Math.PI+o)):u<f?(e.arc(l,u,s,-Math.PI,0),e.arc(l,f,s,0,Math.PI)):e.arc(l,u,s,-Math.PI,Math.PI),e.closePath(),e.moveTo(a,r)}else e.rect(a,r,t,i)}function we(e,a,r){var t=r.backgroundColor,i=r.borderColor,n=r.borderWidth;!t&&(!i||!n)||(e.beginPath(),ge(e,c(a.x)+n/2,c(a.y)+n/2,c(a.w)-n,c(a.h)-n,r.borderRadius),e.closePath(),t&&(e.fillStyle=t,e.fill()),i&&n&&(e.strokeStyle=i,e.lineWidth=n,e.lineJoin="miter",e.stroke()))}function ke(e,a,r){var t=r.lineHeight,i=e.w,n=e.x,o=e.y+t/2;return a==="center"?n+=i/2:(a==="end"||a==="right")&&(n+=i),{h:t,w:i,x:n,y:o}}function Me(e,a,r){var t=e.shadowBlur,i=r.stroked,n=c(r.x),o=c(r.y),s=c(r.w);i&&e.strokeText(a,n,o,s),r.filled&&(t&&i&&(e.shadowBlur=0),e.fillText(a,n,o,s),t&&i&&(e.shadowBlur=t))}function Se(e,a,r,t){var i=t.textAlign,n=t.color,o=!!n,s=t.font,l=a.length,u=t.textStrokeColor,d=t.textStrokeWidth,f=u&&d,y;if(!(!l||!o&&!f))for(r=ke(r,i,s),e.font=s.string,e.textAlign=i,e.textBaseline="middle",e.shadowBlur=t.textShadowBlur,e.shadowColor=t.textShadowColor,o&&(e.fillStyle=n),f&&(e.lineJoin="round",e.lineWidth=d,e.strokeStyle=u),y=0,l=a.length;y<l;++y)Me(e,a[y],{stroked:f,filled:o,w:r.w,x:r.x,y:r.y+r.h*y})}var G=function(e,a,r,t){var i=this;i._config=e,i._index=t,i._model=null,i._rects=null,i._ctx=a,i._el=r};w(G.prototype,{_modelize:function(e,a,r,t){var i=this,n=i._index,o=K(v([r.font,{}],t,n)),s=v([r.color,V.color],t,n);return{align:v([r.align,"center"],t,n),anchor:v([r.anchor,"center"],t,n),area:t.chart.chartArea,backgroundColor:v([r.backgroundColor,null],t,n),borderColor:v([r.borderColor,null],t,n),borderRadius:v([r.borderRadius,0],t,n),borderWidth:v([r.borderWidth,0],t,n),clamp:v([r.clamp,!1],t,n),clip:v([r.clip,!1],t,n),color:s,display:e,font:o,lines:a,offset:v([r.offset,4],t,n),opacity:v([r.opacity,1],t,n),origin:pe(i._el,t),padding:Y(v([r.padding,4],t,n)),positioner:me(i._el),rotation:v([r.rotation,0],t,n)*(Math.PI/180),size:m.textSize(i._ctx,a,o),textAlign:v([r.textAlign,"start"],t,n),textShadowBlur:v([r.textShadowBlur,0],t,n),textShadowColor:v([r.textShadowColor,s],t,n),textStrokeColor:v([r.textStrokeColor,s],t,n),textStrokeWidth:v([r.textStrokeWidth,0],t,n)}},update:function(e){var a=this,r=null,t=null,i=a._index,n=a._config,o,s,l,u=v([n.display,!0],e,i);u&&(o=e.dataset.data[i],s=Z(D(n.formatter,[o,e]),o),l=p(s)?[]:m.toTextLines(s),l.length&&(r=a._modelize(u,l,n,e),t=_e(r))),a._model=r,a._rects=t},geometry:function(){return this._rects?this._rects.frame:{}},rotation:function(){return this._model?this._model.rotation:0},visible:function(){return this._model&&this._model.opacity},model:function(){return this._model},draw:function(e,a){var r=this,t=e.ctx,i=r._model,n=r._rects,o;this.visible()&&(t.save(),i.clip&&(o=i.area,t.beginPath(),t.rect(o.left,o.top,o.right-o.left,o.bottom-o.top),t.clip()),t.globalAlpha=m.bound(0,i.opacity,1),t.translate(c(a.x),c(a.y)),t.rotate(i.rotation),we(t,n.frame,i),Se(t,i.lines,n.text,i),t.restore())}});var je=Number.MIN_SAFE_INTEGER||-9007199254740991,Ce=Number.MAX_SAFE_INTEGER||9007199254740991;function _(e,a,r){var t=Math.cos(r),i=Math.sin(r),n=a.x,o=a.y;return{x:n+t*(e.x-n)-i*(e.y-o),y:o+i*(e.x-n)+t*(e.y-o)}}function B(e,a){var r=Ce,t=je,i=a.origin,n,o,s,l,u;for(n=0;n<e.length;++n)o=e[n],s=o.x-i.x,l=o.y-i.y,u=a.vx*s+a.vy*l,r=Math.min(r,u),t=Math.max(t,u);return{min:r,max:t}}function C(e,a){var r=a.x-e.x,t=a.y-e.y,i=Math.sqrt(r*r+t*t);return{vx:(a.x-e.x)/i,vy:(a.y-e.y)/i,origin:e,ln:i}}var U=function(){this._rotation=0,this._rect={x:0,y:0,w:0,h:0}};w(U.prototype,{center:function(){var e=this._rect;return{x:e.x+e.w/2,y:e.y+e.h/2}},update:function(e,a,r){this._rotation=r,this._rect={x:a.x+e.x,y:a.y+e.y,w:a.w,h:a.h}},contains:function(e){var a=this,r=1,t=a._rect;return e=_(e,a.center(),-a._rotation),!(e.x<t.x-r||e.y<t.y-r||e.x>t.x+t.w+r*2||e.y>t.y+t.h+r*2)},intersects:function(e){var a=this._points(),r=e._points(),t=[C(a[0],a[1]),C(a[0],a[3])],i,n,o;for(this._rotation!==e._rotation&&t.push(C(r[0],r[1]),C(r[0],r[3])),i=0;i<t.length;++i)if(n=B(a,t[i]),o=B(r,t[i]),n.max<o.min||o.max<n.min)return!1;return!0},_points:function(){var e=this,a=e._rect,r=e._rotation,t=e.center();return[_({x:a.x,y:a.y},t,r),_({x:a.x+a.w,y:a.y},t,r),_({x:a.x+a.w,y:a.y+a.h},t,r),_({x:a.x,y:a.y+a.h},t,r)]}});function X(e,a,r){var t=a.positioner(e,a),i=t.vx,n=t.vy;if(!i&&!n)return{x:t.x,y:t.y};var o=r.w,s=r.h,l=a.rotation,u=Math.abs(o/2*Math.cos(l))+Math.abs(s/2*Math.sin(l)),d=Math.abs(o/2*Math.sin(l))+Math.abs(s/2*Math.cos(l)),f=1/Math.max(Math.abs(i),Math.abs(n));return u*=i*f,d*=n*f,u+=a.offset*i,d+=a.offset*n,{x:t.x+u,y:t.y+d}}function Ee(e,a){var r,t,i,n;for(r=e.length-1;r>=0;--r)for(i=e[r].$layout,t=r-1;t>=0&&i._visible;--t)n=e[t].$layout,n._visible&&i._box.intersects(n._box)&&a(i,n);return e}function Pe(e){var a,r,t,i,n,o,s;for(a=0,r=e.length;a<r;++a)t=e[a],i=t.$layout,i._visible&&(s=new Proxy(t._el,{get:(l,u)=>l.getProps([u],!0)[u]}),n=t.geometry(),o=X(s,t.model(),n),i._box.update(o,n,t.rotation()));return Ee(e,function(l,u){var d=l._hidable,f=u._hidable;d&&f||f?u._visible=!1:d&&(l._visible=!1)})}var g={prepare:function(e){var a=[],r,t,i,n,o;for(r=0,i=e.length;r<i;++r)for(t=0,n=e[r].length;t<n;++t)o=e[r][t],a.push(o),o.$layout={_box:new U,_hidable:!1,_visible:!0,_set:r,_idx:o._index};return a.sort(function(s,l){var u=s.$layout,d=l.$layout;return u._idx===d._idx?d._set-u._set:d._idx-u._idx}),this.update(a),a},update:function(e){var a=!1,r,t,i,n,o;for(r=0,t=e.length;r<t;++r)i=e[r],n=i.model(),o=i.$layout,o._hidable=n&&n.display==="auto",o._visible=i.visible(),a|=o._hidable;a&&Pe(e)},lookup:function(e,a){var r,t;for(r=e.length-1;r>=0;--r)if(t=e[r].$layout,t&&t._visible&&t._box.contains(a))return e[r];return null},draw:function(e,a){var r,t,i,n,o,s;for(r=0,t=a.length;r<t;++r)i=a[r],n=i.$layout,n._visible&&(o=i.geometry(),s=X(i._el,i.model(),o),n._box.update(s,o,i.rotation()),i.draw(e,s))}},Ie=function(e){if(p(e))return null;var a=e,r,t,i;if(re(e))if(!p(e.label))a=e.label;else if(!p(e.r))a=e.r;else for(a="",r=Object.keys(e),i=0,t=r.length;i<t;++i)a+=(i!==0?", ":"")+r[i]+": "+e[r[i]];return""+a},Ae={align:"center",anchor:"center",backgroundColor:null,borderColor:null,borderRadius:0,borderWidth:0,clamp:!1,clip:!1,color:void 0,display:!0,font:{family:void 0,lineHeight:1.2,size:void 0,style:void 0,weight:null},formatter:Ie,labels:void 0,listeners:{},offset:4,opacity:1,padding:{top:4,right:4,bottom:4,left:4},rotation:0,textAlign:"start",textStrokeColor:void 0,textStrokeWidth:0,textShadowBlur:0,textShadowColor:void 0},h="$datalabels",q="$default";function ze(e,a){var r=e.datalabels,t={},i=[],n,o;return r===!1?null:(r===!0&&(r={}),a=w({},[a,r]),n=a.labels||{},o=Object.keys(n),delete a.labels,o.length?o.forEach(function(s){n[s]&&i.push(w({},[a,n[s],{_key:s}]))}):i.push(a),t=i.reduce(function(s,l){return ee(l.listeners||{},function(u,d){s[d]=s[d]||{},s[d][l._key||q]=u}),delete l.listeners,s},{}),{labels:i,listeners:t})}function A(e,a,r,t){if(a){var i=r.$context,n=r.$groups,o;a[n._set]&&(o=a[n._set][n._key],o&&D(o,[i,t])===!0&&(e[h]._dirty=!0,r.update(i)))}}function Re(e,a,r,t,i){var n,o;!r&&!t||(r?t?r!==t&&(o=n=!0):o=!0:n=!0,o&&A(e,a.leave,r,i),n&&A(e,a.enter,t,i))}function Te(e,a){var r=e[h],t=r._listeners,i,n;if(!(!t.enter&&!t.leave)){if(a.type==="mousemove")n=g.lookup(r._labels,a);else if(a.type!=="mouseout")return;i=r._hovered,r._hovered=n,Re(e,t,i,n,a)}}function $e(e,a){var r=e[h],t=r._listeners.click,i=t&&g.lookup(r._labels,a);i&&A(e,t,i,a)}var Be={id:"datalabels",defaults:Ae,beforeInit:function(e){e[h]={_actives:[]}},beforeUpdate:function(e){var a=e[h];a._listened=!1,a._listeners={},a._datasets=[],a._labels=[]},afterDatasetUpdate:function(e,a,r){var t=a.index,i=e[h],n=i._datasets[t]=[],o=e.isDatasetVisible(t),s=e.data.datasets[t],l=ze(s,r),u=a.meta.data||[],d=e.ctx,f,y,z,R,E,T,b,x;for(d.save(),f=0,z=u.length;f<z;++f)if(b=u[f],b[h]=[],o&&b&&e.getDataVisibility(f)&&!b.skip)for(y=0,R=l.labels.length;y<R;++y)E=l.labels[y],T=E._key,x=new G(E,d,b,f),x.$groups={_set:t,_key:T||q},x.$context={active:!1,chart:e,dataIndex:f,dataset:s,datasetIndex:t},x.update(x.$context),b[h].push(x),n.push(x);d.restore(),w(i._listeners,l.listeners,{merger:function(k,P,J){P[k]=P[k]||{},P[k][a.index]=J[k],i._listened=!0}})},afterUpdate:function(e){e[h]._labels=g.prepare(e[h]._datasets)},afterDatasetsDraw:function(e){g.draw(e,e[h]._labels)},beforeEvent:function(e,a){if(e[h]._listened){var r=a.event;switch(r.type){case"mousemove":case"mouseout":Te(e,r);break;case"click":$e(e,r);break}}},afterEvent:function(e){var a=e[h],r=a._actives,t=a._actives=e.getActiveElements(),i=m.arrayDiff(r,t),n,o,s,l,u,d,f;for(n=0,o=i.length;n<o;++n)if(u=i[n],u[1])for(f=u[0].element[h]||[],s=0,l=f.length;s<l;++s)d=f[s],d.$context.active=u[1]===1,d.update(d.$context);(a._dirty||i.length)&&(g.update(a._labels),e.render()),delete a._dirty}};const De=e=>({plugins:{legend:{position:"right",maxWidth:150,align:"start",labels:{color:e.palette.text.secondary,usePointStyle:!0,padding:21,boxHeight:8,font:{size:10}}},datalabels:{color:e.palette.text.primary,font:{weight:"bold",size:10},anchor:"end",align:"top",offset:-6}},responsive:!0,maintainAspectRatio:!1,color:e.palette.text.secondary,scales:{y:{beginAtZero:!0,grid:{color:e.palette.divider,borderColor:e.palette.divider,drawBorder:!1},ticks:{stepSize:1,color:e.palette.text.disabled,font:{size:10}}},x:{grid:{display:!1},ticks:{color:e.palette.text.primary,font:{size:10}}}}});function We(e){return ye.all(e.filter(a=>a))}const Ne=({data:e,ariaLabel:a,ariaDescription:r,overrideOptions:t})=>{const i=te(),{locationSettings:n}=ae(),o=ie.useMemo(()=>We([De(i)]),[i,n,t]);return ne.jsx(oe,{options:o,data:e,"aria-label":a,"aria-description":r,plugins:[Be]})};se.register(le,ue,W,O,de,fe,ve,he);export{De as createOptions,Ne as default};
@@ -1 +1 @@
1
- import{jH as g,jI as u,s as x,b as j,bq as y,r as p,j as i,jJ as b,jK as m,C,jL as S,jM as h,jN as f,ji as L,jj as R,jk as k,jB as w,jO as A,jE as E,jn as T,jo as v,jF as F,jG as M}from"./index-g9pKMnOR.js";const _={position:"bottom",labels:{boxWidth:12,padding:30,generateLabels:t=>{var l;const s=t.data.datasets,{labels:{usePointStyle:e,pointStyle:o,textAlign:r,color:d}}=((l=t==null?void 0:t.legend)==null?void 0:l.options)||{labels:{}};return t._getSortedDatasetMetas().map(n=>{const a=n.controller.getStyle(e?0:void 0);return{text:s[n.index].label,fillStyle:a.borderColor,fontColor:d,hidden:!n.visible,lineWidth:0,borderRadius:6,strokeStyle:a.borderColor,pointStyle:o||a.pointStyle,textAlign:r||a.textAlign,datasetIndex:n.index}})}}},B=(t,s,e,o)=>({responsive:!0,...o?{animation:{duration:0}}:{},plugins:{legend:{..._,display:!o},tooltip:{enabled:!1,position:"nearest",external:g(e)}},locale:s.locale,interaction:{intersect:!1,axis:"xy",mode:"nearest"},elements:{point:{radius:0,hitRadius:15}},color:t.palette.text.secondary,scales:{y:{beginAtZero:!0,type:"linear",grid:{color:t.palette.divider,borderColor:t.palette.divider},ticks:{color:t.palette.text.secondary,display:!o,precision:0}},x:{adapters:{date:{locale:u(s.locale)}},type:"time",time:{unit:"week",tooltipFormat:"P"},grid:{color:"transparent",borderColor:"transparent"},ticks:{color:t.palette.text.secondary,display:!o,source:"data",maxRotation:90,minRotation:23.5}}}}),D=x("div")(({theme:t})=>({position:"relative"}));function G(t){return M.all(t.filter(s=>s))}const I=({data:t,aspectRatio:s=2.5,cover:e,overrideOptions:o,TooltipComponent:r})=>{const d=j(),{locationSettings:l}=y(),[n,a]=p.useState(null),c=p.useMemo(()=>G([B(d,l,a,!!e),o??{}]),[d,l,a,o,e]);return i.jsxs(D,{children:[i.jsx(b,{options:c,data:t,plugins:[m({width:26})],height:100,width:100*s},e?"cover":"chart"),i.jsx(C,{condition:!e,show:r?i.jsx(S,{tooltip:n,children:i.jsx(r,{tooltip:n})}):i.jsx(h,{tooltip:n}),elseShow:i.jsx(f,{children:e!==!0?e:" "})})]})};L.register(R,k,w,A,E,T,v,F);export{I as default};
1
+ import{jK as g,jL as u,s as x,b as j,bq as y,r as p,j as i,jM as b,jN as m,C,jO as S,jP as h,jQ as f,jl as L,jm as R,jn as w,jE as A,jR as E,jH as T,jq as k,jr as v,jI as M,jJ as _}from"./index-Cz4lAJ3Y.js";const q={position:"bottom",labels:{boxWidth:12,padding:30,generateLabels:t=>{var l;const s=t.data.datasets,{labels:{usePointStyle:e,pointStyle:o,textAlign:r,color:d}}=((l=t==null?void 0:t.legend)==null?void 0:l.options)||{labels:{}};return t._getSortedDatasetMetas().map(n=>{const a=n.controller.getStyle(e?0:void 0);return{text:s[n.index].label,fillStyle:a.borderColor,fontColor:d,hidden:!n.visible,lineWidth:0,borderRadius:6,strokeStyle:a.borderColor,pointStyle:o||a.pointStyle,textAlign:r||a.textAlign,datasetIndex:n.index}})}}},D=(t,s,e,o)=>({responsive:!0,...o?{animation:{duration:0}}:{},plugins:{legend:{...q,display:!o},tooltip:{enabled:!1,position:"nearest",external:g(e)}},locale:s.locale,interaction:{intersect:!1,axis:"xy",mode:"nearest"},elements:{point:{radius:0,hitRadius:15}},color:t.palette.text.secondary,scales:{y:{beginAtZero:!0,type:"linear",grid:{color:t.palette.divider,borderColor:t.palette.divider},ticks:{color:t.palette.text.secondary,display:!o,precision:0}},x:{adapters:{date:{locale:u(s.locale)}},type:"time",time:{unit:"week",tooltipFormat:"P"},grid:{color:"transparent",borderColor:"transparent"},ticks:{color:t.palette.text.secondary,display:!o,source:"data",maxRotation:90,minRotation:23.5}}}}),F=x("div")(({theme:t})=>({position:"relative"}));function H(t){return _.all(t.filter(s=>s))}const O=({data:t,aspectRatio:s=2.5,cover:e,overrideOptions:o,TooltipComponent:r})=>{const d=j(),{locationSettings:l}=y(),[n,a]=p.useState(null),c=p.useMemo(()=>H([D(d,l,a,!!e),o??{}]),[d,l,a,o,e]);return i.jsxs(F,{children:[i.jsx(b,{options:c,data:t,plugins:[m({width:26})],height:100,width:100*s},e?"cover":"chart"),i.jsx(C,{condition:!e,show:r?i.jsx(S,{tooltip:n,children:i.jsx(r,{tooltip:n})}):i.jsx(h,{tooltip:n}),elseShow:i.jsx(f,{children:e!==!0?e:" "})})]})};L.register(R,w,A,E,T,k,v,M);export{O as default};
@@ -1 +1 @@
1
- import{cj as H,b7 as k,b9 as L,j as e,aV as $,C as p,R as m,T as C,L as y,aT as P,aU as D,f as M,bd as _,fY as E,aR as W,aS as z,i as G,r as f,dE as F,dF as B,s as N,A as J,n as K,m as Y,o as Q,q as X,jq as Z,aq as U,B as T,fg as I,jr as A,fh as b}from"./index-g9pKMnOR.js";const ee=t=>fetch(t).then(L("ChangeRequest")).then(s=>s.json()),te=(t,s)=>{const r=s.map(i=>`feature=${i}`).join("&"),{data:n,error:a,mutate:o}=H([],k(`api/admin/projects/${t}/change-requests/scheduled?${r}`),ee);return{changeRequests:n,loading:!a&&!n,refetch:o,error:a}},q=()=>e.jsx(m,{severity:"warning",sx:{m:t=>t.spacing(2,0)},children:"Archiving flags with dependencies will also remove those dependencies."}),ne=({ids:t,projectId:s})=>{const r=n=>`/projects/${s}/features/${n}`;return t?e.jsxs(m,{severity:"warning",sx:{m:n=>n.spacing(2,0)},children:[e.jsx(C,{fontWeight:"bold",variant:"body2",display:"inline",children:`${t.length} feature flags `}),e.jsx("span",{children:"have usage from applications. If you archive these feature flags they will not be available to Client SDKs:"}),e.jsx("ul",{children:t==null?void 0:t.map(n=>e.jsx("li",{children:e.jsx(y,{to:r(n),children:n})},n))})]}):null},S=({ids:t,projectId:s})=>{const r=n=>`/projects/${s}/features/${n}`;return t&&t.length>1?e.jsxs(m,{severity:"error",sx:{m:n=>n.spacing(2,0)},children:[e.jsx(C,{fontWeight:"bold",variant:"body2",display:"inline",children:`${t.length} feature flags `}),e.jsx("span",{children:"have child features that depend on them and are not part of the archive operation. These parent features can not be archived:"}),e.jsx("ul",{children:t==null?void 0:t.map(n=>e.jsx("li",{children:e.jsx(y,{to:r(n),children:n})},n))})]}):t&&t.length===1?e.jsxs(m,{severity:"error",sx:{m:n=>n.spacing(2,0)},children:[e.jsx(y,{to:r(t[0]),children:t[0]})," has child features that depend on it and are not part of the archive operation."]}):null},R=({changeRequests:t,projectId:s})=>t&&t.length>0?e.jsxs(m,{severity:"warning",sx:{m:r=>r.spacing(2,0)},children:[e.jsxs("p",{children:["This archive operation would conflict with"," ",t.length," scheduled change request(s). The change request(s) that would be affected by this are:"]}),e.jsx("ul",{children:t.map(({id:r,title:n})=>{const a=n?`#${r} (${n})`:`Change request #${r}`;return e.jsx("li",{children:e.jsx(y,{to:`/projects/${s}/change-requests/${r}`,target:"_blank",rel:"noopener noreferrer",title:`Change request ${r}`,children:a})},r)})})]}):t===void 0?e.jsx(m,{severity:"warning",children:e.jsx("p",{children:"This archive operation might conflict with one or more scheduled change requests. If you complete it, those change requests can no longer be applied."})}):null,se=(t,s)=>{const n=P(t)(),{isChangeRequestConfiguredForReview:a}=D(t);return n&&a(n)&&s?"Add to change request":n&&a(n)?"Add change to draft":s?"Archive flags":"Archive flag"},ae=({projectId:t,featureIds:s,onSuccess:r,onError:n})=>{const{setToastData:a,setToastApiError:o}=M(),{archiveFeatureToggle:i}=_(),{archiveFeatures:c}=E(),{isChangeRequestConfiguredForReview:h}=D(t),{addChange:x}=W(),{refetch:u}=z(t),d=P(t),g=(s==null?void 0:s.length)>1,l=d(),v=async()=>{if(!l){console.error("No change request environment");return}await x(t,l,s.map(w=>({action:"archiveFeature",feature:w,payload:void 0}))),u(),a({type:"success",text:g?"Changes added to a draft":"Change added to a draft"})},j=async()=>{await i(t,s[0]),a({type:"success",text:"Feature flag archived"})},V=async()=>{await c(t,s),a({type:"success",text:"Feature flags archived"})};return async()=>{try{l&&h(l)?await v():g?await V():await j(),r()}catch(w){o(G(w)),n()}}},re=(t,s,r)=>{const[n,a]=f.useState(!0),[o,i]=f.useState([]),[c,h]=f.useState(!1),{verifyArchiveFeatures:x}=E();return f.useEffect(()=>{r&&x(s,t).then(u=>u.json()).then(({hasDeletedDependencies:u,parentsWithChildFeatures:d})=>{d.length===0?(a(!1),i(d)):(a(!0),i(d)),h(u)})},[JSON.stringify(t),r,s,i,a,h]),{disableArchive:n,offendingParents:o,hasDeletedDependencies:c}},ue=({isOpen:t,onClose:s,onConfirm:r,projectId:n,featureIds:a,featuresWithUsage:o})=>{const i=(a==null?void 0:a.length)>1,c=se(n,i),h=i?"Archive feature flags":"Archive feature flag",x=ae({projectId:n,featureIds:a,onSuccess(){r(),s()},onError(){s()}}),{changeRequests:u}=te(n,a),{disableArchive:d,offendingParents:g,hasDeletedDependencies:l}=re(a,n,t),v=g.length===0&&l;return e.jsx($,{onClick:x,open:t,onClose:s,primaryButtonText:c,secondaryButtonText:"Cancel",title:h,disabledPrimaryButton:d,children:e.jsx(p,{condition:i,show:e.jsxs(e.Fragment,{children:[e.jsxs("p",{children:["Are you sure you want to archive"," ",e.jsx("strong",{children:a==null?void 0:a.length})," feature flags?"]}),e.jsx(p,{condition:!!(o&&(o==null?void 0:o.length)>0),show:e.jsx(ne,{ids:o,projectId:n})}),e.jsx(p,{condition:g.length>0,show:e.jsx(S,{ids:g,projectId:n})}),e.jsx(p,{condition:v,show:e.jsx(q,{})}),e.jsx(R,{changeRequests:u,projectId:n}),e.jsx(p,{condition:(a==null?void 0:a.length)<=5,show:e.jsx("ul",{children:a==null?void 0:a.map(j=>e.jsx("li",{children:j},j))})})]}),elseShow:e.jsxs(e.Fragment,{children:[e.jsxs("p",{children:["Are you sure you want to archive"," ",i?"these feature flags":"this feature flag","?"]}),e.jsx(p,{condition:g.length>0,show:e.jsx(S,{ids:g,projectId:n})}),e.jsx(p,{condition:v,show:e.jsx(q,{})}),e.jsx(R,{changeRequests:u,projectId:n})]})})})},ie=(t,s)=>`/api/admin/projects/${t}/features/${s}/parents`,ge=(t,s)=>{const r=k(ie(t,s)),{data:n,refetch:a,loading:o,error:i}=F(r,()=>B(r,"Parent Options"));return{parentOptions:n,loading:o,error:i}},oe=(t,s)=>`/api/admin/projects/${t}/features/${s}/parent-variants`,O=(t,s)=>{const r=k(oe(t,s)),{data:n,refetch:a,loading:o,error:i}=F(r,()=>B(r,"Parent Variant Options"));return{parentVariantOptions:n||[],loading:o,error:i}},ce=N(J)(({theme:t})=>({marginTop:t.spacing(2),marginBottom:t.spacing(1.5)})),le=({project:t,parent:s,onSelect:r})=>{const{parentVariantOptions:n}=O(t,s),a=e.jsx(Q,{fontSize:"small"}),o=e.jsx(X,{fontSize:"small"});return e.jsx(ce,{id:"single-variant-options",options:n,renderOption:(i,c,{selected:h})=>e.jsxs("li",{...i,children:[e.jsx(K,{icon:a,checkedIcon:o,style:{marginRight:8},checked:h}),c]}),renderInput:i=>e.jsx(Y,{...i,placeholder:"Select variant"}),fullWidth:!0,onChange:(i,c)=>{r(String(c))}})},de=({projectId:t,featureId:s,isOpen:r,setIsOpen:n,onComplete:a})=>{const{markFeatureCompleted:o}=Z(),{parentVariantOptions:i}=O(t,s),[c,h]=f.useState("kept"),[x,u]=f.useState(void 0),{trackEvent:d}=U(),g=async()=>{const l=c==="kept-with-variant"?"kept":c;await o(s,t,{status:l,statusValue:x}),n(!1),a(),d("feature-lifecycle",{props:{eventType:"complete",status:l}})};return e.jsx($,{open:r,title:"Mark completed",onClose:()=>{n(!1)},disabledPrimaryButton:c==="kept-with-variant"&&x===null,onClick:g,primaryButtonText:"Mark completed",secondaryButtonText:"Cancel",children:e.jsxs(T,{children:[e.jsxs(T,{sx:{mt:2,mb:4},children:["Marking the feature ",e.jsx("b",{children:s})," as complete does not affect any configuration, but it moves the feature flag into it’s next life cycle stage and is an indication that you have learned what you needed in order to progress with the feature. It serves as a reminder to start cleaning up the feature flag and removing it from the code."]}),e.jsx(C,{sx:{mb:2},children:e.jsx("b",{children:"What was the outcome of this feature?"})}),e.jsxs(I,{"aria-label":"selected-value",name:"selected",sx:{gap:l=>l.spacing(.5)},onChange:(l,v)=>{h(v)},children:[e.jsx(A,{value:"kept",legal:{value:"We decided to keep the feature"},control:e.jsx(b,{})},"kept"),e.jsx(A,{value:"discarded",legal:{value:"We decided to discard the feature"},control:e.jsx(b,{})},"discarded"),e.jsx(p,{condition:i.length>0,show:e.jsx(A,{value:"kept-with-variant",legal:{value:"We decided to keep the feature variant",description:"Choose to specify which feature variant will be kept"},control:e.jsx(b,{})},"kept-with-variant")}),e.jsx(p,{condition:i.length>0&&c==="kept-with-variant",show:e.jsx(le,{parent:s,project:t,onSelect:l=>{u(l)}})})]})]})})};export{ue as F,de as M,ge as a,O as u};
1
+ import{cj as H,b7 as k,b9 as L,j as e,aV as $,C as p,R as m,T as C,L as y,aT as P,aU as D,f as M,bd as _,fY as E,aR as W,aS as z,i as G,r as f,dE as F,dF as B,s as N,A as J,n as K,m as Y,o as Q,q as X,jt as Z,aq as U,B as T,fg as I,ju as A,fh as b}from"./index-Cz4lAJ3Y.js";const ee=t=>fetch(t).then(L("ChangeRequest")).then(s=>s.json()),te=(t,s)=>{const r=s.map(i=>`feature=${i}`).join("&"),{data:n,error:a,mutate:o}=H([],k(`api/admin/projects/${t}/change-requests/scheduled?${r}`),ee);return{changeRequests:n,loading:!a&&!n,refetch:o,error:a}},S=()=>e.jsx(m,{severity:"warning",sx:{m:t=>t.spacing(2,0)},children:"Archiving flags with dependencies will also remove those dependencies."}),ne=({ids:t,projectId:s})=>{const r=n=>`/projects/${s}/features/${n}`;return t?e.jsxs(m,{severity:"warning",sx:{m:n=>n.spacing(2,0)},children:[e.jsx(C,{fontWeight:"bold",variant:"body2",display:"inline",children:`${t.length} feature flags `}),e.jsx("span",{children:"have usage from applications. If you archive these feature flags they will not be available to Client SDKs:"}),e.jsx("ul",{children:t==null?void 0:t.map(n=>e.jsx("li",{children:e.jsx(y,{to:r(n),children:n})},n))})]}):null},q=({ids:t,projectId:s})=>{const r=n=>`/projects/${s}/features/${n}`;return t&&t.length>1?e.jsxs(m,{severity:"error",sx:{m:n=>n.spacing(2,0)},children:[e.jsx(C,{fontWeight:"bold",variant:"body2",display:"inline",children:`${t.length} feature flags `}),e.jsx("span",{children:"have child features that depend on them and are not part of the archive operation. These parent features can not be archived:"}),e.jsx("ul",{children:t==null?void 0:t.map(n=>e.jsx("li",{children:e.jsx(y,{to:r(n),children:n})},n))})]}):t&&t.length===1?e.jsxs(m,{severity:"error",sx:{m:n=>n.spacing(2,0)},children:[e.jsx(y,{to:r(t[0]),children:t[0]})," has child features that depend on it and are not part of the archive operation."]}):null},R=({changeRequests:t,projectId:s})=>t&&t.length>0?e.jsxs(m,{severity:"warning",sx:{m:r=>r.spacing(2,0)},children:[e.jsxs("p",{children:["This archive operation would conflict with"," ",t.length," scheduled change request(s). The change request(s) that would be affected by this are:"]}),e.jsx("ul",{children:t.map(({id:r,title:n})=>{const a=n?`#${r} (${n})`:`Change request #${r}`;return e.jsx("li",{children:e.jsx(y,{to:`/projects/${s}/change-requests/${r}`,target:"_blank",rel:"noopener noreferrer",title:`Change request ${r}`,children:a})},r)})})]}):t===void 0?e.jsx(m,{severity:"warning",children:e.jsx("p",{children:"This archive operation might conflict with one or more scheduled change requests. If you complete it, those change requests can no longer be applied."})}):null,se=(t,s)=>{const n=P(t)(),{isChangeRequestConfiguredForReview:a}=D(t);return n&&a(n)&&s?"Add to change request":n&&a(n)?"Add change to draft":s?"Archive flags":"Archive flag"},ae=({projectId:t,featureIds:s,onSuccess:r,onError:n})=>{const{setToastData:a,setToastApiError:o}=M(),{archiveFeatureToggle:i}=_(),{archiveFeatures:c}=E(),{isChangeRequestConfiguredForReview:h}=D(t),{addChange:x}=W(),{refetch:u}=z(t),d=P(t),g=(s==null?void 0:s.length)>1,l=d(),v=async()=>{if(!l){console.error("No change request environment");return}await x(t,l,s.map(w=>({action:"archiveFeature",feature:w,payload:void 0}))),u(),a({type:"success",text:g?"Changes added to a draft":"Change added to a draft"})},j=async()=>{await i(t,s[0]),a({type:"success",text:"Feature flag archived"})},V=async()=>{await c(t,s),a({type:"success",text:"Feature flags archived"})};return async()=>{try{l&&h(l)?await v():g?await V():await j(),r()}catch(w){o(G(w)),n()}}},re=(t,s,r)=>{const[n,a]=f.useState(!0),[o,i]=f.useState([]),[c,h]=f.useState(!1),{verifyArchiveFeatures:x}=E();return f.useEffect(()=>{r&&x(s,t).then(u=>u.json()).then(({hasDeletedDependencies:u,parentsWithChildFeatures:d})=>{d.length===0?(a(!1),i(d)):(a(!0),i(d)),h(u)})},[JSON.stringify(t),r,s,i,a,h]),{disableArchive:n,offendingParents:o,hasDeletedDependencies:c}},ue=({isOpen:t,onClose:s,onConfirm:r,projectId:n,featureIds:a,featuresWithUsage:o})=>{const i=(a==null?void 0:a.length)>1,c=se(n,i),h=i?"Archive feature flags":"Archive feature flag",x=ae({projectId:n,featureIds:a,onSuccess(){r(),s()},onError(){s()}}),{changeRequests:u}=te(n,a),{disableArchive:d,offendingParents:g,hasDeletedDependencies:l}=re(a,n,t),v=g.length===0&&l;return e.jsx($,{onClick:x,open:t,onClose:s,primaryButtonText:c,secondaryButtonText:"Cancel",title:h,disabledPrimaryButton:d,children:e.jsx(p,{condition:i,show:e.jsxs(e.Fragment,{children:[e.jsxs("p",{children:["Are you sure you want to archive"," ",e.jsx("strong",{children:a==null?void 0:a.length})," feature flags?"]}),e.jsx(p,{condition:!!(o&&(o==null?void 0:o.length)>0),show:e.jsx(ne,{ids:o,projectId:n})}),e.jsx(p,{condition:g.length>0,show:e.jsx(q,{ids:g,projectId:n})}),e.jsx(p,{condition:v,show:e.jsx(S,{})}),e.jsx(R,{changeRequests:u,projectId:n}),e.jsx(p,{condition:(a==null?void 0:a.length)<=5,show:e.jsx("ul",{children:a==null?void 0:a.map(j=>e.jsx("li",{children:j},j))})})]}),elseShow:e.jsxs(e.Fragment,{children:[e.jsxs("p",{children:["Are you sure you want to archive"," ",i?"these feature flags":"this feature flag","?"]}),e.jsx(p,{condition:g.length>0,show:e.jsx(q,{ids:g,projectId:n})}),e.jsx(p,{condition:v,show:e.jsx(S,{})}),e.jsx(R,{changeRequests:u,projectId:n})]})})})},ie=(t,s)=>`/api/admin/projects/${t}/features/${s}/parents`,ge=(t,s)=>{const r=k(ie(t,s)),{data:n,loading:a,error:o}=F(r,()=>B(r,"Parent Options"));return{parentOptions:n,loading:a,error:o}},oe=(t,s)=>`/api/admin/projects/${t}/features/${s}/parent-variants`,O=(t,s)=>{const r=k(oe(t,s)),{data:n,loading:a,error:o}=F(r,()=>B(r,"Parent Variant Options"));return{parentVariantOptions:n||[],loading:a,error:o}},ce=N(J)(({theme:t})=>({marginTop:t.spacing(2),marginBottom:t.spacing(1.5)})),le=({project:t,parent:s,onSelect:r})=>{const{parentVariantOptions:n}=O(t,s),a=e.jsx(Q,{fontSize:"small"}),o=e.jsx(X,{fontSize:"small"});return e.jsx(ce,{id:"single-variant-options",options:n,renderOption:(i,c,{selected:h})=>e.jsxs("li",{...i,children:[e.jsx(K,{icon:a,checkedIcon:o,style:{marginRight:8},checked:h}),c]}),renderInput:i=>e.jsx(Y,{...i,placeholder:"Select variant"}),fullWidth:!0,onChange:(i,c)=>{r(String(c))}})},de=({projectId:t,featureId:s,isOpen:r,setIsOpen:n,onComplete:a})=>{const{markFeatureCompleted:o}=Z(),{parentVariantOptions:i}=O(t,s),[c,h]=f.useState("kept"),[x,u]=f.useState(void 0),{trackEvent:d}=U(),g=async()=>{const l=c==="kept-with-variant"?"kept":c;await o(s,t,{status:l,statusValue:x}),n(!1),a(),d("feature-lifecycle",{props:{eventType:"complete",status:l}})};return e.jsx($,{open:r,title:"Mark completed",onClose:()=>{n(!1)},disabledPrimaryButton:c==="kept-with-variant"&&x===null,onClick:g,primaryButtonText:"Mark completed",secondaryButtonText:"Cancel",children:e.jsxs(T,{children:[e.jsxs(T,{sx:{mt:2,mb:4},children:["Marking the feature ",e.jsx("b",{children:s})," as complete does not affect any configuration, but it moves the feature flag into it’s next life cycle stage and is an indication that you have learned what you needed in order to progress with the feature. It serves as a reminder to start cleaning up the feature flag and removing it from the code."]}),e.jsx(C,{sx:{mb:2},children:e.jsx("b",{children:"What was the outcome of this feature?"})}),e.jsxs(I,{"aria-label":"selected-value",name:"selected",sx:{gap:l=>l.spacing(.5)},onChange:(l,v)=>{h(v)},children:[e.jsx(A,{value:"kept",legal:{value:"We decided to keep the feature"},control:e.jsx(b,{})},"kept"),e.jsx(A,{value:"discarded",legal:{value:"We decided to discard the feature"},control:e.jsx(b,{})},"discarded"),e.jsx(p,{condition:i.length>0,show:e.jsx(A,{value:"kept-with-variant",legal:{value:"We decided to keep the feature variant",description:"Choose to specify which feature variant will be kept"},control:e.jsx(b,{})},"kept-with-variant")}),e.jsx(p,{condition:i.length>0&&c==="kept-with-variant",show:e.jsx(le,{parent:s,project:t,onSelect:l=>{u(l)}})})]})]})})};export{ue as F,de as M,ge as a,O as u};
@@ -1 +1 @@
1
- import{s as i,T as d,cV as h,b as x,r as u,j as t,R as m,gc as c,jP as y,jQ as j,jR as f}from"./index-g9pKMnOR.js";import{u as b,N as v}from"./NetworkPrometheusAPIWarning-BwnVz0CY.js";import{u as g}from"./unknownify-B7hmSXnj.js";const w=i("div")(({theme:e})=>({marginBottom:e.spacing(18),display:"flex",justifyContent:"center"})),S=i("div")(({theme:e})=>({display:"flex",justifyContent:"center",gap:e.spacing(4),flexWrap:"wrap"})),p=i("div")(({theme:e})=>({borderRadius:e.shape.borderRadiusMedium,border:"1px solid",borderColor:e.palette.secondary.border,backgroundColor:e.palette.secondary.light,display:"flex",flexDirection:"column",alignItems:"center",padding:e.spacing(1.5),zIndex:1,"& > svg":{width:e.spacing(9),height:e.spacing(9)}})),k=i(d)(({theme:e})=>({fontWeight:e.fontWeight.bold})),A=i(d)(({theme:e})=>({fontSize:e.fontSizes.smallBody,color:e.palette.text.secondary})),q=i(d)(({theme:e})=>({fontSize:e.fontSizes.smallerBody,color:e.palette.text.secondary})),C=e=>e[0]*1e3>Date.now()-6e5,E=e=>{var a,s;const r=(e.values||[]).filter(l=>C(l)),o=r.length?Number.parseFloat(r[r.length-1][1]):0;return{label:e.label,reqs:o,type:g((s=(a=e.metric)==null?void 0:a.endpoint)==null?void 0:s.split("/")[2])}},B=(e,n)=>{var o;const r=n.label+n.type;return e[r]={...n,reqs:n.reqs+(((o=e[r])==null?void 0:o.reqs)??0)},e},N=e=>{var o,a;const r=(((a=(o=e==null?void 0:e.data)==null?void 0:o.result)==null?void 0:a.map(s=>{var l;return{...s,label:g((l=s.metric)==null?void 0:l.appName)}}).filter(s=>s.label!=="unknown"))||[]).map(E).reduce(B,{});return Object.values(r).map(s=>({...s,reqs:s.reqs.toFixed(2)})).filter(s=>s.reqs!=="0.00")??[]},D=()=>{h("Network - Overview");const e=x(),{metrics:n}=b(),r=u.useMemo(()=>N(n),[n]);return r.length===0?t.jsxs(m,{severity:"warning",children:["No data available.",t.jsx(v,{})]}):t.jsxs(c.ArcherContainer,{strokeColor:e.palette.text.primary,endShape:{arrow:{arrowLength:4,arrowThickness:4}},children:[t.jsx(w,{children:t.jsx(c.ArcherElement,{id:"unleash",children:t.jsxs(p,{children:[t.jsx(y,{darkmode:t.jsx(j,{}),lightmode:t.jsx(f,{})}),t.jsx(d,{sx:{marginTop:e.spacing(1)},children:"Unleash"})]})})}),t.jsx(S,{children:r.map(({label:o,reqs:a,type:s},l)=>t.jsx(c.ArcherElement,{id:`${l}`,relations:[{targetId:"unleash",targetAnchor:"bottom",sourceAnchor:"top",style:{strokeColor:e.palette.secondary.border}}],children:t.jsxs(p,{children:[t.jsx(k,{children:o}),t.jsxs(A,{children:[a," req/s"]}),t.jsxs(q,{children:[s," app"]})]})}))})]})};export{D as NetworkOverview,D as default};
1
+ import{s as i,T as d,cV as h,b as x,r as u,j as t,R as m,gc as c,jS as y,jT as j,jU as f}from"./index-Cz4lAJ3Y.js";import{u as b,N as v}from"./NetworkPrometheusAPIWarning-f1m-ZHgX.js";import{u as g}from"./unknownify-B7hmSXnj.js";const w=i("div")(({theme:e})=>({marginBottom:e.spacing(18),display:"flex",justifyContent:"center"})),S=i("div")(({theme:e})=>({display:"flex",justifyContent:"center",gap:e.spacing(4),flexWrap:"wrap"})),p=i("div")(({theme:e})=>({borderRadius:e.shape.borderRadiusMedium,border:"1px solid",borderColor:e.palette.secondary.border,backgroundColor:e.palette.secondary.light,display:"flex",flexDirection:"column",alignItems:"center",padding:e.spacing(1.5),zIndex:1,"& > svg":{width:e.spacing(9),height:e.spacing(9)}})),k=i(d)(({theme:e})=>({fontWeight:e.fontWeight.bold})),A=i(d)(({theme:e})=>({fontSize:e.fontSizes.smallBody,color:e.palette.text.secondary})),q=i(d)(({theme:e})=>({fontSize:e.fontSizes.smallerBody,color:e.palette.text.secondary})),C=e=>e[0]*1e3>Date.now()-6e5,E=e=>{var a,s;const r=(e.values||[]).filter(l=>C(l)),o=r.length?Number.parseFloat(r[r.length-1][1]):0;return{label:e.label,reqs:o,type:g((s=(a=e.metric)==null?void 0:a.endpoint)==null?void 0:s.split("/")[2])}},T=(e,n)=>{var o;const r=n.label+n.type;return e[r]={...n,reqs:n.reqs+(((o=e[r])==null?void 0:o.reqs)??0)},e},B=e=>{var o,a;const r=(((a=(o=e==null?void 0:e.data)==null?void 0:o.result)==null?void 0:a.map(s=>{var l;return{...s,label:g((l=s.metric)==null?void 0:l.appName)}}).filter(s=>s.label!=="unknown"))||[]).map(E).reduce(T,{});return Object.values(r).map(s=>({...s,reqs:s.reqs.toFixed(2)})).filter(s=>s.reqs!=="0.00")??[]},D=()=>{h("Network - Overview");const e=x(),{metrics:n}=b(),r=u.useMemo(()=>B(n),[n]);return r.length===0?t.jsxs(m,{severity:"warning",children:["No data available.",t.jsx(v,{})]}):t.jsxs(c.ArcherContainer,{strokeColor:e.palette.text.primary,endShape:{arrow:{arrowLength:4,arrowThickness:4}},children:[t.jsx(w,{children:t.jsx(c.ArcherElement,{id:"unleash",children:t.jsxs(p,{children:[t.jsx(y,{darkmode:t.jsx(j,{}),lightmode:t.jsx(f,{})}),t.jsx(d,{sx:{marginTop:e.spacing(1)},children:"Unleash"})]})})}),t.jsx(S,{children:r.map(({label:o,reqs:a,type:s},l)=>t.jsx(c.ArcherElement,{id:`${l}`,relations:[{targetId:"unleash",targetAnchor:"bottom",sourceAnchor:"top",style:{strokeColor:e.palette.secondary.border}}],children:t.jsxs(p,{children:[t.jsx(k,{children:o}),t.jsxs(A,{children:[a," req/s"]}),t.jsxs(q,{children:[s," app"]})]})}))})]})};export{D as NetworkOverview,D as default};
@@ -1 +1 @@
1
- import{ba as a,b8 as i,b7 as c,r as u,b9 as h,j as n}from"./index-g9pKMnOR.js";const f=(e={})=>{const{uiConfig:{prometheusAPIAvailable:r}}=a(),{data:t,error:s,mutate:o}=i(r,{},c("api/admin/metrics/rps"),l,e);return u.useMemo(()=>({metrics:t,loading:!s&&!t,refetch:()=>o(),error:s}),[t,s,o])},l=e=>fetch(e).then(h("Instance Metrics")).then(r=>r.json()),p=()=>{const{uiConfig:{prometheusAPIAvailable:e}}=a();return e?null:n.jsxs("p",{children:["This view requires the ",n.jsx("strong",{children:"PROMETHEUS_API"})," environment variable to be set. Refer to our"," ",n.jsx("a",{href:"https://docs.getunleash.io/concepts/network-view#data-source",target:"_blank",rel:"noreferrer",children:"documentation"})," ","for more information."]})};export{p as N,f as u};
1
+ import{ba as a,b8 as i,b7 as c,r as u,b9 as h,j as n}from"./index-Cz4lAJ3Y.js";const f=(e={})=>{const{uiConfig:{prometheusAPIAvailable:r}}=a(),{data:t,error:s,mutate:o}=i(r,{},c("api/admin/metrics/rps"),l,e);return u.useMemo(()=>({metrics:t,loading:!s&&!t,refetch:()=>o(),error:s}),[t,s,o])},l=e=>fetch(e).then(h("Instance Metrics")).then(r=>r.json()),p=()=>{const{uiConfig:{prometheusAPIAvailable:e}}=a();return e?null:n.jsxs("p",{children:["This view requires the ",n.jsx("strong",{children:"PROMETHEUS_API"})," environment variable to be set. Refer to our"," ",n.jsx("a",{href:"https://docs.getunleash.io/concepts/network-view#data-source",target:"_blank",rel:"noreferrer",children:"documentation"})," ","for more information."]})};export{p as N,f as u};
@@ -1 +1 @@
1
- var k=Object.defineProperty;var f=(e,t,a)=>t in e?k(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a;var s=(e,t,a)=>f(e,typeof t!="symbol"?t+"":t,a);import{bq as h,b as C,r as p,cV as w,j as o,C as v,R as P,da as S,jJ as N,ji as I,jj as R,jk as A,jB as M,jO as T,jE as q,jo as E,jn as L,jm as _,jg as u,jS as D}from"./index-g9pKMnOR.js";import{u as W,N as B}from"./NetworkPrometheusAPIWarning-BwnVz0CY.js";import{u as g}from"./unknownify-B7hmSXnj.js";const m=["circle","rect","rectRounded","rectRot","triangle"],H=(e,t)=>e.map(a=>({x:a[0],y:t(a[1])})),O=(e,t)=>({locale:t.locale,responsive:!0,maintainAspectRatio:!1,interaction:{mode:"index",intersect:!1},color:e.palette.text.secondary,plugins:{tooltip:{backgroundColor:e.palette.background.paper,bodyColor:e.palette.text.primary,titleColor:e.palette.action.active,borderColor:e.palette.primary.main,borderWidth:1,padding:10,boxPadding:5,usePointStyle:!0,callbacks:{title:a=>u(1e3*a[0].parsed.x,t.locale)},itemSort:(a,i)=>i.parsed.y-a.parsed.y},legend:{position:"bottom",align:"start",labels:{boxWidth:10,boxHeight:10,usePointStyle:!0,padding:24}},title:{text:"Top 10 requests per second in the last 6 hours",position:"top",align:"start",display:!0,font:{size:16,weight:"400"},color:e.palette.text.primary,padding:{bottom:32}}},scales:{y:{type:"linear",title:{display:!0,text:"Requests per second",color:e.palette.text.secondary},suggestedMin:0,ticks:{precision:0,color:e.palette.text.secondary},grid:{color:e.palette.divider,borderColor:e.palette.divider}},x:{type:"time",time:{unit:"minute"},grid:{display:!0,color:e.palette.divider,borderColor:e.palette.divider},ticks:{callback:(a,i,r)=>u(r[i].value*1e3,t.locale)}}}});class ${constructor(t){s(this,"items");s(this,"picked",new Map);this.items=new D(t)}pick(t){return this.picked.has(t)||this.picked.set(t,this.items.next()),this.picked.get(t)}}const z=(e,t)=>{var a;if((a=t==null?void 0:t.data)!=null&&a.result){const i=new $([e.palette.success,e.palette.error,e.palette.primary,e.palette.warning]);return t.data.result.map((r,x)=>{var c,d;const n=g((c=r.metric)==null?void 0:c.endpoint),y=g((d=r.metric)==null?void 0:d.appName),l=i.pick(n),b=r.values||[];return{label:`${n}: ${y}`,borderColor:l.main,backgroundColor:l.main,data:H(b,j=>Number.parseFloat(j)),elements:{point:{radius:4,pointStyle:m[x%m.length]},line:{borderDash:[8,4]}}}})}return[]},K=()=>{const{locationSettings:e}=h(),{metrics:t}=W(),a=C(),i=p.useMemo(()=>O(a,e),[a,e]);w("Network - Traffic");const r=p.useMemo(()=>({datasets:z(a,t)}),[a,t,e]);return o.jsx(v,{condition:r.datasets.length===0,show:o.jsxs(P,{severity:"warning",children:["No data available.",o.jsx(B,{})]}),elseShow:o.jsx(S,{sx:{display:"grid",gap:4},children:o.jsx("div",{style:{height:400},children:o.jsx(N,{data:r,options:i,"aria-label":"An instance metrics line chart with two lines: requests per second for admin API and requests per second for client API"})})})})};I.register(R,A,M,T,q,E,L,_);export{K as NetworkTraffic,K as default};
1
+ var f=Object.defineProperty;var h=(e,t,a)=>t in e?f(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a;var s=(e,t,a)=>h(e,typeof t!="symbol"?t+"":t,a);import{bq as k,b as C,r as p,cV as w,j as o,C as v,R as P,da as S,jM as N,jl as R,jm as I,jn as M,jE as q,jR as A,jH as T,jr as E,jq as L,jp as _,jj as u,jV as D}from"./index-Cz4lAJ3Y.js";import{u as H,N as W}from"./NetworkPrometheusAPIWarning-f1m-ZHgX.js";import{u as g}from"./unknownify-B7hmSXnj.js";const m=["circle","rect","rectRounded","rectRot","triangle"],V=(e,t)=>e.map(a=>({x:a[0],y:t(a[1])})),$=(e,t)=>({locale:t.locale,responsive:!0,maintainAspectRatio:!1,interaction:{mode:"index",intersect:!1},color:e.palette.text.secondary,plugins:{tooltip:{backgroundColor:e.palette.background.paper,bodyColor:e.palette.text.primary,titleColor:e.palette.action.active,borderColor:e.palette.primary.main,borderWidth:1,padding:10,boxPadding:5,usePointStyle:!0,callbacks:{title:a=>u(1e3*a[0].parsed.x,t.locale)},itemSort:(a,i)=>i.parsed.y-a.parsed.y},legend:{position:"bottom",align:"start",labels:{boxWidth:10,boxHeight:10,usePointStyle:!0,padding:24}},title:{text:"Top 10 requests per second in the last 6 hours",position:"top",align:"start",display:!0,font:{size:16,weight:"400"},color:e.palette.text.primary,padding:{bottom:32}}},scales:{y:{type:"linear",title:{display:!0,text:"Requests per second",color:e.palette.text.secondary},suggestedMin:0,ticks:{precision:0,color:e.palette.text.secondary},grid:{color:e.palette.divider,borderColor:e.palette.divider}},x:{type:"time",time:{unit:"minute"},grid:{display:!0,color:e.palette.divider,borderColor:e.palette.divider},ticks:{callback:(a,i,r)=>u(r[i].value*1e3,t.locale)}}}});class z{constructor(t){s(this,"items");s(this,"picked",new Map);this.items=new D(t)}pick(t){return this.picked.has(t)||this.picked.set(t,this.items.next()),this.picked.get(t)}}const B=(e,t)=>{var a;if((a=t==null?void 0:t.data)!=null&&a.result){const i=new z([e.palette.success,e.palette.error,e.palette.primary,e.palette.warning]);return t.data.result.map((r,x)=>{var c,d;const n=g((c=r.metric)==null?void 0:c.endpoint),y=g((d=r.metric)==null?void 0:d.appName),l=i.pick(n),b=r.values||[];return{label:`${n}: ${y}`,borderColor:l.main,backgroundColor:l.main,data:V(b,j=>Number.parseFloat(j)),elements:{point:{radius:4,pointStyle:m[x%m.length]},line:{borderDash:[8,4]}}}})}return[]},K=()=>{const{locationSettings:e}=k(),{metrics:t}=H(),a=C(),i=p.useMemo(()=>$(a,e),[a,e]);w("Network - Traffic");const r=p.useMemo(()=>({datasets:B(a,t)}),[a,t,e]);return o.jsx(v,{condition:r.datasets.length===0,show:o.jsxs(P,{severity:"warning",children:["No data available.",o.jsx(W,{})]}),elseShow:o.jsx(S,{sx:{display:"grid",gap:4},children:o.jsx("div",{style:{height:400},children:o.jsx(N,{data:r,options:i,"aria-label":"An instance metrics line chart with two lines: requests per second for admin API and requests per second for client API"})})})})};R.register(I,M,q,A,T,E,L,_);export{K as NetworkTraffic,K as default};
@@ -1 +1 @@
1
- import{s as c,bq as E,j as e,M as d,d8 as q,jT as f,ba as y,b7 as v,cm as B,r as A,b9 as I,cV as F,h as M,C as p,R as x,L as j,jp as P,ji as _,jj as k,jk as N,jl as $,jm as z,jn as H,jo as O}from"./index-g9pKMnOR.js";import{a as W}from"./formatTickValue-CqTJlzJZ.js";import{u as Y,a as G,B as V,S as J,T as K,P as Q,n as X,g as Z}from"./networkTrafficUsageHighlightPlugin-Dmm54dMG.js";import{p as ee,c as l}from"./LazyAdminExport-B8GV3V8t.js";import"./RoleCell-D5skjCJn.js";import"./useApiTokens-D1XvAIIA.js";import"./PercentageDonut-B2OwM0Er.js";const S=c("article")(({theme:s})=>({minWidth:"200px",border:`2px solid ${s.palette.divider}`,borderRadius:s.shape.borderRadiusLarge,padding:s.spacing(3),display:"flex",flexDirection:"column",gap:s.spacing(2)})),T=c("h3")(({theme:s})=>({margin:0,fontSize:s.typography.body1.fontSize})),w=c("dl")(({theme:s})=>({display:"flex",flexDirection:"column",gap:s.spacing(2.5),padding:0,margin:0})),a=c("div")(({theme:s})=>({display:"flex",flexFlow:"row wrap",justifyContent:"space-between",gap:s.spacing(1,3),fontSize:s.typography.body2.fontSize,color:s.palette.text.secondary,"& dd":{margin:0,color:s.palette.text.primary}})),se=s=>{const r=n=>n.toLocaleString("en-US",{month:"short",year:"numeric"});if(s.grouping==="monthly"){const n=new Date,t=f(n,s.monthsBack),o=f(n,1);return`Average requests from ${r(t)} to ${r(o)}`}return`Requests used in ${r(ee(s.month))}`},ne=({period:s,usageTotal:r,includedTraffic:n,purchasedTraffic:t,currentMonth:o})=>{const{locationSettings:i}=E();return e.jsxs(S,{children:[e.jsx(T,{children:"Number of requests to Unleash"}),e.jsxs(w,{children:[e.jsxs(a,{children:[e.jsx("dt",{children:se(s)}),e.jsx("dd",{children:e.jsxs(d,{color:n>0?r<=n?"success":"error":"neutral",children:[r.toLocaleString(i.locale??"en-US")," ","requests"]})})]}),n>0&&e.jsxs(a,{children:[e.jsx("dt",{children:"Included in your plan"}),e.jsxs("dd",{children:[n.toLocaleString("en-US")," requests"]})]}),t>0&&o&&e.jsxs(a,{children:[e.jsx("dt",{children:"Additional traffic purchased"}),e.jsxs("dd",{children:[t.toLocaleString("en-US")," requests"]})]}),n>0&&o&&e.jsxs(a,{children:[e.jsx("dt",{children:"Total traffic available"}),e.jsxs("dd",{children:[(n+t).toLocaleString("en-US")," ","requests"]})]})]})]})},te=({overages:s,overageCost:r,estimatedMonthlyCost:n})=>e.jsxs(S,{children:[e.jsx(T,{children:"Accrued traffic charges"}),e.jsxs(w,{children:[e.jsxs(a,{children:[e.jsxs("dt",{children:["Request overages this month (",e.jsx(q,{href:"https://www.getunleash.io/pricing",children:"pricing"}),")"]}),e.jsxs("dd",{children:[s.toLocaleString()," requests"]})]}),e.jsxs(a,{children:[e.jsx("dt",{children:"Accrued traffic charges"}),e.jsx("dd",{children:e.jsxs(d,{color:"secondary",children:[r," USD"]})})]}),n>0&&e.jsxs(a,{children:[e.jsx("dt",{children:"Estimated charges based on current usage"}),e.jsx("dd",{children:e.jsxs(d,{color:"secondary",children:[n," USD"]})})]})]})]}),re=53,oe=259,m=1e6,ae=(s,r)=>!s||r==="pay-as-you-go"?re:oe;function ie(s,r,n){return s===void 0?ae(r,n):s}function ce(s){return s===void 0?0:s}const le=()=>{const{isEnterprise:s,uiConfig:r}=y(),n=v("/api/instance/trafficBundles"),{data:t,error:o,mutate:i}=B(n,de);return{trafficBundles:A.useMemo(()=>({includedTraffic:ie(t==null?void 0:t.includedTraffic,s(),r.billing)*m,purchasedTraffic:ce(t==null?void 0:t.purchasedTraffic)*m}),[t]),loading:!o&&!t,refetch:i}},de=s=>fetch(s).then(I("configuration")).then(r=>r.json()),ue=c("div")(({theme:s})=>({display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(200px, max-content))",flex:1,gap:s.spacing(2,4)})),ye=()=>{F("Network - Data Usage");const s=M("estimateTrafficDataCost"),{isOss:r}=y(),{trafficBundles:n}=le(),t=n.includedTraffic+n.purchasedTraffic,{chartDataSelection:o,setChartDataSelection:i,options:u}=Y(t),{chartData:C,usageTotal:h,overageCost:g,estimatedMonthlyCost:b,requestSummaryUsage:L}=G(t,o),U=o.grouping==="daily"&&o.month===l&&t>0&&h-t>0&&s,D=o.grouping==="daily"&&o.month===l,R=(o.grouping==="monthly"||o.month===l)&&t>0&&g>0;return e.jsx(p,{condition:r(),show:e.jsx(x,{severity:"warning",children:"Not enabled."}),elseShow:e.jsxs(e.Fragment,{children:[e.jsx(p,{condition:R,show:e.jsxs(x,{severity:"warning",sx:{mb:4},children:[e.jsx(V,{children:"Heads up!"})," You are currently consuming more requests than your plan includes and will be billed according to our terms. Please see"," ",e.jsx(j,{to:"https://www.getunleash.io/pricing",children:"this page"})," ","for more information. In order to reduce your traffic consumption, you may configure an"," ",e.jsx(j,{to:"https://docs.getunleash.io/unleash-edge",children:"Unleash Edge instance"})," ","in your own datacenter."]})}),e.jsxs(J,{children:[e.jsxs(K,{children:[e.jsxs(ue,{children:[e.jsx(ne,{period:o,usageTotal:L,includedTraffic:n.includedTraffic,purchasedTraffic:n.purchasedTraffic,currentMonth:D}),U&&e.jsx(te,{overageCost:g,overages:h-t,estimatedMonthlyCost:b})]}),e.jsx(Q,{selectedPeriod:o,setPeriod:i})]}),e.jsx(P,{data:C,plugins:[X],options:u,"aria-label":Z(o)})]})]})})};_.register(W,k,N,$,z,H,O);export{ye as default};
1
+ import{s as c,bq as E,j as e,M as d,d8 as q,jW as f,ba as y,b7 as v,cm as B,r as A,b9 as I,cV as F,h as M,C as p,R as x,L as j,js as P,jl as _,jm as N,jn as k,jo as $,jp as z,jq as W,jr as H}from"./index-Cz4lAJ3Y.js";import{a as O}from"./formatTickValue-ClJtK_xN.js";import{u as Y,a as G,B as V,S as J,T as K,P as Q,n as X,g as Z}from"./networkTrafficUsageHighlightPlugin-Ce-A3Xr6.js";import{p as ee,c as l}from"./LazyAdminExport-dyqU9IvB.js";import"./RoleCell-D01N1lHV.js";import"./useApiTokens-Dx2wjhgw.js";import"./PercentageDonut-cKg6eF-p.js";const S=c("article")(({theme:s})=>({minWidth:"200px",border:`2px solid ${s.palette.divider}`,borderRadius:s.shape.borderRadiusLarge,padding:s.spacing(3),display:"flex",flexDirection:"column",gap:s.spacing(2)})),T=c("h3")(({theme:s})=>({margin:0,fontSize:s.typography.body1.fontSize})),w=c("dl")(({theme:s})=>({display:"flex",flexDirection:"column",gap:s.spacing(2.5),padding:0,margin:0})),a=c("div")(({theme:s})=>({display:"flex",flexFlow:"row wrap",justifyContent:"space-between",gap:s.spacing(1,3),fontSize:s.typography.body2.fontSize,color:s.palette.text.secondary,"& dd":{margin:0,color:s.palette.text.primary}})),se=s=>{const r=n=>n.toLocaleString("en-US",{month:"short",year:"numeric"});if(s.grouping==="monthly"){const n=new Date,t=f(n,s.monthsBack),o=f(n,1);return`Average requests from ${r(t)} to ${r(o)}`}return`Requests used in ${r(ee(s.month))}`},ne=({period:s,usageTotal:r,includedTraffic:n,purchasedTraffic:t,currentMonth:o})=>{const{locationSettings:i}=E();return e.jsxs(S,{children:[e.jsx(T,{children:"Number of requests to Unleash"}),e.jsxs(w,{children:[e.jsxs(a,{children:[e.jsx("dt",{children:se(s)}),e.jsx("dd",{children:e.jsxs(d,{color:n>0?r<=n?"success":"error":"neutral",children:[r.toLocaleString(i.locale??"en-US")," ","requests"]})})]}),n>0&&e.jsxs(a,{children:[e.jsx("dt",{children:"Included in your plan"}),e.jsxs("dd",{children:[n.toLocaleString("en-US")," requests"]})]}),t>0&&o&&e.jsxs(a,{children:[e.jsx("dt",{children:"Additional traffic purchased"}),e.jsxs("dd",{children:[t.toLocaleString("en-US")," requests"]})]}),n>0&&o&&e.jsxs(a,{children:[e.jsx("dt",{children:"Total traffic available"}),e.jsxs("dd",{children:[(n+t).toLocaleString("en-US")," ","requests"]})]})]})]})},te=({overages:s,overageCost:r,estimatedMonthlyCost:n})=>e.jsxs(S,{children:[e.jsx(T,{children:"Accrued traffic charges"}),e.jsxs(w,{children:[e.jsxs(a,{children:[e.jsxs("dt",{children:["Request overages this month (",e.jsx(q,{href:"https://www.getunleash.io/pricing",children:"pricing"}),")"]}),e.jsxs("dd",{children:[s.toLocaleString()," requests"]})]}),e.jsxs(a,{children:[e.jsx("dt",{children:"Accrued traffic charges"}),e.jsx("dd",{children:e.jsxs(d,{color:"secondary",children:[r," USD"]})})]}),n>0&&e.jsxs(a,{children:[e.jsx("dt",{children:"Estimated charges based on current usage"}),e.jsx("dd",{children:e.jsxs(d,{color:"secondary",children:[n," USD"]})})]})]})]}),re=53,oe=259,m=1e6,ae=(s,r)=>!s||r==="pay-as-you-go"?re:oe;function ie(s,r,n){return s===void 0?ae(r,n):s}function ce(s){return s===void 0?0:s}const le=()=>{const{isEnterprise:s,uiConfig:r}=y(),n=v("/api/instance/trafficBundles"),{data:t,error:o,mutate:i}=B(n,de);return{trafficBundles:A.useMemo(()=>({includedTraffic:ie(t==null?void 0:t.includedTraffic,s(),r.billing)*m,purchasedTraffic:ce(t==null?void 0:t.purchasedTraffic)*m}),[t]),loading:!o&&!t,refetch:i}},de=s=>fetch(s).then(I("configuration")).then(r=>r.json()),ue=c("div")(({theme:s})=>({display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(200px, max-content))",flex:1,gap:s.spacing(2,4)})),ye=()=>{F("Network - Data Usage");const s=M("estimateTrafficDataCost"),{isOss:r}=y(),{trafficBundles:n}=le(),t=n.includedTraffic+n.purchasedTraffic,{chartDataSelection:o,setChartDataSelection:i,options:u}=Y(t),{chartData:C,usageTotal:h,overageCost:g,estimatedMonthlyCost:b,requestSummaryUsage:L}=G(t,o),U=o.grouping==="daily"&&o.month===l&&t>0&&h-t>0&&s,D=o.grouping==="daily"&&o.month===l,R=(o.grouping==="monthly"||o.month===l)&&t>0&&g>0;return e.jsx(p,{condition:r(),show:e.jsx(x,{severity:"warning",children:"Not enabled."}),elseShow:e.jsxs(e.Fragment,{children:[e.jsx(p,{condition:R,show:e.jsxs(x,{severity:"warning",sx:{mb:4},children:[e.jsx(V,{children:"Heads up!"})," You are currently consuming more requests than your plan includes and will be billed according to our terms. Please see"," ",e.jsx(j,{to:"https://www.getunleash.io/pricing",children:"this page"})," ","for more information. In order to reduce your traffic consumption, you may configure an"," ",e.jsx(j,{to:"https://docs.getunleash.io/unleash-edge",children:"Unleash Edge instance"})," ","in your own datacenter."]})}),e.jsxs(J,{children:[e.jsxs(K,{children:[e.jsxs(ue,{children:[e.jsx(ne,{period:o,usageTotal:L,includedTraffic:n.includedTraffic,purchasedTraffic:n.purchasedTraffic,currentMonth:D}),U&&e.jsx(te,{overageCost:g,overages:h-t,estimatedMonthlyCost:b})]}),e.jsx(Q,{selectedPeriod:o,setPeriod:i})]}),e.jsx(P,{data:C,plugins:[X],options:u,"aria-label":Z(o)})]})]})})};_.register(O,N,k,$,z,W,H);export{ye as default};
@@ -1 +1 @@
1
- import{s as l,b as p,j as o}from"./index-g9pKMnOR.js";const x=l("div")(()=>({display:"flex",alignItems:"center",justifyContent:"center",position:"relative",margin:0})),y=l("div",{shouldForwardProp:e=>e!=="color"})(({theme:e,color:r})=>({position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",color:r,fontSize:e.fontSizes.smallerBody,margin:0})),u=({percentage:e,size:r="4rem",disabled:c=!1,children:d,strokeRatio:h=.2})=>{const s=p(),m={display:"block",borderRadius:"100%",transform:"rotate(-90deg)",height:r,width:r},t=100/(2*Math.PI),n=2*t,a=n*h,i=c?s.palette.neutral.border:s.palette.primary.light;return o.jsxs(x,{children:[o.jsxs("svg",{viewBox:`0 0 ${n} ${n}`,style:m,"aria-hidden":!0,children:[o.jsx("circle",{r:t,cx:t,cy:t,fill:"none",stroke:s.palette.background.elevation2,strokeWidth:a}),o.jsx("circle",{r:t,cx:t,cy:t,fill:"none",stroke:i,strokeWidth:a,strokeDasharray:`${e} 100`})]}),o.jsx(y,{color:i,children:d})]})};export{u as P};
1
+ import{s as l,b as p,j as o}from"./index-Cz4lAJ3Y.js";const x=l("div")(()=>({display:"flex",alignItems:"center",justifyContent:"center",position:"relative",margin:0})),y=l("div",{shouldForwardProp:e=>e!=="color"})(({theme:e,color:r})=>({position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",color:r,fontSize:e.fontSizes.smallerBody,margin:0})),u=({percentage:e,size:r="4rem",disabled:c=!1,children:d,strokeRatio:h=.2})=>{const s=p(),m={display:"block",borderRadius:"100%",transform:"rotate(-90deg)",height:r,width:r},t=100/(2*Math.PI),n=2*t,a=n*h,i=c?s.palette.neutral.border:s.palette.primary.light;return o.jsxs(x,{children:[o.jsxs("svg",{viewBox:`0 0 ${n} ${n}`,style:m,"aria-hidden":!0,children:[o.jsx("circle",{r:t,cx:t,cy:t,fill:"none",stroke:s.palette.background.elevation2,strokeWidth:a}),o.jsx("circle",{r:t,cx:t,cy:t,fill:"none",stroke:i,strokeWidth:a,strokeDasharray:`${e} 100`})]}),o.jsx(y,{color:i,children:d})]})};export{u as P};
@@ -1,4 +1,4 @@
1
- import{g as Db,jb as Fb,dx as Bb,s as Ub,r as Ya,U as Vb,j as pu}from"./index-g9pKMnOR.js";import{L as Hb,G as Jb,I as Kb,J as Wb,K as Gd,M as Gb,N as Qb,V as a1,O as Yb,P as Xb,A as bi,Q as kc,R as s1,T as c1,H as Zb,B as Ua,o as l1,E as Ji,z as Qd,C as ej,U as tj,b as nj,e as rj,g as oj,i as ij,j as aj,k as sj,m as cj,n as lj,p as uj,q as fj,r as dj,t as pj,u as vj,v as mj,w as hj,x as gj,c as yj,d as bj,s as jj,h as $j,f as wj,a as xj,l as Sj,W as Cj,X as kj,y as _j,Y as Ej,Z as Oj,_ as Mj,$ as Va,a0 as Pj,a1 as Tj,a2 as Rj,a3 as Nj}from"./index-Bj8wwcOa.js";function xn(t){return Array.isArray(t)}function In(t){return t!==null&&typeof t=="object"&&(t.constructor===void 0||t.constructor.name==="Object")}function u1(t){return t&&typeof t=="object"?t.op==="add":!1}function f1(t){return t&&typeof t=="object"?t.op==="remove":!1}function vf(t){return t&&typeof t=="object"?t.op==="replace":!1}function vu(t){return t&&typeof t=="object"?t.op==="copy":!1}function la(t){return t&&typeof t=="object"?t.op==="move":!1}function Aj(t,e){return JSON.stringify(t)===JSON.stringify(e)}function Ij(t,e){return t===e}function d1(t){return t.slice(0,t.length-1)}function zj(t){return t[t.length-1]}function qj(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ij;if(t.length<e.length)return!1;for(let r=0;r<e.length;r++)if(!n(t[r],e[r]))return!1;return!0}function p1(t){return typeof t=="object"&&t!==null}function mf(t){if(xn(t)){const e=t.slice();return Object.getOwnPropertySymbols(t).forEach(n=>{e[n]=t[n]}),e}else if(In(t)){const e={...t};return Object.getOwnPropertySymbols(t).forEach(n=>{e[n]=t[n]}),e}else return t}function hf(t,e,n){if(t[e]===n)return t;{const r=mf(t);return r[e]=n,r}}function We(t,e){let n=t,r=0;for(;r<e.length;)In(n)?n=n[e[r]]:xn(n)?n=n[parseInt(e[r])]:n=void 0,r++;return n}function Yr(t,e,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(e.length===0)return n;const o=e[0],i=Yr(t?t[o]:void 0,e.slice(1),n,r);if(In(t)||xn(t))return hf(t,o,i);if(r){const a=Lj.test(o)?[]:{};return a[o]=i,a}else throw new Error("Path does not exist")}const Lj=/^\d+$/;function v1(t,e,n){if(e.length===0)return n(t);if(!p1(t))throw new Error("Path doesn't exist");const r=e[0],o=v1(t[r],e.slice(1),n);return hf(t,r,o)}function gf(t,e){if(e.length===0)return t;if(!p1(t))throw new Error("Path does not exist");if(e.length===1){const o=e[0];if(o in t){const i=mf(t);return xn(i)&&i.splice(parseInt(o),1),In(i)&&delete i[o],i}else return t}const n=e[0],r=gf(t[n],e.slice(1));return hf(t,n,r)}function yf(t,e,n){const r=e.slice(0,e.length-1),o=e[e.length-1];return v1(t,r,i=>{if(!Array.isArray(i))throw new TypeError("Array expected at path "+JSON.stringify(r));const a=mf(i);return a.splice(parseInt(o),0,n),a})}function Lr(t,e){return t===void 0?!1:e.length===0?!0:t===null?!1:Lr(t[e[0]],e.slice(1))}function ao(t){const e=t.split("/");return e.shift(),e.map(n=>n.replace(/~1/g,"/").replace(/~0/g,"~"))}function Be(t){return t.map(bf).join("")}function bf(t){return"/"+String(t).replace(/~/g,"~0").replace(/\//g,"~1")}function Yd(t,e){return t+bf(e)}function nl(t,e){return t.startsWith(e)&&(t.length===e.length||t[e.length]==="/")}function to(t,e,n){let r=t;for(let o=0;o<e.length;o++){Kj(e[o]);let i=e[o];if(n&&n.before){const l=n.before(r,i);if(l!==void 0){if(l.document!==void 0&&(r=l.document),l.json!==void 0)throw new Error('Deprecation warning: returned object property ".json" has been renamed to ".document"');l.operation!==void 0&&(i=l.operation)}}const a=r,s=yo(r,i.path);if(i.op==="add")r=Bj(r,s,i.value);else if(i.op==="remove")r=Fj(r,s);else if(i.op==="replace")r=Dj(r,s,i.value);else if(i.op==="copy")r=Uj(r,s,mu(i.from));else if(i.op==="move")r=Vj(r,s,mu(i.from));else if(i.op==="test")Hj(r,s,i.value);else throw new Error("Unknown JSONPatch operation "+JSON.stringify(i));if(n&&n.after){const l=n.after(r,i,a);l!==void 0&&(r=l)}}return r}function Dj(t,e,n){return Yr(t,e,n)}function Fj(t,e){return gf(t,e)}function Bj(t,e,n){return Os(t,e)?yf(t,e,n):Yr(t,e,n)}function Uj(t,e,n){const r=We(t,n);if(Os(t,e))return yf(t,e,r);{const o=We(t,n);return Yr(t,e,o)}}function Vj(t,e,n){const r=We(t,n),o=gf(t,n);return Os(o,e)?yf(o,e,r):Yr(o,e,r)}function Hj(t,e,n){if(n===void 0)throw new Error(`Test failed: no value provided (path: "${Be(e)}")`);if(!Lr(t,e))throw new Error(`Test failed: path not found (path: "${Be(e)}")`);const r=We(t,e);if(!Aj(r,n))throw new Error(`Test failed, value differs (path: "${Be(e)}")`)}function Os(t,e){if(e.length===0)return!1;const n=We(t,d1(e));return Array.isArray(n)}function Jj(t,e){if(zj(e)!=="-")return e;const n=d1(e),r=We(t,n);return n.concat(r.length)}function Kj(t){if(!["add","remove","replace","copy","move","test"].includes(t.op))throw new Error("Unknown JSONPatch op "+JSON.stringify(t.op));if(typeof t.path!="string")throw new Error('Required property "path" missing or not a string in operation '+JSON.stringify(t));if((t.op==="copy"||t.op==="move")&&typeof t.from!="string")throw new Error('Required property "from" missing or not a string in operation '+JSON.stringify(t))}function yo(t,e){return Jj(t,ao(e))}function mu(t){return ao(t)}function m1(t,e,n){let r=[];return to(t,e,{before:(i,a)=>{let s;const l=yo(i,a.path);if(a.op==="add")s=y1(i,l);else if(a.op==="remove")s=g1(i,l);else if(a.op==="replace")s=h1(i,l);else if(a.op==="copy")s=Wj(i,l);else if(a.op==="move")s=Gj(i,l,mu(a.from));else if(a.op==="test")s=[];else throw new Error("Unknown JSONPatch operation "+JSON.stringify(a));let c;if(n&&n.before){const u=n.before(i,a,s);if(u&&u.revertOperations&&(s=u.revertOperations),u&&u.document&&(c=u.document),u&&u.json)throw new Error('Deprecation warning: returned object property ".json" has been renamed to ".document"')}if(r=s.concat(r),c!==void 0)return{document:c}}}),r}function h1(t,e){return[{op:"replace",path:Be(e),value:We(t,e)}]}function g1(t,e){return[{op:"add",path:Be(e),value:We(t,e)}]}function y1(t,e){return Os(t,e)||!Lr(t,e)?[{op:"remove",path:Be(e)}]:h1(t,e)}function Wj(t,e){return y1(t,e)}function Gj(t,e,n){if(e.length<n.length&&qj(n,e))return[{op:"replace",path:Be(e),value:t}];const r={op:"move",from:Be(e),path:Be(n)};return!Os(t,e)&&Lr(t,e)?[r,...g1(t,e)]:[r]}var _c={},Xd={b:"\b",f:"\f",n:`
1
+ import{g as Db,je as Fb,dx as Bb,s as Ub,r as Ya,U as Vb,j as pu}from"./index-Cz4lAJ3Y.js";import{L as Hb,G as Jb,I as Kb,J as Wb,K as Gd,M as Gb,N as Qb,V as a1,O as Yb,P as Xb,A as bi,Q as kc,R as s1,T as c1,H as Zb,B as Ua,o as l1,E as Ji,z as Qd,C as ej,U as tj,b as nj,e as rj,g as oj,i as ij,j as aj,k as sj,m as cj,n as lj,p as uj,q as fj,r as dj,t as pj,u as vj,v as mj,w as hj,x as gj,c as yj,d as bj,s as jj,h as $j,f as wj,a as xj,l as Sj,W as Cj,X as kj,y as _j,Y as Ej,Z as Oj,_ as Mj,$ as Va,a0 as Pj,a1 as Tj,a2 as Rj,a3 as Nj}from"./index-Bj8wwcOa.js";function xn(t){return Array.isArray(t)}function In(t){return t!==null&&typeof t=="object"&&(t.constructor===void 0||t.constructor.name==="Object")}function u1(t){return t&&typeof t=="object"?t.op==="add":!1}function f1(t){return t&&typeof t=="object"?t.op==="remove":!1}function vf(t){return t&&typeof t=="object"?t.op==="replace":!1}function vu(t){return t&&typeof t=="object"?t.op==="copy":!1}function la(t){return t&&typeof t=="object"?t.op==="move":!1}function Aj(t,e){return JSON.stringify(t)===JSON.stringify(e)}function Ij(t,e){return t===e}function d1(t){return t.slice(0,t.length-1)}function zj(t){return t[t.length-1]}function qj(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ij;if(t.length<e.length)return!1;for(let r=0;r<e.length;r++)if(!n(t[r],e[r]))return!1;return!0}function p1(t){return typeof t=="object"&&t!==null}function mf(t){if(xn(t)){const e=t.slice();return Object.getOwnPropertySymbols(t).forEach(n=>{e[n]=t[n]}),e}else if(In(t)){const e={...t};return Object.getOwnPropertySymbols(t).forEach(n=>{e[n]=t[n]}),e}else return t}function hf(t,e,n){if(t[e]===n)return t;{const r=mf(t);return r[e]=n,r}}function We(t,e){let n=t,r=0;for(;r<e.length;)In(n)?n=n[e[r]]:xn(n)?n=n[parseInt(e[r])]:n=void 0,r++;return n}function Yr(t,e,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(e.length===0)return n;const o=e[0],i=Yr(t?t[o]:void 0,e.slice(1),n,r);if(In(t)||xn(t))return hf(t,o,i);if(r){const a=Lj.test(o)?[]:{};return a[o]=i,a}else throw new Error("Path does not exist")}const Lj=/^\d+$/;function v1(t,e,n){if(e.length===0)return n(t);if(!p1(t))throw new Error("Path doesn't exist");const r=e[0],o=v1(t[r],e.slice(1),n);return hf(t,r,o)}function gf(t,e){if(e.length===0)return t;if(!p1(t))throw new Error("Path does not exist");if(e.length===1){const o=e[0];if(o in t){const i=mf(t);return xn(i)&&i.splice(parseInt(o),1),In(i)&&delete i[o],i}else return t}const n=e[0],r=gf(t[n],e.slice(1));return hf(t,n,r)}function yf(t,e,n){const r=e.slice(0,e.length-1),o=e[e.length-1];return v1(t,r,i=>{if(!Array.isArray(i))throw new TypeError("Array expected at path "+JSON.stringify(r));const a=mf(i);return a.splice(parseInt(o),0,n),a})}function Lr(t,e){return t===void 0?!1:e.length===0?!0:t===null?!1:Lr(t[e[0]],e.slice(1))}function ao(t){const e=t.split("/");return e.shift(),e.map(n=>n.replace(/~1/g,"/").replace(/~0/g,"~"))}function Be(t){return t.map(bf).join("")}function bf(t){return"/"+String(t).replace(/~/g,"~0").replace(/\//g,"~1")}function Yd(t,e){return t+bf(e)}function nl(t,e){return t.startsWith(e)&&(t.length===e.length||t[e.length]==="/")}function to(t,e,n){let r=t;for(let o=0;o<e.length;o++){Kj(e[o]);let i=e[o];if(n&&n.before){const l=n.before(r,i);if(l!==void 0){if(l.document!==void 0&&(r=l.document),l.json!==void 0)throw new Error('Deprecation warning: returned object property ".json" has been renamed to ".document"');l.operation!==void 0&&(i=l.operation)}}const a=r,s=yo(r,i.path);if(i.op==="add")r=Bj(r,s,i.value);else if(i.op==="remove")r=Fj(r,s);else if(i.op==="replace")r=Dj(r,s,i.value);else if(i.op==="copy")r=Uj(r,s,mu(i.from));else if(i.op==="move")r=Vj(r,s,mu(i.from));else if(i.op==="test")Hj(r,s,i.value);else throw new Error("Unknown JSONPatch operation "+JSON.stringify(i));if(n&&n.after){const l=n.after(r,i,a);l!==void 0&&(r=l)}}return r}function Dj(t,e,n){return Yr(t,e,n)}function Fj(t,e){return gf(t,e)}function Bj(t,e,n){return Os(t,e)?yf(t,e,n):Yr(t,e,n)}function Uj(t,e,n){const r=We(t,n);if(Os(t,e))return yf(t,e,r);{const o=We(t,n);return Yr(t,e,o)}}function Vj(t,e,n){const r=We(t,n),o=gf(t,n);return Os(o,e)?yf(o,e,r):Yr(o,e,r)}function Hj(t,e,n){if(n===void 0)throw new Error(`Test failed: no value provided (path: "${Be(e)}")`);if(!Lr(t,e))throw new Error(`Test failed: path not found (path: "${Be(e)}")`);const r=We(t,e);if(!Aj(r,n))throw new Error(`Test failed, value differs (path: "${Be(e)}")`)}function Os(t,e){if(e.length===0)return!1;const n=We(t,d1(e));return Array.isArray(n)}function Jj(t,e){if(zj(e)!=="-")return e;const n=d1(e),r=We(t,n);return n.concat(r.length)}function Kj(t){if(!["add","remove","replace","copy","move","test"].includes(t.op))throw new Error("Unknown JSONPatch op "+JSON.stringify(t.op));if(typeof t.path!="string")throw new Error('Required property "path" missing or not a string in operation '+JSON.stringify(t));if((t.op==="copy"||t.op==="move")&&typeof t.from!="string")throw new Error('Required property "from" missing or not a string in operation '+JSON.stringify(t))}function yo(t,e){return Jj(t,ao(e))}function mu(t){return ao(t)}function m1(t,e,n){let r=[];return to(t,e,{before:(i,a)=>{let s;const l=yo(i,a.path);if(a.op==="add")s=y1(i,l);else if(a.op==="remove")s=g1(i,l);else if(a.op==="replace")s=h1(i,l);else if(a.op==="copy")s=Wj(i,l);else if(a.op==="move")s=Gj(i,l,mu(a.from));else if(a.op==="test")s=[];else throw new Error("Unknown JSONPatch operation "+JSON.stringify(a));let c;if(n&&n.before){const u=n.before(i,a,s);if(u&&u.revertOperations&&(s=u.revertOperations),u&&u.document&&(c=u.document),u&&u.json)throw new Error('Deprecation warning: returned object property ".json" has been renamed to ".document"')}if(r=s.concat(r),c!==void 0)return{document:c}}}),r}function h1(t,e){return[{op:"replace",path:Be(e),value:We(t,e)}]}function g1(t,e){return[{op:"add",path:Be(e),value:We(t,e)}]}function y1(t,e){return Os(t,e)||!Lr(t,e)?[{op:"remove",path:Be(e)}]:h1(t,e)}function Wj(t,e){return y1(t,e)}function Gj(t,e,n){if(e.length<n.length&&qj(n,e))return[{op:"replace",path:Be(e),value:t}];const r={op:"move",from:Be(e),path:Be(n)};return!Os(t,e)&&Lr(t,e)?[r,...g1(t,e)]:[r]}var _c={},Xd={b:"\b",f:"\f",n:`
2
2
  `,r:"\r",t:" ",'"':'"',"/":"/","\\":"\\"},Qj=97;_c.parse=function(t,e,n){var r={},o=0,i=0,a=0,s=n&&n.bigint&&typeof BigInt<"u";return{data:l("",!0),pointers:r};function l(W,U){c();var te;b(W,"value");var F=m();switch(F){case"t":v("rue"),te=!0;break;case"f":v("alse"),te=!1;break;case"n":v("ull"),te=null;break;case'"':te=u();break;case"[":te=d(W);break;case"{":te=p(W);break;default:g(),"-0123456789".indexOf(F)>=0?te=f():R()}return b(W,"valueEnd"),c(),U&&a<t.length&&R(),te}function c(){e:for(;a<t.length;){switch(t[a]){case" ":i++;break;case" ":i+=4;break;case"\r":i=0;break;case`
3
3
  `:i=0,o++;break;default:break e}a++}}function u(){for(var W="",U;U=m(),U!='"';)U=="\\"?(U=m(),U in Xd?W+=Xd[U]:U=="u"?W+=h():D()):W+=U;return W}function f(){var W="",U=!0;t[a]=="-"&&(W+=m()),W+=t[a]=="0"?m():y(),t[a]=="."&&(W+=m()+y(),U=!1),(t[a]=="e"||t[a]=="E")&&(W+=m(),(t[a]=="+"||t[a]=="-")&&(W+=m()),W+=y(),U=!1);var te=+W;return s&&U&&(te>Number.MAX_SAFE_INTEGER||te<Number.MIN_SAFE_INTEGER)?BigInt(W):te}function d(W){c();var U=[],te=0;if(m()=="]")return U;for(g();;){var F=W+"/"+te;U.push(l(F)),c();var J=m();if(J=="]")break;J!=","&&D(),c(),te++}return U}function p(W){c();var U={};if(m()=="}")return U;for(g();;){var te=w();m()!='"'&&D();var F=u(),J=W+"/"+hu(F);S(J,"key",te),b(J,"keyEnd"),c(),m()!=":"&&D(),c(),U[F]=l(J),c();var H=m();if(H=="}")break;H!=","&&D(),c()}return U}function v(W){for(var U=0;U<W.length;U++)m()!==W[U]&&D()}function m(){Z();var W=t[a];return a++,i++,W}function g(){a--,i--}function h(){for(var W=4,U=0;W--;){U<<=4;var te=m().toLowerCase();te>="a"&&te<="f"?U+=te.charCodeAt()-Qj+10:te>="0"&&te<="9"?U+=+te:D()}return String.fromCharCode(U)}function y(){for(var W="";t[a]>="0"&&t[a]<="9";)W+=m();if(W.length)return W;Z(),R()}function b(W,U){S(W,U,w())}function S(W,U,te){r[W]=r[W]||{},r[W][U]=te}function w(){return{line:o,column:i,pos:a}}function R(){throw new SyntaxError("Unexpected token "+t[a]+" in JSON at position "+a)}function D(){g(),R()}function Z(){if(a>=t.length)throw new SyntaxError("Unexpected end of JSON input")}};_c.stringify=function(t,e,n){if(!Js(t))return;var r=0,o,i,a=typeof n=="object"?n.space:n;switch(typeof a){case"number":var s=a>10?10:a<0?0:Math.floor(a);a=s&&S(s," "),o=s,i=s;break;case"string":a=a.slice(0,10),o=0,i=0;for(var l=0;l<a.length;l++){var c=a[l];switch(c){case" ":i++;break;case" ":i+=4;break;case"\r":i=0;break;case`
4
4
  `:i=0,r++;break;default:throw new Error("whitespace characters not allowed in JSON")}o++}break;default:a=void 0}var u="",f={},d=0,p=0,v=0,m=n&&n.es6&&typeof Map=="function";return g(t,0,""),{json:u,pointers:f};function g(w,R,D){switch(b(D,"value"),typeof w){case"number":case"bigint":case"boolean":h(""+w);break;case"string":h(Ks(w));break;case"object":w===null?h("null"):typeof w.toJSON=="function"?h(Ks(w.toJSON())):Array.isArray(w)?Z():m?w.constructor.BYTES_PER_ELEMENT?Z():w instanceof Map?U():w instanceof Set?U(!0):W():W()}b(D,"valueEnd");function Z(){if(w.length){h("[");for(var te=R+1,F=0;F<w.length;F++){F&&h(","),y(te);var J=Js(w[F])?w[F]:null,H=D+"/"+F;g(J,te,H)}y(R),h("]")}else h("[]")}function W(){var te=Object.keys(w);if(te.length){h("{");for(var F=R+1,J=0;J<te.length;J++){var H=te[J],X=w[H];if(Js(X)){J&&h(",");var K=D+"/"+hu(H);y(F),b(K,"key"),h(Ks(H)),b(K,"keyEnd"),h(":"),a&&h(" "),g(X,F,K)}}y(R),h("}")}else h("{}")}function U(te){if(w.size){h("{");for(var F=R+1,J=!0,H=w.entries(),X=H.next();!X.done;){var K=X.value,Q=K[0],M=te?!0:K[1];if(Js(M)){J||h(","),J=!1;var A=D+"/"+hu(Q);y(F),b(A,"key"),h(Ks(Q)),b(A,"keyEnd"),h(":"),a&&h(" "),g(M,F,A)}X=H.next()}y(R),h("}")}else h("{}")}}function h(w){p+=w.length,v+=w.length,u+=w}function y(w){if(a){for(u+=`
@@ -0,0 +1 @@
1
+ import{aE as ae,aF as le,s as c,r as d,aK as ie,_ as ce,a as $,j as e,aL as de,aN as ue,R as U,f as B,af as q,et as A,y as he,D as pe,fR as V,dj as X,ba as y,er as xe,es as me,ae as je,k as Y,T as v,aj as ge,du as fe,am as be,C as b,B as g,ax as ye,an as Te,aw as K,d8 as L,br as Ce,eH as ke,bf as Ae,j3 as ve,L as Q,ex as we,ai as w,cc as D,ey as E,at as Se,F as Ee,H as Ne,ah as G,fu as Re,al as N,el as Ie,eO as De,aa as C,ab as Ue,cG as J,b1 as Be,aV as Z,i as Le,I as Pe,G as _e,ay as ee,c1 as R,hT as Fe,dO as Me,dN as Oe,e5 as He,e1 as $e,fg as Ke,d$ as Ge,fh as We,gT as ze,cm as qe,b7 as te,b9 as se,b8 as Ve,b6 as Xe,b2 as Ye,dX as Qe}from"./index-Cz4lAJ3Y.js";import{u as Je}from"./useApiTokens-Dx2wjhgw.js";function Ze(t){return le("MuiTableContainer",t)}ae("MuiTableContainer",["root"]);const et=["className","component"],tt=t=>{const{classes:s}=t;return ue({root:["root"]},Ze,s)},st=c("div",{name:"MuiTableContainer",slot:"Root",overridesResolver:(t,s)=>s.root})({width:"100%",overflowX:"auto"}),nt=d.forwardRef(function(s,n){const o=ie({props:s,name:"MuiTableContainer"}),{className:r,component:a="div"}=o,l=ce(o,et),u=$({},o,{component:a}),i=tt(u);return e.jsx(st,$({ref:n,as:a,className:de(i.root,r),ownerState:u},l))}),ot=()=>e.jsx(U,{severity:"info",children:e.jsxs("p",{children:["Read the"," ",e.jsx("a",{href:"https://docs.getunleash.io/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."]})}),k=({title:t,url:s})=>{const{setToastData:n}=B(),o=r=>()=>{X(r),n({type:"success",text:"Copied to clipboard"})};return e.jsxs(q,{children:[e.jsx(A,{component:"th",scope:"row",children:t}),e.jsx(A,{children:e.jsx("pre",{style:{display:"inline"},children:s})}),e.jsx(A,{align:"center",children:e.jsx(he,{title:"Copy URL",arrow:!0,children:e.jsx(pe,{onClick:o(s),size:"small","aria-label":`Copy ${t} to clipboard`,children:e.jsx(V,{})})})})]})},I=c(A)(({theme:t})=>({color:t.palette.text.secondary})),rt=({compact:t})=>{const{uiConfig:s}=y(),[n,o]=d.useState(!t),r=s.unleashUrl&&(n||!s.edgeUrl),a=t&&s.edgeUrl&&s.unleashUrl,l=s.edgeUrl?{edgeUrl:`${s.edgeUrl}/api/`,edgeFrontendUrl:`${s.edgeUrl}/api/frontend/`}:void 0,u=`${s.unleashUrl}/api/`,i=`${s.unleashUrl}/api/frontend/`;return e.jsxs(nt,{role:"region","aria-live":"polite",children:[e.jsxs(xe,{"aria-label":"API URLs",id:"api-urls-table",children:[e.jsx(me,{children:e.jsxs(q,{children:[e.jsx(I,{children:"Type"}),e.jsx(I,{children:"URL"}),e.jsx(I,{align:"center",children:"Actions"})]})}),e.jsxs(je,{children:[l&&e.jsxs(e.Fragment,{children:[e.jsx(k,{title:"Edge Backend",url:l.edgeUrl}),e.jsx(k,{title:"Edge Frontend",url:l.edgeFrontendUrl})]}),r&&e.jsxs(e.Fragment,{children:[e.jsx(k,{title:"Backend",url:u}),e.jsx(k,{title:"Frontend",url:i})]})]})]}),a&&e.jsx(Y,{sx:{mt:1,marginInline:1.5},variant:"text",size:"small","aria-expanded":n,"aria-controls":"api-urls-table",onClick:()=>o(!n),children:n?"Show less":"Show all"})]})},at=["Icon","createdAt","seenAt"],lt=["Icon","project","seenAt"],W=c(v)(({theme:t})=>({margin:0,marginBottom:t.spacing(1.5),fontSize:t.fontSizes.smallBody,color:t.palette.text.primary})),_t=({compact:t=!1,setHiddenColumns:s,columns:n,loading:o,rows:r,headerGroups:a,globalFilter:l,prepareRow:u})=>{const i=ge(fe.breakpoints.down("xl"));return be([{condition:i,columns:at},{condition:t,columns:lt}],s,n),e.jsxs(e.Fragment,{children:[e.jsx(b,{condition:r.length>0,show:e.jsxs(g,{sx:{mb:4},children:[e.jsx(ot,{}),e.jsxs(g,{sx:{marginBlock:4},children:[e.jsx(W,{variant:"h2",children:"API URLs"}),e.jsx(rt,{compact:t})]})]})}),e.jsxs(g,{sx:{overflowX:"auto"},children:[e.jsx(W,{variant:"h2",children:"API Tokens"}),e.jsx(ye,{value:l,children:e.jsx(Te,{rows:r,headerGroups:a,prepareRow:u})})]}),e.jsx(b,{condition:r.length===0&&!o,show:e.jsx(b,{condition:(l==null?void 0:l.length)>0,show:e.jsxs(K,{children:["No tokens found matching “",l,"”"]}),elseShow:e.jsx(K,{children:e.jsxs("span",{children:["No tokens available. Read ",e.jsx(L,{href:"https://docs.getunleash.io/api-overview",target:"_blank",rel:"noreferrer",children:"API How-to guides"})," "," to learn more."]})})})})]})},it=(t,s)=>{const n=s>=t;return{limitReached:n,limitMessage:n?`You have reached the limit of ${t} API tokens`:void 0}},Ft=({path:t,permission:s,project:n})=>{const o=Ce(),{tokens:r,loading:a}=Je(),{uiConfig:l}=y(),{limitReached:u,limitMessage:i}=it(l.resourceLimits.apiTokens,r.length);return e.jsx(ke,{Icon:Ae,onClick:()=>o(t),"data-testid":ve,permission:s,projectId:n,maxWidth:"700px",disabled:a||u,tooltipProps:{title:i},children:"New API token"})},ct=c(Q)(({theme:t})=>({textDecoration:"none",color:t.palette.links,"&:hover, &:focus":{textDecoration:"underline"}})),dt=c("div")({display:"flex",alignItems:"center"}),ut=({projects:t,project:s})=>{const{searchQuery:n}=we(),o=t&&Array.isArray(t)&&t.length>1?t:[];if(o.length>0)return e.jsx(w,{children:e.jsx(D,{title:o.map((r,a)=>e.jsxs(d.Fragment,{children:[a>0&&", ",!r||r==="*"?e.jsx(E,{search:n,children:"*"}):e.jsx(ct,{to:`/projects/${r}`,children:e.jsx(E,{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(Se,{to:`/projects/${r}`,title:r})}return e.jsx(w,{children:e.jsx(D,{title:"ALL current and future projects.",placement:"bottom",arrow:!0,children:e.jsx(dt,{children:e.jsx(E,{search:n,children:"*"})})})})};var P={},ht=Ne;Object.defineProperty(P,"__esModule",{value:!0});var ne=P.default=void 0,pt=ht(Ee()),xt=e,mt=(0,pt.default)((0,xt.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");ne=P.default=mt;const jt=({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},gt=({...t})=>jt(t)?e.jsx(G,{icon:e.jsx(D,{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(L,{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(Re,{"aria-label":"Orphaned token",color:"warning","data-testid":"orphaned-token-icon"})})}):e.jsx(G,{icon:e.jsx(ne,{color:"disabled"})}),Mt=(t,s)=>{const n=d.useMemo(()=>({sortBy:[{id:"createdAt",desc:!0}]}),[]),o=d.useMemo(()=>[{id:"Icon",Cell:p=>e.jsx(gt,{secret:p.row.original.secret,project:p.row.original.project,projects:p.row.original.projects}),disableSortBy:!0,disableGlobalFilter:!0,width:50},{Header:"Token name",accessor:"tokenName",Cell:N,minWidth:35},{Header:"Type",accessor:"type",Cell:({value:p})=>e.jsx(N,{value:z[p.toLowerCase()].label,subtitle:z[p.toLowerCase()].title,subtitleTooltip:!0}),width:180},{Header:"Project",accessor:"project",Cell:p=>e.jsx(ut,{project:p.row.original.project,projects:p.row.original.projects}),width:160},{Header:"Environment",accessor:"environment",Cell:N,width:120},{Header:"Created",accessor:"createdAt",Cell:Ie,width:150,disableGlobalFilter:!0},{Header:"Last seen",accessor:"seenAt",Cell:De,width:140,disableGlobalFilter:!0},{Header:"Actions",width:120,id:"Actions",align:"center",disableSortBy:!0,disableGlobalFilter:!0,Cell:s}],[]),{getTableProps:r,getTableBodyProps:a,headerGroups:l,rows:u,prepareRow:i,state:j,setGlobalFilter:m,setHiddenColumns:f}=C.useTable({columns:o,data:t,initialState:n,sortTypes:Ue,autoResetHiddenColumns:!1,disableSortRemove:!0},C.useGlobalFilter,C.useSortBy,C.useFlexLayout);return{getTableProps:r,getTableBodyProps:a,headerGroups:l,rows:u,prepareRow:i,state:j,setGlobalFilter:m,setHiddenColumns:f,columns:o}},z={client:{label:"BACKEND",title:"Connect backend SDK or Unleash Edge"},backend:{label:"BACKEND",title:"Connect backend SDK or Unleash Edge"},frontend:{label:"FRONTEND",title:"Connect frontend SDK"},admin:{label:"ADMIN",title:"Full access for managing Unleash"}},Ot=({token:t,project:s,permission:n,track:o})=>{const{setToastData:r}=B(),a=l=>{X(l)&&(r({type:"success",text:"Token copied to clipboard"}),o&&typeof o=="function"&&o())};return e.jsx(J,{permission:n,projectId:s,tooltipProps:{title:"Copy token",arrow:!0},onClick:()=>a(t.secret),size:"large",children:e.jsx(V,{})})},ft=c("ul")({marginBottom:0}),Ht=({token:t,permission:s,onRemove:n,project:o})=>{const[r,a]=d.useState(!1),{setToastData:l,setToastApiError:u}=B(),i=async()=>{try{await n(),a(!1),l({type:"success",text:"API token removed"})}catch(j){u(Le(j))}};return e.jsxs(e.Fragment,{children:[e.jsx(J,{permission:s,projectId:o,tooltipProps:{title:"Delete token",arrow:!0},onClick:()=>a(!0),size:"large",children:e.jsx(Be,{})}),e.jsx(Z,{open:r,onClick:i,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(ft,{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})]})]})]})})]})},bt=c("div")(()=>({maxWidth:"400px"})),yt=c("form")(()=>({display:"flex",flexDirection:"column",height:"100%"})),Tt=c(Pe)(({theme:t})=>({width:"100%",marginBottom:t.spacing(2)})),Ct=c(_e)(({theme:t})=>({marginBottom:t.spacing(2),minWidth:"400px",[t.breakpoints.down("sm")]:{minWidth:"379px"}})),oe=c("p")(({theme:t})=>({marginBottom:t.spacing(1)})),kt=c("label")(({theme:t})=>({marginBottom:t.spacing(1)})),At=c(Y)(({theme:t})=>({marginLeft:t.spacing(3)})),vt=c(g)({marginTop:"auto",display:"flex",justifyContent:"flex-end"}),$t=({children:t,actions:s,handleSubmit:n,handleCancel:o})=>{var l;const{uiConfig:r}=y(),a=!!((l=r==null?void 0:r.flags)!=null&&l.UNLEASH_CLOUD);return e.jsxs(yt,{onSubmit:n,children:[e.jsx(b,{condition:a,show:e.jsxs(U,{severity:"info",sx:{mb:4},children:["Please be aware of our"," ",e.jsx(L,{href:"https://www.getunleash.io/fair-use-policy",children:"fair use policy"}),"."]})}),t,e.jsxs(vt,{children:[s,e.jsx(At,{onClick:o,children:"Cancel"})]})]})};var x=(t=>(t.ADMIN="ADMIN",t.CLIENT="CLIENT",t.FRONTEND="FRONTEND",t))(x||{});const Kt=t=>{var M,O;const{environments:s}=ee(),n=(M=s==null?void 0:s.find(h=>h.enabled))==null?void 0:M.name,o=R(Fe,t),r=[{key:x.CLIENT,label:"Backend SDK",title:"Creates a backend token to connect a backend SDK or Unleash Edge",enabled:R(Me)||o},{key:x.FRONTEND,label:"Frontend SDK",title:"Creates a frontend token to connect a frontend SDK",enabled:R(Oe)||o}],a=(O=r.find(h=>h.enabled))==null?void 0:O.key,[l,u]=d.useState(""),[i,j]=d.useState(a||x.CLIENT),[m,f]=d.useState([t||"*"]),[p,re]=d.useState(m),[_,T]=d.useState(),[F,S]=d.useState({});return d.useEffect(()=>{T(i==="ADMIN"?"*":n)},[i,n]),{tokenName:l,type:i,apiTokenTypes:r,projects:m,environment:_,setTokenName:u,setTokenType:h=>{h==="ADMIN"?(j(x.ADMIN),re(m),f(["*"]),T("*")):(j(h),f(p),T(n))},setProjects:f,setEnvironment:T,getApiTokenPayload:()=>({tokenName:l,type:i,environment:_,projects:m}),isValid:()=>{const h={};return l||(h.tokenName="Token name is required"),m.length===0&&(h.projects="At least one project is required"),S(h),Object.keys(h).length===0},clearErrors:h=>{if(h){const H={...F};delete H[h],S(H)}else S({})},errors:F}},Gt=({open:t,setOpen:s,closeConfirm:n,token:o,type:r})=>e.jsxs(Z,{open:t,setOpen:s,onClick:n,primaryButtonText:"Close",title:"New token created",children:[e.jsx(v,{variant:"body1",children:"Your new token has been created successfully."}),e.jsx(He,{token:o}),e.jsx(b,{condition:r===x.FRONTEND,show:e.jsxs(U,{sx:{mt:2},severity:"info",children:["By default, all ",x.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(oe,{children:"What would you like to call this token?"}),e.jsx(Tt,{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})]}),zt=({type:t,setType:s,apiTokenTypes:n})=>e.jsx(bt,{children:e.jsxs($e,{sx:{mb:2,width:"100%"},children:[e.jsx(kt,{id:"token-type",children:"What do you want to connect?"}),e.jsx(Ke,{"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:l})=>e.jsx(Ge,{value:o,sx:{mb:1},disabled:!l,control:e.jsx(We,{sx:{ml:.75,alignSelf:"flex-start"}}),label:e.jsx(g,{children:e.jsxs(g,{children:[e.jsx(v,{children:r}),e.jsx(v,{variant:"body2",color:"text.secondary",children:a})]})})},o))})]})}),qt=({type:t,environment:s,setEnvironment:n})=>{const{environments:o}=ee(),r=t===x.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(oe,{children:"Which environment should the token have access to?"}),e.jsx(Ct,{disabled:t===x.ADMIN,options:r,value:s,onChange:n,label:"Environment",id:"api_key_environment",name:"environment",IconComponent:ze,fullWidth:!0})]})},wt=t=>t.map(s=>({...s.user,joinedAt:new Date(s.joinedAt),createdBy:s.createdBy})),Vt=t=>{const{data:s,error:n,mutate:o}=qe(te(`api/admin/groups/${t}`),St);return d.useMemo(()=>({group:s&&{...s,users:wt((s==null?void 0:s.users)??[])},loading:!n&&!s,refetchGroup:()=>o(),error:n}),[s,n,o])},St=t=>fetch(t).then(se("Group")).then(s=>s.json()),Xt=()=>{const{isEnterprise:t}=y(),{data:s,error:n,mutate:o}=Ve(t(),{serviceAccounts:[],rootRoles:[]},te("api/admin/service-account"),Et);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])},Et=t=>fetch(t).then(se("Service Accounts")).then(s=>s.json()),Nt=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)}})),Rt=c(Xe)(()=>({display:"block"})),Yt=({role:t,roles:s,value:n})=>{const{isEnterprise:o}=y();if(o()){const r=s||[t];return e.jsx(w,{children:e.jsx(Ye,{tooltip:e.jsx(Nt,{children:r.map(a=>e.jsx(Qe,{roleId:a,tooltip:!0},a))}),children:e.jsx(Rt,{children:n})})})}return e.jsx(w,{children:n})};export{_t as A,Ft as C,qt as E,Ht as R,oe as S,x as T,Ot as a,Kt as b,$t as c,Wt as d,zt as e,Gt as f,Xt as g,Vt as h,Yt as i,ne as j,wt as m,Mt as u};
@@ -1 +1 @@
1
- import{s as f,L as m,j as n,aV as g,b7 as d,cm as y,r as p,bb as v,b9 as b,aq as x,ba as k,h as E,G as F}from"./index-g9pKMnOR.js";const M=f(m)(({theme:a})=>({textDecoration:"none",color:a.palette.primary.main,fontWeight:a.fontWeight.bold})),j=({isOpen:a,onClose:s,features:e,project:t})=>n.jsxs(g,{title:"You can't archive a feature that other features depend on",open:a,primaryButtonText:"OK",onClick:s,children:[n.jsx("p",{children:"The following features depend on your feature:"}),n.jsx("ul",{children:e.map(r=>n.jsx("li",{children:n.jsx(M,{to:`/projects/${t}/features/${r}`,target:"_blank",rel:"noopener noreferrer",children:r})},r))})]}),L=d("api/admin/client-metrics/features"),U=(a,s)=>{const e=d(`api/admin/client-metrics/features/${a}/raw?hoursBack=${s}`),{data:t,error:r}=y(e,()=>R(e)),i=p.useCallback(()=>{v(L).catch(console.warn)},[]);return{featureMetrics:t==null?void 0:t.data,loading:!r&&!t,refetchFeatureMetrics:i,error:r}},R=a=>fetch(a).then(b("Features")).then(s=>s.json()).then(),w=48,$=({hoursBack:a,setHoursBack:s,label:e="Period"})=>{const{trackEvent:t}=x(),r=o=>{s(Number.parseInt(o,10)),t("feature-metrics",{props:{eventType:"change-period",hoursBack:o}})},{isEnterprise:i}=k(),h=E("extendedUsageMetrics"),l=i()&&h?[...u,...A]:u,c=l.map(o=>Number(o.key)).includes(a)?a:w;return p.useEffect(()=>{a!==c&&s(c)},[a]),n.jsx("div",{children:n.jsx(F,{name:"feature-metrics-period",label:e,id:"feature-metrics-period",options:l,value:String(c),onChange:r,fullWidth:!0})})},u=[{key:"1",label:"Last hour"},{key:"24",label:"Last 24 hours"},{key:"48",label:"Last 48 hours"}],A=[{key:`${7*24}`,label:"Last 7 days"},{key:`${30*24}`,label:"Last 30 days"},{key:`${90*24}`,label:"Last 90 days"}],C=a=>{const s=new Map;return a.forEach(e=>{let t=s.get(e.timestamp);if(t||(t={...e,yes:0,no:0,variants:{}},s.set(e.timestamp,t)),t.yes+=e.yes,t.no+=e.no,e.variants){t.variants=t.variants||{};for(const[r,i]of Object.entries(e.variants))t.variants[r]=(t.variants[r]||0)+i}}),Array.from(s.values()).map(e=>({...e,variants:e.variants&&Object.keys(e.variants).length===0?void 0:e.variants}))};export{j as F,w as a,C as b,$ as c,U as u};
1
+ import{s as f,L as m,j as n,aV as g,b7 as d,cm as y,r as p,bb as v,b9 as b,aq as x,ba as k,h as E,G as F}from"./index-Cz4lAJ3Y.js";const M=f(m)(({theme:a})=>({textDecoration:"none",color:a.palette.primary.main,fontWeight:a.fontWeight.bold})),j=({isOpen:a,onClose:s,features:e,project:t})=>n.jsxs(g,{title:"You can't archive a feature that other features depend on",open:a,primaryButtonText:"OK",onClick:s,children:[n.jsx("p",{children:"The following features depend on your feature:"}),n.jsx("ul",{children:e.map(r=>n.jsx("li",{children:n.jsx(M,{to:`/projects/${t}/features/${r}`,target:"_blank",rel:"noopener noreferrer",children:r})},r))})]}),L=d("api/admin/client-metrics/features"),U=(a,s)=>{const e=d(`api/admin/client-metrics/features/${a}/raw?hoursBack=${s}`),{data:t,error:r}=y(e,()=>R(e)),i=p.useCallback(()=>{v(L).catch(console.warn)},[]);return{featureMetrics:t==null?void 0:t.data,loading:!r&&!t,refetchFeatureMetrics:i,error:r}},R=a=>fetch(a).then(b("Features")).then(s=>s.json()).then(),w=48,$=({hoursBack:a,setHoursBack:s,label:e="Period"})=>{const{trackEvent:t}=x(),r=o=>{s(Number.parseInt(o,10)),t("feature-metrics",{props:{eventType:"change-period",hoursBack:o}})},{isEnterprise:i}=k(),h=E("extendedUsageMetrics"),l=i()&&h?[...u,...A]:u,c=l.map(o=>Number(o.key)).includes(a)?a:w;return p.useEffect(()=>{a!==c&&s(c)},[a]),n.jsx("div",{children:n.jsx(F,{name:"feature-metrics-period",label:e,id:"feature-metrics-period",options:l,value:String(c),onChange:r,fullWidth:!0})})},u=[{key:"1",label:"Last hour"},{key:"24",label:"Last 24 hours"},{key:"48",label:"Last 48 hours"}],A=[{key:`${7*24}`,label:"Last 7 days"},{key:`${30*24}`,label:"Last 30 days"},{key:`${90*24}`,label:"Last 90 days"}],C=a=>{const s=new Map;return a.forEach(e=>{let t=s.get(e.timestamp);if(t||(t={...e,yes:0,no:0,variants:{}},s.set(e.timestamp,t)),t.yes+=e.yes,t.no+=e.no,e.variants){t.variants=t.variants||{};for(const[r,i]of Object.entries(e.variants))t.variants[r]=(t.variants[r]||0)+i}}),Array.from(s.values()).map(e=>({...e,variants:e.variants&&Object.keys(e.variants).length===0?void 0:e.variants}))};export{j as F,w as a,C as b,$ as c,U as u};
@@ -1,6 +1,6 @@
1
- import{jv as ct,jX as R,jY as w,jZ as p,jw as Q,j_ as fe,j$ as ut,k0 as b,ji as oe,jD as B,k1 as A,k2 as ft,k3 as ht,jx as z,jy as he,jt as K,k4 as yt,k5 as bt,k6 as _,k7 as J,k8 as Ce,k9 as gt,ka as ke,kb as T,kc as $e,kd as Ve,ke as mt}from"./index-g9pKMnOR.js";/*!
1
+ import{jy as ct,j_ as R,j$ as w,k0 as p,jz as Q,k1 as fe,k2 as ut,k3 as b,jl as oe,jG as B,k4 as D,k5 as ft,k6 as ht,jA as X,jB as he,jw as G,k7 as yt,k8 as bt,k9 as _,ka as J,kb as ke,kc as gt,kd as Ce,ke as T,kf as $e,kg as Ve,kh as mt}from"./index-Cz4lAJ3Y.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 Pe={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(Pe.modes[n.mode]||Pe.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,D=.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-D&&t.x<=o+a+D,l=t.y>=n-a-D&&t.y<=r+a+D;return i==="x"?d:(i==="y"||d)&&l}function E(t,e){const{centerX:n,centerY:o}=t.getProps(["centerX","centerY"],e);return{x:n,y:o}}function kt(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 Pt(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:z(t.x,e),y:z(t.y,e)}:(t=z(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,Dt=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 k(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,Rt(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=k(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 jt(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=Pt(e,n),c=e.y+n.textStrokeWidth/2;t.save(),t.textBaseline="middle",t.textAlign=n.textAlign,It(t,n)&&Et(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}Dt(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+_)*l,d=Math.sin(s+_)*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+=_;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+=_;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+=_,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 Rt(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 Et(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=ke(t)?t:e;return ke(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 j(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[j(o,e,"xScaleID")],i=o[j(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[j(n,e,"xScaleID")],r=n[j(n,e,"yScaleID")];if(!o&&!r)return{};let{left:i,right:s}=o||t.chartArea,{top:a,bottom:d}=r||t.chartArea;const l=De(o,{min:e.xMin,max:e.xMax,start:i,end:s});i=l.start,s=l.end;const c=De(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 _t(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):zt(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 _t(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 De(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 zt(t,e,n){for(const o of Object.keys(ve)){const r=t[j(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 je(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=j(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:z(e.min,Number.NEGATIVE_INFINITY),max:z(e.max,Number.POSITIVE_INFINITY)};for(const a of n)a.scaleID===r?Te(a,e,["value","endValue"],s):j(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 R{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 E(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 R{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 E(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),jt(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(),!k(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],P=[];for(let v=0;v<4;v++){const ne=I({x:g[v],y:m[v]},h,w(f));P.push({position:st[v],distance:fe(ne,{x:d,y:l})})}return P.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,Re=(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},Ee=(t,e,n,o)=>(1-o)*(1-o)*t+2*(1-o)*o*e+o*o*n,ae=(t,e,n,o)=>({x:Ee(t.x,e.x,n.x,o),y:Ee(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 R{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){k(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 E(this,e)}draw(e){const{x:n,y:o,x2:r,y2:i,cp:s,options:a}=this;if(e.save(),!k(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 kn(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 _e({x:t,y:e},n,{top:o,right:r,bottom:i,left:s}){return t<s&&(e=Re(s,{x:t,y:e},n),t=s),t>r&&(e=Re(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}=_e(t,e,n),{x:i,y:s}=_e(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=D,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=ze(y.x,x)+a,m=ze(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 ze(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),k(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 kn(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),P=new Path2D;t.beginPath(),P.moveTo(g.x,g.y),P.quadraticCurveTo(n.x,n.y,m.x,m.y),t.shadowColor=d.borderShadowColor,t.stroke(P),e.path=P,e.ctx=t,He(t,g,{angle:x,adjust:u},l),He(t,m,{angle:Y,adjust:f},c)}class V extends R{inRange(e,n,o,r){const i=this.options.rotation,s=this.options.borderWidth;if(o!=="x"&&o!=="y")return Pn({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-D&&h[o]<=f.end+u+D}getCenterPoint(e){return E(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=k(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 Pn(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 R{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 E(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=k(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 R{inRange(e,n,o,r){if(o!=="x"&&o!=="y")return this.options.radius>=.1&&this.elements.length>1&&Dn(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 E(this,e)}draw(e){const{elements:n,options:o}=this;e.save(),e.beginPath(),e.fillStyle=o.backgroundColor,W(e,o);const r=k(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 Dn(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},jn=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(En(t,l,d)),u=l.resolveElementProperties(t,c);u.skip=Tn(u),"elements"in u&&(Rn(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 Rn(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 jn)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 En(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(){kt("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=_n(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 _n(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?(je(n,r,"beforeDraw"),r.draw(t,e),je(n,r,"afterDraw")):r.draw(t,e)}const Hn=(t,e,n)=>{if(typeof t=="string")return t;const o=Number.parseInt(t.toString(),10);return o>999999?`${o/1e6}M`:o>999?`${o/1e3}k`:o};export{Bn as a,Hn as f};
6
+ */const Pe={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(Pe.modes[n.mode]||Pe.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,A=.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 kt(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-A&&t.x<=o+a+A,l=t.y>=n-a-A&&t.y<=r+a+A;return i==="x"?d:(i==="y"||d)&&l}function E(t,e){const{centerX:n,centerY:o}=t.getProps(["centerX","centerY"],e);return{x:n,y:o}}function Ct(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 k(t,e,n=!0){return typeof e=="number"?e:Ue(e)?(n?Ge(e):qe(e))*t:t}function Pt(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:X(t.x,e),y:X(t.y,e)}:(t=X(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 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,At=t=>isNaN(t)||t<=0,Dt=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 C(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:k(n.width,e.width),height:k(n.height,e.height)};const o=e.font,r=D(o)?o.map(d=>G(d)):[G(o)],i=e.textStrokeWidth,s=D(n)?n:[n],a=s.join()+Dt(r)+i+(t._measureText?"-spriting":"");return re.has(a)||re.set(a,Rt(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=C(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 jt(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=D(o)?o:[o],i=n.font,s=D(i)?i.map(u=>G(u)):[G(i)],a=n.color,d=D(a)?a:[a],l=Pt(e,n),c=e.y+n.textStrokeWidth/2;t.save(),t.textBaseline="middle",t.textAlign=n.textAlign,It(t,n)&&Et(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}At(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+=ke,t.lineTo(e+Math.sin(s)*o,n-Math.cos(s)*o),s+=ke,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+_)*l,d=Math.sin(s+_)*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+=_;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+=_;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+=_,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 Rt(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 Et(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=Ce(t)?t:e;return Ce(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 j(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[j(o,e,"xScaleID")],i=o[j(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[j(n,e,"xScaleID")],r=n[j(n,e,"yScaleID")];if(!o&&!r)return{};let{left:i,right:s}=o||t.chartArea,{top:a,bottom:d}=r||t.chartArea;const l=Ae(o,{min:e.xMin,max:e.xMax,start:i,end:s});i=l.start,s=l.end;const c=Ae(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 _t(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?zt(r,i,e):Xt(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 _t(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 Ae(t,e){const n=et(t,e)||e;return{start:Math.min(n.start,n.end),end:Math.max(n.start,n.end)}}function zt(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 Xt(t,e,n){for(const o of Object.keys(ve)){const r=t[j(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=De(i,"leave",r,o);return De(i,"enter",o,r)||s}function De({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 je(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=j(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:X(e.min,Number.NEGATIVE_INFINITY),max:X(e.max,Number.POSITIVE_INFINITY)};for(const a of n)a.scaleID===r?Te(a,e,["value","endValue"],s):j(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 R{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 E(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 R{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 E(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),jt(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(),!C(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+k(i,a)},c={x:l.x+d,y:l.y}):(l={x:n.x+k(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=k(s,y),Y=k(a,y),g=[n,n+x,n+x,r],m=[o+Y,i,o,i],P=[];for(let v=0;v<4;v++){const ne=I({x:g[v],y:m[v]},h,w(f));P.push({position:st[v],distance:fe(ne,{x:d,y:l})})}return P.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,Re=(t,e,n)=>Se(e,n,Math.abs((t-e.x)/(n.x-e.x))).y,z=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},Ee=(t,e,n,o)=>(1-o)*(1-o)*t+2*(1-o)*o*e+o*o*n,ae=(t,e,n,o)=>({x:Ee(t.x,e.x,n.x,o),y:Ee(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 R{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){C(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=z(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 E(this,e)}draw(e){const{x:n,y:o,x2:r,y2:i,cp:s,options:a}=this;if(e.save(),!C(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 Cn(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=kn(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 _e({x:t,y:e},n,{top:o,right:r,bottom:i,left:s}){return t<s&&(e=Re(s,{x:t,y:e},n),t=s),t>r&&(e=Re(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}=_e(t,e,n),{x:i,y:s}=_e(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=A,r){const{x:i,y:s,x2:a,y2:d}=t.getProps(["x","y","x2","y2"],r),l=a-i,c=d-s,u=z(l)+z(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),z(e-h)+z(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=Xe(y.x,x)+a,m=Xe(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=ze({w:t.x2-t.x,h:t.y2-t.y},n,e,i):e.position==="end"?r=1-ze({w:t.x-t.x2,h:t.y-t.y2},n,e,i):r=be(1,e.position),r}function ze(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 Xe(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),C(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 kn(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+k(n,c.x,!1),y:d+k(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 Cn(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),P=new Path2D;t.beginPath(),P.moveTo(g.x,g.y),P.quadraticCurveTo(n.x,n.y,m.x,m.y),t.shadowColor=d.borderShadowColor,t.stroke(P),e.path=P,e.ctx=t,He(t,g,{angle:x,adjust:u},l),He(t,m,{angle:Y,adjust:f},c)}class V extends R{inRange(e,n,o,r){const i=this.options.rotation,s=this.options.borderWidth;if(o!=="x"&&o!=="y")return Pn({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-A&&h[o]<=f.end+u+A}getCenterPoint(e){return E(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=C(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 Pn(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 R{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 kt({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 E(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=C(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 R{inRange(e,n,o,r){if(o!=="x"&&o!=="y")return this.options.radius>=.1&&this.elements.length>1&&An(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 E(this,e)}draw(e){const{elements:n,options:o}=this;e.save(),e.beginPath(),e.fillStyle=o.backgroundColor,W(e,o);const r=C(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 An(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 Dn={update:Object.assign},jn=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(En(t,l,d)),u=l.resolveElementProperties(t,c);u.skip=Tn(u),"elements"in u&&(Rn(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"?Dn:new mt(t,e)}function Rn(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 jn)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)&&D(i)?n[o]=i.map(s=>Ne(s,r)):n[o]=Ne(i,r)}return n}function En(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(){Ct("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))}):D(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=_n(i.visibleElements,e).sort((a,d)=>a.element.options.z-d.element.options.z);for(const a of s)zn(o,r,i,a);n&&ht(o)}function _n(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 zn(t,e,n,o){const r=o.element;o.main?(je(n,r,"beforeDraw"),r.draw(t,e),je(n,r,"afterDraw")):r.draw(t,e)}const Hn=(t,e,n)=>{if(typeof t=="string")return t;const o=Number.parseInt(t.toString(),10);return o>999999?`${o/1e6}M`:o>999?`${o/1e3}k`:o};export{Bn as a,Hn as f};