"use strict";(globalThis.webpackChunksuperset=globalThis.webpackChunksuperset||[]).push([[704],{33738:(e,t,r)=>{r.r(t),r.d(t,{default:()=>u});var n=r(67294),s=r(63475),a=r(6915),l=r(11965);function u({height:e,width:t,echartOptions:r,setDataMask:u,labelMap:c,labelMapB:i,groupby:h,groupbyB:o,selectedValues:d,formData:f,seriesBreakdown:p}){const g=(0,n.useCallback)((e=>e<p),[p]),m=(0,n.useCallback)(((e,t)=>{if(!(g(t)?f.emitFilter:f.emitFilterB))return;const r=g(t)?h:o,n=g(t)?c:i,s=e.map((e=>n[e])).filter((e=>!!e));u({extraFormData:{filters:0===e.length?[]:[...r.map(((e,t)=>{const r=s.map((e=>e[t]));return null==r?{col:e,op:"IS NULL"}:{col:e,op:"IN",val:r}}))]},filterState:{value:s.length?s:null,selectedValues:e.length?e:null}})}),[h,o,c,i,u,d]),b={click:e=>{const{seriesName:t,seriesIndex:r}=e,n=Object.values(d);n.includes(t)?m(n.filter((e=>e!==t)),r):m([t],r)},mouseout:()=>{a.aI.name=""},mouseover:e=>{a.aI.name=e.seriesName}};return(0,l.tZ)(s.Z,{height:e,width:t,echartOptions:r,eventHandlers:b,selectedValues:d})}},63475:(e,t,r)=>{r.d(t,{Z:()=>i});var n=r(67294),s=r(51995),a=r(29027),l=r(11965);const u=s.iK.div`
  height: ${({height:e})=>e};
  width: ${({width:e})=>e};
`;function c({width:e,height:t,echartOptions:r,eventHandlers:s,zrEventHandlers:c,selectedValues:i={}},h){const o=(0,n.useRef)(null),d=(0,n.useRef)(),f=(0,n.useMemo)((()=>Object.keys(i)||[]),[i]),p=(0,n.useRef)([]);return(0,n.useImperativeHandle)(h,(()=>({getEchartInstance:()=>d.current}))),(0,n.useEffect)((()=>{o.current&&(d.current||(d.current=(0,a.S1)(o.current)),Object.entries(s||{}).forEach((([e,t])=>{var r,n;null==(r=d.current)||r.off(e),null==(n=d.current)||n.on(e,t)})),Object.entries(c||{}).forEach((([e,t])=>{var r,n;null==(r=d.current)||r.getZr().off(e),null==(n=d.current)||n.getZr().on(e,t)})),d.current.setOption(r,!0))}),[r,s,c]),(0,n.useEffect)((()=>{d.current&&(d.current.dispatchAction({type:"downplay",dataIndex:p.current.filter((e=>!f.includes(e)))}),f.length&&d.current.dispatchAction({type:"highlight",dataIndex:f}),p.current=f)}),[f]),(0,n.useEffect)((()=>{d.current&&d.current.resize({width:e,height:t})}),[e,t]),(0,l.tZ)(u,{ref:o,height:t,width:e})}const i=(0,n.forwardRef)(c)}}]);