unleash-server 7.5.0 → 7.5.2

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 (229) hide show
  1. package/dist/lib/addons/addon.d.ts +10 -2
  2. package/dist/lib/addons/addon.d.ts.map +1 -1
  3. package/dist/lib/addons/addon.js +104 -6
  4. package/dist/lib/addons/addon.js.map +1 -1
  5. package/dist/lib/addons/datadog-definition.js +1 -1
  6. package/dist/lib/addons/datadog-definition.js.map +1 -1
  7. package/dist/lib/addons/datadog.test.js +2 -0
  8. package/dist/lib/addons/datadog.test.js.map +1 -1
  9. package/dist/lib/addons/new-relic.d.ts.map +1 -1
  10. package/dist/lib/addons/new-relic.js +0 -1
  11. package/dist/lib/addons/new-relic.js.map +1 -1
  12. package/dist/lib/addons/new-relic.test.js +0 -1
  13. package/dist/lib/addons/new-relic.test.js.map +1 -1
  14. package/dist/lib/addons/slack.test.js +1 -2
  15. package/dist/lib/addons/slack.test.js.map +1 -1
  16. package/dist/lib/addons/teams.d.ts.map +1 -1
  17. package/dist/lib/addons/teams.js +0 -1
  18. package/dist/lib/addons/teams.js.map +1 -1
  19. package/dist/lib/addons/teams.test.js +0 -1
  20. package/dist/lib/addons/teams.test.js.map +1 -1
  21. package/dist/lib/addons/validate-url.d.ts +18 -0
  22. package/dist/lib/addons/validate-url.d.ts.map +1 -0
  23. package/dist/lib/addons/validate-url.js +93 -0
  24. package/dist/lib/addons/validate-url.js.map +1 -0
  25. package/dist/lib/addons/validate-url.test.d.ts +2 -0
  26. package/dist/lib/addons/validate-url.test.d.ts.map +1 -0
  27. package/dist/lib/addons/validate-url.test.js +199 -0
  28. package/dist/lib/addons/validate-url.test.js.map +1 -0
  29. package/dist/lib/create-config.d.ts.map +1 -1
  30. package/dist/lib/create-config.js +7 -0
  31. package/dist/lib/create-config.js.map +1 -1
  32. package/dist/lib/error/bad-data-error.d.ts.map +1 -1
  33. package/dist/lib/error/bad-data-error.js +10 -2
  34. package/dist/lib/error/bad-data-error.js.map +1 -1
  35. package/dist/lib/error/unleash-error.test.js +23 -0
  36. package/dist/lib/error/unleash-error.test.js.map +1 -1
  37. package/dist/lib/features/client-feature-toggles/delta/client-feature-toggle-delta.d.ts +3 -0
  38. package/dist/lib/features/client-feature-toggles/delta/client-feature-toggle-delta.d.ts.map +1 -1
  39. package/dist/lib/features/client-feature-toggles/delta/client-feature-toggle-delta.js +50 -1
  40. package/dist/lib/features/client-feature-toggles/delta/client-feature-toggle-delta.js.map +1 -1
  41. package/dist/lib/features/events/event-store.d.ts +4 -0
  42. package/dist/lib/features/events/event-store.d.ts.map +1 -1
  43. package/dist/lib/features/events/event-store.js +62 -1
  44. package/dist/lib/features/events/event-store.js.map +1 -1
  45. package/dist/lib/features/feature-toggle/fakes/fake-features-read-model.d.ts +4 -1
  46. package/dist/lib/features/feature-toggle/fakes/fake-features-read-model.d.ts.map +1 -1
  47. package/dist/lib/features/feature-toggle/fakes/fake-features-read-model.js +5 -1
  48. package/dist/lib/features/feature-toggle/fakes/fake-features-read-model.js.map +1 -1
  49. package/dist/lib/features/feature-toggle/feature-toggle-service.d.ts.map +1 -1
  50. package/dist/lib/features/feature-toggle/feature-toggle-service.js +4 -0
  51. package/dist/lib/features/feature-toggle/feature-toggle-service.js.map +1 -1
  52. package/dist/lib/features/feature-toggle/features-read-model.d.ts +2 -1
  53. package/dist/lib/features/feature-toggle/features-read-model.d.ts.map +1 -1
  54. package/dist/lib/features/feature-toggle/features-read-model.js +10 -2
  55. package/dist/lib/features/feature-toggle/features-read-model.js.map +1 -1
  56. package/dist/lib/features/feature-toggle/tests/feature-toggle-service.e2e.test.js +17 -0
  57. package/dist/lib/features/feature-toggle/tests/feature-toggle-service.e2e.test.js.map +1 -1
  58. package/dist/lib/features/feature-toggle/tests/features-read-model.e2e.test.d.ts +2 -0
  59. package/dist/lib/features/feature-toggle/tests/features-read-model.e2e.test.d.ts.map +1 -0
  60. package/dist/lib/features/feature-toggle/tests/features-read-model.e2e.test.js +44 -0
  61. package/dist/lib/features/feature-toggle/tests/features-read-model.e2e.test.js.map +1 -0
  62. package/dist/lib/features/feature-toggle/types/features-read-model-type.d.ts +1 -0
  63. package/dist/lib/features/feature-toggle/types/features-read-model-type.d.ts.map +1 -1
  64. package/dist/lib/features/frontend-api/frontend-api-controller.d.ts.map +1 -1
  65. package/dist/lib/features/frontend-api/frontend-api-controller.js +3 -2
  66. package/dist/lib/features/frontend-api/frontend-api-controller.js.map +1 -1
  67. package/dist/lib/features/instance-stats/instance-stats-service.d.ts.map +1 -1
  68. package/dist/lib/features/instance-stats/instance-stats-service.js +2 -6
  69. package/dist/lib/features/instance-stats/instance-stats-service.js.map +1 -1
  70. package/dist/lib/features/metrics/instance/metrics.d.ts.map +1 -1
  71. package/dist/lib/features/metrics/instance/metrics.js +5 -2
  72. package/dist/lib/features/metrics/instance/metrics.js.map +1 -1
  73. package/dist/lib/features/metrics/instance/register.d.ts.map +1 -1
  74. package/dist/lib/features/metrics/instance/register.js +3 -1
  75. package/dist/lib/features/metrics/instance/register.js.map +1 -1
  76. package/dist/lib/features/release-plans/release-plan-milestone-strategy-service.d.ts +4 -3
  77. package/dist/lib/features/release-plans/release-plan-milestone-strategy-service.d.ts.map +1 -1
  78. package/dist/lib/features/release-plans/release-plan-milestone-strategy-store.d.ts.map +1 -1
  79. package/dist/lib/features/release-plans/release-plan-milestone-strategy-store.js +5 -2
  80. package/dist/lib/features/release-plans/release-plan-milestone-strategy-store.js.map +1 -1
  81. package/dist/lib/features/release-plans/release-plan-milestone-strategy.d.ts +1 -0
  82. package/dist/lib/features/release-plans/release-plan-milestone-strategy.d.ts.map +1 -1
  83. package/dist/lib/features/release-plans/release-plan-store.d.ts.map +1 -1
  84. package/dist/lib/features/release-plans/release-plan-store.js +7 -4
  85. package/dist/lib/features/release-plans/release-plan-store.js.map +1 -1
  86. package/dist/lib/features/release-plans/release-plan-template-store.d.ts.map +1 -1
  87. package/dist/lib/features/release-plans/release-plan-template-store.js +2 -1
  88. package/dist/lib/features/release-plans/release-plan-template-store.js.map +1 -1
  89. package/dist/lib/metrics.d.ts.map +1 -1
  90. package/dist/lib/metrics.js +1 -6
  91. package/dist/lib/metrics.js.map +1 -1
  92. package/dist/lib/middleware/bearer-token-middleware.test.js +12 -10
  93. package/dist/lib/middleware/bearer-token-middleware.test.js.map +1 -1
  94. package/dist/lib/openapi/spec/export-result-schema.d.ts +96 -0
  95. package/dist/lib/openapi/spec/export-result-schema.d.ts.map +1 -1
  96. package/dist/lib/openapi/spec/feature-environment-schema.d.ts +24 -0
  97. package/dist/lib/openapi/spec/feature-environment-schema.d.ts.map +1 -1
  98. package/dist/lib/openapi/spec/feature-schema.d.ts +48 -0
  99. package/dist/lib/openapi/spec/feature-schema.d.ts.map +1 -1
  100. package/dist/lib/openapi/spec/feature-search-environment-schema.d.ts +48 -0
  101. package/dist/lib/openapi/spec/feature-search-environment-schema.d.ts.map +1 -1
  102. package/dist/lib/openapi/spec/feature-search-response-schema.d.ts +48 -0
  103. package/dist/lib/openapi/spec/feature-search-response-schema.d.ts.map +1 -1
  104. package/dist/lib/openapi/spec/health-overview-schema.d.ts +96 -0
  105. package/dist/lib/openapi/spec/health-overview-schema.d.ts.map +1 -1
  106. package/dist/lib/openapi/spec/health-report-schema.d.ts +96 -0
  107. package/dist/lib/openapi/spec/health-report-schema.d.ts.map +1 -1
  108. package/dist/lib/openapi/spec/index.d.ts +1 -0
  109. package/dist/lib/openapi/spec/index.d.ts.map +1 -1
  110. package/dist/lib/openapi/spec/index.js +1 -0
  111. package/dist/lib/openapi/spec/index.js.map +1 -1
  112. package/dist/lib/openapi/spec/profile-schema.d.ts +48 -0
  113. package/dist/lib/openapi/spec/profile-schema.d.ts.map +1 -1
  114. package/dist/lib/openapi/spec/project-overview-schema.d.ts +96 -0
  115. package/dist/lib/openapi/spec/project-overview-schema.d.ts.map +1 -1
  116. package/dist/lib/openapi/spec/release-plan-milestone-schema.d.ts +6 -0
  117. package/dist/lib/openapi/spec/release-plan-milestone-schema.d.ts.map +1 -1
  118. package/dist/lib/openapi/spec/release-plan-milestone-strategy-schema.d.ts +6 -0
  119. package/dist/lib/openapi/spec/release-plan-milestone-strategy-schema.d.ts.map +1 -1
  120. package/dist/lib/openapi/spec/release-plan-milestone-strategy-schema.js +6 -2
  121. package/dist/lib/openapi/spec/release-plan-milestone-strategy-schema.js.map +1 -1
  122. package/dist/lib/openapi/spec/release-plan-schema.d.ts +12 -0
  123. package/dist/lib/openapi/spec/release-plan-schema.d.ts.map +1 -1
  124. package/dist/lib/openapi/spec/release-plan-template-schema.d.ts +12 -0
  125. package/dist/lib/openapi/spec/release-plan-template-schema.d.ts.map +1 -1
  126. package/dist/lib/openapi/spec/release-plans-schema.d.ts +3337 -0
  127. package/dist/lib/openapi/spec/release-plans-schema.d.ts.map +1 -0
  128. package/dist/lib/openapi/spec/release-plans-schema.js +35 -0
  129. package/dist/lib/openapi/spec/release-plans-schema.js.map +1 -0
  130. package/dist/lib/openapi/spec/search-features-schema.d.ts +96 -0
  131. package/dist/lib/openapi/spec/search-features-schema.d.ts.map +1 -1
  132. package/dist/lib/routes/admin-api/user-admin.d.ts.map +1 -1
  133. package/dist/lib/routes/admin-api/user-admin.js +3 -2
  134. package/dist/lib/routes/admin-api/user-admin.js.map +1 -1
  135. package/dist/lib/routes/auth/simple-password-provider.d.ts.map +1 -1
  136. package/dist/lib/routes/auth/simple-password-provider.js +2 -1
  137. package/dist/lib/routes/auth/simple-password-provider.js.map +1 -1
  138. package/dist/lib/routes/util.d.ts.map +1 -1
  139. package/dist/lib/routes/util.js +9 -6
  140. package/dist/lib/routes/util.js.map +1 -1
  141. package/dist/lib/routes/util.test.d.ts +2 -0
  142. package/dist/lib/routes/util.test.d.ts.map +1 -0
  143. package/dist/lib/routes/util.test.js +18 -0
  144. package/dist/lib/routes/util.test.js.map +1 -0
  145. package/dist/lib/server-impl.d.ts +5 -2
  146. package/dist/lib/server-impl.d.ts.map +1 -1
  147. package/dist/lib/server-impl.js +3 -1
  148. package/dist/lib/server-impl.js.map +1 -1
  149. package/dist/lib/services/addon-service.d.ts +6 -1
  150. package/dist/lib/services/addon-service.d.ts.map +1 -1
  151. package/dist/lib/services/addon-service.js +16 -1
  152. package/dist/lib/services/addon-service.js.map +1 -1
  153. package/dist/lib/services/addon-service.test.js +10 -8
  154. package/dist/lib/services/addon-service.test.js.map +1 -1
  155. package/dist/lib/types/experimental.d.ts +1 -1
  156. package/dist/lib/types/experimental.d.ts.map +1 -1
  157. package/dist/lib/types/experimental.js +1 -2
  158. package/dist/lib/types/experimental.js.map +1 -1
  159. package/dist/lib/types/model.d.ts +3 -4
  160. package/dist/lib/types/model.d.ts.map +1 -1
  161. package/dist/lib/types/model.js.map +1 -1
  162. package/dist/lib/types/option.d.ts +4 -0
  163. package/dist/lib/types/option.d.ts.map +1 -1
  164. package/dist/lib/types/stores/event-store.d.ts +4 -0
  165. package/dist/lib/types/stores/event-store.d.ts.map +1 -1
  166. package/dist/lib/util/extract-user.d.ts +3 -0
  167. package/dist/lib/util/extract-user.d.ts.map +1 -1
  168. package/dist/lib/util/extract-user.js +4 -1
  169. package/dist/lib/util/extract-user.js.map +1 -1
  170. package/dist/server-dev.js +0 -1
  171. package/dist/server-dev.js.map +1 -1
  172. package/dist/test/e2e/api/admin/addon.e2e.test.js +1 -0
  173. package/dist/test/e2e/api/admin/addon.e2e.test.js.map +1 -1
  174. package/dist/test/e2e/services/addon-service.e2e.test.js +2 -0
  175. package/dist/test/e2e/services/addon-service.e2e.test.js.map +1 -1
  176. package/dist/test/e2e/stores/event-store.e2e.test.js +140 -2
  177. package/dist/test/e2e/stores/event-store.e2e.test.js.map +1 -1
  178. package/dist/test/fixtures/fake-event-store.d.ts +4 -0
  179. package/dist/test/fixtures/fake-event-store.d.ts.map +1 -1
  180. package/dist/test/fixtures/fake-event-store.js +6 -0
  181. package/dist/test/fixtures/fake-event-store.js.map +1 -1
  182. package/frontend/build/index.html +1 -1
  183. package/frontend/build/static/AdvancedPlayground-CF0hkpiE.js +3 -0
  184. package/frontend/build/static/BackendConnections-DhZczar-.js +1 -0
  185. package/frontend/build/static/{CreateProject-DLXZ-0X5.js → CreateProject-DV-Ad8Sn.js} +1 -1
  186. package/frontend/build/static/{EnterpriseEdge-CBHzLvsx.js → EnterpriseEdge-D1To2ugP.js} +2 -2
  187. package/frontend/build/static/{FeatureMetricsChart-OmbUYN9n.js → FeatureMetricsChart-D8sRgx5P.js} +2 -2
  188. package/frontend/build/static/FeatureStaleDialog-DOkhgvaj.js +7 -0
  189. package/frontend/build/static/{FeatureViewLazyExport-JSvPNdBO.js → FeatureViewLazyExport-Bsw7-knb.js} +5 -5
  190. package/frontend/build/static/{FlagMetricsChart-D_AVQDU4.js → FlagMetricsChart-CF_kEyQa.js} +2 -2
  191. package/frontend/build/static/FrontendNetworkTrafficUsage-C8zJSvoc.js +1 -0
  192. package/frontend/build/static/GridLayoutWrapper-DpJcUbQB.js +3 -0
  193. package/frontend/build/static/{ImpactMetricsPage-PgSyQayh.js → ImpactMetricsPage-KLVv-tP4.js} +1 -1
  194. package/frontend/build/static/{LazyAdminExport-BYVn1j-Y.js → LazyAdminExport-CWQiknO-.js} +12 -12
  195. package/frontend/build/static/{LazyProjectExport-DkfLitTN.js → LazyProjectExport-DsMn4Yxm.js} +25 -25
  196. package/frontend/build/static/LifecycleChartComponent-cxR-TN3V.js +7 -0
  197. package/frontend/build/static/LineChartComponent-_yZEp3dd.js +1 -0
  198. package/frontend/build/static/{MarkCompletedDialogue-CkeYSNgH.js → MarkCompletedDialogue-DFtLyDN0.js} +1 -1
  199. package/frontend/build/static/{NetworkOverview-BQlqnxzn.js → NetworkOverview-DxaPXUzZ.js} +1 -1
  200. package/frontend/build/static/{NetworkPrometheusAPIWarning-Ba6dYYvk.js → NetworkPrometheusAPIWarning-ltyTlXFF.js} +1 -1
  201. package/frontend/build/static/{NetworkTraffic-p3aQqm31.js → NetworkTraffic-Dhw4yIBs.js} +1 -1
  202. package/frontend/build/static/{NetworkTrafficUsage-y1jnkey9.js → NetworkTrafficUsage-deKWRhIS.js} +1 -1
  203. package/frontend/build/static/{PercentageDonut-WlMbDfDd.js → PercentageDonut-JGNh2FVZ.js} +1 -1
  204. package/frontend/build/static/ReactJSONEditor-GHl7KvdS.js +3864 -0
  205. package/frontend/build/static/{RoleCell-BtYhy-KF.js → RoleCell-CjVCxBgl.js} +1 -1
  206. package/frontend/build/static/{aggregateFeatureMetrics-DqOEKfDa.js → aggregateFeatureMetrics-YEdZNNoV.js} +1 -1
  207. package/frontend/build/static/formatTickValue-BZb4ZIL9.js +6 -0
  208. package/frontend/build/static/heart-FRDdnX3J.svg +3 -0
  209. package/frontend/build/static/index-DMSjiFEm.js +583 -0
  210. package/frontend/build/static/index-DcWBU_a4.js +12 -0
  211. package/frontend/build/static/networkTrafficUsageHighlightPlugin-BbfAyDiQ.js +1 -0
  212. package/frontend/build/static/texture-signup-CpC2AFD3.png +0 -0
  213. package/frontend/build/static/{useApiTokens-BnZdG9it.js → useApiTokens-DBB3NvXL.js} +1 -1
  214. package/frontend/package.json +14 -9
  215. package/package.json +47 -47
  216. package/frontend/build/static/AdvancedPlayground-Bh4g1c_w.js +0 -3
  217. package/frontend/build/static/BackendConnections-BwktKdeU.js +0 -1
  218. package/frontend/build/static/FeatureStaleDialog-Ckz7F5lw.js +0 -7
  219. package/frontend/build/static/FrontendNetworkTrafficUsage-BXS05ybi.js +0 -1
  220. package/frontend/build/static/GridLayoutWrapper-CyXfGdie.js +0 -3
  221. package/frontend/build/static/LifecycleChartComponent-Clq_uGBn.js +0 -7
  222. package/frontend/build/static/LineChartComponent-kHzkQRMt.js +0 -1
  223. package/frontend/build/static/ReactJSONEditor-CD6u2VLM.js +0 -89
  224. package/frontend/build/static/formatTickValue-Ca6X6Ivj.js +0 -6
  225. package/frontend/build/static/index-Bj8wwcOa.js +0 -11
  226. package/frontend/build/static/index-CiWHTkEm.js +0 -580
  227. package/frontend/build/static/networkTrafficUsageHighlightPlugin-Y95iEJUb.js +0 -1
  228. package/frontend/build/static/unleash_logo_dark_no_label-DHgOj_XN.svg +0 -6
  229. package/frontend/build/static/unleash_logo_white_no_label-BazgWvcx.svg +0 -6
