import{d as h}from"./debounce-Xd493GvO.js";import{a as _}from"./echarts_auto_tooltip-BNPm6hqZ.js";import{r as g}from"./request-CEvu378m.js";import{ar as x}from"./echarts-DB130vfq.js";import{r as c,s as K,ax as j,c as y,w as d,j as z,n as L,X as O,S as k,B,z as E}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 X=Object.assign({name:"Pie"},{__name:"Pie",props:{propValue:{type:Object,default:()=>{}},request:{type:Object,default:()=>{}},element:{type:Object,default:()=>{}}},setup(b){const e=b,s=c(null),t=c(null),a=K(null),f=c(null),u=j(),n=y(()=>e.propValue),q=y(()=>{const l=e.element.style.width,o=e.element.style.height;return{width:l,height:o}});function m(){a.value.clear(),a.value.setOption(n.value,!0),t.value&&(t.value.clearLoop(),t.value=null),e.propValue.autoPlay&&(t.value=_(a.value,n.value,{interval:e.propValue.autoPlayTime*1e3,loopSeries:!1,seriesIndex:0}))}function i(){a.value.resize()}return d(q,h(l=>{i()},1e3),{deep:!0}),d(n,h(l=>{m()},1e3),{deep:!0}),z(()=>{var l,o;e.request&&(s.value=g(e.request,e.propValue.series[0],"data")),((o=(l=e.request)==null?void 0:l.global)==null?void 0:o.length)>0&&d(()=>u.state.globalKey,()=>{e.request.global.forEach(w=>{const p=u.state.globalKey.findIndex(r=>r.globalKey===w);if(p>-1){const r=[u.state.globalKey[p].globalKey,u.state.globalKey[p].globalValue],v=e.request.data.findIndex(V=>V[0]===r[0]);v>-1?e.request.data[v][1]=r[1]:e.request.data.push(r)}}),s.value(),s.value=g(e.request,e.propValue.series[0],"data")},{deep:!0}),a.value=x(f.value,"vintage"),L(()=>{m()}),window.addEventListener("resize",i)}),O(()=>{e.propValue.request&&s.value()}),k(()=>{window.removeEventListener("resize",i),a.value.clear(),a.value=null,t.value&&(t.value.clearLoop(),t.value=null)}),(l,o)=>(E(),B("div",{ref_key:"chartRef",ref:f,style:{width:"100%",height:"100%"}},null,512))}});export{X as default};
