"use strict";(globalThis.webpackChunksuperset=globalThis.webpackChunksuperset||[]).push([[704],{33738:(e,t,r)=>{r.r(t),r.d(t,{default:()=>f});var l=r(78580),a=r.n(l),n=r(67294),s=r(16355),u=r(5364),c=r(51115),o=r(67190),i=r(10581),h=r(63475),d=r(6915),p=r(11965);function f(e){let{height:t,width:r,echartOptions:l,setDataMask:f,labelMap:g,labelMapB:m,groupby:b,groupbyB:v,selectedValues:y,formData:w,emitCrossFilters:k,seriesBreakdown:F,onContextMenu:x,onFocusedSeries:E,xValueFormatter:C,xAxis:V,refs:I,coltypeMapping:M}=e;const N=(0,n.useCallback)((e=>e<F),[F]),O=(0,n.useCallback)(((e,t)=>{const r=Object.values(y||{});let l;l=a()(r).call(r,e)?r.filter((t=>t!==e)):[e];const n=N(t)?b:v,s=N(t)?g:m,u=l.map((e=>null==s?void 0:s[e])).filter((e=>!!e));return{dataMask:{extraFormData:{filters:0===l.length?[]:[...n.map(((e,t)=>{const r=u.map((e=>e[t]));return null==r?{col:e,op:"IS NULL"}:{col:e,op:"IN",val:r}}))]},filterState:{value:u.length?u:null,selectedValues:l.length?l:null}},isCurrentValueSelected:a()(r).call(r,e)}}),[b,v,N,g,m,y]),S=(0,n.useCallback)(((e,t)=>{k&&f(O(e,t).dataMask)}),[k,f,O]),B={click:e=>{const{seriesName:t,seriesIndex:r}=e;S(t,r)},mouseout:()=>{E(null)},mouseover:e=>{E(e.seriesName)},contextmenu:async e=>{if(x){e.event.stop();const{data:t,seriesName:r,seriesIndex:l}=e,a=e.event.event,n=[],h=[],p=N(l),f=[...e.name?[e.name]:[],...(p?g:m)[e.seriesName]];t&&V.type===s.we.time&&n.push({col:V.label===u.W3?w.granularitySqla:V.label,grain:w.timeGrainSqla,op:"==",val:t[0],formattedVal:C(t[0])}),[...t&&V.type===s.we.category?[V.label]:[],...p?w.groupby:w.groupbyB].forEach(((e,t)=>n.push({col:e,op:"==",val:f[t],formattedVal:String(f[t])}))),[...p?w.groupby:w.groupbyB].forEach(((e,t)=>h.push({col:e,op:"==",val:f[t],formattedVal:(0,d.mj)(f[t],{timeFormatter:(0,c.bt)(w.dateFormat),numberFormatter:(0,o.JB)(w.numberFormat),coltype:null==M?void 0:M[(0,i.Z)(e)]})}))),x(a.clientX,a.clientY,{drillToDetail:n,crossFilter:O(r,l),drillBy:{filters:h,groupbyFieldName:p?"groupby":"groupby_b",adhocFilterFieldName:p?"adhoc_filters":"adhoc_filters_b"}})}}};return(0,p.tZ)(h.Z,{refs:I,height:t,width:r,echartOptions:l,eventHandlers:B,selectedValues:y})}},63475:(e,t,r)=>{r.d(t,{Z:()=>h});var l=r(78580),a=r.n(l),n=r(67294),s=r(51995),u=r(31431),c=r(11965);const o=s.iK.div`
  height: ${e=>{let{height:t}=e;return t}};
  width: ${e=>{let{width:t}=e;return t}};
`;function i(e,t){let{width:r,height:l,echartOptions:s,eventHandlers:i,zrEventHandlers:h,selectedValues:d={},refs:p}=e;const f=(0,n.useRef)(null);p&&(p.divRef=f);const g=(0,n.useRef)(),m=(0,n.useMemo)((()=>Object.keys(d)||[]),[d]),b=(0,n.useRef)([]);(0,n.useImperativeHandle)(t,(()=>({getEchartInstance:()=>g.current}))),(0,n.useEffect)((()=>{f.current&&(g.current||(g.current=(0,u.S1)(f.current)),Object.entries(i||{}).forEach((e=>{var t,r;let[l,a]=e;null==(t=g.current)||t.off(l),null==(r=g.current)||r.on(l,a)})),Object.entries(h||{}).forEach((e=>{var t,r;let[l,a]=e;null==(t=g.current)||t.getZr().off(l),null==(r=g.current)||r.getZr().on(l,a)})),g.current.setOption(s,!0))}),[s,i,h]),(0,n.useEffect)((()=>{g.current&&(g.current.dispatchAction({type:"downplay",dataIndex:b.current.filter((e=>!a()(m).call(m,e)))}),m.length&&g.current.dispatchAction({type:"highlight",dataIndex:m}),b.current=m)}),[m]);const v=(0,n.useCallback)((e=>{let{width:t,height:r}=e;g.current&&g.current.resize({width:t,height:r})}),[]);return(0,n.useEffect)((()=>(v({width:r,height:l}),()=>{var e;return null==(e=g.current)?void 0:e.dispose()})),[]),(0,n.useLayoutEffect)((()=>{v({width:r,height:l})}),[r,l,v]),(0,c.tZ)(o,{ref:f,height:l,width:r})}const h=(0,n.forwardRef)(i)}}]);
//# sourceMappingURL=25ae9fbedb72d9b3ffe7.chunk.js.map