import{d as b}from"./debounce-Xd493GvO.js";import{r as g}from"./request-CEvu378m.js";import{ar as V}from"./echarts-DB130vfq.js";import{ax as x,r as y,s as C,c as d,j as K,w as f,S,B as j,z}from"./vue-BJk78QHK.js";import"./index-M_JNBppB.js";import"./element-3_pOinej.js";import"./utils-YI6ye1sf.js";import"./threejs-BafxXW5-.js";import"./vxe-Dx3zSILm.js";const N=Object.assign({name:"Pie1"},{__name:"Pie1",props:{propValue:{type:Object,required:!0},request:{type:Object,default:()=>{}},element:{type:Object,default:()=>{}}},setup(w){const e=w,i=x(),m=y(null),t=C(null),n=y(null),c=d(()=>e.propValue.data.data),o=d(()=>e.propValue.data.color),q=d(()=>{const a=e.element.style.width,l=e.element.style.height;return{width:a,height:l}}),v=d(()=>{const a=JSON.parse(JSON.stringify(e.propValue.option)),l=[];return c.value.forEach((r,u)=>{l.push({value:r.value,name:r.name,itemStyle:{borderWidth:5,shadowBlur:20,borderColor:o.value[u%o.value.length],shadowColor:o.value[u%o.value.length]}}),l.push({value:c.value.reduce((s,p)=>s+p.value,0)*.01,name:"",itemStyle:{color:"rgba(0, 0, 0, 0)",borderColor:"rgba(0, 0, 0, 0)",borderWidth:0},label:{show:!1},labelLine:{show:!1}})}),a.series[0].data=l,a.series[0].labelLine.color=r=>o.value[r.dataIndex%o.value.length],a.legend.show&&(a.legend.data=c.value.map(r=>r.name)),a.color=o.value,a});function O(){t.value&&t.value.dispose(),t.value=V(m.value),t.value.setOption(v.value)}function h(){t.value&&t.value.resize()}return K(()=>{var a,l;e.request&&(n.value=g(e.request,e.propValue,"data")),((l=(a=e.request)==null?void 0:a.global)==null?void 0:l.length)>0&&f(()=>i.state.globalKey,()=>{e.request.global.forEach(r=>{const u=i.state.globalKey.findIndex(s=>s.globalKey===r);if(u>-1){const s=[i.state.globalKey[u].globalKey,i.state.globalKey[u].globalValue],p=e.request.data.findIndex(_=>_[0]===s[0]);p>-1?e.request.data[p][1]=s[1]:e.request.data.push(s)}}),n.value(),n.value=g(e.request,e.propValue,"data")},{deep:!0}),O(),window.addEventListener("resize",h)}),S(()=>{window.removeEventListener("resize",h),e.propValue.request&&n.value&&n.value(),t.value&&(t.value.dispose(),t.value=null)}),f(()=>v,b(()=>{t.value&&t.value.setOption(v.value,!0)},300),{deep:!0}),f(q,b(()=>{h()},300),{deep:!0}),(a,l)=>(z(),j("div",{ref_key:"chartRef",ref:m,style:{width:"100%",height:"100%"}},null,512))}});export{N as default};
