@hpcc-js/chart 3.5.0 → 3.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +8683 -8918
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +3 -2
- package/dist/index.umd.cjs.map +1 -1
- package/package.json +6 -6
package/dist/index.umd.cjs
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@hpcc-js/api"),require("@hpcc-js/common"),require("@hpcc-js/util")):"function"==typeof define&&define.amd?define(["exports","@hpcc-js/api","@hpcc-js/common","@hpcc-js/util"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self)["@hpcc-js/chart"]={},t["@hpcc-js/api"],t["@hpcc-js/common"],t["@hpcc-js/util"])}(this,function(t,e,i,n){var o=Object.create,s=Object.defineProperty,a=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,l=Object.getPrototypeOf,h=Object.prototype.hasOwnProperty,c=(t,e,i)=>(i=null!=t?o(l(t)):{},((t,e,i,n)=>{if(e&&"object"==typeof e||"function"==typeof e)for(var o,l=r(e),c=0,u=l.length;c<u;c++)o=l[c],h.call(t,o)||o===i||s(t,o,{get:(t=>e[t]).bind(null,o),enumerable:!(n=a(e,o))||n.enumerable});return t})(!e&&t&&t.__esModule?i:s(i,"default",{value:t,enumerable:!0}),t));e=c(e),i=c(i),n=c(n);var u=Math.PI,p=2*u,d=1e-6,f=p-d;function y(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function _(){return new y}y.prototype=_.prototype={constructor:y,moveTo:function(t,e){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)},closePath:function(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(t,e){this._+="L"+(this._x1=+t)+","+(this._y1=+e)},quadraticCurveTo:function(t,e,i,n){this._+="Q"+ +t+","+ +e+","+(this._x1=+i)+","+(this._y1=+n)},bezierCurveTo:function(t,e,i,n,o,s){this._+="C"+ +t+","+ +e+","+ +i+","+ +n+","+(this._x1=+o)+","+(this._y1=+s)},arcTo:function(t,e,i,n,o){t=+t,e=+e,i=+i,n=+n,o=+o;var s=this._x1,a=this._y1,r=i-t,l=n-e,h=s-t,c=a-e,p=h*h+c*c;if(o<0)throw new Error("negative radius: "+o);if(null===this._x1)this._+="M"+(this._x1=t)+","+(this._y1=e);else if(p>d)if(Math.abs(c*r-l*h)>d&&o){var f=i-s,y=n-a,_=r*r+l*l,x=f*f+y*y,m=Math.sqrt(_),g=Math.sqrt(p),b=o*Math.tan((u-Math.acos((_+p-x)/(2*m*g)))/2),v=b/g,w=b/m;Math.abs(v-1)>d&&(this._+="L"+(t+v*h)+","+(e+v*c)),this._+="A"+o+","+o+",0,0,"+ +(c*f>h*y)+","+(this._x1=t+w*r)+","+(this._y1=e+w*l)}else this._+="L"+(this._x1=t)+","+(this._y1=e);else;},arc:function(t,e,i,n,o,s){t=+t,e=+e,s=!!s;var a=(i=+i)*Math.cos(n),r=i*Math.sin(n),l=t+a,h=e+r,c=1^s,y=s?n-o:o-n;if(i<0)throw new Error("negative radius: "+i);null===this._x1?this._+="M"+l+","+h:(Math.abs(this._x1-l)>d||Math.abs(this._y1-h)>d)&&(this._+="L"+l+","+h),i&&(y<0&&(y=y%p+p),y>f?this._+="A"+i+","+i+",0,1,"+c+","+(t-a)+","+(e-r)+"A"+i+","+i+",0,1,"+c+","+(this._x1=l)+","+(this._y1=h):y>d&&(this._+="A"+i+","+i+",0,"+ +(y>=u)+","+c+","+(this._x1=t+i*Math.cos(o))+","+(this._y1=e+i*Math.sin(o))))},rect:function(t,e,i,n){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)+"h"+ +i+"v"+ +n+"h"+-i+"Z"},toString:function(){return this._}};var x=_;function m(t){return function(){return t}}var g=Math.abs,b=Math.atan2,v=Math.cos,w=Math.max,S=Math.min,A=Math.sin,k=Math.sqrt,M=Math.PI,T=M/2,P=2*M;function C(t){return t>=1?T:t<=-1?-T:Math.asin(t)}function z(t){return t.innerRadius}function I(t){return t.outerRadius}function D(t){return t.startAngle}function F(t){return t.endAngle}function O(t){return t&&t.padAngle}function j(t,e,i,n,o,s,a){var r=t-i,l=e-n,h=(a?s:-s)/k(r*r+l*l),c=h*l,u=-h*r,p=t+c,d=e+u,f=i+c,y=n+u,_=(p+f)/2,x=(d+y)/2,m=f-p,g=y-d,b=m*m+g*g,v=o-s,S=p*y-f*d,A=(g<0?-1:1)*k(w(0,v*v*b-S*S)),M=(S*g-m*A)/b,T=(-S*m-g*A)/b,P=(S*g+m*A)/b,C=(-S*m+g*A)/b,z=M-_,I=T-x,D=P-_,F=C-x;return z*z+I*I>D*D+F*F&&(M=P,T=C),{cx:M,cy:T,x01:-c,y01:-u,x11:M*(o/v-1),y11:T*(o/v-1)}}function R(){var t=z,e=I,i=m(0),n=null,o=D,s=F,a=O,r=null;function l(){var l,h,c,u=+t.apply(this,arguments),p=+e.apply(this,arguments),d=o.apply(this,arguments)-T,f=s.apply(this,arguments)-T,y=g(f-d),_=f>d;if(r||(r=l=x()),p<u&&(h=p,p=u,u=h),p>1e-12)if(y>P-1e-12)r.moveTo(p*v(d),p*A(d)),r.arc(0,0,p,d,f,!_),u>1e-12&&(r.moveTo(u*v(f),u*A(f)),r.arc(0,0,u,f,d,_));else{var m,w,z=d,I=f,D=d,F=f,O=y,R=y,E=a.apply(this,arguments)/2,N=E>1e-12&&(n?+n.apply(this,arguments):k(u*u+p*p)),L=S(g(p-u)/2,+i.apply(this,arguments)),B=L,H=L;if(N>1e-12){var V=C(N/u*A(E)),q=C(N/p*A(E));(O-=2*V)>1e-12?(D+=V*=_?1:-1,F-=V):(O=0,D=F=(d+f)/2),(R-=2*q)>1e-12?(z+=q*=_?1:-1,I-=q):(R=0,z=I=(d+f)/2)}var W=p*v(z),G=p*A(z),$=u*v(F),X=u*A(F);if(L>1e-12){var Y,U=p*v(I),Q=p*A(I),Z=u*v(D),J=u*A(D);if(y<M&&(Y=function(t,e,i,n,o,s,a,r){var l=i-t,h=n-e,c=a-o,u=r-s,p=u*l-c*h;if(!(p*p<1e-12))return[t+(p=(c*(e-s)-u*(t-o))/p)*l,e+p*h]}(W,G,Z,J,U,Q,$,X))){var K=W-Y[0],tt=G-Y[1],et=U-Y[0],it=Q-Y[1],nt=1/A(((c=(K*et+tt*it)/(k(K*K+tt*tt)*k(et*et+it*it)))>1?0:c<-1?M:Math.acos(c))/2),ot=k(Y[0]*Y[0]+Y[1]*Y[1]);B=S(L,(u-ot)/(nt-1)),H=S(L,(p-ot)/(nt+1))}}R>1e-12?H>1e-12?(m=j(Z,J,W,G,p,H,_),w=j(U,Q,$,X,p,H,_),r.moveTo(m.cx+m.x01,m.cy+m.y01),H<L?r.arc(m.cx,m.cy,H,b(m.y01,m.x01),b(w.y01,w.x01),!_):(r.arc(m.cx,m.cy,H,b(m.y01,m.x01),b(m.y11,m.x11),!_),r.arc(0,0,p,b(m.cy+m.y11,m.cx+m.x11),b(w.cy+w.y11,w.cx+w.x11),!_),r.arc(w.cx,w.cy,H,b(w.y11,w.x11),b(w.y01,w.x01),!_))):(r.moveTo(W,G),r.arc(0,0,p,z,I,!_)):r.moveTo(W,G),u>1e-12&&O>1e-12?B>1e-12?(m=j($,X,U,Q,u,-B,_),w=j(W,G,Z,J,u,-B,_),r.lineTo(m.cx+m.x01,m.cy+m.y01),B<L?r.arc(m.cx,m.cy,B,b(m.y01,m.x01),b(w.y01,w.x01),!_):(r.arc(m.cx,m.cy,B,b(m.y01,m.x01),b(m.y11,m.x11),!_),r.arc(0,0,u,b(m.cy+m.y11,m.cx+m.x11),b(w.cy+w.y11,w.cx+w.x11),_),r.arc(w.cx,w.cy,B,b(w.y11,w.x11),b(w.y01,w.x01),!_))):r.arc(0,0,u,F,D,_):r.lineTo($,X)}else r.moveTo(0,0);if(r.closePath(),l)return r=null,l+""||null}return l.centroid=function(){var i=(+t.apply(this,arguments)+ +e.apply(this,arguments))/2,n=(+o.apply(this,arguments)+ +s.apply(this,arguments))/2-M/2;return[v(n)*i,A(n)*i]},l.innerRadius=function(e){return arguments.length?(t="function"==typeof e?e:m(+e),l):t},l.outerRadius=function(t){return arguments.length?(e="function"==typeof t?t:m(+t),l):e},l.cornerRadius=function(t){return arguments.length?(i="function"==typeof t?t:m(+t),l):i},l.padRadius=function(t){return arguments.length?(n=null==t?null:"function"==typeof t?t:m(+t),l):n},l.startAngle=function(t){return arguments.length?(o="function"==typeof t?t:m(+t),l):o},l.endAngle=function(t){return arguments.length?(s="function"==typeof t?t:m(+t),l):s},l.padAngle=function(t){return arguments.length?(a="function"==typeof t?t:m(+t),l):a},l.context=function(t){return arguments.length?(r=null==t?null:t,l):r},l}function E(t){this._context=t}function N(t){return new E(t)}function L(t){return t[0]}function B(t){return t[1]}function H(){var t=L,e=B,i=m(!0),n=null,o=N,s=null;function a(a){var r,l,h,c=a.length,u=!1;for(null==n&&(s=o(h=x())),r=0;r<=c;++r)!(r<c&&i(l=a[r],r,a))===u&&((u=!u)?s.lineStart():s.lineEnd()),u&&s.point(+t(l,r,a),+e(l,r,a));if(h)return s=null,h+""||null}return a.x=function(e){return arguments.length?(t="function"==typeof e?e:m(+e),a):t},a.y=function(t){return arguments.length?(e="function"==typeof t?t:m(+t),a):e},a.defined=function(t){return arguments.length?(i="function"==typeof t?t:m(!!t),a):i},a.curve=function(t){return arguments.length?(o=t,null!=n&&(s=o(n)),a):o},a.context=function(t){return arguments.length?(null==t?n=s=null:s=o(n=t),a):n},a}function V(t,e){return e<t?-1:e>t?1:e>=t?0:NaN}function q(t){return t}function W(t,e,i){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+i)/6)}function G(t){this._context=t}function $(t){return new G(t)}function X(t,e){this._basis=new G(t),this._beta=e}E.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e)}}},G.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:W(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:W(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},X.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var t=this._x,e=this._y,i=t.length-1;if(i>0)for(var n,o=t[0],s=e[0],a=t[i]-o,r=e[i]-s,l=-1;++l<=i;)n=l/i,this._basis.point(this._beta*t[l]+(1-this._beta)*(o+n*a),this._beta*e[l]+(1-this._beta)*(s+n*r));this._x=this._y=null,this._basis.lineEnd()},point:function(t,e){this._x.push(+t),this._y.push(+e)}};var Y=function t(e){function i(t){return 1===e?new G(t):new X(t,e)}return i.beta=function(e){return t(+e)},i}(.85);function U(t,e,i){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-e),t._y2+t._k*(t._y1-i),t._x2,t._y2)}function Q(t,e){this._context=t,this._k=(1-e)/6}Q.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:U(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2,this._x1=t,this._y1=e;break;case 2:this._point=3;default:U(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var Z=function t(e){function i(t){return new Q(t,e)}return i.tension=function(e){return t(+e)},i}(0);function J(t,e){this._context=t,this._alpha=e}J.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var i=this._x2-t,n=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(i*i+n*n,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3;default:!function(t,e,i){var n=t._x1,o=t._y1,s=t._x2,a=t._y2;if(t._l01_a>1e-12){var r=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,l=3*t._l01_a*(t._l01_a+t._l12_a);n=(n*r-t._x0*t._l12_2a+t._x2*t._l01_2a)/l,o=(o*r-t._y0*t._l12_2a+t._y2*t._l01_2a)/l}if(t._l23_a>1e-12){var h=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,c=3*t._l23_a*(t._l23_a+t._l12_a);s=(s*h+t._x1*t._l23_2a-e*t._l12_2a)/c,a=(a*h+t._y1*t._l23_2a-i*t._l12_2a)/c}t._context.bezierCurveTo(n,o,s,a,t._x2,t._y2)}(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var K=function t(e){function i(t){return e?new J(t,e):new Q(t,0)}return i.alpha=function(e){return t(+e)},i}(.5);function tt(t){return t<0?-1:1}function et(t,e,i){var n=t._x1-t._x0,o=e-t._x1,s=(t._y1-t._y0)/(n||o<0&&-0),a=(i-t._y1)/(o||n<0&&-0),r=(s*o+a*n)/(n+o);return(tt(s)+tt(a))*Math.min(Math.abs(s),Math.abs(a),.5*Math.abs(r))||0}function it(t,e){var i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function nt(t,e,i){var n=t._x0,o=t._y0,s=t._x1,a=t._y1,r=(s-n)/3;t._context.bezierCurveTo(n+r,o+r*e,s-r,a-r*i,s,a)}function ot(t){this._context=t}function st(t){this._context=t}function at(t){return new ot(t)}function rt(t){this._context=t}function lt(t){var e,i,n=t.length-1,o=new Array(n),s=new Array(n),a=new Array(n);for(o[0]=0,s[0]=2,a[0]=t[0]+2*t[1],e=1;e<n-1;++e)o[e]=1,s[e]=4,a[e]=4*t[e]+2*t[e+1];for(o[n-1]=2,s[n-1]=7,a[n-1]=8*t[n-1]+t[n],e=1;e<n;++e)i=o[e]/s[e-1],s[e]-=i,a[e]-=i*a[e-1];for(o[n-1]=a[n-1]/s[n-1],e=n-2;e>=0;--e)o[e]=(a[e]-o[e+1])/s[e];for(s[n-1]=(t[n]+o[n-1])/2,e=0;e<n-1;++e)s[e]=2*t[e+1]-o[e+1];return[o,s]}function ht(t){return new rt(t)}function ct(t,e){this._context=t,this._t=e}function ut(t){return new ct(t,.5)}function pt(t){return new ct(t,0)}function dt(t){return new ct(t,1)}ot.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:nt(this,this._t0,it(this,this._t0))}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){var i=NaN;if(e=+e,(t=+t)!==this._x1||e!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,nt(this,it(this,i=et(this,t,e)),i);break;default:nt(this,this._t0,i=et(this,t,e))}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=i}}},(function(t){this._context=new st(t)}.prototype=Object.create(ot.prototype)).point=function(t,e){ot.prototype.point.call(this,e,t)},st.prototype={moveTo:function(t,e){this._context.moveTo(e,t)},closePath:function(){this._context.closePath()},lineTo:function(t,e){this._context.lineTo(e,t)},bezierCurveTo:function(t,e,i,n,o,s){this._context.bezierCurveTo(e,t,n,i,s,o)}},rt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,e=this._y,i=t.length;if(i)if(this._line?this._context.lineTo(t[0],e[0]):this._context.moveTo(t[0],e[0]),2===i)this._context.lineTo(t[1],e[1]);else for(var n=lt(t),o=lt(e),s=0,a=1;a<i;++s,++a)this._context.bezierCurveTo(n[0][s],o[0][s],n[1][s],o[1][s],t[a],e[a]);(this._line||0!==this._line&&1===i)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(t,e){this._x.push(+t),this._y.push(+e)}},ct.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&2===this._point&&this._context.lineTo(this._x,this._y),(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var i=this._x*(1-this._t)+t*this._t;this._context.lineTo(i,this._y),this._context.lineTo(i,e)}}this._x=t,this._y=e}};var ft=Array.prototype.slice;function yt(t){return t}var _t=1e-6;function xt(t){return"translate("+(t+.5)+",0)"}function mt(t){return"translate(0,"+(t+.5)+")"}function gt(t){return function(e){return+t(e)}}function bt(t){var e=Math.max(0,t.bandwidth()-1)/2;return t.round()&&(e=Math.round(e)),function(i){return+t(i)+e}}function vt(){return!this.__axis}function wt(t,e){var i=[],n=null,o=null,s=6,a=6,r=3,l=1===t||4===t?-1:1,h=4===t||2===t?"x":"y",c=1===t||3===t?xt:mt;function u(u){var p=null==n?e.ticks?e.ticks.apply(e,i):e.domain():n,d=null==o?e.tickFormat?e.tickFormat.apply(e,i):yt:o,f=Math.max(s,0)+r,y=e.range(),_=+y[0]+.5,x=+y[y.length-1]+.5,m=(e.bandwidth?bt:gt)(e.copy()),g=u.selection?u.selection():u,b=g.selectAll(".domain").data([null]),v=g.selectAll(".tick").data(p,e).order(),w=v.exit(),S=v.enter().append("g").attr("class","tick"),A=v.select("line"),k=v.select("text");b=b.merge(b.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),v=v.merge(S),A=A.merge(S.append("line").attr("stroke","currentColor").attr(h+"2",l*s)),k=k.merge(S.append("text").attr("fill","currentColor").attr(h,l*f).attr("dy",1===t?"0em":3===t?"0.71em":"0.32em")),u!==g&&(b=b.transition(u),v=v.transition(u),A=A.transition(u),k=k.transition(u),w=w.transition(u).attr("opacity",_t).attr("transform",function(t){return isFinite(t=m(t))?c(t):this.getAttribute("transform")}),S.attr("opacity",_t).attr("transform",function(t){var e=this.parentNode.__axis;return c(e&&isFinite(e=e(t))?e:m(t))})),w.remove(),b.attr("d",4===t||2==t?a?"M"+l*a+","+_+"H0.5V"+x+"H"+l*a:"M0.5,"+_+"V"+x:a?"M"+_+","+l*a+"V0.5H"+x+"V"+l*a:"M"+_+",0.5H"+x),v.attr("opacity",1).attr("transform",function(t){return c(m(t))}),A.attr(h+"2",l*s),k.attr(h,l*f).text(d),g.filter(vt).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",2===t?"start":4===t?"end":"middle"),g.each(function(){this.__axis=m})}return u.scale=function(t){return arguments.length?(e=t,u):e},u.ticks=function(){return i=ft.call(arguments),u},u.tickArguments=function(t){return arguments.length?(i=null==t?[]:ft.call(t),u):i.slice()},u.tickValues=function(t){return arguments.length?(n=null==t?null:ft.call(t),u):n&&n.slice()},u.tickFormat=function(t){return arguments.length?(o=t,u):o},u.tickSize=function(t){return arguments.length?(s=a=+t,u):s},u.tickSizeInner=function(t){return arguments.length?(s=+t,u):s},u.tickSizeOuter=function(t){return arguments.length?(a=+t,u):a},u.tickPadding=function(t){return arguments.length?(r=+t,u):r},u}function St(t){return wt(1,t)}function At(t){return wt(2,t)}function kt(t){return wt(3,t)}function Mt(t){return wt(4,t)}var Tt=class extends i.SVGWidget{_origType;_origTimePattern;parser;parserInvert;formatter;d3Scale;d3Axis;d3Guides;_guideElement;svg;svgAxis;svgGuides;constructor(t="origin"){super(),this._drawStartPos=t,this.updateScale()}lowValue(){return this.parse(this.low())}highValue(){return this.parse(this.high())}parse(t,e){if(t instanceof Array)return t.map(function(t){return this.parse(t)},this);if(null!=t){if(this.parser)return this.parser("number"==typeof t?t.toString():t);if(e&&"string"==typeof t)return+t}return t}parseInvert(t){return t instanceof Array?t.map(function(t){return this.parseInvert(t)},this):this.parserInvert&&t?this.parserInvert(t):t}format(t){return t instanceof Array?t.map(function(t){return this.format(t)},this):null!=t&&this.formatter?this.formatter(t):t}parseFormat(t){return this.format(this.parse(t))}scalePos(t){let e=this.d3Scale(this.parse(t));return"ordinal"===this.type()&&(e+=this.bandwidth()/2),e}bandwidth(){return this.d3Scale.bandwidth?this.d3Scale.bandwidth():0}isHorizontal(){switch(this.orientation()){case"left":case"right":return!1}return!0}domain(t){return arguments.length?(this.d3Scale.domain(t),this):this.d3Scale.domain()}range(t){if(!arguments.length){if(this.d3Scale.rangeRoundBands)return this.d3Scale.rangeExtent();if(this.d3Scale.rangeRound)return this.d3Scale.range()}return this.d3Scale.rangeRoundBands?this.d3Scale.rangeRoundBands(t,.1):this.d3Scale.rangeRound&&this.d3Scale.range(t),this}invert(t){return this.d3Scale.invert(t)}guideTarget(t){return this._guideElement=(0,i.select)(t).attr("class",this._class),this}enter(t,e){super.enter(t,e),this.svg=e.append("g"),this.svgAxis=this.svg.append("g").attr("class","axis"),this.svgGuides=(this._guideElement||e).append("g").attr("class","guide")}_prevOrientation;updateScale(){switch(this.type()){case"ordinal":if(this.d3Scale=(0,i.scaleBand)().paddingInner(this.ordinalPaddingInner()).paddingOuter(this.ordinalPaddingOuter()),this.ordinals_exists()&&this.d3Scale.domain(this.ordinals()),this.parser=null,this.ordinalMappings_exists()){const t=this.ordinalMappings();this.formatter=e=>t[e]||e}else this.formatter=null;break;case"linear":this.d3Scale=(0,i.scaleLinear)(),this.low_exists()&&this.high_exists()&&this.d3Scale.domain([this.lowValue(),this.highValue()]),this.parser=null,this.formatter=this.tickFormat_exists()?(0,i.format)(this.tickFormat()):null;break;case"pow":this.d3Scale=(0,i.scalePow)().exponent(this.powExponent()),this.low_exists()&&this.high_exists()&&this.d3Scale.domain([this.lowValue(),this.highValue()]),this.parser=null,this.formatter=this.tickFormat_exists()?(0,i.format)(this.tickFormat()):null;break;case"log":this.d3Scale=(0,i.scaleLog)().base(this.logBase()),this.low_exists()&&this.high_exists()&&this.d3Scale.domain([this.lowValue(),this.highValue()]),this.parser=null,this.formatter=this.tickFormat_exists()?(0,i.format)(this.tickFormat()):null;break;case"time":this.d3Scale=(0,i.scaleTime)(),this.low_exists()&&this.high_exists()&&this.d3Scale.domain([this.lowValue(),this.highValue()]),this.parser=this.timePattern_exists()?(0,i.timeParse)(this.timePattern()):null,this.parserInvert=this.timePattern_exists()?(0,i.timeFormat)(this.timePattern()):null,this.formatter=this.tickFormat_exists()?(0,i.timeFormat)(this.tickFormat()):null}if(this._prevOrientation!==this.orientation()){switch(this.orientation()){case"left":this.d3Axis=Mt(this.d3Scale),this.d3Guides=Mt(this.d3Scale);break;case"top":this.d3Axis=St(this.d3Scale),this.d3Guides=St(this.d3Scale);break;case"right":this.d3Axis=At(this.d3Scale),this.d3Guides=At(this.d3Scale);break;default:this.d3Axis=kt(this.d3Scale),this.d3Guides=kt(this.d3Scale)}this._prevOrientation=this.orientation(),this.svgAxis&&this.svgAxis.html(""),this.svgGuides&&this.svgGuides.html("")}if(this.extend())if("ordinal"===this.type());else{let t,e,i,n,o,s;this.isHorizontal()?(t=this.width(),this.d3Scale.range([0,t]),e=t*this.extend()/100,i=this.d3Scale.invert(0),o=this.d3Scale.invert(-e),n=this.d3Scale.invert(t),s=this.d3Scale.invert(t+e)):(t=this.height(),this.d3Scale.range([t,0]),e=t*this.extend()/100,i=this.d3Scale.invert(t),o=this.d3Scale.invert(t+e),n=this.d3Scale.invert(0),s=this.d3Scale.invert(-e)),o===i&&(o=i-i*this.extend()/100),s===n&&(s=n+n*this.extend()/100),Math.sign(i)!==Math.sign(o)&&(o=0),Math.sign(n)!==Math.sign(s)&&(s=0),this.d3Scale.domain([o,s])}this.d3Axis.scale(this.d3Scale).tickFormat(this.formatter).ticks(this.tickCount()),this.d3Guides.scale(this.d3Scale).tickSize(this.tickLength_exists()?-this.tickLength():0).tickFormat("").ticks(this.tickCount());const t=this.ticks();return t.length&&(this.d3Axis.tickValues(t.map(t=>this.parse(t.value))).tickFormat((e,i)=>t[i].label),this.d3Guides.tickValues(t.map(t=>this.parse(t.value)))),this}adjustText(t,e){const n=this.isHorizontal(),o="left"===this.orientation(),s="bottom"===this.orientation(),a=this,r=t.selectAll(".tick > text").style("font-family",this.fontFamily()).style("font-size",this.fontSize_exists()?this.fontSize()+"px":null);if("linebreak"===this.overlapMode())"ordinal"===this.type()&&r.call(function(){return a.linebreak.apply(a,arguments)},this.bandwidth());else if("wrap"===this.overlapMode())"ordinal"===this.type()&&r.call(function(){return a.wrap.apply(a,arguments)},this.bandwidth());else switch(n?this.overlapMode():"none"){case"stagger":r.style("text-anchor","middle").attr("dy",function(t,i){return(s?1:-1)*((s?.71:0)+i%e)+"em"}).attr("dx",0).attr("visibility",null).attr("transform","rotate(0)");break;case"hide":r.style("text-anchor","middle").attr("dy",(s?.71:0)+"em").attr("dx",0).attr("visibility",function(t,i){return i%e?"hidden":null}).attr("transform","rotate(0)");break;case"rotate":const t=-this.labelRotation()||0;if(0!==t&&e>1){r.each(function(){const e=(0,i.select)(this),n=e.node().getBBox(),o=(s?1:-1)*Math.sin(Math.PI*(-Math.abs(t)/180));e.style("text-anchor",t>0?s?"start":"end":s?"end":"start").attr("dy",n.height/2*o+"px").attr("dx",t>0?s?"0.71em":"-0.71em":s?"-0.71em":"0.71em").attr("transform","rotate("+t+")").attr("visibility",null)});break}default:r.style("text-anchor",n?"middle":o?"end":"start").attr("dy",n?(s?.71:0)+"em":"0.32em").attr("dx",0).attr("visibility",null).attr("transform","rotate(0)")}}calcTickOverlapModulus(t){let e=1;switch(this.overlapMode()){case"rotate":case"stagger":case"hide":const i=[];t.selectAll(".tick > text").each(function(){const t=this.getBoundingClientRect();for(let n=i.length-1;n>=0&&!(i[n].right<t.left);--n)i.length+1-n>e&&(e=i.length+1-n);i.push(t)})}return e}calcOverflow(t,e){if(this.updateScale(),this.hidden())return{left:0,top:0,right:0,bottom:0,depth:0,tickOverlapModulus:1};const i=this.isHorizontal();this.range(i?[0,this.width()]:[this.height(),0]);const n=t.append("g").attr("class",this.classID()),o=n.append("g");o.attr("class",i?"x":"y").call(this.d3Axis),e&&t.selectAll(".tick > text").remove();const s={left:0,top:0,right:0,bottom:0,depth:0,tickOverlapModulus:this.calcTickOverlapModulus(o)};this.adjustText(o,s.tickOverlapModulus);const a=o.node().getBBox();switch(s.depth=i?a.height:a.width,this.shrinkToFit()){case"low":case"both":s.left=i?-a.x:0,s.bottom=i?0:-(this.height()-(a.height+a.y))}switch(this.shrinkToFit()){case"high":case"both":s.top=i?0:-a.y,s.right=i?-(this.width()-a.x-a.width):0}return n.remove(),s}wrap(t,e,n){n=n||/\s+/;const o=this;t.each(function(){const t=(0,i.select)(this),s=t.text().split(n).reverse();let a=[],r=0;const l=t.attr("x"),h=t.attr("y"),c=parseFloat(t.style("font-size"))||10,u=Math.floor(e/(1.1*c))-1,p=o.isHorizontal()?1:Math.ceil(s.length/u),d=parseFloat(t.attr("dy"));let f=t.text(null).append("tspan").attr("x",l).attr("y",h).attr("dy",d+"em"),y=0,_=s.pop();for(;_;)a.push(_),f.text(a.join(" ")),y++,f.node().getComputedTextLength()>e&&y>=p&&(a.pop(),f.text(a.join(" ")),a=[_],f=t.append("tspan").attr("x",l).attr("y",h).attr("dy",1.1*++r+d+"em").text(_),y=0),_=s.pop();o.isHorizontal()||t.selectAll("tspan").attr("y",-r/2+"em")})}linebreak(t,e){this.wrap(t,e,"\n")}update(t,e){super.update(t,e),this.svg.style("display",this.hidden()?"none":null);const i=this.calcOverflow(e),n=this.isHorizontal()?i.left:this.height()-i.top-i.bottom,o=this.isHorizontal()?this.width()-i.right-this.padding():0+this.padding();this.range(this.reverse()?[o,n]:[n,o]);const s=this;function a(t){t.attr("transform",function(){switch(s.orientation()){case"left":return"translate("+i.depth+", "+i.top+")";case"top":return"translate(0,"+i.depth+")";case"right":return"translate("+(s.width()-i.depth)+", "+i.top+")";case"bottom":return"translate(0,"+(s.height()-i.depth)+")"}return"translate(0,0)"})}this.svg.style("visibility","none"===this.type()?"hidden":null).transition().call(a),this._guideElement&&this.svgGuides.transition().call(a),this.svgAxis.call(this.d3Axis),this.adjustText(this.svgAxis,i.tickOverlapModulus);this.pos().x;const r=this.width(),l=this.svgAxis.selectAll(".axisTitle").data(this.title()?[this.title()]:[]),h=l.enter().append("text").attr("class","axisTitle").merge(l).transition().attr("dx",null).style("text-anchor","end");switch(this.orientation()){case"left":h.attr("transform","rotate(-90)").attr("x",-2).attr("y",2).attr("dy",".71em");break;case"right":h.attr("transform","rotate(-90)").attr("x",-2).attr("y",4).attr("dx",null).attr("dy","-.71em");break;case"top":h.attr("transform","rotate(0)").attr("x",r-2).attr("y",2).attr("dx",null).attr("dy",".71em");break;case"bottom":h.attr("transform","rotate(0)").attr("x",r-2).attr("y",-2).attr("dy",null)}h.text(this.title_exists()?this.title():""),l.exit().remove(),this.svgGuides.call(this.d3Guides).selectAll(".tick").classed("guide-0",t=>0===t&&this.low()<0)}rerender(){this.svgAxis.call(this.d3Axis),this.svgGuides.call(this.d3Guides)}postUpdate(t,e){super.postUpdate(t,e),this._guideElement&&this._guideElement.attr("transform",this._element.attr("transform"))}};Tt.prototype._class+=" chart_Axis",Tt.prototype.publish("type","linear","set","Type",["none","ordinal","linear","pow","log","time"]),Tt.prototype.publish("timePattern","%Y-%m-%d","string","Time Series Pattern",null,{disable:t=>"time"!==t.type()}),Tt.prototype.publish("reverse",!1,"boolean","Reverse"),Tt.prototype.publish("title",null,"string","Title"),Tt.prototype.publish("orientation","bottom","set","Placement/orientation of the axis",["left","top","right","bottom"]),Tt.prototype.publish("powExponent",2,"number","Power exponent (disabled when type is not 'pow')",null,{disable:t=>"pow"!==t.type()}),Tt.prototype.publish("logBase",10,"number","Logarithmic base (disabled when type is not 'log')",null,{disable:t=>"log"!==t.type()}),Tt.prototype.publish("ordinals",[],"array","Array of ordinal values to display (disabled when type is not 'ordinal')",null,{disable:t=>"ordinal"!==t.type()}),Tt.prototype.publish("fontSize",null,"number","Size of tick label font (pixels)",null,{optional:!0}),Tt.prototype.publish("fontFamily",null,"string","Font family of tick labels",null,{optional:!0}),Tt.prototype.publish("tickCount",null,"number","Number of ticks to display (disabled when type is 'ordinal')",null,{optional:!0,disable:t=>"ordinal"===t.type()}),Tt.prototype.publish("tickFormat",null,"string","Format rules for tick text (disabled when type is 'ordinal')",null,{optional:!0,disable:t=>"ordinal"===t.type()}),Tt.prototype.publish("tickLength",null,"number","Height (or width for left/right orientations) of the axis ticks (in pixels)",null,{optional:!0}),Tt.prototype.publish("ticks",[],"array","Custom tick labels",null,{optional:!0}),Tt.prototype.publish("low",null,"any","Minimum tick value (disabled when type is ordinal)",null,{optional:!0,disable:t=>"ordinal"===t.type()}),Tt.prototype.publish("high",null,"any","Maximum tick value (disabled when type is ordinal)",null,{optional:!0,disable:t=>"ordinal"===t.type()}),Tt.prototype.publish("overlapMode","none","set","Specifies the behavior when tick labels overlap",["none","stagger","hide","rotate","linebreak","wrap"]),Tt.prototype.publish("labelRotation",33,"number","Angle of rotation for tick labels (disabled when overlapMode is not 'rotate')",null,{optional:!0,disable:t=>"rotate"!==t.overlapMode()}),Tt.prototype.publish("shrinkToFit","both","set","shrinkToFit",["none","low","high","both"]),Tt.prototype.publish("extend",5,"number","Extend the axis range by this % beyond what is needed to display the data (disabled when type is 'ordinal')",null,{optional:!0,disable:t=>"ordinal"===t.type()}),Tt.prototype.publish("hidden",!1,"boolean","Hides axis when 'true'"),Tt.prototype.publish("ordinalPaddingInner",.1,"number","Determines the ratio of the range that is reserved for blank space between band (0->1)",null,{disable:t=>"ordinal"!==t.type()}),Tt.prototype.publish("ordinalPaddingOuter",.1,"number","Determines the ratio of the range that is reserved for blank space before the first band and after the last band (0->1)",null,{disable:t=>"ordinal"!==t.type()}),Tt.prototype.publish("ordinalMappings",null,"object","Alternative label mappings (icons)",null,{optional:!0}),Tt.prototype.publish("padding",0,"number","Padding space at top of axis (pixels)",null,{optional:!0}),Tt.prototype._origType=Tt.prototype.type,Tt.prototype.type=function(t){const e=Tt.prototype._origType.apply(this,arguments);return void 0!==t&&(this._type=t,this.updateScale()),e},Tt.prototype._origTimePattern=Tt.prototype.timePattern,Tt.prototype.timePattern=function(t){const e=Tt.prototype._origTimePattern.apply(this,arguments);return void 0!==t&&(this._timePattern=t,this.updateScale()),e};var Pt=class extends i.SVGWidget{domainAxis;valueAxis;xAxis;yAxis;xyBrush;xBrush;yBrush;margin;focusChart;constructor(){super(),i.Utility.SimpleSelectionMixin.call(this),this._drawStartPos="origin",this.domainAxis=(new Tt).classed({domain:!0}).orientation_default("bottom").type("ordinal").overlapMode_default("stagger").shrinkToFit_default("high").extend_default(0),this.valueAxis=(new Tt).classed({value:!0}).orientation_default("left").type("linear").shrinkToFit_default("high"),this.xyBrush=(0,i.brush)().on("end",()=>this.brushMoved()).on("start.handle brush.handle end.handle",()=>this.brushMoved2()),this.xBrush=(0,i.brushX)().on("end",()=>this.brushMoved()).on("start.handle brush.handle end.handle",()=>this.brushMoved2()),this.yBrush=(0,i.brushY)().on("end",()=>this.brushMoved()).on("start.handle brush.handle end.handle",()=>this.brushMoved2())}_prevBrush;resetSelection(){return this._prevBrush=null,this}parseData(t){return this.domainAxis.parse(t)}parseValue(t){return this.valueAxis.parse(t,!0)}formatData(t){return this.domainAxis.format(t)}formatValue(t){return this.valueAxis.format(t)}parsedData(){return this.data().map(function(t){let e=0;return t.map(function(t,i){if(0===i)return this.parseData(t);if(i>=this.columns().length)return t;const n=this.yAxisStacked()?[e,e+this.parseValue(t)]:this.parseValue(t);return e+=this.parseValue(t),n},this)},this)}bandwidth(){return this.domainAxis.bandwidth()}svg;svgRegions;svgDomainGuide;svgValueGuide;svgData;svgDataClipRect;svgFocus;svgBrush;enter(t,e){super.enter(t,e),this.svg=e.append("g"),this.svgRegions=e.append("g"),this.svgDomainGuide=this.svg.append("g"),this.svgValueGuide=this.svg.append("g"),this.svgData=this.svg.append("g"),this.svgDataClipRect=this.svg.append("clipPath").attr("id",this.id()+"_clippath").append("rect").attr("x",0).attr("y",0),this.svgData=this.svg.append("g").attr("clip-path","url(#"+this.id()+"_clippath)"),this._selection.widgetElement(this.svgData),this.svgFocus=e.append("g"),this.domainAxis.target(this.svg.node()).guideTarget(this.svgDomainGuide.node()),this.valueAxis.target(this.svg.node()).guideTarget(this.svgValueGuide.node()),this.svgBrush=e.append("g").attr("class","brush"),this.chartsEnter(this,this.svgData,250)}resizeBrushHandle(t,e,i){let n,o,s;return"e"===t.type||"w"===t.type?(n=+("e"===t.type),o=n?1:-1,s=i/3,"M"+.5*o+","+s+"A6,6 0 0 "+n+" "+6.5*o+","+(s+6)+"V"+(2*s-6)+"A6,6 0 0 "+n+" "+.5*o+","+2*s+"ZM"+2.5*o+","+(s+8)+"V"+(2*s-8)+"M"+4.5*o+","+(s+8)+"V"+(2*s-8)):(n=+("s"===t.type),s=n?1:-1,o=e/3,"M"+o+", "+.5*s+"A6,6 0 0 "+(n+1)%2+" "+(o+6)+","+6.5*s+"H"+(2*o-6)+"A6,6 0 0 "+(n+1)%2+" "+2*o+","+.5*s+"ZM"+(o+8)+","+2.5*s+"H"+(2*o-8)+"M"+(o+8)+","+4.5*s+"H"+(2*o-8))}_skipSelection=!1;skipSelection(t){return arguments.length?(this._skipSelection=t,this):this._skipSelection}brushMoved(){if(this._skipSelection)return;let t=[];const e=this,n=(0,i.brushSelection)(this.svgBrush.node());n&&(t=this.data().filter(function(t){const i=e.dataPos(t[0]);if(e.use2dSelection()){const o=e.valuePos(t[1])+e.valueAxis.bandwidth()/2;return i>=n[0][0]&&i<=n[1][0]&&o>=n[0][1]&&o<=n[1][1]}return i>=n[0]&&i<=n[1]})),this.selection(t)}brushMoved2(){const t="horizontal"===this.orientation(),e=this.use2dSelection()?[]:t?[{type:"w"},{type:"e"}]:[{type:"n"},{type:"s"}],n=this.svgBrush.selectAll(".handle--custom").data(e),o=(0,i.d3Event)()?.selection;null==o?n.attr("display","none"):t?n.attr("display",null).attr("transform",(t,e)=>"translate("+o[e]+",0)"):n.attr("display",null).attr("transform",(t,e)=>"translate(0, "+o[e]+")")}dataPos(t){return this.domainAxis.scalePos(t)}valuePos(t){return this.valueAxis.scalePos(t)}getAxisSize(t){return{width:this.xAxis?this.xAxis.width():t.xAxis.width(),height:this.yAxis?this.yAxis.height():t.yAxis.width()}}calcMargin(t,e,i){const n={top:!i&&this.selectionMode()?10:2,right:i&&(this.selectionMode()||this.xAxisFocus())?10:2,bottom:(this.xAxisFocus()?this.xAxisFocusHeight():0)+2,left:2},o=this.width()-n.left-n.right,s=this.height()-n.top-n.bottom;let a=0,r=30,l=0,h=30;for(let c=0;c<10;++c){this.xAxis.width(o-h).height(0);const t=this.xAxis.calcOverflow(e),i=t.depth;this.yAxis.width(0).height(s-r);const n=this.yAxis.calcOverflow(e),c=n.depth;if(a=t.right,l=n.top,i===r&&c===h)break;r=i,h=c}return this.xAxis.x(o/2+h/2+n.left).y(s+n.top).width(o-h),this.yAxis.x(n.left).y(s/2-r/2+n.top).height(s-r),n.left+=h,n.top+=l,n.right+=a,n.bottom+=r,n}updateRegions(t,e,n){const o=this,s=this.svgRegions.selectAll(".region").data(this.regions());s.enter().append("rect").attr("class","region"),n?s.attr("x",function(t){return o.dataPos(t.x0)}).attr("y",0).attr("width",function(t){return o.dataPos(t.x1)-o.dataPos(t.x0)}).attr("height",this.height()).style("stroke",function(t){return o._palette(t.colorID)}).style("fill",function(t){return(0,i.hsl)(o._palette(t.colorID)).brighter()}):s.attr("x",0).attr("y",function(t){return o.dataPos(t.x0)}).attr("width",this.width()).attr("height",function(t){return o.dataPos(t.x0)-o.dataPos(t.x1)}).style("stroke",function(t){return o._palette(t.colorID)}).style("fill",function(t){return(0,i.hsl)(o._palette(t.colorID)).brighter()}),s.exit().remove()}_prevXAxisType;update(t,e){super.update(t,e);const n=this,o="horizontal"===this.orientation();if(this.updateRegions(t,e,o),this.domainAxis.orientation(o?"bottom":"left").title(this.xAxisTitle_exists()?this.xAxisTitle():this.columns()[0]),this.valueAxis.orientation(o?"left":"bottom"),this.xAxis=o?this.domainAxis:this.valueAxis,this.yAxis=o?this.valueAxis:this.domainAxis,"ordinal"===this.xAxisType()){const t=this.columns().length,e={};this.domainAxis.ordinals(this.data().map(function(i){return e[i[0]]=n.xAxisOrdinalMapping(i,i[t]),i[0]})).ordinalMappings(e)}else{const t=this.xAxisDomainLow()?this.xAxisDomainLow():this.domainAxis.parseInvert((0,i.min)(this.parsedData(),function(t){return t[0]})),e=this.xAxisDomainHigh()?this.xAxisDomainHigh():this.domainAxis.parseInvert((0,i.max)(this.parsedData(),function(t){return t[0]}));void 0!==t&&void 0!==e&&this.domainAxis.low(t).high(e)}const s=this.yAxisDomainLow()?this.yAxisDomainLow():this.valueAxis.parseInvert((0,i.min)(this.parsedData(),function(t){return(0,i.min)(t.filter(function(t,e){return e>0&&n.columns()[e]&&0!==n.columns()[e].indexOf("__")&&null!==t}),function(t){return t instanceof Array?t[0]:t})})),a=this.yAxisDomainHigh()?this.yAxisDomainHigh():this.valueAxis.parseInvert((0,i.max)(this.parsedData(),function(t){return(0,i.max)(t.filter(function(t,e){return e>0&&n.columns()[e]&&0!==n.columns()[e].indexOf("__")&&null!==t}),function(t){return t instanceof Array?t[1]:t})}));this.valueAxis.low(s).high(a),this.margin=this.calcMargin(t,e,o);let r=this.width()-this.margin.left-this.margin.right;r<0&&(r=0);let l=this.height()-this.margin.top-this.margin.bottom;l<0&&(l=0);const h=o?r:l,c=o?l:r;if(this.domainAxis.tickLength(this.xAxisGuideLines()?c:0).render(),this.valueAxis.tickLength(this.yAxisGuideLines()?h:0).render(),this.svgDataClipRect.attr("width",r).attr("height",l),this.svgData.transition().attr("transform","translate("+this.margin.left+","+this.margin.top+")"),this.updateBrush(r,l,h,o),this.updateFocusChart(t,e,this.margin,r,l,o),this.chartsUpdate(r,l,250),this.selectionMode())return this.brushMoved()}updateBrush(t,e,n,o){const s=this.use2dSelection()?this.xyBrush:o?this.xBrush:this.yBrush,a=(0,i.brushSelection)(this.svgBrush.node());s.extent([[0,0],[t,e]]),this.svgBrush.attr("transform","translate("+this.margin.left+", "+this.margin.top+")").style("display",this.selectionMode()?null:"none").call(s);const r=this.use2dSelection()?[]:o?[{type:"w"},{type:"e"}]:[{type:"n"},{type:"s"}],l=this.svgBrush.selectAll(".handle--custom").data(r);if(l.enter().append("path").attr("class","handle--custom").merge(l).attr("cursor",o?"ew-resize":"ns-resize").attr("d",i=>this.resizeBrushHandle(i,t,e)),this.selectionMode()){if(this._prevXAxisType!==this.xAxisType()&&(this._prevXAxisType=this.xAxisType(),this._prevBrush=null),this._prevBrush){if(a){if(this._prevBrush.orientation!==this.orientation()){const t=a[0];a[0]=this._prevBrush.maxCurrExtent-a[1],a[1]=this._prevBrush.maxCurrExtent-t}const t=n/this._prevBrush.maxCurrExtent;1!==t&&this.svgBrush.transition().on("start",function(){s.on("end",null)}).call(s.move,[a[0]*t,a[1]*t]).on("end",()=>{s.on("end",()=>this.brushMoved())})}}else this.svgBrush.call(s.move,[0,n]);this._prevBrush={orientation:this.orientation(),maxCurrExtent:n}}}updateFocusChart(t,e,i,n,o,s){const a=this,r=this.svgFocus.selectAll("#"+this.id()+"_focusChart").data(this.xAxisFocus()?[!0]:[]);r.enter().append("g").attr("id",this.id()+"_focusChart").attr("class","focus").each(function(){a.focusChart=(new a.constructor).target(this),a.focusChart.xBrush.on("brush.focus",function(){a.syncAxis(n),a.chartsUpdate(n,o,0)}),a.focusChart.layers(a.layers().map(t=>new t.constructor))}).merge(r).each(function(){a.copyPropsTo(a.focusChart,["layers"]);let t=0;for(const e of a.layers())e.copyPropsTo(a.focusChart.layers()[t]),t++;a.focusChart.xAxisFocus(!1).selectionMode(!0).skipSelection(!0).orientation("horizontal").xAxisGuideLines(!1).xAxisDomainLow(null).xAxisDomainHigh(null).yAxisGuideLines(!1).x(a.width()/2).y(a.height()-a.xAxisFocusHeight()/2).width(a.width()).height(a.xAxisFocusHeight()).columns(a.columns()).data(a.data()).render(),a.syncAxis(n)}),r.exit().each(function(){a.focusChart&&(a.focusChart.target(null),delete a.focusChart)}).remove()}syncAxis(t){const e=(0,i.brushSelection)(this.focusChart.svgBrush.node());if(e){if("ordinal"!==this.focusChart.xAxisType())this.xAxis.domain([this.focusChart.xAxis.invert(e[0]),this.focusChart.xAxis.invert(e[1])]);else{const i=(e[1]-e[0])/t;this.xAxis.range([-e[0]/i,(t-e[0])/i])}this.xAxis.rerender()}}layerColumns(t){const e=t.columns(),i=super.columns().filter(t=>t!==e[0]);return i.length?[e[0],...i]:e}layerColumnIndices(t){const e=t.columns();return this.layerColumns(t).map(t=>e.indexOf(t))}layerColumnIndex(t,e){return t.columns().indexOf(e)}layerData(t){if(1===arguments.length){const e=this.layerColumnIndices(t);return t.data().map(t=>{const i=e.map(e=>t[e]);return i.__hpcc_origRow=t,i})}throw new Error("Setting data on XYAxisLayer is not supported.")}layerEnter(t,e,i=250){}layerUpdate(t,e,i=250){}layerExit(t,e,i=250){}chartsEnter(t,e,i=250){this.layerEnter(this,e,i);for(const n of this.layers())n.__xyAxisElement=e.append("g").attr("class",n.class()),n.target(n.__xyAxisElement.node()).layerEnter(this,e,i)}chartsUpdate(t,e,i){this.layerUpdate(this,this.svgData,i);for(const n of this.layers())n.resize({width:t,height:e}).layerUpdate(this,n.__xyAxisElement,i)}exit(t,e){this.valueAxis.target(null),this.domainAxis.target(null),super.exit(t,e)}selection(t){const e=this;this._selection.widgetElement().selectAll(".selected,.deselected").each(function(n){const o=t.indexOf(n.origRow)>=0;(0,i.select)(this).classed("selected",o).classed("deselected",!o).attr("filter",e._selection.svgGlowID()&&o?`url(#${e._selection.svgGlowID()})`:null)});const n=t.map(t=>this.rowToObj(t));setTimeout(()=>{this.click(n,"",!0)},0)}xAxisOrdinalMapping(t,e){return t[0]}click(t,e,i){}_selection};Pt.prototype._class+=" chart_XYAxis",Pt.prototype.mixin(i.Utility.SimpleSelectionMixin),Pt.prototype.publish("orientation","horizontal","set","Selects orientation for the axis",["horizontal","vertical"]),Pt.prototype.publish("pointSizeColumn",null,"string","pointSizeColumn",null,{optional:!0}),Pt.prototype.publish("minPointSize",6,"number","minPointSize"),Pt.prototype.publish("maxPointSize",26,"number","maxPointSize"),Pt.prototype.publish("use2dSelection",!1,"boolean","2D Range Selector"),Pt.prototype.publish("selectionMode",!1,"boolean","Range Selector"),Pt.prototype.publishProxy("xAxisTitle","domainAxis","title"),Pt.prototype.publishProxy("xAxisTickCount","domainAxis","tickCount"),Pt.prototype.publishProxy("xAxisTickFormat","domainAxis","tickFormat"),Pt.prototype.publishProxy("xAxisTicks","domainAxis","ticks"),Pt.prototype.publishProxy("xAxisType","domainAxis","type"),Pt.prototype.publishProxy("xAxisTypeTimePattern","domainAxis","timePattern"),Pt.prototype.publish("xAxisDomainLow",null,"string","X-Axis Low",null,{optional:!0,disable:t=>"ordinal"===t.xAxisType()}),Pt.prototype.publish("xAxisDomainHigh",null,"string","X-Axis High",null,{optional:!0,disable:t=>"ordinal"===t.xAxisType()}),Pt.prototype.publishProxy("xAxisFontSize","domainAxis","fontSize"),Pt.prototype.publishProxy("xAxisFontFamily","domainAxis","fontFamily"),Pt.prototype.publishProxy("xAxisOrdinalPaddingInner","domainAxis","ordinalPaddingInner"),Pt.prototype.publishProxy("xAxisOrdinalPaddingOuter","domainAxis","ordinalPaddingOuter"),Pt.prototype.publishProxy("xAxisOverlapMode","domainAxis","overlapMode"),Pt.prototype.publishProxy("xAxisLabelRotation","domainAxis","labelRotation"),Pt.prototype.publishProxy("xAxisDomainPadding","domainAxis","extend"),Pt.prototype.publish("xAxisGuideLines",!1,"boolean","Y-Axis Guide Lines"),Pt.prototype.publish("xAxisFocus",!1,"boolean","X-Axis Focus",null,{disable:t=>"horizontal"!==t.orientation()}),Pt.prototype.publish("xAxisFocusHeight",80,"number","X-Axis Focus Height",null,{disable:t=>!t.xAxisFocus()}),Pt.prototype.publishProxy("xAxisHidden","domainAxis","hidden"),Pt.prototype.publishProxy("yAxisFontSize","valueAxis","fontSize"),Pt.prototype.publishProxy("yAxisFontFamily","valueAxis","fontFamily"),Pt.prototype.publishProxy("yAxisTitle","valueAxis","title"),Pt.prototype.publishProxy("yAxisTickCount","valueAxis","tickCount"),Pt.prototype.publishProxy("yAxisTickFormat","valueAxis","tickFormat"),Pt.prototype.publishProxy("yAxisTicks","valueAxis","ticks"),Pt.prototype.publishProxy("yAxisType","valueAxis","type"),Pt.prototype.publishProxy("yAxisTypeTimePattern","valueAxis","timePattern"),Pt.prototype.publishProxy("yAxisTypePowExponent","valueAxis","powExponent"),Pt.prototype.publishProxy("yAxisTypeLogBase","valueAxis","logBase"),Pt.prototype.publish("yAxisStacked",!1,"boolean","Stacked Chart",null,{tags:["Basic"],disable:t=>"ordinal"!==t.xAxisType()||t._class.indexOf("chart_Column")<0}),Pt.prototype.publish("yAxisDomainLow",null,"string","Y-Axis Low",null,{optional:!0,disable:t=>"ordinal"===t.yAxisType()}),Pt.prototype.publish("yAxisDomainHigh",null,"string","Y-Axis High",null,{optional:!0,disable:t=>"ordinal"===t.yAxisType()}),Pt.prototype.publishProxy("yAxisDomainPadding","valueAxis","extend"),Pt.prototype.publish("yAxisGuideLines",!0,"boolean","Y-Axis Guide Lines"),Pt.prototype.publishProxy("yAxisHidden","valueAxis","hidden"),Pt.prototype.publish("regions",[],"array","Regions"),Pt.prototype.publish("layers",[],"widgetArray","Layers",null,{render:!1}),Pt.prototype.publishProxy("xAxisPadding","domainAxis","padding"),Pt.prototype.publishProxy("yAxisPadding","valueAxis","padding");var Ct=class extends Pt{static __inputs=[{id:"label",type:"any"},{id:"values",type:"number",multi:!0}];constructor(){super(),e.INDChart.call(this),e.ITooltip.call(this),this.xAxisGuideLines_default(!0).yAxisGuideLines_default(!0)}xPos(t,e){return"horizontal"===t.orientation()?t.dataPos(e.label):t.valuePos(e.value)}yPos(t,e){return"horizontal"===t.orientation()?t.valuePos(e.value):t.dataPos(e.label)}curve(){switch(this.interpolate()){case"linear":return N;case"step":return ut;case"step-before":return pt;case"step-after":return dt;case"basis":return $;case"bundle":return Y;case"cardinal":return Z;case"catmullRom":return K;case"natural":return ht;default:return at}}getScale(){switch(this.pointSizeScale()){case"linear":return(0,i.scaleLinear)();case"pow":return(0,i.scalePow)().exponent(2);case"log":return(0,i.scaleLog)();case"sqrt":return(0,i.scaleSqrt)()}}pointColor(t,e,i,n){return this.interpolate()&&this.pointDarken()?this.strokeColor(t,e,i,n):this.fillColor(t,e,i,n)}lineColor(t,e,i,n){return this.interpolateFill()&&this.interpolateDarken()?this.strokeColor(t,e,i,n):this.fillColor(t,e,i,n)}areaColor(t,e,i,n){return this.fillColor(t,e,i,n)}layerEnter(t,e,i=250){super.layerEnter(t,e,i);const n=this;this.tooltipHTML(function(t){return"series-table"===n.tooltipStyle()?n.tooltipFormat({label:t.label,arr:n.columns().slice(1).map(function(e,i){return{label:e,color:n._palette(e),value:n.data()[t.rowIdx][i+1]}})}):n.tooltipFormat({label:t.label,series:t.column,value:t.value})})}_prevPointShape;layerUpdate(t,e,n=250){super.layerUpdate(t,e);const o="horizontal"===t.orientation(),s=o?this.height():this.width(),a=this;this._palette=this._palette.switch(this.paletteID()),this.useClonedPalette()&&(this._palette=this._palette.cloneNotExists(this.paletteID()+"_"+this.id())),this._prevPointShape!==this.pointShape()&&(e.selectAll(".data").remove(),this._prevPointShape=this.pointShape());let r,l,h;this.pointSizeColumn_exists()&&(r=this.columns().indexOf(this.pointSizeColumn()),l=(0,i.extent)(this.data(),t=>t[r]),h=this.getScale().domain(l));const c=this.layerColumns(t),u=this.layerData(t),p=this.flattenData(c,u).map(function(t){return t.shape=function(t){switch(t){case"rectangle":return"rect";case"circle":return"circle";case"cross":return"path"}}(a.pointShape()),t.column=c[t.colIdx],t.row=u[t.rowIdx],t.origRow=u[t.rowIdx].__hpcc_origRow,l?(t.size=h(t.row[r])*(a.maxPointSize()-a.minPointSize())+a.minPointSize(),t.column!==a.pointSizeColumn()&&t):(t.size=a.pointSize(),t)}).filter(t=>t),d=e.selectAll(".area").data(c.filter(function(t,e){return a.interpolate()&&a.interpolateFill()&&e>0})),f=d.enter().append("path"),y=function(){var t=L,e=null,i=m(0),n=B,o=m(!0),s=null,a=N,r=null;function l(l){var h,c,u,p,d,f=l.length,y=!1,_=new Array(f),m=new Array(f);for(null==s&&(r=a(d=x())),h=0;h<=f;++h){if(!(h<f&&o(p=l[h],h,l))===y)if(y=!y)c=h,r.areaStart(),r.lineStart();else{for(r.lineEnd(),r.lineStart(),u=h-1;u>=c;--u)r.point(_[u],m[u]);r.lineEnd(),r.areaEnd()}y&&(_[h]=+t(p,h,l),m[h]=+i(p,h,l),r.point(e?+e(p,h,l):_[h],n?+n(p,h,l):m[h]))}if(d)return r=null,d+""||null}function h(){return H().defined(o).curve(a).context(s)}return l.x=function(i){return arguments.length?(t="function"==typeof i?i:m(+i),e=null,l):t},l.x0=function(e){return arguments.length?(t="function"==typeof e?e:m(+e),l):t},l.x1=function(t){return arguments.length?(e=null==t?null:"function"==typeof t?t:m(+t),l):e},l.y=function(t){return arguments.length?(i="function"==typeof t?t:m(+t),n=null,l):i},l.y0=function(t){return arguments.length?(i="function"==typeof t?t:m(+t),l):i},l.y1=function(t){return arguments.length?(n=null==t?null:"function"==typeof t?t:m(+t),l):n},l.lineX0=l.lineY0=function(){return h().x(t).y(i)},l.lineY1=function(){return h().x(t).y(n)},l.lineX1=function(){return h().x(e).y(i)},l.defined=function(t){return arguments.length?(o="function"==typeof t?t:m(!!t),l):o},l.curve=function(t){return arguments.length?(a=t,null!=s&&(r=a(s)),l):a},l.context=function(t){return arguments.length?(null==t?s=r=null:r=a(s=t),l):s},l}().curve(this.curve());o?y.x(function(e){return a.xPos(t,e)}).y0(Math.min(s,this.yPos(t,{value:0}))).y1(function(e){return a.yPos(t,e)}):y.y(function(e){return a.yPos(t,e)}).x0(Math.max(0,this.xPos(t,{value:0}))).x1(function(e){return a.xPos(t,e)}),f.merge(d).attr("class",t=>"area series series-"+this.cssTag(t)).each(function(t,e){(0,i.select)(this).attr("d",y(p.filter(function(t){return t.colIdx===e+1}))).style("opacity",a.interpolateFillOpacity()).style("stroke","none").style("fill",a.areaColor([],t,void 0,[]))}),d.exit().remove();const _=e.selectAll(".line").data(c.filter(function(t,e){return a.interpolate()&&e>0})),g=_.enter().append("path"),b=H().x(function(e){return a.xPos(t,e)}).y(function(e){return a.yPos(t,e)}).curve(this.curve());g.merge(_).attr("class",t=>"line series series-"+this.cssTag(t)).each(function(t,e){const n=(0,i.select)(this),o=p.filter(function(t){return t.colIdx===e+1});n.attr("d",b(o)).style("stroke",a.lineColor([],t,void 0,[])).style("fill","none")}),_.exit().remove();const v=e.selectAll(".point").data(p,function(t,e){return t.shape+"_"+e});v.enter().append("g").each(function(e){const n=(0,i.select)(this);n.append(e.shape).attr("class","pointShape"),n.append("text").attr("class","pointValue").style("display","none").attr("text-anchor",a.valueAnchor()).attr("alignment-baseline",a.valueBaseline()).attr("fill",function(t,e){return"middle"===a.valueBaseline()||"central"===a.valueBaseline()?a.textColor(t.row,t.column,t.value,t.origRow):null}),n.append("circle").attr("class","pointSelection").on("mouseout.tooltip",a.tooltip.hide).on("mousemove.tooltip",a.tooltip.show).call(t._selection.enter.bind(t._selection)).on("click",function(e,i){a.click(t.rowToObj(t.data()[e.rowIdx]),e.column,t._selection.selected(this))}).on("dblclick",function(e,i){a.dblclick(t.rowToObj(t.data()[e.rowIdx]),e.column,t._selection.selected(this))})}).merge(v).attr("class",t=>"point series series-"+this.cssTag(t.column)).each(function(e){(0,i.select)(this).select(".pointValue").attr("x",function(e){return a.xPos(t,e)}).attr("y",function(e){return a.yPos(t,e)}).style("display",a.showValue()?"block":"none").attr("text-anchor",a.valueAnchor()).attr("alignment-baseline",a.valueBaseline()).text(function(t){return t.value}),(0,i.select)(this).select(".pointSelection").attr("cx",function(e){return a.xPos(t,e)}).attr("cy",function(e){return a.yPos(t,e)}).attr("r",e.size);const n=(0,i.select)(this).select(".pointShape");switch(e.shape){case"rect":n.attr("x",function(i){return a.xPos(t,i)-e.size/2}).attr("y",function(i){return a.yPos(t,i)-e.size/2}).attr("width",e.size).attr("height",e.size).style("fill",a.pointColor(e.row,e.column,e.value,e.origRow));break;case"circle":n.attr("cx",function(e){return a.xPos(t,e)}).attr("cy",function(e){return a.yPos(t,e)}).attr("r",.9*e.size).style("fill",a.pointColor(e.row,e.column,e.value,e.origRow));break;case"path":n.attr("d",function(i){return"M"+(a.xPos(t,i)-e.size/2)+" "+(a.yPos(t,i)-e.size/2)+" L"+(a.xPos(t,i)+e.size/2)+" "+(a.yPos(t,i)+e.size/2)+" M"+(a.xPos(t,i)-e.size/2)+" "+(a.yPos(t,i)+e.size/2)+" L"+(a.xPos(t,i)+e.size/2)+" "+(a.yPos(t,i)-e.size/2)}).style("stroke",a.pointColor(e.row,e.column,e.value,e.origRow))}}),v.exit().remove()}exit(t,e){super.exit(t,e)}};Ct.prototype._class+=" chart_Scatter",Ct.prototype.implements(e.INDChart.prototype),Ct.prototype.implements(e.ITooltip.prototype),Ct.prototype.publish("paletteID","default","set","Color palette for this widget",Ct.prototype._palette.switch(),{tags:["Basic","Shared"]}),Ct.prototype.publish("pointSizeScale","linear","set","pointSizeScale",["linear","pow","log","sqrt"]),Ct.prototype.publish("pointShape","cross","set","Shape of the data points",["circle","rectangle","cross"]),Ct.prototype.publish("pointSize",6,"number","Point Size",null,{range:{min:1,step:1,max:200}}),Ct.prototype.publish("interpolate","","set","Interpolate Data",["","linear","step","step-before","step-after","basis","bundle","cardinal","catmullRom","natural","monotone"]),Ct.prototype.publish("pointDarken",!0,"boolean","If true, and interpolate is set, then points will have a slightly darker color than their assigned palette color",null,{disable:t=>!t.interpolate()}),Ct.prototype.publish("interpolateDarken",!0,"boolean","If true, and interpolateFill is true, then lines will have a slightly darker color than their assigned palette color",null,{disable:t=>!t.interpolateFill()}),Ct.prototype.publish("interpolateFill",!1,"boolean","If true, the area between the line and zero will be filled"),Ct.prototype.publish("interpolateFillOpacity",.66,"number","Fill interpolation Opacity",null,{range:{min:0,step:.01,max:1}}),Ct.prototype.publish("useClonedPalette",!1,"boolean","Enable or disable using a cloned palette",null,{tags:["Intermediate","Shared"]}),Ct.prototype.publish("showValue",!1,"boolean"),Ct.prototype.publish("valueAnchor","middle","set","text-anchor for shown value text",["start","middle","end"]),Ct.prototype.publish("valueBaseline","ideographic","set","alignment-baseline for shown value text",["auto","baseline","before-edge","text-before-edge","middle","central","after-edge","text-after-edge","ideographic","alphabetic","hanging","mathematical","inherit"]);var zt=class extends Ct{constructor(){super(),this.interpolate_default("linear").interpolateFill_default(!0)}};zt.prototype._class+=" chart_Area";var It=class extends Pt{static __inputs=[{id:"label",type:"string"},{id:"values",type:"number",multi:!0}];_linearGap;textLocal=(0,i.local)();stackedTextLocal=(0,i.local)();isHorizontal;constructor(){super(),e.INDChart.call(this),e.ITooltip.call(this),this._selection.skipBringToTop(!0),this._linearGap=25}layerEnter(t,e,i=250){super.layerEnter(t,e,i);const n=this;this.tooltipHTML(function(e){if("series-table"===n.tooltipStyle())return n.tooltipFormat({label:e.row[0],arr:n.columns().slice(1).map(function(t,i){return{label:t,color:n._palette(t),value:e.row[i+1]}})});{let i=e.row[e.idx];return i instanceof Array&&(i=i[1]-i[0]),n.tooltipFormat({label:e.row[0],series:n.layerColumns(t)[e.idx],value:i})}})}adjustedData(t){return this.layerData(t).map(e=>{let i=0;return e.map((e,n)=>{if(0===n)return e;if(n>=this.layerColumns(t).length)return e;const o=t.yAxisStacked()?[i,i+e]:e;return i+=e,o},this)},this)}layerUpdate(t,e,n=250){super.layerUpdate(t,e,n);const o="horizontal"===t.orientation();this.isHorizontal=o;const s=this;this._palette=this._palette.switch(this.paletteID()),this.useClonedPalette()&&(this._palette=this._palette.cloneNotExists(this.paletteID()+"_"+this.id()));const a=(0,i.format)(s.showValueAsPercentFormat());let r=10,l=0;switch(t.xAxisType()){case"ordinal":r=t.bandwidth(),l=-r/2;break;case"linear":case"time":r=Math.max(Math.abs(t.dataPos(2)-t.dataPos(1))*(100-this._linearGap)/100,r),l=-r/2}this.tooltip.direction(o?"n":"e");const h=(0,i.scaleBand)().domain(s.layerColumns(t).filter(function(t,e){return e>0})).rangeRound(o?[0,r]:[r,0]).paddingInner(this.xAxisSeriesPaddingInner()).paddingOuter(0);let c=[];const u=[],p=this.columns().length,d=this.data();this.showValue()&&"series"===this.showValueAsPercent()&&d.forEach(t=>{t.filter((t,e)=>e>0&&e<p).forEach((t,e)=>{void 0===u[e+1]&&(u[e+1]=0),u[e+1]+=t})}),(this.showDomainTotal()||this.showValue()&&"domain"===this.showValueAsPercent())&&(c=d.map(t=>t.filter((t,e)=>e>0&&e<p).reduce((t,e)=>t+e,0)));const f=e.selectAll(".dataRow").data(this.adjustedData(t)),y=t.data(),_=this.getAxisSize(t);f.enter().append("g").attr("class","dataRow").merge(f).each(function(e,d){const f=(0,i.select)(this),x=f.selectAll(".dataCell").data(e.filter(function(e,i){return i<s.layerColumns(t).length}).map(function(i,n){return{column:s.layerColumns(t)[n],row:e,origRow:y[d],value:i,idx:n}}).filter(function(t){return null!==t.value&&t.idx>0}),t=>t.column),m=x.enter().append("g").attr("class","dataCell").on("mouseout.tooltip",function(t){(!s.tooltipInnerTextEllipsedOnly()||t.innerTextObj&&t.innerTextObj.isTruncated)&&s.tooltip.hide.apply(s,arguments)}).on("mousemove.tooltip",function(t){(!s.tooltipInnerTextEllipsedOnly()||t.innerTextObj&&t.innerTextObj.isTruncated)&&s.tooltip.show.apply(s,arguments)}).call(t._selection.enter.bind(t._selection)).on("click",function(e){s.click(t.rowToObj(e.origRow),e.column,t._selection.selected(this))}).on("dblclick",function(e){s.dblclick(t.rowToObj(e.origRow),e.column,t._selection.selected(this))}).style("opacity",0).each(function(t){const e=(0,i.select)(this);e.append("rect").attr("class","columnRect series series-"+s.cssTag(t.column)),e.append("text").attr("class","columnRectText").style("stroke","transparent")});m.transition().duration(n).style("opacity",1);const g=t.yAxisStacked()?r:h.bandwidth();m.merge(x).each(function(r){const f=(0,i.select)(this),y=t.dataPos(e[0])+(t.yAxisStacked()?0:h(r.column))+l,x=r.value instanceof Array?r.value[1]:r.value;let m=r.origRow[r.idx];if(s.showValue()){const t=s.dataMeta();switch(s.showValueAsPercent()){case"series":const e=void 0!==t.sum?t.sum:u[r.idx];m=a(m/e);break;case"domain":const n=void 0!==t.sum?t.sum:c[d];m=a(m/n);break;default:m=(0,i.format)(s.showValueFormat())(m)}}const b=t.valuePos(x),v=t.valuePos(r.value instanceof Array?r.value[0]:0),w=Math.min(v,b),S=Math.abs(b-v),A=s.innerTextFontSize(),k=s.innerTextPadding_exists()?s.innerTextPadding():A/2.5,M=s.intersectRectRect({x:o?y:w,y:o?w:y,width:o?g:S,height:o?S:g},{x:0,y:0,width:_.width,height:_.height}),T=f.select("rect").transition().duration(n).style("fill",t=>s.fillColor(t.row,t.column,t.value,t.origRow));o?T.attr("x",y).attr("y",w).attr("width",g).attr("height",S):T.attr("y",y).attr("x",w).attr("height",g).attr("width",S);const P=f.select("text").transition().duration(n).style("font-size",A+"px").style("fill",t=>s.textColor(t.row,t.column,t.value,t.origRow));P.style("font-family",s.innerTextFontFamily_exists()?s.innerTextFontFamily():null);const C=s.innerTextPadding_exists()?s.innerTextPadding():8,z=A/2.7;if(o){const t=M.y+M.height-k;P.attr("x",y+g/2).attr("y",t+z).attr("transform",`rotate(-90, ${y+g/2}, ${t})`)}else P.attr("x",M.x+C).attr("y",y+g/2+z);P.attr("height",g).attr("width",S),s.showInnerText()&&P.text(t=>{const e=s.innerText(t.origRow,t.origRow[p],t.idx);if(e){const i=o?M.height:M.width,n=s.calcInnerText(i,e,m);return t.innerTextObj=n,n.text}return""});const I=f.selectAll(".dataText").data(s.showValue()?[`${x}`]:[]);I.enter().append("g").attr("class","dataText").each(function(t){s.textLocal.set(this,(new i.Text).target(this).colorStroke_default("transparent"))}).merge(I).each(function(){const t={x:0,y:0},e=s.valueFontFamily(),i=s.valueFontSize(),n=s.textSize(m,e,i),a=parseFloat(m)>=0;let l=s.valueAnchor()?s.valueAnchor():o?"middle":"start";const h=M.x,c=_.width-(M.x+M.width),u=M.y,p=_.height-(M.y+M.height);let d,f,x;if(r.innerTextObj){const{padding:e,valueTextWidth:n}=r.innerTextObj;f=!1,o?(l="middle",t.x=y+g/2,4===r.innerTextObj.category?(f=!0,t.y=w-e-i/2):t.y=w+e+i/2):(l="start",4===r.innerTextObj.category?(f=!0,t.x=S+w+e):t.x=S+w-n-e,t.y=y+g/2)}else o?(d=M.height<n.height,f=!s.valueCentered()||d,t.x=M.x+M.width/2,f?a?(x=u<n.height+C,x?d?t.y=M.y+M.height+n.height:(f=!1,t.y=M.y+M.height/2):t.y=M.y-n.height/2-C):(x=p<n.height,x?d?t.y=M.y-n.height/2-C:(f=!1,t.y=M.y+M.height/2):t.y=M.y+n.height+C):t.y=M.y+M.height/2):(d=M.width<n.width,f=!s.valueCentered()||d,t.y=M.y+M.height/2,f?a?(x=c<n.width+C,x?s.showInnerText()||!d?(f=!1,t.x=M.x+M.width/2):t.x=M.x-(n.width-C):t.x=M.x+M.width+n.width/2+C):(x=h<n.width,x?s.showInnerText()||!d?(f=!1,t.x=M.x+M.width/2):t.x=M.x+M.width+(n.width-C):t.x=M.x-(n.width-C)):t.x=M.x+M.width/2);const b=f?null:s.textColor(r.row,r.column,r.value,r.origRow),v=s.columns(),A=s.yAxisStacked()&&d||f&&s.yAxisStacked()&&v.indexOf(r.column)!==v.length-1;s.textLocal.get(this).pos(t).anchor(l).fontFamily(e).fontSize(i).text(`${m}`).colorFill(b).visible(s.showValue()&&!A).render()}),I.exit().each(function(t){s.textLocal.get(this).target(null)}).remove()}),x.exit().transition().duration(n).style("opacity",0).remove();const b=t.yAxisStacked()?c[d]:Math.max(...e.filter((t,e)=>e>0&&e<p)),v=f.selectAll(".stackedTotalText").data(s.showDomainTotal()?[c[d]]:[]);v.enter().append("g").attr("class","stackedTotalText").each(function(t){s.stackedTextLocal.set(this,(new i.Text).target(this).colorStroke_default("transparent"))}).merge(v).each(function(i){const n={x:0,y:0},a=t.dataPos(e[0]),r=t.valuePos(b),l=s.valueFontFamily(),h=s.valueFontSize(),c=s.textSize(i,l,h),u=parseFloat(i)>=0;let p="middle";o?(n.x=a,n.y=u?r-c.height/2:r+c.height/2):(p="start",n.y=a,n.x=u?r+c.width/2:r-c.width/2),s.stackedTextLocal.get(this).pos(n).anchor(p).fontFamily(l).fontSize(h).text(i).render()}),v.exit().each(function(t){s.textLocal.get(this).target(null)}).remove()}),f.exit().transition().duration(n).remove()}calcInnerText(t,e,i){const n=this.innerTextFontFamily_exists()?this.innerTextFontFamily():"Verdana",o=this.innerTextFontSize(),s=this.valueFontFamily_exists()?this.valueFontFamily():"Verdana",a=this.valueFontSize(),r=this.innerTextPadding_exists()?this.innerTextPadding():o/2.5,l=this.isHorizontal?a:this.textSize(i,s,a).width,h=e,c=3*r+this.textSize("...",n,o).width+l,u=1*r+l;let p=4;if(3*r+this.textSize(e,n,o).width+l<t)p=1;else if(c<t){const i=t-c;let s="";for(const t of e){if(this.textSize(s+t,n,o).width>i){e=s+"...";break}s+=t}p=2}else u<t?(e="",p=3):e="";return{text:e,isTruncated:h!==e,padding:r,category:p,valueTextWidth:l}}innerText(t,e,i){return t[0]}};It.prototype._class+=" chart_Column",It.prototype.implements(e.INDChart.prototype),It.prototype.implements(e.ITooltip.prototype),It.prototype.publish("valueFontFamily",null,"string","Font family of value text",null,{optional:!0}),It.prototype.publish("valueFontSize",12,"number","Height of value text (pixels)"),It.prototype.publish("innerTextFontFamily",null,"string","Font family of inner text",null,{optional:!0}),It.prototype.publish("innerTextPadding",8,"number","Offset of inner text (pixels)",null,{optional:!0}),It.prototype.publish("innerTextFontSize",12,"number","Height of inner text (pixels)"),It.prototype.publish("paletteID","default","set","Color palette for this widget",()=>It.prototype._palette.switch(),{tags:["Basic","Shared"]}),It.prototype.publish("useClonedPalette",!1,"boolean","Enable or disable using a cloned palette",null,{tags:["Intermediate","Shared"]}),It.prototype.publish("showValue",!1,"boolean","Show Value in column"),It.prototype.publish("showInnerText",!1,"boolean","Show Label in column"),It.prototype.publish("showValueFormat",",","string","D3 Format for Value",null,{disable:t=>!t.showValue()||!!t.showValueAsPercent()}),It.prototype.publish("showValueAsPercent",null,"set","If showValue is true, optionally show value as a percentage by Series or Domain",[null,"series","domain"],{disable:t=>!t.showValue(),optional:!0}),It.prototype.publish("showValueAsPercentFormat",".0%","string","D3 Format for %",null,{disable:t=>!t.showValue()||!t.showValueAsPercent()}),It.prototype.publish("showDomainTotal",!1,"boolean","Show Total Value for Stacked Columns",null),It.prototype.publish("valueCentered",!1,"boolean","Show Value in center of column"),It.prototype.publish("valueAnchor","middle","set","text-anchor for shown value text",["start","middle","end"]),It.prototype.publish("xAxisSeriesPaddingInner",0,"number","Determines the ratio of the range that is reserved for blank space between band (0->1)"),It.prototype.publish("tooltipInnerTextEllipsedOnly",!1,"boolean","Show tooltip only when inner text is truncated with an ellipsis");var Dt=class extends It{constructor(){super(),this.orientation_default("vertical")}};function Ft(t){var e=0,i=t.children,n=i&&i.length;if(n)for(;--n>=0;)e+=i[n].value;else e=1;t.value=e}function Ot(t,e){var i,n,o,s,a,r=new Nt(t),l=+t.value&&(r.value=t.value),h=[r];for(null==e&&(e=jt);i=h.pop();)if(l&&(i.value=+i.data.value),(o=e(i.data))&&(a=o.length))for(i.children=new Array(a),s=a-1;s>=0;--s)h.push(n=i.children[s]=new Nt(o[s])),n.parent=i,n.depth=i.depth+1;return r.eachBefore(Et)}function jt(t){return t.children}function Rt(t){t.data=t.data.data}function Et(t){var e=0;do{t.height=e}while((t=t.parent)&&t.height<++e)}function Nt(t){this.data=t,this.depth=this.height=0,this.parent=null}Dt.prototype._class+=" chart_Bar",Nt.prototype=Ot.prototype={constructor:Nt,count:function(){return this.eachAfter(Ft)},each:function(t){var e,i,n,o,s=this,a=[s];do{for(e=a.reverse(),a=[];s=e.pop();)if(t(s),i=s.children)for(n=0,o=i.length;n<o;++n)a.push(i[n])}while(a.length);return this},eachAfter:function(t){for(var e,i,n,o=this,s=[o],a=[];o=s.pop();)if(a.push(o),e=o.children)for(i=0,n=e.length;i<n;++i)s.push(e[i]);for(;o=a.pop();)t(o);return this},eachBefore:function(t){for(var e,i,n=this,o=[n];n=o.pop();)if(t(n),e=n.children)for(i=e.length-1;i>=0;--i)o.push(e[i]);return this},sum:function(t){return this.eachAfter(function(e){for(var i=+t(e.data)||0,n=e.children,o=n&&n.length;--o>=0;)i+=n[o].value;e.value=i})},sort:function(t){return this.eachBefore(function(e){e.children&&e.children.sort(t)})},path:function(t){for(var e=this,i=function(t,e){if(t===e)return t;var i=t.ancestors(),n=e.ancestors(),o=null;t=i.pop(),e=n.pop();for(;t===e;)o=t,t=i.pop(),e=n.pop();return o}(e,t),n=[e];e!==i;)e=e.parent,n.push(e);for(var o=n.length;t!==i;)n.splice(o,0,t),t=t.parent;return n},ancestors:function(){for(var t=this,e=[t];t=t.parent;)e.push(t);return e},descendants:function(){var t=[];return this.each(function(e){t.push(e)}),t},leaves:function(){var t=[];return this.eachBefore(function(e){e.children||t.push(e)}),t},links:function(){var t=this,e=[];return t.each(function(i){i!==t&&e.push({source:i.parent,target:i})}),e},copy:function(){return Ot(this).eachBefore(Rt)}};var Lt=Array.prototype.slice;function Bt(t){for(var e,i,n=0,o=(t=function(t){for(var e,i,n=t.length;n;)i=Math.random()*n--|0,e=t[n],t[n]=t[i],t[i]=e;return t}(Lt.call(t))).length,s=[];n<o;)e=t[n],i&&qt(i,e)?++n:(i=Gt(s=Ht(s,e)),n=0);return i}function Ht(t,e){var i,n;if(Wt(e,t))return[e];for(i=0;i<t.length;++i)if(Vt(e,t[i])&&Wt($t(t[i],e),t))return[t[i],e];for(i=0;i<t.length-1;++i)for(n=i+1;n<t.length;++n)if(Vt($t(t[i],t[n]),e)&&Vt($t(t[i],e),t[n])&&Vt($t(t[n],e),t[i])&&Wt(Xt(t[i],t[n],e),t))return[t[i],t[n],e];throw new Error}function Vt(t,e){var i=t.r-e.r,n=e.x-t.x,o=e.y-t.y;return i<0||i*i<n*n+o*o}function qt(t,e){var i=t.r-e.r+1e-6,n=e.x-t.x,o=e.y-t.y;return i>0&&i*i>n*n+o*o}function Wt(t,e){for(var i=0;i<e.length;++i)if(!qt(t,e[i]))return!1;return!0}function Gt(t){switch(t.length){case 1:return{x:(e=t[0]).x,y:e.y,r:e.r};case 2:return $t(t[0],t[1]);case 3:return Xt(t[0],t[1],t[2])}var e}function $t(t,e){var i=t.x,n=t.y,o=t.r,s=e.x,a=e.y,r=e.r,l=s-i,h=a-n,c=r-o,u=Math.sqrt(l*l+h*h);return{x:(i+s+l/u*c)/2,y:(n+a+h/u*c)/2,r:(u+o+r)/2}}function Xt(t,e,i){var n=t.x,o=t.y,s=t.r,a=e.x,r=e.y,l=e.r,h=i.x,c=i.y,u=i.r,p=n-a,d=n-h,f=o-r,y=o-c,_=l-s,x=u-s,m=n*n+o*o-s*s,g=m-a*a-r*r+l*l,b=m-h*h-c*c+u*u,v=d*f-p*y,w=(f*b-y*g)/(2*v)-n,S=(y*_-f*x)/v,A=(d*g-p*b)/(2*v)-o,k=(p*x-d*_)/v,M=S*S+k*k-1,T=2*(s+w*S+A*k),P=w*w+A*A-s*s,C=-(M?(T+Math.sqrt(T*T-4*M*P))/(2*M):P/T);return{x:n+w+S*C,y:o+A+k*C,r:C}}function Yt(t,e,i){var n,o,s,a,r=t.x-e.x,l=t.y-e.y,h=r*r+l*l;h?(o=e.r+i.r,o*=o,a=t.r+i.r,o>(a*=a)?(n=(h+a-o)/(2*h),s=Math.sqrt(Math.max(0,a/h-n*n)),i.x=t.x-n*r-s*l,i.y=t.y-n*l+s*r):(n=(h+o-a)/(2*h),s=Math.sqrt(Math.max(0,o/h-n*n)),i.x=e.x+n*r-s*l,i.y=e.y+n*l+s*r)):(i.x=e.x+i.r,i.y=e.y)}function Ut(t,e){var i=t.r+e.r-1e-6,n=e.x-t.x,o=e.y-t.y;return i>0&&i*i>n*n+o*o}function Qt(t){var e=t._,i=t.next._,n=e.r+i.r,o=(e.x*i.r+i.x*e.r)/n,s=(e.y*i.r+i.y*e.r)/n;return o*o+s*s}function Zt(t){this._=t,this.next=null,this.previous=null}function Jt(t){return null==t?null:function(t){if("function"!=typeof t)throw new Error;return t}(t)}function Kt(){return 0}function te(t){return Math.sqrt(t.value)}function ee(t){return function(e){e.children||(e.r=Math.max(0,+t(e)||0))}}function ie(t,e){return function(i){if(n=i.children){var n,o,s,a=n.length,r=t(i)*e||0;if(r)for(o=0;o<a;++o)n[o].r+=r;if(s=function(t){if(!(n=t.length))return 0;var e,i,n,o,s,a,r,l,h,c,u=t[0];if(u.x=0,u.y=0,!(n>1))return u.r;if(e=t[1],u.x=-e.r,e.x=u.r,e.y=0,!(n>2))return u.r+e.r;Yt(e,u,i=t[2]),u=new Zt(u),e=new Zt(e),i=new Zt(i),u.next=i.previous=e,e.next=u.previous=i,i.next=e.previous=u;t:for(a=3;a<n;++a){Yt(u._,e._,i=t[a]),i=new Zt(i),r=e.next,l=u.previous,h=e._.r,c=u._.r;do{if(h<=c){if(Ut(r._,i._)){e=r,u.next=e,e.previous=u,--a;continue t}h+=r._.r,r=r.next}else{if(Ut(l._,i._)){(u=l).next=e,e.previous=u,--a;continue t}c+=l._.r,l=l.previous}}while(r!==l.next);for(i.previous=u,i.next=e,u.next=e.previous=e=i,o=Qt(u);(i=i.next)!==e;)(s=Qt(i))<o&&(u=i,o=s);e=u.next}for(u=[e._],i=e;(i=i.next)!==e;)u.push(i._);for(i=Bt(u),a=0;a<n;++a)(u=t[a]).x-=i.x,u.y-=i.y;return i.r}(n),r)for(o=0;o<a;++o)n[o].r-=r;i.r=s+r}}}function ne(t){return function(e){var i=e.parent;e.r*=t,i&&(e.x=i.x+t*e.x,e.y=i.y+t*e.y)}}var oe=class extends i.SVGWidget{static __inputs=[{id:"label",type:"string"},{id:"value",type:"number"}];labelWidgets;d3Pack;constructor(){super(),e.I2DChart.call(this),e.ITooltip.call(this),i.Utility.SimpleSelectionMixin.call(this),this._drawStartPos="origin",this.labelWidgets={},this.d3Pack=function(){var t=null,e=1,i=1,n=Kt;function o(o){return o.x=e/2,o.y=i/2,t?o.eachBefore(ee(t)).eachAfter(ie(n,.5)).eachBefore(ne(1)):o.eachBefore(ee(te)).eachAfter(ie(Kt,1)).eachAfter(ie(n,o.r/Math.min(e,i))).eachBefore(ne(Math.min(e,i)/(2*o.r))),o}return o.radius=function(e){return arguments.length?(t=Jt(e),o):t},o.size=function(t){return arguments.length?(e=+t[0],i=+t[1],o):[e,i]},o.padding=function(t){return arguments.length?(n="function"==typeof t?t:function(t){return function(){return t}}(+t),o):n},o}().size([this.width(),this.height()]).padding(1.5)}size(t){const e=super.size.apply(this,arguments);return arguments.length&&this.d3Pack.size([this.width(),this.height()]),e}enter(t,e){super.enter(t,e),this._selection.widgetElement(e);const i=this;this.tooltipHTML(function(t){return"series-table"===i.tooltipStyle()?i.tooltipFormat({label:t[0],arr:i.columns().slice(1).map(function(e,n){return{label:e,color:i._palette(t[0]),value:t[1]}})}):i.tooltipFormat({label:t.data[0],value:t.data[1]})})}update(t,e){super.update(t,e);const n=this;this._palette=this._palette.switch(this.paletteID()),this.useClonedPalette()&&(this._palette=this._palette.cloneNotExists(this.paletteID()+"_"+this.id()));const o=Ot({children:this.cloneData()}).sum(function(t){return t[1]}).sort(function(t,e){return e[1]<t[1]?-1:e[1]>t[1]?1:0});this.d3Pack(o);const s=e.selectAll(".node").data(o.children||[],t=>t.data[0]);s.enter().append("g").attr("class",(t,e)=>"node series series-"+this.cssTag(t.data[0])).attr("opacity",0).call(this._selection.enter.bind(this._selection)).on("click",function(t){n.click(n.rowToObj(t.data),n.columns()[1],n._selection.selected(this))}).on("dblclick",function(t){n.dblclick(n.rowToObj(t.data),n.columns()[1],n._selection.selected(this))}).each(function(t){const e=(0,i.select)(this),o=t.x,s=t.y;e.append("circle").attr("transform","translate("+o+","+s+")").attr("r",0).on("mouseout.tooltip",n.tooltip.hide).on("mousemove.tooltip",n.tooltip.show),t.__viz_faChar?n.labelWidgets[t.data[0]]=(new i.FAChar).char(t.__viz_faChar).target(this).render():n.labelWidgets[t.data[0]]=(new i.Text).text(t.data[0]).target(this).render()}).merge(s).transition().attr("opacity",1).each(function(t){const e=(0,i.select)(this),o={x:t.x,y:t.y};e.select("circle").transition().attr("transform","translate("+o.x+","+o.y+")").style("fill",n.fillColor(t.data,n.columns()[1],t.data[1])).attr("r",t.r).select("title").text(t.data[0]+" ("+t.data[1]+")"),t.__viz_faChar?n.labelWidgets[t.data[0]].pos(o).render():n.labelWidgets[t.data[0]].pos(o).colorFill_default(n.textColor(t.data,n.columns()[1],t.data[1])).width(2*t.r).text(t.data[0]).render()}),s.exit().transition().style("opacity",0).remove()}exit(t,e){super.exit(t,e)}};oe.prototype._class+=" chart_Bubble",oe.prototype.implements(e.I2DChart.prototype),oe.prototype.implements(e.ITooltip.prototype),oe.prototype.mixin(i.Utility.SimpleSelectionMixin),oe.prototype.publish("paletteID","default","set","Color palette for this widget",oe.prototype._palette.switch(),{tags:["Basic","Shared"]}),oe.prototype.publish("useClonedPalette",!1,"boolean","Enable or disable using a cloned palette",null,{tags:["Intermediate","Shared"]});var se=class extends Ct{constructor(){super()}enter(t,e){this.pointSizeColumn_exists()||this.pointSizeColumn(this.columns()[this.columns().length-1]),super.enter(t,e)}};se.prototype._class+=" chart_BubbleXY";var ae,re,le=0,he=0,ce=0,ue=0,pe=0,de=0,fe="object"==typeof performance&&performance.now?performance:Date,ye="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function _e(){return pe||(ye(xe),pe=fe.now()+de)}function xe(){pe=0}function me(){this._call=this._time=this._next=null}function ge(){_e(),++le;for(var t,e=ae;e;)(t=pe-e._time)>=0&&e._call.call(null,t),e=e._next;--le}function be(){pe=(ue=fe.now())+de,le=he=0;try{ge()}finally{le=0,function(){var t,e,i=ae,n=1/0;for(;i;)i._call?(n>i._time&&(n=i._time),t=i,i=i._next):(e=i._next,i._next=null,i=t?t._next=e:ae=e);re=t,we(n)}(),pe=0}}function ve(){var t=fe.now(),e=t-ue;e>1e3&&(de-=e,ue=t)}function we(t){le||(he&&(he=clearTimeout(he)),t-pe>24?(t<1/0&&(he=setTimeout(be,t-fe.now()-de)),ce&&(ce=clearInterval(ce))):(ce||(ue=fe.now(),ce=setInterval(ve,1e3)),le=1,ye(be)))}function Se(t){return t.ranges}function Ae(t){return t.markers}function ke(t){return t.measures}function Me(t){var e=t(0);return function(i){return Math.abs(t(i)-e)}}me.prototype=function(t,e,i){var n=new me;return n.restart(t,e,i),n}.prototype={constructor:me,restart:function(t,e,i){if("function"!=typeof t)throw new TypeError("callback is not a function");i=(null==i?_e():+i)+(null==e?0:+e),this._next||re===this||(re?re._next=this:ae=this,re=this),this._call=t,this._time=i,we()},stop:function(){this._call&&(this._call=null,this._time=1/0,we())}};var Te=class extends i.HTMLWidget{_hiddenColumns={};constructor(){super(),i.Utility.SimpleSelectionMixin.call(this,!0)}bulletData(){const t=this;this._hiddenColumns={};const e=this.columns();return this.data().map(function(t){return{title:i(t,this.titleColumn()),subtitle:i(t,this.subtitleColumn()),ranges:i(t,this.rangesColumn(),"range"),measures:i(t,this.measuresColumn(),"measure"),markers:i(t,this.markersColumn(),"marker"),origRow:t}},this);function i(i,n,o){const s=e.indexOf(n);return s>=0?i[s]instanceof Array?i[s]:[i[s]]:(o&&(t._hiddenColumns[o]=!0),[0])}}enter(t,e){super.enter(t,e),(0,i.select)(t.parentNode).style("overflow","auto"),this._selection.widgetElement(e)}update(t,e){super.update(t,e);const n=this;e.selectAll(".axis").style("display","none"),e.selectAll(".range,.measure,.marker").style("display",null);const o=2,s=8,a=2,r=8,l=this.width()-o-a,h=40-s-r,c=e.selectAll("svg").data(this.bulletData()),u=c.enter().append("svg").attr("class","bullet").call(this._selection.enter.bind(this._selection)).on("click",function(t){n.click(n.rowToObj(t.origRow),n.titleColumn(),n._selection.selected(this))}).on("dblclick",function(t){n.dblclick(n.rowToObj(t.origRow),n.titleColumn(),n._selection.selected(this))}).each(function(){const t=(0,i.select)(this).append("g").attr("class",(t,e)=>"bulletBar series series-"+n.cssTag(n.titleColumn())).append("g").attr("class","bulletTitle");t.append("text").attr("class","title"),t.append("text").attr("class","subtitle").attr("dy","1em")}).merge(c),p=u.select(".bulletTitle").style("text-anchor","end").attr("transform","translate(-6,"+h/2+")");p.select(".title").text(function(t){return t.title}),p.select(".subtitle").text(function(t){return t.subtitle});let d=0;p.each(function(){const t=this.getBBox();t.width>d&&(d=t.width)});const f=function(){var t="left",e=!1,n=!1,o=Se,s=Ae,a=ke,r=380,l=30,h=Mt();function c(t){t.each(function(t,c){var u,p,d=o.call(this,t,c).slice().sort(i.descending),f=s.call(this,t,c).slice().sort(i.descending),y=a.call(this,t,c).slice().sort(i.descending),_=(0,i.select)(this),x=_.select("g.wrap");x.empty()&&(x=_.append("g").attr("class","wrap")),n?(u=l,p=r,x.attr("transform","rotate(90)translate(0,"+-r+")")):(u=r,p=l,x.attr("transform",null));var m=(0,i.scaleLinear)().domain([0,Math.max(d[0],f[0],y[0])]).range(e?[u,0]:[0,u]),g=this.__chart__||(0,i.scaleLinear)().domain([0,1/0]).range(m.range());this.__chart__=m;var b=Me(g),v=Me(m),w=x.selectAll("rect.range").data(d);w.enter().append("rect").attr("class",function(t,e){return"range s"+e}).attr("width",b).attr("height",p).attr("x",e?g:0).merge(w).transition(w).attr("x",e?m:0).attr("width",v).attr("height",p);var S=x.selectAll("rect.measure").data(y);S.enter().append("rect").attr("class",function(t,e){return"measure s"+e}).attr("width",b).attr("height",p/3).attr("x",e?g:0).attr("y",p/3).merge(S).transition(S).attr("width",v).attr("height",p/3).attr("x",e?m:0).attr("y",p/3);var A=x.selectAll("line.marker").data(f);A.enter().append("line").attr("class","marker").attr("x1",g).attr("x2",g).attr("y1",p/6).attr("y2",5*p/6).merge(A).transition(A).attr("x1",m).attr("x2",m).attr("y1",p/6).attr("y2",5*p/6);var k=_.selectAll("g.axis").data([0]);k.enter().append("g").attr("class","axis"),k.attr("transform",n?null:"translate(0,"+p+")").call(h.scale(m))}),ge()}return c.orient=function(i){return arguments.length?(e="right"==(t=i+"")||"bottom"===t,h.orient((n="top"===t||"bottom"===t)?"left":"bottom"),c):t},c.ranges=function(t){return arguments.length?(o=t,c):o},c.markers=function(t){return arguments.length?(s=t,c):s},c.measures=function(t){return arguments.length?(a=t,c):a},c.width=function(t){return arguments.length?(r=+t,c):r},c.height=function(t){return arguments.length?(l=+t,c):l},c.tickFormat=function(t){return arguments.length?(h.tickFormat(t),c):h.tickFormat()},c}().width(l-d-6).height(h);u.attr("width",l).attr("height",h+s+r).style("margin-left",`${o}px`),u.select(".bulletBar").attr("transform","translate("+(d+6)+","+s+")").call(f),c.exit().remove(),Object.keys(this._hiddenColumns).length>0&&e.selectAll(`.${Object.keys(this._hiddenColumns).join(",.")}`).style("display","none")}exit(t,e){super.exit(t,e)}click(t,e,i){}dblclick(t,e,i){}_selection};Te.prototype._class+=" chart_Bullet",Te.prototype.publish("titleColumn",null,"set","Title Column",function(){return this.columns()},{optional:!0}),Te.prototype.publish("subtitleColumn",null,"set","Subtitle Column",function(){return this.columns()},{optional:!0}),Te.prototype.publish("rangesColumn",null,"set","Ranges Column",function(){return this.columns()},{optional:!0}),Te.prototype.publish("measuresColumn",null,"set","Measures Column",function(){return this.columns()},{optional:!0}),Te.prototype.publish("markersColumn",null,"set","Markers Column",function(){return this.columns()},{optional:!0});var Pe=Array.prototype.slice;function Ce(t,e){return t-e}function ze(t){return function(){return t}}function Ie(t,e){for(var i,n=-1,o=e.length;++n<o;)if(i=De(t,e[n]))return i;return 0}function De(t,e){for(var i=e[0],n=e[1],o=-1,s=0,a=t.length,r=a-1;s<a;r=s++){var l=t[s],h=l[0],c=l[1],u=t[r],p=u[0],d=u[1];if(Fe(l,u,e))return 0;c>n!=d>n&&i<(p-h)*(n-c)/(d-c)+h&&(o=-o)}return o}function Fe(t,e,i){var n,o,s,a;return function(t,e,i){return(e[0]-t[0])*(i[1]-t[1])===(i[0]-t[0])*(e[1]-t[1])}(t,e,i)&&(o=t[n=+(t[0]===e[0])],s=i[n],a=e[n],o<=s&&s<=a||a<=s&&s<=o)}function Oe(){}var je=[[],[[[1,1.5],[.5,1]]],[[[1.5,1],[1,1.5]]],[[[1.5,1],[.5,1]]],[[[1,.5],[1.5,1]]],[[[1,1.5],[.5,1]],[[1,.5],[1.5,1]]],[[[1,.5],[1,1.5]]],[[[1,.5],[.5,1]]],[[[.5,1],[1,.5]]],[[[1,1.5],[1,.5]]],[[[.5,1],[1,.5]],[[1.5,1],[1,1.5]]],[[[1.5,1],[1,.5]]],[[[.5,1],[1.5,1]]],[[[1,1.5],[1.5,1]]],[[[.5,1],[1,1.5]]],[]];function Re(){var t=1,e=1,n=i.thresholdSturges,o=l;function s(t){var e=n(t);if(Array.isArray(e))e=e.slice().sort(Ce);else{var o=(0,i.extent)(t),s=o[0],r=o[1];e=(0,i.tickStep)(s,r,e),e=(0,i.range)(Math.floor(s/e)*e,Math.floor(r/e)*e,e)}return e.map(function(e){return a(t,e)})}function a(i,n){var s=[],a=[];return function(i,n,o){var s,a,l,h,c=new Array,u=new Array,p=s=-1,d=i[0]>=n;je[d<<1].forEach(f);for(;++p<t-1;)a=d,d=i[p+1]>=n,je[a|d<<1].forEach(f);je[d|0].forEach(f);for(;++s<e-1;){for(p=-1,d=i[s*t+t]>=n,l=i[s*t]>=n,je[d<<1|l<<2].forEach(f);++p<t-1;)a=d,d=i[s*t+t+p+1]>=n,h=l,l=i[s*t+p+1]>=n,je[a|d<<1|l<<2|h<<3].forEach(f);je[d|l<<3].forEach(f)}p=-1,l=i[s*t]>=n,je[l<<2].forEach(f);for(;++p<t-1;)h=l,l=i[s*t+p+1]>=n,je[l<<2|h<<3].forEach(f);function f(t){var e,i,n=[t[0][0]+p,t[0][1]+s],a=[t[1][0]+p,t[1][1]+s],l=r(n),h=r(a);(e=u[l])?(i=c[h])?(delete u[e.end],delete c[i.start],e===i?(e.ring.push(a),o(e.ring)):c[e.start]=u[i.end]={start:e.start,end:i.end,ring:e.ring.concat(i.ring)}):(delete u[e.end],e.ring.push(a),u[e.end=h]=e):(e=c[h])?(i=u[l])?(delete c[e.start],delete u[i.end],e===i?(e.ring.push(a),o(e.ring)):c[i.start]=u[e.end]={start:i.start,end:e.end,ring:i.ring.concat(e.ring)}):(delete c[e.start],e.ring.unshift(n),c[e.start=l]=e):c[l]=u[h]={start:l,end:h,ring:[n,a]}}je[l<<3].forEach(f)}(i,n,function(t){o(t,i,n),function(t){for(var e=0,i=t.length,n=t[i-1][1]*t[0][0]-t[i-1][0]*t[0][1];++e<i;)n+=t[e-1][1]*t[e][0]-t[e-1][0]*t[e][1];return n}(t)>0?s.push([t]):a.push(t)}),a.forEach(function(t){for(var e,i=0,n=s.length;i<n;++i)if(-1!==Ie((e=s[i])[0],t))return void e.push(t)}),{type:"MultiPolygon",value:n,coordinates:s}}function r(e){return 2*e[0]+e[1]*(t+1)*4}function l(i,n,o){i.forEach(function(i){var s,a=i[0],r=i[1],l=0|a,h=0|r,c=n[h*t+l];a>0&&a<t&&l===a&&(s=n[h*t+l-1],i[0]=a+(o-s)/(c-s)-.5),r>0&&r<e&&h===r&&(s=n[(h-1)*t+l],i[1]=r+(o-s)/(c-s)-.5)})}return s.contour=a,s.size=function(i){if(!arguments.length)return[t,e];var n=Math.ceil(i[0]),o=Math.ceil(i[1]);if(!(n>0&&o>0))throw new Error("invalid size");return t=n,e=o,s},s.thresholds=function(t){return arguments.length?(n="function"==typeof t?t:Array.isArray(t)?ze(Pe.call(t)):ze(t),s):n},s.smooth=function(t){return arguments.length?(o=t?l:Oe,s):o===l},s}function Ee(t,e,i){for(var n=t.width,o=t.height,s=1+(i<<1),a=0;a<o;++a)for(var r=0,l=0;r<n+i;++r)r<n&&(l+=t.data[r+a*n]),r>=i&&(r>=s&&(l-=t.data[r-s+a*n]),e.data[r-i+a*n]=l/Math.min(r+1,n-1+s-r,s))}function Ne(t,e,i){for(var n=t.width,o=t.height,s=1+(i<<1),a=0;a<n;++a)for(var r=0,l=0;r<o+i;++r)r<o&&(l+=t.data[a+r*n]),r>=i&&(r>=s&&(l-=t.data[a+(r-s)*n]),e.data[a+(r-i)*n]=l/Math.min(r+1,o-1+s-r,s))}function Le(t){return t[0]}function Be(t){return t[1]}function He(){return 1}function Ve(){return new qe}function qe(){this.reset()}qe.prototype={constructor:qe,reset:function(){this.s=this.t=0},add:function(t){Ge(We,t,this.t),Ge(this,We.s,this.s),this.s?this.t+=We.t:this.s=We.t},valueOf:function(){return this.s}};var We=new qe;function Ge(t,e,i){var n=t.s=e+i,o=n-e;t.t=e-(n-o)+(i-o)}var $e=Math.PI,Xe=2*$e,Ye=Math.abs,Ue=Math.sqrt;function Qe(){}function Ze(t,e){t&&Ke.hasOwnProperty(t.type)&&Ke[t.type](t,e)}var Je={Feature:function(t,e){Ze(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,n=-1,o=i.length;++n<o;)Ze(i[n].geometry,e)}},Ke={Sphere:function(t,e){e.sphere()},Point:function(t,e){t=t.coordinates,e.point(t[0],t[1],t[2])},MultiPoint:function(t,e){for(var i=t.coordinates,n=-1,o=i.length;++n<o;)t=i[n],e.point(t[0],t[1],t[2])},LineString:function(t,e){ti(t.coordinates,e,0)},MultiLineString:function(t,e){for(var i=t.coordinates,n=-1,o=i.length;++n<o;)ti(i[n],e,0)},Polygon:function(t,e){ei(t.coordinates,e)},MultiPolygon:function(t,e){for(var i=t.coordinates,n=-1,o=i.length;++n<o;)ei(i[n],e)},GeometryCollection:function(t,e){for(var i=t.geometries,n=-1,o=i.length;++n<o;)Ze(i[n],e)}};function ti(t,e,i){var n,o=-1,s=t.length-i;for(e.lineStart();++o<s;)n=t[o],e.point(n[0],n[1],n[2]);e.lineEnd()}function ei(t,e){var i=-1,n=t.length;for(e.polygonStart();++i<n;)ti(t[i],e,1);e.polygonEnd()}function ii(t,e){t&&Je.hasOwnProperty(t.type)?Je[t.type](t,e):Ze(t,e)}function ni(t){return t}var oi,si,ai,ri,li=Ve(),hi=Ve(),ci={point:Qe,lineStart:Qe,lineEnd:Qe,polygonStart:function(){ci.lineStart=ui,ci.lineEnd=fi},polygonEnd:function(){ci.lineStart=ci.lineEnd=ci.point=Qe,li.add(Ye(hi)),hi.reset()},result:function(){var t=li/2;return li.reset(),t}};function ui(){ci.point=pi}function pi(t,e){ci.point=di,oi=ai=t,si=ri=e}function di(t,e){hi.add(ri*t-ai*e),ai=t,ri=e}function fi(){di(oi,si)}var yi=ci,_i=1/0,xi=_i,mi=-_i,gi=mi;var bi,vi,wi,Si,Ai={point:function(t,e){t<_i&&(_i=t);t>mi&&(mi=t);e<xi&&(xi=e);e>gi&&(gi=e)},lineStart:Qe,lineEnd:Qe,polygonStart:Qe,polygonEnd:Qe,result:function(){var t=[[_i,xi],[mi,gi]];return mi=gi=-(xi=_i=1/0),t}},ki=0,Mi=0,Ti=0,Pi=0,Ci=0,zi=0,Ii=0,Di=0,Fi=0,Oi={point:ji,lineStart:Ri,lineEnd:Li,polygonStart:function(){Oi.lineStart=Bi,Oi.lineEnd=Hi},polygonEnd:function(){Oi.point=ji,Oi.lineStart=Ri,Oi.lineEnd=Li},result:function(){var t=Fi?[Ii/Fi,Di/Fi]:zi?[Pi/zi,Ci/zi]:Ti?[ki/Ti,Mi/Ti]:[NaN,NaN];return ki=Mi=Ti=Pi=Ci=zi=Ii=Di=Fi=0,t}};function ji(t,e){ki+=t,Mi+=e,++Ti}function Ri(){Oi.point=Ei}function Ei(t,e){Oi.point=Ni,ji(wi=t,Si=e)}function Ni(t,e){var i=t-wi,n=e-Si,o=Ue(i*i+n*n);Pi+=o*(wi+t)/2,Ci+=o*(Si+e)/2,zi+=o,ji(wi=t,Si=e)}function Li(){Oi.point=ji}function Bi(){Oi.point=Vi}function Hi(){qi(bi,vi)}function Vi(t,e){Oi.point=qi,ji(bi=wi=t,vi=Si=e)}function qi(t,e){var i=t-wi,n=e-Si,o=Ue(i*i+n*n);Pi+=o*(wi+t)/2,Ci+=o*(Si+e)/2,zi+=o,Ii+=(o=Si*t-wi*e)*(wi+t),Di+=o*(Si+e),Fi+=3*o,ji(wi=t,Si=e)}var Wi=Oi;function Gi(t){this._context=t}Gi.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._context.moveTo(t,e),this._point=1;break;case 1:this._context.lineTo(t,e);break;default:this._context.moveTo(t+this._radius,e),this._context.arc(t,e,this._radius,0,Xe)}},result:Qe};var $i,Xi,Yi,Ui,Qi,Zi=Ve(),Ji={point:Qe,lineStart:function(){Ji.point=Ki},lineEnd:function(){$i&&tn(Xi,Yi),Ji.point=Qe},polygonStart:function(){$i=!0},polygonEnd:function(){$i=null},result:function(){var t=+Zi;return Zi.reset(),t}};function Ki(t,e){Ji.point=tn,Xi=Ui=t,Yi=Qi=e}function tn(t,e){Ui-=t,Qi-=e,Zi.add(Ue(Ui*Ui+Qi*Qi)),Ui=t,Qi=e}var en=Ji;function nn(){this._string=[]}function on(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}nn.prototype={_radius:4.5,_circle:on(4.5),pointRadius:function(t){return(t=+t)!==this._radius&&(this._radius=t,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._string.push("Z"),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._string.push("M",t,",",e),this._point=1;break;case 1:this._string.push("L",t,",",e);break;default:null==this._circle&&(this._circle=on(this._radius)),this._string.push("M",t,",",e,this._circle)}},result:function(){if(this._string.length){var t=this._string.join("");return this._string=[],t}return null}};var sn=class extends Pt{static __inputs=[{id:"x",type:"any"},{id:"y",type:"number"}];_dataMinWeight;_dataMaxWeight;constructor(){super(),this.xAxisGuideLines_default(!1).yAxisGuideLines_default(!1).xAxisType_default("linear")}xPos(t,e){return"horizontal"===t.orientation()?t.dataPos(e.label):t.valuePos(e.value)}yPos(t,e){return"horizontal"===t.orientation()?t.valuePos(e.value):t.dataPos(e.label)}layerEnter(t,e,i=250){super.layerEnter(t,e,i)}layerUpdate(t,e,n=250){super.layerUpdate(t,e,n),this._palette=this._palette.switch(this.paletteID());const o=this.flattenData(this.layerColumns(t),this.layerData(t)),s=function(){var t=Le,e=Be,n=He,o=960,s=500,a=20,r=2,l=3*a,h=o+2*l>>r,c=s+2*l>>r,u=ze(20);function p(o){var s=new Float32Array(h*c),p=new Float32Array(h*c);o.forEach(function(i,o,a){var u=+t(i,o,a)+l>>r,p=+e(i,o,a)+l>>r,d=+n(i,o,a);u>=0&&u<h&&p>=0&&p<c&&(s[u+p*h]+=d)}),Ee({width:h,height:c,data:s},{width:h,height:c,data:p},a>>r),Ne({width:h,height:c,data:p},{width:h,height:c,data:s},a>>r),Ee({width:h,height:c,data:s},{width:h,height:c,data:p},a>>r),Ne({width:h,height:c,data:p},{width:h,height:c,data:s},a>>r),Ee({width:h,height:c,data:s},{width:h,height:c,data:p},a>>r),Ne({width:h,height:c,data:p},{width:h,height:c,data:s},a>>r);var f=u(s);if(!Array.isArray(f)){var y=(0,i.max)(s);f=(0,i.tickStep)(0,y,f),(f=(0,i.range)(0,Math.floor(y/f)*f,f)).shift()}return Re().thresholds(f).size([h,c])(s).map(d)}function d(t){return t.value*=Math.pow(2,-2*r),t.coordinates.forEach(f),t}function f(t){t.forEach(y)}function y(t){t.forEach(_)}function _(t){t[0]=t[0]*Math.pow(2,r)-l,t[1]=t[1]*Math.pow(2,r)-l}function x(){return h=o+2*(l=3*a)>>r,c=s+2*l>>r,p}return p.x=function(e){return arguments.length?(t="function"==typeof e?e:ze(+e),p):t},p.y=function(t){return arguments.length?(e="function"==typeof t?t:ze(+t),p):e},p.weight=function(t){return arguments.length?(n="function"==typeof t?t:ze(+t),p):n},p.size=function(t){if(!arguments.length)return[o,s];var e=Math.ceil(t[0]),i=Math.ceil(t[1]);if(!(e>=0||e>=0))throw new Error("invalid size");return o=e,s=i,x()},p.cellSize=function(t){if(!arguments.length)return 1<<r;if(!((t=+t)>=1))throw new Error("invalid cell size");return r=Math.floor(Math.log(t)/Math.LN2),x()},p.thresholds=function(t){return arguments.length?(u="function"==typeof t?t:Array.isArray(t)?ze(Pe.call(t)):ze(t),p):u},p.bandwidth=function(t){if(!arguments.length)return Math.sqrt(a*(a+1));if(!((t=+t)>=0))throw new Error("invalid bandwidth");return a=Math.round((Math.sqrt(4*t*t+1)-1)/2),x()},p}().x(e=>this.xPos(t,e)).y(e=>this.yPos(t,e)).size([this.width(),this.height()]).bandwidth(this.contourBandwidth())(o),a=s.map(t=>t.value),r=Math.min.apply(this,a),l=Math.max.apply(this,a);this._dataMinWeight=r,this._dataMaxWeight=l;const h=e.selectAll("path").data(s);h.enter().append("path").merge(h).attr("d",function(t,e){var i,n,o=4.5;function s(t){return t&&("function"==typeof o&&n.pointRadius(+o.apply(this,arguments)),ii(t,i(n))),n.result()}return s.area=function(t){return ii(t,i(yi)),yi.result()},s.measure=function(t){return ii(t,i(en)),en.result()},s.bounds=function(t){return ii(t,i(Ai)),Ai.result()},s.centroid=function(t){return ii(t,i(Wi)),Wi.result()},s.projection=function(e){return arguments.length?(i=null==e?(t=null,ni):(t=e).stream,s):t},s.context=function(t){return arguments.length?(n=null==t?(e=null,new nn):new Gi(e=t),"function"!=typeof o&&n.pointRadius(o),s):e},s.pointRadius=function(t){return arguments.length?(o="function"==typeof t?t:(n.pointRadius(+t),+t),s):o},s.projection(t).context(e)}()).attr("fill",t=>this.showContourFill()?this._palette(t.value,r,l):"none").attr("stroke",this.contourStrokeColor()).attr("stroke-linejoin","round").attr("stroke-width",this.contourStrokeWidth()),h.exit().remove()}exit(t,e){super.exit(t,e)}};sn.prototype._class+=" chart_Contour",sn.prototype.implements(e.I1DChart.prototype),sn.prototype.publish("paletteID","YlGnBu","string","Color palette for this widget"),sn.prototype.publish("useClonedPalette",!0,"boolean","Enable or disable using a cloned palette"),sn.prototype.publish("showContourFill",!0,"boolean","Show/hide the contour background colors"),sn.prototype.publish("showContour",!0,"boolean","Show/hide the contour border lines"),sn.prototype.publish("contourBandwidth",40,"number","Controls the sensitivity of the contour grouping algorithm"),sn.prototype.publish("contourStrokeColor","#2C3A47","html-color","Color of the contour border lines"),sn.prototype.publish("contourStrokeWidth",1,"number","Width of the contour border lines");var an=class extends Dt{constructor(){super(),this.orientation_default("vertical").xAxisType_default("ordinal").yAxisType_default("time")}};function rn(t){return function(){return t}}an.prototype._class+=" chart_Gantt";var ln=Math.PI,hn=ln/2,cn=2*ln;function un(t){return t.innerRadius}function pn(t){return t.outerRadius}function dn(t){return t.startAngle}function fn(t){return t.endAngle}function yn(t){return t&&t.padAngle}function _n(t){return t>=1?hn:t<=-1?-hn:Math.asin(t)}function xn(t,e,i,n,o,s,a){var r=t-i,l=e-n,h=(a?s:-s)/Math.sqrt(r*r+l*l),c=h*l,u=-h*r,p=t+c,d=e+u,f=i+c,y=n+u,_=(p+f)/2,x=(d+y)/2,m=f-p,g=y-d,b=m*m+g*g,v=o-s,w=p*y-f*d,S=(g<0?-1:1)*Math.sqrt(Math.max(0,v*v*b-w*w)),A=(w*g-m*S)/b,k=(-w*m-g*S)/b,M=(w*g+m*S)/b,T=(-w*m+g*S)/b,P=A-_,C=k-x,z=M-_,I=T-x;return P*P+C*C>z*z+I*I&&(A=M,k=T),{cx:A,cy:k,x01:-c,y01:-u,x11:A*(o/v-1),y11:k*(o/v-1)}}function mn(t){this._context=t}function gn(t){return new mn(t)}function bn(t){return t[0]}function vn(t){return t[1]}mn.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e)}}};!function(t){function e(e){return new wn(t(e))}e._curve=t}(gn);function wn(t){this._curve=t}wn.prototype={areaStart:function(){this._curve.areaStart()},areaEnd:function(){this._curve.areaEnd()},lineStart:function(){this._curve.lineStart()},lineEnd:function(){this._curve.lineEnd()},point:function(t,e){this._curve.point(e*Math.sin(t),e*-Math.cos(t))}};Math.sqrt(1/3);var Sn=Math.sin(ln/10)/Math.sin(7*ln/10);Math.sin(cn/10),Math.cos(cn/10),Math.sqrt(3),Math.sqrt(3),Math.sqrt(12);function An(){}function kn(t,e,i){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+i)/6)}function Mn(t){this._context=t}function Tn(t,e){this._basis=new Mn(t),this._beta=e}Mn.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:kn(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:kn(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},Tn.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var t=this._x,e=this._y,i=t.length-1;if(i>0)for(var n,o=t[0],s=e[0],a=t[i]-o,r=e[i]-s,l=-1;++l<=i;)n=l/i,this._basis.point(this._beta*t[l]+(1-this._beta)*(o+n*a),this._beta*e[l]+(1-this._beta)*(s+n*r));this._x=this._y=null,this._basis.lineEnd()},point:function(t,e){this._x.push(+t),this._y.push(+e)}};(function t(e){function i(t){return 1===e?new Mn(t):new Tn(t,e)}return i.beta=function(e){return t(+e)},i})(.85);function Pn(t,e,i){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-e),t._y2+t._k*(t._y1-i),t._x2,t._y2)}function Cn(t,e){this._context=t,this._k=(1-e)/6}Cn.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:Pn(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2,this._x1=t,this._y1=e;break;case 2:this._point=3;default:Pn(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};(function t(e){function i(t){return new Cn(t,e)}return i.tension=function(e){return t(+e)},i})(0);function zn(t,e){this._context=t,this._k=(1-e)/6}zn.prototype={areaStart:An,areaEnd:An,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:Pn(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};(function t(e){function i(t){return new zn(t,e)}return i.tension=function(e){return t(+e)},i})(0);function In(t,e){this._context=t,this._k=(1-e)/6}In.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Pn(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};(function t(e){function i(t){return new In(t,e)}return i.tension=function(e){return t(+e)},i})(0);function Dn(t,e,i){var n=t._x1,o=t._y1,s=t._x2,a=t._y2;if(t._l01_a>1e-12){var r=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,l=3*t._l01_a*(t._l01_a+t._l12_a);n=(n*r-t._x0*t._l12_2a+t._x2*t._l01_2a)/l,o=(o*r-t._y0*t._l12_2a+t._y2*t._l01_2a)/l}if(t._l23_a>1e-12){var h=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,c=3*t._l23_a*(t._l23_a+t._l12_a);s=(s*h+t._x1*t._l23_2a-e*t._l12_2a)/c,a=(a*h+t._y1*t._l23_2a-i*t._l12_2a)/c}t._context.bezierCurveTo(n,o,s,a,t._x2,t._y2)}function Fn(t,e){this._context=t,this._alpha=e}Fn.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var i=this._x2-t,n=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(i*i+n*n,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3;default:Dn(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var On=function t(e){function i(t){return e?new Fn(t,e):new Cn(t,0)}return i.alpha=function(e){return t(+e)},i}(.5);function jn(t,e){this._context=t,this._alpha=e}jn.prototype={areaStart:An,areaEnd:An,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,e){if(t=+t,e=+e,this._point){var i=this._x2-t,n=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(i*i+n*n,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:Dn(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};(function t(e){function i(t){return e?new jn(t,e):new zn(t,0)}return i.alpha=function(e){return t(+e)},i})(.5);function Rn(t,e){this._context=t,this._alpha=e}Rn.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var i=this._x2-t,n=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(i*i+n*n,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Dn(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};(function t(e){function i(t){return e?new Rn(t,e):new In(t,0)}return i.alpha=function(e){return t(+e)},i})(.5);function En(t){return t<0?-1:1}function Nn(t,e,i){var n=t._x1-t._x0,o=e-t._x1,s=(t._y1-t._y0)/(n||o<0&&-0),a=(i-t._y1)/(o||n<0&&-0),r=(s*o+a*n)/(n+o);return(En(s)+En(a))*Math.min(Math.abs(s),Math.abs(a),.5*Math.abs(r))||0}function Ln(t,e){var i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function Bn(t,e,i){var n=t._x0,o=t._y0,s=t._x1,a=t._y1,r=(s-n)/3;t._context.bezierCurveTo(n+r,o+r*e,s-r,a-r*i,s,a)}function Hn(t){this._context=t}function Vn(t){this._context=t}Hn.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:Bn(this,this._t0,Ln(this,this._t0))}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){var i=NaN;if(e=+e,(t=+t)!==this._x1||e!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,Bn(this,Ln(this,i=Nn(this,t,e)),i);break;default:Bn(this,this._t0,i=Nn(this,t,e))}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=i}}},(function(t){this._context=new Vn(t)}.prototype=Object.create(Hn.prototype)).point=function(t,e){Hn.prototype.point.call(this,e,t)},Vn.prototype={moveTo:function(t,e){this._context.moveTo(e,t)},closePath:function(){this._context.closePath()},lineTo:function(t,e){this._context.lineTo(e,t)},bezierCurveTo:function(t,e,i,n,o,s){this._context.bezierCurveTo(e,t,n,i,s,o)}};Array.prototype.slice;var qn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Wn=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},Gn=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),$n=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])}return t},Xn=function t(e,i,n){null===e&&(e=Function.prototype);var o=Object.getOwnPropertyDescriptor(e,i);if(void 0===o){var s=Object.getPrototypeOf(e);return null===s?void 0:t(s,i,n)}if("value"in o)return o.value;var a=o.get;return void 0!==a?a.call(n):void 0},Yn=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)},Un=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e},Qn=function(){function t(e){var i=e.x,n=void 0===i?0:i,o=e.y,s=void 0===o?0:o,a=e.nx,r=e.ny,l=e.dy,h=void 0===l?0:l,c=e.dx,u=void 0===c?0:c,p=e.color,d=void 0===p?"grey":p,f=e.data,y=e.type,_=e.subject,x=e.connector,m=e.note,g=e.disable,b=e.id,v=e.className;Wn(this,t),this._dx=void 0!==a?a-n:u,this._dy=void 0!==r?r-s:h,this._x=n,this._y=s,this._color=d,this.id=b,this._className=v||"",this._type=y||"",this.data=f,this.note=m||{},this.connector=x||{},this.subject=_||{},this.disable=g||[]}return Gn(t,[{key:"updatePosition",value:function(){this.type.setPosition&&(this.type.setPosition(),this.type.subject&&0!==this.type.subject.selectAll(":not(.handle)").nodes().length&&this.type.redrawSubject())}},{key:"clearComponents",value:function(){this.type.clearComponents&&this.type.clearComponents()}},{key:"updateOffset",value:function(){this.type.setOffset&&(this.type.setOffset(),0!==this.type.connector.selectAll(":not(.handle)").nodes().length&&this.type.redrawConnector(),this.type.redrawNote())}},{key:"className",get:function(){return this._className},set:function(t){this._className=t,this.type.setClassName&&this.type.setClassName()}},{key:"type",get:function(){return this._type},set:function(t){this._type=t,this.clearComponents()}},{key:"x",get:function(){return this._x},set:function(t){this._x=t,this.updatePosition()}},{key:"y",get:function(){return this._y},set:function(t){this._y=t,this.updatePosition()}},{key:"color",get:function(){return this._color},set:function(t){this._color=t,this.updatePosition()}},{key:"dx",get:function(){return this._dx},set:function(t){this._dx=t,this.updateOffset()}},{key:"dy",get:function(){return this._dy},set:function(t){this._dy=t,this.updateOffset()}},{key:"nx",set:function(t){this._dx=t-this._x,this.updateOffset()}},{key:"ny",set:function(t){this._dy=t-this._y,this.updateOffset()}},{key:"offset",get:function(){return{x:this._dx,y:this._dy}},set:function(t){var e=t.x,i=t.y;this._dx=e,this._dy=i,this.updateOffset()}},{key:"position",get:function(){return{x:this._x,y:this._y}},set:function(t){var e=t.x,i=t.y;this._x=e,this._y=i,this.updatePosition()}},{key:"translation",get:function(){return{x:this._x+this._dx,y:this._y+this._dy}}},{key:"json",get:function(){var t={x:this._x,y:this._y,dx:this._dx,dy:this._dy};return this.data&&Object.keys(this.data).length>0&&(t.data=this.data),this.type&&(t.type=this.type),this._className&&(t.className=this._className),Object.keys(this.connector).length>0&&(t.connector=this.connector),Object.keys(this.subject).length>0&&(t.subject=this.subject),Object.keys(this.note).length>0&&(t.note=this.note),t}}]),t}(),Zn=function(){function t(e){var i=e.annotations,n=e.accessors,o=e.accessorsInverse;Wn(this,t),this.accessors=n,this.accessorsInverse=o,this.annotations=i}return Gn(t,[{key:"clearTypes",value:function(t){this.annotations.forEach(function(e){e.type=void 0,e.subject=t&&t.subject||e.subject,e.connector=t&&t.connector||e.connector,e.note=t&&t.note||e.note})}},{key:"setPositionWithAccessors",value:function(){var t=this;this.annotations.forEach(function(e){e.type.setPositionWithAccessors(t.accessors)})}},{key:"editMode",value:function(t){this.annotations.forEach(function(e){e.type&&(e.type.editMode=t,e.type.updateEditMode())})}},{key:"updateDisable",value:function(t){this.annotations.forEach(function(e){e.disable=t,e.type&&t.forEach(function(t){e.type[t]&&(e.type[t].remove&&e.type[t].remove(),e.type[t]=void 0)})})}},{key:"updateTextWrap",value:function(t){this.annotations.forEach(function(e){e.type&&e.type.updateTextWrap&&e.type.updateTextWrap(t)})}},{key:"updateText",value:function(){this.annotations.forEach(function(t){t.type&&t.type.drawText&&t.type.drawText()})}},{key:"updateNotePadding",value:function(t){this.annotations.forEach(function(e){e.type&&(e.type.notePadding=t)})}},{key:"json",get:function(){var t=this;return this.annotations.map(function(e){var i=e.json;return t.accessorsInverse&&e.data&&(i.data={},Object.keys(t.accessorsInverse).forEach(function(n){i.data[n]=t.accessorsInverse[n]({x:e.x,y:e.y})})),i})}},{key:"noteNodes",get:function(){return this.annotations.map(function(t){return $n({},t.type.getNoteBBoxOffset(),{positionX:t.x,positionY:t.y})})}}]),t}(),Jn=function(t,e){return"dynamic"!==t&&"left"!==t&&"right"!==t||(t=e<0?"top":"bottom"),t},Kn=function(t,e){return"dynamic"!==t&&"top"!==t&&"bottom"!==t||(t=e<0?"right":"left"),t},to=["topBottom","top","bottom"],eo=["leftRight","left","right"],io=function(t){var e=t.data,i=t.curve,n=void 0===i?gn:i,o=t.canvasContext,s=t.className,a=t.classID,r=function(){var t=bn,e=vn,i=rn(!0),n=null,o=gn,s=null;function a(a){var r,l,h,c=a.length,u=!1;for(null==n&&(s=o(h=x())),r=0;r<=c;++r)!(r<c&&i(l=a[r],r,a))===u&&((u=!u)?s.lineStart():s.lineEnd()),u&&s.point(+t(l,r,a),+e(l,r,a));if(h)return s=null,h+""||null}return a.x=function(e){return arguments.length?(t="function"==typeof e?e:rn(+e),a):t},a.y=function(t){return arguments.length?(e="function"==typeof t?t:rn(+t),a):e},a.defined=function(t){return arguments.length?(i="function"==typeof t?t:rn(!!t),a):i},a.curve=function(t){return arguments.length?(o=t,null!=n&&(s=o(n)),a):o},a.context=function(t){return arguments.length?(null==t?n=s=null:s=o(n=t),a):n},a}().curve(n),l={type:"path",className:s,classID:a,data:e};return o?(r.context(o),l.pathMethods=r):l.attrs={d:r(e)},l},no=function(t){var e=t.data,i=t.canvasContext,n={type:"path",className:t.className,classID:t.classID,data:e},o=function(){var t=un,e=pn,i=rn(0),n=null,o=dn,s=fn,a=yn,r=null;function l(){var l,h,c=+t.apply(this,arguments),u=+e.apply(this,arguments),p=o.apply(this,arguments)-hn,d=s.apply(this,arguments)-hn,f=Math.abs(d-p),y=d>p;if(r||(r=l=x()),u<c&&(h=u,u=c,c=h),u>1e-12)if(f>cn-1e-12)r.moveTo(u*Math.cos(p),u*Math.sin(p)),r.arc(0,0,u,p,d,!y),c>1e-12&&(r.moveTo(c*Math.cos(d),c*Math.sin(d)),r.arc(0,0,c,d,p,y));else{var _,m,g=p,b=d,v=p,w=d,S=f,A=f,k=a.apply(this,arguments)/2,M=k>1e-12&&(n?+n.apply(this,arguments):Math.sqrt(c*c+u*u)),T=Math.min(Math.abs(u-c)/2,+i.apply(this,arguments)),P=T,C=T;if(M>1e-12){var z=_n(M/c*Math.sin(k)),I=_n(M/u*Math.sin(k));(S-=2*z)>1e-12?(v+=z*=y?1:-1,w-=z):(S=0,v=w=(p+d)/2),(A-=2*I)>1e-12?(g+=I*=y?1:-1,b-=I):(A=0,g=b=(p+d)/2)}var D=u*Math.cos(g),F=u*Math.sin(g),O=c*Math.cos(w),j=c*Math.sin(w);if(T>1e-12){var R=u*Math.cos(b),E=u*Math.sin(b),N=c*Math.cos(v),L=c*Math.sin(v);if(f<ln){var B=S>1e-12?function(t,e,i,n,o,s,a,r){var l=i-t,h=n-e,c=a-o,u=r-s,p=(c*(e-s)-u*(t-o))/(u*l-c*h);return[t+p*l,e+p*h]}(D,F,N,L,R,E,O,j):[O,j],H=D-B[0],V=F-B[1],q=R-B[0],W=E-B[1],G=1/Math.sin(Math.acos((H*q+V*W)/(Math.sqrt(H*H+V*V)*Math.sqrt(q*q+W*W)))/2),$=Math.sqrt(B[0]*B[0]+B[1]*B[1]);P=Math.min(T,(c-$)/(G-1)),C=Math.min(T,(u-$)/(G+1))}}A>1e-12?C>1e-12?(_=xn(N,L,D,F,u,C,y),m=xn(R,E,O,j,u,C,y),r.moveTo(_.cx+_.x01,_.cy+_.y01),C<T?r.arc(_.cx,_.cy,C,Math.atan2(_.y01,_.x01),Math.atan2(m.y01,m.x01),!y):(r.arc(_.cx,_.cy,C,Math.atan2(_.y01,_.x01),Math.atan2(_.y11,_.x11),!y),r.arc(0,0,u,Math.atan2(_.cy+_.y11,_.cx+_.x11),Math.atan2(m.cy+m.y11,m.cx+m.x11),!y),r.arc(m.cx,m.cy,C,Math.atan2(m.y11,m.x11),Math.atan2(m.y01,m.x01),!y))):(r.moveTo(D,F),r.arc(0,0,u,g,b,!y)):r.moveTo(D,F),c>1e-12&&S>1e-12?P>1e-12?(_=xn(O,j,R,E,c,-P,y),m=xn(D,F,N,L,c,-P,y),r.lineTo(_.cx+_.x01,_.cy+_.y01),P<T?r.arc(_.cx,_.cy,P,Math.atan2(_.y01,_.x01),Math.atan2(m.y01,m.x01),!y):(r.arc(_.cx,_.cy,P,Math.atan2(_.y01,_.x01),Math.atan2(_.y11,_.x11),!y),r.arc(0,0,c,Math.atan2(_.cy+_.y11,_.cx+_.x11),Math.atan2(m.cy+m.y11,m.cx+m.x11),y),r.arc(m.cx,m.cy,P,Math.atan2(m.y11,m.x11),Math.atan2(m.y01,m.x01),!y))):r.arc(0,0,c,w,v,y):r.lineTo(O,j)}else r.moveTo(0,0);if(r.closePath(),l)return r=null,l+""||null}return l.centroid=function(){var i=(+t.apply(this,arguments)+ +e.apply(this,arguments))/2,n=(+o.apply(this,arguments)+ +s.apply(this,arguments))/2-ln/2;return[Math.cos(n)*i,Math.sin(n)*i]},l.innerRadius=function(e){return arguments.length?(t="function"==typeof e?e:rn(+e),l):t},l.outerRadius=function(t){return arguments.length?(e="function"==typeof t?t:rn(+t),l):e},l.cornerRadius=function(t){return arguments.length?(i="function"==typeof t?t:rn(+t),l):i},l.padRadius=function(t){return arguments.length?(n=null==t?null:"function"==typeof t?t:rn(+t),l):n},l.startAngle=function(t){return arguments.length?(o="function"==typeof t?t:rn(+t),l):o},l.endAngle=function(t){return arguments.length?(s="function"==typeof t?t:rn(+t),l):s},l.padAngle=function(t){return arguments.length?(a="function"==typeof t?t:rn(+t),l):a},l.context=function(t){return arguments.length?(r=null==t?null:t,l):r},l}().innerRadius(e.innerRadius||0).outerRadius(e.outerRadius||e.radius||2).startAngle(e.startAngle||0).endAngle(e.endAngle||2*Math.PI);return i?(o.context(i),n.pathMethods=lineGen):n.attrs={d:o()},n},oo=function(t){var e=t.type,i=t.subjectType,n=e.annotation,o=n.position,s=n.x-o.x,a=s+n.dx,r=n.y-o.y,l=r+n.dy,h=n.subject;if("circle"===i&&(h.outerRadius||h.radius)){var c=Math.sqrt((s-a)*(s-a)+(r-l)*(r-l)),u=Math.asin(-l/c),p=h.outerRadius||h.radius+(h.radiusPadding||0);s=Math.abs(Math.cos(u)*p)*(a<0?-1:1),r=Math.abs(Math.sin(u)*p)*(l<0?-1:1)}if("rect"===i){var d=h.width,f=h.height;(d>0&&n.dx>0||d<0&&n.dx<0)&&(s=Math.abs(d)>Math.abs(n.dx)?d/2:d),(f>0&&n.dy>0||f<0&&n.dy<0)&&(r=Math.abs(f)>Math.abs(n.dy)?f/2:f),s===d/2&&r===f/2&&(s=a,r=l)}return[[s,r],[a,l]]},so=function(t){var e=t.type,n=t.connectorData,o=t.subjectType;n||(n={}),n.points&&"number"!=typeof n.points||(n.points=ao(e.annotation.offset,n.points)),n.curve||(n.curve=On);var s=[];if(e.editMode){var a=n.points.map(function(t,e){return $n({},function(t){var e=t.cx,i=void 0===e?0:e,n=t.cy;return{move:{x:i,y:void 0===n?0:n}}}({cx:t[0],cy:t[1]}),{index:e})}),r=function(t){n.points[t][0]+=i.event.dx,n.points[t][1]+=i.event.dy,e.redrawConnector()};s=e.mapHandles(a.map(function(t){return $n({},t.move,{drag:r.bind(e,t.index)})}))}var l=oo({type:e,subjectType:o});return l=[l[0]].concat(function(t){if(Array.isArray(t)){for(var e=0,i=Array(t.length);e<t.length;e++)i[e]=t[e];return i}return Array.from(t)}(n.points),[l[1]]),{components:[io({data:l,curve:n.curve,className:"connector"})],handles:s}},ao=function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2,i=t.x/(e+1),n=t.y/(e+1),o=[],s=1;s<=e;s++)o.push([i*s+s%2*20,n*s-s%2*20]);return o},ro=function(t){var e=t.subjectData,n=t.type;e.radius||e.outerRadius||(e.radius=20);var o=[],s=no({data:e,className:"subject"});if(n.editMode){var a=function(t){var e=t.cx,i=void 0===e?0:e,n=t.cy,o=void 0===n?0:n,s=t.r1,a=t.r2,r=t.padding,l={move:{x:i,y:o}};return void 0!==s&&(l.r1={x:i+s/Math.sqrt(2),y:o+s/Math.sqrt(2)}),void 0!==a&&(l.r2={x:i+a/Math.sqrt(2),y:o+a/Math.sqrt(2)}),void 0!==r&&(l.padding={x:i+s+r,y:o}),l}({r1:s.data.outerRadius||s.data.radius,r2:s.data.innerRadius,padding:e.radiusPadding}),r=function(t){e[t]=e[t]+i.event.dx*Math.sqrt(2),n.redrawSubject(),n.redrawConnector()},l=[$n({},a.r1,{drag:r.bind(n,void 0!==e.outerRadius?"outerRadius":"radius")})];e.innerRadius&&l.push($n({},a.r2,{drag:r.bind(n,"innerRadius")})),o=n.mapHandles(l)}return s.attrs["fill-opacity"]=0,{components:[s],handles:o}},lo=function(){function t(e){var i=e.a,n=e.annotation,o=e.editMode,s=e.dispatcher,a=e.notePadding,r=e.accessors;if(Wn(this,t),this.a=i,this.note=-1===n.disable.indexOf("note")&&i.select("g.annotation-note"),this.noteContent=this.note&&i.select("g.annotation-note-content"),this.connector=-1===n.disable.indexOf("connector")&&i.select("g.annotation-connector"),this.subject=-1===n.disable.indexOf("subject")&&i.select("g.annotation-subject"),this.dispatcher=s,s){var l=yo.bind(null,s,n);l({component:this.note,name:"note"}),l({component:this.connector,name:"connector"}),l({component:this.subject,name:"subject"})}this.annotation=n,this.editMode=n.editMode||o,this.notePadding=void 0!==a?a:3,this.offsetCornerX=0,this.offsetCornerY=0,r&&n.data&&this.init(r)}return Gn(t,[{key:"init",value:function(t){this.annotation.x||this.mapX(t),this.annotation.y||this.mapY(t)}},{key:"mapY",value:function(t){t.y&&(this.annotation.y=t.y(this.annotation.data))}},{key:"mapX",value:function(t){t.x&&(this.annotation.x=t.x(this.annotation.data))}},{key:"updateEditMode",value:function(){this.a.selectAll("circle.handle").remove()}},{key:"drawOnSVG",value:function(t,e){var n=this;Array.isArray(e)||(e=[e]),e.filter(function(t){return t}).forEach(function(e){var o=e.type,s=e.className,a=e.attrs,r=e.handles,l=e.classID;if("handle"===o)!function(t){var e=t.group,n=t.handles,o=t.r,s=void 0===o?10:o,a=e.selectAll("circle.handle").data(n);a.enter().append("circle").attr("class","handle").attr("fill","grey").attr("fill-opacity",.1).attr("cursor","move").attr("stroke-dasharray",5).attr("stroke","grey").call((0,i.drag)().container((0,i.select)("g.annotations").node()).on("start",function(t){return t.start&&t.start(t)}).on("drag",function(t){return t.drag&&t.drag(t)}).on("end",function(t){return t.end&&t.end(t)})),e.selectAll("circle.handle").attr("cx",function(t){return t.x}).attr("cy",function(t){return t.y}).attr("r",function(t){return t.r||s}).attr("class",function(t){return"handle "+(t.className||"")}),a.exit().remove()}({group:t,r:a&&a.r,handles:r});else{fo(t,[n.annotation],o,s,l);for(var h=t.select(o+"."+(l||s)),c=Object.keys(a),u=[],p=h.node().attributes,d=p.length-1;d>=0;d--){var f=p[d].name;-1===c.indexOf(f)&&"class"!==f&&u.push(f)}c.forEach(function(t){"text"===t?h.text(a[t]):h.attr(t,a[t])}),u.forEach(function(t){return h.attr(t,null)})}})}},{key:"getNoteBBox",value:function(){return xo(this.note,".annotation-note-content text")}},{key:"getNoteBBoxOffset",value:function(){var t=xo(this.note,".annotation-note-content"),e=this.noteContent.attr("transform").split(/\(|\,|\)/g);return t.offsetCornerX=parseFloat(e[1])+this.annotation.dx,t.offsetCornerY=parseFloat(e[2])+this.annotation.dy,t.offsetX=this.annotation.dx,t.offsetY=this.annotation.dy,t}},{key:"drawSubject",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=this.annotation.subject,o=e.type,s={type:this,subjectData:n},a={};"circle"===o?a=ro(s):"rect"===o?a=function(t){var e=t.subjectData,n=t.type;e.width||(e.width=100),e.height||(e.height=100);var o=[],s=e.width,a=e.height,r=io({data:[[0,0],[s,0],[s,a],[0,a],[0,0]],className:"subject"});if(n.editMode){var l=[{x:s,y:a/2,drag:function(){e.width=i.event.x,n.redrawSubject(),n.redrawConnector()}.bind(n)},{x:s/2,y:a,drag:function(){e.height=i.event.y,n.redrawSubject(),n.redrawConnector()}.bind(n)}];o=n.mapHandles(l)}return r.attrs["fill-opacity"]=.1,{components:[r],handles:o}}(s):"threshold"===o?a=function(t){var e=t.subjectData,i=t.type.annotation.position,n=(void 0!==e.x1?e.x1:i.x)-i.x,o=(void 0!==e.x2?e.x2:i.x)-i.x,s=(void 0!==e.y1?e.y1:i.y)-i.y,a=(void 0!==e.y2?e.y2:i.y)-i.y;return{components:[io({data:[[n,s],[o,a]],className:"subject"})]}}(s):"badge"===o&&(a=function(t){var e=t.subjectData,n=void 0===e?{}:e,o=t.type,s=void 0===o?{}:o,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=s.typeSettings&&s.typeSettings.subject;n.radius||(r&&r.radius?n.radius=r.radius:n.radius=14),n.x||r&&r.x&&(n.x=r.x),n.y||r&&r.y&&(n.y=r.y);var l=[],h=[],c=n.radius,u=.7*c,p=0,d=0,f=Math.sqrt(2)*c,y={xleftcorner:-c,xrightcorner:c,ytopcorner:-c,ybottomcorner:c,xleft:-f,xright:f,ytop:-f,ybottom:f};n.x&&!n.y?p=y["x"+n.x]:n.y&&!n.x?d=y["y"+n.y]:n.x&&n.y&&(p=y["x"+n.x+"corner"],d=y["y"+n.y+"corner"]);var _="translate("+p+", "+d+")",x=no({className:"subject",data:{radius:c}});x.attrs.transform=_,x.attrs.fill=a.color,x.attrs["stroke-linecap"]="round",x.attrs["stroke-width"]="3px";var m=no({className:"subject-ring",data:{outerRadius:c,innerRadius:u}});m.attrs.transform=_,m.attrs["stroke-width"]="3px",m.attrs.fill="white";var g=void 0;if(p&&d||!p&&!d)g=io({className:"subject-pointer",data:[[0,0],[p||0,0],[0,d||0],[0,0]]});else if(p||d){var b=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return t&&t/Math.sqrt(2)/Math.sqrt(2)||e*c/Math.sqrt(2)};g=io({className:"subject-pointer",data:[[0,0],[b(p),b(d)],[b(p,-1),b(d,-1)],[0,0]]})}if(g&&(g.attrs.fill=a.color,g.attrs["stroke-linecap"]="round",g.attrs["stroke-width"]="3px",h.push(g)),s.editMode){var v={x:2*p,y:2*d,drag:function(){n.x=i.event.x<2*-c?"left":i.event.x>2*c?"right":void 0,n.y=i.event.y<2*-c?"top":i.event.y>2*c?"bottom":void 0,s.redrawSubject()}.bind(s)};v.x||v.y||(v.y=-c),l=s.mapHandles([v])}var w=void 0;return n.text&&(w={type:"text",className:"badge-text",attrs:{fill:"white",stroke:"none","font-size":".7em",text:n.text,"text-anchor":"middle",dy:".25em",x:p,y:d}}),h.push(x),h.push(m),h.push(w),{components:h,handles:l}}(s,this.annotation));var r=a,l=r.components,h=void 0===l?[]:l,c=r.handles,u=void 0===c?[]:c;return h.forEach(function(e){e&&e.attrs&&!e.attrs.stroke&&(e.attrs.stroke=t.annotation.color)}),this.editMode&&(u=u.concat(this.mapHandles([{drag:this.dragSubject.bind(this)}])),h.push({type:"handle",handles:u})),h}},{key:"drawConnector",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=this.annotation.connector,n=i.type||e.type,o={type:this,connectorData:i};o.subjectType=this.typeSettings&&this.typeSettings.subject&&this.typeSettings.subject.type;var s={};s="curve"===n?so(o):"elbow"===n?function(t){var e=t.type,i=t.subjectType,n=e.annotation,o=n.position,s=n.x-o.x,a=s+n.dx,r=n.y-o.y,l=r+n.dy,h=n.subject;if("rect"===i){var c=h.width,u=h.height;(c>0&&n.dx>0||c<0&&n.dx<0)&&(s=Math.abs(c)>Math.abs(n.dx)?c/2:c),(u>0&&n.dy>0||u<0&&n.dy<0)&&(r=Math.abs(u)>Math.abs(n.dy)?u/2:u),s===c/2&&r===u/2&&(s=a,r=l)}var p=[[s,r],[a,l]],d=l-r,f=a-s,y=a,_=l,x=l<r&&a>s||a<s&&l>r?-1:1;if(Math.abs(f)<Math.abs(d)?(y=a,_=r+f*x):(_=l,y=s+d*x),"circle"===i&&(h.outerRadius||h.radius)){var m=(h.outerRadius||h.radius)+(h.radiusPadding||0),g=m/Math.sqrt(2);if(Math.abs(f)>g&&Math.abs(d)>g)p=[[s=g*(a<0?-1:1),r=g*(l<0?-1:1)],[y,_],[a,l]];else if(Math.abs(f)>Math.abs(d)){var b=Math.asin(-l/m);p=[[s=Math.abs(Math.cos(b)*m)*(a<0?-1:1),l],[a,l]]}else{var v=Math.acos(a/m);p=[[a,r=Math.abs(Math.sin(v)*m)*(l<0?-1:1)],[a,l]]}}else p=[[s,r],[y,_],[a,l]];return{components:[io({data:p,className:"connector"})]}}(o):function(t){return{components:[io({data:oo(t),className:"connector"})]}}(o);var a=s,r=a.components,l=void 0===r?[]:r,h=a.handles,c=void 0===h?[]:h,u=l[0];u&&(u.attrs.stroke=this.annotation.color,u.attrs.fill="none");var p=i.end||e.end,d={};if("arrow"===p){var f=u.data[1],y=u.data[0];Math.sqrt(Math.pow(f[0]-y[0],2)+Math.pow(f[1]-y[1],2))<5&&u.data[2]&&(f=u.data[2]),d=function(t){var e=t.annotation,i=t.start,n=t.end,o=t.scale,s=void 0===o?1:o,a=e.position;i=i?[-n[0]+i[0],-n[1]+i[1]]:[e.dx,e.dy],n||(n=[e.x-a.x,e.y-a.y]);var r=n[0],l=n[1],h=i[0],c=i[1],u=10*s,p=16/180*Math.PI,d=Math.atan(c/h);return h<0&&(d+=Math.PI),{components:[io({data:[[r,l],[Math.cos(d+p)*u+r,Math.sin(d+p)*u+l],[Math.cos(d-p)*u+r,Math.sin(d-p)*u+l],[r,l]],className:"connector-end connector-arrow",classID:"connector-end"})]}}({annotation:this.annotation,start:f,end:y,scale:i.endScale})}else"dot"===p?d=function(t){var e=t.line,i=t.scale,n=void 0===i?1:i,o=no({className:"connector-end connector-dot",classID:"connector-end",data:{radius:3*Math.sqrt(n)}});return o.attrs.transform="translate("+e.data[0][0]+", "+e.data[0][1]+")",{components:[o]}}({line:u,scale:i.endScale}):p&&"none"!==p||this.connector&&this.connector.select(".connector-end").remove();return d.components&&(d.components.forEach(function(e){e.attrs.fill=t.annotation.color,e.attrs.stroke=t.annotation.color}),l=l.concat(d.components)),this.editMode&&0!==c.length&&l.push({type:"handle",handles:c}),l}},{key:"drawNote",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=this.annotation.note,o=n.align||e.align||"dynamic",s={bbox:e.bbox,align:o,offset:this.annotation.offset},a=n.lineType||e.lineType,r={};"vertical"===a?r=function(t){var e=t.align,i=t.x,n=void 0===i?0:i,o=t.y,s=void 0===o?0:o,a=t.bbox,r=t.offset;return"top"===(e=Jn(e,r.y))?s-=a.height:"middle"===e&&(s-=a.height/2),{components:[io({data:[[n,s],[n,s+a.height]],className:"note-line"})]}}(s):"horizontal"===a&&(r=function(t){var e=t.align,i=t.x,n=void 0===i?0:i,o=t.y,s=void 0===o?0:o,a=t.offset,r=t.bbox;return"right"===(e=Kn(e,a.x))?n-=r.width:"middle"===e&&(n-=r.width/2),{components:[io({data:[[n,s],[n+r.width,s]],className:"note-line"})]}}(s));var l=r,h=l.components,c=void 0===h?[]:h,u=l.handles,p=void 0===u?[]:u;if(c.forEach(function(e){e.attrs.stroke=t.annotation.color}),this.editMode){p=this.mapHandles([{x:0,y:0,drag:this.dragNote.bind(this)}]),c.push({type:"handle",handles:p});var d=this.dragNote.bind(this),f=this.dragstarted.bind(this),y=this.dragended.bind(this);this.note.call((0,i.drag)().container((0,i.select)("g.annotations").node()).on("start",function(t){return f(t)}).on("drag",function(t){return d(t)}).on("end",function(t){return y(t)}))}else this.note.on("mousedown.drag",null);return c}},{key:"drawNoteContent",value:function(t){var e=this.annotation.note,i=void 0!==e.padding?e.padding:this.notePadding,n=e.orientation||t.orientation||"topBottom",o=e.lineType||t.lineType,s=e.align||t.align||"dynamic";"vertical"===o?n="leftRight":"horizontal"===o&&(n="topBottom");var a=function(t){var e=t.padding,i=void 0===e?0:e,n=t.bbox,o=void 0===n?{x:0,y:0,width:0,height:0}:n,s=t.align,a=t.orientation,r=t.offset,l=void 0===r?{x:0,y:0}:r,h=-o.x,c=0;return-1!==to.indexOf(a)?(s=Kn(s,l.x),l.y<0&&"topBottom"===a||"top"===a?c-=o.height+i:c+=i,"middle"===s?h-=o.width/2:"right"===s&&(h-=o.width)):-1!==eo.indexOf(a)&&(s=Jn(s,l.y),l.x<0&&"leftRight"===a||"left"===a?h-=o.width+i:h+=i,"middle"===s?c-=o.height/2:"top"===s&&(c-=o.height)),{x:h,y:c}}({padding:i,bbox:t.bbox,offset:this.annotation.offset,orientation:n,align:s}),r=a.x,l=a.y;return this.offsetCornerX=r+this.annotation.dx,this.offsetCornerY=l+this.annotation.dy,this.note&&this.noteContent.attr("transform","translate("+r+", "+l+")"),[]}},{key:"drawOnScreen",value:function(t,e){return this.drawOnSVG(t,e)}},{key:"redrawSubject",value:function(){this.subject&&this.drawOnScreen(this.subject,this.drawSubject())}},{key:"redrawConnector",value:function(){this.connector&&this.drawOnScreen(this.connector,this.drawConnector())}},{key:"redrawNote",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.getNoteBBox();this.noteContent&&this.drawOnScreen(this.noteContent,this.drawNoteContent({bbox:t})),this.note&&this.drawOnScreen(this.note,this.drawNote({bbox:t}))}},{key:"setPosition",value:function(){var t=this.annotation.position;this.a.attr("transform","translate("+t.x+", "+t.y+")")}},{key:"clearComponents",value:function(){this.subject&&this.subject.select("*").remove(),this.connector&&this.connector.select("*").remove()}},{key:"setOffset",value:function(){if(this.note){var t=this.annotation.offset;this.note.attr("transform","translate("+t.x+", "+t.y+")")}}},{key:"setPositionWithAccessors",value:function(t){t&&this.annotation.data&&(this.mapX(t),this.mapY(t)),this.setPosition()}},{key:"setClassName",value:function(){this.a.attr("class","annotation "+(this.className&&this.className())+" "+(this.editMode?"editable":"")+" "+(this.annotation.className||""))}},{key:"draw",value:function(){this.setClassName(),this.setPosition(),this.setOffset(),this.redrawSubject(),this.redrawConnector(),this.redrawNote()}},{key:"dragstarted",value:function(){i.event.sourceEvent.stopPropagation(),this.dispatcher&&this.dispatcher.call("dragstart",this.a,this.annotation),this.a.classed("dragging",!0),this.a.selectAll("circle.handle").style("pointer-events","none")}},{key:"dragended",value:function(){this.dispatcher&&this.dispatcher.call("dragend",this.a,this.annotation),this.a.classed("dragging",!1),this.a.selectAll("circle.handle").style("pointer-events","all")}},{key:"dragSubject",value:function(){var t=this.annotation.position;t.x+=i.event.dx,t.y+=i.event.dy,this.annotation.position=t}},{key:"dragNote",value:function(){var t=this.annotation.offset;t.x+=i.event.dx,t.y+=i.event.dy,this.annotation.offset=t}},{key:"mapHandles",value:function(t){var e=this;return t.map(function(t){return $n({},t,{start:e.dragstarted.bind(e),end:e.dragended.bind(e)})})}}]),t}(),ho=function(t,e,i){return function(t){function n(t){Wn(this,n);var i=Un(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,t));return i.typeSettings=e,e.disable&&e.disable.forEach(function(t){i[t]&&i[t].remove(),i[t]=void 0,"note"===t&&(i.noteContent=void 0)}),i}return Yn(n,t),Gn(n,[{key:"className",value:function(){return""+(e.className||Xn(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"className",this)&&Xn(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"className",this).call(this)||"")}},{key:"drawSubject",value:function(t){return this.typeSettings.subject=$n({},e.subject,this.typeSettings.subject),Xn(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"drawSubject",this).call(this,$n({},t,this.typeSettings.subject))}},{key:"drawConnector",value:function(t){return this.typeSettings.connector=$n({},e.connector,this.typeSettings.connector),Xn(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"drawConnector",this).call(this,$n({},t,e.connector,this.typeSettings.connector))}},{key:"drawNote",value:function(t){return this.typeSettings.note=$n({},e.note,this.typeSettings.note),Xn(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"drawNote",this).call(this,$n({},t,e.note,this.typeSettings.note))}},{key:"drawNoteContent",value:function(t){return Xn(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"drawNoteContent",this).call(this,$n({},t,e.note,this.typeSettings.note))}}],[{key:"init",value:function(t,e){return Xn(n.__proto__||Object.getPrototypeOf(n),"init",this).call(this,t,e),i&&(t=i(t,e)),t}}]),n}(t)},co=function(t){function e(t){Wn(this,e);var i=Un(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return i.textWrap=t.textWrap||120,i.drawText(),i}return Yn(e,t),Gn(e,[{key:"updateTextWrap",value:function(t){this.textWrap=t,this.drawText()}},{key:"drawText",value:function(){if(this.note){fo(this.note,[this.annotation],"g","annotation-note-content");var t=this.note.select("g.annotation-note-content");fo(t,[this.annotation],"rect","annotation-note-bg"),fo(t,[this.annotation],"text","annotation-note-label"),fo(t,[this.annotation],"text","annotation-note-title");var e={height:0},i=this.a.select("text.annotation-note-label"),n=this.annotation.note&&this.annotation.note.wrap||this.typeSettings&&this.typeSettings.note&&this.typeSettings.note.wrap||this.textWrap,o=this.annotation.note&&this.annotation.note.wrapSplitter||this.typeSettings&&this.typeSettings.note&&this.typeSettings.note.wrapSplitter,s=this.annotation.note&&this.annotation.note.bgPadding||this.typeSettings&&this.typeSettings.note&&this.typeSettings.note.bgPadding,a={top:0,bottom:0,left:0,right:0};if("number"==typeof s?a={top:s,bottom:s,left:s,right:s}:s&&"object"===(void 0===s?"undefined":qn(s))&&(a=$n(a,s)),this.annotation.note.title){var r=this.a.select("text.annotation-note-title");r.text(this.annotation.note.title),r.attr("fill",this.annotation.color),r.attr("font-weight","bold"),r.call(_o,n,o),e=r.node().getBBox()}i.text(this.annotation.note.label).attr("dx","0"),i.call(_o,n,o),i.attr("y",1.1*e.height||0),i.attr("fill",this.annotation.color);var l=this.getNoteBBox();this.a.select("rect.annotation-note-bg").attr("width",l.width+a.left+a.right).attr("height",l.height+a.top+a.bottom).attr("x",l.x-a.left).attr("y",-a.top).attr("fill","white").attr("fill-opacity",0)}}}]),e}(lo),uo=(ho(co,{className:"label",note:{align:"middle"}}),ho(co,{className:"callout",note:{lineType:"horizontal"}})),po=ho(uo,{className:"callout elbow",connector:{type:"elbow"}}),fo=(ho(uo,{className:"callout curve",connector:{type:"curve"}}),ho(lo,{className:"badge",subject:{type:"badge"},disable:["connector","note"]}),ho(co,{className:"callout circle",subject:{type:"circle"},note:{lineType:"horizontal"},connector:{type:"elbow"}}),ho(co,{className:"callout rect",subject:{type:"rect"},note:{lineType:"horizontal"},connector:{type:"elbow"}}),ho(function(t){function e(){return Wn(this,e),Un(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return Yn(e,t),Gn(e,[{key:"mapY",value:function(t){Xn(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"mapY",this).call(this,t);var i=this.annotation;(i.subject.x1||i.subject.x2)&&i.data&&t.y&&(i.y=t.y(i.data)),!i.subject.x1&&!i.subject.x2||i.x||(i.x=i.subject.x1||i.subject.x2)}},{key:"mapX",value:function(t){Xn(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"mapX",this).call(this,t);var i=this.annotation;(i.subject.y1||i.subject.y2)&&i.data&&t.x&&(i.x=t.x(i.data)),!i.subject.y1&&!i.subject.y2||i.y||(i.y=i.subject.y1||i.subject.y2)}}]),e}(uo),{className:"callout xythreshold",subject:{type:"threshold"}}),function(t,e,i,n,o){var s=t.selectAll(i+"."+(o||n)).data(e);return s.enter().append(i).merge(s).attr("class",n),s.exit().remove(),t}),yo=function(t,e,i){var n=i.component,o=i.name;n&&n.on("mouseover.annotations",function(){t.call(o+"over",n,e)}).on("mouseout.annotations",function(){return t.call(o+"out",n,e)}).on("click.annotations",function(){return t.call(o+"click",n,e)})},_o=function(t,e,n){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1.2;t.each(function(){for(var t=(0,i.select)(this),s=t.text().split(n||/[ \t\r\n]+/).reverse().filter(function(t){return""!==t}),a=void 0,r=[],l=t.text(null).append("tspan").attr("x",0).attr("dy","0.8em");a=s.pop();)r.push(a),l.text(r.join(" ")),l.node().getComputedTextLength()>e&&r.length>1&&(r.pop(),l.text(r.join(" ")),r=[a],l=t.append("tspan").attr("x",0).attr("dy",o+"em").text(a))})},xo=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:":not(.handle)";return t?t.selectAll(e).nodes().reduce(function(t,e){var i=e.getBBox();t.x=Math.min(t.x,i.x),t.y=Math.min(t.y,i.y),t.width=Math.max(t.width,i.width);var n=e&&e.attributes&&e.attributes.y;return t.height=Math.max(t.height,(n&&parseFloat(n.value)||0)+i.height),t},{x:0,y:0,width:0,height:0}):{x:0,y:0,width:0,height:0}};function mo(t){return.65*(t-.5)*2*Math.PI}function go(t,e){return{x:Math.cos(t-Math.PI/2)*e,y:Math.sin(t-Math.PI/2)*e}}function bo(t,e,n=!1){return function(o){const s=(0,i.interpolate)(o.angle,t);return o.angle=t,function(t){return function(t,e,i=!1){const n=go(t,e),o=180*t/Math.PI+(!0===i?180:0);return`translate(${n.x}, ${n.y}) rotate(${o})`}(s(t),e,n)}}}function vo(t,e,n){return function(o){const s=(0,i.interpolate)(o.startAngle,t),a=(0,i.interpolate)(o.endAngle,e);return function(t){return o.startAngle=s(t),o.endAngle=a(t),n(o)}}}var wo=class Gauge extends i.SVGWidget{_d3Arc=R().innerRadius(85).outerRadius(100);_colorScale=(0,i.scaleLinear)().interpolate(i.interpolateHcl);_usageArc;_meanArc;_freeArc;_indInner;_indOuter;_centerTextG;_centerText;_bottomText;_tooltipG;_mainTooltip;constructor(){super()}tip(t){if(null===t||""===t.label)this._tooltipG.transition().style("opacity",0).on("interrupt end",()=>{this._tooltipG.selectAll("g").remove()});else{this._tooltipG.interrupt().style("opacity",1),t.w=this._centerText.datum().w+10;let _="horizontal",x=0,m=5,g=5;t.y>=5&&t.y<=25?(x=t.x<0?-t.w/2:t.w/2,m=12.5,g=void 0,_="vertical"):t.y>25&&(m=25,g=0);const b=(e=[],n=void 0,o=void 0,s=[],a={},r={},l=!1,h=void 0,c=uo,u=void 0,p=void 0,d=(0,i.dispatch)("subjectover","subjectout","subjectclick","connectorover","connectorout","connectorclick","noteover","noteout","noteclick","dragend","dragstart"),f=void 0,y=function(t){f=t,l||t.selectAll("circle.handle").remove();var o=e.map(function(t){return t.type||(t.type=c),t.disable||(t.disable=s),new Qn(t)});n=n||new Zn({annotations:o,accessors:a,accessorsInverse:r,ids:h}),t.selectAll("g").data([n]).enter().append("g").attr("class","annotations");var y=t.select("g.annotations");fo(y,n.annotations,"g","annotation"),y.selectAll("g.annotation").each(function(t){var e=(0,i.select)(this);e.attr("class","annotation"),fo(e,[t],"g","annotation-connector"),fo(e,[t],"g","annotation-subject"),fo(e,[t],"g","annotation-note"),fo(e.select("g.annotation-note"),[t],"g","annotation-note-content"),t.type="[object Object]"===t.type.toString()?t.type:new t.type({a:e,annotation:t,textWrap:u,notePadding:p,editMode:l,dispatcher:d,accessors:a}),t.type.draw(),t.type.drawText&&t.type.drawText()})},y.json=function(){return console.log("Annotations JSON was copied to your clipboard. Please note the annotation type is not JSON compatible. It appears in the objects array in the console, but not in the copied JSON.",n.json),window.copy(JSON.stringify(n.json.map(function(t){return delete t.type,t}))),y},y.update=function(){return e&&n&&(e=n.annotations.map(function(t){return t.type.draw(),t})),y},y.updateText=function(){return n&&(n.updateText(u),e=n.annotations),y},y.updatedAccessors=function(){return n.setPositionWithAccessors(),e=n.annotations,y},y.disable=function(t){return arguments.length?(s=t,n&&(n.updateDisable(s),e=n.annotations),y):s},y.textWrap=function(t){return arguments.length?(u=t,n&&(n.updateTextWrap(u),e=n.annotations),y):u},y.notePadding=function(t){return arguments.length?(p=t,n&&(n.updateNotePadding(p),e=n.annotations),y):p},y.type=function(t,i){return arguments.length?(c=t,n&&(n.annotations.map(function(t){t.type.note&&t.type.note.selectAll("*:not(.annotation-note-content)").remove(),t.type.noteContent&&t.type.noteContent.selectAll("*").remove(),t.type.subject&&t.type.subject.selectAll("*").remove(),t.type.connector&&t.type.connector.selectAll("*").remove(),t.type.typeSettings={},t.type=c,t.subject=i&&i.subject||t.subject,t.connector=i&&i.connector||t.connector,t.note=i&&i.note||t.note}),e=n.annotations),y):c},y.annotations=function(t){return arguments.length?(e=t,n&&n.annotations&&(e.some(function(t){return!t.type||"[object Object]"!==t.type.toString()})?(n=null,y(f)):n.annotations=e),y):n&&n.annotations||e},y.context=function(t){return arguments.length?(o=t,y):o},y.accessors=function(t){return arguments.length?(a=t,y):a},y.accessorsInverse=function(t){return arguments.length?(r=t,y):r},y.ids=function(t){return arguments.length?(h=t,y):h},y.editMode=function(t){return arguments.length?(l=t,f&&f.selectAll("g.annotation").classed("editable",l),n&&(n.editMode(l),e=n.annotations),y):l},y.collection=function(t){return arguments.length?(n=t,y):n},y.on=function(){var t=d.on.apply(d,arguments);return t===d?y:t},y).type(po).annotations([{data:t,dx:-t.x+x,dy:-t.y+m,color:"black",note:{label:t.label,lineType:_,padding:g,align:"middle"}}]).accessors({x:t=>t.x,y:t=>t.y});this._tooltipG.call(b)}var e,n,o,s,a,r,l,h,c,u,p,d,f,y}calcSize(t,e,i){const n=t.node().getBBox(),o=e/n.width,s=i/n.height,a=o<s?o:s;return{width:n.width,height:n.height,scale:a}}updateText(t,e,i,n,o){t.datum({x:e,y:i,w:n,h:o}).attr("transform",null);const s=this.calcSize(t,n,o),a=e+n/2-s.width/2*s.scale,r=i+o/2-s.height/2*s.scale;t.attr("transform",`translate(${a}, ${r}) scale(${s.scale})`)}calcWidth(){return Math.min(this.width(),this.height(),this.maxDiameter())}enter(t,e){super.enter(t,e),e.on("click",t=>{this.click(t)}),this._usageArc=e.append("path").datum({startAngle:mo(0),endAngle:mo(0)}).style("fill","green").on("mousemove",t=>{const[e,i]=this._d3Arc.centroid(t);this.tip({x:e,y:i,label:this.valueDescription()})}).on("mouseout",t=>{this.tip(null)}),this._freeArc=e.append("path").datum({startAngle:mo(0),endAngle:mo(1)}).style("fill","lightGrey"),this._meanArc=e.append("path").datum({startAngle:mo(0),endAngle:mo(0)}).style("fill","black").on("mousemove",t=>{const[e,i]=this._d3Arc.centroid(t);this.tip({x:e,y:i,label:this.tickValueDescription()})}).on("mouseout",t=>{this.tip(null)}),this._mainTooltip=e.append("title");const i=this;function n(){return e.append("path").datum({angle:mo(0)}).style("fill","black").style("stroke","black").attr("d","M 0 0 l -3 -3 l 6 0 z").on("mousemove",t=>{const[e,n]=i._d3Arc.centroid(i._meanArc.datum());i.tip({x:e,y:n,label:i.tickValueDescription()})}).on("mouseout",t=>{i.tip(null)})}this._indInner=n(),this._indOuter=n(),this._centerText=e.append("text").attr("dy",".66em").style("fill","green").on("mousemove",t=>{this.tip({x:0,y:0,label:this.valueDescription()})}).on("mouseout",t=>{this.tip(null)}),this._bottomText=e.append("text").attr("dy",".66em").on("mousemove",t=>{this.tip({x:0,y:t.y,label:this.titleDescription()})}).on("mouseout",t=>{this.tip(null)}),this._tooltipG=e.append("g").attr("class","annotation-tip")}update(t,e){super.update(t,e),this._colorScale.domain(this.colorDomain()).range(this.colorRange()),e.attr("title",this.tooltip()).style("cursor",this.click!==Gauge.prototype.click?"pointer":null);const n=this.calcWidth()/3,o=this.calcWidth()/2-5;this._d3Arc.innerRadius(n).outerRadius(o);const s=this.value(),a=this.tickValue();this._usageArc.style("fill",this._colorScale(s)).transition().duration(750).attrTween("d",vo(mo(0),mo(s),this._d3Arc)),this._freeArc.style("fill",this.emptyColor()).transition().duration(750).attrTween("d",vo(mo(s),mo(1),this._d3Arc)),this._meanArc.style("fill",this.tickColor()).style("visibility",this.showTick()?"visible":"hidden").transition().duration(750).attrTween("d",vo(mo(a-.001),mo(a+.001),this._d3Arc)),this._indInner.style("fill",this.tickColor()).style("stroke",this.tickColor()).style("visibility",this.showTick()?"visible":"hidden").transition().duration(750).attrTween("transform",bo(mo(a),n,!0)),this._indOuter.style("fill",this.tickColor()).style("stroke",this.tickColor()).style("visibility",this.showTick()?"visible":"hidden").transition().duration(750).attrTween("transform",bo(mo(a),o)),this._centerText.style("fill",this._colorScale(s)).text((0,i.format)(".0%")(s)),this._bottomText.style("fill",this.click!==Gauge.prototype.click?this.titleClickColor():this.titleColor()).style("text-decoration",this.click!==Gauge.prototype.click?"underline":null).text(this.title());const r=go(mo(1),n-8);this.updateText(this._centerText,-r.x,-r.y,2*r.x,2*r.y);const l=go(mo(1),o);l.y+=5;const h=this.calcWidth()-20,c=this.calcWidth()/2-l.y-5;this.updateText(this._bottomText,-h/2,l.y,h,c),this._mainTooltip.text(this.tooltip())}click(t){}};wo.prototype._class+=" chart_Gauge",wo.prototype.publish("title","","string","Title"),wo.prototype.publish("titleDescription","","string","Title Description"),wo.prototype.publish("titleColor","black","html-color","Color of the title text"),wo.prototype.publish("titleClickColor","blue","html-color","Color of the title text when clickable"),wo.prototype.publish("maxDiameter",128,"number","Max Diameter"),wo.prototype.publish("value",0,"number","Value"),wo.prototype.publish("valueDescription","","string","Value Description"),wo.prototype.publish("showTick",!1,"boolean","Show Tick"),wo.prototype.publish("tickValue",0,"number","Tick Value"),wo.prototype.publish("tickValueDescription","","string","Tick Value Description"),wo.prototype.publish("tooltip","","string","Tooltip"),wo.prototype.publish("colorRange",["green","green","green","green","green","green","green","green","orange","red","red"],"array","Array of colors for the filled gauge portion. The fill color will be relative to the gauge value."),wo.prototype.publish("colorDomain",[0,.1,.2,.3,.4,.5,.6,.7,.8,.9,1],"array","This array augments the mapping of the value to the fill colorRange."),wo.prototype.publish("emptyColor","lightgrey","html-color","Color of the empty portion of the gauge"),wo.prototype.publish("tickColor","black","html-color","Color of the tick");var So=(t,e)=>t[1]-e[1]>0?1:-1,Ao=(t,e)=>t[1]-e[1]>0?-1:1,ko=class extends i.SVGWidget{static __inputs=[{id:"label",type:"string"},{id:"value",type:"number"}];_totalValue;d3Pie;d3Arc;d3LabelArc;_labelPositions;_smallValueLabelHeight;_labelWidthLimit;_quadIdxArr;_minLabelTop=0;_maxLabelBottom=0;_seriesValueFormatter;_seriesPercentageFormatter;constructor(){super(),e.I2DChart.call(this),e.ITooltip.call(this),i.Utility.SimpleSelectionMixin.call(this),this.d3Pie=function(){var t=q,e=V,i=null,n=m(0),o=m(P),s=m(0);function a(a){var r,l,h,c,u,p=a.length,d=0,f=new Array(p),y=new Array(p),_=+n.apply(this,arguments),x=Math.min(P,Math.max(-P,o.apply(this,arguments)-_)),m=Math.min(Math.abs(x)/p,s.apply(this,arguments)),g=m*(x<0?-1:1);for(r=0;r<p;++r)(u=y[f[r]=r]=+t(a[r],r,a))>0&&(d+=u);for(null!=e?f.sort(function(t,i){return e(y[t],y[i])}):null!=i&&f.sort(function(t,e){return i(a[t],a[e])}),r=0,h=d?(x-p*g)/d:0;r<p;++r,_=c)l=f[r],c=_+((u=y[l])>0?u*h:0)+g,y[l]={data:a[l],index:r,value:u,startAngle:_,endAngle:c,padAngle:m};return y}return a.value=function(e){return arguments.length?(t="function"==typeof e?e:m(+e),a):t},a.sortValues=function(t){return arguments.length?(e=t,i=null,a):e},a.sort=function(t){return arguments.length?(i=t,e=null,a):i},a.startAngle=function(t){return arguments.length?(n="function"==typeof t?t:m(+t),a):n},a.endAngle=function(t){return arguments.length?(o="function"==typeof t?t:m(+t),a):o},a.padAngle=function(t){return arguments.length?(s="function"==typeof t?t:m(+t),a):s},a}(),this.d3Arc=R(),this.d3LabelArc=R(),this.tooltipTick_default(!1).tooltipOffset_default(0)}intersection(t,e){return this.intersectCircle(this.calcOuterRadius(),t,e)}calcInnerRadius(){return this.innerRadius_exists()?this.calcOuterRadius()*this.innerRadius()/100:0}calcOuterRadius(){const t=this.textSize(this.data().map(t=>this.getLabelText({data:t},!1)),"Verdana",12).width,e=this._size.width-(this.showLabels()?2*t:0)-20,i=this._size.height-36-(this.showLabels()?this._smallValueLabelHeight:0),n=Math.min(e,i)/2-2;return e/2-2<this.minOuterRadius()?this._labelWidthLimit=t-(this.minOuterRadius()-(e/2-2)):this._labelWidthLimit=t,n<this.minOuterRadius()?this.minOuterRadius():n}calcSmallValueLabelHeight(){const t=this.data().reduce((t,e)=>t+e[1],0);let e=0;return this.data().forEach(i=>{i[1]/t<.1&&e++}),this.labelHeight()*e}calcTotalValue(){return this.data().reduce((t,e)=>t+e[1],0)}getLabelText(t,e){let i,n=t.data[0];if(void 0!==this._labelWidthLimit&&e){const t=this.textSize(n,"Verdana",this.labelHeight()).width;this._labelWidthLimit<t&&(i=n.length*(this._labelWidthLimit/t)-3,n=i<n.length?n.slice(0,i)+"...":n)}if(this.showSeriesValue()&&(n+=` : ${this._seriesValueFormatter(t.data[1])}`),this.showSeriesPercentage()){let e=this._totalValue;const i=this.dataMeta();void 0!==i.sum&&(e=i.sum);const o=t.data[1]/e*100;n+=` : ${this._seriesPercentageFormatter(o)}%`}return n}selection(t){if(!arguments.length)try{return this._selection.selection2()[0]?.data}catch(i){return}const e=JSON.stringify(t);this._selection.selection2(t=>e===JSON.stringify(t.data))}selectByLabel(t){const e=this.data().filter(e=>e[0]===t)[0];e&&this.selection(e)}_slices;_labels;enter(t,e){super.enter(t,e),this._selection.widgetElement(e),this._slices=e.append("g"),this._labels=e.append("g");const i=this;this.tooltipHTML(function(t){return"series-table"===i.tooltipStyle()?i.tooltipFormat({label:t.data[0],arr:i.columns().slice(1).map(function(e,n){return{label:e,color:i._palette(t.data[0]),value:t.data[n+1]}})}):i.tooltipFormat({label:t.data[0],value:t.data[1]})})}update(t,e){super.update(t,e);const n=this;this.updateD3Pie(),this._palette=this._palette.switch(this.paletteID()),this._seriesValueFormatter=(0,i.format)(this.seriesValueFormat()),this._seriesPercentageFormatter=(0,i.format)(this.seriesPercentageFormat()),this.useClonedPalette()&&(this._palette=this._palette.cloneNotExists(this.paletteID()+"_"+this.id())),this._smallValueLabelHeight=this.calcSmallValueLabelHeight(),this._totalValue=this.calcTotalValue();const o=this.calcInnerRadius(),s=this.calcOuterRadius(),a=s+12;this.d3Arc.innerRadius(o).padRadius(s).outerRadius(s),this._quadIdxArr=[[],[],[],[]];const r=[...this.data()];switch(this.sortDataByValue()){case"ascending":r.sort(So);break;case"descending":r.sort(Ao)}const l=this._slices.selectAll(".arc").data(this.d3Pie(r),t=>t.data[0]);this._labelPositions=[],l.enter().append("g").attr("class",(t,e)=>"arc series series-"+this.cssTag(t.data[0])).attr("opacity",0).call(this._selection.enter.bind(this._selection)).on("click",function(t){n.click(n.rowToObj(t.data),n.columns()[1],n._selection.selected(this))}).on("dblclick",function(t){n.dblclick(n.rowToObj(t.data),n.columns()[1],n._selection.selected(this))}).each(function(t,e){(0,i.select)(this).append("path").on("mouseout.tooltip",n.tooltip.hide).on("mousemove.tooltip",n.tooltip.show).on("mouseover",d(0,0)).on("mouseout",d(-5,150))}).merge(l).transition().attr("opacity",1).each(function(t,e){const o=n.getQuadrant(p(t));n._quadIdxArr[o].push(e),t.outerRadius=s-5,(0,i.select)(this).select("path").transition().attr("d",n.d3Arc).style("fill",n.fillColor(t.data,n.columns()[1],t.data[1]))}),l.exit().transition().style("opacity",0).remove(),this.d3LabelArc.innerRadius(a).outerRadius(a);const h=this._labels.selectAll("text").data(this.showLabels()?this.d3Pie(r):[],t=>t.data[0]),c=h.enter().append("text").on("mouseout.tooltip",n.tooltip.hide).on("mousemove.tooltip",n.tooltip.show).attr("dy",".5em").on("click",function(t){n._slices.selectAll("g").filter(function(e){t.data===e.data&&(n._selection.click(this),n.click(n.rowToObj(t.data),n.columns()[1],n._selection.selected(this)))})}).on("dblclick",function(t){n._slices.selectAll("g").filter(function(e){t.data===e.data&&n.dblclick(n.rowToObj(t.data),n.columns()[1],n._selection.selected(this))})}).merge(h).text(t=>this.getLabelText(t,!0)).each(function(t,e){const i=n.d3LabelArc.centroid(t),o=p(t);i[0]=a*(n.isLeftSide(o)?1:-1),n._labelPositions.push({top:i[1],bottom:i[1]+n.labelHeight()})});this.showLabels()&&(this.adjustForOverlap(),c.transition().style("font-size",this.labelHeight()+"px").attr("transform",(t,e)=>{const i=n.d3LabelArc.centroid(t);return i[0]=a*(n.isLeftSide(p(t))?1:-1),i[1]=n._labelPositions[e].top,"translate("+i+")"}).style("text-anchor",t=>this.isLeftSide(p(t))?"start":"end")),h.exit().remove();const u=this._labels.selectAll("polyline").data(this.showLabels()?this.d3Pie(r):[],t=>this.getLabelText(t,!0));function p(t){return t.startAngle+(t.endAngle-t.startAngle)/2}function d(t,e){return function(){(0,i.select)(this).transition().delay(e).attrTween("d",function(e){const o=(0,i.interpolate)(e.outerRadius,s+t);return function(t){return e.outerRadius=o(t),n.d3Arc(e)}})}}u.enter().append("polyline").merge(u).transition().attr("points",function(t,e){const i=n.d3LabelArc.centroid(t),o=n.d3Arc.centroid(t),s=[...i];return i[0]=a*(n.isLeftSide(p(t))?1:-1),i[1]=n._labelPositions[e].top,[o,s,i]}),u.exit().remove(),this.showLabels()&&this.centerOnLabels()}isLeftSide(t){return(t=(0,n.normalizeRadians)(t))>2*Math.PI?t:t<Math.PI&&t>0}getQuadrant(t){let e=0;const i=(0,n.normalizeRadians)(t);return e=i<=1*Math.PI&&i>=.5*Math.PI?3:e,e=i<=.5*Math.PI&&i>=0*Math.PI?2:e,e=i<=0*Math.PI&&i>=-.5*Math.PI?1:e,e}centerOnLabels(){const t=this.pos().y,e=2*t,i=this.calcOuterRadius(),n=Math.min(this._minLabelTop,-i),o=Math.max(this._maxLabelBottom,i),s=e-(o-n),a=Math.abs(this._minLabelTop);let r=0;o>t?(r=t-o+this.labelHeight()/2,r-=s/2):n<0&&a>t&&(r=a-t+this.labelHeight()/2,r+=s/2);const l=this.pos();this.pos({y:l.y+r,x:l.x})}adjustForOverlap(){const t=this.labelHeight();this._quadIdxArr.forEach((e,i)=>{let n;this._quadIdxArr[i].sort((t,e)=>1===i||2===i?this._labelPositions[t].top>this._labelPositions[e].top?-1:1:0===i||3===i?this._labelPositions[t].top>this._labelPositions[e].top?1:-1:void 0),this._quadIdxArr[i].forEach((e,o)=>{if(o>0)if(1===i||2===i){if(n<this._labelPositions[e].bottom){const t=this._labelPositions[e].bottom-n;this._labelPositions[e].top-=t,this._labelPositions[e].bottom-=t}}else if((0===i||3===i)&&n+t>this._labelPositions[e].top){const i=Math.abs(this._labelPositions[e].top)-Math.abs(n+t);this._labelPositions[e].top-=i,this._labelPositions[e].bottom-=i}n=this._labelPositions[e].top})}),this._minLabelTop=0,this._maxLabelBottom=0,this._quadIdxArr.forEach((t,e)=>{this._quadIdxArr[e].forEach((t,e)=>{this._minLabelTop>this._labelPositions[t].top&&(this._minLabelTop=this._labelPositions[t].top),this._maxLabelBottom<this._labelPositions[t].bottom&&(this._maxLabelBottom=this._labelPositions[t].bottom)})})}exit(t,e){super.exit(t,e)}updateD3Pie(){const t=(0,n.normalizeRadians)((0,n.degreesToRadians)(this.startAngle()));switch(this.sortDataByValue()){case"ascending":this.d3Pie.sort(So);break;case"descending":this.d3Pie.sort(Ao);break;default:this.d3Pie.sort(null)}this.d3Pie.padAngle(.0025).startAngle(t).endAngle(2*Math.PI+t).value(function(t){return t[1]})}};ko.prototype._class+=" chart_Pie",ko.prototype.implements(e.I2DChart.prototype),ko.prototype.implements(e.ITooltip.prototype),ko.prototype.mixin(i.Utility.SimpleSelectionMixin),ko.prototype.publish("showLabels",!0,"boolean","If true, wedge labels will display"),ko.prototype.publish("showSeriesValue",!1,"boolean","Append data series value next to label",null,{disable:t=>!t.showLabels()}),ko.prototype.publish("seriesValueFormat",",.0f","string","Number format used for formatting series values",null,{disable:t=>!t.showSeriesValue()}),ko.prototype.publish("showSeriesPercentage",!1,"boolean","Append data series percentage next to label",null,{disable:t=>!t.showLabels()}),ko.prototype.publish("seriesPercentageFormat",",.0f","string","Number format used for formatting series percentages",null,{disable:t=>!t.showSeriesPercentage()}),ko.prototype.publish("paletteID","default","set","Color palette for this widget",ko.prototype._palette.switch(),{tags:["Basic","Shared"]}),ko.prototype.publish("useClonedPalette",!1,"boolean","Enable or disable using a cloned palette",null,{tags:["Intermediate","Shared"]}),ko.prototype.publish("innerRadius",0,"number","Sets inner pie hole radius as a percentage of the radius of the pie chart",null,{tags:["Basic"],range:{min:0,step:1,max:100}}),ko.prototype.publish("minOuterRadius",20,"number","Minimum outer radius (pixels)"),ko.prototype.publish("startAngle",0,"number","Starting angle of the first (and largest) wedge (degrees)"),ko.prototype.publish("labelHeight",12,"number","Font size of labels (pixels)",null,{disable:t=>!t.showLabels()}),ko.prototype.publish("sortDataByValue","descending","set","Sort data by value",["none","ascending","descending"]);var Mo=class extends ko{constructor(){super()}postUpdate(t,e){super.postUpdate(t,e);let i=this._pos.x,n=this._pos.y;"origin"===this._drawStartPos&&this._target instanceof SVGElement&&(i-=this._size.width/2,n-=this._size.height/2),n+=this._size.height/4,this._element.attr("transform","translate("+i+","+n+")scale("+this._widgetScale+")")}updateD3Pie(){super.updateD3Pie(),this.d3Pie.startAngle(-Math.PI/2).endAngle(Math.PI/2)}};Mo.prototype._class+=" chart_HalfPie";var To=class extends Pt{_domForeignObject;_domCanvas;_heat;constructor(){super(),this.xAxisGuideLines_default(!0).yAxisGuideLines_default(!0)}radius(t){return this.radiusX(t),this.radiusY(t),this}layerEnter(t,e,i=250){super.layerEnter(t,e,i),this._domForeignObject=this.svg.insert("foreignObject","#"+(this.id()+"_clippath")),this._domCanvas=this._domForeignObject.append("xhtml:body").style("margin","0px").style("padding","0px").style("background-color","transparent").append("canvas"),this._heat=Po(this._domCanvas.node())}layerUpdate(t,e,n=250){super.layerUpdate(t,e),this._palette=this._palette.switch(this.paletteID());let o=this.width()-this.margin.left-this.margin.right;o<0&&(o=0);let s=this.height()-this.margin.top-this.margin.bottom;s<0&&(s=0),this._domForeignObject.attr("x",this.margin.left).attr("y",this.margin.top).attr("width",o).attr("height",s),this._domCanvas.attr("width",o).attr("height",s);const a="horizontal"===t.orientation()?this.data().map(e=>[t.dataPos(e[0]),t.valuePos(e[1]),e[2]]):this.data().map(e=>[t.valuePos(e[1]),t.dataPos(e[0]),e[2]]),r=this.maxWeight_exists()?this.maxWeight():(0,i.max)(a,t=>t[2]);if("default"!==this.paletteID()){const t={},e=8,i=this.reversePalette();for(let n=0;n<e;++n)t[n/e]=this._palette((i?e-n:n)/e,0,1);this._heat.gradient(t)}else this._heat.gradient(this._heat.defaultGradient);this._heat.resize();const l=this.radiusAsPercent()?this.radiusX()*o/100:this.radiusX(),h=this.radiusAsPercent()?this.radiusY()*s/100:this.radiusY();this._heat.clear().radius(l,h,this.blur()).max(r).data(a).draw(this.minOpacity())}};function Po(t){if(!(this instanceof Po))return new Po(t);this._canvas=t="string"==typeof t?document.getElementById(t):t,this._ctx=t.getContext("2d"),this._width=t.width,this._height=t.height,this._max=1,this._data=[]}To.prototype._class+=" chart_Heat",To.prototype._palette=i.Palette.rainbow("default"),To.prototype.publish("paletteID","default","set","Color palette for this widget",To.prototype._palette.switch(),{tags:["Basic"]}),To.prototype.publish("useClonedPalette",!1,"boolean","Enable or disable using a cloned palette",null,{tags:["Intermediate","Shared"]}),To.prototype.publish("reversePalette",!1,"boolean","Reverse Palette Colors",null,{disable:t=>"default"===t.paletteID()}),To.prototype.publish("radiusX",25,"number","Point X radius (25 by default)"),To.prototype.publish("radiusY",25,"number","Point Y radius (25 by default)"),To.prototype.publish("radiusAsPercent",!1,"boolean","Calculate RadiusX + RadiusY as % of size"),To.prototype.publish("blur",15,"number","Point blur radius (15 by default)"),To.prototype.publish("maxWeight",void 0,"number","Clamp max weight to value (optional), omitting uses max data point",void 0,{optional:!0}),To.prototype.publish("minOpacity",.05,"number","Minimum point opacity (0.05 by default)"),Po.prototype={defaultRadius:25,defaultGradient:{.4:"blue",.6:"cyan",.7:"lime",.8:"yellow",1:"red"},data:function(t){return this._data=t,this},max:function(t){return this._max=t,this},add:function(t){return this._data.push(t),this},clear:function(){return this._data=[],this},radius:function(t,e,i){i=void 0===i?15:i;const n=this._ellipse=this._createCanvas(),o=n.getContext("2d"),s=this._r=t+i,a=this._r=e+i;return n.width=2*s,n.height=2*a,o.shadowOffsetX=o.shadowOffsetY=2*s,o.shadowOffsetY=o.shadowOffsetY=2*a,o.shadowBlur=i,o.shadowColor="black",o.beginPath(),o.ellipse(-s,-a,t,e,0,0,2*Math.PI,!0),o.closePath(),o.fill(),this},resize:function(){this._width=this._canvas.width,this._height=this._canvas.height},gradient:function(t){const e=this._createCanvas(),i=e.getContext("2d"),n=i.createLinearGradient(0,0,0,256);e.width=1,e.height=256;for(const o in t)n.addColorStop(+o,t[o]);return i.fillStyle=n,i.fillRect(0,0,1,256),this._grad=i.getImageData(0,0,1,256).data,this},draw:function(t){this._ellipse||this.radius(this.defaultRadius,this.defaultRadius),this._grad||this.gradient(this.defaultGradient);const e=this._ctx;e.clearRect(0,0,this._width,this._height);for(let n,o=0,s=this._data.length;o<s;o++)n=this._data[o],n[2]<0?n[2]=0:n[2]>this._max&&(n[2]=this._max),e.globalAlpha=Math.max(n[2]/this._max,void 0===t?.05:t),e.drawImage(this._ellipse,n[0]-this._r,n[1]-this._r);const i=e.getImageData(0,0,this._width,this._height);return this._colorize(i.data,this._grad),e.putImageData(i,0,0),this},_colorize:function(t,e){for(let i,n=0,o=t.length;n<o;n+=4)i=4*t[n+3],i&&(t[n]=e[i],t[n+1]=e[i+1],t[n+2]=e[i+2])},_createCanvas:function(){return"undefined"!=typeof document?document.createElement("canvas"):new this._canvas.constructor}};var Co=Math.PI/3,zo=[0,Co,2*Co,3*Co,4*Co,5*Co];function Io(t){return t[0]}function Do(t){return t[1]}var Fo=class extends Pt{static __inputs=[{id:"x",type:"any"},{id:"y",type:"number"}];_hexbin;_dataMinWeight;_dataMaxWeight;constructor(){super(),e.I2DAggrChart.call(this),this.tooltipValueFormat_default(",.0f"),e.ITooltip.call(this),this.tooltipHTML(t=>{const e=(0,i.extent)(t,t=>t.label),n=(0,i.extent)(t,t=>t.value);return this.tooltipFormat({series:e[0]===e[1]?e[0]:`${e[0]} -> ${e[1]}`,label:n[0]===n[1]?n[0]:`${n[0]} -> ${n[1]}`,value:t.length})}),this._hexbin=function(){var t,e,i,n=0,o=0,s=1,a=1,r=Io,l=Do;function h(t){var n,o={},s=[],a=t.length;for(n=0;n<a;++n)if(!isNaN(c=+r.call(null,h=t[n],n,t))&&!isNaN(u=+l.call(null,h,n,t))){var h,c,u,p=Math.round(u/=i),d=Math.round(c=c/e-(1&p)/2),f=u-p;if(3*Math.abs(f)>1){var y=c-d,_=d+(c<d?-1:1)/2,x=p+(u<p?-1:1),m=c-_,g=u-x;y*y+f*f>m*m+g*g&&(d=_+(1&p?1:-1)/2,p=x)}var b=d+"-"+p,v=o[b];v?v.push(h):(s.push(v=o[b]=[h]),v.x=(d+(1&p)/2)*e,v.y=p*i)}return s}function c(t){var e=0,i=0;return zo.map(function(n){var o=Math.sin(n)*t,s=-Math.cos(n)*t,a=o-e,r=s-i;return e=o,i=s,[a,r]})}return h.hexagon=function(e){return"m"+c(null==e?t:+e).join("l")+"z"},h.centers=function(){for(var r=[],l=Math.round(o/i),h=Math.round(n/e),c=l*i;c<a+t;c+=i,++l)for(var u=h*e+(1&l)*e/2;u<s+e/2;u+=e)r.push([u,c]);return r},h.mesh=function(){var e=c(t).slice(0,4).join("l");return h.centers().map(function(t){return"M"+t+"m"+e}).join("")},h.x=function(t){return arguments.length?(r=t,h):r},h.y=function(t){return arguments.length?(l=t,h):l},h.radius=function(n){return arguments.length?(e=2*(t=+n)*Math.sin(Co),i=1.5*t,h):t},h.size=function(t){return arguments.length?(n=o=0,s=+t[0],a=+t[1],h):[s-n,a-o]},h.extent=function(t){return arguments.length?(n=+t[0][0],o=+t[0][1],s=+t[1][0],a=+t[1][1],h):[[n,o],[s,a]]},h.radius(1)}().x(t=>t.x).y(t=>t.y),this.xAxisGuideLines_default(!1).yAxisGuideLines_default(!1).xAxisType_default("linear")}xPos(t,e){return"horizontal"===t.orientation()?t.dataPos(e.label):t.valuePos(e.value)}yPos(t,e){return"horizontal"===t.orientation()?t.valuePos(e.value):t.dataPos(e.label)}layerUpdate(t,e,n=250){super.layerUpdate(t,e,n);const o=this;this._palette=this._palette.switch(this.paletteID()),this.useClonedPalette()&&(this._palette=this._palette.cloneNotExists(this.paletteID()+"_"+this.id())),this._hexbin.extent([0,0],[this.width(),this.height()]).radius(this.binSize());const s=this.flattenData().map(e=>({x:o.xPos(t,e),y:o.yPos(t,e),label:t.parseData(e.label),value:t.parseValue(e.value),origRow:e})),a=this._hexbin(s),r=(0,i.min)(a,function(t){return t.length}),l=(0,i.max)(a,function(t){return t.length});this._dataMinWeight=r,this._dataMaxWeight=l;const h=e.selectAll(".hexagon").data(a,function(t){return t.i+"_"+t.j});h.enter().append("path").attr("class","hexagon").call(t._selection.enter.bind(t._selection)).on("click",function(e){const i=o.data();o.click(e.map(e=>t.rowToObj(i[e.origRow.rowIdx])),o.columns()[1],t._selection.selected(this))}).on("dblclick",function(e){const i=o.data();o.dblclick(e.map(e=>t.rowToObj(i[e.origRow.rowIdx])),o.columns()[1],t._selection.selected(this))}).on("mouseout.tooltip",o.tooltip.hide).on("mousemove.tooltip",o.tooltip.show).attr("transform",function(t){return"translate("+t.x+","+t.y+")scale(0)"}).merge(h).transition().duration(n).attr("d",this._hexbin.hexagon()).attr("transform",function(t){return"translate("+t.x+","+t.y+")scale(1)"}).style("fill",function(t){return o._palette(t.length,r,l)}),h.exit().transition().duration(n).attr("transform",function(t){return"translate("+t.x+","+t.y+")scale(0)"}).remove()}exit(t,e){super.exit(t,e)}click(t,e,i){}dblclick(t,e,i){}};Fo.prototype._class+=" chart_HexBin",Fo.prototype.implements(e.I2DAggrChart.prototype),Fo.prototype.implements(e.ITooltip.prototype),Fo.prototype.publish("paletteID","Blues","set","Color palette for this widget",Fo.prototype._palette.switch(),{tags:["Basic","Shared"]}),Fo.prototype.publish("useClonedPalette",!1,"boolean","Enable or disable using a cloned palette",null,{tags:["Intermediate","Shared"]}),Fo.prototype.publish("binSize",20,"number","Bin radius",null,{range:{min:1,max:300,step:1}});var Oo=class extends Ct{constructor(){super(),this.interpolate_default("linear")}};Oo.prototype._class+=" chart_Line";var jo=class extends ko{constructor(){super()}postUpdate(t,e){super.postUpdate(t,e);let i="left"===this.orientation()?0:this._size.width,n=this._size.height;"origin"===this._drawStartPos&&this._target instanceof SVGElement&&(i-=this._size.width/2,n-=this._size.height/2),this._element.attr("transform","translate("+i+","+n+")scale("+this._widgetScale+")")}updateD3Pie(){super.updateD3Pie(),this.d3Pie.startAngle("left"===this.orientation()?0:-Math.PI/2).endAngle("left"===this.orientation()?Math.PI/2:0)}calcOuterRadius(){const t=this.textSize(this.data().map(t=>this.getLabelText({data:t})),"Verdana",12).width;return Math.min(this._size.width-t-10,this._size.height-36)-2}};jo.prototype._class+=" chart_QuarterPie",jo.prototype.publish("orientation","left","set","Determines the placement and start/end angle.",["left","right"]);var Ro=class extends i.SVGWidget{_g;_leftLine;_rightLine;_midLine;_midOuterRect;_midInnerRect1;_midInnerRect2;_q0text;_q1text;_q2text;_q3text;_q4text;_q0val;_q1val;_q2val;_q3val;_q4val;constructor(){super()}enter(t,e){super.enter(t,e),this._g=e.append("g"),this._leftLine=this._g.append("rect"),this._rightLine=this._g.append("rect"),this._midLine=this._g.append("rect"),this._midOuterRect=this._g.append("rect"),this._midInnerRect1=this._g.append("rect"),this._midInnerRect2=this._g.append("rect"),this._q0text=this._g.append("text"),this._q1text=this._g.append("text"),this._q2text=this._g.append("text"),this._q3text=this._g.append("text"),this._q4text=this._g.append("text"),this._q0val=this._g.append("text"),this._q1val=this._g.append("text"),this._q2val=this._g.append("text"),this._q3val=this._g.append("text"),this._q4val=this._g.append("text")}update(t,e){super.update(t,e);const n=("horizontal"===this.orientation()?this.width():this.height())-this.lineWidth(),o="horizontal"===this.orientation()?this.height():this.width(),s=(0,i.scaleLinear)().domain([this.data()[0],this.data()[4]]).range([this.edgePadding(),n-this.edgePadding()]),a=this.candleWidth_exists()?this.candleWidth():o,r=this.lineWidth(),l=this.lineColor(),h=this.roundedCorners(),c=this.edgePadding();let u=s(this.data()[1]),p=s(this.data()[2]),d=s(this.data()[3]);const f=-a/2,y=a/2,_=this.upperTextRotation(),x=this.lowerTextRotation(),m=this.textPadding(),g=this.labelFontSize(),b=this.valueFontSize(),v=Math.max(g,b),w=n-c;if(v>0){for(;u-c<v;)u+=v;for(;p-u<v;)p+=v;for(;d-p<v;)d+=v;for(;w-d<v;)d-=v;for(;d-p<v;)p-=v;for(;p-u<v;)u-=v}let S=-n/2-this.lineWidth()/2,A=0,k=0;let M=1,T="start",P="end";"vertical"===this.orientation()&&(S=0,A=n/2+this.lineWidth()/2,k=-90,T="end",P="start",M=-1),this._g.style("shape-rendering","crispEdges").attr("transform",`translate(${S},${A})rotate(${k})scale(1)`),this._leftLine.attr("fill",l).attr("height",a).attr("width",r).attr("x",c).attr("y",f).attr("rx",h).attr("ry",h),this._rightLine.attr("class","right-line").attr("fill",l).attr("height",a).attr("width",r).attr("x",w).attr("y",f).attr("rx",h).attr("ry",h),this._midLine.attr("fill",l).attr("height",r).attr("width",w-c).attr("x",c).attr("y",-r/2),this._midOuterRect.attr("fill",l).attr("height",a).attr("width",d-u).attr("x",u).attr("y",f).attr("rx",h).attr("ry",h),this._midInnerRect1.attr("fill",this.innerRectColor()).attr("height",a-2*r).attr("width",p-(u+2*r)).attr("x",u+r).attr("y",r-a/2).attr("rx",.618*h).attr("ry",.618*h),this._midInnerRect2.attr("fill",this.innerRectColor()).attr("height",a-2*r).attr("width",d-p-r).attr("x",p).attr("y",r-a/2).attr("rx",.618*h).attr("ry",.618*h),this._q0text.attr("height",a).attr("width",d-u).attr("display",this.showLabels()?null:"none").attr("fill",this.textColor()).attr("x",0).attr("y",0).attr("transform",`translate(${c}, ${f-m})rotate(${_})scale(${M})`).attr("font-size",g).attr("text-anchor",T).attr("alignment-baseline","hanging").text(this.columns()[0]),this._q1text.attr("height",a).attr("width",d-u).attr("display",this.showLabels()?null:"none").attr("fill",this.textColor()).attr("x",0).attr("y",0).attr("transform",`translate(${u}, ${f-m})rotate(${_})scale(${M})`).attr("font-size",g).attr("text-anchor",T).attr("alignment-baseline","middle").text(this.columns()[1]),this._q2text.attr("height",a).attr("width",d-u).attr("display",this.showLabels()?null:"none").attr("fill",this.textColor()).attr("x",0).attr("y",0).attr("transform",`translate(${p}, ${f-m})rotate(${_})scale(${M})`).attr("font-size",g).attr("text-anchor",T).attr("alignment-baseline","middle").text(this.columns()[2]),this._q3text.attr("height",a).attr("width",d-u).attr("display",this.showLabels()?null:"none").attr("fill",this.textColor()).attr("x",0).attr("y",0).attr("transform",`translate(${d}, ${f-m})rotate(${_})scale(${M})`).attr("font-size",g).attr("text-anchor",T).attr("alignment-baseline","middle").text(this.columns()[3]),this._q4text.attr("height",a).attr("width",d-u).attr("display",this.showLabels()?null:"none").attr("fill",this.textColor()).attr("x",0).attr("y",0).attr("transform",`translate(${w+r}, ${f-m})rotate(${_})scale(${M})`).attr("font-size",g).attr("text-anchor",T).attr("alignment-baseline","baseline").text(this.columns()[4]),this._q0val.attr("height",a).attr("width",d-u).attr("display",this.showValues()?null:"none").attr("fill",this.textColor()).attr("x",0).attr("y",0).attr("transform",`translate(${c}, ${y+m})rotate(${x})scale(${M})`).attr("font-size",b).attr("text-anchor",P).attr("alignment-baseline","hanging").text(this.data()[0]),this._q1val.attr("height",a).attr("width",d-u).attr("display",this.showValues()?null:"none").attr("fill",this.textColor()).attr("x",0).attr("y",0).attr("transform",`translate(${u}, ${y+m})rotate(${x})scale(${M})`).attr("font-size",b).attr("text-anchor",P).attr("alignment-baseline","middle").text(this.data()[1]),this._q2val.attr("height",a).attr("width",d-u).attr("display",this.showValues()?null:"none").attr("fill",this.textColor()).attr("x",0).attr("y",0).attr("transform",`translate(${p}, ${y+m})rotate(${x})scale(${M})`).attr("font-size",b).attr("text-anchor",P).attr("alignment-baseline","middle").text(this.data()[2]),this._q3val.attr("height",a).attr("width",d-u).attr("display",this.showValues()?null:"none").attr("fill",this.textColor()).attr("x",0).attr("y",0).attr("transform",`translate(${d}, ${y+m})rotate(${x})scale(${M})`).attr("font-size",b).attr("text-anchor",P).attr("alignment-baseline","middle").text(this.data()[3]),this._q4val.attr("height",a).attr("width",d-u).attr("display",this.showValues()?null:"none").attr("fill",this.textColor()).attr("x",0).attr("y",0).attr("transform",`translate(${w+r}, ${y+m})rotate(${x})scale(${M})`).attr("font-size",b).attr("text-anchor",P).attr("alignment-baseline","baseline").text(this.data()[4])}};Ro.prototype._class+=" chart_QuartileCandlestick",Ro.prototype.publish("textColor","black","html-color","Color of label and value text"),Ro.prototype.publish("showLabels",!0,"boolean","If true, labels will be shown"),Ro.prototype.publish("showValues",!0,"boolean","If true, values will be shown"),Ro.prototype.publish("orientation","horizontal","set","Determines layout",["horizontal","vertical"]),Ro.prototype.publish("valueFontSize",12,"number","Font size of value text (pixels)"),Ro.prototype.publish("labelFontSize",12,"number","Font size of label text (pixels)"),Ro.prototype.publish("roundedCorners",8,"number","Radius of rounded rect corners (pixels)"),Ro.prototype.publish("lineWidth",4,"number","Width of lines (pixels)"),Ro.prototype.publish("candleWidth",null,"number","Height of outer rect (pixels)",null,{optional:!0}),Ro.prototype.publish("textPadding",8,"number","Padding between outer rect and text (pixels)"),Ro.prototype.publish("edgePadding",30,"number","Padding between outer rect and left/right sides (pixels)"),Ro.prototype.publish("lineColor","#333","html-color","Color of outer rect and lines"),Ro.prototype.publish("innerRectColor","white","html-color","Color of the inner rects"),Ro.prototype.publish("upperTextRotation",-60,"number","Rotation of label text (degrees)"),Ro.prototype.publish("lowerTextRotation",-60,"number","Rotation of value text (degrees)");var Eo=class extends i.SVGWidget{constructor(){super(),e.INDChart.call(this),e.ITooltip.call(this),i.Utility.SimpleSelectionMixin.call(this)}mapShape(t){switch(t){case"rectangle":return"rect";case"circle":return"circle";case"cross":return"path"}}setPointAttributes(t,e,i){const n=this;switch(this.mapShape(this.pointShape())){case"rect":t.attr("width",n.pointSize()).attr("height",n.pointSize()).style("fill",t=>this.strokeColor(t.data,t.column,t.value));break;case"circle":t.attr("r",n.pointSize()/2).attr("cx",e).attr("cy",i).style("fill",t=>this.strokeColor(t.data,t.column,t.value));break;case"path":const o=n.pointSize()/2;t.attr("d",function(t){return"M"+(e-o)+" "+(i-o)+" L"+(e+o)+" "+(i+o)+" M"+(e-o)+" "+(i+o)+" L"+(e+o)+" "+(i-o)}).style("stroke",t=>this.strokeColor(t.data,t.column,t.value))}}enter(t,e){super.enter(t,e),this._selection.widgetElement(e),this.tooltipHTML(t=>this.tooltipFormat({label:t.label,series:t.column,value:t.value}))}update(t,e){super.update(t,e),this._palette=this._palette.switch(this.paletteID());const n=this,o=this.height()/2,s=this.width()/2,a=this.columns(),r=this.data(),l=this.flattenData(a,r).map((t,e)=>(t.shape=this.mapShape(this.pointShape()),t.column=a[t.colIdx],t.row=r[e],t)),h=[],c=this.degrees2radians(360/this.data().length),u=this.fontSize();let p=0;l.filter(t=>1===t.colIdx).forEach(t=>{const e=super.textSize(t.label,`${this.fontFamily()}`,this.fontSize());p<e.width&&(p=e.width)});const d=Math.min(o-u,s-p),f=e.selectAll(".label").data(l.filter(t=>1===t.colIdx)),y=Math.max.apply(n,l.map(t=>t.value));f.enter().append("text").attr("class","label").attr("text-anchor","middle").merge(f).attr("font-size",this.fontSize()).attr("font-family",this.fontFamily()).each(function(t,e){const o=n.polar2cartesian(d,e*c-Math.PI/2);h.push(o.map(t=>t*n.labelPaddingRatio()));let s="middle";const a=Math.round(o[0]);s=a>0?"start":s,s=a<0?"end":s,(0,i.select)(this).attr("text-anchor",s).attr("x",o[0]).attr("y",o[1])}).text(t=>t.label),f.exit().remove();const _=e.selectAll(".domain").data(l.filter(t=>1===t.colIdx));_.enter().append("line").classed("domain",!0).style("stroke","#000").style("stroke-opacity","0.75").style("stroke-width","1px").merge(_).attr("x1",0).attr("y1",0).attr("x2",(t,e)=>h[e][0]).attr("y2",(t,e)=>h[e][1]),_.exit().remove();const x=e.selectAll(".value_guide").data(this.valueGuideRatios());x.enter().append("polygon").classed("value_guide",!0).style("stroke","grey").style("stroke-opacity","0.75").style("stroke-width","0.3px").merge(x).each(function(t,e){const n=[];h.forEach((e,i)=>{n.push([e[0]*t,e[1]*t])}),(0,i.select)(this).attr("points",n.join(" ")).attr("stroke","rgb(0, 0, 0)").attr("stroke-opacity",.75).attr("stroke-width",.3).attr("fill-opacity",0)}),x.exit().remove();const m=e.selectAll(".value_guide_text").data(this.valueGuideRatios());m.enter().append("text").attr("class","value_guide_text").attr("text-anchor","start").attr("font-size",this.fontSize()).attr("font-family",this.fontFamily()).merge(m).attr("x",2).attr("y",t=>h[0][1]*t).text((t,e)=>Math.round(t*y)),x.exit().remove();const g=e.selectAll(".area").data(a.filter((t,e)=>e>0));g.enter().append("polygon").attr("class","area").style("stroke-opacity","0.75").style("stroke-width","0.3px").merge(g).style("stroke",t=>this.strokeColor([],t,0)).style("fill",t=>this.fillColor([],t,0)).style("fill-opacity",this.fillOpacity()).attr("points",(t,e)=>h.map((t,i)=>{const n=r[i][e+1],o=0===n?0:n/y;return t[0]*o+","+t[1]*o}).join(" ")),g.exit().remove();const b=e.selectAll(".point").data(l);b.enter().append("g").attr("class","point").on("mouseout.tooltip",n.tooltip.hide).on("mousemove.tooltip",n.tooltip.show).on("click",function(t,e){const i=n.data()[t.rowIdx],o=n.rowToObj(i),s=n._selection.selected(this);n.click(o,n.columns()[t.colIdx],s)}).on("dblclick",function(t,e){n.dblclick(n.rowToObj(n.data()[t.rowIdx]),t.column,n._selection.selected(this))}).each(function(t){const e=(0,i.select)(this);e.append("circle").attr("class","pointSelection").attr("r",n.pointSize()).call(n._selection.enter.bind(n._selection)),e.append(n.mapShape(n.pointShape())).attr("class","pointShape")}).merge(b).each(function(t){const e=(0,i.select)(this),o=0===t.value?0:t.value/y,s=h[t.rowIdx][0]*o,a=h[t.rowIdx][1]*o;e.select(".pointSelection").attr("cx",s).attr("cy",a);const r=e.select(".pointShape").style("stroke",n.strokeColor(t.row,t.column,t.value)).style("fill",n.fillColor(t.row,t.column,t.value));n.setPointAttributes(r,s,a)}),b.exit().remove()}polar2cartesian(t,e){return[t*Math.cos(e),t*Math.sin(e)]}cartesian2polar(t,e){return[Math.atan2(e,t),Math.sqrt(t*t+e*e)]}degrees2radians(t){return t/57.295779513}radians2degrees(t){return 57.295779513*t}point_in_polygon(t,e){const i=t[0],n=t[1];let o=!1;for(let s=0,a=e.length-1;s<e.length;a=s++){const t=e[s][0],r=e[s][1],l=e[a][0],h=e[a][1];r>n!=h>n&&i<(l-t)*(n-r)/(h-r)+t&&(o=!o)}return o}};Eo.prototype._class+=" chart_Radar",Eo.prototype.implements(e.INDChart.prototype),Eo.prototype.implements(e.ITooltip.prototype),Eo.prototype.mixin(i.Utility.SimpleSelectionMixin),Eo.prototype.publish("paletteID","default","set","Color palette for this widget",Eo.prototype._palette.switch()),Eo.prototype.publish("pointShape","cross","set","pointShape",["circle","rectangle","cross"]),Eo.prototype.publish("pointSize",6,"number","Point Size",null,{range:{min:1,step:1,max:200}}),Eo.prototype.publish("valueGuideRatios",[.2,.4,.6,.8,1],"array","Array of values between 0 and 1 that are multiplied by the widget radius to produce guide lines"),Eo.prototype.publish("fillOpacity",.66,"number","Opacity of the data polygon(s)"),Eo.prototype.publish("fontFamily","","string","fontFamily"),Eo.prototype.publish("fontSize",16,"number","fontSize"),Eo.prototype.publish("labelPaddingRatio",.9,"number","labelPaddingRatio");var No=class extends i.SVGWidget{static __inputs=[{id:"label",type:"any"},{id:"values",type:"number"}];_domainScale=(0,i.scaleBand)();_valueScale=(0,i.scaleLinear)();_d3Arc=R().startAngle(0).endAngle(t=>this._valueScale(t[1]));_arcs;_axialAxis;_radialAxis;constructor(){super(),e.INDChart.call(this),e.ITooltip.call(this),i.Utility.SimpleSelectionMixin.call(this)}enter(t,e){super.enter(t,e),this._selection.widgetElement(e),this.tooltipHTML(t=>this.tooltipFormat({label:t[0],value:t[1]})),this._radialAxis=e.append("g").attr("class","r axis"),this._axialAxis=e.append("g").attr("class","a axis"),this._arcs=e.append("g").attr("class","data")}update(t,e){super.update(t,e);const n=this,o=Math.max(this.valueDomainHigh_exists()?this.valueDomainHigh():0,...this.data().map(t=>t[1]));this._valueScale.domain([0,o]).range([0,this.radians(this.valueMaxAngle())]);const s=this._valueScale.ticks(this.tickCount()),a=this.textSize(s.map(t=>""+t),"Verdana",12).width,r=Math.min(this.width()-2*(10+a),this.height()-44)/2,l=this.data().map(t=>t[0]);this._domainScale.domain(l).range([0,r]).padding(this.domainPadding());const h=this._domainScale.step()*this._domainScale.padding(),c=this._radialAxis.selectAll("circle").data(l);c.enter().append("circle").attr("fill","transparent").merge(c).attr("r",t=>this._domainScale(t)+this._domainScale.step()-h/2),c.exit().remove();const u=this._radialAxis.selectAll(".arc-text").data(l);u.enter().append("text").attr("class","arc-text").attr("x",-4).attr("alignment-baseline","middle").attr("text-anchor","end").merge(u).attr("y",t=>-this._domainScale(t)-this._domainScale.bandwidth()/2).text(t=>t),u.exit().remove();const p=this._axialAxis.selectAll("line").data(s);p.enter().append("line").merge(p).attr("x2",t=>r*Math.cos(this._valueScale(t)-this.radians(90))).attr("y2",t=>r*Math.sin(this._valueScale(t)-this.radians(90))),p.exit().remove();const d=this._axialAxis.selectAll("text").data(s);d.enter().append("text").style("dominant-baseline","central").merge(d).attr("x",t=>(r+10)*Math.cos(this._valueScale(t)-this.radians(90))).attr("y",t=>(r+10)*Math.sin(this._valueScale(t)-this.radians(90))).style("text-anchor",t=>{const e=this.degrees(this._valueScale(t));return e>=0&&e<=20||e>=160&&e<=200||e>=340&&e<=360?"middle":e>=180&&e<=360?"end":null}).text(t=>t),d.exit().remove();const f=this.columns().length>1?this.columns()[1]:"";this._d3Arc.innerRadius(t=>this._domainScale(t[0])).outerRadius(t=>this._domainScale(t[0])+this._domainScale.bandwidth());const y=this._arcs.selectAll("path").data(this.data(),t=>t[0]);y.enter().append("path").attr("class","arc").call(this._selection.enter.bind(this._selection)).on("mouseout.tooltip",this.tooltip.hide).on("mousemove.tooltip",this.tooltip.show).on("click",function(t,e){n.click(n.rowToObj(t),f,n._selection.selected(this))}).on("dblclick",function(t,e){n.dblclick(n.rowToObj(t),f,n._selection.selected(this))}).merge(y).style("fill",(t,e)=>this.fillColor(t,t[0],t[1])).transition().delay((t,e)=>e*this.transitionDelay()).duration(this.transitionDuration()).attrTween("d",(t,e)=>{const n=(0,i.interpolate)(t._current||0,t[1]);return t._current=t[1],i=>this._d3Arc([t[0],n(i)],e)}),y.exit().remove()}degrees(t){return 180*t/Math.PI}radians(t){return t*Math.PI/180}};No.prototype._class+=" chart_RadialBar",No.prototype.implements(e.INDChart.prototype),No.prototype.implements(e.ITooltip.prototype),No.prototype.mixin(i.Utility.SimpleSelectionMixin),No.prototype.publish("paletteID","default","set","Color palette for this widget",No.prototype._palette.switch()),No.prototype.publish("tickCount",10,"number","Number of ticks to display"),No.prototype.publish("domainPadding",.25,"number","Padding between chart edge and container edge (0..1)"),No.prototype.publish("valueMaxAngle",270,"number","Maximum angular length of a bar (degrees)"),No.prototype.publish("valueDomainHigh",null,"number","Value domain high",void 0,{optional:!0}),No.prototype.publish("transitionDelay",100,"number","Delay between the start of each row animation (ms)"),No.prototype.publish("transitionDuration",750,"number","Duration of a row's animation (ms)");var Lo=i.Palette.rainbow("Blues"),Bo=i.Palette.ordinal("Quartile",[Lo(100,0,100),Lo(50,0,100),Lo(50,0,100),Lo(75,0,100)]);Bo("Std. Dev."),Bo("MinMax"),Bo("25%"),Bo("50%");var Ho=class extends i.HTMLWidget{_selectElement;_tickFormatter;_bellCurve=(new Ct).columns(["","Std. Dev."]).paletteID("Quartile").interpolate_default("basis").pointSize(0).xAxisType("linear").xAxisOverlapMode("none").xAxisTickFormat(",").yAxisHidden(!0).yAxisDomainLow(0).yAxisDomainHigh(110).yAxisGuideLines(!1);_candle=(new Ro).columns(["Min","25%","50%","75%","Max"]).edgePadding(0).roundedCorners(1).lineWidth(1).upperTextRotation(-90).lowerTextRotation(-90).labelFontSize(0).valueFontSize(0).lineColor(Lo(90,0,100)).innerRectColor(Lo(10,0,100));constructor(){super(),this.columns(["Min","25%","50%","75%","Max","Mean","Std. Dev."])}stdDev(t){return this.mean()+t*this.standardDeviation()}formatStdDev(t){return this._tickFormatter(this.stdDev(t))}quartile(t){return this.quartiles()[t]}formatQ(t){return this._tickFormatter(this.quartile(t))}domain(t){switch(t){case"25_75":return[this.quartile(1),this.quartile(3)];case"normal":return[this.stdDev(-4),this.stdDev(4)];default:return[this.quartile(0),this.quartile(4)]}}min(){return this.quartile(0)}max(){return this.quartile(4)}data(t){if(!arguments.length)return[[...this.quartiles(),this.mean(),this.standardDeviation()]];const e=t[0];return this.quartiles([e[0],e[1],e[2],e[3],e[4]]),this.mean(e[5]),this.standardDeviation(e[6]),this}enter(t,e){super.enter(t,e),this._bellCurve.target(e.append("div").node()),this._candle.target(e.append("div").node()),this._selectElement=e.append("div").style("position","absolute").style("top","0px").style("right","0px").append("select").on("change",()=>{this.view(this._selectElement.node().value),this.lazyRender()}),this._selectElement.append("option").attr("value","min_max").text("Min / Max"),this._selectElement.append("option").attr("value","25_75").text("25% / 75%"),this._selectElement.append("option").attr("value","normal").text("Normal")}bellTicks(t){let e;switch(t){case"25_75":e=[{label:this.formatQ(1),value:this.quartile(1)},{label:this.formatQ(2),value:this.quartile(2)},{label:this.formatQ(3),value:this.quartile(3)}];break;case"normal":e=[{label:this.formatStdDev(-4),value:this.stdDev(-4)},{label:"-3σ",value:this.stdDev(-3)},{label:"-2σ",value:this.stdDev(-2)},{label:"-1σ",value:this.stdDev(-1)},{label:this.formatStdDev(0),value:this.stdDev(0)},{label:"+1σ",value:this.stdDev(1)},{label:"+2σ",value:this.stdDev(2)},{label:"+3σ",value:this.stdDev(3)},{label:this.formatStdDev(4),value:this.stdDev(4)}];break;default:e=[{label:this.formatQ(0),value:this.quartile(0)},{label:this.formatQ(1),value:this.quartile(1)},{label:this.formatQ(2),value:this.quartile(2)},{label:this.formatQ(3),value:this.quartile(3)},{label:this.formatQ(4),value:this.quartile(4)}]}const[i,n]=this.domain(this._selectElement.node().value);return e.filter(t=>t.value>=i&&t.value<=n).map(t=>({label:t.label,value:t.value.toString()}))}updateScatter(){const t=this._selectElement.node().value,[e,i]=this.domain(t),n=(i-e)*(this.domainPadding()/100);this._bellCurve.xAxisDomainLow(e-n).xAxisDomainHigh(i+n).xAxisTicks(this.bellTicks(t)).data([[this.stdDev(-4),0],[this.stdDev(-3),.3],[this.stdDev(-2),5],[this.stdDev(-1),68],[this.stdDev(0),100],[this.stdDev(1),68],[this.stdDev(2),5],[this.stdDev(3),.3],[this.stdDev(4),0]]).resize({width:this.width(),height:this.height()-this.candleHeight()}).render()}updateCandle(){const t=this._bellCurve.dataPos(this.quartile(0)),e=this._bellCurve.dataPos(this.quartile(4))-t;this._candle.resize({width:this.width(),height:this.candleHeight()}).pos({x:t+e/2+2,y:this.candleHeight()/2}).width(e).candleWidth(this.candleHeight()).data(this.quartiles()).render()}update(t,e){super.update(t,e),this._tickFormatter=function(t){const e=(0,i.format)(t);return function(t){const i=(Math.round(100*t)/100).toString();return i.length<=4?i:e(t)}}(this.tickFormat()),this._selectElement.node().value=this.view(),this.updateScatter(),this.updateCandle()}exit(t,e){this._bellCurve.target(null),this._candle.target(null),this._selectElement.remove(),super.exit(t,e)}};Ho.prototype._class+=" chart_StatChart",Ho.prototype.publish("view","min_max","set","View",["min_max","25_75","normal"]),Ho.prototype.publish("tickFormat",".2e","string","X-Axis Tick Format"),Ho.prototype.publish("candleHeight",20,"number","Height of candle widget (pixels)"),Ho.prototype.publish("domainPadding",10,"number","Domain value padding"),Ho.prototype.publish("mean",.5,"number","Mean"),Ho.prototype.publish("standardDeviation",.125,"number","Standard Deviation (σ)"),Ho.prototype.publish("quartiles",[0,.25,.5,.75,1],"object","Quartiles (Min, 25%, 50%, 75%, Max)");var Vo=class extends Ct{constructor(){super(),this.interpolate_default("step")}};Vo.prototype._class+=" chart_Step";var qo="text",Wo="html",Go=class extends i.HTMLWidget{_playIntervalIdx=0;_mainDiv;_headerDiv;_textDiv;constructor(){super(),this._tag="div",this._drawStartPos="center",this.playInterval(this.playInterval())}lookupFieldIdx(t,e){let i=e;if(!(this[t+"_exists"]()&&(i=this.columns().indexOf(this[t]()),i<0)))return i}lookupFieldText(t,e){return this[t+"_exists"]()?this[t]():void 0!==e&&this.columns()[e]||""}currentRow(){return this.data()[this._playIntervalIdx]}summaryData(){let t;this.hideLabel()||(t=this.lookupFieldIdx("labelColumn",0));const e=this.lookupFieldIdx("iconColumn"),i=this.lookupFieldIdx("valueColumn",1);let n,o;this.hideMore()||(n=this.lookupFieldIdx("moreIconColumn"),o=this.lookupFieldIdx("moreTextColumn"));const s=this.lookupFieldIdx("colorFillColumn"),a=this.lookupFieldIdx("colorStrokeColumn");return this.formattedData().map(function(r){return{icon:void 0===e?this.icon():r[e],label:void 0===t?"":r[t],value:r[i],moreIcon:void 0===n?this.hideMore()?"":this.moreIcon():r[n],moreText:void 0===o?this.hideMore()?"":this.moreText():r[o],fill:void 0===s?this.colorFill():r[s],stroke:void 0===a?this.colorStroke():r[a]}},this)}enter(t,e){super.enter(t,e),this._mainDiv=e.append("div");const i=this;this._headerDiv=this._mainDiv.append("h2").on("click",function(){i.click(i.rowToObj(i.currentRow()),i.lookupFieldText("valueColumn",1),!0)}).on("dblclick",function(){i.dblclick(i.rowToObj(i.currentRow()),i.lookupFieldText("valueColumn",1),!0)}),this._textDiv=this._mainDiv.append("div").attr("class","text").on("click",function(){i.click(i.rowToObj(i.currentRow()),i.lookupFieldText("labelColumn",0),!0)}).on("dblclick",function(){i.dblclick(i.rowToObj(i.currentRow()),i.lookupFieldText("labelColumn",0),!0)})}update(t,e){super.update(t,e),this.data().length;const n=this.summaryData();this._playIntervalIdx>=n.length&&(this._playIntervalIdx=0);const o=this._playIntervalIdx<n.length?n[this._playIntervalIdx]:["",""];e.style("width",this.fixedSize()?this.minWidth_exists()?this.minWidth()+"px":null:"100%").style("height",this.fixedSize()?this.minHeight_exists()?this.minHeight()+"px":null:"100%"),this._mainDiv.attr("class","content bgIcon "+o.icon).transition().style("background-color",o.fill).style("color",o.stroke).style("min-width",this.minWidth_exists()?this.minWidth()+"px":null).style("min-height",this.minHeight_exists()?this.minHeight()+"px":null).style("font-size",this.iconFontSize()+"px"),this._headerDiv.transition().style("color",o.stroke).style("font-size",this.headerFontSize()+"px")[this.valueHTML()?Wo:qo](o.value),this._textDiv.style("font-size",this.textFontSize()+"px")[this.labelHTML()?Wo:qo](o.label);const s=this,a=this._mainDiv.selectAll(".more").data([o]),r=a.enter().append("div").attr("class","more").on("click",function(t){s.click(s.rowToObj(s.currentRow()),s.lookupFieldText("moreTextColumn")||"more",!0)}).each(function(){const t=(0,i.select)(this);t.append("i"),t.append("span")}).merge(a).style("display",this.hideMoreWrapper()?"none":null).style("font-size",this.moreFontSize()+"px").style("height",this.moreWrapperHeight_exists()?this.moreWrapperHeight()+"px":null).transition().style("background-color",(0,i.rgb)(o.fill).darker(.75).toString());r.select("i").attr("class",function(t){return"fa "+t.moreIcon}),this.moreTextHTML()?r.select("span").each(function(t){this.innerHTML=t.moreText}):r.select("span").text(t=>t.moreText),a.exit().remove()}exit(t,e){super.exit(t,e)}};Go.prototype._class+=" chart_Summary",Go.prototype.implements(e.I2DChart.prototype),Go.prototype.publish("iconColumn",null,"set","Select Icon Column",function(){return this.columns()},{optional:!0}),Go.prototype.publish("icon","fa-briefcase","string","FA Char icon class",null,{disable:t=>t.iconColumn()}),Go.prototype.publish("headerFontSize",null,"number","headerFontSize"),Go.prototype.publish("textFontSize",null,"number","textFontSize"),Go.prototype.publish("moreFontSize",null,"number","moreFontSize"),Go.prototype.publish("iconFontSize",null,"number","iconFontSize"),Go.prototype.publish("hideLabel",!1,"boolean","Hide label column"),Go.prototype.publish("labelColumn",null,"set","Select display value",function(){return this.columns()},{optional:!0,disable:t=>t.hideLabel()}),Go.prototype.publish("labelHTML",!1,"boolean","Allow HTML",null,{disable:t=>t.hideLabel()}),Go.prototype.publish("valueColumn",null,"set","Select display value",function(){return this.columns()},{optional:!0}),Go.prototype.publish("valueHTML",!1,"boolean","Allow HTML"),Go.prototype.publish("hideMore",!1,"boolean","Hide More Information"),Go.prototype.publish("hideMoreWrapper",!1,"boolean","Hide More Information Wrapper"),Go.prototype.publish("moreWrapperHeight",null,"number","Height of the 'more' text wrapper (pixels)"),Go.prototype.publish("moreIconColumn",null,"set","Select More Icon Column",function(){return this.columns()},{optional:!0,disable:t=>t.hideMore()}),Go.prototype.publish("moreIcon","fa-info-circle","string","FA Char icon class",null,{disable:t=>t.hideMore()||t.moreIconColumn()}),Go.prototype.publish("moreTextColumn",null,"set","Select display value",function(){return this.columns()},{optional:!0,disable:t=>t.hideMore()}),Go.prototype.publish("moreText","More Info","string","More text",null,{disable:t=>t.hideMore()||t.moreTextColumn()}),Go.prototype.publish("moreTextHTML",!1,"boolean","Allow HTML",null,{disable:t=>t.hideMore()}),Go.prototype.publish("colorFillColumn",null,"set","Column for color",function(){return this.columns()},{optional:!0}),Go.prototype.publish("colorFill","#3498db","html-color","Fill Color",null,{disable:t=>t.colorFillColumn()}),Go.prototype.publish("colorStrokeColumn",null,"set","Column for color",function(){return this.columns()},{optional:!0}),Go.prototype.publish("colorStroke","#ffffff","html-color","Fill Color",null,{disable:t=>t.colorStrokeColumn()}),Go.prototype.publish("fixedSize",!0,"boolean","Fix Size to Min Width/Height"),Go.prototype.publish("minWidth",225,"number","Minimum Width"),Go.prototype.publish("minHeight",150,"number","Minimum Height"),Go.prototype.publish("playInterval",null,"number","Play Interval",null,{optional:!0});var $o=Go.prototype.playInterval;Go.prototype.playInterval=function(t){const e=$o.apply(this,arguments);if(arguments.length){this._playIntervalHandle&&clearInterval(this._playIntervalHandle);const e=this;t&&(this._playIntervalHandle=setInterval(function(){e._playIntervalIdx++,e._renderCount&&e.data().length&&e.render()},t))}return e};var Xo=class extends i.CanvasWidget{_playIntervalIdx=0;constructor(){super(),e.I2DChart.call(this),this.playInterval(this.playInterval())}currentRow(){return this.data()[this._playIntervalIdx]}enter(t,e){super.enter.apply(this,arguments);const{width:i,height:n}=this.size();t.height=n,t.width=i}update(t,e){super.update.apply(this,arguments);const n=this;this._playIntervalIdx>=this.data().length&&(this._playIntervalIdx=0);const o=this.size(),s=Math.min(o.width,o.height),a=this.fontSizeRatio(),r=this.columns().indexOf(this.labelColumn()),l=this.columns().indexOf(this.valueColumn()),h=this.columns().indexOf(this.colorFillColumn()),c=this.columns().indexOf(this.colorStrokeColumn()),u=this.columns().indexOf(this.iconColumn()),p=-1!==u?this.currentRow()[u]:this.icon(),d=-1!==r?this.currentRow()[r]:"",f=-1!==l?this.currentRow()[l]:"",y=-1!==h?this.currentRow()[h]:this.colorFill(),_=-1!==c?this.currentRow()[c]:this.colorStroke();let x=o.height*(a-this.paddingSizeRatio());const m=o.height*(1-a-this.paddingSizeRatio()),g=o.height*(this.iconSizeRatio()-this.paddingSizeRatio()),b=s*this.paddingSizeRatio(),v=t.getContext("2d");v.clearRect(0,0,o.width,o.height);const w=n.fontFamily();function S(t,e,i,n){v.textBaseline="top",v.font=`${i}px ${w}`,v.fillStyle=_;let s=v.measureText(t);if(s.width>o.width-2*b){i*=(o.width-2*b)/s.width,v.font=`${i}px ${w}`,s=v.measureText(t)}const a=A(s.width,n);return v.fillText(t,a,e),i}function A(t,e){switch(e){case"start":return b;case"middle":return o.width/2-t/2;case"end":return o.width-t-b}}v.fillStyle=y,v.fillRect(0,0,o.width,o.height),v.globalAlpha=this.iconOpacity(),function(t,e,i){if(void 0===t)return;v.textBaseline=n.iconBaseline(),v.font=`${e}px FontAwesome`,v.fillStyle=_;let s=v.measureText(t);s.width>o.width-2*b&&(v.font=e*((o.width-2*b)/s.width)+"px FontAwesome",s=v.measureText(t));const a=A(s.width,i),r=function(t){switch(t){case"top":return b;case"middle":return o.height/2;case"bottom":return o.height-b}}(n.iconBaseline());v.fillText(t,a,r)}(i.Utility.faChar(p),g,n.iconAnchor()),v.globalAlpha=this.valueOpacity(),x=S(f,b,x,n.valueAnchor()),v.globalAlpha=this.labelOpacity(),S(d,x+b,m,n.labelAnchor())}};Xo.prototype._class+=" chart_SummaryC",Xo.prototype.implements(e.I2DChart.prototype),Xo.prototype.publish("iconBaseline","bottom","string","Text baseline for the icon",["top","middle","bottom"]),Xo.prototype.publish("iconAnchor","end","set","Anchors the icon either at the start, middle, or end of the summary",["start","middle","end"]),Xo.prototype.publish("valueAnchor","start","set","Anchors the value either at the start, middle, or end of the summary",["start","middle","end"]),Xo.prototype.publish("labelAnchor","start","set","Anchors the label either at the start, middle, or end of the summary",["start","middle","end"]),Xo.prototype.publish("iconColumn",null,"set","Select Icon Column",function(){return this.columns()},{optional:!0}),Xo.prototype.publish("icon","fa-briefcase","string","FA Char icon class",null,{disable:t=>t.iconColumn()}),Xo.prototype.publish("fontFamily","Arial","string","Font Family"),Xo.prototype.publish("labelColumn",null,"set","Select display value",function(){return this.columns()},{optional:!0}),Xo.prototype.publish("valueColumn",null,"set","Select display value",function(){return this.columns()},{optional:!0}),Xo.prototype.publish("colorFillColumn",null,"set","Column for background color",function(){return this.columns()},{optional:!0}),Xo.prototype.publish("colorFill","#0097e6","html-color","Background Color",null,{disable:t=>t.colorFillColumn()}),Xo.prototype.publish("colorStrokeColumn",null,"set","Column for font color",function(){return this.columns()},{optional:!0}),Xo.prototype.publish("colorStroke","#2f3640","html-color","Font Color",null,{disable:t=>t.colorStrokeColumn()}),Xo.prototype.publish("fixedSize",!0,"boolean","Fix Size to Min Width/Height"),Xo.prototype.publish("minWidth",225,"number","Minimum Width"),Xo.prototype.publish("minHeight",150,"number","Minimum Height"),Xo.prototype.publish("playInterval",null,"number","Play Interval",null,{optional:!0}),Xo.prototype.publish("fontSizeRatio",.618,"number","Ratio between widget height and value font size"),Xo.prototype.publish("valueOpacity",1,"number","Opacity of value text (0..1)"),Xo.prototype.publish("labelOpacity",.9,"number","Opacity of label text (0..1)"),Xo.prototype.publish("iconOpacity",.3,"number","Opacity of icon text (0..1)"),Xo.prototype.publish("paddingSizeRatio",.1,"number","Ratio of the smallest dimension for edge padding (0..1)"),Xo.prototype.publish("iconSizeRatio",.9,"number","Ratio of the height for icon size (0..1)");var Yo=Xo.prototype.playInterval;Xo.prototype.playInterval=function(t){const e=Yo.apply(this,arguments);if(arguments.length){this._playIntervalHandle&&clearInterval(this._playIntervalHandle);const e=this;t&&(this._playIntervalHandle=setInterval(function(){e._playIntervalIdx++,e._renderCount&&e.data().length&&e.render()},t))}return e};var Uo=Math.PI/180,Qo=2048;function Zo(){const t=(0,i.dispatch)("word","end"),e={};let n=[256,256],o=Jo,s=Ko,a=es,r=ts,l=ts,h=is,c=ns,u=[],p=ls,d=1/0,f=null,y=Math.random,_=hs;function x(t,e,i){const o=e.x,s=e.y,a=Math.sqrt(n[0]*n[0]+n[1]*n[1]),r=p(n),l=y()<.5?1:-1;let h,c,u,d=-l;for(;(h=r(d+=l))&&(c=~~h[0],u=~~h[1],!(Math.min(Math.abs(c),Math.abs(u))>=a));)if(e.x=o+c,e.y=s+u,!(e.x+e.x0<0||e.y+e.y0<0||e.x+e.x1>n[0]||e.y+e.y1>n[1])&&(!i||!ss(e,t,n[0]))&&(!i||rs(e,i))){const i=e.sprite,o=e.width>>5,s=n[0]>>5,a=e.x-(o<<4),r=127&a,l=32-r,h=e.y1-e.y0;let c,u=(e.y+e.y0)*s+(a>>5);for(let e=0;e<h;e++){c=0;for(let n=0;n<=o;n++)t[u+n]|=c<<l|(n<o?(c=i[e*o+n])>>>r:0);u+=s}return delete e.sprite,!0}return!1}return e.canvas=function(t){return arguments.length?(_=cs(t),e):_},e.start=function(){const i=function(t){t.width=t.height=1;const e=Math.sqrt(t.getContext("2d").getImageData(0,0,1,1).data.length>>2);t.width=2048/e,t.height=Qo/e;const i=t.getContext("2d");return i.fillStyle=i.strokeStyle="red",i.textAlign="center",{context:i,ratio:e}}(_()),p=function(t){const e=[];let i=-1;for(;++i<t;)e[i]=0;return e}((n[0]>>5)*n[1]);let m=null;const g=u.length;let b=-1;const v=[],w=u.map(function(t,e){return t.text=o.call(this,t,e),t.font=s.call(this,t,e),t.style=r.call(this,t,e),t.weight=l.call(this,t,e),t.rotate=h.call(this,t,e),t.size=~~a.call(this,t,e),t.padding=c.call(this,t,e),t}).sort(function(t,e){return e.size-t.size});return f&&clearInterval(f),f=setInterval(S,0),S(),e;function S(){const o=Date.now();for(;Date.now()-o<d&&++b<g&&f;){const o=w[b];o.x=n[0]*(y()+.5)>>1,o.y=n[1]*(y()+.5)>>1,os(i,o,w,b),o.hasText&&x(p,o,m)&&(v.push(o),t.call("word",e,o),m?as(m,o):m=[{x:o.x+o.x0,y:o.y+o.y0},{x:o.x+o.x1,y:o.y+o.y1}],o.x-=n[0]>>1,o.y-=n[1]>>1)}b>=g&&(e.stop(),t.call("end",e,v,m))}},e.stop=function(){return f&&(clearInterval(f),f=null),e},e.timeInterval=function(t){return arguments.length?(d=null==t?1/0:t,e):d},e.words=function(t){return arguments.length?(u=t,e):u},e.size=function(t){return arguments.length?(n=[+t[0],+t[1]],e):n},e.font=function(t){return arguments.length?(s=cs(t),e):s},e.fontStyle=function(t){return arguments.length?(r=cs(t),e):r},e.fontWeight=function(t){return arguments.length?(l=cs(t),e):l},e.rotate=function(t){return arguments.length?(h=cs(t),e):h},e.text=function(t){return arguments.length?(o=cs(t),e):o},e.spiral=function(t){return arguments.length?(p=us[t]||t,e):p},e.fontSize=function(t){return arguments.length?(a=cs(t),e):a},e.padding=function(t){return arguments.length?(c=cs(t),e):c},e.random=function(t){return arguments.length?(y=t,e):y},e.on=function(){const i=t.on.apply(t,arguments);return i===t?e:i},e}function Jo(t){return t.text}function Ko(){return"serif"}function ts(){return"normal"}function es(t){return Math.sqrt(t.value)}function is(){return 30*(~~(6*Math.random())-3)}function ns(){return 1}function os(t,e,i,n){if(e.sprite)return;const o=t.context,s=t.ratio;o.clearRect(0,0,2048/s,Qo/s);let a=0,r=0,l=0;const h=i.length;for(--n;++n<h;){e=i[n],o.save(),o.font=e.style+" "+e.weight+" "+~~((e.size+1)/s)+"px "+e.font;let t=o.measureText(e.text+"m").width*s,h=e.size<<1;if(e.rotate){const i=Math.sin(e.rotate*Uo),n=Math.cos(e.rotate*Uo),o=t*n,s=t*i,a=h*n,r=h*i;t=Math.max(Math.abs(o+r),Math.abs(o-r))+31>>5<<5,h=~~Math.max(Math.abs(s+a),Math.abs(s-a))}else t=t+31>>5<<5;if(h>l&&(l=h),a+t>=2048&&(a=0,r+=l,l=0),r+h>=Qo)break;o.translate((a+(t>>1))/s,(r+(h>>1))/s),e.rotate&&o.rotate(e.rotate*Uo),o.fillText(e.text,0,0),e.padding&&(o.lineWidth=2*e.padding,o.strokeText(e.text,0,0)),o.restore(),e.width=t,e.height=h,e.xoff=a,e.yoff=r,e.x1=t>>1,e.y1=h>>1,e.x0=-e.x1,e.y0=-e.y1,e.hasText=!0,a+=t}const c=o.getImageData(0,0,2048/s,Qo/s).data,u=[];for(;--n>=0;){if(!(e=i[n]).hasText)continue;const t=e.width,o=t>>5;let s=e.y1-e.y0;for(let e=0;e<s*o;e++)u[e]=0;if(a=e.xoff,null==a)return;r=e.yoff;let l=0,h=-1;for(let i=0;i<s;i++){for(let e=0;e<t;e++){const t=o*i+(e>>5),n=c[2048*(r+i)+(a+e)<<2]?1<<31-e%32:0;u[t]|=n,l|=n}l?h=i:(e.y0++,s--,i--,r++)}e.y1=e.y0+h,e.sprite=u.slice(0,(e.y1-e.y0)*o)}}function ss(t,e,i){i>>=5;const n=t.sprite,o=t.width>>5,s=t.x-(o<<4),a=127&s,r=32-a,l=t.y1-t.y0;let h,c=(t.y+t.y0)*i+(s>>5);for(let u=0;u<l;u++){h=0;for(let t=0;t<=o;t++)if((h<<r|(t<o?(h=n[u*o+t])>>>a:0))&e[c+t])return!0;c+=i}return!1}function as(t,e){const i=t[0],n=t[1];e.x+e.x0<i.x&&(i.x=e.x+e.x0),e.y+e.y0<i.y&&(i.y=e.y+e.y0),e.x+e.x1>n.x&&(n.x=e.x+e.x1),e.y+e.y1>n.y&&(n.y=e.y+e.y1)}function rs(t,e){return t.x+t.x1>e[0].x&&t.x+t.x0<e[1].x&&t.y+t.y1>e[0].y&&t.y+t.y0<e[1].y}function ls(t){const e=t[0]/t[1];return function(t){return[e*(t*=.1)*Math.cos(t),t*Math.sin(t)]}}function hs(){return document.createElement("canvas")}function cs(t){return"function"==typeof t?t:function(){return t}}var us={archimedean:ls,rectangular:function(t){const e=4*t[0]/t[1];let i=0,n=0;return function(t){const o=t<0?-1:1;switch(Math.sqrt(1+4*o*t)-o&3){case 0:i+=e;break;case 1:n+=4;break;case 2:i-=e;break;default:n-=4}return[i,n]}}},ps=class extends i.SVGWidget{static __inputs=[{id:"label",type:"string"},{id:"value",type:"number"}];_prevOffsetX;_prevOffsetY;_prevZoom;_root;_canvas;_d3Cloud;_d3Zoom;constructor(){super(),e.I2DChart.call(this),e.ITooltip.call(this),i.Utility.SimpleSelectionMixin.call(this),this._prevOffsetX=this.offsetX(),this._prevOffsetY=this.offsetY(),this._prevZoom=this.zoom()}calcData(){return this.data().map(t=>({__viz_label:t[0],__viz_weight:t[1],__viz_row:t}))}enter(t,e){super.enter(t,e),this._selection.widgetElement(e),this._root=e.append("g"),this._canvas=document.createElement("canvas");const n=this;this._d3Zoom=(0,i.zoom)().scaleExtent([.1,10]),this._d3Zoom.on("zoom",function(t){const e=(0,i.d3Event)();e&&e.transform&&n.zoomed(n._d3Zoom,[e.transform.x,e.transform.y],e.transform.k)}),e.call(this._d3Zoom),this.tooltipHTML(function(t){const e=n.columns(),i=e&&e.length?e[0]:"Word";return n.tooltipFormat({label:t.__viz_label,series:i,value:t.__viz_weight})})}update(t,e){super.update(t,e),this._palette=this._palette.switch(this.paletteID()),this.useClonedPalette()&&(this._palette=this._palette.cloneNotExists(this.paletteID()+"_"+this.id())),this._d3Cloud=Zo().canvas(()=>this._canvas),this.zoomed(this,[this.offsetX(),this.offsetY()],this.zoom());const n=this.calcData(),o=this,s=(0,i.extent)(n,function(t){return t.__viz_weight});let a;switch(this.scaleMode()){case"log":a=i.scaleLog;break;case"sqrt":a=i.scaleSqrt;break;case"pow":a=i.scalePow;break;default:a=i.scaleLinear}const r=a().domain(s).range([this.fontSizeFrom(),this.fontSizeTo()]),l=(0,i.scaleLinear)().domain([0,o.angleCount()-1]).range([o.angleFrom(),o.angleTo()]);this._d3Cloud.stop().size([this.width(),this.height()]).words(n).font(this.fontFamily()).padding(this.padding()).spiral(this.spiral()).text(function(t){return t.__viz_label.trim()}).fontSize(function(t){return r(t.__viz_weight)}).rotate((t,e)=>l(e%o.angleCount())).on("word",t=>{}).on("end",function(t,e){const i=o._root.selectAll("text").data(t,function(t){return t.__viz_label?t.__viz_label.toLowerCase():""});i.enter().append("text").attr("text-anchor","middle").call(o._selection.enter.bind(o._selection)).text(function(t){return t.__viz_label}).on("click",function(t){o.click(o.rowToObj(t.__viz_row),o.columns()[1],o._selection.selected(this))}).on("dblclick",function(t){o.dblclick(o.rowToObj(t.__viz_row),o.columns()[1],o._selection.selected(this))}).on("mouseout.tooltip",o.tooltip.hide).on("mousemove.tooltip",o.tooltip.show).style("opacity",1e-6).merge(i).style("font-size",function(t){return r(t.__viz_weight)+"px"}).style("font-family",o.fontFamily()).transition().duration(1e3).attr("transform",function(t){return"translate("+[t.x,t.y]+")rotate("+t.rotate+")"}).style("fill",function(t){return o._palette(t.__viz_label?t.__viz_label.toLowerCase():"")}).style("opacity",1),i.exit().transition().duration(1e3).style("opacity",1e-4).remove()}).start()}zoomed(t,e,i){if(e[0]!==this._prevOffsetX||e[1]!==this._prevOffsetY||i!==this._prevZoom){switch(this._root.attr("transform",e),t){case this:break;case this._d3Zoom:this.offsetX(e[0]),this.offsetY(e[1]),this.zoom(i)}this._prevOffsetX=e[0],this._prevOffsetY=e[1],this._prevZoom=i}}};ps.prototype._class+=" chart_WordCloud",ps.prototype.implements(e.I2DChart.prototype),ps.prototype.implements(e.ITooltip.prototype),ps.prototype.mixin(i.Utility.SimpleSelectionMixin),ps.prototype.publish("paletteID","default","set","Color palette for this widget",ps.prototype._palette.switch(),{tags:["Basic","Shared"]}),ps.prototype.publish("useClonedPalette",!1,"boolean","Enable or disable using a cloned palette",null,{tags:["Intermediate","Shared"]}),ps.prototype.publish("fontFamily","Impact","string","Font Name",null,{tags:["Basic"]}),ps.prototype.publish("fontSizeFrom",6,"number","Minimum font size (pixels)",null,{tags:["Basic"]}),ps.prototype.publish("fontSizeTo",48,"number","Maximum font size (pixels)",null,{tags:["Basic"]}),ps.prototype.publish("angleFrom",-60,"number","Minimum angle (degrees)",null,{tags:["Basic"]}),ps.prototype.publish("angleTo",60,"number","Maximum angle (degrees)",null,{tags:["Basic"]}),ps.prototype.publish("angleCount",5,"number","Number of different angles",null,{tags:["Basic"]}),ps.prototype.publish("padding",0,"number","Padding between words (pixels)",null,{tags:["Intermediate"]}),ps.prototype.publish("scaleMode","linear","set","Text scaling mode",["linear","log","sqrt","pow"],{tags:["Intermediate"]}),ps.prototype.publish("spiral","archimedean","set","Text scaling mode",["archimedean","rectangular"],{tags:["Intermediate"]}),ps.prototype.publish("offsetX",0,"number","X offset",null,{tags:["Advanced"]}),ps.prototype.publish("offsetY",0,"number","Y offset",null,{tags:["Advanced"]}),ps.prototype.publish("zoom",1,"number","Zoom",null,{tags:["Advanced"]}),t.Area=zt,t.Axis=Tt,t.BUILD_VERSION="3.15.0",t.Bar=Dt,t.Bubble=oe,t.BubbleXY=se,t.Bullet=Te,t.Column=It,t.Contour=sn,t.Gantt=an,t.Gauge=wo,t.HalfPie=Mo,t.Heat=To,t.HexBin=Fo,t.Line=Oo,t.PKG_NAME="@hpcc-js/chart",t.PKG_VERSION="3.5.0",t.Pie=ko,t.QuarterPie=jo,t.QuartileCandlestick=Ro,t.Radar=Eo,t.RadialBar=No,t.Scatter=Ct,t.StatChart=Ho,t.Step=Vo,t.Summary=Go,t.SummaryC=Xo,t.WordCloud=ps,t.XYAxis=Pt});
|
|
2
|
-
//# sourceMappingURL=index.umd.cjs.map
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@hpcc-js/api"),require("@hpcc-js/common"),require("@hpcc-js/util")):"function"==typeof define&&define.amd?define(["exports","@hpcc-js/api","@hpcc-js/common","@hpcc-js/util"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self)["@hpcc-js/chart"]={},t["@hpcc-js/api"],t["@hpcc-js/common"],t["@hpcc-js/util"])}(this,function(t,e,i,n){"use strict";var o=Object.defineProperty,s=(t,e)=>o(t,"name",{value:e,configurable:!0}),a=(t,e,i)=>((t,e,i)=>e in t?o(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i)(t,"symbol"!=typeof e?e+"":e,i);var r=Math.PI,l=2*r,h=1e-6,c=l-h;function u(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function p(){return new u}function d(t){return s(function(){return t},"constant")}s(u,"Path"),s(p,"path"),u.prototype=p.prototype={constructor:u,moveTo:s(function(t,e){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)},"moveTo"),closePath:s(function(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},"closePath"),lineTo:s(function(t,e){this._+="L"+(this._x1=+t)+","+(this._y1=+e)},"lineTo"),quadraticCurveTo:s(function(t,e,i,n){this._+="Q"+ +t+","+ +e+","+(this._x1=+i)+","+(this._y1=+n)},"quadraticCurveTo"),bezierCurveTo:s(function(t,e,i,n,o,s){this._+="C"+ +t+","+ +e+","+ +i+","+ +n+","+(this._x1=+o)+","+(this._y1=+s)},"bezierCurveTo"),arcTo:s(function(t,e,i,n,o){t=+t,e=+e,i=+i,n=+n,o=+o;var s=this._x1,a=this._y1,l=i-t,c=n-e,u=s-t,p=a-e,d=u*u+p*p;if(o<0)throw new Error("negative radius: "+o);if(null===this._x1)this._+="M"+(this._x1=t)+","+(this._y1=e);else if(d>h)if(Math.abs(p*l-c*u)>h&&o){var f=i-s,y=n-a,_=l*l+c*c,x=f*f+y*y,m=Math.sqrt(_),g=Math.sqrt(d),b=o*Math.tan((r-Math.acos((_+d-x)/(2*m*g)))/2),v=b/g,w=b/m;Math.abs(v-1)>h&&(this._+="L"+(t+v*u)+","+(e+v*p)),this._+="A"+o+","+o+",0,0,"+ +(p*f>u*y)+","+(this._x1=t+w*l)+","+(this._y1=e+w*c)}else this._+="L"+(this._x1=t)+","+(this._y1=e);else;},"arcTo"),arc:s(function(t,e,i,n,o,s){t=+t,e=+e,s=!!s;var a=(i=+i)*Math.cos(n),u=i*Math.sin(n),p=t+a,d=e+u,f=1^s,y=s?n-o:o-n;if(i<0)throw new Error("negative radius: "+i);null===this._x1?this._+="M"+p+","+d:(Math.abs(this._x1-p)>h||Math.abs(this._y1-d)>h)&&(this._+="L"+p+","+d),i&&(y<0&&(y=y%l+l),y>c?this._+="A"+i+","+i+",0,1,"+f+","+(t-a)+","+(e-u)+"A"+i+","+i+",0,1,"+f+","+(this._x1=p)+","+(this._y1=d):y>h&&(this._+="A"+i+","+i+",0,"+ +(y>=r)+","+f+","+(this._x1=t+i*Math.cos(o))+","+(this._y1=e+i*Math.sin(o))))},"arc"),rect:s(function(t,e,i,n){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)+"h"+ +i+"v"+ +n+"h"+-i+"Z"},"rect"),toString:s(function(){return this._},"toString")},s(d,"constant$3");var f=Math.abs,y=Math.atan2,_=Math.cos,x=Math.max,m=Math.min,g=Math.sin,b=Math.sqrt,v=1e-12,w=Math.PI,S=w/2,A=2*w;function k(t){return t>1?0:t<-1?w:Math.acos(t)}function M(t){return t>=1?S:t<=-1?-S:Math.asin(t)}function T(t){return t.innerRadius}function P(t){return t.outerRadius}function C(t){return t.startAngle}function I(t){return t.endAngle}function z(t){return t&&t.padAngle}function F(t,e,i,n,o,s,a,r){var l=i-t,h=n-e,c=a-o,u=r-s,p=u*l-c*h;if(!(p*p<v))return[t+(p=(c*(e-s)-u*(t-o))/p)*l,e+p*h]}function D(t,e,i,n,o,s,a){var r=t-i,l=e-n,h=(a?s:-s)/b(r*r+l*l),c=h*l,u=-h*r,p=t+c,d=e+u,f=i+c,y=n+u,_=(p+f)/2,m=(d+y)/2,g=f-p,v=y-d,w=g*g+v*v,S=o-s,A=p*y-f*d,k=(v<0?-1:1)*b(x(0,S*S*w-A*A)),M=(A*v-g*k)/w,T=(-A*g-v*k)/w,P=(A*v+g*k)/w,C=(-A*g+v*k)/w,I=M-_,z=T-m,F=P-_,D=C-m;return I*I+z*z>F*F+D*D&&(M=P,T=C),{cx:M,cy:T,x01:-c,y01:-u,x11:M*(o/S-1),y11:T*(o/S-1)}}function E(){var t=T,e=P,i=d(0),n=null,o=C,a=I,r=z,l=null;function h(){var s,h,c=+t.apply(this,arguments),u=+e.apply(this,arguments),d=o.apply(this,arguments)-S,x=a.apply(this,arguments)-S,T=f(x-d),P=x>d;if(l||(l=s=p()),u<c&&(h=u,u=c,c=h),u>v)if(T>A-v)l.moveTo(u*_(d),u*g(d)),l.arc(0,0,u,d,x,!P),c>v&&(l.moveTo(c*_(x),c*g(x)),l.arc(0,0,c,x,d,P));else{var C,I,z=d,E=x,O=d,R=x,j=T,N=T,L=r.apply(this,arguments)/2,B=L>v&&(n?+n.apply(this,arguments):b(c*c+u*u)),$=m(f(u-c)/2,+i.apply(this,arguments)),H=$,V=$;if(B>v){var q=M(B/c*g(L)),W=M(B/u*g(L));(j-=2*q)>v?(O+=q*=P?1:-1,R-=q):(j=0,O=R=(d+x)/2),(N-=2*W)>v?(z+=W*=P?1:-1,E-=W):(N=0,z=E=(d+x)/2)}var G=u*_(z),X=u*g(z),Y=c*_(R),U=c*g(R);if($>v){var Q,Z=u*_(E),J=u*g(E),K=c*_(O),tt=c*g(O);if(T<w&&(Q=F(G,X,K,tt,Z,J,Y,U))){var et=G-Q[0],it=X-Q[1],nt=Z-Q[0],ot=J-Q[1],st=1/g(k((et*nt+it*ot)/(b(et*et+it*it)*b(nt*nt+ot*ot)))/2),at=b(Q[0]*Q[0]+Q[1]*Q[1]);H=m($,(c-at)/(st-1)),V=m($,(u-at)/(st+1))}}N>v?V>v?(C=D(K,tt,G,X,u,V,P),I=D(Z,J,Y,U,u,V,P),l.moveTo(C.cx+C.x01,C.cy+C.y01),V<$?l.arc(C.cx,C.cy,V,y(C.y01,C.x01),y(I.y01,I.x01),!P):(l.arc(C.cx,C.cy,V,y(C.y01,C.x01),y(C.y11,C.x11),!P),l.arc(0,0,u,y(C.cy+C.y11,C.cx+C.x11),y(I.cy+I.y11,I.cx+I.x11),!P),l.arc(I.cx,I.cy,V,y(I.y11,I.x11),y(I.y01,I.x01),!P))):(l.moveTo(G,X),l.arc(0,0,u,z,E,!P)):l.moveTo(G,X),c>v&&j>v?H>v?(C=D(Y,U,Z,J,c,-H,P),I=D(G,X,K,tt,c,-H,P),l.lineTo(C.cx+C.x01,C.cy+C.y01),H<$?l.arc(C.cx,C.cy,H,y(C.y01,C.x01),y(I.y01,I.x01),!P):(l.arc(C.cx,C.cy,H,y(C.y01,C.x01),y(C.y11,C.x11),!P),l.arc(0,0,c,y(C.cy+C.y11,C.cx+C.x11),y(I.cy+I.y11,I.cx+I.x11),P),l.arc(I.cx,I.cy,H,y(I.y11,I.x11),y(I.y01,I.x01),!P))):l.arc(0,0,c,R,O,P):l.lineTo(Y,U)}else l.moveTo(0,0);if(l.closePath(),s)return l=null,s+""||null}return s(h,"arc"),h.centroid=function(){var i=(+t.apply(this,arguments)+ +e.apply(this,arguments))/2,n=(+o.apply(this,arguments)+ +a.apply(this,arguments))/2-w/2;return[_(n)*i,g(n)*i]},h.innerRadius=function(e){return arguments.length?(t="function"==typeof e?e:d(+e),h):t},h.outerRadius=function(t){return arguments.length?(e="function"==typeof t?t:d(+t),h):e},h.cornerRadius=function(t){return arguments.length?(i="function"==typeof t?t:d(+t),h):i},h.padRadius=function(t){return arguments.length?(n=null==t?null:"function"==typeof t?t:d(+t),h):n},h.startAngle=function(t){return arguments.length?(o="function"==typeof t?t:d(+t),h):o},h.endAngle=function(t){return arguments.length?(a="function"==typeof t?t:d(+t),h):a},h.padAngle=function(t){return arguments.length?(r="function"==typeof t?t:d(+t),h):r},h.context=function(t){return arguments.length?(l=null==t?null:t,h):l},h}function O(t){this._context=t}function R(t){return new O(t)}function j(t){return t[0]}function N(t){return t[1]}function L(){var t=j,e=N,i=d(!0),n=null,o=R,a=null;function r(s){var r,l,h,c=s.length,u=!1;for(null==n&&(a=o(h=p())),r=0;r<=c;++r)!(r<c&&i(l=s[r],r,s))===u&&((u=!u)?a.lineStart():a.lineEnd()),u&&a.point(+t(l,r,s),+e(l,r,s));if(h)return a=null,h+""||null}return s(r,"line"),r.x=function(e){return arguments.length?(t="function"==typeof e?e:d(+e),r):t},r.y=function(t){return arguments.length?(e="function"==typeof t?t:d(+t),r):e},r.defined=function(t){return arguments.length?(i="function"==typeof t?t:d(!!t),r):i},r.curve=function(t){return arguments.length?(o=t,null!=n&&(a=o(n)),r):o},r.context=function(t){return arguments.length?(null==t?n=a=null:a=o(n=t),r):n},r}function B(){var t=j,e=null,i=d(0),n=N,o=d(!0),a=null,r=R,l=null;function h(s){var h,c,u,d,f,y=s.length,_=!1,x=new Array(y),m=new Array(y);for(null==a&&(l=r(f=p())),h=0;h<=y;++h){if(!(h<y&&o(d=s[h],h,s))===_)if(_=!_)c=h,l.areaStart(),l.lineStart();else{for(l.lineEnd(),l.lineStart(),u=h-1;u>=c;--u)l.point(x[u],m[u]);l.lineEnd(),l.areaEnd()}_&&(x[h]=+t(d,h,s),m[h]=+i(d,h,s),l.point(e?+e(d,h,s):x[h],n?+n(d,h,s):m[h]))}if(f)return l=null,f+""||null}function c(){return L().defined(o).curve(r).context(a)}return s(h,"area"),s(c,"arealine"),h.x=function(i){return arguments.length?(t="function"==typeof i?i:d(+i),e=null,h):t},h.x0=function(e){return arguments.length?(t="function"==typeof e?e:d(+e),h):t},h.x1=function(t){return arguments.length?(e=null==t?null:"function"==typeof t?t:d(+t),h):e},h.y=function(t){return arguments.length?(i="function"==typeof t?t:d(+t),n=null,h):i},h.y0=function(t){return arguments.length?(i="function"==typeof t?t:d(+t),h):i},h.y1=function(t){return arguments.length?(n=null==t?null:"function"==typeof t?t:d(+t),h):n},h.lineX0=h.lineY0=function(){return c().x(t).y(i)},h.lineY1=function(){return c().x(t).y(n)},h.lineX1=function(){return c().x(e).y(i)},h.defined=function(t){return arguments.length?(o="function"==typeof t?t:d(!!t),h):o},h.curve=function(t){return arguments.length?(r=t,null!=a&&(l=r(a)),h):r},h.context=function(t){return arguments.length?(null==t?a=l=null:l=r(a=t),h):a},h}function $(t,e){return e<t?-1:e>t?1:e>=t?0:NaN}function H(t){return t}function V(){var t=H,e=$,i=null,n=d(0),o=d(A),a=d(0);function r(s){var r,l,h,c,u,p=s.length,d=0,f=new Array(p),y=new Array(p),_=+n.apply(this,arguments),x=Math.min(A,Math.max(-A,o.apply(this,arguments)-_)),m=Math.min(Math.abs(x)/p,a.apply(this,arguments)),g=m*(x<0?-1:1);for(r=0;r<p;++r)(u=y[f[r]=r]=+t(s[r],r,s))>0&&(d+=u);for(null!=e?f.sort(function(t,i){return e(y[t],y[i])}):null!=i&&f.sort(function(t,e){return i(s[t],s[e])}),r=0,h=d?(x-p*g)/d:0;r<p;++r,_=c)l=f[r],c=_+((u=y[l])>0?u*h:0)+g,y[l]={data:s[l],index:r,value:u,startAngle:_,endAngle:c,padAngle:m};return y}return s(r,"pie"),r.value=function(e){return arguments.length?(t="function"==typeof e?e:d(+e),r):t},r.sortValues=function(t){return arguments.length?(e=t,i=null,r):e},r.sort=function(t){return arguments.length?(i=t,e=null,r):i},r.startAngle=function(t){return arguments.length?(n="function"==typeof t?t:d(+t),r):n},r.endAngle=function(t){return arguments.length?(o="function"==typeof t?t:d(+t),r):o},r.padAngle=function(t){return arguments.length?(a="function"==typeof t?t:d(+t),r):a},r}function q(t,e,i){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+i)/6)}function W(t){this._context=t}function G(t){return new W(t)}function X(t,e){this._basis=new W(t),this._beta=e}s(k,"acos"),s(M,"asin$1"),s(T,"arcInnerRadius$1"),s(P,"arcOuterRadius$1"),s(C,"arcStartAngle$1"),s(I,"arcEndAngle$1"),s(z,"arcPadAngle$1"),s(F,"intersect$1"),s(D,"cornerTangents$1"),s(E,"d3Arc"),s(O,"Linear$1"),O.prototype={areaStart:s(function(){this._line=0},"areaStart"),areaEnd:s(function(){this._line=NaN},"areaEnd"),lineStart:s(function(){this._point=0},"lineStart"),lineEnd:s(function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},"lineEnd"),point:s(function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e)}},"point")},s(R,"d3CurveLinear"),s(j,"x$1"),s(N,"y$1"),s(L,"d3Line"),s(B,"d3Area"),s($,"descending"),s(H,"identity$2"),s(V,"d3Pie"),s(q,"point$7"),s(W,"Basis$1"),W.prototype={areaStart:s(function(){this._line=0},"areaStart"),areaEnd:s(function(){this._line=NaN},"areaEnd"),lineStart:s(function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},"lineStart"),lineEnd:s(function(){switch(this._point){case 3:q(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},"lineEnd"),point:s(function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:q(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e},"point")},s(G,"d3CurveBasis"),s(X,"Bundle$1"),X.prototype={lineStart:s(function(){this._x=[],this._y=[],this._basis.lineStart()},"lineStart"),lineEnd:s(function(){var t=this._x,e=this._y,i=t.length-1;if(i>0)for(var n,o=t[0],s=e[0],a=t[i]-o,r=e[i]-s,l=-1;++l<=i;)n=l/i,this._basis.point(this._beta*t[l]+(1-this._beta)*(o+n*a),this._beta*e[l]+(1-this._beta)*(s+n*r));this._x=this._y=null,this._basis.lineEnd()},"lineEnd"),point:s(function(t,e){this._x.push(+t),this._y.push(+e)},"point")};const Y=s(function t(e){function i(t){return 1===e?new W(t):new X(t,e)}return s(i,"bundle"),i.beta=function(e){return t(+e)},i},"custom")(.85);function U(t,e,i){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-e),t._y2+t._k*(t._y1-i),t._x2,t._y2)}function Q(t,e){this._context=t,this._k=(1-e)/6}s(U,"point$6"),s(Q,"Cardinal$1"),Q.prototype={areaStart:s(function(){this._line=0},"areaStart"),areaEnd:s(function(){this._line=NaN},"areaEnd"),lineStart:s(function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},"lineStart"),lineEnd:s(function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:U(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},"lineEnd"),point:s(function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2,this._x1=t,this._y1=e;break;case 2:this._point=3;default:U(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e},"point")};const Z=s(function t(e){function i(t){return new Q(t,e)}return s(i,"cardinal"),i.tension=function(e){return t(+e)},i},"custom")(0);function J(t,e,i){var n=t._x1,o=t._y1,s=t._x2,a=t._y2;if(t._l01_a>v){var r=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,l=3*t._l01_a*(t._l01_a+t._l12_a);n=(n*r-t._x0*t._l12_2a+t._x2*t._l01_2a)/l,o=(o*r-t._y0*t._l12_2a+t._y2*t._l01_2a)/l}if(t._l23_a>v){var h=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,c=3*t._l23_a*(t._l23_a+t._l12_a);s=(s*h+t._x1*t._l23_2a-e*t._l12_2a)/c,a=(a*h+t._y1*t._l23_2a-i*t._l12_2a)/c}t._context.bezierCurveTo(n,o,s,a,t._x2,t._y2)}function K(t,e){this._context=t,this._alpha=e}s(J,"point$5"),s(K,"CatmullRom$1"),K.prototype={areaStart:s(function(){this._line=0},"areaStart"),areaEnd:s(function(){this._line=NaN},"areaEnd"),lineStart:s(function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},"lineStart"),lineEnd:s(function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},"lineEnd"),point:s(function(t,e){if(t=+t,e=+e,this._point){var i=this._x2-t,n=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(i*i+n*n,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3;default:J(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e},"point")};const tt=s(function t(e){function i(t){return e?new K(t,e):new Q(t,0)}return s(i,"catmullRom"),i.alpha=function(e){return t(+e)},i},"custom")(.5);function et(t){return t<0?-1:1}function it(t,e,i){var n=t._x1-t._x0,o=e-t._x1,s=(t._y1-t._y0)/(n||o<0&&-0),a=(i-t._y1)/(o||n<0&&-0),r=(s*o+a*n)/(n+o);return(et(s)+et(a))*Math.min(Math.abs(s),Math.abs(a),.5*Math.abs(r))||0}function nt(t,e){var i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function ot(t,e,i){var n=t._x0,o=t._y0,s=t._x1,a=t._y1,r=(s-n)/3;t._context.bezierCurveTo(n+r,o+r*e,s-r,a-r*i,s,a)}function st(t){this._context=t}function at(t){return new st(t)}function rt(t){this._context=t}function lt(t){var e,i,n=t.length-1,o=new Array(n),s=new Array(n),a=new Array(n);for(o[0]=0,s[0]=2,a[0]=t[0]+2*t[1],e=1;e<n-1;++e)o[e]=1,s[e]=4,a[e]=4*t[e]+2*t[e+1];for(o[n-1]=2,s[n-1]=7,a[n-1]=8*t[n-1]+t[n],e=1;e<n;++e)i=o[e]/s[e-1],s[e]-=i,a[e]-=i*a[e-1];for(o[n-1]=a[n-1]/s[n-1],e=n-2;e>=0;--e)o[e]=(a[e]-o[e+1])/s[e];for(s[n-1]=(t[n]+o[n-1])/2,e=0;e<n-1;++e)s[e]=2*t[e+1]-o[e+1];return[o,s]}function ht(t){return new rt(t)}function ct(t,e){this._context=t,this._t=e}function ut(t){return new ct(t,.5)}function pt(t){return new ct(t,0)}function dt(t){return new ct(t,1)}s(et,"sign$1"),s(it,"slope3$1"),s(nt,"slope2$1"),s(ot,"point$4"),s(st,"MonotoneX$1"),st.prototype={areaStart:s(function(){this._line=0},"areaStart"),areaEnd:s(function(){this._line=NaN},"areaEnd"),lineStart:s(function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},"lineStart"),lineEnd:s(function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:ot(this,this._t0,nt(this,this._t0))}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},"lineEnd"),point:s(function(t,e){var i=NaN;if(e=+e,(t=+t)!==this._x1||e!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,ot(this,nt(this,i=it(this,t,e)),i);break;default:ot(this,this._t0,i=it(this,t,e))}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=i}},"point")},Object.create(st.prototype).point=function(t,e){st.prototype.point.call(this,e,t)},s(at,"monotoneX"),s(rt,"Natural"),rt.prototype={areaStart:s(function(){this._line=0},"areaStart"),areaEnd:s(function(){this._line=NaN},"areaEnd"),lineStart:s(function(){this._x=[],this._y=[]},"lineStart"),lineEnd:s(function(){var t=this._x,e=this._y,i=t.length;if(i)if(this._line?this._context.lineTo(t[0],e[0]):this._context.moveTo(t[0],e[0]),2===i)this._context.lineTo(t[1],e[1]);else for(var n=lt(t),o=lt(e),s=0,a=1;a<i;++s,++a)this._context.bezierCurveTo(n[0][s],o[0][s],n[1][s],o[1][s],t[a],e[a]);(this._line||0!==this._line&&1===i)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},"lineEnd"),point:s(function(t,e){this._x.push(+t),this._y.push(+e)},"point")},s(lt,"controlPoints"),s(ht,"d3CurveNatural"),s(ct,"Step$1"),ct.prototype={areaStart:s(function(){this._line=0},"areaStart"),areaEnd:s(function(){this._line=NaN},"areaEnd"),lineStart:s(function(){this._x=this._y=NaN,this._point=0},"lineStart"),lineEnd:s(function(){0<this._t&&this._t<1&&2===this._point&&this._context.lineTo(this._x,this._y),(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},"lineEnd"),point:s(function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var i=this._x*(1-this._t)+t*this._t;this._context.lineTo(i,this._y),this._context.lineTo(i,e)}}this._x=t,this._y=e},"point")},s(ut,"d3CurveStep"),s(pt,"stepBefore"),s(dt,"stepAfter");var ft=Array.prototype.slice;function yt(t){return t}s(yt,"identity$1");var _t=1e-6;function xt(t){return"translate("+(t+.5)+",0)"}function mt(t){return"translate(0,"+(t+.5)+")"}function gt(t){return function(e){return+t(e)}}function bt(t){var e=Math.max(0,t.bandwidth()-1)/2;return t.round()&&(e=Math.round(e)),function(i){return+t(i)+e}}function vt(){return!this.__axis}function wt(t,e){var i=[],n=null,o=null,a=6,r=6,l=3,h=1===t||4===t?-1:1,c=4===t||2===t?"x":"y",u=1===t||3===t?xt:mt;function p(s){var p=null==n?e.ticks?e.ticks.apply(e,i):e.domain():n,d=null==o?e.tickFormat?e.tickFormat.apply(e,i):yt:o,f=Math.max(a,0)+l,y=e.range(),_=+y[0]+.5,x=+y[y.length-1]+.5,m=(e.bandwidth?bt:gt)(e.copy()),g=s.selection?s.selection():s,b=g.selectAll(".domain").data([null]),v=g.selectAll(".tick").data(p,e).order(),w=v.exit(),S=v.enter().append("g").attr("class","tick"),A=v.select("line"),k=v.select("text");b=b.merge(b.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),v=v.merge(S),A=A.merge(S.append("line").attr("stroke","currentColor").attr(c+"2",h*a)),k=k.merge(S.append("text").attr("fill","currentColor").attr(c,h*f).attr("dy",1===t?"0em":3===t?"0.71em":"0.32em")),s!==g&&(b=b.transition(s),v=v.transition(s),A=A.transition(s),k=k.transition(s),w=w.transition(s).attr("opacity",_t).attr("transform",function(t){return isFinite(t=m(t))?u(t):this.getAttribute("transform")}),S.attr("opacity",_t).attr("transform",function(t){var e=this.parentNode.__axis;return u(e&&isFinite(e=e(t))?e:m(t))})),w.remove(),b.attr("d",4===t||2==t?r?"M"+h*r+","+_+"H0.5V"+x+"H"+h*r:"M0.5,"+_+"V"+x:r?"M"+_+","+h*r+"V0.5H"+x+"V"+h*r:"M"+_+",0.5H"+x),v.attr("opacity",1).attr("transform",function(t){return u(m(t))}),A.attr(c+"2",h*a),k.attr(c,h*f).text(d),g.filter(vt).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",2===t?"start":4===t?"end":"middle"),g.each(function(){this.__axis=m})}return s(p,"axis"),p.scale=function(t){return arguments.length?(e=t,p):e},p.ticks=function(){return i=ft.call(arguments),p},p.tickArguments=function(t){return arguments.length?(i=null==t?[]:ft.call(t),p):i.slice()},p.tickValues=function(t){return arguments.length?(n=null==t?null:ft.call(t),p):n&&n.slice()},p.tickFormat=function(t){return arguments.length?(o=t,p):o},p.tickSize=function(t){return arguments.length?(a=r=+t,p):a},p.tickSizeInner=function(t){return arguments.length?(a=+t,p):a},p.tickSizeOuter=function(t){return arguments.length?(r=+t,p):r},p.tickPadding=function(t){return arguments.length?(l=+t,p):l},p}function St(t){return wt(1,t)}function At(t){return wt(2,t)}function kt(t){return wt(3,t)}function Mt(t){return wt(4,t)}s(xt,"translateX"),s(mt,"translateY"),s(gt,"number"),s(bt,"center"),s(vt,"entering"),s(wt,"axis"),s(St,"axisTop"),s(At,"axisRight"),s(kt,"axisBottom"),s(Mt,"axisLeft");const Tt=class _Axis extends i.SVGWidget{_origType;_origTimePattern;parser;parserInvert;formatter;d3Scale;d3Axis;d3Guides;_guideElement;svg;svgAxis;svgGuides;constructor(t="origin"){super(),this._drawStartPos=t,this.updateScale()}lowValue(){return this.parse(this.low())}highValue(){return this.parse(this.high())}parse(t,e){if(t instanceof Array)return t.map(function(t){return this.parse(t)},this);if(null!=t){if(this.parser)return this.parser("number"==typeof t?t.toString():t);if(e&&"string"==typeof t)return+t}return t}parseInvert(t){return t instanceof Array?t.map(function(t){return this.parseInvert(t)},this):this.parserInvert&&t?this.parserInvert(t):t}format(t){return t instanceof Array?t.map(function(t){return this.format(t)},this):null!=t&&this.formatter?this.formatter(t):t}parseFormat(t){return this.format(this.parse(t))}scalePos(t){let e=this.d3Scale(this.parse(t));return"ordinal"===this.type()&&(e+=this.bandwidth()/2),e}bandwidth(){return this.d3Scale.bandwidth?this.d3Scale.bandwidth():0}isHorizontal(){switch(this.orientation()){case"left":case"right":return!1}return!0}domain(t){return arguments.length?(this.d3Scale.domain(t),this):this.d3Scale.domain()}range(t){if(!arguments.length){if(this.d3Scale.rangeRoundBands)return this.d3Scale.rangeExtent();if(this.d3Scale.rangeRound)return this.d3Scale.range()}return this.d3Scale.rangeRoundBands?this.d3Scale.rangeRoundBands(t,.1):this.d3Scale.rangeRound&&this.d3Scale.range(t),this}invert(t){return this.d3Scale.invert(t)}guideTarget(t){return this._guideElement=i.select(t).attr("class",this._class),this}enter(t,e){super.enter(t,e),this.svg=e.append("g"),this.svgAxis=this.svg.append("g").attr("class","axis"),this.svgGuides=(this._guideElement||e).append("g").attr("class","guide")}_prevOrientation;updateScale(){switch(this.type()){case"ordinal":if(this.d3Scale=i.scaleBand().paddingInner(this.ordinalPaddingInner()).paddingOuter(this.ordinalPaddingOuter()),this.ordinals_exists()&&this.d3Scale.domain(this.ordinals()),this.parser=null,this.ordinalMappings_exists()){const t=this.ordinalMappings();this.formatter=e=>t[e]||e}else this.formatter=null;break;case"linear":this.d3Scale=i.scaleLinear(),this.low_exists()&&this.high_exists()&&this.d3Scale.domain([this.lowValue(),this.highValue()]),this.parser=null,this.formatter=this.tickFormat_exists()?i.format(this.tickFormat()):null;break;case"pow":this.d3Scale=i.scalePow().exponent(this.powExponent()),this.low_exists()&&this.high_exists()&&this.d3Scale.domain([this.lowValue(),this.highValue()]),this.parser=null,this.formatter=this.tickFormat_exists()?i.format(this.tickFormat()):null;break;case"log":this.d3Scale=i.scaleLog().base(this.logBase()),this.low_exists()&&this.high_exists()&&this.d3Scale.domain([this.lowValue(),this.highValue()]),this.parser=null,this.formatter=this.tickFormat_exists()?i.format(this.tickFormat()):null;break;case"time":this.d3Scale=i.scaleTime(),this.low_exists()&&this.high_exists()&&this.d3Scale.domain([this.lowValue(),this.highValue()]),this.parser=this.timePattern_exists()?i.timeParse(this.timePattern()):null,this.parserInvert=this.timePattern_exists()?i.timeFormat(this.timePattern()):null,this.formatter=this.tickFormat_exists()?i.timeFormat(this.tickFormat()):null}if(this._prevOrientation!==this.orientation()){switch(this.orientation()){case"left":this.d3Axis=Mt(this.d3Scale),this.d3Guides=Mt(this.d3Scale);break;case"top":this.d3Axis=St(this.d3Scale),this.d3Guides=St(this.d3Scale);break;case"right":this.d3Axis=At(this.d3Scale),this.d3Guides=At(this.d3Scale);break;default:this.d3Axis=kt(this.d3Scale),this.d3Guides=kt(this.d3Scale)}this._prevOrientation=this.orientation(),this.svgAxis&&this.svgAxis.html(""),this.svgGuides&&this.svgGuides.html("")}if(this.extend())if("ordinal"===this.type());else{let t,e,i,n,o,s;this.isHorizontal()?(t=this.width(),this.d3Scale.range([0,t]),e=t*this.extend()/100,i=this.d3Scale.invert(0),o=this.d3Scale.invert(-e),n=this.d3Scale.invert(t),s=this.d3Scale.invert(t+e)):(t=this.height(),this.d3Scale.range([t,0]),e=t*this.extend()/100,i=this.d3Scale.invert(t),o=this.d3Scale.invert(t+e),n=this.d3Scale.invert(0),s=this.d3Scale.invert(-e)),o===i&&(o=i-i*this.extend()/100),s===n&&(s=n+n*this.extend()/100),Math.sign(i)!==Math.sign(o)&&(o=0),Math.sign(n)!==Math.sign(s)&&(s=0),this.d3Scale.domain([o,s])}this.d3Axis.scale(this.d3Scale).tickFormat(this.formatter).ticks(this.tickCount()),this.d3Guides.scale(this.d3Scale).tickSize(this.tickLength_exists()?-this.tickLength():0).tickFormat("").ticks(this.tickCount());const t=this.ticks();return t.length&&(this.d3Axis.tickValues(t.map(t=>this.parse(t.value))).tickFormat((e,i)=>t[i].label),this.d3Guides.tickValues(t.map(t=>this.parse(t.value)))),this}adjustText(t,e){const n=this.isHorizontal(),o="left"===this.orientation(),s="bottom"===this.orientation(),a=this,r=t.selectAll(".tick > text").style("font-family",this.fontFamily()).style("font-size",this.fontSize_exists()?this.fontSize()+"px":null);if("linebreak"===this.overlapMode())"ordinal"===this.type()&&r.call(function(){return a.linebreak.apply(a,arguments)},this.bandwidth());else if("wrap"===this.overlapMode())"ordinal"===this.type()&&r.call(function(){return a.wrap.apply(a,arguments)},this.bandwidth());else switch(n?this.overlapMode():"none"){case"stagger":r.style("text-anchor","middle").attr("dy",function(t,i){return(s?1:-1)*((s?.71:0)+i%e)+"em"}).attr("dx",0).attr("visibility",null).attr("transform","rotate(0)");break;case"hide":r.style("text-anchor","middle").attr("dy",(s?.71:0)+"em").attr("dx",0).attr("visibility",function(t,i){return i%e?"hidden":null}).attr("transform","rotate(0)");break;case"rotate":const t=-this.labelRotation()||0;if(0!==t&&e>1){r.each(function(){const e=i.select(this),n=e.node().getBBox(),o=(s?1:-1)*Math.sin(Math.PI*(-Math.abs(t)/180));e.style("text-anchor",t>0?s?"start":"end":s?"end":"start").attr("dy",n.height/2*o+"px").attr("dx",t>0?s?"0.71em":"-0.71em":s?"-0.71em":"0.71em").attr("transform","rotate("+t+")").attr("visibility",null)});break}default:r.style("text-anchor",n?"middle":o?"end":"start").attr("dy",n?(s?.71:0)+"em":"0.32em").attr("dx",0).attr("visibility",null).attr("transform","rotate(0)")}}calcTickOverlapModulus(t){let e=1;switch(this.overlapMode()){case"rotate":case"stagger":case"hide":const i=[];t.selectAll(".tick > text").each(function(){const t=this.getBoundingClientRect();for(let n=i.length-1;n>=0&&!(i[n].right<t.left);--n)i.length+1-n>e&&(e=i.length+1-n);i.push(t)})}return e}calcOverflow(t,e){if(this.updateScale(),this.hidden())return{left:0,top:0,right:0,bottom:0,depth:0,tickOverlapModulus:1};const i=this.isHorizontal();this.range(i?[0,this.width()]:[this.height(),0]);const n=t.append("g").attr("class",this.classID()),o=n.append("g");o.attr("class",i?"x":"y").call(this.d3Axis),e&&t.selectAll(".tick > text").remove();const s={left:0,top:0,right:0,bottom:0,depth:0,tickOverlapModulus:this.calcTickOverlapModulus(o)};this.adjustText(o,s.tickOverlapModulus);const a=o.node().getBBox();switch(s.depth=i?a.height:a.width,this.shrinkToFit()){case"low":case"both":s.left=i?-a.x:0,s.bottom=i?0:-(this.height()-(a.height+a.y))}switch(this.shrinkToFit()){case"high":case"both":s.top=i?0:-a.y,s.right=i?-(this.width()-a.x-a.width):0}return n.remove(),s}wrap(t,e,n){n=n||/\s+/;const o=this;t.each(function(){const t=i.select(this),s=t.text().split(n).reverse();let a=[],r=0;const l=t.attr("x"),h=t.attr("y"),c=parseFloat(t.style("font-size"))||10,u=Math.floor(e/(1.1*c))-1,p=o.isHorizontal()?1:Math.ceil(s.length/u),d=parseFloat(t.attr("dy"));let f=t.text(null).append("tspan").attr("x",l).attr("y",h).attr("dy",d+"em"),y=0,_=s.pop();for(;_;)a.push(_),f.text(a.join(" ")),y++,f.node().getComputedTextLength()>e&&y>=p&&(a.pop(),f.text(a.join(" ")),a=[_],f=t.append("tspan").attr("x",l).attr("y",h).attr("dy",1.1*++r+d+"em").text(_),y=0),_=s.pop();o.isHorizontal()||t.selectAll("tspan").attr("y",-r/2+"em")})}linebreak(t,e){this.wrap(t,e,"\n")}update(t,e){super.update(t,e),this.svg.style("display",this.hidden()?"none":null);const i=this.calcOverflow(e),n=this.isHorizontal()?i.left:this.height()-i.top-i.bottom,o=this.isHorizontal()?this.width()-i.right-this.padding():0+this.padding();this.range(this.reverse()?[o,n]:[n,o]);const a=this;function r(t){t.attr("transform",function(){switch(a.orientation()){case"left":return"translate("+i.depth+", "+i.top+")";case"top":return"translate(0,"+i.depth+")";case"right":return"translate("+(a.width()-i.depth)+", "+i.top+")";case"bottom":return"translate(0,"+(a.height()-i.depth)+")"}return"translate(0,0)"})}s(r,"doPosition"),this.svg.style("visibility","none"===this.type()?"hidden":null).transition().call(r),this._guideElement&&this.svgGuides.transition().call(r),this.svgAxis.call(this.d3Axis),this.adjustText(this.svgAxis,i.tickOverlapModulus);this.pos().x;const l=this.width(),h=this.svgAxis.selectAll(".axisTitle").data(this.title()?[this.title()]:[]),c=h.enter().append("text").attr("class","axisTitle").merge(h).transition().attr("dx",null).style("text-anchor","end");switch(this.orientation()){case"left":c.attr("transform","rotate(-90)").attr("x",-2).attr("y",2).attr("dy",".71em");break;case"right":c.attr("transform","rotate(-90)").attr("x",-2).attr("y",4).attr("dx",null).attr("dy","-.71em");break;case"top":c.attr("transform","rotate(0)").attr("x",l-2).attr("y",2).attr("dx",null).attr("dy",".71em");break;case"bottom":c.attr("transform","rotate(0)").attr("x",l-2).attr("y",-2).attr("dy",null)}c.text(this.title_exists()?this.title():""),h.exit().remove(),this.svgGuides.call(this.d3Guides).selectAll(".tick").classed("guide-0",t=>0===t&&this.low()<0)}rerender(){this.svgAxis.call(this.d3Axis),this.svgGuides.call(this.d3Guides)}postUpdate(t,e){super.postUpdate(t,e),this._guideElement&&this._guideElement.attr("transform",this._element.attr("transform"))}};s(Tt,"Axis");let Pt=Tt;Pt.prototype._class+=" chart_Axis",Pt.prototype.publish("type","linear","set","Type",["none","ordinal","linear","pow","log","time"]),Pt.prototype.publish("timePattern","%Y-%m-%d","string","Time Series Pattern",null,{disable:s(t=>"time"!==t.type(),"disable")}),Pt.prototype.publish("reverse",!1,"boolean","Reverse"),Pt.prototype.publish("title",null,"string","Title"),Pt.prototype.publish("orientation","bottom","set","Placement/orientation of the axis",["left","top","right","bottom"]),Pt.prototype.publish("powExponent",2,"number","Power exponent (disabled when type is not 'pow')",null,{disable:s(t=>"pow"!==t.type(),"disable")}),Pt.prototype.publish("logBase",10,"number","Logarithmic base (disabled when type is not 'log')",null,{disable:s(t=>"log"!==t.type(),"disable")}),Pt.prototype.publish("ordinals",[],"array","Array of ordinal values to display (disabled when type is not 'ordinal')",null,{disable:s(t=>"ordinal"!==t.type(),"disable")}),Pt.prototype.publish("fontSize",null,"number","Size of tick label font (pixels)",null,{optional:!0}),Pt.prototype.publish("fontFamily",null,"string","Font family of tick labels",null,{optional:!0}),Pt.prototype.publish("tickCount",null,"number","Number of ticks to display (disabled when type is 'ordinal')",null,{optional:!0,disable:s(t=>"ordinal"===t.type(),"disable")}),Pt.prototype.publish("tickFormat",null,"string","Format rules for tick text (disabled when type is 'ordinal')",null,{optional:!0,disable:s(t=>"ordinal"===t.type(),"disable")}),Pt.prototype.publish("tickLength",null,"number","Height (or width for left/right orientations) of the axis ticks (in pixels)",null,{optional:!0}),Pt.prototype.publish("ticks",[],"array","Custom tick labels",null,{optional:!0}),Pt.prototype.publish("low",null,"any","Minimum tick value (disabled when type is ordinal)",null,{optional:!0,disable:s(t=>"ordinal"===t.type(),"disable")}),Pt.prototype.publish("high",null,"any","Maximum tick value (disabled when type is ordinal)",null,{optional:!0,disable:s(t=>"ordinal"===t.type(),"disable")}),Pt.prototype.publish("overlapMode","none","set","Specifies the behavior when tick labels overlap",["none","stagger","hide","rotate","linebreak","wrap"]),Pt.prototype.publish("labelRotation",33,"number","Angle of rotation for tick labels (disabled when overlapMode is not 'rotate')",null,{optional:!0,disable:s(t=>"rotate"!==t.overlapMode(),"disable")}),Pt.prototype.publish("shrinkToFit","both","set","shrinkToFit",["none","low","high","both"]),Pt.prototype.publish("extend",5,"number","Extend the axis range by this % beyond what is needed to display the data (disabled when type is 'ordinal')",null,{optional:!0,disable:s(t=>"ordinal"===t.type(),"disable")}),Pt.prototype.publish("hidden",!1,"boolean","Hides axis when 'true'"),Pt.prototype.publish("ordinalPaddingInner",.1,"number","Determines the ratio of the range that is reserved for blank space between band (0->1)",null,{disable:s(t=>"ordinal"!==t.type(),"disable")}),Pt.prototype.publish("ordinalPaddingOuter",.1,"number","Determines the ratio of the range that is reserved for blank space before the first band and after the last band (0->1)",null,{disable:s(t=>"ordinal"!==t.type(),"disable")}),Pt.prototype.publish("ordinalMappings",null,"object","Alternative label mappings (icons)",null,{optional:!0}),Pt.prototype.publish("padding",0,"number","Padding space at top of axis (pixels)",null,{optional:!0}),Pt.prototype._origType=Pt.prototype.type,Pt.prototype.type=function(t){const e=Pt.prototype._origType.apply(this,arguments);return void 0!==t&&(this._type=t,this.updateScale()),e},Pt.prototype._origTimePattern=Pt.prototype.timePattern,Pt.prototype.timePattern=function(t){const e=Pt.prototype._origTimePattern.apply(this,arguments);return void 0!==t&&(this._timePattern=t,this.updateScale()),e};const Ct=class _XYAxis extends i.SVGWidget{domainAxis;valueAxis;xAxis;yAxis;xyBrush;xBrush;yBrush;margin;focusChart;constructor(){super(),i.Utility.SimpleSelectionMixin.call(this),this._drawStartPos="origin",this.domainAxis=(new Pt).classed({domain:!0}).orientation_default("bottom").type("ordinal").overlapMode_default("stagger").shrinkToFit_default("high").extend_default(0),this.valueAxis=(new Pt).classed({value:!0}).orientation_default("left").type("linear").shrinkToFit_default("high"),this.xyBrush=i.brush().on("end",()=>this.brushMoved()).on("start.handle brush.handle end.handle",()=>this.brushMoved2()),this.xBrush=i.brushX().on("end",()=>this.brushMoved()).on("start.handle brush.handle end.handle",()=>this.brushMoved2()),this.yBrush=i.brushY().on("end",()=>this.brushMoved()).on("start.handle brush.handle end.handle",()=>this.brushMoved2())}_prevBrush;resetSelection(){return this._prevBrush=null,this}parseData(t){return this.domainAxis.parse(t)}parseValue(t){return this.valueAxis.parse(t,!0)}formatData(t){return this.domainAxis.format(t)}formatValue(t){return this.valueAxis.format(t)}parsedData(){return this.data().map(function(t){let e=0;return t.map(function(t,i){if(0===i)return this.parseData(t);if(i>=this.columns().length)return t;const n=this.yAxisStacked()?[e,e+this.parseValue(t)]:this.parseValue(t);return e+=this.parseValue(t),n},this)},this)}bandwidth(){return this.domainAxis.bandwidth()}svg;svgRegions;svgDomainGuide;svgValueGuide;svgData;svgDataClipRect;svgFocus;svgBrush;enter(t,e){super.enter(t,e),this.svg=e.append("g"),this.svgRegions=e.append("g"),this.svgDomainGuide=this.svg.append("g"),this.svgValueGuide=this.svg.append("g"),this.svgData=this.svg.append("g"),this.svgDataClipRect=this.svg.append("clipPath").attr("id",this.id()+"_clippath").append("rect").attr("x",0).attr("y",0),this.svgData=this.svg.append("g").attr("clip-path","url(#"+this.id()+"_clippath)"),this._selection.widgetElement(this.svgData),this.svgFocus=e.append("g"),this.domainAxis.target(this.svg.node()).guideTarget(this.svgDomainGuide.node()),this.valueAxis.target(this.svg.node()).guideTarget(this.svgValueGuide.node()),this.svgBrush=e.append("g").attr("class","brush"),this.chartsEnter(this,this.svgData,250)}resizeBrushHandle(t,e,i){let n,o,s;return"e"===t.type||"w"===t.type?(n=+("e"===t.type),o=n?1:-1,s=i/3,"M"+.5*o+","+s+"A6,6 0 0 "+n+" "+6.5*o+","+(s+6)+"V"+(2*s-6)+"A6,6 0 0 "+n+" "+.5*o+","+2*s+"ZM"+2.5*o+","+(s+8)+"V"+(2*s-8)+"M"+4.5*o+","+(s+8)+"V"+(2*s-8)):(n=+("s"===t.type),s=n?1:-1,o=e/3,"M"+o+", "+.5*s+"A6,6 0 0 "+(n+1)%2+" "+(o+6)+","+6.5*s+"H"+(2*o-6)+"A6,6 0 0 "+(n+1)%2+" "+2*o+","+.5*s+"ZM"+(o+8)+","+2.5*s+"H"+(2*o-8)+"M"+(o+8)+","+4.5*s+"H"+(2*o-8))}_skipSelection=!1;skipSelection(t){return arguments.length?(this._skipSelection=t,this):this._skipSelection}brushMoved(){if(this._skipSelection)return;let t=[];const e=this,n=i.brushSelection(this.svgBrush.node());n&&(t=this.data().filter(function(t){const i=e.dataPos(t[0]);if(e.use2dSelection()){const o=e.valuePos(t[1])+e.valueAxis.bandwidth()/2;return i>=n[0][0]&&i<=n[1][0]&&o>=n[0][1]&&o<=n[1][1]}return i>=n[0]&&i<=n[1]})),this.selection(t)}brushMoved2(){const t="horizontal"===this.orientation(),e=this.use2dSelection()?[]:t?[{type:"w"},{type:"e"}]:[{type:"n"},{type:"s"}],n=this.svgBrush.selectAll(".handle--custom").data(e),o=i.d3Event()?.selection;null==o?n.attr("display","none"):t?n.attr("display",null).attr("transform",(t,e)=>"translate("+o[e]+",0)"):n.attr("display",null).attr("transform",(t,e)=>"translate(0, "+o[e]+")")}dataPos(t){return this.domainAxis.scalePos(t)}valuePos(t){return this.valueAxis.scalePos(t)}getAxisSize(t){return{width:this.xAxis?this.xAxis.width():t.xAxis.width(),height:this.yAxis?this.yAxis.height():t.yAxis.width()}}calcMargin(t,e,i){const n={top:!i&&this.selectionMode()?10:2,right:i&&(this.selectionMode()||this.xAxisFocus())?10:2,bottom:(this.xAxisFocus()?this.xAxisFocusHeight():0)+2,left:2},o=this.width()-n.left-n.right,s=this.height()-n.top-n.bottom;let a=0,r=30,l=0,h=30;for(let c=0;c<10;++c){this.xAxis.width(o-h).height(0);const t=this.xAxis.calcOverflow(e),i=t.depth;this.yAxis.width(0).height(s-r);const n=this.yAxis.calcOverflow(e),c=n.depth;if(a=t.right,l=n.top,i===r&&c===h)break;r=i,h=c}return this.xAxis.x(o/2+h/2+n.left).y(s+n.top).width(o-h),this.yAxis.x(n.left).y(s/2-r/2+n.top).height(s-r),n.left+=h,n.top+=l,n.right+=a,n.bottom+=r,n}updateRegions(t,e,n){const o=this,s=this.svgRegions.selectAll(".region").data(this.regions());s.enter().append("rect").attr("class","region"),n?s.attr("x",function(t){return o.dataPos(t.x0)}).attr("y",0).attr("width",function(t){return o.dataPos(t.x1)-o.dataPos(t.x0)}).attr("height",this.height()).style("stroke",function(t){return o._palette(t.colorID)}).style("fill",function(t){return i.hsl(o._palette(t.colorID)).brighter()}):s.attr("x",0).attr("y",function(t){return o.dataPos(t.x0)}).attr("width",this.width()).attr("height",function(t){return o.dataPos(t.x0)-o.dataPos(t.x1)}).style("stroke",function(t){return o._palette(t.colorID)}).style("fill",function(t){return i.hsl(o._palette(t.colorID)).brighter()}),s.exit().remove()}_prevXAxisType;update(t,e){super.update(t,e);const n=this,o="horizontal"===this.orientation();if(this.updateRegions(t,e,o),this.domainAxis.orientation(o?"bottom":"left").title(this.xAxisTitle_exists()?this.xAxisTitle():this.columns()[0]),this.valueAxis.orientation(o?"left":"bottom"),this.xAxis=o?this.domainAxis:this.valueAxis,this.yAxis=o?this.valueAxis:this.domainAxis,"ordinal"===this.xAxisType()){const t=this.columns().length,e={};this.domainAxis.ordinals(this.data().map(function(i){return e[i[0]]=n.xAxisOrdinalMapping(i,i[t]),i[0]})).ordinalMappings(e)}else{const t=this.xAxisDomainLow()?this.xAxisDomainLow():this.domainAxis.parseInvert(i.min(this.parsedData(),function(t){return t[0]})),e=this.xAxisDomainHigh()?this.xAxisDomainHigh():this.domainAxis.parseInvert(i.max(this.parsedData(),function(t){return t[0]}));void 0!==t&&void 0!==e&&this.domainAxis.low(t).high(e)}const s=this.yAxisDomainLow()?this.yAxisDomainLow():this.valueAxis.parseInvert(i.min(this.parsedData(),function(t){return i.min(t.filter(function(t,e){return e>0&&n.columns()[e]&&0!==n.columns()[e].indexOf("__")&&null!==t}),function(t){return t instanceof Array?t[0]:t})})),a=this.yAxisDomainHigh()?this.yAxisDomainHigh():this.valueAxis.parseInvert(i.max(this.parsedData(),function(t){return i.max(t.filter(function(t,e){return e>0&&n.columns()[e]&&0!==n.columns()[e].indexOf("__")&&null!==t}),function(t){return t instanceof Array?t[1]:t})}));this.valueAxis.low(s).high(a),this.margin=this.calcMargin(t,e,o);let r=this.width()-this.margin.left-this.margin.right;r<0&&(r=0);let l=this.height()-this.margin.top-this.margin.bottom;l<0&&(l=0);const h=o?r:l,c=o?l:r;if(this.domainAxis.tickLength(this.xAxisGuideLines()?c:0).render(),this.valueAxis.tickLength(this.yAxisGuideLines()?h:0).render(),this.svgDataClipRect.attr("width",r).attr("height",l),this.svgData.transition().attr("transform","translate("+this.margin.left+","+this.margin.top+")"),this.updateBrush(r,l,h,o),this.updateFocusChart(t,e,this.margin,r,l,o),this.chartsUpdate(r,l,250),this.selectionMode())return this.brushMoved()}updateBrush(t,e,n,o){const s=this.use2dSelection()?this.xyBrush:o?this.xBrush:this.yBrush,a=i.brushSelection(this.svgBrush.node());s.extent([[0,0],[t,e]]),this.svgBrush.attr("transform","translate("+this.margin.left+", "+this.margin.top+")").style("display",this.selectionMode()?null:"none").call(s);const r=this.use2dSelection()?[]:o?[{type:"w"},{type:"e"}]:[{type:"n"},{type:"s"}],l=this.svgBrush.selectAll(".handle--custom").data(r);if(l.enter().append("path").attr("class","handle--custom").merge(l).attr("cursor",o?"ew-resize":"ns-resize").attr("d",i=>this.resizeBrushHandle(i,t,e)),this.selectionMode()){if(this._prevXAxisType!==this.xAxisType()&&(this._prevXAxisType=this.xAxisType(),this._prevBrush=null),this._prevBrush){if(a){if(this._prevBrush.orientation!==this.orientation()){const t=a[0];a[0]=this._prevBrush.maxCurrExtent-a[1],a[1]=this._prevBrush.maxCurrExtent-t}const t=n/this._prevBrush.maxCurrExtent;1!==t&&this.svgBrush.transition().on("start",function(){s.on("end",null)}).call(s.move,[a[0]*t,a[1]*t]).on("end",()=>{s.on("end",()=>this.brushMoved())})}}else this.svgBrush.call(s.move,[0,n]);this._prevBrush={orientation:this.orientation(),maxCurrExtent:n}}}updateFocusChart(t,e,i,n,o,s){const a=this,r=this.svgFocus.selectAll("#"+this.id()+"_focusChart").data(this.xAxisFocus()?[!0]:[]);r.enter().append("g").attr("id",this.id()+"_focusChart").attr("class","focus").each(function(){a.focusChart=(new a.constructor).target(this),a.focusChart.xBrush.on("brush.focus",function(){a.syncAxis(n),a.chartsUpdate(n,o,0)}),a.focusChart.layers(a.layers().map(t=>new t.constructor))}).merge(r).each(function(){a.copyPropsTo(a.focusChart,["layers"]);let t=0;for(const e of a.layers())e.copyPropsTo(a.focusChart.layers()[t]),t++;a.focusChart.xAxisFocus(!1).selectionMode(!0).skipSelection(!0).orientation("horizontal").xAxisGuideLines(!1).xAxisDomainLow(null).xAxisDomainHigh(null).yAxisGuideLines(!1).x(a.width()/2).y(a.height()-a.xAxisFocusHeight()/2).width(a.width()).height(a.xAxisFocusHeight()).columns(a.columns()).data(a.data()).render(),a.syncAxis(n)}),r.exit().each(function(){a.focusChart&&(a.focusChart.target(null),delete a.focusChart)}).remove()}syncAxis(t){const e=i.brushSelection(this.focusChart.svgBrush.node());if(e){if("ordinal"!==this.focusChart.xAxisType())this.xAxis.domain([this.focusChart.xAxis.invert(e[0]),this.focusChart.xAxis.invert(e[1])]);else{const i=(e[1]-e[0])/t;this.xAxis.range([-e[0]/i,(t-e[0])/i])}this.xAxis.rerender()}}layerColumns(t){const e=t.columns(),i=super.columns().filter(t=>t!==e[0]);return i.length?[e[0],...i]:e}layerColumnIndices(t){const e=t.columns();return this.layerColumns(t).map(t=>e.indexOf(t))}layerColumnIndex(t,e){return t.columns().indexOf(e)}layerData(t){if(1===arguments.length){const e=this.layerColumnIndices(t);return t.data().map(t=>{const i=e.map(e=>t[e]);return i.__hpcc_origRow=t,i})}throw new Error("Setting data on XYAxisLayer is not supported.")}layerEnter(t,e,i=250){}layerUpdate(t,e,i=250){}layerExit(t,e,i=250){}chartsEnter(t,e,i=250){this.layerEnter(this,e,i);for(const n of this.layers())n.__xyAxisElement=e.append("g").attr("class",n.class()),n.target(n.__xyAxisElement.node()).layerEnter(this,e,i)}chartsUpdate(t,e,i){this.layerUpdate(this,this.svgData,i);for(const n of this.layers())n.resize({width:t,height:e}).layerUpdate(this,n.__xyAxisElement,i)}exit(t,e){this.valueAxis.target(null),this.domainAxis.target(null),super.exit(t,e)}selection(t){const e=this;this._selection.widgetElement().selectAll(".selected,.deselected").each(function(n){const o=t.indexOf(n.origRow)>=0;i.select(this).classed("selected",o).classed("deselected",!o).attr("filter",e._selection.svgGlowID()&&o?`url(#${e._selection.svgGlowID()})`:null)});const n=t.map(t=>this.rowToObj(t));setTimeout(()=>{this.click(n,"",!0)},0)}xAxisOrdinalMapping(t,e){return t[0]}click(t,e,i){}_selection};s(Ct,"XYAxis");let It=Ct;It.prototype._class+=" chart_XYAxis",It.prototype.mixin(i.Utility.SimpleSelectionMixin),It.prototype.publish("orientation","horizontal","set","Selects orientation for the axis",["horizontal","vertical"]),It.prototype.publish("pointSizeColumn",null,"string","pointSizeColumn",null,{optional:!0}),It.prototype.publish("minPointSize",6,"number","minPointSize"),It.prototype.publish("maxPointSize",26,"number","maxPointSize"),It.prototype.publish("use2dSelection",!1,"boolean","2D Range Selector"),It.prototype.publish("selectionMode",!1,"boolean","Range Selector"),It.prototype.publishProxy("xAxisTitle","domainAxis","title"),It.prototype.publishProxy("xAxisTickCount","domainAxis","tickCount"),It.prototype.publishProxy("xAxisTickFormat","domainAxis","tickFormat"),It.prototype.publishProxy("xAxisTicks","domainAxis","ticks"),It.prototype.publishProxy("xAxisType","domainAxis","type"),It.prototype.publishProxy("xAxisTypeTimePattern","domainAxis","timePattern"),It.prototype.publish("xAxisDomainLow",null,"string","X-Axis Low",null,{optional:!0,disable:s(t=>"ordinal"===t.xAxisType(),"disable")}),It.prototype.publish("xAxisDomainHigh",null,"string","X-Axis High",null,{optional:!0,disable:s(t=>"ordinal"===t.xAxisType(),"disable")}),It.prototype.publishProxy("xAxisFontSize","domainAxis","fontSize"),It.prototype.publishProxy("xAxisFontFamily","domainAxis","fontFamily"),It.prototype.publishProxy("xAxisOrdinalPaddingInner","domainAxis","ordinalPaddingInner"),It.prototype.publishProxy("xAxisOrdinalPaddingOuter","domainAxis","ordinalPaddingOuter"),It.prototype.publishProxy("xAxisOverlapMode","domainAxis","overlapMode"),It.prototype.publishProxy("xAxisLabelRotation","domainAxis","labelRotation"),It.prototype.publishProxy("xAxisDomainPadding","domainAxis","extend"),It.prototype.publish("xAxisGuideLines",!1,"boolean","Y-Axis Guide Lines"),It.prototype.publish("xAxisFocus",!1,"boolean","X-Axis Focus",null,{disable:s(t=>"horizontal"!==t.orientation(),"disable")}),It.prototype.publish("xAxisFocusHeight",80,"number","X-Axis Focus Height",null,{disable:s(t=>!t.xAxisFocus(),"disable")}),It.prototype.publishProxy("xAxisHidden","domainAxis","hidden"),It.prototype.publishProxy("yAxisFontSize","valueAxis","fontSize"),It.prototype.publishProxy("yAxisFontFamily","valueAxis","fontFamily"),It.prototype.publishProxy("yAxisTitle","valueAxis","title"),It.prototype.publishProxy("yAxisTickCount","valueAxis","tickCount"),It.prototype.publishProxy("yAxisTickFormat","valueAxis","tickFormat"),It.prototype.publishProxy("yAxisTicks","valueAxis","ticks"),It.prototype.publishProxy("yAxisType","valueAxis","type"),It.prototype.publishProxy("yAxisTypeTimePattern","valueAxis","timePattern"),It.prototype.publishProxy("yAxisTypePowExponent","valueAxis","powExponent"),It.prototype.publishProxy("yAxisTypeLogBase","valueAxis","logBase"),It.prototype.publish("yAxisStacked",!1,"boolean","Stacked Chart",null,{tags:["Basic"],disable:s(t=>"ordinal"!==t.xAxisType()||t._class.indexOf("chart_Column")<0,"disable")}),It.prototype.publish("yAxisDomainLow",null,"string","Y-Axis Low",null,{optional:!0,disable:s(t=>"ordinal"===t.yAxisType(),"disable")}),It.prototype.publish("yAxisDomainHigh",null,"string","Y-Axis High",null,{optional:!0,disable:s(t=>"ordinal"===t.yAxisType(),"disable")}),It.prototype.publishProxy("yAxisDomainPadding","valueAxis","extend"),It.prototype.publish("yAxisGuideLines",!0,"boolean","Y-Axis Guide Lines"),It.prototype.publishProxy("yAxisHidden","valueAxis","hidden"),It.prototype.publish("regions",[],"array","Regions"),It.prototype.publish("layers",[],"widgetArray","Layers",null,{render:!1}),It.prototype.publishProxy("xAxisPadding","domainAxis","padding"),It.prototype.publishProxy("yAxisPadding","valueAxis","padding");const zt=class _Scatter extends It{constructor(){super(),e.INDChart.call(this),e.ITooltip.call(this),this.xAxisGuideLines_default(!0).yAxisGuideLines_default(!0)}xPos(t,e){return"horizontal"===t.orientation()?t.dataPos(e.label):t.valuePos(e.value)}yPos(t,e){return"horizontal"===t.orientation()?t.valuePos(e.value):t.dataPos(e.label)}curve(){switch(this.interpolate()){case"linear":return R;case"step":return ut;case"step-before":return pt;case"step-after":return dt;case"basis":return G;case"bundle":return Y;case"cardinal":return Z;case"catmullRom":return tt;case"natural":return ht;default:return at}}getScale(){switch(this.pointSizeScale()){case"linear":return i.scaleLinear();case"pow":return i.scalePow().exponent(2);case"log":return i.scaleLog();case"sqrt":return i.scaleSqrt()}}pointColor(t,e,i,n){return this.interpolate()&&this.pointDarken()?this.strokeColor(t,e,i,n):this.fillColor(t,e,i,n)}lineColor(t,e,i,n){return this.interpolateFill()&&this.interpolateDarken()?this.strokeColor(t,e,i,n):this.fillColor(t,e,i,n)}areaColor(t,e,i,n){return this.fillColor(t,e,i,n)}layerEnter(t,e,i=250){super.layerEnter(t,e,i);const n=this;this.tooltipHTML(function(t){return"series-table"===n.tooltipStyle()?n.tooltipFormat({label:t.label,arr:n.columns().slice(1).map(function(e,i){return{label:e,color:n._palette(e),value:n.data()[t.rowIdx][i+1]}})}):n.tooltipFormat({label:t.label,series:t.column,value:t.value})})}_prevPointShape;layerUpdate(t,e,n=250){super.layerUpdate(t,e);const o="horizontal"===t.orientation(),a=o?this.height():this.width(),r=this;function l(t){switch(t){case"rectangle":return"rect";case"circle":return"circle";case"cross":return"path"}}this._palette=this._palette.switch(this.paletteID()),this.useClonedPalette()&&(this._palette=this._palette.cloneNotExists(this.paletteID()+"_"+this.id())),this._prevPointShape!==this.pointShape()&&(e.selectAll(".data").remove(),this._prevPointShape=this.pointShape()),s(l,"mapShape");let h,c,u;this.pointSizeColumn_exists()&&(h=this.columns().indexOf(this.pointSizeColumn()),c=i.extent(this.data(),t=>t[h]),u=this.getScale().domain(c));const p=this.layerColumns(t),d=this.layerData(t),f=this.flattenData(p,d).map(function(t){return t.shape=l(r.pointShape()),t.column=p[t.colIdx],t.row=d[t.rowIdx],t.origRow=d[t.rowIdx].__hpcc_origRow,c?(t.size=u(t.row[h])*(r.maxPointSize()-r.minPointSize())+r.minPointSize(),t.column!==r.pointSizeColumn()&&t):(t.size=r.pointSize(),t)}).filter(t=>t),y=e.selectAll(".area").data(p.filter(function(t,e){return r.interpolate()&&r.interpolateFill()&&e>0})),_=y.enter().append("path"),x=B().curve(this.curve());o?x.x(function(e){return r.xPos(t,e)}).y0(Math.min(a,this.yPos(t,{value:0}))).y1(function(e){return r.yPos(t,e)}):x.y(function(e){return r.yPos(t,e)}).x0(Math.max(0,this.xPos(t,{value:0}))).x1(function(e){return r.xPos(t,e)}),_.merge(y).attr("class",t=>"area series series-"+this.cssTag(t)).each(function(t,e){i.select(this).attr("d",x(f.filter(function(t){return t.colIdx===e+1}))).style("opacity",r.interpolateFillOpacity()).style("stroke","none").style("fill",r.areaColor([],t,void 0,[]))}),y.exit().remove();const m=e.selectAll(".line").data(p.filter(function(t,e){return r.interpolate()&&e>0})),g=m.enter().append("path"),b=L().x(function(e){return r.xPos(t,e)}).y(function(e){return r.yPos(t,e)}).curve(this.curve());g.merge(m).attr("class",t=>"line series series-"+this.cssTag(t)).each(function(t,e){const n=i.select(this),o=f.filter(function(t){return t.colIdx===e+1});n.attr("d",b(o)).style("stroke",r.lineColor([],t,void 0,[])).style("fill","none")}),m.exit().remove();const v=e.selectAll(".point").data(f,function(t,e){return t.shape+"_"+e});v.enter().append("g").each(function(e){const n=i.select(this);n.append(e.shape).attr("class","pointShape"),n.append("text").attr("class","pointValue").style("display","none").attr("text-anchor",r.valueAnchor()).attr("alignment-baseline",r.valueBaseline()).attr("fill",function(t,e){return"middle"===r.valueBaseline()||"central"===r.valueBaseline()?r.textColor(t.row,t.column,t.value,t.origRow):null}),n.append("circle").attr("class","pointSelection").on("mouseout.tooltip",r.tooltip.hide).on("mousemove.tooltip",r.tooltip.show).call(t._selection.enter.bind(t._selection)).on("click",function(e,i){r.click(t.rowToObj(t.data()[e.rowIdx]),e.column,t._selection.selected(this))}).on("dblclick",function(e,i){r.dblclick(t.rowToObj(t.data()[e.rowIdx]),e.column,t._selection.selected(this))})}).merge(v).attr("class",t=>"point series series-"+this.cssTag(t.column)).each(function(e){i.select(this).select(".pointValue").attr("x",function(e){return r.xPos(t,e)}).attr("y",function(e){return r.yPos(t,e)}).style("display",r.showValue()?"block":"none").attr("text-anchor",r.valueAnchor()).attr("alignment-baseline",r.valueBaseline()).text(function(t){return t.value});i.select(this).select(".pointSelection").attr("cx",function(e){return r.xPos(t,e)}).attr("cy",function(e){return r.yPos(t,e)}).attr("r",e.size);const n=i.select(this).select(".pointShape");switch(e.shape){case"rect":n.attr("x",function(i){return r.xPos(t,i)-e.size/2}).attr("y",function(i){return r.yPos(t,i)-e.size/2}).attr("width",e.size).attr("height",e.size).style("fill",r.pointColor(e.row,e.column,e.value,e.origRow));break;case"circle":n.attr("cx",function(e){return r.xPos(t,e)}).attr("cy",function(e){return r.yPos(t,e)}).attr("r",.9*e.size).style("fill",r.pointColor(e.row,e.column,e.value,e.origRow));break;case"path":n.attr("d",function(i){return"M"+(r.xPos(t,i)-e.size/2)+" "+(r.yPos(t,i)-e.size/2)+" L"+(r.xPos(t,i)+e.size/2)+" "+(r.yPos(t,i)+e.size/2)+" M"+(r.xPos(t,i)-e.size/2)+" "+(r.yPos(t,i)+e.size/2)+" L"+(r.xPos(t,i)+e.size/2)+" "+(r.yPos(t,i)-e.size/2)}).style("stroke",r.pointColor(e.row,e.column,e.value,e.origRow))}}),v.exit().remove()}exit(t,e){super.exit(t,e)}};s(zt,"Scatter"),a(zt,"__inputs",[{id:"label",type:"any"},{id:"values",type:"number",multi:!0}]);let Ft=zt;Ft.prototype._class+=" chart_Scatter",Ft.prototype.implements(e.INDChart.prototype),Ft.prototype.implements(e.ITooltip.prototype),Ft.prototype.publish("paletteID","default","set","Color palette for this widget",Ft.prototype._palette.switch(),{tags:["Basic","Shared"]}),Ft.prototype.publish("pointSizeScale","linear","set","pointSizeScale",["linear","pow","log","sqrt"]),Ft.prototype.publish("pointShape","cross","set","Shape of the data points",["circle","rectangle","cross"]),Ft.prototype.publish("pointSize",6,"number","Point Size",null,{range:{min:1,step:1,max:200}}),Ft.prototype.publish("interpolate","","set","Interpolate Data",["","linear","step","step-before","step-after","basis","bundle","cardinal","catmullRom","natural","monotone"]),Ft.prototype.publish("pointDarken",!0,"boolean","If true, and interpolate is set, then points will have a slightly darker color than their assigned palette color",null,{disable:s(t=>!t.interpolate(),"disable")}),Ft.prototype.publish("interpolateDarken",!0,"boolean","If true, and interpolateFill is true, then lines will have a slightly darker color than their assigned palette color",null,{disable:s(t=>!t.interpolateFill(),"disable")}),Ft.prototype.publish("interpolateFill",!1,"boolean","If true, the area between the line and zero will be filled"),Ft.prototype.publish("interpolateFillOpacity",.66,"number","Fill interpolation Opacity",null,{range:{min:0,step:.01,max:1}}),Ft.prototype.publish("useClonedPalette",!1,"boolean","Enable or disable using a cloned palette",null,{tags:["Intermediate","Shared"]}),Ft.prototype.publish("showValue",!1,"boolean"),Ft.prototype.publish("valueAnchor","middle","set","text-anchor for shown value text",["start","middle","end"]),Ft.prototype.publish("valueBaseline","ideographic","set","alignment-baseline for shown value text",["auto","baseline","before-edge","text-before-edge","middle","central","after-edge","text-after-edge","ideographic","alphabetic","hanging","mathematical","inherit"]);const Dt=class _Area extends Ft{constructor(){super(),this.interpolate_default("linear").interpolateFill_default(!0)}};s(Dt,"Area");let Et=Dt;Et.prototype._class+=" chart_Area";const Ot=class _Column extends It{_linearGap;textLocal=i.local();stackedTextLocal=i.local();isHorizontal;constructor(){super(),e.INDChart.call(this),e.ITooltip.call(this),this._selection.skipBringToTop(!0),this._linearGap=25}layerEnter(t,e,i=250){super.layerEnter(t,e,i);const n=this;this.tooltipHTML(function(e){if("series-table"===n.tooltipStyle())return n.tooltipFormat({label:e.row[0],arr:n.columns().slice(1).map(function(t,i){return{label:t,color:n._palette(t),value:e.row[i+1]}})});{let i=e.row[e.idx];return i instanceof Array&&(i=i[1]-i[0]),n.tooltipFormat({label:e.row[0],series:n.layerColumns(t)[e.idx],value:i})}})}adjustedData(t){return this.layerData(t).map(e=>{let i=0;return e.map((e,n)=>{if(0===n)return e;if(n>=this.layerColumns(t).length)return e;const o=t.yAxisStacked()?[i,i+e]:e;return i+=e,o},this)},this)}layerUpdate(t,e,n=250){super.layerUpdate(t,e,n);const o="horizontal"===t.orientation();this.isHorizontal=o;const s=this;this._palette=this._palette.switch(this.paletteID()),this.useClonedPalette()&&(this._palette=this._palette.cloneNotExists(this.paletteID()+"_"+this.id()));const a=i.format(s.showValueAsPercentFormat());let r=10,l=0;switch(t.xAxisType()){case"ordinal":r=t.bandwidth(),l=-r/2;break;case"linear":case"time":r=Math.max(Math.abs(t.dataPos(2)-t.dataPos(1))*(100-this._linearGap)/100,r),l=-r/2}this.tooltip.direction(o?"n":"e");const h=i.scaleBand().domain(s.layerColumns(t).filter(function(t,e){return e>0})).rangeRound(o?[0,r]:[r,0]).paddingInner(this.xAxisSeriesPaddingInner()).paddingOuter(0);let c=[];const u=[],p=this.columns().length,d=this.data();this.showValue()&&"series"===this.showValueAsPercent()&&d.forEach(t=>{t.filter((t,e)=>e>0&&e<p).forEach((t,e)=>{void 0===u[e+1]&&(u[e+1]=0),u[e+1]+=t})}),(this.showDomainTotal()||this.showValue()&&"domain"===this.showValueAsPercent())&&(c=d.map(t=>t.filter((t,e)=>e>0&&e<p).reduce((t,e)=>t+e,0)));const f=e.selectAll(".dataRow").data(this.adjustedData(t)),y=t.data(),_=this.getAxisSize(t);f.enter().append("g").attr("class","dataRow").merge(f).each(function(e,d){const f=i.select(this),x=f.selectAll(".dataCell").data(e.filter(function(e,i){return i<s.layerColumns(t).length}).map(function(i,n){return{column:s.layerColumns(t)[n],row:e,origRow:y[d],value:i,idx:n}}).filter(function(t){return null!==t.value&&t.idx>0}),t=>t.column),m=x.enter().append("g").attr("class","dataCell").on("mouseout.tooltip",function(t){(!s.tooltipInnerTextEllipsedOnly()||t.innerTextObj&&t.innerTextObj.isTruncated)&&s.tooltip.hide.apply(s,arguments)}).on("mousemove.tooltip",function(t){(!s.tooltipInnerTextEllipsedOnly()||t.innerTextObj&&t.innerTextObj.isTruncated)&&s.tooltip.show.apply(s,arguments)}).call(t._selection.enter.bind(t._selection)).on("click",function(e){s.click(t.rowToObj(e.origRow),e.column,t._selection.selected(this))}).on("dblclick",function(e){s.dblclick(t.rowToObj(e.origRow),e.column,t._selection.selected(this))}).style("opacity",0).each(function(t){const e=i.select(this);e.append("rect").attr("class","columnRect series series-"+s.cssTag(t.column)),e.append("text").attr("class","columnRectText").style("stroke","transparent")});m.transition().duration(n).style("opacity",1);const g=t.yAxisStacked()?r:h.bandwidth();m.merge(x).each(function(r){const f=i.select(this),y=t.dataPos(e[0])+(t.yAxisStacked()?0:h(r.column))+l,x=r.value instanceof Array?r.value[1]:r.value;let m=r.origRow[r.idx];if(s.showValue()){const t=s.dataMeta();switch(s.showValueAsPercent()){case"series":const e=void 0!==t.sum?t.sum:u[r.idx];m=a(m/e);break;case"domain":const n=void 0!==t.sum?t.sum:c[d];m=a(m/n);break;default:m=i.format(s.showValueFormat())(m)}}const b=t.valuePos(x),v=t.valuePos(r.value instanceof Array?r.value[0]:0),w=Math.min(v,b),S=Math.abs(b-v),A=s.innerTextFontSize(),k=s.innerTextPadding_exists()?s.innerTextPadding():A/2.5,M=s.intersectRectRect({x:o?y:w,y:o?w:y,width:o?g:S,height:o?S:g},{x:0,y:0,width:_.width,height:_.height}),T=f.select("rect").transition().duration(n).style("fill",t=>s.fillColor(t.row,t.column,t.value,t.origRow));o?T.attr("x",y).attr("y",w).attr("width",g).attr("height",S):T.attr("y",y).attr("x",w).attr("height",g).attr("width",S);const P=f.select("text").transition().duration(n).style("font-size",A+"px").style("fill",t=>s.textColor(t.row,t.column,t.value,t.origRow));P.style("font-family",s.innerTextFontFamily_exists()?s.innerTextFontFamily():null);const C=s.innerTextPadding_exists()?s.innerTextPadding():8,I=A/2.7;if(o){const t=M.y+M.height-k;P.attr("x",y+g/2).attr("y",t+I).attr("transform",`rotate(-90, ${y+g/2}, ${t})`)}else P.attr("x",M.x+C).attr("y",y+g/2+I);P.attr("height",g).attr("width",S),s.showInnerText()&&P.text(t=>{const e=s.innerText(t.origRow,t.origRow[p],t.idx);if(e){const i=o?M.height:M.width,n=s.calcInnerText(i,e,m);return t.innerTextObj=n,n.text}return""});const z=f.selectAll(".dataText").data(s.showValue()?[`${x}`]:[]);z.enter().append("g").attr("class","dataText").each(function(t){s.textLocal.set(this,(new i.Text).target(this).colorStroke_default("transparent"))}).merge(z).each(function(){const t={x:0,y:0},e=s.valueFontFamily(),i=s.valueFontSize(),n=s.textSize(m,e,i),a=parseFloat(m)>=0;let l=s.valueAnchor()?s.valueAnchor():o?"middle":"start";const h=M.x,c=_.width-(M.x+M.width),u=M.y,p=_.height-(M.y+M.height);let d,f,x;if(r.innerTextObj){const{padding:e,valueTextWidth:n}=r.innerTextObj;f=!1,o?(l="middle",t.x=y+g/2,4===r.innerTextObj.category?(f=!0,t.y=w-e-i/2):t.y=w+e+i/2):(l="start",4===r.innerTextObj.category?(f=!0,t.x=S+w+e):t.x=S+w-n-e,t.y=y+g/2)}else o?(d=M.height<n.height,f=!s.valueCentered()||d,t.x=M.x+M.width/2,f?a?(x=u<n.height+C,x?d?t.y=M.y+M.height+n.height:(f=!1,t.y=M.y+M.height/2):t.y=M.y-n.height/2-C):(x=p<n.height,x?d?t.y=M.y-n.height/2-C:(f=!1,t.y=M.y+M.height/2):t.y=M.y+n.height+C):t.y=M.y+M.height/2):(d=M.width<n.width,f=!s.valueCentered()||d,t.y=M.y+M.height/2,f?a?(x=c<n.width+C,x?s.showInnerText()||!d?(f=!1,t.x=M.x+M.width/2):t.x=M.x-(n.width-C):t.x=M.x+M.width+n.width/2+C):(x=h<n.width,x?s.showInnerText()||!d?(f=!1,t.x=M.x+M.width/2):t.x=M.x+M.width+(n.width-C):t.x=M.x-(n.width-C)):t.x=M.x+M.width/2);const b=f?null:s.textColor(r.row,r.column,r.value,r.origRow),v=s.columns(),A=s.yAxisStacked()&&d||f&&s.yAxisStacked()&&v.indexOf(r.column)!==v.length-1;s.textLocal.get(this).pos(t).anchor(l).fontFamily(e).fontSize(i).text(`${m}`).colorFill(b).visible(s.showValue()&&!A).render()}),z.exit().each(function(t){s.textLocal.get(this).target(null)}).remove()}),x.exit().transition().duration(n).style("opacity",0).remove();const b=t.yAxisStacked()?c[d]:Math.max(...e.filter((t,e)=>e>0&&e<p)),v=f.selectAll(".stackedTotalText").data(s.showDomainTotal()?[c[d]]:[]);v.enter().append("g").attr("class","stackedTotalText").each(function(t){s.stackedTextLocal.set(this,(new i.Text).target(this).colorStroke_default("transparent"))}).merge(v).each(function(i){const n={x:0,y:0},a=t.dataPos(e[0]),r=t.valuePos(b),l=s.valueFontFamily(),h=s.valueFontSize(),c=s.textSize(i,l,h),u=parseFloat(i)>=0;let p="middle";o?(n.x=a,n.y=u?r-c.height/2:r+c.height/2):(p="start",n.y=a,n.x=u?r+c.width/2:r-c.width/2),s.stackedTextLocal.get(this).pos(n).anchor(p).fontFamily(l).fontSize(h).text(i).render()}),v.exit().each(function(t){s.textLocal.get(this).target(null)}).remove()}),f.exit().transition().duration(n).remove()}calcInnerText(t,e,i){const n=this.innerTextFontFamily_exists()?this.innerTextFontFamily():"Verdana",o=this.innerTextFontSize(),s=this.valueFontFamily_exists()?this.valueFontFamily():"Verdana",a=this.valueFontSize(),r=this.innerTextPadding_exists()?this.innerTextPadding():o/2.5,l=this.isHorizontal?a:this.textSize(i,s,a).width,h=e,c=3*r+this.textSize("...",n,o).width+l,u=1*r+l;let p=4;if(3*r+this.textSize(e,n,o).width+l<t)p=1;else if(c<t){const i=t-c;let s="";for(const t of e){if(this.textSize(s+t,n,o).width>i){e=s+"...";break}s+=t}p=2}else u<t?(e="",p=3):e="";return{text:e,isTruncated:h!==e,padding:r,category:p,valueTextWidth:l}}innerText(t,e,i){return t[0]}};s(Ot,"Column"),a(Ot,"__inputs",[{id:"label",type:"string"},{id:"values",type:"number",multi:!0}]);let Rt=Ot;Rt.prototype._class+=" chart_Column",Rt.prototype.implements(e.INDChart.prototype),Rt.prototype.implements(e.ITooltip.prototype),Rt.prototype.publish("valueFontFamily",null,"string","Font family of value text",null,{optional:!0}),Rt.prototype.publish("valueFontSize",12,"number","Height of value text (pixels)"),Rt.prototype.publish("innerTextFontFamily",null,"string","Font family of inner text",null,{optional:!0}),Rt.prototype.publish("innerTextPadding",8,"number","Offset of inner text (pixels)",null,{optional:!0}),Rt.prototype.publish("innerTextFontSize",12,"number","Height of inner text (pixels)"),Rt.prototype.publish("paletteID","default","set","Color palette for this widget",()=>Rt.prototype._palette.switch(),{tags:["Basic","Shared"]}),Rt.prototype.publish("useClonedPalette",!1,"boolean","Enable or disable using a cloned palette",null,{tags:["Intermediate","Shared"]}),Rt.prototype.publish("showValue",!1,"boolean","Show Value in column"),Rt.prototype.publish("showInnerText",!1,"boolean","Show Label in column"),Rt.prototype.publish("showValueFormat",",","string","D3 Format for Value",null,{disable:s(t=>!t.showValue()||!!t.showValueAsPercent(),"disable")}),Rt.prototype.publish("showValueAsPercent",null,"set","If showValue is true, optionally show value as a percentage by Series or Domain",[null,"series","domain"],{disable:s(t=>!t.showValue(),"disable"),optional:!0}),Rt.prototype.publish("showValueAsPercentFormat",".0%","string","D3 Format for %",null,{disable:s(t=>!t.showValue()||!t.showValueAsPercent(),"disable")}),Rt.prototype.publish("showDomainTotal",!1,"boolean","Show Total Value for Stacked Columns",null),Rt.prototype.publish("valueCentered",!1,"boolean","Show Value in center of column"),Rt.prototype.publish("valueAnchor","middle","set","text-anchor for shown value text",["start","middle","end"]),Rt.prototype.publish("xAxisSeriesPaddingInner",0,"number","Determines the ratio of the range that is reserved for blank space between band (0->1)"),Rt.prototype.publish("tooltipInnerTextEllipsedOnly",!1,"boolean","Show tooltip only when inner text is truncated with an ellipsis");const jt=class _Bar extends Rt{constructor(){super(),this.orientation_default("vertical")}};s(jt,"Bar");let Nt=jt;function Lt(t){var e=0,i=t.children,n=i&&i.length;if(n)for(;--n>=0;)e+=i[n].value;else e=1;t.value=e}function Bt(){return this.eachAfter(Lt)}function $t(t){var e,i,n,o,s=this,a=[s];do{for(e=a.reverse(),a=[];s=e.pop();)if(t(s),i=s.children)for(n=0,o=i.length;n<o;++n)a.push(i[n])}while(a.length);return this}function Ht(t){for(var e,i,n=this,o=[n];n=o.pop();)if(t(n),e=n.children)for(i=e.length-1;i>=0;--i)o.push(e[i]);return this}function Vt(t){for(var e,i,n,o=this,s=[o],a=[];o=s.pop();)if(a.push(o),e=o.children)for(i=0,n=e.length;i<n;++i)s.push(e[i]);for(;o=a.pop();)t(o);return this}function qt(t){return this.eachAfter(function(e){for(var i=+t(e.data)||0,n=e.children,o=n&&n.length;--o>=0;)i+=n[o].value;e.value=i})}function Wt(t){return this.eachBefore(function(e){e.children&&e.children.sort(t)})}function Gt(t){for(var e=this,i=Xt(e,t),n=[e];e!==i;)e=e.parent,n.push(e);for(var o=n.length;t!==i;)n.splice(o,0,t),t=t.parent;return n}function Xt(t,e){if(t===e)return t;var i=t.ancestors(),n=e.ancestors(),o=null;for(t=i.pop(),e=n.pop();t===e;)o=t,t=i.pop(),e=n.pop();return o}function Yt(){for(var t=this,e=[t];t=t.parent;)e.push(t);return e}function Ut(){var t=[];return this.each(function(e){t.push(e)}),t}function Qt(){var t=[];return this.eachBefore(function(e){e.children||t.push(e)}),t}function Zt(){var t=this,e=[];return t.each(function(i){i!==t&&e.push({source:i.parent,target:i})}),e}function Jt(t,e){var i,n,o,s,a,r=new ne(t),l=+t.value&&(r.value=t.value),h=[r];for(null==e&&(e=te);i=h.pop();)if(l&&(i.value=+i.data.value),(o=e(i.data))&&(a=o.length))for(i.children=new Array(a),s=a-1;s>=0;--s)h.push(n=i.children[s]=new ne(o[s])),n.parent=i,n.depth=i.depth+1;return r.eachBefore(ie)}function Kt(){return Jt(this).eachBefore(ee)}function te(t){return t.children}function ee(t){t.data=t.data.data}function ie(t){var e=0;do{t.height=e}while((t=t.parent)&&t.height<++e)}function ne(t){this.data=t,this.depth=this.height=0,this.parent=null}Nt.prototype._class+=" chart_Bar",s(Lt,"count"),s(Bt,"node_count"),s($t,"node_each"),s(Ht,"node_eachBefore"),s(Vt,"node_eachAfter"),s(qt,"node_sum"),s(Wt,"node_sort"),s(Gt,"node_path"),s(Xt,"leastCommonAncestor"),s(Yt,"node_ancestors"),s(Ut,"node_descendants"),s(Qt,"node_leaves"),s(Zt,"node_links"),s(Jt,"hierarchy"),s(Kt,"node_copy"),s(te,"defaultChildren"),s(ee,"copyData"),s(ie,"computeHeight"),s(ne,"Node$1"),ne.prototype=Jt.prototype={constructor:ne,count:Bt,each:$t,eachAfter:Vt,eachBefore:Ht,sum:qt,sort:Wt,path:Gt,ancestors:Yt,descendants:Ut,leaves:Qt,links:Zt,copy:Kt};var oe=Array.prototype.slice;function se(t){for(var e,i,n=t.length;n;)i=Math.random()*n--|0,e=t[n],t[n]=t[i],t[i]=e;return t}function ae(t){for(var e,i,n=0,o=(t=se(oe.call(t))).length,s=[];n<o;)e=t[n],i&&he(i,e)?++n:(i=ue(s=re(s,e)),n=0);return i}function re(t,e){var i,n;if(ce(e,t))return[e];for(i=0;i<t.length;++i)if(le(e,t[i])&&ce(de(t[i],e),t))return[t[i],e];for(i=0;i<t.length-1;++i)for(n=i+1;n<t.length;++n)if(le(de(t[i],t[n]),e)&&le(de(t[i],e),t[n])&&le(de(t[n],e),t[i])&&ce(fe(t[i],t[n],e),t))return[t[i],t[n],e];throw new Error}function le(t,e){var i=t.r-e.r,n=e.x-t.x,o=e.y-t.y;return i<0||i*i<n*n+o*o}function he(t,e){var i=t.r-e.r+1e-6,n=e.x-t.x,o=e.y-t.y;return i>0&&i*i>n*n+o*o}function ce(t,e){for(var i=0;i<e.length;++i)if(!he(t,e[i]))return!1;return!0}function ue(t){switch(t.length){case 1:return pe(t[0]);case 2:return de(t[0],t[1]);case 3:return fe(t[0],t[1],t[2])}}function pe(t){return{x:t.x,y:t.y,r:t.r}}function de(t,e){var i=t.x,n=t.y,o=t.r,s=e.x,a=e.y,r=e.r,l=s-i,h=a-n,c=r-o,u=Math.sqrt(l*l+h*h);return{x:(i+s+l/u*c)/2,y:(n+a+h/u*c)/2,r:(u+o+r)/2}}function fe(t,e,i){var n=t.x,o=t.y,s=t.r,a=e.x,r=e.y,l=e.r,h=i.x,c=i.y,u=i.r,p=n-a,d=n-h,f=o-r,y=o-c,_=l-s,x=u-s,m=n*n+o*o-s*s,g=m-a*a-r*r+l*l,b=m-h*h-c*c+u*u,v=d*f-p*y,w=(f*b-y*g)/(2*v)-n,S=(y*_-f*x)/v,A=(d*g-p*b)/(2*v)-o,k=(p*x-d*_)/v,M=S*S+k*k-1,T=2*(s+w*S+A*k),P=w*w+A*A-s*s,C=-(M?(T+Math.sqrt(T*T-4*M*P))/(2*M):P/T);return{x:n+w+S*C,y:o+A+k*C,r:C}}function ye(t,e,i){var n,o,s,a,r=t.x-e.x,l=t.y-e.y,h=r*r+l*l;h?(o=e.r+i.r,o*=o,a=t.r+i.r,o>(a*=a)?(n=(h+a-o)/(2*h),s=Math.sqrt(Math.max(0,a/h-n*n)),i.x=t.x-n*r-s*l,i.y=t.y-n*l+s*r):(n=(h+o-a)/(2*h),s=Math.sqrt(Math.max(0,o/h-n*n)),i.x=e.x+n*r-s*l,i.y=e.y+n*l+s*r)):(i.x=e.x+i.r,i.y=e.y)}function _e(t,e){var i=t.r+e.r-1e-6,n=e.x-t.x,o=e.y-t.y;return i>0&&i*i>n*n+o*o}function xe(t){var e=t._,i=t.next._,n=e.r+i.r,o=(e.x*i.r+i.x*e.r)/n,s=(e.y*i.r+i.y*e.r)/n;return o*o+s*s}function me(t){this._=t,this.next=null,this.previous=null}function ge(t){if(!(o=t.length))return 0;var e,i,n,o,s,a,r,l,h,c,u;if((e=t[0]).x=0,e.y=0,!(o>1))return e.r;if(i=t[1],e.x=-i.r,i.x=e.r,i.y=0,!(o>2))return e.r+i.r;ye(i,e,n=t[2]),e=new me(e),i=new me(i),n=new me(n),e.next=n.previous=i,i.next=e.previous=n,n.next=i.previous=e;t:for(r=3;r<o;++r){ye(e._,i._,n=t[r]),n=new me(n),l=i.next,h=e.previous,c=i._.r,u=e._.r;do{if(c<=u){if(_e(l._,n._)){i=l,e.next=i,i.previous=e,--r;continue t}c+=l._.r,l=l.next}else{if(_e(h._,n._)){(e=h).next=i,i.previous=e,--r;continue t}u+=h._.r,h=h.previous}}while(l!==h.next);for(n.previous=e,n.next=i,e.next=i.previous=i=n,s=xe(e);(n=n.next)!==i;)(a=xe(n))<s&&(e=n,s=a);i=e.next}for(e=[i._],n=i;(n=n.next)!==i;)e.push(n._);for(n=ae(e),r=0;r<o;++r)(e=t[r]).x-=n.x,e.y-=n.y;return n.r}function be(t){return null==t?null:ve(t)}function ve(t){if("function"!=typeof t)throw new Error;return t}function we(){return 0}function Se(t){return function(){return t}}function Ae(t){return Math.sqrt(t.value)}function ke(){var t=null,e=1,i=1,n=we;function o(o){return o.x=e/2,o.y=i/2,t?o.eachBefore(Me(t)).eachAfter(Te(n,.5)).eachBefore(Pe(1)):o.eachBefore(Me(Ae)).eachAfter(Te(we,1)).eachAfter(Te(n,o.r/Math.min(e,i))).eachBefore(Pe(Math.min(e,i)/(2*o.r))),o}return s(o,"pack"),o.radius=function(e){return arguments.length?(t=be(e),o):t},o.size=function(t){return arguments.length?(e=+t[0],i=+t[1],o):[e,i]},o.padding=function(t){return arguments.length?(n="function"==typeof t?t:Se(+t),o):n},o}function Me(t){return function(e){e.children||(e.r=Math.max(0,+t(e)||0))}}function Te(t,e){return function(i){if(n=i.children){var n,o,s,a=n.length,r=t(i)*e||0;if(r)for(o=0;o<a;++o)n[o].r+=r;if(s=ge(n),r)for(o=0;o<a;++o)n[o].r-=r;i.r=s+r}}}function Pe(t){return function(e){var i=e.parent;e.r*=t,i&&(e.x=i.x+t*e.x,e.y=i.y+t*e.y)}}s(se,"shuffle"),s(ae,"enclose"),s(re,"extendBasis"),s(le,"enclosesNot"),s(he,"enclosesWeak"),s(ce,"enclosesWeakAll"),s(ue,"encloseBasis"),s(pe,"encloseBasis1"),s(de,"encloseBasis2"),s(fe,"encloseBasis3"),s(ye,"place"),s(_e,"intersects"),s(xe,"score"),s(me,"Node"),s(ge,"packEnclose"),s(be,"optional"),s(ve,"required"),s(we,"constantZero"),s(Se,"constant$2"),s(Ae,"defaultRadius"),s(ke,"d3Pack"),s(Me,"radiusLeaf"),s(Te,"packChildren"),s(Pe,"translateChild");const Ce=class _Bubble extends i.SVGWidget{labelWidgets;d3Pack;constructor(){super(),e.I2DChart.call(this),e.ITooltip.call(this),i.Utility.SimpleSelectionMixin.call(this),this._drawStartPos="origin",this.labelWidgets={},this.d3Pack=ke().size([this.width(),this.height()]).padding(1.5)}size(t){const e=super.size.apply(this,arguments);return arguments.length&&this.d3Pack.size([this.width(),this.height()]),e}enter(t,e){super.enter(t,e),this._selection.widgetElement(e);const i=this;this.tooltipHTML(function(t){return"series-table"===i.tooltipStyle()?i.tooltipFormat({label:t[0],arr:i.columns().slice(1).map(function(e,n){return{label:e,color:i._palette(t[0]),value:t[1]}})}):i.tooltipFormat({label:t.data[0],value:t.data[1]})})}update(t,e){super.update(t,e);const n=this;this._palette=this._palette.switch(this.paletteID()),this.useClonedPalette()&&(this._palette=this._palette.cloneNotExists(this.paletteID()+"_"+this.id()));const o=Jt({children:this.cloneData()}).sum(function(t){return t[1]}).sort(function(t,e){return e[1]<t[1]?-1:e[1]>t[1]?1:0});this.d3Pack(o);const s=e.selectAll(".node").data(o.children||[],t=>t.data[0]);s.enter().append("g").attr("class",(t,e)=>"node series series-"+this.cssTag(t.data[0])).attr("opacity",0).call(this._selection.enter.bind(this._selection)).on("click",function(t){n.click(n.rowToObj(t.data),n.columns()[1],n._selection.selected(this))}).on("dblclick",function(t){n.dblclick(n.rowToObj(t.data),n.columns()[1],n._selection.selected(this))}).each(function(t){const e=i.select(this),o=t.x,s=t.y;e.append("circle").attr("transform","translate("+o+","+s+")").attr("r",0).on("mouseout.tooltip",n.tooltip.hide).on("mousemove.tooltip",n.tooltip.show),t.__viz_faChar?n.labelWidgets[t.data[0]]=(new i.FAChar).char(t.__viz_faChar).target(this).render():n.labelWidgets[t.data[0]]=(new i.Text).text(t.data[0]).target(this).render()}).merge(s).transition().attr("opacity",1).each(function(t){const e=i.select(this),o={x:t.x,y:t.y};e.select("circle").transition().attr("transform","translate("+o.x+","+o.y+")").style("fill",n.fillColor(t.data,n.columns()[1],t.data[1])).attr("r",t.r).select("title").text(t.data[0]+" ("+t.data[1]+")"),t.__viz_faChar?n.labelWidgets[t.data[0]].pos(o).render():n.labelWidgets[t.data[0]].pos(o).colorFill_default(n.textColor(t.data,n.columns()[1],t.data[1])).width(2*t.r).text(t.data[0]).render()}),s.exit().transition().style("opacity",0).remove()}exit(t,e){super.exit(t,e)}};s(Ce,"Bubble"),a(Ce,"__inputs",[{id:"label",type:"string"},{id:"value",type:"number"}]);let Ie=Ce;Ie.prototype._class+=" chart_Bubble",Ie.prototype.implements(e.I2DChart.prototype),Ie.prototype.implements(e.ITooltip.prototype),Ie.prototype.mixin(i.Utility.SimpleSelectionMixin),Ie.prototype.publish("paletteID","default","set","Color palette for this widget",Ie.prototype._palette.switch(),{tags:["Basic","Shared"]}),Ie.prototype.publish("useClonedPalette",!1,"boolean","Enable or disable using a cloned palette",null,{tags:["Intermediate","Shared"]});const ze=class _BubbleXY extends Ft{constructor(){super()}enter(t,e){this.pointSizeColumn_exists()||this.pointSizeColumn(this.columns()[this.columns().length-1]),super.enter(t,e)}};s(ze,"BubbleXY");let Fe=ze;Fe.prototype._class+=" chart_BubbleXY";var De,Ee,Oe=0,Re=0,je=0,Ne=0,Le=0,Be=0,$e="object"==typeof performance&&performance.now?performance:Date,He="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Ve(){return Le||(He(qe),Le=$e.now()+Be)}function qe(){Le=0}function We(){this._call=this._time=this._next=null}function Ge(){Ve(),++Oe;for(var t,e=De;e;)(t=Le-e._time)>=0&&e._call.call(null,t),e=e._next;--Oe}function Xe(){Le=(Ne=$e.now())+Be,Oe=Re=0;try{Ge()}finally{Oe=0,Ue(),Le=0}}function Ye(){var t=$e.now(),e=t-Ne;e>1e3&&(Be-=e,Ne=t)}function Ue(){for(var t,e,i=De,n=1/0;i;)i._call?(n>i._time&&(n=i._time),t=i,i=i._next):(e=i._next,i._next=null,i=t?t._next=e:De=e);Ee=t,Qe(n)}function Qe(t){Oe||(Re&&(Re=clearTimeout(Re)),t-Le>24?(t<1/0&&(Re=setTimeout(Xe,t-$e.now()-Be)),je&&(je=clearInterval(je))):(je||(Ne=$e.now(),je=setInterval(Ye,1e3)),Oe=1,He(Xe)))}function Ze(){var t="left",e=!1,n=!1,o=Je,a=Ke,r=ti,l=380,h=30,c=Mt();function u(t){t.each(function(t,s){var u,p,d=o.call(this,t,s).slice().sort(i.descending),f=a.call(this,t,s).slice().sort(i.descending),y=r.call(this,t,s).slice().sort(i.descending),_=i.select(this),x=_.select("g.wrap");x.empty()&&(x=_.append("g").attr("class","wrap")),n?(u=h,p=l,x.attr("transform","rotate(90)translate(0,"+-l+")")):(u=l,p=h,x.attr("transform",null));var m=i.scaleLinear().domain([0,Math.max(d[0],f[0],y[0])]).range(e?[u,0]:[0,u]),g=this.__chart__||i.scaleLinear().domain([0,1/0]).range(m.range());this.__chart__=m;var b=ei(g),v=ei(m),w=x.selectAll("rect.range").data(d);w.enter().append("rect").attr("class",function(t,e){return"range s"+e}).attr("width",b).attr("height",p).attr("x",e?g:0).merge(w).transition(w).attr("x",e?m:0).attr("width",v).attr("height",p);var S=x.selectAll("rect.measure").data(y);S.enter().append("rect").attr("class",function(t,e){return"measure s"+e}).attr("width",b).attr("height",p/3).attr("x",e?g:0).attr("y",p/3).merge(S).transition(S).attr("width",v).attr("height",p/3).attr("x",e?m:0).attr("y",p/3);var A=x.selectAll("line.marker").data(f);A.enter().append("line").attr("class","marker").attr("x1",g).attr("x2",g).attr("y1",p/6).attr("y2",5*p/6).merge(A).transition(A).attr("x1",m).attr("x2",m).attr("y1",p/6).attr("y2",5*p/6);var k=_.selectAll("g.axis").data([0]);k.enter().append("g").attr("class","axis"),k.attr("transform",n?null:"translate(0,"+p+")").call(c.scale(m))}),Ge()}return s(u,"bulvar"),u.orient=function(i){return arguments.length?(e="right"===(t=i+"")||"bottom"===t,c.orient((n="top"===t||"bottom"===t)?"left":"bottom"),u):t},u.ranges=function(t){return arguments.length?(o=t,u):o},u.markers=function(t){return arguments.length?(a=t,u):a},u.measures=function(t){return arguments.length?(r=t,u):r},u.width=function(t){return arguments.length?(l=+t,u):l},u.height=function(t){return arguments.length?(h=+t,u):h},u.tickFormat=function(t){return arguments.length?(c.tickFormat(t),u):c.tickFormat()},u}function Je(t){return t.ranges}function Ke(t){return t.markers}function ti(t){return t.measures}function ei(t){var e=t(0);return function(i){return Math.abs(t(i)-e)}}s(Ve,"now"),s(qe,"clearNow"),s(We,"Timer"),We.prototype={constructor:We,restart:s(function(t,e,i){if("function"!=typeof t)throw new TypeError("callback is not a function");i=(null==i?Ve():+i)+(null==e?0:+e),this._next||Ee===this||(Ee?Ee._next=this:De=this,Ee=this),this._call=t,this._time=i,Qe()},"restart"),stop:s(function(){this._call&&(this._call=null,this._time=1/0,Qe())},"stop")},s(Ge,"timerFlush"),s(Xe,"wake"),s(Ye,"poke"),s(Ue,"nap"),s(Qe,"sleep"),s(Ze,"d3Bullet"),s(Je,"bulvarRanges"),s(Ke,"bulvarMarkers"),s(ti,"bulvarMeasures"),s(ei,"bulvarWidth");const ii=class _Bullet extends i.HTMLWidget{_hiddenColumns={};constructor(){super(),i.Utility.SimpleSelectionMixin.call(this,!0)}bulletData(){const t=this;this._hiddenColumns={};const e=this.columns();return this.data().map(function(t){return{title:i(t,this.titleColumn()),subtitle:i(t,this.subtitleColumn()),ranges:i(t,this.rangesColumn(),"range"),measures:i(t,this.measuresColumn(),"measure"),markers:i(t,this.markersColumn(),"marker"),origRow:t}},this);function i(i,n,o){const s=e.indexOf(n);return s>=0?i[s]instanceof Array?i[s]:[i[s]]:(o&&(t._hiddenColumns[o]=!0),[0])}}enter(t,e){super.enter(t,e),i.select(t.parentNode).style("overflow","auto"),this._selection.widgetElement(e)}update(t,e){super.update(t,e);const n=this;e.selectAll(".axis").style("display","none"),e.selectAll(".range,.measure,.marker").style("display",null);const o=2,s=8,a=2,r=8,l=this.width()-o-a,h=40-s-r,c=e.selectAll("svg").data(this.bulletData()),u=c.enter().append("svg").attr("class","bullet").call(this._selection.enter.bind(this._selection)).on("click",function(t){n.click(n.rowToObj(t.origRow),n.titleColumn(),n._selection.selected(this))}).on("dblclick",function(t){n.dblclick(n.rowToObj(t.origRow),n.titleColumn(),n._selection.selected(this))}).each(function(){const t=i.select(this).append("g").attr("class",(t,e)=>"bulletBar series series-"+n.cssTag(n.titleColumn())).append("g").attr("class","bulletTitle");t.append("text").attr("class","title"),t.append("text").attr("class","subtitle").attr("dy","1em")}).merge(c),p=u.select(".bulletTitle").style("text-anchor","end").attr("transform","translate(-6,"+h/2+")");p.select(".title").text(function(t){return t.title}),p.select(".subtitle").text(function(t){return t.subtitle});let d=0;p.each(function(){const t=this.getBBox();t.width>d&&(d=t.width)});const f=Ze().width(l-d-6).height(h);u.attr("width",l).attr("height",h+s+r).style("margin-left",`${o}px`),u.select(".bulletBar").attr("transform","translate("+(d+6)+","+s+")").call(f),c.exit().remove(),Object.keys(this._hiddenColumns).length>0&&e.selectAll(`.${Object.keys(this._hiddenColumns).join(",.")}`).style("display","none")}exit(t,e){super.exit(t,e)}click(t,e,i){}dblclick(t,e,i){}_selection};s(ii,"Bullet");let ni=ii;ni.prototype._class+=" chart_Bullet",ni.prototype.publish("titleColumn",null,"set","Title Column",function(){return this.columns()},{optional:!0}),ni.prototype.publish("subtitleColumn",null,"set","Subtitle Column",function(){return this.columns()},{optional:!0}),ni.prototype.publish("rangesColumn",null,"set","Ranges Column",function(){return this.columns()},{optional:!0}),ni.prototype.publish("measuresColumn",null,"set","Measures Column",function(){return this.columns()},{optional:!0}),ni.prototype.publish("markersColumn",null,"set","Markers Column",function(){return this.columns()},{optional:!0});var oi=Array.prototype.slice;function si(t,e){return t-e}function ai(t){for(var e=0,i=t.length,n=t[i-1][1]*t[0][0]-t[i-1][0]*t[0][1];++e<i;)n+=t[e-1][1]*t[e][0]-t[e-1][0]*t[e][1];return n}function ri(t){return function(){return t}}function li(t,e){for(var i,n=-1,o=e.length;++n<o;)if(i=hi(t,e[n]))return i;return 0}function hi(t,e){for(var i=e[0],n=e[1],o=-1,s=0,a=t.length,r=a-1;s<a;r=s++){var l=t[s],h=l[0],c=l[1],u=t[r],p=u[0],d=u[1];if(ci(l,u,e))return 0;c>n!=d>n&&i<(p-h)*(n-c)/(d-c)+h&&(o=-o)}return o}function ci(t,e,i){var n;return ui(t,e,i)&&pi(t[n=+(t[0]===e[0])],i[n],e[n])}function ui(t,e,i){return(e[0]-t[0])*(i[1]-t[1])===(i[0]-t[0])*(e[1]-t[1])}function pi(t,e,i){return t<=e&&e<=i||i<=e&&e<=t}function di(){}s(si,"ascending"),s(ai,"area"),s(ri,"constant$1"),s(li,"contains"),s(hi,"ringContains"),s(ci,"segmentContains"),s(ui,"collinear"),s(pi,"within"),s(di,"noop$2");var fi=[[],[[[1,1.5],[.5,1]]],[[[1.5,1],[1,1.5]]],[[[1.5,1],[.5,1]]],[[[1,.5],[1.5,1]]],[[[1,1.5],[.5,1]],[[1,.5],[1.5,1]]],[[[1,.5],[1,1.5]]],[[[1,.5],[.5,1]]],[[[.5,1],[1,.5]]],[[[1,1.5],[1,.5]]],[[[.5,1],[1,.5]],[[1.5,1],[1,1.5]]],[[[1.5,1],[1,.5]]],[[[.5,1],[1.5,1]]],[[[1,1.5],[1.5,1]]],[[[.5,1],[1,1.5]]],[]];function yi(){var t=1,e=1,n=i.thresholdSturges,o=c;function a(t){var e=n(t);if(Array.isArray(e))e=e.slice().sort(si);else{var o=i.extent(t),s=o[0],a=o[1];e=i.tickStep(s,a,e),e=i.range(Math.floor(s/e)*e,Math.floor(a/e)*e,e)}return e.map(function(e){return r(t,e)})}function r(t,e){var i=[],n=[];return l(t,e,function(s){o(s,t,e),ai(s)>0?i.push([s]):n.push(s)}),n.forEach(function(t){for(var e,n=0,o=i.length;n<o;++n)if(-1!==li((e=i[n])[0],t))return void e.push(t)}),{type:"MultiPolygon",value:e,coordinates:i}}function l(i,n,o){var a,r,l,c,u,p,d=new Array,f=new Array;for(a=r=-1,c=i[0]>=n,fi[c<<1].forEach(y);++a<t-1;)l=c,c=i[a+1]>=n,fi[l|c<<1].forEach(y);for(fi[c|0].forEach(y);++r<e-1;){for(a=-1,c=i[r*t+t]>=n,u=i[r*t]>=n,fi[c<<1|u<<2].forEach(y);++a<t-1;)l=c,c=i[r*t+t+a+1]>=n,p=u,u=i[r*t+a+1]>=n,fi[l|c<<1|u<<2|p<<3].forEach(y);fi[c|u<<3].forEach(y)}for(a=-1,u=i[r*t]>=n,fi[u<<2].forEach(y);++a<t-1;)p=u,u=i[r*t+a+1]>=n,fi[u<<2|p<<3].forEach(y);function y(t){var e,i,n=[t[0][0]+a,t[0][1]+r],s=[t[1][0]+a,t[1][1]+r],l=h(n),c=h(s);(e=f[l])?(i=d[c])?(delete f[e.end],delete d[i.start],e===i?(e.ring.push(s),o(e.ring)):d[e.start]=f[i.end]={start:e.start,end:i.end,ring:e.ring.concat(i.ring)}):(delete f[e.end],e.ring.push(s),f[e.end=c]=e):(e=d[c])?(i=f[l])?(delete d[e.start],delete f[i.end],e===i?(e.ring.push(s),o(e.ring)):d[i.start]=f[e.end]={start:i.start,end:e.end,ring:i.ring.concat(e.ring)}):(delete d[e.start],e.ring.unshift(n),d[e.start=l]=e):d[l]=f[c]={start:l,end:c,ring:[n,s]}}fi[u<<3].forEach(y),s(y,"stitch")}function h(e){return 2*e[0]+e[1]*(t+1)*4}function c(i,n,o){i.forEach(function(i){var s,a=i[0],r=i[1],l=0|a,h=0|r,c=n[h*t+l];a>0&&a<t&&l===a&&(s=n[h*t+l-1],i[0]=a+(o-s)/(c-s)-.5),r>0&&r<e&&h===r&&(s=n[(h-1)*t+l],i[1]=r+(o-s)/(c-s)-.5)})}return s(a,"contours"),s(r,"contour"),s(l,"isorings"),s(h,"index"),s(c,"smoothLinear"),a.contour=r,a.size=function(i){if(!arguments.length)return[t,e];var n=Math.ceil(i[0]),o=Math.ceil(i[1]);if(!(n>0&&o>0))throw new Error("invalid size");return t=n,e=o,a},a.thresholds=function(t){return arguments.length?(n="function"==typeof t?t:Array.isArray(t)?ri(oi.call(t)):ri(t),a):n},a.smooth=function(t){return arguments.length?(o=t?c:di,a):o===c},a}function _i(t,e,i){for(var n=t.width,o=t.height,s=1+(i<<1),a=0;a<o;++a)for(var r=0,l=0;r<n+i;++r)r<n&&(l+=t.data[r+a*n]),r>=i&&(r>=s&&(l-=t.data[r-s+a*n]),e.data[r-i+a*n]=l/Math.min(r+1,n-1+s-r,s))}function xi(t,e,i){for(var n=t.width,o=t.height,s=1+(i<<1),a=0;a<n;++a)for(var r=0,l=0;r<o+i;++r)r<o&&(l+=t.data[a+r*n]),r>=i&&(r>=s&&(l-=t.data[a+(r-s)*n]),e.data[a+(r-i)*n]=l/Math.min(r+1,o-1+s-r,s))}function mi(t){return t[0]}function gi(t){return t[1]}function bi(){return 1}function vi(){var t=mi,e=gi,n=bi,o=960,a=500,r=20,l=2,h=3*r,c=o+2*h>>l,u=a+2*h>>l,p=ri(20);function d(o){var s=new Float32Array(c*u),a=new Float32Array(c*u);o.forEach(function(i,o,a){var r=+t(i,o,a)+h>>l,p=+e(i,o,a)+h>>l,d=+n(i,o,a);r>=0&&r<c&&p>=0&&p<u&&(s[r+p*c]+=d)}),_i({width:c,height:u,data:s},{data:a},r>>l),xi({width:c,height:u,data:a},{data:s},r>>l),_i({width:c,height:u,data:s},{data:a},r>>l),xi({width:c,height:u,data:a},{data:s},r>>l),_i({width:c,height:u,data:s},{data:a},r>>l),xi({width:c,height:u,data:a},{data:s},r>>l);var d=p(s);if(!Array.isArray(d)){var y=i.max(s);d=i.tickStep(0,y,d),(d=i.range(0,Math.floor(y/d)*d,d)).shift()}return yi().thresholds(d).size([c,u])(s).map(f)}function f(t){return t.value*=Math.pow(2,-2*l),t.coordinates.forEach(y),t}function y(t){t.forEach(_)}function _(t){t.forEach(x)}function x(t){t[0]=t[0]*Math.pow(2,l)-h,t[1]=t[1]*Math.pow(2,l)-h}function m(){return c=o+2*(h=3*r)>>l,u=a+2*h>>l,d}return s(d,"density"),s(f,"transform"),s(y,"transformPolygon"),s(_,"transformRing"),s(x,"transformPoint"),s(m,"resize"),d.x=function(e){return arguments.length?(t="function"==typeof e?e:ri(+e),d):t},d.y=function(t){return arguments.length?(e="function"==typeof t?t:ri(+t),d):e},d.weight=function(t){return arguments.length?(n="function"==typeof t?t:ri(+t),d):n},d.size=function(t){if(!arguments.length)return[o,a];var e=Math.ceil(t[0]),i=Math.ceil(t[1]);if(!(e>=0||e>=0))throw new Error("invalid size");return o=e,a=i,m()},d.cellSize=function(t){if(!arguments.length)return 1<<l;if(!((t=+t)>=1))throw new Error("invalid cell size");return l=Math.floor(Math.log(t)/Math.LN2),m()},d.thresholds=function(t){return arguments.length?(p="function"==typeof t?t:Array.isArray(t)?ri(oi.call(t)):ri(t),d):p},d.bandwidth=function(t){if(!arguments.length)return Math.sqrt(r*(r+1));if(!((t=+t)>=0))throw new Error("invalid bandwidth");return r=Math.round((Math.sqrt(4*t*t+1)-1)/2),m()},d}function wi(){return new Si}function Si(){this.reset()}s(yi,"contours"),s(_i,"blurX"),s(xi,"blurY"),s(mi,"defaultX"),s(gi,"defaultY"),s(bi,"defaultWeight"),s(vi,"d3ContourDensity"),s(wi,"adder"),s(Si,"Adder"),Si.prototype={constructor:Si,reset:s(function(){this.s=this.t=0},"reset"),add:s(function(t){ki(Ai,t,this.t),ki(this,Ai.s,this.s),this.s?this.t+=Ai.t:this.s=Ai.t},"add"),valueOf:s(function(){return this.s},"valueOf")};var Ai=new Si;function ki(t,e,i){var n=t.s=e+i,o=n-e,s=n-o;t.t=e-s+(i-o)}s(ki,"add");var Mi=2*Math.PI,Ti=Math.abs,Pi=Math.sqrt;function Ci(){}function Ii(t,e){t&&Fi.hasOwnProperty(t.type)&&Fi[t.type](t,e)}s(Ci,"noop$1"),s(Ii,"streamGeometry");var zi={Feature:s(function(t,e){Ii(t.geometry,e)},"Feature"),FeatureCollection:s(function(t,e){for(var i=t.features,n=-1,o=i.length;++n<o;)Ii(i[n].geometry,e)},"FeatureCollection")},Fi={Sphere:s(function(t,e){e.sphere()},"Sphere"),Point:s(function(t,e){t=t.coordinates,e.point(t[0],t[1],t[2])},"Point"),MultiPoint:s(function(t,e){for(var i=t.coordinates,n=-1,o=i.length;++n<o;)t=i[n],e.point(t[0],t[1],t[2])},"MultiPoint"),LineString:s(function(t,e){Di(t.coordinates,e,0)},"LineString"),MultiLineString:s(function(t,e){for(var i=t.coordinates,n=-1,o=i.length;++n<o;)Di(i[n],e,0)},"MultiLineString"),Polygon:s(function(t,e){Ei(t.coordinates,e)},"Polygon"),MultiPolygon:s(function(t,e){for(var i=t.coordinates,n=-1,o=i.length;++n<o;)Ei(i[n],e)},"MultiPolygon"),GeometryCollection:s(function(t,e){for(var i=t.geometries,n=-1,o=i.length;++n<o;)Ii(i[n],e)},"GeometryCollection")};function Di(t,e,i){var n,o=-1,s=t.length-i;for(e.lineStart();++o<s;)n=t[o],e.point(n[0],n[1],n[2]);e.lineEnd()}function Ei(t,e){var i=-1,n=t.length;for(e.polygonStart();++i<n;)Di(t[i],e,1);e.polygonEnd()}function Oi(t,e){t&&zi.hasOwnProperty(t.type)?zi[t.type](t,e):Ii(t,e)}function Ri(t){return t}s(Di,"streamLine"),s(Ei,"streamPolygon"),s(Oi,"geoStream"),s(Ri,"identity");var ji,Ni,Li,Bi,$i=wi(),Hi=wi(),Vi={point:Ci,lineStart:Ci,lineEnd:Ci,polygonStart:s(function(){Vi.lineStart=qi,Vi.lineEnd=Xi},"polygonStart"),polygonEnd:s(function(){Vi.lineStart=Vi.lineEnd=Vi.point=Ci,$i.add(Ti(Hi)),Hi.reset()},"polygonEnd"),result:s(function(){var t=$i/2;return $i.reset(),t},"result")};function qi(){Vi.point=Wi}function Wi(t,e){Vi.point=Gi,ji=Li=t,Ni=Bi=e}function Gi(t,e){Hi.add(Bi*t-Li*e),Li=t,Bi=e}function Xi(){Gi(ji,Ni)}s(qi,"areaRingStart"),s(Wi,"areaPointFirst"),s(Gi,"areaPoint"),s(Xi,"areaRingEnd");var Yi=1/0,Ui=Yi,Qi=-Yi,Zi=Qi,Ji={point:Ki,lineStart:Ci,lineEnd:Ci,polygonStart:Ci,polygonEnd:Ci,result:s(function(){var t=[[Yi,Ui],[Qi,Zi]];return Qi=Zi=-(Ui=Yi=1/0),t},"result")};function Ki(t,e){t<Yi&&(Yi=t),t>Qi&&(Qi=t),e<Ui&&(Ui=e),e>Zi&&(Zi=e)}s(Ki,"boundsPoint");var tn,en,nn,on,sn=0,an=0,rn=0,ln=0,hn=0,cn=0,un=0,pn=0,dn=0,fn={point:yn,lineStart:_n,lineEnd:gn,polygonStart:s(function(){fn.lineStart=bn,fn.lineEnd=vn},"polygonStart"),polygonEnd:s(function(){fn.point=yn,fn.lineStart=_n,fn.lineEnd=gn},"polygonEnd"),result:s(function(){var t=dn?[un/dn,pn/dn]:cn?[ln/cn,hn/cn]:rn?[sn/rn,an/rn]:[NaN,NaN];return sn=an=rn=ln=hn=cn=un=pn=dn=0,t},"result")};function yn(t,e){sn+=t,an+=e,++rn}function _n(){fn.point=xn}function xn(t,e){fn.point=mn,yn(nn=t,on=e)}function mn(t,e){var i=t-nn,n=e-on,o=Pi(i*i+n*n);ln+=o*(nn+t)/2,hn+=o*(on+e)/2,cn+=o,yn(nn=t,on=e)}function gn(){fn.point=yn}function bn(){fn.point=wn}function vn(){Sn(tn,en)}function wn(t,e){fn.point=Sn,yn(tn=nn=t,en=on=e)}function Sn(t,e){var i=t-nn,n=e-on,o=Pi(i*i+n*n);ln+=o*(nn+t)/2,hn+=o*(on+e)/2,cn+=o,un+=(o=on*t-nn*e)*(nn+t),pn+=o*(on+e),dn+=3*o,yn(nn=t,on=e)}function An(t){this._context=t}s(yn,"centroidPoint"),s(_n,"centroidLineStart"),s(xn,"centroidPointFirstLine"),s(mn,"centroidPointLine"),s(gn,"centroidLineEnd"),s(bn,"centroidRingStart"),s(vn,"centroidRingEnd"),s(wn,"centroidPointFirstRing"),s(Sn,"centroidPointRing"),s(An,"PathContext"),An.prototype={_radius:4.5,pointRadius:s(function(t){return this._radius=t,this},"pointRadius"),polygonStart:s(function(){this._line=0},"polygonStart"),polygonEnd:s(function(){this._line=NaN},"polygonEnd"),lineStart:s(function(){this._point=0},"lineStart"),lineEnd:s(function(){0===this._line&&this._context.closePath(),this._point=NaN},"lineEnd"),point:s(function(t,e){switch(this._point){case 0:this._context.moveTo(t,e),this._point=1;break;case 1:this._context.lineTo(t,e);break;default:this._context.moveTo(t+this._radius,e),this._context.arc(t,e,this._radius,0,Mi)}},"point"),result:Ci};var kn,Mn,Tn,Pn,Cn,In=wi(),zn={point:Ci,lineStart:s(function(){zn.point=Fn},"lineStart"),lineEnd:s(function(){kn&&Dn(Mn,Tn),zn.point=Ci},"lineEnd"),polygonStart:s(function(){kn=!0},"polygonStart"),polygonEnd:s(function(){kn=null},"polygonEnd"),result:s(function(){var t=+In;return In.reset(),t},"result")};function Fn(t,e){zn.point=Dn,Mn=Pn=t,Tn=Cn=e}function Dn(t,e){Pn-=t,Cn-=e,In.add(Pi(Pn*Pn+Cn*Cn)),Pn=t,Cn=e}function En(){this._string=[]}function On(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Rn(t,e){var i,n,o=4.5;function a(t){return t&&("function"==typeof o&&n.pointRadius(+o.apply(this,arguments)),Oi(t,i(n))),n.result()}return s(a,"path"),a.area=function(t){return Oi(t,i(Vi)),Vi.result()},a.measure=function(t){return Oi(t,i(zn)),zn.result()},a.bounds=function(t){return Oi(t,i(Ji)),Ji.result()},a.centroid=function(t){return Oi(t,i(fn)),fn.result()},a.projection=function(e){return arguments.length?(i=null==e?(t=null,Ri):(t=e).stream,a):t},a.context=function(t){return arguments.length?(n=null==t?(e=null,new En):new An(e=t),"function"!=typeof o&&n.pointRadius(o),a):e},a.pointRadius=function(t){return arguments.length?(o="function"==typeof t?t:(n.pointRadius(+t),+t),a):o},a.projection(t).context(e)}s(Fn,"lengthPointFirst"),s(Dn,"lengthPoint"),s(En,"PathString"),En.prototype={_radius:4.5,_circle:On(4.5),pointRadius:s(function(t){return(t=+t)!==this._radius&&(this._radius=t,this._circle=null),this},"pointRadius"),polygonStart:s(function(){this._line=0},"polygonStart"),polygonEnd:s(function(){this._line=NaN},"polygonEnd"),lineStart:s(function(){this._point=0},"lineStart"),lineEnd:s(function(){0===this._line&&this._string.push("Z"),this._point=NaN},"lineEnd"),point:s(function(t,e){switch(this._point){case 0:this._string.push("M",t,",",e),this._point=1;break;case 1:this._string.push("L",t,",",e);break;default:null==this._circle&&(this._circle=On(this._radius)),this._string.push("M",t,",",e,this._circle)}},"point"),result:s(function(){if(this._string.length){var t=this._string.join("");return this._string=[],t}return null},"result")},s(On,"circle"),s(Rn,"geoPath");const jn=class _Contour extends It{_dataMinWeight;_dataMaxWeight;constructor(){super(),this.xAxisGuideLines_default(!1).yAxisGuideLines_default(!1).xAxisType_default("linear")}xPos(t,e){return"horizontal"===t.orientation()?t.dataPos(e.label):t.valuePos(e.value)}yPos(t,e){return"horizontal"===t.orientation()?t.valuePos(e.value):t.dataPos(e.label)}layerEnter(t,e,i=250){super.layerEnter(t,e,i)}layerUpdate(t,e,i=250){super.layerUpdate(t,e,i),this._palette=this._palette.switch(this.paletteID());const n=this.flattenData(this.layerColumns(t),this.layerData(t)),o=vi().x(e=>this.xPos(t,e)).y(e=>this.yPos(t,e)).size([this.width(),this.height()]).bandwidth(this.contourBandwidth())(n),s=o.map(t=>t.value),a=Math.min.apply(this,s),r=Math.max.apply(this,s);this._dataMinWeight=a,this._dataMaxWeight=r;const l=e.selectAll("path").data(o);l.enter().append("path").merge(l).attr("d",Rn()).attr("fill",t=>this.showContourFill()?this._palette(t.value,a,r):"none").attr("stroke",this.contourStrokeColor()).attr("stroke-linejoin","round").attr("stroke-width",this.contourStrokeWidth()),l.exit().remove()}exit(t,e){super.exit(t,e)}};s(jn,"Contour"),a(jn,"__inputs",[{id:"x",type:"any"},{id:"y",type:"number"}]);let Nn=jn;Nn.prototype._class+=" chart_Contour",Nn.prototype.implements(e.I1DChart.prototype),Nn.prototype.publish("paletteID","YlGnBu","string","Color palette for this widget"),Nn.prototype.publish("useClonedPalette",!0,"boolean","Enable or disable using a cloned palette"),Nn.prototype.publish("showContourFill",!0,"boolean","Show/hide the contour background colors"),Nn.prototype.publish("showContour",!0,"boolean","Show/hide the contour border lines"),Nn.prototype.publish("contourBandwidth",40,"number","Controls the sensitivity of the contour grouping algorithm"),Nn.prototype.publish("contourStrokeColor","#2C3A47","html-color","Color of the contour border lines"),Nn.prototype.publish("contourStrokeWidth",1,"number","Width of the contour border lines");const Ln=class _Gantt extends Nt{constructor(){super(),this.orientation_default("vertical").xAxisType_default("ordinal").yAxisType_default("time")}};s(Ln,"Gantt");let Bn=Ln;function $n(t){return s(function(){return t},"constant")}Bn.prototype._class+=" chart_Gantt",s($n,"constant");var Hn=1e-12,Vn=Math.PI,qn=Vn/2,Wn=2*Vn;function Gn(t){return t.innerRadius}function Xn(t){return t.outerRadius}function Yn(t){return t.startAngle}function Un(t){return t.endAngle}function Qn(t){return t&&t.padAngle}function Zn(t){return t>=1?qn:t<=-1?-qn:Math.asin(t)}function Jn(t,e,i,n,o,s,a,r){var l=i-t,h=n-e,c=a-o,u=r-s,p=(c*(e-s)-u*(t-o))/(u*l-c*h);return[t+p*l,e+p*h]}function Kn(t,e,i,n,o,s,a){var r=t-i,l=e-n,h=(a?s:-s)/Math.sqrt(r*r+l*l),c=h*l,u=-h*r,p=t+c,d=e+u,f=i+c,y=n+u,_=(p+f)/2,x=(d+y)/2,m=f-p,g=y-d,b=m*m+g*g,v=o-s,w=p*y-f*d,S=(g<0?-1:1)*Math.sqrt(Math.max(0,v*v*b-w*w)),A=(w*g-m*S)/b,k=(-w*m-g*S)/b,M=(w*g+m*S)/b,T=(-w*m+g*S)/b,P=A-_,C=k-x,I=M-_,z=T-x;return P*P+C*C>I*I+z*z&&(A=M,k=T),{cx:A,cy:k,x01:-c,y01:-u,x11:A*(o/v-1),y11:k*(o/v-1)}}function to(){var t=Gn,e=Xn,i=$n(0),n=null,o=Yn,a=Un,r=Qn,l=null;function h(){var s,h,c=+t.apply(this,arguments),u=+e.apply(this,arguments),d=o.apply(this,arguments)-qn,f=a.apply(this,arguments)-qn,y=Math.abs(f-d),_=f>d;if(l||(l=s=p()),u<c&&(h=u,u=c,c=h),u>Hn)if(y>Wn-Hn)l.moveTo(u*Math.cos(d),u*Math.sin(d)),l.arc(0,0,u,d,f,!_),c>Hn&&(l.moveTo(c*Math.cos(f),c*Math.sin(f)),l.arc(0,0,c,f,d,_));else{var x,m,g=d,b=f,v=d,w=f,S=y,A=y,k=r.apply(this,arguments)/2,M=k>Hn&&(n?+n.apply(this,arguments):Math.sqrt(c*c+u*u)),T=Math.min(Math.abs(u-c)/2,+i.apply(this,arguments)),P=T,C=T;if(M>Hn){var I=Zn(M/c*Math.sin(k)),z=Zn(M/u*Math.sin(k));(S-=2*I)>Hn?(v+=I*=_?1:-1,w-=I):(S=0,v=w=(d+f)/2),(A-=2*z)>Hn?(g+=z*=_?1:-1,b-=z):(A=0,g=b=(d+f)/2)}var F=u*Math.cos(g),D=u*Math.sin(g),E=c*Math.cos(w),O=c*Math.sin(w);if(T>Hn){var R=u*Math.cos(b),j=u*Math.sin(b),N=c*Math.cos(v),L=c*Math.sin(v);if(y<Vn){var B=S>Hn?Jn(F,D,N,L,R,j,E,O):[E,O],$=F-B[0],H=D-B[1],V=R-B[0],q=j-B[1],W=1/Math.sin(Math.acos(($*V+H*q)/(Math.sqrt($*$+H*H)*Math.sqrt(V*V+q*q)))/2),G=Math.sqrt(B[0]*B[0]+B[1]*B[1]);P=Math.min(T,(c-G)/(W-1)),C=Math.min(T,(u-G)/(W+1))}}A>Hn?C>Hn?(x=Kn(N,L,F,D,u,C,_),m=Kn(R,j,E,O,u,C,_),l.moveTo(x.cx+x.x01,x.cy+x.y01),C<T?l.arc(x.cx,x.cy,C,Math.atan2(x.y01,x.x01),Math.atan2(m.y01,m.x01),!_):(l.arc(x.cx,x.cy,C,Math.atan2(x.y01,x.x01),Math.atan2(x.y11,x.x11),!_),l.arc(0,0,u,Math.atan2(x.cy+x.y11,x.cx+x.x11),Math.atan2(m.cy+m.y11,m.cx+m.x11),!_),l.arc(m.cx,m.cy,C,Math.atan2(m.y11,m.x11),Math.atan2(m.y01,m.x01),!_))):(l.moveTo(F,D),l.arc(0,0,u,g,b,!_)):l.moveTo(F,D),c>Hn&&S>Hn?P>Hn?(x=Kn(E,O,R,j,c,-P,_),m=Kn(F,D,N,L,c,-P,_),l.lineTo(x.cx+x.x01,x.cy+x.y01),P<T?l.arc(x.cx,x.cy,P,Math.atan2(x.y01,x.x01),Math.atan2(m.y01,m.x01),!_):(l.arc(x.cx,x.cy,P,Math.atan2(x.y01,x.x01),Math.atan2(x.y11,x.x11),!_),l.arc(0,0,c,Math.atan2(x.cy+x.y11,x.cx+x.x11),Math.atan2(m.cy+m.y11,m.cx+m.x11),_),l.arc(m.cx,m.cy,P,Math.atan2(m.y11,m.x11),Math.atan2(m.y01,m.x01),!_))):l.arc(0,0,c,w,v,_):l.lineTo(E,O)}else l.moveTo(0,0);if(l.closePath(),s)return l=null,s+""||null}return s(h,"arc"),h.centroid=function(){var i=(+t.apply(this,arguments)+ +e.apply(this,arguments))/2,n=(+o.apply(this,arguments)+ +a.apply(this,arguments))/2-Vn/2;return[Math.cos(n)*i,Math.sin(n)*i]},h.innerRadius=function(e){return arguments.length?(t="function"==typeof e?e:$n(+e),h):t},h.outerRadius=function(t){return arguments.length?(e="function"==typeof t?t:$n(+t),h):e},h.cornerRadius=function(t){return arguments.length?(i="function"==typeof t?t:$n(+t),h):i},h.padRadius=function(t){return arguments.length?(n=null==t?null:"function"==typeof t?t:$n(+t),h):n},h.startAngle=function(t){return arguments.length?(o="function"==typeof t?t:$n(+t),h):o},h.endAngle=function(t){return arguments.length?(a="function"==typeof t?t:$n(+t),h):a},h.padAngle=function(t){return arguments.length?(r="function"==typeof t?t:$n(+t),h):r},h.context=function(t){return arguments.length?(l=null==t?null:t,h):l},h}function eo(t){this._context=t}function io(t){return new eo(t)}function no(t){return t[0]}function oo(t){return t[1]}function so(){var t=no,e=oo,i=$n(!0),n=null,o=io,a=null;function r(s){var r,l,h,c=s.length,u=!1;for(null==n&&(a=o(h=p())),r=0;r<=c;++r)!(r<c&&i(l=s[r],r,s))===u&&((u=!u)?a.lineStart():a.lineEnd()),u&&a.point(+t(l,r,s),+e(l,r,s));if(h)return a=null,h+""||null}return s(r,"line"),r.x=function(e){return arguments.length?(t="function"==typeof e?e:$n(+e),r):t},r.y=function(t){return arguments.length?(e="function"==typeof t?t:$n(+t),r):e},r.defined=function(t){return arguments.length?(i="function"==typeof t?t:$n(!!t),r):i},r.curve=function(t){return arguments.length?(o=t,null!=n&&(a=o(n)),r):o},r.context=function(t){return arguments.length?(null==t?n=a=null:a=o(n=t),r):n},r}function ao(){}function ro(t,e,i){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+i)/6)}function lo(t){this._context=t}function ho(t,e){this._basis=new lo(t),this._beta=e}function co(t,e,i){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-e),t._y2+t._k*(t._y1-i),t._x2,t._y2)}function uo(t,e){this._context=t,this._k=(1-e)/6}function po(t,e){this._context=t,this._k=(1-e)/6}function fo(t,e){this._context=t,this._k=(1-e)/6}function yo(t,e,i){var n=t._x1,o=t._y1,s=t._x2,a=t._y2;if(t._l01_a>Hn){var r=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,l=3*t._l01_a*(t._l01_a+t._l12_a);n=(n*r-t._x0*t._l12_2a+t._x2*t._l01_2a)/l,o=(o*r-t._y0*t._l12_2a+t._y2*t._l01_2a)/l}if(t._l23_a>Hn){var h=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,c=3*t._l23_a*(t._l23_a+t._l12_a);s=(s*h+t._x1*t._l23_2a-e*t._l12_2a)/c,a=(a*h+t._y1*t._l23_2a-i*t._l12_2a)/c}t._context.bezierCurveTo(n,o,s,a,t._x2,t._y2)}function _o(t,e){this._context=t,this._alpha=e}s(Gn,"arcInnerRadius"),s(Xn,"arcOuterRadius"),s(Yn,"arcStartAngle"),s(Un,"arcEndAngle"),s(Qn,"arcPadAngle"),s(Zn,"asin"),s(Jn,"intersect"),s(Kn,"cornerTangents"),s(to,"arc"),s(eo,"Linear"),eo.prototype={areaStart:s(function(){this._line=0},"areaStart"),areaEnd:s(function(){this._line=NaN},"areaEnd"),lineStart:s(function(){this._point=0},"lineStart"),lineEnd:s(function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},"lineEnd"),point:s(function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e)}},"point")},s(io,"curveLinear"),s(no,"x"),s(oo,"y"),s(so,"line"),s(ao,"noop"),s(ro,"point$3"),s(lo,"Basis"),lo.prototype={areaStart:s(function(){this._line=0},"areaStart"),areaEnd:s(function(){this._line=NaN},"areaEnd"),lineStart:s(function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},"lineStart"),lineEnd:s(function(){switch(this._point){case 3:ro(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},"lineEnd"),point:s(function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:ro(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e},"point")},s(ho,"Bundle"),ho.prototype={lineStart:s(function(){this._x=[],this._y=[],this._basis.lineStart()},"lineStart"),lineEnd:s(function(){var t=this._x,e=this._y,i=t.length-1;if(i>0)for(var n,o=t[0],s=e[0],a=t[i]-o,r=e[i]-s,l=-1;++l<=i;)n=l/i,this._basis.point(this._beta*t[l]+(1-this._beta)*(o+n*a),this._beta*e[l]+(1-this._beta)*(s+n*r));this._x=this._y=null,this._basis.lineEnd()},"lineEnd"),point:s(function(t,e){this._x.push(+t),this._y.push(+e)},"point")},s(function t(e){function i(t){return 1===e?new lo(t):new ho(t,e)}return s(i,"bundle"),i.beta=function(e){return t(+e)},i},"custom")(.85),s(co,"point$2"),s(uo,"Cardinal"),uo.prototype={areaStart:s(function(){this._line=0},"areaStart"),areaEnd:s(function(){this._line=NaN},"areaEnd"),lineStart:s(function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},"lineStart"),lineEnd:s(function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:co(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},"lineEnd"),point:s(function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2,this._x1=t,this._y1=e;break;case 2:this._point=3;default:co(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e},"point")},s(function t(e){function i(t){return new uo(t,e)}return s(i,"cardinal"),i.tension=function(e){return t(+e)},i},"custom")(0),s(po,"CardinalClosed"),po.prototype={areaStart:ao,areaEnd:ao,lineStart:s(function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},"lineStart"),lineEnd:s(function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},"lineEnd"),point:s(function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:co(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e},"point")},s(function t(e){function i(t){return new po(t,e)}return s(i,"cardinal"),i.tension=function(e){return t(+e)},i},"custom")(0),s(fo,"CardinalOpen"),fo.prototype={areaStart:s(function(){this._line=0},"areaStart"),areaEnd:s(function(){this._line=NaN},"areaEnd"),lineStart:s(function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},"lineStart"),lineEnd:s(function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},"lineEnd"),point:s(function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:co(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e},"point")},s(function t(e){function i(t){return new fo(t,e)}return s(i,"cardinal"),i.tension=function(e){return t(+e)},i},"custom")(0),s(yo,"point$1"),s(_o,"CatmullRom"),_o.prototype={areaStart:s(function(){this._line=0},"areaStart"),areaEnd:s(function(){this._line=NaN},"areaEnd"),lineStart:s(function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},"lineStart"),lineEnd:s(function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},"lineEnd"),point:s(function(t,e){if(t=+t,e=+e,this._point){var i=this._x2-t,n=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(i*i+n*n,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3;default:yo(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e},"point")};const xo=s(function t(e){function i(t){return e?new _o(t,e):new uo(t,0)}return s(i,"catmullRom"),i.alpha=function(e){return t(+e)},i},"custom")(.5);function mo(t,e){this._context=t,this._alpha=e}function go(t,e){this._context=t,this._alpha=e}function bo(t){return t<0?-1:1}function vo(t,e,i){var n=t._x1-t._x0,o=e-t._x1,s=(t._y1-t._y0)/(n||o<0&&-0),a=(i-t._y1)/(o||n<0&&-0),r=(s*o+a*n)/(n+o);return(bo(s)+bo(a))*Math.min(Math.abs(s),Math.abs(a),.5*Math.abs(r))||0}function wo(t,e){var i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function So(t,e,i){var n=t._x0,o=t._y0,s=t._x1,a=t._y1,r=(s-n)/3;t._context.bezierCurveTo(n+r,o+r*e,s-r,a-r*i,s,a)}function Ao(t){this._context=t}s(mo,"CatmullRomClosed"),mo.prototype={areaStart:ao,areaEnd:ao,lineStart:s(function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},"lineStart"),lineEnd:s(function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},"lineEnd"),point:s(function(t,e){if(t=+t,e=+e,this._point){var i=this._x2-t,n=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(i*i+n*n,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:yo(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e},"point")},s(function t(e){function i(t){return e?new mo(t,e):new po(t,0)}return s(i,"catmullRom"),i.alpha=function(e){return t(+e)},i},"custom")(.5),s(go,"CatmullRomOpen"),go.prototype={areaStart:s(function(){this._line=0},"areaStart"),areaEnd:s(function(){this._line=NaN},"areaEnd"),lineStart:s(function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},"lineStart"),lineEnd:s(function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},"lineEnd"),point:s(function(t,e){if(t=+t,e=+e,this._point){var i=this._x2-t,n=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(i*i+n*n,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:yo(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e},"point")},s(function t(e){function i(t){return e?new go(t,e):new fo(t,0)}return s(i,"catmullRom"),i.alpha=function(e){return t(+e)},i},"custom")(.5),s(bo,"sign"),s(vo,"slope3"),s(wo,"slope2"),s(So,"point"),s(Ao,"MonotoneX"),Ao.prototype={areaStart:s(function(){this._line=0},"areaStart"),areaEnd:s(function(){this._line=NaN},"areaEnd"),lineStart:s(function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},"lineStart"),lineEnd:s(function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:So(this,this._t0,wo(this,this._t0))}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},"lineEnd"),point:s(function(t,e){var i=NaN;if(e=+e,(t=+t)!==this._x1||e!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,So(this,wo(this,i=vo(this,t,e)),i);break;default:So(this,this._t0,i=vo(this,t,e))}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=i}},"point")},Object.create(Ao.prototype).point=function(t,e){Ao.prototype.point.call(this,e,t)};var ko="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Mo=s(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},"classCallCheck"),To=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return s(t,"defineProperties"),function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),Po=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])}return t},Co=s(function t(e,i,n){null===e&&(e=Function.prototype);var o=Object.getOwnPropertyDescriptor(e,i);if(void 0===o){var s=Object.getPrototypeOf(e);return null===s?void 0:t(s,i,n)}if("value"in o)return o.value;var a=o.get;return void 0!==a?a.call(n):void 0},"get"),Io=s(function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)},"inherits"),zo=s(function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e},"possibleConstructorReturn"),Fo=s(function(t){if(Array.isArray(t)){for(var e=0,i=Array(t.length);e<t.length;e++)i[e]=t[e];return i}return Array.from(t)},"toConsumableArray"),Do=function(){function t(e){var i=e.x,n=void 0===i?0:i,o=e.y,s=void 0===o?0:o,a=e.nx,r=e.ny,l=e.dy,h=void 0===l?0:l,c=e.dx,u=void 0===c?0:c,p=e.color,d=void 0===p?"grey":p,f=e.data,y=e.type,_=e.subject,x=e.connector,m=e.note,g=e.disable,b=e.id,v=e.className;Mo(this,t),this._dx=void 0!==a?a-n:u,this._dy=void 0!==r?r-s:h,this._x=n,this._y=s,this._color=d,this.id=b,this._className=v||"",this._type=y||"",this.data=f,this.note=m||{},this.connector=x||{},this.subject=_||{},this.disable=g||[]}return s(t,"Annotation"),To(t,[{key:"updatePosition",value:s(function(){this.type.setPosition&&(this.type.setPosition(),this.type.subject&&0!==this.type.subject.selectAll(":not(.handle)").nodes().length&&this.type.redrawSubject())},"updatePosition")},{key:"clearComponents",value:s(function(){this.type.clearComponents&&this.type.clearComponents()},"clearComponents")},{key:"updateOffset",value:s(function(){this.type.setOffset&&(this.type.setOffset(),0!==this.type.connector.selectAll(":not(.handle)").nodes().length&&this.type.redrawConnector(),this.type.redrawNote())},"updateOffset")},{key:"className",get:s(function(){return this._className},"get$$1"),set:s(function(t){this._className=t,this.type.setClassName&&this.type.setClassName()},"set$$1")},{key:"type",get:s(function(){return this._type},"get$$1"),set:s(function(t){this._type=t,this.clearComponents()},"set$$1")},{key:"x",get:s(function(){return this._x},"get$$1"),set:s(function(t){this._x=t,this.updatePosition()},"set$$1")},{key:"y",get:s(function(){return this._y},"get$$1"),set:s(function(t){this._y=t,this.updatePosition()},"set$$1")},{key:"color",get:s(function(){return this._color},"get$$1"),set:s(function(t){this._color=t,this.updatePosition()},"set$$1")},{key:"dx",get:s(function(){return this._dx},"get$$1"),set:s(function(t){this._dx=t,this.updateOffset()},"set$$1")},{key:"dy",get:s(function(){return this._dy},"get$$1"),set:s(function(t){this._dy=t,this.updateOffset()},"set$$1")},{key:"nx",set:s(function(t){this._dx=t-this._x,this.updateOffset()},"set$$1")},{key:"ny",set:s(function(t){this._dy=t-this._y,this.updateOffset()},"set$$1")},{key:"offset",get:s(function(){return{x:this._dx,y:this._dy}},"get$$1"),set:s(function(t){var e=t.x,i=t.y;this._dx=e,this._dy=i,this.updateOffset()},"set$$1")},{key:"position",get:s(function(){return{x:this._x,y:this._y}},"get$$1"),set:s(function(t){var e=t.x,i=t.y;this._x=e,this._y=i,this.updatePosition()},"set$$1")},{key:"translation",get:s(function(){return{x:this._x+this._dx,y:this._y+this._dy}},"get$$1")},{key:"json",get:s(function(){var t={x:this._x,y:this._y,dx:this._dx,dy:this._dy};return this.data&&Object.keys(this.data).length>0&&(t.data=this.data),this.type&&(t.type=this.type),this._className&&(t.className=this._className),Object.keys(this.connector).length>0&&(t.connector=this.connector),Object.keys(this.subject).length>0&&(t.subject=this.subject),Object.keys(this.note).length>0&&(t.note=this.note),t},"get$$1")}]),t}(),Eo=function(){function t(e){var i=e.annotations,n=e.accessors,o=e.accessorsInverse;Mo(this,t),this.accessors=n,this.accessorsInverse=o,this.annotations=i}return s(t,"AnnotationCollection"),To(t,[{key:"clearTypes",value:s(function(t){this.annotations.forEach(function(e){e.type=void 0,e.subject=t&&t.subject||e.subject,e.connector=t&&t.connector||e.connector,e.note=t&&t.note||e.note})},"clearTypes")},{key:"setPositionWithAccessors",value:s(function(){var t=this;this.annotations.forEach(function(e){e.type.setPositionWithAccessors(t.accessors)})},"setPositionWithAccessors")},{key:"editMode",value:s(function(t){this.annotations.forEach(function(e){e.type&&(e.type.editMode=t,e.type.updateEditMode())})},"editMode")},{key:"updateDisable",value:s(function(t){this.annotations.forEach(function(e){e.disable=t,e.type&&t.forEach(function(t){e.type[t]&&(e.type[t].remove&&e.type[t].remove(),e.type[t]=void 0)})})},"updateDisable")},{key:"updateTextWrap",value:s(function(t){this.annotations.forEach(function(e){e.type&&e.type.updateTextWrap&&e.type.updateTextWrap(t)})},"updateTextWrap")},{key:"updateText",value:s(function(){this.annotations.forEach(function(t){t.type&&t.type.drawText&&t.type.drawText()})},"updateText")},{key:"updateNotePadding",value:s(function(t){this.annotations.forEach(function(e){e.type&&(e.type.notePadding=t)})},"updateNotePadding")},{key:"json",get:s(function(){var t=this;return this.annotations.map(function(e){var i=e.json;return t.accessorsInverse&&e.data&&(i.data={},Object.keys(t.accessorsInverse).forEach(function(n){i.data[n]=t.accessorsInverse[n]({x:e.x,y:e.y})})),i})},"get$$1")},{key:"noteNodes",get:s(function(){return this.annotations.map(function(t){return Po({},t.type.getNoteBBoxOffset(),{positionX:t.x,positionY:t.y})})},"get$$1")}]),t}(),Oo=s(function(t){var e=t.cx,i=void 0===e?0:e,n=t.cy;return{move:{x:i,y:void 0===n?0:n}}},"pointHandle"),Ro=s(function(t){var e=t.cx,i=void 0===e?0:e,n=t.cy,o=void 0===n?0:n,s=t.r1,a=t.r2,r=t.padding,l={move:{x:i,y:o}};return void 0!==s&&(l.r1={x:i+s/Math.sqrt(2),y:o+s/Math.sqrt(2)}),void 0!==a&&(l.r2={x:i+a/Math.sqrt(2),y:o+a/Math.sqrt(2)}),void 0!==r&&(l.padding={x:i+s+r,y:o}),l},"circleHandles"),jo=s(function(t){var e=t.group,n=t.handles,o=t.r,s=void 0===o?10:o,a=e.selectAll("circle.handle").data(n);a.enter().append("circle").attr("class","handle").attr("fill","grey").attr("fill-opacity",.1).attr("cursor","move").attr("stroke-dasharray",5).attr("stroke","grey").call(i.drag().container(i.select("g.annotations").node()).on("start",function(t){return t.start&&t.start(t)}).on("drag",function(t){return t.drag&&t.drag(t)}).on("end",function(t){return t.end&&t.end(t)})),e.selectAll("circle.handle").attr("cx",function(t){return t.x}).attr("cy",function(t){return t.y}).attr("r",function(t){return t.r||s}).attr("class",function(t){return"handle "+(t.className||"")}),a.exit().remove()},"addHandles"),No=s(function(t,e){return"dynamic"!==t&&"left"!==t&&"right"!==t||(t=e<0?"top":"bottom"),t},"leftRightDynamic"),Lo=s(function(t,e){return"dynamic"!==t&&"top"!==t&&"bottom"!==t||(t=e<0?"right":"left"),t},"topBottomDynamic"),Bo=["topBottom","top","bottom"],$o=["leftRight","left","right"],Ho=s(function(t){var e=t.padding,i=void 0===e?0:e,n=t.bbox,o=void 0===n?{x:0,width:0,height:0}:n,s=t.align,a=t.orientation,r=t.offset,l=void 0===r?{x:0,y:0}:r,h=-o.x,c=0;return-1!==Bo.indexOf(a)?(s=Lo(s,l.x),l.y<0&&"topBottom"===a||"top"===a?c-=o.height+i:c+=i,"middle"===s?h-=o.width/2:"right"===s&&(h-=o.width)):-1!==$o.indexOf(a)&&(s=No(s,l.y),l.x<0&&"leftRight"===a||"left"===a?h-=o.width+i:h+=i,"middle"===s?c-=o.height/2:"top"===s&&(c-=o.height)),{x:h,y:c}},"noteAlignment"),Vo=s(function(t){var e=t.data,i=t.curve,n=void 0===i?io:i,o=t.canvasContext,s=t.className,a=t.classID,r=so().curve(n),l={type:"path",className:s,classID:a,data:e};return o?(r.context(o),l.pathMethods=r):l.attrs={d:r(e)},l},"lineBuilder"),qo=s(function(t){var e=t.data,i=t.canvasContext,n={type:"path",className:t.className,classID:t.classID,data:e},o=to().innerRadius(e.innerRadius||0).outerRadius(e.outerRadius||e.radius||2).startAngle(e.startAngle||0).endAngle(e.endAngle||2*Math.PI);return i?(o.context(i),n.pathMethods=lineGen):n.attrs={d:o()},n},"arcBuilder"),Wo=s(function(t){var e=t.align,i=t.x,n=void 0===i?0:i,o=t.y,s=void 0===o?0:o,a=t.bbox,r=t.offset;"top"===(e=No(e,r.y))?s-=a.height:"middle"===e&&(s-=a.height/2);var l=[[n,s],[n,s+a.height]];return{components:[Vo({data:l,className:"note-line"})]}},"noteVertical"),Go=s(function(t){var e=t.align,i=t.x,n=void 0===i?0:i,o=t.y,s=void 0===o?0:o,a=t.offset,r=t.bbox;"right"===(e=Lo(e,a.x))?n-=r.width:"middle"===e&&(n-=r.width/2);var l=[[n,s],[n+r.width,s]];return{components:[Vo({data:l,className:"note-line"})]}},"noteHorizontal"),Xo=s(function(t){var e=t.type,i=t.subjectType,n=e.annotation,o=n.position,s=n.x-o.x,a=s+n.dx,r=n.y-o.y,l=r+n.dy,h=n.subject;if("circle"===i&&(h.outerRadius||h.radius)){var c=Math.sqrt((s-a)*(s-a)+(r-l)*(r-l)),u=Math.asin(-l/c),p=h.outerRadius||h.radius+(h.radiusPadding||0);s=Math.abs(Math.cos(u)*p)*(a<0?-1:1),r=Math.abs(Math.sin(u)*p)*(l<0?-1:1)}if("rect"===i){var d=h.width,f=h.height;(d>0&&n.dx>0||d<0&&n.dx<0)&&(s=Math.abs(d)>Math.abs(n.dx)?d/2:d),(f>0&&n.dy>0||f<0&&n.dy<0)&&(r=Math.abs(f)>Math.abs(n.dy)?f/2:f),s===d/2&&r===f/2&&(s=a,r=l)}return[[s,r],[a,l]]},"lineSetup"),Yo=s(function(t){var e=Xo(t);return{components:[Vo({data:e,className:"connector"})]}},"connectorLine"),Uo=s(function(t){var e=t.type,i=t.subjectType,n=e.annotation,o=n.position,s=n.x-o.x,a=s+n.dx,r=n.y-o.y,l=r+n.dy,h=n.subject;if("rect"===i){var c=h.width,u=h.height;(c>0&&n.dx>0||c<0&&n.dx<0)&&(s=Math.abs(c)>Math.abs(n.dx)?c/2:c),(u>0&&n.dy>0||u<0&&n.dy<0)&&(r=Math.abs(u)>Math.abs(n.dy)?u/2:u),s===c/2&&r===u/2&&(s=a,r=l)}var p=[[s,r],[a,l]],d=l-r,f=a-s,y=a,_=l,x=l<r&&a>s||a<s&&l>r?-1:1;if(Math.abs(f)<Math.abs(d)?(y=a,_=r+f*x):(_=l,y=s+d*x),"circle"===i&&(h.outerRadius||h.radius)){var m=(h.outerRadius||h.radius)+(h.radiusPadding||0),g=m/Math.sqrt(2);if(Math.abs(f)>g&&Math.abs(d)>g)p=[[s=g*(a<0?-1:1),r=g*(l<0?-1:1)],[y,_],[a,l]];else if(Math.abs(f)>Math.abs(d)){var b=Math.asin(-l/m);p=[[s=Math.abs(Math.cos(b)*m)*(a<0?-1:1),l],[a,l]]}else{var v=Math.acos(a/m);p=[[a,r=Math.abs(Math.sin(v)*m)*(l<0?-1:1)],[a,l]]}}else p=[[s,r],[y,_],[a,l]];return{components:[Vo({data:p,className:"connector"})]}},"connectorElbow"),Qo=s(function(t){var e=t.type,n=t.connectorData,o=t.subjectType;n||(n={}),n.points&&"number"!=typeof n.points||(n.points=Zo(e.annotation.offset,n.points)),n.curve||(n.curve=xo);var a=[];if(e.editMode){var r=n.points.map(function(t,e){return Po({},Oo({cx:t[0],cy:t[1]}),{index:e})}),l=s(function(t){n.points[t][0]+=i.event.dx,n.points[t][1]+=i.event.dy,e.redrawConnector()},"updatePoint");a=e.mapHandles(r.map(function(t){return Po({},t.move,{drag:l.bind(e,t.index)})}))}var h=Xo({type:e,subjectType:o});return h=[h[0]].concat(Fo(n.points),[h[1]]),{components:[Vo({data:h,curve:n.curve,className:"connector"})],handles:a}},"connectorCurve"),Zo=s(function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2,i=t.x/(e+1),n=t.y/(e+1),o=[],s=1;s<=e;s++)o.push([i*s+s%2*20,n*s-s%2*20]);return o},"createPoints"),Jo=s(function(t){var e=t.annotation,i=t.start,n=t.end,o=t.scale,s=void 0===o?1:o,a=e.position;i=i?[-n[0]+i[0],-n[1]+i[1]]:[e.dx,e.dy],n||(n=[e.x-a.x,e.y-a.y]);var r=n[0],l=n[1],h=i[0],c=i[1],u=10*s,p=16/180*Math.PI,d=Math.atan(c/h);h<0&&(d+=Math.PI);var f=[[r,l],[Math.cos(d+p)*u+r,Math.sin(d+p)*u+l],[Math.cos(d-p)*u+r,Math.sin(d-p)*u+l],[r,l]];return{components:[Vo({data:f,className:"connector-end connector-arrow",classID:"connector-end"})]}},"connectorArrow"),Ko=s(function(t){var e=t.line,i=t.scale,n=void 0===i?1:i,o=qo({className:"connector-end connector-dot",classID:"connector-end",data:{radius:3*Math.sqrt(n)}});return o.attrs.transform="translate("+e.data[0][0]+", "+e.data[0][1]+")",{components:[o]}},"connectorDot"),ts=s(function(t){var e=t.subjectData,n=t.type;e.radius||e.outerRadius||(e.radius=20);var o=[],a=qo({data:e,className:"subject"});if(n.editMode){var r=Ro({r1:a.data.outerRadius||a.data.radius,r2:a.data.innerRadius,padding:e.radiusPadding}),l=s(function(t){var o=e[t]+i.event.dx*Math.sqrt(2);e[t]=o,n.redrawSubject(),n.redrawConnector()},"updateRadius"),h=[Po({},r.r1,{drag:l.bind(n,void 0!==e.outerRadius?"outerRadius":"radius")})];e.innerRadius&&h.push(Po({},r.r2,{drag:l.bind(n,"innerRadius")})),o=n.mapHandles(h)}return a.attrs["fill-opacity"]=0,{components:[a],handles:o}},"subjectCircle"),es=s(function(t){var e=t.subjectData,n=t.type;e.width||(e.width=100),e.height||(e.height=100);var o=[],a=e.width,r=e.height,l=Vo({data:[[0,0],[a,0],[a,r],[0,r],[0,0]],className:"subject"});if(n.editMode){var h=s(function(){e.width=i.event.x,n.redrawSubject(),n.redrawConnector()},"updateWidth"),c=s(function(){e.height=i.event.y,n.redrawSubject(),n.redrawConnector()},"updateHeight"),u=[{x:a,y:r/2,drag:h.bind(n)},{x:a/2,y:r,drag:c.bind(n)}];o=n.mapHandles(u)}return l.attrs["fill-opacity"]=.1,{components:[l],handles:o}},"subjectRect"),is=s(function(t){var e=t.subjectData,i=t.type.annotation.position,n=(void 0!==e.x1?e.x1:i.x)-i.x,o=(void 0!==e.x2?e.x2:i.x)-i.x,s=(void 0!==e.y1?e.y1:i.y)-i.y,a=(void 0!==e.y2?e.y2:i.y)-i.y;return{components:[Vo({data:[[n,s],[o,a]],className:"subject"})]}},"subjectThreshold"),ns=s(function(t){var e=t.subjectData,n=void 0===e?{}:e,o=t.type,a=void 0===o?{}:o,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},l=a.typeSettings&&a.typeSettings.subject;n.radius||(l&&l.radius?n.radius=l.radius:n.radius=14),n.x||l&&l.x&&(n.x=l.x),n.y||l&&l.y&&(n.y=l.y);var h=[],c=[],u=n.radius,p=.7*u,d=0,f=0,y=Math.sqrt(2)*u,_={xleftcorner:-u,xrightcorner:u,ytopcorner:-u,ybottomcorner:u,xleft:-y,xright:y,ytop:-y,ybottom:y};n.x&&!n.y?d=_["x"+n.x]:n.y&&!n.x?f=_["y"+n.y]:n.x&&n.y&&(d=_["x"+n.x+"corner"],f=_["y"+n.y+"corner"]);var x="translate("+d+", "+f+")",m=qo({className:"subject",data:{radius:u}});m.attrs.transform=x,m.attrs.fill=r.color,m.attrs["stroke-linecap"]="round",m.attrs["stroke-width"]="3px";var g=qo({className:"subject-ring",data:{outerRadius:u,innerRadius:p}});g.attrs.transform=x,g.attrs["stroke-width"]="3px",g.attrs.fill="white";var b=void 0;if(d&&f||!d&&!f)b=Vo({className:"subject-pointer",data:[[0,0],[d||0,0],[0,f||0],[0,0]]});else if(d||f){var v=s(function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return t&&t/Math.sqrt(2)/Math.sqrt(2)||e*u/Math.sqrt(2)},"notCornerPointerXY");b=Vo({className:"subject-pointer",data:[[0,0],[v(d),v(f)],[v(d,-1),v(f,-1)],[0,0]]})}if(b&&(b.attrs.fill=r.color,b.attrs["stroke-linecap"]="round",b.attrs["stroke-width"]="3px",c.push(b)),a.editMode){var w={x:2*d,y:2*f,drag:s(function(){n.x=i.event.x<2*-u?"left":i.event.x>2*u?"right":void 0,n.y=i.event.y<2*-u?"top":i.event.y>2*u?"bottom":void 0,a.redrawSubject()},"dragBadge").bind(a)};w.x||w.y||(w.y=-u),h=a.mapHandles([w])}var S=void 0;return n.text&&(S={type:"text",className:"badge-text",attrs:{fill:"white",stroke:"none","font-size":".7em",text:n.text,"text-anchor":"middle",dy:".25em",x:d,y:f}}),c.push(m),c.push(g),c.push(S),{components:c,handles:h}},"subjectBadge"),os=function(){function t(e){var i=e.a,n=e.annotation,o=e.editMode,s=e.dispatcher,a=e.notePadding,r=e.accessors;if(Mo(this,t),this.a=i,this.note=-1===n.disable.indexOf("note")&&i.select("g.annotation-note"),this.noteContent=this.note&&i.select("g.annotation-note-content"),this.connector=-1===n.disable.indexOf("connector")&&i.select("g.annotation-connector"),this.subject=-1===n.disable.indexOf("subject")&&i.select("g.annotation-subject"),this.dispatcher=s,s){var l=us.bind(null,s,n);l({component:this.note,name:"note"}),l({component:this.connector,name:"connector"}),l({component:this.subject,name:"subject"})}this.annotation=n,this.editMode=n.editMode||o,this.notePadding=void 0!==a?a:3,this.offsetCornerX=0,this.offsetCornerY=0,r&&n.data&&this.init(r)}return s(t,"Type"),To(t,[{key:"init",value:s(function(t){this.annotation.x||this.mapX(t),this.annotation.y||this.mapY(t)},"init")},{key:"mapY",value:s(function(t){t.y&&(this.annotation.y=t.y(this.annotation.data))},"mapY")},{key:"mapX",value:s(function(t){t.x&&(this.annotation.x=t.x(this.annotation.data))},"mapX")},{key:"updateEditMode",value:s(function(){this.a.selectAll("circle.handle").remove()},"updateEditMode")},{key:"drawOnSVG",value:s(function(t,e){var i=this;Array.isArray(e)||(e=[e]),e.filter(function(t){return t}).forEach(function(e){var n=e.type,o=e.className,s=e.attrs,a=e.handles,r=e.classID;if("handle"===n)jo({group:t,r:s&&s.r,handles:a});else{cs(t,[i.annotation],n,o,r);for(var l=t.select(n+"."+(r||o)),h=Object.keys(s),c=[],u=l.node().attributes,p=u.length-1;p>=0;p--){var d=u[p].name;-1===h.indexOf(d)&&"class"!==d&&c.push(d)}h.forEach(function(t){"text"===t?l.text(s[t]):l.attr(t,s[t])}),c.forEach(function(t){return l.attr(t,null)})}})},"drawOnSVG")},{key:"getNoteBBox",value:s(function(){return ds(this.note,".annotation-note-content text")},"getNoteBBox")},{key:"getNoteBBoxOffset",value:s(function(){var t=ds(this.note,".annotation-note-content"),e=this.noteContent.attr("transform").split(/\(|\,|\)/g);return t.offsetCornerX=parseFloat(e[1])+this.annotation.dx,t.offsetCornerY=parseFloat(e[2])+this.annotation.dy,t.offsetX=this.annotation.dx,t.offsetY=this.annotation.dy,t},"getNoteBBoxOffset")},{key:"drawSubject",value:s(function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=this.annotation.subject,n=e.type,o={type:this,subjectData:i},s={};"circle"===n?s=ts(o):"rect"===n?s=es(o):"threshold"===n?s=is(o):"badge"===n&&(s=ns(o,this.annotation));var a=s,r=a.components,l=void 0===r?[]:r,h=a.handles,c=void 0===h?[]:h;return l.forEach(function(e){e&&e.attrs&&!e.attrs.stroke&&(e.attrs.stroke=t.annotation.color)}),this.editMode&&(c=c.concat(this.mapHandles([{drag:this.dragSubject.bind(this)}])),l.push({type:"handle",handles:c})),l},"drawSubject")},{key:"drawConnector",value:s(function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=this.annotation.connector,n=i.type||e.type,o={type:this,connectorData:i};o.subjectType=this.typeSettings&&this.typeSettings.subject&&this.typeSettings.subject.type;var s="curve"===n?Qo(o):"elbow"===n?Uo(o):Yo(o),a=s.components,r=void 0===a?[]:a,l=s.handles,h=void 0===l?[]:l,c=r[0];c&&(c.attrs.stroke=this.annotation.color,c.attrs.fill="none");var u=i.end||e.end,p={};if("arrow"===u){var d=c.data[1],f=c.data[0];Math.sqrt(Math.pow(d[0]-f[0],2)+Math.pow(d[1]-f[1],2))<5&&c.data[2]&&(d=c.data[2]),p=Jo({annotation:this.annotation,start:d,end:f,scale:i.endScale})}else"dot"===u?p=Ko({line:c,scale:i.endScale}):u&&"none"!==u||this.connector&&this.connector.select(".connector-end").remove();return p.components&&(p.components.forEach(function(e){e.attrs.fill=t.annotation.color,e.attrs.stroke=t.annotation.color}),r=r.concat(p.components)),this.editMode&&0!==h.length&&r.push({type:"handle",handles:h}),r},"drawConnector")},{key:"drawNote",value:s(function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=this.annotation.note,o=n.align||e.align||"dynamic",s={bbox:e.bbox,align:o,offset:this.annotation.offset},a=n.lineType||e.lineType,r={};"vertical"===a?r=Wo(s):"horizontal"===a&&(r=Go(s));var l=r,h=l.components,c=void 0===h?[]:h,u=l.handles,p=void 0===u?[]:u;if(c.forEach(function(e){e.attrs.stroke=t.annotation.color}),this.editMode){p=this.mapHandles([{x:0,y:0,drag:this.dragNote.bind(this)}]),c.push({type:"handle",handles:p});var d=this.dragNote.bind(this),f=this.dragstarted.bind(this),y=this.dragended.bind(this);this.note.call(i.drag().container(i.select("g.annotations").node()).on("start",function(t){return f(t)}).on("drag",function(t){return d(t)}).on("end",function(t){return y(t)}))}else this.note.on("mousedown.drag",null);return c},"drawNote")},{key:"drawNoteContent",value:s(function(t){var e=this.annotation.note,i=void 0!==e.padding?e.padding:this.notePadding,n=e.orientation||t.orientation||"topBottom",o=e.lineType||t.lineType,s=e.align||t.align||"dynamic";"vertical"===o?n="leftRight":"horizontal"===o&&(n="topBottom");var a={padding:i,bbox:t.bbox,offset:this.annotation.offset,orientation:n,align:s},r=Ho(a),l=r.x,h=r.y;return this.offsetCornerX=l+this.annotation.dx,this.offsetCornerY=h+this.annotation.dy,this.note&&this.noteContent.attr("transform","translate("+l+", "+h+")"),[]},"drawNoteContent")},{key:"drawOnScreen",value:s(function(t,e){return this.drawOnSVG(t,e)},"drawOnScreen")},{key:"redrawSubject",value:s(function(){this.subject&&this.drawOnScreen(this.subject,this.drawSubject())},"redrawSubject")},{key:"redrawConnector",value:s(function(){this.connector&&this.drawOnScreen(this.connector,this.drawConnector())},"redrawConnector")},{key:"redrawNote",value:s(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.getNoteBBox();this.noteContent&&this.drawOnScreen(this.noteContent,this.drawNoteContent({bbox:t})),this.note&&this.drawOnScreen(this.note,this.drawNote({bbox:t}))},"redrawNote")},{key:"setPosition",value:s(function(){var t=this.annotation.position;this.a.attr("transform","translate("+t.x+", "+t.y+")")},"setPosition")},{key:"clearComponents",value:s(function(){this.subject&&this.subject.select("*").remove(),this.connector&&this.connector.select("*").remove()},"clearComponents")},{key:"setOffset",value:s(function(){if(this.note){var t=this.annotation.offset;this.note.attr("transform","translate("+t.x+", "+t.y+")")}},"setOffset")},{key:"setPositionWithAccessors",value:s(function(t){t&&this.annotation.data&&(this.mapX(t),this.mapY(t)),this.setPosition()},"setPositionWithAccessors")},{key:"setClassName",value:s(function(){this.a.attr("class","annotation "+(this.className&&this.className())+" "+(this.editMode?"editable":"")+" "+(this.annotation.className||""))},"setClassName")},{key:"draw",value:s(function(){this.setClassName(),this.setPosition(),this.setOffset(),this.redrawSubject(),this.redrawConnector(),this.redrawNote()},"draw")},{key:"dragstarted",value:s(function(){i.event.sourceEvent.stopPropagation(),this.dispatcher&&this.dispatcher.call("dragstart",this.a,this.annotation),this.a.classed("dragging",!0),this.a.selectAll("circle.handle").style("pointer-events","none")},"dragstarted")},{key:"dragended",value:s(function(){this.dispatcher&&this.dispatcher.call("dragend",this.a,this.annotation),this.a.classed("dragging",!1),this.a.selectAll("circle.handle").style("pointer-events","all")},"dragended")},{key:"dragSubject",value:s(function(){var t=this.annotation.position;t.x+=i.event.dx,t.y+=i.event.dy,this.annotation.position=t},"dragSubject")},{key:"dragNote",value:s(function(){var t=this.annotation.offset;t.x+=i.event.dx,t.y+=i.event.dy,this.annotation.offset=t},"dragNote")},{key:"mapHandles",value:s(function(t){var e=this;return t.map(function(t){return Po({},t,{start:e.dragstarted.bind(e),end:e.dragended.bind(e)})})},"mapHandles")}]),t}(),ss=s(function(t,e,i){return function(t){function n(t){Mo(this,n);var i=zo(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,t));return i.typeSettings=e,e.disable&&e.disable.forEach(function(t){i[t]&&i[t].remove(),i[t]=void 0,"note"===t&&(i.noteContent=void 0)}),i}return Io(n,t),s(n,"customType"),To(n,[{key:"className",value:s(function(){return""+(e.className||Co(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"className",this)&&Co(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"className",this).call(this)||"")},"className")},{key:"drawSubject",value:s(function(t){return this.typeSettings.subject=Po({},e.subject,this.typeSettings.subject),Co(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"drawSubject",this).call(this,Po({},t,this.typeSettings.subject))},"drawSubject")},{key:"drawConnector",value:s(function(t){return this.typeSettings.connector=Po({},e.connector,this.typeSettings.connector),Co(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"drawConnector",this).call(this,Po({},t,e.connector,this.typeSettings.connector))},"drawConnector")},{key:"drawNote",value:s(function(t){return this.typeSettings.note=Po({},e.note,this.typeSettings.note),Co(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"drawNote",this).call(this,Po({},t,e.note,this.typeSettings.note))},"drawNote")},{key:"drawNoteContent",value:s(function(t){return Co(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"drawNoteContent",this).call(this,Po({},t,e.note,this.typeSettings.note))},"drawNoteContent")}],[{key:"init",value:s(function(t,e){return Co(n.__proto__||Object.getPrototypeOf(n),"init",this).call(this,t,e),i&&(t=i(t,e)),t},"init")}]),n}(t)},"customType"),as=function(t){function e(t){Mo(this,e);var i=zo(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return i.textWrap=t.textWrap||120,i.drawText(),i}return Io(e,t),s(e,"d3NoteText"),To(e,[{key:"updateTextWrap",value:s(function(t){this.textWrap=t,this.drawText()},"updateTextWrap")},{key:"drawText",value:s(function(){if(this.note){cs(this.note,[this.annotation],"g","annotation-note-content");var t=this.note.select("g.annotation-note-content");cs(t,[this.annotation],"rect","annotation-note-bg"),cs(t,[this.annotation],"text","annotation-note-label"),cs(t,[this.annotation],"text","annotation-note-title");var e={height:0},i=this.a.select("text.annotation-note-label"),n=this.annotation.note&&this.annotation.note.wrap||this.typeSettings&&this.typeSettings.note&&this.typeSettings.note.wrap||this.textWrap,o=this.annotation.note&&this.annotation.note.wrapSplitter||this.typeSettings&&this.typeSettings.note&&this.typeSettings.note.wrapSplitter,s=this.annotation.note&&this.annotation.note.bgPadding||this.typeSettings&&this.typeSettings.note&&this.typeSettings.note.bgPadding,a={top:0,bottom:0,left:0,right:0};if("number"==typeof s?a={top:s,bottom:s,left:s,right:s}:s&&"object"===(void 0===s?"undefined":ko(s))&&(a=Po(a,s)),this.annotation.note.title){var r=this.a.select("text.annotation-note-title");r.text(this.annotation.note.title),r.attr("fill",this.annotation.color),r.attr("font-weight","bold"),r.call(ps,n,o),e=r.node().getBBox()}i.text(this.annotation.note.label).attr("dx","0"),i.call(ps,n,o),i.attr("y",1.1*e.height||0),i.attr("fill",this.annotation.color);var l=this.getNoteBBox();this.a.select("rect.annotation-note-bg").attr("width",l.width+a.left+a.right).attr("height",l.height+a.top+a.bottom).attr("x",l.x-a.left).attr("y",-a.top).attr("fill","white").attr("fill-opacity",0)}},"drawText")}]),e}(os);ss(as,{className:"label",note:{align:"middle"}});var rs=ss(as,{className:"callout",note:{lineType:"horizontal"}}),ls=ss(rs,{className:"callout elbow",connector:{type:"elbow"}});ss(rs,{className:"callout curve",connector:{type:"curve"}}),ss(os,{className:"badge",subject:{type:"badge"},disable:["connector","note"]}),ss(as,{className:"callout circle",subject:{type:"circle"},note:{lineType:"horizontal"},connector:{type:"elbow"}}),ss(as,{className:"callout rect",subject:{type:"rect"},note:{lineType:"horizontal"},connector:{type:"elbow"}});var hs=function(t){function e(){return Mo(this,e),zo(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return Io(e,t),s(e,"ThresholdMap"),To(e,[{key:"mapY",value:s(function(t){Co(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"mapY",this).call(this,t);var i=this.annotation;(i.subject.x1||i.subject.x2)&&i.data&&t.y&&(i.y=t.y(i.data)),!i.subject.x1&&!i.subject.x2||i.x||(i.x=i.subject.x1||i.subject.x2)},"mapY")},{key:"mapX",value:s(function(t){Co(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"mapX",this).call(this,t);var i=this.annotation;(i.subject.y1||i.subject.y2)&&i.data&&t.x&&(i.x=t.x(i.data)),!i.subject.y1&&!i.subject.y2||i.y||(i.y=i.subject.y1||i.subject.y2)},"mapX")}]),e}(rs);ss(hs,{className:"callout xythreshold",subject:{type:"threshold"}});var cs=s(function(t,e,i,n,o){var s=t.selectAll(i+"."+(o||n)).data(e);return s.enter().append(i).merge(s).attr("class",n),s.exit().remove(),t},"newWithClass"),us=s(function(t,e,i){var n=i.component,o=i.name;n&&n.on("mouseover.annotations",function(){t.call(o+"over",n,e)}).on("mouseout.annotations",function(){return t.call(o+"out",n,e)}).on("click.annotations",function(){return t.call(o+"click",n,e)})},"addHandlers"),ps=s(function(t,e,n){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1.2;t.each(function(){for(var t=i.select(this),s=t.text().split(n||/[ \t\r\n]+/).reverse().filter(function(t){return""!==t}),a=void 0,r=[],l=t.text(null).append("tspan").attr("x",0).attr("dy","0.8em");a=s.pop();)r.push(a),l.text(r.join(" ")),l.node().getComputedTextLength()>e&&r.length>1&&(r.pop(),l.text(r.join(" ")),r=[a],l=t.append("tspan").attr("x",0).attr("dy",o+"em").text(a))})},"wrap"),ds=s(function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:":not(.handle)";return t?t.selectAll(e).nodes().reduce(function(t,e){var i=e.getBBox();t.x=Math.min(t.x,i.x),t.y=Math.min(t.y,i.y),t.width=Math.max(t.width,i.width);var n=e&&e.attributes&&e.attributes.y;return t.height=Math.max(t.height,(n&&parseFloat(n.value)||0)+i.height),t},{x:0,y:0,width:0,height:0}):{x:0,y:0,width:0,height:0}},"bboxWithoutHandles");function fs(){var t=[],e=void 0,n=void 0,o=[],a={},r={},l=!1,h=void 0,c=rs,u=void 0,p=void 0,d=i.dispatch("subjectover","subjectout","subjectclick","connectorover","connectorout","connectorclick","noteover","noteout","noteclick","dragend","dragstart"),f=void 0,y=s(function(n){f=n,l||n.selectAll("circle.handle").remove();var s=t.map(function(t){return t.type||(t.type=c),t.disable||(t.disable=o),new Do(t)});e=e||new Eo({annotations:s,accessors:a,accessorsInverse:r,ids:h}),n.selectAll("g").data([e]).enter().append("g").attr("class","annotations");var y=n.select("g.annotations");cs(y,e.annotations,"g","annotation"),y.selectAll("g.annotation").each(function(t){var e=i.select(this);e.attr("class","annotation"),cs(e,[t],"g","annotation-connector"),cs(e,[t],"g","annotation-subject"),cs(e,[t],"g","annotation-note"),cs(e.select("g.annotation-note"),[t],"g","annotation-note-content"),t.type="[object Object]"===t.type.toString()?t.type:new t.type({a:e,annotation:t,textWrap:u,notePadding:p,editMode:l,dispatcher:d,accessors:a}),t.type.draw(),t.type.drawText&&t.type.drawText()})},"annotation");return y.json=function(){return console.log("Annotations JSON was copied to your clipboard. Please note the annotation type is not JSON compatible. It appears in the objects array in the console, but not in the copied JSON.",e.json),window.copy(JSON.stringify(e.json.map(function(t){return delete t.type,t}))),y},y.update=function(){return t&&e&&(t=e.annotations.map(function(t){return t.type.draw(),t})),y},y.updateText=function(){return e&&(e.updateText(u),t=e.annotations),y},y.updatedAccessors=function(){return e.setPositionWithAccessors(),t=e.annotations,y},y.disable=function(i){return arguments.length?(o=i,e&&(e.updateDisable(o),t=e.annotations),y):o},y.textWrap=function(i){return arguments.length?(u=i,e&&(e.updateTextWrap(u),t=e.annotations),y):u},y.notePadding=function(i){return arguments.length?(p=i,e&&(e.updateNotePadding(p),t=e.annotations),y):p},y.type=function(i,n){return arguments.length?(c=i,e&&(e.annotations.map(function(t){t.type.note&&t.type.note.selectAll("*:not(.annotation-note-content)").remove(),t.type.noteContent&&t.type.noteContent.selectAll("*").remove(),t.type.subject&&t.type.subject.selectAll("*").remove(),t.type.connector&&t.type.connector.selectAll("*").remove(),t.type.typeSettings={},t.type=c,t.subject=n&&n.subject||t.subject,t.connector=n&&n.connector||t.connector,t.note=n&&n.note||t.note}),t=e.annotations),y):c},y.annotations=function(i){if(!arguments.length)return e&&e.annotations||t;(t=i,e&&e.annotations)&&(t.some(function(t){return!t.type||"[object Object]"!==t.type.toString()})?(e=null,y(f)):e.annotations=t);return y},y.context=function(t){return arguments.length?(n=t,y):n},y.accessors=function(t){return arguments.length?(a=t,y):a},y.accessorsInverse=function(t){return arguments.length?(r=t,y):r},y.ids=function(t){return arguments.length?(h=t,y):h},y.editMode=function(i){return arguments.length?(l=i,f&&f.selectAll("g.annotation").classed("editable",l),e&&(e.editMode(l),t=e.annotations),y):l},y.collection=function(t){return arguments.length?(e=t,y):e},y.on=function(){var t=d.on.apply(d,arguments);return t===d?y:t},y}function ys(t){return.65*(t-.5)*2*Math.PI}function _s(t,e){return{x:Math.cos(t-Math.PI/2)*e,y:Math.sin(t-Math.PI/2)*e}}function xs(t,e,i=!1){const n=_s(t,e),o=180*t/Math.PI+(!0===i?180:0);return`translate(${n.x}, ${n.y}) rotate(${o})`}function ms(t,e,n=!1){return function(o){const s=i.interpolate(o.angle,t);return o.angle=t,function(t){return xs(s(t),e,n)}}}function gs(t,e,n){return function(o){const s=i.interpolate(o.startAngle,t),a=i.interpolate(o.endAngle,e);return function(t){return o.startAngle=s(t),o.endAngle=a(t),n(o)}}}s(fs,"annotation"),s(ys,"value2Angle"),s(_s,"pointOnArc"),s(xs,"indicatorTranslate"),s(ms,"indicatorTween"),s(gs,"arcTween");const bs=class _Gauge extends i.SVGWidget{_d3Arc=E().innerRadius(85).outerRadius(100);_colorScale=i.scaleLinear().interpolate(i.interpolateHcl);_usageArc;_meanArc;_freeArc;_indInner;_indOuter;_centerTextG;_centerText;_bottomText;_tooltipG;_mainTooltip;constructor(){super()}tip(t){if(null===t||""===t.label)this._tooltipG.transition().style("opacity",0).on("interrupt end",()=>{this._tooltipG.selectAll("g").remove()});else{this._tooltipG.interrupt().style("opacity",1),t.w=this._centerText.datum().w+10;let e="horizontal",i=0,n=5,o=5;t.y>=5&&t.y<=25?(i=t.x<0?-t.w/2:t.w/2,n=12.5,o=void 0,e="vertical"):t.y>25&&(n=25,o=0);const a=fs().type(ls).annotations([{data:t,dx:-t.x+i,dy:-t.y+n,color:"black",note:{label:t.label,lineType:e,padding:o,align:"middle"}}]).accessors({x:s(t=>t.x,"x"),y:s(t=>t.y,"y")});this._tooltipG.call(a)}}calcSize(t,e,i){const n=t.node().getBBox(),o=e/n.width,s=i/n.height,a=o<s?o:s;return{width:n.width,height:n.height,scale:a}}updateText(t,e,i,n,o){t.datum({x:e,y:i,w:n,h:o}).attr("transform",null);const s=this.calcSize(t,n,o),a=e+n/2-s.width/2*s.scale,r=i+o/2-s.height/2*s.scale;t.attr("transform",`translate(${a}, ${r}) scale(${s.scale})`)}calcWidth(){return Math.min(this.width(),this.height(),this.maxDiameter())}enter(t,e){super.enter(t,e),e.on("click",t=>{this.click(t)}),this._usageArc=e.append("path").datum({startAngle:ys(0),endAngle:ys(0)}).style("fill","green").on("mousemove",t=>{const[e,i]=this._d3Arc.centroid(t);this.tip({x:e,y:i,label:this.valueDescription()})}).on("mouseout",t=>{this.tip(null)}),this._freeArc=e.append("path").datum({startAngle:ys(0),endAngle:ys(1)}).style("fill","lightGrey"),this._meanArc=e.append("path").datum({startAngle:ys(0),endAngle:ys(0)}).style("fill","black").on("mousemove",t=>{const[e,i]=this._d3Arc.centroid(t);this.tip({x:e,y:i,label:this.tickValueDescription()})}).on("mouseout",t=>{this.tip(null)}),this._mainTooltip=e.append("title");const i=this;function n(){return e.append("path").datum({angle:ys(0)}).style("fill","black").style("stroke","black").attr("d","M 0 0 l -3 -3 l 6 0 z").on("mousemove",t=>{const[e,n]=i._d3Arc.centroid(i._meanArc.datum());i.tip({x:e,y:n,label:i.tickValueDescription()})}).on("mouseout",t=>{i.tip(null)})}s(n,"appendIndicator"),this._indInner=n(),this._indOuter=n(),this._centerText=e.append("text").attr("dy",".66em").style("fill","green").on("mousemove",t=>{this.tip({x:0,y:0,label:this.valueDescription()})}).on("mouseout",t=>{this.tip(null)}),this._bottomText=e.append("text").attr("dy",".66em").on("mousemove",t=>{this.tip({x:0,y:t.y,label:this.titleDescription()})}).on("mouseout",t=>{this.tip(null)}),this._tooltipG=e.append("g").attr("class","annotation-tip")}update(t,e){super.update(t,e),this._colorScale.domain(this.colorDomain()).range(this.colorRange()),e.attr("title",this.tooltip()).style("cursor",this.click!==_Gauge.prototype.click?"pointer":null);const n=this.calcWidth()/3,o=this.calcWidth()/2-5;this._d3Arc.innerRadius(n).outerRadius(o);const s=this.value(),a=this.tickValue();this._usageArc.style("fill",this._colorScale(s)).transition().duration(750).attrTween("d",gs(ys(0),ys(s),this._d3Arc)),this._freeArc.style("fill",this.emptyColor()).transition().duration(750).attrTween("d",gs(ys(s),ys(1),this._d3Arc)),this._meanArc.style("fill",this.tickColor()).style("visibility",this.showTick()?"visible":"hidden").transition().duration(750).attrTween("d",gs(ys(a-.001),ys(a+.001),this._d3Arc)),this._indInner.style("fill",this.tickColor()).style("stroke",this.tickColor()).style("visibility",this.showTick()?"visible":"hidden").transition().duration(750).attrTween("transform",ms(ys(a),n,!0)),this._indOuter.style("fill",this.tickColor()).style("stroke",this.tickColor()).style("visibility",this.showTick()?"visible":"hidden").transition().duration(750).attrTween("transform",ms(ys(a),o)),this._centerText.style("fill",this._colorScale(s)).text(i.format(".0%")(s)),this._bottomText.style("fill",this.click!==_Gauge.prototype.click?this.titleClickColor():this.titleColor()).style("text-decoration",this.click!==_Gauge.prototype.click?"underline":null).text(this.title());const r=_s(ys(1),n-8);this.updateText(this._centerText,-r.x,-r.y,2*r.x,2*r.y);const l=_s(ys(1),o);l.y+=5;const h=this.calcWidth()-20,c=this.calcWidth()/2-l.y-5;this.updateText(this._bottomText,-h/2,l.y,h,c),this._mainTooltip.text(this.tooltip())}click(t){}};s(bs,"Gauge");let vs=bs;vs.prototype._class+=" chart_Gauge",vs.prototype.publish("title","","string","Title"),vs.prototype.publish("titleDescription","","string","Title Description"),vs.prototype.publish("titleColor","black","html-color","Color of the title text"),vs.prototype.publish("titleClickColor","blue","html-color","Color of the title text when clickable"),vs.prototype.publish("maxDiameter",128,"number","Max Diameter"),vs.prototype.publish("value",0,"number","Value"),vs.prototype.publish("valueDescription","","string","Value Description"),vs.prototype.publish("showTick",!1,"boolean","Show Tick"),vs.prototype.publish("tickValue",0,"number","Tick Value"),vs.prototype.publish("tickValueDescription","","string","Tick Value Description"),vs.prototype.publish("tooltip","","string","Tooltip"),vs.prototype.publish("colorRange",["green","green","green","green","green","green","green","green","orange","red","red"],"array","Array of colors for the filled gauge portion. The fill color will be relative to the gauge value."),vs.prototype.publish("colorDomain",[0,.1,.2,.3,.4,.5,.6,.7,.8,.9,1],"array","This array augments the mapping of the value to the fill colorRange."),vs.prototype.publish("emptyColor","lightgrey","html-color","Color of the empty portion of the gauge"),vs.prototype.publish("tickColor","black","html-color","Color of the tick");const ws=s((t,e)=>t[1]-e[1]>0?1:-1,"sortAscending"),Ss=s((t,e)=>t[1]-e[1]>0?-1:1,"sortDescending"),As=class _Pie extends i.SVGWidget{_totalValue;d3Pie;d3Arc;d3LabelArc;_labelPositions;_smallValueLabelHeight;_labelWidthLimit;_quadIdxArr;_minLabelTop=0;_maxLabelBottom=0;_seriesValueFormatter;_seriesPercentageFormatter;constructor(){super(),e.I2DChart.call(this),e.ITooltip.call(this),i.Utility.SimpleSelectionMixin.call(this),this.d3Pie=V(),this.d3Arc=E(),this.d3LabelArc=E(),this.tooltipTick_default(!1).tooltipOffset_default(0)}intersection(t,e){return this.intersectCircle(this.calcOuterRadius(),t,e)}calcInnerRadius(){return this.innerRadius_exists()?this.calcOuterRadius()*this.innerRadius()/100:0}calcOuterRadius(){const t=this.textSize(this.data().map(t=>this.getLabelText({data:t},!1)),"Verdana",12).width,e=this._size.width-(this.showLabels()?2*t:0)-20,i=this._size.height-36-(this.showLabels()?this._smallValueLabelHeight:0),n=Math.min(e,i)/2-2;return e/2-2<this.minOuterRadius()?this._labelWidthLimit=t-(this.minOuterRadius()-(e/2-2)):this._labelWidthLimit=t,n<this.minOuterRadius()?this.minOuterRadius():n}calcSmallValueLabelHeight(){const t=this.data().reduce((t,e)=>t+e[1],0);let e=0;return this.data().forEach(i=>{i[1]/t<.1&&e++}),this.labelHeight()*e}calcTotalValue(){return this.data().reduce((t,e)=>t+e[1],0)}getLabelText(t,e){let i,n=t.data[0];if(void 0!==this._labelWidthLimit&&e){const t=this.textSize(n,"Verdana",this.labelHeight()).width;this._labelWidthLimit<t&&(i=n.length*(this._labelWidthLimit/t)-3,n=i<n.length?n.slice(0,i)+"...":n)}if(this.showSeriesValue()&&(n+=` : ${this._seriesValueFormatter(t.data[1])}`),this.showSeriesPercentage()){let e=this._totalValue;const i=this.dataMeta();void 0!==i.sum&&(e=i.sum);const o=t.data[1]/e*100;n+=` : ${this._seriesPercentageFormatter(o)}%`}return n}selection(t){if(!arguments.length)try{return this._selection.selection2()[0]?.data}catch(i){return}const e=JSON.stringify(t);this._selection.selection2(t=>e===JSON.stringify(t.data))}selectByLabel(t){const e=this.data().filter(e=>e[0]===t)[0];e&&this.selection(e)}_slices;_labels;enter(t,e){super.enter(t,e),this._selection.widgetElement(e),this._slices=e.append("g"),this._labels=e.append("g");const i=this;this.tooltipHTML(function(t){return"series-table"===i.tooltipStyle()?i.tooltipFormat({label:t.data[0],arr:i.columns().slice(1).map(function(e,n){return{label:e,color:i._palette(t.data[0]),value:t.data[n+1]}})}):i.tooltipFormat({label:t.data[0],value:t.data[1]})})}update(t,e){super.update(t,e);const n=this;this.updateD3Pie(),this._palette=this._palette.switch(this.paletteID()),this._seriesValueFormatter=i.format(this.seriesValueFormat()),this._seriesPercentageFormatter=i.format(this.seriesPercentageFormat()),this.useClonedPalette()&&(this._palette=this._palette.cloneNotExists(this.paletteID()+"_"+this.id())),this._smallValueLabelHeight=this.calcSmallValueLabelHeight(),this._totalValue=this.calcTotalValue();const o=this.calcInnerRadius(),a=this.calcOuterRadius(),r=a+12;this.d3Arc.innerRadius(o).padRadius(a).outerRadius(a),this._quadIdxArr=[[],[],[],[]];const l=[...this.data()];switch(this.sortDataByValue()){case"ascending":l.sort(ws);break;case"descending":l.sort(Ss)}const h=this._slices.selectAll(".arc").data(this.d3Pie(l),t=>t.data[0]);this._labelPositions=[],h.enter().append("g").attr("class",(t,e)=>"arc series series-"+this.cssTag(t.data[0])).attr("opacity",0).call(this._selection.enter.bind(this._selection)).on("click",function(t){n.click(n.rowToObj(t.data),n.columns()[1],n._selection.selected(this))}).on("dblclick",function(t){n.dblclick(n.rowToObj(t.data),n.columns()[1],n._selection.selected(this))}).each(function(t,e){i.select(this).append("path").on("mouseout.tooltip",n.tooltip.hide).on("mousemove.tooltip",n.tooltip.show).on("mouseover",f(0,0)).on("mouseout",f(-5,150))}).merge(h).transition().attr("opacity",1).each(function(t,e){const o=n.getQuadrant(d(t));n._quadIdxArr[o].push(e),t.outerRadius=a-5;i.select(this).select("path").transition().attr("d",n.d3Arc).style("fill",n.fillColor(t.data,n.columns()[1],t.data[1]))}),h.exit().transition().style("opacity",0).remove(),this.d3LabelArc.innerRadius(r).outerRadius(r);const c=this._labels.selectAll("text").data(this.showLabels()?this.d3Pie(l):[],t=>t.data[0]),u=c.enter().append("text").on("mouseout.tooltip",n.tooltip.hide).on("mousemove.tooltip",n.tooltip.show).attr("dy",".5em").on("click",function(t){n._slices.selectAll("g").filter(function(e){t.data===e.data&&(n._selection.click(this),n.click(n.rowToObj(t.data),n.columns()[1],n._selection.selected(this)))})}).on("dblclick",function(t){n._slices.selectAll("g").filter(function(e){t.data===e.data&&n.dblclick(n.rowToObj(t.data),n.columns()[1],n._selection.selected(this))})}).merge(c).text(t=>this.getLabelText(t,!0)).each(function(t,e){const i=n.d3LabelArc.centroid(t),o=d(t);i[0]=r*(n.isLeftSide(o)?1:-1),n._labelPositions.push({top:i[1],bottom:i[1]+n.labelHeight()})});this.showLabels()&&(this.adjustForOverlap(),u.transition().style("font-size",this.labelHeight()+"px").attr("transform",(t,e)=>{const i=n.d3LabelArc.centroid(t);return i[0]=r*(n.isLeftSide(d(t))?1:-1),i[1]=n._labelPositions[e].top,"translate("+i+")"}).style("text-anchor",t=>this.isLeftSide(d(t))?"start":"end")),c.exit().remove();const p=this._labels.selectAll("polyline").data(this.showLabels()?this.d3Pie(l):[],t=>this.getLabelText(t,!0));function d(t){return t.startAngle+(t.endAngle-t.startAngle)/2}function f(t,e){return function(){i.select(this).transition().delay(e).attrTween("d",function(e){const o=i.interpolate(e.outerRadius,a+t);return function(t){return e.outerRadius=o(t),n.d3Arc(e)}})}}p.enter().append("polyline").merge(p).transition().attr("points",function(t,e){const i=n.d3LabelArc.centroid(t),o=n.d3Arc.centroid(t),s=[...i];return i[0]=r*(n.isLeftSide(d(t))?1:-1),i[1]=n._labelPositions[e].top,[o,s,i]}),p.exit().remove(),this.showLabels()&&this.centerOnLabels(),s(d,"midAngle"),s(f,"arcTween")}isLeftSide(t){return(t=n.normalizeRadians(t))>2*Math.PI?t:t<Math.PI&&t>0}getQuadrant(t){let e=0;const i=n.normalizeRadians(t);return e=i<=1*Math.PI&&i>=.5*Math.PI?3:e,e=i<=.5*Math.PI&&i>=0*Math.PI?2:e,e=i<=0*Math.PI&&i>=-.5*Math.PI?1:e,e}centerOnLabels(){const t=this.pos().y,e=2*t,i=this.calcOuterRadius(),n=Math.min(this._minLabelTop,-i),o=Math.max(this._maxLabelBottom,i),s=e-(o-n),a=Math.abs(this._minLabelTop);let r=0;o>t?(r=t-o+this.labelHeight()/2,r-=s/2):n<0&&a>t&&(r=a-t+this.labelHeight()/2,r+=s/2);const l=this.pos();this.pos({y:l.y+r,x:l.x})}adjustForOverlap(){const t=this.labelHeight();this._quadIdxArr.forEach((e,i)=>{let n;this._quadIdxArr[i].sort((t,e)=>1===i||2===i?this._labelPositions[t].top>this._labelPositions[e].top?-1:1:0===i||3===i?this._labelPositions[t].top>this._labelPositions[e].top?1:-1:void 0),this._quadIdxArr[i].forEach((e,o)=>{if(o>0)if(1===i||2===i){if(n<this._labelPositions[e].bottom){const t=this._labelPositions[e].bottom-n;this._labelPositions[e].top-=t,this._labelPositions[e].bottom-=t}}else if((0===i||3===i)&&n+t>this._labelPositions[e].top){const i=Math.abs(this._labelPositions[e].top)-Math.abs(n+t);this._labelPositions[e].top-=i,this._labelPositions[e].bottom-=i}n=this._labelPositions[e].top})}),this._minLabelTop=0,this._maxLabelBottom=0,this._quadIdxArr.forEach((t,e)=>{this._quadIdxArr[e].forEach((t,e)=>{this._minLabelTop>this._labelPositions[t].top&&(this._minLabelTop=this._labelPositions[t].top),this._maxLabelBottom<this._labelPositions[t].bottom&&(this._maxLabelBottom=this._labelPositions[t].bottom)})})}exit(t,e){super.exit(t,e)}updateD3Pie(){const t=n.normalizeRadians(n.degreesToRadians(this.startAngle()));switch(this.sortDataByValue()){case"ascending":this.d3Pie.sort(ws);break;case"descending":this.d3Pie.sort(Ss);break;default:this.d3Pie.sort(null)}this.d3Pie.padAngle(.0025).startAngle(t).endAngle(2*Math.PI+t).value(function(t){return t[1]})}};s(As,"Pie"),a(As,"__inputs",[{id:"label",type:"string"},{id:"value",type:"number"}]);let ks=As;ks.prototype._class+=" chart_Pie",ks.prototype.implements(e.I2DChart.prototype),ks.prototype.implements(e.ITooltip.prototype),ks.prototype.mixin(i.Utility.SimpleSelectionMixin),ks.prototype.publish("showLabels",!0,"boolean","If true, wedge labels will display"),ks.prototype.publish("showSeriesValue",!1,"boolean","Append data series value next to label",null,{disable:s(t=>!t.showLabels(),"disable")}),ks.prototype.publish("seriesValueFormat",",.0f","string","Number format used for formatting series values",null,{disable:s(t=>!t.showSeriesValue(),"disable")}),ks.prototype.publish("showSeriesPercentage",!1,"boolean","Append data series percentage next to label",null,{disable:s(t=>!t.showLabels(),"disable")}),ks.prototype.publish("seriesPercentageFormat",",.0f","string","Number format used for formatting series percentages",null,{disable:s(t=>!t.showSeriesPercentage(),"disable")}),ks.prototype.publish("paletteID","default","set","Color palette for this widget",ks.prototype._palette.switch(),{tags:["Basic","Shared"]}),ks.prototype.publish("useClonedPalette",!1,"boolean","Enable or disable using a cloned palette",null,{tags:["Intermediate","Shared"]}),ks.prototype.publish("innerRadius",0,"number","Sets inner pie hole radius as a percentage of the radius of the pie chart",null,{tags:["Basic"],range:{min:0,step:1,max:100}}),ks.prototype.publish("minOuterRadius",20,"number","Minimum outer radius (pixels)"),ks.prototype.publish("startAngle",0,"number","Starting angle of the first (and largest) wedge (degrees)"),ks.prototype.publish("labelHeight",12,"number","Font size of labels (pixels)",null,{disable:s(t=>!t.showLabels(),"disable")}),ks.prototype.publish("sortDataByValue","descending","set","Sort data by value",["none","ascending","descending"]);const Ms=class _HalfPie extends ks{constructor(){super()}postUpdate(t,e){super.postUpdate(t,e);let i=this._pos.x,n=this._pos.y;"origin"===this._drawStartPos&&this._target instanceof SVGElement&&(i-=this._size.width/2,n-=this._size.height/2),n+=this._size.height/4,this._element.attr("transform","translate("+i+","+n+")scale("+this._widgetScale+")")}updateD3Pie(){super.updateD3Pie(),this.d3Pie.startAngle(-Math.PI/2).endAngle(Math.PI/2)}};s(Ms,"HalfPie");let Ts=Ms;Ts.prototype._class+=" chart_HalfPie";const Ps=class _Heat extends It{_domForeignObject;_domCanvas;_heat;constructor(){super(),this.xAxisGuideLines_default(!0).yAxisGuideLines_default(!0)}radius(t){return this.radiusX(t),this.radiusY(t),this}layerEnter(t,e,i=250){super.layerEnter(t,e,i),this._domForeignObject=this.svg.insert("foreignObject","#"+(this.id()+"_clippath")),this._domCanvas=this._domForeignObject.append("xhtml:body").style("margin","0px").style("padding","0px").style("background-color","transparent").append("canvas"),this._heat=Is(this._domCanvas.node())}layerUpdate(t,e,n=250){super.layerUpdate(t,e),this._palette=this._palette.switch(this.paletteID());let o=this.width()-this.margin.left-this.margin.right;o<0&&(o=0);let s=this.height()-this.margin.top-this.margin.bottom;s<0&&(s=0),this._domForeignObject.attr("x",this.margin.left).attr("y",this.margin.top).attr("width",o).attr("height",s),this._domCanvas.attr("width",o).attr("height",s);const a="horizontal"===t.orientation()?this.data().map(e=>[t.dataPos(e[0]),t.valuePos(e[1]),e[2]]):this.data().map(e=>[t.valuePos(e[1]),t.dataPos(e[0]),e[2]]),r=this.maxWeight_exists()?this.maxWeight():i.max(a,t=>t[2]);if("default"!==this.paletteID()){const t={},e=8,i=this.reversePalette();for(let n=0;n<e;++n)t[n/e]=this._palette((i?e-n:n)/e,0,1);this._heat.gradient(t)}else this._heat.gradient(this._heat.defaultGradient);this._heat.resize();const l=this.radiusAsPercent()?this.radiusX()*o/100:this.radiusX(),h=this.radiusAsPercent()?this.radiusY()*s/100:this.radiusY();this._heat.clear().radius(l,h,this.blur()).max(r).data(a).draw(this.minOpacity())}};s(Ps,"Heat");let Cs=Ps;function Is(t){if(!(this instanceof Is))return new Is(t);this._canvas=t="string"==typeof t?document.getElementById(t):t,this._ctx=t.getContext("2d"),this._width=t.width,this._height=t.height,this._max=1,this._data=[]}Cs.prototype._class+=" chart_Heat",Cs.prototype._palette=i.Palette.rainbow("default"),Cs.prototype.publish("paletteID","default","set","Color palette for this widget",Cs.prototype._palette.switch(),{tags:["Basic"]}),Cs.prototype.publish("useClonedPalette",!1,"boolean","Enable or disable using a cloned palette",null,{tags:["Intermediate","Shared"]}),Cs.prototype.publish("reversePalette",!1,"boolean","Reverse Palette Colors",null,{disable:s(t=>"default"===t.paletteID(),"disable")}),Cs.prototype.publish("radiusX",25,"number","Point X radius (25 by default)"),Cs.prototype.publish("radiusY",25,"number","Point Y radius (25 by default)"),Cs.prototype.publish("radiusAsPercent",!1,"boolean","Calculate RadiusX + RadiusY as % of size"),Cs.prototype.publish("blur",15,"number","Point blur radius (15 by default)"),Cs.prototype.publish("maxWeight",void 0,"number","Clamp max weight to value (optional), omitting uses max data point",void 0,{optional:!0}),Cs.prototype.publish("minOpacity",.05,"number","Minimum point opacity (0.05 by default)"),s(Is,"simpleheat"),Is.prototype={defaultRadius:25,defaultGradient:{.4:"blue",.6:"cyan",.7:"lime",.8:"yellow",1:"red"},data:s(function(t){return this._data=t,this},"data"),max:s(function(t){return this._max=t,this},"max"),add:s(function(t){return this._data.push(t),this},"add"),clear:s(function(){return this._data=[],this},"clear"),radius:s(function(t,e,i){i=void 0===i?15:i;const n=this._ellipse=this._createCanvas(),o=n.getContext("2d"),s=this._r=t+i,a=this._r=e+i;return n.width=2*s,n.height=2*a,o.shadowOffsetX=o.shadowOffsetY=2*s,o.shadowOffsetY=o.shadowOffsetY=2*a,o.shadowBlur=i,o.shadowColor="black",o.beginPath(),o.ellipse(-s,-a,t,e,0,0,2*Math.PI,!0),o.closePath(),o.fill(),this},"radius"),resize:s(function(){this._width=this._canvas.width,this._height=this._canvas.height},"resize"),gradient:s(function(t){const e=this._createCanvas(),i=e.getContext("2d"),n=i.createLinearGradient(0,0,0,256);e.width=1,e.height=256;for(const o in t)n.addColorStop(+o,t[o]);return i.fillStyle=n,i.fillRect(0,0,1,256),this._grad=i.getImageData(0,0,1,256).data,this},"gradient"),draw:s(function(t){this._ellipse||this.radius(this.defaultRadius,this.defaultRadius),this._grad||this.gradient(this.defaultGradient);const e=this._ctx;e.clearRect(0,0,this._width,this._height);for(let n,o=0,s=this._data.length;o<s;o++)n=this._data[o],n[2]<0?n[2]=0:n[2]>this._max&&(n[2]=this._max),e.globalAlpha=Math.max(n[2]/this._max,void 0===t?.05:t),e.drawImage(this._ellipse,n[0]-this._r,n[1]-this._r);const i=e.getImageData(0,0,this._width,this._height);return this._colorize(i.data,this._grad),e.putImageData(i,0,0),this},"draw"),_colorize:s(function(t,e){for(let i,n=0,o=t.length;n<o;n+=4)i=4*t[n+3],i&&(t[n]=e[i],t[n+1]=e[i+1],t[n+2]=e[i+2])},"_colorize"),_createCanvas:s(function(){return"undefined"!=typeof document?document.createElement("canvas"):new this._canvas.constructor},"_createCanvas")};var zs=Math.PI/3,Fs=[0,zs,2*zs,3*zs,4*zs,5*zs];function Ds(t){return t[0]}function Es(t){return t[1]}function Os(){var t,e,i,n=0,o=0,a=1,r=1,l=Ds,h=Es;function c(t){var n,o={},s=[],a=t.length;for(n=0;n<a;++n)if(!isNaN(c=+l.call(null,r=t[n],n,t))&&!isNaN(u=+h.call(null,r,n,t))){var r,c,u,p=Math.round(u/=i),d=Math.round(c=c/e-(1&p)/2),f=u-p;if(3*Math.abs(f)>1){var y=c-d,_=d+(c<d?-1:1)/2,x=p+(u<p?-1:1),m=c-_,g=u-x;y*y+f*f>m*m+g*g&&(d=_+(1&p?1:-1)/2,p=x)}var b=d+"-"+p,v=o[b];v?v.push(r):(s.push(v=o[b]=[r]),v.x=(d+(1&p)/2)*e,v.y=p*i)}return s}function u(t){var e=0,i=0;return Fs.map(function(n){var o=Math.sin(n)*t,s=-Math.cos(n)*t,a=o-e,r=s-i;return e=o,i=s,[a,r]})}return s(c,"hexbin"),s(u,"hexagon"),c.hexagon=function(e){return"m"+u(null==e?t:+e).join("l")+"z"},c.centers=function(){for(var s=[],l=Math.round(o/i),h=Math.round(n/e),c=l*i;c<r+t;c+=i,++l)for(var u=h*e+(1&l)*e/2;u<a+e/2;u+=e)s.push([u,c]);return s},c.mesh=function(){var e=u(t).slice(0,4).join("l");return c.centers().map(function(t){return"M"+t+"m"+e}).join("")},c.x=function(t){return arguments.length?(l=t,c):l},c.y=function(t){return arguments.length?(h=t,c):h},c.radius=function(n){return arguments.length?(e=2*(t=+n)*Math.sin(zs),i=1.5*t,c):t},c.size=function(t){return arguments.length?(n=o=0,a=+t[0],r=+t[1],c):[a-n,r-o]},c.extent=function(t){return arguments.length?(n=+t[0][0],o=+t[0][1],a=+t[1][0],r=+t[1][1],c):[[n,o],[a,r]]},c.radius(1)}s(Ds,"pointX"),s(Es,"pointY"),s(Os,"d3HexBin");const Rs=class _HexBin extends It{_hexbin;_dataMinWeight;_dataMaxWeight;constructor(){super(),e.I2DAggrChart.call(this),this.tooltipValueFormat_default(",.0f"),e.ITooltip.call(this),this.tooltipHTML(t=>{const e=i.extent(t,t=>t.label),n=i.extent(t,t=>t.value);return this.tooltipFormat({series:e[0]===e[1]?e[0]:`${e[0]} -> ${e[1]}`,label:n[0]===n[1]?n[0]:`${n[0]} -> ${n[1]}`,value:t.length})}),this._hexbin=Os().x(t=>t.x).y(t=>t.y),this.xAxisGuideLines_default(!1).yAxisGuideLines_default(!1).xAxisType_default("linear")}xPos(t,e){return"horizontal"===t.orientation()?t.dataPos(e.label):t.valuePos(e.value)}yPos(t,e){return"horizontal"===t.orientation()?t.valuePos(e.value):t.dataPos(e.label)}layerUpdate(t,e,n=250){super.layerUpdate(t,e,n);const o=this;this._palette=this._palette.switch(this.paletteID()),this.useClonedPalette()&&(this._palette=this._palette.cloneNotExists(this.paletteID()+"_"+this.id())),this._hexbin.extent([0,0],[this.width(),this.height()]).radius(this.binSize());const s=this.flattenData().map(e=>({x:o.xPos(t,e),y:o.yPos(t,e),label:t.parseData(e.label),value:t.parseValue(e.value),origRow:e})),a=this._hexbin(s),r=i.min(a,function(t){return t.length}),l=i.max(a,function(t){return t.length});this._dataMinWeight=r,this._dataMaxWeight=l;const h=e.selectAll(".hexagon").data(a,function(t){return t.i+"_"+t.j});h.enter().append("path").attr("class","hexagon").call(t._selection.enter.bind(t._selection)).on("click",function(e){const i=o.data();o.click(e.map(e=>t.rowToObj(i[e.origRow.rowIdx])),o.columns()[1],t._selection.selected(this))}).on("dblclick",function(e){const i=o.data();o.dblclick(e.map(e=>t.rowToObj(i[e.origRow.rowIdx])),o.columns()[1],t._selection.selected(this))}).on("mouseout.tooltip",o.tooltip.hide).on("mousemove.tooltip",o.tooltip.show).attr("transform",function(t){return"translate("+t.x+","+t.y+")scale(0)"}).merge(h).transition().duration(n).attr("d",this._hexbin.hexagon()).attr("transform",function(t){return"translate("+t.x+","+t.y+")scale(1)"}).style("fill",function(t){return o._palette(t.length,r,l)}),h.exit().transition().duration(n).attr("transform",function(t){return"translate("+t.x+","+t.y+")scale(0)"}).remove()}exit(t,e){super.exit(t,e)}click(t,e,i){}dblclick(t,e,i){}};s(Rs,"HexBin"),a(Rs,"__inputs",[{id:"x",type:"any"},{id:"y",type:"number"}]);let js=Rs;js.prototype._class+=" chart_HexBin",js.prototype.implements(e.I2DAggrChart.prototype),js.prototype.implements(e.ITooltip.prototype),js.prototype.publish("paletteID","Blues","set","Color palette for this widget",js.prototype._palette.switch(),{tags:["Basic","Shared"]}),js.prototype.publish("useClonedPalette",!1,"boolean","Enable or disable using a cloned palette",null,{tags:["Intermediate","Shared"]}),js.prototype.publish("binSize",20,"number","Bin radius",null,{range:{min:1,max:300,step:1}});const Ns=class _Line extends Ft{constructor(){super(),this.interpolate_default("linear")}};s(Ns,"Line");let Ls=Ns;Ls.prototype._class+=" chart_Line";const Bs=class _QuarterPie extends ks{constructor(){super()}postUpdate(t,e){super.postUpdate(t,e);let i="left"===this.orientation()?0:this._size.width,n=this._size.height;"origin"===this._drawStartPos&&this._target instanceof SVGElement&&(i-=this._size.width/2,n-=this._size.height/2),this._element.attr("transform","translate("+i+","+n+")scale("+this._widgetScale+")")}updateD3Pie(){super.updateD3Pie(),this.d3Pie.startAngle("left"===this.orientation()?0:-Math.PI/2).endAngle("left"===this.orientation()?Math.PI/2:0)}calcOuterRadius(){const t=this.textSize(this.data().map(t=>this.getLabelText({data:t})),"Verdana",12).width;return Math.min(this._size.width-t-10,this._size.height-36)-2}};s(Bs,"QuarterPie");let $s=Bs;$s.prototype._class+=" chart_QuarterPie",$s.prototype.publish("orientation","left","set","Determines the placement and start/end angle.",["left","right"]);const Hs=class _QuartileCandlestick extends i.SVGWidget{_g;_leftLine;_rightLine;_midLine;_midOuterRect;_midInnerRect1;_midInnerRect2;_q0text;_q1text;_q2text;_q3text;_q4text;_q0val;_q1val;_q2val;_q3val;_q4val;constructor(){super()}enter(t,e){super.enter(t,e),this._g=e.append("g"),this._leftLine=this._g.append("rect"),this._rightLine=this._g.append("rect"),this._midLine=this._g.append("rect"),this._midOuterRect=this._g.append("rect"),this._midInnerRect1=this._g.append("rect"),this._midInnerRect2=this._g.append("rect"),this._q0text=this._g.append("text"),this._q1text=this._g.append("text"),this._q2text=this._g.append("text"),this._q3text=this._g.append("text"),this._q4text=this._g.append("text"),this._q0val=this._g.append("text"),this._q1val=this._g.append("text"),this._q2val=this._g.append("text"),this._q3val=this._g.append("text"),this._q4val=this._g.append("text")}update(t,e){super.update(t,e);const n=("horizontal"===this.orientation()?this.width():this.height())-this.lineWidth(),o="horizontal"===this.orientation()?this.height():this.width(),s=i.scaleLinear().domain([this.data()[0],this.data()[4]]).range([this.edgePadding(),n-this.edgePadding()]),a=this.candleWidth_exists()?this.candleWidth():o,r=this.lineWidth(),l=this.lineColor(),h=this.roundedCorners(),c=this.edgePadding();let u=s(this.data()[1]),p=s(this.data()[2]),d=s(this.data()[3]);const f=-a/2,y=a/2,_=this.upperTextRotation(),x=this.lowerTextRotation(),m=this.textPadding(),g=this.labelFontSize(),b=this.valueFontSize(),v=Math.max(g,b),w=n-c;if(v>0){for(;u-c<v;)u+=v;for(;p-u<v;)p+=v;for(;d-p<v;)d+=v;for(;w-d<v;)d-=v;for(;d-p<v;)p-=v;for(;p-u<v;)u-=v}let S=-n/2-this.lineWidth()/2,A=0,k=0;let M=1,T="start",P="end";"vertical"===this.orientation()&&(S=0,A=n/2+this.lineWidth()/2,k=-90,T="end",P="start",M=-1),this._g.style("shape-rendering","crispEdges").attr("transform",`translate(${S},${A})rotate(${k})scale(1)`),this._leftLine.attr("fill",l).attr("height",a).attr("width",r).attr("x",c).attr("y",f).attr("rx",h).attr("ry",h),this._rightLine.attr("class","right-line").attr("fill",l).attr("height",a).attr("width",r).attr("x",w).attr("y",f).attr("rx",h).attr("ry",h),this._midLine.attr("fill",l).attr("height",r).attr("width",w-c).attr("x",c).attr("y",-r/2),this._midOuterRect.attr("fill",l).attr("height",a).attr("width",d-u).attr("x",u).attr("y",f).attr("rx",h).attr("ry",h),this._midInnerRect1.attr("fill",this.innerRectColor()).attr("height",a-2*r).attr("width",p-(u+2*r)).attr("x",u+r).attr("y",r-a/2).attr("rx",.618*h).attr("ry",.618*h),this._midInnerRect2.attr("fill",this.innerRectColor()).attr("height",a-2*r).attr("width",d-p-r).attr("x",p).attr("y",r-a/2).attr("rx",.618*h).attr("ry",.618*h),this._q0text.attr("height",a).attr("width",d-u).attr("display",this.showLabels()?null:"none").attr("fill",this.textColor()).attr("x",0).attr("y",0).attr("transform",`translate(${c}, ${f-m})rotate(${_})scale(${M})`).attr("font-size",g).attr("text-anchor",T).attr("alignment-baseline","hanging").text(this.columns()[0]),this._q1text.attr("height",a).attr("width",d-u).attr("display",this.showLabels()?null:"none").attr("fill",this.textColor()).attr("x",0).attr("y",0).attr("transform",`translate(${u}, ${f-m})rotate(${_})scale(${M})`).attr("font-size",g).attr("text-anchor",T).attr("alignment-baseline","middle").text(this.columns()[1]),this._q2text.attr("height",a).attr("width",d-u).attr("display",this.showLabels()?null:"none").attr("fill",this.textColor()).attr("x",0).attr("y",0).attr("transform",`translate(${p}, ${f-m})rotate(${_})scale(${M})`).attr("font-size",g).attr("text-anchor",T).attr("alignment-baseline","middle").text(this.columns()[2]),this._q3text.attr("height",a).attr("width",d-u).attr("display",this.showLabels()?null:"none").attr("fill",this.textColor()).attr("x",0).attr("y",0).attr("transform",`translate(${d}, ${f-m})rotate(${_})scale(${M})`).attr("font-size",g).attr("text-anchor",T).attr("alignment-baseline","middle").text(this.columns()[3]),this._q4text.attr("height",a).attr("width",d-u).attr("display",this.showLabels()?null:"none").attr("fill",this.textColor()).attr("x",0).attr("y",0).attr("transform",`translate(${w+r}, ${f-m})rotate(${_})scale(${M})`).attr("font-size",g).attr("text-anchor",T).attr("alignment-baseline","baseline").text(this.columns()[4]),this._q0val.attr("height",a).attr("width",d-u).attr("display",this.showValues()?null:"none").attr("fill",this.textColor()).attr("x",0).attr("y",0).attr("transform",`translate(${c}, ${y+m})rotate(${x})scale(${M})`).attr("font-size",b).attr("text-anchor",P).attr("alignment-baseline","hanging").text(this.data()[0]),this._q1val.attr("height",a).attr("width",d-u).attr("display",this.showValues()?null:"none").attr("fill",this.textColor()).attr("x",0).attr("y",0).attr("transform",`translate(${u}, ${y+m})rotate(${x})scale(${M})`).attr("font-size",b).attr("text-anchor",P).attr("alignment-baseline","middle").text(this.data()[1]),this._q2val.attr("height",a).attr("width",d-u).attr("display",this.showValues()?null:"none").attr("fill",this.textColor()).attr("x",0).attr("y",0).attr("transform",`translate(${p}, ${y+m})rotate(${x})scale(${M})`).attr("font-size",b).attr("text-anchor",P).attr("alignment-baseline","middle").text(this.data()[2]),this._q3val.attr("height",a).attr("width",d-u).attr("display",this.showValues()?null:"none").attr("fill",this.textColor()).attr("x",0).attr("y",0).attr("transform",`translate(${d}, ${y+m})rotate(${x})scale(${M})`).attr("font-size",b).attr("text-anchor",P).attr("alignment-baseline","middle").text(this.data()[3]),this._q4val.attr("height",a).attr("width",d-u).attr("display",this.showValues()?null:"none").attr("fill",this.textColor()).attr("x",0).attr("y",0).attr("transform",`translate(${w+r}, ${y+m})rotate(${x})scale(${M})`).attr("font-size",b).attr("text-anchor",P).attr("alignment-baseline","baseline").text(this.data()[4])}};s(Hs,"QuartileCandlestick");let Vs=Hs;Vs.prototype._class+=" chart_QuartileCandlestick",Vs.prototype.publish("textColor","black","html-color","Color of label and value text"),Vs.prototype.publish("showLabels",!0,"boolean","If true, labels will be shown"),Vs.prototype.publish("showValues",!0,"boolean","If true, values will be shown"),Vs.prototype.publish("orientation","horizontal","set","Determines layout",["horizontal","vertical"]),Vs.prototype.publish("valueFontSize",12,"number","Font size of value text (pixels)"),Vs.prototype.publish("labelFontSize",12,"number","Font size of label text (pixels)"),Vs.prototype.publish("roundedCorners",8,"number","Radius of rounded rect corners (pixels)"),Vs.prototype.publish("lineWidth",4,"number","Width of lines (pixels)"),Vs.prototype.publish("candleWidth",null,"number","Height of outer rect (pixels)",null,{optional:!0}),Vs.prototype.publish("textPadding",8,"number","Padding between outer rect and text (pixels)"),Vs.prototype.publish("edgePadding",30,"number","Padding between outer rect and left/right sides (pixels)"),Vs.prototype.publish("lineColor","#333","html-color","Color of outer rect and lines"),Vs.prototype.publish("innerRectColor","white","html-color","Color of the inner rects"),Vs.prototype.publish("upperTextRotation",-60,"number","Rotation of label text (degrees)"),Vs.prototype.publish("lowerTextRotation",-60,"number","Rotation of value text (degrees)");const qs=class _Radar extends i.SVGWidget{constructor(){super(),e.INDChart.call(this),e.ITooltip.call(this),i.Utility.SimpleSelectionMixin.call(this)}mapShape(t){switch(t){case"rectangle":return"rect";case"circle":return"circle";case"cross":return"path"}}setPointAttributes(t,e,i){const n=this;switch(this.mapShape(this.pointShape())){case"rect":t.attr("width",n.pointSize()).attr("height",n.pointSize()).style("fill",t=>this.strokeColor(t.data,t.column,t.value));break;case"circle":t.attr("r",n.pointSize()/2).attr("cx",e).attr("cy",i).style("fill",t=>this.strokeColor(t.data,t.column,t.value));break;case"path":const o=n.pointSize()/2;t.attr("d",function(t){return"M"+(e-o)+" "+(i-o)+" L"+(e+o)+" "+(i+o)+" M"+(e-o)+" "+(i+o)+" L"+(e+o)+" "+(i-o)}).style("stroke",t=>this.strokeColor(t.data,t.column,t.value))}}enter(t,e){super.enter(t,e),this._selection.widgetElement(e),this.tooltipHTML(t=>this.tooltipFormat({label:t.label,series:t.column,value:t.value}))}update(t,e){super.update(t,e),this._palette=this._palette.switch(this.paletteID());const n=this,o=this.height()/2,s=this.width()/2,a=this.columns(),r=this.data(),l=this.flattenData(a,r).map((t,e)=>(t.shape=this.mapShape(this.pointShape()),t.column=a[t.colIdx],t.row=r[e],t)),h=[],c=this.degrees2radians(360/this.data().length),u=this.fontSize();let p=0;l.filter(t=>1===t.colIdx).forEach(t=>{const e=super.textSize(t.label,`${this.fontFamily()}`,this.fontSize());p<e.width&&(p=e.width)});const d=Math.min(o-u,s-p),f=e.selectAll(".label").data(l.filter(t=>1===t.colIdx)),y=Math.max.apply(n,l.map(t=>t.value));f.enter().append("text").attr("class","label").attr("text-anchor","middle").merge(f).attr("font-size",this.fontSize()).attr("font-family",this.fontFamily()).each(function(t,e){const o=n.polar2cartesian(d,e*c-Math.PI/2);h.push(o.map(t=>t*n.labelPaddingRatio()));let s="middle";const a=Math.round(o[0]);s=a>0?"start":s,s=a<0?"end":s,i.select(this).attr("text-anchor",s).attr("x",o[0]).attr("y",o[1])}).text(t=>t.label),f.exit().remove();const _=e.selectAll(".domain").data(l.filter(t=>1===t.colIdx));_.enter().append("line").classed("domain",!0).style("stroke","#000").style("stroke-opacity","0.75").style("stroke-width","1px").merge(_).attr("x1",0).attr("y1",0).attr("x2",(t,e)=>h[e][0]).attr("y2",(t,e)=>h[e][1]),_.exit().remove();const x=e.selectAll(".value_guide").data(this.valueGuideRatios());x.enter().append("polygon").classed("value_guide",!0).style("stroke","grey").style("stroke-opacity","0.75").style("stroke-width","0.3px").merge(x).each(function(t,e){const n=[];h.forEach((e,i)=>{n.push([e[0]*t,e[1]*t])}),i.select(this).attr("points",n.join(" ")).attr("stroke","rgb(0, 0, 0)").attr("stroke-opacity",.75).attr("stroke-width",.3).attr("fill-opacity",0)}),x.exit().remove();const m=e.selectAll(".value_guide_text").data(this.valueGuideRatios());m.enter().append("text").attr("class","value_guide_text").attr("text-anchor","start").attr("font-size",this.fontSize()).attr("font-family",this.fontFamily()).merge(m).attr("x",2).attr("y",t=>h[0][1]*t).text((t,e)=>Math.round(t*y)),x.exit().remove();const g=e.selectAll(".area").data(a.filter((t,e)=>e>0));g.enter().append("polygon").attr("class","area").style("stroke-opacity","0.75").style("stroke-width","0.3px").merge(g).style("stroke",t=>this.strokeColor([],t,0)).style("fill",t=>this.fillColor([],t,0)).style("fill-opacity",this.fillOpacity()).attr("points",(t,e)=>h.map((t,i)=>{const n=r[i][e+1],o=0===n?0:n/y;return t[0]*o+","+t[1]*o}).join(" ")),g.exit().remove();const b=e.selectAll(".point").data(l);b.enter().append("g").attr("class","point").on("mouseout.tooltip",n.tooltip.hide).on("mousemove.tooltip",n.tooltip.show).on("click",function(t,e){const i=n.data()[t.rowIdx],o=n.rowToObj(i),s=n._selection.selected(this);n.click(o,n.columns()[t.colIdx],s)}).on("dblclick",function(t,e){n.dblclick(n.rowToObj(n.data()[t.rowIdx]),t.column,n._selection.selected(this))}).each(function(t){const e=i.select(this);e.append("circle").attr("class","pointSelection").attr("r",n.pointSize()).call(n._selection.enter.bind(n._selection)),e.append(n.mapShape(n.pointShape())).attr("class","pointShape")}).merge(b).each(function(t){const e=i.select(this),o=0===t.value?0:t.value/y,s=h[t.rowIdx][0]*o,a=h[t.rowIdx][1]*o;e.select(".pointSelection").attr("cx",s).attr("cy",a);const r=e.select(".pointShape").style("stroke",n.strokeColor(t.row,t.column,t.value)).style("fill",n.fillColor(t.row,t.column,t.value));n.setPointAttributes(r,s,a)}),b.exit().remove()}polar2cartesian(t,e){return[t*Math.cos(e),t*Math.sin(e)]}cartesian2polar(t,e){return[Math.atan2(e,t),Math.sqrt(t*t+e*e)]}degrees2radians(t){return t/57.295779513}radians2degrees(t){return 57.295779513*t}point_in_polygon(t,e){const i=t[0],n=t[1];let o=!1;for(let s=0,a=e.length-1;s<e.length;a=s++){const t=e[s][0],r=e[s][1],l=e[a][0],h=e[a][1];r>n!=h>n&&i<(l-t)*(n-r)/(h-r)+t&&(o=!o)}return o}};s(qs,"Radar");let Ws=qs;Ws.prototype._class+=" chart_Radar",Ws.prototype.implements(e.INDChart.prototype),Ws.prototype.implements(e.ITooltip.prototype),Ws.prototype.mixin(i.Utility.SimpleSelectionMixin),Ws.prototype.publish("paletteID","default","set","Color palette for this widget",Ws.prototype._palette.switch()),Ws.prototype.publish("pointShape","cross","set","pointShape",["circle","rectangle","cross"]),Ws.prototype.publish("pointSize",6,"number","Point Size",null,{range:{min:1,step:1,max:200}}),Ws.prototype.publish("valueGuideRatios",[.2,.4,.6,.8,1],"array","Array of values between 0 and 1 that are multiplied by the widget radius to produce guide lines"),Ws.prototype.publish("fillOpacity",.66,"number","Opacity of the data polygon(s)"),Ws.prototype.publish("fontFamily","","string","fontFamily"),Ws.prototype.publish("fontSize",16,"number","fontSize"),Ws.prototype.publish("labelPaddingRatio",.9,"number","labelPaddingRatio");const Gs=class _RadialBar extends i.SVGWidget{_domainScale=i.scaleBand();_valueScale=i.scaleLinear();_d3Arc=E().startAngle(0).endAngle(t=>this._valueScale(t[1]));_arcs;_axialAxis;_radialAxis;constructor(){super(),e.INDChart.call(this),e.ITooltip.call(this),i.Utility.SimpleSelectionMixin.call(this)}enter(t,e){super.enter(t,e),this._selection.widgetElement(e),this.tooltipHTML(t=>this.tooltipFormat({label:t[0],value:t[1]})),this._radialAxis=e.append("g").attr("class","r axis"),this._axialAxis=e.append("g").attr("class","a axis"),this._arcs=e.append("g").attr("class","data")}update(t,e){super.update(t,e);const n=this,o=Math.max(this.valueDomainHigh_exists()?this.valueDomainHigh():0,...this.data().map(t=>t[1]));this._valueScale.domain([0,o]).range([0,this.radians(this.valueMaxAngle())]);const s=this._valueScale.ticks(this.tickCount()),a=this.textSize(s.map(t=>""+t),"Verdana",12).width,r=Math.min(this.width()-2*(10+a),this.height()-44)/2,l=this.data().map(t=>t[0]);this._domainScale.domain(l).range([0,r]).padding(this.domainPadding());const h=this._domainScale.step()*this._domainScale.padding(),c=this._radialAxis.selectAll("circle").data(l);c.enter().append("circle").attr("fill","transparent").merge(c).attr("r",t=>this._domainScale(t)+this._domainScale.step()-h/2),c.exit().remove();const u=this._radialAxis.selectAll(".arc-text").data(l);u.enter().append("text").attr("class","arc-text").attr("x",-4).attr("alignment-baseline","middle").attr("text-anchor","end").merge(u).attr("y",t=>-this._domainScale(t)-this._domainScale.bandwidth()/2).text(t=>t),u.exit().remove();const p=this._axialAxis.selectAll("line").data(s);p.enter().append("line").merge(p).attr("x2",t=>r*Math.cos(this._valueScale(t)-this.radians(90))).attr("y2",t=>r*Math.sin(this._valueScale(t)-this.radians(90))),p.exit().remove();const d=this._axialAxis.selectAll("text").data(s);d.enter().append("text").style("dominant-baseline","central").merge(d).attr("x",t=>(r+10)*Math.cos(this._valueScale(t)-this.radians(90))).attr("y",t=>(r+10)*Math.sin(this._valueScale(t)-this.radians(90))).style("text-anchor",t=>{const e=this.degrees(this._valueScale(t));return e>=0&&e<=20||e>=160&&e<=200||e>=340&&e<=360?"middle":e>=180&&e<=360?"end":null}).text(t=>t),d.exit().remove();const f=this.columns().length>1?this.columns()[1]:"";this._d3Arc.innerRadius(t=>this._domainScale(t[0])).outerRadius(t=>this._domainScale(t[0])+this._domainScale.bandwidth());const y=this._arcs.selectAll("path").data(this.data(),t=>t[0]);y.enter().append("path").attr("class","arc").call(this._selection.enter.bind(this._selection)).on("mouseout.tooltip",this.tooltip.hide).on("mousemove.tooltip",this.tooltip.show).on("click",function(t,e){n.click(n.rowToObj(t),f,n._selection.selected(this))}).on("dblclick",function(t,e){n.dblclick(n.rowToObj(t),f,n._selection.selected(this))}).merge(y).style("fill",(t,e)=>this.fillColor(t,t[0],t[1])).transition().delay((t,e)=>e*this.transitionDelay()).duration(this.transitionDuration()).attrTween("d",(t,e)=>{const n=i.interpolate(t._current||0,t[1]);return t._current=t[1],i=>this._d3Arc([t[0],n(i)],e)}),y.exit().remove()}degrees(t){return 180*t/Math.PI}radians(t){return t*Math.PI/180}};s(Gs,"RadialBar"),a(Gs,"__inputs",[{id:"label",type:"any"},{id:"values",type:"number"}]);let Xs=Gs;Xs.prototype._class+=" chart_RadialBar",Xs.prototype.implements(e.INDChart.prototype),Xs.prototype.implements(e.ITooltip.prototype),Xs.prototype.mixin(i.Utility.SimpleSelectionMixin),Xs.prototype.publish("paletteID","default","set","Color palette for this widget",Xs.prototype._palette.switch()),Xs.prototype.publish("tickCount",10,"number","Number of ticks to display"),Xs.prototype.publish("domainPadding",.25,"number","Padding between chart edge and container edge (0..1)"),Xs.prototype.publish("valueMaxAngle",270,"number","Maximum angular length of a bar (degrees)"),Xs.prototype.publish("valueDomainHigh",null,"number","Value domain high",void 0,{optional:!0}),Xs.prototype.publish("transitionDelay",100,"number","Delay between the start of each row animation (ms)"),Xs.prototype.publish("transitionDuration",750,"number","Duration of a row's animation (ms)");const Ys=i.Palette.rainbow("Blues"),Us=i.Palette.ordinal("Quartile",[Ys(100,0,100),Ys(50,0,100),Ys(50,0,100),Ys(75,0,100)]);function Qs(t){const e=i.format(t);return function(t){const i=(Math.round(100*t)/100).toString();return i.length<=4?i:e(t)}}Us("Std. Dev."),Us("MinMax"),Us("25%"),Us("50%"),s(Qs,"myFormatter");const Zs=class _StatChart extends i.HTMLWidget{_selectElement;_tickFormatter;_bellCurve=(new Ft).columns(["","Std. Dev."]).paletteID("Quartile").interpolate_default("basis").pointSize(0).xAxisType("linear").xAxisOverlapMode("none").xAxisTickFormat(",").yAxisHidden(!0).yAxisDomainLow(0).yAxisDomainHigh(110).yAxisGuideLines(!1);_candle=(new Vs).columns(["Min","25%","50%","75%","Max"]).edgePadding(0).roundedCorners(1).lineWidth(1).upperTextRotation(-90).lowerTextRotation(-90).labelFontSize(0).valueFontSize(0).lineColor(Ys(90,0,100)).innerRectColor(Ys(10,0,100));constructor(){super(),this.columns(["Min","25%","50%","75%","Max","Mean","Std. Dev."])}stdDev(t){return this.mean()+t*this.standardDeviation()}formatStdDev(t){return this._tickFormatter(this.stdDev(t))}quartile(t){return this.quartiles()[t]}formatQ(t){return this._tickFormatter(this.quartile(t))}domain(t){switch(t){case"25_75":return[this.quartile(1),this.quartile(3)];case"normal":return[this.stdDev(-4),this.stdDev(4)];default:return[this.quartile(0),this.quartile(4)]}}min(){return this.quartile(0)}max(){return this.quartile(4)}data(t){if(!arguments.length)return[[...this.quartiles(),this.mean(),this.standardDeviation()]];const e=t[0];return this.quartiles([e[0],e[1],e[2],e[3],e[4]]),this.mean(e[5]),this.standardDeviation(e[6]),this}enter(t,e){super.enter(t,e),this._bellCurve.target(e.append("div").node()),this._candle.target(e.append("div").node()),this._selectElement=e.append("div").style("position","absolute").style("top","0px").style("right","0px").append("select").on("change",()=>{this.view(this._selectElement.node().value),this.lazyRender()}),this._selectElement.append("option").attr("value","min_max").text("Min / Max"),this._selectElement.append("option").attr("value","25_75").text("25% / 75%"),this._selectElement.append("option").attr("value","normal").text("Normal")}bellTicks(t){let e;switch(t){case"25_75":e=[{label:this.formatQ(1),value:this.quartile(1)},{label:this.formatQ(2),value:this.quartile(2)},{label:this.formatQ(3),value:this.quartile(3)}];break;case"normal":e=[{label:this.formatStdDev(-4),value:this.stdDev(-4)},{label:"-3σ",value:this.stdDev(-3)},{label:"-2σ",value:this.stdDev(-2)},{label:"-1σ",value:this.stdDev(-1)},{label:this.formatStdDev(0),value:this.stdDev(0)},{label:"+1σ",value:this.stdDev(1)},{label:"+2σ",value:this.stdDev(2)},{label:"+3σ",value:this.stdDev(3)},{label:this.formatStdDev(4),value:this.stdDev(4)}];break;default:e=[{label:this.formatQ(0),value:this.quartile(0)},{label:this.formatQ(1),value:this.quartile(1)},{label:this.formatQ(2),value:this.quartile(2)},{label:this.formatQ(3),value:this.quartile(3)},{label:this.formatQ(4),value:this.quartile(4)}]}const[i,n]=this.domain(this._selectElement.node().value);return e.filter(t=>t.value>=i&&t.value<=n).map(t=>({label:t.label,value:t.value.toString()}))}updateScatter(){const t=this._selectElement.node().value,[e,i]=this.domain(t),n=(i-e)*(this.domainPadding()/100);this._bellCurve.xAxisDomainLow(e-n).xAxisDomainHigh(i+n).xAxisTicks(this.bellTicks(t)).data([[this.stdDev(-4),0],[this.stdDev(-3),.3],[this.stdDev(-2),5],[this.stdDev(-1),68],[this.stdDev(0),100],[this.stdDev(1),68],[this.stdDev(2),5],[this.stdDev(3),.3],[this.stdDev(4),0]]).resize({width:this.width(),height:this.height()-this.candleHeight()}).render()}updateCandle(){const t=this._bellCurve.dataPos(this.quartile(0)),e=this._bellCurve.dataPos(this.quartile(4))-t;this._candle.resize({width:this.width(),height:this.candleHeight()}).pos({x:t+e/2+2,y:this.candleHeight()/2}).width(e).candleWidth(this.candleHeight()).data(this.quartiles()).render()}update(t,e){super.update(t,e),this._tickFormatter=Qs(this.tickFormat()),this._selectElement.node().value=this.view(),this.updateScatter(),this.updateCandle()}exit(t,e){this._bellCurve.target(null),this._candle.target(null),this._selectElement.remove(),super.exit(t,e)}};s(Zs,"StatChart");let Js=Zs;Js.prototype._class+=" chart_StatChart",Js.prototype.publish("view","min_max","set","View",["min_max","25_75","normal"]),Js.prototype.publish("tickFormat",".2e","string","X-Axis Tick Format"),Js.prototype.publish("candleHeight",20,"number","Height of candle widget (pixels)"),Js.prototype.publish("domainPadding",10,"number","Domain value padding"),Js.prototype.publish("mean",.5,"number","Mean"),Js.prototype.publish("standardDeviation",.125,"number","Standard Deviation (σ)"),Js.prototype.publish("quartiles",[0,.25,.5,.75,1],"object","Quartiles (Min, 25%, 50%, 75%, Max)");const Ks=class _Step extends Ft{constructor(){super(),this.interpolate_default("step")}};s(Ks,"Step");let ta=Ks;ta.prototype._class+=" chart_Step";const ea="text",ia="html",na=class _Summary extends i.HTMLWidget{_playIntervalIdx=0;_mainDiv;_headerDiv;_textDiv;constructor(){super(),this._tag="div",this._drawStartPos="center",this.playInterval(this.playInterval())}lookupFieldIdx(t,e){let i=e;if(!(this[t+"_exists"]()&&(i=this.columns().indexOf(this[t]()),i<0)))return i}lookupFieldText(t,e){return this[t+"_exists"]()?this[t]():void 0!==e&&this.columns()[e]||""}currentRow(){return this.data()[this._playIntervalIdx]}summaryData(){let t;this.hideLabel()||(t=this.lookupFieldIdx("labelColumn",0));const e=this.lookupFieldIdx("iconColumn"),i=this.lookupFieldIdx("valueColumn",1);let n,o;this.hideMore()||(n=this.lookupFieldIdx("moreIconColumn"),o=this.lookupFieldIdx("moreTextColumn"));const s=this.lookupFieldIdx("colorFillColumn"),a=this.lookupFieldIdx("colorStrokeColumn");return this.formattedData().map(function(r){return{icon:void 0===e?this.icon():r[e],label:void 0===t?"":r[t],value:r[i],moreIcon:void 0===n?this.hideMore()?"":this.moreIcon():r[n],moreText:void 0===o?this.hideMore()?"":this.moreText():r[o],fill:void 0===s?this.colorFill():r[s],stroke:void 0===a?this.colorStroke():r[a]}},this)}enter(t,e){super.enter(t,e),this._mainDiv=e.append("div");const i=this;this._headerDiv=this._mainDiv.append("h2").on("click",function(){i.click(i.rowToObj(i.currentRow()),i.lookupFieldText("valueColumn",1),!0)}).on("dblclick",function(){i.dblclick(i.rowToObj(i.currentRow()),i.lookupFieldText("valueColumn",1),!0)}),this._textDiv=this._mainDiv.append("div").attr("class","text").on("click",function(){i.click(i.rowToObj(i.currentRow()),i.lookupFieldText("labelColumn",0),!0)}).on("dblclick",function(){i.dblclick(i.rowToObj(i.currentRow()),i.lookupFieldText("labelColumn",0),!0)})}update(t,e){super.update(t,e),this.data().length;const n=this.summaryData();this._playIntervalIdx>=n.length&&(this._playIntervalIdx=0);const o=this._playIntervalIdx<n.length?n[this._playIntervalIdx]:["",""];e.style("width",this.fixedSize()?this.minWidth_exists()?this.minWidth()+"px":null:"100%").style("height",this.fixedSize()?this.minHeight_exists()?this.minHeight()+"px":null:"100%"),this._mainDiv.attr("class","content bgIcon "+o.icon).transition().style("background-color",o.fill).style("color",o.stroke).style("min-width",this.minWidth_exists()?this.minWidth()+"px":null).style("min-height",this.minHeight_exists()?this.minHeight()+"px":null).style("font-size",this.iconFontSize()+"px"),this._headerDiv.transition().style("color",o.stroke).style("font-size",this.headerFontSize()+"px")[this.valueHTML()?ia:ea](o.value),this._textDiv.style("font-size",this.textFontSize()+"px")[this.labelHTML()?ia:ea](o.label);const s=this,a=this._mainDiv.selectAll(".more").data([o]),r=a.enter().append("div").attr("class","more").on("click",function(t){s.click(s.rowToObj(s.currentRow()),s.lookupFieldText("moreTextColumn")||"more",!0)}).each(function(){const t=i.select(this);t.append("i"),t.append("span")}).merge(a).style("display",this.hideMoreWrapper()?"none":null).style("font-size",this.moreFontSize()+"px").style("height",this.moreWrapperHeight_exists()?this.moreWrapperHeight()+"px":null).transition().style("background-color",i.rgb(o.fill).darker(.75).toString());r.select("i").attr("class",function(t){return"fa "+t.moreIcon}),this.moreTextHTML()?r.select("span").each(function(t){this.innerHTML=t.moreText}):r.select("span").text(t=>t.moreText),a.exit().remove()}exit(t,e){super.exit(t,e)}};s(na,"Summary");let oa=na;oa.prototype._class+=" chart_Summary",oa.prototype.implements(e.I2DChart.prototype),oa.prototype.publish("iconColumn",null,"set","Select Icon Column",function(){return this.columns()},{optional:!0}),oa.prototype.publish("icon","fa-briefcase","string","FA Char icon class",null,{disable:s(t=>t.iconColumn(),"disable")}),oa.prototype.publish("headerFontSize",null,"number","headerFontSize"),oa.prototype.publish("textFontSize",null,"number","textFontSize"),oa.prototype.publish("moreFontSize",null,"number","moreFontSize"),oa.prototype.publish("iconFontSize",null,"number","iconFontSize"),oa.prototype.publish("hideLabel",!1,"boolean","Hide label column"),oa.prototype.publish("labelColumn",null,"set","Select display value",function(){return this.columns()},{optional:!0,disable:s(t=>t.hideLabel(),"disable")}),oa.prototype.publish("labelHTML",!1,"boolean","Allow HTML",null,{disable:s(t=>t.hideLabel(),"disable")}),oa.prototype.publish("valueColumn",null,"set","Select display value",function(){return this.columns()},{optional:!0}),oa.prototype.publish("valueHTML",!1,"boolean","Allow HTML"),oa.prototype.publish("hideMore",!1,"boolean","Hide More Information"),oa.prototype.publish("hideMoreWrapper",!1,"boolean","Hide More Information Wrapper"),oa.prototype.publish("moreWrapperHeight",null,"number","Height of the 'more' text wrapper (pixels)"),oa.prototype.publish("moreIconColumn",null,"set","Select More Icon Column",function(){return this.columns()},{optional:!0,disable:s(t=>t.hideMore(),"disable")}),oa.prototype.publish("moreIcon","fa-info-circle","string","FA Char icon class",null,{disable:s(t=>t.hideMore()||t.moreIconColumn(),"disable")}),oa.prototype.publish("moreTextColumn",null,"set","Select display value",function(){return this.columns()},{optional:!0,disable:s(t=>t.hideMore(),"disable")}),oa.prototype.publish("moreText","More Info","string","More text",null,{disable:s(t=>t.hideMore()||t.moreTextColumn(),"disable")}),oa.prototype.publish("moreTextHTML",!1,"boolean","Allow HTML",null,{disable:s(t=>t.hideMore(),"disable")}),oa.prototype.publish("colorFillColumn",null,"set","Column for color",function(){return this.columns()},{optional:!0}),oa.prototype.publish("colorFill","#3498db","html-color","Fill Color",null,{disable:s(t=>t.colorFillColumn(),"disable")}),oa.prototype.publish("colorStrokeColumn",null,"set","Column for color",function(){return this.columns()},{optional:!0}),oa.prototype.publish("colorStroke","#ffffff","html-color","Fill Color",null,{disable:s(t=>t.colorStrokeColumn(),"disable")}),oa.prototype.publish("fixedSize",!0,"boolean","Fix Size to Min Width/Height"),oa.prototype.publish("minWidth",225,"number","Minimum Width"),oa.prototype.publish("minHeight",150,"number","Minimum Height"),oa.prototype.publish("playInterval",null,"number","Play Interval",null,{optional:!0});const sa=oa.prototype.playInterval;oa.prototype.playInterval=function(t){const e=sa.apply(this,arguments);if(arguments.length){this._playIntervalHandle&&clearInterval(this._playIntervalHandle);const e=this;t&&(this._playIntervalHandle=setInterval(function(){e._playIntervalIdx++,e._renderCount&&e.data().length&&e.render()},t))}return e};const aa=class _SummaryC extends i.CanvasWidget{_playIntervalIdx=0;constructor(){super(),e.I2DChart.call(this),this.playInterval(this.playInterval())}currentRow(){return this.data()[this._playIntervalIdx]}enter(t,e){super.enter.apply(this,arguments);const{width:i,height:n}=this.size();t.height=n,t.width=i}update(t,e){super.update.apply(this,arguments);const n=this;this._playIntervalIdx>=this.data().length&&(this._playIntervalIdx=0);const o=this.size(),a=Math.min(o.width,o.height),r=this.fontSizeRatio(),l=this.columns().indexOf(this.labelColumn()),h=this.columns().indexOf(this.valueColumn()),c=this.columns().indexOf(this.colorFillColumn()),u=this.columns().indexOf(this.colorStrokeColumn()),p=this.columns().indexOf(this.iconColumn()),d=-1!==p?this.currentRow()[p]:this.icon(),f=-1!==l?this.currentRow()[l]:"",y=-1!==h?this.currentRow()[h]:"",_=-1!==c?this.currentRow()[c]:this.colorFill(),x=-1!==u?this.currentRow()[u]:this.colorStroke();let m=o.height*(r-this.paddingSizeRatio());const g=o.height*(1-r-this.paddingSizeRatio()),b=o.height*(this.iconSizeRatio()-this.paddingSizeRatio()),v=a*this.paddingSizeRatio(),w=t.getContext("2d");w.clearRect(0,0,o.width,o.height);const S=n.fontFamily();function A(t,e,i,n){w.textBaseline="top",w.font=`${i}px ${S}`,w.fillStyle=x;let s=w.measureText(t);if(s.width>o.width-2*v){i*=(o.width-2*v)/s.width,w.font=`${i}px ${S}`,s=w.measureText(t)}const a=M(s.width,n);return w.fillText(t,a,e),i}function k(t,e,i){if(void 0===t)return;w.textBaseline=n.iconBaseline(),w.font=`${e}px FontAwesome`,w.fillStyle=x;let s=w.measureText(t);if(s.width>o.width-2*v){const i=(o.width-2*v)/s.width;w.font=e*i+"px FontAwesome",s=w.measureText(t)}const a=M(s.width,i),r=T(n.iconBaseline());w.fillText(t,a,r)}function M(t,e){switch(e){case"start":return v;case"middle":return o.width/2-t/2;case"end":return o.width-t-v}}function T(t){switch(t){case"top":return v;case"middle":return o.height/2;case"bottom":return o.height-v}}w.fillStyle=_,w.fillRect(0,0,o.width,o.height),w.globalAlpha=this.iconOpacity(),k(i.Utility.faChar(d),b,n.iconAnchor()),w.globalAlpha=this.valueOpacity(),m=A(y,v,m,n.valueAnchor()),w.globalAlpha=this.labelOpacity(),A(f,m+v,g,n.labelAnchor()),s(A,"drawText"),s(k,"drawIcon"),s(M,"getTextOffsetX"),s(T,"getTextOffsetY")}};s(aa,"SummaryC");let ra=aa;ra.prototype._class+=" chart_SummaryC",ra.prototype.implements(e.I2DChart.prototype),ra.prototype.publish("iconBaseline","bottom","string","Text baseline for the icon",["top","middle","bottom"]),ra.prototype.publish("iconAnchor","end","set","Anchors the icon either at the start, middle, or end of the summary",["start","middle","end"]),ra.prototype.publish("valueAnchor","start","set","Anchors the value either at the start, middle, or end of the summary",["start","middle","end"]),ra.prototype.publish("labelAnchor","start","set","Anchors the label either at the start, middle, or end of the summary",["start","middle","end"]),ra.prototype.publish("iconColumn",null,"set","Select Icon Column",function(){return this.columns()},{optional:!0}),ra.prototype.publish("icon","fa-briefcase","string","FA Char icon class",null,{disable:s(t=>t.iconColumn(),"disable")}),ra.prototype.publish("fontFamily","Arial","string","Font Family"),ra.prototype.publish("labelColumn",null,"set","Select display value",function(){return this.columns()},{optional:!0}),ra.prototype.publish("valueColumn",null,"set","Select display value",function(){return this.columns()},{optional:!0}),ra.prototype.publish("colorFillColumn",null,"set","Column for background color",function(){return this.columns()},{optional:!0}),ra.prototype.publish("colorFill","#0097e6","html-color","Background Color",null,{disable:s(t=>t.colorFillColumn(),"disable")}),ra.prototype.publish("colorStrokeColumn",null,"set","Column for font color",function(){return this.columns()},{optional:!0}),ra.prototype.publish("colorStroke","#2f3640","html-color","Font Color",null,{disable:s(t=>t.colorStrokeColumn(),"disable")}),ra.prototype.publish("fixedSize",!0,"boolean","Fix Size to Min Width/Height"),ra.prototype.publish("minWidth",225,"number","Minimum Width"),ra.prototype.publish("minHeight",150,"number","Minimum Height"),ra.prototype.publish("playInterval",null,"number","Play Interval",null,{optional:!0}),ra.prototype.publish("fontSizeRatio",.618,"number","Ratio between widget height and value font size"),ra.prototype.publish("valueOpacity",1,"number","Opacity of value text (0..1)"),ra.prototype.publish("labelOpacity",.9,"number","Opacity of label text (0..1)"),ra.prototype.publish("iconOpacity",.3,"number","Opacity of icon text (0..1)"),ra.prototype.publish("paddingSizeRatio",.1,"number","Ratio of the smallest dimension for edge padding (0..1)"),ra.prototype.publish("iconSizeRatio",.9,"number","Ratio of the height for icon size (0..1)");const la=ra.prototype.playInterval;ra.prototype.playInterval=function(t){const e=la.apply(this,arguments);if(arguments.length){this._playIntervalHandle&&clearInterval(this._playIntervalHandle);const e=this;t&&(this._playIntervalHandle=setInterval(function(){e._playIntervalIdx++,e._renderCount&&e.data().length&&e.render()},t))}return e};const ha=Math.PI/180,ca=2048;function ua(){const t=i.dispatch("word","end"),e={};let n=[256,256],o=pa,a=da,r=ya,l=fa,h=fa,c=_a,u=xa,p=[],d=wa,f=1/0,y=null,_=Math.random,x=ka;function m(t){t.width=t.height=1;const e=Math.sqrt(t.getContext("2d").getImageData(0,0,1,1).data.length>>2);t.width=2048/e,t.height=ca/e;const i=t.getContext("2d");return i.fillStyle=i.strokeStyle="red",i.textAlign="center",{context:i,ratio:e}}function g(t,e,i){const o=e.x,s=e.y,a=Math.sqrt(n[0]*n[0]+n[1]*n[1]),r=d(n),l=_()<.5?1:-1;let h,c,u,p=-l;for(;(h=r(p+=l))&&(c=~~h[0],u=~~h[1],!(Math.min(Math.abs(c),Math.abs(u))>=a));)if(e.x=o+c,e.y=s+u,!(e.x+e.x0<0||e.y+e.y0<0||e.x+e.x1>n[0]||e.y+e.y1>n[1])&&(!i||!ga(e,t,n[0]))&&(!i||va(e,i))){const i=e.sprite,o=e.width>>5,s=n[0]>>5,a=e.x-(o<<4),r=127&a,l=32-r,h=e.y1-e.y0;let c,u=(e.y+e.y0)*s+(a>>5);for(let e=0;e<h;e++){c=0;for(let n=0;n<=o;n++)t[u+n]|=c<<l|(n<o?(c=i[e*o+n])>>>r:0);u+=s}return delete e.sprite,!0}return!1}return e.canvas=function(t){return arguments.length?(x=Ma(t),e):x},e.start=function(){const i=m(x()),s=Aa((n[0]>>5)*n[1]);let d=null;const b=p.length;let v=-1;const w=[],S=p.map(function(t,e){return t.text=o.call(this,t,e),t.font=a.call(this,t,e),t.style=l.call(this,t,e),t.weight=h.call(this,t,e),t.rotate=c.call(this,t,e),t.size=~~r.call(this,t,e),t.padding=u.call(this,t,e),t}).sort(function(t,e){return e.size-t.size});return y&&clearInterval(y),y=setInterval(A,0),A(),e;function A(){const o=Date.now();for(;Date.now()-o<f&&++v<b&&y;){const o=S[v];o.x=n[0]*(_()+.5)>>1,o.y=n[1]*(_()+.5)>>1,ma(i,o,S,v),o.hasText&&g(s,o,d)&&(w.push(o),t.call("word",e,o),d?ba(d,o):d=[{x:o.x+o.x0,y:o.y+o.y0},{x:o.x+o.x1,y:o.y+o.y1}],o.x-=n[0]>>1,o.y-=n[1]>>1)}v>=b&&(e.stop(),t.call("end",e,w,d))}},e.stop=function(){return y&&(clearInterval(y),y=null),e},s(m,"getContext"),s(g,"place"),e.timeInterval=function(t){return arguments.length?(f=null==t?1/0:t,e):f},e.words=function(t){return arguments.length?(p=t,e):p},e.size=function(t){return arguments.length?(n=[+t[0],+t[1]],e):n},e.font=function(t){return arguments.length?(a=Ma(t),e):a},e.fontStyle=function(t){return arguments.length?(l=Ma(t),e):l},e.fontWeight=function(t){return arguments.length?(h=Ma(t),e):h},e.rotate=function(t){return arguments.length?(c=Ma(t),e):c},e.text=function(t){return arguments.length?(o=Ma(t),e):o},e.spiral=function(t){return arguments.length?(d=Ta[t]||t,e):d},e.fontSize=function(t){return arguments.length?(r=Ma(t),e):r},e.padding=function(t){return arguments.length?(u=Ma(t),e):u},e.random=function(t){return arguments.length?(_=t,e):_},e.on=function(){const i=t.on.apply(t,arguments);return i===t?e:i},e}function pa(t){return t.text}function da(){return"serif"}function fa(){return"normal"}function ya(t){return Math.sqrt(t.value)}function _a(){return 30*(~~(6*Math.random())-3)}function xa(){return 1}function ma(t,e,i,n){if(e.sprite)return;const o=t.context,s=t.ratio;o.clearRect(0,0,2048/s,ca/s);let a=0,r=0,l=0;const h=i.length;for(--n;++n<h;){e=i[n],o.save(),o.font=e.style+" "+e.weight+" "+~~((e.size+1)/s)+"px "+e.font;let t=o.measureText(e.text+"m").width*s,h=e.size<<1;if(e.rotate){const i=Math.sin(e.rotate*ha),n=Math.cos(e.rotate*ha),o=t*n,s=t*i,a=h*n,r=h*i;t=Math.max(Math.abs(o+r),Math.abs(o-r))+31>>5<<5,h=~~Math.max(Math.abs(s+a),Math.abs(s-a))}else t=t+31>>5<<5;if(h>l&&(l=h),a+t>=2048&&(a=0,r+=l,l=0),r+h>=ca)break;o.translate((a+(t>>1))/s,(r+(h>>1))/s),e.rotate&&o.rotate(e.rotate*ha),o.fillText(e.text,0,0),e.padding&&(o.lineWidth=2*e.padding,o.strokeText(e.text,0,0)),o.restore(),e.width=t,e.height=h,e.xoff=a,e.yoff=r,e.x1=t>>1,e.y1=h>>1,e.x0=-e.x1,e.y0=-e.y1,e.hasText=!0,a+=t}const c=o.getImageData(0,0,2048/s,ca/s).data,u=[];for(;--n>=0;){if(!(e=i[n]).hasText)continue;const t=e.width,o=t>>5;let s=e.y1-e.y0;for(let e=0;e<s*o;e++)u[e]=0;if(a=e.xoff,null==a)return;r=e.yoff;let l=0,h=-1;for(let i=0;i<s;i++){for(let e=0;e<t;e++){const t=o*i+(e>>5),n=c[2048*(r+i)+(a+e)<<2]?1<<31-e%32:0;u[t]|=n,l|=n}l?h=i:(e.y0++,s--,i--,r++)}e.y1=e.y0+h,e.sprite=u.slice(0,(e.y1-e.y0)*o)}}function ga(t,e,i){i>>=5;const n=t.sprite,o=t.width>>5,s=t.x-(o<<4),a=127&s,r=32-a,l=t.y1-t.y0;let h,c=(t.y+t.y0)*i+(s>>5);for(let u=0;u<l;u++){h=0;for(let t=0;t<=o;t++)if((h<<r|(t<o?(h=n[u*o+t])>>>a:0))&e[c+t])return!0;c+=i}return!1}function ba(t,e){const i=t[0],n=t[1];e.x+e.x0<i.x&&(i.x=e.x+e.x0),e.y+e.y0<i.y&&(i.y=e.y+e.y0),e.x+e.x1>n.x&&(n.x=e.x+e.x1),e.y+e.y1>n.y&&(n.y=e.y+e.y1)}function va(t,e){return t.x+t.x1>e[0].x&&t.x+t.x0<e[1].x&&t.y+t.y1>e[0].y&&t.y+t.y0<e[1].y}function wa(t){const e=t[0]/t[1];return function(t){return[e*(t*=.1)*Math.cos(t),t*Math.sin(t)]}}function Sa(t){const e=4*t[0]/t[1];let i=0,n=0;return function(t){const o=t<0?-1:1;switch(Math.sqrt(1+4*o*t)-o&3){case 0:i+=e;break;case 1:n+=4;break;case 2:i-=e;break;default:n-=4}return[i,n]}}function Aa(t){const e=[];let i=-1;for(;++i<t;)e[i]=0;return e}function ka(){return document.createElement("canvas")}function Ma(t){return"function"==typeof t?t:function(){return t}}s(ua,"d3Cloud"),s(pa,"cloudText"),s(da,"cloudFont"),s(fa,"cloudFontNormal"),s(ya,"cloudFontSize"),s(_a,"cloudRotate"),s(xa,"cloudPadding"),s(ma,"cloudSprite"),s(ga,"cloudCollide"),s(ba,"cloudBounds"),s(va,"collideRects"),s(wa,"archimedeanSpiral"),s(Sa,"rectangularSpiral"),s(Aa,"zeroArray"),s(ka,"cloudCanvas"),s(Ma,"functor");const Ta={archimedean:wa,rectangular:Sa},Pa=class _WordCloud extends i.SVGWidget{_prevOffsetX;_prevOffsetY;_prevZoom;_root;_canvas;_d3Cloud;_d3Zoom;constructor(){super(),e.I2DChart.call(this),e.ITooltip.call(this),i.Utility.SimpleSelectionMixin.call(this),this._prevOffsetX=this.offsetX(),this._prevOffsetY=this.offsetY(),this._prevZoom=this.zoom()}calcData(){return this.data().map(t=>({__viz_label:t[0],__viz_weight:t[1],__viz_row:t}))}enter(t,e){super.enter(t,e),this._selection.widgetElement(e),this._root=e.append("g"),this._canvas=document.createElement("canvas");const n=this;this._d3Zoom=i.zoom().scaleExtent([.1,10]),this._d3Zoom.on("zoom",function(t){const e=i.d3Event();e&&e.transform&&n.zoomed(n._d3Zoom,[e.transform.x,e.transform.y],e.transform.k)}),e.call(this._d3Zoom),this.tooltipHTML(function(t){const e=n.columns(),i=e&&e.length?e[0]:"Word";return n.tooltipFormat({label:t.__viz_label,series:i,value:t.__viz_weight})})}update(t,e){super.update(t,e),this._palette=this._palette.switch(this.paletteID()),this.useClonedPalette()&&(this._palette=this._palette.cloneNotExists(this.paletteID()+"_"+this.id())),this._d3Cloud=ua().canvas(()=>this._canvas),this.zoomed(this,[this.offsetX(),this.offsetY()],this.zoom());const n=this.calcData(),o=this,a=i.extent(n,function(t){return t.__viz_weight});let r;switch(this.scaleMode()){case"log":r=i.scaleLog;break;case"sqrt":r=i.scaleSqrt;break;case"pow":r=i.scalePow;break;default:r=i.scaleLinear}const l=r().domain(a).range([this.fontSizeFrom(),this.fontSizeTo()]),h=i.scaleLinear().domain([0,o.angleCount()-1]).range([o.angleFrom(),o.angleTo()]);function c(t,e){const i=o._root.selectAll("text").data(t,function(t){return t.__viz_label?t.__viz_label.toLowerCase():""});i.enter().append("text").attr("text-anchor","middle").call(o._selection.enter.bind(o._selection)).text(function(t){return t.__viz_label}).on("click",function(t){o.click(o.rowToObj(t.__viz_row),o.columns()[1],o._selection.selected(this))}).on("dblclick",function(t){o.dblclick(o.rowToObj(t.__viz_row),o.columns()[1],o._selection.selected(this))}).on("mouseout.tooltip",o.tooltip.hide).on("mousemove.tooltip",o.tooltip.show).style("opacity",1e-6).merge(i).style("font-size",function(t){return l(t.__viz_weight)+"px"}).style("font-family",o.fontFamily()).transition().duration(1e3).attr("transform",function(t){return"translate("+[t.x,t.y]+")rotate("+t.rotate+")"}).style("fill",function(t){return o._palette(t.__viz_label?t.__viz_label.toLowerCase():"")}).style("opacity",1),i.exit().transition().duration(1e3).style("opacity",1e-4).remove()}this._d3Cloud.stop().size([this.width(),this.height()]).words(n).font(this.fontFamily()).padding(this.padding()).spiral(this.spiral()).text(function(t){return t.__viz_label.trim()}).fontSize(function(t){return l(t.__viz_weight)}).rotate((t,e)=>h(e%o.angleCount())).on("word",t=>{}).on("end",c).start(),s(c,"draw")}zoomed(t,e,i){if(e[0]!==this._prevOffsetX||e[1]!==this._prevOffsetY||i!==this._prevZoom){switch(this._root.attr("transform",e),t){case this:break;case this._d3Zoom:this.offsetX(e[0]),this.offsetY(e[1]),this.zoom(i)}this._prevOffsetX=e[0],this._prevOffsetY=e[1],this._prevZoom=i}}};s(Pa,"WordCloud"),a(Pa,"__inputs",[{id:"label",type:"string"},{id:"value",type:"number"}]);let Ca=Pa;Ca.prototype._class+=" chart_WordCloud",Ca.prototype.implements(e.I2DChart.prototype),Ca.prototype.implements(e.ITooltip.prototype),Ca.prototype.mixin(i.Utility.SimpleSelectionMixin),Ca.prototype.publish("paletteID","default","set","Color palette for this widget",Ca.prototype._palette.switch(),{tags:["Basic","Shared"]}),Ca.prototype.publish("useClonedPalette",!1,"boolean","Enable or disable using a cloned palette",null,{tags:["Intermediate","Shared"]}),Ca.prototype.publish("fontFamily","Impact","string","Font Name",null,{tags:["Basic"]}),Ca.prototype.publish("fontSizeFrom",6,"number","Minimum font size (pixels)",null,{tags:["Basic"]}),Ca.prototype.publish("fontSizeTo",48,"number","Maximum font size (pixels)",null,{tags:["Basic"]}),Ca.prototype.publish("angleFrom",-60,"number","Minimum angle (degrees)",null,{tags:["Basic"]}),Ca.prototype.publish("angleTo",60,"number","Maximum angle (degrees)",null,{tags:["Basic"]}),Ca.prototype.publish("angleCount",5,"number","Number of different angles",null,{tags:["Basic"]}),Ca.prototype.publish("padding",0,"number","Padding between words (pixels)",null,{tags:["Intermediate"]}),Ca.prototype.publish("scaleMode","linear","set","Text scaling mode",["linear","log","sqrt","pow"],{tags:["Intermediate"]}),Ca.prototype.publish("spiral","archimedean","set","Text scaling mode",["archimedean","rectangular"],{tags:["Intermediate"]}),Ca.prototype.publish("offsetX",0,"number","X offset",null,{tags:["Advanced"]}),Ca.prototype.publish("offsetY",0,"number","Y offset",null,{tags:["Advanced"]}),Ca.prototype.publish("zoom",1,"number","Zoom",null,{tags:["Advanced"]}),t.Area=Et,t.Axis=Pt,t.BUILD_VERSION="3.15.1",t.Bar=Nt,t.Bubble=Ie,t.BubbleXY=Fe,t.Bullet=ni,t.Column=Rt,t.Contour=Nn,t.Gantt=Bn,t.Gauge=vs,t.HalfPie=Ts,t.Heat=Cs,t.HexBin=js,t.Line=Ls,t.PKG_NAME="@hpcc-js/chart",t.PKG_VERSION="3.5.1",t.Pie=ks,t.QuarterPie=$s,t.QuartileCandlestick=Vs,t.Radar=Ws,t.RadialBar=Xs,t.Scatter=Ft,t.StatChart=Js,t.Step=ta,t.Summary=oa,t.SummaryC=ra,t.WordCloud=Ca,t.XYAxis=It,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})});
|
|
2
|
+
//# sourceMappingURL=index.umd.cjs.map
|
|
3
|
+
!function(){"use strict";try{if("undefined"!=typeof document){var t=document.createElement("style");t.appendChild(document.createTextNode(".chart_Axis{fill:#000;font:10px sans-serif}.chart_Axis .axis .tick>text{font:10px sans-serif}.chart_Axis .axis path.domain,.chart_Axis .axis .tick line{fill:none;stroke:#000}.chart_Axis .guide path.domain{fill:none;stroke:none}.chart_Axis .guide .tick line{fill:none;stroke:#d3d3d3;opacity:.7}.chart_Axis .guide .tick.guide-0 line{stroke:#000;stroke-width:1;stroke-dasharray:3 5}.chart_Axis line,.chart_Axis path{shape-rendering:crispEdges}.chart_XYAxis .axis{fill:#000;font:10px sans-serif}.chart_XYAxis .tick>text{font:10px sans-serif}.chart_XYAxis .focus .chart_Axis.value .tick{visibility:hidden}.chart_XYAxis .axis path,.chart_XYAxis .axis line{fill:none;stroke:#000;shape-rendering:crispEdges}.chart_XYAxis .region{opacity:.33}.chart_XYAxis .brush rect.background{z-index:-999}.chart_XYAxis .brush .selection{stroke:#4682b4;stroke-opacity:1;stroke-width:1px;fill:#4682b4;fill-opacity:.125;shape-rendering:crispEdges}.chart_XYAxis .brush path.handle--custom{fill:#eee;stroke:#666}.chart_Scatter .pointShape,.chart_Scatter .line,.chart_Scatter .area{pointer-events:none}.chart_Scatter .point .pointSelection{fill:none;stroke:none;pointer-events:all}.chart_Scatter .point .pointSelection.selected{fill:none;stroke:red}.chart_Column .columnRect{fill:#4682b4;cursor:pointer}.chart_Column .data.axis path{display:none}.chart_Column .columnRect{stroke:transparent;border-width:1.5px}.chart_Column .columnRect.selected{stroke:red}.chart_Bubble circle{cursor:pointer}.chart_Bubble .selected circle{stroke:red;stroke-width:1.5px}.chart_Bubble .common_FAChar{fill:#fff;pointer-events:none}.chart_Bubble .common_Text{pointer-events:none}.chart_Bullet .domain{opacity:0}.chart_Bullet .bullet{border:solid 1px;border-color:transparent;font:10px sans-serif}.chart_Bullet .bullet.selected{border-color:red}.chart_Bullet .bullet.over{border-color:orange}.chart_Bullet .bullet.selected.over{border-color:red}.chart_Bullet .bullet .marker{stroke:#000;stroke-width:2px}.chart_Bullet .bullet .tick line{stroke:#666;stroke-width:.5px}.chart_Bullet .bullet .range.s0{fill:#eee}.chart_Bullet .bullet .range.s1{fill:#ddd}.chart_Bullet .bullet .range.s2{fill:#ccc}.chart_Bullet .bullet .measure.s0{fill:#b0c4de}.chart_Bullet .bullet .measure.s1{fill:#4682b4}.chart_Bullet .bullet .title{font-size:14px;font-weight:700}.chart_Bullet .bullet .subtitle{fill:#999}.chart_Pie path{cursor:pointer}.chart_Pie>g>text{cursor:pointer}.chart_Pie .arc path{stroke:#fff;stroke-width:.75px}.chart_Pie .arc.selected path{stroke:red;stroke-width:1.5px}.chart_Pie polyline{opacity:.3;stroke:#000;stroke-width:2px;fill:none}.chart_HexBin .hexagon{fill:none;stroke:#000;stroke-width:.5px}.chart_HexBin .hexagon.selected{stroke:red}.chart_Line .dataLine{fill:none;stroke:#4682b4;stroke-width:1.5px}.chart_Radar .pointShape,.chart_Radar .area{pointer-events:none}.chart_Radar .point .pointSelection{fill:none;stroke:none;pointer-events:all}.chart_Radar .point .pointSelection.selected{fill:none;stroke:red}.chart_RadialBar path.arc{opacity:.9;transition:opacity .5s}.chart_RadialBar path.arc.selected{stroke:red}.chart_RadialBar path.arc:hover{opacity:.7}.chart_RadialBar .axis line,.chart_RadialBar .axis circle{stroke:#ccc;stroke-width:1px}.chart_RadialBar .axis circle{fill:none}.chart_RadialBar .r.axis text{text-anchor:end}.chart_Summary{width:225px;height:150px;font-size:14px}.chart_Summary .content h2{font-weight:700;font-size:3em;margin-left:10px;margin-top:10px;margin-bottom:10px}.chart_Summary .bgIcon:before{position:absolute;font-family:FontAwesome;font-size:5.5em;opacity:.4;top:.5em;right:15px}.chart_Summary .bgIcon{position:relative}.chart_Summary .content{float:left;width:100%;height:100%;background-color:#efd752}.chart_Summary .content div{margin-top:-1.1em;font-size:1.1em;opacity:.8}.chart_Summary .content .text{padding-left:10px}.chart_Summary .content .more{position:absolute;bottom:0;width:100%;height:3em;line-height:3em}.chart_Summary .content .more i{padding-left:10px;padding-right:.5em}.other_Wordcloud text{cursor:pointer}")),document.head.appendChild(t)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}}();
|