'use client';
import{__rest as t}from"tslib";import e from"react";import{twMerge as a}from"tailwind-merge";import{ResponsiveContainer as o,PieChart as n,Pie as r,Tooltip as i}from"recharts";import l from"../common/NoData.js";import{hexColors as m}from"../../../lib/hexColors.js";import{DEFAULT_COLOR as s,themeColorRange as c}from"../../../lib/theme.js";import{defaultValueFormatter as d}from"../../../lib/utils.js";import{parseLabelInput as u,parseData as p}from"./inputParser.js";import{DonutChartTooltip as h}from"./DonutChartTooltip.js";const f=e.forwardRef(((f,v)=>{const{data:w=[],category:x="value",index:g="name",colors:y=c,variant:b="donut",valueFormatter:D=d,label:A,showLabel:E=!0,animationDuration:j=1500,showAnimation:T=!0,showTooltip:N=!0,className:C,noDataText:F}=f,R=t(f,["data","category","index","colors","variant","valueFormatter","label","showLabel","animationDuration","showAnimation","showTooltip","className","noDataText"]),K="donut"==b,L=u(A,D,w,x);return e.createElement("div",Object.assign({ref:v,className:a("w-full h-44",C)},R),e.createElement(o,{width:"100%",height:"100%"},(null==w?void 0:w.length)?e.createElement(n,null,E&&K?e.createElement("text",{x:"50%",y:"50%",textAnchor:"middle",dominantBaseline:"middle",fill:m[s]},L):null,e.createElement(r,{data:p(w,y),cx:"50%",cy:"50%",startAngle:90,endAngle:-270,innerRadius:K?"75%":"0%",outerRadius:"100%",paddingAngle:0,dataKey:x,nameKey:g,isAnimationActive:T,animationDuration:j}),N?e.createElement(i,{wrapperStyle:{outline:"none"},content:({active:t,payload:a})=>e.createElement(h,{active:t,payload:a,valueFormatter:D})}):null):e.createElement(l,{noDataText:F})))}));f.displayName="DonutChart";export{f as default};
