@carbon/charts-vue 1.11.2 → 1.11.3
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/CHANGELOG.md +13 -0
- package/dist/components/CcvAlluvialChart.d.ts +1 -1
- package/dist/components/CcvAreaChart.d.ts +1 -1
- package/dist/components/CcvBoxplotChart.d.ts +1 -1
- package/dist/components/CcvBubbleChart.d.ts +1 -1
- package/dist/components/CcvBulletChart.d.ts +1 -1
- package/dist/components/CcvChoroplethChart.d.ts +1 -1
- package/dist/components/CcvCirclePackChart.d.ts +1 -1
- package/dist/components/CcvComboChart.d.ts +1 -1
- package/dist/components/CcvDonutChart.d.ts +1 -1
- package/dist/components/CcvGaugeChart.d.ts +1 -1
- package/dist/components/CcvGroupedBarChart.d.ts +1 -1
- package/dist/components/CcvHeatmapChart.d.ts +1 -1
- package/dist/components/CcvHistogramChart.d.ts +1 -1
- package/dist/components/CcvLineChart.d.ts +1 -1
- package/dist/components/CcvLollipopChart.d.ts +1 -1
- package/dist/components/CcvMeterChart.d.ts +1 -1
- package/dist/components/CcvPieChart.d.ts +1 -1
- package/dist/components/CcvRadarChart.d.ts +1 -1
- package/dist/components/CcvScatterChart.d.ts +1 -1
- package/dist/components/CcvSimpleBarChart.d.ts +1 -1
- package/dist/components/CcvStackedAreaChart.d.ts +1 -1
- package/dist/components/CcvStackedBarChart.d.ts +1 -1
- package/dist/components/CcvTreeChart.d.ts +1 -1
- package/dist/components/CcvTreemapChart.d.ts +1 -1
- package/dist/components/CcvWordCloudChart.d.ts +1 -1
- package/dist/components/chartFactory.d.ts +1 -1
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +19 -18
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
<circle cx="16" cy="16" r="2"></circle>
|
|
12
12
|
<circle cx="16" cy="24" r="2"></circle>`},clickFunction:t=>this.toggleOverflowMenu(t)}}getControlConfigByType(t){const n=this.services.zoom&&this.services.zoom.isZoomBarEnabled()&&!this.services.zoom.isEmptyState(),i=this.model.getDisplayData();let r;switch(t){case $t.ZOOM_IN:n&&(r={id:"toolbar-zoomIn",title:"Zoom in",shouldBeDisabled:()=>this.services.zoom.isMinZoomDomain(),iconSVG:{content:this.getControlIconByType(t)},clickFunction:()=>this.services.zoom.zoomIn()});break;case $t.ZOOM_OUT:n&&(r={id:"toolbar-zoomOut",title:"Zoom out",shouldBeDisabled:()=>this.services.zoom.isMaxZoomDomain(),iconSVG:{content:this.getControlIconByType(t)},clickFunction:()=>this.services.zoom.zoomOut()});break;case $t.RESET_ZOOM:n&&(r={id:"toolbar-resetZoom",title:"Reset zoom",shouldBeDisabled:()=>this.services.zoom.isMaxZoomDomain(),iconSVG:{content:this.getControlIconByType(t)},clickFunction:()=>this.services.zoom.resetZoomDomain()});break;case $t.MAKE_FULLSCREEN:r={id:"toolbar-makefullscreen",iconSVG:{content:this.getControlIconByType(t),width:"15px",height:"15px"},title:"Make fullscreen",shouldBeDisabled:()=>!1,clickFunction:()=>{this.services.domUtils.toggleFullscreen()}};break;case $t.SHOW_AS_DATATABLE:r={id:"toolbar-showasdatatable",iconSVG:{content:this.getControlIconByType(t)},title:"Show as table",shouldBeDisabled:()=>i.length===0,clickFunction:()=>this.services.events.dispatchEvent(C.Modal.SHOW)};break;case $t.EXPORT_CSV:r={id:"toolbar-export-CSV",title:"Export as CSV",shouldBeDisabled:()=>!1,iconSVG:{content:this.getControlIconByType(t)},clickFunction:()=>this.model.exportToCSV()};break;case $t.EXPORT_PNG:r={id:"toolbar-export-PNG",title:"Export as PNG",shouldBeDisabled:()=>!1,iconSVG:{content:this.getControlIconByType(t)},clickFunction:()=>this.services.domUtils.exportToPNG()};break;case $t.EXPORT_JPG:r={id:"toolbar-export-JPG",title:"Export as JPG",shouldBeDisabled:()=>!1,iconSVG:{content:this.getControlIconByType(t)},clickFunction:()=>this.services.domUtils.exportToJPG()};break;default:throw Error("Not supported toolbar control type: "+t)}return r}getControlIconByType(t){switch(t){case $t.ZOOM_IN:return`<polygon points="19 13 15 13 15 9 13 9 13 13 9 13 9 15 13 15 13 19 15 19 15 15 19 15 19 13"/>
|
|
13
13
|
<path d="M22.45,21A10.87,10.87,0,0,0,25,14,11,11,0,1,0,14,25a10.87,10.87,0,0,0,7-2.55L28.59,30,30,28.59ZM14,23a9,9,0,1,1,9-9A9,9,0,0,1,14,23Z"/>`;case $t.ZOOM_OUT:return`<rect x="9" y="13" width="10" height="2"/>
|
|
14
|
-
<path d="M22.45,21A10.87,10.87,0,0,0,25,14,11,11,0,1,0,14,25a10.87,10.87,0,0,0,7-2.55L28.59,30,30,28.59ZM14,23a9,9,0,1,1,9-9A9,9,0,0,1,14,23Z"/>`;case $t.RESET_ZOOM:return'<path d="M22.4478,21A10.855,10.855,0,0,0,25,14,10.99,10.99,0,0,0,6,6.4658V2H4v8h8V8H7.332a8.9768,8.9768,0,1,1-2.1,8H3.1912A11.0118,11.0118,0,0,0,14,25a10.855,10.855,0,0,0,7-2.5522L28.5859,30,30,28.5859Z"/>';case $t.MAKE_FULLSCREEN:return'<polygon points="21 2 21 4 26.59 4 17 13.58 18.41 15 28 5.41 28 11 30 11 30 2 21 2"/><polygon points="15 18.42 13.59 17 4 26.59 4 21 2 21 2 30 11 30 11 28 5.41 28 15 18.42"/>';case $t.SHOW_AS_DATATABLE:return'<rect x="4" y="6" width="18" height="2"/><rect x="4" y="12" width="18" height="2"/><rect x="4" y="18" width="18" height="2"/><rect x="4" y="24" width="18" height="2"/><rect x="26" y="6" width="2" height="2"/><rect x="26" y="12" width="2" height="2"/><rect x="26" y="18" width="2" height="2"/><rect x="26" y="24" width="2" height="2"/>';case $t.EXPORT_CSV:return'<path d="M22.4478,21A10.855,10.855,0,0,0,25,14,10.99,10.99,0,0,0,6,6.4658V2H4v8h8V8H7.332a8.9768,8.9768,0,1,1-2.1,8H3.1912A11.0118,11.0118,0,0,0,14,25a10.855,10.855,0,0,0,7-2.5522L28.5859,30,30,28.5859Z"/>';case $t.EXPORT_JPG:return'<path d="M22.4478,21A10.855,10.855,0,0,0,25,14,10.99,10.99,0,0,0,6,6.4658V2H4v8h8V8H7.332a8.9768,8.9768,0,1,1-2.1,8H3.1912A11.0118,11.0118,0,0,0,14,25a10.855,10.855,0,0,0,7-2.5522L28.5859,30,30,28.5859Z"/>';case $t.EXPORT_PNG:return'<path d="M22.4478,21A10.855,10.855,0,0,0,25,14,10.99,10.99,0,0,0,6,6.4658V2H4v8h8V8H7.332a8.9768,8.9768,0,1,1-2.1,8H3.1912A11.0118,11.0118,0,0,0,14,25a10.855,10.855,0,0,0,7-2.5522L28.5859,30,30,28.5859Z"/>';default:throw Error("Not supported toolbar control type: "+t)}}};let kr=Og;kr.buttonID=0;const Tg=class extends ht{constructor(t,n,i,r){super(t,n,r),this.type="layout",this.configs=r,this.children=i,this._instanceID=Tg.instanceID++,this.init()}init(){this.children.forEach(t=>{t.components.forEach(n=>{n.init()})})}getPreferedAndFixedSizeSum(){const t=this.parent;let n=0;return t.selectAll(`div.layout-child-${this._instanceID}`).filter(i=>{const r=E(i,"growth");return r===it.PREFERRED||r===it.FIXED}).each(function(i){n+=i.size}),n}getNumOfStretchChildren(){return this.parent.selectAll(`div.layout-child-${this._instanceID}`).filter(t=>E(t,"growth")===it.STRETCH).size()}render(t=!0){const n=this.parent,{width:i,height:r}=R.getHTMLElementSize(n.node()),s=this.configs.direction===Et.ROW||this.configs.direction===Et.ROW_REVERSE,a=E(this.model.getOptions(),"style","prefix"),o=n.classed(`${ne}--${a}--layout-row`,this.configs.direction===Et.ROW).classed(`${ne}--${a}--layout-row-reverse`,this.configs.direction===Et.ROW_REVERSE).classed(`${ne}--${a}--layout-column`,this.configs.direction===Et.COLUMN).classed(`${ne}--${a}--layout-column-reverse`,this.configs.direction===Et.COLUMN_REVERSE).classed(`${ne}--${a}--layout-alignitems-center`,this.configs.alignItems===hi.CENTER).selectAll(`div.layout-child-${this._instanceID}`).data(this.children,l=>l.id);o.enter().append("div").merge(n.selectAll(`div.layout-child-${this._instanceID}`)).attr("class",l=>`layout-child layout-child-${this._instanceID} ${l.id}`).each(function(l){l.components.forEach(u=>{const h=P(this),d=E(l,"renderType")===K.SVG;u.setParent(d?R.appendOrSelect(h,"svg.layout-svg-wrapper").attr("width","100%").attr("height","100%"):h);const f=E(l,"growth");(f===it.PREFERRED||f===it.FIXED)&&u.render(t)})}),n.selectAll(`div.layout-child-${this._instanceID}`).style("height",null).style("width",null).each(function(l){const u=E(l,"growth"),h=E(l,"renderType")===K.SVG?R.getSVGElementSize(P(this).select("svg.layout-svg-wrapper"),{useBBox:!0}):R.getHTMLElementSize(this);if(u===it.PREFERRED){const d=s?h.width:h.height,f=s?i:r;l.size=d/f*100}}),o.exit().remove(),this.children.filter(l=>E(l,"growth")===it.STRETCH).forEach(l=>{l.size=(100-+this.getPreferedAndFixedSizeSum())/+this.getNumOfStretchChildren()});const c=n.selectAll(`div.layout-child-${this._instanceID}`).data(this.children,l=>l.id);s?c.style("width",l=>`${l.size/100*i}px`).style("height","100%"):c.style("height",l=>`${l.size/100*r}px`).style("width","100%"),c.each(function(l){l.components.forEach(u=>{E(l,"growth")===it.STRETCH&&u.render(t)})})}setModel(t){super.setModel(t),this.children.forEach(n=>{n.components.forEach(i=>i.setModel(t))})}setServices(t){super.setServices(t),this.children.forEach(n=>{n.components.forEach(i=>i.setServices(t))})}destroy(){this.children.forEach(t=>{t.components.forEach(n=>n.destroy())})}};let ie=Tg;ie.instanceID=Math.floor(Math.random()*99999999999);class on extends ht{constructor(){super(...arguments),this.type="spacer"}render(t=!
|
|
14
|
+
<path d="M22.45,21A10.87,10.87,0,0,0,25,14,11,11,0,1,0,14,25a10.87,10.87,0,0,0,7-2.55L28.59,30,30,28.59ZM14,23a9,9,0,1,1,9-9A9,9,0,0,1,14,23Z"/>`;case $t.RESET_ZOOM:return'<path d="M22.4478,21A10.855,10.855,0,0,0,25,14,10.99,10.99,0,0,0,6,6.4658V2H4v8h8V8H7.332a8.9768,8.9768,0,1,1-2.1,8H3.1912A11.0118,11.0118,0,0,0,14,25a10.855,10.855,0,0,0,7-2.5522L28.5859,30,30,28.5859Z"/>';case $t.MAKE_FULLSCREEN:return'<polygon points="21 2 21 4 26.59 4 17 13.58 18.41 15 28 5.41 28 11 30 11 30 2 21 2"/><polygon points="15 18.42 13.59 17 4 26.59 4 21 2 21 2 30 11 30 11 28 5.41 28 15 18.42"/>';case $t.SHOW_AS_DATATABLE:return'<rect x="4" y="6" width="18" height="2"/><rect x="4" y="12" width="18" height="2"/><rect x="4" y="18" width="18" height="2"/><rect x="4" y="24" width="18" height="2"/><rect x="26" y="6" width="2" height="2"/><rect x="26" y="12" width="2" height="2"/><rect x="26" y="18" width="2" height="2"/><rect x="26" y="24" width="2" height="2"/>';case $t.EXPORT_CSV:return'<path d="M22.4478,21A10.855,10.855,0,0,0,25,14,10.99,10.99,0,0,0,6,6.4658V2H4v8h8V8H7.332a8.9768,8.9768,0,1,1-2.1,8H3.1912A11.0118,11.0118,0,0,0,14,25a10.855,10.855,0,0,0,7-2.5522L28.5859,30,30,28.5859Z"/>';case $t.EXPORT_JPG:return'<path d="M22.4478,21A10.855,10.855,0,0,0,25,14,10.99,10.99,0,0,0,6,6.4658V2H4v8h8V8H7.332a8.9768,8.9768,0,1,1-2.1,8H3.1912A11.0118,11.0118,0,0,0,14,25a10.855,10.855,0,0,0,7-2.5522L28.5859,30,30,28.5859Z"/>';case $t.EXPORT_PNG:return'<path d="M22.4478,21A10.855,10.855,0,0,0,25,14,10.99,10.99,0,0,0,6,6.4658V2H4v8h8V8H7.332a8.9768,8.9768,0,1,1-2.1,8H3.1912A11.0118,11.0118,0,0,0,14,25a10.855,10.855,0,0,0,7-2.5522L28.5859,30,30,28.5859Z"/>';default:throw Error("Not supported toolbar control type: "+t)}}};let kr=Og;kr.buttonID=0;const Tg=class extends ht{constructor(t,n,i,r){super(t,n,r),this.type="layout",this.configs=r,this.children=i,this._instanceID=Tg.instanceID++,this.init()}init(){this.children.forEach(t=>{t.components.forEach(n=>{n.init()})})}getPreferedAndFixedSizeSum(){const t=this.parent;let n=0;return t.selectAll(`div.layout-child-${this._instanceID}`).filter(i=>{const r=E(i,"growth");return r===it.PREFERRED||r===it.FIXED}).each(function(i){n+=i.size}),n}getNumOfStretchChildren(){return this.parent.selectAll(`div.layout-child-${this._instanceID}`).filter(t=>E(t,"growth")===it.STRETCH).size()}render(t=!0){const n=this.parent,{width:i,height:r}=R.getHTMLElementSize(n.node()),s=this.configs.direction===Et.ROW||this.configs.direction===Et.ROW_REVERSE,a=E(this.model.getOptions(),"style","prefix"),o=n.classed(`${ne}--${a}--layout-row`,this.configs.direction===Et.ROW).classed(`${ne}--${a}--layout-row-reverse`,this.configs.direction===Et.ROW_REVERSE).classed(`${ne}--${a}--layout-column`,this.configs.direction===Et.COLUMN).classed(`${ne}--${a}--layout-column-reverse`,this.configs.direction===Et.COLUMN_REVERSE).classed(`${ne}--${a}--layout-alignitems-center`,this.configs.alignItems===hi.CENTER).selectAll(`div.layout-child-${this._instanceID}`).data(this.children,l=>l.id);o.enter().append("div").merge(n.selectAll(`div.layout-child-${this._instanceID}`)).attr("class",l=>`layout-child layout-child-${this._instanceID} ${l.id}`).each(function(l){l.components.forEach(u=>{const h=P(this),d=E(l,"renderType")===K.SVG;u.setParent(d?R.appendOrSelect(h,"svg.layout-svg-wrapper").attr("width","100%").attr("height","100%"):h);const f=E(l,"growth");(f===it.PREFERRED||f===it.FIXED)&&u.render(t)})}),n.selectAll(`div.layout-child-${this._instanceID}`).style("height",null).style("width",null).each(function(l){const u=E(l,"growth"),h=E(l,"renderType")===K.SVG?R.getSVGElementSize(P(this).select("svg.layout-svg-wrapper"),{useBBox:!0}):R.getHTMLElementSize(this);if(u===it.PREFERRED){const d=s?h.width:h.height,f=s?i:r;l.size=d/f*100}}),o.exit().remove(),this.children.filter(l=>E(l,"growth")===it.STRETCH).forEach(l=>{l.size=(100-+this.getPreferedAndFixedSizeSum())/+this.getNumOfStretchChildren()});const c=n.selectAll(`div.layout-child-${this._instanceID}`).data(this.children,l=>l.id);s?c.style("width",l=>`${l.size/100*i}px`).style("height","100%"):c.style("height",l=>`${l.size/100*r}px`).style("width","100%"),c.each(function(l){l.components.forEach(u=>{E(l,"growth")===it.STRETCH&&u.render(t)})})}setModel(t){super.setModel(t),this.children.forEach(n=>{n.components.forEach(i=>i.setModel(t))})}setServices(t){super.setServices(t),this.children.forEach(n=>{n.components.forEach(i=>i.setServices(t))})}destroy(){this.children.forEach(t=>{t.components.forEach(n=>n.destroy())})}};let ie=Tg;ie.instanceID=Math.floor(Math.random()*99999999999);class on extends ht{constructor(){super(...arguments),this.type="spacer"}render(t=!1){this.getComponentContainer().style("width",`${this.configs.size||mf.default.size}px`).style("height",`${this.configs.size||mf.default.size}px`).attr("opacity",0)}}var fD={prefix:"bx",selectorTabbable:`
|
|
15
15
|
a[href], area[href], input:not([disabled]):not([tabindex='-1']),
|
|
16
16
|
button:not([disabled]):not([tabindex='-1']),select:not([disabled]):not([tabindex='-1']),
|
|
17
17
|
textarea:not([disabled]):not([tabindex='-1']),
|
|
@@ -59,7 +59,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
59
59
|
<div class="${ne}--${n}-modal-footer-spacer"></div>
|
|
60
60
|
<button class="cds--btn cds--btn--primary cds--btn cds--btn--primary" type="button" data-modal-primary-focus>Download as CSV</button>
|
|
61
61
|
</div>
|
|
62
|
-
</div>`}render(t=!0){const n=this.model.getOptions();if(!this.isEventListenerAdded){const i=P(this.services.domUtils.getHolder()),r=E(n,"style","prefix");this.modal=R.appendOrSelect(i,`div.${ne}--${r}--modal`),this.addEventListeners(),this.isEventListenerAdded=!0,this.modal.attr("data-modal",!0).attr("class","cds--modal cds--modal").attr("role","dialog").attr("aria-modal",!0).attr("aria-labelledby","modal-title").attr("aria-describedby","modal-description").attr("tabindex",-1)}}destroy(){this.removeEventListeners(),this.isEventListenerAdded=!1}}class Ir extends ht{constructor(){super(...arguments),this.type="title",this.renderType=K.HTML}render(t=!0){const n=this.getComponentContainer(),i=E(this.getOptions(),"title"),r=n.selectAll("p.title").data([i]);if(r.enter().append("p").classed("title",!0).attr("role","heading").attr("aria-level",2).merge(r).html(s=>s),r.node()&&r.node().offsetWidth<r.node().scrollWidth){const s=this;r.on("mouseover",function(a){s.services.events.dispatchEvent(C.Tooltip.SHOW,{event:a,hoveredElement:r,content:r.text()})}).on("mousemove",function(a){s.services.events.dispatchEvent(C.Tooltip.MOVE,{event:a})}).on("mouseout",function(){s.services.events.dispatchEvent(C.Tooltip.HIDE)})}r.exit().remove()}truncateTitle(t,n){if(n<=0)return;const i=t.text();if(t.node().getComputedTextLength()>n){t.append("tspan").text("...");const r=R.appendOrSelect(t,"tspan").node().getComputedTextLength(),s=t.text(),a=this.getSubstringIndex(t.node(),0,s.length-1,n-r);t.html(s.substring(0,a-1)).append("tspan").text("...");const o=this;t.on("mouseover",function(c){o.services.events.dispatchEvent(C.Tooltip.SHOW,{event:c,hoveredElement:t,content:i})}).on("mousemove",function(c){o.services.events.dispatchEvent(C.Tooltip.MOVE,{event:c})}).on("mouseout",function(){o.services.events.dispatchEvent(C.Tooltip.HIDE)})}}getMaxTitleWidth(){return R.getSVGElementSize(this.parent.node(),{useAttrs:!0}).width}getSubstringIndex(t,n,i,r){const s=Math.floor((i+n)/2);return t.getSubStringLength(0,s)>r?this.getSubstringIndex(t,n,s,r):t.getSubStringLength(0,s)<r?t.getSubStringLength(0,s+1)>r?s:this.getSubstringIndex(t,s,i,r):s}}class pc extends ht{constructor(){super(...arguments),this.type="legend",this.renderType=K.HTML}render(t=!0){const n=this.getOptions(),i=E(n,"legend"),r=E(i,"alignment"),s=E(n,"legend","orientation");let a=this.model.getDataGroups();const{DISABLED:o}=Lt.items.status,c=a.some(b=>b.status===o),l=E(i,"order"),u=this.getComponentContainer().classed("center-aligned",r===It.CENTER).classed("right-aligned",r===It.RIGHT).classed(s,!0).classed("has-deactivated-items",c).attr("role",at.GROUP).attr("aria-label","Data groups").attr("data-name","legend-items");l&&(a=this.sortDataGroups(a,l));const h=u.selectAll("div.legend-item").data(a,b=>b.name),d=h.enter().append("div").attr("class","legend-item");d.merge(u.selectAll("div.legend-item")).classed("active",function(b){return b.status===Lt.items.status.ACTIVE});const f=E(this.getOptions(),"legend","clickable");u.classed("clickable",f&&a.length>1);const p=Lt.checkbox.radius,m=d.append("div").classed("checkbox",!0),g=m.merge(h.select("div.checkbox")).attr("role",at.CHECKBOX).attr("tabindex",f?0:-1).attr("aria-labelledby",(b,w)=>this.services.domUtils.generateElementIDString(`legend-datagroup-${w}-title`)).attr("aria-checked",({status:b})=>b===Lt.items.status.ACTIVE).attr("width",p*2).attr("height",p*2).attr("class",b=>this.model.getColorClassName({classNameTypes:[J.BACKGROUND],dataGroupName:b.name,originalClassName:"checkbox"})).style("background",b=>b.status===Lt.items.status.ACTIVE?this.model.getFillColor(b.name)||this.model.getStrokeColor(b.name):null).classed("active",function(b){return b.status===Lt.items.status.ACTIVE});m.append("svg").attr("focusable",!1).attr("preserveAspectRatio","xMidYMid meet").attr("xmlns","http://www.w3.org/2000/svg").attr("width","11").attr("height","11").attr("viewBox","0 0 31 28").attr("aria-hidden",!0).style("will-change","transform").append("path").attr("d","M13 21.2l-7.1-7.1-1.4 1.4 7.1 7.1L13 24 27.1 9.9l-1.4-1.5z"),d.append("p").merge(h.select("p"));const v=E(n,"legend","additionalItems");if(v&&a.length){const b=this,w=u.selectAll("div.additional-item").data(v);w.exit().remove();const O=w.enter().append("div").merge(w).classed("legend-item",!0).classed("additional",!0).attr("aria-labelledby",(S,$)=>this.services.domUtils.generateElementIDString(`legend-datagroup-${g.size()+$}-title`));O.selectAll("*").remove();let _,T=1;O.append("svg").classed("icon",!0).each(function(S){const $=P(this);!_||_!=S.type?(_=S.type,T=1):T++,b.addAdditionalItem($,S,T)}),O.append("p").merge(O.select("p")),this.truncateLegendText()}h.exit().on("mouseover",null).on("click",null).on("mouseout",null).remove(),f&&d.size()>1&&this.addEventListeners()}sortDataGroups(t,n){if(t.sort((i,r)=>n.indexOf(i.name)-n.indexOf(r.name)),n.length<t.length){const i=t.length-n.length;return t.slice(i).concat(t.slice(0,i))}return t}addAdditionalItem(t,n,i){const{width:r,height:s}=Lt.area;if(n.type===Nt.RADIUS?t.style("width",`${s}px`).style("height",`${s}px`):t.style("width",`${r}px`).style("height",`${s}px`),n.type===Nt.RADIUS){const{iconData:a,fill:o,stroke:c}=Lt.radius;t.attr("fill","none").selectAll("circle").data(a).enter().append("circle").classed("radius",!0).attr("role",at.IMG).attr("aria-label","radius").attr("cx",l=>l.cx).attr("cy",l=>l.cy).attr("r",l=>l.r).style("fill",n.fill?n.fill:o).style("stroke",n.stroke?n.stroke:c)}else if(n.type===Nt.LINE){const a=Lt.line;t.select("line.line").empty()&&t.append("line").classed(`line-${i}`,!0).attr("role",at.IMG).attr("aria-label","line").attr("x1",0).attr("y1",a.yPosition).attr("x2",r).attr("y2",a.yPosition).style("stroke",n.stroke?n.stroke:a.stroke).style("stroke-width",a.strokeWidth)}else if(n.type===Nt.AREA)t.select("rect.area").empty()&&t.append("rect").classed(`area-${i}`,!0).attr("role",at.IMG).attr("aria-label","area").attr("width",r).attr("height",s).style("fill",i>3&&!n.fill?Lt.area.fill:n.fill).style("stroke",n.stroke);else if(n.type===Nt.SIZE){const{iconData:a,fill:o,stroke:c}=Lt.size;t.attr("fill","none").attr("role",at.IMG).attr("aria-label","size").selectAll("rect").data(a).enter().append("rect").classed("size",!0).attr("width",l=>l.width).attr("height",l=>l.height).attr("y",()=>0).style("fill",n.fill?n.fill:o).style("stroke",n.stroke?n.stroke:c).style("stroke-width",1)}else if(n.type===Nt.QUARTILE){const{iconData:a}=Lt.quartile;t.selectAll("rect").attr("role",at.IMG).attr("aria-label","quartile").data(a).enter().append("rect").attr("class",(o,c)=>`quartile-${c===0?"wrapper":"line"}`).attr("x",o=>o.x).attr("y",o=>o.y).attr("width",o=>o.width).attr("height",o=>o.height)}else if(n.type===Nt.ZOOM){const{iconData:a,color:o}=E(Lt,"zoom"),c=t.attr("role",at.IMG).attr("aria-label","zoom").selectAll("g.icon").data(a).enter();c.append("g").attr("x",l=>l.x).attr("y",l=>l.y).attr("width",l=>l.width).attr("height",l=>l.height).append("polygon").attr("points","7.7 4.82 5.78 4.82 5.78 2.89 4.82 2.89 4.82 4.82 2.89 4.82 2.89 5.78 4.82 5.78 4.82 7.7 5.78 7.7 5.78 5.78 7.7 5.78 7.7 4.82").attr("fill",()=>n.color?n.color:o),c.append("path").attr("d","M9.36,8.67A5.22,5.22,0,0,0,10.59,5.3,5.3,5.3,0,1,0,5.3,10.59,5.22,5.22,0,0,0,8.67,9.36L12.32,13l.68-.68Zm-4.06,1A4.34,4.34,0,1,1,9.63,5.3,4.33,4.33,0,0,1,5.3,9.63Z").attr("fill",()=>n.color?n.color:o)}}truncateLegendText(){const t=this.getComponentContainer(),n=E(this.getOptions(),"legend","truncation"),i=E(n,"type"),r=E(n,"threshold"),s=E(n,"numCharacter"),a=t.selectAll("div.legend-item p");a.attr("id",function(){return(this.parentNode.querySelector("div.checkbox")||this.parentNode).getAttribute("aria-labelledby")}),i!==Se.NONE?a.html(function(o){return o.name.length>r?Cr(o.name,i,s):o.name}):a.html(o=>o.name)}addEventListeners(){const t=this,n=this.getComponentContainer(),i=this.getOptions(),r=E(i,"legend"),s=E(r,"truncation");n.selectAll("div.legend-item").on("mouseover",function(a){t.services.events.dispatchEvent(C.Legend.ITEM_HOVER,{hoveredElement:P(this)});const o=P(this);o.select("div.checkbox").classed("hovered",!0);const c=o.datum();c.name.length>s.threshold&&s.type!==Se.NONE&&t.services.events.dispatchEvent(C.Tooltip.SHOW,{event:a,hoveredElement:o,content:c.name})}).on("mousemove",function(a){P(this).datum().name.length>s.threshold&&s.type!==Se.NONE&&t.services.events.dispatchEvent(C.Tooltip.MOVE,{event:a})}).on("click",function(){t.services.events.dispatchEvent(C.Legend.ITEM_CLICK,{clickedElement:P(this)});const a=P(this).datum();t.model.toggleDataLabel(a.name)}).on("mouseout",function(){const a=P(this);a.select("div.checkbox").classed("hovered",!1),a.datum().name.length>s.threshold&&s.type!==Se.NONE&&t.services.events.dispatchEvent(C.Tooltip.HIDE),t.services.events.dispatchEvent(C.Legend.ITEM_MOUSEOUT,{hoveredElement:a})}),n.selectAll("div.legend-item div.checkbox").on("keyup",function(a){a.key&&a.key==="Tab"&&t.services.events.dispatchEvent(C.Legend.ITEM_HOVER,{hoveredElement:P(this)})}),n.selectAll("div.legend-item div.checkbox").on("keydown",function(a,o){a.key&&a.key===" "?(a.preventDefault(),t.model.toggleDataLabel(o.name)):a.key&&a.key==="Tab"&&t.services.events.dispatchEvent(C.Legend.ITEM_MOUSEOUT,{hoveredElement:P(this)})}),n.selectAll("g.additional-item").on("mouseover",function(a){const o=P(this),c=o.datum();c.name.length>s.threshold&&t.services.events.dispatchEvent(C.Tooltip.SHOW,{event:a,hoveredElement:o,content:c.name})})}}class Ug extends ht{constructor(t,n,i){super(t,n,i),this.type="chart-clip",this.renderType=K.SVG,this.chartClipId="chart-clip-id-"+Math.floor(Math.random()*99999999999),this.init()}init(){this.model.set({chartClipId:this.chartClipId},{skipUpdate:!0})}render(t=!0){this.createClipPath()}createClipPath(){const t=this.parent,{cartesianScales:n}=this.services;if(!n)throw new Error("Service cartesianScales was undefined");const i=n.getMainXScale(),r=n.getMainYScale(),[s,a]=i.range(),[o,c]=r.range();if(!t)throw new Error("svg is undefined");this.chartClipPath=R.appendOrSelect(t,`clipPath.${this.type}`).attr("id",this.chartClipId);const l=R.appendOrSelect(this.chartClipPath,`rect.${this.type}`);a-s>0&&l.attr("x",s).attr("y",c).attr("width",a-s).attr("height",o-c),this.chartClipPath.merge(l).lower()}}class Tk extends Ug{constructor(){super(...arguments),this.type="canvas-chart-clip",this.chartClipId="canvas-chart-clip-id-"+Math.floor(Math.random()*99999999999)}createClipPath(){const t=this.parent,{width:n,height:i}=R.getSVGElementSize(this.parent,{useAttrs:!0});this.chartClipPath=R.appendOrSelect(t,`clipPath.${this.type}`).attr("id",this.chartClipId);const r=R.appendOrSelect(this.chartClipPath,`rect.${this.type}`);r.attr("x",0).attr("y",0).attr("width",n).attr("height",i),this.chartClipPath.merge(r).lower()}}var Ti,zt;(function(e){e.LEFT="left",e.RIGHT="right",e.TOP="top",e.BOTTOM="bottom"})(zt||(zt={}));var Bg=(Ti={},Ti[zt.LEFT]=function(e,t,n){return{top:e.top-Math.round(t.offsetHeight/2)+Math.round(n.height/2),left:Math.round(e.left-t.offsetWidth)}},Ti[zt.RIGHT]=function(e,t,n){return{top:e.top-Math.round(t.offsetHeight/2)+Math.round(n.height/2),left:Math.round(e.left+n.width)}},Ti[zt.TOP]=function(e,t,n){return{top:Math.round(e.top-t.offsetHeight),left:e.left-Math.round(t.offsetWidth/2)+Math.round(n.width/2)}},Ti[zt.BOTTOM]=function(e,t,n){return{top:Math.round(e.top+n.height),left:e.left-Math.round(t.offsetWidth/2)+Math.round(n.width/2)}},Ti),Hg=typeof window<"u"?window:{innerHeight:0,scrollY:0,innerWidth:0,scrollX:0},Aa=function(){function e(t){t===void 0&&(t={}),this.positions=Bg,this.positions=Object.assign({},Bg,t)}return e.prototype.getRelativeOffset=function(t){for(var n={left:t.offsetLeft,top:t.offsetTop};t.offsetParent&&getComputedStyle(t.offsetParent).position==="static";)n.left+=t.offsetLeft,n.top+=t.offsetTop,t=t.offsetParent;return n},e.prototype.getAbsoluteOffset=function(t){for(var n=t,i={top:0,left:0};n.offsetParent;){var r=getComputedStyle(n.offsetParent);r.position==="static"&&r.marginLeft&&r.marginTop&&(parseInt(r.marginTop,10)&&(i.top+=parseInt(r.marginTop,10)),parseInt(r.marginLeft,10)&&(i.left+=parseInt(r.marginLeft,10))),n=n.offsetParent}var s=t.getBoundingClientRect(),a=document.body.getBoundingClientRect();return{top:s.top-a.top+i.top,left:s.left-a.left+i.left}},e.prototype.findRelative=function(t,n,i){var r=this.getRelativeOffset(t),s=t.getBoundingClientRect();return this.calculatePosition(r,s,n,i)},e.prototype.findAbsolute=function(t,n,i){var r=this.getAbsoluteOffset(t),s=t.getBoundingClientRect();return this.calculatePosition(r,s,n,i)},e.prototype.findPosition=function(t,n,i,r){r===void 0&&(r=this.getAbsoluteOffset.bind(this));var s=r(t),a=t.getBoundingClientRect();return this.calculatePosition(s,a,n,i)},e.prototype.findPositionAt=function(t,n,i){return this.calculatePosition(t,{top:0,left:0,height:0,width:0},n,i)},e.prototype.getPlacementBox=function(t,n){var i=t.offsetHeight+n.top,r=t.offsetWidth+n.left;return{top:n.top,bottom:i,left:n.left,right:r}},e.prototype.addOffset=function(t,n,i){return n===void 0&&(n=0),i===void 0&&(i=0),Object.assign({},t,{top:t.top+n,left:t.left+i})},e.prototype.setElement=function(t,n){t.style.top=n.top+"px",t.style.left=n.left+"px"},e.prototype.findBestPlacement=function(t,n,i,r,s){var a=this;r===void 0&&(r=this.defaultContainerFunction.bind(this)),s===void 0&&(s=this.findPosition.bind(this));var o=i.map(function(c){var l=s(t,n,c),u=a.getPlacementBox(n,l),h=0,d=0,f=r();u.top<f.top?h=f.top-u.top:u.bottom>f.height&&(h=u.bottom-f.height),u.left<f.left?d=f.left-u.left:u.right>f.width&&(d=u.right-f.width),h&&!d?d=1:d&&!h&&(h=1);var p=n.offsetHeight*n.offsetWidth,m=h*d,g=p-m,v=g/p;return{placement:c,weight:v}});return o.sort(function(c,l){return l.weight-c.weight}),o[0].placement},e.prototype.findBestPlacementAt=function(t,n,i,r){var s=this;r===void 0&&(r=this.defaultContainerFunction.bind(this));var a=function(o,c,l){return s.findPositionAt(t,c,l)};return this.findBestPlacement(null,n,i,r,a)},e.prototype.defaultContainerFunction=function(){return{top:0,left:0,height:Hg.innerHeight,width:Hg.innerWidth}},e.prototype.calculatePosition=function(t,n,i,r){return this.positions[r]?this.positions[r](t,i,n):(console.error("No function found for placement, defaulting to 0,0"),{left:0,top:0})},e}();new Aa;class gc extends ht{constructor(t,n,i){super(t,n,i),this.type="tooltip",this.renderType=K.HTML,this.isEventListenerAdded=!1,this.positionService=new Aa,this.handleShowTooltip=r=>{const s=r.detail.data||r.detail.items;let a;const o=this.formatItems(this.getItems(r));r.detail.content?a=`<div class="title-tooltip"><p>${r.detail.content}</p></div>`:a=this.getTooltipHTML(o);const c=R.appendOrSelect(this.tooltip,"div.content-box");if(E(this.getOptions(),"tooltip","customHTML"))if(r.detail.content){const l=`<div class="title-tooltip"><p>${r.detail.content}</p></div>`;c.html(l)}else c.html(this.model.getOptions().tooltip.customHTML(s,a));else c.html(a);c.selectAll(".datapoint-tooltip").each(function(l,u){const h=o[u];o[u]&&o[u].color&&P(this).select(".tooltip-color").attr("class","tooltip-color").style("background-color",h.color)}),this.positionTooltip(r),this.tooltip.classed("hidden",!1).attr("aria-hidden",!1)},this.handleHideTooltip=()=>{this.tooltip.classed("hidden",!0).attr("aria-hidden",!0)},this.init()}addTooltipEventListener(){this.services.events.addEventListener(C.Tooltip.MOVE,t=>{this.tooltip.classed("hidden")===!1&&this.positionTooltip(t)}),this.services.events.addEventListener(C.Tooltip.SHOW,this.handleShowTooltip),this.services.events.addEventListener(C.Tooltip.HIDE,this.handleHideTooltip),this.services.events.addEventListener(C.Chart.MOUSEOUT,this.handleHideTooltip)}removeTooltipEventListener(){this.services.events.removeEventListener(C.Tooltip.MOVE,null),this.services.events.removeEventListener(C.Tooltip.SHOW,this.handleShowTooltip),this.services.events.removeEventListener(C.Tooltip.HIDE,this.handleHideTooltip),this.services.events.removeEventListener(C.Chart.MOUSEOUT,this.handleHideTooltip)}getItems(t){return t.detail.items?t.detail.items:[]}formatItems(t){const n=this.getOptions(),i=E(n,"tooltip","truncation","type"),r=E(n,"tooltip","truncation","threshold"),s=E(n,"tooltip","truncation","numCharacter");return i!==Se.NONE?t.map(a=>{const o=a.labelIcon?12:0;return a.value=a.value?this.valueFormatter(a.value,a.label):a.value,a.label&&a.label.length+o>r&&(a.label=Cr(a.label,i,s)),a.value&&a.value.length>r&&(a.value=Cr(a.value,i,s)),a}):t}getTooltipHTML(t){return'<ul class="multi-tooltip">'+t.map(n=>`<li>
|
|
62
|
+
</div>`}render(t=!1){const n=this.model.getOptions();if(!this.isEventListenerAdded){const i=P(this.services.domUtils.getHolder()),r=E(n,"style","prefix");this.modal=R.appendOrSelect(i,`div.${ne}--${r}--modal`),this.addEventListeners(),this.isEventListenerAdded=!0,this.modal.attr("data-modal",!0).attr("class","cds--modal cds--modal").attr("role","dialog").attr("aria-modal",!0).attr("aria-labelledby","modal-title").attr("aria-describedby","modal-description").attr("tabindex",-1)}}destroy(){this.removeEventListeners(),this.isEventListenerAdded=!1}}class Ir extends ht{constructor(){super(...arguments),this.type="title",this.renderType=K.HTML}render(t=!1){const n=this.getComponentContainer(),i=E(this.getOptions(),"title"),r=n.selectAll("p.title").data([i]);if(r.enter().append("p").classed("title",!0).attr("role","heading").attr("aria-level",2).merge(r).html(s=>s),r.node()&&r.node().offsetWidth<r.node().scrollWidth){const s=this;r.on("mouseover",function(a){s.services.events.dispatchEvent(C.Tooltip.SHOW,{event:a,hoveredElement:r,content:r.text()})}).on("mousemove",function(a){s.services.events.dispatchEvent(C.Tooltip.MOVE,{event:a})}).on("mouseout",function(){s.services.events.dispatchEvent(C.Tooltip.HIDE)})}r.exit().remove()}truncateTitle(t,n){if(n<=0)return;const i=t.text();if(t.node().getComputedTextLength()>n){t.append("tspan").text("...");const r=R.appendOrSelect(t,"tspan").node().getComputedTextLength(),s=t.text(),a=this.getSubstringIndex(t.node(),0,s.length-1,n-r);t.html(s.substring(0,a-1)).append("tspan").text("...");const o=this;t.on("mouseover",function(c){o.services.events.dispatchEvent(C.Tooltip.SHOW,{event:c,hoveredElement:t,content:i})}).on("mousemove",function(c){o.services.events.dispatchEvent(C.Tooltip.MOVE,{event:c})}).on("mouseout",function(){o.services.events.dispatchEvent(C.Tooltip.HIDE)})}}getMaxTitleWidth(){return R.getSVGElementSize(this.parent.node(),{useAttrs:!0}).width}getSubstringIndex(t,n,i,r){const s=Math.floor((i+n)/2);return t.getSubStringLength(0,s)>r?this.getSubstringIndex(t,n,s,r):t.getSubStringLength(0,s)<r?t.getSubStringLength(0,s+1)>r?s:this.getSubstringIndex(t,s,i,r):s}}class pc extends ht{constructor(){super(...arguments),this.type="legend",this.renderType=K.HTML}render(t=!1){const n=this.getOptions(),i=E(n,"legend"),r=E(i,"alignment"),s=E(n,"legend","orientation");let a=this.model.getDataGroups();const{DISABLED:o}=Lt.items.status,c=a.some(b=>b.status===o),l=E(i,"order"),u=this.getComponentContainer().classed("center-aligned",r===It.CENTER).classed("right-aligned",r===It.RIGHT).classed(s,!0).classed("has-deactivated-items",c).attr("role",at.GROUP).attr("aria-label","Data groups").attr("data-name","legend-items");l&&(a=this.sortDataGroups(a,l));const h=u.selectAll("div.legend-item").data(a,b=>b.name),d=h.enter().append("div").attr("class","legend-item");d.merge(u.selectAll("div.legend-item")).classed("active",function(b){return b.status===Lt.items.status.ACTIVE});const f=E(this.getOptions(),"legend","clickable");u.classed("clickable",f&&a.length>1);const p=Lt.checkbox.radius,m=d.append("div").classed("checkbox",!0),g=m.merge(h.select("div.checkbox")).attr("role",at.CHECKBOX).attr("tabindex",f?0:-1).attr("aria-labelledby",(b,w)=>this.services.domUtils.generateElementIDString(`legend-datagroup-${w}-title`)).attr("aria-checked",({status:b})=>b===Lt.items.status.ACTIVE).attr("width",p*2).attr("height",p*2).attr("class",b=>this.model.getColorClassName({classNameTypes:[J.BACKGROUND],dataGroupName:b.name,originalClassName:"checkbox"})).style("background",b=>b.status===Lt.items.status.ACTIVE?this.model.getFillColor(b.name)||this.model.getStrokeColor(b.name):null).classed("active",function(b){return b.status===Lt.items.status.ACTIVE});m.append("svg").attr("focusable",!1).attr("preserveAspectRatio","xMidYMid meet").attr("xmlns","http://www.w3.org/2000/svg").attr("width","11").attr("height","11").attr("viewBox","0 0 31 28").attr("aria-hidden",!0).style("will-change","transform").append("path").attr("d","M13 21.2l-7.1-7.1-1.4 1.4 7.1 7.1L13 24 27.1 9.9l-1.4-1.5z"),d.append("p").merge(h.select("p"));const v=E(n,"legend","additionalItems");if(v&&a.length){const b=this,w=u.selectAll("div.additional-item").data(v);w.exit().remove();const O=w.enter().append("div").merge(w).classed("legend-item",!0).classed("additional",!0).attr("aria-labelledby",(S,$)=>this.services.domUtils.generateElementIDString(`legend-datagroup-${g.size()+$}-title`));O.selectAll("*").remove();let _,T=1;O.append("svg").classed("icon",!0).each(function(S){const $=P(this);!_||_!=S.type?(_=S.type,T=1):T++,b.addAdditionalItem($,S,T)}),O.append("p").merge(O.select("p")),this.truncateLegendText()}h.exit().on("mouseover",null).on("click",null).on("mouseout",null).remove(),f&&d.size()>1&&this.addEventListeners()}sortDataGroups(t,n){if(t.sort((i,r)=>n.indexOf(i.name)-n.indexOf(r.name)),n.length<t.length){const i=t.length-n.length;return t.slice(i).concat(t.slice(0,i))}return t}addAdditionalItem(t,n,i){const{width:r,height:s}=Lt.area;if(n.type===Nt.RADIUS?t.style("width",`${s}px`).style("height",`${s}px`):t.style("width",`${r}px`).style("height",`${s}px`),n.type===Nt.RADIUS){const{iconData:a,fill:o,stroke:c}=Lt.radius;t.attr("fill","none").selectAll("circle").data(a).enter().append("circle").classed("radius",!0).attr("role",at.IMG).attr("aria-label","radius").attr("cx",l=>l.cx).attr("cy",l=>l.cy).attr("r",l=>l.r).style("fill",n.fill?n.fill:o).style("stroke",n.stroke?n.stroke:c)}else if(n.type===Nt.LINE){const a=Lt.line;t.select("line.line").empty()&&t.append("line").classed(`line-${i}`,!0).attr("role",at.IMG).attr("aria-label","line").attr("x1",0).attr("y1",a.yPosition).attr("x2",r).attr("y2",a.yPosition).style("stroke",n.stroke?n.stroke:a.stroke).style("stroke-width",a.strokeWidth)}else if(n.type===Nt.AREA)t.select("rect.area").empty()&&t.append("rect").classed(`area-${i}`,!0).attr("role",at.IMG).attr("aria-label","area").attr("width",r).attr("height",s).style("fill",i>3&&!n.fill?Lt.area.fill:n.fill).style("stroke",n.stroke);else if(n.type===Nt.SIZE){const{iconData:a,fill:o,stroke:c}=Lt.size;t.attr("fill","none").attr("role",at.IMG).attr("aria-label","size").selectAll("rect").data(a).enter().append("rect").classed("size",!0).attr("width",l=>l.width).attr("height",l=>l.height).attr("y",()=>0).style("fill",n.fill?n.fill:o).style("stroke",n.stroke?n.stroke:c).style("stroke-width",1)}else if(n.type===Nt.QUARTILE){const{iconData:a}=Lt.quartile;t.selectAll("rect").attr("role",at.IMG).attr("aria-label","quartile").data(a).enter().append("rect").attr("class",(o,c)=>`quartile-${c===0?"wrapper":"line"}`).attr("x",o=>o.x).attr("y",o=>o.y).attr("width",o=>o.width).attr("height",o=>o.height)}else if(n.type===Nt.ZOOM){const{iconData:a,color:o}=E(Lt,"zoom"),c=t.attr("role",at.IMG).attr("aria-label","zoom").selectAll("g.icon").data(a).enter();c.append("g").attr("x",l=>l.x).attr("y",l=>l.y).attr("width",l=>l.width).attr("height",l=>l.height).append("polygon").attr("points","7.7 4.82 5.78 4.82 5.78 2.89 4.82 2.89 4.82 4.82 2.89 4.82 2.89 5.78 4.82 5.78 4.82 7.7 5.78 7.7 5.78 5.78 7.7 5.78 7.7 4.82").attr("fill",()=>n.color?n.color:o),c.append("path").attr("d","M9.36,8.67A5.22,5.22,0,0,0,10.59,5.3,5.3,5.3,0,1,0,5.3,10.59,5.22,5.22,0,0,0,8.67,9.36L12.32,13l.68-.68Zm-4.06,1A4.34,4.34,0,1,1,9.63,5.3,4.33,4.33,0,0,1,5.3,9.63Z").attr("fill",()=>n.color?n.color:o)}}truncateLegendText(){const t=this.getComponentContainer(),n=E(this.getOptions(),"legend","truncation"),i=E(n,"type"),r=E(n,"threshold"),s=E(n,"numCharacter"),a=t.selectAll("div.legend-item p");a.attr("id",function(){return(this.parentNode.querySelector("div.checkbox")||this.parentNode).getAttribute("aria-labelledby")}),i!==Se.NONE?a.html(function(o){return o.name.length>r?Cr(o.name,i,s):o.name}):a.html(o=>o.name)}addEventListeners(){const t=this,n=this.getComponentContainer(),i=this.getOptions(),r=E(i,"legend"),s=E(r,"truncation");n.selectAll("div.legend-item").on("mouseover",function(a){t.services.events.dispatchEvent(C.Legend.ITEM_HOVER,{hoveredElement:P(this)});const o=P(this);o.select("div.checkbox").classed("hovered",!0);const c=o.datum();c.name.length>s.threshold&&s.type!==Se.NONE&&t.services.events.dispatchEvent(C.Tooltip.SHOW,{event:a,hoveredElement:o,content:c.name})}).on("mousemove",function(a){P(this).datum().name.length>s.threshold&&s.type!==Se.NONE&&t.services.events.dispatchEvent(C.Tooltip.MOVE,{event:a})}).on("click",function(){t.services.events.dispatchEvent(C.Legend.ITEM_CLICK,{clickedElement:P(this)});const a=P(this).datum();t.model.toggleDataLabel(a.name)}).on("mouseout",function(){const a=P(this);a.select("div.checkbox").classed("hovered",!1),a.datum().name.length>s.threshold&&s.type!==Se.NONE&&t.services.events.dispatchEvent(C.Tooltip.HIDE),t.services.events.dispatchEvent(C.Legend.ITEM_MOUSEOUT,{hoveredElement:a})}),n.selectAll("div.legend-item div.checkbox").on("keyup",function(a){a.key&&a.key==="Tab"&&t.services.events.dispatchEvent(C.Legend.ITEM_HOVER,{hoveredElement:P(this)})}),n.selectAll("div.legend-item div.checkbox").on("keydown",function(a,o){a.key&&a.key===" "?(a.preventDefault(),t.model.toggleDataLabel(o.name)):a.key&&a.key==="Tab"&&t.services.events.dispatchEvent(C.Legend.ITEM_MOUSEOUT,{hoveredElement:P(this)})}),n.selectAll("g.additional-item").on("mouseover",function(a){const o=P(this),c=o.datum();c.name.length>s.threshold&&t.services.events.dispatchEvent(C.Tooltip.SHOW,{event:a,hoveredElement:o,content:c.name})})}}class Ug extends ht{constructor(t,n,i){super(t,n,i),this.type="chart-clip",this.renderType=K.SVG,this.chartClipId="chart-clip-id-"+Math.floor(Math.random()*99999999999),this.init()}init(){this.model.set({chartClipId:this.chartClipId},{skipUpdate:!0})}render(t=!0){this.createClipPath()}createClipPath(){const t=this.parent,{cartesianScales:n}=this.services;if(!n)throw new Error("Service cartesianScales was undefined");const i=n.getMainXScale(),r=n.getMainYScale(),[s,a]=i.range(),[o,c]=r.range();if(!t)throw new Error("svg is undefined");this.chartClipPath=R.appendOrSelect(t,`clipPath.${this.type}`).attr("id",this.chartClipId);const l=R.appendOrSelect(this.chartClipPath,`rect.${this.type}`);a-s>0&&l.attr("x",s).attr("y",c).attr("width",a-s).attr("height",o-c),this.chartClipPath.merge(l).lower()}}class Tk extends Ug{constructor(){super(...arguments),this.type="canvas-chart-clip",this.chartClipId="canvas-chart-clip-id-"+Math.floor(Math.random()*99999999999)}createClipPath(){const t=this.parent,{width:n,height:i}=R.getSVGElementSize(this.parent,{useAttrs:!0});this.chartClipPath=R.appendOrSelect(t,`clipPath.${this.type}`).attr("id",this.chartClipId);const r=R.appendOrSelect(this.chartClipPath,`rect.${this.type}`);r.attr("x",0).attr("y",0).attr("width",n).attr("height",i),this.chartClipPath.merge(r).lower()}}var Ti,zt;(function(e){e.LEFT="left",e.RIGHT="right",e.TOP="top",e.BOTTOM="bottom"})(zt||(zt={}));var Bg=(Ti={},Ti[zt.LEFT]=function(e,t,n){return{top:e.top-Math.round(t.offsetHeight/2)+Math.round(n.height/2),left:Math.round(e.left-t.offsetWidth)}},Ti[zt.RIGHT]=function(e,t,n){return{top:e.top-Math.round(t.offsetHeight/2)+Math.round(n.height/2),left:Math.round(e.left+n.width)}},Ti[zt.TOP]=function(e,t,n){return{top:Math.round(e.top-t.offsetHeight),left:e.left-Math.round(t.offsetWidth/2)+Math.round(n.width/2)}},Ti[zt.BOTTOM]=function(e,t,n){return{top:Math.round(e.top+n.height),left:e.left-Math.round(t.offsetWidth/2)+Math.round(n.width/2)}},Ti),Hg=typeof window<"u"?window:{innerHeight:0,scrollY:0,innerWidth:0,scrollX:0},Aa=function(){function e(t){t===void 0&&(t={}),this.positions=Bg,this.positions=Object.assign({},Bg,t)}return e.prototype.getRelativeOffset=function(t){for(var n={left:t.offsetLeft,top:t.offsetTop};t.offsetParent&&getComputedStyle(t.offsetParent).position==="static";)n.left+=t.offsetLeft,n.top+=t.offsetTop,t=t.offsetParent;return n},e.prototype.getAbsoluteOffset=function(t){for(var n=t,i={top:0,left:0};n.offsetParent;){var r=getComputedStyle(n.offsetParent);r.position==="static"&&r.marginLeft&&r.marginTop&&(parseInt(r.marginTop,10)&&(i.top+=parseInt(r.marginTop,10)),parseInt(r.marginLeft,10)&&(i.left+=parseInt(r.marginLeft,10))),n=n.offsetParent}var s=t.getBoundingClientRect(),a=document.body.getBoundingClientRect();return{top:s.top-a.top+i.top,left:s.left-a.left+i.left}},e.prototype.findRelative=function(t,n,i){var r=this.getRelativeOffset(t),s=t.getBoundingClientRect();return this.calculatePosition(r,s,n,i)},e.prototype.findAbsolute=function(t,n,i){var r=this.getAbsoluteOffset(t),s=t.getBoundingClientRect();return this.calculatePosition(r,s,n,i)},e.prototype.findPosition=function(t,n,i,r){r===void 0&&(r=this.getAbsoluteOffset.bind(this));var s=r(t),a=t.getBoundingClientRect();return this.calculatePosition(s,a,n,i)},e.prototype.findPositionAt=function(t,n,i){return this.calculatePosition(t,{top:0,left:0,height:0,width:0},n,i)},e.prototype.getPlacementBox=function(t,n){var i=t.offsetHeight+n.top,r=t.offsetWidth+n.left;return{top:n.top,bottom:i,left:n.left,right:r}},e.prototype.addOffset=function(t,n,i){return n===void 0&&(n=0),i===void 0&&(i=0),Object.assign({},t,{top:t.top+n,left:t.left+i})},e.prototype.setElement=function(t,n){t.style.top=n.top+"px",t.style.left=n.left+"px"},e.prototype.findBestPlacement=function(t,n,i,r,s){var a=this;r===void 0&&(r=this.defaultContainerFunction.bind(this)),s===void 0&&(s=this.findPosition.bind(this));var o=i.map(function(c){var l=s(t,n,c),u=a.getPlacementBox(n,l),h=0,d=0,f=r();u.top<f.top?h=f.top-u.top:u.bottom>f.height&&(h=u.bottom-f.height),u.left<f.left?d=f.left-u.left:u.right>f.width&&(d=u.right-f.width),h&&!d?d=1:d&&!h&&(h=1);var p=n.offsetHeight*n.offsetWidth,m=h*d,g=p-m,v=g/p;return{placement:c,weight:v}});return o.sort(function(c,l){return l.weight-c.weight}),o[0].placement},e.prototype.findBestPlacementAt=function(t,n,i,r){var s=this;r===void 0&&(r=this.defaultContainerFunction.bind(this));var a=function(o,c,l){return s.findPositionAt(t,c,l)};return this.findBestPlacement(null,n,i,r,a)},e.prototype.defaultContainerFunction=function(){return{top:0,left:0,height:Hg.innerHeight,width:Hg.innerWidth}},e.prototype.calculatePosition=function(t,n,i,r){return this.positions[r]?this.positions[r](t,i,n):(console.error("No function found for placement, defaulting to 0,0"),{left:0,top:0})},e}();new Aa;class gc extends ht{constructor(t,n,i){super(t,n,i),this.type="tooltip",this.renderType=K.HTML,this.isEventListenerAdded=!1,this.positionService=new Aa,this.handleShowTooltip=r=>{const s=r.detail.data||r.detail.items;let a;const o=this.formatItems(this.getItems(r));r.detail.content?a=`<div class="title-tooltip"><p>${r.detail.content}</p></div>`:a=this.getTooltipHTML(o);const c=R.appendOrSelect(this.tooltip,"div.content-box");if(E(this.getOptions(),"tooltip","customHTML"))if(r.detail.content){const l=`<div class="title-tooltip"><p>${r.detail.content}</p></div>`;c.html(l)}else c.html(this.model.getOptions().tooltip.customHTML(s,a));else c.html(a);c.selectAll(".datapoint-tooltip").each(function(l,u){const h=o[u];o[u]&&o[u].color&&P(this).select(".tooltip-color").attr("class","tooltip-color").style("background-color",h.color)}),this.positionTooltip(r),this.tooltip.classed("hidden",!1).attr("aria-hidden",!1)},this.handleHideTooltip=()=>{this.tooltip.classed("hidden",!0).attr("aria-hidden",!0)},this.init()}addTooltipEventListener(){this.services.events.addEventListener(C.Tooltip.MOVE,t=>{this.tooltip.classed("hidden")===!1&&this.positionTooltip(t)}),this.services.events.addEventListener(C.Tooltip.SHOW,this.handleShowTooltip),this.services.events.addEventListener(C.Tooltip.HIDE,this.handleHideTooltip),this.services.events.addEventListener(C.Chart.MOUSEOUT,this.handleHideTooltip)}removeTooltipEventListener(){this.services.events.removeEventListener(C.Tooltip.MOVE,null),this.services.events.removeEventListener(C.Tooltip.SHOW,this.handleShowTooltip),this.services.events.removeEventListener(C.Tooltip.HIDE,this.handleHideTooltip),this.services.events.removeEventListener(C.Chart.MOUSEOUT,this.handleHideTooltip)}getItems(t){return t.detail.items?t.detail.items:[]}formatItems(t){const n=this.getOptions(),i=E(n,"tooltip","truncation","type"),r=E(n,"tooltip","truncation","threshold"),s=E(n,"tooltip","truncation","numCharacter");return i!==Se.NONE?t.map(a=>{const o=a.labelIcon?12:0;return a.value=a.value?this.valueFormatter(a.value,a.label):a.value,a.label&&a.label.length+o>r&&(a.label=Cr(a.label,i,s)),a.value&&a.value.length>r&&(a.value=Cr(a.value,i,s)),a}):t}getTooltipHTML(t){return'<ul class="multi-tooltip">'+t.map(n=>`<li>
|
|
63
63
|
<div class="datapoint-tooltip${n.bold?" bold":""}">
|
|
64
64
|
${n.class||n.color?`<div class="tooltip-color ${n.class}"></div>`:""}
|
|
65
65
|
<div class="label">
|
|
@@ -68,17 +68,17 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
68
68
|
</div>
|
|
69
69
|
${n.value===void 0||n.value===null?"":`<p class="value"/>${n.value}</p>`}
|
|
70
70
|
</div>
|
|
71
|
-
</li>`).join("")+"</ul>"}valueFormatter(t,n){const i=this.getOptions(),r=E(i,"tooltip","valueFormatter");if(r)return r(t,n);if(typeof t.getTime=="function")return pi(t,"MMM d, yyyy");try{if(typeof t=="string"&&/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z/.test(t))return pi(Date.parse(t),"MMM d, yyyy")}catch{}return t.toLocaleString()}render(t=!0){const n=this.getOptions(),i=E(n,"tooltip","enabled");if(i){const r=P(this.services.domUtils.getHolder()),s=E(n,"style","prefix");this.tooltip=R.appendOrSelect(r,`div.${ne}--${s}--tooltip`),this.tooltip.style("max-width",null).attr("role","tooltip"),this.isEventListenerAdded||(this.addTooltipEventListener(),this.isEventListenerAdded=!0),this.tooltip.classed("hidden",!0)}else!i&&this.isEventListenerAdded&&(this.removeTooltipEventListener(),this.isEventListenerAdded=!1)}positionTooltip(t){const n=this.services.domUtils.getHolder(),i=this.tooltip.node(),r=this.getOptions(),s=E(r,"zoomBar","top","enabled");let a=E(t,"detail","mousePosition");if(!a)a=wn(E(t,"detail","event"),n);else{const d=E(r,"zoomBar","top","type"),f=ce.height[d];s&&(a[1]+=f+ce.spacerHeight)}const o=n.offsetWidth,c=n.offsetHeight;let l;a[0]/o>.9?l=zt.LEFT:a[0]/o<.1?l=zt.RIGHT:l=this.positionService.findBestPlacementAt({left:a[0],top:a[1]},i,[zt.RIGHT,zt.LEFT,zt.TOP,zt.BOTTOM],()=>({top:void 0,left:void 0,width:o,height:c}));let{horizontalOffset:u}=RS;l===zt.LEFT&&(u*=-1);const h=this.positionService.findPositionAt({left:a[0]+u,top:a[1]},i,l);this.positionService.setElement(i,h)}}const $a=class extends ht{constructor(){super(...arguments),this.type="grid-brush",this.renderType=K.SVG,this.selectionSelector="rect.selection",this.frontSelectionSelector="rect.frontSelection"}render(t=!0){const n=this.parent,i=this.getComponentContainer();if(!n)throw new Error("SVG was not defined");const r=R.appendOrSelect(n,"svg.chart-grid-backdrop"),s=R.appendOrSelect(r,`g.${this.type}`),a=R.appendOrSelect(s,this.selectionSelector),{width:o,height:c}=R.getSVGElementSize(r,{useAttrs:!0}),{cartesianScales:l}=this.services,u=l.getMainXScaleType(),h=l.getMainXScale(),[d]=h.range();i.attr("transform",`translate(${d},0)`);const f=R.appendOrSelect(i,this.frontSelectionSelector);if(h&&u===Z.TIME){let p=this.model.get("zoomDomain");p===void 0&&(p=this.services.zoom.getDefaultZoomBarDomain(),p&&this.model.set({zoomDomain:p},{animate:!1}));const m=_=>{const T=_[1]-_[0];let S="0,"+T.toString();const $=Math.floor(c/$a.DASH_LENGTH),D=$*$a.DASH_LENGTH;for(let L=0;L<$;L++)S+=","+$a.DASH_LENGTH;S+=","+(c-D),$%2===1&&(S+=",0"),S+=","+T.toString(),S+=","+c.toString(),f.attr("stroke-dasharray",S)},g=_=>{const T=_.selection;T===null||T[0]===T[1]||(f.attr("x",parseFloat(a.attr("x"))+parseFloat(r.attr("x"))).attr("y",a.attr("y")).attr("width",a.attr("width")).attr("height",a.attr("height")).style("cursor","pointer").style("display",null),m(T))},v=(_,T)=>{const S=ud().range([0,o]).domain(p);let $=[S.invert(_),S.invert(T)];$[0].valueOf()===$[1].valueOf()&&($=this.services.zoom.getDefaultZoomBarDomain()),(p[0].valueOf()!==$[0].valueOf()||p[1].valueOf()!==$[1].valueOf())&&this.services.zoom.handleDomainChange($)};let b;const w=_=>{const T=_.selection;T!==null&&(v(T[0],T[1]),s.call(b.move,null),f.style("display","none"))};c!=0&&o!=0&&(b=Mu().extent([[0,0],[o-1,c]]).on("start brush end",g).on("end.brushed",w),s.call(b));const O=this.services.zoom.getZoomRatio();r.on("click",function(_){if(_.shiftKey){const T=this.services.domUtils.getHolder(),S=wn(s.node(),T)[0];let $=S-o*O/2;$<0&&($=0);let D=S+o*O/2;D>o&&(D=o),v($,D)}})}}};let Vg=$a;Vg.DASH_LENGTH=4;class Mk extends ht{constructor(){super(...arguments),this.type="zoom-bar",this.renderType=K.SVG,this.MIN_SELECTION_DIFF=9e-10,this.brushSelector="g.zoom-bar-brush",this.clipId="zoomBarClip-"+Math.floor(Math.random()*99999999999),this.brush=Mu(),this.highlightStrokeWidth=1}init(){this.services.events.addEventListener(C.ZoomBar.UPDATE,this.render.bind(this));const t=E(this.getOptions(),"zoomBar",H.TOP,"data");this.model.setZoomBarData(t)}render(t=!0){const n=this.getComponentContainer(),i=this.services.zoom.isZoomBarLoading(H.TOP),r=this.services.zoom.isZoomBarLocked(H.TOP),s=E(this.getOptions(),"zoomBar",H.TOP,"type"),a=E(this.getOptions(),"axes",H.BOTTOM,"highlights"),o=ce.height[s],{width:c}=R.getSVGElementSize(this.parent,{useAttrs:!0});if(c===0)return;let l=0;const u=this.model.get("axesMargins");u&&u.left&&(l=u.left);const h=R.appendOrSelect(n,"svg.zoom-container").attr("width","100%").attr("height",o).attr("opacity",1);if(R.appendOrSelect(n,"rect.zoom-spacer").attr("x",0).attr("y",o).attr("width","100%").attr("height",ce.spacerHeight).attr("opacity",1).attr("fill","none"),s===Ie.GRAPH_VIEW?R.appendOrSelect(h,"rect.zoom-bg").attr("x",l).attr("y",0).attr("width",c-l).attr("height","100%").classed("zoom-bg-skeleton",i).style("stroke",i?`url(#${this.services.domUtils.generateElementIDString("shimmer-lines")})`:null):s===Ie.SLIDER_VIEW&&R.appendOrSelect(h,"rect.zoom-slider-bg").attr("x",l).attr("y",o/2-1).attr("width",c-l).attr("height",2).classed("zoom-slider-bg-skeleton",i).style("stroke",i?`url(#${this.services.domUtils.generateElementIDString("shimmer-lines")})`:null),i){this.renderSkeleton(h,l,c);return}const{cartesianScales:d}=this.services,f=d.getMainXScale(),p=d.getMainYScale(),m=d.getMainXScaleType();if(f&&m===Z.TIME){let g=this.services.zoom.getZoomBarData();if(Ce(g)||g.length===1)return;this.xScale=f.copy(),this.yScale=p.copy();const v=this.services.zoom.getDefaultZoomBarDomain(g);g=this.compensateDataForDefaultDomain(g,v);const b=this.model.get("initialZoomDomain"),w=E(this.getOptions(),"zoomBar",H.TOP,"initialZoomDomain");w&&w[0]&&w[1]&&(w[0]=new Date(w[0]),w[1]=new Date(w[1])),w&&!(b&&b[0].valueOf()===w[0].valueOf()&&b[1].valueOf()===w[1].valueOf())?this.model.set({initialZoomDomain:nt([],w),zoomDomain:w?nt([],w):v},{skipUpdate:!0}):w===null&&b!==null&&this.model.set({initialZoomDomain:null,zoomDomain:nt([],v)},{skipUpdate:!0}),this.xScale.range([l,c]).domain(v),this.maxSelectionRange=this.xScale.range(),this.yScale.range([0,o-6]).domain(ye(g,T=>T.value));const O=this.model.get("zoomDomain");if(s===Ie.GRAPH_VIEW&&(this.renderZoomBarArea(h,"path.zoom-graph-area-unselected",g,null),this.updateClipPath(n,this.clipId,0,0,0,0),this.renderZoomBarArea(h,"path.zoom-graph-area",g,this.clipId),this.renderZoomBarBaseline(h,l,c),a)){const T=a.highlightStartMapsTo,S=a.highlightEndMapsTo,$=a.color,D=a.labelMapsTo;a.data.forEach((L,M)=>{R.appendOrSelect(h,`rect.highlight-${M}`).attr("height",o-2*this.highlightStrokeWidth).attr("y",this.highlightStrokeWidth).attr("x",this.xScale(L[T])).attr("width",this.xScale(L[S])-this.xScale(L[T])).style("fill",$&&$.scale[L[D]]?$.scale[L[D]]:null).style("fill-opacity",.1).style("stroke",$&&$.scale[L[D]]?$.scale[L[D]]:null).style("stroke-dasharray","2, 2").attr("stroke-width","1px")})}this.addBrushEventListener(O,l,c);const _=R.appendOrSelect(n,this.brushSelector).call(this.brush);if(O!==void 0)if(O[0].valueOf()===O[1].valueOf())_.call(this.brush.move,this.xScale.range()),this.updateBrushHandle(this.getComponentContainer(),this.xScale.range());else{const T=O.map(S=>this.xScale(S));T[1]-T[0]<this.MIN_SELECTION_DIFF||(_.call(this.brush.move,T),this.updateBrushHandle(this.getComponentContainer(),T))}r&&(this.brush.filter(()=>!1),_.selectAll("rect").attr("cursor","auto"))}}addBrushEventListener(t,n,i){const r=o=>{const c=o.selection;c===null?this.handleBrushedEvent(o,t,this.xScale,this.xScale.range()):c[0]===c[1]||this.handleBrushedEvent(o,t,this.xScale,c)},s=E(this.getOptions(),"zoomBar",H.TOP,"type"),a=ce.height[s];this.brush.extent([[n,0],[i,a]]).on("start brush end",null).on("start brush end",r)}handleBrushedEvent(t,n,i,r){const s=[i.invert(r[0]),i.invert(r[1])];if(this.updateBrushHandle(this.getComponentContainer(),r),t.sourceEvent!=null&&(t.sourceEvent.type==="mousemove"||t.sourceEvent.type==="mouseup"||t.sourceEvent.type==="mousedown"||t.sourceEvent.type==="touchstart"||t.sourceEvent.type==="touchmove"||t.sourceEvent.type==="touchend")){(n===void 0||n[0]!==s[0]||n[1]!==s[1])&&this.services.zoom.handleDomainChange(s,{dispatchEvent:!1});let a;t.type==="start"?a=C.ZoomBar.SELECTION_START:t.type==="brush"?a=C.ZoomBar.SELECTION_IN_PROGRESS:t.type==="end"&&(a=C.ZoomBar.SELECTION_END,this.services.events.dispatchEvent(C.ZoomDomain.CHANGE,{newDomain:s})),this.services.events.dispatchEvent(a,{selection:r,newDomain:s})}}updateBrushHandle(t,n){const i=this,r=ce.handleWidth,s=E(this.getOptions(),"zoomBar",H.TOP,"type"),a=ce.height[s],o=-r/2,c=ce.handleBarWidth,l=s===Ie.GRAPH_VIEW?ce.handleBarHeight:6,u=-c/2,h=(a-l)/2;t.select(this.brushSelector).selectAll("rect.handle").data([{type:"w"},{type:"e"}]).attr("x",function(f){if(f.type==="w")return Math.max(n[0]+o,i.maxSelectionRange[0]);if(f.type==="e")return Math.min(n[1]+o,i.maxSelectionRange[1]-r)}).attr("y",0).attr("width",r).attr("height",a).attr("cursor","ew-resize").style("display",null);const d=t.select(this.brushSelector).selectAll("rect.handle-bar").data([{type:"w"},{type:"e"}]);d.enter().append("rect").attr("class",function(f){return"handle-bar handle-bar--"+f.type}),d.attr("x",function(f){if(f.type==="w")return Math.max(n[0]+u,i.maxSelectionRange[0]-o+u);if(f.type==="e")return Math.min(n[1]+u,i.maxSelectionRange[1]+o+u)}).attr("y",h).attr("width",c).attr("height",l).attr("cursor","ew-resize"),s===Ie.SLIDER_VIEW&&this.updateSliderSelectedArea(n),this.updateClipPath(t,this.clipId,n[0],0,n[1]-n[0],a)}updateSliderSelectedArea(t){const n=E(this.getOptions(),"zoomBar",H.TOP,"type"),i=ce.height[n],r=this.getComponentContainer().select("svg.zoom-container");R.appendOrSelect(r,"rect.zoom-slider-selected-area").attr("x",t[0]).attr("y",i/2-1).attr("width",t[1]-t[0]).attr("height",2)}renderZoomBarArea(t,n,i,r){const{cartesianScales:s}=this.services,a=s.getMainXAxisPosition(),o=s.getMainYAxisPosition(),c=s.getMainXScaleType(),l=s.getMainYScaleType(),u=(v,b,w)=>O=>s.getValueFromScale(v,b,w,O),h=u(this.xScale,c,a),d=u(this.yScale,l,o),f=E(this.getOptions(),"zoomBar",H.TOP,"type"),p=ce.height[f],m=rl().x(v=>h(v)).y0(p).y1(v=>p-d(v)),g=R.appendOrSelect(t,n).datum(i).attr("d",m);r&&g.attr("clip-path",`url(#${r})`)}updateClipPath(t,n,i,r,s,a){const o=R.appendOrSelect(t,"clipPath").attr("id",n);R.appendOrSelect(o,"rect").attr("x",i).attr("y",r).attr("width",s).attr("height",a)}compensateDataForDefaultDomain(t,n){if(!t||t.length<2)return;const i=nn(t),r=this.services.cartesianScales.getDomainIdentifier(),s=this.services.cartesianScales.getRangeIdentifier();if(Number(n[0])<Number(i[0][r])){const a={};a[r]=n[0],a[s]=0,i.unshift(a)}if(Number(n[1])>Number(i[i.length-1][r])){const a={};a[r]=n[1],a[s]=0,i.push(a)}return i}renderZoomBarBaseline(t,n,i,r=!1){const s=E(this.model.getOptions(),"zoomBar",H.TOP,"type"),a=ce.height[s],o=lr()([[n,a],[i,a]]);R.appendOrSelect(t,"path.zoom-bg-baseline").attr("d",o).classed("zoom-bg-baseline-skeleton",r).style("stroke",r?`url(#${this.services.domUtils.generateElementIDString("shimmer-lines")})`:null)}renderSkeleton(t,n,i){this.renderZoomBarArea(t,"path.zoom-graph-area-unselected",[],null),this.renderZoomBarArea(t,"path.zoom-graph-area",[],this.clipId),this.brush.on("start brush end",null),R.appendOrSelect(this.getComponentContainer(),this.brushSelector).html(null),E(this.getOptions(),"zoomBar",H.TOP,"type")===Ie.GRAPH_VIEW&&this.renderZoomBarBaseline(t,n,i,!0)}destroy(){this.brush.on("start brush end",null),this.services.events.removeEventListener(C.ZoomBar.UPDATE,this.render.bind(this))}}class Ck extends ht{constructor(t,n){super(t,n),this.type="threshold",this.renderType=K.SVG,this.positionService=new Aa}render(t=!1){const n=E(this.getOptions(),"axes"),i=[];Object.keys(n).forEach(l=>{if(Object.values(H).includes(l)){const u=n[l];u.thresholds&&u.thresholds.length>0&&i.push({axisPosition:l,thresholds:u.thresholds,correspondingDatasets:u==null?void 0:u.correspondingDatasets,mapsTo:u==null?void 0:u.mapsTo})}});const r=this.getComponentContainer({withinChartClip:!0}).selectAll("g.axis-thresholds").data(i,l=>l.axisPosition);r.exit().attr("opacity",0).remove();const s=r.enter().append("g").merge(r);s.attr("class",l=>`axis-thresholds ${l.axisPosition}`);const a=s.selectAll("g.threshold-group").data(l=>l.thresholds.map(u=>(u.axisPosition=l.axisPosition,u.datum=this.constructDatumObj(l,u),u)));a.exit().attr("opacity",0).remove();const o=a.enter().append("g");o.append("line").attr("class","threshold-line"),o.append("rect").attr("class","threshold-hoverable-area"),o.merge(a).attr("class","threshold-group");const c=this;s.each(function({axisPosition:l}){const u=c.services.cartesianScales.getScaleByPosition(l),h=c.services.cartesianScales.getScaleTypeByPosition(l);let d=null,f=null;l===H.LEFT||l===H.RIGHT?(f=u,d=c.services.cartesianScales.getMainXScale()):(d=u,f=c.services.cartesianScales.getMainYScale());const p=h===Z.LABELS,[m,g]=d.range(),[v,b]=f.range(),{cartesianScales:w}=c.services,O=w.getOrientation(),_=L=>w.getDomainValue(L),T=L=>w.getRangeValue(L),[S,$]=sn(_,T,O),D=P(this);l===H.TOP||l===H.BOTTOM?(D.selectAll("line.threshold-line").transition().call(L=>c.services.transitions.setupTransition({transition:L,name:"threshold-line-update",animate:t})).attr("y1",b).attr("y2",v).attr("x1",({datum:L})=>S(L)+(p?u.step()/2:0)).attr("x2",({datum:L})=>S(L)+(p?u.step()/2:0)).style("stroke",({fillColor:L})=>L),D.selectAll("rect.threshold-hoverable-area").attr("x",0).attr("y",({datum:L})=>-S(L)).attr("width",Math.abs(v-b)).classed("rotate",!0)):(D.selectAll("line.threshold-line").transition().call(L=>c.services.transitions.setupTransition({transition:L,name:"threshold-line-update",animate:t})).attr("x1",m).attr("x2",g).attr("y1",({datum:L})=>$(L)+(p?u.step()/2:0)).attr("y2",({datum:L})=>$(L)+(p?u.step()/2:0)).style("stroke",({fillColor:L})=>L),D.selectAll("rect.threshold-hoverable-area").attr("x",m).attr("y",({datum:L})=>$(L)).attr("width",Math.abs(g-m)).classed("rotate",!1))}),this.services.events.addEventListener(C.Threshold.SHOW,l=>{this.setThresholdLabelPosition(l.detail),this.label.classed("hidden",!1)}),this.services.events.addEventListener(C.Threshold.HIDE,()=>{this.label.classed("hidden",!0)}),this.appendThresholdLabel(),this.addEventListeners()}getFormattedValue(t){const{value:n,axisPosition:i}=t,r=this.getOptions();if(this.services.cartesianScales.getScaleTypeByPosition(i)===Z.TIME){const s=[H.LEFT,H.RIGHT].includes(i),a=this.services.cartesianScales.getMainXScale(),o=this.services.cartesianScales.getMainYScale(),c=s?o:a,l=E(r,"timeScale"),u=Gl(c.ticks(),E(l,"timeInterval"));return Vl(n,0,c.ticks(),u,l)}return n.toLocaleString("en")}appendThresholdLabel(){const t=P(this.services.domUtils.getHolder()),n=E(this.getOptions(),"style","prefix");this.label=R.appendOrSelect(t,`div.${ne}--${n}--threshold--label`).classed("hidden",!0)}setThresholdLabelPosition({event:t,datum:n}){const i=this.services.domUtils.getHolder(),r=wn(t,i),s=n.valueFormatter?n.valueFormatter(n.value):this.getFormattedValue(n);this.label.html(`${n.label||"Threshold"}: ${s}`).style("background-color",n.fillColor);const a=this.label.node(),o=this.positionService.findBestPlacementAt({left:r[0],top:r[1]},a,[zt.RIGHT,zt.LEFT,zt.TOP,zt.BOTTOM],()=>({top:void 0,left:void 0,width:i.offsetWidth,height:i.offsetHeight})),c=this.positionService.findPositionAt({left:r[0],top:r[1]},a,o);this.positionService.setElement(a,c)}constructDatumObj(t,n){const i={};return t.correspondingDatasets&&(i.group=E(t,"correspondingDatasets",0)),i[t.mapsTo]=n.value,i}addEventListeners(){const t=this;this.getComponentContainer({withinChartClip:!0}).selectAll("rect.threshold-hoverable-area").on("mouseover mousemove",function(n){P(this.parentNode).select("line.threshold-line").classed("active",!0),t.services.events.dispatchEvent(C.Threshold.SHOW,{event:n,hoveredElement:P(this),datum:P(this).datum()})}).on("mouseout",function(n){P(this.parentNode).select("line.threshold-line").classed("active",!1),t.services.events.dispatchEvent(C.Threshold.HIDE,{event:n,hoveredElement:P(this),datum:P(this).datum()})})}}class Ak extends ht{constructor(t,n){super(t,n),this.type="highlight",this.renderType=K.SVG,this.positionService=new Aa,this.highlightStrokeWidth=1}render(t=!1){const n=E(this.getOptions(),"axes"),i=[];Object.keys(n).forEach(l=>{if(Object.values(H).includes(l)){const u=n[l];u.highlights&&u.highlights.data.length>0&&i.push({axisPosition:l,highlightStartMapsTo:u.highlights.highlightStartMapsTo,highlightEndMapsTo:u.highlights.highlightEndMapsTo,labelMapsTo:u.highlights.labelMapsTo,highlight:u.highlights.data,color:u.highlights.color})}});const r=this.getComponentContainer({withinChartClip:!0}).selectAll("g.axis-highlight").data(i,l=>l.axisPosition);r.exit().attr("opacity",0).remove();const s=r.enter().append("g").merge(r);s.attr("class",l=>`axis-highlight ${l.axisPosition}`);const a=s.selectAll("g.highlight-group").data(l=>l.highlight.map(u=>(u.axisPosition=l.axisPosition,u.highlightStartMapsTo=l.highlightStartMapsTo,u.labelMapsTo=l.labelMapsTo,u.color=l.color,u.highlightEndMapsTo=l.highlightEndMapsTo,u)));a.exit().attr("opacity",0).remove();const o=a.enter().append("g");o.append("rect").attr("class","highlight-bar"),o.append("line").attr("class","highlight-line"),o.merge(a).attr("class","highlight-group");const c=this;s.each(function({axisPosition:l}){const u=c.services.cartesianScales.getMainXScale(),h=c.services.cartesianScales.getMainYScale(),[d,f]=u.range(),[p,m]=h.range(),{cartesianScales:g}=c.services,v=g.getOrientation(),b=S=>g.getDomainValue(S),w=S=>g.getRangeValue(S),[O,_]=sn(b,w,v),T=P(this);l===H.TOP||l===H.BOTTOM?T.selectAll("rect.highlight-bar").transition().call(S=>c.services.transitions.setupTransition({transition:S,name:"highlight-bar-update",animate:t})).attr("y",Math.max(m+c.highlightStrokeWidth,0)).attr("height",Math.max(p-2*c.highlightStrokeWidth,0)).attr("x",({highlightStartMapsTo:S,...$})=>O($[S])).attr("width",({highlightStartMapsTo:S,highlightEndMapsTo:$,...D})=>Math.max(O(D[$])-O(D[S]),0)).style("stroke",({color:S,labelMapsTo:$,...D})=>S&&S.scale[D[$]]?S.scale[D[$]]:null).style("stroke-dasharray","2, 2").attr("stroke-width",c.highlightStrokeWidth+"px").style("fill-opacity",.1).style("fill",({color:S,labelMapsTo:$,...D})=>S&&S.scale[D[$]]?S.scale[D[$]]:null):T.selectAll("rect.highlight-bar").transition().call(S=>c.services.transitions.setupTransition({transition:S,name:"highlight-bar-update",animate:t})).attr("x",d).attr("width",Math.max(f-d,0)).attr("y",({highlightEndMapsTo:S,...$})=>_($[S])).attr("height",({highlightStartMapsTo:S,highlightEndMapsTo:$,...D})=>Math.max(_(D[S])-_(D[$]),0)).style("stroke",({color:S,labelMapsTo:$,...D})=>S&&S.scale[D[$]]?S.scale[D[$]]:null).style("stroke-dasharray","2, 2").attr("stroke-width",c.highlightStrokeWidth+"px").style("fill-opacity",.1).style("fill",({color:S,labelMapsTo:$,...D})=>S&&S.scale[D[$]]?S.scale[D[$]]:null)})}}class Gg extends gc{getItems(t){if(t.detail.items)return t.detail.items;const n=t.detail.data;if(!n.length||!n[0])return[];const i=this.getOptions(),{cartesianScales:r}=this.services,s=r.getDomainIdentifier(),a=r.isDualAxes(),{groupMapsTo:o}=i.data,c=r.getDomainLabel();let l=r.getRangeLabel();const u=n[0][s];let h;if(n.length===1){const d=n[0],f=r.getRangeIdentifier(d);if(a){const m=r.getRangeAxisPosition({datum:d,groups:[d[o]]});l=r.getScaleLabel(m)}const p=d[f];h=[{label:c,value:u},...Array.isArray(p)&&p.length===2?[{label:"Start",value:p[0]},{label:"End",value:p[1]}]:[{label:l,value:d[f]}]],t.detail.additionalItems&&t.detail.additionalItems.forEach(m=>h.push({label:m.label,value:m.value})),h.push({label:i.tooltip.groupLabel,value:d[o],color:this.model.getFillColor(d[o]),class:this.model.getColorClassName({classNameTypes:[J.TOOLTIP],dataGroupName:d[o]})})}else if(n.length>1&&(h=[{label:c,value:u}],h=h.concat(n.map(d=>{const f=d[r.getRangeIdentifier(d)];return{label:d[o],value:Array.isArray(f)&&f.length===2?`${f[0]} - ${f[1]}`:f,color:this.model.getFillColor(d[o]),class:this.model.getColorClassName({classNameTypes:[J.TOOLTIP],dataGroupName:d[o]})}}).sort((d,f)=>f.value-d.value)),!a&&E(i,"tooltip","showTotal")===!0)){const d=r.getRangeIdentifier();h.push({label:St(i,"tooltip.totalLabel")||"Total",value:n.reduce((f,p)=>f+p[d],0),bold:!0})}return h}}class $k extends ht{constructor(){super(...arguments),this.type="alluvial",this.renderType=K.SVG,this.gradient_id="gradient-id-"+Math.floor(Math.random()*99999999999)}render(t=!0){const n=this.getComponentContainer({withinChartClip:!0});n.html("");const{width:i,height:r}=R.getSVGElementSize(n,{useAttrs:!0});if(i<1||r<1)return;const s=this.model.getOptions(),a=this.model.getDisplayData(),o=E(this.getOptions(),"color","gradient","enabled");let c=Oe.minNodePadding;s.alluvial.nodePadding>Oe.minNodePadding&&(c=s.alluvial.nodePadding);const l=E(s,"alluvial","nodeAlignment");let u=Yp;l===It.LEFT?u=L$:l===It.RIGHT&&(u=D$);const h=P$().nodeId(g=>g.name).nodeWidth(Oe.nodeWidth).nodePadding(c).nodeAlign(u).extent([[2,30],[i-2,r]]);this.graph=h({nodes:s.alluvial.nodes.map(g=>Object.assign({},g)),links:a.map(g=>Object.assign({},g))}),this.graph.nodes=this.graph.nodes.filter(g=>g.value!==0);const d={};this.graph.nodes.forEach(g=>{const v=g.x0;g.category&&(d[v]=g==null?void 0:g.category)}),n.append("g").classed("header-arrows",!0).selectAll("g").data(Object.keys(d)).join("g").attr("transform",g=>`translate(${g}, 0)`).append("text").attr("id",(g,v)=>this.services.domUtils.generateElementIDString(`alluvial-category-${v}`)).style("font-size","14px").text(g=>d[g]?d[g]:"").attr("y",20).attr("x",(g,v)=>{const b=this.services.domUtils.generateElementIDString(`alluvial-category-${v}`),{width:w}=R.getSVGElementSize(P(`text#${b}`),{useBBox:!0});let O=0;return g+O>=w&&(O=-w+4),O});const f=n.append("g").attr("fill","none").selectAll("g").data(this.graph.links);if(f.exit().remove(),o){const g=E(this.getOptions(),"color","scale");g&&f.enter().append("linearGradient").attr("id",v=>`${this.gradient_id}-link-${v.index}`).attr("gradientUnits","userSpaceOnUse").call(v=>v.append("stop").attr("offset","0%").attr("stop-color",b=>g[b.source.name])).call(v=>v.append("stop").attr("offset","100%").attr("stop-color",b=>g[b.target.name])),f.exit().remove()}f.enter().append("path").classed("link",!0).attr("d",Y$()).attr("id",g=>this.services.domUtils.generateElementIDString(`alluvial-line-${g.index}`)).attr("class",g=>s.alluvial.monochrome?this.model.getColorClassName({classNameTypes:[J.STROKE],dataGroupName:0,originalClassName:"link"}):this.model.getColorClassName({classNameTypes:[J.STROKE],dataGroupName:g.source.index,originalClassName:"link"})).style("stroke",g=>o?`url(#${this.gradient_id}-link-${g.index})`:this.model.getFillColor(g.source.name)).attr("stroke-width",g=>Math.max(1,g.width)).style("stroke-opacity",Oe.opacity.default).attr("aria-label",g=>`${g.source.name} → ${g.target.name} (${g.value}${s.alluvial.units?" "+s.alluvial.units:""})`);const p=n.append("g").selectAll("g").data(this.graph.nodes).enter().append("g").attr("id",g=>this.services.domUtils.generateElementIDString(`alluvial-node-${g.index}`)).classed("node-group",!0).attr("transform",g=>`translate(${g.x0}, ${g.y0})`);p.append("rect").classed("node",!0).attr("height",g=>g.y1-g.y0).attr("width",g=>g.x1-g.x0).attr("fill","black");const m=p.append("g").attr("id",g=>this.services.domUtils.generateElementIDString(`alluvial-node-title-${g.index}`));m.append("text").attr("id",g=>this.services.domUtils.generateElementIDString(`alluvial-node-text-${g.index}`)).attr("class","node-text").style("font-size","12px").attr("text-anchor","start").attr("fill","white").attr("x",4).attr("dy",13).text(g=>`${g.name} (${g.value})`).attr("aria-label",g=>`${g.name} (${g.value})`),m.append("rect").classed("node-text-bg",!0).attr("width",(g,v)=>{const b=this.services.domUtils.generateElementIDString(`alluvial-node-text-${v}`),{width:w}=R.getSVGElementSize(P(`text#${b}`),{useBBox:!0});return w+8}).attr("height",18).attr("stroke-width",2).lower(),m.attr("transform",(g,v)=>{const b=this.services.domUtils.generateElementIDString(`alluvial-node-text-${v}`),{width:w}=R.getSVGElementSize(P(`text#${b}`),{useBBox:!0}),O=(g.y1-g.y0)/2-9;let _=g.x1-g.x0;return g.x1>=w?_=_-(w+16):_+=4,`translate(${_}, ${O})`}),this.addLineEventListener(),this.addNodeEventListener()}addLineEventListener(){const t=this.getOptions(),n=this,i=va((r,s="mouseover")=>{const a=n.parent.selectAll("path.link").transition().call(o=>n.services.transitions.setupTransition({transition:o,name:"alluvial-links-mouse-highlight"}));s==="mouseout"?(P(r).lower(),a.style("stroke-opacity",Oe.opacity.default)):a.style("stroke-opacity",function(){return r===this?(P(this).raise(),Oe.opacity.selected):Oe.opacity.unfocus})},33);this.parent.selectAll("path.link").on("mouseover",function(r,s){const a=P(this);i(this,"mouseover"),a.classed("link-hovered",!0);const o=getComputedStyle(this).getPropertyValue("stroke");n.services.events.dispatchEvent(C.Alluvial.LINE_MOUSEOVER,{event:r,element:a,datum:s}),n.services.events.dispatchEvent(C.Tooltip.SHOW,{event:r,hoveredElement:a,items:[{label:s.target.name,value:s.value+(t.alluvial.units?` ${t.alluvial.units}`:""),color:o,labelIcon:n.getRightArrowIcon()}]})}).on("mousemove",function(r,s){n.services.events.dispatchEvent(C.Alluvial.LINE_MOUSEMOVE,{event:r,element:P(this),datum:s}),n.services.events.dispatchEvent(C.Tooltip.MOVE,{event:r})}).on("click",function(r,s){n.services.events.dispatchEvent(C.Alluvial.LINE_CLICK,{event:r,element:P(this),datum:s})}).on("mouseout",function(r,s){const a=P(this);i(this,"mouseout"),a.classed("link-hovered",!1),n.services.events.dispatchEvent(C.Alluvial.LINE_MOUSEOUT,{event:r,element:a,datum:s}),n.services.events.dispatchEvent(C.Tooltip.HIDE,{event:r,hoveredElement:a})})}addNodeEventListener(){const t=this,n=va((i=[],r="mouseover")=>{if(r==="mouseout"||i.length===0){t.parent.selectAll("path.link").classed("link-hovered",!1).data(this.graph.links,s=>s.index).order().style("stroke-opacity",Oe.opacity.default);return}t.parent.selectAll("path.link").transition().call(s=>this.services.transitions.setupTransition({transition:s,name:"alluvial-link-mouse-highlight"})).style("stroke-opacity",function(s){return i.some(a=>a===s.index)?(P(this).classed("link-hovered",!0).raise(),Oe.opacity.selected):Oe.opacity.unfocus})},66);t.parent.selectAll(".node-group").on("mouseover",function(i,r){const s=P(this),a=[];if(t.traverse({link:"sourceLinks",node:"target"},r,a),t.traverse({link:"targetLinks",node:"source"},r,a),a.length){const o=Mr(s.attr("transform"));if(s.attr("transform",`translate(${o.x-2}, ${o.y})`),s.classed("node-hovered",!0).selectAll("rect.node").attr("width",8),r.x0-2===0){const l=t.services.domUtils.generateElementIDString(`alluvial-node-title-${r.index}`),u=t.parent.select(`g#${l}`),h=Mr(u.attr("transform"));u.attr("transform",`translate(${h.x+4},${h.y})`)}const c=t.services.domUtils.generateElementIDString(`alluvial-node-text-${r.index}`);t.parent.select(`text#${c}`).style("font-weight","bold"),n(a,"mouseover"),t.services.events.dispatchEvent(C.Alluvial.NODE_MOUSEOVER,{event:i,element:s,datum:r})}}).on("mousemove",function(i,r){t.services.events.dispatchEvent(C.Alluvial.NODE_MOUSEMOVE,{event:i,element:P(this),datum:r}),t.services.events.dispatchEvent(C.Tooltip.MOVE,{event:i})}).on("click",function(i,r){t.services.events.dispatchEvent(C.Alluvial.NODE_CLICK,{event:i,element:P(this),datum:r})}).on("mouseout",function(i,r){const s=P(this),a=Mr(s.attr("transform"));if(s.classed("node-hovered",!1).attr("transform",`translate(${a.x+2}, ${a.y})`).select("rect.node").attr("width",Oe.nodeWidth),r.x0-2===0){const c=t.services.domUtils.generateElementIDString(`alluvial-node-title-${r.index}`),l=t.parent.select(`g#${c}`),u=Mr(l.attr("transform"));l.attr("transform",`translate(${u.x-4},${u.y})`)}const o=t.services.domUtils.generateElementIDString(`alluvial-node-text-${r.index}`);t.parent.select(`text#${o}`).style("font-weight","normal"),n([],"mouseout"),t.services.events.dispatchEvent(C.Alluvial.NODE_MOUSEOUT,{event:i,element:s,datum:r}),t.services.events.dispatchEvent(C.Tooltip.HIDE,{hoveredElement:s})})}traverse(t,n,i=[]){n[t.link].map(r=>(i.push(r.index),r[t.node])).forEach(r=>this.traverse(t,r,i))}getRightArrowIcon(){return`
|
|
71
|
+
</li>`).join("")+"</ul>"}valueFormatter(t,n){const i=this.getOptions(),r=E(i,"tooltip","valueFormatter");if(r)return r(t,n);if(typeof t.getTime=="function")return pi(t,"MMM d, yyyy");try{if(typeof t=="string"&&/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z/.test(t))return pi(Date.parse(t),"MMM d, yyyy")}catch{}return t.toLocaleString()}render(t=!1){const n=this.getOptions(),i=E(n,"tooltip","enabled");if(i){const r=P(this.services.domUtils.getHolder()),s=E(n,"style","prefix");this.tooltip=R.appendOrSelect(r,`div.${ne}--${s}--tooltip`),this.tooltip.style("max-width",null).attr("role","tooltip"),this.isEventListenerAdded||(this.addTooltipEventListener(),this.isEventListenerAdded=!0),this.tooltip.classed("hidden",!0)}else!i&&this.isEventListenerAdded&&(this.removeTooltipEventListener(),this.isEventListenerAdded=!1)}positionTooltip(t){const n=this.services.domUtils.getHolder(),i=this.tooltip.node(),r=this.getOptions(),s=E(r,"zoomBar","top","enabled");let a=E(t,"detail","mousePosition");if(!a)a=wn(E(t,"detail","event"),n);else{const d=E(r,"zoomBar","top","type"),f=ce.height[d];s&&(a[1]+=f+ce.spacerHeight)}const o=n.offsetWidth,c=n.offsetHeight;let l;a[0]/o>.9?l=zt.LEFT:a[0]/o<.1?l=zt.RIGHT:l=this.positionService.findBestPlacementAt({left:a[0],top:a[1]},i,[zt.RIGHT,zt.LEFT,zt.TOP,zt.BOTTOM],()=>({top:void 0,left:void 0,width:o,height:c}));let{horizontalOffset:u}=RS;l===zt.LEFT&&(u*=-1);const h=this.positionService.findPositionAt({left:a[0]+u,top:a[1]},i,l);this.positionService.setElement(i,h)}}const $a=class extends ht{constructor(){super(...arguments),this.type="grid-brush",this.renderType=K.SVG,this.selectionSelector="rect.selection",this.frontSelectionSelector="rect.frontSelection"}render(t=!0){const n=this.parent,i=this.getComponentContainer();if(!n)throw new Error("SVG was not defined");const r=R.appendOrSelect(n,"svg.chart-grid-backdrop"),s=R.appendOrSelect(r,`g.${this.type}`),a=R.appendOrSelect(s,this.selectionSelector),{width:o,height:c}=R.getSVGElementSize(r,{useAttrs:!0}),{cartesianScales:l}=this.services,u=l.getMainXScaleType(),h=l.getMainXScale(),[d]=h.range();i.attr("transform",`translate(${d},0)`);const f=R.appendOrSelect(i,this.frontSelectionSelector);if(h&&u===Z.TIME){let p=this.model.get("zoomDomain");p===void 0&&(p=this.services.zoom.getDefaultZoomBarDomain(),p&&this.model.set({zoomDomain:p},{animate:!1}));const m=_=>{const T=_[1]-_[0];let S="0,"+T.toString();const $=Math.floor(c/$a.DASH_LENGTH),D=$*$a.DASH_LENGTH;for(let L=0;L<$;L++)S+=","+$a.DASH_LENGTH;S+=","+(c-D),$%2===1&&(S+=",0"),S+=","+T.toString(),S+=","+c.toString(),f.attr("stroke-dasharray",S)},g=_=>{const T=_.selection;T===null||T[0]===T[1]||(f.attr("x",parseFloat(a.attr("x"))+parseFloat(r.attr("x"))).attr("y",a.attr("y")).attr("width",a.attr("width")).attr("height",a.attr("height")).style("cursor","pointer").style("display",null),m(T))},v=(_,T)=>{const S=ud().range([0,o]).domain(p);let $=[S.invert(_),S.invert(T)];$[0].valueOf()===$[1].valueOf()&&($=this.services.zoom.getDefaultZoomBarDomain()),(p[0].valueOf()!==$[0].valueOf()||p[1].valueOf()!==$[1].valueOf())&&this.services.zoom.handleDomainChange($)};let b;const w=_=>{const T=_.selection;T!==null&&(v(T[0],T[1]),s.call(b.move,null),f.style("display","none"))};c!=0&&o!=0&&(b=Mu().extent([[0,0],[o-1,c]]).on("start brush end",g).on("end.brushed",w),s.call(b));const O=this.services.zoom.getZoomRatio();r.on("click",function(_){if(_.shiftKey){const T=this.services.domUtils.getHolder(),S=wn(s.node(),T)[0];let $=S-o*O/2;$<0&&($=0);let D=S+o*O/2;D>o&&(D=o),v($,D)}})}}};let Vg=$a;Vg.DASH_LENGTH=4;class Mk extends ht{constructor(){super(...arguments),this.type="zoom-bar",this.renderType=K.SVG,this.MIN_SELECTION_DIFF=9e-10,this.brushSelector="g.zoom-bar-brush",this.clipId="zoomBarClip-"+Math.floor(Math.random()*99999999999),this.brush=Mu(),this.highlightStrokeWidth=1}init(){this.services.events.addEventListener(C.ZoomBar.UPDATE,this.render.bind(this));const t=E(this.getOptions(),"zoomBar",H.TOP,"data");this.model.setZoomBarData(t)}render(t=!0){const n=this.getComponentContainer(),i=this.services.zoom.isZoomBarLoading(H.TOP),r=this.services.zoom.isZoomBarLocked(H.TOP),s=E(this.getOptions(),"zoomBar",H.TOP,"type"),a=E(this.getOptions(),"axes",H.BOTTOM,"highlights"),o=ce.height[s],{width:c}=R.getSVGElementSize(this.parent,{useAttrs:!0});if(c===0)return;let l=0;const u=this.model.get("axesMargins");u&&u.left&&(l=u.left);const h=R.appendOrSelect(n,"svg.zoom-container").attr("width","100%").attr("height",o).attr("opacity",1);if(R.appendOrSelect(n,"rect.zoom-spacer").attr("x",0).attr("y",o).attr("width","100%").attr("height",ce.spacerHeight).attr("opacity",1).attr("fill","none"),s===Ie.GRAPH_VIEW?R.appendOrSelect(h,"rect.zoom-bg").attr("x",l).attr("y",0).attr("width",c-l).attr("height","100%").classed("zoom-bg-skeleton",i).style("stroke",i?`url(#${this.services.domUtils.generateElementIDString("shimmer-lines")})`:null):s===Ie.SLIDER_VIEW&&R.appendOrSelect(h,"rect.zoom-slider-bg").attr("x",l).attr("y",o/2-1).attr("width",c-l).attr("height",2).classed("zoom-slider-bg-skeleton",i).style("stroke",i?`url(#${this.services.domUtils.generateElementIDString("shimmer-lines")})`:null),i){this.renderSkeleton(h,l,c);return}const{cartesianScales:d}=this.services,f=d.getMainXScale(),p=d.getMainYScale(),m=d.getMainXScaleType();if(f&&m===Z.TIME){let g=this.services.zoom.getZoomBarData();if(Ce(g)||g.length===1)return;this.xScale=f.copy(),this.yScale=p.copy();const v=this.services.zoom.getDefaultZoomBarDomain(g);g=this.compensateDataForDefaultDomain(g,v);const b=this.model.get("initialZoomDomain"),w=E(this.getOptions(),"zoomBar",H.TOP,"initialZoomDomain");w&&w[0]&&w[1]&&(w[0]=new Date(w[0]),w[1]=new Date(w[1])),w&&!(b&&b[0].valueOf()===w[0].valueOf()&&b[1].valueOf()===w[1].valueOf())?this.model.set({initialZoomDomain:nt([],w),zoomDomain:w?nt([],w):v},{skipUpdate:!0}):w===null&&b!==null&&this.model.set({initialZoomDomain:null,zoomDomain:nt([],v)},{skipUpdate:!0}),this.xScale.range([l,c]).domain(v),this.maxSelectionRange=this.xScale.range(),this.yScale.range([0,o-6]).domain(ye(g,T=>T.value));const O=this.model.get("zoomDomain");if(s===Ie.GRAPH_VIEW&&(this.renderZoomBarArea(h,"path.zoom-graph-area-unselected",g,null),this.updateClipPath(n,this.clipId,0,0,0,0),this.renderZoomBarArea(h,"path.zoom-graph-area",g,this.clipId),this.renderZoomBarBaseline(h,l,c),a)){const T=a.highlightStartMapsTo,S=a.highlightEndMapsTo,$=a.color,D=a.labelMapsTo;a.data.forEach((L,M)=>{R.appendOrSelect(h,`rect.highlight-${M}`).attr("height",o-2*this.highlightStrokeWidth).attr("y",this.highlightStrokeWidth).attr("x",this.xScale(L[T])).attr("width",this.xScale(L[S])-this.xScale(L[T])).style("fill",$&&$.scale[L[D]]?$.scale[L[D]]:null).style("fill-opacity",.1).style("stroke",$&&$.scale[L[D]]?$.scale[L[D]]:null).style("stroke-dasharray","2, 2").attr("stroke-width","1px")})}this.addBrushEventListener(O,l,c);const _=R.appendOrSelect(n,this.brushSelector).call(this.brush);if(O!==void 0)if(O[0].valueOf()===O[1].valueOf())_.call(this.brush.move,this.xScale.range()),this.updateBrushHandle(this.getComponentContainer(),this.xScale.range());else{const T=O.map(S=>this.xScale(S));T[1]-T[0]<this.MIN_SELECTION_DIFF||(_.call(this.brush.move,T),this.updateBrushHandle(this.getComponentContainer(),T))}r&&(this.brush.filter(()=>!1),_.selectAll("rect").attr("cursor","auto"))}}addBrushEventListener(t,n,i){const r=o=>{const c=o.selection;c===null?this.handleBrushedEvent(o,t,this.xScale,this.xScale.range()):c[0]===c[1]||this.handleBrushedEvent(o,t,this.xScale,c)},s=E(this.getOptions(),"zoomBar",H.TOP,"type"),a=ce.height[s];this.brush.extent([[n,0],[i,a]]).on("start brush end",null).on("start brush end",r)}handleBrushedEvent(t,n,i,r){const s=[i.invert(r[0]),i.invert(r[1])];if(this.updateBrushHandle(this.getComponentContainer(),r),t.sourceEvent!=null&&(t.sourceEvent.type==="mousemove"||t.sourceEvent.type==="mouseup"||t.sourceEvent.type==="mousedown"||t.sourceEvent.type==="touchstart"||t.sourceEvent.type==="touchmove"||t.sourceEvent.type==="touchend")){(n===void 0||n[0]!==s[0]||n[1]!==s[1])&&this.services.zoom.handleDomainChange(s,{dispatchEvent:!1});let a;t.type==="start"?a=C.ZoomBar.SELECTION_START:t.type==="brush"?a=C.ZoomBar.SELECTION_IN_PROGRESS:t.type==="end"&&(a=C.ZoomBar.SELECTION_END,this.services.events.dispatchEvent(C.ZoomDomain.CHANGE,{newDomain:s})),this.services.events.dispatchEvent(a,{selection:r,newDomain:s})}}updateBrushHandle(t,n){const i=this,r=ce.handleWidth,s=E(this.getOptions(),"zoomBar",H.TOP,"type"),a=ce.height[s],o=-r/2,c=ce.handleBarWidth,l=s===Ie.GRAPH_VIEW?ce.handleBarHeight:6,u=-c/2,h=(a-l)/2;t.select(this.brushSelector).selectAll("rect.handle").data([{type:"w"},{type:"e"}]).attr("x",function(f){if(f.type==="w")return Math.max(n[0]+o,i.maxSelectionRange[0]);if(f.type==="e")return Math.min(n[1]+o,i.maxSelectionRange[1]-r)}).attr("y",0).attr("width",r).attr("height",a).attr("cursor","ew-resize").style("display",null);const d=t.select(this.brushSelector).selectAll("rect.handle-bar").data([{type:"w"},{type:"e"}]);d.enter().append("rect").attr("class",function(f){return"handle-bar handle-bar--"+f.type}),d.attr("x",function(f){if(f.type==="w")return Math.max(n[0]+u,i.maxSelectionRange[0]-o+u);if(f.type==="e")return Math.min(n[1]+u,i.maxSelectionRange[1]+o+u)}).attr("y",h).attr("width",c).attr("height",l).attr("cursor","ew-resize"),s===Ie.SLIDER_VIEW&&this.updateSliderSelectedArea(n),this.updateClipPath(t,this.clipId,n[0],0,n[1]-n[0],a)}updateSliderSelectedArea(t){const n=E(this.getOptions(),"zoomBar",H.TOP,"type"),i=ce.height[n],r=this.getComponentContainer().select("svg.zoom-container");R.appendOrSelect(r,"rect.zoom-slider-selected-area").attr("x",t[0]).attr("y",i/2-1).attr("width",t[1]-t[0]).attr("height",2)}renderZoomBarArea(t,n,i,r){const{cartesianScales:s}=this.services,a=s.getMainXAxisPosition(),o=s.getMainYAxisPosition(),c=s.getMainXScaleType(),l=s.getMainYScaleType(),u=(v,b,w)=>O=>s.getValueFromScale(v,b,w,O),h=u(this.xScale,c,a),d=u(this.yScale,l,o),f=E(this.getOptions(),"zoomBar",H.TOP,"type"),p=ce.height[f],m=rl().x(v=>h(v)).y0(p).y1(v=>p-d(v)),g=R.appendOrSelect(t,n).datum(i).attr("d",m);r&&g.attr("clip-path",`url(#${r})`)}updateClipPath(t,n,i,r,s,a){const o=R.appendOrSelect(t,"clipPath").attr("id",n);R.appendOrSelect(o,"rect").attr("x",i).attr("y",r).attr("width",s).attr("height",a)}compensateDataForDefaultDomain(t,n){if(!t||t.length<2)return;const i=nn(t),r=this.services.cartesianScales.getDomainIdentifier(),s=this.services.cartesianScales.getRangeIdentifier();if(Number(n[0])<Number(i[0][r])){const a={};a[r]=n[0],a[s]=0,i.unshift(a)}if(Number(n[1])>Number(i[i.length-1][r])){const a={};a[r]=n[1],a[s]=0,i.push(a)}return i}renderZoomBarBaseline(t,n,i,r=!1){const s=E(this.model.getOptions(),"zoomBar",H.TOP,"type"),a=ce.height[s],o=lr()([[n,a],[i,a]]);R.appendOrSelect(t,"path.zoom-bg-baseline").attr("d",o).classed("zoom-bg-baseline-skeleton",r).style("stroke",r?`url(#${this.services.domUtils.generateElementIDString("shimmer-lines")})`:null)}renderSkeleton(t,n,i){this.renderZoomBarArea(t,"path.zoom-graph-area-unselected",[],null),this.renderZoomBarArea(t,"path.zoom-graph-area",[],this.clipId),this.brush.on("start brush end",null),R.appendOrSelect(this.getComponentContainer(),this.brushSelector).html(null),E(this.getOptions(),"zoomBar",H.TOP,"type")===Ie.GRAPH_VIEW&&this.renderZoomBarBaseline(t,n,i,!0)}destroy(){this.brush.on("start brush end",null),this.services.events.removeEventListener(C.ZoomBar.UPDATE,this.render.bind(this))}}class Ck extends ht{constructor(t,n){super(t,n),this.type="threshold",this.renderType=K.SVG,this.positionService=new Aa}render(t=!1){const n=E(this.getOptions(),"axes"),i=[];Object.keys(n).forEach(l=>{if(Object.values(H).includes(l)){const u=n[l];u.thresholds&&u.thresholds.length>0&&i.push({axisPosition:l,thresholds:u.thresholds,correspondingDatasets:u==null?void 0:u.correspondingDatasets,mapsTo:u==null?void 0:u.mapsTo})}});const r=this.getComponentContainer({withinChartClip:!0}).selectAll("g.axis-thresholds").data(i,l=>l.axisPosition);r.exit().attr("opacity",0).remove();const s=r.enter().append("g").merge(r);s.attr("class",l=>`axis-thresholds ${l.axisPosition}`);const a=s.selectAll("g.threshold-group").data(l=>l.thresholds.map(u=>(u.axisPosition=l.axisPosition,u.datum=this.constructDatumObj(l,u),u)));a.exit().attr("opacity",0).remove();const o=a.enter().append("g");o.append("line").attr("class","threshold-line"),o.append("rect").attr("class","threshold-hoverable-area"),o.merge(a).attr("class","threshold-group");const c=this;s.each(function({axisPosition:l}){const u=c.services.cartesianScales.getScaleByPosition(l),h=c.services.cartesianScales.getScaleTypeByPosition(l);let d=null,f=null;l===H.LEFT||l===H.RIGHT?(f=u,d=c.services.cartesianScales.getMainXScale()):(d=u,f=c.services.cartesianScales.getMainYScale());const p=h===Z.LABELS,[m,g]=d.range(),[v,b]=f.range(),{cartesianScales:w}=c.services,O=w.getOrientation(),_=L=>w.getDomainValue(L),T=L=>w.getRangeValue(L),[S,$]=sn(_,T,O),D=P(this);l===H.TOP||l===H.BOTTOM?(D.selectAll("line.threshold-line").transition().call(L=>c.services.transitions.setupTransition({transition:L,name:"threshold-line-update",animate:t})).attr("y1",b).attr("y2",v).attr("x1",({datum:L})=>S(L)+(p?u.step()/2:0)).attr("x2",({datum:L})=>S(L)+(p?u.step()/2:0)).style("stroke",({fillColor:L})=>L),D.selectAll("rect.threshold-hoverable-area").attr("x",0).attr("y",({datum:L})=>-S(L)).attr("width",Math.abs(v-b)).classed("rotate",!0)):(D.selectAll("line.threshold-line").transition().call(L=>c.services.transitions.setupTransition({transition:L,name:"threshold-line-update",animate:t})).attr("x1",m).attr("x2",g).attr("y1",({datum:L})=>$(L)+(p?u.step()/2:0)).attr("y2",({datum:L})=>$(L)+(p?u.step()/2:0)).style("stroke",({fillColor:L})=>L),D.selectAll("rect.threshold-hoverable-area").attr("x",m).attr("y",({datum:L})=>$(L)).attr("width",Math.abs(g-m)).classed("rotate",!1))}),this.services.events.addEventListener(C.Threshold.SHOW,l=>{this.setThresholdLabelPosition(l.detail),this.label.classed("hidden",!1)}),this.services.events.addEventListener(C.Threshold.HIDE,()=>{this.label.classed("hidden",!0)}),this.appendThresholdLabel(),this.addEventListeners()}getFormattedValue(t){const{value:n,axisPosition:i}=t,r=this.getOptions();if(this.services.cartesianScales.getScaleTypeByPosition(i)===Z.TIME){const s=[H.LEFT,H.RIGHT].includes(i),a=this.services.cartesianScales.getMainXScale(),o=this.services.cartesianScales.getMainYScale(),c=s?o:a,l=E(r,"timeScale"),u=Gl(c.ticks(),E(l,"timeInterval"));return Vl(n,0,c.ticks(),u,l)}return n.toLocaleString("en")}appendThresholdLabel(){const t=P(this.services.domUtils.getHolder()),n=E(this.getOptions(),"style","prefix");this.label=R.appendOrSelect(t,`div.${ne}--${n}--threshold--label`).classed("hidden",!0)}setThresholdLabelPosition({event:t,datum:n}){const i=this.services.domUtils.getHolder(),r=wn(t,i),s=n.valueFormatter?n.valueFormatter(n.value):this.getFormattedValue(n);this.label.html(`${n.label||"Threshold"}: ${s}`).style("background-color",n.fillColor);const a=this.label.node(),o=this.positionService.findBestPlacementAt({left:r[0],top:r[1]},a,[zt.RIGHT,zt.LEFT,zt.TOP,zt.BOTTOM],()=>({top:void 0,left:void 0,width:i.offsetWidth,height:i.offsetHeight})),c=this.positionService.findPositionAt({left:r[0],top:r[1]},a,o);this.positionService.setElement(a,c)}constructDatumObj(t,n){const i={};return t.correspondingDatasets&&(i.group=E(t,"correspondingDatasets",0)),i[t.mapsTo]=n.value,i}addEventListeners(){const t=this;this.getComponentContainer({withinChartClip:!0}).selectAll("rect.threshold-hoverable-area").on("mouseover mousemove",function(n){P(this.parentNode).select("line.threshold-line").classed("active",!0),t.services.events.dispatchEvent(C.Threshold.SHOW,{event:n,hoveredElement:P(this),datum:P(this).datum()})}).on("mouseout",function(n){P(this.parentNode).select("line.threshold-line").classed("active",!1),t.services.events.dispatchEvent(C.Threshold.HIDE,{event:n,hoveredElement:P(this),datum:P(this).datum()})})}}class Ak extends ht{constructor(t,n){super(t,n),this.type="highlight",this.renderType=K.SVG,this.positionService=new Aa,this.highlightStrokeWidth=1}render(t=!1){const n=E(this.getOptions(),"axes"),i=[];Object.keys(n).forEach(l=>{if(Object.values(H).includes(l)){const u=n[l];u.highlights&&u.highlights.data.length>0&&i.push({axisPosition:l,highlightStartMapsTo:u.highlights.highlightStartMapsTo,highlightEndMapsTo:u.highlights.highlightEndMapsTo,labelMapsTo:u.highlights.labelMapsTo,highlight:u.highlights.data,color:u.highlights.color})}});const r=this.getComponentContainer({withinChartClip:!0}).selectAll("g.axis-highlight").data(i,l=>l.axisPosition);r.exit().attr("opacity",0).remove();const s=r.enter().append("g").merge(r);s.attr("class",l=>`axis-highlight ${l.axisPosition}`);const a=s.selectAll("g.highlight-group").data(l=>l.highlight.map(u=>(u.axisPosition=l.axisPosition,u.highlightStartMapsTo=l.highlightStartMapsTo,u.labelMapsTo=l.labelMapsTo,u.color=l.color,u.highlightEndMapsTo=l.highlightEndMapsTo,u)));a.exit().attr("opacity",0).remove();const o=a.enter().append("g");o.append("rect").attr("class","highlight-bar"),o.append("line").attr("class","highlight-line"),o.merge(a).attr("class","highlight-group");const c=this;s.each(function({axisPosition:l}){const u=c.services.cartesianScales.getMainXScale(),h=c.services.cartesianScales.getMainYScale(),[d,f]=u.range(),[p,m]=h.range(),{cartesianScales:g}=c.services,v=g.getOrientation(),b=S=>g.getDomainValue(S),w=S=>g.getRangeValue(S),[O,_]=sn(b,w,v),T=P(this);l===H.TOP||l===H.BOTTOM?T.selectAll("rect.highlight-bar").transition().call(S=>c.services.transitions.setupTransition({transition:S,name:"highlight-bar-update",animate:t})).attr("y",Math.max(m+c.highlightStrokeWidth,0)).attr("height",Math.max(p-2*c.highlightStrokeWidth,0)).attr("x",({highlightStartMapsTo:S,...$})=>O($[S])).attr("width",({highlightStartMapsTo:S,highlightEndMapsTo:$,...D})=>Math.max(O(D[$])-O(D[S]),0)).style("stroke",({color:S,labelMapsTo:$,...D})=>S&&S.scale[D[$]]?S.scale[D[$]]:null).style("stroke-dasharray","2, 2").attr("stroke-width",c.highlightStrokeWidth+"px").style("fill-opacity",.1).style("fill",({color:S,labelMapsTo:$,...D})=>S&&S.scale[D[$]]?S.scale[D[$]]:null):T.selectAll("rect.highlight-bar").transition().call(S=>c.services.transitions.setupTransition({transition:S,name:"highlight-bar-update",animate:t})).attr("x",d).attr("width",Math.max(f-d,0)).attr("y",({highlightEndMapsTo:S,...$})=>_($[S])).attr("height",({highlightStartMapsTo:S,highlightEndMapsTo:$,...D})=>Math.max(_(D[S])-_(D[$]),0)).style("stroke",({color:S,labelMapsTo:$,...D})=>S&&S.scale[D[$]]?S.scale[D[$]]:null).style("stroke-dasharray","2, 2").attr("stroke-width",c.highlightStrokeWidth+"px").style("fill-opacity",.1).style("fill",({color:S,labelMapsTo:$,...D})=>S&&S.scale[D[$]]?S.scale[D[$]]:null)})}}class Gg extends gc{getItems(t){if(t.detail.items)return t.detail.items;const n=t.detail.data;if(!n.length||!n[0])return[];const i=this.getOptions(),{cartesianScales:r}=this.services,s=r.getDomainIdentifier(),a=r.isDualAxes(),{groupMapsTo:o}=i.data,c=r.getDomainLabel();let l=r.getRangeLabel();const u=n[0][s];let h;if(n.length===1){const d=n[0],f=r.getRangeIdentifier(d);if(a){const m=r.getRangeAxisPosition({datum:d,groups:[d[o]]});l=r.getScaleLabel(m)}const p=d[f];h=[{label:c,value:u},...Array.isArray(p)&&p.length===2?[{label:"Start",value:p[0]},{label:"End",value:p[1]}]:[{label:l,value:d[f]}]],t.detail.additionalItems&&t.detail.additionalItems.forEach(m=>h.push({label:m.label,value:m.value})),h.push({label:i.tooltip.groupLabel,value:d[o],color:this.model.getFillColor(d[o]),class:this.model.getColorClassName({classNameTypes:[J.TOOLTIP],dataGroupName:d[o]})})}else if(n.length>1&&(h=[{label:c,value:u}],h=h.concat(n.map(d=>{const f=d[r.getRangeIdentifier(d)];return{label:d[o],value:Array.isArray(f)&&f.length===2?`${f[0]} - ${f[1]}`:f,color:this.model.getFillColor(d[o]),class:this.model.getColorClassName({classNameTypes:[J.TOOLTIP],dataGroupName:d[o]})}}).sort((d,f)=>f.value-d.value)),!a&&E(i,"tooltip","showTotal")===!0)){const d=r.getRangeIdentifier();h.push({label:St(i,"tooltip.totalLabel")||"Total",value:n.reduce((f,p)=>f+p[d],0),bold:!0})}return h}}class $k extends ht{constructor(){super(...arguments),this.type="alluvial",this.renderType=K.SVG,this.gradient_id="gradient-id-"+Math.floor(Math.random()*99999999999)}render(t=!0){const n=this.getComponentContainer({withinChartClip:!0});n.html("");const{width:i,height:r}=R.getSVGElementSize(n,{useAttrs:!0});if(i<1||r<1)return;const s=this.model.getOptions(),a=this.model.getDisplayData(),o=E(this.getOptions(),"color","gradient","enabled");let c=Oe.minNodePadding;s.alluvial.nodePadding>Oe.minNodePadding&&(c=s.alluvial.nodePadding);const l=E(s,"alluvial","nodeAlignment");let u=Yp;l===It.LEFT?u=L$:l===It.RIGHT&&(u=D$);const h=P$().nodeId(g=>g.name).nodeWidth(Oe.nodeWidth).nodePadding(c).nodeAlign(u).extent([[2,30],[i-2,r]]);this.graph=h({nodes:s.alluvial.nodes.map(g=>Object.assign({},g)),links:a.map(g=>Object.assign({},g))}),this.graph.nodes=this.graph.nodes.filter(g=>g.value!==0);const d={};this.graph.nodes.forEach(g=>{const v=g.x0;g.category&&(d[v]=g==null?void 0:g.category)}),n.append("g").classed("header-arrows",!0).selectAll("g").data(Object.keys(d)).join("g").attr("transform",g=>`translate(${g}, 0)`).append("text").attr("id",(g,v)=>this.services.domUtils.generateElementIDString(`alluvial-category-${v}`)).style("font-size","14px").text(g=>d[g]?d[g]:"").attr("y",20).attr("x",(g,v)=>{const b=this.services.domUtils.generateElementIDString(`alluvial-category-${v}`),{width:w}=R.getSVGElementSize(P(`text#${b}`),{useBBox:!0});let O=0;return g+O>=w&&(O=-w+4),O});const f=n.append("g").attr("fill","none").selectAll("g").data(this.graph.links);if(f.exit().remove(),o){const g=E(this.getOptions(),"color","scale");g&&f.enter().append("linearGradient").attr("id",v=>`${this.gradient_id}-link-${v.index}`).attr("gradientUnits","userSpaceOnUse").call(v=>v.append("stop").attr("offset","0%").attr("stop-color",b=>g[b.source.name])).call(v=>v.append("stop").attr("offset","100%").attr("stop-color",b=>g[b.target.name])),f.exit().remove()}f.enter().append("path").classed("link",!0).attr("d",Y$()).attr("id",g=>this.services.domUtils.generateElementIDString(`alluvial-line-${g.index}`)).attr("class",g=>s.alluvial.monochrome?this.model.getColorClassName({classNameTypes:[J.STROKE],dataGroupName:0,originalClassName:"link"}):this.model.getColorClassName({classNameTypes:[J.STROKE],dataGroupName:g.source.index,originalClassName:"link"})).style("stroke",g=>o?`url(#${this.gradient_id}-link-${g.index})`:this.model.getFillColor(g.source.name)).attr("stroke-width",g=>Math.max(1,g.width)).style("stroke-opacity",Oe.opacity.default).attr("aria-label",g=>`${g.source.name} → ${g.target.name} (${g.value}${s.alluvial.units?" "+s.alluvial.units:""})`);const p=n.append("g").selectAll("g").data(this.graph.nodes).enter().append("g").attr("id",g=>this.services.domUtils.generateElementIDString(`alluvial-node-${g.index}`)).classed("node-group",!0).attr("transform",g=>`translate(${g.x0}, ${g.y0})`);p.append("rect").classed("node",!0).attr("height",g=>g.y1-g.y0).attr("width",g=>g.x1-g.x0).attr("fill","black");const m=p.append("g").attr("id",g=>this.services.domUtils.generateElementIDString(`alluvial-node-title-${g.index}`));m.append("text").attr("id",g=>this.services.domUtils.generateElementIDString(`alluvial-node-text-${g.index}`)).attr("class","node-text").style("font-size","12px").attr("text-anchor","start").attr("fill","white").attr("x",4).attr("dy",13).text(g=>`${g.name} (${g.value})`).attr("aria-label",g=>`${g.name} (${g.value})`),m.append("rect").classed("node-text-bg",!0).attr("width",(g,v)=>{const b=this.services.domUtils.generateElementIDString(`alluvial-node-text-${v}`),{width:w}=R.getSVGElementSize(P(`text#${b}`),{useBBox:!0});return w+8}).attr("height",18).attr("stroke-width",2).lower(),m.attr("transform",(g,v)=>{const b=this.services.domUtils.generateElementIDString(`alluvial-node-text-${v}`),{width:w}=R.getSVGElementSize(P(`text#${b}`),{useBBox:!0}),O=(g.y1-g.y0)/2-9;let _=g.x1-g.x0;return g.x1>=w?_=_-(w+16):_+=4,`translate(${_}, ${O})`}),this.addLineEventListener(),this.addNodeEventListener()}addLineEventListener(){const t=this.getOptions(),n=this,i=va((r,s="mouseover")=>{const a=n.parent.selectAll("path.link").transition().call(o=>n.services.transitions.setupTransition({transition:o,name:"alluvial-links-mouse-highlight"}));s==="mouseout"?(P(r).lower(),a.style("stroke-opacity",Oe.opacity.default)):a.style("stroke-opacity",function(){return r===this?(P(this).raise(),Oe.opacity.selected):Oe.opacity.unfocus})},33);this.parent.selectAll("path.link").on("mouseover",function(r,s){const a=P(this);i(this,"mouseover"),a.classed("link-hovered",!0);const o=getComputedStyle(this).getPropertyValue("stroke");n.services.events.dispatchEvent(C.Alluvial.LINE_MOUSEOVER,{event:r,element:a,datum:s}),n.services.events.dispatchEvent(C.Tooltip.SHOW,{event:r,hoveredElement:a,items:[{label:s.target.name,value:s.value+(t.alluvial.units?` ${t.alluvial.units}`:""),color:o,labelIcon:n.getRightArrowIcon()}]})}).on("mousemove",function(r,s){n.services.events.dispatchEvent(C.Alluvial.LINE_MOUSEMOVE,{event:r,element:P(this),datum:s}),n.services.events.dispatchEvent(C.Tooltip.MOVE,{event:r})}).on("click",function(r,s){n.services.events.dispatchEvent(C.Alluvial.LINE_CLICK,{event:r,element:P(this),datum:s})}).on("mouseout",function(r,s){const a=P(this);i(this,"mouseout"),a.classed("link-hovered",!1),n.services.events.dispatchEvent(C.Alluvial.LINE_MOUSEOUT,{event:r,element:a,datum:s}),n.services.events.dispatchEvent(C.Tooltip.HIDE,{event:r,hoveredElement:a})})}addNodeEventListener(){const t=this,n=va((i=[],r="mouseover")=>{if(r==="mouseout"||i.length===0){t.parent.selectAll("path.link").classed("link-hovered",!1).data(this.graph.links,s=>s.index).order().style("stroke-opacity",Oe.opacity.default);return}t.parent.selectAll("path.link").transition().call(s=>this.services.transitions.setupTransition({transition:s,name:"alluvial-link-mouse-highlight"})).style("stroke-opacity",function(s){return i.some(a=>a===s.index)?(P(this).classed("link-hovered",!0).raise(),Oe.opacity.selected):Oe.opacity.unfocus})},66);t.parent.selectAll(".node-group").on("mouseover",function(i,r){const s=P(this),a=[];if(t.traverse({link:"sourceLinks",node:"target"},r,a),t.traverse({link:"targetLinks",node:"source"},r,a),a.length){const o=Mr(s.attr("transform"));if(s.attr("transform",`translate(${o.x-2}, ${o.y})`),s.classed("node-hovered",!0).selectAll("rect.node").attr("width",8),r.x0-2===0){const l=t.services.domUtils.generateElementIDString(`alluvial-node-title-${r.index}`),u=t.parent.select(`g#${l}`),h=Mr(u.attr("transform"));u.attr("transform",`translate(${h.x+4},${h.y})`)}const c=t.services.domUtils.generateElementIDString(`alluvial-node-text-${r.index}`);t.parent.select(`text#${c}`).style("font-weight","bold"),n(a,"mouseover"),t.services.events.dispatchEvent(C.Alluvial.NODE_MOUSEOVER,{event:i,element:s,datum:r})}}).on("mousemove",function(i,r){t.services.events.dispatchEvent(C.Alluvial.NODE_MOUSEMOVE,{event:i,element:P(this),datum:r}),t.services.events.dispatchEvent(C.Tooltip.MOVE,{event:i})}).on("click",function(i,r){t.services.events.dispatchEvent(C.Alluvial.NODE_CLICK,{event:i,element:P(this),datum:r})}).on("mouseout",function(i,r){const s=P(this),a=Mr(s.attr("transform"));if(s.classed("node-hovered",!1).attr("transform",`translate(${a.x+2}, ${a.y})`).select("rect.node").attr("width",Oe.nodeWidth),r.x0-2===0){const c=t.services.domUtils.generateElementIDString(`alluvial-node-title-${r.index}`),l=t.parent.select(`g#${c}`),u=Mr(l.attr("transform"));l.attr("transform",`translate(${u.x-4},${u.y})`)}const o=t.services.domUtils.generateElementIDString(`alluvial-node-text-${r.index}`);t.parent.select(`text#${o}`).style("font-weight","normal"),n([],"mouseout"),t.services.events.dispatchEvent(C.Alluvial.NODE_MOUSEOUT,{event:i,element:s,datum:r}),t.services.events.dispatchEvent(C.Tooltip.HIDE,{hoveredElement:s})})}traverse(t,n,i=[]){n[t.link].map(r=>(i.push(r.index),r[t.node])).forEach(r=>this.traverse(t,r,i))}getRightArrowIcon(){return`
|
|
72
72
|
<svg xmlns="http://www.w3.org/2000/svg" class="arrow-right" width="32" height="32" viewBox="0 0 32 32">
|
|
73
73
|
<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"/>
|
|
74
74
|
<rect width="32" height="32"/>
|
|
75
|
-
</svg>`}destroy(){this.parent.selectAll("path.line,.node-group").on("mouseover",null).on("mousemove",null).on("click",null).on("mouseout",null)}}class ue extends ht{constructor(){super(...arguments),this.type="grid",this.renderType=K.SVG}render(t=!0){const n=E(this.getOptions(),"grid","x","enabled"),i=E(this.getOptions(),"grid","y","enabled");this.drawBackdrop(n,i),!(!n&&!i)&&(n&&(R.appendOrSelect(this.backdrop,"g.x.grid"),this.drawXGrid(t)),i&&(R.appendOrSelect(this.backdrop,"g.y.grid"),this.drawYGrid(t)))}drawXGrid(t){const n=this.parent,i=this.backdrop.attr("height"),r=this.services.cartesianScales.getMainXScale(),s=Ua(r).tickSizeInner(-i).tickSizeOuter(0);if(E(this.getOptions(),"grid","x","alignWithAxisTicks")){const o=this.services.cartesianScales.getDomainAxisPosition(),c=E(this.getOptions(),"axes",o,"ticks","values");c&&s.tickValues(c)}else{const o=E(this.getOptions(),"grid","x","numberOfTicks");s.ticks(o)}const a=n.select(".x.grid").attr("transform",`translate(${-this.backdrop.attr("x")}, ${i})`);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,i=this.backdrop.attr("width"),r=this.services.cartesianScales.getMainYScale(),s=Dc(r).tickSizeInner(-i).tickSizeOuter(0);if(E(this.getOptions(),"grid","y","alignWithAxisTicks")){const o=this.services.cartesianScales.getRangeAxisPosition(),c=E(this.getOptions(),"axes",o,"ticks","values");c&&s.tickValues(c)}else{const o=E(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,i=n.selectAll(".x.grid .tick").nodes().sort((u,h)=>Number(rn(u).tx)-Number(rn(h).tx));let r=-1;if(!i.length)return;i.forEach(u=>{t[0]>=+rn(u).tx&&r++});const s=r+1<i.length?r+1:i.length,a=i[r],o=i[s];let c;if(!a)c=+rn(o).tx;else if(o)c=+rn(o).tx-+rn(a).tx;else{const u=n.select("rect.chart-grid-backdrop").node();c=R.getSVGElementSize(u).width-+rn(a).tx}const{threshold:l}=this.getOptions().tooltip.gridline;return c*l}getActiveGridline(t){const n=E(this.getOptions,"tooltip","gridline","threshold"),i=n||this.getGridlineThreshold(t);return this.parent.selectAll(".x.grid .tick").filter(function(){const r=rn(this),s={min:Number(r.tx)-i,max:Number(r.tx)+i};return s.min<=t[0]&&t[0]<=s.max})}drawBackdrop(t,n){const i=this.parent,r=this.services.cartesianScales.getMainXScale(),s=this.services.cartesianScales.getMainYScale(),[a,o]=r.range(),[c,l]=s.range();this.backdrop=R.appendOrSelect(i,"svg.chart-grid-backdrop");const u=R.appendOrSelect(this.backdrop,t||n?"rect.chart-grid-backdrop.stroked":"rect.chart-grid-backdrop");this.backdrop.merge(u).attr("x",a).attr("y",l).attr("width",Math.abs(o-a)).attr("height",Math.abs(c-l)).lower(),u.attr("width","100%").attr("height","100%")}cleanGrid(t){t.selectAll("text").remove(),t.select(".domain").remove()}}class Fg extends ht{constructor(){super(...arguments),this.type="area",this.renderType=K.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(i=>this.services.transitions.setupTransition({transition:i,name:"legend-hover-area"})).attr("opacity",i=>i.name!==n.datum().name?Qe.opacity.unselected:Qe.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",Qe.opacity.selected)}}init(){const t=this.services.events;t.addEventListener(C.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(C.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t=!0){const n=this.getComponentContainer({withinChartClip:!0}),i=this.getOptions();let r=[0,0];const{cartesianScales:s}=this.services,a=s.getOrientation(),o=rl().curve(this.services.curves.getD3Curve()).defined(_=>{const T=s.getRangeIdentifier();return _[T]!=null}),c=this.model.getGroupedData(this.configs.groups),l=E(i,"bounds"),u=l&&c&&c.length===1;!u&&l&&console.warn(`Bounds can only be shown when having 1 single datagroup, you've supplied ${c.length}`);let h=0;const d=(_,T)=>{E(i,"axes",_,"includeZero")===!1&&T[0]>0&&T[1]>0&&(h=T[0])},f=_=>u?s.getBoundedScaledValues(_)[0]:s.getRangeValue(h),p=_=>u?s.getBoundedScaledValues(_)[1]:s.getRangeValue(_);a===Ht.VERTICAL?(r=s.getMainYScale().domain(),d(s.getMainYAxisPosition(),r),o.x(_=>s.getDomainValue(_)).y0(_=>f(_)).y1(_=>p(_))):(r=s.getMainXScale().domain(),d(s.getMainXAxisPosition(),r),o.x0(_=>f(_)).x1(_=>p(_)).y(_=>s.getDomainValue(_)));const m=E(i,"color","gradient","enabled"),g=c&&c.length===1&&m;c.length>1&&m&&console.error("Gradients can only be enabled when having 1 single dataset");const v=n.selectAll("path.area").data(c,_=>_.name),b=P(this.services.domUtils.getMainContainer());if(v.exit().attr("opacity",0).remove(),!c.length)return;if(g){const _=b.select(`path.${this.model.getColorClassName({classNameTypes:[J.STROKE],dataGroupName:c[0].name})}`).node();let T;if(_)T=getComputedStyle(_,null).getPropertyValue("stroke");else{const S=E(this.model.getOptions(),"color","scale");if(S!==null){const $=Object.keys(S);T=S[$[0]]}}jl.appendOrUpdateLinearGradient({svg:this.parent,id:this.services.domUtils.generateElementIDString(`${c[0].name.replace(" ","")}_${this.gradient_id}`),x1:"0%",x2:"0%",y1:"0%",y2:"100%",stops:jl.getStops(r,T)})}else this.parent.selectAll("defs linearGradient").empty()||this.parent.selectAll("defs linearGradient").each(function(){this.parentNode.remove()});const w=this,O=v.enter().append("path");g?O.merge(v).style("fill",_=>`url(#${this.services.domUtils.generateElementIDString(`${_.name.replace(" ","")}_${this.gradient_id}`)})`).attr("class","area").attr("class",_=>this.model.getColorClassName({classNameTypes:[J.FILL],dataGroupName:_.name,originalClassName:"area"})).attr("d",_=>{const{data:T}=_;return o(T)}):(O.attr("opacity",0).merge(v).attr("class","area").attr("class",_=>this.model.getColorClassName({classNameTypes:[J.FILL,J.STROKE],dataGroupName:_.name,originalClassName:"area"})).style("fill",_=>w.model.getFillColor(_.name)).transition().call(_=>this.services.transitions.setupTransition({transition:_,name:"area-update-enter",animate:t})).attr("opacity",u?1:Qe.opacity.selected).attr("d",_=>{const{data:T}=_;return o(T)}),u&&O.attr("fill-opacity",Qe.opacity.selected).style("stroke",_=>w.model.getStrokeColor(_.name)).style("stroke-dasharray","2, 2").attr("stroke-width",.7+"px"))}destroy(){const t=this.services.events;t.removeEventListener(C.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(C.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}}class Mi extends ht{constructor(){super(...arguments),this.type="line",this.renderType=K.SVG,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail;this.parent.selectAll("path.line").transition("legend-hover-line").call(i=>this.services.transitions.setupTransition({transition:i,name:"legend-hover-line"})).attr("opacity",i=>i.name!==n.datum().name?Je.opacity.unselected:Je.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",Je.opacity.selected)}}init(){const{events:t}=this.services;t.addEventListener(C.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(C.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t=!0){const n=this.getComponentContainer({withinChartClip:!0}),{cartesianScales:i,curves:r}=this.services,s=f=>i.getDomainValue(f),a=f=>i.getRangeValue(f),[o,c]=sn(s,a,i.getOrientation()),l=this.getOptions(),u=lr().x(o).y(c).curve(r.getD3Curve()).defined(f=>{const p=i.getRangeIdentifier(f);return f[p]!=null});let h=[];if(this.configs.stacked){const f=Object.keys(l.axes).some(m=>l.axes[m].percentage),{groupMapsTo:p}=l.data;h=this.model.getStackedData({groups:this.configs.groups,percentage:f}).map(m=>{const g=this.services.cartesianScales.getDomainIdentifier(m),v=this.services.cartesianScales.getRangeIdentifier(m);return{name:E(m,0,p),data:m.map(b=>({[g]:b.data.sharedStackKey,[p]:b[p],[v]:b[1]})),hidden:!dD(m,b=>b[0]!==b[1])}})}else h=this.model.getGroupedData(this.configs.groups);const d=n.selectAll("path.line").data(h,f=>f.name);d.exit().attr("opacity",0).remove(),d.enter().append("path").classed("line",!0).attr("opacity",0).merge(d).data(h,f=>f.name).attr("class",f=>this.model.getColorClassName({classNameTypes:[J.STROKE],dataGroupName:f.name,originalClassName:"line"})).style("stroke",f=>this.model.getStrokeColor(f.name)).attr("role",at.GRAPHICS_SYMBOL).attr("aria-roledescription","line").attr("aria-label",f=>{const{data:p}=f;return p.map(m=>{const g=this.services.cartesianScales.getRangeIdentifier(m);return m[g]}).join(",")}).transition().call(f=>this.services.transitions.setupTransition({transition:f,name:"line-update-enter",animate:t})).attr("opacity",f=>f.hidden?0:1).attr("d",f=>{const{data:p}=f;return u(p)})}destroy(){const t=this.services.events;t.removeEventListener(C.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(C.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}}const zg=5;function Lk(e,t){return e>t-zg&&e<t+zg}let vn=class extends ht{constructor(){super(...arguments),this.type="ruler",this.renderType=K.SVG,this.isXGridEnabled=E(this.getOptions(),"grid","x","enabled"),this.isYGridEnabled=E(this.getOptions(),"grid","y","enabled"),this.isEventListenerAdded=!1}render(t=!0){const n=E(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,i]){const r=this.parent,s=this.services.cartesianScales.getOrientation(),a=this.model.getDisplayData(),o=this.services.cartesianScales.getRangeScale(),[c,l]=o.range(),u=s===Ht.HORIZONTAL?i:n,h=R.appendOrSelect(r,"g.ruler").attr("aria-label","ruler"),d=R.appendOrSelect(h,"line.ruler-line"),f=r.selectAll("[role=graphics-symbol]"),p=a.map(g=>({domainValue:this.services.cartesianScales.getDomainValue(g),originalData:g})).filter(g=>Lk(g.domainValue,u));if(this.pointsWithinLine&&p.length===this.pointsWithinLine.length&&p.map(g=>g.domainValue).join()===this.pointsWithinLine.map(g=>g.domainValue).join())return this.pointsWithinLine=p,this.services.events.dispatchEvent(C.Tooltip.MOVE,{mousePosition:[n,i]});this.pointsWithinLine=p;const m=this.pointsWithinLine.reduce((g,v)=>{if(g.length===0)return g.push(v),g;const b=g[0].domainValue,w=Math.abs(u-v.domainValue),O=Math.abs(u-b);return w>O||(w<O?g=[v]:g.push(v)),g},[]);if(m.length>0){const g=m.map(O=>O.originalData).filter(O=>{const _=this.services.cartesianScales.getRangeIdentifier(O);return O[_]!=null}),v=m.map(O=>O.domainValue),b=f.filter(O=>{const _=this.services.cartesianScales.getDomainValue(O);return v.includes(_)});this.elementsToHighlight&&this.elementsToHighlight.size()>0&&!Sg(this.elementsToHighlight,b)&&this.hideRuler(),b.dispatch("mouseover"),this.elementsToHighlight=b,this.services.events.dispatchEvent(C.Tooltip.SHOW,{mousePosition:[n,i],hoveredElement:d,data:this.formatTooltipData(g)}),h.attr("opacity",1);const w=m[0];s==="horizontal"?d.attr("x1",l).attr("x2",c).attr("y1",w.domainValue).attr("y2",w.domainValue):d.attr("y1",l).attr("y2",c).attr("x1",w.domainValue).attr("x2",w.domainValue)}else this.hideRuler()}hideRuler(){const t=this.parent,n=R.appendOrSelect(t,"g.ruler");t.selectAll("[role=graphics-symbol]").dispatch("mouseout"),this.services.events.dispatchEvent(C.Tooltip.HIDE),n.attr("opacity",0)}addBackdropEventListeners(){this.isEventListenerAdded=!0;const t=this,n=this.services.domUtils.getHolder(),i=this.model.getDisplayData();let r=function(s){const a=wn(s,t.parent.node());t.showRuler(s,a)};if(i.length>100){const s=i.length%50*12.5;r=pA(function(a){const{mousePosition:o}=this;t.showRuler(a,o)},s,n)}this.backdrop.on("mousemove mouseover",r).on("mouseout",this.hideRuler.bind(this))}drawBackdrop(){const t=this.parent;this.backdrop=R.appendOrSelect(t,"svg.chart-grid-backdrop")}};class Ue extends ht{constructor(){super(...arguments),this.type="scatter",this.renderType=K.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:i}=this.getOptions().data;if(!this.parent)throw new Error("Parent not defined");this.parent.selectAll("circle.dot").transition("legend-hover-scatter").call(r=>{var s;return(s=this.services.transitions)==null?void 0:s.setupTransition({transition:r,name:"legend-hover-scatter"})}).attr("opacity",r=>r[i]!==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(C.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(C.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut);const{fadeInOnChartHolderMouseover:n}=this.configs;n&&(t.addEventListener(C.Chart.MOUSEOVER,this.handleChartHolderOnHover),t.addEventListener(C.Chart.MOUSEOUT,this.handleChartHolderOnMouseOut))}filterBasedOnZoomDomain(t){const{cartesianScales:n}=this.services;if(!n)throw new Error("Services cartesianScales are undefined.");const i=n.getDomainIdentifier(t),r=this.model.get("zoomDomain");return r!==void 0?t.filter(s=>s[i].getTime()>=r[0].getTime()&&s[i].getTime()<=r[1].getTime()):t}getScatterData(){const t=this.getOptions(),{stacked:n}=this.configs;let i;if(n){const r=Object.keys(t.axes).some(s=>t.axes[s].percentage);i=this.model.getStackedData({groups:this.configs.groups,percentage:r})}else{const{cartesianScales:r}=this.services;if(!r)throw new Error("Services cartesianScales are undefined.");i=this.model.getDisplayData(this.configs.groups).filter(s=>{const a=r.getRangeIdentifier(s);return s[a]!==void 0&&s[a]!==null})}return this.filterBasedOnZoomDomain(i)}render(t){if(!(E(this.getOptions(),"points","enabled")||E(this.getOptions(),"bubble","enabled")))return;const n=this.getComponentContainer({withinChartClip:!0}),i=this.getOptions(),{groupMapsTo:r}=i.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(),l=>`${l[r]}-${l[a]}`);o.exit().attr("opacity",0).remove();const c=o.enter().append("circle").classed("dot",!0).attr("opacity",0).merge(o);this.styleCircles(c,t),this.addEventListeners()}isDatapointThresholdAnomaly(t){const{handleThresholds:n}=this.configs;if(!n)return!1;const{cartesianScales:i}=this.services;if(!i)throw new Error("Cartesian scales service is undefined");const r=i.getOrientation(),[s,a]=sn(i.getHighestDomainThreshold(),i.getHighestRangeThreshold(),r),[o,c]=sn(h=>i.getDomainValue(h),h=>i.getRangeValue(h),r),l=o(t),u=c(t);return a&&s?u<=a.scaleValue&&l>=s.scaleValue:a?u<=a.scaleValue:s?l>=s.scaleValue:!1}styleCircles(t,n){const i=this.getOptions(),{filled:r,fillOpacity:s}=i.points,{cartesianScales:a}=this.services;if(!a)throw new Error("Cartesian scales service is undefined");const{groupMapsTo:o}=i.data,c=f=>a.getDomainValue(f),l=f=>a.getRangeValue(f),[u,h]=sn(c,l,a.getOrientation()),{fadeInOnChartHolderMouseover:d}=this.configs;t.raise().classed("dot",!0).attr("class",f=>{const p=a.getDomainIdentifier(f),m=this.model.getIsFilled(f[o],f[p],f,r)?[J.FILL,J.STROKE]:[J.STROKE];return this.model.getColorClassName({classNameTypes:m,dataGroupName:f[o],originalClassName:"dot"})||""}).classed("threshold-anomaly",f=>this.isDatapointThresholdAnomaly(f)).classed("filled",f=>{const p=a.getDomainIdentifier(f);return this.model.getIsFilled(f[o],f[p],f,r)}).classed("unfilled",f=>{const p=a.getDomainIdentifier(f);return!this.model.getIsFilled(f[o],f[p],f,r)}).transition().call(f=>{var p;return(p=this.services.transitions)==null?void 0:p.setupTransition({transition:f,name:"scatter-update-enter",animate:n})}).attr("cx",u).attr("cy",h).attr("r",i.points.radius).style("fill",f=>{const p=a.getDomainIdentifier(f);if(this.model.getIsFilled(f[o],f[p],f,r))return this.model.getFillColor(f[o],f[p],f)}).style("stroke",f=>{const p=a.getDomainIdentifier(f);return this.model.getStrokeColor(f[o],f[p],f)}).attr("fill-opacity",r?s:1).attr("opacity",d?0:1).attr("role",at.GRAPHICS_SYMBOL).attr("aria-roledescription","point").attr("aria-label",f=>{const p=a.getRangeIdentifier(f);return f[p]}),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(i,r){var s,a;const o=P(this);o.classed("hovered",!0).attr("class",c=>t.model.getColorClassName({classNameTypes:[J.FILL],dataGroupName:c[n],originalClassName:o.attr("class")})).style("fill",c=>{var l;const u=(l=t.services.cartesianScales)==null?void 0:l.getDomainIdentifier(c);return t.model.getFillColor(c[n],c[u],c)}).classed("unfilled",!1),(s=t.services.events)==null||s.dispatchEvent(C.Tooltip.SHOW,{event:i,hoveredElement:o,data:[r],additionalItems:t.getTooltipAdditionalItems(r)}),(a=t.services.events)==null||a.dispatchEvent(C.Scatter.SCATTER_MOUSEOVER,{event:i,element:o,datum:r})}).on("mousemove",function(i,r){var s,a;const o=P(this);(s=t.services.events)==null||s.dispatchEvent(C.Scatter.SCATTER_MOUSEMOVE,{event:i,element:o,datum:r}),(a=t.services.events)==null||a.dispatchEvent(C.Tooltip.MOVE,{event:i})}).on("click",function(i,r){var s;(s=t.services.events)==null||s.dispatchEvent(C.Scatter.SCATTER_CLICK,{event:i,element:P(this),datum:r})}).on("mouseout",function(i,r){var s,a,o;const c=P(this);if(c.classed("hovered",!1),!t.configs.filled){const{filled:l}=t.getOptions().points,u=(s=t.services.cartesianScales)==null?void 0:s.getDomainIdentifier(r),h=t.model.getIsFilled(r[n],r[u],r,l);c.classed("unfilled",!h).style("fill",d=>h||l?t.model.getFillColor(d[n],d[u],d):null)}(a=t.services.events)==null||a.dispatchEvent(C.Scatter.SCATTER_MOUSEOUT,{event:i,element:c,datum:r}),(o=t.services.events)==null||o.dispatchEvent(C.Tooltip.HIDE,{hoveredElement:c})})}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(C.Legend.ITEM_HOVER,this.handleLegendOnHover),n.removeEventListener(C.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut),n.removeEventListener(C.Chart.MOUSEOVER,this.handleChartHolderOnHover),n.removeEventListener(C.Chart.MOUSEOUT,this.handleChartHolderOnMouseOut)}}let jg=class extends ht{constructor(t,n,i){super(t,n,i),this.type="axes",this.renderType=K.SVG,this.truncation={[H.LEFT]:!1,[H.RIGHT]:!1,[H.TOP]:!1,[H.BOTTOM]:!1},i&&(this.configs=i),this.margins=this.configs.margins}render(t=!0){const{position:n}=this.configs,i=this.getOptions(),r=E(i,"axes",n,"visible"),s=this.getComponentContainer(),{width:a,height:o}=R.getSVGElementSize(s,{useAttrs:!0}),c=R.appendOrSelect(s,`g.axis.${n}`);let l,u;if(n===H.BOTTOM||n===H.TOP?(l=this.configs.axes[H.LEFT]?this.margins.left:0,u=this.configs.axes[H.RIGHT]?a-this.margins.right:a):(l=o-this.margins.bottom,u=this.margins.top),!this.services.cartesianScales)throw new Error("Services cartesianScales undefineds");const h=this.services.cartesianScales.getScaleByPosition(n);this.scaleType===Z.LABELS||this.scaleType===Z.LABELS_RATIO?h.rangeRound([l,u]):h.range([l,u]);let d;switch(n){case H.LEFT:d=Dc;break;case H.BOTTOM:d=Ua;break;case H.RIGHT:d=Sv;break;case H.TOP:d=_v;break}c.attr("aria-label",`${n} axis`);const f=!c.select("g.ticks").empty();let p=R.appendOrSelect(c,"g.ticks");f||(p.attr("role",`${at.GRAPHICS_OBJECT} ${at.GROUP}`),p.attr("aria-label",`${n} ticks`));const m=R.appendOrSelect(c,"g.ticks.invisible").style("opacity","0").style("pointer-events","none").attr("aria-hidden",!0).attr("aria-label",`invisible ${n} ticks`),g=E(i,"axes",n),v=this.scaleType===Z.TIME||g.scaleType===Z.TIME,b=n===H.LEFT||n===H.RIGHT,w=this.model.get("zoomDomain");if(w&&v&&!b&&h.domain(w),!r){p.attr("aria-hidden",!0);return}const O=E(g,"scaleType"),_=E(i,"data","loading"),T=E(g,"ticks","number"),S=E(g,"ticks","values"),$=E(g,"truncation","type"),D=E(g,"truncation","threshold"),L=E(g,"truncation","numCharacter"),M=T!==null,B=E(i,"timeScale"),x=R.appendOrSelect(m,"g.tick"),A=R.appendOrSelect(x,"text").text("0"),y=R.getSVGElementSize(A.node(),{useBBox:!0}).height;x.remove();const k=this.scaleType||g.scaleType||Z.LINEAR,I=d(h).tickSizeOuter(0);if(h.ticks){let j;if(M?j=T:(j=fn.ticks.number,b&&(j=this.getNumberOfFittingTicks(o,y,fn.ticks.verticalSpaceRatio))),h.ticks().length===1&&h.ticks()[0]===0&&(j=0),I.ticks(j),v)if(!h.ticks(j).length)I.tickValues([]);else{const X=E(i,"timeScale","addSpaceOnEdges"),ot=E(i,"axes",n,"domain"),tt=h.copy();X&&!ot&&tt.nice(j);const lt=tt.ticks(j);X&<.length>2&&!ot&&(lt.splice(lt.length-1,1),lt.splice(0,1)),I.tickValues(lt)}}let U;const N=E(g,"ticks","formatter");if(v){const j=Gl(I.tickValues(),E(i,"timeScale","timeInterval"));N===null?U=(X,ot)=>Vl(X,ot,I.tickValues(),j,B):U=(X,ot)=>{const tt=Vl(X,ot,I.tickValues(),j,B);return N(X,ot,tt)}}else N===null?k===Z.LINEAR&&(U=j=>j.toLocaleString()):U=N;I.tickFormat(U);const[F,z]=this.services.cartesianScales.getScaleByPosition(n).domain();let G;if(S){if(v)S.forEach((j,X)=>{j.getTime===void 0&&(S[X]=new Date(j))}),G=S.filter(j=>{const X=j.getTime();return X>=new Date(F).getTime()&&X<=new Date(z).getTime()});else if(O===Z.LABELS){const j=this.services.cartesianScales.getScaleByPosition(n).domain();G=S.filter(X=>j.includes(X))}else G=S.filter(j=>j>=F&&j<=z);I.tickValues(G)}switch(n){case H.LEFT:p.attr("transform",`translate(${this.margins.left}, 0)`);break;case H.BOTTOM:p.attr("transform",`translate(0, ${o-this.margins.bottom})`);break;case H.RIGHT:p.attr("transform",`translate(${a-this.margins.right}, 0)`);break;case H.TOP:p.attr("transform",`translate(0, ${this.margins.top})`);break}const Q=this.model.isDataEmpty();if(g.title){const j=R.appendOrSelect(c,"text.axis-title").html(Q||_?"":g.title),X=E(g,"titleOrientation");let ot;switch(n){case H.LEFT:X===fl.RIGHT?j.attr("transform","rotate(90)").attr("y",0).attr("x",h.range()[0]/2).attr("dy","-0.5em").style("text-anchor","middle"):j.attr("transform","rotate(-90)").attr("y",0).attr("x",-(h.range()[0]/2)).attr("dy","0.75em").style("text-anchor","middle");break;case H.BOTTOM:j.attr("transform",`translate(${this.margins.left/2+h.range()[1]/2}, ${o+4})`).style("text-anchor","middle");break;case H.RIGHT:X===fl.LEFT?j.attr("transform","rotate(-90)").attr("y",a).attr("x",-(h.range()[0]/2)).style("text-anchor","middle"):j.attr("transform","rotate(90)").attr("y",-a).attr("x",h.range()[0]/2).attr("dy","0.75em").style("text-anchor","middle");break;case H.TOP:ot=R.getSVGElementSize(j,{useBBox:!0}).height,j.attr("transform",`translate(${this.margins.left/2+h.range()[1]/2}, ${ot/2})`).style("text-anchor","middle");break}}if(v){const j=Gl(I.tickValues(),E(i,"timeScale","timeInterval")),X=B.showDayName,ot=p;t&&(p=p.transition().call(tt=>this.services.transitions.setupTransition({transition:tt,name:"axis-update",animate:t}))),p=p.call(I),ot.selectAll(".tick").data(I.tickValues(),h).order().select("text").style("font-weight",(tt,lt)=>Np(tt,lt,I.tickValues(),j,X)?"bold":"normal")}else!t||!f?p=p.call(I):p=p.transition().call(j=>this.services.transitions.setupTransition({transition:j,name:"axis-update",animate:t})).call(I);if(m.call(I),n===H.BOTTOM||n===H.TOP){let j=!1;const X=E(g,"ticks","rotation");if(X===Ws.ALWAYS)j=!0;else if(X===Ws.NEVER)j=!1;else if(!X||X===Ws.AUTO)if(h.step)j=m.selectAll("g.tick text").nodes().some(ot=>R.getSVGElementSize(ot,{useBBox:!0}).width>=h.step());else{j=!1;const ot=m.append("text").text("A"),tt=R.getSVGElementSize(ot.node(),{useBBox:!0}).width;let lt;m.selectAll("g.tick").each(function(){const W=P(this),q=parseFloat(E(rn(this),"tx"));q!==null&<+W.text().length*tt*.8>=q&&(j=!0),lt=q}),ot.remove()}j?(M||(I.ticks(this.getNumberOfFittingTicks(a,y,fn.ticks.horizontalSpaceRatio)),m.call(I),p.call(I)),c.selectAll("g.ticks g.tick text").attr("transform","rotate(-45)").attr("text-anchor",n===H.TOP?"start":"end")):c.selectAll("g.ticks g.tick text").attr("transform",null).attr("text-anchor",null)}if(_?c.attr("opacity",0):c.attr("opacity",1),p.selectAll("g.tick").attr("aria-label",j=>j),m.selectAll("g.tick").attr("aria-label",j=>j),$!==Se.NONE&&O===Z.LABELS&&!S){const j=this.services.cartesianScales.getScaleDomain(n);if(j.length>0){const X=s.select(`g.axis.${n} g.ticks g.tick`).html();c.selectAll("g.ticks g.tick").html(X);const ot=this;c.selectAll("g.tick text").data(j).text(function(tt){return tt.length>D?(ot.truncation[n]=!0,Cr(tt,$,L)):tt}),this.getInvisibleAxisRef().selectAll("g.tick text").data(j).text(function(tt){return tt.length>D?Cr(tt,$,L):tt}),c.selectAll("g.ticks").html(this.getInvisibleAxisRef().html()),c.selectAll("g.tick text").data(j)}}this.addEventListeners()}addEventListeners(){const t=this.getComponentContainer(),{position:n}=this.configs,i=R.appendOrSelect(t,`g.axis.${n}`),r=this.getOptions(),s=E(r,"axes",n),a=E(s,"scaleType"),o=E(s,"truncation","threshold"),c=this;i.selectAll("g.tick text").on("mouseover",function(l,u){c.services.events.dispatchEvent(C.Axis.LABEL_MOUSEOVER,{event:l,element:P(this),datum:u}),a===Z.LABELS&&u.length>o&&c.services.events.dispatchEvent(C.Tooltip.SHOW,{event:l,hoveredElement:P(this),content:u})}).on("mousemove",function(l,u){c.services.events.dispatchEvent(C.Axis.LABEL_MOUSEMOVE,{event:l,element:P(this),datum:u}),a===Z.LABELS&&u.length>o&&c.services.events.dispatchEvent(C.Tooltip.MOVE,{event:l})}).on("click",function(l,u){c.services.events.dispatchEvent(C.Axis.LABEL_CLICK,{event:l,element:P(this),datum:u})}).on("mouseout",function(l,u){c.services.events.dispatchEvent(C.Axis.LABEL_MOUSEOUT,{event:l,element:P(this),datum:u}),a===Z.LABELS&&c.services.events.dispatchEvent(C.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,i){const r=Math.floor(t/(n*i));return _g(r,2,fn.ticks.number)}destroy(){const t=this.getComponentContainer(),{position:n}=this.configs;R.appendOrSelect(t,`g.axis.${n}`).selectAll("g.tick text").on("mouseover",null).on("mousemove",null).on("mouseout",null)}};class Dk extends jg{constructor(t,n,i){super(t,n,i)}render(t=!0){super.render(t),super.destroy();const n=this.configs.position,i=this.getComponentContainer(),r=R.appendOrSelect(i,`g.axis.${n}`),s=this;r.selectAll("g.tick").each(function(a,o){const c=P(this);c.classed("tick-hover",!0).attr("tabindex",o===0?0:-1);const l=c.select("text"),{width:u,height:h}=R.getSVGElementSize(l,{useBBox:!0}),d=R.appendOrSelect(c,"rect.axis-holder");let f=0,p=0;switch(n){case H.LEFT:f=-u+Number(l.attr("x")),p=-(h/2);break;case H.RIGHT:f=Math.abs(Number(l.attr("x"))),p=-(h/2);break;case H.TOP:f=-(u/2),p=-h+Number(l.attr("y"))/2,s.truncation[n]&&(f=0,d.attr("transform","rotate(-45)"));break;case H.BOTTOM:f=-(u/2),p=h/2-2,s.truncation[n]&&(f=-u,d.attr("transform","rotate(-45)"));break}d.attr("x",f-fn.hover.rectanglePadding).attr("y",p).attr("width",u+fn.hover.rectanglePadding*2).attr("height",h).lower()}),this.addEventListeners()}addEventListeners(){const t=this.getComponentContainer(),{position:n}=this.configs,i=R.appendOrSelect(t,`g.axis.${n}`),r=this.getOptions(),s=E(r,"axes",n),a=E(s,"scaleType"),o=E(s,"truncation","threshold"),c=this;i.selectAll("g.tick.tick-hover").on("mouseover",function(l){const u=P(this).select("text"),h=u.datum();c.services.events.dispatchEvent(C.Axis.LABEL_MOUSEOVER,{event:l,element:u,datum:h}),a===Z.LABELS&&h.length>o&&c.services.events.dispatchEvent(C.Tooltip.SHOW,{event:l,element:u,datum:h})}).on("mousemove",function(l){const u=P(this).select("text"),h=u.datum();c.services.events.dispatchEvent(C.Axis.LABEL_MOUSEMOVE,{event:l,element:u,datum:h}),c.services.events.dispatchEvent(C.Tooltip.MOVE,{event:l})}).on("click",function(l){c.services.events.dispatchEvent(C.Axis.LABEL_CLICK,{event:l,element:P(this).select("text"),datum:P(this).select("text").datum()})}).on("mouseout",function(l){c.services.events.dispatchEvent(C.Axis.LABEL_MOUSEOUT,{event:l,element:P(this).select("text"),datum:P(this).select("text").datum()}),a===Z.LABELS&&c.services.events.dispatchEvent(C.Tooltip.HIDE)}).on("focus",function(l){const u={clientX:0,clientY:0};if(l.target){l.target.focus();const h=l.target.getBoundingClientRect();u.clientX=h.x,u.clientY=h.y}c.services.events.dispatchEvent(C.Axis.LABEL_FOCUS,{event:{...l,...u},element:P(this),datum:P(this).select("text").datum()})}).on("blur",function(l){c.services.events.dispatchEvent(C.Axis.LABEL_BLUR,{event:l,element:P(this),datum:P(this).select("text").datum()})}).on("keydown",function(l){l.key&&l.key==="Escape"&&(c.services.events.dispatchEvent(C.Tooltip.HIDE),c.services.events.dispatchEvent(C.Axis.LABEL_BLUR,{event:l,element:P(this),datum:P(this).select("text").datum()})),n===H.LEFT||n===H.RIGHT?l.key&&l.key==="ArrowUp"?c.goNext(this,l):l.key&&l.key==="ArrowDown"&&c.goPrevious(this,l):l.key&&l.key==="ArrowLeft"?c.goPrevious(this,l):l.key&&l.key==="ArrowRight"&&c.goNext(this,l)})}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;R.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 re extends ht{constructor(){super(...arguments),this.type="2D-axes",this.renderType=K.SVG,this.children={},this.thresholds=[],this.margins={top:0,right:0,bottom:0,left:0}}render(t=!1){const n={},i=Object.keys(H),r=E(this.getOptions(),"axes");i.forEach(a=>{r[H[a]]&&(n[H[a]]=!0)}),this.configs.axes=n,i.forEach(a=>{const o=H[a];if(this.configs.axes[o]&&!this.children[o]){const c={position:o,axes:this.configs.axes,margins:this.margins},l=this.model.axisFlavor===Ys.DEFAULT?new jg(this.model,this.services,c):new Dk(this.model,this.services,c);l.setModel(this.model),l.setServices(this.services),l.setParent(this.parent),this.children[o]=l}}),Object.keys(this.children).forEach(a=>{this.children[a].render(t)});const s={};Object.keys(this.children).forEach(a=>{const o=this.children[a],c=o.configs.position,l=o.getInvisibleAxisRef(),{width:u,height:h}=R.getSVGElementSize(l,{useBBox:!0});let d;switch(o.getTitleRef().empty()?d=0:(d=R.getSVGElementSize(o.getTitleRef(),{useBBox:!0}).height,(c===H.LEFT||c===H.RIGHT)&&(d+=5)),c){case H.TOP:s.top=h+d;break;case H.BOTTOM:s.bottom=h+d;break;case H.LEFT:s.left=u+d;break;case H.RIGHT:s.right=u+d;break}}),this.services.events.dispatchEvent(C.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(C.ZoomBar.UPDATE),Object.keys(this.children).forEach(a=>{const o=this.children[a];o.margins=this.margins}),this.render(!0))}}class Jt extends ht{constructor(){super(...arguments),this.type="skeleton"}render(t=!0){const n=E(this.getOptions(),"data","loading");n?this.renderSkeleton(n):this.removeSkeleton()}renderSkeleton(t){if(this.configs.skeleton===Pt.GRID)this.renderGridSkeleton(t);else if(this.configs.skeleton===Pt.VERT_OR_HORIZ)this.renderVertOrHorizSkeleton(t);else if(this.configs.skeleton===Pt.PIE)this.renderPieSkeleton(t);else if(this.configs.skeleton===Pt.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===Ht.VERTICAL&&this.drawYGrid(t),n===Ht.HORIZONTAL&&this.drawXGrid(t),this.setShimmerEffect("shimmer-lines")}renderPieSkeleton(t){const n=this.computeOuterRadius(),i=0;this.drawRing(n,i,t),t&&this.setShimmerEffect("shimmer-areas")}renderDonutSkeleton(t){const n=this.computeOuterRadius(),i=this.computeInnerRadius();this.drawRing(n,i,t),t&&this.setShimmerEffect("shimmer-areas")}setScales(){const t=this.services.cartesianScales.getMainXScale().range(),n=this.services.cartesianScales.getMainYScale().range();this.xScale=_e().domain([0,1]).range(t),this.yScale=_e().domain([0,1]).range(n)}drawBackdrop(t){const n=this.parent,{width:i,height:r}=R.getSVGElementSize(n,{useAttrs:!0});this.backdrop=R.appendOrSelect(n,"svg.chart-skeleton.DAII").attr("width",i).attr("height",r);const s=R.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"),i=E(this.getOptions(),"grid","x","numberOfTicks"),r=this.xScale.ticks(i).map(o=>o*n),s=R.appendOrSelect(this.backdrop,"g.x.skeleton"),a=s.selectAll("line").data(r);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"),i=this.backdrop.attr("width"),r=E(this.getOptions(),"grid","y","numberOfTicks"),s=this.xScale.ticks(r).map(c=>c*n),a=R.appendOrSelect(this.backdrop,"g.y.skeleton"),o=a.selectAll("line").data(s);o.enter().append("line").merge(o).attr("x1",0).attr("x2",i).attr("y1",c=>c).attr("y2",c=>c),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,i=!0){const r=this.parent,{width:s,height:a}=R.getSVGElementSize(r,{useAttrs:!0}),o=R.appendOrSelect(r,"svg.chart-skeleton").attr("width",s).attr("height",a),c=n===0?"pie":"donut",l=E(this.getOptions(),c,"alignment");R.appendOrSelect(o,"rect.chart-skeleton-area-container").attr("width",s).attr("height",a).attr("fill","none");const u=or().innerRadius(n).outerRadius(t).startAngle(0).endAngle(Math.PI*2),h=t+Math.abs(_t.radiusOffset),d=t+(Math.min(s,a)-t*2)/2,f=R.appendOrSelect(o,"path").attr("class","skeleton-area-shape").attr("transform",`translate(${h}, ${d})`).attr("d",u).classed("shimmer-effect-areas",i).classed("empty-state-areas",!i).style("fill",i?`url(#${this.services.domUtils.generateElementIDString("shimmer-areas")})`:null);let p=t+_t.xOffset;l===It.CENTER?p=s/2:l===It.RIGHT&&(p=s-t-_t.xOffset);const m=t+_t.yOffset;f.attr("transform",`translate(${p}, ${m})`)}computeOuterRadius(){const{width:t,height:n}=R.getSVGElementSize(this.parent,{useAttrs:!0});return Math.min(t,n)/2+_t.radiusOffset}computeInnerRadius(){return this.computeOuterRadius()*(3/4)}setShimmerEffect(t){const n="stop-bg-shimmer",i="stop-shimmer",r=this.parent.select(".chart-skeleton"),{width:s}=R.getSVGElementSize(this.parent,{useAttrs:!0}),a=0,o=s,c=R.appendOrSelect(r,"defs").lower(),l=R.appendOrSelect(c,"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=`
|
|
75
|
+
</svg>`}destroy(){this.parent.selectAll("path.line,.node-group").on("mouseover",null).on("mousemove",null).on("click",null).on("mouseout",null)}}class ue extends ht{constructor(){super(...arguments),this.type="grid",this.renderType=K.SVG}render(t=!0){const n=E(this.getOptions(),"grid","x","enabled"),i=E(this.getOptions(),"grid","y","enabled");this.drawBackdrop(n,i),!(!n&&!i)&&(n&&(R.appendOrSelect(this.backdrop,"g.x.grid"),this.drawXGrid(t)),i&&(R.appendOrSelect(this.backdrop,"g.y.grid"),this.drawYGrid(t)))}drawXGrid(t){const n=this.parent,i=this.backdrop.attr("height"),r=this.services.cartesianScales.getMainXScale(),s=Ua(r).tickSizeInner(-i).tickSizeOuter(0);if(E(this.getOptions(),"grid","x","alignWithAxisTicks")){const o=this.services.cartesianScales.getDomainAxisPosition(),c=E(this.getOptions(),"axes",o,"ticks","values");c&&s.tickValues(c)}else{const o=E(this.getOptions(),"grid","x","numberOfTicks");s.ticks(o)}const a=n.select(".x.grid").attr("transform",`translate(${-this.backdrop.attr("x")}, ${i})`);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,i=this.backdrop.attr("width"),r=this.services.cartesianScales.getMainYScale(),s=Dc(r).tickSizeInner(-i).tickSizeOuter(0);if(E(this.getOptions(),"grid","y","alignWithAxisTicks")){const o=this.services.cartesianScales.getRangeAxisPosition(),c=E(this.getOptions(),"axes",o,"ticks","values");c&&s.tickValues(c)}else{const o=E(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,i=n.selectAll(".x.grid .tick").nodes().sort((u,h)=>Number(rn(u).tx)-Number(rn(h).tx));let r=-1;if(!i.length)return;i.forEach(u=>{t[0]>=+rn(u).tx&&r++});const s=r+1<i.length?r+1:i.length,a=i[r],o=i[s];let c;if(!a)c=+rn(o).tx;else if(o)c=+rn(o).tx-+rn(a).tx;else{const u=n.select("rect.chart-grid-backdrop").node();c=R.getSVGElementSize(u).width-+rn(a).tx}const{threshold:l}=this.getOptions().tooltip.gridline;return c*l}getActiveGridline(t){const n=E(this.getOptions,"tooltip","gridline","threshold"),i=n||this.getGridlineThreshold(t);return this.parent.selectAll(".x.grid .tick").filter(function(){const r=rn(this),s={min:Number(r.tx)-i,max:Number(r.tx)+i};return s.min<=t[0]&&t[0]<=s.max})}drawBackdrop(t,n){const i=this.parent,r=this.services.cartesianScales.getMainXScale(),s=this.services.cartesianScales.getMainYScale(),[a,o]=r.range(),[c,l]=s.range();this.backdrop=R.appendOrSelect(i,"svg.chart-grid-backdrop");const u=R.appendOrSelect(this.backdrop,t||n?"rect.chart-grid-backdrop.stroked":"rect.chart-grid-backdrop");this.backdrop.merge(u).attr("x",a).attr("y",l).attr("width",Math.abs(o-a)).attr("height",Math.abs(c-l)).lower(),u.attr("width","100%").attr("height","100%")}cleanGrid(t){t.selectAll("text").remove(),t.select(".domain").remove()}}class Fg extends ht{constructor(){super(...arguments),this.type="area",this.renderType=K.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(i=>this.services.transitions.setupTransition({transition:i,name:"legend-hover-area"})).attr("opacity",i=>i.name!==n.datum().name?Qe.opacity.unselected:Qe.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",Qe.opacity.selected)}}init(){const t=this.services.events;t.addEventListener(C.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(C.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t=!0){const n=this.getComponentContainer({withinChartClip:!0}),i=this.getOptions();let r=[0,0];const{cartesianScales:s}=this.services,a=s.getOrientation(),o=rl().curve(this.services.curves.getD3Curve()).defined(_=>{const T=s.getRangeIdentifier();return _[T]!=null}),c=this.model.getGroupedData(this.configs.groups),l=E(i,"bounds"),u=l&&c&&c.length===1;!u&&l&&console.warn(`Bounds can only be shown when having 1 single datagroup, you've supplied ${c.length}`);let h=0;const d=(_,T)=>{E(i,"axes",_,"includeZero")===!1&&T[0]>0&&T[1]>0&&(h=T[0])},f=_=>u?s.getBoundedScaledValues(_)[0]:s.getRangeValue(h),p=_=>u?s.getBoundedScaledValues(_)[1]:s.getRangeValue(_);a===Ht.VERTICAL?(r=s.getMainYScale().domain(),d(s.getMainYAxisPosition(),r),o.x(_=>s.getDomainValue(_)).y0(_=>f(_)).y1(_=>p(_))):(r=s.getMainXScale().domain(),d(s.getMainXAxisPosition(),r),o.x0(_=>f(_)).x1(_=>p(_)).y(_=>s.getDomainValue(_)));const m=E(i,"color","gradient","enabled"),g=c&&c.length===1&&m;c.length>1&&m&&console.error("Gradients can only be enabled when having 1 single dataset");const v=n.selectAll("path.area").data(c,_=>_.name),b=P(this.services.domUtils.getMainContainer());if(v.exit().attr("opacity",0).remove(),!c.length)return;if(g){const _=b.select(`path.${this.model.getColorClassName({classNameTypes:[J.STROKE],dataGroupName:c[0].name})}`).node();let T;if(_)T=getComputedStyle(_,null).getPropertyValue("stroke");else{const S=E(this.model.getOptions(),"color","scale");if(S!==null){const $=Object.keys(S);T=S[$[0]]}}jl.appendOrUpdateLinearGradient({svg:this.parent,id:this.services.domUtils.generateElementIDString(`${c[0].name.replace(" ","")}_${this.gradient_id}`),x1:"0%",x2:"0%",y1:"0%",y2:"100%",stops:jl.getStops(r,T)})}else this.parent.selectAll("defs linearGradient").empty()||this.parent.selectAll("defs linearGradient").each(function(){this.parentNode.remove()});const w=this,O=v.enter().append("path");g?O.merge(v).style("fill",_=>`url(#${this.services.domUtils.generateElementIDString(`${_.name.replace(" ","")}_${this.gradient_id}`)})`).attr("class","area").attr("class",_=>this.model.getColorClassName({classNameTypes:[J.FILL],dataGroupName:_.name,originalClassName:"area"})).attr("d",_=>{const{data:T}=_;return o(T)}):(O.attr("opacity",0).merge(v).attr("class","area").attr("class",_=>this.model.getColorClassName({classNameTypes:[J.FILL,J.STROKE],dataGroupName:_.name,originalClassName:"area"})).style("fill",_=>w.model.getFillColor(_.name)).transition().call(_=>this.services.transitions.setupTransition({transition:_,name:"area-update-enter",animate:t})).attr("opacity",u?1:Qe.opacity.selected).attr("d",_=>{const{data:T}=_;return o(T)}),u&&O.attr("fill-opacity",Qe.opacity.selected).style("stroke",_=>w.model.getStrokeColor(_.name)).style("stroke-dasharray","2, 2").attr("stroke-width",.7+"px"))}destroy(){const t=this.services.events;t.removeEventListener(C.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(C.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}}class Mi extends ht{constructor(){super(...arguments),this.type="line",this.renderType=K.SVG,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail;this.parent.selectAll("path.line").transition("legend-hover-line").call(i=>this.services.transitions.setupTransition({transition:i,name:"legend-hover-line"})).attr("opacity",i=>i.name!==n.datum().name?Je.opacity.unselected:Je.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",Je.opacity.selected)}}init(){const{events:t}=this.services;t.addEventListener(C.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(C.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t=!0){const n=this.getComponentContainer({withinChartClip:!0}),{cartesianScales:i,curves:r}=this.services,s=f=>i.getDomainValue(f),a=f=>i.getRangeValue(f),[o,c]=sn(s,a,i.getOrientation()),l=this.getOptions(),u=lr().x(o).y(c).curve(r.getD3Curve()).defined(f=>{const p=i.getRangeIdentifier(f);return f[p]!=null});let h=[];if(this.configs.stacked){const f=Object.keys(l.axes).some(m=>l.axes[m].percentage),{groupMapsTo:p}=l.data;h=this.model.getStackedData({groups:this.configs.groups,percentage:f}).map(m=>{const g=this.services.cartesianScales.getDomainIdentifier(m),v=this.services.cartesianScales.getRangeIdentifier(m);return{name:E(m,0,p),data:m.map(b=>({[g]:b.data.sharedStackKey,[p]:b[p],[v]:b[1]})),hidden:!dD(m,b=>b[0]!==b[1])}})}else h=this.model.getGroupedData(this.configs.groups);const d=n.selectAll("path.line").data(h,f=>f.name);d.exit().attr("opacity",0).remove(),d.enter().append("path").classed("line",!0).attr("opacity",0).merge(d).data(h,f=>f.name).attr("class",f=>this.model.getColorClassName({classNameTypes:[J.STROKE],dataGroupName:f.name,originalClassName:"line"})).style("stroke",f=>this.model.getStrokeColor(f.name)).attr("role",at.GRAPHICS_SYMBOL).attr("aria-roledescription","line").attr("aria-label",f=>{const{data:p}=f;return p.map(m=>{const g=this.services.cartesianScales.getRangeIdentifier(m);return m[g]}).join(",")}).transition().call(f=>this.services.transitions.setupTransition({transition:f,name:"line-update-enter",animate:t})).attr("opacity",f=>f.hidden?0:1).attr("d",f=>{const{data:p}=f;return u(p)})}destroy(){const t=this.services.events;t.removeEventListener(C.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(C.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}}const zg=5;function Lk(e,t){return e>t-zg&&e<t+zg}let vn=class extends ht{constructor(){super(...arguments),this.type="ruler",this.renderType=K.SVG,this.isXGridEnabled=E(this.getOptions(),"grid","x","enabled"),this.isYGridEnabled=E(this.getOptions(),"grid","y","enabled"),this.isEventListenerAdded=!1}render(t=!1){const n=E(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,i]){const r=this.parent,s=this.services.cartesianScales.getOrientation(),a=this.model.getDisplayData(),o=this.services.cartesianScales.getRangeScale(),[c,l]=o.range(),u=s===Ht.HORIZONTAL?i:n,h=R.appendOrSelect(r,"g.ruler").attr("aria-label","ruler"),d=R.appendOrSelect(h,"line.ruler-line"),f=r.selectAll("[role=graphics-symbol]"),p=a.map(g=>({domainValue:this.services.cartesianScales.getDomainValue(g),originalData:g})).filter(g=>Lk(g.domainValue,u));if(this.pointsWithinLine&&p.length===this.pointsWithinLine.length&&p.map(g=>g.domainValue).join()===this.pointsWithinLine.map(g=>g.domainValue).join())return this.pointsWithinLine=p,this.services.events.dispatchEvent(C.Tooltip.MOVE,{mousePosition:[n,i]});this.pointsWithinLine=p;const m=this.pointsWithinLine.reduce((g,v)=>{if(g.length===0)return g.push(v),g;const b=g[0].domainValue,w=Math.abs(u-v.domainValue),O=Math.abs(u-b);return w>O||(w<O?g=[v]:g.push(v)),g},[]);if(m.length>0){const g=m.map(O=>O.originalData).filter(O=>{const _=this.services.cartesianScales.getRangeIdentifier(O);return O[_]!=null}),v=m.map(O=>O.domainValue),b=f.filter(O=>{const _=this.services.cartesianScales.getDomainValue(O);return v.includes(_)});this.elementsToHighlight&&this.elementsToHighlight.size()>0&&!Sg(this.elementsToHighlight,b)&&this.hideRuler(),b.dispatch("mouseover"),this.elementsToHighlight=b,this.services.events.dispatchEvent(C.Tooltip.SHOW,{mousePosition:[n,i],hoveredElement:d,data:this.formatTooltipData(g)}),h.attr("opacity",1);const w=m[0];s==="horizontal"?d.attr("x1",l).attr("x2",c).attr("y1",w.domainValue).attr("y2",w.domainValue):d.attr("y1",l).attr("y2",c).attr("x1",w.domainValue).attr("x2",w.domainValue)}else this.hideRuler()}hideRuler(){const t=this.parent,n=R.appendOrSelect(t,"g.ruler");t.selectAll("[role=graphics-symbol]").dispatch("mouseout"),this.services.events.dispatchEvent(C.Tooltip.HIDE),n.attr("opacity",0)}addBackdropEventListeners(){this.isEventListenerAdded=!0;const t=this,n=this.services.domUtils.getHolder(),i=this.model.getDisplayData();let r=function(s){const a=wn(s,t.parent.node());t.showRuler(s,a)};if(i.length>100){const s=i.length%50*12.5;r=pA(function(a){const{mousePosition:o}=this;t.showRuler(a,o)},s,n)}this.backdrop.on("mousemove mouseover",r).on("mouseout",this.hideRuler.bind(this))}drawBackdrop(){const t=this.parent;this.backdrop=R.appendOrSelect(t,"svg.chart-grid-backdrop")}};class Ue extends ht{constructor(){super(...arguments),this.type="scatter",this.renderType=K.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:i}=this.getOptions().data;if(!this.parent)throw new Error("Parent not defined");this.parent.selectAll("circle.dot").transition("legend-hover-scatter").call(r=>{var s;return(s=this.services.transitions)==null?void 0:s.setupTransition({transition:r,name:"legend-hover-scatter"})}).attr("opacity",r=>r[i]!==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(C.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(C.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut);const{fadeInOnChartHolderMouseover:n}=this.configs;n&&(t.addEventListener(C.Chart.MOUSEOVER,this.handleChartHolderOnHover),t.addEventListener(C.Chart.MOUSEOUT,this.handleChartHolderOnMouseOut))}filterBasedOnZoomDomain(t){const{cartesianScales:n}=this.services;if(!n)throw new Error("Services cartesianScales are undefined.");const i=n.getDomainIdentifier(t),r=this.model.get("zoomDomain");return r!==void 0?t.filter(s=>s[i].getTime()>=r[0].getTime()&&s[i].getTime()<=r[1].getTime()):t}getScatterData(){const t=this.getOptions(),{stacked:n}=this.configs;let i;if(n){const r=Object.keys(t.axes).some(s=>t.axes[s].percentage);i=this.model.getStackedData({groups:this.configs.groups,percentage:r})}else{const{cartesianScales:r}=this.services;if(!r)throw new Error("Services cartesianScales are undefined.");i=this.model.getDisplayData(this.configs.groups).filter(s=>{const a=r.getRangeIdentifier(s);return s[a]!==void 0&&s[a]!==null})}return this.filterBasedOnZoomDomain(i)}render(t){if(!(E(this.getOptions(),"points","enabled")||E(this.getOptions(),"bubble","enabled")))return;const n=this.getComponentContainer({withinChartClip:!0}),i=this.getOptions(),{groupMapsTo:r}=i.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(),l=>`${l[r]}-${l[a]}`);o.exit().attr("opacity",0).remove();const c=o.enter().append("circle").classed("dot",!0).attr("opacity",0).merge(o);this.styleCircles(c,t),this.addEventListeners()}isDatapointThresholdAnomaly(t){const{handleThresholds:n}=this.configs;if(!n)return!1;const{cartesianScales:i}=this.services;if(!i)throw new Error("Cartesian scales service is undefined");const r=i.getOrientation(),[s,a]=sn(i.getHighestDomainThreshold(),i.getHighestRangeThreshold(),r),[o,c]=sn(h=>i.getDomainValue(h),h=>i.getRangeValue(h),r),l=o(t),u=c(t);return a&&s?u<=a.scaleValue&&l>=s.scaleValue:a?u<=a.scaleValue:s?l>=s.scaleValue:!1}styleCircles(t,n){const i=this.getOptions(),{filled:r,fillOpacity:s}=i.points,{cartesianScales:a}=this.services;if(!a)throw new Error("Cartesian scales service is undefined");const{groupMapsTo:o}=i.data,c=f=>a.getDomainValue(f),l=f=>a.getRangeValue(f),[u,h]=sn(c,l,a.getOrientation()),{fadeInOnChartHolderMouseover:d}=this.configs;t.raise().classed("dot",!0).attr("class",f=>{const p=a.getDomainIdentifier(f),m=this.model.getIsFilled(f[o],f[p],f,r)?[J.FILL,J.STROKE]:[J.STROKE];return this.model.getColorClassName({classNameTypes:m,dataGroupName:f[o],originalClassName:"dot"})||""}).classed("threshold-anomaly",f=>this.isDatapointThresholdAnomaly(f)).classed("filled",f=>{const p=a.getDomainIdentifier(f);return this.model.getIsFilled(f[o],f[p],f,r)}).classed("unfilled",f=>{const p=a.getDomainIdentifier(f);return!this.model.getIsFilled(f[o],f[p],f,r)}).transition().call(f=>{var p;return(p=this.services.transitions)==null?void 0:p.setupTransition({transition:f,name:"scatter-update-enter",animate:n})}).attr("cx",u).attr("cy",h).attr("r",i.points.radius).style("fill",f=>{const p=a.getDomainIdentifier(f);if(this.model.getIsFilled(f[o],f[p],f,r))return this.model.getFillColor(f[o],f[p],f)}).style("stroke",f=>{const p=a.getDomainIdentifier(f);return this.model.getStrokeColor(f[o],f[p],f)}).attr("fill-opacity",r?s:1).attr("opacity",d?0:1).attr("role",at.GRAPHICS_SYMBOL).attr("aria-roledescription","point").attr("aria-label",f=>{const p=a.getRangeIdentifier(f);return f[p]}),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(i,r){var s,a;const o=P(this);o.classed("hovered",!0).attr("class",c=>t.model.getColorClassName({classNameTypes:[J.FILL],dataGroupName:c[n],originalClassName:o.attr("class")})).style("fill",c=>{var l;const u=(l=t.services.cartesianScales)==null?void 0:l.getDomainIdentifier(c);return t.model.getFillColor(c[n],c[u],c)}).classed("unfilled",!1),(s=t.services.events)==null||s.dispatchEvent(C.Tooltip.SHOW,{event:i,hoveredElement:o,data:[r],additionalItems:t.getTooltipAdditionalItems(r)}),(a=t.services.events)==null||a.dispatchEvent(C.Scatter.SCATTER_MOUSEOVER,{event:i,element:o,datum:r})}).on("mousemove",function(i,r){var s,a;const o=P(this);(s=t.services.events)==null||s.dispatchEvent(C.Scatter.SCATTER_MOUSEMOVE,{event:i,element:o,datum:r}),(a=t.services.events)==null||a.dispatchEvent(C.Tooltip.MOVE,{event:i})}).on("click",function(i,r){var s;(s=t.services.events)==null||s.dispatchEvent(C.Scatter.SCATTER_CLICK,{event:i,element:P(this),datum:r})}).on("mouseout",function(i,r){var s,a,o;const c=P(this);if(c.classed("hovered",!1),!t.configs.filled){const{filled:l}=t.getOptions().points,u=(s=t.services.cartesianScales)==null?void 0:s.getDomainIdentifier(r),h=t.model.getIsFilled(r[n],r[u],r,l);c.classed("unfilled",!h).style("fill",d=>h||l?t.model.getFillColor(d[n],d[u],d):null)}(a=t.services.events)==null||a.dispatchEvent(C.Scatter.SCATTER_MOUSEOUT,{event:i,element:c,datum:r}),(o=t.services.events)==null||o.dispatchEvent(C.Tooltip.HIDE,{hoveredElement:c})})}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(C.Legend.ITEM_HOVER,this.handleLegendOnHover),n.removeEventListener(C.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut),n.removeEventListener(C.Chart.MOUSEOVER,this.handleChartHolderOnHover),n.removeEventListener(C.Chart.MOUSEOUT,this.handleChartHolderOnMouseOut)}}let jg=class extends ht{constructor(t,n,i){super(t,n,i),this.type="axes",this.renderType=K.SVG,this.truncation={[H.LEFT]:!1,[H.RIGHT]:!1,[H.TOP]:!1,[H.BOTTOM]:!1},i&&(this.configs=i),this.margins=this.configs.margins}render(t=!0){const{position:n}=this.configs,i=this.getOptions(),r=E(i,"axes",n,"visible"),s=this.getComponentContainer(),{width:a,height:o}=R.getSVGElementSize(s,{useAttrs:!0}),c=R.appendOrSelect(s,`g.axis.${n}`);let l,u;if(n===H.BOTTOM||n===H.TOP?(l=this.configs.axes[H.LEFT]?this.margins.left:0,u=this.configs.axes[H.RIGHT]?a-this.margins.right:a):(l=o-this.margins.bottom,u=this.margins.top),!this.services.cartesianScales)throw new Error("Services cartesianScales undefined");const h=this.services.cartesianScales.getScaleByPosition(n);this.scaleType===Z.LABELS||this.scaleType===Z.LABELS_RATIO?h.rangeRound([l,u]):h.range([l,u]);let d;switch(n){case H.LEFT:d=Dc;break;case H.BOTTOM:d=Ua;break;case H.RIGHT:d=Sv;break;case H.TOP:d=_v;break}c.attr("aria-label",`${n} axis`);const f=!c.select("g.ticks").empty();let p=R.appendOrSelect(c,"g.ticks");f||(p.attr("role",`${at.GRAPHICS_OBJECT} ${at.GROUP}`),p.attr("aria-label",`${n} ticks`));const m=R.appendOrSelect(c,"g.ticks.invisible").style("opacity","0").style("pointer-events","none").attr("aria-hidden",!0).attr("aria-label",`invisible ${n} ticks`),g=E(i,"axes",n),v=this.scaleType===Z.TIME||g.scaleType===Z.TIME,b=n===H.LEFT||n===H.RIGHT,w=this.model.get("zoomDomain");if(w&&v&&!b&&h.domain(w),!r){p.attr("aria-hidden",!0);return}const O=E(g,"scaleType"),_=E(i,"data","loading"),T=E(g,"ticks","number"),S=E(g,"ticks","values"),$=E(g,"truncation","type"),D=E(g,"truncation","threshold"),L=E(g,"truncation","numCharacter"),M=T!==null,B=E(i,"timeScale"),x=R.appendOrSelect(m,"g.tick"),A=R.appendOrSelect(x,"text").text("0"),y=R.getSVGElementSize(A.node(),{useBBox:!0}).height;x.remove();const k=this.scaleType||g.scaleType||Z.LINEAR,I=d(h).tickSizeOuter(0);if(h.ticks){let j;if(M?j=T:(j=fn.ticks.number,b&&(j=this.getNumberOfFittingTicks(o,y,fn.ticks.verticalSpaceRatio))),h.ticks().length===1&&h.ticks()[0]===0&&(j=0),I.ticks(j),v)if(!h.ticks(j).length)I.tickValues([]);else{const X=E(i,"timeScale","addSpaceOnEdges"),ot=E(i,"axes",n,"domain"),tt=h.copy();X&&!ot&&tt.nice(j);const lt=tt.ticks(j);X&<.length>2&&!ot&&(lt.splice(lt.length-1,1),lt.splice(0,1)),I.tickValues(lt)}}let U;const N=E(g,"ticks","formatter");if(v){const j=Gl(I.tickValues(),E(i,"timeScale","timeInterval"));N===null?U=(X,ot)=>Vl(X,ot,I.tickValues(),j,B):U=(X,ot)=>{const tt=Vl(X,ot,I.tickValues(),j,B);return N(X,ot,tt)}}else N===null?k===Z.LINEAR&&(U=j=>j.toLocaleString()):U=N;I.tickFormat(U);const[F,z]=this.services.cartesianScales.getScaleByPosition(n).domain();let G;if(S){if(v)S.forEach((j,X)=>{j.getTime===void 0&&(S[X]=new Date(j))}),G=S.filter(j=>{const X=j.getTime();return X>=new Date(F).getTime()&&X<=new Date(z).getTime()});else if(O===Z.LABELS){const j=this.services.cartesianScales.getScaleByPosition(n).domain();G=S.filter(X=>j.includes(X))}else G=S.filter(j=>j>=F&&j<=z);I.tickValues(G)}switch(n){case H.LEFT:p.attr("transform",`translate(${this.margins.left}, 0)`);break;case H.BOTTOM:p.attr("transform",`translate(0, ${o-this.margins.bottom})`);break;case H.RIGHT:p.attr("transform",`translate(${a-this.margins.right}, 0)`);break;case H.TOP:p.attr("transform",`translate(0, ${this.margins.top})`);break}const Q=this.model.isDataEmpty();if(g.title){const j=R.appendOrSelect(c,"text.axis-title").html(Q||_?"":g.title),X=E(g,"titleOrientation");let ot;switch(n){case H.LEFT:X===fl.RIGHT?j.attr("transform","rotate(90)").attr("y",0).attr("x",h.range()[0]/2).attr("dy","-0.5em").style("text-anchor","middle"):j.attr("transform","rotate(-90)").attr("y",0).attr("x",-(h.range()[0]/2)).attr("dy","0.75em").style("text-anchor","middle");break;case H.BOTTOM:j.attr("transform",`translate(${this.margins.left/2+h.range()[1]/2}, ${o+4})`).style("text-anchor","middle");break;case H.RIGHT:X===fl.LEFT?j.attr("transform","rotate(-90)").attr("y",a).attr("x",-(h.range()[0]/2)).style("text-anchor","middle"):j.attr("transform","rotate(90)").attr("y",-a).attr("x",h.range()[0]/2).attr("dy","0.75em").style("text-anchor","middle");break;case H.TOP:ot=R.getSVGElementSize(j,{useBBox:!0}).height,j.attr("transform",`translate(${this.margins.left/2+h.range()[1]/2}, ${ot/2})`).style("text-anchor","middle");break}}if(v){const j=Gl(I.tickValues(),E(i,"timeScale","timeInterval")),X=B.showDayName,ot=p;t&&(p=p.transition().call(tt=>this.services.transitions.setupTransition({transition:tt,name:"axis-update",animate:t}))),p=p.call(I),ot.selectAll(".tick").data(I.tickValues(),h).order().select("text").style("font-weight",(tt,lt)=>Np(tt,lt,I.tickValues(),j,X)?"bold":"normal")}else!t||!f?p=p.call(I):p=p.transition().call(j=>this.services.transitions.setupTransition({transition:j,name:"axis-update",animate:t})).call(I);if(m.call(I),n===H.BOTTOM||n===H.TOP){let j=!1;const X=E(g,"ticks","rotation");if(X===Ws.ALWAYS)j=!0;else if(X===Ws.NEVER)j=!1;else if(!X||X===Ws.AUTO)if(h.step)j=m.selectAll("g.tick text").nodes().some(ot=>R.getSVGElementSize(ot,{useBBox:!0}).width>=h.step());else{j=!1;const ot=m.append("text").text("A"),tt=R.getSVGElementSize(ot.node(),{useBBox:!0}).width;let lt;m.selectAll("g.tick").each(function(){const W=P(this),q=parseFloat(E(rn(this),"tx"));q!==null&<+W.text().length*tt*.8>=q&&(j=!0),lt=q}),ot.remove()}j?(M||(I.ticks(this.getNumberOfFittingTicks(a,y,fn.ticks.horizontalSpaceRatio)),m.call(I),p.call(I)),c.selectAll("g.ticks g.tick text").attr("transform","rotate(-45)").attr("text-anchor",n===H.TOP?"start":"end")):c.selectAll("g.ticks g.tick text").attr("transform",null).attr("text-anchor",null)}if(_?c.attr("opacity",0):c.attr("opacity",1),p.selectAll("g.tick").attr("aria-label",j=>j),m.selectAll("g.tick").attr("aria-label",j=>j),$!==Se.NONE&&O===Z.LABELS&&!S){const j=this.services.cartesianScales.getScaleDomain(n);if(j.length>0){const X=s.select(`g.axis.${n} g.ticks g.tick`).html();c.selectAll("g.ticks g.tick").html(X);const ot=this;c.selectAll("g.tick text").data(j).text(function(tt){return tt.length>D?(ot.truncation[n]=!0,Cr(tt,$,L)):tt}),this.getInvisibleAxisRef().selectAll("g.tick text").data(j).text(function(tt){return tt.length>D?Cr(tt,$,L):tt}),c.selectAll("g.ticks").html(this.getInvisibleAxisRef().html()),c.selectAll("g.tick text").data(j)}}this.addEventListeners()}addEventListeners(){const t=this.getComponentContainer(),{position:n}=this.configs,i=R.appendOrSelect(t,`g.axis.${n}`),r=this.getOptions(),s=E(r,"axes",n),a=E(s,"scaleType"),o=E(s,"truncation","threshold"),c=this;i.selectAll("g.tick text").on("mouseover",function(l,u){c.services.events.dispatchEvent(C.Axis.LABEL_MOUSEOVER,{event:l,element:P(this),datum:u}),a===Z.LABELS&&u.length>o&&c.services.events.dispatchEvent(C.Tooltip.SHOW,{event:l,hoveredElement:P(this),content:u})}).on("mousemove",function(l,u){c.services.events.dispatchEvent(C.Axis.LABEL_MOUSEMOVE,{event:l,element:P(this),datum:u}),a===Z.LABELS&&u.length>o&&c.services.events.dispatchEvent(C.Tooltip.MOVE,{event:l})}).on("click",function(l,u){c.services.events.dispatchEvent(C.Axis.LABEL_CLICK,{event:l,element:P(this),datum:u})}).on("mouseout",function(l,u){c.services.events.dispatchEvent(C.Axis.LABEL_MOUSEOUT,{event:l,element:P(this),datum:u}),a===Z.LABELS&&c.services.events.dispatchEvent(C.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,i){const r=Math.floor(t/(n*i));return _g(r,2,fn.ticks.number)}destroy(){const t=this.getComponentContainer(),{position:n}=this.configs;R.appendOrSelect(t,`g.axis.${n}`).selectAll("g.tick text").on("mouseover",null).on("mousemove",null).on("mouseout",null)}};class Dk extends jg{constructor(t,n,i){super(t,n,i)}render(t=!0){super.render(t),super.destroy();const n=this.configs.position,i=this.getComponentContainer(),r=R.appendOrSelect(i,`g.axis.${n}`),s=this;r.selectAll("g.tick").each(function(a,o){const c=P(this);c.classed("tick-hover",!0).attr("tabindex",o===0?0:-1);const l=c.select("text"),{width:u,height:h}=R.getSVGElementSize(l,{useBBox:!0}),d=R.appendOrSelect(c,"rect.axis-holder");let f=0,p=0;switch(n){case H.LEFT:f=-u+Number(l.attr("x")),p=-(h/2);break;case H.RIGHT:f=Math.abs(Number(l.attr("x"))),p=-(h/2);break;case H.TOP:f=-(u/2),p=-h+Number(l.attr("y"))/2,s.truncation[n]&&(f=0,d.attr("transform","rotate(-45)"));break;case H.BOTTOM:f=-(u/2),p=h/2-2,s.truncation[n]&&(f=-u,d.attr("transform","rotate(-45)"));break}d.attr("x",f-fn.hover.rectanglePadding).attr("y",p).attr("width",u+fn.hover.rectanglePadding*2).attr("height",h).lower()}),this.addEventListeners()}addEventListeners(){const t=this.getComponentContainer(),{position:n}=this.configs,i=R.appendOrSelect(t,`g.axis.${n}`),r=this.getOptions(),s=E(r,"axes",n),a=E(s,"scaleType"),o=E(s,"truncation","threshold"),c=this;i.selectAll("g.tick.tick-hover").on("mouseover",function(l){const u=P(this).select("text"),h=u.datum();c.services.events.dispatchEvent(C.Axis.LABEL_MOUSEOVER,{event:l,element:u,datum:h}),a===Z.LABELS&&h.length>o&&c.services.events.dispatchEvent(C.Tooltip.SHOW,{event:l,element:u,datum:h})}).on("mousemove",function(l){const u=P(this).select("text"),h=u.datum();c.services.events.dispatchEvent(C.Axis.LABEL_MOUSEMOVE,{event:l,element:u,datum:h}),c.services.events.dispatchEvent(C.Tooltip.MOVE,{event:l})}).on("click",function(l){c.services.events.dispatchEvent(C.Axis.LABEL_CLICK,{event:l,element:P(this).select("text"),datum:P(this).select("text").datum()})}).on("mouseout",function(l){c.services.events.dispatchEvent(C.Axis.LABEL_MOUSEOUT,{event:l,element:P(this).select("text"),datum:P(this).select("text").datum()}),a===Z.LABELS&&c.services.events.dispatchEvent(C.Tooltip.HIDE)}).on("focus",function(l){const u={clientX:0,clientY:0};if(l.target){l.target.focus();const h=l.target.getBoundingClientRect();u.clientX=h.x,u.clientY=h.y}c.services.events.dispatchEvent(C.Axis.LABEL_FOCUS,{event:{...l,...u},element:P(this),datum:P(this).select("text").datum()})}).on("blur",function(l){c.services.events.dispatchEvent(C.Axis.LABEL_BLUR,{event:l,element:P(this),datum:P(this).select("text").datum()})}).on("keydown",function(l){l.key&&l.key==="Escape"&&(c.services.events.dispatchEvent(C.Tooltip.HIDE),c.services.events.dispatchEvent(C.Axis.LABEL_BLUR,{event:l,element:P(this),datum:P(this).select("text").datum()})),n===H.LEFT||n===H.RIGHT?l.key&&l.key==="ArrowUp"?c.goNext(this,l):l.key&&l.key==="ArrowDown"&&c.goPrevious(this,l):l.key&&l.key==="ArrowLeft"?c.goPrevious(this,l):l.key&&l.key==="ArrowRight"&&c.goNext(this,l)})}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;R.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 re extends ht{constructor(){super(...arguments),this.type="2D-axes",this.renderType=K.SVG,this.children={},this.thresholds=[],this.margins={top:0,right:0,bottom:0,left:0}}render(t=!1){const n={},i=Object.keys(H),r=E(this.getOptions(),"axes");i.forEach(a=>{r[H[a]]&&(n[H[a]]=!0)}),this.configs.axes=n,i.forEach(a=>{const o=H[a];if(this.configs.axes[o]&&!this.children[o]){const c={position:o,axes:this.configs.axes,margins:this.margins},l=this.model.axisFlavor===Ys.DEFAULT?new jg(this.model,this.services,c):new Dk(this.model,this.services,c);l.setModel(this.model),l.setServices(this.services),l.setParent(this.parent),this.children[o]=l}}),Object.keys(this.children).forEach(a=>{this.children[a].render(t)});const s={};Object.keys(this.children).forEach(a=>{const o=this.children[a],c=o.configs.position,l=o.getInvisibleAxisRef(),{width:u,height:h}=R.getSVGElementSize(l,{useBBox:!0});let d;switch(o.getTitleRef().empty()?d=0:(d=R.getSVGElementSize(o.getTitleRef(),{useBBox:!0}).height,(c===H.LEFT||c===H.RIGHT)&&(d+=5)),c){case H.TOP:s.top=h+d;break;case H.BOTTOM:s.bottom=h+d;break;case H.LEFT:s.left=u+d;break;case H.RIGHT:s.right=u+d;break}}),this.services.events.dispatchEvent(C.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(C.ZoomBar.UPDATE),Object.keys(this.children).forEach(a=>{const o=this.children[a];o.margins=this.margins}),this.render(!0))}}class Jt extends ht{constructor(){super(...arguments),this.type="skeleton"}render(t=!0){const n=E(this.getOptions(),"data","loading");n?this.renderSkeleton(n):this.removeSkeleton()}renderSkeleton(t){if(this.configs.skeleton===Pt.GRID)this.renderGridSkeleton(t);else if(this.configs.skeleton===Pt.VERT_OR_HORIZ)this.renderVertOrHorizSkeleton(t);else if(this.configs.skeleton===Pt.PIE)this.renderPieSkeleton(t);else if(this.configs.skeleton===Pt.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===Ht.VERTICAL&&this.drawYGrid(t),n===Ht.HORIZONTAL&&this.drawXGrid(t),this.setShimmerEffect("shimmer-lines")}renderPieSkeleton(t){const n=this.computeOuterRadius(),i=0;this.drawRing(n,i,t),t&&this.setShimmerEffect("shimmer-areas")}renderDonutSkeleton(t){const n=this.computeOuterRadius(),i=this.computeInnerRadius();this.drawRing(n,i,t),t&&this.setShimmerEffect("shimmer-areas")}setScales(){const t=this.services.cartesianScales.getMainXScale().range(),n=this.services.cartesianScales.getMainYScale().range();this.xScale=_e().domain([0,1]).range(t),this.yScale=_e().domain([0,1]).range(n)}drawBackdrop(t){const n=this.parent,{width:i,height:r}=R.getSVGElementSize(n,{useAttrs:!0});this.backdrop=R.appendOrSelect(n,"svg.chart-skeleton.DAII").attr("width",i).attr("height",r);const s=R.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"),i=E(this.getOptions(),"grid","x","numberOfTicks"),r=this.xScale.ticks(i).map(o=>o*n),s=R.appendOrSelect(this.backdrop,"g.x.skeleton"),a=s.selectAll("line").data(r);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"),i=this.backdrop.attr("width"),r=E(this.getOptions(),"grid","y","numberOfTicks"),s=this.xScale.ticks(r).map(c=>c*n),a=R.appendOrSelect(this.backdrop,"g.y.skeleton"),o=a.selectAll("line").data(s);o.enter().append("line").merge(o).attr("x1",0).attr("x2",i).attr("y1",c=>c).attr("y2",c=>c),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,i=!0){const r=this.parent,{width:s,height:a}=R.getSVGElementSize(r,{useAttrs:!0}),o=R.appendOrSelect(r,"svg.chart-skeleton").attr("width",s).attr("height",a),c=n===0?"pie":"donut",l=E(this.getOptions(),c,"alignment");R.appendOrSelect(o,"rect.chart-skeleton-area-container").attr("width",s).attr("height",a).attr("fill","none");const u=or().innerRadius(n).outerRadius(t).startAngle(0).endAngle(Math.PI*2),h=t+Math.abs(_t.radiusOffset),d=t+(Math.min(s,a)-t*2)/2,f=R.appendOrSelect(o,"path").attr("class","skeleton-area-shape").attr("transform",`translate(${h}, ${d})`).attr("d",u).classed("shimmer-effect-areas",i).classed("empty-state-areas",!i).style("fill",i?`url(#${this.services.domUtils.generateElementIDString("shimmer-areas")})`:null);let p=t+_t.xOffset;l===It.CENTER?p=s/2:l===It.RIGHT&&(p=s-t-_t.xOffset);const m=t+_t.yOffset;f.attr("transform",`translate(${p}, ${m})`)}computeOuterRadius(){const{width:t,height:n}=R.getSVGElementSize(this.parent,{useAttrs:!0});return Math.min(t,n)/2+_t.radiusOffset}computeInnerRadius(){return this.computeOuterRadius()*(3/4)}setShimmerEffect(t){const n="stop-bg-shimmer",i="stop-shimmer",r=this.parent.select(".chart-skeleton"),{width:s}=R.getSVGElementSize(this.parent,{useAttrs:!0}),a=0,o=s,c=R.appendOrSelect(r,"defs").lower(),l=R.appendOrSelect(c,"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=`
|
|
76
76
|
<stop class="${n}" offset="${a}"></stop>
|
|
77
77
|
<stop class="${i}" offset="${a+.2}"></stop>
|
|
78
78
|
<stop class="${n}" offset="${a+2*.2}"></stop>
|
|
79
|
-
`;l.html(u),h();function h(){l.attr("gradientTransform",`translate(${a-3*.2*s}, 0)`).transition().duration(2e3).delay(1e3).ease(G1).attr("gradientTransform",`translate(${o+3*.2*s}, 0)`).on("end",h)}}removeSkeleton(){this.parent.select(".chart-skeleton").remove()}}class kk extends ht{constructor(){super(...arguments),this.type="boxplot",this.renderType=K.SVG}render(t){const n=this.getComponentContainer({withinChartClip:!0}),i=this.getOptions(),{groupMapsTo:r}=i.data,s=this.model.getDataGroupNames(),a=this.services.cartesianScales.getMainXScale(),o=this.services.cartesianScales.getMainYScale(),[c,l]=a.range(),[u,h]=o.range(),d=l-c,f=u-h;if(d===0)return;const{cartesianScales:p}=this.services,m=p.getOrientation(),g=m===Ht.VERTICAL,[v,b]=sn(M=>this.services.cartesianScales.getDomainValue(M),M=>this.services.cartesianScales.getRangeValue(M),m),w=Math.floor((g?d:f)/s.length),O=Math.min(w/2,16),_=this.model.getBoxplotData(),T=n.selectAll(".box-group").data(_);T.exit().remove();const S=T.enter().append("g").attr("class","box-group"),$=T.merge(S);S.append("path").merge(T.select("path.vertical-line.start")).attr("class",()=>this.model.getColorClassName({classNameTypes:[J.STROKE],originalClassName:"vertical-line start"})).attr("stroke-width",pe.strokeWidth.default).attr("fill","none").transition().call(M=>this.services.transitions.setupTransition({transition:M,name:"boxplot-update-verticalstartline",animate:t})).attr("d",M=>{const B=p.getDomainValue(M[r]),x=B,A=p.getRangeValue(M.whiskers.min),y=p.getRangeValue(M.quartiles.q_25);return Qt({x0:B,x1:x,y0:A,y1:y},m)}),S.append("path").merge(T.select("path.vertical-line.end")).attr("class",()=>this.model.getColorClassName({classNameTypes:[J.STROKE],originalClassName:"vertical-line end"})).attr("stroke-width",pe.strokeWidth.default).attr("fill","none").transition().call(M=>this.services.transitions.setupTransition({transition:M,name:"boxplot-update-verticalendline",animate:t})).attr("d",M=>{const B=p.getDomainValue(M[r]),x=B,A=p.getRangeValue(M.whiskers.max),y=p.getRangeValue(M.quartiles.q_75);return Qt({x0:B,x1:x,y0:A,y1:y},m)}),S.append("path").merge(T.select("path.box")).attr("class",()=>this.model.getColorClassName({classNameTypes:[J.FILL,J.STROKE],originalClassName:"box"})).attr("fill-opacity",pe.box.opacity.default).attr("stroke-width",pe.strokeWidth.default).attr("role",at.GRAPHICS_SYMBOL).attr("aria-roledescription","box").attr("aria-label",M=>M[r]).transition().call(M=>this.services.transitions.setupTransition({transition:M,name:"boxplot-update-quartiles",animate:t})).attr("d",M=>{const B=p.getDomainValue(M[r])-O/2,x=B+O,A=p.getRangeValue(Math[g?"max":"min"](M.quartiles.q_75,M.quartiles.q_25)),y=A+Math.abs(p.getRangeValue(M.quartiles.q_75)-p.getRangeValue(M.quartiles.q_25));return Qt({x0:B,x1:x,y0:A,y1:y},m)}),S.append("path").merge(T.select("path.highlight-area")).attr("class","highlight-area").attr("opacity",0).attr("d",M=>{const B=p.getDomainValue(M[r])-O/2,x=B+O,A=p.getRangeValue(M.whiskers.min),y=p.getRangeValue(M.whiskers.max);return Qt({x0:B,x1:x,y0:A,y1:y},m)}),S.append("path").merge(T.select("path.whisker.start")).attr("class",()=>this.model.getColorClassName({classNameTypes:[J.STROKE],originalClassName:"whisker start"})).attr("stroke-width",pe.strokeWidth.thicker).attr("fill","none").transition().call(M=>this.services.transitions.setupTransition({transition:M,name:"boxplot-update-startingwhisker",animate:t})).attr("d",M=>{const B=p.getDomainValue(M[r])-O/4,x=B+O/2,A=p.getRangeValue(M.whiskers.min),y=p.getRangeValue(M.whiskers.min);return Qt({x0:B,x1:x,y0:A,y1:y},m)}),S.append("path").merge(T.select("path.median")).attr("fill","none").attr("class",()=>this.model.getColorClassName({classNameTypes:[J.STROKE],originalClassName:"median"})).attr("stroke-width",2).transition().call(M=>this.services.transitions.setupTransition({transition:M,name:"boxplot-update-median",animate:t})).attr("d",M=>{const B=p.getDomainValue(M[r])-O/2,x=B+O,A=p.getRangeValue(M.quartiles.q_50);return Qt({x0:B,x1:x,y0:A,y1:A},m)}),S.append("path").merge(T.select("path.whisker.end")).attr("class",()=>this.model.getColorClassName({classNameTypes:[J.STROKE],originalClassName:"whisker end"})).attr("stroke-width",pe.strokeWidth.thicker).attr("fill","none").transition().call(M=>this.services.transitions.setupTransition({transition:M,name:"boxplot-update-endingwhisker",animate:t})).attr("d",M=>{const B=p.getDomainValue(M[r])-O/4,x=B+O/2,A=p.getRangeValue(M.whiskers.max),y=p.getRangeValue(M.whiskers.max);return Qt({x0:B,x1:x,y0:A,y1:y},m)});const D=$.selectAll("circle.outlier").data(M=>M.outliers.map(B=>({min:M.whiskers.min,max:M.whiskers.max,[r]:M[r],value:B})));D.exit().remove();const L=D.enter().append("circle");D.merge(L).attr("r",pe.circle.radius).attr("class",()=>this.model.getColorClassName({classNameTypes:[J.FILL,J.STROKE],originalClassName:"outlier"})).attr("fill-opacity",pe.circle.opacity.default).attr("cx",v).transition().call(M=>this.services.transitions.setupTransition({transition:M,name:"boxplot-update-circles",animate:t})).attr("cy",b),this.addBoxEventListeners(),this.addCircleEventListeners()}addBoxEventListeners(){const t=this,n=this.getOptions(),{groupMapsTo:i}=n.data;this.parent.selectAll("path.highlight-area").on("mouseover",function(r,s){const a=P(this);P(this.parentNode).select("path.box").classed("hovered",!0).attr("fill-opacity",pe.box.opacity.hovered),t.services.events.dispatchEvent(C.Tooltip.SHOW,{event:r,hoveredElement:a,items:[{label:n.tooltip.groupLabel,value:s[i],class:t.model.getColorClassName({classNameTypes:[J.TOOLTIP]})},{label:"Minimum",value:s.whiskers.min},{label:"Q1",value:s.quartiles.q_25},{label:"Median",value:s.quartiles.q_50},{label:"Q3",value:s.quartiles.q_75},{label:"Maximum",value:s.whiskers.max},{label:"IQR",value:s.quartiles.q_75-s.quartiles.q_25}]}),t.services.events.dispatchEvent(C.Boxplot.BOX_MOUSEOVER,{event:r,element:a,datum:s})}).on("mousemove",function(r,s){const a=P(this);t.services.events.dispatchEvent(C.Boxplot.BOX_MOUSEMOVE,{event:r,element:a,datum:s}),t.services.events.dispatchEvent(C.Tooltip.MOVE,{event:r})}).on("click",function(r,s){t.services.events.dispatchEvent(C.Boxplot.BOX_CLICK,{event:r,element:P(this),datum:s})}).on("mouseout",function(r,s){const a=P(this);P(this.parentNode).select("path.box").classed("hovered",!1).attr("fill-opacity",pe.box.opacity.default),t.services.events.dispatchEvent(C.Boxplot.BOX_MOUSEOUT,{event:r,element:a,datum:s}),t.services.events.dispatchEvent(C.Tooltip.HIDE,{hoveredElement:a})})}addCircleEventListeners(){const t=this,n=this.getOptions(),{groupMapsTo:i}=n.data,r=this.services.cartesianScales.getRangeIdentifier();this.parent.selectAll("circle").on("mouseover",function(s,a){const o=P(this);o.classed("hovered",!0).attr("fill-opacity",pe.circle.opacity.hovered).classed("unfilled",!1),t.services.events.dispatchEvent(C.Tooltip.SHOW,{event:s,hoveredElement:o,items:[{label:n.tooltip.groupLabel,value:a[i],class:t.model.getColorClassName({classNameTypes:[J.TOOLTIP]})},{label:"Outlier",value:a[r]}]}),t.services.events.dispatchEvent(C.Boxplot.OUTLIER_MOUSEOVER,{event:s,element:o,datum:a})}).on("mousemove",function(s,a){const o=P(this);t.services.events.dispatchEvent(C.Boxplot.OUTLIER_MOUSEMOVE,{event:s,element:o,datum:a}),t.services.events.dispatchEvent(C.Tooltip.MOVE,{event:s})}).on("click",function(s,a){t.services.events.dispatchEvent(C.Boxplot.OUTLIER_CLICK,{event:s,element:P(this),datum:a})}).on("mouseout",function(s,a){const o=P(this);o.classed("hovered",!1).attr("fill-opacity",pe.circle.opacity.default),t.services.events.dispatchEvent(C.Boxplot.OUTLIER_MOUSEOUT,{event:s,element:o,datum:a}),t.services.events.dispatchEvent(C.Tooltip.HIDE,{hoveredElement:o})})}}class Ci extends ht{constructor(){super(...arguments),this.type="zero-line",this.renderType=K.SVG}render(t){const n=this.services.cartesianScales.getRangeAxisPosition({groups:this.configs.groups}),i=this.services.cartesianScales.getScaleByPosition(n),[r,s]=i.domain(),a=r>0&&s<0||r<0&&s>0,o=this.getComponentContainer();if(!a){o.selectAll("line.domain").remove();return}const[c,l]=this.services.cartesianScales.getDomainScale().range();let u=+i(0)+.5;u||(u=i.range()[0]);const h=Cp({x0:c,x1:l,y0:u,y1:u},this.services.cartesianScales.getOrientation());R.appendOrSelect(o,"line.domain").transition().call(d=>this.services.transitions.setupTransition({transition:d,name:"zero-line-update",animate:t})).attr("y1",h.y0).attr("y2",h.y1).attr("x1",h.x0).attr("x2",h.x1)}}class Rk extends Ue{constructor(){super(...arguments),this.type="bubble",this.renderType=K.SVG}getRadiusScale(t){const n=this.getOptions(),{radiusMapsTo:i}=n.bubble,r=t.data(),s=r.map(l=>l[i]).filter(l=>l),a=R.getHTMLElementSize(this.services.domUtils.getMainContainer()),o=s.length>0,c=o?ye(s):[1,1];return _e().domain(c).range(o?n.bubble.radiusRange(a,r):[4,4])}styleCircles(t,n){const i=this.getOptions(),{radiusMapsTo:r}=i.bubble,s=this.getRadiusScale(t),{groupMapsTo:a}=i.data,{cartesianScales:o}=this.services,c=d=>o.getDomainValue(d),l=d=>o.getRangeValue(d),[u,h]=sn(c,l,o.getOrientation());t.raise().classed("dot",!0).attr("role",at.GRAPHICS_SYMBOL).attr("aria-label",d=>{const f=o.getRangeIdentifier(d);return d[f]}).transition().call(d=>this.services.transitions.setupTransition({transition:d,name:"bubble-update-enter",animate:n})).attr("cx",u).attr("cy",h).attr("r",d=>s(d[r]||1)).attr("class",d=>this.model.getColorClassName({classNameTypes:[J.FILL,J.STROKE],dataGroupName:d[a],originalClassName:"dot"})).style("fill",d=>{const f=this.services.cartesianScales.getDomainIdentifier(d);return this.model.getFillColor(d[a],d[f],d)}).style("stroke",d=>{const f=this.services.cartesianScales.getDomainIdentifier(d);return this.model.getStrokeColor(d[a],d[f],d)}).attr("fill-opacity",i.bubble.fillOpacity).attr("opacity",1)}getTooltipAdditionalItems(t){const n=E(this.getOptions(),"bubble");return[{label:E(n,"radiusLabel"),value:t[E(n,"radiusMapsTo")]}]}}class Ik extends ht{constructor(){super(...arguments),this.type="bullet",this.renderType=K.SVG,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail,{groupMapsTo:i}=this.getOptions().data;this.parent.selectAll("path.bar").transition("legend-hover-simple-bar").call(r=>this.services.transitions.setupTransition({transition:r,name:"legend-hover-simple-bar"})).attr("opacity",r=>r[i]!==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(C.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(C.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t){const n=this.getOptions(),{groupMapsTo:i}=n.data,r=this.getComponentContainer({withinChartClip:!0}),s=this.model.getDisplayData(this.configs.groups),a=this.services.cartesianScales.getRangeScale(),o=this.services.cartesianScales.getRangeIdentifier(),[c,l]=a.range(),[,u]=a.domain(),h=()=>{const m=[];s.forEach(v=>{v.ranges?v.ranges.forEach((b,w)=>{b!=null&&b<u&&m.push({datum:v,value:b,order:w+1})}):m.push({datum:v,order:1})});const g=R.appendOrSelect(r,"g.range-boxes").selectAll("path.range-box").data(m,v=>`${v[i]}-${v.order}`);g.exit().attr("opacity",0).remove(),g.enter().append("path").attr("opacity",0).merge(g).attr("class",v=>`range-box order-${v.order}`).transition().call(v=>this.services.transitions.setupTransition({transition:v,name:"bullet-range-box-update-enter",animate:t})).attr("d",v=>{let b,w,O,_;return v.order===1?(b=this.services.cartesianScales.getDomainValue(v.datum)-16/2,w=b+16,O=l-2,_=c+1):(b=this.services.cartesianScales.getDomainValue(v.datum)-16/2,w=b+16,O=this.services.cartesianScales.getRangeValue(v.value),_=l),Qt({x0:b,x1:w,y0:O,y1:_},this.services.cartesianScales.getOrientation())}).attr("opacity",1)},d=()=>{const m=R.appendOrSelect(r,"g.bars").selectAll("path.bar").data(s,g=>g[i]);m.exit().attr("opacity",0).remove(),m.enter().append("path").attr("opacity",0).merge(m).classed("bar",!0).transition().call(g=>this.services.transitions.setupTransition({transition:g,name:"bullet-bar-update-enter",animate:t})).attr("class",g=>this.model.getColorClassName({classNameTypes:[J.FILL],dataGroupName:g[i],originalClassName:"bar"})).style("fill",g=>this.model.getFillColor(g[i])).attr("d",g=>{const v=this.services.cartesianScales.getDomainValue(g)-4,b=v+8,w=this.services.cartesianScales.getRangeValue(0)+1,O=this.services.cartesianScales.getRangeValue(g);return Qt({x0:v,x1:b,y0:w,y1:O},this.services.cartesianScales.getOrientation())}).attr("opacity",1).attr("role",at.GRAPHICS_SYMBOL).attr("aria-roledescription","bar").attr("aria-label",g=>g.value)},f=()=>{const m=R.appendOrSelect(r,"g.markers").selectAll("path.marker").data(s.filter(g=>E(g,"marker")!==null),g=>g[i]);m.exit().attr("opacity",0).remove(),m.enter().append("path").attr("opacity",0).merge(m).classed("marker",!0).transition().call(g=>this.services.transitions.setupTransition({transition:g,name:"bullet-marker-update-enter",animate:t})).attr("d",g=>{const v=this.services.cartesianScales.getDomainValue(g)-12,b=v+24,w=this.services.cartesianScales.getRangeValue(g.marker);return Qt({x0:v,x1:b,y0:w,y1:w},this.services.cartesianScales.getOrientation())}).attr("opacity",1)},p=()=>{let m=[];s.filter(v=>E(v,"marker")!==null).forEach(v=>{const b=v.marker,w=v[o];m=m.concat([{datum:v,value:b*.25,barValue:w},{datum:v,value:b*.5,barValue:w},{datum:v,value:b*.75,barValue:w}])});const g=R.appendOrSelect(r,"g.quartiles").selectAll("path.quartile").data(m,v=>v[i]);g.exit().attr("opacity",0).remove(),g.enter().append("path").attr("opacity",0).merge(g).attr("class",v=>`quartile ${v.value<=v.barValue?"over-bar":""}`).transition().call(v=>this.services.transitions.setupTransition({transition:v,name:"bullet-quartile-update-enter",animate:t})).attr("d",({datum:v,value:b})=>{let w=4;v.ranges&&v.ranges.indexOf(b)!==-1&&(w=8);const O=this.services.cartesianScales.getDomainValue(v)-w/2,_=O+w,T=this.services.cartesianScales.getRangeValue(b);return Qt({x0:O,x1:_,y0:T,y1:T},this.services.cartesianScales.getOrientation())}).attr("opacity",1)};h(),d(),f(),p(),this.addEventListeners()}addEventListeners(){const t=this,n=this.getOptions(),{groupMapsTo:i}=n.data,r=this.services.cartesianScales.getRangeIdentifier();this.parent.selectAll("path.bar").on("mouseover",function(s,a){const o=P(this);o.classed("hovered",!0),t.services.events.dispatchEvent(C.Bar.BAR_MOUSEOVER,{event:s,element:o,datum:a});const c=E(n,"bullet","performanceAreaTitles"),l=t.model.getMatchingRangeIndexForDatapoint(a);t.services.events.dispatchEvent(C.Tooltip.SHOW,{event:s,hoveredElement:o,items:[{label:n.tooltip.groupLabel||"Group",value:a[i],class:t.model.getColorClassName({classNameTypes:[J.TOOLTIP],dataGroupName:a[i]})},{label:"Value",value:a[r]},{label:"Target",value:a.marker},{label:"Percentage",value:`${Math.floor(a[r]/a.marker*100)}%`},{label:"Performance",value:c[l]}]})}).on("mousemove",function(s,a){t.services.events.dispatchEvent(C.Bar.BAR_MOUSEMOVE,{event:s,element:P(this),datum:a}),t.services.events.dispatchEvent(C.Tooltip.MOVE,{event:s})}).on("click",function(s,a){t.services.events.dispatchEvent(C.Bar.BAR_CLICK,{event:s,element:P(this),datum:a})}).on("mouseout",function(s,a){const o=P(this);o.classed("hovered",!1),t.services.events.dispatchEvent(C.Bar.BAR_MOUSEOUT,{event:s,element:o,datum:a}),t.services.events.dispatchEvent(C.Tooltip.HIDE,{hoveredElement:o})})}destroy(){this.parent.selectAll("path.bar").on("mouseover",null).on("mousemove",null).on("mouseout",null);const t=this.services.events;t.removeEventListener(C.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(C.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}}function Pk(e){return e}function Nk(e){if(e==null)return Pk;var t,n,i=e.scale[0],r=e.scale[1],s=e.translate[0],a=e.translate[1];return function(o,c){c||(t=n=0);var l=2,u=o.length,h=new Array(u);for(h[0]=(t+=o[0])*i+s,h[1]=(n+=o[1])*r+a;l<u;)h[l]=o[l],++l;return h}}function Uk(e,t){for(var n,i=e.length,r=i-t;r<--i;)n=e[r],e[r++]=e[i],e[i]=n}function Bk(e,t){return typeof t=="string"&&(t=e.objects[t]),t.type==="GeometryCollection"?{type:"FeatureCollection",features:t.geometries.map(function(n){return Wg(e,n)})}:Wg(e,t)}function Wg(e,t){var n=t.id,i=t.bbox,r=t.properties==null?{}:t.properties,s=mc(e,t);return n==null&&i==null?{type:"Feature",properties:r,geometry:s}:i==null?{type:"Feature",id:n,properties:r,geometry:s}:{type:"Feature",id:n,bbox:i,properties:r,geometry:s}}function mc(e,t){var n=Nk(e.transform),i=e.arcs;function r(u,h){h.length&&h.pop();for(var d=i[u<0?~u:u],f=0,p=d.length;f<p;++f)h.push(n(d[f],f));u<0&&Uk(h,p)}function s(u){return n(u)}function a(u){for(var h=[],d=0,f=u.length;d<f;++d)r(u[d],h);return h.length<2&&h.push(h[0]),h}function o(u){for(var h=a(u);h.length<4;)h.push(h[0]);return h}function c(u){return u.map(o)}function l(u){var h=u.type,d;switch(h){case"GeometryCollection":return{type:h,geometries:u.geometries.map(l)};case"Point":d=s(u.coordinates);break;case"MultiPoint":d=u.coordinates.map(s);break;case"LineString":d=a(u.arcs);break;case"MultiLineString":d=u.arcs.map(a);break;case"Polygon":d=c(u.arcs);break;case"MultiPolygon":d=u.arcs.map(c);break;default:return null}return{type:h,coordinates:d}}return l(t)}function Hk(e,t){var n={},i={},r={},s=[],a=-1;t.forEach(function(l,u){var h=e.arcs[l<0?~l:l],d;h.length<3&&!h[1][0]&&!h[1][1]&&(d=t[++a],t[a]=l,t[u]=d)}),t.forEach(function(l){var u=o(l),h=u[0],d=u[1],f,p;if(f=r[h])if(delete r[f.end],f.push(l),f.end=d,p=i[d]){delete i[p.start];var m=p===f?f:f.concat(p);i[m.start=f.start]=r[m.end=p.end]=m}else i[f.start]=r[f.end]=f;else if(f=i[d])if(delete i[f.start],f.unshift(l),f.start=h,p=r[h]){delete r[p.end];var g=p===f?f:p.concat(f);i[g.start=p.start]=r[g.end=f.end]=g}else i[f.start]=r[f.end]=f;else f=[l],i[f.start=h]=r[f.end=d]=f});function o(l){var u=e.arcs[l<0?~l:l],h=u[0],d;return e.transform?(d=[0,0],u.forEach(function(f){d[0]+=f[0],d[1]+=f[1]})):d=u[u.length-1],l<0?[d,h]:[h,d]}function c(l,u){for(var h in l){var d=l[h];delete u[d.start],delete d.start,delete d.end,d.forEach(function(f){n[f<0?~f:f]=1}),s.push(d)}}return c(r,i),c(i,r),t.forEach(function(l){n[l<0?~l:l]||s.push([l])}),s}function Vk(e){for(var t=-1,n=e.length,i,r=e[n-1],s=0;++t<n;)i=r,r=e[t],s+=i[0]*r[1]-i[1]*r[0];return Math.abs(s)}function Gk(e){return mc(e,Fk.apply(this,arguments))}function Fk(e,t){var n={},i=[],r=[];t.forEach(s);function s(c){switch(c.type){case"GeometryCollection":c.geometries.forEach(s);break;case"Polygon":a(c.arcs);break;case"MultiPolygon":c.arcs.forEach(a);break}}function a(c){c.forEach(function(l){l.forEach(function(u){(n[u=u<0?~u:u]||(n[u]=[])).push(c)})}),i.push(c)}function o(c){return Vk(mc(e,{type:"Polygon",arcs:[c]}).coordinates[0])}return i.forEach(function(c){if(!c._){var l=[],u=[c];for(c._=1,r.push(l);c=u.pop();)l.push(c),c.forEach(function(h){h.forEach(function(d){n[d<0?~d:d].forEach(function(f){f._||(f._=1,u.push(f))})})})}}),i.forEach(function(c){delete c._}),{type:"MultiPolygon",arcs:r.map(function(c){var l=[],u;if(c.forEach(function(m){m.forEach(function(g){g.forEach(function(v){n[v<0?~v:v].length<2&&l.push(v)})})}),l=Hk(e,l),(u=l.length)>1)for(var h=1,d=o(l[0]),f,p;h<u;++h)(f=o(l[h]))>d&&(p=l[0],l[0]=l[h],l[h]=p,d=f);return l}).filter(function(c){return c.length>0})}}class zk extends vn{constructor(){super(...arguments),this.type="ruler-binned",this.renderType=K.SVG}showRuler(t,[n,i]){const r=this.parent,s=this.model.getOptions(),{cartesianScales:a}=this.services,o=a.getOrientation(),c=a.getRangeScale(),[l,u]=c.range(),h=a.getDomainScale(),d=h.invert(o===Ht.VERTICAL?n:i),f=R.appendOrSelect(r,"g.ruler").attr("aria-label","ruler"),p=R.appendOrSelect(f,"line.ruler-line"),m=r.selectAll("[role=graphics-symbol]").filter(g=>{if(parseFloat(St(g,"data.x0"))<=d&&parseFloat(St(g,"data.x1"))>=d)return!0});if(m.size()>0){this.elementsToHighlight&&this.elementsToHighlight.size()>0&&!Sg(this.elementsToHighlight,m)&&this.hideRuler(),m.dispatch("mouseover"),this.elementsToHighlight=m;const g=P(m.nodes()[0]).datum(),v=parseFloat(St(g,"data.x0")),b=parseFloat(St(g,"data.x1")),w=this.model.getActiveDataGroupNames(),O=w.reverse().map(_=>({label:_,value:St(g,`data.${_}`),class:this.model.getColorClassName({classNameTypes:[J.TOOLTIP],dataGroupName:_})})).filter(_=>_.value!==0);if(O.length>0){this.services.events.dispatchEvent(C.Tooltip.SHOW,{mousePosition:[n,i],hoveredElement:p,items:[{label:St(s,"bins.rangeLabel")||"Range",value:`${v} – ${b}`},...O,...E(s,"tooltip","showTotal")===!0?[{label:St(s,"tooltip.totalLabel")||"Total",value:w.reduce((T,S)=>T+parseFloat(St(g,`data.${S}`)),0)}]:[]]}),f.attr("opacity",1);const _=h((v+b)/2);o==="horizontal"?p.attr("x1",u).attr("x2",l).attr("y1",_).attr("y2",_):p.attr("y1",u).attr("y2",l).attr("x1",_).attr("x2",_)}else this.hideRuler()}else this.hideRuler()}}class La extends vn{formatTooltipData(t){return t.reverse()}}class qg extends pc{constructor(t,n,i){super(t,n,i),this.type="color-legend",this.renderType=K.SVG,this.gradient_id=`gradient-id-${Math.floor(Math.random()*99999999999)}`,this.handleAxisCompleteEvent=()=>{const r=this.getComponentContainer(),{width:s}=R.getSVGElementSize(r,{useAttrs:!0}),a=E(this.getOptions(),"data","loading");if(s>Lt.color.barWidth&&!a){const o=E(this.getOptions(),"heatmap","colorLegend","title"),{cartesianScales:c}=this.services,l=c.getMainXScale().range();if(l[0]>1&&(r.select("g.legend").attr("transform",`translate(${l[0]}, 0)`),o)){const{width:u}=R.getSVGElementSize(r.select("g.legend-title").select("text"),{useBBox:!0}),h=l[0]-u-9;h>1?r.select("g.legend-title").attr("transform",`translate(${h}, 0)`):(r.select("g.legend").attr("transform",`translate(${l[0]}, 16)`),r.select("g.legend-title").attr("transform",`translate(${l[0]}, 0)`))}}else r.select("g.legend-title").attr("transform","translate(0, 0)")},this.chartType=i.chartType}init(){this.chartType==="heatmap"&&this.services.events.addEventListener(C.Axis.RENDER_COMPLETE,this.handleAxisCompleteEvent)}render(t=!0){const n=this.getOptions(),i=this.getComponentContainer(),{width:r}=R.getSVGElementSize(i,{useAttrs:!0}),s=E(n,"color","gradient","colors"),a=E(n,this.chartType,"colorLegend","type");let o=E(n,"color","pairing","option");const c=E(n,"heatmap","colorLegend","title");if(E(this.getOptions(),"data","loading")){i.html("");return}const l=!Ce(s),u=Gp(this.model.getDisplayData()),h=!(r<=Lt.color.barWidth),d=h?Lt.color.barWidth:r,f=R.appendOrSelect(i,"g.legend"),p=R.appendOrSelect(f,"g.legend-axis");if(c){const S=R.appendOrSelect(i,"g.legend-title");R.appendOrSelect(S,"text").text(c).attr("dy","0.7em"),f.attr("transform","translate(0, 16)")}const m=u[0]<0&&u[1]>0?"diverge":"mono";(o<1&&o>4&&m==="mono"||o<1&&o>2&&m==="diverge")&&(o=1);let g=[];const v=m==="diverge"?17:11;if(l)g=s;else for(let S=1;S<v+1;S++)g.push(a===qs.LINEAR?`stop-color-${m}-${o}-${S}`:`fill-${m}-${o}-${S}`);const b=oe(u[0],u[1]),w=Ry(b,3),O=_e().domain(u).range([0,d]),_=Ua(O).tickSize(0).tickValues(w);let T;switch(a){case qs.LINEAR:this.drawLinear(g,f,d);break;case qs.QUANTIZE:T=this.drawQuantize(g,m,l,f,d),O.range([T,d]);break;default:throw Error("Entered color legend type is not supported.")}p.attr("transform",`translate(0,${Lt.color.axisYTranslation})`).call(_),p.select(".domain").remove(),p.select("g.tick:last-of-type text").style("text-anchor",h?"middle":"end"),p.select("g.tick:first-of-type text").style("text-anchor",h&&this.chartType!=="choropleth"?"middle":"start")}drawLinear(t,n,i){const r=100/(t.length-1);R.appendOrSelect(n,"linearGradient").attr("id",`${this.gradient_id}-legend`).selectAll("stop").data(t).enter().append("stop").attr("offset",(s,a)=>`${a*r}%`).attr("class",(s,a)=>t[a]).attr("stop-color",s=>s),R.appendOrSelect(n,"rect").attr("width",i).attr("height",Lt.color.barHeight).style("fill",`url(#${this.gradient_id}-legend)`)}drawQuantize(t,n,i,r,s){!i&&n==="diverge"&&t.splice(t.length/2,1);const a=er().domain(t).range([0,s]);return R.appendOrSelect(r,"g.quantized-rect").selectAll("rect").data(a.domain()).join("rect").attr("x",o=>a(o)).attr("y",0).attr("width",Math.max(0,a.bandwidth()-1)).attr("height",Lt.color.barHeight).attr("class",o=>o).attr("fill",o=>o),(!i&&n)==="mono"?a.bandwidth()-1:0}destroy(){this.chartType==="heatmap"&&this.services.events.removeEventListener(C.Axis.RENDER_COMPLETE,this.handleAxisCompleteEvent)}}class jk extends Ir{constructor(){super(...arguments),this.type="meter-title",this.renderType=K.SVG}render(t=!0){const n=E(this.model.getDisplayData(),0),i=this.getOptions(),r=this.getComponentContainer(),{groupMapsTo:s}=i.data;if(E(i,"meter","proportional"))this.displayTotal(),this.displayBreakdownTitle();else{const c=r.selectAll("text.meter-title").data([n[s]]);c.enter().append("text").classed("meter-title",!0).merge(c).attr("x",0).attr("y","1em").text(l=>l),c.exit().remove(),this.appendPercentage()}this.displayStatus();const a=this.getMaxTitleWidth(),o=R.appendOrSelect(r,"text.meter-title");a>0&&o.node().getComputedTextLength()>a&&this.truncateTitle(o,a)}displayBreakdownTitle(){const t=this.getComponentContainer(),n=this.getOptions(),i=this.model.getMaximumDomain(this.model.getDisplayData()),r=E(n,"meter","proportional","total"),s=E(n,"meter","proportional","unit")?E(n,"meter","proportional","unit"):"";let a;if(i===r)a=null;else{const u=r!==null?r-i:i,h=E(n,"meter","proportional","breakdownFormatter");a=h!==null?h({datasetsTotal:i,total:r}):`${i} ${s} used (${u} ${s} available)`}const o=t.selectAll("text.proportional-meter-title").data([a]);o.enter().append("text").classed("proportional-meter-title",!0).merge(o).attr("x",0).attr("y","1em").text(u=>u),o.exit().remove();const c=this.getMaxTitleWidth(),l=R.appendOrSelect(t,"text.proportional-meter-title");c>0&&l.node().getComputedTextLength()>c&&this.truncateTitle(l,c)}displayTotal(){const t=this.getComponentContainer(),n=this.getOptions(),i=E(n,"meter","proportional","total"),r=i?E(n,"meter","proportional","total"):this.model.getMaximumDomain(this.model.getDisplayData()),s=E(n,"meter","proportional","unit")?E(n,"meter","proportional","unit"):"",a=E(n,"meter","proportional","totalFormatter"),o=a!==null?a(r):`${i} ${s} total`,c=R.getHTMLElementSize(this.services.domUtils.getMainContainer()),l=c.width?c.width:this.parent.node().getAttribute("width"),u=t.selectAll("text.proportional-meter-total").data([o]);u.enter().append("text").classed("proportional-meter-total",!0).merge(u).attr("x",this.model.getStatus()&&typeof l!="string"?l-Gt.total.paddingRight:l).attr("y","1em").attr("text-anchor","end").text(h=>h),u.exit().remove()}displayStatus(){const t=this,n=this.getComponentContainer(),i=R.getHTMLElementSize(this.services.domUtils.getMainContainer()),r=i.width?i.width:0,s=this.model.getStatus(),a=Gt.status.indicatorSize/2,o=R.appendOrSelect(n,"g.status-indicator").attr("class",s!==null?`status-indicator status--${s}`:"").attr("transform",`translate(${r-a}, 0)`),c=s?[s]:[],l=o.selectAll("circle.status").data(c);l.enter().append("circle").merge(l).attr("class","status").attr("r",a).attr("cx",0).attr("cy",8);const u=o.selectAll("path.innerFill").data(c);u.enter().append("path").merge(u).attr("d",t.getStatusIconPathString(s)).attr("transform",`translate(-${a}, 0)`).attr("class","innerFill"),u.exit().remove(),l.exit().remove()}appendPercentage(){const t=E(this.model.getDisplayData(),0,"value"),n=this.getComponentContainer(),i=R.appendOrSelect(n,"text.meter-title"),r=E(this.getOptions(),"meter","statusBar","percentageIndicator","enabled")===!0?[t]:[],s=n.selectAll("text.percent-value").data(r),a=Gt.statusBar.paddingRight;s.enter().append("text").classed("percent-value",!0).merge(s).text(o=>`${o}%`).attr("x",+i.attr("x")+i.node().getComputedTextLength()+a).attr("y",i.attr("y")),s.exit().remove()}truncateTitle(t,n){super.truncateTitle(t,n);const i=R.appendOrSelect(this.parent,"tspan"),r=Gt.statusBar.paddingRight,s=Math.ceil(i.node().getComputedTextLength());R.appendOrSelect(this.parent,"text.percent-value").attr("x",+t.attr("x")+t.node().getComputedTextLength()+s+r)}getMaxTitleWidth(){const t=R.getHTMLElementSize(this.services.domUtils.getMainContainer()),n=E(this.getOptions(),"meter","proportional"),i=t.width?t.width:this.parent.node().getBoundingClientRect().width;if(n!==null){const r=R.appendOrSelect(this.parent,"text.proportional-meter-total").node(),s=R.getSVGElementSize(r,{useBBox:!0}).width;return i-s-Gt.total.paddingLeft}else{const r=R.appendOrSelect(this.parent,"text.percent-value"),s=Gt.statusBar.paddingRight,a=r.node().getComputedTextLength(),o=R.appendOrSelect(this.parent,"g.status-indicator").node(),c=R.getSVGElementSize(o,{useBBox:!0}).width+Gt.status.paddingLeft;return i-a-s-c}}getStatusIconPathString(t){switch(t){case js.SUCCESS:return"M6.875 11.3125 3.75 8.1875 4.74375 7.25 6.875 9.34375 11.50625 4.75 12.5 5.7375 Z";case js.DANGER:return"M10.7 11.5 4.5 5.3 5.3 4.5 11.5 10.7 Z";case js.WARNING:return"M7.9375,11.125 C7.41973305,11.125 7,11.544733 7,12.0625 C7,12.580267 7.41973305,13 7.9375,13 C8.45526695,13 8.875,12.580267 8.875,12.0625 C8.875,11.544733 8.45526695,11.125 7.9375,11.125 M7.3125, 3 8.5625, 3 8.5625, 9.875 7.3125, 9.875, 7.3125, 3 Z"}}}class vc extends ht{getBarWidth(){const t=this.getOptions();if(t.bars.width)return t.bars.width;const n=this.model.getDisplayData().length,i=this.services.cartesianScales.getMainXScale(),r=R.getSVGElementSize(this.parent,{useAttrs:!0}).width;if(!i.step){const s=E(t,"bars","spacingFactor");return Math.min(t.bars.maxWidth,r*s/n)}return Math.min(t.bars.maxWidth,i.step()/2)}isOutsideZoomedDomain(t,n){if(this.model.getDisplayData().length<=1)return!1;const i=this.model.get("zoomDomain");if(i!==void 0){const r=this.services.cartesianScales.getDomainScale();return t<r(i[0])||n>r(i[1])}return!1}}class Wk extends ht{constructor(){super(...arguments),this.type="circle-pack",this.renderType=K.SVG,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail;this.parent.selectAll("circle.node").transition("legend-hover-circlepack").call(i=>this.services.transitions.setupTransition({transition:i,name:"legend-hover-circlepack"})).attr("opacity",i=>i.data.dataGroupName===n.datum().name?1:mi.circles.fillOpacity)},this.handleLegendMouseOut=()=>{this.parent.selectAll("circle.node").transition("legend-mouseout-circlepack").call(t=>this.services.transitions.setupTransition({transition:t,name:"legend-mouseout-circlepack"})).attr("opacity",1)}}render(t=!0){const n=this.getComponentContainer({withinChartClip:!0}),{width:i,height:r}=R.getSVGElementSize(this.parent,{useAttrs:!0});if(i<1||r<1)return;let s=this.model.getDisplayData();const a=this.model.hasParentNode(),o=this.model.getHierarchyLevel(),c=this.getOptions(),l=E(c,"canvasZoom","enabled");a&&E(s,0,"children")&&(s=E(s,0,"children"));const u=Qi({children:s}).sum(p=>p.value).sort((p,m)=>m.value-p.value),h=Xb().size([i,r]).padding(p=>p.depth>=1?mi.padding.children+3:mi.padding.mainGroup+3)(u).descendants().splice(1).filter(p=>p.depth<=o),d=n.selectAll("circle.node").data(h);d.exit().attr("width",0).attr("height",0).remove();const f=d.enter().append("circle").classed("node",!0);f.merge(d).attr("class",p=>{const m=l&&o===3?this.getZoomClass(p):"";return this.model.getColorClassName({classNameTypes:[J.FILL,J.STROKE],dataGroupName:p.data.dataGroupName,originalClassName:p.children?`node ${m}`:`node node-leaf ${m}`})}).style("fill",p=>this.model.getFillColor(p.data.dataGroupName)).style("stroke",p=>this.model.getFillColor(p.data.dataGroupName)).attr("cx",p=>p.x).attr("cy",p=>p.y).transition("circlepack-leaf-update-enter").call(p=>this.services.transitions.setupTransition({transition:p,name:"circlepack-leaf-update-enter"})).attr("r",p=>p.r).attr("opacity",1).attr("fill-opacity",mi.circles.fillOpacity),l===!0&&this.focal&&(this.services.canvasZoom.zoomIn(this.focal,f,gi),this.setBackgroundListeners()),a||this.addLegendListeners(),this.addEventListeners()}unhighlightChildren(t){const n=t.map(i=>i.data);this.parent.selectAll("circle.node").filter(i=>n.some(r=>r===i.data)&&i.depth>1).style("stroke",i=>this.model.getFillColor(i.data.dataGroupName))}highlightChildren(t){const n=t.map(i=>i.data);this.parent.selectAll("circle.node").filter(i=>n.some(r=>r===i.data)&&i.depth>1).style("stroke",mi.circles.hover.stroke)}getZoomClass(t){return this.model.getHierarchyLevel()===3&&this.focal&&(t.data===this.focal.data||this.focal.children.some(n=>n.data===t.data))?"focal":"non-focal"}addLegendListeners(){const{events:t}=this.services;t.addEventListener(C.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(C.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}removeBackgroundListeners(){P(this.services.domUtils.getMainContainer()).on("click",()=>null)}setBackgroundListeners(){const t=P(this.services.domUtils.getMainContainer()),n=this,i=this.parent.selectAll("circle.node");t.on("click",()=>{n.focal=null,n.model.updateHierarchyLevel(2),t.classed("zoomed-in",!1),n.services.canvasZoom.zoomOut(i,gi)})}getZoomIcon(){return`
|
|
79
|
+
`;l.html(u),h();function h(){l.attr("gradientTransform",`translate(${a-3*.2*s}, 0)`).transition().duration(2e3).delay(1e3).ease(G1).attr("gradientTransform",`translate(${o+3*.2*s}, 0)`).on("end",h)}}removeSkeleton(){this.parent.select(".chart-skeleton").remove()}}class kk extends ht{constructor(){super(...arguments),this.type="boxplot",this.renderType=K.SVG}render(t){const n=this.getComponentContainer({withinChartClip:!0}),i=this.getOptions(),{groupMapsTo:r}=i.data,s=this.model.getDataGroupNames(),a=this.services.cartesianScales.getMainXScale(),o=this.services.cartesianScales.getMainYScale(),[c,l]=a.range(),[u,h]=o.range(),d=l-c,f=u-h;if(d===0)return;const{cartesianScales:p}=this.services,m=p.getOrientation(),g=m===Ht.VERTICAL,[v,b]=sn(M=>this.services.cartesianScales.getDomainValue(M),M=>this.services.cartesianScales.getRangeValue(M),m),w=Math.floor((g?d:f)/s.length),O=Math.min(w/2,16),_=this.model.getBoxplotData(),T=n.selectAll(".box-group").data(_);T.exit().remove();const S=T.enter().append("g").attr("class","box-group"),$=T.merge(S);S.append("path").merge(T.select("path.vertical-line.start")).attr("class",()=>this.model.getColorClassName({classNameTypes:[J.STROKE],originalClassName:"vertical-line start"})).attr("stroke-width",pe.strokeWidth.default).attr("fill","none").transition().call(M=>this.services.transitions.setupTransition({transition:M,name:"boxplot-update-verticalstartline",animate:t})).attr("d",M=>{const B=p.getDomainValue(M[r]),x=B,A=p.getRangeValue(M.whiskers.min),y=p.getRangeValue(M.quartiles.q_25);return Qt({x0:B,x1:x,y0:A,y1:y},m)}),S.append("path").merge(T.select("path.vertical-line.end")).attr("class",()=>this.model.getColorClassName({classNameTypes:[J.STROKE],originalClassName:"vertical-line end"})).attr("stroke-width",pe.strokeWidth.default).attr("fill","none").transition().call(M=>this.services.transitions.setupTransition({transition:M,name:"boxplot-update-verticalendline",animate:t})).attr("d",M=>{const B=p.getDomainValue(M[r]),x=B,A=p.getRangeValue(M.whiskers.max),y=p.getRangeValue(M.quartiles.q_75);return Qt({x0:B,x1:x,y0:A,y1:y},m)}),S.append("path").merge(T.select("path.box")).attr("class",()=>this.model.getColorClassName({classNameTypes:[J.FILL,J.STROKE],originalClassName:"box"})).attr("fill-opacity",pe.box.opacity.default).attr("stroke-width",pe.strokeWidth.default).attr("role",at.GRAPHICS_SYMBOL).attr("aria-roledescription","box").attr("aria-label",M=>M[r]).transition().call(M=>this.services.transitions.setupTransition({transition:M,name:"boxplot-update-quartiles",animate:t})).attr("d",M=>{const B=p.getDomainValue(M[r])-O/2,x=B+O,A=p.getRangeValue(Math[g?"max":"min"](M.quartiles.q_75,M.quartiles.q_25)),y=A+Math.abs(p.getRangeValue(M.quartiles.q_75)-p.getRangeValue(M.quartiles.q_25));return Qt({x0:B,x1:x,y0:A,y1:y},m)}),S.append("path").merge(T.select("path.highlight-area")).attr("class","highlight-area").attr("opacity",0).attr("d",M=>{const B=p.getDomainValue(M[r])-O/2,x=B+O,A=p.getRangeValue(M.whiskers.min),y=p.getRangeValue(M.whiskers.max);return Qt({x0:B,x1:x,y0:A,y1:y},m)}),S.append("path").merge(T.select("path.whisker.start")).attr("class",()=>this.model.getColorClassName({classNameTypes:[J.STROKE],originalClassName:"whisker start"})).attr("stroke-width",pe.strokeWidth.thicker).attr("fill","none").transition().call(M=>this.services.transitions.setupTransition({transition:M,name:"boxplot-update-startingwhisker",animate:t})).attr("d",M=>{const B=p.getDomainValue(M[r])-O/4,x=B+O/2,A=p.getRangeValue(M.whiskers.min),y=p.getRangeValue(M.whiskers.min);return Qt({x0:B,x1:x,y0:A,y1:y},m)}),S.append("path").merge(T.select("path.median")).attr("fill","none").attr("class",()=>this.model.getColorClassName({classNameTypes:[J.STROKE],originalClassName:"median"})).attr("stroke-width",2).transition().call(M=>this.services.transitions.setupTransition({transition:M,name:"boxplot-update-median",animate:t})).attr("d",M=>{const B=p.getDomainValue(M[r])-O/2,x=B+O,A=p.getRangeValue(M.quartiles.q_50);return Qt({x0:B,x1:x,y0:A,y1:A},m)}),S.append("path").merge(T.select("path.whisker.end")).attr("class",()=>this.model.getColorClassName({classNameTypes:[J.STROKE],originalClassName:"whisker end"})).attr("stroke-width",pe.strokeWidth.thicker).attr("fill","none").transition().call(M=>this.services.transitions.setupTransition({transition:M,name:"boxplot-update-endingwhisker",animate:t})).attr("d",M=>{const B=p.getDomainValue(M[r])-O/4,x=B+O/2,A=p.getRangeValue(M.whiskers.max),y=p.getRangeValue(M.whiskers.max);return Qt({x0:B,x1:x,y0:A,y1:y},m)});const D=$.selectAll("circle.outlier").data(M=>M.outliers.map(B=>({min:M.whiskers.min,max:M.whiskers.max,[r]:M[r],value:B})));D.exit().remove();const L=D.enter().append("circle");D.merge(L).attr("r",pe.circle.radius).attr("class",()=>this.model.getColorClassName({classNameTypes:[J.FILL,J.STROKE],originalClassName:"outlier"})).attr("fill-opacity",pe.circle.opacity.default).attr("cx",v).transition().call(M=>this.services.transitions.setupTransition({transition:M,name:"boxplot-update-circles",animate:t})).attr("cy",b),this.addBoxEventListeners(),this.addCircleEventListeners()}addBoxEventListeners(){const t=this,n=this.getOptions(),{groupMapsTo:i}=n.data;this.parent.selectAll("path.highlight-area").on("mouseover",function(r,s){const a=P(this);P(this.parentNode).select("path.box").classed("hovered",!0).attr("fill-opacity",pe.box.opacity.hovered),t.services.events.dispatchEvent(C.Tooltip.SHOW,{event:r,hoveredElement:a,items:[{label:n.tooltip.groupLabel,value:s[i],class:t.model.getColorClassName({classNameTypes:[J.TOOLTIP]})},{label:"Minimum",value:s.whiskers.min},{label:"Q1",value:s.quartiles.q_25},{label:"Median",value:s.quartiles.q_50},{label:"Q3",value:s.quartiles.q_75},{label:"Maximum",value:s.whiskers.max},{label:"IQR",value:s.quartiles.q_75-s.quartiles.q_25}]}),t.services.events.dispatchEvent(C.Boxplot.BOX_MOUSEOVER,{event:r,element:a,datum:s})}).on("mousemove",function(r,s){const a=P(this);t.services.events.dispatchEvent(C.Boxplot.BOX_MOUSEMOVE,{event:r,element:a,datum:s}),t.services.events.dispatchEvent(C.Tooltip.MOVE,{event:r})}).on("click",function(r,s){t.services.events.dispatchEvent(C.Boxplot.BOX_CLICK,{event:r,element:P(this),datum:s})}).on("mouseout",function(r,s){const a=P(this);P(this.parentNode).select("path.box").classed("hovered",!1).attr("fill-opacity",pe.box.opacity.default),t.services.events.dispatchEvent(C.Boxplot.BOX_MOUSEOUT,{event:r,element:a,datum:s}),t.services.events.dispatchEvent(C.Tooltip.HIDE,{hoveredElement:a})})}addCircleEventListeners(){const t=this,n=this.getOptions(),{groupMapsTo:i}=n.data,r=this.services.cartesianScales.getRangeIdentifier();this.parent.selectAll("circle").on("mouseover",function(s,a){const o=P(this);o.classed("hovered",!0).attr("fill-opacity",pe.circle.opacity.hovered).classed("unfilled",!1),t.services.events.dispatchEvent(C.Tooltip.SHOW,{event:s,hoveredElement:o,items:[{label:n.tooltip.groupLabel,value:a[i],class:t.model.getColorClassName({classNameTypes:[J.TOOLTIP]})},{label:"Outlier",value:a[r]}]}),t.services.events.dispatchEvent(C.Boxplot.OUTLIER_MOUSEOVER,{event:s,element:o,datum:a})}).on("mousemove",function(s,a){const o=P(this);t.services.events.dispatchEvent(C.Boxplot.OUTLIER_MOUSEMOVE,{event:s,element:o,datum:a}),t.services.events.dispatchEvent(C.Tooltip.MOVE,{event:s})}).on("click",function(s,a){t.services.events.dispatchEvent(C.Boxplot.OUTLIER_CLICK,{event:s,element:P(this),datum:a})}).on("mouseout",function(s,a){const o=P(this);o.classed("hovered",!1).attr("fill-opacity",pe.circle.opacity.default),t.services.events.dispatchEvent(C.Boxplot.OUTLIER_MOUSEOUT,{event:s,element:o,datum:a}),t.services.events.dispatchEvent(C.Tooltip.HIDE,{hoveredElement:o})})}}class Ci extends ht{constructor(){super(...arguments),this.type="zero-line",this.renderType=K.SVG}render(t){const n=this.services.cartesianScales.getRangeAxisPosition({groups:this.configs.groups}),i=this.services.cartesianScales.getScaleByPosition(n),[r,s]=i.domain(),a=r>0&&s<0||r<0&&s>0,o=this.getComponentContainer();if(!a){o.selectAll("line.domain").remove();return}const[c,l]=this.services.cartesianScales.getDomainScale().range();let u=+i(0)+.5;u||(u=i.range()[0]);const h=Cp({x0:c,x1:l,y0:u,y1:u},this.services.cartesianScales.getOrientation());R.appendOrSelect(o,"line.domain").transition().call(d=>this.services.transitions.setupTransition({transition:d,name:"zero-line-update",animate:t})).attr("y1",h.y0).attr("y2",h.y1).attr("x1",h.x0).attr("x2",h.x1)}}class Rk extends Ue{constructor(){super(...arguments),this.type="bubble",this.renderType=K.SVG}getRadiusScale(t){const n=this.getOptions(),{radiusMapsTo:i}=n.bubble,r=t.data(),s=r.map(l=>l[i]).filter(l=>l),a=R.getHTMLElementSize(this.services.domUtils.getMainContainer()),o=s.length>0,c=o?ye(s):[1,1];return _e().domain(c).range(o?n.bubble.radiusRange(a,r):[4,4])}styleCircles(t,n){const i=this.getOptions(),{radiusMapsTo:r}=i.bubble,s=this.getRadiusScale(t),{groupMapsTo:a}=i.data,{cartesianScales:o}=this.services,c=d=>o.getDomainValue(d),l=d=>o.getRangeValue(d),[u,h]=sn(c,l,o.getOrientation());t.raise().classed("dot",!0).attr("role",at.GRAPHICS_SYMBOL).attr("aria-label",d=>{const f=o.getRangeIdentifier(d);return d[f]}).transition().call(d=>this.services.transitions.setupTransition({transition:d,name:"bubble-update-enter",animate:n})).attr("cx",u).attr("cy",h).attr("r",d=>s(d[r]||1)).attr("class",d=>this.model.getColorClassName({classNameTypes:[J.FILL,J.STROKE],dataGroupName:d[a],originalClassName:"dot"})).style("fill",d=>{const f=this.services.cartesianScales.getDomainIdentifier(d);return this.model.getFillColor(d[a],d[f],d)}).style("stroke",d=>{const f=this.services.cartesianScales.getDomainIdentifier(d);return this.model.getStrokeColor(d[a],d[f],d)}).attr("fill-opacity",i.bubble.fillOpacity).attr("opacity",1)}getTooltipAdditionalItems(t){const n=E(this.getOptions(),"bubble");return[{label:E(n,"radiusLabel"),value:t[E(n,"radiusMapsTo")]}]}}class Ik extends ht{constructor(){super(...arguments),this.type="bullet",this.renderType=K.SVG,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail,{groupMapsTo:i}=this.getOptions().data;this.parent.selectAll("path.bar").transition("legend-hover-simple-bar").call(r=>this.services.transitions.setupTransition({transition:r,name:"legend-hover-simple-bar"})).attr("opacity",r=>r[i]!==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(C.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(C.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t){const n=this.getOptions(),{groupMapsTo:i}=n.data,r=this.getComponentContainer({withinChartClip:!0}),s=this.model.getDisplayData(this.configs.groups),a=this.services.cartesianScales.getRangeScale(),o=this.services.cartesianScales.getRangeIdentifier(),[c,l]=a.range(),[,u]=a.domain(),h=()=>{const m=[];s.forEach(v=>{v.ranges?v.ranges.forEach((b,w)=>{b!=null&&b<u&&m.push({datum:v,value:b,order:w+1})}):m.push({datum:v,order:1})});const g=R.appendOrSelect(r,"g.range-boxes").selectAll("path.range-box").data(m,v=>`${v[i]}-${v.order}`);g.exit().attr("opacity",0).remove(),g.enter().append("path").attr("opacity",0).merge(g).attr("class",v=>`range-box order-${v.order}`).transition().call(v=>this.services.transitions.setupTransition({transition:v,name:"bullet-range-box-update-enter",animate:t})).attr("d",v=>{let b,w,O,_;return v.order===1?(b=this.services.cartesianScales.getDomainValue(v.datum)-16/2,w=b+16,O=l-2,_=c+1):(b=this.services.cartesianScales.getDomainValue(v.datum)-16/2,w=b+16,O=this.services.cartesianScales.getRangeValue(v.value),_=l),Qt({x0:b,x1:w,y0:O,y1:_},this.services.cartesianScales.getOrientation())}).attr("opacity",1)},d=()=>{const m=R.appendOrSelect(r,"g.bars").selectAll("path.bar").data(s,g=>g[i]);m.exit().attr("opacity",0).remove(),m.enter().append("path").attr("opacity",0).merge(m).classed("bar",!0).transition().call(g=>this.services.transitions.setupTransition({transition:g,name:"bullet-bar-update-enter",animate:t})).attr("class",g=>this.model.getColorClassName({classNameTypes:[J.FILL],dataGroupName:g[i],originalClassName:"bar"})).style("fill",g=>this.model.getFillColor(g[i])).attr("d",g=>{const v=this.services.cartesianScales.getDomainValue(g)-4,b=v+8,w=this.services.cartesianScales.getRangeValue(0)+1,O=this.services.cartesianScales.getRangeValue(g);return Qt({x0:v,x1:b,y0:w,y1:O},this.services.cartesianScales.getOrientation())}).attr("opacity",1).attr("role",at.GRAPHICS_SYMBOL).attr("aria-roledescription","bar").attr("aria-label",g=>g.value)},f=()=>{const m=R.appendOrSelect(r,"g.markers").selectAll("path.marker").data(s.filter(g=>E(g,"marker")!==null),g=>g[i]);m.exit().attr("opacity",0).remove(),m.enter().append("path").attr("opacity",0).merge(m).classed("marker",!0).transition().call(g=>this.services.transitions.setupTransition({transition:g,name:"bullet-marker-update-enter",animate:t})).attr("d",g=>{const v=this.services.cartesianScales.getDomainValue(g)-12,b=v+24,w=this.services.cartesianScales.getRangeValue(g.marker);return Qt({x0:v,x1:b,y0:w,y1:w},this.services.cartesianScales.getOrientation())}).attr("opacity",1)},p=()=>{let m=[];s.filter(v=>E(v,"marker")!==null).forEach(v=>{const b=v.marker,w=v[o];m=m.concat([{datum:v,value:b*.25,barValue:w},{datum:v,value:b*.5,barValue:w},{datum:v,value:b*.75,barValue:w}])});const g=R.appendOrSelect(r,"g.quartiles").selectAll("path.quartile").data(m,v=>v[i]);g.exit().attr("opacity",0).remove(),g.enter().append("path").attr("opacity",0).merge(g).attr("class",v=>`quartile ${v.value<=v.barValue?"over-bar":""}`).transition().call(v=>this.services.transitions.setupTransition({transition:v,name:"bullet-quartile-update-enter",animate:t})).attr("d",({datum:v,value:b})=>{let w=4;v.ranges&&v.ranges.indexOf(b)!==-1&&(w=8);const O=this.services.cartesianScales.getDomainValue(v)-w/2,_=O+w,T=this.services.cartesianScales.getRangeValue(b);return Qt({x0:O,x1:_,y0:T,y1:T},this.services.cartesianScales.getOrientation())}).attr("opacity",1)};h(),d(),f(),p(),this.addEventListeners()}addEventListeners(){const t=this,n=this.getOptions(),{groupMapsTo:i}=n.data,r=this.services.cartesianScales.getRangeIdentifier();this.parent.selectAll("path.bar").on("mouseover",function(s,a){const o=P(this);o.classed("hovered",!0),t.services.events.dispatchEvent(C.Bar.BAR_MOUSEOVER,{event:s,element:o,datum:a});const c=E(n,"bullet","performanceAreaTitles"),l=t.model.getMatchingRangeIndexForDatapoint(a);t.services.events.dispatchEvent(C.Tooltip.SHOW,{event:s,hoveredElement:o,items:[{label:n.tooltip.groupLabel||"Group",value:a[i],class:t.model.getColorClassName({classNameTypes:[J.TOOLTIP],dataGroupName:a[i]})},{label:"Value",value:a[r]},{label:"Target",value:a.marker},{label:"Percentage",value:`${Math.floor(a[r]/a.marker*100)}%`},{label:"Performance",value:c[l]}]})}).on("mousemove",function(s,a){t.services.events.dispatchEvent(C.Bar.BAR_MOUSEMOVE,{event:s,element:P(this),datum:a}),t.services.events.dispatchEvent(C.Tooltip.MOVE,{event:s})}).on("click",function(s,a){t.services.events.dispatchEvent(C.Bar.BAR_CLICK,{event:s,element:P(this),datum:a})}).on("mouseout",function(s,a){const o=P(this);o.classed("hovered",!1),t.services.events.dispatchEvent(C.Bar.BAR_MOUSEOUT,{event:s,element:o,datum:a}),t.services.events.dispatchEvent(C.Tooltip.HIDE,{hoveredElement:o})})}destroy(){this.parent.selectAll("path.bar").on("mouseover",null).on("mousemove",null).on("mouseout",null);const t=this.services.events;t.removeEventListener(C.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(C.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}}function Pk(e){return e}function Nk(e){if(e==null)return Pk;var t,n,i=e.scale[0],r=e.scale[1],s=e.translate[0],a=e.translate[1];return function(o,c){c||(t=n=0);var l=2,u=o.length,h=new Array(u);for(h[0]=(t+=o[0])*i+s,h[1]=(n+=o[1])*r+a;l<u;)h[l]=o[l],++l;return h}}function Uk(e,t){for(var n,i=e.length,r=i-t;r<--i;)n=e[r],e[r++]=e[i],e[i]=n}function Bk(e,t){return typeof t=="string"&&(t=e.objects[t]),t.type==="GeometryCollection"?{type:"FeatureCollection",features:t.geometries.map(function(n){return Wg(e,n)})}:Wg(e,t)}function Wg(e,t){var n=t.id,i=t.bbox,r=t.properties==null?{}:t.properties,s=mc(e,t);return n==null&&i==null?{type:"Feature",properties:r,geometry:s}:i==null?{type:"Feature",id:n,properties:r,geometry:s}:{type:"Feature",id:n,bbox:i,properties:r,geometry:s}}function mc(e,t){var n=Nk(e.transform),i=e.arcs;function r(u,h){h.length&&h.pop();for(var d=i[u<0?~u:u],f=0,p=d.length;f<p;++f)h.push(n(d[f],f));u<0&&Uk(h,p)}function s(u){return n(u)}function a(u){for(var h=[],d=0,f=u.length;d<f;++d)r(u[d],h);return h.length<2&&h.push(h[0]),h}function o(u){for(var h=a(u);h.length<4;)h.push(h[0]);return h}function c(u){return u.map(o)}function l(u){var h=u.type,d;switch(h){case"GeometryCollection":return{type:h,geometries:u.geometries.map(l)};case"Point":d=s(u.coordinates);break;case"MultiPoint":d=u.coordinates.map(s);break;case"LineString":d=a(u.arcs);break;case"MultiLineString":d=u.arcs.map(a);break;case"Polygon":d=c(u.arcs);break;case"MultiPolygon":d=u.arcs.map(c);break;default:return null}return{type:h,coordinates:d}}return l(t)}function Hk(e,t){var n={},i={},r={},s=[],a=-1;t.forEach(function(l,u){var h=e.arcs[l<0?~l:l],d;h.length<3&&!h[1][0]&&!h[1][1]&&(d=t[++a],t[a]=l,t[u]=d)}),t.forEach(function(l){var u=o(l),h=u[0],d=u[1],f,p;if(f=r[h])if(delete r[f.end],f.push(l),f.end=d,p=i[d]){delete i[p.start];var m=p===f?f:f.concat(p);i[m.start=f.start]=r[m.end=p.end]=m}else i[f.start]=r[f.end]=f;else if(f=i[d])if(delete i[f.start],f.unshift(l),f.start=h,p=r[h]){delete r[p.end];var g=p===f?f:p.concat(f);i[g.start=p.start]=r[g.end=f.end]=g}else i[f.start]=r[f.end]=f;else f=[l],i[f.start=h]=r[f.end=d]=f});function o(l){var u=e.arcs[l<0?~l:l],h=u[0],d;return e.transform?(d=[0,0],u.forEach(function(f){d[0]+=f[0],d[1]+=f[1]})):d=u[u.length-1],l<0?[d,h]:[h,d]}function c(l,u){for(var h in l){var d=l[h];delete u[d.start],delete d.start,delete d.end,d.forEach(function(f){n[f<0?~f:f]=1}),s.push(d)}}return c(r,i),c(i,r),t.forEach(function(l){n[l<0?~l:l]||s.push([l])}),s}function Vk(e){for(var t=-1,n=e.length,i,r=e[n-1],s=0;++t<n;)i=r,r=e[t],s+=i[0]*r[1]-i[1]*r[0];return Math.abs(s)}function Gk(e){return mc(e,Fk.apply(this,arguments))}function Fk(e,t){var n={},i=[],r=[];t.forEach(s);function s(c){switch(c.type){case"GeometryCollection":c.geometries.forEach(s);break;case"Polygon":a(c.arcs);break;case"MultiPolygon":c.arcs.forEach(a);break}}function a(c){c.forEach(function(l){l.forEach(function(u){(n[u=u<0?~u:u]||(n[u]=[])).push(c)})}),i.push(c)}function o(c){return Vk(mc(e,{type:"Polygon",arcs:[c]}).coordinates[0])}return i.forEach(function(c){if(!c._){var l=[],u=[c];for(c._=1,r.push(l);c=u.pop();)l.push(c),c.forEach(function(h){h.forEach(function(d){n[d<0?~d:d].forEach(function(f){f._||(f._=1,u.push(f))})})})}}),i.forEach(function(c){delete c._}),{type:"MultiPolygon",arcs:r.map(function(c){var l=[],u;if(c.forEach(function(m){m.forEach(function(g){g.forEach(function(v){n[v<0?~v:v].length<2&&l.push(v)})})}),l=Hk(e,l),(u=l.length)>1)for(var h=1,d=o(l[0]),f,p;h<u;++h)(f=o(l[h]))>d&&(p=l[0],l[0]=l[h],l[h]=p,d=f);return l}).filter(function(c){return c.length>0})}}class zk extends vn{constructor(){super(...arguments),this.type="ruler-binned",this.renderType=K.SVG}showRuler(t,[n,i]){const r=this.parent,s=this.model.getOptions(),{cartesianScales:a}=this.services,o=a.getOrientation(),c=a.getRangeScale(),[l,u]=c.range(),h=a.getDomainScale(),d=h.invert(o===Ht.VERTICAL?n:i),f=R.appendOrSelect(r,"g.ruler").attr("aria-label","ruler"),p=R.appendOrSelect(f,"line.ruler-line"),m=r.selectAll("[role=graphics-symbol]").filter(g=>{if(parseFloat(St(g,"data.x0"))<=d&&parseFloat(St(g,"data.x1"))>=d)return!0});if(m.size()>0){this.elementsToHighlight&&this.elementsToHighlight.size()>0&&!Sg(this.elementsToHighlight,m)&&this.hideRuler(),m.dispatch("mouseover"),this.elementsToHighlight=m;const g=P(m.nodes()[0]).datum(),v=parseFloat(St(g,"data.x0")),b=parseFloat(St(g,"data.x1")),w=this.model.getActiveDataGroupNames(),O=w.reverse().map(_=>({label:_,value:St(g,`data.${_}`),class:this.model.getColorClassName({classNameTypes:[J.TOOLTIP],dataGroupName:_})})).filter(_=>_.value!==0);if(O.length>0){this.services.events.dispatchEvent(C.Tooltip.SHOW,{mousePosition:[n,i],hoveredElement:p,items:[{label:St(s,"bins.rangeLabel")||"Range",value:`${v} – ${b}`},...O,...E(s,"tooltip","showTotal")===!0?[{label:St(s,"tooltip.totalLabel")||"Total",value:w.reduce((T,S)=>T+parseFloat(St(g,`data.${S}`)),0)}]:[]]}),f.attr("opacity",1);const _=h((v+b)/2);o==="horizontal"?p.attr("x1",u).attr("x2",l).attr("y1",_).attr("y2",_):p.attr("y1",u).attr("y2",l).attr("x1",_).attr("x2",_)}else this.hideRuler()}else this.hideRuler()}}class La extends vn{formatTooltipData(t){return t.reverse()}}class qg extends pc{constructor(t,n,i){super(t,n,i),this.type="color-legend",this.renderType=K.SVG,this.gradient_id=`gradient-id-${Math.floor(Math.random()*99999999999)}`,this.handleAxisCompleteEvent=()=>{const r=this.getComponentContainer(),{width:s}=R.getSVGElementSize(r,{useAttrs:!0}),a=E(this.getOptions(),"data","loading");if(s>Lt.color.barWidth&&!a){const o=E(this.getOptions(),"heatmap","colorLegend","title"),{cartesianScales:c}=this.services,l=c.getMainXScale().range();if(l[0]>1&&(r.select("g.legend").attr("transform",`translate(${l[0]}, 0)`),o)){const{width:u}=R.getSVGElementSize(r.select("g.legend-title").select("text"),{useBBox:!0}),h=l[0]-u-9;h>1?r.select("g.legend-title").attr("transform",`translate(${h}, 0)`):(r.select("g.legend").attr("transform",`translate(${l[0]}, 16)`),r.select("g.legend-title").attr("transform",`translate(${l[0]}, 0)`))}}else r.select("g.legend-title").attr("transform","translate(0, 0)")},this.chartType=i.chartType}init(){this.chartType==="heatmap"&&this.services.events.addEventListener(C.Axis.RENDER_COMPLETE,this.handleAxisCompleteEvent)}render(t=!1){const n=this.getOptions(),i=this.getComponentContainer(),{width:r}=R.getSVGElementSize(i,{useAttrs:!0}),s=E(n,"color","gradient","colors"),a=E(n,this.chartType,"colorLegend","type");let o=E(n,"color","pairing","option");const c=E(n,"heatmap","colorLegend","title");if(E(this.getOptions(),"data","loading")){i.html("");return}const l=!Ce(s),u=Gp(this.model.getDisplayData()),h=!(r<=Lt.color.barWidth),d=h?Lt.color.barWidth:r,f=R.appendOrSelect(i,"g.legend"),p=R.appendOrSelect(f,"g.legend-axis");if(c){const S=R.appendOrSelect(i,"g.legend-title");R.appendOrSelect(S,"text").text(c).attr("dy","0.7em"),f.attr("transform","translate(0, 16)")}const m=u[0]<0&&u[1]>0?"diverge":"mono";(o<1&&o>4&&m==="mono"||o<1&&o>2&&m==="diverge")&&(o=1);let g=[];const v=m==="diverge"?17:11;if(l)g=s;else for(let S=1;S<v+1;S++)g.push(a===qs.LINEAR?`stop-color-${m}-${o}-${S}`:`fill-${m}-${o}-${S}`);const b=oe(u[0],u[1]),w=Ry(b,3),O=_e().domain(u).range([0,d]),_=Ua(O).tickSize(0).tickValues(w);let T;switch(a){case qs.LINEAR:this.drawLinear(g,f,d);break;case qs.QUANTIZE:T=this.drawQuantize(g,m,l,f,d),O.range([T,d]);break;default:throw Error("Entered color legend type is not supported.")}p.attr("transform",`translate(0,${Lt.color.axisYTranslation})`).call(_),p.select(".domain").remove(),p.select("g.tick:last-of-type text").style("text-anchor",h?"middle":"end"),p.select("g.tick:first-of-type text").style("text-anchor",h&&this.chartType!=="choropleth"?"middle":"start")}drawLinear(t,n,i){const r=100/(t.length-1);R.appendOrSelect(n,"linearGradient").attr("id",`${this.gradient_id}-legend`).selectAll("stop").data(t).enter().append("stop").attr("offset",(s,a)=>`${a*r}%`).attr("class",(s,a)=>t[a]).attr("stop-color",s=>s),R.appendOrSelect(n,"rect").attr("width",i).attr("height",Lt.color.barHeight).style("fill",`url(#${this.gradient_id}-legend)`)}drawQuantize(t,n,i,r,s){!i&&n==="diverge"&&t.splice(t.length/2,1);const a=er().domain(t).range([0,s]);return R.appendOrSelect(r,"g.quantized-rect").selectAll("rect").data(a.domain()).join("rect").attr("x",o=>a(o)).attr("y",0).attr("width",Math.max(0,a.bandwidth()-1)).attr("height",Lt.color.barHeight).attr("class",o=>o).attr("fill",o=>o),(!i&&n)==="mono"?a.bandwidth()-1:0}destroy(){this.chartType==="heatmap"&&this.services.events.removeEventListener(C.Axis.RENDER_COMPLETE,this.handleAxisCompleteEvent)}}class jk extends Ir{constructor(){super(...arguments),this.type="meter-title",this.renderType=K.SVG}render(t=!1){const n=E(this.model.getDisplayData(),0),i=this.getOptions(),r=this.getComponentContainer(),{groupMapsTo:s}=i.data;if(E(i,"meter","proportional"))this.displayTotal(),this.displayBreakdownTitle();else{const c=r.selectAll("text.meter-title").data([n[s]]);c.enter().append("text").classed("meter-title",!0).merge(c).attr("x",0).attr("y","1em").text(l=>l),c.exit().remove(),this.appendPercentage()}this.displayStatus();const a=this.getMaxTitleWidth(),o=R.appendOrSelect(r,"text.meter-title");a>0&&o.node().getComputedTextLength()>a&&this.truncateTitle(o,a)}displayBreakdownTitle(){const t=this.getComponentContainer(),n=this.getOptions(),i=this.model.getMaximumDomain(this.model.getDisplayData()),r=E(n,"meter","proportional","total"),s=E(n,"meter","proportional","unit")?E(n,"meter","proportional","unit"):"";let a;if(i===r)a=null;else{const u=r!==null?r-i:i,h=E(n,"meter","proportional","breakdownFormatter");a=h!==null?h({datasetsTotal:i,total:r}):`${i} ${s} used (${u} ${s} available)`}const o=t.selectAll("text.proportional-meter-title").data([a]);o.enter().append("text").classed("proportional-meter-title",!0).merge(o).attr("x",0).attr("y","1em").text(u=>u),o.exit().remove();const c=this.getMaxTitleWidth(),l=R.appendOrSelect(t,"text.proportional-meter-title");c>0&&l.node().getComputedTextLength()>c&&this.truncateTitle(l,c)}displayTotal(){const t=this.getComponentContainer(),n=this.getOptions(),i=E(n,"meter","proportional","total"),r=i?E(n,"meter","proportional","total"):this.model.getMaximumDomain(this.model.getDisplayData()),s=E(n,"meter","proportional","unit")?E(n,"meter","proportional","unit"):"",a=E(n,"meter","proportional","totalFormatter"),o=a!==null?a(r):`${i} ${s} total`,c=R.getHTMLElementSize(this.services.domUtils.getMainContainer()),l=c.width?c.width:this.parent.node().getAttribute("width"),u=t.selectAll("text.proportional-meter-total").data([o]);u.enter().append("text").classed("proportional-meter-total",!0).merge(u).attr("x",this.model.getStatus()&&typeof l!="string"?l-Gt.total.paddingRight:l).attr("y","1em").attr("text-anchor","end").text(h=>h),u.exit().remove()}displayStatus(){const t=this,n=this.getComponentContainer(),i=R.getHTMLElementSize(this.services.domUtils.getMainContainer()),r=i.width?i.width:0,s=this.model.getStatus(),a=Gt.status.indicatorSize/2,o=R.appendOrSelect(n,"g.status-indicator").attr("class",s!==null?`status-indicator status--${s}`:"").attr("transform",`translate(${r-a}, 0)`),c=s?[s]:[],l=o.selectAll("circle.status").data(c);l.enter().append("circle").merge(l).attr("class","status").attr("r",a).attr("cx",0).attr("cy",8);const u=o.selectAll("path.innerFill").data(c);u.enter().append("path").merge(u).attr("d",t.getStatusIconPathString(s)).attr("transform",`translate(-${a}, 0)`).attr("class","innerFill"),u.exit().remove(),l.exit().remove()}appendPercentage(){const t=E(this.model.getDisplayData(),0,"value"),n=this.getComponentContainer(),i=R.appendOrSelect(n,"text.meter-title"),r=E(this.getOptions(),"meter","statusBar","percentageIndicator","enabled")===!0?[t]:[],s=n.selectAll("text.percent-value").data(r),a=Gt.statusBar.paddingRight;s.enter().append("text").classed("percent-value",!0).merge(s).text(o=>`${o}%`).attr("x",+i.attr("x")+i.node().getComputedTextLength()+a).attr("y",i.attr("y")),s.exit().remove()}truncateTitle(t,n){super.truncateTitle(t,n);const i=R.appendOrSelect(this.parent,"tspan"),r=Gt.statusBar.paddingRight,s=Math.ceil(i.node().getComputedTextLength());R.appendOrSelect(this.parent,"text.percent-value").attr("x",+t.attr("x")+t.node().getComputedTextLength()+s+r)}getMaxTitleWidth(){const t=R.getHTMLElementSize(this.services.domUtils.getMainContainer()),n=E(this.getOptions(),"meter","proportional"),i=t.width?t.width:this.parent.node().getBoundingClientRect().width;if(n!==null){const r=R.appendOrSelect(this.parent,"text.proportional-meter-total").node(),s=R.getSVGElementSize(r,{useBBox:!0}).width;return i-s-Gt.total.paddingLeft}else{const r=R.appendOrSelect(this.parent,"text.percent-value"),s=Gt.statusBar.paddingRight,a=r.node().getComputedTextLength(),o=R.appendOrSelect(this.parent,"g.status-indicator").node(),c=R.getSVGElementSize(o,{useBBox:!0}).width+Gt.status.paddingLeft;return i-a-s-c}}getStatusIconPathString(t){switch(t){case js.SUCCESS:return"M6.875 11.3125 3.75 8.1875 4.74375 7.25 6.875 9.34375 11.50625 4.75 12.5 5.7375 Z";case js.DANGER:return"M10.7 11.5 4.5 5.3 5.3 4.5 11.5 10.7 Z";case js.WARNING:return"M7.9375,11.125 C7.41973305,11.125 7,11.544733 7,12.0625 C7,12.580267 7.41973305,13 7.9375,13 C8.45526695,13 8.875,12.580267 8.875,12.0625 C8.875,11.544733 8.45526695,11.125 7.9375,11.125 M7.3125, 3 8.5625, 3 8.5625, 9.875 7.3125, 9.875, 7.3125, 3 Z"}}}class vc extends ht{getBarWidth(){const t=this.getOptions();if(t.bars.width)return t.bars.width;const n=this.model.getDisplayData().length,i=this.services.cartesianScales.getMainXScale(),r=R.getSVGElementSize(this.parent,{useAttrs:!0}).width;if(!i.step){const s=E(t,"bars","spacingFactor");return Math.min(t.bars.maxWidth,r*s/n)}return Math.min(t.bars.maxWidth,i.step()/2)}isOutsideZoomedDomain(t,n){if(this.model.getDisplayData().length<=1)return!1;const i=this.model.get("zoomDomain");if(i!==void 0){const r=this.services.cartesianScales.getDomainScale();return t<r(i[0])||n>r(i[1])}return!1}}class Wk extends ht{constructor(){super(...arguments),this.type="circle-pack",this.renderType=K.SVG,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail;this.parent.selectAll("circle.node").transition("legend-hover-circlepack").call(i=>this.services.transitions.setupTransition({transition:i,name:"legend-hover-circlepack"})).attr("opacity",i=>i.data.dataGroupName===n.datum().name?1:mi.circles.fillOpacity)},this.handleLegendMouseOut=()=>{this.parent.selectAll("circle.node").transition("legend-mouseout-circlepack").call(t=>this.services.transitions.setupTransition({transition:t,name:"legend-mouseout-circlepack"})).attr("opacity",1)}}render(t=!0){const n=this.getComponentContainer({withinChartClip:!0}),{width:i,height:r}=R.getSVGElementSize(this.parent,{useAttrs:!0});if(i<1||r<1)return;let s=this.model.getDisplayData();const a=this.model.hasParentNode(),o=this.model.getHierarchyLevel(),c=this.getOptions(),l=E(c,"canvasZoom","enabled");a&&E(s,0,"children")&&(s=E(s,0,"children"));const u=Qi({children:s}).sum(p=>p.value).sort((p,m)=>m.value-p.value),h=Xb().size([i,r]).padding(p=>p.depth>=1?mi.padding.children+3:mi.padding.mainGroup+3)(u).descendants().splice(1).filter(p=>p.depth<=o),d=n.selectAll("circle.node").data(h);d.exit().attr("width",0).attr("height",0).remove();const f=d.enter().append("circle").classed("node",!0);f.merge(d).attr("class",p=>{const m=l&&o===3?this.getZoomClass(p):"";return this.model.getColorClassName({classNameTypes:[J.FILL,J.STROKE],dataGroupName:p.data.dataGroupName,originalClassName:p.children?`node ${m}`:`node node-leaf ${m}`})}).style("fill",p=>this.model.getFillColor(p.data.dataGroupName)).style("stroke",p=>this.model.getFillColor(p.data.dataGroupName)).attr("cx",p=>p.x).attr("cy",p=>p.y).transition("circlepack-leaf-update-enter").call(p=>this.services.transitions.setupTransition({transition:p,name:"circlepack-leaf-update-enter"})).attr("r",p=>p.r).attr("opacity",1).attr("fill-opacity",mi.circles.fillOpacity),l===!0&&this.focal&&(this.services.canvasZoom.zoomIn(this.focal,f,gi),this.setBackgroundListeners()),a||this.addLegendListeners(),this.addEventListeners()}unhighlightChildren(t){const n=t.map(i=>i.data);this.parent.selectAll("circle.node").filter(i=>n.some(r=>r===i.data)&&i.depth>1).style("stroke",i=>this.model.getFillColor(i.data.dataGroupName))}highlightChildren(t){const n=t.map(i=>i.data);this.parent.selectAll("circle.node").filter(i=>n.some(r=>r===i.data)&&i.depth>1).style("stroke",mi.circles.hover.stroke)}getZoomClass(t){return this.model.getHierarchyLevel()===3&&this.focal&&(t.data===this.focal.data||this.focal.children.some(n=>n.data===t.data))?"focal":"non-focal"}addLegendListeners(){const{events:t}=this.services;t.addEventListener(C.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(C.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}removeBackgroundListeners(){P(this.services.domUtils.getMainContainer()).on("click",()=>null)}setBackgroundListeners(){const t=P(this.services.domUtils.getMainContainer()),n=this,i=this.parent.selectAll("circle.node");t.on("click",()=>{n.focal=null,n.model.updateHierarchyLevel(2),t.classed("zoomed-in",!1),n.services.canvasZoom.zoomOut(i,gi)})}getZoomIcon(){return`
|
|
80
80
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 10">
|
|
81
81
|
<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"/>
|
|
82
82
|
<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"/>
|
|
83
|
-
</svg>`}addEventListeners(){const t=this;this.parent.selectAll("circle.node").on("mouseover",function(n,i){const r=P(this);r.classed("hovered",!0);const s=t.model.getHierarchyLevel(),a=s>2&&!r.classed("focal"),o=E(t.model.getOptions(),"canvasZoom","enabled");let c=!1;if(!a){let l=[],u=[],h=null;if(i.children){i.depth>1&&o&&(c=!0,r.classed("clickable",!0)),l=i.children.map(p=>{if(p!==null)return typeof p.data.value=="number"?{label:p.data.name,value:p.data.value}:{label:p.data.name,labelIcon:o&&s<=2?t.getZoomIcon():null,value:p.value}});const f=t.model.getOptions();u=[{label:St(f,"tooltip.totalLabel")||"Total",value:i.value,bold:!0}],t.highlightChildren(i.children)}else h=i.value;const d=getComputedStyle(this,null).getPropertyValue("fill");t.services.events.dispatchEvent(C.Tooltip.SHOW,{event:n,hoveredElement:r,items:[{color:d,label:i.data.name,labelIcon:c&&o&&s<=2?t.getZoomIcon():null,value:h},...l,...u]})}t.services.events.dispatchEvent(C.CirclePack.CIRCLE_MOUSEOVER,{event:n,element:r,datum:i})}).on("mousemove",function(n,i){const r=P(this);t.services.events.dispatchEvent(C.CirclePack.CIRCLE_MOUSEMOVE,{event:n,element:r,datum:i}),t.services.events.dispatchEvent(C.Tooltip.MOVE,{event:n})}).on("mouseout",function(n,i){const r=P(this);r.classed("hovered",!1),i.children&&t.unhighlightChildren(i.children),t.services.events.dispatchEvent(C.CirclePack.CIRCLE_MOUSEOUT,{event:n,element:r,datum:i}),t.services.events.dispatchEvent(C.Tooltip.HIDE,{hoveredElement:r})}).on("click",function(n,i){const r=P(this),s=r.classed("non-focal"),a=E(t.model.getOptions(),"canvasZoom","enabled");if(a&&t.model.getHierarchyLevel()>2){const o=t.parent.selectAll("circle.node");P(t.services.domUtils.getMainContainer()).classed("zoomed-in",!1),t.focal=null,t.model.updateHierarchyLevel(2),t.services.canvasZoom.zoomOut(o,gi)}else if(i.depth===2&&i.children&&!s&&a){const o=t.parent.selectAll("circle.node");P(t.services.domUtils.getMainContainer()).classed("zoomed-in",!0),t.focal=i,t.model.updateHierarchyLevel(3),t.services.canvasZoom.zoomIn(i,o,gi),n.stopPropagation()}t.services.events.dispatchEvent(C.CirclePack.CIRCLE_CLICK,{event:n,element:r,datum:i})})}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(C.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(C.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut),this.removeBackgroundListeners()}}function qk(e,t){const n=Pi(this._current,e);return i=>(this._current=n(i),t(this._current))}class Yg extends ht{constructor(){super(...arguments),this.type="pie",this.renderType=K.SVG,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail,{groupMapsTo:i}=this.getOptions().data;this.parent.selectAll("path.slice").transition("legend-hover-bar").call(r=>this.services.transitions.setupTransition({transition:r,name:"legend-hover-bar"})).attr("opacity",r=>r.data[i]!==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(C.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(C.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}getInnerRadius(){return _t.innerRadius}render(t=!0){const n=this,i=this.getComponentContainer(),r=this.getOptions(),{groupMapsTo:s}=r.data,{valueMapsTo:a}=r.pie,o=this.model.getDisplayData().filter(S=>S[a]>0),c=this.computeRadius();this.arc=or().innerRadius(this.getInnerRadius()).outerRadius(c),this.hoverArc=or().innerRadius(this.getInnerRadius()).outerRadius(c+_t.hoverArc.outerRadiusOffset);const l=WE().value(S=>S[a]).sort(E(r,"pie","sortFunction")).padAngle(_t.padAngle)(o),u=R.appendOrSelect(i,"g.slices").attr("role",at.GROUP).attr("data-name","slices").selectAll("path.slice").data(l,S=>S.data[s]);u.exit().attr("opacity",0).remove(),u.enter().append("path").classed("slice",!0).attr("opacity",0).merge(u).attr("class",S=>this.model.getColorClassName({classNameTypes:[J.FILL],dataGroupName:S.data[s],originalClassName:"slice"})).style("fill",S=>n.model.getFillColor(S.data[s])).attr("d",this.arc).transition().call(S=>this.services.transitions.setupTransition({transition:S,name:"pie_slice_enter_update",animate:t})).attr("opacity",1).attr("role",at.GRAPHICS_SYMBOL).attr("aria-roledescription","slice").attr("aria-label",S=>`${S[a]}, ${Mp(S.data[a],o,a)+"%"}`).attrTween("d",function(S){return qk.bind(this)(S,n.arc)});const h=r.pie.labels.enabled,d=h?l.filter(S=>S.data[a]>0):[],f=R.appendOrSelect(i,"g.labels").attr("role",at.GROUP).attr("data-name","labels").selectAll("text.pie-label").data(d,S=>S.data[s]);f.exit().attr("opacity",0).remove();const p=f.enter().append("text").classed("pie-label",!0),m=[];p.merge(f).style("text-anchor","middle").text(S=>r.pie.labels.formatter?r.pie.labels.formatter(S):Mp(S.data[a],o,a)+"%").datum(function(S){const $=c+7,D=(S.endAngle-S.startAngle)/2+S.startAngle,L=D/Math.PI*180,M=this.getComputedTextLength();return S.textOffsetX=M/2,S.textOffsetY=L>90&&L<270?10:0,S.xPosition=(S.textOffsetX+$)*Math.sin(D),S.yPosition=(S.textOffsetY+$)*-Math.cos(D),S}).attr("transform",function(S,$){const D=d.length,L=(S.endAngle-S.startAngle)*(180/Math.PI);if($>=D-2&&L<_t.callout.minSliceDegree){let M,B;return S.index===D-1?(M=S.xPosition+_t.callout.offsetX+_t.callout.textMargin+S.textOffsetX,B=S.yPosition-_t.callout.offsetY,S.direction=zs.RIGHT,m.push(S)):(M=S.xPosition-_t.callout.offsetX-S.textOffsetX-_t.callout.textMargin,B=S.yPosition-_t.callout.offsetY,S.direction=zs.LEFT,m.push(S)),`translate(${M}, ${B})`}return`translate(${S.xPosition}, ${S.yPosition})`}),this.renderCallouts(m);const g=E(r,"donut")?"donut":"pie",v=E(r,g,"alignment"),{width:b}=R.getSVGElementSize(this.getParent(),{useAttrs:!0}),w=h?_t.xOffset:0,O=h?_t.yOffset:0;let _=c+w;v===It.CENTER?_=b/2:v===It.RIGHT&&(_=b-c-_t.xOffset);let T=c+O;m.length>0&&(T+=_t.yOffsetCallout),i.attr("x",_+7).attr("y",T),this.addEventListeners()}renderCallouts(t){const n=R.appendOrSelect(this.getComponentContainer(),"g.callouts").attr("role",at.GROUP).attr("data-name","callouts"),i=n.selectAll("g.callout").data(t);i.exit().remove();const r=i.enter().append("g").classed("callout",!0).attr("role",at.GROUP).attr("aria-roledescription","label callout");r.merge(i).datum(function(s){const{xPosition:a,yPosition:o,direction:c}=s;return c===zs.RIGHT?(s.startPos={x:a,y:o+s.textOffsetY},s.endPos={x:a+_t.callout.offsetX,y:o-_t.callout.offsetY+s.textOffsetY},s.intersectPointX=s.endPos.x-_t.callout.horizontalLineLength):(s.startPos={x:a,y:o+s.textOffsetY},s.endPos={x:a-_t.callout.offsetX,y:o-_t.callout.offsetY+s.textOffsetY},s.intersectPointX=s.endPos.x+_t.callout.horizontalLineLength),s}),r.append("line").classed("vertical-line",!0).merge(n.selectAll("line.vertical-line")).datum(function(){return P(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),r.append("line").classed("horizontal-line",!0).merge(n.selectAll("line.horizontal-line")).datum(function(){return P(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,i){const r=P(this);r.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(C.Pie.SLICE_MOUSEOVER,{event:n,element:P(this),datum:i});const{groupMapsTo:s}=t.getOptions().data,{valueMapsTo:a}=t.getOptions().pie;t.services.events.dispatchEvent(C.Tooltip.SHOW,{event:n,hoveredElement:r,items:[{label:i.data[s],value:i.data[a]}]})}).on("mousemove",function(n,i){const r=P(this);t.services.events.dispatchEvent(C.Pie.SLICE_MOUSEMOVE,{event:n,element:r,datum:i}),t.services.events.dispatchEvent(C.Tooltip.MOVE,{event:n})}).on("click",function(n,i){t.services.events.dispatchEvent(C.Pie.SLICE_CLICK,{event:n,element:P(this),datum:i})}).on("mouseout",function(n,i){const r=P(this);r.classed("hovered",!1).transition("pie_slice_mouseout").call(s=>t.services.transitions.setupTransition({transition:s,name:"pie_slice_mouseout"})).attr("d",t.arc),t.services.events.dispatchEvent(C.Pie.SLICE_MOUSEOUT,{event:n,element:r,datum:i}),t.services.events.dispatchEvent(C.Tooltip.HIDE,{hoveredElement:r})})}computeRadius(){const{width:t,height:n}=R.getSVGElementSize(this.parent,{useAttrs:!0}),i=this.getOptions(),r=Math.min(t,n)/2;return i.pie.labels.enabled?r+_t.radiusOffset:r}}class Yk extends Yg{constructor(){super(...arguments),this.type="donut",this.renderType=K.SVG}render(t=!0){super.render(t);const n=this;if(this.model.isDataEmpty()){this.getComponentContainer().select("g.center").remove();return}const i=R.appendOrSelect(this.getComponentContainer(),"g.center"),r=this.getOptions(),s=this.computeRadius(),a=E(r,"donut","center","label");R.appendOrSelect(i,"text.donut-figure").attr("text-anchor","middle").style("dominant-baseline",()=>a===null||a===""?"central":"initial").style("font-size",()=>r.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(P(this))}),a!==null&&a!==""&&R.appendOrSelect(i,"text.donut-title").attr("text-anchor","middle").style("font-size",()=>r.donut.center.titleFontSize(s)).attr("y",r.donut.center.titleYPosition(s)).text(a)}getInnerRadius(){return this.computeRadius()*(3/4)}centerNumberTween(t){const n=this.getOptions();let i=E(n,"donut","center","number");i===null&&(i=this.model.getDisplayData().reduce((o,c)=>o+c[n.pie.valueMapsTo],0));const r=parseInt(t.text().replace(/[, ]+/g,""),10)||0;let s;r%1===0&&i%1===0?s=su:s=oe;const a=s(r,i);return o=>{const{numberFormatter:c}=n.donut.center;t.text(c(a(o)))}}}const Xg="4,10 8,6 12,10",Zg="12,6 8,10 4,6";class Xk extends ht{constructor(){super(...arguments),this.type="gauge",this.renderType=K.SVG}getValue(){var t;return((t=this.model.getData().find(n=>n.group==="value"))==null?void 0:t.value)??null}getValueRatio(){return _g(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 E(t,"gauge","type")===di.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(E(n,"gauge","deltaArrow","direction")){case dl.UP:return Xg;case dl.DOWN:return Zg;default:return t>0?Xg:Zg}}render(t=!0){const n=this.getComponentContainer().attr("width","100%").attr("height","100%"),i=this.getOptions(),r=this.getValue(),s=this.getValueRatio(),a=this.getArcSize(),o=this.getStartAngle(),c=s*a,l=o+c,u=o+a,h=this.computeRadius(),d=this.getInnerRadius();this.backgroundArc=or().innerRadius(d).outerRadius(h).startAngle(l).endAngle(u),this.arc=or().innerRadius(d).outerRadius(h).startAngle(o).endAngle(l),R.appendOrSelect(n,"path.arc-background").attr("d",this.backgroundArc);const f=n.selectAll("path.arc-foreground").data([r]);f.enter().append("path").merge(f).attr("class",this.model.getColorClassName({classNameTypes:[J.FILL],dataGroupName:"value",originalClassName:"arc-foreground"})).style("fill",()=>E(this.getOptions(),"color","scale","value")).attr("d",this.arc).attr("role",at.GRAPHICS_SYMBOL).attr("aria-roledescription","value").attr("aria-label",v=>v),this.drawValueNumber(),this.drawDelta(),f.exit().remove();const p=E(i,"gauge","alignment"),{width:m}=R.getSVGElementSize(this.getParent(),{useAttrs:!0});let g=h;p===It.CENTER?g=m/2:p===It.RIGHT&&(g=m-h),n.attr("x",g).attr("y",h),this.addEventListeners()}drawValueNumber(){const t=this.getComponentContainer(),n=this.getOptions(),i=E(n,"gauge","type"),r=this.getValue(),s=this.getDelta(),a=this.computeRadius(),o=E(n,"gauge","valueFontSize"),c=E(n,"gauge","deltaFontSize"),l=E(n,"gauge","numberSpacing"),u=E(n,"gauge","showPercentageSymbol");let h=0;i===di.FULL&&!s?h=c(a):i===di.SEMI&&s&&(h=-(c(a)+l));const d=R.appendOrSelect(t,"g.gauge-numbers").attr("transform",`translate(0, ${h})`),f=o(a),p=R.appendOrSelect(d,"g.gauge-value-number"),m=E(n,"gauge","numberFormatter"),g=p.selectAll("text.gauge-value-number").data([r]);g.enter().append("text").attr("class","gauge-value-number").merge(g).style("font-size",`${f}px`).attr("text-anchor","middle").text(S=>m(S));const{width:v}=R.getSVGElementSize(R.appendOrSelect(t,"text.gauge-value-number"),{useBBox:!0}),b=f/2,w=u?"%":"",O=R.appendOrSelect(p,"text.gauge-value-symbol").style("font-size",`${b}px`).attr("x",v/2).text(w),{width:_,height:T}=R.getSVGElementSize(O,{useBBox:!0});O.attr("y",`-${T/2}px`),p.attr("transform",`translate(-${_/2}, 0)`)}drawDelta(){const t=this,n=this.getComponentContainer(),i=this.getOptions(),r=this.getDelta();if(r){const s=this.computeRadius(),a=r?E(i,"gauge","deltaFontSize"):()=>0,o=r?E(i,"gauge","numberFormatter"):()=>null,c=E(i,"gauge","deltaArrow","size"),l=E(i,"gauge","numberSpacing"),u=E(i,"gauge","showPercentageSymbol"),h=R.appendOrSelect(n,"g.gauge-numbers"),d=R.appendOrSelect(h,"g.gauge-delta").attr("transform",`translate(0, ${a(s)+l})`),f=R.appendOrSelect(d,"text.gauge-delta-number"),p=u?"%":"";f.data(r===null?[]:[r]),f.enter().append("text").classed("gauge-delta-number",!0).merge(f).attr("text-anchor","middle").style("font-size",`${a(s)}px`).text(b=>`${o(b)}${p}`);const{width:m}=R.getSVGElementSize(R.appendOrSelect(n,".gauge-delta-number"),{useBBox:!0}),g=E(i,"gauge","deltaArrow","enabled"),v=d.selectAll("svg.gauge-delta-arrow").data(r!==null&&g?[r]:[]);v.enter().append("svg").merge(v).attr("class","gauge-delta-arrow").attr("x",-c(s)-m/2).attr("y",-c(s)/2-a(s)*.35).attr("width",c(s)).attr("height",c(s)).attr("viewBox","0 0 16 16").each(function(){const b=P(this);R.appendOrSelect(b,"rect.gauge-delta-arrow-backdrop").attr("width","16").attr("height","16").attr("fill","none");const w=E(i,"gauge","status");R.appendOrSelect(b,"polygon.gauge-delta-arrow").attr("class",w!==null?`gauge-delta-arrow status--${w}`:"").attr("points",t.getArrow(r))}),v.exit().remove(),f.exit().remove()}else{const s=n.select("g.gauge-delta");s.empty()||s.remove()}}getInnerRadius(){const t=this.computeRadius(),n=E(this.getOptions(),"gauge","arcWidth");return t-n}addEventListeners(){const t=this;this.parent.selectAll("path.arc-foreground").on("mouseover",function(n,i){t.services.events.dispatchEvent(C.Gauge.ARC_MOUSEOVER,{event:n,element:P(this),datum:i})}).on("mousemove",function(n,i){const r=P(this);t.services.events.dispatchEvent(C.Gauge.ARC_MOUSEMOVE,{event:n,element:r,datum:i})}).on("click",function(n,i){t.services.events.dispatchEvent(C.Gauge.ARC_CLICK,{event:n,element:P(this),datum:i})}).on("mouseout",function(n,i){const r=P(this);t.services.events.dispatchEvent(C.Gauge.ARC_MOUSEOUT,{event:n,element:r,datum:i})})}computeRadius(){const t=this.getOptions(),n=E(t,"gauge","type"),{width:i,height:r}=R.getSVGElementSize(this.parent,{useAttrs:!0});return n===di.SEMI?Math.min(i/2,r):Math.min(i/2,r/2)}}class Kg extends vc{constructor(){super(...arguments),this.type="grouped-bar",this.renderType=K.SVG,this.padding=5,this.defaultStepFactor=70,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail,{groupMapsTo:i}=this.getOptions().data;this.parent.selectAll("path.bar").transition("legend-hover-bar").call(r=>this.services.transitions.setupTransition({transition:r,name:"legend-hover-bar"})).attr("opacity",r=>r[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(C.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(C.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t){const n=this.model.getDisplayData(this.configs.groups),i=this.getOptions(),{groupMapsTo:r}=i.data;this.setGroupScale();const s=this.getComponentContainer({withinChartClip:!0}),a=Tr(n.map(u=>{const h=this.services.cartesianScales.getDomainIdentifier(u);return u[h]&&typeof u[h].toString=="function"?u[h].toString():u[h]})),o=s.selectAll("g.bars").data(a,u=>u);o.exit().attr("opacity",0).remove();const c=o.enter().append("g").classed("bars",!0).attr("role",at.GROUP).attr("data-name","bars").merge(o);c.transition().call(u=>this.services.transitions.setupTransition({transition:u,name:"bar-group-update-enter",animate:t})).attr("transform",u=>{const h=this.services.cartesianScales.getDomainValue(u)-this.getGroupWidth()/2;return this.services.cartesianScales.getOrientation()===Ht.VERTICAL?`translate(${h}, 0)`:`translate(0, ${h})`});const l=c.selectAll("path.bar").data(u=>this.getDataCorrespondingToLabel(u),u=>u[r]);l.exit().attr("opacity",0).remove(),l.enter().append("path").attr("opacity",0).merge(l).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:[J.FILL],dataGroupName:u[r],originalClassName:"bar"})).style("fill",u=>this.model.getFillColor(u[r])).attr("d",u=>{const h=this.groupScale(u[r]),d=this.getBarWidth(),f=h,p=h+d,m=this.services.cartesianScales.getRangeAxisPosition({datum:u}),g=this.services.cartesianScales.getValueThroughAxisPosition(m,0),v=this.services.cartesianScales.getRangeValue(u),b=this.services.cartesianScales.getDomainValue(u)-d/2,w=b+d;if(!this.isOutsideZoomedDomain(b,w))return Qt({x0:f,x1:p,y0:g,y1:v},this.services.cartesianScales.getOrientation())}).attr("opacity",1).attr("role",at.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,i){const r=P(this);r.classed("hovered",!0),t.services.events.dispatchEvent(C.Bar.BAR_MOUSEOVER,{event:n,element:r,datum:i}),t.services.events.dispatchEvent(C.Tooltip.SHOW,{event:n,hoveredElement:r,data:[i]})}).on("mousemove",function(n,i){const r=P(this);t.services.events.dispatchEvent(C.Bar.BAR_MOUSEMOVE,{event:n,element:r,datum:i}),t.services.events.dispatchEvent(C.Tooltip.MOVE,{event:n})}).on("click",function(n,i){t.services.events.dispatchEvent(C.Bar.BAR_CLICK,{event:n,element:P(this),datum:i})}).on("mouseout",function(n,i){const r=P(this);r.classed("hovered",!1),t.services.events.dispatchEvent(C.Bar.BAR_MOUSEOUT,{event:n,element:r,datum:i}),t.services.events.dispatchEvent(C.Tooltip.HIDE,{hoveredElement:r})})}destroy(){this.parent.selectAll("path.bar").on("mouseover",null).on("mousemove",null).on("mouseout",null);const t=this.services.events;t.removeEventListener(C.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(C.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}getDataCorrespondingToLabel(t){return this.model.getDisplayData(this.configs.groups).filter(n=>{const i=this.services.cartesianScales.getDomainIdentifier(n);return n[i].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 i=this.defaultStepFactor;if(typeof t.step=="function")i=t.step();else if(n.length>0){const r=n.find(s=>{var a;return((a=s.data)==null?void 0:a.length)>1});if(r){const s=this.services.cartesianScales.getDomainIdentifier(r.data[0]);i=Math.abs(t(r.data[1][s])-t(r.data[0][s]))}}return i}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=E(t,"bars","width"),i=E(t,"bars","maxWidth");if(n!==null&&(i===null||n<=i))return n;const r=this.model.getGroupedData(this.configs.groups).length,s=this.getTotalGroupPadding();return Math.min(i,(this.getDomainScaleStep()-s)/r)}setGroupScale(){const t=this.model.getActiveDataGroupNames(this.configs.groups);this.groupScale=er().domain(t).rangeRound([0,this.getGroupWidth()])}}class Zk extends ht{constructor(){super(...arguments),this.type="heatmap",this.renderType=K.SVG,this.matrix={},this.xBandwidth=0,this.yBandwidth=0,this.translationUnits={x:0,y:0},this.handleAxisOnHover=t=>{const{detail:n}=t,{datum:i}=n,r=this.model.getUniqueRanges(),s=this.model.getUniqueDomain(),a=this.services.cartesianScales.getDomainLabel(),o=this.services.cartesianScales.getRangeLabel(),c=this.services.cartesianScales.getMainXScale(),l=this.services.cartesianScales.getMainYScale();let u="",h=null,d=null,f=null;this.matrix[i]!==void 0?(u=a,r.forEach(p=>{if(typeof this.matrix[i][p].value=="number"){const m=this.matrix[i][p].value;if(h===null){h=m,d=m,f=m;return}h+=m,d=m<d?m:d,f=m>f?m:f}})):(u=o,s.forEach(p=>{if(typeof this.matrix[p][i].value=="number"){const m=this.matrix[p][i].value;if(h===null){h=m,d=m,f=m;return}h+=m,d=m<d?m:d,f=m>f?m:f}})),c(i)!==void 0?this.parent.select("g.multi-cell.column-highlight").classed("highlighter-hidden",!1).attr("transform",`translate(${c(i)}, ${ln(l.range())})`):l(i)!==void 0&&this.parent.select("g.multi-cell.row-highlight").classed("highlighter-hidden",!1).attr("transform",`translate(${ln(c.range())},${l(i)})`),this.services.events.dispatchEvent(C.Tooltip.SHOW,{event:n.event,hoveredElement:P(t.detail.element),items:[{label:u,value:i,bold:!0},{label:"Min",value:d!==null?d:"-"},{label:"Max",value:f!==null?f:"-"},{label:"Average",value:h!==null?h/s.length:"-"}]})},this.handleAxisMouseOut=t=>{this.parent.selectAll("g.multi-cell").classed("highlighter-hidden",!0),this.services.events.dispatchEvent(C.Tooltip.HIDE,{event:t})}}init(){const t=this.services.events;t.addEventListener(C.Axis.LABEL_MOUSEOVER,this.handleAxisOnHover),t.addEventListener(C.Axis.LABEL_MOUSEOUT,this.handleAxisMouseOut),t.addEventListener(C.Axis.LABEL_FOCUS,this.handleAxisOnHover),t.addEventListener(C.Axis.LABEL_BLUR,this.handleAxisMouseOut)}render(t=!0){const n=this.getComponentContainer({withinChartClip:!0});n.lower();const{cartesianScales:i}=this.services;if(this.matrix=this.model.getMatrix(),n.html(""),E(this.getOptions(),"data","loading"))return;const r=i.getMainXScale(),s=i.getMainYScale(),a=i.getDomainIdentifier(),o=i.getRangeIdentifier(),c=this.model.getUniqueDomain(),l=this.model.getUniqueRanges(),u=this.model.getMatrixAsArray(),h=r.range(),d=s.range();this.xBandwidth=Math.abs((h[1]-h[0])/c.length),this.yBandwidth=Math.abs((d[1]-d[0])/l.length);const f=this.services.domUtils.generateElementIDString("heatmap-pattern-stripes");n.append("defs").append("pattern").attr("id",f).attr("width",3).attr("height",3).attr("patternUnits","userSpaceOnUse").attr("patternTransform","rotate(45)").append("rect").classed("pattern-fill",!0).attr("width",.5).attr("height",8);const p=n.selectAll().data(u).enter().append("g").attr("class",m=>`heat-${m.index}`).classed("cell",!0).attr("transform",m=>`translate(${r(m[a])}, ${s(m[o])})`).append("rect").attr("class",m=>this.model.getColorClassName({value:m.value,originalClassName:`heat-${m.index}`})).classed("heat",!0).classed("null-state",m=>m.index===-1||m.value===null).attr("width",this.xBandwidth).attr("height",this.yBandwidth).style("fill",m=>m.index===-1||m.value===null?`url(#${f})`:this.model.getFillColor(Number(m.value))).attr("aria-label",m=>m.value);this.createOuterBox("g.cell-highlight",this.xBandwidth,this.yBandwidth),this.createOuterBox("g.multi-cell.column-highlight",this.xBandwidth,Math.abs(d[1]-d[0])),this.createOuterBox("g.multi-cell.row-highlight",Math.abs(h[1]-h[0]),this.yBandwidth),this.determineDividerStatus()&&(p.style("stroke-width","1px"),this.parent.select("g.cell-highlight").classed("cell-2",!0)),this.addEventListener()}createOuterBox(t,n,i){const r=R.appendOrSelect(this.parent,t).classed("shadows",!0).classed("highlighter-hidden",!0);R.appendOrSelect(r,"line.top").attr("x1",-1).attr("x2",n+1),R.appendOrSelect(r,"line.left").attr("x1",0).attr("y1",-1).attr("x2",0).attr("y2",i+1),R.appendOrSelect(r,"line.down").attr("x1",-1).attr("x2",n+1).attr("y1",i).attr("y2",i),R.appendOrSelect(r,"line.right").attr("x1",n).attr("x2",n).attr("y1",-1).attr("y2",i+1)}determineDividerStatus(){const t=E(this.getOptions(),"heatmap","divider","state");return t!==fr.OFF&&(t===fr.AUTO&&gf.minCellDividerDimension<=this.xBandwidth&&gf.minCellDividerDimension<=this.yBandwidth||t===fr.ON)}addEventListener(){const t=this,{cartesianScales:n}=this.services,i=this.getOptions(),r=St(i,"tooltip.totalLabel"),s=n.getDomainIdentifier(),a=n.getRangeIdentifier(),o=n.getDomainLabel(),c=n.getRangeLabel();this.parent.selectAll("g.cell").on("mouseover",function(l,u){const h=P(this),d=h.select("rect.heat");if(!d.classed("null-state")){const f=Mr(h.attr("transform"));t.parent.select("g.cell-highlight").attr("transform",`translate(${f.x+t.translationUnits.x}, ${f.y+t.translationUnits.y})`).classed("highlighter-hidden",!1),t.services.events.dispatchEvent(C.Heatmap.HEATMAP_MOUSEOVER,{event:l,element:d,datum:u}),t.services.events.dispatchEvent(C.Tooltip.SHOW,{event:l,items:[{label:o,value:u[s]},{label:c,value:u[a]},{label:r||"Total",value:u.value,color:d.style("fill")}]})}}).on("mousemove",function(l,u){t.services.events.dispatchEvent(C.Heatmap.HEATMAP_MOUSEMOVE,{event:l,element:P(this),datum:u}),t.services.events.dispatchEvent(C.Tooltip.MOVE,{event:l})}).on("click",function(l,u){t.services.events.dispatchEvent(C.Heatmap.HEATMAP_CLICK,{event:l,element:P(this),datum:u})}).on("mouseout",function(l,u){const h=P(this).select("rect.heat"),d=h.classed("null-state");t.parent.select("g.cell-highlight").classed("highlighter-hidden",!0),d||(t.services.events.dispatchEvent(C.Heatmap.HEATMAP_MOUSEOUT,{event:l,element:h,datum:u}),t.services.events.dispatchEvent(C.Tooltip.HIDE,{event:l,hoveredElement:h}))})}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(C.Legend.ITEM_HOVER,this.handleAxisOnHover),t.removeEventListener(C.Legend.ITEM_MOUSEOUT,this.handleAxisMouseOut)}}class Kk extends ht{constructor(){super(...arguments),this.type="histogram",this.renderType=K.SVG,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail,i=this.getOptions(),{groupMapsTo:r}=i.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[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(C.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(C.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t){const n=this.getComponentContainer(),i=this.model.getOptions(),{groupIdentifier:r}=i,{groupMapsTo:s}=i.data,a=this.model.getBinnedStackedData(),o=this.services.cartesianScales.getMainXScale(),c=n.selectAll("g.bars").data(a,u=>St(u,`0.${s}`));c.exit().attr("opacity",0).remove(),c.enter().append("g").classed("bars",!0).attr("role",at.GROUP);const l=n.selectAll("g.bars").selectAll("path.bar").data(u=>u);l.exit().remove(),l.enter().append("path").merge(l).classed("bar",!0).attr(r,(u,h)=>h).transition().call(u=>this.services.transitions.setupTransition({transition:u,name:"histogram-bar-update-enter",animate:t})).attr("class",u=>this.model.getColorClassName({classNameTypes:[J.FILL],dataGroupName:u[s],originalClassName:"bar"})).style("fill",u=>this.model.getFillColor(u[s])).attr("d",u=>{const h=St(u,"data");if(!h)return;const d=o(h.x1)-o(h.x0)-1,f=this.services.cartesianScales.getDomainValue(h.x0),p=f+d,m=this.services.cartesianScales.getRangeValue(u[0]);let g=this.services.cartesianScales.getRangeValue(u[1]);return Math.abs(g-m)>0&&Math.abs(g-m)>i.bars.dividerSize&&(this.services.cartesianScales.getOrientation()===Ht.VERTICAL?g+=1:g-=1),Qt({x0:f,x1:p,y0:m,y1:g},this.services.cartesianScales.getOrientation())}).attr("opacity",1).attr("role",at.GRAPHICS_SYMBOL).attr("aria-roledescription","bar").attr("aria-label",u=>E(u,"data",u[s])),this.addEventListeners()}addEventListeners(){const t=this.model.getOptions(),{groupMapsTo:n}=t.data,i=this;this.parent.selectAll("path.bar").on("mouseover",function(r,s){const a=P(this);a.classed("hovered",!0);const o=parseFloat(St(s,"data.x0")),c=parseFloat(St(s,"data.x1")),l=i.services.cartesianScales.getRangeAxisPosition(),u=i.services.cartesianScales.getScaleLabel(l);i.services.events.dispatchEvent(C.Tooltip.SHOW,{event:r,hoveredElement:a,items:[{label:St(t,"bins.rangeLabel")||"Range",value:`${o} – ${c}`},{label:t.tooltip.groupLabel||"Group",value:s[n],class:i.model.getColorClassName({classNameTypes:[J.TOOLTIP],dataGroupName:s[n]})},{label:u,value:St(s,`data.${s[n]}`)}]})}).on("mousemove",function(r){i.services.events.dispatchEvent(C.Tooltip.MOVE,{event:r})}).on("mouseout",function(){P(this).classed("hovered",!1),i.services.events.dispatchEvent(C.Tooltip.HIDE)})}destroy(){this.parent.selectAll("path.bar").on("mouseover",null).on("mousemove",null).on("mouseout",null);const t=this.services.events;t.removeEventListener(C.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(C.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}}class Qk extends Ue{constructor(){super(...arguments),this.type="lollipop",this.renderType=K.SVG,this.handleScatterOnHover=t=>{const n=t.detail,i=this.getOptions(),{groupMapsTo:r}=i.data;this.parent.selectAll("line.line").attr("stroke-width",s=>s[r]!==n.datum[r]?Je.weight.unselected:Je.weight.selected)},this.handleScatterOnMouseOut=()=>{this.parent.selectAll("line.line").attr("stroke-width",Je.weight.unselected)},this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail,i=this.getOptions(),{groupMapsTo:r}=i.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[r]!==n.datum().name?Je.opacity.unselected:Je.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",Je.opacity.selected)}}init(){const{events:t}=this.services;t.addEventListener(C.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(C.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t){const n=this.getComponentContainer({withinChartClip:!0}),i=this.model.getOptions(),{groupMapsTo:r}=i.data,{cartesianScales:s}=this.services,a=s.getMainXScale(),o=s.getMainYScale(),c=s.getDomainIdentifier(),l=g=>s.getDomainValue(g),u=g=>s.getRangeValue(g),h=s.getOrientation(),[d,f]=sn(l,u,h),p=n.selectAll("line.line").data(this.getScatterData(),g=>`${g[r]}-${g[c]}`);p.exit().attr("opacity",0).remove();const m=p.enter().append("line").attr("opacity",0).merge(p).classed("line",!0).attr("class",g=>this.model.getColorClassName({classNameTypes:[J.STROKE],dataGroupName:g[r],originalClassName:"line"})).transition().call(g=>this.services.transitions.setupTransition({transition:g,name:"lollipop-line-update-enter",animate:t})).style("stroke",g=>this.model.getFillColor(g[r],g[c],g)).attr("opacity",1);h===Ht.HORIZONTAL?m.attr("y1",f).attr("y2",f).attr("x1",a.range()[0]).attr("x2",g=>d(g)-i.points.radius):m.attr("x1",d).attr("x2",d).attr("y1",o.range()[0]).attr("y2",g=>f(g)+i.points.radius),this.addScatterPointEventListeners()}addScatterPointEventListeners(){this.services.events.addEventListener(C.Scatter.SCATTER_MOUSEOVER,this.handleScatterOnHover),this.services.events.addEventListener(C.Scatter.SCATTER_MOUSEOUT,this.handleScatterOnMouseOut)}destroy(){const t=this.services.events;t.removeEventListener(C.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(C.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut),t.removeEventListener(C.Scatter.SCATTER_MOUSEOVER,this.handleScatterOnHover),t.removeEventListener(C.Scatter.SCATTER_MOUSEOUT,this.handleScatterOnMouseOut)}}class Jk extends ht{constructor(){super(...arguments),this.type="meter",this.renderType=K.SVG}getStackedBounds(t,n){let i=0;return t.map((r,s)=>s!==0?(i+=n(r.value),{...r,width:Math.abs(n(r.value)-Gt.dividerWidth),x:i-n(r.value)}):(i=n(r.value),{...r,width:Math.abs(n(r.value)-Gt.dividerWidth),x:0}))}render(t=!0){const n=this,i=this.getComponentContainer(),r=this.getOptions(),s=E(r,"meter","proportional"),a=this.model.getDisplayData(),o=this.model.getStatus(),{width:c}=R.getSVGElementSize(i,{useAttrs:!0}),{groupMapsTo:l}=r.data;let u;E(r,"meter","proportional")===null?u=100:u=E(r,"meter","proportional","total")||this.model.getMaximumDomain(this.model.getDisplayData());const h=_e().domain([0,u]).range([0,c]),d=this.getStackedBounds(a,h),f=E(r,"meter","height");R.appendOrSelect(i,"rect.container").attr("x",0).attr("y",0).attr("width",c).attr("height",f||(s?Gt.height.proportional:Gt.height.default)),R.appendOrSelect(i,"line.rangeIndicator").attr("x1",c).attr("x2",c).attr("y1",0).attr("y2",f||(s?Gt.height.proportional:Gt.height.default));const p=i.selectAll("rect.value").data(d),m=o!=null&&!n.model.isUserProvidedColorScaleValid()&&!s?`value status--${o}`:"value";p.enter().append("rect").classed("value",!0).merge(p).attr("x",w=>w.x).attr("y",0).attr("height",()=>f||(s?Gt.height.proportional:Gt.height.default)).attr("class",w=>this.model.getColorClassName({classNameTypes:[J.FILL],dataGroupName:w[l],originalClassName:m})).transition().call(w=>this.services.transitions.setupTransition({transition:w,name:"meter-bar-update",animate:t})).attr("width",w=>w.value>u?h(u):w.width).style("fill",w=>n.model.getFillColor(w[l])).attr("role",at.GRAPHICS_SYMBOL).attr("aria-roledescription","value").attr("aria-label",w=>w.value),p.exit().remove();const g=E(r,"meter","peak");let v=g;g!==null&&(g>u?v=u:g<a[0].value&&(v=a[0].value>u?u:a[0].value));const b=i.selectAll("line.peak").data(v==null?[]:[v]);b.enter().append("line").classed("peak",!0).merge(b).attr("y1",0).attr("y2",()=>f||(s?Gt.height.proportional:Gt.height.default)).transition().call(w=>this.services.transitions.setupTransition({transition:w,name:"peak-line-update",animate:t})).attr("x1",w=>h(w)).attr("x2",w=>h(w)).attr("role",at.GRAPHICS_SYMBOL).attr("aria-roledescription","peak").attr("aria-label",w=>w),b.exit().remove(),this.services.domUtils.setSVGMaxHeight(),this.addEventListeners()}addEventListeners(){const t=this.getOptions(),{groupMapsTo:n}=t.data,i=this,r=E(t,"meter","proportional");this.parent.selectAll("rect.value").on("mouseover",function(s,a){const o=P(this);i.services.events.dispatchEvent(C.Meter.METER_MOUSEOVER,{event:s,element:o,datum:a}),r&&(o.classed("hovered",!0),i.services.events.dispatchEvent(C.Tooltip.SHOW,{event:s,hoveredElement:o,items:[{label:a[n],value:a.value}]}))}).on("mousemove",function(s,a){const o=P(this);i.services.events.dispatchEvent(C.Meter.METER_MOUSEMOVE,{event:s,element:o,datum:a}),r&&i.services.events.dispatchEvent(C.Tooltip.MOVE,{event:s})}).on("click",function(s,a){i.services.events.dispatchEvent(C.Meter.METER_CLICK,{event:s,element:P(this),datum:a})}).on("mouseout",function(s,a){const o=P(this);i.services.events.dispatchEvent(C.Meter.METER_MOUSEOUT,{event:s,element:o,datum:a}),r&&(o.classed("hovered",!1),i.services.events.dispatchEvent(C.Tooltip.HIDE,{hoveredElement:o}))})}destroy(){this.parent.selectAll("rect.value").on("mouseover",null).on("mousemove",null).on("mouseout",null).on("click",null)}}class tR extends ht{constructor(){super(...arguments),this.type="radar",this.renderType=K.SVG,this.getLabelDimensions=t=>{const n=R.appendOrSelect(this.getComponentContainer(),"g.tmp-tick"),i=R.appendOrSelect(n,"text").text(t),{width:r,height:s}=R.getSVGElementSize(i.node(),{useBBox:!0});return n.remove(),{width:r,height:s}},this.normalizeFlatData=t=>{const n=this.getOptions(),{angle:i,value:r}=E(n,"radar","axes"),s=E(n,"data","groupMapsTo"),a=cD(this.uniqueKeys.map(o=>this.uniqueGroups.map(c=>({[i]:o,[s]:c,[r]:null}))));return nt(a,t)},this.normalizeGroupedData=t=>{const n=this.getOptions(),{angle:i,value:r}=E(n,"radar","axes"),s=E(n,"data","groupMapsTo");return t.map(({name:a,data:o})=>{const c=this.uniqueKeys.map(l=>({[s]:a,[i]:l,[r]:null}));return{name:a,data:nt(c,o)}})},this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail;this.parent.selectAll("g.blobs path").transition("legend-hover-blob").call(i=>this.services.transitions.setupTransition({transition:i,name:"legend-hover-blob"})).style("fill-opacity",i=>i.name!==n.datum().name?Rn.opacity.unselected:Rn.opacity.selected).style("stroke-opacity",i=>i.name!==n.datum().name?Rn.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",Rn.opacity.selected).style("stroke-opacity",1)}}init(){const{events:t}=this.services;t.addEventListener(C.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(C.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t=!0){const n=this.getComponentContainer(),{width:i,height:r}=R.getSVGElementSize(n,{useAttrs:!0}),s=this.model.getData(),a=this.model.getGroupedData(),o=this.getOptions(),c=E(o,"data","groupMapsTo"),l=E(o,"radar","axes","value"),{angle:u,value:h}=E(o,"radar","axes"),{xLabelPadding:d,yLabelPadding:f,yTicksNumber:p,minRange:m,xAxisRectHeight:g}=Rn;this.uniqueKeys=Array.from(new Set(s.map(x=>x[u]))),this.uniqueGroups=Array.from(new Set(s.map(x=>x[c]))),this.fullDataNormalized=this.normalizeFlatData(s),this.groupedDataNormalized=this.normalizeGroupedData(a);const v=2*(this.getLabelDimensions(this.uniqueKeys[0]).height+f),b=(Math.min(i,r)-v)/2;if(b<=0)return;const w=er().domain(this.fullDataNormalized.map(x=>x[u])).range([0,2*Math.PI].map(x=>x-Math.PI/2)),O=ln(this.fullDataNormalized.map(x=>x[h])),_=_e().domain([O>=0?0:O,bn(this.fullDataNormalized.map(x=>x[h]))]).range([m,b]).nice(p),T=_.ticks(p),S=x=>this.model.getFillColor(x),$=XE().angle(x=>w(x[u])+Math.PI/2).radius(x=>_(x[h])).curve(_d),D=this.uniqueKeys.map(x=>{const A=this.getLabelDimensions(x).width,y=A$(w(x),b);return A+y}),L={x:bn(D)+d,y:r/2},M=R.appendOrSelect(n,"g.y-axes").attr("role",at.GROUP).selectAll("path").data(T,x=>x),B=x=>this.uniqueKeys.map(A=>({[u]:A,[h]:x}));M.join(x=>x.append("path").attr("opacity",0).attr("transform",`translate(${L.x}, ${L.y})`).attr("fill","none").call(A=>A.transition().call(y=>this.services.transitions.setupTransition({transition:y,name:"radar_y_axes_enter",animate:t})).attr("opacity",1).attr("d",y=>$(B(y)))),x=>x.call(A=>A.transition().call(y=>this.services.transitions.setupTransition({transition:y,name:"radar_y_axes_update",animate:t})).attr("opacity",1).attr("transform",`translate(${L.x}, ${L.y})`).attr("d",y=>$(B(y)))),x=>x.call(A=>A.transition().call(y=>this.services.transitions.setupTransition({transition:y,name:"radar_y_axes_exit",animate:t})).attr("d",y=>$(B(y))).attr("opacity",0).remove())),R.appendOrSelect(n,"g.x-axes").attr("role",at.GROUP).selectAll("line").data(this.uniqueKeys,x=>x).join(x=>x.append("line").attr("opacity",0).attr("class",A=>`x-axis-${Si(A)}`).attr("stroke-dasharray","0").attr("x1",A=>kt(w(A),0,L).x).attr("y1",A=>kt(w(A),0,L).y).attr("x2",A=>kt(w(A),0,L).x).attr("y2",A=>kt(w(A),0,L).y).call(A=>A.transition().call(y=>this.services.transitions.setupTransition({transition:y,name:"radar_x_axes_enter",animate:t})).attr("opacity",1).attr("x1",y=>kt(w(y),_.range()[0],L).x).attr("y1",y=>kt(w(y),_.range()[0],L).y).attr("x2",y=>kt(w(y),_.range()[1],L).x).attr("y2",y=>kt(w(y),_.range()[1],L).y)),x=>x.call(A=>A.transition().call(y=>this.services.transitions.setupTransition({transition:y,name:"radar_x_axes_update",animate:t})).attr("opacity",1).attr("x1",y=>kt(w(y),_.range()[0],L).x).attr("y1",y=>kt(w(y),_.range()[0],L).y).attr("x2",y=>kt(w(y),_.range()[1],L).x).attr("y2",y=>kt(w(y),_.range()[1],L).y)),x=>x.call(A=>A.transition().call(y=>this.services.transitions.setupTransition({transition:y,name:"radar_x_axes_exit",animate:t})).attr("opacity",0).remove())),R.appendOrSelect(n,"g.x-labels").attr("role",at.GROUP).selectAll("text").data(this.uniqueKeys).join(x=>x.append("text").text(A=>A).attr("opacity",0).attr("x",A=>kt(w(A),_.range()[1]+d,L).x).attr("y",A=>kt(w(A),_.range()[1]+d,L).y).style("text-anchor",A=>jp(w(A)).textAnchor).style("dominant-baseline",A=>jp(w(A)).dominantBaseline).call(A=>A.transition().call(y=>this.services.transitions.setupTransition({transition:y,name:"radar_x_labels_enter",animate:t})).attr("opacity",1)),x=>x.call(A=>A.transition().call(y=>this.services.transitions.setupTransition({transition:y,name:"radar_x_labels_update",animate:t})).attr("opacity",1).attr("x",y=>kt(w(y),_.range()[1]+d,L).x).attr("y",y=>kt(w(y),_.range()[1]+d,L).y).end().finally(()=>{const y=E(o,"radar","alignment"),k=this.getAlignmentXOffset(y,n,this.getParent());n.attr("x",k)})),x=>x.call(A=>A.transition().call(y=>this.services.transitions.setupTransition({transition:y,name:"radar_x_labels_exit",animate:t})).attr("opacity",0).remove())),R.appendOrSelect(n,"g.blobs").attr("role",at.GROUP).selectAll("path").data(this.groupedDataNormalized,x=>x.name).join(x=>x.append("path").attr("class",A=>this.model.getColorClassName({classNameTypes:[J.FILL,J.STROKE],dataGroupName:A.name,originalClassName:"blob"})).attr("role",at.GRAPHICS_SYMBOL).attr("aria-label",A=>A.name).attr("opacity",0).attr("transform",t?()=>`translate(${L.x}, ${L.y}) scale(${1+Math.random()*.35})`:`translate(${L.x}, ${L.y})`).style("fill",A=>S(A.name)).style("fill-opacity",Rn.opacity.selected).style("stroke",A=>S(A.name)).call(A=>{const y=A.transition().call(k=>this.services.transitions.setupTransition({transition:k,name:"radar_blobs_enter",animate:t}));t&&y.delay(()=>Math.random()*30).attr("transform",`translate(${L.x}, ${L.y})`),y.attr("opacity",1).attr("d",k=>$(k.data))}),x=>(x.attr("class",A=>this.model.getColorClassName({classNameTypes:[J.FILL,J.STROKE],dataGroupName:A.name,originalClassName:"blob"})).style("fill",A=>S(A.name)).style("stroke",A=>S(A.name)),x.call(A=>A.transition().call(y=>this.services.transitions.setupTransition({transition:y,name:"radar_blobs_update",animate:t})).attr("opacity",1).attr("transform",`translate(${L.x}, ${L.y})`).attr("d",y=>$(y.data))),x),x=>x.call(A=>{const y=A.transition().call(k=>this.services.transitions.setupTransition({transition:k,name:"radar_blobs_exit",animate:t}));t&&y.delay(()=>Math.random()*30).attr("transform",()=>`translate(${L.x}, ${L.y}) scale(${1+Math.random()*.35})`),y.attr("opacity",0).remove()})),R.appendOrSelect(n,"g.dots").attr("role",at.GROUP).selectAll("circle").data(this.fullDataNormalized.filter(x=>E(x,h)!==null)).join(x=>x.append("circle").attr("role",at.GRAPHICS_SYMBOL).attr("aria-label",A=>A[l]),x=>x,x=>x.remove()).attr("class",x=>this.model.getColorClassName({classNameTypes:[J.FILL],dataGroupName:x[c],originalClassName:Si(x[u])})).attr("cx",x=>kt(w(x[u]),_(x[h]),L).x).attr("cy",x=>kt(w(x[u]),_(x[h]),L).y).attr("r",0).attr("opacity",0).style("fill",x=>S(x[c])),R.appendOrSelect(n,"g.x-axes-rect").attr("role",at.GROUP).selectAll("rect").data(this.uniqueKeys).join(x=>x.append("rect"),x=>x,x=>x.remove()).attr("x",L.x).attr("y",L.y-g/2).attr("width",_.range()[1]).attr("height",g).style("fill","red").style("fill-opacity",0).attr("transform",x=>`rotate(${Wp(w(x))}, ${L.x}, ${L.y})`),R.appendOrSelect(n,"g.y-labels").attr("role",at.GROUP).selectAll("text").data(ye(T)).join(x=>x.append("text").attr("opacity",0).text(A=>A).attr("x",A=>kt(-Math.PI/2,_(A),L).x+f).attr("y",A=>kt(-Math.PI/2,_(A),L).y).style("text-anchor","start").style("dominant-baseline","middle").call(A=>A.transition().call(y=>this.services.transitions.setupTransition({transition:y,name:"radar_y_labels_enter",animate:t})).attr("opacity",1)),x=>x.call(A=>A.transition().call(y=>this.services.transitions.setupTransition({transition:y,name:"radar_y_labels_update",animate:t})).text(y=>y).attr("opacity",1).attr("x",y=>kt(-Math.PI/2,_(y),L).x+f).attr("y",y=>kt(-Math.PI/2,_(y),L).y)),x=>x.call(A=>A.transition().call(y=>this.services.transitions.setupTransition({transition:y,name:"radar_y_labels_exit",animate:t})).attr("opacity",0).remove())),this.addEventListeners()}getAlignmentXOffset(t,n,i){const r=R.getSVGElementSize(n,{useBBox:!0}),{width:s}=R.getSVGElementSize(i,{useAttrs:!0});let a=0;return t===It.CENTER?a=Math.floor((s-r.width)/2):t===It.RIGHT&&(a=s-r.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(C.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(C.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}addEventListeners(){const t=this,{axes:{angle:n}}=E(this.getOptions(),"radar");this.parent.selectAll(".x-axes-rect > rect").on("mouseover",function(i,r){const s=P(this);t.services.events.dispatchEvent(C.Radar.X_AXIS_MOUSEOVER,{event:i,element:s,datum:r});const a=t.parent.select(`.x-axes .x-axis-${Si(r)}`),o=t.parent.selectAll(`.dots circle.${Si(r)}`),c=t.model.getActiveDataGroupNames(),l=t.getOptions(),{groupMapsTo:u}=l.data,h=E(l,"radar","axes","value");a.classed("hovered",!0).attr("stroke-dasharray","4 4"),o.classed("hovered",!0).attr("opacity",f=>c.indexOf(f[u])!==-1?1:0).attr("r",Rn.dotsRadius);const d=t.fullDataNormalized.filter(f=>f[n]===r&&c.indexOf(f[u])!==-1);t.services.events.dispatchEvent(C.Tooltip.SHOW,{event:i,hoveredElement:s,items:d.filter(f=>typeof f[h]=="number").map(f=>({label:f[u],value:f[h],color:t.model.getFillColor(f[u]),class:t.model.getColorClassName({classNameTypes:[J.TOOLTIP],dataGroupName:f[u]})}))})}).on("mousemove",function(i,r){const s=P(this);t.services.events.dispatchEvent(C.Radar.X_AXIS_MOUSEMOVE,{event:i,element:s,datum:r}),t.services.events.dispatchEvent(C.Tooltip.MOVE,{event:i})}).on("click",function(i,r){t.services.events.dispatchEvent(C.Radar.X_AXIS_CLICK,{event:i,element:P(this),datum:r})}).on("mouseout",function(i,r){const s=P(this),a=t.parent.select(`.x-axes .x-axis-${Si(r)}`),o=t.parent.selectAll(`.dots circle.${Si(r)}`);a.classed("hovered",!1).attr("stroke-dasharray","0"),o.classed("hovered",!1).attr("opacity",0).attr("r",0),t.services.events.dispatchEvent(C.Radar.X_AXIS_MOUSEOUT,{event:i,element:s,datum:r}),t.services.events.dispatchEvent(C.Tooltip.HIDE)})}}class Qg extends vc{constructor(){super(...arguments),this.type="simple-bar",this.renderType=K.SVG,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail,{groupMapsTo:i}=this.getOptions().data;this.parent.selectAll("path.bar").transition("legend-hover-simple-bar").call(r=>this.services.transitions.setupTransition({transition:r,name:"legend-hover-simple-bar"})).attr("opacity",r=>r[i]!==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(C.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(C.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t){const n=this.getOptions(),{groupMapsTo:i}=n.data,r=this.getComponentContainer({withinChartClip:!0}),s=this.model.getDisplayData(this.configs.groups),a=this.services.cartesianScales.getOrientation(),o=r.selectAll("path.bar").data(s,c=>c[i]);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(c=>this.services.transitions.setupTransition({transition:c,name:"bar-update-enter",animate:t})).attr("class",c=>this.model.getColorClassName({classNameTypes:[J.FILL],dataGroupName:c[i],originalClassName:"bar"})).style("fill",c=>this.model.getFillColor(c[i])).attr("d",c=>{const l=this.services.cartesianScales.getRangeIdentifier(),u=this.getBarWidth(),h=c[l],d=this.services.cartesianScales.getDomainValue(c)-u/2,f=d+u;let p,m;if(Array.isArray(h)&&h.length===2)p=this.services.cartesianScales.getRangeValue(h[0]),m=this.services.cartesianScales.getRangeValue(h[1]);else{const v=this.services.cartesianScales.getRangeScale().domain()[0];p=this.services.cartesianScales.getRangeValue(Math.max(0,v)),m=this.services.cartesianScales.getRangeValue(c)}const g=Math.abs(m-p);if(g!==0&&g<2&&(h>0&&a===Ht.VERTICAL||h<0&&a===Ht.HORIZONTAL?m=p-2:m=p+2),!this.isOutsideZoomedDomain(d,f))return Qt({x0:d,x1:f,y0:p,y1:m},a)}).attr("opacity",1).attr("role",at.GRAPHICS_SYMBOL).attr("aria-roledescription","bar").attr("aria-label",c=>c.value),this.addEventListeners()}addEventListeners(){const t=this;this.parent.selectAll("path.bar").on("mouseover",function(n,i){const r=P(this);r.classed("hovered",!0),t.services.events.dispatchEvent(C.Bar.BAR_MOUSEOVER,{event:n,element:r,datum:i}),t.services.events.dispatchEvent(C.Tooltip.SHOW,{event:n,hoveredElement:r,data:[i]})}).on("mousemove",function(n,i){t.services.events.dispatchEvent(C.Bar.BAR_MOUSEMOVE,{event:n,element:P(this),datum:i}),t.services.events.dispatchEvent(C.Tooltip.MOVE,{event:n})}).on("click",function(n,i){t.services.events.dispatchEvent(C.Bar.BAR_CLICK,{event:n,element:P(this),datum:i})}).on("mouseout",function(n,i){const r=P(this);r.classed("hovered",!1),t.services.events.dispatchEvent(C.Bar.BAR_MOUSEOUT,{event:n,element:r,datum:i}),t.services.events.dispatchEvent(C.Tooltip.HIDE,{hoveredElement:r})})}destroy(){this.parent.selectAll("path.bar").on("mouseover",null).on("mousemove",null).on("mouseout",null);const t=this.services.events;t.removeEventListener(C.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(C.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}}class eR extends Jt{constructor(){super(...arguments),this.type="skeleton-lines"}render(t=!0){const n=E(this.getOptions(),"data","loading"),i=!E(this.getOptions(),"grid","x","enabled")&&!E(this.getOptions(),"grid","y","enabled")&&!E(this.getOptions(),"axes","bottom","visible")&&!E(this.getOptions(),"axes","left","visible");n&&!i?super.renderGridSkeleton(n):n&&i?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"),i=[100],r=R.appendOrSelect(this.backdrop,"g.y.skeleton"),s=r.selectAll("line").data(i);s.enter().append("line").merge(s).attr("x1",0).attr("x2",n).attr("y1",a=>a).attr("y2",a=>a),r.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=R.appendOrSelect(t,"svg.chart-skeleton.DAII"),R.appendOrSelect(this.backdrop,"rect.chart-skeleton-backdrop").classed("shimmer-effect-lines",!1).classed("shimmer-effect-sparkline",!0).style("stroke",null)}}class Jg extends ht{constructor(){super(...arguments),this.type="area-stacked",this.renderType=K.SVG,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail,i=this.getOptions(),{groupMapsTo:r}=i.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=>E(s,0,r)!==n.datum().name?Qe.opacity.unselected:Qe.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",Qe.opacity.selected)}}init(){const t=this.services.events;t.addEventListener(C.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(C.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t=!0){const n=this.getComponentContainer({withinChartClip:!0}),i=this,r=this.getOptions(),{groupMapsTo:s}=r.data,a=Object.keys(r.axes).some(f=>r.axes[f].percentage),o=this.model.getStackedData({percentage:a,groups:this.configs.groups}),c=E(o,0,0),l=this.services.cartesianScales.getDomainAxisPosition({datum:c}),u=this.services.cartesianScales.getRangeAxisPosition({datum:c}),h=this.services.cartesianScales.getScaleByPosition(u),d=n.selectAll("path.area").data(o,f=>E(f,0,s));this.areaGenerator=rl().x(f=>this.services.cartesianScales.getValueThroughAxisPosition(l,f.data.sharedStackKey)).y0(f=>h(f[0])).y1(f=>h(f[1])).curve(this.services.curves.getD3Curve()),d.exit().attr("opacity",0).remove(),d.enter().append("path").attr("opacity",0).merge(d).data(o,f=>E(f,0,s)).attr("class","area").attr("class",f=>this.model.getColorClassName({classNameTypes:[J.FILL],dataGroupName:E(f,0,s),originalClassName:"area"})).style("fill",f=>i.model.getFillColor(E(f,0,s))).attr("role",at.GRAPHICS_SYMBOL).attr("aria-roledescription","area").attr("aria-label",f=>E(f,0,s)).transition().call(f=>this.services.transitions.setupTransition({transition:f,name:"area-update-enter",animate:t})).attr("opacity",Qe.opacity.selected).attr("d",this.areaGenerator)}}class tm extends vc{constructor(){super(...arguments),this.type="stacked-bar",this.renderType=K.SVG,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail,{groupMapsTo:i}=this.model.getOptions().data;this.parent.selectAll("path.bar").transition("legend-hover-bar").call(r=>this.services.transitions.setupTransition({transition:r,name:"legend-hover-bar"})).attr("opacity",r=>r[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(C.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(C.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t){const n=this.getComponentContainer({withinChartClip:!0}),i=this.getOptions(),{groupMapsTo:r}=i.data,s=this.model.getStackedData({groups:this.configs.groups,divergent:!0}),a=this.model.getActiveDataGroupNames(),o=n.selectAll("g.bars").data(s,l=>E(l,0,r));o.exit().attr("opacity",0).remove(),o.enter().append("g").classed("bars",!0).attr("role",at.GROUP).attr("data-name","bars");const c=n.selectAll("g.bars").selectAll("path.bar").data(l=>l,l=>l.data.sharedStackKey);c.exit().remove(),c.enter().append("path").merge(c).classed("bar",!0).transition().call(l=>this.services.transitions.setupTransition({transition:l,name:"bar-update-enter",animate:t})).attr("class",l=>this.model.getColorClassName({classNameTypes:[J.FILL],dataGroupName:l[r],originalClassName:"bar"})).style("fill",l=>this.model.getFillColor(l[r])).attr("d",l=>{const u=l.data.sharedStackKey,h=this.getBarWidth(),d=this.services.cartesianScales.getDomainValue(u)-h/2,f=d+h,p=this.services.cartesianScales.getRangeValue(l[0]);let m=this.services.cartesianScales.getRangeValue(l[1]);if(!this.isOutsideZoomedDomain(d,f)){if(Math.abs(m-p)>0&&Math.abs(m-p)>i.bars.dividerSize){const g=l[0]<0&&l[1]<=0;g&&a.length>1?this.services.cartesianScales.getOrientation()===Ht.VERTICAL?m+=l[1]===0?2:1:m-=1:g||(this.services.cartesianScales.getOrientation()===Ht.VERTICAL?m+=1:m-=1)}return Qt({x0:d,x1:f,y0:p,y1:m},this.services.cartesianScales.getOrientation())}}).attr("opacity",1).attr("role",at.GRAPHICS_SYMBOL).attr("aria-roledescription","bar").attr("aria-label",l=>l[1]-l[0]),this.addEventListeners()}addEventListeners(){const t=this.getOptions(),{groupMapsTo:n}=t.data,i=this;this.parent.selectAll("path.bar").on("mouseover",function(r,s){const a=P(this);a.classed("hovered",!0),i.services.events.dispatchEvent(C.Bar.BAR_MOUSEOVER,{event:r,element:a,datum:s});let o=i.model.getDisplayData(i.configs.groups).find(c=>{const l=i.services.cartesianScales.getDomainIdentifier(c),u=i.services.cartesianScales.getRangeIdentifier(c);return c[u]===s.data[s[n]]&&c[l].toString()===s.data.sharedStackKey&&c[n]===s[n]});if(o===void 0){const c=i.services.cartesianScales.getDomainIdentifier(),l=i.services.cartesianScales.getRangeIdentifier();o={[c]:s.data.sharedStackKey,[l]:s.data[s[n]],[n]:s[n]}}i.services.events.dispatchEvent(C.Tooltip.SHOW,{event:r,hoveredElement:a,data:[o]})}).on("mousemove",function(r,s){const a=P(this);i.services.events.dispatchEvent(C.Bar.BAR_MOUSEMOVE,{event:r,element:a,datum:s}),i.services.events.dispatchEvent(C.Tooltip.MOVE,{event:r})}).on("click",function(r,s){i.services.events.dispatchEvent(C.Bar.BAR_CLICK,{event:r,element:P(this),datum:s})}).on("mouseout",function(r,s){const a=P(this);a.classed("hovered",!1),i.services.events.dispatchEvent(C.Bar.BAR_MOUSEOUT,{event:r,element:a,datum:s}),i.services.events.dispatchEvent(C.Tooltip.HIDE,{hoveredElement:a})})}getBarWidth(){const t=this.getOptions();if(E(t,"bars","width"))return t.bars.width;const n=this.services.cartesianScales.getMainXScale(),i=R.getSVGElementSize(this.parent,{useAttrs:!0}).width,r=this.model.getStackKeys().length,s=E(t,"bars","spacingFactor");return n.step?Math.min(t.bars.maxWidth,n.step()/2):Math.min(t.bars.maxWidth,i*s/r)}destroy(){this.parent.selectAll("path.bar").on("mouseover",null).on("mousemove",null).on("mouseout",null);const t=this.services.events;t.removeEventListener(C.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(C.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}}class em extends Ue{constructor(){super(...arguments),this.type="scatter-stacked",this.renderType=K.SVG}render(t){if(!E(this.getOptions(),"points","enabled"))return;const n=this.getComponentContainer({withinChartClip:!0}),i=this.getOptions(),{groupMapsTo:r}=i.data,s=Object.keys(i.axes).some(u=>i.axes[u].percentage),a=this.model.getStackedData({groups:this.configs.groups,percentage:s}),o=n.selectAll("g.dots").data(a,u=>E(u,0,r));o.exit().attr("opacity",0).remove();const c=o.enter().append("g").classed("dots",!0).attr("role",at.GROUP).merge(o).selectAll("circle.dot").data(u=>u);c.exit().attr("opacity",0).remove();const l=c.enter().append("circle").classed("dot",!0).attr("opacity",0).merge(c).datum(u=>{const h=u[r],d=this.services.cartesianScales.getDomainIdentifier(u),f=this.services.cartesianScales.getRangeIdentifier(u);return{[r]:h,[d]:u.data.sharedStackKey,[f]:u[1]}});this.styleCircles(l,t),this.addEventListeners()}getTooltipData(t,n){const i=this.getOptions(),{groupMapsTo:r}=i.data,s=Object.keys(i.axes).some(c=>i.axes[c].percentage),a=this.model.getStackedData({groups:this.configs.groups,percentage:s}),o=[];return a.forEach((c,l)=>{c.forEach((u,h)=>{const d=u[r],f=u.data.sharedStackKey;let p=u.data[d];const m=u[1],g=this.services.cartesianScales.getDomainIdentifier(u),v=this.services.cartesianScales.getRangeIdentifier(u);p!=null&&t===this.services.cartesianScales.getDomainValue(f)&&n===this.services.cartesianScales.getRangeValue(m)&&(s&&(p=this.model.getStackedData({groups:this.configs.groups})[l][h].data[d]),p!==null&&o.push({[r]:d,[g]:f,[v]:p}))})}),this.model.getDisplayData(this.configs.groups).filter(c=>{const l=this.services.cartesianScales.getDomainIdentifier(c),u=this.services.cartesianScales.getRangeIdentifier(c);return o.find(h=>h[r]==c[r]&&h[l]==c[l]&&h[u]==c[u])!==void 0})}}const Ai=6;class nR extends ht{constructor(){super(...arguments),this.type="tree",this.renderType=K.SVG}getLongestLabel(t){let n="";return t.forEach(i=>{const r=i.children?this.getLongestLabel(i.children):"";(r.length>n.length||i.name.length>n.length)&&(n=r.length>i.name.length?r:i.name)}),n}getMockLabelWidth(t,n){const i=t.append("text").attr("dy","0.31em").attr("x",0).attr("text-anchor","end").text(n),{width:r}=R.getSVGElementSize(i.node(),{useBBox:!0});return i.remove(),r}render(t=!0){const n=this.getComponentContainer();n.html("");const{width:i,height:r}=R.getSVGElementSize(this.parent,{useAttrs:!0});if(i<1||r<1)return;const s=this.model.getOptions(),a=this.model.getDisplayData(),o=E(s,"tree","rootTitle")||"Tree",c=this.getMockLabelWidth(n,o),l=this.getLongestLabel(a),u=this.getMockLabelWidth(n,l),h={top:0,right:0,bottom:0,left:c>0?c+Ai:30-Ai},d=Qi({name:o,children:a}),f=10,p=i/6,m=T=>{const S=d.descendants().reverse(),$=d.links();let D=d,L=d;d.eachBefore(U=>{U.x<D.x&&(D=U),U.x>L.x&&(L=U)});const M=L.x-D.x,B=n.transition().call(U=>this.services.transitions.setupTransition({transition:U,name:"tree-update-viewbox",animate:!0})).attr("viewBox",[-h.left,D.x,i,M].join(" ")),x=_.selectAll("g").data(S,U=>U.id),A=this,y=x.enter().append("g").attr("transform",()=>`translate(${T.y0},${T.x0})`).attr("class",U=>U.depth!==0&&U.children&&U.children.length>0?"clickable":null).on("mouseover",function(U,N){A.services.events.dispatchEvent(C.Tree.NODE_MOUSEOVER,{event:U,element:P(this),datum:N})}).on("click",function(U,N){N.depth!==0&&(N.children=N.children?null:N._children,m(N)),A.services.events.dispatchEvent(C.Tree.NODE_CLICK,{event:U,element:P(this),datum:N})}).on("mouseout",function(U,N){A.services.events.dispatchEvent(C.Tree.NODE_MOUSEOUT,{event:U,element:P(this),datum:N})});y.append("circle").attr("r",2.5).attr("class",U=>U._children?"parent":"child").attr("stroke-width",10),y.append("text").attr("dy","0.31em").attr("x",U=>U._children?-Ai:Ai).attr("text-anchor",U=>U._children?"end":"start").text(U=>U.data.name).clone(!0).attr("class","text-stroke").lower(),x.merge(y).transition(B).attr("transform",U=>`translate(${U.y},${U.x})`).attr("fill-opacity",1).attr("stroke-opacity",1),x.exit().transition(B).remove().attr("transform",()=>`translate(${T.y},${T.x})`).attr("fill-opacity",0).attr("stroke-opacity",0);const k=O.selectAll("path").data($,U=>U.target.id),I=k.enter().append("path").attr("d",()=>{const U={x:T.x0,y:T.y0};return w({source:U,target:U})});k.merge(I).transition(B).attr("d",w),k.exit().transition(B).remove().attr("d",()=>{const U={x:T.x,y:T.y};return w({source:U,target:U})}),d.eachBefore(U=>{U.x0=U.x,U.y0=U.y})},g=d.descendants(),v=g[g.length-1].depth,b=E(s,"tree","type")===hl.DENDROGRAM?mb().size([r,i-u-v*Ai-c]):iw().nodeSize([f,p]).size([r,i-u-v*Ai-c]),w=e_().x(T=>T.y).y(T=>T.x);d.x0=p/2,d.y0=0,d.descendants().forEach((T,S)=>{T.id=S,T._children=T.children}),b(d),n.attr("viewBox",[-h.left,-h.top,i,f]).style("user-select","none");const O=n.append("g").attr("class","links"),_=n.append("g").attr("class","nodes");m(d)}}var iR="#000000",rR="#ffffff",sR="#fcf4d6",aR="#fddc69",oR="#f1c21b",lR="#d2a106",cR="#b28600",uR="#8e6a00",hR="#684e00",dR="#483700",fR="#302400",pR="#1c1500",gR={10:sR,20:aR,30:oR,40:lR,50:cR,60:uR,70:hR,80:dR,90:fR,100:pR},mR="#fff2e8",vR="#ffd9be",yR="#ffb784",xR="#ff832b",bR="#eb6200",wR="#ba4e00",ER="#8a3800",_R="#5e2900",SR="#3e1a00",OR="#231000",TR={10:mR,20:vR,30:yR,40:xR,50:bR,60:wR,70:ER,80:_R,90:SR,100:OR},MR="#fff1f1",CR="#ffd7d9",AR="#ffb3b8",$R="#ff8389",LR="#fa4d56",DR="#da1e28",kR="#a2191f",RR="#750e13",IR="#520408",PR="#2d0709",NR={10:MR,20:CR,30:AR,40:$R,50:LR,60:DR,70:kR,80:RR,90:IR,100:PR},UR="#fff0f7",BR="#ffd6e8",HR="#ffafd2",VR="#ff7eb6",GR="#ee5396",FR="#d02670",zR="#9f1853",jR="#740937",WR="#510224",qR="#2a0a18",YR={10:UR,20:BR,30:HR,40:VR,50:GR,60:FR,70:zR,80:jR,90:WR,100:qR},XR="#f6f2ff",ZR="#e8daff",KR="#d4bbff",QR="#be95ff",JR="#a56eff",tI="#8a3ffc",eI="#6929c4",nI="#491d8b",iI="#31135e",rI="#1c0f30",sI={10:XR,20:ZR,30:KR,40:QR,50:JR,60:tI,70:eI,80:nI,90:iI,100:rI},aI="#edf5ff",oI="#d0e2ff",lI="#a6c8ff",cI="#78a9ff",uI="#4589ff",hI="#0f62fe",dI="#0043ce",fI="#002d9c",pI="#001d6c",gI="#001141",mI={10:aI,20:oI,30:lI,40:cI,50:uI,60:hI,70:dI,80:fI,90:pI,100:gI},vI="#e5f6ff",yI="#bae6ff",xI="#82cfff",bI="#33b1ff",wI="#1192e8",EI="#0072c3",_I="#00539a",SI="#003a6d",OI="#012749",TI="#061727",MI={10:vI,20:yI,30:xI,40:bI,50:wI,60:EI,70:_I,80:SI,90:OI,100:TI},CI="#d9fbfb",AI="#9ef0f0",$I="#3ddbd9",LI="#08bdba",DI="#009d9a",kI="#007d79",RI="#005d5d",II="#004144",PI="#022b30",NI="#081a1c",UI={10:CI,20:AI,30:$I,40:LI,50:DI,60:kI,70:RI,80:II,90:PI,100:NI},BI="#defbe6",HI="#a7f0ba",VI="#6fdc8c",GI="#42be65",FI="#24a148",zI="#198038",jI="#0e6027",WI="#044317",qI="#022d0d",YI="#071908",XI={10:BI,20:HI,30:VI,40:GI,50:FI,60:zI,70:jI,80:WI,90:qI,100:YI},ZI="#f2f4f8",KI="#dde1e6",QI="#c1c7cd",JI="#a2a9b0",tP="#878d96",eP="#697077",nP="#4d5358",iP="#343a3f",rP="#21272a",sP="#121619",aP={10:ZI,20:KI,30:QI,40:JI,50:tP,60:eP,70:nP,80:iP,90:rP,100:sP},oP="#f4f4f4",lP="#e0e0e0",cP="#c6c6c6",uP="#a8a8a8",hP="#8d8d8d",dP="#6f6f6f",fP="#525252",pP="#393939",gP="#262626",mP="#161616",vP={10:oP,20:lP,30:cP,40:uP,50:hP,60:dP,70:fP,80:pP,90:gP,100:mP},yP="#f7f3f2",xP="#e5e0df",bP="#cac5c4",wP="#ada8a8",EP="#8f8b8b",_P="#726e6e",SP="#565151",OP="#3c3838",TP="#272525",MP="#171414",CP={10:yP,20:xP,30:bP,40:wP,50:EP,60:_P,70:SP,80:OP,90:TP,100:MP},nm={black:{100:iR},blue:mI,coolGray:aP,cyan:MI,gray:vP,green:XI,magenta:YR,orange:TR,purple:sI,red:NR,teal:UI,warmGray:CP,white:{0:rR},yellow:gR};const AP=e=>{if(!e)return null;for(const t of Object.keys(nm)){const n=nm[t];for(const i of Object.keys(n))if(n[+i]===e)return i}return null},im=function(){const e=P(this.parentNode).select("rect.leaf"),t=getComputedStyle(e.node(),null).getPropertyValue("fill"),n=He(t);let i;if(n&&(i=AP(n?n.hex():null)),i==null){const r=qa(n).l;i=Math.abs(r*100-100)}return i>50?"white":"black"};let $P=0;class LP extends ht{constructor(){super(...arguments),this.type="treemap",this.renderType=K.SVG,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail;this.parent.selectAll("g[data-name='leaf']").transition("legend-hover-treemap").call(i=>this.services.transitions.setupTransition({transition:i,name:"legend-hover-treemap"})).attr("opacity",i=>i.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(C.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(C.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t=!0){const n=this.getComponentContainer();this.model.getData();const i=this.model.getDisplayData(),r=this.model.getOptions(),s=E(window,"location"),{width:a,height:o}=R.getSVGElementSize(n,{useAttrs:!0}),c=Qi({name:r.title||"Treemap",children:i}).sum(f=>f.value).sort((f,p)=>p.value-f.value),l=lw().size([a,o]).paddingInner(1).paddingOuter(0).round(!0)(c),u=n.selectAll("g[data-name='leaf']").data(l.leaves(),f=>f.data.name);u.exit().attr("opacity",0).remove();const h=u.enter().append("g").attr("data-name","leaf").attr("data-uid",()=>$P++).merge(u);h.attr("data-name","leaf").transition().call(f=>this.services.transitions.setupTransition({transition:f,name:"treemap-group-update",animate:t})).attr("transform",f=>`translate(${f.x0},${f.y0})`);const d=h.selectAll("rect.leaf").data(f=>[f]);d.exit().attr("width",0).attr("height",0).remove(),d.enter().append("rect").classed("leaf",!0).merge(d).attr("width",0).attr("height",0).attr("id",function(){const f=P(this.parentNode).attr("data-uid");return`${r.style.prefix}-leaf-${f}`}).attr("class",f=>{for(;f.depth>1;)f=f.parent;return this.model.getColorClassName({classNameTypes:[J.FILL],dataGroupName:f.data.name,originalClassName:"leaf"})}).transition().call(f=>this.services.transitions.setupTransition({transition:f,name:"treemap-leaf-update-enter",animate:t})).attr("width",f=>f.x1-f.x0).attr("height",f=>f.y1-f.y0).style("fill",f=>{for(;f.depth>1;)f=f.parent;return this.model.getFillColor(f.data.name)}),h.selectAll("clipPath").data(f=>f.data.showLabel!==!0?[]:[1],f=>f).join(f=>f.append("clipPath").attr("id",function(){const p=P(this.parentNode).attr("data-uid");return`${r.style.prefix}-clip-${p}`}).append("use").attr("xlink:href",function(){const p=P(this.parentNode.parentNode).attr("data-uid"),m=`${r.style.prefix}-leaf-${p}`;return new URL(`#${m}`,s)+""}),f=>null,f=>f.remove()),h.selectAll("text").data(f=>{if(f.data.showLabel!==!0)return[];let p=f;for(;p.depth>1;)p=p.parent;const m=qa(this.model.getFillColor(p.data.name));return[{text:f.data.name,color:m.l<.5?"white":"black"}]},f=>f).join(f=>{const p=f.append("text").text(m=>m.text).style("fill",im).attr("x",7).attr("y",18);return s&&p.attr("clip-path",function(){const m=P(this.parentNode).attr("data-uid"),g=`${r.style.prefix}-clip-${m}`;return`url(${new URL(`#${g}`,s)+""})`}),p},f=>f.text(p=>p.text).style("fill",im),f=>f.remove()),this.addEventListeners()}addEventListeners(){const t=this;this.parent.selectAll("rect.leaf").on("mouseover",function(n,i){const r=P(this);let s=getComputedStyle(this,null).getPropertyValue("fill"),a=i;for(;a.depth>1;)a=a.parent;r.transition("graph_element_mouseover_fill_update").call(o=>t.services.transitions.setupTransition({transition:o,name:"graph_element_mouseover_fill_update"})).style("fill",o=>{const c=t.model.getFillColor(o.parent.data.name);return c&&(s=c),He(s).darker(.7).toString()}),t.services.events.dispatchEvent(C.Tooltip.SHOW,{event:n,hoveredElement:r,items:[{color:s,label:a.data.name,bold:!0},{label:i.data.name,value:i.data.value}]}),t.services.events.dispatchEvent(C.Treemap.LEAF_MOUSEOVER,{event:n,element:r,datum:i})}).on("mousemove",function(n,i){const r=P(this);t.services.events.dispatchEvent(C.Treemap.LEAF_MOUSEMOVE,{event:n,element:r,datum:i}),t.services.events.dispatchEvent(C.Tooltip.MOVE,{event:n})}).on("click",function(n,i){t.services.events.dispatchEvent(C.Treemap.LEAF_CLICK,{event:n,element:P(this),datum:i})}).on("mouseout",function(n,i){const r=P(this);r.classed("hovered",!1);let s=i;for(;s.depth>1;)s=s.parent;r.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)),t.services.events.dispatchEvent(C.Treemap.LEAF_MOUSEOUT,{event:n,element:r,datum:i}),t.services.events.dispatchEvent(C.Tooltip.HIDE,{hoveredElement:r})})}}class DP extends ht{constructor(){super(...arguments),this.type="wordcloud",this.renderType=K.SVG,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail,{groupMapsTo:i}=this.getOptions().data;this.parent.selectAll("text.word").transition("legend-hover-wordcloud").call(r=>this.services.transitions.setupTransition({transition:r,name:"legend-hover-wordcloud"})).attr("opacity",r=>r[i]!==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(C.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(C.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t=!0){const n=this,i=this.getComponentContainer().attr("width","100%").attr("height","100%"),r=this.model.getDisplayData(),s=this.getFontSizeScale(r),a=this.getOptions(),{fontSizeMapsTo:o,wordMapsTo:c}=a.wordCloud,{groupMapsTo:l}=a.data,{width:u,height:h}=R.getSVGElementSize(i,{useAttrs:!0});if(u===0||h===0)return;const d=gL().size([u,h]).words(r.map(function(p){const m=p[o];if(typeof p[o]!="number")throw Error("Badly formatted WordCloud data. `value` should only be an integer or float");return{[l]:p[l],text:p[c],size:m,value:m}})).padding(5).rotate(0).fontSize(p=>s(p.size)).on("end",f);d.start();function f(p){const m=R.appendOrSelect(i,"g.words");m.attr("transform",`translate(${d.size()[0]/2}, ${d.size()[1]/2})`);const g=m.selectAll("text").data(p,v=>`${v[l]}-${v.text}`);g.exit().attr("opacity",0).remove(),g.enter().append("text").attr("opacity",0).merge(g).style("font-size",v=>`${v.size}px`).text(function(v){return v.text}).attr("class",v=>n.model.getColorClassName({classNameTypes:[J.FILL],dataGroupName:v[l],originalClassName:`word ${v.size>32?"light":""}`})).style("fill",v=>n.model.getFillColor(v[l],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:i}=n.wordCloud,r=t.map(c=>c[i]).filter(c=>c),s=R.getHTMLElementSize(this.services.domUtils.getMainContainer()),a=r.length>0,o=a?ye(r):[1,1];return _e().domain(o).range(a?n.wordCloud.fontSizeRange(s,t):[4,4])}addEventListeners(){const t=this.getOptions(),{groupMapsTo:n}=t.data,i=this,r=va(s=>{const a=i.parent.selectAll("text.word").transition("wordcloud-word-mouse-highlight").call(o=>i.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;r(o),i.services.events.dispatchEvent(C.WordCloud.WORD_MOUSEOVER,{event:s,element:P(this),datum:a}),i.services.events.dispatchEvent(C.Tooltip.SHOW,{event:s,hoveredElement:o,items:[{label:t.tooltip.wordLabel,value:a.text},{label:t.tooltip.valueLabel,value:a.value},{label:t.tooltip.groupLabel,value:a[n],class:i.model.getColorClassName({classNameTypes:[J.TOOLTIP],dataGroupName:a[n]})}]})}).on("mousemove",function(s,a){const o=P(this);i.services.events.dispatchEvent(C.WordCloud.WORD_MOUSEMOVE,{element:o,datum:a}),i.services.events.dispatchEvent(C.Tooltip.MOVE,{event:s})}).on("click",function(s,a){i.services.events.dispatchEvent(C.WordCloud.WORD_CLICK,{event:s,element:P(this),datum:a})}).on("mouseout",function(s,a){const o=P(this);r(null),i.services.events.dispatchEvent(C.WordCloud.WORD_MOUSEOUT,{event:s,element:o,datum:a}),i.services.events.dispatchEvent(C.Tooltip.HIDE,{hoveredElement:o})})}}class kP extends ht{constructor(){super(...arguments),this.type="geo",this.renderType=K.SVG}render(){const t=this.getComponentContainer({withinChartClip:!0}),{width:n,height:i}=R.getSVGElementSize(t,{useAttrs:!0});if(n<1||i<1)return;const r=this.getProjection(),s=E(this.getOptions(),"geoData"),a=this.model.getCombinedData(),o={},c={};Object.keys(a).forEach(g=>{typeof a[g].value=="number"?o[g]=a[g]:c[g]=a[g]});const l=Gk(s,Object.values(c)),u=Bk(s,{type:"GeometryCollection",geometries:Object.values(o)}),h=r.fitSize([n,i],u),d=Gx().projection(h);R.appendOrSelect(t,"g.geo").selectAll("path").data(u.features).join("path").attr("d",d);const f=this.services.domUtils.generateElementIDString("geo-pattern-stripes"),p=R.appendOrSelect(t,"defs");R.appendOrSelect(p,"pattern").attr("id",f).attr("width",5).attr("height",10).attr("patternUnits","userSpaceOnUse").attr("patternTransform","rotate(45)").append("path").classed("pattern-fill",!0).attr("d",lr()([[0,0],[0,10]]));const m=R.appendOrSelect(t,"g.missing-data");R.appendOrSelect(m,"path").datum(l).attr("d",d).style("fill",`url(#${f})`)}getProjection(){let t=null;switch(E(this.getOptions(),"thematic","projection")){case Ke.geoEqualEarth:t=ob();break;case Ke.geoAlbers:t=tb();break;case Ke.geoConicEqualArea:t=Sh();break;case Ke.geoConicEquidistant:t=sb();break;case Ke.geoEquirectangular:t=ib();break;case Ke.geoMercator:t=eb();break;case Ke.geoNaturalEarth1:t=lb();break;default:throw new Error("Projection is not supported.")}return t}}class RP extends kP{constructor(){super(...arguments),this.type="choropleth"}render(t=!0){super.render();const n=this.model.getCombinedData();this.getComponentContainer({withinChartClip:!0}).select("g.geo").selectAll("path").classed("border",!0).attr("class",i=>this.model.getColorClassName({value:n[i.properties.NAME].value,originalClassName:"border"})),this.addCountryAreaEventListener()}addCountryAreaEventListener(){const t=this,n=this.model.getCombinedData();this.parent.selectAll("path.border").on("mouseover",function(i,r){const s=P(this);t.services.events.dispatchEvent(ui.CHOROPLETH_MOUSEOVER,{event:i,element:s,datum:n[r.properties.NAME]}),t.services.events.dispatchEvent(ur.SHOW,{event:i,hoveredElement:s,items:[{label:r.properties.NAME,value:n[r.properties.NAME].value}]})}).on("mousemove",function(i,r){t.services.events.dispatchEvent(ui.CHOROPLETH_MOUSEMOVE,{event:i,element:P(this),datum:n[r.properties.NAME]}),t.services.events.dispatchEvent(ur.MOVE,{event:i})}).on("click",function(i,r){t.services.events.dispatchEvent(ui.CHOROPLETH_CLICK,{event:i,element:P(this),datum:n[r.properties.NAME]})}).on("mouseout",function(i,r){const s=P(this);t.services.events.dispatchEvent(ui.CHOROPLETH_MOUSEOUT,{event:i,element:s,datum:n[r.properties.NAME]}),t.services.events.dispatchEvent(ur.HIDE,{event:i,hoveredElement:s})})}}function rm(e,t){st(2,arguments);var n=ft(e),i=Ut(t);return isNaN(i)?new Date(NaN):(i&&n.setDate(n.getDate()+i),n)}function yc(e,t){st(2,arguments);var n=ft(e),i=Ut(t);if(isNaN(i))return new Date(NaN);if(!i)return n;var r=n.getDate(),s=new Date(n.getTime());s.setMonth(n.getMonth()+i+1,0);var a=s.getDate();return r>=a?s:(n.setFullYear(s.getFullYear(),s.getMonth(),r),n)}var IP=36e5;function sm(e,t){st(2,arguments);var n=Ut(t);return Zs(e,n*IP)}function am(e){st(1,arguments);var t=ft(e);return t.setHours(0,0,0,0),t}var PP=864e5;function NP(e,t){st(2,arguments);var n=am(e),i=am(t),r=n.getTime()-gl(n),s=i.getTime()-gl(i);return Math.round((r-s)/PP)}var UP=6e4;function xc(e,t){st(2,arguments);var n=Ut(t);return Zs(e,n*UP)}function bc(e,t){st(2,arguments);var n=Ut(t);return Zs(e,n*1e3)}function om(e,t){st(2,arguments);var n=Ut(t);return yc(e,n*12)}function Pr(e,t){st(2,arguments);var n=ft(e),i=ft(t),r=n.getTime()-i.getTime();return r<0?-1:r>0?1:r}var BP=6e4,HP=36e5;function VP(e,t){st(2,arguments);var n=ft(e),i=ft(t),r=n.getFullYear()-i.getFullYear(),s=n.getMonth()-i.getMonth();return r*12+s}function GP(e,t){st(2,arguments);var n=ft(e),i=ft(t);return n.getFullYear()-i.getFullYear()}function lm(e,t){var 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 FP(e,t){st(2,arguments);var n=ft(e),i=ft(t),r=lm(n,i),s=Math.abs(NP(n,i));n.setDate(n.getDate()-r*s);var a=+(lm(n,i)===-r),o=r*(s-a);return o===0?0:o}function wc(e,t){return st(2,arguments),ft(e).getTime()-ft(t).getTime()}var cm={ceil:Math.ceil,round:Math.round,floor:Math.floor,trunc:function(e){return e<0?Math.ceil(e):Math.floor(e)}},zP="trunc";function Ec(e){return e?cm[e]:cm[zP]}function jP(e,t,n){st(2,arguments);var i=wc(e,t)/HP;return Ec(n==null?void 0:n.roundingMethod)(i)}function um(e,t,n){st(2,arguments);var i=wc(e,t)/BP;return Ec(n==null?void 0:n.roundingMethod)(i)}function WP(e){st(1,arguments);var t=ft(e);return t.setHours(23,59,59,999),t}function qP(e){st(1,arguments);var t=ft(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(23,59,59,999),t}function YP(e){st(1,arguments);var t=ft(e);return WP(t).getTime()===qP(t).getTime()}function XP(e,t){st(2,arguments);var n=ft(e),i=ft(t),r=Pr(n,i),s=Math.abs(VP(n,i)),a;if(s<1)a=0;else{n.getMonth()===1&&n.getDate()>27&&n.setDate(30),n.setMonth(n.getMonth()-r*s);var o=Pr(n,i)===-r;YP(ft(e))&&s===1&&Pr(e,i)===1&&(o=!1),a=r*(s-Number(o))}return a===0?0:a}function hm(e,t,n){st(2,arguments);var i=wc(e,t)/1e3;return Ec(n==null?void 0:n.roundingMethod)(i)}function ZP(e,t){st(2,arguments);var n=ft(e),i=ft(t),r=Pr(n,i),s=Math.abs(GP(n,i));n.setFullYear(1584),i.setFullYear(1584);var a=Pr(n,i)===-r,o=r*(s-Number(a));return o===0?0:o}function KP(e,t){st(2,arguments);var n=Ut(t);return rm(e,-n)}function QP(e,t){st(2,arguments);var n=Ut(t);return yc(e,-n)}function JP(e,t){st(2,arguments);var n=Ut(t);return sm(e,-n)}function dm(e,t){st(2,arguments);var n=Ut(t);return xc(e,-n)}function fm(e,t){st(2,arguments);var n=Ut(t);return bc(e,-n)}function tN(e,t){st(2,arguments);var n=Ut(t);return om(e,-n)}function pm(e){var t=e==null?0:e.length;return t?la(e,1):[]}class eN extends an{zoomIn(t,n,i){let r,s,a;const o=i||gi;t&&(r=t.x,s=t.y,a=2);const{width:c,height:l}=R.getSVGElementSize(this.services.domUtils.getHolder(),{useClientDimensions:!0});n.transition().duration(o.duration).ease(o.ease).attr("transform",`translate(${c/2}, ${l/2}) scale(${a}) translate(${-r},${-s})`),this.services.events.dispatchEvent(C.CanvasZoom.CANVAS_ZOOM_IN,{element:P(t)})}zoomOut(t,n){const i=n||gi;t.transition().duration(i.duration).ease(i.ease).attr("transform",""),this.services.events.dispatchEvent(C.CanvasZoom.CANVAS_ZOOM_OUT)}}class nN extends an{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 i;n?i=new CustomEvent(t,{detail:n}):(i=document.createEvent("Event"),i.initEvent(t,!1,!0)),this.documentFragment.dispatchEvent(i)}}class iN extends an{constructor(t,n){super(t,n)}downloadCSV(t,n){const i=document.createElement("a"),r="text/csv;encoding:utf-8";if(navigator.msSaveBlob)navigator.msSaveBlob(new Blob([t],{type:r}),n);else if(URL&&"download"in i){const s=URL.createObjectURL(new Blob([t],{type:r}));i.href=s,i.setAttribute("download",n),document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(s)}else location.href=`data:application/octet-stream,${encodeURIComponent(t)}`}downloadImage(t,n){const i=document.createElement("a");i.download=n,i.href=t,document.body.appendChild(i),i.click(),document.body.removeChild(i)}}class rN extends an{constructor(){super(...arguments),this.pendingTransitions={}}init(){var t;(t=this.services.events)==null||t.addEventListener(C.Model.UPDATE,()=>{this.pendingTransitions={}})}setupTransition({transition:t,name:n,animate:i}){return this.pendingTransitions[t._id]=t,t.on("end interrupt cancel",()=>{delete this.pendingTransitions[t._id]}),this.model.getOptions().animations===!1||i===!1?t.duration(0):t.duration(E(vf,n,"duration")||vf.default.duration)}getPendingTransitions(){return this.pendingTransitions}}let sN=class extends an{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:i}=n.data,r=E(n,"axes",this.secondaryDomainAxisPosition),s=t[i];if(r!=null&&r.correspondingDatasets&&r.correspondingDatasets.includes(s))return this.secondaryDomainAxisPosition}return this.domainAxisPosition}getRangeAxisPosition({datum:t=null,groups:n=null}={}){if(this.dualAxes){const i=this.model.getOptions(),{groupMapsTo:r}=i.data,s=E(i,"axes",this.secondaryRangeAxisPosition);let a;if(t!==null?a=t[r]:n&&n.length>0&&(a=n[0]),s!=null&&s.correspondingDatasets&&s.correspondingDatasets.includes(a))return this.secondaryRangeAxisPosition}return this.rangeAxisPosition}getAxisOptions(t){return E(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===H.BOTTOM||t===H.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(H).map(t=>H[t]).forEach(t=>{this.scales[t]=this.createScale(t)})}findDomainAndRangeAxes(){const t=this.findVerticalAxesPositions(),n=this.findHorizontalAxesPositions(),i=this.findDomainAndRangeAxesPositions(t,n);this.domainAxisPosition=i.primaryDomainAxisPosition,this.rangeAxisPosition=i.primaryRangeAxisPosition,this.isDualAxes()&&(this.secondaryDomainAxisPosition=i.secondaryDomainAxisPosition,this.secondaryRangeAxisPosition=i.secondaryRangeAxisPosition)}determineOrientation(){(this.rangeAxisPosition===H.LEFT||this.rangeAxisPosition===H.RIGHT)&&(this.domainAxisPosition===H.BOTTOM||this.domainAxisPosition===H.TOP)?this.orientation=Ht.VERTICAL:this.orientation=Ht.HORIZONTAL}isDualAxes(){return this.dualAxes}determineAxisDuality(){var t,n,i,r;const s=this.model.getOptions(),a=E(s,"axes");((t=a[H.LEFT])!=null&&t.correspondingDatasets&&a[H.RIGHT]||(n=a[H.RIGHT])!=null&&n.correspondingDatasets&&a[H.LEFT]||(i=a[H.TOP])!=null&&i.correspondingDatasets&&a[H.BOTTOM]||(r=a[H.BOTTOM])!=null&&r.correspondingDatasets&&a[H.TOP])&&(this.dualAxes=!0)}getCustomDomainValuesByposition(t){const n=E(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]===Z.LINEAR||this.scaleTypes[t]===Z.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=[H.BOTTOM,H.TOP];return[this.domainAxisPosition,this.rangeAxisPosition].find(n=>t.indexOf(n)>-1)}getMainYAxisPosition(){const t=[H.LEFT,H.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,i,r){const s=this.model.getOptions(),a=E(s,"axes")[i],{mapsTo:o}=a,c=E(r,o)!==null?r[o]:r;let l;switch(n){case Z.LABELS:l=t(c)+t.step()/2;break;case Z.TIME:l=t(new Date(c));break;default:l=t(c)}return l}getBoundedScaledValues(t){const{bounds:n}=this.model.getOptions(),i=this.getRangeAxisPosition({datum:t}),r=this.scales[i],s=this.model.getOptions(),a=E(s,"axes")[i],{mapsTo:o}=a,c=t[o]!==void 0?t[o]:t;return[r(E(t,n.upperBoundMapsTo)!==null?t[n.upperBoundMapsTo]:c),r(E(t,n.lowerBoundMapsTo)!==null?t[n.lowerBoundMapsTo]:c)]}getValueThroughAxisPosition(t,n){const i=this.scaleTypes[t],r=this.scales[t];return this.getValueFromScale(r,i,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 E(n,"axes",this.getDomainAxisPosition({datum:t}),"mapsTo")}getRangeIdentifier(t){const n=this.model.getOptions();return E(n,"axes",this.getRangeAxisPosition({datum:t}),"mapsTo")}extendsDomain(t,n){const i=this.model.getOptions(),r=E(i,"axes",t);if(r.scaleType===Z.TIME){const s=E(i,"timeScale","addSpaceOnEdges");return aN(n,s)}else return oN(n,fn.paddingRatio,r.scaleType)}findVerticalAxesPositions(){const t=this.model.getOptions(),n=E(t,"axes"),i=this.isDualAxes();return E(n,H.LEFT)===null&&E(n,H.RIGHT)!==null||E(n,H.RIGHT,"main")===!0||i&&E(n,H.LEFT,"correspondingDatasets")?{primary:H.RIGHT,secondary:H.LEFT}:{primary:H.LEFT,secondary:H.RIGHT}}findHorizontalAxesPositions(){const t=this.model.getOptions(),n=E(t,"axes"),i=this.isDualAxes();return E(n,H.BOTTOM)===null&&E(n,H.TOP)!==null||E(n,H.TOP,"main")===!0||i&&E(n,H.BOTTOM,"correspondingDatasets")?{primary:H.TOP,secondary:H.BOTTOM}:{primary:H.BOTTOM,secondary:H.TOP}}findDomainAndRangeAxesPositions(t,n){const i=this.model.getOptions(),r=E(i,"axes",t.primary),s=E(i,"axes",n.primary),a=r.scaleType||Z.LINEAR,o=s.scaleType||Z.LINEAR,c={primaryDomainAxisPosition:null,secondaryDomainAxisPosition:null,primaryRangeAxisPosition:null,secondaryRangeAxisPosition:null};return c.primaryDomainAxisPosition=n.primary,c.primaryRangeAxisPosition=t.primary,c.secondaryDomainAxisPosition=n.secondary,c.secondaryRangeAxisPosition=t.secondary,(!(o===Z.LABELS||o===Z.TIME)&&a===Z.LABELS||a===Z.TIME)&&(c.primaryDomainAxisPosition=t.primary,c.primaryRangeAxisPosition=n.primary,c.secondaryDomainAxisPosition=t.secondary,c.secondaryRangeAxisPosition=n.secondary),c}getScaleDomain(t){const n=this.model.getOptions(),i=E(n,"axes",t),r=E(n,"bounds"),{includeZero:s}=i,a=E(i,"scaleType")||Z.LINEAR;if(this.model.isDataEmpty())return[];if(i.binned){const{bins:v}=this.model.getBinConfigurations();return[0,bn(v,b=>b.length)]}else if(i.limitDomainToBins){const{bins:v}=this.model.getBinConfigurations(),b=this.model.getStackKeys({bins:v});return[b[0].split("-")[0],b[b.length-1].split("-")[1]]}const o=this.model.getDisplayData(),{extendLinearDomainBy:c,mapsTo:l,percentage:u,thresholds:h}=i,{reference:d,compareTo:f}=fn.ratio;if(i.domain)return a===Z.LABELS?i.domain:(a===Z.TIME&&(i.domain=i.domain.map(v=>v.getTime===void 0?new Date(v):v)),this.extendsDomain(t,i.domain));if(u)return[0,100];if(i&&a===Z.LABELS)return Tr(o.map(v=>v[l]));let p,m;const g=this.model.getDataGroupNames();if(a===Z.LABELS_RATIO)return o.map(v=>`${v[d]}/${v[f]}`);if(a===Z.TIME)m=o.map(v=>+new Date(v[l]));else if(r&&n.axes)m=[],o.forEach(v=>{m.push(v[l]),v[r.upperBoundMapsTo]&&m.push(v[r.upperBoundMapsTo]),v[r.lowerBoundMapsTo]&&m.push(v[r.lowerBoundMapsTo])});else if(i.stacked===!0&&g&&t===this.getRangeAxisPosition()){const{groupMapsTo:v}=n.data,b=this.model.getDataValuesGroupedByKeys({groups:g}),w=o.filter(_=>!g.includes(_[v])),O=[];b.forEach(_=>{const{...T}=_;let S=0,$=0;Object.values(T).forEach(D=>{isNaN(D)||(D<0?$+=D:S+=D)}),O.push([$,S])}),m=[...pm(O),...w.map(_=>_[l])]}else m=[],o.forEach(v=>{const b=v[l];Array.isArray(b)&&b.length===2?(m.push(b[0]),m.push(b[1])):(c&&m.push(Math.max(v[l],v[c])),m.push(b))});return a!==Z.TIME&&a!==Z.LOG&&s&&m.push(0),h&&h.length>0&&h.forEach(v=>{const b=E(v,"value");b!==null&&m.push(b)}),p=ye(m),p=this.extendsDomain(t,p),p}createScale(t){const n=this.model.getOptions(),i=E(n,"axes",t);if(!i)return null;const r=E(i,"scaleType")||Z.LINEAR;this.scaleTypes[t]=r;let s;return r===Z.TIME?s=ud():r===Z.LOG?s=jh().base(i.base||10):r===Z.LABELS||r===Z.LABELS_RATIO?s=er():s=_e(),s.domain(this.getScaleDomain(t)),s}getHighestDomainThreshold(){const t=E(this.model.getOptions(),"axes"),n=this.getDomainAxisPosition(),{thresholds:i}=t[n];if(!Array.isArray(i)||Array.isArray(i)&&!i.length)return null;const r=this.getDomainScale(),s=i.sort((a,o)=>o.value-a.value)[0];return this.getScaleTypeByPosition(n)===Z.TIME&&(typeof s.value=="string"||s.value.getTime===void 0)&&(s.value=new Date(s.value)),{threshold:s,scaleValue:r(s.value)}}getHighestRangeThreshold(){const t=E(this.model.getOptions(),"axes"),n=this.getRangeAxisPosition(),{thresholds:i}=t[n];if(!Array.isArray(i)||Array.isArray(i)&&!i.length)return null;const r=this.getRangeScale(),s=i.sort((a,o)=>o.value-a.value)[0];return{threshold:s,scaleValue:r(s.value)}}};function aN(e,t){const n=new Date(e[0]),i=new Date(e[1]);return ZP(i,n)>1?[tN(n,t),om(i,t)]:XP(i,n)>1?[QP(n,t),yc(i,t)]:FP(i,n)>1?[KP(n,t),rm(i,t)]:jP(i,n)>1?[JP(n,t),sm(i,t)]:um(i,n)>30?[dm(n,t*30),xc(i,t*30)]:um(i,n)>1?[dm(n,t),xc(i,t)]:hm(i,n)>15?[fm(n,t*15),bc(i,t*15)]:hm(i,n)>1?[fm(n,t),bc(i,t)]:[n,i]}function oN([e,t],n,i){const r=(t-e)*n,s=t<=0&&t+r>0?0:t+r;let a=e>=0&&e-r<0?0:e-r;if(i===Z.LOG&&a<=0){if(e<=0)throw Error("Data must have values greater than 0 if log scale type is used.");a=e}return[a,s]}let lN=class extends an{constructor(){super(...arguments),this.curveTypes={curveLinear:Us,curveLinearClosed:_d,curveBasis:n_,curveBasisClosed:i_,curveBasisOpen:r_,curveBundle:s_,curveCardinal:a_,curveCardinalClosed:o_,curveCardinalOpen:l_,curveCatmullRom:c_,curveCatmullRomClosed:u_,curveCatmullRomOpen:h_,curveMonotoneX:d_,curveMonotoneY:f_,curveNatural:p_,curveStep:g_,curveStepAfter:v_,curveStepBefore:m_}}getD3Curve(){let t="curveLinear";const n=this.model.getOptions().curve;if(n&&(typeof n=="string"?t=n:t=n.name),this.curveTypes[t]){let i=this.curveTypes[t];return n&&Object.keys(n).forEach(r=>{i[r]&&(i=i[r](n[r]))}),i}return console.warn(`The curve type '${t}' is invalid, using 'curveLinear' instead`),this.curveTypes.curveLinear}};class cN extends an{isZoomBarEnabled(){if(!this.services.cartesianScales||!E(this.model.getOptions(),"zoomBar","top","enabled"))return!1;this.services.cartesianScales.findDomainAndRangeAxes();const t=this.services.cartesianScales.getMainXAxisPosition(),n=E(this.model.getOptions(),"axes",t,"scaleType");return t===H.BOTTOM&&n===Z.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:i}=this.services;if(!i)throw new Error("Services cartesianScales undefined");const r=i.getMainXAxisPosition(),s=i.getDomainIdentifier(),a=E(this.model.getOptions(),"axes",r,"domain");if(Array.isArray(a)&&a.length===2)return a;if(!r)throw new Error("Not defined: mainXAxisPosition");return i.extendsDomain(r,ye(n,o=>o[s]))}handleDomainChange(t,n={dispatchEvent:!0}){var i;this.model.set({zoomDomain:t},{animate:!1}),n.dispatchEvent&&((i=this.services.events)==null||i.dispatchEvent(C.ZoomDomain.CHANGE,{newDomain:t}))}getZoomRatio(){return E(this.model.getOptions(),"zoomBar","zoomRatio")}filterDataForRangeAxis(t,n){var i;const r=this.model.get("zoomDomain"),s=Object.assign({stacked:!1},n),a=E(this.model.getOptions(),"zoomBar","updateRangeAxis");if(this.isZoomBarEnabled()&&a&&r){const o=s.stacked?"sharedStackKey":(i=this.services.cartesianScales)==null?void 0:i.getDomainIdentifier(),c=t.filter(l=>new Date(l[o])>=r[0]&&new Date(l[o])<=r[1]);if(c.length>0)return c}return t}zoomIn(t=this.getZoomRatio()){var n;const i=this.model.get("zoomDomain"),r=ce.handleWidth,s=(n=this.services.cartesianScales)==null?void 0:n.getMainXScale().copy();s.domain(this.getDefaultZoomBarDomain());const a=s(i[0]),o=s(i[1]);if(o-a<r+1)return;const c=s.range(),l=o-a,u=Math.min((c[1]-c[0])/2*(t/2),l/2);let h=a+u,d=o-u;h>=d&&(h=a+l/2-r/2,d=o-l/2+r/2);const f=[s.invert(h),s.invert(d)];(i[0].valueOf()!==f[0].valueOf()||i[1].valueOf()!==f[1].valueOf())&&this.handleDomainChange(f)}zoomOut(t=this.getZoomRatio()){const n=this.model.get("zoomDomain");if(!this.services.cartesianScales)throw new Error("Services cartesianScales undefined");const i=this.services.cartesianScales.getMainXScale().copy();i.domain(this.getDefaultZoomBarDomain());const r=i(n[0]),s=i(n[1]),a=i.range(),o=(a[1]-a[0])/2*(t/2),c=Math.max(r-o,a[0]),l=Math.min(s+o,a[1]),u=[i.invert(c),i.invert(l)];(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 i=t[1].valueOf()-t[0].valueOf(),r=n[1].valueOf()-n[0].valueOf(),s=E(this.model.getOptions(),"zoomBar","minZoomRatio");return i/r<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 E(this.model.getOptions(),"zoomBar",t,"loading")}isZoomBarLocked(t){return E(this.model.getOptions(),"zoomBar",t,"locked")}}function uN(e,t,n){var i=-1,r=e.length;t<0&&(t=-t>r?0:r+t),n=n>r?r:n,n<0&&(n+=r),r=t>n?0:n-t>>>0,t>>>=0;for(var s=Array(r);++i<r;)s[i]=e[i+t];return s}function hN(e,t,n){var i=e.length;return n=n===void 0?i:n,!t&&n>=i?e:uN(e,t,n)}var dN="\\ud800-\\udfff",fN="\\u0300-\\u036f",pN="\\ufe20-\\ufe2f",gN="\\u20d0-\\u20ff",mN=fN+pN+gN,vN="\\ufe0e\\ufe0f",yN="\\u200d",xN=RegExp("["+yN+dN+mN+vN+"]");function gm(e){return xN.test(e)}function bN(e){return e.split("")}var mm="\\ud800-\\udfff",wN="\\u0300-\\u036f",EN="\\ufe20-\\ufe2f",_N="\\u20d0-\\u20ff",SN=wN+EN+_N,ON="\\ufe0e\\ufe0f",TN="["+mm+"]",_c="["+SN+"]",Sc="\\ud83c[\\udffb-\\udfff]",MN="(?:"+_c+"|"+Sc+")",vm="[^"+mm+"]",ym="(?:\\ud83c[\\udde6-\\uddff]){2}",xm="[\\ud800-\\udbff][\\udc00-\\udfff]",CN="\\u200d",bm=MN+"?",wm="["+ON+"]?",AN="(?:"+CN+"(?:"+[vm,ym,xm].join("|")+")"+wm+bm+")*",$N=wm+bm+AN,LN="(?:"+[vm+_c+"?",_c,ym,xm,TN].join("|")+")",DN=RegExp(Sc+"(?="+Sc+")|"+LN+$N,"g");function kN(e){return e.match(DN)||[]}function RN(e){return gm(e)?kN(e):bN(e)}function IN(e){return function(t){t=Sr(t);var n=gm(t)?RN(t):void 0,i=n?n[0]:t.charAt(0),r=n?hN(n,1).join(""):t.slice(1);return i[e]()+r}}var PN=IN("toUpperCase");const NN=PN;function UN(e){return NN(Sr(e).toLowerCase())}var BN=Eg(function(e,t,n){return t=t.toLowerCase(),e+(n?UN(t):t)});const HN=BN;class Ae{constructor(t,n){this.components=[],this.services={canvasZoom:eN,domUtils:R,events:nN,files:iN,gradientUtils:jl,transitions:rN},this.model=new Ne(this.services)}init(t,n){this.model.set({holder:t},{skipUpdate:!0}),Object.keys(this.services).forEach(i=>{const r=this.services[i];this.services[i]=new r(this.model,this.services)}),this.services.events.addEventListener(C.Model.UPDATE,()=>{this.update()}),this.model.setData(n.data),this.services.events.addEventListener(C.Chart.RESIZE,()=>{this.update()}),this.components=this.getComponents(),this.update()}getComponents(){return console.error("getComponents() method is not implemented"),[]}update(){if(!this.components)return;Object.keys(this.services).forEach(i=>{this.services[i].update()}),this.components.forEach(i=>i.render(!0));const t=this.services.transitions.getPendingTransitions(),n=Object.keys(t).map(i=>t[i].end().catch(r=>r));Promise.all(n).then(()=>this.services.events.dispatchEvent(C.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 i=this.model.getOptions(),r=E(i,"toolbar","enabled"),s={id:"legend",components:[new pc(this.model,this.services)],growth:it.PREFERRED},a=E(i,"canvasZoom","enabled");a&&a===!0&&t.push(new Tk(this.model,this.services));const o=!!this.model.getOptions().title,c={id:"title",components:[new Ir(this.model,this.services)],growth:it.STRETCH},l={id:"toolbar",components:[new kr(this.model,this.services)],growth:it.PREFERRED},u={id:"header",components:[new ie(this.model,this.services,[c,...r?[l]:[]],{direction:Et.ROW,alignItems:hi.CENTER})],growth:it.PREFERRED},h={id:"graph-frame",components:t,growth:it.STRETCH,renderType:E(n,"graphFrameRenderType")||K.SVG},d=E(n,"excludeLegend")!==!0&&i.legend.enabled!==!1;let f=Et.COLUMN;if(d){const v=E(i,"legend","position");v==="left"?(f=Et.ROW,i.legend.orientation||(i.legend.orientation=dr.VERTICAL)):v==="right"?(f=Et.ROW_REVERSE,i.legend.orientation||(i.legend.orientation=dr.VERTICAL)):v==="bottom"&&(f=Et.COLUMN_REVERSE)}const p={id:"spacer",components:[new on(this.model,this.services)],growth:it.PREFERRED},m={id:"full-frame",components:[new ie(this.model,this.services,[...d?[s]:[],...d?[p]:[],h],{direction:f})],growth:it.STRETCH},g=[];if(o||r){g.push(u);const v={id:"spacer",components:[new on(this.model,this.services,r?{size:15}:void 0)],growth:it.PREFERRED};g.push(v)}return g.push(m),[new gc(this.model,this.services),new Ca(this.model,this.services),new ie(this.model,this.services,g,{direction:Et.COLUMN})]}}class se extends Ae{constructor(t,n){super(t,n),this.services=Object.assign(this.services,{cartesianScales:sN,curves:lN,zoom:cN}),this.model=new Gn(this.services)}getAxisChartComponents(t,n){const i=this.model.getOptions(),r=E(i,"zoomBar",H.TOP,"enabled"),s=E(i,"toolbar","enabled");this.services.cartesianScales.determineAxisDuality(),this.services.cartesianScales.findDomainAndRangeAxes(),this.services.cartesianScales.determineOrientation();const a=this.services.cartesianScales.getMainXAxisPosition(),o=E(i,"axes",a,"scaleType"),c=r&&a===H.BOTTOM&&o===Z.TIME,l=this.services.zoom.isZoomBarLocked(H.TOP),u=!!this.model.getOptions().title,h={id:"title",components:[new Ir(this.model,this.services)],growth:it.STRETCH},d={id:"toolbar",components:[new kr(this.model,this.services)],growth:it.PREFERRED},f={id:"header",components:[new ie(this.model,this.services,[h,...s?[d]:[]],{direction:Et.ROW,alignItems:hi.CENTER})],growth:it.PREFERRED},p={id:"legend",components:[new pc(this.model,this.services)],growth:it.PREFERRED};c&&!l&&t.push(new Ug(this.model,this.services),new Vg(this.model,this.services)),t.push(new Ck(this.model,this.services)),t.push(new Ak(this.model,this.services));const m={id:"graph-frame",components:t,growth:it.STRETCH,renderType:K.SVG},g=E(n,"legend","enabled")!==!1&&this.model.getOptions().legend.enabled!==!1;let v=Et.COLUMN;if(g){const T=E(this.model.getOptions(),"legend","position");T===hr.LEFT?(v=Et.ROW,this.model.getOptions().legend.orientation||(this.model.getOptions().legend.orientation=dr.VERTICAL)):T===hr.RIGHT?(v=Et.ROW_REVERSE,this.model.getOptions().legend.orientation||(this.model.getOptions().legend.orientation=dr.VERTICAL)):T===hr.BOTTOM&&(v=Et.COLUMN_REVERSE)}const b={id:"spacer",components:[new on(this.model,this.services)],growth:it.PREFERRED},w={id:"full-frame",components:[new ie(this.model,this.services,[...g?[p]:[],...g?[b]:[],m],{direction:v})],growth:it.STRETCH},O={id:"zoom-bar",components:[new Mk(this.model,this.services)],growth:it.PREFERRED,renderType:K.SVG},_=[];if(u||s){_.push(f);const T={id:"spacer",components:[new on(this.model,this.services,s?{size:15}:void 0)],growth:it.PREFERRED};_.push(T)}return c&&_.push(O),_.push(w),[new Gg(this.model,this.services),new Ca(this.model,this.services),new ie(this.model,this.services,_,{direction:Et.COLUMN})]}}class VN extends Ae{constructor(t,n){super(t,n),this.model=new e$(this.services),this.model.setOptions(Ct(wt.alluvialChart,n.options)),this.init(t,n)}getComponents(){const t=[new $k(this.model,this.services)];return this.getChartComponents(t,{excludeLegend:!0})}}class GN extends se{constructor(t,n){super(t,n),this.model.setOptions(Ct(nn(wt.areaChart),n.options)),this.init(t,n)}getComponents(){const t=[new re(this.model,this.services),new ue(this.model,this.services),new vn(this.model,this.services),new Mi(this.model,this.services),new Fg(this.model,this.services),new Ue(this.model,this.services,{fadeInOnChartHolderMouseover:!0,handleThresholds:!0}),new Jt(this.model,this.services,{skeleton:Pt.GRID})];return this.getAxisChartComponents(t)}}class FN extends se{constructor(t,n){super(t,n),this.model=new n$(this.services),this.model.setOptions(Ct(wt.boxplotChart,n.options)),this.init(t,n)}getComponents(){const t=[new re(this.model,this.services),new ue(this.model,this.services),new kk(this.model,this.services),new Ci(this.model,this.services),new Jt(this.model,this.services,{skeleton:Pt.VERT_OR_HORIZ})];return this.getAxisChartComponents(t,{legend:{enabled:!1}})}}class zN extends se{constructor(t,n){super(t,n),this.model.setOptions(Ct(wt.bubbleChart,n.options)),this.init(t,n)}getComponents(){const t=[new re(this.model,this.services),new ue(this.model,this.services),new vn(this.model,this.services),new Rk(this.model,this.services),new Jt(this.model,this.services,{skeleton:Pt.GRID})];return this.getAxisChartComponents(t)}}class jN extends se{constructor(t,n){super(t,n),this.model=new i$(this.services),this.model.setOptions(Ct(wt.bulletChart,n.options)),this.init(t,n)}getComponents(){const t=[new re(this.model,this.services),new ue(this.model,this.services),new Ik(this.model,this.services),new Jt(this.model,this.services,{skeleton:Pt.GRID})];return this.getAxisChartComponents(t)}}class WN extends Ae{constructor(t,n){super(t,n),this.model=new r$(this.services),this.model.setOptions(Ct(wt.choroplethChart,n.options)),this.init(t,n)}getChartComponents(t,n){const i=this.model.getOptions(),r=E(i,"toolbar","enabled"),s=!!this.model.getOptions().title,a={id:"title",components:[new Ir(this.model,this.services)],growth:it.STRETCH},o={id:"toolbar",components:[new kr(this.model,this.services)],growth:it.PREFERRED},c={id:"header",components:[new ie(this.model,this.services,[a,...r?[o]:[]],{direction:Et.ROW,alignItems:hi.CENTER})],growth:it.PREFERRED},l={id:"legend",components:[new qg(this.model,this.services,{chartType:"choropleth"})],growth:it.PREFERRED,renderType:K.SVG},u={id:"graph-frame",components:t,growth:it.STRETCH,renderType:K.SVG},h=E(n,"legend","enabled")!==!1&&this.model.getOptions().legend.enabled!==!1,d=Et.COLUMN_REVERSE,f={id:"spacer",components:[new on(this.model,this.services,{size:15})],growth:it.PREFERRED},p={id:"full-frame",components:[new ie(this.model,this.services,[...h?[l]:[],...h?[f]:[],u],{direction:d})],growth:it.STRETCH},m=[];if(s||r){m.push(c);const g={id:"spacer",components:[new on(this.model,this.services,r?{size:15}:void 0)],growth:it.PREFERRED};m.push(g)}return m.push(p),[new gc(this.model,this.services),new Ca(this.model,this.services),new ie(this.model,this.services,m,{direction:Et.COLUMN})]}getComponents(){const t=[new RP(this.model,this.services)];return this.getChartComponents(t)}}class qN extends Ae{constructor(t,n){super(t,n),this.model=new s$(this.services),this.model.setOptions(Ct(wt.circlePackChart,n.options)),this.init(t,n)}getComponents(){const t=[new Wk(this.model,this.services)];return this.getChartComponents(t)}}const Em={[fe.LINE]:[Mi,Ue],[fe.SCATTER]:[Ue],[fe.AREA]:[Fg,Mi,Ue],[fe.STACKED_AREA]:[Jg,Mi,em,La],[fe.SIMPLE_BAR]:[Qg],[fe.GROUPED_BAR]:[Kg,Ci],[fe.STACKED_BAR]:[tm,La]};class YN extends se{constructor(t,n){super(t,n);const i=Ct(wt.comboChart,n.options);n.options.comboChartTypes||(console.error("No comboChartTypes defined for the Combo Chart!"),i.comboChartTypes=[{type:fe.LINE,correspondingDatasets:[]}]),this.model.setOptions(i),this.init(t,n)}getGraphComponents(){const{comboChartTypes:t}=this.model.getOptions();let n=0;const i=t.map(r=>{const s=r.type;let a;if(typeof r.type=="string"){if(!Object.keys(Em).includes(r.type))return console.error(`Invalid chart type "${r.type}" specified for combo chart. Please refer to the ComboChart tutorial for more guidance.`),null;let o=!1;const c=`${HN(r.type)}Chart`;return a=nt({},wt[c],this.model.getOptions(),r.options),r.type===fe.STACKED_AREA&&(o=!0),Em[r.type].map(l=>new l(this.model,this.services,{groups:r.correspondingDatasets,id:n++,options:a,stacked:o}))}else return a=nt({},this.model.getOptions(),r.options),new s(this.model,this.services,{groups:r.correspondingDatasets,id:n++,options:a})}).filter(r=>r!==null);return pm(i)}getComponents(){const{comboChartTypes:t}=this.model.getOptions(),n=t.some(r=>r.type===fe.STACKED_BAR||r.type===fe.STACKED_AREA),i=[new re(this.model,this.services),new ue(this.model,this.services),new Jt(this.model,this.services,{skeleton:Pt.GRID}),...n?[]:[new vn(this.model,this.services)],...this.getGraphComponents()];return this.getAxisChartComponents(i)}}class _m extends Ae{constructor(t,n,i=!1){super(t,n),this.model=new a$(this.services),!i&&(this.model.setOptions(Ct(wt.pieChart,n.options)),this.init(t,n))}getComponents(){const t=[new Yg(this.model,this.services),new Jt(this.model,this.services,{skeleton:Pt.PIE})];return this.getChartComponents(t)}}class XN extends _m{constructor(t,n){super(t,n,!0),this.model.setOptions(Ct(wt.donutChart,n.options)),this.init(t,n)}getComponents(){const t=[new Yk(this.model,this.services),new Jt(this.model,this.services,{skeleton:Pt.DONUT})];return this.getChartComponents(t)}}class ZN extends Ae{constructor(t,n){super(t,n),this.model=new o$(this.services),this.model.setOptions(Ct(wt.gaugeChart,n.options)),this.init(t,n)}getComponents(){const t=[new Xk(this.model,this.services)];return this.getChartComponents(t)}}class KN extends se{constructor(t,n){super(t,n),this.model.setOptions(Ct(wt.groupedBarChart,n.options)),this.init(t,n)}getComponents(){const t=[new re(this.model,this.services),new ue(this.model,this.services),new Kg(this.model,this.services),new Ci(this.model,this.services),new Jt(this.model,this.services,{skeleton:Pt.VERT_OR_HORIZ})];return this.getAxisChartComponents(t)}}class QN extends se{constructor(t,n){super(t,n),this.model=new l$(this.services),this.model.setOptions(Ct(wt.heatmapChart,n.options)),this.init(t,n)}getAxisChartComponents(t,n){const i=this.model.getOptions(),r=E(i,"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 Ir(this.model,this.services)],growth:it.STRETCH},o={id:"toolbar",components:[new kr(this.model,this.services)],growth:it.PREFERRED},c={id:"header",components:[new ie(this.model,this.services,[a,...r?[o]:[]],{direction:Et.ROW,alignItems:hi.CENTER})],growth:it.PREFERRED},l={id:"legend",components:[new qg(this.model,this.services,{chartType:"heatmap"})],growth:it.PREFERRED,renderType:K.SVG},u={id:"graph-frame",components:t,growth:it.STRETCH,renderType:K.SVG},h=E(n,"legend","enabled")!==!1&&this.model.getOptions().legend.enabled!==!1,d=Et.COLUMN_REVERSE,f={id:"spacer",components:[new on(this.model,this.services,{size:15})],growth:it.PREFERRED},p={id:"full-frame",components:[new ie(this.model,this.services,[...h?[l]:[],...h?[f]:[],u],{direction:d})],growth:it.STRETCH},m=[];if(s||r){m.push(c);const g={id:"spacer",components:[new on(this.model,this.services,r?{size:15}:void 0)],growth:it.PREFERRED};m.push(g)}return m.push(p),[new Gg(this.model,this.services),new Ca(this.model,this.services),new ie(this.model,this.services,m,{direction:Et.COLUMN})]}getComponents(){const t=[new re(this.model,this.services),new Zk(this.model,this.services)];return this.getAxisChartComponents(t)}}class JN extends se{constructor(t,n){super(t,n),this.model=new c$(this.services),this.model.setOptions(Ct(wt.histogramChart,n.options)),this.init(t,n),this.update()}getComponents(){const t=[new re(this.model,this.services),new ue(this.model,this.services),new zk(this.model,this.services),new Kk(this.model,this.services)];return this.getAxisChartComponents(t)}}class tU extends se{constructor(t,n){super(t,n),this.model.setOptions(Ct(wt.lineChart,n.options)),this.init(t,n)}getComponents(){const t=[new re(this.model,this.services),new ue(this.model,this.services),new vn(this.model,this.services),new Mi(this.model,this.services),new Ue(this.model,this.services,{handleThresholds:!0}),new eR(this.model,this.services),new Ci(this.model,this.services)];return this.getAxisChartComponents(t)}}class eU extends se{constructor(t,n){super(t,n),this.model.setOptions(Ct(wt.lollipopChart,n.options)),this.init(t,n)}getComponents(){const t=[new re(this.model,this.services),new ue(this.model,this.services),new vn(this.model,this.services),new Qk(this.model,this.services),new Ue(this.model,this.services),new Jt(this.model,this.services,{skeleton:Pt.GRID})];return this.getAxisChartComponents(t)}}class nU extends Ae{constructor(t,n){var i;super(t,n),this.model=new u$(this.services);const r=(i=n.options.meter)!=null&&i.proportional?nt(nn(wt.proportionalMeterChart),n.options):nt(nn(wt.meterChart),n.options);this.model.setOptions(r),this.init(t,n)}getComponents(){const t=[...E(this.model.getOptions(),"meter","showLabels")?[{id:"meter-title",components:[new jk(this.model,this.services)],growth:it.STRETCH,renderType:K.SVG},{id:"spacer",components:[new on(this.model,this.services,{size:8})],growth:it.STRETCH}]:[],{id:"meter-graph",components:[new Jk(this.model,this.services)],growth:it.STRETCH,renderType:K.SVG}],n=[new ie(this.model,this.services,t,{direction:Et.COLUMN})];return this.getChartComponents(n,{graphFrameRenderType:K.HTML})}}class iU extends Ae{constructor(t,n){super(t,n),this.model=new h$(this.services),this.model.setOptions(Ct(wt.radarChart,n.options)),this.init(t,n)}getComponents(){const t=[new tR(this.model,this.services)];return this.getChartComponents(t)}}class rU extends se{constructor(t,n){super(t,n),this.model.setOptions(Ct(wt.scatterChart,n.options)),this.init(t,n)}getComponents(){const t=[new re(this.model,this.services),new ue(this.model,this.services),new vn(this.model,this.services),new Ue(this.model,this.services),new Jt(this.model,this.services,{skeleton:Pt.GRID})];return this.getAxisChartComponents(t)}}class sU extends Ae{constructor(t,n){super(t,n),this.model=new d$(this.services),this.model.setOptions(Ct(wt.treeChart,n.options)),this.init(t,n)}getComponents(){const t=[new nR(this.model,this.services)];return this.getChartComponents(t,{excludeLegend:!0})}}class aU extends Ae{constructor(t,n){super(t,n),this.model=new f$(this.services),this.model.setOptions(Ct(wt.treemapChart,n.options)),this.init(t,n)}getComponents(){const t=[new LP(this.model,this.services)];return this.getChartComponents(t)}}class oU extends se{constructor(t,n){super(t,n),this.model.setOptions(Ct(wt.simpleBarChart,n.options)),this.init(t,n)}getComponents(){const t=[new re(this.model,this.services),new ue(this.model,this.services),new Qg(this.model,this.services),new Ci(this.model,this.services),new Jt(this.model,this.services,{skeleton:Pt.VERT_OR_HORIZ})];return this.getAxisChartComponents(t)}}class lU extends se{constructor(t,n){super(t,n),this.model.setOptions(Ct(wt.stackedAreaChart,n.options)),this.init(t,n)}getComponents(){const t=[new re(this.model,this.services),new ue(this.model,this.services),new La(this.model,this.services),new Jg(this.model,this.services),new Mi(this.model,this.services,{stacked:!0}),new em(this.model,this.services,{fadeInOnChartHolderMouseover:!0,handleThresholds:!0,stacked:!0}),new Jt(this.model,this.services,{skeleton:Pt.GRID})];return this.getAxisChartComponents(t)}}class cU extends se{constructor(t,n){super(t,n),this.model.setOptions(Ct(wt.stackedBarChart,n.options)),this.init(t,n)}getComponents(){const t=[new re(this.model,this.services),new ue(this.model,this.services),new La(this.model,this.services),new tm(this.model,this.services),new Jt(this.model,this.services,{skeleton:Pt.VERT_OR_HORIZ}),new Ci(this.model,this.services)];return this.getAxisChartComponents(t)}}class uU extends Ae{constructor(t,n){super(t,n),this.model=new p$(this.services),this.model.setOptions(Ct(wt.wordCloudChart,n.options)),this.init(t,n)}getComponents(){const t=[new DP(this.model,this.services),new Jt(this.model,this.services,{skeleton:Pt.PIE})];return this.getChartComponents(t)}}function Mt(e,t){return ve.defineComponent({name:t,props:{data:{type:Object,required:!0},options:{type:Object,required:!0}},setup(n){const i=ve.ref(null),r=ve.ref(null),{data:s,options:a}=ve.toRefs(n);return ve.onMounted(()=>{r.value=new e(i.value,{data:s.value,options:a.value})}),ve.watch(s,o=>{var c;(c=r.value)==null||c.model.setData(o)},{immediate:!0}),ve.watch(a,o=>{var c;(c=r.value)==null||c.model.setOptions(o)}),{chart:r,chartDiv:i}},template:'<div ref="chartDiv"></div>'})}const Sm=Mt(VN,"CcvAlluvialChart"),Om=Mt(GN,"CcvAreaChart"),Tm=Mt(FN,"CcvBoxplotChart"),Mm=Mt(zN,"CcvBubbleChart"),Cm=Mt(jN,"CcvBulletChart"),Am=Mt(WN,"ExperimentalCcvChoroplethChart"),$m=Mt(qN,"CcvCirclePackChart"),Lm=Mt(YN,"CcvComboChart"),Dm=Mt(XN,"CcvDonutChart"),km=Mt(ZN,"CcvGaugeChart"),Rm=Mt(KN,"CcvGroupedBarChart"),Im=Mt(QN,"CcvHeatmapChart"),Pm=Mt(JN,"CcvHistogramChart"),Nm=Mt(tU,"CcvLineChart"),Um=Mt(eU,"CcvLollipopChart"),Bm=Mt(nU,"CcvMeterChart"),Hm=Mt(_m,"CcvPieChart"),Vm=Mt(iU,"CcvRadarChart"),Gm=Mt(rU,"CcvScatterChart"),Fm=Mt(oU,"CcvSimpleBarChart"),zm=Mt(lU,"CcvStackedAreaChart"),jm=Mt(cU,"CcvStackedBarChart"),Wm=Mt(sU,"CcvTreeChart"),qm=Mt(aU,"CcvTreemapChart"),Ym=Mt(uU,"CcvWordCloudChart"),hU=[Sm,Om,Tm,Mm,Cm,Am,$m,Lm,Dm,km,Rm,Im,Pm,Nm,Um,Bm,Hm,Vm,Gm,Fm,zm,jm,Wm,qm,Ym],dU={install(e,t){for(const n of hU)(!t||t.includes(n.name))&&e.component(n.name,n)}};rt.CcvAlluvialChart=Sm,rt.CcvAreaChart=Om,rt.CcvBoxplotChart=Tm,rt.CcvBubbleChart=Mm,rt.CcvBulletChart=Cm,rt.CcvCirclePackChart=$m,rt.CcvComboChart=Lm,rt.CcvDonutChart=Dm,rt.CcvGaugeChart=km,rt.CcvGroupedBarChart=Rm,rt.CcvHeatmapChart=Im,rt.CcvHistogramChart=Pm,rt.CcvLineChart=Nm,rt.CcvLollipopChart=Um,rt.CcvMeterChart=Bm,rt.CcvPieChart=Hm,rt.CcvRadarChart=Vm,rt.CcvScatterChart=Gm,rt.CcvSimpleBarChart=Fm,rt.CcvStackedAreaChart=zm,rt.CcvStackedBarChart=jm,rt.CcvTreeChart=Wm,rt.CcvTreemapChart=qm,rt.CcvWordCloudChart=Ym,rt.ExperimentalCcvChoroplethChart=Am,rt.default=dU,Object.defineProperties(rt,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
83
|
+
</svg>`}addEventListeners(){const t=this;this.parent.selectAll("circle.node").on("mouseover",function(n,i){const r=P(this);r.classed("hovered",!0);const s=t.model.getHierarchyLevel(),a=s>2&&!r.classed("focal"),o=E(t.model.getOptions(),"canvasZoom","enabled");let c=!1;if(!a){let l=[],u=[],h=null;if(i.children){i.depth>1&&o&&(c=!0,r.classed("clickable",!0)),l=i.children.map(p=>{if(p!==null)return typeof p.data.value=="number"?{label:p.data.name,value:p.data.value}:{label:p.data.name,labelIcon:o&&s<=2?t.getZoomIcon():null,value:p.value}});const f=t.model.getOptions();u=[{label:St(f,"tooltip.totalLabel")||"Total",value:i.value,bold:!0}],t.highlightChildren(i.children)}else h=i.value;const d=getComputedStyle(this,null).getPropertyValue("fill");t.services.events.dispatchEvent(C.Tooltip.SHOW,{event:n,hoveredElement:r,items:[{color:d,label:i.data.name,labelIcon:c&&o&&s<=2?t.getZoomIcon():null,value:h},...l,...u]})}t.services.events.dispatchEvent(C.CirclePack.CIRCLE_MOUSEOVER,{event:n,element:r,datum:i})}).on("mousemove",function(n,i){const r=P(this);t.services.events.dispatchEvent(C.CirclePack.CIRCLE_MOUSEMOVE,{event:n,element:r,datum:i}),t.services.events.dispatchEvent(C.Tooltip.MOVE,{event:n})}).on("mouseout",function(n,i){const r=P(this);r.classed("hovered",!1),i.children&&t.unhighlightChildren(i.children),t.services.events.dispatchEvent(C.CirclePack.CIRCLE_MOUSEOUT,{event:n,element:r,datum:i}),t.services.events.dispatchEvent(C.Tooltip.HIDE,{hoveredElement:r})}).on("click",function(n,i){const r=P(this),s=r.classed("non-focal"),a=E(t.model.getOptions(),"canvasZoom","enabled");if(a&&t.model.getHierarchyLevel()>2){const o=t.parent.selectAll("circle.node");P(t.services.domUtils.getMainContainer()).classed("zoomed-in",!1),t.focal=null,t.model.updateHierarchyLevel(2),t.services.canvasZoom.zoomOut(o,gi)}else if(i.depth===2&&i.children&&!s&&a){const o=t.parent.selectAll("circle.node");P(t.services.domUtils.getMainContainer()).classed("zoomed-in",!0),t.focal=i,t.model.updateHierarchyLevel(3),t.services.canvasZoom.zoomIn(i,o,gi),n.stopPropagation()}t.services.events.dispatchEvent(C.CirclePack.CIRCLE_CLICK,{event:n,element:r,datum:i})})}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(C.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(C.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut),this.removeBackgroundListeners()}}function qk(e,t){const n=Pi(this._current,e);return i=>(this._current=n(i),t(this._current))}class Yg extends ht{constructor(){super(...arguments),this.type="pie",this.renderType=K.SVG,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail,{groupMapsTo:i}=this.getOptions().data;this.parent.selectAll("path.slice").transition("legend-hover-bar").call(r=>this.services.transitions.setupTransition({transition:r,name:"legend-hover-bar"})).attr("opacity",r=>r.data[i]!==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(C.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(C.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}getInnerRadius(){return _t.innerRadius}render(t=!0){const n=this,i=this.getComponentContainer(),r=this.getOptions(),{groupMapsTo:s}=r.data,{valueMapsTo:a}=r.pie,o=this.model.getDisplayData().filter(S=>S[a]>0),c=this.computeRadius();this.arc=or().innerRadius(this.getInnerRadius()).outerRadius(c),this.hoverArc=or().innerRadius(this.getInnerRadius()).outerRadius(c+_t.hoverArc.outerRadiusOffset);const l=WE().value(S=>S[a]).sort(E(r,"pie","sortFunction")).padAngle(_t.padAngle)(o),u=R.appendOrSelect(i,"g.slices").attr("role",at.GROUP).attr("data-name","slices").selectAll("path.slice").data(l,S=>S.data[s]);u.exit().attr("opacity",0).remove(),u.enter().append("path").classed("slice",!0).attr("opacity",0).merge(u).attr("class",S=>this.model.getColorClassName({classNameTypes:[J.FILL],dataGroupName:S.data[s],originalClassName:"slice"})).style("fill",S=>n.model.getFillColor(S.data[s])).attr("d",this.arc).transition().call(S=>this.services.transitions.setupTransition({transition:S,name:"pie_slice_enter_update",animate:t})).attr("opacity",1).attr("role",at.GRAPHICS_SYMBOL).attr("aria-roledescription","slice").attr("aria-label",S=>`${S[a]}, ${Mp(S.data[a],o,a)+"%"}`).attrTween("d",function(S){return qk.bind(this)(S,n.arc)});const h=r.pie.labels.enabled,d=h?l.filter(S=>S.data[a]>0):[],f=R.appendOrSelect(i,"g.labels").attr("role",at.GROUP).attr("data-name","labels").selectAll("text.pie-label").data(d,S=>S.data[s]);f.exit().attr("opacity",0).remove();const p=f.enter().append("text").classed("pie-label",!0),m=[];p.merge(f).style("text-anchor","middle").text(S=>r.pie.labels.formatter?r.pie.labels.formatter(S):Mp(S.data[a],o,a)+"%").datum(function(S){const $=c+7,D=(S.endAngle-S.startAngle)/2+S.startAngle,L=D/Math.PI*180,M=this.getComputedTextLength();return S.textOffsetX=M/2,S.textOffsetY=L>90&&L<270?10:0,S.xPosition=(S.textOffsetX+$)*Math.sin(D),S.yPosition=(S.textOffsetY+$)*-Math.cos(D),S}).attr("transform",function(S,$){const D=d.length,L=(S.endAngle-S.startAngle)*(180/Math.PI);if($>=D-2&&L<_t.callout.minSliceDegree){let M,B;return S.index===D-1?(M=S.xPosition+_t.callout.offsetX+_t.callout.textMargin+S.textOffsetX,B=S.yPosition-_t.callout.offsetY,S.direction=zs.RIGHT,m.push(S)):(M=S.xPosition-_t.callout.offsetX-S.textOffsetX-_t.callout.textMargin,B=S.yPosition-_t.callout.offsetY,S.direction=zs.LEFT,m.push(S)),`translate(${M}, ${B})`}return`translate(${S.xPosition}, ${S.yPosition})`}),this.renderCallouts(m);const g=E(r,"donut")?"donut":"pie",v=E(r,g,"alignment"),{width:b}=R.getSVGElementSize(this.getParent(),{useAttrs:!0}),w=h?_t.xOffset:0,O=h?_t.yOffset:0;let _=c+w;v===It.CENTER?_=b/2:v===It.RIGHT&&(_=b-c-_t.xOffset);let T=c+O;m.length>0&&(T+=_t.yOffsetCallout),i.attr("x",_+7).attr("y",T),this.addEventListeners()}renderCallouts(t){const n=R.appendOrSelect(this.getComponentContainer(),"g.callouts").attr("role",at.GROUP).attr("data-name","callouts"),i=n.selectAll("g.callout").data(t);i.exit().remove();const r=i.enter().append("g").classed("callout",!0).attr("role",at.GROUP).attr("aria-roledescription","label callout");r.merge(i).datum(function(s){const{xPosition:a,yPosition:o,direction:c}=s;return c===zs.RIGHT?(s.startPos={x:a,y:o+s.textOffsetY},s.endPos={x:a+_t.callout.offsetX,y:o-_t.callout.offsetY+s.textOffsetY},s.intersectPointX=s.endPos.x-_t.callout.horizontalLineLength):(s.startPos={x:a,y:o+s.textOffsetY},s.endPos={x:a-_t.callout.offsetX,y:o-_t.callout.offsetY+s.textOffsetY},s.intersectPointX=s.endPos.x+_t.callout.horizontalLineLength),s}),r.append("line").classed("vertical-line",!0).merge(n.selectAll("line.vertical-line")).datum(function(){return P(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),r.append("line").classed("horizontal-line",!0).merge(n.selectAll("line.horizontal-line")).datum(function(){return P(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,i){const r=P(this);r.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(C.Pie.SLICE_MOUSEOVER,{event:n,element:P(this),datum:i});const{groupMapsTo:s}=t.getOptions().data,{valueMapsTo:a}=t.getOptions().pie;t.services.events.dispatchEvent(C.Tooltip.SHOW,{event:n,hoveredElement:r,items:[{label:i.data[s],value:i.data[a]}]})}).on("mousemove",function(n,i){const r=P(this);t.services.events.dispatchEvent(C.Pie.SLICE_MOUSEMOVE,{event:n,element:r,datum:i}),t.services.events.dispatchEvent(C.Tooltip.MOVE,{event:n})}).on("click",function(n,i){t.services.events.dispatchEvent(C.Pie.SLICE_CLICK,{event:n,element:P(this),datum:i})}).on("mouseout",function(n,i){const r=P(this);r.classed("hovered",!1).transition("pie_slice_mouseout").call(s=>t.services.transitions.setupTransition({transition:s,name:"pie_slice_mouseout"})).attr("d",t.arc),t.services.events.dispatchEvent(C.Pie.SLICE_MOUSEOUT,{event:n,element:r,datum:i}),t.services.events.dispatchEvent(C.Tooltip.HIDE,{hoveredElement:r})})}computeRadius(){const{width:t,height:n}=R.getSVGElementSize(this.parent,{useAttrs:!0}),i=this.getOptions(),r=Math.min(t,n)/2;return i.pie.labels.enabled?r+_t.radiusOffset:r}}class Yk extends Yg{constructor(){super(...arguments),this.type="donut",this.renderType=K.SVG}render(t=!0){super.render(t);const n=this;if(this.model.isDataEmpty()){this.getComponentContainer().select("g.center").remove();return}const i=R.appendOrSelect(this.getComponentContainer(),"g.center"),r=this.getOptions(),s=this.computeRadius(),a=E(r,"donut","center","label");R.appendOrSelect(i,"text.donut-figure").attr("text-anchor","middle").style("dominant-baseline",()=>a===null||a===""?"central":"initial").style("font-size",()=>r.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(P(this))}),a!==null&&a!==""&&R.appendOrSelect(i,"text.donut-title").attr("text-anchor","middle").style("font-size",()=>r.donut.center.titleFontSize(s)).attr("y",r.donut.center.titleYPosition(s)).text(a)}getInnerRadius(){return this.computeRadius()*(3/4)}centerNumberTween(t){const n=this.getOptions();let i=E(n,"donut","center","number");i===null&&(i=this.model.getDisplayData().reduce((o,c)=>o+c[n.pie.valueMapsTo],0));const r=parseInt(t.text().replace(/[, ]+/g,""),10)||0;let s;r%1===0&&i%1===0?s=su:s=oe;const a=s(r,i);return o=>{const{numberFormatter:c}=n.donut.center;t.text(c(a(o)))}}}const Xg="4,10 8,6 12,10",Zg="12,6 8,10 4,6";class Xk extends ht{constructor(){super(...arguments),this.type="gauge",this.renderType=K.SVG}getValue(){var t;return((t=this.model.getData().find(n=>n.group==="value"))==null?void 0:t.value)??null}getValueRatio(){return _g(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 E(t,"gauge","type")===di.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(E(n,"gauge","deltaArrow","direction")){case dl.UP:return Xg;case dl.DOWN:return Zg;default:return t>0?Xg:Zg}}render(t=!0){const n=this.getComponentContainer().attr("width","100%").attr("height","100%"),i=this.getOptions(),r=this.getValue(),s=this.getValueRatio(),a=this.getArcSize(),o=this.getStartAngle(),c=s*a,l=o+c,u=o+a,h=this.computeRadius(),d=this.getInnerRadius();this.backgroundArc=or().innerRadius(d).outerRadius(h).startAngle(l).endAngle(u),this.arc=or().innerRadius(d).outerRadius(h).startAngle(o).endAngle(l),R.appendOrSelect(n,"path.arc-background").attr("d",this.backgroundArc);const f=n.selectAll("path.arc-foreground").data([r]);f.enter().append("path").merge(f).attr("class",this.model.getColorClassName({classNameTypes:[J.FILL],dataGroupName:"value",originalClassName:"arc-foreground"})).style("fill",()=>E(this.getOptions(),"color","scale","value")).attr("d",this.arc).attr("role",at.GRAPHICS_SYMBOL).attr("aria-roledescription","value").attr("aria-label",v=>v),this.drawValueNumber(),this.drawDelta(),f.exit().remove();const p=E(i,"gauge","alignment"),{width:m}=R.getSVGElementSize(this.getParent(),{useAttrs:!0});let g=h;p===It.CENTER?g=m/2:p===It.RIGHT&&(g=m-h),n.attr("x",g).attr("y",h),this.addEventListeners()}drawValueNumber(){const t=this.getComponentContainer(),n=this.getOptions(),i=E(n,"gauge","type"),r=this.getValue(),s=this.getDelta(),a=this.computeRadius(),o=E(n,"gauge","valueFontSize"),c=E(n,"gauge","deltaFontSize"),l=E(n,"gauge","numberSpacing"),u=E(n,"gauge","showPercentageSymbol");let h=0;i===di.FULL&&!s?h=c(a):i===di.SEMI&&s&&(h=-(c(a)+l));const d=R.appendOrSelect(t,"g.gauge-numbers").attr("transform",`translate(0, ${h})`),f=o(a),p=R.appendOrSelect(d,"g.gauge-value-number"),m=E(n,"gauge","numberFormatter"),g=p.selectAll("text.gauge-value-number").data([r]);g.enter().append("text").attr("class","gauge-value-number").merge(g).style("font-size",`${f}px`).attr("text-anchor","middle").text(S=>m(S));const{width:v}=R.getSVGElementSize(R.appendOrSelect(t,"text.gauge-value-number"),{useBBox:!0}),b=f/2,w=u?"%":"",O=R.appendOrSelect(p,"text.gauge-value-symbol").style("font-size",`${b}px`).attr("x",v/2).text(w),{width:_,height:T}=R.getSVGElementSize(O,{useBBox:!0});O.attr("y",`-${T/2}px`),p.attr("transform",`translate(-${_/2}, 0)`)}drawDelta(){const t=this,n=this.getComponentContainer(),i=this.getOptions(),r=this.getDelta();if(r){const s=this.computeRadius(),a=r?E(i,"gauge","deltaFontSize"):()=>0,o=r?E(i,"gauge","numberFormatter"):()=>null,c=E(i,"gauge","deltaArrow","size"),l=E(i,"gauge","numberSpacing"),u=E(i,"gauge","showPercentageSymbol"),h=R.appendOrSelect(n,"g.gauge-numbers"),d=R.appendOrSelect(h,"g.gauge-delta").attr("transform",`translate(0, ${a(s)+l})`),f=R.appendOrSelect(d,"text.gauge-delta-number"),p=u?"%":"";f.data(r===null?[]:[r]),f.enter().append("text").classed("gauge-delta-number",!0).merge(f).attr("text-anchor","middle").style("font-size",`${a(s)}px`).text(b=>`${o(b)}${p}`);const{width:m}=R.getSVGElementSize(R.appendOrSelect(n,".gauge-delta-number"),{useBBox:!0}),g=E(i,"gauge","deltaArrow","enabled"),v=d.selectAll("svg.gauge-delta-arrow").data(r!==null&&g?[r]:[]);v.enter().append("svg").merge(v).attr("class","gauge-delta-arrow").attr("x",-c(s)-m/2).attr("y",-c(s)/2-a(s)*.35).attr("width",c(s)).attr("height",c(s)).attr("viewBox","0 0 16 16").each(function(){const b=P(this);R.appendOrSelect(b,"rect.gauge-delta-arrow-backdrop").attr("width","16").attr("height","16").attr("fill","none");const w=E(i,"gauge","status");R.appendOrSelect(b,"polygon.gauge-delta-arrow").attr("class",w!==null?`gauge-delta-arrow status--${w}`:"").attr("points",t.getArrow(r))}),v.exit().remove(),f.exit().remove()}else{const s=n.select("g.gauge-delta");s.empty()||s.remove()}}getInnerRadius(){const t=this.computeRadius(),n=E(this.getOptions(),"gauge","arcWidth");return t-n}addEventListeners(){const t=this;this.parent.selectAll("path.arc-foreground").on("mouseover",function(n,i){t.services.events.dispatchEvent(C.Gauge.ARC_MOUSEOVER,{event:n,element:P(this),datum:i})}).on("mousemove",function(n,i){const r=P(this);t.services.events.dispatchEvent(C.Gauge.ARC_MOUSEMOVE,{event:n,element:r,datum:i})}).on("click",function(n,i){t.services.events.dispatchEvent(C.Gauge.ARC_CLICK,{event:n,element:P(this),datum:i})}).on("mouseout",function(n,i){const r=P(this);t.services.events.dispatchEvent(C.Gauge.ARC_MOUSEOUT,{event:n,element:r,datum:i})})}computeRadius(){const t=this.getOptions(),n=E(t,"gauge","type"),{width:i,height:r}=R.getSVGElementSize(this.parent,{useAttrs:!0});return n===di.SEMI?Math.min(i/2,r):Math.min(i/2,r/2)}}class Kg extends vc{constructor(){super(...arguments),this.type="grouped-bar",this.renderType=K.SVG,this.padding=5,this.defaultStepFactor=70,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail,{groupMapsTo:i}=this.getOptions().data;this.parent.selectAll("path.bar").transition("legend-hover-bar").call(r=>this.services.transitions.setupTransition({transition:r,name:"legend-hover-bar"})).attr("opacity",r=>r[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(C.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(C.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t){const n=this.model.getDisplayData(this.configs.groups),i=this.getOptions(),{groupMapsTo:r}=i.data;this.setGroupScale();const s=this.getComponentContainer({withinChartClip:!0}),a=Tr(n.map(u=>{const h=this.services.cartesianScales.getDomainIdentifier(u);return u[h]&&typeof u[h].toString=="function"?u[h].toString():u[h]})),o=s.selectAll("g.bars").data(a,u=>u);o.exit().attr("opacity",0).remove();const c=o.enter().append("g").classed("bars",!0).attr("role",at.GROUP).attr("data-name","bars").merge(o);c.transition().call(u=>this.services.transitions.setupTransition({transition:u,name:"bar-group-update-enter",animate:t})).attr("transform",u=>{const h=this.services.cartesianScales.getDomainValue(u)-this.getGroupWidth()/2;return this.services.cartesianScales.getOrientation()===Ht.VERTICAL?`translate(${h}, 0)`:`translate(0, ${h})`});const l=c.selectAll("path.bar").data(u=>this.getDataCorrespondingToLabel(u),u=>u[r]);l.exit().attr("opacity",0).remove(),l.enter().append("path").attr("opacity",0).merge(l).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:[J.FILL],dataGroupName:u[r],originalClassName:"bar"})).style("fill",u=>this.model.getFillColor(u[r])).attr("d",u=>{const h=this.groupScale(u[r]),d=this.getBarWidth(),f=h,p=h+d,m=this.services.cartesianScales.getRangeAxisPosition({datum:u}),g=this.services.cartesianScales.getValueThroughAxisPosition(m,0),v=this.services.cartesianScales.getRangeValue(u),b=this.services.cartesianScales.getDomainValue(u)-d/2,w=b+d;if(!this.isOutsideZoomedDomain(b,w))return Qt({x0:f,x1:p,y0:g,y1:v},this.services.cartesianScales.getOrientation())}).attr("opacity",1).attr("role",at.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,i){const r=P(this);r.classed("hovered",!0),t.services.events.dispatchEvent(C.Bar.BAR_MOUSEOVER,{event:n,element:r,datum:i}),t.services.events.dispatchEvent(C.Tooltip.SHOW,{event:n,hoveredElement:r,data:[i]})}).on("mousemove",function(n,i){const r=P(this);t.services.events.dispatchEvent(C.Bar.BAR_MOUSEMOVE,{event:n,element:r,datum:i}),t.services.events.dispatchEvent(C.Tooltip.MOVE,{event:n})}).on("click",function(n,i){t.services.events.dispatchEvent(C.Bar.BAR_CLICK,{event:n,element:P(this),datum:i})}).on("mouseout",function(n,i){const r=P(this);r.classed("hovered",!1),t.services.events.dispatchEvent(C.Bar.BAR_MOUSEOUT,{event:n,element:r,datum:i}),t.services.events.dispatchEvent(C.Tooltip.HIDE,{hoveredElement:r})})}destroy(){this.parent.selectAll("path.bar").on("mouseover",null).on("mousemove",null).on("mouseout",null);const t=this.services.events;t.removeEventListener(C.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(C.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}getDataCorrespondingToLabel(t){return this.model.getDisplayData(this.configs.groups).filter(n=>{const i=this.services.cartesianScales.getDomainIdentifier(n);return n[i].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 i=this.defaultStepFactor;if(typeof t.step=="function")i=t.step();else if(n.length>0){const r=n.find(s=>{var a;return((a=s.data)==null?void 0:a.length)>1});if(r){const s=this.services.cartesianScales.getDomainIdentifier(r.data[0]);i=Math.abs(t(r.data[1][s])-t(r.data[0][s]))}}return i}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=E(t,"bars","width"),i=E(t,"bars","maxWidth");if(n!==null&&(i===null||n<=i))return n;const r=this.model.getGroupedData(this.configs.groups).length,s=this.getTotalGroupPadding();return Math.min(i,(this.getDomainScaleStep()-s)/r)}setGroupScale(){const t=this.model.getActiveDataGroupNames(this.configs.groups);this.groupScale=er().domain(t).rangeRound([0,this.getGroupWidth()])}}class Zk extends ht{constructor(){super(...arguments),this.type="heatmap",this.renderType=K.SVG,this.matrix={},this.xBandwidth=0,this.yBandwidth=0,this.translationUnits={x:0,y:0},this.handleAxisOnHover=t=>{const{detail:n}=t,{datum:i}=n,r=this.model.getUniqueRanges(),s=this.model.getUniqueDomain(),a=this.services.cartesianScales.getDomainLabel(),o=this.services.cartesianScales.getRangeLabel(),c=this.services.cartesianScales.getMainXScale(),l=this.services.cartesianScales.getMainYScale();let u="",h=null,d=null,f=null;this.matrix[i]!==void 0?(u=a,r.forEach(p=>{if(typeof this.matrix[i][p].value=="number"){const m=this.matrix[i][p].value;if(h===null){h=m,d=m,f=m;return}h+=m,d=m<d?m:d,f=m>f?m:f}})):(u=o,s.forEach(p=>{if(typeof this.matrix[p][i].value=="number"){const m=this.matrix[p][i].value;if(h===null){h=m,d=m,f=m;return}h+=m,d=m<d?m:d,f=m>f?m:f}})),c(i)!==void 0?this.parent.select("g.multi-cell.column-highlight").classed("highlighter-hidden",!1).attr("transform",`translate(${c(i)}, ${ln(l.range())})`):l(i)!==void 0&&this.parent.select("g.multi-cell.row-highlight").classed("highlighter-hidden",!1).attr("transform",`translate(${ln(c.range())},${l(i)})`),this.services.events.dispatchEvent(C.Tooltip.SHOW,{event:n.event,hoveredElement:P(t.detail.element),items:[{label:u,value:i,bold:!0},{label:"Min",value:d!==null?d:"-"},{label:"Max",value:f!==null?f:"-"},{label:"Average",value:h!==null?h/s.length:"-"}]})},this.handleAxisMouseOut=t=>{this.parent.selectAll("g.multi-cell").classed("highlighter-hidden",!0),this.services.events.dispatchEvent(C.Tooltip.HIDE,{event:t})}}init(){const t=this.services.events;t.addEventListener(C.Axis.LABEL_MOUSEOVER,this.handleAxisOnHover),t.addEventListener(C.Axis.LABEL_MOUSEOUT,this.handleAxisMouseOut),t.addEventListener(C.Axis.LABEL_FOCUS,this.handleAxisOnHover),t.addEventListener(C.Axis.LABEL_BLUR,this.handleAxisMouseOut)}render(t=!0){const n=this.getComponentContainer({withinChartClip:!0});n.lower();const{cartesianScales:i}=this.services;if(this.matrix=this.model.getMatrix(),n.html(""),E(this.getOptions(),"data","loading"))return;const r=i.getMainXScale(),s=i.getMainYScale(),a=i.getDomainIdentifier(),o=i.getRangeIdentifier(),c=this.model.getUniqueDomain(),l=this.model.getUniqueRanges(),u=this.model.getMatrixAsArray(),h=r.range(),d=s.range();this.xBandwidth=Math.abs((h[1]-h[0])/c.length),this.yBandwidth=Math.abs((d[1]-d[0])/l.length);const f=this.services.domUtils.generateElementIDString("heatmap-pattern-stripes");n.append("defs").append("pattern").attr("id",f).attr("width",3).attr("height",3).attr("patternUnits","userSpaceOnUse").attr("patternTransform","rotate(45)").append("rect").classed("pattern-fill",!0).attr("width",.5).attr("height",8);const p=n.selectAll().data(u).enter().append("g").attr("class",m=>`heat-${m.index}`).classed("cell",!0).attr("transform",m=>`translate(${r(m[a])}, ${s(m[o])})`).append("rect").attr("class",m=>this.model.getColorClassName({value:m.value,originalClassName:`heat-${m.index}`})).classed("heat",!0).classed("null-state",m=>m.index===-1||m.value===null).attr("width",this.xBandwidth).attr("height",this.yBandwidth).style("fill",m=>m.index===-1||m.value===null?`url(#${f})`:this.model.getFillColor(Number(m.value))).attr("aria-label",m=>m.value);this.createOuterBox("g.cell-highlight",this.xBandwidth,this.yBandwidth),this.createOuterBox("g.multi-cell.column-highlight",this.xBandwidth,Math.abs(d[1]-d[0])),this.createOuterBox("g.multi-cell.row-highlight",Math.abs(h[1]-h[0]),this.yBandwidth),this.determineDividerStatus()&&(p.style("stroke-width","1px"),this.parent.select("g.cell-highlight").classed("cell-2",!0)),this.addEventListener()}createOuterBox(t,n,i){const r=R.appendOrSelect(this.parent,t).classed("shadows",!0).classed("highlighter-hidden",!0);R.appendOrSelect(r,"line.top").attr("x1",-1).attr("x2",n+1),R.appendOrSelect(r,"line.left").attr("x1",0).attr("y1",-1).attr("x2",0).attr("y2",i+1),R.appendOrSelect(r,"line.down").attr("x1",-1).attr("x2",n+1).attr("y1",i).attr("y2",i),R.appendOrSelect(r,"line.right").attr("x1",n).attr("x2",n).attr("y1",-1).attr("y2",i+1)}determineDividerStatus(){const t=E(this.getOptions(),"heatmap","divider","state");return t!==fr.OFF&&(t===fr.AUTO&&gf.minCellDividerDimension<=this.xBandwidth&&gf.minCellDividerDimension<=this.yBandwidth||t===fr.ON)}addEventListener(){const t=this,{cartesianScales:n}=this.services,i=this.getOptions(),r=St(i,"tooltip.totalLabel"),s=n.getDomainIdentifier(),a=n.getRangeIdentifier(),o=n.getDomainLabel(),c=n.getRangeLabel();this.parent.selectAll("g.cell").on("mouseover",function(l,u){const h=P(this),d=h.select("rect.heat");if(!d.classed("null-state")){const f=Mr(h.attr("transform"));t.parent.select("g.cell-highlight").attr("transform",`translate(${f.x+t.translationUnits.x}, ${f.y+t.translationUnits.y})`).classed("highlighter-hidden",!1),t.services.events.dispatchEvent(C.Heatmap.HEATMAP_MOUSEOVER,{event:l,element:d,datum:u}),t.services.events.dispatchEvent(C.Tooltip.SHOW,{event:l,items:[{label:o,value:u[s]},{label:c,value:u[a]},{label:r||"Total",value:u.value,color:d.style("fill")}]})}}).on("mousemove",function(l,u){t.services.events.dispatchEvent(C.Heatmap.HEATMAP_MOUSEMOVE,{event:l,element:P(this),datum:u}),t.services.events.dispatchEvent(C.Tooltip.MOVE,{event:l})}).on("click",function(l,u){t.services.events.dispatchEvent(C.Heatmap.HEATMAP_CLICK,{event:l,element:P(this),datum:u})}).on("mouseout",function(l,u){const h=P(this).select("rect.heat"),d=h.classed("null-state");t.parent.select("g.cell-highlight").classed("highlighter-hidden",!0),d||(t.services.events.dispatchEvent(C.Heatmap.HEATMAP_MOUSEOUT,{event:l,element:h,datum:u}),t.services.events.dispatchEvent(C.Tooltip.HIDE,{event:l,hoveredElement:h}))})}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(C.Legend.ITEM_HOVER,this.handleAxisOnHover),t.removeEventListener(C.Legend.ITEM_MOUSEOUT,this.handleAxisMouseOut)}}class Kk extends ht{constructor(){super(...arguments),this.type="histogram",this.renderType=K.SVG,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail,i=this.getOptions(),{groupMapsTo:r}=i.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[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(C.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(C.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t){const n=this.getComponentContainer(),i=this.model.getOptions(),{groupIdentifier:r}=i,{groupMapsTo:s}=i.data,a=this.model.getBinnedStackedData(),o=this.services.cartesianScales.getMainXScale(),c=n.selectAll("g.bars").data(a,u=>St(u,`0.${s}`));c.exit().attr("opacity",0).remove(),c.enter().append("g").classed("bars",!0).attr("role",at.GROUP);const l=n.selectAll("g.bars").selectAll("path.bar").data(u=>u);l.exit().remove(),l.enter().append("path").merge(l).classed("bar",!0).attr(r,(u,h)=>h).transition().call(u=>this.services.transitions.setupTransition({transition:u,name:"histogram-bar-update-enter",animate:t})).attr("class",u=>this.model.getColorClassName({classNameTypes:[J.FILL],dataGroupName:u[s],originalClassName:"bar"})).style("fill",u=>this.model.getFillColor(u[s])).attr("d",u=>{const h=St(u,"data");if(!h)return;const d=o(h.x1)-o(h.x0)-1,f=this.services.cartesianScales.getDomainValue(h.x0),p=f+d,m=this.services.cartesianScales.getRangeValue(u[0]);let g=this.services.cartesianScales.getRangeValue(u[1]);return Math.abs(g-m)>0&&Math.abs(g-m)>i.bars.dividerSize&&(this.services.cartesianScales.getOrientation()===Ht.VERTICAL?g+=1:g-=1),Qt({x0:f,x1:p,y0:m,y1:g},this.services.cartesianScales.getOrientation())}).attr("opacity",1).attr("role",at.GRAPHICS_SYMBOL).attr("aria-roledescription","bar").attr("aria-label",u=>E(u,"data",u[s])),this.addEventListeners()}addEventListeners(){const t=this.model.getOptions(),{groupMapsTo:n}=t.data,i=this;this.parent.selectAll("path.bar").on("mouseover",function(r,s){const a=P(this);a.classed("hovered",!0);const o=parseFloat(St(s,"data.x0")),c=parseFloat(St(s,"data.x1")),l=i.services.cartesianScales.getRangeAxisPosition(),u=i.services.cartesianScales.getScaleLabel(l);i.services.events.dispatchEvent(C.Tooltip.SHOW,{event:r,hoveredElement:a,items:[{label:St(t,"bins.rangeLabel")||"Range",value:`${o} – ${c}`},{label:t.tooltip.groupLabel||"Group",value:s[n],class:i.model.getColorClassName({classNameTypes:[J.TOOLTIP],dataGroupName:s[n]})},{label:u,value:St(s,`data.${s[n]}`)}]})}).on("mousemove",function(r){i.services.events.dispatchEvent(C.Tooltip.MOVE,{event:r})}).on("mouseout",function(){P(this).classed("hovered",!1),i.services.events.dispatchEvent(C.Tooltip.HIDE)})}destroy(){this.parent.selectAll("path.bar").on("mouseover",null).on("mousemove",null).on("mouseout",null);const t=this.services.events;t.removeEventListener(C.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(C.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}}class Qk extends Ue{constructor(){super(...arguments),this.type="lollipop",this.renderType=K.SVG,this.handleScatterOnHover=t=>{const n=t.detail,i=this.getOptions(),{groupMapsTo:r}=i.data;this.parent.selectAll("line.line").attr("stroke-width",s=>s[r]!==n.datum[r]?Je.weight.unselected:Je.weight.selected)},this.handleScatterOnMouseOut=()=>{this.parent.selectAll("line.line").attr("stroke-width",Je.weight.unselected)},this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail,i=this.getOptions(),{groupMapsTo:r}=i.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[r]!==n.datum().name?Je.opacity.unselected:Je.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",Je.opacity.selected)}}init(){const{events:t}=this.services;t.addEventListener(C.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(C.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t){const n=this.getComponentContainer({withinChartClip:!0}),i=this.model.getOptions(),{groupMapsTo:r}=i.data,{cartesianScales:s}=this.services,a=s.getMainXScale(),o=s.getMainYScale(),c=s.getDomainIdentifier(),l=g=>s.getDomainValue(g),u=g=>s.getRangeValue(g),h=s.getOrientation(),[d,f]=sn(l,u,h),p=n.selectAll("line.line").data(this.getScatterData(),g=>`${g[r]}-${g[c]}`);p.exit().attr("opacity",0).remove();const m=p.enter().append("line").attr("opacity",0).merge(p).classed("line",!0).attr("class",g=>this.model.getColorClassName({classNameTypes:[J.STROKE],dataGroupName:g[r],originalClassName:"line"})).transition().call(g=>this.services.transitions.setupTransition({transition:g,name:"lollipop-line-update-enter",animate:t})).style("stroke",g=>this.model.getFillColor(g[r],g[c],g)).attr("opacity",1);h===Ht.HORIZONTAL?m.attr("y1",f).attr("y2",f).attr("x1",a.range()[0]).attr("x2",g=>d(g)-i.points.radius):m.attr("x1",d).attr("x2",d).attr("y1",o.range()[0]).attr("y2",g=>f(g)+i.points.radius),this.addScatterPointEventListeners()}addScatterPointEventListeners(){this.services.events.addEventListener(C.Scatter.SCATTER_MOUSEOVER,this.handleScatterOnHover),this.services.events.addEventListener(C.Scatter.SCATTER_MOUSEOUT,this.handleScatterOnMouseOut)}destroy(){const t=this.services.events;t.removeEventListener(C.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(C.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut),t.removeEventListener(C.Scatter.SCATTER_MOUSEOVER,this.handleScatterOnHover),t.removeEventListener(C.Scatter.SCATTER_MOUSEOUT,this.handleScatterOnMouseOut)}}class Jk extends ht{constructor(){super(...arguments),this.type="meter",this.renderType=K.SVG}getStackedBounds(t,n){let i=0;return t.map((r,s)=>s!==0?(i+=n(r.value),{...r,width:Math.abs(n(r.value)-Gt.dividerWidth),x:i-n(r.value)}):(i=n(r.value),{...r,width:Math.abs(n(r.value)-Gt.dividerWidth),x:0}))}render(t=!0){const n=this,i=this.getComponentContainer(),r=this.getOptions(),s=E(r,"meter","proportional"),a=this.model.getDisplayData(),o=this.model.getStatus(),{width:c}=R.getSVGElementSize(i,{useAttrs:!0}),{groupMapsTo:l}=r.data;let u;E(r,"meter","proportional")===null?u=100:u=E(r,"meter","proportional","total")||this.model.getMaximumDomain(this.model.getDisplayData());const h=_e().domain([0,u]).range([0,c]),d=this.getStackedBounds(a,h),f=E(r,"meter","height");R.appendOrSelect(i,"rect.container").attr("x",0).attr("y",0).attr("width",c).attr("height",f||(s?Gt.height.proportional:Gt.height.default)),R.appendOrSelect(i,"line.rangeIndicator").attr("x1",c).attr("x2",c).attr("y1",0).attr("y2",f||(s?Gt.height.proportional:Gt.height.default));const p=i.selectAll("rect.value").data(d),m=o!=null&&!n.model.isUserProvidedColorScaleValid()&&!s?`value status--${o}`:"value";p.enter().append("rect").classed("value",!0).merge(p).attr("x",w=>w.x).attr("y",0).attr("height",()=>f||(s?Gt.height.proportional:Gt.height.default)).attr("class",w=>this.model.getColorClassName({classNameTypes:[J.FILL],dataGroupName:w[l],originalClassName:m})).transition().call(w=>this.services.transitions.setupTransition({transition:w,name:"meter-bar-update",animate:t})).attr("width",w=>w.value>u?h(u):w.width).style("fill",w=>n.model.getFillColor(w[l])).attr("role",at.GRAPHICS_SYMBOL).attr("aria-roledescription","value").attr("aria-label",w=>w.value),p.exit().remove();const g=E(r,"meter","peak");let v=g;g!==null&&(g>u?v=u:g<a[0].value&&(v=a[0].value>u?u:a[0].value));const b=i.selectAll("line.peak").data(v==null?[]:[v]);b.enter().append("line").classed("peak",!0).merge(b).attr("y1",0).attr("y2",()=>f||(s?Gt.height.proportional:Gt.height.default)).transition().call(w=>this.services.transitions.setupTransition({transition:w,name:"peak-line-update",animate:t})).attr("x1",w=>h(w)).attr("x2",w=>h(w)).attr("role",at.GRAPHICS_SYMBOL).attr("aria-roledescription","peak").attr("aria-label",w=>w),b.exit().remove(),this.services.domUtils.setSVGMaxHeight(),this.addEventListeners()}addEventListeners(){const t=this.getOptions(),{groupMapsTo:n}=t.data,i=this,r=E(t,"meter","proportional");this.parent.selectAll("rect.value").on("mouseover",function(s,a){const o=P(this);i.services.events.dispatchEvent(C.Meter.METER_MOUSEOVER,{event:s,element:o,datum:a}),r&&(o.classed("hovered",!0),i.services.events.dispatchEvent(C.Tooltip.SHOW,{event:s,hoveredElement:o,items:[{label:a[n],value:a.value}]}))}).on("mousemove",function(s,a){const o=P(this);i.services.events.dispatchEvent(C.Meter.METER_MOUSEMOVE,{event:s,element:o,datum:a}),r&&i.services.events.dispatchEvent(C.Tooltip.MOVE,{event:s})}).on("click",function(s,a){i.services.events.dispatchEvent(C.Meter.METER_CLICK,{event:s,element:P(this),datum:a})}).on("mouseout",function(s,a){const o=P(this);i.services.events.dispatchEvent(C.Meter.METER_MOUSEOUT,{event:s,element:o,datum:a}),r&&(o.classed("hovered",!1),i.services.events.dispatchEvent(C.Tooltip.HIDE,{hoveredElement:o}))})}destroy(){this.parent.selectAll("rect.value").on("mouseover",null).on("mousemove",null).on("mouseout",null).on("click",null)}}class tR extends ht{constructor(){super(...arguments),this.type="radar",this.renderType=K.SVG,this.getLabelDimensions=t=>{const n=R.appendOrSelect(this.getComponentContainer(),"g.tmp-tick"),i=R.appendOrSelect(n,"text").text(t),{width:r,height:s}=R.getSVGElementSize(i.node(),{useBBox:!0});return n.remove(),{width:r,height:s}},this.normalizeFlatData=t=>{const n=this.getOptions(),{angle:i,value:r}=E(n,"radar","axes"),s=E(n,"data","groupMapsTo"),a=cD(this.uniqueKeys.map(o=>this.uniqueGroups.map(c=>({[i]:o,[s]:c,[r]:null}))));return nt(a,t)},this.normalizeGroupedData=t=>{const n=this.getOptions(),{angle:i,value:r}=E(n,"radar","axes"),s=E(n,"data","groupMapsTo");return t.map(({name:a,data:o})=>{const c=this.uniqueKeys.map(l=>({[s]:a,[i]:l,[r]:null}));return{name:a,data:nt(c,o)}})},this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail;this.parent.selectAll("g.blobs path").transition("legend-hover-blob").call(i=>this.services.transitions.setupTransition({transition:i,name:"legend-hover-blob"})).style("fill-opacity",i=>i.name!==n.datum().name?Rn.opacity.unselected:Rn.opacity.selected).style("stroke-opacity",i=>i.name!==n.datum().name?Rn.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",Rn.opacity.selected).style("stroke-opacity",1)}}init(){const{events:t}=this.services;t.addEventListener(C.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(C.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t=!0){const n=this.getComponentContainer(),{width:i,height:r}=R.getSVGElementSize(n,{useAttrs:!0}),s=this.model.getData(),a=this.model.getGroupedData(),o=this.getOptions(),c=E(o,"data","groupMapsTo"),l=E(o,"radar","axes","value"),{angle:u,value:h}=E(o,"radar","axes"),{xLabelPadding:d,yLabelPadding:f,yTicksNumber:p,minRange:m,xAxisRectHeight:g}=Rn;this.uniqueKeys=Array.from(new Set(s.map(x=>x[u]))),this.uniqueGroups=Array.from(new Set(s.map(x=>x[c]))),this.fullDataNormalized=this.normalizeFlatData(s),this.groupedDataNormalized=this.normalizeGroupedData(a);const v=2*(this.getLabelDimensions(this.uniqueKeys[0]).height+f),b=(Math.min(i,r)-v)/2;if(b<=0)return;const w=er().domain(this.fullDataNormalized.map(x=>x[u])).range([0,2*Math.PI].map(x=>x-Math.PI/2)),O=ln(this.fullDataNormalized.map(x=>x[h])),_=_e().domain([O>=0?0:O,bn(this.fullDataNormalized.map(x=>x[h]))]).range([m,b]).nice(p),T=_.ticks(p),S=x=>this.model.getFillColor(x),$=XE().angle(x=>w(x[u])+Math.PI/2).radius(x=>_(x[h])).curve(_d),D=this.uniqueKeys.map(x=>{const A=this.getLabelDimensions(x).width,y=A$(w(x),b);return A+y}),L={x:bn(D)+d,y:r/2},M=R.appendOrSelect(n,"g.y-axes").attr("role",at.GROUP).selectAll("path").data(T,x=>x),B=x=>this.uniqueKeys.map(A=>({[u]:A,[h]:x}));M.join(x=>x.append("path").attr("opacity",0).attr("transform",`translate(${L.x}, ${L.y})`).attr("fill","none").call(A=>A.transition().call(y=>this.services.transitions.setupTransition({transition:y,name:"radar_y_axes_enter",animate:t})).attr("opacity",1).attr("d",y=>$(B(y)))),x=>x.call(A=>A.transition().call(y=>this.services.transitions.setupTransition({transition:y,name:"radar_y_axes_update",animate:t})).attr("opacity",1).attr("transform",`translate(${L.x}, ${L.y})`).attr("d",y=>$(B(y)))),x=>x.call(A=>A.transition().call(y=>this.services.transitions.setupTransition({transition:y,name:"radar_y_axes_exit",animate:t})).attr("d",y=>$(B(y))).attr("opacity",0).remove())),R.appendOrSelect(n,"g.x-axes").attr("role",at.GROUP).selectAll("line").data(this.uniqueKeys,x=>x).join(x=>x.append("line").attr("opacity",0).attr("class",A=>`x-axis-${Si(A)}`).attr("stroke-dasharray","0").attr("x1",A=>kt(w(A),0,L).x).attr("y1",A=>kt(w(A),0,L).y).attr("x2",A=>kt(w(A),0,L).x).attr("y2",A=>kt(w(A),0,L).y).call(A=>A.transition().call(y=>this.services.transitions.setupTransition({transition:y,name:"radar_x_axes_enter",animate:t})).attr("opacity",1).attr("x1",y=>kt(w(y),_.range()[0],L).x).attr("y1",y=>kt(w(y),_.range()[0],L).y).attr("x2",y=>kt(w(y),_.range()[1],L).x).attr("y2",y=>kt(w(y),_.range()[1],L).y)),x=>x.call(A=>A.transition().call(y=>this.services.transitions.setupTransition({transition:y,name:"radar_x_axes_update",animate:t})).attr("opacity",1).attr("x1",y=>kt(w(y),_.range()[0],L).x).attr("y1",y=>kt(w(y),_.range()[0],L).y).attr("x2",y=>kt(w(y),_.range()[1],L).x).attr("y2",y=>kt(w(y),_.range()[1],L).y)),x=>x.call(A=>A.transition().call(y=>this.services.transitions.setupTransition({transition:y,name:"radar_x_axes_exit",animate:t})).attr("opacity",0).remove())),R.appendOrSelect(n,"g.x-labels").attr("role",at.GROUP).selectAll("text").data(this.uniqueKeys).join(x=>x.append("text").text(A=>A).attr("opacity",0).attr("x",A=>kt(w(A),_.range()[1]+d,L).x).attr("y",A=>kt(w(A),_.range()[1]+d,L).y).style("text-anchor",A=>jp(w(A)).textAnchor).style("dominant-baseline",A=>jp(w(A)).dominantBaseline).call(A=>A.transition().call(y=>this.services.transitions.setupTransition({transition:y,name:"radar_x_labels_enter",animate:t})).attr("opacity",1)),x=>x.call(A=>A.transition().call(y=>this.services.transitions.setupTransition({transition:y,name:"radar_x_labels_update",animate:t})).attr("opacity",1).attr("x",y=>kt(w(y),_.range()[1]+d,L).x).attr("y",y=>kt(w(y),_.range()[1]+d,L).y).end().finally(()=>{const y=E(o,"radar","alignment"),k=this.getAlignmentXOffset(y,n,this.getParent());n.attr("x",k)})),x=>x.call(A=>A.transition().call(y=>this.services.transitions.setupTransition({transition:y,name:"radar_x_labels_exit",animate:t})).attr("opacity",0).remove())),R.appendOrSelect(n,"g.blobs").attr("role",at.GROUP).selectAll("path").data(this.groupedDataNormalized,x=>x.name).join(x=>x.append("path").attr("class",A=>this.model.getColorClassName({classNameTypes:[J.FILL,J.STROKE],dataGroupName:A.name,originalClassName:"blob"})).attr("role",at.GRAPHICS_SYMBOL).attr("aria-label",A=>A.name).attr("opacity",0).attr("transform",t?()=>`translate(${L.x}, ${L.y}) scale(${1+Math.random()*.35})`:`translate(${L.x}, ${L.y})`).style("fill",A=>S(A.name)).style("fill-opacity",Rn.opacity.selected).style("stroke",A=>S(A.name)).call(A=>{const y=A.transition().call(k=>this.services.transitions.setupTransition({transition:k,name:"radar_blobs_enter",animate:t}));t&&y.delay(()=>Math.random()*30).attr("transform",`translate(${L.x}, ${L.y})`),y.attr("opacity",1).attr("d",k=>$(k.data))}),x=>(x.attr("class",A=>this.model.getColorClassName({classNameTypes:[J.FILL,J.STROKE],dataGroupName:A.name,originalClassName:"blob"})).style("fill",A=>S(A.name)).style("stroke",A=>S(A.name)),x.call(A=>A.transition().call(y=>this.services.transitions.setupTransition({transition:y,name:"radar_blobs_update",animate:t})).attr("opacity",1).attr("transform",`translate(${L.x}, ${L.y})`).attr("d",y=>$(y.data))),x),x=>x.call(A=>{const y=A.transition().call(k=>this.services.transitions.setupTransition({transition:k,name:"radar_blobs_exit",animate:t}));t&&y.delay(()=>Math.random()*30).attr("transform",()=>`translate(${L.x}, ${L.y}) scale(${1+Math.random()*.35})`),y.attr("opacity",0).remove()})),R.appendOrSelect(n,"g.dots").attr("role",at.GROUP).selectAll("circle").data(this.fullDataNormalized.filter(x=>E(x,h)!==null)).join(x=>x.append("circle").attr("role",at.GRAPHICS_SYMBOL).attr("aria-label",A=>A[l]),x=>x,x=>x.remove()).attr("class",x=>this.model.getColorClassName({classNameTypes:[J.FILL],dataGroupName:x[c],originalClassName:Si(x[u])})).attr("cx",x=>kt(w(x[u]),_(x[h]),L).x).attr("cy",x=>kt(w(x[u]),_(x[h]),L).y).attr("r",0).attr("opacity",0).style("fill",x=>S(x[c])),R.appendOrSelect(n,"g.x-axes-rect").attr("role",at.GROUP).selectAll("rect").data(this.uniqueKeys).join(x=>x.append("rect"),x=>x,x=>x.remove()).attr("x",L.x).attr("y",L.y-g/2).attr("width",_.range()[1]).attr("height",g).style("fill","red").style("fill-opacity",0).attr("transform",x=>`rotate(${Wp(w(x))}, ${L.x}, ${L.y})`),R.appendOrSelect(n,"g.y-labels").attr("role",at.GROUP).selectAll("text").data(ye(T)).join(x=>x.append("text").attr("opacity",0).text(A=>A).attr("x",A=>kt(-Math.PI/2,_(A),L).x+f).attr("y",A=>kt(-Math.PI/2,_(A),L).y).style("text-anchor","start").style("dominant-baseline","middle").call(A=>A.transition().call(y=>this.services.transitions.setupTransition({transition:y,name:"radar_y_labels_enter",animate:t})).attr("opacity",1)),x=>x.call(A=>A.transition().call(y=>this.services.transitions.setupTransition({transition:y,name:"radar_y_labels_update",animate:t})).text(y=>y).attr("opacity",1).attr("x",y=>kt(-Math.PI/2,_(y),L).x+f).attr("y",y=>kt(-Math.PI/2,_(y),L).y)),x=>x.call(A=>A.transition().call(y=>this.services.transitions.setupTransition({transition:y,name:"radar_y_labels_exit",animate:t})).attr("opacity",0).remove())),this.addEventListeners()}getAlignmentXOffset(t,n,i){const r=R.getSVGElementSize(n,{useBBox:!0}),{width:s}=R.getSVGElementSize(i,{useAttrs:!0});let a=0;return t===It.CENTER?a=Math.floor((s-r.width)/2):t===It.RIGHT&&(a=s-r.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(C.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(C.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}addEventListeners(){const t=this,{axes:{angle:n}}=E(this.getOptions(),"radar");this.parent.selectAll(".x-axes-rect > rect").on("mouseover",function(i,r){const s=P(this);t.services.events.dispatchEvent(C.Radar.X_AXIS_MOUSEOVER,{event:i,element:s,datum:r});const a=t.parent.select(`.x-axes .x-axis-${Si(r)}`),o=t.parent.selectAll(`.dots circle.${Si(r)}`),c=t.model.getActiveDataGroupNames(),l=t.getOptions(),{groupMapsTo:u}=l.data,h=E(l,"radar","axes","value");a.classed("hovered",!0).attr("stroke-dasharray","4 4"),o.classed("hovered",!0).attr("opacity",f=>c.indexOf(f[u])!==-1?1:0).attr("r",Rn.dotsRadius);const d=t.fullDataNormalized.filter(f=>f[n]===r&&c.indexOf(f[u])!==-1);t.services.events.dispatchEvent(C.Tooltip.SHOW,{event:i,hoveredElement:s,items:d.filter(f=>typeof f[h]=="number").map(f=>({label:f[u],value:f[h],color:t.model.getFillColor(f[u]),class:t.model.getColorClassName({classNameTypes:[J.TOOLTIP],dataGroupName:f[u]})}))})}).on("mousemove",function(i,r){const s=P(this);t.services.events.dispatchEvent(C.Radar.X_AXIS_MOUSEMOVE,{event:i,element:s,datum:r}),t.services.events.dispatchEvent(C.Tooltip.MOVE,{event:i})}).on("click",function(i,r){t.services.events.dispatchEvent(C.Radar.X_AXIS_CLICK,{event:i,element:P(this),datum:r})}).on("mouseout",function(i,r){const s=P(this),a=t.parent.select(`.x-axes .x-axis-${Si(r)}`),o=t.parent.selectAll(`.dots circle.${Si(r)}`);a.classed("hovered",!1).attr("stroke-dasharray","0"),o.classed("hovered",!1).attr("opacity",0).attr("r",0),t.services.events.dispatchEvent(C.Radar.X_AXIS_MOUSEOUT,{event:i,element:s,datum:r}),t.services.events.dispatchEvent(C.Tooltip.HIDE)})}}class Qg extends vc{constructor(){super(...arguments),this.type="simple-bar",this.renderType=K.SVG,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail,{groupMapsTo:i}=this.getOptions().data;this.parent.selectAll("path.bar").transition("legend-hover-simple-bar").call(r=>this.services.transitions.setupTransition({transition:r,name:"legend-hover-simple-bar"})).attr("opacity",r=>r[i]!==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(C.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(C.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t){const n=this.getOptions(),{groupMapsTo:i}=n.data,r=this.getComponentContainer({withinChartClip:!0}),s=this.model.getDisplayData(this.configs.groups),a=this.services.cartesianScales.getOrientation(),o=r.selectAll("path.bar").data(s,c=>c[i]);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(c=>this.services.transitions.setupTransition({transition:c,name:"bar-update-enter",animate:t})).attr("class",c=>this.model.getColorClassName({classNameTypes:[J.FILL],dataGroupName:c[i],originalClassName:"bar"})).style("fill",c=>this.model.getFillColor(c[i])).attr("d",c=>{const l=this.services.cartesianScales.getRangeIdentifier(),u=this.getBarWidth(),h=c[l],d=this.services.cartesianScales.getDomainValue(c)-u/2,f=d+u;let p,m;if(Array.isArray(h)&&h.length===2)p=this.services.cartesianScales.getRangeValue(h[0]),m=this.services.cartesianScales.getRangeValue(h[1]);else{const v=this.services.cartesianScales.getRangeScale().domain()[0];p=this.services.cartesianScales.getRangeValue(Math.max(0,v)),m=this.services.cartesianScales.getRangeValue(c)}const g=Math.abs(m-p);if(g!==0&&g<2&&(h>0&&a===Ht.VERTICAL||h<0&&a===Ht.HORIZONTAL?m=p-2:m=p+2),!this.isOutsideZoomedDomain(d,f))return Qt({x0:d,x1:f,y0:p,y1:m},a)}).attr("opacity",1).attr("role",at.GRAPHICS_SYMBOL).attr("aria-roledescription","bar").attr("aria-label",c=>c.value),this.addEventListeners()}addEventListeners(){const t=this;this.parent.selectAll("path.bar").on("mouseover",function(n,i){const r=P(this);r.classed("hovered",!0),t.services.events.dispatchEvent(C.Bar.BAR_MOUSEOVER,{event:n,element:r,datum:i}),t.services.events.dispatchEvent(C.Tooltip.SHOW,{event:n,hoveredElement:r,data:[i]})}).on("mousemove",function(n,i){t.services.events.dispatchEvent(C.Bar.BAR_MOUSEMOVE,{event:n,element:P(this),datum:i}),t.services.events.dispatchEvent(C.Tooltip.MOVE,{event:n})}).on("click",function(n,i){t.services.events.dispatchEvent(C.Bar.BAR_CLICK,{event:n,element:P(this),datum:i})}).on("mouseout",function(n,i){const r=P(this);r.classed("hovered",!1),t.services.events.dispatchEvent(C.Bar.BAR_MOUSEOUT,{event:n,element:r,datum:i}),t.services.events.dispatchEvent(C.Tooltip.HIDE,{hoveredElement:r})})}destroy(){this.parent.selectAll("path.bar").on("mouseover",null).on("mousemove",null).on("mouseout",null);const t=this.services.events;t.removeEventListener(C.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(C.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}}class eR extends Jt{constructor(){super(...arguments),this.type="skeleton-lines"}render(t=!0){const n=E(this.getOptions(),"data","loading"),i=!E(this.getOptions(),"grid","x","enabled")&&!E(this.getOptions(),"grid","y","enabled")&&!E(this.getOptions(),"axes","bottom","visible")&&!E(this.getOptions(),"axes","left","visible");n&&!i?super.renderGridSkeleton(n):n&&i?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"),i=[100],r=R.appendOrSelect(this.backdrop,"g.y.skeleton"),s=r.selectAll("line").data(i);s.enter().append("line").merge(s).attr("x1",0).attr("x2",n).attr("y1",a=>a).attr("y2",a=>a),r.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=R.appendOrSelect(t,"svg.chart-skeleton.DAII"),R.appendOrSelect(this.backdrop,"rect.chart-skeleton-backdrop").classed("shimmer-effect-lines",!1).classed("shimmer-effect-sparkline",!0).style("stroke",null)}}class Jg extends ht{constructor(){super(...arguments),this.type="area-stacked",this.renderType=K.SVG,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail,i=this.getOptions(),{groupMapsTo:r}=i.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=>E(s,0,r)!==n.datum().name?Qe.opacity.unselected:Qe.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",Qe.opacity.selected)}}init(){const t=this.services.events;t.addEventListener(C.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(C.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t=!0){const n=this.getComponentContainer({withinChartClip:!0}),i=this,r=this.getOptions(),{groupMapsTo:s}=r.data,a=Object.keys(r.axes).some(f=>r.axes[f].percentage),o=this.model.getStackedData({percentage:a,groups:this.configs.groups}),c=E(o,0,0),l=this.services.cartesianScales.getDomainAxisPosition({datum:c}),u=this.services.cartesianScales.getRangeAxisPosition({datum:c}),h=this.services.cartesianScales.getScaleByPosition(u),d=n.selectAll("path.area").data(o,f=>E(f,0,s));this.areaGenerator=rl().x(f=>this.services.cartesianScales.getValueThroughAxisPosition(l,f.data.sharedStackKey)).y0(f=>h(f[0])).y1(f=>h(f[1])).curve(this.services.curves.getD3Curve()),d.exit().attr("opacity",0).remove(),d.enter().append("path").attr("opacity",0).merge(d).data(o,f=>E(f,0,s)).attr("class","area").attr("class",f=>this.model.getColorClassName({classNameTypes:[J.FILL],dataGroupName:E(f,0,s),originalClassName:"area"})).style("fill",f=>i.model.getFillColor(E(f,0,s))).attr("role",at.GRAPHICS_SYMBOL).attr("aria-roledescription","area").attr("aria-label",f=>E(f,0,s)).transition().call(f=>this.services.transitions.setupTransition({transition:f,name:"area-update-enter",animate:t})).attr("opacity",Qe.opacity.selected).attr("d",this.areaGenerator)}}class tm extends vc{constructor(){super(...arguments),this.type="stacked-bar",this.renderType=K.SVG,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail,{groupMapsTo:i}=this.model.getOptions().data;this.parent.selectAll("path.bar").transition("legend-hover-bar").call(r=>this.services.transitions.setupTransition({transition:r,name:"legend-hover-bar"})).attr("opacity",r=>r[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(C.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(C.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t){const n=this.getComponentContainer({withinChartClip:!0}),i=this.getOptions(),{groupMapsTo:r}=i.data,s=this.model.getStackedData({groups:this.configs.groups,divergent:!0}),a=this.model.getActiveDataGroupNames(),o=n.selectAll("g.bars").data(s,l=>E(l,0,r));o.exit().attr("opacity",0).remove(),o.enter().append("g").classed("bars",!0).attr("role",at.GROUP).attr("data-name","bars");const c=n.selectAll("g.bars").selectAll("path.bar").data(l=>l,l=>l.data.sharedStackKey);c.exit().remove(),c.enter().append("path").merge(c).classed("bar",!0).transition().call(l=>this.services.transitions.setupTransition({transition:l,name:"bar-update-enter",animate:t})).attr("class",l=>this.model.getColorClassName({classNameTypes:[J.FILL],dataGroupName:l[r],originalClassName:"bar"})).style("fill",l=>this.model.getFillColor(l[r])).attr("d",l=>{const u=l.data.sharedStackKey,h=this.getBarWidth(),d=this.services.cartesianScales.getDomainValue(u)-h/2,f=d+h,p=this.services.cartesianScales.getRangeValue(l[0]);let m=this.services.cartesianScales.getRangeValue(l[1]);if(!this.isOutsideZoomedDomain(d,f)){if(Math.abs(m-p)>0&&Math.abs(m-p)>i.bars.dividerSize){const g=l[0]<0&&l[1]<=0;g&&a.length>1?this.services.cartesianScales.getOrientation()===Ht.VERTICAL?m+=l[1]===0?2:1:m-=1:g||(this.services.cartesianScales.getOrientation()===Ht.VERTICAL?m+=1:m-=1)}return Qt({x0:d,x1:f,y0:p,y1:m},this.services.cartesianScales.getOrientation())}}).attr("opacity",1).attr("role",at.GRAPHICS_SYMBOL).attr("aria-roledescription","bar").attr("aria-label",l=>l[1]-l[0]),this.addEventListeners()}addEventListeners(){const t=this.getOptions(),{groupMapsTo:n}=t.data,i=this;this.parent.selectAll("path.bar").on("mouseover",function(r,s){const a=P(this);a.classed("hovered",!0),i.services.events.dispatchEvent(C.Bar.BAR_MOUSEOVER,{event:r,element:a,datum:s});let o=i.model.getDisplayData(i.configs.groups).find(c=>{const l=i.services.cartesianScales.getDomainIdentifier(c),u=i.services.cartesianScales.getRangeIdentifier(c);return c[u]===s.data[s[n]]&&c[l].toString()===s.data.sharedStackKey&&c[n]===s[n]});if(o===void 0){const c=i.services.cartesianScales.getDomainIdentifier(),l=i.services.cartesianScales.getRangeIdentifier();o={[c]:s.data.sharedStackKey,[l]:s.data[s[n]],[n]:s[n]}}i.services.events.dispatchEvent(C.Tooltip.SHOW,{event:r,hoveredElement:a,data:[o]})}).on("mousemove",function(r,s){const a=P(this);i.services.events.dispatchEvent(C.Bar.BAR_MOUSEMOVE,{event:r,element:a,datum:s}),i.services.events.dispatchEvent(C.Tooltip.MOVE,{event:r})}).on("click",function(r,s){i.services.events.dispatchEvent(C.Bar.BAR_CLICK,{event:r,element:P(this),datum:s})}).on("mouseout",function(r,s){const a=P(this);a.classed("hovered",!1),i.services.events.dispatchEvent(C.Bar.BAR_MOUSEOUT,{event:r,element:a,datum:s}),i.services.events.dispatchEvent(C.Tooltip.HIDE,{hoveredElement:a})})}getBarWidth(){const t=this.getOptions();if(E(t,"bars","width"))return t.bars.width;const n=this.services.cartesianScales.getMainXScale(),i=R.getSVGElementSize(this.parent,{useAttrs:!0}).width,r=this.model.getStackKeys().length,s=E(t,"bars","spacingFactor");return n.step?Math.min(t.bars.maxWidth,n.step()/2):Math.min(t.bars.maxWidth,i*s/r)}destroy(){this.parent.selectAll("path.bar").on("mouseover",null).on("mousemove",null).on("mouseout",null);const t=this.services.events;t.removeEventListener(C.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(C.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}}class em extends Ue{constructor(){super(...arguments),this.type="scatter-stacked",this.renderType=K.SVG}render(t){if(!E(this.getOptions(),"points","enabled"))return;const n=this.getComponentContainer({withinChartClip:!0}),i=this.getOptions(),{groupMapsTo:r}=i.data,s=Object.keys(i.axes).some(u=>i.axes[u].percentage),a=this.model.getStackedData({groups:this.configs.groups,percentage:s}),o=n.selectAll("g.dots").data(a,u=>E(u,0,r));o.exit().attr("opacity",0).remove();const c=o.enter().append("g").classed("dots",!0).attr("role",at.GROUP).merge(o).selectAll("circle.dot").data(u=>u);c.exit().attr("opacity",0).remove();const l=c.enter().append("circle").classed("dot",!0).attr("opacity",0).merge(c).datum(u=>{const h=u[r],d=this.services.cartesianScales.getDomainIdentifier(u),f=this.services.cartesianScales.getRangeIdentifier(u);return{[r]:h,[d]:u.data.sharedStackKey,[f]:u[1]}});this.styleCircles(l,t),this.addEventListeners()}getTooltipData(t,n){const i=this.getOptions(),{groupMapsTo:r}=i.data,s=Object.keys(i.axes).some(c=>i.axes[c].percentage),a=this.model.getStackedData({groups:this.configs.groups,percentage:s}),o=[];return a.forEach((c,l)=>{c.forEach((u,h)=>{const d=u[r],f=u.data.sharedStackKey;let p=u.data[d];const m=u[1],g=this.services.cartesianScales.getDomainIdentifier(u),v=this.services.cartesianScales.getRangeIdentifier(u);p!=null&&t===this.services.cartesianScales.getDomainValue(f)&&n===this.services.cartesianScales.getRangeValue(m)&&(s&&(p=this.model.getStackedData({groups:this.configs.groups})[l][h].data[d]),p!==null&&o.push({[r]:d,[g]:f,[v]:p}))})}),this.model.getDisplayData(this.configs.groups).filter(c=>{const l=this.services.cartesianScales.getDomainIdentifier(c),u=this.services.cartesianScales.getRangeIdentifier(c);return o.find(h=>h[r]==c[r]&&h[l]==c[l]&&h[u]==c[u])!==void 0})}}const Ai=6;class nR extends ht{constructor(){super(...arguments),this.type="tree",this.renderType=K.SVG}getLongestLabel(t){let n="";return t.forEach(i=>{const r=i.children?this.getLongestLabel(i.children):"";(r.length>n.length||i.name.length>n.length)&&(n=r.length>i.name.length?r:i.name)}),n}getMockLabelWidth(t,n){const i=t.append("text").attr("dy","0.31em").attr("x",0).attr("text-anchor","end").text(n),{width:r}=R.getSVGElementSize(i.node(),{useBBox:!0});return i.remove(),r}render(t=!0){const n=this.getComponentContainer();n.html("");const{width:i,height:r}=R.getSVGElementSize(this.parent,{useAttrs:!0});if(i<1||r<1)return;const s=this.model.getOptions(),a=this.model.getDisplayData(),o=E(s,"tree","rootTitle")||"Tree",c=this.getMockLabelWidth(n,o),l=this.getLongestLabel(a),u=this.getMockLabelWidth(n,l),h={top:0,right:0,bottom:0,left:c>0?c+Ai:30-Ai},d=Qi({name:o,children:a}),f=10,p=i/6,m=T=>{const S=d.descendants().reverse(),$=d.links();let D=d,L=d;d.eachBefore(U=>{U.x<D.x&&(D=U),U.x>L.x&&(L=U)});const M=L.x-D.x,B=n.transition().call(U=>this.services.transitions.setupTransition({transition:U,name:"tree-update-viewbox",animate:!0})).attr("viewBox",[-h.left,D.x,i,M].join(" ")),x=_.selectAll("g").data(S,U=>U.id),A=this,y=x.enter().append("g").attr("transform",()=>`translate(${T.y0},${T.x0})`).attr("class",U=>U.depth!==0&&U.children&&U.children.length>0?"clickable":null).on("mouseover",function(U,N){A.services.events.dispatchEvent(C.Tree.NODE_MOUSEOVER,{event:U,element:P(this),datum:N})}).on("click",function(U,N){N.depth!==0&&(N.children=N.children?null:N._children,m(N)),A.services.events.dispatchEvent(C.Tree.NODE_CLICK,{event:U,element:P(this),datum:N})}).on("mouseout",function(U,N){A.services.events.dispatchEvent(C.Tree.NODE_MOUSEOUT,{event:U,element:P(this),datum:N})});y.append("circle").attr("r",2.5).attr("class",U=>U._children?"parent":"child").attr("stroke-width",10),y.append("text").attr("dy","0.31em").attr("x",U=>U._children?-Ai:Ai).attr("text-anchor",U=>U._children?"end":"start").text(U=>U.data.name).clone(!0).attr("class","text-stroke").lower(),x.merge(y).transition(B).attr("transform",U=>`translate(${U.y},${U.x})`).attr("fill-opacity",1).attr("stroke-opacity",1),x.exit().transition(B).remove().attr("transform",()=>`translate(${T.y},${T.x})`).attr("fill-opacity",0).attr("stroke-opacity",0);const k=O.selectAll("path").data($,U=>U.target.id),I=k.enter().append("path").attr("d",()=>{const U={x:T.x0,y:T.y0};return w({source:U,target:U})});k.merge(I).transition(B).attr("d",w),k.exit().transition(B).remove().attr("d",()=>{const U={x:T.x,y:T.y};return w({source:U,target:U})}),d.eachBefore(U=>{U.x0=U.x,U.y0=U.y})},g=d.descendants(),v=g[g.length-1].depth,b=E(s,"tree","type")===hl.DENDROGRAM?mb().size([r,i-u-v*Ai-c]):iw().nodeSize([f,p]).size([r,i-u-v*Ai-c]),w=e_().x(T=>T.y).y(T=>T.x);d.x0=p/2,d.y0=0,d.descendants().forEach((T,S)=>{T.id=S,T._children=T.children}),b(d),n.attr("viewBox",[-h.left,-h.top,i,f]).style("user-select","none");const O=n.append("g").attr("class","links"),_=n.append("g").attr("class","nodes");m(d)}}var iR="#000000",rR="#ffffff",sR="#fcf4d6",aR="#fddc69",oR="#f1c21b",lR="#d2a106",cR="#b28600",uR="#8e6a00",hR="#684e00",dR="#483700",fR="#302400",pR="#1c1500",gR={10:sR,20:aR,30:oR,40:lR,50:cR,60:uR,70:hR,80:dR,90:fR,100:pR},mR="#fff2e8",vR="#ffd9be",yR="#ffb784",xR="#ff832b",bR="#eb6200",wR="#ba4e00",ER="#8a3800",_R="#5e2900",SR="#3e1a00",OR="#231000",TR={10:mR,20:vR,30:yR,40:xR,50:bR,60:wR,70:ER,80:_R,90:SR,100:OR},MR="#fff1f1",CR="#ffd7d9",AR="#ffb3b8",$R="#ff8389",LR="#fa4d56",DR="#da1e28",kR="#a2191f",RR="#750e13",IR="#520408",PR="#2d0709",NR={10:MR,20:CR,30:AR,40:$R,50:LR,60:DR,70:kR,80:RR,90:IR,100:PR},UR="#fff0f7",BR="#ffd6e8",HR="#ffafd2",VR="#ff7eb6",GR="#ee5396",FR="#d02670",zR="#9f1853",jR="#740937",WR="#510224",qR="#2a0a18",YR={10:UR,20:BR,30:HR,40:VR,50:GR,60:FR,70:zR,80:jR,90:WR,100:qR},XR="#f6f2ff",ZR="#e8daff",KR="#d4bbff",QR="#be95ff",JR="#a56eff",tI="#8a3ffc",eI="#6929c4",nI="#491d8b",iI="#31135e",rI="#1c0f30",sI={10:XR,20:ZR,30:KR,40:QR,50:JR,60:tI,70:eI,80:nI,90:iI,100:rI},aI="#edf5ff",oI="#d0e2ff",lI="#a6c8ff",cI="#78a9ff",uI="#4589ff",hI="#0f62fe",dI="#0043ce",fI="#002d9c",pI="#001d6c",gI="#001141",mI={10:aI,20:oI,30:lI,40:cI,50:uI,60:hI,70:dI,80:fI,90:pI,100:gI},vI="#e5f6ff",yI="#bae6ff",xI="#82cfff",bI="#33b1ff",wI="#1192e8",EI="#0072c3",_I="#00539a",SI="#003a6d",OI="#012749",TI="#061727",MI={10:vI,20:yI,30:xI,40:bI,50:wI,60:EI,70:_I,80:SI,90:OI,100:TI},CI="#d9fbfb",AI="#9ef0f0",$I="#3ddbd9",LI="#08bdba",DI="#009d9a",kI="#007d79",RI="#005d5d",II="#004144",PI="#022b30",NI="#081a1c",UI={10:CI,20:AI,30:$I,40:LI,50:DI,60:kI,70:RI,80:II,90:PI,100:NI},BI="#defbe6",HI="#a7f0ba",VI="#6fdc8c",GI="#42be65",FI="#24a148",zI="#198038",jI="#0e6027",WI="#044317",qI="#022d0d",YI="#071908",XI={10:BI,20:HI,30:VI,40:GI,50:FI,60:zI,70:jI,80:WI,90:qI,100:YI},ZI="#f2f4f8",KI="#dde1e6",QI="#c1c7cd",JI="#a2a9b0",tP="#878d96",eP="#697077",nP="#4d5358",iP="#343a3f",rP="#21272a",sP="#121619",aP={10:ZI,20:KI,30:QI,40:JI,50:tP,60:eP,70:nP,80:iP,90:rP,100:sP},oP="#f4f4f4",lP="#e0e0e0",cP="#c6c6c6",uP="#a8a8a8",hP="#8d8d8d",dP="#6f6f6f",fP="#525252",pP="#393939",gP="#262626",mP="#161616",vP={10:oP,20:lP,30:cP,40:uP,50:hP,60:dP,70:fP,80:pP,90:gP,100:mP},yP="#f7f3f2",xP="#e5e0df",bP="#cac5c4",wP="#ada8a8",EP="#8f8b8b",_P="#726e6e",SP="#565151",OP="#3c3838",TP="#272525",MP="#171414",CP={10:yP,20:xP,30:bP,40:wP,50:EP,60:_P,70:SP,80:OP,90:TP,100:MP},nm={black:{100:iR},blue:mI,coolGray:aP,cyan:MI,gray:vP,green:XI,magenta:YR,orange:TR,purple:sI,red:NR,teal:UI,warmGray:CP,white:{0:rR},yellow:gR};const AP=e=>{if(!e)return null;for(const t of Object.keys(nm)){const n=nm[t];for(const i of Object.keys(n))if(n[+i]===e)return i}return null},im=function(){const e=P(this.parentNode).select("rect.leaf"),t=getComputedStyle(e.node(),null).getPropertyValue("fill"),n=He(t);let i;if(n&&(i=AP(n?n.hex():null)),i==null){const r=qa(n).l;i=Math.abs(r*100-100)}return i>50?"white":"black"};let $P=0;class LP extends ht{constructor(){super(...arguments),this.type="treemap",this.renderType=K.SVG,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail;this.parent.selectAll("g[data-name='leaf']").transition("legend-hover-treemap").call(i=>this.services.transitions.setupTransition({transition:i,name:"legend-hover-treemap"})).attr("opacity",i=>i.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(C.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(C.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t=!0){const n=this.getComponentContainer();this.model.getData();const i=this.model.getDisplayData(),r=this.model.getOptions(),s=E(window,"location"),{width:a,height:o}=R.getSVGElementSize(n,{useAttrs:!0}),c=Qi({name:r.title||"Treemap",children:i}).sum(f=>f.value).sort((f,p)=>p.value-f.value),l=lw().size([a,o]).paddingInner(1).paddingOuter(0).round(!0)(c),u=n.selectAll("g[data-name='leaf']").data(l.leaves(),f=>f.data.name);u.exit().attr("opacity",0).remove();const h=u.enter().append("g").attr("data-name","leaf").attr("data-uid",()=>$P++).merge(u);h.attr("data-name","leaf").transition().call(f=>this.services.transitions.setupTransition({transition:f,name:"treemap-group-update",animate:t})).attr("transform",f=>`translate(${f.x0},${f.y0})`);const d=h.selectAll("rect.leaf").data(f=>[f]);d.exit().attr("width",0).attr("height",0).remove(),d.enter().append("rect").classed("leaf",!0).merge(d).attr("width",0).attr("height",0).attr("id",function(){const f=P(this.parentNode).attr("data-uid");return`${r.style.prefix}-leaf-${f}`}).attr("class",f=>{for(;f.depth>1;)f=f.parent;return this.model.getColorClassName({classNameTypes:[J.FILL],dataGroupName:f.data.name,originalClassName:"leaf"})}).transition().call(f=>this.services.transitions.setupTransition({transition:f,name:"treemap-leaf-update-enter",animate:t})).attr("width",f=>f.x1-f.x0).attr("height",f=>f.y1-f.y0).style("fill",f=>{for(;f.depth>1;)f=f.parent;return this.model.getFillColor(f.data.name)}),h.selectAll("clipPath").data(f=>f.data.showLabel!==!0?[]:[1],f=>f).join(f=>f.append("clipPath").attr("id",function(){const p=P(this.parentNode).attr("data-uid");return`${r.style.prefix}-clip-${p}`}).append("use").attr("xlink:href",function(){const p=P(this.parentNode.parentNode).attr("data-uid"),m=`${r.style.prefix}-leaf-${p}`;return new URL(`#${m}`,s)+""}),f=>null,f=>f.remove()),h.selectAll("text").data(f=>{if(f.data.showLabel!==!0)return[];let p=f;for(;p.depth>1;)p=p.parent;const m=qa(this.model.getFillColor(p.data.name));return[{text:f.data.name,color:m.l<.5?"white":"black"}]},f=>f).join(f=>{const p=f.append("text").text(m=>m.text).style("fill",im).attr("x",7).attr("y",18);return s&&p.attr("clip-path",function(){const m=P(this.parentNode).attr("data-uid"),g=`${r.style.prefix}-clip-${m}`;return`url(${new URL(`#${g}`,s)+""})`}),p},f=>f.text(p=>p.text).style("fill",im),f=>f.remove()),this.addEventListeners()}addEventListeners(){const t=this;this.parent.selectAll("rect.leaf").on("mouseover",function(n,i){const r=P(this);let s=getComputedStyle(this,null).getPropertyValue("fill"),a=i;for(;a.depth>1;)a=a.parent;r.transition("graph_element_mouseover_fill_update").call(o=>t.services.transitions.setupTransition({transition:o,name:"graph_element_mouseover_fill_update"})).style("fill",o=>{const c=t.model.getFillColor(o.parent.data.name);return c&&(s=c),He(s).darker(.7).toString()}),t.services.events.dispatchEvent(C.Tooltip.SHOW,{event:n,hoveredElement:r,items:[{color:s,label:a.data.name,bold:!0},{label:i.data.name,value:i.data.value}]}),t.services.events.dispatchEvent(C.Treemap.LEAF_MOUSEOVER,{event:n,element:r,datum:i})}).on("mousemove",function(n,i){const r=P(this);t.services.events.dispatchEvent(C.Treemap.LEAF_MOUSEMOVE,{event:n,element:r,datum:i}),t.services.events.dispatchEvent(C.Tooltip.MOVE,{event:n})}).on("click",function(n,i){t.services.events.dispatchEvent(C.Treemap.LEAF_CLICK,{event:n,element:P(this),datum:i})}).on("mouseout",function(n,i){const r=P(this);r.classed("hovered",!1);let s=i;for(;s.depth>1;)s=s.parent;r.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)),t.services.events.dispatchEvent(C.Treemap.LEAF_MOUSEOUT,{event:n,element:r,datum:i}),t.services.events.dispatchEvent(C.Tooltip.HIDE,{hoveredElement:r})})}}class DP extends ht{constructor(){super(...arguments),this.type="wordcloud",this.renderType=K.SVG,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail,{groupMapsTo:i}=this.getOptions().data;this.parent.selectAll("text.word").transition("legend-hover-wordcloud").call(r=>this.services.transitions.setupTransition({transition:r,name:"legend-hover-wordcloud"})).attr("opacity",r=>r[i]!==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(C.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(C.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t=!0){const n=this,i=this.getComponentContainer().attr("width","100%").attr("height","100%"),r=this.model.getDisplayData(),s=this.getFontSizeScale(r),a=this.getOptions(),{fontSizeMapsTo:o,wordMapsTo:c}=a.wordCloud,{groupMapsTo:l}=a.data,{width:u,height:h}=R.getSVGElementSize(i,{useAttrs:!0});if(u===0||h===0)return;const d=gL().size([u,h]).words(r.map(function(p){const m=p[o];if(typeof p[o]!="number")throw Error("Badly formatted WordCloud data. `value` should only be an integer or float");return{[l]:p[l],text:p[c],size:m,value:m}})).padding(5).rotate(0).fontSize(p=>s(p.size)).on("end",f);d.start();function f(p){const m=R.appendOrSelect(i,"g.words");m.attr("transform",`translate(${d.size()[0]/2}, ${d.size()[1]/2})`);const g=m.selectAll("text").data(p,v=>`${v[l]}-${v.text}`);g.exit().attr("opacity",0).remove(),g.enter().append("text").attr("opacity",0).merge(g).style("font-size",v=>`${v.size}px`).text(function(v){return v.text}).attr("class",v=>n.model.getColorClassName({classNameTypes:[J.FILL],dataGroupName:v[l],originalClassName:`word ${v.size>32?"light":""}`})).style("fill",v=>n.model.getFillColor(v[l],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:i}=n.wordCloud,r=t.map(c=>c[i]).filter(c=>c),s=R.getHTMLElementSize(this.services.domUtils.getMainContainer()),a=r.length>0,o=a?ye(r):[1,1];return _e().domain(o).range(a?n.wordCloud.fontSizeRange(s,t):[4,4])}addEventListeners(){const t=this.getOptions(),{groupMapsTo:n}=t.data,i=this,r=va(s=>{const a=i.parent.selectAll("text.word").transition("wordcloud-word-mouse-highlight").call(o=>i.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;r(o),i.services.events.dispatchEvent(C.WordCloud.WORD_MOUSEOVER,{event:s,element:P(this),datum:a}),i.services.events.dispatchEvent(C.Tooltip.SHOW,{event:s,hoveredElement:o,items:[{label:t.tooltip.wordLabel,value:a.text},{label:t.tooltip.valueLabel,value:a.value},{label:t.tooltip.groupLabel,value:a[n],class:i.model.getColorClassName({classNameTypes:[J.TOOLTIP],dataGroupName:a[n]})}]})}).on("mousemove",function(s,a){const o=P(this);i.services.events.dispatchEvent(C.WordCloud.WORD_MOUSEMOVE,{element:o,datum:a}),i.services.events.dispatchEvent(C.Tooltip.MOVE,{event:s})}).on("click",function(s,a){i.services.events.dispatchEvent(C.WordCloud.WORD_CLICK,{event:s,element:P(this),datum:a})}).on("mouseout",function(s,a){const o=P(this);r(null),i.services.events.dispatchEvent(C.WordCloud.WORD_MOUSEOUT,{event:s,element:o,datum:a}),i.services.events.dispatchEvent(C.Tooltip.HIDE,{hoveredElement:o})})}}class kP extends ht{constructor(){super(...arguments),this.type="geo",this.renderType=K.SVG}render(){const t=this.getComponentContainer({withinChartClip:!0}),{width:n,height:i}=R.getSVGElementSize(t,{useAttrs:!0});if(n<1||i<1)return;const r=this.getProjection(),s=E(this.getOptions(),"geoData"),a=this.model.getCombinedData(),o={},c={};Object.keys(a).forEach(g=>{typeof a[g].value=="number"?o[g]=a[g]:c[g]=a[g]});const l=Gk(s,Object.values(c)),u=Bk(s,{type:"GeometryCollection",geometries:Object.values(o)}),h=r.fitSize([n,i],u),d=Gx().projection(h);R.appendOrSelect(t,"g.geo").selectAll("path").data(u.features).join("path").attr("d",d);const f=this.services.domUtils.generateElementIDString("geo-pattern-stripes"),p=R.appendOrSelect(t,"defs");R.appendOrSelect(p,"pattern").attr("id",f).attr("width",5).attr("height",10).attr("patternUnits","userSpaceOnUse").attr("patternTransform","rotate(45)").append("path").classed("pattern-fill",!0).attr("d",lr()([[0,0],[0,10]]));const m=R.appendOrSelect(t,"g.missing-data");R.appendOrSelect(m,"path").datum(l).attr("d",d).style("fill",`url(#${f})`)}getProjection(){let t=null;switch(E(this.getOptions(),"thematic","projection")){case Ke.geoEqualEarth:t=ob();break;case Ke.geoAlbers:t=tb();break;case Ke.geoConicEqualArea:t=Sh();break;case Ke.geoConicEquidistant:t=sb();break;case Ke.geoEquirectangular:t=ib();break;case Ke.geoMercator:t=eb();break;case Ke.geoNaturalEarth1:t=lb();break;default:throw new Error("Projection is not supported.")}return t}}class RP extends kP{constructor(){super(...arguments),this.type="choropleth"}render(t=!0){super.render();const n=this.model.getCombinedData();this.getComponentContainer({withinChartClip:!0}).select("g.geo").selectAll("path").classed("border",!0).attr("class",i=>this.model.getColorClassName({value:n[i.properties.NAME].value,originalClassName:"border"})),this.addCountryAreaEventListener()}addCountryAreaEventListener(){const t=this,n=this.model.getCombinedData();this.parent.selectAll("path.border").on("mouseover",function(i,r){const s=P(this);t.services.events.dispatchEvent(ui.CHOROPLETH_MOUSEOVER,{event:i,element:s,datum:n[r.properties.NAME]}),t.services.events.dispatchEvent(ur.SHOW,{event:i,hoveredElement:s,items:[{label:r.properties.NAME,value:n[r.properties.NAME].value}]})}).on("mousemove",function(i,r){t.services.events.dispatchEvent(ui.CHOROPLETH_MOUSEMOVE,{event:i,element:P(this),datum:n[r.properties.NAME]}),t.services.events.dispatchEvent(ur.MOVE,{event:i})}).on("click",function(i,r){t.services.events.dispatchEvent(ui.CHOROPLETH_CLICK,{event:i,element:P(this),datum:n[r.properties.NAME]})}).on("mouseout",function(i,r){const s=P(this);t.services.events.dispatchEvent(ui.CHOROPLETH_MOUSEOUT,{event:i,element:s,datum:n[r.properties.NAME]}),t.services.events.dispatchEvent(ur.HIDE,{event:i,hoveredElement:s})})}}function rm(e,t){st(2,arguments);var n=ft(e),i=Ut(t);return isNaN(i)?new Date(NaN):(i&&n.setDate(n.getDate()+i),n)}function yc(e,t){st(2,arguments);var n=ft(e),i=Ut(t);if(isNaN(i))return new Date(NaN);if(!i)return n;var r=n.getDate(),s=new Date(n.getTime());s.setMonth(n.getMonth()+i+1,0);var a=s.getDate();return r>=a?s:(n.setFullYear(s.getFullYear(),s.getMonth(),r),n)}var IP=36e5;function sm(e,t){st(2,arguments);var n=Ut(t);return Zs(e,n*IP)}function am(e){st(1,arguments);var t=ft(e);return t.setHours(0,0,0,0),t}var PP=864e5;function NP(e,t){st(2,arguments);var n=am(e),i=am(t),r=n.getTime()-gl(n),s=i.getTime()-gl(i);return Math.round((r-s)/PP)}var UP=6e4;function xc(e,t){st(2,arguments);var n=Ut(t);return Zs(e,n*UP)}function bc(e,t){st(2,arguments);var n=Ut(t);return Zs(e,n*1e3)}function om(e,t){st(2,arguments);var n=Ut(t);return yc(e,n*12)}function Pr(e,t){st(2,arguments);var n=ft(e),i=ft(t),r=n.getTime()-i.getTime();return r<0?-1:r>0?1:r}var BP=6e4,HP=36e5;function VP(e,t){st(2,arguments);var n=ft(e),i=ft(t),r=n.getFullYear()-i.getFullYear(),s=n.getMonth()-i.getMonth();return r*12+s}function GP(e,t){st(2,arguments);var n=ft(e),i=ft(t);return n.getFullYear()-i.getFullYear()}function lm(e,t){var 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 FP(e,t){st(2,arguments);var n=ft(e),i=ft(t),r=lm(n,i),s=Math.abs(NP(n,i));n.setDate(n.getDate()-r*s);var a=+(lm(n,i)===-r),o=r*(s-a);return o===0?0:o}function wc(e,t){return st(2,arguments),ft(e).getTime()-ft(t).getTime()}var cm={ceil:Math.ceil,round:Math.round,floor:Math.floor,trunc:function(e){return e<0?Math.ceil(e):Math.floor(e)}},zP="trunc";function Ec(e){return e?cm[e]:cm[zP]}function jP(e,t,n){st(2,arguments);var i=wc(e,t)/HP;return Ec(n==null?void 0:n.roundingMethod)(i)}function um(e,t,n){st(2,arguments);var i=wc(e,t)/BP;return Ec(n==null?void 0:n.roundingMethod)(i)}function WP(e){st(1,arguments);var t=ft(e);return t.setHours(23,59,59,999),t}function qP(e){st(1,arguments);var t=ft(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(23,59,59,999),t}function YP(e){st(1,arguments);var t=ft(e);return WP(t).getTime()===qP(t).getTime()}function XP(e,t){st(2,arguments);var n=ft(e),i=ft(t),r=Pr(n,i),s=Math.abs(VP(n,i)),a;if(s<1)a=0;else{n.getMonth()===1&&n.getDate()>27&&n.setDate(30),n.setMonth(n.getMonth()-r*s);var o=Pr(n,i)===-r;YP(ft(e))&&s===1&&Pr(e,i)===1&&(o=!1),a=r*(s-Number(o))}return a===0?0:a}function hm(e,t,n){st(2,arguments);var i=wc(e,t)/1e3;return Ec(n==null?void 0:n.roundingMethod)(i)}function ZP(e,t){st(2,arguments);var n=ft(e),i=ft(t),r=Pr(n,i),s=Math.abs(GP(n,i));n.setFullYear(1584),i.setFullYear(1584);var a=Pr(n,i)===-r,o=r*(s-Number(a));return o===0?0:o}function KP(e,t){st(2,arguments);var n=Ut(t);return rm(e,-n)}function QP(e,t){st(2,arguments);var n=Ut(t);return yc(e,-n)}function JP(e,t){st(2,arguments);var n=Ut(t);return sm(e,-n)}function dm(e,t){st(2,arguments);var n=Ut(t);return xc(e,-n)}function fm(e,t){st(2,arguments);var n=Ut(t);return bc(e,-n)}function tN(e,t){st(2,arguments);var n=Ut(t);return om(e,-n)}function pm(e){var t=e==null?0:e.length;return t?la(e,1):[]}class eN extends an{zoomIn(t,n,i){let r,s,a;const o=i||gi;t&&(r=t.x,s=t.y,a=2);const{width:c,height:l}=R.getSVGElementSize(this.services.domUtils.getHolder(),{useClientDimensions:!0});n.transition().duration(o.duration).ease(o.ease).attr("transform",`translate(${c/2}, ${l/2}) scale(${a}) translate(${-r},${-s})`),this.services.events.dispatchEvent(C.CanvasZoom.CANVAS_ZOOM_IN,{element:P(t)})}zoomOut(t,n){const i=n||gi;t.transition().duration(i.duration).ease(i.ease).attr("transform",""),this.services.events.dispatchEvent(C.CanvasZoom.CANVAS_ZOOM_OUT)}}class nN extends an{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 i;n?i=new CustomEvent(t,{detail:n}):(i=document.createEvent("Event"),i.initEvent(t,!1,!0)),this.documentFragment.dispatchEvent(i)}}class iN extends an{constructor(t,n){super(t,n)}downloadCSV(t,n){const i=document.createElement("a"),r="text/csv;encoding:utf-8";if(navigator.msSaveBlob)navigator.msSaveBlob(new Blob([t],{type:r}),n);else if(URL&&"download"in i){const s=URL.createObjectURL(new Blob([t],{type:r}));i.href=s,i.setAttribute("download",n),document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(s)}else location.href=`data:application/octet-stream,${encodeURIComponent(t)}`}downloadImage(t,n){const i=document.createElement("a");i.download=n,i.href=t,document.body.appendChild(i),i.click(),document.body.removeChild(i)}}class rN extends an{constructor(){super(...arguments),this.pendingTransitions={}}init(){var t;(t=this.services.events)==null||t.addEventListener(C.Model.UPDATE,()=>{this.pendingTransitions={}})}setupTransition({transition:t,name:n,animate:i}){return this.pendingTransitions[t._id]=t,t.on("end interrupt cancel",()=>{delete this.pendingTransitions[t._id]}),this.model.getOptions().animations===!1||i===!1?t.duration(0):t.duration(E(vf,n,"duration")||vf.default.duration)}getPendingTransitions(){return this.pendingTransitions}}let sN=class extends an{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:i}=n.data,r=E(n,"axes",this.secondaryDomainAxisPosition),s=t[i];if(r!=null&&r.correspondingDatasets&&r.correspondingDatasets.includes(s))return this.secondaryDomainAxisPosition}return this.domainAxisPosition}getRangeAxisPosition({datum:t=null,groups:n=null}={}){if(this.dualAxes){const i=this.model.getOptions(),{groupMapsTo:r}=i.data,s=E(i,"axes",this.secondaryRangeAxisPosition);let a;if(t!==null?a=t[r]:n&&n.length>0&&(a=n[0]),s!=null&&s.correspondingDatasets&&s.correspondingDatasets.includes(a))return this.secondaryRangeAxisPosition}return this.rangeAxisPosition}getAxisOptions(t){return E(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===H.BOTTOM||t===H.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(H).map(t=>H[t]).forEach(t=>{this.scales[t]=this.createScale(t)})}findDomainAndRangeAxes(){const t=this.findVerticalAxesPositions(),n=this.findHorizontalAxesPositions(),i=this.findDomainAndRangeAxesPositions(t,n);this.domainAxisPosition=i.primaryDomainAxisPosition,this.rangeAxisPosition=i.primaryRangeAxisPosition,this.isDualAxes()&&(this.secondaryDomainAxisPosition=i.secondaryDomainAxisPosition,this.secondaryRangeAxisPosition=i.secondaryRangeAxisPosition)}determineOrientation(){(this.rangeAxisPosition===H.LEFT||this.rangeAxisPosition===H.RIGHT)&&(this.domainAxisPosition===H.BOTTOM||this.domainAxisPosition===H.TOP)?this.orientation=Ht.VERTICAL:this.orientation=Ht.HORIZONTAL}isDualAxes(){return this.dualAxes}determineAxisDuality(){var t,n,i,r;const s=this.model.getOptions(),a=E(s,"axes");((t=a[H.LEFT])!=null&&t.correspondingDatasets&&a[H.RIGHT]||(n=a[H.RIGHT])!=null&&n.correspondingDatasets&&a[H.LEFT]||(i=a[H.TOP])!=null&&i.correspondingDatasets&&a[H.BOTTOM]||(r=a[H.BOTTOM])!=null&&r.correspondingDatasets&&a[H.TOP])&&(this.dualAxes=!0)}getCustomDomainValuesByposition(t){const n=E(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]===Z.LINEAR||this.scaleTypes[t]===Z.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=[H.BOTTOM,H.TOP];return[this.domainAxisPosition,this.rangeAxisPosition].find(n=>t.indexOf(n)>-1)}getMainYAxisPosition(){const t=[H.LEFT,H.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,i,r){const s=this.model.getOptions(),a=E(s,"axes")[i],{mapsTo:o}=a,c=E(r,o)!==null?r[o]:r;let l;switch(n){case Z.LABELS:l=t(c)+t.step()/2;break;case Z.TIME:l=t(new Date(c));break;default:l=t(c)}return l}getBoundedScaledValues(t){const{bounds:n}=this.model.getOptions(),i=this.getRangeAxisPosition({datum:t}),r=this.scales[i],s=this.model.getOptions(),a=E(s,"axes")[i],{mapsTo:o}=a,c=t[o]!==void 0?t[o]:t;return[r(E(t,n.upperBoundMapsTo)!==null?t[n.upperBoundMapsTo]:c),r(E(t,n.lowerBoundMapsTo)!==null?t[n.lowerBoundMapsTo]:c)]}getValueThroughAxisPosition(t,n){const i=this.scaleTypes[t],r=this.scales[t];return this.getValueFromScale(r,i,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 E(n,"axes",this.getDomainAxisPosition({datum:t}),"mapsTo")}getRangeIdentifier(t){const n=this.model.getOptions();return E(n,"axes",this.getRangeAxisPosition({datum:t}),"mapsTo")}extendsDomain(t,n){const i=this.model.getOptions(),r=E(i,"axes",t);if(r.scaleType===Z.TIME){const s=E(i,"timeScale","addSpaceOnEdges");return aN(n,s)}else return oN(n,fn.paddingRatio,r.scaleType)}findVerticalAxesPositions(){const t=this.model.getOptions(),n=E(t,"axes"),i=this.isDualAxes();return E(n,H.LEFT)===null&&E(n,H.RIGHT)!==null||E(n,H.RIGHT,"main")===!0||i&&E(n,H.LEFT,"correspondingDatasets")?{primary:H.RIGHT,secondary:H.LEFT}:{primary:H.LEFT,secondary:H.RIGHT}}findHorizontalAxesPositions(){const t=this.model.getOptions(),n=E(t,"axes"),i=this.isDualAxes();return E(n,H.BOTTOM)===null&&E(n,H.TOP)!==null||E(n,H.TOP,"main")===!0||i&&E(n,H.BOTTOM,"correspondingDatasets")?{primary:H.TOP,secondary:H.BOTTOM}:{primary:H.BOTTOM,secondary:H.TOP}}findDomainAndRangeAxesPositions(t,n){const i=this.model.getOptions(),r=E(i,"axes",t.primary),s=E(i,"axes",n.primary),a=r.scaleType||Z.LINEAR,o=s.scaleType||Z.LINEAR,c={primaryDomainAxisPosition:null,secondaryDomainAxisPosition:null,primaryRangeAxisPosition:null,secondaryRangeAxisPosition:null};return c.primaryDomainAxisPosition=n.primary,c.primaryRangeAxisPosition=t.primary,c.secondaryDomainAxisPosition=n.secondary,c.secondaryRangeAxisPosition=t.secondary,(!(o===Z.LABELS||o===Z.TIME)&&a===Z.LABELS||a===Z.TIME)&&(c.primaryDomainAxisPosition=t.primary,c.primaryRangeAxisPosition=n.primary,c.secondaryDomainAxisPosition=t.secondary,c.secondaryRangeAxisPosition=n.secondary),c}getScaleDomain(t){const n=this.model.getOptions(),i=E(n,"axes",t),r=E(n,"bounds"),{includeZero:s}=i,a=E(i,"scaleType")||Z.LINEAR;if(this.model.isDataEmpty())return[];if(i.binned){const{bins:v}=this.model.getBinConfigurations();return[0,bn(v,b=>b.length)]}else if(i.limitDomainToBins){const{bins:v}=this.model.getBinConfigurations(),b=this.model.getStackKeys({bins:v});return[b[0].split("-")[0],b[b.length-1].split("-")[1]]}const o=this.model.getDisplayData(),{extendLinearDomainBy:c,mapsTo:l,percentage:u,thresholds:h}=i,{reference:d,compareTo:f}=fn.ratio;if(i.domain)return a===Z.LABELS?i.domain:(a===Z.TIME&&(i.domain=i.domain.map(v=>v.getTime===void 0?new Date(v):v)),this.extendsDomain(t,i.domain));if(u)return[0,100];if(i&&a===Z.LABELS)return Tr(o.map(v=>v[l]));let p,m;const g=this.model.getDataGroupNames();if(a===Z.LABELS_RATIO)return o.map(v=>`${v[d]}/${v[f]}`);if(a===Z.TIME)m=o.map(v=>+new Date(v[l]));else if(r&&n.axes)m=[],o.forEach(v=>{m.push(v[l]),v[r.upperBoundMapsTo]&&m.push(v[r.upperBoundMapsTo]),v[r.lowerBoundMapsTo]&&m.push(v[r.lowerBoundMapsTo])});else if(i.stacked===!0&&g&&t===this.getRangeAxisPosition()){const{groupMapsTo:v}=n.data,b=this.model.getDataValuesGroupedByKeys({groups:g}),w=o.filter(_=>!g.includes(_[v])),O=[];b.forEach(_=>{const{...T}=_;let S=0,$=0;Object.values(T).forEach(D=>{isNaN(D)||(D<0?$+=D:S+=D)}),O.push([$,S])}),m=[...pm(O),...w.map(_=>_[l])]}else m=[],o.forEach(v=>{const b=v[l];Array.isArray(b)&&b.length===2?(m.push(b[0]),m.push(b[1])):(c&&m.push(Math.max(v[l],v[c])),m.push(b))});return a!==Z.TIME&&a!==Z.LOG&&s&&m.push(0),h&&h.length>0&&h.forEach(v=>{const b=E(v,"value");b!==null&&m.push(b)}),p=ye(m),p=this.extendsDomain(t,p),p}createScale(t){const n=this.model.getOptions(),i=E(n,"axes",t);if(!i)return null;const r=E(i,"scaleType")||Z.LINEAR;this.scaleTypes[t]=r;let s;return r===Z.TIME?s=ud():r===Z.LOG?s=jh().base(i.base||10):r===Z.LABELS||r===Z.LABELS_RATIO?s=er():s=_e(),s.domain(this.getScaleDomain(t)),s}getHighestDomainThreshold(){const t=E(this.model.getOptions(),"axes"),n=this.getDomainAxisPosition(),{thresholds:i}=t[n];if(!Array.isArray(i)||Array.isArray(i)&&!i.length)return null;const r=this.getDomainScale(),s=i.sort((a,o)=>o.value-a.value)[0];return this.getScaleTypeByPosition(n)===Z.TIME&&(typeof s.value=="string"||s.value.getTime===void 0)&&(s.value=new Date(s.value)),{threshold:s,scaleValue:r(s.value)}}getHighestRangeThreshold(){const t=E(this.model.getOptions(),"axes"),n=this.getRangeAxisPosition(),{thresholds:i}=t[n];if(!Array.isArray(i)||Array.isArray(i)&&!i.length)return null;const r=this.getRangeScale(),s=i.sort((a,o)=>o.value-a.value)[0];return{threshold:s,scaleValue:r(s.value)}}};function aN(e,t){const n=new Date(e[0]),i=new Date(e[1]);return ZP(i,n)>1?[tN(n,t),om(i,t)]:XP(i,n)>1?[QP(n,t),yc(i,t)]:FP(i,n)>1?[KP(n,t),rm(i,t)]:jP(i,n)>1?[JP(n,t),sm(i,t)]:um(i,n)>30?[dm(n,t*30),xc(i,t*30)]:um(i,n)>1?[dm(n,t),xc(i,t)]:hm(i,n)>15?[fm(n,t*15),bc(i,t*15)]:hm(i,n)>1?[fm(n,t),bc(i,t)]:[n,i]}function oN([e,t],n,i){const r=(t-e)*n,s=t<=0&&t+r>0?0:t+r;let a=e>=0&&e-r<0?0:e-r;if(i===Z.LOG&&a<=0){if(e<=0)throw Error("Data must have values greater than 0 if log scale type is used.");a=e}return[a,s]}let lN=class extends an{constructor(){super(...arguments),this.curveTypes={curveLinear:Us,curveLinearClosed:_d,curveBasis:n_,curveBasisClosed:i_,curveBasisOpen:r_,curveBundle:s_,curveCardinal:a_,curveCardinalClosed:o_,curveCardinalOpen:l_,curveCatmullRom:c_,curveCatmullRomClosed:u_,curveCatmullRomOpen:h_,curveMonotoneX:d_,curveMonotoneY:f_,curveNatural:p_,curveStep:g_,curveStepAfter:v_,curveStepBefore:m_}}getD3Curve(){let t="curveLinear";const n=this.model.getOptions().curve;if(n&&(typeof n=="string"?t=n:t=n.name),this.curveTypes[t]){let i=this.curveTypes[t];return n&&Object.keys(n).forEach(r=>{i[r]&&(i=i[r](n[r]))}),i}return console.warn(`The curve type '${t}' is invalid, using 'curveLinear' instead`),this.curveTypes.curveLinear}};class cN extends an{isZoomBarEnabled(){if(!this.services.cartesianScales||!E(this.model.getOptions(),"zoomBar","top","enabled"))return!1;this.services.cartesianScales.findDomainAndRangeAxes();const t=this.services.cartesianScales.getMainXAxisPosition(),n=E(this.model.getOptions(),"axes",t,"scaleType");return t===H.BOTTOM&&n===Z.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:i}=this.services;if(!i)throw new Error("Services cartesianScales undefined");const r=i.getMainXAxisPosition(),s=i.getDomainIdentifier(),a=E(this.model.getOptions(),"axes",r,"domain");if(Array.isArray(a)&&a.length===2)return a;if(!r)throw new Error("Not defined: mainXAxisPosition");return i.extendsDomain(r,ye(n,o=>o[s]))}handleDomainChange(t,n={dispatchEvent:!0}){var i;this.model.set({zoomDomain:t},{animate:!1}),n.dispatchEvent&&((i=this.services.events)==null||i.dispatchEvent(C.ZoomDomain.CHANGE,{newDomain:t}))}getZoomRatio(){return E(this.model.getOptions(),"zoomBar","zoomRatio")}filterDataForRangeAxis(t,n){var i;const r=this.model.get("zoomDomain"),s=Object.assign({stacked:!1},n),a=E(this.model.getOptions(),"zoomBar","updateRangeAxis");if(this.isZoomBarEnabled()&&a&&r){const o=s.stacked?"sharedStackKey":(i=this.services.cartesianScales)==null?void 0:i.getDomainIdentifier(),c=t.filter(l=>new Date(l[o])>=r[0]&&new Date(l[o])<=r[1]);if(c.length>0)return c}return t}zoomIn(t=this.getZoomRatio()){var n;const i=this.model.get("zoomDomain"),r=ce.handleWidth,s=(n=this.services.cartesianScales)==null?void 0:n.getMainXScale().copy();s.domain(this.getDefaultZoomBarDomain());const a=s(i[0]),o=s(i[1]);if(o-a<r+1)return;const c=s.range(),l=o-a,u=Math.min((c[1]-c[0])/2*(t/2),l/2);let h=a+u,d=o-u;h>=d&&(h=a+l/2-r/2,d=o-l/2+r/2);const f=[s.invert(h),s.invert(d)];(i[0].valueOf()!==f[0].valueOf()||i[1].valueOf()!==f[1].valueOf())&&this.handleDomainChange(f)}zoomOut(t=this.getZoomRatio()){const n=this.model.get("zoomDomain");if(!this.services.cartesianScales)throw new Error("Services cartesianScales undefined");const i=this.services.cartesianScales.getMainXScale().copy();i.domain(this.getDefaultZoomBarDomain());const r=i(n[0]),s=i(n[1]),a=i.range(),o=(a[1]-a[0])/2*(t/2),c=Math.max(r-o,a[0]),l=Math.min(s+o,a[1]),u=[i.invert(c),i.invert(l)];(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 i=t[1].valueOf()-t[0].valueOf(),r=n[1].valueOf()-n[0].valueOf(),s=E(this.model.getOptions(),"zoomBar","minZoomRatio");return i/r<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 E(this.model.getOptions(),"zoomBar",t,"loading")}isZoomBarLocked(t){return E(this.model.getOptions(),"zoomBar",t,"locked")}}function uN(e,t,n){var i=-1,r=e.length;t<0&&(t=-t>r?0:r+t),n=n>r?r:n,n<0&&(n+=r),r=t>n?0:n-t>>>0,t>>>=0;for(var s=Array(r);++i<r;)s[i]=e[i+t];return s}function hN(e,t,n){var i=e.length;return n=n===void 0?i:n,!t&&n>=i?e:uN(e,t,n)}var dN="\\ud800-\\udfff",fN="\\u0300-\\u036f",pN="\\ufe20-\\ufe2f",gN="\\u20d0-\\u20ff",mN=fN+pN+gN,vN="\\ufe0e\\ufe0f",yN="\\u200d",xN=RegExp("["+yN+dN+mN+vN+"]");function gm(e){return xN.test(e)}function bN(e){return e.split("")}var mm="\\ud800-\\udfff",wN="\\u0300-\\u036f",EN="\\ufe20-\\ufe2f",_N="\\u20d0-\\u20ff",SN=wN+EN+_N,ON="\\ufe0e\\ufe0f",TN="["+mm+"]",_c="["+SN+"]",Sc="\\ud83c[\\udffb-\\udfff]",MN="(?:"+_c+"|"+Sc+")",vm="[^"+mm+"]",ym="(?:\\ud83c[\\udde6-\\uddff]){2}",xm="[\\ud800-\\udbff][\\udc00-\\udfff]",CN="\\u200d",bm=MN+"?",wm="["+ON+"]?",AN="(?:"+CN+"(?:"+[vm,ym,xm].join("|")+")"+wm+bm+")*",$N=wm+bm+AN,LN="(?:"+[vm+_c+"?",_c,ym,xm,TN].join("|")+")",DN=RegExp(Sc+"(?="+Sc+")|"+LN+$N,"g");function kN(e){return e.match(DN)||[]}function RN(e){return gm(e)?kN(e):bN(e)}function IN(e){return function(t){t=Sr(t);var n=gm(t)?RN(t):void 0,i=n?n[0]:t.charAt(0),r=n?hN(n,1).join(""):t.slice(1);return i[e]()+r}}var PN=IN("toUpperCase");const NN=PN;function UN(e){return NN(Sr(e).toLowerCase())}var BN=Eg(function(e,t,n){return t=t.toLowerCase(),e+(n?UN(t):t)});const HN=BN;class Ae{constructor(t,n){this.components=[],this.services={canvasZoom:eN,domUtils:R,events:nN,files:iN,gradientUtils:jl,transitions:rN},this.model=new Ne(this.services)}init(t,n){this.model.set({holder:t},{skipUpdate:!0}),Object.keys(this.services).forEach(i=>{const r=this.services[i];this.services[i]=new r(this.model,this.services)}),this.services.events.addEventListener(C.Model.UPDATE,i=>{const r=!!E(i,"detail","animate");this.update(r)}),this.model.setData(n.data),this.services.events.addEventListener(C.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(r=>{this.services[r].update()}),this.components.forEach(r=>r.render(t));const n=this.services.transitions.getPendingTransitions(),i=Object.keys(n).map(r=>n[r].end().catch(s=>s));Promise.all(i).then(()=>this.services.events.dispatchEvent(C.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 i=this.model.getOptions(),r=E(i,"toolbar","enabled"),s={id:"legend",components:[new pc(this.model,this.services)],growth:it.PREFERRED},a=E(i,"canvasZoom","enabled");a&&a===!0&&t.push(new Tk(this.model,this.services));const o=!!this.model.getOptions().title,c={id:"title",components:[new Ir(this.model,this.services)],growth:it.STRETCH},l={id:"toolbar",components:[new kr(this.model,this.services)],growth:it.PREFERRED},u={id:"header",components:[new ie(this.model,this.services,[c,...r?[l]:[]],{direction:Et.ROW,alignItems:hi.CENTER})],growth:it.PREFERRED},h={id:"graph-frame",components:t,growth:it.STRETCH,renderType:E(n,"graphFrameRenderType")||K.SVG},d=E(n,"excludeLegend")!==!0&&i.legend.enabled!==!1;let f=Et.COLUMN;if(d){const v=E(i,"legend","position");v==="left"?(f=Et.ROW,i.legend.orientation||(i.legend.orientation=dr.VERTICAL)):v==="right"?(f=Et.ROW_REVERSE,i.legend.orientation||(i.legend.orientation=dr.VERTICAL)):v==="bottom"&&(f=Et.COLUMN_REVERSE)}const p={id:"spacer",components:[new on(this.model,this.services)],growth:it.PREFERRED},m={id:"full-frame",components:[new ie(this.model,this.services,[...d?[s]:[],...d?[p]:[],h],{direction:f})],growth:it.STRETCH},g=[];if(o||r){g.push(u);const v={id:"spacer",components:[new on(this.model,this.services,r?{size:15}:void 0)],growth:it.PREFERRED};g.push(v)}return g.push(m),[new gc(this.model,this.services),new Ca(this.model,this.services),new ie(this.model,this.services,g,{direction:Et.COLUMN})]}}class se extends Ae{constructor(t,n){super(t,n),this.services=Object.assign(this.services,{cartesianScales:sN,curves:lN,zoom:cN}),this.model=new Gn(this.services)}getAxisChartComponents(t,n){const i=this.model.getOptions(),r=E(i,"zoomBar",H.TOP,"enabled"),s=E(i,"toolbar","enabled");this.services.cartesianScales.determineAxisDuality(),this.services.cartesianScales.findDomainAndRangeAxes(),this.services.cartesianScales.determineOrientation();const a=this.services.cartesianScales.getMainXAxisPosition(),o=E(i,"axes",a,"scaleType"),c=r&&a===H.BOTTOM&&o===Z.TIME,l=this.services.zoom.isZoomBarLocked(H.TOP),u=!!this.model.getOptions().title,h={id:"title",components:[new Ir(this.model,this.services)],growth:it.STRETCH},d={id:"toolbar",components:[new kr(this.model,this.services)],growth:it.PREFERRED},f={id:"header",components:[new ie(this.model,this.services,[h,...s?[d]:[]],{direction:Et.ROW,alignItems:hi.CENTER})],growth:it.PREFERRED},p={id:"legend",components:[new pc(this.model,this.services)],growth:it.PREFERRED};c&&!l&&t.push(new Ug(this.model,this.services),new Vg(this.model,this.services)),t.push(new Ck(this.model,this.services)),t.push(new Ak(this.model,this.services));const m={id:"graph-frame",components:t,growth:it.STRETCH,renderType:K.SVG},g=E(n,"legend","enabled")!==!1&&this.model.getOptions().legend.enabled!==!1;let v=Et.COLUMN;if(g){const T=E(this.model.getOptions(),"legend","position");T===hr.LEFT?(v=Et.ROW,this.model.getOptions().legend.orientation||(this.model.getOptions().legend.orientation=dr.VERTICAL)):T===hr.RIGHT?(v=Et.ROW_REVERSE,this.model.getOptions().legend.orientation||(this.model.getOptions().legend.orientation=dr.VERTICAL)):T===hr.BOTTOM&&(v=Et.COLUMN_REVERSE)}const b={id:"spacer",components:[new on(this.model,this.services)],growth:it.PREFERRED},w={id:"full-frame",components:[new ie(this.model,this.services,[...g?[p]:[],...g?[b]:[],m],{direction:v})],growth:it.STRETCH},O={id:"zoom-bar",components:[new Mk(this.model,this.services)],growth:it.PREFERRED,renderType:K.SVG},_=[];if(u||s){_.push(f);const T={id:"spacer",components:[new on(this.model,this.services,s?{size:15}:void 0)],growth:it.PREFERRED};_.push(T)}return c&&_.push(O),_.push(w),[new Gg(this.model,this.services),new Ca(this.model,this.services),new ie(this.model,this.services,_,{direction:Et.COLUMN})]}}class VN extends Ae{constructor(t,n){super(t,n),this.model=new e$(this.services),this.model.setOptions(Ct(wt.alluvialChart,n.options)),this.init(t,n)}getComponents(){const t=[new $k(this.model,this.services)];return this.getChartComponents(t,{excludeLegend:!0})}}class GN extends se{constructor(t,n){super(t,n),this.model.setOptions(Ct(nn(wt.areaChart),n.options)),this.init(t,n)}getComponents(){const t=[new re(this.model,this.services),new ue(this.model,this.services),new vn(this.model,this.services),new Mi(this.model,this.services),new Fg(this.model,this.services),new Ue(this.model,this.services,{fadeInOnChartHolderMouseover:!0,handleThresholds:!0}),new Jt(this.model,this.services,{skeleton:Pt.GRID})];return this.getAxisChartComponents(t)}}class FN extends se{constructor(t,n){super(t,n),this.model=new n$(this.services),this.model.setOptions(Ct(wt.boxplotChart,n.options)),this.init(t,n)}getComponents(){const t=[new re(this.model,this.services),new ue(this.model,this.services),new kk(this.model,this.services),new Ci(this.model,this.services),new Jt(this.model,this.services,{skeleton:Pt.VERT_OR_HORIZ})];return this.getAxisChartComponents(t,{legend:{enabled:!1}})}}class zN extends se{constructor(t,n){super(t,n),this.model.setOptions(Ct(wt.bubbleChart,n.options)),this.init(t,n)}getComponents(){const t=[new re(this.model,this.services),new ue(this.model,this.services),new vn(this.model,this.services),new Rk(this.model,this.services),new Jt(this.model,this.services,{skeleton:Pt.GRID})];return this.getAxisChartComponents(t)}}class jN extends se{constructor(t,n){super(t,n),this.model=new i$(this.services),this.model.setOptions(Ct(wt.bulletChart,n.options)),this.init(t,n)}getComponents(){const t=[new re(this.model,this.services),new ue(this.model,this.services),new Ik(this.model,this.services),new Jt(this.model,this.services,{skeleton:Pt.GRID})];return this.getAxisChartComponents(t)}}class WN extends Ae{constructor(t,n){super(t,n),this.model=new r$(this.services),this.model.setOptions(Ct(wt.choroplethChart,n.options)),this.init(t,n)}getChartComponents(t,n){const i=this.model.getOptions(),r=E(i,"toolbar","enabled"),s=!!this.model.getOptions().title,a={id:"title",components:[new Ir(this.model,this.services)],growth:it.STRETCH},o={id:"toolbar",components:[new kr(this.model,this.services)],growth:it.PREFERRED},c={id:"header",components:[new ie(this.model,this.services,[a,...r?[o]:[]],{direction:Et.ROW,alignItems:hi.CENTER})],growth:it.PREFERRED},l={id:"legend",components:[new qg(this.model,this.services,{chartType:"choropleth"})],growth:it.PREFERRED,renderType:K.SVG},u={id:"graph-frame",components:t,growth:it.STRETCH,renderType:K.SVG},h=E(n,"legend","enabled")!==!1&&this.model.getOptions().legend.enabled!==!1,d=Et.COLUMN_REVERSE,f={id:"spacer",components:[new on(this.model,this.services,{size:15})],growth:it.PREFERRED},p={id:"full-frame",components:[new ie(this.model,this.services,[...h?[l]:[],...h?[f]:[],u],{direction:d})],growth:it.STRETCH},m=[];if(s||r){m.push(c);const g={id:"spacer",components:[new on(this.model,this.services,r?{size:15}:void 0)],growth:it.PREFERRED};m.push(g)}return m.push(p),[new gc(this.model,this.services),new Ca(this.model,this.services),new ie(this.model,this.services,m,{direction:Et.COLUMN})]}getComponents(){const t=[new RP(this.model,this.services)];return this.getChartComponents(t)}}class qN extends Ae{constructor(t,n){super(t,n),this.model=new s$(this.services),this.model.setOptions(Ct(wt.circlePackChart,n.options)),this.init(t,n)}getComponents(){const t=[new Wk(this.model,this.services)];return this.getChartComponents(t)}}const Em={[fe.LINE]:[Mi,Ue],[fe.SCATTER]:[Ue],[fe.AREA]:[Fg,Mi,Ue],[fe.STACKED_AREA]:[Jg,Mi,em,La],[fe.SIMPLE_BAR]:[Qg],[fe.GROUPED_BAR]:[Kg,Ci],[fe.STACKED_BAR]:[tm,La]};class YN extends se{constructor(t,n){super(t,n);const i=Ct(wt.comboChart,n.options);n.options.comboChartTypes||(console.error("No comboChartTypes defined for the Combo Chart!"),i.comboChartTypes=[{type:fe.LINE,correspondingDatasets:[]}]),this.model.setOptions(i),this.init(t,n)}getGraphComponents(){const{comboChartTypes:t}=this.model.getOptions();let n=0;const i=t.map(r=>{const s=r.type;let a;if(typeof r.type=="string"){if(!Object.keys(Em).includes(r.type))return console.error(`Invalid chart type "${r.type}" specified for combo chart. Please refer to the ComboChart tutorial for more guidance.`),null;let o=!1;const c=`${HN(r.type)}Chart`;return a=nt({},wt[c],this.model.getOptions(),r.options),r.type===fe.STACKED_AREA&&(o=!0),Em[r.type].map(l=>new l(this.model,this.services,{groups:r.correspondingDatasets,id:n++,options:a,stacked:o}))}else return a=nt({},this.model.getOptions(),r.options),new s(this.model,this.services,{groups:r.correspondingDatasets,id:n++,options:a})}).filter(r=>r!==null);return pm(i)}getComponents(){const{comboChartTypes:t}=this.model.getOptions(),n=t.some(r=>r.type===fe.STACKED_BAR||r.type===fe.STACKED_AREA),i=[new re(this.model,this.services),new ue(this.model,this.services),new Jt(this.model,this.services,{skeleton:Pt.GRID}),...n?[]:[new vn(this.model,this.services)],...this.getGraphComponents()];return this.getAxisChartComponents(i)}}class _m extends Ae{constructor(t,n,i=!1){super(t,n),this.model=new a$(this.services),!i&&(this.model.setOptions(Ct(wt.pieChart,n.options)),this.init(t,n))}getComponents(){const t=[new Yg(this.model,this.services),new Jt(this.model,this.services,{skeleton:Pt.PIE})];return this.getChartComponents(t)}}class XN extends _m{constructor(t,n){super(t,n,!0),this.model.setOptions(Ct(wt.donutChart,n.options)),this.init(t,n)}getComponents(){const t=[new Yk(this.model,this.services),new Jt(this.model,this.services,{skeleton:Pt.DONUT})];return this.getChartComponents(t)}}class ZN extends Ae{constructor(t,n){super(t,n),this.model=new o$(this.services),this.model.setOptions(Ct(wt.gaugeChart,n.options)),this.init(t,n)}getComponents(){const t=[new Xk(this.model,this.services)];return this.getChartComponents(t)}}class KN extends se{constructor(t,n){super(t,n),this.model.setOptions(Ct(wt.groupedBarChart,n.options)),this.init(t,n)}getComponents(){const t=[new re(this.model,this.services),new ue(this.model,this.services),new Kg(this.model,this.services),new Ci(this.model,this.services),new Jt(this.model,this.services,{skeleton:Pt.VERT_OR_HORIZ})];return this.getAxisChartComponents(t)}}class QN extends se{constructor(t,n){super(t,n),this.model=new l$(this.services),this.model.setOptions(Ct(wt.heatmapChart,n.options)),this.init(t,n)}getAxisChartComponents(t,n){const i=this.model.getOptions(),r=E(i,"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 Ir(this.model,this.services)],growth:it.STRETCH},o={id:"toolbar",components:[new kr(this.model,this.services)],growth:it.PREFERRED},c={id:"header",components:[new ie(this.model,this.services,[a,...r?[o]:[]],{direction:Et.ROW,alignItems:hi.CENTER})],growth:it.PREFERRED},l={id:"legend",components:[new qg(this.model,this.services,{chartType:"heatmap"})],growth:it.PREFERRED,renderType:K.SVG},u={id:"graph-frame",components:t,growth:it.STRETCH,renderType:K.SVG},h=E(n,"legend","enabled")!==!1&&this.model.getOptions().legend.enabled!==!1,d=Et.COLUMN_REVERSE,f={id:"spacer",components:[new on(this.model,this.services,{size:15})],growth:it.PREFERRED},p={id:"full-frame",components:[new ie(this.model,this.services,[...h?[l]:[],...h?[f]:[],u],{direction:d})],growth:it.STRETCH},m=[];if(s||r){m.push(c);const g={id:"spacer",components:[new on(this.model,this.services,r?{size:15}:void 0)],growth:it.PREFERRED};m.push(g)}return m.push(p),[new Gg(this.model,this.services),new Ca(this.model,this.services),new ie(this.model,this.services,m,{direction:Et.COLUMN})]}getComponents(){const t=[new re(this.model,this.services),new Zk(this.model,this.services)];return this.getAxisChartComponents(t)}}class JN extends se{constructor(t,n){super(t,n),this.model=new c$(this.services),this.model.setOptions(Ct(wt.histogramChart,n.options)),this.init(t,n),this.update()}getComponents(){const t=[new re(this.model,this.services),new ue(this.model,this.services),new zk(this.model,this.services),new Kk(this.model,this.services)];return this.getAxisChartComponents(t)}}class tU extends se{constructor(t,n){super(t,n),this.model.setOptions(Ct(wt.lineChart,n.options)),this.init(t,n)}getComponents(){const t=[new re(this.model,this.services),new ue(this.model,this.services),new vn(this.model,this.services),new Mi(this.model,this.services),new Ue(this.model,this.services,{handleThresholds:!0}),new eR(this.model,this.services),new Ci(this.model,this.services)];return this.getAxisChartComponents(t)}}class eU extends se{constructor(t,n){super(t,n),this.model.setOptions(Ct(wt.lollipopChart,n.options)),this.init(t,n)}getComponents(){const t=[new re(this.model,this.services),new ue(this.model,this.services),new vn(this.model,this.services),new Qk(this.model,this.services),new Ue(this.model,this.services),new Jt(this.model,this.services,{skeleton:Pt.GRID})];return this.getAxisChartComponents(t)}}class nU extends Ae{constructor(t,n){var i;super(t,n),this.model=new u$(this.services);const r=(i=n.options.meter)!=null&&i.proportional?nt(nn(wt.proportionalMeterChart),n.options):nt(nn(wt.meterChart),n.options);this.model.setOptions(r),this.init(t,n)}getComponents(){const t=[...E(this.model.getOptions(),"meter","showLabels")?[{id:"meter-title",components:[new jk(this.model,this.services)],growth:it.STRETCH,renderType:K.SVG},{id:"spacer",components:[new on(this.model,this.services,{size:8})],growth:it.STRETCH}]:[],{id:"meter-graph",components:[new Jk(this.model,this.services)],growth:it.STRETCH,renderType:K.SVG}],n=[new ie(this.model,this.services,t,{direction:Et.COLUMN})];return this.getChartComponents(n,{graphFrameRenderType:K.HTML})}}class iU extends Ae{constructor(t,n){super(t,n),this.model=new h$(this.services),this.model.setOptions(Ct(wt.radarChart,n.options)),this.init(t,n)}getComponents(){const t=[new tR(this.model,this.services)];return this.getChartComponents(t)}}class rU extends se{constructor(t,n){super(t,n),this.model.setOptions(Ct(wt.scatterChart,n.options)),this.init(t,n)}getComponents(){const t=[new re(this.model,this.services),new ue(this.model,this.services),new vn(this.model,this.services),new Ue(this.model,this.services),new Jt(this.model,this.services,{skeleton:Pt.GRID})];return this.getAxisChartComponents(t)}}class sU extends Ae{constructor(t,n){super(t,n),this.model=new d$(this.services),this.model.setOptions(Ct(wt.treeChart,n.options)),this.init(t,n)}getComponents(){const t=[new nR(this.model,this.services)];return this.getChartComponents(t,{excludeLegend:!0})}}class aU extends Ae{constructor(t,n){super(t,n),this.model=new f$(this.services),this.model.setOptions(Ct(wt.treemapChart,n.options)),this.init(t,n)}getComponents(){const t=[new LP(this.model,this.services)];return this.getChartComponents(t)}}class oU extends se{constructor(t,n){super(t,n),this.model.setOptions(Ct(wt.simpleBarChart,n.options)),this.init(t,n)}getComponents(){const t=[new re(this.model,this.services),new ue(this.model,this.services),new Qg(this.model,this.services),new Ci(this.model,this.services),new Jt(this.model,this.services,{skeleton:Pt.VERT_OR_HORIZ})];return this.getAxisChartComponents(t)}}class lU extends se{constructor(t,n){super(t,n),this.model.setOptions(Ct(wt.stackedAreaChart,n.options)),this.init(t,n)}getComponents(){const t=[new re(this.model,this.services),new ue(this.model,this.services),new La(this.model,this.services),new Jg(this.model,this.services),new Mi(this.model,this.services,{stacked:!0}),new em(this.model,this.services,{fadeInOnChartHolderMouseover:!0,handleThresholds:!0,stacked:!0}),new Jt(this.model,this.services,{skeleton:Pt.GRID})];return this.getAxisChartComponents(t)}}class cU extends se{constructor(t,n){super(t,n),this.model.setOptions(Ct(wt.stackedBarChart,n.options)),this.init(t,n)}getComponents(){const t=[new re(this.model,this.services),new ue(this.model,this.services),new La(this.model,this.services),new tm(this.model,this.services),new Jt(this.model,this.services,{skeleton:Pt.VERT_OR_HORIZ}),new Ci(this.model,this.services)];return this.getAxisChartComponents(t)}}class uU extends Ae{constructor(t,n){super(t,n),this.model=new p$(this.services),this.model.setOptions(Ct(wt.wordCloudChart,n.options)),this.init(t,n)}getComponents(){const t=[new DP(this.model,this.services),new Jt(this.model,this.services,{skeleton:Pt.PIE})];return this.getChartComponents(t)}}function Mt(e,t){return ve.defineComponent({name:t,props:{data:{type:Object,required:!0},options:{type:Object,required:!0}},setup(n){const i=ve.ref(null),r=ve.ref(null),{data:s,options:a}=ve.toRefs(n);return ve.onMounted(()=>{r.value=new e(i.value,{data:s.value,options:a.value})}),ve.watch(s,o=>{var c;(c=r.value)==null||c.model.setData(o)},{immediate:!0}),ve.watch(a,o=>{var c;(c=r.value)==null||c.model.setOptions(o)}),{chart:r,chartDiv:i}},template:'<div ref="chartDiv"></div>'})}const Sm=Mt(VN,"CcvAlluvialChart"),Om=Mt(GN,"CcvAreaChart"),Tm=Mt(FN,"CcvBoxplotChart"),Mm=Mt(zN,"CcvBubbleChart"),Cm=Mt(jN,"CcvBulletChart"),Am=Mt(WN,"ExperimentalCcvChoroplethChart"),$m=Mt(qN,"CcvCirclePackChart"),Lm=Mt(YN,"CcvComboChart"),Dm=Mt(XN,"CcvDonutChart"),km=Mt(ZN,"CcvGaugeChart"),Rm=Mt(KN,"CcvGroupedBarChart"),Im=Mt(QN,"CcvHeatmapChart"),Pm=Mt(JN,"CcvHistogramChart"),Nm=Mt(tU,"CcvLineChart"),Um=Mt(eU,"CcvLollipopChart"),Bm=Mt(nU,"CcvMeterChart"),Hm=Mt(_m,"CcvPieChart"),Vm=Mt(iU,"CcvRadarChart"),Gm=Mt(rU,"CcvScatterChart"),Fm=Mt(oU,"CcvSimpleBarChart"),zm=Mt(lU,"CcvStackedAreaChart"),jm=Mt(cU,"CcvStackedBarChart"),Wm=Mt(sU,"CcvTreeChart"),qm=Mt(aU,"CcvTreemapChart"),Ym=Mt(uU,"CcvWordCloudChart"),hU=[Sm,Om,Tm,Mm,Cm,Am,$m,Lm,Dm,km,Rm,Im,Pm,Nm,Um,Bm,Hm,Vm,Gm,Fm,zm,jm,Wm,qm,Ym],dU={install(e,t){for(const n of hU)(!t||t.includes(n.name))&&e.component(n.name,n)}};rt.CcvAlluvialChart=Sm,rt.CcvAreaChart=Om,rt.CcvBoxplotChart=Tm,rt.CcvBubbleChart=Mm,rt.CcvBulletChart=Cm,rt.CcvCirclePackChart=$m,rt.CcvComboChart=Lm,rt.CcvDonutChart=Dm,rt.CcvGaugeChart=km,rt.CcvGroupedBarChart=Rm,rt.CcvHeatmapChart=Im,rt.CcvHistogramChart=Pm,rt.CcvLineChart=Nm,rt.CcvLollipopChart=Um,rt.CcvMeterChart=Bm,rt.CcvPieChart=Hm,rt.CcvRadarChart=Vm,rt.CcvScatterChart=Gm,rt.CcvSimpleBarChart=Fm,rt.CcvStackedAreaChart=zm,rt.CcvStackedBarChart=jm,rt.CcvTreeChart=Wm,rt.CcvTreemapChart=qm,rt.CcvWordCloudChart=Ym,rt.ExperimentalCcvChoroplethChart=Am,rt.default=dU,Object.defineProperties(rt,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
84
84
|
//# sourceMappingURL=index.js.map
|