@hpcc-js/chart 2.86.5 → 2.86.6

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.min.js CHANGED
@@ -1,2 +1,2 @@
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=function(t,e){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},o(t,e)};function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function i(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}function r(t,e,i,n){var o,a=arguments.length,r=a<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(r=(a<3?o(r):a>3?o(e,i,r):o(e,i))||r);return a>3&&r&&Object.defineProperty(e,i,r),r}function s(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}function l(t){var e="function"==typeof Symbol&&Symbol.iterator,i=e&&t[e],n=0;if(i)return i.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function h(t,e){var i="function"==typeof Symbol&&t[Symbol.iterator];if(!i)return t;var n,o,a=i.call(t),r=[];try{for(;(void 0===e||e-- >0)&&!(n=a.next()).done;)r.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(i=a.return)&&i.call(a)}finally{if(o)throw o.error}}return r}function c(t,e,i){if(i||2===arguments.length)for(var n,o=0,a=e.length;o<a;o++)!n&&o in e||(n||(n=Array.prototype.slice.call(e,0,o)),n[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))}"function"==typeof SuppressedError&&SuppressedError;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}function x(t){return function(){return t}}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,a){this._+="C"+ +t+","+ +e+","+ +i+","+ +n+","+(this._x1=+o)+","+(this._y1=+a)},arcTo:function(t,e,i,n,o){t=+t,e=+e,i=+i,n=+n,o=+o;var a=this._x1,r=this._y1,s=i-t,l=n-e,h=a-t,c=r-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*s-l*h)>d&&o){var f=i-a,y=n-r,_=s*s+l*l,x=f*f+y*y,m=Math.sqrt(_),g=Math.sqrt(p),v=o*Math.tan((u-Math.acos((_+p-x)/(2*m*g)))/2),b=v/g,w=v/m;Math.abs(b-1)>d&&(this._+="L"+(t+b*h)+","+(e+b*c)),this._+="A"+o+","+o+",0,0,"+ +(c*f>h*y)+","+(this._x1=t+w*s)+","+(this._y1=e+w*l)}else this._+="L"+(this._x1=t)+","+(this._y1=e);else;},arc:function(t,e,i,n,o,a){t=+t,e=+e,a=!!a;var r=(i=+i)*Math.cos(n),s=i*Math.sin(n),l=t+r,h=e+s,c=1^a,y=a?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-r)+","+(e-s)+"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 m=Math.abs,g=Math.atan2,v=Math.cos,b=Math.max,w=Math.min,S=Math.sin,k=Math.sqrt,A=1e-12,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 F(t){return t.startAngle}function D(t){return t.endAngle}function O(t){return t&&t.padAngle}function R(t,e,i,n,o,a,r){var s=t-i,l=e-n,h=(r?a:-a)/k(s*s+l*l),c=h*l,u=-h*s,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,v=m*m+g*g,w=o-a,S=p*y-f*d,A=(g<0?-1:1)*k(b(0,w*w*v-S*S)),M=(S*g-m*A)/v,T=(-S*m-g*A)/v,P=(S*g+m*A)/v,C=(-S*m+g*A)/v,z=M-_,I=T-x,F=P-_,D=C-x;return z*z+I*I>F*F+D*D&&(M=P,T=C),{cx:M,cy:T,x01:-c,y01:-u,x11:M*(o/w-1),y11:T*(o/w-1)}}function j(){var t=z,e=I,i=x(0),n=null,o=F,a=D,r=O,s=null;function l(){var l,h,c=+t.apply(this,arguments),u=+e.apply(this,arguments),p=o.apply(this,arguments)-T,d=a.apply(this,arguments)-T,f=m(d-p),y=d>p;if(s||(s=l=_()),u<c&&(h=u,u=c,c=h),u>A)if(f>P-A)s.moveTo(u*v(p),u*S(p)),s.arc(0,0,u,p,d,!y),c>A&&(s.moveTo(c*v(d),c*S(d)),s.arc(0,0,c,d,p,y));else{var x,b,z=p,I=d,F=p,D=d,O=f,j=f,E=r.apply(this,arguments)/2,N=E>A&&(n?+n.apply(this,arguments):k(c*c+u*u)),L=w(m(u-c)/2,+i.apply(this,arguments)),B=L,H=L;if(N>A){var V=C(N/c*S(E)),q=C(N/u*S(E));(O-=2*V)>A?(F+=V*=y?1:-1,D-=V):(O=0,F=D=(p+d)/2),(j-=2*q)>A?(z+=q*=y?1:-1,I-=q):(j=0,z=I=(p+d)/2)}var W=u*v(z),G=u*S(z),Y=c*v(D),X=c*S(D);if(L>A){var U,Q=u*v(I),Z=u*S(I),J=c*v(F),K=c*S(F);if(f<M&&(U=function(t,e,i,n,o,a,r,s){var l=i-t,h=n-e,c=r-o,u=s-a,p=u*l-c*h;if(!(p*p<A))return[t+(p=(c*(e-a)-u*(t-o))/p)*l,e+p*h]}(W,G,J,K,Q,Z,Y,X))){var $=W-U[0],tt=G-U[1],et=Q-U[0],it=Z-U[1],nt=1/S(function(t){return t>1?0:t<-1?M:Math.acos(t)}(($*et+tt*it)/(k($*$+tt*tt)*k(et*et+it*it)))/2),ot=k(U[0]*U[0]+U[1]*U[1]);B=w(L,(c-ot)/(nt-1)),H=w(L,(u-ot)/(nt+1))}}j>A?H>A?(x=R(J,K,W,G,u,H,y),b=R(Q,Z,Y,X,u,H,y),s.moveTo(x.cx+x.x01,x.cy+x.y01),H<L?s.arc(x.cx,x.cy,H,g(x.y01,x.x01),g(b.y01,b.x01),!y):(s.arc(x.cx,x.cy,H,g(x.y01,x.x01),g(x.y11,x.x11),!y),s.arc(0,0,u,g(x.cy+x.y11,x.cx+x.x11),g(b.cy+b.y11,b.cx+b.x11),!y),s.arc(b.cx,b.cy,H,g(b.y11,b.x11),g(b.y01,b.x01),!y))):(s.moveTo(W,G),s.arc(0,0,u,z,I,!y)):s.moveTo(W,G),c>A&&O>A?B>A?(x=R(Y,X,Q,Z,c,-B,y),b=R(W,G,J,K,c,-B,y),s.lineTo(x.cx+x.x01,x.cy+x.y01),B<L?s.arc(x.cx,x.cy,B,g(x.y01,x.x01),g(b.y01,b.x01),!y):(s.arc(x.cx,x.cy,B,g(x.y01,x.x01),g(x.y11,x.x11),!y),s.arc(0,0,c,g(x.cy+x.y11,x.cx+x.x11),g(b.cy+b.y11,b.cx+b.x11),y),s.arc(b.cx,b.cy,B,g(b.y11,b.x11),g(b.y01,b.x01),!y))):s.arc(0,0,c,D,F,y):s.lineTo(Y,X)}else s.moveTo(0,0);if(s.closePath(),l)return s=null,l+""||null}return l.centroid=function(){var i=(+t.apply(this,arguments)+ +e.apply(this,arguments))/2,n=(+o.apply(this,arguments)+ +a.apply(this,arguments))/2-M/2;return[v(n)*i,S(n)*i]},l.innerRadius=function(e){return arguments.length?(t="function"==typeof e?e:x(+e),l):t},l.outerRadius=function(t){return arguments.length?(e="function"==typeof t?t:x(+t),l):e},l.cornerRadius=function(t){return arguments.length?(i="function"==typeof t?t:x(+t),l):i},l.padRadius=function(t){return arguments.length?(n=null==t?null:"function"==typeof t?t:x(+t),l):n},l.startAngle=function(t){return arguments.length?(o="function"==typeof t?t:x(+t),l):o},l.endAngle=function(t){return arguments.length?(a="function"==typeof t?t:x(+t),l):a},l.padAngle=function(t){return arguments.length?(r="function"==typeof t?t:x(+t),l):r},l.context=function(t){return arguments.length?(s=null==t?null:t,l):s},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=x(!0),n=null,o=N,a=null;function r(r){var s,l,h,c=r.length,u=!1;for(null==n&&(a=o(h=_())),s=0;s<=c;++s)!(s<c&&i(l=r[s],s,r))===u&&((u=!u)?a.lineStart():a.lineEnd()),u&&a.point(+t(l,s,r),+e(l,s,r));if(h)return a=null,h+""||null}return r.x=function(e){return arguments.length?(t="function"==typeof e?e:x(+e),r):t},r.y=function(t){return arguments.length?(e="function"==typeof t?t:x(+t),r):e},r.defined=function(t){return arguments.length?(i="function"==typeof t?t:x(!!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 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 Y(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],a=e[0],r=t[i]-o,s=e[i]-a,l=-1;++l<=i;)n=l/i,this._basis.point(this._beta*t[l]+(1-this._beta)*(o+n*r),this._beta*e[l]+(1-this._beta)*(a+n*s));this._x=this._y=null,this._basis.lineEnd()},point:function(t,e){this._x.push(+t),this._y.push(+e)}};var U=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 Q(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 Z(t,e){this._context=t,this._k=(1-e)/6}Z.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:Q(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:Q(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 J=function t(e){function i(t){return new Z(t,e)}return i.tension=function(e){return t(+e)},i}(0);function K(t,e){this._context=t,this._alpha=e}K.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,a=t._x2,r=t._y2;if(t._l01_a>A){var s=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*s-t._x0*t._l12_2a+t._x2*t._l01_2a)/l,o=(o*s-t._y0*t._l12_2a+t._y2*t._l01_2a)/l}if(t._l23_a>A){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);a=(a*h+t._x1*t._l23_2a-e*t._l12_2a)/c,r=(r*h+t._y1*t._l23_2a-i*t._l12_2a)/c}t._context.bezierCurveTo(n,o,a,r,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 $=function t(e){function i(t){return e?new K(t,e):new Z(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,a=(t._y1-t._y0)/(n||o<0&&-0),r=(i-t._y1)/(o||n<0&&-0),s=(a*o+r*n)/(n+o);return(tt(a)+tt(r))*Math.min(Math.abs(a),Math.abs(r),.5*Math.abs(s))||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,a=t._x1,r=t._y1,s=(a-n)/3;t._context.bezierCurveTo(n+s,o+s*e,a-s,r-s*i,a,r)}function ot(t){this._context=t}function at(t){return new ot(t)}function rt(t){this._context=t}function st(t){var e,i,n=t.length-1,o=new Array(n),a=new Array(n),r=new Array(n);for(o[0]=0,a[0]=2,r[0]=t[0]+2*t[1],e=1;e<n-1;++e)o[e]=1,a[e]=4,r[e]=4*t[e]+2*t[e+1];for(o[n-1]=2,a[n-1]=7,r[n-1]=8*t[n-1]+t[n],e=1;e<n;++e)i=o[e]/a[e-1],a[e]-=i,r[e]-=i*r[e-1];for(o[n-1]=r[n-1]/a[n-1],e=n-2;e>=0;--e)o[e]=(r[e]-o[e+1])/a[e];for(a[n-1]=(t[n]+o[n-1])/2,e=0;e<n-1;++e)a[e]=2*t[e+1]-o[e+1];return[o,a]}function lt(t){return new rt(t)}function ht(t,e){this._context=t,this._t=e}function ct(t){return new ht(t,.5)}function ut(t){return new ht(t,0)}function pt(t){return new ht(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}}},Object.create(ot.prototype).point=function(t,e){ot.prototype.point.call(this,e,t)},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=st(t),o=st(e),a=0,r=1;r<i;++a,++r)this._context.bezierCurveTo(n[0][a],o[0][a],n[1][a],o[1][a],t[r],e[r]);(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)}},ht.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 dt=Array.prototype.slice;function ft(t){return t}var yt=1e-6;function _t(t){return"translate("+(t+.5)+",0)"}function xt(t){return"translate(0,"+(t+.5)+")"}function mt(t){return function(e){return+t(e)}}function gt(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 bt(t,e){var i=[],n=null,o=null,a=6,r=6,s=3,l=1===t||4===t?-1:1,h=4===t||2===t?"x":"y",c=1===t||3===t?_t:xt;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):ft:o,f=Math.max(a,0)+s,y=e.range(),_=+y[0]+.5,x=+y[y.length-1]+.5,m=(e.bandwidth?gt:mt)(e.copy()),g=u.selection?u.selection():u,v=g.selectAll(".domain").data([null]),b=g.selectAll(".tick").data(p,e).order(),w=b.exit(),S=b.enter().append("g").attr("class","tick"),k=b.select("line"),A=b.select("text");v=v.merge(v.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),b=b.merge(S),k=k.merge(S.append("line").attr("stroke","currentColor").attr(h+"2",l*a)),A=A.merge(S.append("text").attr("fill","currentColor").attr(h,l*f).attr("dy",1===t?"0em":3===t?"0.71em":"0.32em")),u!==g&&(v=v.transition(u),b=b.transition(u),k=k.transition(u),A=A.transition(u),w=w.transition(u).attr("opacity",yt).attr("transform",function(t){return isFinite(t=m(t))?c(t):this.getAttribute("transform")}),S.attr("opacity",yt).attr("transform",function(t){var e=this.parentNode.__axis;return c(e&&isFinite(e=e(t))?e:m(t))})),w.remove(),v.attr("d",4===t||2==t?r?"M"+l*r+","+_+"H0.5V"+x+"H"+l*r:"M0.5,"+_+"V"+x:r?"M"+_+","+l*r+"V0.5H"+x+"V"+l*r:"M"+_+",0.5H"+x),b.attr("opacity",1).attr("transform",function(t){return c(m(t))}),k.attr(h+"2",l*a),A.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=dt.call(arguments),u},u.tickArguments=function(t){return arguments.length?(i=null==t?[]:dt.call(t),u):i.slice()},u.tickValues=function(t){return arguments.length?(n=null==t?null:dt.call(t),u):n&&n.slice()},u.tickFormat=function(t){return arguments.length?(o=t,u):o},u.tickSize=function(t){return arguments.length?(a=r=+t,u):a},u.tickSizeInner=function(t){return arguments.length?(a=+t,u):a},u.tickSizeOuter=function(t){return arguments.length?(r=+t,u):r},u.tickPadding=function(t){return arguments.length?(s=+t,u):s},u}function wt(t){return bt(1,t)}function St(t){return bt(2,t)}function kt(t){return bt(3,t)}function At(t){return bt(4,t)}function Mt(t,e){void 0===e&&(e={});var i=e.insertAt;if(t&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===i&&n.firstChild?n.insertBefore(o,n.firstChild):n.appendChild(o),o.styleSheet?o.styleSheet.cssText=t:o.appendChild(document.createTextNode(t))}}Mt(".chart_Axis{fill:#000}.chart_Axis,.chart_Axis .axis .tick>text{font:10px sans-serif}.chart_Axis .axis .tick line,.chart_Axis .axis path.domain{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}");var Tt=function(t){function e(e){void 0===e&&(e="origin");var i=t.call(this)||this;return i._drawStartPos=e,i.updateScale(),i}return a(e,t),e.prototype.type=function(t){return arguments.length?(this._type=t,this.updateScale(),this):this._type},e.prototype.timePattern=function(t){return arguments.length?(this._timePattern=t,this.updateScale(),this):this._timePattern},e.prototype.lowValue=function(){return this.parse(this.low())},e.prototype.highValue=function(){return this.parse(this.high())},e.prototype.parse=function(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},e.prototype.parseInvert=function(t){return t instanceof Array?t.map(function(t){return this.parseInvert(t)},this):this.parserInvert&&t?this.parserInvert(t):t},e.prototype.format=function(t){return t instanceof Array?t.map(function(t){return this.format(t)},this):null!=t&&this.formatter?this.formatter(t):t},e.prototype.parseFormat=function(t){return this.format(this.parse(t))},e.prototype.scalePos=function(t){var e=this.d3Scale(this.parse(t));return"ordinal"===this.type()&&(e+=this.bandwidth()/2),e},e.prototype.bandwidth=function(){return this.d3Scale.bandwidth?this.d3Scale.bandwidth():0},e.prototype.isHorizontal=function(){switch(this.orientation()){case"left":case"right":return!1}return!0},e.prototype.domain=function(t){return arguments.length?(this.d3Scale.domain(t),this):this.d3Scale.domain()},e.prototype.range=function(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},e.prototype.invert=function(t){return this.d3Scale.invert(t)},e.prototype.guideTarget=function(t){return this._guideElement=i.select(t).attr("class",this._class),this},e.prototype.enter=function(e,i){t.prototype.enter.call(this,e,i),this.svg=i.append("g"),this.svgAxis=this.svg.append("g").attr("class","axis"),this.svgGuides=(this._guideElement||i).append("g").attr("class","guide")},e.prototype.updateScale=function(){var t=this;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()){var e=this.ordinalMappings();this.formatter=function(t){return e[t]||t}}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=At(this.d3Scale),this.d3Guides=At(this.d3Scale);break;case"top":this.d3Axis=wt(this.d3Scale),this.d3Guides=wt(this.d3Scale);break;case"right":this.d3Axis=St(this.d3Scale),this.d3Guides=St(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{var n,o=void 0,a=void 0,r=void 0,s=void 0,l=void 0;this.isHorizontal()?(n=this.width(),this.d3Scale.range([0,n]),o=n*this.extend()/100,a=this.d3Scale.invert(0),s=this.d3Scale.invert(-o),r=this.d3Scale.invert(n),l=this.d3Scale.invert(n+o)):(n=this.height(),this.d3Scale.range([n,0]),o=n*this.extend()/100,a=this.d3Scale.invert(n),s=this.d3Scale.invert(n+o),r=this.d3Scale.invert(0),l=this.d3Scale.invert(-o)),s===a&&(s=a-a*this.extend()/100),l===r&&(l=r+r*this.extend()/100),Math.sign(a)!==Math.sign(s)&&(s=0),Math.sign(r)!==Math.sign(l)&&(l=0),this.d3Scale.domain([s,l])}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());var h=this.ticks();return h.length&&(this.d3Axis.tickValues(h.map(function(e){return t.parse(e.value)})).tickFormat(function(t,e){return h[e].label}),this.d3Guides.tickValues(h.map(function(e){return t.parse(e.value)}))),this},e.prototype.adjustText=function(t,e){var n=this.isHorizontal(),o="left"===this.orientation(),a="bottom"===this.orientation(),r=this,s=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()&&s.call(function(){return r.linebreak.apply(r,arguments)},this.bandwidth());else if("wrap"===this.overlapMode())"ordinal"===this.type()&&s.call(function(){return r.wrap.apply(r,arguments)},this.bandwidth());else switch(n?this.overlapMode():"none"){case"stagger":s.style("text-anchor","middle").attr("dy",function(t,i){return(a?1:-1)*((a?.71:0)+i%e)+"em"}).attr("dx",0).attr("visibility",null).attr("transform","rotate(0)");break;case"hide":s.style("text-anchor","middle").attr("dy",(a?.71:0)+"em").attr("dx",0).attr("visibility",function(t,i){return i%e?"hidden":null}).attr("transform","rotate(0)");break;case"rotate":var l=-this.labelRotation()||0;if(0!==l&&e>1){s.each(function(){var t=i.select(this),e=t.node().getBBox(),n=(a?1:-1)*Math.sin(Math.PI*(-Math.abs(l)/180));t.style("text-anchor",l>0?a?"start":"end":a?"end":"start").attr("dy",e.height/2*n+"px").attr("dx",l>0?a?"0.71em":"-0.71em":a?"-0.71em":"0.71em").attr("transform","rotate("+l+")").attr("visibility",null)});break}default:s.style("text-anchor",n?"middle":o?"end":"start").attr("dy",n?(a?.71:0)+"em":"0.32em").attr("dx",0).attr("visibility",null).attr("transform","rotate(0)")}},e.prototype.calcTickOverlapModulus=function(t){var e=1;switch(this.overlapMode()){case"rotate":case"stagger":case"hide":var i=[];t.selectAll(".tick > text").each(function(){for(var t=this.getBoundingClientRect(),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},e.prototype.calcOverflow=function(t,e){if(this.updateScale(),this.hidden())return{left:0,top:0,right:0,bottom:0,depth:0,tickOverlapModulus:1};var i=this.isHorizontal();this.range(i?[0,this.width()]:[this.height(),0]);var 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();var a={left:0,top:0,right:0,bottom:0,depth:0,tickOverlapModulus:this.calcTickOverlapModulus(o)};this.adjustText(o,a.tickOverlapModulus);var r=o.node().getBBox();switch(a.depth=i?r.height:r.width,this.shrinkToFit()){case"low":case"both":a.left=i?-r.x:0,a.bottom=i?0:-(this.height()-(r.height+r.y))}switch(this.shrinkToFit()){case"high":case"both":a.top=i?0:-r.y,a.right=i?-(this.width()-r.x-r.width):0}return n.remove(),a},e.prototype.wrap=function(t,e,n){n=n||/\s+/;var o=this;t.each(function(){for(var t=i.select(this),a=t.text().split(n).reverse(),r=[],s=0,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(a.length/u),d=parseFloat(t.attr("dy")),f=t.text(null).append("tspan").attr("x",l).attr("y",h).attr("dy",d+"em"),y=0,_=a.pop();_;)r.push(_),f.text(r.join(" ")),y++,f.node().getComputedTextLength()>e&&y>=p&&(r.pop(),f.text(r.join(" ")),r=[_],f=t.append("tspan").attr("x",l).attr("y",h).attr("dy",1.1*++s+d+"em").text(_),y=0),_=a.pop();o.isHorizontal()||t.selectAll("tspan").attr("y",-s/2+"em")})},e.prototype.linebreak=function(t,e){this.wrap(t,e,"\n")},e.prototype.update=function(e,i){var n=this;t.prototype.update.call(this,e,i),this.svg.style("display",this.hidden()?"none":null);var o=this.calcOverflow(i),a=this.isHorizontal()?o.left:this.height()-o.top-o.bottom,r=this.isHorizontal()?this.width()-o.right-this.padding():0+this.padding();this.range(this.reverse()?[r,a]:[a,r]);var s=this;function l(t){t.attr("transform",function(){switch(s.orientation()){case"left":return"translate("+o.depth+", "+o.top+")";case"top":return"translate(0,"+o.depth+")";case"right":return"translate("+(s.width()-o.depth)+", "+o.top+")";case"bottom":return"translate(0,"+(s.height()-o.depth)+")"}return"translate(0,0)"})}this.svg.style("visibility","none"===this.type()?"hidden":null).transition().call(l),this._guideElement&&this.svgGuides.transition().call(l),this.svgAxis.call(this.d3Axis),this.adjustText(this.svgAxis,o.tickOverlapModulus);this.pos().x;var h=this.width(),c=this.svgAxis.selectAll(".axisTitle").data(this.title()?[this.title()]:[]),u=c.enter().append("text").attr("class","axisTitle").merge(c).transition().attr("dx",null).style("text-anchor","end");switch(this.orientation()){case"left":u.attr("transform","rotate(-90)").attr("x",-2).attr("y",2).attr("dy",".71em");break;case"right":u.attr("transform","rotate(-90)").attr("x",-2).attr("y",4).attr("dx",null).attr("dy","-.71em");break;case"top":u.attr("transform","rotate(0)").attr("x",h-2).attr("y",2).attr("dx",null).attr("dy",".71em");break;case"bottom":u.attr("transform","rotate(0)").attr("x",h-2).attr("y",-2).attr("dy",null)}u.text(this.title_exists()?this.title():""),c.exit().remove(),this.svgGuides.call(this.d3Guides).selectAll(".tick").classed("guide-0",function(t){return 0===t&&n.low()<0})},e.prototype.rerender=function(){this.svgAxis.call(this.d3Axis),this.svgGuides.call(this.d3Guides)},e.prototype.postUpdate=function(e,i){t.prototype.postUpdate.call(this,e,i),this._guideElement&&this._guideElement.attr("transform",this._element.attr("transform"))},r([i.publish("linear","set","Type",["none","ordinal","linear","pow","log","time"]),s("design:type",String)],e.prototype,"_type",void 0),r([i.publish("%Y-%m-%d","string","Time Series Pattern",null,{disable:function(t){return"time"!==t.type()}}),s("design:type",String)],e.prototype,"_timePattern",void 0),r([i.publish(!1,"boolean","Reverse"),s("design:type",Function)],e.prototype,"reverse",void 0),e}(i.SVGWidget);Tt.prototype._class+=" chart_Axis",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:function(t){return"pow"!==t.type()}}),Tt.prototype.publish("logBase",10,"number","Logarithmic base (disabled when type is not 'log')",null,{disable:function(t){return"log"!==t.type()}}),Tt.prototype.publish("ordinals",[],"array","Array of ordinal values to display (disabled when type is not 'ordinal')",null,{disable:function(t){return"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:function(t){return"ordinal"===t.type()}}),Tt.prototype.publish("tickFormat",null,"string","Format rules for tick text (disabled when type is 'ordinal')",null,{optional:!0,disable:function(t){return"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:function(t){return"ordinal"===t.type()}}),Tt.prototype.publish("high",null,"any","Maximum tick value (disabled when type is ordinal)",null,{optional:!0,disable:function(t){return"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:function(t){return"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:function(t){return"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:function(t){return"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:function(t){return"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});Mt(".chart_XYAxis .axis{fill:#000}.chart_XYAxis .axis,.chart_XYAxis .tick>text{font:10px sans-serif}.chart_XYAxis .focus .chart_Axis.value .tick{visibility:hidden}.chart_XYAxis .axis line,.chart_XYAxis .axis path{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}");var Pt=function(t){function e(){var e=t.call(this)||this;return e._skipSelection=!1,i.Utility.SimpleSelectionMixin.call(e),e._drawStartPos="origin",e.domainAxis=(new Tt).classed({domain:!0}).orientation_default("bottom").type("ordinal").overlapMode_default("stagger").shrinkToFit_default("high").extend_default(0),e.valueAxis=(new Tt).classed({value:!0}).orientation_default("left").type("linear").shrinkToFit_default("high"),e.xyBrush=i.brush().on("end",function(){return e.brushMoved()}).on("start.handle brush.handle end.handle",function(){return e.brushMoved2()}),e.xBrush=i.brushX().on("end",function(){return e.brushMoved()}).on("start.handle brush.handle end.handle",function(){return e.brushMoved2()}),e.yBrush=i.brushY().on("end",function(){return e.brushMoved()}).on("start.handle brush.handle end.handle",function(){return e.brushMoved2()}),e}return a(e,t),e.prototype.resetSelection=function(){return this._prevBrush=null,this},e.prototype.parseData=function(t){return this.domainAxis.parse(t)},e.prototype.parseValue=function(t){return this.valueAxis.parse(t,!0)},e.prototype.formatData=function(t){return this.domainAxis.format(t)},e.prototype.formatValue=function(t){return this.valueAxis.format(t)},e.prototype.parsedData=function(){return this.data().map(function(t){var e=0;return t.map(function(t,i){if(0===i)return this.parseData(t);if(i>=this.columns().length)return t;var n=this.yAxisStacked()?[e,e+this.parseValue(t)]:this.parseValue(t);return e+=this.parseValue(t),n},this)},this)},e.prototype.bandwidth=function(){return this.domainAxis.bandwidth()},e.prototype.enter=function(e,i){t.prototype.enter.call(this,e,i),this.svg=i.append("g"),this.svgRegions=i.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=i.append("g"),this.domainAxis.target(this.svg.node()).guideTarget(this.svgDomainGuide.node()),this.valueAxis.target(this.svg.node()).guideTarget(this.svgValueGuide.node()),this.svgBrush=i.append("g").attr("class","brush"),this.chartsEnter(this,this.svgData,250)},e.prototype.resizeBrushHandle=function(t,e,i){var n,o,a;return"e"===t.type||"w"===t.type?"M"+.5*(o=(n=+("e"===t.type))?1:-1)+","+(a=i/3)+"A6,6 0 0 "+n+" "+6.5*o+","+(a+6)+"V"+(2*a-6)+"A6,6 0 0 "+n+" "+.5*o+","+2*a+"ZM"+2.5*o+","+(a+8)+"V"+(2*a-8)+"M"+4.5*o+","+(a+8)+"V"+(2*a-8):"M"+(o=e/3)+", "+.5*(a=(n=+("s"===t.type))?1:-1)+"A6,6 0 0 "+(n+1)%2+" "+(o+6)+","+6.5*a+"H"+(2*o-6)+"A6,6 0 0 "+(n+1)%2+" "+2*o+","+.5*a+"ZM"+(o+8)+","+2.5*a+"H"+(2*o-8)+"M"+(o+8)+","+4.5*a+"H"+(2*o-8)},e.prototype.skipSelection=function(t){return arguments.length?(this._skipSelection=t,this):this._skipSelection},e.prototype.brushMoved=function(){if(!this._skipSelection){var t=[],e=this,n=i.brushSelection(this.svgBrush.node());n&&(t=this.data().filter(function(t){var i=e.dataPos(t[0]);if(e.use2dSelection()){var 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)}},e.prototype.brushMoved2=function(){var 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",function(t,e){return"translate("+o[e]+",0)"}):n.attr("display",null).attr("transform",function(t,e){return"translate(0, "+o[e]+")"})},e.prototype.dataPos=function(t){return this.domainAxis.scalePos(t)},e.prototype.valuePos=function(t){return this.valueAxis.scalePos(t)},e.prototype.getAxisSize=function(t){return{width:this.xAxis?this.xAxis.width():t.xAxis.width(),height:this.yAxis?this.yAxis.height():t.yAxis.width()}},e.prototype.calcMargin=function(t,e,i){for(var 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,a=this.height()-n.top-n.bottom,r=0,s=30,l=0,h=30,c=0;c<10;++c){this.xAxis.width(o-h).height(0);var u=this.xAxis.calcOverflow(e),p=u.depth;this.yAxis.width(0).height(a-s);var d=this.yAxis.calcOverflow(e),f=d.depth;if(r=u.right,l=d.top,p===s&&f===h)break;s=p,h=f}return this.xAxis.x(o/2+h/2+n.left).y(a+n.top).width(o-h),this.yAxis.x(n.left).y(a/2-s/2+n.top).height(a-s),n.left+=h,n.top+=l,n.right+=r,n.bottom+=s,n},e.prototype.updateRegions=function(t,e,n){var o=this,a=this.svgRegions.selectAll(".region").data(this.regions());a.enter().append("rect").attr("class","region"),n?a.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()}):a.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()}),a.exit().remove()},e.prototype.update=function(e,n){t.prototype.update.call(this,e,n);var o=this,a="horizontal"===this.orientation();if(this.updateRegions(e,n,a),this.domainAxis.orientation(a?"bottom":"left").title(this.xAxisTitle_exists()?this.xAxisTitle():this.columns()[0]),this.valueAxis.orientation(a?"left":"bottom"),this.xAxis=a?this.domainAxis:this.valueAxis,this.yAxis=a?this.valueAxis:this.domainAxis,"ordinal"===this.xAxisType()){var r=this.columns().length,s={};this.domainAxis.ordinals(this.data().map(function(t){return s[t[0]]=o.xAxisOrdinalMapping(t,t[r]),t[0]})).ordinalMappings(s)}else{var l=this.xAxisDomainLow()?this.xAxisDomainLow():this.domainAxis.parseInvert(i.min(this.parsedData(),function(t){return t[0]})),h=this.xAxisDomainHigh()?this.xAxisDomainHigh():this.domainAxis.parseInvert(i.max(this.parsedData(),function(t){return t[0]}));void 0!==l&&void 0!==h&&this.domainAxis.low(l).high(h)}var c=this.yAxisDomainLow()?this.yAxisDomainLow():this.valueAxis.parseInvert(i.min(this.parsedData(),function(t){return i.min(t.filter(function(t,e){return e>0&&o.columns()[e]&&0!==o.columns()[e].indexOf("__")&&null!==t}),function(t){return t instanceof Array?t[0]:t})})),u=this.yAxisDomainHigh()?this.yAxisDomainHigh():this.valueAxis.parseInvert(i.max(this.parsedData(),function(t){return i.max(t.filter(function(t,e){return e>0&&o.columns()[e]&&0!==o.columns()[e].indexOf("__")&&null!==t}),function(t){return t instanceof Array?t[1]:t})}));this.valueAxis.low(c).high(u),this.margin=this.calcMargin(e,n,a);var p=this.width()-this.margin.left-this.margin.right;p<0&&(p=0);var d=this.height()-this.margin.top-this.margin.bottom;d<0&&(d=0);var f=a?p:d,y=a?d:p;if(this.domainAxis.tickLength(this.xAxisGuideLines()?y:0).render(),this.valueAxis.tickLength(this.yAxisGuideLines()?f:0).render(),this.svgDataClipRect.attr("width",p).attr("height",d),this.svgData.transition().attr("transform","translate("+this.margin.left+","+this.margin.top+")"),this.updateBrush(p,d,f,a),this.updateFocusChart(e,n,this.margin,p,d,a),this.chartsUpdate(p,d,250),this.selectionMode())return this.brushMoved()},e.prototype.updateBrush=function(t,e,n,o){var a=this,r=this.use2dSelection()?this.xyBrush:o?this.xBrush:this.yBrush,s=i.brushSelection(this.svgBrush.node());r.extent([[0,0],[t,e]]),this.svgBrush.attr("transform","translate("+this.margin.left+", "+this.margin.top+")").style("display",this.selectionMode()?null:"none").call(r);var l=this.use2dSelection()?[]:o?[{type:"w"},{type:"e"}]:[{type:"n"},{type:"s"}],h=this.svgBrush.selectAll(".handle--custom").data(l);if(h.enter().append("path").attr("class","handle--custom").merge(h).attr("cursor",o?"ew-resize":"ns-resize").attr("d",function(i){return a.resizeBrushHandle(i,t,e)}),this.selectionMode()){if(this._prevXAxisType!==this.xAxisType()&&(this._prevXAxisType=this.xAxisType(),this._prevBrush=null),this._prevBrush){if(s){if(this._prevBrush.orientation!==this.orientation()){var c=s[0];s[0]=this._prevBrush.maxCurrExtent-s[1],s[1]=this._prevBrush.maxCurrExtent-c}var u=n/this._prevBrush.maxCurrExtent;1!==u&&this.svgBrush.transition().on("start",function(){r.on("end",null)}).call(r.move,[s[0]*u,s[1]*u]).on("end",function(){r.on("end",function(){return a.brushMoved()})})}}else this.svgBrush.call(r.move,[0,n]);this._prevBrush={orientation:this.orientation(),maxCurrExtent:n}}},e.prototype.updateFocusChart=function(t,e,i,n,o,a){var r=this,s=this.svgFocus.selectAll("#"+this.id()+"_focusChart").data(this.xAxisFocus()?[!0]:[]);s.enter().append("g").attr("id",this.id()+"_focusChart").attr("class","focus").each(function(){r.focusChart=(new r.constructor).target(this),r.focusChart.xBrush.on("brush.focus",function(){r.syncAxis(n),r.chartsUpdate(n,o,0)}),r.focusChart.layers(r.layers().map(function(t){return new t.constructor}))}).merge(s).each(function(){var t,e;r.copyPropsTo(r.focusChart,["layers"]);var i=0;try{for(var o=l(r.layers()),a=o.next();!a.done;a=o.next()){a.value.copyPropsTo(r.focusChart.layers()[i]),i++}}catch(e){t={error:e}}finally{try{a&&!a.done&&(e=o.return)&&e.call(o)}finally{if(t)throw t.error}}r.focusChart.xAxisFocus(!1).selectionMode(!0).skipSelection(!0).orientation("horizontal").xAxisGuideLines(!1).xAxisDomainLow(null).xAxisDomainHigh(null).yAxisGuideLines(!1).x(r.width()/2).y(r.height()-r.xAxisFocusHeight()/2).width(r.width()).height(r.xAxisFocusHeight()).columns(r.columns()).data(r.data()).render(),r.syncAxis(n)}),s.exit().each(function(){r.focusChart&&(r.focusChart.target(null),delete r.focusChart)}).remove()},e.prototype.syncAxis=function(t){var 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{var n=(e[1]-e[0])/t;this.xAxis.range([-e[0]/n,(t-e[0])/n])}this.xAxis.rerender()}},e.prototype.layerColumns=function(e){var i=e.columns(),n=t.prototype.columns.call(this).filter(function(t){return t!==i[0]});return n.length?c([i[0]],h(n),!1):i},e.prototype.layerColumnIndices=function(t){var e=t.columns();return this.layerColumns(t).map(function(t){return e.indexOf(t)})},e.prototype.layerColumnIndex=function(t,e){return t.columns().indexOf(e)},e.prototype.layerData=function(t){if(1===arguments.length){var e=this.layerColumnIndices(t);return t.data().map(function(t){var i=e.map(function(e){return t[e]});return i.__hpcc_origRow=t,i})}throw new Error("Setting data on XYAxisLayer is not supported.")},e.prototype.layerEnter=function(t,e,i){},e.prototype.layerUpdate=function(t,e,i){},e.prototype.layerExit=function(t,e,i){},e.prototype.chartsEnter=function(t,e,i){var n,o;void 0===i&&(i=250),this.layerEnter(this,e,i);try{for(var a=l(this.layers()),r=a.next();!r.done;r=a.next()){var s=r.value;s.__xyAxisElement=e.append("g").attr("class",s.class()),s.target(s.__xyAxisElement.node()).layerEnter(this,e,i)}}catch(t){n={error:t}}finally{try{r&&!r.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}},e.prototype.chartsUpdate=function(t,e,i){var n,o;this.layerUpdate(this,this.svgData,i);try{for(var a=l(this.layers()),r=a.next();!r.done;r=a.next()){var s=r.value;s.resize({width:t,height:e}).layerUpdate(this,s.__xyAxisElement,i)}}catch(t){n={error:t}}finally{try{r&&!r.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}},e.prototype.exit=function(e,i){this.valueAxis.target(null),this.domainAxis.target(null),t.prototype.exit.call(this,e,i)},e.prototype.selection=function(t){var e=this,n=this;this._selection.widgetElement().selectAll(".selected,.deselected").each(function(e){var o=t.indexOf(e.origRow)>=0;i.select(this).classed("selected",o).classed("deselected",!o).attr("filter",n._selection.svgGlowID()&&o?"url(#".concat(n._selection.svgGlowID(),")"):null)});var o=t.map(function(t){return e.rowToObj(t)});setTimeout(function(){e.click(o,"",!0)},0)},e.prototype.xAxisOrdinalMapping=function(t,e){return t[0]},e.prototype.click=function(t,e,i){},e}(i.SVGWidget);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:function(t){return"ordinal"===t.xAxisType()}}),Pt.prototype.publish("xAxisDomainHigh",null,"string","X-Axis High",null,{optional:!0,disable:function(t){return"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:function(t){return"horizontal"!==t.orientation()}}),Pt.prototype.publish("xAxisFocusHeight",80,"number","X-Axis Focus Height",null,{disable:function(t){return!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:function(t){return"ordinal"!==t.xAxisType()||t._class.indexOf("chart_Column")<0}}),Pt.prototype.publish("yAxisDomainLow",null,"string","Y-Axis Low",null,{optional:!0,disable:function(t){return"ordinal"===t.yAxisType()}}),Pt.prototype.publish("yAxisDomainHigh",null,"string","Y-Axis High",null,{optional:!0,disable:function(t){return"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");Mt(".chart_Scatter .area,.chart_Scatter .line,.chart_Scatter .pointShape{pointer-events:none}.chart_Scatter .point .pointSelection{fill:none;stroke:none;pointer-events:all}.chart_Scatter .point .pointSelection.selected{fill:none;stroke:red}");var Ct=function(t){function n(){var i=t.call(this)||this;return e.INDChart.call(i),e.ITooltip.call(i),i.xAxisGuideLines_default(!0).yAxisGuideLines_default(!0),i}return a(n,t),n.prototype.xPos=function(t,e){return"horizontal"===t.orientation()?t.dataPos(e.label):t.valuePos(e.value)},n.prototype.yPos=function(t,e){return"horizontal"===t.orientation()?t.valuePos(e.value):t.dataPos(e.label)},n.prototype.curve=function(){switch(this.interpolate()){case"linear":return N;case"step":return ct;case"step-before":return ut;case"step-after":return pt;case"basis":return Y;case"bundle":return U;case"cardinal":return J;case"catmullRom":return $;case"natural":return lt;default:return at}},n.prototype.getScale=function(){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()}},n.prototype.pointColor=function(t,e,i,n){return this.interpolate()&&this.pointDarken()?this.strokeColor(t,e,i,n):this.fillColor(t,e,i,n)},n.prototype.lineColor=function(t,e,i,n){return this.interpolateFill()&&this.interpolateDarken()?this.strokeColor(t,e,i,n):this.fillColor(t,e,i,n)},n.prototype.areaColor=function(t,e,i,n){return this.fillColor(t,e,i,n)},n.prototype.layerEnter=function(e,i,n){void 0===n&&(n=250),t.prototype.layerEnter.call(this,e,i,n);var o=this;this.tooltipHTML(function(t){return"series-table"===o.tooltipStyle()?o.tooltipFormat({label:t.label,arr:o.columns().slice(1).map(function(e,i){return{label:e,color:o._palette(e),value:o.data()[t.rowIdx][i+1]}})}):o.tooltipFormat({label:t.label,series:t.column,value:t.value})})},n.prototype.layerUpdate=function(e,n,o){var a=this;t.prototype.layerUpdate.call(this,e,n);var r,s,l,h="horizontal"===e.orientation(),c=h?this.height():this.width(),u=this;this._palette=this._palette.switch(this.paletteID()),this.useClonedPalette()&&(this._palette=this._palette.cloneNotExists(this.paletteID()+"_"+this.id())),this._prevPointShape!==this.pointShape()&&(n.selectAll(".data").remove(),this._prevPointShape=this.pointShape()),this.pointSizeColumn_exists()&&(r=this.columns().indexOf(this.pointSizeColumn()),s=i.extent(this.data(),function(t){return t[r]}),l=this.getScale().domain(s));var p=this.layerColumns(e),d=this.layerData(e),f=this.flattenData(p,d).map(function(t){return t.shape=function(t){switch(t){case"rectangle":return"rect";case"circle":return"circle";case"cross":return"path"}}(u.pointShape()),t.column=p[t.colIdx],t.row=d[t.rowIdx],t.origRow=d[t.rowIdx].__hpcc_origRow,s?(t.size=l(t.row[r])*(u.maxPointSize()-u.minPointSize())+u.minPointSize(),t.column!==u.pointSizeColumn()&&t):(t.size=u.pointSize(),t)}).filter(function(t){return t}),y=n.selectAll(".area").data(p.filter(function(t,e){return u.interpolate()&&u.interpolateFill()&&e>0})),m=y.enter().append("path"),g=function(){var t=L,e=null,i=x(0),n=B,o=x(!0),a=null,r=N,s=null;function l(l){var h,c,u,p,d,f=l.length,y=!1,x=new Array(f),m=new Array(f);for(null==a&&(s=r(d=_())),h=0;h<=f;++h){if(!(h<f&&o(p=l[h],h,l))===y)if(y=!y)c=h,s.areaStart(),s.lineStart();else{for(s.lineEnd(),s.lineStart(),u=h-1;u>=c;--u)s.point(x[u],m[u]);s.lineEnd(),s.areaEnd()}y&&(x[h]=+t(p,h,l),m[h]=+i(p,h,l),s.point(e?+e(p,h,l):x[h],n?+n(p,h,l):m[h]))}if(d)return s=null,d+""||null}function h(){return H().defined(o).curve(r).context(a)}return l.x=function(i){return arguments.length?(t="function"==typeof i?i:x(+i),e=null,l):t},l.x0=function(e){return arguments.length?(t="function"==typeof e?e:x(+e),l):t},l.x1=function(t){return arguments.length?(e=null==t?null:"function"==typeof t?t:x(+t),l):e},l.y=function(t){return arguments.length?(i="function"==typeof t?t:x(+t),n=null,l):i},l.y0=function(t){return arguments.length?(i="function"==typeof t?t:x(+t),l):i},l.y1=function(t){return arguments.length?(n=null==t?null:"function"==typeof t?t:x(+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:x(!!t),l):o},l.curve=function(t){return arguments.length?(r=t,null!=a&&(s=r(a)),l):r},l.context=function(t){return arguments.length?(null==t?a=s=null:s=r(a=t),l):a},l}().curve(this.curve());h?g.x(function(t){return u.xPos(e,t)}).y0(Math.min(c,this.yPos(e,{value:0}))).y1(function(t){return u.yPos(e,t)}):g.y(function(t){return u.yPos(e,t)}).x0(Math.max(0,this.xPos(e,{value:0}))).x1(function(t){return u.xPos(e,t)}),m.merge(y).attr("class",function(t){return"area series series-"+a.cssTag(t)}).each(function(t,e){i.select(this).attr("d",g(f.filter(function(t){return t.colIdx===e+1}))).style("opacity",u.interpolateFillOpacity()).style("stroke","none").style("fill",u.areaColor([],t,void 0,[]))}),y.exit().remove();var v=n.selectAll(".line").data(p.filter(function(t,e){return u.interpolate()&&e>0})),b=v.enter().append("path"),w=H().x(function(t){return u.xPos(e,t)}).y(function(t){return u.yPos(e,t)}).curve(this.curve());b.merge(v).attr("class",function(t){return"line series series-"+a.cssTag(t)}).each(function(t,e){var n=i.select(this),o=f.filter(function(t){return t.colIdx===e+1});n.attr("d",w(o)).style("stroke",u.lineColor([],t,void 0,[])).style("fill","none")}),v.exit().remove();var S=n.selectAll(".point").data(f,function(t,e){return t.shape+"_"+e});S.enter().append("g").each(function(t){var n=i.select(this);n.append(t.shape).attr("class","pointShape"),n.append("text").attr("class","pointValue").style("display","none").attr("text-anchor",u.valueAnchor()).attr("alignment-baseline",u.valueBaseline()).attr("fill",function(t,e){return"middle"===u.valueBaseline()||"central"===u.valueBaseline()?u.textColor(t.row,t.column,t.value,t.origRow):null}),n.append("circle").attr("class","pointSelection").on("mouseout.tooltip",u.tooltip.hide).on("mousemove.tooltip",u.tooltip.show).call(e._selection.enter.bind(e._selection)).on("click",function(t,i){u.click(e.rowToObj(e.data()[t.rowIdx]),t.column,e._selection.selected(this))}).on("dblclick",function(t,i){u.dblclick(e.rowToObj(e.data()[t.rowIdx]),t.column,e._selection.selected(this))})}).merge(S).attr("class",function(t){return"point series series-"+a.cssTag(t.column)}).each(function(t){i.select(this).select(".pointValue").attr("x",function(t){return u.xPos(e,t)}).attr("y",function(t){return u.yPos(e,t)}).style("display",u.showValue()?"block":"none").attr("text-anchor",u.valueAnchor()).attr("alignment-baseline",u.valueBaseline()).text(function(t){return t.value}),i.select(this).select(".pointSelection").attr("cx",function(t){return u.xPos(e,t)}).attr("cy",function(t){return u.yPos(e,t)}).attr("r",t.size);var n=i.select(this).select(".pointShape");switch(t.shape){case"rect":n.attr("x",function(i){return u.xPos(e,i)-t.size/2}).attr("y",function(i){return u.yPos(e,i)-t.size/2}).attr("width",t.size).attr("height",t.size).style("fill",u.pointColor(t.row,t.column,t.value,t.origRow));break;case"circle":n.attr("cx",function(t){return u.xPos(e,t)}).attr("cy",function(t){return u.yPos(e,t)}).attr("r",.9*t.size).style("fill",u.pointColor(t.row,t.column,t.value,t.origRow));break;case"path":n.attr("d",function(i){return"M"+(u.xPos(e,i)-t.size/2)+" "+(u.yPos(e,i)-t.size/2)+" L"+(u.xPos(e,i)+t.size/2)+" "+(u.yPos(e,i)+t.size/2)+" M"+(u.xPos(e,i)-t.size/2)+" "+(u.yPos(e,i)+t.size/2)+" L"+(u.xPos(e,i)+t.size/2)+" "+(u.yPos(e,i)-t.size/2)}).style("stroke",u.pointColor(t.row,t.column,t.value,t.origRow))}}),S.exit().remove()},n.prototype.exit=function(e,i){t.prototype.exit.call(this,e,i)},n.__inputs=[{id:"label",type:"any"},{id:"values",type:"number",multi:!0}],n}(Pt);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:function(t){return!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:function(t){return!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=function(t){function e(){var e=t.call(this)||this;return e.interpolate_default("linear").interpolateFill_default(!0),e}return a(e,t),e}(Ct);zt.prototype._class+=" chart_Area";Mt(".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}");var It=function(t){function n(){var n=t.call(this)||this;return n.textLocal=i.local(),n.stackedTextLocal=i.local(),e.INDChart.call(n),e.ITooltip.call(n),n._selection.skipBringToTop(!0),n._linearGap=25,n}return a(n,t),n.prototype.layerEnter=function(e,i,n){void 0===n&&(n=250),t.prototype.layerEnter.call(this,e,i,n);var o=this;this.tooltipHTML(function(t){if("series-table"===o.tooltipStyle())return o.tooltipFormat({label:t.row[0],arr:o.columns().slice(1).map(function(e,i){return{label:e,color:o._palette(e),value:t.row[i+1]}})});var i=t.row[t.idx];return i instanceof Array&&(i=i[1]-i[0]),o.tooltipFormat({label:t.row[0],series:o.layerColumns(e)[t.idx],value:i})})},n.prototype.adjustedData=function(t){var e=this;return this.layerData(t).map(function(i){var n=0;return i.map(function(i,o){if(0===o)return i;if(o>=e.layerColumns(t).length)return i;var a=t.yAxisStacked()?[n,n+i]:i;return n+=i,a},e)},this)},n.prototype.layerUpdate=function(e,n,o){void 0===o&&(o=250),t.prototype.layerUpdate.call(this,e,n,o);var a="horizontal"===e.orientation();this.isHorizontal=a;var r=this;this._palette=this._palette.switch(this.paletteID()),this.useClonedPalette()&&(this._palette=this._palette.cloneNotExists(this.paletteID()+"_"+this.id()));var s=i.format(r.showValueAsPercentFormat()),l=10,u=0;switch(e.xAxisType()){case"ordinal":l=e.bandwidth(),u=-l/2;break;case"linear":case"time":l=Math.max(Math.abs(e.dataPos(2)-e.dataPos(1))*(100-this._linearGap)/100,l),u=-l/2}this.tooltip.direction(a?"n":"e");var p=i.scaleBand().domain(r.layerColumns(e).filter(function(t,e){return e>0})).rangeRound(a?[0,l]:[l,0]).paddingInner(this.xAxisSeriesPaddingInner()).paddingOuter(0),d=[],f=[],y=this.columns().length,_=this.data();this.showValue()&&"series"===this.showValueAsPercent()&&_.forEach(function(t){t.filter(function(t,e){return e>0&&e<y}).forEach(function(t,e){void 0===f[e+1]&&(f[e+1]=0),f[e+1]+=t})}),(this.showDomainTotal()||this.showValue()&&"domain"===this.showValueAsPercent())&&(d=_.map(function(t){return t.filter(function(t,e){return e>0&&e<y}).reduce(function(t,e){return t+e},0)}));var x=n.selectAll(".dataRow").data(this.adjustedData(e)),m=e.data(),g=this.getAxisSize(e);x.enter().append("g").attr("class","dataRow").merge(x).each(function(t,n){var _=i.select(this),x=_.selectAll(".dataCell").data(t.filter(function(t,i){return i<r.layerColumns(e).length}).map(function(i,o){return{column:r.layerColumns(e)[o],row:t,origRow:m[n],value:i,idx:o}}).filter(function(t){return null!==t.value&&t.idx>0}),function(t){return t.column}),v=x.enter().append("g").attr("class","dataCell").on("mouseout.tooltip",function(t){(!r.tooltipInnerTextEllipsedOnly()||t.innerTextObj&&t.innerTextObj.isTruncated)&&r.tooltip.hide.apply(r,arguments)}).on("mousemove.tooltip",function(t){(!r.tooltipInnerTextEllipsedOnly()||t.innerTextObj&&t.innerTextObj.isTruncated)&&r.tooltip.show.apply(r,arguments)}).call(e._selection.enter.bind(e._selection)).on("click",function(t){r.click(e.rowToObj(t.origRow),t.column,e._selection.selected(this))}).on("dblclick",function(t){r.dblclick(e.rowToObj(t.origRow),t.column,e._selection.selected(this))}).style("opacity",0).each(function(t){var e=i.select(this);e.append("rect").attr("class","columnRect series series-"+r.cssTag(t.column)),e.append("text").attr("class","columnRectText").style("stroke","transparent")});v.transition().duration(o).style("opacity",1);var b=e.yAxisStacked()?l:p.bandwidth();v.merge(x).each(function(l){var h=i.select(this),c=e.dataPos(t[0])+(e.yAxisStacked()?0:p(l.column))+u,_=l.value instanceof Array?l.value[1]:l.value,x=l.origRow[l.idx];if(r.showValue()){var m=r.dataMeta();switch(r.showValueAsPercent()){case"series":var v=void 0!==m.sum?m.sum:f[l.idx];x=s(x/v);break;case"domain":var w=void 0!==m.sum?m.sum:d[n];x=s(x/w);break;default:x=i.format(r.showValueFormat())(x)}}var S=e.valuePos(_),k=e.valuePos(l.value instanceof Array?l.value[0]:0),A=Math.min(k,S),M=Math.abs(S-k),T=r.innerTextFontSize(),P=r.innerTextPadding_exists()?r.innerTextPadding():T/2.5,C=r.intersectRectRect({x:a?c:A,y:a?A:c,width:a?b:M,height:a?M:b},{x:0,y:0,width:g.width,height:g.height}),z=h.select("rect").transition().duration(o).style("fill",function(t){return r.fillColor(t.row,t.column,t.value,t.origRow)});a?z.attr("x",c).attr("y",A).attr("width",b).attr("height",M):z.attr("y",c).attr("x",A).attr("height",b).attr("width",M);var I=h.select("text").transition().duration(o).style("font-size",T+"px").style("fill",function(t){return r.textColor(t.row,t.column,t.value,t.origRow)});I.style("font-family",r.innerTextFontFamily_exists()?r.innerTextFontFamily():null);var F=r.innerTextPadding_exists()?r.innerTextPadding():8,D=T/2.7;if(a){var O=C.y+C.height-P;I.attr("x",c+b/2).attr("y",O+D).attr("transform","rotate(-90, ".concat(c+b/2,", ").concat(O,")"))}else I.attr("x",C.x+F).attr("y",c+b/2+D);I.attr("height",b).attr("width",M),r.showInnerText()&&I.text(function(t){var e=r.innerText(t.origRow,t.origRow[y],t.idx);if(e){var i=a?C.height:C.width,n=r.calcInnerText(i,e,x);return t.innerTextObj=n,n.text}return""});var R=h.selectAll(".dataText").data(r.showValue()?["".concat(_)]:[]);R.enter().append("g").attr("class","dataText").each(function(t){r.textLocal.set(this,(new i.Text).target(this).colorStroke_default("transparent"))}).merge(R).each(function(){var t,e,i={x:0,y:0},n=r.valueFontFamily(),o=r.valueFontSize(),s=r.textSize(x,n,o),h=parseFloat(x)>=0,u=r.valueAnchor()?r.valueAnchor():a?"middle":"start",p=C.x,d=g.width-(C.x+C.width),f=C.y,y=g.height-(C.y+C.height);if(l.innerTextObj){var _=l.innerTextObj,m=_.padding,v=_.valueTextWidth;e=!1,a?(u="middle",i.x=c+b/2,4===l.innerTextObj.category?(e=!0,i.y=A-m-o/2):i.y=A+m+o/2):(u="start",4===l.innerTextObj.category?(e=!0,i.x=M+A+m):i.x=M+A-v-m,i.y=c+b/2)}else a?(t=C.height<s.height,e=!r.valueCentered()||t,i.x=C.x+C.width/2,e?h?f<s.height+F?t?i.y=C.y+C.height+s.height:(e=!1,i.y=C.y+C.height/2):i.y=C.y-s.height/2-F:y<s.height?t?i.y=C.y-s.height/2-F:(e=!1,i.y=C.y+C.height/2):i.y=C.y+s.height+F:i.y=C.y+C.height/2):(t=C.width<s.width,e=!r.valueCentered()||t,i.y=C.y+C.height/2,e?h?d<s.width+F?r.showInnerText()||!t?(e=!1,i.x=C.x+C.width/2):i.x=C.x-(s.width-F):i.x=C.x+C.width+s.width/2+F:p<s.width?r.showInnerText()||!t?(e=!1,i.x=C.x+C.width/2):i.x=C.x+C.width+(s.width-F):i.x=C.x-(s.width-F):i.x=C.x+C.width/2);var w=e?null:r.textColor(l.row,l.column,l.value,l.origRow),S=r.columns(),k=r.yAxisStacked()&&t||e&&r.yAxisStacked()&&S.indexOf(l.column)!==S.length-1;r.textLocal.get(this).pos(i).anchor(u).fontFamily(n).fontSize(o).text("".concat(x)).colorFill(w).visible(r.showValue()&&!k).render()}),R.exit().each(function(t){r.textLocal.get(this).target(null)}).remove()}),x.exit().transition().duration(o).style("opacity",0).remove();var w=e.yAxisStacked()?d[n]:Math.max.apply(Math,c([],h(t.filter(function(t,e){return e>0&&e<y})),!1)),S=_.selectAll(".stackedTotalText").data(r.showDomainTotal()?[d[n]]:[]);S.enter().append("g").attr("class","stackedTotalText").each(function(t){r.stackedTextLocal.set(this,(new i.Text).target(this).colorStroke_default("transparent"))}).merge(S).each(function(i){var n={x:0,y:0},o=e.dataPos(t[0]),s=e.valuePos(w),l=r.valueFontFamily(),h=r.valueFontSize(),c=r.textSize(i,l,h),u=parseFloat(i)>=0,p="middle";a?(n.x=o,n.y=u?s-c.height/2:s+c.height/2):(p="start",n.y=o,n.x=u?s+c.width/2:s-c.width/2),r.stackedTextLocal.get(this).pos(n).anchor(p).fontFamily(l).fontSize(h).text(i).render()}),S.exit().each(function(t){r.textLocal.get(this).target(null)}).remove()}),x.exit().transition().duration(o).remove()},n.prototype.calcInnerText=function(t,e,i){var n,o,a=this.innerTextFontFamily_exists()?this.innerTextFontFamily():"Verdana",r=this.innerTextFontSize(),s=this.valueFontFamily_exists()?this.valueFontFamily():"Verdana",h=this.valueFontSize(),c=this.innerTextPadding_exists()?this.innerTextPadding():r/2.5,u=this.isHorizontal?h:this.textSize(i,s,h).width,p=e,d=3*c+this.textSize("...",a,r).width+u,f=1*c+u,y=4;if(3*c+this.textSize(e,a,r).width+u<t)y=1;else if(d<t){var _=t-d,x="";try{for(var m=l(e),g=m.next();!g.done;g=m.next()){var v=g.value;if(this.textSize(x+v,a,r).width>_){e=x+"...";break}x+=v}}catch(t){n={error:t}}finally{try{g&&!g.done&&(o=m.return)&&o.call(m)}finally{if(n)throw n.error}}y=2}else f<t?(e="",y=3):e="";return{text:e,isTruncated:p!==e,padding:c,category:y,valueTextWidth:u}},n.prototype.innerText=function(t,e,i){return t[0]},n.__inputs=[{id:"label",type:"string"},{id:"values",type:"number",multi:!0}],n}(Pt);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",function(){return 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:function(t){return!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:function(t){return!t.showValue()},optional:!0}),It.prototype.publish("showValueAsPercentFormat",".0%","string","D3 Format for %",null,{disable:function(t){return!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 Ft=function(t){function e(){var e=t.call(this)||this;return e.orientation_default("vertical"),e}return a(e,t),e}(It);function Dt(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,a,r,s=new Nt(t),l=+t.value&&(s.value=t.value),h=[s];for(null==e&&(e=Rt);i=h.pop();)if(l&&(i.value=+i.data.value),(o=e(i.data))&&(r=o.length))for(i.children=new Array(r),a=r-1;a>=0;--a)h.push(n=i.children[a]=new Nt(o[a])),n.parent=i,n.depth=i.depth+1;return s.eachBefore(Et)}function Rt(t){return t.children}function jt(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}Ft.prototype._class+=" chart_Bar",Nt.prototype=Ot.prototype={constructor:Nt,count:function(){return this.eachAfter(Dt)},each:function(t){var e,i,n,o,a=this,r=[a];do{for(e=r.reverse(),r=[];a=e.pop();)if(t(a),i=a.children)for(n=0,o=i.length;n<o;++n)r.push(i[n])}while(r.length);return this},eachAfter:function(t){for(var e,i,n,o=this,a=[o],r=[];o=a.pop();)if(r.push(o),e=o.children)for(i=0,n=e.length;i<n;++i)a.push(e[i]);for(;o=r.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(jt)}};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,a=[];n<o;)e=t[n],i&&qt(i,e)?++n:(i=Gt(a=Ht(a,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(Yt(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(Yt(t[i],t[n]),e)&&Vt(Yt(t[i],e),t[n])&&Vt(Yt(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 Yt(t[0],t[1]);case 3:return Xt(t[0],t[1],t[2])}var e}function Yt(t,e){var i=t.x,n=t.y,o=t.r,a=e.x,r=e.y,s=e.r,l=a-i,h=r-n,c=s-o,u=Math.sqrt(l*l+h*h);return{x:(i+a+l/u*c)/2,y:(n+r+h/u*c)/2,r:(u+o+s)/2}}function Xt(t,e,i){var n=t.x,o=t.y,a=t.r,r=e.x,s=e.y,l=e.r,h=i.x,c=i.y,u=i.r,p=n-r,d=n-h,f=o-s,y=o-c,_=l-a,x=u-a,m=n*n+o*o-a*a,g=m-r*r-s*s+l*l,v=m-h*h-c*c+u*u,b=d*f-p*y,w=(f*v-y*g)/(2*b)-n,S=(y*_-f*x)/b,k=(d*g-p*v)/(2*b)-o,A=(p*x-d*_)/b,M=S*S+A*A-1,T=2*(a+w*S+k*A),P=w*w+k*k-a*a,C=-(M?(T+Math.sqrt(T*T-4*M*P))/(2*M):P/T);return{x:n+w+S*C,y:o+k+A*C,r:C}}function Ut(t,e,i){var n,o,a,r,s=t.x-e.x,l=t.y-e.y,h=s*s+l*l;h?(o=e.r+i.r,o*=o,r=t.r+i.r,o>(r*=r)?(n=(h+r-o)/(2*h),a=Math.sqrt(Math.max(0,r/h-n*n)),i.x=t.x-n*s-a*l,i.y=t.y-n*l+a*s):(n=(h+o-r)/(2*h),a=Math.sqrt(Math.max(0,o/h-n*n)),i.x=e.x+n*s-a*l,i.y=e.y+n*l+a*s)):(i.x=e.x+i.r,i.y=e.y)}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 Zt(t){var e=t._,i=t.next._,n=e.r+i.r,o=(e.x*i.r+i.x*e.r)/n,a=(e.y*i.r+i.y*e.r)/n;return o*o+a*a}function Jt(t){this._=t,this.next=null,this.previous=null}function Kt(t){return null==t?null:function(t){if("function"!=typeof t)throw new Error;return t}(t)}function $t(){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,a,r=n.length,s=t(i)*e||0;if(s)for(o=0;o<r;++o)n[o].r+=s;if(a=function(t){if(!(o=t.length))return 0;var e,i,n,o,a,r,s,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;Ut(i,e,n=t[2]),e=new Jt(e),i=new Jt(i),n=new Jt(n),e.next=n.previous=i,i.next=e.previous=n,n.next=i.previous=e;t:for(s=3;s<o;++s){Ut(e._,i._,n=t[s]),n=new Jt(n),l=i.next,h=e.previous,c=i._.r,u=e._.r;do{if(c<=u){if(Qt(l._,n._)){i=l,e.next=i,i.previous=e,--s;continue t}c+=l._.r,l=l.next}else{if(Qt(h._,n._)){(e=h).next=i,i.previous=e,--s;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,a=Zt(e);(n=n.next)!==i;)(r=Zt(n))<a&&(e=n,a=r);i=e.next}for(e=[i._],n=i;(n=n.next)!==i;)e.push(n._);for(n=Bt(e),s=0;s<o;++s)(e=t[s]).x-=n.x,e.y-=n.y;return n.r}(n),s)for(o=0;o<r;++o)n[o].r-=s;i.r=a+s}}}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)}}Mt(".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}");var oe=function(t){function n(){var n=t.call(this)||this;return e.I2DChart.call(n),e.ITooltip.call(n),i.Utility.SimpleSelectionMixin.call(n),n._drawStartPos="origin",n.labelWidgets={},n.d3Pack=function(){var t=null,e=1,i=1,n=$t;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($t,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=Kt(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([n.width(),n.height()]).padding(1.5),n}return a(n,t),n.prototype.size=function(e){var i=t.prototype.size.apply(this,arguments);return arguments.length&&this.d3Pack.size([this.width(),this.height()]),i},n.prototype.enter=function(e,i){t.prototype.enter.call(this,e,i),this._selection.widgetElement(i);var n=this;this.tooltipHTML(function(t){return"series-table"===n.tooltipStyle()?n.tooltipFormat({label:t[0],arr:n.columns().slice(1).map(function(e,i){return{label:e,color:n._palette(t[0]),value:t[1]}})}):n.tooltipFormat({label:t.data[0],value:t.data[1]})})},n.prototype.update=function(e,n){var o=this;t.prototype.update.call(this,e,n);var a=this;this._palette=this._palette.switch(this.paletteID()),this.useClonedPalette()&&(this._palette=this._palette.cloneNotExists(this.paletteID()+"_"+this.id()));var r=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(r);var s=n.selectAll(".node").data(r.children||[],function(t){return t.data[0]});s.enter().append("g").attr("class",function(t,e){return"node series series-"+o.cssTag(t.data[0])}).attr("opacity",0).call(this._selection.enter.bind(this._selection)).on("click",function(t){a.click(a.rowToObj(t.data),a.columns()[1],a._selection.selected(this))}).on("dblclick",function(t){a.dblclick(a.rowToObj(t.data),a.columns()[1],a._selection.selected(this))}).each(function(t){var e=i.select(this),n=t.x,o=t.y;e.append("circle").attr("transform","translate("+n+","+o+")").attr("r",0).on("mouseout.tooltip",a.tooltip.hide).on("mousemove.tooltip",a.tooltip.show),t.__viz_faChar?a.labelWidgets[t.data[0]]=(new i.FAChar).char(t.__viz_faChar).target(this).render():a.labelWidgets[t.data[0]]=(new i.Text).text(t.data[0]).target(this).render()}).merge(s).transition().attr("opacity",1).each(function(t){var e=i.select(this),n={x:t.x,y:t.y};e.select("circle").transition().attr("transform","translate("+n.x+","+n.y+")").style("fill",a.fillColor(t.data,a.columns()[1],t.data[1])).attr("r",t.r).select("title").text(t.data[0]+" ("+t.data[1]+")"),t.__viz_faChar?a.labelWidgets[t.data[0]].pos(n).render():a.labelWidgets[t.data[0]].pos(n).colorFill_default(a.textColor(t.data,a.columns()[1],t.data[1])).width(2*t.r).text(t.data[0]).render()}),s.exit().transition().style("opacity",0).remove()},n.prototype.exit=function(e,i){t.prototype.exit.call(this,e,i)},n.__inputs=[{id:"label",type:"string"},{id:"value",type:"number"}],n}(i.SVGWidget);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 ae=function(t){function e(){return t.call(this)||this}return a(e,t),e.prototype.enter=function(e,i){this.pointSizeColumn_exists()||this.pointSizeColumn(this.columns()[this.columns().length-1]),t.prototype.enter.call(this,e,i)},e}(Ct);ae.prototype._class+=" chart_BubbleXY";var re,se,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=re;e;)(t=pe-e._time)>=0&&e._call.call(null,t),e=e._next;--le}function ve(){pe=(ue=fe.now())+de,le=he=0;try{ge()}finally{le=0,function(){var t,e,i=re,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:re=e);se=t,we(n)}(),pe=0}}function be(){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(ve,t-fe.now()-de)),ce&&(ce=clearInterval(ce))):(ce||(ue=fe.now(),ce=setInterval(be,1e3)),le=1,ye(ve)))}function Se(t){return t.ranges}function ke(t){return t.markers}function Ae(t){return t.measures}function Me(t){var e=t(0);return function(i){return Math.abs(t(i)-e)}}me.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||se===this||(se?se._next=this:re=this,se=this),this._call=t,this._time=i,we()},stop:function(){this._call&&(this._call=null,this._time=1/0,we())}};Mt(".chart_Bullet .domain{opacity:0}.chart_Bullet .bullet{border:1px solid 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}");var Te=function(t){function e(){var e=t.call(this)||this;return e._hiddenColumns={},i.Utility.SimpleSelectionMixin.call(e,!0),e}return a(e,t),e.prototype.bulletData=function(){var t=this;this._hiddenColumns={};var 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){var a=e.indexOf(n);return a>=0?i[a]instanceof Array?i[a]:[i[a]]:(o&&(t._hiddenColumns[o]=!0),[0])}},e.prototype.enter=function(e,n){t.prototype.enter.call(this,e,n),i.select(e.parentNode).style("overflow","auto"),this._selection.widgetElement(n)},e.prototype.update=function(e,n){t.prototype.update.call(this,e,n);var o=this;n.selectAll(".axis").style("display","none"),n.selectAll(".range,.measure,.marker").style("display",null);var a=2,r=8,s=2,l=8,h=this.width()-a-s,c=40-r-l,u=n.selectAll("svg").data(this.bulletData()),p=u.enter().append("svg").attr("class","bullet").call(this._selection.enter.bind(this._selection)).on("click",function(t){o.click(o.rowToObj(t.origRow),o.titleColumn(),o._selection.selected(this))}).on("dblclick",function(t){o.dblclick(o.rowToObj(t.origRow),o.titleColumn(),o._selection.selected(this))}).each(function(){var t=i.select(this).append("g").attr("class",function(t,e){return"bulletBar series series-"+o.cssTag(o.titleColumn())}).append("g").attr("class","bulletTitle");t.append("text").attr("class","title"),t.append("text").attr("class","subtitle").attr("dy","1em")}).merge(u),d=p.select(".bulletTitle").style("text-anchor","end").attr("transform","translate(-6,"+c/2+")");d.select(".title").text(function(t){return t.title}),d.select(".subtitle").text(function(t){return t.subtitle});var f=0;d.each(function(){var t=this.getBBox();t.width>f&&(f=t.width)});var y=function(){var t="left",e=!1,n=!1,o=Se,a=ke,r=Ae,s=380,l=30,h=At();function c(t){t.each(function(t,c){var u,p,d=o.call(this,t,c).slice().sort(i.descending),f=a.call(this,t,c).slice().sort(i.descending),y=r.call(this,t,c).slice().sort(i.descending),_=i.select(this),x=_.select("g.wrap");x.empty()&&(x=_.append("g").attr("class","wrap")),n?(u=l,p=s,x.attr("transform","rotate(90)translate(0,"+-s+")")):(u=s,p=l,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 v=Me(g),b=Me(m),w=x.selectAll("rect.range").data(d);w.enter().append("rect").attr("class",function(t,e){return"range s"+e}).attr("width",v).attr("height",p).attr("x",e?g:0).merge(w).transition(w).attr("x",e?m:0).attr("width",b).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",v).attr("height",p/3).attr("x",e?g:0).attr("y",p/3).merge(S).transition(S).attr("width",b).attr("height",p/3).attr("x",e?m:0).attr("y",p/3);var k=x.selectAll("line.marker").data(f);k.enter().append("line").attr("class","marker").attr("x1",g).attr("x2",g).attr("y1",p/6).attr("y2",5*p/6).merge(k).transition(k).attr("x1",m).attr("x2",m).attr("y1",p/6).attr("y2",5*p/6);var A=_.selectAll("g.axis").data([0]);A.enter().append("g").attr("class","axis"),A.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?(a=t,c):a},c.measures=function(t){return arguments.length?(r=t,c):r},c.width=function(t){return arguments.length?(s=+t,c):s},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(h-f-6).height(c);p.attr("width",h).attr("height",c+r+l).style("margin-left","".concat(a,"px")),p.select(".bulletBar").attr("transform","translate("+(f+6)+","+r+")").call(y),u.exit().remove(),Object.keys(this._hiddenColumns).length>0&&n.selectAll(".".concat(Object.keys(this._hiddenColumns).join(",."))).style("display","none")},e.prototype.exit=function(e,i){t.prototype.exit.call(this,e,i)},e.prototype.click=function(t,e,i){},e.prototype.dblclick=function(t,e,i){},r([i.publish(null,"set","Title Column",function(){return this.columns()},{optional:!0}),s("design:type",Function)],e.prototype,"titleColumn",void 0),r([i.publish(null,"set","Subtitle Column",function(){return this.columns()},{optional:!0}),s("design:type",Function)],e.prototype,"subtitleColumn",void 0),r([i.publish(null,"set","Ranges Column",function(){return this.columns()},{optional:!0}),s("design:type",Function)],e.prototype,"rangesColumn",void 0),r([i.publish(null,"set","Measures Column",function(){return this.columns()},{optional:!0}),s("design:type",Function)],e.prototype,"measuresColumn",void 0),r([i.publish(null,"set","Markers Column",function(){return this.columns()},{optional:!0}),s("design:type",Function)],e.prototype,"markersColumn",void 0),e}(i.HTMLWidget);Te.prototype._class+=" chart_Bullet";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=Fe(t,e[n]))return i;return 0}function Fe(t,e){for(var i=e[0],n=e[1],o=-1,a=0,r=t.length,s=r-1;a<r;s=a++){var l=t[a],h=l[0],c=l[1],u=t[s],p=u[0],d=u[1];if(De(l,u,e))return 0;c>n!=d>n&&i<(p-h)*(n-c)/(d-c)+h&&(o=-o)}return o}function De(t,e,i){var n,o,a,r;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])],a=i[n],r=e[n],o<=a&&a<=r||r<=a&&a<=o)}function Oe(){}var Re=[[],[[[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 je(){var t=1,e=1,n=i.thresholdSturges,o=l;function a(t){var e=n(t);if(Array.isArray(e))e=e.slice().sort(Ce);else{var o=i.extent(t),a=o[0],s=o[1];e=i.tickStep(a,s,e),e=i.range(Math.floor(a/e)*e,Math.floor(s/e)*e,e)}return e.map(function(e){return r(t,e)})}function r(i,n){var a=[],r=[];return function(i,n,o){var a,r,l,h,c,u,p=new Array,d=new Array;a=r=-1,h=i[0]>=n,Re[h<<1].forEach(f);for(;++a<t-1;)l=h,h=i[a+1]>=n,Re[l|h<<1].forEach(f);Re[h|0].forEach(f);for(;++r<e-1;){for(a=-1,h=i[r*t+t]>=n,c=i[r*t]>=n,Re[h<<1|c<<2].forEach(f);++a<t-1;)l=h,h=i[r*t+t+a+1]>=n,u=c,c=i[r*t+a+1]>=n,Re[l|h<<1|c<<2|u<<3].forEach(f);Re[h|c<<3].forEach(f)}a=-1,c=i[r*t]>=n,Re[c<<2].forEach(f);for(;++a<t-1;)u=c,c=i[r*t+a+1]>=n,Re[c<<2|u<<3].forEach(f);function f(t){var e,i,n=[t[0][0]+a,t[0][1]+r],l=[t[1][0]+a,t[1][1]+r],h=s(n),c=s(l);(e=d[h])?(i=p[c])?(delete d[e.end],delete p[i.start],e===i?(e.ring.push(l),o(e.ring)):p[e.start]=d[i.end]={start:e.start,end:i.end,ring:e.ring.concat(i.ring)}):(delete d[e.end],e.ring.push(l),d[e.end=c]=e):(e=p[c])?(i=d[h])?(delete p[e.start],delete d[i.end],e===i?(e.ring.push(l),o(e.ring)):p[i.start]=d[e.end]={start:i.start,end:e.end,ring:i.ring.concat(e.ring)}):(delete p[e.start],e.ring.unshift(n),p[e.start=h]=e):p[h]=d[c]={start:h,end:c,ring:[n,l]}}Re[c<<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?a.push([t]):r.push(t)}),r.forEach(function(t){for(var e,i=0,n=a.length;i<n;++i)if(-1!==Ie((e=a[i])[0],t))return void e.push(t)}),{type:"MultiPolygon",value:n,coordinates:a}}function s(e){return 2*e[0]+e[1]*(t+1)*4}function l(i,n,o){i.forEach(function(i){var a,r=i[0],s=i[1],l=0|r,h=0|s,c=n[h*t+l];r>0&&r<t&&l===r&&(a=n[h*t+l-1],i[0]=r+(o-a)/(c-a)-.5),s>0&&s<e&&h===s&&(a=n[(h-1)*t+l],i[1]=s+(o-a)/(c-a)-.5)})}return 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)?ze(Pe.call(t)):ze(t),a):n},a.smooth=function(t){return arguments.length?(o=t?l:Oe,a):o===l},a}function Ee(t,e,i){for(var n=t.width,o=t.height,a=1+(i<<1),r=0;r<o;++r)for(var s=0,l=0;s<n+i;++s)s<n&&(l+=t.data[s+r*n]),s>=i&&(s>=a&&(l-=t.data[s-a+r*n]),e.data[s-i+r*n]=l/Math.min(s+1,n-1+a-s,a))}function Ne(t,e,i){for(var n=t.width,o=t.height,a=1+(i<<1),r=0;r<n;++r)for(var s=0,l=0;s<o+i;++s)s<o&&(l+=t.data[r+s*n]),s>=i&&(s>=a&&(l-=t.data[r+(s-a)*n]),e.data[r+(s-i)*n]=l/Math.min(s+1,o-1+a-s,a))}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,a=n-o;t.t=e-a+(i-o)}var Ye=2*Math.PI,Xe=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){$e(t.coordinates,e,0)},MultiLineString:function(t,e){for(var i=t.coordinates,n=-1,o=i.length;++n<o;)$e(i[n],e,0)},Polygon:function(t,e){ti(t.coordinates,e)},MultiPolygon:function(t,e){for(var i=t.coordinates,n=-1,o=i.length;++n<o;)ti(i[n],e)},GeometryCollection:function(t,e){for(var i=t.geometries,n=-1,o=i.length;++n<o;)Ze(i[n],e)}};function $e(t,e,i){var n,o=-1,a=t.length-i;for(e.lineStart();++o<a;)n=t[o],e.point(n[0],n[1],n[2]);e.lineEnd()}function ti(t,e){var i=-1,n=t.length;for(e.polygonStart();++i<n;)$e(t[i],e,1);e.polygonEnd()}function ei(t,e){t&&Je.hasOwnProperty(t.type)?Je[t.type](t,e):Ze(t,e)}function ii(t){return t}var ni,oi,ai,ri,si=Ve(),li=Ve(),hi={point:Qe,lineStart:Qe,lineEnd:Qe,polygonStart:function(){hi.lineStart=ci,hi.lineEnd=di},polygonEnd:function(){hi.lineStart=hi.lineEnd=hi.point=Qe,si.add(Xe(li)),li.reset()},result:function(){var t=si/2;return si.reset(),t}};function ci(){hi.point=ui}function ui(t,e){hi.point=pi,ni=ai=t,oi=ri=e}function pi(t,e){li.add(ri*t-ai*e),ai=t,ri=e}function di(){pi(ni,oi)}var fi=1/0,yi=fi,_i=-fi,xi=_i,mi={point:function(t,e){t<fi&&(fi=t);t>_i&&(_i=t);e<yi&&(yi=e);e>xi&&(xi=e)},lineStart:Qe,lineEnd:Qe,polygonStart:Qe,polygonEnd:Qe,result:function(){var t=[[fi,yi],[_i,xi]];return _i=xi=-(yi=fi=1/0),t}};var gi,vi,bi,wi,Si=0,ki=0,Ai=0,Mi=0,Ti=0,Pi=0,Ci=0,zi=0,Ii=0,Fi={point:Di,lineStart:Oi,lineEnd:Ei,polygonStart:function(){Fi.lineStart=Ni,Fi.lineEnd=Li},polygonEnd:function(){Fi.point=Di,Fi.lineStart=Oi,Fi.lineEnd=Ei},result:function(){var t=Ii?[Ci/Ii,zi/Ii]:Pi?[Mi/Pi,Ti/Pi]:Ai?[Si/Ai,ki/Ai]:[NaN,NaN];return Si=ki=Ai=Mi=Ti=Pi=Ci=zi=Ii=0,t}};function Di(t,e){Si+=t,ki+=e,++Ai}function Oi(){Fi.point=Ri}function Ri(t,e){Fi.point=ji,Di(bi=t,wi=e)}function ji(t,e){var i=t-bi,n=e-wi,o=Ue(i*i+n*n);Mi+=o*(bi+t)/2,Ti+=o*(wi+e)/2,Pi+=o,Di(bi=t,wi=e)}function Ei(){Fi.point=Di}function Ni(){Fi.point=Bi}function Li(){Hi(gi,vi)}function Bi(t,e){Fi.point=Hi,Di(gi=bi=t,vi=wi=e)}function Hi(t,e){var i=t-bi,n=e-wi,o=Ue(i*i+n*n);Mi+=o*(bi+t)/2,Ti+=o*(wi+e)/2,Pi+=o,Ci+=(o=wi*t-bi*e)*(bi+t),zi+=o*(wi+e),Ii+=3*o,Di(bi=t,wi=e)}function Vi(t){this._context=t}Vi.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,Ye)}},result:Qe};var qi,Wi,Gi,Yi,Xi,Ui=Ve(),Qi={point:Qe,lineStart:function(){Qi.point=Zi},lineEnd:function(){qi&&Ji(Wi,Gi),Qi.point=Qe},polygonStart:function(){qi=!0},polygonEnd:function(){qi=null},result:function(){var t=+Ui;return Ui.reset(),t}};function Zi(t,e){Qi.point=Ji,Wi=Yi=t,Gi=Xi=e}function Ji(t,e){Yi-=t,Xi-=e,Ui.add(Ue(Yi*Yi+Xi*Xi)),Yi=t,Xi=e}function Ki(){this._string=[]}function $i(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}Ki.prototype={_radius:4.5,_circle:$i(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=$i(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 tn=function(t){function e(){var e=t.call(this)||this;return e.xAxisGuideLines_default(!1).yAxisGuideLines_default(!1).xAxisType_default("linear"),e}return a(e,t),e.prototype.xPos=function(t,e){return"horizontal"===t.orientation()?t.dataPos(e.label):t.valuePos(e.value)},e.prototype.yPos=function(t,e){return"horizontal"===t.orientation()?t.valuePos(e.value):t.dataPos(e.label)},e.prototype.layerEnter=function(e,i,n){void 0===n&&(n=250),t.prototype.layerEnter.call(this,e,i,n)},e.prototype.layerUpdate=function(e,n,o){var a=this;void 0===o&&(o=250),t.prototype.layerUpdate.call(this,e,n,o),this._palette=this._palette.switch(this.paletteID());var r=this.flattenData(this.layerColumns(e),this.layerData(e)),s=function(){var t=Le,e=Be,n=He,o=960,a=500,r=20,s=2,l=3*r,h=o+2*l>>s,c=a+2*l>>s,u=ze(20);function p(o){var a=new Float32Array(h*c),p=new Float32Array(h*c);o.forEach(function(i,o,r){var u=+t(i,o,r)+l>>s,p=+e(i,o,r)+l>>s,d=+n(i,o,r);u>=0&&u<h&&p>=0&&p<c&&(a[u+p*h]+=d)}),Ee({width:h,height:c,data:a},{data:p},r>>s),Ne({width:h,height:c,data:p},{data:a},r>>s),Ee({width:h,height:c,data:a},{data:p},r>>s),Ne({width:h,height:c,data:p},{data:a},r>>s),Ee({width:h,height:c,data:a},{data:p},r>>s),Ne({width:h,height:c,data:p},{data:a},r>>s);var f=u(a);if(!Array.isArray(f)){var y=i.max(a);f=i.tickStep(0,y,f),(f=i.range(0,Math.floor(y/f)*f,f)).shift()}return je().thresholds(f).size([h,c])(a).map(d)}function d(t){return t.value*=Math.pow(2,-2*s),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,s)-l,t[1]=t[1]*Math.pow(2,s)-l}function x(){return h=o+2*(l=3*r)>>s,c=a+2*l>>s,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,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,x()},p.cellSize=function(t){if(!arguments.length)return 1<<s;if(!((t=+t)>=1))throw new Error("invalid cell size");return s=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(r*(r+1));if(!((t=+t)>=0))throw new Error("invalid bandwidth");return r=Math.round((Math.sqrt(4*t*t+1)-1)/2),x()},p}().x(function(t){return a.xPos(e,t)}).y(function(t){return a.yPos(e,t)}).size([this.width(),this.height()]).bandwidth(this.contourBandwidth())(r),l=s.map(function(t){return t.value}),h=Math.min.apply(this,l),c=Math.max.apply(this,l);this._dataMinWeight=h,this._dataMaxWeight=c;var u=n.selectAll("path").data(s);u.enter().append("path").merge(u).attr("d",function(t,e){var i,n,o=4.5;function a(t){return t&&("function"==typeof o&&n.pointRadius(+o.apply(this,arguments)),ei(t,i(n))),n.result()}return a.area=function(t){return ei(t,i(hi)),hi.result()},a.measure=function(t){return ei(t,i(Qi)),Qi.result()},a.bounds=function(t){return ei(t,i(mi)),mi.result()},a.centroid=function(t){return ei(t,i(Fi)),Fi.result()},a.projection=function(e){return arguments.length?(i=null==e?(t=null,ii):(t=e).stream,a):t},a.context=function(t){return arguments.length?(n=null==t?(e=null,new Ki):new Vi(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)}()).attr("fill",function(t){return a.showContourFill()?a._palette(t.value,h,c):"none"}).attr("stroke",this.contourStrokeColor()).attr("stroke-linejoin","round").attr("stroke-width",this.contourStrokeWidth()),u.exit().remove()},e.prototype.exit=function(e,i){t.prototype.exit.call(this,e,i)},e.__inputs=[{id:"x",type:"any"},{id:"y",type:"number"}],e}(Pt);tn.prototype._class+=" chart_Contour",tn.prototype.implements(e.I1DChart.prototype),tn.prototype.publish("paletteID","YlGnBu","string","Color palette for this widget"),tn.prototype.publish("useClonedPalette",!0,"boolean","Enable or disable using a cloned palette"),tn.prototype.publish("showContourFill",!0,"boolean","Show/hide the contour background colors"),tn.prototype.publish("showContour",!0,"boolean","Show/hide the contour border lines"),tn.prototype.publish("contourBandwidth",40,"number","Controls the sensitivity of the contour grouping algorithm"),tn.prototype.publish("contourStrokeColor","#2C3A47","html-color","Color of the contour border lines"),tn.prototype.publish("contourStrokeWidth",1,"number","Width of the contour border lines");var en=function(t){function e(){var e=t.call(this)||this;return e.orientation_default("vertical").xAxisType_default("ordinal").yAxisType_default("time"),e}return a(e,t),e}(Ft);function nn(t){return function(){return t}}en.prototype._class+=" chart_Gantt";var on=1e-12,an=Math.PI,rn=an/2,sn=2*an;function ln(t){return t.innerRadius}function hn(t){return t.outerRadius}function cn(t){return t.startAngle}function un(t){return t.endAngle}function pn(t){return t&&t.padAngle}function dn(t){return t>=1?rn:t<=-1?-rn:Math.asin(t)}function fn(t,e,i,n,o,a,r){var s=t-i,l=e-n,h=(r?a:-a)/Math.sqrt(s*s+l*l),c=h*l,u=-h*s,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,v=m*m+g*g,b=o-a,w=p*y-f*d,S=(g<0?-1:1)*Math.sqrt(Math.max(0,b*b*v-w*w)),k=(w*g-m*S)/v,A=(-w*m-g*S)/v,M=(w*g+m*S)/v,T=(-w*m+g*S)/v,P=k-_,C=A-x,z=M-_,I=T-x;return P*P+C*C>z*z+I*I&&(k=M,A=T),{cx:k,cy:A,x01:-c,y01:-u,x11:k*(o/b-1),y11:A*(o/b-1)}}function yn(t){this._context=t}function _n(t){return new yn(t)}function xn(t){return t[0]}function mn(t){return t[1]}function gn(){}function vn(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 bn(t){this._context=t}function wn(t,e){this._basis=new bn(t),this._beta=e}function Sn(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 kn(t,e){this._context=t,this._k=(1-e)/6}function An(t,e){this._context=t,this._k=(1-e)/6}function Mn(t,e){this._context=t,this._k=(1-e)/6}function Tn(t,e,i){var n=t._x1,o=t._y1,a=t._x2,r=t._y2;if(t._l01_a>on){var s=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*s-t._x0*t._l12_2a+t._x2*t._l01_2a)/l,o=(o*s-t._y0*t._l12_2a+t._y2*t._l01_2a)/l}if(t._l23_a>on){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);a=(a*h+t._x1*t._l23_2a-e*t._l12_2a)/c,r=(r*h+t._y1*t._l23_2a-i*t._l12_2a)/c}t._context.bezierCurveTo(n,o,a,r,t._x2,t._y2)}function Pn(t,e){this._context=t,this._alpha=e}yn.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)}}},bn.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:vn(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:vn(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},wn.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],a=e[0],r=t[i]-o,s=e[i]-a,l=-1;++l<=i;)n=l/i,this._basis.point(this._beta*t[l]+(1-this._beta)*(o+n*r),this._beta*e[l]+(1-this._beta)*(a+n*s));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 bn(t):new wn(t,e)}return i.beta=function(e){return t(+e)},i}(.85),kn.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:Sn(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:Sn(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 kn(t,e)}return i.tension=function(e){return t(+e)},i}(0),An.prototype={areaStart:gn,areaEnd:gn,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:Sn(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 An(t,e)}return i.tension=function(e){return t(+e)},i}(0),Mn.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:Sn(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 Mn(t,e)}return i.tension=function(e){return t(+e)},i}(0),Pn.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:Tn(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 Cn=function t(e){function i(t){return e?new Pn(t,e):new kn(t,0)}return i.alpha=function(e){return t(+e)},i}(.5);function zn(t,e){this._context=t,this._alpha=e}function In(t,e){this._context=t,this._alpha=e}function Fn(t){return t<0?-1:1}function Dn(t,e,i){var n=t._x1-t._x0,o=e-t._x1,a=(t._y1-t._y0)/(n||o<0&&-0),r=(i-t._y1)/(o||n<0&&-0),s=(a*o+r*n)/(n+o);return(Fn(a)+Fn(r))*Math.min(Math.abs(a),Math.abs(r),.5*Math.abs(s))||0}function On(t,e){var i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function Rn(t,e,i){var n=t._x0,o=t._y0,a=t._x1,r=t._y1,s=(a-n)/3;t._context.bezierCurveTo(n+s,o+s*e,a-s,r-s*i,a,r)}function jn(t){this._context=t}zn.prototype={areaStart:gn,areaEnd:gn,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:Tn(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 zn(t,e):new An(t,0)}return i.alpha=function(e){return t(+e)},i}(.5),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._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:Tn(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 In(t,e):new Mn(t,0)}return i.alpha=function(e){return t(+e)},i}(.5),jn.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:Rn(this,this._t0,On(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,Rn(this,On(this,i=Dn(this,t,e)),i);break;default:Rn(this,this._t0,i=Dn(this,t,e))}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=i}}},Object.create(jn.prototype).point=function(t,e){jn.prototype.point.call(this,e,t)};var En="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},Nn=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},Ln=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}}(),Bn=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},Hn=function t(e,i,n){null===e&&(e=Function.prototype);var o=Object.getOwnPropertyDescriptor(e,i);if(void 0===o){var a=Object.getPrototypeOf(e);return null===a?void 0:t(a,i,n)}if("value"in o)return o.value;var r=o.get;return void 0!==r?r.call(n):void 0},Vn=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)},qn=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},Wn=function(){function t(e){var i=e.x,n=void 0===i?0:i,o=e.y,a=void 0===o?0:o,r=e.nx,s=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,v=e.id,b=e.className;Nn(this,t),this._dx=void 0!==r?r-n:u,this._dy=void 0!==s?s-a:h,this._x=n,this._y=a,this._color=d,this.id=v,this._className=b||"",this._type=y||"",this.data=f,this.note=m||{},this.connector=x||{},this.subject=_||{},this.disable=g||[]}return Ln(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}(),Gn=function(){function t(e){var i=e.annotations,n=e.accessors,o=e.accessorsInverse;Nn(this,t),this.accessors=n,this.accessorsInverse=o,this.annotations=i}return Ln(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 Bn({},t.type.getNoteBBoxOffset(),{positionX:t.x,positionY:t.y})})}}]),t}(),Yn=function(t,e){return"dynamic"!==t&&"left"!==t&&"right"!==t||(t=e<0?"top":"bottom"),t},Xn=function(t,e){return"dynamic"!==t&&"top"!==t&&"bottom"!==t||(t=e<0?"right":"left"),t},Un=["topBottom","top","bottom"],Qn=["leftRight","left","right"],Zn=function(t){var e=t.data,i=t.curve,n=void 0===i?_n:i,o=t.canvasContext,a=t.className,r=t.classID,s=function(){var t=xn,e=mn,i=nn(!0),n=null,o=_n,a=null;function r(r){var s,l,h,c=r.length,u=!1;for(null==n&&(a=o(h=_())),s=0;s<=c;++s)!(s<c&&i(l=r[s],s,r))===u&&((u=!u)?a.lineStart():a.lineEnd()),u&&a.point(+t(l,s,r),+e(l,s,r));if(h)return a=null,h+""||null}return r.x=function(e){return arguments.length?(t="function"==typeof e?e:nn(+e),r):t},r.y=function(t){return arguments.length?(e="function"==typeof t?t:nn(+t),r):e},r.defined=function(t){return arguments.length?(i="function"==typeof t?t:nn(!!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}().curve(n),l={type:"path",className:a,classID:r,data:e};return o?(s.context(o),l.pathMethods=s):l.attrs={d:s(e)},l},Jn=function(t){var e=t.data,i=t.canvasContext,n={type:"path",className:t.className,classID:t.classID,data:e},o=function(){var t=ln,e=hn,i=nn(0),n=null,o=cn,a=un,r=pn,s=null;function l(){var l,h,c=+t.apply(this,arguments),u=+e.apply(this,arguments),p=o.apply(this,arguments)-rn,d=a.apply(this,arguments)-rn,f=Math.abs(d-p),y=d>p;if(s||(s=l=_()),u<c&&(h=u,u=c,c=h),u>on)if(f>sn-on)s.moveTo(u*Math.cos(p),u*Math.sin(p)),s.arc(0,0,u,p,d,!y),c>on&&(s.moveTo(c*Math.cos(d),c*Math.sin(d)),s.arc(0,0,c,d,p,y));else{var x,m,g=p,v=d,b=p,w=d,S=f,k=f,A=r.apply(this,arguments)/2,M=A>on&&(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>on){var z=dn(M/c*Math.sin(A)),I=dn(M/u*Math.sin(A));(S-=2*z)>on?(b+=z*=y?1:-1,w-=z):(S=0,b=w=(p+d)/2),(k-=2*I)>on?(g+=I*=y?1:-1,v-=I):(k=0,g=v=(p+d)/2)}var F=u*Math.cos(g),D=u*Math.sin(g),O=c*Math.cos(w),R=c*Math.sin(w);if(T>on){var j=u*Math.cos(v),E=u*Math.sin(v),N=c*Math.cos(b),L=c*Math.sin(b);if(f<an){var B=S>on?function(t,e,i,n,o,a,r,s){var l=i-t,h=n-e,c=r-o,u=s-a,p=(c*(e-a)-u*(t-o))/(u*l-c*h);return[t+p*l,e+p*h]}(F,D,N,L,j,E,O,R):[O,R],H=F-B[0],V=D-B[1],q=j-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),Y=Math.sqrt(B[0]*B[0]+B[1]*B[1]);P=Math.min(T,(c-Y)/(G-1)),C=Math.min(T,(u-Y)/(G+1))}}k>on?C>on?(x=fn(N,L,F,D,u,C,y),m=fn(j,E,O,R,u,C,y),s.moveTo(x.cx+x.x01,x.cy+x.y01),C<T?s.arc(x.cx,x.cy,C,Math.atan2(x.y01,x.x01),Math.atan2(m.y01,m.x01),!y):(s.arc(x.cx,x.cy,C,Math.atan2(x.y01,x.x01),Math.atan2(x.y11,x.x11),!y),s.arc(0,0,u,Math.atan2(x.cy+x.y11,x.cx+x.x11),Math.atan2(m.cy+m.y11,m.cx+m.x11),!y),s.arc(m.cx,m.cy,C,Math.atan2(m.y11,m.x11),Math.atan2(m.y01,m.x01),!y))):(s.moveTo(F,D),s.arc(0,0,u,g,v,!y)):s.moveTo(F,D),c>on&&S>on?P>on?(x=fn(O,R,j,E,c,-P,y),m=fn(F,D,N,L,c,-P,y),s.lineTo(x.cx+x.x01,x.cy+x.y01),P<T?s.arc(x.cx,x.cy,P,Math.atan2(x.y01,x.x01),Math.atan2(m.y01,m.x01),!y):(s.arc(x.cx,x.cy,P,Math.atan2(x.y01,x.x01),Math.atan2(x.y11,x.x11),!y),s.arc(0,0,c,Math.atan2(x.cy+x.y11,x.cx+x.x11),Math.atan2(m.cy+m.y11,m.cx+m.x11),y),s.arc(m.cx,m.cy,P,Math.atan2(m.y11,m.x11),Math.atan2(m.y01,m.x01),!y))):s.arc(0,0,c,w,b,y):s.lineTo(O,R)}else s.moveTo(0,0);if(s.closePath(),l)return s=null,l+""||null}return l.centroid=function(){var i=(+t.apply(this,arguments)+ +e.apply(this,arguments))/2,n=(+o.apply(this,arguments)+ +a.apply(this,arguments))/2-an/2;return[Math.cos(n)*i,Math.sin(n)*i]},l.innerRadius=function(e){return arguments.length?(t="function"==typeof e?e:nn(+e),l):t},l.outerRadius=function(t){return arguments.length?(e="function"==typeof t?t:nn(+t),l):e},l.cornerRadius=function(t){return arguments.length?(i="function"==typeof t?t:nn(+t),l):i},l.padRadius=function(t){return arguments.length?(n=null==t?null:"function"==typeof t?t:nn(+t),l):n},l.startAngle=function(t){return arguments.length?(o="function"==typeof t?t:nn(+t),l):o},l.endAngle=function(t){return arguments.length?(a="function"==typeof t?t:nn(+t),l):a},l.padAngle=function(t){return arguments.length?(r="function"==typeof t?t:nn(+t),l):r},l.context=function(t){return arguments.length?(s=null==t?null:t,l):s},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},Kn=function(t){var e=t.type,i=t.subjectType,n=e.annotation,o=n.position,a=n.x-o.x,r=a+n.dx,s=n.y-o.y,l=s+n.dy,h=n.subject;if("circle"===i&&(h.outerRadius||h.radius)){var c=Math.sqrt((a-r)*(a-r)+(s-l)*(s-l)),u=Math.asin(-l/c),p=h.outerRadius||h.radius+(h.radiusPadding||0);a=Math.abs(Math.cos(u)*p)*(r<0?-1:1),s=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)&&(a=Math.abs(d)>Math.abs(n.dx)?d/2:d),(f>0&&n.dy>0||f<0&&n.dy<0)&&(s=Math.abs(f)>Math.abs(n.dy)?f/2:f),a===d/2&&s===f/2&&(a=r,s=l)}return[[a,s],[r,l]]},$n=function(t){var e=t.type,n=t.connectorData,o=t.subjectType;n||(n={}),n.points&&"number"!=typeof n.points||(n.points=to(e.annotation.offset,n.points)),n.curve||(n.curve=Cn);var a=[];if(e.editMode){var r=n.points.map(function(t,e){return Bn({},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})}),s=function(t){n.points[t][0]+=i.event.dx,n.points[t][1]+=i.event.dy,e.redrawConnector()};a=e.mapHandles(r.map(function(t){return Bn({},t.move,{drag:s.bind(e,t.index)})}))}var l=Kn({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:[Zn({data:l,curve:n.curve,className:"connector"})],handles:a}},to=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=[],a=1;a<=e;a++)o.push([i*a+a%2*20,n*a-a%2*20]);return o},eo=function(t){var e=t.subjectData,n=t.type;e.radius||e.outerRadius||(e.radius=20);var o=[],a=Jn({data:e,className:"subject"});if(n.editMode){var r=function(t){var e=t.cx,i=void 0===e?0:e,n=t.cy,o=void 0===n?0:n,a=t.r1,r=t.r2,s=t.padding,l={move:{x:i,y:o}};return void 0!==a&&(l.r1={x:i+a/Math.sqrt(2),y:o+a/Math.sqrt(2)}),void 0!==r&&(l.r2={x:i+r/Math.sqrt(2),y:o+r/Math.sqrt(2)}),void 0!==s&&(l.padding={x:i+a+s,y:o}),l}({r1:a.data.outerRadius||a.data.radius,r2:a.data.innerRadius,padding:e.radiusPadding}),s=function(t){var o=e[t]+i.event.dx*Math.sqrt(2);e[t]=o,n.redrawSubject(),n.redrawConnector()},l=[Bn({},r.r1,{drag:s.bind(n,void 0!==e.outerRadius?"outerRadius":"radius")})];e.innerRadius&&l.push(Bn({},r.r2,{drag:s.bind(n,"innerRadius")})),o=n.mapHandles(l)}return a.attrs["fill-opacity"]=0,{components:[a],handles:o}},io=function(){function t(e){var i=e.a,n=e.annotation,o=e.editMode,a=e.dispatcher,r=e.notePadding,s=e.accessors;if(Nn(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=a,a){var l=ho.bind(null,a,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!==r?r:3,this.offsetCornerX=0,this.offsetCornerY=0,s&&n.data&&this.init(s)}return Ln(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,a=e.className,r=e.attrs,s=e.handles,l=e.classID;if("handle"===o)!function(t){var e=t.group,n=t.handles,o=t.r,a=void 0===o?10:o,r=e.selectAll("circle.handle").data(n);r.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||a}).attr("class",function(t){return"handle "+(t.className||"")}),r.exit().remove()}({group:t,r:r&&r.r,handles:s});else{lo(t,[n.annotation],o,a,l);for(var h=t.select(o+"."+(l||a)),c=Object.keys(r),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(r[t]):h.attr(t,r[t])}),u.forEach(function(t){return h.attr(t,null)})}})}},{key:"getNoteBBox",value:function(){return uo(this.note,".annotation-note-content text")}},{key:"getNoteBBoxOffset",value:function(){var t=uo(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,a={type:this,subjectData:n},r={};"circle"===o?r=eo(a):"rect"===o?r=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,s=Zn({data:[[0,0],[a,0],[a,r],[0,r],[0,0]],className:"subject"});if(n.editMode){var l=[{x:a,y:r/2,drag:function(){e.width=i.event.x,n.redrawSubject(),n.redrawConnector()}.bind(n)},{x:a/2,y:r,drag:function(){e.height=i.event.y,n.redrawSubject(),n.redrawConnector()}.bind(n)}];o=n.mapHandles(l)}return s.attrs["fill-opacity"]=.1,{components:[s],handles:o}}(a):"threshold"===o?r=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,a=(void 0!==e.y1?e.y1:i.y)-i.y,r=(void 0!==e.y2?e.y2:i.y)-i.y;return{components:[Zn({data:[[n,a],[o,r]],className:"subject"})]}}(a):"badge"===o&&(r=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]:{},s=a.typeSettings&&a.typeSettings.subject;n.radius||(s&&s.radius?n.radius=s.radius:n.radius=14),n.x||s&&s.x&&(n.x=s.x),n.y||s&&s.y&&(n.y=s.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=Jn({className:"subject",data:{radius:c}});x.attrs.transform=_,x.attrs.fill=r.color,x.attrs["stroke-linecap"]="round",x.attrs["stroke-width"]="3px";var m=Jn({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=Zn({className:"subject-pointer",data:[[0,0],[p||0,0],[0,d||0],[0,0]]});else if(p||d){var v=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=Zn({className:"subject-pointer",data:[[0,0],[v(p),v(d)],[v(p,-1),v(d,-1)],[0,0]]})}if(g&&(g.attrs.fill=r.color,g.attrs["stroke-linecap"]="round",g.attrs["stroke-width"]="3px",h.push(g)),a.editMode){var b={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,a.redrawSubject()}.bind(a)};b.x||b.y||(b.y=-c),l=a.mapHandles([b])}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}}(a,this.annotation));var s=r,l=s.components,h=void 0===l?[]:l,c=s.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 a={};a="curve"===n?$n(o):"elbow"===n?function(t){var e=t.type,i=t.subjectType,n=e.annotation,o=n.position,a=n.x-o.x,r=a+n.dx,s=n.y-o.y,l=s+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)&&(a=Math.abs(c)>Math.abs(n.dx)?c/2:c),(u>0&&n.dy>0||u<0&&n.dy<0)&&(s=Math.abs(u)>Math.abs(n.dy)?u/2:u),a===c/2&&s===u/2&&(a=r,s=l)}var p=[[a,s],[r,l]],d=l-s,f=r-a,y=r,_=l,x=l<s&&r>a||r<a&&l>s?-1:1;if(Math.abs(f)<Math.abs(d)?(y=r,_=s+f*x):(_=l,y=a+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=[[a=g*(r<0?-1:1),s=g*(l<0?-1:1)],[y,_],[r,l]];else if(Math.abs(f)>Math.abs(d)){var v=Math.asin(-l/m);p=[[a=Math.abs(Math.cos(v)*m)*(r<0?-1:1),l],[r,l]]}else{var b=Math.acos(r/m);p=[[r,s=Math.abs(Math.sin(b)*m)*(l<0?-1:1)],[r,l]]}}else p=[[a,s],[y,_],[r,l]];return{components:[Zn({data:p,className:"connector"})]}}(o):function(t){var e=Kn(t);return{components:[Zn({data:e,className:"connector"})]}}(o);var r=a,s=r.components,l=void 0===s?[]:s,h=r.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,a=void 0===o?1:o,r=e.position;i=i?[-n[0]+i[0],-n[1]+i[1]]:[e.dx,e.dy],n||(n=[e.x-r.x,e.y-r.y]);var s=n[0],l=n[1],h=i[0],c=i[1],u=10*a,p=16/180*Math.PI,d=Math.atan(c/h);h<0&&(d+=Math.PI);var f=[[s,l],[Math.cos(d+p)*u+s,Math.sin(d+p)*u+l],[Math.cos(d-p)*u+s,Math.sin(d-p)*u+l],[s,l]];return{components:[Zn({data:f,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=Jn({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",a={bbox:e.bbox,align:o,offset:this.annotation.offset},r=n.lineType||e.lineType,s={};"vertical"===r?s=function(t){var e=t.align,i=t.x,n=void 0===i?0:i,o=t.y,a=void 0===o?0:o,r=t.bbox,s=t.offset;"top"===(e=Yn(e,s.y))?a-=r.height:"middle"===e&&(a-=r.height/2);var l=[[n,a],[n,a+r.height]];return{components:[Zn({data:l,className:"note-line"})]}}(a):"horizontal"===r&&(s=function(t){var e=t.align,i=t.x,n=void 0===i?0:i,o=t.y,a=void 0===o?0:o,r=t.offset,s=t.bbox;"right"===(e=Xn(e,r.x))?n-=s.width:"middle"===e&&(n-=s.width/2);var l=[[n,a],[n+s.width,a]];return{components:[Zn({data:l,className:"note-line"})]}}(a));var l=s,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}},{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,a=e.align||t.align||"dynamic";"vertical"===o?n="leftRight":"horizontal"===o&&(n="topBottom");var r=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,a=t.align,r=t.orientation,s=t.offset,l=void 0===s?{x:0,y:0}:s,h=-o.x,c=0;return-1!==Un.indexOf(r)?(a=Xn(a,l.x),l.y<0&&"topBottom"===r||"top"===r?c-=o.height+i:c+=i,"middle"===a?h-=o.width/2:"right"===a&&(h-=o.width)):-1!==Qn.indexOf(r)&&(a=Yn(a,l.y),l.x<0&&"leftRight"===r||"left"===r?h-=o.width+i:h+=i,"middle"===a?c-=o.height/2:"top"===a&&(c-=o.height)),{x:h,y:c}}({padding:i,bbox:t.bbox,offset:this.annotation.offset,orientation:n,align:a}),s=r.x,l=r.y;return this.offsetCornerX=s+this.annotation.dx,this.offsetCornerY=l+this.annotation.dy,this.note&&this.noteContent.attr("transform","translate("+s+", "+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 Bn({},t,{start:e.dragstarted.bind(e),end:e.dragended.bind(e)})})}}]),t}(),no=function(t,e,i){return function(t){function n(t){Nn(this,n);var i=qn(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 Vn(n,t),Ln(n,[{key:"className",value:function(){return""+(e.className||Hn(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"className",this)&&Hn(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"className",this).call(this)||"")}},{key:"drawSubject",value:function(t){return this.typeSettings.subject=Bn({},e.subject,this.typeSettings.subject),Hn(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"drawSubject",this).call(this,Bn({},t,this.typeSettings.subject))}},{key:"drawConnector",value:function(t){return this.typeSettings.connector=Bn({},e.connector,this.typeSettings.connector),Hn(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"drawConnector",this).call(this,Bn({},t,e.connector,this.typeSettings.connector))}},{key:"drawNote",value:function(t){return this.typeSettings.note=Bn({},e.note,this.typeSettings.note),Hn(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"drawNote",this).call(this,Bn({},t,e.note,this.typeSettings.note))}},{key:"drawNoteContent",value:function(t){return Hn(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"drawNoteContent",this).call(this,Bn({},t,e.note,this.typeSettings.note))}}],[{key:"init",value:function(t,e){return Hn(n.__proto__||Object.getPrototypeOf(n),"init",this).call(this,t,e),i&&(t=i(t,e)),t}}]),n}(t)},oo=function(t){function e(t){Nn(this,e);var i=qn(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return i.textWrap=t.textWrap||120,i.drawText(),i}return Vn(e,t),Ln(e,[{key:"updateTextWrap",value:function(t){this.textWrap=t,this.drawText()}},{key:"drawText",value:function(){if(this.note){lo(this.note,[this.annotation],"g","annotation-note-content");var t=this.note.select("g.annotation-note-content");lo(t,[this.annotation],"rect","annotation-note-bg"),lo(t,[this.annotation],"text","annotation-note-label"),lo(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,a=this.annotation.note&&this.annotation.note.bgPadding||this.typeSettings&&this.typeSettings.note&&this.typeSettings.note.bgPadding,r={top:0,bottom:0,left:0,right:0};if("number"==typeof a?r={top:a,bottom:a,left:a,right:a}:a&&"object"===(void 0===a?"undefined":En(a))&&(r=Bn(r,a)),this.annotation.note.title){var s=this.a.select("text.annotation-note-title");s.text(this.annotation.note.title),s.attr("fill",this.annotation.color),s.attr("font-weight","bold"),s.call(co,n,o),e=s.node().getBBox()}i.text(this.annotation.note.label).attr("dx","0"),i.call(co,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+r.left+r.right).attr("height",l.height+r.top+r.bottom).attr("x",l.x-r.left).attr("y",-r.top).attr("fill","white").attr("fill-opacity",0)}}}]),e}(io);no(oo,{className:"label",note:{align:"middle"}});var ao=no(oo,{className:"callout",note:{lineType:"horizontal"}}),ro=no(ao,{className:"callout elbow",connector:{type:"elbow"}});no(ao,{className:"callout curve",connector:{type:"curve"}}),no(io,{className:"badge",subject:{type:"badge"},disable:["connector","note"]}),no(oo,{className:"callout circle",subject:{type:"circle"},note:{lineType:"horizontal"},connector:{type:"elbow"}}),no(oo,{className:"callout rect",subject:{type:"rect"},note:{lineType:"horizontal"},connector:{type:"elbow"}});var so=function(t){function e(){return Nn(this,e),qn(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return Vn(e,t),Ln(e,[{key:"mapY",value:function(t){Hn(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){Hn(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}(ao);no(so,{className:"callout xythreshold",subject:{type:"threshold"}});var lo=function(t,e,i,n,o){var a=t.selectAll(i+"."+(o||n)).data(e);return a.enter().append(i).merge(a).attr("class",n),a.exit().remove(),t},ho=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)})},co=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),a=t.text().split(n||/[ \t\r\n]+/).reverse().filter(function(t){return""!==t}),r=void 0,s=[],l=t.text(null).append("tspan").attr("x",0).attr("dy","0.8em");r=a.pop();)s.push(r),l.text(s.join(" ")),l.node().getComputedTextLength()>e&&s.length>1&&(s.pop(),l.text(s.join(" ")),s=[r],l=t.append("tspan").attr("x",0).attr("dy",o+"em").text(r))})},uo=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 po(t){return.65*(t-.5)*2*Math.PI}function fo(t,e){return{x:Math.cos(t-Math.PI/2)*e,y:Math.sin(t-Math.PI/2)*e}}function yo(t,e,n){return void 0===n&&(n=!1),function(o){var a=i.interpolate(o.angle,t);return o.angle=t,function(t){return function(t,e,i){void 0===i&&(i=!1);var n=fo(t,e),o=180*t/Math.PI+(!0===i?180:0);return"translate(".concat(n.x,", ").concat(n.y,") rotate(").concat(o,")")}(a(t),e,n)}}}function _o(t,e,n){return function(o){var a=i.interpolate(o.startAngle,t),r=i.interpolate(o.endAngle,e);return function(t){return o.startAngle=a(t),o.endAngle=r(t),n(o)}}}var xo=function(t){function e(){var e=t.call(this)||this;return e._d3Arc=j().innerRadius(85).outerRadius(100),e._colorScale=i.scaleLinear().interpolate(i.interpolateHcl),e}return a(e,t),e.prototype.tip=function(t){var e=this;if(null===t||""===t.label)this._tooltipG.transition().style("opacity",0).on("interrupt end",function(){e._tooltipG.selectAll("g").remove()});else{this._tooltipG.interrupt().style("opacity",1),t.w=this._centerText.datum().w+10;var n="horizontal",o=0,a=5,r=5;t.y>=5&&t.y<=25?(o=t.x<0?-t.w/2:t.w/2,a=12.5,r=void 0,n="vertical"):t.y>25&&(a=25,r=0);var s=function(){var t=[],e=void 0,n=void 0,o=[],a={},r={},s=!1,l=void 0,h=ao,c=void 0,u=void 0,p=i.dispatch("subjectover","subjectout","subjectclick","connectorover","connectorout","connectorclick","noteover","noteout","noteclick","dragend","dragstart"),d=void 0,f=function(n){d=n,s||n.selectAll("circle.handle").remove();var f=t.map(function(t){return t.type||(t.type=h),t.disable||(t.disable=o),new Wn(t)});e=e||new Gn({annotations:f,accessors:a,accessorsInverse:r,ids:l}),n.selectAll("g").data([e]).enter().append("g").attr("class","annotations");var y=n.select("g.annotations");lo(y,e.annotations,"g","annotation"),y.selectAll("g.annotation").each(function(t){var e=i.select(this);e.attr("class","annotation"),lo(e,[t],"g","annotation-connector"),lo(e,[t],"g","annotation-subject"),lo(e,[t],"g","annotation-note"),lo(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:c,notePadding:u,editMode:s,dispatcher:p,accessors:a}),t.type.draw(),t.type.drawText&&t.type.drawText()})};return f.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}))),f},f.update=function(){return t&&e&&(t=e.annotations.map(function(t){return t.type.draw(),t})),f},f.updateText=function(){return e&&(e.updateText(c),t=e.annotations),f},f.updatedAccessors=function(){return e.setPositionWithAccessors(),t=e.annotations,f},f.disable=function(i){return arguments.length?(o=i,e&&(e.updateDisable(o),t=e.annotations),f):o},f.textWrap=function(i){return arguments.length?(c=i,e&&(e.updateTextWrap(c),t=e.annotations),f):c},f.notePadding=function(i){return arguments.length?(u=i,e&&(e.updateNotePadding(u),t=e.annotations),f):u},f.type=function(i,n){return arguments.length?(h=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=h,t.subject=n&&n.subject||t.subject,t.connector=n&&n.connector||t.connector,t.note=n&&n.note||t.note}),t=e.annotations),f):h},f.annotations=function(i){return arguments.length?(t=i,e&&e.annotations&&(t.some(function(t){return!t.type||"[object Object]"!==t.type.toString()})?(e=null,f(d)):e.annotations=t),f):e&&e.annotations||t},f.context=function(t){return arguments.length?(n=t,f):n},f.accessors=function(t){return arguments.length?(a=t,f):a},f.accessorsInverse=function(t){return arguments.length?(r=t,f):r},f.ids=function(t){return arguments.length?(l=t,f):l},f.editMode=function(i){return arguments.length?(s=i,d&&d.selectAll("g.annotation").classed("editable",s),e&&(e.editMode(s),t=e.annotations),f):s},f.collection=function(t){return arguments.length?(e=t,f):e},f.on=function(){var t=p.on.apply(p,arguments);return t===p?f:t},f}().type(ro).annotations([{data:t,dx:-t.x+o,dy:-t.y+a,color:"black",note:{label:t.label,lineType:n,padding:r,align:"middle"}}]).accessors({x:function(t){return t.x},y:function(t){return t.y}});this._tooltipG.call(s)}},e.prototype.calcSize=function(t,e,i){var n=t.node().getBBox(),o=e/n.width,a=i/n.height,r=o<a?o:a;return{width:n.width,height:n.height,scale:r}},e.prototype.updateText=function(t,e,i,n,o){t.datum({x:e,y:i,w:n,h:o}).attr("transform",null);var a=this.calcSize(t,n,o),r=e+n/2-a.width/2*a.scale,s=i+o/2-a.height/2*a.scale;t.attr("transform","translate(".concat(r,", ").concat(s,") scale(").concat(a.scale,")"))},e.prototype.calcWidth=function(){return Math.min(this.width(),this.height(),this.maxDiameter())},e.prototype.enter=function(e,i){var n=this;t.prototype.enter.call(this,e,i),i.on("click",function(t){n.click(t)}),this._usageArc=i.append("path").datum({startAngle:po(0),endAngle:po(0)}).style("fill","green").on("mousemove",function(t){var e=h(n._d3Arc.centroid(t),2),i=e[0],o=e[1];n.tip({x:i,y:o,label:n.valueDescription()})}).on("mouseout",function(t){n.tip(null)}),this._freeArc=i.append("path").datum({startAngle:po(0),endAngle:po(1)}).style("fill","lightGrey"),this._meanArc=i.append("path").datum({startAngle:po(0),endAngle:po(0)}).style("fill","black").on("mousemove",function(t){var e=h(n._d3Arc.centroid(t),2),i=e[0],o=e[1];n.tip({x:i,y:o,label:n.tickValueDescription()})}).on("mouseout",function(t){n.tip(null)}),this._mainTooltip=i.append("title");var o=this;function a(){return i.append("path").datum({angle:po(0)}).style("fill","black").style("stroke","black").attr("d","M 0 0 l -3 -3 l 6 0 z").on("mousemove",function(t){var e=h(o._d3Arc.centroid(o._meanArc.datum()),2),i=e[0],n=e[1];o.tip({x:i,y:n,label:o.tickValueDescription()})}).on("mouseout",function(t){o.tip(null)})}this._indInner=a(),this._indOuter=a(),this._centerText=i.append("text").attr("dy",".66em").style("fill","green").on("mousemove",function(t){n.tip({x:0,y:0,label:n.valueDescription()})}).on("mouseout",function(t){n.tip(null)}),this._bottomText=i.append("text").attr("dy",".66em").on("mousemove",function(t){n.tip({x:0,y:t.y,label:n.titleDescription()})}).on("mouseout",function(t){n.tip(null)}),this._tooltipG=i.append("g").attr("class","annotation-tip")},e.prototype.update=function(n,o){t.prototype.update.call(this,n,o),this._colorScale.domain(this.colorDomain()).range(this.colorRange()),o.attr("title",this.tooltip()).style("cursor",this.click!==e.prototype.click?"pointer":null);var a=this.calcWidth()/3,r=this.calcWidth()/2-5;this._d3Arc.innerRadius(a).outerRadius(r);var s=this.value(),l=this.tickValue();this._usageArc.style("fill",this._colorScale(s)).transition().duration(750).attrTween("d",_o(po(0),po(s),this._d3Arc)),this._freeArc.style("fill",this.emptyColor()).transition().duration(750).attrTween("d",_o(po(s),po(1),this._d3Arc)),this._meanArc.style("fill",this.tickColor()).style("visibility",this.showTick()?"visible":"hidden").transition().duration(750).attrTween("d",_o(po(l-.001),po(l+.001),this._d3Arc)),this._indInner.style("fill",this.tickColor()).style("stroke",this.tickColor()).style("visibility",this.showTick()?"visible":"hidden").transition().duration(750).attrTween("transform",yo(po(l),a,!0)),this._indOuter.style("fill",this.tickColor()).style("stroke",this.tickColor()).style("visibility",this.showTick()?"visible":"hidden").transition().duration(750).attrTween("transform",yo(po(l),r)),this._centerText.style("fill",this._colorScale(s)).text(i.format(".0%")(s)),this._bottomText.style("fill",this.click!==e.prototype.click?"blue":"black").style("text-decoration",this.click!==e.prototype.click?"underline":null).text(this.title());var h=fo(po(1),a-8);this.updateText(this._centerText,-h.x,-h.y,2*h.x,2*h.y);var c=fo(po(1),r);c.y+=5;var u=this.calcWidth()-20,p=this.calcWidth()/2-c.y-5;this.updateText(this._bottomText,-u/2,c.y,u,p),this._mainTooltip.text(this.tooltip())},e.prototype.click=function(t){},r([i.publish("","string"),s("design:type",Function)],e.prototype,"title",void 0),r([i.publish("","string"),s("design:type",Function)],e.prototype,"titleDescription",void 0),r([i.publish(128,"number"),s("design:type",Function)],e.prototype,"maxDiameter",void 0),r([i.publish(0,"number"),s("design:type",Function)],e.prototype,"value",void 0),r([i.publish("","string"),s("design:type",Function)],e.prototype,"valueDescription",void 0),r([i.publish(!1,"boolean"),s("design:type",Function)],e.prototype,"showTick",void 0),r([i.publish(0,"number"),s("design:type",Function)],e.prototype,"tickValue",void 0),r([i.publish("","string"),s("design:type",Function)],e.prototype,"tickValueDescription",void 0),r([i.publish("","string"),s("design:type",Function)],e.prototype,"tooltip",void 0),e}(i.SVGWidget);xo.prototype._class+=" chart_Gauge",xo.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."),xo.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."),xo.prototype.publish("emptyColor","lightgrey","html-color","Color of the empty portion of the gauge"),xo.prototype.publish("tickColor","black","html-color","Color of the tick");Mt(".chart_Pie path,.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{stroke:#000;stroke-width:2px;fill:none;opacity:.3}");var mo=function(t,e){return t[1]-e[1]>0?1:-1},go=function(t,e){return t[1]-e[1]>0?-1:1},vo=function(t){function o(){var n=t.call(this)||this;return n._minLabelTop=0,n._maxLabelBottom=0,e.I2DChart.call(n),e.ITooltip.call(n),i.Utility.SimpleSelectionMixin.call(n),n.d3Pie=function(){var t=q,e=V,i=null,n=x(0),o=x(P),a=x(0);function r(r){var s,l,h,c,u,p=r.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,a.apply(this,arguments)),g=m*(x<0?-1:1);for(s=0;s<p;++s)(u=y[f[s]=s]=+t(r[s],s,r))>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(r[t],r[e])}),s=0,h=d?(x-p*g)/d:0;s<p;++s,_=c)l=f[s],c=_+((u=y[l])>0?u*h:0)+g,y[l]={data:r[l],index:s,value:u,startAngle:_,endAngle:c,padAngle:m};return y}return r.value=function(e){return arguments.length?(t="function"==typeof e?e:x(+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:x(+t),r):n},r.endAngle=function(t){return arguments.length?(o="function"==typeof t?t:x(+t),r):o},r.padAngle=function(t){return arguments.length?(a="function"==typeof t?t:x(+t),r):a},r}(),n.d3Arc=j(),n.d3LabelArc=j(),n.tooltipTick_default(!1).tooltipOffset_default(0),n}return a(o,t),o.prototype.intersection=function(t,e){return this.intersectCircle(this.calcOuterRadius(),t,e)},o.prototype.calcInnerRadius=function(){return this.innerRadius_exists()?this.calcOuterRadius()*this.innerRadius()/100:0},o.prototype.calcOuterRadius=function(){var t=this,e=this.textSize(this.data().map(function(e){return t.getLabelText({data:e},!1)}),"Verdana",12).width,i=this._size.width-(this.showLabels()?2*e:0)-20,n=this._size.height-36-(this.showLabels()?this._smallValueLabelHeight:0),o=Math.min(i,n)/2-2;return i/2-2<this.minOuterRadius()?this._labelWidthLimit=e-(this.minOuterRadius()-(i/2-2)):this._labelWidthLimit=e,o<this.minOuterRadius()?this.minOuterRadius():o},o.prototype.calcSmallValueLabelHeight=function(){var t=this.data().reduce(function(t,e){return t+e[1]},0),e=0;return this.data().forEach(function(i){i[1]/t<.1&&e++}),this.labelHeight()*e},o.prototype.calcTotalValue=function(){return this.data().reduce(function(t,e){return t+e[1]},0)},o.prototype.getLabelText=function(t,e){var i,n=t.data[0];if(void 0!==this._labelWidthLimit&&e){var o=this.textSize(n,"Verdana",this.labelHeight()).width;this._labelWidthLimit<o&&(n=(i=n.length*(this._labelWidthLimit/o)-3)<n.length?n.slice(0,i)+"...":n)}if(this.showSeriesValue()&&(n+=" : ".concat(this._seriesValueFormatter(t.data[1]))),this.showSeriesPercentage()){var a=this._totalValue,r=this.dataMeta();void 0!==r.sum&&(a=r.sum);var s=t.data[1]/a*100;n+=" : ".concat(this._seriesPercentageFormatter(s),"%")}return n},o.prototype.selection=function(t){var e;if(!arguments.length)try{return null===(e=this._selection.selection2()[0])||void 0===e?void 0:e.data}catch(t){return}var i=JSON.stringify(t);this._selection.selection2(function(t){return i===JSON.stringify(t.data)})},o.prototype.selectByLabel=function(t){var e=this.data().filter(function(e){return e[0]===t})[0];e&&this.selection(e)},o.prototype.enter=function(e,i){t.prototype.enter.call(this,e,i),this._selection.widgetElement(i),this._slices=i.append("g"),this._labels=i.append("g");var n=this;this.tooltipHTML(function(t){return"series-table"===n.tooltipStyle()?n.tooltipFormat({label:t.data[0],arr:n.columns().slice(1).map(function(e,i){return{label:e,color:n._palette(t.data[0]),value:t.data[i+1]}})}):n.tooltipFormat({label:t.data[0],value:t.data[1]})})},o.prototype.update=function(e,n){var o=this;t.prototype.update.call(this,e,n);var a=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();var r=this.calcInnerRadius(),s=this.calcOuterRadius(),l=s+12;this.d3Arc.innerRadius(r).padRadius(s).outerRadius(s),this._quadIdxArr=[[],[],[],[]];var u=c([],h(this.data()),!1);switch(this.sortDataByValue()){case"ascending":u.sort(mo);break;case"descending":u.sort(go)}var p=this._slices.selectAll(".arc").data(this.d3Pie(u),function(t){return t.data[0]});this._labelPositions=[],p.enter().append("g").attr("class",function(t,e){return"arc series series-"+o.cssTag(t.data[0])}).attr("opacity",0).call(this._selection.enter.bind(this._selection)).on("click",function(t){a.click(a.rowToObj(t.data),a.columns()[1],a._selection.selected(this))}).on("dblclick",function(t){a.dblclick(a.rowToObj(t.data),a.columns()[1],a._selection.selected(this))}).each(function(t,e){i.select(this).append("path").on("mouseout.tooltip",a.tooltip.hide).on("mousemove.tooltip",a.tooltip.show).on("mouseover",x(0,0)).on("mouseout",x(-5,150))}).merge(p).transition().attr("opacity",1).each(function(t,e){var n=a.getQuadrant(_(t));a._quadIdxArr[n].push(e),t.outerRadius=s-5,i.select(this).select("path").transition().attr("d",a.d3Arc).style("fill",a.fillColor(t.data,a.columns()[1],t.data[1]))}),p.exit().transition().style("opacity",0).remove(),this.d3LabelArc.innerRadius(l).outerRadius(l);var d=this._labels.selectAll("text").data(this.showLabels()?this.d3Pie(u):[],function(t){return t.data[0]}),f=d.enter().append("text").on("mouseout.tooltip",a.tooltip.hide).on("mousemove.tooltip",a.tooltip.show).attr("dy",".5em").on("click",function(t){a._slices.selectAll("g").filter(function(e){t.data===e.data&&(a._selection.click(this),a.click(a.rowToObj(t.data),a.columns()[1],a._selection.selected(this)))})}).on("dblclick",function(t){a._slices.selectAll("g").filter(function(e){t.data===e.data&&a.dblclick(a.rowToObj(t.data),a.columns()[1],a._selection.selected(this))})}).merge(d).text(function(t){return o.getLabelText(t,!0)}).each(function(t,e){var i=a.d3LabelArc.centroid(t),n=_(t);i[0]=l*(a.isLeftSide(n)?1:-1),a._labelPositions.push({top:i[1],bottom:i[1]+a.labelHeight()})});this.showLabels()&&(this.adjustForOverlap(),f.transition().style("font-size",this.labelHeight()+"px").attr("transform",function(t,e){var i=a.d3LabelArc.centroid(t);return i[0]=l*(a.isLeftSide(_(t))?1:-1),i[1]=a._labelPositions[e].top,"translate("+i+")"}).style("text-anchor",function(t){return o.isLeftSide(_(t))?"start":"end"})),d.exit().remove();var y=this._labels.selectAll("polyline").data(this.showLabels()?this.d3Pie(u):[],function(t){return o.getLabelText(t,!0)});function _(t){return t.startAngle+(t.endAngle-t.startAngle)/2}function x(t,e){return function(){i.select(this).transition().delay(e).attrTween("d",function(e){var n=i.interpolate(e.outerRadius,s+t);return function(t){return e.outerRadius=n(t),a.d3Arc(e)}})}}y.enter().append("polyline").merge(y).transition().attr("points",function(t,e){var i=a.d3LabelArc.centroid(t),n=a.d3Arc.centroid(t),o=c([],h(i),!1);return i[0]=l*(a.isLeftSide(_(t))?1:-1),i[1]=a._labelPositions[e].top,[n,o,i]}),y.exit().remove(),this.showLabels()&&this.centerOnLabels()},o.prototype.isLeftSide=function(t){return(t=n.normalizeRadians(t))>2*Math.PI?t:t<Math.PI&&t>0},o.prototype.getQuadrant=function(t){var e=0,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},o.prototype.centerOnLabels=function(){var t=this.pos().y,e=2*t,i=this.calcOuterRadius(),n=Math.min(this._minLabelTop,-i),o=Math.max(this._maxLabelBottom,i),a=e-(o-n),r=Math.abs(this._minLabelTop),s=0;o>t?(s=t-o+this.labelHeight()/2,s-=a/2):n<0&&r>t&&(s=r-t+this.labelHeight()/2,s+=a/2);var l=this.pos();this.pos({y:l.y+s,x:l.x})},o.prototype.adjustForOverlap=function(){var t=this,e=this.labelHeight();this._quadIdxArr.forEach(function(i,n){var o;t._quadIdxArr[n].sort(function(e,i){return 1===n||2===n?t._labelPositions[e].top>t._labelPositions[i].top?-1:1:0===n||3===n?t._labelPositions[e].top>t._labelPositions[i].top?1:-1:void 0}),t._quadIdxArr[n].forEach(function(i,a){if(a>0)if(1===n||2===n){if(o<t._labelPositions[i].bottom){var r=t._labelPositions[i].bottom-o;t._labelPositions[i].top-=r,t._labelPositions[i].bottom-=r}}else if((0===n||3===n)&&o+e>t._labelPositions[i].top){r=Math.abs(t._labelPositions[i].top)-Math.abs(o+e);t._labelPositions[i].top-=r,t._labelPositions[i].bottom-=r}o=t._labelPositions[i].top})}),this._minLabelTop=0,this._maxLabelBottom=0,this._quadIdxArr.forEach(function(e,i){t._quadIdxArr[i].forEach(function(e,i){t._minLabelTop>t._labelPositions[e].top&&(t._minLabelTop=t._labelPositions[e].top),t._maxLabelBottom<t._labelPositions[e].bottom&&(t._maxLabelBottom=t._labelPositions[e].bottom)})})},o.prototype.exit=function(e,i){t.prototype.exit.call(this,e,i)},o.prototype.updateD3Pie=function(){var t=n.normalizeRadians(n.degreesToRadians(this.startAngle()));switch(this.sortDataByValue()){case"ascending":this.d3Pie.sort(mo);break;case"descending":this.d3Pie.sort(go);break;default:this.d3Pie.sort(null)}this.d3Pie.padAngle(.0025).startAngle(t).endAngle(2*Math.PI+t).value(function(t){return t[1]})},o.__inputs=[{id:"label",type:"string"},{id:"value",type:"number"}],o}(i.SVGWidget);vo.prototype._class+=" chart_Pie",vo.prototype.implements(e.I2DChart.prototype),vo.prototype.implements(e.ITooltip.prototype),vo.prototype.mixin(i.Utility.SimpleSelectionMixin),vo.prototype.publish("showLabels",!0,"boolean","If true, wedge labels will display"),vo.prototype.publish("showSeriesValue",!1,"boolean","Append data series value next to label",null,{disable:function(t){return!t.showLabels()}}),vo.prototype.publish("seriesValueFormat",",.0f","string","Number format used for formatting series values",null,{disable:function(t){return!t.showSeriesValue()}}),vo.prototype.publish("showSeriesPercentage",!1,"boolean","Append data series percentage next to label",null,{disable:function(t){return!t.showLabels()}}),vo.prototype.publish("seriesPercentageFormat",",.0f","string","Number format used for formatting series percentages",null,{disable:function(t){return!t.showSeriesPercentage()}}),vo.prototype.publish("paletteID","default","set","Color palette for this widget",vo.prototype._palette.switch(),{tags:["Basic","Shared"]}),vo.prototype.publish("useClonedPalette",!1,"boolean","Enable or disable using a cloned palette",null,{tags:["Intermediate","Shared"]}),vo.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}}),vo.prototype.publish("minOuterRadius",20,"number","Minimum outer radius (pixels)"),vo.prototype.publish("startAngle",0,"number","Starting angle of the first (and largest) wedge (degrees)"),vo.prototype.publish("labelHeight",12,"number","Font size of labels (pixels)",null,{disable:function(t){return!t.showLabels()}}),vo.prototype.publish("sortDataByValue","descending","set","Sort data by value",["none","ascending","descending"]);var bo=function(t){function e(){return t.call(this)||this}return a(e,t),e.prototype.postUpdate=function(e,i){t.prototype.postUpdate.call(this,e,i);var n=this._pos.x,o=this._pos.y;"origin"===this._drawStartPos&&this._target instanceof SVGElement&&(n-=this._size.width/2,o-=this._size.height/2),o+=this._size.height/4,this._element.attr("transform","translate("+n+","+o+")scale("+this._widgetScale+")")},e.prototype.updateD3Pie=function(){t.prototype.updateD3Pie.call(this),this.d3Pie.startAngle(-Math.PI/2).endAngle(Math.PI/2)},e}(vo);bo.prototype._class+=" chart_HalfPie";var wo=function(t){function e(){var e=t.call(this)||this;return e.xAxisGuideLines_default(!0).yAxisGuideLines_default(!0),e}return a(e,t),e.prototype.radius=function(t){return this.radiusX(t),this.radiusY(t),this},e.prototype.layerEnter=function(e,i,n){void 0===n&&(n=250),t.prototype.layerEnter.call(this,e,i,n),this._domForeignObject=this.svg.insert("foreignObject","#".concat(this.id()+"_clippath")),this._domCanvas=this._domForeignObject.append("xhtml:body").style("margin","0px").style("padding","0px").style("background-color","transparent").append("canvas"),this._heat=So(this._domCanvas.node())},e.prototype.layerUpdate=function(e,n,o){t.prototype.layerUpdate.call(this,e,n),this._palette=this._palette.switch(this.paletteID());var a=this.width()-this.margin.left-this.margin.right;a<0&&(a=0);var r=this.height()-this.margin.top-this.margin.bottom;r<0&&(r=0),this._domForeignObject.attr("x",this.margin.left).attr("y",this.margin.top).attr("width",a).attr("height",r),this._domCanvas.attr("width",a).attr("height",r);var s="horizontal"===e.orientation()?this.data().map(function(t){return[e.dataPos(t[0]),e.valuePos(t[1]),t[2]]}):this.data().map(function(t){return[e.valuePos(t[1]),e.dataPos(t[0]),t[2]]}),l=this.maxWeight_exists()?this.maxWeight():i.max(s,function(t){return t[2]});if("default"!==this.paletteID()){for(var h={},c=this.reversePalette(),u=0;u<8;++u)h[u/8]=this._palette((c?8-u:u)/8,0,1);this._heat.gradient(h)}else this._heat.gradient(this._heat.defaultGradient);this._heat.resize();var p=this.radiusAsPercent()?this.radiusX()*a/100:this.radiusX(),d=this.radiusAsPercent()?this.radiusY()*r/100:this.radiusY();this._heat.clear().radius(p,d,this.blur()).max(l).data(s).draw(this.minOpacity())},e}(Pt);function So(t){if(!(this instanceof So))return new So(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=[]}wo.prototype._class+=" chart_Heat",wo.prototype._palette=i.Palette.rainbow("default"),wo.prototype.publish("paletteID","default","set","Color palette for this widget",wo.prototype._palette.switch(),{tags:["Basic"]}),wo.prototype.publish("useClonedPalette",!1,"boolean","Enable or disable using a cloned palette",null,{tags:["Intermediate","Shared"]}),wo.prototype.publish("reversePalette",!1,"boolean","Reverse Palette Colors",null,{disable:function(t){return"default"===t.paletteID()}}),wo.prototype.publish("radiusX",25,"number","Point X radius (25 by default)"),wo.prototype.publish("radiusY",25,"number","Point Y radius (25 by default)"),wo.prototype.publish("radiusAsPercent",!1,"boolean","Calculate RadiusX + RadiusY as % of size"),wo.prototype.publish("blur",15,"number","Point blur radius (15 by default)"),wo.prototype.publish("maxWeight",void 0,"number","Clamp max weight to value (optional), omitting uses max data point",void 0,{optional:!0}),wo.prototype.publish("minOpacity",.05,"number","Minimum point opacity (0.05 by default)"),So.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;var n=this._ellipse=this._createCanvas(),o=n.getContext("2d"),a=this._r=t+i,r=this._r=e+i;return n.width=2*a,n.height=2*r,o.shadowOffsetX=o.shadowOffsetY=2*a,o.shadowOffsetY=o.shadowOffsetY=2*r,o.shadowBlur=i,o.shadowColor="black",o.beginPath(),o.ellipse(-a,-r,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){var e=this._createCanvas(),i=e.getContext("2d"),n=i.createLinearGradient(0,0,0,256);for(var o in e.width=1,e.height=256,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);var e=this._ctx;e.clearRect(0,0,this._width,this._height);for(var i=0,n=this._data.length,o=void 0;i<n;i++)(o=this._data[i])[2]<0?o[2]=0:o[2]>this._max&&(o[2]=this._max),e.globalAlpha=Math.max(o[2]/this._max,void 0===t?.05:t),e.drawImage(this._ellipse,o[0]-this._r,o[1]-this._r);var a=e.getImageData(0,0,this._width,this._height);return this._colorize(a.data,this._grad),e.putImageData(a,0,0),this},_colorize:function(t,e){for(var i=0,n=t.length,o=void 0;i<n;i+=4)(o=4*t[i+3])&&(t[i]=e[o],t[i+1]=e[o+1],t[i+2]=e[o+2])},_createCanvas:function(){return"undefined"!=typeof document?document.createElement("canvas"):new this._canvas.constructor}};var ko=Math.PI/3,Ao=[0,ko,2*ko,3*ko,4*ko,5*ko];function Mo(t){return t[0]}function To(t){return t[1]}Mt(".chart_HexBin .hexagon{fill:none;stroke:#000;stroke-width:.5px}.chart_HexBin .hexagon.selected{stroke:red}");var Po=function(t){function n(){var n=t.call(this)||this;return e.I2DAggrChart.call(n),n.tooltipValueFormat_default(",.0f"),e.ITooltip.call(n),n.tooltipHTML(function(t){var e=i.extent(t,function(t){return t.label}),o=i.extent(t,function(t){return t.value});return n.tooltipFormat({series:e[0]===e[1]?e[0]:"".concat(e[0]," -> ").concat(e[1]),label:o[0]===o[1]?o[0]:"".concat(o[0]," -> ").concat(o[1]),value:t.length})}),n._hexbin=function(){var t,e,i,n=0,o=0,a=1,r=1,s=Mo,l=To;function h(t){var n,o={},a=[],r=t.length;for(n=0;n<r;++n)if(!isNaN(c=+s.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 v=d+"-"+p,b=o[v];b?b.push(h):(a.push(b=o[v]=[h]),b.x=(d+(1&p)/2)*e,b.y=p*i)}return a}function c(t){var e=0,i=0;return Ao.map(function(n){var o=Math.sin(n)*t,a=-Math.cos(n)*t,r=o-e,s=a-i;return e=o,i=a,[r,s]})}return h.hexagon=function(e){return"m"+c(null==e?t:+e).join("l")+"z"},h.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},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?(s=t,h):s},h.y=function(t){return arguments.length?(l=t,h):l},h.radius=function(n){return arguments.length?(e=2*(t=+n)*Math.sin(ko),i=1.5*t,h):t},h.size=function(t){return arguments.length?(n=o=0,a=+t[0],r=+t[1],h):[a-n,r-o]},h.extent=function(t){return arguments.length?(n=+t[0][0],o=+t[0][1],a=+t[1][0],r=+t[1][1],h):[[n,o],[a,r]]},h.radius(1)}().x(function(t){return t.x}).y(function(t){return t.y}),n.xAxisGuideLines_default(!1).yAxisGuideLines_default(!1).xAxisType_default("linear"),n}return a(n,t),n.prototype.xPos=function(t,e){return"horizontal"===t.orientation()?t.dataPos(e.label):t.valuePos(e.value)},n.prototype.yPos=function(t,e){return"horizontal"===t.orientation()?t.valuePos(e.value):t.dataPos(e.label)},n.prototype.layerUpdate=function(e,n,o){void 0===o&&(o=250),t.prototype.layerUpdate.call(this,e,n,o);var a=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());var r=this.flattenData().map(function(t){return{x:a.xPos(e,t),y:a.yPos(e,t),label:e.parseData(t.label),value:e.parseValue(t.value),origRow:t}}),s=this._hexbin(r),l=i.min(s,function(t){return t.length}),h=i.max(s,function(t){return t.length});this._dataMinWeight=l,this._dataMaxWeight=h;var c=n.selectAll(".hexagon").data(s,function(t){return t.i+"_"+t.j});c.enter().append("path").attr("class","hexagon").call(e._selection.enter.bind(e._selection)).on("click",function(t){var i=a.data();a.click(t.map(function(t){return e.rowToObj(i[t.origRow.rowIdx])}),a.columns()[1],e._selection.selected(this))}).on("dblclick",function(t){var i=a.data();a.dblclick(t.map(function(t){return e.rowToObj(i[t.origRow.rowIdx])}),a.columns()[1],e._selection.selected(this))}).on("mouseout.tooltip",a.tooltip.hide).on("mousemove.tooltip",a.tooltip.show).attr("transform",function(t){return"translate("+t.x+","+t.y+")scale(0)"}).merge(c).transition().duration(o).attr("d",this._hexbin.hexagon()).attr("transform",function(t){return"translate("+t.x+","+t.y+")scale(1)"}).style("fill",function(t){return a._palette(t.length,l,h)}),c.exit().transition().duration(o).attr("transform",function(t){return"translate("+t.x+","+t.y+")scale(0)"}).remove()},n.prototype.exit=function(e,i){t.prototype.exit.call(this,e,i)},n.prototype.click=function(t,e,i){},n.prototype.dblclick=function(t,e,i){},n.__inputs=[{id:"x",type:"any"},{id:"y",type:"number"}],n}(Pt);Po.prototype._class+=" chart_HexBin",Po.prototype.implements(e.I2DAggrChart.prototype),Po.prototype.implements(e.ITooltip.prototype),Po.prototype.publish("paletteID","Blues","set","Color palette for this widget",Po.prototype._palette.switch(),{tags:["Basic","Shared"]}),Po.prototype.publish("useClonedPalette",!1,"boolean","Enable or disable using a cloned palette",null,{tags:["Intermediate","Shared"]}),Po.prototype.publish("binSize",20,"number","Bin radius",null,{range:{min:1,max:300,step:1}});Mt(".chart_Line .dataLine{fill:none;stroke:#4682b4;stroke-width:1.5px}");var Co=function(t){function e(){var e=t.call(this)||this;return e.interpolate_default("linear"),e}return a(e,t),e}(Ct);Co.prototype._class+=" chart_Line";var zo=function(t){function e(){return t.call(this)||this}return a(e,t),e.prototype.postUpdate=function(e,i){t.prototype.postUpdate.call(this,e,i);var n="left"===this.orientation()?0:this._size.width,o=this._size.height;"origin"===this._drawStartPos&&this._target instanceof SVGElement&&(n-=this._size.width/2,o-=this._size.height/2),this._element.attr("transform","translate("+n+","+o+")scale("+this._widgetScale+")")},e.prototype.updateD3Pie=function(){t.prototype.updateD3Pie.call(this),this.d3Pie.startAngle("left"===this.orientation()?0:-Math.PI/2).endAngle("left"===this.orientation()?Math.PI/2:0)},e.prototype.calcOuterRadius=function(){var t=this,e=this.textSize(this.data().map(function(e){return t.getLabelText({data:e})}),"Verdana",12).width;return Math.min(this._size.width-e-10,this._size.height-36)-2},e}(vo);zo.prototype._class+=" chart_QuarterPie",zo.prototype.publish("orientation","left","set","Determines the placement and start/end angle.",["left","right"]);var Io=function(t){function e(){return t.call(this)||this}return a(e,t),e.prototype.enter=function(e,i){t.prototype.enter.call(this,e,i),this._g=i.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")},e.prototype.update=function(e,n){t.prototype.update.call(this,e,n);var o=("horizontal"===this.orientation()?this.width():this.height())-this.lineWidth(),a="horizontal"===this.orientation()?this.height():this.width(),r=i.scaleLinear().domain([this.data()[0],this.data()[4]]).range([this.edgePadding(),o-this.edgePadding()]),s=this.candleWidth_exists()?this.candleWidth():a,l=this.lineWidth(),h=this.lineColor(),c=this.roundedCorners(),u=this.edgePadding(),p=r(this.data()[1]),d=r(this.data()[2]),f=r(this.data()[3]),y=-s/2,_=s/2,x=this.upperTextRotation(),m=this.lowerTextRotation(),g=this.textPadding(),v=this.labelFontSize(),b=this.valueFontSize(),w=Math.max(v,b),S=o-u;if(w>0){for(;p-u<w;)p+=w;for(;d-p<w;)d+=w;for(;f-d<w;)f+=w;for(;S-f<w;)f-=w;for(;f-d<w;)d-=w;for(;d-p<w;)p-=w}var k=-o/2-this.lineWidth()/2,A=0,M=0,T=1,P="start",C="end";"vertical"===this.orientation()&&(k=0,A=o/2+this.lineWidth()/2,M=-90,P="end",C="start",T=-1),this._g.style("shape-rendering","crispEdges").attr("transform","translate(".concat(k,",").concat(A,")rotate(").concat(M,")scale(").concat(1,")")),this._leftLine.attr("fill",h).attr("height",s).attr("width",l).attr("x",u).attr("y",y).attr("rx",c).attr("ry",c),this._rightLine.attr("class","right-line").attr("fill",h).attr("height",s).attr("width",l).attr("x",S).attr("y",y).attr("rx",c).attr("ry",c),this._midLine.attr("fill",h).attr("height",l).attr("width",S-u).attr("x",u).attr("y",-l/2),this._midOuterRect.attr("fill",h).attr("height",s).attr("width",f-p).attr("x",p).attr("y",y).attr("rx",c).attr("ry",c),this._midInnerRect1.attr("fill",this.innerRectColor()).attr("height",s-2*l).attr("width",d-(p+2*l)).attr("x",p+l).attr("y",l-s/2).attr("rx",.618*c).attr("ry",.618*c),this._midInnerRect2.attr("fill",this.innerRectColor()).attr("height",s-2*l).attr("width",f-d-l).attr("x",d).attr("y",l-s/2).attr("rx",.618*c).attr("ry",.618*c),this._q0text.attr("height",s).attr("width",f-p).attr("display",this.showLabels()?null:"none").attr("fill",this.textColor()).attr("x",0).attr("y",0).attr("transform","translate(".concat(u,", ").concat(y-g,")rotate(").concat(x,")scale(").concat(T,")")).attr("font-size",v).attr("text-anchor",P).attr("alignment-baseline","hanging").text(this.columns()[0]),this._q1text.attr("height",s).attr("width",f-p).attr("display",this.showLabels()?null:"none").attr("fill",this.textColor()).attr("x",0).attr("y",0).attr("transform","translate(".concat(p,", ").concat(y-g,")rotate(").concat(x,")scale(").concat(T,")")).attr("font-size",v).attr("text-anchor",P).attr("alignment-baseline","middle").text(this.columns()[1]),this._q2text.attr("height",s).attr("width",f-p).attr("display",this.showLabels()?null:"none").attr("fill",this.textColor()).attr("x",0).attr("y",0).attr("transform","translate(".concat(d,", ").concat(y-g,")rotate(").concat(x,")scale(").concat(T,")")).attr("font-size",v).attr("text-anchor",P).attr("alignment-baseline","middle").text(this.columns()[2]),this._q3text.attr("height",s).attr("width",f-p).attr("display",this.showLabels()?null:"none").attr("fill",this.textColor()).attr("x",0).attr("y",0).attr("transform","translate(".concat(f,", ").concat(y-g,")rotate(").concat(x,")scale(").concat(T,")")).attr("font-size",v).attr("text-anchor",P).attr("alignment-baseline","middle").text(this.columns()[3]),this._q4text.attr("height",s).attr("width",f-p).attr("display",this.showLabels()?null:"none").attr("fill",this.textColor()).attr("x",0).attr("y",0).attr("transform","translate(".concat(S+l,", ").concat(y-g,")rotate(").concat(x,")scale(").concat(T,")")).attr("font-size",v).attr("text-anchor",P).attr("alignment-baseline","baseline").text(this.columns()[4]),this._q0val.attr("height",s).attr("width",f-p).attr("display",this.showValues()?null:"none").attr("fill",this.textColor()).attr("x",0).attr("y",0).attr("transform","translate(".concat(u,", ").concat(_+g,")rotate(").concat(m,")scale(").concat(T,")")).attr("font-size",b).attr("text-anchor",C).attr("alignment-baseline","hanging").text(this.data()[0]),this._q1val.attr("height",s).attr("width",f-p).attr("display",this.showValues()?null:"none").attr("fill",this.textColor()).attr("x",0).attr("y",0).attr("transform","translate(".concat(p,", ").concat(_+g,")rotate(").concat(m,")scale(").concat(T,")")).attr("font-size",b).attr("text-anchor",C).attr("alignment-baseline","middle").text(this.data()[1]),this._q2val.attr("height",s).attr("width",f-p).attr("display",this.showValues()?null:"none").attr("fill",this.textColor()).attr("x",0).attr("y",0).attr("transform","translate(".concat(d,", ").concat(_+g,")rotate(").concat(m,")scale(").concat(T,")")).attr("font-size",b).attr("text-anchor",C).attr("alignment-baseline","middle").text(this.data()[2]),this._q3val.attr("height",s).attr("width",f-p).attr("display",this.showValues()?null:"none").attr("fill",this.textColor()).attr("x",0).attr("y",0).attr("transform","translate(".concat(f,", ").concat(_+g,")rotate(").concat(m,")scale(").concat(T,")")).attr("font-size",b).attr("text-anchor",C).attr("alignment-baseline","middle").text(this.data()[3]),this._q4val.attr("height",s).attr("width",f-p).attr("display",this.showValues()?null:"none").attr("fill",this.textColor()).attr("x",0).attr("y",0).attr("transform","translate(".concat(S+l,", ").concat(_+g,")rotate(").concat(m,")scale(").concat(T,")")).attr("font-size",b).attr("text-anchor",C).attr("alignment-baseline","baseline").text(this.data()[4])},e}(i.SVGWidget);Io.prototype._class+=" chart_QuartileCandlestick",Io.prototype.publish("textColor","black","html-color","Color of label and value text"),Io.prototype.publish("showLabels",!0,"boolean","If true, labels will be shown"),Io.prototype.publish("showValues",!0,"boolean","If true, values will be shown"),Io.prototype.publish("orientation","horizontal","set","Determines layout",["horizontal","vertical"]),Io.prototype.publish("valueFontSize",12,"number","Font size of value text (pixels)"),Io.prototype.publish("labelFontSize",12,"number","Font size of label text (pixels)"),Io.prototype.publish("roundedCorners",8,"number","Radius of rounded rect corners (pixels)"),Io.prototype.publish("lineWidth",4,"number","Width of lines (pixels)"),Io.prototype.publish("candleWidth",null,"number","Height of outer rect (pixels)",null,{optional:!0}),Io.prototype.publish("textPadding",8,"number","Padding between outer rect and text (pixels)"),Io.prototype.publish("edgePadding",30,"number","Padding between outer rect and left/right sides (pixels)"),Io.prototype.publish("lineColor","#333","html-color","Color of outer rect and lines"),Io.prototype.publish("innerRectColor","white","html-color","Color of the inner rects"),Io.prototype.publish("upperTextRotation",-60,"number","Rotation of label text (degrees)"),Io.prototype.publish("lowerTextRotation",-60,"number","Rotation of value text (degrees)");Mt(".chart_Radar .area,.chart_Radar .pointShape{pointer-events:none}.chart_Radar .point .pointSelection{fill:none;stroke:none;pointer-events:all}.chart_Radar .point .pointSelection.selected{fill:none;stroke:red}");var Fo=function(t){function n(){var n=t.call(this)||this;return e.INDChart.call(n),e.ITooltip.call(n),i.Utility.SimpleSelectionMixin.call(n),n}return a(n,t),n.prototype.mapShape=function(t){switch(t){case"rectangle":return"rect";case"circle":return"circle";case"cross":return"path"}},n.prototype.setPointAttributes=function(t,e,i){var n=this,o=this;switch(this.mapShape(this.pointShape())){case"rect":t.attr("width",o.pointSize()).attr("height",o.pointSize()).style("fill",function(t){return n.strokeColor(t.data,t.column,t.value)});break;case"circle":t.attr("r",o.pointSize()/2).attr("cx",e).attr("cy",i).style("fill",function(t){return n.strokeColor(t.data,t.column,t.value)});break;case"path":var a=o.pointSize()/2;t.attr("d",function(t){return"M"+(e-a)+" "+(i-a)+" L"+(e+a)+" "+(i+a)+" M"+(e-a)+" "+(i+a)+" L"+(e+a)+" "+(i-a)}).style("stroke",function(t){return n.strokeColor(t.data,t.column,t.value)})}},n.prototype.enter=function(e,i){var n=this;t.prototype.enter.call(this,e,i),this._selection.widgetElement(i),this.tooltipHTML(function(t){return n.tooltipFormat({label:t.label,series:t.column,value:t.value})})},n.prototype.update=function(e,n){var o=this;t.prototype.update.call(this,e,n),this._palette=this._palette.switch(this.paletteID());var a=this,r=this.height()/2,s=this.width()/2,l=this.columns(),h=this.data(),c=this.flattenData(l,h).map(function(t,e){return t.shape=o.mapShape(o.pointShape()),t.column=l[t.colIdx],t.row=h[e],t}),u=[],p=this.degrees2radians(360/this.data().length),d=this.fontSize(),f=0;c.filter(function(t){return 1===t.colIdx}).forEach(function(e){var i=t.prototype.textSize.call(o,e.label,"".concat(o.fontFamily()),o.fontSize());f<i.width&&(f=i.width)});var y=Math.min(r-d,s-f),_=n.selectAll(".label").data(c.filter(function(t){return 1===t.colIdx})),x=Math.max.apply(a,c.map(function(t){return t.value}));_.enter().append("text").attr("class","label").attr("text-anchor","middle").merge(_).attr("font-size",this.fontSize()).attr("font-family",this.fontFamily()).each(function(t,e){var n=a.polar2cartesian(y,e*p-Math.PI/2);u.push(n.map(function(t){return t*a.labelPaddingRatio()}));var o="middle",r=Math.round(n[0]);o=r>0?"start":o,o=r<0?"end":o,i.select(this).attr("text-anchor",o).attr("x",n[0]).attr("y",n[1])}).text(function(t){return t.label}),_.exit().remove();var m=n.selectAll(".domain").data(c.filter(function(t){return 1===t.colIdx}));m.enter().append("line").classed("domain",!0).style("stroke","#000").style("stroke-opacity","0.75").style("stroke-width","1px").merge(m).attr("x1",0).attr("y1",0).attr("x2",function(t,e){return u[e][0]}).attr("y2",function(t,e){return u[e][1]}),m.exit().remove();var g=n.selectAll(".value_guide").data(this.valueGuideRatios());g.enter().append("polygon").classed("value_guide",!0).style("stroke","grey").style("stroke-opacity","0.75").style("stroke-width","0.3px").merge(g).each(function(t,e){var n=[];u.forEach(function(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)}),g.exit().remove();var v=n.selectAll(".value_guide_text").data(this.valueGuideRatios());v.enter().append("text").attr("class","value_guide_text").attr("text-anchor","start").attr("font-size",this.fontSize()).attr("font-family",this.fontFamily()).merge(v).attr("x",2).attr("y",function(t){return u[0][1]*t}).text(function(t,e){return Math.round(t*x)}),g.exit().remove();var b=n.selectAll(".area").data(l.filter(function(t,e){return e>0}));b.enter().append("polygon").attr("class","area").style("stroke-opacity","0.75").style("stroke-width","0.3px").merge(b).style("stroke",function(t){return o.strokeColor([],t,0)}).style("fill",function(t){return o.fillColor([],t,0)}).style("fill-opacity",this.fillOpacity()).attr("points",function(t,e){return u.map(function(t,i){var n=h[i][e+1],o=0===n?0:n/x;return t[0]*o+","+t[1]*o}).join(" ")}),b.exit().remove();var w=n.selectAll(".point").data(c);w.enter().append("g").attr("class","point").on("mouseout.tooltip",a.tooltip.hide).on("mousemove.tooltip",a.tooltip.show).on("click",function(t,e){var i=a.data()[t.rowIdx],n=a.rowToObj(i),o=a._selection.selected(this);a.click(n,a.columns()[t.colIdx],o)}).on("dblclick",function(t,e){a.dblclick(a.rowToObj(a.data()[t.rowIdx]),t.column,a._selection.selected(this))}).each(function(t){var e=i.select(this);e.append("circle").attr("class","pointSelection").attr("r",a.pointSize()).call(a._selection.enter.bind(a._selection)),e.append(a.mapShape(a.pointShape())).attr("class","pointShape")}).merge(w).each(function(t){var e=i.select(this),n=0===t.value?0:t.value/x,o=u[t.rowIdx][0]*n,r=u[t.rowIdx][1]*n;e.select(".pointSelection").attr("cx",o).attr("cy",r);var s=e.select(".pointShape").style("stroke",a.strokeColor(t.row,t.column,t.value)).style("fill",a.fillColor(t.row,t.column,t.value));a.setPointAttributes(s,o,r)}),w.exit().remove()},n.prototype.polar2cartesian=function(t,e){return[t*Math.cos(e),t*Math.sin(e)]},n.prototype.cartesian2polar=function(t,e){return[Math.atan2(e,t),Math.sqrt(t*t+e*e)]},n.prototype.degrees2radians=function(t){return t/57.295779513},n.prototype.radians2degrees=function(t){return 57.295779513*t},n.prototype.point_in_polygon=function(t,e){for(var i=t[0],n=t[1],o=!1,a=0,r=e.length-1;a<e.length;r=a++){var s=e[a][0],l=e[a][1],h=e[r][0],c=e[r][1];l>n!=c>n&&i<(h-s)*(n-l)/(c-l)+s&&(o=!o)}return o},n}(i.SVGWidget);Fo.prototype._class+=" chart_Radar",Fo.prototype.implements(e.INDChart.prototype),Fo.prototype.implements(e.ITooltip.prototype),Fo.prototype.mixin(i.Utility.SimpleSelectionMixin),Fo.prototype.publish("paletteID","default","set","Color palette for this widget",Fo.prototype._palette.switch()),Fo.prototype.publish("pointShape","cross","set","pointShape",["circle","rectangle","cross"]),Fo.prototype.publish("pointSize",6,"number","Point Size",null,{range:{min:1,step:1,max:200}}),Fo.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"),Fo.prototype.publish("fillOpacity",.66,"number","Opacity of the data polygon(s)"),Fo.prototype.publish("fontFamily","","string","fontFamily"),Fo.prototype.publish("fontSize",16,"number","fontSize"),Fo.prototype.publish("labelPaddingRatio",.9,"number","labelPaddingRatio");Mt(".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 circle,.chart_RadialBar .axis line{stroke:#ccc;stroke-width:1px}.chart_RadialBar .axis circle{fill:none}.chart_RadialBar .r.axis text{text-anchor:end}");var Do=function(t){function n(){var n=t.call(this)||this;return n._domainScale=i.scaleBand(),n._valueScale=i.scaleLinear(),n._d3Arc=j().startAngle(0).endAngle(function(t){return n._valueScale(t[1])}),e.INDChart.call(n),e.ITooltip.call(n),i.Utility.SimpleSelectionMixin.call(n),n}return a(n,t),n.prototype.enter=function(e,i){var n=this;t.prototype.enter.call(this,e,i),this._selection.widgetElement(i),this.tooltipHTML(function(t){return n.tooltipFormat({label:t[0],value:t[1]})}),this._radialAxis=i.append("g").attr("class","r axis"),this._axialAxis=i.append("g").attr("class","a axis"),this._arcs=i.append("g").attr("class","data")},n.prototype.update=function(e,n){var o=this;t.prototype.update.call(this,e,n);var a=this,r=Math.max.apply(Math,c([this.valueDomainHigh_exists()?this.valueDomainHigh():0],h(this.data().map(function(t){return t[1]})),!1));this._valueScale.domain([0,r]).range([0,this.radians(this.valueMaxAngle())]);var s=this._valueScale.ticks(this.tickCount()),l=this.textSize(s.map(function(t){return""+t}),"Verdana",12).width,u=Math.min(this.width()-2*(10+l),this.height()-44)/2,p=this.data().map(function(t){return t[0]});this._domainScale.domain(p).range([0,u]).padding(this.domainPadding());var d=this._domainScale.step()*this._domainScale.padding(),f=this._radialAxis.selectAll("circle").data(p);f.enter().append("circle").attr("fill","transparent").merge(f).attr("r",function(t){return o._domainScale(t)+o._domainScale.step()-d/2}),f.exit().remove();var y=this._radialAxis.selectAll(".arc-text").data(p);y.enter().append("text").attr("class","arc-text").attr("x",-4).attr("alignment-baseline","middle").attr("text-anchor","end").merge(y).attr("y",function(t){return-o._domainScale(t)-o._domainScale.bandwidth()/2}).text(function(t){return t}),y.exit().remove();var _=this._axialAxis.selectAll("line").data(s);_.enter().append("line").merge(_).attr("x2",function(t){return u*Math.cos(o._valueScale(t)-o.radians(90))}).attr("y2",function(t){return u*Math.sin(o._valueScale(t)-o.radians(90))}),_.exit().remove();var x=this._axialAxis.selectAll("text").data(s);x.enter().append("text").style("dominant-baseline","central").merge(x).attr("x",function(t){return(u+10)*Math.cos(o._valueScale(t)-o.radians(90))}).attr("y",function(t){return(u+10)*Math.sin(o._valueScale(t)-o.radians(90))}).style("text-anchor",function(t){var e=o.degrees(o._valueScale(t));return e>=0&&e<=20||e>=160&&e<=200||e>=340&&e<=360?"middle":e>=180&&e<=360?"end":null}).text(function(t){return t}),x.exit().remove();var m=this.columns().length>1?this.columns()[1]:"";this._d3Arc.innerRadius(function(t){return o._domainScale(t[0])}).outerRadius(function(t){return o._domainScale(t[0])+o._domainScale.bandwidth()});var g=this._arcs.selectAll("path").data(this.data(),function(t){return t[0]});g.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){a.click(a.rowToObj(t),m,a._selection.selected(this))}).on("dblclick",function(t,e){a.dblclick(a.rowToObj(t),m,a._selection.selected(this))}).merge(g).style("fill",function(t,e){return o.fillColor(t,t[0],t[1])}).transition().delay(function(t,e){return e*o.transitionDelay()}).duration(this.transitionDuration()).attrTween("d",function(t,e){var n=i.interpolate(t._current||0,t[1]);return t._current=t[1],function(i){return o._d3Arc([t[0],n(i)],e)}}),g.exit().remove()},n.prototype.degrees=function(t){return 180*t/Math.PI},n.prototype.radians=function(t){return t*Math.PI/180},n.__inputs=[{id:"label",type:"any"},{id:"values",type:"number"}],n}(i.SVGWidget);Do.prototype._class+=" chart_RadialBar",Do.prototype.implements(e.INDChart.prototype),Do.prototype.implements(e.ITooltip.prototype),Do.prototype.mixin(i.Utility.SimpleSelectionMixin),Do.prototype.publish("paletteID","default","set","Color palette for this widget",Do.prototype._palette.switch()),Do.prototype.publish("tickCount",10,"number","Number of ticks to display"),Do.prototype.publish("domainPadding",.25,"number","Padding between chart edge and container edge (0..1)"),Do.prototype.publish("valueMaxAngle",270,"number","Maximum angular length of a bar (degrees)"),Do.prototype.publish("valueDomainHigh",null,"number","Value domain high",void 0,{optional:!0}),Do.prototype.publish("transitionDelay",100,"number","Delay between the start of each row animation (ms)"),Do.prototype.publish("transitionDuration",750,"number","Duration of a row's animation (ms)");var Oo=i.Palette.rainbow("Blues"),Ro=i.Palette.ordinal("Quartile",[Oo(100,0,100),Oo(50,0,100),Oo(50,0,100),Oo(75,0,100)]);Ro("Std. Dev."),Ro("MinMax"),Ro("25%"),Ro("50%");var jo=function(t){function e(){var e=t.call(this)||this;return e._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),e._candle=(new Io).columns(["Min","25%","50%","75%","Max"]).edgePadding(0).roundedCorners(1).lineWidth(1).upperTextRotation(-90).lowerTextRotation(-90).labelFontSize(0).valueFontSize(0).lineColor(Oo(90,0,100)).innerRectColor(Oo(10,0,100)),e.columns(["Min","25%","50%","75%","Max","Mean","Std. Dev."]),e}return a(e,t),e.prototype.stdDev=function(t){return this.mean()+t*this.standardDeviation()},e.prototype.formatStdDev=function(t){return this._tickFormatter(this.stdDev(t))},e.prototype.quartile=function(t){return this.quartiles()[t]},e.prototype.formatQ=function(t){return this._tickFormatter(this.quartile(t))},e.prototype.domain=function(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)]}},e.prototype.min=function(){return this.quartile(0)},e.prototype.max=function(){return this.quartile(4)},e.prototype.data=function(t){if(!arguments.length)return[c(c([],h(this.quartiles()),!1),[this.mean(),this.standardDeviation()],!1)];var 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},e.prototype.enter=function(e,i){var n=this;t.prototype.enter.call(this,e,i),this._bellCurve.target(i.append("div").node()),this._candle.target(i.append("div").node()),this._selectElement=i.append("div").style("position","absolute").style("top","0px").style("right","0px").append("select").on("change",function(){n.view(n._selectElement.node().value),n.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")},e.prototype.bellTicks=function(t){var 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)}]}var i=h(this.domain(this._selectElement.node().value),2),n=i[0],o=i[1];return e.filter(function(t){return t.value>=n&&t.value<=o}).map(function(t){return{label:t.label,value:t.value.toString()}})},e.prototype.updateScatter=function(){var t=this._selectElement.node().value,e=h(this.domain(t),2),i=e[0],n=e[1],o=(n-i)*(this.domainPadding()/100);this._bellCurve.xAxisDomainLow(i-o).xAxisDomainHigh(n+o).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()},e.prototype.updateCandle=function(){var 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()},e.prototype.update=function(e,n){var o,a;t.prototype.update.call(this,e,n),this._tickFormatter=(o=this.tickFormat(),a=i.format(o),function(t){var e=(Math.round(100*t)/100).toString();return e.length<=4?e:a(t)}),this._selectElement.node().value=this.view(),this.updateScatter(),this.updateCandle()},e}(i.HTMLWidget);jo.prototype._class+=" chart_Stat",jo.prototype.publish("view","min_max","set","View",["min_max","25_75","normal"]),jo.prototype.publish("tickFormat",".2e","string","X-Axis Tick Format"),jo.prototype.publish("candleHeight",20,"number","Height of candle widget (pixels)"),jo.prototype.publish("domainPadding",10,"number","Domain value padding"),jo.prototype.publish("mean",.5,"number","Mean"),jo.prototype.publish("standardDeviation",.125,"number","Standard Deviation (σ)"),jo.prototype.publish("quartiles",[0,.25,.5,.75,1],"object","Quartiles (Min, 25%, 50%, 75%, Max)");var Eo=function(t){function e(){var e=t.call(this)||this;return e.interpolate_default("step"),e}return a(e,t),e}(Ct);Eo.prototype._class+=" chart_Step";Mt(".chart_Summary{font-size:14px;height:150px;width:225px}.chart_Summary .content h2{font-size:3em;font-weight:700;margin-bottom:10px;margin-left:10px;margin-top:10px}.chart_Summary .bgIcon:before{font-family:FontAwesome;font-size:5.5em;opacity:.4;position:absolute;right:15px;top:.5em}.chart_Summary .bgIcon{position:relative}.chart_Summary .content{background-color:#efd752;float:left;height:100%;width:100%}.chart_Summary .content div{font-size:1.1em;margin-top:-1.1em;opacity:.8}.chart_Summary .content .text{padding-left:10px}.chart_Summary .content .more{bottom:0;height:3em;line-height:3em;position:absolute;width:100%}.chart_Summary .content .more i{padding-left:10px;padding-right:.5em}");var No="text",Lo="html",Bo=function(t){function e(){var e=t.call(this)||this;return e._playIntervalIdx=0,e._tag="div",e._drawStartPos="center",e.playInterval(e.playInterval()),e}return a(e,t),e.prototype.lookupFieldIdx=function(t,e){var i=e;if(!(this[t+"_exists"]()&&(i=this.columns().indexOf(this[t]()))<0))return i},e.prototype.lookupFieldText=function(t,e){return this[t+"_exists"]()?this[t]():void 0!==e&&this.columns()[e]||""},e.prototype.currentRow=function(){return this.data()[this._playIntervalIdx]},e.prototype.summaryData=function(){var t;this.hideLabel()||(t=this.lookupFieldIdx("labelColumn",0));var e,i,n=this.lookupFieldIdx("iconColumn"),o=this.lookupFieldIdx("valueColumn",1);this.hideMore()||(e=this.lookupFieldIdx("moreIconColumn"),i=this.lookupFieldIdx("moreTextColumn"));var a=this.lookupFieldIdx("colorFillColumn"),r=this.lookupFieldIdx("colorStrokeColumn");return this.formattedData().map(function(s){return{icon:void 0===n?this.icon():s[n],label:void 0===t?"":s[t],value:s[o],moreIcon:void 0===e?this.hideMore()?"":this.moreIcon():s[e],moreText:void 0===i?this.hideMore()?"":this.moreText():s[i],fill:void 0===a?this.colorFill():s[a],stroke:void 0===r?this.colorStroke():s[r]}},this)},e.prototype.enter=function(e,i){t.prototype.enter.call(this,e,i),this._mainDiv=i.append("div");var n=this;this._headerDiv=this._mainDiv.append("h2").on("click",function(){n.click(n.rowToObj(n.currentRow()),n.lookupFieldText("valueColumn",1),!0)}).on("dblclick",function(){n.dblclick(n.rowToObj(n.currentRow()),n.lookupFieldText("valueColumn",1),!0)}),this._textDiv=this._mainDiv.append("div").attr("class","text").on("click",function(){n.click(n.rowToObj(n.currentRow()),n.lookupFieldText("labelColumn",0),!0)}).on("dblclick",function(){n.dblclick(n.rowToObj(n.currentRow()),n.lookupFieldText("labelColumn",0),!0)})},e.prototype.update=function(e,n){t.prototype.update.call(this,e,n),this.data().length;var o=this.summaryData();this._playIntervalIdx>=o.length&&(this._playIntervalIdx=0);var a=this._playIntervalIdx<o.length?o[this._playIntervalIdx]:["",""];n.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 "+a.icon).transition().style("background-color",a.fill).style("color",a.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",a.stroke).style("font-size",this.headerFontSize()+"px")[this.valueHTML()?Lo:No](a.value),this._textDiv.style("font-size",this.textFontSize()+"px")[this.labelHTML()?Lo:No](a.label);var r=this,s=this._mainDiv.selectAll(".more").data([a]),l=s.enter().append("div").attr("class","more").on("click",function(t){r.click(r.rowToObj(r.currentRow()),r.lookupFieldText("moreTextColumn")||"more",!0)}).each(function(){var t=i.select(this);t.append("i"),t.append("span")}).merge(s).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(a.fill).darker(.75).toString());l.select("i").attr("class",function(t){return"fa "+t.moreIcon}),this.moreTextHTML()?l.select("span").each(function(t){this.innerHTML=t.moreText}):l.select("span").text(function(t){return t.moreText}),s.exit().remove()},e.prototype.exit=function(e,i){t.prototype.exit.call(this,e,i)},e}(i.HTMLWidget);Bo.prototype._class+=" chart_Summary",Bo.prototype.implements(e.I2DChart.prototype),Bo.prototype.publish("iconColumn",null,"set","Select Icon Column",function(){return this.columns()},{optional:!0}),Bo.prototype.publish("icon","fa-briefcase","string","FA Char icon class",null,{disable:function(t){return t.iconColumn()}}),Bo.prototype.publish("headerFontSize",null,"number","headerFontSize"),Bo.prototype.publish("textFontSize",null,"number","textFontSize"),Bo.prototype.publish("moreFontSize",null,"number","moreFontSize"),Bo.prototype.publish("iconFontSize",null,"number","iconFontSize"),Bo.prototype.publish("hideLabel",!1,"boolean","Hide label column"),Bo.prototype.publish("labelColumn",null,"set","Select display value",function(){return this.columns()},{optional:!0,disable:function(t){return t.hideLabel()}}),Bo.prototype.publish("labelHTML",!1,"boolean","Allow HTML",null,{disable:function(t){return t.hideLabel()}}),Bo.prototype.publish("valueColumn",null,"set","Select display value",function(){return this.columns()},{optional:!0}),Bo.prototype.publish("valueHTML",!1,"boolean","Allow HTML"),Bo.prototype.publish("hideMore",!1,"boolean","Hide More Information"),Bo.prototype.publish("hideMoreWrapper",!1,"boolean","Hide More Information Wrapper"),Bo.prototype.publish("moreWrapperHeight",null,"number","Height of the 'more' text wrapper (pixels)"),Bo.prototype.publish("moreIconColumn",null,"set","Select More Icon Column",function(){return this.columns()},{optional:!0,disable:function(t){return t.hideMore()}}),Bo.prototype.publish("moreIcon","fa-info-circle","string","FA Char icon class",null,{disable:function(t){return t.hideMore()||t.moreIconColumn()}}),Bo.prototype.publish("moreTextColumn",null,"set","Select display value",function(){return this.columns()},{optional:!0,disable:function(t){return t.hideMore()}}),Bo.prototype.publish("moreText","More Info","string","More text",null,{disable:function(t){return t.hideMore()||t.moreTextColumn()}}),Bo.prototype.publish("moreTextHTML",!1,"boolean","Allow HTML",null,{disable:function(t){return t.hideMore()}}),Bo.prototype.publish("colorFillColumn",null,"set","Column for color",function(){return this.columns()},{optional:!0}),Bo.prototype.publish("colorFill","#3498db","html-color","Fill Color",null,{disable:function(t){return t.colorFillColumn()}}),Bo.prototype.publish("colorStrokeColumn",null,"set","Column for color",function(){return this.columns()},{optional:!0}),Bo.prototype.publish("colorStroke","#ffffff","html-color","Fill Color",null,{disable:function(t){return t.colorStrokeColumn()}}),Bo.prototype.publish("fixedSize",!0,"boolean","Fix Size to Min Width/Height"),Bo.prototype.publish("minWidth",225,"number","Minimum Width"),Bo.prototype.publish("minHeight",150,"number","Minimum Height"),Bo.prototype.publish("playInterval",null,"number","Play Interval",null,{optional:!0});var Ho=Bo.prototype.playInterval;Bo.prototype.playInterval=function(t){var e=Ho.apply(this,arguments);if(arguments.length){this._playIntervalHandle&&clearInterval(this._playIntervalHandle);var i=this;t&&(this._playIntervalHandle=setInterval(function(){i._playIntervalIdx++,i._renderCount&&i.data().length&&i.render()},t))}return e};var Vo=function(t){function n(){var i=t.call(this)||this;return i._playIntervalIdx=0,e.I2DChart.call(i),i.playInterval(i.playInterval()),i}return a(n,t),n.prototype.currentRow=function(){return this.data()[this._playIntervalIdx]},n.prototype.enter=function(e,i){t.prototype.enter.apply(this,arguments);var n=this.size(),o=n.width,a=n.height;e.height=a,e.width=o},n.prototype.update=function(e,n){t.prototype.update.apply(this,arguments);var o=this;this._playIntervalIdx>=this.data().length&&(this._playIntervalIdx=0);var a=this.size(),r=Math.min(a.width,a.height),s=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(),m=a.height*(s-this.paddingSizeRatio()),g=a.height*(1-s-this.paddingSizeRatio()),v=a.height*(this.iconSizeRatio()-this.paddingSizeRatio()),b=r*this.paddingSizeRatio(),w=e.getContext("2d");w.clearRect(0,0,a.width,a.height);var S=o.fontFamily();function k(t,e,i,n){w.textBaseline="top",w.font="".concat(i,"px ").concat(S),w.fillStyle=x;var o=w.measureText(t);o.width>a.width-2*b&&(i*=(a.width-2*b)/o.width,w.font="".concat(i,"px ").concat(S),o=w.measureText(t));var r=A(o.width,n);return w.fillText(t,r,e),i}function A(t,e){switch(e){case"start":return b;case"middle":return a.width/2-t/2;case"end":return a.width-t-b}}w.fillStyle=_,w.fillRect(0,0,a.width,a.height),w.globalAlpha=this.iconOpacity(),function(t,e,i){if(void 0===t)return;w.textBaseline=o.iconBaseline(),w.font="".concat(e,"px FontAwesome"),w.fillStyle=x;var n=w.measureText(t);if(n.width>a.width-2*b){var r=(a.width-2*b)/n.width;w.font="".concat(e*r,"px FontAwesome"),n=w.measureText(t)}var s=A(n.width,i),l=function(t){switch(t){case"top":return b;case"middle":return a.height/2;case"bottom":return a.height-b}}(o.iconBaseline());w.fillText(t,s,l)}(i.Utility.faChar(d),v,o.iconAnchor()),w.globalAlpha=this.valueOpacity(),m=k(y,b,m,o.valueAnchor()),w.globalAlpha=this.labelOpacity(),k(f,m+b,g,o.labelAnchor())},n}(i.CanvasWidget);Vo.prototype._class+=" chart_SummaryC",Vo.prototype.implements(e.I2DChart.prototype),Vo.prototype.publish("iconBaseline","bottom","string","Text baseline for the icon",["top","middle","bottom"]),Vo.prototype.publish("iconAnchor","end","set","Anchors the icon either at the start, middle, or end of the summary",["start","middle","end"]),Vo.prototype.publish("valueAnchor","start","set","Anchors the value either at the start, middle, or end of the summary",["start","middle","end"]),Vo.prototype.publish("labelAnchor","start","set","Anchors the label either at the start, middle, or end of the summary",["start","middle","end"]),Vo.prototype.publish("iconColumn",null,"set","Select Icon Column",function(){return this.columns()},{optional:!0}),Vo.prototype.publish("icon","fa-briefcase","string","FA Char icon class",null,{disable:function(t){return t.iconColumn()}}),Vo.prototype.publish("fontFamily","Arial","string","Font Family"),Vo.prototype.publish("labelColumn",null,"set","Select display value",function(){return this.columns()},{optional:!0}),Vo.prototype.publish("valueColumn",null,"set","Select display value",function(){return this.columns()},{optional:!0}),Vo.prototype.publish("colorFillColumn",null,"set","Column for background color",function(){return this.columns()},{optional:!0}),Vo.prototype.publish("colorFill","#0097e6","html-color","Background Color",null,{disable:function(t){return t.colorFillColumn()}}),Vo.prototype.publish("colorStrokeColumn",null,"set","Column for font color",function(){return this.columns()},{optional:!0}),Vo.prototype.publish("colorStroke","#2f3640","html-color","Font Color",null,{disable:function(t){return t.colorStrokeColumn()}}),Vo.prototype.publish("fixedSize",!0,"boolean","Fix Size to Min Width/Height"),Vo.prototype.publish("minWidth",225,"number","Minimum Width"),Vo.prototype.publish("minHeight",150,"number","Minimum Height"),Vo.prototype.publish("playInterval",null,"number","Play Interval",null,{optional:!0}),Vo.prototype.publish("fontSizeRatio",.618,"number","Ratio between widget height and value font size"),Vo.prototype.publish("valueOpacity",1,"number","Opacity of value text (0..1)"),Vo.prototype.publish("labelOpacity",.9,"number","Opacity of label text (0..1)"),Vo.prototype.publish("iconOpacity",.3,"number","Opacity of icon text (0..1)"),Vo.prototype.publish("paddingSizeRatio",.1,"number","Ratio of the smallest dimension for edge padding (0..1)"),Vo.prototype.publish("iconSizeRatio",.9,"number","Ratio of the height for icon size (0..1)");var qo=Vo.prototype.playInterval;Vo.prototype.playInterval=function(t){var e=qo.apply(this,arguments);if(arguments.length){this._playIntervalHandle&&clearInterval(this._playIntervalHandle);var i=this;t&&(this._playIntervalHandle=setInterval(function(){i._playIntervalIdx++,i._renderCount&&i.data().length&&i.render()},t))}return e};var Wo=Math.PI/180,Go=2048;function Yo(){var t=i.dispatch("word","end"),e={},n=[256,256],o=Xo,a=Uo,r=Zo,s=Qo,l=Qo,h=Jo,c=Ko,u=[],p=na,d=1/0,f=null,y=Math.random,_=oa;function x(t,e,i){for(var o,a,r,s=e.x,l=e.y,h=Math.sqrt(n[0]*n[0]+n[1]*n[1]),c=p(n),u=y()<.5?1:-1,d=-u;(o=c(d+=u))&&(a=~~o[0],r=~~o[1],!(Math.min(Math.abs(a),Math.abs(r))>=h));)if(e.x=s+a,e.y=l+r,!(e.x+e.x0<0||e.y+e.y0<0||e.x+e.x1>n[0]||e.y+e.y1>n[1])&&(!i||!ta(e,t,n[0]))&&(!i||ia(e,i))){for(var f=e.sprite,_=e.width>>5,x=n[0]>>5,m=e.x-(_<<4),g=127&m,v=32-g,b=e.y1-e.y0,w=(e.y+e.y0)*x+(m>>5),S=void 0,k=0;k<b;k++){S=0;for(var A=0;A<=_;A++)t[w+A]|=S<<v|(A<_?(S=f[k*_+A])>>>g:0);w+=x}return delete e.sprite,!0}return!1}return e.canvas=function(t){return arguments.length?(_=aa(t),e):_},e.start=function(){var i=function(t){t.width=t.height=1;var e=Math.sqrt(t.getContext("2d").getImageData(0,0,1,1).data.length>>2);t.width=2048/e,t.height=Go/e;var i=t.getContext("2d");return i.fillStyle=i.strokeStyle="red",i.textAlign="center",{context:i,ratio:e}}(_()),p=function(t){var e=[],i=-1;for(;++i<t;)e[i]=0;return e}((n[0]>>5)*n[1]),m=null,g=u.length,v=-1,b=[],w=u.map(function(t,e){return t.text=o.call(this,t,e),t.font=a.call(this,t,e),t.style=s.call(this,t,e),t.weight=l.call(this,t,e),t.rotate=h.call(this,t,e),t.size=~~r.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(){for(var o=Date.now();Date.now()-o<d&&++v<g&&f;){var a=w[v];a.x=n[0]*(y()+.5)>>1,a.y=n[1]*(y()+.5)>>1,$o(i,a,w,v),a.hasText&&x(p,a,m)&&(b.push(a),t.call("word",e,a),m?ea(m,a):m=[{x:a.x+a.x0,y:a.y+a.y0},{x:a.x+a.x1,y:a.y+a.y1}],a.x-=n[0]>>1,a.y-=n[1]>>1)}v>=g&&(e.stop(),t.call("end",e,b,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?(a=aa(t),e):a},e.fontStyle=function(t){return arguments.length?(s=aa(t),e):s},e.fontWeight=function(t){return arguments.length?(l=aa(t),e):l},e.rotate=function(t){return arguments.length?(h=aa(t),e):h},e.text=function(t){return arguments.length?(o=aa(t),e):o},e.spiral=function(t){return arguments.length?(p=ra[t]||t,e):p},e.fontSize=function(t){return arguments.length?(r=aa(t),e):r},e.padding=function(t){return arguments.length?(c=aa(t),e):c},e.random=function(t){return arguments.length?(y=t,e):y},e.on=function(){var i=t.on.apply(t,arguments);return i===t?e:i},e}function Xo(t){return t.text}function Uo(){return"serif"}function Qo(){return"normal"}function Zo(t){return Math.sqrt(t.value)}function Jo(){return 30*(~~(6*Math.random())-3)}function Ko(){return 1}function $o(t,e,i,n){if(!e.sprite){var o=t.context,a=t.ratio;o.clearRect(0,0,2048/a,Go/a);var r=0,s=0,l=0,h=i.length;for(--n;++n<h;){e=i[n],o.save(),o.font=e.style+" "+e.weight+" "+~~((e.size+1)/a)+"px "+e.font;var c=o.measureText(e.text+"m").width*a,u=e.size<<1;if(e.rotate){var p=Math.sin(e.rotate*Wo),d=Math.cos(e.rotate*Wo),f=c*d,y=c*p,_=u*d,x=u*p;c=Math.max(Math.abs(f+x),Math.abs(f-x))+31>>5<<5,u=~~Math.max(Math.abs(y+_),Math.abs(y-_))}else c=c+31>>5<<5;if(u>l&&(l=u),r+c>=2048&&(r=0,s+=l,l=0),s+u>=Go)break;o.translate((r+(c>>1))/a,(s+(u>>1))/a),e.rotate&&o.rotate(e.rotate*Wo),o.fillText(e.text,0,0),e.padding&&(o.lineWidth=2*e.padding,o.strokeText(e.text,0,0)),o.restore(),e.width=c,e.height=u,e.xoff=r,e.yoff=s,e.x1=c>>1,e.y1=u>>1,e.x0=-e.x1,e.y0=-e.y1,e.hasText=!0,r+=c}for(var m=o.getImageData(0,0,2048/a,Go/a).data,g=[];--n>=0;)if((e=i[n]).hasText){for(var v=(c=e.width)>>5,b=(u=e.y1-e.y0,0);b<u*v;b++)g[b]=0;if(null==(r=e.xoff))return;s=e.yoff;for(var w=0,S=-1,k=0;k<u;k++){for(b=0;b<c;b++){var A=v*k+(b>>5),M=m[2048*(s+k)+(r+b)<<2]?1<<31-b%32:0;g[A]|=M,w|=M}w?S=k:(e.y0++,u--,k--,s++)}e.y1=e.y0+S,e.sprite=g.slice(0,(e.y1-e.y0)*v)}}}function ta(t,e,i){i>>=5;for(var n,o=t.sprite,a=t.width>>5,r=t.x-(a<<4),s=127&r,l=32-s,h=t.y1-t.y0,c=(t.y+t.y0)*i+(r>>5),u=0;u<h;u++){n=0;for(var p=0;p<=a;p++)if((n<<l|(p<a?(n=o[u*a+p])>>>s:0))&e[c+p])return!0;c+=i}return!1}function ea(t,e){var 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 ia(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 na(t){var e=t[0]/t[1];return function(t){return[e*(t*=.1)*Math.cos(t),t*Math.sin(t)]}}function oa(){return document.createElement("canvas")}function aa(t){return"function"==typeof t?t:function(){return t}}var ra={archimedean:na,rectangular:function(t){var e=4*t[0]/t[1],i=0,n=0;return function(t){var 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]}}};Mt(".other_Wordcloud text{cursor:pointer}");var sa=function(t){function n(){var n=t.call(this)||this;return e.I2DChart.call(n),e.ITooltip.call(n),i.Utility.SimpleSelectionMixin.call(n),n._prevOffsetX=n.offsetX(),n._prevOffsetY=n.offsetY(),n._prevZoom=n.zoom(),n}return a(n,t),n.prototype.calcData=function(){return this.data().map(function(t){return{__viz_label:t[0],__viz_weight:t[1],__viz_row:t}})},n.prototype.enter=function(e,n){t.prototype.enter.call(this,e,n),this._selection.widgetElement(n),this._root=n.append("g"),this._canvas=document.createElement("canvas");var o=this;this._d3Zoom=i.zoom().scaleExtent([.1,10]),this._d3Zoom.on("zoom",function(t){var e=i.d3Event();e&&e.transform&&o.zoomed(o._d3Zoom,[e.transform.x,e.transform.y],e.transform.k)}),n.call(this._d3Zoom),this.tooltipHTML(function(t){var e=o.columns(),i=e&&e.length?e[0]:"Word";return o.tooltipFormat({label:t.__viz_label,series:i,value:t.__viz_weight})})},n.prototype.update=function(e,n){var o=this;t.prototype.update.call(this,e,n),this._palette=this._palette.switch(this.paletteID()),this.useClonedPalette()&&(this._palette=this._palette.cloneNotExists(this.paletteID()+"_"+this.id())),this._d3Cloud=Yo().canvas(function(){return o._canvas}),this.zoomed(this,[this.offsetX(),this.offsetY()],this.zoom());var a,r=this.calcData(),s=this,l=i.extent(r,function(t){return t.__viz_weight});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}var h=a().domain(l).range([this.fontSizeFrom(),this.fontSizeTo()]),c=i.scaleLinear().domain([0,s.angleCount()-1]).range([s.angleFrom(),s.angleTo()]);this._d3Cloud.stop().size([this.width(),this.height()]).words(r).font(this.fontFamily()).padding(this.padding()).spiral(this.spiral()).text(function(t){return t.__viz_label.trim()}).fontSize(function(t){return h(t.__viz_weight)}).rotate(function(t,e){return c(e%s.angleCount())}).on("word",function(t){}).on("end",function(t,e){var i=s._root.selectAll("text").data(t,function(t){return t.__viz_label?t.__viz_label.toLowerCase():""});i.enter().append("text").attr("text-anchor","middle").call(s._selection.enter.bind(s._selection)).text(function(t){return t.__viz_label}).on("click",function(t){s.click(s.rowToObj(t.__viz_row),s.columns()[1],s._selection.selected(this))}).on("dblclick",function(t){s.dblclick(s.rowToObj(t.__viz_row),s.columns()[1],s._selection.selected(this))}).on("mouseout.tooltip",s.tooltip.hide).on("mousemove.tooltip",s.tooltip.show).style("opacity",1e-6).merge(i).style("font-size",function(t){return h(t.__viz_weight)+"px"}).style("font-family",s.fontFamily()).transition().duration(1e3).attr("transform",function(t){return"translate("+[t.x,t.y]+")rotate("+t.rotate+")"}).style("fill",function(t){return s._palette(t.__viz_label?t.__viz_label.toLowerCase():"")}).style("opacity",1),i.exit().transition().duration(1e3).style("opacity",1e-4).remove()}).start()},n.prototype.zoomed=function(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}},n.__inputs=[{id:"label",type:"string"},{id:"value",type:"number"}],n}(i.SVGWidget);sa.prototype._class+=" chart_WordCloud",sa.prototype.implements(e.I2DChart.prototype),sa.prototype.implements(e.ITooltip.prototype),sa.prototype.mixin(i.Utility.SimpleSelectionMixin),sa.prototype.publish("paletteID","default","set","Color palette for this widget",sa.prototype._palette.switch(),{tags:["Basic","Shared"]}),sa.prototype.publish("useClonedPalette",!1,"boolean","Enable or disable using a cloned palette",null,{tags:["Intermediate","Shared"]}),sa.prototype.publish("fontFamily","Impact","string","Font Name",null,{tags:["Basic"]}),sa.prototype.publish("fontSizeFrom",6,"number","Minimum font size (pixels)",null,{tags:["Basic"]}),sa.prototype.publish("fontSizeTo",48,"number","Maximum font size (pixels)",null,{tags:["Basic"]}),sa.prototype.publish("angleFrom",-60,"number","Minimum angle (degrees)",null,{tags:["Basic"]}),sa.prototype.publish("angleTo",60,"number","Maximum angle (degrees)",null,{tags:["Basic"]}),sa.prototype.publish("angleCount",5,"number","Number of different angles",null,{tags:["Basic"]}),sa.prototype.publish("padding",0,"number","Padding between words (pixels)",null,{tags:["Intermediate"]}),sa.prototype.publish("scaleMode","linear","set","Text scaling mode",["linear","log","sqrt","pow"],{tags:["Intermediate"]}),sa.prototype.publish("spiral","archimedean","set","Text scaling mode",["archimedean","rectangular"],{tags:["Intermediate"]}),sa.prototype.publish("offsetX",0,"number","X offset",null,{tags:["Advanced"]}),sa.prototype.publish("offsetY",0,"number","Y offset",null,{tags:["Advanced"]}),sa.prototype.publish("zoom",1,"number","Zoom",null,{tags:["Advanced"]}),t.Area=zt,t.Axis=Tt,t.BUILD_VERSION="2.108.10",t.Bar=Ft,t.Bubble=oe,t.BubbleXY=ae,t.Bullet=Te,t.Column=It,t.Contour=tn,t.Gantt=en,t.Gauge=xo,t.HalfPie=bo,t.Heat=wo,t.HexBin=Po,t.Line=Co,t.PKG_NAME="@hpcc-js/chart",t.PKG_VERSION="2.86.5",t.Pie=vo,t.QuarterPie=zo,t.QuartileCandlestick=Io,t.Radar=Fo,t.RadialBar=Do,t.Scatter=Ct,t.StatChart=jo,t.Step=Eo,t.Summary=Bo,t.SummaryC=Vo,t.WordCloud=sa,t.XYAxis=Pt});
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=function(t,e){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},o(t,e)};function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function i(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}function r(t,e,i,n){var o,a=arguments.length,r=a<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(r=(a<3?o(r):a>3?o(e,i,r):o(e,i))||r);return a>3&&r&&Object.defineProperty(e,i,r),r}function s(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}function l(t){var e="function"==typeof Symbol&&Symbol.iterator,i=e&&t[e],n=0;if(i)return i.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function h(t,e){var i="function"==typeof Symbol&&t[Symbol.iterator];if(!i)return t;var n,o,a=i.call(t),r=[];try{for(;(void 0===e||e-- >0)&&!(n=a.next()).done;)r.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(i=a.return)&&i.call(a)}finally{if(o)throw o.error}}return r}function c(t,e,i){if(i||2===arguments.length)for(var n,o=0,a=e.length;o<a;o++)!n&&o in e||(n||(n=Array.prototype.slice.call(e,0,o)),n[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))}"function"==typeof SuppressedError&&SuppressedError;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}function x(t){return function(){return t}}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,a){this._+="C"+ +t+","+ +e+","+ +i+","+ +n+","+(this._x1=+o)+","+(this._y1=+a)},arcTo:function(t,e,i,n,o){t=+t,e=+e,i=+i,n=+n,o=+o;var a=this._x1,r=this._y1,s=i-t,l=n-e,h=a-t,c=r-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*s-l*h)>d&&o){var f=i-a,y=n-r,_=s*s+l*l,x=f*f+y*y,m=Math.sqrt(_),g=Math.sqrt(p),v=o*Math.tan((u-Math.acos((_+p-x)/(2*m*g)))/2),b=v/g,w=v/m;Math.abs(b-1)>d&&(this._+="L"+(t+b*h)+","+(e+b*c)),this._+="A"+o+","+o+",0,0,"+ +(c*f>h*y)+","+(this._x1=t+w*s)+","+(this._y1=e+w*l)}else this._+="L"+(this._x1=t)+","+(this._y1=e);else;},arc:function(t,e,i,n,o,a){t=+t,e=+e,a=!!a;var r=(i=+i)*Math.cos(n),s=i*Math.sin(n),l=t+r,h=e+s,c=1^a,y=a?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-r)+","+(e-s)+"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 m=Math.abs,g=Math.atan2,v=Math.cos,b=Math.max,w=Math.min,S=Math.sin,k=Math.sqrt,A=1e-12,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 F(t){return t.startAngle}function D(t){return t.endAngle}function O(t){return t&&t.padAngle}function R(t,e,i,n,o,a,r){var s=t-i,l=e-n,h=(r?a:-a)/k(s*s+l*l),c=h*l,u=-h*s,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,v=m*m+g*g,w=o-a,S=p*y-f*d,A=(g<0?-1:1)*k(b(0,w*w*v-S*S)),M=(S*g-m*A)/v,T=(-S*m-g*A)/v,P=(S*g+m*A)/v,C=(-S*m+g*A)/v,z=M-_,I=T-x,F=P-_,D=C-x;return z*z+I*I>F*F+D*D&&(M=P,T=C),{cx:M,cy:T,x01:-c,y01:-u,x11:M*(o/w-1),y11:T*(o/w-1)}}function j(){var t=z,e=I,i=x(0),n=null,o=F,a=D,r=O,s=null;function l(){var l,h,c=+t.apply(this,arguments),u=+e.apply(this,arguments),p=o.apply(this,arguments)-T,d=a.apply(this,arguments)-T,f=m(d-p),y=d>p;if(s||(s=l=_()),u<c&&(h=u,u=c,c=h),u>A)if(f>P-A)s.moveTo(u*v(p),u*S(p)),s.arc(0,0,u,p,d,!y),c>A&&(s.moveTo(c*v(d),c*S(d)),s.arc(0,0,c,d,p,y));else{var x,b,z=p,I=d,F=p,D=d,O=f,j=f,E=r.apply(this,arguments)/2,N=E>A&&(n?+n.apply(this,arguments):k(c*c+u*u)),L=w(m(u-c)/2,+i.apply(this,arguments)),B=L,H=L;if(N>A){var V=C(N/c*S(E)),q=C(N/u*S(E));(O-=2*V)>A?(F+=V*=y?1:-1,D-=V):(O=0,F=D=(p+d)/2),(j-=2*q)>A?(z+=q*=y?1:-1,I-=q):(j=0,z=I=(p+d)/2)}var W=u*v(z),G=u*S(z),Y=c*v(D),X=c*S(D);if(L>A){var U,Q=u*v(I),Z=u*S(I),J=c*v(F),K=c*S(F);if(f<M&&(U=function(t,e,i,n,o,a,r,s){var l=i-t,h=n-e,c=r-o,u=s-a,p=u*l-c*h;if(!(p*p<A))return[t+(p=(c*(e-a)-u*(t-o))/p)*l,e+p*h]}(W,G,J,K,Q,Z,Y,X))){var $=W-U[0],tt=G-U[1],et=Q-U[0],it=Z-U[1],nt=1/S(function(t){return t>1?0:t<-1?M:Math.acos(t)}(($*et+tt*it)/(k($*$+tt*tt)*k(et*et+it*it)))/2),ot=k(U[0]*U[0]+U[1]*U[1]);B=w(L,(c-ot)/(nt-1)),H=w(L,(u-ot)/(nt+1))}}j>A?H>A?(x=R(J,K,W,G,u,H,y),b=R(Q,Z,Y,X,u,H,y),s.moveTo(x.cx+x.x01,x.cy+x.y01),H<L?s.arc(x.cx,x.cy,H,g(x.y01,x.x01),g(b.y01,b.x01),!y):(s.arc(x.cx,x.cy,H,g(x.y01,x.x01),g(x.y11,x.x11),!y),s.arc(0,0,u,g(x.cy+x.y11,x.cx+x.x11),g(b.cy+b.y11,b.cx+b.x11),!y),s.arc(b.cx,b.cy,H,g(b.y11,b.x11),g(b.y01,b.x01),!y))):(s.moveTo(W,G),s.arc(0,0,u,z,I,!y)):s.moveTo(W,G),c>A&&O>A?B>A?(x=R(Y,X,Q,Z,c,-B,y),b=R(W,G,J,K,c,-B,y),s.lineTo(x.cx+x.x01,x.cy+x.y01),B<L?s.arc(x.cx,x.cy,B,g(x.y01,x.x01),g(b.y01,b.x01),!y):(s.arc(x.cx,x.cy,B,g(x.y01,x.x01),g(x.y11,x.x11),!y),s.arc(0,0,c,g(x.cy+x.y11,x.cx+x.x11),g(b.cy+b.y11,b.cx+b.x11),y),s.arc(b.cx,b.cy,B,g(b.y11,b.x11),g(b.y01,b.x01),!y))):s.arc(0,0,c,D,F,y):s.lineTo(Y,X)}else s.moveTo(0,0);if(s.closePath(),l)return s=null,l+""||null}return l.centroid=function(){var i=(+t.apply(this,arguments)+ +e.apply(this,arguments))/2,n=(+o.apply(this,arguments)+ +a.apply(this,arguments))/2-M/2;return[v(n)*i,S(n)*i]},l.innerRadius=function(e){return arguments.length?(t="function"==typeof e?e:x(+e),l):t},l.outerRadius=function(t){return arguments.length?(e="function"==typeof t?t:x(+t),l):e},l.cornerRadius=function(t){return arguments.length?(i="function"==typeof t?t:x(+t),l):i},l.padRadius=function(t){return arguments.length?(n=null==t?null:"function"==typeof t?t:x(+t),l):n},l.startAngle=function(t){return arguments.length?(o="function"==typeof t?t:x(+t),l):o},l.endAngle=function(t){return arguments.length?(a="function"==typeof t?t:x(+t),l):a},l.padAngle=function(t){return arguments.length?(r="function"==typeof t?t:x(+t),l):r},l.context=function(t){return arguments.length?(s=null==t?null:t,l):s},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=x(!0),n=null,o=N,a=null;function r(r){var s,l,h,c=r.length,u=!1;for(null==n&&(a=o(h=_())),s=0;s<=c;++s)!(s<c&&i(l=r[s],s,r))===u&&((u=!u)?a.lineStart():a.lineEnd()),u&&a.point(+t(l,s,r),+e(l,s,r));if(h)return a=null,h+""||null}return r.x=function(e){return arguments.length?(t="function"==typeof e?e:x(+e),r):t},r.y=function(t){return arguments.length?(e="function"==typeof t?t:x(+t),r):e},r.defined=function(t){return arguments.length?(i="function"==typeof t?t:x(!!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 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 Y(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],a=e[0],r=t[i]-o,s=e[i]-a,l=-1;++l<=i;)n=l/i,this._basis.point(this._beta*t[l]+(1-this._beta)*(o+n*r),this._beta*e[l]+(1-this._beta)*(a+n*s));this._x=this._y=null,this._basis.lineEnd()},point:function(t,e){this._x.push(+t),this._y.push(+e)}};var U=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 Q(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 Z(t,e){this._context=t,this._k=(1-e)/6}Z.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:Q(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:Q(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 J=function t(e){function i(t){return new Z(t,e)}return i.tension=function(e){return t(+e)},i}(0);function K(t,e){this._context=t,this._alpha=e}K.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,a=t._x2,r=t._y2;if(t._l01_a>A){var s=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*s-t._x0*t._l12_2a+t._x2*t._l01_2a)/l,o=(o*s-t._y0*t._l12_2a+t._y2*t._l01_2a)/l}if(t._l23_a>A){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);a=(a*h+t._x1*t._l23_2a-e*t._l12_2a)/c,r=(r*h+t._y1*t._l23_2a-i*t._l12_2a)/c}t._context.bezierCurveTo(n,o,a,r,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 $=function t(e){function i(t){return e?new K(t,e):new Z(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,a=(t._y1-t._y0)/(n||o<0&&-0),r=(i-t._y1)/(o||n<0&&-0),s=(a*o+r*n)/(n+o);return(tt(a)+tt(r))*Math.min(Math.abs(a),Math.abs(r),.5*Math.abs(s))||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,a=t._x1,r=t._y1,s=(a-n)/3;t._context.bezierCurveTo(n+s,o+s*e,a-s,r-s*i,a,r)}function ot(t){this._context=t}function at(t){return new ot(t)}function rt(t){this._context=t}function st(t){var e,i,n=t.length-1,o=new Array(n),a=new Array(n),r=new Array(n);for(o[0]=0,a[0]=2,r[0]=t[0]+2*t[1],e=1;e<n-1;++e)o[e]=1,a[e]=4,r[e]=4*t[e]+2*t[e+1];for(o[n-1]=2,a[n-1]=7,r[n-1]=8*t[n-1]+t[n],e=1;e<n;++e)i=o[e]/a[e-1],a[e]-=i,r[e]-=i*r[e-1];for(o[n-1]=r[n-1]/a[n-1],e=n-2;e>=0;--e)o[e]=(r[e]-o[e+1])/a[e];for(a[n-1]=(t[n]+o[n-1])/2,e=0;e<n-1;++e)a[e]=2*t[e+1]-o[e+1];return[o,a]}function lt(t){return new rt(t)}function ht(t,e){this._context=t,this._t=e}function ct(t){return new ht(t,.5)}function ut(t){return new ht(t,0)}function pt(t){return new ht(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}}},Object.create(ot.prototype).point=function(t,e){ot.prototype.point.call(this,e,t)},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=st(t),o=st(e),a=0,r=1;r<i;++a,++r)this._context.bezierCurveTo(n[0][a],o[0][a],n[1][a],o[1][a],t[r],e[r]);(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)}},ht.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 dt=Array.prototype.slice;function ft(t){return t}var yt=1e-6;function _t(t){return"translate("+(t+.5)+",0)"}function xt(t){return"translate(0,"+(t+.5)+")"}function mt(t){return function(e){return+t(e)}}function gt(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 bt(t,e){var i=[],n=null,o=null,a=6,r=6,s=3,l=1===t||4===t?-1:1,h=4===t||2===t?"x":"y",c=1===t||3===t?_t:xt;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):ft:o,f=Math.max(a,0)+s,y=e.range(),_=+y[0]+.5,x=+y[y.length-1]+.5,m=(e.bandwidth?gt:mt)(e.copy()),g=u.selection?u.selection():u,v=g.selectAll(".domain").data([null]),b=g.selectAll(".tick").data(p,e).order(),w=b.exit(),S=b.enter().append("g").attr("class","tick"),k=b.select("line"),A=b.select("text");v=v.merge(v.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),b=b.merge(S),k=k.merge(S.append("line").attr("stroke","currentColor").attr(h+"2",l*a)),A=A.merge(S.append("text").attr("fill","currentColor").attr(h,l*f).attr("dy",1===t?"0em":3===t?"0.71em":"0.32em")),u!==g&&(v=v.transition(u),b=b.transition(u),k=k.transition(u),A=A.transition(u),w=w.transition(u).attr("opacity",yt).attr("transform",function(t){return isFinite(t=m(t))?c(t):this.getAttribute("transform")}),S.attr("opacity",yt).attr("transform",function(t){var e=this.parentNode.__axis;return c(e&&isFinite(e=e(t))?e:m(t))})),w.remove(),v.attr("d",4===t||2==t?r?"M"+l*r+","+_+"H0.5V"+x+"H"+l*r:"M0.5,"+_+"V"+x:r?"M"+_+","+l*r+"V0.5H"+x+"V"+l*r:"M"+_+",0.5H"+x),b.attr("opacity",1).attr("transform",function(t){return c(m(t))}),k.attr(h+"2",l*a),A.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=dt.call(arguments),u},u.tickArguments=function(t){return arguments.length?(i=null==t?[]:dt.call(t),u):i.slice()},u.tickValues=function(t){return arguments.length?(n=null==t?null:dt.call(t),u):n&&n.slice()},u.tickFormat=function(t){return arguments.length?(o=t,u):o},u.tickSize=function(t){return arguments.length?(a=r=+t,u):a},u.tickSizeInner=function(t){return arguments.length?(a=+t,u):a},u.tickSizeOuter=function(t){return arguments.length?(r=+t,u):r},u.tickPadding=function(t){return arguments.length?(s=+t,u):s},u}function wt(t){return bt(1,t)}function St(t){return bt(2,t)}function kt(t){return bt(3,t)}function At(t){return bt(4,t)}function Mt(t,e){void 0===e&&(e={});var i=e.insertAt;if(t&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===i&&n.firstChild?n.insertBefore(o,n.firstChild):n.appendChild(o),o.styleSheet?o.styleSheet.cssText=t:o.appendChild(document.createTextNode(t))}}Mt(".chart_Axis{fill:#000}.chart_Axis,.chart_Axis .axis .tick>text{font:10px sans-serif}.chart_Axis .axis .tick line,.chart_Axis .axis path.domain{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}");var Tt=function(t){function e(e){void 0===e&&(e="origin");var i=t.call(this)||this;return i._drawStartPos=e,i.updateScale(),i}return a(e,t),e.prototype.type=function(t){return arguments.length?(this._type=t,this.updateScale(),this):this._type},e.prototype.timePattern=function(t){return arguments.length?(this._timePattern=t,this.updateScale(),this):this._timePattern},e.prototype.lowValue=function(){return this.parse(this.low())},e.prototype.highValue=function(){return this.parse(this.high())},e.prototype.parse=function(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},e.prototype.parseInvert=function(t){return t instanceof Array?t.map(function(t){return this.parseInvert(t)},this):this.parserInvert&&t?this.parserInvert(t):t},e.prototype.format=function(t){return t instanceof Array?t.map(function(t){return this.format(t)},this):null!=t&&this.formatter?this.formatter(t):t},e.prototype.parseFormat=function(t){return this.format(this.parse(t))},e.prototype.scalePos=function(t){var e=this.d3Scale(this.parse(t));return"ordinal"===this.type()&&(e+=this.bandwidth()/2),e},e.prototype.bandwidth=function(){return this.d3Scale.bandwidth?this.d3Scale.bandwidth():0},e.prototype.isHorizontal=function(){switch(this.orientation()){case"left":case"right":return!1}return!0},e.prototype.domain=function(t){return arguments.length?(this.d3Scale.domain(t),this):this.d3Scale.domain()},e.prototype.range=function(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},e.prototype.invert=function(t){return this.d3Scale.invert(t)},e.prototype.guideTarget=function(t){return this._guideElement=i.select(t).attr("class",this._class),this},e.prototype.enter=function(e,i){t.prototype.enter.call(this,e,i),this.svg=i.append("g"),this.svgAxis=this.svg.append("g").attr("class","axis"),this.svgGuides=(this._guideElement||i).append("g").attr("class","guide")},e.prototype.updateScale=function(){var t=this;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()){var e=this.ordinalMappings();this.formatter=function(t){return e[t]||t}}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=At(this.d3Scale),this.d3Guides=At(this.d3Scale);break;case"top":this.d3Axis=wt(this.d3Scale),this.d3Guides=wt(this.d3Scale);break;case"right":this.d3Axis=St(this.d3Scale),this.d3Guides=St(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{var n,o=void 0,a=void 0,r=void 0,s=void 0,l=void 0;this.isHorizontal()?(n=this.width(),this.d3Scale.range([0,n]),o=n*this.extend()/100,a=this.d3Scale.invert(0),s=this.d3Scale.invert(-o),r=this.d3Scale.invert(n),l=this.d3Scale.invert(n+o)):(n=this.height(),this.d3Scale.range([n,0]),o=n*this.extend()/100,a=this.d3Scale.invert(n),s=this.d3Scale.invert(n+o),r=this.d3Scale.invert(0),l=this.d3Scale.invert(-o)),s===a&&(s=a-a*this.extend()/100),l===r&&(l=r+r*this.extend()/100),Math.sign(a)!==Math.sign(s)&&(s=0),Math.sign(r)!==Math.sign(l)&&(l=0),this.d3Scale.domain([s,l])}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());var h=this.ticks();return h.length&&(this.d3Axis.tickValues(h.map(function(e){return t.parse(e.value)})).tickFormat(function(t,e){return h[e].label}),this.d3Guides.tickValues(h.map(function(e){return t.parse(e.value)}))),this},e.prototype.adjustText=function(t,e){var n=this.isHorizontal(),o="left"===this.orientation(),a="bottom"===this.orientation(),r=this,s=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()&&s.call(function(){return r.linebreak.apply(r,arguments)},this.bandwidth());else if("wrap"===this.overlapMode())"ordinal"===this.type()&&s.call(function(){return r.wrap.apply(r,arguments)},this.bandwidth());else switch(n?this.overlapMode():"none"){case"stagger":s.style("text-anchor","middle").attr("dy",function(t,i){return(a?1:-1)*((a?.71:0)+i%e)+"em"}).attr("dx",0).attr("visibility",null).attr("transform","rotate(0)");break;case"hide":s.style("text-anchor","middle").attr("dy",(a?.71:0)+"em").attr("dx",0).attr("visibility",function(t,i){return i%e?"hidden":null}).attr("transform","rotate(0)");break;case"rotate":var l=-this.labelRotation()||0;if(0!==l&&e>1){s.each(function(){var t=i.select(this),e=t.node().getBBox(),n=(a?1:-1)*Math.sin(Math.PI*(-Math.abs(l)/180));t.style("text-anchor",l>0?a?"start":"end":a?"end":"start").attr("dy",e.height/2*n+"px").attr("dx",l>0?a?"0.71em":"-0.71em":a?"-0.71em":"0.71em").attr("transform","rotate("+l+")").attr("visibility",null)});break}default:s.style("text-anchor",n?"middle":o?"end":"start").attr("dy",n?(a?.71:0)+"em":"0.32em").attr("dx",0).attr("visibility",null).attr("transform","rotate(0)")}},e.prototype.calcTickOverlapModulus=function(t){var e=1;switch(this.overlapMode()){case"rotate":case"stagger":case"hide":var i=[];t.selectAll(".tick > text").each(function(){for(var t=this.getBoundingClientRect(),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},e.prototype.calcOverflow=function(t,e){if(this.updateScale(),this.hidden())return{left:0,top:0,right:0,bottom:0,depth:0,tickOverlapModulus:1};var i=this.isHorizontal();this.range(i?[0,this.width()]:[this.height(),0]);var 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();var a={left:0,top:0,right:0,bottom:0,depth:0,tickOverlapModulus:this.calcTickOverlapModulus(o)};this.adjustText(o,a.tickOverlapModulus);var r=o.node().getBBox();switch(a.depth=i?r.height:r.width,this.shrinkToFit()){case"low":case"both":a.left=i?-r.x:0,a.bottom=i?0:-(this.height()-(r.height+r.y))}switch(this.shrinkToFit()){case"high":case"both":a.top=i?0:-r.y,a.right=i?-(this.width()-r.x-r.width):0}return n.remove(),a},e.prototype.wrap=function(t,e,n){n=n||/\s+/;var o=this;t.each(function(){for(var t=i.select(this),a=t.text().split(n).reverse(),r=[],s=0,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(a.length/u),d=parseFloat(t.attr("dy")),f=t.text(null).append("tspan").attr("x",l).attr("y",h).attr("dy",d+"em"),y=0,_=a.pop();_;)r.push(_),f.text(r.join(" ")),y++,f.node().getComputedTextLength()>e&&y>=p&&(r.pop(),f.text(r.join(" ")),r=[_],f=t.append("tspan").attr("x",l).attr("y",h).attr("dy",1.1*++s+d+"em").text(_),y=0),_=a.pop();o.isHorizontal()||t.selectAll("tspan").attr("y",-s/2+"em")})},e.prototype.linebreak=function(t,e){this.wrap(t,e,"\n")},e.prototype.update=function(e,i){var n=this;t.prototype.update.call(this,e,i),this.svg.style("display",this.hidden()?"none":null);var o=this.calcOverflow(i),a=this.isHorizontal()?o.left:this.height()-o.top-o.bottom,r=this.isHorizontal()?this.width()-o.right-this.padding():0+this.padding();this.range(this.reverse()?[r,a]:[a,r]);var s=this;function l(t){t.attr("transform",function(){switch(s.orientation()){case"left":return"translate("+o.depth+", "+o.top+")";case"top":return"translate(0,"+o.depth+")";case"right":return"translate("+(s.width()-o.depth)+", "+o.top+")";case"bottom":return"translate(0,"+(s.height()-o.depth)+")"}return"translate(0,0)"})}this.svg.style("visibility","none"===this.type()?"hidden":null).transition().call(l),this._guideElement&&this.svgGuides.transition().call(l),this.svgAxis.call(this.d3Axis),this.adjustText(this.svgAxis,o.tickOverlapModulus);this.pos().x;var h=this.width(),c=this.svgAxis.selectAll(".axisTitle").data(this.title()?[this.title()]:[]),u=c.enter().append("text").attr("class","axisTitle").merge(c).transition().attr("dx",null).style("text-anchor","end");switch(this.orientation()){case"left":u.attr("transform","rotate(-90)").attr("x",-2).attr("y",2).attr("dy",".71em");break;case"right":u.attr("transform","rotate(-90)").attr("x",-2).attr("y",4).attr("dx",null).attr("dy","-.71em");break;case"top":u.attr("transform","rotate(0)").attr("x",h-2).attr("y",2).attr("dx",null).attr("dy",".71em");break;case"bottom":u.attr("transform","rotate(0)").attr("x",h-2).attr("y",-2).attr("dy",null)}u.text(this.title_exists()?this.title():""),c.exit().remove(),this.svgGuides.call(this.d3Guides).selectAll(".tick").classed("guide-0",function(t){return 0===t&&n.low()<0})},e.prototype.rerender=function(){this.svgAxis.call(this.d3Axis),this.svgGuides.call(this.d3Guides)},e.prototype.postUpdate=function(e,i){t.prototype.postUpdate.call(this,e,i),this._guideElement&&this._guideElement.attr("transform",this._element.attr("transform"))},r([i.publish("linear","set","Type",["none","ordinal","linear","pow","log","time"]),s("design:type",String)],e.prototype,"_type",void 0),r([i.publish("%Y-%m-%d","string","Time Series Pattern",null,{disable:function(t){return"time"!==t.type()}}),s("design:type",String)],e.prototype,"_timePattern",void 0),r([i.publish(!1,"boolean","Reverse"),s("design:type",Function)],e.prototype,"reverse",void 0),e}(i.SVGWidget);Tt.prototype._class+=" chart_Axis",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:function(t){return"pow"!==t.type()}}),Tt.prototype.publish("logBase",10,"number","Logarithmic base (disabled when type is not 'log')",null,{disable:function(t){return"log"!==t.type()}}),Tt.prototype.publish("ordinals",[],"array","Array of ordinal values to display (disabled when type is not 'ordinal')",null,{disable:function(t){return"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:function(t){return"ordinal"===t.type()}}),Tt.prototype.publish("tickFormat",null,"string","Format rules for tick text (disabled when type is 'ordinal')",null,{optional:!0,disable:function(t){return"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:function(t){return"ordinal"===t.type()}}),Tt.prototype.publish("high",null,"any","Maximum tick value (disabled when type is ordinal)",null,{optional:!0,disable:function(t){return"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:function(t){return"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:function(t){return"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:function(t){return"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:function(t){return"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});Mt(".chart_XYAxis .axis{fill:#000}.chart_XYAxis .axis,.chart_XYAxis .tick>text{font:10px sans-serif}.chart_XYAxis .focus .chart_Axis.value .tick{visibility:hidden}.chart_XYAxis .axis line,.chart_XYAxis .axis path{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}");var Pt=function(t){function e(){var e=t.call(this)||this;return e._skipSelection=!1,i.Utility.SimpleSelectionMixin.call(e),e._drawStartPos="origin",e.domainAxis=(new Tt).classed({domain:!0}).orientation_default("bottom").type("ordinal").overlapMode_default("stagger").shrinkToFit_default("high").extend_default(0),e.valueAxis=(new Tt).classed({value:!0}).orientation_default("left").type("linear").shrinkToFit_default("high"),e.xyBrush=i.brush().on("end",function(){return e.brushMoved()}).on("start.handle brush.handle end.handle",function(){return e.brushMoved2()}),e.xBrush=i.brushX().on("end",function(){return e.brushMoved()}).on("start.handle brush.handle end.handle",function(){return e.brushMoved2()}),e.yBrush=i.brushY().on("end",function(){return e.brushMoved()}).on("start.handle brush.handle end.handle",function(){return e.brushMoved2()}),e}return a(e,t),e.prototype.resetSelection=function(){return this._prevBrush=null,this},e.prototype.parseData=function(t){return this.domainAxis.parse(t)},e.prototype.parseValue=function(t){return this.valueAxis.parse(t,!0)},e.prototype.formatData=function(t){return this.domainAxis.format(t)},e.prototype.formatValue=function(t){return this.valueAxis.format(t)},e.prototype.parsedData=function(){return this.data().map(function(t){var e=0;return t.map(function(t,i){if(0===i)return this.parseData(t);if(i>=this.columns().length)return t;var n=this.yAxisStacked()?[e,e+this.parseValue(t)]:this.parseValue(t);return e+=this.parseValue(t),n},this)},this)},e.prototype.bandwidth=function(){return this.domainAxis.bandwidth()},e.prototype.enter=function(e,i){t.prototype.enter.call(this,e,i),this.svg=i.append("g"),this.svgRegions=i.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=i.append("g"),this.domainAxis.target(this.svg.node()).guideTarget(this.svgDomainGuide.node()),this.valueAxis.target(this.svg.node()).guideTarget(this.svgValueGuide.node()),this.svgBrush=i.append("g").attr("class","brush"),this.chartsEnter(this,this.svgData,250)},e.prototype.resizeBrushHandle=function(t,e,i){var n,o,a;return"e"===t.type||"w"===t.type?"M"+.5*(o=(n=+("e"===t.type))?1:-1)+","+(a=i/3)+"A6,6 0 0 "+n+" "+6.5*o+","+(a+6)+"V"+(2*a-6)+"A6,6 0 0 "+n+" "+.5*o+","+2*a+"ZM"+2.5*o+","+(a+8)+"V"+(2*a-8)+"M"+4.5*o+","+(a+8)+"V"+(2*a-8):"M"+(o=e/3)+", "+.5*(a=(n=+("s"===t.type))?1:-1)+"A6,6 0 0 "+(n+1)%2+" "+(o+6)+","+6.5*a+"H"+(2*o-6)+"A6,6 0 0 "+(n+1)%2+" "+2*o+","+.5*a+"ZM"+(o+8)+","+2.5*a+"H"+(2*o-8)+"M"+(o+8)+","+4.5*a+"H"+(2*o-8)},e.prototype.skipSelection=function(t){return arguments.length?(this._skipSelection=t,this):this._skipSelection},e.prototype.brushMoved=function(){if(!this._skipSelection){var t=[],e=this,n=i.brushSelection(this.svgBrush.node());n&&(t=this.data().filter(function(t){var i=e.dataPos(t[0]);if(e.use2dSelection()){var 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)}},e.prototype.brushMoved2=function(){var 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",function(t,e){return"translate("+o[e]+",0)"}):n.attr("display",null).attr("transform",function(t,e){return"translate(0, "+o[e]+")"})},e.prototype.dataPos=function(t){return this.domainAxis.scalePos(t)},e.prototype.valuePos=function(t){return this.valueAxis.scalePos(t)},e.prototype.getAxisSize=function(t){return{width:this.xAxis?this.xAxis.width():t.xAxis.width(),height:this.yAxis?this.yAxis.height():t.yAxis.width()}},e.prototype.calcMargin=function(t,e,i){for(var 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,a=this.height()-n.top-n.bottom,r=0,s=30,l=0,h=30,c=0;c<10;++c){this.xAxis.width(o-h).height(0);var u=this.xAxis.calcOverflow(e),p=u.depth;this.yAxis.width(0).height(a-s);var d=this.yAxis.calcOverflow(e),f=d.depth;if(r=u.right,l=d.top,p===s&&f===h)break;s=p,h=f}return this.xAxis.x(o/2+h/2+n.left).y(a+n.top).width(o-h),this.yAxis.x(n.left).y(a/2-s/2+n.top).height(a-s),n.left+=h,n.top+=l,n.right+=r,n.bottom+=s,n},e.prototype.updateRegions=function(t,e,n){var o=this,a=this.svgRegions.selectAll(".region").data(this.regions());a.enter().append("rect").attr("class","region"),n?a.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()}):a.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()}),a.exit().remove()},e.prototype.update=function(e,n){t.prototype.update.call(this,e,n);var o=this,a="horizontal"===this.orientation();if(this.updateRegions(e,n,a),this.domainAxis.orientation(a?"bottom":"left").title(this.xAxisTitle_exists()?this.xAxisTitle():this.columns()[0]),this.valueAxis.orientation(a?"left":"bottom"),this.xAxis=a?this.domainAxis:this.valueAxis,this.yAxis=a?this.valueAxis:this.domainAxis,"ordinal"===this.xAxisType()){var r=this.columns().length,s={};this.domainAxis.ordinals(this.data().map(function(t){return s[t[0]]=o.xAxisOrdinalMapping(t,t[r]),t[0]})).ordinalMappings(s)}else{var l=this.xAxisDomainLow()?this.xAxisDomainLow():this.domainAxis.parseInvert(i.min(this.parsedData(),function(t){return t[0]})),h=this.xAxisDomainHigh()?this.xAxisDomainHigh():this.domainAxis.parseInvert(i.max(this.parsedData(),function(t){return t[0]}));void 0!==l&&void 0!==h&&this.domainAxis.low(l).high(h)}var c=this.yAxisDomainLow()?this.yAxisDomainLow():this.valueAxis.parseInvert(i.min(this.parsedData(),function(t){return i.min(t.filter(function(t,e){return e>0&&o.columns()[e]&&0!==o.columns()[e].indexOf("__")&&null!==t}),function(t){return t instanceof Array?t[0]:t})})),u=this.yAxisDomainHigh()?this.yAxisDomainHigh():this.valueAxis.parseInvert(i.max(this.parsedData(),function(t){return i.max(t.filter(function(t,e){return e>0&&o.columns()[e]&&0!==o.columns()[e].indexOf("__")&&null!==t}),function(t){return t instanceof Array?t[1]:t})}));this.valueAxis.low(c).high(u),this.margin=this.calcMargin(e,n,a);var p=this.width()-this.margin.left-this.margin.right;p<0&&(p=0);var d=this.height()-this.margin.top-this.margin.bottom;d<0&&(d=0);var f=a?p:d,y=a?d:p;if(this.domainAxis.tickLength(this.xAxisGuideLines()?y:0).render(),this.valueAxis.tickLength(this.yAxisGuideLines()?f:0).render(),this.svgDataClipRect.attr("width",p).attr("height",d),this.svgData.transition().attr("transform","translate("+this.margin.left+","+this.margin.top+")"),this.updateBrush(p,d,f,a),this.updateFocusChart(e,n,this.margin,p,d,a),this.chartsUpdate(p,d,250),this.selectionMode())return this.brushMoved()},e.prototype.updateBrush=function(t,e,n,o){var a=this,r=this.use2dSelection()?this.xyBrush:o?this.xBrush:this.yBrush,s=i.brushSelection(this.svgBrush.node());r.extent([[0,0],[t,e]]),this.svgBrush.attr("transform","translate("+this.margin.left+", "+this.margin.top+")").style("display",this.selectionMode()?null:"none").call(r);var l=this.use2dSelection()?[]:o?[{type:"w"},{type:"e"}]:[{type:"n"},{type:"s"}],h=this.svgBrush.selectAll(".handle--custom").data(l);if(h.enter().append("path").attr("class","handle--custom").merge(h).attr("cursor",o?"ew-resize":"ns-resize").attr("d",function(i){return a.resizeBrushHandle(i,t,e)}),this.selectionMode()){if(this._prevXAxisType!==this.xAxisType()&&(this._prevXAxisType=this.xAxisType(),this._prevBrush=null),this._prevBrush){if(s){if(this._prevBrush.orientation!==this.orientation()){var c=s[0];s[0]=this._prevBrush.maxCurrExtent-s[1],s[1]=this._prevBrush.maxCurrExtent-c}var u=n/this._prevBrush.maxCurrExtent;1!==u&&this.svgBrush.transition().on("start",function(){r.on("end",null)}).call(r.move,[s[0]*u,s[1]*u]).on("end",function(){r.on("end",function(){return a.brushMoved()})})}}else this.svgBrush.call(r.move,[0,n]);this._prevBrush={orientation:this.orientation(),maxCurrExtent:n}}},e.prototype.updateFocusChart=function(t,e,i,n,o,a){var r=this,s=this.svgFocus.selectAll("#"+this.id()+"_focusChart").data(this.xAxisFocus()?[!0]:[]);s.enter().append("g").attr("id",this.id()+"_focusChart").attr("class","focus").each(function(){r.focusChart=(new r.constructor).target(this),r.focusChart.xBrush.on("brush.focus",function(){r.syncAxis(n),r.chartsUpdate(n,o,0)}),r.focusChart.layers(r.layers().map(function(t){return new t.constructor}))}).merge(s).each(function(){var t,e;r.copyPropsTo(r.focusChart,["layers"]);var i=0;try{for(var o=l(r.layers()),a=o.next();!a.done;a=o.next()){a.value.copyPropsTo(r.focusChart.layers()[i]),i++}}catch(e){t={error:e}}finally{try{a&&!a.done&&(e=o.return)&&e.call(o)}finally{if(t)throw t.error}}r.focusChart.xAxisFocus(!1).selectionMode(!0).skipSelection(!0).orientation("horizontal").xAxisGuideLines(!1).xAxisDomainLow(null).xAxisDomainHigh(null).yAxisGuideLines(!1).x(r.width()/2).y(r.height()-r.xAxisFocusHeight()/2).width(r.width()).height(r.xAxisFocusHeight()).columns(r.columns()).data(r.data()).render(),r.syncAxis(n)}),s.exit().each(function(){r.focusChart&&(r.focusChart.target(null),delete r.focusChart)}).remove()},e.prototype.syncAxis=function(t){var 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{var n=(e[1]-e[0])/t;this.xAxis.range([-e[0]/n,(t-e[0])/n])}this.xAxis.rerender()}},e.prototype.layerColumns=function(e){var i=e.columns(),n=t.prototype.columns.call(this).filter(function(t){return t!==i[0]});return n.length?c([i[0]],h(n),!1):i},e.prototype.layerColumnIndices=function(t){var e=t.columns();return this.layerColumns(t).map(function(t){return e.indexOf(t)})},e.prototype.layerColumnIndex=function(t,e){return t.columns().indexOf(e)},e.prototype.layerData=function(t){if(1===arguments.length){var e=this.layerColumnIndices(t);return t.data().map(function(t){var i=e.map(function(e){return t[e]});return i.__hpcc_origRow=t,i})}throw new Error("Setting data on XYAxisLayer is not supported.")},e.prototype.layerEnter=function(t,e,i){},e.prototype.layerUpdate=function(t,e,i){},e.prototype.layerExit=function(t,e,i){},e.prototype.chartsEnter=function(t,e,i){var n,o;void 0===i&&(i=250),this.layerEnter(this,e,i);try{for(var a=l(this.layers()),r=a.next();!r.done;r=a.next()){var s=r.value;s.__xyAxisElement=e.append("g").attr("class",s.class()),s.target(s.__xyAxisElement.node()).layerEnter(this,e,i)}}catch(t){n={error:t}}finally{try{r&&!r.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}},e.prototype.chartsUpdate=function(t,e,i){var n,o;this.layerUpdate(this,this.svgData,i);try{for(var a=l(this.layers()),r=a.next();!r.done;r=a.next()){var s=r.value;s.resize({width:t,height:e}).layerUpdate(this,s.__xyAxisElement,i)}}catch(t){n={error:t}}finally{try{r&&!r.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}},e.prototype.exit=function(e,i){this.valueAxis.target(null),this.domainAxis.target(null),t.prototype.exit.call(this,e,i)},e.prototype.selection=function(t){var e=this,n=this;this._selection.widgetElement().selectAll(".selected,.deselected").each(function(e){var o=t.indexOf(e.origRow)>=0;i.select(this).classed("selected",o).classed("deselected",!o).attr("filter",n._selection.svgGlowID()&&o?"url(#".concat(n._selection.svgGlowID(),")"):null)});var o=t.map(function(t){return e.rowToObj(t)});setTimeout(function(){e.click(o,"",!0)},0)},e.prototype.xAxisOrdinalMapping=function(t,e){return t[0]},e.prototype.click=function(t,e,i){},e}(i.SVGWidget);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:function(t){return"ordinal"===t.xAxisType()}}),Pt.prototype.publish("xAxisDomainHigh",null,"string","X-Axis High",null,{optional:!0,disable:function(t){return"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:function(t){return"horizontal"!==t.orientation()}}),Pt.prototype.publish("xAxisFocusHeight",80,"number","X-Axis Focus Height",null,{disable:function(t){return!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:function(t){return"ordinal"!==t.xAxisType()||t._class.indexOf("chart_Column")<0}}),Pt.prototype.publish("yAxisDomainLow",null,"string","Y-Axis Low",null,{optional:!0,disable:function(t){return"ordinal"===t.yAxisType()}}),Pt.prototype.publish("yAxisDomainHigh",null,"string","Y-Axis High",null,{optional:!0,disable:function(t){return"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");Mt(".chart_Scatter .area,.chart_Scatter .line,.chart_Scatter .pointShape{pointer-events:none}.chart_Scatter .point .pointSelection{fill:none;stroke:none;pointer-events:all}.chart_Scatter .point .pointSelection.selected{fill:none;stroke:red}");var Ct=function(t){function n(){var i=t.call(this)||this;return e.INDChart.call(i),e.ITooltip.call(i),i.xAxisGuideLines_default(!0).yAxisGuideLines_default(!0),i}return a(n,t),n.prototype.xPos=function(t,e){return"horizontal"===t.orientation()?t.dataPos(e.label):t.valuePos(e.value)},n.prototype.yPos=function(t,e){return"horizontal"===t.orientation()?t.valuePos(e.value):t.dataPos(e.label)},n.prototype.curve=function(){switch(this.interpolate()){case"linear":return N;case"step":return ct;case"step-before":return ut;case"step-after":return pt;case"basis":return Y;case"bundle":return U;case"cardinal":return J;case"catmullRom":return $;case"natural":return lt;default:return at}},n.prototype.getScale=function(){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()}},n.prototype.pointColor=function(t,e,i,n){return this.interpolate()&&this.pointDarken()?this.strokeColor(t,e,i,n):this.fillColor(t,e,i,n)},n.prototype.lineColor=function(t,e,i,n){return this.interpolateFill()&&this.interpolateDarken()?this.strokeColor(t,e,i,n):this.fillColor(t,e,i,n)},n.prototype.areaColor=function(t,e,i,n){return this.fillColor(t,e,i,n)},n.prototype.layerEnter=function(e,i,n){void 0===n&&(n=250),t.prototype.layerEnter.call(this,e,i,n);var o=this;this.tooltipHTML(function(t){return"series-table"===o.tooltipStyle()?o.tooltipFormat({label:t.label,arr:o.columns().slice(1).map(function(e,i){return{label:e,color:o._palette(e),value:o.data()[t.rowIdx][i+1]}})}):o.tooltipFormat({label:t.label,series:t.column,value:t.value})})},n.prototype.layerUpdate=function(e,n,o){var a=this;t.prototype.layerUpdate.call(this,e,n);var r,s,l,h="horizontal"===e.orientation(),c=h?this.height():this.width(),u=this;this._palette=this._palette.switch(this.paletteID()),this.useClonedPalette()&&(this._palette=this._palette.cloneNotExists(this.paletteID()+"_"+this.id())),this._prevPointShape!==this.pointShape()&&(n.selectAll(".data").remove(),this._prevPointShape=this.pointShape()),this.pointSizeColumn_exists()&&(r=this.columns().indexOf(this.pointSizeColumn()),s=i.extent(this.data(),function(t){return t[r]}),l=this.getScale().domain(s));var p=this.layerColumns(e),d=this.layerData(e),f=this.flattenData(p,d).map(function(t){return t.shape=function(t){switch(t){case"rectangle":return"rect";case"circle":return"circle";case"cross":return"path"}}(u.pointShape()),t.column=p[t.colIdx],t.row=d[t.rowIdx],t.origRow=d[t.rowIdx].__hpcc_origRow,s?(t.size=l(t.row[r])*(u.maxPointSize()-u.minPointSize())+u.minPointSize(),t.column!==u.pointSizeColumn()&&t):(t.size=u.pointSize(),t)}).filter(function(t){return t}),y=n.selectAll(".area").data(p.filter(function(t,e){return u.interpolate()&&u.interpolateFill()&&e>0})),m=y.enter().append("path"),g=function(){var t=L,e=null,i=x(0),n=B,o=x(!0),a=null,r=N,s=null;function l(l){var h,c,u,p,d,f=l.length,y=!1,x=new Array(f),m=new Array(f);for(null==a&&(s=r(d=_())),h=0;h<=f;++h){if(!(h<f&&o(p=l[h],h,l))===y)if(y=!y)c=h,s.areaStart(),s.lineStart();else{for(s.lineEnd(),s.lineStart(),u=h-1;u>=c;--u)s.point(x[u],m[u]);s.lineEnd(),s.areaEnd()}y&&(x[h]=+t(p,h,l),m[h]=+i(p,h,l),s.point(e?+e(p,h,l):x[h],n?+n(p,h,l):m[h]))}if(d)return s=null,d+""||null}function h(){return H().defined(o).curve(r).context(a)}return l.x=function(i){return arguments.length?(t="function"==typeof i?i:x(+i),e=null,l):t},l.x0=function(e){return arguments.length?(t="function"==typeof e?e:x(+e),l):t},l.x1=function(t){return arguments.length?(e=null==t?null:"function"==typeof t?t:x(+t),l):e},l.y=function(t){return arguments.length?(i="function"==typeof t?t:x(+t),n=null,l):i},l.y0=function(t){return arguments.length?(i="function"==typeof t?t:x(+t),l):i},l.y1=function(t){return arguments.length?(n=null==t?null:"function"==typeof t?t:x(+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:x(!!t),l):o},l.curve=function(t){return arguments.length?(r=t,null!=a&&(s=r(a)),l):r},l.context=function(t){return arguments.length?(null==t?a=s=null:s=r(a=t),l):a},l}().curve(this.curve());h?g.x(function(t){return u.xPos(e,t)}).y0(Math.min(c,this.yPos(e,{value:0}))).y1(function(t){return u.yPos(e,t)}):g.y(function(t){return u.yPos(e,t)}).x0(Math.max(0,this.xPos(e,{value:0}))).x1(function(t){return u.xPos(e,t)}),m.merge(y).attr("class",function(t){return"area series series-"+a.cssTag(t)}).each(function(t,e){i.select(this).attr("d",g(f.filter(function(t){return t.colIdx===e+1}))).style("opacity",u.interpolateFillOpacity()).style("stroke","none").style("fill",u.areaColor([],t,void 0,[]))}),y.exit().remove();var v=n.selectAll(".line").data(p.filter(function(t,e){return u.interpolate()&&e>0})),b=v.enter().append("path"),w=H().x(function(t){return u.xPos(e,t)}).y(function(t){return u.yPos(e,t)}).curve(this.curve());b.merge(v).attr("class",function(t){return"line series series-"+a.cssTag(t)}).each(function(t,e){var n=i.select(this),o=f.filter(function(t){return t.colIdx===e+1});n.attr("d",w(o)).style("stroke",u.lineColor([],t,void 0,[])).style("fill","none")}),v.exit().remove();var S=n.selectAll(".point").data(f,function(t,e){return t.shape+"_"+e});S.enter().append("g").each(function(t){var n=i.select(this);n.append(t.shape).attr("class","pointShape"),n.append("text").attr("class","pointValue").style("display","none").attr("text-anchor",u.valueAnchor()).attr("alignment-baseline",u.valueBaseline()).attr("fill",function(t,e){return"middle"===u.valueBaseline()||"central"===u.valueBaseline()?u.textColor(t.row,t.column,t.value,t.origRow):null}),n.append("circle").attr("class","pointSelection").on("mouseout.tooltip",u.tooltip.hide).on("mousemove.tooltip",u.tooltip.show).call(e._selection.enter.bind(e._selection)).on("click",function(t,i){u.click(e.rowToObj(e.data()[t.rowIdx]),t.column,e._selection.selected(this))}).on("dblclick",function(t,i){u.dblclick(e.rowToObj(e.data()[t.rowIdx]),t.column,e._selection.selected(this))})}).merge(S).attr("class",function(t){return"point series series-"+a.cssTag(t.column)}).each(function(t){i.select(this).select(".pointValue").attr("x",function(t){return u.xPos(e,t)}).attr("y",function(t){return u.yPos(e,t)}).style("display",u.showValue()?"block":"none").attr("text-anchor",u.valueAnchor()).attr("alignment-baseline",u.valueBaseline()).text(function(t){return t.value}),i.select(this).select(".pointSelection").attr("cx",function(t){return u.xPos(e,t)}).attr("cy",function(t){return u.yPos(e,t)}).attr("r",t.size);var n=i.select(this).select(".pointShape");switch(t.shape){case"rect":n.attr("x",function(i){return u.xPos(e,i)-t.size/2}).attr("y",function(i){return u.yPos(e,i)-t.size/2}).attr("width",t.size).attr("height",t.size).style("fill",u.pointColor(t.row,t.column,t.value,t.origRow));break;case"circle":n.attr("cx",function(t){return u.xPos(e,t)}).attr("cy",function(t){return u.yPos(e,t)}).attr("r",.9*t.size).style("fill",u.pointColor(t.row,t.column,t.value,t.origRow));break;case"path":n.attr("d",function(i){return"M"+(u.xPos(e,i)-t.size/2)+" "+(u.yPos(e,i)-t.size/2)+" L"+(u.xPos(e,i)+t.size/2)+" "+(u.yPos(e,i)+t.size/2)+" M"+(u.xPos(e,i)-t.size/2)+" "+(u.yPos(e,i)+t.size/2)+" L"+(u.xPos(e,i)+t.size/2)+" "+(u.yPos(e,i)-t.size/2)}).style("stroke",u.pointColor(t.row,t.column,t.value,t.origRow))}}),S.exit().remove()},n.prototype.exit=function(e,i){t.prototype.exit.call(this,e,i)},n.__inputs=[{id:"label",type:"any"},{id:"values",type:"number",multi:!0}],n}(Pt);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:function(t){return!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:function(t){return!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=function(t){function e(){var e=t.call(this)||this;return e.interpolate_default("linear").interpolateFill_default(!0),e}return a(e,t),e}(Ct);zt.prototype._class+=" chart_Area";Mt(".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}");var It=function(t){function n(){var n=t.call(this)||this;return n.textLocal=i.local(),n.stackedTextLocal=i.local(),e.INDChart.call(n),e.ITooltip.call(n),n._selection.skipBringToTop(!0),n._linearGap=25,n}return a(n,t),n.prototype.layerEnter=function(e,i,n){void 0===n&&(n=250),t.prototype.layerEnter.call(this,e,i,n);var o=this;this.tooltipHTML(function(t){if("series-table"===o.tooltipStyle())return o.tooltipFormat({label:t.row[0],arr:o.columns().slice(1).map(function(e,i){return{label:e,color:o._palette(e),value:t.row[i+1]}})});var i=t.row[t.idx];return i instanceof Array&&(i=i[1]-i[0]),o.tooltipFormat({label:t.row[0],series:o.layerColumns(e)[t.idx],value:i})})},n.prototype.adjustedData=function(t){var e=this;return this.layerData(t).map(function(i){var n=0;return i.map(function(i,o){if(0===o)return i;if(o>=e.layerColumns(t).length)return i;var a=t.yAxisStacked()?[n,n+i]:i;return n+=i,a},e)},this)},n.prototype.layerUpdate=function(e,n,o){void 0===o&&(o=250),t.prototype.layerUpdate.call(this,e,n,o);var a="horizontal"===e.orientation();this.isHorizontal=a;var r=this;this._palette=this._palette.switch(this.paletteID()),this.useClonedPalette()&&(this._palette=this._palette.cloneNotExists(this.paletteID()+"_"+this.id()));var s=i.format(r.showValueAsPercentFormat()),l=10,u=0;switch(e.xAxisType()){case"ordinal":l=e.bandwidth(),u=-l/2;break;case"linear":case"time":l=Math.max(Math.abs(e.dataPos(2)-e.dataPos(1))*(100-this._linearGap)/100,l),u=-l/2}this.tooltip.direction(a?"n":"e");var p=i.scaleBand().domain(r.layerColumns(e).filter(function(t,e){return e>0})).rangeRound(a?[0,l]:[l,0]).paddingInner(this.xAxisSeriesPaddingInner()).paddingOuter(0),d=[],f=[],y=this.columns().length,_=this.data();this.showValue()&&"series"===this.showValueAsPercent()&&_.forEach(function(t){t.filter(function(t,e){return e>0&&e<y}).forEach(function(t,e){void 0===f[e+1]&&(f[e+1]=0),f[e+1]+=t})}),(this.showDomainTotal()||this.showValue()&&"domain"===this.showValueAsPercent())&&(d=_.map(function(t){return t.filter(function(t,e){return e>0&&e<y}).reduce(function(t,e){return t+e},0)}));var x=n.selectAll(".dataRow").data(this.adjustedData(e)),m=e.data(),g=this.getAxisSize(e);x.enter().append("g").attr("class","dataRow").merge(x).each(function(t,n){var _=i.select(this),x=_.selectAll(".dataCell").data(t.filter(function(t,i){return i<r.layerColumns(e).length}).map(function(i,o){return{column:r.layerColumns(e)[o],row:t,origRow:m[n],value:i,idx:o}}).filter(function(t){return null!==t.value&&t.idx>0}),function(t){return t.column}),v=x.enter().append("g").attr("class","dataCell").on("mouseout.tooltip",function(t){(!r.tooltipInnerTextEllipsedOnly()||t.innerTextObj&&t.innerTextObj.isTruncated)&&r.tooltip.hide.apply(r,arguments)}).on("mousemove.tooltip",function(t){(!r.tooltipInnerTextEllipsedOnly()||t.innerTextObj&&t.innerTextObj.isTruncated)&&r.tooltip.show.apply(r,arguments)}).call(e._selection.enter.bind(e._selection)).on("click",function(t){r.click(e.rowToObj(t.origRow),t.column,e._selection.selected(this))}).on("dblclick",function(t){r.dblclick(e.rowToObj(t.origRow),t.column,e._selection.selected(this))}).style("opacity",0).each(function(t){var e=i.select(this);e.append("rect").attr("class","columnRect series series-"+r.cssTag(t.column)),e.append("text").attr("class","columnRectText").style("stroke","transparent")});v.transition().duration(o).style("opacity",1);var b=e.yAxisStacked()?l:p.bandwidth();v.merge(x).each(function(l){var h=i.select(this),c=e.dataPos(t[0])+(e.yAxisStacked()?0:p(l.column))+u,_=l.value instanceof Array?l.value[1]:l.value,x=l.origRow[l.idx];if(r.showValue()){var m=r.dataMeta();switch(r.showValueAsPercent()){case"series":var v=void 0!==m.sum?m.sum:f[l.idx];x=s(x/v);break;case"domain":var w=void 0!==m.sum?m.sum:d[n];x=s(x/w);break;default:x=i.format(r.showValueFormat())(x)}}var S=e.valuePos(_),k=e.valuePos(l.value instanceof Array?l.value[0]:0),A=Math.min(k,S),M=Math.abs(S-k),T=r.innerTextFontSize(),P=r.innerTextPadding_exists()?r.innerTextPadding():T/2.5,C=r.intersectRectRect({x:a?c:A,y:a?A:c,width:a?b:M,height:a?M:b},{x:0,y:0,width:g.width,height:g.height}),z=h.select("rect").transition().duration(o).style("fill",function(t){return r.fillColor(t.row,t.column,t.value,t.origRow)});a?z.attr("x",c).attr("y",A).attr("width",b).attr("height",M):z.attr("y",c).attr("x",A).attr("height",b).attr("width",M);var I=h.select("text").transition().duration(o).style("font-size",T+"px").style("fill",function(t){return r.textColor(t.row,t.column,t.value,t.origRow)});I.style("font-family",r.innerTextFontFamily_exists()?r.innerTextFontFamily():null);var F=r.innerTextPadding_exists()?r.innerTextPadding():8,D=T/2.7;if(a){var O=C.y+C.height-P;I.attr("x",c+b/2).attr("y",O+D).attr("transform","rotate(-90, ".concat(c+b/2,", ").concat(O,")"))}else I.attr("x",C.x+F).attr("y",c+b/2+D);I.attr("height",b).attr("width",M),r.showInnerText()&&I.text(function(t){var e=r.innerText(t.origRow,t.origRow[y],t.idx);if(e){var i=a?C.height:C.width,n=r.calcInnerText(i,e,x);return t.innerTextObj=n,n.text}return""});var R=h.selectAll(".dataText").data(r.showValue()?["".concat(_)]:[]);R.enter().append("g").attr("class","dataText").each(function(t){r.textLocal.set(this,(new i.Text).target(this).colorStroke_default("transparent"))}).merge(R).each(function(){var t,e,i={x:0,y:0},n=r.valueFontFamily(),o=r.valueFontSize(),s=r.textSize(x,n,o),h=parseFloat(x)>=0,u=r.valueAnchor()?r.valueAnchor():a?"middle":"start",p=C.x,d=g.width-(C.x+C.width),f=C.y,y=g.height-(C.y+C.height);if(l.innerTextObj){var _=l.innerTextObj,m=_.padding,v=_.valueTextWidth;e=!1,a?(u="middle",i.x=c+b/2,4===l.innerTextObj.category?(e=!0,i.y=A-m-o/2):i.y=A+m+o/2):(u="start",4===l.innerTextObj.category?(e=!0,i.x=M+A+m):i.x=M+A-v-m,i.y=c+b/2)}else a?(t=C.height<s.height,e=!r.valueCentered()||t,i.x=C.x+C.width/2,e?h?f<s.height+F?t?i.y=C.y+C.height+s.height:(e=!1,i.y=C.y+C.height/2):i.y=C.y-s.height/2-F:y<s.height?t?i.y=C.y-s.height/2-F:(e=!1,i.y=C.y+C.height/2):i.y=C.y+s.height+F:i.y=C.y+C.height/2):(t=C.width<s.width,e=!r.valueCentered()||t,i.y=C.y+C.height/2,e?h?d<s.width+F?r.showInnerText()||!t?(e=!1,i.x=C.x+C.width/2):i.x=C.x-(s.width-F):i.x=C.x+C.width+s.width/2+F:p<s.width?r.showInnerText()||!t?(e=!1,i.x=C.x+C.width/2):i.x=C.x+C.width+(s.width-F):i.x=C.x-(s.width-F):i.x=C.x+C.width/2);var w=e?null:r.textColor(l.row,l.column,l.value,l.origRow),S=r.columns(),k=r.yAxisStacked()&&t||e&&r.yAxisStacked()&&S.indexOf(l.column)!==S.length-1;r.textLocal.get(this).pos(i).anchor(u).fontFamily(n).fontSize(o).text("".concat(x)).colorFill(w).visible(r.showValue()&&!k).render()}),R.exit().each(function(t){r.textLocal.get(this).target(null)}).remove()}),x.exit().transition().duration(o).style("opacity",0).remove();var w=e.yAxisStacked()?d[n]:Math.max.apply(Math,c([],h(t.filter(function(t,e){return e>0&&e<y})),!1)),S=_.selectAll(".stackedTotalText").data(r.showDomainTotal()?[d[n]]:[]);S.enter().append("g").attr("class","stackedTotalText").each(function(t){r.stackedTextLocal.set(this,(new i.Text).target(this).colorStroke_default("transparent"))}).merge(S).each(function(i){var n={x:0,y:0},o=e.dataPos(t[0]),s=e.valuePos(w),l=r.valueFontFamily(),h=r.valueFontSize(),c=r.textSize(i,l,h),u=parseFloat(i)>=0,p="middle";a?(n.x=o,n.y=u?s-c.height/2:s+c.height/2):(p="start",n.y=o,n.x=u?s+c.width/2:s-c.width/2),r.stackedTextLocal.get(this).pos(n).anchor(p).fontFamily(l).fontSize(h).text(i).render()}),S.exit().each(function(t){r.textLocal.get(this).target(null)}).remove()}),x.exit().transition().duration(o).remove()},n.prototype.calcInnerText=function(t,e,i){var n,o,a=this.innerTextFontFamily_exists()?this.innerTextFontFamily():"Verdana",r=this.innerTextFontSize(),s=this.valueFontFamily_exists()?this.valueFontFamily():"Verdana",h=this.valueFontSize(),c=this.innerTextPadding_exists()?this.innerTextPadding():r/2.5,u=this.isHorizontal?h:this.textSize(i,s,h).width,p=e,d=3*c+this.textSize("...",a,r).width+u,f=1*c+u,y=4;if(3*c+this.textSize(e,a,r).width+u<t)y=1;else if(d<t){var _=t-d,x="";try{for(var m=l(e),g=m.next();!g.done;g=m.next()){var v=g.value;if(this.textSize(x+v,a,r).width>_){e=x+"...";break}x+=v}}catch(t){n={error:t}}finally{try{g&&!g.done&&(o=m.return)&&o.call(m)}finally{if(n)throw n.error}}y=2}else f<t?(e="",y=3):e="";return{text:e,isTruncated:p!==e,padding:c,category:y,valueTextWidth:u}},n.prototype.innerText=function(t,e,i){return t[0]},n.__inputs=[{id:"label",type:"string"},{id:"values",type:"number",multi:!0}],n}(Pt);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",function(){return 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:function(t){return!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:function(t){return!t.showValue()},optional:!0}),It.prototype.publish("showValueAsPercentFormat",".0%","string","D3 Format for %",null,{disable:function(t){return!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 Ft=function(t){function e(){var e=t.call(this)||this;return e.orientation_default("vertical"),e}return a(e,t),e}(It);function Dt(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,a,r,s=new Nt(t),l=+t.value&&(s.value=t.value),h=[s];for(null==e&&(e=Rt);i=h.pop();)if(l&&(i.value=+i.data.value),(o=e(i.data))&&(r=o.length))for(i.children=new Array(r),a=r-1;a>=0;--a)h.push(n=i.children[a]=new Nt(o[a])),n.parent=i,n.depth=i.depth+1;return s.eachBefore(Et)}function Rt(t){return t.children}function jt(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}Ft.prototype._class+=" chart_Bar",Nt.prototype=Ot.prototype={constructor:Nt,count:function(){return this.eachAfter(Dt)},each:function(t){var e,i,n,o,a=this,r=[a];do{for(e=r.reverse(),r=[];a=e.pop();)if(t(a),i=a.children)for(n=0,o=i.length;n<o;++n)r.push(i[n])}while(r.length);return this},eachAfter:function(t){for(var e,i,n,o=this,a=[o],r=[];o=a.pop();)if(r.push(o),e=o.children)for(i=0,n=e.length;i<n;++i)a.push(e[i]);for(;o=r.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(jt)}};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,a=[];n<o;)e=t[n],i&&qt(i,e)?++n:(i=Gt(a=Ht(a,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(Yt(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(Yt(t[i],t[n]),e)&&Vt(Yt(t[i],e),t[n])&&Vt(Yt(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 Yt(t[0],t[1]);case 3:return Xt(t[0],t[1],t[2])}var e}function Yt(t,e){var i=t.x,n=t.y,o=t.r,a=e.x,r=e.y,s=e.r,l=a-i,h=r-n,c=s-o,u=Math.sqrt(l*l+h*h);return{x:(i+a+l/u*c)/2,y:(n+r+h/u*c)/2,r:(u+o+s)/2}}function Xt(t,e,i){var n=t.x,o=t.y,a=t.r,r=e.x,s=e.y,l=e.r,h=i.x,c=i.y,u=i.r,p=n-r,d=n-h,f=o-s,y=o-c,_=l-a,x=u-a,m=n*n+o*o-a*a,g=m-r*r-s*s+l*l,v=m-h*h-c*c+u*u,b=d*f-p*y,w=(f*v-y*g)/(2*b)-n,S=(y*_-f*x)/b,k=(d*g-p*v)/(2*b)-o,A=(p*x-d*_)/b,M=S*S+A*A-1,T=2*(a+w*S+k*A),P=w*w+k*k-a*a,C=-(M?(T+Math.sqrt(T*T-4*M*P))/(2*M):P/T);return{x:n+w+S*C,y:o+k+A*C,r:C}}function Ut(t,e,i){var n,o,a,r,s=t.x-e.x,l=t.y-e.y,h=s*s+l*l;h?(o=e.r+i.r,o*=o,r=t.r+i.r,o>(r*=r)?(n=(h+r-o)/(2*h),a=Math.sqrt(Math.max(0,r/h-n*n)),i.x=t.x-n*s-a*l,i.y=t.y-n*l+a*s):(n=(h+o-r)/(2*h),a=Math.sqrt(Math.max(0,o/h-n*n)),i.x=e.x+n*s-a*l,i.y=e.y+n*l+a*s)):(i.x=e.x+i.r,i.y=e.y)}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 Zt(t){var e=t._,i=t.next._,n=e.r+i.r,o=(e.x*i.r+i.x*e.r)/n,a=(e.y*i.r+i.y*e.r)/n;return o*o+a*a}function Jt(t){this._=t,this.next=null,this.previous=null}function Kt(t){return null==t?null:function(t){if("function"!=typeof t)throw new Error;return t}(t)}function $t(){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,a,r=n.length,s=t(i)*e||0;if(s)for(o=0;o<r;++o)n[o].r+=s;if(a=function(t){if(!(o=t.length))return 0;var e,i,n,o,a,r,s,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;Ut(i,e,n=t[2]),e=new Jt(e),i=new Jt(i),n=new Jt(n),e.next=n.previous=i,i.next=e.previous=n,n.next=i.previous=e;t:for(s=3;s<o;++s){Ut(e._,i._,n=t[s]),n=new Jt(n),l=i.next,h=e.previous,c=i._.r,u=e._.r;do{if(c<=u){if(Qt(l._,n._)){i=l,e.next=i,i.previous=e,--s;continue t}c+=l._.r,l=l.next}else{if(Qt(h._,n._)){(e=h).next=i,i.previous=e,--s;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,a=Zt(e);(n=n.next)!==i;)(r=Zt(n))<a&&(e=n,a=r);i=e.next}for(e=[i._],n=i;(n=n.next)!==i;)e.push(n._);for(n=Bt(e),s=0;s<o;++s)(e=t[s]).x-=n.x,e.y-=n.y;return n.r}(n),s)for(o=0;o<r;++o)n[o].r-=s;i.r=a+s}}}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)}}Mt(".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}");var oe=function(t){function n(){var n=t.call(this)||this;return e.I2DChart.call(n),e.ITooltip.call(n),i.Utility.SimpleSelectionMixin.call(n),n._drawStartPos="origin",n.labelWidgets={},n.d3Pack=function(){var t=null,e=1,i=1,n=$t;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($t,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=Kt(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([n.width(),n.height()]).padding(1.5),n}return a(n,t),n.prototype.size=function(e){var i=t.prototype.size.apply(this,arguments);return arguments.length&&this.d3Pack.size([this.width(),this.height()]),i},n.prototype.enter=function(e,i){t.prototype.enter.call(this,e,i),this._selection.widgetElement(i);var n=this;this.tooltipHTML(function(t){return"series-table"===n.tooltipStyle()?n.tooltipFormat({label:t[0],arr:n.columns().slice(1).map(function(e,i){return{label:e,color:n._palette(t[0]),value:t[1]}})}):n.tooltipFormat({label:t.data[0],value:t.data[1]})})},n.prototype.update=function(e,n){var o=this;t.prototype.update.call(this,e,n);var a=this;this._palette=this._palette.switch(this.paletteID()),this.useClonedPalette()&&(this._palette=this._palette.cloneNotExists(this.paletteID()+"_"+this.id()));var r=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(r);var s=n.selectAll(".node").data(r.children||[],function(t){return t.data[0]});s.enter().append("g").attr("class",function(t,e){return"node series series-"+o.cssTag(t.data[0])}).attr("opacity",0).call(this._selection.enter.bind(this._selection)).on("click",function(t){a.click(a.rowToObj(t.data),a.columns()[1],a._selection.selected(this))}).on("dblclick",function(t){a.dblclick(a.rowToObj(t.data),a.columns()[1],a._selection.selected(this))}).each(function(t){var e=i.select(this),n=t.x,o=t.y;e.append("circle").attr("transform","translate("+n+","+o+")").attr("r",0).on("mouseout.tooltip",a.tooltip.hide).on("mousemove.tooltip",a.tooltip.show),t.__viz_faChar?a.labelWidgets[t.data[0]]=(new i.FAChar).char(t.__viz_faChar).target(this).render():a.labelWidgets[t.data[0]]=(new i.Text).text(t.data[0]).target(this).render()}).merge(s).transition().attr("opacity",1).each(function(t){var e=i.select(this),n={x:t.x,y:t.y};e.select("circle").transition().attr("transform","translate("+n.x+","+n.y+")").style("fill",a.fillColor(t.data,a.columns()[1],t.data[1])).attr("r",t.r).select("title").text(t.data[0]+" ("+t.data[1]+")"),t.__viz_faChar?a.labelWidgets[t.data[0]].pos(n).render():a.labelWidgets[t.data[0]].pos(n).colorFill_default(a.textColor(t.data,a.columns()[1],t.data[1])).width(2*t.r).text(t.data[0]).render()}),s.exit().transition().style("opacity",0).remove()},n.prototype.exit=function(e,i){t.prototype.exit.call(this,e,i)},n.__inputs=[{id:"label",type:"string"},{id:"value",type:"number"}],n}(i.SVGWidget);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 ae=function(t){function e(){return t.call(this)||this}return a(e,t),e.prototype.enter=function(e,i){this.pointSizeColumn_exists()||this.pointSizeColumn(this.columns()[this.columns().length-1]),t.prototype.enter.call(this,e,i)},e}(Ct);ae.prototype._class+=" chart_BubbleXY";var re,se,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=re;e;)(t=pe-e._time)>=0&&e._call.call(null,t),e=e._next;--le}function ve(){pe=(ue=fe.now())+de,le=he=0;try{ge()}finally{le=0,function(){var t,e,i=re,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:re=e);se=t,we(n)}(),pe=0}}function be(){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(ve,t-fe.now()-de)),ce&&(ce=clearInterval(ce))):(ce||(ue=fe.now(),ce=setInterval(be,1e3)),le=1,ye(ve)))}function Se(t){return t.ranges}function ke(t){return t.markers}function Ae(t){return t.measures}function Me(t){var e=t(0);return function(i){return Math.abs(t(i)-e)}}me.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||se===this||(se?se._next=this:re=this,se=this),this._call=t,this._time=i,we()},stop:function(){this._call&&(this._call=null,this._time=1/0,we())}};Mt(".chart_Bullet .domain{opacity:0}.chart_Bullet .bullet{border:1px solid 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}");var Te=function(t){function e(){var e=t.call(this)||this;return e._hiddenColumns={},i.Utility.SimpleSelectionMixin.call(e,!0),e}return a(e,t),e.prototype.bulletData=function(){var t=this;this._hiddenColumns={};var 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){var a=e.indexOf(n);return a>=0?i[a]instanceof Array?i[a]:[i[a]]:(o&&(t._hiddenColumns[o]=!0),[0])}},e.prototype.enter=function(e,n){t.prototype.enter.call(this,e,n),i.select(e.parentNode).style("overflow","auto"),this._selection.widgetElement(n)},e.prototype.update=function(e,n){t.prototype.update.call(this,e,n);var o=this;n.selectAll(".axis").style("display","none"),n.selectAll(".range,.measure,.marker").style("display",null);var a=2,r=8,s=2,l=8,h=this.width()-a-s,c=40-r-l,u=n.selectAll("svg").data(this.bulletData()),p=u.enter().append("svg").attr("class","bullet").call(this._selection.enter.bind(this._selection)).on("click",function(t){o.click(o.rowToObj(t.origRow),o.titleColumn(),o._selection.selected(this))}).on("dblclick",function(t){o.dblclick(o.rowToObj(t.origRow),o.titleColumn(),o._selection.selected(this))}).each(function(){var t=i.select(this).append("g").attr("class",function(t,e){return"bulletBar series series-"+o.cssTag(o.titleColumn())}).append("g").attr("class","bulletTitle");t.append("text").attr("class","title"),t.append("text").attr("class","subtitle").attr("dy","1em")}).merge(u),d=p.select(".bulletTitle").style("text-anchor","end").attr("transform","translate(-6,"+c/2+")");d.select(".title").text(function(t){return t.title}),d.select(".subtitle").text(function(t){return t.subtitle});var f=0;d.each(function(){var t=this.getBBox();t.width>f&&(f=t.width)});var y=function(){var t="left",e=!1,n=!1,o=Se,a=ke,r=Ae,s=380,l=30,h=At();function c(t){t.each(function(t,c){var u,p,d=o.call(this,t,c).slice().sort(i.descending),f=a.call(this,t,c).slice().sort(i.descending),y=r.call(this,t,c).slice().sort(i.descending),_=i.select(this),x=_.select("g.wrap");x.empty()&&(x=_.append("g").attr("class","wrap")),n?(u=l,p=s,x.attr("transform","rotate(90)translate(0,"+-s+")")):(u=s,p=l,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 v=Me(g),b=Me(m),w=x.selectAll("rect.range").data(d);w.enter().append("rect").attr("class",function(t,e){return"range s"+e}).attr("width",v).attr("height",p).attr("x",e?g:0).merge(w).transition(w).attr("x",e?m:0).attr("width",b).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",v).attr("height",p/3).attr("x",e?g:0).attr("y",p/3).merge(S).transition(S).attr("width",b).attr("height",p/3).attr("x",e?m:0).attr("y",p/3);var k=x.selectAll("line.marker").data(f);k.enter().append("line").attr("class","marker").attr("x1",g).attr("x2",g).attr("y1",p/6).attr("y2",5*p/6).merge(k).transition(k).attr("x1",m).attr("x2",m).attr("y1",p/6).attr("y2",5*p/6);var A=_.selectAll("g.axis").data([0]);A.enter().append("g").attr("class","axis"),A.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?(a=t,c):a},c.measures=function(t){return arguments.length?(r=t,c):r},c.width=function(t){return arguments.length?(s=+t,c):s},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(h-f-6).height(c);p.attr("width",h).attr("height",c+r+l).style("margin-left","".concat(a,"px")),p.select(".bulletBar").attr("transform","translate("+(f+6)+","+r+")").call(y),u.exit().remove(),Object.keys(this._hiddenColumns).length>0&&n.selectAll(".".concat(Object.keys(this._hiddenColumns).join(",."))).style("display","none")},e.prototype.exit=function(e,i){t.prototype.exit.call(this,e,i)},e.prototype.click=function(t,e,i){},e.prototype.dblclick=function(t,e,i){},r([i.publish(null,"set","Title Column",function(){return this.columns()},{optional:!0}),s("design:type",Function)],e.prototype,"titleColumn",void 0),r([i.publish(null,"set","Subtitle Column",function(){return this.columns()},{optional:!0}),s("design:type",Function)],e.prototype,"subtitleColumn",void 0),r([i.publish(null,"set","Ranges Column",function(){return this.columns()},{optional:!0}),s("design:type",Function)],e.prototype,"rangesColumn",void 0),r([i.publish(null,"set","Measures Column",function(){return this.columns()},{optional:!0}),s("design:type",Function)],e.prototype,"measuresColumn",void 0),r([i.publish(null,"set","Markers Column",function(){return this.columns()},{optional:!0}),s("design:type",Function)],e.prototype,"markersColumn",void 0),e}(i.HTMLWidget);Te.prototype._class+=" chart_Bullet";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=Fe(t,e[n]))return i;return 0}function Fe(t,e){for(var i=e[0],n=e[1],o=-1,a=0,r=t.length,s=r-1;a<r;s=a++){var l=t[a],h=l[0],c=l[1],u=t[s],p=u[0],d=u[1];if(De(l,u,e))return 0;c>n!=d>n&&i<(p-h)*(n-c)/(d-c)+h&&(o=-o)}return o}function De(t,e,i){var n,o,a,r;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])],a=i[n],r=e[n],o<=a&&a<=r||r<=a&&a<=o)}function Oe(){}var Re=[[],[[[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 je(){var t=1,e=1,n=i.thresholdSturges,o=l;function a(t){var e=n(t);if(Array.isArray(e))e=e.slice().sort(Ce);else{var o=i.extent(t),a=o[0],s=o[1];e=i.tickStep(a,s,e),e=i.range(Math.floor(a/e)*e,Math.floor(s/e)*e,e)}return e.map(function(e){return r(t,e)})}function r(i,n){var a=[],r=[];return function(i,n,o){var a,r,l,h,c,u,p=new Array,d=new Array;a=r=-1,h=i[0]>=n,Re[h<<1].forEach(f);for(;++a<t-1;)l=h,h=i[a+1]>=n,Re[l|h<<1].forEach(f);Re[h|0].forEach(f);for(;++r<e-1;){for(a=-1,h=i[r*t+t]>=n,c=i[r*t]>=n,Re[h<<1|c<<2].forEach(f);++a<t-1;)l=h,h=i[r*t+t+a+1]>=n,u=c,c=i[r*t+a+1]>=n,Re[l|h<<1|c<<2|u<<3].forEach(f);Re[h|c<<3].forEach(f)}a=-1,c=i[r*t]>=n,Re[c<<2].forEach(f);for(;++a<t-1;)u=c,c=i[r*t+a+1]>=n,Re[c<<2|u<<3].forEach(f);function f(t){var e,i,n=[t[0][0]+a,t[0][1]+r],l=[t[1][0]+a,t[1][1]+r],h=s(n),c=s(l);(e=d[h])?(i=p[c])?(delete d[e.end],delete p[i.start],e===i?(e.ring.push(l),o(e.ring)):p[e.start]=d[i.end]={start:e.start,end:i.end,ring:e.ring.concat(i.ring)}):(delete d[e.end],e.ring.push(l),d[e.end=c]=e):(e=p[c])?(i=d[h])?(delete p[e.start],delete d[i.end],e===i?(e.ring.push(l),o(e.ring)):p[i.start]=d[e.end]={start:i.start,end:e.end,ring:i.ring.concat(e.ring)}):(delete p[e.start],e.ring.unshift(n),p[e.start=h]=e):p[h]=d[c]={start:h,end:c,ring:[n,l]}}Re[c<<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?a.push([t]):r.push(t)}),r.forEach(function(t){for(var e,i=0,n=a.length;i<n;++i)if(-1!==Ie((e=a[i])[0],t))return void e.push(t)}),{type:"MultiPolygon",value:n,coordinates:a}}function s(e){return 2*e[0]+e[1]*(t+1)*4}function l(i,n,o){i.forEach(function(i){var a,r=i[0],s=i[1],l=0|r,h=0|s,c=n[h*t+l];r>0&&r<t&&l===r&&(a=n[h*t+l-1],i[0]=r+(o-a)/(c-a)-.5),s>0&&s<e&&h===s&&(a=n[(h-1)*t+l],i[1]=s+(o-a)/(c-a)-.5)})}return 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)?ze(Pe.call(t)):ze(t),a):n},a.smooth=function(t){return arguments.length?(o=t?l:Oe,a):o===l},a}function Ee(t,e,i){for(var n=t.width,o=t.height,a=1+(i<<1),r=0;r<o;++r)for(var s=0,l=0;s<n+i;++s)s<n&&(l+=t.data[s+r*n]),s>=i&&(s>=a&&(l-=t.data[s-a+r*n]),e.data[s-i+r*n]=l/Math.min(s+1,n-1+a-s,a))}function Ne(t,e,i){for(var n=t.width,o=t.height,a=1+(i<<1),r=0;r<n;++r)for(var s=0,l=0;s<o+i;++s)s<o&&(l+=t.data[r+s*n]),s>=i&&(s>=a&&(l-=t.data[r+(s-a)*n]),e.data[r+(s-i)*n]=l/Math.min(s+1,o-1+a-s,a))}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,a=n-o;t.t=e-a+(i-o)}var Ye=2*Math.PI,Xe=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){$e(t.coordinates,e,0)},MultiLineString:function(t,e){for(var i=t.coordinates,n=-1,o=i.length;++n<o;)$e(i[n],e,0)},Polygon:function(t,e){ti(t.coordinates,e)},MultiPolygon:function(t,e){for(var i=t.coordinates,n=-1,o=i.length;++n<o;)ti(i[n],e)},GeometryCollection:function(t,e){for(var i=t.geometries,n=-1,o=i.length;++n<o;)Ze(i[n],e)}};function $e(t,e,i){var n,o=-1,a=t.length-i;for(e.lineStart();++o<a;)n=t[o],e.point(n[0],n[1],n[2]);e.lineEnd()}function ti(t,e){var i=-1,n=t.length;for(e.polygonStart();++i<n;)$e(t[i],e,1);e.polygonEnd()}function ei(t,e){t&&Je.hasOwnProperty(t.type)?Je[t.type](t,e):Ze(t,e)}function ii(t){return t}var ni,oi,ai,ri,si=Ve(),li=Ve(),hi={point:Qe,lineStart:Qe,lineEnd:Qe,polygonStart:function(){hi.lineStart=ci,hi.lineEnd=di},polygonEnd:function(){hi.lineStart=hi.lineEnd=hi.point=Qe,si.add(Xe(li)),li.reset()},result:function(){var t=si/2;return si.reset(),t}};function ci(){hi.point=ui}function ui(t,e){hi.point=pi,ni=ai=t,oi=ri=e}function pi(t,e){li.add(ri*t-ai*e),ai=t,ri=e}function di(){pi(ni,oi)}var fi=1/0,yi=fi,_i=-fi,xi=_i,mi={point:function(t,e){t<fi&&(fi=t);t>_i&&(_i=t);e<yi&&(yi=e);e>xi&&(xi=e)},lineStart:Qe,lineEnd:Qe,polygonStart:Qe,polygonEnd:Qe,result:function(){var t=[[fi,yi],[_i,xi]];return _i=xi=-(yi=fi=1/0),t}};var gi,vi,bi,wi,Si=0,ki=0,Ai=0,Mi=0,Ti=0,Pi=0,Ci=0,zi=0,Ii=0,Fi={point:Di,lineStart:Oi,lineEnd:Ei,polygonStart:function(){Fi.lineStart=Ni,Fi.lineEnd=Li},polygonEnd:function(){Fi.point=Di,Fi.lineStart=Oi,Fi.lineEnd=Ei},result:function(){var t=Ii?[Ci/Ii,zi/Ii]:Pi?[Mi/Pi,Ti/Pi]:Ai?[Si/Ai,ki/Ai]:[NaN,NaN];return Si=ki=Ai=Mi=Ti=Pi=Ci=zi=Ii=0,t}};function Di(t,e){Si+=t,ki+=e,++Ai}function Oi(){Fi.point=Ri}function Ri(t,e){Fi.point=ji,Di(bi=t,wi=e)}function ji(t,e){var i=t-bi,n=e-wi,o=Ue(i*i+n*n);Mi+=o*(bi+t)/2,Ti+=o*(wi+e)/2,Pi+=o,Di(bi=t,wi=e)}function Ei(){Fi.point=Di}function Ni(){Fi.point=Bi}function Li(){Hi(gi,vi)}function Bi(t,e){Fi.point=Hi,Di(gi=bi=t,vi=wi=e)}function Hi(t,e){var i=t-bi,n=e-wi,o=Ue(i*i+n*n);Mi+=o*(bi+t)/2,Ti+=o*(wi+e)/2,Pi+=o,Ci+=(o=wi*t-bi*e)*(bi+t),zi+=o*(wi+e),Ii+=3*o,Di(bi=t,wi=e)}function Vi(t){this._context=t}Vi.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,Ye)}},result:Qe};var qi,Wi,Gi,Yi,Xi,Ui=Ve(),Qi={point:Qe,lineStart:function(){Qi.point=Zi},lineEnd:function(){qi&&Ji(Wi,Gi),Qi.point=Qe},polygonStart:function(){qi=!0},polygonEnd:function(){qi=null},result:function(){var t=+Ui;return Ui.reset(),t}};function Zi(t,e){Qi.point=Ji,Wi=Yi=t,Gi=Xi=e}function Ji(t,e){Yi-=t,Xi-=e,Ui.add(Ue(Yi*Yi+Xi*Xi)),Yi=t,Xi=e}function Ki(){this._string=[]}function $i(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}Ki.prototype={_radius:4.5,_circle:$i(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=$i(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 tn=function(t){function e(){var e=t.call(this)||this;return e.xAxisGuideLines_default(!1).yAxisGuideLines_default(!1).xAxisType_default("linear"),e}return a(e,t),e.prototype.xPos=function(t,e){return"horizontal"===t.orientation()?t.dataPos(e.label):t.valuePos(e.value)},e.prototype.yPos=function(t,e){return"horizontal"===t.orientation()?t.valuePos(e.value):t.dataPos(e.label)},e.prototype.layerEnter=function(e,i,n){void 0===n&&(n=250),t.prototype.layerEnter.call(this,e,i,n)},e.prototype.layerUpdate=function(e,n,o){var a=this;void 0===o&&(o=250),t.prototype.layerUpdate.call(this,e,n,o),this._palette=this._palette.switch(this.paletteID());var r=this.flattenData(this.layerColumns(e),this.layerData(e)),s=function(){var t=Le,e=Be,n=He,o=960,a=500,r=20,s=2,l=3*r,h=o+2*l>>s,c=a+2*l>>s,u=ze(20);function p(o){var a=new Float32Array(h*c),p=new Float32Array(h*c);o.forEach(function(i,o,r){var u=+t(i,o,r)+l>>s,p=+e(i,o,r)+l>>s,d=+n(i,o,r);u>=0&&u<h&&p>=0&&p<c&&(a[u+p*h]+=d)}),Ee({width:h,height:c,data:a},{data:p},r>>s),Ne({width:h,height:c,data:p},{data:a},r>>s),Ee({width:h,height:c,data:a},{data:p},r>>s),Ne({width:h,height:c,data:p},{data:a},r>>s),Ee({width:h,height:c,data:a},{data:p},r>>s),Ne({width:h,height:c,data:p},{data:a},r>>s);var f=u(a);if(!Array.isArray(f)){var y=i.max(a);f=i.tickStep(0,y,f),(f=i.range(0,Math.floor(y/f)*f,f)).shift()}return je().thresholds(f).size([h,c])(a).map(d)}function d(t){return t.value*=Math.pow(2,-2*s),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,s)-l,t[1]=t[1]*Math.pow(2,s)-l}function x(){return h=o+2*(l=3*r)>>s,c=a+2*l>>s,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,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,x()},p.cellSize=function(t){if(!arguments.length)return 1<<s;if(!((t=+t)>=1))throw new Error("invalid cell size");return s=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(r*(r+1));if(!((t=+t)>=0))throw new Error("invalid bandwidth");return r=Math.round((Math.sqrt(4*t*t+1)-1)/2),x()},p}().x(function(t){return a.xPos(e,t)}).y(function(t){return a.yPos(e,t)}).size([this.width(),this.height()]).bandwidth(this.contourBandwidth())(r),l=s.map(function(t){return t.value}),h=Math.min.apply(this,l),c=Math.max.apply(this,l);this._dataMinWeight=h,this._dataMaxWeight=c;var u=n.selectAll("path").data(s);u.enter().append("path").merge(u).attr("d",function(t,e){var i,n,o=4.5;function a(t){return t&&("function"==typeof o&&n.pointRadius(+o.apply(this,arguments)),ei(t,i(n))),n.result()}return a.area=function(t){return ei(t,i(hi)),hi.result()},a.measure=function(t){return ei(t,i(Qi)),Qi.result()},a.bounds=function(t){return ei(t,i(mi)),mi.result()},a.centroid=function(t){return ei(t,i(Fi)),Fi.result()},a.projection=function(e){return arguments.length?(i=null==e?(t=null,ii):(t=e).stream,a):t},a.context=function(t){return arguments.length?(n=null==t?(e=null,new Ki):new Vi(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)}()).attr("fill",function(t){return a.showContourFill()?a._palette(t.value,h,c):"none"}).attr("stroke",this.contourStrokeColor()).attr("stroke-linejoin","round").attr("stroke-width",this.contourStrokeWidth()),u.exit().remove()},e.prototype.exit=function(e,i){t.prototype.exit.call(this,e,i)},e.__inputs=[{id:"x",type:"any"},{id:"y",type:"number"}],e}(Pt);tn.prototype._class+=" chart_Contour",tn.prototype.implements(e.I1DChart.prototype),tn.prototype.publish("paletteID","YlGnBu","string","Color palette for this widget"),tn.prototype.publish("useClonedPalette",!0,"boolean","Enable or disable using a cloned palette"),tn.prototype.publish("showContourFill",!0,"boolean","Show/hide the contour background colors"),tn.prototype.publish("showContour",!0,"boolean","Show/hide the contour border lines"),tn.prototype.publish("contourBandwidth",40,"number","Controls the sensitivity of the contour grouping algorithm"),tn.prototype.publish("contourStrokeColor","#2C3A47","html-color","Color of the contour border lines"),tn.prototype.publish("contourStrokeWidth",1,"number","Width of the contour border lines");var en=function(t){function e(){var e=t.call(this)||this;return e.orientation_default("vertical").xAxisType_default("ordinal").yAxisType_default("time"),e}return a(e,t),e}(Ft);function nn(t){return function(){return t}}en.prototype._class+=" chart_Gantt";var on=1e-12,an=Math.PI,rn=an/2,sn=2*an;function ln(t){return t.innerRadius}function hn(t){return t.outerRadius}function cn(t){return t.startAngle}function un(t){return t.endAngle}function pn(t){return t&&t.padAngle}function dn(t){return t>=1?rn:t<=-1?-rn:Math.asin(t)}function fn(t,e,i,n,o,a,r){var s=t-i,l=e-n,h=(r?a:-a)/Math.sqrt(s*s+l*l),c=h*l,u=-h*s,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,v=m*m+g*g,b=o-a,w=p*y-f*d,S=(g<0?-1:1)*Math.sqrt(Math.max(0,b*b*v-w*w)),k=(w*g-m*S)/v,A=(-w*m-g*S)/v,M=(w*g+m*S)/v,T=(-w*m+g*S)/v,P=k-_,C=A-x,z=M-_,I=T-x;return P*P+C*C>z*z+I*I&&(k=M,A=T),{cx:k,cy:A,x01:-c,y01:-u,x11:k*(o/b-1),y11:A*(o/b-1)}}function yn(t){this._context=t}function _n(t){return new yn(t)}function xn(t){return t[0]}function mn(t){return t[1]}function gn(){}function vn(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 bn(t){this._context=t}function wn(t,e){this._basis=new bn(t),this._beta=e}function Sn(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 kn(t,e){this._context=t,this._k=(1-e)/6}function An(t,e){this._context=t,this._k=(1-e)/6}function Mn(t,e){this._context=t,this._k=(1-e)/6}function Tn(t,e,i){var n=t._x1,o=t._y1,a=t._x2,r=t._y2;if(t._l01_a>on){var s=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*s-t._x0*t._l12_2a+t._x2*t._l01_2a)/l,o=(o*s-t._y0*t._l12_2a+t._y2*t._l01_2a)/l}if(t._l23_a>on){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);a=(a*h+t._x1*t._l23_2a-e*t._l12_2a)/c,r=(r*h+t._y1*t._l23_2a-i*t._l12_2a)/c}t._context.bezierCurveTo(n,o,a,r,t._x2,t._y2)}function Pn(t,e){this._context=t,this._alpha=e}yn.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)}}},bn.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:vn(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:vn(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},wn.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],a=e[0],r=t[i]-o,s=e[i]-a,l=-1;++l<=i;)n=l/i,this._basis.point(this._beta*t[l]+(1-this._beta)*(o+n*r),this._beta*e[l]+(1-this._beta)*(a+n*s));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 bn(t):new wn(t,e)}return i.beta=function(e){return t(+e)},i}(.85),kn.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:Sn(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:Sn(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 kn(t,e)}return i.tension=function(e){return t(+e)},i}(0),An.prototype={areaStart:gn,areaEnd:gn,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:Sn(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 An(t,e)}return i.tension=function(e){return t(+e)},i}(0),Mn.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:Sn(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 Mn(t,e)}return i.tension=function(e){return t(+e)},i}(0),Pn.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:Tn(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 Cn=function t(e){function i(t){return e?new Pn(t,e):new kn(t,0)}return i.alpha=function(e){return t(+e)},i}(.5);function zn(t,e){this._context=t,this._alpha=e}function In(t,e){this._context=t,this._alpha=e}function Fn(t){return t<0?-1:1}function Dn(t,e,i){var n=t._x1-t._x0,o=e-t._x1,a=(t._y1-t._y0)/(n||o<0&&-0),r=(i-t._y1)/(o||n<0&&-0),s=(a*o+r*n)/(n+o);return(Fn(a)+Fn(r))*Math.min(Math.abs(a),Math.abs(r),.5*Math.abs(s))||0}function On(t,e){var i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function Rn(t,e,i){var n=t._x0,o=t._y0,a=t._x1,r=t._y1,s=(a-n)/3;t._context.bezierCurveTo(n+s,o+s*e,a-s,r-s*i,a,r)}function jn(t){this._context=t}zn.prototype={areaStart:gn,areaEnd:gn,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:Tn(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 zn(t,e):new An(t,0)}return i.alpha=function(e){return t(+e)},i}(.5),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._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:Tn(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 In(t,e):new Mn(t,0)}return i.alpha=function(e){return t(+e)},i}(.5),jn.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:Rn(this,this._t0,On(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,Rn(this,On(this,i=Dn(this,t,e)),i);break;default:Rn(this,this._t0,i=Dn(this,t,e))}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=i}}},Object.create(jn.prototype).point=function(t,e){jn.prototype.point.call(this,e,t)};var En="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},Nn=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},Ln=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}}(),Bn=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},Hn=function t(e,i,n){null===e&&(e=Function.prototype);var o=Object.getOwnPropertyDescriptor(e,i);if(void 0===o){var a=Object.getPrototypeOf(e);return null===a?void 0:t(a,i,n)}if("value"in o)return o.value;var r=o.get;return void 0!==r?r.call(n):void 0},Vn=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)},qn=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},Wn=function(){function t(e){var i=e.x,n=void 0===i?0:i,o=e.y,a=void 0===o?0:o,r=e.nx,s=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,v=e.id,b=e.className;Nn(this,t),this._dx=void 0!==r?r-n:u,this._dy=void 0!==s?s-a:h,this._x=n,this._y=a,this._color=d,this.id=v,this._className=b||"",this._type=y||"",this.data=f,this.note=m||{},this.connector=x||{},this.subject=_||{},this.disable=g||[]}return Ln(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}(),Gn=function(){function t(e){var i=e.annotations,n=e.accessors,o=e.accessorsInverse;Nn(this,t),this.accessors=n,this.accessorsInverse=o,this.annotations=i}return Ln(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 Bn({},t.type.getNoteBBoxOffset(),{positionX:t.x,positionY:t.y})})}}]),t}(),Yn=function(t,e){return"dynamic"!==t&&"left"!==t&&"right"!==t||(t=e<0?"top":"bottom"),t},Xn=function(t,e){return"dynamic"!==t&&"top"!==t&&"bottom"!==t||(t=e<0?"right":"left"),t},Un=["topBottom","top","bottom"],Qn=["leftRight","left","right"],Zn=function(t){var e=t.data,i=t.curve,n=void 0===i?_n:i,o=t.canvasContext,a=t.className,r=t.classID,s=function(){var t=xn,e=mn,i=nn(!0),n=null,o=_n,a=null;function r(r){var s,l,h,c=r.length,u=!1;for(null==n&&(a=o(h=_())),s=0;s<=c;++s)!(s<c&&i(l=r[s],s,r))===u&&((u=!u)?a.lineStart():a.lineEnd()),u&&a.point(+t(l,s,r),+e(l,s,r));if(h)return a=null,h+""||null}return r.x=function(e){return arguments.length?(t="function"==typeof e?e:nn(+e),r):t},r.y=function(t){return arguments.length?(e="function"==typeof t?t:nn(+t),r):e},r.defined=function(t){return arguments.length?(i="function"==typeof t?t:nn(!!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}().curve(n),l={type:"path",className:a,classID:r,data:e};return o?(s.context(o),l.pathMethods=s):l.attrs={d:s(e)},l},Jn=function(t){var e=t.data,i=t.canvasContext,n={type:"path",className:t.className,classID:t.classID,data:e},o=function(){var t=ln,e=hn,i=nn(0),n=null,o=cn,a=un,r=pn,s=null;function l(){var l,h,c=+t.apply(this,arguments),u=+e.apply(this,arguments),p=o.apply(this,arguments)-rn,d=a.apply(this,arguments)-rn,f=Math.abs(d-p),y=d>p;if(s||(s=l=_()),u<c&&(h=u,u=c,c=h),u>on)if(f>sn-on)s.moveTo(u*Math.cos(p),u*Math.sin(p)),s.arc(0,0,u,p,d,!y),c>on&&(s.moveTo(c*Math.cos(d),c*Math.sin(d)),s.arc(0,0,c,d,p,y));else{var x,m,g=p,v=d,b=p,w=d,S=f,k=f,A=r.apply(this,arguments)/2,M=A>on&&(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>on){var z=dn(M/c*Math.sin(A)),I=dn(M/u*Math.sin(A));(S-=2*z)>on?(b+=z*=y?1:-1,w-=z):(S=0,b=w=(p+d)/2),(k-=2*I)>on?(g+=I*=y?1:-1,v-=I):(k=0,g=v=(p+d)/2)}var F=u*Math.cos(g),D=u*Math.sin(g),O=c*Math.cos(w),R=c*Math.sin(w);if(T>on){var j=u*Math.cos(v),E=u*Math.sin(v),N=c*Math.cos(b),L=c*Math.sin(b);if(f<an){var B=S>on?function(t,e,i,n,o,a,r,s){var l=i-t,h=n-e,c=r-o,u=s-a,p=(c*(e-a)-u*(t-o))/(u*l-c*h);return[t+p*l,e+p*h]}(F,D,N,L,j,E,O,R):[O,R],H=F-B[0],V=D-B[1],q=j-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),Y=Math.sqrt(B[0]*B[0]+B[1]*B[1]);P=Math.min(T,(c-Y)/(G-1)),C=Math.min(T,(u-Y)/(G+1))}}k>on?C>on?(x=fn(N,L,F,D,u,C,y),m=fn(j,E,O,R,u,C,y),s.moveTo(x.cx+x.x01,x.cy+x.y01),C<T?s.arc(x.cx,x.cy,C,Math.atan2(x.y01,x.x01),Math.atan2(m.y01,m.x01),!y):(s.arc(x.cx,x.cy,C,Math.atan2(x.y01,x.x01),Math.atan2(x.y11,x.x11),!y),s.arc(0,0,u,Math.atan2(x.cy+x.y11,x.cx+x.x11),Math.atan2(m.cy+m.y11,m.cx+m.x11),!y),s.arc(m.cx,m.cy,C,Math.atan2(m.y11,m.x11),Math.atan2(m.y01,m.x01),!y))):(s.moveTo(F,D),s.arc(0,0,u,g,v,!y)):s.moveTo(F,D),c>on&&S>on?P>on?(x=fn(O,R,j,E,c,-P,y),m=fn(F,D,N,L,c,-P,y),s.lineTo(x.cx+x.x01,x.cy+x.y01),P<T?s.arc(x.cx,x.cy,P,Math.atan2(x.y01,x.x01),Math.atan2(m.y01,m.x01),!y):(s.arc(x.cx,x.cy,P,Math.atan2(x.y01,x.x01),Math.atan2(x.y11,x.x11),!y),s.arc(0,0,c,Math.atan2(x.cy+x.y11,x.cx+x.x11),Math.atan2(m.cy+m.y11,m.cx+m.x11),y),s.arc(m.cx,m.cy,P,Math.atan2(m.y11,m.x11),Math.atan2(m.y01,m.x01),!y))):s.arc(0,0,c,w,b,y):s.lineTo(O,R)}else s.moveTo(0,0);if(s.closePath(),l)return s=null,l+""||null}return l.centroid=function(){var i=(+t.apply(this,arguments)+ +e.apply(this,arguments))/2,n=(+o.apply(this,arguments)+ +a.apply(this,arguments))/2-an/2;return[Math.cos(n)*i,Math.sin(n)*i]},l.innerRadius=function(e){return arguments.length?(t="function"==typeof e?e:nn(+e),l):t},l.outerRadius=function(t){return arguments.length?(e="function"==typeof t?t:nn(+t),l):e},l.cornerRadius=function(t){return arguments.length?(i="function"==typeof t?t:nn(+t),l):i},l.padRadius=function(t){return arguments.length?(n=null==t?null:"function"==typeof t?t:nn(+t),l):n},l.startAngle=function(t){return arguments.length?(o="function"==typeof t?t:nn(+t),l):o},l.endAngle=function(t){return arguments.length?(a="function"==typeof t?t:nn(+t),l):a},l.padAngle=function(t){return arguments.length?(r="function"==typeof t?t:nn(+t),l):r},l.context=function(t){return arguments.length?(s=null==t?null:t,l):s},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},Kn=function(t){var e=t.type,i=t.subjectType,n=e.annotation,o=n.position,a=n.x-o.x,r=a+n.dx,s=n.y-o.y,l=s+n.dy,h=n.subject;if("circle"===i&&(h.outerRadius||h.radius)){var c=Math.sqrt((a-r)*(a-r)+(s-l)*(s-l)),u=Math.asin(-l/c),p=h.outerRadius||h.radius+(h.radiusPadding||0);a=Math.abs(Math.cos(u)*p)*(r<0?-1:1),s=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)&&(a=Math.abs(d)>Math.abs(n.dx)?d/2:d),(f>0&&n.dy>0||f<0&&n.dy<0)&&(s=Math.abs(f)>Math.abs(n.dy)?f/2:f),a===d/2&&s===f/2&&(a=r,s=l)}return[[a,s],[r,l]]},$n=function(t){var e=t.type,n=t.connectorData,o=t.subjectType;n||(n={}),n.points&&"number"!=typeof n.points||(n.points=to(e.annotation.offset,n.points)),n.curve||(n.curve=Cn);var a=[];if(e.editMode){var r=n.points.map(function(t,e){return Bn({},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})}),s=function(t){n.points[t][0]+=i.event.dx,n.points[t][1]+=i.event.dy,e.redrawConnector()};a=e.mapHandles(r.map(function(t){return Bn({},t.move,{drag:s.bind(e,t.index)})}))}var l=Kn({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:[Zn({data:l,curve:n.curve,className:"connector"})],handles:a}},to=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=[],a=1;a<=e;a++)o.push([i*a+a%2*20,n*a-a%2*20]);return o},eo=function(t){var e=t.subjectData,n=t.type;e.radius||e.outerRadius||(e.radius=20);var o=[],a=Jn({data:e,className:"subject"});if(n.editMode){var r=function(t){var e=t.cx,i=void 0===e?0:e,n=t.cy,o=void 0===n?0:n,a=t.r1,r=t.r2,s=t.padding,l={move:{x:i,y:o}};return void 0!==a&&(l.r1={x:i+a/Math.sqrt(2),y:o+a/Math.sqrt(2)}),void 0!==r&&(l.r2={x:i+r/Math.sqrt(2),y:o+r/Math.sqrt(2)}),void 0!==s&&(l.padding={x:i+a+s,y:o}),l}({r1:a.data.outerRadius||a.data.radius,r2:a.data.innerRadius,padding:e.radiusPadding}),s=function(t){var o=e[t]+i.event.dx*Math.sqrt(2);e[t]=o,n.redrawSubject(),n.redrawConnector()},l=[Bn({},r.r1,{drag:s.bind(n,void 0!==e.outerRadius?"outerRadius":"radius")})];e.innerRadius&&l.push(Bn({},r.r2,{drag:s.bind(n,"innerRadius")})),o=n.mapHandles(l)}return a.attrs["fill-opacity"]=0,{components:[a],handles:o}},io=function(){function t(e){var i=e.a,n=e.annotation,o=e.editMode,a=e.dispatcher,r=e.notePadding,s=e.accessors;if(Nn(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=a,a){var l=ho.bind(null,a,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!==r?r:3,this.offsetCornerX=0,this.offsetCornerY=0,s&&n.data&&this.init(s)}return Ln(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,a=e.className,r=e.attrs,s=e.handles,l=e.classID;if("handle"===o)!function(t){var e=t.group,n=t.handles,o=t.r,a=void 0===o?10:o,r=e.selectAll("circle.handle").data(n);r.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||a}).attr("class",function(t){return"handle "+(t.className||"")}),r.exit().remove()}({group:t,r:r&&r.r,handles:s});else{lo(t,[n.annotation],o,a,l);for(var h=t.select(o+"."+(l||a)),c=Object.keys(r),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(r[t]):h.attr(t,r[t])}),u.forEach(function(t){return h.attr(t,null)})}})}},{key:"getNoteBBox",value:function(){return uo(this.note,".annotation-note-content text")}},{key:"getNoteBBoxOffset",value:function(){var t=uo(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,a={type:this,subjectData:n},r={};"circle"===o?r=eo(a):"rect"===o?r=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,s=Zn({data:[[0,0],[a,0],[a,r],[0,r],[0,0]],className:"subject"});if(n.editMode){var l=[{x:a,y:r/2,drag:function(){e.width=i.event.x,n.redrawSubject(),n.redrawConnector()}.bind(n)},{x:a/2,y:r,drag:function(){e.height=i.event.y,n.redrawSubject(),n.redrawConnector()}.bind(n)}];o=n.mapHandles(l)}return s.attrs["fill-opacity"]=.1,{components:[s],handles:o}}(a):"threshold"===o?r=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,a=(void 0!==e.y1?e.y1:i.y)-i.y,r=(void 0!==e.y2?e.y2:i.y)-i.y;return{components:[Zn({data:[[n,a],[o,r]],className:"subject"})]}}(a):"badge"===o&&(r=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]:{},s=a.typeSettings&&a.typeSettings.subject;n.radius||(s&&s.radius?n.radius=s.radius:n.radius=14),n.x||s&&s.x&&(n.x=s.x),n.y||s&&s.y&&(n.y=s.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=Jn({className:"subject",data:{radius:c}});x.attrs.transform=_,x.attrs.fill=r.color,x.attrs["stroke-linecap"]="round",x.attrs["stroke-width"]="3px";var m=Jn({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=Zn({className:"subject-pointer",data:[[0,0],[p||0,0],[0,d||0],[0,0]]});else if(p||d){var v=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=Zn({className:"subject-pointer",data:[[0,0],[v(p),v(d)],[v(p,-1),v(d,-1)],[0,0]]})}if(g&&(g.attrs.fill=r.color,g.attrs["stroke-linecap"]="round",g.attrs["stroke-width"]="3px",h.push(g)),a.editMode){var b={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,a.redrawSubject()}.bind(a)};b.x||b.y||(b.y=-c),l=a.mapHandles([b])}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}}(a,this.annotation));var s=r,l=s.components,h=void 0===l?[]:l,c=s.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 a={};a="curve"===n?$n(o):"elbow"===n?function(t){var e=t.type,i=t.subjectType,n=e.annotation,o=n.position,a=n.x-o.x,r=a+n.dx,s=n.y-o.y,l=s+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)&&(a=Math.abs(c)>Math.abs(n.dx)?c/2:c),(u>0&&n.dy>0||u<0&&n.dy<0)&&(s=Math.abs(u)>Math.abs(n.dy)?u/2:u),a===c/2&&s===u/2&&(a=r,s=l)}var p=[[a,s],[r,l]],d=l-s,f=r-a,y=r,_=l,x=l<s&&r>a||r<a&&l>s?-1:1;if(Math.abs(f)<Math.abs(d)?(y=r,_=s+f*x):(_=l,y=a+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=[[a=g*(r<0?-1:1),s=g*(l<0?-1:1)],[y,_],[r,l]];else if(Math.abs(f)>Math.abs(d)){var v=Math.asin(-l/m);p=[[a=Math.abs(Math.cos(v)*m)*(r<0?-1:1),l],[r,l]]}else{var b=Math.acos(r/m);p=[[r,s=Math.abs(Math.sin(b)*m)*(l<0?-1:1)],[r,l]]}}else p=[[a,s],[y,_],[r,l]];return{components:[Zn({data:p,className:"connector"})]}}(o):function(t){var e=Kn(t);return{components:[Zn({data:e,className:"connector"})]}}(o);var r=a,s=r.components,l=void 0===s?[]:s,h=r.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,a=void 0===o?1:o,r=e.position;i=i?[-n[0]+i[0],-n[1]+i[1]]:[e.dx,e.dy],n||(n=[e.x-r.x,e.y-r.y]);var s=n[0],l=n[1],h=i[0],c=i[1],u=10*a,p=16/180*Math.PI,d=Math.atan(c/h);h<0&&(d+=Math.PI);var f=[[s,l],[Math.cos(d+p)*u+s,Math.sin(d+p)*u+l],[Math.cos(d-p)*u+s,Math.sin(d-p)*u+l],[s,l]];return{components:[Zn({data:f,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=Jn({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",a={bbox:e.bbox,align:o,offset:this.annotation.offset},r=n.lineType||e.lineType,s={};"vertical"===r?s=function(t){var e=t.align,i=t.x,n=void 0===i?0:i,o=t.y,a=void 0===o?0:o,r=t.bbox,s=t.offset;"top"===(e=Yn(e,s.y))?a-=r.height:"middle"===e&&(a-=r.height/2);var l=[[n,a],[n,a+r.height]];return{components:[Zn({data:l,className:"note-line"})]}}(a):"horizontal"===r&&(s=function(t){var e=t.align,i=t.x,n=void 0===i?0:i,o=t.y,a=void 0===o?0:o,r=t.offset,s=t.bbox;"right"===(e=Xn(e,r.x))?n-=s.width:"middle"===e&&(n-=s.width/2);var l=[[n,a],[n+s.width,a]];return{components:[Zn({data:l,className:"note-line"})]}}(a));var l=s,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}},{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,a=e.align||t.align||"dynamic";"vertical"===o?n="leftRight":"horizontal"===o&&(n="topBottom");var r=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,a=t.align,r=t.orientation,s=t.offset,l=void 0===s?{x:0,y:0}:s,h=-o.x,c=0;return-1!==Un.indexOf(r)?(a=Xn(a,l.x),l.y<0&&"topBottom"===r||"top"===r?c-=o.height+i:c+=i,"middle"===a?h-=o.width/2:"right"===a&&(h-=o.width)):-1!==Qn.indexOf(r)&&(a=Yn(a,l.y),l.x<0&&"leftRight"===r||"left"===r?h-=o.width+i:h+=i,"middle"===a?c-=o.height/2:"top"===a&&(c-=o.height)),{x:h,y:c}}({padding:i,bbox:t.bbox,offset:this.annotation.offset,orientation:n,align:a}),s=r.x,l=r.y;return this.offsetCornerX=s+this.annotation.dx,this.offsetCornerY=l+this.annotation.dy,this.note&&this.noteContent.attr("transform","translate("+s+", "+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 Bn({},t,{start:e.dragstarted.bind(e),end:e.dragended.bind(e)})})}}]),t}(),no=function(t,e,i){return function(t){function n(t){Nn(this,n);var i=qn(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 Vn(n,t),Ln(n,[{key:"className",value:function(){return""+(e.className||Hn(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"className",this)&&Hn(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"className",this).call(this)||"")}},{key:"drawSubject",value:function(t){return this.typeSettings.subject=Bn({},e.subject,this.typeSettings.subject),Hn(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"drawSubject",this).call(this,Bn({},t,this.typeSettings.subject))}},{key:"drawConnector",value:function(t){return this.typeSettings.connector=Bn({},e.connector,this.typeSettings.connector),Hn(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"drawConnector",this).call(this,Bn({},t,e.connector,this.typeSettings.connector))}},{key:"drawNote",value:function(t){return this.typeSettings.note=Bn({},e.note,this.typeSettings.note),Hn(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"drawNote",this).call(this,Bn({},t,e.note,this.typeSettings.note))}},{key:"drawNoteContent",value:function(t){return Hn(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"drawNoteContent",this).call(this,Bn({},t,e.note,this.typeSettings.note))}}],[{key:"init",value:function(t,e){return Hn(n.__proto__||Object.getPrototypeOf(n),"init",this).call(this,t,e),i&&(t=i(t,e)),t}}]),n}(t)},oo=function(t){function e(t){Nn(this,e);var i=qn(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return i.textWrap=t.textWrap||120,i.drawText(),i}return Vn(e,t),Ln(e,[{key:"updateTextWrap",value:function(t){this.textWrap=t,this.drawText()}},{key:"drawText",value:function(){if(this.note){lo(this.note,[this.annotation],"g","annotation-note-content");var t=this.note.select("g.annotation-note-content");lo(t,[this.annotation],"rect","annotation-note-bg"),lo(t,[this.annotation],"text","annotation-note-label"),lo(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,a=this.annotation.note&&this.annotation.note.bgPadding||this.typeSettings&&this.typeSettings.note&&this.typeSettings.note.bgPadding,r={top:0,bottom:0,left:0,right:0};if("number"==typeof a?r={top:a,bottom:a,left:a,right:a}:a&&"object"===(void 0===a?"undefined":En(a))&&(r=Bn(r,a)),this.annotation.note.title){var s=this.a.select("text.annotation-note-title");s.text(this.annotation.note.title),s.attr("fill",this.annotation.color),s.attr("font-weight","bold"),s.call(co,n,o),e=s.node().getBBox()}i.text(this.annotation.note.label).attr("dx","0"),i.call(co,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+r.left+r.right).attr("height",l.height+r.top+r.bottom).attr("x",l.x-r.left).attr("y",-r.top).attr("fill","white").attr("fill-opacity",0)}}}]),e}(io);no(oo,{className:"label",note:{align:"middle"}});var ao=no(oo,{className:"callout",note:{lineType:"horizontal"}}),ro=no(ao,{className:"callout elbow",connector:{type:"elbow"}});no(ao,{className:"callout curve",connector:{type:"curve"}}),no(io,{className:"badge",subject:{type:"badge"},disable:["connector","note"]}),no(oo,{className:"callout circle",subject:{type:"circle"},note:{lineType:"horizontal"},connector:{type:"elbow"}}),no(oo,{className:"callout rect",subject:{type:"rect"},note:{lineType:"horizontal"},connector:{type:"elbow"}});var so=function(t){function e(){return Nn(this,e),qn(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return Vn(e,t),Ln(e,[{key:"mapY",value:function(t){Hn(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){Hn(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}(ao);no(so,{className:"callout xythreshold",subject:{type:"threshold"}});var lo=function(t,e,i,n,o){var a=t.selectAll(i+"."+(o||n)).data(e);return a.enter().append(i).merge(a).attr("class",n),a.exit().remove(),t},ho=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)})},co=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),a=t.text().split(n||/[ \t\r\n]+/).reverse().filter(function(t){return""!==t}),r=void 0,s=[],l=t.text(null).append("tspan").attr("x",0).attr("dy","0.8em");r=a.pop();)s.push(r),l.text(s.join(" ")),l.node().getComputedTextLength()>e&&s.length>1&&(s.pop(),l.text(s.join(" ")),s=[r],l=t.append("tspan").attr("x",0).attr("dy",o+"em").text(r))})},uo=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 po(t){return.65*(t-.5)*2*Math.PI}function fo(t,e){return{x:Math.cos(t-Math.PI/2)*e,y:Math.sin(t-Math.PI/2)*e}}function yo(t,e,n){return void 0===n&&(n=!1),function(o){var a=i.interpolate(o.angle,t);return o.angle=t,function(t){return function(t,e,i){void 0===i&&(i=!1);var n=fo(t,e),o=180*t/Math.PI+(!0===i?180:0);return"translate(".concat(n.x,", ").concat(n.y,") rotate(").concat(o,")")}(a(t),e,n)}}}function _o(t,e,n){return function(o){var a=i.interpolate(o.startAngle,t),r=i.interpolate(o.endAngle,e);return function(t){return o.startAngle=a(t),o.endAngle=r(t),n(o)}}}var xo=function(t){function e(){var e=t.call(this)||this;return e._d3Arc=j().innerRadius(85).outerRadius(100),e._colorScale=i.scaleLinear().interpolate(i.interpolateHcl),e}return a(e,t),e.prototype.tip=function(t){var e=this;if(null===t||""===t.label)this._tooltipG.transition().style("opacity",0).on("interrupt end",function(){e._tooltipG.selectAll("g").remove()});else{this._tooltipG.interrupt().style("opacity",1),t.w=this._centerText.datum().w+10;var n="horizontal",o=0,a=5,r=5;t.y>=5&&t.y<=25?(o=t.x<0?-t.w/2:t.w/2,a=12.5,r=void 0,n="vertical"):t.y>25&&(a=25,r=0);var s=function(){var t=[],e=void 0,n=void 0,o=[],a={},r={},s=!1,l=void 0,h=ao,c=void 0,u=void 0,p=i.dispatch("subjectover","subjectout","subjectclick","connectorover","connectorout","connectorclick","noteover","noteout","noteclick","dragend","dragstart"),d=void 0,f=function(n){d=n,s||n.selectAll("circle.handle").remove();var f=t.map(function(t){return t.type||(t.type=h),t.disable||(t.disable=o),new Wn(t)});e=e||new Gn({annotations:f,accessors:a,accessorsInverse:r,ids:l}),n.selectAll("g").data([e]).enter().append("g").attr("class","annotations");var y=n.select("g.annotations");lo(y,e.annotations,"g","annotation"),y.selectAll("g.annotation").each(function(t){var e=i.select(this);e.attr("class","annotation"),lo(e,[t],"g","annotation-connector"),lo(e,[t],"g","annotation-subject"),lo(e,[t],"g","annotation-note"),lo(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:c,notePadding:u,editMode:s,dispatcher:p,accessors:a}),t.type.draw(),t.type.drawText&&t.type.drawText()})};return f.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}))),f},f.update=function(){return t&&e&&(t=e.annotations.map(function(t){return t.type.draw(),t})),f},f.updateText=function(){return e&&(e.updateText(c),t=e.annotations),f},f.updatedAccessors=function(){return e.setPositionWithAccessors(),t=e.annotations,f},f.disable=function(i){return arguments.length?(o=i,e&&(e.updateDisable(o),t=e.annotations),f):o},f.textWrap=function(i){return arguments.length?(c=i,e&&(e.updateTextWrap(c),t=e.annotations),f):c},f.notePadding=function(i){return arguments.length?(u=i,e&&(e.updateNotePadding(u),t=e.annotations),f):u},f.type=function(i,n){return arguments.length?(h=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=h,t.subject=n&&n.subject||t.subject,t.connector=n&&n.connector||t.connector,t.note=n&&n.note||t.note}),t=e.annotations),f):h},f.annotations=function(i){return arguments.length?(t=i,e&&e.annotations&&(t.some(function(t){return!t.type||"[object Object]"!==t.type.toString()})?(e=null,f(d)):e.annotations=t),f):e&&e.annotations||t},f.context=function(t){return arguments.length?(n=t,f):n},f.accessors=function(t){return arguments.length?(a=t,f):a},f.accessorsInverse=function(t){return arguments.length?(r=t,f):r},f.ids=function(t){return arguments.length?(l=t,f):l},f.editMode=function(i){return arguments.length?(s=i,d&&d.selectAll("g.annotation").classed("editable",s),e&&(e.editMode(s),t=e.annotations),f):s},f.collection=function(t){return arguments.length?(e=t,f):e},f.on=function(){var t=p.on.apply(p,arguments);return t===p?f:t},f}().type(ro).annotations([{data:t,dx:-t.x+o,dy:-t.y+a,color:"black",note:{label:t.label,lineType:n,padding:r,align:"middle"}}]).accessors({x:function(t){return t.x},y:function(t){return t.y}});this._tooltipG.call(s)}},e.prototype.calcSize=function(t,e,i){var n=t.node().getBBox(),o=e/n.width,a=i/n.height,r=o<a?o:a;return{width:n.width,height:n.height,scale:r}},e.prototype.updateText=function(t,e,i,n,o){t.datum({x:e,y:i,w:n,h:o}).attr("transform",null);var a=this.calcSize(t,n,o),r=e+n/2-a.width/2*a.scale,s=i+o/2-a.height/2*a.scale;t.attr("transform","translate(".concat(r,", ").concat(s,") scale(").concat(a.scale,")"))},e.prototype.calcWidth=function(){return Math.min(this.width(),this.height(),this.maxDiameter())},e.prototype.enter=function(e,i){var n=this;t.prototype.enter.call(this,e,i),i.on("click",function(t){n.click(t)}),this._usageArc=i.append("path").datum({startAngle:po(0),endAngle:po(0)}).style("fill","green").on("mousemove",function(t){var e=h(n._d3Arc.centroid(t),2),i=e[0],o=e[1];n.tip({x:i,y:o,label:n.valueDescription()})}).on("mouseout",function(t){n.tip(null)}),this._freeArc=i.append("path").datum({startAngle:po(0),endAngle:po(1)}).style("fill","lightGrey"),this._meanArc=i.append("path").datum({startAngle:po(0),endAngle:po(0)}).style("fill","black").on("mousemove",function(t){var e=h(n._d3Arc.centroid(t),2),i=e[0],o=e[1];n.tip({x:i,y:o,label:n.tickValueDescription()})}).on("mouseout",function(t){n.tip(null)}),this._mainTooltip=i.append("title");var o=this;function a(){return i.append("path").datum({angle:po(0)}).style("fill","black").style("stroke","black").attr("d","M 0 0 l -3 -3 l 6 0 z").on("mousemove",function(t){var e=h(o._d3Arc.centroid(o._meanArc.datum()),2),i=e[0],n=e[1];o.tip({x:i,y:n,label:o.tickValueDescription()})}).on("mouseout",function(t){o.tip(null)})}this._indInner=a(),this._indOuter=a(),this._centerText=i.append("text").attr("dy",".66em").style("fill","green").on("mousemove",function(t){n.tip({x:0,y:0,label:n.valueDescription()})}).on("mouseout",function(t){n.tip(null)}),this._bottomText=i.append("text").attr("dy",".66em").on("mousemove",function(t){n.tip({x:0,y:t.y,label:n.titleDescription()})}).on("mouseout",function(t){n.tip(null)}),this._tooltipG=i.append("g").attr("class","annotation-tip")},e.prototype.update=function(n,o){t.prototype.update.call(this,n,o),this._colorScale.domain(this.colorDomain()).range(this.colorRange()),o.attr("title",this.tooltip()).style("cursor",this.click!==e.prototype.click?"pointer":null);var a=this.calcWidth()/3,r=this.calcWidth()/2-5;this._d3Arc.innerRadius(a).outerRadius(r);var s=this.value(),l=this.tickValue();this._usageArc.style("fill",this._colorScale(s)).transition().duration(750).attrTween("d",_o(po(0),po(s),this._d3Arc)),this._freeArc.style("fill",this.emptyColor()).transition().duration(750).attrTween("d",_o(po(s),po(1),this._d3Arc)),this._meanArc.style("fill",this.tickColor()).style("visibility",this.showTick()?"visible":"hidden").transition().duration(750).attrTween("d",_o(po(l-.001),po(l+.001),this._d3Arc)),this._indInner.style("fill",this.tickColor()).style("stroke",this.tickColor()).style("visibility",this.showTick()?"visible":"hidden").transition().duration(750).attrTween("transform",yo(po(l),a,!0)),this._indOuter.style("fill",this.tickColor()).style("stroke",this.tickColor()).style("visibility",this.showTick()?"visible":"hidden").transition().duration(750).attrTween("transform",yo(po(l),r)),this._centerText.style("fill",this._colorScale(s)).text(i.format(".0%")(s)),this._bottomText.style("fill",this.click!==e.prototype.click?"blue":"black").style("text-decoration",this.click!==e.prototype.click?"underline":null).text(this.title());var h=fo(po(1),a-8);this.updateText(this._centerText,-h.x,-h.y,2*h.x,2*h.y);var c=fo(po(1),r);c.y+=5;var u=this.calcWidth()-20,p=this.calcWidth()/2-c.y-5;this.updateText(this._bottomText,-u/2,c.y,u,p),this._mainTooltip.text(this.tooltip())},e.prototype.click=function(t){},r([i.publish("","string"),s("design:type",Function)],e.prototype,"title",void 0),r([i.publish("","string"),s("design:type",Function)],e.prototype,"titleDescription",void 0),r([i.publish(128,"number"),s("design:type",Function)],e.prototype,"maxDiameter",void 0),r([i.publish(0,"number"),s("design:type",Function)],e.prototype,"value",void 0),r([i.publish("","string"),s("design:type",Function)],e.prototype,"valueDescription",void 0),r([i.publish(!1,"boolean"),s("design:type",Function)],e.prototype,"showTick",void 0),r([i.publish(0,"number"),s("design:type",Function)],e.prototype,"tickValue",void 0),r([i.publish("","string"),s("design:type",Function)],e.prototype,"tickValueDescription",void 0),r([i.publish("","string"),s("design:type",Function)],e.prototype,"tooltip",void 0),e}(i.SVGWidget);xo.prototype._class+=" chart_Gauge",xo.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."),xo.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."),xo.prototype.publish("emptyColor","lightgrey","html-color","Color of the empty portion of the gauge"),xo.prototype.publish("tickColor","black","html-color","Color of the tick");Mt(".chart_Pie path,.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{stroke:#000;stroke-width:2px;fill:none;opacity:.3}");var mo=function(t,e){return t[1]-e[1]>0?1:-1},go=function(t,e){return t[1]-e[1]>0?-1:1},vo=function(t){function o(){var n=t.call(this)||this;return n._minLabelTop=0,n._maxLabelBottom=0,e.I2DChart.call(n),e.ITooltip.call(n),i.Utility.SimpleSelectionMixin.call(n),n.d3Pie=function(){var t=q,e=V,i=null,n=x(0),o=x(P),a=x(0);function r(r){var s,l,h,c,u,p=r.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,a.apply(this,arguments)),g=m*(x<0?-1:1);for(s=0;s<p;++s)(u=y[f[s]=s]=+t(r[s],s,r))>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(r[t],r[e])}),s=0,h=d?(x-p*g)/d:0;s<p;++s,_=c)l=f[s],c=_+((u=y[l])>0?u*h:0)+g,y[l]={data:r[l],index:s,value:u,startAngle:_,endAngle:c,padAngle:m};return y}return r.value=function(e){return arguments.length?(t="function"==typeof e?e:x(+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:x(+t),r):n},r.endAngle=function(t){return arguments.length?(o="function"==typeof t?t:x(+t),r):o},r.padAngle=function(t){return arguments.length?(a="function"==typeof t?t:x(+t),r):a},r}(),n.d3Arc=j(),n.d3LabelArc=j(),n.tooltipTick_default(!1).tooltipOffset_default(0),n}return a(o,t),o.prototype.intersection=function(t,e){return this.intersectCircle(this.calcOuterRadius(),t,e)},o.prototype.calcInnerRadius=function(){return this.innerRadius_exists()?this.calcOuterRadius()*this.innerRadius()/100:0},o.prototype.calcOuterRadius=function(){var t=this,e=this.textSize(this.data().map(function(e){return t.getLabelText({data:e},!1)}),"Verdana",12).width,i=this._size.width-(this.showLabels()?2*e:0)-20,n=this._size.height-36-(this.showLabels()?this._smallValueLabelHeight:0),o=Math.min(i,n)/2-2;return i/2-2<this.minOuterRadius()?this._labelWidthLimit=e-(this.minOuterRadius()-(i/2-2)):this._labelWidthLimit=e,o<this.minOuterRadius()?this.minOuterRadius():o},o.prototype.calcSmallValueLabelHeight=function(){var t=this.data().reduce(function(t,e){return t+e[1]},0),e=0;return this.data().forEach(function(i){i[1]/t<.1&&e++}),this.labelHeight()*e},o.prototype.calcTotalValue=function(){return this.data().reduce(function(t,e){return t+e[1]},0)},o.prototype.getLabelText=function(t,e){var i,n=t.data[0];if(void 0!==this._labelWidthLimit&&e){var o=this.textSize(n,"Verdana",this.labelHeight()).width;this._labelWidthLimit<o&&(n=(i=n.length*(this._labelWidthLimit/o)-3)<n.length?n.slice(0,i)+"...":n)}if(this.showSeriesValue()&&(n+=" : ".concat(this._seriesValueFormatter(t.data[1]))),this.showSeriesPercentage()){var a=this._totalValue,r=this.dataMeta();void 0!==r.sum&&(a=r.sum);var s=t.data[1]/a*100;n+=" : ".concat(this._seriesPercentageFormatter(s),"%")}return n},o.prototype.selection=function(t){var e;if(!arguments.length)try{return null===(e=this._selection.selection2()[0])||void 0===e?void 0:e.data}catch(t){return}var i=JSON.stringify(t);this._selection.selection2(function(t){return i===JSON.stringify(t.data)})},o.prototype.selectByLabel=function(t){var e=this.data().filter(function(e){return e[0]===t})[0];e&&this.selection(e)},o.prototype.enter=function(e,i){t.prototype.enter.call(this,e,i),this._selection.widgetElement(i),this._slices=i.append("g"),this._labels=i.append("g");var n=this;this.tooltipHTML(function(t){return"series-table"===n.tooltipStyle()?n.tooltipFormat({label:t.data[0],arr:n.columns().slice(1).map(function(e,i){return{label:e,color:n._palette(t.data[0]),value:t.data[i+1]}})}):n.tooltipFormat({label:t.data[0],value:t.data[1]})})},o.prototype.update=function(e,n){var o=this;t.prototype.update.call(this,e,n);var a=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();var r=this.calcInnerRadius(),s=this.calcOuterRadius(),l=s+12;this.d3Arc.innerRadius(r).padRadius(s).outerRadius(s),this._quadIdxArr=[[],[],[],[]];var u=c([],h(this.data()),!1);switch(this.sortDataByValue()){case"ascending":u.sort(mo);break;case"descending":u.sort(go)}var p=this._slices.selectAll(".arc").data(this.d3Pie(u),function(t){return t.data[0]});this._labelPositions=[],p.enter().append("g").attr("class",function(t,e){return"arc series series-"+o.cssTag(t.data[0])}).attr("opacity",0).call(this._selection.enter.bind(this._selection)).on("click",function(t){a.click(a.rowToObj(t.data),a.columns()[1],a._selection.selected(this))}).on("dblclick",function(t){a.dblclick(a.rowToObj(t.data),a.columns()[1],a._selection.selected(this))}).each(function(t,e){i.select(this).append("path").on("mouseout.tooltip",a.tooltip.hide).on("mousemove.tooltip",a.tooltip.show).on("mouseover",x(0,0)).on("mouseout",x(-5,150))}).merge(p).transition().attr("opacity",1).each(function(t,e){var n=a.getQuadrant(_(t));a._quadIdxArr[n].push(e),t.outerRadius=s-5,i.select(this).select("path").transition().attr("d",a.d3Arc).style("fill",a.fillColor(t.data,a.columns()[1],t.data[1]))}),p.exit().transition().style("opacity",0).remove(),this.d3LabelArc.innerRadius(l).outerRadius(l);var d=this._labels.selectAll("text").data(this.showLabels()?this.d3Pie(u):[],function(t){return t.data[0]}),f=d.enter().append("text").on("mouseout.tooltip",a.tooltip.hide).on("mousemove.tooltip",a.tooltip.show).attr("dy",".5em").on("click",function(t){a._slices.selectAll("g").filter(function(e){t.data===e.data&&(a._selection.click(this),a.click(a.rowToObj(t.data),a.columns()[1],a._selection.selected(this)))})}).on("dblclick",function(t){a._slices.selectAll("g").filter(function(e){t.data===e.data&&a.dblclick(a.rowToObj(t.data),a.columns()[1],a._selection.selected(this))})}).merge(d).text(function(t){return o.getLabelText(t,!0)}).each(function(t,e){var i=a.d3LabelArc.centroid(t),n=_(t);i[0]=l*(a.isLeftSide(n)?1:-1),a._labelPositions.push({top:i[1],bottom:i[1]+a.labelHeight()})});this.showLabels()&&(this.adjustForOverlap(),f.transition().style("font-size",this.labelHeight()+"px").attr("transform",function(t,e){var i=a.d3LabelArc.centroid(t);return i[0]=l*(a.isLeftSide(_(t))?1:-1),i[1]=a._labelPositions[e].top,"translate("+i+")"}).style("text-anchor",function(t){return o.isLeftSide(_(t))?"start":"end"})),d.exit().remove();var y=this._labels.selectAll("polyline").data(this.showLabels()?this.d3Pie(u):[],function(t){return o.getLabelText(t,!0)});function _(t){return t.startAngle+(t.endAngle-t.startAngle)/2}function x(t,e){return function(){i.select(this).transition().delay(e).attrTween("d",function(e){var n=i.interpolate(e.outerRadius,s+t);return function(t){return e.outerRadius=n(t),a.d3Arc(e)}})}}y.enter().append("polyline").merge(y).transition().attr("points",function(t,e){var i=a.d3LabelArc.centroid(t),n=a.d3Arc.centroid(t),o=c([],h(i),!1);return i[0]=l*(a.isLeftSide(_(t))?1:-1),i[1]=a._labelPositions[e].top,[n,o,i]}),y.exit().remove(),this.showLabels()&&this.centerOnLabels()},o.prototype.isLeftSide=function(t){return(t=n.normalizeRadians(t))>2*Math.PI?t:t<Math.PI&&t>0},o.prototype.getQuadrant=function(t){var e=0,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},o.prototype.centerOnLabels=function(){var t=this.pos().y,e=2*t,i=this.calcOuterRadius(),n=Math.min(this._minLabelTop,-i),o=Math.max(this._maxLabelBottom,i),a=e-(o-n),r=Math.abs(this._minLabelTop),s=0;o>t?(s=t-o+this.labelHeight()/2,s-=a/2):n<0&&r>t&&(s=r-t+this.labelHeight()/2,s+=a/2);var l=this.pos();this.pos({y:l.y+s,x:l.x})},o.prototype.adjustForOverlap=function(){var t=this,e=this.labelHeight();this._quadIdxArr.forEach(function(i,n){var o;t._quadIdxArr[n].sort(function(e,i){return 1===n||2===n?t._labelPositions[e].top>t._labelPositions[i].top?-1:1:0===n||3===n?t._labelPositions[e].top>t._labelPositions[i].top?1:-1:void 0}),t._quadIdxArr[n].forEach(function(i,a){if(a>0)if(1===n||2===n){if(o<t._labelPositions[i].bottom){var r=t._labelPositions[i].bottom-o;t._labelPositions[i].top-=r,t._labelPositions[i].bottom-=r}}else if((0===n||3===n)&&o+e>t._labelPositions[i].top){r=Math.abs(t._labelPositions[i].top)-Math.abs(o+e);t._labelPositions[i].top-=r,t._labelPositions[i].bottom-=r}o=t._labelPositions[i].top})}),this._minLabelTop=0,this._maxLabelBottom=0,this._quadIdxArr.forEach(function(e,i){t._quadIdxArr[i].forEach(function(e,i){t._minLabelTop>t._labelPositions[e].top&&(t._minLabelTop=t._labelPositions[e].top),t._maxLabelBottom<t._labelPositions[e].bottom&&(t._maxLabelBottom=t._labelPositions[e].bottom)})})},o.prototype.exit=function(e,i){t.prototype.exit.call(this,e,i)},o.prototype.updateD3Pie=function(){var t=n.normalizeRadians(n.degreesToRadians(this.startAngle()));switch(this.sortDataByValue()){case"ascending":this.d3Pie.sort(mo);break;case"descending":this.d3Pie.sort(go);break;default:this.d3Pie.sort(null)}this.d3Pie.padAngle(.0025).startAngle(t).endAngle(2*Math.PI+t).value(function(t){return t[1]})},o.__inputs=[{id:"label",type:"string"},{id:"value",type:"number"}],o}(i.SVGWidget);vo.prototype._class+=" chart_Pie",vo.prototype.implements(e.I2DChart.prototype),vo.prototype.implements(e.ITooltip.prototype),vo.prototype.mixin(i.Utility.SimpleSelectionMixin),vo.prototype.publish("showLabels",!0,"boolean","If true, wedge labels will display"),vo.prototype.publish("showSeriesValue",!1,"boolean","Append data series value next to label",null,{disable:function(t){return!t.showLabels()}}),vo.prototype.publish("seriesValueFormat",",.0f","string","Number format used for formatting series values",null,{disable:function(t){return!t.showSeriesValue()}}),vo.prototype.publish("showSeriesPercentage",!1,"boolean","Append data series percentage next to label",null,{disable:function(t){return!t.showLabels()}}),vo.prototype.publish("seriesPercentageFormat",",.0f","string","Number format used for formatting series percentages",null,{disable:function(t){return!t.showSeriesPercentage()}}),vo.prototype.publish("paletteID","default","set","Color palette for this widget",vo.prototype._palette.switch(),{tags:["Basic","Shared"]}),vo.prototype.publish("useClonedPalette",!1,"boolean","Enable or disable using a cloned palette",null,{tags:["Intermediate","Shared"]}),vo.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}}),vo.prototype.publish("minOuterRadius",20,"number","Minimum outer radius (pixels)"),vo.prototype.publish("startAngle",0,"number","Starting angle of the first (and largest) wedge (degrees)"),vo.prototype.publish("labelHeight",12,"number","Font size of labels (pixels)",null,{disable:function(t){return!t.showLabels()}}),vo.prototype.publish("sortDataByValue","descending","set","Sort data by value",["none","ascending","descending"]);var bo=function(t){function e(){return t.call(this)||this}return a(e,t),e.prototype.postUpdate=function(e,i){t.prototype.postUpdate.call(this,e,i);var n=this._pos.x,o=this._pos.y;"origin"===this._drawStartPos&&this._target instanceof SVGElement&&(n-=this._size.width/2,o-=this._size.height/2),o+=this._size.height/4,this._element.attr("transform","translate("+n+","+o+")scale("+this._widgetScale+")")},e.prototype.updateD3Pie=function(){t.prototype.updateD3Pie.call(this),this.d3Pie.startAngle(-Math.PI/2).endAngle(Math.PI/2)},e}(vo);bo.prototype._class+=" chart_HalfPie";var wo=function(t){function e(){var e=t.call(this)||this;return e.xAxisGuideLines_default(!0).yAxisGuideLines_default(!0),e}return a(e,t),e.prototype.radius=function(t){return this.radiusX(t),this.radiusY(t),this},e.prototype.layerEnter=function(e,i,n){void 0===n&&(n=250),t.prototype.layerEnter.call(this,e,i,n),this._domForeignObject=this.svg.insert("foreignObject","#".concat(this.id()+"_clippath")),this._domCanvas=this._domForeignObject.append("xhtml:body").style("margin","0px").style("padding","0px").style("background-color","transparent").append("canvas"),this._heat=So(this._domCanvas.node())},e.prototype.layerUpdate=function(e,n,o){t.prototype.layerUpdate.call(this,e,n),this._palette=this._palette.switch(this.paletteID());var a=this.width()-this.margin.left-this.margin.right;a<0&&(a=0);var r=this.height()-this.margin.top-this.margin.bottom;r<0&&(r=0),this._domForeignObject.attr("x",this.margin.left).attr("y",this.margin.top).attr("width",a).attr("height",r),this._domCanvas.attr("width",a).attr("height",r);var s="horizontal"===e.orientation()?this.data().map(function(t){return[e.dataPos(t[0]),e.valuePos(t[1]),t[2]]}):this.data().map(function(t){return[e.valuePos(t[1]),e.dataPos(t[0]),t[2]]}),l=this.maxWeight_exists()?this.maxWeight():i.max(s,function(t){return t[2]});if("default"!==this.paletteID()){for(var h={},c=this.reversePalette(),u=0;u<8;++u)h[u/8]=this._palette((c?8-u:u)/8,0,1);this._heat.gradient(h)}else this._heat.gradient(this._heat.defaultGradient);this._heat.resize();var p=this.radiusAsPercent()?this.radiusX()*a/100:this.radiusX(),d=this.radiusAsPercent()?this.radiusY()*r/100:this.radiusY();this._heat.clear().radius(p,d,this.blur()).max(l).data(s).draw(this.minOpacity())},e}(Pt);function So(t){if(!(this instanceof So))return new So(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=[]}wo.prototype._class+=" chart_Heat",wo.prototype._palette=i.Palette.rainbow("default"),wo.prototype.publish("paletteID","default","set","Color palette for this widget",wo.prototype._palette.switch(),{tags:["Basic"]}),wo.prototype.publish("useClonedPalette",!1,"boolean","Enable or disable using a cloned palette",null,{tags:["Intermediate","Shared"]}),wo.prototype.publish("reversePalette",!1,"boolean","Reverse Palette Colors",null,{disable:function(t){return"default"===t.paletteID()}}),wo.prototype.publish("radiusX",25,"number","Point X radius (25 by default)"),wo.prototype.publish("radiusY",25,"number","Point Y radius (25 by default)"),wo.prototype.publish("radiusAsPercent",!1,"boolean","Calculate RadiusX + RadiusY as % of size"),wo.prototype.publish("blur",15,"number","Point blur radius (15 by default)"),wo.prototype.publish("maxWeight",void 0,"number","Clamp max weight to value (optional), omitting uses max data point",void 0,{optional:!0}),wo.prototype.publish("minOpacity",.05,"number","Minimum point opacity (0.05 by default)"),So.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;var n=this._ellipse=this._createCanvas(),o=n.getContext("2d"),a=this._r=t+i,r=this._r=e+i;return n.width=2*a,n.height=2*r,o.shadowOffsetX=o.shadowOffsetY=2*a,o.shadowOffsetY=o.shadowOffsetY=2*r,o.shadowBlur=i,o.shadowColor="black",o.beginPath(),o.ellipse(-a,-r,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){var e=this._createCanvas(),i=e.getContext("2d"),n=i.createLinearGradient(0,0,0,256);for(var o in e.width=1,e.height=256,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);var e=this._ctx;e.clearRect(0,0,this._width,this._height);for(var i=0,n=this._data.length,o=void 0;i<n;i++)(o=this._data[i])[2]<0?o[2]=0:o[2]>this._max&&(o[2]=this._max),e.globalAlpha=Math.max(o[2]/this._max,void 0===t?.05:t),e.drawImage(this._ellipse,o[0]-this._r,o[1]-this._r);var a=e.getImageData(0,0,this._width,this._height);return this._colorize(a.data,this._grad),e.putImageData(a,0,0),this},_colorize:function(t,e){for(var i=0,n=t.length,o=void 0;i<n;i+=4)(o=4*t[i+3])&&(t[i]=e[o],t[i+1]=e[o+1],t[i+2]=e[o+2])},_createCanvas:function(){return"undefined"!=typeof document?document.createElement("canvas"):new this._canvas.constructor}};var ko=Math.PI/3,Ao=[0,ko,2*ko,3*ko,4*ko,5*ko];function Mo(t){return t[0]}function To(t){return t[1]}Mt(".chart_HexBin .hexagon{fill:none;stroke:#000;stroke-width:.5px}.chart_HexBin .hexagon.selected{stroke:red}");var Po=function(t){function n(){var n=t.call(this)||this;return e.I2DAggrChart.call(n),n.tooltipValueFormat_default(",.0f"),e.ITooltip.call(n),n.tooltipHTML(function(t){var e=i.extent(t,function(t){return t.label}),o=i.extent(t,function(t){return t.value});return n.tooltipFormat({series:e[0]===e[1]?e[0]:"".concat(e[0]," -> ").concat(e[1]),label:o[0]===o[1]?o[0]:"".concat(o[0]," -> ").concat(o[1]),value:t.length})}),n._hexbin=function(){var t,e,i,n=0,o=0,a=1,r=1,s=Mo,l=To;function h(t){var n,o={},a=[],r=t.length;for(n=0;n<r;++n)if(!isNaN(c=+s.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 v=d+"-"+p,b=o[v];b?b.push(h):(a.push(b=o[v]=[h]),b.x=(d+(1&p)/2)*e,b.y=p*i)}return a}function c(t){var e=0,i=0;return Ao.map(function(n){var o=Math.sin(n)*t,a=-Math.cos(n)*t,r=o-e,s=a-i;return e=o,i=a,[r,s]})}return h.hexagon=function(e){return"m"+c(null==e?t:+e).join("l")+"z"},h.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},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?(s=t,h):s},h.y=function(t){return arguments.length?(l=t,h):l},h.radius=function(n){return arguments.length?(e=2*(t=+n)*Math.sin(ko),i=1.5*t,h):t},h.size=function(t){return arguments.length?(n=o=0,a=+t[0],r=+t[1],h):[a-n,r-o]},h.extent=function(t){return arguments.length?(n=+t[0][0],o=+t[0][1],a=+t[1][0],r=+t[1][1],h):[[n,o],[a,r]]},h.radius(1)}().x(function(t){return t.x}).y(function(t){return t.y}),n.xAxisGuideLines_default(!1).yAxisGuideLines_default(!1).xAxisType_default("linear"),n}return a(n,t),n.prototype.xPos=function(t,e){return"horizontal"===t.orientation()?t.dataPos(e.label):t.valuePos(e.value)},n.prototype.yPos=function(t,e){return"horizontal"===t.orientation()?t.valuePos(e.value):t.dataPos(e.label)},n.prototype.layerUpdate=function(e,n,o){void 0===o&&(o=250),t.prototype.layerUpdate.call(this,e,n,o);var a=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());var r=this.flattenData().map(function(t){return{x:a.xPos(e,t),y:a.yPos(e,t),label:e.parseData(t.label),value:e.parseValue(t.value),origRow:t}}),s=this._hexbin(r),l=i.min(s,function(t){return t.length}),h=i.max(s,function(t){return t.length});this._dataMinWeight=l,this._dataMaxWeight=h;var c=n.selectAll(".hexagon").data(s,function(t){return t.i+"_"+t.j});c.enter().append("path").attr("class","hexagon").call(e._selection.enter.bind(e._selection)).on("click",function(t){var i=a.data();a.click(t.map(function(t){return e.rowToObj(i[t.origRow.rowIdx])}),a.columns()[1],e._selection.selected(this))}).on("dblclick",function(t){var i=a.data();a.dblclick(t.map(function(t){return e.rowToObj(i[t.origRow.rowIdx])}),a.columns()[1],e._selection.selected(this))}).on("mouseout.tooltip",a.tooltip.hide).on("mousemove.tooltip",a.tooltip.show).attr("transform",function(t){return"translate("+t.x+","+t.y+")scale(0)"}).merge(c).transition().duration(o).attr("d",this._hexbin.hexagon()).attr("transform",function(t){return"translate("+t.x+","+t.y+")scale(1)"}).style("fill",function(t){return a._palette(t.length,l,h)}),c.exit().transition().duration(o).attr("transform",function(t){return"translate("+t.x+","+t.y+")scale(0)"}).remove()},n.prototype.exit=function(e,i){t.prototype.exit.call(this,e,i)},n.prototype.click=function(t,e,i){},n.prototype.dblclick=function(t,e,i){},n.__inputs=[{id:"x",type:"any"},{id:"y",type:"number"}],n}(Pt);Po.prototype._class+=" chart_HexBin",Po.prototype.implements(e.I2DAggrChart.prototype),Po.prototype.implements(e.ITooltip.prototype),Po.prototype.publish("paletteID","Blues","set","Color palette for this widget",Po.prototype._palette.switch(),{tags:["Basic","Shared"]}),Po.prototype.publish("useClonedPalette",!1,"boolean","Enable or disable using a cloned palette",null,{tags:["Intermediate","Shared"]}),Po.prototype.publish("binSize",20,"number","Bin radius",null,{range:{min:1,max:300,step:1}});Mt(".chart_Line .dataLine{fill:none;stroke:#4682b4;stroke-width:1.5px}");var Co=function(t){function e(){var e=t.call(this)||this;return e.interpolate_default("linear"),e}return a(e,t),e}(Ct);Co.prototype._class+=" chart_Line";var zo=function(t){function e(){return t.call(this)||this}return a(e,t),e.prototype.postUpdate=function(e,i){t.prototype.postUpdate.call(this,e,i);var n="left"===this.orientation()?0:this._size.width,o=this._size.height;"origin"===this._drawStartPos&&this._target instanceof SVGElement&&(n-=this._size.width/2,o-=this._size.height/2),this._element.attr("transform","translate("+n+","+o+")scale("+this._widgetScale+")")},e.prototype.updateD3Pie=function(){t.prototype.updateD3Pie.call(this),this.d3Pie.startAngle("left"===this.orientation()?0:-Math.PI/2).endAngle("left"===this.orientation()?Math.PI/2:0)},e.prototype.calcOuterRadius=function(){var t=this,e=this.textSize(this.data().map(function(e){return t.getLabelText({data:e})}),"Verdana",12).width;return Math.min(this._size.width-e-10,this._size.height-36)-2},e}(vo);zo.prototype._class+=" chart_QuarterPie",zo.prototype.publish("orientation","left","set","Determines the placement and start/end angle.",["left","right"]);var Io=function(t){function e(){return t.call(this)||this}return a(e,t),e.prototype.enter=function(e,i){t.prototype.enter.call(this,e,i),this._g=i.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")},e.prototype.update=function(e,n){t.prototype.update.call(this,e,n);var o=("horizontal"===this.orientation()?this.width():this.height())-this.lineWidth(),a="horizontal"===this.orientation()?this.height():this.width(),r=i.scaleLinear().domain([this.data()[0],this.data()[4]]).range([this.edgePadding(),o-this.edgePadding()]),s=this.candleWidth_exists()?this.candleWidth():a,l=this.lineWidth(),h=this.lineColor(),c=this.roundedCorners(),u=this.edgePadding(),p=r(this.data()[1]),d=r(this.data()[2]),f=r(this.data()[3]),y=-s/2,_=s/2,x=this.upperTextRotation(),m=this.lowerTextRotation(),g=this.textPadding(),v=this.labelFontSize(),b=this.valueFontSize(),w=Math.max(v,b),S=o-u;if(w>0){for(;p-u<w;)p+=w;for(;d-p<w;)d+=w;for(;f-d<w;)f+=w;for(;S-f<w;)f-=w;for(;f-d<w;)d-=w;for(;d-p<w;)p-=w}var k=-o/2-this.lineWidth()/2,A=0,M=0,T=1,P="start",C="end";"vertical"===this.orientation()&&(k=0,A=o/2+this.lineWidth()/2,M=-90,P="end",C="start",T=-1),this._g.style("shape-rendering","crispEdges").attr("transform","translate(".concat(k,",").concat(A,")rotate(").concat(M,")scale(").concat(1,")")),this._leftLine.attr("fill",h).attr("height",s).attr("width",l).attr("x",u).attr("y",y).attr("rx",c).attr("ry",c),this._rightLine.attr("class","right-line").attr("fill",h).attr("height",s).attr("width",l).attr("x",S).attr("y",y).attr("rx",c).attr("ry",c),this._midLine.attr("fill",h).attr("height",l).attr("width",S-u).attr("x",u).attr("y",-l/2),this._midOuterRect.attr("fill",h).attr("height",s).attr("width",f-p).attr("x",p).attr("y",y).attr("rx",c).attr("ry",c),this._midInnerRect1.attr("fill",this.innerRectColor()).attr("height",s-2*l).attr("width",d-(p+2*l)).attr("x",p+l).attr("y",l-s/2).attr("rx",.618*c).attr("ry",.618*c),this._midInnerRect2.attr("fill",this.innerRectColor()).attr("height",s-2*l).attr("width",f-d-l).attr("x",d).attr("y",l-s/2).attr("rx",.618*c).attr("ry",.618*c),this._q0text.attr("height",s).attr("width",f-p).attr("display",this.showLabels()?null:"none").attr("fill",this.textColor()).attr("x",0).attr("y",0).attr("transform","translate(".concat(u,", ").concat(y-g,")rotate(").concat(x,")scale(").concat(T,")")).attr("font-size",v).attr("text-anchor",P).attr("alignment-baseline","hanging").text(this.columns()[0]),this._q1text.attr("height",s).attr("width",f-p).attr("display",this.showLabels()?null:"none").attr("fill",this.textColor()).attr("x",0).attr("y",0).attr("transform","translate(".concat(p,", ").concat(y-g,")rotate(").concat(x,")scale(").concat(T,")")).attr("font-size",v).attr("text-anchor",P).attr("alignment-baseline","middle").text(this.columns()[1]),this._q2text.attr("height",s).attr("width",f-p).attr("display",this.showLabels()?null:"none").attr("fill",this.textColor()).attr("x",0).attr("y",0).attr("transform","translate(".concat(d,", ").concat(y-g,")rotate(").concat(x,")scale(").concat(T,")")).attr("font-size",v).attr("text-anchor",P).attr("alignment-baseline","middle").text(this.columns()[2]),this._q3text.attr("height",s).attr("width",f-p).attr("display",this.showLabels()?null:"none").attr("fill",this.textColor()).attr("x",0).attr("y",0).attr("transform","translate(".concat(f,", ").concat(y-g,")rotate(").concat(x,")scale(").concat(T,")")).attr("font-size",v).attr("text-anchor",P).attr("alignment-baseline","middle").text(this.columns()[3]),this._q4text.attr("height",s).attr("width",f-p).attr("display",this.showLabels()?null:"none").attr("fill",this.textColor()).attr("x",0).attr("y",0).attr("transform","translate(".concat(S+l,", ").concat(y-g,")rotate(").concat(x,")scale(").concat(T,")")).attr("font-size",v).attr("text-anchor",P).attr("alignment-baseline","baseline").text(this.columns()[4]),this._q0val.attr("height",s).attr("width",f-p).attr("display",this.showValues()?null:"none").attr("fill",this.textColor()).attr("x",0).attr("y",0).attr("transform","translate(".concat(u,", ").concat(_+g,")rotate(").concat(m,")scale(").concat(T,")")).attr("font-size",b).attr("text-anchor",C).attr("alignment-baseline","hanging").text(this.data()[0]),this._q1val.attr("height",s).attr("width",f-p).attr("display",this.showValues()?null:"none").attr("fill",this.textColor()).attr("x",0).attr("y",0).attr("transform","translate(".concat(p,", ").concat(_+g,")rotate(").concat(m,")scale(").concat(T,")")).attr("font-size",b).attr("text-anchor",C).attr("alignment-baseline","middle").text(this.data()[1]),this._q2val.attr("height",s).attr("width",f-p).attr("display",this.showValues()?null:"none").attr("fill",this.textColor()).attr("x",0).attr("y",0).attr("transform","translate(".concat(d,", ").concat(_+g,")rotate(").concat(m,")scale(").concat(T,")")).attr("font-size",b).attr("text-anchor",C).attr("alignment-baseline","middle").text(this.data()[2]),this._q3val.attr("height",s).attr("width",f-p).attr("display",this.showValues()?null:"none").attr("fill",this.textColor()).attr("x",0).attr("y",0).attr("transform","translate(".concat(f,", ").concat(_+g,")rotate(").concat(m,")scale(").concat(T,")")).attr("font-size",b).attr("text-anchor",C).attr("alignment-baseline","middle").text(this.data()[3]),this._q4val.attr("height",s).attr("width",f-p).attr("display",this.showValues()?null:"none").attr("fill",this.textColor()).attr("x",0).attr("y",0).attr("transform","translate(".concat(S+l,", ").concat(_+g,")rotate(").concat(m,")scale(").concat(T,")")).attr("font-size",b).attr("text-anchor",C).attr("alignment-baseline","baseline").text(this.data()[4])},e}(i.SVGWidget);Io.prototype._class+=" chart_QuartileCandlestick",Io.prototype.publish("textColor","black","html-color","Color of label and value text"),Io.prototype.publish("showLabels",!0,"boolean","If true, labels will be shown"),Io.prototype.publish("showValues",!0,"boolean","If true, values will be shown"),Io.prototype.publish("orientation","horizontal","set","Determines layout",["horizontal","vertical"]),Io.prototype.publish("valueFontSize",12,"number","Font size of value text (pixels)"),Io.prototype.publish("labelFontSize",12,"number","Font size of label text (pixels)"),Io.prototype.publish("roundedCorners",8,"number","Radius of rounded rect corners (pixels)"),Io.prototype.publish("lineWidth",4,"number","Width of lines (pixels)"),Io.prototype.publish("candleWidth",null,"number","Height of outer rect (pixels)",null,{optional:!0}),Io.prototype.publish("textPadding",8,"number","Padding between outer rect and text (pixels)"),Io.prototype.publish("edgePadding",30,"number","Padding between outer rect and left/right sides (pixels)"),Io.prototype.publish("lineColor","#333","html-color","Color of outer rect and lines"),Io.prototype.publish("innerRectColor","white","html-color","Color of the inner rects"),Io.prototype.publish("upperTextRotation",-60,"number","Rotation of label text (degrees)"),Io.prototype.publish("lowerTextRotation",-60,"number","Rotation of value text (degrees)");Mt(".chart_Radar .area,.chart_Radar .pointShape{pointer-events:none}.chart_Radar .point .pointSelection{fill:none;stroke:none;pointer-events:all}.chart_Radar .point .pointSelection.selected{fill:none;stroke:red}");var Fo=function(t){function n(){var n=t.call(this)||this;return e.INDChart.call(n),e.ITooltip.call(n),i.Utility.SimpleSelectionMixin.call(n),n}return a(n,t),n.prototype.mapShape=function(t){switch(t){case"rectangle":return"rect";case"circle":return"circle";case"cross":return"path"}},n.prototype.setPointAttributes=function(t,e,i){var n=this,o=this;switch(this.mapShape(this.pointShape())){case"rect":t.attr("width",o.pointSize()).attr("height",o.pointSize()).style("fill",function(t){return n.strokeColor(t.data,t.column,t.value)});break;case"circle":t.attr("r",o.pointSize()/2).attr("cx",e).attr("cy",i).style("fill",function(t){return n.strokeColor(t.data,t.column,t.value)});break;case"path":var a=o.pointSize()/2;t.attr("d",function(t){return"M"+(e-a)+" "+(i-a)+" L"+(e+a)+" "+(i+a)+" M"+(e-a)+" "+(i+a)+" L"+(e+a)+" "+(i-a)}).style("stroke",function(t){return n.strokeColor(t.data,t.column,t.value)})}},n.prototype.enter=function(e,i){var n=this;t.prototype.enter.call(this,e,i),this._selection.widgetElement(i),this.tooltipHTML(function(t){return n.tooltipFormat({label:t.label,series:t.column,value:t.value})})},n.prototype.update=function(e,n){var o=this;t.prototype.update.call(this,e,n),this._palette=this._palette.switch(this.paletteID());var a=this,r=this.height()/2,s=this.width()/2,l=this.columns(),h=this.data(),c=this.flattenData(l,h).map(function(t,e){return t.shape=o.mapShape(o.pointShape()),t.column=l[t.colIdx],t.row=h[e],t}),u=[],p=this.degrees2radians(360/this.data().length),d=this.fontSize(),f=0;c.filter(function(t){return 1===t.colIdx}).forEach(function(e){var i=t.prototype.textSize.call(o,e.label,"".concat(o.fontFamily()),o.fontSize());f<i.width&&(f=i.width)});var y=Math.min(r-d,s-f),_=n.selectAll(".label").data(c.filter(function(t){return 1===t.colIdx})),x=Math.max.apply(a,c.map(function(t){return t.value}));_.enter().append("text").attr("class","label").attr("text-anchor","middle").merge(_).attr("font-size",this.fontSize()).attr("font-family",this.fontFamily()).each(function(t,e){var n=a.polar2cartesian(y,e*p-Math.PI/2);u.push(n.map(function(t){return t*a.labelPaddingRatio()}));var o="middle",r=Math.round(n[0]);o=r>0?"start":o,o=r<0?"end":o,i.select(this).attr("text-anchor",o).attr("x",n[0]).attr("y",n[1])}).text(function(t){return t.label}),_.exit().remove();var m=n.selectAll(".domain").data(c.filter(function(t){return 1===t.colIdx}));m.enter().append("line").classed("domain",!0).style("stroke","#000").style("stroke-opacity","0.75").style("stroke-width","1px").merge(m).attr("x1",0).attr("y1",0).attr("x2",function(t,e){return u[e][0]}).attr("y2",function(t,e){return u[e][1]}),m.exit().remove();var g=n.selectAll(".value_guide").data(this.valueGuideRatios());g.enter().append("polygon").classed("value_guide",!0).style("stroke","grey").style("stroke-opacity","0.75").style("stroke-width","0.3px").merge(g).each(function(t,e){var n=[];u.forEach(function(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)}),g.exit().remove();var v=n.selectAll(".value_guide_text").data(this.valueGuideRatios());v.enter().append("text").attr("class","value_guide_text").attr("text-anchor","start").attr("font-size",this.fontSize()).attr("font-family",this.fontFamily()).merge(v).attr("x",2).attr("y",function(t){return u[0][1]*t}).text(function(t,e){return Math.round(t*x)}),g.exit().remove();var b=n.selectAll(".area").data(l.filter(function(t,e){return e>0}));b.enter().append("polygon").attr("class","area").style("stroke-opacity","0.75").style("stroke-width","0.3px").merge(b).style("stroke",function(t){return o.strokeColor([],t,0)}).style("fill",function(t){return o.fillColor([],t,0)}).style("fill-opacity",this.fillOpacity()).attr("points",function(t,e){return u.map(function(t,i){var n=h[i][e+1],o=0===n?0:n/x;return t[0]*o+","+t[1]*o}).join(" ")}),b.exit().remove();var w=n.selectAll(".point").data(c);w.enter().append("g").attr("class","point").on("mouseout.tooltip",a.tooltip.hide).on("mousemove.tooltip",a.tooltip.show).on("click",function(t,e){var i=a.data()[t.rowIdx],n=a.rowToObj(i),o=a._selection.selected(this);a.click(n,a.columns()[t.colIdx],o)}).on("dblclick",function(t,e){a.dblclick(a.rowToObj(a.data()[t.rowIdx]),t.column,a._selection.selected(this))}).each(function(t){var e=i.select(this);e.append("circle").attr("class","pointSelection").attr("r",a.pointSize()).call(a._selection.enter.bind(a._selection)),e.append(a.mapShape(a.pointShape())).attr("class","pointShape")}).merge(w).each(function(t){var e=i.select(this),n=0===t.value?0:t.value/x,o=u[t.rowIdx][0]*n,r=u[t.rowIdx][1]*n;e.select(".pointSelection").attr("cx",o).attr("cy",r);var s=e.select(".pointShape").style("stroke",a.strokeColor(t.row,t.column,t.value)).style("fill",a.fillColor(t.row,t.column,t.value));a.setPointAttributes(s,o,r)}),w.exit().remove()},n.prototype.polar2cartesian=function(t,e){return[t*Math.cos(e),t*Math.sin(e)]},n.prototype.cartesian2polar=function(t,e){return[Math.atan2(e,t),Math.sqrt(t*t+e*e)]},n.prototype.degrees2radians=function(t){return t/57.295779513},n.prototype.radians2degrees=function(t){return 57.295779513*t},n.prototype.point_in_polygon=function(t,e){for(var i=t[0],n=t[1],o=!1,a=0,r=e.length-1;a<e.length;r=a++){var s=e[a][0],l=e[a][1],h=e[r][0],c=e[r][1];l>n!=c>n&&i<(h-s)*(n-l)/(c-l)+s&&(o=!o)}return o},n}(i.SVGWidget);Fo.prototype._class+=" chart_Radar",Fo.prototype.implements(e.INDChart.prototype),Fo.prototype.implements(e.ITooltip.prototype),Fo.prototype.mixin(i.Utility.SimpleSelectionMixin),Fo.prototype.publish("paletteID","default","set","Color palette for this widget",Fo.prototype._palette.switch()),Fo.prototype.publish("pointShape","cross","set","pointShape",["circle","rectangle","cross"]),Fo.prototype.publish("pointSize",6,"number","Point Size",null,{range:{min:1,step:1,max:200}}),Fo.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"),Fo.prototype.publish("fillOpacity",.66,"number","Opacity of the data polygon(s)"),Fo.prototype.publish("fontFamily","","string","fontFamily"),Fo.prototype.publish("fontSize",16,"number","fontSize"),Fo.prototype.publish("labelPaddingRatio",.9,"number","labelPaddingRatio");Mt(".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 circle,.chart_RadialBar .axis line{stroke:#ccc;stroke-width:1px}.chart_RadialBar .axis circle{fill:none}.chart_RadialBar .r.axis text{text-anchor:end}");var Do=function(t){function n(){var n=t.call(this)||this;return n._domainScale=i.scaleBand(),n._valueScale=i.scaleLinear(),n._d3Arc=j().startAngle(0).endAngle(function(t){return n._valueScale(t[1])}),e.INDChart.call(n),e.ITooltip.call(n),i.Utility.SimpleSelectionMixin.call(n),n}return a(n,t),n.prototype.enter=function(e,i){var n=this;t.prototype.enter.call(this,e,i),this._selection.widgetElement(i),this.tooltipHTML(function(t){return n.tooltipFormat({label:t[0],value:t[1]})}),this._radialAxis=i.append("g").attr("class","r axis"),this._axialAxis=i.append("g").attr("class","a axis"),this._arcs=i.append("g").attr("class","data")},n.prototype.update=function(e,n){var o=this;t.prototype.update.call(this,e,n);var a=this,r=Math.max.apply(Math,c([this.valueDomainHigh_exists()?this.valueDomainHigh():0],h(this.data().map(function(t){return t[1]})),!1));this._valueScale.domain([0,r]).range([0,this.radians(this.valueMaxAngle())]);var s=this._valueScale.ticks(this.tickCount()),l=this.textSize(s.map(function(t){return""+t}),"Verdana",12).width,u=Math.min(this.width()-2*(10+l),this.height()-44)/2,p=this.data().map(function(t){return t[0]});this._domainScale.domain(p).range([0,u]).padding(this.domainPadding());var d=this._domainScale.step()*this._domainScale.padding(),f=this._radialAxis.selectAll("circle").data(p);f.enter().append("circle").attr("fill","transparent").merge(f).attr("r",function(t){return o._domainScale(t)+o._domainScale.step()-d/2}),f.exit().remove();var y=this._radialAxis.selectAll(".arc-text").data(p);y.enter().append("text").attr("class","arc-text").attr("x",-4).attr("alignment-baseline","middle").attr("text-anchor","end").merge(y).attr("y",function(t){return-o._domainScale(t)-o._domainScale.bandwidth()/2}).text(function(t){return t}),y.exit().remove();var _=this._axialAxis.selectAll("line").data(s);_.enter().append("line").merge(_).attr("x2",function(t){return u*Math.cos(o._valueScale(t)-o.radians(90))}).attr("y2",function(t){return u*Math.sin(o._valueScale(t)-o.radians(90))}),_.exit().remove();var x=this._axialAxis.selectAll("text").data(s);x.enter().append("text").style("dominant-baseline","central").merge(x).attr("x",function(t){return(u+10)*Math.cos(o._valueScale(t)-o.radians(90))}).attr("y",function(t){return(u+10)*Math.sin(o._valueScale(t)-o.radians(90))}).style("text-anchor",function(t){var e=o.degrees(o._valueScale(t));return e>=0&&e<=20||e>=160&&e<=200||e>=340&&e<=360?"middle":e>=180&&e<=360?"end":null}).text(function(t){return t}),x.exit().remove();var m=this.columns().length>1?this.columns()[1]:"";this._d3Arc.innerRadius(function(t){return o._domainScale(t[0])}).outerRadius(function(t){return o._domainScale(t[0])+o._domainScale.bandwidth()});var g=this._arcs.selectAll("path").data(this.data(),function(t){return t[0]});g.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){a.click(a.rowToObj(t),m,a._selection.selected(this))}).on("dblclick",function(t,e){a.dblclick(a.rowToObj(t),m,a._selection.selected(this))}).merge(g).style("fill",function(t,e){return o.fillColor(t,t[0],t[1])}).transition().delay(function(t,e){return e*o.transitionDelay()}).duration(this.transitionDuration()).attrTween("d",function(t,e){var n=i.interpolate(t._current||0,t[1]);return t._current=t[1],function(i){return o._d3Arc([t[0],n(i)],e)}}),g.exit().remove()},n.prototype.degrees=function(t){return 180*t/Math.PI},n.prototype.radians=function(t){return t*Math.PI/180},n.__inputs=[{id:"label",type:"any"},{id:"values",type:"number"}],n}(i.SVGWidget);Do.prototype._class+=" chart_RadialBar",Do.prototype.implements(e.INDChart.prototype),Do.prototype.implements(e.ITooltip.prototype),Do.prototype.mixin(i.Utility.SimpleSelectionMixin),Do.prototype.publish("paletteID","default","set","Color palette for this widget",Do.prototype._palette.switch()),Do.prototype.publish("tickCount",10,"number","Number of ticks to display"),Do.prototype.publish("domainPadding",.25,"number","Padding between chart edge and container edge (0..1)"),Do.prototype.publish("valueMaxAngle",270,"number","Maximum angular length of a bar (degrees)"),Do.prototype.publish("valueDomainHigh",null,"number","Value domain high",void 0,{optional:!0}),Do.prototype.publish("transitionDelay",100,"number","Delay between the start of each row animation (ms)"),Do.prototype.publish("transitionDuration",750,"number","Duration of a row's animation (ms)");var Oo=i.Palette.rainbow("Blues"),Ro=i.Palette.ordinal("Quartile",[Oo(100,0,100),Oo(50,0,100),Oo(50,0,100),Oo(75,0,100)]);Ro("Std. Dev."),Ro("MinMax"),Ro("25%"),Ro("50%");var jo=function(t){function e(){var e=t.call(this)||this;return e._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),e._candle=(new Io).columns(["Min","25%","50%","75%","Max"]).edgePadding(0).roundedCorners(1).lineWidth(1).upperTextRotation(-90).lowerTextRotation(-90).labelFontSize(0).valueFontSize(0).lineColor(Oo(90,0,100)).innerRectColor(Oo(10,0,100)),e.columns(["Min","25%","50%","75%","Max","Mean","Std. Dev."]),e}return a(e,t),e.prototype.stdDev=function(t){return this.mean()+t*this.standardDeviation()},e.prototype.formatStdDev=function(t){return this._tickFormatter(this.stdDev(t))},e.prototype.quartile=function(t){return this.quartiles()[t]},e.prototype.formatQ=function(t){return this._tickFormatter(this.quartile(t))},e.prototype.domain=function(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)]}},e.prototype.min=function(){return this.quartile(0)},e.prototype.max=function(){return this.quartile(4)},e.prototype.data=function(t){if(!arguments.length)return[c(c([],h(this.quartiles()),!1),[this.mean(),this.standardDeviation()],!1)];var 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},e.prototype.enter=function(e,i){var n=this;t.prototype.enter.call(this,e,i),this._bellCurve.target(i.append("div").node()),this._candle.target(i.append("div").node()),this._selectElement=i.append("div").style("position","absolute").style("top","0px").style("right","0px").append("select").on("change",function(){n.view(n._selectElement.node().value),n.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")},e.prototype.bellTicks=function(t){var 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)}]}var i=h(this.domain(this._selectElement.node().value),2),n=i[0],o=i[1];return e.filter(function(t){return t.value>=n&&t.value<=o}).map(function(t){return{label:t.label,value:t.value.toString()}})},e.prototype.updateScatter=function(){var t=this._selectElement.node().value,e=h(this.domain(t),2),i=e[0],n=e[1],o=(n-i)*(this.domainPadding()/100);this._bellCurve.xAxisDomainLow(i-o).xAxisDomainHigh(n+o).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()},e.prototype.updateCandle=function(){var 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()},e.prototype.update=function(e,n){var o,a;t.prototype.update.call(this,e,n),this._tickFormatter=(o=this.tickFormat(),a=i.format(o),function(t){var e=(Math.round(100*t)/100).toString();return e.length<=4?e:a(t)}),this._selectElement.node().value=this.view(),this.updateScatter(),this.updateCandle()},e}(i.HTMLWidget);jo.prototype._class+=" chart_Stat",jo.prototype.publish("view","min_max","set","View",["min_max","25_75","normal"]),jo.prototype.publish("tickFormat",".2e","string","X-Axis Tick Format"),jo.prototype.publish("candleHeight",20,"number","Height of candle widget (pixels)"),jo.prototype.publish("domainPadding",10,"number","Domain value padding"),jo.prototype.publish("mean",.5,"number","Mean"),jo.prototype.publish("standardDeviation",.125,"number","Standard Deviation (σ)"),jo.prototype.publish("quartiles",[0,.25,.5,.75,1],"object","Quartiles (Min, 25%, 50%, 75%, Max)");var Eo=function(t){function e(){var e=t.call(this)||this;return e.interpolate_default("step"),e}return a(e,t),e}(Ct);Eo.prototype._class+=" chart_Step";Mt(".chart_Summary{font-size:14px;height:150px;width:225px}.chart_Summary .content h2{font-size:3em;font-weight:700;margin-bottom:10px;margin-left:10px;margin-top:10px}.chart_Summary .bgIcon:before{font-family:FontAwesome;font-size:5.5em;opacity:.4;position:absolute;right:15px;top:.5em}.chart_Summary .bgIcon{position:relative}.chart_Summary .content{background-color:#efd752;float:left;height:100%;width:100%}.chart_Summary .content div{font-size:1.1em;margin-top:-1.1em;opacity:.8}.chart_Summary .content .text{padding-left:10px}.chart_Summary .content .more{bottom:0;height:3em;line-height:3em;position:absolute;width:100%}.chart_Summary .content .more i{padding-left:10px;padding-right:.5em}");var No="text",Lo="html",Bo=function(t){function e(){var e=t.call(this)||this;return e._playIntervalIdx=0,e._tag="div",e._drawStartPos="center",e.playInterval(e.playInterval()),e}return a(e,t),e.prototype.lookupFieldIdx=function(t,e){var i=e;if(!(this[t+"_exists"]()&&(i=this.columns().indexOf(this[t]()))<0))return i},e.prototype.lookupFieldText=function(t,e){return this[t+"_exists"]()?this[t]():void 0!==e&&this.columns()[e]||""},e.prototype.currentRow=function(){return this.data()[this._playIntervalIdx]},e.prototype.summaryData=function(){var t;this.hideLabel()||(t=this.lookupFieldIdx("labelColumn",0));var e,i,n=this.lookupFieldIdx("iconColumn"),o=this.lookupFieldIdx("valueColumn",1);this.hideMore()||(e=this.lookupFieldIdx("moreIconColumn"),i=this.lookupFieldIdx("moreTextColumn"));var a=this.lookupFieldIdx("colorFillColumn"),r=this.lookupFieldIdx("colorStrokeColumn");return this.formattedData().map(function(s){return{icon:void 0===n?this.icon():s[n],label:void 0===t?"":s[t],value:s[o],moreIcon:void 0===e?this.hideMore()?"":this.moreIcon():s[e],moreText:void 0===i?this.hideMore()?"":this.moreText():s[i],fill:void 0===a?this.colorFill():s[a],stroke:void 0===r?this.colorStroke():s[r]}},this)},e.prototype.enter=function(e,i){t.prototype.enter.call(this,e,i),this._mainDiv=i.append("div");var n=this;this._headerDiv=this._mainDiv.append("h2").on("click",function(){n.click(n.rowToObj(n.currentRow()),n.lookupFieldText("valueColumn",1),!0)}).on("dblclick",function(){n.dblclick(n.rowToObj(n.currentRow()),n.lookupFieldText("valueColumn",1),!0)}),this._textDiv=this._mainDiv.append("div").attr("class","text").on("click",function(){n.click(n.rowToObj(n.currentRow()),n.lookupFieldText("labelColumn",0),!0)}).on("dblclick",function(){n.dblclick(n.rowToObj(n.currentRow()),n.lookupFieldText("labelColumn",0),!0)})},e.prototype.update=function(e,n){t.prototype.update.call(this,e,n),this.data().length;var o=this.summaryData();this._playIntervalIdx>=o.length&&(this._playIntervalIdx=0);var a=this._playIntervalIdx<o.length?o[this._playIntervalIdx]:["",""];n.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 "+a.icon).transition().style("background-color",a.fill).style("color",a.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",a.stroke).style("font-size",this.headerFontSize()+"px")[this.valueHTML()?Lo:No](a.value),this._textDiv.style("font-size",this.textFontSize()+"px")[this.labelHTML()?Lo:No](a.label);var r=this,s=this._mainDiv.selectAll(".more").data([a]),l=s.enter().append("div").attr("class","more").on("click",function(t){r.click(r.rowToObj(r.currentRow()),r.lookupFieldText("moreTextColumn")||"more",!0)}).each(function(){var t=i.select(this);t.append("i"),t.append("span")}).merge(s).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(a.fill).darker(.75).toString());l.select("i").attr("class",function(t){return"fa "+t.moreIcon}),this.moreTextHTML()?l.select("span").each(function(t){this.innerHTML=t.moreText}):l.select("span").text(function(t){return t.moreText}),s.exit().remove()},e.prototype.exit=function(e,i){t.prototype.exit.call(this,e,i)},e}(i.HTMLWidget);Bo.prototype._class+=" chart_Summary",Bo.prototype.implements(e.I2DChart.prototype),Bo.prototype.publish("iconColumn",null,"set","Select Icon Column",function(){return this.columns()},{optional:!0}),Bo.prototype.publish("icon","fa-briefcase","string","FA Char icon class",null,{disable:function(t){return t.iconColumn()}}),Bo.prototype.publish("headerFontSize",null,"number","headerFontSize"),Bo.prototype.publish("textFontSize",null,"number","textFontSize"),Bo.prototype.publish("moreFontSize",null,"number","moreFontSize"),Bo.prototype.publish("iconFontSize",null,"number","iconFontSize"),Bo.prototype.publish("hideLabel",!1,"boolean","Hide label column"),Bo.prototype.publish("labelColumn",null,"set","Select display value",function(){return this.columns()},{optional:!0,disable:function(t){return t.hideLabel()}}),Bo.prototype.publish("labelHTML",!1,"boolean","Allow HTML",null,{disable:function(t){return t.hideLabel()}}),Bo.prototype.publish("valueColumn",null,"set","Select display value",function(){return this.columns()},{optional:!0}),Bo.prototype.publish("valueHTML",!1,"boolean","Allow HTML"),Bo.prototype.publish("hideMore",!1,"boolean","Hide More Information"),Bo.prototype.publish("hideMoreWrapper",!1,"boolean","Hide More Information Wrapper"),Bo.prototype.publish("moreWrapperHeight",null,"number","Height of the 'more' text wrapper (pixels)"),Bo.prototype.publish("moreIconColumn",null,"set","Select More Icon Column",function(){return this.columns()},{optional:!0,disable:function(t){return t.hideMore()}}),Bo.prototype.publish("moreIcon","fa-info-circle","string","FA Char icon class",null,{disable:function(t){return t.hideMore()||t.moreIconColumn()}}),Bo.prototype.publish("moreTextColumn",null,"set","Select display value",function(){return this.columns()},{optional:!0,disable:function(t){return t.hideMore()}}),Bo.prototype.publish("moreText","More Info","string","More text",null,{disable:function(t){return t.hideMore()||t.moreTextColumn()}}),Bo.prototype.publish("moreTextHTML",!1,"boolean","Allow HTML",null,{disable:function(t){return t.hideMore()}}),Bo.prototype.publish("colorFillColumn",null,"set","Column for color",function(){return this.columns()},{optional:!0}),Bo.prototype.publish("colorFill","#3498db","html-color","Fill Color",null,{disable:function(t){return t.colorFillColumn()}}),Bo.prototype.publish("colorStrokeColumn",null,"set","Column for color",function(){return this.columns()},{optional:!0}),Bo.prototype.publish("colorStroke","#ffffff","html-color","Fill Color",null,{disable:function(t){return t.colorStrokeColumn()}}),Bo.prototype.publish("fixedSize",!0,"boolean","Fix Size to Min Width/Height"),Bo.prototype.publish("minWidth",225,"number","Minimum Width"),Bo.prototype.publish("minHeight",150,"number","Minimum Height"),Bo.prototype.publish("playInterval",null,"number","Play Interval",null,{optional:!0});var Ho=Bo.prototype.playInterval;Bo.prototype.playInterval=function(t){var e=Ho.apply(this,arguments);if(arguments.length){this._playIntervalHandle&&clearInterval(this._playIntervalHandle);var i=this;t&&(this._playIntervalHandle=setInterval(function(){i._playIntervalIdx++,i._renderCount&&i.data().length&&i.render()},t))}return e};var Vo=function(t){function n(){var i=t.call(this)||this;return i._playIntervalIdx=0,e.I2DChart.call(i),i.playInterval(i.playInterval()),i}return a(n,t),n.prototype.currentRow=function(){return this.data()[this._playIntervalIdx]},n.prototype.enter=function(e,i){t.prototype.enter.apply(this,arguments);var n=this.size(),o=n.width,a=n.height;e.height=a,e.width=o},n.prototype.update=function(e,n){t.prototype.update.apply(this,arguments);var o=this;this._playIntervalIdx>=this.data().length&&(this._playIntervalIdx=0);var a=this.size(),r=Math.min(a.width,a.height),s=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(),m=a.height*(s-this.paddingSizeRatio()),g=a.height*(1-s-this.paddingSizeRatio()),v=a.height*(this.iconSizeRatio()-this.paddingSizeRatio()),b=r*this.paddingSizeRatio(),w=e.getContext("2d");w.clearRect(0,0,a.width,a.height);var S=o.fontFamily();function k(t,e,i,n){w.textBaseline="top",w.font="".concat(i,"px ").concat(S),w.fillStyle=x;var o=w.measureText(t);o.width>a.width-2*b&&(i*=(a.width-2*b)/o.width,w.font="".concat(i,"px ").concat(S),o=w.measureText(t));var r=A(o.width,n);return w.fillText(t,r,e),i}function A(t,e){switch(e){case"start":return b;case"middle":return a.width/2-t/2;case"end":return a.width-t-b}}w.fillStyle=_,w.fillRect(0,0,a.width,a.height),w.globalAlpha=this.iconOpacity(),function(t,e,i){if(void 0===t)return;w.textBaseline=o.iconBaseline(),w.font="".concat(e,"px FontAwesome"),w.fillStyle=x;var n=w.measureText(t);if(n.width>a.width-2*b){var r=(a.width-2*b)/n.width;w.font="".concat(e*r,"px FontAwesome"),n=w.measureText(t)}var s=A(n.width,i),l=function(t){switch(t){case"top":return b;case"middle":return a.height/2;case"bottom":return a.height-b}}(o.iconBaseline());w.fillText(t,s,l)}(i.Utility.faChar(d),v,o.iconAnchor()),w.globalAlpha=this.valueOpacity(),m=k(y,b,m,o.valueAnchor()),w.globalAlpha=this.labelOpacity(),k(f,m+b,g,o.labelAnchor())},n}(i.CanvasWidget);Vo.prototype._class+=" chart_SummaryC",Vo.prototype.implements(e.I2DChart.prototype),Vo.prototype.publish("iconBaseline","bottom","string","Text baseline for the icon",["top","middle","bottom"]),Vo.prototype.publish("iconAnchor","end","set","Anchors the icon either at the start, middle, or end of the summary",["start","middle","end"]),Vo.prototype.publish("valueAnchor","start","set","Anchors the value either at the start, middle, or end of the summary",["start","middle","end"]),Vo.prototype.publish("labelAnchor","start","set","Anchors the label either at the start, middle, or end of the summary",["start","middle","end"]),Vo.prototype.publish("iconColumn",null,"set","Select Icon Column",function(){return this.columns()},{optional:!0}),Vo.prototype.publish("icon","fa-briefcase","string","FA Char icon class",null,{disable:function(t){return t.iconColumn()}}),Vo.prototype.publish("fontFamily","Arial","string","Font Family"),Vo.prototype.publish("labelColumn",null,"set","Select display value",function(){return this.columns()},{optional:!0}),Vo.prototype.publish("valueColumn",null,"set","Select display value",function(){return this.columns()},{optional:!0}),Vo.prototype.publish("colorFillColumn",null,"set","Column for background color",function(){return this.columns()},{optional:!0}),Vo.prototype.publish("colorFill","#0097e6","html-color","Background Color",null,{disable:function(t){return t.colorFillColumn()}}),Vo.prototype.publish("colorStrokeColumn",null,"set","Column for font color",function(){return this.columns()},{optional:!0}),Vo.prototype.publish("colorStroke","#2f3640","html-color","Font Color",null,{disable:function(t){return t.colorStrokeColumn()}}),Vo.prototype.publish("fixedSize",!0,"boolean","Fix Size to Min Width/Height"),Vo.prototype.publish("minWidth",225,"number","Minimum Width"),Vo.prototype.publish("minHeight",150,"number","Minimum Height"),Vo.prototype.publish("playInterval",null,"number","Play Interval",null,{optional:!0}),Vo.prototype.publish("fontSizeRatio",.618,"number","Ratio between widget height and value font size"),Vo.prototype.publish("valueOpacity",1,"number","Opacity of value text (0..1)"),Vo.prototype.publish("labelOpacity",.9,"number","Opacity of label text (0..1)"),Vo.prototype.publish("iconOpacity",.3,"number","Opacity of icon text (0..1)"),Vo.prototype.publish("paddingSizeRatio",.1,"number","Ratio of the smallest dimension for edge padding (0..1)"),Vo.prototype.publish("iconSizeRatio",.9,"number","Ratio of the height for icon size (0..1)");var qo=Vo.prototype.playInterval;Vo.prototype.playInterval=function(t){var e=qo.apply(this,arguments);if(arguments.length){this._playIntervalHandle&&clearInterval(this._playIntervalHandle);var i=this;t&&(this._playIntervalHandle=setInterval(function(){i._playIntervalIdx++,i._renderCount&&i.data().length&&i.render()},t))}return e};var Wo=Math.PI/180,Go=2048;function Yo(){var t=i.dispatch("word","end"),e={},n=[256,256],o=Xo,a=Uo,r=Zo,s=Qo,l=Qo,h=Jo,c=Ko,u=[],p=na,d=1/0,f=null,y=Math.random,_=oa;function x(t,e,i){for(var o,a,r,s=e.x,l=e.y,h=Math.sqrt(n[0]*n[0]+n[1]*n[1]),c=p(n),u=y()<.5?1:-1,d=-u;(o=c(d+=u))&&(a=~~o[0],r=~~o[1],!(Math.min(Math.abs(a),Math.abs(r))>=h));)if(e.x=s+a,e.y=l+r,!(e.x+e.x0<0||e.y+e.y0<0||e.x+e.x1>n[0]||e.y+e.y1>n[1])&&(!i||!ta(e,t,n[0]))&&(!i||ia(e,i))){for(var f=e.sprite,_=e.width>>5,x=n[0]>>5,m=e.x-(_<<4),g=127&m,v=32-g,b=e.y1-e.y0,w=(e.y+e.y0)*x+(m>>5),S=void 0,k=0;k<b;k++){S=0;for(var A=0;A<=_;A++)t[w+A]|=S<<v|(A<_?(S=f[k*_+A])>>>g:0);w+=x}return delete e.sprite,!0}return!1}return e.canvas=function(t){return arguments.length?(_=aa(t),e):_},e.start=function(){var i=function(t){t.width=t.height=1;var e=Math.sqrt(t.getContext("2d").getImageData(0,0,1,1).data.length>>2);t.width=2048/e,t.height=Go/e;var i=t.getContext("2d");return i.fillStyle=i.strokeStyle="red",i.textAlign="center",{context:i,ratio:e}}(_()),p=function(t){var e=[],i=-1;for(;++i<t;)e[i]=0;return e}((n[0]>>5)*n[1]),m=null,g=u.length,v=-1,b=[],w=u.map(function(t,e){return t.text=o.call(this,t,e),t.font=a.call(this,t,e),t.style=s.call(this,t,e),t.weight=l.call(this,t,e),t.rotate=h.call(this,t,e),t.size=~~r.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(){for(var o=Date.now();Date.now()-o<d&&++v<g&&f;){var a=w[v];a.x=n[0]*(y()+.5)>>1,a.y=n[1]*(y()+.5)>>1,$o(i,a,w,v),a.hasText&&x(p,a,m)&&(b.push(a),t.call("word",e,a),m?ea(m,a):m=[{x:a.x+a.x0,y:a.y+a.y0},{x:a.x+a.x1,y:a.y+a.y1}],a.x-=n[0]>>1,a.y-=n[1]>>1)}v>=g&&(e.stop(),t.call("end",e,b,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?(a=aa(t),e):a},e.fontStyle=function(t){return arguments.length?(s=aa(t),e):s},e.fontWeight=function(t){return arguments.length?(l=aa(t),e):l},e.rotate=function(t){return arguments.length?(h=aa(t),e):h},e.text=function(t){return arguments.length?(o=aa(t),e):o},e.spiral=function(t){return arguments.length?(p=ra[t]||t,e):p},e.fontSize=function(t){return arguments.length?(r=aa(t),e):r},e.padding=function(t){return arguments.length?(c=aa(t),e):c},e.random=function(t){return arguments.length?(y=t,e):y},e.on=function(){var i=t.on.apply(t,arguments);return i===t?e:i},e}function Xo(t){return t.text}function Uo(){return"serif"}function Qo(){return"normal"}function Zo(t){return Math.sqrt(t.value)}function Jo(){return 30*(~~(6*Math.random())-3)}function Ko(){return 1}function $o(t,e,i,n){if(!e.sprite){var o=t.context,a=t.ratio;o.clearRect(0,0,2048/a,Go/a);var r=0,s=0,l=0,h=i.length;for(--n;++n<h;){e=i[n],o.save(),o.font=e.style+" "+e.weight+" "+~~((e.size+1)/a)+"px "+e.font;var c=o.measureText(e.text+"m").width*a,u=e.size<<1;if(e.rotate){var p=Math.sin(e.rotate*Wo),d=Math.cos(e.rotate*Wo),f=c*d,y=c*p,_=u*d,x=u*p;c=Math.max(Math.abs(f+x),Math.abs(f-x))+31>>5<<5,u=~~Math.max(Math.abs(y+_),Math.abs(y-_))}else c=c+31>>5<<5;if(u>l&&(l=u),r+c>=2048&&(r=0,s+=l,l=0),s+u>=Go)break;o.translate((r+(c>>1))/a,(s+(u>>1))/a),e.rotate&&o.rotate(e.rotate*Wo),o.fillText(e.text,0,0),e.padding&&(o.lineWidth=2*e.padding,o.strokeText(e.text,0,0)),o.restore(),e.width=c,e.height=u,e.xoff=r,e.yoff=s,e.x1=c>>1,e.y1=u>>1,e.x0=-e.x1,e.y0=-e.y1,e.hasText=!0,r+=c}for(var m=o.getImageData(0,0,2048/a,Go/a).data,g=[];--n>=0;)if((e=i[n]).hasText){for(var v=(c=e.width)>>5,b=(u=e.y1-e.y0,0);b<u*v;b++)g[b]=0;if(null==(r=e.xoff))return;s=e.yoff;for(var w=0,S=-1,k=0;k<u;k++){for(b=0;b<c;b++){var A=v*k+(b>>5),M=m[2048*(s+k)+(r+b)<<2]?1<<31-b%32:0;g[A]|=M,w|=M}w?S=k:(e.y0++,u--,k--,s++)}e.y1=e.y0+S,e.sprite=g.slice(0,(e.y1-e.y0)*v)}}}function ta(t,e,i){i>>=5;for(var n,o=t.sprite,a=t.width>>5,r=t.x-(a<<4),s=127&r,l=32-s,h=t.y1-t.y0,c=(t.y+t.y0)*i+(r>>5),u=0;u<h;u++){n=0;for(var p=0;p<=a;p++)if((n<<l|(p<a?(n=o[u*a+p])>>>s:0))&e[c+p])return!0;c+=i}return!1}function ea(t,e){var 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 ia(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 na(t){var e=t[0]/t[1];return function(t){return[e*(t*=.1)*Math.cos(t),t*Math.sin(t)]}}function oa(){return document.createElement("canvas")}function aa(t){return"function"==typeof t?t:function(){return t}}var ra={archimedean:na,rectangular:function(t){var e=4*t[0]/t[1],i=0,n=0;return function(t){var 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]}}};Mt(".other_Wordcloud text{cursor:pointer}");var sa=function(t){function n(){var n=t.call(this)||this;return e.I2DChart.call(n),e.ITooltip.call(n),i.Utility.SimpleSelectionMixin.call(n),n._prevOffsetX=n.offsetX(),n._prevOffsetY=n.offsetY(),n._prevZoom=n.zoom(),n}return a(n,t),n.prototype.calcData=function(){return this.data().map(function(t){return{__viz_label:t[0],__viz_weight:t[1],__viz_row:t}})},n.prototype.enter=function(e,n){t.prototype.enter.call(this,e,n),this._selection.widgetElement(n),this._root=n.append("g"),this._canvas=document.createElement("canvas");var o=this;this._d3Zoom=i.zoom().scaleExtent([.1,10]),this._d3Zoom.on("zoom",function(t){var e=i.d3Event();e&&e.transform&&o.zoomed(o._d3Zoom,[e.transform.x,e.transform.y],e.transform.k)}),n.call(this._d3Zoom),this.tooltipHTML(function(t){var e=o.columns(),i=e&&e.length?e[0]:"Word";return o.tooltipFormat({label:t.__viz_label,series:i,value:t.__viz_weight})})},n.prototype.update=function(e,n){var o=this;t.prototype.update.call(this,e,n),this._palette=this._palette.switch(this.paletteID()),this.useClonedPalette()&&(this._palette=this._palette.cloneNotExists(this.paletteID()+"_"+this.id())),this._d3Cloud=Yo().canvas(function(){return o._canvas}),this.zoomed(this,[this.offsetX(),this.offsetY()],this.zoom());var a,r=this.calcData(),s=this,l=i.extent(r,function(t){return t.__viz_weight});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}var h=a().domain(l).range([this.fontSizeFrom(),this.fontSizeTo()]),c=i.scaleLinear().domain([0,s.angleCount()-1]).range([s.angleFrom(),s.angleTo()]);this._d3Cloud.stop().size([this.width(),this.height()]).words(r).font(this.fontFamily()).padding(this.padding()).spiral(this.spiral()).text(function(t){return t.__viz_label.trim()}).fontSize(function(t){return h(t.__viz_weight)}).rotate(function(t,e){return c(e%s.angleCount())}).on("word",function(t){}).on("end",function(t,e){var i=s._root.selectAll("text").data(t,function(t){return t.__viz_label?t.__viz_label.toLowerCase():""});i.enter().append("text").attr("text-anchor","middle").call(s._selection.enter.bind(s._selection)).text(function(t){return t.__viz_label}).on("click",function(t){s.click(s.rowToObj(t.__viz_row),s.columns()[1],s._selection.selected(this))}).on("dblclick",function(t){s.dblclick(s.rowToObj(t.__viz_row),s.columns()[1],s._selection.selected(this))}).on("mouseout.tooltip",s.tooltip.hide).on("mousemove.tooltip",s.tooltip.show).style("opacity",1e-6).merge(i).style("font-size",function(t){return h(t.__viz_weight)+"px"}).style("font-family",s.fontFamily()).transition().duration(1e3).attr("transform",function(t){return"translate("+[t.x,t.y]+")rotate("+t.rotate+")"}).style("fill",function(t){return s._palette(t.__viz_label?t.__viz_label.toLowerCase():"")}).style("opacity",1),i.exit().transition().duration(1e3).style("opacity",1e-4).remove()}).start()},n.prototype.zoomed=function(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}},n.__inputs=[{id:"label",type:"string"},{id:"value",type:"number"}],n}(i.SVGWidget);sa.prototype._class+=" chart_WordCloud",sa.prototype.implements(e.I2DChart.prototype),sa.prototype.implements(e.ITooltip.prototype),sa.prototype.mixin(i.Utility.SimpleSelectionMixin),sa.prototype.publish("paletteID","default","set","Color palette for this widget",sa.prototype._palette.switch(),{tags:["Basic","Shared"]}),sa.prototype.publish("useClonedPalette",!1,"boolean","Enable or disable using a cloned palette",null,{tags:["Intermediate","Shared"]}),sa.prototype.publish("fontFamily","Impact","string","Font Name",null,{tags:["Basic"]}),sa.prototype.publish("fontSizeFrom",6,"number","Minimum font size (pixels)",null,{tags:["Basic"]}),sa.prototype.publish("fontSizeTo",48,"number","Maximum font size (pixels)",null,{tags:["Basic"]}),sa.prototype.publish("angleFrom",-60,"number","Minimum angle (degrees)",null,{tags:["Basic"]}),sa.prototype.publish("angleTo",60,"number","Maximum angle (degrees)",null,{tags:["Basic"]}),sa.prototype.publish("angleCount",5,"number","Number of different angles",null,{tags:["Basic"]}),sa.prototype.publish("padding",0,"number","Padding between words (pixels)",null,{tags:["Intermediate"]}),sa.prototype.publish("scaleMode","linear","set","Text scaling mode",["linear","log","sqrt","pow"],{tags:["Intermediate"]}),sa.prototype.publish("spiral","archimedean","set","Text scaling mode",["archimedean","rectangular"],{tags:["Intermediate"]}),sa.prototype.publish("offsetX",0,"number","X offset",null,{tags:["Advanced"]}),sa.prototype.publish("offsetY",0,"number","Y offset",null,{tags:["Advanced"]}),sa.prototype.publish("zoom",1,"number","Zoom",null,{tags:["Advanced"]}),t.Area=zt,t.Axis=Tt,t.BUILD_VERSION="2.108.11",t.Bar=Ft,t.Bubble=oe,t.BubbleXY=ae,t.Bullet=Te,t.Column=It,t.Contour=tn,t.Gantt=en,t.Gauge=xo,t.HalfPie=bo,t.Heat=wo,t.HexBin=Po,t.Line=Co,t.PKG_NAME="@hpcc-js/chart",t.PKG_VERSION="2.86.6",t.Pie=vo,t.QuarterPie=zo,t.QuartileCandlestick=Io,t.Radar=Fo,t.RadialBar=Do,t.Scatter=Ct,t.StatChart=jo,t.Step=Eo,t.Summary=Bo,t.SummaryC=Vo,t.WordCloud=sa,t.XYAxis=Pt});
2
2
  //# sourceMappingURL=index.min.js.map