(()=>{"use strict";function t(t,n){let e;if(void 0===n)for(const n of t)null!=n&&(e=n)&&(e=n);else{let r=-1;for(let i of t)null!=(i=n(i,++r,t))&&(e=i)&&(e=i)}return e}function n(t){return t}var e=1e-6;function r(t){return"translate("+t+",0)"}function i(t){return"translate(0,"+t+")"}function o(t){return n=>+t(n)}function a(t,n){return n=Math.max(0,t.bandwidth()-2*n)/2,t.round()&&(n=Math.round(n)),e=>+t(e)+n}function u(){return!this.__axis}function s(t,s){var l=[],c=null,h=null,f=6,p=6,d=3,g="undefined"!=typeof window&&window.devicePixelRatio>1?0:.5,y=1===t||4===t?-1:1,m=4===t||2===t?"x":"y",v=1===t||3===t?r:i;function w(r){var i=null==c?s.ticks?s.ticks.apply(s,l):s.domain():c,w=null==h?s.tickFormat?s.tickFormat.apply(s,l):n:h,_=Math.max(f,0)+d,b=s.range(),x=+b[0]+g,M=+b[b.length-1]+g,k=(s.bandwidth?a:o)(s.copy(),g),A=r.selection?r.selection():r,N=A.selectAll(".domain").data([null]),E=A.selectAll(".tick").data(i,s).order(),$=E.exit(),S=E.enter().append("g").attr("class","tick"),C=E.select("line"),O=E.select("text");N=N.merge(N.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),E=E.merge(S),C=C.merge(S.append("line").attr("stroke","currentColor").attr(m+"2",y*f)),O=O.merge(S.append("text").attr("fill","currentColor").attr(m,y*_).attr("dy",1===t?"0em":3===t?"0.71em":"0.32em")),r!==A&&(N=N.transition(r),E=E.transition(r),C=C.transition(r),O=O.transition(r),$=$.transition(r).attr("opacity",e).attr("transform",(function(t){return isFinite(t=k(t))?v(t+g):this.getAttribute("transform")})),S.attr("opacity",e).attr("transform",(function(t){var n=this.parentNode.__axis;return v((n&&isFinite(n=n(t))?n:k(t))+g)}))),$.remove(),N.attr("d",4===t||2===t?p?"M"+y*p+","+x+"H"+g+"V"+M+"H"+y*p:"M"+g+","+x+"V"+M:p?"M"+x+","+y*p+"V"+g+"H"+M+"V"+y*p:"M"+x+","+g+"H"+M),E.attr("opacity",1).attr("transform",(function(t){return v(k(t)+g)})),C.attr(m+"2",y*f),O.attr(m,y*_).text(w),A.filter(u).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",2===t?"start":4===t?"end":"middle"),A.each((function(){this.__axis=k}))}return w.scale=function(t){return arguments.length?(s=t,w):s},w.ticks=function(){return l=Array.from(arguments),w},w.tickArguments=function(t){return arguments.length?(l=null==t?[]:Array.from(t),w):l.slice()},w.tickValues=function(t){return arguments.length?(c=null==t?null:Array.from(t),w):c&&c.slice()},w.tickFormat=function(t){return arguments.length?(h=t,w):h},w.tickSize=function(t){return arguments.length?(f=p=+t,w):f},w.tickSizeInner=function(t){return arguments.length?(f=+t,w):f},w.tickSizeOuter=function(t){return arguments.length?(p=+t,w):p},w.tickPadding=function(t){return arguments.length?(d=+t,w):d},w.offset=function(t){return arguments.length?(g=+t,w):g},w}function l(t){return s(3,t)}function c(t){return s(4,t)}function h(){}function f(t){return null==t?h:function(){return this.querySelector(t)}}function p(){return[]}function d(t){return null==t?p:function(){return this.querySelectorAll(t)}}function g(t){return function(){return this.matches(t)}}function y(t){return function(n){return n.matches(t)}}var m=Array.prototype.find;function v(){return this.firstElementChild}var w=Array.prototype.filter;function _(){return Array.from(this.children)}function b(t){return new Array(t.length)}function x(t,n){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=n}function M(t,n,e,r,i,o){for(var a,u=0,s=n.length,l=o.length;un?1:t>=n?0:NaN}x.prototype={constructor:x,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,n){return this._parent.insertBefore(t,n)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};var $="http://www.w3.org/1999/xhtml";const S={svg:"http://www.w3.org/2000/svg",xhtml:$,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function C(t){var n=t+="",e=n.indexOf(":");return e>=0&&"xmlns"!==(n=t.slice(0,e))&&(t=t.slice(e+1)),S.hasOwnProperty(n)?{space:S[n],local:t}:t}function O(t){return function(){this.removeAttribute(t)}}function P(t){return function(){this.removeAttributeNS(t.space,t.local)}}function j(t,n){return function(){this.setAttribute(t,n)}}function q(t,n){return function(){this.setAttributeNS(t.space,t.local,n)}}function H(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttribute(t):this.setAttribute(t,e)}}function T(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,e)}}function X(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function I(t){return function(){this.style.removeProperty(t)}}function z(t,n,e){return function(){this.style.setProperty(t,n,e)}}function D(t,n,e){return function(){var r=n.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,e)}}function L(t,n){return t.style.getPropertyValue(n)||X(t).getComputedStyle(t,null).getPropertyValue(n)}function R(t){return function(){delete this[t]}}function B(t,n){return function(){this[t]=n}}function V(t,n){return function(){var e=n.apply(this,arguments);null==e?delete this[t]:this[t]=e}}function Y(t){return t.trim().split(/^|\s+/)}function F(t){return t.classList||new G(t)}function G(t){this._node=t,this._names=Y(t.getAttribute("class")||"")}function U(t,n){for(var e=F(t),r=-1,i=n.length;++r=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var wt=[null];function _t(t,n){this._groups=t,this._parents=n}function bt(){return new _t([[document.documentElement]],wt)}_t.prototype=bt.prototype={constructor:_t,select:function(t){"function"!=typeof t&&(t=f(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i=b&&(b=_+1);!(w=m[b])&&++b=0;)(r=i[o])&&(a&&4^r.compareDocumentPosition(a)&&a.parentNode.insertBefore(r,a),a=r);return this},sort:function(t){function n(n,e){return n&&e?t(n.__data__,e.__data__):!n-!e}t||(t=E);for(var e=this._groups,r=e.length,i=new Array(r),o=0;o1?this.each((null==n?I:"function"==typeof n?D:z)(t,n,null==e?"":e)):L(this.node(),t)},property:function(t,n){return arguments.length>1?this.each((null==n?R:"function"==typeof n?V:B)(t,n)):this.node()[t]},classed:function(t,n){var e=Y(t+"");if(arguments.length<2){for(var r=F(this.node()),i=-1,o=e.length;++i=0&&(n=t.slice(e+1),t=t.slice(0,e)),{type:t,name:n}}))}(t+""),a=o.length;if(!(arguments.length<2)){for(u=n?gt:dt,r=0;r{}};function kt(){for(var t,n=0,e=arguments.length,r={};n=0&&(n=t.slice(e+1),t=t.slice(0,e)),t&&!r.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}}))),a=-1,u=o.length;if(!(arguments.length<2)){if(null!=n&&"function"!=typeof n)throw new Error("invalid callback: "+n);for(;++a0)for(var e,r,i=new Array(e),o=0;o=0&&n._call.call(void 0,t),n=n._next;--Ot}()}finally{Ot=0,function(){for(var t,n,e=St,r=1/0;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:St=n);Ct=t,Yt(r)}(),Ht=0}}function Vt(){var t=Xt.now(),n=t-qt;n>1e3&&(Tt-=n,qt=t)}function Yt(t){Ot||(Pt&&(Pt=clearTimeout(Pt)),t-Ht>24?(t<1/0&&(Pt=setTimeout(Bt,t-Xt.now()-Tt)),jt&&(jt=clearInterval(jt))):(jt||(qt=Xt.now(),jt=setInterval(Vt,1e3)),Ot=1,It(Bt)))}function Ft(t,n,e){var r=new Lt;return n=null==n?0:+n,r.restart((e=>{r.stop(),t(e+n)}),n,e),r}Lt.prototype=Rt.prototype={constructor:Lt,restart:function(t,n,e){if("function"!=typeof t)throw new TypeError("callback is not a function");e=(null==e?zt():+e)+(null==n?0:+n),this._next||Ct===this||(Ct?Ct._next=this:St=this,Ct=this),this._call=t,this._time=e,Yt()},stop:function(){this._call&&(this._call=null,this._time=1/0,Yt())}};var Gt=$t("start","end","cancel","interrupt"),Ut=[];function Wt(t,n,e,r,i,o){var a=t.__transition;if(a){if(e in a)return}else t.__transition={};!function(t,n,e){var r,i=t.__transition;function o(s){var l,c,h,f;if(1!==e.state)return u();for(l in i)if((f=i[l]).name===e.name){if(3===f.state)return Ft(o);4===f.state?(f.state=6,f.timer.stop(),f.on.call("interrupt",t,t.__data__,f.index,f.group),delete i[l]):+l0)throw new Error("too late; already scheduled");return e}function Zt(t,n){var e=Jt(t,n);if(e.state>3)throw new Error("too late; already running");return e}function Jt(t,n){var e=t.__transition;if(!e||!(e=e[n]))throw new Error("transition not found");return e}function Qt(t,n){return t=+t,n=+n,function(e){return t*(1-e)+n*e}}var tn,nn=180/Math.PI,en={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function rn(t,n,e,r,i,o){var a,u,s;return(a=Math.sqrt(t*t+n*n))&&(t/=a,n/=a),(s=t*e+n*r)&&(e-=t*s,r-=n*s),(u=Math.sqrt(e*e+r*r))&&(e/=u,r/=u,s/=u),t*r180?n+=360:n-t>180&&(t+=360),o.push({i:e.push(i(e)+"rotate(",null,r)-2,x:Qt(t,n)})):n&&e.push(i(e)+"rotate("+n+r)}(o.rotate,a.rotate,u,s),function(t,n,e,o){t!==n?o.push({i:e.push(i(e)+"skewX(",null,r)-2,x:Qt(t,n)}):n&&e.push(i(e)+"skewX("+n+r)}(o.skewX,a.skewX,u,s),function(t,n,e,r,o,a){if(t!==e||n!==r){var u=o.push(i(o)+"scale(",null,",",null,")");a.push({i:u-4,x:Qt(t,e)},{i:u-2,x:Qt(n,r)})}else 1===e&&1===r||o.push(i(o)+"scale("+e+","+r+")")}(o.scaleX,o.scaleY,a.scaleX,a.scaleY,u,s),o=a=null,function(t){for(var n,e=-1,r=s.length;++e>8&15|n>>4&240,n>>4&15|240&n,(15&n)<<4|15&n,1):8===e?Pn(n>>24&255,n>>16&255,n>>8&255,(255&n)/255):4===e?Pn(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|240&n,((15&n)<<4|15&n)/255):null):(n=bn.exec(t))?new qn(n[1],n[2],n[3],1):(n=xn.exec(t))?new qn(255*n[1]/100,255*n[2]/100,255*n[3]/100,1):(n=Mn.exec(t))?Pn(n[1],n[2],n[3],n[4]):(n=kn.exec(t))?Pn(255*n[1]/100,255*n[2]/100,255*n[3]/100,n[4]):(n=An.exec(t))?Dn(n[1],n[2]/100,n[3]/100,1):(n=Nn.exec(t))?Dn(n[1],n[2]/100,n[3]/100,n[4]):En.hasOwnProperty(t)?On(En[t]):"transparent"===t?new qn(NaN,NaN,NaN,0):null}function On(t){return new qn(t>>16&255,t>>8&255,255&t,1)}function Pn(t,n,e,r){return r<=0&&(t=n=e=NaN),new qn(t,n,e,r)}function jn(t,n,e,r){return 1===arguments.length?((i=t)instanceof pn||(i=Cn(i)),i?new qn((i=i.rgb()).r,i.g,i.b,i.opacity):new qn):new qn(t,n,e,null==r?1:r);var i}function qn(t,n,e,r){this.r=+t,this.g=+n,this.b=+e,this.opacity=+r}function Hn(){return`#${zn(this.r)}${zn(this.g)}${zn(this.b)}`}function Tn(){const t=Xn(this.opacity);return`${1===t?"rgb(":"rgba("}${In(this.r)}, ${In(this.g)}, ${In(this.b)}${1===t?")":`, ${t})`}`}function Xn(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function In(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function zn(t){return((t=In(t))<16?"0":"")+t.toString(16)}function Dn(t,n,e,r){return r<=0?t=n=e=NaN:e<=0||e>=1?t=n=NaN:n<=0&&(t=NaN),new Rn(t,n,e,r)}function Ln(t){if(t instanceof Rn)return new Rn(t.h,t.s,t.l,t.opacity);if(t instanceof pn||(t=Cn(t)),!t)return new Rn;if(t instanceof Rn)return t;var n=(t=t.rgb()).r/255,e=t.g/255,r=t.b/255,i=Math.min(n,e,r),o=Math.max(n,e,r),a=NaN,u=o-i,s=(o+i)/2;return u?(a=n===o?(e-r)/u+6*(e0&&s<1?0:a,new Rn(a,u,s,t.opacity)}function Rn(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function Bn(t){return(t=(t||0)%360)<0?t+360:t}function Vn(t){return Math.max(0,Math.min(1,t||0))}function Yn(t,n,e){return 255*(t<60?n+(e-n)*t/60:t<180?e:t<240?n+(e-n)*(240-t)/60:n)}function Fn(t,n,e,r,i){var o=t*t,a=o*t;return((1-3*t+3*o-a)*n+(4-6*o+3*a)*e+(1+3*t+3*o-3*a)*r+a*i)/6}hn(pn,Cn,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:$n,formatHex:$n,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Ln(this).formatHsl()},formatRgb:Sn,toString:Sn}),hn(qn,jn,fn(pn,{brighter(t){return t=null==t?gn:Math.pow(gn,t),new qn(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?dn:Math.pow(dn,t),new qn(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new qn(In(this.r),In(this.g),In(this.b),Xn(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Hn,formatHex:Hn,formatHex8:function(){return`#${zn(this.r)}${zn(this.g)}${zn(this.b)}${zn(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:Tn,toString:Tn})),hn(Rn,(function(t,n,e,r){return 1===arguments.length?Ln(t):new Rn(t,n,e,null==r?1:r)}),fn(pn,{brighter(t){return t=null==t?gn:Math.pow(gn,t),new Rn(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?dn:Math.pow(dn,t),new Rn(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+360*(this.h<0),n=isNaN(t)||isNaN(this.s)?0:this.s,e=this.l,r=e+(e<.5?e:1-e)*n,i=2*e-r;return new qn(Yn(t>=240?t-240:t+120,i,r),Yn(t,i,r),Yn(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new Rn(Bn(this.h),Vn(this.s),Vn(this.l),Xn(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=Xn(this.opacity);return`${1===t?"hsl(":"hsla("}${Bn(this.h)}, ${100*Vn(this.s)}%, ${100*Vn(this.l)}%${1===t?")":`, ${t})`}`}}));const Gn=t=>()=>t;function Un(t,n){var e=n-t;return e?function(t,n){return function(e){return t+e*n}}(t,e):Gn(isNaN(t)?n:t)}const Wn=function t(n){var e=function(t){return 1==(t=+t)?Un:function(n,e){return e-n?function(t,n,e){return t=Math.pow(t,e),n=Math.pow(n,e)-t,e=1/e,function(r){return Math.pow(t+r*n,e)}}(n,e,t):Gn(isNaN(n)?e:n)}}(n);function r(t,n){var r=e((t=jn(t)).r,(n=jn(n)).r),i=e(t.g,n.g),o=e(t.b,n.b),a=Un(t.opacity,n.opacity);return function(n){return t.r=r(n),t.g=i(n),t.b=o(n),t.opacity=a(n),t+""}}return r.gamma=t,r}(1);function Kn(t){return function(n){var e,r,i=n.length,o=new Array(i),a=new Array(i),u=new Array(i);for(e=0;e=1?(e=1,n-1):Math.floor(e*n),i=t[r],o=t[r+1],a=r>0?t[r-1]:2*i-o,u=ro&&(i=n.slice(o,i),u[a]?u[a]+=i:u[++a]=i),(e=e[0])===(r=r[0])?u[a]?u[a]+=r:u[++a]=r:(u[++a]=null,s.push({i:a,x:Qt(e,r)})),o=Jn.lastIndex;return o=0&&(t=t.slice(0,n)),!t||"start"===t}))}(n)?Kt:Zt;return function(){var a=o(this,t),u=a.on;u!==r&&(i=(r=u).copy()).on(n,e),a.on=i}}(e,t,n))},attr:function(t,n){var e=C(t),r="transform"===e?un:te;return this.attrTween(t,"function"==typeof n?(e.local?ae:oe)(e,r,cn(this,"attr."+t,n)):null==n?(e.local?ee:ne)(e):(e.local?ie:re)(e,r,n))},attrTween:function(t,n){var e="attr."+t;if(arguments.length<2)return(e=this.tween(e))&&e._value;if(null==n)return this.tween(e,null);if("function"!=typeof n)throw new Error;var r=C(t);return this.tween(e,(r.local?ue:se)(r,n))},style:function(t,n,e){var r="transform"==(t+="")?an:te;return null==n?this.styleTween(t,function(t,n){var e,r,i;return function(){var o=L(this,t),a=(this.style.removeProperty(t),L(this,t));return o===a?null:o===e&&a===r?i:i=n(e=o,r=a)}}(t,r)).on("end.style."+t,de(t)):"function"==typeof n?this.styleTween(t,function(t,n,e){var r,i,o;return function(){var a=L(this,t),u=e(this),s=u+"";return null==u&&(this.style.removeProperty(t),s=u=L(this,t)),a===s?null:a===r&&s===i?o:(i=s,o=n(r=a,u))}}(t,r,cn(this,"style."+t,n))).each(function(t,n){var e,r,i,o,a="style."+n,u="end."+a;return function(){var s=Zt(this,t),l=s.on,c=null==s.value[a]?o||(o=de(n)):void 0;l===e&&i===c||(r=(e=l).copy()).on(u,i=c),s.on=r}}(this._id,t)):this.styleTween(t,function(t,n,e){var r,i,o=e+"";return function(){var a=L(this,t);return a===o?null:a===r?i:i=n(r=a,e)}}(t,r,n),e).on("end.style."+t,null)},styleTween:function(t,n,e){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==n)return this.tween(r,null);if("function"!=typeof n)throw new Error;return this.tween(r,function(t,n,e){var r,i;function o(){var o=n.apply(this,arguments);return o!==i&&(r=(i=o)&&function(t,n,e){return function(r){this.style.setProperty(t,n.call(this,r),e)}}(t,o,e)),r}return o._value=n,o}(t,n,null==e?"":e))},text:function(t){return this.tween("text","function"==typeof t?function(t){return function(){var n=t(this);this.textContent=null==n?"":n}}(cn(this,"text",t)):function(t){return function(){this.textContent=t}}(null==t?"":t+""))},textTween:function(t){var n="text";if(arguments.length<1)return(n=this.tween(n))&&n._value;if(null==t)return this.tween(n,null);if("function"!=typeof t)throw new Error;return this.tween(n,function(t){var n,e;function r(){var r=t.apply(this,arguments);return r!==e&&(n=(e=r)&&function(t){return function(n){this.textContent=t.call(this,n)}}(r)),n}return r._value=t,r}(t))},remove:function(){return this.on("end.remove",function(t){return function(){var n=this.parentNode;for(var e in this.__transition)if(+e!==t)return;n&&n.removeChild(this)}}(this._id))},tween:function(t,n){var e=this._id;if(t+="",arguments.length<2){for(var r,i=Jt(this.node(),e).tween,o=0,a=i.length;o2&&e.state<5,e.state=6,e.timer.stop(),e.on.call(r?"interrupt":"cancel",t,t.__data__,e.index,e.group),delete o[i]):a=!1;a&&delete t.__transition}}(this,t)}))},xt.prototype.transition=function(t){var n,e;t instanceof ye?(n=t._id,t=t._name):(n=me(),(e=we).time=zt(),t=null==t?null:t+"");for(var r=this._groups,i=r.length,o=0;o=Pe?10:o>=je?5:o>=qe?2:1;let u,s,l;return i<0?(l=Math.pow(10,-i)/a,u=Math.round(t*l),s=Math.round(n*l),u/ln&&--s,l=-l):(l=Math.pow(10,i)*a,u=Math.round(t/l),s=Math.round(n/l),u*ln&&--s),sn?1:t>=n?0:NaN}function Ie(t,n){return null==t||null==n?NaN:nt?1:n>=t?0:NaN}function ze(t){let n,e,r;function i(t,r,i=0,o=t.length){if(i>>1;e(t[n],r)<0?i=n+1:o=n}while(iXe(t(n),e),r=(n,e)=>t(n)-e):(n=t===Xe||t===Ie?t:De,e=t,r=t),{left:i,center:function(t,n,e=0,o=t.length){const a=i(t,n,e,o-1);return a>e&&r(t[a-1],n)>-r(t[a],n)?a-1:a},right:function(t,r,i=0,o=t.length){if(i>>1;e(t[n],r)<=0?i=n+1:o=n}while(i=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function ir(t){if(!(n=rr.exec(t)))throw new Error("invalid format: "+t);var n;return new or({fill:n[1],align:n[2],sign:n[3],symbol:n[4],zero:n[5],width:n[6],comma:n[7],precision:n[8]&&n[8].slice(1),trim:n[9],type:n[10]})}function or(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}function ar(t,n){if((e=(t=n?t.toExponential(n-1):t.toExponential()).indexOf("e"))<0)return null;var e,r=t.slice(0,e);return[r.length>1?r[0]+r.slice(2):r,+t.slice(e+1)]}function ur(t){return(t=ar(Math.abs(t)))?t[1]:NaN}function sr(t,n){var e=ar(t,n);if(!e)return t+"";var r=e[0],i=e[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}ir.prototype=or.prototype,or.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};const lr={"%":(t,n)=>(100*t).toFixed(n),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},e:(t,n)=>t.toExponential(n),f:(t,n)=>t.toFixed(n),g:(t,n)=>t.toPrecision(n),o:t=>Math.round(t).toString(8),p:(t,n)=>sr(100*t,n),r:sr,s:function(t,n){var e=ar(t,n);if(!e)return t+"";var r=e[0],i=e[1],o=i-(er=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,a=r.length;return o===a?r:o>a?r+new Array(o-a+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+ar(t,Math.max(0,n+o-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function cr(t){return t}var hr,fr,pr,dr=Array.prototype.map,gr=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function yr(t){var n=t.domain;return t.ticks=function(t){var e=n();return function(t,n,e){if(!((e=+e)>0))return[];if((t=+t)==(n=+n))return[t];const r=n=i))return[];const u=o-i+1,s=new Array(u);if(r)if(a<0)for(let t=0;t0;){if((i=Te(s,l,e))===r)return o[a]=s,o[u]=l,n(o);if(i>0)s=Math.floor(s/i)*i,l=Math.ceil(l/i)*i;else{if(!(i<0))break;s=Math.ceil(s*i)/i,l=Math.floor(l*i)/i}r=i}return t},t}function mr(){var t=function(){var t,n,e,r,i,o,a=Ze,u=Ze,s=Ue,l=Je;function c(){var t,n,e,s=Math.min(a.length,u.length);return l!==Je&&(t=a[0],n=a[s-1],t>n&&(e=t,t=n,n=e),l=function(e){return Math.max(t,Math.min(n,e))}),r=s>2?nr:tr,i=o=null,h}function h(n){return null==n||isNaN(n=+n)?e:(i||(i=r(a.map(t),u,s)))(t(l(n)))}return h.invert=function(e){return l(n((o||(o=r(u,a.map(t),Qt)))(e)))},h.domain=function(t){return arguments.length?(a=Array.from(t,Ke),c()):a.slice()},h.range=function(t){return arguments.length?(u=Array.from(t),c()):u.slice()},h.rangeRound=function(t){return u=Array.from(t),s=We,c()},h.clamp=function(t){return arguments.length?(l=!!t||Je,c()):l!==Je},h.interpolate=function(t){return arguments.length?(s=t,c()):s},h.unknown=function(t){return arguments.length?(e=t,h):e},function(e,r){return t=e,n=r,c()}}()(Je,Je);return t.copy=function(){return n=t,mr().domain(n.domain()).range(n.range()).interpolate(n.interpolate()).clamp(n.clamp()).unknown(n.unknown());var n},Ae.apply(t,arguments),yr(t)}function vr(t,n,e){this.k=t,this.x=n,this.y=e}function wr(n,e){const r=n.querySelector(".bar-graph-container");if(!r)return;r.innerHTML="";const i=r.clientWidth,o=i-60-20,a=e.chartHeight-40-60,u=function(t,n){const e={};return Object.entries(t).forEach((([t,r])=>{const i=r.filter((t=>t.parent===n));i.length>0&&(e[t]=i)})),e}(e.chartData,e.selectedParentId),s=[];Object.entries(u).forEach((([t,n])=>{n.forEach((n=>{var r,i;s.push({id:n.id,dataset:t,label:n.label||"",value:parseFloat(n.value)||0,color:n.color||e.barColor,hasChildren:(r=e.chartData,i=n.id,Object.values(r).some((t=>t.some((t=>t.parent===i)))))})}))}));const h=function(t){return"string"==typeof t?new _t([[document.querySelector(t)]],[document.documentElement]):new _t([[t]],wt)}(r).append("svg").attr("width",i).attr("height",e.chartHeight).style("background-color",e.backgroundColor),f=h.append("g").attr("transform","translate(60,40)"),p=Oe().domain(s.map((t=>t.label))).range([0,o]).padding(.1),d=mr().domain([0,t(s,(t=>t.value))||100]).range([a,0]);e.showGridX&&f.append("g").attr("class","grid x-grid").attr("transform",`translate(0,${a})`).style("color",e.xGridColor).style("stroke-width",e.xGridWidth).call(l(p).tickSize(-a).tickFormat("")),e.showGridY&&f.append("g").attr("class","grid y-grid").style("color",e.yGridColor).style("stroke-width",e.yGridWidth).call(c(d).tickSize(-o).tickFormat("")),f.selectAll("rect").data(s).enter().append("rect").attr("x",(t=>p(t.label))).attr("y",(t=>d(t.value))).attr("width",p.bandwidth()).attr("height",(t=>a-d(t.value))).attr("fill",(t=>(t=>{switch(e.chartColorSource){case"singleColor":return e.barColor;case"customColors":const n=e.chartCustomColors?.find((n=>n.dataset===t.dataset&&n.label===t.label));return n?n.color:t.color;default:return t.color}})(t))).style("opacity",e.barOpacity).style("cursor",(t=>t.hasChildren?"pointer":"default")).on("click",(function(t,e){if(e.hasChildren){const t=window.lcpBarGraphData[n.id];t&&(t.attributes.selectedParentId=e.id,wr(n,t.attributes))}})),null!==e.selectedParentId&&h.append("text").attr("x",60).attr("y",20).attr("class","back-button").style("cursor","pointer").style("font-weight","bold").text("← Back").on("click",(function(){const t=window.lcpBarGraphData[n.id];if(t){let r=null;Object.values(e.chartData).forEach((t=>{const n=t.find((t=>t.id===e.selectedParentId));n&&(r=n.parent)})),t.attributes.selectedParentId=r,wr(n,t.attributes)}})),e.showBarValues&&f.selectAll(".bar-value").data(s).enter().append("text").attr("class","bar-value").attr("x",(t=>p(t.label)+p.bandwidth()/2)).attr("y",(t=>d(t.value)-5)).attr("text-anchor","middle").text((t=>t.value)),f.append("g").attr("class","x-axis").attr("transform",`translate(0,${a})`).call(l(p)).selectAll("text").style("text-anchor","end").attr("dx","-.8em").attr("dy",".15em").attr("transform","rotate(-45)"),f.append("g").attr("class","y-axis").call(c(d)),e.displayChartTitle&&e.chartTitle&&h.append("text").attr("x",i/2).attr("y",20).attr("text-anchor","middle").style("font-size","16px").text(e.chartTitle),e.xAxisLabel&&h.append("text").attr("x",i/2).attr("y",e.chartHeight-10).attr("text-anchor","middle").text(e.xAxisLabel),e.yAxisLabel&&h.append("text").attr("transform","rotate(-90)").attr("x",-e.chartHeight/2).attr("y",20).attr("text-anchor","middle").text(e.yAxisLabel),new ResizeObserver((()=>{r.clientWidth!==i&&(r.innerHTML="",wr(n,e))})).observe(r)}hr=function(t){var n,e,r=void 0===t.grouping||void 0===t.thousands?cr:(n=dr.call(t.grouping,Number),e=t.thousands+"",function(t,r){for(var i=t.length,o=[],a=0,u=n[0],s=0;i>0&&u>0&&(s+u+1>r&&(u=Math.max(1,r-s)),o.push(t.substring(i-=u,i+u)),!((s+=u+1)>r));)u=n[a=(a+1)%n.length];return o.reverse().join(e)}),i=void 0===t.currency?"":t.currency[0]+"",o=void 0===t.currency?"":t.currency[1]+"",a=void 0===t.decimal?".":t.decimal+"",u=void 0===t.numerals?cr:function(t){return function(n){return n.replace(/[0-9]/g,(function(n){return t[+n]}))}}(dr.call(t.numerals,String)),s=void 0===t.percent?"%":t.percent+"",l=void 0===t.minus?"−":t.minus+"",c=void 0===t.nan?"NaN":t.nan+"";function h(t){var n=(t=ir(t)).fill,e=t.align,h=t.sign,f=t.symbol,p=t.zero,d=t.width,g=t.comma,y=t.precision,m=t.trim,v=t.type;"n"===v?(g=!0,v="g"):lr[v]||(void 0===y&&(y=12),m=!0,v="g"),(p||"0"===n&&"="===e)&&(p=!0,n="0",e="=");var w="$"===f?i:"#"===f&&/[boxX]/.test(v)?"0"+v.toLowerCase():"",_="$"===f?o:/[%p]/.test(v)?s:"",b=lr[v],x=/[defgprs%]/.test(v);function M(t){var i,o,s,f=w,M=_;if("c"===v)M=b(t)+M,t="";else{var k=(t=+t)<0||1/t<0;if(t=isNaN(t)?c:b(Math.abs(t),y),m&&(t=function(t){t:for(var n,e=t.length,r=1,i=-1;r0&&(i=0)}return i>0?t.slice(0,i)+t.slice(n+1):t}(t)),k&&0==+t&&"+"!==h&&(k=!1),f=(k?"("===h?h:l:"-"===h||"("===h?"":h)+f,M=("s"===v?gr[8+er/3]:"")+M+(k&&"("===h?")":""),x)for(i=-1,o=t.length;++i(s=t.charCodeAt(i))||s>57){M=(46===s?a+t.slice(i+1):t.slice(i))+M,t=t.slice(0,i);break}}g&&!p&&(t=r(t,1/0));var A=f.length+t.length+M.length,N=A>1)+f+t+M+N.slice(A);break;default:t=N+f+t+M}return u(t)}return y=void 0===y?6:/[gprs]/.test(v)?Math.max(1,Math.min(21,y)):Math.max(0,Math.min(20,y)),M.toString=function(){return t+""},M}return{format:h,formatPrefix:function(t,n){var e=h(((t=ir(t)).type="f",t)),r=3*Math.max(-8,Math.min(8,Math.floor(ur(n)/3))),i=Math.pow(10,-r),o=gr[8+r/3];return function(t){return e(i*t)+o}}}}({thousands:",",grouping:[3],currency:["$",""]}),fr=hr.format,pr=hr.formatPrefix,vr.prototype={constructor:vr,scale:function(t){return 1===t?this:new vr(this.k*t,this.x,this.y)},translate:function(t,n){return 0===t&0===n?this:new vr(this.k,this.x+this.k*t,this.y+this.k*n)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}},new vr(1,0,0),vr.prototype,window.addEventListener("load",(function(){window.lcpBarGraphData&&Object.entries(window.lcpBarGraphData).forEach((([t,n])=>{const{attributes:e}=n,r=document.getElementById(t);r&&wr(r,e)}))}))})();