"use strict";(globalThis.webpackChunksuperset=globalThis.webpackChunksuperset||[]).push([[2580],{62580:(e,t,r)=>{r.r(t),r.d(t,{default:()=>s}),r(67294);var n=r(63475),c=r(11965);function s(e){const{height:t,width:r,echartOptions:s,refs:u,onLegendStateChanged:h}=e,i={legendselectchanged:e=>{null==h||h(e.selected)},legendselectall:e=>{null==h||h(e.selected)},legendinverseselect:e=>{null==h||h(e.selected)}};return(0,c.tZ)(n.Z,{refs:u,height:t,width:r,echartOptions:s,eventHandlers:i})}},63475:(e,t,r)=>{r.d(t,{Z:()=>l});var n=r(67294),c=r(51995),s=r(31431),u=r(11965);const h=c.iK.div`
  height: ${({height:e})=>e};
  width: ${({width:e})=>e};
`;function i({width:e,height:t,echartOptions:r,eventHandlers:c,zrEventHandlers:i,selectedValues:l={},refs:d},a){const o=(0,n.useRef)(null);d&&(d.divRef=o);const f=(0,n.useRef)(),g=(0,n.useMemo)((()=>Object.keys(l)||[]),[l]),p=(0,n.useRef)([]);(0,n.useImperativeHandle)(a,(()=>({getEchartInstance:()=>f.current}))),(0,n.useEffect)((()=>{o.current&&(f.current||(f.current=(0,s.S1)(o.current)),Object.entries(c||{}).forEach((([e,t])=>{var r,n;null==(r=f.current)||r.off(e),null==(n=f.current)||n.on(e,t)})),Object.entries(i||{}).forEach((([e,t])=>{var r,n;null==(r=f.current)||r.getZr().off(e),null==(n=f.current)||n.getZr().on(e,t)})),f.current.setOption(r,!0))}),[r,c,i]),(0,n.useEffect)((()=>{f.current&&(f.current.dispatchAction({type:"downplay",dataIndex:p.current.filter((e=>!g.includes(e)))}),g.length&&f.current.dispatchAction({type:"highlight",dataIndex:g}),p.current=g)}),[g]);const w=(0,n.useCallback)((({width:e,height:t})=>{f.current&&f.current.resize({width:e,height:t})}),[]);return(0,n.useEffect)((()=>(w({width:e,height:t}),()=>{var e;return null==(e=f.current)?void 0:e.dispose()})),[]),(0,n.useLayoutEffect)((()=>{w({width:e,height:t})}),[e,t,w]),(0,u.tZ)(h,{ref:o,height:t,width:e})}const l=(0,n.forwardRef)(i)}}]);
//# sourceMappingURL=6c07761ce5b5c3aa7c22.chunk.js.map