@carbon/charts-react 1.15.5 → 1.15.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -82,7 +82,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
82
82
  <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 10">
83
83
  <polygon points="5.93 3.71 4.45 3.71 4.45 2.23 3.71 2.23 3.71 3.71 2.23 3.71 2.23 4.45 3.71 4.45 3.71 5.93 4.45 5.93 4.45 4.45 5.93 4.45 5.93 3.71"/>
84
84
  <path d="M7.2,6.67a4,4,0,0,0,1-2.59A4.08,4.08,0,1,0,4.07,8.15h0a4,4,0,0,0,2.59-1L9.48,10,10,9.48Zm-3.12.77A3.34,3.34,0,1,1,7.41,4.08,3.34,3.34,0,0,1,4.08,7.44Z"/>
85
- </svg>`}addEventListeners(){const t=this;this.parent.selectAll("circle.node").on("mouseover",function(n,r){const i=k(this);i.classed("hovered",!0);const s=t.model.getHierarchyLevel(),a=s>2&&!i.classed("focal"),o=x(t.model.getOptions(),"canvasZoom","enabled");let l=!1;if(!a){let c=[],u=[],d=null;if(r.children){r.depth>1&&o&&(l=!0,i.classed("clickable",!0)),c=r.children.map(p=>{if(p!==null)return typeof p.data.value=="number"?{label:p.data.name,value:p.data.value}:{label:p.data.name,labelIcon:o&&s<=2?t.getZoomIcon():null,value:p.value}});const f=t.model.getOptions();u=[{label:_t(f,"locale.translations.total")||_t(f,"tooltip.totalLabel")||"Total",value:r.value,bold:!0}],t.highlightChildren(r.children)}else d=r.value;const h=getComputedStyle(this,null).getPropertyValue("fill");t.services.events.dispatchEvent(O.Tooltip.SHOW,{event:n,hoveredElement:i,items:[{color:h,label:r.data.name,labelIcon:l&&o&&s<=2?t.getZoomIcon():null,value:d},...c,...u]})}t.services.events.dispatchEvent(O.CirclePack.CIRCLE_MOUSEOVER,{event:n,element:i,datum:r})}).on("mousemove",function(n,r){const i=k(this);t.services.events.dispatchEvent(O.CirclePack.CIRCLE_MOUSEMOVE,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(O.Tooltip.MOVE,{event:n})}).on("mouseout",function(n,r){const i=k(this);i.classed("hovered",!1),r.children&&t.unhighlightChildren(r.children),t.services.events.dispatchEvent(O.CirclePack.CIRCLE_MOUSEOUT,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(O.Tooltip.HIDE,{hoveredElement:i})}).on("click",function(n,r){const i=k(this),s=i.classed("non-focal"),a=x(t.model.getOptions(),"canvasZoom","enabled");if(a&&t.model.getHierarchyLevel()>2){const o=t.parent.selectAll("circle.node");k(t.services.domUtils.getMainContainer()).classed("zoomed-in",!1),t.focal=null,t.model.updateHierarchyLevel(2),t.services.canvasZoom.zoomOut(o,oi)}else if(r.depth===2&&r.children&&!s&&a){const o=t.parent.selectAll("circle.node");k(t.services.domUtils.getMainContainer()).classed("zoomed-in",!0),t.focal=r,t.model.updateHierarchyLevel(3),t.services.canvasZoom.zoomIn(r,o,oi),n.stopPropagation()}t.services.events.dispatchEvent(O.CirclePack.CIRCLE_CLICK,{event:n,element:i,datum:r})})}destroy(){this.parent.selectAll("circle.node").on("mouseover",null).on("mousemove",null).on("mouseout",null).on("click",null);const t=this.services.events;t.removeEventListener(O.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(O.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut),this.removeBackgroundListeners()}}function bN(e,t){const n=Ri(this._current,e);return r=>(this._current=n(r),t(this._current))}class u0 extends xt{constructor(){super(...arguments),this.type="pie",this.renderType=rt.SVG,this.isRendering=!1,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail,{groupMapsTo:r}=this.getOptions().data;this.parent.selectAll("path.slice").transition("legend-hover-bar").call(i=>this.services.transitions.setupTransition({transition:i,name:"legend-hover-bar"})).attr("opacity",i=>i.data[r]!==n.datum().name?.3:1)},this.handleLegendMouseOut=()=>{this.parent.selectAll("path.slice").transition("legend-mouseout-bar").call(t=>this.services.transitions.setupTransition({transition:t,name:"legend-mouseout-bar"})).attr("opacity",1)}}init(){const t=this.services.events;t.addEventListener(O.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(O.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}getInnerRadius(){return Ht.innerRadius}render(t=!0){const n=this,r=this.getComponentContainer(),i=this.getOptions(),{groupMapsTo:s}=i.data,{valueMapsTo:a}=i.pie;this.isRendering=!0;const o=this.model.getDisplayData().filter(D=>D[a]>0),l=this.computeRadius();this.arc=is().innerRadius(this.getInnerRadius()).outerRadius(l),this.hoverArc=is().innerRadius(this.getInnerRadius()).outerRadius(l+Ht.hoverArc.outerRadiusOffset);const c=BS().value(D=>D[a]).sort(x(i,"pie","sortFunction")).padAngle(Ht.padAngle)(o),u=N.appendOrSelect(r,"g.slices").attr("role",dt.GROUP).attr("data-name","slices").selectAll("path.slice").data(c,D=>D.data[s]);u.exit().attr("opacity",0).remove(),u.enter().append("path").classed("slice",!0).attr("opacity",0).merge(u).attr("class",D=>this.model.getColorClassName({classNameTypes:[at.FILL],dataGroupName:D.data[s],originalClassName:"slice"})).style("fill",D=>n.model.getFillColor(D.data[s],null,D.data)).attr("d",this.arc).transition().call(D=>this.services.transitions.setupTransition({transition:D,name:"pie_slice_enter_update",animate:t})).attr("opacity",1).attr("role",dt.GRAPHICS_SYMBOL).attr("aria-roledescription","slice").attr("aria-label",D=>`${D[a]}, ${au(D.data[a],o,a)+"%"}`).attrTween("d",function(D){return bN.bind(this)(D,n.arc)}).on("end",()=>{n.isRendering=!1});const{code:d,number:h}=x(i,"locale"),f=i.pie.labels.enabled,p=f?c.filter(D=>D.data[a]>0):[],v=N.appendOrSelect(r,"g.labels").attr("role",dt.GROUP).attr("data-name","labels").selectAll("text.pie-label").data(p,D=>D.data[s]);v.exit().attr("opacity",0).remove();const m=v.enter().append("text").classed("pie-label",!0),y=[];m.merge(v).style("text-anchor","middle").text(D=>i.pie.labels.formatter?i.pie.labels.formatter({...D,percentageValue:au(D.data[a],o,a,!0)}):h(au(D.data[a],o,a),d)+"%").datum(function(D){const R=l+7,M=(D.endAngle-D.startAngle)/2+D.startAngle,V=M/Math.PI*180,P=this.getComputedTextLength();return D.textOffsetX=P/2,D.textOffsetY=V>90&&V<270?10:0,D.xPosition=(D.textOffsetX+R)*Math.sin(M),D.yPosition=(D.textOffsetY+R)*-Math.cos(M),D}).attr("transform",function(D,R){const M=p.length,V=(D.endAngle-D.startAngle)*(180/Math.PI);if(R>=M-2&&V<Ht.callout.minSliceDegree){let P,H;return D.index===M-1?(P=D.xPosition+Ht.callout.offsetX+Ht.callout.textMargin+D.textOffsetX,H=D.yPosition-Ht.callout.offsetY,D.direction=Ws.RIGHT,y.push(D)):(P=D.xPosition-Ht.callout.offsetX-D.textOffsetX-Ht.callout.textMargin,H=D.yPosition-Ht.callout.offsetY,D.direction=Ws.LEFT,y.push(D)),`translate(${P}, ${H})`}return`translate(${D.xPosition}, ${D.yPosition})`}),this.renderCallouts(y);const g=x(i,"donut")?"donut":"pie",b=x(i,g,"alignment"),{width:w}=N.getSVGElementSize(this.getParent(),{useAttrs:!0}),_=f?Ht.xOffset:0,S=f?Ht.yOffset:0;let L=l+_;b===Kt.CENTER?L=w/2:b===Kt.RIGHT&&(L=w-l-Ht.xOffset);let I=l+S;y.length>0&&(I+=Ht.yOffsetCallout),r.attr("x",L+7).attr("y",I),this.addEventListeners()}renderCallouts(t){const n=N.appendOrSelect(this.getComponentContainer(),"g.callouts").attr("role",dt.GROUP).attr("data-name","callouts"),r=n.selectAll("g.callout").data(t);r.exit().remove();const i=r.enter().append("g").classed("callout",!0).attr("role",dt.GROUP).attr("aria-roledescription","label callout");i.merge(r).datum(function(s){const{xPosition:a,yPosition:o,direction:l}=s;return l===Ws.RIGHT?(s.startPos={x:a,y:o+s.textOffsetY},s.endPos={x:a+Ht.callout.offsetX,y:o-Ht.callout.offsetY+s.textOffsetY},s.intersectPointX=s.endPos.x-Ht.callout.horizontalLineLength):(s.startPos={x:a,y:o+s.textOffsetY},s.endPos={x:a-Ht.callout.offsetX,y:o-Ht.callout.offsetY+s.textOffsetY},s.intersectPointX=s.endPos.x+Ht.callout.horizontalLineLength),s}),i.append("line").classed("vertical-line",!0).merge(n.selectAll("line.vertical-line")).datum(function(){return k(this.parentNode).datum()}).style("stroke-width","1px").attr("x1",s=>s.startPos.x).attr("y1",s=>s.startPos.y).attr("x2",s=>s.intersectPointX).attr("y2",s=>s.endPos.y),i.append("line").classed("horizontal-line",!0).merge(n.selectAll("line.horizontal-line")).datum(function(){return k(this.parentNode).datum()}).style("stroke-width","1px").attr("x1",s=>s.intersectPointX).attr("y1",s=>s.endPos.y).attr("x2",s=>s.endPos.x).attr("y2",s=>s.endPos.y)}addEventListeners(){const t=this;this.parent.selectAll("path.slice").on("mouseover",function(n,r){const i=k(this);t.isRendering||i.classed("hovered",!0).transition("pie_slice_mouseover").call(o=>t.services.transitions.setupTransition({transition:o,name:"pie_slice_mouseover"})).attr("d",t.hoverArc),t.services.events.dispatchEvent(O.Pie.SLICE_MOUSEOVER,{event:n,element:k(this),datum:r});const{groupMapsTo:s}=t.getOptions().data,{valueMapsTo:a}=t.getOptions().pie;t.services.events.dispatchEvent(O.Tooltip.SHOW,{event:n,hoveredElement:i,items:[{label:r.data[s],value:r.data[a]}]})}).on("mousemove",function(n,r){const i=k(this);t.services.events.dispatchEvent(O.Pie.SLICE_MOUSEMOVE,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(O.Tooltip.MOVE,{event:n})}).on("click",function(n,r){t.services.events.dispatchEvent(O.Pie.SLICE_CLICK,{event:n,element:k(this),datum:r})}).on("mouseout",function(n,r){const i=k(this);sk(()=>{t.isRendering||i.classed("hovered",!1).transition("pie_slice_mouseout").call(s=>t.services.transitions.setupTransition({transition:s,name:"pie_slice_mouseout"})).attr("d",t.arc)},100),t.services.events.dispatchEvent(O.Pie.SLICE_MOUSEOUT,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(O.Tooltip.HIDE,{hoveredElement:i})})}computeRadius(){const{width:t,height:n}=N.getSVGElementSize(this.parent,{useAttrs:!0}),r=this.getOptions(),i=Math.min(t,n)/2;return r.pie.labels.enabled?i+Ht.radiusOffset:i}}class EN extends u0{constructor(){super(...arguments),this.type="donut",this.renderType=rt.SVG}render(t=!0){super.render(t);const n=this;if(this.model.isDataEmpty()){this.getComponentContainer().select("g.center").remove();return}const r=N.appendOrSelect(this.getComponentContainer(),"g.center"),i=this.getOptions(),s=this.computeRadius(),a=x(i,"donut","center","label");N.appendOrSelect(r,"text.donut-figure").attr("text-anchor","middle").style("dominant-baseline",()=>a===null||a===""?"central":"initial").style("font-size",()=>i.donut.center.numberFontSize(s)).transition().call(o=>this.services.transitions.setupTransition({transition:o,name:"donut-figure-enter-update",animate:t})).tween("text",function(){return n.centerNumberTween(k(this))}),a!==null&&a!==""&&N.appendOrSelect(r,"text.donut-title").attr("text-anchor","middle").style("font-size",()=>i.donut.center.titleFontSize(s)).attr("y",i.donut.center.titleYPosition(s)).text(a)}getInnerRadius(){return this.computeRadius()*(3/4)}centerNumberTween(t){const n=this.getOptions();let r=x(n,"donut","center","number");r===null&&(r=this.model.getDisplayData().reduce((o,l)=>o+l[n.pie.valueMapsTo],0));const i=parseInt(t.text().replace(/[, ]+/g,""),10)||0;let s;i%1===0&&r%1===0?s=yd:s=Oe;const a=s(i,r);return o=>{const{numberFormatter:l}=n.donut.center;if(l)t.text(l(a(o)));else{const{code:c,number:u}=x(n,"locale");t.text(u(Math.floor(a(o)),c))}}}}const h0="4,10 8,6 12,10",d0="12,6 8,10 4,6";class _N extends xt{constructor(){super(...arguments),this.type="gauge",this.renderType=rt.SVG}getValue(){var t;return((t=this.model.getData().find(n=>n.group==="value"))==null?void 0:t.value)??null}getValueRatio(){return Tv(this.getValue(),0,100)/100}getDelta(){var t;return((t=this.model.getData().find(n=>n.group==="delta"))==null?void 0:t.value)??null}getArcRatio(){const t=this.getOptions();return x(t,"gauge","type")===Nr.FULL?1:.5}getArcSize(){return this.getArcRatio()*Math.PI*2}getStartAngle(){const t=this.getArcSize();return t===2*Math.PI?0:-t/2}getArrow(t){const n=this.getOptions();switch(x(n,"gauge","deltaArrow","direction")){case tl.UP:return h0;case tl.DOWN:return d0;default:return t>0?h0:d0}}render(t=!0){const n=this.getComponentContainer().attr("width","100%").attr("height","100%"),r=this.getOptions(),i=this.getValue(),s=this.getValueRatio(),a=this.getArcSize(),o=this.getStartAngle(),l=s*a,c=o+l,u=o+a,d=this.computeRadius(),h=this.getInnerRadius();this.backgroundArc=is().innerRadius(h).outerRadius(d).startAngle(c).endAngle(u),this.arc=is().innerRadius(h).outerRadius(d).startAngle(o).endAngle(c),N.appendOrSelect(n,"path.arc-background").attr("d",this.backgroundArc);const f=n.selectAll("path.arc-foreground").data([i]);f.enter().append("path").merge(f).attr("class",this.model.getColorClassName({classNameTypes:[at.FILL],dataGroupName:"value",originalClassName:"arc-foreground"})).style("fill",()=>x(this.getOptions(),"color","scale","value")).attr("d",this.arc).attr("role",dt.GRAPHICS_SYMBOL).attr("aria-roledescription","value").attr("aria-label",y=>y),this.drawValueNumber(),this.drawDelta(),f.exit().remove();const p=x(r,"gauge","alignment"),{width:v}=N.getSVGElementSize(this.getParent(),{useAttrs:!0});let m=d;p===Kt.CENTER?m=v/2:p===Kt.RIGHT&&(m=v-d),n.attr("x",m).attr("y",d),this.addEventListeners()}drawValueNumber(){const t=this.getComponentContainer(),n=this.getOptions(),r=x(n,"gauge","type"),i=this.getValue(),s=this.getDelta(),a=this.computeRadius(),o=x(n,"gauge","valueFontSize"),l=x(n,"gauge","deltaFontSize"),c=x(n,"gauge","numberSpacing"),u=x(n,"gauge","showPercentageSymbol");let d=0;r===Nr.FULL&&!s?d=l(a):r===Nr.SEMI&&s&&(d=-(l(a)+c));const h=N.appendOrSelect(t,"g.gauge-numbers").attr("transform",`translate(0, ${d})`),f=o(a),p=N.appendOrSelect(h,"g.gauge-value-number"),{code:v,number:m}=x(n,"locale"),y=x(n,"gauge","numberFormatter"),g=p.selectAll("text.gauge-value-number").data([i]);g.enter().append("text").attr("class","gauge-value-number").merge(g).style("font-size",`${f}px`).attr("text-anchor","middle").text(D=>{let R;return D!=null?R=Number(D.toFixed(2))%1!==0?D.toFixed(2):D.toFixed():R=0,y?y(R):m(Number(R),v)});const{width:b}=N.getSVGElementSize(N.appendOrSelect(t,"text.gauge-value-number"),{useBBox:!0}),w=f/2,_=u?"%":"",S=N.appendOrSelect(p,"text.gauge-value-symbol").style("font-size",`${w}px`).attr("x",b/2).text(_),{width:L,height:I}=N.getSVGElementSize(S,{useBBox:!0});S.attr("y",`-${I/2}px`),p.attr("transform",`translate(-${L/2}, 0)`)}drawDelta(){const t=this,n=this.getComponentContainer(),r=this.getOptions(),i=this.getDelta(),{code:s,number:a}=x(r,"locale");if(i){const o=this.computeRadius(),l=i?x(r,"gauge","deltaFontSize"):()=>0,c=i?x(r,"gauge","numberFormatter"):()=>null,u=x(r,"gauge","deltaArrow","size"),d=x(r,"gauge","numberSpacing"),h=x(r,"gauge","showPercentageSymbol"),f=N.appendOrSelect(n,"g.gauge-numbers"),p=N.appendOrSelect(f,"g.gauge-delta").attr("transform",`translate(0, ${l(o)+d})`),v=N.appendOrSelect(p,"text.gauge-delta-number"),m=h?"%":"";v.data(i===null?[]:[i]),v.enter().append("text").classed("gauge-delta-number",!0).merge(v).attr("text-anchor","middle").style("font-size",`${l(o)}px`).text(w=>{let _;return w!=null?_=Number(w.toFixed(2))%1!==0?w.toFixed(2):w.toFixed():_=0,c?`${c(_)}${m}`:`${a(Number(_),s)}${m}`});const{width:y}=N.getSVGElementSize(N.appendOrSelect(n,".gauge-delta-number"),{useBBox:!0}),g=x(r,"gauge","deltaArrow","enabled"),b=p.selectAll("svg.gauge-delta-arrow").data(i!==null&&g?[i]:[]);b.enter().append("svg").merge(b).attr("class","gauge-delta-arrow").attr("x",-u(o)-y/2).attr("y",-u(o)/2-l(o)*.35).attr("width",u(o)).attr("height",u(o)).attr("viewBox","0 0 16 16").each(function(){const w=k(this);N.appendOrSelect(w,"rect.gauge-delta-arrow-backdrop").attr("width","16").attr("height","16").attr("fill","none");const _=x(r,"gauge","status");N.appendOrSelect(w,"polygon.gauge-delta-arrow").attr("class",_!==null?`gauge-delta-arrow status--${_}`:"").attr("points",t.getArrow(i))}),b.exit().remove(),v.exit().remove()}else{const o=n.select("g.gauge-delta");o.empty()||o.remove()}}getInnerRadius(){const t=this.computeRadius(),n=x(this.getOptions(),"gauge","arcWidth");return t-n}addEventListeners(){const t=this;this.parent.selectAll("path.arc-foreground").on("mouseover",function(n,r){t.services.events.dispatchEvent(O.Gauge.ARC_MOUSEOVER,{event:n,element:k(this),datum:r})}).on("mousemove",function(n,r){const i=k(this);t.services.events.dispatchEvent(O.Gauge.ARC_MOUSEMOVE,{event:n,element:i,datum:r})}).on("click",function(n,r){t.services.events.dispatchEvent(O.Gauge.ARC_CLICK,{event:n,element:k(this),datum:r})}).on("mouseout",function(n,r){const i=k(this);t.services.events.dispatchEvent(O.Gauge.ARC_MOUSEOUT,{event:n,element:i,datum:r})})}computeRadius(){const t=this.getOptions(),n=x(t,"gauge","type"),{width:r,height:i}=N.getSVGElementSize(this.parent,{useAttrs:!0});return n===Nr.SEMI?Math.min(r/2,i):Math.min(r/2,i/2)}}class f0 extends Qu{constructor(){super(...arguments),this.type="grouped-bar",this.renderType=rt.SVG,this.padding=5,this.defaultStepFactor=70,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail,{groupMapsTo:r}=this.getOptions().data;this.parent.selectAll("path.bar").transition("legend-hover-bar").call(i=>this.services.transitions.setupTransition({transition:i,name:"legend-hover-bar"})).attr("opacity",i=>i[r]!==n.datum().name?.3:1)},this.handleLegendMouseOut=()=>{this.parent.selectAll("path.bar").transition("legend-mouseout-bar").call(t=>this.services.transitions.setupTransition({transition:t,name:"legend-mouseout-bar"})).attr("opacity",1)}}init(){const t=this.services.events;t.addEventListener(O.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(O.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t){const n=this.model.getDisplayData(this.configs.groups),r=this.getOptions(),{groupMapsTo:i}=r.data;this.setGroupScale();const s=this.getComponentContainer({withinChartClip:!0}),a=bs(n.map(u=>{const d=this.services.cartesianScales.getDomainIdentifier(u);return u[d]&&typeof u[d].toString=="function"?u[d].toString():u[d]})),o=s.selectAll("g.bars").data(a,u=>u);o.exit().attr("opacity",0).remove();const l=o.enter().append("g").classed("bars",!0).attr("role",dt.GROUP).attr("data-name","bars").merge(o);l.transition().call(u=>this.services.transitions.setupTransition({transition:u,name:"bar-group-update-enter",animate:t})).attr("transform",u=>{const d=this.services.cartesianScales.getDomainValue(u)-this.getGroupWidth()/2;return this.services.cartesianScales.getOrientation()===Jt.VERTICAL?`translate(${d}, 0)`:`translate(0, ${d})`});const c=l.selectAll("path.bar").data(u=>this.getDataCorrespondingToLabel(u),u=>u[i]);c.exit().attr("opacity",0).remove(),c.enter().append("path").attr("opacity",0).merge(c).classed("bar",!0).transition().call(u=>this.services.transitions.setupTransition({transition:u,name:"bar-update-enter",animate:t})).attr("class",u=>this.model.getColorClassName({classNameTypes:[at.FILL],dataGroupName:u[i],originalClassName:"bar"})).style("fill",u=>{const d=this.services.cartesianScales.getDomainIdentifier(u);return this.model.getFillColor(u[i],u[d],u)}).attr("d",u=>{const d=this.groupScale(u[i]),h=this.getBarWidth(),f=d,p=d+h,v=this.services.cartesianScales.getRangeAxisPosition({datum:u}),m=this.services.cartesianScales.getDomainLowerBound(v),y=this.services.cartesianScales.getValueThroughAxisPosition(v,m),g=this.services.cartesianScales.getRangeValue(u),b=this.services.cartesianScales.getDomainValue(u)-h/2,w=b+h;if(!this.isOutsideZoomedDomain(b,w))return pe({x0:f,x1:p,y0:y,y1:g},this.services.cartesianScales.getOrientation())}).attr("opacity",1).attr("role",dt.GRAPHICS_SYMBOL).attr("aria-roledescription","bar").attr("aria-label",u=>u.value),this.addEventListeners()}addEventListeners(){const t=this;this.parent.selectAll("path.bar").on("mouseover",function(n,r){const i=k(this);i.classed("hovered",!0),t.services.events.dispatchEvent(O.Bar.BAR_MOUSEOVER,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(O.Tooltip.SHOW,{event:n,hoveredElement:i,data:[r]})}).on("mousemove",function(n,r){const i=k(this);t.services.events.dispatchEvent(O.Bar.BAR_MOUSEMOVE,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(O.Tooltip.MOVE,{event:n})}).on("click",function(n,r){t.services.events.dispatchEvent(O.Bar.BAR_CLICK,{event:n,element:k(this),datum:r})}).on("mouseout",function(n,r){const i=k(this);i.classed("hovered",!1),t.services.events.dispatchEvent(O.Bar.BAR_MOUSEOUT,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(O.Tooltip.HIDE,{hoveredElement:i})})}destroy(){this.parent.selectAll("path.bar").on("mouseover",null).on("mousemove",null).on("mouseout",null);const t=this.services.events;t.removeEventListener(O.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(O.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}getDataCorrespondingToLabel(t){return this.model.getDisplayData(this.configs.groups).filter(n=>{const r=this.services.cartesianScales.getDomainIdentifier(n);return n[r].toString()===t})}getGroupWidth(){const t=this.model.getGroupedData(this.configs.groups),n=this.getTotalGroupPadding();return this.getBarWidth()*t.length+n}getDomainScaleStep(){const t=this.services.cartesianScales.getDomainScale(),n=this.model.getGroupedData(this.configs.groups);let r=this.defaultStepFactor;if(typeof t.step=="function")r=t.step();else if(n.length>0){const i=n.find(s=>{var a;return((a=s.data)==null?void 0:a.length)>1});if(i){const s=this.services.cartesianScales.getDomainIdentifier(i.data[0]);r=Math.abs(t(i.data[1][s])-t(i.data[0][s]))}}return r}getTotalGroupPadding(){const t=this.model.getGroupedData(this.configs.groups);return t.length===1?0:Math.min(5,5*(this.getDomainScaleStep()/this.defaultStepFactor))*(t.length-1)}getBarWidth(){const t=this.getOptions(),n=x(t,"bars","width"),r=x(t,"bars","maxWidth");if(n!==null&&(r===null||n<=r))return n;const i=this.model.getGroupedData(this.configs.groups).length,s=this.getTotalGroupPadding();return Math.min(r,(this.getDomainScaleStep()-s)/i)}setGroupScale(){const t=this.model.getActiveDataGroupNames(this.configs.groups);this.groupScale=Qi().domain(t).rangeRound([0,this.getGroupWidth()])}}class wN extends xt{constructor(){super(...arguments),this.type="heatmap",this.renderType=rt.SVG,this.matrix={},this.xBandwidth=0,this.yBandwidth=0,this.translationUnits={x:0,y:0},this.handleAxisOnHover=t=>{const{detail:n}=t,{datum:r}=n,i=this.model.getUniqueRanges(),s=this.model.getUniqueDomain(),a=this.services.cartesianScales.getDomainLabel(),o=this.services.cartesianScales.getRangeLabel(),l=this.services.cartesianScales.getMainXScale(),c=this.services.cartesianScales.getMainYScale();let u="",d=null,h=null,f=null;this.matrix[r]!==void 0?(u=a,i.forEach(p=>{if(typeof this.matrix[r][p].value=="number"){const v=this.matrix[r][p].value;if(d===null){d=v,h=v,f=v;return}d+=v,h=v<h?v:h,f=v>f?v:f}})):(u=o,s.forEach(p=>{if(typeof this.matrix[p][r].value=="number"){const v=this.matrix[p][r].value;if(d===null){d=v,h=v,f=v;return}d+=v,h=v<h?v:h,f=v>f?v:f}})),l(r)!==void 0?this.parent.select("g.multi-cell.column-highlight").classed("highlighter-hidden",!1).attr("transform",`translate(${l(r)}, ${Vn(c.range())})`):c(r)!==void 0&&this.parent.select("g.multi-cell.row-highlight").classed("highlighter-hidden",!1).attr("transform",`translate(${Vn(l.range())},${c(r)})`),this.services.events.dispatchEvent(O.Tooltip.SHOW,{event:n.event,hoveredElement:k(t.detail.element),items:[{label:u,value:r,bold:!0},{label:"Min",value:h!==null?h:"-"},{label:"Max",value:f!==null?f:"-"},{label:"Average",value:d!==null?d/s.length:"-"}]})},this.handleAxisMouseOut=t=>{this.parent.selectAll("g.multi-cell").classed("highlighter-hidden",!0),this.services.events.dispatchEvent(O.Tooltip.HIDE,{event:t})}}init(){const t=this.services.events;t.addEventListener(O.Axis.LABEL_MOUSEOVER,this.handleAxisOnHover),t.addEventListener(O.Axis.LABEL_MOUSEOUT,this.handleAxisMouseOut),t.addEventListener(O.Axis.LABEL_FOCUS,this.handleAxisOnHover),t.addEventListener(O.Axis.LABEL_BLUR,this.handleAxisMouseOut)}render(t=!0){const n=this.getComponentContainer({withinChartClip:!0});n.lower();const{cartesianScales:r}=this.services;if(this.matrix=this.model.getMatrix(),n.html(""),x(this.getOptions(),"data","loading"))return;const i=r.getMainXScale(),s=r.getMainYScale(),a=r.getDomainIdentifier(),o=r.getRangeIdentifier(),l=this.model.getUniqueDomain(),c=this.model.getUniqueRanges(),u=this.model.getMatrixAsArray(),d=i.range(),h=s.range();this.xBandwidth=Math.abs((d[1]-d[0])/l.length),this.yBandwidth=Math.abs((h[1]-h[0])/c.length);const f=this.services.domUtils.generateElementIDString("heatmap-pattern-stripes");n.append("defs").append("pattern").attr("id",f).attr("width",3).attr("height",3).attr("patternUnits","userSpaceOnUse").attr("patternTransform","rotate(45)").append("rect").classed("pattern-fill",!0).attr("width",.5).attr("height",8);const p=n.selectAll().data(u).enter().append("g").attr("class",v=>`heat-${v.index}`).classed("cell",!0).attr("transform",v=>`translate(${i(v[a])}, ${s(v[o])})`).append("rect").attr("class",v=>this.model.getColorClassName({value:v.value,originalClassName:`heat-${v.index}`})).classed("heat",!0).classed("null-state",v=>v.index===-1||v.value===null).attr("width",this.xBandwidth).attr("height",this.yBandwidth).style("fill",v=>{const m=this.services.cartesianScales.getDomainIdentifier(v);return v.index===-1||v.value===null?`url(#${f})`:this.model.getFillColor(Number(v.value),v[m],v)}).attr("aria-label",v=>v.value);this.createOuterBox("g.cell-highlight",this.xBandwidth,this.yBandwidth),this.createOuterBox("g.multi-cell.column-highlight",this.xBandwidth,Math.abs(h[1]-h[0])),this.createOuterBox("g.multi-cell.row-highlight",Math.abs(d[1]-d[0]),this.yBandwidth),this.determineDividerStatus()&&(p.style("stroke-width","1px"),this.parent.select("g.cell-highlight").classed("cell-2",!0)),this.addEventListener()}createOuterBox(t,n,r){const i=N.appendOrSelect(this.parent,t).classed("shadows",!0).classed("highlighter-hidden",!0);N.appendOrSelect(i,"line.top").attr("x1",-1).attr("x2",n+1),N.appendOrSelect(i,"line.left").attr("x1",0).attr("y1",-1).attr("x2",0).attr("y2",r+1),N.appendOrSelect(i,"line.down").attr("x1",-1).attr("x2",n+1).attr("y1",r).attr("y2",r),N.appendOrSelect(i,"line.right").attr("x1",n).attr("x2",n).attr("y1",-1).attr("y2",r+1)}determineDividerStatus(){const t=x(this.getOptions(),"heatmap","divider","state");return t!==Oi.OFF&&(t===Oi.AUTO&&eg.minCellDividerDimension<=this.xBandwidth&&eg.minCellDividerDimension<=this.yBandwidth||t===Oi.ON)}addEventListener(){const t=this,{cartesianScales:n}=this.services,r=this.getOptions(),i=_t(r,"locale.translations.total")||_t(r,"tooltip.totalLabel")||"Total",s=n.getDomainIdentifier(),a=n.getRangeIdentifier(),o=n.getDomainLabel(),l=n.getRangeLabel();this.parent.selectAll("g.cell").on("mouseover",function(c,u){const d=k(this),h=d.select("rect.heat");if(!h.classed("null-state")){const f=_s(d.attr("transform"));t.parent.select("g.cell-highlight").attr("transform",`translate(${f.x+t.translationUnits.x}, ${f.y+t.translationUnits.y})`).classed("highlighter-hidden",!1),t.services.events.dispatchEvent(O.Heatmap.HEATMAP_MOUSEOVER,{event:c,element:h,datum:u}),t.services.events.dispatchEvent(O.Tooltip.SHOW,{event:c,items:[{label:o,value:u[s]},{label:l,value:u[a]},{label:i,value:u.value,color:h.style("fill")}]})}}).on("mousemove",function(c,u){t.services.events.dispatchEvent(O.Heatmap.HEATMAP_MOUSEMOVE,{event:c,element:k(this),datum:u}),t.services.events.dispatchEvent(O.Tooltip.MOVE,{event:c})}).on("click",function(c,u){t.services.events.dispatchEvent(O.Heatmap.HEATMAP_CLICK,{event:c,element:k(this),datum:u})}).on("mouseout",function(c,u){const d=k(this).select("rect.heat"),h=d.classed("null-state");t.parent.select("g.cell-highlight").classed("highlighter-hidden",!0),h||(t.services.events.dispatchEvent(O.Heatmap.HEATMAP_MOUSEOUT,{event:c,element:d,datum:u}),t.services.events.dispatchEvent(O.Tooltip.HIDE,{event:c,hoveredElement:d}))})}destroy(){this.parent.selectAll("rect.heat").on("mouseover",null).on("mousemove",null).on("click",null).on("mouseout",null);const t=this.services.events;t.removeEventListener(O.Legend.ITEM_HOVER,this.handleAxisOnHover),t.removeEventListener(O.Legend.ITEM_MOUSEOUT,this.handleAxisMouseOut)}}class SN extends xt{constructor(){super(...arguments),this.type="histogram",this.renderType=rt.SVG,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail,r=this.getOptions(),{groupMapsTo:i}=r.data;this.parent.selectAll("path.bar").transition("legend-hover-bar").call(s=>this.services.transitions.setupTransition({transition:s,name:"legend-hover-bar"})).attr("opacity",s=>s[i]!==n.datum().name?.3:1)},this.handleLegendMouseOut=()=>{this.parent.selectAll("path.bar").transition("legend-mouseout-bar").call(t=>this.services.transitions.setupTransition({transition:t,name:"legend-mouseout-bar"})).attr("opacity",1)}}init(){const t=this.services.events;t.addEventListener(O.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(O.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t){const n=this.getComponentContainer(),r=this.model.getOptions(),{groupIdentifier:i}=r,{groupMapsTo:s}=r.data,a=this.model.getBinnedStackedData(),o=this.services.cartesianScales.getMainXScale(),l=n.selectAll("g.bars").data(a,u=>_t(u,`0.${s}`));l.exit().attr("opacity",0).remove(),l.enter().append("g").classed("bars",!0).attr("role",dt.GROUP);const c=n.selectAll("g.bars").selectAll("path.bar").data(u=>u);c.exit().remove(),c.enter().append("path").merge(c).classed("bar",!0).attr(i,(u,d)=>d).transition().call(u=>this.services.transitions.setupTransition({transition:u,name:"histogram-bar-update-enter",animate:t})).attr("class",u=>this.model.getColorClassName({classNameTypes:[at.FILL],dataGroupName:u[s],originalClassName:"bar"})).style("fill",u=>this.model.getFillColor(u[s],null,u)).attr("d",u=>{const d=_t(u,"data");if(!d)return;const h=o(d.x1)-o(d.x0)-1,f=this.services.cartesianScales.getDomainValue(d.x0),p=f+h,v=this.services.cartesianScales.getRangeValue(u[0]);let m=this.services.cartesianScales.getRangeValue(u[1]);return Math.abs(m-v)>0&&Math.abs(m-v)>r.bars.dividerSize&&(this.services.cartesianScales.getOrientation()===Jt.VERTICAL?m+=1:m-=1),pe({x0:f,x1:p,y0:v,y1:m},this.services.cartesianScales.getOrientation())}).attr("opacity",1).attr("role",dt.GRAPHICS_SYMBOL).attr("aria-roledescription","bar").attr("aria-label",u=>x(u,"data",u[s])),this.addEventListeners()}addEventListeners(){const t=this.model.getOptions(),{groupMapsTo:n}=t.data,{code:r,number:i}=x(t,"locale"),s=this;this.parent.selectAll("path.bar").on("mouseover",function(a,o){const l=k(this);l.classed("hovered",!0);const c=i(parseFloat(_t(o,"data.x0")),r),u=i(parseFloat(_t(o,"data.x1")),r),d=s.services.cartesianScales.getRangeAxisPosition(),h=s.services.cartesianScales.getScaleLabel(d);s.services.events.dispatchEvent(O.Tooltip.SHOW,{event:a,hoveredElement:l,items:[{label:_t(t,"bins.rangeLabel")||"Range",value:`${c} – ${u}`},{label:t.tooltip.groupLabel||"Group",value:o[n],class:s.model.getColorClassName({classNameTypes:[at.TOOLTIP],dataGroupName:o[n]})},{label:h,value:_t(o,`data.${o[n]}`)}]})}).on("mousemove",function(a){s.services.events.dispatchEvent(O.Tooltip.MOVE,{event:a})}).on("mouseout",function(){k(this).classed("hovered",!1),s.services.events.dispatchEvent(O.Tooltip.HIDE)})}destroy(){this.parent.selectAll("path.bar").on("mouseover",null).on("mousemove",null).on("mouseout",null);const t=this.services.events;t.removeEventListener(O.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(O.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}}class ON extends mn{constructor(){super(...arguments),this.type="lollipop",this.renderType=rt.SVG,this.handleScatterOnHover=t=>{const n=t.detail,r=this.getOptions(),{groupMapsTo:i}=r.data;this.parent.selectAll("line.line").attr("stroke-width",s=>s[i]!==n.datum[i]?Dn.weight.unselected:Dn.weight.selected)},this.handleScatterOnMouseOut=()=>{this.parent.selectAll("line.line").attr("stroke-width",Dn.weight.unselected)},this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail,r=this.getOptions(),{groupMapsTo:i}=r.data;this.parent.selectAll("line.line").transition("legend-hover-line").call(s=>this.services.transitions.setupTransition({transition:s,name:"legend-hover-line"})).attr("opacity",s=>s[i]!==n.datum().name?Dn.opacity.unselected:Dn.opacity.selected)},this.handleLegendMouseOut=()=>{this.parent.selectAll("line.line").transition("legend-mouseout-line").call(t=>this.services.transitions.setupTransition({transition:t,name:"legend-mouseout-line"})).attr("opacity",Dn.opacity.selected)}}init(){const{events:t}=this.services;t.addEventListener(O.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(O.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t){const n=this.getComponentContainer({withinChartClip:!0}),r=this.model.getOptions(),{groupMapsTo:i}=r.data,{cartesianScales:s}=this.services,a=s.getMainXScale(),o=s.getMainYScale(),l=s.getDomainIdentifier(),c=m=>s.getDomainValue(m),u=m=>s.getRangeValue(m),d=s.getOrientation(),[h,f]=In(c,u,d),p=n.selectAll("line.line").data(this.getScatterData(),m=>`${m[i]}-${m[l]}`);p.exit().attr("opacity",0).remove();const v=p.enter().append("line").attr("opacity",0).merge(p).classed("line",!0).attr("class",m=>this.model.getColorClassName({classNameTypes:[at.STROKE],dataGroupName:m[i],originalClassName:"line"})).transition().call(m=>this.services.transitions.setupTransition({transition:m,name:"lollipop-line-update-enter",animate:t})).style("stroke",m=>this.model.getFillColor(m[i],m[l],m)).attr("opacity",1);d===Jt.HORIZONTAL?v.attr("y1",f).attr("y2",f).attr("x1",a.range()[0]).attr("x2",m=>h(m)-r.points.radius):v.attr("x1",h).attr("x2",h).attr("y1",o.range()[0]).attr("y2",m=>f(m)+r.points.radius),this.addScatterPointEventListeners()}addScatterPointEventListeners(){this.services.events.addEventListener(O.Scatter.SCATTER_MOUSEOVER,this.handleScatterOnHover),this.services.events.addEventListener(O.Scatter.SCATTER_MOUSEOUT,this.handleScatterOnMouseOut)}destroy(){const t=this.services.events;t.removeEventListener(O.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(O.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut),t.removeEventListener(O.Scatter.SCATTER_MOUSEOVER,this.handleScatterOnHover),t.removeEventListener(O.Scatter.SCATTER_MOUSEOUT,this.handleScatterOnMouseOut)}}class TN extends xt{constructor(){super(...arguments),this.type="meter",this.renderType=rt.SVG}getStackedBounds(t,n){let r=0;return t.map((i,s)=>s!==0?(r+=n(i.value),{...i,width:Math.abs(n(i.value)-se.dividerWidth),x:r-n(i.value)}):(r=n(i.value),{...i,width:Math.abs(n(i.value)-se.dividerWidth),x:0}))}render(t=!0){const n=this,r=this.getComponentContainer(),i=this.getOptions(),s=x(i,"meter","proportional"),a=this.model.getDisplayData(),o=this.model.getStatus(),{width:l}=N.getSVGElementSize(r,{useAttrs:!0}),{groupMapsTo:c}=i.data;let u;x(i,"meter","proportional")===null?u=100:u=x(i,"meter","proportional","total")||this.model.getMaximumDomain(this.model.getDisplayData());const d=Ze().domain([0,u]).range([0,l]),h=this.getStackedBounds(a,d),f=x(i,"meter","height");N.appendOrSelect(r,"rect.container").attr("x",0).attr("y",0).attr("width",l).attr("height",f||(s?se.height.proportional:se.height.default)),N.appendOrSelect(r,"line.rangeIndicator").attr("x1",l).attr("x2",l).attr("y1",0).attr("y2",f||(s?se.height.proportional:se.height.default));const p=r.selectAll("rect.value").data(h),v=o!=null&&!n.model.isUserProvidedColorScaleValid()&&!s?`value status--${o}`:"value";p.enter().append("rect").classed("value",!0).merge(p).attr("x",b=>b.x).attr("y",0).attr("height",()=>f||(s?se.height.proportional:se.height.default)).attr("class",b=>this.model.getColorClassName({classNameTypes:[at.FILL],dataGroupName:b[c],originalClassName:v})).transition().call(b=>this.services.transitions.setupTransition({transition:b,name:"meter-bar-update",animate:t})).attr("width",b=>b.value>u?d(u):b.width).style("fill",b=>n.model.getFillColor(b[c],null,b)).attr("role",dt.GRAPHICS_SYMBOL).attr("aria-roledescription","value").attr("aria-label",b=>b.value),p.exit().remove();const m=x(i,"meter","peak");let y=m;m!==null&&(m>u?y=u:m<a[0].value&&(y=a[0].value>u?u:a[0].value));const g=r.selectAll("line.peak").data(y==null?[]:[y]);g.enter().append("line").classed("peak",!0).merge(g).attr("y1",0).attr("y2",()=>f||(s?se.height.proportional:se.height.default)).transition().call(b=>this.services.transitions.setupTransition({transition:b,name:"peak-line-update",animate:t})).attr("x1",b=>d(b)).attr("x2",b=>d(b)).attr("role",dt.GRAPHICS_SYMBOL).attr("aria-roledescription","peak").attr("aria-label",b=>b),g.exit().remove(),this.services.domUtils.setSVGMaxHeight(),this.addEventListeners()}addEventListeners(){const t=this.getOptions(),{groupMapsTo:n}=t.data,r=this,i=x(t,"meter","proportional");this.parent.selectAll("rect.value").on("mouseover",function(s,a){const o=k(this);r.services.events.dispatchEvent(O.Meter.METER_MOUSEOVER,{event:s,element:o,datum:a}),i&&(o.classed("hovered",!0),r.services.events.dispatchEvent(O.Tooltip.SHOW,{event:s,hoveredElement:o,items:[{label:a[n],value:a.value}]}))}).on("mousemove",function(s,a){const o=k(this);r.services.events.dispatchEvent(O.Meter.METER_MOUSEMOVE,{event:s,element:o,datum:a}),i&&r.services.events.dispatchEvent(O.Tooltip.MOVE,{event:s})}).on("click",function(s,a){r.services.events.dispatchEvent(O.Meter.METER_CLICK,{event:s,element:k(this),datum:a})}).on("mouseout",function(s,a){const o=k(this);r.services.events.dispatchEvent(O.Meter.METER_MOUSEOUT,{event:s,element:o,datum:a}),i&&(o.classed("hovered",!1),r.services.events.dispatchEvent(O.Tooltip.HIDE,{hoveredElement:o}))})}destroy(){this.parent.selectAll("rect.value").on("mouseover",null).on("mousemove",null).on("mouseout",null).on("click",null)}}class MN extends xt{constructor(){super(...arguments),this.type="radar",this.renderType=rt.SVG,this.getLabelDimensions=t=>{const n=N.appendOrSelect(this.getComponentContainer(),"g.tmp-tick"),r=N.appendOrSelect(n,"text").text(t),{width:i,height:s}=N.getSVGElementSize(r.node(),{useBBox:!0});return n.remove(),{width:i,height:s}},this.normalizeFlatData=t=>{const n=this.getOptions(),{angle:r,value:i}=x(n,"radar","axes"),s=x(n,"data","groupMapsTo"),a=ck(this.uniqueKeys.map(o=>this.uniqueGroups.map(l=>({[r]:o,[s]:l,[i]:null}))));return lt(a,t)},this.normalizeGroupedData=t=>{const n=this.getOptions(),{angle:r,value:i}=x(n,"radar","axes"),s=x(n,"data","groupMapsTo");return t.map(({name:a,data:o})=>{const l=this.uniqueKeys.map(c=>({[s]:a,[r]:c,[i]:null}));return{name:a,data:lt(l,o)}})},this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail;this.parent.selectAll("g.blobs path").transition("legend-hover-blob").call(r=>this.services.transitions.setupTransition({transition:r,name:"legend-hover-blob"})).style("fill-opacity",r=>r.name!==n.datum().name?Or.opacity.unselected:Or.opacity.selected).style("stroke-opacity",r=>r.name!==n.datum().name?Or.opacity.unselected:1)},this.handleLegendMouseOut=()=>{this.parent.selectAll("g.blobs path").transition("legend-mouseout-blob").call(t=>this.services.transitions.setupTransition({transition:t,name:"legend-mouseout-blob"})).style("fill-opacity",Or.opacity.selected).style("stroke-opacity",1)}}init(){const{events:t}=this.services;t.addEventListener(O.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(O.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t=!0){const n=this.getComponentContainer(),{width:r,height:i}=N.getSVGElementSize(n,{useAttrs:!0}),s=this.model.getData(),a=this.model.getGroupedData(),o=this.getOptions(),l=x(o,"data","groupMapsTo"),c=x(o,"radar","axes","value"),{angle:u,value:d}=x(o,"radar","axes"),{xLabelPadding:h,yLabelPadding:f,yTicksNumber:p,minRange:v,xAxisRectHeight:m}=Or;this.uniqueKeys=Array.from(new Set(s.map(E=>E[u]))),this.uniqueGroups=Array.from(new Set(s.map(E=>E[l]))),this.fullDataNormalized=this.normalizeFlatData(s),this.groupedDataNormalized=this.normalizeGroupedData(a);const y=2*(this.getLabelDimensions(this.uniqueKeys[0]).height+f),g=(Math.min(r,i)-y)/2;if(g<=0)return;const b=Qi().domain(this.fullDataNormalized.map(E=>E[u])).range([0,2*Math.PI].map(E=>E-Math.PI/2)),w=Vn(this.fullDataNormalized.map(E=>E[d])),_=Ze().domain([w>=0?0:w,ar(this.fullDataNormalized.map(E=>E[d]))]).range([v,g]).nice(p),S=_.ticks(p),L=(E,A,$)=>this.model.getFillColor(E,A,$),I=FS().angle(E=>b(E[u])+Math.PI/2).radius(E=>_(E[d])).curve(Ip),D=this.uniqueKeys.map(E=>{const A=this.getLabelDimensions(E).width,$=MR(b(E),g);return A+$}),R={x:ar(D)+h,y:i/2},M=N.appendOrSelect(n,"g.y-axes").attr("role",dt.GROUP).selectAll("path").data(S,E=>E),V=E=>this.uniqueKeys.map(A=>({[u]:A,[d]:E}));M.join(E=>E.append("path").attr("opacity",0).attr("transform",`translate(${R.x}, ${R.y})`).attr("fill","none").call(A=>A.transition().call($=>this.services.transitions.setupTransition({transition:$,name:"radar_y_axes_enter",animate:t})).attr("opacity",1).attr("d",$=>I(V($)))),E=>E.call(A=>A.transition().call($=>this.services.transitions.setupTransition({transition:$,name:"radar_y_axes_update",animate:t})).attr("opacity",1).attr("transform",`translate(${R.x}, ${R.y})`).attr("d",$=>I(V($)))),E=>E.call(A=>A.transition().call($=>this.services.transitions.setupTransition({transition:$,name:"radar_y_axes_exit",animate:t})).attr("d",$=>I(V($))).attr("opacity",0).remove())),N.appendOrSelect(n,"g.x-axes").attr("role",dt.GROUP).selectAll("line").data(this.uniqueKeys,E=>E).join(E=>E.append("line").attr("opacity",0).attr("class",A=>`x-axis-${fi(A)}`).attr("stroke-dasharray","0").attr("x1",A=>Yt(b(A),0,R).x).attr("y1",A=>Yt(b(A),0,R).y).attr("x2",A=>Yt(b(A),0,R).x).attr("y2",A=>Yt(b(A),0,R).y).call(A=>A.transition().call($=>this.services.transitions.setupTransition({transition:$,name:"radar_x_axes_enter",animate:t})).attr("opacity",1).attr("x1",$=>Yt(b($),_.range()[0],R).x).attr("y1",$=>Yt(b($),_.range()[0],R).y).attr("x2",$=>Yt(b($),_.range()[1],R).x).attr("y2",$=>Yt(b($),_.range()[1],R).y)),E=>E.call(A=>A.transition().call($=>this.services.transitions.setupTransition({transition:$,name:"radar_x_axes_update",animate:t})).attr("opacity",1).attr("x1",$=>Yt(b($),_.range()[0],R).x).attr("y1",$=>Yt(b($),_.range()[0],R).y).attr("x2",$=>Yt(b($),_.range()[1],R).x).attr("y2",$=>Yt(b($),_.range()[1],R).y)),E=>E.call(A=>A.transition().call($=>this.services.transitions.setupTransition({transition:$,name:"radar_x_axes_exit",animate:t})).attr("opacity",0).remove())),N.appendOrSelect(n,"g.x-labels").attr("role",dt.GROUP).selectAll("text").data(this.uniqueKeys).join(E=>E.append("text").text(A=>A).attr("opacity",0).attr("x",A=>Yt(b(A),_.range()[1]+h,R).x).attr("y",A=>Yt(b(A),_.range()[1]+h,R).y).style("text-anchor",A=>qg(b(A)).textAnchor).style("dominant-baseline",A=>qg(b(A)).dominantBaseline).call(A=>A.transition().call($=>this.services.transitions.setupTransition({transition:$,name:"radar_x_labels_enter",animate:t})).attr("opacity",1)),E=>E.call(A=>A.transition().call($=>this.services.transitions.setupTransition({transition:$,name:"radar_x_labels_update",animate:t})).attr("opacity",1).attr("x",$=>Yt(b($),_.range()[1]+h,R).x).attr("y",$=>Yt(b($),_.range()[1]+h,R).y).end().finally(()=>{const $=x(o,"radar","alignment"),U=this.getAlignmentXOffset($,n,this.getParent());n.attr("x",U)})),E=>E.call(A=>A.transition().call($=>this.services.transitions.setupTransition({transition:$,name:"radar_x_labels_exit",animate:t})).attr("opacity",0).remove())),N.appendOrSelect(n,"g.blobs").attr("role",dt.GROUP).selectAll("path").data(this.groupedDataNormalized,E=>E.name).join(E=>E.append("path").attr("class",A=>this.model.getColorClassName({classNameTypes:[at.FILL,at.STROKE],dataGroupName:A.name,originalClassName:"blob"})).attr("role",dt.GRAPHICS_SYMBOL).attr("aria-label",A=>A.name).attr("opacity",0).attr("transform",t?()=>`translate(${R.x}, ${R.y}) scale(${1+Math.random()*.35})`:`translate(${R.x}, ${R.y})`).style("fill",A=>L(A.name,null,A.data)).style("fill-opacity",Or.opacity.selected).style("stroke",A=>L(A.name,null,A.data)).call(A=>{const $=A.transition().call(U=>this.services.transitions.setupTransition({transition:U,name:"radar_blobs_enter",animate:t}));t&&$.delay(()=>Math.random()*30).attr("transform",`translate(${R.x}, ${R.y})`),$.attr("opacity",1).attr("d",U=>I(U.data))}),E=>(E.attr("class",A=>this.model.getColorClassName({classNameTypes:[at.FILL,at.STROKE],dataGroupName:A.name,originalClassName:"blob"})).style("fill",A=>L(A.name,null,A.data)).style("stroke",A=>L(A.name,null,A.data)),E.call(A=>A.transition().call($=>this.services.transitions.setupTransition({transition:$,name:"radar_blobs_update",animate:t})).attr("opacity",1).attr("transform",`translate(${R.x}, ${R.y})`).attr("d",$=>I($.data))),E),E=>E.call(A=>{const $=A.transition().call(U=>this.services.transitions.setupTransition({transition:U,name:"radar_blobs_exit",animate:t}));t&&$.delay(()=>Math.random()*30).attr("transform",()=>`translate(${R.x}, ${R.y}) scale(${1+Math.random()*.35})`),$.attr("opacity",0).remove()})),N.appendOrSelect(n,"g.dots").attr("role",dt.GROUP).selectAll("circle").data(this.fullDataNormalized.filter(E=>x(E,d)!==null)).join(E=>E.append("circle").attr("role",dt.GRAPHICS_SYMBOL).attr("aria-label",A=>A[c]),E=>E,E=>E.remove()).attr("class",E=>this.model.getColorClassName({classNameTypes:[at.FILL],dataGroupName:E[l],originalClassName:fi(E[u])})).attr("cx",E=>Yt(b(E[u]),_(E[d]),R).x).attr("cy",E=>Yt(b(E[u]),_(E[d]),R).y).attr("r",0).attr("opacity",0).style("fill",E=>L(E[l])),N.appendOrSelect(n,"g.x-axes-rect").attr("role",dt.GROUP).selectAll("rect").data(this.uniqueKeys).join(E=>E.append("rect"),E=>E,E=>E.remove()).attr("x",R.x).attr("y",R.y-m/2).attr("width",_.range()[1]).attr("height",m).style("fill","red").style("fill-opacity",0).attr("transform",E=>`rotate(${Yg(b(E))}, ${R.x}, ${R.y})`);const{code:P,number:H}=x(o,"locale");N.appendOrSelect(n,"g.y-labels").attr("role",dt.GROUP).selectAll("text").data(We(S)).join(E=>E.append("text").attr("opacity",0).text(A=>H(A,P)).attr("x",A=>Yt(-Math.PI/2,_(A),R).x+f).attr("y",A=>Yt(-Math.PI/2,_(A),R).y).style("text-anchor","start").style("dominant-baseline","middle").call(A=>A.transition().call($=>this.services.transitions.setupTransition({transition:$,name:"radar_y_labels_enter",animate:t})).attr("opacity",1)),E=>E.call(A=>A.transition().call($=>this.services.transitions.setupTransition({transition:$,name:"radar_y_labels_update",animate:t})).text($=>$).attr("opacity",1).attr("x",$=>Yt(-Math.PI/2,_($),R).x+f).attr("y",$=>Yt(-Math.PI/2,_($),R).y)),E=>E.call(A=>A.transition().call($=>this.services.transitions.setupTransition({transition:$,name:"radar_y_labels_exit",animate:t})).attr("opacity",0).remove())),this.addEventListeners()}getAlignmentXOffset(t,n,r){const i=N.getSVGElementSize(n,{useBBox:!0}),{width:s}=N.getSVGElementSize(r,{useAttrs:!0});let a=0;return t===Kt.CENTER?a=Math.floor((s-i.width)/2):t===Kt.RIGHT&&(a=s-i.width),a}destroy(){this.parent.selectAll(".x-axes-rect > rect").on("mouseover",null).on("mousemove",null).on("mouseout",null);const t=this.services.events;t.removeEventListener(O.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(O.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}addEventListeners(){const t=this,{axes:{angle:n}}=x(this.getOptions(),"radar");this.parent.selectAll(".x-axes-rect > rect").on("mouseover",function(r,i){const s=k(this);t.services.events.dispatchEvent(O.Radar.X_AXIS_MOUSEOVER,{event:r,element:s,datum:i});const a=t.parent.select(`.x-axes .x-axis-${fi(i)}`),o=t.parent.selectAll(`.dots circle.${fi(i)}`),l=t.model.getActiveDataGroupNames(),c=t.getOptions(),{groupMapsTo:u}=c.data,d=x(c,"radar","axes","value");a.classed("hovered",!0).attr("stroke-dasharray","4 4"),o.classed("hovered",!0).attr("opacity",f=>l.indexOf(f[u])!==-1?1:0).attr("r",Or.dotsRadius);const h=t.fullDataNormalized.filter(f=>f[n]===i&&l.indexOf(f[u])!==-1);t.services.events.dispatchEvent(O.Tooltip.SHOW,{event:r,hoveredElement:s,items:h.filter(f=>typeof f[d]=="number").map(f=>({label:f[u],value:f[d],color:t.model.getFillColor(f[u],null,f),class:t.model.getColorClassName({classNameTypes:[at.TOOLTIP],dataGroupName:f[u]})}))})}).on("mousemove",function(r,i){const s=k(this);t.services.events.dispatchEvent(O.Radar.X_AXIS_MOUSEMOVE,{event:r,element:s,datum:i}),t.services.events.dispatchEvent(O.Tooltip.MOVE,{event:r})}).on("click",function(r,i){t.services.events.dispatchEvent(O.Radar.X_AXIS_CLICK,{event:r,element:k(this),datum:i})}).on("mouseout",function(r,i){const s=k(this),a=t.parent.select(`.x-axes .x-axis-${fi(i)}`),o=t.parent.selectAll(`.dots circle.${fi(i)}`);a.classed("hovered",!1).attr("stroke-dasharray","0"),o.classed("hovered",!1).attr("opacity",0).attr("r",0),t.services.events.dispatchEvent(O.Radar.X_AXIS_MOUSEOUT,{event:r,element:s,datum:i}),t.services.events.dispatchEvent(O.Tooltip.HIDE)})}}class p0 extends Qu{constructor(){super(...arguments),this.type="simple-bar",this.renderType=rt.SVG,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail,{groupMapsTo:r}=this.getOptions().data;this.parent.selectAll("path.bar").transition("legend-hover-simple-bar").call(i=>this.services.transitions.setupTransition({transition:i,name:"legend-hover-simple-bar"})).attr("opacity",i=>i[r]!==n.datum().name?.3:1)},this.handleLegendMouseOut=()=>{this.parent.selectAll("path.bar").transition("legend-mouseout-simple-bar").call(t=>this.services.transitions.setupTransition({transition:t,name:"legend-mouseout-simple-bar"})).attr("opacity",1)}}init(){const t=this.services.events;t.addEventListener(O.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(O.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t){const n=this.getOptions(),{groupMapsTo:r}=n.data,i=this.getComponentContainer({withinChartClip:!0}),s=this.model.getDisplayData(this.configs.groups),a=this.services.cartesianScales.getOrientation(),o=i.selectAll("path.bar").data(s,l=>l[r]);o.exit().attr("opacity",0).remove(),o.enter().append("path").attr("opacity",0).merge(o).classed("bar",!0).attr("width",this.getBarWidth.bind(this)).transition().call(l=>this.services.transitions.setupTransition({transition:l,name:"bar-update-enter",animate:t})).attr("class",l=>this.model.getColorClassName({classNameTypes:[at.FILL],dataGroupName:l[r],originalClassName:"bar"})).style("fill",l=>{const c=this.services.cartesianScales.getDomainIdentifier(l);return this.model.getFillColor(l[r],l[c],l)}).attr("d",l=>{const c=this.services.cartesianScales.getRangeIdentifier(),u=this.getBarWidth(),d=l[c],h=this.services.cartesianScales.getDomainValue(l)-u/2,f=h+u;let p,v;if(Array.isArray(d)&&d.length===2)p=this.services.cartesianScales.getRangeValue(d[0]),v=this.services.cartesianScales.getRangeValue(d[1]);else{const y=this.services.cartesianScales.getRangeScale().domain()[0];p=this.services.cartesianScales.getRangeValue(Math.max(0,y)),v=this.services.cartesianScales.getRangeValue(l)}const m=Math.abs(v-p);if(m!==0&&m<2&&(d>0&&a===Jt.VERTICAL||d<0&&a===Jt.HORIZONTAL?v=p-2:v=p+2),!this.isOutsideZoomedDomain(h,f))return pe({x0:h,x1:f,y0:p,y1:v},a)}).attr("opacity",1).attr("role",dt.GRAPHICS_SYMBOL).attr("aria-roledescription","bar").attr("aria-label",l=>l.value),this.addEventListeners()}addEventListeners(){const t=this;this.parent.selectAll("path.bar").on("mouseover",function(n,r){const i=k(this);i.classed("hovered",!0),t.services.events.dispatchEvent(O.Bar.BAR_MOUSEOVER,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(O.Tooltip.SHOW,{event:n,hoveredElement:i,data:[r]})}).on("mousemove",function(n,r){t.services.events.dispatchEvent(O.Bar.BAR_MOUSEMOVE,{event:n,element:k(this),datum:r}),t.services.events.dispatchEvent(O.Tooltip.MOVE,{event:n})}).on("click",function(n,r){t.services.events.dispatchEvent(O.Bar.BAR_CLICK,{event:n,element:k(this),datum:r})}).on("mouseout",function(n,r){const i=k(this);i.classed("hovered",!1),t.services.events.dispatchEvent(O.Bar.BAR_MOUSEOUT,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(O.Tooltip.HIDE,{hoveredElement:i})})}destroy(){this.parent.selectAll("path.bar").on("mouseover",null).on("mousemove",null).on("mouseout",null);const t=this.services.events;t.removeEventListener(O.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(O.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}}class CN extends ge{constructor(){super(...arguments),this.type="skeleton-lines"}render(t=!0){const n=x(this.getOptions(),"data","loading"),r=!x(this.getOptions(),"grid","x","enabled")&&!x(this.getOptions(),"grid","y","enabled")&&!x(this.getOptions(),"axes","bottom","visible")&&!x(this.getOptions(),"axes","left","visible");n&&!r?super.renderGridSkeleton(n):n&&r?this.renderSparklineSkeleton(n):this.removeSkeleton()}renderSparklineSkeleton(t){this.setScales(),this.drawBackdrop(t),this.drawSparkline(t),this.updateBackdropStyle(),t&&this.setShimmerEffect("shimmer-lines")}drawSparkline(t){const n=this.backdrop.attr("width"),r=[100],i=N.appendOrSelect(this.backdrop,"g.y.skeleton"),s=i.selectAll("line").data(r);s.enter().append("line").merge(s).attr("x1",0).attr("x2",n).attr("y1",a=>a).attr("y2",a=>a),i.selectAll("line").classed("shimmer-effect-lines",t).classed("empty-state-lines",!t).style("stroke",t?`url(#${this.services.domUtils.generateElementIDString("shimmer-lines")})`:null)}updateBackdropStyle(){const t=this.parent;this.backdrop=N.appendOrSelect(t,"svg.chart-skeleton.DAII"),N.appendOrSelect(this.backdrop,"rect.chart-skeleton-backdrop").classed("shimmer-effect-lines",!1).classed("shimmer-effect-sparkline",!0).style("stroke",null)}}class m0 extends xt{constructor(){super(...arguments),this.type="area-stacked",this.renderType=rt.SVG,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail,r=this.getOptions(),{groupMapsTo:i}=r.data;this.parent.selectAll("path.area").transition("legend-hover-area").call(s=>this.services.transitions.setupTransition({transition:s,name:"legend-hover-area"})).attr("opacity",s=>x(s,0,i)!==n.datum().name?Rn.opacity.unselected:Rn.opacity.selected)},this.handleLegendMouseOut=()=>{this.parent.selectAll("path.area").transition("legend-mouseout-area").call(t=>this.services.transitions.setupTransition({transition:t,name:"legend-mouseout-area"})).attr("opacity",Rn.opacity.selected)}}init(){const t=this.services.events;t.addEventListener(O.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(O.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t=!0){const n=this.getComponentContainer({withinChartClip:!0}),r=this,i=this.getOptions(),{groupMapsTo:s}=i.data,a=Object.keys(i.axes).some(f=>i.axes[f].percentage),o=this.model.getStackedData({percentage:a,groups:this.configs.groups}),l=x(o,0,0),c=this.services.cartesianScales.getDomainAxisPosition({datum:l}),u=this.services.cartesianScales.getRangeAxisPosition({datum:l}),d=this.services.cartesianScales.getScaleByPosition(u),h=n.selectAll("path.area").data(o,f=>x(f,0,s));this.areaGenerator=Cc().x(f=>this.services.cartesianScales.getValueThroughAxisPosition(c,f.data.sharedStackKey)).y0(f=>d(f[0])).y1(f=>d(f[1])).curve(this.services.curves.getD3Curve()),h.exit().attr("opacity",0).remove(),h.enter().append("path").attr("opacity",0).merge(h).data(o,f=>x(f,0,s)).attr("class","area").attr("class",f=>this.model.getColorClassName({classNameTypes:[at.FILL],dataGroupName:x(f,0,s),originalClassName:"area"})).style("fill",f=>r.model.getFillColor(x(f,0,s),null,f)).attr("role",dt.GRAPHICS_SYMBOL).attr("aria-roledescription","area").attr("aria-label",f=>x(f,0,s)).transition().call(f=>this.services.transitions.setupTransition({transition:f,name:"area-update-enter",animate:t})).attr("opacity",Rn.opacity.selected).attr("d",this.areaGenerator)}}class g0 extends Qu{constructor(){super(...arguments),this.type="stacked-bar",this.renderType=rt.SVG,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail,{groupMapsTo:r}=this.model.getOptions().data;this.parent.selectAll("path.bar").transition("legend-hover-bar").call(i=>this.services.transitions.setupTransition({transition:i,name:"legend-hover-bar"})).attr("opacity",i=>i[r]!==n.datum().name?.3:1)},this.handleLegendMouseOut=()=>{this.parent.selectAll("path.bar").transition("legend-mouseout-bar").call(t=>this.services.transitions.setupTransition({transition:t,name:"legend-mouseout-bar"})).attr("opacity",1)}}init(){const t=this.services.events;t.addEventListener(O.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(O.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t){const n=this.getComponentContainer({withinChartClip:!0}),r=this.getOptions(),{groupMapsTo:i}=r.data,s=this.model.getStackedData({groups:this.configs.groups,divergent:!0}),a=this.model.getActiveDataGroupNames(),o=n.selectAll("g.bars").data(s,c=>x(c,0,i));o.exit().attr("opacity",0).remove(),o.enter().append("g").classed("bars",!0).attr("role",dt.GROUP).attr("data-name","bars");const l=n.selectAll("g.bars").selectAll("path.bar").data(c=>c,c=>c.data.sharedStackKey);l.exit().remove(),l.enter().append("path").merge(l).classed("bar",!0).transition().call(c=>this.services.transitions.setupTransition({transition:c,name:"bar-update-enter",animate:t})).attr("class",c=>this.model.getColorClassName({classNameTypes:[at.FILL],dataGroupName:c[i],originalClassName:"bar"})).style("fill",c=>this.model.getFillColor(c[i],c.data.sharedStackKey,c.data)).attr("d",c=>{const u=c.data.sharedStackKey,d=this.getBarWidth(),h=this.services.cartesianScales.getDomainValue(u)-d/2,f=h+d,p=this.services.cartesianScales.getRangeValue(c[0]);let v=this.services.cartesianScales.getRangeValue(c[1]);if(!this.isOutsideZoomedDomain(h,f)){if(Math.abs(v-p)>0&&Math.abs(v-p)>r.bars.dividerSize){const m=c[0]<0&&c[1]<=0;m&&a.length>1?this.services.cartesianScales.getOrientation()===Jt.VERTICAL?v+=c[1]===0?2:1:v-=1:m||(this.services.cartesianScales.getOrientation()===Jt.VERTICAL?v+=1:v-=1)}return pe({x0:h,x1:f,y0:p,y1:v},this.services.cartesianScales.getOrientation())}}).attr("opacity",1).attr("role",dt.GRAPHICS_SYMBOL).attr("aria-roledescription","bar").attr("aria-label",c=>c[1]-c[0]),this.addEventListeners()}addEventListeners(){const t=this.getOptions(),{groupMapsTo:n}=t.data,r=this;this.parent.selectAll("path.bar").on("mouseover",function(i,s){const a=k(this);a.classed("hovered",!0),r.services.events.dispatchEvent(O.Bar.BAR_MOUSEOVER,{event:i,element:a,datum:s});let o=r.model.getDisplayData(r.configs.groups).find(l=>{const c=r.services.cartesianScales.getDomainIdentifier(l),u=r.services.cartesianScales.getRangeIdentifier(l);return l[u]===s.data[s[n]]&&l[c].toString()===s.data.sharedStackKey&&l[n]===s[n]});if(o===void 0){const l=r.services.cartesianScales.getDomainIdentifier(),c=r.services.cartesianScales.getRangeIdentifier();o={[l]:s.data.sharedStackKey,[c]:s.data[s[n]],[n]:s[n]}}r.services.events.dispatchEvent(O.Tooltip.SHOW,{event:i,hoveredElement:a,data:[o]})}).on("mousemove",function(i,s){const a=k(this);r.services.events.dispatchEvent(O.Bar.BAR_MOUSEMOVE,{event:i,element:a,datum:s}),r.services.events.dispatchEvent(O.Tooltip.MOVE,{event:i})}).on("click",function(i,s){r.services.events.dispatchEvent(O.Bar.BAR_CLICK,{event:i,element:k(this),datum:s})}).on("mouseout",function(i,s){const a=k(this);a.classed("hovered",!1),r.services.events.dispatchEvent(O.Bar.BAR_MOUSEOUT,{event:i,element:a,datum:s}),r.services.events.dispatchEvent(O.Tooltip.HIDE,{hoveredElement:a})})}getBarWidth(){const t=this.getOptions();if(x(t,"bars","width"))return t.bars.width;const n=this.services.cartesianScales.getMainXScale(),r=N.getSVGElementSize(this.parent,{useAttrs:!0}).width,i=this.model.getStackKeys().length,s=x(t,"bars","spacingFactor");return n.step?Math.min(t.bars.maxWidth,n.step()/2):Math.min(t.bars.maxWidth,r*s/i)}destroy(){this.parent.selectAll("path.bar").on("mouseover",null).on("mousemove",null).on("mouseout",null);const t=this.services.events;t.removeEventListener(O.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(O.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}}class v0 extends mn{constructor(){super(...arguments),this.type="scatter-stacked",this.renderType=rt.SVG}render(t){if(!x(this.getOptions(),"points","enabled"))return;const n=this.getComponentContainer({withinChartClip:!0}),r=this.getOptions(),{groupMapsTo:i}=r.data,s=Object.keys(r.axes).some(u=>r.axes[u].percentage),a=this.model.getStackedData({groups:this.configs.groups,percentage:s}),o=n.selectAll("g.dots").data(a,u=>x(u,0,i));o.exit().attr("opacity",0).remove();const l=o.enter().append("g").classed("dots",!0).attr("role",dt.GROUP).merge(o).selectAll("circle.dot").data(u=>u);l.exit().attr("opacity",0).remove();const c=l.enter().append("circle").classed("dot",!0).attr("opacity",0).merge(l).datum(u=>{const d=u[i],h=this.services.cartesianScales.getDomainIdentifier(u),f=this.services.cartesianScales.getRangeIdentifier(u);return{[i]:d,[h]:u.data.sharedStackKey,[f]:u[1]}});this.styleCircles(c,t),this.addEventListeners()}getTooltipData(t,n){const r=this.getOptions(),{groupMapsTo:i}=r.data,s=Object.keys(r.axes).some(l=>r.axes[l].percentage),a=this.model.getStackedData({groups:this.configs.groups,percentage:s}),o=[];return a.forEach((l,c)=>{l.forEach((u,d)=>{const h=u[i],f=u.data.sharedStackKey;let p=u.data[h];const v=u[1],m=this.services.cartesianScales.getDomainIdentifier(u),y=this.services.cartesianScales.getRangeIdentifier(u);p!=null&&t===this.services.cartesianScales.getDomainValue(f)&&n===this.services.cartesianScales.getRangeValue(v)&&(s&&(p=this.model.getStackedData({groups:this.configs.groups})[c][d].data[h]),p!==null&&o.push({[i]:h,[m]:f,[y]:p}))})}),this.model.getDisplayData(this.configs.groups).filter(l=>{const c=this.services.cartesianScales.getDomainIdentifier(l),u=this.services.cartesianScales.getRangeIdentifier(l);return o.find(d=>d[i]==l[i]&&d[c]==l[c]&&d[u]==l[u])!==void 0})}}const yi=6;class AN extends xt{constructor(){super(...arguments),this.type="tree",this.renderType=rt.SVG}getLongestLabel(t){let n="";return t.forEach(r=>{const i=r.children?this.getLongestLabel(r.children):"";(i.length>n.length||r.name.length>n.length)&&(n=i.length>r.name.length?i:r.name)}),n}getMockLabelWidth(t,n){const r=t.append("text").attr("dy","0.31em").attr("x",0).attr("text-anchor","end").text(n),{width:i}=N.getSVGElementSize(r.node(),{useBBox:!0});return r.remove(),i}render(t=!0){const n=this.getComponentContainer();n.html("");const{width:r,height:i}=N.getSVGElementSize(this.parent,{useAttrs:!0});if(r<1||i<1)return;const s=this.model.getOptions(),a=this.model.getDisplayData(),o=x(s,"tree","rootTitle")||"Tree",l=this.getMockLabelWidth(n,o),c=this.getLongestLabel(a),u=this.getMockLabelWidth(n,c),d={top:0,right:0,bottom:0,left:l>0?l+yi:30-yi},h=Xi({name:o,children:a}),f=10,p=r/6,v=S=>{const L=h.descendants().reverse(),I=h.links();let D=h,R=h;h.eachBefore(U=>{U.x<D.x&&(D=U),U.x>R.x&&(R=U)});const M=R.x-D.x,V=n.transition().call(U=>this.services.transitions.setupTransition({transition:U,name:"tree-update-viewbox",animate:!0})).attr("viewBox",[-d.left,D.x,r,M].join(" ")),P=_.selectAll("g").data(L,U=>U.id),H=this,E=P.enter().append("g").attr("transform",()=>`translate(${S.y0},${S.x0})`).attr("class",U=>U.depth!==0&&U.children&&U.children.length>0?"clickable":null).on("mouseover",function(U,B){H.services.events.dispatchEvent(O.Tree.NODE_MOUSEOVER,{event:U,element:k(this),datum:B})}).on("click",function(U,B){B.depth!==0&&(B.children=B.children?null:B._children,v(B)),H.services.events.dispatchEvent(O.Tree.NODE_CLICK,{event:U,element:k(this),datum:B})}).on("mouseout",function(U,B){H.services.events.dispatchEvent(O.Tree.NODE_MOUSEOUT,{event:U,element:k(this),datum:B})});E.append("circle").attr("r",2.5).attr("class",U=>U._children?"parent":"child").attr("stroke-width",10),E.append("text").attr("dy","0.31em").attr("x",U=>U._children?-yi:yi).attr("text-anchor",U=>U._children?"end":"start").text(U=>U.data.name).clone(!0).attr("class","text-stroke").lower(),P.merge(E).transition(V).attr("transform",U=>`translate(${U.y},${U.x})`).attr("fill-opacity",1).attr("stroke-opacity",1),P.exit().transition(V).remove().attr("transform",()=>`translate(${S.y},${S.x})`).attr("fill-opacity",0).attr("stroke-opacity",0);const A=w.selectAll("path").data(I,U=>U.target.id),$=A.enter().append("path").attr("d",()=>{const U={x:S.x0,y:S.y0};return b({source:U,target:U})});A.merge($).transition(V).attr("d",b),A.exit().transition(V).remove().attr("d",()=>{const U={x:S.x,y:S.y};return b({source:U,target:U})}),h.eachBefore(U=>{U.x0=U.x,U.y0=U.y})},m=h.descendants(),y=m[m.length-1].depth,g=x(s,"tree","type")===Jo.DENDROGRAM?c_().size([i,r-u-y*yi-l]):Z_().nodeSize([f,p]).size([i,r-u-y*yi-l]),b=YS().x(S=>S.y).y(S=>S.x);h.x0=p/2,h.y0=0,h.descendants().forEach((S,L)=>{S.id=L,S._children=S.children}),g(h),n.attr("viewBox",[-d.left,-d.top,r,f]).style("user-select","none");const w=n.append("g").attr("class","links"),_=n.append("g").attr("class","nodes");v(h)}}var $N="#000000",LN="#ffffff",RN="#fcf4d6",DN="#fddc69",kN="#f1c21b",IN="#d2a106",NN="#b28600",PN="#8e6a00",UN="#684e00",BN="#483700",HN="#302400",VN="#1c1500",FN={10:RN,20:DN,30:kN,40:IN,50:NN,60:PN,70:UN,80:BN,90:HN,100:VN},zN="#fff2e8",GN="#ffd9be",jN="#ffb784",WN="#ff832b",qN="#eb6200",YN="#ba4e00",XN="#8a3800",ZN="#5e2900",KN="#3e1a00",QN="#231000",JN={10:zN,20:GN,30:jN,40:WN,50:qN,60:YN,70:XN,80:ZN,90:KN,100:QN},tP="#fff1f1",eP="#ffd7d9",nP="#ffb3b8",rP="#ff8389",iP="#fa4d56",sP="#da1e28",aP="#a2191f",oP="#750e13",lP="#520408",cP="#2d0709",uP={10:tP,20:eP,30:nP,40:rP,50:iP,60:sP,70:aP,80:oP,90:lP,100:cP},hP="#fff0f7",dP="#ffd6e8",fP="#ffafd2",pP="#ff7eb6",mP="#ee5396",gP="#d02670",vP="#9f1853",yP="#740937",xP="#510224",bP="#2a0a18",EP={10:hP,20:dP,30:fP,40:pP,50:mP,60:gP,70:vP,80:yP,90:xP,100:bP},_P="#f6f2ff",wP="#e8daff",SP="#d4bbff",OP="#be95ff",TP="#a56eff",MP="#8a3ffc",CP="#6929c4",AP="#491d8b",$P="#31135e",LP="#1c0f30",RP={10:_P,20:wP,30:SP,40:OP,50:TP,60:MP,70:CP,80:AP,90:$P,100:LP},DP="#edf5ff",kP="#d0e2ff",IP="#a6c8ff",NP="#78a9ff",PP="#4589ff",UP="#0f62fe",BP="#0043ce",HP="#002d9c",VP="#001d6c",FP="#001141",zP={10:DP,20:kP,30:IP,40:NP,50:PP,60:UP,70:BP,80:HP,90:VP,100:FP},GP="#e5f6ff",jP="#bae6ff",WP="#82cfff",qP="#33b1ff",YP="#1192e8",XP="#0072c3",ZP="#00539a",KP="#003a6d",QP="#012749",JP="#061727",tU={10:GP,20:jP,30:WP,40:qP,50:YP,60:XP,70:ZP,80:KP,90:QP,100:JP},eU="#d9fbfb",nU="#9ef0f0",rU="#3ddbd9",iU="#08bdba",sU="#009d9a",aU="#007d79",oU="#005d5d",lU="#004144",cU="#022b30",uU="#081a1c",hU={10:eU,20:nU,30:rU,40:iU,50:sU,60:aU,70:oU,80:lU,90:cU,100:uU},dU="#defbe6",fU="#a7f0ba",pU="#6fdc8c",mU="#42be65",gU="#24a148",vU="#198038",yU="#0e6027",xU="#044317",bU="#022d0d",EU="#071908",_U={10:dU,20:fU,30:pU,40:mU,50:gU,60:vU,70:yU,80:xU,90:bU,100:EU},wU="#f2f4f8",SU="#dde1e6",OU="#c1c7cd",TU="#a2a9b0",MU="#878d96",CU="#697077",AU="#4d5358",$U="#343a3f",LU="#21272a",RU="#121619",DU={10:wU,20:SU,30:OU,40:TU,50:MU,60:CU,70:AU,80:$U,90:LU,100:RU},kU="#f4f4f4",IU="#e0e0e0",NU="#c6c6c6",PU="#a8a8a8",UU="#8d8d8d",BU="#6f6f6f",HU="#525252",VU="#393939",FU="#262626",zU="#161616",GU={10:kU,20:IU,30:NU,40:PU,50:UU,60:BU,70:HU,80:VU,90:FU,100:zU},jU="#f7f3f2",WU="#e5e0df",qU="#cac5c4",YU="#ada8a8",XU="#8f8b8b",ZU="#726e6e",KU="#565151",QU="#3c3838",JU="#272525",tB="#171414",eB={10:jU,20:WU,30:qU,40:YU,50:XU,60:ZU,70:KU,80:QU,90:JU,100:tB},y0={black:{100:$N},blue:zP,coolGray:DU,cyan:tU,gray:GU,green:_U,magenta:EP,orange:JN,purple:RP,red:uP,teal:hU,warmGray:eB,white:{0:LN},yellow:FN};const nB=e=>{if(!e)return null;for(const t of Object.keys(y0)){const n=y0[t];for(const r of Object.keys(n))if(n[+r]===e)return r}return null},x0=function(){const e=k(this.parentNode).select("rect.leaf"),t=getComputedStyle(e.node(),null).getPropertyValue("fill"),n=xn(t);let r;if(n&&(r=nB(n?n.hex():null)),r==null){const i=vl(n).l;r=Math.abs(i*100-100)}return r>50?"white":"black"};let rB=0;class iB extends xt{constructor(){super(...arguments),this.type="treemap",this.renderType=rt.SVG,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail;this.parent.selectAll("g[data-name='leaf']").transition("legend-hover-treemap").call(r=>this.services.transitions.setupTransition({transition:r,name:"legend-hover-treemap"})).attr("opacity",r=>r.parent.data.name===n.datum().name?1:.3)},this.handleLegendMouseOut=()=>{this.parent.selectAll("g[data-name='leaf']").transition("legend-mouseout-treemap").call(t=>this.services.transitions.setupTransition({transition:t,name:"legend-mouseout-treemap"})).attr("opacity",1)}}init(){const{events:t}=this.services;t.addEventListener(O.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(O.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t=!0){const n=this.getComponentContainer();this.model.getData();const r=this.model.getDisplayData(),i=this.model.getOptions(),s=x(window,"location"),{width:a,height:o}=N.getSVGElementSize(n,{useAttrs:!0}),l=Xi({name:i.title||"Treemap",children:r}).sum(f=>f.value).sort((f,p)=>p.value-f.value),c=ew().size([a,o]).paddingInner(1).paddingOuter(0).round(!0)(l),u=n.selectAll("g[data-name='leaf']").data(c.leaves(),f=>f.data.name);u.exit().attr("opacity",0).remove();const d=u.enter().append("g").attr("data-name","leaf").attr("data-uid",()=>rB++).merge(u);d.attr("data-name","leaf").transition().call(f=>this.services.transitions.setupTransition({transition:f,name:"treemap-group-update",animate:t})).attr("transform",f=>`translate(${f.x0},${f.y0})`);const h=d.selectAll("rect.leaf").data(f=>[f]);h.exit().attr("width",0).attr("height",0).remove(),h.enter().append("rect").classed("leaf",!0).merge(h).attr("width",0).attr("height",0).attr("id",function(){const f=k(this.parentNode).attr("data-uid");return`${i.style.prefix}-leaf-${f}`}).attr("class",f=>{for(;f.depth>1;)f=f.parent;return this.model.getColorClassName({classNameTypes:[at.FILL],dataGroupName:f.data.name,originalClassName:"leaf"})}).transition().call(f=>this.services.transitions.setupTransition({transition:f,name:"treemap-leaf-update-enter",animate:t})).attr("width",f=>f.x1-f.x0).attr("height",f=>f.y1-f.y0).style("fill",f=>{for(;f.depth>1;)f=f.parent;return this.model.getFillColor(f.data.name,null,f.data)}),d.selectAll("clipPath").data(f=>f.data.showLabel!==!0?[]:[1],f=>f).join(f=>f.append("clipPath").attr("id",function(){const p=k(this.parentNode).attr("data-uid");return`${i.style.prefix}-clip-${p}`}).append("use").attr("xlink:href",function(){const p=k(this.parentNode.parentNode).attr("data-uid"),v=`${i.style.prefix}-leaf-${p}`;return new URL(`#${v}`,s)+""}),f=>null,f=>f.remove()),d.selectAll("text").data(f=>{if(f.data.showLabel!==!0)return[];let p=f;for(;p.depth>1;)p=p.parent;const v=vl(this.model.getFillColor(p.data.name));return[{text:f.data.name,color:v.l<.5?"white":"black"}]},f=>f).join(f=>{const p=f.append("text").text(v=>v.text).style("fill",x0).attr("x",7).attr("y",18);return s&&p.attr("clip-path",function(){const v=k(this.parentNode).attr("data-uid"),m=`${i.style.prefix}-clip-${v}`;return`url(${new URL(`#${m}`,s)+""})`}),p},f=>f.text(p=>p.text).style("fill",x0),f=>f.remove()),this.addEventListeners()}addEventListeners(){const t=this;this.parent.selectAll("rect.leaf").on("mouseover",function(n,r){const i=k(this);let s=getComputedStyle(this,null).getPropertyValue("fill"),a=r;for(;a.depth>1;)a=a.parent;i.transition("graph_element_mouseover_fill_update").call(o=>t.services.transitions.setupTransition({transition:o,name:"graph_element_mouseover_fill_update"})).style("fill",o=>{const l=t.model.getFillColor(o.parent.data.name,null,o.data);return l&&(s=l),xn(s).darker(.7).toString()}),t.services.events.dispatchEvent(O.Tooltip.SHOW,{event:n,hoveredElement:i,items:[{color:s,label:a.data.name,bold:!0},{label:r.data.name,value:r.data.value}]}),t.services.events.dispatchEvent(O.Treemap.LEAF_MOUSEOVER,{event:n,element:i,datum:r})}).on("mousemove",function(n,r){const i=k(this);t.services.events.dispatchEvent(O.Treemap.LEAF_MOUSEMOVE,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(O.Tooltip.MOVE,{event:n})}).on("click",function(n,r){t.services.events.dispatchEvent(O.Treemap.LEAF_CLICK,{event:n,element:k(this),datum:r})}).on("mouseout",function(n,r){const i=k(this);i.classed("hovered",!1);let s=r;for(;s.depth>1;)s=s.parent;i.transition().call(a=>t.services.transitions.setupTransition({transition:a,name:"graph_element_mouseout_fill_update"})).style("fill",a=>t.model.getFillColor(a.parent.data.name,null,a.data)),t.services.events.dispatchEvent(O.Treemap.LEAF_MOUSEOUT,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(O.Tooltip.HIDE,{hoveredElement:i})})}}class sB extends xt{constructor(){super(...arguments),this.type="wordcloud",this.renderType=rt.SVG,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail,{groupMapsTo:r}=this.getOptions().data;this.parent.selectAll("text.word").transition("legend-hover-wordcloud").call(i=>this.services.transitions.setupTransition({transition:i,name:"legend-hover-wordcloud"})).attr("opacity",i=>i[r]!==n.datum().name?.3:1)},this.handleLegendMouseOut=()=>{this.parent.selectAll("text.word").transition("legend-mouseout-wordcloud").call(t=>this.services.transitions.setupTransition({transition:t,name:"legend-mouseout-wordcloud"})).attr("opacity",1)}}init(){const t=this.services.events;t.addEventListener(O.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(O.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t=!0){const n=this,r=this.getComponentContainer().attr("width","100%").attr("height","100%"),i=this.model.getDisplayData(),s=this.getFontSizeScale(i),a=this.getOptions(),{fontSizeMapsTo:o,wordMapsTo:l}=a.wordCloud,{groupMapsTo:c}=a.data,{width:u,height:d}=N.getSVGElementSize(r,{useAttrs:!0});if(u===0||d===0)return;const h=dD().size([u,d]).words(i.map(function(p){const v=p[o];if(typeof p[o]!="number")throw Error("Badly formatted WordCloud data. `value` should only be an integer or float");return{[c]:p[c],text:p[l],size:v,value:v}})).padding(5).rotate(0).fontSize(p=>s(p.size)).on("end",f);h.start();function f(p){const v=N.appendOrSelect(r,"g.words");v.attr("transform",`translate(${h.size()[0]/2}, ${h.size()[1]/2})`);const m=v.selectAll("text").data(p,y=>`${y[c]}-${y.text}`);m.exit().attr("opacity",0).remove(),m.enter().append("text").attr("opacity",0).merge(m).style("font-size",y=>`${y.size}px`).text(function(y){return y.text}).attr("class",y=>n.model.getColorClassName({classNameTypes:[at.FILL],dataGroupName:y[c],originalClassName:`word ${y.size>32?"light":""}`})).style("fill",y=>n.model.getFillColor(y[c],y.text,y)).attr("text-anchor","middle").transition().call(y=>n.services.transitions.setupTransition({transition:y,name:"wordcloud-text-update-enter",animate:t})).attr("transform",y=>`translate(${y.x}, ${y.y})`).attr("opacity",1)}this.addEventListeners()}getFontSizeScale(t){const n=this.getOptions(),{fontSizeMapsTo:r}=n.wordCloud,i=t.map(l=>l[r]).filter(l=>l),s=N.getHTMLElementSize(this.services.domUtils.getMainContainer()),a=i.length>0,o=a?We(i):[1,1];return Ze().domain(o).range(a?n.wordCloud.fontSizeRange(s,t):[4,4])}addEventListeners(){const t=this.getOptions(),{groupMapsTo:n}=t.data,r=this,i=wo(s=>{const a=r.parent.selectAll("text.word").transition("wordcloud-word-mouse-highlight").call(o=>r.services.transitions.setupTransition({transition:o,name:"wordcloud-word-mouse-highlight"}));s===null?a.attr("opacity",1):a.attr("opacity",function(){return s===this?1:.3})},6);this.parent.selectAll("text.word").on("mouseover",function(s,a){const o=this;i(o),r.services.events.dispatchEvent(O.WordCloud.WORD_MOUSEOVER,{event:s,element:k(this),datum:a}),r.services.events.dispatchEvent(O.Tooltip.SHOW,{event:s,hoveredElement:o,items:[{label:t.tooltip.wordLabel,value:a.text},{label:t.tooltip.valueLabel,value:a.value},{label:_t(t,"locale.translations.group")||_t(t,"tooltip.groupLabel")||"Group",value:a[n],class:r.model.getColorClassName({classNameTypes:[at.TOOLTIP],dataGroupName:a[n]})}]})}).on("mousemove",function(s,a){const o=k(this);r.services.events.dispatchEvent(O.WordCloud.WORD_MOUSEMOVE,{element:o,datum:a}),r.services.events.dispatchEvent(O.Tooltip.MOVE,{event:s})}).on("click",function(s,a){r.services.events.dispatchEvent(O.WordCloud.WORD_CLICK,{event:s,element:k(this),datum:a})}).on("mouseout",function(s,a){const o=k(this);i(null),r.services.events.dispatchEvent(O.WordCloud.WORD_MOUSEOUT,{event:s,element:o,datum:a}),r.services.events.dispatchEvent(O.Tooltip.HIDE,{hoveredElement:o})})}}class aB extends xt{constructor(){super(...arguments),this.type="geo",this.renderType=rt.SVG}render(){const t=this.getComponentContainer({withinChartClip:!0}),{width:n,height:r}=N.getSVGElementSize(t,{useAttrs:!0});if(n<1||r<1)return;const i=this.getProjection(),s=x(this.getOptions(),"geoData"),a=this.model.getCombinedData(),o={},l={};Object.keys(a).forEach(m=>{typeof a[m].value=="number"?o[m]=a[m]:l[m]=a[m]});const c=lN(s,Object.values(l)),u=sN(s,{type:"GeometryCollection",geometries:Object.values(o)}),d=i.fitSize([n,r],u),h=IE().projection(d);N.appendOrSelect(t,"g.geo").selectAll("path").data(u.features).join("path").attr("d",h);const f=this.services.domUtils.generateElementIDString("geo-pattern-stripes"),p=N.appendOrSelect(t,"defs");N.appendOrSelect(p,"pattern").attr("id",f).attr("width",5).attr("height",10).attr("patternUnits","userSpaceOnUse").attr("patternTransform","rotate(45)").append("path").classed("pattern-fill",!0).attr("d",ss()([[0,0],[0,10]]));const v=N.appendOrSelect(t,"g.missing-data");N.appendOrSelect(v,"path").datum(c).attr("d",h).style("fill",`url(#${f})`)}getProjection(){let t=null;switch(x(this.getOptions(),"thematic","projection")){case yn.geoEqualEarth:t=t_();break;case yn.geoAlbers:t=qE();break;case yn.geoConicEqualArea:t=Nf();break;case yn.geoConicEquidistant:t=QE();break;case yn.geoEquirectangular:t=ZE();break;case yn.geoMercator:t=YE();break;case yn.geoNaturalEarth1:t=e_();break;default:throw new Error("Projection is not supported.")}return t}}class oB extends aB{constructor(){super(...arguments),this.type="choropleth"}render(t=!0){super.render();const n=this.model.getCombinedData();this.getComponentContainer({withinChartClip:!0}).select("g.geo").selectAll("path").classed("border",!0).attr("class",r=>this.model.getColorClassName({value:n[r.properties.NAME].value,originalClassName:"border"})),this.addCountryAreaEventListener()}addCountryAreaEventListener(){const t=this,n=this.model.getCombinedData();this.parent.selectAll("path.border").on("mouseover",function(r,i){const s=k(this);t.services.events.dispatchEvent(kr.CHOROPLETH_MOUSEOVER,{event:r,element:s,datum:n[i.properties.NAME]}),t.services.events.dispatchEvent(_i.SHOW,{event:r,hoveredElement:s,items:[{label:i.properties.NAME,value:n[i.properties.NAME].value}]})}).on("mousemove",function(r,i){t.services.events.dispatchEvent(kr.CHOROPLETH_MOUSEMOVE,{event:r,element:k(this),datum:n[i.properties.NAME]}),t.services.events.dispatchEvent(_i.MOVE,{event:r})}).on("click",function(r,i){t.services.events.dispatchEvent(kr.CHOROPLETH_CLICK,{event:r,element:k(this),datum:n[i.properties.NAME]})}).on("mouseout",function(r,i){const s=k(this);t.services.events.dispatchEvent(kr.CHOROPLETH_MOUSEOUT,{event:r,element:s,datum:n[i.properties.NAME]}),t.services.events.dispatchEvent(_i.HIDE,{event:r,hoveredElement:s})})}}function b0(e){var t=e==null?0:e.length;return t?fo(e,1):[]}class lB extends Pn{zoomIn(t,n,r){let i,s,a;const o=r||oi;t&&(i=t.x,s=t.y,a=2);const{width:l,height:c}=N.getSVGElementSize(this.services.domUtils.getHolder(),{useClientDimensions:!0});n.transition().duration(o.duration).ease(o.ease).attr("transform",`translate(${l/2}, ${c/2}) scale(${a}) translate(${-i},${-s})`),this.services.events.dispatchEvent(O.CanvasZoom.CANVAS_ZOOM_IN,{element:k(t)})}zoomOut(t,n){const r=n||oi;t.transition().duration(r.duration).ease(r.ease).attr("transform",""),this.services.events.dispatchEvent(O.CanvasZoom.CANVAS_ZOOM_OUT)}}class cB extends Pn{init(){this.documentFragment=document.createDocumentFragment()}addEventListener(t,n){this.documentFragment.addEventListener(t,n)}removeEventListener(t,n){this.documentFragment.removeEventListener(t,n)}dispatchEvent(t,n){let r;n?r=new CustomEvent(t,{detail:n}):(r=document.createEvent("Event"),r.initEvent(t,!1,!0)),this.documentFragment.dispatchEvent(r)}}class uB extends Pn{constructor(t,n){super(t,n)}downloadCSV(t,n){const r=document.createElement("a"),i="text/csv;encoding:utf-8";if(navigator.msSaveBlob)navigator.msSaveBlob(new Blob([t],{type:i}),n);else if(URL&&"download"in r){const s=URL.createObjectURL(new Blob([t],{type:i}));r.href=s,r.setAttribute("download",n),document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(s)}else location.href=`data:application/octet-stream,${encodeURIComponent(t)}`}downloadImage(t,n){const r=document.createElement("a");r.download=n,r.href=t,document.body.appendChild(r),r.click(),document.body.removeChild(r)}}class hB extends Pn{constructor(){super(...arguments),this.pendingTransitions={}}init(){var t;(t=this.services.events)==null||t.addEventListener(O.Model.UPDATE,()=>{this.pendingTransitions={}})}setupTransition({transition:t,name:n,animate:r}){return this.pendingTransitions[t._id]=t,t.on("end interrupt cancel",()=>{delete this.pendingTransitions[t._id]}),this.model.getOptions().animations===!1||r===!1?t.duration(0):t.duration(x(rg,n,"duration")||rg.default.duration)}getPendingTransitions(){return this.pendingTransitions}}function Ls(e,t){const n=Ot(e),r=Ot(t),i=n.getTime()-r.getTime();return i<0?-1:i>0?1:i}function dB(e,t){const n=Ot(e),r=Ot(t);return n.getFullYear()-r.getFullYear()}function fB(e,t){const n=Ot(e),r=Ot(t),i=Ls(n,r),s=Math.abs(dB(n,r));n.setFullYear(1584),r.setFullYear(1584);const a=Ls(n,r)===-i,o=i*(s-+a);return o===0?0:o}function Ju(e,t){const n=Ot(e);if(isNaN(t))return en(e,NaN);if(!t)return n;const r=n.getDate(),i=en(e,n.getTime());i.setMonth(n.getMonth()+t+1,0);const s=i.getDate();return r>=s?i:(n.setFullYear(i.getFullYear(),i.getMonth(),r),n)}function E0(e,t){return Ju(e,t*12)}function pB(e,t){return E0(e,-t)}function mB(e,t){const n=Ot(e),r=Ot(t),i=n.getFullYear()-r.getFullYear(),s=n.getMonth()-r.getMonth();return i*12+s}function gB(e){const t=Ot(e);return t.setHours(23,59,59,999),t}function vB(e){const t=Ot(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(23,59,59,999),t}function yB(e){const t=Ot(e);return+gB(t)==+vB(t)}function xB(e,t){const n=Ot(e),r=Ot(t),i=Ls(n,r),s=Math.abs(mB(n,r));let a;if(s<1)a=0;else{n.getMonth()===1&&n.getDate()>27&&n.setDate(30),n.setMonth(n.getMonth()-i*s);let o=Ls(n,r)===-i;yB(Ot(e))&&s===1&&Ls(e,r)===1&&(o=!1),a=i*(s-Number(o))}return a===0?0:a}function bB(e,t){return Ju(e,-t)}function EB(e,t){const n=Ot(e),r=Ot(t),i=_0(n,r),s=Math.abs(yg(n,r));n.setDate(n.getDate()-i*s);const a=+(_0(n,r)===-i),o=i*(s-a);return o===0?0:o}function _0(e,t){const n=e.getFullYear()-t.getFullYear()||e.getMonth()-t.getMonth()||e.getDate()-t.getDate()||e.getHours()-t.getHours()||e.getMinutes()-t.getMinutes()||e.getSeconds()-t.getSeconds()||e.getMilliseconds()-t.getMilliseconds();return n<0?-1:n>0?1:n}function w0(e,t){const n=Ot(e);return isNaN(t)?en(e,NaN):(t&&n.setDate(n.getDate()+t),n)}function _B(e,t){return w0(e,-t)}function th(e){return t=>{const n=(e?Math[e]:Math.trunc)(t);return n===0?0:n}}function eh(e,t){return+Ot(e)-+Ot(t)}function wB(e,t,n){const r=eh(e,t)/mg;return th(n==null?void 0:n.roundingMethod)(r)}function nh(e,t){const n=+Ot(e);return en(e,n+t)}function S0(e,t){return nh(e,t*mg)}function SB(e,t){return S0(e,-t)}function O0(e,t,n){const r=eh(e,t)/pg;return th(n==null?void 0:n.roundingMethod)(r)}function rh(e,t){return nh(e,t*pg)}function T0(e,t){return rh(e,-t)}function M0(e,t,n){const r=eh(e,t)/1e3;return th(n==null?void 0:n.roundingMethod)(r)}function ih(e,t){return nh(e,t*1e3)}function C0(e,t){return ih(e,-t)}class OB extends Pn{constructor(){super(...arguments),this.scaleTypes={top:null,right:null,bottom:null,left:null},this.scales={top:null,right:null,bottom:null,left:null}}getDomainAxisPosition({datum:t=null}={}){if(this.dualAxes&&t){const n=this.model.getOptions(),{groupMapsTo:r}=n.data,i=x(n,"axes",this.secondaryDomainAxisPosition),s=t[r];if(i!=null&&i.correspondingDatasets&&i.correspondingDatasets.includes(s))return this.secondaryDomainAxisPosition}return this.domainAxisPosition}getRangeAxisPosition({datum:t=null,groups:n=null}={}){if(this.dualAxes){const r=this.model.getOptions(),{groupMapsTo:i}=r.data,s=x(r,"axes",this.secondaryRangeAxisPosition);let a;if(t!==null?a=t[i]:n&&n.length>0&&(a=n[0]),s!=null&&s.correspondingDatasets&&s.correspondingDatasets.includes(a))return this.secondaryRangeAxisPosition}return this.rangeAxisPosition}getAxisOptions(t){return x(this.model.getOptions(),"axes",t)}getDomainAxisOptions(){const t=this.getDomainAxisPosition();return this.getAxisOptions(t)}getRangeAxisOptions(){const t=this.getRangeAxisPosition();return this.getAxisOptions(t)}getScaleLabel(t){return this.getAxisOptions(t).title||(t===F.BOTTOM||t===F.TOP?"x-value":"y-value")}getDomainLabel(){return this.getScaleLabel(this.getDomainAxisPosition())}getRangeLabel(){return this.getScaleLabel(this.getRangeAxisPosition())}update(){this.determineAxisDuality(),this.findDomainAndRangeAxes(),this.determineOrientation(),Object.keys(F).map(t=>F[t]).forEach(t=>{this.scales[t]=this.createScale(t)})}findDomainAndRangeAxes(){const t=this.findVerticalAxesPositions(),n=this.findHorizontalAxesPositions(),r=this.findDomainAndRangeAxesPositions(t,n);this.domainAxisPosition=r.primaryDomainAxisPosition,this.rangeAxisPosition=r.primaryRangeAxisPosition,this.isDualAxes()&&(this.secondaryDomainAxisPosition=r.secondaryDomainAxisPosition,this.secondaryRangeAxisPosition=r.secondaryRangeAxisPosition)}determineOrientation(){(this.rangeAxisPosition===F.LEFT||this.rangeAxisPosition===F.RIGHT)&&(this.domainAxisPosition===F.BOTTOM||this.domainAxisPosition===F.TOP)?this.orientation=Jt.VERTICAL:this.orientation=Jt.HORIZONTAL}isDualAxes(){return this.dualAxes}determineAxisDuality(){var t,n,r,i;const s=this.model.getOptions(),a=x(s,"axes");((t=a[F.LEFT])!=null&&t.correspondingDatasets&&a[F.RIGHT]||(n=a[F.RIGHT])!=null&&n.correspondingDatasets&&a[F.LEFT]||(r=a[F.TOP])!=null&&r.correspondingDatasets&&a[F.BOTTOM]||(i=a[F.BOTTOM])!=null&&i.correspondingDatasets&&a[F.TOP])&&(this.dualAxes=!0)}getCustomDomainValuesByposition(t){const n=x(this.model.getOptions(),"axes",t,"domain");if(n&&!Array.isArray(n))throw new Error(`Domain in ${t} axis is not a valid array`);if(Array.isArray(n)&&(this.scaleTypes[t]===et.LINEAR||this.scaleTypes[t]===et.TIME)&&n.length!==2)throw new Error(`There can only be 2 elements in domain for scale type: ${this.scaleTypes[t]}`);return n}getOrientation(){return this.orientation}getScaleByPosition(t){return this.scales[t]}getScaleTypeByPosition(t){return this.scaleTypes[t]}getDomainAxisScaleType(){const t=this.getDomainAxisPosition();return this.getScaleTypeByPosition(t)}getRangeAxisScaleType(){const t=this.getRangeAxisPosition();return this.getScaleTypeByPosition(t)}getDomainScale(){return this.scales[this.domainAxisPosition]}getRangeScale(){return this.scales[this.rangeAxisPosition]}getMainXAxisPosition(){const t=[F.BOTTOM,F.TOP];return[this.domainAxisPosition,this.rangeAxisPosition].find(n=>t.indexOf(n)>-1)}getMainYAxisPosition(){const t=[F.LEFT,F.RIGHT];return[this.domainAxisPosition,this.rangeAxisPosition].find(n=>t.indexOf(n)>-1)}getMainXScale(){return this.scales[this.getMainXAxisPosition()]}getMainYScale(){return this.scales[this.getMainYAxisPosition()]}getValueFromScale(t,n,r,i){const s=this.model.getOptions(),a=x(s,"axes")[r],{mapsTo:o}=a,l=x(i,o)!==null?i[o]:i;let c;switch(n){case et.LABELS:c=t(l)+t.step()/2;break;case et.TIME:c=t(new Date(l));break;default:c=t(l)}return c}getBoundedScaledValues(t){const{bounds:n}=this.model.getOptions(),r=this.getRangeAxisPosition({datum:t}),i=this.scales[r],s=this.model.getOptions(),a=x(s,"axes")[r],{mapsTo:o}=a,l=t[o]!==void 0?t[o]:t;return[i(x(t,n.upperBoundMapsTo)!==null?t[n.upperBoundMapsTo]:l),i(x(t,n.lowerBoundMapsTo)!==null?t[n.lowerBoundMapsTo]:l)]}getValueThroughAxisPosition(t,n){const r=this.scaleTypes[t],i=this.scales[t];return this.getValueFromScale(i,r,t,n)}getDomainValue(t){const n=this.getDomainAxisPosition({datum:t});return this.getValueThroughAxisPosition(n,t)}getRangeValue(t){const n=this.getRangeAxisPosition({datum:t});return this.getValueThroughAxisPosition(n,t)}getMainXScaleType(){return this.getScaleTypeByPosition(this.getMainXAxisPosition())}getMainYScaleType(){return this.getScaleTypeByPosition(this.getMainYAxisPosition())}getDomainIdentifier(t){const n=this.model.getOptions();return x(n,"axes",this.getDomainAxisPosition({datum:t}),"mapsTo")}getRangeIdentifier(t){const n=this.model.getOptions();return x(n,"axes",this.getRangeAxisPosition({datum:t}),"mapsTo")}extendsDomain(t,n){const r=this.model.getOptions(),i=x(r,"axes",t);if(i.scaleType===et.TIME){const s=x(r,"timeScale","addSpaceOnEdges");return TB(n,s)}else return MB(n,Gn.paddingRatio,i.scaleType)}findVerticalAxesPositions(){const t=this.model.getOptions(),n=x(t,"axes"),r=this.isDualAxes();return x(n,F.LEFT)===null&&x(n,F.RIGHT)!==null||x(n,F.RIGHT,"main")===!0||r&&x(n,F.LEFT,"correspondingDatasets")?{primary:F.RIGHT,secondary:F.LEFT}:{primary:F.LEFT,secondary:F.RIGHT}}findHorizontalAxesPositions(){const t=this.model.getOptions(),n=x(t,"axes"),r=this.isDualAxes();return x(n,F.BOTTOM)===null&&x(n,F.TOP)!==null||x(n,F.TOP,"main")===!0||r&&x(n,F.BOTTOM,"correspondingDatasets")?{primary:F.TOP,secondary:F.BOTTOM}:{primary:F.BOTTOM,secondary:F.TOP}}findDomainAndRangeAxesPositions(t,n){const r=this.model.getOptions(),i=x(r,"axes",t.primary),s=x(r,"axes",n.primary),a=i.scaleType||et.LINEAR,o=s.scaleType||et.LINEAR,l={primaryDomainAxisPosition:null,secondaryDomainAxisPosition:null,primaryRangeAxisPosition:null,secondaryRangeAxisPosition:null};return l.primaryDomainAxisPosition=n.primary,l.primaryRangeAxisPosition=t.primary,l.secondaryDomainAxisPosition=n.secondary,l.secondaryRangeAxisPosition=t.secondary,(!(o===et.LABELS||o===et.TIME)&&a===et.LABELS||a===et.TIME)&&(l.primaryDomainAxisPosition=t.primary,l.primaryRangeAxisPosition=n.primary,l.secondaryDomainAxisPosition=t.secondary,l.secondaryRangeAxisPosition=n.secondary),l}getScaleDomain(t){const n=this.model.getOptions(),r=x(n,"axes",t),i=x(n,"bounds"),{includeZero:s}=r,a=x(r,"scaleType")||et.LINEAR;if(this.model.isDataEmpty())return[];if(r.binned){const{bins:y}=this.model.getBinConfigurations();return[0,ar(y,g=>g.length)]}else if(r.limitDomainToBins){const{bins:y}=this.model.getBinConfigurations(),g=this.model.getStackKeys({bins:y});return[g[0].split(":")[0],g[g.length-1].split(":")[1]]}const o=this.model.getDisplayData(),{extendLinearDomainBy:l,mapsTo:c,percentage:u,thresholds:d}=r,{reference:h,compareTo:f}=Gn.ratio;if(r.domain)return a===et.LABELS?r.domain:(a===et.TIME&&(r.domain=r.domain.map(y=>y.getTime===void 0?new Date(y):y)),this.extendsDomain(t,r.domain));if(u)return[0,100];if(r&&a===et.LABELS)return bs(o.map(y=>y[c]));let p,v;const m=this.model.getDataGroupNames();if(a===et.LABELS_RATIO)return o.map(y=>`${y[h]}/${y[f]}`);if(a===et.TIME)v=o.map(y=>+new Date(y[c]));else if(i&&n.axes)v=[],o.forEach(y=>{v.push(y[c]),y[i.upperBoundMapsTo]&&v.push(y[i.upperBoundMapsTo]),y[i.lowerBoundMapsTo]&&v.push(y[i.lowerBoundMapsTo])});else if(r.stacked===!0&&m&&t===this.getRangeAxisPosition()){const{groupMapsTo:y}=n.data,g=this.model.getDataValuesGroupedByKeys({groups:m}),b=o.filter(_=>!m.includes(_[y])),w=[];g.forEach(_=>{const{...S}=_;let L=0,I=0;Object.values(S).forEach(D=>{isNaN(D)||(D<0?I+=D:L+=D)}),w.push([I,L])}),v=[...b0(w),...b.map(_=>_[c])]}else v=[],o.forEach(y=>{const g=y[c];Array.isArray(g)&&g.length===2?(v.push(g[0]),v.push(g[1])):(l&&v.push(Math.max(y[c],y[l])),v.push(g))});return a!==et.TIME&&a!==et.LOG&&s&&v.push(0),d&&d.length>0&&d.forEach(y=>{const g=x(y,"value");g!==null&&v.push(g)}),p=We(v),p=this.extendsDomain(t,p),p}createScale(t){const n=this.model.getOptions(),r=x(n,"axes",t);if(!r)return null;const i=x(r,"scaleType")||et.LINEAR;this.scaleTypes[t]=i;let s;return i===et.TIME?s=_p():i===et.LOG?s=rp().base(r.base||10):i===et.LABELS||i===et.LABELS_RATIO?s=Qi():s=Ze(),s.domain(this.getScaleDomain(t)),s}getDomainLowerBound(t){let n,r=0;return this.getOrientation()===Jt.VERTICAL?n=this.getMainYScale().domain():n=this.getMainXScale().domain(),x(this.model.getOptions(),"axes",t,"includeZero")===!1&&n[0]>0&&n[1]>0&&(r=n[0]),r}getHighestDomainThreshold(){const t=x(this.model.getOptions(),"axes"),n=this.getDomainAxisPosition(),{thresholds:r}=t[n];if(!Array.isArray(r)||Array.isArray(r)&&!r.length)return null;const i=this.getDomainScale(),s=r.sort((a,o)=>o.value-a.value)[0];return this.getScaleTypeByPosition(n)===et.TIME&&(typeof s.value=="string"||s.value.getTime===void 0)&&(s.value=new Date(s.value)),{threshold:s,scaleValue:i(s.value)}}getHighestRangeThreshold(){const t=x(this.model.getOptions(),"axes"),n=this.getRangeAxisPosition(),{thresholds:r}=t[n];if(!Array.isArray(r)||Array.isArray(r)&&!r.length)return null;const i=this.getRangeScale(),s=r.sort((a,o)=>o.value-a.value)[0];return{threshold:s,scaleValue:i(s.value)}}}function TB(e,t){const n=new Date(e[0]),r=new Date(e[1]);return fB(r,n)>1?[pB(n,t),E0(r,t)]:xB(r,n)>1?[bB(n,t),Ju(r,t)]:EB(r,n)>1?[_B(n,t),w0(r,t)]:wB(r,n)>1?[SB(n,t),S0(r,t)]:O0(r,n)>30?[T0(n,t*30),rh(r,t*30)]:O0(r,n)>1?[T0(n,t),rh(r,t)]:M0(r,n)>15?[C0(n,t*15),ih(r,t*15)]:M0(r,n)>1?[C0(n,t),ih(r,t)]:[n,r]}function MB([e,t],n,r){const i=(t-e)*n,s=t<=0&&t+i>0?0:t+i;let a=e>=0&&e-i<0?0:e-i;if(r===et.LOG&&a<=0){if(e<=0)throw Error("Data must have values greater than 0 if log scale type is used.");a=e}return[a,s]}let CB=class extends Pn{constructor(){super(...arguments),this.curveTypes={curveLinear:Ka,curveLinearClosed:Ip,curveBasis:XS,curveBasisClosed:ZS,curveBasisOpen:KS,curveBundle:QS,curveCardinal:JS,curveCardinalClosed:tO,curveCardinalOpen:eO,curveCatmullRom:nO,curveCatmullRomClosed:rO,curveCatmullRomOpen:iO,curveMonotoneX:sO,curveMonotoneY:aO,curveNatural:oO,curveStep:lO,curveStepAfter:uO,curveStepBefore:cO}}getD3Curve(){let t="curveLinear";const n=this.model.getOptions().curve;if(n&&(typeof n=="string"?t=n:t=n.name),this.curveTypes[t]){let r=this.curveTypes[t];return n&&Object.keys(n).forEach(i=>{r[i]&&(r=r[i](n[i]))}),r}return console.warn(`The curve type '${t}' is invalid, using 'curveLinear' instead`),this.curveTypes.curveLinear}},AB=class extends Pn{isZoomBarEnabled(){if(!this.services.cartesianScales||!x(this.model.getOptions(),"zoomBar","top","enabled"))return!1;this.services.cartesianScales.findDomainAndRangeAxes();const t=this.services.cartesianScales.getMainXAxisPosition(),n=x(this.model.getOptions(),"axes",t,"scaleType");return t===F.BOTTOM&&n===et.TIME}getZoomBarData(){const t=this.model.getZoomBarData();return t&&t.length>1?t:this.model.getDisplayData()}getDefaultZoomBarDomain(t){if(!this.services.zoom)throw new Error("Services zoom not defined");const n=t||this.services.zoom.getZoomBarData(),{cartesianScales:r}=this.services;if(!r)throw new Error("Services cartesianScales undefined");const i=r.getMainXAxisPosition(),s=r.getDomainIdentifier(),a=x(this.model.getOptions(),"axes",i,"domain");if(Array.isArray(a)&&a.length===2)return a;if(!i)throw new Error("Not defined: mainXAxisPosition");return r.extendsDomain(i,We(n,o=>o[s]))}handleDomainChange(t,n={dispatchEvent:!0}){var r;this.model.set({zoomDomain:t},{animate:!1}),n.dispatchEvent&&((r=this.services.events)==null||r.dispatchEvent(O.ZoomDomain.CHANGE,{newDomain:t}))}getZoomRatio(){return x(this.model.getOptions(),"zoomBar","zoomRatio")}filterDataForRangeAxis(t,n){var r;const i=this.model.get("zoomDomain"),s=Object.assign({stacked:!1},n),a=x(this.model.getOptions(),"zoomBar","updateRangeAxis");if(this.isZoomBarEnabled()&&a&&i){const o=s.stacked?"sharedStackKey":(r=this.services.cartesianScales)==null?void 0:r.getDomainIdentifier(),l=t.filter(c=>new Date(c[o])>=i[0]&&new Date(c[o])<=i[1]);if(l.length>0)return l}return t}zoomIn(t=this.getZoomRatio()){var n;const r=this.model.get("zoomDomain"),i=Me.handleWidth,s=(n=this.services.cartesianScales)==null?void 0:n.getMainXScale().copy();s.domain(this.getDefaultZoomBarDomain());const a=s(r[0]),o=s(r[1]);if(o-a<i+1)return;const l=s.range(),c=o-a,u=Math.min((l[1]-l[0])/2*(t/2),c/2);let d=a+u,h=o-u;d>=h&&(d=a+c/2-i/2,h=o-c/2+i/2);const f=[s.invert(d),s.invert(h)];(r[0].valueOf()!==f[0].valueOf()||r[1].valueOf()!==f[1].valueOf())&&this.handleDomainChange(f)}zoomOut(t=this.getZoomRatio()){const n=this.model.get("zoomDomain");if(!this.services.cartesianScales)throw new Error("Services cartesianScales undefined");const r=this.services.cartesianScales.getMainXScale().copy();r.domain(this.getDefaultZoomBarDomain());const i=r(n[0]),s=r(n[1]),a=r.range(),o=(a[1]-a[0])/2*(t/2),l=Math.max(i-o,a[0]),c=Math.min(s+o,a[1]),u=[r.invert(l),r.invert(c)];(n[0].valueOf()!==u[0].valueOf()||n[1].valueOf()!==u[1].valueOf())&&this.handleDomainChange(u)}resetZoomDomain(){const t=this.model.get("zoomDomain"),n=this.getDefaultZoomBarDomain();(t[0].valueOf()!==n[0].valueOf()||t[1].valueOf()!==n[1].valueOf())&&this.handleDomainChange(n)}isMinZoomDomain(){const t=this.model.get("zoomDomain"),n=this.getDefaultZoomBarDomain();if(!t||!n)return!1;const r=t[1].valueOf()-t[0].valueOf(),i=n[1].valueOf()-n[0].valueOf(),s=x(this.model.getOptions(),"zoomBar","minZoomRatio");return r/i<s}isMaxZoomDomain(){const t=this.model.get("zoomDomain"),n=this.getDefaultZoomBarDomain();return!!(t&&n&&t[0].valueOf()===n[0].valueOf()&&t[1].valueOf()===n[1].valueOf())}isEmptyState(){return this.getZoomBarData().length===0}isZoomBarLoading(t){return x(this.model.getOptions(),"zoomBar",t,"loading")}isZoomBarLocked(t){return x(this.model.getOptions(),"zoomBar",t,"locked")}};function $B(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),n=n>i?i:n,n<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var s=Array(i);++r<i;)s[r]=e[r+t];return s}function LB(e,t,n){var r=e.length;return n=n===void 0?r:n,!t&&n>=r?e:$B(e,t,n)}var RB="\\ud800-\\udfff",DB="\\u0300-\\u036f",kB="\\ufe20-\\ufe2f",IB="\\u20d0-\\u20ff",NB=DB+kB+IB,PB="\\ufe0e\\ufe0f",UB="\\u200d",BB=RegExp("["+UB+RB+NB+PB+"]");function A0(e){return BB.test(e)}function HB(e){return e.split("")}var $0="\\ud800-\\udfff",VB="\\u0300-\\u036f",FB="\\ufe20-\\ufe2f",zB="\\u20d0-\\u20ff",GB=VB+FB+zB,jB="\\ufe0e\\ufe0f",WB="["+$0+"]",sh="["+GB+"]",ah="\\ud83c[\\udffb-\\udfff]",qB="(?:"+sh+"|"+ah+")",L0="[^"+$0+"]",R0="(?:\\ud83c[\\udde6-\\uddff]){2}",D0="[\\ud800-\\udbff][\\udc00-\\udfff]",YB="\\u200d",k0=qB+"?",I0="["+jB+"]?",XB="(?:"+YB+"(?:"+[L0,R0,D0].join("|")+")"+I0+k0+")*",ZB=I0+k0+XB,KB="(?:"+[L0+sh+"?",sh,R0,D0,WB].join("|")+")",QB=RegExp(ah+"(?="+ah+")|"+KB+ZB,"g");function JB(e){return e.match(QB)||[]}function tH(e){return A0(e)?JB(e):HB(e)}function eH(e){return function(t){t=ys(t);var n=A0(t)?tH(t):void 0,r=n?n[0]:t.charAt(0),i=n?LB(n,1).join(""):t.slice(1);return r[e]()+i}}var nH=eH("toUpperCase");function rH(e){return nH(ys(e).toLowerCase())}var iH=Ov(function(e,t,n){return t=t.toLowerCase(),e+(n?rH(t):t)});class rn{constructor(t,n){this.components=[],this.services={canvasZoom:lB,domUtils:N,events:cB,files:uB,gradientUtils:yu,transitions:hB},this.model=new fn(this.services)}init(t,n){this.model.set({holder:t},{skipUpdate:!0}),Object.keys(this.services).forEach(r=>{const i=this.services[r];this.services[r]=new i(this.model,this.services)}),this.services.events.addEventListener(O.Model.UPDATE,r=>{const i=!!x(r,"detail","animate");this.update(i)}),this.model.setData(n.data),this.services.events.addEventListener(O.Chart.RESIZE,()=>{this.update(!1)}),this.components=this.getComponents(),this.update()}getComponents(){return console.error("getComponents() method is not implemented"),[]}update(t=!0){if(!this.components)return;Object.keys(this.services).forEach(i=>{this.services[i].update()}),this.components.forEach(i=>i.render(t));const n=this.services.transitions.getPendingTransitions(),r=Object.keys(n).map(i=>n[i].end().catch(s=>s));Promise.all(r).then(()=>this.services.events.dispatchEvent(O.Chart.RENDER_FINISHED))}destroy(){this.components.forEach(t=>t.destroy()),this.services.domUtils.getHolder().remove(),this.model.set({destroyed:!0},{skipUpdate:!0})}getChartComponents(t,n){const r=this.model.getOptions(),i=x(r,"toolbar","enabled"),s={id:"legend",components:[new Xu(this.model,this.services)],growth:ht.PREFERRED},a=x(r,"canvasZoom","enabled");a&&a===!0&&t.push(new jI(this.model,this.services));const o=!!this.model.getOptions().title,l={id:"title",components:[new $s(this.model,this.services)],growth:ht.STRETCH},c={id:"toolbar",components:[new Po(this.model,this.services)],growth:ht.PREFERRED},u={id:"header",components:[new Le(this.model,this.services,[l,...i?[c]:[]],{direction:Ut.ROW,alignItems:Ir.CENTER})],growth:ht.PREFERRED},d={id:"graph-frame",components:t,growth:ht.STRETCH,renderType:x(n,"graphFrameRenderType")||rt.SVG},h=x(n,"excludeLegend")!==!0&&r.legend.enabled!==!1;let f=Ut.COLUMN;if(h){const y=x(r,"legend","position");y==="left"?(f=Ut.ROW,r.legend.orientation||(r.legend.orientation=Si.VERTICAL)):y==="right"?(f=Ut.ROW_REVERSE,r.legend.orientation||(r.legend.orientation=Si.VERTICAL)):y==="bottom"&&(f=Ut.COLUMN_REVERSE)}const p={id:"spacer",components:[new Un(this.model,this.services)],growth:ht.PREFERRED},v={id:"full-frame",components:[new Le(this.model,this.services,[...h?[s]:[],...h?[p]:[],d],{direction:f})],growth:ht.STRETCH},m=[];if(o||i){m.push(u);const y={id:"spacer",components:[new Un(this.model,this.services,i?{size:15}:void 0)],growth:ht.PREFERRED};m.push(y)}return m.push(v),[new Zu(this.model,this.services),new Go(this.model,this.services),new Le(this.model,this.services,m,{direction:Ut.COLUMN})]}}class _e extends rn{constructor(t,n){super(t,n),this.services=Object.assign(this.services,{cartesianScales:OB,curves:CB,zoom:AB}),this.model=new Cr(this.services)}getAxisChartComponents(t,n){const r=this.model.getOptions(),i=x(r,"zoomBar",F.TOP,"enabled"),s=x(r,"toolbar","enabled");this.services.cartesianScales.determineAxisDuality(),this.services.cartesianScales.findDomainAndRangeAxes(),this.services.cartesianScales.determineOrientation();const a=this.services.cartesianScales.getMainXAxisPosition(),o=x(r,"axes",a,"scaleType"),l=i&&a===F.BOTTOM&&o===et.TIME,c=this.services.zoom.isZoomBarLocked(F.TOP),u=!!this.model.getOptions().title,d={id:"title",components:[new $s(this.model,this.services)],growth:ht.STRETCH},h={id:"toolbar",components:[new Po(this.model,this.services)],growth:ht.PREFERRED},f={id:"header",components:[new Le(this.model,this.services,[d,...s?[h]:[]],{direction:Ut.ROW,alignItems:Ir.CENTER})],growth:ht.PREFERRED},p={id:"legend",components:[new Xu(this.model,this.services)],growth:ht.PREFERRED};l&&!c&&t.push(new t0(this.model,this.services),new WI(this.model,this.services)),t.push(new YI(this.model,this.services)),t.push(new XI(this.model,this.services));const v={id:"graph-frame",components:t,growth:ht.STRETCH,renderType:rt.SVG},m=x(n,"legend","enabled")!==!1&&this.model.getOptions().legend.enabled!==!1;let y=Ut.COLUMN;if(m){const S=x(this.model.getOptions(),"legend","position");S===wi.LEFT?(y=Ut.ROW,this.model.getOptions().legend.orientation||(this.model.getOptions().legend.orientation=Si.VERTICAL)):S===wi.RIGHT?(y=Ut.ROW_REVERSE,this.model.getOptions().legend.orientation||(this.model.getOptions().legend.orientation=Si.VERTICAL)):S===wi.BOTTOM&&(y=Ut.COLUMN_REVERSE)}const g={id:"spacer",components:[new Un(this.model,this.services)],growth:ht.PREFERRED},b={id:"full-frame",components:[new Le(this.model,this.services,[...m?[p]:[],...m?[g]:[],v],{direction:y})],growth:ht.STRETCH},w={id:"zoom-bar",components:[new qI(this.model,this.services)],growth:ht.PREFERRED,renderType:rt.SVG},_=[];if(u||s){_.push(f);const S={id:"spacer",components:[new Un(this.model,this.services,s?{size:15}:void 0)],growth:ht.PREFERRED};_.push(S)}return l&&_.push(w),_.push(b),[new i0(this.model,this.services),new Go(this.model,this.services),new Le(this.model,this.services,_,{direction:Ut.COLUMN})]}}class sH extends rn{constructor(t,n){super(t,n),this.model=new cL(this.services),this.model.setOptions(Gt(Nt.alluvialChart,n.options)),this.init(t,n)}getComponents(){const t=[new ZI(this.model,this.services)];return this.getChartComponents(t,{excludeLegend:!0})}}class aH extends _e{constructor(t,n){super(t,n),this.model.setOptions(Gt(Ln(Nt.areaChart),n.options)),this.init(t,n)}getComponents(){const t=[new Ee(this.model,this.services),new Re(this.model,this.services),new Xn(this.model,this.services),new gi(this.model,this.services),new s0(this.model,this.services),new mn(this.model,this.services,{fadeInOnChartHolderMouseover:!0,handleThresholds:!0}),new ge(this.model,this.services,{skeleton:te.GRID})];return this.getAxisChartComponents(t)}}class oH extends _e{constructor(t,n){super(t,n),this.model=new uL(this.services),this.model.setOptions(Gt(Nt.boxplotChart,n.options)),this.init(t,n)}getComponents(){const t=[new Ee(this.model,this.services),new Re(this.model,this.services),new JI(this.model,this.services),new vi(this.model,this.services),new ge(this.model,this.services,{skeleton:te.VERT_OR_HORIZ})];return this.getAxisChartComponents(t,{legend:{enabled:!1}})}}class lH extends _e{constructor(t,n){super(t,n),this.model.setOptions(Gt(Nt.bubbleChart,n.options)),this.init(t,n)}getComponents(){const t=[new Ee(this.model,this.services),new Re(this.model,this.services),new Xn(this.model,this.services),new tN(this.model,this.services),new ge(this.model,this.services,{skeleton:te.GRID})];return this.getAxisChartComponents(t)}}class cH extends _e{constructor(t,n){super(t,n),this.model=new hL(this.services),this.model.setOptions(Gt(Nt.bulletChart,n.options)),this.init(t,n)}getComponents(){const t=[new Ee(this.model,this.services),new Re(this.model,this.services),new eN(this.model,this.services),new ge(this.model,this.services,{skeleton:te.GRID})];return this.getAxisChartComponents(t)}}class uH extends rn{constructor(t,n){super(t,n),this.model=new dL(this.services),this.model.setOptions(Gt(Nt.choroplethChart,n.options)),this.init(t,n)}getChartComponents(t,n){const r=this.model.getOptions(),i=x(r,"toolbar","enabled"),s=!!this.model.getOptions().title,a={id:"title",components:[new $s(this.model,this.services)],growth:ht.STRETCH},o={id:"toolbar",components:[new Po(this.model,this.services)],growth:ht.PREFERRED},l={id:"header",components:[new Le(this.model,this.services,[a,...i?[o]:[]],{direction:Ut.ROW,alignItems:Ir.CENTER})],growth:ht.PREFERRED},c={id:"legend",components:[new c0(this.model,this.services,{chartType:"choropleth"})],growth:ht.PREFERRED,renderType:rt.SVG},u={id:"graph-frame",components:t,growth:ht.STRETCH,renderType:rt.SVG},d=x(n,"legend","enabled")!==!1&&this.model.getOptions().legend.enabled!==!1&&this.model.getData().length>0,h=Ut.COLUMN_REVERSE,f={id:"spacer",components:[new Un(this.model,this.services,{size:15})],growth:ht.PREFERRED},p={id:"full-frame",components:[new Le(this.model,this.services,[...d?[c]:[],...d?[f]:[],u],{direction:h})],growth:ht.STRETCH},v=[];if(s||i){v.push(l);const m={id:"spacer",components:[new Un(this.model,this.services,i?{size:15}:void 0)],growth:ht.PREFERRED};v.push(m)}return v.push(p),[new Zu(this.model,this.services),new Go(this.model,this.services),new Le(this.model,this.services,v,{direction:Ut.COLUMN})]}getComponents(){const t=[new oB(this.model,this.services)];return this.getChartComponents(t)}}class hH extends rn{constructor(t,n){super(t,n),this.model=new fL(this.services),this.model.setOptions(Gt(Nt.circlePackChart,n.options)),this.init(t,n)}getComponents(){const t=[new xN(this.model,this.services)];return this.getChartComponents(t)}}const N0={[Ie.LINE]:[gi,mn],[Ie.SCATTER]:[mn],[Ie.AREA]:[s0,gi,mn],[Ie.STACKED_AREA]:[m0,gi,v0,Wo],[Ie.SIMPLE_BAR]:[p0],[Ie.GROUPED_BAR]:[f0,vi],[Ie.STACKED_BAR]:[g0,Wo]};class dH extends _e{constructor(t,n){super(t,n);const r=Gt(Nt.comboChart,n.options);n.options.comboChartTypes||(console.error("No comboChartTypes defined for the Combo Chart!"),r.comboChartTypes=[{type:Ie.LINE,correspondingDatasets:[]}]),this.model.setOptions(r),this.init(t,n)}getGraphComponents(){const{comboChartTypes:t}=this.model.getOptions();let n=0;const r=t.map(i=>{const s=i.type;let a;if(typeof i.type=="string"){if(!Object.keys(N0).includes(i.type))return console.error(`Invalid chart type "${i.type}" specified for combo chart. Please refer to the ComboChart tutorial for more guidance.`),null;let o=!1;const l=`${iH(i.type)}Chart`;return a=lt({},Nt[l],this.model.getOptions(),i.options),i.type===Ie.STACKED_AREA&&(o=!0),N0[i.type].map(c=>new c(this.model,this.services,{groups:i.correspondingDatasets,id:n++,options:a,stacked:o}))}else return a=lt({},this.model.getOptions(),i.options),new s(this.model,this.services,{groups:i.correspondingDatasets,id:n++,options:a})}).filter(i=>i!==null);return b0(r)}getComponents(){const{comboChartTypes:t}=this.model.getOptions(),n=t.some(i=>i.type===Ie.STACKED_BAR||i.type===Ie.STACKED_AREA),r=[new Ee(this.model,this.services),new Re(this.model,this.services),new ge(this.model,this.services,{skeleton:te.GRID}),...n?[]:[new Xn(this.model,this.services)],...this.getGraphComponents()];return this.getAxisChartComponents(r)}}class P0 extends rn{constructor(t,n,r=!1){super(t,n),this.model=new pL(this.services),!r&&(this.model.setOptions(Gt(Nt.pieChart,n.options)),this.init(t,n))}getComponents(){const t=[new u0(this.model,this.services),new ge(this.model,this.services,{skeleton:te.PIE})];return this.getChartComponents(t)}}class fH extends P0{constructor(t,n){super(t,n,!0),this.model.setOptions(Gt(Nt.donutChart,n.options)),this.init(t,n)}getComponents(){const t=[new EN(this.model,this.services),new ge(this.model,this.services,{skeleton:te.DONUT})];return this.getChartComponents(t)}}class pH extends rn{constructor(t,n){super(t,n),this.model=new mL(this.services),this.model.setOptions(Gt(Nt.gaugeChart,n.options)),this.init(t,n)}getComponents(){const t=[new _N(this.model,this.services)];return this.getChartComponents(t)}}class mH extends _e{constructor(t,n){super(t,n),this.model.setOptions(Gt(Nt.groupedBarChart,n.options)),this.init(t,n)}getComponents(){const t=[new Ee(this.model,this.services),new Re(this.model,this.services),new f0(this.model,this.services),new vi(this.model,this.services),new ge(this.model,this.services,{skeleton:te.VERT_OR_HORIZ})];return this.getAxisChartComponents(t)}}class gH extends _e{constructor(t,n){super(t,n),this.model=new gL(this.services),this.model.setOptions(Gt(Nt.heatmapChart,n.options)),this.init(t,n)}getAxisChartComponents(t,n){const r=this.model.getOptions(),i=x(r,"toolbar","enabled");this.services.cartesianScales.determineAxisDuality(),this.services.cartesianScales.findDomainAndRangeAxes(),this.services.cartesianScales.determineOrientation();const s=!!this.model.getOptions().title,a={id:"title",components:[new $s(this.model,this.services)],growth:ht.STRETCH},o={id:"toolbar",components:[new Po(this.model,this.services)],growth:ht.PREFERRED},l={id:"header",components:[new Le(this.model,this.services,[a,...i?[o]:[]],{direction:Ut.ROW,alignItems:Ir.CENTER})],growth:ht.PREFERRED},c={id:"legend",components:[new c0(this.model,this.services,{chartType:"heatmap"})],growth:ht.PREFERRED,renderType:rt.SVG},u={id:"graph-frame",components:t,growth:ht.STRETCH,renderType:rt.SVG},d=x(n,"legend","enabled")!==!1&&this.model.getOptions().legend.enabled!==!1&&this.model.getData().length>0,h=Ut.COLUMN_REVERSE,f={id:"spacer",components:[new Un(this.model,this.services,{size:15})],growth:ht.PREFERRED},p={id:"full-frame",components:[new Le(this.model,this.services,[...d?[c]:[],...d?[f]:[],u],{direction:h})],growth:ht.STRETCH},v=[];if(s||i){v.push(l);const m={id:"spacer",components:[new Un(this.model,this.services,i?{size:15}:void 0)],growth:ht.PREFERRED};v.push(m)}return v.push(p),[new i0(this.model,this.services),new Go(this.model,this.services),new Le(this.model,this.services,v,{direction:Ut.COLUMN})]}getComponents(){const t=[new Ee(this.model,this.services),new wN(this.model,this.services)];return this.getAxisChartComponents(t)}}class vH extends _e{constructor(t,n){super(t,n),this.model=new vL(this.services),this.model.setOptions(Gt(Nt.histogramChart,n.options)),this.init(t,n),this.update()}getComponents(){const t=[new Ee(this.model,this.services),new Re(this.model,this.services),new uN(this.model,this.services),new SN(this.model,this.services)];return this.getAxisChartComponents(t)}}class yH extends _e{constructor(t,n){super(t,n),this.model.setOptions(Gt(Nt.lineChart,n.options)),this.init(t,n)}getComponents(){const t=[new Ee(this.model,this.services),new Re(this.model,this.services),new Xn(this.model,this.services),new gi(this.model,this.services),new mn(this.model,this.services,{handleThresholds:!0}),new CN(this.model,this.services),new vi(this.model,this.services)];return this.getAxisChartComponents(t)}}class xH extends _e{constructor(t,n){super(t,n),this.model.setOptions(Gt(Nt.lollipopChart,n.options)),this.init(t,n)}getComponents(){const t=[new Ee(this.model,this.services),new Re(this.model,this.services),new Xn(this.model,this.services),new ON(this.model,this.services),new mn(this.model,this.services),new ge(this.model,this.services,{skeleton:te.GRID})];return this.getAxisChartComponents(t)}}class bH extends rn{constructor(t,n){var r;super(t,n),this.model=new yL(this.services);const i=(r=n.options.meter)!=null&&r.proportional?lt(Ln(Nt.proportionalMeterChart),n.options):lt(Ln(Nt.meterChart),n.options);this.model.setOptions(i),this.init(t,n)}getComponents(){const t=[...x(this.model.getOptions(),"meter","showLabels")?[{id:"meter-title",components:[new yN(this.model,this.services)],growth:ht.STRETCH,renderType:rt.SVG},{id:"spacer",components:[new Un(this.model,this.services,{size:8})],growth:ht.STRETCH}]:[],{id:"meter-graph",components:[new TN(this.model,this.services)],growth:ht.STRETCH,renderType:rt.SVG}],n=[new Le(this.model,this.services,t,{direction:Ut.COLUMN})];return this.getChartComponents(n,{graphFrameRenderType:rt.HTML})}}class EH extends rn{constructor(t,n){super(t,n),this.model=new xL(this.services),this.model.setOptions(Gt(Nt.radarChart,n.options)),this.init(t,n)}getComponents(){const t=[new MN(this.model,this.services)];return this.getChartComponents(t)}}class _H extends _e{constructor(t,n){super(t,n),this.model.setOptions(Gt(Nt.scatterChart,n.options)),this.init(t,n)}getComponents(){const t=[new Ee(this.model,this.services),new Re(this.model,this.services),new Xn(this.model,this.services),new mn(this.model,this.services),new ge(this.model,this.services,{skeleton:te.GRID})];return this.getAxisChartComponents(t)}}class wH extends rn{constructor(t,n){super(t,n),this.model=new bL(this.services),this.model.setOptions(Gt(Nt.treeChart,n.options)),this.init(t,n)}getComponents(){const t=[new AN(this.model,this.services)];return this.getChartComponents(t,{excludeLegend:!0})}}class SH extends rn{constructor(t,n){super(t,n),this.model=new EL(this.services),this.model.setOptions(Gt(Nt.treemapChart,n.options)),this.init(t,n)}getComponents(){const t=[new iB(this.model,this.services)];return this.getChartComponents(t)}}class OH extends _e{constructor(t,n){super(t,n),this.model.setOptions(Gt(Nt.simpleBarChart,n.options)),this.init(t,n)}getComponents(){const t=[new Ee(this.model,this.services),new Re(this.model,this.services),new p0(this.model,this.services),new vi(this.model,this.services),new ge(this.model,this.services,{skeleton:te.VERT_OR_HORIZ})];return this.getAxisChartComponents(t)}}class TH extends _e{constructor(t,n){super(t,n),this.model.setOptions(Gt(Nt.stackedAreaChart,n.options)),this.init(t,n)}getComponents(){const t=[new Ee(this.model,this.services),new Re(this.model,this.services),new Wo(this.model,this.services),new m0(this.model,this.services),new gi(this.model,this.services,{stacked:!0}),new v0(this.model,this.services,{fadeInOnChartHolderMouseover:!0,handleThresholds:!0,stacked:!0}),new ge(this.model,this.services,{skeleton:te.GRID})];return this.getAxisChartComponents(t)}}class MH extends _e{constructor(t,n){super(t,n),this.model.setOptions(Gt(Nt.stackedBarChart,n.options)),this.init(t,n)}getComponents(){const t=[new Ee(this.model,this.services),new Re(this.model,this.services),new Wo(this.model,this.services),new g0(this.model,this.services),new ge(this.model,this.services,{skeleton:te.VERT_OR_HORIZ}),new vi(this.model,this.services)];return this.getAxisChartComponents(t)}}class CH extends rn{constructor(t,n){super(t,n),this.model=new _L(this.services),this.model.setOptions(Gt(Nt.wordCloudChart,n.options)),this.init(t,n)}getComponents(){const t=[new sB(this.model,this.services),new ge(this.model,this.services,{skeleton:te.PIE})];return this.getChartComponents(t)}}var oh={exports:{}},Rs={};/**
85
+ </svg>`}addEventListeners(){const t=this;this.parent.selectAll("circle.node").on("mouseover",function(n,r){const i=k(this);i.classed("hovered",!0);const s=t.model.getHierarchyLevel(),a=s>2&&!i.classed("focal"),o=x(t.model.getOptions(),"canvasZoom","enabled");let l=!1;if(!a){let c=[],u=[],d=null;if(r.children){r.depth>1&&o&&(l=!0,i.classed("clickable",!0)),c=r.children.map(p=>{if(p!==null)return typeof p.data.value=="number"?{label:p.data.name,value:p.data.value}:{label:p.data.name,labelIcon:o&&s<=2?t.getZoomIcon():null,value:p.value}});const f=t.model.getOptions();u=[{label:_t(f,"locale.translations.total")||_t(f,"tooltip.totalLabel")||"Total",value:r.value,bold:!0}],t.highlightChildren(r.children)}else d=r.value;const h=getComputedStyle(this,null).getPropertyValue("fill");t.services.events.dispatchEvent(O.Tooltip.SHOW,{event:n,hoveredElement:i,items:[{color:h,label:r.data.name,labelIcon:l&&o&&s<=2?t.getZoomIcon():null,value:d},...c,...u]})}t.services.events.dispatchEvent(O.CirclePack.CIRCLE_MOUSEOVER,{event:n,element:i,datum:r})}).on("mousemove",function(n,r){const i=k(this);t.services.events.dispatchEvent(O.CirclePack.CIRCLE_MOUSEMOVE,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(O.Tooltip.MOVE,{event:n})}).on("mouseout",function(n,r){const i=k(this);i.classed("hovered",!1),r.children&&t.unhighlightChildren(r.children),t.services.events.dispatchEvent(O.CirclePack.CIRCLE_MOUSEOUT,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(O.Tooltip.HIDE,{hoveredElement:i})}).on("click",function(n,r){const i=k(this),s=i.classed("non-focal"),a=x(t.model.getOptions(),"canvasZoom","enabled");if(a&&t.model.getHierarchyLevel()>2){const o=t.parent.selectAll("circle.node");k(t.services.domUtils.getMainContainer()).classed("zoomed-in",!1),t.focal=null,t.model.updateHierarchyLevel(2),t.services.canvasZoom.zoomOut(o,oi)}else if(r.depth===2&&r.children&&!s&&a){const o=t.parent.selectAll("circle.node");k(t.services.domUtils.getMainContainer()).classed("zoomed-in",!0),t.focal=r,t.model.updateHierarchyLevel(3),t.services.canvasZoom.zoomIn(r,o,oi),n.stopPropagation()}t.services.events.dispatchEvent(O.CirclePack.CIRCLE_CLICK,{event:n,element:i,datum:r})})}destroy(){this.parent.selectAll("circle.node").on("mouseover",null).on("mousemove",null).on("mouseout",null).on("click",null);const t=this.services.events;t.removeEventListener(O.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(O.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut),this.removeBackgroundListeners()}}function bN(e,t){const n=Ri(this._current,e);return r=>(this._current=n(r),t(this._current))}class u0 extends xt{constructor(){super(...arguments),this.type="pie",this.renderType=rt.SVG,this.isRendering=!1,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail,{groupMapsTo:r}=this.getOptions().data;this.parent.selectAll("path.slice").transition("legend-hover-bar").call(i=>this.services.transitions.setupTransition({transition:i,name:"legend-hover-bar"})).attr("opacity",i=>i.data[r]!==n.datum().name?.3:1)},this.handleLegendMouseOut=()=>{this.parent.selectAll("path.slice").transition("legend-mouseout-bar").call(t=>this.services.transitions.setupTransition({transition:t,name:"legend-mouseout-bar"})).attr("opacity",1)}}init(){const t=this.services.events;t.addEventListener(O.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(O.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}getInnerRadius(){return Ht.innerRadius}render(t=!0){const n=this,r=this.getComponentContainer(),i=this.getOptions(),{groupMapsTo:s}=i.data,{valueMapsTo:a}=i.pie;this.isRendering=!0;const o=this.model.getDisplayData().filter(D=>D[a]>0),l=this.computeRadius();this.arc=is().innerRadius(this.getInnerRadius()).outerRadius(l),this.hoverArc=is().innerRadius(this.getInnerRadius()).outerRadius(l+Ht.hoverArc.outerRadiusOffset);const c=BS().value(D=>D[a]).sort(x(i,"pie","sortFunction")).padAngle(Ht.padAngle)(o),u=N.appendOrSelect(r,"g.slices").attr("role",dt.GROUP).attr("data-name","slices").selectAll("path.slice").data(c,D=>D.data[s]);u.exit().attr("opacity",0).remove(),u.enter().append("path").classed("slice",!0).attr("opacity",0).merge(u).attr("class",D=>this.model.getColorClassName({classNameTypes:[at.FILL],dataGroupName:D.data[s],originalClassName:"slice"})).style("fill",D=>n.model.getFillColor(D.data[s],null,D.data)).attr("d",this.arc).transition().call(D=>this.services.transitions.setupTransition({transition:D,name:"pie_slice_enter_update",animate:t})).attr("opacity",1).attr("role",dt.GRAPHICS_SYMBOL).attr("aria-roledescription","slice").attr("aria-label",D=>`${D[a]}, ${au(D.data[a],o,a)+"%"}`).attrTween("d",function(D){return bN.bind(this)(D,n.arc)}).on("end",()=>{n.isRendering=!1});const{code:d,number:h}=x(i,"locale"),f=i.pie.labels.enabled,p=f?c.filter(D=>D.data[a]>0):[],v=N.appendOrSelect(r,"g.labels").attr("role",dt.GROUP).attr("data-name","labels").selectAll("text.pie-label").data(p,D=>D.data[s]);v.exit().attr("opacity",0).remove();const m=v.enter().append("text").classed("pie-label",!0),y=[];m.merge(v).style("text-anchor","middle").text(D=>i.pie.labels.formatter?i.pie.labels.formatter({...D,percentageValue:au(D.data[a],o,a,!0)}):h(au(D.data[a],o,a),d)+"%").datum(function(D){const R=l+7,M=(D.endAngle-D.startAngle)/2+D.startAngle,V=M/Math.PI*180,P=this.getComputedTextLength();return D.textOffsetX=P/2,D.textOffsetY=V>90&&V<270?10:0,D.xPosition=(D.textOffsetX+R)*Math.sin(M),D.yPosition=(D.textOffsetY+R)*-Math.cos(M),D}).attr("transform",function(D,R){const M=p.length,V=(D.endAngle-D.startAngle)*(180/Math.PI);if(R>=M-2&&V<Ht.callout.minSliceDegree){let P,H;return D.index===M-1?(P=D.xPosition+Ht.callout.offsetX+Ht.callout.textMargin+D.textOffsetX,H=D.yPosition-Ht.callout.offsetY,D.direction=Ws.RIGHT,y.push(D)):(P=D.xPosition-Ht.callout.offsetX-D.textOffsetX-Ht.callout.textMargin,H=D.yPosition-Ht.callout.offsetY,D.direction=Ws.LEFT,y.push(D)),`translate(${P}, ${H})`}return`translate(${D.xPosition}, ${D.yPosition})`}),this.renderCallouts(y);const g=x(i,"donut")?"donut":"pie",b=x(i,g,"alignment"),{width:w}=N.getSVGElementSize(this.getParent(),{useAttrs:!0}),_=f?Ht.xOffset:0,S=f?Ht.yOffset:0;let L=l+_;b===Kt.CENTER?L=w/2:b===Kt.RIGHT&&(L=w-l-Ht.xOffset);let I=l+S;y.length>0&&(I+=Ht.yOffsetCallout),r.attr("x",L+7).attr("y",I),this.addEventListeners()}renderCallouts(t){const n=N.appendOrSelect(this.getComponentContainer(),"g.callouts").attr("role",dt.GROUP).attr("data-name","callouts"),r=n.selectAll("g.callout").data(t);r.exit().remove();const i=r.enter().append("g").classed("callout",!0).attr("role",dt.GROUP).attr("aria-roledescription","label callout");i.merge(r).datum(function(s){const{xPosition:a,yPosition:o,direction:l}=s;return l===Ws.RIGHT?(s.startPos={x:a,y:o+s.textOffsetY},s.endPos={x:a+Ht.callout.offsetX,y:o-Ht.callout.offsetY+s.textOffsetY},s.intersectPointX=s.endPos.x-Ht.callout.horizontalLineLength):(s.startPos={x:a,y:o+s.textOffsetY},s.endPos={x:a-Ht.callout.offsetX,y:o-Ht.callout.offsetY+s.textOffsetY},s.intersectPointX=s.endPos.x+Ht.callout.horizontalLineLength),s}),i.append("line").classed("vertical-line",!0).merge(n.selectAll("line.vertical-line")).datum(function(){return k(this.parentNode).datum()}).style("stroke-width","1px").attr("x1",s=>s.startPos.x).attr("y1",s=>s.startPos.y).attr("x2",s=>s.intersectPointX).attr("y2",s=>s.endPos.y),i.append("line").classed("horizontal-line",!0).merge(n.selectAll("line.horizontal-line")).datum(function(){return k(this.parentNode).datum()}).style("stroke-width","1px").attr("x1",s=>s.intersectPointX).attr("y1",s=>s.endPos.y).attr("x2",s=>s.endPos.x).attr("y2",s=>s.endPos.y)}addEventListeners(){const t=this;this.parent.selectAll("path.slice").on("mouseover",function(n,r){const i=k(this);t.isRendering||i.classed("hovered",!0).transition("pie_slice_mouseover").call(o=>t.services.transitions.setupTransition({transition:o,name:"pie_slice_mouseover"})).attr("d",t.hoverArc),t.services.events.dispatchEvent(O.Pie.SLICE_MOUSEOVER,{event:n,element:k(this),datum:r});const{groupMapsTo:s}=t.getOptions().data,{valueMapsTo:a}=t.getOptions().pie;t.services.events.dispatchEvent(O.Tooltip.SHOW,{event:n,hoveredElement:i,items:[{label:r.data[s],value:r.data[a]}]})}).on("mousemove",function(n,r){const i=k(this);t.services.events.dispatchEvent(O.Pie.SLICE_MOUSEMOVE,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(O.Tooltip.MOVE,{event:n})}).on("click",function(n,r){t.services.events.dispatchEvent(O.Pie.SLICE_CLICK,{event:n,element:k(this),datum:r})}).on("mouseout",function(n,r){const i=k(this);sk(()=>{t.isRendering||i.classed("hovered",!1).transition("pie_slice_mouseout").call(s=>t.services.transitions.setupTransition({transition:s,name:"pie_slice_mouseout"})).attr("d",t.arc)},100),t.services.events.dispatchEvent(O.Pie.SLICE_MOUSEOUT,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(O.Tooltip.HIDE,{hoveredElement:i})})}computeRadius(){const{width:t,height:n}=N.getSVGElementSize(this.parent,{useAttrs:!0}),r=this.getOptions(),i=Math.min(t,n)/2;return r.pie.labels.enabled?i+Ht.radiusOffset:i}}class EN extends u0{constructor(){super(...arguments),this.type="donut",this.renderType=rt.SVG}render(t=!0){super.render(t);const n=this;if(this.model.isDataEmpty()){this.getComponentContainer().select("g.center").remove();return}const r=N.appendOrSelect(this.getComponentContainer(),"g.center"),i=this.getOptions(),s=this.computeRadius(),a=x(i,"donut","center","label");N.appendOrSelect(r,"text.donut-figure").attr("text-anchor","middle").style("dominant-baseline",()=>a===null||a===""?"central":"initial").style("font-size",()=>i.donut.center.numberFontSize(s)).transition().call(o=>this.services.transitions.setupTransition({transition:o,name:"donut-figure-enter-update",animate:t})).tween("text",function(){return n.centerNumberTween(k(this))}),a!==null&&a!==""&&N.appendOrSelect(r,"text.donut-title").attr("text-anchor","middle").style("font-size",()=>i.donut.center.titleFontSize(s)).attr("y",i.donut.center.titleYPosition(s)).text(a)}getInnerRadius(){return this.computeRadius()*(3/4)}centerNumberTween(t){const n=this.getOptions();let r=x(n,"donut","center","number");r===null&&(r=this.model.getDisplayData().reduce((o,l)=>o+l[n.pie.valueMapsTo],0));const i=parseInt(t.text().replace(/[, ]+/g,""),10)||0;let s;i%1===0&&r%1===0?s=yd:s=Oe;const a=s(i,r);return o=>{const{numberFormatter:l}=n.donut.center;if(l)t.text(l(a(o)));else{const{code:c,number:u}=x(n,"locale");t.text(u(Math.floor(a(o)),c))}}}}const h0="4,10 8,6 12,10",d0="12,6 8,10 4,6";class _N extends xt{constructor(){super(...arguments),this.type="gauge",this.renderType=rt.SVG}getValue(){var t;return((t=this.model.getData().find(n=>n.group==="value"))==null?void 0:t.value)??null}getValueRatio(){return Tv(this.getValue(),0,100)/100}getDelta(){var t;return((t=this.model.getData().find(n=>n.group==="delta"))==null?void 0:t.value)??null}getArcRatio(){const t=this.getOptions();return x(t,"gauge","type")===Nr.FULL?1:.5}getArcSize(){return this.getArcRatio()*Math.PI*2}getStartAngle(){const t=this.getArcSize();return t===2*Math.PI?0:-t/2}getArrow(t){const n=this.getOptions();switch(x(n,"gauge","deltaArrow","direction")){case tl.UP:return h0;case tl.DOWN:return d0;default:return t>0?h0:d0}}render(t=!0){const n=this.getComponentContainer().attr("width","100%").attr("height","100%"),r=this.getOptions(),i=this.getValue(),s=this.getValueRatio(),a=this.getArcSize(),o=this.getStartAngle(),l=s*a,c=o+l,u=o+a,d=this.computeRadius(),h=this.getInnerRadius();this.backgroundArc=is().innerRadius(h).outerRadius(d).startAngle(c).endAngle(u),this.arc=is().innerRadius(h).outerRadius(d).startAngle(o).endAngle(c),N.appendOrSelect(n,"path.arc-background").attr("d",this.backgroundArc);const f=n.selectAll("path.arc-foreground").data([i]);f.enter().append("path").merge(f).attr("class",this.model.getColorClassName({classNameTypes:[at.FILL],dataGroupName:"value",originalClassName:"arc-foreground"})).style("fill",()=>x(this.getOptions(),"color","scale","value")).attr("d",this.arc).attr("role",dt.GRAPHICS_SYMBOL).attr("aria-roledescription","value").attr("aria-label",y=>y),this.drawValueNumber(),this.drawDelta(),f.exit().remove();const p=x(r,"gauge","alignment"),{width:v}=N.getSVGElementSize(this.getParent(),{useAttrs:!0});let m=d;p===Kt.CENTER?m=v/2:p===Kt.RIGHT&&(m=v-d),n.attr("x",m).attr("y",d),this.addEventListeners()}drawValueNumber(){const t=this.getComponentContainer(),n=this.getOptions(),r=x(n,"gauge","type"),i=this.getValue(),s=this.getDelta(),a=this.computeRadius(),o=x(n,"gauge","valueFontSize"),l=x(n,"gauge","deltaFontSize"),c=x(n,"gauge","numberSpacing"),u=x(n,"gauge","showPercentageSymbol");let d=0;r===Nr.FULL&&!s?d=l(a):r===Nr.SEMI&&s&&(d=-(l(a)+c));const h=N.appendOrSelect(t,"g.gauge-numbers").attr("transform",`translate(0, ${d})`),f=o(a),p=N.appendOrSelect(h,"g.gauge-value-number"),{code:v,number:m}=x(n,"locale"),y=x(n,"gauge","numberFormatter"),g=p.selectAll("text.gauge-value-number").data([i]);g.enter().append("text").attr("class","gauge-value-number").merge(g).style("font-size",`${f}px`).attr("text-anchor","middle").text(D=>{let R;return D!=null?R=Number(D.toFixed(2))%1!==0?D.toFixed(2):D.toFixed():R=0,y?y(R):m(Number(R),v)});const{width:b}=N.getSVGElementSize(N.appendOrSelect(t,"text.gauge-value-number"),{useBBox:!0}),w=f/2,_=u?"%":"",S=N.appendOrSelect(p,"text.gauge-value-symbol").style("font-size",`${w}px`).attr("x",b/2).text(_),{width:L,height:I}=N.getSVGElementSize(S,{useBBox:!0});S.attr("y",`-${I/2}px`),p.attr("transform",`translate(-${L/2}, 0)`)}drawDelta(){const t=this,n=this.getComponentContainer(),r=this.getOptions(),i=this.getDelta(),{code:s,number:a}=x(r,"locale");if(i){const o=this.computeRadius(),l=i?x(r,"gauge","deltaFontSize"):()=>0,c=i?x(r,"gauge","numberFormatter"):()=>null,u=x(r,"gauge","deltaArrow","size"),d=x(r,"gauge","numberSpacing"),h=x(r,"gauge","showPercentageSymbol"),f=N.appendOrSelect(n,"g.gauge-numbers"),p=N.appendOrSelect(f,"g.gauge-delta").attr("transform",`translate(0, ${l(o)+d})`),v=N.appendOrSelect(p,"text.gauge-delta-number"),m=h?"%":"";v.data(i===null?[]:[i]),v.enter().append("text").classed("gauge-delta-number",!0).merge(v).attr("text-anchor","middle").style("font-size",`${l(o)}px`).text(w=>{let _;return w!=null?_=Number(w.toFixed(2))%1!==0?w.toFixed(2):w.toFixed():_=0,c?`${c(_)}${m}`:`${a(Number(_),s)}${m}`});const{width:y}=N.getSVGElementSize(N.appendOrSelect(n,".gauge-delta-number"),{useBBox:!0}),g=x(r,"gauge","deltaArrow","enabled"),b=p.selectAll("svg.gauge-delta-arrow").data(i!==null&&g?[i]:[]);b.enter().append("svg").merge(b).attr("class","gauge-delta-arrow").attr("x",-u(o)-y/2).attr("y",-u(o)/2-l(o)*.35).attr("width",u(o)).attr("height",u(o)).attr("viewBox","0 0 16 16").each(function(){const w=k(this);N.appendOrSelect(w,"rect.gauge-delta-arrow-backdrop").attr("width","16").attr("height","16").attr("fill","none");const _=x(r,"gauge","status");N.appendOrSelect(w,"polygon.gauge-delta-arrow").attr("class",_!==null?`gauge-delta-arrow status--${_}`:"").attr("points",t.getArrow(i))}),b.exit().remove(),v.exit().remove()}else{const o=n.select("g.gauge-delta");o.empty()||o.remove()}}getInnerRadius(){const t=this.computeRadius(),n=x(this.getOptions(),"gauge","arcWidth");return t-n}addEventListeners(){const t=this;this.parent.selectAll("path.arc-foreground").on("mouseover",function(n,r){t.services.events.dispatchEvent(O.Gauge.ARC_MOUSEOVER,{event:n,element:k(this),datum:r})}).on("mousemove",function(n,r){const i=k(this);t.services.events.dispatchEvent(O.Gauge.ARC_MOUSEMOVE,{event:n,element:i,datum:r})}).on("click",function(n,r){t.services.events.dispatchEvent(O.Gauge.ARC_CLICK,{event:n,element:k(this),datum:r})}).on("mouseout",function(n,r){const i=k(this);t.services.events.dispatchEvent(O.Gauge.ARC_MOUSEOUT,{event:n,element:i,datum:r})})}computeRadius(){const t=this.getOptions(),n=x(t,"gauge","type"),{width:r,height:i}=N.getSVGElementSize(this.parent,{useAttrs:!0});return n===Nr.SEMI?Math.min(r/2,i):Math.min(r/2,i/2)}}class f0 extends Qu{constructor(){super(...arguments),this.type="grouped-bar",this.renderType=rt.SVG,this.padding=5,this.defaultStepFactor=70,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail,{groupMapsTo:r}=this.getOptions().data;this.parent.selectAll("path.bar").transition("legend-hover-bar").call(i=>this.services.transitions.setupTransition({transition:i,name:"legend-hover-bar"})).attr("opacity",i=>i[r]!==n.datum().name?.3:1)},this.handleLegendMouseOut=()=>{this.parent.selectAll("path.bar").transition("legend-mouseout-bar").call(t=>this.services.transitions.setupTransition({transition:t,name:"legend-mouseout-bar"})).attr("opacity",1)}}init(){const t=this.services.events;t.addEventListener(O.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(O.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t){const n=this.model.getDisplayData(this.configs.groups),r=this.getOptions(),{groupMapsTo:i}=r.data;this.setGroupScale();const s=this.getComponentContainer({withinChartClip:!0}),a=bs(n.map(u=>{const d=this.services.cartesianScales.getDomainIdentifier(u);return u[d]&&typeof u[d].toString=="function"?u[d].toString():u[d]})),o=s.selectAll("g.bars").data(a,u=>u);o.exit().attr("opacity",0).remove();const l=o.enter().append("g").classed("bars",!0).attr("role",dt.GROUP).attr("data-name","bars").merge(o);l.transition().call(u=>this.services.transitions.setupTransition({transition:u,name:"bar-group-update-enter",animate:t})).attr("transform",u=>{const d=this.services.cartesianScales.getDomainValue(u)-this.getGroupWidth()/2;return this.services.cartesianScales.getOrientation()===Jt.VERTICAL?`translate(${d}, 0)`:`translate(0, ${d})`});const c=l.selectAll("path.bar").data(u=>this.getDataCorrespondingToLabel(u),u=>u[i]);c.exit().attr("opacity",0).remove(),c.enter().append("path").attr("opacity",0).merge(c).classed("bar",!0).transition().call(u=>this.services.transitions.setupTransition({transition:u,name:"bar-update-enter",animate:t})).attr("class",u=>this.model.getColorClassName({classNameTypes:[at.FILL],dataGroupName:u[i],originalClassName:"bar"})).style("fill",u=>{const d=this.services.cartesianScales.getDomainIdentifier(u);return this.model.getFillColor(u[i],u[d],u)}).attr("d",u=>{const d=this.groupScale(u[i]),h=this.getBarWidth(),f=d,p=d+h,v=this.services.cartesianScales.getRangeAxisPosition({datum:u}),m=this.services.cartesianScales.getDomainLowerBound(v),y=this.services.cartesianScales.getValueThroughAxisPosition(v,m),g=this.services.cartesianScales.getRangeValue(u),b=this.services.cartesianScales.getDomainValue(u)-h/2,w=b+h;if(!this.isOutsideZoomedDomain(b,w))return pe({x0:f,x1:p,y0:y,y1:g},this.services.cartesianScales.getOrientation())}).attr("opacity",1).attr("role",dt.GRAPHICS_SYMBOL).attr("aria-roledescription","bar").attr("aria-label",u=>u.value),this.addEventListeners()}addEventListeners(){const t=this;this.parent.selectAll("path.bar").on("mouseover",function(n,r){const i=k(this);i.classed("hovered",!0),t.services.events.dispatchEvent(O.Bar.BAR_MOUSEOVER,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(O.Tooltip.SHOW,{event:n,hoveredElement:i,data:[r]})}).on("mousemove",function(n,r){const i=k(this);t.services.events.dispatchEvent(O.Bar.BAR_MOUSEMOVE,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(O.Tooltip.MOVE,{event:n})}).on("click",function(n,r){t.services.events.dispatchEvent(O.Bar.BAR_CLICK,{event:n,element:k(this),datum:r})}).on("mouseout",function(n,r){const i=k(this);i.classed("hovered",!1),t.services.events.dispatchEvent(O.Bar.BAR_MOUSEOUT,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(O.Tooltip.HIDE,{hoveredElement:i})})}destroy(){this.parent.selectAll("path.bar").on("mouseover",null).on("mousemove",null).on("mouseout",null);const t=this.services.events;t.removeEventListener(O.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(O.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}getDataCorrespondingToLabel(t){return this.model.getDisplayData(this.configs.groups).filter(n=>{const r=this.services.cartesianScales.getDomainIdentifier(n);return n[r].toString()===t})}getGroupWidth(){const t=this.model.getGroupedData(this.configs.groups),n=this.getTotalGroupPadding();return this.getBarWidth()*t.length+n}getDomainScaleStep(){const t=this.services.cartesianScales.getDomainScale(),n=this.model.getGroupedData(this.configs.groups);let r=this.defaultStepFactor;if(typeof t.step=="function")r=t.step();else if(n.length>0){const i=n.find(s=>{var a;return((a=s.data)==null?void 0:a.length)>1});if(i){const s=this.services.cartesianScales.getDomainIdentifier(i.data[0]);r=Math.abs(t(i.data[1][s])-t(i.data[0][s]))}}return r}getTotalGroupPadding(){const t=this.model.getGroupedData(this.configs.groups);return t.length===1?0:Math.min(5,5*(this.getDomainScaleStep()/this.defaultStepFactor))*(t.length-1)}getBarWidth(){const t=this.getOptions(),n=x(t,"bars","width"),r=x(t,"bars","maxWidth");if(n!==null&&(r===null||n<=r))return n;const i=this.model.getGroupedData(this.configs.groups).length,s=this.getTotalGroupPadding();return Math.min(r,(this.getDomainScaleStep()-s)/i)}setGroupScale(){const t=this.model.getActiveDataGroupNames(this.configs.groups);this.groupScale=Qi().domain(t).rangeRound([0,this.getGroupWidth()])}}class wN extends xt{constructor(){super(...arguments),this.type="heatmap",this.renderType=rt.SVG,this.matrix={},this.xBandwidth=0,this.yBandwidth=0,this.translationUnits={x:0,y:0},this.handleAxisOnHover=t=>{const{detail:n}=t,{datum:r}=n,i=this.model.getUniqueRanges(),s=this.model.getUniqueDomain(),a=this.services.cartesianScales.getDomainLabel(),o=this.services.cartesianScales.getRangeLabel(),l=this.services.cartesianScales.getMainXScale(),c=this.services.cartesianScales.getMainYScale();let u="",d=null,h=null,f=null;this.matrix[r]!==void 0?(u=a,i.forEach(p=>{if(typeof this.matrix[r][p].value=="number"){const v=this.matrix[r][p].value;if(d===null){d=v,h=v,f=v;return}d+=v,h=v<h?v:h,f=v>f?v:f}})):(u=o,s.forEach(p=>{if(typeof this.matrix[p][r].value=="number"){const v=this.matrix[p][r].value;if(d===null){d=v,h=v,f=v;return}d+=v,h=v<h?v:h,f=v>f?v:f}})),l(r)!==void 0?this.parent.select("g.multi-cell.column-highlight").classed("highlighter-hidden",!1).attr("transform",`translate(${l(r)}, ${Vn(c.range())})`):c(r)!==void 0&&this.parent.select("g.multi-cell.row-highlight").classed("highlighter-hidden",!1).attr("transform",`translate(${Vn(l.range())},${c(r)})`),this.services.events.dispatchEvent(O.Tooltip.SHOW,{event:n.event,hoveredElement:k(t.detail.element),items:[{label:u,value:r,bold:!0},{label:"Min",value:h!==null?h:"-"},{label:"Max",value:f!==null?f:"-"},{label:"Average",value:d!==null?d/s.length:"-"}]})},this.handleAxisMouseOut=t=>{this.parent.selectAll("g.multi-cell").classed("highlighter-hidden",!0),this.services.events.dispatchEvent(O.Tooltip.HIDE,{event:t})}}init(){const t=this.services.events;t.addEventListener(O.Axis.LABEL_MOUSEOVER,this.handleAxisOnHover),t.addEventListener(O.Axis.LABEL_MOUSEOUT,this.handleAxisMouseOut),t.addEventListener(O.Axis.LABEL_FOCUS,this.handleAxisOnHover),t.addEventListener(O.Axis.LABEL_BLUR,this.handleAxisMouseOut)}render(t=!0){const n=this.getComponentContainer({withinChartClip:!0});n.lower();const{cartesianScales:r}=this.services;if(this.matrix=this.model.getMatrix(),n.html(""),x(this.getOptions(),"data","loading"))return;const i=r.getMainXScale(),s=r.getMainYScale(),a=r.getDomainIdentifier(),o=r.getRangeIdentifier(),l=this.model.getUniqueDomain(),c=this.model.getUniqueRanges(),u=this.model.getMatrixAsArray(),d=i.range(),h=s.range();this.xBandwidth=Math.abs((d[1]-d[0])/l.length),this.yBandwidth=Math.abs((h[1]-h[0])/c.length);const f=this.services.domUtils.generateElementIDString("heatmap-pattern-stripes");n.append("defs").append("pattern").attr("id",f).attr("width",3).attr("height",3).attr("patternUnits","userSpaceOnUse").attr("patternTransform","rotate(45)").append("rect").classed("pattern-fill",!0).attr("width",.5).attr("height",8);const p=n.selectAll().data(u).enter().append("g").attr("class",v=>`heat-${v.index}`).classed("cell",!0).attr("transform",v=>`translate(${i(v[a])}, ${s(v[o])})`).append("rect").attr("class",v=>this.model.getColorClassName({value:v.value,originalClassName:`heat-${v.index}`})).classed("heat",!0).classed("null-state",v=>v.index===-1||v.value===null).attr("width",this.xBandwidth).attr("height",this.yBandwidth).style("fill",v=>{const m=this.services.cartesianScales.getDomainIdentifier(v);return v.index===-1||v.value===null?`url(#${f})`:this.model.getFillColor(Number(v.value),v[m],v)}).attr("aria-label",v=>v.value);this.createOuterBox("g.cell-highlight",this.xBandwidth,this.yBandwidth),this.createOuterBox("g.multi-cell.column-highlight",this.xBandwidth,Math.abs(h[1]-h[0])),this.createOuterBox("g.multi-cell.row-highlight",Math.abs(d[1]-d[0]),this.yBandwidth),this.determineDividerStatus()&&(p.style("stroke-width","1px"),this.parent.select("g.cell-highlight").classed("cell-2",!0)),this.addEventListener()}createOuterBox(t,n,r){const i=N.appendOrSelect(this.parent,t).classed("shadows",!0).classed("highlighter-hidden",!0);N.appendOrSelect(i,"line.top").attr("x1",-1).attr("x2",n+1),N.appendOrSelect(i,"line.left").attr("x1",0).attr("y1",-1).attr("x2",0).attr("y2",r+1),N.appendOrSelect(i,"line.down").attr("x1",-1).attr("x2",n+1).attr("y1",r).attr("y2",r),N.appendOrSelect(i,"line.right").attr("x1",n).attr("x2",n).attr("y1",-1).attr("y2",r+1)}determineDividerStatus(){const t=x(this.getOptions(),"heatmap","divider","state");return t!==Oi.OFF&&(t===Oi.AUTO&&eg.minCellDividerDimension<=this.xBandwidth&&eg.minCellDividerDimension<=this.yBandwidth||t===Oi.ON)}addEventListener(){const t=this,{cartesianScales:n}=this.services,r=this.getOptions(),i=_t(r,"locale.translations.total")||_t(r,"tooltip.totalLabel")||"Total",s=n.getDomainIdentifier(),a=n.getRangeIdentifier(),o=n.getDomainLabel(),l=n.getRangeLabel();this.parent.selectAll("g.cell").on("mouseover",function(c,u){const d=k(this),h=d.select("rect.heat");if(!h.classed("null-state")){const f=_s(d.attr("transform"));t.parent.select("g.cell-highlight").attr("transform",`translate(${f.x+t.translationUnits.x}, ${f.y+t.translationUnits.y})`).classed("highlighter-hidden",!1),t.services.events.dispatchEvent(O.Heatmap.HEATMAP_MOUSEOVER,{event:c,element:h,datum:u}),t.services.events.dispatchEvent(O.Tooltip.SHOW,{event:c,items:[{label:o,value:u[s]},{label:l,value:u[a]},{label:i,value:u.value,color:h.style("fill")}]})}}).on("mousemove",function(c,u){t.services.events.dispatchEvent(O.Heatmap.HEATMAP_MOUSEMOVE,{event:c,element:k(this),datum:u}),t.services.events.dispatchEvent(O.Tooltip.MOVE,{event:c})}).on("click",function(c,u){t.services.events.dispatchEvent(O.Heatmap.HEATMAP_CLICK,{event:c,element:k(this),datum:u})}).on("mouseout",function(c,u){const d=k(this).select("rect.heat"),h=d.classed("null-state");t.parent.select("g.cell-highlight").classed("highlighter-hidden",!0),h||(t.services.events.dispatchEvent(O.Heatmap.HEATMAP_MOUSEOUT,{event:c,element:d,datum:u}),t.services.events.dispatchEvent(O.Tooltip.HIDE,{event:c,hoveredElement:d}))})}destroy(){this.parent.selectAll("rect.heat").on("mouseover",null).on("mousemove",null).on("click",null).on("mouseout",null);const t=this.services.events;t.removeEventListener(O.Legend.ITEM_HOVER,this.handleAxisOnHover),t.removeEventListener(O.Legend.ITEM_MOUSEOUT,this.handleAxisMouseOut)}}class SN extends xt{constructor(){super(...arguments),this.type="histogram",this.renderType=rt.SVG,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail,r=this.getOptions(),{groupMapsTo:i}=r.data;this.parent.selectAll("path.bar").transition("legend-hover-bar").call(s=>this.services.transitions.setupTransition({transition:s,name:"legend-hover-bar"})).attr("opacity",s=>s[i]!==n.datum().name?.3:1)},this.handleLegendMouseOut=()=>{this.parent.selectAll("path.bar").transition("legend-mouseout-bar").call(t=>this.services.transitions.setupTransition({transition:t,name:"legend-mouseout-bar"})).attr("opacity",1)}}init(){const t=this.services.events;t.addEventListener(O.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(O.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t){const n=this.getComponentContainer(),r=this.model.getOptions(),{groupIdentifier:i}=r,{groupMapsTo:s}=r.data,a=this.model.getBinnedStackedData(),o=this.services.cartesianScales.getMainXScale(),l=n.selectAll("g.bars").data(a,u=>_t(u,`0.${s}`));l.exit().attr("opacity",0).remove(),l.enter().append("g").classed("bars",!0).attr("role",dt.GROUP);const c=n.selectAll("g.bars").selectAll("path.bar").data(u=>u);c.exit().remove(),c.enter().append("path").merge(c).classed("bar",!0).attr(i,(u,d)=>d).transition().call(u=>this.services.transitions.setupTransition({transition:u,name:"histogram-bar-update-enter",animate:t})).attr("class",u=>this.model.getColorClassName({classNameTypes:[at.FILL],dataGroupName:u[s],originalClassName:"bar"})).style("fill",u=>this.model.getFillColor(u[s],null,u)).attr("d",u=>{const d=_t(u,"data");if(!d)return;const h=o(d.x1)-o(d.x0)-1,f=this.services.cartesianScales.getDomainValue(d.x0),p=f+h,v=this.services.cartesianScales.getRangeValue(u[0]);let m=this.services.cartesianScales.getRangeValue(u[1]);return Math.abs(m-v)>0&&Math.abs(m-v)>r.bars.dividerSize&&(this.services.cartesianScales.getOrientation()===Jt.VERTICAL?m+=1:m-=1),pe({x0:f,x1:p,y0:v,y1:m},this.services.cartesianScales.getOrientation())}).attr("opacity",1).attr("role",dt.GRAPHICS_SYMBOL).attr("aria-roledescription","bar").attr("aria-label",u=>x(u,"data",u[s])),this.addEventListeners()}addEventListeners(){const t=this.model.getOptions(),{groupMapsTo:n}=t.data,{code:r,number:i}=x(t,"locale"),s=this;this.parent.selectAll("path.bar").on("mouseover",function(a,o){const l=k(this);l.classed("hovered",!0);const c=i(parseFloat(_t(o,"data.x0")),r),u=i(parseFloat(_t(o,"data.x1")),r),d=s.services.cartesianScales.getRangeAxisPosition(),h=s.services.cartesianScales.getScaleLabel(d);s.services.events.dispatchEvent(O.Tooltip.SHOW,{event:a,hoveredElement:l,items:[{label:_t(t,"bins.rangeLabel")||"Range",value:`${c} – ${u}`},{label:t.tooltip.groupLabel||"Group",value:o[n],class:s.model.getColorClassName({classNameTypes:[at.TOOLTIP],dataGroupName:o[n]})},{label:h,value:_t(o,`data.${o[n]}`)}]})}).on("mousemove",function(a){s.services.events.dispatchEvent(O.Tooltip.MOVE,{event:a})}).on("mouseout",function(){k(this).classed("hovered",!1),s.services.events.dispatchEvent(O.Tooltip.HIDE)})}destroy(){this.parent.selectAll("path.bar").on("mouseover",null).on("mousemove",null).on("mouseout",null);const t=this.services.events;t.removeEventListener(O.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(O.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}}class ON extends mn{constructor(){super(...arguments),this.type="lollipop",this.renderType=rt.SVG,this.handleScatterOnHover=t=>{const n=t.detail,r=this.getOptions(),{groupMapsTo:i}=r.data;this.parent.selectAll("line.line").attr("stroke-width",s=>s[i]!==n.datum[i]?Dn.weight.unselected:Dn.weight.selected)},this.handleScatterOnMouseOut=()=>{this.parent.selectAll("line.line").attr("stroke-width",Dn.weight.unselected)},this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail,r=this.getOptions(),{groupMapsTo:i}=r.data;this.parent.selectAll("line.line").transition("legend-hover-line").call(s=>this.services.transitions.setupTransition({transition:s,name:"legend-hover-line"})).attr("opacity",s=>s[i]!==n.datum().name?Dn.opacity.unselected:Dn.opacity.selected)},this.handleLegendMouseOut=()=>{this.parent.selectAll("line.line").transition("legend-mouseout-line").call(t=>this.services.transitions.setupTransition({transition:t,name:"legend-mouseout-line"})).attr("opacity",Dn.opacity.selected)}}init(){const{events:t}=this.services;t.addEventListener(O.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(O.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t){const n=this.getComponentContainer({withinChartClip:!0}),r=this.model.getOptions(),{groupMapsTo:i}=r.data,{cartesianScales:s}=this.services,a=s.getMainXScale(),o=s.getMainYScale(),l=s.getDomainIdentifier(),c=m=>s.getDomainValue(m),u=m=>s.getRangeValue(m),d=s.getOrientation(),[h,f]=In(c,u,d),p=n.selectAll("line.line").data(this.getScatterData(),m=>`${m[i]}-${m[l]}`);p.exit().attr("opacity",0).remove();const v=p.enter().append("line").attr("opacity",0).merge(p).classed("line",!0).attr("class",m=>this.model.getColorClassName({classNameTypes:[at.STROKE],dataGroupName:m[i],originalClassName:"line"})).transition().call(m=>this.services.transitions.setupTransition({transition:m,name:"lollipop-line-update-enter",animate:t})).style("stroke",m=>this.model.getFillColor(m[i],m[l],m)).attr("opacity",1);d===Jt.HORIZONTAL?v.attr("y1",f).attr("y2",f).attr("x1",a.range()[0]).attr("x2",m=>h(m)-r.points.radius):v.attr("x1",h).attr("x2",h).attr("y1",o.range()[0]).attr("y2",m=>f(m)+r.points.radius),this.addScatterPointEventListeners()}addScatterPointEventListeners(){this.services.events.addEventListener(O.Scatter.SCATTER_MOUSEOVER,this.handleScatterOnHover),this.services.events.addEventListener(O.Scatter.SCATTER_MOUSEOUT,this.handleScatterOnMouseOut)}destroy(){const t=this.services.events;t.removeEventListener(O.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(O.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut),t.removeEventListener(O.Scatter.SCATTER_MOUSEOVER,this.handleScatterOnHover),t.removeEventListener(O.Scatter.SCATTER_MOUSEOUT,this.handleScatterOnMouseOut)}}class TN extends xt{constructor(){super(...arguments),this.type="meter",this.renderType=rt.SVG}getStackedBounds(t,n){let r=0;return t.map((i,s)=>s!==0?(r+=n(i.value),{...i,width:Math.abs(n(i.value)-se.dividerWidth),x:r-n(i.value)}):(r=n(i.value),{...i,width:Math.abs(n(i.value)-se.dividerWidth),x:0}))}render(t=!0){const n=this,r=this.getComponentContainer(),i=this.getOptions(),s=x(i,"meter","proportional"),a=this.model.getDisplayData(),o=this.model.getStatus(),{width:l}=N.getSVGElementSize(r,{useAttrs:!0}),{groupMapsTo:c}=i.data;let u;x(i,"meter","proportional")===null?u=100:u=x(i,"meter","proportional","total")||this.model.getMaximumDomain(this.model.getDisplayData());const d=Ze().domain([0,u]).range([0,l]),h=this.getStackedBounds(a,d),f=x(i,"meter","height");N.appendOrSelect(r,"rect.container").attr("x",0).attr("y",0).attr("width",l).attr("height",f||(s?se.height.proportional:se.height.default)),N.appendOrSelect(r,"line.rangeIndicator").attr("x1",l).attr("x2",l).attr("y1",0).attr("y2",f||(s?se.height.proportional:se.height.default));const p=r.selectAll("rect.value").data(h),v=o!=null&&!n.model.isUserProvidedColorScaleValid()&&!s?`value status--${o}`:"value";p.enter().append("rect").classed("value",!0).merge(p).attr("x",b=>b.x).attr("y",0).attr("height",()=>f||(s?se.height.proportional:se.height.default)).attr("class",b=>this.model.getColorClassName({classNameTypes:[at.FILL],dataGroupName:b[c],originalClassName:v})).transition().call(b=>this.services.transitions.setupTransition({transition:b,name:"meter-bar-update",animate:t})).attr("width",b=>b.value>u?d(u):Math.max(b.width,2)).style("fill",b=>n.model.getFillColor(b[c],null,b)).attr("role",dt.GRAPHICS_SYMBOL).attr("aria-roledescription","value").attr("aria-label",b=>b.value),p.exit().remove();const m=x(i,"meter","peak");let y=m;m!==null&&(m>u?y=u:m<a[0].value&&(y=a[0].value>u?u:a[0].value));const g=r.selectAll("line.peak").data(y==null?[]:[y]);g.enter().append("line").classed("peak",!0).merge(g).attr("y1",0).attr("y2",()=>f||(s?se.height.proportional:se.height.default)).transition().call(b=>this.services.transitions.setupTransition({transition:b,name:"peak-line-update",animate:t})).attr("x1",b=>d(b)).attr("x2",b=>d(b)).attr("role",dt.GRAPHICS_SYMBOL).attr("aria-roledescription","peak").attr("aria-label",b=>b),g.exit().remove(),this.services.domUtils.setSVGMaxHeight(),this.addEventListeners()}addEventListeners(){const t=this.getOptions(),{groupMapsTo:n}=t.data,r=this,i=x(t,"meter","proportional");this.parent.selectAll("rect.value").on("mouseover",function(s,a){const o=k(this);r.services.events.dispatchEvent(O.Meter.METER_MOUSEOVER,{event:s,element:o,datum:a}),i&&(o.classed("hovered",!0),r.services.events.dispatchEvent(O.Tooltip.SHOW,{event:s,hoveredElement:o,items:[{label:a[n],value:a.value}]}))}).on("mousemove",function(s,a){const o=k(this);r.services.events.dispatchEvent(O.Meter.METER_MOUSEMOVE,{event:s,element:o,datum:a}),i&&r.services.events.dispatchEvent(O.Tooltip.MOVE,{event:s})}).on("click",function(s,a){r.services.events.dispatchEvent(O.Meter.METER_CLICK,{event:s,element:k(this),datum:a})}).on("mouseout",function(s,a){const o=k(this);r.services.events.dispatchEvent(O.Meter.METER_MOUSEOUT,{event:s,element:o,datum:a}),i&&(o.classed("hovered",!1),r.services.events.dispatchEvent(O.Tooltip.HIDE,{hoveredElement:o}))})}destroy(){this.parent.selectAll("rect.value").on("mouseover",null).on("mousemove",null).on("mouseout",null).on("click",null)}}class MN extends xt{constructor(){super(...arguments),this.type="radar",this.renderType=rt.SVG,this.getLabelDimensions=t=>{const n=N.appendOrSelect(this.getComponentContainer(),"g.tmp-tick"),r=N.appendOrSelect(n,"text").text(t),{width:i,height:s}=N.getSVGElementSize(r.node(),{useBBox:!0});return n.remove(),{width:i,height:s}},this.normalizeFlatData=t=>{const n=this.getOptions(),{angle:r,value:i}=x(n,"radar","axes"),s=x(n,"data","groupMapsTo"),a=ck(this.uniqueKeys.map(o=>this.uniqueGroups.map(l=>({[r]:o,[s]:l,[i]:null}))));return lt(a,t)},this.normalizeGroupedData=t=>{const n=this.getOptions(),{angle:r,value:i}=x(n,"radar","axes"),s=x(n,"data","groupMapsTo");return t.map(({name:a,data:o})=>{const l=this.uniqueKeys.map(c=>({[s]:a,[r]:c,[i]:null}));return{name:a,data:lt(l,o)}})},this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail;this.parent.selectAll("g.blobs path").transition("legend-hover-blob").call(r=>this.services.transitions.setupTransition({transition:r,name:"legend-hover-blob"})).style("fill-opacity",r=>r.name!==n.datum().name?Or.opacity.unselected:Or.opacity.selected).style("stroke-opacity",r=>r.name!==n.datum().name?Or.opacity.unselected:1)},this.handleLegendMouseOut=()=>{this.parent.selectAll("g.blobs path").transition("legend-mouseout-blob").call(t=>this.services.transitions.setupTransition({transition:t,name:"legend-mouseout-blob"})).style("fill-opacity",Or.opacity.selected).style("stroke-opacity",1)}}init(){const{events:t}=this.services;t.addEventListener(O.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(O.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t=!0){const n=this.getComponentContainer(),{width:r,height:i}=N.getSVGElementSize(n,{useAttrs:!0}),s=this.model.getData(),a=this.model.getGroupedData(),o=this.getOptions(),l=x(o,"data","groupMapsTo"),c=x(o,"radar","axes","value"),{angle:u,value:d}=x(o,"radar","axes"),{xLabelPadding:h,yLabelPadding:f,yTicksNumber:p,minRange:v,xAxisRectHeight:m}=Or;this.uniqueKeys=Array.from(new Set(s.map(E=>E[u]))),this.uniqueGroups=Array.from(new Set(s.map(E=>E[l]))),this.fullDataNormalized=this.normalizeFlatData(s),this.groupedDataNormalized=this.normalizeGroupedData(a);const y=2*(this.getLabelDimensions(this.uniqueKeys[0]).height+f),g=(Math.min(r,i)-y)/2;if(g<=0)return;const b=Qi().domain(this.fullDataNormalized.map(E=>E[u])).range([0,2*Math.PI].map(E=>E-Math.PI/2)),w=Vn(this.fullDataNormalized.map(E=>E[d])),_=Ze().domain([w>=0?0:w,ar(this.fullDataNormalized.map(E=>E[d]))]).range([v,g]).nice(p),S=_.ticks(p),L=(E,A,$)=>this.model.getFillColor(E,A,$),I=FS().angle(E=>b(E[u])+Math.PI/2).radius(E=>_(E[d])).curve(Ip),D=this.uniqueKeys.map(E=>{const A=this.getLabelDimensions(E).width,$=MR(b(E),g);return A+$}),R={x:ar(D)+h,y:i/2},M=N.appendOrSelect(n,"g.y-axes").attr("role",dt.GROUP).selectAll("path").data(S,E=>E),V=E=>this.uniqueKeys.map(A=>({[u]:A,[d]:E}));M.join(E=>E.append("path").attr("opacity",0).attr("transform",`translate(${R.x}, ${R.y})`).attr("fill","none").call(A=>A.transition().call($=>this.services.transitions.setupTransition({transition:$,name:"radar_y_axes_enter",animate:t})).attr("opacity",1).attr("d",$=>I(V($)))),E=>E.call(A=>A.transition().call($=>this.services.transitions.setupTransition({transition:$,name:"radar_y_axes_update",animate:t})).attr("opacity",1).attr("transform",`translate(${R.x}, ${R.y})`).attr("d",$=>I(V($)))),E=>E.call(A=>A.transition().call($=>this.services.transitions.setupTransition({transition:$,name:"radar_y_axes_exit",animate:t})).attr("d",$=>I(V($))).attr("opacity",0).remove())),N.appendOrSelect(n,"g.x-axes").attr("role",dt.GROUP).selectAll("line").data(this.uniqueKeys,E=>E).join(E=>E.append("line").attr("opacity",0).attr("class",A=>`x-axis-${fi(A)}`).attr("stroke-dasharray","0").attr("x1",A=>Yt(b(A),0,R).x).attr("y1",A=>Yt(b(A),0,R).y).attr("x2",A=>Yt(b(A),0,R).x).attr("y2",A=>Yt(b(A),0,R).y).call(A=>A.transition().call($=>this.services.transitions.setupTransition({transition:$,name:"radar_x_axes_enter",animate:t})).attr("opacity",1).attr("x1",$=>Yt(b($),_.range()[0],R).x).attr("y1",$=>Yt(b($),_.range()[0],R).y).attr("x2",$=>Yt(b($),_.range()[1],R).x).attr("y2",$=>Yt(b($),_.range()[1],R).y)),E=>E.call(A=>A.transition().call($=>this.services.transitions.setupTransition({transition:$,name:"radar_x_axes_update",animate:t})).attr("opacity",1).attr("x1",$=>Yt(b($),_.range()[0],R).x).attr("y1",$=>Yt(b($),_.range()[0],R).y).attr("x2",$=>Yt(b($),_.range()[1],R).x).attr("y2",$=>Yt(b($),_.range()[1],R).y)),E=>E.call(A=>A.transition().call($=>this.services.transitions.setupTransition({transition:$,name:"radar_x_axes_exit",animate:t})).attr("opacity",0).remove())),N.appendOrSelect(n,"g.x-labels").attr("role",dt.GROUP).selectAll("text").data(this.uniqueKeys).join(E=>E.append("text").text(A=>A).attr("opacity",0).attr("x",A=>Yt(b(A),_.range()[1]+h,R).x).attr("y",A=>Yt(b(A),_.range()[1]+h,R).y).style("text-anchor",A=>qg(b(A)).textAnchor).style("dominant-baseline",A=>qg(b(A)).dominantBaseline).call(A=>A.transition().call($=>this.services.transitions.setupTransition({transition:$,name:"radar_x_labels_enter",animate:t})).attr("opacity",1)),E=>E.call(A=>A.transition().call($=>this.services.transitions.setupTransition({transition:$,name:"radar_x_labels_update",animate:t})).attr("opacity",1).attr("x",$=>Yt(b($),_.range()[1]+h,R).x).attr("y",$=>Yt(b($),_.range()[1]+h,R).y).end().finally(()=>{const $=x(o,"radar","alignment"),U=this.getAlignmentXOffset($,n,this.getParent());n.attr("x",U)})),E=>E.call(A=>A.transition().call($=>this.services.transitions.setupTransition({transition:$,name:"radar_x_labels_exit",animate:t})).attr("opacity",0).remove())),N.appendOrSelect(n,"g.blobs").attr("role",dt.GROUP).selectAll("path").data(this.groupedDataNormalized,E=>E.name).join(E=>E.append("path").attr("class",A=>this.model.getColorClassName({classNameTypes:[at.FILL,at.STROKE],dataGroupName:A.name,originalClassName:"blob"})).attr("role",dt.GRAPHICS_SYMBOL).attr("aria-label",A=>A.name).attr("opacity",0).attr("transform",t?()=>`translate(${R.x}, ${R.y}) scale(${1+Math.random()*.35})`:`translate(${R.x}, ${R.y})`).style("fill",A=>L(A.name,null,A.data)).style("fill-opacity",Or.opacity.selected).style("stroke",A=>L(A.name,null,A.data)).call(A=>{const $=A.transition().call(U=>this.services.transitions.setupTransition({transition:U,name:"radar_blobs_enter",animate:t}));t&&$.delay(()=>Math.random()*30).attr("transform",`translate(${R.x}, ${R.y})`),$.attr("opacity",1).attr("d",U=>I(U.data))}),E=>(E.attr("class",A=>this.model.getColorClassName({classNameTypes:[at.FILL,at.STROKE],dataGroupName:A.name,originalClassName:"blob"})).style("fill",A=>L(A.name,null,A.data)).style("stroke",A=>L(A.name,null,A.data)),E.call(A=>A.transition().call($=>this.services.transitions.setupTransition({transition:$,name:"radar_blobs_update",animate:t})).attr("opacity",1).attr("transform",`translate(${R.x}, ${R.y})`).attr("d",$=>I($.data))),E),E=>E.call(A=>{const $=A.transition().call(U=>this.services.transitions.setupTransition({transition:U,name:"radar_blobs_exit",animate:t}));t&&$.delay(()=>Math.random()*30).attr("transform",()=>`translate(${R.x}, ${R.y}) scale(${1+Math.random()*.35})`),$.attr("opacity",0).remove()})),N.appendOrSelect(n,"g.dots").attr("role",dt.GROUP).selectAll("circle").data(this.fullDataNormalized.filter(E=>x(E,d)!==null)).join(E=>E.append("circle").attr("role",dt.GRAPHICS_SYMBOL).attr("aria-label",A=>A[c]),E=>E,E=>E.remove()).attr("class",E=>this.model.getColorClassName({classNameTypes:[at.FILL],dataGroupName:E[l],originalClassName:fi(E[u])})).attr("cx",E=>Yt(b(E[u]),_(E[d]),R).x).attr("cy",E=>Yt(b(E[u]),_(E[d]),R).y).attr("r",0).attr("opacity",0).style("fill",E=>L(E[l])),N.appendOrSelect(n,"g.x-axes-rect").attr("role",dt.GROUP).selectAll("rect").data(this.uniqueKeys).join(E=>E.append("rect"),E=>E,E=>E.remove()).attr("x",R.x).attr("y",R.y-m/2).attr("width",_.range()[1]).attr("height",m).style("fill","red").style("fill-opacity",0).attr("transform",E=>`rotate(${Yg(b(E))}, ${R.x}, ${R.y})`);const{code:P,number:H}=x(o,"locale");N.appendOrSelect(n,"g.y-labels").attr("role",dt.GROUP).selectAll("text").data(We(S)).join(E=>E.append("text").attr("opacity",0).text(A=>H(A,P)).attr("x",A=>Yt(-Math.PI/2,_(A),R).x+f).attr("y",A=>Yt(-Math.PI/2,_(A),R).y).style("text-anchor","start").style("dominant-baseline","middle").call(A=>A.transition().call($=>this.services.transitions.setupTransition({transition:$,name:"radar_y_labels_enter",animate:t})).attr("opacity",1)),E=>E.call(A=>A.transition().call($=>this.services.transitions.setupTransition({transition:$,name:"radar_y_labels_update",animate:t})).text($=>$).attr("opacity",1).attr("x",$=>Yt(-Math.PI/2,_($),R).x+f).attr("y",$=>Yt(-Math.PI/2,_($),R).y)),E=>E.call(A=>A.transition().call($=>this.services.transitions.setupTransition({transition:$,name:"radar_y_labels_exit",animate:t})).attr("opacity",0).remove())),this.addEventListeners()}getAlignmentXOffset(t,n,r){const i=N.getSVGElementSize(n,{useBBox:!0}),{width:s}=N.getSVGElementSize(r,{useAttrs:!0});let a=0;return t===Kt.CENTER?a=Math.floor((s-i.width)/2):t===Kt.RIGHT&&(a=s-i.width),a}destroy(){this.parent.selectAll(".x-axes-rect > rect").on("mouseover",null).on("mousemove",null).on("mouseout",null);const t=this.services.events;t.removeEventListener(O.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(O.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}addEventListeners(){const t=this,{axes:{angle:n}}=x(this.getOptions(),"radar");this.parent.selectAll(".x-axes-rect > rect").on("mouseover",function(r,i){const s=k(this);t.services.events.dispatchEvent(O.Radar.X_AXIS_MOUSEOVER,{event:r,element:s,datum:i});const a=t.parent.select(`.x-axes .x-axis-${fi(i)}`),o=t.parent.selectAll(`.dots circle.${fi(i)}`),l=t.model.getActiveDataGroupNames(),c=t.getOptions(),{groupMapsTo:u}=c.data,d=x(c,"radar","axes","value");a.classed("hovered",!0).attr("stroke-dasharray","4 4"),o.classed("hovered",!0).attr("opacity",f=>l.indexOf(f[u])!==-1?1:0).attr("r",Or.dotsRadius);const h=t.fullDataNormalized.filter(f=>f[n]===i&&l.indexOf(f[u])!==-1);t.services.events.dispatchEvent(O.Tooltip.SHOW,{event:r,hoveredElement:s,items:h.filter(f=>typeof f[d]=="number").map(f=>({label:f[u],value:f[d],color:t.model.getFillColor(f[u],null,f),class:t.model.getColorClassName({classNameTypes:[at.TOOLTIP],dataGroupName:f[u]})}))})}).on("mousemove",function(r,i){const s=k(this);t.services.events.dispatchEvent(O.Radar.X_AXIS_MOUSEMOVE,{event:r,element:s,datum:i}),t.services.events.dispatchEvent(O.Tooltip.MOVE,{event:r})}).on("click",function(r,i){t.services.events.dispatchEvent(O.Radar.X_AXIS_CLICK,{event:r,element:k(this),datum:i})}).on("mouseout",function(r,i){const s=k(this),a=t.parent.select(`.x-axes .x-axis-${fi(i)}`),o=t.parent.selectAll(`.dots circle.${fi(i)}`);a.classed("hovered",!1).attr("stroke-dasharray","0"),o.classed("hovered",!1).attr("opacity",0).attr("r",0),t.services.events.dispatchEvent(O.Radar.X_AXIS_MOUSEOUT,{event:r,element:s,datum:i}),t.services.events.dispatchEvent(O.Tooltip.HIDE)})}}class p0 extends Qu{constructor(){super(...arguments),this.type="simple-bar",this.renderType=rt.SVG,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail,{groupMapsTo:r}=this.getOptions().data;this.parent.selectAll("path.bar").transition("legend-hover-simple-bar").call(i=>this.services.transitions.setupTransition({transition:i,name:"legend-hover-simple-bar"})).attr("opacity",i=>i[r]!==n.datum().name?.3:1)},this.handleLegendMouseOut=()=>{this.parent.selectAll("path.bar").transition("legend-mouseout-simple-bar").call(t=>this.services.transitions.setupTransition({transition:t,name:"legend-mouseout-simple-bar"})).attr("opacity",1)}}init(){const t=this.services.events;t.addEventListener(O.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(O.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t){const n=this.getOptions(),{groupMapsTo:r}=n.data,i=this.getComponentContainer({withinChartClip:!0}),s=this.model.getDisplayData(this.configs.groups),a=this.services.cartesianScales.getOrientation(),o=i.selectAll("path.bar").data(s,l=>l[r]);o.exit().attr("opacity",0).remove(),o.enter().append("path").attr("opacity",0).merge(o).classed("bar",!0).attr("width",this.getBarWidth.bind(this)).transition().call(l=>this.services.transitions.setupTransition({transition:l,name:"bar-update-enter",animate:t})).attr("class",l=>this.model.getColorClassName({classNameTypes:[at.FILL],dataGroupName:l[r],originalClassName:"bar"})).style("fill",l=>{const c=this.services.cartesianScales.getDomainIdentifier(l);return this.model.getFillColor(l[r],l[c],l)}).attr("d",l=>{const c=this.services.cartesianScales.getRangeIdentifier(),u=this.getBarWidth(),d=l[c],h=this.services.cartesianScales.getDomainValue(l)-u/2,f=h+u;let p,v;if(Array.isArray(d)&&d.length===2)p=this.services.cartesianScales.getRangeValue(d[0]),v=this.services.cartesianScales.getRangeValue(d[1]);else{const y=this.services.cartesianScales.getRangeScale().domain()[0];p=this.services.cartesianScales.getRangeValue(Math.max(0,y)),v=this.services.cartesianScales.getRangeValue(l)}const m=Math.abs(v-p);if(m!==0&&m<2&&(d>0&&a===Jt.VERTICAL||d<0&&a===Jt.HORIZONTAL?v=p-2:v=p+2),!this.isOutsideZoomedDomain(h,f))return pe({x0:h,x1:f,y0:p,y1:v},a)}).attr("opacity",1).attr("role",dt.GRAPHICS_SYMBOL).attr("aria-roledescription","bar").attr("aria-label",l=>l.value),this.addEventListeners()}addEventListeners(){const t=this;this.parent.selectAll("path.bar").on("mouseover",function(n,r){const i=k(this);i.classed("hovered",!0),t.services.events.dispatchEvent(O.Bar.BAR_MOUSEOVER,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(O.Tooltip.SHOW,{event:n,hoveredElement:i,data:[r]})}).on("mousemove",function(n,r){t.services.events.dispatchEvent(O.Bar.BAR_MOUSEMOVE,{event:n,element:k(this),datum:r}),t.services.events.dispatchEvent(O.Tooltip.MOVE,{event:n})}).on("click",function(n,r){t.services.events.dispatchEvent(O.Bar.BAR_CLICK,{event:n,element:k(this),datum:r})}).on("mouseout",function(n,r){const i=k(this);i.classed("hovered",!1),t.services.events.dispatchEvent(O.Bar.BAR_MOUSEOUT,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(O.Tooltip.HIDE,{hoveredElement:i})})}destroy(){this.parent.selectAll("path.bar").on("mouseover",null).on("mousemove",null).on("mouseout",null);const t=this.services.events;t.removeEventListener(O.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(O.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}}class CN extends ge{constructor(){super(...arguments),this.type="skeleton-lines"}render(t=!0){const n=x(this.getOptions(),"data","loading"),r=!x(this.getOptions(),"grid","x","enabled")&&!x(this.getOptions(),"grid","y","enabled")&&!x(this.getOptions(),"axes","bottom","visible")&&!x(this.getOptions(),"axes","left","visible");n&&!r?super.renderGridSkeleton(n):n&&r?this.renderSparklineSkeleton(n):this.removeSkeleton()}renderSparklineSkeleton(t){this.setScales(),this.drawBackdrop(t),this.drawSparkline(t),this.updateBackdropStyle(),t&&this.setShimmerEffect("shimmer-lines")}drawSparkline(t){const n=this.backdrop.attr("width"),r=[100],i=N.appendOrSelect(this.backdrop,"g.y.skeleton"),s=i.selectAll("line").data(r);s.enter().append("line").merge(s).attr("x1",0).attr("x2",n).attr("y1",a=>a).attr("y2",a=>a),i.selectAll("line").classed("shimmer-effect-lines",t).classed("empty-state-lines",!t).style("stroke",t?`url(#${this.services.domUtils.generateElementIDString("shimmer-lines")})`:null)}updateBackdropStyle(){const t=this.parent;this.backdrop=N.appendOrSelect(t,"svg.chart-skeleton.DAII"),N.appendOrSelect(this.backdrop,"rect.chart-skeleton-backdrop").classed("shimmer-effect-lines",!1).classed("shimmer-effect-sparkline",!0).style("stroke",null)}}class m0 extends xt{constructor(){super(...arguments),this.type="area-stacked",this.renderType=rt.SVG,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail,r=this.getOptions(),{groupMapsTo:i}=r.data;this.parent.selectAll("path.area").transition("legend-hover-area").call(s=>this.services.transitions.setupTransition({transition:s,name:"legend-hover-area"})).attr("opacity",s=>x(s,0,i)!==n.datum().name?Rn.opacity.unselected:Rn.opacity.selected)},this.handleLegendMouseOut=()=>{this.parent.selectAll("path.area").transition("legend-mouseout-area").call(t=>this.services.transitions.setupTransition({transition:t,name:"legend-mouseout-area"})).attr("opacity",Rn.opacity.selected)}}init(){const t=this.services.events;t.addEventListener(O.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(O.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t=!0){const n=this.getComponentContainer({withinChartClip:!0}),r=this,i=this.getOptions(),{groupMapsTo:s}=i.data,a=Object.keys(i.axes).some(f=>i.axes[f].percentage),o=this.model.getStackedData({percentage:a,groups:this.configs.groups}),l=x(o,0,0),c=this.services.cartesianScales.getDomainAxisPosition({datum:l}),u=this.services.cartesianScales.getRangeAxisPosition({datum:l}),d=this.services.cartesianScales.getScaleByPosition(u),h=n.selectAll("path.area").data(o,f=>x(f,0,s));this.areaGenerator=Cc().x(f=>this.services.cartesianScales.getValueThroughAxisPosition(c,f.data.sharedStackKey)).y0(f=>d(f[0])).y1(f=>d(f[1])).curve(this.services.curves.getD3Curve()),h.exit().attr("opacity",0).remove(),h.enter().append("path").attr("opacity",0).merge(h).data(o,f=>x(f,0,s)).attr("class","area").attr("class",f=>this.model.getColorClassName({classNameTypes:[at.FILL],dataGroupName:x(f,0,s),originalClassName:"area"})).style("fill",f=>r.model.getFillColor(x(f,0,s),null,f)).attr("role",dt.GRAPHICS_SYMBOL).attr("aria-roledescription","area").attr("aria-label",f=>x(f,0,s)).transition().call(f=>this.services.transitions.setupTransition({transition:f,name:"area-update-enter",animate:t})).attr("opacity",Rn.opacity.selected).attr("d",this.areaGenerator)}}class g0 extends Qu{constructor(){super(...arguments),this.type="stacked-bar",this.renderType=rt.SVG,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail,{groupMapsTo:r}=this.model.getOptions().data;this.parent.selectAll("path.bar").transition("legend-hover-bar").call(i=>this.services.transitions.setupTransition({transition:i,name:"legend-hover-bar"})).attr("opacity",i=>i[r]!==n.datum().name?.3:1)},this.handleLegendMouseOut=()=>{this.parent.selectAll("path.bar").transition("legend-mouseout-bar").call(t=>this.services.transitions.setupTransition({transition:t,name:"legend-mouseout-bar"})).attr("opacity",1)}}init(){const t=this.services.events;t.addEventListener(O.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(O.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t){const n=this.getComponentContainer({withinChartClip:!0}),r=this.getOptions(),{groupMapsTo:i}=r.data,s=this.model.getStackedData({groups:this.configs.groups,divergent:!0}),a=this.model.getActiveDataGroupNames(),o=n.selectAll("g.bars").data(s,c=>x(c,0,i));o.exit().attr("opacity",0).remove(),o.enter().append("g").classed("bars",!0).attr("role",dt.GROUP).attr("data-name","bars");const l=n.selectAll("g.bars").selectAll("path.bar").data(c=>c,c=>c.data.sharedStackKey);l.exit().remove(),l.enter().append("path").merge(l).classed("bar",!0).transition().call(c=>this.services.transitions.setupTransition({transition:c,name:"bar-update-enter",animate:t})).attr("class",c=>this.model.getColorClassName({classNameTypes:[at.FILL],dataGroupName:c[i],originalClassName:"bar"})).style("fill",c=>this.model.getFillColor(c[i],c.data.sharedStackKey,c.data)).attr("d",c=>{const u=c.data.sharedStackKey,d=this.getBarWidth(),h=this.services.cartesianScales.getDomainValue(u)-d/2,f=h+d,p=this.services.cartesianScales.getRangeValue(c[0]);let v=this.services.cartesianScales.getRangeValue(c[1]);if(!this.isOutsideZoomedDomain(h,f)){if(Math.abs(v-p)>0&&Math.abs(v-p)>r.bars.dividerSize){const m=c[0]<0&&c[1]<=0;m&&a.length>1?this.services.cartesianScales.getOrientation()===Jt.VERTICAL?v+=c[1]===0?2:1:v-=1:m||(this.services.cartesianScales.getOrientation()===Jt.VERTICAL?v+=1:v-=1)}return pe({x0:h,x1:f,y0:p,y1:v},this.services.cartesianScales.getOrientation())}}).attr("opacity",1).attr("role",dt.GRAPHICS_SYMBOL).attr("aria-roledescription","bar").attr("aria-label",c=>c[1]-c[0]),this.addEventListeners()}addEventListeners(){const t=this.getOptions(),{groupMapsTo:n}=t.data,r=this;this.parent.selectAll("path.bar").on("mouseover",function(i,s){const a=k(this);a.classed("hovered",!0),r.services.events.dispatchEvent(O.Bar.BAR_MOUSEOVER,{event:i,element:a,datum:s});let o=r.model.getDisplayData(r.configs.groups).find(l=>{const c=r.services.cartesianScales.getDomainIdentifier(l),u=r.services.cartesianScales.getRangeIdentifier(l);return l[u]===s.data[s[n]]&&l[c].toString()===s.data.sharedStackKey&&l[n]===s[n]});if(o===void 0){const l=r.services.cartesianScales.getDomainIdentifier(),c=r.services.cartesianScales.getRangeIdentifier();o={[l]:s.data.sharedStackKey,[c]:s.data[s[n]],[n]:s[n]}}r.services.events.dispatchEvent(O.Tooltip.SHOW,{event:i,hoveredElement:a,data:[o]})}).on("mousemove",function(i,s){const a=k(this);r.services.events.dispatchEvent(O.Bar.BAR_MOUSEMOVE,{event:i,element:a,datum:s}),r.services.events.dispatchEvent(O.Tooltip.MOVE,{event:i})}).on("click",function(i,s){r.services.events.dispatchEvent(O.Bar.BAR_CLICK,{event:i,element:k(this),datum:s})}).on("mouseout",function(i,s){const a=k(this);a.classed("hovered",!1),r.services.events.dispatchEvent(O.Bar.BAR_MOUSEOUT,{event:i,element:a,datum:s}),r.services.events.dispatchEvent(O.Tooltip.HIDE,{hoveredElement:a})})}getBarWidth(){const t=this.getOptions();if(x(t,"bars","width"))return t.bars.width;const n=this.services.cartesianScales.getMainXScale(),r=N.getSVGElementSize(this.parent,{useAttrs:!0}).width,i=this.model.getStackKeys().length,s=x(t,"bars","spacingFactor");return n.step?Math.min(t.bars.maxWidth,n.step()/2):Math.min(t.bars.maxWidth,r*s/i)}destroy(){this.parent.selectAll("path.bar").on("mouseover",null).on("mousemove",null).on("mouseout",null);const t=this.services.events;t.removeEventListener(O.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(O.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}}class v0 extends mn{constructor(){super(...arguments),this.type="scatter-stacked",this.renderType=rt.SVG}render(t){if(!x(this.getOptions(),"points","enabled"))return;const n=this.getComponentContainer({withinChartClip:!0}),r=this.getOptions(),{groupMapsTo:i}=r.data,s=Object.keys(r.axes).some(u=>r.axes[u].percentage),a=this.model.getStackedData({groups:this.configs.groups,percentage:s}),o=n.selectAll("g.dots").data(a,u=>x(u,0,i));o.exit().attr("opacity",0).remove();const l=o.enter().append("g").classed("dots",!0).attr("role",dt.GROUP).merge(o).selectAll("circle.dot").data(u=>u);l.exit().attr("opacity",0).remove();const c=l.enter().append("circle").classed("dot",!0).attr("opacity",0).merge(l).datum(u=>{const d=u[i],h=this.services.cartesianScales.getDomainIdentifier(u),f=this.services.cartesianScales.getRangeIdentifier(u);return{[i]:d,[h]:u.data.sharedStackKey,[f]:u[1]}});this.styleCircles(c,t),this.addEventListeners()}getTooltipData(t,n){const r=this.getOptions(),{groupMapsTo:i}=r.data,s=Object.keys(r.axes).some(l=>r.axes[l].percentage),a=this.model.getStackedData({groups:this.configs.groups,percentage:s}),o=[];return a.forEach((l,c)=>{l.forEach((u,d)=>{const h=u[i],f=u.data.sharedStackKey;let p=u.data[h];const v=u[1],m=this.services.cartesianScales.getDomainIdentifier(u),y=this.services.cartesianScales.getRangeIdentifier(u);p!=null&&t===this.services.cartesianScales.getDomainValue(f)&&n===this.services.cartesianScales.getRangeValue(v)&&(s&&(p=this.model.getStackedData({groups:this.configs.groups})[c][d].data[h]),p!==null&&o.push({[i]:h,[m]:f,[y]:p}))})}),this.model.getDisplayData(this.configs.groups).filter(l=>{const c=this.services.cartesianScales.getDomainIdentifier(l),u=this.services.cartesianScales.getRangeIdentifier(l);return o.find(d=>d[i]==l[i]&&d[c]==l[c]&&d[u]==l[u])!==void 0})}}const yi=6;class AN extends xt{constructor(){super(...arguments),this.type="tree",this.renderType=rt.SVG}getLongestLabel(t){let n="";return t.forEach(r=>{const i=r.children?this.getLongestLabel(r.children):"";(i.length>n.length||r.name.length>n.length)&&(n=i.length>r.name.length?i:r.name)}),n}getMockLabelWidth(t,n){const r=t.append("text").attr("dy","0.31em").attr("x",0).attr("text-anchor","end").text(n),{width:i}=N.getSVGElementSize(r.node(),{useBBox:!0});return r.remove(),i}render(t=!0){const n=this.getComponentContainer();n.html("");const{width:r,height:i}=N.getSVGElementSize(this.parent,{useAttrs:!0});if(r<1||i<1)return;const s=this.model.getOptions(),a=this.model.getDisplayData(),o=x(s,"tree","rootTitle")||"Tree",l=this.getMockLabelWidth(n,o),c=this.getLongestLabel(a),u=this.getMockLabelWidth(n,c),d={top:0,right:0,bottom:0,left:l>0?l+yi:30-yi},h=Xi({name:o,children:a}),f=10,p=r/6,v=S=>{const L=h.descendants().reverse(),I=h.links();let D=h,R=h;h.eachBefore(U=>{U.x<D.x&&(D=U),U.x>R.x&&(R=U)});const M=R.x-D.x,V=n.transition().call(U=>this.services.transitions.setupTransition({transition:U,name:"tree-update-viewbox",animate:!0})).attr("viewBox",[-d.left,D.x,r,M].join(" ")),P=_.selectAll("g").data(L,U=>U.id),H=this,E=P.enter().append("g").attr("transform",()=>`translate(${S.y0},${S.x0})`).attr("class",U=>U.depth!==0&&U.children&&U.children.length>0?"clickable":null).on("mouseover",function(U,B){H.services.events.dispatchEvent(O.Tree.NODE_MOUSEOVER,{event:U,element:k(this),datum:B})}).on("click",function(U,B){B.depth!==0&&(B.children=B.children?null:B._children,v(B)),H.services.events.dispatchEvent(O.Tree.NODE_CLICK,{event:U,element:k(this),datum:B})}).on("mouseout",function(U,B){H.services.events.dispatchEvent(O.Tree.NODE_MOUSEOUT,{event:U,element:k(this),datum:B})});E.append("circle").attr("r",2.5).attr("class",U=>U._children?"parent":"child").attr("stroke-width",10),E.append("text").attr("dy","0.31em").attr("x",U=>U._children?-yi:yi).attr("text-anchor",U=>U._children?"end":"start").text(U=>U.data.name).clone(!0).attr("class","text-stroke").lower(),P.merge(E).transition(V).attr("transform",U=>`translate(${U.y},${U.x})`).attr("fill-opacity",1).attr("stroke-opacity",1),P.exit().transition(V).remove().attr("transform",()=>`translate(${S.y},${S.x})`).attr("fill-opacity",0).attr("stroke-opacity",0);const A=w.selectAll("path").data(I,U=>U.target.id),$=A.enter().append("path").attr("d",()=>{const U={x:S.x0,y:S.y0};return b({source:U,target:U})});A.merge($).transition(V).attr("d",b),A.exit().transition(V).remove().attr("d",()=>{const U={x:S.x,y:S.y};return b({source:U,target:U})}),h.eachBefore(U=>{U.x0=U.x,U.y0=U.y})},m=h.descendants(),y=m[m.length-1].depth,g=x(s,"tree","type")===Jo.DENDROGRAM?c_().size([i,r-u-y*yi-l]):Z_().nodeSize([f,p]).size([i,r-u-y*yi-l]),b=YS().x(S=>S.y).y(S=>S.x);h.x0=p/2,h.y0=0,h.descendants().forEach((S,L)=>{S.id=L,S._children=S.children}),g(h),n.attr("viewBox",[-d.left,-d.top,r,f]).style("user-select","none");const w=n.append("g").attr("class","links"),_=n.append("g").attr("class","nodes");v(h)}}var $N="#000000",LN="#ffffff",RN="#fcf4d6",DN="#fddc69",kN="#f1c21b",IN="#d2a106",NN="#b28600",PN="#8e6a00",UN="#684e00",BN="#483700",HN="#302400",VN="#1c1500",FN={10:RN,20:DN,30:kN,40:IN,50:NN,60:PN,70:UN,80:BN,90:HN,100:VN},zN="#fff2e8",GN="#ffd9be",jN="#ffb784",WN="#ff832b",qN="#eb6200",YN="#ba4e00",XN="#8a3800",ZN="#5e2900",KN="#3e1a00",QN="#231000",JN={10:zN,20:GN,30:jN,40:WN,50:qN,60:YN,70:XN,80:ZN,90:KN,100:QN},tP="#fff1f1",eP="#ffd7d9",nP="#ffb3b8",rP="#ff8389",iP="#fa4d56",sP="#da1e28",aP="#a2191f",oP="#750e13",lP="#520408",cP="#2d0709",uP={10:tP,20:eP,30:nP,40:rP,50:iP,60:sP,70:aP,80:oP,90:lP,100:cP},hP="#fff0f7",dP="#ffd6e8",fP="#ffafd2",pP="#ff7eb6",mP="#ee5396",gP="#d02670",vP="#9f1853",yP="#740937",xP="#510224",bP="#2a0a18",EP={10:hP,20:dP,30:fP,40:pP,50:mP,60:gP,70:vP,80:yP,90:xP,100:bP},_P="#f6f2ff",wP="#e8daff",SP="#d4bbff",OP="#be95ff",TP="#a56eff",MP="#8a3ffc",CP="#6929c4",AP="#491d8b",$P="#31135e",LP="#1c0f30",RP={10:_P,20:wP,30:SP,40:OP,50:TP,60:MP,70:CP,80:AP,90:$P,100:LP},DP="#edf5ff",kP="#d0e2ff",IP="#a6c8ff",NP="#78a9ff",PP="#4589ff",UP="#0f62fe",BP="#0043ce",HP="#002d9c",VP="#001d6c",FP="#001141",zP={10:DP,20:kP,30:IP,40:NP,50:PP,60:UP,70:BP,80:HP,90:VP,100:FP},GP="#e5f6ff",jP="#bae6ff",WP="#82cfff",qP="#33b1ff",YP="#1192e8",XP="#0072c3",ZP="#00539a",KP="#003a6d",QP="#012749",JP="#061727",tU={10:GP,20:jP,30:WP,40:qP,50:YP,60:XP,70:ZP,80:KP,90:QP,100:JP},eU="#d9fbfb",nU="#9ef0f0",rU="#3ddbd9",iU="#08bdba",sU="#009d9a",aU="#007d79",oU="#005d5d",lU="#004144",cU="#022b30",uU="#081a1c",hU={10:eU,20:nU,30:rU,40:iU,50:sU,60:aU,70:oU,80:lU,90:cU,100:uU},dU="#defbe6",fU="#a7f0ba",pU="#6fdc8c",mU="#42be65",gU="#24a148",vU="#198038",yU="#0e6027",xU="#044317",bU="#022d0d",EU="#071908",_U={10:dU,20:fU,30:pU,40:mU,50:gU,60:vU,70:yU,80:xU,90:bU,100:EU},wU="#f2f4f8",SU="#dde1e6",OU="#c1c7cd",TU="#a2a9b0",MU="#878d96",CU="#697077",AU="#4d5358",$U="#343a3f",LU="#21272a",RU="#121619",DU={10:wU,20:SU,30:OU,40:TU,50:MU,60:CU,70:AU,80:$U,90:LU,100:RU},kU="#f4f4f4",IU="#e0e0e0",NU="#c6c6c6",PU="#a8a8a8",UU="#8d8d8d",BU="#6f6f6f",HU="#525252",VU="#393939",FU="#262626",zU="#161616",GU={10:kU,20:IU,30:NU,40:PU,50:UU,60:BU,70:HU,80:VU,90:FU,100:zU},jU="#f7f3f2",WU="#e5e0df",qU="#cac5c4",YU="#ada8a8",XU="#8f8b8b",ZU="#726e6e",KU="#565151",QU="#3c3838",JU="#272525",tB="#171414",eB={10:jU,20:WU,30:qU,40:YU,50:XU,60:ZU,70:KU,80:QU,90:JU,100:tB},y0={black:{100:$N},blue:zP,coolGray:DU,cyan:tU,gray:GU,green:_U,magenta:EP,orange:JN,purple:RP,red:uP,teal:hU,warmGray:eB,white:{0:LN},yellow:FN};const nB=e=>{if(!e)return null;for(const t of Object.keys(y0)){const n=y0[t];for(const r of Object.keys(n))if(n[+r]===e)return r}return null},x0=function(){const e=k(this.parentNode).select("rect.leaf"),t=getComputedStyle(e.node(),null).getPropertyValue("fill"),n=xn(t);let r;if(n&&(r=nB(n?n.hex():null)),r==null){const i=vl(n).l;r=Math.abs(i*100-100)}return r>50?"white":"black"};let rB=0;class iB extends xt{constructor(){super(...arguments),this.type="treemap",this.renderType=rt.SVG,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail;this.parent.selectAll("g[data-name='leaf']").transition("legend-hover-treemap").call(r=>this.services.transitions.setupTransition({transition:r,name:"legend-hover-treemap"})).attr("opacity",r=>r.parent.data.name===n.datum().name?1:.3)},this.handleLegendMouseOut=()=>{this.parent.selectAll("g[data-name='leaf']").transition("legend-mouseout-treemap").call(t=>this.services.transitions.setupTransition({transition:t,name:"legend-mouseout-treemap"})).attr("opacity",1)}}init(){const{events:t}=this.services;t.addEventListener(O.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(O.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t=!0){const n=this.getComponentContainer();this.model.getData();const r=this.model.getDisplayData(),i=this.model.getOptions(),s=x(window,"location"),{width:a,height:o}=N.getSVGElementSize(n,{useAttrs:!0}),l=Xi({name:i.title||"Treemap",children:r}).sum(f=>f.value).sort((f,p)=>p.value-f.value),c=ew().size([a,o]).paddingInner(1).paddingOuter(0).round(!0)(l),u=n.selectAll("g[data-name='leaf']").data(c.leaves(),f=>f.data.name);u.exit().attr("opacity",0).remove();const d=u.enter().append("g").attr("data-name","leaf").attr("data-uid",()=>rB++).merge(u);d.attr("data-name","leaf").transition().call(f=>this.services.transitions.setupTransition({transition:f,name:"treemap-group-update",animate:t})).attr("transform",f=>`translate(${f.x0},${f.y0})`);const h=d.selectAll("rect.leaf").data(f=>[f]);h.exit().attr("width",0).attr("height",0).remove(),h.enter().append("rect").classed("leaf",!0).merge(h).attr("width",0).attr("height",0).attr("id",function(){const f=k(this.parentNode).attr("data-uid");return`${i.style.prefix}-leaf-${f}`}).attr("class",f=>{for(;f.depth>1;)f=f.parent;return this.model.getColorClassName({classNameTypes:[at.FILL],dataGroupName:f.data.name,originalClassName:"leaf"})}).transition().call(f=>this.services.transitions.setupTransition({transition:f,name:"treemap-leaf-update-enter",animate:t})).attr("width",f=>f.x1-f.x0).attr("height",f=>f.y1-f.y0).style("fill",f=>{for(;f.depth>1;)f=f.parent;return this.model.getFillColor(f.data.name,null,f.data)}),d.selectAll("clipPath").data(f=>f.data.showLabel!==!0?[]:[1],f=>f).join(f=>f.append("clipPath").attr("id",function(){const p=k(this.parentNode).attr("data-uid");return`${i.style.prefix}-clip-${p}`}).append("use").attr("xlink:href",function(){const p=k(this.parentNode.parentNode).attr("data-uid"),v=`${i.style.prefix}-leaf-${p}`;return new URL(`#${v}`,s)+""}),f=>null,f=>f.remove()),d.selectAll("text").data(f=>{if(f.data.showLabel!==!0)return[];let p=f;for(;p.depth>1;)p=p.parent;const v=vl(this.model.getFillColor(p.data.name));return[{text:f.data.name,color:v.l<.5?"white":"black"}]},f=>f).join(f=>{const p=f.append("text").text(v=>v.text).style("fill",x0).attr("x",7).attr("y",18);return s&&p.attr("clip-path",function(){const v=k(this.parentNode).attr("data-uid"),m=`${i.style.prefix}-clip-${v}`;return`url(${new URL(`#${m}`,s)+""})`}),p},f=>f.text(p=>p.text).style("fill",x0),f=>f.remove()),this.addEventListeners()}addEventListeners(){const t=this;this.parent.selectAll("rect.leaf").on("mouseover",function(n,r){const i=k(this);let s=getComputedStyle(this,null).getPropertyValue("fill"),a=r;for(;a.depth>1;)a=a.parent;i.transition("graph_element_mouseover_fill_update").call(o=>t.services.transitions.setupTransition({transition:o,name:"graph_element_mouseover_fill_update"})).style("fill",o=>{const l=t.model.getFillColor(o.parent.data.name,null,o.data);return l&&(s=l),xn(s).darker(.7).toString()}),t.services.events.dispatchEvent(O.Tooltip.SHOW,{event:n,hoveredElement:i,items:[{color:s,label:a.data.name,bold:!0},{label:r.data.name,value:r.data.value}]}),t.services.events.dispatchEvent(O.Treemap.LEAF_MOUSEOVER,{event:n,element:i,datum:r})}).on("mousemove",function(n,r){const i=k(this);t.services.events.dispatchEvent(O.Treemap.LEAF_MOUSEMOVE,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(O.Tooltip.MOVE,{event:n})}).on("click",function(n,r){t.services.events.dispatchEvent(O.Treemap.LEAF_CLICK,{event:n,element:k(this),datum:r})}).on("mouseout",function(n,r){const i=k(this);i.classed("hovered",!1);let s=r;for(;s.depth>1;)s=s.parent;i.transition().call(a=>t.services.transitions.setupTransition({transition:a,name:"graph_element_mouseout_fill_update"})).style("fill",a=>t.model.getFillColor(a.parent.data.name,null,a.data)),t.services.events.dispatchEvent(O.Treemap.LEAF_MOUSEOUT,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(O.Tooltip.HIDE,{hoveredElement:i})})}}class sB extends xt{constructor(){super(...arguments),this.type="wordcloud",this.renderType=rt.SVG,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail,{groupMapsTo:r}=this.getOptions().data;this.parent.selectAll("text.word").transition("legend-hover-wordcloud").call(i=>this.services.transitions.setupTransition({transition:i,name:"legend-hover-wordcloud"})).attr("opacity",i=>i[r]!==n.datum().name?.3:1)},this.handleLegendMouseOut=()=>{this.parent.selectAll("text.word").transition("legend-mouseout-wordcloud").call(t=>this.services.transitions.setupTransition({transition:t,name:"legend-mouseout-wordcloud"})).attr("opacity",1)}}init(){const t=this.services.events;t.addEventListener(O.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(O.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t=!0){const n=this,r=this.getComponentContainer().attr("width","100%").attr("height","100%"),i=this.model.getDisplayData(),s=this.getFontSizeScale(i),a=this.getOptions(),{fontSizeMapsTo:o,wordMapsTo:l}=a.wordCloud,{groupMapsTo:c}=a.data,{width:u,height:d}=N.getSVGElementSize(r,{useAttrs:!0});if(u===0||d===0)return;const h=dD().size([u,d]).words(i.map(function(p){const v=p[o];if(typeof p[o]!="number")throw Error("Badly formatted WordCloud data. `value` should only be an integer or float");return{[c]:p[c],text:p[l],size:v,value:v}})).padding(5).rotate(0).fontSize(p=>s(p.size)).on("end",f);h.start();function f(p){const v=N.appendOrSelect(r,"g.words");v.attr("transform",`translate(${h.size()[0]/2}, ${h.size()[1]/2})`);const m=v.selectAll("text").data(p,y=>`${y[c]}-${y.text}`);m.exit().attr("opacity",0).remove(),m.enter().append("text").attr("opacity",0).merge(m).style("font-size",y=>`${y.size}px`).text(function(y){return y.text}).attr("class",y=>n.model.getColorClassName({classNameTypes:[at.FILL],dataGroupName:y[c],originalClassName:`word ${y.size>32?"light":""}`})).style("fill",y=>n.model.getFillColor(y[c],y.text,y)).attr("text-anchor","middle").transition().call(y=>n.services.transitions.setupTransition({transition:y,name:"wordcloud-text-update-enter",animate:t})).attr("transform",y=>`translate(${y.x}, ${y.y})`).attr("opacity",1)}this.addEventListeners()}getFontSizeScale(t){const n=this.getOptions(),{fontSizeMapsTo:r}=n.wordCloud,i=t.map(l=>l[r]).filter(l=>l),s=N.getHTMLElementSize(this.services.domUtils.getMainContainer()),a=i.length>0,o=a?We(i):[1,1];return Ze().domain(o).range(a?n.wordCloud.fontSizeRange(s,t):[4,4])}addEventListeners(){const t=this.getOptions(),{groupMapsTo:n}=t.data,r=this,i=wo(s=>{const a=r.parent.selectAll("text.word").transition("wordcloud-word-mouse-highlight").call(o=>r.services.transitions.setupTransition({transition:o,name:"wordcloud-word-mouse-highlight"}));s===null?a.attr("opacity",1):a.attr("opacity",function(){return s===this?1:.3})},6);this.parent.selectAll("text.word").on("mouseover",function(s,a){const o=this;i(o),r.services.events.dispatchEvent(O.WordCloud.WORD_MOUSEOVER,{event:s,element:k(this),datum:a}),r.services.events.dispatchEvent(O.Tooltip.SHOW,{event:s,hoveredElement:o,items:[{label:t.tooltip.wordLabel,value:a.text},{label:t.tooltip.valueLabel,value:a.value},{label:_t(t,"locale.translations.group")||_t(t,"tooltip.groupLabel")||"Group",value:a[n],class:r.model.getColorClassName({classNameTypes:[at.TOOLTIP],dataGroupName:a[n]})}]})}).on("mousemove",function(s,a){const o=k(this);r.services.events.dispatchEvent(O.WordCloud.WORD_MOUSEMOVE,{element:o,datum:a}),r.services.events.dispatchEvent(O.Tooltip.MOVE,{event:s})}).on("click",function(s,a){r.services.events.dispatchEvent(O.WordCloud.WORD_CLICK,{event:s,element:k(this),datum:a})}).on("mouseout",function(s,a){const o=k(this);i(null),r.services.events.dispatchEvent(O.WordCloud.WORD_MOUSEOUT,{event:s,element:o,datum:a}),r.services.events.dispatchEvent(O.Tooltip.HIDE,{hoveredElement:o})})}}class aB extends xt{constructor(){super(...arguments),this.type="geo",this.renderType=rt.SVG}render(){const t=this.getComponentContainer({withinChartClip:!0}),{width:n,height:r}=N.getSVGElementSize(t,{useAttrs:!0});if(n<1||r<1)return;const i=this.getProjection(),s=x(this.getOptions(),"geoData"),a=this.model.getCombinedData(),o={},l={};Object.keys(a).forEach(m=>{typeof a[m].value=="number"?o[m]=a[m]:l[m]=a[m]});const c=lN(s,Object.values(l)),u=sN(s,{type:"GeometryCollection",geometries:Object.values(o)}),d=i.fitSize([n,r],u),h=IE().projection(d);N.appendOrSelect(t,"g.geo").selectAll("path").data(u.features).join("path").attr("d",h);const f=this.services.domUtils.generateElementIDString("geo-pattern-stripes"),p=N.appendOrSelect(t,"defs");N.appendOrSelect(p,"pattern").attr("id",f).attr("width",5).attr("height",10).attr("patternUnits","userSpaceOnUse").attr("patternTransform","rotate(45)").append("path").classed("pattern-fill",!0).attr("d",ss()([[0,0],[0,10]]));const v=N.appendOrSelect(t,"g.missing-data");N.appendOrSelect(v,"path").datum(c).attr("d",h).style("fill",`url(#${f})`)}getProjection(){let t=null;switch(x(this.getOptions(),"thematic","projection")){case yn.geoEqualEarth:t=t_();break;case yn.geoAlbers:t=qE();break;case yn.geoConicEqualArea:t=Nf();break;case yn.geoConicEquidistant:t=QE();break;case yn.geoEquirectangular:t=ZE();break;case yn.geoMercator:t=YE();break;case yn.geoNaturalEarth1:t=e_();break;default:throw new Error("Projection is not supported.")}return t}}class oB extends aB{constructor(){super(...arguments),this.type="choropleth"}render(t=!0){super.render();const n=this.model.getCombinedData();this.getComponentContainer({withinChartClip:!0}).select("g.geo").selectAll("path").classed("border",!0).attr("class",r=>this.model.getColorClassName({value:n[r.properties.NAME].value,originalClassName:"border"})),this.addCountryAreaEventListener()}addCountryAreaEventListener(){const t=this,n=this.model.getCombinedData();this.parent.selectAll("path.border").on("mouseover",function(r,i){const s=k(this);t.services.events.dispatchEvent(kr.CHOROPLETH_MOUSEOVER,{event:r,element:s,datum:n[i.properties.NAME]}),t.services.events.dispatchEvent(_i.SHOW,{event:r,hoveredElement:s,items:[{label:i.properties.NAME,value:n[i.properties.NAME].value}]})}).on("mousemove",function(r,i){t.services.events.dispatchEvent(kr.CHOROPLETH_MOUSEMOVE,{event:r,element:k(this),datum:n[i.properties.NAME]}),t.services.events.dispatchEvent(_i.MOVE,{event:r})}).on("click",function(r,i){t.services.events.dispatchEvent(kr.CHOROPLETH_CLICK,{event:r,element:k(this),datum:n[i.properties.NAME]})}).on("mouseout",function(r,i){const s=k(this);t.services.events.dispatchEvent(kr.CHOROPLETH_MOUSEOUT,{event:r,element:s,datum:n[i.properties.NAME]}),t.services.events.dispatchEvent(_i.HIDE,{event:r,hoveredElement:s})})}}function b0(e){var t=e==null?0:e.length;return t?fo(e,1):[]}class lB extends Pn{zoomIn(t,n,r){let i,s,a;const o=r||oi;t&&(i=t.x,s=t.y,a=2);const{width:l,height:c}=N.getSVGElementSize(this.services.domUtils.getHolder(),{useClientDimensions:!0});n.transition().duration(o.duration).ease(o.ease).attr("transform",`translate(${l/2}, ${c/2}) scale(${a}) translate(${-i},${-s})`),this.services.events.dispatchEvent(O.CanvasZoom.CANVAS_ZOOM_IN,{element:k(t)})}zoomOut(t,n){const r=n||oi;t.transition().duration(r.duration).ease(r.ease).attr("transform",""),this.services.events.dispatchEvent(O.CanvasZoom.CANVAS_ZOOM_OUT)}}class cB extends Pn{init(){this.documentFragment=document.createDocumentFragment()}addEventListener(t,n){this.documentFragment.addEventListener(t,n)}removeEventListener(t,n){this.documentFragment.removeEventListener(t,n)}dispatchEvent(t,n){let r;n?r=new CustomEvent(t,{detail:n}):(r=document.createEvent("Event"),r.initEvent(t,!1,!0)),this.documentFragment.dispatchEvent(r)}}class uB extends Pn{constructor(t,n){super(t,n)}downloadCSV(t,n){const r=document.createElement("a"),i="text/csv;encoding:utf-8";if(navigator.msSaveBlob)navigator.msSaveBlob(new Blob([t],{type:i}),n);else if(URL&&"download"in r){const s=URL.createObjectURL(new Blob([t],{type:i}));r.href=s,r.setAttribute("download",n),document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(s)}else location.href=`data:application/octet-stream,${encodeURIComponent(t)}`}downloadImage(t,n){const r=document.createElement("a");r.download=n,r.href=t,document.body.appendChild(r),r.click(),document.body.removeChild(r)}}class hB extends Pn{constructor(){super(...arguments),this.pendingTransitions={}}init(){var t;(t=this.services.events)==null||t.addEventListener(O.Model.UPDATE,()=>{this.pendingTransitions={}})}setupTransition({transition:t,name:n,animate:r}){return this.pendingTransitions[t._id]=t,t.on("end interrupt cancel",()=>{delete this.pendingTransitions[t._id]}),this.model.getOptions().animations===!1||r===!1?t.duration(0):t.duration(x(rg,n,"duration")||rg.default.duration)}getPendingTransitions(){return this.pendingTransitions}}function Ls(e,t){const n=Ot(e),r=Ot(t),i=n.getTime()-r.getTime();return i<0?-1:i>0?1:i}function dB(e,t){const n=Ot(e),r=Ot(t);return n.getFullYear()-r.getFullYear()}function fB(e,t){const n=Ot(e),r=Ot(t),i=Ls(n,r),s=Math.abs(dB(n,r));n.setFullYear(1584),r.setFullYear(1584);const a=Ls(n,r)===-i,o=i*(s-+a);return o===0?0:o}function Ju(e,t){const n=Ot(e);if(isNaN(t))return en(e,NaN);if(!t)return n;const r=n.getDate(),i=en(e,n.getTime());i.setMonth(n.getMonth()+t+1,0);const s=i.getDate();return r>=s?i:(n.setFullYear(i.getFullYear(),i.getMonth(),r),n)}function E0(e,t){return Ju(e,t*12)}function pB(e,t){return E0(e,-t)}function mB(e,t){const n=Ot(e),r=Ot(t),i=n.getFullYear()-r.getFullYear(),s=n.getMonth()-r.getMonth();return i*12+s}function gB(e){const t=Ot(e);return t.setHours(23,59,59,999),t}function vB(e){const t=Ot(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(23,59,59,999),t}function yB(e){const t=Ot(e);return+gB(t)==+vB(t)}function xB(e,t){const n=Ot(e),r=Ot(t),i=Ls(n,r),s=Math.abs(mB(n,r));let a;if(s<1)a=0;else{n.getMonth()===1&&n.getDate()>27&&n.setDate(30),n.setMonth(n.getMonth()-i*s);let o=Ls(n,r)===-i;yB(Ot(e))&&s===1&&Ls(e,r)===1&&(o=!1),a=i*(s-Number(o))}return a===0?0:a}function bB(e,t){return Ju(e,-t)}function EB(e,t){const n=Ot(e),r=Ot(t),i=_0(n,r),s=Math.abs(yg(n,r));n.setDate(n.getDate()-i*s);const a=+(_0(n,r)===-i),o=i*(s-a);return o===0?0:o}function _0(e,t){const n=e.getFullYear()-t.getFullYear()||e.getMonth()-t.getMonth()||e.getDate()-t.getDate()||e.getHours()-t.getHours()||e.getMinutes()-t.getMinutes()||e.getSeconds()-t.getSeconds()||e.getMilliseconds()-t.getMilliseconds();return n<0?-1:n>0?1:n}function w0(e,t){const n=Ot(e);return isNaN(t)?en(e,NaN):(t&&n.setDate(n.getDate()+t),n)}function _B(e,t){return w0(e,-t)}function th(e){return t=>{const n=(e?Math[e]:Math.trunc)(t);return n===0?0:n}}function eh(e,t){return+Ot(e)-+Ot(t)}function wB(e,t,n){const r=eh(e,t)/mg;return th(n==null?void 0:n.roundingMethod)(r)}function nh(e,t){const n=+Ot(e);return en(e,n+t)}function S0(e,t){return nh(e,t*mg)}function SB(e,t){return S0(e,-t)}function O0(e,t,n){const r=eh(e,t)/pg;return th(n==null?void 0:n.roundingMethod)(r)}function rh(e,t){return nh(e,t*pg)}function T0(e,t){return rh(e,-t)}function M0(e,t,n){const r=eh(e,t)/1e3;return th(n==null?void 0:n.roundingMethod)(r)}function ih(e,t){return nh(e,t*1e3)}function C0(e,t){return ih(e,-t)}class OB extends Pn{constructor(){super(...arguments),this.scaleTypes={top:null,right:null,bottom:null,left:null},this.scales={top:null,right:null,bottom:null,left:null}}getDomainAxisPosition({datum:t=null}={}){if(this.dualAxes&&t){const n=this.model.getOptions(),{groupMapsTo:r}=n.data,i=x(n,"axes",this.secondaryDomainAxisPosition),s=t[r];if(i!=null&&i.correspondingDatasets&&i.correspondingDatasets.includes(s))return this.secondaryDomainAxisPosition}return this.domainAxisPosition}getRangeAxisPosition({datum:t=null,groups:n=null}={}){if(this.dualAxes){const r=this.model.getOptions(),{groupMapsTo:i}=r.data,s=x(r,"axes",this.secondaryRangeAxisPosition);let a;if(t!==null?a=t[i]:n&&n.length>0&&(a=n[0]),s!=null&&s.correspondingDatasets&&s.correspondingDatasets.includes(a))return this.secondaryRangeAxisPosition}return this.rangeAxisPosition}getAxisOptions(t){return x(this.model.getOptions(),"axes",t)}getDomainAxisOptions(){const t=this.getDomainAxisPosition();return this.getAxisOptions(t)}getRangeAxisOptions(){const t=this.getRangeAxisPosition();return this.getAxisOptions(t)}getScaleLabel(t){return this.getAxisOptions(t).title||(t===F.BOTTOM||t===F.TOP?"x-value":"y-value")}getDomainLabel(){return this.getScaleLabel(this.getDomainAxisPosition())}getRangeLabel(){return this.getScaleLabel(this.getRangeAxisPosition())}update(){this.determineAxisDuality(),this.findDomainAndRangeAxes(),this.determineOrientation(),Object.keys(F).map(t=>F[t]).forEach(t=>{this.scales[t]=this.createScale(t)})}findDomainAndRangeAxes(){const t=this.findVerticalAxesPositions(),n=this.findHorizontalAxesPositions(),r=this.findDomainAndRangeAxesPositions(t,n);this.domainAxisPosition=r.primaryDomainAxisPosition,this.rangeAxisPosition=r.primaryRangeAxisPosition,this.isDualAxes()&&(this.secondaryDomainAxisPosition=r.secondaryDomainAxisPosition,this.secondaryRangeAxisPosition=r.secondaryRangeAxisPosition)}determineOrientation(){(this.rangeAxisPosition===F.LEFT||this.rangeAxisPosition===F.RIGHT)&&(this.domainAxisPosition===F.BOTTOM||this.domainAxisPosition===F.TOP)?this.orientation=Jt.VERTICAL:this.orientation=Jt.HORIZONTAL}isDualAxes(){return this.dualAxes}determineAxisDuality(){var t,n,r,i;const s=this.model.getOptions(),a=x(s,"axes");((t=a[F.LEFT])!=null&&t.correspondingDatasets&&a[F.RIGHT]||(n=a[F.RIGHT])!=null&&n.correspondingDatasets&&a[F.LEFT]||(r=a[F.TOP])!=null&&r.correspondingDatasets&&a[F.BOTTOM]||(i=a[F.BOTTOM])!=null&&i.correspondingDatasets&&a[F.TOP])&&(this.dualAxes=!0)}getCustomDomainValuesByposition(t){const n=x(this.model.getOptions(),"axes",t,"domain");if(n&&!Array.isArray(n))throw new Error(`Domain in ${t} axis is not a valid array`);if(Array.isArray(n)&&(this.scaleTypes[t]===et.LINEAR||this.scaleTypes[t]===et.TIME)&&n.length!==2)throw new Error(`There can only be 2 elements in domain for scale type: ${this.scaleTypes[t]}`);return n}getOrientation(){return this.orientation}getScaleByPosition(t){return this.scales[t]}getScaleTypeByPosition(t){return this.scaleTypes[t]}getDomainAxisScaleType(){const t=this.getDomainAxisPosition();return this.getScaleTypeByPosition(t)}getRangeAxisScaleType(){const t=this.getRangeAxisPosition();return this.getScaleTypeByPosition(t)}getDomainScale(){return this.scales[this.domainAxisPosition]}getRangeScale(){return this.scales[this.rangeAxisPosition]}getMainXAxisPosition(){const t=[F.BOTTOM,F.TOP];return[this.domainAxisPosition,this.rangeAxisPosition].find(n=>t.indexOf(n)>-1)}getMainYAxisPosition(){const t=[F.LEFT,F.RIGHT];return[this.domainAxisPosition,this.rangeAxisPosition].find(n=>t.indexOf(n)>-1)}getMainXScale(){return this.scales[this.getMainXAxisPosition()]}getMainYScale(){return this.scales[this.getMainYAxisPosition()]}getValueFromScale(t,n,r,i){const s=this.model.getOptions(),a=x(s,"axes")[r],{mapsTo:o}=a,l=x(i,o)!==null?i[o]:i;let c;switch(n){case et.LABELS:c=t(l)+t.step()/2;break;case et.TIME:c=t(new Date(l));break;default:c=t(l)}return c}getBoundedScaledValues(t){const{bounds:n}=this.model.getOptions(),r=this.getRangeAxisPosition({datum:t}),i=this.scales[r],s=this.model.getOptions(),a=x(s,"axes")[r],{mapsTo:o}=a,l=t[o]!==void 0?t[o]:t;return[i(x(t,n.upperBoundMapsTo)!==null?t[n.upperBoundMapsTo]:l),i(x(t,n.lowerBoundMapsTo)!==null?t[n.lowerBoundMapsTo]:l)]}getValueThroughAxisPosition(t,n){const r=this.scaleTypes[t],i=this.scales[t];return this.getValueFromScale(i,r,t,n)}getDomainValue(t){const n=this.getDomainAxisPosition({datum:t});return this.getValueThroughAxisPosition(n,t)}getRangeValue(t){const n=this.getRangeAxisPosition({datum:t});return this.getValueThroughAxisPosition(n,t)}getMainXScaleType(){return this.getScaleTypeByPosition(this.getMainXAxisPosition())}getMainYScaleType(){return this.getScaleTypeByPosition(this.getMainYAxisPosition())}getDomainIdentifier(t){const n=this.model.getOptions();return x(n,"axes",this.getDomainAxisPosition({datum:t}),"mapsTo")}getRangeIdentifier(t){const n=this.model.getOptions();return x(n,"axes",this.getRangeAxisPosition({datum:t}),"mapsTo")}extendsDomain(t,n){const r=this.model.getOptions(),i=x(r,"axes",t);if(i.scaleType===et.TIME){const s=x(r,"timeScale","addSpaceOnEdges");return TB(n,s)}else return MB(n,Gn.paddingRatio,i.scaleType)}findVerticalAxesPositions(){const t=this.model.getOptions(),n=x(t,"axes"),r=this.isDualAxes();return x(n,F.LEFT)===null&&x(n,F.RIGHT)!==null||x(n,F.RIGHT,"main")===!0||r&&x(n,F.LEFT,"correspondingDatasets")?{primary:F.RIGHT,secondary:F.LEFT}:{primary:F.LEFT,secondary:F.RIGHT}}findHorizontalAxesPositions(){const t=this.model.getOptions(),n=x(t,"axes"),r=this.isDualAxes();return x(n,F.BOTTOM)===null&&x(n,F.TOP)!==null||x(n,F.TOP,"main")===!0||r&&x(n,F.BOTTOM,"correspondingDatasets")?{primary:F.TOP,secondary:F.BOTTOM}:{primary:F.BOTTOM,secondary:F.TOP}}findDomainAndRangeAxesPositions(t,n){const r=this.model.getOptions(),i=x(r,"axes",t.primary),s=x(r,"axes",n.primary),a=i.scaleType||et.LINEAR,o=s.scaleType||et.LINEAR,l={primaryDomainAxisPosition:null,secondaryDomainAxisPosition:null,primaryRangeAxisPosition:null,secondaryRangeAxisPosition:null};return l.primaryDomainAxisPosition=n.primary,l.primaryRangeAxisPosition=t.primary,l.secondaryDomainAxisPosition=n.secondary,l.secondaryRangeAxisPosition=t.secondary,(!(o===et.LABELS||o===et.TIME)&&a===et.LABELS||a===et.TIME)&&(l.primaryDomainAxisPosition=t.primary,l.primaryRangeAxisPosition=n.primary,l.secondaryDomainAxisPosition=t.secondary,l.secondaryRangeAxisPosition=n.secondary),l}getScaleDomain(t){const n=this.model.getOptions(),r=x(n,"axes",t),i=x(n,"bounds"),{includeZero:s}=r,a=x(r,"scaleType")||et.LINEAR;if(this.model.isDataEmpty())return[];if(r.binned){const{bins:y}=this.model.getBinConfigurations();return[0,ar(y,g=>g.length)]}else if(r.limitDomainToBins){const{bins:y}=this.model.getBinConfigurations(),g=this.model.getStackKeys({bins:y});return[g[0].split(":")[0],g[g.length-1].split(":")[1]]}const o=this.model.getDisplayData(),{extendLinearDomainBy:l,mapsTo:c,percentage:u,thresholds:d}=r,{reference:h,compareTo:f}=Gn.ratio;if(r.domain)return a===et.LABELS?r.domain:(a===et.TIME&&(r.domain=r.domain.map(y=>y.getTime===void 0?new Date(y):y)),this.extendsDomain(t,r.domain));if(u)return[0,100];if(r&&a===et.LABELS)return bs(o.map(y=>y[c]));let p,v;const m=this.model.getDataGroupNames();if(a===et.LABELS_RATIO)return o.map(y=>`${y[h]}/${y[f]}`);if(a===et.TIME)v=o.map(y=>+new Date(y[c]));else if(i&&n.axes)v=[],o.forEach(y=>{v.push(y[c]),y[i.upperBoundMapsTo]&&v.push(y[i.upperBoundMapsTo]),y[i.lowerBoundMapsTo]&&v.push(y[i.lowerBoundMapsTo])});else if(r.stacked===!0&&m&&t===this.getRangeAxisPosition()){const{groupMapsTo:y}=n.data,g=this.model.getDataValuesGroupedByKeys({groups:m}),b=o.filter(_=>!m.includes(_[y])),w=[];g.forEach(_=>{const{...S}=_;let L=0,I=0;Object.values(S).forEach(D=>{isNaN(D)||(D<0?I+=D:L+=D)}),w.push([I,L])}),v=[...b0(w),...b.map(_=>_[c])]}else v=[],o.forEach(y=>{const g=y[c];Array.isArray(g)&&g.length===2?(v.push(g[0]),v.push(g[1])):(l&&v.push(Math.max(y[c],y[l])),v.push(g))});return a!==et.TIME&&a!==et.LOG&&s&&v.push(0),d&&d.length>0&&d.forEach(y=>{const g=x(y,"value");g!==null&&v.push(g)}),p=We(v),p=this.extendsDomain(t,p),p}createScale(t){const n=this.model.getOptions(),r=x(n,"axes",t);if(!r)return null;const i=x(r,"scaleType")||et.LINEAR;this.scaleTypes[t]=i;let s;return i===et.TIME?s=_p():i===et.LOG?s=rp().base(r.base||10):i===et.LABELS||i===et.LABELS_RATIO?s=Qi():s=Ze(),s.domain(this.getScaleDomain(t)),s}getDomainLowerBound(t){let n,r=0;return this.getOrientation()===Jt.VERTICAL?n=this.getMainYScale().domain():n=this.getMainXScale().domain(),x(this.model.getOptions(),"axes",t,"includeZero")===!1&&n[0]>0&&n[1]>0&&(r=n[0]),r}getHighestDomainThreshold(){const t=x(this.model.getOptions(),"axes"),n=this.getDomainAxisPosition(),{thresholds:r}=t[n];if(!Array.isArray(r)||Array.isArray(r)&&!r.length)return null;const i=this.getDomainScale(),s=r.sort((a,o)=>o.value-a.value)[0];return this.getScaleTypeByPosition(n)===et.TIME&&(typeof s.value=="string"||s.value.getTime===void 0)&&(s.value=new Date(s.value)),{threshold:s,scaleValue:i(s.value)}}getHighestRangeThreshold(){const t=x(this.model.getOptions(),"axes"),n=this.getRangeAxisPosition(),{thresholds:r}=t[n];if(!Array.isArray(r)||Array.isArray(r)&&!r.length)return null;const i=this.getRangeScale(),s=r.sort((a,o)=>o.value-a.value)[0];return{threshold:s,scaleValue:i(s.value)}}}function TB(e,t){const n=new Date(e[0]),r=new Date(e[1]);return fB(r,n)>1?[pB(n,t),E0(r,t)]:xB(r,n)>1?[bB(n,t),Ju(r,t)]:EB(r,n)>1?[_B(n,t),w0(r,t)]:wB(r,n)>1?[SB(n,t),S0(r,t)]:O0(r,n)>30?[T0(n,t*30),rh(r,t*30)]:O0(r,n)>1?[T0(n,t),rh(r,t)]:M0(r,n)>15?[C0(n,t*15),ih(r,t*15)]:M0(r,n)>1?[C0(n,t),ih(r,t)]:[n,r]}function MB([e,t],n,r){const i=(t-e)*n,s=t<=0&&t+i>0?0:t+i;let a=e>=0&&e-i<0?0:e-i;if(r===et.LOG&&a<=0){if(e<=0)throw Error("Data must have values greater than 0 if log scale type is used.");a=e}return[a,s]}let CB=class extends Pn{constructor(){super(...arguments),this.curveTypes={curveLinear:Ka,curveLinearClosed:Ip,curveBasis:XS,curveBasisClosed:ZS,curveBasisOpen:KS,curveBundle:QS,curveCardinal:JS,curveCardinalClosed:tO,curveCardinalOpen:eO,curveCatmullRom:nO,curveCatmullRomClosed:rO,curveCatmullRomOpen:iO,curveMonotoneX:sO,curveMonotoneY:aO,curveNatural:oO,curveStep:lO,curveStepAfter:uO,curveStepBefore:cO}}getD3Curve(){let t="curveLinear";const n=this.model.getOptions().curve;if(n&&(typeof n=="string"?t=n:t=n.name),this.curveTypes[t]){let r=this.curveTypes[t];return n&&Object.keys(n).forEach(i=>{r[i]&&(r=r[i](n[i]))}),r}return console.warn(`The curve type '${t}' is invalid, using 'curveLinear' instead`),this.curveTypes.curveLinear}},AB=class extends Pn{isZoomBarEnabled(){if(!this.services.cartesianScales||!x(this.model.getOptions(),"zoomBar","top","enabled"))return!1;this.services.cartesianScales.findDomainAndRangeAxes();const t=this.services.cartesianScales.getMainXAxisPosition(),n=x(this.model.getOptions(),"axes",t,"scaleType");return t===F.BOTTOM&&n===et.TIME}getZoomBarData(){const t=this.model.getZoomBarData();return t&&t.length>1?t:this.model.getDisplayData()}getDefaultZoomBarDomain(t){if(!this.services.zoom)throw new Error("Services zoom not defined");const n=t||this.services.zoom.getZoomBarData(),{cartesianScales:r}=this.services;if(!r)throw new Error("Services cartesianScales undefined");const i=r.getMainXAxisPosition(),s=r.getDomainIdentifier(),a=x(this.model.getOptions(),"axes",i,"domain");if(Array.isArray(a)&&a.length===2)return a;if(!i)throw new Error("Not defined: mainXAxisPosition");return r.extendsDomain(i,We(n,o=>o[s]))}handleDomainChange(t,n={dispatchEvent:!0}){var r;this.model.set({zoomDomain:t},{animate:!1}),n.dispatchEvent&&((r=this.services.events)==null||r.dispatchEvent(O.ZoomDomain.CHANGE,{newDomain:t}))}getZoomRatio(){return x(this.model.getOptions(),"zoomBar","zoomRatio")}filterDataForRangeAxis(t,n){var r;const i=this.model.get("zoomDomain"),s=Object.assign({stacked:!1},n),a=x(this.model.getOptions(),"zoomBar","updateRangeAxis");if(this.isZoomBarEnabled()&&a&&i){const o=s.stacked?"sharedStackKey":(r=this.services.cartesianScales)==null?void 0:r.getDomainIdentifier(),l=t.filter(c=>new Date(c[o])>=i[0]&&new Date(c[o])<=i[1]);if(l.length>0)return l}return t}zoomIn(t=this.getZoomRatio()){var n;const r=this.model.get("zoomDomain"),i=Me.handleWidth,s=(n=this.services.cartesianScales)==null?void 0:n.getMainXScale().copy();s.domain(this.getDefaultZoomBarDomain());const a=s(r[0]),o=s(r[1]);if(o-a<i+1)return;const l=s.range(),c=o-a,u=Math.min((l[1]-l[0])/2*(t/2),c/2);let d=a+u,h=o-u;d>=h&&(d=a+c/2-i/2,h=o-c/2+i/2);const f=[s.invert(d),s.invert(h)];(r[0].valueOf()!==f[0].valueOf()||r[1].valueOf()!==f[1].valueOf())&&this.handleDomainChange(f)}zoomOut(t=this.getZoomRatio()){const n=this.model.get("zoomDomain");if(!this.services.cartesianScales)throw new Error("Services cartesianScales undefined");const r=this.services.cartesianScales.getMainXScale().copy();r.domain(this.getDefaultZoomBarDomain());const i=r(n[0]),s=r(n[1]),a=r.range(),o=(a[1]-a[0])/2*(t/2),l=Math.max(i-o,a[0]),c=Math.min(s+o,a[1]),u=[r.invert(l),r.invert(c)];(n[0].valueOf()!==u[0].valueOf()||n[1].valueOf()!==u[1].valueOf())&&this.handleDomainChange(u)}resetZoomDomain(){const t=this.model.get("zoomDomain"),n=this.getDefaultZoomBarDomain();(t[0].valueOf()!==n[0].valueOf()||t[1].valueOf()!==n[1].valueOf())&&this.handleDomainChange(n)}isMinZoomDomain(){const t=this.model.get("zoomDomain"),n=this.getDefaultZoomBarDomain();if(!t||!n)return!1;const r=t[1].valueOf()-t[0].valueOf(),i=n[1].valueOf()-n[0].valueOf(),s=x(this.model.getOptions(),"zoomBar","minZoomRatio");return r/i<s}isMaxZoomDomain(){const t=this.model.get("zoomDomain"),n=this.getDefaultZoomBarDomain();return!!(t&&n&&t[0].valueOf()===n[0].valueOf()&&t[1].valueOf()===n[1].valueOf())}isEmptyState(){return this.getZoomBarData().length===0}isZoomBarLoading(t){return x(this.model.getOptions(),"zoomBar",t,"loading")}isZoomBarLocked(t){return x(this.model.getOptions(),"zoomBar",t,"locked")}};function $B(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),n=n>i?i:n,n<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var s=Array(i);++r<i;)s[r]=e[r+t];return s}function LB(e,t,n){var r=e.length;return n=n===void 0?r:n,!t&&n>=r?e:$B(e,t,n)}var RB="\\ud800-\\udfff",DB="\\u0300-\\u036f",kB="\\ufe20-\\ufe2f",IB="\\u20d0-\\u20ff",NB=DB+kB+IB,PB="\\ufe0e\\ufe0f",UB="\\u200d",BB=RegExp("["+UB+RB+NB+PB+"]");function A0(e){return BB.test(e)}function HB(e){return e.split("")}var $0="\\ud800-\\udfff",VB="\\u0300-\\u036f",FB="\\ufe20-\\ufe2f",zB="\\u20d0-\\u20ff",GB=VB+FB+zB,jB="\\ufe0e\\ufe0f",WB="["+$0+"]",sh="["+GB+"]",ah="\\ud83c[\\udffb-\\udfff]",qB="(?:"+sh+"|"+ah+")",L0="[^"+$0+"]",R0="(?:\\ud83c[\\udde6-\\uddff]){2}",D0="[\\ud800-\\udbff][\\udc00-\\udfff]",YB="\\u200d",k0=qB+"?",I0="["+jB+"]?",XB="(?:"+YB+"(?:"+[L0,R0,D0].join("|")+")"+I0+k0+")*",ZB=I0+k0+XB,KB="(?:"+[L0+sh+"?",sh,R0,D0,WB].join("|")+")",QB=RegExp(ah+"(?="+ah+")|"+KB+ZB,"g");function JB(e){return e.match(QB)||[]}function tH(e){return A0(e)?JB(e):HB(e)}function eH(e){return function(t){t=ys(t);var n=A0(t)?tH(t):void 0,r=n?n[0]:t.charAt(0),i=n?LB(n,1).join(""):t.slice(1);return r[e]()+i}}var nH=eH("toUpperCase");function rH(e){return nH(ys(e).toLowerCase())}var iH=Ov(function(e,t,n){return t=t.toLowerCase(),e+(n?rH(t):t)});class rn{constructor(t,n){this.components=[],this.services={canvasZoom:lB,domUtils:N,events:cB,files:uB,gradientUtils:yu,transitions:hB},this.model=new fn(this.services)}init(t,n){this.model.set({holder:t},{skipUpdate:!0}),Object.keys(this.services).forEach(r=>{const i=this.services[r];this.services[r]=new i(this.model,this.services)}),this.services.events.addEventListener(O.Model.UPDATE,r=>{const i=!!x(r,"detail","animate");this.update(i)}),this.model.setData(n.data),this.services.events.addEventListener(O.Chart.RESIZE,()=>{this.update(!1)}),this.components=this.getComponents(),this.update()}getComponents(){return console.error("getComponents() method is not implemented"),[]}update(t=!0){if(!this.components)return;Object.keys(this.services).forEach(i=>{this.services[i].update()}),this.components.forEach(i=>i.render(t));const n=this.services.transitions.getPendingTransitions(),r=Object.keys(n).map(i=>n[i].end().catch(s=>s));Promise.all(r).then(()=>this.services.events.dispatchEvent(O.Chart.RENDER_FINISHED))}destroy(){this.components.forEach(t=>t.destroy()),this.services.domUtils.getHolder().remove(),this.model.set({destroyed:!0},{skipUpdate:!0})}getChartComponents(t,n){const r=this.model.getOptions(),i=x(r,"toolbar","enabled"),s={id:"legend",components:[new Xu(this.model,this.services)],growth:ht.PREFERRED},a=x(r,"canvasZoom","enabled");a&&a===!0&&t.push(new jI(this.model,this.services));const o=!!this.model.getOptions().title,l={id:"title",components:[new $s(this.model,this.services)],growth:ht.STRETCH},c={id:"toolbar",components:[new Po(this.model,this.services)],growth:ht.PREFERRED},u={id:"header",components:[new Le(this.model,this.services,[l,...i?[c]:[]],{direction:Ut.ROW,alignItems:Ir.CENTER})],growth:ht.PREFERRED},d={id:"graph-frame",components:t,growth:ht.STRETCH,renderType:x(n,"graphFrameRenderType")||rt.SVG},h=x(n,"excludeLegend")!==!0&&r.legend.enabled!==!1;let f=Ut.COLUMN;if(h){const y=x(r,"legend","position");y==="left"?(f=Ut.ROW,r.legend.orientation||(r.legend.orientation=Si.VERTICAL)):y==="right"?(f=Ut.ROW_REVERSE,r.legend.orientation||(r.legend.orientation=Si.VERTICAL)):y==="bottom"&&(f=Ut.COLUMN_REVERSE)}const p={id:"spacer",components:[new Un(this.model,this.services)],growth:ht.PREFERRED},v={id:"full-frame",components:[new Le(this.model,this.services,[...h?[s]:[],...h?[p]:[],d],{direction:f})],growth:ht.STRETCH},m=[];if(o||i){m.push(u);const y={id:"spacer",components:[new Un(this.model,this.services,i?{size:15}:void 0)],growth:ht.PREFERRED};m.push(y)}return m.push(v),[new Zu(this.model,this.services),new Go(this.model,this.services),new Le(this.model,this.services,m,{direction:Ut.COLUMN})]}}class _e extends rn{constructor(t,n){super(t,n),this.services=Object.assign(this.services,{cartesianScales:OB,curves:CB,zoom:AB}),this.model=new Cr(this.services)}getAxisChartComponents(t,n){const r=this.model.getOptions(),i=x(r,"zoomBar",F.TOP,"enabled"),s=x(r,"toolbar","enabled");this.services.cartesianScales.determineAxisDuality(),this.services.cartesianScales.findDomainAndRangeAxes(),this.services.cartesianScales.determineOrientation();const a=this.services.cartesianScales.getMainXAxisPosition(),o=x(r,"axes",a,"scaleType"),l=i&&a===F.BOTTOM&&o===et.TIME,c=this.services.zoom.isZoomBarLocked(F.TOP),u=!!this.model.getOptions().title,d={id:"title",components:[new $s(this.model,this.services)],growth:ht.STRETCH},h={id:"toolbar",components:[new Po(this.model,this.services)],growth:ht.PREFERRED},f={id:"header",components:[new Le(this.model,this.services,[d,...s?[h]:[]],{direction:Ut.ROW,alignItems:Ir.CENTER})],growth:ht.PREFERRED},p={id:"legend",components:[new Xu(this.model,this.services)],growth:ht.PREFERRED};l&&!c&&t.push(new t0(this.model,this.services),new WI(this.model,this.services)),t.push(new YI(this.model,this.services)),t.push(new XI(this.model,this.services));const v={id:"graph-frame",components:t,growth:ht.STRETCH,renderType:rt.SVG},m=x(n,"legend","enabled")!==!1&&this.model.getOptions().legend.enabled!==!1;let y=Ut.COLUMN;if(m){const S=x(this.model.getOptions(),"legend","position");S===wi.LEFT?(y=Ut.ROW,this.model.getOptions().legend.orientation||(this.model.getOptions().legend.orientation=Si.VERTICAL)):S===wi.RIGHT?(y=Ut.ROW_REVERSE,this.model.getOptions().legend.orientation||(this.model.getOptions().legend.orientation=Si.VERTICAL)):S===wi.BOTTOM&&(y=Ut.COLUMN_REVERSE)}const g={id:"spacer",components:[new Un(this.model,this.services)],growth:ht.PREFERRED},b={id:"full-frame",components:[new Le(this.model,this.services,[...m?[p]:[],...m?[g]:[],v],{direction:y})],growth:ht.STRETCH},w={id:"zoom-bar",components:[new qI(this.model,this.services)],growth:ht.PREFERRED,renderType:rt.SVG},_=[];if(u||s){_.push(f);const S={id:"spacer",components:[new Un(this.model,this.services,s?{size:15}:void 0)],growth:ht.PREFERRED};_.push(S)}return l&&_.push(w),_.push(b),[new i0(this.model,this.services),new Go(this.model,this.services),new Le(this.model,this.services,_,{direction:Ut.COLUMN})]}}class sH extends rn{constructor(t,n){super(t,n),this.model=new cL(this.services),this.model.setOptions(Gt(Nt.alluvialChart,n.options)),this.init(t,n)}getComponents(){const t=[new ZI(this.model,this.services)];return this.getChartComponents(t,{excludeLegend:!0})}}class aH extends _e{constructor(t,n){super(t,n),this.model.setOptions(Gt(Ln(Nt.areaChart),n.options)),this.init(t,n)}getComponents(){const t=[new Ee(this.model,this.services),new Re(this.model,this.services),new Xn(this.model,this.services),new gi(this.model,this.services),new s0(this.model,this.services),new mn(this.model,this.services,{fadeInOnChartHolderMouseover:!0,handleThresholds:!0}),new ge(this.model,this.services,{skeleton:te.GRID})];return this.getAxisChartComponents(t)}}class oH extends _e{constructor(t,n){super(t,n),this.model=new uL(this.services),this.model.setOptions(Gt(Nt.boxplotChart,n.options)),this.init(t,n)}getComponents(){const t=[new Ee(this.model,this.services),new Re(this.model,this.services),new JI(this.model,this.services),new vi(this.model,this.services),new ge(this.model,this.services,{skeleton:te.VERT_OR_HORIZ})];return this.getAxisChartComponents(t,{legend:{enabled:!1}})}}class lH extends _e{constructor(t,n){super(t,n),this.model.setOptions(Gt(Nt.bubbleChart,n.options)),this.init(t,n)}getComponents(){const t=[new Ee(this.model,this.services),new Re(this.model,this.services),new Xn(this.model,this.services),new tN(this.model,this.services),new ge(this.model,this.services,{skeleton:te.GRID})];return this.getAxisChartComponents(t)}}class cH extends _e{constructor(t,n){super(t,n),this.model=new hL(this.services),this.model.setOptions(Gt(Nt.bulletChart,n.options)),this.init(t,n)}getComponents(){const t=[new Ee(this.model,this.services),new Re(this.model,this.services),new eN(this.model,this.services),new ge(this.model,this.services,{skeleton:te.GRID})];return this.getAxisChartComponents(t)}}class uH extends rn{constructor(t,n){super(t,n),this.model=new dL(this.services),this.model.setOptions(Gt(Nt.choroplethChart,n.options)),this.init(t,n)}getChartComponents(t,n){const r=this.model.getOptions(),i=x(r,"toolbar","enabled"),s=!!this.model.getOptions().title,a={id:"title",components:[new $s(this.model,this.services)],growth:ht.STRETCH},o={id:"toolbar",components:[new Po(this.model,this.services)],growth:ht.PREFERRED},l={id:"header",components:[new Le(this.model,this.services,[a,...i?[o]:[]],{direction:Ut.ROW,alignItems:Ir.CENTER})],growth:ht.PREFERRED},c={id:"legend",components:[new c0(this.model,this.services,{chartType:"choropleth"})],growth:ht.PREFERRED,renderType:rt.SVG},u={id:"graph-frame",components:t,growth:ht.STRETCH,renderType:rt.SVG},d=x(n,"legend","enabled")!==!1&&this.model.getOptions().legend.enabled!==!1&&this.model.getData().length>0,h=Ut.COLUMN_REVERSE,f={id:"spacer",components:[new Un(this.model,this.services,{size:15})],growth:ht.PREFERRED},p={id:"full-frame",components:[new Le(this.model,this.services,[...d?[c]:[],...d?[f]:[],u],{direction:h})],growth:ht.STRETCH},v=[];if(s||i){v.push(l);const m={id:"spacer",components:[new Un(this.model,this.services,i?{size:15}:void 0)],growth:ht.PREFERRED};v.push(m)}return v.push(p),[new Zu(this.model,this.services),new Go(this.model,this.services),new Le(this.model,this.services,v,{direction:Ut.COLUMN})]}getComponents(){const t=[new oB(this.model,this.services)];return this.getChartComponents(t)}}class hH extends rn{constructor(t,n){super(t,n),this.model=new fL(this.services),this.model.setOptions(Gt(Nt.circlePackChart,n.options)),this.init(t,n)}getComponents(){const t=[new xN(this.model,this.services)];return this.getChartComponents(t)}}const N0={[Ie.LINE]:[gi,mn],[Ie.SCATTER]:[mn],[Ie.AREA]:[s0,gi,mn],[Ie.STACKED_AREA]:[m0,gi,v0,Wo],[Ie.SIMPLE_BAR]:[p0],[Ie.GROUPED_BAR]:[f0,vi],[Ie.STACKED_BAR]:[g0,Wo]};class dH extends _e{constructor(t,n){super(t,n);const r=Gt(Nt.comboChart,n.options);n.options.comboChartTypes||(console.error("No comboChartTypes defined for the Combo Chart!"),r.comboChartTypes=[{type:Ie.LINE,correspondingDatasets:[]}]),this.model.setOptions(r),this.init(t,n)}getGraphComponents(){const{comboChartTypes:t}=this.model.getOptions();let n=0;const r=t.map(i=>{const s=i.type;let a;if(typeof i.type=="string"){if(!Object.keys(N0).includes(i.type))return console.error(`Invalid chart type "${i.type}" specified for combo chart. Please refer to the ComboChart tutorial for more guidance.`),null;let o=!1;const l=`${iH(i.type)}Chart`;return a=lt({},Nt[l],this.model.getOptions(),i.options),i.type===Ie.STACKED_AREA&&(o=!0),N0[i.type].map(c=>new c(this.model,this.services,{groups:i.correspondingDatasets,id:n++,options:a,stacked:o}))}else return a=lt({},this.model.getOptions(),i.options),new s(this.model,this.services,{groups:i.correspondingDatasets,id:n++,options:a})}).filter(i=>i!==null);return b0(r)}getComponents(){const{comboChartTypes:t}=this.model.getOptions(),n=t.some(i=>i.type===Ie.STACKED_BAR||i.type===Ie.STACKED_AREA),r=[new Ee(this.model,this.services),new Re(this.model,this.services),new ge(this.model,this.services,{skeleton:te.GRID}),...n?[]:[new Xn(this.model,this.services)],...this.getGraphComponents()];return this.getAxisChartComponents(r)}}class P0 extends rn{constructor(t,n,r=!1){super(t,n),this.model=new pL(this.services),!r&&(this.model.setOptions(Gt(Nt.pieChart,n.options)),this.init(t,n))}getComponents(){const t=[new u0(this.model,this.services),new ge(this.model,this.services,{skeleton:te.PIE})];return this.getChartComponents(t)}}class fH extends P0{constructor(t,n){super(t,n,!0),this.model.setOptions(Gt(Nt.donutChart,n.options)),this.init(t,n)}getComponents(){const t=[new EN(this.model,this.services),new ge(this.model,this.services,{skeleton:te.DONUT})];return this.getChartComponents(t)}}class pH extends rn{constructor(t,n){super(t,n),this.model=new mL(this.services),this.model.setOptions(Gt(Nt.gaugeChart,n.options)),this.init(t,n)}getComponents(){const t=[new _N(this.model,this.services)];return this.getChartComponents(t)}}class mH extends _e{constructor(t,n){super(t,n),this.model.setOptions(Gt(Nt.groupedBarChart,n.options)),this.init(t,n)}getComponents(){const t=[new Ee(this.model,this.services),new Re(this.model,this.services),new f0(this.model,this.services),new vi(this.model,this.services),new ge(this.model,this.services,{skeleton:te.VERT_OR_HORIZ})];return this.getAxisChartComponents(t)}}class gH extends _e{constructor(t,n){super(t,n),this.model=new gL(this.services),this.model.setOptions(Gt(Nt.heatmapChart,n.options)),this.init(t,n)}getAxisChartComponents(t,n){const r=this.model.getOptions(),i=x(r,"toolbar","enabled");this.services.cartesianScales.determineAxisDuality(),this.services.cartesianScales.findDomainAndRangeAxes(),this.services.cartesianScales.determineOrientation();const s=!!this.model.getOptions().title,a={id:"title",components:[new $s(this.model,this.services)],growth:ht.STRETCH},o={id:"toolbar",components:[new Po(this.model,this.services)],growth:ht.PREFERRED},l={id:"header",components:[new Le(this.model,this.services,[a,...i?[o]:[]],{direction:Ut.ROW,alignItems:Ir.CENTER})],growth:ht.PREFERRED},c={id:"legend",components:[new c0(this.model,this.services,{chartType:"heatmap"})],growth:ht.PREFERRED,renderType:rt.SVG},u={id:"graph-frame",components:t,growth:ht.STRETCH,renderType:rt.SVG},d=x(n,"legend","enabled")!==!1&&this.model.getOptions().legend.enabled!==!1&&this.model.getData().length>0,h=Ut.COLUMN_REVERSE,f={id:"spacer",components:[new Un(this.model,this.services,{size:15})],growth:ht.PREFERRED},p={id:"full-frame",components:[new Le(this.model,this.services,[...d?[c]:[],...d?[f]:[],u],{direction:h})],growth:ht.STRETCH},v=[];if(s||i){v.push(l);const m={id:"spacer",components:[new Un(this.model,this.services,i?{size:15}:void 0)],growth:ht.PREFERRED};v.push(m)}return v.push(p),[new i0(this.model,this.services),new Go(this.model,this.services),new Le(this.model,this.services,v,{direction:Ut.COLUMN})]}getComponents(){const t=[new Ee(this.model,this.services),new wN(this.model,this.services)];return this.getAxisChartComponents(t)}}class vH extends _e{constructor(t,n){super(t,n),this.model=new vL(this.services),this.model.setOptions(Gt(Nt.histogramChart,n.options)),this.init(t,n),this.update()}getComponents(){const t=[new Ee(this.model,this.services),new Re(this.model,this.services),new uN(this.model,this.services),new SN(this.model,this.services)];return this.getAxisChartComponents(t)}}class yH extends _e{constructor(t,n){super(t,n),this.model.setOptions(Gt(Nt.lineChart,n.options)),this.init(t,n)}getComponents(){const t=[new Ee(this.model,this.services),new Re(this.model,this.services),new Xn(this.model,this.services),new gi(this.model,this.services),new mn(this.model,this.services,{handleThresholds:!0}),new CN(this.model,this.services),new vi(this.model,this.services)];return this.getAxisChartComponents(t)}}class xH extends _e{constructor(t,n){super(t,n),this.model.setOptions(Gt(Nt.lollipopChart,n.options)),this.init(t,n)}getComponents(){const t=[new Ee(this.model,this.services),new Re(this.model,this.services),new Xn(this.model,this.services),new ON(this.model,this.services),new mn(this.model,this.services),new ge(this.model,this.services,{skeleton:te.GRID})];return this.getAxisChartComponents(t)}}class bH extends rn{constructor(t,n){var r;super(t,n),this.model=new yL(this.services);const i=(r=n.options.meter)!=null&&r.proportional?lt(Ln(Nt.proportionalMeterChart),n.options):lt(Ln(Nt.meterChart),n.options);this.model.setOptions(i),this.init(t,n)}getComponents(){const t=[...x(this.model.getOptions(),"meter","showLabels")?[{id:"meter-title",components:[new yN(this.model,this.services)],growth:ht.STRETCH,renderType:rt.SVG},{id:"spacer",components:[new Un(this.model,this.services,{size:8})],growth:ht.STRETCH}]:[],{id:"meter-graph",components:[new TN(this.model,this.services)],growth:ht.STRETCH,renderType:rt.SVG}],n=[new Le(this.model,this.services,t,{direction:Ut.COLUMN})];return this.getChartComponents(n,{graphFrameRenderType:rt.HTML})}}class EH extends rn{constructor(t,n){super(t,n),this.model=new xL(this.services),this.model.setOptions(Gt(Nt.radarChart,n.options)),this.init(t,n)}getComponents(){const t=[new MN(this.model,this.services)];return this.getChartComponents(t)}}class _H extends _e{constructor(t,n){super(t,n),this.model.setOptions(Gt(Nt.scatterChart,n.options)),this.init(t,n)}getComponents(){const t=[new Ee(this.model,this.services),new Re(this.model,this.services),new Xn(this.model,this.services),new mn(this.model,this.services),new ge(this.model,this.services,{skeleton:te.GRID})];return this.getAxisChartComponents(t)}}class wH extends rn{constructor(t,n){super(t,n),this.model=new bL(this.services),this.model.setOptions(Gt(Nt.treeChart,n.options)),this.init(t,n)}getComponents(){const t=[new AN(this.model,this.services)];return this.getChartComponents(t,{excludeLegend:!0})}}class SH extends rn{constructor(t,n){super(t,n),this.model=new EL(this.services),this.model.setOptions(Gt(Nt.treemapChart,n.options)),this.init(t,n)}getComponents(){const t=[new iB(this.model,this.services)];return this.getChartComponents(t)}}class OH extends _e{constructor(t,n){super(t,n),this.model.setOptions(Gt(Nt.simpleBarChart,n.options)),this.init(t,n)}getComponents(){const t=[new Ee(this.model,this.services),new Re(this.model,this.services),new p0(this.model,this.services),new vi(this.model,this.services),new ge(this.model,this.services,{skeleton:te.VERT_OR_HORIZ})];return this.getAxisChartComponents(t)}}class TH extends _e{constructor(t,n){super(t,n),this.model.setOptions(Gt(Nt.stackedAreaChart,n.options)),this.init(t,n)}getComponents(){const t=[new Ee(this.model,this.services),new Re(this.model,this.services),new Wo(this.model,this.services),new m0(this.model,this.services),new gi(this.model,this.services,{stacked:!0}),new v0(this.model,this.services,{fadeInOnChartHolderMouseover:!0,handleThresholds:!0,stacked:!0}),new ge(this.model,this.services,{skeleton:te.GRID})];return this.getAxisChartComponents(t)}}class MH extends _e{constructor(t,n){super(t,n),this.model.setOptions(Gt(Nt.stackedBarChart,n.options)),this.init(t,n)}getComponents(){const t=[new Ee(this.model,this.services),new Re(this.model,this.services),new Wo(this.model,this.services),new g0(this.model,this.services),new ge(this.model,this.services,{skeleton:te.VERT_OR_HORIZ}),new vi(this.model,this.services)];return this.getAxisChartComponents(t)}}class CH extends rn{constructor(t,n){super(t,n),this.model=new _L(this.services),this.model.setOptions(Gt(Nt.wordCloudChart,n.options)),this.init(t,n)}getComponents(){const t=[new sB(this.model,this.services),new ge(this.model,this.services,{skeleton:te.PIE})];return this.getChartComponents(t)}}var oh={exports:{}},Rs={};/**
86
86
  * @license React
87
87
  * react-jsx-runtime.production.min.js
88
88
  *