${this.patterns?"{=COLOR}":''}{=NAME} | {=VALUE} |
{const x=e[_];if(_!=="axis.x"&&x.attr("transform",null),_==="grid.x")x.attr(n.xgridAttr);else if(_==="gridLines.x")x.attr("x1",o?0:c).attr("x2",o?n.width:c),x.select("text").attr("x",o?n.width:0).attr("y",c);else if(/^(area|bar|line)$/.test(_))x.attr("d",l.type[_]);else if(_==="text")x.attr("x",h).attr("y",g).style("fill-opacity",s.opacityForText.bind(s));else if(_==="circle")if(s.isCirclePoint())x.attr("cx",u).attr("cy",d);else{const m=y=>u(y)-i.point_r,b=y=>d(y)-i.point_r;x.attr("x",m).attr("y",b)}else _==="region.list"&&x.select("rect").filter(s.isRegionOnX).attr("x",s.regionX.bind(s)).attr("width",s.regionWidth.bind(s))}),i.interaction_enabled&&s.redrawEventRect(),f.call(s.api),n.flowing=!1},getFlowTransform(e,t,s,i){const n=this,{data:a,scale:{x:o}}=n,r=a.targets[0].values;let l=n.getValueOnIndex(r,s),c=n.getValueOnIndex(r,s+i),u;const d=o.domain(),h=n.updateXDomain(e,!0,!0);t?t===1||(l==null?void 0:l.x)===(c==null?void 0:c.x)?u=o(d[0])-o(h[0]):u=n.axis.isTimeSeries()?o(d[0])-o(h[0]):o((l==null?void 0:l.x)||0)-o(c.x):r.length!==1?u=o(d[0])-o(h[0]):n.axis.isTimeSeries()?(l=n.getValueOnIndex(r,0),c=n.getValueOnIndex(r,r.length-1),u=o(l.x)-o(c.x)):u=Xt(h)/2;const g=Xt(d)/Xt(h);return`translate(${u},0) scale(${g},1)`}},lo={initClip(){const e=this,{clip:t,datetimeId:s}=e.state;t.id=`${s}-clip`,t.idXAxis=`${t.id}-xaxis`,t.idYAxis=`${t.id}-yaxis`,t.idGrid=`${t.id}-grid`,t.path=e.getClipPath(t.id),t.pathXAxis=e.getClipPath(t.idXAxis),t.pathYAxis=e.getClipPath(t.idYAxis),t.pathGrid=e.getClipPath(t.idGrid)},getClipPath(e){const t=this,{config:s}=t;return!s.clipPath&&/-clip$/.test(e)||!s.axis_x_clipPath&&/-clip-xaxis$/.test(e)||!s.axis_y_clipPath&&/-clip-yaxis$/.test(e)?null:`url(#${e})`},appendClip(e,t){t&&e.append("clipPath").attr("id",t).append("rect")},setXAxisClipPath(e){const t=this,{config:s,state:{margin:i,width:n,height:a}}=t,o=s.axis_rotated,r=Math.max(30,i.left)-(o?0:20),l=(o?i.top+a+10:i.bottom)+20,c=o?-(1+r):-(r-1),u=-15,d=o?i.left+20:n+10+r;e.attr("x",c).attr("y",u).attr("width",d).attr("height",l)},setYAxisClipPath(e){const t=this,{config:s,state:{margin:i,width:n,height:a}}=t,o=s.axis_rotated,r=Math.max(30,i.left)-(o?20:0),l=s.axis_y_inner,c=l&&!o?s.axis_y_label.text?-20:-1:o?-(1+r):-(r-1),u=-(o?20:i.top),d=(o?n+15+r:i.left+20)+(l?20:0),h=(o?i.bottom+10:i.top+a)+10;e.attr("x",c).attr("y",u).attr("width",d).attr("height",h)},updateXAxisTickClip(){const e=this,{config:t,state:{clip:s,xAxisHeight:i},$el:{defs:n}}=e,a=e.getHorizontalAxisHeight("x");if(n&&!s.idXAxisTickTexts){const o=`${s.id}-xaxisticktexts`;e.appendClip(n,o),s.pathXAxisTickTexts=e.getClipPath(s.idXAxisTickTexts),s.idXAxisTickTexts=o}!t.axis_x_tick_multiline&&e.getAxisTickRotate("x")&&a!==i&&(e.setXAxisTickClipWidth(),e.setXAxisTickTextClipPathWidth()),e.state.xAxisHeight=a},setXAxisTickClipWidth(){const e=this,{config:t,state:{current:{maxTickSize:s}}}=e,i=e.getAxisTickRotate("x");if(!t.axis_x_tick_multiline&&i){const n=Math.sin(Math.PI/180*Math.abs(i));s.x.clipPath=(e.getHorizontalAxisHeight("x")-20)/n}else s.x.clipPath=null},setXAxisTickTextClipPathWidth(){const e=this,{state:{clip:t,current:s},$el:{svg:i}}=e;i&&i.select(`#${t.idXAxisTickTexts} rect`).attr("width",s.maxTickSize.x.clipPath).attr("height",30)}};const co=e=>z(e.position)||"end",uo=e=>e.position==="start"?4:e.position==="middle"?0:-4;function Ys(e,t,s){return i=>{let n=e?0:t;return i.position==="start"?n=e?-s:0:i.position==="middle"&&(n=(e?-s:t)/2),n}}function js(e,t){t==="grid"&&e.each(function(){const s=(0,w.select)(this);["x1","x2","y1","y2"].forEach(i=>s.attr(i,Math.ceil(+s.attr(i))))})}var ho={hasGrid(){const{config:e}=this;return["x","y"].some(t=>e[`grid_${t}_show`]||e[`grid_${t}_lines`].length)},initGrid(){const e=this;e.hasGrid()&&e.initGridLines(),e.initFocusGrid()},initGridLines(){const e=this,{config:t,state:{clip:s},$el:i}=e;(t.grid_x_lines.length||t.grid_y_lines.length)&&(i.gridLines.main=i.main.insert("g",`.${I.chart}${t.grid_lines_front?" + *":""}`).attr("clip-path",s.pathGrid).attr("class",`${J.grid} ${J.gridLines}`),i.gridLines.main.append("g").attr("class",J.xgridLines),i.gridLines.main.append("g").attr("class",J.ygridLines),i.gridLines.x=(0,w.selectAll)([]))},updateXGrid(e){const t=this,{config:s,scale:i,state:n,$el:{main:a,grid:o}}=t,r=s.axis_rotated,l=t.generateGridData(s.grid_x_type,i.x),c=t.axis.isCategorized()?t.axis.x.tickOffset():0,u=d=>(i.zoom||i.x)(d)+c*(r?-1:1);n.xgridAttr=r?{x1:0,x2:n.width,y1:u,y2:u}:{x1:u,x2:u,y1:0,y2:n.height},o.x=a.select(`.${J.xgrids}`).selectAll(`.${J.xgrid}`).data(l),o.x.exit().remove(),o.x=o.x.enter().append("line").attr("class",J.xgrid).merge(o.x),e||o.x.each(function(){const d=(0,w.select)(this);Object.keys(n.xgridAttr).forEach(h=>{d.attr(h,n.xgridAttr[h]).style("opacity",()=>d.attr(r?"y1":"x1")===(r?n.height:0)?"0":null)})})},updateYGrid(){const e=this,{axis:t,config:s,scale:i,state:n,$el:{grid:a,main:o}}=e,r=s.axis_rotated,l=u=>Math.ceil(i.y(u)),c=t.y.getGeneratedTicks(s.grid_y_ticks)||e.scale.y.ticks(s.grid_y_ticks);a.y=o.select(`.${J.ygrids}`).selectAll(`.${J.ygrid}`).data(c),a.y.exit().remove(),a.y=a.y.enter().append("line").attr("class",J.ygrid).merge(a.y),a.y.attr("x1",r?l:0).attr("x2",r?l:n.width).attr("y1",r?0:l).attr("y2",r?n.height:l),js(a.y,"grid")},updateGrid(){const e=this,{$el:{grid:t,gridLines:s}}=e;!s.main&&e.initGridLines(),t.main.style("visibility",e.hasArcType()?"hidden":null),e.hideGridFocus(),e.updateGridLines("x"),e.updateGridLines("y")},updateGridLines(e){const t=this,{config:s,$el:{gridLines:i,main:n},$T:a}=t,o=s.axis_rotated,r=e==="x";s[`grid_${e}_show`]&&t[`update${e.toUpperCase()}Grid`]();let l=n.select(`.${J[`${e}gridLines`]}`).selectAll(`.${J[`${e}gridLine`]}`).data(s[`grid_${e}_lines`]);a(l.exit()).style("opacity","0").remove();const c=l.enter().append("g");c.append("line").style("opacity","0"),l=c.merge(l),l.each(function(u){const d=(0,w.select)(this);d.select("text").empty()&&u.text&&d.append("text").style("opacity","0")}),a(l.attr("class",u=>`${J[`${e}gridLine`]} ${u.class||""}`.trim()).select("text").attr("text-anchor",co).attr("transform",()=>r?o?null:"rotate(-90)":o?"rotate(-90)":null).attr("dx",uo).attr("dy",-5)).text(function(u){var d;return(d=u.text)!=null?d:this.remove()}),i[e]=l},redrawGrid(e){const t=this,{config:{axis_rotated:s},state:{width:i,height:n},$el:{gridLines:a},$T:o}=t,r=t.xv.bind(t),l=t.yv.bind(t);let c=a.x.select("line"),u=a.x.select("text"),d=a.y.select("line"),h=a.y.select("text");return c=o(c,e).attr("x1",s?0:r).attr("x2",s?i:r).attr("y1",s?r:0).attr("y2",s?r:n),u=o(u,e).attr("x",Ys(!s,i,n)).attr("y",r),d=o(d,e).attr("x1",s?l:0).attr("x2",s?l:i).attr("y1",s?0:l).attr("y2",s?n:l),h=o(h,e).attr("x",Ys(s,i,n)).attr("y",l),[c.style("opacity",null),u.style("opacity",null),d.style("opacity",null),h.style("opacity",null)]},initFocusGrid(){const e=this,{config:t,state:{clip:s},$el:i}=e,n=t.grid_front,a=`.${n&&i.gridLines.main?J.gridLines:I.chart}${n?" + *":""}`,o=i.main.insert("g",a).attr("clip-path",s.pathGrid).attr("class",J.grid);if(i.grid.main=o,t.grid_x_show&&o.append("g").attr("class",J.xgrids),t.grid_y_show&&o.append("g").attr("class",J.ygrids),t.axis_tooltip){const r=o.append("g").attr("class","bb-axis-tooltip");r.append("line").attr("class","bb-axis-tooltip-x"),r.append("line").attr("class","bb-axis-tooltip-y")}t.interaction_enabled&&t.grid_focus_show&&!t.axis_tooltip&&(o.append("g").attr("class",W.xgridFocus).append("line").attr("class",W.xgridFocus),t.grid_focus_y&&!t.tooltip_grouped&&o.append("g").attr("class",W.ygridFocus).append("line").attr("class",W.ygridFocus))},showAxisGridFocus(){var e,t;const s=this,{config:i,format:n,state:{event:a,width:o,height:r}}=s,l=i.axis_rotated,[c,u]=mt(a,(e=s.$el.eventRect)==null?void 0:e.node()),d={x:c,y:u};for(const[h,g]of Object.entries(s.$el.axisTooltip)){const f=h==="x"&&!l||h!=="x"&&l?"x":"y",p=d[f];let _=(t=s.scale[h])==null?void 0:t.invert(p);_&&(_=h==="x"&&s.axis.isTimeSeries()?n.xAxisTick(_):_==null?void 0:_.toFixed(2),g==null||g.attr(f,p).text(_))}s.$el.main.selectAll("line.bb-axis-tooltip-x, line.bb-axis-tooltip-y").style("visibility",null).each(function(h,g){const f=(0,w.select)(this);g===0?f.attr("x1",c).attr("x2",c).attr("y1",g?0:r).attr("y2",g?r:0):f.attr("x1",g?0:o).attr("x2",g?o:0).attr("y1",u).attr("y2",u)})},hideAxisGridFocus(){const e=this;e.$el.main.selectAll("line.bb-axis-tooltip-x, line.bb-axis-tooltip-y").style("visibility","hidden"),Object.values(e.$el.axisTooltip).forEach(t=>t==null?void 0:t.style("display","none"))},showGridFocus(e){var t;const s=this,{config:i,state:{width:n,height:a}}=s,o=i.axis_rotated,r=s.$el.main.selectAll(`line.${W.xgridFocus}, line.${W.ygridFocus}`),l=(e||[r.datum()]).filter(d=>d&&z(s.getBaseValue(d)));if(!i.tooltip_show||l.length===0||!i.axis_x_forceAsSingle&&s.hasType("bubble")||s.hasArcType())return;const c=i.grid_focus_edge&&!i.tooltip_grouped,u=s.xx.bind(s);r.style("visibility",null).data(l.concat(l)).each(function(d){const h=(0,w.select)(this),g={x:u(d),y:s.getYScaleById(d.id)(d.value)};let f;if(h.classed(W.xgridFocus))f=o?[null,g.x,c?g.y:n,g.x]:[g.x,c?g.y:null,g.x,a];else{const p=s.axis.getId(d.id)==="y2";f=o?[g.y,c&&!p?g.x:null,g.y,c&&p?g.x:a]:[c&&p?g.x:null,g.y,c&&!p?g.x:n,g.y]}["x1","y1","x2","y2"].forEach((p,_)=>h.attr(p,f[_]))}),js(r,"grid"),(t=s.showCircleFocus)==null||t.call(s,e)},hideGridFocus(){var e;const t=this,{state:{inputType:s,resizing:i},$el:{main:n}}=t;(s==="mouse"||!i)&&(n.selectAll(`line.${W.xgridFocus}, line.${W.ygridFocus}`).style("visibility","hidden"),(e=t.hideCircleFocus)==null||e.call(t))},updateGridFocus(){var e;const t=this,{state:{inputType:s,width:i,height:n,resizing:a},$el:{grid:o}}=t,r=o.main.select(`line.${W.xgridFocus}`);if(s==="touch")r.empty()?a&&((e=t.showCircleFocus)==null||e.call(t)):t.showGridFocus();else{const l=t.config.axis_rotated;r.attr("x1",l?0:-10).attr("x2",l?i:-10).attr("y1",l?-10:0).attr("y2",l?-10:n)}return!0},generateGridData(e,t){const s=this,i=s.$el.main.select(`.${st.axisX}`).selectAll(".tick").size();let n=[];if(e==="year"){const a=s.getXDomain(),[o,r]=a.map(l=>l.getFullYear());for(let l=o;l<=r;l++)n.push(new Date(`${l}-01-01 00:00:00`))}else n=t.ticks(10),n.length>i&&(n=n.filter(a=>String(a).indexOf(".")<0));return n},getGridFilterToRemove(e){return e?t=>{let s=!1;return(B(e)?e.concat():[e]).forEach(i=>{("value"in i&&t.value===i.value||"class"in i&&t.class===i.class)&&(s=!0)}),s}:()=>!0},removeGridLines(e,t){const s=this,{config:i,$T:n}=s,a=s.getGridFilterToRemove(e),o=u=>!a(u),r=t?J.xgridLines:J.ygridLines,l=t?J.xgridLine:J.ygridLine;n(s.$el.main.select(`.${r}`).selectAll(`.${l}`).filter(a)).style("opacity","0").remove();const c=`grid_${t?"x":"y"}_lines`;i[c]=i[c].filter(o)}},go={initRegion(){const e=this,{$el:t}=e;t.region.main=t.main.insert("g",":first-child").attr("clip-path",e.state.clip.path).attr("class",ae.regions)},updateRegion(){const e=this,{config:t,$el:{region:s},$T:i}=e;s.main||e.initRegion(),s.main.style("visibility",e.hasArcType()?"hidden":null);const n=s.main.selectAll(`.${ae.region}`).data(t.regions);i(n.exit()).style("opacity","0").remove();const a=n.enter().append("g");a.append("rect").style("fill-opacity","0"),s.list=a.merge(n).attr("class",e.classRegion.bind(e)),s.list.each(function(o){var r;(0,w.select)(this).select("text").empty()&&((r=o.label)!=null&&r.text)&&(0,w.select)(this).append("text").style("opacity","0")})},redrawRegion(e){const t=this,{$el:{region:s},$T:i}=t;let n=s.list.select("rect"),a=s.list.selectAll("text");return n=i(n,e).attr("x",t.regionX.bind(t)).attr("y",t.regionY.bind(t)).attr("width",t.regionWidth.bind(t)).attr("height",t.regionHeight.bind(t)),a=i(a,e).attr("transform",o=>{var r;const{x:l=0,y:c=0,rotated:u=!1}=(r=o.label)!=null?r:{};return`translate(${t.regionX.bind(t)(o)+l}, ${t.regionY.bind(t)(o)+c})${u?" rotate(-90)":""}`}).attr("text-anchor",o=>{var r;return(r=o.label)!=null&&r.rotated?"end":null}).attr("dy","1em").style("fill",o=>{var r,l;return(l=(r=o.label)==null?void 0:r.color)!=null?l:null}).text(o=>{var r;return(r=o.label)==null?void 0:r.text}),[n.style("fill-opacity",o=>z(o.opacity)?o.opacity:null).on("end",function(){(0,w.select)(this.parentNode).selectAll("rect:not([x])").remove()}),a.style("opacity",null)]},getRegionXY(e,t){const s=this,{config:i,scale:n}=s,a=i.axis_rotated,o=e==="x";let r="start",l,c=0;return t.axis==="y"||t.axis==="y2"?(o||(r="end"),(o?a:!a)&&r in t&&(l=n[t.axis],c=l(t[r]))):(o?!a:a)&&r in t&&(l=n.zoom||n.x,c=l(s.axis.isTimeSeries()?_t.call(s,t[r]):t[r])),c},regionX(e){return this.getRegionXY("x",e)},regionY(e){return this.getRegionXY("y",e)},getRegionSize(e,t){const s=this,{config:i,scale:n,state:a}=s,o=i.axis_rotated,r=e==="width",l=s[r?"regionX":"regionY"](t);let c,u="end",d=a[e];return t.axis==="y"||t.axis==="y2"?(r||(u="start"),(r?o:!o)&&u in t&&(c=n[t.axis],d=c(t[u]))):(r?!o:o)&&u in t&&(c=n.zoom||n.x,d=c(s.axis.isTimeSeries()?_t.call(s,t[u]):t[u])),d {const x=e[_];if(_!=="axis.x"&&x.attr("transform",null),_==="grid.x")x.attr(n.xgridAttr);else if(_==="gridLines.x")x.attr("x1",o?0:c).attr("x2",o?n.width:c),x.select("text").attr("x",o?n.width:0).attr("y",c);else if(/^(area|bar|line)$/.test(_))x.attr("d",l.type[_]);else if(_==="text")x.attr("x",h).attr("y",g).style("fill-opacity",s.opacityForText.bind(s));else if(_==="circle")if(s.isCirclePoint())x.attr("cx",u).attr("cy",d);else{const m=b=>u(b)-i.point_r,$=b=>d(b)-i.point_r;x.attr("x",m).attr("y",$)}else _==="region.list"&&x.select("rect").filter(s.isRegionOnX).attr("x",s.regionX.bind(s)).attr("width",s.regionWidth.bind(s))}),i.interaction_enabled&&s.redrawEventRect(),f.call(s.api),n.flowing=!1},getFlowTransform(e,t,s,i){const n=this,{data:a,scale:{x:o}}=n,r=a.targets[0].values;let l=n.getValueOnIndex(r,s),c=n.getValueOnIndex(r,s+i),u;const d=o.domain(),h=n.updateXDomain(e,!0,!0);t?t===1||(l==null?void 0:l.x)===(c==null?void 0:c.x)?u=o(d[0])-o(h[0]):u=n.axis.isTimeSeries()?o(d[0])-o(h[0]):o((l==null?void 0:l.x)||0)-o(c.x):r.length!==1?u=o(d[0])-o(h[0]):n.axis.isTimeSeries()?(l=n.getValueOnIndex(r,0),c=n.getValueOnIndex(r,r.length-1),u=o(l.x)-o(c.x)):u=Nt(h)/2;const g=Nt(d)/Nt(h);return`translate(${u},0) scale(${g},1)`}},lo={initClip(){const e=this,{clip:t,datetimeId:s}=e.state;t.id=`${s}-clip`,t.idXAxis=`${t.id}-xaxis`,t.idYAxis=`${t.id}-yaxis`,t.idGrid=`${t.id}-grid`,t.path=e.getClipPath(t.id),t.pathXAxis=e.getClipPath(t.idXAxis),t.pathYAxis=e.getClipPath(t.idYAxis),t.pathGrid=e.getClipPath(t.idGrid)},getClipPath(e){const t=this,{config:s}=t;return!s.clipPath&&/-clip$/.test(e)||!s.axis_x_clipPath&&/-clip-xaxis$/.test(e)||!s.axis_y_clipPath&&/-clip-yaxis$/.test(e)?null:`url(#${e})`},appendClip(e,t){t&&e.append("clipPath").attr("id",t).append("rect")},setXAxisClipPath(e){const t=this,{config:s,state:{margin:i,width:n,height:a}}=t,o=s.axis_rotated,r=Math.max(30,i.left)-(o?0:20),l=(o?i.top+a+10:i.bottom)+20,c=o?-(1+r):-(r-1),u=-15,d=o?i.left+20:n+10+r;e.attr("x",c).attr("y",u).attr("width",d).attr("height",l)},setYAxisClipPath(e){const t=this,{config:s,state:{margin:i,width:n,height:a}}=t,o=s.axis_rotated,r=Math.max(30,i.left)-(o?20:0),l=s.axis_y_inner,c=l&&!o?s.axis_y_label.text?-20:-1:o?-(1+r):-(r-1),u=-(o?20:i.top),d=(o?n+15+r:i.left+20)+(l?20:0),h=(o?i.bottom+10:i.top+a)+10;e.attr("x",c).attr("y",u).attr("width",d).attr("height",h)},updateXAxisTickClip(){const e=this,{config:t,state:{clip:s,xAxisHeight:i},$el:{defs:n}}=e,a=e.getHorizontalAxisHeight("x");if(n&&!s.idXAxisTickTexts){const o=`${s.id}-xaxisticktexts`;e.appendClip(n,o),s.pathXAxisTickTexts=e.getClipPath(s.idXAxisTickTexts),s.idXAxisTickTexts=o}!t.axis_x_tick_multiline&&e.getAxisTickRotate("x")&&a!==i&&(e.setXAxisTickClipWidth(),e.setXAxisTickTextClipPathWidth()),e.state.xAxisHeight=a},setXAxisTickClipWidth(){const e=this,{config:t,state:{current:{maxTickSize:s}}}=e,i=e.getAxisTickRotate("x");if(!t.axis_x_tick_multiline&&i){const n=Math.sin(Math.PI/180*Math.abs(i));s.x.clipPath=(e.getHorizontalAxisHeight("x")-20)/n}else s.x.clipPath=null},setXAxisTickTextClipPathWidth(){const e=this,{state:{clip:t,current:s},$el:{svg:i}}=e;i&&i.select(`#${t.idXAxisTickTexts} rect`).attr("width",s.maxTickSize.x.clipPath).attr("height",30)}};const co=e=>F(e.position)||"end",uo=e=>e.position==="start"?4:e.position==="middle"?0:-4;function js(e,t,s){return i=>{let n=e?0:t;return i.position==="start"?n=e?-s:0:i.position==="middle"&&(n=(e?-s:t)/2),n}}function Hs(e,t){t==="grid"&&e.each(function(){const s=(0,S.select)(this);["x1","x2","y1","y2"].forEach(i=>s.attr(i,Math.ceil(+s.attr(i))))})}var ho={hasGrid(){const{config:e}=this;return["x","y"].some(t=>e[`grid_${t}_show`]||e[`grid_${t}_lines`].length)},initGrid(){const e=this;e.hasGrid()&&e.initGridLines(),e.initFocusGrid()},initGridLines(){const e=this,{config:t,state:{clip:s},$el:i}=e;(t.grid_x_lines.length||t.grid_y_lines.length)&&(i.gridLines.main=i.main.insert("g",`.${z.chart}${t.grid_lines_front?" + *":""}`).attr("clip-path",s.pathGrid).attr("class",`${et.grid} ${et.gridLines}`),i.gridLines.main.append("g").attr("class",et.xgridLines),i.gridLines.main.append("g").attr("class",et.ygridLines),i.gridLines.x=(0,S.selectAll)([]))},updateXGrid(e){const t=this,{config:s,scale:i,state:n,$el:{main:a,grid:o}}=t,r=s.axis_rotated,l=t.generateGridData(s.grid_x_type,i.x),c=t.axis.isCategorized()?t.axis.x.tickOffset():0,u=d=>(i.zoom||i.x)(d)+c*(r?-1:1);n.xgridAttr=r?{x1:0,x2:n.width,y1:u,y2:u}:{x1:u,x2:u,y1:0,y2:n.height},o.x=a.select(`.${et.xgrids}`).selectAll(`.${et.xgrid}`).data(l),o.x.exit().remove(),o.x=o.x.enter().append("line").attr("class",et.xgrid).merge(o.x),e||o.x.each(function(){const d=(0,S.select)(this);Object.keys(n.xgridAttr).forEach(h=>{d.attr(h,n.xgridAttr[h]).style("opacity",()=>d.attr(r?"y1":"x1")===(r?n.height:0)?"0":null)})})},updateYGrid(){const e=this,{axis:t,config:s,scale:i,state:n,$el:{grid:a,main:o}}=e,r=s.axis_rotated,l=u=>Math.ceil(i.y(u)),c=t.y.getGeneratedTicks(s.grid_y_ticks)||e.scale.y.ticks(s.grid_y_ticks);a.y=o.select(`.${et.ygrids}`).selectAll(`.${et.ygrid}`).data(c),a.y.exit().remove(),a.y=a.y.enter().append("line").attr("class",et.ygrid).merge(a.y),a.y.attr("x1",r?l:0).attr("x2",r?l:n.width).attr("y1",r?0:l).attr("y2",r?n.height:l),Hs(a.y,"grid")},updateGrid(){const e=this,{$el:{grid:t,gridLines:s}}=e;!s.main&&e.initGridLines(),t.main.style("visibility",e.hasArcType()?"hidden":null),e.hideGridFocus(),e.updateGridLines("x"),e.updateGridLines("y")},updateGridLines(e){const t=this,{config:s,$el:{gridLines:i,main:n},$T:a}=t,o=s.axis_rotated,r=e==="x";s[`grid_${e}_show`]&&t[`update${e.toUpperCase()}Grid`]();let l=n.select(`.${et[`${e}gridLines`]}`).selectAll(`.${et[`${e}gridLine`]}`).data(s[`grid_${e}_lines`]);a(l.exit()).style("opacity","0").remove();const c=l.enter().append("g");c.append("line").style("opacity","0"),l=c.merge(l),l.each(function(u){const d=(0,S.select)(this);d.select("text").empty()&&u.text&&d.append("text").style("opacity","0")}),a(l.attr("class",u=>`${et[`${e}gridLine`]} ${u.class||""}`.trim()).select("text").attr("text-anchor",co).attr("transform",()=>r?o?null:"rotate(-90)":o?"rotate(-90)":null).attr("dx",uo).attr("dy",-5)).text(function(u){var d;return(d=u.text)!=null?d:this.remove()}),i[e]=l},redrawGrid(e){const t=this,{config:{axis_rotated:s},state:{width:i,height:n},$el:{gridLines:a},$T:o}=t,r=t.xv.bind(t),l=t.yv.bind(t);let c=a.x.select("line"),u=a.x.select("text"),d=a.y.select("line"),h=a.y.select("text");return c=o(c,e).attr("x1",s?0:r).attr("x2",s?i:r).attr("y1",s?r:0).attr("y2",s?r:n),u=o(u,e).attr("x",js(!s,i,n)).attr("y",r),d=o(d,e).attr("x1",s?l:0).attr("x2",s?l:i).attr("y1",s?0:l).attr("y2",s?n:l),h=o(h,e).attr("x",js(s,i,n)).attr("y",l),[c.style("opacity",null),u.style("opacity",null),d.style("opacity",null),h.style("opacity",null)]},initFocusGrid(){const e=this,{config:t,state:{clip:s},$el:i}=e,n=t.grid_front,a=`.${n&&i.gridLines.main?et.gridLines:z.chart}${n?" + *":""}`,o=i.main.insert("g",a).attr("clip-path",s.pathGrid).attr("class",et.grid);if(i.grid.main=o,t.grid_x_show&&o.append("g").attr("class",et.xgrids),t.grid_y_show&&o.append("g").attr("class",et.ygrids),t.axis_tooltip){const r=o.append("g").attr("class","bb-axis-tooltip");r.append("line").attr("class","bb-axis-tooltip-x"),r.append("line").attr("class","bb-axis-tooltip-y")}t.interaction_enabled&&t.grid_focus_show&&!t.axis_tooltip&&(o.append("g").attr("class",Z.xgridFocus).append("line").attr("class",Z.xgridFocus),t.grid_focus_y&&!t.tooltip_grouped&&o.append("g").attr("class",Z.ygridFocus).append("line").attr("class",Z.ygridFocus))},showAxisGridFocus(){var e,t;const s=this,{config:i,format:n,state:{event:a,width:o,height:r}}=s,l=i.axis_rotated,[c,u]=$t(a,(e=s.$el.eventRect)==null?void 0:e.node()),d={x:c,y:u};for(const[h,g]of Object.entries(s.$el.axisTooltip)){const f=h==="x"&&!l||h!=="x"&&l?"x":"y",p=d[f];let _=(t=s.scale[h])==null?void 0:t.invert(p);_&&(_=h==="x"&&s.axis.isTimeSeries()?n.xAxisTick(_):_==null?void 0:_.toFixed(2),g==null||g.attr(f,p).text(_))}s.$el.main.selectAll("line.bb-axis-tooltip-x, line.bb-axis-tooltip-y").style("visibility",null).each(function(h,g){const f=(0,S.select)(this);g===0?f.attr("x1",c).attr("x2",c).attr("y1",g?0:r).attr("y2",g?r:0):f.attr("x1",g?0:o).attr("x2",g?o:0).attr("y1",u).attr("y2",u)})},hideAxisGridFocus(){const e=this;e.$el.main.selectAll("line.bb-axis-tooltip-x, line.bb-axis-tooltip-y").style("visibility","hidden"),Object.values(e.$el.axisTooltip).forEach(t=>t==null?void 0:t.style("display","none"))},showGridFocus(e){var t;const s=this,{config:i,state:{width:n,height:a}}=s,o=i.axis_rotated,r=s.$el.main.selectAll(`line.${Z.xgridFocus}, line.${Z.ygridFocus}`),l=(e||[r.datum()]).filter(d=>d&&F(s.getBaseValue(d)));if(!i.tooltip_show||l.length===0||!i.axis_x_forceAsSingle&&s.hasType("bubble")||s.hasArcType())return;const c=i.grid_focus_edge&&!i.tooltip_grouped,u=s.xx.bind(s);r.style("visibility",null).data(l.concat(l)).each(function(d){const h=(0,S.select)(this),g={x:u(d),y:s.getYScaleById(d.id)(d.value)};let f;if(h.classed(Z.xgridFocus))f=o?[null,g.x,c?g.y:n,g.x]:[g.x,c?g.y:null,g.x,a];else{const p=s.axis.getId(d.id)==="y2";f=o?[g.y,c&&!p?g.x:null,g.y,c&&p?g.x:a]:[c&&p?g.x:null,g.y,c&&!p?g.x:n,g.y]}["x1","y1","x2","y2"].forEach((p,_)=>h.attr(p,f[_]))}),Hs(r,"grid"),(t=s.showCircleFocus)==null||t.call(s,e)},hideGridFocus(){var e;const t=this,{state:{inputType:s,resizing:i},$el:{main:n}}=t;(s==="mouse"||!i)&&(n.selectAll(`line.${Z.xgridFocus}, line.${Z.ygridFocus}`).style("visibility","hidden"),(e=t.hideCircleFocus)==null||e.call(t))},updateGridFocus(){var e;const t=this,{state:{inputType:s,width:i,height:n,resizing:a},$el:{grid:o}}=t,r=o.main.select(`line.${Z.xgridFocus}`);if(s==="touch")r.empty()?a&&((e=t.showCircleFocus)==null||e.call(t)):t.showGridFocus();else{const l=t.config.axis_rotated;r.attr("x1",l?0:-10).attr("x2",l?i:-10).attr("y1",l?-10:0).attr("y2",l?-10:n)}return!0},generateGridData(e,t){const s=this,i=s.$el.main.select(`.${ot.axisX}`).selectAll(".tick").size();let n=[];if(e==="year"){const a=s.getXDomain(),[o,r]=a.map(l=>l.getFullYear());for(let l=o;l<=r;l++)n.push(new Date(`${l}-01-01 00:00:00`))}else n=t.ticks(10),n.length>i&&(n=n.filter(a=>String(a).indexOf(".")<0));return n},getGridFilterToRemove(e){return e?t=>{let s=!1;return(N(e)?e.concat():[e]).forEach(i=>{("value"in i&&t.value===i.value||"class"in i&&t.class===i.class)&&(s=!0)}),s}:()=>!0},removeGridLines(e,t){const s=this,{config:i,$T:n}=s,a=s.getGridFilterToRemove(e),o=u=>!a(u),r=t?et.xgridLines:et.ygridLines,l=t?et.xgridLine:et.ygridLine;n(s.$el.main.select(`.${r}`).selectAll(`.${l}`).filter(a)).style("opacity","0").remove();const c=`grid_${t?"x":"y"}_lines`;i[c]=i[c].filter(o)}},go={initRegion(){const e=this,{$el:t}=e;t.region.main=t.main.insert("g",":first-child").attr("clip-path",e.state.clip.path).attr("class",re.regions)},updateRegion(){const e=this,{config:t,$el:{region:s},$T:i}=e;s.main||e.initRegion(),s.main.style("visibility",e.hasArcType()?"hidden":null);const n=s.main.selectAll(`.${re.region}`).data(t.regions);i(n.exit()).style("opacity","0").remove();const a=n.enter().append("g");a.append("rect").style("fill-opacity","0"),s.list=a.merge(n).attr("class",e.classRegion.bind(e)),s.list.each(function(o){var r;(0,S.select)(this).select("text").empty()&&((r=o.label)!=null&&r.text)&&(0,S.select)(this).append("text").style("opacity","0")})},redrawRegion(e){const t=this,{$el:{region:s},$T:i}=t;let n=s.list.select("rect"),a=s.list.selectAll("text");return n=i(n,e).attr("x",t.regionX.bind(t)).attr("y",t.regionY.bind(t)).attr("width",t.regionWidth.bind(t)).attr("height",t.regionHeight.bind(t)),a=i(a,e).attr("transform",o=>{var r;const{x:l=0,y:c=0,rotated:u=!1}=(r=o.label)!=null?r:{};return`translate(${t.regionX.bind(t)(o)+l}, ${t.regionY.bind(t)(o)+c})${u?" rotate(-90)":""}`}).attr("text-anchor",o=>{var r;return(r=o.label)!=null&&r.rotated?"end":null}).attr("dy","1em").style("fill",o=>{var r,l;return(l=(r=o.label)==null?void 0:r.color)!=null?l:null}).text(o=>{var r;return(r=o.label)==null?void 0:r.text}),[n.style("fill-opacity",o=>F(o.opacity)?o.opacity:null).on("end",function(){(0,S.select)(this.parentNode).selectAll("rect:not([x])").remove()}),a.style("opacity",null)]},getRegionXY(e,t){const s=this,{config:i,scale:n}=s,a=i.axis_rotated,o=e==="x";let r="start",l,c=0;return t.axis==="y"||t.axis==="y2"?(o||(r="end"),(o?a:!a)&&r in t&&(l=n[t.axis],c=l(t[r]))):(o?!a:a)&&r in t&&(l=n.zoom||n.x,c=l(s.axis.isTimeSeries()?mt.call(s,t[r]):t[r])),c},regionX(e){return this.getRegionXY("x",e)},regionY(e){return this.getRegionXY("y",e)},getRegionSize(e,t){const s=this,{config:i,scale:n,state:a}=s,o=i.axis_rotated,r=e==="width",l=s[r?"regionX":"regionY"](t);let c,u="end",d=a[e];return t.axis==="y"||t.axis==="y2"?(r||(u="start"),(r?o:!o)&&u in t&&(c=n[t.axis],d=c(t[u]))):(r?!o:o)&&u in t&&(c=n.zoom||n.x,d=c(s.axis.isTimeSeries()?mt.call(s,t[u]):t[u])),dr)throw E("Maximum allowed index exceeded");return f}},function(x,E,r){var f=r(6),d=r(44),h=r(11);x.exports=function(p,y,T){f?d.f(p,y,h(0,T)):p[y]=T}},function(x,E,r){var f=r(7),d=r(33),h=r(27),p=d("species");x.exports=function(y){return h>=51||!f(function(){var T=[],$=T.constructor={};return $[p]=function(){return{foo:1}},T[y](Boolean).foo!==1})}},function(x,E,r){var f=r(3),d=r(144),h=r(138);f({target:"Array",proto:!0},{copyWithin:d}),h("copyWithin")},function(x,E,r){var f=r(39),d=r(60),h=r(63),p=r(145),y=Math.min;x.exports=[].copyWithin||function($,A){var b=f(this),R=h(b),O=d($,R),C=d(A,R),w=arguments.length>2?arguments[2]:void 0,D=y((w===void 0?R:d(w,R))-C,R-O),L=1;for(C