@handijitcom/ui 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/README.md +34 -32
  2. package/build/calendar.cjs.map +1 -1
  3. package/build/calendar.js.map +1 -1
  4. package/build/charts.cjs +1 -1
  5. package/build/charts.cjs.map +1 -1
  6. package/build/charts.js +1 -1
  7. package/build/charts.js.map +1 -1
  8. package/build/chat.cjs +1 -1
  9. package/build/chat.cjs.map +1 -1
  10. package/build/chat.js +1 -1
  11. package/build/chat.js.map +1 -1
  12. package/build/components/MoneyInput/index.cjs.map +1 -1
  13. package/build/components/MoneyInput/index.d.cts +1 -1
  14. package/build/components/MoneyInput/index.d.ts +1 -1
  15. package/build/components/MoneyInput/index.js.map +1 -1
  16. package/build/constants/breakpoint.constants.cjs +1 -1
  17. package/build/constants/breakpoint.constants.cjs.map +1 -1
  18. package/build/constants/breakpoint.constants.d.cts +1 -1
  19. package/build/constants/breakpoint.constants.d.ts +1 -1
  20. package/build/constants/breakpoint.constants.js +1 -1
  21. package/build/constants/breakpoint.constants.js.map +1 -1
  22. package/build/constants/scale.constants.cjs.map +1 -1
  23. package/build/constants/scale.constants.d.cts +2 -3
  24. package/build/constants/scale.constants.d.ts +2 -3
  25. package/build/constants/scale.constants.js.map +1 -1
  26. package/build/design/fonts/LICENSE-archivo.txt +93 -0
  27. package/build/design/fonts/LICENSE-ibm-plex-mono.txt +93 -0
  28. package/build/design/fonts/LICENSE-inter.txt +93 -0
  29. package/build/design/fonts/archivo-latin-ext-wdth-normal.woff2 +0 -0
  30. package/build/design/fonts/archivo-latin-wdth-normal.woff2 +0 -0
  31. package/build/design/fonts/ibm-plex-mono-latin-400-normal.woff2 +0 -0
  32. package/build/design/fonts/ibm-plex-mono-latin-500-normal.woff2 +0 -0
  33. package/build/design/fonts/ibm-plex-mono-latin-ext-400-normal.woff2 +0 -0
  34. package/build/design/fonts/ibm-plex-mono-latin-ext-500-normal.woff2 +0 -0
  35. package/build/design/fonts/inter-latin-ext-wght-normal.woff2 +0 -0
  36. package/build/design/fonts/inter-latin-wght-normal.woff2 +0 -0
  37. package/build/design/fonts.css +75 -0
  38. package/build/design/fonts.d.css.ts +1 -0
  39. package/build/design/index.cjs +778 -0
  40. package/build/design/index.cjs.map +1 -0
  41. package/build/design/index.d.cts +263 -0
  42. package/build/design/index.d.mts +263 -0
  43. package/build/design/index.mjs +751 -0
  44. package/build/design/index.mjs.map +1 -0
  45. package/build/design/index.umd.cjs +2 -0
  46. package/build/design/index.umd.cjs.map +1 -0
  47. package/build/design/logos/horizontal.svg +1 -0
  48. package/build/design/logos/mark.svg +1 -0
  49. package/build/design/tokens.css +477 -0
  50. package/build/design/tokens.d.css.ts +1 -0
  51. package/build/design/tokens.json +542 -0
  52. package/build/design/tokens.scss +616 -0
  53. package/build/helpers/scaled-number.helper.cjs.map +1 -1
  54. package/build/helpers/scaled-number.helper.d.cts +3 -4
  55. package/build/helpers/scaled-number.helper.d.ts +3 -4
  56. package/build/helpers/scaled-number.helper.js.map +1 -1
  57. package/build/helpers/theme.helper.cjs +1 -1
  58. package/build/helpers/theme.helper.cjs.map +1 -1
  59. package/build/helpers/theme.helper.d.cts +2 -2
  60. package/build/helpers/theme.helper.d.ts +2 -2
  61. package/build/helpers/theme.helper.js +1 -1
  62. package/build/helpers/theme.helper.js.map +1 -1
  63. package/build/hooks/useUiTheme.cjs +1 -1
  64. package/build/hooks/useUiTheme.cjs.map +1 -1
  65. package/build/hooks/useUiTheme.d.cts +1 -1
  66. package/build/hooks/useUiTheme.d.ts +1 -1
  67. package/build/hooks/useUiTheme.js +1 -1
  68. package/build/hooks/useUiTheme.js.map +1 -1
  69. package/build/hooks/useUiTokens.cjs +1 -1
  70. package/build/hooks/useUiTokens.cjs.map +1 -1
  71. package/build/hooks/useUiTokens.d.cts +2 -2
  72. package/build/hooks/useUiTokens.d.ts +2 -2
  73. package/build/hooks/useUiTokens.js +1 -1
  74. package/build/hooks/useUiTokens.js.map +1 -1
  75. package/build/index.cjs +1 -1
  76. package/build/index.d.cts +1 -1
  77. package/build/index.d.ts +1 -1
  78. package/build/index.js +1 -1
  79. package/build/scss/_index.scss +1 -1
  80. package/build/scss/_variables.scss +3 -3
  81. package/build/theme/UiProvider.cjs.map +1 -1
  82. package/build/theme/UiProvider.d.cts +1 -1
  83. package/build/theme/UiProvider.d.ts +1 -1
  84. package/build/theme/UiProvider.js.map +1 -1
  85. package/build/theme/UiThemeScript.cjs +1 -1
  86. package/build/theme/UiThemeScript.cjs.map +1 -1
  87. package/build/theme/UiThemeScript.d.cts +1 -1
  88. package/build/theme/UiThemeScript.d.ts +1 -1
  89. package/build/theme/UiThemeScript.js +1 -1
  90. package/build/theme/UiThemeScript.js.map +1 -1
  91. package/build/types/calendar/Calendar/index.d.cts +2 -2
  92. package/build/types/calendar/Calendar/index.d.ts +2 -2
  93. package/build/types/calendar/core/time.d.cts +1 -1
  94. package/build/types/calendar/core/time.d.ts +1 -1
  95. package/build/types/calendar/core/types.d.cts +1 -1
  96. package/build/types/calendar/core/types.d.ts +1 -1
  97. package/build/types/calendar/index.d.cts +1 -1
  98. package/build/types/calendar/index.d.ts +1 -1
  99. package/build/types/charts/core/palette.d.cts +1 -1
  100. package/build/types/charts/core/palette.d.ts +1 -1
  101. package/build/types/chat/Legend/index.d.cts +1 -1
  102. package/build/types/chat/Legend/index.d.ts +1 -1
  103. package/build/types/theme.type.d.cts +2 -2
  104. package/build/types/theme.type.d.ts +2 -2
  105. package/build/types/types/theme.type.d.cts +2 -2
  106. package/build/types/types/theme.type.d.ts +2 -2
  107. package/package.json +30 -6
