@carbon/charts-react 1.23.3 → 1.23.4
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.mjs +5 -2
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.cjs +2 -2
- package/dist/index.umd.cjs.map +1 -1
- package/dist/index.umd.js +2 -2
- package/package.json +3 -3
package/dist/index.umd.js
CHANGED
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
<svg xmlns="http://www.w3.org/2000/svg" class="arrow-right" width="32" height="32" viewBox="0 0 32 32">
|
|
63
63
|
<polygon points="18 6 16.57 7.393 24.15 15 4 15 4 17 24.15 17 16.57 24.573 18 26 28 16 18 6"/>
|
|
64
64
|
<rect width="32" height="32"/>
|
|
65
|
-
</svg>`}destroy(){this.parent.selectAll("path.line,.node-group").on("mouseover",null).on("mousemove",null).on("click",null).on("mouseout",null)}}class Se extends gt{constructor(){super(...arguments),this.type="grid",this.renderType=it.SVG}render(t=!0){const n=y(this.getOptions(),"grid","x","enabled"),r=y(this.getOptions(),"grid","y","enabled");this.drawBackdrop(n,r),!(!n&&!r)&&(n&&(N.appendOrSelect(this.backdrop,"g.x.grid"),this.drawXGrid(t)),r&&(N.appendOrSelect(this.backdrop,"g.y.grid"),this.drawYGrid(t)))}drawXGrid(t){const n=this.parent,r=this.backdrop.attr("height"),i=this.services.cartesianScales.getMainXScale(),s=fc(i).tickSizeInner(-r).tickSizeOuter(0);if(y(this.getOptions(),"grid","x","alignWithAxisTicks")){const o=this.services.cartesianScales.getDomainAxisPosition(),l=y(this.getOptions(),"axes",o,"ticks","values");l&&s.tickValues(l)}else{const o=y(this.getOptions(),"grid","x","numberOfTicks");s.ticks(o)}const a=n.select(".x.grid").attr("transform",`translate(${-this.backdrop.attr("x")}, ${r})`);t?a.transition().call(o=>this.services.transitions.setupTransition({transition:o,name:"grid-update",animate:t})).call(s):a.call(s),this.cleanGrid(a)}drawYGrid(t){const n=this.parent,r=this.backdrop.attr("width"),i=this.services.cartesianScales.getMainYScale(),s=Jf(i).tickSizeInner(-r).tickSizeOuter(0);if(y(this.getOptions(),"grid","y","alignWithAxisTicks")){const o=this.services.cartesianScales.getRangeAxisPosition(),l=y(this.getOptions(),"axes",o,"ticks","values");l&&s.tickValues(l)}else{const o=y(this.getOptions(),"grid","y","numberOfTicks");s.ticks(o)}const a=n.select(".y.grid").attr("transform",`translate(0, ${-this.backdrop.attr("y")})`);t?a.transition().call(o=>this.services.transitions.setupTransition({transition:o,name:"grid-update",animate:t})).call(s):a.call(s),this.cleanGrid(a)}getGridlineThreshold(t){const n=this.parent,r=n.selectAll(".x.grid .tick").nodes().sort((u,d)=>Number(xn(u).tx)-Number(xn(d).tx));let i=-1;if(!r.length)return;r.forEach(u=>{t[0]>=+xn(u).tx&&i++});const s=i+1<r.length?i+1:r.length,a=r[i],o=r[s];let l;if(!a)l=+xn(o).tx;else if(o)l=+xn(o).tx-+xn(a).tx;else{const u=n.select("rect.chart-grid-backdrop").node();l=N.getSVGElementSize(u).width-+xn(a).tx}const{threshold:c}=this.getOptions().tooltip.gridline;return l*c}getActiveGridline(t){const n=y(this.getOptions,"tooltip","gridline","threshold"),r=n||this.getGridlineThreshold(t);return this.parent.selectAll(".x.grid .tick").filter(function(){const i=xn(this),s={min:Number(i.tx)-r,max:Number(i.tx)+r};return s.min<=t[0]&&t[0]<=s.max})}drawBackdrop(t,n){const r=this.parent,i=this.services.cartesianScales.getMainXScale(),s=this.services.cartesianScales.getMainYScale(),[a,o]=i.range(),[l,c]=s.range();this.backdrop=N.appendOrSelect(r,"svg.chart-grid-backdrop").attr("role","presentation");const u=N.appendOrSelect(this.backdrop,t||n?"rect.chart-grid-backdrop.stroked":"rect.chart-grid-backdrop");this.backdrop.merge(u).attr("x",a).attr("y",c).attr("width",Math.abs(o-a)).attr("height",Math.abs(l-c)).lower(),u.attr("width","100%").attr("height","100%")}cleanGrid(t){t.selectAll("text").remove(),t.select(".domain").remove()}}class Ng extends gt{constructor(){super(...arguments),this.type="area",this.renderType=it.SVG,this.gradient_id="gradient-id-"+Math.floor(Math.random()*99999999999),this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail;this.parent.selectAll("path.area").transition("legend-hover-area").call(r=>this.services.transitions.setupTransition({transition:r,name:"legend-hover-area"})).attr("opacity",r=>r.name!==n.datum().name?vn.opacity.unselected:vn.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",vn.opacity.selected)}}init(){const t=this.services.events;t.addEventListener(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t=!0){const n=this.getComponentContainer({ariaLabel:"area graphs",withinChartClip:!0}),r=this.getOptions();let i=[0,0];const{cartesianScales:s}=this.services,a=s.getOrientation(),o=tu().curve(this.services.curves.getD3Curve()).defined(b=>{const S=s.getRangeIdentifier();return b[S]!=null}),l=this.model.getGroupedData(this.configs.groups),c=y(r,"bounds"),u=c&&l&&l.length===1;!u&&c&&console.warn(`Bounds can only be shown when having 1 single datagroup, you've supplied ${l.length}`);let d=0;const h=(b,S)=>{y(r,"axes",b,"includeZero")===!1&&S[0]>0&&S[1]>0&&(d=S[0])},p=b=>u?s.getBoundedScaledValues(b)[0]:s.getRangeValue(d),f=b=>u?s.getBoundedScaledValues(b)[1]:s.getRangeValue(b);a===Gt.VERTICAL?(i=s.getMainYScale().domain(),h(s.getMainYAxisPosition(),i),o.x(b=>s.getDomainValue(b)).y0(b=>p(b)).y1(b=>f(b))):(i=s.getMainXScale().domain(),h(s.getMainXAxisPosition(),i),o.x0(b=>p(b)).x1(b=>f(b)).y(b=>s.getDomainValue(b)));const g=y(r,"color","gradient","enabled"),m=l&&l.length===1&&g;l.length>1&&g&&console.error("Gradients can only be enabled when having 1 single dataset");const v=n.selectAll("path.area").data(l,b=>b.name),x=I(this.services.domUtils.getMainContainer());if(v.exit().attr("opacity",0).remove(),!l.length)return;if(m){const b=x.select(`path.${this.model.getColorClassName({classNameTypes:[st.STROKE],dataGroupName:l[0].name})}`).node();let S;if(b)S=getComputedStyle(b,null).getPropertyValue("stroke");else{const M=y(this.model.getOptions(),"color","scale");if(M!==null){const D=Object.keys(M);S=M[D[0]]}}dc.appendOrUpdateLinearGradient({svg:this.parent,id:this.services.domUtils.generateElementIDString(`${l[0].name.replace(" ","")}_${this.gradient_id}`),x1:"0%",x2:"0%",y1:"0%",y2:"100%",stops:dc.getStops(i,S)})}else this.parent.selectAll("defs linearGradient").empty()||this.parent.selectAll("defs linearGradient").each(function(){this.parentNode.remove()});const _=this,E=v.enter().append("path");m?E.merge(v).style("fill",b=>`url(#${this.services.domUtils.generateElementIDString(`${b.name.replace(" ","")}_${this.gradient_id}`)})`).attr("class","area").attr("class",b=>this.model.getColorClassName({classNameTypes:[st.FILL],dataGroupName:b.name,originalClassName:"area"})).attr("d",b=>{const{data:S}=b;return o(S)}):(E.attr("opacity",0).merge(v).attr("class","area").attr("class",b=>this.model.getColorClassName({classNameTypes:[st.FILL,st.STROKE],dataGroupName:b.name,originalClassName:"area"})).style("fill",b=>_.model.getFillColor(b.name,null,b.data)).transition().call(b=>this.services.transitions.setupTransition({transition:b,name:"area-update-enter",animate:t})).attr("opacity",u?1:vn.opacity.selected).attr("d",b=>{const{data:S}=b;return o(S)}),u&&E.attr("fill-opacity",vn.opacity.selected).style("stroke",b=>_.model.getStrokeColor(b.name,null,b.data)).style("stroke-dasharray","2, 2").attr("stroke-width",.7+"px"))}destroy(){const t=this.services.events;t.removeEventListener(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}}class ai extends gt{constructor(){super(...arguments),this.type="line",this.renderType=it.SVG,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail;this.parent.selectAll("path.line").transition("legend-hover-line").call(r=>this.services.transitions.setupTransition({transition:r,name:"legend-hover-line"})).attr("opacity",r=>r.name!==n.datum().name?yn.opacity.unselected:yn.opacity.selected)},this.handleLegendMouseOut=()=>{this.parent.selectAll("path.line").transition("legend-mouseout-line").call(t=>this.services.transitions.setupTransition({transition:t,name:"legend-mouseout-line"})).attr("opacity",yn.opacity.selected)}}init(){const{events:t}=this.services;t.addEventListener(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t=!0){const n=this.getComponentContainer({ariaLabel:"lines",withinChartClip:!0}),{cartesianScales:r,curves:i}=this.services,s=p=>r.getDomainValue(p),a=p=>r.getRangeValue(p),[o,l]=bn(s,a,r.getOrientation()),c=this.getOptions(),u=ms().x(o).y(l).curve(i.getD3Curve()).defined(p=>{const f=r.getRangeIdentifier(p);return p[f]!=null});let d=[];if(this.configs.stacked){const p=Object.keys(c.axes).some(g=>c.axes[g].percentage),{groupMapsTo:f}=c.data;d=this.model.getStackedData({groups:this.configs.groups,percentage:p}).map(g=>{const m=this.services.cartesianScales.getDomainIdentifier(g),v=this.services.cartesianScales.getRangeIdentifier(g);return{name:y(g,0,f),data:g.map(x=>({[m]:x.data.sharedStackKey,[f]:x[f],[v]:x[1]})),hidden:!OC(g,x=>x[0]!==x[1])}})}else d=this.model.getGroupedData(this.configs.groups);const h=n.selectAll("path.line").data(d,p=>p.name);h.exit().attr("opacity",0).remove(),h.enter().append("path").classed("line",!0).attr("opacity",0).merge(h).data(d,p=>p.name).attr("class",p=>this.model.getColorClassName({classNameTypes:[st.STROKE],dataGroupName:p.name,originalClassName:"line"})).style("stroke",p=>this.model.getStrokeColor(p.name,null,p.data)).attr("role",ht.GRAPHICS_SYMBOL).attr("aria-roledescription","line").attr("aria-label",p=>{const{data:f}=p;return f.map(g=>{const m=this.services.cartesianScales.getRangeIdentifier(g);return g[m]}).join(",")}).transition().call(p=>this.services.transitions.setupTransition({transition:p,name:"line-update-enter",animate:t})).attr("opacity",p=>p.hidden?0:1).attr("d",p=>{const{data:f}=p;return u(f)})}destroy(){const t=this.services.events;t.removeEventListener(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}}const Pg=5;function Jk(e,t){return e>t-Pg&&e<t+Pg}class Gn extends gt{constructor(){super(...arguments),this.type="ruler",this.renderType=it.SVG,this.isXGridEnabled=y(this.getOptions(),"grid","x","enabled"),this.isYGridEnabled=y(this.getOptions(),"grid","y","enabled"),this.isEventListenerAdded=!1}render(t=!1){const n=y(this.getOptions(),"ruler","enabled");this.drawBackdrop(),n&&!this.isEventListenerAdded?this.addBackdropEventListeners():!n&&this.isEventListenerAdded&&this.removeBackdropEventListeners()}removeBackdropEventListeners(){this.isEventListenerAdded=!1,this.backdrop.on("mousemove mouseover mouseout",null)}formatTooltipData(t){return t}showRuler(t,[n,r]){const i=this.parent,s=this.services.cartesianScales.getOrientation(),a=this.model.getDisplayData(),o=this.services.cartesianScales.getRangeScale(),[l,c]=o.range(),u=s===Gt.HORIZONTAL?r:n,d=N.appendOrSelect(i,"g.ruler").attr("aria-label","ruler"),h=N.appendOrSelect(d,"line.ruler-line"),p=i.selectAll("[role=graphics-symbol]"),f=a.map(m=>({domainValue:this.services.cartesianScales.getDomainValue(m),originalData:m})).filter(m=>Jk(m.domainValue,u));if(this.pointsWithinLine&&f.length===this.pointsWithinLine.length&&f.map(m=>m.domainValue).join()===this.pointsWithinLine.map(m=>m.domainValue).join())return this.pointsWithinLine=f,this.services.events.dispatchEvent(T.Tooltip.MOVE,{mousePosition:[n,r]});this.pointsWithinLine=f;const g=this.pointsWithinLine.reduce((m,v)=>{if(m.length===0)return m.push(v),m;const x=m[0].domainValue,_=Math.abs(u-v.domainValue),E=Math.abs(u-x);return _>E||(_<E?m=[v]:m.push(v)),m},[]);if(g.length>0){const m=g.map(E=>E.originalData).filter(E=>{const b=this.services.cartesianScales.getRangeIdentifier(E);return E[b]!=null}),v=g.map(E=>E.domainValue),x=p.filter(E=>{const b=this.services.cartesianScales.getDomainValue(E);return v.includes(b)});this.elementsToHighlight&&this.elementsToHighlight.size()>0&&!Zf(this.elementsToHighlight,x)&&this.hideRuler(),x.dispatch("mouseover"),this.elementsToHighlight=x,this.services.events.dispatchEvent(T.Tooltip.SHOW,{event:t,mousePosition:[n,r],hoveredElement:h,data:this.formatTooltipData(m)}),d.attr("opacity",1);const _=g[0];s==="horizontal"?h.attr("x1",c).attr("x2",l).attr("y1",_.domainValue).attr("y2",_.domainValue):h.attr("y1",c).attr("y2",l).attr("x1",_.domainValue).attr("x2",_.domainValue)}else this.hideRuler()}hideRuler(){const t=this.parent,n=N.appendOrSelect(t,"g.ruler");t.selectAll("[role=graphics-symbol]").dispatch("mouseout"),this.services.events.dispatchEvent(T.Tooltip.HIDE),n.attr("opacity",0)}addBackdropEventListeners(){this.isEventListenerAdded=!0;const t=this,n=this.services.domUtils.getHolder(),r=this.model.getDisplayData();let i=function(s){const a=er(s,t.parent.node());t.showRuler(s,a)};if(r.length>100){const s=r.length%50*12.5;i=XT(function(a){const{mousePosition:o}=this;t.showRuler(a,o)},s,n)}this.backdrop.on("mousemove mouseover",i).on("mouseout",this.hideRuler.bind(this))}drawBackdrop(){const t=this.parent;this.backdrop=N.appendOrSelect(t,"svg.chart-grid-backdrop")}}let cn=class extends gt{constructor(){super(...arguments),this.type="scatter",this.renderType=it.SVG,this.handleChartHolderOnHover=()=>{if(!this.parent)throw new Error("Parent not defined");this.parent.selectAll("circle.dot").transition("chart-holder-hover-scatter").call(t=>{var n;return(n=this.services.transitions)==null?void 0:n.setupTransition({transition:t,name:"chart-holder-hover-scatter"})}).attr("opacity",1)},this.handleChartHolderOnMouseOut=()=>{if(!this.parent)throw new Error("Parent not defined");this.parent.selectAll("circle.dot").transition("chart-holder-mouseout-scatter").call(t=>{var n;return(n=this.services.transitions)==null?void 0:n.setupTransition({transition:t,name:"chart-holder-mouseout-scatter"})}).attr("opacity",0)},this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail,{groupMapsTo:r}=this.getOptions().data;if(!this.parent)throw new Error("Parent not defined");this.parent.selectAll("circle.dot").transition("legend-hover-scatter").call(i=>{var s;return(s=this.services.transitions)==null?void 0:s.setupTransition({transition:i,name:"legend-hover-scatter"})}).attr("opacity",i=>i[r]!==n.datum().name?.3:1)},this.handleLegendMouseOut=()=>{if(!this.parent)throw new Error("Parent not defined");this.parent.selectAll("circle.dot").transition("legend-mouseout-scatter").call(t=>{var n;return(n=this.services.transitions)==null?void 0:n.setupTransition({transition:t,name:"legend-mouseout-scatter"})}).attr("opacity",1)}}init(){const{events:t}=this.services;if(!t)throw new Error("Services events are undefined.");t.addEventListener(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut);const{fadeInOnChartHolderMouseover:n}=this.configs;n&&(t.addEventListener(T.Chart.MOUSEOVER,this.handleChartHolderOnHover),t.addEventListener(T.Chart.MOUSEOUT,this.handleChartHolderOnMouseOut))}filterBasedOnZoomDomain(t){const{cartesianScales:n}=this.services;if(!n)throw new Error("Services cartesianScales are undefined.");const r=n.getDomainIdentifier(t),i=this.model.get("zoomDomain");return i!==void 0?t.filter(s=>s[r].getTime()>=i[0].getTime()&&s[r].getTime()<=i[1].getTime()):t}getScatterData(){const t=this.getOptions(),{stacked:n}=this.configs;let r;if(n){const i=Object.keys(t.axes).some(s=>t.axes[s].percentage);r=this.model.getStackedData({groups:this.configs.groups,percentage:i})}else{const{cartesianScales:i}=this.services;if(!i)throw new Error("Services cartesianScales are undefined.");r=this.model.getDisplayData(this.configs.groups).filter(s=>{const a=i.getRangeIdentifier(s);return s[a]!==void 0&&s[a]!==null})}return this.filterBasedOnZoomDomain(r)}render(t){if(!(y(this.getOptions(),"points","enabled")||y(this.getOptions(),"bubble","enabled")))return;const n=this.getComponentContainer({ariaLabel:"scatter points",withinChartClip:!0}),r=this.getOptions(),{groupMapsTo:i}=r.data,{cartesianScales:s}=this.services;if(!s)throw new Error("Services cartesianScales are undefined.");const a=s.getDomainIdentifier(),o=n.selectAll("circle.dot").data(this.getScatterData(),c=>`${c[i]}-${c[a]}`);o.exit().attr("opacity",0).remove();const l=o.enter().append("circle").classed("dot",!0).attr("opacity",0).merge(o);this.styleCircles(l,t),this.addEventListeners()}isDatapointThresholdAnomaly(t){const{handleThresholds:n}=this.configs;if(!n)return!1;const{cartesianScales:r}=this.services;if(!r)throw new Error("Cartesian scales service is undefined");const i=r.getOrientation(),[s,a]=bn(r.getHighestDomainThreshold(),r.getHighestRangeThreshold(),i),[o,l]=bn(d=>r.getDomainValue(d),d=>r.getRangeValue(d),i),c=o(t),u=l(t);return a&&s?u<=a.scaleValue&&c>=s.scaleValue:a?u<=a.scaleValue:s?c>=s.scaleValue:!1}styleCircles(t,n){const r=this.getOptions(),{filled:i,fillOpacity:s}=r.points,{cartesianScales:a}=this.services;if(!a)throw new Error("Cartesian scales service is undefined");const{groupMapsTo:o}=r.data,l=p=>a.getDomainValue(p),c=p=>a.getRangeValue(p),[u,d]=bn(l,c,a.getOrientation()),{fadeInOnChartHolderMouseover:h}=this.configs;t.raise().classed("dot",!0).attr("class",p=>{const f=a.getDomainIdentifier(p),g=this.model.getIsFilled(p[o],p[f],p,i)?[st.FILL,st.STROKE]:[st.STROKE];return this.model.getColorClassName({classNameTypes:g,dataGroupName:p[o],originalClassName:"dot"})||""}).classed("threshold-anomaly",p=>this.isDatapointThresholdAnomaly(p)).classed("filled",p=>{const f=a.getDomainIdentifier(p);return this.model.getIsFilled(p[o],p[f],p,i)}).classed("unfilled",p=>{const f=a.getDomainIdentifier(p);return!this.model.getIsFilled(p[o],p[f],p,i)}).transition().call(p=>{var f;return(f=this.services.transitions)==null?void 0:f.setupTransition({transition:p,name:"scatter-update-enter",animate:n})}).attr("cx",u).attr("cy",d).attr("r",r.points.radius).style("fill",p=>{const f=a.getDomainIdentifier(p);if(this.model.getIsFilled(p[o],p[f],p,i))return this.model.getFillColor(p[o],p[f],p)}).style("stroke",p=>{const f=a.getDomainIdentifier(p);return this.model.getStrokeColor(p[o],p[f],p)}).attr("fill-opacity",i?s:1).attr("opacity",h?0:1).attr("role",ht.GRAPHICS_SYMBOL).attr("aria-roledescription","point").attr("aria-label",p=>{const f=a.getRangeIdentifier(p);return p[f]}),this.addEventListeners()}getTooltipAdditionalItems(t){return null}addEventListeners(){const t=this,{groupMapsTo:n}=t.getOptions().data;if(!this.parent)throw new Error("Parent not defined");this.parent.selectAll("circle").on("mouseover",function(r,i){var s,a;const o=I(this);o.classed("hovered",!0).attr("class",l=>t.model.getColorClassName({classNameTypes:[st.FILL],dataGroupName:l[n],originalClassName:o.attr("class")})).style("fill",l=>{var c;const u=(c=t.services.cartesianScales)==null?void 0:c.getDomainIdentifier(l);return t.model.getFillColor(l[n],l[u],l)}).classed("unfilled",!1),(s=t.services.events)==null||s.dispatchEvent(T.Tooltip.SHOW,{event:r,hoveredElement:o,data:[i],additionalItems:t.getTooltipAdditionalItems(i)}),(a=t.services.events)==null||a.dispatchEvent(T.Scatter.SCATTER_MOUSEOVER,{event:r,element:o,datum:i})}).on("mousemove",function(r,i){var s,a;const o=I(this);(s=t.services.events)==null||s.dispatchEvent(T.Scatter.SCATTER_MOUSEMOVE,{event:r,element:o,datum:i}),(a=t.services.events)==null||a.dispatchEvent(T.Tooltip.MOVE,{event:r})}).on("click",function(r,i){var s;(s=t.services.events)==null||s.dispatchEvent(T.Scatter.SCATTER_CLICK,{event:r,element:I(this),datum:i})}).on("mouseout",function(r,i){var s,a,o;const l=I(this);if(l.classed("hovered",!1),!t.configs.filled){const{filled:c}=t.getOptions().points,u=(s=t.services.cartesianScales)==null?void 0:s.getDomainIdentifier(i),d=t.model.getIsFilled(i[n],i[u],i,c);l.classed("unfilled",!d).style("fill",h=>d||c?t.model.getFillColor(h[n],h[u],h):null)}(a=t.services.events)==null||a.dispatchEvent(T.Scatter.SCATTER_MOUSEOUT,{event:r,element:l,datum:i}),(o=t.services.events)==null||o.dispatchEvent(T.Tooltip.HIDE,{hoveredElement:l})})}destroy(){var t;(t=this.parent)==null||t.selectAll("circle").on("mousemove",null).on("mouseout",null);const{events:n}=this.services;if(!n)throw new Error("Services events undefined");n.removeEventListener(T.Legend.ITEM_HOVER,this.handleLegendOnHover),n.removeEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut),n.removeEventListener(T.Chart.MOUSEOVER,this.handleChartHolderOnHover),n.removeEventListener(T.Chart.MOUSEOUT,this.handleChartHolderOnMouseOut)}};class Ug extends gt{constructor(t,n,r){super(t,n,r),this.type="axes",this.renderType=it.SVG,this.truncation={[z.LEFT]:!1,[z.RIGHT]:!1,[z.TOP]:!1,[z.BOTTOM]:!1},r&&(this.configs=r),this.margins=this.configs.margins}render(t=!0){const{position:n}=this.configs,r=this.getOptions(),i=y(r,"axes",n,"visible"),s=this.getComponentContainer({ariaLabel:"axes"}),{width:a,height:o}=N.getSVGElementSize(s,{useAttrs:!0}),l=N.appendOrSelect(s,`g.axis.${n}`);let c,u;if(n===z.BOTTOM||n===z.TOP?(c=this.configs.axes[z.LEFT]?this.margins.left:0,u=this.configs.axes[z.RIGHT]?a-this.margins.right:a):(c=o-this.margins.bottom,u=this.margins.top),!this.services.cartesianScales)throw new Error("Services cartesianScales undefined");const d=this.services.cartesianScales.getScaleByPosition(n);this.scaleType===nt.LABELS||this.scaleType===nt.LABELS_RATIO?d.rangeRound([c,u]):d.range([c,u]);let h;switch(n){case z.LEFT:h=Jf;break;case z.BOTTOM:h=fc;break;case z.RIGHT:h=kC;break;case z.TOP:h=LC;break}l.attr("aria-label",`${n} axis`);const p=!l.select("g.ticks").empty();let f=N.appendOrSelect(l,"g.ticks");p||(f.attr("role",`${ht.GRAPHICS_OBJECT} ${ht.GROUP}`),f.attr("aria-label",`${n} ticks`));const g=N.appendOrSelect(l,"g.ticks.invisible").style("opacity","0").style("pointer-events","none").attr("aria-hidden",!0).attr("aria-label",`invisible ${n} ticks`),m=y(r,"axes",n),v=this.scaleType===nt.TIME||m.scaleType===nt.TIME,x=n===z.LEFT||n===z.RIGHT,_=this.model.get("zoomDomain");if(_&&v&&!x&&d.domain(_),!i){f.attr("aria-hidden",!0);return}const E=y(m,"scaleType"),b=y(r,"data","loading"),S=y(m,"ticks","number"),M=y(m,"ticks","values"),D=y(m,"truncation","type"),A=y(m,"truncation","threshold"),R=y(m,"truncation","numCharacter"),$=S!==null,H=y(r,"timeScale"),P=N.appendOrSelect(g,"g.tick"),B=N.appendOrSelect(P,"text").text("0"),O=N.getSVGElementSize(B.node(),{useBBox:!0}).height;P.remove();const w=this.scaleType||m.scaleType||nt.LINEAR,L=h(d).tickSizeOuter(0);if(d.ticks){let Y;if($?Y=S:(Y=Nn.ticks.number,x&&(Y=this.getNumberOfFittingTicks(o,O,Nn.ticks.verticalSpaceRatio))),d.ticks().length===1&&d.ticks()[0]===0&&(Y=0),L.ticks(Y),v)if(!d.ticks(Y).length)L.tickValues([]);else{const et=y(r,"timeScale","addSpaceOnEdges"),ut=y(r,"axes",n,"domain"),F=d.copy();et&&!ut&&F.nice(Y);const q=F.ticks(Y);et&&q.length>2&&!ut&&(q.splice(q.length-1,1),q.splice(0,1)),L.tickValues(q)}}let k;const U=y(m,"ticks","formatter"),{code:K,number:W}=y(r,"locale");if(v){const Y=jl(L.tickValues(),y(r,"timeScale","timeInterval"));U===null?k=(et,ut)=>Fl(et,ut,L.tickValues(),Y,H,r.locale):k=(et,ut)=>{const F=Fl(et,ut,L.tickValues(),Y,H,r.locale);return U(et,ut,F)}}else U===null?w===nt.LINEAR&&(k=Y=>W(Y,K)):k=U;L.tickFormat(k);const[j,X]=this.services.cartesianScales.getScaleByPosition(n).domain();let ct;if(M){if(v)M.forEach((Y,et)=>{Y.getTime===void 0&&(M[et]=new Date(Y))}),ct=M.filter(Y=>{const et=Y.getTime();return et>=new Date(j).getTime()&&et<=new Date(X).getTime()});else if(E===nt.LABELS){const Y=this.services.cartesianScales.getScaleByPosition(n).domain();ct=M.filter(et=>Y.includes(et))}else ct=M.filter(Y=>Y>=j&&Y<=X);L.tickValues(ct)}switch(n){case z.LEFT:f.attr("transform",`translate(${this.margins.left}, 0)`);break;case z.BOTTOM:f.attr("transform",`translate(0, ${o-this.margins.bottom})`);break;case z.RIGHT:f.attr("transform",`translate(${a-this.margins.right}, 0)`);break;case z.TOP:f.attr("transform",`translate(0, ${this.margins.top})`);break}const J=this.model.isDataEmpty();if(m.title){const Y=N.appendOrSelect(l,"text.axis-title").html(J||b?"":ln(m.title)),et=y(m,"titleOrientation");let ut;switch(n){case z.LEFT:et===Cs.RIGHT?Y.attr("transform","rotate(90)").attr("y",0).attr("x",d.range()[0]/2).attr("dy","-0.5em").style("text-anchor","middle"):Y.attr("transform","rotate(-90)").attr("y",0).attr("x",-(d.range()[0]/2)).attr("dy","0.75em").style("text-anchor","middle");break;case z.BOTTOM:Y.attr("transform",`translate(${this.margins.left/2+d.range()[1]/2}, ${o+4})`).style("text-anchor","middle");break;case z.RIGHT:et===Cs.LEFT?Y.attr("transform","rotate(-90)").attr("y",a).attr("x",-(d.range()[0]/2)).style("text-anchor","middle"):Y.attr("transform","rotate(90)").attr("y",-a).attr("x",d.range()[0]/2).attr("dy","0.75em").style("text-anchor","middle");break;case z.TOP:ut=N.getSVGElementSize(Y,{useBBox:!0}).height,Y.attr("transform",`translate(${this.margins.left/2+d.range()[1]/2}, ${ut/2})`).style("text-anchor","middle");break}}if(v){const Y=jl(L.tickValues(),y(r,"timeScale","timeInterval")),et=H.showDayName,ut=f;t&&(f=f.transition().call(F=>this.services.transitions.setupTransition({transition:F,name:"axis-update",animate:t}))),f=f.call(L),ut.selectAll(".tick").data(L.tickValues(),d).order().select("text").attr("class",(F,q)=>Rp(F,q,L.tickValues(),Y,et)?"tick-label--primary":"tick-label")}else!t||!p?f=f.call(L):f=f.transition().call(Y=>this.services.transitions.setupTransition({transition:Y,name:"axis-update",animate:t})).call(L);if(g.call(L),n===z.BOTTOM||n===z.TOP){let Y=!1;const et=y(m,"ticks","rotation");if(et===fi.ALWAYS)Y=!0;else if(et===fi.NEVER)Y=!1;else if(!et||et===fi.AUTO)if(d.step)Y=g.selectAll("g.tick text").nodes().some(ut=>N.getSVGElementSize(ut,{useBBox:!0}).width>=d.step());else{Y=!1;const ut=g.append("text").text("A"),F=N.getSVGElementSize(ut.node(),{useBBox:!0}).width;let q;g.selectAll("g.tick").each(function(){const Z=I(this),G=parseFloat(y(xn(this),"tx"));G!==null&&q+Z.text().length*F*.8>=G&&(Y=!0),q=G}),ut.remove()}Y?($||(L.ticks(this.getNumberOfFittingTicks(a,O,Nn.ticks.horizontalSpaceRatio)),g.call(L),f.call(L)),l.selectAll("g.ticks g.tick text").attr("transform","rotate(-45)").attr("text-anchor",n===z.TOP?"start":"end")):l.selectAll("g.ticks g.tick text").attr("transform",null).attr("text-anchor",null)}if(b?l.attr("opacity",0):l.attr("opacity",1),f.selectAll("g.tick").attr("aria-label",Y=>Y),g.selectAll("g.tick").attr("aria-label",Y=>Y),D!==we.NONE&&E===nt.LABELS&&!M){const Y=this.services.cartesianScales.getScaleDomain(n);if(Y.length>0){const et=s.select(`g.axis.${n} g.ticks g.tick`).html();l.selectAll("g.ticks g.tick").html(et);const ut=this;l.selectAll("g.tick text").data(Y).text(function(F){return F.length>A?(ut.truncation[n]=!0,ji(F,D,R)):F}),this.getInvisibleAxisRef().selectAll("g.tick text").data(Y).text(function(F){return F.length>A?ji(F,D,R):F}),l.selectAll("g.ticks").html(this.getInvisibleAxisRef().html()),l.selectAll("g.tick text").data(Y)}}this.addEventListeners()}addEventListeners(){const t=this.getComponentContainer(),{position:n}=this.configs,r=N.appendOrSelect(t,`g.axis.${n}`),i=this.getOptions(),s=y(i,"axes",n),a=y(s,"scaleType"),o=y(s,"truncation","threshold"),l=this;r.selectAll("g.tick text").on("mouseover",function(c,u){l.services.events.dispatchEvent(T.Axis.LABEL_MOUSEOVER,{event:c,element:I(this),datum:u}),a===nt.LABELS&&u.length>o&&l.services.events.dispatchEvent(T.Tooltip.SHOW,{event:c,hoveredElement:I(this),content:u})}).on("mousemove",function(c,u){l.services.events.dispatchEvent(T.Axis.LABEL_MOUSEMOVE,{event:c,element:I(this),datum:u}),a===nt.LABELS&&u.length>o&&l.services.events.dispatchEvent(T.Tooltip.MOVE,{event:c})}).on("click",function(c,u){l.services.events.dispatchEvent(T.Axis.LABEL_CLICK,{event:c,element:I(this),datum:u})}).on("mouseout",function(c,u){l.services.events.dispatchEvent(T.Axis.LABEL_MOUSEOUT,{event:c,element:I(this),datum:u}),a===nt.LABELS&&l.services.events.dispatchEvent(T.Tooltip.HIDE)})}getInvisibleAxisRef(){const{position:t}=this.configs;return this.getComponentContainer().select(`g.axis.${t} g.ticks.invisible`)}getTitleRef(){const{position:t}=this.configs;return this.getComponentContainer().select(`g.axis.${t} text.axis-title`)}getNumberOfFittingTicks(t,n,r){const i=Math.floor(t/(n*r));return Xf(i,2,Nn.ticks.number)}destroy(){const t=this.getComponentContainer(),{position:n}=this.configs;N.appendOrSelect(t,`g.axis.${n}`).selectAll("g.tick text").on("mouseover",null).on("mousemove",null).on("mouseout",null)}}class tD extends Ug{constructor(t,n,r){super(t,n,r)}render(t=!0){super.render(t),super.destroy();const n=this.configs.position,r=this.getComponentContainer({ariaLabel:"axes"}),i=N.appendOrSelect(r,`g.axis.${n}`),s=this;i.selectAll("g.tick").each(function(a,o){const l=I(this);l.classed("tick-hover",!0).attr("tabindex",o===0?0:-1);const c=l.select("text"),{width:u,height:d}=N.getSVGElementSize(c,{useBBox:!0}),h=N.appendOrSelect(l,"rect.axis-holder");let p=0,f=0;switch(n){case z.LEFT:p=-u+Number(c.attr("x")),f=-(d/2);break;case z.RIGHT:p=Math.abs(Number(c.attr("x"))),f=-(d/2);break;case z.TOP:p=-(u/2),f=-d+Number(c.attr("y"))/2,s.truncation[n]&&(p=0,h.attr("transform","rotate(-45)"));break;case z.BOTTOM:p=-(u/2),f=d/2-2,s.truncation[n]&&(p=-u,h.attr("transform","rotate(-45)"));break}h.attr("x",p-Nn.hover.rectanglePadding).attr("y",f).attr("width",u+Nn.hover.rectanglePadding*2).attr("height",d).lower()}),this.addEventListeners()}addEventListeners(){const t=this.getComponentContainer(),{position:n}=this.configs,r=N.appendOrSelect(t,`g.axis.${n}`),i=this.getOptions(),s=y(i,"axes",n),a=y(s,"scaleType"),o=y(s,"truncation","threshold"),l=this;r.selectAll("g.tick.tick-hover").on("mouseover",function(c){const u=I(this).select("text"),d=u.datum();l.services.events.dispatchEvent(T.Axis.LABEL_MOUSEOVER,{event:c,element:u,datum:d}),a===nt.LABELS&&d.length>o&&l.services.events.dispatchEvent(T.Tooltip.SHOW,{event:c,element:u,datum:d})}).on("mousemove",function(c){const u=I(this).select("text"),d=u.datum();l.services.events.dispatchEvent(T.Axis.LABEL_MOUSEMOVE,{event:c,element:u,datum:d}),l.services.events.dispatchEvent(T.Tooltip.MOVE,{event:c})}).on("click",function(c){l.services.events.dispatchEvent(T.Axis.LABEL_CLICK,{event:c,element:I(this).select("text"),datum:I(this).select("text").datum()})}).on("mouseout",function(c){l.services.events.dispatchEvent(T.Axis.LABEL_MOUSEOUT,{event:c,element:I(this).select("text"),datum:I(this).select("text").datum()}),a===nt.LABELS&&l.services.events.dispatchEvent(T.Tooltip.HIDE)}).on("focus",function(c){const u={clientX:0,clientY:0};if(c.target){c.target.focus();const d=c.target.getBoundingClientRect();u.clientX=d.x,u.clientY=d.y}l.services.events.dispatchEvent(T.Axis.LABEL_FOCUS,{event:{...c,...u},element:I(this),datum:I(this).select("text").datum()})}).on("blur",function(c){l.services.events.dispatchEvent(T.Axis.LABEL_BLUR,{event:c,element:I(this),datum:I(this).select("text").datum()})}).on("keydown",function(c){c.key&&c.key==="Escape"&&(l.services.events.dispatchEvent(T.Tooltip.HIDE),l.services.events.dispatchEvent(T.Axis.LABEL_BLUR,{event:c,element:I(this),datum:I(this).select("text").datum()})),n===z.LEFT||n===z.RIGHT?c.key&&c.key==="ArrowUp"?l.goNext(this,c):c.key&&c.key==="ArrowDown"&&l.goPrevious(this,c):c.key&&c.key==="ArrowLeft"?l.goPrevious(this,c):c.key&&c.key==="ArrowRight"&&l.goNext(this,c)})}goNext(t,n){t.nextElementSibling&&t.nextElementSibling.tagName!=="path"&&t.nextElementSibling.dispatchEvent(new Event("focus")),n.preventDefault()}goPrevious(t,n){t.previousElementSibling&&t.previousElementSibling.tagName!=="path"&&t.previousElementSibling.dispatchEvent(new Event("focus")),n.preventDefault()}destroy(){const t=this.getComponentContainer(),{position:n}=this.configs;N.appendOrSelect(t,`g.axis.${n}`).selectAll("g.tick.tick-hover").on("mouseover",null).on("mousemove",null).on("mouseout",null).on("focus",null).on("blur",null)}}class me extends gt{constructor(){super(...arguments),this.type="2D-axes",this.renderType=it.SVG,this.children={},this.thresholds=[],this.margins={top:0,right:0,bottom:0,left:0}}render(t=!1){const n={},r=Object.keys(z),i=y(this.getOptions(),"axes");r.forEach(a=>{i[z[a]]&&(n[z[a]]=!0)}),this.configs.axes=n,r.forEach(a=>{const o=z[a];if(this.configs.axes[o]&&!this.children[o]){const l={position:o,axes:this.configs.axes,margins:this.margins},c=this.model.axisFlavor===gi.DEFAULT?new Ug(this.model,this.services,l):new tD(this.model,this.services,l);c.setModel(this.model),c.setServices(this.services),c.setParent(this.parent),this.children[o]=c}}),Object.keys(this.children).forEach(a=>{this.children[a].render(t)});const s={};Object.keys(this.children).forEach(a=>{const o=this.children[a],l=o.configs.position,c=o.getInvisibleAxisRef(),{width:u,height:d}=N.getSVGElementSize(c,{useBBox:!0});let h;switch(o.getTitleRef().empty()?h=0:(h=N.getSVGElementSize(o.getTitleRef(),{useBBox:!0}).height,(l===z.LEFT||l===z.RIGHT)&&(h+=5)),l){case z.TOP:s.top=d+h;break;case z.BOTTOM:s.bottom=d+h;break;case z.LEFT:s.left=u+h;break;case z.RIGHT:s.right=u+h;break}}),this.services.events.dispatchEvent(T.Axis.RENDER_COMPLETE),Object.keys(s).some(a=>this.margins[a]!==s[a])&&(this.margins=Object.assign(this.margins,s),this.model.set({axesMargins:this.margins},{skipUpdate:!0}),this.services.events.dispatchEvent(T.ZoomBar.UPDATE),Object.keys(this.children).forEach(a=>{const o=this.children[a];o.margins=this.margins}),this.render(!0))}}class ce extends gt{constructor(){super(...arguments),this.type="skeleton"}render(t=!0){const n=y(this.getOptions(),"data","loading");n?this.renderSkeleton(n):this.removeSkeleton()}renderSkeleton(t){if(this.configs.skeleton===Ft.GRID)this.renderGridSkeleton(t);else if(this.configs.skeleton===Ft.VERT_OR_HORIZ)this.renderVertOrHorizSkeleton(t);else if(this.configs.skeleton===Ft.PIE)this.renderPieSkeleton(t);else if(this.configs.skeleton===Ft.DONUT)this.renderDonutSkeleton(t);else throw new Error(`"${this.configs.skeleton}" is not a valid Skeleton type.`)}renderGridSkeleton(t){this.setScales(),this.drawBackdrop(t),this.drawXGrid(t),this.drawYGrid(t),t&&this.setShimmerEffect("shimmer-lines")}renderVertOrHorizSkeleton(t){const n=this.services.cartesianScales.getOrientation();this.setScales(),this.drawBackdrop(t),n===Gt.VERTICAL&&this.drawYGrid(t),n===Gt.HORIZONTAL&&this.drawXGrid(t),this.setShimmerEffect("shimmer-lines")}renderPieSkeleton(t){const n=this.computeOuterRadius();this.drawRing(n,0,t),t&&this.setShimmerEffect("shimmer-areas")}renderDonutSkeleton(t){const n=this.computeOuterRadius(),r=this.computeInnerRadius();this.drawRing(n,r,t),t&&this.setShimmerEffect("shimmer-areas")}setScales(){const t=this.services.cartesianScales.getMainXScale().range(),n=this.services.cartesianScales.getMainYScale().range();this.xScale=je().domain([0,1]).range(t),this.yScale=je().domain([0,1]).range(n)}drawBackdrop(t){const n=this.parent,{width:r,height:i}=N.getSVGElementSize(n,{useAttrs:!0});this.backdrop=N.appendOrSelect(n,"svg.chart-skeleton.DAII").attr("width",r).attr("height",i);const s=N.appendOrSelect(this.backdrop,"rect.chart-skeleton-backdrop");s.attr("width","100%").attr("height","100%");const[a]=this.xScale.range(),[,o]=this.yScale.range();this.backdrop.merge(s).attr("x",a).attr("y",o),s.classed("shimmer-effect-lines",t).classed("empty-state-lines",!t).style("stroke",t?`url(#${this.services.domUtils.generateElementIDString("shimmer-lines")})`:null)}drawXGrid(t){const n=+this.backdrop.attr("width"),r=y(this.getOptions(),"grid","x","numberOfTicks"),i=this.xScale.ticks(r).map(o=>o*n),s=N.appendOrSelect(this.backdrop,"g.x.skeleton"),a=s.selectAll("line").data(i);a.enter().append("line").merge(a).attr("x1",o=>o).attr("x2",o=>o).attr("y1",0).attr("y2","100%"),s.selectAll("line").classed("shimmer-effect-lines",t).classed("empty-state-lines",!t).style("stroke",t?`url(#${this.services.domUtils.generateElementIDString("shimmer-lines")})`:null)}drawYGrid(t){const n=+this.backdrop.attr("height"),r=this.backdrop.attr("width"),i=y(this.getOptions(),"grid","y","numberOfTicks"),s=this.xScale.ticks(i).map(l=>l*n),a=N.appendOrSelect(this.backdrop,"g.y.skeleton"),o=a.selectAll("line").data(s);o.enter().append("line").merge(o).attr("x1",0).attr("x2",r).attr("y1",l=>l).attr("y2",l=>l),a.selectAll("line").classed("shimmer-effect-lines",t).classed("empty-state-lines",!t).style("stroke",t?`url(#${this.services.domUtils.generateElementIDString("shimmer-lines")})`:null)}drawRing(t,n,r=!0){const i=this.parent,{width:s,height:a}=N.getSVGElementSize(i,{useAttrs:!0}),o=N.appendOrSelect(i,"svg.chart-skeleton").attr("width",s).attr("height",a),l=n===0?"pie":"donut",c=y(this.getOptions(),l,"alignment");N.appendOrSelect(o,"rect.chart-skeleton-area-container").attr("width",s).attr("height",a).attr("fill","none");const u=fs().innerRadius(n).outerRadius(t).startAngle(0).endAngle(Math.PI*2),d=t+Math.abs(Lt.radiusOffset),h=t+(Math.min(s,a)-t*2)/2,p=N.appendOrSelect(o,"path").attr("class","skeleton-area-shape").attr("transform",`translate(${d}, ${h})`).attr("d",u).classed("shimmer-effect-areas",r).classed("empty-state-areas",!r).style("fill",r?`url(#${this.services.domUtils.generateElementIDString("shimmer-areas")})`:null);let f=t+Lt.xOffset;c===zt.CENTER?f=s/2:c===zt.RIGHT&&(f=s-t-Lt.xOffset);const g=t+Lt.yOffset;p.attr("transform",`translate(${f}, ${g})`)}computeOuterRadius(){const{width:t,height:n}=N.getSVGElementSize(this.parent,{useAttrs:!0});return Math.min(t,n)/2+Lt.radiusOffset}computeInnerRadius(){return this.computeOuterRadius()*(3/4)}setShimmerEffect(t){const n="stop-bg-shimmer",r="stop-shimmer",i=this.parent.select(".chart-skeleton"),{width:s}=N.getSVGElementSize(this.parent,{useAttrs:!0}),a=0,o=s,l=N.appendOrSelect(i,"defs").lower(),c=N.appendOrSelect(l,"linearGradient").attr("id",this.services.domUtils.generateElementIDString(t)).attr("class",t).attr("x1",a-3*.2*s).attr("x2",o).attr("y1",0).attr("y2",0).attr("gradientUnits","userSpaceOnUse").attr("gradientTransform","translate(0, 0)"),u=`
|
|
65
|
+
</svg>`}destroy(){this.parent.selectAll("path.line,.node-group").on("mouseover",null).on("mousemove",null).on("click",null).on("mouseout",null)}}class Se extends gt{constructor(){super(...arguments),this.type="grid",this.renderType=it.SVG}render(t=!0){const n=y(this.getOptions(),"grid","x","enabled"),r=y(this.getOptions(),"grid","y","enabled");this.drawBackdrop(n,r),!(!n&&!r)&&(n&&(N.appendOrSelect(this.backdrop,"g.x.grid"),this.drawXGrid(t)),r&&(N.appendOrSelect(this.backdrop,"g.y.grid"),this.drawYGrid(t)))}drawXGrid(t){const n=this.parent,r=this.backdrop.attr("height"),i=this.services.cartesianScales.getMainXScale(),s=fc(i).tickSizeInner(-r).tickSizeOuter(0);if(y(this.getOptions(),"grid","x","alignWithAxisTicks")){const o=this.services.cartesianScales.getDomainAxisPosition(),l=y(this.getOptions(),"axes",o,"ticks","values");l&&s.tickValues(l)}else{const o=y(this.getOptions(),"grid","x","numberOfTicks");s.ticks(o)}const a=n.select(".x.grid").attr("transform",`translate(${-this.backdrop.attr("x")}, ${r})`);t?a.transition().call(o=>this.services.transitions.setupTransition({transition:o,name:"grid-update",animate:t})).call(s):a.call(s),this.cleanGrid(a)}drawYGrid(t){const n=this.parent,r=this.backdrop.attr("width"),i=this.services.cartesianScales.getMainYScale(),s=Jf(i).tickSizeInner(-r).tickSizeOuter(0);if(y(this.getOptions(),"grid","y","alignWithAxisTicks")){const o=this.services.cartesianScales.getRangeAxisPosition(),l=y(this.getOptions(),"axes",o,"ticks","values");l&&s.tickValues(l)}else{const o=y(this.getOptions(),"grid","y","numberOfTicks");s.ticks(o)}const a=n.select(".y.grid").attr("transform",`translate(0, ${-this.backdrop.attr("y")})`);t?a.transition().call(o=>this.services.transitions.setupTransition({transition:o,name:"grid-update",animate:t})).call(s):a.call(s),this.cleanGrid(a)}getGridlineThreshold(t){const n=this.parent,r=n.selectAll(".x.grid .tick").nodes().sort((u,d)=>Number(xn(u).tx)-Number(xn(d).tx));let i=-1;if(!r.length)return;r.forEach(u=>{t[0]>=+xn(u).tx&&i++});const s=i+1<r.length?i+1:r.length,a=r[i],o=r[s];let l;if(!a)l=+xn(o).tx;else if(o)l=+xn(o).tx-+xn(a).tx;else{const u=n.select("rect.chart-grid-backdrop").node();l=N.getSVGElementSize(u).width-+xn(a).tx}const{threshold:c}=this.getOptions().tooltip.gridline;return l*c}getActiveGridline(t){const n=y(this.getOptions,"tooltip","gridline","threshold"),r=n||this.getGridlineThreshold(t);return this.parent.selectAll(".x.grid .tick").filter(function(){const i=xn(this),s={min:Number(i.tx)-r,max:Number(i.tx)+r};return s.min<=t[0]&&t[0]<=s.max})}drawBackdrop(t,n){const r=this.parent,i=this.services.cartesianScales.getMainXScale(),s=this.services.cartesianScales.getMainYScale(),[a,o]=i.range(),[l,c]=s.range();this.backdrop=N.appendOrSelect(r,"svg.chart-grid-backdrop").attr("role","presentation");const u=N.appendOrSelect(this.backdrop,t||n?"rect.chart-grid-backdrop.stroked":"rect.chart-grid-backdrop");this.backdrop.merge(u).attr("x",a).attr("y",c).attr("width",Math.abs(o-a)).attr("height",Math.abs(l-c)).lower(),u.attr("width","100%").attr("height","100%")}cleanGrid(t){t.selectAll("text").remove(),t.select(".domain").remove()}}class Ng extends gt{constructor(){super(...arguments),this.type="area",this.renderType=it.SVG,this.gradient_id="gradient-id-"+Math.floor(Math.random()*99999999999),this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail;this.parent.selectAll("path.area").transition("legend-hover-area").call(r=>this.services.transitions.setupTransition({transition:r,name:"legend-hover-area"})).attr("opacity",r=>r.name!==n.datum().name?vn.opacity.unselected:vn.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",vn.opacity.selected)}}init(){const t=this.services.events;t.addEventListener(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t=!0){const n=this.getComponentContainer({ariaLabel:"area graphs",withinChartClip:!0}),r=this.getOptions();let i=[0,0];const{cartesianScales:s}=this.services,a=s.getOrientation(),o=tu().curve(this.services.curves.getD3Curve()).defined(b=>{const S=s.getRangeIdentifier();return b[S]!=null}),l=this.model.getGroupedData(this.configs.groups),c=y(r,"bounds"),u=c&&l&&l.length===1;!u&&c&&console.warn(`Bounds can only be shown when having 1 single datagroup, you've supplied ${l.length}`);let d=0;const h=(b,S)=>{y(r,"axes",b,"includeZero")===!1&&S[0]>0&&S[1]>0&&(d=S[0])},p=b=>u?s.getBoundedScaledValues(b)[0]:s.getRangeValue(d),f=b=>u?s.getBoundedScaledValues(b)[1]:s.getRangeValue(b);a===Gt.VERTICAL?(i=s.getMainYScale().domain(),h(s.getMainYAxisPosition(),i),o.x(b=>s.getDomainValue(b)).y0(b=>p(b)).y1(b=>f(b))):(i=s.getMainXScale().domain(),h(s.getMainXAxisPosition(),i),o.x0(b=>p(b)).x1(b=>f(b)).y(b=>s.getDomainValue(b)));const g=y(r,"color","gradient","enabled"),m=l&&l.length===1&&g;l.length>1&&g&&console.error("Gradients can only be enabled when having 1 single dataset");const v=n.selectAll("path.area").data(l,b=>b.name),x=I(this.services.domUtils.getMainContainer());if(v.exit().attr("opacity",0).remove(),!l.length)return;if(m){const b=x.select(`path.${this.model.getColorClassName({classNameTypes:[st.STROKE],dataGroupName:l[0].name})}`).node();let S;if(b)S=getComputedStyle(b,null).getPropertyValue("stroke");else{const M=y(this.model.getOptions(),"color","scale");if(M!==null){const D=Object.keys(M);S=M[D[0]]}}dc.appendOrUpdateLinearGradient({svg:this.parent,id:this.services.domUtils.generateElementIDString(`${l[0].name.replace(" ","")}_${this.gradient_id}`),x1:"0%",x2:"0%",y1:"0%",y2:"100%",stops:dc.getStops(i,S)})}else this.parent.selectAll("defs linearGradient").empty()||this.parent.selectAll("defs linearGradient").each(function(){this.parentNode.remove()});const _=this,E=v.enter().append("path");m?E.merge(v).style("fill",b=>`url(#${this.services.domUtils.generateElementIDString(`${b.name.replace(" ","")}_${this.gradient_id}`)})`).attr("class","area").attr("class",b=>this.model.getColorClassName({classNameTypes:[st.FILL],dataGroupName:b.name,originalClassName:"area"})).attr("d",b=>{const{data:S}=b;return o(S)}):(E.attr("opacity",0).merge(v).attr("class","area").attr("class",b=>this.model.getColorClassName({classNameTypes:[st.FILL,st.STROKE],dataGroupName:b.name,originalClassName:"area"})).style("fill",b=>_.model.getFillColor(b.name,null,b.data)).transition().call(b=>this.services.transitions.setupTransition({transition:b,name:"area-update-enter",animate:t})).attr("opacity",u?1:vn.opacity.selected).attr("d",b=>{const{data:S}=b;return o(S)}),u&&E.attr("fill-opacity",vn.opacity.selected).style("stroke",b=>_.model.getStrokeColor(b.name,null,b.data)).style("stroke-dasharray","2, 2").attr("stroke-width",.7+"px"))}destroy(){const t=this.services.events;t.removeEventListener(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}}class ai extends gt{constructor(){super(...arguments),this.type="line",this.renderType=it.SVG,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail;this.parent.selectAll("path.line").transition("legend-hover-line").call(r=>this.services.transitions.setupTransition({transition:r,name:"legend-hover-line"})).attr("opacity",r=>r.name!==n.datum().name?yn.opacity.unselected:yn.opacity.selected)},this.handleLegendMouseOut=()=>{this.parent.selectAll("path.line").transition("legend-mouseout-line").call(t=>this.services.transitions.setupTransition({transition:t,name:"legend-mouseout-line"})).attr("opacity",yn.opacity.selected)}}init(){const{events:t}=this.services;t.addEventListener(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t=!0){const n=this.getComponentContainer({ariaLabel:"lines",withinChartClip:!0}),{cartesianScales:r,curves:i}=this.services,s=p=>r.getDomainValue(p),a=p=>r.getRangeValue(p),[o,l]=bn(s,a,r.getOrientation()),c=this.getOptions(),u=ms().x(o).y(l).curve(i.getD3Curve()).defined(p=>{const f=r.getRangeIdentifier(p);return p[f]!=null});let d=[];if(this.configs.stacked){const p=Object.keys(c.axes).some(g=>c.axes[g].percentage),{groupMapsTo:f}=c.data;d=this.model.getStackedData({groups:this.configs.groups,percentage:p}).map(g=>{const m=this.services.cartesianScales.getDomainIdentifier(g),v=this.services.cartesianScales.getRangeIdentifier(g);return{name:y(g,0,f),data:g.map(x=>({[m]:x.data.sharedStackKey,[f]:x[f],[v]:x[1]})),hidden:!OC(g,x=>x[0]!==x[1])}})}else d=this.model.getGroupedData(this.configs.groups);const h=n.selectAll("path.line").data(d,p=>p.name);h.exit().attr("opacity",0).remove(),h.enter().append("path").classed("line",!0).attr("opacity",0).merge(h).data(d,p=>p.name).attr("class",p=>this.model.getColorClassName({classNameTypes:[st.STROKE],dataGroupName:p.name,originalClassName:"line"})).style("stroke",p=>this.model.getStrokeColor(p.name,null,p.data)).attr("role",ht.GRAPHICS_SYMBOL).attr("aria-roledescription","line").attr("aria-label",p=>{const{data:f}=p;return f.map(g=>{const m=this.services.cartesianScales.getRangeIdentifier(g);return g[m]}).join(",")}).transition().call(p=>this.services.transitions.setupTransition({transition:p,name:"line-update-enter",animate:t})).attr("opacity",p=>p.hidden?0:1).attr("d",p=>{const{data:f}=p;return u(f)})}destroy(){const t=this.services.events;t.removeEventListener(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}}const Pg=5;function Jk(e,t){return e>t-Pg&&e<t+Pg}class Gn extends gt{constructor(){super(...arguments),this.type="ruler",this.renderType=it.SVG,this.isXGridEnabled=y(this.getOptions(),"grid","x","enabled"),this.isYGridEnabled=y(this.getOptions(),"grid","y","enabled"),this.isEventListenerAdded=!1}render(t=!1){const n=y(this.getOptions(),"ruler","enabled");this.drawBackdrop(),n&&!this.isEventListenerAdded?this.addBackdropEventListeners():!n&&this.isEventListenerAdded&&this.removeBackdropEventListeners()}removeBackdropEventListeners(){this.isEventListenerAdded=!1,this.backdrop.on("mousemove mouseover mouseout",null)}formatTooltipData(t){return t}showRuler(t,[n,r]){const i=this.parent,s=this.services.cartesianScales.getOrientation(),a=this.model.getDisplayData(),o=this.services.cartesianScales.getRangeScale(),[l,c]=o.range(),u=s===Gt.HORIZONTAL?r:n,d=N.appendOrSelect(i,"g.ruler").attr("aria-label","ruler"),h=N.appendOrSelect(d,"line.ruler-line"),p=i.selectAll("[role=graphics-symbol]"),f=a.map(m=>({domainValue:this.services.cartesianScales.getDomainValue(m),originalData:m})).filter(m=>Jk(m.domainValue,u));if(this.pointsWithinLine&&f.length===this.pointsWithinLine.length&&f.map(m=>m.domainValue).join()===this.pointsWithinLine.map(m=>m.domainValue).join())return this.pointsWithinLine=f,this.services.events.dispatchEvent(T.Tooltip.MOVE,{mousePosition:[n,r]});this.pointsWithinLine=f;const g=this.pointsWithinLine.reduce((m,v)=>{if(m.length===0)return m.push(v),m;const x=m[0].domainValue,_=Math.abs(u-v.domainValue),E=Math.abs(u-x);return _>E||(_<E?m=[v]:m.push(v)),m},[]);if(g.length>0){const m=g.map(E=>E.originalData).filter(E=>{const b=this.services.cartesianScales.getRangeIdentifier(E);return E[b]!=null}),v=g.map(E=>E.domainValue),x=p.filter(E=>{const b=this.services.cartesianScales.getDomainValue(E);return v.includes(b)});this.elementsToHighlight&&this.elementsToHighlight.size()>0&&!Zf(this.elementsToHighlight,x)&&this.hideRuler(),x.dispatch("mouseover"),this.elementsToHighlight=x,this.services.events.dispatchEvent(T.Tooltip.SHOW,{event:t,mousePosition:[n,r],hoveredElement:h,data:this.formatTooltipData(m)}),d.attr("opacity",1);const _=g[0];s==="horizontal"?h.attr("x1",c).attr("x2",l).attr("y1",_.domainValue).attr("y2",_.domainValue):h.attr("y1",c).attr("y2",l).attr("x1",_.domainValue).attr("x2",_.domainValue)}else this.hideRuler()}hideRuler(){const t=this.parent,n=N.appendOrSelect(t,"g.ruler");t.selectAll("[role=graphics-symbol]").dispatch("mouseout"),this.services.events.dispatchEvent(T.Tooltip.HIDE),n.attr("opacity",0)}addBackdropEventListeners(){this.isEventListenerAdded=!0;const t=this,n=this.services.domUtils.getHolder(),r=this.model.getDisplayData();let i=function(s){const a=er(s,t.parent.node());t.showRuler(s,a)};if(r.length>100){const s=r.length%50*12.5;i=XT(function(a){const{mousePosition:o}=this;t.showRuler(a,o)},s,n)}this.backdrop.on("mousemove mouseover",i).on("mouseout",this.hideRuler.bind(this))}drawBackdrop(){const t=this.parent;this.backdrop=N.appendOrSelect(t,"svg.chart-grid-backdrop")}}let cn=class extends gt{constructor(){super(...arguments),this.type="scatter",this.renderType=it.SVG,this.handleChartHolderOnHover=()=>{if(!this.parent)throw new Error("Parent not defined");this.parent.selectAll("circle.dot").transition("chart-holder-hover-scatter").call(t=>{var n;return(n=this.services.transitions)==null?void 0:n.setupTransition({transition:t,name:"chart-holder-hover-scatter"})}).attr("opacity",1)},this.handleChartHolderOnMouseOut=()=>{if(!this.parent)throw new Error("Parent not defined");this.parent.selectAll("circle.dot").transition("chart-holder-mouseout-scatter").call(t=>{var n;return(n=this.services.transitions)==null?void 0:n.setupTransition({transition:t,name:"chart-holder-mouseout-scatter"})}).attr("opacity",0)},this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail,{groupMapsTo:r}=this.getOptions().data;if(!this.parent)throw new Error("Parent not defined");this.parent.selectAll("circle.dot").transition("legend-hover-scatter").call(i=>{var s;return(s=this.services.transitions)==null?void 0:s.setupTransition({transition:i,name:"legend-hover-scatter"})}).attr("opacity",i=>i[r]!==n.datum().name?.3:1)},this.handleLegendMouseOut=()=>{if(!this.parent)throw new Error("Parent not defined");this.parent.selectAll("circle.dot").transition("legend-mouseout-scatter").call(t=>{var n;return(n=this.services.transitions)==null?void 0:n.setupTransition({transition:t,name:"legend-mouseout-scatter"})}).attr("opacity",1)}}init(){const{events:t}=this.services;if(!t)throw new Error("Services events are undefined.");t.addEventListener(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut);const{fadeInOnChartHolderMouseover:n}=this.configs;n&&(t.addEventListener(T.Chart.MOUSEOVER,this.handleChartHolderOnHover),t.addEventListener(T.Chart.MOUSEOUT,this.handleChartHolderOnMouseOut))}filterBasedOnZoomDomain(t){const{cartesianScales:n}=this.services;if(!n)throw new Error("Services cartesianScales are undefined.");const r=n.getDomainIdentifier(t),i=this.model.get("zoomDomain");return i!==void 0?t.filter(s=>s[r].getTime()>=i[0].getTime()&&s[r].getTime()<=i[1].getTime()):t}getScatterData(){const t=this.getOptions(),{stacked:n}=this.configs;let r;if(n){const i=Object.keys(t.axes).some(s=>t.axes[s].percentage);r=this.model.getStackedData({groups:this.configs.groups,percentage:i})}else{const{cartesianScales:i}=this.services;if(!i)throw new Error("Services cartesianScales are undefined.");r=this.model.getDisplayData(this.configs.groups).filter(s=>{const a=i.getRangeIdentifier(s);return s[a]!==void 0&&s[a]!==null})}return this.filterBasedOnZoomDomain(r)}render(t){if(!(y(this.getOptions(),"points","enabled")||y(this.getOptions(),"bubble","enabled")))return;const n=this.getComponentContainer({ariaLabel:"scatter points",withinChartClip:!0}),r=this.getOptions(),{groupMapsTo:i}=r.data,{cartesianScales:s}=this.services;if(!s)throw new Error("Services cartesianScales are undefined.");const a=s.getDomainIdentifier(),o=n.selectAll("circle.dot").data(this.getScatterData(),c=>`${c[i]}-${c[a]}`);o.exit().attr("opacity",0).remove();const l=o.enter().append("circle").classed("dot",!0).attr("opacity",0).merge(o);this.styleCircles(l,t),this.addEventListeners()}isDatapointThresholdAnomaly(t){const{handleThresholds:n}=this.configs;if(!n)return!1;const{cartesianScales:r}=this.services;if(!r)throw new Error("Cartesian scales service is undefined");const i=r.getOrientation(),[s,a]=bn(r.getHighestDomainThreshold(),r.getHighestRangeThreshold(),i),[o,l]=bn(d=>r.getDomainValue(d),d=>r.getRangeValue(d),i),c=o(t),u=l(t);return a&&s?u<=a.scaleValue&&c>=s.scaleValue:a?u<=a.scaleValue:s?c>=s.scaleValue:!1}styleCircles(t,n){const r=this.getOptions(),{filled:i,fillOpacity:s}=r.points,{cartesianScales:a}=this.services;if(!a)throw new Error("Cartesian scales service is undefined");const{groupMapsTo:o}=r.data,l=p=>a.getDomainValue(p),c=p=>a.getRangeValue(p),[u,d]=bn(l,c,a.getOrientation()),{fadeInOnChartHolderMouseover:h}=this.configs;t.raise().classed("dot",!0).attr("class",p=>{const f=a.getDomainIdentifier(p),g=this.model.getIsFilled(p[o],p[f],p,i)?[st.FILL,st.STROKE]:[st.STROKE];return this.model.getColorClassName({classNameTypes:g,dataGroupName:p[o],originalClassName:"dot"})||""}).classed("threshold-anomaly",p=>this.isDatapointThresholdAnomaly(p)).classed("filled",p=>{const f=a.getDomainIdentifier(p);return this.model.getIsFilled(p[o],p[f],p,i)}).classed("unfilled",p=>{const f=a.getDomainIdentifier(p);return!this.model.getIsFilled(p[o],p[f],p,i)}).transition().call(p=>{var f;return(f=this.services.transitions)==null?void 0:f.setupTransition({transition:p,name:"scatter-update-enter",animate:n})}).attr("cx",u).attr("cy",d).attr("r",r.points.radius).style("fill",p=>{const f=a.getDomainIdentifier(p);if(this.model.getIsFilled(p[o],p[f],p,i))return this.model.getFillColor(p[o],p[f],p)}).style("stroke",p=>{const f=a.getDomainIdentifier(p);return this.model.getStrokeColor(p[o],p[f],p)}).attr("fill-opacity",i?s:1).attr("opacity",h?0:1).attr("role",ht.GRAPHICS_SYMBOL).attr("aria-roledescription","point").attr("aria-label",p=>{const f=a.getRangeIdentifier(p);return p[f]}),this.addEventListeners()}getTooltipAdditionalItems(t){return null}addEventListeners(){const t=this,{groupMapsTo:n}=t.getOptions().data;if(!this.parent)throw new Error("Parent not defined");this.parent.selectAll("circle").on("mouseover",function(r,i){var s,a;const o=I(this);o.classed("hovered",!0).attr("class",l=>t.model.getColorClassName({classNameTypes:[st.FILL],dataGroupName:l[n],originalClassName:o.attr("class")})).style("fill",l=>{var c;const u=(c=t.services.cartesianScales)==null?void 0:c.getDomainIdentifier(l);return t.model.getFillColor(l[n],l[u],l)}).classed("unfilled",!1),(s=t.services.events)==null||s.dispatchEvent(T.Tooltip.SHOW,{event:r,hoveredElement:o,data:[i],additionalItems:t.getTooltipAdditionalItems(i)}),(a=t.services.events)==null||a.dispatchEvent(T.Scatter.SCATTER_MOUSEOVER,{event:r,element:o,datum:i})}).on("mousemove",function(r,i){var s,a;const o=I(this);(s=t.services.events)==null||s.dispatchEvent(T.Scatter.SCATTER_MOUSEMOVE,{event:r,element:o,datum:i}),(a=t.services.events)==null||a.dispatchEvent(T.Tooltip.MOVE,{event:r})}).on("click",function(r,i){var s;(s=t.services.events)==null||s.dispatchEvent(T.Scatter.SCATTER_CLICK,{event:r,element:I(this),datum:i})}).on("mouseout",function(r,i){var s,a,o;const l=I(this);if(l.classed("hovered",!1),!t.configs.filled){const{filled:c}=t.getOptions().points,u=(s=t.services.cartesianScales)==null?void 0:s.getDomainIdentifier(i),d=t.model.getIsFilled(i[n],i[u],i,c);l.classed("unfilled",!d).style("fill",h=>d||c?t.model.getFillColor(h[n],h[u],h):null)}(a=t.services.events)==null||a.dispatchEvent(T.Scatter.SCATTER_MOUSEOUT,{event:r,element:l,datum:i}),(o=t.services.events)==null||o.dispatchEvent(T.Tooltip.HIDE,{hoveredElement:l})})}destroy(){var t;(t=this.parent)==null||t.selectAll("circle").on("mousemove",null).on("mouseout",null);const{events:n}=this.services;if(!n)throw new Error("Services events undefined");n.removeEventListener(T.Legend.ITEM_HOVER,this.handleLegendOnHover),n.removeEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut),n.removeEventListener(T.Chart.MOUSEOVER,this.handleChartHolderOnHover),n.removeEventListener(T.Chart.MOUSEOUT,this.handleChartHolderOnMouseOut)}};class Ug extends gt{constructor(t,n,r){super(t,n,r),this.type="axes",this.renderType=it.SVG,this.truncation={[z.LEFT]:!1,[z.RIGHT]:!1,[z.TOP]:!1,[z.BOTTOM]:!1},r&&(this.configs=r),this.margins=this.configs.margins}render(t=!0){const{position:n}=this.configs,r=this.getOptions(),i=y(r,"axes",n,"visible"),s=this.getComponentContainer({ariaLabel:"axes"}),{width:a,height:o}=N.getSVGElementSize(s,{useAttrs:!0}),l=N.appendOrSelect(s,`g.axis.${n}`);let c,u;if(n===z.BOTTOM||n===z.TOP?(c=this.configs.axes[z.LEFT]?this.margins.left:0,u=this.configs.axes[z.RIGHT]?a-this.margins.right:a):(c=o-this.margins.bottom,u=this.margins.top),!this.services.cartesianScales)throw new Error("Services cartesianScales undefined");const d=this.services.cartesianScales.getScaleByPosition(n);this.scaleType===nt.LABELS||this.scaleType===nt.LABELS_RATIO?d.rangeRound([c,u]):d.range([c,u]);let h;switch(n){case z.LEFT:h=Jf;break;case z.BOTTOM:h=fc;break;case z.RIGHT:h=kC;break;case z.TOP:h=LC;break}l.attr("aria-label",`${n} axis`);const p=!l.select("g.ticks").empty();let f=N.appendOrSelect(l,"g.ticks");p||(f.attr("role",`${ht.GRAPHICS_OBJECT} ${ht.GROUP}`),f.attr("aria-label",`${n} ticks`));const g=N.appendOrSelect(l,"g.ticks.invisible").style("opacity","0").style("pointer-events","none").attr("aria-hidden",!0).attr("aria-label",`invisible ${n} ticks`),m=y(r,"axes",n),v=this.scaleType===nt.TIME||m.scaleType===nt.TIME,x=n===z.LEFT||n===z.RIGHT,_=this.model.get("zoomDomain");if(_&&v&&!x&&d.domain(_),!i){f.attr("aria-hidden",!0);return}const E=y(m,"scaleType"),b=y(r,"data","loading"),S=y(m,"ticks","number"),M=y(m,"ticks","values"),D=y(m,"truncation","type"),A=y(m,"truncation","threshold"),R=y(m,"truncation","numCharacter"),$=S!==null,H=y(r,"timeScale"),P=N.appendOrSelect(g,"g.tick"),B=N.appendOrSelect(P,"text").text("0"),O=N.getSVGElementSize(B.node(),{useBBox:!0}).height;P.remove();const w=this.scaleType||m.scaleType||nt.LINEAR,L=h(d).tickSizeOuter(0);if(d.ticks){let Y;if($?Y=S:(Y=Nn.ticks.number,x&&(Y=this.getNumberOfFittingTicks(o,O,Nn.ticks.verticalSpaceRatio))),d.ticks().length===1&&d.ticks()[0]===0&&(Y=0),L.ticks(Y),v)if(!d.ticks(Y).length)L.tickValues([]);else{const et=y(r,"timeScale","addSpaceOnEdges"),ut=y(r,"axes",n,"domain"),F=d.copy();et&&!ut&&F.nice(Y);const q=F.ticks(Y);et&&q.length>2&&!ut&&(q.splice(q.length-1,1),q.splice(0,1)),L.tickValues(q)}}let k;const U=y(m,"ticks","formatter"),{code:K,number:W}=y(r,"locale");if(v){const Y=jl(L.tickValues(),y(r,"timeScale","timeInterval"));U===null?k=(et,ut)=>Fl(et,ut,L.tickValues(),Y,H,r.locale):k=(et,ut)=>{const F=Fl(et,ut,L.tickValues(),Y,H,r.locale);return U(et,ut,F)}}else U===null?w===nt.LINEAR&&(k=Y=>W(Y,K)):k=U;L.tickFormat(k);const[j,X]=this.services.cartesianScales.getScaleByPosition(n).domain();let ct;if(M){if(v)M.forEach((Y,et)=>{Y.getTime===void 0&&(M[et]=new Date(Y))}),ct=M.filter(Y=>{const et=Y.getTime();return et>=new Date(j).getTime()&&et<=new Date(X).getTime()});else if(E===nt.LABELS){const Y=this.services.cartesianScales.getScaleByPosition(n).domain();ct=M.filter(et=>Y.includes(et))}else ct=M.filter(Y=>Y>=j&&Y<=X);L.tickValues(ct)}switch(n){case z.LEFT:f.attr("transform",`translate(${this.margins.left}, 0)`);break;case z.BOTTOM:f.attr("transform",`translate(0, ${o-this.margins.bottom})`);break;case z.RIGHT:f.attr("transform",`translate(${a-this.margins.right}, 0)`);break;case z.TOP:f.attr("transform",`translate(0, ${this.margins.top})`);break}const J=this.model.isDataEmpty();if(m.title){const Y=N.appendOrSelect(l,"text.axis-title").html(J||b?"":ln(m.title)),et=y(m,"titleOrientation");let ut;switch(n){case z.LEFT:et===Cs.RIGHT?Y.attr("transform","rotate(90)").attr("y",0).attr("x",d.range()[0]/2).attr("dy","-0.5em").style("text-anchor","middle"):Y.attr("transform","rotate(-90)").attr("y",0).attr("x",-(d.range()[0]/2)).attr("dy","0.75em").style("text-anchor","middle");break;case z.BOTTOM:Y.attr("transform",`translate(${this.margins.left/2+d.range()[1]/2}, ${o+4})`).style("text-anchor","middle");break;case z.RIGHT:et===Cs.LEFT?Y.attr("transform","rotate(-90)").attr("y",a).attr("x",-(d.range()[0]/2)).style("text-anchor","middle"):Y.attr("transform","rotate(90)").attr("y",-a).attr("x",d.range()[0]/2).attr("dy","0.75em").style("text-anchor","middle");break;case z.TOP:ut=N.getSVGElementSize(Y,{useBBox:!0}).height,Y.attr("transform",`translate(${this.margins.left/2+d.range()[1]/2}, ${ut/2})`).style("text-anchor","middle");break}}if(v){const Y=jl(L.tickValues(),y(r,"timeScale","timeInterval")),et=H.showDayName,ut=f;t&&(f=f.transition().call(F=>this.services.transitions.setupTransition({transition:F,name:"axis-update",animate:t}))),f=f.call(L),ut.selectAll(".tick").data(L.tickValues(),d).order().select("text").attr("class",(F,q)=>Rp(F,q,L.tickValues(),Y,et)?"tick-label--primary":"tick-label")}else!t||!p?f=f.call(L):f=f.transition().call(Y=>this.services.transitions.setupTransition({transition:Y,name:"axis-update",animate:t})).call(L);if(g.call(L),n===z.BOTTOM||n===z.TOP){let Y=!1;const et=y(m,"ticks","rotation");if(et===fi.ALWAYS)Y=!0;else if(et===fi.NEVER)Y=!1;else if(!et||et===fi.AUTO)if(d.step)Y=g.selectAll("g.tick text").nodes().some(ut=>N.getSVGElementSize(ut,{useBBox:!0}).width>=d.step());else{Y=!1;const ut=g.append("text").text("A"),F=N.getSVGElementSize(ut.node(),{useBBox:!0}).width;let q;g.selectAll("g.tick").each(function(){const Z=I(this),G=parseFloat(y(xn(this),"tx"));G!==null&&q+Z.text().length*F*.8>=G&&(Y=!0),q=G}),ut.remove()}Y?($||(L.ticks(this.getNumberOfFittingTicks(a,O,Nn.ticks.horizontalSpaceRatio)),g.call(L),f.call(L)),l.selectAll("g.ticks g.tick text").attr("transform","rotate(-45)").attr("text-anchor",n===z.TOP?"start":"end")):l.selectAll("g.ticks g.tick text").attr("transform",null).attr("text-anchor",null)}if(b?l.attr("opacity",0):l.attr("opacity",1),f.selectAll("g.tick").attr("aria-label",Y=>Y),g.selectAll("g.tick").attr("aria-label",Y=>Y),D!==we.NONE&&E===nt.LABELS&&!M){const Y=this.services.cartesianScales.getScaleDomain(n);if(Y.length>0){const et=s.select(`g.axis.${n} g.ticks g.tick`).html();l.selectAll("g.ticks g.tick").html(et);const ut=this;l.selectAll("g.tick text").data(Y).text(function(F){return F.length>A?(ut.truncation[n]=!0,ji(F,D,R)):F}),this.getInvisibleAxisRef().selectAll("g.tick text").data(Y).text(function(F){return F.length>A?ji(F,D,R):F}),l.selectAll("g.ticks").html(this.getInvisibleAxisRef().html()),l.selectAll("g.tick text").data(Y)}}this.addEventListeners()}addEventListeners(){const t=this.getComponentContainer(),{position:n}=this.configs,r=N.appendOrSelect(t,`g.axis.${n}`),i=this.getOptions(),s=y(i,"axes",n),a=y(s,"scaleType"),o=y(s,"truncation","threshold"),l=this;r.selectAll("g.tick text").on("mouseover",function(c,u){l.services.events.dispatchEvent(T.Axis.LABEL_MOUSEOVER,{event:c,element:I(this),datum:u}),a===nt.LABELS&&u.length>o&&l.services.events.dispatchEvent(T.Tooltip.SHOW,{event:c,hoveredElement:I(this),content:u})}).on("mousemove",function(c,u){l.services.events.dispatchEvent(T.Axis.LABEL_MOUSEMOVE,{event:c,element:I(this),datum:u}),a===nt.LABELS&&u.length>o&&l.services.events.dispatchEvent(T.Tooltip.MOVE,{event:c})}).on("click",function(c,u){l.services.events.dispatchEvent(T.Axis.LABEL_CLICK,{event:c,element:I(this),datum:u})}).on("mouseout",function(c,u){l.services.events.dispatchEvent(T.Axis.LABEL_MOUSEOUT,{event:c,element:I(this),datum:u}),a===nt.LABELS&&l.services.events.dispatchEvent(T.Tooltip.HIDE)})}getInvisibleAxisRef(){const{position:t}=this.configs;return this.getComponentContainer().select(`g.axis.${t} g.ticks.invisible`)}getTitleRef(){const{position:t}=this.configs;return this.getComponentContainer().select(`g.axis.${t} text.axis-title`)}getNumberOfFittingTicks(t,n,r){const i=Math.floor(t/(n*r));return Xf(i,2,Nn.ticks.number)}destroy(){const t=this.getComponentContainer(),{position:n}=this.configs;N.appendOrSelect(t,`g.axis.${n}`).selectAll("g.tick text").on("mouseover",null).on("mousemove",null).on("mouseout",null)}}class tD extends Ug{constructor(t,n,r){super(t,n,r)}render(t=!0){super.render(t),super.destroy();const n=this.configs.position,r=this.getComponentContainer({ariaLabel:"axes"}),i=N.appendOrSelect(r,`g.axis.${n}`),s=this;i.selectAll("g.tick").each(function(a,o){const l=I(this);l.classed("tick-hover",!0).attr("tabindex",o===0?0:-1);const c=l.select("text"),{width:u,height:d}=N.getSVGElementSize(c,{useBBox:!0}),h=N.appendOrSelect(l,"rect.axis-holder");let p=0,f=0;switch(n){case z.LEFT:p=-u+Number(c.attr("x")),f=-(d/2);break;case z.RIGHT:p=Math.abs(Number(c.attr("x"))),f=-(d/2);break;case z.TOP:p=-(u/2),f=-d+Number(c.attr("y"))/2,s.truncation[n]&&(p=0,h.attr("transform","rotate(-45)"));break;case z.BOTTOM:p=-(u/2),f=d/2-2,s.truncation[n]&&(p=-u,h.attr("transform","rotate(-45)"));break}h.attr("x",p-Nn.hover.rectanglePadding).attr("y",f).attr("width",u+Nn.hover.rectanglePadding*2).attr("height",d).lower()}),this.addEventListeners()}addEventListeners(){const t=this.getComponentContainer(),{position:n}=this.configs,r=N.appendOrSelect(t,`g.axis.${n}`),i=this.getOptions(),s=y(i,"axes",n),a=y(s,"scaleType"),o=y(s,"truncation","threshold"),l=this;r.selectAll("g.tick.tick-hover").on("mouseover",function(c){const u=I(this).select("text"),d=u.datum();l.services.events.dispatchEvent(T.Axis.LABEL_MOUSEOVER,{event:c,element:u,datum:d}),a===nt.LABELS&&d.length>o&&l.services.events.dispatchEvent(T.Tooltip.SHOW,{event:c,element:u,datum:d})}).on("mousemove",function(c){const u=I(this).select("text"),d=u.datum();l.services.events.dispatchEvent(T.Axis.LABEL_MOUSEMOVE,{event:c,element:u,datum:d}),l.services.events.dispatchEvent(T.Tooltip.MOVE,{event:c})}).on("click",function(c){l.services.events.dispatchEvent(T.Axis.LABEL_CLICK,{event:c,element:I(this).select("text"),datum:I(this).select("text").datum()})}).on("mouseout",function(c){l.services.events.dispatchEvent(T.Axis.LABEL_MOUSEOUT,{event:c,element:I(this).select("text"),datum:I(this).select("text").datum()}),a===nt.LABELS&&l.services.events.dispatchEvent(T.Tooltip.HIDE)}).on("focus",function(c){const u={clientX:0,clientY:0};if(c.target){c.target.focus();const d=c.target.getBoundingClientRect();u.clientX=d.x,u.clientY=d.y}l.services.events.dispatchEvent(T.Axis.LABEL_FOCUS,{event:{...c,...u},element:I(this),datum:I(this).select("text").datum()})}).on("blur",function(c){l.services.events.dispatchEvent(T.Axis.LABEL_BLUR,{event:c,element:I(this),datum:I(this).select("text").datum()})}).on("keydown",function(c){c.key&&c.key==="Escape"&&(l.services.events.dispatchEvent(T.Tooltip.HIDE),l.services.events.dispatchEvent(T.Axis.LABEL_BLUR,{event:c,element:I(this),datum:I(this).select("text").datum()})),n===z.LEFT||n===z.RIGHT?c.key&&c.key==="ArrowUp"?l.goNext(this,c):c.key&&c.key==="ArrowDown"&&l.goPrevious(this,c):c.key&&c.key==="ArrowLeft"?l.goPrevious(this,c):c.key&&c.key==="ArrowRight"&&l.goNext(this,c)})}goNext(t,n){t.nextElementSibling&&t.nextElementSibling.tagName!=="path"&&t.nextElementSibling.dispatchEvent(new Event("focus")),n.preventDefault()}goPrevious(t,n){t.previousElementSibling&&t.previousElementSibling.tagName!=="path"&&t.previousElementSibling.dispatchEvent(new Event("focus")),n.preventDefault()}destroy(){const t=this.getComponentContainer(),{position:n}=this.configs;N.appendOrSelect(t,`g.axis.${n}`).selectAll("g.tick.tick-hover").on("mouseover",null).on("mousemove",null).on("mouseout",null).on("focus",null).on("blur",null)}}class me extends gt{constructor(){super(...arguments),this.type="2D-axes",this.renderType=it.SVG,this.children={},this.thresholds=[],this.margins={top:0,right:0,bottom:0,left:0}}render(t=!1){const n={},r=Object.keys(z),i=y(this.getOptions(),"axes");r.forEach(a=>{i[z[a]]&&(n[z[a]]=!0)}),this.configs.axes=n,r.forEach(a=>{const o=z[a];if(this.configs.axes[o]&&!this.children[o]){const l={position:o,axes:this.configs.axes,margins:this.margins},c=this.model.axisFlavor===gi.DEFAULT?new Ug(this.model,this.services,l):new tD(this.model,this.services,l);c.setModel(this.model),c.setServices(this.services),c.setParent(this.parent),this.children[o]=c}}),Object.keys(this.children).forEach(a=>{this.children[a].render(t)});const s={};Object.keys(this.children).forEach(a=>{const o=this.children[a],l=o.configs.position,c=o.getInvisibleAxisRef(),{width:u,height:d}=N.getSVGElementSize(c,{useBBox:!0});let h;switch(o.getTitleRef().empty()?h=0:(h=N.getSVGElementSize(o.getTitleRef(),{useBBox:!0}).height,(l===z.LEFT||l===z.RIGHT)&&(h+=5)),l){case z.TOP:s.top=d+h;break;case z.BOTTOM:s.bottom=d+h;break;case z.LEFT:s.left=u+h;break;case z.RIGHT:s.right=u+h;break}}),this.services.events.dispatchEvent(T.Axis.RENDER_COMPLETE),Object.keys(s).some(a=>this.margins[a]!==s[a])&&(this.margins=Object.assign(this.margins,s),this.model.set({axesMargins:this.margins},{skipUpdate:!0}),this.services.events.dispatchEvent(T.ZoomBar.UPDATE),Object.keys(this.children).forEach(a=>{const o=this.children[a];o.margins=this.margins}),this.render(!0))}}class ce extends gt{constructor(){super(...arguments),this.type="skeleton"}render(t=!0){const n=y(this.getOptions(),"data","loading");n?this.renderSkeleton(n):this.removeSkeleton()}renderSkeleton(t){if(this.configs.skeleton===Ft.GRID)this.renderGridSkeleton(t);else if(this.configs.skeleton===Ft.VERT_OR_HORIZ)this.renderVertOrHorizSkeleton(t);else if(this.configs.skeleton===Ft.PIE)this.renderPieSkeleton(t);else if(this.configs.skeleton===Ft.DONUT)this.renderDonutSkeleton(t);else throw new Error(`"${this.configs.skeleton}" is not a valid Skeleton type.`)}renderGridSkeleton(t){this.setScales(),this.drawBackdrop(t),this.drawXGrid(t),this.drawYGrid(t),t&&this.setShimmerEffect("shimmer-lines")}renderVertOrHorizSkeleton(t){const n=this.services.cartesianScales.getOrientation();this.setScales(),this.drawBackdrop(t),n===Gt.VERTICAL&&this.drawYGrid(t),n===Gt.HORIZONTAL&&this.drawXGrid(t),this.setShimmerEffect("shimmer-lines")}renderPieSkeleton(t){const n=this.computeOuterRadius();this.drawRing(n,0,t),t&&this.setShimmerEffect("shimmer-areas")}renderDonutSkeleton(t){const n=this.computeOuterRadius(),r=this.computeInnerRadius();this.drawRing(n,r,t),t&&this.setShimmerEffect("shimmer-areas")}setScales(){const t=this.services.cartesianScales.getMainXScale().range(),n=this.services.cartesianScales.getMainYScale().range();this.xScale=je().domain([0,1]).range(t),this.yScale=je().domain([0,1]).range(n)}drawBackdrop(t){const n=this.parent,{width:r,height:i}=N.getSVGElementSize(n,{useAttrs:!0});this.backdrop=N.appendOrSelect(n,"svg.chart-skeleton.DAII").attr("role","presentation").attr("width",r).attr("height",i);const s=N.appendOrSelect(this.backdrop,"rect.chart-skeleton-backdrop");s.attr("width","100%").attr("height","100%");const[a]=this.xScale.range(),[,o]=this.yScale.range();this.backdrop.merge(s).attr("x",a).attr("y",o),s.classed("shimmer-effect-lines",t).classed("empty-state-lines",!t).style("stroke",t?`url(#${this.services.domUtils.generateElementIDString("shimmer-lines")})`:null)}drawXGrid(t){const n=+this.backdrop.attr("width"),r=y(this.getOptions(),"grid","x","numberOfTicks"),i=this.xScale.ticks(r).map(o=>o*n),s=N.appendOrSelect(this.backdrop,"g.x.skeleton"),a=s.selectAll("line").data(i);a.enter().append("line").merge(a).attr("x1",o=>o).attr("x2",o=>o).attr("y1",0).attr("y2","100%"),s.selectAll("line").classed("shimmer-effect-lines",t).classed("empty-state-lines",!t).style("stroke",t?`url(#${this.services.domUtils.generateElementIDString("shimmer-lines")})`:null)}drawYGrid(t){const n=+this.backdrop.attr("height"),r=this.backdrop.attr("width"),i=y(this.getOptions(),"grid","y","numberOfTicks"),s=this.xScale.ticks(i).map(l=>l*n),a=N.appendOrSelect(this.backdrop,"g.y.skeleton"),o=a.selectAll("line").data(s);o.enter().append("line").merge(o).attr("x1",0).attr("x2",r).attr("y1",l=>l).attr("y2",l=>l),a.selectAll("line").classed("shimmer-effect-lines",t).classed("empty-state-lines",!t).style("stroke",t?`url(#${this.services.domUtils.generateElementIDString("shimmer-lines")})`:null)}drawRing(t,n,r=!0){const i=this.parent,{width:s,height:a}=N.getSVGElementSize(i,{useAttrs:!0}),o=N.appendOrSelect(i,"svg.chart-skeleton").attr("width",s).attr("height",a),l=n===0?"pie":"donut",c=y(this.getOptions(),l,"alignment");N.appendOrSelect(o,"rect.chart-skeleton-area-container").attr("width",s).attr("height",a).attr("fill","none");const u=fs().innerRadius(n).outerRadius(t).startAngle(0).endAngle(Math.PI*2),d=t+Math.abs(Lt.radiusOffset),h=t+(Math.min(s,a)-t*2)/2,p=N.appendOrSelect(o,"path").attr("class","skeleton-area-shape").attr("transform",`translate(${d}, ${h})`).attr("d",u).classed("shimmer-effect-areas",r).classed("empty-state-areas",!r).style("fill",r?`url(#${this.services.domUtils.generateElementIDString("shimmer-areas")})`:null);let f=t+Lt.xOffset;c===zt.CENTER?f=s/2:c===zt.RIGHT&&(f=s-t-Lt.xOffset);const g=t+Lt.yOffset;p.attr("transform",`translate(${f}, ${g})`)}computeOuterRadius(){const{width:t,height:n}=N.getSVGElementSize(this.parent,{useAttrs:!0});return Math.min(t,n)/2+Lt.radiusOffset}computeInnerRadius(){return this.computeOuterRadius()*(3/4)}setShimmerEffect(t){const n="stop-bg-shimmer",r="stop-shimmer",i=this.parent.select(".chart-skeleton"),{width:s}=N.getSVGElementSize(this.parent,{useAttrs:!0}),a=0,o=s,l=N.appendOrSelect(i,"defs").lower(),c=N.appendOrSelect(l,"linearGradient").attr("id",this.services.domUtils.generateElementIDString(t)).attr("class",t).attr("x1",a-3*.2*s).attr("x2",o).attr("y1",0).attr("y2",0).attr("gradientUnits","userSpaceOnUse").attr("gradientTransform","translate(0, 0)"),u=`
|
|
66
66
|
<stop class="${n}" offset="${a}"></stop>
|
|
67
67
|
<stop class="${r}" offset="${a+.2}"></stop>
|
|
68
68
|
<stop class="${n}" offset="${a+2*.2}"></stop>
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 10">
|
|
71
71
|
<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"/>
|
|
72
72
|
<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"/>
|
|
73
|
-
</svg>`}addEventListeners(){const t=this;this.parent.selectAll("circle.node").on("mouseover",function(n,r){const i=I(this);i.classed("hovered",!0);const s=t.model.getHierarchyLevel(),a=s>2&&!i.classed("focal"),o=y(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(f=>{if(f!==null)return typeof f.data.value=="number"?{label:f.data.name,value:f.data.value}:{label:f.data.name,labelIcon:o&&s<=2?t.getZoomIcon():null,value:f.value}});const p=t.model.getOptions();u=[{label:yt(p,"locale.translations.total")||yt(p,"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(T.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(T.CirclePack.CIRCLE_MOUSEOVER,{event:n,element:i,datum:r})}).on("mousemove",function(n,r){const i=I(this);t.services.events.dispatchEvent(T.CirclePack.CIRCLE_MOUSEMOVE,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(T.Tooltip.MOVE,{event:n})}).on("mouseout",function(n,r){const i=I(this);i.classed("hovered",!1),r.children&&t.unhighlightChildren(r.children),t.services.events.dispatchEvent(T.CirclePack.CIRCLE_MOUSEOUT,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(T.Tooltip.HIDE,{hoveredElement:i})}).on("click",function(n,r){const i=I(this),s=i.classed("non-focal"),a=y(t.model.getOptions(),"canvasZoom","enabled");if(a&&t.model.getHierarchyLevel()>2){const o=t.parent.selectAll("circle.node");I(t.services.domUtils.getMainContainer()).classed("zoomed-in",!1),t.focal=null,t.model.updateHierarchyLevel(2),t.services.canvasZoom.zoomOut(o,Hr)}else if(r.depth===2&&r.children&&!s&&a){const o=t.parent.selectAll("circle.node");I(t.services.domUtils.getMainContainer()).classed("zoomed-in",!0),t.focal=r,t.model.updateHierarchyLevel(3),t.services.canvasZoom.zoomIn(r,o,Hr),n.stopPropagation()}t.services.events.dispatchEvent(T.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(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut),this.removeBackgroundListeners()}}function ED(e,t){const n=Ni(this._current,e);return r=>(this._current=n(r),t(this._current))}class Vg extends gt{constructor(){super(...arguments),this.type="pie",this.renderType=it.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(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}getInnerRadius(){return Lt.innerRadius}render(t=!0){const n=this,r=this.getComponentContainer({ariaLabel:"pie graph"}),i=this.getOptions(),{groupMapsTo:s}=i.data,{valueMapsTo:a}=i.pie;this.isRendering=!0;const o=this.model.getDisplayData().filter(A=>A[a]>0),l=this.computeRadius();this.arc=fs().innerRadius(this.getInnerRadius()).outerRadius(l),this.hoverArc=fs().innerRadius(this.getInnerRadius()).outerRadius(l+Lt.hoverArc.outerRadiusOffset);const c=ZL().value(A=>A[a]).sort(y(i,"pie","sortFunction")).padAngle(Lt.padAngle)(o),u=N.appendOrSelect(r,"g.slices").attr("role",ht.GROUP).attr("data-name","slices").selectAll("path.slice").data(c,A=>A.data[s]);u.exit().attr("opacity",0).remove(),u.enter().append("path").classed("slice",!0).attr("opacity",0).merge(u).attr("class",A=>this.model.getColorClassName({classNameTypes:[st.FILL],dataGroupName:A.data[s],originalClassName:"slice"})).style("fill",A=>n.model.getFillColor(A.data[s],null,A.data)).attr("d",this.arc).transition().call(A=>this.services.transitions.setupTransition({transition:A,name:"pie_slice_enter_update",animate:t})).attr("opacity",1).attr("role",ht.GRAPHICS_SYMBOL).attr("aria-roledescription","slice").attr("aria-label",A=>`${A[a]}, ${Hl(A.data[a],o,a)+"%"}`).attrTween("d",function(A){return ED.bind(this)(A,n.arc)}).on("end",()=>{n.isRendering=!1});const{code:d,number:h}=y(i,"locale"),p=i.pie.labels.enabled,f=p?c.filter(A=>A.data[a]>0):[],g=N.appendOrSelect(r,"g.labels").attr("role",ht.GROUP).attr("data-name","labels").selectAll("text.pie-label").data(f,A=>A.data[s]);g.exit().attr("opacity",0).remove();const m=g.enter().append("text").classed("pie-label",!0),v=[];m.merge(g).style("text-anchor","middle").text(A=>i.pie.labels.formatter?i.pie.labels.formatter({...A,percentageValue:Hl(A.data[a],o,a,!0)}):h(Hl(A.data[a],o,a),d)+"%").datum(function(A){const R=l+7,$=(A.endAngle-A.startAngle)/2+A.startAngle,H=$/Math.PI*180,P=this.getComputedTextLength();return A.textOffsetX=P/2,A.textOffsetY=H>90&&H<270?10:0,A.xPosition=(A.textOffsetX+R)*Math.sin($),A.yPosition=(A.textOffsetY+R)*-Math.cos($),A}).attr("transform",function(A,R){const $=f.length,H=(A.endAngle-A.startAngle)*(180/Math.PI);if(R>=$-2&&H<Lt.callout.minSliceDegree){let P,B;return A.index===$-1?(P=A.xPosition+Lt.callout.offsetX+Lt.callout.textMargin+A.textOffsetX,B=A.yPosition-Lt.callout.offsetY,A.direction=di.RIGHT,v.push(A)):(P=A.xPosition-Lt.callout.offsetX-A.textOffsetX-Lt.callout.textMargin,B=A.yPosition-Lt.callout.offsetY,A.direction=di.LEFT,v.push(A)),`translate(${P}, ${B})`}return`translate(${A.xPosition}, ${A.yPosition})`}),this.renderCallouts(v);const x=y(i,"donut")?"donut":"pie",_=y(i,x,"alignment"),{width:E}=N.getSVGElementSize(this.getParent(),{useAttrs:!0}),b=p?Lt.xOffset:0,S=p?Lt.yOffset:0;let M=l+b;_===zt.CENTER?M=E/2:_===zt.RIGHT&&(M=E-l-Lt.xOffset);let D=l+S;v.length>0&&(D+=Lt.yOffsetCallout),r.attr("x",M+7).attr("y",D),this.addEventListeners()}renderCallouts(t){const n=N.appendOrSelect(this.getComponentContainer(),"g.callouts").attr("role",ht.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",ht.GROUP).attr("aria-roledescription","label callout");i.merge(r).datum(function(s){const{xPosition:a,yPosition:o,direction:l}=s;return l===di.RIGHT?(s.startPos={x:a,y:o+s.textOffsetY},s.endPos={x:a+Lt.callout.offsetX,y:o-Lt.callout.offsetY+s.textOffsetY},s.intersectPointX=s.endPos.x-Lt.callout.horizontalLineLength):(s.startPos={x:a,y:o+s.textOffsetY},s.endPos={x:a-Lt.callout.offsetX,y:o-Lt.callout.offsetY+s.textOffsetY},s.intersectPointX=s.endPos.x+Lt.callout.horizontalLineLength),s}),i.append("line").classed("vertical-line",!0).merge(n.selectAll("line.vertical-line")).datum(function(){return I(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 I(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=I(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(T.Pie.SLICE_MOUSEOVER,{event:n,element:I(this),datum:r});const{groupMapsTo:s}=t.getOptions().data,{valueMapsTo:a}=t.getOptions().pie;t.services.events.dispatchEvent(T.Tooltip.SHOW,{event:n,hoveredElement:i,items:[{label:r.data[s],value:r.data[a]}]})}).on("mousemove",function(n,r){const i=I(this);t.services.events.dispatchEvent(T.Pie.SLICE_MOUSEMOVE,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(T.Tooltip.MOVE,{event:n})}).on("click",function(n,r){t.services.events.dispatchEvent(T.Pie.SLICE_CLICK,{event:n,element:I(this),datum:r})}).on("mouseout",function(n,r){const i=I(this);vC(()=>{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(T.Pie.SLICE_MOUSEOUT,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(T.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+Lt.radiusOffset:i}}class OD extends Vg{constructor(){super(...arguments),this.type="donut",this.renderType=it.SVG}render(t=!0){super.render(t);const n=this;if(this.model.isDataEmpty()){this.getComponentContainer({ariaLabel:"donut graph"}).select("g.center").remove();return}const r=N.appendOrSelect(this.getComponentContainer({ariaLabel:"donut graph"}),"g.center"),i=this.getOptions(),s=this.computeRadius(),a=y(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(I(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=y(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=Id:s=xe;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}=y(n,"locale");t.text(u(Math.floor(a(o)),c))}}}}const Gg="4,10 8,6 12,10",zg="12,6 8,10 4,6";class SD extends gt{constructor(){super(...arguments),this.type="gauge",this.renderType=it.SVG}getValue(){var t;return((t=this.model.getData().find(n=>n.group==="value"))==null?void 0:t.value)??null}getValueRatio(){return Xf(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 y(t,"gauge","type")===Wn.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(y(n,"gauge","deltaArrow","direction")){case Ms.UP:return Gg;case Ms.DOWN:return zg;default:return t>0?Gg:zg}}render(t=!0){const n=this.getComponentContainer({ariaLabel:"gauge graph"}).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=fs().innerRadius(h).outerRadius(d).startAngle(c).endAngle(u),this.arc=fs().innerRadius(h).outerRadius(d).startAngle(o).endAngle(c),N.appendOrSelect(n,"path.arc-background").attr("d",this.backgroundArc);const p=n.selectAll("path.arc-foreground").data([i]);p.enter().append("path").merge(p).attr("class",this.model.getColorClassName({classNameTypes:[st.FILL],dataGroupName:"value",originalClassName:"arc-foreground"})).style("fill",()=>y(this.getOptions(),"color","scale","value")).attr("d",this.arc).attr("role",ht.GRAPHICS_SYMBOL).attr("aria-roledescription","value").attr("aria-label",v=>v),this.drawValueNumber(),this.drawDelta(),p.exit().remove();const f=y(r,"gauge","alignment"),{width:g}=N.getSVGElementSize(this.getParent(),{useAttrs:!0});let m=d;f===zt.CENTER?m=g/2:f===zt.RIGHT&&(m=g-d),n.attr("x",m).attr("y",d),this.addEventListeners()}drawValueNumber(){const t=this.getComponentContainer(),n=this.getOptions(),r=y(n,"gauge","type"),i=this.getValue(),s=this.getDelta(),a=this.computeRadius(),o=y(n,"gauge","valueFontSize"),l=y(n,"gauge","deltaFontSize"),c=y(n,"gauge","numberSpacing"),u=y(n,"gauge","showPercentageSymbol");let d=0;r===Wn.FULL&&!s?d=l(a):r===Wn.SEMI&&s&&(d=-(l(a)+c));const h=N.appendOrSelect(t,"g.gauge-numbers").attr("transform",`translate(0, ${d})`),p=o(a),f=N.appendOrSelect(h,"g.gauge-value-number"),{code:g,number:m}=y(n,"locale"),v=y(n,"gauge","numberFormatter"),x=f.selectAll("text.gauge-value-number").data([i]);x.enter().append("text").attr("class","gauge-value-number").merge(x).style("font-size",`${p}px`).attr("text-anchor","middle").text(A=>{let R;return A!=null?R=Number(A.toFixed(2))%1!==0?A.toFixed(2):A.toFixed():R=0,v?v(R):m(Number(R),g)});const{width:_}=N.getSVGElementSize(N.appendOrSelect(t,"text.gauge-value-number"),{useBBox:!0}),E=p/2,b=u?"%":"",S=N.appendOrSelect(f,"text.gauge-value-symbol").style("font-size",`${E}px`).attr("x",_/2).text(b),{width:M,height:D}=N.getSVGElementSize(S,{useBBox:!0});S.attr("y",`-${D/2}px`),f.attr("transform",`translate(-${M/2}, 0)`)}drawDelta(){const t=this,n=this.getComponentContainer(),r=this.getOptions(),i=this.getDelta(),{code:s,number:a}=y(r,"locale");if(i){const o=this.computeRadius(),l=i?y(r,"gauge","deltaFontSize"):()=>0,c=i?y(r,"gauge","numberFormatter"):()=>null,u=y(r,"gauge","deltaArrow","size"),d=y(r,"gauge","numberSpacing"),h=y(r,"gauge","showPercentageSymbol"),p=N.appendOrSelect(n,"g.gauge-numbers"),f=N.appendOrSelect(p,"g.gauge-delta").attr("transform",`translate(0, ${l(o)+d})`),g=N.appendOrSelect(f,"text.gauge-delta-number"),m=h?"%":"";g.data(i===null?[]:[i]),g.enter().append("text").classed("gauge-delta-number",!0).merge(g).attr("text-anchor","middle").style("font-size",`${l(o)}px`).text(E=>{let b;return E!=null?b=Number(E.toFixed(2))%1!==0?E.toFixed(2):E.toFixed():b=0,c?`${c(b)}${m}`:`${a(Number(b),s)}${m}`});const{width:v}=N.getSVGElementSize(N.appendOrSelect(n,".gauge-delta-number"),{useBBox:!0}),x=y(r,"gauge","deltaArrow","enabled"),_=f.selectAll("svg.gauge-delta-arrow").data(i!==null&&x?[i]:[]);_.enter().append("svg").merge(_).attr("class","gauge-delta-arrow").attr("x",-u(o)-v/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 E=I(this);N.appendOrSelect(E,"rect.gauge-delta-arrow-backdrop").attr("width","16").attr("height","16").attr("fill","none");const b=y(r,"gauge","status");N.appendOrSelect(E,"polygon.gauge-delta-arrow").attr("class",b!==null?`gauge-delta-arrow status--${b}`:"").attr("points",t.getArrow(i))}),_.exit().remove(),g.exit().remove()}else{const o=n.select("g.gauge-delta");o.empty()||o.remove()}}getInnerRadius(){const t=this.computeRadius(),n=y(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(T.Gauge.ARC_MOUSEOVER,{event:n,element:I(this),datum:r})}).on("mousemove",function(n,r){const i=I(this);t.services.events.dispatchEvent(T.Gauge.ARC_MOUSEMOVE,{event:n,element:i,datum:r})}).on("click",function(n,r){t.services.events.dispatchEvent(T.Gauge.ARC_CLICK,{event:n,element:I(this),datum:r})}).on("mouseout",function(n,r){const i=I(this);t.services.events.dispatchEvent(T.Gauge.ARC_MOUSEOUT,{event:n,element:i,datum:r})})}computeRadius(){const t=this.getOptions(),n=y(t,"gauge","type"),{width:r,height:i}=N.getSVGElementSize(this.parent,{useAttrs:!0});return n===Wn.SEMI?Math.min(r/2,i):Math.min(r/2,i/2)}}class Fg extends vu{constructor(){super(...arguments),this.type="grouped-bar",this.renderType=it.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(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(T.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({ariaLabel:"grouped bar graphs",withinChartClip:!0}),a=Li(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",ht.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()===Gt.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:[st.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(),p=d,f=d+h,g=this.services.cartesianScales.getRangeAxisPosition({datum:u}),m=this.services.cartesianScales.getDomainLowerBound(g),v=this.services.cartesianScales.getValueThroughAxisPosition(g,m),x=this.services.cartesianScales.getRangeValue(u),_=this.services.cartesianScales.getDomainValue(u)-h/2,E=_+h;if(!this.isOutsideZoomedDomain(_,E))return ie({x0:p,x1:f,y0:v,y1:x},this.services.cartesianScales.getOrientation())}).attr("opacity",1).attr("role",ht.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=I(this);i.classed("hovered",!0),t.services.events.dispatchEvent(T.Bar.BAR_MOUSEOVER,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(T.Tooltip.SHOW,{event:n,hoveredElement:i,data:[r]})}).on("mousemove",function(n,r){const i=I(this);t.services.events.dispatchEvent(T.Bar.BAR_MOUSEMOVE,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(T.Tooltip.MOVE,{event:n})}).on("click",function(n,r){t.services.events.dispatchEvent(T.Bar.BAR_CLICK,{event:n,element:I(this),datum:r})}).on("mouseout",function(n,r){const i=I(this);i.classed("hovered",!1),t.services.events.dispatchEvent(T.Bar.BAR_MOUSEOUT,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(T.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(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(T.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=y(t,"bars","width"),r=y(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=Yi().domain(t).rangeRound([0,this.getGroupWidth()])}}class TD extends gt{constructor(){super(...arguments),this.type="heatmap",this.renderType=it.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,p=null;this.matrix[r]!==void 0?(u=a,i.forEach(f=>{if(typeof this.matrix[r][f].value=="number"){const g=this.matrix[r][f].value;if(d===null){d=g,h=g,p=g;return}d+=g,h=g<h?g:h,p=g>p?g:p}})):(u=o,s.forEach(f=>{if(typeof this.matrix[f][r].value=="number"){const g=this.matrix[f][r].value;if(d===null){d=g,h=g,p=g;return}d+=g,h=g<h?g:h,p=g>p?g:p}})),l(r)!==void 0?this.parent.select("g.multi-cell.column-highlight").classed("highlighter-hidden",!1).attr("transform",`translate(${l(r)}, ${In(c.range())})`):c(r)!==void 0&&this.parent.select("g.multi-cell.row-highlight").classed("highlighter-hidden",!1).attr("transform",`translate(${In(l.range())},${c(r)})`),this.services.events.dispatchEvent(T.Tooltip.SHOW,{event:n.event,hoveredElement:I(t.detail.element),items:[{label:u,value:r,bold:!0},{label:"Min",value:h!==null?h:"-"},{label:"Max",value:p!==null?p:"-"},{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(T.Tooltip.HIDE,{event:t})}}init(){const t=this.services.events;t.addEventListener(T.Axis.LABEL_MOUSEOVER,this.handleAxisOnHover),t.addEventListener(T.Axis.LABEL_MOUSEOUT,this.handleAxisMouseOut),t.addEventListener(T.Axis.LABEL_FOCUS,this.handleAxisOnHover),t.addEventListener(T.Axis.LABEL_BLUR,this.handleAxisMouseOut)}render(t=!0){const n=this.getComponentContainer({ariaLabel:"heatmap",withinChartClip:!0});n.lower();const{cartesianScales:r}=this.services;if(this.matrix=this.model.getMatrix(),n.html(""),y(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 p=this.services.domUtils.generateElementIDString("heatmap-pattern-stripes");n.append("defs").append("pattern").attr("id",p).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 f=n.selectAll().data(u).enter().append("g").attr("class",g=>`heat-${g.index}`).classed("cell",!0).attr("transform",g=>`translate(${i(g[a])}, ${s(g[o])})`).append("rect").attr("class",g=>this.model.getColorClassName({value:g.value,originalClassName:`heat-${g.index}`})).classed("heat",!0).classed("null-state",g=>g.index===-1||g.value===null).attr("width",this.xBandwidth).attr("height",this.yBandwidth).style("fill",g=>{const m=this.services.cartesianScales.getDomainIdentifier(g);return g.index===-1||g.value===null?`url(#${p})`:this.model.getFillColor(Number(g.value),g[m],g)}).attr("aria-label",g=>g.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()&&(f.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=y(this.getOptions(),"heatmap","divider","state");return t!==$r.OFF&&(t===$r.AUTO&&hp.minCellDividerDimension<=this.xBandwidth&&hp.minCellDividerDimension<=this.yBandwidth||t===$r.ON)}addEventListener(){const t=this,{cartesianScales:n}=this.services,r=this.getOptions(),i=yt(r,"locale.translations.total")||yt(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=I(this),h=d.select("rect.heat");if(!h.classed("null-state")){const p=Fi(d.attr("transform"));t.parent.select("g.cell-highlight").attr("transform",`translate(${p.x+t.translationUnits.x}, ${p.y+t.translationUnits.y})`).classed("highlighter-hidden",!1),t.services.events.dispatchEvent(T.Heatmap.HEATMAP_MOUSEOVER,{event:c,element:h,datum:u}),t.services.events.dispatchEvent(T.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(T.Heatmap.HEATMAP_MOUSEMOVE,{event:c,element:I(this),datum:u}),t.services.events.dispatchEvent(T.Tooltip.MOVE,{event:c})}).on("click",function(c,u){t.services.events.dispatchEvent(T.Heatmap.HEATMAP_CLICK,{event:c,element:I(this),datum:u})}).on("mouseout",function(c,u){const d=I(this).select("rect.heat"),h=d.classed("null-state");t.parent.select("g.cell-highlight").classed("highlighter-hidden",!0),h||(t.services.events.dispatchEvent(T.Heatmap.HEATMAP_MOUSEOUT,{event:c,element:d,datum:u}),t.services.events.dispatchEvent(T.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(T.Legend.ITEM_HOVER,this.handleAxisOnHover),t.removeEventListener(T.Legend.ITEM_MOUSEOUT,this.handleAxisMouseOut)}}class wD extends gt{constructor(){super(...arguments),this.type="histogram",this.renderType=it.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(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t){const n=this.getComponentContainer({ariaLabel:"histogram bars"}),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=>yt(u,`0.${s}`));l.exit().attr("opacity",0).remove(),l.enter().append("g").classed("bars",!0).attr("role",ht.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:[st.FILL],dataGroupName:u[s],originalClassName:"bar"})).style("fill",u=>this.model.getFillColor(u[s],null,u)).attr("d",u=>{const d=yt(u,"data");if(!d)return;const h=o(d.x1)-o(d.x0)-1,p=this.services.cartesianScales.getDomainValue(d.x0),f=p+h,g=this.services.cartesianScales.getRangeValue(u[0]);let m=this.services.cartesianScales.getRangeValue(u[1]);return Math.abs(m-g)>0&&Math.abs(m-g)>r.bars.dividerSize&&(this.services.cartesianScales.getOrientation()===Gt.VERTICAL?m+=1:m-=1),ie({x0:p,x1:f,y0:g,y1:m},this.services.cartesianScales.getOrientation())}).attr("opacity",1).attr("role",ht.GRAPHICS_SYMBOL).attr("aria-roledescription","bar").attr("aria-label",u=>y(u,"data",u[s])),this.addEventListeners()}addEventListeners(){const t=this.model.getOptions(),{groupMapsTo:n}=t.data,{code:r,number:i}=y(t,"locale"),s=this;this.parent.selectAll("path.bar").on("mouseover",function(a,o){const l=I(this);l.classed("hovered",!0);const c=i(parseFloat(yt(o,"data.x0")),r),u=i(parseFloat(yt(o,"data.x1")),r),d=s.services.cartesianScales.getRangeAxisPosition(),h=s.services.cartesianScales.getScaleLabel(d);s.services.events.dispatchEvent(T.Tooltip.SHOW,{event:a,hoveredElement:l,items:[{label:yt(t,"bins.rangeLabel")||"Range",value:`${c} – ${u}`},{label:t.tooltip.groupLabel||"Group",value:o[n],class:s.model.getColorClassName({classNameTypes:[st.TOOLTIP],dataGroupName:o[n]})},{label:h,value:yt(o,`data.${o[n]}`)}]})}).on("mousemove",function(a){s.services.events.dispatchEvent(T.Tooltip.MOVE,{event:a})}).on("mouseout",function(){I(this).classed("hovered",!1),s.services.events.dispatchEvent(T.Tooltip.HIDE)})}destroy(){this.parent.selectAll("path.bar").on("mouseover",null).on("mousemove",null).on("mouseout",null);const t=this.services.events;t.removeEventListener(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}}class $D extends cn{constructor(){super(...arguments),this.type="lollipop",this.renderType=it.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]?yn.weight.unselected:yn.weight.selected)},this.handleScatterOnMouseOut=()=>{this.parent.selectAll("line.line").attr("stroke-width",yn.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?yn.opacity.unselected:yn.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",yn.opacity.selected)}}init(){const{events:t}=this.services;t.addEventListener(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t){const n=this.getComponentContainer({ariaLabel:"lines",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,p]=bn(c,u,d),f=n.selectAll("line.line").data(this.getScatterData(),m=>`${m[i]}-${m[l]}`);f.exit().attr("opacity",0).remove();const g=f.enter().append("line").attr("opacity",0).merge(f).classed("line",!0).attr("class",m=>this.model.getColorClassName({classNameTypes:[st.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===Gt.HORIZONTAL?g.attr("y1",p).attr("y2",p).attr("x1",a.range()[0]).attr("x2",m=>h(m)-r.points.radius):g.attr("x1",h).attr("x2",h).attr("y1",o.range()[0]).attr("y2",m=>p(m)+r.points.radius),this.addScatterPointEventListeners()}addScatterPointEventListeners(){this.services.events.addEventListener(T.Scatter.SCATTER_MOUSEOVER,this.handleScatterOnHover),this.services.events.addEventListener(T.Scatter.SCATTER_MOUSEOUT,this.handleScatterOnMouseOut)}destroy(){const t=this.services.events;t.removeEventListener(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut),t.removeEventListener(T.Scatter.SCATTER_MOUSEOVER,this.handleScatterOnHover),t.removeEventListener(T.Scatter.SCATTER_MOUSEOUT,this.handleScatterOnMouseOut)}}class MD extends gt{constructor(){super(...arguments),this.type="meter",this.renderType=it.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)-Kt.dividerWidth),x:r-n(i.value)}):(r=n(i.value),{...i,width:Math.abs(n(i.value)-Kt.dividerWidth),x:0}))}render(t=!0){const n=this,r=this.getComponentContainer({ariaLabel:"meter lines"}),i=this.getOptions(),s=y(i,"meter","proportional"),a=this.model.getDisplayData(),o=this.model.getStatus(),{width:l}=N.getSVGElementSize(r,{useAttrs:!0}),{groupMapsTo:c}=i.data;let u;y(i,"meter","proportional")===null?u=100:u=y(i,"meter","proportional","total")||this.model.getMaximumDomain(this.model.getDisplayData());const d=je().domain([0,u]).range([0,l]),h=this.getStackedBounds(a,d),p=y(i,"meter","height");N.appendOrSelect(r,"rect.container").attr("x",0).attr("y",0).attr("width",l).attr("height",p||(s?Kt.height.proportional:Kt.height.default)),N.appendOrSelect(r,"line.rangeIndicator").attr("x1",l).attr("x2",l).attr("y1",0).attr("y2",p||(s?Kt.height.proportional:Kt.height.default));const f=r.selectAll("rect.value").data(h),g=o!=null&&!n.model.isUserProvidedColorScaleValid()&&!s?`value status--${o}`:"value";f.enter().append("rect").classed("value",!0).merge(f).attr("x",_=>_.x).attr("y",0).attr("height",()=>p||(s?Kt.height.proportional:Kt.height.default)).attr("class",_=>this.model.getColorClassName({classNameTypes:[st.FILL],dataGroupName:_[c],originalClassName:g})).transition().call(_=>this.services.transitions.setupTransition({transition:_,name:"meter-bar-update",animate:t})).attr("width",_=>_.value>u?d(u):Math.max(_.width,2)).style("fill",_=>n.model.getFillColor(_[c],null,_)).attr("role",ht.GRAPHICS_SYMBOL).attr("aria-roledescription","value").attr("aria-label",_=>_.value),f.exit().remove();const m=y(i,"meter","peak");let v=m;m!==null&&(m>u?v=u:m<0&&(v=0));const x=r.selectAll("line.peak").data(v==null?[]:[v]);x.enter().append("line").classed("peak",!0).merge(x).attr("y1",0).attr("y2",()=>p||(s?Kt.height.proportional:Kt.height.default)).transition().call(_=>this.services.transitions.setupTransition({transition:_,name:"peak-line-update",animate:t})).attr("x1",_=>d(_)).attr("x2",_=>d(_)).attr("role",ht.GRAPHICS_SYMBOL).attr("aria-roledescription","peak").attr("aria-label",_=>_),x.exit().remove(),this.services.domUtils.setSVGMaxHeight(),this.addEventListeners()}addEventListeners(){const t=this.getOptions(),{groupMapsTo:n}=t.data,r=this,i=y(t,"meter","proportional");this.parent.selectAll("rect.value").on("mouseover",function(s,a){const o=I(this);r.services.events.dispatchEvent(T.Meter.METER_MOUSEOVER,{event:s,element:o,datum:a}),i&&(o.classed("hovered",!0),r.services.events.dispatchEvent(T.Tooltip.SHOW,{event:s,hoveredElement:o,items:[{label:a[n],value:a.value}]}))}).on("mousemove",function(s,a){const o=I(this);r.services.events.dispatchEvent(T.Meter.METER_MOUSEMOVE,{event:s,element:o,datum:a}),i&&r.services.events.dispatchEvent(T.Tooltip.MOVE,{event:s})}).on("click",function(s,a){r.services.events.dispatchEvent(T.Meter.METER_CLICK,{event:s,element:I(this),datum:a})}).on("mouseout",function(s,a){const o=I(this);r.services.events.dispatchEvent(T.Meter.METER_MOUSEOUT,{event:s,element:o,datum:a}),i&&(o.classed("hovered",!1),r.services.events.dispatchEvent(T.Tooltip.HIDE,{hoveredElement:o}))})}destroy(){this.parent.selectAll("rect.value").on("mouseover",null).on("mousemove",null).on("mouseout",null).on("click",null)}}class CD extends gt{constructor(){super(...arguments),this.type="radar",this.renderType=it.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}=y(n,"radar","axes"),s=y(n,"data","groupMapsTo"),a=_C(this.uniqueKeys.map(o=>this.uniqueGroups.map(l=>({[r]:o,[s]:l,[i]:null}))));return at(a,t)},this.normalizeGroupedData=t=>{const n=this.getOptions(),{angle:r,value:i}=y(n,"radar","axes"),s=y(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:at(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?sr.opacity.unselected:sr.opacity.selected).style("stroke-opacity",r=>r.name!==n.datum().name?sr.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",sr.opacity.selected).style("stroke-opacity",1)}}init(){const{events:t}=this.services;t.addEventListener(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t=!0){const n=this.getComponentContainer({ariaLabel:"radar graph"}),{width:r,height:i}=N.getSVGElementSize(n,{useAttrs:!0}),s=this.model.getData(),a=this.model.getGroupedData(),o=this.getOptions(),l=y(o,"data","groupMapsTo"),c=y(o,"radar","axes","value"),{angle:u,value:d}=y(o,"radar","axes"),{xLabelPadding:h,yLabelPadding:p,yTicksNumber:f,minRange:g,xAxisRectHeight:m}=sr;this.uniqueKeys=Array.from(new Set(s.map(O=>O[u]))),this.uniqueGroups=Array.from(new Set(s.map(O=>O[l]))),this.fullDataNormalized=this.normalizeFlatData(s),this.groupedDataNormalized=this.normalizeGroupedData(a);const v=2*(this.getLabelDimensions(this.uniqueKeys[0]).height+p),x=(Math.min(r,i)-v)/2;if(x<=0)return;const _=Yi().domain(this.fullDataNormalized.map(O=>O[u])).range([0,2*Math.PI].map(O=>O-Math.PI/2)),E=In(this.fullDataNormalized.map(O=>O[d])),b=je().domain([E>=0?0:E,tr(this.fullDataNormalized.map(O=>O[d]))]).range([g,x]).nice(f),S=b.ticks(f),M=(O,w,L)=>this.model.getFillColor(O,w,L),D=JL().angle(O=>_(O[u])+Math.PI/2).radius(O=>b(O[d])).curve(ff),A=this.uniqueKeys.map(O=>{const w=this.getLabelDimensions(O).width,L=T2(_(O),x);return w+L}),R={x:tr(A)+h,y:i/2},$=N.appendOrSelect(n,"g.y-axes").attr("role",ht.GROUP).selectAll("path").data(S,O=>O),H=O=>this.uniqueKeys.map(w=>({[u]:w,[d]:O}));$.join(O=>O.append("path").attr("opacity",0).attr("transform",`translate(${R.x}, ${R.y})`).attr("fill","none").call(w=>w.transition().call(L=>this.services.transitions.setupTransition({transition:L,name:"radar_y_axes_enter",animate:t})).attr("opacity",1).attr("d",L=>D(H(L)))),O=>O.call(w=>w.transition().call(L=>this.services.transitions.setupTransition({transition:L,name:"radar_y_axes_update",animate:t})).attr("opacity",1).attr("transform",`translate(${R.x}, ${R.y})`).attr("d",L=>D(H(L)))),O=>O.call(w=>w.transition().call(L=>this.services.transitions.setupTransition({transition:L,name:"radar_y_axes_exit",animate:t})).attr("d",L=>D(H(L))).attr("opacity",0).remove())),N.appendOrSelect(n,"g.x-axes").attr("role",ht.GROUP).selectAll("line").data(this.uniqueKeys,O=>O).join(O=>O.append("line").attr("opacity",0).attr("class",w=>`x-axis-${Kr(w)}`).attr("stroke-dasharray","0").attr("x1",w=>Ut(_(w),0,R).x).attr("y1",w=>Ut(_(w),0,R).y).attr("x2",w=>Ut(_(w),0,R).x).attr("y2",w=>Ut(_(w),0,R).y).call(w=>w.transition().call(L=>this.services.transitions.setupTransition({transition:L,name:"radar_x_axes_enter",animate:t})).attr("opacity",1).attr("x1",L=>Ut(_(L),b.range()[0],R).x).attr("y1",L=>Ut(_(L),b.range()[0],R).y).attr("x2",L=>Ut(_(L),b.range()[1],R).x).attr("y2",L=>Ut(_(L),b.range()[1],R).y)),O=>O.call(w=>w.transition().call(L=>this.services.transitions.setupTransition({transition:L,name:"radar_x_axes_update",animate:t})).attr("opacity",1).attr("x1",L=>Ut(_(L),b.range()[0],R).x).attr("y1",L=>Ut(_(L),b.range()[0],R).y).attr("x2",L=>Ut(_(L),b.range()[1],R).x).attr("y2",L=>Ut(_(L),b.range()[1],R).y)),O=>O.call(w=>w.transition().call(L=>this.services.transitions.setupTransition({transition:L,name:"radar_x_axes_exit",animate:t})).attr("opacity",0).remove())),N.appendOrSelect(n,"g.x-labels").attr("role",ht.GROUP).selectAll("text").data(this.uniqueKeys).join(O=>O.append("text").text(w=>w).attr("opacity",0).attr("x",w=>Ut(_(w),b.range()[1]+h,R).x).attr("y",w=>Ut(_(w),b.range()[1]+h,R).y).style("text-anchor",w=>Cf(_(w)).textAnchor).style("dominant-baseline",w=>Cf(_(w)).dominantBaseline).call(w=>w.transition().call(L=>this.services.transitions.setupTransition({transition:L,name:"radar_x_labels_enter",animate:t})).attr("opacity",1)),O=>O.call(w=>w.transition().call(L=>this.services.transitions.setupTransition({transition:L,name:"radar_x_labels_update",animate:t})).attr("opacity",1).attr("x",L=>Ut(_(L),b.range()[1]+h,R).x).attr("y",L=>Ut(_(L),b.range()[1]+h,R).y).end().finally(()=>{const L=y(o,"radar","alignment"),k=this.getAlignmentXOffset(L,n,this.getParent());n.attr("x",k)})),O=>O.call(w=>w.transition().call(L=>this.services.transitions.setupTransition({transition:L,name:"radar_x_labels_exit",animate:t})).attr("opacity",0).remove())),N.appendOrSelect(n,"g.blobs").attr("role",ht.GROUP).selectAll("path").data(this.groupedDataNormalized,O=>O.name).join(O=>O.append("path").attr("class",w=>this.model.getColorClassName({classNameTypes:[st.FILL,st.STROKE],dataGroupName:w.name,originalClassName:"blob"})).attr("role",ht.GRAPHICS_SYMBOL).attr("aria-label",w=>w.name).attr("opacity",0).attr("transform",t?()=>`translate(${R.x}, ${R.y}) scale(${1+Math.random()*.35})`:`translate(${R.x}, ${R.y})`).style("fill",w=>M(w.name,null,w.data)).style("fill-opacity",sr.opacity.selected).style("stroke",w=>M(w.name,null,w.data)).call(w=>{const L=w.transition().call(k=>this.services.transitions.setupTransition({transition:k,name:"radar_blobs_enter",animate:t}));t&&L.delay(()=>Math.random()*30).attr("transform",`translate(${R.x}, ${R.y})`),L.attr("opacity",1).attr("d",k=>D(k.data))}),O=>(O.attr("class",w=>this.model.getColorClassName({classNameTypes:[st.FILL,st.STROKE],dataGroupName:w.name,originalClassName:"blob"})).style("fill",w=>M(w.name,null,w.data)).style("stroke",w=>M(w.name,null,w.data)),O.call(w=>w.transition().call(L=>this.services.transitions.setupTransition({transition:L,name:"radar_blobs_update",animate:t})).attr("opacity",1).attr("transform",`translate(${R.x}, ${R.y})`).attr("d",L=>D(L.data))),O),O=>O.call(w=>{const L=w.transition().call(k=>this.services.transitions.setupTransition({transition:k,name:"radar_blobs_exit",animate:t}));t&&L.delay(()=>Math.random()*30).attr("transform",()=>`translate(${R.x}, ${R.y}) scale(${1+Math.random()*.35})`),L.attr("opacity",0).remove()})),N.appendOrSelect(n,"g.dots").attr("role",ht.GROUP).selectAll("circle").data(this.fullDataNormalized.filter(O=>y(O,d)!==null)).join(O=>O.append("circle").attr("role",ht.GRAPHICS_SYMBOL).attr("aria-label",w=>w[c]),O=>O,O=>O.remove()).attr("class",O=>this.model.getColorClassName({classNameTypes:[st.FILL],dataGroupName:O[l],originalClassName:Kr(O[u])})).attr("cx",O=>Ut(_(O[u]),b(O[d]),R).x).attr("cy",O=>Ut(_(O[u]),b(O[d]),R).y).attr("r",0).attr("opacity",0).style("fill",O=>M(O[l])),N.appendOrSelect(n,"g.x-axes-rect").attr("role",ht.GROUP).selectAll("rect").data(this.uniqueKeys).join(O=>O.append("rect"),O=>O,O=>O.remove()).attr("x",R.x).attr("y",R.y-m/2).attr("width",b.range()[1]).attr("height",m).style("fill","red").style("fill-opacity",0).attr("transform",O=>`rotate(${Af(_(O))}, ${R.x}, ${R.y})`);const{code:P,number:B}=y(o,"locale");N.appendOrSelect(n,"g.y-labels").attr("role",ht.GROUP).selectAll("text").data(Ge(S)).join(O=>O.append("text").attr("opacity",0).text(w=>B(w,P)).attr("x",w=>Ut(-Math.PI/2,b(w),R).x+p).attr("y",w=>Ut(-Math.PI/2,b(w),R).y).style("text-anchor","start").style("dominant-baseline","middle").call(w=>w.transition().call(L=>this.services.transitions.setupTransition({transition:L,name:"radar_y_labels_enter",animate:t})).attr("opacity",1)),O=>O.call(w=>w.transition().call(L=>this.services.transitions.setupTransition({transition:L,name:"radar_y_labels_update",animate:t})).text(L=>L).attr("opacity",1).attr("x",L=>Ut(-Math.PI/2,b(L),R).x+p).attr("y",L=>Ut(-Math.PI/2,b(L),R).y)),O=>O.call(w=>w.transition().call(L=>this.services.transitions.setupTransition({transition:L,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===zt.CENTER?a=Math.floor((s-i.width)/2):t===zt.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(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}addEventListeners(){const t=this,{axes:{angle:n}}=y(this.getOptions(),"radar");this.parent.selectAll(".x-axes-rect > rect").on("mouseover",function(r,i){const s=I(this);t.services.events.dispatchEvent(T.Radar.X_AXIS_MOUSEOVER,{event:r,element:s,datum:i});const a=t.parent.select(`.x-axes .x-axis-${Kr(i)}`),o=t.parent.selectAll(`.dots circle.${Kr(i)}`),l=t.model.getActiveDataGroupNames(),c=t.getOptions(),{groupMapsTo:u}=c.data,d=y(c,"radar","axes","value");a.classed("hovered",!0).attr("stroke-dasharray","4 4"),o.classed("hovered",!0).attr("opacity",p=>l.indexOf(p[u])!==-1?1:0).attr("r",sr.dotsRadius);const h=t.fullDataNormalized.filter(p=>p[n]===i&&l.indexOf(p[u])!==-1);t.services.events.dispatchEvent(T.Tooltip.SHOW,{event:r,hoveredElement:s,items:h.filter(p=>typeof p[d]=="number").map(p=>({label:p[u],value:p[d],color:t.model.getFillColor(p[u],null,p),class:t.model.getColorClassName({classNameTypes:[st.TOOLTIP],dataGroupName:p[u]})}))})}).on("mousemove",function(r,i){const s=I(this);t.services.events.dispatchEvent(T.Radar.X_AXIS_MOUSEMOVE,{event:r,element:s,datum:i}),t.services.events.dispatchEvent(T.Tooltip.MOVE,{event:r})}).on("click",function(r,i){t.services.events.dispatchEvent(T.Radar.X_AXIS_CLICK,{event:r,element:I(this),datum:i})}).on("mouseout",function(r,i){const s=I(this),a=t.parent.select(`.x-axes .x-axis-${Kr(i)}`),o=t.parent.selectAll(`.dots circle.${Kr(i)}`);a.classed("hovered",!1).attr("stroke-dasharray","0"),o.classed("hovered",!1).attr("opacity",0).attr("r",0),t.services.events.dispatchEvent(T.Radar.X_AXIS_MOUSEOUT,{event:r,element:s,datum:i}),t.services.events.dispatchEvent(T.Tooltip.HIDE)})}}class jg extends vu{constructor(){super(...arguments),this.type="simple-bar",this.renderType=it.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(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t){const n=this.getOptions(),{groupMapsTo:r}=n.data,i=this.getComponentContainer({ariaLabel:"bar graphs",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:[st.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,p=h+u;let f,g;if(Array.isArray(d)&&d.length===2)f=this.services.cartesianScales.getRangeValue(d[0]),g=this.services.cartesianScales.getRangeValue(d[1]);else{const v=this.services.cartesianScales.getRangeScale().domain()[0];f=this.services.cartesianScales.getRangeValue(Math.max(0,v)),g=this.services.cartesianScales.getRangeValue(l)}const m=Math.abs(g-f);if(m!==0&&m<2&&(d>0&&a===Gt.VERTICAL||d<0&&a===Gt.HORIZONTAL?g=f-2:g=f+2),!this.isOutsideZoomedDomain(h,p))return ie({x0:h,x1:p,y0:f,y1:g},a)}).attr("opacity",1).attr("role",ht.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=I(this);i.classed("hovered",!0),t.services.events.dispatchEvent(T.Bar.BAR_MOUSEOVER,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(T.Tooltip.SHOW,{event:n,hoveredElement:i,data:[r]})}).on("mousemove",function(n,r){t.services.events.dispatchEvent(T.Bar.BAR_MOUSEMOVE,{event:n,element:I(this),datum:r}),t.services.events.dispatchEvent(T.Tooltip.MOVE,{event:n})}).on("click",function(n,r){t.services.events.dispatchEvent(T.Bar.BAR_CLICK,{event:n,element:I(this),datum:r})}).on("mouseout",function(n,r){const i=I(this);i.classed("hovered",!1),t.services.events.dispatchEvent(T.Bar.BAR_MOUSEOUT,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(T.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(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}}class AD extends ce{constructor(){super(...arguments),this.type="skeleton-lines"}render(t=!0){const n=y(this.getOptions(),"data","loading"),r=!y(this.getOptions(),"grid","x","enabled")&&!y(this.getOptions(),"grid","y","enabled")&&!y(this.getOptions(),"axes","bottom","visible")&&!y(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 Wg extends gt{constructor(){super(...arguments),this.type="area-stacked",this.renderType=it.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=>y(s,0,i)!==n.datum().name?vn.opacity.unselected:vn.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",vn.opacity.selected)}}init(){const t=this.services.events;t.addEventListener(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t=!0){const n=this.getComponentContainer({ariaLabel:"stacked area graphs",withinChartClip:!0}),r=this,i=this.getOptions(),{groupMapsTo:s}=i.data,a=Object.keys(i.axes).some(p=>i.axes[p].percentage),o=this.model.getStackedData({percentage:a,groups:this.configs.groups}),l=y(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,p=>y(p,0,s));this.areaGenerator=tu().x(p=>this.services.cartesianScales.getValueThroughAxisPosition(c,p.data.sharedStackKey)).y0(p=>d(p[0])).y1(p=>d(p[1])).curve(this.services.curves.getD3Curve()),h.exit().attr("opacity",0).remove(),h.enter().append("path").attr("opacity",0).merge(h).data(o,p=>y(p,0,s)).attr("class","area").attr("class",p=>this.model.getColorClassName({classNameTypes:[st.FILL],dataGroupName:y(p,0,s),originalClassName:"area"})).style("fill",p=>r.model.getFillColor(y(p,0,s),null,p)).attr("role",ht.GRAPHICS_SYMBOL).attr("aria-roledescription","area").attr("aria-label",p=>y(p,0,s)).transition().call(p=>this.services.transitions.setupTransition({transition:p,name:"area-update-enter",animate:t})).attr("opacity",vn.opacity.selected).attr("d",this.areaGenerator)}}class qg extends vu{constructor(){super(...arguments),this.type="stacked-bar",this.renderType=it.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(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t){const n=this.getComponentContainer({ariaLabel:"stacked bar graphs",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=>y(c,0,i));o.exit().attr("opacity",0).remove(),o.enter().append("g").classed("bars",!0).attr("role",ht.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:[st.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,p=h+d,f=this.services.cartesianScales.getRangeValue(c[0]);let g=this.services.cartesianScales.getRangeValue(c[1]);if(!this.isOutsideZoomedDomain(h,p)){if(Math.abs(g-f)>0&&Math.abs(g-f)>r.bars.dividerSize){const m=c[0]<0&&c[1]<=0;m&&a.length>1?this.services.cartesianScales.getOrientation()===Gt.VERTICAL?g+=c[1]===0?2:1:g-=1:m||(this.services.cartesianScales.getOrientation()===Gt.VERTICAL?g+=1:g-=1)}return ie({x0:h,x1:p,y0:f,y1:g},this.services.cartesianScales.getOrientation())}}).attr("opacity",1).attr("role",ht.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=I(this);a.classed("hovered",!0),r.services.events.dispatchEvent(T.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(T.Tooltip.SHOW,{event:i,hoveredElement:a,data:[o]})}).on("mousemove",function(i,s){const a=I(this);r.services.events.dispatchEvent(T.Bar.BAR_MOUSEMOVE,{event:i,element:a,datum:s}),r.services.events.dispatchEvent(T.Tooltip.MOVE,{event:i})}).on("click",function(i,s){r.services.events.dispatchEvent(T.Bar.BAR_CLICK,{event:i,element:I(this),datum:s})}).on("mouseout",function(i,s){const a=I(this);a.classed("hovered",!1),r.services.events.dispatchEvent(T.Bar.BAR_MOUSEOUT,{event:i,element:a,datum:s}),r.services.events.dispatchEvent(T.Tooltip.HIDE,{hoveredElement:a})})}getBarWidth(){const t=this.getOptions();if(y(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=y(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(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}}class Yg extends cn{constructor(){super(...arguments),this.type="scatter-stacked",this.renderType=it.SVG}render(t){if(!y(this.getOptions(),"points","enabled"))return;const n=this.getComponentContainer({ariaLabel:"scatter points",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=>y(u,0,i));o.exit().attr("opacity",0).remove();const l=o.enter().append("g").classed("dots",!0).attr("role",ht.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),p=this.services.cartesianScales.getRangeIdentifier(u);return{[i]:d,[h]:u.data.sharedStackKey,[p]: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],p=u.data.sharedStackKey;let f=u.data[h];const g=u[1],m=this.services.cartesianScales.getDomainIdentifier(u),v=this.services.cartesianScales.getRangeIdentifier(u);f!=null&&t===this.services.cartesianScales.getDomainValue(p)&&n===this.services.cartesianScales.getRangeValue(g)&&(s&&(f=this.model.getStackedData({groups:this.configs.groups})[c][d].data[h]),f!==null&&o.push({[i]:h,[m]:p,[v]:f}))})}),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 Es=6;class LD extends gt{constructor(){super(...arguments),this.type="tree",this.renderType=it.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({ariaLabel:"tree diagram"});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=y(s,"tree","rootTitle")||"Tree",l=this.getMockLabelWidth(n,o),c=this.getLongestLabel(a),u=this.getMockLabelWidth(n,c),d={left:l>0?l+Es:30-Es},h=hs({name:o,children:a}),p=10,f=r/6,g=S=>{const M=h.descendants().reverse(),D=h.links();let A=h,R=h;h.eachBefore(k=>{k.x<A.x&&(A=k),k.x>R.x&&(R=k)});const $=R.x-A.x,H=n.transition().call(k=>this.services.transitions.setupTransition({transition:k,name:"tree-update-viewbox",animate:!0})).attr("viewBox",[-d.left,A.x,r,$].join(" ")),P=b.selectAll("g").data(M,k=>k.id),B=this,O=P.enter().append("g").attr("transform",()=>`translate(${S.y0},${S.x0})`).attr("class",k=>k.depth!==0&&k.children&&k.children.length>0?"clickable":null).on("mouseover",function(k,U){B.services.events.dispatchEvent(T.Tree.NODE_MOUSEOVER,{event:k,element:I(this),datum:U})}).on("click",function(k,U){U.depth!==0&&(U.children=U.children?null:U._children,g(U)),B.services.events.dispatchEvent(T.Tree.NODE_CLICK,{event:k,element:I(this),datum:U})}).on("mouseout",function(k,U){B.services.events.dispatchEvent(T.Tree.NODE_MOUSEOUT,{event:k,element:I(this),datum:U})});O.append("circle").attr("r",2.5).attr("class",k=>k._children?"parent":"child").attr("stroke-width",10),O.append("text").attr("dy","0.31em").attr("x",k=>k._children?-6:Es).attr("text-anchor",k=>k._children?"end":"start").text(k=>k.data.name).clone(!0).attr("class","text-stroke").lower(),P.merge(O).transition(H).attr("transform",k=>`translate(${k.y},${k.x})`).attr("fill-opacity",1).attr("stroke-opacity",1),P.exit().transition(H).remove().attr("transform",()=>`translate(${S.y},${S.x})`).attr("fill-opacity",0).attr("stroke-opacity",0);const w=E.selectAll("path").data(D,k=>k.target.id),L=w.enter().append("path").attr("d",()=>{const k={x:S.x0,y:S.y0};return _({source:k,target:k})});w.merge(L).transition(H).attr("d",_),w.exit().transition(H).remove().attr("d",()=>{const k={x:S.x,y:S.y};return _({source:k,target:k})}),h.eachBefore(k=>{k.x0=k.x,k.y0=k.y})},m=h.descendants(),v=m[m.length-1].depth,x=y(s,"tree","type")===$s.DENDROGRAM?XA().size([i,r-u-v*Es-l]):NL().nodeSize([p,f]).size([i,r-u-v*Es-l]),_=sk().x(S=>S.y).y(S=>S.x);h.x0=f/2,h.y0=0,h.descendants().forEach((S,M)=>{S.id=M,S._children=S.children}),x(h),n.attr("viewBox",[-d.left,-0,r,p]).style("user-select","none");const E=n.append("g").attr("class","links"),b=n.append("g").attr("class","nodes");g(h)}}var kD="#000000",DD="#ffffff",RD="#fcf4d6",ID="#fddc69",ND="#f1c21b",PD="#d2a106",UD="#b28600",BD="#8e6a00",HD="#684e00",VD="#483700",GD="#302400",zD="#1c1500",FD={10:RD,20:ID,30:ND,40:PD,50:UD,60:BD,70:HD,80:VD,90:GD,100:zD},jD="#fff2e8",WD="#ffd9be",qD="#ffb784",YD="#ff832b",XD="#eb6200",ZD="#ba4e00",KD="#8a3800",QD="#5e2900",JD="#3e1a00",tR="#231000",eR={10:jD,20:WD,30:qD,40:YD,50:XD,60:ZD,70:KD,80:QD,90:JD,100:tR},nR="#fff1f1",rR="#ffd7d9",iR="#ffb3b8",sR="#ff8389",aR="#fa4d56",oR="#da1e28",lR="#a2191f",cR="#750e13",uR="#520408",hR="#2d0709",dR={10:nR,20:rR,30:iR,40:sR,50:aR,60:oR,70:lR,80:cR,90:uR,100:hR},pR="#fff0f7",fR="#ffd6e8",mR="#ffafd2",gR="#ff7eb6",vR="#ee5396",yR="#d02670",xR="#9f1853",bR="#740937",_R="#510224",ER="#2a0a18",OR={10:pR,20:fR,30:mR,40:gR,50:vR,60:yR,70:xR,80:bR,90:_R,100:ER},SR="#f6f2ff",TR="#e8daff",wR="#d4bbff",$R="#be95ff",MR="#a56eff",CR="#8a3ffc",AR="#6929c4",LR="#491d8b",kR="#31135e",DR="#1c0f30",RR={10:SR,20:TR,30:wR,40:$R,50:MR,60:CR,70:AR,80:LR,90:kR,100:DR},IR="#edf5ff",NR="#d0e2ff",PR="#a6c8ff",UR="#78a9ff",BR="#4589ff",HR="#0f62fe",VR="#0043ce",GR="#002d9c",zR="#001d6c",FR="#001141",jR={10:IR,20:NR,30:PR,40:UR,50:BR,60:HR,70:VR,80:GR,90:zR,100:FR},WR="#e5f6ff",qR="#bae6ff",YR="#82cfff",XR="#33b1ff",ZR="#1192e8",KR="#0072c3",QR="#00539a",JR="#003a6d",tI="#012749",eI="#061727",nI={10:WR,20:qR,30:YR,40:XR,50:ZR,60:KR,70:QR,80:JR,90:tI,100:eI},rI="#d9fbfb",iI="#9ef0f0",sI="#3ddbd9",aI="#08bdba",oI="#009d9a",lI="#007d79",cI="#005d5d",uI="#004144",hI="#022b30",dI="#081a1c",pI={10:rI,20:iI,30:sI,40:aI,50:oI,60:lI,70:cI,80:uI,90:hI,100:dI},fI="#defbe6",mI="#a7f0ba",gI="#6fdc8c",vI="#42be65",yI="#24a148",xI="#198038",bI="#0e6027",_I="#044317",EI="#022d0d",OI="#071908",SI={10:fI,20:mI,30:gI,40:vI,50:yI,60:xI,70:bI,80:_I,90:EI,100:OI},TI="#f2f4f8",wI="#dde1e6",$I="#c1c7cd",MI="#a2a9b0",CI="#878d96",AI="#697077",LI="#4d5358",kI="#343a3f",DI="#21272a",RI="#121619",II={10:TI,20:wI,30:$I,40:MI,50:CI,60:AI,70:LI,80:kI,90:DI,100:RI},NI="#f4f4f4",PI="#e0e0e0",UI="#c6c6c6",BI="#a8a8a8",HI="#8d8d8d",VI="#6f6f6f",GI="#525252",zI="#393939",FI="#262626",jI="#161616",WI={10:NI,20:PI,30:UI,40:BI,50:HI,60:VI,70:GI,80:zI,90:FI,100:jI},qI="#f7f3f2",YI="#e5e0df",XI="#cac5c4",ZI="#ada8a8",KI="#8f8b8b",QI="#726e6e",JI="#565151",tN="#3c3838",eN="#272525",nN="#171414",rN={10:qI,20:YI,30:XI,40:ZI,50:KI,60:QI,70:JI,80:tN,90:eN,100:nN},Xg={black:{100:kD},blue:jR,coolGray:II,cyan:nI,gray:WI,green:SI,magenta:OR,orange:eR,purple:RR,red:dR,teal:pI,warmGray:rN,white:{0:DD},yellow:FD};const iN=e=>{if(!e)return null;for(const t of Object.keys(Xg)){const n=Xg[t];for(const r of Object.keys(n))if(n[+r]===e)return r}return null},Zg=function(e){const t=I(this.parentNode).select("rect.leaf"),n=e.backgroundColor??getComputedStyle(t.node(),null).getPropertyValue("fill"),r=fn(n);let i;if(r&&(i=iN(r?r.hex():null)),i==null){const s=Ld(r).l;i=Math.abs(s*100-100)}return i>50?"white":"black"};let sN=0;class aN extends gt{constructor(){super(...arguments),this.type="treemap",this.renderType=it.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(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t=!0){const n=this.getComponentContainer({ariaLabel:"treemap"});this.model.getData();const r=this.model.getDisplayData(),i=this.model.getOptions(),s=y(window,"location"),{width:a,height:o}=N.getSVGElementSize(n,{useAttrs:!0}),l=hs({name:i.title||"Treemap",children:r}).sum(p=>p.value).sort((p,f)=>f.value-p.value),c=VL().size([a,o]).paddingInner(1).paddingOuter(0).round(!0)(l),u=n.selectAll("g[data-name='leaf']").data(c.leaves(),p=>p.data.name);u.exit().attr("opacity",0).remove();const d=u.enter().append("g").attr("data-name","leaf").attr("data-uid",()=>sN++).merge(u);d.attr("data-name","leaf").transition().call(p=>this.services.transitions.setupTransition({transition:p,name:"treemap-group-update",animate:t})).attr("transform",p=>`translate(${p.x0},${p.y0})`);const h=d.selectAll("rect.leaf").data(p=>[p]);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 p=I(this.parentNode).attr("data-uid");return`${i.style.prefix}-leaf-${p}`}).attr("class",p=>{for(;p.depth>1;)p=p.parent;return this.model.getColorClassName({classNameTypes:[st.FILL],dataGroupName:p.data.name,originalClassName:"leaf"})}).transition().call(p=>this.services.transitions.setupTransition({transition:p,name:"treemap-leaf-update-enter",animate:t})).attr("width",p=>p.x1-p.x0).attr("height",p=>p.y1-p.y0).style("fill",p=>{for(;p.depth>1;)p=p.parent;return this.model.getFillColor(p.data.name,null,p.data)}),d.selectAll("clipPath").data(p=>p.data.showLabel!==!0?[]:[1],p=>p).join(p=>p.append("clipPath").attr("id",function(){const f=I(this.parentNode).attr("data-uid");return`${i.style.prefix}-clip-${f}`}).append("use").attr("xlink:href",function(){const f=I(this.parentNode.parentNode).attr("data-uid"),g=`${i.style.prefix}-leaf-${f}`;return new URL(`#${g}`,s)+""}),p=>null,p=>p.remove()),d.selectAll("text").data(p=>{if(p.data.showLabel!==!0)return[];let f=p;for(;f.depth>1;)f=f.parent;return[{text:p.data.name,backgroundColor:this.model.getFillColor(f.data.name)}]},p=>p).join(p=>{const f=p.append("text").text(g=>g.text).style("fill",Zg).attr("x",7).attr("y",18);return s&&f.attr("clip-path",function(){const g=I(this.parentNode).attr("data-uid"),m=`${i.style.prefix}-clip-${g}`;return`url(${new URL(`#${m}`,s)+""})`}),f},p=>p.text(f=>f.text).style("fill",Zg),p=>p.remove()),this.addEventListeners()}addEventListeners(){const t=this;this.parent.selectAll("rect.leaf").on("mouseover",function(n,r){const i=I(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),fn(s).darker(.7).toString()}),t.services.events.dispatchEvent(T.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(T.Treemap.LEAF_MOUSEOVER,{event:n,element:i,datum:r})}).on("mousemove",function(n,r){const i=I(this);t.services.events.dispatchEvent(T.Treemap.LEAF_MOUSEMOVE,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(T.Tooltip.MOVE,{event:n})}).on("click",function(n,r){t.services.events.dispatchEvent(T.Treemap.LEAF_CLICK,{event:n,element:I(this),datum:r})}).on("mouseout",function(n,r){const i=I(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(T.Treemap.LEAF_MOUSEOUT,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(T.Tooltip.HIDE,{hoveredElement:i})})}}function oN(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function lN(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}),n}var cN={value:function(){}};function Kg(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new uo(n)}function uo(e){this._=e}function uN(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",i=n.indexOf(".");if(i>=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}uo.prototype=Kg.prototype={constructor:uo,on:function(e,t){var n=this._,r=uN(e+"",n),i,s=-1,a=r.length;if(arguments.length<2){for(;++s<a;)if((i=(e=r[s]).type)&&(i=hN(n[i],e.name)))return i;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++s<a;)if(i=(e=r[s]).type)n[i]=Qg(n[i],e.name,t);else if(t==null)for(i in n)n[i]=Qg(n[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new uo(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=new Array(i),r=0,i,s;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(s=this._[e],r=0,i=s.length;r<i;++r)s[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],i=0,s=r.length;i<s;++i)r[i].value.apply(t,n)}};function hN(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function Qg(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=cN,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}const dN=Object.freeze(Object.defineProperty({__proto__:null,dispatch:Kg},Symbol.toStringTag,{value:"Module"})),pN=lN(dN);var yu,Jg;function fN(){if(Jg)return yu;Jg=1;const e=pN.dispatch,t=Math.PI/180,n={archimedean:g,rectangular:m},r=64,i=2048;yu=function(){var E=[256,256],b=s,S=a,M=l,D=o,A=o,R=c,$=u,H=g,P=[],B=1/0,O=e("word","end"),w=null,L=Math.random,k={},U=x;k.canvas=function(j){return arguments.length?(U=_(j),k):U},k.start=function(){var j=K(U()),X=v((E[0]>>5)*E[1]),ct=null,J=P.length,Y=-1,et=[],ut=P.map(function(q,Z){return q.text=b.call(this,q,Z),q.font=S.call(this,q,Z),q.style=D.call(this,q,Z),q.weight=A.call(this,q,Z),q.rotate=R.call(this,q,Z),q.size=~~M.call(this,q,Z),q.padding=$.call(this,q,Z),q}).sort(function(q,Z){return Z.size-q.size});return w&&clearInterval(w),w=setInterval(F,0),F(),k;function F(){for(var q=Date.now();Date.now()-q<B&&++Y<J&&w;){var Z=ut[Y];Z.x=E[0]*(L()+.5)>>1,Z.y=E[1]*(L()+.5)>>1,d(j,Z,ut,Y),Z.hasText&&W(X,Z,ct)&&(et.push(Z),O.call("word",k,Z),ct?p(ct,Z):ct=[{x:Z.x+Z.x0,y:Z.y+Z.y0},{x:Z.x+Z.x1,y:Z.y+Z.y1}],Z.x-=E[0]>>1,Z.y-=E[1]>>1)}Y>=J&&(k.stop(),O.call("end",k,et,ct))}},k.stop=function(){w&&(clearInterval(w),w=null);for(const j of P)delete j.sprite;return k};function K(j){const X=j.getContext("2d",{willReadFrequently:!0});j.width=j.height=1;const ct=Math.sqrt(X.getImageData(0,0,1,1).data.length>>2);return j.width=(r<<5)/ct,j.height=i/ct,X.fillStyle=X.strokeStyle="red",{context:X,ratio:ct}}function W(j,X,ct){E[0],E[1];for(var J=X.x,Y=X.y,et=Math.sqrt(E[0]*E[0]+E[1]*E[1]),ut=H(E),F=L()<.5?1:-1,q=-F,Z,G,dt;(Z=ut(q+=F))&&(G=~~Z[0],dt=~~Z[1],!(Math.min(Math.abs(G),Math.abs(dt))>=et));)if(X.x=J+G,X.y=Y+dt,!(X.x+X.x0<0||X.y+X.y0<0||X.x+X.x1>E[0]||X.y+X.y1>E[1])&&(!ct||f(X,ct))&&!h(X,j,E[0])){for(var ot=X.sprite,It=X.width>>5,Ht=E[0]>>5,rt=X.x-(It<<4),Et=rt&127,Ne=32-Et,Te=X.y1-X.y0,Ss=(X.y+X.y0)*Ht+(rt>>5),Ts,_r=0;_r<Te;_r++){Ts=0;for(var Ze=0;Ze<=It;Ze++)j[Ss+Ze]|=Ts<<Ne|(Ze<It?(Ts=ot[_r*It+Ze])>>>Et:0);Ss+=Ht}return!0}return!1}return k.timeInterval=function(j){return arguments.length?(B=j??1/0,k):B},k.words=function(j){return arguments.length?(P=j,k):P},k.size=function(j){return arguments.length?(E=[+j[0],+j[1]],k):E},k.font=function(j){return arguments.length?(S=_(j),k):S},k.fontStyle=function(j){return arguments.length?(D=_(j),k):D},k.fontWeight=function(j){return arguments.length?(A=_(j),k):A},k.rotate=function(j){return arguments.length?(R=_(j),k):R},k.text=function(j){return arguments.length?(b=_(j),k):b},k.spiral=function(j){return arguments.length?(H=n[j]||j,k):H},k.fontSize=function(j){return arguments.length?(M=_(j),k):M},k.padding=function(j){return arguments.length?($=_(j),k):$},k.random=function(j){return arguments.length?(L=j,k):L},k.on=function(){var j=O.on.apply(O,arguments);return j===O?k:j},k};function s(E){return E.text}function a(){return"serif"}function o(){return"normal"}function l(E){return Math.sqrt(E.value)}function c(){return(~~(random()*6)-3)*30}function u(){return 1}function d(E,b,S,M){if(!b.sprite){var D=E.context,A=E.ratio;D.clearRect(0,0,(r<<5)/A,i/A);var R=0,$=0,H=0,P=S.length;for(--M;++M<P;){b=S[M],D.save(),D.font=b.style+" "+b.weight+" "+~~((b.size+1)/A)+"px "+b.font;const Z=D.measureText(b.text),G=-Math.floor(Z.width/2);let dt=(Z.width+1)*A,ot=b.size<<1;if(b.rotate){var B=Math.sin(b.rotate*t),O=Math.cos(b.rotate*t),w=dt*O,L=dt*B,k=ot*O,U=ot*B;dt=Math.max(Math.abs(w+U),Math.abs(w-U))+31>>5<<5,ot=~~Math.max(Math.abs(L+k),Math.abs(L-k))}else dt=dt+31>>5<<5;if(ot>H&&(H=ot),R+dt>=r<<5&&(R=0,$+=H,H=0),$+ot>=i)break;D.translate((R+(dt>>1))/A,($+(ot>>1))/A),b.rotate&&D.rotate(b.rotate*t),D.fillText(b.text,G,0),b.padding&&(D.lineWidth=2*b.padding,D.strokeText(b.text,G,0)),D.restore(),b.width=dt,b.height=ot,b.xoff=R,b.yoff=$,b.x1=dt>>1,b.y1=ot>>1,b.x0=-b.x1,b.y0=-b.y1,b.hasText=!0,R+=dt}for(var K=D.getImageData(0,0,(r<<5)/A,i/A).data,W=[];--M>=0;)if(b=S[M],!!b.hasText){for(var j=b.width,X=j>>5,ct=b.y1-b.y0,J=0;J<ct*X;J++)W[J]=0;if(R=b.xoff,R==null)return;$=b.yoff;for(var Y=0,et=-1,ut=0;ut<ct;ut++){for(var J=0;J<j;J++){var F=X*ut+(J>>5),q=K[($+ut)*(r<<5)+(R+J)<<2]?1<<31-J%32:0;W[F]|=q,Y|=q}Y?et=ut:(b.y0++,ct--,ut--,$++)}b.y1=b.y0+et,b.sprite=W.slice(0,(b.y1-b.y0)*X)}}}function h(E,b,S){S>>=5;for(var M=E.sprite,D=E.width>>5,A=E.x-(D<<4),R=A&127,$=32-R,H=E.y1-E.y0,P=(E.y+E.y0)*S+(A>>5),B,O=0;O<H;O++){B=0;for(var w=0;w<=D;w++)if((B<<$|(w<D?(B=M[O*D+w])>>>R:0))&b[P+w])return!0;P+=S}return!1}function p(E,b){var S=E[0],M=E[1];b.x+b.x0<S.x&&(S.x=b.x+b.x0),b.y+b.y0<S.y&&(S.y=b.y+b.y0),b.x+b.x1>M.x&&(M.x=b.x+b.x1),b.y+b.y1>M.y&&(M.y=b.y+b.y1)}function f(E,b){return E.x+E.x1>b[0].x&&E.x+E.x0<b[1].x&&E.y+E.y1>b[0].y&&E.y+E.y0<b[1].y}function g(E){var b=E[0]/E[1];return function(S){return[b*(S*=.1)*Math.cos(S),S*Math.sin(S)]}}function m(E){var b=4,S=b*E[0]/E[1],M=0,D=0;return function(A){var R=A<0?-1:1;switch(Math.sqrt(1+4*R*A)-R&3){case 0:M+=S;break;case 1:D+=b;break;case 2:M-=S;break;default:D-=b;break}return[M,D]}}function v(E){for(var b=[],S=-1;++S<E;)b[S]=0;return b}function x(){return document.createElement("canvas")}function _(E){return typeof E=="function"?E:function(){return E}}return yu}var mN=fN();const gN=oN(mN);class vN extends gt{constructor(){super(...arguments),this.type="wordcloud",this.renderType=it.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(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t=!0){const n=this,r=this.getComponentContainer({ariaLabel:"word cloud"}).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=gN().size([u,d]).words(i.map(function(f){const g=f[o];if(typeof f[o]!="number")throw Error("Badly formatted WordCloud data. `value` should only be an integer or float");return{[c]:f[c],text:f[l],size:g,value:g}})).padding(5).rotate(0).fontSize(f=>s(f.size)).on("end",p);h.start();function p(f){const g=N.appendOrSelect(r,"g.words");g.attr("transform",`translate(${h.size()[0]/2}, ${h.size()[1]/2})`);const m=g.selectAll("text").data(f,v=>`${v[c]}-${v.text}`);m.exit().attr("opacity",0).remove(),m.enter().append("text").attr("opacity",0).merge(m).style("font-size",v=>`${v.size}px`).text(function(v){return v.text}).attr("class",v=>n.model.getColorClassName({classNameTypes:[st.FILL],dataGroupName:v[c],originalClassName:`word ${v.size>32?"light":""}`})).style("fill",v=>n.model.getFillColor(v[c],v.text,v)).attr("text-anchor","middle").transition().call(v=>n.services.transitions.setupTransition({transition:v,name:"wordcloud-text-update-enter",animate:t})).attr("transform",v=>`translate(${v.x}, ${v.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?Ge(i):[1,1];return je().domain(o).range(a?n.wordCloud.fontSizeRange(s,t):[4,4])}addEventListeners(){const t=this.getOptions(),{groupMapsTo:n}=t.data,r=this,i=ga(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(T.WordCloud.WORD_MOUSEOVER,{event:s,element:I(this),datum:a}),r.services.events.dispatchEvent(T.Tooltip.SHOW,{event:s,hoveredElement:o,items:[{label:t.tooltip.wordLabel,value:a.text},{label:t.tooltip.valueLabel,value:a.value},{label:yt(t,"locale.translations.group")||yt(t,"tooltip.groupLabel")||"Group",value:a[n],class:r.model.getColorClassName({classNameTypes:[st.TOOLTIP],dataGroupName:a[n]})}]})}).on("mousemove",function(s,a){const o=I(this);r.services.events.dispatchEvent(T.WordCloud.WORD_MOUSEMOVE,{element:o,datum:a}),r.services.events.dispatchEvent(T.Tooltip.MOVE,{event:s})}).on("click",function(s,a){r.services.events.dispatchEvent(T.WordCloud.WORD_CLICK,{event:s,element:I(this),datum:a})}).on("mouseout",function(s,a){const o=I(this);i(null),r.services.events.dispatchEvent(T.WordCloud.WORD_MOUSEOUT,{event:s,element:o,datum:a}),r.services.events.dispatchEvent(T.Tooltip.HIDE,{hoveredElement:o})})}}class yN extends gt{constructor(){super(...arguments),this.type="geo",this.renderType=it.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=y(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=uD(s,Object.values(l)),u=oD(s,{type:"GeometryCollection",geometries:Object.values(o)}),d=i.fitSize([n,r],u),h=_A().projection(d);N.appendOrSelect(t,"g.geo").selectAll("path").data(u.features).join("path").attr("d",h);const p=this.services.domUtils.generateElementIDString("geo-pattern-stripes"),f=N.appendOrSelect(t,"defs");N.appendOrSelect(f,"pattern").attr("id",p).attr("width",5).attr("height",10).attr("patternUnits","userSpaceOnUse").attr("patternTransform","rotate(45)").append("path").classed("pattern-fill",!0).attr("d",ms()([[0,0],[0,10]]));const g=N.appendOrSelect(t,"g.missing-data");N.appendOrSelect(g,"path").datum(c).attr("d",h).style("fill",`url(#${p})`)}getProjection(){let t=null;switch(y(this.getOptions(),"thematic","projection")){case Je.geoEqualEarth:t=HA();break;case Je.geoAlbers:t=DA();break;case Je.geoConicEqualArea:t=qm();break;case Je.geoConicEquidistant:t=UA();break;case Je.geoEquirectangular:t=NA();break;case Je.geoMercator:t=RA();break;case Je.geoNaturalEarth1:t=VA();break;default:throw new Error("Projection is not supported.")}return t}}class xN extends yN{constructor(){super(...arguments),this.type="choropleth"}render(t=!0){super.render();const n=this.model.getCombinedData(),r=this.getComponentContainer({ariaLabel:"map",withinChartClip:!0}),i=y(this.getOptions(),"color"),s=y(i,"gradient","colors");r.select("g.geo").selectAll("path").classed("border",!0).attr("class",a=>this.model.getColorClassName({value:n[a.properties.NAME].value,originalClassName:"border"})).attr("style",a=>s?`fill: ${this.model.getColorClassName({value:n[a.properties.NAME].value})}`:null),this.addCountryAreaEventListener()}addCountryAreaEventListener(){const t=this,n=this.model.getCombinedData();this.parent.selectAll("path.border").on("mouseover",function(r,i){const s=I(this);t.services.events.dispatchEvent(Sr.CHOROPLETH_MOUSEOVER,{event:r,element:s,datum:n[i.properties.NAME]}),t.services.events.dispatchEvent(Or.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(Sr.CHOROPLETH_MOUSEMOVE,{event:r,element:I(this),datum:n[i.properties.NAME]}),t.services.events.dispatchEvent(Or.MOVE,{event:r})}).on("click",function(r,i){t.services.events.dispatchEvent(Sr.CHOROPLETH_CLICK,{event:r,element:I(this),datum:n[i.properties.NAME]})}).on("mouseout",function(r,i){const s=I(this);t.services.events.dispatchEvent(Sr.CHOROPLETH_MOUSEOUT,{event:r,element:s,datum:n[i.properties.NAME]}),t.services.events.dispatchEvent(Or.HIDE,{event:r,hoveredElement:s})})}}function xu(e){var t=e==null?0:e.length;return t?Bs(e,1):[]}function bN(e){return ah(ch(e,void 0,xu),e+"")}function tv(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 _N(e,t){return t.length<2?e:el(e,tv(t,0,-1))}function EN(e,t){return t=Us(t,e),e=_N(e,t),e==null||delete e[Mi(id(t))]}function ON(e){return Eh(e)?void 0:e}var SN=1,TN=2,wN=4,$N=bN(function(e,t){var n={};if(e==null)return n;var r=!1;t=zo(t,function(s){return s=Us(s,e),r||(r=s.length>1),s}),Mr(e,kh(e),n),r&&(n=Ci(n,SN|TN|wN,ON));for(var i=t.length;i--;)EN(n,t[i]);return n});function ev(e){return Math.log(e)}function nv(e){return Math.exp(e)}function MN(e){return-Math.log(-e)}function CN(e){return-Math.exp(-e)}function AN(e){return isFinite(e)?+("1e"+e):e<0?0:e}function LN(e){return e===10?AN:e===Math.E?Math.exp:t=>Math.pow(e,t)}function kN(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function rv(e){return(t,n)=>-e(-t,n)}function DN(e){const t=e(ev,nv),n=t.domain;let r=10,i,s;function a(){return i=kN(r),s=LN(r),n()[0]<0?(i=rv(i),s=rv(s),e(MN,CN)):e(ev,nv),t}return t.base=function(o){return arguments.length?(r=+o,a()):r},t.domain=function(o){return arguments.length?(n(o),a()):n()},t.ticks=o=>{const l=n();let c=l[0],u=l[l.length-1];const d=u<c;d&&([c,u]=[u,c]);let h=i(c),p=i(u),f,g;const m=o==null?10:+o;let v=[];if(!(r%1)&&p-h<m){if(h=Math.floor(h),p=Math.ceil(p),c>0){for(;h<=p;++h)for(f=1;f<r;++f)if(g=h<0?f/s(-h):f*s(h),!(g<c)){if(g>u)break;v.push(g)}}else for(;h<=p;++h)for(f=r-1;f>=1;--f)if(g=h>0?f/s(-h):f*s(h),!(g<c)){if(g>u)break;v.push(g)}v.length*2<m&&(v=js(c,u,m))}else v=js(h,p,Math.min(p-h,m)).map(s);return d?v.reverse():v},t.tickFormat=(o,l)=>{if(o==null&&(o=10),l==null&&(l=r===10?"s":","),typeof l!="function"&&(!(r%1)&&(l=Vi(l)).precision==null&&(l.trim=!0),l=Il(l)),o===1/0)return l;const c=Math.max(1,r*o/t.ticks().length);return u=>{let d=u/s(Math.round(i(u)));return d*r<r-.5&&(d*=r),d<=c?l(u):""}},t.nice=()=>n(zp(n(),{floor:o=>s(Math.floor(i(o))),ceil:o=>s(Math.ceil(i(o)))})),t}function iv(){const e=DN(op()).domain([1,10]);return e.copy=()=>Pl(e,iv()).base(e.base()),Ur.apply(e,arguments),e}function ho(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function po(e){this._context=e}po.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:ho(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:ho(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function RN(e){return new po(e)}function sv(e){this._context=e}sv.prototype={areaStart:Bn,areaEnd:Bn,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:ho(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function IN(e){return new sv(e)}function av(e){this._context=e}av.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:ho(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function NN(e){return new av(e)}function ov(e,t){this._basis=new po(e),this._beta=t}ov.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var e=this._x,t=this._y,n=e.length-1;if(n>0)for(var r=e[0],i=t[0],s=e[n]-r,a=t[n]-i,o=-1,l;++o<=n;)l=o/n,this._basis.point(this._beta*e[o]+(1-this._beta)*(r+l*s),this._beta*t[o]+(1-this._beta)*(i+l*a));this._x=this._y=null,this._basis.lineEnd()},point:function(e,t){this._x.push(+e),this._y.push(+t)}};const PN=function e(t){function n(r){return t===1?new po(r):new ov(r,t)}return n.beta=function(r){return e(+r)},n}(.85);function fo(e,t,n){e._context.bezierCurveTo(e._x1+e._k*(e._x2-e._x0),e._y1+e._k*(e._y2-e._y0),e._x2+e._k*(e._x1-t),e._y2+e._k*(e._y1-n),e._x2,e._y2)}function bu(e,t){this._context=e,this._k=(1-t)/6}bu.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:fo(this,this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2,this._x1=e,this._y1=t;break;case 2:this._point=3;default:fo(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const UN=function e(t){function n(r){return new bu(r,t)}return n.tension=function(r){return e(+r)},n}(0);function _u(e,t){this._context=e,this._k=(1-t)/6}_u.prototype={areaStart:Bn,areaEnd:Bn,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:fo(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const BN=function e(t){function n(r){return new _u(r,t)}return n.tension=function(r){return e(+r)},n}(0);function Eu(e,t){this._context=e,this._k=(1-t)/6}Eu.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:fo(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const HN=function e(t){function n(r){return new Eu(r,t)}return n.tension=function(r){return e(+r)},n}(0);function Ou(e,t,n){var r=e._x1,i=e._y1,s=e._x2,a=e._y2;if(e._l01_a>ee){var o=2*e._l01_2a+3*e._l01_a*e._l12_a+e._l12_2a,l=3*e._l01_a*(e._l01_a+e._l12_a);r=(r*o-e._x0*e._l12_2a+e._x2*e._l01_2a)/l,i=(i*o-e._y0*e._l12_2a+e._y2*e._l01_2a)/l}if(e._l23_a>ee){var c=2*e._l23_2a+3*e._l23_a*e._l12_a+e._l12_2a,u=3*e._l23_a*(e._l23_a+e._l12_a);s=(s*c+e._x1*e._l23_2a-t*e._l12_2a)/u,a=(a*c+e._y1*e._l23_2a-n*e._l12_2a)/u}e._context.bezierCurveTo(r,i,s,a,e._x2,e._y2)}function lv(e,t){this._context=e,this._alpha=t}lv.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3;default:Ou(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const VN=function e(t){function n(r){return t?new lv(r,t):new bu(r,0)}return n.alpha=function(r){return e(+r)},n}(.5);function cv(e,t){this._context=e,this._alpha=t}cv.prototype={areaStart:Bn,areaEnd:Bn,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:Ou(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const GN=function e(t){function n(r){return t?new cv(r,t):new _u(r,0)}return n.alpha=function(r){return e(+r)},n}(.5);function uv(e,t){this._context=e,this._alpha=t}uv.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Ou(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const zN=function e(t){function n(r){return t?new uv(r,t):new Eu(r,0)}return n.alpha=function(r){return e(+r)},n}(.5);function hv(e){return e<0?-1:1}function dv(e,t,n){var r=e._x1-e._x0,i=t-e._x1,s=(e._y1-e._y0)/(r||i<0&&-0),a=(n-e._y1)/(i||r<0&&-0),o=(s*i+a*r)/(r+i);return(hv(s)+hv(a))*Math.min(Math.abs(s),Math.abs(a),.5*Math.abs(o))||0}function pv(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function Su(e,t,n){var r=e._x0,i=e._y0,s=e._x1,a=e._y1,o=(s-r)/3;e._context.bezierCurveTo(r+o,i+o*t,s-o,a-o*n,s,a)}function mo(e){this._context=e}mo.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:Su(this,this._t0,pv(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,Su(this,pv(this,n=dv(this,e,t)),n);break;default:Su(this,this._t0,n=dv(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function fv(e){this._context=new mv(e)}(fv.prototype=Object.create(mo.prototype)).point=function(e,t){mo.prototype.point.call(this,t,e)};function mv(e){this._context=e}mv.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,s){this._context.bezierCurveTo(t,e,r,n,s,i)}};function FN(e){return new mo(e)}function jN(e){return new fv(e)}function gv(e){this._context=e}gv.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=vv(e),i=vv(t),s=0,a=1;a<n;++s,++a)this._context.bezierCurveTo(r[0][s],i[0][s],r[1][s],i[1][s],e[a],t[a]);(this._line||this._line!==0&&n===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}};function vv(e){var t,n=e.length-1,r,i=new Array(n),s=new Array(n),a=new Array(n);for(i[0]=0,s[0]=2,a[0]=e[0]+2*e[1],t=1;t<n-1;++t)i[t]=1,s[t]=4,a[t]=4*e[t]+2*e[t+1];for(i[n-1]=2,s[n-1]=7,a[n-1]=8*e[n-1]+e[n],t=1;t<n;++t)r=i[t]/s[t-1],s[t]-=r,a[t]-=r*a[t-1];for(i[n-1]=a[n-1]/s[n-1],t=n-2;t>=0;--t)i[t]=(a[t]-i[t+1])/s[t];for(s[n-1]=(e[n]+i[n-1])/2,t=0;t<n-1;++t)s[t]=2*e[t+1]-i[t+1];return[i,s]}function WN(e){return new gv(e)}function go(e,t){this._context=e,this._t=t}go.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}break}}this._x=e,this._y=t}};function qN(e){return new go(e,.5)}function YN(e){return new go(e,0)}function XN(e){return new go(e,1)}class ZN extends wn{zoomIn(t,n,r){let i,s,a;const o=r||Hr;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(T.CanvasZoom.CANVAS_ZOOM_IN,{element:I(t)})}zoomOut(t,n){const r=n||Hr;t.transition().duration(r.duration).ease(r.ease).attr("transform",""),this.services.events.dispatchEvent(T.CanvasZoom.CANVAS_ZOOM_OUT)}}class KN extends wn{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 QN extends wn{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 JN extends wn{constructor(){super(...arguments),this.pendingTransitions={}}init(){var t;(t=this.services.events)==null||t.addEventListener(T.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(y(fp,n,"duration")||fp.default.duration)}getPendingTransitions(){return this.pendingTransitions}}function Os(e,t){const n=+Pt(e)-+Pt(t);return n<0?-1:n>0?1:n}function tP(e,t,n){const[r,i]=qn(void 0,e,t);return r.getFullYear()-i.getFullYear()}function eP(e,t,n){const[r,i]=qn(void 0,e,t),s=Os(r,i),a=Math.abs(tP(r,i));r.setFullYear(1584),i.setFullYear(1584);const o=Os(r,i)===-s,l=s*(a-+o);return l===0?0:l}function Tu(e,t,n){const r=Pt(e,void 0);if(isNaN(t))return $e(e,NaN);if(!t)return r;const i=r.getDate(),s=$e(e,r.getTime());s.setMonth(r.getMonth()+t+1,0);const a=s.getDate();return i>=a?s:(r.setFullYear(s.getFullYear(),s.getMonth(),i),r)}function yv(e,t,n){return Tu(e,t*12)}function nP(e,t,n){return yv(e,-t)}function rP(e,t,n){const[r,i]=qn(void 0,e,t),s=r.getFullYear()-i.getFullYear(),a=r.getMonth()-i.getMonth();return s*12+a}function iP(e,t){const n=Pt(e,void 0);return n.setHours(23,59,59,999),n}function sP(e,t){const n=Pt(e,void 0),r=n.getMonth();return n.setFullYear(n.getFullYear(),r+1,0),n.setHours(23,59,59,999),n}function aP(e,t){const n=Pt(e,void 0);return+iP(n)==+sP(n)}function oP(e,t,n){const[r,i,s]=qn(void 0,e,e,t),a=Os(i,s),o=Math.abs(rP(i,s));if(o<1)return 0;i.getMonth()===1&&i.getDate()>27&&i.setDate(30),i.setMonth(i.getMonth()-a*o);let l=Os(i,s)===-a;aP(r)&&o===1&&Os(r,s)===1&&(l=!1);const c=a*(o-+l);return c===0?0:c}function lP(e,t,n){return Tu(e,-t)}function cP(e,t,n){const[r,i]=qn(void 0,e,t),s=xv(r,i),a=Math.abs(wp(r,i));r.setDate(r.getDate()-s*a);const o=+(xv(r,i)===-s),l=s*(a-o);return l===0?0:l}function xv(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 bv(e,t,n){const r=Pt(e,void 0);return isNaN(t)?$e(e,NaN):(t&&r.setDate(r.getDate()+t),r)}function uP(e,t,n){return bv(e,-t)}function wu(e){return t=>{const n=(0,Math.trunc)(t);return n===0?0:n}}function hP(e,t,n){const[r,i]=qn(void 0,e,t),s=(+r-+i)/Yu;return wu()(s)}function _v(e,t,n){return $e(e,+Pt(e)+t)}function Ev(e,t,n){return _v(e,t*Yu)}function dP(e,t,n){return Ev(e,-t)}function Ov(e,t){return+Pt(e)-+Pt(t)}function Sv(e,t,n){const r=Ov(e,t)/qu;return wu()(r)}function $u(e,t,n){const r=Pt(e,void 0);return r.setTime(r.getTime()+t*qu),r}function Tv(e,t,n){return $u(e,-t)}function wv(e,t,n){const r=Ov(e,t)/1e3;return wu()(r)}function Mu(e,t,n){return _v(e,t*1e3)}function $v(e,t,n){return Mu(e,-t)}class pP extends wn{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=y(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=y(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 y(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===z.BOTTOM||t===z.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(z).map(t=>z[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===z.LEFT||this.rangeAxisPosition===z.RIGHT)&&(this.domainAxisPosition===z.BOTTOM||this.domainAxisPosition===z.TOP)?this.orientation=Gt.VERTICAL:this.orientation=Gt.HORIZONTAL}isDualAxes(){return this.dualAxes}determineAxisDuality(){var t,n,r,i;const s=this.model.getOptions(),a=y(s,"axes");((t=a[z.LEFT])!=null&&t.correspondingDatasets&&a[z.RIGHT]||(n=a[z.RIGHT])!=null&&n.correspondingDatasets&&a[z.LEFT]||(r=a[z.TOP])!=null&&r.correspondingDatasets&&a[z.BOTTOM]||(i=a[z.BOTTOM])!=null&&i.correspondingDatasets&&a[z.TOP])&&(this.dualAxes=!0)}getCustomDomainValuesByposition(t){const n=y(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]===nt.LINEAR||this.scaleTypes[t]===nt.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=[z.BOTTOM,z.TOP];return[this.domainAxisPosition,this.rangeAxisPosition].find(n=>t.indexOf(n)>-1)}getMainYAxisPosition(){const t=[z.LEFT,z.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=y(s,"axes")[r],{mapsTo:o}=a,l=y(i,o)!==null?i[o]:i;let c;switch(n){case nt.LABELS:c=t(l)+t.step()/2;break;case nt.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=y(s,"axes")[r],{mapsTo:o}=a,l=t[o]!==void 0?t[o]:t;return[i(y(t,n.upperBoundMapsTo)!==null?t[n.upperBoundMapsTo]:l),i(y(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 y(n,"axes",this.getDomainAxisPosition({datum:t}),"mapsTo")}getRangeIdentifier(t){const n=this.model.getOptions();return y(n,"axes",this.getRangeAxisPosition({datum:t}),"mapsTo")}extendsDomain(t,n){const r=this.model.getOptions(),i=y(r,"axes",t);if(i.scaleType===nt.TIME){const s=y(r,"timeScale","addSpaceOnEdges");return fP(n,s)}else return mP(n,Nn.paddingRatio,i.scaleType)}findVerticalAxesPositions(){const t=this.model.getOptions(),n=y(t,"axes"),r=this.isDualAxes();return y(n,z.LEFT)===null&&y(n,z.RIGHT)!==null||y(n,z.RIGHT,"main")===!0||r&&y(n,z.LEFT,"correspondingDatasets")?{primary:z.RIGHT,secondary:z.LEFT}:{primary:z.LEFT,secondary:z.RIGHT}}findHorizontalAxesPositions(){const t=this.model.getOptions(),n=y(t,"axes"),r=this.isDualAxes();return y(n,z.BOTTOM)===null&&y(n,z.TOP)!==null||y(n,z.TOP,"main")===!0||r&&y(n,z.BOTTOM,"correspondingDatasets")?{primary:z.TOP,secondary:z.BOTTOM}:{primary:z.BOTTOM,secondary:z.TOP}}findDomainAndRangeAxesPositions(t,n){const r=this.model.getOptions(),i=y(r,"axes",t.primary),s=y(r,"axes",n.primary),a=i.scaleType||nt.LINEAR,o=s.scaleType||nt.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===nt.LABELS||o===nt.TIME)&&a===nt.LABELS||a===nt.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=y(n,"axes",t),i=y(n,"bounds"),{includeZero:s}=r,a=y(r,"scaleType")||nt.LINEAR;if(this.model.isDataEmpty())return[];if(r.binned){const{bins:v}=this.model.getBinConfigurations();return[0,tr(v,x=>x.length)]}else if(r.limitDomainToBins){const{bins:v}=this.model.getBinConfigurations(),x=this.model.getStackKeys({bins:v});return[x[0].split(":")[0],x[x.length-1].split(":")[1]]}const o=this.model.getDisplayData(),{extendLinearDomainBy:l,mapsTo:c,percentage:u,thresholds:d}=r,{reference:h,compareTo:p}=Nn.ratio;if(r.domain)return a===nt.LABELS?r.domain:(a===nt.TIME&&(r.domain=r.domain.map(v=>v.getTime===void 0?new Date(v):v)),this.extendsDomain(t,r.domain));if(u)return[0,100];if(r&&a===nt.LABELS)return Li(o.map(v=>v[c]));let f,g;const m=this.model.getDataGroupNames();if(a===nt.LABELS_RATIO)return o.map(v=>`${v[h]}/${v[p]}`);if(a===nt.TIME)g=o.map(v=>+new Date(v[c]));else if(i&&n.axes)g=[],o.forEach(v=>{g.push(v[c]),v[i.upperBoundMapsTo]&&g.push(v[i.upperBoundMapsTo]),v[i.lowerBoundMapsTo]&&g.push(v[i.lowerBoundMapsTo])});else if(r.stacked===!0&&m&&t===this.getRangeAxisPosition()){const{groupMapsTo:v}=n.data,x=this.model.getDataValuesGroupedByKeys({groups:m}),_=o.filter(b=>!m.includes(b[v])),E=[];x.forEach(b=>{const{...S}=b;let M=0,D=0;Object.values($N(S,"sharedStackKey")).forEach(A=>{isNaN(A)||(A<0?D+=A:M+=A)}),E.push([D,M])}),g=[...xu(E),..._.map(b=>b[c])]}else g=[],o.forEach(v=>{const x=v[c];Array.isArray(x)&&x.length===2?(g.push(x[0]),g.push(x[1])):(l&&g.push(Math.max(v[c],v[l])),g.push(x))});return a!==nt.TIME&&a!==nt.LOG&&s&&g.push(0),d&&d.length>0&&d.forEach(v=>{const x=y(v,"value");x!==null&&g.push(x)}),f=Ge(g),f=this.extendsDomain(t,f),f}createScale(t){const n=this.model.getOptions(),r=y(n,"axes",t);if(!r)return null;const i=y(r,"scaleType")||nt.LINEAR;this.scaleTypes[t]=i;let s;return i===nt.TIME?s=cf():i===nt.LOG?s=iv().base(r.base||10):i===nt.LABELS||i===nt.LABELS_RATIO?s=Yi():s=je(),s.domain(this.getScaleDomain(t)),s}getDomainLowerBound(t){let n,r=0;return this.getOrientation()===Gt.VERTICAL?n=this.getMainYScale().domain():n=this.getMainXScale().domain(),y(this.model.getOptions(),"axes",t,"includeZero")===!1&&n[0]>0&&n[1]>0&&(r=n[0]),r}getHighestDomainThreshold(){const t=y(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)===nt.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=y(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 fP(e,t){const n=new Date(e[0]),r=new Date(e[1]);return eP(r,n)>1?[nP(n,t),yv(r,t)]:oP(r,n)>1?[lP(n,t),Tu(r,t)]:cP(r,n)>1?[uP(n,t),bv(r,t)]:hP(r,n)>1?[dP(n,t),Ev(r,t)]:Sv(r,n)>30?[Tv(n,t*30),$u(r,t*30)]:Sv(r,n)>1?[Tv(n,t),$u(r,t)]:wv(r,n)>15?[$v(n,t*15),Mu(r,t*15)]:wv(r,n)>1?[$v(n,t),Mu(r,t)]:[n,r]}function mP([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===nt.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]}class gP extends wn{constructor(){super(...arguments),this.curveTypes={curveLinear:Oa,curveLinearClosed:ff,curveBasis:RN,curveBasisClosed:IN,curveBasisOpen:NN,curveBundle:PN,curveCardinal:UN,curveCardinalClosed:BN,curveCardinalOpen:HN,curveCatmullRom:VN,curveCatmullRomClosed:GN,curveCatmullRomOpen:zN,curveMonotoneX:FN,curveMonotoneY:jN,curveNatural:WN,curveStep:qN,curveStepAfter:XN,curveStepBefore:YN}}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}}class vP extends wn{isZoomBarEnabled(){if(!this.services.cartesianScales||!y(this.model.getOptions(),"zoomBar","top","enabled"))return!1;this.services.cartesianScales.findDomainAndRangeAxes();const t=this.services.cartesianScales.getMainXAxisPosition(),n=y(this.model.getOptions(),"axes",t,"scaleType");return t===z.BOTTOM&&n===nt.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=y(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,Ge(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(T.ZoomDomain.CHANGE,{newDomain:t}))}getZoomRatio(){return y(this.model.getOptions(),"zoomBar","zoomRatio")}filterDataForRangeAxis(t,n){var r;const i=this.model.get("zoomDomain"),s=Object.assign({stacked:!1},n),a=y(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=be.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 p=[s.invert(d),s.invert(h)];(r[0].valueOf()!==p[0].valueOf()||r[1].valueOf()!==p[1].valueOf())&&this.handleDomainChange(p)}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=y(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 y(this.model.getOptions(),"zoomBar",t,"loading")}isZoomBarLocked(t){return y(this.model.getOptions(),"zoomBar",t,"locked")}}function yP(e,t,n){var r=e.length;return n=n===void 0?r:n,tv(e,t,n)}var xP="\\ud800-\\udfff",bP="\\u0300-\\u036f",_P="\\ufe20-\\ufe2f",EP="\\u20d0-\\u20ff",OP=bP+_P+EP,SP="\\ufe0e\\ufe0f",TP="\\u200d",wP=RegExp("["+TP+xP+OP+SP+"]");function Mv(e){return wP.test(e)}function $P(e){return e.split("")}var Cv="\\ud800-\\udfff",MP="\\u0300-\\u036f",CP="\\ufe20-\\ufe2f",AP="\\u20d0-\\u20ff",LP=MP+CP+AP,kP="\\ufe0e\\ufe0f",DP="["+Cv+"]",Cu="["+LP+"]",Au="\\ud83c[\\udffb-\\udfff]",RP="(?:"+Cu+"|"+Au+")",Av="[^"+Cv+"]",Lv="(?:\\ud83c[\\udde6-\\uddff]){2}",kv="[\\ud800-\\udbff][\\udc00-\\udfff]",IP="\\u200d",Dv=RP+"?",Rv="["+kP+"]?",NP="(?:"+IP+"(?:"+[Av,Lv,kv].join("|")+")"+Rv+Dv+")*",PP=Rv+Dv+NP,UP="(?:"+[Av+Cu+"?",Cu,Lv,kv,DP].join("|")+")",BP=RegExp(Au+"(?="+Au+")|"+UP+PP,"g");function HP(e){return e.match(BP)||[]}function VP(e){return Mv(e)?HP(e):$P(e)}function GP(e){return function(t){t=$i(t);var n=Mv(t)?VP(t):void 0,r=n?n[0]:t.charAt(0),i=n?yP(n,1).join(""):t.slice(1);return r[e]()+i}}var zP=GP("toUpperCase");function FP(e){return zP($i(e).toLowerCase())}var jP=Yf(function(e,t,n){return t=t.toLowerCase(),e+(n?FP(t):t)});class Xe{constructor(t,n){this.components=[],this.services={canvasZoom:ZN,domUtils:N,events:KN,files:QN,gradientUtils:dc,transitions:JN},this.model=new rn(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(T.Model.UPDATE,r=>{const i=!!y(r,"detail","animate");this.update(i)}),this.model.setData(n.data),this.services.events.addEventListener(T.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(T.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=y(r,"toolbar","enabled"),s={id:"legend",components:[new cu(this.model,this.services)],growth:lt.PREFERRED},a=y(r,"canvasZoom","enabled");a&&a===!0&&t.push(new Mk(this.model,this.services));const o=!!this.model.getOptions().title,l={id:"title",components:[new _s(this.model,this.services)],growth:lt.STRETCH},c={id:"toolbar",components:[new io(this.model,this.services)],growth:lt.PREFERRED},u={id:"header",components:[new Oe(this.model,this.services,[l,...i?[c]:[]],{direction:Mt.ROW,alignItems:jn.CENTER})],growth:lt.PREFERRED},d={id:"graph-frame",components:t,growth:lt.STRETCH,renderType:y(n,"graphFrameRenderType")||it.SVG},h=y(n,"excludeLegend")!==!0&&r.legend.enabled!==!1;let p=Mt.COLUMN;if(h){const v=y(r,"legend","position");v==="left"?(p=Mt.ROW,r.legend.orientation||(r.legend.orientation=wr.VERTICAL)):v==="right"?(p=Mt.ROW_REVERSE,r.legend.orientation||(r.legend.orientation=wr.VERTICAL)):v==="bottom"&&(p=Mt.COLUMN_REVERSE)}const f={id:"spacer",components:[new An(this.model,this.services)],growth:lt.PREFERRED},g={id:"full-frame",components:[new Oe(this.model,this.services,[...h?[s]:[],...h?[f]:[],d],{direction:p})],growth:lt.STRETCH},m=[];if(o||i){m.push(u);const v={id:"spacer",components:[new An(this.model,this.services,i?{size:15}:void 0)],growth:lt.PREFERRED};m.push(v)}return m.push(g),[new uu(this.model,this.services),new so(this.model,this.services),new Oe(this.model,this.services,m,{direction:Mt.COLUMN})]}}class ge extends Xe{constructor(t,n){super(t,n),this.services=Object.assign(this.services,{cartesianScales:pP,curves:gP,zoom:vP}),this.model=new lr(this.services)}getAxisChartComponents(t,n){const r=this.model.getOptions(),i=y(r,"zoomBar",z.TOP,"enabled"),s=y(r,"toolbar","enabled");this.services.cartesianScales.determineAxisDuality(),this.services.cartesianScales.findDomainAndRangeAxes(),this.services.cartesianScales.determineOrientation();const a=this.services.cartesianScales.getMainXAxisPosition(),o=y(r,"axes",a,"scaleType"),l=i&&a===z.BOTTOM&&o===nt.TIME,c=this.services.zoom.isZoomBarLocked(z.TOP),u=!!this.model.getOptions().title,d={id:"title",components:[new _s(this.model,this.services)],growth:lt.STRETCH},h={id:"toolbar",components:[new io(this.model,this.services)],growth:lt.PREFERRED},p={id:"header",components:[new Oe(this.model,this.services,[d,...s?[h]:[]],{direction:Mt.ROW,alignItems:jn.CENTER})],growth:lt.PREFERRED},f={id:"legend",components:[new cu(this.model,this.services)],growth:lt.PREFERRED};l&&!c&&t.push(new Og(this.model,this.services),new Ck(this.model,this.services)),t.push(new Lk(this.model,this.services)),t.push(new kk(this.model,this.services));const g={id:"graph-frame",components:t,growth:lt.STRETCH,renderType:it.SVG},m=y(n,"legend","enabled")!==!1&&this.model.getOptions().legend.enabled!==!1;let v=Mt.COLUMN;if(m){const S=y(this.model.getOptions(),"legend","position");S===Tr.LEFT?(v=Mt.ROW,this.model.getOptions().legend.orientation||(this.model.getOptions().legend.orientation=wr.VERTICAL)):S===Tr.RIGHT?(v=Mt.ROW_REVERSE,this.model.getOptions().legend.orientation||(this.model.getOptions().legend.orientation=wr.VERTICAL)):S===Tr.BOTTOM&&(v=Mt.COLUMN_REVERSE)}const x={id:"spacer",components:[new An(this.model,this.services)],growth:lt.PREFERRED},_={id:"full-frame",components:[new Oe(this.model,this.services,[...m?[f]:[],...m?[x]:[],g],{direction:v})],growth:lt.STRETCH},E={id:"zoom-bar",components:[new Ak(this.model,this.services)],growth:lt.PREFERRED,renderType:it.SVG},b=[];if(u||s){b.push(p);const S={id:"spacer",components:[new An(this.model,this.services,s?{size:15}:void 0)],growth:lt.PREFERRED};b.push(S)}return l&&b.push(E),b.push(_),[new $g(this.model,this.services),new so(this.model,this.services),new Oe(this.model,this.services,b,{direction:Mt.COLUMN})]}}class WP extends Xe{constructor(t,n){super(t,n),this.model=new zw(this.services),this.model.setOptions(Rt(Ct.alluvialChart,n.options)),this.init(t,n)}getComponents(){const t=[new Qk(this.model,this.services)];return this.getChartComponents(t,{excludeLegend:!0})}}class qP extends ge{constructor(t,n){super(t,n),this.model.setOptions(Rt(pn(Ct.areaChart),n.options)),this.init(t,n)}getComponents(){const t=[new me(this.model,this.services),new Se(this.model,this.services),new Gn(this.model,this.services),new ai(this.model,this.services),new Ng(this.model,this.services),new cn(this.model,this.services,{fadeInOnChartHolderMouseover:!0,handleThresholds:!0}),new ce(this.model,this.services,{skeleton:Ft.GRID})];return this.getAxisChartComponents(t)}}class YP extends ge{constructor(t,n){super(t,n),this.model=new Fw(this.services),this.model.setOptions(Rt(Ct.boxplotChart,n.options)),this.init(t,n)}getComponents(){const t=[new me(this.model,this.services),new Se(this.model,this.services),new eD(this.model,this.services),new oi(this.model,this.services),new ce(this.model,this.services,{skeleton:Ft.VERT_OR_HORIZ})];return this.getAxisChartComponents(t,{legend:{enabled:!1}})}}class XP extends ge{constructor(t,n){super(t,n),this.model.setOptions(Rt(Ct.bubbleChart,n.options)),this.init(t,n)}getComponents(){const t=[new me(this.model,this.services),new Se(this.model,this.services),new Gn(this.model,this.services),new nD(this.model,this.services),new ce(this.model,this.services,{skeleton:Ft.GRID})];return this.getAxisChartComponents(t)}}class ZP extends ge{constructor(t,n){super(t,n),this.model=new jw(this.services),this.model.setOptions(Rt(Ct.bulletChart,n.options)),this.init(t,n)}getComponents(){const t=[new me(this.model,this.services),new Se(this.model,this.services),new rD(this.model,this.services),new ce(this.model,this.services,{skeleton:Ft.GRID})];return this.getAxisChartComponents(t)}}class KP extends Xe{constructor(t,n){super(t,n),this.model=new Ww(this.services),this.model.setOptions(Rt(Ct.choroplethChart,n.options)),this.init(t,n)}getChartComponents(t,n){const r=this.model.getOptions(),i=y(r,"toolbar","enabled"),s=!!this.model.getOptions().title,a={id:"title",components:[new _s(this.model,this.services)],growth:lt.STRETCH},o={id:"toolbar",components:[new io(this.model,this.services)],growth:lt.PREFERRED},l={id:"header",components:[new Oe(this.model,this.services,[a,...i?[o]:[]],{direction:Mt.ROW,alignItems:jn.CENTER})],growth:lt.PREFERRED},c={id:"legend",components:[new Hg(this.model,this.services,{chartType:"choropleth"})],growth:lt.PREFERRED,renderType:it.SVG},u={id:"graph-frame",components:t,growth:lt.STRETCH,renderType:it.SVG},d=y(n,"legend","enabled")!==!1&&this.model.getOptions().legend.enabled!==!1&&this.model.getData().length>0,h=Mt.COLUMN_REVERSE,p={id:"spacer",components:[new An(this.model,this.services,{size:15})],growth:lt.PREFERRED},f={id:"full-frame",components:[new Oe(this.model,this.services,[...d?[c]:[],...d?[p]:[],u],{direction:h})],growth:lt.STRETCH},g=[];if(s||i){g.push(l);const m={id:"spacer",components:[new An(this.model,this.services,i?{size:15}:void 0)],growth:lt.PREFERRED};g.push(m)}return g.push(f),[new uu(this.model,this.services),new so(this.model,this.services),new Oe(this.model,this.services,g,{direction:Mt.COLUMN})]}getComponents(){const t=[new xN(this.model,this.services)];return this.getChartComponents(t)}}class QP extends Xe{constructor(t,n){super(t,n),this.model=new qw(this.services),this.model.setOptions(Rt(Ct.circlePackChart,n.options)),this.init(t,n)}getComponents(){const t=[new _D(this.model,this.services)];return this.getChartComponents(t)}}const Iv={[ve.LINE]:[ai,cn],[ve.SCATTER]:[cn],[ve.AREA]:[Ng,ai,cn],[ve.STACKED_AREA]:[Wg,ai,Yg,co],[ve.SIMPLE_BAR]:[jg],[ve.GROUPED_BAR]:[Fg,oi],[ve.STACKED_BAR]:[qg,co]};class JP extends ge{constructor(t,n){super(t,n);const r=Rt(Ct.comboChart,n.options);n.options.comboChartTypes||(console.error("No comboChartTypes defined for the Combo Chart!"),r.comboChartTypes=[{type:ve.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(Iv).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=`${jP(i.type)}Chart`;return a=at({},Ct[l],this.model.getOptions(),i.options),i.type===ve.STACKED_AREA&&(o=!0),Iv[i.type].map(c=>new c(this.model,this.services,{groups:i.correspondingDatasets,id:n++,options:a,stacked:o}))}else return a=at({},this.model.getOptions(),i.options),new s(this.model,this.services,{groups:i.correspondingDatasets,id:n++,options:a})}).filter(i=>i!==null);return xu(r)}getComponents(){const{comboChartTypes:t}=this.model.getOptions(),n=t.some(i=>i.type===ve.STACKED_BAR||i.type===ve.STACKED_AREA),r=[new me(this.model,this.services),new Se(this.model,this.services),new ce(this.model,this.services,{skeleton:Ft.GRID}),...n?[]:[new Gn(this.model,this.services)],...this.getGraphComponents()];return this.getAxisChartComponents(r)}}class Nv extends Xe{constructor(t,n,r=!1){super(t,n),this.model=new Yw(this.services),!r&&(this.model.setOptions(Rt(Ct.pieChart,n.options)),this.init(t,n))}getComponents(){const t=[new Vg(this.model,this.services),new ce(this.model,this.services,{skeleton:Ft.PIE})];return this.getChartComponents(t)}}class t3 extends Nv{constructor(t,n){super(t,n,!0),this.model.setOptions(Rt(Ct.donutChart,n.options)),this.init(t,n)}getComponents(){const t=[new OD(this.model,this.services),new ce(this.model,this.services,{skeleton:Ft.DONUT})];return this.getChartComponents(t)}}class e3 extends Xe{constructor(t,n){super(t,n),this.model=new Xw(this.services),this.model.setOptions(Rt(Ct.gaugeChart,n.options)),this.init(t,n)}getComponents(){const t=[new SD(this.model,this.services)];return this.getChartComponents(t)}}class n3 extends ge{constructor(t,n){super(t,n),this.model.setOptions(Rt(Ct.groupedBarChart,n.options)),this.init(t,n)}getComponents(){const t=[new me(this.model,this.services),new Se(this.model,this.services),new Fg(this.model,this.services),new oi(this.model,this.services),new ce(this.model,this.services,{skeleton:Ft.VERT_OR_HORIZ})];return this.getAxisChartComponents(t)}}class r3 extends ge{constructor(t,n){super(t,n),this.model=new Zw(this.services),this.model.setOptions(Rt(Ct.heatmapChart,n.options)),this.init(t,n)}getAxisChartComponents(t,n){const r=this.model.getOptions(),i=y(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:lt.STRETCH},o={id:"toolbar",components:[new io(this.model,this.services)],growth:lt.PREFERRED},l={id:"header",components:[new Oe(this.model,this.services,[a,...i?[o]:[]],{direction:Mt.ROW,alignItems:jn.CENTER})],growth:lt.PREFERRED},c={id:"legend",components:[new Hg(this.model,this.services,{chartType:"heatmap"})],growth:lt.PREFERRED,renderType:it.SVG},u={id:"graph-frame",components:t,growth:lt.STRETCH,renderType:it.SVG},d=y(n,"legend","enabled")!==!1&&this.model.getOptions().legend.enabled!==!1&&this.model.getData().length>0,h=Mt.COLUMN_REVERSE,p={id:"spacer",components:[new An(this.model,this.services,{size:15})],growth:lt.PREFERRED},f={id:"full-frame",components:[new Oe(this.model,this.services,[...d?[c]:[],...d?[p]:[],u],{direction:h})],growth:lt.STRETCH},g=[];if(s||i){g.push(l);const m={id:"spacer",components:[new An(this.model,this.services,i?{size:15}:void 0)],growth:lt.PREFERRED};g.push(m)}return g.push(f),[new $g(this.model,this.services),new so(this.model,this.services),new Oe(this.model,this.services,g,{direction:Mt.COLUMN})]}getComponents(){const t=[new me(this.model,this.services),new TD(this.model,this.services)];return this.getAxisChartComponents(t)}}class i3 extends ge{constructor(t,n){super(t,n),this.model=new Kw(this.services),this.model.setOptions(Rt(Ct.histogramChart,n.options)),this.init(t,n),this.update()}getComponents(){const t=[new me(this.model,this.services),new Se(this.model,this.services),new dD(this.model,this.services),new wD(this.model,this.services)];return this.getAxisChartComponents(t)}}class s3 extends ge{constructor(t,n){super(t,n),this.model.setOptions(Rt(Ct.lineChart,n.options)),this.init(t,n)}getComponents(){const t=[new me(this.model,this.services),new Se(this.model,this.services),new Gn(this.model,this.services),new ai(this.model,this.services),new cn(this.model,this.services,{handleThresholds:!0}),new AD(this.model,this.services),new oi(this.model,this.services)];return this.getAxisChartComponents(t)}}class a3 extends ge{constructor(t,n){super(t,n),this.model.setOptions(Rt(Ct.lollipopChart,n.options)),this.init(t,n)}getComponents(){const t=[new me(this.model,this.services),new Se(this.model,this.services),new Gn(this.model,this.services),new $D(this.model,this.services),new cn(this.model,this.services),new ce(this.model,this.services,{skeleton:Ft.GRID})];return this.getAxisChartComponents(t)}}class o3 extends Xe{constructor(t,n){var r;super(t,n),this.model=new Qw(this.services);const i=(r=n.options.meter)!=null&&r.proportional?at(pn(Ct.proportionalMeterChart),n.options):at(pn(Ct.meterChart),n.options);this.model.setOptions(i),this.init(t,n)}getComponents(){const t=[...y(this.model.getOptions(),"meter","showLabels")?[{id:"meter-title",components:[new bD(this.model,this.services)],growth:lt.STRETCH,renderType:it.SVG},{id:"spacer",components:[new An(this.model,this.services,{size:8})],growth:lt.STRETCH}]:[],{id:"meter-graph",components:[new MD(this.model,this.services)],growth:lt.STRETCH,renderType:it.SVG}],n=[new Oe(this.model,this.services,t,{direction:Mt.COLUMN})];return this.getChartComponents(n,{graphFrameRenderType:it.HTML})}}class l3 extends Xe{constructor(t,n){super(t,n),this.model=new Jw(this.services),this.model.setOptions(Rt(Ct.radarChart,n.options)),this.init(t,n)}getComponents(){const t=[new CD(this.model,this.services)];return this.getChartComponents(t)}}class c3 extends ge{constructor(t,n){super(t,n),this.model.setOptions(Rt(Ct.scatterChart,n.options)),this.init(t,n)}getComponents(){const t=[new me(this.model,this.services),new Se(this.model,this.services),new Gn(this.model,this.services),new cn(this.model,this.services),new ce(this.model,this.services,{skeleton:Ft.GRID})];return this.getAxisChartComponents(t)}}class u3 extends Xe{constructor(t,n){super(t,n),this.model=new t$(this.services),this.model.setOptions(Rt(Ct.treeChart,n.options)),this.init(t,n)}getComponents(){const t=[new LD(this.model,this.services)];return this.getChartComponents(t,{excludeLegend:!0})}}class h3 extends Xe{constructor(t,n){super(t,n),this.model=new e$(this.services),this.model.setOptions(Rt(Ct.treemapChart,n.options)),this.init(t,n)}getComponents(){const t=[new aN(this.model,this.services)];return this.getChartComponents(t)}}class d3 extends ge{constructor(t,n){super(t,n),this.model.setOptions(Rt(Ct.simpleBarChart,n.options)),this.init(t,n)}getComponents(){const t=[new me(this.model,this.services),new Se(this.model,this.services),new jg(this.model,this.services),new oi(this.model,this.services),new ce(this.model,this.services,{skeleton:Ft.VERT_OR_HORIZ})];return this.getAxisChartComponents(t)}}class p3 extends ge{constructor(t,n){super(t,n),this.model.setOptions(Rt(Ct.stackedAreaChart,n.options)),this.init(t,n)}getComponents(){const t=[new me(this.model,this.services),new Se(this.model,this.services),new co(this.model,this.services),new Wg(this.model,this.services),new ai(this.model,this.services,{stacked:!0}),new Yg(this.model,this.services,{fadeInOnChartHolderMouseover:!0,handleThresholds:!0,stacked:!0}),new ce(this.model,this.services,{skeleton:Ft.GRID})];return this.getAxisChartComponents(t)}}class f3 extends ge{constructor(t,n){super(t,n),this.model.setOptions(Rt(Ct.stackedBarChart,n.options)),this.init(t,n)}getComponents(){const t=[new me(this.model,this.services),new Se(this.model,this.services),new co(this.model,this.services),new qg(this.model,this.services),new ce(this.model,this.services,{skeleton:Ft.VERT_OR_HORIZ}),new oi(this.model,this.services)];return this.getAxisChartComponents(t)}}class m3 extends Xe{constructor(t,n){super(t,n),this.model=new n$(this.services),this.model.setOptions(Rt(Ct.wordCloudChart,n.options)),this.init(t,n)}getComponents(){const t=[new vN(this.model,this.services),new ce(this.model,this.services,{skeleton:Ft.PIE})];return this.getChartComponents(t)}}class Dt extends ft.PureComponent{constructor(){super(...arguments);Pu(this,"chart");Pu(this,"chartRef",ft.createRef())}createChart(n,r,i){throw new Error("Method not implemented.")}componentDidMount(){this.chartRef.current&&!this.chart&&(this.chart=this.createChart(this.chartRef.current,this.props.data,this.props.options))}componentDidUpdate(n){var r,i;this.props.data!==n.data&&((r=this.chart)==null||r.model.setData(this.props.data)),this.props.options!==n.options&&((i=this.chart)==null||i.model.setOptions(this.props.options))}render(){return ft.createElement("div",{ref:this.chartRef,className:"chart-holder"})}}class g3 extends Dt{createChart(t,n,r){return new WP(t,{data:n,options:r})}}class v3 extends Dt{createChart(t,n,r){return new qP(t,{data:n,options:r})}}class y3 extends Dt{createChart(t,n,r){return new YP(t,{data:n,options:r})}}class x3 extends Dt{createChart(t,n,r){return new XP(t,{data:n,options:r})}}class b3 extends Dt{createChart(t,n,r){return new ZP(t,{data:n,options:r})}}class Pv extends Dt{createChart(t,n,r){return new KP(t,{data:n,options:r})}}class _3 extends Dt{createChart(t,n,r){return new QP(t,{data:n,options:r})}}class E3 extends Dt{createChart(t,n,r){return new JP(t,{data:n,options:r})}}class O3 extends Dt{createChart(t,n,r){return new t3(t,{data:n,options:r})}}class S3 extends Dt{createChart(t,n,r){return new e3(t,{data:n,options:r})}}class T3 extends Dt{createChart(t,n,r){return new n3(t,{data:n,options:r})}}class w3 extends Dt{createChart(t,n,r){return new r3(t,{data:n,options:r})}}class $3 extends Dt{createChart(t,n,r){return new i3(t,{data:n,options:r})}}class M3 extends Dt{createChart(t,n,r){return new s3(t,{data:n,options:r})}}class C3 extends Dt{createChart(t,n,r){return new a3(t,{data:n,options:r})}}class A3 extends Dt{createChart(t,n,r){return new o3(t,{data:n,options:r})}}class L3 extends Dt{createChart(t,n,r){return new Nv(t,{data:n,options:r})}}class k3 extends Dt{createChart(t,n,r){return new l3(t,{data:n,options:r})}}class D3 extends Dt{createChart(t,n,r){return new c3(t,{data:n,options:r})}}class R3 extends Dt{createChart(t,n,r){return new d3(t,{data:n,options:r})}}class I3 extends Dt{createChart(t,n,r){return new p3(t,{data:n,options:r})}}class N3 extends Dt{createChart(t,n,r){return new f3(t,{data:n,options:r})}}class P3 extends Dt{createChart(t,n,r){return new u3(t,{data:n,options:r})}}class U3 extends Dt{createChart(t,n,r){return new h3(t,{data:n,options:r})}}class B3 extends Dt{createChart(t,n,r){return new m3(t,{data:n,options:r})}}function H3(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Lu={exports:{}};/*!
|
|
73
|
+
</svg>`}addEventListeners(){const t=this;this.parent.selectAll("circle.node").on("mouseover",function(n,r){const i=I(this);i.classed("hovered",!0);const s=t.model.getHierarchyLevel(),a=s>2&&!i.classed("focal"),o=y(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(f=>{if(f!==null)return typeof f.data.value=="number"?{label:f.data.name,value:f.data.value}:{label:f.data.name,labelIcon:o&&s<=2?t.getZoomIcon():null,value:f.value}});const p=t.model.getOptions();u=[{label:yt(p,"locale.translations.total")||yt(p,"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(T.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(T.CirclePack.CIRCLE_MOUSEOVER,{event:n,element:i,datum:r})}).on("mousemove",function(n,r){const i=I(this);t.services.events.dispatchEvent(T.CirclePack.CIRCLE_MOUSEMOVE,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(T.Tooltip.MOVE,{event:n})}).on("mouseout",function(n,r){const i=I(this);i.classed("hovered",!1),r.children&&t.unhighlightChildren(r.children),t.services.events.dispatchEvent(T.CirclePack.CIRCLE_MOUSEOUT,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(T.Tooltip.HIDE,{hoveredElement:i})}).on("click",function(n,r){const i=I(this),s=i.classed("non-focal"),a=y(t.model.getOptions(),"canvasZoom","enabled");if(a&&t.model.getHierarchyLevel()>2){const o=t.parent.selectAll("circle.node");I(t.services.domUtils.getMainContainer()).classed("zoomed-in",!1),t.focal=null,t.model.updateHierarchyLevel(2),t.services.canvasZoom.zoomOut(o,Hr)}else if(r.depth===2&&r.children&&!s&&a){const o=t.parent.selectAll("circle.node");I(t.services.domUtils.getMainContainer()).classed("zoomed-in",!0),t.focal=r,t.model.updateHierarchyLevel(3),t.services.canvasZoom.zoomIn(r,o,Hr),n.stopPropagation()}t.services.events.dispatchEvent(T.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(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut),this.removeBackgroundListeners()}}function ED(e,t){const n=Ni(this._current,e);return r=>(this._current=n(r),t(this._current))}class Vg extends gt{constructor(){super(...arguments),this.type="pie",this.renderType=it.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(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}getInnerRadius(){return Lt.innerRadius}render(t=!0){const n=this,r=this.getComponentContainer({ariaLabel:"pie graph"}),i=this.getOptions(),{groupMapsTo:s}=i.data,{valueMapsTo:a}=i.pie;this.isRendering=!0;const o=this.model.getDisplayData().filter(A=>A[a]>0),l=this.computeRadius();this.arc=fs().innerRadius(this.getInnerRadius()).outerRadius(l),this.hoverArc=fs().innerRadius(this.getInnerRadius()).outerRadius(l+Lt.hoverArc.outerRadiusOffset);const c=ZL().value(A=>A[a]).sort(y(i,"pie","sortFunction")).padAngle(Lt.padAngle)(o),u=N.appendOrSelect(r,"g.slices").attr("role",ht.GROUP).attr("data-name","slices").selectAll("path.slice").data(c,A=>A.data[s]);u.exit().attr("opacity",0).remove(),u.enter().append("path").classed("slice",!0).attr("opacity",0).merge(u).attr("class",A=>this.model.getColorClassName({classNameTypes:[st.FILL],dataGroupName:A.data[s],originalClassName:"slice"})).style("fill",A=>n.model.getFillColor(A.data[s],null,A.data)).attr("d",this.arc).transition().call(A=>this.services.transitions.setupTransition({transition:A,name:"pie_slice_enter_update",animate:t})).attr("opacity",1).attr("role",ht.GRAPHICS_SYMBOL).attr("aria-roledescription","slice").attr("aria-label",A=>`${A[a]}, ${Hl(A.data[a],o,a)+"%"}`).attrTween("d",function(A){return ED.bind(this)(A,n.arc)}).on("end",()=>{n.isRendering=!1});const{code:d,number:h}=y(i,"locale"),p=i.pie.labels.enabled,f=p?c.filter(A=>A.data[a]>0):[],g=N.appendOrSelect(r,"g.labels").attr("role",ht.GROUP).attr("data-name","labels").selectAll("text.pie-label").data(f,A=>A.data[s]);g.exit().attr("opacity",0).remove();const m=g.enter().append("text").classed("pie-label",!0),v=[];m.merge(g).style("text-anchor","middle").text(A=>i.pie.labels.formatter?i.pie.labels.formatter({...A,percentageValue:Hl(A.data[a],o,a,!0)}):h(Hl(A.data[a],o,a),d)+"%").datum(function(A){const R=l+7,$=(A.endAngle-A.startAngle)/2+A.startAngle,H=$/Math.PI*180,P=this.getComputedTextLength();return A.textOffsetX=P/2,A.textOffsetY=H>90&&H<270?10:0,A.xPosition=(A.textOffsetX+R)*Math.sin($),A.yPosition=(A.textOffsetY+R)*-Math.cos($),A}).attr("transform",function(A,R){const $=f.length,H=(A.endAngle-A.startAngle)*(180/Math.PI);if(R>=$-2&&H<Lt.callout.minSliceDegree){let P,B;return A.index===$-1?(P=A.xPosition+Lt.callout.offsetX+Lt.callout.textMargin+A.textOffsetX,B=A.yPosition-Lt.callout.offsetY,A.direction=di.RIGHT,v.push(A)):(P=A.xPosition-Lt.callout.offsetX-A.textOffsetX-Lt.callout.textMargin,B=A.yPosition-Lt.callout.offsetY,A.direction=di.LEFT,v.push(A)),`translate(${P}, ${B})`}return`translate(${A.xPosition}, ${A.yPosition})`}),this.renderCallouts(v);const x=y(i,"donut")?"donut":"pie",_=y(i,x,"alignment"),{width:E}=N.getSVGElementSize(this.getParent(),{useAttrs:!0}),b=p?Lt.xOffset:0,S=p?Lt.yOffset:0;let M=l+b;_===zt.CENTER?M=E/2:_===zt.RIGHT&&(M=E-l-Lt.xOffset);let D=l+S;v.length>0&&(D+=Lt.yOffsetCallout),r.attr("x",M+7).attr("y",D),this.addEventListeners()}renderCallouts(t){const n=N.appendOrSelect(this.getComponentContainer(),"g.callouts").attr("role",ht.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",ht.GROUP).attr("aria-roledescription","label callout");i.merge(r).datum(function(s){const{xPosition:a,yPosition:o,direction:l}=s;return l===di.RIGHT?(s.startPos={x:a,y:o+s.textOffsetY},s.endPos={x:a+Lt.callout.offsetX,y:o-Lt.callout.offsetY+s.textOffsetY},s.intersectPointX=s.endPos.x-Lt.callout.horizontalLineLength):(s.startPos={x:a,y:o+s.textOffsetY},s.endPos={x:a-Lt.callout.offsetX,y:o-Lt.callout.offsetY+s.textOffsetY},s.intersectPointX=s.endPos.x+Lt.callout.horizontalLineLength),s}),i.append("line").classed("vertical-line",!0).merge(n.selectAll("line.vertical-line")).datum(function(){return I(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 I(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=I(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(T.Pie.SLICE_MOUSEOVER,{event:n,element:I(this),datum:r});const{groupMapsTo:s}=t.getOptions().data,{valueMapsTo:a}=t.getOptions().pie;t.services.events.dispatchEvent(T.Tooltip.SHOW,{event:n,hoveredElement:i,items:[{label:r.data[s],value:r.data[a]}]})}).on("mousemove",function(n,r){const i=I(this);t.services.events.dispatchEvent(T.Pie.SLICE_MOUSEMOVE,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(T.Tooltip.MOVE,{event:n})}).on("click",function(n,r){t.services.events.dispatchEvent(T.Pie.SLICE_CLICK,{event:n,element:I(this),datum:r})}).on("mouseout",function(n,r){const i=I(this);vC(()=>{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(T.Pie.SLICE_MOUSEOUT,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(T.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+Lt.radiusOffset:i}}class OD extends Vg{constructor(){super(...arguments),this.type="donut",this.renderType=it.SVG}render(t=!0){super.render(t);const n=this;if(this.model.isDataEmpty()){this.getComponentContainer({ariaLabel:"donut graph"}).select("g.center").remove();return}const r=N.appendOrSelect(this.getComponentContainer({ariaLabel:"donut graph"}),"g.center"),i=this.getOptions(),s=this.computeRadius(),a=y(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(I(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=y(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=Id:s=xe;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}=y(n,"locale");t.text(u(Math.floor(a(o)),c))}}}}const Gg="4,10 8,6 12,10",zg="12,6 8,10 4,6";class SD extends gt{constructor(){super(...arguments),this.type="gauge",this.renderType=it.SVG}getValue(){var t;return((t=this.model.getData().find(n=>n.group==="value"))==null?void 0:t.value)??null}getValueRatio(){return Xf(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 y(t,"gauge","type")===Wn.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(y(n,"gauge","deltaArrow","direction")){case Ms.UP:return Gg;case Ms.DOWN:return zg;default:return t>0?Gg:zg}}render(t=!0){const n=this.getComponentContainer({ariaLabel:"gauge graph"}).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=fs().innerRadius(h).outerRadius(d).startAngle(c).endAngle(u),this.arc=fs().innerRadius(h).outerRadius(d).startAngle(o).endAngle(c),N.appendOrSelect(n,"path.arc-background").attr("d",this.backgroundArc);const p=n.selectAll("path.arc-foreground").data([i]);p.enter().append("path").merge(p).attr("class",this.model.getColorClassName({classNameTypes:[st.FILL],dataGroupName:"value",originalClassName:"arc-foreground"})).style("fill",()=>y(this.getOptions(),"color","scale","value")).attr("d",this.arc).attr("role",ht.GRAPHICS_SYMBOL).attr("aria-roledescription","value").attr("aria-label",v=>v),this.drawValueNumber(),this.drawDelta(),p.exit().remove();const f=y(r,"gauge","alignment"),{width:g}=N.getSVGElementSize(this.getParent(),{useAttrs:!0});let m=d;f===zt.CENTER?m=g/2:f===zt.RIGHT&&(m=g-d),n.attr("x",m).attr("y",d),this.addEventListeners()}drawValueNumber(){const t=this.getComponentContainer(),n=this.getOptions(),r=y(n,"gauge","type"),i=this.getValue(),s=this.getDelta(),a=this.computeRadius(),o=y(n,"gauge","valueFontSize"),l=y(n,"gauge","deltaFontSize"),c=y(n,"gauge","numberSpacing"),u=y(n,"gauge","showPercentageSymbol");let d=0;r===Wn.FULL&&!s?d=l(a):r===Wn.SEMI&&s&&(d=-(l(a)+c));const h=N.appendOrSelect(t,"g.gauge-numbers").attr("transform",`translate(0, ${d})`),p=o(a),f=N.appendOrSelect(h,"g.gauge-value-number"),{code:g,number:m}=y(n,"locale"),v=y(n,"gauge","numberFormatter"),x=f.selectAll("text.gauge-value-number").data([i]);x.enter().append("text").attr("class","gauge-value-number").merge(x).style("font-size",`${p}px`).attr("text-anchor","middle").text(A=>{let R;return A!=null?R=Number(A.toFixed(2))%1!==0?A.toFixed(2):A.toFixed():R=0,v?v(R):m(Number(R),g)});const{width:_}=N.getSVGElementSize(N.appendOrSelect(t,"text.gauge-value-number"),{useBBox:!0}),E=p/2,b=u?"%":"",S=N.appendOrSelect(f,"text.gauge-value-symbol").style("font-size",`${E}px`).attr("x",_/2).text(b),{width:M,height:D}=N.getSVGElementSize(S,{useBBox:!0});S.attr("y",`-${D/2}px`),f.attr("transform",`translate(-${M/2}, 0)`)}drawDelta(){const t=this,n=this.getComponentContainer(),r=this.getOptions(),i=this.getDelta(),{code:s,number:a}=y(r,"locale");if(i){const o=this.computeRadius(),l=i?y(r,"gauge","deltaFontSize"):()=>0,c=i?y(r,"gauge","numberFormatter"):()=>null,u=y(r,"gauge","deltaArrow","size"),d=y(r,"gauge","numberSpacing"),h=y(r,"gauge","showPercentageSymbol"),p=N.appendOrSelect(n,"g.gauge-numbers"),f=N.appendOrSelect(p,"g.gauge-delta").attr("transform",`translate(0, ${l(o)+d})`),g=N.appendOrSelect(f,"text.gauge-delta-number"),m=h?"%":"";g.data(i===null?[]:[i]),g.enter().append("text").classed("gauge-delta-number",!0).merge(g).attr("text-anchor","middle").style("font-size",`${l(o)}px`).text(E=>{let b;return E!=null?b=Number(E.toFixed(2))%1!==0?E.toFixed(2):E.toFixed():b=0,c?`${c(b)}${m}`:`${a(Number(b),s)}${m}`});const{width:v}=N.getSVGElementSize(N.appendOrSelect(n,".gauge-delta-number"),{useBBox:!0}),x=y(r,"gauge","deltaArrow","enabled"),_=f.selectAll("svg.gauge-delta-arrow").data(i!==null&&x?[i]:[]);_.enter().append("svg").merge(_).attr("class","gauge-delta-arrow").attr("x",-u(o)-v/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 E=I(this);N.appendOrSelect(E,"rect.gauge-delta-arrow-backdrop").attr("width","16").attr("height","16").attr("fill","none");const b=y(r,"gauge","status");N.appendOrSelect(E,"polygon.gauge-delta-arrow").attr("class",b!==null?`gauge-delta-arrow status--${b}`:"").attr("points",t.getArrow(i))}),_.exit().remove(),g.exit().remove()}else{const o=n.select("g.gauge-delta");o.empty()||o.remove()}}getInnerRadius(){const t=this.computeRadius(),n=y(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(T.Gauge.ARC_MOUSEOVER,{event:n,element:I(this),datum:r})}).on("mousemove",function(n,r){const i=I(this);t.services.events.dispatchEvent(T.Gauge.ARC_MOUSEMOVE,{event:n,element:i,datum:r})}).on("click",function(n,r){t.services.events.dispatchEvent(T.Gauge.ARC_CLICK,{event:n,element:I(this),datum:r})}).on("mouseout",function(n,r){const i=I(this);t.services.events.dispatchEvent(T.Gauge.ARC_MOUSEOUT,{event:n,element:i,datum:r})})}computeRadius(){const t=this.getOptions(),n=y(t,"gauge","type"),{width:r,height:i}=N.getSVGElementSize(this.parent,{useAttrs:!0});return n===Wn.SEMI?Math.min(r/2,i):Math.min(r/2,i/2)}}class Fg extends vu{constructor(){super(...arguments),this.type="grouped-bar",this.renderType=it.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(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(T.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({ariaLabel:"grouped bar graphs",withinChartClip:!0}),a=Li(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",ht.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()===Gt.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:[st.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(),p=d,f=d+h,g=this.services.cartesianScales.getRangeAxisPosition({datum:u}),m=this.services.cartesianScales.getDomainLowerBound(g),v=this.services.cartesianScales.getValueThroughAxisPosition(g,m),x=this.services.cartesianScales.getRangeValue(u),_=this.services.cartesianScales.getDomainValue(u)-h/2,E=_+h;if(!this.isOutsideZoomedDomain(_,E))return ie({x0:p,x1:f,y0:v,y1:x},this.services.cartesianScales.getOrientation())}).attr("opacity",1).attr("role",ht.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=I(this);i.classed("hovered",!0),t.services.events.dispatchEvent(T.Bar.BAR_MOUSEOVER,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(T.Tooltip.SHOW,{event:n,hoveredElement:i,data:[r]})}).on("mousemove",function(n,r){const i=I(this);t.services.events.dispatchEvent(T.Bar.BAR_MOUSEMOVE,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(T.Tooltip.MOVE,{event:n})}).on("click",function(n,r){t.services.events.dispatchEvent(T.Bar.BAR_CLICK,{event:n,element:I(this),datum:r})}).on("mouseout",function(n,r){const i=I(this);i.classed("hovered",!1),t.services.events.dispatchEvent(T.Bar.BAR_MOUSEOUT,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(T.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(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(T.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=y(t,"bars","width"),r=y(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=Yi().domain(t).rangeRound([0,this.getGroupWidth()])}}class TD extends gt{constructor(){super(...arguments),this.type="heatmap",this.renderType=it.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,p=null;this.matrix[r]!==void 0?(u=a,i.forEach(f=>{if(typeof this.matrix[r][f].value=="number"){const g=this.matrix[r][f].value;if(d===null){d=g,h=g,p=g;return}d+=g,h=g<h?g:h,p=g>p?g:p}})):(u=o,s.forEach(f=>{if(typeof this.matrix[f][r].value=="number"){const g=this.matrix[f][r].value;if(d===null){d=g,h=g,p=g;return}d+=g,h=g<h?g:h,p=g>p?g:p}})),l(r)!==void 0?this.parent.select("g.multi-cell.column-highlight").classed("highlighter-hidden",!1).attr("transform",`translate(${l(r)}, ${In(c.range())})`):c(r)!==void 0&&this.parent.select("g.multi-cell.row-highlight").classed("highlighter-hidden",!1).attr("transform",`translate(${In(l.range())},${c(r)})`),this.services.events.dispatchEvent(T.Tooltip.SHOW,{event:n.event,hoveredElement:I(t.detail.element),items:[{label:u,value:r,bold:!0},{label:"Min",value:h!==null?h:"-"},{label:"Max",value:p!==null?p:"-"},{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(T.Tooltip.HIDE,{event:t})}}init(){const t=this.services.events;t.addEventListener(T.Axis.LABEL_MOUSEOVER,this.handleAxisOnHover),t.addEventListener(T.Axis.LABEL_MOUSEOUT,this.handleAxisMouseOut),t.addEventListener(T.Axis.LABEL_FOCUS,this.handleAxisOnHover),t.addEventListener(T.Axis.LABEL_BLUR,this.handleAxisMouseOut)}render(t=!0){const n=this.getComponentContainer({ariaLabel:"heatmap",withinChartClip:!0});n.lower();const{cartesianScales:r}=this.services;if(this.matrix=this.model.getMatrix(),n.html(""),y(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 p=this.services.domUtils.generateElementIDString("heatmap-pattern-stripes");n.append("defs").append("pattern").attr("id",p).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 f=n.selectAll().data(u).enter().append("g").attr("class",g=>`heat-${g.index}`).classed("cell",!0).attr("transform",g=>`translate(${i(g[a])}, ${s(g[o])})`).append("rect").attr("class",g=>this.model.getColorClassName({value:g.value,originalClassName:`heat-${g.index}`})).classed("heat",!0).classed("null-state",g=>g.index===-1||g.value===null).attr("width",this.xBandwidth).attr("height",this.yBandwidth).style("fill",g=>{const m=this.services.cartesianScales.getDomainIdentifier(g);return g.index===-1||g.value===null?`url(#${p})`:this.model.getFillColor(Number(g.value),g[m],g)}).attr("aria-label",g=>g.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()&&(f.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=y(this.getOptions(),"heatmap","divider","state");return t!==$r.OFF&&(t===$r.AUTO&&hp.minCellDividerDimension<=this.xBandwidth&&hp.minCellDividerDimension<=this.yBandwidth||t===$r.ON)}addEventListener(){const t=this,{cartesianScales:n}=this.services,r=this.getOptions(),i=yt(r,"locale.translations.total")||yt(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=I(this),h=d.select("rect.heat");if(!h.classed("null-state")){const p=Fi(d.attr("transform"));t.parent.select("g.cell-highlight").attr("transform",`translate(${p.x+t.translationUnits.x}, ${p.y+t.translationUnits.y})`).classed("highlighter-hidden",!1),t.services.events.dispatchEvent(T.Heatmap.HEATMAP_MOUSEOVER,{event:c,element:h,datum:u}),t.services.events.dispatchEvent(T.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(T.Heatmap.HEATMAP_MOUSEMOVE,{event:c,element:I(this),datum:u}),t.services.events.dispatchEvent(T.Tooltip.MOVE,{event:c})}).on("click",function(c,u){t.services.events.dispatchEvent(T.Heatmap.HEATMAP_CLICK,{event:c,element:I(this),datum:u})}).on("mouseout",function(c,u){const d=I(this).select("rect.heat"),h=d.classed("null-state");t.parent.select("g.cell-highlight").classed("highlighter-hidden",!0),h||(t.services.events.dispatchEvent(T.Heatmap.HEATMAP_MOUSEOUT,{event:c,element:d,datum:u}),t.services.events.dispatchEvent(T.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(T.Legend.ITEM_HOVER,this.handleAxisOnHover),t.removeEventListener(T.Legend.ITEM_MOUSEOUT,this.handleAxisMouseOut)}}class wD extends gt{constructor(){super(...arguments),this.type="histogram",this.renderType=it.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(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t){const n=this.getComponentContainer({ariaLabel:"histogram bars"}),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=>yt(u,`0.${s}`));l.exit().attr("opacity",0).remove(),l.enter().append("g").classed("bars",!0).attr("role",ht.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:[st.FILL],dataGroupName:u[s],originalClassName:"bar"})).style("fill",u=>this.model.getFillColor(u[s],null,u)).attr("d",u=>{const d=yt(u,"data");if(!d)return;const h=o(d.x1)-o(d.x0)-1,p=this.services.cartesianScales.getDomainValue(d.x0),f=p+h,g=this.services.cartesianScales.getRangeValue(u[0]);let m=this.services.cartesianScales.getRangeValue(u[1]);return Math.abs(m-g)>0&&Math.abs(m-g)>r.bars.dividerSize&&(this.services.cartesianScales.getOrientation()===Gt.VERTICAL?m+=1:m-=1),ie({x0:p,x1:f,y0:g,y1:m},this.services.cartesianScales.getOrientation())}).attr("opacity",1).attr("role",ht.GRAPHICS_SYMBOL).attr("aria-roledescription","bar").attr("aria-label",u=>y(u,"data",u[s])),this.addEventListeners()}addEventListeners(){const t=this.model.getOptions(),{groupMapsTo:n}=t.data,{code:r,number:i}=y(t,"locale"),s=this;this.parent.selectAll("path.bar").on("mouseover",function(a,o){const l=I(this);l.classed("hovered",!0);const c=i(parseFloat(yt(o,"data.x0")),r),u=i(parseFloat(yt(o,"data.x1")),r),d=s.services.cartesianScales.getRangeAxisPosition(),h=s.services.cartesianScales.getScaleLabel(d);s.services.events.dispatchEvent(T.Tooltip.SHOW,{event:a,hoveredElement:l,items:[{label:yt(t,"bins.rangeLabel")||"Range",value:`${c} – ${u}`},{label:t.tooltip.groupLabel||"Group",value:o[n],class:s.model.getColorClassName({classNameTypes:[st.TOOLTIP],dataGroupName:o[n]})},{label:h,value:yt(o,`data.${o[n]}`)}]})}).on("mousemove",function(a){s.services.events.dispatchEvent(T.Tooltip.MOVE,{event:a})}).on("mouseout",function(){I(this).classed("hovered",!1),s.services.events.dispatchEvent(T.Tooltip.HIDE)})}destroy(){this.parent.selectAll("path.bar").on("mouseover",null).on("mousemove",null).on("mouseout",null);const t=this.services.events;t.removeEventListener(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}}class $D extends cn{constructor(){super(...arguments),this.type="lollipop",this.renderType=it.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]?yn.weight.unselected:yn.weight.selected)},this.handleScatterOnMouseOut=()=>{this.parent.selectAll("line.line").attr("stroke-width",yn.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?yn.opacity.unselected:yn.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",yn.opacity.selected)}}init(){const{events:t}=this.services;t.addEventListener(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t){const n=this.getComponentContainer({ariaLabel:"lines",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,p]=bn(c,u,d),f=n.selectAll("line.line").data(this.getScatterData(),m=>`${m[i]}-${m[l]}`);f.exit().attr("opacity",0).remove();const g=f.enter().append("line").attr("opacity",0).merge(f).classed("line",!0).attr("class",m=>this.model.getColorClassName({classNameTypes:[st.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===Gt.HORIZONTAL?g.attr("y1",p).attr("y2",p).attr("x1",a.range()[0]).attr("x2",m=>h(m)-r.points.radius):g.attr("x1",h).attr("x2",h).attr("y1",o.range()[0]).attr("y2",m=>p(m)+r.points.radius),this.addScatterPointEventListeners()}addScatterPointEventListeners(){this.services.events.addEventListener(T.Scatter.SCATTER_MOUSEOVER,this.handleScatterOnHover),this.services.events.addEventListener(T.Scatter.SCATTER_MOUSEOUT,this.handleScatterOnMouseOut)}destroy(){const t=this.services.events;t.removeEventListener(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut),t.removeEventListener(T.Scatter.SCATTER_MOUSEOVER,this.handleScatterOnHover),t.removeEventListener(T.Scatter.SCATTER_MOUSEOUT,this.handleScatterOnMouseOut)}}class MD extends gt{constructor(){super(...arguments),this.type="meter",this.renderType=it.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)-Kt.dividerWidth),x:r-n(i.value)}):(r=n(i.value),{...i,width:Math.abs(n(i.value)-Kt.dividerWidth),x:0}))}render(t=!0){const n=this,r=this.getComponentContainer({ariaLabel:"meter lines"}),i=this.getOptions(),s=y(i,"meter","proportional"),a=this.model.getDisplayData(),o=this.model.getStatus(),{width:l}=N.getSVGElementSize(r,{useAttrs:!0}),{groupMapsTo:c}=i.data;let u;y(i,"meter","proportional")===null?u=100:u=y(i,"meter","proportional","total")||this.model.getMaximumDomain(this.model.getDisplayData());const d=je().domain([0,u]).range([0,l]),h=this.getStackedBounds(a,d),p=y(i,"meter","height");N.appendOrSelect(r,"rect.container").attr("x",0).attr("y",0).attr("width",l).attr("height",p||(s?Kt.height.proportional:Kt.height.default)),N.appendOrSelect(r,"line.rangeIndicator").attr("x1",l).attr("x2",l).attr("y1",0).attr("y2",p||(s?Kt.height.proportional:Kt.height.default));const f=r.selectAll("rect.value").data(h),g=o!=null&&!n.model.isUserProvidedColorScaleValid()&&!s?`value status--${o}`:"value";f.enter().append("rect").classed("value",!0).merge(f).attr("x",_=>_.x).attr("y",0).attr("height",()=>p||(s?Kt.height.proportional:Kt.height.default)).attr("class",_=>this.model.getColorClassName({classNameTypes:[st.FILL],dataGroupName:_[c],originalClassName:g})).transition().call(_=>this.services.transitions.setupTransition({transition:_,name:"meter-bar-update",animate:t})).attr("width",_=>_.value>u?d(u):Math.max(_.width,2)).style("fill",_=>n.model.getFillColor(_[c],null,_)).attr("role",ht.GRAPHICS_SYMBOL).attr("aria-roledescription","value").attr("aria-label",_=>_.value),f.exit().remove();const m=y(i,"meter","peak");let v=m;m!==null&&(m>u?v=u:m<0&&(v=0));const x=r.selectAll("line.peak").data(v==null?[]:[v]);x.enter().append("line").classed("peak",!0).merge(x).attr("y1",0).attr("y2",()=>p||(s?Kt.height.proportional:Kt.height.default)).transition().call(_=>this.services.transitions.setupTransition({transition:_,name:"peak-line-update",animate:t})).attr("x1",_=>d(_)).attr("x2",_=>d(_)).attr("role",ht.GRAPHICS_SYMBOL).attr("aria-roledescription","peak").attr("aria-label",_=>_),x.exit().remove(),this.services.domUtils.setSVGMaxHeight(),this.addEventListeners()}addEventListeners(){const t=this.getOptions(),{groupMapsTo:n}=t.data,r=this,i=y(t,"meter","proportional");this.parent.selectAll("rect.value").on("mouseover",function(s,a){const o=I(this);r.services.events.dispatchEvent(T.Meter.METER_MOUSEOVER,{event:s,element:o,datum:a}),i&&(o.classed("hovered",!0),r.services.events.dispatchEvent(T.Tooltip.SHOW,{event:s,hoveredElement:o,items:[{label:a[n],value:a.value}]}))}).on("mousemove",function(s,a){const o=I(this);r.services.events.dispatchEvent(T.Meter.METER_MOUSEMOVE,{event:s,element:o,datum:a}),i&&r.services.events.dispatchEvent(T.Tooltip.MOVE,{event:s})}).on("click",function(s,a){r.services.events.dispatchEvent(T.Meter.METER_CLICK,{event:s,element:I(this),datum:a})}).on("mouseout",function(s,a){const o=I(this);r.services.events.dispatchEvent(T.Meter.METER_MOUSEOUT,{event:s,element:o,datum:a}),i&&(o.classed("hovered",!1),r.services.events.dispatchEvent(T.Tooltip.HIDE,{hoveredElement:o}))})}destroy(){this.parent.selectAll("rect.value").on("mouseover",null).on("mousemove",null).on("mouseout",null).on("click",null)}}class CD extends gt{constructor(){super(...arguments),this.type="radar",this.renderType=it.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}=y(n,"radar","axes"),s=y(n,"data","groupMapsTo"),a=_C(this.uniqueKeys.map(o=>this.uniqueGroups.map(l=>({[r]:o,[s]:l,[i]:null}))));return at(a,t)},this.normalizeGroupedData=t=>{const n=this.getOptions(),{angle:r,value:i}=y(n,"radar","axes"),s=y(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:at(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?sr.opacity.unselected:sr.opacity.selected).style("stroke-opacity",r=>r.name!==n.datum().name?sr.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",sr.opacity.selected).style("stroke-opacity",1)}}init(){const{events:t}=this.services;t.addEventListener(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t=!0){const n=this.getComponentContainer({ariaLabel:"radar graph"}),{width:r,height:i}=N.getSVGElementSize(n,{useAttrs:!0}),s=this.model.getData(),a=this.model.getGroupedData(),o=this.getOptions(),l=y(o,"data","groupMapsTo"),c=y(o,"radar","axes","value"),{angle:u,value:d}=y(o,"radar","axes"),{xLabelPadding:h,yLabelPadding:p,yTicksNumber:f,minRange:g,xAxisRectHeight:m}=sr;this.uniqueKeys=Array.from(new Set(s.map(O=>O[u]))),this.uniqueGroups=Array.from(new Set(s.map(O=>O[l]))),this.fullDataNormalized=this.normalizeFlatData(s),this.groupedDataNormalized=this.normalizeGroupedData(a);const v=2*(this.getLabelDimensions(this.uniqueKeys[0]).height+p),x=(Math.min(r,i)-v)/2;if(x<=0)return;const _=Yi().domain(this.fullDataNormalized.map(O=>O[u])).range([0,2*Math.PI].map(O=>O-Math.PI/2)),E=In(this.fullDataNormalized.map(O=>O[d])),b=je().domain([E>=0?0:E,tr(this.fullDataNormalized.map(O=>O[d]))]).range([g,x]).nice(f),S=b.ticks(f),M=(O,w,L)=>this.model.getFillColor(O,w,L),D=JL().angle(O=>_(O[u])+Math.PI/2).radius(O=>b(O[d])).curve(ff),A=this.uniqueKeys.map(O=>{const w=this.getLabelDimensions(O).width,L=T2(_(O),x);return w+L}),R={x:tr(A)+h,y:i/2},$=N.appendOrSelect(n,"g.y-axes").attr("role",ht.GROUP).selectAll("path").data(S,O=>O),H=O=>this.uniqueKeys.map(w=>({[u]:w,[d]:O}));$.join(O=>O.append("path").attr("opacity",0).attr("transform",`translate(${R.x}, ${R.y})`).attr("fill","none").call(w=>w.transition().call(L=>this.services.transitions.setupTransition({transition:L,name:"radar_y_axes_enter",animate:t})).attr("opacity",1).attr("d",L=>D(H(L)))),O=>O.call(w=>w.transition().call(L=>this.services.transitions.setupTransition({transition:L,name:"radar_y_axes_update",animate:t})).attr("opacity",1).attr("transform",`translate(${R.x}, ${R.y})`).attr("d",L=>D(H(L)))),O=>O.call(w=>w.transition().call(L=>this.services.transitions.setupTransition({transition:L,name:"radar_y_axes_exit",animate:t})).attr("d",L=>D(H(L))).attr("opacity",0).remove())),N.appendOrSelect(n,"g.x-axes").attr("role",ht.GROUP).selectAll("line").data(this.uniqueKeys,O=>O).join(O=>O.append("line").attr("opacity",0).attr("class",w=>`x-axis-${Kr(w)}`).attr("stroke-dasharray","0").attr("x1",w=>Ut(_(w),0,R).x).attr("y1",w=>Ut(_(w),0,R).y).attr("x2",w=>Ut(_(w),0,R).x).attr("y2",w=>Ut(_(w),0,R).y).call(w=>w.transition().call(L=>this.services.transitions.setupTransition({transition:L,name:"radar_x_axes_enter",animate:t})).attr("opacity",1).attr("x1",L=>Ut(_(L),b.range()[0],R).x).attr("y1",L=>Ut(_(L),b.range()[0],R).y).attr("x2",L=>Ut(_(L),b.range()[1],R).x).attr("y2",L=>Ut(_(L),b.range()[1],R).y)),O=>O.call(w=>w.transition().call(L=>this.services.transitions.setupTransition({transition:L,name:"radar_x_axes_update",animate:t})).attr("opacity",1).attr("x1",L=>Ut(_(L),b.range()[0],R).x).attr("y1",L=>Ut(_(L),b.range()[0],R).y).attr("x2",L=>Ut(_(L),b.range()[1],R).x).attr("y2",L=>Ut(_(L),b.range()[1],R).y)),O=>O.call(w=>w.transition().call(L=>this.services.transitions.setupTransition({transition:L,name:"radar_x_axes_exit",animate:t})).attr("opacity",0).remove())),N.appendOrSelect(n,"g.x-labels").attr("role",ht.GROUP).selectAll("text").data(this.uniqueKeys).join(O=>O.append("text").text(w=>w).attr("opacity",0).attr("x",w=>Ut(_(w),b.range()[1]+h,R).x).attr("y",w=>Ut(_(w),b.range()[1]+h,R).y).style("text-anchor",w=>Cf(_(w)).textAnchor).style("dominant-baseline",w=>Cf(_(w)).dominantBaseline).call(w=>w.transition().call(L=>this.services.transitions.setupTransition({transition:L,name:"radar_x_labels_enter",animate:t})).attr("opacity",1)),O=>O.call(w=>w.transition().call(L=>this.services.transitions.setupTransition({transition:L,name:"radar_x_labels_update",animate:t})).attr("opacity",1).attr("x",L=>Ut(_(L),b.range()[1]+h,R).x).attr("y",L=>Ut(_(L),b.range()[1]+h,R).y).end().finally(()=>{const L=y(o,"radar","alignment"),k=this.getAlignmentXOffset(L,n,this.getParent());n.attr("x",k)})),O=>O.call(w=>w.transition().call(L=>this.services.transitions.setupTransition({transition:L,name:"radar_x_labels_exit",animate:t})).attr("opacity",0).remove())),N.appendOrSelect(n,"g.blobs").attr("role",ht.GROUP).selectAll("path").data(this.groupedDataNormalized,O=>O.name).join(O=>O.append("path").attr("class",w=>this.model.getColorClassName({classNameTypes:[st.FILL,st.STROKE],dataGroupName:w.name,originalClassName:"blob"})).attr("role",ht.GRAPHICS_SYMBOL).attr("aria-label",w=>w.name).attr("opacity",0).attr("transform",t?()=>`translate(${R.x}, ${R.y}) scale(${1+Math.random()*.35})`:`translate(${R.x}, ${R.y})`).style("fill",w=>M(w.name,null,w.data)).style("fill-opacity",sr.opacity.selected).style("stroke",w=>M(w.name,null,w.data)).call(w=>{const L=w.transition().call(k=>this.services.transitions.setupTransition({transition:k,name:"radar_blobs_enter",animate:t}));t&&L.delay(()=>Math.random()*30).attr("transform",`translate(${R.x}, ${R.y})`),L.attr("opacity",1).attr("d",k=>D(k.data))}),O=>(O.attr("class",w=>this.model.getColorClassName({classNameTypes:[st.FILL,st.STROKE],dataGroupName:w.name,originalClassName:"blob"})).style("fill",w=>M(w.name,null,w.data)).style("stroke",w=>M(w.name,null,w.data)),O.call(w=>w.transition().call(L=>this.services.transitions.setupTransition({transition:L,name:"radar_blobs_update",animate:t})).attr("opacity",1).attr("transform",`translate(${R.x}, ${R.y})`).attr("d",L=>D(L.data))),O),O=>O.call(w=>{const L=w.transition().call(k=>this.services.transitions.setupTransition({transition:k,name:"radar_blobs_exit",animate:t}));t&&L.delay(()=>Math.random()*30).attr("transform",()=>`translate(${R.x}, ${R.y}) scale(${1+Math.random()*.35})`),L.attr("opacity",0).remove()})),N.appendOrSelect(n,"g.dots").attr("role",ht.GROUP).selectAll("circle").data(this.fullDataNormalized.filter(O=>y(O,d)!==null)).join(O=>O.append("circle").attr("role",ht.GRAPHICS_SYMBOL).attr("aria-label",w=>w[c]),O=>O,O=>O.remove()).attr("class",O=>this.model.getColorClassName({classNameTypes:[st.FILL],dataGroupName:O[l],originalClassName:Kr(O[u])})).attr("cx",O=>Ut(_(O[u]),b(O[d]),R).x).attr("cy",O=>Ut(_(O[u]),b(O[d]),R).y).attr("r",0).attr("opacity",0).style("fill",O=>M(O[l])),N.appendOrSelect(n,"g.x-axes-rect").attr("role",ht.GROUP).selectAll("rect").data(this.uniqueKeys).join(O=>O.append("rect"),O=>O,O=>O.remove()).attr("x",R.x).attr("y",R.y-m/2).attr("width",b.range()[1]).attr("height",m).style("fill","red").style("fill-opacity",0).attr("transform",O=>`rotate(${Af(_(O))}, ${R.x}, ${R.y})`);const{code:P,number:B}=y(o,"locale");N.appendOrSelect(n,"g.y-labels").attr("role",ht.GROUP).selectAll("text").data(Ge(S)).join(O=>O.append("text").attr("opacity",0).text(w=>B(w,P)).attr("x",w=>Ut(-Math.PI/2,b(w),R).x+p).attr("y",w=>Ut(-Math.PI/2,b(w),R).y).style("text-anchor","start").style("dominant-baseline","middle").call(w=>w.transition().call(L=>this.services.transitions.setupTransition({transition:L,name:"radar_y_labels_enter",animate:t})).attr("opacity",1)),O=>O.call(w=>w.transition().call(L=>this.services.transitions.setupTransition({transition:L,name:"radar_y_labels_update",animate:t})).text(L=>L).attr("opacity",1).attr("x",L=>Ut(-Math.PI/2,b(L),R).x+p).attr("y",L=>Ut(-Math.PI/2,b(L),R).y)),O=>O.call(w=>w.transition().call(L=>this.services.transitions.setupTransition({transition:L,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===zt.CENTER?a=Math.floor((s-i.width)/2):t===zt.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(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}addEventListeners(){const t=this,{axes:{angle:n}}=y(this.getOptions(),"radar");this.parent.selectAll(".x-axes-rect > rect").on("mouseover",function(r,i){const s=I(this);t.services.events.dispatchEvent(T.Radar.X_AXIS_MOUSEOVER,{event:r,element:s,datum:i});const a=t.parent.select(`.x-axes .x-axis-${Kr(i)}`),o=t.parent.selectAll(`.dots circle.${Kr(i)}`),l=t.model.getActiveDataGroupNames(),c=t.getOptions(),{groupMapsTo:u}=c.data,d=y(c,"radar","axes","value");a.classed("hovered",!0).attr("stroke-dasharray","4 4"),o.classed("hovered",!0).attr("opacity",p=>l.indexOf(p[u])!==-1?1:0).attr("r",sr.dotsRadius);const h=t.fullDataNormalized.filter(p=>p[n]===i&&l.indexOf(p[u])!==-1);t.services.events.dispatchEvent(T.Tooltip.SHOW,{event:r,hoveredElement:s,items:h.filter(p=>typeof p[d]=="number").map(p=>({label:p[u],value:p[d],color:t.model.getFillColor(p[u],null,p),class:t.model.getColorClassName({classNameTypes:[st.TOOLTIP],dataGroupName:p[u]})}))})}).on("mousemove",function(r,i){const s=I(this);t.services.events.dispatchEvent(T.Radar.X_AXIS_MOUSEMOVE,{event:r,element:s,datum:i}),t.services.events.dispatchEvent(T.Tooltip.MOVE,{event:r})}).on("click",function(r,i){t.services.events.dispatchEvent(T.Radar.X_AXIS_CLICK,{event:r,element:I(this),datum:i})}).on("mouseout",function(r,i){const s=I(this),a=t.parent.select(`.x-axes .x-axis-${Kr(i)}`),o=t.parent.selectAll(`.dots circle.${Kr(i)}`);a.classed("hovered",!1).attr("stroke-dasharray","0"),o.classed("hovered",!1).attr("opacity",0).attr("r",0),t.services.events.dispatchEvent(T.Radar.X_AXIS_MOUSEOUT,{event:r,element:s,datum:i}),t.services.events.dispatchEvent(T.Tooltip.HIDE)})}}class jg extends vu{constructor(){super(...arguments),this.type="simple-bar",this.renderType=it.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(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t){const n=this.getOptions(),{groupMapsTo:r}=n.data,i=this.getComponentContainer({ariaLabel:"bar graphs",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:[st.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,p=h+u;let f,g;if(Array.isArray(d)&&d.length===2)f=this.services.cartesianScales.getRangeValue(d[0]),g=this.services.cartesianScales.getRangeValue(d[1]);else{const v=this.services.cartesianScales.getRangeScale().domain()[0];f=this.services.cartesianScales.getRangeValue(Math.max(0,v)),g=this.services.cartesianScales.getRangeValue(l)}const m=Math.abs(g-f);if(m!==0&&m<2&&(d>0&&a===Gt.VERTICAL||d<0&&a===Gt.HORIZONTAL?g=f-2:g=f+2),!this.isOutsideZoomedDomain(h,p))return ie({x0:h,x1:p,y0:f,y1:g},a)}).attr("opacity",1).attr("role",ht.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=I(this);i.classed("hovered",!0),t.services.events.dispatchEvent(T.Bar.BAR_MOUSEOVER,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(T.Tooltip.SHOW,{event:n,hoveredElement:i,data:[r]})}).on("mousemove",function(n,r){t.services.events.dispatchEvent(T.Bar.BAR_MOUSEMOVE,{event:n,element:I(this),datum:r}),t.services.events.dispatchEvent(T.Tooltip.MOVE,{event:n})}).on("click",function(n,r){t.services.events.dispatchEvent(T.Bar.BAR_CLICK,{event:n,element:I(this),datum:r})}).on("mouseout",function(n,r){const i=I(this);i.classed("hovered",!1),t.services.events.dispatchEvent(T.Bar.BAR_MOUSEOUT,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(T.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(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}}class AD extends ce{constructor(){super(...arguments),this.type="skeleton-lines"}render(t=!0){const n=y(this.getOptions(),"data","loading"),r=!y(this.getOptions(),"grid","x","enabled")&&!y(this.getOptions(),"grid","y","enabled")&&!y(this.getOptions(),"axes","bottom","visible")&&!y(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").attr("role","presentation"),N.appendOrSelect(this.backdrop,"rect.chart-skeleton-backdrop").classed("shimmer-effect-lines",!1).classed("shimmer-effect-sparkline",!0).style("stroke",null)}}class Wg extends gt{constructor(){super(...arguments),this.type="area-stacked",this.renderType=it.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=>y(s,0,i)!==n.datum().name?vn.opacity.unselected:vn.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",vn.opacity.selected)}}init(){const t=this.services.events;t.addEventListener(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t=!0){const n=this.getComponentContainer({ariaLabel:"stacked area graphs",withinChartClip:!0}),r=this,i=this.getOptions(),{groupMapsTo:s}=i.data,a=Object.keys(i.axes).some(p=>i.axes[p].percentage),o=this.model.getStackedData({percentage:a,groups:this.configs.groups}),l=y(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,p=>y(p,0,s));this.areaGenerator=tu().x(p=>this.services.cartesianScales.getValueThroughAxisPosition(c,p.data.sharedStackKey)).y0(p=>d(p[0])).y1(p=>d(p[1])).curve(this.services.curves.getD3Curve()),h.exit().attr("opacity",0).remove(),h.enter().append("path").attr("opacity",0).merge(h).data(o,p=>y(p,0,s)).attr("class","area").attr("class",p=>this.model.getColorClassName({classNameTypes:[st.FILL],dataGroupName:y(p,0,s),originalClassName:"area"})).style("fill",p=>r.model.getFillColor(y(p,0,s),null,p)).attr("role",ht.GRAPHICS_SYMBOL).attr("aria-roledescription","area").attr("aria-label",p=>y(p,0,s)).transition().call(p=>this.services.transitions.setupTransition({transition:p,name:"area-update-enter",animate:t})).attr("opacity",vn.opacity.selected).attr("d",this.areaGenerator)}}class qg extends vu{constructor(){super(...arguments),this.type="stacked-bar",this.renderType=it.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(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t){const n=this.getComponentContainer({ariaLabel:"stacked bar graphs",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=>y(c,0,i));o.exit().attr("opacity",0).remove(),o.enter().append("g").classed("bars",!0).attr("role",ht.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:[st.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,p=h+d,f=this.services.cartesianScales.getRangeValue(c[0]);let g=this.services.cartesianScales.getRangeValue(c[1]);if(!this.isOutsideZoomedDomain(h,p)){if(Math.abs(g-f)>0&&Math.abs(g-f)>r.bars.dividerSize){const m=c[0]<0&&c[1]<=0;m&&a.length>1?this.services.cartesianScales.getOrientation()===Gt.VERTICAL?g+=c[1]===0?2:1:g-=1:m||(this.services.cartesianScales.getOrientation()===Gt.VERTICAL?g+=1:g-=1)}return ie({x0:h,x1:p,y0:f,y1:g},this.services.cartesianScales.getOrientation())}}).attr("opacity",1).attr("role",ht.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=I(this);a.classed("hovered",!0),r.services.events.dispatchEvent(T.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(T.Tooltip.SHOW,{event:i,hoveredElement:a,data:[o]})}).on("mousemove",function(i,s){const a=I(this);r.services.events.dispatchEvent(T.Bar.BAR_MOUSEMOVE,{event:i,element:a,datum:s}),r.services.events.dispatchEvent(T.Tooltip.MOVE,{event:i})}).on("click",function(i,s){r.services.events.dispatchEvent(T.Bar.BAR_CLICK,{event:i,element:I(this),datum:s})}).on("mouseout",function(i,s){const a=I(this);a.classed("hovered",!1),r.services.events.dispatchEvent(T.Bar.BAR_MOUSEOUT,{event:i,element:a,datum:s}),r.services.events.dispatchEvent(T.Tooltip.HIDE,{hoveredElement:a})})}getBarWidth(){const t=this.getOptions();if(y(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=y(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(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}}class Yg extends cn{constructor(){super(...arguments),this.type="scatter-stacked",this.renderType=it.SVG}render(t){if(!y(this.getOptions(),"points","enabled"))return;const n=this.getComponentContainer({ariaLabel:"scatter points",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=>y(u,0,i));o.exit().attr("opacity",0).remove();const l=o.enter().append("g").classed("dots",!0).attr("role",ht.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),p=this.services.cartesianScales.getRangeIdentifier(u);return{[i]:d,[h]:u.data.sharedStackKey,[p]: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],p=u.data.sharedStackKey;let f=u.data[h];const g=u[1],m=this.services.cartesianScales.getDomainIdentifier(u),v=this.services.cartesianScales.getRangeIdentifier(u);f!=null&&t===this.services.cartesianScales.getDomainValue(p)&&n===this.services.cartesianScales.getRangeValue(g)&&(s&&(f=this.model.getStackedData({groups:this.configs.groups})[c][d].data[h]),f!==null&&o.push({[i]:h,[m]:p,[v]:f}))})}),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 Es=6;class LD extends gt{constructor(){super(...arguments),this.type="tree",this.renderType=it.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({ariaLabel:"tree diagram"});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=y(s,"tree","rootTitle")||"Tree",l=this.getMockLabelWidth(n,o),c=this.getLongestLabel(a),u=this.getMockLabelWidth(n,c),d={left:l>0?l+Es:30-Es},h=hs({name:o,children:a}),p=10,f=r/6,g=S=>{const M=h.descendants().reverse(),D=h.links();let A=h,R=h;h.eachBefore(k=>{k.x<A.x&&(A=k),k.x>R.x&&(R=k)});const $=R.x-A.x,H=n.transition().call(k=>this.services.transitions.setupTransition({transition:k,name:"tree-update-viewbox",animate:!0})).attr("viewBox",[-d.left,A.x,r,$].join(" ")),P=b.selectAll("g").data(M,k=>k.id),B=this,O=P.enter().append("g").attr("transform",()=>`translate(${S.y0},${S.x0})`).attr("class",k=>k.depth!==0&&k.children&&k.children.length>0?"clickable":null).on("mouseover",function(k,U){B.services.events.dispatchEvent(T.Tree.NODE_MOUSEOVER,{event:k,element:I(this),datum:U})}).on("click",function(k,U){U.depth!==0&&(U.children=U.children?null:U._children,g(U)),B.services.events.dispatchEvent(T.Tree.NODE_CLICK,{event:k,element:I(this),datum:U})}).on("mouseout",function(k,U){B.services.events.dispatchEvent(T.Tree.NODE_MOUSEOUT,{event:k,element:I(this),datum:U})});O.append("circle").attr("r",2.5).attr("class",k=>k._children?"parent":"child").attr("stroke-width",10),O.append("text").attr("dy","0.31em").attr("x",k=>k._children?-6:Es).attr("text-anchor",k=>k._children?"end":"start").text(k=>k.data.name).clone(!0).attr("class","text-stroke").lower(),P.merge(O).transition(H).attr("transform",k=>`translate(${k.y},${k.x})`).attr("fill-opacity",1).attr("stroke-opacity",1),P.exit().transition(H).remove().attr("transform",()=>`translate(${S.y},${S.x})`).attr("fill-opacity",0).attr("stroke-opacity",0);const w=E.selectAll("path").data(D,k=>k.target.id),L=w.enter().append("path").attr("d",()=>{const k={x:S.x0,y:S.y0};return _({source:k,target:k})});w.merge(L).transition(H).attr("d",_),w.exit().transition(H).remove().attr("d",()=>{const k={x:S.x,y:S.y};return _({source:k,target:k})}),h.eachBefore(k=>{k.x0=k.x,k.y0=k.y})},m=h.descendants(),v=m[m.length-1].depth,x=y(s,"tree","type")===$s.DENDROGRAM?XA().size([i,r-u-v*Es-l]):NL().nodeSize([p,f]).size([i,r-u-v*Es-l]),_=sk().x(S=>S.y).y(S=>S.x);h.x0=f/2,h.y0=0,h.descendants().forEach((S,M)=>{S.id=M,S._children=S.children}),x(h),n.attr("viewBox",[-d.left,-0,r,p]).style("user-select","none");const E=n.append("g").attr("class","links"),b=n.append("g").attr("class","nodes");g(h)}}var kD="#000000",DD="#ffffff",RD="#fcf4d6",ID="#fddc69",ND="#f1c21b",PD="#d2a106",UD="#b28600",BD="#8e6a00",HD="#684e00",VD="#483700",GD="#302400",zD="#1c1500",FD={10:RD,20:ID,30:ND,40:PD,50:UD,60:BD,70:HD,80:VD,90:GD,100:zD},jD="#fff2e8",WD="#ffd9be",qD="#ffb784",YD="#ff832b",XD="#eb6200",ZD="#ba4e00",KD="#8a3800",QD="#5e2900",JD="#3e1a00",tR="#231000",eR={10:jD,20:WD,30:qD,40:YD,50:XD,60:ZD,70:KD,80:QD,90:JD,100:tR},nR="#fff1f1",rR="#ffd7d9",iR="#ffb3b8",sR="#ff8389",aR="#fa4d56",oR="#da1e28",lR="#a2191f",cR="#750e13",uR="#520408",hR="#2d0709",dR={10:nR,20:rR,30:iR,40:sR,50:aR,60:oR,70:lR,80:cR,90:uR,100:hR},pR="#fff0f7",fR="#ffd6e8",mR="#ffafd2",gR="#ff7eb6",vR="#ee5396",yR="#d02670",xR="#9f1853",bR="#740937",_R="#510224",ER="#2a0a18",OR={10:pR,20:fR,30:mR,40:gR,50:vR,60:yR,70:xR,80:bR,90:_R,100:ER},SR="#f6f2ff",TR="#e8daff",wR="#d4bbff",$R="#be95ff",MR="#a56eff",CR="#8a3ffc",AR="#6929c4",LR="#491d8b",kR="#31135e",DR="#1c0f30",RR={10:SR,20:TR,30:wR,40:$R,50:MR,60:CR,70:AR,80:LR,90:kR,100:DR},IR="#edf5ff",NR="#d0e2ff",PR="#a6c8ff",UR="#78a9ff",BR="#4589ff",HR="#0f62fe",VR="#0043ce",GR="#002d9c",zR="#001d6c",FR="#001141",jR={10:IR,20:NR,30:PR,40:UR,50:BR,60:HR,70:VR,80:GR,90:zR,100:FR},WR="#e5f6ff",qR="#bae6ff",YR="#82cfff",XR="#33b1ff",ZR="#1192e8",KR="#0072c3",QR="#00539a",JR="#003a6d",tI="#012749",eI="#061727",nI={10:WR,20:qR,30:YR,40:XR,50:ZR,60:KR,70:QR,80:JR,90:tI,100:eI},rI="#d9fbfb",iI="#9ef0f0",sI="#3ddbd9",aI="#08bdba",oI="#009d9a",lI="#007d79",cI="#005d5d",uI="#004144",hI="#022b30",dI="#081a1c",pI={10:rI,20:iI,30:sI,40:aI,50:oI,60:lI,70:cI,80:uI,90:hI,100:dI},fI="#defbe6",mI="#a7f0ba",gI="#6fdc8c",vI="#42be65",yI="#24a148",xI="#198038",bI="#0e6027",_I="#044317",EI="#022d0d",OI="#071908",SI={10:fI,20:mI,30:gI,40:vI,50:yI,60:xI,70:bI,80:_I,90:EI,100:OI},TI="#f2f4f8",wI="#dde1e6",$I="#c1c7cd",MI="#a2a9b0",CI="#878d96",AI="#697077",LI="#4d5358",kI="#343a3f",DI="#21272a",RI="#121619",II={10:TI,20:wI,30:$I,40:MI,50:CI,60:AI,70:LI,80:kI,90:DI,100:RI},NI="#f4f4f4",PI="#e0e0e0",UI="#c6c6c6",BI="#a8a8a8",HI="#8d8d8d",VI="#6f6f6f",GI="#525252",zI="#393939",FI="#262626",jI="#161616",WI={10:NI,20:PI,30:UI,40:BI,50:HI,60:VI,70:GI,80:zI,90:FI,100:jI},qI="#f7f3f2",YI="#e5e0df",XI="#cac5c4",ZI="#ada8a8",KI="#8f8b8b",QI="#726e6e",JI="#565151",tN="#3c3838",eN="#272525",nN="#171414",rN={10:qI,20:YI,30:XI,40:ZI,50:KI,60:QI,70:JI,80:tN,90:eN,100:nN},Xg={black:{100:kD},blue:jR,coolGray:II,cyan:nI,gray:WI,green:SI,magenta:OR,orange:eR,purple:RR,red:dR,teal:pI,warmGray:rN,white:{0:DD},yellow:FD};const iN=e=>{if(!e)return null;for(const t of Object.keys(Xg)){const n=Xg[t];for(const r of Object.keys(n))if(n[+r]===e)return r}return null},Zg=function(e){const t=I(this.parentNode).select("rect.leaf"),n=e.backgroundColor??getComputedStyle(t.node(),null).getPropertyValue("fill"),r=fn(n);let i;if(r&&(i=iN(r?r.hex():null)),i==null){const s=Ld(r).l;i=Math.abs(s*100-100)}return i>50?"white":"black"};let sN=0;class aN extends gt{constructor(){super(...arguments),this.type="treemap",this.renderType=it.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(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t=!0){const n=this.getComponentContainer({ariaLabel:"treemap"});this.model.getData();const r=this.model.getDisplayData(),i=this.model.getOptions(),s=y(window,"location"),{width:a,height:o}=N.getSVGElementSize(n,{useAttrs:!0}),l=hs({name:i.title||"Treemap",children:r}).sum(p=>p.value).sort((p,f)=>f.value-p.value),c=VL().size([a,o]).paddingInner(1).paddingOuter(0).round(!0)(l),u=n.selectAll("g[data-name='leaf']").data(c.leaves(),p=>p.data.name);u.exit().attr("opacity",0).remove();const d=u.enter().append("g").attr("data-name","leaf").attr("data-uid",()=>sN++).merge(u);d.attr("data-name","leaf").transition().call(p=>this.services.transitions.setupTransition({transition:p,name:"treemap-group-update",animate:t})).attr("transform",p=>`translate(${p.x0},${p.y0})`);const h=d.selectAll("rect.leaf").data(p=>[p]);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 p=I(this.parentNode).attr("data-uid");return`${i.style.prefix}-leaf-${p}`}).attr("class",p=>{for(;p.depth>1;)p=p.parent;return this.model.getColorClassName({classNameTypes:[st.FILL],dataGroupName:p.data.name,originalClassName:"leaf"})}).transition().call(p=>this.services.transitions.setupTransition({transition:p,name:"treemap-leaf-update-enter",animate:t})).attr("width",p=>p.x1-p.x0).attr("height",p=>p.y1-p.y0).style("fill",p=>{for(;p.depth>1;)p=p.parent;return this.model.getFillColor(p.data.name,null,p.data)}),d.selectAll("clipPath").data(p=>p.data.showLabel!==!0?[]:[1],p=>p).join(p=>p.append("clipPath").attr("id",function(){const f=I(this.parentNode).attr("data-uid");return`${i.style.prefix}-clip-${f}`}).append("use").attr("xlink:href",function(){const f=I(this.parentNode.parentNode).attr("data-uid"),g=`${i.style.prefix}-leaf-${f}`;return new URL(`#${g}`,s)+""}),p=>null,p=>p.remove()),d.selectAll("text").data(p=>{if(p.data.showLabel!==!0)return[];let f=p;for(;f.depth>1;)f=f.parent;return[{text:p.data.name,backgroundColor:this.model.getFillColor(f.data.name)}]},p=>p).join(p=>{const f=p.append("text").text(g=>g.text).style("fill",Zg).attr("x",7).attr("y",18);return s&&f.attr("clip-path",function(){const g=I(this.parentNode).attr("data-uid"),m=`${i.style.prefix}-clip-${g}`;return`url(${new URL(`#${m}`,s)+""})`}),f},p=>p.text(f=>f.text).style("fill",Zg),p=>p.remove()),this.addEventListeners()}addEventListeners(){const t=this;this.parent.selectAll("rect.leaf").on("mouseover",function(n,r){const i=I(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),fn(s).darker(.7).toString()}),t.services.events.dispatchEvent(T.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(T.Treemap.LEAF_MOUSEOVER,{event:n,element:i,datum:r})}).on("mousemove",function(n,r){const i=I(this);t.services.events.dispatchEvent(T.Treemap.LEAF_MOUSEMOVE,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(T.Tooltip.MOVE,{event:n})}).on("click",function(n,r){t.services.events.dispatchEvent(T.Treemap.LEAF_CLICK,{event:n,element:I(this),datum:r})}).on("mouseout",function(n,r){const i=I(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(T.Treemap.LEAF_MOUSEOUT,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(T.Tooltip.HIDE,{hoveredElement:i})})}}function oN(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function lN(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}),n}var cN={value:function(){}};function Kg(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new uo(n)}function uo(e){this._=e}function uN(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",i=n.indexOf(".");if(i>=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}uo.prototype=Kg.prototype={constructor:uo,on:function(e,t){var n=this._,r=uN(e+"",n),i,s=-1,a=r.length;if(arguments.length<2){for(;++s<a;)if((i=(e=r[s]).type)&&(i=hN(n[i],e.name)))return i;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++s<a;)if(i=(e=r[s]).type)n[i]=Qg(n[i],e.name,t);else if(t==null)for(i in n)n[i]=Qg(n[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new uo(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=new Array(i),r=0,i,s;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(s=this._[e],r=0,i=s.length;r<i;++r)s[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],i=0,s=r.length;i<s;++i)r[i].value.apply(t,n)}};function hN(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function Qg(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=cN,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}const dN=Object.freeze(Object.defineProperty({__proto__:null,dispatch:Kg},Symbol.toStringTag,{value:"Module"})),pN=lN(dN);var yu,Jg;function fN(){if(Jg)return yu;Jg=1;const e=pN.dispatch,t=Math.PI/180,n={archimedean:g,rectangular:m},r=64,i=2048;yu=function(){var E=[256,256],b=s,S=a,M=l,D=o,A=o,R=c,$=u,H=g,P=[],B=1/0,O=e("word","end"),w=null,L=Math.random,k={},U=x;k.canvas=function(j){return arguments.length?(U=_(j),k):U},k.start=function(){var j=K(U()),X=v((E[0]>>5)*E[1]),ct=null,J=P.length,Y=-1,et=[],ut=P.map(function(q,Z){return q.text=b.call(this,q,Z),q.font=S.call(this,q,Z),q.style=D.call(this,q,Z),q.weight=A.call(this,q,Z),q.rotate=R.call(this,q,Z),q.size=~~M.call(this,q,Z),q.padding=$.call(this,q,Z),q}).sort(function(q,Z){return Z.size-q.size});return w&&clearInterval(w),w=setInterval(F,0),F(),k;function F(){for(var q=Date.now();Date.now()-q<B&&++Y<J&&w;){var Z=ut[Y];Z.x=E[0]*(L()+.5)>>1,Z.y=E[1]*(L()+.5)>>1,d(j,Z,ut,Y),Z.hasText&&W(X,Z,ct)&&(et.push(Z),O.call("word",k,Z),ct?p(ct,Z):ct=[{x:Z.x+Z.x0,y:Z.y+Z.y0},{x:Z.x+Z.x1,y:Z.y+Z.y1}],Z.x-=E[0]>>1,Z.y-=E[1]>>1)}Y>=J&&(k.stop(),O.call("end",k,et,ct))}},k.stop=function(){w&&(clearInterval(w),w=null);for(const j of P)delete j.sprite;return k};function K(j){const X=j.getContext("2d",{willReadFrequently:!0});j.width=j.height=1;const ct=Math.sqrt(X.getImageData(0,0,1,1).data.length>>2);return j.width=(r<<5)/ct,j.height=i/ct,X.fillStyle=X.strokeStyle="red",{context:X,ratio:ct}}function W(j,X,ct){E[0],E[1];for(var J=X.x,Y=X.y,et=Math.sqrt(E[0]*E[0]+E[1]*E[1]),ut=H(E),F=L()<.5?1:-1,q=-F,Z,G,dt;(Z=ut(q+=F))&&(G=~~Z[0],dt=~~Z[1],!(Math.min(Math.abs(G),Math.abs(dt))>=et));)if(X.x=J+G,X.y=Y+dt,!(X.x+X.x0<0||X.y+X.y0<0||X.x+X.x1>E[0]||X.y+X.y1>E[1])&&(!ct||f(X,ct))&&!h(X,j,E[0])){for(var ot=X.sprite,It=X.width>>5,Ht=E[0]>>5,rt=X.x-(It<<4),Et=rt&127,Ne=32-Et,Te=X.y1-X.y0,Ss=(X.y+X.y0)*Ht+(rt>>5),Ts,_r=0;_r<Te;_r++){Ts=0;for(var Ze=0;Ze<=It;Ze++)j[Ss+Ze]|=Ts<<Ne|(Ze<It?(Ts=ot[_r*It+Ze])>>>Et:0);Ss+=Ht}return!0}return!1}return k.timeInterval=function(j){return arguments.length?(B=j??1/0,k):B},k.words=function(j){return arguments.length?(P=j,k):P},k.size=function(j){return arguments.length?(E=[+j[0],+j[1]],k):E},k.font=function(j){return arguments.length?(S=_(j),k):S},k.fontStyle=function(j){return arguments.length?(D=_(j),k):D},k.fontWeight=function(j){return arguments.length?(A=_(j),k):A},k.rotate=function(j){return arguments.length?(R=_(j),k):R},k.text=function(j){return arguments.length?(b=_(j),k):b},k.spiral=function(j){return arguments.length?(H=n[j]||j,k):H},k.fontSize=function(j){return arguments.length?(M=_(j),k):M},k.padding=function(j){return arguments.length?($=_(j),k):$},k.random=function(j){return arguments.length?(L=j,k):L},k.on=function(){var j=O.on.apply(O,arguments);return j===O?k:j},k};function s(E){return E.text}function a(){return"serif"}function o(){return"normal"}function l(E){return Math.sqrt(E.value)}function c(){return(~~(random()*6)-3)*30}function u(){return 1}function d(E,b,S,M){if(!b.sprite){var D=E.context,A=E.ratio;D.clearRect(0,0,(r<<5)/A,i/A);var R=0,$=0,H=0,P=S.length;for(--M;++M<P;){b=S[M],D.save(),D.font=b.style+" "+b.weight+" "+~~((b.size+1)/A)+"px "+b.font;const Z=D.measureText(b.text),G=-Math.floor(Z.width/2);let dt=(Z.width+1)*A,ot=b.size<<1;if(b.rotate){var B=Math.sin(b.rotate*t),O=Math.cos(b.rotate*t),w=dt*O,L=dt*B,k=ot*O,U=ot*B;dt=Math.max(Math.abs(w+U),Math.abs(w-U))+31>>5<<5,ot=~~Math.max(Math.abs(L+k),Math.abs(L-k))}else dt=dt+31>>5<<5;if(ot>H&&(H=ot),R+dt>=r<<5&&(R=0,$+=H,H=0),$+ot>=i)break;D.translate((R+(dt>>1))/A,($+(ot>>1))/A),b.rotate&&D.rotate(b.rotate*t),D.fillText(b.text,G,0),b.padding&&(D.lineWidth=2*b.padding,D.strokeText(b.text,G,0)),D.restore(),b.width=dt,b.height=ot,b.xoff=R,b.yoff=$,b.x1=dt>>1,b.y1=ot>>1,b.x0=-b.x1,b.y0=-b.y1,b.hasText=!0,R+=dt}for(var K=D.getImageData(0,0,(r<<5)/A,i/A).data,W=[];--M>=0;)if(b=S[M],!!b.hasText){for(var j=b.width,X=j>>5,ct=b.y1-b.y0,J=0;J<ct*X;J++)W[J]=0;if(R=b.xoff,R==null)return;$=b.yoff;for(var Y=0,et=-1,ut=0;ut<ct;ut++){for(var J=0;J<j;J++){var F=X*ut+(J>>5),q=K[($+ut)*(r<<5)+(R+J)<<2]?1<<31-J%32:0;W[F]|=q,Y|=q}Y?et=ut:(b.y0++,ct--,ut--,$++)}b.y1=b.y0+et,b.sprite=W.slice(0,(b.y1-b.y0)*X)}}}function h(E,b,S){S>>=5;for(var M=E.sprite,D=E.width>>5,A=E.x-(D<<4),R=A&127,$=32-R,H=E.y1-E.y0,P=(E.y+E.y0)*S+(A>>5),B,O=0;O<H;O++){B=0;for(var w=0;w<=D;w++)if((B<<$|(w<D?(B=M[O*D+w])>>>R:0))&b[P+w])return!0;P+=S}return!1}function p(E,b){var S=E[0],M=E[1];b.x+b.x0<S.x&&(S.x=b.x+b.x0),b.y+b.y0<S.y&&(S.y=b.y+b.y0),b.x+b.x1>M.x&&(M.x=b.x+b.x1),b.y+b.y1>M.y&&(M.y=b.y+b.y1)}function f(E,b){return E.x+E.x1>b[0].x&&E.x+E.x0<b[1].x&&E.y+E.y1>b[0].y&&E.y+E.y0<b[1].y}function g(E){var b=E[0]/E[1];return function(S){return[b*(S*=.1)*Math.cos(S),S*Math.sin(S)]}}function m(E){var b=4,S=b*E[0]/E[1],M=0,D=0;return function(A){var R=A<0?-1:1;switch(Math.sqrt(1+4*R*A)-R&3){case 0:M+=S;break;case 1:D+=b;break;case 2:M-=S;break;default:D-=b;break}return[M,D]}}function v(E){for(var b=[],S=-1;++S<E;)b[S]=0;return b}function x(){return document.createElement("canvas")}function _(E){return typeof E=="function"?E:function(){return E}}return yu}var mN=fN();const gN=oN(mN);class vN extends gt{constructor(){super(...arguments),this.type="wordcloud",this.renderType=it.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(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t=!0){const n=this,r=this.getComponentContainer({ariaLabel:"word cloud"}).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=gN().size([u,d]).words(i.map(function(f){const g=f[o];if(typeof f[o]!="number")throw Error("Badly formatted WordCloud data. `value` should only be an integer or float");return{[c]:f[c],text:f[l],size:g,value:g}})).padding(5).rotate(0).fontSize(f=>s(f.size)).on("end",p);h.start();function p(f){const g=N.appendOrSelect(r,"g.words");g.attr("transform",`translate(${h.size()[0]/2}, ${h.size()[1]/2})`);const m=g.selectAll("text").data(f,v=>`${v[c]}-${v.text}`);m.exit().attr("opacity",0).remove(),m.enter().append("text").attr("opacity",0).merge(m).style("font-size",v=>`${v.size}px`).text(function(v){return v.text}).attr("class",v=>n.model.getColorClassName({classNameTypes:[st.FILL],dataGroupName:v[c],originalClassName:`word ${v.size>32?"light":""}`})).style("fill",v=>n.model.getFillColor(v[c],v.text,v)).attr("text-anchor","middle").transition().call(v=>n.services.transitions.setupTransition({transition:v,name:"wordcloud-text-update-enter",animate:t})).attr("transform",v=>`translate(${v.x}, ${v.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?Ge(i):[1,1];return je().domain(o).range(a?n.wordCloud.fontSizeRange(s,t):[4,4])}addEventListeners(){const t=this.getOptions(),{groupMapsTo:n}=t.data,r=this,i=ga(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(T.WordCloud.WORD_MOUSEOVER,{event:s,element:I(this),datum:a}),r.services.events.dispatchEvent(T.Tooltip.SHOW,{event:s,hoveredElement:o,items:[{label:t.tooltip.wordLabel,value:a.text},{label:t.tooltip.valueLabel,value:a.value},{label:yt(t,"locale.translations.group")||yt(t,"tooltip.groupLabel")||"Group",value:a[n],class:r.model.getColorClassName({classNameTypes:[st.TOOLTIP],dataGroupName:a[n]})}]})}).on("mousemove",function(s,a){const o=I(this);r.services.events.dispatchEvent(T.WordCloud.WORD_MOUSEMOVE,{element:o,datum:a}),r.services.events.dispatchEvent(T.Tooltip.MOVE,{event:s})}).on("click",function(s,a){r.services.events.dispatchEvent(T.WordCloud.WORD_CLICK,{event:s,element:I(this),datum:a})}).on("mouseout",function(s,a){const o=I(this);i(null),r.services.events.dispatchEvent(T.WordCloud.WORD_MOUSEOUT,{event:s,element:o,datum:a}),r.services.events.dispatchEvent(T.Tooltip.HIDE,{hoveredElement:o})})}}class yN extends gt{constructor(){super(...arguments),this.type="geo",this.renderType=it.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=y(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=uD(s,Object.values(l)),u=oD(s,{type:"GeometryCollection",geometries:Object.values(o)}),d=i.fitSize([n,r],u),h=_A().projection(d);N.appendOrSelect(t,"g.geo").selectAll("path").data(u.features).join("path").attr("d",h);const p=this.services.domUtils.generateElementIDString("geo-pattern-stripes"),f=N.appendOrSelect(t,"defs");N.appendOrSelect(f,"pattern").attr("id",p).attr("width",5).attr("height",10).attr("patternUnits","userSpaceOnUse").attr("patternTransform","rotate(45)").append("path").classed("pattern-fill",!0).attr("d",ms()([[0,0],[0,10]]));const g=N.appendOrSelect(t,"g.missing-data");N.appendOrSelect(g,"path").datum(c).attr("d",h).style("fill",`url(#${p})`)}getProjection(){let t=null;switch(y(this.getOptions(),"thematic","projection")){case Je.geoEqualEarth:t=HA();break;case Je.geoAlbers:t=DA();break;case Je.geoConicEqualArea:t=qm();break;case Je.geoConicEquidistant:t=UA();break;case Je.geoEquirectangular:t=NA();break;case Je.geoMercator:t=RA();break;case Je.geoNaturalEarth1:t=VA();break;default:throw new Error("Projection is not supported.")}return t}}class xN extends yN{constructor(){super(...arguments),this.type="choropleth"}render(t=!0){super.render();const n=this.model.getCombinedData(),r=this.getComponentContainer({ariaLabel:"map",withinChartClip:!0}),i=y(this.getOptions(),"color"),s=y(i,"gradient","colors");r.select("g.geo").selectAll("path").classed("border",!0).attr("class",a=>this.model.getColorClassName({value:n[a.properties.NAME].value,originalClassName:"border"})).attr("style",a=>s?`fill: ${this.model.getColorClassName({value:n[a.properties.NAME].value})}`:null),this.addCountryAreaEventListener()}addCountryAreaEventListener(){const t=this,n=this.model.getCombinedData();this.parent.selectAll("path.border").on("mouseover",function(r,i){const s=I(this);t.services.events.dispatchEvent(Sr.CHOROPLETH_MOUSEOVER,{event:r,element:s,datum:n[i.properties.NAME]}),t.services.events.dispatchEvent(Or.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(Sr.CHOROPLETH_MOUSEMOVE,{event:r,element:I(this),datum:n[i.properties.NAME]}),t.services.events.dispatchEvent(Or.MOVE,{event:r})}).on("click",function(r,i){t.services.events.dispatchEvent(Sr.CHOROPLETH_CLICK,{event:r,element:I(this),datum:n[i.properties.NAME]})}).on("mouseout",function(r,i){const s=I(this);t.services.events.dispatchEvent(Sr.CHOROPLETH_MOUSEOUT,{event:r,element:s,datum:n[i.properties.NAME]}),t.services.events.dispatchEvent(Or.HIDE,{event:r,hoveredElement:s})})}}function xu(e){var t=e==null?0:e.length;return t?Bs(e,1):[]}function bN(e){return ah(ch(e,void 0,xu),e+"")}function tv(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 _N(e,t){return t.length<2?e:el(e,tv(t,0,-1))}function EN(e,t){return t=Us(t,e),e=_N(e,t),e==null||delete e[Mi(id(t))]}function ON(e){return Eh(e)?void 0:e}var SN=1,TN=2,wN=4,$N=bN(function(e,t){var n={};if(e==null)return n;var r=!1;t=zo(t,function(s){return s=Us(s,e),r||(r=s.length>1),s}),Mr(e,kh(e),n),r&&(n=Ci(n,SN|TN|wN,ON));for(var i=t.length;i--;)EN(n,t[i]);return n});function ev(e){return Math.log(e)}function nv(e){return Math.exp(e)}function MN(e){return-Math.log(-e)}function CN(e){return-Math.exp(-e)}function AN(e){return isFinite(e)?+("1e"+e):e<0?0:e}function LN(e){return e===10?AN:e===Math.E?Math.exp:t=>Math.pow(e,t)}function kN(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function rv(e){return(t,n)=>-e(-t,n)}function DN(e){const t=e(ev,nv),n=t.domain;let r=10,i,s;function a(){return i=kN(r),s=LN(r),n()[0]<0?(i=rv(i),s=rv(s),e(MN,CN)):e(ev,nv),t}return t.base=function(o){return arguments.length?(r=+o,a()):r},t.domain=function(o){return arguments.length?(n(o),a()):n()},t.ticks=o=>{const l=n();let c=l[0],u=l[l.length-1];const d=u<c;d&&([c,u]=[u,c]);let h=i(c),p=i(u),f,g;const m=o==null?10:+o;let v=[];if(!(r%1)&&p-h<m){if(h=Math.floor(h),p=Math.ceil(p),c>0){for(;h<=p;++h)for(f=1;f<r;++f)if(g=h<0?f/s(-h):f*s(h),!(g<c)){if(g>u)break;v.push(g)}}else for(;h<=p;++h)for(f=r-1;f>=1;--f)if(g=h>0?f/s(-h):f*s(h),!(g<c)){if(g>u)break;v.push(g)}v.length*2<m&&(v=js(c,u,m))}else v=js(h,p,Math.min(p-h,m)).map(s);return d?v.reverse():v},t.tickFormat=(o,l)=>{if(o==null&&(o=10),l==null&&(l=r===10?"s":","),typeof l!="function"&&(!(r%1)&&(l=Vi(l)).precision==null&&(l.trim=!0),l=Il(l)),o===1/0)return l;const c=Math.max(1,r*o/t.ticks().length);return u=>{let d=u/s(Math.round(i(u)));return d*r<r-.5&&(d*=r),d<=c?l(u):""}},t.nice=()=>n(zp(n(),{floor:o=>s(Math.floor(i(o))),ceil:o=>s(Math.ceil(i(o)))})),t}function iv(){const e=DN(op()).domain([1,10]);return e.copy=()=>Pl(e,iv()).base(e.base()),Ur.apply(e,arguments),e}function ho(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function po(e){this._context=e}po.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:ho(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:ho(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function RN(e){return new po(e)}function sv(e){this._context=e}sv.prototype={areaStart:Bn,areaEnd:Bn,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:ho(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function IN(e){return new sv(e)}function av(e){this._context=e}av.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:ho(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function NN(e){return new av(e)}function ov(e,t){this._basis=new po(e),this._beta=t}ov.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var e=this._x,t=this._y,n=e.length-1;if(n>0)for(var r=e[0],i=t[0],s=e[n]-r,a=t[n]-i,o=-1,l;++o<=n;)l=o/n,this._basis.point(this._beta*e[o]+(1-this._beta)*(r+l*s),this._beta*t[o]+(1-this._beta)*(i+l*a));this._x=this._y=null,this._basis.lineEnd()},point:function(e,t){this._x.push(+e),this._y.push(+t)}};const PN=function e(t){function n(r){return t===1?new po(r):new ov(r,t)}return n.beta=function(r){return e(+r)},n}(.85);function fo(e,t,n){e._context.bezierCurveTo(e._x1+e._k*(e._x2-e._x0),e._y1+e._k*(e._y2-e._y0),e._x2+e._k*(e._x1-t),e._y2+e._k*(e._y1-n),e._x2,e._y2)}function bu(e,t){this._context=e,this._k=(1-t)/6}bu.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:fo(this,this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2,this._x1=e,this._y1=t;break;case 2:this._point=3;default:fo(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const UN=function e(t){function n(r){return new bu(r,t)}return n.tension=function(r){return e(+r)},n}(0);function _u(e,t){this._context=e,this._k=(1-t)/6}_u.prototype={areaStart:Bn,areaEnd:Bn,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:fo(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const BN=function e(t){function n(r){return new _u(r,t)}return n.tension=function(r){return e(+r)},n}(0);function Eu(e,t){this._context=e,this._k=(1-t)/6}Eu.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:fo(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const HN=function e(t){function n(r){return new Eu(r,t)}return n.tension=function(r){return e(+r)},n}(0);function Ou(e,t,n){var r=e._x1,i=e._y1,s=e._x2,a=e._y2;if(e._l01_a>ee){var o=2*e._l01_2a+3*e._l01_a*e._l12_a+e._l12_2a,l=3*e._l01_a*(e._l01_a+e._l12_a);r=(r*o-e._x0*e._l12_2a+e._x2*e._l01_2a)/l,i=(i*o-e._y0*e._l12_2a+e._y2*e._l01_2a)/l}if(e._l23_a>ee){var c=2*e._l23_2a+3*e._l23_a*e._l12_a+e._l12_2a,u=3*e._l23_a*(e._l23_a+e._l12_a);s=(s*c+e._x1*e._l23_2a-t*e._l12_2a)/u,a=(a*c+e._y1*e._l23_2a-n*e._l12_2a)/u}e._context.bezierCurveTo(r,i,s,a,e._x2,e._y2)}function lv(e,t){this._context=e,this._alpha=t}lv.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3;default:Ou(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const VN=function e(t){function n(r){return t?new lv(r,t):new bu(r,0)}return n.alpha=function(r){return e(+r)},n}(.5);function cv(e,t){this._context=e,this._alpha=t}cv.prototype={areaStart:Bn,areaEnd:Bn,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:Ou(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const GN=function e(t){function n(r){return t?new cv(r,t):new _u(r,0)}return n.alpha=function(r){return e(+r)},n}(.5);function uv(e,t){this._context=e,this._alpha=t}uv.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Ou(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const zN=function e(t){function n(r){return t?new uv(r,t):new Eu(r,0)}return n.alpha=function(r){return e(+r)},n}(.5);function hv(e){return e<0?-1:1}function dv(e,t,n){var r=e._x1-e._x0,i=t-e._x1,s=(e._y1-e._y0)/(r||i<0&&-0),a=(n-e._y1)/(i||r<0&&-0),o=(s*i+a*r)/(r+i);return(hv(s)+hv(a))*Math.min(Math.abs(s),Math.abs(a),.5*Math.abs(o))||0}function pv(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function Su(e,t,n){var r=e._x0,i=e._y0,s=e._x1,a=e._y1,o=(s-r)/3;e._context.bezierCurveTo(r+o,i+o*t,s-o,a-o*n,s,a)}function mo(e){this._context=e}mo.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:Su(this,this._t0,pv(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,Su(this,pv(this,n=dv(this,e,t)),n);break;default:Su(this,this._t0,n=dv(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function fv(e){this._context=new mv(e)}(fv.prototype=Object.create(mo.prototype)).point=function(e,t){mo.prototype.point.call(this,t,e)};function mv(e){this._context=e}mv.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,s){this._context.bezierCurveTo(t,e,r,n,s,i)}};function FN(e){return new mo(e)}function jN(e){return new fv(e)}function gv(e){this._context=e}gv.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=vv(e),i=vv(t),s=0,a=1;a<n;++s,++a)this._context.bezierCurveTo(r[0][s],i[0][s],r[1][s],i[1][s],e[a],t[a]);(this._line||this._line!==0&&n===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}};function vv(e){var t,n=e.length-1,r,i=new Array(n),s=new Array(n),a=new Array(n);for(i[0]=0,s[0]=2,a[0]=e[0]+2*e[1],t=1;t<n-1;++t)i[t]=1,s[t]=4,a[t]=4*e[t]+2*e[t+1];for(i[n-1]=2,s[n-1]=7,a[n-1]=8*e[n-1]+e[n],t=1;t<n;++t)r=i[t]/s[t-1],s[t]-=r,a[t]-=r*a[t-1];for(i[n-1]=a[n-1]/s[n-1],t=n-2;t>=0;--t)i[t]=(a[t]-i[t+1])/s[t];for(s[n-1]=(e[n]+i[n-1])/2,t=0;t<n-1;++t)s[t]=2*e[t+1]-i[t+1];return[i,s]}function WN(e){return new gv(e)}function go(e,t){this._context=e,this._t=t}go.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}break}}this._x=e,this._y=t}};function qN(e){return new go(e,.5)}function YN(e){return new go(e,0)}function XN(e){return new go(e,1)}class ZN extends wn{zoomIn(t,n,r){let i,s,a;const o=r||Hr;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(T.CanvasZoom.CANVAS_ZOOM_IN,{element:I(t)})}zoomOut(t,n){const r=n||Hr;t.transition().duration(r.duration).ease(r.ease).attr("transform",""),this.services.events.dispatchEvent(T.CanvasZoom.CANVAS_ZOOM_OUT)}}class KN extends wn{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 QN extends wn{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 JN extends wn{constructor(){super(...arguments),this.pendingTransitions={}}init(){var t;(t=this.services.events)==null||t.addEventListener(T.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(y(fp,n,"duration")||fp.default.duration)}getPendingTransitions(){return this.pendingTransitions}}function Os(e,t){const n=+Pt(e)-+Pt(t);return n<0?-1:n>0?1:n}function tP(e,t,n){const[r,i]=qn(void 0,e,t);return r.getFullYear()-i.getFullYear()}function eP(e,t,n){const[r,i]=qn(void 0,e,t),s=Os(r,i),a=Math.abs(tP(r,i));r.setFullYear(1584),i.setFullYear(1584);const o=Os(r,i)===-s,l=s*(a-+o);return l===0?0:l}function Tu(e,t,n){const r=Pt(e,void 0);if(isNaN(t))return $e(e,NaN);if(!t)return r;const i=r.getDate(),s=$e(e,r.getTime());s.setMonth(r.getMonth()+t+1,0);const a=s.getDate();return i>=a?s:(r.setFullYear(s.getFullYear(),s.getMonth(),i),r)}function yv(e,t,n){return Tu(e,t*12)}function nP(e,t,n){return yv(e,-t)}function rP(e,t,n){const[r,i]=qn(void 0,e,t),s=r.getFullYear()-i.getFullYear(),a=r.getMonth()-i.getMonth();return s*12+a}function iP(e,t){const n=Pt(e,void 0);return n.setHours(23,59,59,999),n}function sP(e,t){const n=Pt(e,void 0),r=n.getMonth();return n.setFullYear(n.getFullYear(),r+1,0),n.setHours(23,59,59,999),n}function aP(e,t){const n=Pt(e,void 0);return+iP(n)==+sP(n)}function oP(e,t,n){const[r,i,s]=qn(void 0,e,e,t),a=Os(i,s),o=Math.abs(rP(i,s));if(o<1)return 0;i.getMonth()===1&&i.getDate()>27&&i.setDate(30),i.setMonth(i.getMonth()-a*o);let l=Os(i,s)===-a;aP(r)&&o===1&&Os(r,s)===1&&(l=!1);const c=a*(o-+l);return c===0?0:c}function lP(e,t,n){return Tu(e,-t)}function cP(e,t,n){const[r,i]=qn(void 0,e,t),s=xv(r,i),a=Math.abs(wp(r,i));r.setDate(r.getDate()-s*a);const o=+(xv(r,i)===-s),l=s*(a-o);return l===0?0:l}function xv(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 bv(e,t,n){const r=Pt(e,void 0);return isNaN(t)?$e(e,NaN):(t&&r.setDate(r.getDate()+t),r)}function uP(e,t,n){return bv(e,-t)}function wu(e){return t=>{const n=(0,Math.trunc)(t);return n===0?0:n}}function hP(e,t,n){const[r,i]=qn(void 0,e,t),s=(+r-+i)/Yu;return wu()(s)}function _v(e,t,n){return $e(e,+Pt(e)+t)}function Ev(e,t,n){return _v(e,t*Yu)}function dP(e,t,n){return Ev(e,-t)}function Ov(e,t){return+Pt(e)-+Pt(t)}function Sv(e,t,n){const r=Ov(e,t)/qu;return wu()(r)}function $u(e,t,n){const r=Pt(e,void 0);return r.setTime(r.getTime()+t*qu),r}function Tv(e,t,n){return $u(e,-t)}function wv(e,t,n){const r=Ov(e,t)/1e3;return wu()(r)}function Mu(e,t,n){return _v(e,t*1e3)}function $v(e,t,n){return Mu(e,-t)}class pP extends wn{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=y(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=y(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 y(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===z.BOTTOM||t===z.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(z).map(t=>z[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===z.LEFT||this.rangeAxisPosition===z.RIGHT)&&(this.domainAxisPosition===z.BOTTOM||this.domainAxisPosition===z.TOP)?this.orientation=Gt.VERTICAL:this.orientation=Gt.HORIZONTAL}isDualAxes(){return this.dualAxes}determineAxisDuality(){var t,n,r,i;const s=this.model.getOptions(),a=y(s,"axes");((t=a[z.LEFT])!=null&&t.correspondingDatasets&&a[z.RIGHT]||(n=a[z.RIGHT])!=null&&n.correspondingDatasets&&a[z.LEFT]||(r=a[z.TOP])!=null&&r.correspondingDatasets&&a[z.BOTTOM]||(i=a[z.BOTTOM])!=null&&i.correspondingDatasets&&a[z.TOP])&&(this.dualAxes=!0)}getCustomDomainValuesByposition(t){const n=y(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]===nt.LINEAR||this.scaleTypes[t]===nt.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=[z.BOTTOM,z.TOP];return[this.domainAxisPosition,this.rangeAxisPosition].find(n=>t.indexOf(n)>-1)}getMainYAxisPosition(){const t=[z.LEFT,z.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=y(s,"axes")[r],{mapsTo:o}=a,l=y(i,o)!==null?i[o]:i;let c;switch(n){case nt.LABELS:c=t(l)+t.step()/2;break;case nt.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=y(s,"axes")[r],{mapsTo:o}=a,l=t[o]!==void 0?t[o]:t;return[i(y(t,n.upperBoundMapsTo)!==null?t[n.upperBoundMapsTo]:l),i(y(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 y(n,"axes",this.getDomainAxisPosition({datum:t}),"mapsTo")}getRangeIdentifier(t){const n=this.model.getOptions();return y(n,"axes",this.getRangeAxisPosition({datum:t}),"mapsTo")}extendsDomain(t,n){const r=this.model.getOptions(),i=y(r,"axes",t);if(i.scaleType===nt.TIME){const s=y(r,"timeScale","addSpaceOnEdges");return fP(n,s)}else return mP(n,Nn.paddingRatio,i.scaleType)}findVerticalAxesPositions(){const t=this.model.getOptions(),n=y(t,"axes"),r=this.isDualAxes();return y(n,z.LEFT)===null&&y(n,z.RIGHT)!==null||y(n,z.RIGHT,"main")===!0||r&&y(n,z.LEFT,"correspondingDatasets")?{primary:z.RIGHT,secondary:z.LEFT}:{primary:z.LEFT,secondary:z.RIGHT}}findHorizontalAxesPositions(){const t=this.model.getOptions(),n=y(t,"axes"),r=this.isDualAxes();return y(n,z.BOTTOM)===null&&y(n,z.TOP)!==null||y(n,z.TOP,"main")===!0||r&&y(n,z.BOTTOM,"correspondingDatasets")?{primary:z.TOP,secondary:z.BOTTOM}:{primary:z.BOTTOM,secondary:z.TOP}}findDomainAndRangeAxesPositions(t,n){const r=this.model.getOptions(),i=y(r,"axes",t.primary),s=y(r,"axes",n.primary),a=i.scaleType||nt.LINEAR,o=s.scaleType||nt.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===nt.LABELS||o===nt.TIME)&&a===nt.LABELS||a===nt.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=y(n,"axes",t),i=y(n,"bounds"),{includeZero:s}=r,a=y(r,"scaleType")||nt.LINEAR;if(this.model.isDataEmpty())return[];if(r.binned){const{bins:v}=this.model.getBinConfigurations();return[0,tr(v,x=>x.length)]}else if(r.limitDomainToBins){const{bins:v}=this.model.getBinConfigurations(),x=this.model.getStackKeys({bins:v});return[x[0].split(":")[0],x[x.length-1].split(":")[1]]}const o=this.model.getDisplayData(),{extendLinearDomainBy:l,mapsTo:c,percentage:u,thresholds:d}=r,{reference:h,compareTo:p}=Nn.ratio;if(r.domain)return a===nt.LABELS?r.domain:(a===nt.TIME&&(r.domain=r.domain.map(v=>v.getTime===void 0?new Date(v):v)),this.extendsDomain(t,r.domain));if(u)return[0,100];if(r&&a===nt.LABELS)return Li(o.map(v=>v[c]));let f,g;const m=this.model.getDataGroupNames();if(a===nt.LABELS_RATIO)return o.map(v=>`${v[h]}/${v[p]}`);if(a===nt.TIME)g=o.map(v=>+new Date(v[c]));else if(i&&n.axes)g=[],o.forEach(v=>{g.push(v[c]),v[i.upperBoundMapsTo]&&g.push(v[i.upperBoundMapsTo]),v[i.lowerBoundMapsTo]&&g.push(v[i.lowerBoundMapsTo])});else if(r.stacked===!0&&m&&t===this.getRangeAxisPosition()){const{groupMapsTo:v}=n.data,x=this.model.getDataValuesGroupedByKeys({groups:m}),_=o.filter(b=>!m.includes(b[v])),E=[];x.forEach(b=>{const{...S}=b;let M=0,D=0;Object.values($N(S,"sharedStackKey")).forEach(A=>{isNaN(A)||(A<0?D+=A:M+=A)}),E.push([D,M])}),g=[...xu(E),..._.map(b=>b[c])]}else g=[],o.forEach(v=>{const x=v[c];Array.isArray(x)&&x.length===2?(g.push(x[0]),g.push(x[1])):(l&&g.push(Math.max(v[c],v[l])),g.push(x))});return a!==nt.TIME&&a!==nt.LOG&&s&&g.push(0),d&&d.length>0&&d.forEach(v=>{const x=y(v,"value");x!==null&&g.push(x)}),f=Ge(g),f=this.extendsDomain(t,f),f}createScale(t){const n=this.model.getOptions(),r=y(n,"axes",t);if(!r)return null;const i=y(r,"scaleType")||nt.LINEAR;this.scaleTypes[t]=i;let s;return i===nt.TIME?s=cf():i===nt.LOG?s=iv().base(r.base||10):i===nt.LABELS||i===nt.LABELS_RATIO?s=Yi():s=je(),s.domain(this.getScaleDomain(t)),s}getDomainLowerBound(t){let n,r=0;return this.getOrientation()===Gt.VERTICAL?n=this.getMainYScale().domain():n=this.getMainXScale().domain(),y(this.model.getOptions(),"axes",t,"includeZero")===!1&&n[0]>0&&n[1]>0&&(r=n[0]),r}getHighestDomainThreshold(){const t=y(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)===nt.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=y(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 fP(e,t){const n=new Date(e[0]),r=new Date(e[1]);return eP(r,n)>1?[nP(n,t),yv(r,t)]:oP(r,n)>1?[lP(n,t),Tu(r,t)]:cP(r,n)>1?[uP(n,t),bv(r,t)]:hP(r,n)>1?[dP(n,t),Ev(r,t)]:Sv(r,n)>30?[Tv(n,t*30),$u(r,t*30)]:Sv(r,n)>1?[Tv(n,t),$u(r,t)]:wv(r,n)>15?[$v(n,t*15),Mu(r,t*15)]:wv(r,n)>1?[$v(n,t),Mu(r,t)]:[n,r]}function mP([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===nt.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]}class gP extends wn{constructor(){super(...arguments),this.curveTypes={curveLinear:Oa,curveLinearClosed:ff,curveBasis:RN,curveBasisClosed:IN,curveBasisOpen:NN,curveBundle:PN,curveCardinal:UN,curveCardinalClosed:BN,curveCardinalOpen:HN,curveCatmullRom:VN,curveCatmullRomClosed:GN,curveCatmullRomOpen:zN,curveMonotoneX:FN,curveMonotoneY:jN,curveNatural:WN,curveStep:qN,curveStepAfter:XN,curveStepBefore:YN}}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}}class vP extends wn{isZoomBarEnabled(){if(!this.services.cartesianScales||!y(this.model.getOptions(),"zoomBar","top","enabled"))return!1;this.services.cartesianScales.findDomainAndRangeAxes();const t=this.services.cartesianScales.getMainXAxisPosition(),n=y(this.model.getOptions(),"axes",t,"scaleType");return t===z.BOTTOM&&n===nt.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=y(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,Ge(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(T.ZoomDomain.CHANGE,{newDomain:t}))}getZoomRatio(){return y(this.model.getOptions(),"zoomBar","zoomRatio")}filterDataForRangeAxis(t,n){var r;const i=this.model.get("zoomDomain"),s=Object.assign({stacked:!1},n),a=y(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=be.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 p=[s.invert(d),s.invert(h)];(r[0].valueOf()!==p[0].valueOf()||r[1].valueOf()!==p[1].valueOf())&&this.handleDomainChange(p)}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=y(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 y(this.model.getOptions(),"zoomBar",t,"loading")}isZoomBarLocked(t){return y(this.model.getOptions(),"zoomBar",t,"locked")}}function yP(e,t,n){var r=e.length;return n=n===void 0?r:n,tv(e,t,n)}var xP="\\ud800-\\udfff",bP="\\u0300-\\u036f",_P="\\ufe20-\\ufe2f",EP="\\u20d0-\\u20ff",OP=bP+_P+EP,SP="\\ufe0e\\ufe0f",TP="\\u200d",wP=RegExp("["+TP+xP+OP+SP+"]");function Mv(e){return wP.test(e)}function $P(e){return e.split("")}var Cv="\\ud800-\\udfff",MP="\\u0300-\\u036f",CP="\\ufe20-\\ufe2f",AP="\\u20d0-\\u20ff",LP=MP+CP+AP,kP="\\ufe0e\\ufe0f",DP="["+Cv+"]",Cu="["+LP+"]",Au="\\ud83c[\\udffb-\\udfff]",RP="(?:"+Cu+"|"+Au+")",Av="[^"+Cv+"]",Lv="(?:\\ud83c[\\udde6-\\uddff]){2}",kv="[\\ud800-\\udbff][\\udc00-\\udfff]",IP="\\u200d",Dv=RP+"?",Rv="["+kP+"]?",NP="(?:"+IP+"(?:"+[Av,Lv,kv].join("|")+")"+Rv+Dv+")*",PP=Rv+Dv+NP,UP="(?:"+[Av+Cu+"?",Cu,Lv,kv,DP].join("|")+")",BP=RegExp(Au+"(?="+Au+")|"+UP+PP,"g");function HP(e){return e.match(BP)||[]}function VP(e){return Mv(e)?HP(e):$P(e)}function GP(e){return function(t){t=$i(t);var n=Mv(t)?VP(t):void 0,r=n?n[0]:t.charAt(0),i=n?yP(n,1).join(""):t.slice(1);return r[e]()+i}}var zP=GP("toUpperCase");function FP(e){return zP($i(e).toLowerCase())}var jP=Yf(function(e,t,n){return t=t.toLowerCase(),e+(n?FP(t):t)});class Xe{constructor(t,n){this.components=[],this.services={canvasZoom:ZN,domUtils:N,events:KN,files:QN,gradientUtils:dc,transitions:JN},this.model=new rn(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(T.Model.UPDATE,r=>{const i=!!y(r,"detail","animate");this.update(i)}),this.model.setData(n.data),this.services.events.addEventListener(T.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(T.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=y(r,"toolbar","enabled"),s={id:"legend",components:[new cu(this.model,this.services)],growth:lt.PREFERRED},a=y(r,"canvasZoom","enabled");a&&a===!0&&t.push(new Mk(this.model,this.services));const o=!!this.model.getOptions().title,l={id:"title",components:[new _s(this.model,this.services)],growth:lt.STRETCH},c={id:"toolbar",components:[new io(this.model,this.services)],growth:lt.PREFERRED},u={id:"header",components:[new Oe(this.model,this.services,[l,...i?[c]:[]],{direction:Mt.ROW,alignItems:jn.CENTER})],growth:lt.PREFERRED},d={id:"graph-frame",components:t,growth:lt.STRETCH,renderType:y(n,"graphFrameRenderType")||it.SVG},h=y(n,"excludeLegend")!==!0&&r.legend.enabled!==!1;let p=Mt.COLUMN;if(h){const v=y(r,"legend","position");v==="left"?(p=Mt.ROW,r.legend.orientation||(r.legend.orientation=wr.VERTICAL)):v==="right"?(p=Mt.ROW_REVERSE,r.legend.orientation||(r.legend.orientation=wr.VERTICAL)):v==="bottom"&&(p=Mt.COLUMN_REVERSE)}const f={id:"spacer",components:[new An(this.model,this.services)],growth:lt.PREFERRED},g={id:"full-frame",components:[new Oe(this.model,this.services,[...h?[s]:[],...h?[f]:[],d],{direction:p})],growth:lt.STRETCH},m=[];if(o||i){m.push(u);const v={id:"spacer",components:[new An(this.model,this.services,i?{size:15}:void 0)],growth:lt.PREFERRED};m.push(v)}return m.push(g),[new uu(this.model,this.services),new so(this.model,this.services),new Oe(this.model,this.services,m,{direction:Mt.COLUMN})]}}class ge extends Xe{constructor(t,n){super(t,n),this.services=Object.assign(this.services,{cartesianScales:pP,curves:gP,zoom:vP}),this.model=new lr(this.services)}getAxisChartComponents(t,n){const r=this.model.getOptions(),i=y(r,"zoomBar",z.TOP,"enabled"),s=y(r,"toolbar","enabled");this.services.cartesianScales.determineAxisDuality(),this.services.cartesianScales.findDomainAndRangeAxes(),this.services.cartesianScales.determineOrientation();const a=this.services.cartesianScales.getMainXAxisPosition(),o=y(r,"axes",a,"scaleType"),l=i&&a===z.BOTTOM&&o===nt.TIME,c=this.services.zoom.isZoomBarLocked(z.TOP),u=!!this.model.getOptions().title,d={id:"title",components:[new _s(this.model,this.services)],growth:lt.STRETCH},h={id:"toolbar",components:[new io(this.model,this.services)],growth:lt.PREFERRED},p={id:"header",components:[new Oe(this.model,this.services,[d,...s?[h]:[]],{direction:Mt.ROW,alignItems:jn.CENTER})],growth:lt.PREFERRED},f={id:"legend",components:[new cu(this.model,this.services)],growth:lt.PREFERRED};l&&!c&&t.push(new Og(this.model,this.services),new Ck(this.model,this.services)),t.push(new Lk(this.model,this.services)),t.push(new kk(this.model,this.services));const g={id:"graph-frame",components:t,growth:lt.STRETCH,renderType:it.SVG},m=y(n,"legend","enabled")!==!1&&this.model.getOptions().legend.enabled!==!1;let v=Mt.COLUMN;if(m){const S=y(this.model.getOptions(),"legend","position");S===Tr.LEFT?(v=Mt.ROW,this.model.getOptions().legend.orientation||(this.model.getOptions().legend.orientation=wr.VERTICAL)):S===Tr.RIGHT?(v=Mt.ROW_REVERSE,this.model.getOptions().legend.orientation||(this.model.getOptions().legend.orientation=wr.VERTICAL)):S===Tr.BOTTOM&&(v=Mt.COLUMN_REVERSE)}const x={id:"spacer",components:[new An(this.model,this.services)],growth:lt.PREFERRED},_={id:"full-frame",components:[new Oe(this.model,this.services,[...m?[f]:[],...m?[x]:[],g],{direction:v})],growth:lt.STRETCH},E={id:"zoom-bar",components:[new Ak(this.model,this.services)],growth:lt.PREFERRED,renderType:it.SVG},b=[];if(u||s){b.push(p);const S={id:"spacer",components:[new An(this.model,this.services,s?{size:15}:void 0)],growth:lt.PREFERRED};b.push(S)}return l&&b.push(E),b.push(_),[new $g(this.model,this.services),new so(this.model,this.services),new Oe(this.model,this.services,b,{direction:Mt.COLUMN})]}}class WP extends Xe{constructor(t,n){super(t,n),this.model=new zw(this.services),this.model.setOptions(Rt(Ct.alluvialChart,n.options)),this.init(t,n)}getComponents(){const t=[new Qk(this.model,this.services)];return this.getChartComponents(t,{excludeLegend:!0})}}class qP extends ge{constructor(t,n){super(t,n),this.model.setOptions(Rt(pn(Ct.areaChart),n.options)),this.init(t,n)}getComponents(){const t=[new me(this.model,this.services),new Se(this.model,this.services),new Gn(this.model,this.services),new ai(this.model,this.services),new Ng(this.model,this.services),new cn(this.model,this.services,{fadeInOnChartHolderMouseover:!0,handleThresholds:!0}),new ce(this.model,this.services,{skeleton:Ft.GRID})];return this.getAxisChartComponents(t)}}class YP extends ge{constructor(t,n){super(t,n),this.model=new Fw(this.services),this.model.setOptions(Rt(Ct.boxplotChart,n.options)),this.init(t,n)}getComponents(){const t=[new me(this.model,this.services),new Se(this.model,this.services),new eD(this.model,this.services),new oi(this.model,this.services),new ce(this.model,this.services,{skeleton:Ft.VERT_OR_HORIZ})];return this.getAxisChartComponents(t,{legend:{enabled:!1}})}}class XP extends ge{constructor(t,n){super(t,n),this.model.setOptions(Rt(Ct.bubbleChart,n.options)),this.init(t,n)}getComponents(){const t=[new me(this.model,this.services),new Se(this.model,this.services),new Gn(this.model,this.services),new nD(this.model,this.services),new ce(this.model,this.services,{skeleton:Ft.GRID})];return this.getAxisChartComponents(t)}}class ZP extends ge{constructor(t,n){super(t,n),this.model=new jw(this.services),this.model.setOptions(Rt(Ct.bulletChart,n.options)),this.init(t,n)}getComponents(){const t=[new me(this.model,this.services),new Se(this.model,this.services),new rD(this.model,this.services),new ce(this.model,this.services,{skeleton:Ft.GRID})];return this.getAxisChartComponents(t)}}class KP extends Xe{constructor(t,n){super(t,n),this.model=new Ww(this.services),this.model.setOptions(Rt(Ct.choroplethChart,n.options)),this.init(t,n)}getChartComponents(t,n){const r=this.model.getOptions(),i=y(r,"toolbar","enabled"),s=!!this.model.getOptions().title,a={id:"title",components:[new _s(this.model,this.services)],growth:lt.STRETCH},o={id:"toolbar",components:[new io(this.model,this.services)],growth:lt.PREFERRED},l={id:"header",components:[new Oe(this.model,this.services,[a,...i?[o]:[]],{direction:Mt.ROW,alignItems:jn.CENTER})],growth:lt.PREFERRED},c={id:"legend",components:[new Hg(this.model,this.services,{chartType:"choropleth"})],growth:lt.PREFERRED,renderType:it.SVG},u={id:"graph-frame",components:t,growth:lt.STRETCH,renderType:it.SVG},d=y(n,"legend","enabled")!==!1&&this.model.getOptions().legend.enabled!==!1&&this.model.getData().length>0,h=Mt.COLUMN_REVERSE,p={id:"spacer",components:[new An(this.model,this.services,{size:15})],growth:lt.PREFERRED},f={id:"full-frame",components:[new Oe(this.model,this.services,[...d?[c]:[],...d?[p]:[],u],{direction:h})],growth:lt.STRETCH},g=[];if(s||i){g.push(l);const m={id:"spacer",components:[new An(this.model,this.services,i?{size:15}:void 0)],growth:lt.PREFERRED};g.push(m)}return g.push(f),[new uu(this.model,this.services),new so(this.model,this.services),new Oe(this.model,this.services,g,{direction:Mt.COLUMN})]}getComponents(){const t=[new xN(this.model,this.services)];return this.getChartComponents(t)}}class QP extends Xe{constructor(t,n){super(t,n),this.model=new qw(this.services),this.model.setOptions(Rt(Ct.circlePackChart,n.options)),this.init(t,n)}getComponents(){const t=[new _D(this.model,this.services)];return this.getChartComponents(t)}}const Iv={[ve.LINE]:[ai,cn],[ve.SCATTER]:[cn],[ve.AREA]:[Ng,ai,cn],[ve.STACKED_AREA]:[Wg,ai,Yg,co],[ve.SIMPLE_BAR]:[jg],[ve.GROUPED_BAR]:[Fg,oi],[ve.STACKED_BAR]:[qg,co]};class JP extends ge{constructor(t,n){super(t,n);const r=Rt(Ct.comboChart,n.options);n.options.comboChartTypes||(console.error("No comboChartTypes defined for the Combo Chart!"),r.comboChartTypes=[{type:ve.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(Iv).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=`${jP(i.type)}Chart`;return a=at({},Ct[l],this.model.getOptions(),i.options),i.type===ve.STACKED_AREA&&(o=!0),Iv[i.type].map(c=>new c(this.model,this.services,{groups:i.correspondingDatasets,id:n++,options:a,stacked:o}))}else return a=at({},this.model.getOptions(),i.options),new s(this.model,this.services,{groups:i.correspondingDatasets,id:n++,options:a})}).filter(i=>i!==null);return xu(r)}getComponents(){const{comboChartTypes:t}=this.model.getOptions(),n=t.some(i=>i.type===ve.STACKED_BAR||i.type===ve.STACKED_AREA),r=[new me(this.model,this.services),new Se(this.model,this.services),new ce(this.model,this.services,{skeleton:Ft.GRID}),...n?[]:[new Gn(this.model,this.services)],...this.getGraphComponents()];return this.getAxisChartComponents(r)}}class Nv extends Xe{constructor(t,n,r=!1){super(t,n),this.model=new Yw(this.services),!r&&(this.model.setOptions(Rt(Ct.pieChart,n.options)),this.init(t,n))}getComponents(){const t=[new Vg(this.model,this.services),new ce(this.model,this.services,{skeleton:Ft.PIE})];return this.getChartComponents(t)}}class t3 extends Nv{constructor(t,n){super(t,n,!0),this.model.setOptions(Rt(Ct.donutChart,n.options)),this.init(t,n)}getComponents(){const t=[new OD(this.model,this.services),new ce(this.model,this.services,{skeleton:Ft.DONUT})];return this.getChartComponents(t)}}class e3 extends Xe{constructor(t,n){super(t,n),this.model=new Xw(this.services),this.model.setOptions(Rt(Ct.gaugeChart,n.options)),this.init(t,n)}getComponents(){const t=[new SD(this.model,this.services)];return this.getChartComponents(t)}}class n3 extends ge{constructor(t,n){super(t,n),this.model.setOptions(Rt(Ct.groupedBarChart,n.options)),this.init(t,n)}getComponents(){const t=[new me(this.model,this.services),new Se(this.model,this.services),new Fg(this.model,this.services),new oi(this.model,this.services),new ce(this.model,this.services,{skeleton:Ft.VERT_OR_HORIZ})];return this.getAxisChartComponents(t)}}class r3 extends ge{constructor(t,n){super(t,n),this.model=new Zw(this.services),this.model.setOptions(Rt(Ct.heatmapChart,n.options)),this.init(t,n)}getAxisChartComponents(t,n){const r=this.model.getOptions(),i=y(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:lt.STRETCH},o={id:"toolbar",components:[new io(this.model,this.services)],growth:lt.PREFERRED},l={id:"header",components:[new Oe(this.model,this.services,[a,...i?[o]:[]],{direction:Mt.ROW,alignItems:jn.CENTER})],growth:lt.PREFERRED},c={id:"legend",components:[new Hg(this.model,this.services,{chartType:"heatmap"})],growth:lt.PREFERRED,renderType:it.SVG},u={id:"graph-frame",components:t,growth:lt.STRETCH,renderType:it.SVG},d=y(n,"legend","enabled")!==!1&&this.model.getOptions().legend.enabled!==!1&&this.model.getData().length>0,h=Mt.COLUMN_REVERSE,p={id:"spacer",components:[new An(this.model,this.services,{size:15})],growth:lt.PREFERRED},f={id:"full-frame",components:[new Oe(this.model,this.services,[...d?[c]:[],...d?[p]:[],u],{direction:h})],growth:lt.STRETCH},g=[];if(s||i){g.push(l);const m={id:"spacer",components:[new An(this.model,this.services,i?{size:15}:void 0)],growth:lt.PREFERRED};g.push(m)}return g.push(f),[new $g(this.model,this.services),new so(this.model,this.services),new Oe(this.model,this.services,g,{direction:Mt.COLUMN})]}getComponents(){const t=[new me(this.model,this.services),new TD(this.model,this.services)];return this.getAxisChartComponents(t)}}class i3 extends ge{constructor(t,n){super(t,n),this.model=new Kw(this.services),this.model.setOptions(Rt(Ct.histogramChart,n.options)),this.init(t,n),this.update()}getComponents(){const t=[new me(this.model,this.services),new Se(this.model,this.services),new dD(this.model,this.services),new wD(this.model,this.services)];return this.getAxisChartComponents(t)}}class s3 extends ge{constructor(t,n){super(t,n),this.model.setOptions(Rt(Ct.lineChart,n.options)),this.init(t,n)}getComponents(){const t=[new me(this.model,this.services),new Se(this.model,this.services),new Gn(this.model,this.services),new ai(this.model,this.services),new cn(this.model,this.services,{handleThresholds:!0}),new AD(this.model,this.services),new oi(this.model,this.services)];return this.getAxisChartComponents(t)}}class a3 extends ge{constructor(t,n){super(t,n),this.model.setOptions(Rt(Ct.lollipopChart,n.options)),this.init(t,n)}getComponents(){const t=[new me(this.model,this.services),new Se(this.model,this.services),new Gn(this.model,this.services),new $D(this.model,this.services),new cn(this.model,this.services),new ce(this.model,this.services,{skeleton:Ft.GRID})];return this.getAxisChartComponents(t)}}class o3 extends Xe{constructor(t,n){var r;super(t,n),this.model=new Qw(this.services);const i=(r=n.options.meter)!=null&&r.proportional?at(pn(Ct.proportionalMeterChart),n.options):at(pn(Ct.meterChart),n.options);this.model.setOptions(i),this.init(t,n)}getComponents(){const t=[...y(this.model.getOptions(),"meter","showLabels")?[{id:"meter-title",components:[new bD(this.model,this.services)],growth:lt.STRETCH,renderType:it.SVG},{id:"spacer",components:[new An(this.model,this.services,{size:8})],growth:lt.STRETCH}]:[],{id:"meter-graph",components:[new MD(this.model,this.services)],growth:lt.STRETCH,renderType:it.SVG}],n=[new Oe(this.model,this.services,t,{direction:Mt.COLUMN})];return this.getChartComponents(n,{graphFrameRenderType:it.HTML})}}class l3 extends Xe{constructor(t,n){super(t,n),this.model=new Jw(this.services),this.model.setOptions(Rt(Ct.radarChart,n.options)),this.init(t,n)}getComponents(){const t=[new CD(this.model,this.services)];return this.getChartComponents(t)}}class c3 extends ge{constructor(t,n){super(t,n),this.model.setOptions(Rt(Ct.scatterChart,n.options)),this.init(t,n)}getComponents(){const t=[new me(this.model,this.services),new Se(this.model,this.services),new Gn(this.model,this.services),new cn(this.model,this.services),new ce(this.model,this.services,{skeleton:Ft.GRID})];return this.getAxisChartComponents(t)}}class u3 extends Xe{constructor(t,n){super(t,n),this.model=new t$(this.services),this.model.setOptions(Rt(Ct.treeChart,n.options)),this.init(t,n)}getComponents(){const t=[new LD(this.model,this.services)];return this.getChartComponents(t,{excludeLegend:!0})}}class h3 extends Xe{constructor(t,n){super(t,n),this.model=new e$(this.services),this.model.setOptions(Rt(Ct.treemapChart,n.options)),this.init(t,n)}getComponents(){const t=[new aN(this.model,this.services)];return this.getChartComponents(t)}}class d3 extends ge{constructor(t,n){super(t,n),this.model.setOptions(Rt(Ct.simpleBarChart,n.options)),this.init(t,n)}getComponents(){const t=[new me(this.model,this.services),new Se(this.model,this.services),new jg(this.model,this.services),new oi(this.model,this.services),new ce(this.model,this.services,{skeleton:Ft.VERT_OR_HORIZ})];return this.getAxisChartComponents(t)}}class p3 extends ge{constructor(t,n){super(t,n),this.model.setOptions(Rt(Ct.stackedAreaChart,n.options)),this.init(t,n)}getComponents(){const t=[new me(this.model,this.services),new Se(this.model,this.services),new co(this.model,this.services),new Wg(this.model,this.services),new ai(this.model,this.services,{stacked:!0}),new Yg(this.model,this.services,{fadeInOnChartHolderMouseover:!0,handleThresholds:!0,stacked:!0}),new ce(this.model,this.services,{skeleton:Ft.GRID})];return this.getAxisChartComponents(t)}}class f3 extends ge{constructor(t,n){super(t,n),this.model.setOptions(Rt(Ct.stackedBarChart,n.options)),this.init(t,n)}getComponents(){const t=[new me(this.model,this.services),new Se(this.model,this.services),new co(this.model,this.services),new qg(this.model,this.services),new ce(this.model,this.services,{skeleton:Ft.VERT_OR_HORIZ}),new oi(this.model,this.services)];return this.getAxisChartComponents(t)}}class m3 extends Xe{constructor(t,n){super(t,n),this.model=new n$(this.services),this.model.setOptions(Rt(Ct.wordCloudChart,n.options)),this.init(t,n)}getComponents(){const t=[new vN(this.model,this.services),new ce(this.model,this.services,{skeleton:Ft.PIE})];return this.getChartComponents(t)}}class Dt extends ft.PureComponent{constructor(){super(...arguments);Pu(this,"chart");Pu(this,"chartRef",ft.createRef())}createChart(n,r,i){throw new Error("Method not implemented.")}componentDidMount(){this.chartRef.current&&!this.chart&&(this.chart=this.createChart(this.chartRef.current,this.props.data,this.props.options))}componentDidUpdate(n){var r,i;this.props.data!==n.data&&((r=this.chart)==null||r.model.setData(this.props.data)),this.props.options!==n.options&&((i=this.chart)==null||i.model.setOptions(this.props.options))}render(){return ft.createElement("div",{ref:this.chartRef,className:"chart-holder"})}}class g3 extends Dt{createChart(t,n,r){return new WP(t,{data:n,options:r})}}class v3 extends Dt{createChart(t,n,r){return new qP(t,{data:n,options:r})}}class y3 extends Dt{createChart(t,n,r){return new YP(t,{data:n,options:r})}}class x3 extends Dt{createChart(t,n,r){return new XP(t,{data:n,options:r})}}class b3 extends Dt{createChart(t,n,r){return new ZP(t,{data:n,options:r})}}class Pv extends Dt{createChart(t,n,r){return new KP(t,{data:n,options:r})}}class _3 extends Dt{createChart(t,n,r){return new QP(t,{data:n,options:r})}}class E3 extends Dt{createChart(t,n,r){return new JP(t,{data:n,options:r})}}class O3 extends Dt{createChart(t,n,r){return new t3(t,{data:n,options:r})}}class S3 extends Dt{createChart(t,n,r){return new e3(t,{data:n,options:r})}}class T3 extends Dt{createChart(t,n,r){return new n3(t,{data:n,options:r})}}class w3 extends Dt{createChart(t,n,r){return new r3(t,{data:n,options:r})}}class $3 extends Dt{createChart(t,n,r){return new i3(t,{data:n,options:r})}}class M3 extends Dt{createChart(t,n,r){return new s3(t,{data:n,options:r})}}class C3 extends Dt{createChart(t,n,r){return new a3(t,{data:n,options:r})}}class A3 extends Dt{createChart(t,n,r){return new o3(t,{data:n,options:r})}}class L3 extends Dt{createChart(t,n,r){return new Nv(t,{data:n,options:r})}}class k3 extends Dt{createChart(t,n,r){return new l3(t,{data:n,options:r})}}class D3 extends Dt{createChart(t,n,r){return new c3(t,{data:n,options:r})}}class R3 extends Dt{createChart(t,n,r){return new d3(t,{data:n,options:r})}}class I3 extends Dt{createChart(t,n,r){return new p3(t,{data:n,options:r})}}class N3 extends Dt{createChart(t,n,r){return new f3(t,{data:n,options:r})}}class P3 extends Dt{createChart(t,n,r){return new u3(t,{data:n,options:r})}}class U3 extends Dt{createChart(t,n,r){return new h3(t,{data:n,options:r})}}class B3 extends Dt{createChart(t,n,r){return new m3(t,{data:n,options:r})}}function H3(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Lu={exports:{}};/*!
|
|
74
74
|
Copyright (c) 2018 Jed Watson.
|
|
75
75
|
Licensed under the MIT License (MIT), see
|
|
76
76
|
http://jedwatson.github.io/classnames
|