import{d as m}from"./debounce-Xd493GvO.js";import{r as h}from"./request-CEvu378m.js";import{ar as O}from"./echarts-DB130vfq.js";import{ax as _,r as v,s as V,c as g,j as x,w as p,S as K,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:"Bar2"},{__name:"Bar2",props:{propValue:{type:Object,required:!0},request:{type:Object,default:()=>{}},element:{type:Object,default:()=>{}}},setup(b){const e=b,n=_(),c=v(null),a=V(null),o=v(null),y=g(()=>{const r=e.element.style.width,t=e.element.style.height;return{width:r,height:t}}),d=g(()=>{const r=JSON.parse(JSON.stringify(e.propValue.option)),t=e.propValue.data;return r.xAxis[0].data=t.xData,t.series&&t.series.length>0&&r.series.forEach((u,s)=>{t.series[s]&&(u.name=t.series[s].name,u.data=t.series[s].data)}),r});function q(){a.value&&a.value.dispose(),a.value=O(c.value),a.value.setOption(d.value)}function i(){a.value&&a.value.resize()}return x(()=>{var r,t;e.request&&(o.value=h(e.request,e.propValue,"data")),((t=(r=e.request)==null?void 0:r.global)==null?void 0:t.length)>0&&p(()=>n.state.globalKey,()=>{e.request.global.forEach(u=>{const s=n.state.globalKey.findIndex(l=>l.globalKey===u);if(s>-1){const l=[n.state.globalKey[s].globalKey,n.state.globalKey[s].globalValue],f=e.request.data.findIndex(w=>w[0]===l[0]);f>-1?e.request.data[f][1]=l[1]:e.request.data.push(l)}}),o.value(),o.value=h(e.request,e.propValue,"data")},{deep:!0}),q(),window.addEventListener("resize",i)}),K(()=>{window.removeEventListener("resize",i),e.propValue.request&&o.value&&o.value(),a.value&&(a.value.dispose(),a.value=null)}),p(()=>e.propValue,m(()=>{a.value&&a.value.setOption(d.value,!0)},300),{deep:!0}),p(y,m(()=>{i()},300),{deep:!0}),(r,t)=>(z(),j("div",{ref_key:"chartRef",ref:c,style:{width:"100%",height:"100%"}},null,512))}});export{N as default};