@@ -1 +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 L,af as q,eK as A,y as he,D as pe,g5 as V,dq as Y,ba as y,eI as xe,eJ as me,ae as je,k as J,T as v,aj as ge,dA as fe,am as be,C as b,B as g,ax as ye,an as Te,aw as K,de as B,br as Ce,eY as ke,bf as Ae,jj as ve,L as Q,eO as we,ai as w,ci as D,eP as E,at as Se,F as Ee,H as Ne,ah as G,fL as Re,al as N,eD as Ie,f3 as De,aa as C,ab as Ue,cM as X,b1 as Le,aV as Z,i as Be,I as Pe,G as _e,ay as ee,c7 as R,i7 as Fe,e4 as Me,e3 as Oe,en as He,ej as $e,fx as Ke,eh as Ge,fy as We,h7 as ze,cs as qe,b7 as te,b9 as se,b8 as Ve,b6 as Ye,b2 as Je,ed as Qe}from"./index-CiWHTkEm.js";import{u as Xe}from"./useApiTokens-BnZdG9it.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}=L(),o=r=>()=>{Y(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(J,{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(B,{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}=Xe(),{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(B,{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}=L(),a=l=>{Y(l)&&(r({type:"success",text:"Token copied to clipboard"}),o&&typeof o=="function"&&o())};return e.jsx(X,{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}=L(),i=async()=>{try{await n(),a(!1),l({type:"success",text:"API token removed"})}catch(j){u(Be(j))}};return e.jsxs(e.Fragment,{children:[e.jsx(X,{permission:s,projectId:o,tooltipProps:{title:"Delete token",arrow:!0},onClick:()=>a(!0),size:"large",children:e.jsx(Le,{})}),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(J)(({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(B,{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()),Yt=()=>{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(Ye)(()=>({display:"block"})),Jt=({role:t,roles:s,value:n})=>{const{isEnterprise:o}=y();if(o()){const r=s||[t];return e.jsx(w,{children:e.jsx(Je,{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,Yt as g,Vt as h,Jt as i,ne as j,wt as m,Mt as u};
1
+ import{aE as ae,aF as le,r as d,aI as ie,_ as ce,a as $,j as e,aJ as de,aL as ue,s as c,R as D,f as B,af as V,ew as v,x as he,y as pe,fU as q,dc as X,ba as y,eu as xe,ev as me,ae as je,k as Y,aj as ge,dm as be,am as fe,C as f,B as g,av as ye,an as Te,aw as K,cV as L,T as A,br as Ce,eL as ke,j8 as ve,bg as Ae,eB as we,ai as w,ci as U,eC as E,as as Se,L as J,F as Ee,H as Ne,ah as G,fy as Re,ak as N,eq as Ie,eS as Ue,aa as C,ab as De,d4 as Q,b0 as Be,aV as Z,i as Le,z as Pe,G as _e,ay as ee,c7 as R,hX as Fe,dT as Me,dS as He,ea as Oe,e6 as $e,fk as Ke,e4 as Ge,fl as We,gV as ze,cA as Ve,b7 as te,b9 as se,b8 as qe,b1 as Xe,e0 as Ye,b5 as Je}from"./index-DMSjiFEm.js";import{u as Qe}from"./useApiTokens-DBB3NvXL.js";function Ze(t){return ae("MuiTableContainer",t)}le("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(D,{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(V,{children:[e.jsx(v,{component:"th",scope:"row",children:t}),e.jsx(v,{children:e.jsx("pre",{style:{display:"inline"},children:s})}),e.jsx(v,{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(q,{})})})})]})},I=c(v)(({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(V,{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(A)(({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(be.breakpoints.down("xl"));return fe([{condition:i,columns:at},{condition:t,columns:lt}],s,n),e.jsxs(e.Fragment,{children:[e.jsx(f,{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(f,{condition:r.length===0&&!o,show:e.jsx(f,{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}=Qe(),{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(J)(({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(U,{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(U,{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(U,{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:Ue,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:b}=C.useTable({columns:o,data:t,initialState:n,sortTypes:De,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:b,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"}},Ht=({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(Q,{permission:n,projectId:s,tooltipProps:{title:"Copy token",arrow:!0},onClick:()=>a(t.secret),size:"large",children:e.jsx(q,{})})},bt=c("ul")({marginBottom:0}),Ot=({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(Q,{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(bt,{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})]})]})]})})]})},ft=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)})),vt=c(Y)(({theme:t})=>({marginLeft:t.spacing(3)})),At=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(f,{condition:a,show:e.jsxs(D,{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(At,{children:[s,e.jsx(vt,{onClick:o,children:"Cancel"})]})]})};var x=(t=>(t.ADMIN="ADMIN",t.CLIENT="CLIENT",t.FRONTEND="FRONTEND",t))(x||{});const Kt=t=>{var M,H;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(He)||o}],a=(H=r.find(h=>h.enabled))==null?void 0:H.key,[l,u]=d.useState(""),[i,j]=d.useState(a||x.CLIENT),[m,b]=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),b(["*"]),T("*")):(j(h),b(p),T(n))},setProjects:b,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 O={...F};delete O[h],S(O)}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(A,{variant:"body1",children:"Your new token has been created successfully."}),e.jsx(Oe,{token:o}),e.jsx(f,{condition:r===x.FRONTEND,show:e.jsxs(D,{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(J,{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(ft,{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(A,{children:r}),e.jsx(A,{variant:"body2",color:"text.secondary",children:a})]})})},o))})]})}),Vt=({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})),qt=t=>{const{data:s,error:n,mutate:o}=Ve(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}=qe(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(Je)(()=>({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(Xe,{tooltip:e.jsx(Nt,{children:r.map(a=>e.jsx(Ye,{roleId:a,tooltip:!0},a))}),children:e.jsx(Rt,{children:n})})})}return e.jsx(w,{children:n})};export{_t as A,Ft as C,Vt as E,Ot as R,oe as S,x as T,Ht as a,Kt as b,$t as c,Wt as d,zt as e,Gt as f,Xt as g,qt 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,cs 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-CiWHTkEm.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{j as n,aV as f,s as m,L as g,b7 as d,cA as y,r as p,bb as v,b9 as b,ap as x,ba as k,h as E,G as F}from"./index-DMSjiFEm.js";const M=m(g)(({theme:a})=>({textDecoration:"none",color:a.palette.primary.main,fontWeight:a.fontWeight.bold})),j=({isOpen:a,onClose:s,features:e,project:t})=>n.jsxs(f,{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,()=>A(e)),i=p.useCallback(()=>{v(L).catch(console.warn)},[]);return{featureMetrics:t==null?void 0:t.data,loading:!r&&!t,refetchFeatureMetrics:i,error:r}},A=a=>fetch(a).then(b("Features")).then(s=>s.json()).then(),R=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,...w]:u,c=l.map(o=>Number(o.key)).includes(a)?a:R;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"}],w=[{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,R as a,C as b,$ as c,U as u};
@@ -0,0 +1,6 @@
1
+ import{jD as ct,jW as E,jX as w,jY as p,jE as Q,jZ as fe,j_ as b,j$ as ut,k0 as ft,k1 as A,jC as K,jz as he,k2 as $e,k3 as Me,k4 as Ve,jx as B,jB as z,k5 as ht,k6 as _,k7 as J,k8 as Pe,k9 as yt,dC as oe,ka as bt,kb as gt,kc as T,kd as mt}from"./index-DMSjiFEm.js";/*!
2
+ * chartjs-plugin-annotation v2.2.1
3
+ * https://www.chartjs.org/chartjs-plugin-annotation/index
4
+ * (c) 2023 chartjs-plugin-annotation Contributors
5
+ * Released under the MIT License
6
+ */const ke={modes:{point(t,e){return q(t,e,{intersect:!0})},nearest(t,e,n){return xt(t,e,n)},x(t,e,n){return q(t,e,{intersect:n.intersect,axis:"x"})},y(t,e,n){return q(t,e,{intersect:n.intersect,axis:"y"})}}};function ye(t,e,n){return(ke.modes[n.mode]||ke.modes.nearest)(t,e,n)}function pt(t,e,n){return n!=="x"&&n!=="y"?t.inRange(e.x,e.y,"x",!0)||t.inRange(e.x,e.y,"y",!0):t.inRange(e.x,e.y,n,!0)}function wt(t,e,n){return n==="x"?{x:t.x,y:e.y}:n==="y"?{x:e.x,y:t.y}:e}function q(t,e,n){return t.visibleElements.filter(o=>n.intersect?o.inRange(e.x,e.y):pt(o,e,n.axis))}function xt(t,e,n){let o=Number.POSITIVE_INFINITY;return q(t,e,n).reduce((r,i)=>{const s=i.getCenterPoint(),a=wt(e,s,n.axis),d=fe(e,a);return d<o?(r=[i],o=d):d===o&&r.push(i),r},[]).sort((r,i)=>r._index-i._index).slice(0,1)}const St=(t,e)=>e>t||t.length>e.length&&t.slice(0,e.length)===e,D=.001,F=(t,e,n)=>Math.min(n,Math.max(e,t));function Ct(t,e,n){for(const o of Object.keys(t))t[o]=F(t[o],e,n);return t}function Mt(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 R(t,e){const{centerX:n,centerY:o}=t.getProps(["centerX","centerY"],e);return{x:n,y:o}}function Pt(t,e,n,o=!0){const r=n.split(".");let i=0;for(const s of e.split(".")){const a=r[i++];if(parseInt(s,10)<parseInt(a,10))break;if(St(a,s)){if(o)throw new Error(`${t} v${n} is not supported. v${e} or newer is required.`);return!1}}return!0}const Ue=t=>typeof t=="string"&&t.endsWith("%"),qe=t=>parseFloat(t)/100,Ke=t=>F(qe(t),0,1);function be(t,e){return e==="start"?0:e==="end"?t:Ue(e)?Ke(e)*t:t/2}function M(t,e,n=!0){return typeof e=="number"?e:Ue(e)?(n?Ke(e):qe(e))*t:t}function kt(t,e){const{x:n,width:o}=t,r=e.textAlign;return r==="center"?n+o/2:r==="end"||r==="right"?n+o:n}function ge(t,e="center"){return B(t)?{x: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 P(t,e){if(e&&e.borderWidth)return t.lineCap=e.borderCapStyle,t.setLineDash(e.borderDash),t.lineDashOffset=e.borderDashOffset,t.lineJoin=e.borderJoinStyle,t.lineWidth=e.borderWidth,t.strokeStyle=e.borderColor,!0}function W(t,e){t.shadowColor=e.backgroundShadowColor,t.shadowBlur=e.shadowBlur,t.shadowOffsetX=e.shadowOffsetX,t.shadowOffsetY=e.shadowOffsetY}function pe(t,e){const n=e.content;if(Z(n))return{width:M(n.width,e.width),height:M(n.height,e.height)};const o=e.font,r=A(o)?o.map(d=>K(d)):[K(o)],i=e.textStrokeWidth,s=A(n)?n:[n],a=s.join()+At(r)+i+(t._measureText?"-spriting":"");return re.has(a)||re.set(a,Et(t,s,r,i)),re.get(a)}function Ze(t,e,n){const{x:o,y:r,width:i,height:s}=e;t.save(),W(t,n);const a=P(t,n);t.fillStyle=n.backgroundColor,t.beginPath(),ut(t,{x:o,y:r,w:i,h:s,radius:Ct(ft(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=kt(e,n),c=e.y+n.textStrokeWidth/2;t.save(),t.textBaseline="middle",t.textAlign=n.textAlign,It(t,n)&&Rt(t,{x:l,y:c},r,s),Wt(t,{x:l,y:c},r,{fonts:s,colors:d}),t.restore()}function It(t,e){if(e.textStrokeWidth>0)return t.lineJoin="round",t.miterLimit=2,t.lineWidth=e.textStrokeWidth,t.strokeStyle=e.textStrokeColor,!0}function Tt(t,e,n,o){const{radius:r,options:i}=e,s=i.pointStyle,a=i.rotation;let d=(a||0)*$e;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,yt),t.closePath();break;case"triangle":t.moveTo(e+Math.sin(s)*o,n-Math.cos(s)*o),s+=Pe,t.lineTo(e+Math.sin(s)*o,n-Math.cos(s)*o),s+=Pe,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 Et(t,e,n,o){t.save();const r=e.length;let i=0,s=o;for(let a=0;a<r;a++){const d=n[Math.min(a,n.length-1)];t.font=d.string;const l=e[a];i=Math.max(i,t.measureText(l).width+o),s+=d.lineHeight}return t.restore(),{width:i,height:s}}function Rt(t,{x:e,y:n},o,r){t.beginPath();let i=0;o.forEach(function(s,a){const d=r[Math.min(a,r.length-1)],l=d.lineHeight;t.font=d.string,t.strokeText(s,e,n+l/2+i),i+=l}),t.stroke()}function Wt(t,{x:e,y:n},o,{fonts:r,colors:i}){let s=0;o.forEach(function(a,d){const l=i[Math.min(d,i.length-1)],c=r[Math.min(d,r.length-1)],u=c.lineHeight;t.beginPath(),t.font=c.string,t.fillStyle=l,t.fillText(a,e,n+u/2+s),s+=u,t.fill()})}function Lt(t,e){const n=Me(t)?t:e;return Me(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),Ve(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,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,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(Ve(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 E{inRange(e,n,o,r){const{x:i,y:s}=I({x:e,y:n},this.getCenterPoint(r),w(-this.options.rotation));return Je({x:i,y:s},this.getProps(["x","y","x2","y2"],r),o,this.options.borderWidth)}getCenterPoint(e){return R(this,e)}draw(e){e.save(),me(e,this.getCenterPoint(),this.options.rotation),Ze(e,this,this.options),e.restore()}get label(){return this.elements&&this.elements[0]}resolveElementProperties(e,n){return ot(e,n)}}L.id="boxAnnotation";L.defaults={adjustScaleRange:!0,backgroundShadowColor:"transparent",borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderRadius:0,borderShadowColor:"transparent",borderWidth:1,display:!0,init:void 0,label:{backgroundColor:"transparent",borderWidth:0,callout:{display:!1},color:"black",content:null,display:!1,drawTime:void 0,font:{family:void 0,lineHeight:void 0,size:void 0,style:void 0,weight:"bold"},height:void 0,opacity:void 0,padding:6,position:"center",rotation:void 0,textAlign:"start",textStrokeColor:void 0,textStrokeWidth:0,width:void 0,xAdjust:0,yAdjust:0,z:void 0},rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,xMax:void 0,xMin:void 0,xScaleID:void 0,yMax:void 0,yMin:void 0,yScaleID:void 0,z:0};L.defaultRoutes={borderColor:"color",backgroundColor:"color"};L.descriptors={label:{_fallback:!0}};const st=["left","bottom","top","right"];class N extends E{inRange(e,n,o,r){const{x:i,y:s}=I({x:e,y:n},this.getCenterPoint(r),w(-this.rotation));return Je({x:i,y:s},this.getProps(["x","y","x2","y2"],r),o,this.options.borderWidth)}getCenterPoint(e){return R(this,e)}draw(e){const n=this.options,o=!p(this._visible)||this._visible;!n.display||!n.content||!o||(e.save(),me(e,this.getCenterPoint(),this.rotation),nn(e,this),Ze(e,this,n),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(),!P(t,i))return t.restore();const{separatorStart:d,separatorEnd:l}=on(e,s),{sideStart:c,sideEnd:u}=sn(e,s,d);(i.margin>0||r.borderWidth===0)&&(t.moveTo(d.x,d.y),t.lineTo(l.x,l.y)),t.moveTo(c.x,c.y),t.lineTo(u.x,u.y);const f=I({x:n,y:o},e.getCenterPoint(),w(-e.rotation));t.lineTo(f.x,f.y),t.stroke(),t.restore()}function on(t,e){const{x:n,y:o,x2:r,y2:i}=t,s=rn(t,e);let a,d;return e==="left"||e==="right"?(a={x:n+s,y:o},d={x:a.x,y:i}):(a={x:n,y:o+s},d={x:r,y:a.y}),{separatorStart:a,separatorEnd:d}}function rn(t,e){const{width:n,height:o,options:r}=t,i=r.callout.margin+r.borderWidth/2;return e==="right"?n+i:e==="bottom"?o+i:-i}function sn(t,e,n){const{y:o,width:r,height:i,options:s}=t,a=s.callout.start,d=an(e,s.callout);let l,c;return e==="left"||e==="right"?(l={x:n.x,y:o+M(i,a)},c={x:l.x+d,y:l.y}):(l={x:n.x+M(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=M(s,y),Y=M(a,y),g=[n,n+x,n+x,r],m=[o+Y,i,o,i],k=[];for(let v=0;v<4;v++){const ne=I({x:g[v],y:m[v]},h,w(f));k.push({position:st[v],distance:fe(ne,{x:d,y:l})})}return k.sort((v,ne)=>v.distance-ne.distance)[0].position}function cn({x:t,y:e,width:n,height:o,options:r}){const i=r.borderWidth/2,s=Q(r.padding);return{x:t+s.left+i,y:e+s.top+i,width:n-s.left-s.right-r.borderWidth,height:o-s.top-s.bottom-r.borderWidth}}function un(t,e,n){const{pointX:o,pointY:r}=t,i=e.margin;let s=o,a=r;return n==="left"?s+=i:n==="right"?s-=i:n==="top"?a+=i:n==="bottom"&&(a-=i),t.inRange(s,a)}const Se=(t,e,n)=>({x:t.x+n*(e.x-t.x),y:t.y+n*(e.y-t.y)}),se=(t,e,n)=>Se(e,n,Math.abs((t-e.y)/(n.y-e.y))).x,Ee=(t,e,n)=>Se(e,n,Math.abs((t-e.x)/(n.x-e.x))).y,X=t=>t*t,fn=(t,e,{x:n,y:o,x2:r,y2:i},s)=>s==="y"?{start:Math.min(o,i),end:Math.max(o,i),value:e}:{start:Math.min(n,r),end:Math.max(n,r),value:t},Re=(t,e,n,o)=>(1-o)*(1-o)*t+2*(1-o)*o*e+o*o*n,ae=(t,e,n,o)=>({x:Re(t.x,e.x,n.x,o),y:Re(t.y,e.y,n.y,o)}),We=(t,e,n,o)=>2*(1-o)*(e-t)+2*o*(n-e),Le=(t,e,n,o)=>-Math.atan2(We(t.x,e.x,n.x,o),We(t.y,e.y,n.y,o))+.5*b;class $ extends E{inRange(e,n,o,r){const i=this.options.borderWidth/2;if(o!=="x"&&o!=="y"){const s={mouseX:e,mouseY:n},{path:a,ctx:d}=this;if(a){P(d,this.options);const{chart:c}=this.$context,u=e*c.currentDevicePixelRatio,f=n*c.currentDevicePixelRatio,h=d.isPointInStroke(a,u,f)||de(this,s,r);return d.restore(),h}const l=X(i);return gn(this,s,l,r)||de(this,s,r)}return hn(this,{mouseX:e,mouseY:n},o,{hBorderWidth:i,useFinalPosition:r})}getCenterPoint(e){return R(this,e)}draw(e){const{x:n,y:o,x2:r,y2:i,cp:s,options:a}=this;if(e.save(),!P(e,a))return e.restore();W(e,a);const d=Math.sqrt(Math.pow(r-n,2)+Math.pow(i-o,2));if(a.curve&&s)return Pn(e,this,s,d),e.restore();const{startOpts:l,endOpts:c,startAdjust:u,endAdjust:f}=at(this),h=Math.atan2(i-o,r-n);e.translate(n,o),e.rotate(h),e.beginPath(),e.moveTo(0+u,0),e.lineTo(d-f,0),e.shadowColor=a.borderShadowColor,e.stroke(),le(e,0,u,l),le(e,d,-f,c),e.restore()}get label(){return this.elements&&this.elements[0]}resolveElementProperties(e,n){const o=Yt(e,n),{x:r,y:i,x2:s,y2:a}=o,d=yn(o,e.chartArea),l=d?bn({x:r,y:i},{x:s,y:a},e.chartArea):{x:r,y:i,x2:s,y2:a,width:Math.abs(s-r),height:Math.abs(a-i)};if(l.centerX=(s+r)/2,l.centerY=(a+i)/2,l.initProperties=H(e,l,n),n.curve){const u={x:l.x,y:l.y},f={x:l.x2,y:l.y2};l.cp=Mn(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=Ee(s,{x:t,y:e},n),t=s),t>r&&(e=Ee(r,{x:t,y:e},n),t=r),e<o&&(t=se(o,{x:t,y:e},n),e=o),e>i&&(t=se(i,{x:t,y:e},n),e=i),{x:t,y:e}}function bn(t,e,n){const{x:o,y:r}=_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:ht(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=Cn(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 Cn(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),P(t,o),t.moveTo(l,-i),t.lineTo(e+n,0),t.lineTo(l,i),s===!0?(t.fillStyle=a||d,t.closePath(),t.fill(),t.shadowColor="transparent"):t.shadowColor=o.borderShadowColor,t.stroke()}function Mn(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+M(n,c.x,!1),y:d+M(n,c.y,!1)};return I(u,{x:a,y:d},l)}function He(t,{x:e,y:n},{angle:o,adjust:r},i){!i||!i.display||(t.save(),t.translate(e,n),t.rotate(o),le(t,0,-r,i),t.restore())}function Pn(t,e,n,o){const{x:r,y:i,x2:s,y2:a,options:d}=e,{startOpts:l,endOpts:c,startAdjust:u,endAdjust:f}=at(e),h={x:r,y:i},y={x:s,y:a},x=Le(h,n,y,0),Y=Le(h,n,y,1)-b,g=ae(h,n,y,u/o),m=ae(h,n,y,1-f/o),k=new Path2D;t.beginPath(),k.moveTo(g.x,g.y),k.quadraticCurveTo(n.x,n.y,m.x,m.y),t.shadowColor=d.borderShadowColor,t.stroke(k),e.path=k,e.ctx=t,He(t,g,{angle:x,adjust:u},l),He(t,m,{angle:Y,adjust:f},c)}class V extends E{inRange(e,n,o,r){const i=this.options.rotation,s=this.options.borderWidth;if(o!=="x"&&o!=="y")return kn({x:e,y:n},this.getProps(["width","height","centerX","centerY"],r),i,s);const{x:a,y:d,x2:l,y2:c}=this.getProps(["x","y","x2","y2"],r),u=s/2,f=o==="y"?{start:d,end:c}:{start:a,end:l},h=I({x:e,y:n},this.getCenterPoint(r),w(-i));return h[o]>=f.start-u-D&&h[o]<=f.end+u+D}getCenterPoint(e){return R(this,e)}draw(e){const{width:n,height:o,centerX:r,centerY:i,options:s}=this;e.save(),me(e,this.getCenterPoint(),s.rotation),W(e,this.options),e.beginPath(),e.fillStyle=s.backgroundColor;const a=P(e,s);e.ellipse(r,i,o/2,n/2,b/2,0,2*b),e.fill(),a&&(e.shadowColor=s.borderShadowColor,e.stroke()),e.restore()}get label(){return this.elements&&this.elements[0]}resolveElementProperties(e,n){return ot(e,n,!0)}}V.id="ellipseAnnotation";V.defaults={adjustScaleRange:!0,backgroundShadowColor:"transparent",borderDash:[],borderDashOffset:0,borderShadowColor:"transparent",borderWidth:1,display:!0,init:void 0,label:Object.assign({},L.defaults.label),rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,xMax:void 0,xMin:void 0,xScaleID:void 0,yMax:void 0,yMin:void 0,yScaleID:void 0,z:0};V.defaultRoutes={borderColor:"color",backgroundColor:"color"};V.descriptors={label:{_fallback:!0}};function kn(t,e,n,o){const{width:r,height:i,centerX:s,centerY:a}=e,d=r/2,l=i/2;if(d<=0||l<=0)return!1;const c=w(n||0),u=o/2||0,f=Math.cos(c),h=Math.sin(c),y=Math.pow(f*(t.x-s)+h*(t.y-a),2),x=Math.pow(h*(t.x-s)-f*(t.y-a),2);return y/Math.pow(d+u,2)+x/Math.pow(l+u,2)<=1.0001}class ee extends E{inRange(e,n,o,r){const{x:i,y:s,x2:a,y2:d,width:l}=this.getProps(["x","y","x2","y2","width"],r),c=this.options.borderWidth;if(o!=="x"&&o!=="y")return Mt({x:e,y:n},this.getCenterPoint(r),l/2,c);const u=c/2,f=o==="y"?{start:s,end:d,value:n}:{start:i,end:a,value:e};return f.value>=f.start-u&&f.value<=f.end+u}getCenterPoint(e){return R(this,e)}draw(e){const n=this.options,o=n.borderWidth;if(n.radius<.1)return;e.save(),e.fillStyle=n.backgroundColor,W(e,n);const r=P(e,n);Tt(e,this,this.centerX,this.centerY),r&&!Z(n.pointStyle)&&(e.shadowColor=n.borderShadowColor,e.stroke()),e.restore(),n.borderWidth=o}resolveElementProperties(e,n){const o=nt(e,n);return o.initProperties=H(e,o,n,!0),o}}ee.id="pointAnnotation";ee.defaults={adjustScaleRange:!0,backgroundShadowColor:"transparent",borderDash:[],borderDashOffset:0,borderShadowColor:"transparent",borderWidth:1,display:!0,init:void 0,pointStyle:"circle",radius:10,rotation:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,xAdjust:0,xMax:void 0,xMin:void 0,xScaleID:void 0,xValue:void 0,yAdjust:0,yMax:void 0,yMin:void 0,yScaleID:void 0,yValue:void 0,z:0};ee.defaultRoutes={borderColor:"color",backgroundColor:"color"};class te extends E{inRange(e,n,o,r){if(o!=="x"&&o!=="y")return this.options.radius>=.1&&this.elements.length>1&&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 R(this,e)}draw(e){const{elements:n,options:o}=this;e.save(),e.beginPath(),e.fillStyle=o.backgroundColor,W(e,o);const r=P(e,o);let i=!0;for(const s of n)i?(e.moveTo(s.x,s.y),i=!1):e.lineTo(s.x,s.y);e.closePath(),e.fill(),r&&(e.shadowColor=o.borderShadowColor,e.stroke()),e.restore()}resolveElementProperties(e,n){const o=nt(e,n),{sides:r,rotation:i}=n,s=[],a=2*b/r;let d=i*$e;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 C={box:L,ellipse:V,label:N,line:$,point:ee,polygon:te};Object.keys(C).forEach(t=>{ct.describe(`elements.${C[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 Ce(t="line"){return C[t]?t:(console.warn(`Unknown annotation type: '${t}', defaulting to 'line'`),"line")}function In(t,e,n,o){const r=On(t,n.animations,o),i=e.annotations,s=Wn(e.elements,i);for(let a=0;a<i.length;a++){const d=i[a],l=dt(s,a,d.type),c=d.setContext(Rn(t,l,d)),u=l.resolveElementProperties(t,c);u.skip=Tn(u),"elements"in u&&(En(l,u.elements,c,r),delete u.elements),p(l.x)||Object.assign(l,u),Object.assign(l,u.initProperties),u.options=lt(c),r.update(l,u)}}function Tn(t){return isNaN(t.x)||isNaN(t.y)}function On(t,e,n){return n==="reset"||n==="none"||n==="resize"?An:new mt(t,e)}function En(t,e,n,o){const r=t.elements||(t.elements=[]);r.length=e.length;for(let i=0;i<e.length;i++){const s=e[i],a=s.properties,d=dt(r,i,s.type,s.initProperties),l=n[s.optionScope].override(s);a.options=lt(l),o.update(d,a)}}function dt(t,e,n,o){const r=C[Ce(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=C[Ce(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 Rn(t,e,n){return e.$context||(e.$context=Object.assign(Object.create(t.getContext()),{element:e,id:n.id,type:"annotation"}))}function Wn(t,e){const n=e.length,o=t.length;if(o<n){const r=n-o;t.splice(o,0,...new Array(r))}else o>n&&t.splice(n,o-n);return t}var Ln="2.2.1";const S=new Map,Yn=xe.concat(G);var Bn={id:"annotation",version:Ln,beforeRegister(){Pt("chart.js","3.7",oe.version)},afterRegister(){oe.register(C)},afterUnregister(){oe.unregister(C)},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.${C[Ce(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&&bt(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&&gt(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};
@@ -0,0 +1,3 @@
1
+ <svg width="66" height="57" viewBox="0 0 66 57" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M28.0703 9.35645H37.4268V0H56.1406V9.35645H65.4971V28.0703H56.1406V37.4268H46.7842V46.7842H37.4268V56.1406H28.0703V46.7842H18.7139V37.4268H9.35645V28.0703H0V9.35645H9.35645V0H28.0703V9.35645Z" fill="currentColor"/>
3
+ </svg>