"use strict";(globalThis.webpackChunksuperset=globalThis.webpackChunksuperset||[]).push([[7521],{67521:(e,t,r)=>{r.r(t),r.d(t,{default:()=>d});var n=r(78580),l=r.n(n),a=(r(67294),r(51115)),i=r(67190),c=r(10581),o=r(63475),u=r(6915),s=r(11965);function d(e){let{height:t,width:r,echartOptions:n,formData:d,onContextMenu:h,setDataMask:f,filterState:v,emitCrossFilters:p,refs:m,coltypeMapping:g}=e;const w=e=>{if(null==e||!e.name||null==e||!e.col)return;const{name:t,col:r}=e,n=Object.values((null==v?void 0:v.selectedValues)||{});let a;return a=l()(n).call(n,t)?n.filter((e=>e!==t)):[t],{dataMask:{extraFormData:{filters:a.length?[{col:r,op:"IN",val:a}]:[]},filterState:{value:a.length?a:null,selectedValues:a.length?a:null}},isCurrentValueSelected:l()(n).call(n,t)}},b={click:e=>{var t;if(!p||!f)return;e.event.stop();const r=n.series[0].data.find((t=>t.id===e.data.id)),l=null==(t=w(r))?void 0:t.dataMask;l&&f(l)},contextmenu:e=>{if(h){e.event.stop();const t=e.event.event,r=n.series[0].data,l="node"===e.dataType?(t=>{const r=t.find((t=>t.id===e.data.id));if(null!=r&&r.name)return[{col:r.col,op:"==",val:r.name,formattedVal:r.name}]})(r):(t=>{var r,n;const l=null==(r=t.find((t=>t.id===e.data.source)))?void 0:r.name,a=null==(n=t.find((t=>t.id===e.data.target)))?void 0:n.name;if(l&&a)return[{col:d.source,op:"==",val:l,formattedVal:l},{col:d.target,op:"==",val:a,formattedVal:a}]})(r),o=r.find((t=>t.id===e.data.id));h(t.clientX,t.clientY,{drillToDetail:l,crossFilter:w(o),drillBy:o&&{filters:[{col:o.col,op:"==",val:o.name,formattedVal:(0,u.mj)(o.name,{timeFormatter:(0,a.bt)(d.dateFormat),numberFormatter:(0,i.JB)(d.numberFormat),coltype:null==g?void 0:g[(0,c.Z)(o.col)]})}],groupbyFieldName:o.col===d.source?"source":"target"}})}}};return(0,s.tZ)(o.Z,{refs:m,height:t,width:r,echartOptions:n,eventHandlers:b})}},63475:(e,t,r)=>{r.d(t,{Z:()=>d});var n=r(78580),l=r.n(n),a=r(67294),i=r(51995),c=r(31431),o=r(11965);const u=i.iK.div`
  height: ${e=>{let{height:t}=e;return t}};
  width: ${e=>{let{width:t}=e;return t}};
`;function s(e,t){let{width:r,height:n,echartOptions:i,eventHandlers:s,zrEventHandlers:d,selectedValues:h={},refs:f}=e;const v=(0,a.useRef)(null);f&&(f.divRef=v);const p=(0,a.useRef)(),m=(0,a.useMemo)((()=>Object.keys(h)||[]),[h]),g=(0,a.useRef)([]);(0,a.useImperativeHandle)(t,(()=>({getEchartInstance:()=>p.current}))),(0,a.useEffect)((()=>{v.current&&(p.current||(p.current=(0,c.S1)(v.current)),Object.entries(s||{}).forEach((e=>{var t,r;let[n,l]=e;null==(t=p.current)||t.off(n),null==(r=p.current)||r.on(n,l)})),Object.entries(d||{}).forEach((e=>{var t,r;let[n,l]=e;null==(t=p.current)||t.getZr().off(n),null==(r=p.current)||r.getZr().on(n,l)})),p.current.setOption(i,!0))}),[i,s,d]),(0,a.useEffect)((()=>{p.current&&(p.current.dispatchAction({type:"downplay",dataIndex:g.current.filter((e=>!l()(m).call(m,e)))}),m.length&&p.current.dispatchAction({type:"highlight",dataIndex:m}),g.current=m)}),[m]);const w=(0,a.useCallback)((e=>{let{width:t,height:r}=e;p.current&&p.current.resize({width:t,height:r})}),[]);return(0,a.useEffect)((()=>(w({width:r,height:n}),()=>{var e;return null==(e=p.current)?void 0:e.dispose()})),[]),(0,a.useLayoutEffect)((()=>{w({width:r,height:n})}),[r,n,w]),(0,o.tZ)(u,{ref:v,height:n,width:r})}const d=(0,a.forwardRef)(s)}}]);
//# sourceMappingURL=b7b1f7a6bc46d5a0dd8b.chunk.js.map