@carbon/charts 1.15.1 → 1.15.2
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/{choropleth-kGlHP3Ga.mjs → choropleth-iPofCoEr.mjs} +2 -2
- package/dist/{choropleth-kGlHP3Ga.mjs.map → choropleth-iPofCoEr.mjs.map} +1 -1
- package/dist/components/index.mjs +1 -1
- package/dist/demo/index.mjs +4 -4
- package/dist/index.mjs +3 -3
- package/dist/model/index.mjs +1 -1
- package/dist/umd/bundle.umd.js +3 -3
- package/dist/umd/bundle.umd.js.map +1 -1
- package/dist/{wordcloud-w4x7neZf.mjs → wordcloud-EFHcMnWt.mjs} +267 -261
- package/dist/wordcloud-EFHcMnWt.mjs.map +1 -0
- package/package.json +2 -2
- package/dist/wordcloud-w4x7neZf.mjs.map +0 -1
package/dist/umd/bundle.umd.js
CHANGED
|
@@ -70,7 +70,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
70
70
|
</div>
|
|
71
71
|
${n.value===void 0||n.value===null?"":`<p class="value"/>${n.value}</p>`}
|
|
72
72
|
</div>
|
|
73
|
-
</li>`).join("")+"</ul>"}valueFormatter(t,n){const r=this.getOptions(),i=b(r,"tooltip","valueFormatter"),{code:s,number:a,date:o}=b(r,"locale");if(i)return i(t,n);if(typeof t.getTime=="function")return o(t,s,{month:"short",day:"numeric",year:"numeric"});try{if(typeof t=="string"&&/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z/.test(t)){const l=new Date(t);return o(l,s,{month:"short",day:"numeric",year:"numeric"})}}catch{}return a(t,s)}render(t=!1){const n=this.getOptions(),r=b(n,"tooltip","enabled");if(r){const i=I(this.services.domUtils.getHolder()),s=b(n,"style","prefix");this.tooltip=R.appendOrSelect(i,`div.${ue}--${s}--tooltip`),this.tooltip.style("max-width",null).attr("role","tooltip"),this.isEventListenerAdded||(this.addTooltipEventListener(),this.isEventListenerAdded=!0),this.tooltip.classed("hidden",!0)}else!r&&this.isEventListenerAdded&&(this.removeTooltipEventListener(),this.isEventListenerAdded=!1)}addOffsetByPlacement(t,n,r){const i=Object.assign({},t);return n==Ut.LEFT?i.left-=r:n==Ut.RIGHT?i.left+=r:n==Ut.TOP?i.top-=r:n==Ut.BOTTOM&&(i.top+=r),i}positionTooltip(t){const n=this.services.domUtils.getHolder(),r=n.offsetWidth,i=n.offsetHeight,s=this.tooltip.node(),a=this.getOptions(),o=b(a,"zoomBar","top","enabled"),l=!!b(t,"detail","noWrap"),c=Array.isArray(b(t,"detail","placements")),u=c?b(t,"detail","placements"):[Ut.RIGHT,Ut.LEFT,Ut.TOP,Ut.BOTTOM];let d,{horizontalOffset:h,defaultOffset:f}=_R;if(this.tooltip.select("div.title-tooltip").classed("title-tooltip-nowrap",l),c){const m=b(t,"detail","event","target"),v=this.services.domUtils.getElementOffset(m,!0);d=this.positionService.findBestPlacementAt(v,s,u,()=>({top:0,left:0,width:r,height:i}));let E=this.positionService.findPosition(m,s,d,()=>this.services.domUtils.getElementOffset(m));E=this.addOffsetByPlacement(E,d,f),this.positionService.setElement(s,E);return}let p=b(t,"detail","mousePosition");if(!p)p=Bn(b(t,"detail","event"),n);else{const m=b(a,"zoomBar","top","type"),v=be.height[m];o&&(p[1]+=v+be.spacerHeight)}p[0]/r>.9?d=Ut.LEFT:p[0]/r<.1?d=Ut.RIGHT:d=this.positionService.findBestPlacementAt({left:p[0],top:p[1]},s,u,()=>({top:void 0,left:void 0,width:r,height:i})),d===Ut.LEFT&&(h*=-1);const g=this.positionService.findPositionAt({left:p[0]+h,top:p[1]},s,d);this.positionService.setElement(s,g)}}class wP extends Tn{zoomIn(t,n,r){let i,s,a;const o=r||qr;t&&(i=t.x,s=t.y,a=2);const{width:l,height:c}=R.getSVGElementSize(this.services.domUtils.getHolder(),{useClientDimensions:!0});n.transition().duration(o.duration).ease(o.ease).attr("transform",`translate(${l/2}, ${c/2}) scale(${a}) translate(${-i},${-s})`),this.services.events.dispatchEvent(T.CanvasZoom.CANVAS_ZOOM_IN,{element:I(t)})}zoomOut(t,n){const r=n||qr;t.transition().duration(r.duration).ease(r.ease).attr("transform",""),this.services.events.dispatchEvent(T.CanvasZoom.CANVAS_ZOOM_OUT)}}class MP extends Tn{init(){this.documentFragment=document.createDocumentFragment()}addEventListener(t,n){this.documentFragment.addEventListener(t,n)}removeEventListener(t,n){this.documentFragment.removeEventListener(t,n)}dispatchEvent(t,n){let r;n?r=new CustomEvent(t,{detail:n}):(r=document.createEvent("Event"),r.initEvent(t,!1,!0)),this.documentFragment.dispatchEvent(r)}}class AP extends Tn{constructor(t,n){super(t,n)}downloadCSV(t,n){const r=document.createElement("a"),i="text/csv;encoding:utf-8";if(navigator.msSaveBlob)navigator.msSaveBlob(new Blob([t],{type:i}),n);else if(URL&&"download"in r){const s=URL.createObjectURL(new Blob([t],{type:i}));r.href=s,r.setAttribute("download",n),document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(s)}else location.href=`data:application/octet-stream,${encodeURIComponent(t)}`}downloadImage(t,n){const r=document.createElement("a");r.download=n,r.href=t,document.body.appendChild(r),r.click(),document.body.removeChild(r)}}class ms extends Tn{static appendOrUpdateLinearGradient(t){let n=t.svg.select(`defs linearGradient#${t.id}`);n.empty()&&(n=t.svg.append("defs").append("linearGradient").attr("id",t.id).attr("x1",t.x1).attr("x2",t.x2).attr("y1",t.y1).attr("y2",t.y2)),n.selectAll("stop").remove(),n.selectAll("stop").data(t.stops).enter().append("stop").attr("offset",r=>r.offset).style("stop-color",r=>r.color).style("stop-opacity",r=>r.opacity)}static getOffsetRatio(t){return(Math.abs(t[1])*100/Math.abs(t[0]-t[1])).toFixed(2)+"%"}static getStops(t,n){const r=t[0]<0&&t[1]>0;let i=[{offset:"0%",color:n,opacity:"0.6"},{offset:"80%",color:n,opacity:"0"}];return r&&(i=[{offset:"0%",color:n,opacity:"0.6"},{offset:ms.getOffsetRatio(t),color:n,opacity:"0"},{offset:"100%",color:n,opacity:"0.6"}]),i}}class CP extends Tn{constructor(){super(...arguments),this.pendingTransitions={}}init(){var t;(t=this.services.events)==null||t.addEventListener(T.Model.UPDATE,()=>{this.pendingTransitions={}})}setupTransition({transition:t,name:n,animate:r}){return this.pendingTransitions[t._id]=t,t.on("end interrupt cancel",()=>{delete this.pendingTransitions[t._id]}),this.model.getOptions().animations===!1||r===!1?t.duration(0):t.duration(b(tm,n,"duration")||tm.default.duration)}getPendingTransitions(){return this.pendingTransitions}}class qe{constructor(t,n){this.components=[],this.services={canvasZoom:wP,domUtils:R,events:MP,files:AP,gradientUtils:ms,transitions:CP},this.model=new rn(this.services)}init(t,n){this.model.set({holder:t},{skipUpdate:!0}),Object.keys(this.services).forEach(r=>{const i=this.services[r];this.services[r]=new i(this.model,this.services)}),this.services.events.addEventListener(T.Model.UPDATE,r=>{const i=!!b(r,"detail","animate");this.update(i)}),this.model.setData(n.data),this.services.events.addEventListener(T.Chart.RESIZE,()=>{this.update(!1)}),this.components=this.getComponents(),this.update()}getComponents(){return console.error("getComponents() method is not implemented"),[]}update(t=!0){if(!this.components)return;Object.keys(this.services).forEach(i=>{this.services[i].update()}),this.components.forEach(i=>i.render(t));const n=this.services.transitions.getPendingTransitions(),r=Object.keys(n).map(i=>n[i].end().catch(a=>a));Promise.all(r).then(()=>this.services.events.dispatchEvent(T.Chart.RENDER_FINISHED))}destroy(){this.components.forEach(t=>t.destroy()),this.services.domUtils.getHolder().remove(),this.model.set({destroyed:!0},{skipUpdate:!0})}getChartComponents(t,n){const r=this.model.getOptions(),i=b(r,"toolbar","enabled"),s={id:"legend",components:[new Ru(this.model,this.services)],growth:ct.PREFERRED},a=b(r,"canvasZoom","enabled");a&&a===!0&&t.push(new OP(this.model,this.services));const o=!!this.model.getOptions().title,l={id:"title",components:[new gs(this.model,this.services)],growth:ct.STRETCH},c={id:"toolbar",components:[new Kr(this.model,this.services)],growth:ct.PREFERRED},u={id:"header",components:[new ae(this.model,this.services,[l,...i?[c]:[]],{direction:At.ROW,alignItems:ir.CENTER})],growth:ct.PREFERRED},d={id:"graph-frame",components:t,growth:ct.STRETCH,renderType:b(n,"graphFrameRenderType")||tt.SVG},h=b(n,"excludeLegend")!==!0&&r.legend.enabled!==!1;let f=At.COLUMN;if(h){const v=b(r,"legend","position");v==="left"?(f=At.ROW,r.legend.orientation||(r.legend.orientation=Wr.VERTICAL)):v==="right"?(f=At.ROW_REVERSE,r.legend.orientation||(r.legend.orientation=Wr.VERTICAL)):v==="bottom"&&(f=At.COLUMN_REVERSE)}const p={id:"spacer",components:[new On(this.model,this.services)],growth:ct.PREFERRED},g={id:"full-frame",components:[new ae(this.model,this.services,[...h?[s]:[],...h?[p]:[],d],{direction:f})],growth:ct.STRETCH},m=[];if(o||i){m.push(u);const v={id:"spacer",components:[new On(this.model,this.services,i?{size:15}:void 0)],growth:ct.PREFERRED};m.push(v)}return m.push(g),[new Iu(this.model,this.services),new po(this.model,this.services),new ae(this.model,this.services,m,{direction:At.COLUMN})]}}class ur extends rn{constructor(t){super(t),this.axisFlavor=rs.DEFAULT}assignRangeAndDomains(){const{cartesianScales:t}=this.services,n=this.getOptions(),r=t.isDualAxes(),i={primaryDomain:t.domainAxisPosition,primaryRange:t.rangeAxisPosition,secondaryDomain:null,secondaryRange:null};return r&&(i.secondaryDomain=t.secondaryDomainAxisPosition,i.secondaryRange=t.secondaryRangeAxisPosition),Object.keys(i).forEach(s=>{const a=i[s];t.scales[a]?i[s]={position:a,label:t.getScaleLabel(a),identifier:b(n,"axes",a,"mapsTo")}:i[s]=null}),i}getTabularDataArray(){const t=this.getDisplayData(),n=this.getOptions(),{groupMapsTo:r}=n.data,{primaryDomain:i,primaryRange:s,secondaryDomain:a,secondaryRange:o}=this.assignRangeAndDomains(),{number:l,code:c}=b(this.getOptions(),"locale"),u=["Group",i.label,s.label,...a?[a.label]:[],...o?[o.label]:[]],d=t.map(h=>[h[r],h[i.identifier]===null?"–":h[i.identifier],h[s.identifier]===null||isNaN(h[s.identifier])?"–":l(h[s.identifier],c),...a?[h[a.identifier]===null?"–":h[a.identifier]]:[],...o?[h[o.identifier]===null||isNaN(h[o.identifier])?"–":h[o.identifier]]:[]]);return super.formatTable({headers:u,cells:d})}setData(t){let n;if(t&&(n=super.setData(t),b(this.getOptions(),"zoomBar",G.TOP,"enabled"))){const r=b(this.getOptions(),"zoomBar",G.TOP,"data");this.setZoomBarData(r)}return n}setZoomBarData(t){const n=t?this.sanitize(yn(t)):this.getDisplayData();let r=n;const{cartesianScales:i}=this.services;if(n&&i.domainAxisPosition&&i.rangeAxisPosition){const s=i.getDomainIdentifier(),a=i.getRangeIdentifier();let o=n.map(l=>l[s].getTime());o=Qi(o).sort(),r=o.map(l=>{let c=0;const u={};return n.forEach(d=>{d[s].getTime()===l&&(c+=d[a])}),u[s]=new Date(l),u[a]=c,u})}this.set({zoomBarData:r})}getZoomBarData(){return this.get("zoomBarData")}sanitizeDateValues(t){const n=this.getOptions();if(!n.axes)return t;const r=[];return Object.keys(G).forEach(i=>{const s=G[i],a=n.axes[s];if(a&&a.scaleType===Q.TIME){const o=a.mapsTo;(o!==null||o!==void 0)&&r.push(o)}}),r.length>0&&t.forEach(i=>{r.forEach(s=>{b(i,s,"getTime")===null&&(i[s]=new Date(i[s]))})}),t}sanitize(t){return t=super.sanitize(t),t=this.sanitizeDateValues(t),t}}class DP extends ur{constructor(t){super(t)}getTabularDataArray(){const t=this.getDisplayData(),{number:n,code:r}=b(this.getOptions(),"locale");t.sort((a,o)=>a.source.localeCompare(o.source));const i=["Source","Target","Value"],s=[...t.map(a=>[a.source,a.target,n(a.value,r)])];return super.formatTable({headers:i,cells:s})}}function fv(e,t){let n;if(t===void 0)for(const r of e)r!=null&&(n<r||n===void 0&&r>=r)&&(n=r);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n<i||n===void 0&&i>=i)&&(n=i)}return n}function LP(e,t){let n;if(t===void 0)for(const r of e)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n>i||n===void 0&&i>=i)&&(n=i)}return n}function ku(e,t){let n=0;if(t===void 0)for(let r of e)(r=+r)&&(n+=r);else{let r=-1;for(let i of e)(i=+t(i,++r,e))&&(n+=i)}return n}function RP(e){return e.depth}function IP(e,t){return t-1-e.height}function pv(e,t){return e.sourceLinks.length?e.depth:t-1}function mo(e){return function(){return e}}function gv(e,t){return vo(e.source,t.source)||e.index-t.index}function mv(e,t){return vo(e.target,t.target)||e.index-t.index}function vo(e,t){return e.y0-t.y0}function Pu(e){return e.value}function kP(e){return e.index}function PP(e){return e.nodes}function NP(e){return e.links}function vv(e,t){const n=e.get(t);if(!n)throw new Error("missing: "+t);return n}function yv({nodes:e}){for(const t of e){let n=t.y0,r=n;for(const i of t.sourceLinks)i.y0=n+i.width/2,n+=i.width;for(const i of t.targetLinks)i.y1=r+i.width/2,r+=i.width}}function $P(){let e=0,t=0,n=1,r=1,i=24,s=8,a,o=kP,l=pv,c,u,d=PP,h=NP,f=6;function p(){const w={nodes:d.apply(null,arguments),links:h.apply(null,arguments)};return g(w),m(w),v(w),E(w),S(w),yv(w),w}p.update=function(w){return yv(w),w},p.nodeId=function(w){return arguments.length?(o=typeof w=="function"?w:mo(w),p):o},p.nodeAlign=function(w){return arguments.length?(l=typeof w=="function"?w:mo(w),p):l},p.nodeSort=function(w){return arguments.length?(c=w,p):c},p.nodeWidth=function(w){return arguments.length?(i=+w,p):i},p.nodePadding=function(w){return arguments.length?(s=a=+w,p):s},p.nodes=function(w){return arguments.length?(d=typeof w=="function"?w:mo(w),p):d},p.links=function(w){return arguments.length?(h=typeof w=="function"?w:mo(w),p):h},p.linkSort=function(w){return arguments.length?(u=w,p):u},p.size=function(w){return arguments.length?(e=t=0,n=+w[0],r=+w[1],p):[n-e,r-t]},p.extent=function(w){return arguments.length?(e=+w[0][0],n=+w[1][0],t=+w[0][1],r=+w[1][1],p):[[e,t],[n,r]]},p.iterations=function(w){return arguments.length?(f=+w,p):f};function g({nodes:w,links:U}){for(const[$,N]of w.entries())N.index=$,N.sourceLinks=[],N.targetLinks=[];const F=new Map(w.map(($,N)=>[o($,N,w),$]));for(const[$,N]of U.entries()){N.index=$;let{source:j,target:q}=N;typeof j!="object"&&(j=N.source=vv(F,j)),typeof q!="object"&&(q=N.target=vv(F,q)),j.sourceLinks.push(N),q.targetLinks.push(N)}if(u!=null)for(const{sourceLinks:$,targetLinks:N}of w)$.sort(u),N.sort(u)}function m({nodes:w}){for(const U of w)U.value=U.fixedValue===void 0?Math.max(ku(U.sourceLinks,Pu),ku(U.targetLinks,Pu)):U.fixedValue}function v({nodes:w}){const U=w.length;let F=new Set(w),$=new Set,N=0;for(;F.size;){for(const j of F){j.depth=N;for(const{target:q}of j.sourceLinks)$.add(q)}if(++N>U)throw new Error("circular link");F=$,$=new Set}}function E({nodes:w}){const U=w.length;let F=new Set(w),$=new Set,N=0;for(;F.size;){for(const j of F){j.height=N;for(const{source:q}of j.targetLinks)$.add(q)}if(++N>U)throw new Error("circular link");F=$,$=new Set}}function y({nodes:w}){const U=fv(w,N=>N.depth)+1,F=(n-e-i)/(U-1),$=new Array(U);for(const N of w){const j=Math.max(0,Math.min(U-1,Math.floor(l.call(null,N,U))));N.layer=j,N.x0=e+j*F,N.x1=N.x0+i,$[j]?$[j].push(N):$[j]=[N]}if(c)for(const N of $)N.sort(c);return $}function x(w){const U=LP(w,F=>(r-t-(F.length-1)*a)/ku(F,Pu));for(const F of w){let $=t;for(const N of F){N.y0=$,N.y1=$+N.value*U,$=N.y1+a;for(const j of N.sourceLinks)j.width=j.value*U}$=(r-$+a)/(F.length+1);for(let N=0;N<F.length;++N){const j=F[N];j.y0+=$*(N+1),j.y1+=$*(N+1)}H(F)}}function S(w){const U=y(w);a=Math.min(s,(r-t)/(fv(U,F=>F.length)-1)),x(U);for(let F=0;F<f;++F){const $=Math.pow(.99,F),N=Math.max(1-$,(F+1)/f);A(U,$,N),_(U,$,N)}}function _(w,U,F){for(let $=1,N=w.length;$<N;++$){const j=w[$];for(const q of j){let at=0,nt=0;for(const{source:mt,value:Z}of q.targetLinks){let et=Z*(q.layer-mt.layer);at+=P(mt,q)*et,nt+=et}if(!(nt>0))continue;let dt=(at/nt-q.y0)*U;q.y0+=dt,q.y1+=dt,O(q)}c===void 0&&j.sort(vo),L(j,F)}}function A(w,U,F){for(let $=w.length,N=$-2;N>=0;--N){const j=w[N];for(const q of j){let at=0,nt=0;for(const{target:mt,value:Z}of q.sourceLinks){let et=Z*(mt.layer-q.layer);at+=M(q,mt)*et,nt+=et}if(!(nt>0))continue;let dt=(at/nt-q.y0)*U;q.y0+=dt,q.y1+=dt,O(q)}c===void 0&&j.sort(vo),L(j,F)}}function L(w,U){const F=w.length>>1,$=w[F];D(w,$.y0-a,F-1,U),B(w,$.y1+a,F+1,U),D(w,r,w.length-1,U),B(w,t,0,U)}function B(w,U,F,$){for(;F<w.length;++F){const N=w[F],j=(U-N.y0)*$;j>1e-6&&(N.y0+=j,N.y1+=j),U=N.y1+a}}function D(w,U,F,$){for(;F>=0;--F){const N=w[F],j=(N.y1-U)*$;j>1e-6&&(N.y0-=j,N.y1-=j),U=N.y0-a}}function O({sourceLinks:w,targetLinks:U}){if(u===void 0){for(const{source:{sourceLinks:F}}of U)F.sort(mv);for(const{target:{targetLinks:F}}of w)F.sort(gv)}}function H(w){if(u===void 0)for(const{sourceLinks:U,targetLinks:F}of w)U.sort(mv),F.sort(gv)}function P(w,U){let F=w.y0-(w.sourceLinks.length-1)*a/2;for(const{target:$,width:N}of w.sourceLinks){if($===U)break;F+=N+a}for(const{source:$,width:N}of U.targetLinks){if($===w)break;F-=N}return F}function M(w,U){let F=U.y0-(U.targetLinks.length-1)*a/2;for(const{source:$,width:N}of U.targetLinks){if($===w)break;F+=N+a}for(const{target:$,width:N}of w.sourceLinks){if($===U)break;F-=N}return F}return p}var Nu=Math.PI,$u=2*Nu,hr=1e-6,FP=$u-hr;function Fu(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function Ev(){return new Fu}Fu.prototype=Ev.prototype={constructor:Fu,moveTo:function(e,t){this._+="M"+(this._x0=this._x1=+e)+","+(this._y0=this._y1=+t)},closePath:function(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(e,t){this._+="L"+(this._x1=+e)+","+(this._y1=+t)},quadraticCurveTo:function(e,t,n,r){this._+="Q"+ +e+","+ +t+","+(this._x1=+n)+","+(this._y1=+r)},bezierCurveTo:function(e,t,n,r,i,s){this._+="C"+ +e+","+ +t+","+ +n+","+ +r+","+(this._x1=+i)+","+(this._y1=+s)},arcTo:function(e,t,n,r,i){e=+e,t=+t,n=+n,r=+r,i=+i;var s=this._x1,a=this._y1,o=n-e,l=r-t,c=s-e,u=a-t,d=c*c+u*u;if(i<0)throw new Error("negative radius: "+i);if(this._x1===null)this._+="M"+(this._x1=e)+","+(this._y1=t);else if(d>hr)if(!(Math.abs(u*o-l*c)>hr)||!i)this._+="L"+(this._x1=e)+","+(this._y1=t);else{var h=n-s,f=r-a,p=o*o+l*l,g=h*h+f*f,m=Math.sqrt(p),v=Math.sqrt(d),E=i*Math.tan((Nu-Math.acos((p+d-g)/(2*m*v)))/2),y=E/v,x=E/m;Math.abs(y-1)>hr&&(this._+="L"+(e+y*c)+","+(t+y*u)),this._+="A"+i+","+i+",0,0,"+ +(u*h>c*f)+","+(this._x1=e+x*o)+","+(this._y1=t+x*l)}},arc:function(e,t,n,r,i,s){e=+e,t=+t,n=+n,s=!!s;var a=n*Math.cos(r),o=n*Math.sin(r),l=e+a,c=t+o,u=1^s,d=s?r-i:i-r;if(n<0)throw new Error("negative radius: "+n);this._x1===null?this._+="M"+l+","+c:(Math.abs(this._x1-l)>hr||Math.abs(this._y1-c)>hr)&&(this._+="L"+l+","+c),n&&(d<0&&(d=d%$u+$u),d>FP?this._+="A"+n+","+n+",0,1,"+u+","+(e-a)+","+(t-o)+"A"+n+","+n+",0,1,"+u+","+(this._x1=l)+","+(this._y1=c):d>hr&&(this._+="A"+n+","+n+",0,"+ +(d>=Nu)+","+u+","+(this._x1=e+n*Math.cos(i))+","+(this._y1=t+n*Math.sin(i))))},rect:function(e,t,n,r){this._+="M"+(this._x0=this._x1=+e)+","+(this._y0=this._y1=+t)+"h"+ +n+"v"+ +r+"h"+-n+"Z"},toString:function(){return this._}};function bv(e){return function(){return e}}function UP(e){return e[0]}function BP(e){return e[1]}var HP=Array.prototype.slice;function GP(e){return e.source}function VP(e){return e.target}function zP(e){var t=GP,n=VP,r=UP,i=BP,s=null;function a(){var o,l=HP.call(arguments),c=t.apply(this,l),u=n.apply(this,l);if(s||(s=o=Ev()),e(s,+r.apply(this,(l[0]=c,l)),+i.apply(this,l),+r.apply(this,(l[0]=u,l)),+i.apply(this,l)),o)return s=null,o+""||null}return a.source=function(o){return arguments.length?(t=o,a):t},a.target=function(o){return arguments.length?(n=o,a):n},a.x=function(o){return arguments.length?(r=typeof o=="function"?o:bv(+o),a):r},a.y=function(o){return arguments.length?(i=typeof o=="function"?o:bv(+o),a):i},a.context=function(o){return arguments.length?(s=o??null,a):s},a}function WP(e,t,n,r,i){e.moveTo(t,n),e.bezierCurveTo(t=(t+r)/2,n,t,i,r,i)}function YP(){return zP(WP)}function qP(e){return[e.source.x1,e.y0]}function XP(e){return[e.target.x0,e.y1]}function jP(){return YP().source(qP).target(XP)}class ZP extends pt{constructor(){super(...arguments),this.type="alluvial",this.renderType=tt.SVG,this.gradient_id="gradient-id-"+Math.floor(Math.random()*99999999999)}render(t=!0){const n=this.getComponentContainer({withinChartClip:!0});n.html("");const{width:r,height:i}=R.getSVGElementSize(n,{useAttrs:!0});if(r<1||i<1)return;const s=this.model.getOptions(),a=this.model.getDisplayData(),o=b(this.getOptions(),"color","gradient","enabled");let l=Ve.minNodePadding;s.alluvial.nodePadding>Ve.minNodePadding&&(l=s.alluvial.nodePadding);const c=b(s,"alluvial","nodeAlignment");let u=pv;c===Bt.LEFT?u=RP:c===Bt.RIGHT&&(u=IP);const d=$P().nodeId(y=>y.name).nodeWidth(Ve.nodeWidth).nodePadding(l).nodeAlign(u).extent([[2,30],[r-2,i]]);this.graph=d({nodes:s.alluvial.nodes.map(y=>Object.assign({},y)),links:a.map(y=>Object.assign({},y))}),this.graph.nodes=this.graph.nodes.filter(y=>y.value!==0);const h={};this.graph.nodes.forEach(y=>{const x=y.x0;y.category&&(h[x]=y==null?void 0:y.category)}),n.append("g").classed("header-arrows",!0).selectAll("g").data(Object.keys(h)).join("g").attr("transform",y=>`translate(${y}, 0)`).append("text").attr("id",(y,x)=>this.services.domUtils.generateElementIDString(`alluvial-category-${x}`)).style("font-size","14px").text(y=>h[y]?h[y]:"").attr("y",20).attr("x",(y,x)=>{const S=this.services.domUtils.generateElementIDString(`alluvial-category-${x}`),{width:_}=R.getSVGElementSize(I(`text#${S}`),{useBBox:!0});let A=0;return y+A>=_&&(A=-_+4),A});const p=n.append("g").attr("fill","none").selectAll("g").data(this.graph.links);if(p.exit().remove(),o){const y=b(this.getOptions(),"color","scale");y&&p.enter().append("linearGradient").attr("id",x=>`${this.gradient_id}-link-${x.index}`).attr("gradientUnits","userSpaceOnUse").call(x=>x.append("stop").attr("offset","0%").attr("stop-color",S=>y[S.source.name])).call(x=>x.append("stop").attr("offset","100%").attr("stop-color",S=>y[S.target.name])),p.exit().remove()}p.enter().append("path").classed("link",!0).attr("d",jP()).attr("id",y=>this.services.domUtils.generateElementIDString(`alluvial-line-${y.index}`)).attr("class",y=>s.alluvial.monochrome?this.model.getColorClassName({classNameTypes:[it.STROKE],dataGroupName:0,originalClassName:"link"}):this.model.getColorClassName({classNameTypes:[it.STROKE],dataGroupName:y.source.index,originalClassName:"link"})).style("stroke",y=>o?`url(#${this.gradient_id}-link-${y.index})`:this.model.getFillColor(y.source.name,null,{...y,source:y.source.name,target:y.target.name})).attr("stroke-width",y=>Math.max(1,y.width)).style("stroke-opacity",Ve.opacity.default).attr("aria-label",y=>`${y.source.name} → ${y.target.name} (${y.value}${s.alluvial.units?" "+s.alluvial.units:""})`);const g=n.append("g").selectAll("g").data(this.graph.nodes).enter().append("g").attr("id",y=>this.services.domUtils.generateElementIDString(`alluvial-node-${y.index}`)).classed("node-group",!0).attr("transform",y=>`translate(${y.x0}, ${y.y0})`);g.append("rect").classed("node",!0).attr("height",y=>y.y1-y.y0).attr("width",y=>y.x1-y.x0).attr("fill","black");const m=g.append("g").attr("id",y=>this.services.domUtils.generateElementIDString(`alluvial-node-title-${y.index}`)),{code:v,number:E}=b(s,"locale");m.append("text").attr("id",y=>this.services.domUtils.generateElementIDString(`alluvial-node-text-${y.index}`)).attr("class","node-text").style("font-size","12px").attr("text-anchor","start").attr("fill","white").attr("x",4).attr("dy",13).text(y=>`${y.name} (${E(y.value,v)})`).attr("aria-label",y=>`${y.name} (${y.value})`),m.append("rect").classed("node-text-bg",!0).attr("width",(y,x)=>{const S=this.services.domUtils.generateElementIDString(`alluvial-node-text-${x}`),{width:_}=R.getSVGElementSize(I(`text#${S}`),{useBBox:!0});return _+8}).attr("height",18).attr("stroke-width",2).lower(),m.attr("transform",(y,x)=>{const S=this.services.domUtils.generateElementIDString(`alluvial-node-text-${x}`),{width:_}=R.getSVGElementSize(I(`text#${S}`),{useBBox:!0}),A=(y.y1-y.y0)/2-9;let L=y.x1-y.x0;return y.x1>=_?L=L-(_+16):L+=4,`translate(${L}, ${A})`}),this.addLineEventListener(),this.addNodeEventListener()}addLineEventListener(){const t=this.getOptions(),n=this,{number:r,code:i}=b(this.getOptions(),"locale"),s=Va((a,o="mouseover")=>{const l=n.parent.selectAll("path.link").transition().call(c=>n.services.transitions.setupTransition({transition:c,name:"alluvial-links-mouse-highlight"}));o==="mouseout"?(I(a).lower(),l.style("stroke-opacity",Ve.opacity.default)):l.style("stroke-opacity",function(){return a===this?(I(this).raise(),Ve.opacity.selected):Ve.opacity.unfocus})},33);this.parent.selectAll("path.link").on("mouseover",function(a,o){const l=I(this);s(this,"mouseover"),l.classed("link-hovered",!0);const c=getComputedStyle(this).getPropertyValue("stroke");n.services.events.dispatchEvent(T.Alluvial.LINE_MOUSEOVER,{event:a,element:l,datum:o}),n.services.events.dispatchEvent(T.Tooltip.SHOW,{event:a,hoveredElement:l,items:[{label:o.target.name,value:(r(o.value,i)?`${r(o.value,i)}`:"-")+(t.alluvial.units?` ${t.alluvial.units}`:""),color:c,labelIcon:n.getRightArrowIcon()}]})}).on("mousemove",function(a,o){n.services.events.dispatchEvent(T.Alluvial.LINE_MOUSEMOVE,{event:a,element:I(this),datum:o}),n.services.events.dispatchEvent(T.Tooltip.MOVE,{event:a})}).on("click",function(a,o){n.services.events.dispatchEvent(T.Alluvial.LINE_CLICK,{event:a,element:I(this),datum:o})}).on("mouseout",function(a,o){const l=I(this);s(this,"mouseout"),l.classed("link-hovered",!1),n.services.events.dispatchEvent(T.Alluvial.LINE_MOUSEOUT,{event:a,element:l,datum:o}),n.services.events.dispatchEvent(T.Tooltip.HIDE,{event:a,hoveredElement:l})})}addNodeEventListener(){const t=this,n=Va((r=[],i="mouseover")=>{if(i==="mouseout"||r.length===0){t.parent.selectAll("path.link").classed("link-hovered",!1).data(this.graph.links,a=>a.index).order().style("stroke-opacity",Ve.opacity.default);return}t.parent.selectAll("path.link").transition().call(a=>this.services.transitions.setupTransition({transition:a,name:"alluvial-link-mouse-highlight"})).style("stroke-opacity",function(a){return r.some(o=>o===a.index)?(I(this).classed("link-hovered",!0).raise(),Ve.opacity.selected):Ve.opacity.unfocus})},66);t.parent.selectAll(".node-group").on("mouseover",function(r,i){const s=I(this),a=[];if(t.traverse({link:"sourceLinks",node:"target"},i,a),t.traverse({link:"targetLinks",node:"source"},i,a),a.length){const o=is(s.attr("transform"));if(s.attr("transform",`translate(${o.x-2}, ${o.y})`),s.classed("node-hovered",!0).selectAll("rect.node").attr("width",8),i.x0-2===0){const c=t.services.domUtils.generateElementIDString(`alluvial-node-title-${i.index}`),u=t.parent.select(`g#${c}`),d=is(u.attr("transform"));u.attr("transform",`translate(${d.x+4},${d.y})`)}const l=t.services.domUtils.generateElementIDString(`alluvial-node-text-${i.index}`);t.parent.select(`text#${l}`).style("font-weight","bold"),n(a,"mouseover"),t.services.events.dispatchEvent(T.Alluvial.NODE_MOUSEOVER,{event:r,element:s,datum:i})}}).on("mousemove",function(r,i){t.services.events.dispatchEvent(T.Alluvial.NODE_MOUSEMOVE,{event:r,element:I(this),datum:i}),t.services.events.dispatchEvent(T.Tooltip.MOVE,{event:r})}).on("click",function(r,i){t.services.events.dispatchEvent(T.Alluvial.NODE_CLICK,{event:r,element:I(this),datum:i})}).on("mouseout",function(r,i){const s=I(this),a=is(s.attr("transform"));if(s.classed("node-hovered",!1).attr("transform",`translate(${a.x+2}, ${a.y})`).select("rect.node").attr("width",Ve.nodeWidth),i.x0-2===0){const l=t.services.domUtils.generateElementIDString(`alluvial-node-title-${i.index}`),c=t.parent.select(`g#${l}`),u=is(c.attr("transform"));c.attr("transform",`translate(${u.x-4},${u.y})`)}const o=t.services.domUtils.generateElementIDString(`alluvial-node-text-${i.index}`);t.parent.select(`text#${o}`).style("font-weight","normal"),n([],"mouseout"),t.services.events.dispatchEvent(T.Alluvial.NODE_MOUSEOUT,{event:r,element:s,datum:i}),t.services.events.dispatchEvent(T.Tooltip.HIDE,{hoveredElement:s})})}traverse(t,n,r=[]){n[t.link].map(s=>(r.push(s.index),s[t.node])).forEach(s=>this.traverse(t,s,r))}getRightArrowIcon(){return`
|
|
73
|
+
</li>`).join("")+"</ul>"}valueFormatter(t,n){const r=this.getOptions(),i=b(r,"tooltip","valueFormatter"),{code:s,number:a,date:o}=b(r,"locale");if(i)return i(t,n);if(typeof t.getTime=="function")return o(t,s,{month:"short",day:"numeric",year:"numeric"});try{if(typeof t=="string"&&/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z/.test(t)){const l=new Date(t);return o(l,s,{month:"short",day:"numeric",year:"numeric"})}}catch{}return a(t,s)}render(t=!1){const n=this.getOptions(),r=b(n,"tooltip","enabled");if(r){const i=I(this.services.domUtils.getHolder()),s=b(n,"style","prefix");this.tooltip=R.appendOrSelect(i,`div.${ue}--${s}--tooltip`),this.tooltip.style("max-width",null).attr("role","tooltip"),this.isEventListenerAdded||(this.addTooltipEventListener(),this.isEventListenerAdded=!0),this.tooltip.classed("hidden",!0)}else!r&&this.isEventListenerAdded&&(this.removeTooltipEventListener(),this.isEventListenerAdded=!1)}addOffsetByPlacement(t,n,r){const i=Object.assign({},t);return n==Ut.LEFT?i.left-=r:n==Ut.RIGHT?i.left+=r:n==Ut.TOP?i.top-=r:n==Ut.BOTTOM&&(i.top+=r),i}positionTooltip(t){const n=this.services.domUtils.getHolder(),r=n.offsetWidth,i=n.offsetHeight,s=this.tooltip.node(),a=this.getOptions(),o=b(a,"zoomBar","top","enabled"),l=!!b(t,"detail","noWrap"),c=Array.isArray(b(t,"detail","placements")),u=c?b(t,"detail","placements"):[Ut.RIGHT,Ut.LEFT,Ut.TOP,Ut.BOTTOM];let d,{horizontalOffset:h,defaultOffset:f}=_R;if(this.tooltip.select("div.title-tooltip").classed("title-tooltip-nowrap",l),c){const m=b(t,"detail","event","target"),v=this.services.domUtils.getElementOffset(m,!0);d=this.positionService.findBestPlacementAt(v,s,u,()=>({top:0,left:0,width:r,height:i}));let E=this.positionService.findPosition(m,s,d,()=>this.services.domUtils.getElementOffset(m));E=this.addOffsetByPlacement(E,d,f),this.positionService.setElement(s,E);return}let p=b(t,"detail","mousePosition");if(!p)p=Bn(b(t,"detail","event"),n);else{const m=b(a,"zoomBar","top","type"),v=be.height[m];o&&(p[1]+=v+be.spacerHeight)}p[0]/r>.9?d=Ut.LEFT:p[0]/r<.1?d=Ut.RIGHT:d=this.positionService.findBestPlacementAt({left:p[0],top:p[1]},s,u,()=>({top:void 0,left:void 0,width:r,height:i})),d===Ut.LEFT&&(h*=-1);const g=this.positionService.findPositionAt({left:p[0]+h,top:p[1]},s,d);this.positionService.setElement(s,g)}}class wP extends Tn{zoomIn(t,n,r){let i,s,a;const o=r||qr;t&&(i=t.x,s=t.y,a=2);const{width:l,height:c}=R.getSVGElementSize(this.services.domUtils.getHolder(),{useClientDimensions:!0});n.transition().duration(o.duration).ease(o.ease).attr("transform",`translate(${l/2}, ${c/2}) scale(${a}) translate(${-i},${-s})`),this.services.events.dispatchEvent(T.CanvasZoom.CANVAS_ZOOM_IN,{element:I(t)})}zoomOut(t,n){const r=n||qr;t.transition().duration(r.duration).ease(r.ease).attr("transform",""),this.services.events.dispatchEvent(T.CanvasZoom.CANVAS_ZOOM_OUT)}}class MP extends Tn{init(){this.documentFragment=document.createDocumentFragment()}addEventListener(t,n){this.documentFragment.addEventListener(t,n)}removeEventListener(t,n){this.documentFragment.removeEventListener(t,n)}dispatchEvent(t,n){let r;n?r=new CustomEvent(t,{detail:n}):(r=document.createEvent("Event"),r.initEvent(t,!1,!0)),this.documentFragment.dispatchEvent(r)}}class AP extends Tn{constructor(t,n){super(t,n)}downloadCSV(t,n){const r=document.createElement("a"),i="text/csv;encoding:utf-8";if(navigator.msSaveBlob)navigator.msSaveBlob(new Blob([t],{type:i}),n);else if(URL&&"download"in r){const s=URL.createObjectURL(new Blob([t],{type:i}));r.href=s,r.setAttribute("download",n),document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(s)}else location.href=`data:application/octet-stream,${encodeURIComponent(t)}`}downloadImage(t,n){const r=document.createElement("a");r.download=n,r.href=t,document.body.appendChild(r),r.click(),document.body.removeChild(r)}}class ms extends Tn{static appendOrUpdateLinearGradient(t){let n=t.svg.select(`defs linearGradient#${t.id}`);n.empty()&&(n=t.svg.append("defs").append("linearGradient").attr("id",t.id).attr("x1",t.x1).attr("x2",t.x2).attr("y1",t.y1).attr("y2",t.y2)),n.selectAll("stop").remove(),n.selectAll("stop").data(t.stops).enter().append("stop").attr("offset",r=>r.offset).style("stop-color",r=>r.color).style("stop-opacity",r=>r.opacity)}static getOffsetRatio(t){return(Math.abs(t[1])*100/Math.abs(t[0]-t[1])).toFixed(2)+"%"}static getStops(t,n){const r=t[0]<0&&t[1]>0;let i=[{offset:"0%",color:n,opacity:"0.6"},{offset:"80%",color:n,opacity:"0"}];return r&&(i=[{offset:"0%",color:n,opacity:"0.6"},{offset:ms.getOffsetRatio(t),color:n,opacity:"0"},{offset:"100%",color:n,opacity:"0.6"}]),i}}class CP extends Tn{constructor(){super(...arguments),this.pendingTransitions={}}init(){var t;(t=this.services.events)==null||t.addEventListener(T.Model.UPDATE,()=>{this.pendingTransitions={}})}setupTransition({transition:t,name:n,animate:r}){return this.pendingTransitions[t._id]=t,t.on("end interrupt cancel",()=>{delete this.pendingTransitions[t._id]}),this.model.getOptions().animations===!1||r===!1?t.duration(0):t.duration(b(tm,n,"duration")||tm.default.duration)}getPendingTransitions(){return this.pendingTransitions}}class qe{constructor(t,n){this.components=[],this.services={canvasZoom:wP,domUtils:R,events:MP,files:AP,gradientUtils:ms,transitions:CP},this.model=new rn(this.services)}init(t,n){this.model.set({holder:t},{skipUpdate:!0}),Object.keys(this.services).forEach(r=>{const i=this.services[r];this.services[r]=new i(this.model,this.services)}),this.services.events.addEventListener(T.Model.UPDATE,r=>{const i=!!b(r,"detail","animate");this.update(i)}),this.model.setData(n.data),this.services.events.addEventListener(T.Chart.RESIZE,()=>{this.update(!1)}),this.components=this.getComponents(),this.update()}getComponents(){return console.error("getComponents() method is not implemented"),[]}update(t=!0){if(!this.components)return;Object.keys(this.services).forEach(i=>{this.services[i].update()}),this.components.forEach(i=>i.render(t));const n=this.services.transitions.getPendingTransitions(),r=Object.keys(n).map(i=>n[i].end().catch(a=>a));Promise.all(r).then(()=>this.services.events.dispatchEvent(T.Chart.RENDER_FINISHED))}destroy(){this.components.forEach(t=>t.destroy()),this.services.domUtils.getHolder().remove(),this.model.set({destroyed:!0},{skipUpdate:!0})}getChartComponents(t,n){const r=this.model.getOptions(),i=b(r,"toolbar","enabled"),s={id:"legend",components:[new Ru(this.model,this.services)],growth:ct.PREFERRED},a=b(r,"canvasZoom","enabled");a&&a===!0&&t.push(new OP(this.model,this.services));const o=!!this.model.getOptions().title,l={id:"title",components:[new gs(this.model,this.services)],growth:ct.STRETCH},c={id:"toolbar",components:[new Kr(this.model,this.services)],growth:ct.PREFERRED},u={id:"header",components:[new ae(this.model,this.services,[l,...i?[c]:[]],{direction:At.ROW,alignItems:ir.CENTER})],growth:ct.PREFERRED},d={id:"graph-frame",components:t,growth:ct.STRETCH,renderType:b(n,"graphFrameRenderType")||tt.SVG},h=b(n,"excludeLegend")!==!0&&r.legend.enabled!==!1;let f=At.COLUMN;if(h){const v=b(r,"legend","position");v==="left"?(f=At.ROW,r.legend.orientation||(r.legend.orientation=Wr.VERTICAL)):v==="right"?(f=At.ROW_REVERSE,r.legend.orientation||(r.legend.orientation=Wr.VERTICAL)):v==="bottom"&&(f=At.COLUMN_REVERSE)}const p={id:"spacer",components:[new On(this.model,this.services)],growth:ct.PREFERRED},g={id:"full-frame",components:[new ae(this.model,this.services,[...h?[s]:[],...h?[p]:[],d],{direction:f})],growth:ct.STRETCH},m=[];if(o||i){m.push(u);const v={id:"spacer",components:[new On(this.model,this.services,i?{size:15}:void 0)],growth:ct.PREFERRED};m.push(v)}return m.push(g),[new Iu(this.model,this.services),new po(this.model,this.services),new ae(this.model,this.services,m,{direction:At.COLUMN})]}}class ur extends rn{constructor(t){super(t),this.axisFlavor=rs.DEFAULT}assignRangeAndDomains(){const{cartesianScales:t}=this.services,n=this.getOptions(),r=t.isDualAxes(),i={primaryDomain:t.domainAxisPosition,primaryRange:t.rangeAxisPosition,secondaryDomain:null,secondaryRange:null};return r&&(i.secondaryDomain=t.secondaryDomainAxisPosition,i.secondaryRange=t.secondaryRangeAxisPosition),Object.keys(i).forEach(s=>{const a=i[s];t.scales[a]?i[s]={position:a,label:t.getScaleLabel(a),identifier:b(n,"axes",a,"mapsTo")}:i[s]=null}),i}getTabularDataArray(){const t=this.getDisplayData(),n=this.getOptions(),{groupMapsTo:r}=n.data,{primaryDomain:i,primaryRange:s,secondaryDomain:a,secondaryRange:o}=this.assignRangeAndDomains(),{number:l,code:c}=b(this.getOptions(),"locale"),u=["Group",i.label,s.label,...a?[a.label]:[],...o?[o.label]:[]],d=t.map(h=>[h[r],h[i.identifier]===null?"–":h[i.identifier],h[s.identifier]===null||isNaN(h[s.identifier])?"–":l(h[s.identifier],c),...a?[h[a.identifier]===null?"–":h[a.identifier]]:[],...o?[h[o.identifier]===null||isNaN(h[o.identifier])?"–":h[o.identifier]]:[]]);return super.formatTable({headers:u,cells:d})}setData(t){let n;if(t&&(n=super.setData(t),b(this.getOptions(),"zoomBar",G.TOP,"enabled"))){const r=b(this.getOptions(),"zoomBar",G.TOP,"data");this.setZoomBarData(r)}return n}setZoomBarData(t){const n=t?this.sanitize(yn(t)):this.getDisplayData();let r=n;const{cartesianScales:i}=this.services;if(n&&i.domainAxisPosition&&i.rangeAxisPosition){const s=i.getDomainIdentifier(),a=i.getRangeIdentifier();let o=n.map(l=>l[s].getTime());o=Qi(o).sort(),r=o.map(l=>{let c=0;const u={};return n.forEach(d=>{d[s].getTime()===l&&(c+=d[a])}),u[s]=new Date(l),u[a]=c,u})}this.set({zoomBarData:r})}getZoomBarData(){return this.get("zoomBarData")}sanitizeDateValues(t){const n=this.getOptions();if(!n.axes)return t;const r=[];return Object.keys(G).forEach(i=>{const s=G[i],a=n.axes[s];if(a&&a.scaleType===Q.TIME){const o=a.mapsTo;(o!==null||o!==void 0)&&r.push(o)}}),r.length>0&&t.forEach(i=>{r.forEach(s=>{b(i,s,"getTime")===null&&(i[s]=new Date(i[s]))})}),t}sanitize(t){return t=super.sanitize(t),t=this.sanitizeDateValues(t),t}}class DP extends ur{constructor(t){super(t)}getTabularDataArray(){const t=this.getDisplayData(),{number:n,code:r}=b(this.getOptions(),"locale");t.sort((a,o)=>a.source.localeCompare(o.source));const i=["Source","Target","Value"],s=[...t.map(a=>[a.source,a.target,a.value===null?"–":n(a.value,r)])];return super.formatTable({headers:i,cells:s})}}function fv(e,t){let n;if(t===void 0)for(const r of e)r!=null&&(n<r||n===void 0&&r>=r)&&(n=r);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n<i||n===void 0&&i>=i)&&(n=i)}return n}function LP(e,t){let n;if(t===void 0)for(const r of e)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n>i||n===void 0&&i>=i)&&(n=i)}return n}function ku(e,t){let n=0;if(t===void 0)for(let r of e)(r=+r)&&(n+=r);else{let r=-1;for(let i of e)(i=+t(i,++r,e))&&(n+=i)}return n}function RP(e){return e.depth}function IP(e,t){return t-1-e.height}function pv(e,t){return e.sourceLinks.length?e.depth:t-1}function mo(e){return function(){return e}}function gv(e,t){return vo(e.source,t.source)||e.index-t.index}function mv(e,t){return vo(e.target,t.target)||e.index-t.index}function vo(e,t){return e.y0-t.y0}function Pu(e){return e.value}function kP(e){return e.index}function PP(e){return e.nodes}function NP(e){return e.links}function vv(e,t){const n=e.get(t);if(!n)throw new Error("missing: "+t);return n}function yv({nodes:e}){for(const t of e){let n=t.y0,r=n;for(const i of t.sourceLinks)i.y0=n+i.width/2,n+=i.width;for(const i of t.targetLinks)i.y1=r+i.width/2,r+=i.width}}function $P(){let e=0,t=0,n=1,r=1,i=24,s=8,a,o=kP,l=pv,c,u,d=PP,h=NP,f=6;function p(){const w={nodes:d.apply(null,arguments),links:h.apply(null,arguments)};return g(w),m(w),v(w),E(w),S(w),yv(w),w}p.update=function(w){return yv(w),w},p.nodeId=function(w){return arguments.length?(o=typeof w=="function"?w:mo(w),p):o},p.nodeAlign=function(w){return arguments.length?(l=typeof w=="function"?w:mo(w),p):l},p.nodeSort=function(w){return arguments.length?(c=w,p):c},p.nodeWidth=function(w){return arguments.length?(i=+w,p):i},p.nodePadding=function(w){return arguments.length?(s=a=+w,p):s},p.nodes=function(w){return arguments.length?(d=typeof w=="function"?w:mo(w),p):d},p.links=function(w){return arguments.length?(h=typeof w=="function"?w:mo(w),p):h},p.linkSort=function(w){return arguments.length?(u=w,p):u},p.size=function(w){return arguments.length?(e=t=0,n=+w[0],r=+w[1],p):[n-e,r-t]},p.extent=function(w){return arguments.length?(e=+w[0][0],n=+w[1][0],t=+w[0][1],r=+w[1][1],p):[[e,t],[n,r]]},p.iterations=function(w){return arguments.length?(f=+w,p):f};function g({nodes:w,links:U}){for(const[$,N]of w.entries())N.index=$,N.sourceLinks=[],N.targetLinks=[];const F=new Map(w.map(($,N)=>[o($,N,w),$]));for(const[$,N]of U.entries()){N.index=$;let{source:j,target:q}=N;typeof j!="object"&&(j=N.source=vv(F,j)),typeof q!="object"&&(q=N.target=vv(F,q)),j.sourceLinks.push(N),q.targetLinks.push(N)}if(u!=null)for(const{sourceLinks:$,targetLinks:N}of w)$.sort(u),N.sort(u)}function m({nodes:w}){for(const U of w)U.value=U.fixedValue===void 0?Math.max(ku(U.sourceLinks,Pu),ku(U.targetLinks,Pu)):U.fixedValue}function v({nodes:w}){const U=w.length;let F=new Set(w),$=new Set,N=0;for(;F.size;){for(const j of F){j.depth=N;for(const{target:q}of j.sourceLinks)$.add(q)}if(++N>U)throw new Error("circular link");F=$,$=new Set}}function E({nodes:w}){const U=w.length;let F=new Set(w),$=new Set,N=0;for(;F.size;){for(const j of F){j.height=N;for(const{source:q}of j.targetLinks)$.add(q)}if(++N>U)throw new Error("circular link");F=$,$=new Set}}function y({nodes:w}){const U=fv(w,N=>N.depth)+1,F=(n-e-i)/(U-1),$=new Array(U);for(const N of w){const j=Math.max(0,Math.min(U-1,Math.floor(l.call(null,N,U))));N.layer=j,N.x0=e+j*F,N.x1=N.x0+i,$[j]?$[j].push(N):$[j]=[N]}if(c)for(const N of $)N.sort(c);return $}function x(w){const U=LP(w,F=>(r-t-(F.length-1)*a)/ku(F,Pu));for(const F of w){let $=t;for(const N of F){N.y0=$,N.y1=$+N.value*U,$=N.y1+a;for(const j of N.sourceLinks)j.width=j.value*U}$=(r-$+a)/(F.length+1);for(let N=0;N<F.length;++N){const j=F[N];j.y0+=$*(N+1),j.y1+=$*(N+1)}H(F)}}function S(w){const U=y(w);a=Math.min(s,(r-t)/(fv(U,F=>F.length)-1)),x(U);for(let F=0;F<f;++F){const $=Math.pow(.99,F),N=Math.max(1-$,(F+1)/f);A(U,$,N),_(U,$,N)}}function _(w,U,F){for(let $=1,N=w.length;$<N;++$){const j=w[$];for(const q of j){let at=0,nt=0;for(const{source:mt,value:Z}of q.targetLinks){let et=Z*(q.layer-mt.layer);at+=P(mt,q)*et,nt+=et}if(!(nt>0))continue;let dt=(at/nt-q.y0)*U;q.y0+=dt,q.y1+=dt,O(q)}c===void 0&&j.sort(vo),L(j,F)}}function A(w,U,F){for(let $=w.length,N=$-2;N>=0;--N){const j=w[N];for(const q of j){let at=0,nt=0;for(const{target:mt,value:Z}of q.sourceLinks){let et=Z*(mt.layer-q.layer);at+=M(q,mt)*et,nt+=et}if(!(nt>0))continue;let dt=(at/nt-q.y0)*U;q.y0+=dt,q.y1+=dt,O(q)}c===void 0&&j.sort(vo),L(j,F)}}function L(w,U){const F=w.length>>1,$=w[F];D(w,$.y0-a,F-1,U),B(w,$.y1+a,F+1,U),D(w,r,w.length-1,U),B(w,t,0,U)}function B(w,U,F,$){for(;F<w.length;++F){const N=w[F],j=(U-N.y0)*$;j>1e-6&&(N.y0+=j,N.y1+=j),U=N.y1+a}}function D(w,U,F,$){for(;F>=0;--F){const N=w[F],j=(N.y1-U)*$;j>1e-6&&(N.y0-=j,N.y1-=j),U=N.y0-a}}function O({sourceLinks:w,targetLinks:U}){if(u===void 0){for(const{source:{sourceLinks:F}}of U)F.sort(mv);for(const{target:{targetLinks:F}}of w)F.sort(gv)}}function H(w){if(u===void 0)for(const{sourceLinks:U,targetLinks:F}of w)U.sort(mv),F.sort(gv)}function P(w,U){let F=w.y0-(w.sourceLinks.length-1)*a/2;for(const{target:$,width:N}of w.sourceLinks){if($===U)break;F+=N+a}for(const{source:$,width:N}of U.targetLinks){if($===w)break;F-=N}return F}function M(w,U){let F=U.y0-(U.targetLinks.length-1)*a/2;for(const{source:$,width:N}of U.targetLinks){if($===w)break;F+=N+a}for(const{target:$,width:N}of w.sourceLinks){if($===U)break;F-=N}return F}return p}var Nu=Math.PI,$u=2*Nu,hr=1e-6,FP=$u-hr;function Fu(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function Ev(){return new Fu}Fu.prototype=Ev.prototype={constructor:Fu,moveTo:function(e,t){this._+="M"+(this._x0=this._x1=+e)+","+(this._y0=this._y1=+t)},closePath:function(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(e,t){this._+="L"+(this._x1=+e)+","+(this._y1=+t)},quadraticCurveTo:function(e,t,n,r){this._+="Q"+ +e+","+ +t+","+(this._x1=+n)+","+(this._y1=+r)},bezierCurveTo:function(e,t,n,r,i,s){this._+="C"+ +e+","+ +t+","+ +n+","+ +r+","+(this._x1=+i)+","+(this._y1=+s)},arcTo:function(e,t,n,r,i){e=+e,t=+t,n=+n,r=+r,i=+i;var s=this._x1,a=this._y1,o=n-e,l=r-t,c=s-e,u=a-t,d=c*c+u*u;if(i<0)throw new Error("negative radius: "+i);if(this._x1===null)this._+="M"+(this._x1=e)+","+(this._y1=t);else if(d>hr)if(!(Math.abs(u*o-l*c)>hr)||!i)this._+="L"+(this._x1=e)+","+(this._y1=t);else{var h=n-s,f=r-a,p=o*o+l*l,g=h*h+f*f,m=Math.sqrt(p),v=Math.sqrt(d),E=i*Math.tan((Nu-Math.acos((p+d-g)/(2*m*v)))/2),y=E/v,x=E/m;Math.abs(y-1)>hr&&(this._+="L"+(e+y*c)+","+(t+y*u)),this._+="A"+i+","+i+",0,0,"+ +(u*h>c*f)+","+(this._x1=e+x*o)+","+(this._y1=t+x*l)}},arc:function(e,t,n,r,i,s){e=+e,t=+t,n=+n,s=!!s;var a=n*Math.cos(r),o=n*Math.sin(r),l=e+a,c=t+o,u=1^s,d=s?r-i:i-r;if(n<0)throw new Error("negative radius: "+n);this._x1===null?this._+="M"+l+","+c:(Math.abs(this._x1-l)>hr||Math.abs(this._y1-c)>hr)&&(this._+="L"+l+","+c),n&&(d<0&&(d=d%$u+$u),d>FP?this._+="A"+n+","+n+",0,1,"+u+","+(e-a)+","+(t-o)+"A"+n+","+n+",0,1,"+u+","+(this._x1=l)+","+(this._y1=c):d>hr&&(this._+="A"+n+","+n+",0,"+ +(d>=Nu)+","+u+","+(this._x1=e+n*Math.cos(i))+","+(this._y1=t+n*Math.sin(i))))},rect:function(e,t,n,r){this._+="M"+(this._x0=this._x1=+e)+","+(this._y0=this._y1=+t)+"h"+ +n+"v"+ +r+"h"+-n+"Z"},toString:function(){return this._}};function bv(e){return function(){return e}}function UP(e){return e[0]}function BP(e){return e[1]}var HP=Array.prototype.slice;function GP(e){return e.source}function VP(e){return e.target}function zP(e){var t=GP,n=VP,r=UP,i=BP,s=null;function a(){var o,l=HP.call(arguments),c=t.apply(this,l),u=n.apply(this,l);if(s||(s=o=Ev()),e(s,+r.apply(this,(l[0]=c,l)),+i.apply(this,l),+r.apply(this,(l[0]=u,l)),+i.apply(this,l)),o)return s=null,o+""||null}return a.source=function(o){return arguments.length?(t=o,a):t},a.target=function(o){return arguments.length?(n=o,a):n},a.x=function(o){return arguments.length?(r=typeof o=="function"?o:bv(+o),a):r},a.y=function(o){return arguments.length?(i=typeof o=="function"?o:bv(+o),a):i},a.context=function(o){return arguments.length?(s=o??null,a):s},a}function WP(e,t,n,r,i){e.moveTo(t,n),e.bezierCurveTo(t=(t+r)/2,n,t,i,r,i)}function YP(){return zP(WP)}function qP(e){return[e.source.x1,e.y0]}function XP(e){return[e.target.x0,e.y1]}function jP(){return YP().source(qP).target(XP)}class ZP extends pt{constructor(){super(...arguments),this.type="alluvial",this.renderType=tt.SVG,this.gradient_id="gradient-id-"+Math.floor(Math.random()*99999999999)}render(t=!0){const n=this.getComponentContainer({withinChartClip:!0});n.html("");const{width:r,height:i}=R.getSVGElementSize(n,{useAttrs:!0});if(r<1||i<1)return;const s=this.model.getOptions(),a=this.model.getDisplayData(),o=b(this.getOptions(),"color","gradient","enabled");let l=Ve.minNodePadding;s.alluvial.nodePadding>Ve.minNodePadding&&(l=s.alluvial.nodePadding);const c=b(s,"alluvial","nodeAlignment");let u=pv;c===Bt.LEFT?u=RP:c===Bt.RIGHT&&(u=IP);const d=$P().nodeId(y=>y.name).nodeWidth(Ve.nodeWidth).nodePadding(l).nodeAlign(u).extent([[2,30],[r-2,i]]);this.graph=d({nodes:s.alluvial.nodes.map(y=>Object.assign({},y)),links:a.map(y=>Object.assign({},y))}),this.graph.nodes=this.graph.nodes.filter(y=>y.value!==0);const h={};this.graph.nodes.forEach(y=>{const x=y.x0;y.category&&(h[x]=y==null?void 0:y.category)}),n.append("g").classed("header-arrows",!0).selectAll("g").data(Object.keys(h)).join("g").attr("transform",y=>`translate(${y}, 0)`).append("text").attr("id",(y,x)=>this.services.domUtils.generateElementIDString(`alluvial-category-${x}`)).style("font-size","14px").text(y=>h[y]?h[y]:"").attr("y",20).attr("x",(y,x)=>{const S=this.services.domUtils.generateElementIDString(`alluvial-category-${x}`),{width:_}=R.getSVGElementSize(I(`text#${S}`),{useBBox:!0});let A=0;return y+A>=_&&(A=-_+4),A});const p=n.append("g").attr("fill","none").selectAll("g").data(this.graph.links);if(p.exit().remove(),o){const y=b(this.getOptions(),"color","scale");y&&p.enter().append("linearGradient").attr("id",x=>`${this.gradient_id}-link-${x.index}`).attr("gradientUnits","userSpaceOnUse").call(x=>x.append("stop").attr("offset","0%").attr("stop-color",S=>y[S.source.name])).call(x=>x.append("stop").attr("offset","100%").attr("stop-color",S=>y[S.target.name])),p.exit().remove()}p.enter().append("path").classed("link",!0).attr("d",jP()).attr("id",y=>this.services.domUtils.generateElementIDString(`alluvial-line-${y.index}`)).attr("class",y=>s.alluvial.monochrome?this.model.getColorClassName({classNameTypes:[it.STROKE],dataGroupName:0,originalClassName:"link"}):this.model.getColorClassName({classNameTypes:[it.STROKE],dataGroupName:y.source.index,originalClassName:"link"})).style("stroke",y=>o?`url(#${this.gradient_id}-link-${y.index})`:this.model.getFillColor(y.source.name,null,{...y,source:y.source.name,target:y.target.name})).attr("stroke-width",y=>Math.max(1,y.width)).style("stroke-opacity",Ve.opacity.default).attr("aria-label",y=>`${y.source.name} → ${y.target.name} (${y.value}${s.alluvial.units?" "+s.alluvial.units:""})`);const g=n.append("g").selectAll("g").data(this.graph.nodes).enter().append("g").attr("id",y=>this.services.domUtils.generateElementIDString(`alluvial-node-${y.index}`)).classed("node-group",!0).attr("transform",y=>`translate(${y.x0}, ${y.y0})`);g.append("rect").classed("node",!0).attr("height",y=>y.y1-y.y0).attr("width",y=>y.x1-y.x0).attr("fill","black");const m=g.append("g").attr("id",y=>this.services.domUtils.generateElementIDString(`alluvial-node-title-${y.index}`)),{code:v,number:E}=b(s,"locale");m.append("text").attr("id",y=>this.services.domUtils.generateElementIDString(`alluvial-node-text-${y.index}`)).attr("class","node-text").style("font-size","12px").attr("text-anchor","start").attr("fill","white").attr("x",4).attr("dy",13).text(y=>`${y.name} (${E(y.value,v)})`).attr("aria-label",y=>`${y.name} (${y.value})`),m.append("rect").classed("node-text-bg",!0).attr("width",(y,x)=>{const S=this.services.domUtils.generateElementIDString(`alluvial-node-text-${x}`),{width:_}=R.getSVGElementSize(I(`text#${S}`),{useBBox:!0});return _+8}).attr("height",18).attr("stroke-width",2).lower(),m.attr("transform",(y,x)=>{const S=this.services.domUtils.generateElementIDString(`alluvial-node-text-${x}`),{width:_}=R.getSVGElementSize(I(`text#${S}`),{useBBox:!0}),A=(y.y1-y.y0)/2-9;let L=y.x1-y.x0;return y.x1>=_?L=L-(_+16):L+=4,`translate(${L}, ${A})`}),this.addLineEventListener(),this.addNodeEventListener()}addLineEventListener(){const t=this.getOptions(),n=this,{number:r,code:i}=b(this.getOptions(),"locale"),s=Va((a,o="mouseover")=>{const l=n.parent.selectAll("path.link").transition().call(c=>n.services.transitions.setupTransition({transition:c,name:"alluvial-links-mouse-highlight"}));o==="mouseout"?(I(a).lower(),l.style("stroke-opacity",Ve.opacity.default)):l.style("stroke-opacity",function(){return a===this?(I(this).raise(),Ve.opacity.selected):Ve.opacity.unfocus})},33);this.parent.selectAll("path.link").on("mouseover",function(a,o){const l=I(this);s(this,"mouseover"),l.classed("link-hovered",!0);const c=getComputedStyle(this).getPropertyValue("stroke");n.services.events.dispatchEvent(T.Alluvial.LINE_MOUSEOVER,{event:a,element:l,datum:o}),n.services.events.dispatchEvent(T.Tooltip.SHOW,{event:a,hoveredElement:l,items:[{label:o.target.name,value:(r(o.value,i)?`${r(o.value,i)}`:"-")+(t.alluvial.units?` ${t.alluvial.units}`:""),color:c,labelIcon:n.getRightArrowIcon()}]})}).on("mousemove",function(a,o){n.services.events.dispatchEvent(T.Alluvial.LINE_MOUSEMOVE,{event:a,element:I(this),datum:o}),n.services.events.dispatchEvent(T.Tooltip.MOVE,{event:a})}).on("click",function(a,o){n.services.events.dispatchEvent(T.Alluvial.LINE_CLICK,{event:a,element:I(this),datum:o})}).on("mouseout",function(a,o){const l=I(this);s(this,"mouseout"),l.classed("link-hovered",!1),n.services.events.dispatchEvent(T.Alluvial.LINE_MOUSEOUT,{event:a,element:l,datum:o}),n.services.events.dispatchEvent(T.Tooltip.HIDE,{event:a,hoveredElement:l})})}addNodeEventListener(){const t=this,n=Va((r=[],i="mouseover")=>{if(i==="mouseout"||r.length===0){t.parent.selectAll("path.link").classed("link-hovered",!1).data(this.graph.links,a=>a.index).order().style("stroke-opacity",Ve.opacity.default);return}t.parent.selectAll("path.link").transition().call(a=>this.services.transitions.setupTransition({transition:a,name:"alluvial-link-mouse-highlight"})).style("stroke-opacity",function(a){return r.some(o=>o===a.index)?(I(this).classed("link-hovered",!0).raise(),Ve.opacity.selected):Ve.opacity.unfocus})},66);t.parent.selectAll(".node-group").on("mouseover",function(r,i){const s=I(this),a=[];if(t.traverse({link:"sourceLinks",node:"target"},i,a),t.traverse({link:"targetLinks",node:"source"},i,a),a.length){const o=is(s.attr("transform"));if(s.attr("transform",`translate(${o.x-2}, ${o.y})`),s.classed("node-hovered",!0).selectAll("rect.node").attr("width",8),i.x0-2===0){const c=t.services.domUtils.generateElementIDString(`alluvial-node-title-${i.index}`),u=t.parent.select(`g#${c}`),d=is(u.attr("transform"));u.attr("transform",`translate(${d.x+4},${d.y})`)}const l=t.services.domUtils.generateElementIDString(`alluvial-node-text-${i.index}`);t.parent.select(`text#${l}`).style("font-weight","bold"),n(a,"mouseover"),t.services.events.dispatchEvent(T.Alluvial.NODE_MOUSEOVER,{event:r,element:s,datum:i})}}).on("mousemove",function(r,i){t.services.events.dispatchEvent(T.Alluvial.NODE_MOUSEMOVE,{event:r,element:I(this),datum:i}),t.services.events.dispatchEvent(T.Tooltip.MOVE,{event:r})}).on("click",function(r,i){t.services.events.dispatchEvent(T.Alluvial.NODE_CLICK,{event:r,element:I(this),datum:i})}).on("mouseout",function(r,i){const s=I(this),a=is(s.attr("transform"));if(s.classed("node-hovered",!1).attr("transform",`translate(${a.x+2}, ${a.y})`).select("rect.node").attr("width",Ve.nodeWidth),i.x0-2===0){const l=t.services.domUtils.generateElementIDString(`alluvial-node-title-${i.index}`),c=t.parent.select(`g#${l}`),u=is(c.attr("transform"));c.attr("transform",`translate(${u.x-4},${u.y})`)}const o=t.services.domUtils.generateElementIDString(`alluvial-node-text-${i.index}`);t.parent.select(`text#${o}`).style("font-weight","normal"),n([],"mouseout"),t.services.events.dispatchEvent(T.Alluvial.NODE_MOUSEOUT,{event:r,element:s,datum:i}),t.services.events.dispatchEvent(T.Tooltip.HIDE,{hoveredElement:s})})}traverse(t,n,r=[]){n[t.link].map(s=>(r.push(s.index),s[t.node])).forEach(s=>this.traverse(t,s,r))}getRightArrowIcon(){return`
|
|
74
74
|
<svg xmlns="http://www.w3.org/2000/svg" class="arrow-right" width="32" height="32" viewBox="0 0 32 32">
|
|
75
75
|
<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"/>
|
|
76
76
|
<rect width="32" height="32"/>
|
|
@@ -78,9 +78,9 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
78
78
|
<stop class="${s}" offset="${c}"></stop>
|
|
79
79
|
<stop class="${a}" offset="${c+.2}"></stop>
|
|
80
80
|
<stop class="${s}" offset="${c+2*.2}"></stop>
|
|
81
|
-
`;h.html(f),p();function p(){h.attr("gradientTransform",`translate(${c-3*.2*l}, 0)`).transition().duration(2e3).delay(1e3).ease(hb).attr("gradientTransform",`translate(${u+3*.2*l}, 0)`).on("end",p)}}removeSkeleton(){this.parent.select(".chart-skeleton").remove()}}class xN extends de{constructor(t,n){super(t,n),this.model.setOptions(Pt(yn(Ct.areaChart),n.options)),this.init(t,n)}getComponents(){const t=[new fe(this.model,this.services),new Te(this.model,this.services),new Pn(this.model,this.services),new ti(this.model,this.services),new Dv(this.model,this.services),new an(this.model,this.services,{fadeInOnChartHolderMouseover:!0,handleThresholds:!0}),new oe(this.model,this.services,{skeleton:Ht.GRID})];return this.getAxisChartComponents(t)}}class _N extends ur{constructor(t){super(t)}getBoxQuartiles(t){return{q_25:Co(t,.25),q_50:Co(t,.5),q_75:Co(t,.75)}}getBoxplotData(){const t=this.getOptions(),{groupMapsTo:n}=t.data,r=this.getGroupedData(),i=[];for(const{name:s,data:a}of r){const o=this.services.cartesianScales.getRangeIdentifier(),l=a.map(y=>y[o]).sort(Re),c={[n]:s,counts:l,quartiles:this.getBoxQuartiles(l),outliers:null,whiskers:null},u=c.quartiles.q_25,d=c.quartiles.q_75,h=(d-u)*1.5,f=u-h,p=d+h,g=[],m=[];for(const y of l)y<f||y>p?g.push(y):m.push(y);c.outliers=g;const v=An(m),E=Un(m);c.whiskers={min:v||An([c.quartiles.q_25,c.quartiles.q_50,c.quartiles.q_75]),max:E||Un([c.quartiles.q_25,c.quartiles.q_50,c.quartiles.q_75])},i.push(c)}return i}getTabularDataArray(){const t=this.getOptions(),{groupMapsTo:n}=t.data,r=this.getBoxplotData(),{number:i,code:s}=b(t,"locale"),a=["Group","Minimum","Q1","Median","Q3","Maximum","IQR","Outlier(s)"],o=[...r.map(l=>{let c=b(l,"outliers");return(c===null||c.length===0)&&(c=["–"]),[l[n],b(l,"whiskers","min")!==null?i(b(l,"whiskers","min"),s):"–",b(l,"quartiles","q_25")!==null?i(b(l,"quartiles","q_25"),s):"–",b(l,"quartiles","q_50")!==null?i(b(l,"quartiles","q_50"),s):"–",b(l,"quartiles","q_75")!==null?i(b(l,"quartiles","q_75"),s):"–",b(l,"whiskers","max")!==null?i(b(l,"whiskers","max"),s):"–",b(l,"quartiles","q_75")!==null&&b(l,"quartiles","q_25")!==null?(i(b(l,"quartiles","q_75")-b(l,"quartiles","q_25")),s):"–",c.map(u=>i(u,s)).join(",")]})];return super.formatTable({headers:a,cells:o})}setColorClassNames(){const n=b(this.getOptions(),"color","pairing");let r=b(n,"option");const i=Kg.pairingOptions;r=r<=i["1-color"]?r:1;const s=this.allDataGroups.map(()=>`1-${r}-1`);this.colorClassNames=fa().range(s).domain(this.allDataGroups)}}class SN extends pt{constructor(){super(...arguments),this.type="boxplot",this.renderType=tt.SVG}render(t){const n=this.getComponentContainer({withinChartClip:!0}),r=this.getOptions(),{groupMapsTo:i}=r.data,s=this.model.getDataGroupNames(),a=this.services.cartesianScales.getMainXScale(),o=this.services.cartesianScales.getMainYScale(),[l,c]=a.range(),[u,d]=o.range(),h=c-l,f=u-d;if(h===0)return;const{cartesianScales:p}=this.services,g=p.getOrientation(),m=g===Wt.VERTICAL,[v,E]=_n(O=>this.services.cartesianScales.getDomainValue(O),O=>this.services.cartesianScales.getRangeValue(O),g),y=Math.floor((m?h:f)/s.length),x=Math.min(y/2,16),S=this.model.getBoxplotData(),_=n.selectAll(".box-group").data(S);_.exit().remove();const A=_.enter().append("g").attr("class","box-group"),L=_.merge(A);A.append("path").merge(_.select("path.vertical-line.start")).attr("class",()=>this.model.getColorClassName({classNameTypes:[it.STROKE],originalClassName:"vertical-line start"})).attr("stroke-width",De.strokeWidth.default).attr("fill","none").transition().call(O=>this.services.transitions.setupTransition({transition:O,name:"boxplot-update-verticalstartline",animate:t})).attr("d",O=>{const H=p.getDomainValue(O[i]),P=H,M=p.getRangeValue(O.whiskers.min),w=p.getRangeValue(O.quartiles.q_25);return ie({x0:H,x1:P,y0:M,y1:w},g)}),A.append("path").merge(_.select("path.vertical-line.end")).attr("class",()=>this.model.getColorClassName({classNameTypes:[it.STROKE],originalClassName:"vertical-line end"})).attr("stroke-width",De.strokeWidth.default).attr("fill","none").transition().call(O=>this.services.transitions.setupTransition({transition:O,name:"boxplot-update-verticalendline",animate:t})).attr("d",O=>{const H=p.getDomainValue(O[i]),P=H,M=p.getRangeValue(O.whiskers.max),w=p.getRangeValue(O.quartiles.q_75);return ie({x0:H,x1:P,y0:M,y1:w},g)}),A.append("path").merge(_.select("path.box")).attr("class",()=>this.model.getColorClassName({classNameTypes:[it.FILL,it.STROKE],originalClassName:"box"})).attr("fill-opacity",De.box.opacity.default).attr("stroke-width",De.strokeWidth.default).attr("role",ut.GRAPHICS_SYMBOL).attr("aria-roledescription","box").attr("aria-label",O=>O[i]).transition().call(O=>this.services.transitions.setupTransition({transition:O,name:"boxplot-update-quartiles",animate:t})).attr("d",O=>{const H=p.getDomainValue(O[i])-x/2,P=H+x,M=p.getRangeValue(Math[m?"max":"min"](O.quartiles.q_75,O.quartiles.q_25)),w=M+Math.abs(p.getRangeValue(O.quartiles.q_75)-p.getRangeValue(O.quartiles.q_25));return ie({x0:H,x1:P,y0:M,y1:w},g)}),A.append("path").merge(_.select("path.highlight-area")).attr("class","highlight-area").attr("opacity",0).attr("d",O=>{const H=p.getDomainValue(O[i])-x/2,P=H+x,M=p.getRangeValue(O.whiskers.min),w=p.getRangeValue(O.whiskers.max);return ie({x0:H,x1:P,y0:M,y1:w},g)}),A.append("path").merge(_.select("path.whisker.start")).attr("class",()=>this.model.getColorClassName({classNameTypes:[it.STROKE],originalClassName:"whisker start"})).attr("stroke-width",De.strokeWidth.thicker).attr("fill","none").transition().call(O=>this.services.transitions.setupTransition({transition:O,name:"boxplot-update-startingwhisker",animate:t})).attr("d",O=>{const H=p.getDomainValue(O[i])-x/4,P=H+x/2,M=p.getRangeValue(O.whiskers.min),w=p.getRangeValue(O.whiskers.min);return ie({x0:H,x1:P,y0:M,y1:w},g)}),A.append("path").merge(_.select("path.median")).attr("fill","none").attr("class",()=>this.model.getColorClassName({classNameTypes:[it.STROKE],originalClassName:"median"})).attr("stroke-width",2).transition().call(O=>this.services.transitions.setupTransition({transition:O,name:"boxplot-update-median",animate:t})).attr("d",O=>{const H=p.getDomainValue(O[i])-x/2,P=H+x,M=p.getRangeValue(O.quartiles.q_50);return ie({x0:H,x1:P,y0:M,y1:M},g)}),A.append("path").merge(_.select("path.whisker.end")).attr("class",()=>this.model.getColorClassName({classNameTypes:[it.STROKE],originalClassName:"whisker end"})).attr("stroke-width",De.strokeWidth.thicker).attr("fill","none").transition().call(O=>this.services.transitions.setupTransition({transition:O,name:"boxplot-update-endingwhisker",animate:t})).attr("d",O=>{const H=p.getDomainValue(O[i])-x/4,P=H+x/2,M=p.getRangeValue(O.whiskers.max),w=p.getRangeValue(O.whiskers.max);return ie({x0:H,x1:P,y0:M,y1:w},g)});const B=L.selectAll("circle.outlier").data(O=>O.outliers.map(H=>({min:O.whiskers.min,max:O.whiskers.max,[i]:O[i],value:H})));B.exit().remove();const D=B.enter().append("circle");B.merge(D).attr("r",De.circle.radius).attr("class",()=>this.model.getColorClassName({classNameTypes:[it.FILL,it.STROKE],originalClassName:"outlier"})).attr("fill-opacity",De.circle.opacity.default).attr("cx",v).transition().call(O=>this.services.transitions.setupTransition({transition:O,name:"boxplot-update-circles",animate:t})).attr("cy",E),this.addBoxEventListeners(),this.addCircleEventListeners()}addBoxEventListeners(){const t=this,n=this.getOptions(),{groupMapsTo:r}=n.data;this.parent.selectAll("path.highlight-area").on("mouseover",function(i,s){const a=I(this);I(this.parentNode).select("path.box").classed("hovered",!0).attr("fill-opacity",De.box.opacity.hovered),t.services.events.dispatchEvent(T.Tooltip.SHOW,{event:i,hoveredElement:a,items:[{label:b(n,"locale","translations","group")||b(n,"tooltip","groupLabel")||"Group",value:s[r],class:t.model.getColorClassName({classNameTypes:[it.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(T.Boxplot.BOX_MOUSEOVER,{event:i,element:a,datum:s})}).on("mousemove",function(i,s){const a=I(this);t.services.events.dispatchEvent(T.Boxplot.BOX_MOUSEMOVE,{event:i,element:a,datum:s}),t.services.events.dispatchEvent(T.Tooltip.MOVE,{event:i})}).on("click",function(i,s){t.services.events.dispatchEvent(T.Boxplot.BOX_CLICK,{event:i,element:I(this),datum:s})}).on("mouseout",function(i,s){const a=I(this);I(this.parentNode).select("path.box").classed("hovered",!1).attr("fill-opacity",De.box.opacity.default),t.services.events.dispatchEvent(T.Boxplot.BOX_MOUSEOUT,{event:i,element:a,datum:s}),t.services.events.dispatchEvent(T.Tooltip.HIDE,{hoveredElement:a})})}addCircleEventListeners(){const t=this,n=this.getOptions(),{groupMapsTo:r}=n.data,i=this.services.cartesianScales.getRangeIdentifier();this.parent.selectAll("circle").on("mouseover",function(s,a){const o=I(this);o.classed("hovered",!0).attr("fill-opacity",De.circle.opacity.hovered).classed("unfilled",!1),t.services.events.dispatchEvent(T.Tooltip.SHOW,{event:s,hoveredElement:o,items:[{label:b(n,"locale","translations","group")||b(n,"tooltip","groupLabel")||"Group",value:a[r],class:t.model.getColorClassName({classNameTypes:[it.TOOLTIP]})},{label:"Outlier",value:a[i]}]}),t.services.events.dispatchEvent(T.Boxplot.OUTLIER_MOUSEOVER,{event:s,element:o,datum:a})}).on("mousemove",function(s,a){const o=I(this);t.services.events.dispatchEvent(T.Boxplot.OUTLIER_MOUSEMOVE,{event:s,element:o,datum:a}),t.services.events.dispatchEvent(T.Tooltip.MOVE,{event:s})}).on("click",function(s,a){t.services.events.dispatchEvent(T.Boxplot.OUTLIER_CLICK,{event:s,element:I(this),datum:a})}).on("mouseout",function(s,a){const o=I(this);o.classed("hovered",!1).attr("fill-opacity",De.circle.opacity.default),t.services.events.dispatchEvent(T.Boxplot.OUTLIER_MOUSEOUT,{event:s,element:o,datum:a}),t.services.events.dispatchEvent(T.Tooltip.HIDE,{hoveredElement:o})})}}class ei extends pt{constructor(){super(...arguments),this.type="zero-line",this.renderType=tt.SVG}render(t){const n=this.services.cartesianScales.getRangeAxisPosition({groups:this.configs.groups}),r=this.services.cartesianScales.getScaleByPosition(n),[i,s]=r.domain(),a=i>0&&s<0||i<0&&s>0,o=this.getComponentContainer();if(!a){o.selectAll("line.domain").remove();return}const[l,c]=this.services.cartesianScales.getDomainScale().range();let u=+r(0)+.5;u||(u=r.range()[0]);const d=em({x0:l,x1:c,y0:u,y1:u},this.services.cartesianScales.getOrientation());R.appendOrSelect(o,"line.domain").transition().call(f=>this.services.transitions.setupTransition({transition:f,name:"zero-line-update",animate:t})).attr("y1",d.y0).attr("y2",d.y1).attr("x1",d.x0).attr("x2",d.x1)}}class TN extends de{constructor(t,n){super(t,n),this.model=new _N(this.services),this.model.setOptions(Pt(Ct.boxplotChart,n.options)),this.init(t,n)}getComponents(){const t=[new fe(this.model,this.services),new Te(this.model,this.services),new SN(this.model,this.services),new ei(this.model,this.services),new oe(this.model,this.services,{skeleton:Ht.VERT_OR_HORIZ})];return this.getAxisChartComponents(t,{legend:{enabled:!1}})}}class ON extends an{constructor(){super(...arguments),this.type="bubble",this.renderType=tt.SVG}getRadiusScale(t){const n=this.getOptions(),{radiusMapsTo:r}=n.bubble,i=t.data(),s=i.map(c=>c[r]).filter(c=>c),a=R.getHTMLElementSize(this.services.domUtils.getMainContainer()),o=s.length>0,l=o?Ie(s):[1,1];return Fe().domain(l).range(o?n.bubble.radiusRange(a,i):[4,4])}styleCircles(t,n){const r=this.getOptions(),{radiusMapsTo:i}=r.bubble,s=this.getRadiusScale(t),{groupMapsTo:a}=r.data,{cartesianScales:o}=this.services,l=h=>o.getDomainValue(h),c=h=>o.getRangeValue(h),[u,d]=_n(l,c,o.getOrientation());t.raise().classed("dot",!0).attr("role",ut.GRAPHICS_SYMBOL).attr("aria-label",h=>{const f=o.getRangeIdentifier(h);return h[f]}).transition().call(h=>this.services.transitions.setupTransition({transition:h,name:"bubble-update-enter",animate:n})).attr("cx",u).attr("cy",d).attr("r",h=>s(h[i]||1)).attr("class",h=>this.model.getColorClassName({classNameTypes:[it.FILL,it.STROKE],dataGroupName:h[a],originalClassName:"dot"})).style("fill",h=>{const f=this.services.cartesianScales.getDomainIdentifier(h);return this.model.getFillColor(h[a],h[f],h)}).style("stroke",h=>{const f=this.services.cartesianScales.getDomainIdentifier(h);return this.model.getStrokeColor(h[a],h[f],h)}).attr("fill-opacity",r.bubble.fillOpacity).attr("opacity",1)}getTooltipAdditionalItems(t){const n=b(this.getOptions(),"bubble");return[{label:b(n,"radiusLabel"),value:t[b(n,"radiusMapsTo")]}]}}class wN extends de{constructor(t,n){super(t,n),this.model.setOptions(Pt(Ct.bubbleChart,n.options)),this.init(t,n)}getComponents(){const t=[new fe(this.model,this.services),new Te(this.model,this.services),new Pn(this.model,this.services),new ON(this.model,this.services),new oe(this.model,this.services,{skeleton:Ht.GRID})];return this.getAxisChartComponents(t)}}class MN extends ur{constructor(t){super(t)}getMatchingRangeIndexForDatapoint(t){let n;for(let r=t.ranges.length-1;r>0;r--){const i=t.ranges[r];if(t.value>=i)return n=r,n}return 0}getTabularDataArray(){const t=this.getDisplayData(),n=this.getOptions(),{groupMapsTo:r}=n.data,i=this.services.cartesianScales.getRangeIdentifier(),{number:s,code:a}=b(n,"locale"),o=b(n,"bullet","performanceAreaTitles"),l=["Title","Group","Value","Target","Percentage","Performance"],c=[...t.map(u=>[u.title,u[r],u.value===null?"–":s(u.value,a),b(u,"marker")===null?"–":s(u.marker,a),b(u,"marker")===null?"–":`${s(Math.floor(u[i]/u.marker*100),a)}%`,o[this.getMatchingRangeIndexForDatapoint(u)]])];return super.formatTable({headers:l,cells:c})}}class AN extends pt{constructor(){super(...arguments),this.type="bullet",this.renderType=tt.SVG,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail,{groupMapsTo:r}=this.getOptions().data;this.parent.selectAll("path.bar").transition("legend-hover-simple-bar").call(i=>this.services.transitions.setupTransition({transition:i,name:"legend-hover-simple-bar"})).attr("opacity",i=>i[r]!==n.datum().name?.3:1)},this.handleLegendMouseOut=()=>{this.parent.selectAll("path.bar").transition("legend-mouseout-simple-bar").call(t=>this.services.transitions.setupTransition({transition:t,name:"legend-mouseout-simple-bar"})).attr("opacity",1)}}init(){const t=this.services.events;t.addEventListener(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t){const n=this.getOptions(),{groupMapsTo:r}=n.data,i=this.getComponentContainer({withinChartClip:!0}),s=this.model.getDisplayData(this.configs.groups),a=this.services.cartesianScales.getRangeScale(),o=this.services.cartesianScales.getRangeIdentifier(),[l,c]=a.range(),[,u]=a.domain(),d=()=>{const g=[];s.forEach(E=>{E.ranges?E.ranges.forEach((y,x)=>{y!=null&&y<u&&g.push({datum:E,value:y,order:x+1})}):g.push({datum:E,order:1})});const m=R.appendOrSelect(i,"g.range-boxes").selectAll("path.range-box").data(g,E=>`${E[r]}-${E.order}`);m.exit().attr("opacity",0).remove(),m.enter().append("path").attr("opacity",0).merge(m).attr("class",E=>`range-box order-${E.order}`).transition().call(E=>this.services.transitions.setupTransition({transition:E,name:"bullet-range-box-update-enter",animate:t})).attr("d",E=>{let x,S,_,A;return E.order===1?(x=this.services.cartesianScales.getDomainValue(E.datum)-16/2,S=x+16,_=c-2,A=l+1):(x=this.services.cartesianScales.getDomainValue(E.datum)-16/2,S=x+16,_=this.services.cartesianScales.getRangeValue(E.value),A=c),ie({x0:x,x1:S,y0:_,y1:A},this.services.cartesianScales.getOrientation())}).attr("opacity",1)},h=()=>{const g=R.appendOrSelect(i,"g.bars").selectAll("path.bar").data(s,v=>v[r]);g.exit().attr("opacity",0).remove(),g.enter().append("path").attr("opacity",0).merge(g).classed("bar",!0).transition().call(v=>this.services.transitions.setupTransition({transition:v,name:"bullet-bar-update-enter",animate:t})).attr("class",v=>this.model.getColorClassName({classNameTypes:[it.FILL],dataGroupName:v[r],originalClassName:"bar"})).style("fill",v=>{const E=this.services.cartesianScales.getDomainIdentifier(v);return this.model.getFillColor(v[r],v[E],v)}).attr("d",v=>{const y=this.services.cartesianScales.getDomainValue(v)-4,x=y+8,S=this.services.cartesianScales.getRangeValue(0)+1,_=this.services.cartesianScales.getRangeValue(v);return ie({x0:y,x1:x,y0:S,y1:_},this.services.cartesianScales.getOrientation())}).attr("opacity",1).attr("role",ut.GRAPHICS_SYMBOL).attr("aria-roledescription","bar").attr("aria-label",v=>v.value)},f=()=>{const g=R.appendOrSelect(i,"g.markers").selectAll("path.marker").data(s.filter(v=>b(v,"marker")!==null),v=>v[r]);g.exit().attr("opacity",0).remove(),g.enter().append("path").attr("opacity",0).merge(g).classed("marker",!0).transition().call(v=>this.services.transitions.setupTransition({transition:v,name:"bullet-marker-update-enter",animate:t})).attr("d",v=>{const y=this.services.cartesianScales.getDomainValue(v)-12,x=y+24,S=this.services.cartesianScales.getRangeValue(v.marker);return ie({x0:y,x1:x,y0:S,y1:S},this.services.cartesianScales.getOrientation())}).attr("opacity",1)},p=()=>{let g=[];s.filter(E=>b(E,"marker")!==null).forEach(E=>{const y=E.marker,x=E[o];g=g.concat([{datum:E,value:y*.25,barValue:x},{datum:E,value:y*.5,barValue:x},{datum:E,value:y*.75,barValue:x}])});const m=R.appendOrSelect(i,"g.quartiles").selectAll("path.quartile").data(g,E=>E[r]);m.exit().attr("opacity",0).remove(),m.enter().append("path").attr("opacity",0).merge(m).attr("class",E=>`quartile ${E.value<=E.barValue?"over-bar":""}`).transition().call(E=>this.services.transitions.setupTransition({transition:E,name:"bullet-quartile-update-enter",animate:t})).attr("d",({datum:E,value:y})=>{let x=4;E.ranges&&E.ranges.indexOf(y)!==-1&&(x=8);const S=this.services.cartesianScales.getDomainValue(E)-x/2,_=S+x,A=this.services.cartesianScales.getRangeValue(y);return ie({x0:S,x1:_,y0:A,y1:A},this.services.cartesianScales.getOrientation())}).attr("opacity",1)};d(),h(),f(),p(),this.addEventListeners()}addEventListeners(){const t=this,n=this.getOptions(),{groupMapsTo:r}=n.data,i=this.services.cartesianScales.getRangeIdentifier(),{code:s,number:a}=b(n,"locale");this.parent.selectAll("path.bar").on("mouseover",function(o,l){const c=I(this);c.classed("hovered",!0),t.services.events.dispatchEvent(T.Bar.BAR_MOUSEOVER,{event:o,element:c,datum:l});const u=b(n,"bullet","performanceAreaTitles"),d=t.model.getMatchingRangeIndexForDatapoint(l);t.services.events.dispatchEvent(T.Tooltip.SHOW,{event:o,hoveredElement:c,items:[{label:b(n,"locale","translations","group")||b(n,"tooltip","groupLabel")||"Group",value:l[r],class:t.model.getColorClassName({classNameTypes:[it.TOOLTIP],dataGroupName:l[r]})},{label:"Value",value:l[i]},{label:"Target",value:l.marker},{label:"Percentage",value:`${a(Math.floor(l[i]/l.marker*100),s)}%`},{label:"Performance",value:u[d]}]})}).on("mousemove",function(o,l){t.services.events.dispatchEvent(T.Bar.BAR_MOUSEMOVE,{event:o,element:I(this),datum:l}),t.services.events.dispatchEvent(T.Tooltip.MOVE,{event:o})}).on("click",function(o,l){t.services.events.dispatchEvent(T.Bar.BAR_CLICK,{event:o,element:I(this),datum:l})}).on("mouseout",function(o,l){const c=I(this);c.classed("hovered",!1),t.services.events.dispatchEvent(T.Bar.BAR_MOUSEOUT,{event:o,element:c,datum:l}),t.services.events.dispatchEvent(T.Tooltip.HIDE,{hoveredElement:c})})}destroy(){this.parent.selectAll("path.bar").on("mouseover",null).on("mousemove",null).on("mouseout",null);const t=this.services.events;t.removeEventListener(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}}class CN extends de{constructor(t,n){super(t,n),this.model=new MN(this.services),this.model.setOptions(Pt(Ct.bulletChart,n.options)),this.init(t,n)}getComponents(){const t=[new fe(this.model,this.services),new Te(this.model,this.services),new AN(this.model,this.services),new oe(this.model,this.services,{skeleton:Ht.GRID})];return this.getAxisChartComponents(t)}}function Iv(e){const t=Ie(e,r=>r.value),n=Fe().domain(t).nice().domain();if(n[0]>0)n[0]=0;else if(n[0]===0&&n[1]===0)return[0,1];return n[0]<0&&n[1]>0&&(Math.abs(n[0])>n[1]?n[1]=Math.abs(n[0]):n[0]=-n[1]),n}function kv(e,t){const n=b(t,"gradient","colors"),r=!He(n);let i=b(t,"pairing","option");const s=Iv(e),a=s[0]<0&&s[1]>0?"diverge":"mono";(i<1&&i>4&&a==="mono"||i<1&&i>2&&a==="diverge")&&(i=1);const o=r?n:[];if(!r){const l=a==="diverge"?17:11;for(let c=1;c<l+1;c++)o.push(`fill-${a}-${i}-${c}`)}return Nl().domain(s).range(o)}class DN extends rn{constructor(t){super(t),this._colorScale=void 0,this._matrix={}}getFillColor(t){return this._colorScale(t)}getCombinedData(){if(He(this._matrix)){const t=this.getOptions(),n=this.getDisplayData();!He(n)&&!He(t.geoData.objects.countries)&&(t.geoData.objects.countries.geometries.forEach(r=>{this._matrix[r.properties.NAME]=r}),n.forEach(r=>{this._matrix[r.name]?this._matrix[r.name].value=r.value||null:console.warn(`Data point ${r} is missing geographical data.`)}))}return this._matrix}getTabularDataArray(){const t=this.getDisplayData(),{number:n,code:r}=b(this.getOptions(),"locale"),i=["Country ID","Country Name","Value"],s=[...t.map(a=>[a.id===null?"–":a.id,a.name,n(a.value,r)])];return super.formatTable({headers:i,cells:s})}getColorClassName(t){return`${t.originalClassName} ${this._colorScale(t.value)}`}setColorClassNames(){const t=b(this.getOptions(),"color");this._colorScale=kv(this.getDisplayData(),t)}}function LN(e){return e}function RN(e){if(e==null)return LN;var t,n,r=e.scale[0],i=e.scale[1],s=e.translate[0],a=e.translate[1];return function(o,l){l||(t=n=0);var c=2,u=o.length,d=new Array(u);for(d[0]=(t+=o[0])*r+s,d[1]=(n+=o[1])*i+a;c<u;)d[c]=o[c],++c;return d}}function IN(e,t){for(var n,r=e.length,i=r-t;i<--r;)n=e[i],e[i++]=e[r],e[r]=n}function kN(e,t){return typeof t=="string"&&(t=e.objects[t]),t.type==="GeometryCollection"?{type:"FeatureCollection",features:t.geometries.map(function(n){return Pv(e,n)})}:Pv(e,t)}function Pv(e,t){var n=t.id,r=t.bbox,i=t.properties==null?{}:t.properties,s=Yu(e,t);return n==null&&r==null?{type:"Feature",properties:i,geometry:s}:r==null?{type:"Feature",id:n,properties:i,geometry:s}:{type:"Feature",id:n,bbox:r,properties:i,geometry:s}}function Yu(e,t){var n=RN(e.transform),r=e.arcs;function i(u,d){d.length&&d.pop();for(var h=r[u<0?~u:u],f=0,p=h.length;f<p;++f)d.push(n(h[f],f));u<0&&IN(d,p)}function s(u){return n(u)}function a(u){for(var d=[],h=0,f=u.length;h<f;++h)i(u[h],d);return d.length<2&&d.push(d[0]),d}function o(u){for(var d=a(u);d.length<4;)d.push(d[0]);return d}function l(u){return u.map(o)}function c(u){var d=u.type,h;switch(d){case"GeometryCollection":return{type:d,geometries:u.geometries.map(c)};case"Point":h=s(u.coordinates);break;case"MultiPoint":h=u.coordinates.map(s);break;case"LineString":h=a(u.arcs);break;case"MultiLineString":h=u.arcs.map(a);break;case"Polygon":h=l(u.arcs);break;case"MultiPolygon":h=u.arcs.map(l);break;default:return null}return{type:d,coordinates:h}}return c(t)}function PN(e,t){var n={},r={},i={},s=[],a=-1;t.forEach(function(c,u){var d=e.arcs[c<0?~c:c],h;d.length<3&&!d[1][0]&&!d[1][1]&&(h=t[++a],t[a]=c,t[u]=h)}),t.forEach(function(c){var u=o(c),d=u[0],h=u[1],f,p;if(f=i[d])if(delete i[f.end],f.push(c),f.end=h,p=r[h]){delete r[p.start];var g=p===f?f:f.concat(p);r[g.start=f.start]=i[g.end=p.end]=g}else r[f.start]=i[f.end]=f;else if(f=r[h])if(delete r[f.start],f.unshift(c),f.start=d,p=i[d]){delete i[p.end];var m=p===f?f:p.concat(f);r[m.start=p.start]=i[m.end=f.end]=m}else r[f.start]=i[f.end]=f;else f=[c],r[f.start=d]=i[f.end=h]=f});function o(c){var u=e.arcs[c<0?~c:c],d=u[0],h;return e.transform?(h=[0,0],u.forEach(function(f){h[0]+=f[0],h[1]+=f[1]})):h=u[u.length-1],c<0?[h,d]:[d,h]}function l(c,u){for(var d in c){var h=c[d];delete u[h.start],delete h.start,delete h.end,h.forEach(function(f){n[f<0?~f:f]=1}),s.push(h)}}return l(i,r),l(r,i),t.forEach(function(c){n[c<0?~c:c]||s.push([c])}),s}function NN(e){for(var t=-1,n=e.length,r,i=e[n-1],s=0;++t<n;)r=i,i=e[t],s+=r[0]*i[1]-r[1]*i[0];return Math.abs(s)}function $N(e){return Yu(e,FN.apply(this,arguments))}function FN(e,t){var n={},r=[],i=[];t.forEach(s);function s(l){switch(l.type){case"GeometryCollection":l.geometries.forEach(s);break;case"Polygon":a(l.arcs);break;case"MultiPolygon":l.arcs.forEach(a);break}}function a(l){l.forEach(function(c){c.forEach(function(u){(n[u=u<0?~u:u]||(n[u]=[])).push(l)})}),r.push(l)}function o(l){return NN(Yu(e,{type:"Polygon",arcs:[l]}).coordinates[0])}return r.forEach(function(l){if(!l._){var c=[],u=[l];for(l._=1,i.push(c);l=u.pop();)c.push(l),l.forEach(function(d){d.forEach(function(h){n[h<0?~h:h].forEach(function(f){f._||(f._=1,u.push(f))})})})}}),r.forEach(function(l){delete l._}),{type:"MultiPolygon",arcs:i.map(function(l){var c=[],u;if(l.forEach(function(g){g.forEach(function(m){m.forEach(function(v){n[v<0?~v:v].length<2&&c.push(v)})})}),c=PN(e,c),(u=c.length)>1)for(var d=1,h=o(c[0]),f,p;d<u;++d)(f=o(c[d]))>h&&(p=c[0],c[0]=c[d],c[d]=p,h=f);return c}).filter(function(l){return l.length>0})}}class UN extends Pn{constructor(){super(...arguments),this.type="ruler-binned",this.renderType=tt.SVG}showRuler(t,[n,r]){const i=this.parent,s=this.model.getOptions(),{cartesianScales:a}=this.services,o=a.getOrientation(),l=a.getRangeScale(),[c,u]=l.range(),d=a.getDomainScale(),h=d.invert(o===Wt.VERTICAL?n:r),f=R.appendOrSelect(i,"g.ruler").attr("aria-label","ruler"),p=R.appendOrSelect(f,"line.ruler-line"),m=i.selectAll("[role=graphics-symbol]").filter(v=>{if(parseFloat(yt(v,"data.x0"))<=h&&parseFloat(yt(v,"data.x1"))>=h)return!0});if(m.size()>0){this.elementsToHighlight&&this.elementsToHighlight.size()>0&&!Vg(this.elementsToHighlight,m)&&this.hideRuler(),m.dispatch("mouseover"),this.elementsToHighlight=m;const v=I(m.nodes()[0]).datum(),E=parseFloat(yt(v,"data.x0")),y=parseFloat(yt(v,"data.x1")),x=this.model.getActiveDataGroupNames(),S=x.reverse().map(A=>({label:A,value:yt(v,`data.${A}`),class:this.model.getColorClassName({classNameTypes:[it.TOOLTIP],dataGroupName:A})})).filter(A=>A.value!==0);if(S.length>0){this.services.events.dispatchEvent(T.Tooltip.SHOW,{mousePosition:[n,r],hoveredElement:p,items:[{label:yt(s,"bins.rangeLabel")||"Range",value:`${E} – ${y}`},...S,...b(s,"tooltip","showTotal")===!0?[{label:yt(s,"locale.translations.total")||yt(s,"tooltip.totalLabel")||"Total",value:x.reduce((L,B)=>L+parseFloat(yt(v,`data.${B}`)),0)}]:[]]}),f.attr("opacity",1);const A=d((E+y)/2);o==="horizontal"?p.attr("x1",u).attr("x2",c).attr("y1",A).attr("y2",A):p.attr("y1",u).attr("y2",c).attr("x1",A).attr("x2",A)}else this.hideRuler()}else this.hideRuler()}}class yo extends Pn{formatTooltipData(t){return t.reverse()}}class Nv extends Ru{constructor(t,n,r){super(t,n,r),this.type="color-legend",this.renderType=tt.SVG,this.gradient_id=`gradient-id-${Math.floor(Math.random()*99999999999)}`,this.handleAxisCompleteEvent=()=>{const i=this.getComponentContainer(),{width:s}=R.getSVGElementSize(i,{useAttrs:!0}),a=b(this.getOptions(),"data","loading");if(s>Nt.color.barWidth&&!a){const o=b(this.getOptions(),"heatmap","colorLegend","title"),{cartesianScales:l}=this.services,u=l.getMainXScale().range();if(u[0]>1&&(i.select("g.legend").attr("transform",`translate(${u[0]}, 0)`),o)){const{width:d}=R.getSVGElementSize(i.select("g.legend-title").select("text"),{useBBox:!0}),h=u[0]-d-9;h>1?i.select("g.legend-title").attr("transform",`translate(${h}, 0)`):(i.select("g.legend").attr("transform",`translate(${u[0]}, 16)`),i.select("g.legend-title").attr("transform",`translate(${u[0]}, 0)`))}}else i.select("g.legend-title").attr("transform","translate(0, 0)")},this.chartType=r.chartType}init(){this.chartType==="heatmap"&&this.services.events.addEventListener(T.Axis.RENDER_COMPLETE,this.handleAxisCompleteEvent)}render(t=!1){const n=this.getOptions(),r=this.getComponentContainer(),{width:i}=R.getSVGElementSize(r,{useAttrs:!0}),s=b(n,"color","gradient","colors"),a=b(n,this.chartType,"colorLegend","type");let o=b(n,"color","pairing","option");const l=b(n,"heatmap","colorLegend","title");if(b(this.getOptions(),"data","loading")){r.html("");return}const u=!He(s),d=Iv(this.model.getDisplayData()),h=!(i<=Nt.color.barWidth),f=h?Nt.color.barWidth:i,p=R.appendOrSelect(r,"g.legend"),g=R.appendOrSelect(p,"g.legend-axis");if(l){const D=R.appendOrSelect(r,"g.legend-title");R.appendOrSelect(D,"text").text(l).attr("dy","0.7em"),p.attr("transform","translate(0, 16)")}const m=d[0]<0&&d[1]>0?"diverge":"mono";(o<1&&o>4&&m==="mono"||o<1&&o>2&&m==="diverge")&&(o=1);let v=[];const E=m==="diverge"?17:11;if(u)v=s;else for(let D=1;D<E+1;D++)v.push(a===ns.LINEAR?`stop-color-${m}-${o}-${D}`:`fill-${m}-${o}-${D}`);const y=ve(d[0],d[1]),x=rE(y,3),S=Fe().domain(d).range([0,f]),_=Lo(S).tickSize(0).tickValues(x),{code:A,number:L}=b(n,"locale");_.tickFormat(D=>L(D,A));let B;switch(a){case ns.LINEAR:this.drawLinear(v,p,f);break;case ns.QUANTIZE:B=this.drawQuantize(v,m,u,p,f),S.range([B,f]);break;default:throw Error("Entered color legend type is not supported.")}g.attr("transform",`translate(0,${Nt.color.axisYTranslation})`).call(_),g.select(".domain").remove(),g.select("g.tick:last-of-type text").style("text-anchor",h?"middle":"end"),g.select("g.tick:first-of-type text").style("text-anchor",h&&this.chartType!=="choropleth"?"middle":"start")}drawLinear(t,n,r){const i=100/(t.length-1);R.appendOrSelect(n,"linearGradient").attr("id",`${this.gradient_id}-legend`).selectAll("stop").data(t).enter().append("stop").attr("offset",(o,l)=>`${l*i}%`).attr("class",(o,l)=>t[l]).attr("stop-color",o=>o),R.appendOrSelect(n,"rect").attr("width",r).attr("height",Nt.color.barHeight).style("fill",`url(#${this.gradient_id}-legend)`)}drawQuantize(t,n,r,i,s){!r&&n==="diverge"&&t.splice(t.length/2,1);const a=Ii().domain(t).range([0,s]);return R.appendOrSelect(i,"g.quantized-rect").selectAll("rect").data(a.domain()).join("rect").attr("x",l=>a(l)).attr("y",0).attr("width",Math.max(0,a.bandwidth()-1)).attr("height",Nt.color.barHeight).attr("class",l=>l).attr("fill",l=>l),(!r&&n)==="mono"?a.bandwidth()-1:0}destroy(){this.chartType==="heatmap"&&this.services.events.removeEventListener(T.Axis.RENDER_COMPLETE,this.handleAxisCompleteEvent)}}class BN extends gs{constructor(){super(...arguments),this.type="meter-title",this.renderType=tt.SVG}render(t=!1){const n=b(this.model.getDisplayData(),0),r=this.getOptions(),i=this.getComponentContainer(),{groupMapsTo:s}=r.data,a=r.locale.translations.meter.title;if(b(r,"meter","proportional"))this.displayTotal(),this.displayBreakdownTitle();else{const u=i.selectAll("text.meter-title").data(a?[a]:[n[s]]);u.enter().append("text").classed("meter-title",!0).merge(u).attr("x",0).attr("y","1em").text(d=>d),u.exit().remove(),this.appendPercentage()}this.displayStatus();const l=this.getMaxTitleWidth(),c=R.appendOrSelect(i,"text.meter-title");l>0&&c.node().getComputedTextLength()>l&&this.truncateTitle(c,l)}displayBreakdownTitle(){const t=this.getComponentContainer(),n=this.getOptions(),r=this.model.getMaximumDomain(this.model.getDisplayData()),i=b(n,"meter","proportional","total"),s=b(n,"meter","proportional","unit")?b(n,"meter","proportional","unit"):"";let a;if(r===i)a=null;else{const u=i!==null?i-r:r,d=b(n,"meter","proportional","breakdownFormatter"),{code:h,number:f}=b(n,"locale");a=d!==null?d({datasetsTotal:r,total:i}):`${f(r,h)} ${s} used (${f(u,h)} ${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 l=this.getMaxTitleWidth(),c=R.appendOrSelect(t,"text.proportional-meter-title");l>0&&c.node().getComputedTextLength()>l&&this.truncateTitle(c,l)}displayTotal(){const t=this.getComponentContainer(),n=this.getOptions(),r=b(n,"meter","proportional","total"),i=r?b(n,"meter","proportional","total"):this.model.getMaximumDomain(this.model.getDisplayData()),s=b(n,"meter","proportional","unit")?b(n,"meter","proportional","unit"):"",a=b(n,"meter","proportional","totalFormatter"),{code:o,number:l}=b(n,"locale"),c=a!==null?a(i):`${l(r,o)} ${s} total`,u=R.getHTMLElementSize(this.parent.node()).width,d=t.selectAll("text.proportional-meter-total").data([c]);d.enter().append("text").classed("proportional-meter-total",!0).merge(d).attr("x",this.model.getStatus()&&typeof u!="string"?u-jt.total.paddingRight:u).attr("y","1em").attr("text-anchor","end").text(h=>h),d.exit().remove()}displayStatus(){const t=this,n=this.getComponentContainer(),r=R.getHTMLElementSize(this.parent.node()).width||0,i=this.model.getStatus(),s=jt.status.indicatorSize/2,a=R.appendOrSelect(n,"g.status-indicator").attr("class",i!==null?`status-indicator status--${i}`:"").attr("transform",`translate(${r-s}, 0)`),o=i?[i]:[],l=a.selectAll("circle.status").data(o);l.enter().append("circle").merge(l).attr("class","status").attr("r",s).attr("cx",0).attr("cy",8);const c=a.selectAll("path.innerFill").data(o);c.enter().append("path").merge(c).attr("d",t.getStatusIconPathString(i)).attr("transform",`translate(-${s}, 0)`).attr("class","innerFill"),c.exit().remove(),l.exit().remove()}appendPercentage(){const t=b(this.model.getDisplayData(),0,"value"),{code:n,number:r}=b(this.getOptions(),"locale"),i=this.getComponentContainer(),s=R.appendOrSelect(i,"text.meter-title"),a=b(this.getOptions(),"meter","statusBar","percentageIndicator","enabled")===!0?[t]:[],o=i.selectAll("text.percent-value").data(a),l=jt.statusBar.paddingRight;o.enter().append("text").classed("percent-value",!0).merge(o).text(c=>`${r(c,n)}%`).attr("x",+s.attr("x")+s.node().getComputedTextLength()+l).attr("y",s.attr("y")),o.exit().remove()}truncateTitle(t,n){super.truncateTitle(t,n);const r=R.appendOrSelect(this.parent,"tspan"),i=jt.statusBar.paddingRight,s=Math.ceil(r.node().getComputedTextLength());R.appendOrSelect(this.parent,"text.percent-value").attr("x",+t.attr("x")+t.node().getComputedTextLength()+s+i)}getMaxTitleWidth(){const t=b(this.getOptions(),"meter","proportional"),n=R.getHTMLElementSize(this.parent.node()).width;if(t!==null){const r=R.appendOrSelect(this.parent,"text.proportional-meter-total").node(),i=R.getSVGElementSize(r,{useBBox:!0}).width;return n-i-jt.total.paddingLeft}else{const r=R.appendOrSelect(this.parent,"text.percent-value"),i=jt.statusBar.paddingRight,s=r.node().getComputedTextLength(),a=R.appendOrSelect(this.parent,"g.status-indicator").node(),o=R.getSVGElementSize(a,{useBBox:!0}).width+jt.status.paddingLeft;return n-s-i-o}}getStatusIconPathString(t){switch(t){case ts.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 ts.DANGER:return"M10.7 11.5 4.5 5.3 5.3 4.5 11.5 10.7 Z";case ts.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 qu extends pt{getBarWidth(){const t=this.getOptions();if(t.bars.width)return t.bars.width;const n=this.model.getDisplayData().length,r=this.services.cartesianScales.getMainXScale(),i=R.getSVGElementSize(this.parent,{useAttrs:!0}).width;if(!r.step){const s=b(t,"bars","spacingFactor");return Math.min(t.bars.maxWidth,i*s/n)}return Math.min(t.bars.maxWidth,r.step()/2)}isOutsideZoomedDomain(t,n){if(this.model.getDisplayData().length<=1)return!1;const i=this.model.get("zoomDomain");if(i!==void 0){const s=this.services.cartesianScales.getDomainScale();return t<s(i[0])||n>s(i[1])}return!1}}class HN extends pt{constructor(){super(...arguments),this.type="circle-pack",this.renderType=tt.SVG,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail;this.parent.selectAll("circle.node").transition("legend-hover-circlepack").call(r=>this.services.transitions.setupTransition({transition:r,name:"legend-hover-circlepack"})).attr("opacity",r=>r.data.dataGroupName===n.datum().name?1:Xr.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:r,height:i}=R.getSVGElementSize(this.parent,{useAttrs:!0});if(r<1||i<1)return;let s=this.model.getDisplayData();const a=this.model.hasParentNode(),o=this.model.getHierarchyLevel(),l=this.getOptions(),c=b(l,"canvasZoom","enabled");a&&b(s,0,"children")&&(s=b(s,0,"children"));const u=Di({children:s}).sum(g=>g.value).sort((g,m)=>m.value-g.value),h=y_().size([r,i]).padding(g=>g.depth>=1?Xr.padding.children+3:Xr.padding.mainGroup+3)(u).descendants().splice(1).filter(g=>g.depth<=o),f=n.selectAll("circle.node").data(h);f.exit().attr("width",0).attr("height",0).remove();const p=f.enter().append("circle").classed("node",!0);p.merge(f).attr("class",g=>{const m=c&&o===3?this.getZoomClass(g):"";return this.model.getColorClassName({classNameTypes:[it.FILL,it.STROKE],dataGroupName:g.data.dataGroupName,originalClassName:g.children?`node ${m}`:`node node-leaf ${m}`})}).style("fill",g=>this.model.getFillColor(g.data.dataGroupName,null,g.data)).style("stroke",g=>this.model.getFillColor(g.data.dataGroupName,null,g.data)).attr("cx",g=>g.x).attr("cy",g=>g.y).transition("circlepack-leaf-update-enter").call(g=>this.services.transitions.setupTransition({transition:g,name:"circlepack-leaf-update-enter"})).attr("r",g=>g.r).attr("opacity",1).attr("fill-opacity",Xr.circles.fillOpacity),c===!0&&this.focal&&(this.services.canvasZoom.zoomIn(this.focal,p,qr),this.setBackgroundListeners()),a||this.addLegendListeners(),this.addEventListeners()}unhighlightChildren(t){const n=t.map(r=>r.data);this.parent.selectAll("circle.node").filter(r=>n.some(i=>i===r.data)&&r.depth>1).style("stroke",r=>this.model.getFillColor(r.data.dataGroupName,null,r.data))}highlightChildren(t){const n=t.map(r=>r.data);this.parent.selectAll("circle.node").filter(r=>n.some(i=>i===r.data)&&r.depth>1).style("stroke",Xr.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(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}removeBackgroundListeners(){I(this.services.domUtils.getMainContainer()).on("click",()=>null)}setBackgroundListeners(){const t=I(this.services.domUtils.getMainContainer()),n=this,r=this.parent.selectAll("circle.node");t.on("click",()=>{n.focal=null,n.model.updateHierarchyLevel(2),t.classed("zoomed-in",!1),n.services.canvasZoom.zoomOut(r,qr)})}getZoomIcon(){return`
|
|
81
|
+
`;h.html(f),p();function p(){h.attr("gradientTransform",`translate(${c-3*.2*l}, 0)`).transition().duration(2e3).delay(1e3).ease(hb).attr("gradientTransform",`translate(${u+3*.2*l}, 0)`).on("end",p)}}removeSkeleton(){this.parent.select(".chart-skeleton").remove()}}class xN extends de{constructor(t,n){super(t,n),this.model.setOptions(Pt(yn(Ct.areaChart),n.options)),this.init(t,n)}getComponents(){const t=[new fe(this.model,this.services),new Te(this.model,this.services),new Pn(this.model,this.services),new ti(this.model,this.services),new Dv(this.model,this.services),new an(this.model,this.services,{fadeInOnChartHolderMouseover:!0,handleThresholds:!0}),new oe(this.model,this.services,{skeleton:Ht.GRID})];return this.getAxisChartComponents(t)}}class _N extends ur{constructor(t){super(t)}getBoxQuartiles(t){return{q_25:Co(t,.25),q_50:Co(t,.5),q_75:Co(t,.75)}}getBoxplotData(){const t=this.getOptions(),{groupMapsTo:n}=t.data,r=this.getGroupedData(),i=[];for(const{name:s,data:a}of r){const o=this.services.cartesianScales.getRangeIdentifier(),l=a.map(y=>y[o]).sort(Re),c={[n]:s,counts:l,quartiles:this.getBoxQuartiles(l),outliers:null,whiskers:null},u=c.quartiles.q_25,d=c.quartiles.q_75,h=(d-u)*1.5,f=u-h,p=d+h,g=[],m=[];for(const y of l)y<f||y>p?g.push(y):m.push(y);c.outliers=g;const v=An(m),E=Un(m);c.whiskers={min:v||An([c.quartiles.q_25,c.quartiles.q_50,c.quartiles.q_75]),max:E||Un([c.quartiles.q_25,c.quartiles.q_50,c.quartiles.q_75])},i.push(c)}return i}getTabularDataArray(){const t=this.getOptions(),{groupMapsTo:n}=t.data,r=this.getBoxplotData(),{number:i,code:s}=b(t,"locale"),a=["Group","Minimum","Q1","Median","Q3","Maximum","IQR","Outlier(s)"],o=[...r.map(l=>{let c=b(l,"outliers");return(c===null||c.length===0)&&(c=["–"]),[l[n],b(l,"whiskers","min")!==null?i(b(l,"whiskers","min"),s):"–",b(l,"quartiles","q_25")!==null?i(b(l,"quartiles","q_25"),s):"–",b(l,"quartiles","q_50")!==null?i(b(l,"quartiles","q_50"),s):"–",b(l,"quartiles","q_75")!==null?i(b(l,"quartiles","q_75"),s):"–",b(l,"whiskers","max")!==null?i(b(l,"whiskers","max"),s):"–",b(l,"quartiles","q_75")!==null&&b(l,"quartiles","q_25")!==null?(i(b(l,"quartiles","q_75")-b(l,"quartiles","q_25")),s):"–",c.map(u=>i(u,s)).join(",")]})];return super.formatTable({headers:a,cells:o})}setColorClassNames(){const n=b(this.getOptions(),"color","pairing");let r=b(n,"option");const i=Kg.pairingOptions;r=r<=i["1-color"]?r:1;const s=this.allDataGroups.map(()=>`1-${r}-1`);this.colorClassNames=fa().range(s).domain(this.allDataGroups)}}class SN extends pt{constructor(){super(...arguments),this.type="boxplot",this.renderType=tt.SVG}render(t){const n=this.getComponentContainer({withinChartClip:!0}),r=this.getOptions(),{groupMapsTo:i}=r.data,s=this.model.getDataGroupNames(),a=this.services.cartesianScales.getMainXScale(),o=this.services.cartesianScales.getMainYScale(),[l,c]=a.range(),[u,d]=o.range(),h=c-l,f=u-d;if(h===0)return;const{cartesianScales:p}=this.services,g=p.getOrientation(),m=g===Wt.VERTICAL,[v,E]=_n(O=>this.services.cartesianScales.getDomainValue(O),O=>this.services.cartesianScales.getRangeValue(O),g),y=Math.floor((m?h:f)/s.length),x=Math.min(y/2,16),S=this.model.getBoxplotData(),_=n.selectAll(".box-group").data(S);_.exit().remove();const A=_.enter().append("g").attr("class","box-group"),L=_.merge(A);A.append("path").merge(_.select("path.vertical-line.start")).attr("class",()=>this.model.getColorClassName({classNameTypes:[it.STROKE],originalClassName:"vertical-line start"})).attr("stroke-width",De.strokeWidth.default).attr("fill","none").transition().call(O=>this.services.transitions.setupTransition({transition:O,name:"boxplot-update-verticalstartline",animate:t})).attr("d",O=>{const H=p.getDomainValue(O[i]),P=H,M=p.getRangeValue(O.whiskers.min),w=p.getRangeValue(O.quartiles.q_25);return ie({x0:H,x1:P,y0:M,y1:w},g)}),A.append("path").merge(_.select("path.vertical-line.end")).attr("class",()=>this.model.getColorClassName({classNameTypes:[it.STROKE],originalClassName:"vertical-line end"})).attr("stroke-width",De.strokeWidth.default).attr("fill","none").transition().call(O=>this.services.transitions.setupTransition({transition:O,name:"boxplot-update-verticalendline",animate:t})).attr("d",O=>{const H=p.getDomainValue(O[i]),P=H,M=p.getRangeValue(O.whiskers.max),w=p.getRangeValue(O.quartiles.q_75);return ie({x0:H,x1:P,y0:M,y1:w},g)}),A.append("path").merge(_.select("path.box")).attr("class",()=>this.model.getColorClassName({classNameTypes:[it.FILL,it.STROKE],originalClassName:"box"})).attr("fill-opacity",De.box.opacity.default).attr("stroke-width",De.strokeWidth.default).attr("role",ut.GRAPHICS_SYMBOL).attr("aria-roledescription","box").attr("aria-label",O=>O[i]).transition().call(O=>this.services.transitions.setupTransition({transition:O,name:"boxplot-update-quartiles",animate:t})).attr("d",O=>{const H=p.getDomainValue(O[i])-x/2,P=H+x,M=p.getRangeValue(Math[m?"max":"min"](O.quartiles.q_75,O.quartiles.q_25)),w=M+Math.abs(p.getRangeValue(O.quartiles.q_75)-p.getRangeValue(O.quartiles.q_25));return ie({x0:H,x1:P,y0:M,y1:w},g)}),A.append("path").merge(_.select("path.highlight-area")).attr("class","highlight-area").attr("opacity",0).attr("d",O=>{const H=p.getDomainValue(O[i])-x/2,P=H+x,M=p.getRangeValue(O.whiskers.min),w=p.getRangeValue(O.whiskers.max);return ie({x0:H,x1:P,y0:M,y1:w},g)}),A.append("path").merge(_.select("path.whisker.start")).attr("class",()=>this.model.getColorClassName({classNameTypes:[it.STROKE],originalClassName:"whisker start"})).attr("stroke-width",De.strokeWidth.thicker).attr("fill","none").transition().call(O=>this.services.transitions.setupTransition({transition:O,name:"boxplot-update-startingwhisker",animate:t})).attr("d",O=>{const H=p.getDomainValue(O[i])-x/4,P=H+x/2,M=p.getRangeValue(O.whiskers.min),w=p.getRangeValue(O.whiskers.min);return ie({x0:H,x1:P,y0:M,y1:w},g)}),A.append("path").merge(_.select("path.median")).attr("fill","none").attr("class",()=>this.model.getColorClassName({classNameTypes:[it.STROKE],originalClassName:"median"})).attr("stroke-width",2).transition().call(O=>this.services.transitions.setupTransition({transition:O,name:"boxplot-update-median",animate:t})).attr("d",O=>{const H=p.getDomainValue(O[i])-x/2,P=H+x,M=p.getRangeValue(O.quartiles.q_50);return ie({x0:H,x1:P,y0:M,y1:M},g)}),A.append("path").merge(_.select("path.whisker.end")).attr("class",()=>this.model.getColorClassName({classNameTypes:[it.STROKE],originalClassName:"whisker end"})).attr("stroke-width",De.strokeWidth.thicker).attr("fill","none").transition().call(O=>this.services.transitions.setupTransition({transition:O,name:"boxplot-update-endingwhisker",animate:t})).attr("d",O=>{const H=p.getDomainValue(O[i])-x/4,P=H+x/2,M=p.getRangeValue(O.whiskers.max),w=p.getRangeValue(O.whiskers.max);return ie({x0:H,x1:P,y0:M,y1:w},g)});const B=L.selectAll("circle.outlier").data(O=>O.outliers.map(H=>({min:O.whiskers.min,max:O.whiskers.max,[i]:O[i],value:H})));B.exit().remove();const D=B.enter().append("circle");B.merge(D).attr("r",De.circle.radius).attr("class",()=>this.model.getColorClassName({classNameTypes:[it.FILL,it.STROKE],originalClassName:"outlier"})).attr("fill-opacity",De.circle.opacity.default).attr("cx",v).transition().call(O=>this.services.transitions.setupTransition({transition:O,name:"boxplot-update-circles",animate:t})).attr("cy",E),this.addBoxEventListeners(),this.addCircleEventListeners()}addBoxEventListeners(){const t=this,n=this.getOptions(),{groupMapsTo:r}=n.data;this.parent.selectAll("path.highlight-area").on("mouseover",function(i,s){const a=I(this);I(this.parentNode).select("path.box").classed("hovered",!0).attr("fill-opacity",De.box.opacity.hovered),t.services.events.dispatchEvent(T.Tooltip.SHOW,{event:i,hoveredElement:a,items:[{label:b(n,"locale","translations","group")||b(n,"tooltip","groupLabel")||"Group",value:s[r],class:t.model.getColorClassName({classNameTypes:[it.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(T.Boxplot.BOX_MOUSEOVER,{event:i,element:a,datum:s})}).on("mousemove",function(i,s){const a=I(this);t.services.events.dispatchEvent(T.Boxplot.BOX_MOUSEMOVE,{event:i,element:a,datum:s}),t.services.events.dispatchEvent(T.Tooltip.MOVE,{event:i})}).on("click",function(i,s){t.services.events.dispatchEvent(T.Boxplot.BOX_CLICK,{event:i,element:I(this),datum:s})}).on("mouseout",function(i,s){const a=I(this);I(this.parentNode).select("path.box").classed("hovered",!1).attr("fill-opacity",De.box.opacity.default),t.services.events.dispatchEvent(T.Boxplot.BOX_MOUSEOUT,{event:i,element:a,datum:s}),t.services.events.dispatchEvent(T.Tooltip.HIDE,{hoveredElement:a})})}addCircleEventListeners(){const t=this,n=this.getOptions(),{groupMapsTo:r}=n.data,i=this.services.cartesianScales.getRangeIdentifier();this.parent.selectAll("circle").on("mouseover",function(s,a){const o=I(this);o.classed("hovered",!0).attr("fill-opacity",De.circle.opacity.hovered).classed("unfilled",!1),t.services.events.dispatchEvent(T.Tooltip.SHOW,{event:s,hoveredElement:o,items:[{label:b(n,"locale","translations","group")||b(n,"tooltip","groupLabel")||"Group",value:a[r],class:t.model.getColorClassName({classNameTypes:[it.TOOLTIP]})},{label:"Outlier",value:a[i]}]}),t.services.events.dispatchEvent(T.Boxplot.OUTLIER_MOUSEOVER,{event:s,element:o,datum:a})}).on("mousemove",function(s,a){const o=I(this);t.services.events.dispatchEvent(T.Boxplot.OUTLIER_MOUSEMOVE,{event:s,element:o,datum:a}),t.services.events.dispatchEvent(T.Tooltip.MOVE,{event:s})}).on("click",function(s,a){t.services.events.dispatchEvent(T.Boxplot.OUTLIER_CLICK,{event:s,element:I(this),datum:a})}).on("mouseout",function(s,a){const o=I(this);o.classed("hovered",!1).attr("fill-opacity",De.circle.opacity.default),t.services.events.dispatchEvent(T.Boxplot.OUTLIER_MOUSEOUT,{event:s,element:o,datum:a}),t.services.events.dispatchEvent(T.Tooltip.HIDE,{hoveredElement:o})})}}class ei extends pt{constructor(){super(...arguments),this.type="zero-line",this.renderType=tt.SVG}render(t){const n=this.services.cartesianScales.getRangeAxisPosition({groups:this.configs.groups}),r=this.services.cartesianScales.getScaleByPosition(n),[i,s]=r.domain(),a=i>0&&s<0||i<0&&s>0,o=this.getComponentContainer();if(!a){o.selectAll("line.domain").remove();return}const[l,c]=this.services.cartesianScales.getDomainScale().range();let u=+r(0)+.5;u||(u=r.range()[0]);const d=em({x0:l,x1:c,y0:u,y1:u},this.services.cartesianScales.getOrientation());R.appendOrSelect(o,"line.domain").transition().call(f=>this.services.transitions.setupTransition({transition:f,name:"zero-line-update",animate:t})).attr("y1",d.y0).attr("y2",d.y1).attr("x1",d.x0).attr("x2",d.x1)}}class TN extends de{constructor(t,n){super(t,n),this.model=new _N(this.services),this.model.setOptions(Pt(Ct.boxplotChart,n.options)),this.init(t,n)}getComponents(){const t=[new fe(this.model,this.services),new Te(this.model,this.services),new SN(this.model,this.services),new ei(this.model,this.services),new oe(this.model,this.services,{skeleton:Ht.VERT_OR_HORIZ})];return this.getAxisChartComponents(t,{legend:{enabled:!1}})}}class ON extends an{constructor(){super(...arguments),this.type="bubble",this.renderType=tt.SVG}getRadiusScale(t){const n=this.getOptions(),{radiusMapsTo:r}=n.bubble,i=t.data(),s=i.map(c=>c[r]).filter(c=>c),a=R.getHTMLElementSize(this.services.domUtils.getMainContainer()),o=s.length>0,l=o?Ie(s):[1,1];return Fe().domain(l).range(o?n.bubble.radiusRange(a,i):[4,4])}styleCircles(t,n){const r=this.getOptions(),{radiusMapsTo:i}=r.bubble,s=this.getRadiusScale(t),{groupMapsTo:a}=r.data,{cartesianScales:o}=this.services,l=h=>o.getDomainValue(h),c=h=>o.getRangeValue(h),[u,d]=_n(l,c,o.getOrientation());t.raise().classed("dot",!0).attr("role",ut.GRAPHICS_SYMBOL).attr("aria-label",h=>{const f=o.getRangeIdentifier(h);return h[f]}).transition().call(h=>this.services.transitions.setupTransition({transition:h,name:"bubble-update-enter",animate:n})).attr("cx",u).attr("cy",d).attr("r",h=>s(h[i]||1)).attr("class",h=>this.model.getColorClassName({classNameTypes:[it.FILL,it.STROKE],dataGroupName:h[a],originalClassName:"dot"})).style("fill",h=>{const f=this.services.cartesianScales.getDomainIdentifier(h);return this.model.getFillColor(h[a],h[f],h)}).style("stroke",h=>{const f=this.services.cartesianScales.getDomainIdentifier(h);return this.model.getStrokeColor(h[a],h[f],h)}).attr("fill-opacity",r.bubble.fillOpacity).attr("opacity",1)}getTooltipAdditionalItems(t){const n=b(this.getOptions(),"bubble");return[{label:b(n,"radiusLabel"),value:t[b(n,"radiusMapsTo")]}]}}class wN extends de{constructor(t,n){super(t,n),this.model.setOptions(Pt(Ct.bubbleChart,n.options)),this.init(t,n)}getComponents(){const t=[new fe(this.model,this.services),new Te(this.model,this.services),new Pn(this.model,this.services),new ON(this.model,this.services),new oe(this.model,this.services,{skeleton:Ht.GRID})];return this.getAxisChartComponents(t)}}class MN extends ur{constructor(t){super(t)}getMatchingRangeIndexForDatapoint(t){let n;for(let r=t.ranges.length-1;r>0;r--){const i=t.ranges[r];if(t.value>=i)return n=r,n}return 0}getTabularDataArray(){const t=this.getDisplayData(),n=this.getOptions(),{groupMapsTo:r}=n.data,i=this.services.cartesianScales.getRangeIdentifier(),{number:s,code:a}=b(n,"locale"),o=b(n,"bullet","performanceAreaTitles"),l=["Title","Group","Value","Target","Percentage","Performance"],c=[...t.map(u=>[u.title,u[r],u.value===null?"–":s(u.value,a),b(u,"marker")===null?"–":s(u.marker,a),b(u,"marker")===null?"–":`${s(Math.floor(u[i]/u.marker*100),a)}%`,o[this.getMatchingRangeIndexForDatapoint(u)]])];return super.formatTable({headers:l,cells:c})}}class AN extends pt{constructor(){super(...arguments),this.type="bullet",this.renderType=tt.SVG,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail,{groupMapsTo:r}=this.getOptions().data;this.parent.selectAll("path.bar").transition("legend-hover-simple-bar").call(i=>this.services.transitions.setupTransition({transition:i,name:"legend-hover-simple-bar"})).attr("opacity",i=>i[r]!==n.datum().name?.3:1)},this.handleLegendMouseOut=()=>{this.parent.selectAll("path.bar").transition("legend-mouseout-simple-bar").call(t=>this.services.transitions.setupTransition({transition:t,name:"legend-mouseout-simple-bar"})).attr("opacity",1)}}init(){const t=this.services.events;t.addEventListener(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t){const n=this.getOptions(),{groupMapsTo:r}=n.data,i=this.getComponentContainer({withinChartClip:!0}),s=this.model.getDisplayData(this.configs.groups),a=this.services.cartesianScales.getRangeScale(),o=this.services.cartesianScales.getRangeIdentifier(),[l,c]=a.range(),[,u]=a.domain(),d=()=>{const g=[];s.forEach(E=>{E.ranges?E.ranges.forEach((y,x)=>{y!=null&&y<u&&g.push({datum:E,value:y,order:x+1})}):g.push({datum:E,order:1})});const m=R.appendOrSelect(i,"g.range-boxes").selectAll("path.range-box").data(g,E=>`${E[r]}-${E.order}`);m.exit().attr("opacity",0).remove(),m.enter().append("path").attr("opacity",0).merge(m).attr("class",E=>`range-box order-${E.order}`).transition().call(E=>this.services.transitions.setupTransition({transition:E,name:"bullet-range-box-update-enter",animate:t})).attr("d",E=>{let x,S,_,A;return E.order===1?(x=this.services.cartesianScales.getDomainValue(E.datum)-16/2,S=x+16,_=c-2,A=l+1):(x=this.services.cartesianScales.getDomainValue(E.datum)-16/2,S=x+16,_=this.services.cartesianScales.getRangeValue(E.value),A=c),ie({x0:x,x1:S,y0:_,y1:A},this.services.cartesianScales.getOrientation())}).attr("opacity",1)},h=()=>{const g=R.appendOrSelect(i,"g.bars").selectAll("path.bar").data(s,v=>v[r]);g.exit().attr("opacity",0).remove(),g.enter().append("path").attr("opacity",0).merge(g).classed("bar",!0).transition().call(v=>this.services.transitions.setupTransition({transition:v,name:"bullet-bar-update-enter",animate:t})).attr("class",v=>this.model.getColorClassName({classNameTypes:[it.FILL],dataGroupName:v[r],originalClassName:"bar"})).style("fill",v=>{const E=this.services.cartesianScales.getDomainIdentifier(v);return this.model.getFillColor(v[r],v[E],v)}).attr("d",v=>{const y=this.services.cartesianScales.getDomainValue(v)-4,x=y+8,S=this.services.cartesianScales.getRangeValue(0)+1,_=this.services.cartesianScales.getRangeValue(v);return ie({x0:y,x1:x,y0:S,y1:_},this.services.cartesianScales.getOrientation())}).attr("opacity",1).attr("role",ut.GRAPHICS_SYMBOL).attr("aria-roledescription","bar").attr("aria-label",v=>v.value)},f=()=>{const g=R.appendOrSelect(i,"g.markers").selectAll("path.marker").data(s.filter(v=>b(v,"marker")!==null),v=>v[r]);g.exit().attr("opacity",0).remove(),g.enter().append("path").attr("opacity",0).merge(g).classed("marker",!0).transition().call(v=>this.services.transitions.setupTransition({transition:v,name:"bullet-marker-update-enter",animate:t})).attr("d",v=>{const y=this.services.cartesianScales.getDomainValue(v)-12,x=y+24,S=this.services.cartesianScales.getRangeValue(v.marker);return ie({x0:y,x1:x,y0:S,y1:S},this.services.cartesianScales.getOrientation())}).attr("opacity",1)},p=()=>{let g=[];s.filter(E=>b(E,"marker")!==null).forEach(E=>{const y=E.marker,x=E[o];g=g.concat([{datum:E,value:y*.25,barValue:x},{datum:E,value:y*.5,barValue:x},{datum:E,value:y*.75,barValue:x}])});const m=R.appendOrSelect(i,"g.quartiles").selectAll("path.quartile").data(g,E=>E[r]);m.exit().attr("opacity",0).remove(),m.enter().append("path").attr("opacity",0).merge(m).attr("class",E=>`quartile ${E.value<=E.barValue?"over-bar":""}`).transition().call(E=>this.services.transitions.setupTransition({transition:E,name:"bullet-quartile-update-enter",animate:t})).attr("d",({datum:E,value:y})=>{let x=4;E.ranges&&E.ranges.indexOf(y)!==-1&&(x=8);const S=this.services.cartesianScales.getDomainValue(E)-x/2,_=S+x,A=this.services.cartesianScales.getRangeValue(y);return ie({x0:S,x1:_,y0:A,y1:A},this.services.cartesianScales.getOrientation())}).attr("opacity",1)};d(),h(),f(),p(),this.addEventListeners()}addEventListeners(){const t=this,n=this.getOptions(),{groupMapsTo:r}=n.data,i=this.services.cartesianScales.getRangeIdentifier(),{code:s,number:a}=b(n,"locale");this.parent.selectAll("path.bar").on("mouseover",function(o,l){const c=I(this);c.classed("hovered",!0),t.services.events.dispatchEvent(T.Bar.BAR_MOUSEOVER,{event:o,element:c,datum:l});const u=b(n,"bullet","performanceAreaTitles"),d=t.model.getMatchingRangeIndexForDatapoint(l);t.services.events.dispatchEvent(T.Tooltip.SHOW,{event:o,hoveredElement:c,items:[{label:b(n,"locale","translations","group")||b(n,"tooltip","groupLabel")||"Group",value:l[r],class:t.model.getColorClassName({classNameTypes:[it.TOOLTIP],dataGroupName:l[r]})},{label:"Value",value:l[i]},{label:"Target",value:l.marker},{label:"Percentage",value:`${a(Math.floor(l[i]/l.marker*100),s)}%`},{label:"Performance",value:u[d]}]})}).on("mousemove",function(o,l){t.services.events.dispatchEvent(T.Bar.BAR_MOUSEMOVE,{event:o,element:I(this),datum:l}),t.services.events.dispatchEvent(T.Tooltip.MOVE,{event:o})}).on("click",function(o,l){t.services.events.dispatchEvent(T.Bar.BAR_CLICK,{event:o,element:I(this),datum:l})}).on("mouseout",function(o,l){const c=I(this);c.classed("hovered",!1),t.services.events.dispatchEvent(T.Bar.BAR_MOUSEOUT,{event:o,element:c,datum:l}),t.services.events.dispatchEvent(T.Tooltip.HIDE,{hoveredElement:c})})}destroy(){this.parent.selectAll("path.bar").on("mouseover",null).on("mousemove",null).on("mouseout",null);const t=this.services.events;t.removeEventListener(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}}class CN extends de{constructor(t,n){super(t,n),this.model=new MN(this.services),this.model.setOptions(Pt(Ct.bulletChart,n.options)),this.init(t,n)}getComponents(){const t=[new fe(this.model,this.services),new Te(this.model,this.services),new AN(this.model,this.services),new oe(this.model,this.services,{skeleton:Ht.GRID})];return this.getAxisChartComponents(t)}}function Iv(e){const t=Ie(e,r=>r.value),n=Fe().domain(t).nice().domain();if(n[0]>0)n[0]=0;else if(n[0]===0&&n[1]===0)return[0,1];return n[0]<0&&n[1]>0&&(Math.abs(n[0])>n[1]?n[1]=Math.abs(n[0]):n[0]=-n[1]),n}function kv(e,t){const n=b(t,"gradient","colors"),r=!He(n);let i=b(t,"pairing","option");const s=Iv(e),a=s[0]<0&&s[1]>0?"diverge":"mono";(i<1&&i>4&&a==="mono"||i<1&&i>2&&a==="diverge")&&(i=1);const o=r?n:[];if(!r){const l=a==="diverge"?17:11;for(let c=1;c<l+1;c++)o.push(`fill-${a}-${i}-${c}`)}return Nl().domain(s).range(o)}class DN extends rn{constructor(t){super(t),this._colorScale=void 0,this._matrix={}}getFillColor(t){return this._colorScale(t)}getCombinedData(){if(He(this._matrix)){const t=this.getOptions(),n=this.getDisplayData();!He(n)&&!He(t.geoData.objects.countries)&&(t.geoData.objects.countries.geometries.forEach(r=>{this._matrix[r.properties.NAME]=r}),n.forEach(r=>{this._matrix[r.name]?this._matrix[r.name].value=r.value||null:console.warn(`Data point ${r} is missing geographical data.`)}))}return this._matrix}getTabularDataArray(){const t=this.getDisplayData(),{number:n,code:r}=b(this.getOptions(),"locale"),i=["Country ID","Country Name","Value"],s=[...t.map(a=>[a.id===null?"–":a.id,a.name,a.value===null?"–":n(a.value,r)])];return super.formatTable({headers:i,cells:s})}getColorClassName(t){return`${t.originalClassName} ${this._colorScale(t.value)}`}setColorClassNames(){const t=b(this.getOptions(),"color");this._colorScale=kv(this.getDisplayData(),t)}}function LN(e){return e}function RN(e){if(e==null)return LN;var t,n,r=e.scale[0],i=e.scale[1],s=e.translate[0],a=e.translate[1];return function(o,l){l||(t=n=0);var c=2,u=o.length,d=new Array(u);for(d[0]=(t+=o[0])*r+s,d[1]=(n+=o[1])*i+a;c<u;)d[c]=o[c],++c;return d}}function IN(e,t){for(var n,r=e.length,i=r-t;i<--r;)n=e[i],e[i++]=e[r],e[r]=n}function kN(e,t){return typeof t=="string"&&(t=e.objects[t]),t.type==="GeometryCollection"?{type:"FeatureCollection",features:t.geometries.map(function(n){return Pv(e,n)})}:Pv(e,t)}function Pv(e,t){var n=t.id,r=t.bbox,i=t.properties==null?{}:t.properties,s=Yu(e,t);return n==null&&r==null?{type:"Feature",properties:i,geometry:s}:r==null?{type:"Feature",id:n,properties:i,geometry:s}:{type:"Feature",id:n,bbox:r,properties:i,geometry:s}}function Yu(e,t){var n=RN(e.transform),r=e.arcs;function i(u,d){d.length&&d.pop();for(var h=r[u<0?~u:u],f=0,p=h.length;f<p;++f)d.push(n(h[f],f));u<0&&IN(d,p)}function s(u){return n(u)}function a(u){for(var d=[],h=0,f=u.length;h<f;++h)i(u[h],d);return d.length<2&&d.push(d[0]),d}function o(u){for(var d=a(u);d.length<4;)d.push(d[0]);return d}function l(u){return u.map(o)}function c(u){var d=u.type,h;switch(d){case"GeometryCollection":return{type:d,geometries:u.geometries.map(c)};case"Point":h=s(u.coordinates);break;case"MultiPoint":h=u.coordinates.map(s);break;case"LineString":h=a(u.arcs);break;case"MultiLineString":h=u.arcs.map(a);break;case"Polygon":h=l(u.arcs);break;case"MultiPolygon":h=u.arcs.map(l);break;default:return null}return{type:d,coordinates:h}}return c(t)}function PN(e,t){var n={},r={},i={},s=[],a=-1;t.forEach(function(c,u){var d=e.arcs[c<0?~c:c],h;d.length<3&&!d[1][0]&&!d[1][1]&&(h=t[++a],t[a]=c,t[u]=h)}),t.forEach(function(c){var u=o(c),d=u[0],h=u[1],f,p;if(f=i[d])if(delete i[f.end],f.push(c),f.end=h,p=r[h]){delete r[p.start];var g=p===f?f:f.concat(p);r[g.start=f.start]=i[g.end=p.end]=g}else r[f.start]=i[f.end]=f;else if(f=r[h])if(delete r[f.start],f.unshift(c),f.start=d,p=i[d]){delete i[p.end];var m=p===f?f:p.concat(f);r[m.start=p.start]=i[m.end=f.end]=m}else r[f.start]=i[f.end]=f;else f=[c],r[f.start=d]=i[f.end=h]=f});function o(c){var u=e.arcs[c<0?~c:c],d=u[0],h;return e.transform?(h=[0,0],u.forEach(function(f){h[0]+=f[0],h[1]+=f[1]})):h=u[u.length-1],c<0?[h,d]:[d,h]}function l(c,u){for(var d in c){var h=c[d];delete u[h.start],delete h.start,delete h.end,h.forEach(function(f){n[f<0?~f:f]=1}),s.push(h)}}return l(i,r),l(r,i),t.forEach(function(c){n[c<0?~c:c]||s.push([c])}),s}function NN(e){for(var t=-1,n=e.length,r,i=e[n-1],s=0;++t<n;)r=i,i=e[t],s+=r[0]*i[1]-r[1]*i[0];return Math.abs(s)}function $N(e){return Yu(e,FN.apply(this,arguments))}function FN(e,t){var n={},r=[],i=[];t.forEach(s);function s(l){switch(l.type){case"GeometryCollection":l.geometries.forEach(s);break;case"Polygon":a(l.arcs);break;case"MultiPolygon":l.arcs.forEach(a);break}}function a(l){l.forEach(function(c){c.forEach(function(u){(n[u=u<0?~u:u]||(n[u]=[])).push(l)})}),r.push(l)}function o(l){return NN(Yu(e,{type:"Polygon",arcs:[l]}).coordinates[0])}return r.forEach(function(l){if(!l._){var c=[],u=[l];for(l._=1,i.push(c);l=u.pop();)c.push(l),l.forEach(function(d){d.forEach(function(h){n[h<0?~h:h].forEach(function(f){f._||(f._=1,u.push(f))})})})}}),r.forEach(function(l){delete l._}),{type:"MultiPolygon",arcs:i.map(function(l){var c=[],u;if(l.forEach(function(g){g.forEach(function(m){m.forEach(function(v){n[v<0?~v:v].length<2&&c.push(v)})})}),c=PN(e,c),(u=c.length)>1)for(var d=1,h=o(c[0]),f,p;d<u;++d)(f=o(c[d]))>h&&(p=c[0],c[0]=c[d],c[d]=p,h=f);return c}).filter(function(l){return l.length>0})}}class UN extends Pn{constructor(){super(...arguments),this.type="ruler-binned",this.renderType=tt.SVG}showRuler(t,[n,r]){const i=this.parent,s=this.model.getOptions(),{cartesianScales:a}=this.services,o=a.getOrientation(),l=a.getRangeScale(),[c,u]=l.range(),d=a.getDomainScale(),h=d.invert(o===Wt.VERTICAL?n:r),f=R.appendOrSelect(i,"g.ruler").attr("aria-label","ruler"),p=R.appendOrSelect(f,"line.ruler-line"),m=i.selectAll("[role=graphics-symbol]").filter(v=>{if(parseFloat(yt(v,"data.x0"))<=h&&parseFloat(yt(v,"data.x1"))>=h)return!0});if(m.size()>0){this.elementsToHighlight&&this.elementsToHighlight.size()>0&&!Vg(this.elementsToHighlight,m)&&this.hideRuler(),m.dispatch("mouseover"),this.elementsToHighlight=m;const v=I(m.nodes()[0]).datum(),E=parseFloat(yt(v,"data.x0")),y=parseFloat(yt(v,"data.x1")),x=this.model.getActiveDataGroupNames(),S=x.reverse().map(A=>({label:A,value:yt(v,`data.${A}`),class:this.model.getColorClassName({classNameTypes:[it.TOOLTIP],dataGroupName:A})})).filter(A=>A.value!==0);if(S.length>0){this.services.events.dispatchEvent(T.Tooltip.SHOW,{mousePosition:[n,r],hoveredElement:p,items:[{label:yt(s,"bins.rangeLabel")||"Range",value:`${E} – ${y}`},...S,...b(s,"tooltip","showTotal")===!0?[{label:yt(s,"locale.translations.total")||yt(s,"tooltip.totalLabel")||"Total",value:x.reduce((L,B)=>L+parseFloat(yt(v,`data.${B}`)),0)}]:[]]}),f.attr("opacity",1);const A=d((E+y)/2);o==="horizontal"?p.attr("x1",u).attr("x2",c).attr("y1",A).attr("y2",A):p.attr("y1",u).attr("y2",c).attr("x1",A).attr("x2",A)}else this.hideRuler()}else this.hideRuler()}}class yo extends Pn{formatTooltipData(t){return t.reverse()}}class Nv extends Ru{constructor(t,n,r){super(t,n,r),this.type="color-legend",this.renderType=tt.SVG,this.gradient_id=`gradient-id-${Math.floor(Math.random()*99999999999)}`,this.handleAxisCompleteEvent=()=>{const i=this.getComponentContainer(),{width:s}=R.getSVGElementSize(i,{useAttrs:!0}),a=b(this.getOptions(),"data","loading");if(s>Nt.color.barWidth&&!a){const o=b(this.getOptions(),"heatmap","colorLegend","title"),{cartesianScales:l}=this.services,u=l.getMainXScale().range();if(u[0]>1&&(i.select("g.legend").attr("transform",`translate(${u[0]}, 0)`),o)){const{width:d}=R.getSVGElementSize(i.select("g.legend-title").select("text"),{useBBox:!0}),h=u[0]-d-9;h>1?i.select("g.legend-title").attr("transform",`translate(${h}, 0)`):(i.select("g.legend").attr("transform",`translate(${u[0]}, 16)`),i.select("g.legend-title").attr("transform",`translate(${u[0]}, 0)`))}}else i.select("g.legend-title").attr("transform","translate(0, 0)")},this.chartType=r.chartType}init(){this.chartType==="heatmap"&&this.services.events.addEventListener(T.Axis.RENDER_COMPLETE,this.handleAxisCompleteEvent)}render(t=!1){const n=this.getOptions(),r=this.getComponentContainer(),{width:i}=R.getSVGElementSize(r,{useAttrs:!0}),s=b(n,"color","gradient","colors"),a=b(n,this.chartType,"colorLegend","type");let o=b(n,"color","pairing","option");const l=b(n,"heatmap","colorLegend","title");if(b(this.getOptions(),"data","loading")){r.html("");return}const u=!He(s),d=Iv(this.model.getDisplayData()),h=!(i<=Nt.color.barWidth),f=h?Nt.color.barWidth:i,p=R.appendOrSelect(r,"g.legend"),g=R.appendOrSelect(p,"g.legend-axis");if(l){const D=R.appendOrSelect(r,"g.legend-title");R.appendOrSelect(D,"text").text(l).attr("dy","0.7em"),p.attr("transform","translate(0, 16)")}const m=d[0]<0&&d[1]>0?"diverge":"mono";(o<1&&o>4&&m==="mono"||o<1&&o>2&&m==="diverge")&&(o=1);let v=[];const E=m==="diverge"?17:11;if(u)v=s;else for(let D=1;D<E+1;D++)v.push(a===ns.LINEAR?`stop-color-${m}-${o}-${D}`:`fill-${m}-${o}-${D}`);const y=ve(d[0],d[1]),x=rE(y,3),S=Fe().domain(d).range([0,f]),_=Lo(S).tickSize(0).tickValues(x),{code:A,number:L}=b(n,"locale");_.tickFormat(D=>L(D,A));let B;switch(a){case ns.LINEAR:this.drawLinear(v,p,f);break;case ns.QUANTIZE:B=this.drawQuantize(v,m,u,p,f),S.range([B,f]);break;default:throw Error("Entered color legend type is not supported.")}g.attr("transform",`translate(0,${Nt.color.axisYTranslation})`).call(_),g.select(".domain").remove(),g.select("g.tick:last-of-type text").style("text-anchor",h?"middle":"end"),g.select("g.tick:first-of-type text").style("text-anchor",h&&this.chartType!=="choropleth"?"middle":"start")}drawLinear(t,n,r){const i=100/(t.length-1);R.appendOrSelect(n,"linearGradient").attr("id",`${this.gradient_id}-legend`).selectAll("stop").data(t).enter().append("stop").attr("offset",(o,l)=>`${l*i}%`).attr("class",(o,l)=>t[l]).attr("stop-color",o=>o),R.appendOrSelect(n,"rect").attr("width",r).attr("height",Nt.color.barHeight).style("fill",`url(#${this.gradient_id}-legend)`)}drawQuantize(t,n,r,i,s){!r&&n==="diverge"&&t.splice(t.length/2,1);const a=Ii().domain(t).range([0,s]);return R.appendOrSelect(i,"g.quantized-rect").selectAll("rect").data(a.domain()).join("rect").attr("x",l=>a(l)).attr("y",0).attr("width",Math.max(0,a.bandwidth()-1)).attr("height",Nt.color.barHeight).attr("class",l=>l).attr("fill",l=>l),(!r&&n)==="mono"?a.bandwidth()-1:0}destroy(){this.chartType==="heatmap"&&this.services.events.removeEventListener(T.Axis.RENDER_COMPLETE,this.handleAxisCompleteEvent)}}class BN extends gs{constructor(){super(...arguments),this.type="meter-title",this.renderType=tt.SVG}render(t=!1){const n=b(this.model.getDisplayData(),0),r=this.getOptions(),i=this.getComponentContainer(),{groupMapsTo:s}=r.data,a=r.locale.translations.meter.title;if(b(r,"meter","proportional"))this.displayTotal(),this.displayBreakdownTitle();else{const u=i.selectAll("text.meter-title").data(a?[a]:[n[s]]);u.enter().append("text").classed("meter-title",!0).merge(u).attr("x",0).attr("y","1em").text(d=>d),u.exit().remove(),this.appendPercentage()}this.displayStatus();const l=this.getMaxTitleWidth(),c=R.appendOrSelect(i,"text.meter-title");l>0&&c.node().getComputedTextLength()>l&&this.truncateTitle(c,l)}displayBreakdownTitle(){const t=this.getComponentContainer(),n=this.getOptions(),r=this.model.getMaximumDomain(this.model.getDisplayData()),i=b(n,"meter","proportional","total"),s=b(n,"meter","proportional","unit")?b(n,"meter","proportional","unit"):"";let a;if(r===i)a=null;else{const u=i!==null?i-r:r,d=b(n,"meter","proportional","breakdownFormatter"),{code:h,number:f}=b(n,"locale");a=d!==null?d({datasetsTotal:r,total:i}):`${f(r,h)} ${s} used (${f(u,h)} ${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 l=this.getMaxTitleWidth(),c=R.appendOrSelect(t,"text.proportional-meter-title");l>0&&c.node().getComputedTextLength()>l&&this.truncateTitle(c,l)}displayTotal(){const t=this.getComponentContainer(),n=this.getOptions(),r=b(n,"meter","proportional","total"),i=r?b(n,"meter","proportional","total"):this.model.getMaximumDomain(this.model.getDisplayData()),s=b(n,"meter","proportional","unit")?b(n,"meter","proportional","unit"):"",a=b(n,"meter","proportional","totalFormatter"),{code:o,number:l}=b(n,"locale"),c=a!==null?a(i):`${l(r,o)} ${s} total`,u=R.getHTMLElementSize(this.parent.node()).width,d=t.selectAll("text.proportional-meter-total").data([c]);d.enter().append("text").classed("proportional-meter-total",!0).merge(d).attr("x",this.model.getStatus()&&typeof u!="string"?u-jt.total.paddingRight:u).attr("y","1em").attr("text-anchor","end").text(h=>h),d.exit().remove()}displayStatus(){const t=this,n=this.getComponentContainer(),r=R.getHTMLElementSize(this.parent.node()).width||0,i=this.model.getStatus(),s=jt.status.indicatorSize/2,a=R.appendOrSelect(n,"g.status-indicator").attr("class",i!==null?`status-indicator status--${i}`:"").attr("transform",`translate(${r-s}, 0)`),o=i?[i]:[],l=a.selectAll("circle.status").data(o);l.enter().append("circle").merge(l).attr("class","status").attr("r",s).attr("cx",0).attr("cy",8);const c=a.selectAll("path.innerFill").data(o);c.enter().append("path").merge(c).attr("d",t.getStatusIconPathString(i)).attr("transform",`translate(-${s}, 0)`).attr("class","innerFill"),c.exit().remove(),l.exit().remove()}appendPercentage(){const t=b(this.model.getDisplayData(),0,"value"),{code:n,number:r}=b(this.getOptions(),"locale"),i=this.getComponentContainer(),s=R.appendOrSelect(i,"text.meter-title"),a=b(this.getOptions(),"meter","statusBar","percentageIndicator","enabled")===!0?[t]:[],o=i.selectAll("text.percent-value").data(a),l=jt.statusBar.paddingRight;o.enter().append("text").classed("percent-value",!0).merge(o).text(c=>`${c!=null?r(c,n):0}%`).attr("x",+s.attr("x")+s.node().getComputedTextLength()+l).attr("y",s.attr("y")),o.exit().remove()}truncateTitle(t,n){super.truncateTitle(t,n);const r=R.appendOrSelect(this.parent,"tspan"),i=jt.statusBar.paddingRight,s=Math.ceil(r.node().getComputedTextLength());R.appendOrSelect(this.parent,"text.percent-value").attr("x",+t.attr("x")+t.node().getComputedTextLength()+s+i)}getMaxTitleWidth(){const t=b(this.getOptions(),"meter","proportional"),n=R.getHTMLElementSize(this.parent.node()).width;if(t!==null){const r=R.appendOrSelect(this.parent,"text.proportional-meter-total").node(),i=R.getSVGElementSize(r,{useBBox:!0}).width;return n-i-jt.total.paddingLeft}else{const r=R.appendOrSelect(this.parent,"text.percent-value"),i=jt.statusBar.paddingRight,s=r.node().getComputedTextLength(),a=R.appendOrSelect(this.parent,"g.status-indicator").node(),o=R.getSVGElementSize(a,{useBBox:!0}).width+jt.status.paddingLeft;return n-s-i-o}}getStatusIconPathString(t){switch(t){case ts.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 ts.DANGER:return"M10.7 11.5 4.5 5.3 5.3 4.5 11.5 10.7 Z";case ts.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 qu extends pt{getBarWidth(){const t=this.getOptions();if(t.bars.width)return t.bars.width;const n=this.model.getDisplayData().length,r=this.services.cartesianScales.getMainXScale(),i=R.getSVGElementSize(this.parent,{useAttrs:!0}).width;if(!r.step){const s=b(t,"bars","spacingFactor");return Math.min(t.bars.maxWidth,i*s/n)}return Math.min(t.bars.maxWidth,r.step()/2)}isOutsideZoomedDomain(t,n){if(this.model.getDisplayData().length<=1)return!1;const i=this.model.get("zoomDomain");if(i!==void 0){const s=this.services.cartesianScales.getDomainScale();return t<s(i[0])||n>s(i[1])}return!1}}class HN extends pt{constructor(){super(...arguments),this.type="circle-pack",this.renderType=tt.SVG,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail;this.parent.selectAll("circle.node").transition("legend-hover-circlepack").call(r=>this.services.transitions.setupTransition({transition:r,name:"legend-hover-circlepack"})).attr("opacity",r=>r.data.dataGroupName===n.datum().name?1:Xr.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:r,height:i}=R.getSVGElementSize(this.parent,{useAttrs:!0});if(r<1||i<1)return;let s=this.model.getDisplayData();const a=this.model.hasParentNode(),o=this.model.getHierarchyLevel(),l=this.getOptions(),c=b(l,"canvasZoom","enabled");a&&b(s,0,"children")&&(s=b(s,0,"children"));const u=Di({children:s}).sum(g=>g.value).sort((g,m)=>m.value-g.value),h=y_().size([r,i]).padding(g=>g.depth>=1?Xr.padding.children+3:Xr.padding.mainGroup+3)(u).descendants().splice(1).filter(g=>g.depth<=o),f=n.selectAll("circle.node").data(h);f.exit().attr("width",0).attr("height",0).remove();const p=f.enter().append("circle").classed("node",!0);p.merge(f).attr("class",g=>{const m=c&&o===3?this.getZoomClass(g):"";return this.model.getColorClassName({classNameTypes:[it.FILL,it.STROKE],dataGroupName:g.data.dataGroupName,originalClassName:g.children?`node ${m}`:`node node-leaf ${m}`})}).style("fill",g=>this.model.getFillColor(g.data.dataGroupName,null,g.data)).style("stroke",g=>this.model.getFillColor(g.data.dataGroupName,null,g.data)).attr("cx",g=>g.x).attr("cy",g=>g.y).transition("circlepack-leaf-update-enter").call(g=>this.services.transitions.setupTransition({transition:g,name:"circlepack-leaf-update-enter"})).attr("r",g=>g.r).attr("opacity",1).attr("fill-opacity",Xr.circles.fillOpacity),c===!0&&this.focal&&(this.services.canvasZoom.zoomIn(this.focal,p,qr),this.setBackgroundListeners()),a||this.addLegendListeners(),this.addEventListeners()}unhighlightChildren(t){const n=t.map(r=>r.data);this.parent.selectAll("circle.node").filter(r=>n.some(i=>i===r.data)&&r.depth>1).style("stroke",r=>this.model.getFillColor(r.data.dataGroupName,null,r.data))}highlightChildren(t){const n=t.map(r=>r.data);this.parent.selectAll("circle.node").filter(r=>n.some(i=>i===r.data)&&r.depth>1).style("stroke",Xr.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(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}removeBackgroundListeners(){I(this.services.domUtils.getMainContainer()).on("click",()=>null)}setBackgroundListeners(){const t=I(this.services.domUtils.getMainContainer()),n=this,r=this.parent.selectAll("circle.node");t.on("click",()=>{n.focal=null,n.model.updateHierarchyLevel(2),t.classed("zoomed-in",!1),n.services.canvasZoom.zoomOut(r,qr)})}getZoomIcon(){return`
|
|
82
82
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 10">
|
|
83
83
|
<polygon points="5.93 3.71 4.45 3.71 4.45 2.23 3.71 2.23 3.71 3.71 2.23 3.71 2.23 4.45 3.71 4.45 3.71 5.93 4.45 5.93 4.45 4.45 5.93 4.45 5.93 3.71"/>
|
|
84
84
|
<path d="M7.2,6.67a4,4,0,0,0,1-2.59A4.08,4.08,0,1,0,4.07,8.15h0a4,4,0,0,0,2.59-1L9.48,10,10,9.48Zm-3.12.77A3.34,3.34,0,1,1,7.41,4.08,3.34,3.34,0,0,1,4.08,7.44Z"/>
|
|
85
|
-
</svg>`}addEventListeners(){const t=this;this.parent.selectAll("circle.node").on("mouseover",function(n,r){const i=I(this);i.classed("hovered",!0);const s=t.model.getHierarchyLevel(),a=s>2&&!i.classed("focal"),o=b(t.model.getOptions(),"canvasZoom","enabled");let l=!1;if(!a){let c=[],u=[],d=null;if(r.children){r.depth>1&&o&&(l=!0,i.classed("clickable",!0)),c=r.children.map(p=>{if(p!==null)return typeof p.data.value=="number"?{label:p.data.name,value:p.data.value}:{label:p.data.name,labelIcon:o&&s<=2?t.getZoomIcon():null,value:p.value}});const f=t.model.getOptions();u=[{label:yt(f,"locale.translations.total")||yt(f,"tooltip.totalLabel")||"Total",value:r.value,bold:!0}],t.highlightChildren(r.children)}else d=r.value;const h=getComputedStyle(this,null).getPropertyValue("fill");t.services.events.dispatchEvent(T.Tooltip.SHOW,{event:n,hoveredElement:i,items:[{color:h,label:r.data.name,labelIcon:l&&o&&s<=2?t.getZoomIcon():null,value:d},...c,...u]})}t.services.events.dispatchEvent(T.CirclePack.CIRCLE_MOUSEOVER,{event:n,element:i,datum:r})}).on("mousemove",function(n,r){const i=I(this);t.services.events.dispatchEvent(T.CirclePack.CIRCLE_MOUSEMOVE,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(T.Tooltip.MOVE,{event:n})}).on("mouseout",function(n,r){const i=I(this);i.classed("hovered",!1),r.children&&t.unhighlightChildren(r.children),t.services.events.dispatchEvent(T.CirclePack.CIRCLE_MOUSEOUT,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(T.Tooltip.HIDE,{hoveredElement:i})}).on("click",function(n,r){const i=I(this),s=i.classed("non-focal"),a=b(t.model.getOptions(),"canvasZoom","enabled");if(a&&t.model.getHierarchyLevel()>2){const o=t.parent.selectAll("circle.node");I(t.services.domUtils.getMainContainer()).classed("zoomed-in",!1),t.focal=null,t.model.updateHierarchyLevel(2),t.services.canvasZoom.zoomOut(o,qr)}else if(r.depth===2&&r.children&&!s&&a){const o=t.parent.selectAll("circle.node");I(t.services.domUtils.getMainContainer()).classed("zoomed-in",!0),t.focal=r,t.model.updateHierarchyLevel(3),t.services.canvasZoom.zoomIn(r,o,qr),n.stopPropagation()}t.services.events.dispatchEvent(T.CirclePack.CIRCLE_CLICK,{event:n,element:i,datum:r})})}destroy(){this.parent.selectAll("circle.node").on("mouseover",null).on("mousemove",null).on("mouseout",null).on("click",null);const t=this.services.events;t.removeEventListener(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut),this.removeBackgroundListeners()}}function GN(e,t){const n=pi(this._current,e);return r=>(this._current=n(r),t(this._current))}class $v extends pt{constructor(){super(...arguments),this.type="pie",this.renderType=tt.SVG,this.isRendering=!1,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail,{groupMapsTo:r}=this.getOptions().data;this.parent.selectAll("path.slice").transition("legend-hover-bar").call(i=>this.services.transitions.setupTransition({transition:i,name:"legend-hover-bar"})).attr("opacity",i=>i.data[r]!==n.datum().name?.3:1)},this.handleLegendMouseOut=()=>{this.parent.selectAll("path.slice").transition("legend-mouseout-bar").call(t=>this.services.transitions.setupTransition({transition:t,name:"legend-mouseout-bar"})).attr("opacity",1)}}init(){const t=this.services.events;t.addEventListener(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}getInnerRadius(){return Lt.innerRadius}render(t=!0){const n=this,r=this.getComponentContainer(),i=this.getOptions(),{groupMapsTo:s}=i.data,{valueMapsTo:a}=i.pie;this.isRendering=!0;const o=this.model.getDisplayData().filter(M=>M[a]>0),l=this.computeRadius();this.arc=Ui().innerRadius(this.getInnerRadius()).outerRadius(l),this.hoverArc=Ui().innerRadius(this.getInnerRadius()).outerRadius(l+Lt.hoverArc.outerRadiusOffset);const u=gT().value(M=>M[a]).sort(b(i,"pie","sortFunction")).padAngle(Lt.padAngle)(o),h=R.appendOrSelect(r,"g.slices").attr("role",ut.GROUP).attr("data-name","slices").selectAll("path.slice").data(u,M=>M.data[s]);h.exit().attr("opacity",0).remove(),h.enter().append("path").classed("slice",!0).attr("opacity",0).merge(h).attr("class",M=>this.model.getColorClassName({classNameTypes:[it.FILL],dataGroupName:M.data[s],originalClassName:"slice"})).style("fill",M=>n.model.getFillColor(M.data[s],null,M.data)).attr("d",this.arc).transition().call(M=>this.services.transitions.setupTransition({transition:M,name:"pie_slice_enter_update",animate:t})).attr("opacity",1).attr("role",ut.GRAPHICS_SYMBOL).attr("aria-roledescription","slice").attr("aria-label",M=>`${M[a]}, ${Zc(M.data[a],o,a)+"%"}`).attrTween("d",function(M){return GN.bind(this)(M,n.arc)}).end().finally(()=>{n.isRendering=!1});const{code:g,number:m}=b(i,"locale"),v=i.pie.labels.enabled,E=v?u.filter(M=>M.data[a]>0):[],x=R.appendOrSelect(r,"g.labels").attr("role",ut.GROUP).attr("data-name","labels").selectAll("text.pie-label").data(E,M=>M.data[s]);x.exit().attr("opacity",0).remove();const S=x.enter().append("text").classed("pie-label",!0),_=[];S.merge(x).style("text-anchor","middle").text(M=>i.pie.labels.formatter?i.pie.labels.formatter({...M,percentageValue:Zc(M.data[a],o,a,!0)}):m(Zc(M.data[a],o,a),g)+"%").datum(function(M){const w=l+7,U=(M.endAngle-M.startAngle)/2+M.startAngle,F=U/Math.PI*180,$=this.getComputedTextLength();return M.textOffsetX=$/2,M.textOffsetY=F>90&&F<270?10:0,M.xPosition=(M.textOffsetX+w)*Math.sin(U),M.yPosition=(M.textOffsetY+w)*-Math.cos(U),M}).attr("transform",function(M,w){const U=E.length,F=(M.endAngle-M.startAngle)*(180/Math.PI);if(w>=U-2&&F<Lt.callout.minSliceDegree){let $,N;return M.index===U-1?($=M.xPosition+Lt.callout.offsetX+Lt.callout.textMargin+M.textOffsetX,N=M.yPosition-Lt.callout.offsetY,M.direction=Ji.RIGHT,_.push(M)):($=M.xPosition-Lt.callout.offsetX-M.textOffsetX-Lt.callout.textMargin,N=M.yPosition-Lt.callout.offsetY,M.direction=Ji.LEFT,_.push(M)),`translate(${$}, ${N})`}return`translate(${M.xPosition}, ${M.yPosition})`}),this.renderCallouts(_);const A=b(i,"donut")?"donut":"pie",L=b(i,A,"alignment"),{width:B}=R.getSVGElementSize(this.getParent(),{useAttrs:!0}),D=v?Lt.xOffset:0,O=v?Lt.yOffset:0;let H=l+D;L===Bt.CENTER?H=B/2:L===Bt.RIGHT&&(H=B-l-Lt.xOffset);let P=l+O;_.length>0&&(P+=Lt.yOffsetCallout),r.attr("x",H+7).attr("y",P),this.addEventListeners()}renderCallouts(t){const n=R.appendOrSelect(this.getComponentContainer(),"g.callouts").attr("role",ut.GROUP).attr("data-name","callouts"),r=n.selectAll("g.callout").data(t);r.exit().remove();const i=r.enter().append("g").classed("callout",!0).attr("role",ut.GROUP).attr("aria-roledescription","label callout");i.merge(r).datum(function(o){const{xPosition:l,yPosition:c,direction:u}=o;return u===Ji.RIGHT?(o.startPos={x:l,y:c+o.textOffsetY},o.endPos={x:l+Lt.callout.offsetX,y:c-Lt.callout.offsetY+o.textOffsetY},o.intersectPointX=o.endPos.x-Lt.callout.horizontalLineLength):(o.startPos={x:l,y:c+o.textOffsetY},o.endPos={x:l-Lt.callout.offsetX,y:c-Lt.callout.offsetY+o.textOffsetY},o.intersectPointX=o.endPos.x+Lt.callout.horizontalLineLength),o}),i.append("line").classed("vertical-line",!0).merge(n.selectAll("line.vertical-line")).datum(function(){return I(this.parentNode).datum()}).style("stroke-width","1px").attr("x1",o=>o.startPos.x).attr("y1",o=>o.startPos.y).attr("x2",o=>o.intersectPointX).attr("y2",o=>o.endPos.y),i.append("line").classed("horizontal-line",!0).merge(n.selectAll("line.horizontal-line")).datum(function(){return I(this.parentNode).datum()}).style("stroke-width","1px").attr("x1",o=>o.intersectPointX).attr("y1",o=>o.endPos.y).attr("x2",o=>o.endPos.x).attr("y2",o=>o.endPos.y)}addEventListeners(){const t=this;this.parent.selectAll("path.slice").on("mouseover",function(n,r){const i=I(this);t.isRendering||i.classed("hovered",!0).transition("pie_slice_mouseover").call(o=>t.services.transitions.setupTransition({transition:o,name:"pie_slice_mouseover"})).attr("d",t.hoverArc),t.services.events.dispatchEvent(T.Pie.SLICE_MOUSEOVER,{event:n,element:I(this),datum:r});const{groupMapsTo:s}=t.getOptions().data,{valueMapsTo:a}=t.getOptions().pie;t.services.events.dispatchEvent(T.Tooltip.SHOW,{event:n,hoveredElement:i,items:[{label:r.data[s],value:r.data[a]}]})}).on("mousemove",function(n,r){const i=I(this);t.services.events.dispatchEvent(T.Pie.SLICE_MOUSEMOVE,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(T.Tooltip.MOVE,{event:n})}).on("click",function(n,r){t.services.events.dispatchEvent(T.Pie.SLICE_CLICK,{event:n,element:I(this),datum:r})}).on("mouseout",function(n,r){const i=I(this);jL(()=>{t.isRendering||i.classed("hovered",!1).transition("pie_slice_mouseout").call(s=>t.services.transitions.setupTransition({transition:s,name:"pie_slice_mouseout"})).attr("d",t.arc)},100),t.services.events.dispatchEvent(T.Pie.SLICE_MOUSEOUT,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(T.Tooltip.HIDE,{hoveredElement:i})})}computeRadius(){const{width:t,height:n}=R.getSVGElementSize(this.parent,{useAttrs:!0}),r=this.getOptions(),i=Math.min(t,n)/2;return r.pie.labels.enabled?i+Lt.radiusOffset:i}}class VN extends $v{constructor(){super(...arguments),this.type="donut",this.renderType=tt.SVG}render(t=!0){super.render(t);const n=this;if(this.model.isDataEmpty()){this.getComponentContainer().select("g.center").remove();return}const r=R.appendOrSelect(this.getComponentContainer(),"g.center"),i=this.getOptions(),s=this.computeRadius(),a=b(i,"donut","center","label");R.appendOrSelect(r,"text.donut-figure").attr("text-anchor","middle").style("dominant-baseline",()=>a===null||a===""?"central":"initial").style("font-size",()=>i.donut.center.numberFontSize(s)).transition().call(o=>this.services.transitions.setupTransition({transition:o,name:"donut-figure-enter-update",animate:t})).tween("text",function(){return n.centerNumberTween(I(this))}),a!==null&&a!==""&&R.appendOrSelect(r,"text.donut-title").attr("text-anchor","middle").style("font-size",()=>i.donut.center.titleFontSize(s)).attr("y",i.donut.center.titleYPosition(s)).text(a)}getInnerRadius(){return this.computeRadius()*(3/4)}centerNumberTween(t){const n=this.getOptions();let r=b(n,"donut","center","number");r===null&&(r=this.model.getDisplayData().reduce((o,l)=>o+l[n.pie.valueMapsTo],0));const i=parseInt(t.text().replace(/[, ]+/g,""),10)||0;let s;i%1===0&&r%1===0?s=Ih:s=ve;const a=s(i,r);return o=>{const{numberFormatter:l}=n.donut.center;if(l)t.text(l(a(o)));else{const{code:c,number:u}=b(n,"locale");t.text(u(Math.floor(a(o)),c))}}}}const Fv="4,10 8,6 12,10",Uv="12,6 8,10 4,6";class zN extends pt{constructor(){super(...arguments),this.type="gauge",this.renderType=tt.SVG}getValue(){var r;return((r=this.model.getData().find(i=>i.group==="value"))==null?void 0:r.value)??null}getValueRatio(){return lg(this.getValue(),0,100)/100}getDelta(){var r;return((r=this.model.getData().find(i=>i.group==="delta"))==null?void 0:r.value)??null}getArcRatio(){const t=this.getOptions();return b(t,"gauge","type")===sr.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(b(n,"gauge","deltaArrow","direction")){case Wa.UP:return Fv;case Wa.DOWN:return Uv;default:return t>0?Fv:Uv}}render(t=!0){const n=this.getComponentContainer().attr("width","100%").attr("height","100%"),r=this.getOptions(),i=this.getValue(),s=this.getValueRatio(),a=this.getArcSize(),o=this.getStartAngle(),l=s*a,c=o+l,u=o+a,d=this.computeRadius(),h=this.getInnerRadius();this.backgroundArc=Ui().innerRadius(h).outerRadius(d).startAngle(c).endAngle(u),this.arc=Ui().innerRadius(h).outerRadius(d).startAngle(o).endAngle(c),R.appendOrSelect(n,"path.arc-background").attr("d",this.backgroundArc);const f=n.selectAll("path.arc-foreground").data([i]);f.enter().append("path").merge(f).attr("class",this.model.getColorClassName({classNameTypes:[it.FILL],dataGroupName:"value",originalClassName:"arc-foreground"})).style("fill",()=>b(this.getOptions(),"color","scale","value")).attr("d",this.arc).attr("role",ut.GRAPHICS_SYMBOL).attr("aria-roledescription","value").attr("aria-label",E=>E),this.drawValueNumber(),this.drawDelta(),f.exit().remove();const g=b(r,"gauge","alignment"),{width:m}=R.getSVGElementSize(this.getParent(),{useAttrs:!0});let v=d;g===Bt.CENTER?v=m/2:g===Bt.RIGHT&&(v=m-d),n.attr("x",v).attr("y",d),this.addEventListeners()}drawValueNumber(){const t=this.getComponentContainer(),n=this.getOptions(),r=b(n,"gauge","type"),i=this.getValue(),s=this.getDelta(),a=this.computeRadius(),o=b(n,"gauge","valueFontSize"),l=b(n,"gauge","deltaFontSize"),c=b(n,"gauge","numberSpacing"),u=b(n,"gauge","showPercentageSymbol");let d=0;r===sr.FULL&&!s?d=l(a):r===sr.SEMI&&s&&(d=-(l(a)+c));const h=R.appendOrSelect(t,"g.gauge-numbers").attr("transform",`translate(0, ${d})`),f=o(a),p=R.appendOrSelect(h,"g.gauge-value-number"),{code:g,number:m}=b(n,"locale"),v=b(n,"gauge","numberFormatter"),E=p.selectAll("text.gauge-value-number").data([i]);E.enter().append("text").attr("class","gauge-value-number").merge(E).style("font-size",`${f}px`).attr("text-anchor","middle").text(B=>{let D;return B!=null?D=Number(B.toFixed(2))%1!==0?B.toFixed(2):B.toFixed():D=0,v?v(D):m(Number(D),g)});const{width:y}=R.getSVGElementSize(R.appendOrSelect(t,"text.gauge-value-number"),{useBBox:!0}),x=f/2,S=u?"%":"",_=R.appendOrSelect(p,"text.gauge-value-symbol").style("font-size",`${x}px`).attr("x",y/2).text(S),{width:A,height:L}=R.getSVGElementSize(_,{useBBox:!0});_.attr("y",`-${L/2}px`),p.attr("transform",`translate(-${A/2}, 0)`)}drawDelta(){const t=this,n=this.getComponentContainer(),r=this.getOptions(),i=this.getDelta(),{code:s,number:a}=b(r,"locale");if(i){const o=this.computeRadius(),l=i?b(r,"gauge","deltaFontSize"):()=>0,c=i?b(r,"gauge","numberFormatter"):()=>null,u=b(r,"gauge","deltaArrow","size"),d=b(r,"gauge","numberSpacing"),h=b(r,"gauge","showPercentageSymbol"),f=R.appendOrSelect(n,"g.gauge-numbers"),p=R.appendOrSelect(f,"g.gauge-delta").attr("transform",`translate(0, ${l(o)+d})`),g=R.appendOrSelect(p,"text.gauge-delta-number"),m=h?"%":"";g.data(i===null?[]:[i]),g.enter().append("text").classed("gauge-delta-number",!0).merge(g).attr("text-anchor","middle").style("font-size",`${l(o)}px`).text(x=>{let S;return x!=null?S=Number(x.toFixed(2))%1!==0?x.toFixed(2):x.toFixed():S=0,c?`${c(S)}${m}`:`${a(Number(S),s)}${m}`});const{width:v}=R.getSVGElementSize(R.appendOrSelect(n,".gauge-delta-number"),{useBBox:!0}),E=b(r,"gauge","deltaArrow","enabled"),y=p.selectAll("svg.gauge-delta-arrow").data(i!==null&&E?[i]:[]);y.enter().append("svg").merge(y).attr("class","gauge-delta-arrow").attr("x",-u(o)-v/2).attr("y",-u(o)/2-l(o)*.35).attr("width",u(o)).attr("height",u(o)).attr("viewBox","0 0 16 16").each(function(){const x=I(this);R.appendOrSelect(x,"rect.gauge-delta-arrow-backdrop").attr("width","16").attr("height","16").attr("fill","none");const S=b(r,"gauge","status");R.appendOrSelect(x,"polygon.gauge-delta-arrow").attr("class",S!==null?`gauge-delta-arrow status--${S}`:"").attr("points",t.getArrow(i))}),y.exit().remove(),g.exit().remove()}else{const o=n.select("g.gauge-delta");o.empty()||o.remove()}}getInnerRadius(){const t=this.computeRadius(),n=b(this.getOptions(),"gauge","arcWidth");return t-n}addEventListeners(){const t=this;this.parent.selectAll("path.arc-foreground").on("mouseover",function(n,r){t.services.events.dispatchEvent(T.Gauge.ARC_MOUSEOVER,{event:n,element:I(this),datum:r})}).on("mousemove",function(n,r){const i=I(this);t.services.events.dispatchEvent(T.Gauge.ARC_MOUSEMOVE,{event:n,element:i,datum:r})}).on("click",function(n,r){t.services.events.dispatchEvent(T.Gauge.ARC_CLICK,{event:n,element:I(this),datum:r})}).on("mouseout",function(n,r){const i=I(this);t.services.events.dispatchEvent(T.Gauge.ARC_MOUSEOUT,{event:n,element:i,datum:r})})}computeRadius(){const t=this.getOptions(),n=b(t,"gauge","type"),{width:r,height:i}=R.getSVGElementSize(this.parent,{useAttrs:!0});return n===sr.SEMI?Math.min(r/2,i):Math.min(r/2,i/2)}}class Bv extends qu{constructor(){super(...arguments),this.type="grouped-bar",this.renderType=tt.SVG,this.padding=5,this.defaultStepFactor=70,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail,{groupMapsTo:r}=this.getOptions().data;this.parent.selectAll("path.bar").transition("legend-hover-bar").call(i=>this.services.transitions.setupTransition({transition:i,name:"legend-hover-bar"})).attr("opacity",i=>i[r]!==n.datum().name?.3:1)},this.handleLegendMouseOut=()=>{this.parent.selectAll("path.bar").transition("legend-mouseout-bar").call(t=>this.services.transitions.setupTransition({transition:t,name:"legend-mouseout-bar"})).attr("opacity",1)}}init(){const t=this.services.events;t.addEventListener(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t){const n=this.model.getDisplayData(this.configs.groups),r=this.getOptions(),{groupMapsTo:i}=r.data;this.setGroupScale();const s=this.getComponentContainer({withinChartClip:!0}),a=Qi(n.map(h=>{const f=this.services.cartesianScales.getDomainIdentifier(h);return h[f]&&typeof h[f].toString=="function"?h[f].toString():h[f]})),o=s.selectAll("g.bars").data(a,h=>h);o.exit().attr("opacity",0).remove();const c=o.enter().append("g").classed("bars",!0).attr("role",ut.GROUP).attr("data-name","bars").merge(o);c.transition().call(h=>this.services.transitions.setupTransition({transition:h,name:"bar-group-update-enter",animate:t})).attr("transform",h=>{const p=this.services.cartesianScales.getDomainValue(h)-this.getGroupWidth()/2;return this.services.cartesianScales.getOrientation()===Wt.VERTICAL?`translate(${p}, 0)`:`translate(0, ${p})`});const u=c.selectAll("path.bar").data(h=>this.getDataCorrespondingToLabel(h),h=>h[i]);u.exit().attr("opacity",0).remove(),u.enter().append("path").attr("opacity",0).merge(u).classed("bar",!0).transition().call(h=>this.services.transitions.setupTransition({transition:h,name:"bar-update-enter",animate:t})).attr("class",h=>this.model.getColorClassName({classNameTypes:[it.FILL],dataGroupName:h[i],originalClassName:"bar"})).style("fill",h=>{const f=this.services.cartesianScales.getDomainIdentifier(h);return this.model.getFillColor(h[i],h[f],h)}).attr("d",h=>{const f=this.groupScale(h[i]),p=this.getBarWidth(),g=f,m=f+p,v=this.services.cartesianScales.getRangeAxisPosition({datum:h}),E=this.services.cartesianScales.getValueThroughAxisPosition(v,0),y=this.services.cartesianScales.getRangeValue(h),x=this.services.cartesianScales.getDomainValue(h)-p/2,S=x+p;if(!this.isOutsideZoomedDomain(x,S))return ie({x0:g,x1:m,y0:E,y1:y},this.services.cartesianScales.getOrientation())}).attr("opacity",1).attr("role",ut.GRAPHICS_SYMBOL).attr("aria-roledescription","bar").attr("aria-label",h=>h.value),this.addEventListeners()}addEventListeners(){const t=this;this.parent.selectAll("path.bar").on("mouseover",function(n,r){const i=I(this);i.classed("hovered",!0),t.services.events.dispatchEvent(T.Bar.BAR_MOUSEOVER,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(T.Tooltip.SHOW,{event:n,hoveredElement:i,data:[r]})}).on("mousemove",function(n,r){const i=I(this);t.services.events.dispatchEvent(T.Bar.BAR_MOUSEMOVE,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(T.Tooltip.MOVE,{event:n})}).on("click",function(n,r){t.services.events.dispatchEvent(T.Bar.BAR_CLICK,{event:n,element:I(this),datum:r})}).on("mouseout",function(n,r){const i=I(this);i.classed("hovered",!1),t.services.events.dispatchEvent(T.Bar.BAR_MOUSEOUT,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(T.Tooltip.HIDE,{hoveredElement:i})})}destroy(){this.parent.selectAll("path.bar").on("mouseover",null).on("mousemove",null).on("mouseout",null);const t=this.services.events;t.removeEventListener(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}getDataCorrespondingToLabel(t){return this.model.getDisplayData(this.configs.groups).filter(r=>{const i=this.services.cartesianScales.getDomainIdentifier(r);return r[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 r=this.defaultStepFactor;if(typeof t.step=="function")r=t.step();else if(n.length>0){const i=n.find(s=>{var a;return((a=s.data)==null?void 0:a.length)>1});if(i){const s=this.services.cartesianScales.getDomainIdentifier(i.data[0]);r=Math.abs(t(i.data[1][s])-t(i.data[0][s]))}}return r}getTotalGroupPadding(){const t=this.model.getGroupedData(this.configs.groups);return t.length===1?0:Math.min(5,5*(this.getDomainScaleStep()/this.defaultStepFactor))*(t.length-1)}getBarWidth(){const t=this.getOptions(),n=b(t,"bars","width"),r=b(t,"bars","maxWidth");if(n!==null&&(r===null||n<=r))return n;const s=this.model.getGroupedData(this.configs.groups).length,a=this.getTotalGroupPadding();return Math.min(r,(this.getDomainScaleStep()-a)/s)}setGroupScale(){const t=this.model.getActiveDataGroupNames(this.configs.groups);this.groupScale=Ii().domain(t).rangeRound([0,this.getGroupWidth()])}}class WN extends pt{constructor(){super(...arguments),this.type="heatmap",this.renderType=tt.SVG,this.matrix={},this.xBandwidth=0,this.yBandwidth=0,this.translationUnits={x:0,y:0},this.handleAxisOnHover=t=>{const{detail:n}=t,{datum:r}=n,i=this.model.getUniqueRanges(),s=this.model.getUniqueDomain(),a=this.services.cartesianScales.getDomainLabel(),o=this.services.cartesianScales.getRangeLabel(),l=this.services.cartesianScales.getMainXScale(),c=this.services.cartesianScales.getMainYScale();let u="",d=null,h=null,f=null;this.matrix[r]!==void 0?(u=a,i.forEach(p=>{if(typeof this.matrix[r][p].value=="number"){const g=this.matrix[r][p].value;if(d===null){d=g,h=g,f=g;return}d+=g,h=g<h?g:h,f=g>f?g:f}})):(u=o,s.forEach(p=>{if(typeof this.matrix[p][r].value=="number"){const g=this.matrix[p][r].value;if(d===null){d=g,h=g,f=g;return}d+=g,h=g<h?g:h,f=g>f?g:f}})),l(r)!==void 0?this.parent.select("g.multi-cell.column-highlight").classed("highlighter-hidden",!1).attr("transform",`translate(${l(r)}, ${An(c.range())})`):c(r)!==void 0&&this.parent.select("g.multi-cell.row-highlight").classed("highlighter-hidden",!1).attr("transform",`translate(${An(l.range())},${c(r)})`),this.services.events.dispatchEvent(T.Tooltip.SHOW,{event:n.event,hoveredElement:I(t.detail.element),items:[{label:u,value:r,bold:!0},{label:"Min",value:h!==null?h:"-"},{label:"Max",value:f!==null?f:"-"},{label:"Average",value:d!==null?d/s.length:"-"}]})},this.handleAxisMouseOut=t=>{this.parent.selectAll("g.multi-cell").classed("highlighter-hidden",!0),this.services.events.dispatchEvent(T.Tooltip.HIDE,{event:t})}}init(){const t=this.services.events;t.addEventListener(T.Axis.LABEL_MOUSEOVER,this.handleAxisOnHover),t.addEventListener(T.Axis.LABEL_MOUSEOUT,this.handleAxisMouseOut),t.addEventListener(T.Axis.LABEL_FOCUS,this.handleAxisOnHover),t.addEventListener(T.Axis.LABEL_BLUR,this.handleAxisMouseOut)}render(t=!0){const n=this.getComponentContainer({withinChartClip:!0});n.lower();const{cartesianScales:r}=this.services;if(this.matrix=this.model.getMatrix(),n.html(""),b(this.getOptions(),"data","loading"))return;const i=r.getMainXScale(),s=r.getMainYScale(),a=r.getDomainIdentifier(),o=r.getRangeIdentifier(),l=this.model.getUniqueDomain(),c=this.model.getUniqueRanges(),u=this.model.getMatrixAsArray(),d=i.range(),h=s.range();this.xBandwidth=Math.abs((d[1]-d[0])/l.length),this.yBandwidth=Math.abs((h[1]-h[0])/c.length);const f=this.services.domUtils.generateElementIDString("heatmap-pattern-stripes");n.append("defs").append("pattern").attr("id",f).attr("width",3).attr("height",3).attr("patternUnits","userSpaceOnUse").attr("patternTransform","rotate(45)").append("rect").classed("pattern-fill",!0).attr("width",.5).attr("height",8);const p=n.selectAll().data(u).enter().append("g").attr("class",g=>`heat-${g.index}`).classed("cell",!0).attr("transform",g=>`translate(${i(g[a])}, ${s(g[o])})`).append("rect").attr("class",g=>this.model.getColorClassName({value:g.value,originalClassName:`heat-${g.index}`})).classed("heat",!0).classed("null-state",g=>g.index===-1||g.value===null).attr("width",this.xBandwidth).attr("height",this.yBandwidth).style("fill",g=>{const m=this.services.cartesianScales.getDomainIdentifier(g);return g.index===-1||g.value===null?`url(#${f})`:this.model.getFillColor(Number(g.value),g[m],g)}).attr("aria-label",g=>g.value);this.createOuterBox("g.cell-highlight",this.xBandwidth,this.yBandwidth),this.createOuterBox("g.multi-cell.column-highlight",this.xBandwidth,Math.abs(h[1]-h[0])),this.createOuterBox("g.multi-cell.row-highlight",Math.abs(d[1]-d[0]),this.yBandwidth),this.determineDividerStatus()&&(p.style("stroke-width","1px"),this.parent.select("g.cell-highlight").classed("cell-2",!0)),this.addEventListener()}createOuterBox(t,n,r){const i=R.appendOrSelect(this.parent,t).classed("shadows",!0).classed("highlighter-hidden",!0);R.appendOrSelect(i,"line.top").attr("x1",-1).attr("x2",n+1),R.appendOrSelect(i,"line.left").attr("x1",0).attr("y1",-1).attr("x2",0).attr("y2",r+1),R.appendOrSelect(i,"line.down").attr("x1",-1).attr("x2",n+1).attr("y1",r).attr("y2",r),R.appendOrSelect(i,"line.right").attr("x1",n).attr("x2",n).attr("y1",-1).attr("y2",r+1)}determineDividerStatus(){const t=b(this.getOptions(),"heatmap","divider","state");return t!==Yr.OFF&&(t===Yr.AUTO&&Qg.minCellDividerDimension<=this.xBandwidth&&Qg.minCellDividerDimension<=this.yBandwidth||t===Yr.ON)}addEventListener(){const t=this,{cartesianScales:n}=this.services,r=this.getOptions(),i=yt(r,"locale.translations.total")||yt(r,"tooltip.totalLabel")||"Total",s=n.getDomainIdentifier(),a=n.getRangeIdentifier(),o=n.getDomainLabel(),l=n.getRangeLabel();this.parent.selectAll("g.cell").on("mouseover",function(c,u){const d=I(this),h=d.select("rect.heat");if(!h.classed("null-state")){const p=is(d.attr("transform"));t.parent.select("g.cell-highlight").attr("transform",`translate(${p.x+t.translationUnits.x}, ${p.y+t.translationUnits.y})`).classed("highlighter-hidden",!1),t.services.events.dispatchEvent(T.Heatmap.HEATMAP_MOUSEOVER,{event:c,element:h,datum:u}),t.services.events.dispatchEvent(T.Tooltip.SHOW,{event:c,items:[{label:o,value:u[s]},{label:l,value:u[a]},{label:i,value:u.value,color:h.style("fill")}]})}}).on("mousemove",function(c,u){t.services.events.dispatchEvent(T.Heatmap.HEATMAP_MOUSEMOVE,{event:c,element:I(this),datum:u}),t.services.events.dispatchEvent(T.Tooltip.MOVE,{event:c})}).on("click",function(c,u){t.services.events.dispatchEvent(T.Heatmap.HEATMAP_CLICK,{event:c,element:I(this),datum:u})}).on("mouseout",function(c,u){const h=I(this).select("rect.heat"),f=h.classed("null-state");t.parent.select("g.cell-highlight").classed("highlighter-hidden",!0),f||(t.services.events.dispatchEvent(T.Heatmap.HEATMAP_MOUSEOUT,{event:c,element:h,datum:u}),t.services.events.dispatchEvent(T.Tooltip.HIDE,{event:c,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(T.Legend.ITEM_HOVER,this.handleAxisOnHover),t.removeEventListener(T.Legend.ITEM_MOUSEOUT,this.handleAxisMouseOut)}}class YN extends pt{constructor(){super(...arguments),this.type="histogram",this.renderType=tt.SVG,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail,r=this.getOptions(),{groupMapsTo:i}=r.data;this.parent.selectAll("path.bar").transition("legend-hover-bar").call(s=>this.services.transitions.setupTransition({transition:s,name:"legend-hover-bar"})).attr("opacity",s=>s[i]!==n.datum().name?.3:1)},this.handleLegendMouseOut=()=>{this.parent.selectAll("path.bar").transition("legend-mouseout-bar").call(t=>this.services.transitions.setupTransition({transition:t,name:"legend-mouseout-bar"})).attr("opacity",1)}}init(){const t=this.services.events;t.addEventListener(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t){const n=this.getComponentContainer(),r=this.model.getOptions(),{groupIdentifier:i}=r,{groupMapsTo:s}=r.data,a=this.model.getBinnedStackedData(),o=this.services.cartesianScales.getMainXScale(),l=n.selectAll("g.bars").data(a,u=>yt(u,`0.${s}`));l.exit().attr("opacity",0).remove(),l.enter().append("g").classed("bars",!0).attr("role",ut.GROUP);const c=n.selectAll("g.bars").selectAll("path.bar").data(u=>u);c.exit().remove(),c.enter().append("path").merge(c).classed("bar",!0).attr(i,(u,d)=>d).transition().call(u=>this.services.transitions.setupTransition({transition:u,name:"histogram-bar-update-enter",animate:t})).attr("class",u=>this.model.getColorClassName({classNameTypes:[it.FILL],dataGroupName:u[s],originalClassName:"bar"})).style("fill",u=>this.model.getFillColor(u[s],null,u)).attr("d",u=>{const d=yt(u,"data");if(!d)return;const h=o(d.x1)-o(d.x0)-1,f=this.services.cartesianScales.getDomainValue(d.x0),p=f+h,g=this.services.cartesianScales.getRangeValue(u[0]);let m=this.services.cartesianScales.getRangeValue(u[1]);return Math.abs(m-g)>0&&Math.abs(m-g)>r.bars.dividerSize&&(this.services.cartesianScales.getOrientation()===Wt.VERTICAL?m+=1:m-=1),ie({x0:f,x1:p,y0:g,y1:m},this.services.cartesianScales.getOrientation())}).attr("opacity",1).attr("role",ut.GRAPHICS_SYMBOL).attr("aria-roledescription","bar").attr("aria-label",u=>b(u,"data",u[s])),this.addEventListeners()}addEventListeners(){const t=this.model.getOptions(),{groupMapsTo:n}=t.data,{code:r,number:i}=b(t,"locale"),s=this;this.parent.selectAll("path.bar").on("mouseover",function(a,o){const l=I(this);l.classed("hovered",!0);const c=i(parseFloat(yt(o,"data.x0")),r),u=i(parseFloat(yt(o,"data.x1")),r),d=s.services.cartesianScales.getRangeAxisPosition(),h=s.services.cartesianScales.getScaleLabel(d);s.services.events.dispatchEvent(T.Tooltip.SHOW,{event:a,hoveredElement:l,items:[{label:yt(t,"bins.rangeLabel")||"Range",value:`${c} – ${u}`},{label:t.tooltip.groupLabel||"Group",value:o[n],class:s.model.getColorClassName({classNameTypes:[it.TOOLTIP],dataGroupName:o[n]})},{label:h,value:yt(o,`data.${o[n]}`)}]})}).on("mousemove",function(a){s.services.events.dispatchEvent(T.Tooltip.MOVE,{event:a})}).on("mouseout",function(){I(this).classed("hovered",!1),s.services.events.dispatchEvent(T.Tooltip.HIDE)})}destroy(){this.parent.selectAll("path.bar").on("mouseover",null).on("mousemove",null).on("mouseout",null);const t=this.services.events;t.removeEventListener(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}}class qN extends an{constructor(){super(...arguments),this.type="lollipop",this.renderType=tt.SVG,this.handleScatterOnHover=t=>{const n=t.detail,r=this.getOptions(),{groupMapsTo:i}=r.data;this.parent.selectAll("line.line").attr("stroke-width",s=>s[i]!==n.datum[i]?bn.weight.unselected:bn.weight.selected)},this.handleScatterOnMouseOut=()=>{this.parent.selectAll("line.line").attr("stroke-width",bn.weight.unselected)},this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail,r=this.getOptions(),{groupMapsTo:i}=r.data;this.parent.selectAll("line.line").transition("legend-hover-line").call(s=>this.services.transitions.setupTransition({transition:s,name:"legend-hover-line"})).attr("opacity",s=>s[i]!==n.datum().name?bn.opacity.unselected:bn.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",bn.opacity.selected)}}init(){const{events:t}=this.services;t.addEventListener(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t){const n=this.getComponentContainer({withinChartClip:!0}),r=this.model.getOptions(),{groupMapsTo:i}=r.data,{cartesianScales:s}=this.services,a=s.getMainXScale(),o=s.getMainYScale(),l=s.getDomainIdentifier(),c=v=>s.getDomainValue(v),u=v=>s.getRangeValue(v),d=s.getOrientation(),[h,f]=_n(c,u,d),p=n.selectAll("line.line").data(this.getScatterData(),v=>`${v[i]}-${v[l]}`);p.exit().attr("opacity",0).remove();const m=p.enter().append("line").attr("opacity",0).merge(p).classed("line",!0).attr("class",v=>this.model.getColorClassName({classNameTypes:[it.STROKE],dataGroupName:v[i],originalClassName:"line"})).transition().call(v=>this.services.transitions.setupTransition({transition:v,name:"lollipop-line-update-enter",animate:t})).style("stroke",v=>this.model.getFillColor(v[i],v[l],v)).attr("opacity",1);d===Wt.HORIZONTAL?m.attr("y1",f).attr("y2",f).attr("x1",a.range()[0]).attr("x2",v=>h(v)-r.points.radius):m.attr("x1",h).attr("x2",h).attr("y1",o.range()[0]).attr("y2",v=>f(v)+r.points.radius),this.addScatterPointEventListeners()}addScatterPointEventListeners(){this.services.events.addEventListener(T.Scatter.SCATTER_MOUSEOVER,this.handleScatterOnHover),this.services.events.addEventListener(T.Scatter.SCATTER_MOUSEOUT,this.handleScatterOnMouseOut)}destroy(){const t=this.services.events;t.removeEventListener(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut),t.removeEventListener(T.Scatter.SCATTER_MOUSEOVER,this.handleScatterOnHover),t.removeEventListener(T.Scatter.SCATTER_MOUSEOUT,this.handleScatterOnMouseOut)}}class XN extends pt{constructor(){super(...arguments),this.type="meter",this.renderType=tt.SVG}getStackedBounds(t,n){let r=0;return t.map((s,a)=>a!==0?(r+=n(s.value),{...s,width:Math.abs(n(s.value)-jt.dividerWidth),x:r-n(s.value)}):(r=n(s.value),{...s,width:Math.abs(n(s.value)-jt.dividerWidth),x:0}))}render(t=!0){const n=this,r=this.getComponentContainer(),i=this.getOptions(),s=b(i,"meter","proportional"),a=this.model.getDisplayData(),o=this.model.getStatus(),{width:l}=R.getSVGElementSize(r,{useAttrs:!0}),{groupMapsTo:c}=i.data;let u;if(b(i,"meter","proportional")===null)u=100;else{const y=b(i,"meter","proportional","total");u=y||this.model.getMaximumDomain(this.model.getDisplayData())}const d=Fe().domain([0,u]).range([0,l]),h=this.getStackedBounds(a,d),f=b(i,"meter","height");R.appendOrSelect(r,"rect.container").attr("x",0).attr("y",0).attr("width",l).attr("height",f||(s?jt.height.proportional:jt.height.default)),R.appendOrSelect(r,"line.rangeIndicator").attr("x1",l).attr("x2",l).attr("y1",0).attr("y2",f||(s?jt.height.proportional:jt.height.default));const p=r.selectAll("rect.value").data(h),g=o!=null&&!n.model.isUserProvidedColorScaleValid()&&!s?`value status--${o}`:"value";p.enter().append("rect").classed("value",!0).merge(p).attr("x",y=>y.x).attr("y",0).attr("height",()=>f||(s?jt.height.proportional:jt.height.default)).attr("class",y=>this.model.getColorClassName({classNameTypes:[it.FILL],dataGroupName:y[c],originalClassName:g})).transition().call(y=>this.services.transitions.setupTransition({transition:y,name:"meter-bar-update",animate:t})).attr("width",y=>y.value>u?d(u):y.width).style("fill",y=>n.model.getFillColor(y[c],null,y)).attr("role",ut.GRAPHICS_SYMBOL).attr("aria-roledescription","value").attr("aria-label",y=>y.value),p.exit().remove();const m=b(i,"meter","peak");let v=m;m!==null&&(m>u?v=u:m<a[0].value&&(v=a[0].value>u?u:a[0].value));const E=r.selectAll("line.peak").data(v==null?[]:[v]);E.enter().append("line").classed("peak",!0).merge(E).attr("y1",0).attr("y2",()=>f||(s?jt.height.proportional:jt.height.default)).transition().call(y=>this.services.transitions.setupTransition({transition:y,name:"peak-line-update",animate:t})).attr("x1",y=>d(y)).attr("x2",y=>d(y)).attr("role",ut.GRAPHICS_SYMBOL).attr("aria-roledescription","peak").attr("aria-label",y=>y),E.exit().remove(),this.services.domUtils.setSVGMaxHeight(),this.addEventListeners()}addEventListeners(){const t=this.getOptions(),{groupMapsTo:n}=t.data,r=this,i=b(t,"meter","proportional");this.parent.selectAll("rect.value").on("mouseover",function(s,a){const o=I(this);r.services.events.dispatchEvent(T.Meter.METER_MOUSEOVER,{event:s,element:o,datum:a}),i&&(o.classed("hovered",!0),r.services.events.dispatchEvent(T.Tooltip.SHOW,{event:s,hoveredElement:o,items:[{label:a[n],value:a.value}]}))}).on("mousemove",function(s,a){const o=I(this);r.services.events.dispatchEvent(T.Meter.METER_MOUSEMOVE,{event:s,element:o,datum:a}),i&&r.services.events.dispatchEvent(T.Tooltip.MOVE,{event:s})}).on("click",function(s,a){r.services.events.dispatchEvent(T.Meter.METER_CLICK,{event:s,element:I(this),datum:a})}).on("mouseout",function(s,a){const o=I(this);r.services.events.dispatchEvent(T.Meter.METER_MOUSEOUT,{event:s,element:o,datum:a}),i&&(o.classed("hovered",!1),r.services.events.dispatchEvent(T.Tooltip.HIDE,{hoveredElement:o}))})}destroy(){this.parent.selectAll("rect.value").on("mouseover",null).on("mousemove",null).on("mouseout",null).on("click",null)}}function Hv(e){const t=jN(Gv(e),360);return Nn(t,[0,10])||Nn(t,[350,0])?{textAnchor:tn.START,dominantBaseline:en.MIDDLE}:Nn(t,[10,80])?{textAnchor:tn.START,dominantBaseline:en.HANGING}:Nn(t,[80,100])?{textAnchor:tn.MIDDLE,dominantBaseline:en.HANGING}:Nn(t,[100,170])?{textAnchor:tn.END,dominantBaseline:en.HANGING}:Nn(t,[170,190])?{textAnchor:tn.END,dominantBaseline:en.MIDDLE}:Nn(t,[190,260])?{textAnchor:tn.END,dominantBaseline:en.BASELINE}:Nn(t,[260,280])?{textAnchor:tn.MIDDLE,dominantBaseline:en.BASELINE}:{textAnchor:tn.START,dominantBaseline:en.BASELINE}}function jN(e,t){return(e%t+t)%t}function Nn(e,[t,n]){return e>=t&&e<=n}function Gv(e){return e*(180/Math.PI)}function Ft(e,t,n={x:0,y:0}){const r=t*Math.cos(e)+n.x,i=t*Math.sin(e)+n.y;return{x:isNaN(r)?0:r,y:isNaN(i)?0:i}}function ZN(e,t){return t*Math.sin(e-Math.PI/2)}class KN extends pt{constructor(){super(...arguments),this.type="radar",this.renderType=tt.SVG,this.getLabelDimensions=t=>{const n=R.appendOrSelect(this.getComponentContainer(),"g.tmp-tick"),r=R.appendOrSelect(n,"text").text(t),{width:i,height:s}=R.getSVGElementSize(r.node(),{useBBox:!0});return n.remove(),{width:i,height:s}},this.normalizeFlatData=t=>{const n=this.getOptions(),{angle:r,value:i}=b(n,"radar","axes"),s=b(n,"data","groupMapsTo"),a=eR(this.uniqueKeys.map(o=>this.uniqueGroups.map(l=>({[r]:o,[s]:l,[i]:null}))));return lt(a,t)},this.normalizeGroupedData=t=>{const n=this.getOptions(),{angle:r,value:i}=b(n,"radar","axes"),s=b(n,"data","groupMapsTo");return t.map(({name:a,data:o})=>{const l=this.uniqueKeys.map(c=>({[s]:a,[r]:c,[i]:null}));return{name:a,data:lt(l,o)}})},this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail;this.parent.selectAll("g.blobs path").transition("legend-hover-blob").call(r=>this.services.transitions.setupTransition({transition:r,name:"legend-hover-blob"})).style("fill-opacity",r=>r.name!==n.datum().name?ar.opacity.unselected:ar.opacity.selected).style("stroke-opacity",r=>r.name!==n.datum().name?ar.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",ar.opacity.selected).style("stroke-opacity",1)}}init(){const{events:t}=this.services;t.addEventListener(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t=!0){const n=this.getComponentContainer(),{width:r,height:i}=R.getSVGElementSize(n,{useAttrs:!0}),s=this.model.getData(),a=this.model.getGroupedData(),o=this.getOptions(),l=b(o,"data","groupMapsTo"),c=b(o,"radar","axes","value"),{angle:u,value:d}=b(o,"radar","axes"),{xLabelPadding:h,yLabelPadding:f,yTicksNumber:p,minRange:g,xAxisRectHeight:m}=ar;this.uniqueKeys=Array.from(new Set(s.map(C=>C[u]))),this.uniqueGroups=Array.from(new Set(s.map(C=>C[l]))),this.fullDataNormalized=this.normalizeFlatData(s),this.groupedDataNormalized=this.normalizeGroupedData(a);const E=2*(this.getLabelDimensions(this.uniqueKeys[0]).height+f),S=(Math.min(r,i)-E)/2;if(S<=0)return;const _=Ii().domain(this.fullDataNormalized.map(C=>C[u])).range([0,2*Math.PI].map(C=>C-Math.PI/2)),A=An(this.fullDataNormalized.map(C=>C[d])),L=Fe().domain([A>=0?0:A,Un(this.fullDataNormalized.map(C=>C[d]))]).range([g,S]).nice(p),B=L.ticks(p),D=(C,V,z)=>this.model.getFillColor(C,V,z),O=yT().angle(C=>_(C[u])+Math.PI/2).radius(C=>L(C[d])).curve(Qf),H=this.uniqueKeys.map(C=>{const V=this.getLabelDimensions(C).width,z=ZN(_(C),S);return V+z}),M={x:Un(H)+h,y:i/2},U=R.appendOrSelect(n,"g.y-axes").attr("role",ut.GROUP).selectAll("path").data(B,C=>C),F=C=>this.uniqueKeys.map(V=>({[u]:V,[d]:C}));U.join(C=>C.append("path").attr("opacity",0).attr("transform",`translate(${M.x}, ${M.y})`).attr("fill","none").call(V=>V.transition().call(z=>this.services.transitions.setupTransition({transition:z,name:"radar_y_axes_enter",animate:t})).attr("opacity",1).attr("d",z=>O(F(z)))),C=>C.call(V=>V.transition().call(z=>this.services.transitions.setupTransition({transition:z,name:"radar_y_axes_update",animate:t})).attr("opacity",1).attr("transform",`translate(${M.x}, ${M.y})`).attr("d",z=>O(F(z)))),C=>C.call(V=>V.transition().call(z=>this.services.transitions.setupTransition({transition:z,name:"radar_y_axes_exit",animate:t})).attr("d",z=>O(F(z))).attr("opacity",0).remove())),R.appendOrSelect(n,"g.x-axes").attr("role",ut.GROUP).selectAll("line").data(this.uniqueKeys,C=>C).join(C=>C.append("line").attr("opacity",0).attr("class",V=>`x-axis-${Hr(V)}`).attr("stroke-dasharray","0").attr("x1",V=>Ft(_(V),0,M).x).attr("y1",V=>Ft(_(V),0,M).y).attr("x2",V=>Ft(_(V),0,M).x).attr("y2",V=>Ft(_(V),0,M).y).call(V=>V.transition().call(z=>this.services.transitions.setupTransition({transition:z,name:"radar_x_axes_enter",animate:t})).attr("opacity",1).attr("x1",z=>Ft(_(z),L.range()[0],M).x).attr("y1",z=>Ft(_(z),L.range()[0],M).y).attr("x2",z=>Ft(_(z),L.range()[1],M).x).attr("y2",z=>Ft(_(z),L.range()[1],M).y)),C=>C.call(V=>V.transition().call(z=>this.services.transitions.setupTransition({transition:z,name:"radar_x_axes_update",animate:t})).attr("opacity",1).attr("x1",z=>Ft(_(z),L.range()[0],M).x).attr("y1",z=>Ft(_(z),L.range()[0],M).y).attr("x2",z=>Ft(_(z),L.range()[1],M).x).attr("y2",z=>Ft(_(z),L.range()[1],M).y)),C=>C.call(V=>V.transition().call(z=>this.services.transitions.setupTransition({transition:z,name:"radar_x_axes_exit",animate:t})).attr("opacity",0).remove())),R.appendOrSelect(n,"g.x-labels").attr("role",ut.GROUP).selectAll("text").data(this.uniqueKeys).join(C=>C.append("text").text(V=>V).attr("opacity",0).attr("x",V=>Ft(_(V),L.range()[1]+h,M).x).attr("y",V=>Ft(_(V),L.range()[1]+h,M).y).style("text-anchor",V=>Hv(_(V)).textAnchor).style("dominant-baseline",V=>Hv(_(V)).dominantBaseline).call(V=>V.transition().call(z=>this.services.transitions.setupTransition({transition:z,name:"radar_x_labels_enter",animate:t})).attr("opacity",1)),C=>C.call(V=>V.transition().call(z=>this.services.transitions.setupTransition({transition:z,name:"radar_x_labels_update",animate:t})).attr("opacity",1).attr("x",z=>Ft(_(z),L.range()[1]+h,M).x).attr("y",z=>Ft(_(z),L.range()[1]+h,M).y).end().finally(()=>{const z=b(o,"radar","alignment"),Mt=this.getAlignmentXOffset(z,n,this.getParent());n.attr("x",Mt)})),C=>C.call(V=>V.transition().call(z=>this.services.transitions.setupTransition({transition:z,name:"radar_x_labels_exit",animate:t})).attr("opacity",0).remove())),R.appendOrSelect(n,"g.blobs").attr("role",ut.GROUP).selectAll("path").data(this.groupedDataNormalized,C=>C.name).join(C=>C.append("path").attr("class",V=>this.model.getColorClassName({classNameTypes:[it.FILL,it.STROKE],dataGroupName:V.name,originalClassName:"blob"})).attr("role",ut.GRAPHICS_SYMBOL).attr("aria-label",V=>V.name).attr("opacity",0).attr("transform",t?()=>`translate(${M.x}, ${M.y}) scale(${1+Math.random()*.35})`:`translate(${M.x}, ${M.y})`).style("fill",V=>D(V.name,null,V.data)).style("fill-opacity",ar.opacity.selected).style("stroke",V=>D(V.name,null,V.data)).call(V=>{const z=V.transition().call(Mt=>this.services.transitions.setupTransition({transition:Mt,name:"radar_blobs_enter",animate:t}));t&&z.delay(()=>Math.random()*30).attr("transform",`translate(${M.x}, ${M.y})`),z.attr("opacity",1).attr("d",Mt=>O(Mt.data))}),C=>(C.attr("class",V=>this.model.getColorClassName({classNameTypes:[it.FILL,it.STROKE],dataGroupName:V.name,originalClassName:"blob"})).style("fill",V=>D(V.name,null,V.data)).style("stroke",V=>D(V.name,null,V.data)),C.call(V=>V.transition().call(z=>this.services.transitions.setupTransition({transition:z,name:"radar_blobs_update",animate:t})).attr("opacity",1).attr("transform",`translate(${M.x}, ${M.y})`).attr("d",z=>O(z.data))),C),C=>C.call(V=>{const z=V.transition().call(Mt=>this.services.transitions.setupTransition({transition:Mt,name:"radar_blobs_exit",animate:t}));t&&z.delay(()=>Math.random()*30).attr("transform",()=>`translate(${M.x}, ${M.y}) scale(${1+Math.random()*.35})`),z.attr("opacity",0).remove()})),R.appendOrSelect(n,"g.dots").attr("role",ut.GROUP).selectAll("circle").data(this.fullDataNormalized.filter(C=>b(C,d)!==null)).join(C=>C.append("circle").attr("role",ut.GRAPHICS_SYMBOL).attr("aria-label",V=>V[c]),C=>C,C=>C.remove()).attr("class",C=>this.model.getColorClassName({classNameTypes:[it.FILL],dataGroupName:C[l],originalClassName:Hr(C[u])})).attr("cx",C=>Ft(_(C[u]),L(C[d]),M).x).attr("cy",C=>Ft(_(C[u]),L(C[d]),M).y).attr("r",0).attr("opacity",0).style("fill",C=>D(C[l])),R.appendOrSelect(n,"g.x-axes-rect").attr("role",ut.GROUP).selectAll("rect").data(this.uniqueKeys).join(C=>C.append("rect"),C=>C,C=>C.remove()).attr("x",M.x).attr("y",M.y-m/2).attr("width",L.range()[1]).attr("height",m).style("fill","red").style("fill-opacity",0).attr("transform",C=>`rotate(${Gv(_(C))}, ${M.x}, ${M.y})`);const{code:vt,number:Y}=b(o,"locale");R.appendOrSelect(n,"g.y-labels").attr("role",ut.GROUP).selectAll("text").data(Ie(B)).join(C=>C.append("text").attr("opacity",0).text(V=>Y(V,vt)).attr("x",V=>Ft(-Math.PI/2,L(V),M).x+f).attr("y",V=>Ft(-Math.PI/2,L(V),M).y).style("text-anchor","start").style("dominant-baseline","middle").call(V=>V.transition().call(z=>this.services.transitions.setupTransition({transition:z,name:"radar_y_labels_enter",animate:t})).attr("opacity",1)),C=>C.call(V=>V.transition().call(z=>this.services.transitions.setupTransition({transition:z,name:"radar_y_labels_update",animate:t})).text(z=>z).attr("opacity",1).attr("x",z=>Ft(-Math.PI/2,L(z),M).x+f).attr("y",z=>Ft(-Math.PI/2,L(z),M).y)),C=>C.call(V=>V.transition().call(z=>this.services.transitions.setupTransition({transition:z,name:"radar_y_labels_exit",animate:t})).attr("opacity",0).remove())),this.addEventListeners()}getAlignmentXOffset(t,n,r){const i=R.getSVGElementSize(n,{useBBox:!0}),{width:s}=R.getSVGElementSize(r,{useAttrs:!0});let a=0;return t===Bt.CENTER?a=Math.floor((s-i.width)/2):t===Bt.RIGHT&&(a=s-i.width),a}destroy(){this.parent.selectAll(".x-axes-rect > rect").on("mouseover",null).on("mousemove",null).on("mouseout",null);const t=this.services.events;t.removeEventListener(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}addEventListeners(){const t=this,{axes:{angle:n}}=b(this.getOptions(),"radar");this.parent.selectAll(".x-axes-rect > rect").on("mouseover",function(r,i){const s=I(this);t.services.events.dispatchEvent(T.Radar.X_AXIS_MOUSEOVER,{event:r,element:s,datum:i});const a=t.parent.select(`.x-axes .x-axis-${Hr(i)}`),o=t.parent.selectAll(`.dots circle.${Hr(i)}`),l=t.model.getActiveDataGroupNames(),c=t.getOptions(),{groupMapsTo:u}=c.data,d=b(c,"radar","axes","value");a.classed("hovered",!0).attr("stroke-dasharray","4 4"),o.classed("hovered",!0).attr("opacity",f=>l.indexOf(f[u])!==-1?1:0).attr("r",ar.dotsRadius);const h=t.fullDataNormalized.filter(f=>f[n]===i&&l.indexOf(f[u])!==-1);t.services.events.dispatchEvent(T.Tooltip.SHOW,{event:r,hoveredElement:s,items:h.filter(f=>typeof f[d]=="number").map(f=>({label:f[u],value:f[d],color:t.model.getFillColor(f[u],null,f),class:t.model.getColorClassName({classNameTypes:[it.TOOLTIP],dataGroupName:f[u]})}))})}).on("mousemove",function(r,i){const s=I(this);t.services.events.dispatchEvent(T.Radar.X_AXIS_MOUSEMOVE,{event:r,element:s,datum:i}),t.services.events.dispatchEvent(T.Tooltip.MOVE,{event:r})}).on("click",function(r,i){t.services.events.dispatchEvent(T.Radar.X_AXIS_CLICK,{event:r,element:I(this),datum:i})}).on("mouseout",function(r,i){const s=I(this),a=t.parent.select(`.x-axes .x-axis-${Hr(i)}`),o=t.parent.selectAll(`.dots circle.${Hr(i)}`);a.classed("hovered",!1).attr("stroke-dasharray","0"),o.classed("hovered",!1).attr("opacity",0).attr("r",0),t.services.events.dispatchEvent(T.Radar.X_AXIS_MOUSEOUT,{event:r,element:s,datum:i}),t.services.events.dispatchEvent(T.Tooltip.HIDE)})}}class Vv extends qu{constructor(){super(...arguments),this.type="simple-bar",this.renderType=tt.SVG,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail,{groupMapsTo:r}=this.getOptions().data;this.parent.selectAll("path.bar").transition("legend-hover-simple-bar").call(i=>this.services.transitions.setupTransition({transition:i,name:"legend-hover-simple-bar"})).attr("opacity",i=>i[r]!==n.datum().name?.3:1)},this.handleLegendMouseOut=()=>{this.parent.selectAll("path.bar").transition("legend-mouseout-simple-bar").call(t=>this.services.transitions.setupTransition({transition:t,name:"legend-mouseout-simple-bar"})).attr("opacity",1)}}init(){const t=this.services.events;t.addEventListener(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t){const n=this.getOptions(),{groupMapsTo:r}=n.data,i=this.getComponentContainer({withinChartClip:!0}),s=this.model.getDisplayData(this.configs.groups),a=this.services.cartesianScales.getOrientation(),o=i.selectAll("path.bar").data(s,c=>c[r]);o.exit().attr("opacity",0).remove(),o.enter().append("path").attr("opacity",0).merge(o).classed("bar",!0).attr("width",this.getBarWidth.bind(this)).transition().call(c=>this.services.transitions.setupTransition({transition:c,name:"bar-update-enter",animate:t})).attr("class",c=>this.model.getColorClassName({classNameTypes:[it.FILL],dataGroupName:c[r],originalClassName:"bar"})).style("fill",c=>{const u=this.services.cartesianScales.getDomainIdentifier(c);return this.model.getFillColor(c[r],c[u],c)}).attr("d",c=>{const u=this.services.cartesianScales.getRangeIdentifier(),d=this.getBarWidth(),h=c[u],f=this.services.cartesianScales.getDomainValue(c)-d/2,p=f+d;let g,m;if(Array.isArray(h)&&h.length===2)g=this.services.cartesianScales.getRangeValue(h[0]),m=this.services.cartesianScales.getRangeValue(h[1]);else{const y=this.services.cartesianScales.getRangeScale().domain()[0];g=this.services.cartesianScales.getRangeValue(Math.max(0,y)),m=this.services.cartesianScales.getRangeValue(c)}const v=Math.abs(m-g);if(v!==0&&v<2&&(h>0&&a===Wt.VERTICAL||h<0&&a===Wt.HORIZONTAL?m=g-2:m=g+2),!this.isOutsideZoomedDomain(f,p))return ie({x0:f,x1:p,y0:g,y1:m},a)}).attr("opacity",1).attr("role",ut.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,r){const i=I(this);i.classed("hovered",!0),t.services.events.dispatchEvent(T.Bar.BAR_MOUSEOVER,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(T.Tooltip.SHOW,{event:n,hoveredElement:i,data:[r]})}).on("mousemove",function(n,r){t.services.events.dispatchEvent(T.Bar.BAR_MOUSEMOVE,{event:n,element:I(this),datum:r}),t.services.events.dispatchEvent(T.Tooltip.MOVE,{event:n})}).on("click",function(n,r){t.services.events.dispatchEvent(T.Bar.BAR_CLICK,{event:n,element:I(this),datum:r})}).on("mouseout",function(n,r){const i=I(this);i.classed("hovered",!1),t.services.events.dispatchEvent(T.Bar.BAR_MOUSEOUT,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(T.Tooltip.HIDE,{hoveredElement:i})})}destroy(){this.parent.selectAll("path.bar").on("mouseover",null).on("mousemove",null).on("mouseout",null);const t=this.services.events;t.removeEventListener(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}}class QN extends oe{constructor(){super(...arguments),this.type="skeleton-lines"}render(t=!0){const n=b(this.getOptions(),"data","loading"),r=!b(this.getOptions(),"grid","x","enabled")&&!b(this.getOptions(),"grid","y","enabled")&&!b(this.getOptions(),"axes","bottom","visible")&&!b(this.getOptions(),"axes","left","visible");n&&!r?super.renderGridSkeleton(n):n&&r?this.renderSparklineSkeleton(n):this.removeSkeleton()}renderSparklineSkeleton(t){this.setScales(),this.drawBackdrop(t),this.drawSparkline(t),this.updateBackdropStyle(),t&&this.setShimmerEffect("shimmer-lines")}drawSparkline(t){const n=this.backdrop.attr("width"),r=[100],i=R.appendOrSelect(this.backdrop,"g.y.skeleton"),s=i.selectAll("line").data(r);s.enter().append("line").merge(s).attr("x1",0).attr("x2",n).attr("y1",a=>a).attr("y2",a=>a),i.selectAll("line").classed("shimmer-effect-lines",t).classed("empty-state-lines",!t).style("stroke",t?`url(#${this.services.domUtils.generateElementIDString("shimmer-lines")})`:null)}updateBackdropStyle(){const t=this.parent;this.backdrop=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 zv extends pt{constructor(){super(...arguments),this.type="area-stacked",this.renderType=tt.SVG,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail,r=this.getOptions(),{groupMapsTo:i}=r.data;this.parent.selectAll("path.area").transition("legend-hover-area").call(s=>this.services.transitions.setupTransition({transition:s,name:"legend-hover-area"})).attr("opacity",s=>b(s,0,i)!==n.datum().name?En.opacity.unselected:En.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",En.opacity.selected)}}init(){const t=this.services.events;t.addEventListener(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t=!0){const n=this.getComponentContainer({withinChartClip:!0}),r=this,i=this.getOptions(),{groupMapsTo:s}=i.data,a=Object.keys(i.axes).some(p=>i.axes[p].percentage),o=this.model.getStackedData({percentage:a,groups:this.configs.groups}),l=b(o,0,0),c=this.services.cartesianScales.getDomainAxisPosition({datum:l}),u=this.services.cartesianScales.getRangeAxisPosition({datum:l}),d=this.services.cartesianScales.getScaleByPosition(u),h=n.selectAll("path.area").data(o,p=>b(p,0,s));this.areaGenerator=Zl().x(p=>this.services.cartesianScales.getValueThroughAxisPosition(c,p.data.sharedStackKey)).y0(p=>d(p[0])).y1(p=>d(p[1])).curve(this.services.curves.getD3Curve()),h.exit().attr("opacity",0).remove(),h.enter().append("path").attr("opacity",0).merge(h).data(o,p=>b(p,0,s)).attr("class","area").attr("class",p=>this.model.getColorClassName({classNameTypes:[it.FILL],dataGroupName:b(p,0,s),originalClassName:"area"})).style("fill",p=>r.model.getFillColor(b(p,0,s),null,p)).attr("role",ut.GRAPHICS_SYMBOL).attr("aria-roledescription","area").attr("aria-label",p=>b(p,0,s)).transition().call(p=>this.services.transitions.setupTransition({transition:p,name:"area-update-enter",animate:t})).attr("opacity",En.opacity.selected).attr("d",this.areaGenerator)}}class Wv extends qu{constructor(){super(...arguments),this.type="stacked-bar",this.renderType=tt.SVG,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail,{groupMapsTo:r}=this.model.getOptions().data;this.parent.selectAll("path.bar").transition("legend-hover-bar").call(i=>this.services.transitions.setupTransition({transition:i,name:"legend-hover-bar"})).attr("opacity",i=>i[r]!==n.datum().name?.3:1)},this.handleLegendMouseOut=()=>{this.parent.selectAll("path.bar").transition("legend-mouseout-bar").call(t=>this.services.transitions.setupTransition({transition:t,name:"legend-mouseout-bar"})).attr("opacity",1)}}init(){const t=this.services.events;t.addEventListener(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t){const n=this.getComponentContainer({withinChartClip:!0}),r=this.getOptions(),{groupMapsTo:i}=r.data,s=this.model.getStackedData({groups:this.configs.groups,divergent:!0}),a=this.model.getActiveDataGroupNames(),o=n.selectAll("g.bars").data(s,c=>b(c,0,i));o.exit().attr("opacity",0).remove(),o.enter().append("g").classed("bars",!0).attr("role",ut.GROUP).attr("data-name","bars");const l=n.selectAll("g.bars").selectAll("path.bar").data(c=>c,c=>c.data.sharedStackKey);l.exit().remove(),l.enter().append("path").merge(l).classed("bar",!0).transition().call(c=>this.services.transitions.setupTransition({transition:c,name:"bar-update-enter",animate:t})).attr("class",c=>this.model.getColorClassName({classNameTypes:[it.FILL],dataGroupName:c[i],originalClassName:"bar"})).style("fill",c=>this.model.getFillColor(c[i],c.data.sharedStackKey,c.data)).attr("d",c=>{const u=c.data.sharedStackKey,d=this.getBarWidth(),h=this.services.cartesianScales.getDomainValue(u)-d/2,f=h+d,p=this.services.cartesianScales.getRangeValue(c[0]);let g=this.services.cartesianScales.getRangeValue(c[1]);if(!this.isOutsideZoomedDomain(h,f)){if(Math.abs(g-p)>0&&Math.abs(g-p)>r.bars.dividerSize){const m=c[0]<0&&c[1]<=0;m&&a.length>1?this.services.cartesianScales.getOrientation()===Wt.VERTICAL?g+=c[1]===0?2:1:g-=1:m||(this.services.cartesianScales.getOrientation()===Wt.VERTICAL?g+=1:g-=1)}return ie({x0:h,x1:f,y0:p,y1:g},this.services.cartesianScales.getOrientation())}}).attr("opacity",1).attr("role",ut.GRAPHICS_SYMBOL).attr("aria-roledescription","bar").attr("aria-label",c=>c[1]-c[0]),this.addEventListeners()}addEventListeners(){const t=this.getOptions(),{groupMapsTo:n}=t.data,r=this;this.parent.selectAll("path.bar").on("mouseover",function(i,s){const a=I(this);a.classed("hovered",!0),r.services.events.dispatchEvent(T.Bar.BAR_MOUSEOVER,{event:i,element:a,datum:s});let l=r.model.getDisplayData(r.configs.groups).find(c=>{const u=r.services.cartesianScales.getDomainIdentifier(c),d=r.services.cartesianScales.getRangeIdentifier(c);return c[d]===s.data[s[n]]&&c[u].toString()===s.data.sharedStackKey&&c[n]===s[n]});if(l===void 0){const c=r.services.cartesianScales.getDomainIdentifier(),u=r.services.cartesianScales.getRangeIdentifier();l={[c]:s.data.sharedStackKey,[u]:s.data[s[n]],[n]:s[n]}}r.services.events.dispatchEvent(T.Tooltip.SHOW,{event:i,hoveredElement:a,data:[l]})}).on("mousemove",function(i,s){const a=I(this);r.services.events.dispatchEvent(T.Bar.BAR_MOUSEMOVE,{event:i,element:a,datum:s}),r.services.events.dispatchEvent(T.Tooltip.MOVE,{event:i})}).on("click",function(i,s){r.services.events.dispatchEvent(T.Bar.BAR_CLICK,{event:i,element:I(this),datum:s})}).on("mouseout",function(i,s){const a=I(this);a.classed("hovered",!1),r.services.events.dispatchEvent(T.Bar.BAR_MOUSEOUT,{event:i,element:a,datum:s}),r.services.events.dispatchEvent(T.Tooltip.HIDE,{hoveredElement:a})})}getBarWidth(){const t=this.getOptions();if(b(t,"bars","width"))return t.bars.width;const n=this.services.cartesianScales.getMainXScale(),r=R.getSVGElementSize(this.parent,{useAttrs:!0}).width,i=this.model.getStackKeys().length,s=b(t,"bars","spacingFactor");return n.step?Math.min(t.bars.maxWidth,n.step()/2):Math.min(t.bars.maxWidth,r*s/i)}destroy(){this.parent.selectAll("path.bar").on("mouseover",null).on("mousemove",null).on("mouseout",null);const t=this.services.events;t.removeEventListener(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}}class Yv extends an{constructor(){super(...arguments),this.type="scatter-stacked",this.renderType=tt.SVG}render(t){if(!b(this.getOptions(),"points","enabled"))return;const r=this.getComponentContainer({withinChartClip:!0}),i=this.getOptions(),{groupMapsTo:s}=i.data,a=Object.keys(i.axes).some(f=>i.axes[f].percentage),o=this.model.getStackedData({groups:this.configs.groups,percentage:a}),l=r.selectAll("g.dots").data(o,f=>b(f,0,s));l.exit().attr("opacity",0).remove();const u=l.enter().append("g").classed("dots",!0).attr("role",ut.GROUP).merge(l).selectAll("circle.dot").data(f=>f);u.exit().attr("opacity",0).remove();const h=u.enter().append("circle").classed("dot",!0).attr("opacity",0).merge(u).datum(f=>{const p=f[s],g=this.services.cartesianScales.getDomainIdentifier(f),m=this.services.cartesianScales.getRangeIdentifier(f);return{[s]:p,[g]:f.data.sharedStackKey,[m]:f[1]}});this.styleCircles(h,t),this.addEventListeners()}getTooltipData(t,n){const r=this.getOptions(),{groupMapsTo:i}=r.data,s=Object.keys(r.axes).some(l=>r.axes[l].percentage),a=this.model.getStackedData({groups:this.configs.groups,percentage:s}),o=[];return a.forEach((l,c)=>{l.forEach((u,d)=>{const h=u[i],f=u.data.sharedStackKey;let p=u.data[h];const g=u[1],m=this.services.cartesianScales.getDomainIdentifier(u),v=this.services.cartesianScales.getRangeIdentifier(u);p!=null&&t===this.services.cartesianScales.getDomainValue(f)&&n===this.services.cartesianScales.getRangeValue(g)&&(s&&(p=this.model.getStackedData({groups:this.configs.groups})[c][d].data[h]),p!==null&&o.push({[i]:h,[m]:f,[v]:p}))})}),this.model.getDisplayData(this.configs.groups).filter(l=>{const c=this.services.cartesianScales.getDomainIdentifier(l),u=this.services.cartesianScales.getRangeIdentifier(l);return o.find(d=>d[i]==l[i]&&d[c]==l[c]&&d[u]==l[u])!==void 0})}}const ni=6;class JN extends pt{constructor(){super(...arguments),this.type="tree",this.renderType=tt.SVG}getLongestLabel(t){let n="";return t.forEach(r=>{const i=r.children?this.getLongestLabel(r.children):"";(i.length>n.length||r.name.length>n.length)&&(n=i.length>r.name.length?i:r.name)}),n}getMockLabelWidth(t,n){const r=t.append("text").attr("dy","0.31em").attr("x",0).attr("text-anchor","end").text(n),{width:i}=R.getSVGElementSize(r.node(),{useBBox:!0});return r.remove(),i}render(t=!0){const n=this.getComponentContainer();n.html("");const{width:r,height:i}=R.getSVGElementSize(this.parent,{useAttrs:!0});if(r<1||i<1)return;const s=this.model.getOptions(),a=this.model.getDisplayData(),o=b(s,"tree","rootTitle")||"Tree",l=this.getMockLabelWidth(n,o),c=this.getLongestLabel(a),u=this.getMockLabelWidth(n,c),d={top:0,right:0,bottom:0,left:l>0?l+ni:30-ni},h=Di({name:o,children:a}),f=10,p=r/6,g=_=>{const A=h.descendants().reverse(),L=h.links();let B=h,D=h;h.eachBefore($=>{$.x<B.x&&(B=$),$.x>D.x&&(D=$)});const O=D.x-B.x,H=n.transition().call($=>this.services.transitions.setupTransition({transition:$,name:"tree-update-viewbox",animate:!0})).attr("viewBox",[-d.left,B.x,r,O].join(" ")),P=S.selectAll("g").data(A,$=>$.id),M=this,w=P.enter().append("g").attr("transform",()=>`translate(${_.y0},${_.x0})`).attr("class",$=>$.depth!==0&&$.children&&$.children.length>0?"clickable":null).on("mouseover",function($,N){M.services.events.dispatchEvent(T.Tree.NODE_MOUSEOVER,{event:$,element:I(this),datum:N})}).on("click",function($,N){N.depth!==0&&(N.children=N.children?null:N._children,g(N)),M.services.events.dispatchEvent(T.Tree.NODE_CLICK,{event:$,element:I(this),datum:N})}).on("mouseout",function($,N){M.services.events.dispatchEvent(T.Tree.NODE_MOUSEOUT,{event:$,element:I(this),datum:N})});w.append("circle").attr("r",2.5).attr("class",$=>$._children?"parent":"child").attr("stroke-width",10),w.append("text").attr("dy","0.31em").attr("x",$=>$._children?-ni:ni).attr("text-anchor",$=>$._children?"end":"start").text($=>$.data.name).clone(!0).attr("class","text-stroke").lower(),P.merge(w).transition(H).attr("transform",$=>`translate(${$.y},${$.x})`).attr("fill-opacity",1).attr("stroke-opacity",1),P.exit().transition(H).remove().attr("transform",()=>`translate(${_.y},${_.x})`).attr("fill-opacity",0).attr("stroke-opacity",0);const U=x.selectAll("path").data(L,$=>$.target.id),F=U.enter().append("path").attr("d",()=>{const $={x:_.x0,y:_.y0};return y({source:$,target:$})});U.merge(F).transition(H).attr("d",y),U.exit().transition(H).remove().attr("d",()=>{const $={x:_.x,y:_.y};return y({source:$,target:$})}),h.eachBefore($=>{$.x0=$.x,$.y0=$.y})},m=h.descendants(),v=m[m.length-1].depth,E=b(s,"tree","type")===za.DENDROGRAM?Ux().size([i,r-u-v*ni-l]):w_().nodeSize([f,p]).size([i,r-u-v*ni-l]),y=TT().x(_=>_.y).y(_=>_.x);h.x0=p/2,h.y0=0,h.descendants().forEach((_,A)=>{_.id=A,_._children=_.children}),E(h),n.attr("viewBox",[-d.left,-d.top,r,f]).style("user-select","none");const x=n.append("g").attr("class","links"),S=n.append("g").attr("class","nodes");g(h)}}var t$="#000000",e$="#ffffff",n$="#fcf4d6",r$="#fddc69",i$="#f1c21b",s$="#d2a106",a$="#b28600",o$="#8e6a00",l$="#684e00",c$="#483700",u$="#302400",h$="#1c1500",d$={10:n$,20:r$,30:i$,40:s$,50:a$,60:o$,70:l$,80:c$,90:u$,100:h$},f$="#fff2e8",p$="#ffd9be",g$="#ffb784",m$="#ff832b",v$="#eb6200",y$="#ba4e00",E$="#8a3800",b$="#5e2900",x$="#3e1a00",_$="#231000",S$={10:f$,20:p$,30:g$,40:m$,50:v$,60:y$,70:E$,80:b$,90:x$,100:_$},T$="#fff1f1",O$="#ffd7d9",w$="#ffb3b8",M$="#ff8389",A$="#fa4d56",C$="#da1e28",D$="#a2191f",L$="#750e13",R$="#520408",I$="#2d0709",k$={10:T$,20:O$,30:w$,40:M$,50:A$,60:C$,70:D$,80:L$,90:R$,100:I$},P$="#fff0f7",N$="#ffd6e8",$$="#ffafd2",F$="#ff7eb6",U$="#ee5396",B$="#d02670",H$="#9f1853",G$="#740937",V$="#510224",z$="#2a0a18",W$={10:P$,20:N$,30:$$,40:F$,50:U$,60:B$,70:H$,80:G$,90:V$,100:z$},Y$="#f6f2ff",q$="#e8daff",X$="#d4bbff",j$="#be95ff",Z$="#a56eff",K$="#8a3ffc",Q$="#6929c4",J$="#491d8b",tF="#31135e",eF="#1c0f30",nF={10:Y$,20:q$,30:X$,40:j$,50:Z$,60:K$,70:Q$,80:J$,90:tF,100:eF},rF="#edf5ff",iF="#d0e2ff",sF="#a6c8ff",aF="#78a9ff",oF="#4589ff",lF="#0f62fe",cF="#0043ce",uF="#002d9c",hF="#001d6c",dF="#001141",fF={10:rF,20:iF,30:sF,40:aF,50:oF,60:lF,70:cF,80:uF,90:hF,100:dF},pF="#e5f6ff",gF="#bae6ff",mF="#82cfff",vF="#33b1ff",yF="#1192e8",EF="#0072c3",bF="#00539a",xF="#003a6d",_F="#012749",SF="#061727",TF={10:pF,20:gF,30:mF,40:vF,50:yF,60:EF,70:bF,80:xF,90:_F,100:SF},OF="#d9fbfb",wF="#9ef0f0",MF="#3ddbd9",AF="#08bdba",CF="#009d9a",DF="#007d79",LF="#005d5d",RF="#004144",IF="#022b30",kF="#081a1c",PF={10:OF,20:wF,30:MF,40:AF,50:CF,60:DF,70:LF,80:RF,90:IF,100:kF},NF="#defbe6",$F="#a7f0ba",FF="#6fdc8c",UF="#42be65",BF="#24a148",HF="#198038",GF="#0e6027",VF="#044317",zF="#022d0d",WF="#071908",YF={10:NF,20:$F,30:FF,40:UF,50:BF,60:HF,70:GF,80:VF,90:zF,100:WF},qF="#f2f4f8",XF="#dde1e6",jF="#c1c7cd",ZF="#a2a9b0",KF="#878d96",QF="#697077",JF="#4d5358",tU="#343a3f",eU="#21272a",nU="#121619",rU={10:qF,20:XF,30:jF,40:ZF,50:KF,60:QF,70:JF,80:tU,90:eU,100:nU},iU="#f4f4f4",sU="#e0e0e0",aU="#c6c6c6",oU="#a8a8a8",lU="#8d8d8d",cU="#6f6f6f",uU="#525252",hU="#393939",dU="#262626",fU="#161616",pU={10:iU,20:sU,30:aU,40:oU,50:lU,60:cU,70:uU,80:hU,90:dU,100:fU},gU="#f7f3f2",mU="#e5e0df",vU="#cac5c4",yU="#ada8a8",EU="#8f8b8b",bU="#726e6e",xU="#565151",_U="#3c3838",SU="#272525",TU="#171414",OU={10:gU,20:mU,30:vU,40:yU,50:EU,60:bU,70:xU,80:_U,90:SU,100:TU},qv={black:{100:t$},blue:fF,coolGray:rU,cyan:TF,gray:pU,green:YF,magenta:W$,orange:S$,purple:nF,red:k$,teal:PF,warmGray:OU,white:{0:e$},yellow:d$};const wU=e=>{if(!e)return null;for(const t of Object.keys(qv)){const n=qv[t];for(const r of Object.keys(n))if(n[+r]===e)return r}return null},Xv=function(){const e=I(this.parentNode).select("rect.leaf"),t=getComputedStyle(e.node(),null).getPropertyValue("fill"),n=on(t);let r;if(n&&(r=wU(n?n.hex():null)),r==null){const i=Bo(n).l;r=Math.abs(i*100-100)}return r>50?"white":"black"};let MU=0;class AU extends pt{constructor(){super(...arguments),this.type="treemap",this.renderType=tt.SVG,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail;this.parent.selectAll("g[data-name='leaf']").transition("legend-hover-treemap").call(r=>this.services.transitions.setupTransition({transition:r,name:"legend-hover-treemap"})).attr("opacity",r=>r.parent.data.name===n.datum().name?1:.3)},this.handleLegendMouseOut=()=>{this.parent.selectAll("g[data-name='leaf']").transition("legend-mouseout-treemap").call(t=>this.services.transitions.setupTransition({transition:t,name:"legend-mouseout-treemap"})).attr("opacity",1)}}init(){const{events:t}=this.services;t.addEventListener(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t=!0){const n=this.getComponentContainer();this.model.getData();const r=this.model.getDisplayData(),i=this.model.getOptions(),s=b(window,"location"),{width:a,height:o}=R.getSVGElementSize(n,{useAttrs:!0}),l=Di({name:i.title||"Treemap",children:r}).sum(g=>g.value).sort((g,m)=>m.value-g.value),c=L_().size([a,o]).paddingInner(1).paddingOuter(0).round(!0)(l),u=n.selectAll("g[data-name='leaf']").data(c.leaves(),g=>g.data.name);u.exit().attr("opacity",0).remove();const h=u.enter().append("g").attr("data-name","leaf").attr("data-uid",()=>MU++).merge(u);h.attr("data-name","leaf").transition().call(g=>this.services.transitions.setupTransition({transition:g,name:"treemap-group-update",animate:t})).attr("transform",g=>`translate(${g.x0},${g.y0})`);const f=h.selectAll("rect.leaf").data(g=>[g]);f.exit().attr("width",0).attr("height",0).remove(),f.enter().append("rect").classed("leaf",!0).merge(f).attr("width",0).attr("height",0).attr("id",function(){const g=I(this.parentNode).attr("data-uid");return`${i.style.prefix}-leaf-${g}`}).attr("class",g=>{for(;g.depth>1;)g=g.parent;return this.model.getColorClassName({classNameTypes:[it.FILL],dataGroupName:g.data.name,originalClassName:"leaf"})}).transition().call(g=>this.services.transitions.setupTransition({transition:g,name:"treemap-leaf-update-enter",animate:t})).attr("width",g=>g.x1-g.x0).attr("height",g=>g.y1-g.y0).style("fill",g=>{for(;g.depth>1;)g=g.parent;return this.model.getFillColor(g.data.name,null,g.data)}),h.selectAll("clipPath").data(g=>g.data.showLabel!==!0?[]:[1],g=>g).join(g=>g.append("clipPath").attr("id",function(){const m=I(this.parentNode).attr("data-uid");return`${i.style.prefix}-clip-${m}`}).append("use").attr("xlink:href",function(){const m=I(this.parentNode.parentNode).attr("data-uid"),v=`${i.style.prefix}-leaf-${m}`;return new URL(`#${v}`,s)+""}),g=>null,g=>g.remove()),h.selectAll("text").data(g=>{if(g.data.showLabel!==!0)return[];let m=g;for(;m.depth>1;)m=m.parent;const v=Bo(this.model.getFillColor(m.data.name));return[{text:g.data.name,color:v.l<.5?"white":"black"}]},g=>g).join(g=>{const m=g.append("text").text(v=>v.text).style("fill",Xv).attr("x",7).attr("y",18);return s&&m.attr("clip-path",function(){const v=I(this.parentNode).attr("data-uid"),E=`${i.style.prefix}-clip-${v}`;return`url(${new URL(`#${E}`,s)+""})`}),m},g=>g.text(m=>m.text).style("fill",Xv),g=>g.remove()),this.addEventListeners()}addEventListeners(){const t=this;this.parent.selectAll("rect.leaf").on("mouseover",function(n,r){const i=I(this);let s=getComputedStyle(this,null).getPropertyValue("fill"),a=r;for(;a.depth>1;)a=a.parent;i.transition("graph_element_mouseover_fill_update").call(o=>t.services.transitions.setupTransition({transition:o,name:"graph_element_mouseover_fill_update"})).style("fill",o=>{const l=t.model.getFillColor(o.parent.data.name,null,o.data);return l&&(s=l),on(s).darker(.7).toString()}),t.services.events.dispatchEvent(T.Tooltip.SHOW,{event:n,hoveredElement:i,items:[{color:s,label:a.data.name,bold:!0},{label:r.data.name,value:r.data.value}]}),t.services.events.dispatchEvent(T.Treemap.LEAF_MOUSEOVER,{event:n,element:i,datum:r})}).on("mousemove",function(n,r){const i=I(this);t.services.events.dispatchEvent(T.Treemap.LEAF_MOUSEMOVE,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(T.Tooltip.MOVE,{event:n})}).on("click",function(n,r){t.services.events.dispatchEvent(T.Treemap.LEAF_CLICK,{event:n,element:I(this),datum:r})}).on("mouseout",function(n,r){const i=I(this);i.classed("hovered",!1);let s=r;for(;s.depth>1;)s=s.parent;i.transition().call(a=>t.services.transitions.setupTransition({transition:a,name:"graph_element_mouseout_fill_update"})).style("fill",a=>t.model.getFillColor(a.parent.data.name,null,a.data)),t.services.events.dispatchEvent(T.Treemap.LEAF_MOUSEOUT,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(T.Tooltip.HIDE,{hoveredElement:i})})}}var CU={value:function(){}};function jv(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new Eo(n)}function Eo(e){this._=e}function DU(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",i=n.indexOf(".");if(i>=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Eo.prototype=jv.prototype={constructor:Eo,on:function(e,t){var n=this._,r=DU(e+"",n),i,s=-1,a=r.length;if(arguments.length<2){for(;++s<a;)if((i=(e=r[s]).type)&&(i=LU(n[i],e.name)))return i;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++s<a;)if(i=(e=r[s]).type)n[i]=Zv(n[i],e.name,t);else if(t==null)for(i in n)n[i]=Zv(n[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new Eo(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=new Array(i),r=0,i,s;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(s=this._[e],r=0,i=s.length;r<i;++r)s[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],i=0,s=r.length;i<s;++i)r[i].value.apply(t,n)}};function LU(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function Zv(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=CU,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}const RU=oP(Object.freeze(Object.defineProperty({__proto__:null,dispatch:jv},Symbol.toStringTag,{value:"Module"}))).dispatch,Xu=Math.PI/180,IU={archimedean:Qv,rectangular:zU},ys=64,bo=2048;var kU=function(){var e=[256,256],t=PU,n=NU,r=$U,i=Kv,s=Kv,a=FU,o=UU,l=Qv,c=[],u=1/0,d=RU("word","end"),h=null,f=Math.random,p={},g=YU;p.canvas=function(E){return arguments.length?(g=$n(E),p):g},p.start=function(){var E=m(g()),y=WU((e[0]>>5)*e[1]),x=null,S=c.length,_=-1,A=[],L=c.map(function(D,O){return D.text=t.call(this,D,O),D.font=n.call(this,D,O),D.style=i.call(this,D,O),D.weight=s.call(this,D,O),D.rotate=a.call(this,D,O),D.size=~~r.call(this,D,O),D.padding=o.call(this,D,O),D}).sort(function(D,O){return O.size-D.size});return h&&clearInterval(h),h=setInterval(B,0),B(),p;function B(){for(var D=Date.now();Date.now()-D<u&&++_<S&&h;){var O=L[_];O.x=e[0]*(f()+.5)>>1,O.y=e[1]*(f()+.5)>>1,BU(E,O,L,_),O.hasText&&v(y,O,x)&&(A.push(O),d.call("word",p,O),x?GU(x,O):x=[{x:O.x+O.x0,y:O.y+O.y0},{x:O.x+O.x1,y:O.y+O.y1}],O.x-=e[0]>>1,O.y-=e[1]>>1)}_>=S&&(p.stop(),d.call("end",p,A,x))}},p.stop=function(){h&&(clearInterval(h),h=null);for(const E of c)delete E.sprite;return p};function m(E){const y=E.getContext("2d",{willReadFrequently:!0});E.width=E.height=1;const x=Math.sqrt(y.getImageData(0,0,1,1).data.length>>2);return E.width=(ys<<5)/x,E.height=bo/x,y.fillStyle=y.strokeStyle="red",{context:y,ratio:x}}function v(E,y,x){e[0],e[1];for(var S=y.x,_=y.y,A=Math.sqrt(e[0]*e[0]+e[1]*e[1]),L=l(e),B=f()<.5?1:-1,D=-B,O,H,P;(O=L(D+=B))&&(H=~~O[0],P=~~O[1],!(Math.min(Math.abs(H),Math.abs(P))>=A));)if(y.x=S+H,y.y=_+P,!(y.x+y.x0<0||y.y+y.y0<0||y.x+y.x1>e[0]||y.y+y.y1>e[1])&&(!x||VU(y,x))&&!HU(y,E,e[0])){for(var M=y.sprite,w=y.width>>5,U=e[0]>>5,F=y.x-(w<<4),$=F&127,N=32-$,j=y.y1-y.y0,q=(y.y+y.y0)*U+(F>>5),at,nt=0;nt<j;nt++){at=0;for(var dt=0;dt<=w;dt++)E[q+dt]|=at<<N|(dt<w?(at=M[nt*w+dt])>>>$:0);q+=U}return!0}return!1}return p.timeInterval=function(E){return arguments.length?(u=E??1/0,p):u},p.words=function(E){return arguments.length?(c=E,p):c},p.size=function(E){return arguments.length?(e=[+E[0],+E[1]],p):e},p.font=function(E){return arguments.length?(n=$n(E),p):n},p.fontStyle=function(E){return arguments.length?(i=$n(E),p):i},p.fontWeight=function(E){return arguments.length?(s=$n(E),p):s},p.rotate=function(E){return arguments.length?(a=$n(E),p):a},p.text=function(E){return arguments.length?(t=$n(E),p):t},p.spiral=function(E){return arguments.length?(l=IU[E]||E,p):l},p.fontSize=function(E){return arguments.length?(r=$n(E),p):r},p.padding=function(E){return arguments.length?(o=$n(E),p):o},p.random=function(E){return arguments.length?(f=E,p):f},p.on=function(){var E=d.on.apply(d,arguments);return E===d?p:E},p};function PU(e){return e.text}function NU(){return"serif"}function Kv(){return"normal"}function $U(e){return Math.sqrt(e.value)}function FU(){return(~~(random()*6)-3)*30}function UU(){return 1}function BU(e,t,n,r){if(!t.sprite){var i=e.context,s=e.ratio;i.clearRect(0,0,(ys<<5)/s,bo/s);var a=0,o=0,l=0,c=n.length;for(--r;++r<c;){t=n[r],i.save(),i.font=t.style+" "+t.weight+" "+~~((t.size+1)/s)+"px "+t.font;const O=i.measureText(t.text),H=-Math.floor(O.width/2);let P=(O.width+1)*s,M=t.size<<1;if(t.rotate){var u=Math.sin(t.rotate*Xu),d=Math.cos(t.rotate*Xu),h=P*d,f=P*u,p=M*d,g=M*u;P=Math.max(Math.abs(h+g),Math.abs(h-g))+31>>5<<5,M=~~Math.max(Math.abs(f+p),Math.abs(f-p))}else P=P+31>>5<<5;if(M>l&&(l=M),a+P>=ys<<5&&(a=0,o+=l,l=0),o+M>=bo)break;i.translate((a+(P>>1))/s,(o+(M>>1))/s),t.rotate&&i.rotate(t.rotate*Xu),i.fillText(t.text,H,0),t.padding&&(i.lineWidth=2*t.padding,i.strokeText(t.text,H,0)),i.restore(),t.width=P,t.height=M,t.xoff=a,t.yoff=o,t.x1=P>>1,t.y1=M>>1,t.x0=-t.x1,t.y0=-t.y1,t.hasText=!0,a+=P}for(var m=i.getImageData(0,0,(ys<<5)/s,bo/s).data,v=[];--r>=0;)if(t=n[r],!!t.hasText){for(var E=t.width,y=E>>5,x=t.y1-t.y0,S=0;S<x*y;S++)v[S]=0;if(a=t.xoff,a==null)return;o=t.yoff;for(var _=0,A=-1,L=0;L<x;L++){for(var S=0;S<E;S++){var B=y*L+(S>>5),D=m[(o+L)*(ys<<5)+(a+S)<<2]?1<<31-S%32:0;v[B]|=D,_|=D}_?A=L:(t.y0++,x--,L--,o++)}t.y1=t.y0+A,t.sprite=v.slice(0,(t.y1-t.y0)*y)}}}function HU(e,t,n){n>>=5;for(var r=e.sprite,i=e.width>>5,s=e.x-(i<<4),a=s&127,o=32-a,l=e.y1-e.y0,c=(e.y+e.y0)*n+(s>>5),u,d=0;d<l;d++){u=0;for(var h=0;h<=i;h++)if((u<<o|(h<i?(u=r[d*i+h])>>>a:0))&t[c+h])return!0;c+=n}return!1}function GU(e,t){var n=e[0],r=e[1];t.x+t.x0<n.x&&(n.x=t.x+t.x0),t.y+t.y0<n.y&&(n.y=t.y+t.y0),t.x+t.x1>r.x&&(r.x=t.x+t.x1),t.y+t.y1>r.y&&(r.y=t.y+t.y1)}function VU(e,t){return e.x+e.x1>t[0].x&&e.x+e.x0<t[1].x&&e.y+e.y1>t[0].y&&e.y+e.y0<t[1].y}function Qv(e){var t=e[0]/e[1];return function(n){return[t*(n*=.1)*Math.cos(n),n*Math.sin(n)]}}function zU(e){var t=4,n=t*e[0]/e[1],r=0,i=0;return function(s){var a=s<0?-1:1;switch(Math.sqrt(1+4*a*s)-a&3){case 0:r+=n;break;case 1:i+=t;break;case 2:r-=n;break;default:i-=t;break}return[r,i]}}function WU(e){for(var t=[],n=-1;++n<e;)t[n]=0;return t}function YU(){return document.createElement("canvas")}function $n(e){return typeof e=="function"?e:function(){return e}}const qU=aP(kU);class XU extends pt{constructor(){super(...arguments),this.type="wordcloud",this.renderType=tt.SVG,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail,{groupMapsTo:r}=this.getOptions().data;this.parent.selectAll("text.word").transition("legend-hover-wordcloud").call(i=>this.services.transitions.setupTransition({transition:i,name:"legend-hover-wordcloud"})).attr("opacity",i=>i[r]!==n.datum().name?.3:1)},this.handleLegendMouseOut=()=>{this.parent.selectAll("text.word").transition("legend-mouseout-wordcloud").call(t=>this.services.transitions.setupTransition({transition:t,name:"legend-mouseout-wordcloud"})).attr("opacity",1)}}init(){const t=this.services.events;t.addEventListener(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t=!0){const n=this,r=this.getComponentContainer().attr("width","100%").attr("height","100%"),i=this.model.getDisplayData(),s=this.getFontSizeScale(i),a=this.getOptions(),{fontSizeMapsTo:o,wordMapsTo:l}=a.wordCloud,{groupMapsTo:c}=a.data,{width:u,height:d}=R.getSVGElementSize(r,{useAttrs:!0});if(u===0||d===0)return;const h=qU().size([u,d]).words(i.map(function(p){const g=p[o];if(typeof p[o]!="number")throw Error("Badly formatted WordCloud data. `value` should only be an integer or float");return{[c]:p[c],text:p[l],size:g,value:g}})).padding(5).rotate(0).fontSize(p=>s(p.size)).on("end",f);h.start();function f(p){const g=R.appendOrSelect(r,"g.words");g.attr("transform",`translate(${h.size()[0]/2}, ${h.size()[1]/2})`);const m=g.selectAll("text").data(p,E=>`${E[c]}-${E.text}`);m.exit().attr("opacity",0).remove(),m.enter().append("text").attr("opacity",0).merge(m).style("font-size",E=>`${E.size}px`).text(function(E){return E.text}).attr("class",E=>n.model.getColorClassName({classNameTypes:[it.FILL],dataGroupName:E[c],originalClassName:`word ${E.size>32?"light":""}`})).style("fill",E=>n.model.getFillColor(E[c],E.text,E)).attr("text-anchor","middle").transition().call(E=>n.services.transitions.setupTransition({transition:E,name:"wordcloud-text-update-enter",animate:t})).attr("transform",E=>`translate(${E.x}, ${E.y})`).attr("opacity",1)}this.addEventListeners()}getFontSizeScale(t){const n=this.getOptions(),{fontSizeMapsTo:r}=n.wordCloud,i=t.map(l=>l[r]).filter(l=>l),s=R.getHTMLElementSize(this.services.domUtils.getMainContainer()),a=i.length>0,o=a?Ie(i):[1,1];return Fe().domain(o).range(a?n.wordCloud.fontSizeRange(s,t):[4,4])}addEventListeners(){const t=this.getOptions(),{groupMapsTo:n}=t.data,r=this,i=Va(s=>{const a=r.parent.selectAll("text.word").transition("wordcloud-word-mouse-highlight").call(o=>r.services.transitions.setupTransition({transition:o,name:"wordcloud-word-mouse-highlight"}));s===null?a.attr("opacity",1):a.attr("opacity",function(){return s===this?1:.3})},6);this.parent.selectAll("text.word").on("mouseover",function(s,a){const o=this;i(o),r.services.events.dispatchEvent(T.WordCloud.WORD_MOUSEOVER,{event:s,element:I(this),datum:a}),r.services.events.dispatchEvent(T.Tooltip.SHOW,{event:s,hoveredElement:o,items:[{label:t.tooltip.wordLabel,value:a.text},{label:t.tooltip.valueLabel,value:a.value},{label:yt(t,"locale.translations.group")||yt(t,"tooltip.groupLabel")||"Group",value:a[n],class:r.model.getColorClassName({classNameTypes:[it.TOOLTIP],dataGroupName:a[n]})}]})}).on("mousemove",function(s,a){const o=I(this);r.services.events.dispatchEvent(T.WordCloud.WORD_MOUSEMOVE,{element:o,datum:a}),r.services.events.dispatchEvent(T.Tooltip.MOVE,{event:s})}).on("click",function(s,a){r.services.events.dispatchEvent(T.WordCloud.WORD_CLICK,{event:s,element:I(this),datum:a})}).on("mouseout",function(s,a){const o=I(this);i(null),r.services.events.dispatchEvent(T.WordCloud.WORD_MOUSEOUT,{event:s,element:o,datum:a}),r.services.events.dispatchEvent(T.Tooltip.HIDE,{hoveredElement:o})})}}class jU extends pt{constructor(){super(...arguments),this.type="geo",this.renderType=tt.SVG}render(){const t=this.getComponentContainer({withinChartClip:!0}),{width:n,height:r}=R.getSVGElementSize(t,{useAttrs:!0});if(n<1||r<1)return;const i=this.getProjection(),s=b(this.getOptions(),"geoData"),a=this.model.getCombinedData(),o={},l={};Object.keys(a).forEach(v=>{typeof a[v].value=="number"?o[v]=a[v]:l[v]=a[v]});const c=$N(s,Object.values(l)),u=kN(s,{type:"GeometryCollection",geometries:Object.values(o)}),d=i.fitSize([n,r],u),h=hx().projection(d);R.appendOrSelect(t,"g.geo").selectAll("path").data(u.features).join("path").attr("d",h);const p=this.services.domUtils.generateElementIDString("geo-pattern-stripes"),g=R.appendOrSelect(t,"defs");R.appendOrSelect(g,"pattern").attr("id",p).attr("width",5).attr("height",10).attr("patternUnits","userSpaceOnUse").attr("patternTransform","rotate(45)").append("path").classed("pattern-fill",!0).attr("d",Bi()([[0,0],[0,10]]));const m=R.appendOrSelect(t,"g.missing-data");R.appendOrSelect(m,"path").datum(c).attr("d",h).style("fill",`url(#${p})`)}getProjection(){let t=null;switch(b(this.getOptions(),"thematic","projection")){case nn.geoEqualEarth:t=Dx();break;case nn.geoAlbers:t=Sx();break;case nn.geoConicEqualArea:t=Qd();break;case nn.geoConicEquidistant:t=Ax();break;case nn.geoEquirectangular:t=wx();break;case nn.geoMercator:t=Tx();break;case nn.geoNaturalEarth1:t=Lx();break;default:throw new Error("Projection is not supported.")}return t}}class ZU extends jU{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",s=>this.model.getColorClassName({value:n[s.properties.NAME].value,originalClassName:"border"})),this.addCountryAreaEventListener()}addCountryAreaEventListener(){const t=this,n=this.model.getCombinedData();this.parent.selectAll("path.border").on("mouseover",function(r,i){const s=I(this);t.services.events.dispatchEvent(Vr.CHOROPLETH_MOUSEOVER,{event:r,element:s,datum:n[i.properties.NAME]}),t.services.events.dispatchEvent(Gr.SHOW,{event:r,hoveredElement:s,items:[{label:i.properties.NAME,value:n[i.properties.NAME].value}]})}).on("mousemove",function(r,i){t.services.events.dispatchEvent(Vr.CHOROPLETH_MOUSEMOVE,{event:r,element:I(this),datum:n[i.properties.NAME]}),t.services.events.dispatchEvent(Gr.MOVE,{event:r})}).on("click",function(r,i){t.services.events.dispatchEvent(Vr.CHOROPLETH_CLICK,{event:r,element:I(this),datum:n[i.properties.NAME]})}).on("mouseout",function(r,i){const s=I(this);t.services.events.dispatchEvent(Vr.CHOROPLETH_MOUSEOUT,{event:r,element:s,datum:n[i.properties.NAME]}),t.services.events.dispatchEvent(Gr.HIDE,{event:r,hoveredElement:s})})}}class KU extends qe{constructor(t,n){super(t,n),this.model=new DN(this.services),this.model.setOptions(Pt(Ct.choroplethChart,n.options)),this.init(t,n)}getChartComponents(t,n){const r=this.model.getOptions(),i=b(r,"toolbar","enabled"),s=!!this.model.getOptions().title,a={id:"title",components:[new gs(this.model,this.services)],growth:ct.STRETCH},o={id:"toolbar",components:[new Kr(this.model,this.services)],growth:ct.PREFERRED},l={id:"header",components:[new ae(this.model,this.services,[a,...i?[o]:[]],{direction:At.ROW,alignItems:ir.CENTER})],growth:ct.PREFERRED},c={id:"legend",components:[new Nv(this.model,this.services,{chartType:"choropleth"})],growth:ct.PREFERRED,renderType:tt.SVG},u={id:"graph-frame",components:t,growth:ct.STRETCH,renderType:tt.SVG},d=b(n,"legend","enabled")!==!1&&this.model.getOptions().legend.enabled!==!1&&this.model.getData().length>0,h=At.COLUMN_REVERSE,f={id:"spacer",components:[new On(this.model,this.services,{size:15})],growth:ct.PREFERRED},p={id:"full-frame",components:[new ae(this.model,this.services,[...d?[c]:[],...d?[f]:[],u],{direction:h})],growth:ct.STRETCH},g=[];if(s||i){g.push(l);const m={id:"spacer",components:[new On(this.model,this.services,i?{size:15}:void 0)],growth:ct.PREFERRED};g.push(m)}return g.push(p),[new Iu(this.model,this.services),new po(this.model,this.services),new ae(this.model,this.services,g,{direction:At.COLUMN})]}getComponents(){const t=[new ZU(this.model,this.services)];return this.getChartComponents(t)}}class QU extends rn{constructor(t){super(t),this.parentNode=!1,this.set({depth:2},{skipUpdate:!0})}setData(t){super.setData(t),this.setDataGroups(),t.length===1&&(this.parentNode=!0),this.setZoom()}setOptions(t){const n=this.getOptions(),r=lt({},t,this.getZoomOptions(t));Kc(n,r);const i=this.getHierarchyLevel(),s=b(n,"circlePack","hierarchyLevel");this.set({options:lt(n,r),depth:s&&s<4?s:i})}getZoomOptions(t){if(!this.getDisplayData())return{};const n=this.getDisplayData(),r=t||this.getOptions(),i=n.length===1&&b(n,0,"children")?b(n,0,"children"):n;let s=this.getHierarchyLevel();return i.some(a=>{if(a.children&&a.children.some(o=>o.children))return s=3,!1}),b(r,"canvasZoom","enabled")===!0&&s>2?{legend:{additionalItems:[{type:Gt.ZOOM,name:"Click to zoom"}]}}:null}setZoom(t){this.setOptions(this.getZoomOptions(t))}updateHierarchyLevel(t){this.set({depth:t})}getHierarchyLevel(){return this.get("depth")}hasParentNode(){return this.parentNode}setDataGroups(){const t=this.getData(),n=this.getOptions(),{groupMapsTo:r}=n.data,i=t.map(s=>{const a=s[r];return this.setChildrenDataGroup(s,a)});this.set({data:i},{skipUpdate:!0})}setChildrenDataGroup(t,n){return t.children?{...t,dataGroupName:n,children:t.children.map(r=>this.setChildrenDataGroup(r,n))}:{...t,dataGroupName:n}}getTabularDataArray(){const t=this.getDisplayData(),{number:n,code:r}=b(this.getOptions(),"locale"),i=["Child","Parent","Value"],s=[];return t.forEach(a=>{let o=a.value?a.value:0;a.children&&(o+=this.getChildrenDatums(a.children,a.name,s,0)),s.push(["–",a.name,n(o,r)])}),super.formatTable({headers:i,cells:s})}getChildrenDatums(t,n,r=[],i=0){const s=n,{number:a,code:o}=b(this.getOptions(),"locale");return t.forEach(l=>{const c=l.name;let u=0;if(l.children)l.children.length>0&&(typeof l.value=="number"&&(i+=l.value),u+=this.getChildrenDatums(l.children,c,r,u),r.push([c,s,a(u,o)]),i+=u);else{let d=0;typeof l.value=="number"&&(d=l.value,i+=l.value),r.push([l.name,s,a(d,o)])}}),i}}class JU extends qe{constructor(t,n){super(t,n),this.model=new QU(this.services),this.model.setOptions(Pt(Ct.circlePackChart,n.options)),this.init(t,n)}getComponents(){const t=[new HN(this.model,this.services)];return this.getChartComponents(t)}}const Jv={[Ee.LINE]:[ti,an],[Ee.SCATTER]:[an],[Ee.AREA]:[Dv,ti,an],[Ee.STACKED_AREA]:[zv,ti,Yv,yo],[Ee.SIMPLE_BAR]:[Vv],[Ee.GROUPED_BAR]:[Bv,ei],[Ee.STACKED_BAR]:[Wv,yo]};class tB extends de{constructor(t,n){super(t,n);const r=Pt(Ct.comboChart,n.options);n.options.comboChartTypes||(console.error("No comboChartTypes defined for the Combo Chart!"),r.comboChartTypes=[{type:Ee.LINE,correspondingDatasets:[]}]),this.model.setOptions(r),this.init(t,n)}getGraphComponents(){const{comboChartTypes:t}=this.model.getOptions();let n=0;const r=t.map(i=>{const s=i.type;let a;if(typeof i.type=="string"){if(!Object.keys(Jv).includes(i.type))return console.error(`Invalid chart type "${i.type}" specified for combo chart. Please refer to the ComboChart tutorial for more guidance.`),null;let o=!1;const l=`${aC(i.type)}Chart`;return a=lt({},Ct[l],this.model.getOptions(),i.options),i.type===Ee.STACKED_AREA&&(o=!0),Jv[i.type].map(c=>new c(this.model,this.services,{groups:i.correspondingDatasets,id:n++,options:a,stacked:o}))}else return a=lt({},this.model.getOptions(),i.options),new s(this.model,this.services,{groups:i.correspondingDatasets,id:n++,options:a})}).filter(i=>i!==null);return Pp(r)}getComponents(){const{comboChartTypes:t}=this.model.getOptions(),n=t.some(s=>s.type===Ee.STACKED_BAR||s.type===Ee.STACKED_AREA),r=[new fe(this.model,this.services),new Te(this.model,this.services),new oe(this.model,this.services,{skeleton:Ht.GRID}),...n?[]:[new Pn(this.model,this.services)],...this.getGraphComponents()];return this.getAxisChartComponents(r)}}class eB extends rn{constructor(t){super(t)}getTabularData(t){const n=super.getTabularData(t);return t!==n&&n.forEach(r=>{r.key&&r.key!==r.group&&(r.group=r.key)}),n}getTabularDataArray(){const t=this.getDisplayData(),n=this.getOptions(),{groupMapsTo:r}=n.data,{valueMapsTo:i}=n.pie,{number:s,code:a}=b(n,"locale"),o=["Group","Value"],l=[...t.map(c=>[c[r],c[i]===null?"–":s(c[i],a)])];return super.formatTable({headers:o,cells:l})}sanitize(t){return this.getTabularData(t).sort((r,i)=>i.value-r.value)}}class t0 extends qe{constructor(t,n,r=!1){super(t,n),this.model=new eB(this.services),!r&&(this.model.setOptions(Pt(Ct.pieChart,n.options)),this.init(t,n))}getComponents(){const t=[new $v(this.model,this.services),new oe(this.model,this.services,{skeleton:Ht.PIE})];return this.getChartComponents(t)}}class nB extends t0{constructor(t,n){super(t,n,!0),this.model.setOptions(Pt(Ct.donutChart,n.options)),this.init(t,n)}getComponents(){const t=[new VN(this.model,this.services),new oe(this.model,this.services,{skeleton:Ht.DONUT})];return this.getChartComponents(t)}}class rB extends rn{constructor(t){super(t)}getDataGroups(){return super.getDataGroups().filter(t=>t.name!=="delta")}getTabularDataArray(){const t=this.getDisplayData(),n=this.getOptions(),{groupMapsTo:r}=n.data,{number:i,code:s}=b(this.getOptions(),"locale"),a=["Group","Value"],o=[...t.map(l=>[l[r],l.value===null?"–":i(l.value,s)])];return super.formatTable({headers:a,cells:o})}}class iB extends qe{constructor(t,n){super(t,n),this.model=new rB(this.services),this.model.setOptions(Pt(Ct.gaugeChart,n.options)),this.init(t,n)}getComponents(){const t=[new zN(this.model,this.services)];return this.getChartComponents(t)}}class sB extends de{constructor(t,n){super(t,n),this.model.setOptions(Pt(Ct.groupedBarChart,n.options)),this.init(t,n)}getComponents(){const t=[new fe(this.model,this.services),new Te(this.model,this.services),new Bv(this.model,this.services),new ei(this.model,this.services),new oe(this.model,this.services,{skeleton:Ht.VERT_OR_HORIZ})];return this.getAxisChartComponents(t)}}class aB extends ur{constructor(t){super(t),this.axisFlavor=rs.HOVERABLE,this._colorScale=void 0,this._domains=[],this._ranges=[],this._matrix={};const n=b(this.getOptions(),"axes");if(b(n,"left","scaleType")&&b(n,"left","scaleType")!==Q.LABELS||b(n,"right","scaleType")&&b(n,"right","scaleType")!==Q.LABELS||b(n,"top","scaleType")&&b(n,"top","scaleType")!==Q.LABELS||b(n,"bottom","scaleType")&&b(n,"bottom","scaleType")!==Q.LABELS)throw Error("Heatmap only supports label scaletypes.")}getValueDomain(){const t=Ie(this.getDisplayData(),r=>r.value),n=Fe().domain(t).nice().domain();if(n[0]>0)n[0]=0;else if(n[0]===0&&n[1]===0)return[0,1];return n[0]<0&&n[1]>0&&(Math.abs(n[0])>n[1]?n[1]=Math.abs(n[0]):n[0]=-n[1]),n}getFillColor(t){return this._colorScale(t)}getUniqueDomain(){if(He(this._domains)){const t=this.getDisplayData(),{cartesianScales:n}=this.services,r=n.getDomainIdentifier(),i=n.getMainXAxisPosition(),s=n.getCustomDomainValuesByposition(i);if(s)return s;this._domains=Array.from(new Set(t.map(a=>a[r])))}return this._domains}getUniqueRanges(){if(He(this._ranges)){const t=this.getDisplayData(),{cartesianScales:n}=this.services,r=n.getRangeIdentifier(),i=n.getMainYAxisPosition(),s=n.getCustomDomainValuesByposition(i);if(s)return s;this._ranges=Array.from(new Set(t.map(a=>a[r])))}return this._ranges}getMatrix(){if(He(this._matrix)){const t=this.getUniqueDomain(),n=this.getUniqueRanges(),r=this.services.cartesianScales.getDomainIdentifier(),i=this.services.cartesianScales.getRangeIdentifier(),s={};n.forEach(a=>{s[a]={value:null,index:-1}}),t.forEach(a=>{this._matrix[a]=yn(s)}),this.getDisplayData().forEach((a,o)=>{this._matrix[a[r]][a[i]]={value:a.value,index:o}})}return this._matrix}setData(t){const n=this.sanitize(yn(t)),r=this.generateDataGroups(n);return this.set({data:n,dataGroups:r}),this._domains=[],this._ranges=[],this._matrix={},n}getMatrixAsArray(){He(this._matrix)&&this.getMatrix();const t=this.getUniqueDomain(),n=this.getUniqueRanges(),r=this.services.cartesianScales.getDomainIdentifier(),i=this.services.cartesianScales.getRangeIdentifier(),s=[];return t.forEach(a=>{n.forEach(o=>{const l={value:this._matrix[a][o].value,index:this._matrix[a][o].index};l[r]=a,l[i]=o,s.push(l)})}),s}getTabularDataArray(){const t=this.getDisplayData(),{primaryDomain:n,primaryRange:r}=this.assignRangeAndDomains(),{number:i,code:s}=b(this.getOptions(),"locale"),a=[n.label,r.label,"Value"],o=[...t.map(l=>[l[n.identifier]===null?"–":l[n.identifier],l[r.identifier]===null?"–":l[r.identifier],i(l.value,s)])];return super.formatTable({headers:a,cells:o})}getColorClassName(t){return`${t.originalClassName} ${this._colorScale(t.value)}`}setColorClassNames(){const t=this.getOptions(),n=b(t,"color","gradient","colors"),r=!He(n);let i=b(t,"color","pairing","option");const s=this.getValueDomain(),a=s[0]<0&&s[1]>0?"diverge":"mono";(i<1&&i>4&&a==="mono"||i<1&&i>2&&a==="diverge")&&(i=1);const o=r?n:[];if(!r){const c=a==="diverge"?17:11;for(let u=1;u<c+1;u++)o.push(`fill-${a}-${i}-${u}`)}this._colorScale=Nl().domain(s).range(o);const l=b(this.getOptions(),"color");this._colorScale=kv(this.getDisplayData(),l)}}class oB extends de{constructor(t,n){super(t,n),this.model=new aB(this.services),this.model.setOptions(Pt(Ct.heatmapChart,n.options)),this.init(t,n)}getAxisChartComponents(t,n){const r=this.model.getOptions(),i=b(r,"toolbar","enabled");this.services.cartesianScales.determineAxisDuality(),this.services.cartesianScales.findDomainAndRangeAxes(),this.services.cartesianScales.determineOrientation();const s=!!this.model.getOptions().title,a={id:"title",components:[new gs(this.model,this.services)],growth:ct.STRETCH},o={id:"toolbar",components:[new Kr(this.model,this.services)],growth:ct.PREFERRED},l={id:"header",components:[new ae(this.model,this.services,[a,...i?[o]:[]],{direction:At.ROW,alignItems:ir.CENTER})],growth:ct.PREFERRED},c={id:"legend",components:[new Nv(this.model,this.services,{chartType:"heatmap"})],growth:ct.PREFERRED,renderType:tt.SVG},u={id:"graph-frame",components:t,growth:ct.STRETCH,renderType:tt.SVG},d=b(n,"legend","enabled")!==!1&&this.model.getOptions().legend.enabled!==!1&&this.model.getData().length>0,h=At.COLUMN_REVERSE,f={id:"spacer",components:[new On(this.model,this.services,{size:15})],growth:ct.PREFERRED},p={id:"full-frame",components:[new ae(this.model,this.services,[...d?[c]:[],...d?[f]:[],u],{direction:h})],growth:ct.STRETCH},g=[];if(s||i){g.push(l);const m={id:"spacer",components:[new On(this.model,this.services,i?{size:15}:void 0)],growth:ct.PREFERRED};g.push(m)}return g.push(p),[new xv(this.model,this.services),new po(this.model,this.services),new ae(this.model,this.services,g,{direction:At.COLUMN})]}getComponents(){const t=[new fe(this.model,this.services),new WN(this.model,this.services)];return this.getAxisChartComponents(t)}}class lB extends ur{getTabularDataArray(){const t=this.getOptions(),{groupMapsTo:n}=t.data,{number:r,code:i}=b(this.getOptions(),"locale"),s=this.getBinnedStackedData(),a=[yt(t,"bins.rangeLabel")||"Range",...s.map(l=>yt(l,`0.${n}`))],o=[...yt(s,0).map((l,c)=>[`${r(Number(yt(l,"data.x0")),i)} – ${r(Number(yt(l,"data.x1")),i)}`,...s.map(u=>r(yt(u[c],`data.${yt(u[c],n)}`),i))])];return super.formatTable({headers:a,cells:o})}}class cB extends de{constructor(t,n){super(t,n),this.model=new lB(this.services),this.model.setOptions(Pt(Ct.histogramChart,n.options)),this.init(t,n),this.update()}getComponents(){const t=[new fe(this.model,this.services),new Te(this.model,this.services),new UN(this.model,this.services),new YN(this.model,this.services)];return this.getAxisChartComponents(t)}}class uB extends de{constructor(t,n){super(t,n),this.model.setOptions(Pt(Ct.lineChart,n.options)),this.init(t,n)}getComponents(){const t=[new fe(this.model,this.services),new Te(this.model,this.services),new Pn(this.model,this.services),new ti(this.model,this.services),new an(this.model,this.services,{handleThresholds:!0}),new QN(this.model,this.services),new ei(this.model,this.services)];return this.getAxisChartComponents(t)}}class hB extends de{constructor(t,n){super(t,n),this.model.setOptions(Pt(Ct.lollipopChart,n.options)),this.init(t,n)}getComponents(){const t=[new fe(this.model,this.services),new Te(this.model,this.services),new Pn(this.model,this.services),new qN(this.model,this.services),new an(this.model,this.services),new oe(this.model,this.services,{skeleton:Ht.GRID})];return this.getAxisChartComponents(t)}}class dB extends rn{constructor(t){super(t)}getMaximumDomain(t){return t.reduce((r,i)=>r+i.value,0)}getFillColor(t){const n=this.getOptions(),r=b(n,"color","scale"),i=this.getStatus();return r||!i?super.getFillColor(t):null}getStatus(){const t=this.getOptions(),n=b(this.getDisplayData()),r=(n==null?void 0:n.reduce((a,o)=>a+o.value,0))??0,i=b(t,"meter","proportional")?r:r>100?100:r,s=b(t,"meter","status","ranges");if(s){const a=s.filter(o=>o.range[0]<=i&&i<=o.range[1]);if(a.length>0)return a[0].status}return null}getTabularDataArray(){const t=this.getDisplayData(),n=this.getOptions(),{groupMapsTo:r}=n.data,i=this.getStatus(),s=b(n,"meter","proportional"),{number:a,code:o}=b(this.getOptions(),"locale");let l=[],c=[],u;if(s===null){u=100;const d=t[0];l=["Group","Value",...i?["Status"]:[]],c=[[d[r],a(d.value,o),...i?[i]:[]]]}else{const d=b(s,"total");u=d||this.getMaximumDomain(t),l=["Group","Value","Percentage of total"],c=[...t.map(h=>{const f=h.value,p=Number((h.value/u*100).toFixed(2));return[h[r],a(f,o),a(p,o)+" %"]})]}return super.formatTable({headers:l,cells:c})}}class fB extends qe{constructor(t,n){var i;super(t,n),this.model=new dB(this.services);const r=(i=n.options.meter)!=null&&i.proportional?lt(yn(Ct.proportionalMeterChart),n.options):lt(yn(Ct.meterChart),n.options);this.model.setOptions(r),this.init(t,n)}getComponents(){const n=[...b(this.model.getOptions(),"meter","showLabels")?[{id:"meter-title",components:[new BN(this.model,this.services)],growth:ct.STRETCH,renderType:tt.SVG},{id:"spacer",components:[new On(this.model,this.services,{size:8})],growth:ct.STRETCH}]:[],{id:"meter-graph",components:[new XN(this.model,this.services)],growth:ct.STRETCH,renderType:tt.SVG}],r=[new ae(this.model,this.services,n,{direction:At.COLUMN})];return this.getChartComponents(r,{graphFrameRenderType:tt.HTML})}}class pB extends ur{constructor(t){super(t)}getTabularDataArray(){const t=this.getOptions(),n=this.getGroupedData(),{angle:r,value:i}=b(t,"radar","axes"),{number:s,code:a}=b(t,"locale"),o=b(n,"0","data").map(u=>u[r]),l=["Group",...o],c=[...n.map(u=>[u.name,...o.map((d,h)=>b(u,"data",h,i)!==null?s(b(u,"data",h,i),a):"–")])];return super.formatTable({headers:l,cells:c})}}class gB extends qe{constructor(t,n){super(t,n),this.model=new pB(this.services),this.model.setOptions(Pt(Ct.radarChart,n.options)),this.init(t,n)}getComponents(){const t=[new KN(this.model,this.services)];return this.getChartComponents(t)}}class mB extends de{constructor(t,n){super(t,n),this.model.setOptions(Pt(Ct.scatterChart,n.options)),this.init(t,n)}getComponents(){const t=[new fe(this.model,this.services),new Te(this.model,this.services),new Pn(this.model,this.services),new an(this.model,this.services),new oe(this.model,this.services,{skeleton:Ht.GRID})];return this.getAxisChartComponents(t)}}class vB extends rn{constructor(t){super(t)}getTabularDataArray(){const t=this.getDisplayData(),n=["Child","Parent"],r=[];return t.forEach(i=>{this.getChildrenDatums(i,r),r.push([i.name,"–"])}),super.formatTable({headers:n,cells:r})}getChildrenDatums(t,n=[]){t.children&&t.children.length>0&&t.children.forEach(r=>{this.getChildrenDatums(r,n),n.push([r.name,t.name])})}}class yB extends qe{constructor(t,n){super(t,n),this.model=new vB(this.services),this.model.setOptions(Pt(Ct.treeChart,n.options)),this.init(t,n)}getComponents(){const t=[new JN(this.model,this.services)];return this.getChartComponents(t,{excludeLegend:!0})}}class EB extends rn{constructor(t){super(t)}getTabularDataArray(){const t=this.getDisplayData(),{number:n,code:r}=b(this.getOptions(),"locale"),i=["Child","Group","Value"],s=[];return t.forEach(a=>{Array.isArray(a.children)?a.children.forEach(o=>{s.push([o.name,a.name,n(o.value,r)])}):b(a.name)!==null&&b(a.value)&&s.push(["–",a.name,n(a.value,r)])}),super.formatTable({headers:i,cells:s})}}class bB extends qe{constructor(t,n){super(t,n),this.model=new EB(this.services),this.model.setOptions(Pt(Ct.treemapChart,n.options)),this.init(t,n)}getComponents(){const t=[new AU(this.model,this.services)];return this.getChartComponents(t)}}class xB extends de{constructor(t,n){super(t,n),this.model.setOptions(Pt(Ct.simpleBarChart,n.options)),this.init(t,n)}getComponents(){const t=[new fe(this.model,this.services),new Te(this.model,this.services),new Vv(this.model,this.services),new ei(this.model,this.services),new oe(this.model,this.services,{skeleton:Ht.VERT_OR_HORIZ})];return this.getAxisChartComponents(t)}}class _B extends de{constructor(t,n){super(t,n),this.model.setOptions(Pt(Ct.stackedAreaChart,n.options)),this.init(t,n)}getComponents(){const t=[new fe(this.model,this.services),new Te(this.model,this.services),new yo(this.model,this.services),new zv(this.model,this.services),new ti(this.model,this.services,{stacked:!0}),new Yv(this.model,this.services,{fadeInOnChartHolderMouseover:!0,handleThresholds:!0,stacked:!0}),new oe(this.model,this.services,{skeleton:Ht.GRID})];return this.getAxisChartComponents(t)}}class SB extends de{constructor(t,n){super(t,n),this.model.setOptions(Pt(Ct.stackedBarChart,n.options)),this.init(t,n)}getComponents(){const t=[new fe(this.model,this.services),new Te(this.model,this.services),new yo(this.model,this.services),new Wv(this.model,this.services),new oe(this.model,this.services,{skeleton:Ht.VERT_OR_HORIZ}),new ei(this.model,this.services)];return this.getAxisChartComponents(t)}}class TB extends rn{constructor(t){super(t)}getTabularDataArray(){const t=this.getDisplayData(),n=this.getOptions(),{fontSizeMapsTo:r,wordMapsTo:i}=n.wordCloud,{groupMapsTo:s}=n.data,{code:a,number:o}=b(n,"locale"),l=[n.tooltip.wordLabel,"Group",n.tooltip.valueLabel],c=[...t.map(u=>[u[i],u[s],o(u[r],a)])];return super.formatTable({headers:l,cells:c})}}class OB extends qe{constructor(t,n){super(t,n),this.model=new TB(this.services),this.model.setOptions(Pt(Ct.wordCloudChart,n.options)),this.init(t,n)}getComponents(){const t=[new XU(this.model,this.services),new oe(this.model,this.services,{skeleton:Ht.PIE})];return this.getChartComponents(t)}}W.Alignments=Bt,W.AlluvialChart=KP,W.AreaChart=xN,W.AreaEvent=$c,W.ArrowDirections=Wa,W.AxisEvent=Nc,W.AxisFlavor=rs,W.AxisPositions=G,W.AxisTitleOrientations=Ya,W.BarEvent=Hc,W.BoxplotChart=TN,W.BoxplotEvent=Gc,W.BubbleChart=wN,W.BulletChart=CN,W.CalloutDirections=Ji,W.CanvasZoomEvent=Pc,W.CartesianOrientations=Wt,W.ChartEvent=Dc,W.ChartTheme=jc,W.ChartTypes=Ee,W.CirclePackChart=JU,W.ColorClassNameTypes=it,W.ColorLegendType=ns,W.ComboChart=tB,W.DividerStatus=Yr,W.DominantBaseline=en,W.DonutChart=nB,W.ExperimentalChoroplethChart=KU,W.GaugeChart=iB,W.GaugeEvent=Bc,W.GaugeTypes=sr,W.GroupedBarChart=sB,W.HeatmapChart=oB,W.HistogramChart=cB,W.LayoutAlignItems=ir,W.LayoutDirection=At,W.LayoutGrowth=ct,W.LegendItemType=Gt,W.LegendOrientations=Wr,W.LegendPositions=zr,W.LineChart=uB,W.LineEvent=zc,W.LollipopChart=hB,W.MeterChart=fB,W.ModalEvent=Lc,W.ModelEvent=Rc,W.PieChart=t0,W.PieEvent=Uc,W.Projection=nn,W.RadarChart=gB,W.RadarEvent=Wc,W.RenderTypes=tt,W.ScaleTypes=Q,W.ScatterChart=mB,W.ScatterEvent=Vc,W.SimpleBarChart=xB,W.Skeletons=Ht,W.StackedAreaChart=_B,W.StackedBarChart=SB,W.Statuses=ts,W.TextAnchor=tn,W.ThresholdEvent=Xc,W.TickRotations=es,W.ToolbarControlTypes=_t,W.TooltipEvent=Gr,W.TreeChart=yB,W.TreeEvent=Yc,W.TreeTypes=za,W.TreemapChart=bB,W.TreemapEvent=qc,W.TruncationTypes=Ce,W.WordCloudChart=OB,W.WordCloudEvent=Fc,W.ZoomBarTypes=Ge,W.ZoomDomainEvent=kc,W.ZoombarEvent=Ic,Object.defineProperty(W,Symbol.toStringTag,{value:"Module"})});
|
|
85
|
+
</svg>`}addEventListeners(){const t=this;this.parent.selectAll("circle.node").on("mouseover",function(n,r){const i=I(this);i.classed("hovered",!0);const s=t.model.getHierarchyLevel(),a=s>2&&!i.classed("focal"),o=b(t.model.getOptions(),"canvasZoom","enabled");let l=!1;if(!a){let c=[],u=[],d=null;if(r.children){r.depth>1&&o&&(l=!0,i.classed("clickable",!0)),c=r.children.map(p=>{if(p!==null)return typeof p.data.value=="number"?{label:p.data.name,value:p.data.value}:{label:p.data.name,labelIcon:o&&s<=2?t.getZoomIcon():null,value:p.value}});const f=t.model.getOptions();u=[{label:yt(f,"locale.translations.total")||yt(f,"tooltip.totalLabel")||"Total",value:r.value,bold:!0}],t.highlightChildren(r.children)}else d=r.value;const h=getComputedStyle(this,null).getPropertyValue("fill");t.services.events.dispatchEvent(T.Tooltip.SHOW,{event:n,hoveredElement:i,items:[{color:h,label:r.data.name,labelIcon:l&&o&&s<=2?t.getZoomIcon():null,value:d},...c,...u]})}t.services.events.dispatchEvent(T.CirclePack.CIRCLE_MOUSEOVER,{event:n,element:i,datum:r})}).on("mousemove",function(n,r){const i=I(this);t.services.events.dispatchEvent(T.CirclePack.CIRCLE_MOUSEMOVE,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(T.Tooltip.MOVE,{event:n})}).on("mouseout",function(n,r){const i=I(this);i.classed("hovered",!1),r.children&&t.unhighlightChildren(r.children),t.services.events.dispatchEvent(T.CirclePack.CIRCLE_MOUSEOUT,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(T.Tooltip.HIDE,{hoveredElement:i})}).on("click",function(n,r){const i=I(this),s=i.classed("non-focal"),a=b(t.model.getOptions(),"canvasZoom","enabled");if(a&&t.model.getHierarchyLevel()>2){const o=t.parent.selectAll("circle.node");I(t.services.domUtils.getMainContainer()).classed("zoomed-in",!1),t.focal=null,t.model.updateHierarchyLevel(2),t.services.canvasZoom.zoomOut(o,qr)}else if(r.depth===2&&r.children&&!s&&a){const o=t.parent.selectAll("circle.node");I(t.services.domUtils.getMainContainer()).classed("zoomed-in",!0),t.focal=r,t.model.updateHierarchyLevel(3),t.services.canvasZoom.zoomIn(r,o,qr),n.stopPropagation()}t.services.events.dispatchEvent(T.CirclePack.CIRCLE_CLICK,{event:n,element:i,datum:r})})}destroy(){this.parent.selectAll("circle.node").on("mouseover",null).on("mousemove",null).on("mouseout",null).on("click",null);const t=this.services.events;t.removeEventListener(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut),this.removeBackgroundListeners()}}function GN(e,t){const n=pi(this._current,e);return r=>(this._current=n(r),t(this._current))}class $v extends pt{constructor(){super(...arguments),this.type="pie",this.renderType=tt.SVG,this.isRendering=!1,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail,{groupMapsTo:r}=this.getOptions().data;this.parent.selectAll("path.slice").transition("legend-hover-bar").call(i=>this.services.transitions.setupTransition({transition:i,name:"legend-hover-bar"})).attr("opacity",i=>i.data[r]!==n.datum().name?.3:1)},this.handleLegendMouseOut=()=>{this.parent.selectAll("path.slice").transition("legend-mouseout-bar").call(t=>this.services.transitions.setupTransition({transition:t,name:"legend-mouseout-bar"})).attr("opacity",1)}}init(){const t=this.services.events;t.addEventListener(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}getInnerRadius(){return Lt.innerRadius}render(t=!0){const n=this,r=this.getComponentContainer(),i=this.getOptions(),{groupMapsTo:s}=i.data,{valueMapsTo:a}=i.pie;this.isRendering=!0;const o=this.model.getDisplayData().filter(M=>M[a]>0),l=this.computeRadius();this.arc=Ui().innerRadius(this.getInnerRadius()).outerRadius(l),this.hoverArc=Ui().innerRadius(this.getInnerRadius()).outerRadius(l+Lt.hoverArc.outerRadiusOffset);const u=gT().value(M=>M[a]).sort(b(i,"pie","sortFunction")).padAngle(Lt.padAngle)(o),h=R.appendOrSelect(r,"g.slices").attr("role",ut.GROUP).attr("data-name","slices").selectAll("path.slice").data(u,M=>M.data[s]);h.exit().attr("opacity",0).remove(),h.enter().append("path").classed("slice",!0).attr("opacity",0).merge(h).attr("class",M=>this.model.getColorClassName({classNameTypes:[it.FILL],dataGroupName:M.data[s],originalClassName:"slice"})).style("fill",M=>n.model.getFillColor(M.data[s],null,M.data)).attr("d",this.arc).transition().call(M=>this.services.transitions.setupTransition({transition:M,name:"pie_slice_enter_update",animate:t})).attr("opacity",1).attr("role",ut.GRAPHICS_SYMBOL).attr("aria-roledescription","slice").attr("aria-label",M=>`${M[a]}, ${Zc(M.data[a],o,a)+"%"}`).attrTween("d",function(M){return GN.bind(this)(M,n.arc)}).end().finally(()=>{n.isRendering=!1});const{code:g,number:m}=b(i,"locale"),v=i.pie.labels.enabled,E=v?u.filter(M=>M.data[a]>0):[],x=R.appendOrSelect(r,"g.labels").attr("role",ut.GROUP).attr("data-name","labels").selectAll("text.pie-label").data(E,M=>M.data[s]);x.exit().attr("opacity",0).remove();const S=x.enter().append("text").classed("pie-label",!0),_=[];S.merge(x).style("text-anchor","middle").text(M=>i.pie.labels.formatter?i.pie.labels.formatter({...M,percentageValue:Zc(M.data[a],o,a,!0)}):m(Zc(M.data[a],o,a),g)+"%").datum(function(M){const w=l+7,U=(M.endAngle-M.startAngle)/2+M.startAngle,F=U/Math.PI*180,$=this.getComputedTextLength();return M.textOffsetX=$/2,M.textOffsetY=F>90&&F<270?10:0,M.xPosition=(M.textOffsetX+w)*Math.sin(U),M.yPosition=(M.textOffsetY+w)*-Math.cos(U),M}).attr("transform",function(M,w){const U=E.length,F=(M.endAngle-M.startAngle)*(180/Math.PI);if(w>=U-2&&F<Lt.callout.minSliceDegree){let $,N;return M.index===U-1?($=M.xPosition+Lt.callout.offsetX+Lt.callout.textMargin+M.textOffsetX,N=M.yPosition-Lt.callout.offsetY,M.direction=Ji.RIGHT,_.push(M)):($=M.xPosition-Lt.callout.offsetX-M.textOffsetX-Lt.callout.textMargin,N=M.yPosition-Lt.callout.offsetY,M.direction=Ji.LEFT,_.push(M)),`translate(${$}, ${N})`}return`translate(${M.xPosition}, ${M.yPosition})`}),this.renderCallouts(_);const A=b(i,"donut")?"donut":"pie",L=b(i,A,"alignment"),{width:B}=R.getSVGElementSize(this.getParent(),{useAttrs:!0}),D=v?Lt.xOffset:0,O=v?Lt.yOffset:0;let H=l+D;L===Bt.CENTER?H=B/2:L===Bt.RIGHT&&(H=B-l-Lt.xOffset);let P=l+O;_.length>0&&(P+=Lt.yOffsetCallout),r.attr("x",H+7).attr("y",P),this.addEventListeners()}renderCallouts(t){const n=R.appendOrSelect(this.getComponentContainer(),"g.callouts").attr("role",ut.GROUP).attr("data-name","callouts"),r=n.selectAll("g.callout").data(t);r.exit().remove();const i=r.enter().append("g").classed("callout",!0).attr("role",ut.GROUP).attr("aria-roledescription","label callout");i.merge(r).datum(function(o){const{xPosition:l,yPosition:c,direction:u}=o;return u===Ji.RIGHT?(o.startPos={x:l,y:c+o.textOffsetY},o.endPos={x:l+Lt.callout.offsetX,y:c-Lt.callout.offsetY+o.textOffsetY},o.intersectPointX=o.endPos.x-Lt.callout.horizontalLineLength):(o.startPos={x:l,y:c+o.textOffsetY},o.endPos={x:l-Lt.callout.offsetX,y:c-Lt.callout.offsetY+o.textOffsetY},o.intersectPointX=o.endPos.x+Lt.callout.horizontalLineLength),o}),i.append("line").classed("vertical-line",!0).merge(n.selectAll("line.vertical-line")).datum(function(){return I(this.parentNode).datum()}).style("stroke-width","1px").attr("x1",o=>o.startPos.x).attr("y1",o=>o.startPos.y).attr("x2",o=>o.intersectPointX).attr("y2",o=>o.endPos.y),i.append("line").classed("horizontal-line",!0).merge(n.selectAll("line.horizontal-line")).datum(function(){return I(this.parentNode).datum()}).style("stroke-width","1px").attr("x1",o=>o.intersectPointX).attr("y1",o=>o.endPos.y).attr("x2",o=>o.endPos.x).attr("y2",o=>o.endPos.y)}addEventListeners(){const t=this;this.parent.selectAll("path.slice").on("mouseover",function(n,r){const i=I(this);t.isRendering||i.classed("hovered",!0).transition("pie_slice_mouseover").call(o=>t.services.transitions.setupTransition({transition:o,name:"pie_slice_mouseover"})).attr("d",t.hoverArc),t.services.events.dispatchEvent(T.Pie.SLICE_MOUSEOVER,{event:n,element:I(this),datum:r});const{groupMapsTo:s}=t.getOptions().data,{valueMapsTo:a}=t.getOptions().pie;t.services.events.dispatchEvent(T.Tooltip.SHOW,{event:n,hoveredElement:i,items:[{label:r.data[s],value:r.data[a]}]})}).on("mousemove",function(n,r){const i=I(this);t.services.events.dispatchEvent(T.Pie.SLICE_MOUSEMOVE,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(T.Tooltip.MOVE,{event:n})}).on("click",function(n,r){t.services.events.dispatchEvent(T.Pie.SLICE_CLICK,{event:n,element:I(this),datum:r})}).on("mouseout",function(n,r){const i=I(this);jL(()=>{t.isRendering||i.classed("hovered",!1).transition("pie_slice_mouseout").call(s=>t.services.transitions.setupTransition({transition:s,name:"pie_slice_mouseout"})).attr("d",t.arc)},100),t.services.events.dispatchEvent(T.Pie.SLICE_MOUSEOUT,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(T.Tooltip.HIDE,{hoveredElement:i})})}computeRadius(){const{width:t,height:n}=R.getSVGElementSize(this.parent,{useAttrs:!0}),r=this.getOptions(),i=Math.min(t,n)/2;return r.pie.labels.enabled?i+Lt.radiusOffset:i}}class VN extends $v{constructor(){super(...arguments),this.type="donut",this.renderType=tt.SVG}render(t=!0){super.render(t);const n=this;if(this.model.isDataEmpty()){this.getComponentContainer().select("g.center").remove();return}const r=R.appendOrSelect(this.getComponentContainer(),"g.center"),i=this.getOptions(),s=this.computeRadius(),a=b(i,"donut","center","label");R.appendOrSelect(r,"text.donut-figure").attr("text-anchor","middle").style("dominant-baseline",()=>a===null||a===""?"central":"initial").style("font-size",()=>i.donut.center.numberFontSize(s)).transition().call(o=>this.services.transitions.setupTransition({transition:o,name:"donut-figure-enter-update",animate:t})).tween("text",function(){return n.centerNumberTween(I(this))}),a!==null&&a!==""&&R.appendOrSelect(r,"text.donut-title").attr("text-anchor","middle").style("font-size",()=>i.donut.center.titleFontSize(s)).attr("y",i.donut.center.titleYPosition(s)).text(a)}getInnerRadius(){return this.computeRadius()*(3/4)}centerNumberTween(t){const n=this.getOptions();let r=b(n,"donut","center","number");r===null&&(r=this.model.getDisplayData().reduce((o,l)=>o+l[n.pie.valueMapsTo],0));const i=parseInt(t.text().replace(/[, ]+/g,""),10)||0;let s;i%1===0&&r%1===0?s=Ih:s=ve;const a=s(i,r);return o=>{const{numberFormatter:l}=n.donut.center;if(l)t.text(l(a(o)));else{const{code:c,number:u}=b(n,"locale");t.text(u(Math.floor(a(o)),c))}}}}const Fv="4,10 8,6 12,10",Uv="12,6 8,10 4,6";class zN extends pt{constructor(){super(...arguments),this.type="gauge",this.renderType=tt.SVG}getValue(){var r;return((r=this.model.getData().find(i=>i.group==="value"))==null?void 0:r.value)??null}getValueRatio(){return lg(this.getValue(),0,100)/100}getDelta(){var r;return((r=this.model.getData().find(i=>i.group==="delta"))==null?void 0:r.value)??null}getArcRatio(){const t=this.getOptions();return b(t,"gauge","type")===sr.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(b(n,"gauge","deltaArrow","direction")){case Wa.UP:return Fv;case Wa.DOWN:return Uv;default:return t>0?Fv:Uv}}render(t=!0){const n=this.getComponentContainer().attr("width","100%").attr("height","100%"),r=this.getOptions(),i=this.getValue(),s=this.getValueRatio(),a=this.getArcSize(),o=this.getStartAngle(),l=s*a,c=o+l,u=o+a,d=this.computeRadius(),h=this.getInnerRadius();this.backgroundArc=Ui().innerRadius(h).outerRadius(d).startAngle(c).endAngle(u),this.arc=Ui().innerRadius(h).outerRadius(d).startAngle(o).endAngle(c),R.appendOrSelect(n,"path.arc-background").attr("d",this.backgroundArc);const f=n.selectAll("path.arc-foreground").data([i]);f.enter().append("path").merge(f).attr("class",this.model.getColorClassName({classNameTypes:[it.FILL],dataGroupName:"value",originalClassName:"arc-foreground"})).style("fill",()=>b(this.getOptions(),"color","scale","value")).attr("d",this.arc).attr("role",ut.GRAPHICS_SYMBOL).attr("aria-roledescription","value").attr("aria-label",E=>E),this.drawValueNumber(),this.drawDelta(),f.exit().remove();const g=b(r,"gauge","alignment"),{width:m}=R.getSVGElementSize(this.getParent(),{useAttrs:!0});let v=d;g===Bt.CENTER?v=m/2:g===Bt.RIGHT&&(v=m-d),n.attr("x",v).attr("y",d),this.addEventListeners()}drawValueNumber(){const t=this.getComponentContainer(),n=this.getOptions(),r=b(n,"gauge","type"),i=this.getValue(),s=this.getDelta(),a=this.computeRadius(),o=b(n,"gauge","valueFontSize"),l=b(n,"gauge","deltaFontSize"),c=b(n,"gauge","numberSpacing"),u=b(n,"gauge","showPercentageSymbol");let d=0;r===sr.FULL&&!s?d=l(a):r===sr.SEMI&&s&&(d=-(l(a)+c));const h=R.appendOrSelect(t,"g.gauge-numbers").attr("transform",`translate(0, ${d})`),f=o(a),p=R.appendOrSelect(h,"g.gauge-value-number"),{code:g,number:m}=b(n,"locale"),v=b(n,"gauge","numberFormatter"),E=p.selectAll("text.gauge-value-number").data([i]);E.enter().append("text").attr("class","gauge-value-number").merge(E).style("font-size",`${f}px`).attr("text-anchor","middle").text(B=>{let D;return B!=null?D=Number(B.toFixed(2))%1!==0?B.toFixed(2):B.toFixed():D=0,v?v(D):m(Number(D),g)});const{width:y}=R.getSVGElementSize(R.appendOrSelect(t,"text.gauge-value-number"),{useBBox:!0}),x=f/2,S=u?"%":"",_=R.appendOrSelect(p,"text.gauge-value-symbol").style("font-size",`${x}px`).attr("x",y/2).text(S),{width:A,height:L}=R.getSVGElementSize(_,{useBBox:!0});_.attr("y",`-${L/2}px`),p.attr("transform",`translate(-${A/2}, 0)`)}drawDelta(){const t=this,n=this.getComponentContainer(),r=this.getOptions(),i=this.getDelta(),{code:s,number:a}=b(r,"locale");if(i){const o=this.computeRadius(),l=i?b(r,"gauge","deltaFontSize"):()=>0,c=i?b(r,"gauge","numberFormatter"):()=>null,u=b(r,"gauge","deltaArrow","size"),d=b(r,"gauge","numberSpacing"),h=b(r,"gauge","showPercentageSymbol"),f=R.appendOrSelect(n,"g.gauge-numbers"),p=R.appendOrSelect(f,"g.gauge-delta").attr("transform",`translate(0, ${l(o)+d})`),g=R.appendOrSelect(p,"text.gauge-delta-number"),m=h?"%":"";g.data(i===null?[]:[i]),g.enter().append("text").classed("gauge-delta-number",!0).merge(g).attr("text-anchor","middle").style("font-size",`${l(o)}px`).text(x=>{let S;return x!=null?S=Number(x.toFixed(2))%1!==0?x.toFixed(2):x.toFixed():S=0,c?`${c(S)}${m}`:`${a(Number(S),s)}${m}`});const{width:v}=R.getSVGElementSize(R.appendOrSelect(n,".gauge-delta-number"),{useBBox:!0}),E=b(r,"gauge","deltaArrow","enabled"),y=p.selectAll("svg.gauge-delta-arrow").data(i!==null&&E?[i]:[]);y.enter().append("svg").merge(y).attr("class","gauge-delta-arrow").attr("x",-u(o)-v/2).attr("y",-u(o)/2-l(o)*.35).attr("width",u(o)).attr("height",u(o)).attr("viewBox","0 0 16 16").each(function(){const x=I(this);R.appendOrSelect(x,"rect.gauge-delta-arrow-backdrop").attr("width","16").attr("height","16").attr("fill","none");const S=b(r,"gauge","status");R.appendOrSelect(x,"polygon.gauge-delta-arrow").attr("class",S!==null?`gauge-delta-arrow status--${S}`:"").attr("points",t.getArrow(i))}),y.exit().remove(),g.exit().remove()}else{const o=n.select("g.gauge-delta");o.empty()||o.remove()}}getInnerRadius(){const t=this.computeRadius(),n=b(this.getOptions(),"gauge","arcWidth");return t-n}addEventListeners(){const t=this;this.parent.selectAll("path.arc-foreground").on("mouseover",function(n,r){t.services.events.dispatchEvent(T.Gauge.ARC_MOUSEOVER,{event:n,element:I(this),datum:r})}).on("mousemove",function(n,r){const i=I(this);t.services.events.dispatchEvent(T.Gauge.ARC_MOUSEMOVE,{event:n,element:i,datum:r})}).on("click",function(n,r){t.services.events.dispatchEvent(T.Gauge.ARC_CLICK,{event:n,element:I(this),datum:r})}).on("mouseout",function(n,r){const i=I(this);t.services.events.dispatchEvent(T.Gauge.ARC_MOUSEOUT,{event:n,element:i,datum:r})})}computeRadius(){const t=this.getOptions(),n=b(t,"gauge","type"),{width:r,height:i}=R.getSVGElementSize(this.parent,{useAttrs:!0});return n===sr.SEMI?Math.min(r/2,i):Math.min(r/2,i/2)}}class Bv extends qu{constructor(){super(...arguments),this.type="grouped-bar",this.renderType=tt.SVG,this.padding=5,this.defaultStepFactor=70,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail,{groupMapsTo:r}=this.getOptions().data;this.parent.selectAll("path.bar").transition("legend-hover-bar").call(i=>this.services.transitions.setupTransition({transition:i,name:"legend-hover-bar"})).attr("opacity",i=>i[r]!==n.datum().name?.3:1)},this.handleLegendMouseOut=()=>{this.parent.selectAll("path.bar").transition("legend-mouseout-bar").call(t=>this.services.transitions.setupTransition({transition:t,name:"legend-mouseout-bar"})).attr("opacity",1)}}init(){const t=this.services.events;t.addEventListener(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t){const n=this.model.getDisplayData(this.configs.groups),r=this.getOptions(),{groupMapsTo:i}=r.data;this.setGroupScale();const s=this.getComponentContainer({withinChartClip:!0}),a=Qi(n.map(h=>{const f=this.services.cartesianScales.getDomainIdentifier(h);return h[f]&&typeof h[f].toString=="function"?h[f].toString():h[f]})),o=s.selectAll("g.bars").data(a,h=>h);o.exit().attr("opacity",0).remove();const c=o.enter().append("g").classed("bars",!0).attr("role",ut.GROUP).attr("data-name","bars").merge(o);c.transition().call(h=>this.services.transitions.setupTransition({transition:h,name:"bar-group-update-enter",animate:t})).attr("transform",h=>{const p=this.services.cartesianScales.getDomainValue(h)-this.getGroupWidth()/2;return this.services.cartesianScales.getOrientation()===Wt.VERTICAL?`translate(${p}, 0)`:`translate(0, ${p})`});const u=c.selectAll("path.bar").data(h=>this.getDataCorrespondingToLabel(h),h=>h[i]);u.exit().attr("opacity",0).remove(),u.enter().append("path").attr("opacity",0).merge(u).classed("bar",!0).transition().call(h=>this.services.transitions.setupTransition({transition:h,name:"bar-update-enter",animate:t})).attr("class",h=>this.model.getColorClassName({classNameTypes:[it.FILL],dataGroupName:h[i],originalClassName:"bar"})).style("fill",h=>{const f=this.services.cartesianScales.getDomainIdentifier(h);return this.model.getFillColor(h[i],h[f],h)}).attr("d",h=>{const f=this.groupScale(h[i]),p=this.getBarWidth(),g=f,m=f+p,v=this.services.cartesianScales.getRangeAxisPosition({datum:h}),E=this.services.cartesianScales.getValueThroughAxisPosition(v,0),y=this.services.cartesianScales.getRangeValue(h),x=this.services.cartesianScales.getDomainValue(h)-p/2,S=x+p;if(!this.isOutsideZoomedDomain(x,S))return ie({x0:g,x1:m,y0:E,y1:y},this.services.cartesianScales.getOrientation())}).attr("opacity",1).attr("role",ut.GRAPHICS_SYMBOL).attr("aria-roledescription","bar").attr("aria-label",h=>h.value),this.addEventListeners()}addEventListeners(){const t=this;this.parent.selectAll("path.bar").on("mouseover",function(n,r){const i=I(this);i.classed("hovered",!0),t.services.events.dispatchEvent(T.Bar.BAR_MOUSEOVER,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(T.Tooltip.SHOW,{event:n,hoveredElement:i,data:[r]})}).on("mousemove",function(n,r){const i=I(this);t.services.events.dispatchEvent(T.Bar.BAR_MOUSEMOVE,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(T.Tooltip.MOVE,{event:n})}).on("click",function(n,r){t.services.events.dispatchEvent(T.Bar.BAR_CLICK,{event:n,element:I(this),datum:r})}).on("mouseout",function(n,r){const i=I(this);i.classed("hovered",!1),t.services.events.dispatchEvent(T.Bar.BAR_MOUSEOUT,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(T.Tooltip.HIDE,{hoveredElement:i})})}destroy(){this.parent.selectAll("path.bar").on("mouseover",null).on("mousemove",null).on("mouseout",null);const t=this.services.events;t.removeEventListener(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}getDataCorrespondingToLabel(t){return this.model.getDisplayData(this.configs.groups).filter(r=>{const i=this.services.cartesianScales.getDomainIdentifier(r);return r[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 r=this.defaultStepFactor;if(typeof t.step=="function")r=t.step();else if(n.length>0){const i=n.find(s=>{var a;return((a=s.data)==null?void 0:a.length)>1});if(i){const s=this.services.cartesianScales.getDomainIdentifier(i.data[0]);r=Math.abs(t(i.data[1][s])-t(i.data[0][s]))}}return r}getTotalGroupPadding(){const t=this.model.getGroupedData(this.configs.groups);return t.length===1?0:Math.min(5,5*(this.getDomainScaleStep()/this.defaultStepFactor))*(t.length-1)}getBarWidth(){const t=this.getOptions(),n=b(t,"bars","width"),r=b(t,"bars","maxWidth");if(n!==null&&(r===null||n<=r))return n;const s=this.model.getGroupedData(this.configs.groups).length,a=this.getTotalGroupPadding();return Math.min(r,(this.getDomainScaleStep()-a)/s)}setGroupScale(){const t=this.model.getActiveDataGroupNames(this.configs.groups);this.groupScale=Ii().domain(t).rangeRound([0,this.getGroupWidth()])}}class WN extends pt{constructor(){super(...arguments),this.type="heatmap",this.renderType=tt.SVG,this.matrix={},this.xBandwidth=0,this.yBandwidth=0,this.translationUnits={x:0,y:0},this.handleAxisOnHover=t=>{const{detail:n}=t,{datum:r}=n,i=this.model.getUniqueRanges(),s=this.model.getUniqueDomain(),a=this.services.cartesianScales.getDomainLabel(),o=this.services.cartesianScales.getRangeLabel(),l=this.services.cartesianScales.getMainXScale(),c=this.services.cartesianScales.getMainYScale();let u="",d=null,h=null,f=null;this.matrix[r]!==void 0?(u=a,i.forEach(p=>{if(typeof this.matrix[r][p].value=="number"){const g=this.matrix[r][p].value;if(d===null){d=g,h=g,f=g;return}d+=g,h=g<h?g:h,f=g>f?g:f}})):(u=o,s.forEach(p=>{if(typeof this.matrix[p][r].value=="number"){const g=this.matrix[p][r].value;if(d===null){d=g,h=g,f=g;return}d+=g,h=g<h?g:h,f=g>f?g:f}})),l(r)!==void 0?this.parent.select("g.multi-cell.column-highlight").classed("highlighter-hidden",!1).attr("transform",`translate(${l(r)}, ${An(c.range())})`):c(r)!==void 0&&this.parent.select("g.multi-cell.row-highlight").classed("highlighter-hidden",!1).attr("transform",`translate(${An(l.range())},${c(r)})`),this.services.events.dispatchEvent(T.Tooltip.SHOW,{event:n.event,hoveredElement:I(t.detail.element),items:[{label:u,value:r,bold:!0},{label:"Min",value:h!==null?h:"-"},{label:"Max",value:f!==null?f:"-"},{label:"Average",value:d!==null?d/s.length:"-"}]})},this.handleAxisMouseOut=t=>{this.parent.selectAll("g.multi-cell").classed("highlighter-hidden",!0),this.services.events.dispatchEvent(T.Tooltip.HIDE,{event:t})}}init(){const t=this.services.events;t.addEventListener(T.Axis.LABEL_MOUSEOVER,this.handleAxisOnHover),t.addEventListener(T.Axis.LABEL_MOUSEOUT,this.handleAxisMouseOut),t.addEventListener(T.Axis.LABEL_FOCUS,this.handleAxisOnHover),t.addEventListener(T.Axis.LABEL_BLUR,this.handleAxisMouseOut)}render(t=!0){const n=this.getComponentContainer({withinChartClip:!0});n.lower();const{cartesianScales:r}=this.services;if(this.matrix=this.model.getMatrix(),n.html(""),b(this.getOptions(),"data","loading"))return;const i=r.getMainXScale(),s=r.getMainYScale(),a=r.getDomainIdentifier(),o=r.getRangeIdentifier(),l=this.model.getUniqueDomain(),c=this.model.getUniqueRanges(),u=this.model.getMatrixAsArray(),d=i.range(),h=s.range();this.xBandwidth=Math.abs((d[1]-d[0])/l.length),this.yBandwidth=Math.abs((h[1]-h[0])/c.length);const f=this.services.domUtils.generateElementIDString("heatmap-pattern-stripes");n.append("defs").append("pattern").attr("id",f).attr("width",3).attr("height",3).attr("patternUnits","userSpaceOnUse").attr("patternTransform","rotate(45)").append("rect").classed("pattern-fill",!0).attr("width",.5).attr("height",8);const p=n.selectAll().data(u).enter().append("g").attr("class",g=>`heat-${g.index}`).classed("cell",!0).attr("transform",g=>`translate(${i(g[a])}, ${s(g[o])})`).append("rect").attr("class",g=>this.model.getColorClassName({value:g.value,originalClassName:`heat-${g.index}`})).classed("heat",!0).classed("null-state",g=>g.index===-1||g.value===null).attr("width",this.xBandwidth).attr("height",this.yBandwidth).style("fill",g=>{const m=this.services.cartesianScales.getDomainIdentifier(g);return g.index===-1||g.value===null?`url(#${f})`:this.model.getFillColor(Number(g.value),g[m],g)}).attr("aria-label",g=>g.value);this.createOuterBox("g.cell-highlight",this.xBandwidth,this.yBandwidth),this.createOuterBox("g.multi-cell.column-highlight",this.xBandwidth,Math.abs(h[1]-h[0])),this.createOuterBox("g.multi-cell.row-highlight",Math.abs(d[1]-d[0]),this.yBandwidth),this.determineDividerStatus()&&(p.style("stroke-width","1px"),this.parent.select("g.cell-highlight").classed("cell-2",!0)),this.addEventListener()}createOuterBox(t,n,r){const i=R.appendOrSelect(this.parent,t).classed("shadows",!0).classed("highlighter-hidden",!0);R.appendOrSelect(i,"line.top").attr("x1",-1).attr("x2",n+1),R.appendOrSelect(i,"line.left").attr("x1",0).attr("y1",-1).attr("x2",0).attr("y2",r+1),R.appendOrSelect(i,"line.down").attr("x1",-1).attr("x2",n+1).attr("y1",r).attr("y2",r),R.appendOrSelect(i,"line.right").attr("x1",n).attr("x2",n).attr("y1",-1).attr("y2",r+1)}determineDividerStatus(){const t=b(this.getOptions(),"heatmap","divider","state");return t!==Yr.OFF&&(t===Yr.AUTO&&Qg.minCellDividerDimension<=this.xBandwidth&&Qg.minCellDividerDimension<=this.yBandwidth||t===Yr.ON)}addEventListener(){const t=this,{cartesianScales:n}=this.services,r=this.getOptions(),i=yt(r,"locale.translations.total")||yt(r,"tooltip.totalLabel")||"Total",s=n.getDomainIdentifier(),a=n.getRangeIdentifier(),o=n.getDomainLabel(),l=n.getRangeLabel();this.parent.selectAll("g.cell").on("mouseover",function(c,u){const d=I(this),h=d.select("rect.heat");if(!h.classed("null-state")){const p=is(d.attr("transform"));t.parent.select("g.cell-highlight").attr("transform",`translate(${p.x+t.translationUnits.x}, ${p.y+t.translationUnits.y})`).classed("highlighter-hidden",!1),t.services.events.dispatchEvent(T.Heatmap.HEATMAP_MOUSEOVER,{event:c,element:h,datum:u}),t.services.events.dispatchEvent(T.Tooltip.SHOW,{event:c,items:[{label:o,value:u[s]},{label:l,value:u[a]},{label:i,value:u.value,color:h.style("fill")}]})}}).on("mousemove",function(c,u){t.services.events.dispatchEvent(T.Heatmap.HEATMAP_MOUSEMOVE,{event:c,element:I(this),datum:u}),t.services.events.dispatchEvent(T.Tooltip.MOVE,{event:c})}).on("click",function(c,u){t.services.events.dispatchEvent(T.Heatmap.HEATMAP_CLICK,{event:c,element:I(this),datum:u})}).on("mouseout",function(c,u){const h=I(this).select("rect.heat"),f=h.classed("null-state");t.parent.select("g.cell-highlight").classed("highlighter-hidden",!0),f||(t.services.events.dispatchEvent(T.Heatmap.HEATMAP_MOUSEOUT,{event:c,element:h,datum:u}),t.services.events.dispatchEvent(T.Tooltip.HIDE,{event:c,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(T.Legend.ITEM_HOVER,this.handleAxisOnHover),t.removeEventListener(T.Legend.ITEM_MOUSEOUT,this.handleAxisMouseOut)}}class YN extends pt{constructor(){super(...arguments),this.type="histogram",this.renderType=tt.SVG,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail,r=this.getOptions(),{groupMapsTo:i}=r.data;this.parent.selectAll("path.bar").transition("legend-hover-bar").call(s=>this.services.transitions.setupTransition({transition:s,name:"legend-hover-bar"})).attr("opacity",s=>s[i]!==n.datum().name?.3:1)},this.handleLegendMouseOut=()=>{this.parent.selectAll("path.bar").transition("legend-mouseout-bar").call(t=>this.services.transitions.setupTransition({transition:t,name:"legend-mouseout-bar"})).attr("opacity",1)}}init(){const t=this.services.events;t.addEventListener(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t){const n=this.getComponentContainer(),r=this.model.getOptions(),{groupIdentifier:i}=r,{groupMapsTo:s}=r.data,a=this.model.getBinnedStackedData(),o=this.services.cartesianScales.getMainXScale(),l=n.selectAll("g.bars").data(a,u=>yt(u,`0.${s}`));l.exit().attr("opacity",0).remove(),l.enter().append("g").classed("bars",!0).attr("role",ut.GROUP);const c=n.selectAll("g.bars").selectAll("path.bar").data(u=>u);c.exit().remove(),c.enter().append("path").merge(c).classed("bar",!0).attr(i,(u,d)=>d).transition().call(u=>this.services.transitions.setupTransition({transition:u,name:"histogram-bar-update-enter",animate:t})).attr("class",u=>this.model.getColorClassName({classNameTypes:[it.FILL],dataGroupName:u[s],originalClassName:"bar"})).style("fill",u=>this.model.getFillColor(u[s],null,u)).attr("d",u=>{const d=yt(u,"data");if(!d)return;const h=o(d.x1)-o(d.x0)-1,f=this.services.cartesianScales.getDomainValue(d.x0),p=f+h,g=this.services.cartesianScales.getRangeValue(u[0]);let m=this.services.cartesianScales.getRangeValue(u[1]);return Math.abs(m-g)>0&&Math.abs(m-g)>r.bars.dividerSize&&(this.services.cartesianScales.getOrientation()===Wt.VERTICAL?m+=1:m-=1),ie({x0:f,x1:p,y0:g,y1:m},this.services.cartesianScales.getOrientation())}).attr("opacity",1).attr("role",ut.GRAPHICS_SYMBOL).attr("aria-roledescription","bar").attr("aria-label",u=>b(u,"data",u[s])),this.addEventListeners()}addEventListeners(){const t=this.model.getOptions(),{groupMapsTo:n}=t.data,{code:r,number:i}=b(t,"locale"),s=this;this.parent.selectAll("path.bar").on("mouseover",function(a,o){const l=I(this);l.classed("hovered",!0);const c=i(parseFloat(yt(o,"data.x0")),r),u=i(parseFloat(yt(o,"data.x1")),r),d=s.services.cartesianScales.getRangeAxisPosition(),h=s.services.cartesianScales.getScaleLabel(d);s.services.events.dispatchEvent(T.Tooltip.SHOW,{event:a,hoveredElement:l,items:[{label:yt(t,"bins.rangeLabel")||"Range",value:`${c} – ${u}`},{label:t.tooltip.groupLabel||"Group",value:o[n],class:s.model.getColorClassName({classNameTypes:[it.TOOLTIP],dataGroupName:o[n]})},{label:h,value:yt(o,`data.${o[n]}`)}]})}).on("mousemove",function(a){s.services.events.dispatchEvent(T.Tooltip.MOVE,{event:a})}).on("mouseout",function(){I(this).classed("hovered",!1),s.services.events.dispatchEvent(T.Tooltip.HIDE)})}destroy(){this.parent.selectAll("path.bar").on("mouseover",null).on("mousemove",null).on("mouseout",null);const t=this.services.events;t.removeEventListener(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}}class qN extends an{constructor(){super(...arguments),this.type="lollipop",this.renderType=tt.SVG,this.handleScatterOnHover=t=>{const n=t.detail,r=this.getOptions(),{groupMapsTo:i}=r.data;this.parent.selectAll("line.line").attr("stroke-width",s=>s[i]!==n.datum[i]?bn.weight.unselected:bn.weight.selected)},this.handleScatterOnMouseOut=()=>{this.parent.selectAll("line.line").attr("stroke-width",bn.weight.unselected)},this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail,r=this.getOptions(),{groupMapsTo:i}=r.data;this.parent.selectAll("line.line").transition("legend-hover-line").call(s=>this.services.transitions.setupTransition({transition:s,name:"legend-hover-line"})).attr("opacity",s=>s[i]!==n.datum().name?bn.opacity.unselected:bn.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",bn.opacity.selected)}}init(){const{events:t}=this.services;t.addEventListener(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t){const n=this.getComponentContainer({withinChartClip:!0}),r=this.model.getOptions(),{groupMapsTo:i}=r.data,{cartesianScales:s}=this.services,a=s.getMainXScale(),o=s.getMainYScale(),l=s.getDomainIdentifier(),c=v=>s.getDomainValue(v),u=v=>s.getRangeValue(v),d=s.getOrientation(),[h,f]=_n(c,u,d),p=n.selectAll("line.line").data(this.getScatterData(),v=>`${v[i]}-${v[l]}`);p.exit().attr("opacity",0).remove();const m=p.enter().append("line").attr("opacity",0).merge(p).classed("line",!0).attr("class",v=>this.model.getColorClassName({classNameTypes:[it.STROKE],dataGroupName:v[i],originalClassName:"line"})).transition().call(v=>this.services.transitions.setupTransition({transition:v,name:"lollipop-line-update-enter",animate:t})).style("stroke",v=>this.model.getFillColor(v[i],v[l],v)).attr("opacity",1);d===Wt.HORIZONTAL?m.attr("y1",f).attr("y2",f).attr("x1",a.range()[0]).attr("x2",v=>h(v)-r.points.radius):m.attr("x1",h).attr("x2",h).attr("y1",o.range()[0]).attr("y2",v=>f(v)+r.points.radius),this.addScatterPointEventListeners()}addScatterPointEventListeners(){this.services.events.addEventListener(T.Scatter.SCATTER_MOUSEOVER,this.handleScatterOnHover),this.services.events.addEventListener(T.Scatter.SCATTER_MOUSEOUT,this.handleScatterOnMouseOut)}destroy(){const t=this.services.events;t.removeEventListener(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut),t.removeEventListener(T.Scatter.SCATTER_MOUSEOVER,this.handleScatterOnHover),t.removeEventListener(T.Scatter.SCATTER_MOUSEOUT,this.handleScatterOnMouseOut)}}class XN extends pt{constructor(){super(...arguments),this.type="meter",this.renderType=tt.SVG}getStackedBounds(t,n){let r=0;return t.map((s,a)=>a!==0?(r+=n(s.value),{...s,width:Math.abs(n(s.value)-jt.dividerWidth),x:r-n(s.value)}):(r=n(s.value),{...s,width:Math.abs(n(s.value)-jt.dividerWidth),x:0}))}render(t=!0){const n=this,r=this.getComponentContainer(),i=this.getOptions(),s=b(i,"meter","proportional"),a=this.model.getDisplayData(),o=this.model.getStatus(),{width:l}=R.getSVGElementSize(r,{useAttrs:!0}),{groupMapsTo:c}=i.data;let u;if(b(i,"meter","proportional")===null)u=100;else{const y=b(i,"meter","proportional","total");u=y||this.model.getMaximumDomain(this.model.getDisplayData())}const d=Fe().domain([0,u]).range([0,l]),h=this.getStackedBounds(a,d),f=b(i,"meter","height");R.appendOrSelect(r,"rect.container").attr("x",0).attr("y",0).attr("width",l).attr("height",f||(s?jt.height.proportional:jt.height.default)),R.appendOrSelect(r,"line.rangeIndicator").attr("x1",l).attr("x2",l).attr("y1",0).attr("y2",f||(s?jt.height.proportional:jt.height.default));const p=r.selectAll("rect.value").data(h),g=o!=null&&!n.model.isUserProvidedColorScaleValid()&&!s?`value status--${o}`:"value";p.enter().append("rect").classed("value",!0).merge(p).attr("x",y=>y.x).attr("y",0).attr("height",()=>f||(s?jt.height.proportional:jt.height.default)).attr("class",y=>this.model.getColorClassName({classNameTypes:[it.FILL],dataGroupName:y[c],originalClassName:g})).transition().call(y=>this.services.transitions.setupTransition({transition:y,name:"meter-bar-update",animate:t})).attr("width",y=>y.value>u?d(u):y.width).style("fill",y=>n.model.getFillColor(y[c],null,y)).attr("role",ut.GRAPHICS_SYMBOL).attr("aria-roledescription","value").attr("aria-label",y=>y.value),p.exit().remove();const m=b(i,"meter","peak");let v=m;m!==null&&(m>u?v=u:m<a[0].value&&(v=a[0].value>u?u:a[0].value));const E=r.selectAll("line.peak").data(v==null?[]:[v]);E.enter().append("line").classed("peak",!0).merge(E).attr("y1",0).attr("y2",()=>f||(s?jt.height.proportional:jt.height.default)).transition().call(y=>this.services.transitions.setupTransition({transition:y,name:"peak-line-update",animate:t})).attr("x1",y=>d(y)).attr("x2",y=>d(y)).attr("role",ut.GRAPHICS_SYMBOL).attr("aria-roledescription","peak").attr("aria-label",y=>y),E.exit().remove(),this.services.domUtils.setSVGMaxHeight(),this.addEventListeners()}addEventListeners(){const t=this.getOptions(),{groupMapsTo:n}=t.data,r=this,i=b(t,"meter","proportional");this.parent.selectAll("rect.value").on("mouseover",function(s,a){const o=I(this);r.services.events.dispatchEvent(T.Meter.METER_MOUSEOVER,{event:s,element:o,datum:a}),i&&(o.classed("hovered",!0),r.services.events.dispatchEvent(T.Tooltip.SHOW,{event:s,hoveredElement:o,items:[{label:a[n],value:a.value}]}))}).on("mousemove",function(s,a){const o=I(this);r.services.events.dispatchEvent(T.Meter.METER_MOUSEMOVE,{event:s,element:o,datum:a}),i&&r.services.events.dispatchEvent(T.Tooltip.MOVE,{event:s})}).on("click",function(s,a){r.services.events.dispatchEvent(T.Meter.METER_CLICK,{event:s,element:I(this),datum:a})}).on("mouseout",function(s,a){const o=I(this);r.services.events.dispatchEvent(T.Meter.METER_MOUSEOUT,{event:s,element:o,datum:a}),i&&(o.classed("hovered",!1),r.services.events.dispatchEvent(T.Tooltip.HIDE,{hoveredElement:o}))})}destroy(){this.parent.selectAll("rect.value").on("mouseover",null).on("mousemove",null).on("mouseout",null).on("click",null)}}function Hv(e){const t=jN(Gv(e),360);return Nn(t,[0,10])||Nn(t,[350,0])?{textAnchor:tn.START,dominantBaseline:en.MIDDLE}:Nn(t,[10,80])?{textAnchor:tn.START,dominantBaseline:en.HANGING}:Nn(t,[80,100])?{textAnchor:tn.MIDDLE,dominantBaseline:en.HANGING}:Nn(t,[100,170])?{textAnchor:tn.END,dominantBaseline:en.HANGING}:Nn(t,[170,190])?{textAnchor:tn.END,dominantBaseline:en.MIDDLE}:Nn(t,[190,260])?{textAnchor:tn.END,dominantBaseline:en.BASELINE}:Nn(t,[260,280])?{textAnchor:tn.MIDDLE,dominantBaseline:en.BASELINE}:{textAnchor:tn.START,dominantBaseline:en.BASELINE}}function jN(e,t){return(e%t+t)%t}function Nn(e,[t,n]){return e>=t&&e<=n}function Gv(e){return e*(180/Math.PI)}function Ft(e,t,n={x:0,y:0}){const r=t*Math.cos(e)+n.x,i=t*Math.sin(e)+n.y;return{x:isNaN(r)?0:r,y:isNaN(i)?0:i}}function ZN(e,t){return t*Math.sin(e-Math.PI/2)}class KN extends pt{constructor(){super(...arguments),this.type="radar",this.renderType=tt.SVG,this.getLabelDimensions=t=>{const n=R.appendOrSelect(this.getComponentContainer(),"g.tmp-tick"),r=R.appendOrSelect(n,"text").text(t),{width:i,height:s}=R.getSVGElementSize(r.node(),{useBBox:!0});return n.remove(),{width:i,height:s}},this.normalizeFlatData=t=>{const n=this.getOptions(),{angle:r,value:i}=b(n,"radar","axes"),s=b(n,"data","groupMapsTo"),a=eR(this.uniqueKeys.map(o=>this.uniqueGroups.map(l=>({[r]:o,[s]:l,[i]:null}))));return lt(a,t)},this.normalizeGroupedData=t=>{const n=this.getOptions(),{angle:r,value:i}=b(n,"radar","axes"),s=b(n,"data","groupMapsTo");return t.map(({name:a,data:o})=>{const l=this.uniqueKeys.map(c=>({[s]:a,[r]:c,[i]:null}));return{name:a,data:lt(l,o)}})},this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail;this.parent.selectAll("g.blobs path").transition("legend-hover-blob").call(r=>this.services.transitions.setupTransition({transition:r,name:"legend-hover-blob"})).style("fill-opacity",r=>r.name!==n.datum().name?ar.opacity.unselected:ar.opacity.selected).style("stroke-opacity",r=>r.name!==n.datum().name?ar.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",ar.opacity.selected).style("stroke-opacity",1)}}init(){const{events:t}=this.services;t.addEventListener(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t=!0){const n=this.getComponentContainer(),{width:r,height:i}=R.getSVGElementSize(n,{useAttrs:!0}),s=this.model.getData(),a=this.model.getGroupedData(),o=this.getOptions(),l=b(o,"data","groupMapsTo"),c=b(o,"radar","axes","value"),{angle:u,value:d}=b(o,"radar","axes"),{xLabelPadding:h,yLabelPadding:f,yTicksNumber:p,minRange:g,xAxisRectHeight:m}=ar;this.uniqueKeys=Array.from(new Set(s.map(C=>C[u]))),this.uniqueGroups=Array.from(new Set(s.map(C=>C[l]))),this.fullDataNormalized=this.normalizeFlatData(s),this.groupedDataNormalized=this.normalizeGroupedData(a);const E=2*(this.getLabelDimensions(this.uniqueKeys[0]).height+f),S=(Math.min(r,i)-E)/2;if(S<=0)return;const _=Ii().domain(this.fullDataNormalized.map(C=>C[u])).range([0,2*Math.PI].map(C=>C-Math.PI/2)),A=An(this.fullDataNormalized.map(C=>C[d])),L=Fe().domain([A>=0?0:A,Un(this.fullDataNormalized.map(C=>C[d]))]).range([g,S]).nice(p),B=L.ticks(p),D=(C,V,z)=>this.model.getFillColor(C,V,z),O=yT().angle(C=>_(C[u])+Math.PI/2).radius(C=>L(C[d])).curve(Qf),H=this.uniqueKeys.map(C=>{const V=this.getLabelDimensions(C).width,z=ZN(_(C),S);return V+z}),M={x:Un(H)+h,y:i/2},U=R.appendOrSelect(n,"g.y-axes").attr("role",ut.GROUP).selectAll("path").data(B,C=>C),F=C=>this.uniqueKeys.map(V=>({[u]:V,[d]:C}));U.join(C=>C.append("path").attr("opacity",0).attr("transform",`translate(${M.x}, ${M.y})`).attr("fill","none").call(V=>V.transition().call(z=>this.services.transitions.setupTransition({transition:z,name:"radar_y_axes_enter",animate:t})).attr("opacity",1).attr("d",z=>O(F(z)))),C=>C.call(V=>V.transition().call(z=>this.services.transitions.setupTransition({transition:z,name:"radar_y_axes_update",animate:t})).attr("opacity",1).attr("transform",`translate(${M.x}, ${M.y})`).attr("d",z=>O(F(z)))),C=>C.call(V=>V.transition().call(z=>this.services.transitions.setupTransition({transition:z,name:"radar_y_axes_exit",animate:t})).attr("d",z=>O(F(z))).attr("opacity",0).remove())),R.appendOrSelect(n,"g.x-axes").attr("role",ut.GROUP).selectAll("line").data(this.uniqueKeys,C=>C).join(C=>C.append("line").attr("opacity",0).attr("class",V=>`x-axis-${Hr(V)}`).attr("stroke-dasharray","0").attr("x1",V=>Ft(_(V),0,M).x).attr("y1",V=>Ft(_(V),0,M).y).attr("x2",V=>Ft(_(V),0,M).x).attr("y2",V=>Ft(_(V),0,M).y).call(V=>V.transition().call(z=>this.services.transitions.setupTransition({transition:z,name:"radar_x_axes_enter",animate:t})).attr("opacity",1).attr("x1",z=>Ft(_(z),L.range()[0],M).x).attr("y1",z=>Ft(_(z),L.range()[0],M).y).attr("x2",z=>Ft(_(z),L.range()[1],M).x).attr("y2",z=>Ft(_(z),L.range()[1],M).y)),C=>C.call(V=>V.transition().call(z=>this.services.transitions.setupTransition({transition:z,name:"radar_x_axes_update",animate:t})).attr("opacity",1).attr("x1",z=>Ft(_(z),L.range()[0],M).x).attr("y1",z=>Ft(_(z),L.range()[0],M).y).attr("x2",z=>Ft(_(z),L.range()[1],M).x).attr("y2",z=>Ft(_(z),L.range()[1],M).y)),C=>C.call(V=>V.transition().call(z=>this.services.transitions.setupTransition({transition:z,name:"radar_x_axes_exit",animate:t})).attr("opacity",0).remove())),R.appendOrSelect(n,"g.x-labels").attr("role",ut.GROUP).selectAll("text").data(this.uniqueKeys).join(C=>C.append("text").text(V=>V).attr("opacity",0).attr("x",V=>Ft(_(V),L.range()[1]+h,M).x).attr("y",V=>Ft(_(V),L.range()[1]+h,M).y).style("text-anchor",V=>Hv(_(V)).textAnchor).style("dominant-baseline",V=>Hv(_(V)).dominantBaseline).call(V=>V.transition().call(z=>this.services.transitions.setupTransition({transition:z,name:"radar_x_labels_enter",animate:t})).attr("opacity",1)),C=>C.call(V=>V.transition().call(z=>this.services.transitions.setupTransition({transition:z,name:"radar_x_labels_update",animate:t})).attr("opacity",1).attr("x",z=>Ft(_(z),L.range()[1]+h,M).x).attr("y",z=>Ft(_(z),L.range()[1]+h,M).y).end().finally(()=>{const z=b(o,"radar","alignment"),Mt=this.getAlignmentXOffset(z,n,this.getParent());n.attr("x",Mt)})),C=>C.call(V=>V.transition().call(z=>this.services.transitions.setupTransition({transition:z,name:"radar_x_labels_exit",animate:t})).attr("opacity",0).remove())),R.appendOrSelect(n,"g.blobs").attr("role",ut.GROUP).selectAll("path").data(this.groupedDataNormalized,C=>C.name).join(C=>C.append("path").attr("class",V=>this.model.getColorClassName({classNameTypes:[it.FILL,it.STROKE],dataGroupName:V.name,originalClassName:"blob"})).attr("role",ut.GRAPHICS_SYMBOL).attr("aria-label",V=>V.name).attr("opacity",0).attr("transform",t?()=>`translate(${M.x}, ${M.y}) scale(${1+Math.random()*.35})`:`translate(${M.x}, ${M.y})`).style("fill",V=>D(V.name,null,V.data)).style("fill-opacity",ar.opacity.selected).style("stroke",V=>D(V.name,null,V.data)).call(V=>{const z=V.transition().call(Mt=>this.services.transitions.setupTransition({transition:Mt,name:"radar_blobs_enter",animate:t}));t&&z.delay(()=>Math.random()*30).attr("transform",`translate(${M.x}, ${M.y})`),z.attr("opacity",1).attr("d",Mt=>O(Mt.data))}),C=>(C.attr("class",V=>this.model.getColorClassName({classNameTypes:[it.FILL,it.STROKE],dataGroupName:V.name,originalClassName:"blob"})).style("fill",V=>D(V.name,null,V.data)).style("stroke",V=>D(V.name,null,V.data)),C.call(V=>V.transition().call(z=>this.services.transitions.setupTransition({transition:z,name:"radar_blobs_update",animate:t})).attr("opacity",1).attr("transform",`translate(${M.x}, ${M.y})`).attr("d",z=>O(z.data))),C),C=>C.call(V=>{const z=V.transition().call(Mt=>this.services.transitions.setupTransition({transition:Mt,name:"radar_blobs_exit",animate:t}));t&&z.delay(()=>Math.random()*30).attr("transform",()=>`translate(${M.x}, ${M.y}) scale(${1+Math.random()*.35})`),z.attr("opacity",0).remove()})),R.appendOrSelect(n,"g.dots").attr("role",ut.GROUP).selectAll("circle").data(this.fullDataNormalized.filter(C=>b(C,d)!==null)).join(C=>C.append("circle").attr("role",ut.GRAPHICS_SYMBOL).attr("aria-label",V=>V[c]),C=>C,C=>C.remove()).attr("class",C=>this.model.getColorClassName({classNameTypes:[it.FILL],dataGroupName:C[l],originalClassName:Hr(C[u])})).attr("cx",C=>Ft(_(C[u]),L(C[d]),M).x).attr("cy",C=>Ft(_(C[u]),L(C[d]),M).y).attr("r",0).attr("opacity",0).style("fill",C=>D(C[l])),R.appendOrSelect(n,"g.x-axes-rect").attr("role",ut.GROUP).selectAll("rect").data(this.uniqueKeys).join(C=>C.append("rect"),C=>C,C=>C.remove()).attr("x",M.x).attr("y",M.y-m/2).attr("width",L.range()[1]).attr("height",m).style("fill","red").style("fill-opacity",0).attr("transform",C=>`rotate(${Gv(_(C))}, ${M.x}, ${M.y})`);const{code:vt,number:Y}=b(o,"locale");R.appendOrSelect(n,"g.y-labels").attr("role",ut.GROUP).selectAll("text").data(Ie(B)).join(C=>C.append("text").attr("opacity",0).text(V=>Y(V,vt)).attr("x",V=>Ft(-Math.PI/2,L(V),M).x+f).attr("y",V=>Ft(-Math.PI/2,L(V),M).y).style("text-anchor","start").style("dominant-baseline","middle").call(V=>V.transition().call(z=>this.services.transitions.setupTransition({transition:z,name:"radar_y_labels_enter",animate:t})).attr("opacity",1)),C=>C.call(V=>V.transition().call(z=>this.services.transitions.setupTransition({transition:z,name:"radar_y_labels_update",animate:t})).text(z=>z).attr("opacity",1).attr("x",z=>Ft(-Math.PI/2,L(z),M).x+f).attr("y",z=>Ft(-Math.PI/2,L(z),M).y)),C=>C.call(V=>V.transition().call(z=>this.services.transitions.setupTransition({transition:z,name:"radar_y_labels_exit",animate:t})).attr("opacity",0).remove())),this.addEventListeners()}getAlignmentXOffset(t,n,r){const i=R.getSVGElementSize(n,{useBBox:!0}),{width:s}=R.getSVGElementSize(r,{useAttrs:!0});let a=0;return t===Bt.CENTER?a=Math.floor((s-i.width)/2):t===Bt.RIGHT&&(a=s-i.width),a}destroy(){this.parent.selectAll(".x-axes-rect > rect").on("mouseover",null).on("mousemove",null).on("mouseout",null);const t=this.services.events;t.removeEventListener(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}addEventListeners(){const t=this,{axes:{angle:n}}=b(this.getOptions(),"radar");this.parent.selectAll(".x-axes-rect > rect").on("mouseover",function(r,i){const s=I(this);t.services.events.dispatchEvent(T.Radar.X_AXIS_MOUSEOVER,{event:r,element:s,datum:i});const a=t.parent.select(`.x-axes .x-axis-${Hr(i)}`),o=t.parent.selectAll(`.dots circle.${Hr(i)}`),l=t.model.getActiveDataGroupNames(),c=t.getOptions(),{groupMapsTo:u}=c.data,d=b(c,"radar","axes","value");a.classed("hovered",!0).attr("stroke-dasharray","4 4"),o.classed("hovered",!0).attr("opacity",f=>l.indexOf(f[u])!==-1?1:0).attr("r",ar.dotsRadius);const h=t.fullDataNormalized.filter(f=>f[n]===i&&l.indexOf(f[u])!==-1);t.services.events.dispatchEvent(T.Tooltip.SHOW,{event:r,hoveredElement:s,items:h.filter(f=>typeof f[d]=="number").map(f=>({label:f[u],value:f[d],color:t.model.getFillColor(f[u],null,f),class:t.model.getColorClassName({classNameTypes:[it.TOOLTIP],dataGroupName:f[u]})}))})}).on("mousemove",function(r,i){const s=I(this);t.services.events.dispatchEvent(T.Radar.X_AXIS_MOUSEMOVE,{event:r,element:s,datum:i}),t.services.events.dispatchEvent(T.Tooltip.MOVE,{event:r})}).on("click",function(r,i){t.services.events.dispatchEvent(T.Radar.X_AXIS_CLICK,{event:r,element:I(this),datum:i})}).on("mouseout",function(r,i){const s=I(this),a=t.parent.select(`.x-axes .x-axis-${Hr(i)}`),o=t.parent.selectAll(`.dots circle.${Hr(i)}`);a.classed("hovered",!1).attr("stroke-dasharray","0"),o.classed("hovered",!1).attr("opacity",0).attr("r",0),t.services.events.dispatchEvent(T.Radar.X_AXIS_MOUSEOUT,{event:r,element:s,datum:i}),t.services.events.dispatchEvent(T.Tooltip.HIDE)})}}class Vv extends qu{constructor(){super(...arguments),this.type="simple-bar",this.renderType=tt.SVG,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail,{groupMapsTo:r}=this.getOptions().data;this.parent.selectAll("path.bar").transition("legend-hover-simple-bar").call(i=>this.services.transitions.setupTransition({transition:i,name:"legend-hover-simple-bar"})).attr("opacity",i=>i[r]!==n.datum().name?.3:1)},this.handleLegendMouseOut=()=>{this.parent.selectAll("path.bar").transition("legend-mouseout-simple-bar").call(t=>this.services.transitions.setupTransition({transition:t,name:"legend-mouseout-simple-bar"})).attr("opacity",1)}}init(){const t=this.services.events;t.addEventListener(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t){const n=this.getOptions(),{groupMapsTo:r}=n.data,i=this.getComponentContainer({withinChartClip:!0}),s=this.model.getDisplayData(this.configs.groups),a=this.services.cartesianScales.getOrientation(),o=i.selectAll("path.bar").data(s,c=>c[r]);o.exit().attr("opacity",0).remove(),o.enter().append("path").attr("opacity",0).merge(o).classed("bar",!0).attr("width",this.getBarWidth.bind(this)).transition().call(c=>this.services.transitions.setupTransition({transition:c,name:"bar-update-enter",animate:t})).attr("class",c=>this.model.getColorClassName({classNameTypes:[it.FILL],dataGroupName:c[r],originalClassName:"bar"})).style("fill",c=>{const u=this.services.cartesianScales.getDomainIdentifier(c);return this.model.getFillColor(c[r],c[u],c)}).attr("d",c=>{const u=this.services.cartesianScales.getRangeIdentifier(),d=this.getBarWidth(),h=c[u],f=this.services.cartesianScales.getDomainValue(c)-d/2,p=f+d;let g,m;if(Array.isArray(h)&&h.length===2)g=this.services.cartesianScales.getRangeValue(h[0]),m=this.services.cartesianScales.getRangeValue(h[1]);else{const y=this.services.cartesianScales.getRangeScale().domain()[0];g=this.services.cartesianScales.getRangeValue(Math.max(0,y)),m=this.services.cartesianScales.getRangeValue(c)}const v=Math.abs(m-g);if(v!==0&&v<2&&(h>0&&a===Wt.VERTICAL||h<0&&a===Wt.HORIZONTAL?m=g-2:m=g+2),!this.isOutsideZoomedDomain(f,p))return ie({x0:f,x1:p,y0:g,y1:m},a)}).attr("opacity",1).attr("role",ut.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,r){const i=I(this);i.classed("hovered",!0),t.services.events.dispatchEvent(T.Bar.BAR_MOUSEOVER,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(T.Tooltip.SHOW,{event:n,hoveredElement:i,data:[r]})}).on("mousemove",function(n,r){t.services.events.dispatchEvent(T.Bar.BAR_MOUSEMOVE,{event:n,element:I(this),datum:r}),t.services.events.dispatchEvent(T.Tooltip.MOVE,{event:n})}).on("click",function(n,r){t.services.events.dispatchEvent(T.Bar.BAR_CLICK,{event:n,element:I(this),datum:r})}).on("mouseout",function(n,r){const i=I(this);i.classed("hovered",!1),t.services.events.dispatchEvent(T.Bar.BAR_MOUSEOUT,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(T.Tooltip.HIDE,{hoveredElement:i})})}destroy(){this.parent.selectAll("path.bar").on("mouseover",null).on("mousemove",null).on("mouseout",null);const t=this.services.events;t.removeEventListener(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}}class QN extends oe{constructor(){super(...arguments),this.type="skeleton-lines"}render(t=!0){const n=b(this.getOptions(),"data","loading"),r=!b(this.getOptions(),"grid","x","enabled")&&!b(this.getOptions(),"grid","y","enabled")&&!b(this.getOptions(),"axes","bottom","visible")&&!b(this.getOptions(),"axes","left","visible");n&&!r?super.renderGridSkeleton(n):n&&r?this.renderSparklineSkeleton(n):this.removeSkeleton()}renderSparklineSkeleton(t){this.setScales(),this.drawBackdrop(t),this.drawSparkline(t),this.updateBackdropStyle(),t&&this.setShimmerEffect("shimmer-lines")}drawSparkline(t){const n=this.backdrop.attr("width"),r=[100],i=R.appendOrSelect(this.backdrop,"g.y.skeleton"),s=i.selectAll("line").data(r);s.enter().append("line").merge(s).attr("x1",0).attr("x2",n).attr("y1",a=>a).attr("y2",a=>a),i.selectAll("line").classed("shimmer-effect-lines",t).classed("empty-state-lines",!t).style("stroke",t?`url(#${this.services.domUtils.generateElementIDString("shimmer-lines")})`:null)}updateBackdropStyle(){const t=this.parent;this.backdrop=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 zv extends pt{constructor(){super(...arguments),this.type="area-stacked",this.renderType=tt.SVG,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail,r=this.getOptions(),{groupMapsTo:i}=r.data;this.parent.selectAll("path.area").transition("legend-hover-area").call(s=>this.services.transitions.setupTransition({transition:s,name:"legend-hover-area"})).attr("opacity",s=>b(s,0,i)!==n.datum().name?En.opacity.unselected:En.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",En.opacity.selected)}}init(){const t=this.services.events;t.addEventListener(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t=!0){const n=this.getComponentContainer({withinChartClip:!0}),r=this,i=this.getOptions(),{groupMapsTo:s}=i.data,a=Object.keys(i.axes).some(p=>i.axes[p].percentage),o=this.model.getStackedData({percentage:a,groups:this.configs.groups}),l=b(o,0,0),c=this.services.cartesianScales.getDomainAxisPosition({datum:l}),u=this.services.cartesianScales.getRangeAxisPosition({datum:l}),d=this.services.cartesianScales.getScaleByPosition(u),h=n.selectAll("path.area").data(o,p=>b(p,0,s));this.areaGenerator=Zl().x(p=>this.services.cartesianScales.getValueThroughAxisPosition(c,p.data.sharedStackKey)).y0(p=>d(p[0])).y1(p=>d(p[1])).curve(this.services.curves.getD3Curve()),h.exit().attr("opacity",0).remove(),h.enter().append("path").attr("opacity",0).merge(h).data(o,p=>b(p,0,s)).attr("class","area").attr("class",p=>this.model.getColorClassName({classNameTypes:[it.FILL],dataGroupName:b(p,0,s),originalClassName:"area"})).style("fill",p=>r.model.getFillColor(b(p,0,s),null,p)).attr("role",ut.GRAPHICS_SYMBOL).attr("aria-roledescription","area").attr("aria-label",p=>b(p,0,s)).transition().call(p=>this.services.transitions.setupTransition({transition:p,name:"area-update-enter",animate:t})).attr("opacity",En.opacity.selected).attr("d",this.areaGenerator)}}class Wv extends qu{constructor(){super(...arguments),this.type="stacked-bar",this.renderType=tt.SVG,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail,{groupMapsTo:r}=this.model.getOptions().data;this.parent.selectAll("path.bar").transition("legend-hover-bar").call(i=>this.services.transitions.setupTransition({transition:i,name:"legend-hover-bar"})).attr("opacity",i=>i[r]!==n.datum().name?.3:1)},this.handleLegendMouseOut=()=>{this.parent.selectAll("path.bar").transition("legend-mouseout-bar").call(t=>this.services.transitions.setupTransition({transition:t,name:"legend-mouseout-bar"})).attr("opacity",1)}}init(){const t=this.services.events;t.addEventListener(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t){const n=this.getComponentContainer({withinChartClip:!0}),r=this.getOptions(),{groupMapsTo:i}=r.data,s=this.model.getStackedData({groups:this.configs.groups,divergent:!0}),a=this.model.getActiveDataGroupNames(),o=n.selectAll("g.bars").data(s,c=>b(c,0,i));o.exit().attr("opacity",0).remove(),o.enter().append("g").classed("bars",!0).attr("role",ut.GROUP).attr("data-name","bars");const l=n.selectAll("g.bars").selectAll("path.bar").data(c=>c,c=>c.data.sharedStackKey);l.exit().remove(),l.enter().append("path").merge(l).classed("bar",!0).transition().call(c=>this.services.transitions.setupTransition({transition:c,name:"bar-update-enter",animate:t})).attr("class",c=>this.model.getColorClassName({classNameTypes:[it.FILL],dataGroupName:c[i],originalClassName:"bar"})).style("fill",c=>this.model.getFillColor(c[i],c.data.sharedStackKey,c.data)).attr("d",c=>{const u=c.data.sharedStackKey,d=this.getBarWidth(),h=this.services.cartesianScales.getDomainValue(u)-d/2,f=h+d,p=this.services.cartesianScales.getRangeValue(c[0]);let g=this.services.cartesianScales.getRangeValue(c[1]);if(!this.isOutsideZoomedDomain(h,f)){if(Math.abs(g-p)>0&&Math.abs(g-p)>r.bars.dividerSize){const m=c[0]<0&&c[1]<=0;m&&a.length>1?this.services.cartesianScales.getOrientation()===Wt.VERTICAL?g+=c[1]===0?2:1:g-=1:m||(this.services.cartesianScales.getOrientation()===Wt.VERTICAL?g+=1:g-=1)}return ie({x0:h,x1:f,y0:p,y1:g},this.services.cartesianScales.getOrientation())}}).attr("opacity",1).attr("role",ut.GRAPHICS_SYMBOL).attr("aria-roledescription","bar").attr("aria-label",c=>c[1]-c[0]),this.addEventListeners()}addEventListeners(){const t=this.getOptions(),{groupMapsTo:n}=t.data,r=this;this.parent.selectAll("path.bar").on("mouseover",function(i,s){const a=I(this);a.classed("hovered",!0),r.services.events.dispatchEvent(T.Bar.BAR_MOUSEOVER,{event:i,element:a,datum:s});let l=r.model.getDisplayData(r.configs.groups).find(c=>{const u=r.services.cartesianScales.getDomainIdentifier(c),d=r.services.cartesianScales.getRangeIdentifier(c);return c[d]===s.data[s[n]]&&c[u].toString()===s.data.sharedStackKey&&c[n]===s[n]});if(l===void 0){const c=r.services.cartesianScales.getDomainIdentifier(),u=r.services.cartesianScales.getRangeIdentifier();l={[c]:s.data.sharedStackKey,[u]:s.data[s[n]],[n]:s[n]}}r.services.events.dispatchEvent(T.Tooltip.SHOW,{event:i,hoveredElement:a,data:[l]})}).on("mousemove",function(i,s){const a=I(this);r.services.events.dispatchEvent(T.Bar.BAR_MOUSEMOVE,{event:i,element:a,datum:s}),r.services.events.dispatchEvent(T.Tooltip.MOVE,{event:i})}).on("click",function(i,s){r.services.events.dispatchEvent(T.Bar.BAR_CLICK,{event:i,element:I(this),datum:s})}).on("mouseout",function(i,s){const a=I(this);a.classed("hovered",!1),r.services.events.dispatchEvent(T.Bar.BAR_MOUSEOUT,{event:i,element:a,datum:s}),r.services.events.dispatchEvent(T.Tooltip.HIDE,{hoveredElement:a})})}getBarWidth(){const t=this.getOptions();if(b(t,"bars","width"))return t.bars.width;const n=this.services.cartesianScales.getMainXScale(),r=R.getSVGElementSize(this.parent,{useAttrs:!0}).width,i=this.model.getStackKeys().length,s=b(t,"bars","spacingFactor");return n.step?Math.min(t.bars.maxWidth,n.step()/2):Math.min(t.bars.maxWidth,r*s/i)}destroy(){this.parent.selectAll("path.bar").on("mouseover",null).on("mousemove",null).on("mouseout",null);const t=this.services.events;t.removeEventListener(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}}class Yv extends an{constructor(){super(...arguments),this.type="scatter-stacked",this.renderType=tt.SVG}render(t){if(!b(this.getOptions(),"points","enabled"))return;const r=this.getComponentContainer({withinChartClip:!0}),i=this.getOptions(),{groupMapsTo:s}=i.data,a=Object.keys(i.axes).some(f=>i.axes[f].percentage),o=this.model.getStackedData({groups:this.configs.groups,percentage:a}),l=r.selectAll("g.dots").data(o,f=>b(f,0,s));l.exit().attr("opacity",0).remove();const u=l.enter().append("g").classed("dots",!0).attr("role",ut.GROUP).merge(l).selectAll("circle.dot").data(f=>f);u.exit().attr("opacity",0).remove();const h=u.enter().append("circle").classed("dot",!0).attr("opacity",0).merge(u).datum(f=>{const p=f[s],g=this.services.cartesianScales.getDomainIdentifier(f),m=this.services.cartesianScales.getRangeIdentifier(f);return{[s]:p,[g]:f.data.sharedStackKey,[m]:f[1]}});this.styleCircles(h,t),this.addEventListeners()}getTooltipData(t,n){const r=this.getOptions(),{groupMapsTo:i}=r.data,s=Object.keys(r.axes).some(l=>r.axes[l].percentage),a=this.model.getStackedData({groups:this.configs.groups,percentage:s}),o=[];return a.forEach((l,c)=>{l.forEach((u,d)=>{const h=u[i],f=u.data.sharedStackKey;let p=u.data[h];const g=u[1],m=this.services.cartesianScales.getDomainIdentifier(u),v=this.services.cartesianScales.getRangeIdentifier(u);p!=null&&t===this.services.cartesianScales.getDomainValue(f)&&n===this.services.cartesianScales.getRangeValue(g)&&(s&&(p=this.model.getStackedData({groups:this.configs.groups})[c][d].data[h]),p!==null&&o.push({[i]:h,[m]:f,[v]:p}))})}),this.model.getDisplayData(this.configs.groups).filter(l=>{const c=this.services.cartesianScales.getDomainIdentifier(l),u=this.services.cartesianScales.getRangeIdentifier(l);return o.find(d=>d[i]==l[i]&&d[c]==l[c]&&d[u]==l[u])!==void 0})}}const ni=6;class JN extends pt{constructor(){super(...arguments),this.type="tree",this.renderType=tt.SVG}getLongestLabel(t){let n="";return t.forEach(r=>{const i=r.children?this.getLongestLabel(r.children):"";(i.length>n.length||r.name.length>n.length)&&(n=i.length>r.name.length?i:r.name)}),n}getMockLabelWidth(t,n){const r=t.append("text").attr("dy","0.31em").attr("x",0).attr("text-anchor","end").text(n),{width:i}=R.getSVGElementSize(r.node(),{useBBox:!0});return r.remove(),i}render(t=!0){const n=this.getComponentContainer();n.html("");const{width:r,height:i}=R.getSVGElementSize(this.parent,{useAttrs:!0});if(r<1||i<1)return;const s=this.model.getOptions(),a=this.model.getDisplayData(),o=b(s,"tree","rootTitle")||"Tree",l=this.getMockLabelWidth(n,o),c=this.getLongestLabel(a),u=this.getMockLabelWidth(n,c),d={top:0,right:0,bottom:0,left:l>0?l+ni:30-ni},h=Di({name:o,children:a}),f=10,p=r/6,g=_=>{const A=h.descendants().reverse(),L=h.links();let B=h,D=h;h.eachBefore($=>{$.x<B.x&&(B=$),$.x>D.x&&(D=$)});const O=D.x-B.x,H=n.transition().call($=>this.services.transitions.setupTransition({transition:$,name:"tree-update-viewbox",animate:!0})).attr("viewBox",[-d.left,B.x,r,O].join(" ")),P=S.selectAll("g").data(A,$=>$.id),M=this,w=P.enter().append("g").attr("transform",()=>`translate(${_.y0},${_.x0})`).attr("class",$=>$.depth!==0&&$.children&&$.children.length>0?"clickable":null).on("mouseover",function($,N){M.services.events.dispatchEvent(T.Tree.NODE_MOUSEOVER,{event:$,element:I(this),datum:N})}).on("click",function($,N){N.depth!==0&&(N.children=N.children?null:N._children,g(N)),M.services.events.dispatchEvent(T.Tree.NODE_CLICK,{event:$,element:I(this),datum:N})}).on("mouseout",function($,N){M.services.events.dispatchEvent(T.Tree.NODE_MOUSEOUT,{event:$,element:I(this),datum:N})});w.append("circle").attr("r",2.5).attr("class",$=>$._children?"parent":"child").attr("stroke-width",10),w.append("text").attr("dy","0.31em").attr("x",$=>$._children?-ni:ni).attr("text-anchor",$=>$._children?"end":"start").text($=>$.data.name).clone(!0).attr("class","text-stroke").lower(),P.merge(w).transition(H).attr("transform",$=>`translate(${$.y},${$.x})`).attr("fill-opacity",1).attr("stroke-opacity",1),P.exit().transition(H).remove().attr("transform",()=>`translate(${_.y},${_.x})`).attr("fill-opacity",0).attr("stroke-opacity",0);const U=x.selectAll("path").data(L,$=>$.target.id),F=U.enter().append("path").attr("d",()=>{const $={x:_.x0,y:_.y0};return y({source:$,target:$})});U.merge(F).transition(H).attr("d",y),U.exit().transition(H).remove().attr("d",()=>{const $={x:_.x,y:_.y};return y({source:$,target:$})}),h.eachBefore($=>{$.x0=$.x,$.y0=$.y})},m=h.descendants(),v=m[m.length-1].depth,E=b(s,"tree","type")===za.DENDROGRAM?Ux().size([i,r-u-v*ni-l]):w_().nodeSize([f,p]).size([i,r-u-v*ni-l]),y=TT().x(_=>_.y).y(_=>_.x);h.x0=p/2,h.y0=0,h.descendants().forEach((_,A)=>{_.id=A,_._children=_.children}),E(h),n.attr("viewBox",[-d.left,-d.top,r,f]).style("user-select","none");const x=n.append("g").attr("class","links"),S=n.append("g").attr("class","nodes");g(h)}}var t$="#000000",e$="#ffffff",n$="#fcf4d6",r$="#fddc69",i$="#f1c21b",s$="#d2a106",a$="#b28600",o$="#8e6a00",l$="#684e00",c$="#483700",u$="#302400",h$="#1c1500",d$={10:n$,20:r$,30:i$,40:s$,50:a$,60:o$,70:l$,80:c$,90:u$,100:h$},f$="#fff2e8",p$="#ffd9be",g$="#ffb784",m$="#ff832b",v$="#eb6200",y$="#ba4e00",E$="#8a3800",b$="#5e2900",x$="#3e1a00",_$="#231000",S$={10:f$,20:p$,30:g$,40:m$,50:v$,60:y$,70:E$,80:b$,90:x$,100:_$},T$="#fff1f1",O$="#ffd7d9",w$="#ffb3b8",M$="#ff8389",A$="#fa4d56",C$="#da1e28",D$="#a2191f",L$="#750e13",R$="#520408",I$="#2d0709",k$={10:T$,20:O$,30:w$,40:M$,50:A$,60:C$,70:D$,80:L$,90:R$,100:I$},P$="#fff0f7",N$="#ffd6e8",$$="#ffafd2",F$="#ff7eb6",U$="#ee5396",B$="#d02670",H$="#9f1853",G$="#740937",V$="#510224",z$="#2a0a18",W$={10:P$,20:N$,30:$$,40:F$,50:U$,60:B$,70:H$,80:G$,90:V$,100:z$},Y$="#f6f2ff",q$="#e8daff",X$="#d4bbff",j$="#be95ff",Z$="#a56eff",K$="#8a3ffc",Q$="#6929c4",J$="#491d8b",tF="#31135e",eF="#1c0f30",nF={10:Y$,20:q$,30:X$,40:j$,50:Z$,60:K$,70:Q$,80:J$,90:tF,100:eF},rF="#edf5ff",iF="#d0e2ff",sF="#a6c8ff",aF="#78a9ff",oF="#4589ff",lF="#0f62fe",cF="#0043ce",uF="#002d9c",hF="#001d6c",dF="#001141",fF={10:rF,20:iF,30:sF,40:aF,50:oF,60:lF,70:cF,80:uF,90:hF,100:dF},pF="#e5f6ff",gF="#bae6ff",mF="#82cfff",vF="#33b1ff",yF="#1192e8",EF="#0072c3",bF="#00539a",xF="#003a6d",_F="#012749",SF="#061727",TF={10:pF,20:gF,30:mF,40:vF,50:yF,60:EF,70:bF,80:xF,90:_F,100:SF},OF="#d9fbfb",wF="#9ef0f0",MF="#3ddbd9",AF="#08bdba",CF="#009d9a",DF="#007d79",LF="#005d5d",RF="#004144",IF="#022b30",kF="#081a1c",PF={10:OF,20:wF,30:MF,40:AF,50:CF,60:DF,70:LF,80:RF,90:IF,100:kF},NF="#defbe6",$F="#a7f0ba",FF="#6fdc8c",UF="#42be65",BF="#24a148",HF="#198038",GF="#0e6027",VF="#044317",zF="#022d0d",WF="#071908",YF={10:NF,20:$F,30:FF,40:UF,50:BF,60:HF,70:GF,80:VF,90:zF,100:WF},qF="#f2f4f8",XF="#dde1e6",jF="#c1c7cd",ZF="#a2a9b0",KF="#878d96",QF="#697077",JF="#4d5358",tU="#343a3f",eU="#21272a",nU="#121619",rU={10:qF,20:XF,30:jF,40:ZF,50:KF,60:QF,70:JF,80:tU,90:eU,100:nU},iU="#f4f4f4",sU="#e0e0e0",aU="#c6c6c6",oU="#a8a8a8",lU="#8d8d8d",cU="#6f6f6f",uU="#525252",hU="#393939",dU="#262626",fU="#161616",pU={10:iU,20:sU,30:aU,40:oU,50:lU,60:cU,70:uU,80:hU,90:dU,100:fU},gU="#f7f3f2",mU="#e5e0df",vU="#cac5c4",yU="#ada8a8",EU="#8f8b8b",bU="#726e6e",xU="#565151",_U="#3c3838",SU="#272525",TU="#171414",OU={10:gU,20:mU,30:vU,40:yU,50:EU,60:bU,70:xU,80:_U,90:SU,100:TU},qv={black:{100:t$},blue:fF,coolGray:rU,cyan:TF,gray:pU,green:YF,magenta:W$,orange:S$,purple:nF,red:k$,teal:PF,warmGray:OU,white:{0:e$},yellow:d$};const wU=e=>{if(!e)return null;for(const t of Object.keys(qv)){const n=qv[t];for(const r of Object.keys(n))if(n[+r]===e)return r}return null},Xv=function(){const e=I(this.parentNode).select("rect.leaf"),t=getComputedStyle(e.node(),null).getPropertyValue("fill"),n=on(t);let r;if(n&&(r=wU(n?n.hex():null)),r==null){const i=Bo(n).l;r=Math.abs(i*100-100)}return r>50?"white":"black"};let MU=0;class AU extends pt{constructor(){super(...arguments),this.type="treemap",this.renderType=tt.SVG,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail;this.parent.selectAll("g[data-name='leaf']").transition("legend-hover-treemap").call(r=>this.services.transitions.setupTransition({transition:r,name:"legend-hover-treemap"})).attr("opacity",r=>r.parent.data.name===n.datum().name?1:.3)},this.handleLegendMouseOut=()=>{this.parent.selectAll("g[data-name='leaf']").transition("legend-mouseout-treemap").call(t=>this.services.transitions.setupTransition({transition:t,name:"legend-mouseout-treemap"})).attr("opacity",1)}}init(){const{events:t}=this.services;t.addEventListener(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t=!0){const n=this.getComponentContainer();this.model.getData();const r=this.model.getDisplayData(),i=this.model.getOptions(),s=b(window,"location"),{width:a,height:o}=R.getSVGElementSize(n,{useAttrs:!0}),l=Di({name:i.title||"Treemap",children:r}).sum(g=>g.value).sort((g,m)=>m.value-g.value),c=L_().size([a,o]).paddingInner(1).paddingOuter(0).round(!0)(l),u=n.selectAll("g[data-name='leaf']").data(c.leaves(),g=>g.data.name);u.exit().attr("opacity",0).remove();const h=u.enter().append("g").attr("data-name","leaf").attr("data-uid",()=>MU++).merge(u);h.attr("data-name","leaf").transition().call(g=>this.services.transitions.setupTransition({transition:g,name:"treemap-group-update",animate:t})).attr("transform",g=>`translate(${g.x0},${g.y0})`);const f=h.selectAll("rect.leaf").data(g=>[g]);f.exit().attr("width",0).attr("height",0).remove(),f.enter().append("rect").classed("leaf",!0).merge(f).attr("width",0).attr("height",0).attr("id",function(){const g=I(this.parentNode).attr("data-uid");return`${i.style.prefix}-leaf-${g}`}).attr("class",g=>{for(;g.depth>1;)g=g.parent;return this.model.getColorClassName({classNameTypes:[it.FILL],dataGroupName:g.data.name,originalClassName:"leaf"})}).transition().call(g=>this.services.transitions.setupTransition({transition:g,name:"treemap-leaf-update-enter",animate:t})).attr("width",g=>g.x1-g.x0).attr("height",g=>g.y1-g.y0).style("fill",g=>{for(;g.depth>1;)g=g.parent;return this.model.getFillColor(g.data.name,null,g.data)}),h.selectAll("clipPath").data(g=>g.data.showLabel!==!0?[]:[1],g=>g).join(g=>g.append("clipPath").attr("id",function(){const m=I(this.parentNode).attr("data-uid");return`${i.style.prefix}-clip-${m}`}).append("use").attr("xlink:href",function(){const m=I(this.parentNode.parentNode).attr("data-uid"),v=`${i.style.prefix}-leaf-${m}`;return new URL(`#${v}`,s)+""}),g=>null,g=>g.remove()),h.selectAll("text").data(g=>{if(g.data.showLabel!==!0)return[];let m=g;for(;m.depth>1;)m=m.parent;const v=Bo(this.model.getFillColor(m.data.name));return[{text:g.data.name,color:v.l<.5?"white":"black"}]},g=>g).join(g=>{const m=g.append("text").text(v=>v.text).style("fill",Xv).attr("x",7).attr("y",18);return s&&m.attr("clip-path",function(){const v=I(this.parentNode).attr("data-uid"),E=`${i.style.prefix}-clip-${v}`;return`url(${new URL(`#${E}`,s)+""})`}),m},g=>g.text(m=>m.text).style("fill",Xv),g=>g.remove()),this.addEventListeners()}addEventListeners(){const t=this;this.parent.selectAll("rect.leaf").on("mouseover",function(n,r){const i=I(this);let s=getComputedStyle(this,null).getPropertyValue("fill"),a=r;for(;a.depth>1;)a=a.parent;i.transition("graph_element_mouseover_fill_update").call(o=>t.services.transitions.setupTransition({transition:o,name:"graph_element_mouseover_fill_update"})).style("fill",o=>{const l=t.model.getFillColor(o.parent.data.name,null,o.data);return l&&(s=l),on(s).darker(.7).toString()}),t.services.events.dispatchEvent(T.Tooltip.SHOW,{event:n,hoveredElement:i,items:[{color:s,label:a.data.name,bold:!0},{label:r.data.name,value:r.data.value}]}),t.services.events.dispatchEvent(T.Treemap.LEAF_MOUSEOVER,{event:n,element:i,datum:r})}).on("mousemove",function(n,r){const i=I(this);t.services.events.dispatchEvent(T.Treemap.LEAF_MOUSEMOVE,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(T.Tooltip.MOVE,{event:n})}).on("click",function(n,r){t.services.events.dispatchEvent(T.Treemap.LEAF_CLICK,{event:n,element:I(this),datum:r})}).on("mouseout",function(n,r){const i=I(this);i.classed("hovered",!1);let s=r;for(;s.depth>1;)s=s.parent;i.transition().call(a=>t.services.transitions.setupTransition({transition:a,name:"graph_element_mouseout_fill_update"})).style("fill",a=>t.model.getFillColor(a.parent.data.name,null,a.data)),t.services.events.dispatchEvent(T.Treemap.LEAF_MOUSEOUT,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(T.Tooltip.HIDE,{hoveredElement:i})})}}var CU={value:function(){}};function jv(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new Eo(n)}function Eo(e){this._=e}function DU(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",i=n.indexOf(".");if(i>=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Eo.prototype=jv.prototype={constructor:Eo,on:function(e,t){var n=this._,r=DU(e+"",n),i,s=-1,a=r.length;if(arguments.length<2){for(;++s<a;)if((i=(e=r[s]).type)&&(i=LU(n[i],e.name)))return i;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++s<a;)if(i=(e=r[s]).type)n[i]=Zv(n[i],e.name,t);else if(t==null)for(i in n)n[i]=Zv(n[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new Eo(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=new Array(i),r=0,i,s;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(s=this._[e],r=0,i=s.length;r<i;++r)s[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],i=0,s=r.length;i<s;++i)r[i].value.apply(t,n)}};function LU(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function Zv(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=CU,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}const RU=oP(Object.freeze(Object.defineProperty({__proto__:null,dispatch:jv},Symbol.toStringTag,{value:"Module"}))).dispatch,Xu=Math.PI/180,IU={archimedean:Qv,rectangular:zU},ys=64,bo=2048;var kU=function(){var e=[256,256],t=PU,n=NU,r=$U,i=Kv,s=Kv,a=FU,o=UU,l=Qv,c=[],u=1/0,d=RU("word","end"),h=null,f=Math.random,p={},g=YU;p.canvas=function(E){return arguments.length?(g=$n(E),p):g},p.start=function(){var E=m(g()),y=WU((e[0]>>5)*e[1]),x=null,S=c.length,_=-1,A=[],L=c.map(function(D,O){return D.text=t.call(this,D,O),D.font=n.call(this,D,O),D.style=i.call(this,D,O),D.weight=s.call(this,D,O),D.rotate=a.call(this,D,O),D.size=~~r.call(this,D,O),D.padding=o.call(this,D,O),D}).sort(function(D,O){return O.size-D.size});return h&&clearInterval(h),h=setInterval(B,0),B(),p;function B(){for(var D=Date.now();Date.now()-D<u&&++_<S&&h;){var O=L[_];O.x=e[0]*(f()+.5)>>1,O.y=e[1]*(f()+.5)>>1,BU(E,O,L,_),O.hasText&&v(y,O,x)&&(A.push(O),d.call("word",p,O),x?GU(x,O):x=[{x:O.x+O.x0,y:O.y+O.y0},{x:O.x+O.x1,y:O.y+O.y1}],O.x-=e[0]>>1,O.y-=e[1]>>1)}_>=S&&(p.stop(),d.call("end",p,A,x))}},p.stop=function(){h&&(clearInterval(h),h=null);for(const E of c)delete E.sprite;return p};function m(E){const y=E.getContext("2d",{willReadFrequently:!0});E.width=E.height=1;const x=Math.sqrt(y.getImageData(0,0,1,1).data.length>>2);return E.width=(ys<<5)/x,E.height=bo/x,y.fillStyle=y.strokeStyle="red",{context:y,ratio:x}}function v(E,y,x){e[0],e[1];for(var S=y.x,_=y.y,A=Math.sqrt(e[0]*e[0]+e[1]*e[1]),L=l(e),B=f()<.5?1:-1,D=-B,O,H,P;(O=L(D+=B))&&(H=~~O[0],P=~~O[1],!(Math.min(Math.abs(H),Math.abs(P))>=A));)if(y.x=S+H,y.y=_+P,!(y.x+y.x0<0||y.y+y.y0<0||y.x+y.x1>e[0]||y.y+y.y1>e[1])&&(!x||VU(y,x))&&!HU(y,E,e[0])){for(var M=y.sprite,w=y.width>>5,U=e[0]>>5,F=y.x-(w<<4),$=F&127,N=32-$,j=y.y1-y.y0,q=(y.y+y.y0)*U+(F>>5),at,nt=0;nt<j;nt++){at=0;for(var dt=0;dt<=w;dt++)E[q+dt]|=at<<N|(dt<w?(at=M[nt*w+dt])>>>$:0);q+=U}return!0}return!1}return p.timeInterval=function(E){return arguments.length?(u=E??1/0,p):u},p.words=function(E){return arguments.length?(c=E,p):c},p.size=function(E){return arguments.length?(e=[+E[0],+E[1]],p):e},p.font=function(E){return arguments.length?(n=$n(E),p):n},p.fontStyle=function(E){return arguments.length?(i=$n(E),p):i},p.fontWeight=function(E){return arguments.length?(s=$n(E),p):s},p.rotate=function(E){return arguments.length?(a=$n(E),p):a},p.text=function(E){return arguments.length?(t=$n(E),p):t},p.spiral=function(E){return arguments.length?(l=IU[E]||E,p):l},p.fontSize=function(E){return arguments.length?(r=$n(E),p):r},p.padding=function(E){return arguments.length?(o=$n(E),p):o},p.random=function(E){return arguments.length?(f=E,p):f},p.on=function(){var E=d.on.apply(d,arguments);return E===d?p:E},p};function PU(e){return e.text}function NU(){return"serif"}function Kv(){return"normal"}function $U(e){return Math.sqrt(e.value)}function FU(){return(~~(random()*6)-3)*30}function UU(){return 1}function BU(e,t,n,r){if(!t.sprite){var i=e.context,s=e.ratio;i.clearRect(0,0,(ys<<5)/s,bo/s);var a=0,o=0,l=0,c=n.length;for(--r;++r<c;){t=n[r],i.save(),i.font=t.style+" "+t.weight+" "+~~((t.size+1)/s)+"px "+t.font;const O=i.measureText(t.text),H=-Math.floor(O.width/2);let P=(O.width+1)*s,M=t.size<<1;if(t.rotate){var u=Math.sin(t.rotate*Xu),d=Math.cos(t.rotate*Xu),h=P*d,f=P*u,p=M*d,g=M*u;P=Math.max(Math.abs(h+g),Math.abs(h-g))+31>>5<<5,M=~~Math.max(Math.abs(f+p),Math.abs(f-p))}else P=P+31>>5<<5;if(M>l&&(l=M),a+P>=ys<<5&&(a=0,o+=l,l=0),o+M>=bo)break;i.translate((a+(P>>1))/s,(o+(M>>1))/s),t.rotate&&i.rotate(t.rotate*Xu),i.fillText(t.text,H,0),t.padding&&(i.lineWidth=2*t.padding,i.strokeText(t.text,H,0)),i.restore(),t.width=P,t.height=M,t.xoff=a,t.yoff=o,t.x1=P>>1,t.y1=M>>1,t.x0=-t.x1,t.y0=-t.y1,t.hasText=!0,a+=P}for(var m=i.getImageData(0,0,(ys<<5)/s,bo/s).data,v=[];--r>=0;)if(t=n[r],!!t.hasText){for(var E=t.width,y=E>>5,x=t.y1-t.y0,S=0;S<x*y;S++)v[S]=0;if(a=t.xoff,a==null)return;o=t.yoff;for(var _=0,A=-1,L=0;L<x;L++){for(var S=0;S<E;S++){var B=y*L+(S>>5),D=m[(o+L)*(ys<<5)+(a+S)<<2]?1<<31-S%32:0;v[B]|=D,_|=D}_?A=L:(t.y0++,x--,L--,o++)}t.y1=t.y0+A,t.sprite=v.slice(0,(t.y1-t.y0)*y)}}}function HU(e,t,n){n>>=5;for(var r=e.sprite,i=e.width>>5,s=e.x-(i<<4),a=s&127,o=32-a,l=e.y1-e.y0,c=(e.y+e.y0)*n+(s>>5),u,d=0;d<l;d++){u=0;for(var h=0;h<=i;h++)if((u<<o|(h<i?(u=r[d*i+h])>>>a:0))&t[c+h])return!0;c+=n}return!1}function GU(e,t){var n=e[0],r=e[1];t.x+t.x0<n.x&&(n.x=t.x+t.x0),t.y+t.y0<n.y&&(n.y=t.y+t.y0),t.x+t.x1>r.x&&(r.x=t.x+t.x1),t.y+t.y1>r.y&&(r.y=t.y+t.y1)}function VU(e,t){return e.x+e.x1>t[0].x&&e.x+e.x0<t[1].x&&e.y+e.y1>t[0].y&&e.y+e.y0<t[1].y}function Qv(e){var t=e[0]/e[1];return function(n){return[t*(n*=.1)*Math.cos(n),n*Math.sin(n)]}}function zU(e){var t=4,n=t*e[0]/e[1],r=0,i=0;return function(s){var a=s<0?-1:1;switch(Math.sqrt(1+4*a*s)-a&3){case 0:r+=n;break;case 1:i+=t;break;case 2:r-=n;break;default:i-=t;break}return[r,i]}}function WU(e){for(var t=[],n=-1;++n<e;)t[n]=0;return t}function YU(){return document.createElement("canvas")}function $n(e){return typeof e=="function"?e:function(){return e}}const qU=aP(kU);class XU extends pt{constructor(){super(...arguments),this.type="wordcloud",this.renderType=tt.SVG,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail,{groupMapsTo:r}=this.getOptions().data;this.parent.selectAll("text.word").transition("legend-hover-wordcloud").call(i=>this.services.transitions.setupTransition({transition:i,name:"legend-hover-wordcloud"})).attr("opacity",i=>i[r]!==n.datum().name?.3:1)},this.handleLegendMouseOut=()=>{this.parent.selectAll("text.word").transition("legend-mouseout-wordcloud").call(t=>this.services.transitions.setupTransition({transition:t,name:"legend-mouseout-wordcloud"})).attr("opacity",1)}}init(){const t=this.services.events;t.addEventListener(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t=!0){const n=this,r=this.getComponentContainer().attr("width","100%").attr("height","100%"),i=this.model.getDisplayData(),s=this.getFontSizeScale(i),a=this.getOptions(),{fontSizeMapsTo:o,wordMapsTo:l}=a.wordCloud,{groupMapsTo:c}=a.data,{width:u,height:d}=R.getSVGElementSize(r,{useAttrs:!0});if(u===0||d===0)return;const h=qU().size([u,d]).words(i.map(function(p){const g=p[o];if(typeof p[o]!="number")throw Error("Badly formatted WordCloud data. `value` should only be an integer or float");return{[c]:p[c],text:p[l],size:g,value:g}})).padding(5).rotate(0).fontSize(p=>s(p.size)).on("end",f);h.start();function f(p){const g=R.appendOrSelect(r,"g.words");g.attr("transform",`translate(${h.size()[0]/2}, ${h.size()[1]/2})`);const m=g.selectAll("text").data(p,E=>`${E[c]}-${E.text}`);m.exit().attr("opacity",0).remove(),m.enter().append("text").attr("opacity",0).merge(m).style("font-size",E=>`${E.size}px`).text(function(E){return E.text}).attr("class",E=>n.model.getColorClassName({classNameTypes:[it.FILL],dataGroupName:E[c],originalClassName:`word ${E.size>32?"light":""}`})).style("fill",E=>n.model.getFillColor(E[c],E.text,E)).attr("text-anchor","middle").transition().call(E=>n.services.transitions.setupTransition({transition:E,name:"wordcloud-text-update-enter",animate:t})).attr("transform",E=>`translate(${E.x}, ${E.y})`).attr("opacity",1)}this.addEventListeners()}getFontSizeScale(t){const n=this.getOptions(),{fontSizeMapsTo:r}=n.wordCloud,i=t.map(l=>l[r]).filter(l=>l),s=R.getHTMLElementSize(this.services.domUtils.getMainContainer()),a=i.length>0,o=a?Ie(i):[1,1];return Fe().domain(o).range(a?n.wordCloud.fontSizeRange(s,t):[4,4])}addEventListeners(){const t=this.getOptions(),{groupMapsTo:n}=t.data,r=this,i=Va(s=>{const a=r.parent.selectAll("text.word").transition("wordcloud-word-mouse-highlight").call(o=>r.services.transitions.setupTransition({transition:o,name:"wordcloud-word-mouse-highlight"}));s===null?a.attr("opacity",1):a.attr("opacity",function(){return s===this?1:.3})},6);this.parent.selectAll("text.word").on("mouseover",function(s,a){const o=this;i(o),r.services.events.dispatchEvent(T.WordCloud.WORD_MOUSEOVER,{event:s,element:I(this),datum:a}),r.services.events.dispatchEvent(T.Tooltip.SHOW,{event:s,hoveredElement:o,items:[{label:t.tooltip.wordLabel,value:a.text},{label:t.tooltip.valueLabel,value:a.value},{label:yt(t,"locale.translations.group")||yt(t,"tooltip.groupLabel")||"Group",value:a[n],class:r.model.getColorClassName({classNameTypes:[it.TOOLTIP],dataGroupName:a[n]})}]})}).on("mousemove",function(s,a){const o=I(this);r.services.events.dispatchEvent(T.WordCloud.WORD_MOUSEMOVE,{element:o,datum:a}),r.services.events.dispatchEvent(T.Tooltip.MOVE,{event:s})}).on("click",function(s,a){r.services.events.dispatchEvent(T.WordCloud.WORD_CLICK,{event:s,element:I(this),datum:a})}).on("mouseout",function(s,a){const o=I(this);i(null),r.services.events.dispatchEvent(T.WordCloud.WORD_MOUSEOUT,{event:s,element:o,datum:a}),r.services.events.dispatchEvent(T.Tooltip.HIDE,{hoveredElement:o})})}}class jU extends pt{constructor(){super(...arguments),this.type="geo",this.renderType=tt.SVG}render(){const t=this.getComponentContainer({withinChartClip:!0}),{width:n,height:r}=R.getSVGElementSize(t,{useAttrs:!0});if(n<1||r<1)return;const i=this.getProjection(),s=b(this.getOptions(),"geoData"),a=this.model.getCombinedData(),o={},l={};Object.keys(a).forEach(v=>{typeof a[v].value=="number"?o[v]=a[v]:l[v]=a[v]});const c=$N(s,Object.values(l)),u=kN(s,{type:"GeometryCollection",geometries:Object.values(o)}),d=i.fitSize([n,r],u),h=hx().projection(d);R.appendOrSelect(t,"g.geo").selectAll("path").data(u.features).join("path").attr("d",h);const p=this.services.domUtils.generateElementIDString("geo-pattern-stripes"),g=R.appendOrSelect(t,"defs");R.appendOrSelect(g,"pattern").attr("id",p).attr("width",5).attr("height",10).attr("patternUnits","userSpaceOnUse").attr("patternTransform","rotate(45)").append("path").classed("pattern-fill",!0).attr("d",Bi()([[0,0],[0,10]]));const m=R.appendOrSelect(t,"g.missing-data");R.appendOrSelect(m,"path").datum(c).attr("d",h).style("fill",`url(#${p})`)}getProjection(){let t=null;switch(b(this.getOptions(),"thematic","projection")){case nn.geoEqualEarth:t=Dx();break;case nn.geoAlbers:t=Sx();break;case nn.geoConicEqualArea:t=Qd();break;case nn.geoConicEquidistant:t=Ax();break;case nn.geoEquirectangular:t=wx();break;case nn.geoMercator:t=Tx();break;case nn.geoNaturalEarth1:t=Lx();break;default:throw new Error("Projection is not supported.")}return t}}class ZU extends jU{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",s=>this.model.getColorClassName({value:n[s.properties.NAME].value,originalClassName:"border"})),this.addCountryAreaEventListener()}addCountryAreaEventListener(){const t=this,n=this.model.getCombinedData();this.parent.selectAll("path.border").on("mouseover",function(r,i){const s=I(this);t.services.events.dispatchEvent(Vr.CHOROPLETH_MOUSEOVER,{event:r,element:s,datum:n[i.properties.NAME]}),t.services.events.dispatchEvent(Gr.SHOW,{event:r,hoveredElement:s,items:[{label:i.properties.NAME,value:n[i.properties.NAME].value}]})}).on("mousemove",function(r,i){t.services.events.dispatchEvent(Vr.CHOROPLETH_MOUSEMOVE,{event:r,element:I(this),datum:n[i.properties.NAME]}),t.services.events.dispatchEvent(Gr.MOVE,{event:r})}).on("click",function(r,i){t.services.events.dispatchEvent(Vr.CHOROPLETH_CLICK,{event:r,element:I(this),datum:n[i.properties.NAME]})}).on("mouseout",function(r,i){const s=I(this);t.services.events.dispatchEvent(Vr.CHOROPLETH_MOUSEOUT,{event:r,element:s,datum:n[i.properties.NAME]}),t.services.events.dispatchEvent(Gr.HIDE,{event:r,hoveredElement:s})})}}class KU extends qe{constructor(t,n){super(t,n),this.model=new DN(this.services),this.model.setOptions(Pt(Ct.choroplethChart,n.options)),this.init(t,n)}getChartComponents(t,n){const r=this.model.getOptions(),i=b(r,"toolbar","enabled"),s=!!this.model.getOptions().title,a={id:"title",components:[new gs(this.model,this.services)],growth:ct.STRETCH},o={id:"toolbar",components:[new Kr(this.model,this.services)],growth:ct.PREFERRED},l={id:"header",components:[new ae(this.model,this.services,[a,...i?[o]:[]],{direction:At.ROW,alignItems:ir.CENTER})],growth:ct.PREFERRED},c={id:"legend",components:[new Nv(this.model,this.services,{chartType:"choropleth"})],growth:ct.PREFERRED,renderType:tt.SVG},u={id:"graph-frame",components:t,growth:ct.STRETCH,renderType:tt.SVG},d=b(n,"legend","enabled")!==!1&&this.model.getOptions().legend.enabled!==!1&&this.model.getData().length>0,h=At.COLUMN_REVERSE,f={id:"spacer",components:[new On(this.model,this.services,{size:15})],growth:ct.PREFERRED},p={id:"full-frame",components:[new ae(this.model,this.services,[...d?[c]:[],...d?[f]:[],u],{direction:h})],growth:ct.STRETCH},g=[];if(s||i){g.push(l);const m={id:"spacer",components:[new On(this.model,this.services,i?{size:15}:void 0)],growth:ct.PREFERRED};g.push(m)}return g.push(p),[new Iu(this.model,this.services),new po(this.model,this.services),new ae(this.model,this.services,g,{direction:At.COLUMN})]}getComponents(){const t=[new ZU(this.model,this.services)];return this.getChartComponents(t)}}class QU extends rn{constructor(t){super(t),this.parentNode=!1,this.set({depth:2},{skipUpdate:!0})}setData(t){super.setData(t),this.setDataGroups(),t.length===1&&(this.parentNode=!0),this.setZoom()}setOptions(t){const n=this.getOptions(),r=lt({},t,this.getZoomOptions(t));Kc(n,r);const i=this.getHierarchyLevel(),s=b(n,"circlePack","hierarchyLevel");this.set({options:lt(n,r),depth:s&&s<4?s:i})}getZoomOptions(t){if(!this.getDisplayData())return{};const n=this.getDisplayData(),r=t||this.getOptions(),i=n.length===1&&b(n,0,"children")?b(n,0,"children"):n;let s=this.getHierarchyLevel();return i.some(a=>{if(a.children&&a.children.some(o=>o.children))return s=3,!1}),b(r,"canvasZoom","enabled")===!0&&s>2?{legend:{additionalItems:[{type:Gt.ZOOM,name:"Click to zoom"}]}}:null}setZoom(t){this.setOptions(this.getZoomOptions(t))}updateHierarchyLevel(t){this.set({depth:t})}getHierarchyLevel(){return this.get("depth")}hasParentNode(){return this.parentNode}setDataGroups(){const t=this.getData(),n=this.getOptions(),{groupMapsTo:r}=n.data,i=t.map(s=>{const a=s[r];return this.setChildrenDataGroup(s,a)});this.set({data:i},{skipUpdate:!0})}setChildrenDataGroup(t,n){return t.children?{...t,dataGroupName:n,children:t.children.map(r=>this.setChildrenDataGroup(r,n))}:{...t,dataGroupName:n}}getTabularDataArray(){const t=this.getDisplayData(),{number:n,code:r}=b(this.getOptions(),"locale"),i=["Child","Parent","Value"],s=[];return t.forEach(a=>{let o=a.value?a.value:0;a.children&&(o+=this.getChildrenDatums(a.children,a.name,s,0)),s.push(["–",a.name,n(o,r)])}),super.formatTable({headers:i,cells:s})}getChildrenDatums(t,n,r=[],i=0){const s=n,{number:a,code:o}=b(this.getOptions(),"locale");return t.forEach(l=>{const c=l.name;let u=0;if(l.children)l.children.length>0&&(typeof l.value=="number"&&(i+=l.value),u+=this.getChildrenDatums(l.children,c,r,u),r.push([c,s,a(u,o)]),i+=u);else{let d=0;typeof l.value=="number"&&(d=l.value,i+=l.value),r.push([l.name,s,a(d,o)])}}),i}}class JU extends qe{constructor(t,n){super(t,n),this.model=new QU(this.services),this.model.setOptions(Pt(Ct.circlePackChart,n.options)),this.init(t,n)}getComponents(){const t=[new HN(this.model,this.services)];return this.getChartComponents(t)}}const Jv={[Ee.LINE]:[ti,an],[Ee.SCATTER]:[an],[Ee.AREA]:[Dv,ti,an],[Ee.STACKED_AREA]:[zv,ti,Yv,yo],[Ee.SIMPLE_BAR]:[Vv],[Ee.GROUPED_BAR]:[Bv,ei],[Ee.STACKED_BAR]:[Wv,yo]};class tB extends de{constructor(t,n){super(t,n);const r=Pt(Ct.comboChart,n.options);n.options.comboChartTypes||(console.error("No comboChartTypes defined for the Combo Chart!"),r.comboChartTypes=[{type:Ee.LINE,correspondingDatasets:[]}]),this.model.setOptions(r),this.init(t,n)}getGraphComponents(){const{comboChartTypes:t}=this.model.getOptions();let n=0;const r=t.map(i=>{const s=i.type;let a;if(typeof i.type=="string"){if(!Object.keys(Jv).includes(i.type))return console.error(`Invalid chart type "${i.type}" specified for combo chart. Please refer to the ComboChart tutorial for more guidance.`),null;let o=!1;const l=`${aC(i.type)}Chart`;return a=lt({},Ct[l],this.model.getOptions(),i.options),i.type===Ee.STACKED_AREA&&(o=!0),Jv[i.type].map(c=>new c(this.model,this.services,{groups:i.correspondingDatasets,id:n++,options:a,stacked:o}))}else return a=lt({},this.model.getOptions(),i.options),new s(this.model,this.services,{groups:i.correspondingDatasets,id:n++,options:a})}).filter(i=>i!==null);return Pp(r)}getComponents(){const{comboChartTypes:t}=this.model.getOptions(),n=t.some(s=>s.type===Ee.STACKED_BAR||s.type===Ee.STACKED_AREA),r=[new fe(this.model,this.services),new Te(this.model,this.services),new oe(this.model,this.services,{skeleton:Ht.GRID}),...n?[]:[new Pn(this.model,this.services)],...this.getGraphComponents()];return this.getAxisChartComponents(r)}}class eB extends rn{constructor(t){super(t)}getTabularData(t){const n=super.getTabularData(t);return t!==n&&n.forEach(r=>{r.key&&r.key!==r.group&&(r.group=r.key)}),n}getTabularDataArray(){const t=this.getDisplayData(),n=this.getOptions(),{groupMapsTo:r}=n.data,{valueMapsTo:i}=n.pie,{number:s,code:a}=b(n,"locale"),o=["Group","Value"],l=[...t.map(c=>[c[r],c[i]===null?"–":s(c[i],a)])];return super.formatTable({headers:o,cells:l})}sanitize(t){return this.getTabularData(t).sort((r,i)=>i.value-r.value)}}class t0 extends qe{constructor(t,n,r=!1){super(t,n),this.model=new eB(this.services),!r&&(this.model.setOptions(Pt(Ct.pieChart,n.options)),this.init(t,n))}getComponents(){const t=[new $v(this.model,this.services),new oe(this.model,this.services,{skeleton:Ht.PIE})];return this.getChartComponents(t)}}class nB extends t0{constructor(t,n){super(t,n,!0),this.model.setOptions(Pt(Ct.donutChart,n.options)),this.init(t,n)}getComponents(){const t=[new VN(this.model,this.services),new oe(this.model,this.services,{skeleton:Ht.DONUT})];return this.getChartComponents(t)}}class rB extends rn{constructor(t){super(t)}getDataGroups(){return super.getDataGroups().filter(t=>t.name!=="delta")}getTabularDataArray(){const t=this.getDisplayData(),n=this.getOptions(),{groupMapsTo:r}=n.data,{number:i,code:s}=b(this.getOptions(),"locale"),a=["Group","Value"],o=[...t.map(l=>[l[r],l.value===null?"–":i(l.value,s)])];return super.formatTable({headers:a,cells:o})}}class iB extends qe{constructor(t,n){super(t,n),this.model=new rB(this.services),this.model.setOptions(Pt(Ct.gaugeChart,n.options)),this.init(t,n)}getComponents(){const t=[new zN(this.model,this.services)];return this.getChartComponents(t)}}class sB extends de{constructor(t,n){super(t,n),this.model.setOptions(Pt(Ct.groupedBarChart,n.options)),this.init(t,n)}getComponents(){const t=[new fe(this.model,this.services),new Te(this.model,this.services),new Bv(this.model,this.services),new ei(this.model,this.services),new oe(this.model,this.services,{skeleton:Ht.VERT_OR_HORIZ})];return this.getAxisChartComponents(t)}}class aB extends ur{constructor(t){super(t),this.axisFlavor=rs.HOVERABLE,this._colorScale=void 0,this._domains=[],this._ranges=[],this._matrix={};const n=b(this.getOptions(),"axes");if(b(n,"left","scaleType")&&b(n,"left","scaleType")!==Q.LABELS||b(n,"right","scaleType")&&b(n,"right","scaleType")!==Q.LABELS||b(n,"top","scaleType")&&b(n,"top","scaleType")!==Q.LABELS||b(n,"bottom","scaleType")&&b(n,"bottom","scaleType")!==Q.LABELS)throw Error("Heatmap only supports label scaletypes.")}getValueDomain(){const t=Ie(this.getDisplayData(),r=>r.value),n=Fe().domain(t).nice().domain();if(n[0]>0)n[0]=0;else if(n[0]===0&&n[1]===0)return[0,1];return n[0]<0&&n[1]>0&&(Math.abs(n[0])>n[1]?n[1]=Math.abs(n[0]):n[0]=-n[1]),n}getFillColor(t){return this._colorScale(t)}getUniqueDomain(){if(He(this._domains)){const t=this.getDisplayData(),{cartesianScales:n}=this.services,r=n.getDomainIdentifier(),i=n.getMainXAxisPosition(),s=n.getCustomDomainValuesByposition(i);if(s)return s;this._domains=Array.from(new Set(t.map(a=>a[r])))}return this._domains}getUniqueRanges(){if(He(this._ranges)){const t=this.getDisplayData(),{cartesianScales:n}=this.services,r=n.getRangeIdentifier(),i=n.getMainYAxisPosition(),s=n.getCustomDomainValuesByposition(i);if(s)return s;this._ranges=Array.from(new Set(t.map(a=>a[r])))}return this._ranges}getMatrix(){if(He(this._matrix)){const t=this.getUniqueDomain(),n=this.getUniqueRanges(),r=this.services.cartesianScales.getDomainIdentifier(),i=this.services.cartesianScales.getRangeIdentifier(),s={};n.forEach(a=>{s[a]={value:null,index:-1}}),t.forEach(a=>{this._matrix[a]=yn(s)}),this.getDisplayData().forEach((a,o)=>{this._matrix[a[r]][a[i]]={value:a.value,index:o}})}return this._matrix}setData(t){const n=this.sanitize(yn(t)),r=this.generateDataGroups(n);return this.set({data:n,dataGroups:r}),this._domains=[],this._ranges=[],this._matrix={},n}getMatrixAsArray(){He(this._matrix)&&this.getMatrix();const t=this.getUniqueDomain(),n=this.getUniqueRanges(),r=this.services.cartesianScales.getDomainIdentifier(),i=this.services.cartesianScales.getRangeIdentifier(),s=[];return t.forEach(a=>{n.forEach(o=>{const l={value:this._matrix[a][o].value,index:this._matrix[a][o].index};l[r]=a,l[i]=o,s.push(l)})}),s}getTabularDataArray(){const t=this.getDisplayData(),{primaryDomain:n,primaryRange:r}=this.assignRangeAndDomains(),{number:i,code:s}=b(this.getOptions(),"locale"),a=[n.label,r.label,"Value"],o=[...t.map(l=>[l[n.identifier]===null?"–":l[n.identifier],l[r.identifier]===null?"–":l[r.identifier],l.value===null?"–":i(l.value,s)])];return super.formatTable({headers:a,cells:o})}getColorClassName(t){return`${t.originalClassName} ${this._colorScale(t.value)}`}setColorClassNames(){const t=this.getOptions(),n=b(t,"color","gradient","colors"),r=!He(n);let i=b(t,"color","pairing","option");const s=this.getValueDomain(),a=s[0]<0&&s[1]>0?"diverge":"mono";(i<1&&i>4&&a==="mono"||i<1&&i>2&&a==="diverge")&&(i=1);const o=r?n:[];if(!r){const c=a==="diverge"?17:11;for(let u=1;u<c+1;u++)o.push(`fill-${a}-${i}-${u}`)}this._colorScale=Nl().domain(s).range(o);const l=b(this.getOptions(),"color");this._colorScale=kv(this.getDisplayData(),l)}}class oB extends de{constructor(t,n){super(t,n),this.model=new aB(this.services),this.model.setOptions(Pt(Ct.heatmapChart,n.options)),this.init(t,n)}getAxisChartComponents(t,n){const r=this.model.getOptions(),i=b(r,"toolbar","enabled");this.services.cartesianScales.determineAxisDuality(),this.services.cartesianScales.findDomainAndRangeAxes(),this.services.cartesianScales.determineOrientation();const s=!!this.model.getOptions().title,a={id:"title",components:[new gs(this.model,this.services)],growth:ct.STRETCH},o={id:"toolbar",components:[new Kr(this.model,this.services)],growth:ct.PREFERRED},l={id:"header",components:[new ae(this.model,this.services,[a,...i?[o]:[]],{direction:At.ROW,alignItems:ir.CENTER})],growth:ct.PREFERRED},c={id:"legend",components:[new Nv(this.model,this.services,{chartType:"heatmap"})],growth:ct.PREFERRED,renderType:tt.SVG},u={id:"graph-frame",components:t,growth:ct.STRETCH,renderType:tt.SVG},d=b(n,"legend","enabled")!==!1&&this.model.getOptions().legend.enabled!==!1&&this.model.getData().length>0,h=At.COLUMN_REVERSE,f={id:"spacer",components:[new On(this.model,this.services,{size:15})],growth:ct.PREFERRED},p={id:"full-frame",components:[new ae(this.model,this.services,[...d?[c]:[],...d?[f]:[],u],{direction:h})],growth:ct.STRETCH},g=[];if(s||i){g.push(l);const m={id:"spacer",components:[new On(this.model,this.services,i?{size:15}:void 0)],growth:ct.PREFERRED};g.push(m)}return g.push(p),[new xv(this.model,this.services),new po(this.model,this.services),new ae(this.model,this.services,g,{direction:At.COLUMN})]}getComponents(){const t=[new fe(this.model,this.services),new WN(this.model,this.services)];return this.getAxisChartComponents(t)}}class lB extends ur{getTabularDataArray(){const t=this.getOptions(),{groupMapsTo:n}=t.data,{number:r,code:i}=b(this.getOptions(),"locale"),s=this.getBinnedStackedData(),a=[yt(t,"bins.rangeLabel")||"Range",...s.map(l=>yt(l,`0.${n}`))],o=[...yt(s,0).map((l,c)=>[`${r(Number(yt(l,"data.x0")),i)} – ${r(Number(yt(l,"data.x1")),i)}`,...s.map(u=>r(yt(u[c],`data.${yt(u[c],n)}`),i))])];return super.formatTable({headers:a,cells:o})}}class cB extends de{constructor(t,n){super(t,n),this.model=new lB(this.services),this.model.setOptions(Pt(Ct.histogramChart,n.options)),this.init(t,n),this.update()}getComponents(){const t=[new fe(this.model,this.services),new Te(this.model,this.services),new UN(this.model,this.services),new YN(this.model,this.services)];return this.getAxisChartComponents(t)}}class uB extends de{constructor(t,n){super(t,n),this.model.setOptions(Pt(Ct.lineChart,n.options)),this.init(t,n)}getComponents(){const t=[new fe(this.model,this.services),new Te(this.model,this.services),new Pn(this.model,this.services),new ti(this.model,this.services),new an(this.model,this.services,{handleThresholds:!0}),new QN(this.model,this.services),new ei(this.model,this.services)];return this.getAxisChartComponents(t)}}class hB extends de{constructor(t,n){super(t,n),this.model.setOptions(Pt(Ct.lollipopChart,n.options)),this.init(t,n)}getComponents(){const t=[new fe(this.model,this.services),new Te(this.model,this.services),new Pn(this.model,this.services),new qN(this.model,this.services),new an(this.model,this.services),new oe(this.model,this.services,{skeleton:Ht.GRID})];return this.getAxisChartComponents(t)}}class dB extends rn{constructor(t){super(t)}getMaximumDomain(t){return t.reduce((r,i)=>r+i.value,0)}getFillColor(t){const n=this.getOptions(),r=b(n,"color","scale"),i=this.getStatus();return r||!i?super.getFillColor(t):null}getStatus(){const t=this.getOptions(),n=b(this.getDisplayData()),r=(n==null?void 0:n.reduce((a,o)=>a+o.value,0))??0,i=b(t,"meter","proportional")?r:r>100?100:r,s=b(t,"meter","status","ranges");if(s){const a=s.filter(o=>o.range[0]<=i&&i<=o.range[1]);if(a.length>0)return a[0].status}return null}getTabularDataArray(){const t=this.getDisplayData(),n=this.getOptions(),{groupMapsTo:r}=n.data,i=this.getStatus(),s=b(n,"meter","proportional"),{number:a,code:o}=b(this.getOptions(),"locale");let l=[],c=[],u;if(s===null){u=100;const d=t[0];l=["Group","Value",...i?["Status"]:[]],c=[[d[r],d.value===null?"–":a(d.value,o),...i?[i]:[]]]}else{const d=b(s,"total");u=d||this.getMaximumDomain(t),l=["Group","Value","Percentage of total"],c=[...t.map(h=>{let f;h.value!==null&&h.value!==void 0?f=Number(h.value):f=0;let p=Number((h.value/u*100).toFixed(2));return[h[r],h.value===null?"–":a(f,o),a(p,o)+" %"]})]}return super.formatTable({headers:l,cells:c})}}class fB extends qe{constructor(t,n){var i;super(t,n),this.model=new dB(this.services);const r=(i=n.options.meter)!=null&&i.proportional?lt(yn(Ct.proportionalMeterChart),n.options):lt(yn(Ct.meterChart),n.options);this.model.setOptions(r),this.init(t,n)}getComponents(){const n=[...b(this.model.getOptions(),"meter","showLabels")?[{id:"meter-title",components:[new BN(this.model,this.services)],growth:ct.STRETCH,renderType:tt.SVG},{id:"spacer",components:[new On(this.model,this.services,{size:8})],growth:ct.STRETCH}]:[],{id:"meter-graph",components:[new XN(this.model,this.services)],growth:ct.STRETCH,renderType:tt.SVG}],r=[new ae(this.model,this.services,n,{direction:At.COLUMN})];return this.getChartComponents(r,{graphFrameRenderType:tt.HTML})}}class pB extends ur{constructor(t){super(t)}getTabularDataArray(){const t=this.getOptions(),n=this.getGroupedData(),{angle:r,value:i}=b(t,"radar","axes"),{number:s,code:a}=b(t,"locale"),o=b(n,"0","data").map(u=>u[r]),l=["Group",...o],c=[...n.map(u=>[u.name,...o.map((d,h)=>b(u,"data",h,i)!==null?s(b(u,"data",h,i),a):"–")])];return super.formatTable({headers:l,cells:c})}}class gB extends qe{constructor(t,n){super(t,n),this.model=new pB(this.services),this.model.setOptions(Pt(Ct.radarChart,n.options)),this.init(t,n)}getComponents(){const t=[new KN(this.model,this.services)];return this.getChartComponents(t)}}class mB extends de{constructor(t,n){super(t,n),this.model.setOptions(Pt(Ct.scatterChart,n.options)),this.init(t,n)}getComponents(){const t=[new fe(this.model,this.services),new Te(this.model,this.services),new Pn(this.model,this.services),new an(this.model,this.services),new oe(this.model,this.services,{skeleton:Ht.GRID})];return this.getAxisChartComponents(t)}}class vB extends rn{constructor(t){super(t)}getTabularDataArray(){const t=this.getDisplayData(),n=["Child","Parent"],r=[];return t.forEach(i=>{this.getChildrenDatums(i,r),r.push([i.name,"–"])}),super.formatTable({headers:n,cells:r})}getChildrenDatums(t,n=[]){t.children&&t.children.length>0&&t.children.forEach(r=>{this.getChildrenDatums(r,n),n.push([r.name,t.name])})}}class yB extends qe{constructor(t,n){super(t,n),this.model=new vB(this.services),this.model.setOptions(Pt(Ct.treeChart,n.options)),this.init(t,n)}getComponents(){const t=[new JN(this.model,this.services)];return this.getChartComponents(t,{excludeLegend:!0})}}class EB extends rn{constructor(t){super(t)}getTabularDataArray(){const t=this.getDisplayData(),{number:n,code:r}=b(this.getOptions(),"locale"),i=["Child","Group","Value"],s=[];return t.forEach(a=>{Array.isArray(a.children)?a.children.forEach(o=>{s.push([o.name,a.name,o.value===null?"–":n(o.value,r)])}):b(a.name)!==null&&b(a.value)&&s.push(["–",a.name,n(a.value,r)])}),super.formatTable({headers:i,cells:s})}}class bB extends qe{constructor(t,n){super(t,n),this.model=new EB(this.services),this.model.setOptions(Pt(Ct.treemapChart,n.options)),this.init(t,n)}getComponents(){const t=[new AU(this.model,this.services)];return this.getChartComponents(t)}}class xB extends de{constructor(t,n){super(t,n),this.model.setOptions(Pt(Ct.simpleBarChart,n.options)),this.init(t,n)}getComponents(){const t=[new fe(this.model,this.services),new Te(this.model,this.services),new Vv(this.model,this.services),new ei(this.model,this.services),new oe(this.model,this.services,{skeleton:Ht.VERT_OR_HORIZ})];return this.getAxisChartComponents(t)}}class _B extends de{constructor(t,n){super(t,n),this.model.setOptions(Pt(Ct.stackedAreaChart,n.options)),this.init(t,n)}getComponents(){const t=[new fe(this.model,this.services),new Te(this.model,this.services),new yo(this.model,this.services),new zv(this.model,this.services),new ti(this.model,this.services,{stacked:!0}),new Yv(this.model,this.services,{fadeInOnChartHolderMouseover:!0,handleThresholds:!0,stacked:!0}),new oe(this.model,this.services,{skeleton:Ht.GRID})];return this.getAxisChartComponents(t)}}class SB extends de{constructor(t,n){super(t,n),this.model.setOptions(Pt(Ct.stackedBarChart,n.options)),this.init(t,n)}getComponents(){const t=[new fe(this.model,this.services),new Te(this.model,this.services),new yo(this.model,this.services),new Wv(this.model,this.services),new oe(this.model,this.services,{skeleton:Ht.VERT_OR_HORIZ}),new ei(this.model,this.services)];return this.getAxisChartComponents(t)}}class TB extends rn{constructor(t){super(t)}getTabularDataArray(){const t=this.getDisplayData(),n=this.getOptions(),{fontSizeMapsTo:r,wordMapsTo:i}=n.wordCloud,{groupMapsTo:s}=n.data,{code:a,number:o}=b(n,"locale"),l=[n.tooltip.wordLabel,"Group",n.tooltip.valueLabel],c=[...t.map(u=>[u[i],u[s],o(u[r],a)])];return super.formatTable({headers:l,cells:c})}}class OB extends qe{constructor(t,n){super(t,n),this.model=new TB(this.services),this.model.setOptions(Pt(Ct.wordCloudChart,n.options)),this.init(t,n)}getComponents(){const t=[new XU(this.model,this.services),new oe(this.model,this.services,{skeleton:Ht.PIE})];return this.getChartComponents(t)}}W.Alignments=Bt,W.AlluvialChart=KP,W.AreaChart=xN,W.AreaEvent=$c,W.ArrowDirections=Wa,W.AxisEvent=Nc,W.AxisFlavor=rs,W.AxisPositions=G,W.AxisTitleOrientations=Ya,W.BarEvent=Hc,W.BoxplotChart=TN,W.BoxplotEvent=Gc,W.BubbleChart=wN,W.BulletChart=CN,W.CalloutDirections=Ji,W.CanvasZoomEvent=Pc,W.CartesianOrientations=Wt,W.ChartEvent=Dc,W.ChartTheme=jc,W.ChartTypes=Ee,W.CirclePackChart=JU,W.ColorClassNameTypes=it,W.ColorLegendType=ns,W.ComboChart=tB,W.DividerStatus=Yr,W.DominantBaseline=en,W.DonutChart=nB,W.ExperimentalChoroplethChart=KU,W.GaugeChart=iB,W.GaugeEvent=Bc,W.GaugeTypes=sr,W.GroupedBarChart=sB,W.HeatmapChart=oB,W.HistogramChart=cB,W.LayoutAlignItems=ir,W.LayoutDirection=At,W.LayoutGrowth=ct,W.LegendItemType=Gt,W.LegendOrientations=Wr,W.LegendPositions=zr,W.LineChart=uB,W.LineEvent=zc,W.LollipopChart=hB,W.MeterChart=fB,W.ModalEvent=Lc,W.ModelEvent=Rc,W.PieChart=t0,W.PieEvent=Uc,W.Projection=nn,W.RadarChart=gB,W.RadarEvent=Wc,W.RenderTypes=tt,W.ScaleTypes=Q,W.ScatterChart=mB,W.ScatterEvent=Vc,W.SimpleBarChart=xB,W.Skeletons=Ht,W.StackedAreaChart=_B,W.StackedBarChart=SB,W.Statuses=ts,W.TextAnchor=tn,W.ThresholdEvent=Xc,W.TickRotations=es,W.ToolbarControlTypes=_t,W.TooltipEvent=Gr,W.TreeChart=yB,W.TreeEvent=Yc,W.TreeTypes=za,W.TreemapChart=bB,W.TreemapEvent=qc,W.TruncationTypes=Ce,W.WordCloudChart=OB,W.WordCloudEvent=Fc,W.ZoomBarTypes=Ge,W.ZoomDomainEvent=kc,W.ZoombarEvent=Ic,Object.defineProperty(W,Symbol.toStringTag,{value:"Module"})});
|
|
86
86
|
//# sourceMappingURL=bundle.umd.js.map
|