package/build/charts.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),f=require("react"),dt=require("@handijitcom/ui"),Gt=require("@handijit/design"),at=(t,s)=>Object.assign(t,{displayName:s}),xe="ui-axis-AqLAe",fe="ui-axis__label-dHxpo",pe="ui-axis__grid-RVxXW",ye="ui-axis__baseline-jhG2z",st={axis:xe,axis__label:fe,axis__grid:pe,axis__baseline:ye},wt=(t,s,e)=>{const n=e(t);return t.map((c,i)=>({position:s(c),label:n[i]}))},ie=6.4,ht=t=>t.length*ie,he=(t,s=8)=>{if(t.length<2)return[...t];const e=Math.max(...t.map(i=>ht(i.label))),n=Math.abs(t[1].position-t[0].position),c=n<=0?1:Math.max(1,Math.ceil((e+s)/n));return t.filter((i,m)=>m%c===0)},St=(t,s)=>{const e=Math.max(1,Math.floor(s/ie));return t.length<=e?t:`${t.slice(0,Math.max(1,e-1))}…`},ut=({area:t,ticks:s,side:e,hasGrid:n=!1})=>l.jsx("g",{className:st.axis,"aria-hidden":!0,children:s.map(c=>e==="bottom"?l.jsxs("g",{children:[n&&l.jsx("line",{className:st.axis__grid,x1:c.position,x2:c.position,y1:t.top,y2:t.bottom}),l.jsx("text",{className:st.axis__label,x:c.position,y:t.bottom+16,textAnchor:"middle",children:c.label})]},`${c.position}-${c.label}`):l.jsxs("g",{children:[n&&l.jsx("line",{className:st.axis__grid,x1:t.left,x2:t.right,y1:c.position,y2:c.position}),l.jsx("text",{className:st.axis__label,x:e==="left"?t.left-8:t.right+8,y:c.position,dy:"0.32em",textAnchor:e==="left"?"end":"start",children:c.label})]},`${c.position}-${c.label}`))}),Ot=({area:t,ticks:s,side:e})=>l.jsx("g",{className:st.axis,"aria-hidden":!0,children:e==="bottom"?l.jsxs(l.Fragment,{children:[l.jsx("line",{className:st.axis__baseline,x1:t.left,x2:t.right,y1:t.bottom,y2:t.bottom}),he(s).map(n=>l.jsx("text",{className:st.axis__label,x:n.position,y:t.bottom+16,textAnchor:"middle",children:n.label},`${n.position}-${n.label}`))]}):l.jsxs(l.Fragment,{children:[l.jsx("line",{className:st.axis__baseline,x1:t.left,x2:t.left,y1:t.top,y2:t.bottom}),s.map(n=>l.jsx("text",{className:st.axis__label,x:t.left-8,y:n.position,dy:"0.32em",textAnchor:"end",children:St(n.label,t.left-12)},`${n.position}-${n.label}`))]})}),V=t=>Math.round(t*100)/100,ge=t=>{const s=[];let e=[];for(const n of t)n===null||!Number.isFinite(n.x)||!Number.isFinite(n.y)?(e.length>0&&s.push(e),e=[]):e.push(n);return e.length>0&&s.push(e),s},Lt=t=>t.map((s,e)=>`${e===0?"M":"L"}${V(s.x)},${V(s.y)}`).join(""),ue=t=>{const s=t.length;if(s<3)return Lt(t);const e=[],n=[];for(let i=0;i<s-1;i+=1){const m=t[i+1].x-t[i].x;n.push(m===0?0:(t[i+1].y-t[i].y)/m)}e.push(n[0]);for(let i=1;i<s-1;i+=1)e.push(n[i-1]*n[i]<=0?0:(n[i-1]+n[i])/2);e.push(n[s-2]);for(let i=0;i<s-1;i+=1){if(n[i]===0){e[i]=0,e[i+1]=0;continue}const m=e[i]/n[i],d=e[i+1]/n[i],k=m*m+d*d;if(k>9){const A=3/Math.sqrt(k);e[i]=A*m*n[i],e[i+1]=A*d*n[i]}}let c=`M${V(t[0].x)},${V(t[0].y)}`;for(let i=0;i<s-1;i+=1){const m=t[i],d=t[i+1],k=(d.x-m.x)/3;c+=`C${V(m.x+k)},${V(m.y+e[i]*k)} ${V(d.x-k)},${V(d.y-e[i+1]*k)} ${V(d.x)},${V(d.y)}`}return c},be=(t,s="linear")=>ge(t).map(e=>s==="monotone"?ue(e):Lt(e)).join(""),Me=(t,s,e="linear")=>{const n=[];let c=[],i=[];const m=()=>{if(c.length>0){const d=e==="monotone"?ue:Lt,k=d([...i].reverse()).replace(/^M/,"L");n.push(`${d(c)}${k}Z`)}c=[],i=[]};return t.forEach((d,k)=>{const A=s[k];d===null||A===null||A===void 0?m():(c.push(d),i.push(A))}),m(),n.join("")},tt=(t,s,e,n)=>({x:t+e*Math.sin(n),y:s-e*Math.cos(n)}),Yt=(t,s,e,n,c,i)=>{const m=i-c;if(m<=0||e<=0)return"";if(m>=Math.PI*2-1e-6){const b=(R,E)=>`M${V(t)},${V(s-R)}A${R},${R} 0 1 ${E} ${V(t)},${V(s+R)}A${R},${R} 0 1 ${E} ${V(t)},${V(s-R)}Z`;return b(e,1)+(n>0?b(n,0):"")}const d=m>Math.PI?1:0,k=tt(t,s,e,c),A=tt(t,s,e,i);if(n<=0)return`M${V(t)},${V(s)}L${V(k.x)},${V(k.y)}A${e},${e} 0 ${d} 1 ${V(A.x)},${V(A.y)}Z`;const T=tt(t,s,n,i),C=tt(t,s,n,c);return`M${V(k.x)},${V(k.y)}A${e},${e} 0 ${d} 1 ${V(A.x)},${V(A.y)}L${V(T.x)},${V(T.y)}A${n},${n} 0 ${d} 0 ${V(C.x)},${V(C.y)}Z`},Zt=t=>t.length===0?"":`${Lt(t)}Z`,mt=(t,s)=>{const[e,n]=t,[c,i]=s,m=n-e,d=k=>m===0?(c+i)/2:c+(k-e)/m*(i-c);return d.domain=t,d.range=s,d.invert=k=>i===c?e:e+(k-c)/(i-c)*m,d},Rt=(t,s,{paddingInner:e=.2,paddingOuter:n=.1}={})=>{const[c,i]=s,m=t.length,d=m===0?0:(i-c)/Math.max(1,m-e+n*2),k=d*(1-e),A=c+d*n,T=new Map(t.map((b,R)=>[b,R])),C=b=>{const R=T.get(b);return R===void 0?Number.NaN:A+R*d};return C.domain=t,C.range=s,C.bandwidth=k,C.step=d,C.indexAt=b=>m===0?-1:Math.min(m-1,Math.max(0,Math.floor((b-c-d*n+(d-k)/2)/d))),C},Vt=(t,s,e)=>{const n=Math.abs(s-t);if(n===0||!Number.isFinite(n)||e<=0)return 1;const c=n/e,i=10**Math.floor(Math.log10(c)),m=c/i;return(m>=7.5?10:m>=3.5?5:m>=1.5?2:1)*i},Bt=(t,s)=>{const e=Math.max(0,-Math.floor(Math.log10(s))+1);return Number(t.toFixed(Math.min(e,12)))},jt=(t,s,e=5)=>{if(!Number.isFinite(t)||!Number.isFinite(s))return[0,1];let n=Math.min(t,s),c=Math.max(t,s);if(n===c){if(n===0)return[0,1];const m=Math.abs(n)*.5;n=n>0?0:n-m,c=c<0?0:c+m}const i=Vt(n,c,e);return[Bt(Math.floor(n/i)*i,i),Bt(Math.ceil(c/i)*i,i)]},ot=(t,s,e=5)=>{if(!Number.isFinite(t)||!Number.isFinite(s))return[];if(t===s)return[t];const n=Vt(t,s,e),c=Math.ceil(t/n-1e-9),i=Math.floor(s/n+1e-9),m=[];for(let d=c;d<=i&&m.length<1e3;d+=1)m.push(Bt(d*n,n));return m},_e=(t,s)=>{if(t.length===0)return-1;let e=0,n=t.length-1;for(;e<n;){const c=e+n>>1;t[c]<s?e=c+1:n=c}return e>0&&Math.abs(t[e-1]-s)<=Math.abs(t[e]-s)?e-1:e},Ht=t=>t.filter(s=>typeof s=="number"&&Number.isFinite(s)),xt=t=>{if(t.length===0)return[0,0];let s=t[0],e=t[0];for(const n of t)n<s&&(s=n),n>e&&(e=n);return[s,e]},Pt=(t,s)=>{if(t.length===0)return Number.NaN;if(t.length===1)return t[0];const e=(t.length-1)*Math.min(1,Math.max(0,s)),n=Math.floor(e),c=e-n;return n+1<t.length?t[n]+(t[n+1]-t[n])*c:t[n]},$e=t=>{const s=Ht(t).sort((m,d)=>m-d);if(s.length===0)return null;const e=Pt(s,.25),n=Pt(s,.75),c=(n-e)*1.5,i=s.filter(m=>m>=e-c&&m<=n+c);return{count:s.length,min:s[0],q1:e,median:Pt(s,.5),q3:n,max:s[s.length-1],whiskerLow:i[0]??e,whiskerHigh:i[i.length-1]??n,outliers:s.filter(m=>m<e-c||m>n+c)}},we=(t,s)=>{const e=Ht(t);if(e.length===0)return[];const[n,c]=xt(e);if(n===c)return[{from:n,to:n+1,count:e.length}];const i=s??Math.ceil(Math.log2(e.length))+1,m=Vt(n,c,Math.max(1,i)),d=Math.floor(n/m)*m,k=Math.max(1,Math.ceil((c-d)/m-1e-9)),A=Array.from({length:k},(T,C)=>({from:d+C*m,to:d+(C+1)*m,count:0}));for(const T of e){const C=Math.min(A.length-1,Math.floor((T-d)/m));A[C].count+=1}return A},$t=t=>typeof t=="number"&&Number.isFinite(t)?t:null,ct={top:12,right:16,bottom:28,minLeft:32},je=(t,s)=>{const e=t.map(()=>0),n=t.map(()=>0),c={};for(const i of s)c[i]=t.map((m,d)=>{const k=$t(m[i])??0;if(k>=0){const T=e[d];return e[d]+=k,{base:T,top:e[d]}}const A=n[d];return n[d]+=k,{base:A,top:n[d]}});return c},ke=t=>{const{rows:s,xKey:e,series:n,width:c,height:i,isStacked:m,curve:d,formatX:k}=t,A=n.some(v=>v.type==="bar"),C=(A&&n.every(v=>v.type==="bar")?t.orientation:"vertical")==="horizontal",b=s.map(v=>v[e]),R=!A&&!C&&b.length>1&&b.every(v=>$t(v)!==null),E={};if(m)for(const v of["left","right"])for(const O of["bar","area"]){const B=n.filter(Z=>(Z.axis??"left")===v&&Z.type===O).map(Z=>Z.key);Object.assign(E,je(s,B))}const S=(v,O)=>{if(E[v])return E[v][O];const B=$t(s[O][v]);return B===null?null:{base:0,top:B}},D=v=>{const O=n.filter(lt=>(lt.axis??"left")===v);if(O.length===0)return null;let B=Number.POSITIVE_INFINITY,Z=Number.NEGATIVE_INFINITY;for(const lt of O)for(let gt=0;gt<s.length;gt+=1){const it=S(lt.key,gt);it&&(B=Math.min(B,it.top,it.base),Z=Math.max(Z,it.top,it.base))}if(O.some(lt=>lt.type!=="line")&&(B=Math.min(B,0),Z=Math.max(Z,0)),!Number.isFinite(B)||!Number.isFinite(Z))return[0,1];const[et,J]=v==="left"?t.domain??[void 0,void 0]:[void 0,void 0],K=jt(et??B,J??Z);return[et??K[0],J??K[1]]},z=D("left")??[0,1],N=D("right"),I=N!==null&&!C,P=t.formatLeft(ot(z[0],z[1],5)),$=N?t.formatRight(ot(N[0],N[1],5)):[],j=s.map(v=>k(v[e])),u=C?Math.min(c*.4,Math.max(ct.minLeft,...j.map(ht))+12):Math.max(ct.minLeft,...P.map(ht))+10,p=I?Math.max(ct.minLeft,...$.map(ht))+10:ct.right,a={left:u,top:ct.top,right:Math.max(u+1,c-p),bottom:Math.max(ct.top+1,i-ct.bottom),width:Math.max(1,c-p-u),height:Math.max(1,i-ct.bottom-ct.top)},h=C?[a.top,a.bottom]:[a.left,a.right],r=C?[a.left,a.right]:[a.bottom,a.top],o=mt(z,r),x=N?mt(N,r):o,M=v=>(v.axis??"left")==="right"&&N?x:o;let w,y=0,_=null;if(R){const v=b.map(O=>$t(O));_=mt(xt(v),h),w=v.map(_)}else{const v=Rt(s.map((O,B)=>String(B)),h,A?{paddingInner:.24,paddingOuter:.12}:{paddingInner:0,paddingOuter:0});y=v.bandwidth,w=s.map((O,B)=>v(String(B))+v.bandwidth/2)}const q=(v,O)=>C?{x:O,y:v}:{x:v,y:O},L=[],W=n.filter(v=>v.type==="bar"),U=m?1:Math.max(1,W.length),G=U>1?Math.min(2,y*.04):0,g=Math.max(1,(y-G*(U-1))/U);W.forEach((v,O)=>{const B=M(v),Z=m?0:O;s.forEach((et,J)=>{const K=S(v.key,J);if(!K||K.top===K.base)return;const lt=w[J]-y/2+Z*(g+G),gt=B(K.base),it=B(K.top),Ut=Math.min(gt,it),Xt=Math.max(1,Math.abs(it-gt));L.push(C?{key:v.key,index:J,tone:v.tone,x:Ut,y:lt,width:Xt,height:g}:{key:v.key,index:J,tone:v.tone,x:lt,y:Ut,width:g,height:Xt})})});const F={},H=[],X=[];for(const v of n){if(v.type==="bar")continue;const O=M(v),B=s.map((Z,et)=>{const J=S(v.key,et);return J?q(w[et],O(J.top)):null});if(F[v.key]=B,v.type==="area"){const Z=s.map((et,J)=>{const K=S(v.key,J);return K?q(w[J],O(K.base)):null});X.push({key:v.key,tone:v.tone,d:Me(B,Z,d)})}H.push({key:v.key,tone:v.tone,d:be(B,d)})}const rt=s.map((v,O)=>{let B=null;for(const et of n){const J=S(et.key,O);if(!J)continue;const K=M(et)(J.top);B=B===null?K:C?Math.max(B,K):Math.min(B,K)}const Z=C?a.left:a.bottom;return q(w[O],B??Z)}),kt=(v,O,B)=>wt(ot(O[0],O[1],C?Math.max(2,Math.floor(a.width/90)):Math.max(2,Math.floor(a.height/48))),v,B),de=_?ot(_.domain[0],_.domain[1],Math.max(2,Math.floor(a.width/90))).map(v=>({position:_(v),label:k(v)})):s.map((v,O)=>({position:w[O],label:C?St(j[O],u-12):j[O]}));return{zero:z[0]<0&&z[1]>0?o(0):null,area:a,centers:w,bandwidth:y,isContinuous:R,categoryTicks:de,leftTicks:kt(o,z,t.formatLeft),rightTicks:I&&N?kt(x,N,t.formatRight):[],hasRightAxis:I,lines:H,areas:X,bars:L,points:F,anchors:rt}},Qt=(...t)=>{let s="";for(const e of t)e&&(s=s===""?e:`${s} ${e}`);return s},Jt=["chart-1","chart-2","chart-3","chart-4","chart-5","chart-6"],Tt=(t,s)=>s??Jt[t%Jt.length],Y=t=>Gt.cssVar(t==="muted"?"text-3":t),Ne="ui-chart-iR-5u",ve="ui-chart__canvas-4wf8o",Te="ui-chart__svg-yC5iw",Ae="ui-chart__overlay-kbXEv",Ce="ui-chart__tooltip-wbhLY",Ie="ui-chart__tooltipTitle-j-1Nw",Fe="ui-chart__tooltipRow-phors",Re="ui-chart__tooltipLabel-72x80",Se="ui-chart__tooltipValue-caeby",Le="ui-chart__swatch--mk77",He="ui-chart__legend-EhXcQ",Ee="ui-chart__legendItem--AaGe",Pe="ui-chart__srOnly-Oyem2",Q={chart:Ne,chart__canvas:ve,chart__svg:Te,chart__overlay:Ae,chart__tooltip:Ce,chart__tooltipTitle:Ie,chart__tooltipRow:Fe,chart__tooltipLabel:Re,chart__tooltipValue:Se,chart__swatch:Le,chart__legend:He,chart__legendItem:Ee,"chart__legendItem--hidden":"ui-chart__legendItem--hidden-D3li8",chart__srOnly:Pe},Kt=12,ft=({label:t,description:s,containerRef:e,width:n,height:c,plot:i,overlay:m,underlay:d,itemCount:k,columns:A,pick:T,tooltip:C,anchor:b,tooltipSide:R="inward",announce:E,table:S,legend:D,className:z,testId:N})=>{const I=f.useId(),P=dt.useAnnounce(),[$,j]=f.useState(null),u=f.useRef(null),p=f.useRef(null),a=f.useRef(null);f.useEffect(()=>{$!==null&&$>=k&&j(k>0?k-1:null)},[$,k]),f.useEffect(()=>()=>{u.current!==null&&cancelAnimationFrame(u.current)},[]);const h=f.useCallback(y=>{const _=y.currentTarget.getBoundingClientRect();a.current={x:y.clientX-_.left,y:y.clientY-_.top},u.current===null&&(u.current=requestAnimationFrame(()=>{u.current=null;const q=a.current;q&&j(T(q.x,q.y))}))},[T]),r=y=>{const _=Math.min(k-1,Math.max(0,y));j(_),P(E(_))},o=y=>{if(k===0)return;const _=$??-1,q=A??1,L=y.key==="ArrowRight"?_+1:y.key==="ArrowLeft"?Math.max(0,_-1):y.key==="ArrowDown"?_<0?0:_+q:y.key==="ArrowUp"?Math.max(0,_-q):y.key==="Home"?0:y.key==="End"?k-1:null;if(y.key==="Escape"&&$!==null){y.preventDefault(),j(null);return}L!==null&&(y.preventDefault(),r(L))},x=$===null?null:C($),M=$===null?null:b($),w=M==null?void 0:M.x;return f.useLayoutEffect(()=>{const y=p.current;if(!y||w===void 0)return;const _=y.offsetWidth,q=w>n/2,L=R==="outward"?!q:q,W=w-Kt-_,U=w+Kt,G=W>=0,g=U+_<=n,F=R==="outward"?L?W:U:L?G||!g?W:U:g||!G?U:W;y.style.left=`${Math.min(Math.max(0,F),Math.max(0,n-_))}px`},[$,w,n,R]),l.jsxs("figure",{className:Qt(Q.chart,z),"data-testid":N,children:[l.jsxs("div",{ref:e,className:Q.chart__canvas,style:{blockSize:c},children:[l.jsxs("svg",{className:Q.chart__svg,width:n,height:c,viewBox:`0 0 ${n} ${c}`,role:"img","aria-label":t,"aria-describedby":s?I:void 0,tabIndex:k>0?0:void 0,onPointerMove:h,onPointerDown:h,onPointerLeave:()=>j(null),onKeyDown:o,onBlur:()=>j(null),children:[$!==null&&d&&l.jsx("g",{className:Q.chart__overlay,children:d($)}),i,$!==null&&l.jsx("g",{className:Q.chart__overlay,children:m($)})]}),x&&M&&l.jsxs("div",{ref:p,"aria-hidden":!0,className:Q.chart__tooltip,style:{insetBlockStart:Math.max(24,Math.min(M.y,c-24))},children:[x.title&&l.jsx("span",{className:Q.chart__tooltipTitle,children:x.title}),x.rows.map(y=>l.jsxs("span",{className:Q.chart__tooltipRow,children:[y.tone&&l.jsx("span",{className:Q.chart__swatch,style:{backgroundColor:Y(y.tone)}}),l.jsx("span",{className:Q.chart__tooltipLabel,children:y.label}),l.jsx("span",{className:Q.chart__tooltipValue,children:y.value})]},y.id))]})]}),D&&D.entries.length>1&&l.jsx("ul",{className:Q.chart__legend,children:D.entries.map(y=>{const _=D.hidden.has(y.id);return l.jsx("li",{children:l.jsxs("button",{type:"button",className:Qt(Q.chart__legendItem,_&&Q["chart__legendItem--hidden"]),"aria-pressed":!_,onClick:()=>D.onToggle(y.id),children:[l.jsx(ze,{tone:y.tone,isHidden:_}),y.label]})},y.id)})}),s&&l.jsx("p",{id:I,className:Q.chart__srOnly,children:s}),l.jsx("div",{className:Q.chart__srOnly,children:l.jsxs("table",{children:[l.jsx("caption",{children:t}),l.jsx("thead",{children:l.jsx("tr",{children:S.columns.map((y,_)=>l.jsx("th",{scope:"col",children:y},_))})}),l.jsx("tbody",{children:S.rows.map((y,_)=>l.jsx("tr",{children:y.map((q,L)=>L===0?l.jsx("th",{scope:"row",children:q},L):l.jsx("td",{children:q},L))},_))})]})})]})},ze=({tone:t,isHidden:s})=>l.jsx("span",{"aria-hidden":!0,className:Q.chart__swatch,style:s?{backgroundColor:"transparent",boxShadow:`inset 0 0 0 2px ${Y(t)}`}:{backgroundColor:Y(t)}}),te=new Map,me=(t,s)=>{const e=`${t??""}|${JSON.stringify(s)}`;let n=te.get(e);return n||(n=new Intl.NumberFormat(t,s),te.set(e,n)),n},ee=t=>{if(t===0||!Number.isFinite(t))return null;const[s,e]=Math.abs(t).toExponential(9).split("e"),n=Number(e);return{first:n,last:n-(s.replace(".","").replace(/0+$/,"").length-1)}},At=t=>s=>{const e=s.reduce((n,c)=>{var i;return Math.min(n,((i=ee(c))==null?void 0:i.last)??n)},Number.POSITIVE_INFINITY);return s.map(n=>{var c;return me(t,{notation:"compact",maximumSignificantDigits:Math.min(21,Math.max(1,(((c=ee(n))==null?void 0:c.first)??0)-e+1))}).format(n)})},pt=t=>s=>me(t,{maximumFractionDigits:2}).format(s),qe=640,De=typeof window>"u"?()=>{}:f.useLayoutEffect,yt=t=>{const s=f.useRef(null),[e,n]=f.useState(t??qe);return De(()=>{if(t!==void 0){n(t);return}const c=s.current;if(!c)return;const i=d=>{const k=Math.floor(d);k>0&&n(A=>A===k?A:k)};if(i(c.clientWidth),typeof ResizeObserver>"u")return;const m=new ResizeObserver(([d])=>i(d.contentRect.width));return m.observe(c),()=>m.disconnect()},[t]),[s,e]},Ge="ui-line-CLpqU",Oe="ui-area-LkWXB",Be="ui-bar-260Bd",Ve="ui-point-Vc-kX",We="ui-marker-G-xZb",Ue="ui-crosshair-nV-xX",Xe="ui-band-jnG7s",Ye="ui-zero-GpHvw",nt={line:Ge,area:Oe,bar:Be,point:Ve,marker:We,crosshair:Ue,band:Xe,zero:Ye},Ze=280,ne="—",Qe=({label:t,description:s,data:e,xKey:n,xLabel:c,series:i,height:m=Ze,width:d,isStacked:k=!1,orientation:A="vertical",curve:T="monotone",hasPoints:C=!1,formatX:b=String,formatValue:R,domain:E,className:S,testId:D})=>{const{labels:z}=dt.useUi(),N=z==null?void 0:z.locale,[I,P]=yt(d),[$,j]=f.useState(()=>new Set),u=f.useMemo(()=>R??pt(N),[R,N]),p=f.useMemo(()=>At(N),[N]),a=f.useCallback(g=>g==null?"":b(g),[b]),h=f.useMemo(()=>i.map((g,F)=>({...g,tone:Tt(F,g.tone)})),[i]),r=f.useMemo(()=>h.filter(g=>!$.has(g.key)),[h,$]),o=f.useMemo(()=>ke({rows:e,xKey:n,series:r,width:P,height:m,isStacked:k,orientation:A,curve:T,formatX:a,formatLeft:p,formatRight:p,domain:E}),[e,n,r,P,m,k,A,T,a,p,E]),x=A==="horizontal"&&r.length>0&&r.every(g=>g.type==="bar"),M=r.some(g=>g.type==="bar"),w=f.useMemo(()=>{const g=o.centers.map((F,H)=>({center:F,index:H})).sort((F,H)=>F.center-H.center);return{centers:g.map(F=>F.center),indices:g.map(F=>F.index)}},[o.centers]),y=f.useCallback((g,F)=>{const{area:H}=o;if(g<H.left-4||g>H.right+4||F<H.top-4||F>H.bottom+4)return null;const X=_e(w.centers,x?F:g);return X<0?null:w.indices[X]},[o,w,x]),_=f.useCallback(g=>{var F;return{title:a((F=e[g])==null?void 0:F[n]),rows:r.map(H=>{var rt;const X=$t((rt=e[g])==null?void 0:rt[H.key]);return{id:H.key,label:H.label,tone:H.tone,value:X===null?ne:(H.format??u)(X)}})}},[e,n,r,u,a]),q=f.useCallback(g=>{const F=_(g);return`${F.title}: ${F.rows.map(H=>`${H.label} ${H.value}`).join(", ")}`},[_]),L=f.useMemo(()=>({columns:[c??n,...h.map(g=>g.label)],rows:e.map(g=>[a(g[n]),...h.map(F=>{const H=$t(g[F.key]);return H===null?ne:(F.format??u)(H)})])}),[e,n,c,h,u,a]),W=f.useMemo(()=>l.jsxs("g",{children:[x?l.jsxs(l.Fragment,{children:[l.jsx(ut,{area:o.area,ticks:o.leftTicks,side:"bottom",hasGrid:!0}),l.jsx(Ot,{area:o.area,ticks:o.categoryTicks,side:"left"})]}):l.jsxs(l.Fragment,{children:[l.jsx(ut,{area:o.area,ticks:o.leftTicks,side:"left",hasGrid:!0}),o.hasRightAxis&&l.jsx(ut,{area:o.area,ticks:o.rightTicks,side:"right"}),l.jsx(Ot,{area:o.area,ticks:o.categoryTicks,side:"bottom"})]}),o.zero!==null&&(x?l.jsx("line",{className:nt.zero,x1:o.zero,x2:o.zero,y1:o.area.top,y2:o.area.bottom}):l.jsx("line",{className:nt.zero,x1:o.area.left,x2:o.area.right,y1:o.zero,y2:o.zero})),o.areas.map(g=>l.jsx("path",{d:g.d,className:nt.area,style:{fill:`color-mix(in srgb, ${Y(g.tone)} 18%, transparent)`}},`area-${g.key}`)),o.bars.map(g=>l.jsx("rect",{className:nt.bar,x:g.x,y:g.y,width:g.width,height:g.height,rx:Math.min(3,g.width/4,g.height/4),style:{fill:Y(g.tone)}},`bar-${g.key}-${g.index}`)),o.lines.map(g=>l.jsx("path",{d:g.d,className:nt.line,style:{stroke:Y(g.tone)}},`line-${g.key}`)),r.filter(g=>g.type!=="bar").flatMap(g=>(o.points[g.key]??[]).map((F,H,X)=>F&&(C||!X[H-1]&&!X[H+1])?l.jsx("circle",{className:nt.point,cx:F.x,cy:F.y,r:3,style:{fill:Y(g.tone)}},`point-${g.key}-${H}`):null))]}),[o,C,x,r]),U=f.useCallback(g=>{if(!M||o.bandwidth<=0)return null;const{area:F}=o,H=o.centers[g],X=o.bandwidth*.12;return x?l.jsx("rect",{className:nt.band,x:F.left,width:F.width,y:H-o.bandwidth/2-X,height:o.bandwidth+X*2}):l.jsx("rect",{className:nt.band,y:F.top,height:F.height,x:H-o.bandwidth/2-X,width:o.bandwidth+X*2})},[o,x,M]),G=f.useCallback(g=>{const{area:F}=o,H=o.centers[g];return l.jsxs(l.Fragment,{children:[!M&&l.jsx("line",{className:nt.crosshair,x1:H,x2:H,y1:F.top,y2:F.bottom}),r.filter(X=>X.type!=="bar").map(X=>{var kt;const rt=(kt=o.points[X.key])==null?void 0:kt[g];return rt?l.jsx("circle",{className:nt.marker,cx:rt.x,cy:rt.y,r:4.5,style:{fill:Y(X.tone)}},X.key):null})]})},[o,r,M]);return l.jsx(ft,{label:t,description:s,containerRef:I,width:P,height:m,plot:W,overlay:G,underlay:U,itemCount:e.length,pick:y,tooltip:_,anchor:g=>o.anchors[g]??{x:0,y:0},announce:q,table:L,legend:{entries:h.map(g=>({id:g.key,label:g.label,tone:g.tone})),hidden:$,onToggle:g=>j(F=>{const H=new Set(F);return H.has(g)?H.delete(g):h.length-F.size>1&&H.add(g),H})},className:S,testId:D})},Et=f.memo(Qe),Je=({series:t,...s})=>{const e=f.useMemo(()=>t.map(n=>({...n,type:"line"})),[t]);return l.jsx(Et,{...s,series:e})},Ke=f.memo(at(Je,"LineChart")),tn=({series:t,...s})=>{const e=f.useMemo(()=>t.map(n=>({...n,type:"area"})),[t]);return l.jsx(Et,{...s,series:e})},en=f.memo(at(tn,"AreaChart")),nn=({series:t,...s})=>{const e=f.useMemo(()=>t.map(n=>({...n,type:"bar"})),[t]);return l.jsx(Et,{...s,series:e})},sn=f.memo(at(nn,"BarChart")),on=t=>l.jsx(Et,{...t}),an=f.memo(at(on,"ComposedChart")),cn="ui-slice-dFWuh",rn="ui-center__value-GnqKe",ln="ui-center__label-DsgTV",Nt={slice:cn,center__value:rn,center__label:ln},Ct=6,se=1.5,hn=({label:t,description:s,data:e,variant:n="donut",centerValue:c,centerLabel:i,valueLabel:m,height:d=260,width:k,formatValue:A,className:T,testId:C})=>{const{labels:b}=dt.useUi(),[R,E]=yt(k),[S,D]=f.useState(()=>new Set),z=f.useMemo(()=>pt(b==null?void 0:b.locale),[b==null?void 0:b.locale]),N=A??z,I=f.useMemo(()=>e.map((a,h)=>({...a,tone:Tt(h,a.tone)})),[e]),P=f.useMemo(()=>{const a=I.filter(_=>!S.has(_.id)&&Number.isFinite(_.value)&&_.value>0),h=a.reduce((_,q)=>_+q.value,0),r=E/2,o=d/2,x=Math.max(8,Math.min(E,d)/2-Ct-4),M=n==="donut"?x*.62:0;let w=0;const y=a.map(_=>{const q=h>0?_.value/h*Math.PI*2:0,L=w;return w+=q,{..._,start:L,end:w,share:h>0?_.value/h:0}});return{cx:r,cy:o,outer:x,inner:M,total:h,slices:y}},[I,S,E,d,n]),$=f.useMemo(()=>{const a=new Intl.NumberFormat(b==null?void 0:b.locale,{style:"percent",maximumFractionDigits:1});return h=>a.format(h)},[b==null?void 0:b.locale]),j=f.useMemo(()=>{const{cx:a,cy:h,outer:r,inner:o,slices:x,total:M}=P;return l.jsxs("g",{children:[x.map(w=>l.jsx("path",{className:Nt.slice,d:Yt(a,h,r,o,w.start,w.end),style:{fill:Y(w.tone),strokeWidth:x.length>1?se:0}},w.id)),n==="donut"&&l.jsxs("g",{"aria-hidden":!0,className:Nt.center,children:[l.jsx("text",{className:Nt.center__value,x:a,y:i?h-4:h,dy:"0.32em",textAnchor:"middle",children:c??N(M)}),i&&l.jsx("text",{className:Nt.center__label,x:a,y:h+16,dy:"0.32em",textAnchor:"middle",children:i})]})]})},[P,n,c,i,N]),u=f.useCallback((a,h)=>{const{cx:r,cy:o,outer:x,inner:M,slices:w}=P,y=Math.hypot(a-r,h-o);if(y>x+Ct||y<M)return null;let _=Math.atan2(a-r,-(h-o));_<0&&(_+=Math.PI*2);const q=w.findIndex(L=>_>=L.start&&_<L.end);return q<0?null:q},[P]),p=a=>{const h=P.slices[a];return`${N(h.value)} (${$(h.share)})`};return l.jsx(ft,{label:t,description:s,containerRef:R,width:E,height:d,plot:j,overlay:a=>{const{cx:h,cy:r,outer:o,inner:x,slices:M}=P,w=M[a],y=(w.start+w.end)/2,_=tt(0,0,Ct,y);return l.jsx("path",{className:Nt.slice,d:Yt(h+_.x,r+_.y,o,x,w.start,w.end),style:{fill:Y(w.tone),strokeWidth:se}})},itemCount:P.slices.length,pick:u,tooltip:a=>{const h=P.slices[a];return{rows:[{id:h.id,label:h.label,value:p(a),tone:h.tone}]}},anchor:a=>{const{cx:h,cy:r,outer:o,slices:x}=P,M=x[a];return tt(h,r,o+Ct,(M.start+M.end)/2)},tooltipSide:"outward",announce:a=>`${P.slices[a].label}: ${p(a)}`,table:{columns:[t,m],rows:I.map(a=>[a.label,Number.isFinite(a.value)?N(a.value):"—"])},legend:{entries:I.map(a=>({id:a.id,label:a.label,tone:a.tone})),hidden:S,onToggle:a=>D(h=>{const r=new Set(h);return r.has(a)?r.delete(a):I.length-h.size>1&&r.add(a),r})},className:T,testId:C})},un=f.memo(at(hn,"PieChart")),Wt=(t,s,e,{top:n=12,right:c=16,bottom:i=28}={})=>{const m=Math.max(32,...e.map(ht))+10;return{left:m,top:n,right:Math.max(m+1,t-c),bottom:Math.max(n+1,s-i),width:Math.max(1,t-c-m),height:Math.max(1,s-n-i)}},vt=(t,s)=>Math.max(2,Math.floor(t/(s?90:48))),mn=(t,s=24)=>{const e=new Map,n=(c,i)=>`${c}:${i}`;return t.forEach((c,i)=>{if(!Number.isFinite(c.x)||!Number.isFinite(c.y))return;const m=n(Math.floor(c.x/s),Math.floor(c.y/s)),d=e.get(m);d?d.push(i):e.set(m,[i])}),{nearest:(c,i,m)=>{const d=Math.ceil(m/s),k=Math.floor(c/s),A=Math.floor(i/s);let T=null,C=m*m;for(let b=-d;b<=d;b+=1)for(let R=-d;R<=d;R+=1)for(const E of e.get(n(k+b,A+R))??[]){const S=(t[E].x-c)**2+(t[E].y-i)**2;S<=C&&(C=S,T=E)}return T}}},dn="ui-point-YKyMm",xn="ui-marker-ToO1T",oe={point:dn,marker:xn},bt={plain:4,min:3,max:16},fn=22,pn=({label:t,description:s,series:e,xLabel:n,yLabel:c,sizeLabel:i,height:m=300,width:d,formatX:k,formatY:A,className:T,testId:C})=>{const{labels:b}=dt.useUi(),[R,E]=yt(d),[S,D]=f.useState(()=>new Set),z=f.useMemo(()=>pt(b==null?void 0:b.locale),[b==null?void 0:b.locale]),N=f.useMemo(()=>At(b==null?void 0:b.locale),[b==null?void 0:b.locale]),I=k??z,P=A??z,$=f.useMemo(()=>e.map((r,o)=>({...r,tone:Tt(o,r.tone)})),[e]),j=f.useMemo(()=>$.filter(r=>!S.has(r.id)).flatMap(r=>r.data.filter(o=>Number.isFinite(o.x)&&Number.isFinite(o.y)).map(o=>({...o,series:r}))).sort((r,o)=>r.x-o.x||r.y-o.y),[$,S]),u=f.useMemo(()=>{const r=jt(...xt(j.map(G=>G.x))),o=jt(...xt(j.map(G=>G.y))),x=ot(o[0],o[1],vt(m,!1)),M=Wt(E,m,N(x),{right:20}),w=mt(r,[M.left,M.right]),y=mt(o,[M.bottom,M.top]),_=Ht(j.map(G=>G.size)),[q,L]=xt(_),W=G=>G===void 0||!Number.isFinite(G)||_.length===0?bt.plain:L===q?(bt.min+bt.max)/2:Math.sqrt(bt.min**2+(G-q)/(L-q)*(bt.max**2-bt.min**2)),U=j.map(G=>({...G,cx:w(G.x),cy:y(G.y),r:W(G.size)}));return{area:M,placed:U,index:mn(U.map(G=>({x:G.cx,y:G.cy}))),xTicks:wt(ot(r[0],r[1],vt(M.width,!0)),w,N),yTicks:wt(x,y,N)}},[j,E,m,N]),p=f.useMemo(()=>l.jsxs("g",{children:[l.jsx(ut,{area:u.area,ticks:u.yTicks,side:"left",hasGrid:!0}),l.jsx(ut,{area:u.area,ticks:u.xTicks,side:"bottom",hasGrid:!0}),u.placed.map((r,o)=>l.jsx("circle",{className:oe.point,cx:r.cx,cy:r.cy,r:r.r,style:{fill:`color-mix(in srgb, ${Y(r.series.tone)} 72%, transparent)`,stroke:Y(r.series.tone)}},o))]}),[u]),a=f.useCallback((r,o)=>u.index.nearest(r,o,fn),[u]),h=r=>{const o=u.placed[r];return{title:o.label??o.series.label,rows:[{id:"series",label:o.series.label,value:"",tone:o.series.tone},{id:"x",label:n,value:I(o.x)},{id:"y",label:c,value:P(o.y)},...o.size!==void 0&&i?[{id:"size",label:i,value:z(o.size)}]:[]]}};return l.jsx(ft,{label:t,description:s,containerRef:R,width:E,height:m,plot:p,overlay:r=>{const o=u.placed[r];return l.jsx("circle",{className:oe.marker,cx:o.cx,cy:o.cy,r:o.r+3,style:{stroke:Y(o.series.tone)}})},itemCount:u.placed.length,pick:a,tooltip:h,anchor:r=>({x:u.placed[r].cx,y:u.placed[r].cy}),announce:r=>{const o=u.placed[r];return`${o.label?`${o.label}, `:""}${o.series.label}: ${n} ${I(o.x)}, ${c} ${P(o.y)}`},table:{columns:[t,n,c],rows:j.map(r=>[r.label??r.series.label,I(r.x),P(r.y)])},legend:{entries:$.map(r=>({id:r.id,label:r.label,tone:r.tone})),hidden:S,onToggle:r=>D(o=>{const x=new Set(o);return x.has(r)?x.delete(r):$.length-o.size>1&&x.add(r),x})},className:T,testId:C})},yn=f.memo(at(pn,"ScatterPlot")),gn="ui-labels-MJWYF",bn="ui-empty-AW7c9",Mn="ui-focus-hLQdB",It={labels:gn,empty:bn,focus:Mn},zt=8,_n=28,qt=140,ae=(t,s,e)=>{var c;const n=(c=t[s])==null?void 0:c[e];return typeof n=="number"&&Number.isFinite(n)?n:null},ce=t=>t.map((s,e)=>String(e)),$n=({label:t,description:s,columns:e,rows:n,values:c,valueLabel:i,tone:m="chart-1",height:d=280,width:k,formatValue:A,className:T,testId:C})=>{const{labels:b}=dt.useUi(),[R,E]=yt(k),S=f.useMemo(()=>pt(b==null?void 0:b.locale),[b==null?void 0:b.locale]),D=A??S,z=`ui-heat-${f.useId().replace(/:/g,"")}`,N=f.useMemo(()=>{const p={left:Math.min(E*.3,Math.max(32,...n.map(ht))+12),top:8,right:E-8,bottom:d-28-_n},a=Rt(ce(e),[p.left,p.right],{paddingInner:.06,paddingOuter:0}),h=Rt(ce(n),[p.top,p.bottom],{paddingInner:.06,paddingOuter:0}),[r,o]=xt(Ht(c.flat())),x=w=>w===null?null:o===r?60:zt+(w-r)/(o-r)*(100-zt),M=n.flatMap((w,y)=>e.map((_,q)=>{const L=ae(c,y,q);return{row:w,column:_,key:`${y}:${q}`,value:L,x:a(String(q)),y:h(String(y)),width:a.bandwidth,height:h.bandwidth,mix:x(L)}}));return{area:p,x:a,y:h,cells:M,min:r,max:o}},[e,n,c,E,d]),I=Y(m),P=f.useMemo(()=>{const{area:u,x:p,y:a,cells:h}=N,r=D(N.max),o=u.right-ht(r)-8,x=he(e.map((M,w)=>({position:p(String(w))+p.bandwidth/2,label:M})));return l.jsxs("g",{children:[h.map(M=>l.jsx("rect",{className:M.mix===null?It.empty:void 0,x:M.x,y:M.y,width:M.width,height:M.height,rx:2,style:M.mix===null?void 0:{fill:`color-mix(in srgb, ${I} ${M.mix}%, ${Gt.cssVar("bg-surface")})`}},M.key)),l.jsxs("g",{"aria-hidden":!0,className:It.labels,children:[n.map((M,w)=>l.jsx("text",{x:u.left-8,y:a(String(w))+a.bandwidth/2,dy:"0.32em",textAnchor:"end",children:St(M,u.left-12)},w)),x.map(M=>l.jsx("text",{x:M.position,y:u.bottom+16,textAnchor:"middle",children:M.label},M.position))]}),l.jsx("defs",{children:l.jsxs("linearGradient",{id:z,children:[l.jsx("stop",{offset:"0%",style:{stopColor:`color-mix(in srgb, ${I} ${zt}%, ${Gt.cssVar("bg-surface")})`}}),l.jsx("stop",{offset:"100%",style:{stopColor:I}})]})}),l.jsxs("g",{"aria-hidden":!0,className:It.labels,children:[l.jsx("rect",{x:o-qt,y:d-18,width:qt,height:8,rx:4,style:{fill:`url(#${z})`}}),l.jsx("text",{x:o-qt-8,y:d-14,dy:"0.32em",textAnchor:"end",children:D(N.min)}),l.jsx("text",{x:u.right,y:d-14,dy:"0.32em",textAnchor:"end",children:r})]})]})},[N,e,n,I,z,d,D]),$=f.useCallback((u,p)=>{const{area:a,x:h,y:r}=N;if(u<a.left||u>a.right||p<a.top||p>a.bottom)return null;const o=h.indexAt(u),x=r.indexAt(p);return o<0||x<0?null:x*e.length+o},[N,e.length]),j=u=>{const p=N.cells[u];return{cell:p,value:p.value===null?"—":D(p.value)}};return l.jsx(ft,{label:t,description:s,containerRef:R,width:E,height:d,plot:P,overlay:u=>{const p=N.cells[u];return l.jsx("rect",{className:It.focus,x:p.x-1,y:p.y-1,width:p.width+2,height:p.height+2,rx:3})},itemCount:N.cells.length,columns:e.length,pick:$,tooltip:u=>{const{cell:p,value:a}=j(u);return{title:`${p.row} · ${p.column}`,rows:[{id:"value",label:i,value:a,tone:m}]}},anchor:u=>{const p=N.cells[u];return{x:p.x+p.width/2,y:p.y+p.height/2}},announce:u=>{const{cell:p,value:a}=j(u);return`${p.row}, ${p.column}: ${i} ${a}`},table:{columns:[t,...e],rows:n.map((u,p)=>[u,...e.map((a,h)=>{const r=ae(c,p,h);return r===null?"—":D(r)})])},className:T,testId:C})},wn=f.memo(at($n,"Heatmap")),jn="ui-box-7zEQ-",kn="ui-median-J5g6o",Nn="ui-outlier-M0VN-",vn="ui-band-kK09D",Ft={box:jn,median:kn,outlier:Nn,band:vn},Tn=({label:t,description:s,groups:e,groupLabel:n,labels:c,height:i=280,width:m,formatValue:d,className:k,testId:A})=>{const{labels:T}=dt.useUi(),[C,b]=yt(m),R=f.useMemo(()=>pt(T==null?void 0:T.locale),[T==null?void 0:T.locale]),E=f.useMemo(()=>At(T==null?void 0:T.locale),[T==null?void 0:T.locale]),S=d??R,D=f.useMemo(()=>e.map(($,j)=>({group:$,tone:Tt(j,$.tone),stats:$e($.values)})),[e]),z=f.useMemo(()=>{const $=D.flatMap(x=>x.stats?[x.stats.min,x.stats.max]:[]),[j,u]=$.length?xt($):[0,1],p=jt(j,u),a=ot(p[0],p[1],vt(i,!1)),h=Wt(b,i,E(a)),r=Rt(e.map(x=>x.id),[h.left,h.right],{paddingInner:.4,paddingOuter:.2}),o=mt(p,[h.bottom,h.top]);return{area:h,band:r,y:o,yTicks:wt(a,o,E),groupTicks:e.map(x=>({position:r(x.id)+r.bandwidth/2,label:x.label}))}},[D,e,b,i,E]),N=$=>[{id:"max",label:c.max,value:S($.whiskerHigh)},{id:"q3",label:c.q3,value:S($.q3)},{id:"median",label:c.median,value:S($.median)},{id:"q1",label:c.q1,value:S($.q1)},{id:"min",label:c.min,value:S($.whiskerLow)},...$.outliers.length>0?[{id:"outliers",label:c.outliers,value:R($.outliers.length)}]:[],{id:"count",label:c.count,value:R($.count)}],I=f.useMemo(()=>{const{area:$,band:j,y:u}=z;return l.jsxs("g",{children:[l.jsx(ut,{area:$,ticks:z.yTicks,side:"left",hasGrid:!0}),l.jsx(Ot,{area:$,ticks:z.groupTicks,side:"bottom"}),D.map(({group:p,tone:a,stats:h})=>{if(!h)return null;const r=j(p.id),o=r+j.bandwidth/2,x=j.bandwidth*.3,M=Y(a);return l.jsxs("g",{style:{stroke:M},className:Ft.box,children:[l.jsx("line",{x1:o,x2:o,y1:u(h.whiskerHigh),y2:u(h.q3)}),l.jsx("line",{x1:o,x2:o,y1:u(h.q1),y2:u(h.whiskerLow)}),l.jsx("line",{x1:o-x,x2:o+x,y1:u(h.whiskerHigh),y2:u(h.whiskerHigh)}),l.jsx("line",{x1:o-x,x2:o+x,y1:u(h.whiskerLow),y2:u(h.whiskerLow)}),l.jsx("rect",{x:r,width:j.bandwidth,y:u(h.q3),height:Math.max(1,u(h.q1)-u(h.q3)),rx:2,style:{fill:`color-mix(in srgb, ${M} 22%, transparent)`}}),l.jsx("line",{className:Ft.median,x1:r,x2:r+j.bandwidth,y1:u(h.median),y2:u(h.median)}),h.outliers.map((w,y)=>l.jsx("circle",{className:Ft.outlier,cx:o,cy:u(w),r:3},y))]},p.id)})]})},[z,D]),P=f.useCallback(($,j)=>{const{area:u,band:p}=z;if($<u.left||$>u.right||j<u.top-4||j>u.bottom+4)return null;const a=p.indexAt($);return a<0?null:a},[z]);return l.jsx(ft,{label:t,description:s,containerRef:C,width:b,height:i,plot:I,underlay:$=>{const{area:j,band:u}=z,p=u.step*.2;return l.jsx("rect",{className:Ft.band,x:u(e[$].id)-p,width:u.bandwidth+p*2,y:j.top,height:j.height})},overlay:()=>null,itemCount:e.length,pick:P,tooltip:$=>{const j=D[$];return{title:j.group.label,rows:j.stats?N(j.stats).map(u=>({...u,tone:u.id==="median"?j.tone:void 0})):[]}},anchor:$=>{const j=D[$],{band:u,y:p}=z;return{x:u(j.group.id)+u.bandwidth/2,y:j.stats?p(j.stats.q3):z.area.bottom}},announce:$=>{const j=D[$];return j.stats?`${j.group.label}: ${N(j.stats).map(u=>`${u.label} ${u.value}`).join(", ")}`:j.group.label},table:{columns:[n,c.min,c.q1,c.median,c.q3,c.max,c.count],rows:D.map(({group:$,stats:j})=>j?[$.label,S(j.whiskerLow),S(j.q1),S(j.median),S(j.q3),S(j.whiskerHigh),R(j.count)]:[$.label,"—","—","—","—","—","0"])},className:k,testId:A})},An=f.memo(at(Tn,"BoxPlot")),Cn="ui-baseline-wWs7h",In="ui-band-xvYtL",re={baseline:Cn,band:In},Mt=1,Fn=({label:t,description:s,values:e,bins:n,valueLabel:c,countLabel:i,tone:m="chart-1",height:d=260,width:k,formatValue:A,className:T,testId:C})=>{const{labels:b}=dt.useUi(),[R,E]=yt(k),S=f.useMemo(()=>pt(b==null?void 0:b.locale),[b==null?void 0:b.locale]),D=f.useMemo(()=>At(b==null?void 0:b.locale),[b==null?void 0:b.locale]),z=A??S,N=f.useMemo(()=>we(e,n),[e,n]),I=f.useMemo(()=>{var w,y;const u=Math.max(1,...N.map(_=>_.count)),p=jt(0,u),a=ot(0,p[1],vt(d,!1)).filter(Number.isInteger),h=Wt(E,d,D(a)),r=((w=N[0])==null?void 0:w.from)??0,o=((y=N[N.length-1])==null?void 0:y.to)??1,x=mt([r,o],[h.left,h.right]),M=mt(p,[h.bottom,h.top]);return{area:h,columns:N.map(_=>({x:x(_.from)+Mt/2,width:Math.max(1,x(_.to)-x(_.from)-Mt),y:M(_.count),height:Math.max(0,h.bottom-M(_.count)),center:(x(_.from)+x(_.to))/2})),xTicks:wt(ot(r,o,vt(h.width,!0)),x,D),yTicks:wt(a,M,D)}},[N,E,d,D]),P=u=>`${z(N[u].from)} – ${z(N[u].to)}`,$=f.useMemo(()=>l.jsxs("g",{children:[l.jsx(ut,{area:I.area,ticks:I.yTicks,side:"left",hasGrid:!0}),l.jsx(ut,{area:I.area,ticks:I.xTicks,side:"bottom"}),l.jsx("line",{className:re.baseline,x1:I.area.left,x2:I.area.right,y1:I.area.bottom,y2:I.area.bottom}),I.columns.map((u,p)=>u.height>0?l.jsx("rect",{x:u.x,y:u.y,width:u.width,height:u.height,style:{fill:Y(m)}},p):null)]}),[I,m]),j=f.useCallback((u,p)=>{const{area:a,columns:h}=I;if(u<a.left||u>a.right||p<a.top-4||p>a.bottom+4)return null;const r=h.findIndex(o=>u>=o.x-Mt&&u<=o.x+o.width+Mt);return r<0?null:r},[I]);return l.jsx(ft,{label:t,description:s,containerRef:R,width:E,height:d,plot:$,underlay:u=>{const p=I.columns[u];return l.jsx("rect",{className:re.band,x:p.x-Mt/2,width:p.width+Mt,y:I.area.top,height:I.area.height})},overlay:()=>null,itemCount:N.length,pick:j,tooltip:u=>({title:P(u),rows:[{id:"count",label:i,value:S(N[u].count),tone:m}]}),anchor:u=>({x:I.columns[u].center,y:I.columns[u].y}),announce:u=>`${c} ${P(u)}: ${i} ${S(N[u].count)}`,table:{columns:[c,i],rows:N.map((u,p)=>[P(p),S(u.count)])},className:T,testId:C})},Rn=f.memo(at(Fn,"Histogram")),Sn="ui-grid-fHioN",Ln="ui-shape-Vbb9D",Hn="ui-labels-nRfEk",En="ui-axisLabel-UOZQ7",Pn="ui-spoke-P-6cp",zn="ui-marker-xzn9h",_t={grid:Sn,shape:Ln,labels:Hn,axisLabel:En,spoke:Pn,marker:zn},le=10,qn=16,Dn=28,Dt=(t,s)=>{const e=t.values[s];return typeof e=="number"&&Number.isFinite(e)?e:null},Gn=({label:t,description:s,axes:e,series:n,max:c,height:i=320,width:m,formatValue:d,className:k,testId:A})=>{const{labels:T}=dt.useUi(),[C,b]=yt(m),[R,E]=f.useState(()=>new Set),S=f.useMemo(()=>At(T==null?void 0:T.locale),[T==null?void 0:T.locale]),D=f.useMemo(()=>pt(T==null?void 0:T.locale),[T==null?void 0:T.locale]),z=d??D,N=f.useMemo(()=>n.map((a,h)=>({...a,tone:Tt(h,a.tone)})),[n]),I=f.useMemo(()=>N.filter(a=>!R.has(a.id)),[N,R]),P=f.useMemo(()=>{const a=e.length,h=a>0?Math.PI*2/a:0,r=e.map((W,U)=>U*h),o=Math.min(b*.22,Math.max(0,...e.map(W=>ht(W.label)))),x=Math.max(24,Math.min(i/2-24,b/2-o-le-4)),M=b/2,w=i/2;let y=0;for(const W of n)for(const U of e){const G=Dt(W,U.key);G!==null&&G>y&&(y=G)}const _=c!==void 0&&c>0?c:jt(0,y,4)[1],q=ot(0,_,4).filter(W=>W>0);return{cx:M,cy:w,radius:x,angles:r,step:h,top:_,rings:q,scale:W=>Math.min(Math.max(W,0),_)/_*x,labelRoom:o}},[e,n,c,b,i]),$=f.useMemo(()=>{const{cx:a,cy:h,angles:r,scale:o}=P;return I.map(x=>({...x,points:e.map((M,w)=>{const y=Dt(x,M.key);return{...tt(a,h,o(y??0),r[w]),value:y}})}))},[P,I,e]),j=f.useMemo(()=>{const{cx:a,cy:h,radius:r,angles:o,rings:x,scale:M,labelRoom:w}=P,y=x.length>0?M(x[0]):r,_=Math.max(1,Math.ceil(qn/Math.max(1,y))),q=S(x);return l.jsxs("g",{children:[l.jsxs("g",{"aria-hidden":!0,className:_t.grid,children:[x.map(L=>l.jsx("path",{d:Zt(o.map(W=>tt(a,h,M(L),W)))},L)),o.map((L,W)=>{const U=tt(a,h,r,L);return l.jsx("line",{x1:a,y1:h,x2:U.x,y2:U.y},e[W].key)})]}),$.map(L=>l.jsx("path",{className:_t.shape,d:Zt(L.points),style:{fill:`color-mix(in srgb, ${Y(L.tone)} 14%, transparent)`,stroke:Y(L.tone)}},L.id)),l.jsxs("g",{"aria-hidden":!0,className:_t.labels,children:[x.map((L,W)=>(x.length-1-W)%_===0?l.jsx("text",{x:a+4,y:h-M(L),dy:"1.1em",children:q[W]},L):null),e.map((L,W)=>{const U=o[W],G=tt(a,h,r+le,U),g=Math.sin(U),F=Math.cos(U),H=g>.3?"start":g<-.3?"end":"middle",X=F>.3?"-0.2em":F<-.3?"0.9em":"0.32em";return l.jsx("text",{className:_t.axisLabel,x:G.x,y:G.y,dy:X,textAnchor:H,children:St(L.label,H==="middle"?r*1.4:w)},L.key)})]})]})},[P,$,e,S]),u=f.useCallback((a,h)=>{const{cx:r,cy:o,radius:x,step:M}=P;if(e.length===0||Math.hypot(a-r,h-o)>x+Dn)return null;let w=Math.atan2(a-r,-(h-o));return w<0&&(w+=Math.PI*2),Math.round(w/M)%e.length},[P,e.length]),p=a=>$.map(h=>{const r=h.points[a].value;return{id:h.id,label:h.label,value:r===null?"—":z(r),tone:h.tone}});return l.jsx(ft,{label:t,description:s,containerRef:C,width:b,height:i,plot:j,overlay:a=>{const{cx:h,cy:r,radius:o,angles:x}=P,M=tt(h,r,o,x[a]);return l.jsxs("g",{children:[l.jsx("line",{className:_t.spoke,x1:h,y1:r,x2:M.x,y2:M.y}),$.map(w=>{const y=w.points[a];return y.value===null?null:l.jsx("circle",{className:_t.marker,cx:y.x,cy:y.y,r:4.5,style:{fill:Y(w.tone)}},w.id)})]})},itemCount:e.length,pick:u,tooltip:a=>({title:e[a].label,rows:p(a)}),anchor:a=>{const{cx:h,cy:r,radius:o,angles:x}=P;let M=0;for(const w of $){const y=w.points[a];M=Math.max(M,Math.hypot(y.x-h,y.y-r))}return tt(h,r,Math.min(o,M),x[a])},tooltipSide:"outward",announce:a=>`${e[a].label}: ${p(a).map(h=>`${h.label} ${h.value}`).join(", ")}`,table:{columns:[t,...N.map(a=>a.label)],rows:e.map(a=>[a.label,...N.map(h=>{const r=Dt(h,a.key);return r===null?"—":z(r)})])},legend:N.length>1?{entries:N.map(a=>({id:a.id,label:a.label,tone:a.tone})),hidden:R,onToggle:a=>E(h=>{const r=new Set(h);return r.has(a)?r.delete(a):N.length-h.size>1&&r.add(a),r})}:void 0,className:k,testId:A})},On=f.memo(at(Gn,"RadarChart"));exports.AreaChart=en;exports.BarChart=sn;exports.BoxPlot=An;exports.ComposedChart=an;exports.Heatmap=wn;exports.Histogram=Rn;exports.LineChart=Ke;exports.PieChart=un;exports.RadarChart=On;exports.ScatterPlot=yn;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),f=require("react"),dt=require("@handijitcom/ui"),Gt=require("@handijitcom/ui/design"),at=(t,s)=>Object.assign(t,{displayName:s}),xe="ui-axis-AqLAe",fe="ui-axis__label-dHxpo",pe="ui-axis__grid-RVxXW",ye="ui-axis__baseline-jhG2z",st={axis:xe,axis__label:fe,axis__grid:pe,axis__baseline:ye},wt=(t,s,e)=>{const n=e(t);return t.map((c,i)=>({position:s(c),label:n[i]}))},ie=6.4,ht=t=>t.length*ie,he=(t,s=8)=>{if(t.length<2)return[...t];const e=Math.max(...t.map(i=>ht(i.label))),n=Math.abs(t[1].position-t[0].position),c=n<=0?1:Math.max(1,Math.ceil((e+s)/n));return t.filter((i,m)=>m%c===0)},St=(t,s)=>{const e=Math.max(1,Math.floor(s/ie));return t.length<=e?t:`${t.slice(0,Math.max(1,e-1))}…`},ut=({area:t,ticks:s,side:e,hasGrid:n=!1})=>l.jsx("g",{className:st.axis,"aria-hidden":!0,children:s.map(c=>e==="bottom"?l.jsxs("g",{children:[n&&l.jsx("line",{className:st.axis__grid,x1:c.position,x2:c.position,y1:t.top,y2:t.bottom}),l.jsx("text",{className:st.axis__label,x:c.position,y:t.bottom+16,textAnchor:"middle",children:c.label})]},`${c.position}-${c.label}`):l.jsxs("g",{children:[n&&l.jsx("line",{className:st.axis__grid,x1:t.left,x2:t.right,y1:c.position,y2:c.position}),l.jsx("text",{className:st.axis__label,x:e==="left"?t.left-8:t.right+8,y:c.position,dy:"0.32em",textAnchor:e==="left"?"end":"start",children:c.label})]},`${c.position}-${c.label}`))}),Ot=({area:t,ticks:s,side:e})=>l.jsx("g",{className:st.axis,"aria-hidden":!0,children:e==="bottom"?l.jsxs(l.Fragment,{children:[l.jsx("line",{className:st.axis__baseline,x1:t.left,x2:t.right,y1:t.bottom,y2:t.bottom}),he(s).map(n=>l.jsx("text",{className:st.axis__label,x:n.position,y:t.bottom+16,textAnchor:"middle",children:n.label},`${n.position}-${n.label}`))]}):l.jsxs(l.Fragment,{children:[l.jsx("line",{className:st.axis__baseline,x1:t.left,x2:t.left,y1:t.top,y2:t.bottom}),s.map(n=>l.jsx("text",{className:st.axis__label,x:t.left-8,y:n.position,dy:"0.32em",textAnchor:"end",children:St(n.label,t.left-12)},`${n.position}-${n.label}`))]})}),V=t=>Math.round(t*100)/100,ge=t=>{const s=[];let e=[];for(const n of t)n===null||!Number.isFinite(n.x)||!Number.isFinite(n.y)?(e.length>0&&s.push(e),e=[]):e.push(n);return e.length>0&&s.push(e),s},Lt=t=>t.map((s,e)=>`${e===0?"M":"L"}${V(s.x)},${V(s.y)}`).join(""),ue=t=>{const s=t.length;if(s<3)return Lt(t);const e=[],n=[];for(let i=0;i<s-1;i+=1){const m=t[i+1].x-t[i].x;n.push(m===0?0:(t[i+1].y-t[i].y)/m)}e.push(n[0]);for(let i=1;i<s-1;i+=1)e.push(n[i-1]*n[i]<=0?0:(n[i-1]+n[i])/2);e.push(n[s-2]);for(let i=0;i<s-1;i+=1){if(n[i]===0){e[i]=0,e[i+1]=0;continue}const m=e[i]/n[i],d=e[i+1]/n[i],k=m*m+d*d;if(k>9){const A=3/Math.sqrt(k);e[i]=A*m*n[i],e[i+1]=A*d*n[i]}}let c=`M${V(t[0].x)},${V(t[0].y)}`;for(let i=0;i<s-1;i+=1){const m=t[i],d=t[i+1],k=(d.x-m.x)/3;c+=`C${V(m.x+k)},${V(m.y+e[i]*k)} ${V(d.x-k)},${V(d.y-e[i+1]*k)} ${V(d.x)},${V(d.y)}`}return c},be=(t,s="linear")=>ge(t).map(e=>s==="monotone"?ue(e):Lt(e)).join(""),Me=(t,s,e="linear")=>{const n=[];let c=[],i=[];const m=()=>{if(c.length>0){const d=e==="monotone"?ue:Lt,k=d([...i].reverse()).replace(/^M/,"L");n.push(`${d(c)}${k}Z`)}c=[],i=[]};return t.forEach((d,k)=>{const A=s[k];d===null||A===null||A===void 0?m():(c.push(d),i.push(A))}),m(),n.join("")},tt=(t,s,e,n)=>({x:t+e*Math.sin(n),y:s-e*Math.cos(n)}),Yt=(t,s,e,n,c,i)=>{const m=i-c;if(m<=0||e<=0)return"";if(m>=Math.PI*2-1e-6){const b=(R,E)=>`M${V(t)},${V(s-R)}A${R},${R} 0 1 ${E} ${V(t)},${V(s+R)}A${R},${R} 0 1 ${E} ${V(t)},${V(s-R)}Z`;return b(e,1)+(n>0?b(n,0):"")}const d=m>Math.PI?1:0,k=tt(t,s,e,c),A=tt(t,s,e,i);if(n<=0)return`M${V(t)},${V(s)}L${V(k.x)},${V(k.y)}A${e},${e} 0 ${d} 1 ${V(A.x)},${V(A.y)}Z`;const T=tt(t,s,n,i),C=tt(t,s,n,c);return`M${V(k.x)},${V(k.y)}A${e},${e} 0 ${d} 1 ${V(A.x)},${V(A.y)}L${V(T.x)},${V(T.y)}A${n},${n} 0 ${d} 0 ${V(C.x)},${V(C.y)}Z`},Zt=t=>t.length===0?"":`${Lt(t)}Z`,mt=(t,s)=>{const[e,n]=t,[c,i]=s,m=n-e,d=k=>m===0?(c+i)/2:c+(k-e)/m*(i-c);return d.domain=t,d.range=s,d.invert=k=>i===c?e:e+(k-c)/(i-c)*m,d},Rt=(t,s,{paddingInner:e=.2,paddingOuter:n=.1}={})=>{const[c,i]=s,m=t.length,d=m===0?0:(i-c)/Math.max(1,m-e+n*2),k=d*(1-e),A=c+d*n,T=new Map(t.map((b,R)=>[b,R])),C=b=>{const R=T.get(b);return R===void 0?Number.NaN:A+R*d};return C.domain=t,C.range=s,C.bandwidth=k,C.step=d,C.indexAt=b=>m===0?-1:Math.min(m-1,Math.max(0,Math.floor((b-c-d*n+(d-k)/2)/d))),C},Vt=(t,s,e)=>{const n=Math.abs(s-t);if(n===0||!Number.isFinite(n)||e<=0)return 1;const c=n/e,i=10**Math.floor(Math.log10(c)),m=c/i;return(m>=7.5?10:m>=3.5?5:m>=1.5?2:1)*i},Bt=(t,s)=>{const e=Math.max(0,-Math.floor(Math.log10(s))+1);return Number(t.toFixed(Math.min(e,12)))},jt=(t,s,e=5)=>{if(!Number.isFinite(t)||!Number.isFinite(s))return[0,1];let n=Math.min(t,s),c=Math.max(t,s);if(n===c){if(n===0)return[0,1];const m=Math.abs(n)*.5;n=n>0?0:n-m,c=c<0?0:c+m}const i=Vt(n,c,e);return[Bt(Math.floor(n/i)*i,i),Bt(Math.ceil(c/i)*i,i)]},ot=(t,s,e=5)=>{if(!Number.isFinite(t)||!Number.isFinite(s))return[];if(t===s)return[t];const n=Vt(t,s,e),c=Math.ceil(t/n-1e-9),i=Math.floor(s/n+1e-9),m=[];for(let d=c;d<=i&&m.length<1e3;d+=1)m.push(Bt(d*n,n));return m},_e=(t,s)=>{if(t.length===0)return-1;let e=0,n=t.length-1;for(;e<n;){const c=e+n>>1;t[c]<s?e=c+1:n=c}return e>0&&Math.abs(t[e-1]-s)<=Math.abs(t[e]-s)?e-1:e},Ht=t=>t.filter(s=>typeof s=="number"&&Number.isFinite(s)),xt=t=>{if(t.length===0)return[0,0];let s=t[0],e=t[0];for(const n of t)n<s&&(s=n),n>e&&(e=n);return[s,e]},Pt=(t,s)=>{if(t.length===0)return Number.NaN;if(t.length===1)return t[0];const e=(t.length-1)*Math.min(1,Math.max(0,s)),n=Math.floor(e),c=e-n;return n+1<t.length?t[n]+(t[n+1]-t[n])*c:t[n]},$e=t=>{const s=Ht(t).sort((m,d)=>m-d);if(s.length===0)return null;const e=Pt(s,.25),n=Pt(s,.75),c=(n-e)*1.5,i=s.filter(m=>m>=e-c&&m<=n+c);return{count:s.length,min:s[0],q1:e,median:Pt(s,.5),q3:n,max:s[s.length-1],whiskerLow:i[0]??e,whiskerHigh:i[i.length-1]??n,outliers:s.filter(m=>m<e-c||m>n+c)}},we=(t,s)=>{const e=Ht(t);if(e.length===0)return[];const[n,c]=xt(e);if(n===c)return[{from:n,to:n+1,count:e.length}];const i=s??Math.ceil(Math.log2(e.length))+1,m=Vt(n,c,Math.max(1,i)),d=Math.floor(n/m)*m,k=Math.max(1,Math.ceil((c-d)/m-1e-9)),A=Array.from({length:k},(T,C)=>({from:d+C*m,to:d+(C+1)*m,count:0}));for(const T of e){const C=Math.min(A.length-1,Math.floor((T-d)/m));A[C].count+=1}return A},$t=t=>typeof t=="number"&&Number.isFinite(t)?t:null,ct={top:12,right:16,bottom:28,minLeft:32},je=(t,s)=>{const e=t.map(()=>0),n=t.map(()=>0),c={};for(const i of s)c[i]=t.map((m,d)=>{const k=$t(m[i])??0;if(k>=0){const T=e[d];return e[d]+=k,{base:T,top:e[d]}}const A=n[d];return n[d]+=k,{base:A,top:n[d]}});return c},ke=t=>{const{rows:s,xKey:e,series:n,width:c,height:i,isStacked:m,curve:d,formatX:k}=t,A=n.some(v=>v.type==="bar"),C=(A&&n.every(v=>v.type==="bar")?t.orientation:"vertical")==="horizontal",b=s.map(v=>v[e]),R=!A&&!C&&b.length>1&&b.every(v=>$t(v)!==null),E={};if(m)for(const v of["left","right"])for(const O of["bar","area"]){const B=n.filter(Z=>(Z.axis??"left")===v&&Z.type===O).map(Z=>Z.key);Object.assign(E,je(s,B))}const S=(v,O)=>{if(E[v])return E[v][O];const B=$t(s[O][v]);return B===null?null:{base:0,top:B}},D=v=>{const O=n.filter(lt=>(lt.axis??"left")===v);if(O.length===0)return null;let B=Number.POSITIVE_INFINITY,Z=Number.NEGATIVE_INFINITY;for(const lt of O)for(let gt=0;gt<s.length;gt+=1){const it=S(lt.key,gt);it&&(B=Math.min(B,it.top,it.base),Z=Math.max(Z,it.top,it.base))}if(O.some(lt=>lt.type!=="line")&&(B=Math.min(B,0),Z=Math.max(Z,0)),!Number.isFinite(B)||!Number.isFinite(Z))return[0,1];const[et,J]=v==="left"?t.domain??[void 0,void 0]:[void 0,void 0],K=jt(et??B,J??Z);return[et??K[0],J??K[1]]},z=D("left")??[0,1],N=D("right"),I=N!==null&&!C,P=t.formatLeft(ot(z[0],z[1],5)),$=N?t.formatRight(ot(N[0],N[1],5)):[],j=s.map(v=>k(v[e])),u=C?Math.min(c*.4,Math.max(ct.minLeft,...j.map(ht))+12):Math.max(ct.minLeft,...P.map(ht))+10,p=I?Math.max(ct.minLeft,...$.map(ht))+10:ct.right,a={left:u,top:ct.top,right:Math.max(u+1,c-p),bottom:Math.max(ct.top+1,i-ct.bottom),width:Math.max(1,c-p-u),height:Math.max(1,i-ct.bottom-ct.top)},h=C?[a.top,a.bottom]:[a.left,a.right],r=C?[a.left,a.right]:[a.bottom,a.top],o=mt(z,r),x=N?mt(N,r):o,M=v=>(v.axis??"left")==="right"&&N?x:o;let w,y=0,_=null;if(R){const v=b.map(O=>$t(O));_=mt(xt(v),h),w=v.map(_)}else{const v=Rt(s.map((O,B)=>String(B)),h,A?{paddingInner:.24,paddingOuter:.12}:{paddingInner:0,paddingOuter:0});y=v.bandwidth,w=s.map((O,B)=>v(String(B))+v.bandwidth/2)}const q=(v,O)=>C?{x:O,y:v}:{x:v,y:O},L=[],W=n.filter(v=>v.type==="bar"),U=m?1:Math.max(1,W.length),G=U>1?Math.min(2,y*.04):0,g=Math.max(1,(y-G*(U-1))/U);W.forEach((v,O)=>{const B=M(v),Z=m?0:O;s.forEach((et,J)=>{const K=S(v.key,J);if(!K||K.top===K.base)return;const lt=w[J]-y/2+Z*(g+G),gt=B(K.base),it=B(K.top),Ut=Math.min(gt,it),Xt=Math.max(1,Math.abs(it-gt));L.push(C?{key:v.key,index:J,tone:v.tone,x:Ut,y:lt,width:Xt,height:g}:{key:v.key,index:J,tone:v.tone,x:lt,y:Ut,width:g,height:Xt})})});const F={},H=[],X=[];for(const v of n){if(v.type==="bar")continue;const O=M(v),B=s.map((Z,et)=>{const J=S(v.key,et);return J?q(w[et],O(J.top)):null});if(F[v.key]=B,v.type==="area"){const Z=s.map((et,J)=>{const K=S(v.key,J);return K?q(w[J],O(K.base)):null});X.push({key:v.key,tone:v.tone,d:Me(B,Z,d)})}H.push({key:v.key,tone:v.tone,d:be(B,d)})}const rt=s.map((v,O)=>{let B=null;for(const et of n){const J=S(et.key,O);if(!J)continue;const K=M(et)(J.top);B=B===null?K:C?Math.max(B,K):Math.min(B,K)}const Z=C?a.left:a.bottom;return q(w[O],B??Z)}),kt=(v,O,B)=>wt(ot(O[0],O[1],C?Math.max(2,Math.floor(a.width/90)):Math.max(2,Math.floor(a.height/48))),v,B),de=_?ot(_.domain[0],_.domain[1],Math.max(2,Math.floor(a.width/90))).map(v=>({position:_(v),label:k(v)})):s.map((v,O)=>({position:w[O],label:C?St(j[O],u-12):j[O]}));return{zero:z[0]<0&&z[1]>0?o(0):null,area:a,centers:w,bandwidth:y,isContinuous:R,categoryTicks:de,leftTicks:kt(o,z,t.formatLeft),rightTicks:I&&N?kt(x,N,t.formatRight):[],hasRightAxis:I,lines:H,areas:X,bars:L,points:F,anchors:rt}},Qt=(...t)=>{let s="";for(const e of t)e&&(s=s===""?e:`${s} ${e}`);return s},Jt=["chart-1","chart-2","chart-3","chart-4","chart-5","chart-6"],Tt=(t,s)=>s??Jt[t%Jt.length],Y=t=>Gt.cssVar(t==="muted"?"text-3":t),Ne="ui-chart-iR-5u",ve="ui-chart__canvas-4wf8o",Te="ui-chart__svg-yC5iw",Ae="ui-chart__overlay-kbXEv",Ce="ui-chart__tooltip-wbhLY",Ie="ui-chart__tooltipTitle-j-1Nw",Fe="ui-chart__tooltipRow-phors",Re="ui-chart__tooltipLabel-72x80",Se="ui-chart__tooltipValue-caeby",Le="ui-chart__swatch--mk77",He="ui-chart__legend-EhXcQ",Ee="ui-chart__legendItem--AaGe",Pe="ui-chart__srOnly-Oyem2",Q={chart:Ne,chart__canvas:ve,chart__svg:Te,chart__overlay:Ae,chart__tooltip:Ce,chart__tooltipTitle:Ie,chart__tooltipRow:Fe,chart__tooltipLabel:Re,chart__tooltipValue:Se,chart__swatch:Le,chart__legend:He,chart__legendItem:Ee,"chart__legendItem--hidden":"ui-chart__legendItem--hidden-D3li8",chart__srOnly:Pe},Kt=12,ft=({label:t,description:s,containerRef:e,width:n,height:c,plot:i,overlay:m,underlay:d,itemCount:k,columns:A,pick:T,tooltip:C,anchor:b,tooltipSide:R="inward",announce:E,table:S,legend:D,className:z,testId:N})=>{const I=f.useId(),P=dt.useAnnounce(),[$,j]=f.useState(null),u=f.useRef(null),p=f.useRef(null),a=f.useRef(null);f.useEffect(()=>{$!==null&&$>=k&&j(k>0?k-1:null)},[$,k]),f.useEffect(()=>()=>{u.current!==null&&cancelAnimationFrame(u.current)},[]);const h=f.useCallback(y=>{const _=y.currentTarget.getBoundingClientRect();a.current={x:y.clientX-_.left,y:y.clientY-_.top},u.current===null&&(u.current=requestAnimationFrame(()=>{u.current=null;const q=a.current;q&&j(T(q.x,q.y))}))},[T]),r=y=>{const _=Math.min(k-1,Math.max(0,y));j(_),P(E(_))},o=y=>{if(k===0)return;const _=$??-1,q=A??1,L=y.key==="ArrowRight"?_+1:y.key==="ArrowLeft"?Math.max(0,_-1):y.key==="ArrowDown"?_<0?0:_+q:y.key==="ArrowUp"?Math.max(0,_-q):y.key==="Home"?0:y.key==="End"?k-1:null;if(y.key==="Escape"&&$!==null){y.preventDefault(),j(null);return}L!==null&&(y.preventDefault(),r(L))},x=$===null?null:C($),M=$===null?null:b($),w=M==null?void 0:M.x;return f.useLayoutEffect(()=>{const y=p.current;if(!y||w===void 0)return;const _=y.offsetWidth,q=w>n/2,L=R==="outward"?!q:q,W=w-Kt-_,U=w+Kt,G=W>=0,g=U+_<=n,F=R==="outward"?L?W:U:L?G||!g?W:U:g||!G?U:W;y.style.left=`${Math.min(Math.max(0,F),Math.max(0,n-_))}px`},[$,w,n,R]),l.jsxs("figure",{className:Qt(Q.chart,z),"data-testid":N,children:[l.jsxs("div",{ref:e,className:Q.chart__canvas,style:{blockSize:c},children:[l.jsxs("svg",{className:Q.chart__svg,width:n,height:c,viewBox:`0 0 ${n} ${c}`,role:"img","aria-label":t,"aria-describedby":s?I:void 0,tabIndex:k>0?0:void 0,onPointerMove:h,onPointerDown:h,onPointerLeave:()=>j(null),onKeyDown:o,onBlur:()=>j(null),children:[$!==null&&d&&l.jsx("g",{className:Q.chart__overlay,children:d($)}),i,$!==null&&l.jsx("g",{className:Q.chart__overlay,children:m($)})]}),x&&M&&l.jsxs("div",{ref:p,"aria-hidden":!0,className:Q.chart__tooltip,style:{insetBlockStart:Math.max(24,Math.min(M.y,c-24))},children:[x.title&&l.jsx("span",{className:Q.chart__tooltipTitle,children:x.title}),x.rows.map(y=>l.jsxs("span",{className:Q.chart__tooltipRow,children:[y.tone&&l.jsx("span",{className:Q.chart__swatch,style:{backgroundColor:Y(y.tone)}}),l.jsx("span",{className:Q.chart__tooltipLabel,children:y.label}),l.jsx("span",{className:Q.chart__tooltipValue,children:y.value})]},y.id))]})]}),D&&D.entries.length>1&&l.jsx("ul",{className:Q.chart__legend,children:D.entries.map(y=>{const _=D.hidden.has(y.id);return l.jsx("li",{children:l.jsxs("button",{type:"button",className:Qt(Q.chart__legendItem,_&&Q["chart__legendItem--hidden"]),"aria-pressed":!_,onClick:()=>D.onToggle(y.id),children:[l.jsx(ze,{tone:y.tone,isHidden:_}),y.label]})},y.id)})}),s&&l.jsx("p",{id:I,className:Q.chart__srOnly,children:s}),l.jsx("div",{className:Q.chart__srOnly,children:l.jsxs("table",{children:[l.jsx("caption",{children:t}),l.jsx("thead",{children:l.jsx("tr",{children:S.columns.map((y,_)=>l.jsx("th",{scope:"col",children:y},_))})}),l.jsx("tbody",{children:S.rows.map((y,_)=>l.jsx("tr",{children:y.map((q,L)=>L===0?l.jsx("th",{scope:"row",children:q},L):l.jsx("td",{children:q},L))},_))})]})})]})},ze=({tone:t,isHidden:s})=>l.jsx("span",{"aria-hidden":!0,className:Q.chart__swatch,style:s?{backgroundColor:"transparent",boxShadow:`inset 0 0 0 2px ${Y(t)}`}:{backgroundColor:Y(t)}}),te=new Map,me=(t,s)=>{const e=`${t??""}|${JSON.stringify(s)}`;let n=te.get(e);return n||(n=new Intl.NumberFormat(t,s),te.set(e,n)),n},ee=t=>{if(t===0||!Number.isFinite(t))return null;const[s,e]=Math.abs(t).toExponential(9).split("e"),n=Number(e);return{first:n,last:n-(s.replace(".","").replace(/0+$/,"").length-1)}},At=t=>s=>{const e=s.reduce((n,c)=>{var i;return Math.min(n,((i=ee(c))==null?void 0:i.last)??n)},Number.POSITIVE_INFINITY);return s.map(n=>{var c;return me(t,{notation:"compact",maximumSignificantDigits:Math.min(21,Math.max(1,(((c=ee(n))==null?void 0:c.first)??0)-e+1))}).format(n)})},pt=t=>s=>me(t,{maximumFractionDigits:2}).format(s),qe=640,De=typeof window>"u"?()=>{}:f.useLayoutEffect,yt=t=>{const s=f.useRef(null),[e,n]=f.useState(t??qe);return De(()=>{if(t!==void 0){n(t);return}const c=s.current;if(!c)return;const i=d=>{const k=Math.floor(d);k>0&&n(A=>A===k?A:k)};if(i(c.clientWidth),typeof ResizeObserver>"u")return;const m=new ResizeObserver(([d])=>i(d.contentRect.width));return m.observe(c),()=>m.disconnect()},[t]),[s,e]},Ge="ui-line-CLpqU",Oe="ui-area-LkWXB",Be="ui-bar-260Bd",Ve="ui-point-Vc-kX",We="ui-marker-G-xZb",Ue="ui-crosshair-nV-xX",Xe="ui-band-jnG7s",Ye="ui-zero-GpHvw",nt={line:Ge,area:Oe,bar:Be,point:Ve,marker:We,crosshair:Ue,band:Xe,zero:Ye},Ze=280,ne="—",Qe=({label:t,description:s,data:e,xKey:n,xLabel:c,series:i,height:m=Ze,width:d,isStacked:k=!1,orientation:A="vertical",curve:T="monotone",hasPoints:C=!1,formatX:b=String,formatValue:R,domain:E,className:S,testId:D})=>{const{labels:z}=dt.useUi(),N=z==null?void 0:z.locale,[I,P]=yt(d),[$,j]=f.useState(()=>new Set),u=f.useMemo(()=>R??pt(N),[R,N]),p=f.useMemo(()=>At(N),[N]),a=f.useCallback(g=>g==null?"":b(g),[b]),h=f.useMemo(()=>i.map((g,F)=>({...g,tone:Tt(F,g.tone)})),[i]),r=f.useMemo(()=>h.filter(g=>!$.has(g.key)),[h,$]),o=f.useMemo(()=>ke({rows:e,xKey:n,series:r,width:P,height:m,isStacked:k,orientation:A,curve:T,formatX:a,formatLeft:p,formatRight:p,domain:E}),[e,n,r,P,m,k,A,T,a,p,E]),x=A==="horizontal"&&r.length>0&&r.every(g=>g.type==="bar"),M=r.some(g=>g.type==="bar"),w=f.useMemo(()=>{const g=o.centers.map((F,H)=>({center:F,index:H})).sort((F,H)=>F.center-H.center);return{centers:g.map(F=>F.center),indices:g.map(F=>F.index)}},[o.centers]),y=f.useCallback((g,F)=>{const{area:H}=o;if(g<H.left-4||g>H.right+4||F<H.top-4||F>H.bottom+4)return null;const X=_e(w.centers,x?F:g);return X<0?null:w.indices[X]},[o,w,x]),_=f.useCallback(g=>{var F;return{title:a((F=e[g])==null?void 0:F[n]),rows:r.map(H=>{var rt;const X=$t((rt=e[g])==null?void 0:rt[H.key]);return{id:H.key,label:H.label,tone:H.tone,value:X===null?ne:(H.format??u)(X)}})}},[e,n,r,u,a]),q=f.useCallback(g=>{const F=_(g);return`${F.title}: ${F.rows.map(H=>`${H.label} ${H.value}`).join(", ")}`},[_]),L=f.useMemo(()=>({columns:[c??n,...h.map(g=>g.label)],rows:e.map(g=>[a(g[n]),...h.map(F=>{const H=$t(g[F.key]);return H===null?ne:(F.format??u)(H)})])}),[e,n,c,h,u,a]),W=f.useMemo(()=>l.jsxs("g",{children:[x?l.jsxs(l.Fragment,{children:[l.jsx(ut,{area:o.area,ticks:o.leftTicks,side:"bottom",hasGrid:!0}),l.jsx(Ot,{area:o.area,ticks:o.categoryTicks,side:"left"})]}):l.jsxs(l.Fragment,{children:[l.jsx(ut,{area:o.area,ticks:o.leftTicks,side:"left",hasGrid:!0}),o.hasRightAxis&&l.jsx(ut,{area:o.area,ticks:o.rightTicks,side:"right"}),l.jsx(Ot,{area:o.area,ticks:o.categoryTicks,side:"bottom"})]}),o.zero!==null&&(x?l.jsx("line",{className:nt.zero,x1:o.zero,x2:o.zero,y1:o.area.top,y2:o.area.bottom}):l.jsx("line",{className:nt.zero,x1:o.area.left,x2:o.area.right,y1:o.zero,y2:o.zero})),o.areas.map(g=>l.jsx("path",{d:g.d,className:nt.area,style:{fill:`color-mix(in srgb, ${Y(g.tone)} 18%, transparent)`}},`area-${g.key}`)),o.bars.map(g=>l.jsx("rect",{className:nt.bar,x:g.x,y:g.y,width:g.width,height:g.height,rx:Math.min(3,g.width/4,g.height/4),style:{fill:Y(g.tone)}},`bar-${g.key}-${g.index}`)),o.lines.map(g=>l.jsx("path",{d:g.d,className:nt.line,style:{stroke:Y(g.tone)}},`line-${g.key}`)),r.filter(g=>g.type!=="bar").flatMap(g=>(o.points[g.key]??[]).map((F,H,X)=>F&&(C||!X[H-1]&&!X[H+1])?l.jsx("circle",{className:nt.point,cx:F.x,cy:F.y,r:3,style:{fill:Y(g.tone)}},`point-${g.key}-${H}`):null))]}),[o,C,x,r]),U=f.useCallback(g=>{if(!M||o.bandwidth<=0)return null;const{area:F}=o,H=o.centers[g],X=o.bandwidth*.12;return x?l.jsx("rect",{className:nt.band,x:F.left,width:F.width,y:H-o.bandwidth/2-X,height:o.bandwidth+X*2}):l.jsx("rect",{className:nt.band,y:F.top,height:F.height,x:H-o.bandwidth/2-X,width:o.bandwidth+X*2})},[o,x,M]),G=f.useCallback(g=>{const{area:F}=o,H=o.centers[g];return l.jsxs(l.Fragment,{children:[!M&&l.jsx("line",{className:nt.crosshair,x1:H,x2:H,y1:F.top,y2:F.bottom}),r.filter(X=>X.type!=="bar").map(X=>{var kt;const rt=(kt=o.points[X.key])==null?void 0:kt[g];return rt?l.jsx("circle",{className:nt.marker,cx:rt.x,cy:rt.y,r:4.5,style:{fill:Y(X.tone)}},X.key):null})]})},[o,r,M]);return l.jsx(ft,{label:t,description:s,containerRef:I,width:P,height:m,plot:W,overlay:G,underlay:U,itemCount:e.length,pick:y,tooltip:_,anchor:g=>o.anchors[g]??{x:0,y:0},announce:q,table:L,legend:{entries:h.map(g=>({id:g.key,label:g.label,tone:g.tone})),hidden:$,onToggle:g=>j(F=>{const H=new Set(F);return H.has(g)?H.delete(g):h.length-F.size>1&&H.add(g),H})},className:S,testId:D})},Et=f.memo(Qe),Je=({series:t,...s})=>{const e=f.useMemo(()=>t.map(n=>({...n,type:"line"})),[t]);return l.jsx(Et,{...s,series:e})},Ke=f.memo(at(Je,"LineChart")),tn=({series:t,...s})=>{const e=f.useMemo(()=>t.map(n=>({...n,type:"area"})),[t]);return l.jsx(Et,{...s,series:e})},en=f.memo(at(tn,"AreaChart")),nn=({series:t,...s})=>{const e=f.useMemo(()=>t.map(n=>({...n,type:"bar"})),[t]);return l.jsx(Et,{...s,series:e})},sn=f.memo(at(nn,"BarChart")),on=t=>l.jsx(Et,{...t}),an=f.memo(at(on,"ComposedChart")),cn="ui-slice-dFWuh",rn="ui-center__value-GnqKe",ln="ui-center__label-DsgTV",Nt={slice:cn,center__value:rn,center__label:ln},Ct=6,se=1.5,hn=({label:t,description:s,data:e,variant:n="donut",centerValue:c,centerLabel:i,valueLabel:m,height:d=260,width:k,formatValue:A,className:T,testId:C})=>{const{labels:b}=dt.useUi(),[R,E]=yt(k),[S,D]=f.useState(()=>new Set),z=f.useMemo(()=>pt(b==null?void 0:b.locale),[b==null?void 0:b.locale]),N=A??z,I=f.useMemo(()=>e.map((a,h)=>({...a,tone:Tt(h,a.tone)})),[e]),P=f.useMemo(()=>{const a=I.filter(_=>!S.has(_.id)&&Number.isFinite(_.value)&&_.value>0),h=a.reduce((_,q)=>_+q.value,0),r=E/2,o=d/2,x=Math.max(8,Math.min(E,d)/2-Ct-4),M=n==="donut"?x*.62:0;let w=0;const y=a.map(_=>{const q=h>0?_.value/h*Math.PI*2:0,L=w;return w+=q,{..._,start:L,end:w,share:h>0?_.value/h:0}});return{cx:r,cy:o,outer:x,inner:M,total:h,slices:y}},[I,S,E,d,n]),$=f.useMemo(()=>{const a=new Intl.NumberFormat(b==null?void 0:b.locale,{style:"percent",maximumFractionDigits:1});return h=>a.format(h)},[b==null?void 0:b.locale]),j=f.useMemo(()=>{const{cx:a,cy:h,outer:r,inner:o,slices:x,total:M}=P;return l.jsxs("g",{children:[x.map(w=>l.jsx("path",{className:Nt.slice,d:Yt(a,h,r,o,w.start,w.end),style:{fill:Y(w.tone),strokeWidth:x.length>1?se:0}},w.id)),n==="donut"&&l.jsxs("g",{"aria-hidden":!0,className:Nt.center,children:[l.jsx("text",{className:Nt.center__value,x:a,y:i?h-4:h,dy:"0.32em",textAnchor:"middle",children:c??N(M)}),i&&l.jsx("text",{className:Nt.center__label,x:a,y:h+16,dy:"0.32em",textAnchor:"middle",children:i})]})]})},[P,n,c,i,N]),u=f.useCallback((a,h)=>{const{cx:r,cy:o,outer:x,inner:M,slices:w}=P,y=Math.hypot(a-r,h-o);if(y>x+Ct||y<M)return null;let _=Math.atan2(a-r,-(h-o));_<0&&(_+=Math.PI*2);const q=w.findIndex(L=>_>=L.start&&_<L.end);return q<0?null:q},[P]),p=a=>{const h=P.slices[a];return`${N(h.value)} (${$(h.share)})`};return l.jsx(ft,{label:t,description:s,containerRef:R,width:E,height:d,plot:j,overlay:a=>{const{cx:h,cy:r,outer:o,inner:x,slices:M}=P,w=M[a],y=(w.start+w.end)/2,_=tt(0,0,Ct,y);return l.jsx("path",{className:Nt.slice,d:Yt(h+_.x,r+_.y,o,x,w.start,w.end),style:{fill:Y(w.tone),strokeWidth:se}})},itemCount:P.slices.length,pick:u,tooltip:a=>{const h=P.slices[a];return{rows:[{id:h.id,label:h.label,value:p(a),tone:h.tone}]}},anchor:a=>{const{cx:h,cy:r,outer:o,slices:x}=P,M=x[a];return tt(h,r,o+Ct,(M.start+M.end)/2)},tooltipSide:"outward",announce:a=>`${P.slices[a].label}: ${p(a)}`,table:{columns:[t,m],rows:I.map(a=>[a.label,Number.isFinite(a.value)?N(a.value):"—"])},legend:{entries:I.map(a=>({id:a.id,label:a.label,tone:a.tone})),hidden:S,onToggle:a=>D(h=>{const r=new Set(h);return r.has(a)?r.delete(a):I.length-h.size>1&&r.add(a),r})},className:T,testId:C})},un=f.memo(at(hn,"PieChart")),Wt=(t,s,e,{top:n=12,right:c=16,bottom:i=28}={})=>{const m=Math.max(32,...e.map(ht))+10;return{left:m,top:n,right:Math.max(m+1,t-c),bottom:Math.max(n+1,s-i),width:Math.max(1,t-c-m),height:Math.max(1,s-n-i)}},vt=(t,s)=>Math.max(2,Math.floor(t/(s?90:48))),mn=(t,s=24)=>{const e=new Map,n=(c,i)=>`${c}:${i}`;return t.forEach((c,i)=>{if(!Number.isFinite(c.x)||!Number.isFinite(c.y))return;const m=n(Math.floor(c.x/s),Math.floor(c.y/s)),d=e.get(m);d?d.push(i):e.set(m,[i])}),{nearest:(c,i,m)=>{const d=Math.ceil(m/s),k=Math.floor(c/s),A=Math.floor(i/s);let T=null,C=m*m;for(let b=-d;b<=d;b+=1)for(let R=-d;R<=d;R+=1)for(const E of e.get(n(k+b,A+R))??[]){const S=(t[E].x-c)**2+(t[E].y-i)**2;S<=C&&(C=S,T=E)}return T}}},dn="ui-point-YKyMm",xn="ui-marker-ToO1T",oe={point:dn,marker:xn},bt={plain:4,min:3,max:16},fn=22,pn=({label:t,description:s,series:e,xLabel:n,yLabel:c,sizeLabel:i,height:m=300,width:d,formatX:k,formatY:A,className:T,testId:C})=>{const{labels:b}=dt.useUi(),[R,E]=yt(d),[S,D]=f.useState(()=>new Set),z=f.useMemo(()=>pt(b==null?void 0:b.locale),[b==null?void 0:b.locale]),N=f.useMemo(()=>At(b==null?void 0:b.locale),[b==null?void 0:b.locale]),I=k??z,P=A??z,$=f.useMemo(()=>e.map((r,o)=>({...r,tone:Tt(o,r.tone)})),[e]),j=f.useMemo(()=>$.filter(r=>!S.has(r.id)).flatMap(r=>r.data.filter(o=>Number.isFinite(o.x)&&Number.isFinite(o.y)).map(o=>({...o,series:r}))).sort((r,o)=>r.x-o.x||r.y-o.y),[$,S]),u=f.useMemo(()=>{const r=jt(...xt(j.map(G=>G.x))),o=jt(...xt(j.map(G=>G.y))),x=ot(o[0],o[1],vt(m,!1)),M=Wt(E,m,N(x),{right:20}),w=mt(r,[M.left,M.right]),y=mt(o,[M.bottom,M.top]),_=Ht(j.map(G=>G.size)),[q,L]=xt(_),W=G=>G===void 0||!Number.isFinite(G)||_.length===0?bt.plain:L===q?(bt.min+bt.max)/2:Math.sqrt(bt.min**2+(G-q)/(L-q)*(bt.max**2-bt.min**2)),U=j.map(G=>({...G,cx:w(G.x),cy:y(G.y),r:W(G.size)}));return{area:M,placed:U,index:mn(U.map(G=>({x:G.cx,y:G.cy}))),xTicks:wt(ot(r[0],r[1],vt(M.width,!0)),w,N),yTicks:wt(x,y,N)}},[j,E,m,N]),p=f.useMemo(()=>l.jsxs("g",{children:[l.jsx(ut,{area:u.area,ticks:u.yTicks,side:"left",hasGrid:!0}),l.jsx(ut,{area:u.area,ticks:u.xTicks,side:"bottom",hasGrid:!0}),u.placed.map((r,o)=>l.jsx("circle",{className:oe.point,cx:r.cx,cy:r.cy,r:r.r,style:{fill:`color-mix(in srgb, ${Y(r.series.tone)} 72%, transparent)`,stroke:Y(r.series.tone)}},o))]}),[u]),a=f.useCallback((r,o)=>u.index.nearest(r,o,fn),[u]),h=r=>{const o=u.placed[r];return{title:o.label??o.series.label,rows:[{id:"series",label:o.series.label,value:"",tone:o.series.tone},{id:"x",label:n,value:I(o.x)},{id:"y",label:c,value:P(o.y)},...o.size!==void 0&&i?[{id:"size",label:i,value:z(o.size)}]:[]]}};return l.jsx(ft,{label:t,description:s,containerRef:R,width:E,height:m,plot:p,overlay:r=>{const o=u.placed[r];return l.jsx("circle",{className:oe.marker,cx:o.cx,cy:o.cy,r:o.r+3,style:{stroke:Y(o.series.tone)}})},itemCount:u.placed.length,pick:a,tooltip:h,anchor:r=>({x:u.placed[r].cx,y:u.placed[r].cy}),announce:r=>{const o=u.placed[r];return`${o.label?`${o.label}, `:""}${o.series.label}: ${n} ${I(o.x)}, ${c} ${P(o.y)}`},table:{columns:[t,n,c],rows:j.map(r=>[r.label??r.series.label,I(r.x),P(r.y)])},legend:{entries:$.map(r=>({id:r.id,label:r.label,tone:r.tone})),hidden:S,onToggle:r=>D(o=>{const x=new Set(o);return x.has(r)?x.delete(r):$.length-o.size>1&&x.add(r),x})},className:T,testId:C})},yn=f.memo(at(pn,"ScatterPlot")),gn="ui-labels-MJWYF",bn="ui-empty-AW7c9",Mn="ui-focus-hLQdB",It={labels:gn,empty:bn,focus:Mn},zt=8,_n=28,qt=140,ae=(t,s,e)=>{var c;const n=(c=t[s])==null?void 0:c[e];return typeof n=="number"&&Number.isFinite(n)?n:null},ce=t=>t.map((s,e)=>String(e)),$n=({label:t,description:s,columns:e,rows:n,values:c,valueLabel:i,tone:m="chart-1",height:d=280,width:k,formatValue:A,className:T,testId:C})=>{const{labels:b}=dt.useUi(),[R,E]=yt(k),S=f.useMemo(()=>pt(b==null?void 0:b.locale),[b==null?void 0:b.locale]),D=A??S,z=`ui-heat-${f.useId().replace(/:/g,"")}`,N=f.useMemo(()=>{const p={left:Math.min(E*.3,Math.max(32,...n.map(ht))+12),top:8,right:E-8,bottom:d-28-_n},a=Rt(ce(e),[p.left,p.right],{paddingInner:.06,paddingOuter:0}),h=Rt(ce(n),[p.top,p.bottom],{paddingInner:.06,paddingOuter:0}),[r,o]=xt(Ht(c.flat())),x=w=>w===null?null:o===r?60:zt+(w-r)/(o-r)*(100-zt),M=n.flatMap((w,y)=>e.map((_,q)=>{const L=ae(c,y,q);return{row:w,column:_,key:`${y}:${q}`,value:L,x:a(String(q)),y:h(String(y)),width:a.bandwidth,height:h.bandwidth,mix:x(L)}}));return{area:p,x:a,y:h,cells:M,min:r,max:o}},[e,n,c,E,d]),I=Y(m),P=f.useMemo(()=>{const{area:u,x:p,y:a,cells:h}=N,r=D(N.max),o=u.right-ht(r)-8,x=he(e.map((M,w)=>({position:p(String(w))+p.bandwidth/2,label:M})));return l.jsxs("g",{children:[h.map(M=>l.jsx("rect",{className:M.mix===null?It.empty:void 0,x:M.x,y:M.y,width:M.width,height:M.height,rx:2,style:M.mix===null?void 0:{fill:`color-mix(in srgb, ${I} ${M.mix}%, ${Gt.cssVar("bg-surface")})`}},M.key)),l.jsxs("g",{"aria-hidden":!0,className:It.labels,children:[n.map((M,w)=>l.jsx("text",{x:u.left-8,y:a(String(w))+a.bandwidth/2,dy:"0.32em",textAnchor:"end",children:St(M,u.left-12)},w)),x.map(M=>l.jsx("text",{x:M.position,y:u.bottom+16,textAnchor:"middle",children:M.label},M.position))]}),l.jsx("defs",{children:l.jsxs("linearGradient",{id:z,children:[l.jsx("stop",{offset:"0%",style:{stopColor:`color-mix(in srgb, ${I} ${zt}%, ${Gt.cssVar("bg-surface")})`}}),l.jsx("stop",{offset:"100%",style:{stopColor:I}})]})}),l.jsxs("g",{"aria-hidden":!0,className:It.labels,children:[l.jsx("rect",{x:o-qt,y:d-18,width:qt,height:8,rx:4,style:{fill:`url(#${z})`}}),l.jsx("text",{x:o-qt-8,y:d-14,dy:"0.32em",textAnchor:"end",children:D(N.min)}),l.jsx("text",{x:u.right,y:d-14,dy:"0.32em",textAnchor:"end",children:r})]})]})},[N,e,n,I,z,d,D]),$=f.useCallback((u,p)=>{const{area:a,x:h,y:r}=N;if(u<a.left||u>a.right||p<a.top||p>a.bottom)return null;const o=h.indexAt(u),x=r.indexAt(p);return o<0||x<0?null:x*e.length+o},[N,e.length]),j=u=>{const p=N.cells[u];return{cell:p,value:p.value===null?"—":D(p.value)}};return l.jsx(ft,{label:t,description:s,containerRef:R,width:E,height:d,plot:P,overlay:u=>{const p=N.cells[u];return l.jsx("rect",{className:It.focus,x:p.x-1,y:p.y-1,width:p.width+2,height:p.height+2,rx:3})},itemCount:N.cells.length,columns:e.length,pick:$,tooltip:u=>{const{cell:p,value:a}=j(u);return{title:`${p.row} · ${p.column}`,rows:[{id:"value",label:i,value:a,tone:m}]}},anchor:u=>{const p=N.cells[u];return{x:p.x+p.width/2,y:p.y+p.height/2}},announce:u=>{const{cell:p,value:a}=j(u);return`${p.row}, ${p.column}: ${i} ${a}`},table:{columns:[t,...e],rows:n.map((u,p)=>[u,...e.map((a,h)=>{const r=ae(c,p,h);return r===null?"—":D(r)})])},className:T,testId:C})},wn=f.memo(at($n,"Heatmap")),jn="ui-box-7zEQ-",kn="ui-median-J5g6o",Nn="ui-outlier-M0VN-",vn="ui-band-kK09D",Ft={box:jn,median:kn,outlier:Nn,band:vn},Tn=({label:t,description:s,groups:e,groupLabel:n,labels:c,height:i=280,width:m,formatValue:d,className:k,testId:A})=>{const{labels:T}=dt.useUi(),[C,b]=yt(m),R=f.useMemo(()=>pt(T==null?void 0:T.locale),[T==null?void 0:T.locale]),E=f.useMemo(()=>At(T==null?void 0:T.locale),[T==null?void 0:T.locale]),S=d??R,D=f.useMemo(()=>e.map(($,j)=>({group:$,tone:Tt(j,$.tone),stats:$e($.values)})),[e]),z=f.useMemo(()=>{const $=D.flatMap(x=>x.stats?[x.stats.min,x.stats.max]:[]),[j,u]=$.length?xt($):[0,1],p=jt(j,u),a=ot(p[0],p[1],vt(i,!1)),h=Wt(b,i,E(a)),r=Rt(e.map(x=>x.id),[h.left,h.right],{paddingInner:.4,paddingOuter:.2}),o=mt(p,[h.bottom,h.top]);return{area:h,band:r,y:o,yTicks:wt(a,o,E),groupTicks:e.map(x=>({position:r(x.id)+r.bandwidth/2,label:x.label}))}},[D,e,b,i,E]),N=$=>[{id:"max",label:c.max,value:S($.whiskerHigh)},{id:"q3",label:c.q3,value:S($.q3)},{id:"median",label:c.median,value:S($.median)},{id:"q1",label:c.q1,value:S($.q1)},{id:"min",label:c.min,value:S($.whiskerLow)},...$.outliers.length>0?[{id:"outliers",label:c.outliers,value:R($.outliers.length)}]:[],{id:"count",label:c.count,value:R($.count)}],I=f.useMemo(()=>{const{area:$,band:j,y:u}=z;return l.jsxs("g",{children:[l.jsx(ut,{area:$,ticks:z.yTicks,side:"left",hasGrid:!0}),l.jsx(Ot,{area:$,ticks:z.groupTicks,side:"bottom"}),D.map(({group:p,tone:a,stats:h})=>{if(!h)return null;const r=j(p.id),o=r+j.bandwidth/2,x=j.bandwidth*.3,M=Y(a);return l.jsxs("g",{style:{stroke:M},className:Ft.box,children:[l.jsx("line",{x1:o,x2:o,y1:u(h.whiskerHigh),y2:u(h.q3)}),l.jsx("line",{x1:o,x2:o,y1:u(h.q1),y2:u(h.whiskerLow)}),l.jsx("line",{x1:o-x,x2:o+x,y1:u(h.whiskerHigh),y2:u(h.whiskerHigh)}),l.jsx("line",{x1:o-x,x2:o+x,y1:u(h.whiskerLow),y2:u(h.whiskerLow)}),l.jsx("rect",{x:r,width:j.bandwidth,y:u(h.q3),height:Math.max(1,u(h.q1)-u(h.q3)),rx:2,style:{fill:`color-mix(in srgb, ${M} 22%, transparent)`}}),l.jsx("line",{className:Ft.median,x1:r,x2:r+j.bandwidth,y1:u(h.median),y2:u(h.median)}),h.outliers.map((w,y)=>l.jsx("circle",{className:Ft.outlier,cx:o,cy:u(w),r:3},y))]},p.id)})]})},[z,D]),P=f.useCallback(($,j)=>{const{area:u,band:p}=z;if($<u.left||$>u.right||j<u.top-4||j>u.bottom+4)return null;const a=p.indexAt($);return a<0?null:a},[z]);return l.jsx(ft,{label:t,description:s,containerRef:C,width:b,height:i,plot:I,underlay:$=>{const{area:j,band:u}=z,p=u.step*.2;return l.jsx("rect",{className:Ft.band,x:u(e[$].id)-p,width:u.bandwidth+p*2,y:j.top,height:j.height})},overlay:()=>null,itemCount:e.length,pick:P,tooltip:$=>{const j=D[$];return{title:j.group.label,rows:j.stats?N(j.stats).map(u=>({...u,tone:u.id==="median"?j.tone:void 0})):[]}},anchor:$=>{const j=D[$],{band:u,y:p}=z;return{x:u(j.group.id)+u.bandwidth/2,y:j.stats?p(j.stats.q3):z.area.bottom}},announce:$=>{const j=D[$];return j.stats?`${j.group.label}: ${N(j.stats).map(u=>`${u.label} ${u.value}`).join(", ")}`:j.group.label},table:{columns:[n,c.min,c.q1,c.median,c.q3,c.max,c.count],rows:D.map(({group:$,stats:j})=>j?[$.label,S(j.whiskerLow),S(j.q1),S(j.median),S(j.q3),S(j.whiskerHigh),R(j.count)]:[$.label,"—","—","—","—","—","0"])},className:k,testId:A})},An=f.memo(at(Tn,"BoxPlot")),Cn="ui-baseline-wWs7h",In="ui-band-xvYtL",re={baseline:Cn,band:In},Mt=1,Fn=({label:t,description:s,values:e,bins:n,valueLabel:c,countLabel:i,tone:m="chart-1",height:d=260,width:k,formatValue:A,className:T,testId:C})=>{const{labels:b}=dt.useUi(),[R,E]=yt(k),S=f.useMemo(()=>pt(b==null?void 0:b.locale),[b==null?void 0:b.locale]),D=f.useMemo(()=>At(b==null?void 0:b.locale),[b==null?void 0:b.locale]),z=A??S,N=f.useMemo(()=>we(e,n),[e,n]),I=f.useMemo(()=>{var w,y;const u=Math.max(1,...N.map(_=>_.count)),p=jt(0,u),a=ot(0,p[1],vt(d,!1)).filter(Number.isInteger),h=Wt(E,d,D(a)),r=((w=N[0])==null?void 0:w.from)??0,o=((y=N[N.length-1])==null?void 0:y.to)??1,x=mt([r,o],[h.left,h.right]),M=mt(p,[h.bottom,h.top]);return{area:h,columns:N.map(_=>({x:x(_.from)+Mt/2,width:Math.max(1,x(_.to)-x(_.from)-Mt),y:M(_.count),height:Math.max(0,h.bottom-M(_.count)),center:(x(_.from)+x(_.to))/2})),xTicks:wt(ot(r,o,vt(h.width,!0)),x,D),yTicks:wt(a,M,D)}},[N,E,d,D]),P=u=>`${z(N[u].from)} – ${z(N[u].to)}`,$=f.useMemo(()=>l.jsxs("g",{children:[l.jsx(ut,{area:I.area,ticks:I.yTicks,side:"left",hasGrid:!0}),l.jsx(ut,{area:I.area,ticks:I.xTicks,side:"bottom"}),l.jsx("line",{className:re.baseline,x1:I.area.left,x2:I.area.right,y1:I.area.bottom,y2:I.area.bottom}),I.columns.map((u,p)=>u.height>0?l.jsx("rect",{x:u.x,y:u.y,width:u.width,height:u.height,style:{fill:Y(m)}},p):null)]}),[I,m]),j=f.useCallback((u,p)=>{const{area:a,columns:h}=I;if(u<a.left||u>a.right||p<a.top-4||p>a.bottom+4)return null;const r=h.findIndex(o=>u>=o.x-Mt&&u<=o.x+o.width+Mt);return r<0?null:r},[I]);return l.jsx(ft,{label:t,description:s,containerRef:R,width:E,height:d,plot:$,underlay:u=>{const p=I.columns[u];return l.jsx("rect",{className:re.band,x:p.x-Mt/2,width:p.width+Mt,y:I.area.top,height:I.area.height})},overlay:()=>null,itemCount:N.length,pick:j,tooltip:u=>({title:P(u),rows:[{id:"count",label:i,value:S(N[u].count),tone:m}]}),anchor:u=>({x:I.columns[u].center,y:I.columns[u].y}),announce:u=>`${c} ${P(u)}: ${i} ${S(N[u].count)}`,table:{columns:[c,i],rows:N.map((u,p)=>[P(p),S(u.count)])},className:T,testId:C})},Rn=f.memo(at(Fn,"Histogram")),Sn="ui-grid-fHioN",Ln="ui-shape-Vbb9D",Hn="ui-labels-nRfEk",En="ui-axisLabel-UOZQ7",Pn="ui-spoke-P-6cp",zn="ui-marker-xzn9h",_t={grid:Sn,shape:Ln,labels:Hn,axisLabel:En,spoke:Pn,marker:zn},le=10,qn=16,Dn=28,Dt=(t,s)=>{const e=t.values[s];return typeof e=="number"&&Number.isFinite(e)?e:null},Gn=({label:t,description:s,axes:e,series:n,max:c,height:i=320,width:m,formatValue:d,className:k,testId:A})=>{const{labels:T}=dt.useUi(),[C,b]=yt(m),[R,E]=f.useState(()=>new Set),S=f.useMemo(()=>At(T==null?void 0:T.locale),[T==null?void 0:T.locale]),D=f.useMemo(()=>pt(T==null?void 0:T.locale),[T==null?void 0:T.locale]),z=d??D,N=f.useMemo(()=>n.map((a,h)=>({...a,tone:Tt(h,a.tone)})),[n]),I=f.useMemo(()=>N.filter(a=>!R.has(a.id)),[N,R]),P=f.useMemo(()=>{const a=e.length,h=a>0?Math.PI*2/a:0,r=e.map((W,U)=>U*h),o=Math.min(b*.22,Math.max(0,...e.map(W=>ht(W.label)))),x=Math.max(24,Math.min(i/2-24,b/2-o-le-4)),M=b/2,w=i/2;let y=0;for(const W of n)for(const U of e){const G=Dt(W,U.key);G!==null&&G>y&&(y=G)}const _=c!==void 0&&c>0?c:jt(0,y,4)[1],q=ot(0,_,4).filter(W=>W>0);return{cx:M,cy:w,radius:x,angles:r,step:h,top:_,rings:q,scale:W=>Math.min(Math.max(W,0),_)/_*x,labelRoom:o}},[e,n,c,b,i]),$=f.useMemo(()=>{const{cx:a,cy:h,angles:r,scale:o}=P;return I.map(x=>({...x,points:e.map((M,w)=>{const y=Dt(x,M.key);return{...tt(a,h,o(y??0),r[w]),value:y}})}))},[P,I,e]),j=f.useMemo(()=>{const{cx:a,cy:h,radius:r,angles:o,rings:x,scale:M,labelRoom:w}=P,y=x.length>0?M(x[0]):r,_=Math.max(1,Math.ceil(qn/Math.max(1,y))),q=S(x);return l.jsxs("g",{children:[l.jsxs("g",{"aria-hidden":!0,className:_t.grid,children:[x.map(L=>l.jsx("path",{d:Zt(o.map(W=>tt(a,h,M(L),W)))},L)),o.map((L,W)=>{const U=tt(a,h,r,L);return l.jsx("line",{x1:a,y1:h,x2:U.x,y2:U.y},e[W].key)})]}),$.map(L=>l.jsx("path",{className:_t.shape,d:Zt(L.points),style:{fill:`color-mix(in srgb, ${Y(L.tone)} 14%, transparent)`,stroke:Y(L.tone)}},L.id)),l.jsxs("g",{"aria-hidden":!0,className:_t.labels,children:[x.map((L,W)=>(x.length-1-W)%_===0?l.jsx("text",{x:a+4,y:h-M(L),dy:"1.1em",children:q[W]},L):null),e.map((L,W)=>{const U=o[W],G=tt(a,h,r+le,U),g=Math.sin(U),F=Math.cos(U),H=g>.3?"start":g<-.3?"end":"middle",X=F>.3?"-0.2em":F<-.3?"0.9em":"0.32em";return l.jsx("text",{className:_t.axisLabel,x:G.x,y:G.y,dy:X,textAnchor:H,children:St(L.label,H==="middle"?r*1.4:w)},L.key)})]})]})},[P,$,e,S]),u=f.useCallback((a,h)=>{const{cx:r,cy:o,radius:x,step:M}=P;if(e.length===0||Math.hypot(a-r,h-o)>x+Dn)return null;let w=Math.atan2(a-r,-(h-o));return w<0&&(w+=Math.PI*2),Math.round(w/M)%e.length},[P,e.length]),p=a=>$.map(h=>{const r=h.points[a].value;return{id:h.id,label:h.label,value:r===null?"—":z(r),tone:h.tone}});return l.jsx(ft,{label:t,description:s,containerRef:C,width:b,height:i,plot:j,overlay:a=>{const{cx:h,cy:r,radius:o,angles:x}=P,M=tt(h,r,o,x[a]);return l.jsxs("g",{children:[l.jsx("line",{className:_t.spoke,x1:h,y1:r,x2:M.x,y2:M.y}),$.map(w=>{const y=w.points[a];return y.value===null?null:l.jsx("circle",{className:_t.marker,cx:y.x,cy:y.y,r:4.5,style:{fill:Y(w.tone)}},w.id)})]})},itemCount:e.length,pick:u,tooltip:a=>({title:e[a].label,rows:p(a)}),anchor:a=>{const{cx:h,cy:r,radius:o,angles:x}=P;let M=0;for(const w of $){const y=w.points[a];M=Math.max(M,Math.hypot(y.x-h,y.y-r))}return tt(h,r,Math.min(o,M),x[a])},tooltipSide:"outward",announce:a=>`${e[a].label}: ${p(a).map(h=>`${h.label} ${h.value}`).join(", ")}`,table:{columns:[t,...N.map(a=>a.label)],rows:e.map(a=>[a.label,...N.map(h=>{const r=Dt(h,a.key);return r===null?"—":z(r)})])},legend:N.length>1?{entries:N.map(a=>({id:a.id,label:a.label,tone:a.tone})),hidden:R,onToggle:a=>E(h=>{const r=new Set(h);return r.has(a)?r.delete(a):N.length-h.size>1&&r.add(a),r})}:void 0,className:k,testId:A})},On=f.memo(at(Gn,"RadarChart"));exports.AreaChart=en;exports.BarChart=sn;exports.BoxPlot=An;exports.ComposedChart=an;exports.Heatmap=wn;exports.Histogram=Rn;exports.LineChart=Ke;exports.PieChart=un;exports.RadarChart=On;exports.ScatterPlot=yn;
2
2
  //# sourceMappingURL=charts.cjs.map