import{j as d}from"./mui-vendor-CkIVaoQP.js";import{r as p}from"./react-vendor-CmFgShSM.js";import{J as b,K as v}from"./chart-vendor-sE2SUVPW.js";import{G as w}from"./index-Vwb3Bce5.js";const E=({info:e,title:r,seperator:h,type:l,group:y})=>{const[o,m]=p.useState(y),s=p.useRef(null),n=["#1105f5","#f50505","#f5056d","#f505f5","#05a5f5","#05f5bd","#05f57d","#1f4f33","#95DFD3","#AEC7ED","#92BFFF","#B1B1E0","#fdcb6e","#636e72","#d63031","#7f8fa6","#40739e"],a=t=>n[t%n.length],C=(t,u)=>({type:"linear",x:0,y:0,x2:0,y2:1,colorStops:[{offset:0,color:t},{offset:1,color:u}]}),f=t=>{s.current=t},x=()=>{m(t=>!t),s.current&&s.current.setOption(i())},i=()=>l==="pie"?{title:{text:r,textStyle:{fontWeight:"bold",fontSize:16,fontFamily:"iranyekan"},left:"center",padding:10},tooltip:{trigger:"item",formatter:"{a} <br/>{b}: {c} ({d}%)"},legend:{orient:"vertical",right:10,top:"center",data:e==null?void 0:e.map(t=>t==null?void 0:t.name),textStyle:{fontFamily:"iranyekan",width:100,overflow:"truncate",ellipsis:"..."}},color:e==null?void 0:e.map((t,u)=>a(u)),series:[{name:r,type:"pie",radius:["40%","70%"],avoidLabelOverlap:!1,itemStyle:{borderRadius:10,borderColor:"#fff",borderWidth:2},label:{show:!1,position:"center"},emphasis:{label:{show:!0,fontSize:"18",fontWeight:"bold"}},labelLine:{show:!1},data:e==null?void 0:e.map((t,u)=>({value:t.data[0],name:t.name,itemStyle:{color:a(u)}}))}],textStyle:{fontFamily:"iranyekan"}}:{title:{text:r,textStyle:{fontWeight:"bold",fontSize:16,fontFamily:"iranyekan"},left:"center",padding:10},xAxis:{type:"category",data:h,axisLabel:{rotate:30,interval:0,width:60,overflow:"truncate",fontSize:10}},yAxis:o?[{type:"value",axisLabel:{formatter:function(t){return t=+t,isFinite(t)?v(+t/1e3):""}}}]:{type:"value"},dataZoom:[{show:!1,start:0,end:100},{type:"inside",start:94,end:100}],toolbox:{show:!0,feature:{mark:{show:!0,title:{mark:"علامت گذاری",markUndo:"حذف علامت",markClear:"پاک کردن همه علامت‌ها"}},magicType:{show:!0,type:["line","bar"],title:{line:"خطی",bar:"میله‌ای",pie:"دایره ای"}},saveAsImage:{show:!0,title:"ذخیره به عنوان تصویر"},myCustomButton:{show:!0,title:o?"نمایش گروهی":"نمایش جداگانه",icon:"path://M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z",onclick:x}}},grid:{top:"20%",left:"1%",right:"1%",containLabel:!0},textStyle:{fontFamily:"iranyekan"},color:e==null?void 0:e.map((t,u)=>a(u)),series:e==null?void 0:e.map((t,u)=>{const c=a(u),g=a(u+1);return{...t,smooth:!0,type:l,itemStyle:{color:c},areaStyle:{color:C(c,g)},emphasis:{focus:"series"},stack:o?!1:"stack"}}),tooltip:{trigger:"axis",axisPointer:{type:"cross"}},legend:{data:e==null?void 0:e.map(t=>t==null?void 0:t.name),itemGap:10,top:"10%",type:"scroll",padding:[5,50],textStyle:{width:100,overflow:"truncate",ellipsis:"..."}}};return d.jsx(w,{xs:12,style:{height:"100%"},children:d.jsx(b,{option:i(),style:{height:"100%",width:"100%"},onChartReady:f})})};export{E as A};
