@hpcc-js/chart 2.83.1 → 2.83.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.es6.js +2 -2
- package/dist/index.es6.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/package.json +5 -5
- package/src/__package__.ts +2 -2
- package/types/__package__.d.ts +2 -2
- package/types-3.4/__package__.d.ts +2 -2
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,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 h=Math.PI,c=2*h,u=1e-6,p=c-u;function d(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function f(){return new d}function y(t){return function(){return t}}d.prototype=f.prototype={constructor:d,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,c=a-t,p=r-e,d=c*c+p*p;if(o<0)throw new Error("negative radius: "+o);if(null===this._x1)this._+="M"+(this._x1=t)+","+(this._y1=e);else if(d>u)if(Math.abs(p*s-l*c)>u&&o){var f=i-a,y=n-r,_=s*s+l*l,x=f*f+y*y,m=Math.sqrt(_),g=Math.sqrt(d),v=o*Math.tan((h-Math.acos((_+d-x)/(2*m*g)))/2),b=v/g,w=v/m;Math.abs(b-1)>u&&(this._+="L"+(t+b*c)+","+(e+b*p)),this._+="A"+o+","+o+",0,0,"+ +(p*f>c*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,d=e+s,f=1^a,y=a?n-o:o-n;if(i<0)throw new Error("negative radius: "+i);null===this._x1?this._+="M"+l+","+d:(Math.abs(this._x1-l)>u||Math.abs(this._y1-d)>u)&&(this._+="L"+l+","+d),i&&(y<0&&(y=y%c+c),y>p?this._+="A"+i+","+i+",0,1,"+f+","+(t-r)+","+(e-s)+"A"+i+","+i+",0,1,"+f+","+(this._x1=l)+","+(this._y1=d):y>u&&(this._+="A"+i+","+i+",0,"+ +(y>=h)+","+f+","+(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 _=Math.abs,x=Math.atan2,m=Math.cos,g=Math.max,v=Math.min,b=Math.sin,w=Math.sqrt,S=1e-12,k=Math.PI,A=k/2,M=2*k;function T(t){return t>=1?A:t<=-1?-A:Math.asin(t)}function P(t){return t.innerRadius}function C(t){return t.outerRadius}function z(t){return t.startAngle}function I(t){return t.endAngle}function F(t){return t&&t.padAngle}function D(t,e,i,n,o,a,r){var s=t-i,l=e-n,h=(r?a:-a)/w(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,v=y-d,b=m*m+v*v,S=o-a,k=p*y-f*d,A=(v<0?-1:1)*w(g(0,S*S*b-k*k)),M=(k*v-m*A)/b,T=(-k*m-v*A)/b,P=(k*v+m*A)/b,C=(-k*m+v*A)/b,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/S-1),y11:T*(o/S-1)}}function O(){var t=P,e=C,i=y(0),n=null,o=z,a=I,r=F,s=null;function l(){var l,h,c=+t.apply(this,arguments),u=+e.apply(this,arguments),p=o.apply(this,arguments)-A,d=a.apply(this,arguments)-A,y=_(d-p),g=d>p;if(s||(s=l=f()),u<c&&(h=u,u=c,c=h),u>S)if(y>M-S)s.moveTo(u*m(p),u*b(p)),s.arc(0,0,u,p,d,!g),c>S&&(s.moveTo(c*m(d),c*b(d)),s.arc(0,0,c,d,p,g));else{var P,C,z=p,I=d,F=p,O=d,R=y,j=y,E=r.apply(this,arguments)/2,N=E>S&&(n?+n.apply(this,arguments):w(c*c+u*u)),L=v(_(u-c)/2,+i.apply(this,arguments)),B=L,H=L;if(N>S){var V=T(N/c*b(E)),q=T(N/u*b(E));(R-=2*V)>S?(F+=V*=g?1:-1,O-=V):(R=0,F=O=(p+d)/2),(j-=2*q)>S?(z+=q*=g?1:-1,I-=q):(j=0,z=I=(p+d)/2)}var W=u*m(z),G=u*b(z),Y=c*m(O),X=c*b(O);if(L>S){var U,Q=u*m(I),Z=u*b(I),J=c*m(F),K=c*b(F);if(y<k&&(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<S))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/b(function(t){return t>1?0:t<-1?k:Math.acos(t)}(($*et+tt*it)/(w($*$+tt*tt)*w(et*et+it*it)))/2),ot=w(U[0]*U[0]+U[1]*U[1]);B=v(L,(c-ot)/(nt-1)),H=v(L,(u-ot)/(nt+1))}}j>S?H>S?(P=D(J,K,W,G,u,H,g),C=D(Q,Z,Y,X,u,H,g),s.moveTo(P.cx+P.x01,P.cy+P.y01),H<L?s.arc(P.cx,P.cy,H,x(P.y01,P.x01),x(C.y01,C.x01),!g):(s.arc(P.cx,P.cy,H,x(P.y01,P.x01),x(P.y11,P.x11),!g),s.arc(0,0,u,x(P.cy+P.y11,P.cx+P.x11),x(C.cy+C.y11,C.cx+C.x11),!g),s.arc(C.cx,C.cy,H,x(C.y11,C.x11),x(C.y01,C.x01),!g))):(s.moveTo(W,G),s.arc(0,0,u,z,I,!g)):s.moveTo(W,G),c>S&&R>S?B>S?(P=D(Y,X,Q,Z,c,-B,g),C=D(W,G,J,K,c,-B,g),s.lineTo(P.cx+P.x01,P.cy+P.y01),B<L?s.arc(P.cx,P.cy,B,x(P.y01,P.x01),x(C.y01,C.x01),!g):(s.arc(P.cx,P.cy,B,x(P.y01,P.x01),x(P.y11,P.x11),!g),s.arc(0,0,c,x(P.cy+P.y11,P.cx+P.x11),x(C.cy+C.y11,C.cx+C.x11),g),s.arc(C.cx,C.cy,B,x(C.y11,C.x11),x(C.y01,C.x01),!g))):s.arc(0,0,c,O,F,g):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-k/2;return[m(n)*i,b(n)*i]},l.innerRadius=function(e){return arguments.length?(t="function"==typeof e?e:y(+e),l):t},l.outerRadius=function(t){return arguments.length?(e="function"==typeof t?t:y(+t),l):e},l.cornerRadius=function(t){return arguments.length?(i="function"==typeof t?t:y(+t),l):i},l.padRadius=function(t){return arguments.length?(n=null==t?null:"function"==typeof t?t:y(+t),l):n},l.startAngle=function(t){return arguments.length?(o="function"==typeof t?t:y(+t),l):o},l.endAngle=function(t){return arguments.length?(a="function"==typeof t?t:y(+t),l):a},l.padAngle=function(t){return arguments.length?(r="function"==typeof t?t:y(+t),l):r},l.context=function(t){return arguments.length?(s=null==t?null:t,l):s},l}function R(t){this._context=t}function j(t){return new R(t)}function E(t){return t[0]}function N(t){return t[1]}function L(){var t=E,e=N,i=y(!0),n=null,o=j,a=null;function r(r){var s,l,h,c=r.length,u=!1;for(null==n&&(a=o(h=f())),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:y(+e),r):t},r.y=function(t){return arguments.length?(e="function"==typeof t?t:y(+t),r):e},r.defined=function(t){return arguments.length?(i="function"==typeof t?t:y(!!t),r):i},r.curve=function(t){return arguments.length?(o=t,null!=n&&(a=o(n)),r):o},r.context=function(t){return arguments.length?(null==t?n=a=null:a=o(n=t),r):n},r}function B(t,e){return e<t?-1:e>t?1:e>=t?0:NaN}function H(t){return t}function V(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 q(t){this._context=t}function W(t){return new q(t)}function G(t,e){this._basis=new q(t),this._beta=e}R.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)}}},q.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:V(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:V(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},G.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 Y=function t(e){function i(t){return 1===e?new q(t):new G(t,e)}return i.beta=function(e){return t(+e)},i}(.85);function X(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 U(t,e){this._context=t,this._k=(1-e)/6}U.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:X(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:X(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 Q=function t(e){function i(t){return new U(t,e)}return i.tension=function(e){return t(+e)},i}(0);function Z(t,e){this._context=t,this._alpha=e}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._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>S){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>S){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 J=function t(e){function i(t){return e?new Z(t,e):new U(t,0)}return i.alpha=function(e){return t(+e)},i}(.5);function K(t){return t<0?-1:1}function $(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(K(a)+K(r))*Math.min(Math.abs(a),Math.abs(r),.5*Math.abs(s))||0}function tt(t,e){var i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function et(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 it(t){this._context=t}function nt(t){return new it(t)}function ot(t){this._context=t}function at(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 rt(t){return new ot(t)}function st(t,e){this._context=t,this._t=e}function lt(t){return new st(t,.5)}function ht(t){return new st(t,0)}function ct(t){return new st(t,1)}it.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:et(this,this._t0,tt(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,et(this,tt(this,i=$(this,t,e)),i);break;default:et(this,this._t0,i=$(this,t,e))}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=i}}},Object.create(it.prototype).point=function(t,e){it.prototype.point.call(this,e,t)},ot.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=at(t),o=at(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)}},st.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 ut=Array.prototype.slice;function pt(t){return t}var dt=1,ft=2,yt=3,_t=4,xt=1e-6;function mt(t){return"translate("+(t+.5)+",0)"}function gt(t){return"translate(0,"+(t+.5)+")"}function vt(t){return function(e){return+t(e)}}function bt(t){var e=Math.max(0,t.bandwidth()-1)/2;return t.round()&&(e=Math.round(e)),function(i){return+t(i)+e}}function wt(){return!this.__axis}function St(t,e){var i=[],n=null,o=null,a=6,r=6,s=3,l=t===dt||t===_t?-1:1,h=t===_t||t===ft?"x":"y",c=t===dt||t===yt?mt:gt;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):pt:o,f=Math.max(a,0)+s,y=e.range(),_=+y[0]+.5,x=+y[y.length-1]+.5,m=(e.bandwidth?bt:vt)(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",t===dt?"0em":t===yt?"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",xt).attr("transform",(function(t){return isFinite(t=m(t))?c(t):this.getAttribute("transform")})),S.attr("opacity",xt).attr("transform",(function(t){var e=this.parentNode.__axis;return c(e&&isFinite(e=e(t))?e:m(t))}))),w.remove(),v.attr("d",t===_t||t==ft?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(wt).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",t===ft?"start":t===_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=ut.call(arguments),u},u.tickArguments=function(t){return arguments.length?(i=null==t?[]:ut.call(t),u):i.slice()},u.tickValues=function(t){return arguments.length?(n=null==t?null:ut.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 kt(t){return St(dt,t)}function At(t){return St(ft,t)}function Mt(t){return St(yt,t)}function Tt(t){return St(_t,t)}function Pt(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))}}Pt(".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 Ct=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=Tt(this.d3Scale),this.d3Guides=Tt(this.d3Scale);break;case"top":this.d3Axis=kt(this.d3Scale),this.d3Guides=kt(this.d3Scale);break;case"right":this.d3Axis=At(this.d3Scale),this.d3Guides=At(this.d3Scale);break;default:this.d3Axis=Mt(this.d3Scale),this.d3Guides=Mt(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);Ct.prototype._class+=" chart_Axis",Ct.prototype.publish("title",null,"string","Title"),Ct.prototype.publish("orientation","bottom","set","Placement/orientation of the axis",["left","top","right","bottom"]),Ct.prototype.publish("powExponent",2,"number","Power exponent (disabled when type is not 'pow')",null,{disable:function(t){return"pow"!==t.type()}}),Ct.prototype.publish("logBase",10,"number","Logarithmic base (disabled when type is not 'log')",null,{disable:function(t){return"log"!==t.type()}}),Ct.prototype.publish("ordinals",[],"array","Array of ordinal values to display (disabled when type is not 'ordinal')",null,{disable:function(t){return"ordinal"!==t.type()}}),Ct.prototype.publish("fontSize",null,"number","Size of tick label font (pixels)",null,{optional:!0}),Ct.prototype.publish("fontFamily",null,"string","Font family of tick labels",null,{optional:!0}),Ct.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()}}),Ct.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()}}),Ct.prototype.publish("tickLength",null,"number","Height (or width for left/right orientations) of the axis ticks (in pixels)",null,{optional:!0}),Ct.prototype.publish("ticks",[],"array","Custom tick labels",null,{optional:!0}),Ct.prototype.publish("low",null,"any","Minimum tick value (disabled when type is ordinal)",null,{optional:!0,disable:function(t){return"ordinal"===t.type()}}),Ct.prototype.publish("high",null,"any","Maximum tick value (disabled when type is ordinal)",null,{optional:!0,disable:function(t){return"ordinal"===t.type()}}),Ct.prototype.publish("overlapMode","none","set","Specifies the behavior when tick labels overlap",["none","stagger","hide","rotate","linebreak","wrap"]),Ct.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()}}),Ct.prototype.publish("shrinkToFit","both","set","shrinkToFit",["none","low","high","both"]),Ct.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()}}),Ct.prototype.publish("hidden",!1,"boolean","Hides axis when 'true'"),Ct.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()}}),Ct.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()}}),Ct.prototype.publish("ordinalMappings",null,"object","Alternative label mappings (icons)",null,{optional:!0}),Ct.prototype.publish("padding",0,"number","Padding space at top of axis (pixels)",null,{optional:!0});Pt(".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 zt=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 Ct).classed({domain:!0}).orientation_default("bottom").type("ordinal").overlapMode_default("stagger").shrinkToFit_default("high").extend_default(0),e.valueAxis=(new Ct).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(){r.copyPropsTo(r.focusChart,["layers"]);for(var t=0,e=0,i=r.layers();e<i.length;e++){i[e].copyPropsTo(r.focusChart.layers()[t]),t++}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?l([i[0]],n,!0):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){void 0===i&&(i=250),this.layerEnter(this,e,i);for(var n=0,o=this.layers();n<o.length;n++){var a=o[n];a.__xyAxisElement=e.append("g").attr("class",a.class()),a.target(a.__xyAxisElement.node()).layerEnter(this,e,i)}},e.prototype.chartsUpdate=function(t,e,i){this.layerUpdate(this,this.svgData,i);for(var n=0,o=this.layers();n<o.length;n++){var a=o[n];a.resize({width:t,height:e}).layerUpdate(this,a.__xyAxisElement,i)}},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);zt.prototype._class+=" chart_XYAxis",zt.prototype.mixin(i.Utility.SimpleSelectionMixin),zt.prototype.publish("orientation","horizontal","set","Selects orientation for the axis",["horizontal","vertical"]),zt.prototype.publish("pointSizeColumn",null,"string","pointSizeColumn",null,{optional:!0}),zt.prototype.publish("minPointSize",6,"number","minPointSize"),zt.prototype.publish("maxPointSize",26,"number","maxPointSize"),zt.prototype.publish("use2dSelection",!1,"boolean","2D Range Selector"),zt.prototype.publish("selectionMode",!1,"boolean","Range Selector"),zt.prototype.publishProxy("xAxisTitle","domainAxis","title"),zt.prototype.publishProxy("xAxisTickCount","domainAxis","tickCount"),zt.prototype.publishProxy("xAxisTickFormat","domainAxis","tickFormat"),zt.prototype.publishProxy("xAxisTicks","domainAxis","ticks"),zt.prototype.publishProxy("xAxisType","domainAxis","type"),zt.prototype.publishProxy("xAxisTypeTimePattern","domainAxis","timePattern"),zt.prototype.publish("xAxisDomainLow",null,"string","X-Axis Low",null,{optional:!0,disable:function(t){return"ordinal"===t.xAxisType()}}),zt.prototype.publish("xAxisDomainHigh",null,"string","X-Axis High",null,{optional:!0,disable:function(t){return"ordinal"===t.xAxisType()}}),zt.prototype.publishProxy("xAxisFontSize","domainAxis","fontSize"),zt.prototype.publishProxy("xAxisFontFamily","domainAxis","fontFamily"),zt.prototype.publishProxy("xAxisOrdinalPaddingInner","domainAxis","ordinalPaddingInner"),zt.prototype.publishProxy("xAxisOrdinalPaddingOuter","domainAxis","ordinalPaddingOuter"),zt.prototype.publishProxy("xAxisOverlapMode","domainAxis","overlapMode"),zt.prototype.publishProxy("xAxisLabelRotation","domainAxis","labelRotation"),zt.prototype.publishProxy("xAxisDomainPadding","domainAxis","extend"),zt.prototype.publish("xAxisGuideLines",!1,"boolean","Y-Axis Guide Lines"),zt.prototype.publish("xAxisFocus",!1,"boolean","X-Axis Focus",null,{disable:function(t){return"horizontal"!==t.orientation()}}),zt.prototype.publish("xAxisFocusHeight",80,"number","X-Axis Focus Height",null,{disable:function(t){return!t.xAxisFocus()}}),zt.prototype.publishProxy("xAxisHidden","domainAxis","hidden"),zt.prototype.publishProxy("yAxisFontSize","valueAxis","fontSize"),zt.prototype.publishProxy("yAxisFontFamily","valueAxis","fontFamily"),zt.prototype.publishProxy("yAxisTitle","valueAxis","title"),zt.prototype.publishProxy("yAxisTickCount","valueAxis","tickCount"),zt.prototype.publishProxy("yAxisTickFormat","valueAxis","tickFormat"),zt.prototype.publishProxy("yAxisTicks","valueAxis","ticks"),zt.prototype.publishProxy("yAxisType","valueAxis","type"),zt.prototype.publishProxy("yAxisTypeTimePattern","valueAxis","timePattern"),zt.prototype.publishProxy("yAxisTypePowExponent","valueAxis","powExponent"),zt.prototype.publishProxy("yAxisTypeLogBase","valueAxis","logBase"),zt.prototype.publish("yAxisStacked",!1,"boolean","Stacked Chart",null,{tags:["Basic"],disable:function(t){return"ordinal"!==t.xAxisType()||t._class.indexOf("chart_Column")<0}}),zt.prototype.publish("yAxisDomainLow",null,"string","Y-Axis Low",null,{optional:!0,disable:function(t){return"ordinal"===t.yAxisType()}}),zt.prototype.publish("yAxisDomainHigh",null,"string","Y-Axis High",null,{optional:!0,disable:function(t){return"ordinal"===t.yAxisType()}}),zt.prototype.publishProxy("yAxisDomainPadding","valueAxis","extend"),zt.prototype.publish("yAxisGuideLines",!0,"boolean","Y-Axis Guide Lines"),zt.prototype.publishProxy("yAxisHidden","valueAxis","hidden"),zt.prototype.publish("regions",[],"array","Regions"),zt.prototype.publish("layers",[],"widgetArray","Layers",null,{render:!1}),zt.prototype.publishProxy("xAxisPadding","domainAxis","padding"),zt.prototype.publishProxy("yAxisPadding","valueAxis","padding");Pt(".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 It=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 j;case"step":return lt;case"step-before":return ht;case"step-after":return ct;case"basis":return W;case"bundle":return Y;case"cardinal":return Q;case"catmullRom":return J;case"natural":return rt;default:return nt}},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),_=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})),x=n.selectAll(".area").data(p.filter((function(t,e){return u.interpolate()&&u.interpolateFill()&&e>0}))),m=x.enter().append("path"),g=function(){var t=E,e=null,i=y(0),n=N,o=y(!0),a=null,r=j,s=null;function l(l){var h,c,u,p,d,y=l.length,_=!1,x=new Array(y),m=new Array(y);for(null==a&&(s=r(d=f())),h=0;h<=y;++h){if(!(h<y&&o(p=l[h],h,l))===_)if(_=!_)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()}_&&(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 L().defined(o).curve(r).context(a)}return l.x=function(i){return arguments.length?(t="function"==typeof i?i:y(+i),e=null,l):t},l.x0=function(e){return arguments.length?(t="function"==typeof e?e:y(+e),l):t},l.x1=function(t){return arguments.length?(e=null==t?null:"function"==typeof t?t:y(+t),l):e},l.y=function(t){return arguments.length?(i="function"==typeof t?t:y(+t),n=null,l):i},l.y0=function(t){return arguments.length?(i="function"==typeof t?t:y(+t),l):i},l.y1=function(t){return arguments.length?(n=null==t?null:"function"==typeof t?t:y(+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:y(!!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(x).attr("class",(function(t){return"area series series-"+a.cssTag(t)})).each((function(t,e){i.select(this).attr("d",g(_.filter((function(t){return t.colIdx===e+1})))).style("opacity",u.interpolateFillOpacity()).style("stroke","none").style("fill",u.areaColor([],t,void 0,[]))})),x.exit().remove();var v=n.selectAll(".line").data(p.filter((function(t,e){return u.interpolate()&&e>0}))),b=v.enter().append("path"),w=L().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=_.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(_,(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}(zt);It.prototype._class+=" chart_Scatter",It.prototype.implements(e.INDChart.prototype),It.prototype.implements(e.ITooltip.prototype),It.prototype.publish("paletteID","default","set","Color palette for this widget",It.prototype._palette.switch(),{tags:["Basic","Shared"]}),It.prototype.publish("pointSizeScale","linear","set","pointSizeScale",["linear","pow","log","sqrt"]),It.prototype.publish("pointShape","cross","set","Shape of the data points",["circle","rectangle","cross"]),It.prototype.publish("pointSize",6,"number","Point Size",null,{range:{min:1,step:1,max:200}}),It.prototype.publish("interpolate","","set","Interpolate Data",["","linear","step","step-before","step-after","basis","bundle","cardinal","catmullRom","natural","monotone"]),It.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()}}),It.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()}}),It.prototype.publish("interpolateFill",!1,"boolean","If true, the area between the line and zero will be filled"),It.prototype.publish("interpolateFillOpacity",.66,"number","Fill interpolation Opacity",null,{range:{min:0,step:.01,max:1}}),It.prototype.publish("useClonedPalette",!1,"boolean","Enable or disable using a cloned palette",null,{tags:["Intermediate","Shared"]}),It.prototype.publish("showValue",!1,"boolean"),It.prototype.publish("valueAnchor","middle","set","text-anchor for shown value text",["start","middle","end"]),It.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 Ft=function(t){function e(){var e=t.call(this)||this;return e.interpolate_default("linear").interpolateFill_default(!0),e}return a(e,t),e}(It);Ft.prototype._class+=" chart_Area";Pt(".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 Dt=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,h=0;switch(e.xAxisType()){case"ordinal":l=e.bandwidth(),h=-l/2;break;case"linear":case"time":l=Math.max(Math.abs(e.dataPos(2)-e.dataPos(1))*(100-this._linearGap)/100,l),h=-l/2}this.tooltip.direction(a?"n":"e");var c=i.scaleBand().domain(r.layerColumns(e).filter((function(t,e){return e>0}))).rangeRound(a?[0,l]:[l,0]).paddingInner(this.xAxisSeriesPaddingInner()).paddingOuter(0),u=[],p=[],d=this.columns().length,f=this.data();this.showValue()&&"series"===this.showValueAsPercent()&&f.forEach((function(t){t.filter((function(t,e){return e>0&&e<d})).forEach((function(t,e){void 0===p[e+1]&&(p[e+1]=0),p[e+1]+=t}))})),(this.showDomainTotal()||this.showValue()&&"domain"===this.showValueAsPercent())&&(u=f.map((function(t){return t.filter((function(t,e){return e>0&&e<d})).reduce((function(t,e){return t+e}),0)})));var y=n.selectAll(".dataRow").data(this.adjustedData(e)),_=e.data(),x=this.getAxisSize(e);y.enter().append("g").attr("class","dataRow").merge(y).each((function(t,n){var f=i.select(this),y=f.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:_[n],value:i,idx:o}})).filter((function(t){return null!==t.value&&t.idx>0})),(function(t){return t.column})),m=y.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")}));m.transition().duration(o).style("opacity",1);var g=e.yAxisStacked()?l:c.bandwidth();m.merge(y).each((function(l){var f=i.select(this),y=e.dataPos(t[0])+(e.yAxisStacked()?0:c(l.column))+h,_=l.value instanceof Array?l.value[1]:l.value,m=l.origRow[l.idx];if(r.showValue()){var v=r.dataMeta();switch(r.showValueAsPercent()){case"series":var b=void 0!==v.sum?v.sum:p[l.idx];m=s(m/b);break;case"domain":var w=void 0!==v.sum?v.sum:u[n];m=s(m/w);break;default:m=i.format(r.showValueFormat())(m)}}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?y:A,y:a?A:y,width:a?g:M,height:a?M:g},{x:0,y:0,width:x.width,height:x.height}),z=f.select("rect").transition().duration(o).style("fill",(function(t){return r.fillColor(t.row,t.column,t.value,t.origRow)}));a?z.attr("x",y).attr("y",A).attr("width",g).attr("height",M):z.attr("y",y).attr("x",A).attr("height",g).attr("width",M);var I=f.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",y+g/2).attr("y",O+D).attr("transform","rotate(-90, ".concat(y+g/2,", ").concat(O,")"))}else I.attr("x",C.x+F).attr("y",y+g/2+D);I.attr("height",g).attr("width",M),r.showInnerText()&&I.text((function(t){var e=r.innerText(t.origRow,t.origRow[d],t.idx);if(e){var i=a?C.height:C.width,n=r.calcInnerText(i,e,m);return t.innerTextObj=n,n.text}return""}));var R=f.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(m,n,o),h=parseFloat(m)>=0,c=r.valueAnchor()?r.valueAnchor():a?"middle":"start",u=C.x,p=x.width-(C.x+C.width),d=C.y,f=x.height-(C.y+C.height);if(l.innerTextObj){var _=l.innerTextObj,v=_.padding,b=_.valueTextWidth;e=!1,a?(c="middle",i.x=y+g/2,4===l.innerTextObj.category?(e=!0,i.y=A-v-o/2):i.y=A+v+o/2):(c="start",4===l.innerTextObj.category?(e=!0,i.x=M+A+v):i.x=M+A-b-v,i.y=y+g/2)}else a?(t=C.height<s.height,e=!r.valueCentered()||t,i.x=C.x+C.width/2,e?h?d<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:f<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?p<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:u<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(c).fontFamily(n).fontSize(o).text("".concat(m)).colorFill(w).visible(r.showValue()&&!k).render()})),R.exit().each((function(t){r.textLocal.get(this).target(null)})).remove()})),y.exit().transition().duration(o).style("opacity",0).remove();var v=e.yAxisStacked()?u[n]:Math.max.apply(Math,t.filter((function(t,e){return e>0&&e<d}))),b=f.selectAll(".stackedTotalText").data(r.showDomainTotal()?[u[n]]:[]);b.enter().append("g").attr("class","stackedTotalText").each((function(t){r.stackedTextLocal.set(this,(new i.Text).target(this).colorStroke_default("transparent"))})).merge(b).each((function(i){var n={x:0,y:0},o=e.dataPos(t[0]),s=e.valuePos(v),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()})),b.exit().each((function(t){r.textLocal.get(this).target(null)})).remove()})),y.exit().transition().duration(o).remove()},n.prototype.calcInnerText=function(t,e,i){var n=this.innerTextFontFamily_exists()?this.innerTextFontFamily():"Verdana",o=this.innerTextFontSize(),a=this.valueFontFamily_exists()?this.valueFontFamily():"Verdana",r=this.valueFontSize(),s=this.innerTextPadding_exists()?this.innerTextPadding():o/2.5,l=this.isHorizontal?r:this.textSize(i,a,r).width,h=e,c=3*s+this.textSize("...",n,o).width+l,u=1*s+l,p=4;if(3*s+this.textSize(e,n,o).width+l<t)p=1;else if(c<t){for(var d=t-c,f="",y=0,_=e;y<_.length;y++){var x=_[y];if(this.textSize(f+x,n,o).width>d){e=f+"...";break}f+=x}p=2}else u<t?(e="",p=3):e="";return{text:e,isTruncated:h!==e,padding:s,category:p,valueTextWidth:l}},n.prototype.innerText=function(t,e,i){return t[0]},n.__inputs=[{id:"label",type:"string"},{id:"values",type:"number",multi:!0}],n}(zt);Dt.prototype._class+=" chart_Column",Dt.prototype.implements(e.INDChart.prototype),Dt.prototype.implements(e.ITooltip.prototype),Dt.prototype.publish("valueFontFamily",null,"string","Font family of value text",null,{optional:!0}),Dt.prototype.publish("valueFontSize",12,"number","Height of value text (pixels)"),Dt.prototype.publish("innerTextFontFamily",null,"string","Font family of inner text",null,{optional:!0}),Dt.prototype.publish("innerTextPadding",8,"number","Offset of inner text (pixels)",null,{optional:!0}),Dt.prototype.publish("innerTextFontSize",12,"number","Height of inner text (pixels)"),Dt.prototype.publish("paletteID","default","set","Color palette for this widget",(function(){return Dt.prototype._palette.switch()}),{tags:["Basic","Shared"]}),Dt.prototype.publish("useClonedPalette",!1,"boolean","Enable or disable using a cloned palette",null,{tags:["Intermediate","Shared"]}),Dt.prototype.publish("showValue",!1,"boolean","Show Value in column"),Dt.prototype.publish("showInnerText",!1,"boolean","Show Label in column"),Dt.prototype.publish("showValueFormat",",","string","D3 Format for Value",null,{disable:function(t){return!t.showValue()||!!t.showValueAsPercent()}}),Dt.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}),Dt.prototype.publish("showValueAsPercentFormat",".0%","string","D3 Format for %",null,{disable:function(t){return!t.showValue()||!t.showValueAsPercent()}}),Dt.prototype.publish("showDomainTotal",!1,"boolean","Show Total Value for Stacked Columns",null),Dt.prototype.publish("valueCentered",!1,"boolean","Show Value in center of column"),Dt.prototype.publish("valueAnchor","middle","set","text-anchor for shown value text",["start","middle","end"]),Dt.prototype.publish("xAxisSeriesPaddingInner",0,"number","Determines the ratio of the range that is reserved for blank space between band (0->1)"),Dt.prototype.publish("tooltipInnerTextEllipsedOnly",!1,"boolean","Show tooltip only when inner text is truncated with an ellipsis");var Ot=function(t){function e(){var e=t.call(this)||this;return e.orientation_default("vertical"),e}return a(e,t),e}(Dt);function Rt(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 jt(t,e){var i,n,o,a,r,s=new Bt(t),l=+t.value&&(s.value=t.value),h=[s];for(null==e&&(e=Et);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 Bt(o[a])),n.parent=i,n.depth=i.depth+1;return s.eachBefore(Lt)}function Et(t){return t.children}function Nt(t){t.data=t.data.data}function Lt(t){var e=0;do{t.height=e}while((t=t.parent)&&t.height<++e)}function Bt(t){this.data=t,this.depth=this.height=0,this.parent=null}Ot.prototype._class+=" chart_Bar",Bt.prototype=jt.prototype={constructor:Bt,count:function(){return this.eachAfter(Rt)},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 jt(this).eachBefore(Nt)}};var Ht=Array.prototype.slice;function Vt(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}(Ht.call(t))).length,a=[];n<o;)e=t[n],i&&Gt(i,e)?++n:(i=Xt(a=qt(a,e)),n=0);return i}function qt(t,e){var i,n;if(Yt(e,t))return[e];for(i=0;i<t.length;++i)if(Wt(e,t[i])&&Yt(Ut(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(Wt(Ut(t[i],t[n]),e)&&Wt(Ut(t[i],e),t[n])&&Wt(Ut(t[n],e),t[i])&&Yt(Qt(t[i],t[n],e),t))return[t[i],t[n],e];throw new Error}function Wt(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 Gt(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 Yt(t,e){for(var i=0;i<e.length;++i)if(!Gt(t,e[i]))return!1;return!0}function Xt(t){switch(t.length){case 1:return{x:(e=t[0]).x,y:e.y,r:e.r};case 2:return Ut(t[0],t[1]);case 3:return Qt(t[0],t[1],t[2])}var e}function Ut(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 Qt(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 Zt(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 Jt(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 Kt(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 $t(t){this._=t,this.next=null,this.previous=null}function te(t){return null==t?null:function(t){if("function"!=typeof t)throw new Error;return t}(t)}function ee(){return 0}function ie(t){return Math.sqrt(t.value)}function ne(t){return function(e){e.children||(e.r=Math.max(0,+t(e)||0))}}function oe(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;Zt(i,e,n=t[2]),e=new $t(e),i=new $t(i),n=new $t(n),e.next=n.previous=i,i.next=e.previous=n,n.next=i.previous=e;t:for(s=3;s<o;++s){Zt(e._,i._,n=t[s]),n=new $t(n),l=i.next,h=e.previous,c=i._.r,u=e._.r;do{if(c<=u){if(Jt(l._,n._)){i=l,e.next=i,i.previous=e,--s;continue t}c+=l._.r,l=l.next}else{if(Jt(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=Kt(e);(n=n.next)!==i;)(r=Kt(n))<a&&(e=n,a=r);i=e.next}for(e=[i._],n=i;(n=n.next)!==i;)e.push(n._);for(n=Vt(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 ae(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)}}Pt(".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 re=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=ee;function o(o){return o.x=e/2,o.y=i/2,t?o.eachBefore(ne(t)).eachAfter(oe(n,.5)).eachBefore(ae(1)):o.eachBefore(ne(ie)).eachAfter(oe(ee,1)).eachAfter(oe(n,o.r/Math.min(e,i))).eachBefore(ae(Math.min(e,i)/(2*o.r))),o}return o.radius=function(e){return arguments.length?(t=te(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=jt({children:this.cloneData()}).sum((function(t){return t[1]})).sort((function(t,e){return e[1]<t[1]?-1:e[1]>t[1]?1:0}));this.d3Pack(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);re.prototype._class+=" chart_Bubble",re.prototype.implements(e.I2DChart.prototype),re.prototype.implements(e.ITooltip.prototype),re.prototype.mixin(i.Utility.SimpleSelectionMixin),re.prototype.publish("paletteID","default","set","Color palette for this widget",re.prototype._palette.switch(),{tags:["Basic","Shared"]}),re.prototype.publish("useClonedPalette",!1,"boolean","Enable or disable using a cloned palette",null,{tags:["Intermediate","Shared"]});var se=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}(It);se.prototype._class+=" chart_BubbleXY";var le,he,ce=0,ue=0,pe=0,de=1e3,fe=0,ye=0,_e=0,xe="object"==typeof performance&&performance.now?performance:Date,me="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function ge(){return ye||(me(ve),ye=xe.now()+_e)}function ve(){ye=0}function be(){this._call=this._time=this._next=null}function we(){ge(),++ce;for(var t,e=le;e;)(t=ye-e._time)>=0&&e._call.call(null,t),e=e._next;--ce}function Se(){ye=(fe=xe.now())+_e,ce=ue=0;try{we()}finally{ce=0,function(){var t,e,i=le,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:le=e);he=t,Ae(n)}(),ye=0}}function ke(){var t=xe.now(),e=t-fe;e>de&&(_e-=e,fe=t)}function Ae(t){ce||(ue&&(ue=clearTimeout(ue)),t-ye>24?(t<1/0&&(ue=setTimeout(Se,t-xe.now()-_e)),pe&&(pe=clearInterval(pe))):(pe||(fe=xe.now(),pe=setInterval(ke,de)),ce=1,me(Se)))}function Me(t){return t.ranges}function Te(t){return t.markers}function Pe(t){return t.measures}function Ce(t){var e=t(0);return function(i){return Math.abs(t(i)-e)}}be.prototype={constructor:be,restart:function(t,e,i){if("function"!=typeof t)throw new TypeError("callback is not a function");i=(null==i?ge():+i)+(null==e?0:+e),this._next||he===this||(he?he._next=this:le=this,he=this),this._call=t,this._time=i,Ae()},stop:function(){this._call&&(this._call=null,this._time=1/0,Ae())}};Pt(".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 ze=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=Me,a=Te,r=Pe,s=380,l=30,h=Tt();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=Ce(g),b=Ce(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))})),we()}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);ze.prototype._class+=" chart_Bullet";var Ie=Array.prototype.slice;function Fe(t,e){return t-e}function De(t){return function(){return t}}function Oe(t,e){for(var i,n=-1,o=e.length;++n<o;)if(i=Re(t,e[n]))return i;return 0}function Re(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(je(l,u,e))return 0;c>n!=d>n&&i<(p-h)*(n-c)/(d-c)+h&&(o=-o)}return o}function je(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 Ee(){}var Ne=[[],[[[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 Le(){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(Fe);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,Ne[h<<1].forEach(f);for(;++a<t-1;)l=h,h=i[a+1]>=n,Ne[l|h<<1].forEach(f);Ne[h<<0].forEach(f);for(;++r<e-1;){for(a=-1,h=i[r*t+t]>=n,c=i[r*t]>=n,Ne[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,Ne[l|h<<1|c<<2|u<<3].forEach(f);Ne[h|c<<3].forEach(f)}a=-1,c=i[r*t]>=n,Ne[c<<2].forEach(f);for(;++a<t-1;)u=c,c=i[r*t+a+1]>=n,Ne[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]}}Ne[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!==Oe((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)?De(Ie.call(t)):De(t),a):n},a.smooth=function(t){return arguments.length?(o=t?l:Ee,a):o===l},a}function Be(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 He(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 Ve(t){return t[0]}function qe(t){return t[1]}function We(){return 1}function Ge(){return new Ye}function Ye(){this.reset()}Ye.prototype={constructor:Ye,reset:function(){this.s=this.t=0},add:function(t){Ue(Xe,t,this.t),Ue(this,Xe.s,this.s),this.s?this.t+=Xe.t:this.s=Xe.t},valueOf:function(){return this.s}};var Xe=new Ye;function Ue(t,e,i){var n=t.s=e+i,o=n-e,a=n-o;t.t=e-a+(i-o)}var Qe=2*Math.PI,Ze=Math.abs,Je=Math.sqrt;function Ke(){}function $e(t,e){t&&ei.hasOwnProperty(t.type)&&ei[t.type](t,e)}var ti={Feature:function(t,e){$e(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,n=-1,o=i.length;++n<o;)$e(i[n].geometry,e)}},ei={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){ii(t.coordinates,e,0)},MultiLineString:function(t,e){for(var i=t.coordinates,n=-1,o=i.length;++n<o;)ii(i[n],e,0)},Polygon:function(t,e){ni(t.coordinates,e)},MultiPolygon:function(t,e){for(var i=t.coordinates,n=-1,o=i.length;++n<o;)ni(i[n],e)},GeometryCollection:function(t,e){for(var i=t.geometries,n=-1,o=i.length;++n<o;)$e(i[n],e)}};function ii(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 ni(t,e){var i=-1,n=t.length;for(e.polygonStart();++i<n;)ii(t[i],e,1);e.polygonEnd()}function oi(t,e){t&&ti.hasOwnProperty(t.type)?ti[t.type](t,e):$e(t,e)}function ai(t){return t}var ri,si,li,hi,ci=Ge(),ui=Ge(),pi={point:Ke,lineStart:Ke,lineEnd:Ke,polygonStart:function(){pi.lineStart=di,pi.lineEnd=_i},polygonEnd:function(){pi.lineStart=pi.lineEnd=pi.point=Ke,ci.add(Ze(ui)),ui.reset()},result:function(){var t=ci/2;return ci.reset(),t}};function di(){pi.point=fi}function fi(t,e){pi.point=yi,ri=li=t,si=hi=e}function yi(t,e){ui.add(hi*t-li*e),li=t,hi=e}function _i(){yi(ri,si)}var xi=pi,mi=1/0,gi=mi,vi=-mi,bi=vi,wi={point:function(t,e){t<mi&&(mi=t);t>vi&&(vi=t);e<gi&&(gi=e);e>bi&&(bi=e)},lineStart:Ke,lineEnd:Ke,polygonStart:Ke,polygonEnd:Ke,result:function(){var t=[[mi,gi],[vi,bi]];return vi=bi=-(gi=mi=1/0),t}};var Si,ki,Ai,Mi,Ti=wi,Pi=0,Ci=0,zi=0,Ii=0,Fi=0,Di=0,Oi=0,Ri=0,ji=0,Ei={point:Ni,lineStart:Li,lineEnd:Vi,polygonStart:function(){Ei.lineStart=qi,Ei.lineEnd=Wi},polygonEnd:function(){Ei.point=Ni,Ei.lineStart=Li,Ei.lineEnd=Vi},result:function(){var t=ji?[Oi/ji,Ri/ji]:Di?[Ii/Di,Fi/Di]:zi?[Pi/zi,Ci/zi]:[NaN,NaN];return Pi=Ci=zi=Ii=Fi=Di=Oi=Ri=ji=0,t}};function Ni(t,e){Pi+=t,Ci+=e,++zi}function Li(){Ei.point=Bi}function Bi(t,e){Ei.point=Hi,Ni(Ai=t,Mi=e)}function Hi(t,e){var i=t-Ai,n=e-Mi,o=Je(i*i+n*n);Ii+=o*(Ai+t)/2,Fi+=o*(Mi+e)/2,Di+=o,Ni(Ai=t,Mi=e)}function Vi(){Ei.point=Ni}function qi(){Ei.point=Gi}function Wi(){Yi(Si,ki)}function Gi(t,e){Ei.point=Yi,Ni(Si=Ai=t,ki=Mi=e)}function Yi(t,e){var i=t-Ai,n=e-Mi,o=Je(i*i+n*n);Ii+=o*(Ai+t)/2,Fi+=o*(Mi+e)/2,Di+=o,Oi+=(o=Mi*t-Ai*e)*(Ai+t),Ri+=o*(Mi+e),ji+=3*o,Ni(Ai=t,Mi=e)}var Xi=Ei;function Ui(t){this._context=t}Ui.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,Qe)}},result:Ke};var Qi,Zi,Ji,Ki,$i,tn=Ge(),en={point:Ke,lineStart:function(){en.point=nn},lineEnd:function(){Qi&&on(Zi,Ji),en.point=Ke},polygonStart:function(){Qi=!0},polygonEnd:function(){Qi=null},result:function(){var t=+tn;return tn.reset(),t}};function nn(t,e){en.point=on,Zi=Ki=t,Ji=$i=e}function on(t,e){Ki-=t,$i-=e,tn.add(Je(Ki*Ki+$i*$i)),Ki=t,$i=e}var an=en;function rn(){this._string=[]}function sn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}rn.prototype={_radius:4.5,_circle:sn(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=sn(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 ln=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=Ve,e=qe,n=We,o=960,a=500,r=20,s=2,l=3*r,h=o+2*l>>s,c=a+2*l>>s,u=De(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)})),Be({width:h,height:c,data:a},{width:h,height:c,data:p},r>>s),He({width:h,height:c,data:p},{width:h,height:c,data:a},r>>s),Be({width:h,height:c,data:a},{width:h,height:c,data:p},r>>s),He({width:h,height:c,data:p},{width:h,height:c,data:a},r>>s),Be({width:h,height:c,data:a},{width:h,height:c,data:p},r>>s),He({width:h,height:c,data:p},{width:h,height:c,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 Le().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:De(+e),p):t},p.y=function(t){return arguments.length?(e="function"==typeof t?t:De(+t),p):e},p.weight=function(t){return arguments.length?(n="function"==typeof t?t:De(+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)?De(Ie.call(t)):De(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)),oi(t,i(n))),n.result()}return a.area=function(t){return oi(t,i(xi)),xi.result()},a.measure=function(t){return oi(t,i(an)),an.result()},a.bounds=function(t){return oi(t,i(Ti)),Ti.result()},a.centroid=function(t){return oi(t,i(Xi)),Xi.result()},a.projection=function(e){return arguments.length?(i=null==e?(t=null,ai):(t=e).stream,a):t},a.context=function(t){return arguments.length?(n=null==t?(e=null,new rn):new Ui(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}(zt);ln.prototype._class+=" chart_Contour",ln.prototype.implements(e.I1DChart.prototype),ln.prototype.publish("paletteID","YlGnBu","string","Color palette for this widget"),ln.prototype.publish("useClonedPalette",!0,"boolean","Enable or disable using a cloned palette"),ln.prototype.publish("showContourFill",!0,"boolean","Show/hide the contour background colors"),ln.prototype.publish("showContour",!0,"boolean","Show/hide the contour border lines"),ln.prototype.publish("contourBandwidth",40,"number","Controls the sensitivity of the contour grouping algorithm"),ln.prototype.publish("contourStrokeColor","#2C3A47","html-color","Color of the contour border lines"),ln.prototype.publish("contourStrokeWidth",1,"number","Width of the contour border lines");var hn=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}(Ot);function cn(t){return function(){return t}}hn.prototype._class+=" chart_Gantt";var un=1e-12,pn=Math.PI,dn=pn/2,fn=2*pn;function yn(t){return t.innerRadius}function _n(t){return t.outerRadius}function xn(t){return t.startAngle}function mn(t){return t.endAngle}function gn(t){return t&&t.padAngle}function vn(t){return t>=1?dn:t<=-1?-dn:Math.asin(t)}function bn(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 wn(t){this._context=t}function Sn(t){return new wn(t)}function kn(t){return t[0]}function An(t){return t[1]}function Mn(){}function Tn(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 Pn(t){this._context=t}function Cn(t,e){this._basis=new Pn(t),this._beta=e}function zn(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 In(t,e){this._context=t,this._k=(1-e)/6}function Fn(t,e){this._context=t,this._k=(1-e)/6}function Dn(t,e){this._context=t,this._k=(1-e)/6}function On(t,e,i){var n=t._x1,o=t._y1,a=t._x2,r=t._y2;if(t._l01_a>un){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>un){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 Rn(t,e){this._context=t,this._alpha=e}wn.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)}}},Pn.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:Tn(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:Tn(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},Cn.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 Pn(t):new Cn(t,e)}return i.beta=function(e){return t(+e)},i}(.85),In.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:zn(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:zn(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}},function t(e){function i(t){return new In(t,e)}return i.tension=function(e){return t(+e)},i}(0),Fn.prototype={areaStart:Mn,areaEnd:Mn,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:zn(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 Fn(t,e)}return i.tension=function(e){return t(+e)},i}(0),Dn.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:zn(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 Dn(t,e)}return i.tension=function(e){return t(+e)},i}(0),Rn.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){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:On(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 jn=function t(e){function i(t){return e?new Rn(t,e):new In(t,0)}return i.alpha=function(e){return t(+e)},i}(.5);function En(t,e){this._context=t,this._alpha=e}function Nn(t,e){this._context=t,this._alpha=e}function Ln(t){return t<0?-1:1}function Bn(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(Ln(a)+Ln(r))*Math.min(Math.abs(a),Math.abs(r),.5*Math.abs(s))||0}function Hn(t,e){var i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function Vn(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 qn(t){this._context=t}En.prototype={areaStart:Mn,areaEnd:Mn,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:On(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 En(t,e):new Fn(t,0)}return i.alpha=function(e){return t(+e)},i}(.5),Nn.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:On(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 Nn(t,e):new Dn(t,0)}return i.alpha=function(e){return t(+e)},i}(.5),qn.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:Vn(this,this._t0,Hn(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,Vn(this,Hn(this,i=Bn(this,t,e)),i);break;default:Vn(this,this._t0,i=Bn(this,t,e))}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=i}}},Object.create(qn.prototype).point=function(t,e){qn.prototype.point.call(this,e,t)};var Wn="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},Gn=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},Yn=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}}(),Xn=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},Un=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},Qn=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)},Zn=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},Jn=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;Gn(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 Yn(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}(),Kn=function(){function t(e){var i=e.annotations,n=e.accessors,o=e.accessorsInverse;Gn(this,t),this.accessors=n,this.accessorsInverse=o,this.annotations=i}return Yn(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 Xn({},t.type.getNoteBBoxOffset(),{positionX:t.x,positionY:t.y})}))}}]),t}(),$n=function(t,e){return"dynamic"!==t&&"left"!==t&&"right"!==t||(t=e<0?"top":"bottom"),t},to=function(t,e){return"dynamic"!==t&&"top"!==t&&"bottom"!==t||(t=e<0?"right":"left"),t},eo=["topBottom","top","bottom"],io=["leftRight","left","right"],no=function(t){var e=t.data,i=t.curve,n=void 0===i?Sn:i,o=t.canvasContext,a=t.className,r=t.classID,s=function(){var t=kn,e=An,i=cn(!0),n=null,o=Sn,a=null;function r(r){var s,l,h,c=r.length,u=!1;for(null==n&&(a=o(h=f())),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:cn(+e),r):t},r.y=function(t){return arguments.length?(e="function"==typeof t?t:cn(+t),r):e},r.defined=function(t){return arguments.length?(i="function"==typeof t?t:cn(!!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},oo=function(t){var e=t.data,i=t.canvasContext,n={type:"path",className:t.className,classID:t.classID,data:e},o=function(){var t=yn,e=_n,i=cn(0),n=null,o=xn,a=mn,r=gn,s=null;function l(){var l,h,c=+t.apply(this,arguments),u=+e.apply(this,arguments),p=o.apply(this,arguments)-dn,d=a.apply(this,arguments)-dn,y=Math.abs(d-p),_=d>p;if(s||(s=l=f()),u<c&&(h=u,u=c,c=h),u>un)if(y>fn-un)s.moveTo(u*Math.cos(p),u*Math.sin(p)),s.arc(0,0,u,p,d,!_),c>un&&(s.moveTo(c*Math.cos(d),c*Math.sin(d)),s.arc(0,0,c,d,p,_));else{var x,m,g=p,v=d,b=p,w=d,S=y,k=y,A=r.apply(this,arguments)/2,M=A>un&&(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>un){var z=vn(M/c*Math.sin(A)),I=vn(M/u*Math.sin(A));(S-=2*z)>un?(b+=z*=_?1:-1,w-=z):(S=0,b=w=(p+d)/2),(k-=2*I)>un?(g+=I*=_?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>un){var j=u*Math.cos(v),E=u*Math.sin(v),N=c*Math.cos(b),L=c*Math.sin(b);if(y<pn){var B=S>un?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>un?C>un?(x=bn(N,L,F,D,u,C,_),m=bn(j,E,O,R,u,C,_),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),!_):(s.arc(x.cx,x.cy,C,Math.atan2(x.y01,x.x01),Math.atan2(x.y11,x.x11),!_),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),!_),s.arc(m.cx,m.cy,C,Math.atan2(m.y11,m.x11),Math.atan2(m.y01,m.x01),!_))):(s.moveTo(F,D),s.arc(0,0,u,g,v,!_)):s.moveTo(F,D),c>un&&S>un?P>un?(x=bn(O,R,j,E,c,-P,_),m=bn(F,D,N,L,c,-P,_),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),!_):(s.arc(x.cx,x.cy,P,Math.atan2(x.y01,x.x01),Math.atan2(x.y11,x.x11),!_),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),_),s.arc(m.cx,m.cy,P,Math.atan2(m.y11,m.x11),Math.atan2(m.y01,m.x01),!_))):s.arc(0,0,c,w,b,_):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-pn/2;return[Math.cos(n)*i,Math.sin(n)*i]},l.innerRadius=function(e){return arguments.length?(t="function"==typeof e?e:cn(+e),l):t},l.outerRadius=function(t){return arguments.length?(e="function"==typeof t?t:cn(+t),l):e},l.cornerRadius=function(t){return arguments.length?(i="function"==typeof t?t:cn(+t),l):i},l.padRadius=function(t){return arguments.length?(n=null==t?null:"function"==typeof t?t:cn(+t),l):n},l.startAngle=function(t){return arguments.length?(o="function"==typeof t?t:cn(+t),l):o},l.endAngle=function(t){return arguments.length?(a="function"==typeof t?t:cn(+t),l):a},l.padAngle=function(t){return arguments.length?(r="function"==typeof t?t:cn(+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},ao=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]]},ro=function(t){var e=t.type,n=t.connectorData,o=t.subjectType;n||(n={}),n.points&&"number"!=typeof n.points||(n.points=so(e.annotation.offset,n.points)),n.curve||(n.curve=jn);var a=[];if(e.editMode){var r=n.points.map((function(t,e){return Xn({},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 Xn({},t.move,{drag:s.bind(e,t.index)})})))}var l=ao({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:[no({data:l,curve:n.curve,className:"connector"})],handles:a}},so=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},lo=function(t){var e=t.subjectData,n=t.type;e.radius||e.outerRadius||(e.radius=20);var o=[],a=oo({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=[Xn({},r.r1,{drag:s.bind(n,void 0!==e.outerRadius?"outerRadius":"radius")})];e.innerRadius&&l.push(Xn({},r.r2,{drag:s.bind(n,"innerRadius")})),o=n.mapHandles(l)}return a.attrs["fill-opacity"]=0,{components:[a],handles:o}},ho=function(){function t(e){var i=e.a,n=e.annotation,o=e.editMode,a=e.dispatcher,r=e.notePadding,s=e.accessors;if(Gn(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=xo.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 Yn(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{_o(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 go(this.note,".annotation-note-content text")}},{key:"getNoteBBoxOffset",value:function(){var t=go(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=lo(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=no({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:[no({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=oo({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=oo({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=no({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=no({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?ro(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:[no({data:p,className:"connector"})]}}(o):function(t){var e=ao(t);return{components:[no({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:[no({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=oo({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=$n(e,s.y))?a-=r.height:"middle"===e&&(a-=r.height/2);var l=[[n,a],[n,a+r.height]];return{components:[no({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=to(e,r.x))?n-=s.width:"middle"===e&&(n-=s.width/2);var l=[[n,a],[n+s.width,a]];return{components:[no({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,y: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!==eo.indexOf(r)?(a=to(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!==io.indexOf(r)&&(a=$n(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 Xn({},t,{start:e.dragstarted.bind(e),end:e.dragended.bind(e)})}))}}]),t}(),co=function(t,e,i){return function(t){function n(t){Gn(this,n);var i=Zn(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 Qn(n,t),Yn(n,[{key:"className",value:function(){return""+(e.className||Un(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"className",this)&&Un(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"className",this).call(this)||"")}},{key:"drawSubject",value:function(t){return this.typeSettings.subject=Xn({},e.subject,this.typeSettings.subject),Un(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"drawSubject",this).call(this,Xn({},t,this.typeSettings.subject))}},{key:"drawConnector",value:function(t){return this.typeSettings.connector=Xn({},e.connector,this.typeSettings.connector),Un(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"drawConnector",this).call(this,Xn({},t,e.connector,this.typeSettings.connector))}},{key:"drawNote",value:function(t){return this.typeSettings.note=Xn({},e.note,this.typeSettings.note),Un(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"drawNote",this).call(this,Xn({},t,e.note,this.typeSettings.note))}},{key:"drawNoteContent",value:function(t){return Un(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"drawNoteContent",this).call(this,Xn({},t,e.note,this.typeSettings.note))}}],[{key:"init",value:function(t,e){return Un(n.__proto__||Object.getPrototypeOf(n),"init",this).call(this,t,e),i&&(t=i(t,e)),t}}]),n}(t)},uo=function(t){function e(t){Gn(this,e);var i=Zn(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return i.textWrap=t.textWrap||120,i.drawText(),i}return Qn(e,t),Yn(e,[{key:"updateTextWrap",value:function(t){this.textWrap=t,this.drawText()}},{key:"drawText",value:function(){if(this.note){_o(this.note,[this.annotation],"g","annotation-note-content");var t=this.note.select("g.annotation-note-content");_o(t,[this.annotation],"rect","annotation-note-bg"),_o(t,[this.annotation],"text","annotation-note-label"),_o(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":Wn(a))&&(r=Xn(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(mo,n,o),e=s.node().getBBox()}i.text(this.annotation.note.label).attr("dx","0"),i.call(mo,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}(ho);co(uo,{className:"label",note:{align:"middle"}});var po=co(uo,{className:"callout",note:{lineType:"horizontal"}}),fo=co(po,{className:"callout elbow",connector:{type:"elbow"}});co(po,{className:"callout curve",connector:{type:"curve"}}),co(ho,{className:"badge",subject:{type:"badge"},disable:["connector","note"]}),co(uo,{className:"callout circle",subject:{type:"circle"},note:{lineType:"horizontal"},connector:{type:"elbow"}}),co(uo,{className:"callout rect",subject:{type:"rect"},note:{lineType:"horizontal"},connector:{type:"elbow"}});var yo=function(t){function e(){return Gn(this,e),Zn(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return Qn(e,t),Yn(e,[{key:"mapY",value:function(t){Un(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){Un(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}(po);co(yo,{className:"callout xythreshold",subject:{type:"threshold"}});var _o=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},xo=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)}))},mo=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))}))},go=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 vo(t){return.65*(t-.5)*2*Math.PI}function bo(t,e){return{x:Math.cos(t-Math.PI/2)*e,y:Math.sin(t-Math.PI/2)*e}}function wo(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=bo(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 So(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 ko=function(t){function e(){var e=t.call(this)||this;return e._d3Arc=O().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=po,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 Jn(t)}));e=e||new Kn({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");_o(y,e.annotations,"g","annotation"),y.selectAll("g.annotation").each((function(t){var e=i.select(this);e.attr("class","annotation"),_o(e,[t],"g","annotation-connector"),_o(e,[t],"g","annotation-subject"),_o(e,[t],"g","annotation-note"),_o(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(fo).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:vo(0),endAngle:vo(0)}).style("fill","green").on("mousemove",(function(t){var e=n._d3Arc.centroid(t),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:vo(0),endAngle:vo(1)}).style("fill","lightGrey"),this._meanArc=i.append("path").datum({startAngle:vo(0),endAngle:vo(0)}).style("fill","black").on("mousemove",(function(t){var e=n._d3Arc.centroid(t),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:vo(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=o._d3Arc.centroid(o._meanArc.datum()),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",So(vo(0),vo(s),this._d3Arc)),this._freeArc.style("fill",this.emptyColor()).transition().duration(750).attrTween("d",So(vo(s),vo(1),this._d3Arc)),this._meanArc.style("fill",this.tickColor()).style("visibility",this.showTick()?"visible":"hidden").transition().duration(750).attrTween("d",So(vo(l-.001),vo(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",wo(vo(l),a,!0)),this._indOuter.style("fill",this.tickColor()).style("stroke",this.tickColor()).style("visibility",this.showTick()?"visible":"hidden").transition().duration(750).attrTween("transform",wo(vo(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=bo(vo(1),a-8);this.updateText(this._centerText,-h.x,-h.y,2*h.x,2*h.y);var c=bo(vo(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);ko.prototype._class+=" chart_Gauge",ko.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."),ko.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."),ko.prototype.publish("emptyColor","lightgrey","html-color","Color of the empty portion of the gauge"),ko.prototype.publish("tickColor","black","html-color","Color of the tick");Pt(".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 Ao=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=H,e=B,i=null,n=y(0),o=y(M),a=y(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(M,Math.max(-M,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:y(+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:y(+t),r):n},r.endAngle=function(t){return arguments.length?(o="function"==typeof t?t:y(+t),r):o},r.padAngle=function(t){return arguments.length?(a="function"==typeof t?t:y(+t),r):a},r}(),n.d3Arc=O(),n.d3LabelArc=O(),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(),h=s+12;this.d3Arc.innerRadius(r).padRadius(s).outerRadius(s),this._quadIdxArr=[[],[],[],[]];var c=l([],this.data(),!0).sort((function(t,e){return t[1]-e[1]>0?-1:1})),u=this._slices.selectAll(".arc").data(this.d3Pie(c),(function(t){return t.data[0]}));this._labelPositions=[],u.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",_(0,0)).on("mouseout",_(-5,150))})).merge(u).transition().attr("opacity",1).each((function(t,e){var n=a.getQuadrant(y(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]))})),u.exit().transition().style("opacity",0).remove(),this.d3LabelArc.innerRadius(h).outerRadius(h);var p=this._labels.selectAll("text").data(this.showLabels()?this.d3Pie(c):[],(function(t){return t.data[0]})),d=p.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(p).text((function(t){return o.getLabelText(t,!0)})).each((function(t,e){var i=a.d3LabelArc.centroid(t),n=y(t);i[0]=h*(a.isLeftSide(n)?1:-1),a._labelPositions.push({top:i[1],bottom:i[1]+a.labelHeight()})}));this.showLabels()&&(this.adjustForOverlap(),d.transition().style("font-size",this.labelHeight()+"px").attr("transform",(function(t,e){var i=a.d3LabelArc.centroid(t);return i[0]=h*(a.isLeftSide(y(t))?1:-1),i[1]=a._labelPositions[e].top,"translate("+i+")"})).style("text-anchor",(function(t){return o.isLeftSide(y(t))?"start":"end"}))),p.exit().remove();var f=this._labels.selectAll("polyline").data(this.showLabels()?this.d3Pie(c):[],(function(t){return o.getLabelText(t,!0)}));function y(t){return t.startAngle+(t.endAngle-t.startAngle)/2}function _(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)}}))}}f.enter().append("polyline").merge(f).transition().attr("points",(function(t,e){var i=a.d3LabelArc.centroid(t),n=a.d3Arc.centroid(t),o=l([],i,!0);return i[0]=h*(a.isLeftSide(y(t))?1:-1),i[1]=a._labelPositions[e].top,[n,o,i]})),f.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()));this.d3Pie.padAngle(.0025).startAngle(t).endAngle(2*Math.PI+t).sort((function(t,e){return e[1]<t[1]?-1:e[1]>t[1]?1:0})).value((function(t){return t[1]}))},o.__inputs=[{id:"label",type:"string"},{id:"value",type:"number"}],o}(i.SVGWidget);Ao.prototype._class+=" chart_Pie",Ao.prototype.implements(e.I2DChart.prototype),Ao.prototype.implements(e.ITooltip.prototype),Ao.prototype.mixin(i.Utility.SimpleSelectionMixin),Ao.prototype.publish("showLabels",!0,"boolean","If true, wedge labels will display"),Ao.prototype.publish("showSeriesValue",!1,"boolean","Append data series value next to label",null,{disable:function(t){return!t.showLabels()}}),Ao.prototype.publish("seriesValueFormat",",.0f","string","Number format used for formatting series values",null,{disable:function(t){return!t.showSeriesValue()}}),Ao.prototype.publish("showSeriesPercentage",!1,"boolean","Append data series percentage next to label",null,{disable:function(t){return!t.showLabels()}}),Ao.prototype.publish("seriesPercentageFormat",",.0f","string","Number format used for formatting series percentages",null,{disable:function(t){return!t.showSeriesPercentage()}}),Ao.prototype.publish("paletteID","default","set","Color palette for this widget",Ao.prototype._palette.switch(),{tags:["Basic","Shared"]}),Ao.prototype.publish("useClonedPalette",!1,"boolean","Enable or disable using a cloned palette",null,{tags:["Intermediate","Shared"]}),Ao.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}}),Ao.prototype.publish("minOuterRadius",20,"number","Minimum outer radius (pixels)"),Ao.prototype.publish("startAngle",0,"number","Starting angle of the first (and largest) wedge (degrees)"),Ao.prototype.publish("labelHeight",12,"number","Font size of labels (pixels)",null,{disable:function(t){return!t.showLabels()}});var Mo=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}(Ao);Mo.prototype._class+=" chart_HalfPie";var To=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=Po(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=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}(zt);function Po(t){if(!(this instanceof Po))return new Po(t);this._canvas=t="string"==typeof t?document.getElementById(t):t,this._ctx=t.getContext("2d"),this._width=t.width,this._height=t.height,this._max=1,this._data=[]}To.prototype._class+=" chart_Heat",To.prototype._palette=i.Palette.rainbow("default"),To.prototype.publish("paletteID","default","set","Color palette for this widget",To.prototype._palette.switch(),{tags:["Basic"]}),To.prototype.publish("useClonedPalette",!1,"boolean","Enable or disable using a cloned palette",null,{tags:["Intermediate","Shared"]}),To.prototype.publish("reversePalette",!1,"boolean","Reverse Palette Colors",null,{disable:function(t){return"default"===t.paletteID()}}),To.prototype.publish("radiusX",25,"number","Point X radius (25 by default)"),To.prototype.publish("radiusY",25,"number","Point Y radius (25 by default)"),To.prototype.publish("radiusAsPercent",!1,"boolean","Calculate RadiusX + RadiusY as % of size"),To.prototype.publish("blur",15,"number","Point blur radius (15 by default)"),To.prototype.publish("minOpacity",.05,"number","Minimum point opacity (0.05 by default)"),Po.prototype={defaultRadius:25,defaultGradient:{.4:"blue",.6:"cyan",.7:"lime",.8:"yellow",1:"red"},data:function(t){return this._data=t,this},max:function(t){return this._max=t,this},add:function(t){return this._data.push(t),this},clear:function(){return this._data=[],this},radius:function(t,e,i){i=void 0===i?15:i;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],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 Co=Math.PI/3,zo=[0,Co,2*Co,3*Co,4*Co,5*Co];function Io(t){return t[0]}function Fo(t){return t[1]}Pt(".chart_HexBin .hexagon{fill:none;stroke:#000;stroke-width:.5px}.chart_HexBin .hexagon.selected{stroke:red}");var Do=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=Io,l=Fo;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 zo.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(Co),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}(zt);Do.prototype._class+=" chart_HexBin",Do.prototype.implements(e.I2DAggrChart.prototype),Do.prototype.implements(e.ITooltip.prototype),Do.prototype.publish("paletteID","Blues","set","Color palette for this widget",Do.prototype._palette.switch(),{tags:["Basic","Shared"]}),Do.prototype.publish("useClonedPalette",!1,"boolean","Enable or disable using a cloned palette",null,{tags:["Intermediate","Shared"]}),Do.prototype.publish("binSize",20,"number","Bin radius",null,{range:{min:1,max:300,step:1}});Pt(".chart_Line .dataLine{fill:none;stroke:#4682b4;stroke-width:1.5px}");var Oo=function(t){function e(){var e=t.call(this)||this;return e.interpolate_default("linear"),e}return a(e,t),e}(It);Oo.prototype._class+=" chart_Line";var Ro=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}(Ao);Ro.prototype._class+=" chart_QuarterPie",Ro.prototype.publish("orientation","left","set","Determines the placement and start/end angle.",["left","right"]);var jo=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);jo.prototype._class+=" chart_QuartileCandlestick",jo.prototype.publish("textColor","black","html-color","Color of label and value text"),jo.prototype.publish("showLabels",!0,"boolean","If true, labels will be shown"),jo.prototype.publish("showValues",!0,"boolean","If true, values will be shown"),jo.prototype.publish("orientation","horizontal","set","Determines layout",["horizontal","vertical"]),jo.prototype.publish("valueFontSize",12,"number","Font size of value text (pixels)"),jo.prototype.publish("labelFontSize",12,"number","Font size of label text (pixels)"),jo.prototype.publish("roundedCorners",8,"number","Radius of rounded rect corners (pixels)"),jo.prototype.publish("lineWidth",4,"number","Width of lines (pixels)"),jo.prototype.publish("candleWidth",null,"number","Height of outer rect (pixels)",null,{optional:!0}),jo.prototype.publish("textPadding",8,"number","Padding between outer rect and text (pixels)"),jo.prototype.publish("edgePadding",30,"number","Padding between outer rect and left/right sides (pixels)"),jo.prototype.publish("lineColor","#333","html-color","Color of outer rect and lines"),jo.prototype.publish("innerRectColor","white","html-color","Color of the inner rects"),jo.prototype.publish("upperTextRotation",-60,"number","Rotation of label text (degrees)"),jo.prototype.publish("lowerTextRotation",-60,"number","Rotation of value text (degrees)");Pt(".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 Eo=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);Eo.prototype._class+=" chart_Radar",Eo.prototype.implements(e.INDChart.prototype),Eo.prototype.implements(e.ITooltip.prototype),Eo.prototype.mixin(i.Utility.SimpleSelectionMixin),Eo.prototype.publish("paletteID","default","set","Color palette for this widget",Eo.prototype._palette.switch()),Eo.prototype.publish("pointShape","cross","set","pointShape",["circle","rectangle","cross"]),Eo.prototype.publish("pointSize",6,"number","Point Size",null,{range:{min:1,step:1,max:200}}),Eo.prototype.publish("valueGuideRatios",[.2,.4,.6,.8,1],"array","Array of values between 0 and 1 that are multiplied by the widget radius to produce guide lines"),Eo.prototype.publish("fillOpacity",.66,"number","Opacity of the data polygon(s)"),Eo.prototype.publish("fontFamily","","string","fontFamily"),Eo.prototype.publish("fontSize",16,"number","fontSize"),Eo.prototype.publish("labelPaddingRatio",.9,"number","labelPaddingRatio");Pt(".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 No=function(t){function n(){var n=t.call(this)||this;return n._domainScale=i.scaleBand(),n._valueScale=i.scaleLinear(),n._d3Arc=O().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,l([this.valueDomainHigh_exists()?this.valueDomainHigh():0],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()),h=this.textSize(s.map((function(t){return""+t})),"Verdana",12).width,c=Math.min(this.width()-2*(10+h),this.height()-44)/2,u=this.data().map((function(t){return t[0]}));this._domainScale.domain(u).range([0,c]).padding(this.domainPadding());var p=this._domainScale.step()*this._domainScale.padding(),d=this._radialAxis.selectAll("circle").data(u);d.enter().append("circle").attr("fill","transparent").merge(d).attr("r",(function(t){return o._domainScale(t)+o._domainScale.step()-p/2})),d.exit().remove();var f=this._radialAxis.selectAll(".arc-text").data(u);f.enter().append("text").attr("class","arc-text").attr("x",-4).attr("alignment-baseline","middle").attr("text-anchor","end").merge(f).attr("y",(function(t){return-o._domainScale(t)-o._domainScale.bandwidth()/2})).text((function(t){return t})),f.exit().remove();var y=this._axialAxis.selectAll("line").data(s);y.enter().append("line").merge(y).attr("x2",(function(t){return c*Math.cos(o._valueScale(t)-o.radians(90))})).attr("y2",(function(t){return c*Math.sin(o._valueScale(t)-o.radians(90))})),y.exit().remove();var _=this._axialAxis.selectAll("text").data(s);_.enter().append("text").style("dominant-baseline","central").merge(_).attr("x",(function(t){return(c+10)*Math.cos(o._valueScale(t)-o.radians(90))})).attr("y",(function(t){return(c+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})),_.exit().remove();var x=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 m=this._arcs.selectAll("path").data(this.data(),(function(t){return t[0]}));m.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),x,a._selection.selected(this))})).on("dblclick",(function(t,e){a.dblclick(a.rowToObj(t),x,a._selection.selected(this))})).merge(m).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)}})),m.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);No.prototype._class+=" chart_RadialBar",No.prototype.implements(e.INDChart.prototype),No.prototype.implements(e.ITooltip.prototype),No.prototype.mixin(i.Utility.SimpleSelectionMixin),No.prototype.publish("paletteID","default","set","Color palette for this widget",No.prototype._palette.switch()),No.prototype.publish("tickCount",10,"number","Number of ticks to display"),No.prototype.publish("domainPadding",.25,"number","Padding between chart edge and container edge (0..1)"),No.prototype.publish("valueMaxAngle",270,"number","Maximum angular length of a bar (degrees)"),No.prototype.publish("valueDomainHigh",null,"number","Value domain high",void 0,{optional:!0}),No.prototype.publish("transitionDelay",100,"number","Delay between the start of each row animation (ms)"),No.prototype.publish("transitionDuration",750,"number","Duration of a row's animation (ms)");var Lo=i.Palette.rainbow("Blues"),Bo=i.Palette.ordinal("Quartile",[Lo(100,0,100),Lo(50,0,100),Lo(50,0,100),Lo(75,0,100)]);Bo("Std. Dev."),Bo("MinMax"),Bo("25%"),Bo("50%");var Ho=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._bellCurve=(new It).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 jo).columns(["Min","25%","50%","75%","Max"]).edgePadding(0).roundedCorners(1).lineWidth(1).upperTextRotation(-90).lowerTextRotation(-90).labelFontSize(0).valueFontSize(0).lineColor(Lo(90,0,100)).innerRectColor(Lo(10,0,100)),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.data()[0][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.mean=function(t){return arguments.length?(this._mean=t,this.data()[0]&&(this.data()[0][5]=t),this):this._mean},e.prototype.standardDeviation=function(t){return arguments.length?(this._standardDeviation=t,this.data()[0]&&(this.data()[0][6]=t),this):this._standardDeviation},e.prototype.quartiles=function(t){return arguments.length?(this._quartiles=t,this.data()[0]&&(this.data()[0]=t.concat(this.data()[0].slice(-2))),this):this._quartiles},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._selectMode=i.append("div").style("position","absolute").style("top","0px").style("right","0px").append("select").on("change",(function(){n.render()})),this._selectMode.append("option").attr("value","min_max").text("Min / Max"),this._selectMode.append("option").attr("value","25_75").text("25% / 75%"),this._selectMode.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=this.domain(this._selectMode.node().value),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._selectMode.node().value,e=this.domain(t),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.data()[0]&&7===this.data()[0].length&&(this.quartiles(this.data()[0].slice(0,5)),this.mean(this.data()[0][5]),this.standardDeviation(this.data()[0][6])),this.updateScatter(),this.updateCandle()},e}(i.HTMLWidget);Ho.prototype.publish("tickFormat",".2e","string","X-Axis Tick Format"),Ho.prototype.publish("candleHeight",20,"number","Height of candle widget (pixels)"),Ho.prototype.publish("domainPadding",10,"number","Domain value padding");var Vo=function(t){function e(){var e=t.call(this)||this;return e.interpolate_default("step"),e}return a(e,t),e}(It);Vo.prototype._class+=" chart_Step";Pt(".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 qo="text",Wo="html",Go=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()?Wo:qo](a.value),this._textDiv.style("font-size",this.textFontSize()+"px")[this.labelHTML()?Wo:qo](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);Go.prototype._class+=" chart_Summary",Go.prototype.implements(e.I2DChart.prototype),Go.prototype.publish("iconColumn",null,"set","Select Icon Column",(function(){return this.columns()}),{optional:!0}),Go.prototype.publish("icon","fa-briefcase","string","FA Char icon class",null,{disable:function(t){return t.iconColumn()}}),Go.prototype.publish("headerFontSize",null,"number","headerFontSize"),Go.prototype.publish("textFontSize",null,"number","textFontSize"),Go.prototype.publish("moreFontSize",null,"number","moreFontSize"),Go.prototype.publish("iconFontSize",null,"number","iconFontSize"),Go.prototype.publish("hideLabel",!1,"boolean","Hide label column"),Go.prototype.publish("labelColumn",null,"set","Select display value",(function(){return this.columns()}),{optional:!0,disable:function(t){return t.hideLabel()}}),Go.prototype.publish("labelHTML",!1,"boolean","Allow HTML",null,{disable:function(t){return t.hideLabel()}}),Go.prototype.publish("valueColumn",null,"set","Select display value",(function(){return this.columns()}),{optional:!0}),Go.prototype.publish("valueHTML",!1,"boolean","Allow HTML"),Go.prototype.publish("hideMore",!1,"boolean","Hide More Information"),Go.prototype.publish("hideMoreWrapper",!1,"boolean","Hide More Information Wrapper"),Go.prototype.publish("moreWrapperHeight",null,"number","Height of the 'more' text wrapper (pixels)"),Go.prototype.publish("moreIconColumn",null,"set","Select More Icon Column",(function(){return this.columns()}),{optional:!0,disable:function(t){return t.hideMore()}}),Go.prototype.publish("moreIcon","fa-info-circle","string","FA Char icon class",null,{disable:function(t){return t.hideMore()||t.moreIconColumn()}}),Go.prototype.publish("moreTextColumn",null,"set","Select display value",(function(){return this.columns()}),{optional:!0,disable:function(t){return t.hideMore()}}),Go.prototype.publish("moreText","More Info","string","More text",null,{disable:function(t){return t.hideMore()||t.moreTextColumn()}}),Go.prototype.publish("moreTextHTML",!1,"boolean","Allow HTML",null,{disable:function(t){return t.hideMore()}}),Go.prototype.publish("colorFillColumn",null,"set","Column for color",(function(){return this.columns()}),{optional:!0}),Go.prototype.publish("colorFill","#3498db","html-color","Fill Color",null,{disable:function(t){return t.colorFillColumn()}}),Go.prototype.publish("colorStrokeColumn",null,"set","Column for color",(function(){return this.columns()}),{optional:!0}),Go.prototype.publish("colorStroke","#ffffff","html-color","Fill Color",null,{disable:function(t){return t.colorStrokeColumn()}}),Go.prototype.publish("fixedSize",!0,"boolean","Fix Size to Min Width/Height"),Go.prototype.publish("minWidth",225,"number","Minimum Width"),Go.prototype.publish("minHeight",150,"number","Minimum Height"),Go.prototype.publish("playInterval",null,"number","Play Interval",null,{optional:!0});var Yo=Go.prototype.playInterval;Go.prototype.playInterval=function(t){var e=Yo.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 Xo=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);Xo.prototype._class+=" chart_SummaryC",Xo.prototype.implements(e.I2DChart.prototype),Xo.prototype.publish("iconBaseline","bottom","string","Text baseline for the icon",["top","middle","bottom"]),Xo.prototype.publish("iconAnchor","end","set","Anchors the icon either at the start, middle, or end of the summary",["start","middle","end"]),Xo.prototype.publish("valueAnchor","start","set","Anchors the value either at the start, middle, or end of the summary",["start","middle","end"]),Xo.prototype.publish("labelAnchor","start","set","Anchors the label either at the start, middle, or end of the summary",["start","middle","end"]),Xo.prototype.publish("iconColumn",null,"set","Select Icon Column",(function(){return this.columns()}),{optional:!0}),Xo.prototype.publish("icon","fa-briefcase","string","FA Char icon class",null,{disable:function(t){return t.iconColumn()}}),Xo.prototype.publish("fontFamily","Arial","string","Font Family"),Xo.prototype.publish("labelColumn",null,"set","Select display value",(function(){return this.columns()}),{optional:!0}),Xo.prototype.publish("valueColumn",null,"set","Select display value",(function(){return this.columns()}),{optional:!0}),Xo.prototype.publish("colorFillColumn",null,"set","Column for background color",(function(){return this.columns()}),{optional:!0}),Xo.prototype.publish("colorFill","#0097e6","html-color","Background Color",null,{disable:function(t){return t.colorFillColumn()}}),Xo.prototype.publish("colorStrokeColumn",null,"set","Column for font color",(function(){return this.columns()}),{optional:!0}),Xo.prototype.publish("colorStroke","#2f3640","html-color","Font Color",null,{disable:function(t){return t.colorStrokeColumn()}}),Xo.prototype.publish("fixedSize",!0,"boolean","Fix Size to Min Width/Height"),Xo.prototype.publish("minWidth",225,"number","Minimum Width"),Xo.prototype.publish("minHeight",150,"number","Minimum Height"),Xo.prototype.publish("playInterval",null,"number","Play Interval",null,{optional:!0}),Xo.prototype.publish("fontSizeRatio",.618,"number","Ratio between widget height and value font size"),Xo.prototype.publish("valueOpacity",1,"number","Opacity of value text (0..1)"),Xo.prototype.publish("labelOpacity",.9,"number","Opacity of label text (0..1)"),Xo.prototype.publish("iconOpacity",.3,"number","Opacity of icon text (0..1)"),Xo.prototype.publish("paddingSizeRatio",.1,"number","Ratio of the smallest dimension for edge padding (0..1)"),Xo.prototype.publish("iconSizeRatio",.9,"number","Ratio of the height for icon size (0..1)");var Uo=Xo.prototype.playInterval;Xo.prototype.playInterval=function(t){var e=Uo.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 Qo=Math.PI/180,Zo=64,Jo=2048;function Ko(){var t=i.dispatch("word","end"),e={},n=[256,256],o=$o,a=ta,r=ia,s=ea,l=ea,h=na,c=oa,u=[],p=la,d=1/0,f=null,y=Math.random,_=ha;function x(t,e,i){for(var o,a,r,s,l,h=e.x,c=e.y,u=Math.sqrt(n[0]*n[0]+n[1]*n[1]),d=p(n),f=y()<.5?1:-1,_=-f;(o=d(_+=f))&&(a=~~o[0],r=~~o[1],!(Math.min(Math.abs(a),Math.abs(r))>=u));)if(e.x=h+a,e.y=c+r,!(e.x+e.x0<0||e.y+e.y0<0||e.x+e.x1>n[0]||e.y+e.y1>n[1]||i&&ra(e,t,n[0])||i&&(l=i,!((s=e).x+s.x1>l[0].x&&s.x+s.x0<l[1].x&&s.y+s.y1>l[0].y&&s.y+s.y0<l[1].y)))){for(var x=e.sprite,m=e.width>>5,g=n[0]>>5,v=e.x-(m<<4),b=127&v,w=32-b,S=e.y1-e.y0,k=(e.y+e.y0)*g+(v>>5),A=void 0,M=0;M<S;M++){A=0;for(var T=0;T<=m;T++)t[k+T]|=A<<w|(T<m?(A=x[M*m+T])>>>b:0);k+=g}return delete e.sprite,!0}return!1}return e.canvas=function(t){return arguments.length?(_=ca(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=(Zo<<5)/e,t.height=Jo/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,aa(i,a,w,v),a.hasText&&x(p,a,m)&&(b.push(a),t.call("word",e,a),m?sa(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=ca(t),e):a},e.fontStyle=function(t){return arguments.length?(s=ca(t),e):s},e.fontWeight=function(t){return arguments.length?(l=ca(t),e):l},e.rotate=function(t){return arguments.length?(h=ca(t),e):h},e.text=function(t){return arguments.length?(o=ca(t),e):o},e.spiral=function(t){return arguments.length?(p=ua[t]||t,e):p},e.fontSize=function(t){return arguments.length?(r=ca(t),e):r},e.padding=function(t){return arguments.length?(c=ca(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 $o(t){return t.text}function ta(){return"serif"}function ea(){return"normal"}function ia(t){return Math.sqrt(t.value)}function na(){return 30*(~~(6*Math.random())-3)}function oa(){return 1}function aa(t,e,i,n){if(!e.sprite){var o=t.context,a=t.ratio;o.clearRect(0,0,(Zo<<5)/a,Jo/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*Qo),d=Math.cos(e.rotate*Qo),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>=Zo<<5&&(r=0,s+=l,l=0),s+u>=Jo)break;o.translate((r+(c>>1))/a,(s+(u>>1))/a),e.rotate&&o.rotate(e.rotate*Qo),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,(Zo<<5)/a,Jo/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[(s+k)*(Zo<<5)+(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 ra(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 sa(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 la(t){var e=t[0]/t[1];return function(t){return[e*(t*=.1)*Math.cos(t),t*Math.sin(t)]}}function ha(){return document.createElement("canvas")}function ca(t){return"function"==typeof t?t:function(){return t}}var ua={archimedean:la,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]}}};Pt(".other_Wordcloud text{cursor:pointer}");var pa=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=Ko().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);pa.prototype._class+=" chart_WordCloud",pa.prototype.implements(e.I2DChart.prototype),pa.prototype.implements(e.ITooltip.prototype),pa.prototype.mixin(i.Utility.SimpleSelectionMixin),pa.prototype.publish("paletteID","default","set","Color palette for this widget",pa.prototype._palette.switch(),{tags:["Basic","Shared"]}),pa.prototype.publish("useClonedPalette",!1,"boolean","Enable or disable using a cloned palette",null,{tags:["Intermediate","Shared"]}),pa.prototype.publish("fontFamily","Impact","string","Font Name",null,{tags:["Basic"]}),pa.prototype.publish("fontSizeFrom",6,"number","Minimum font size (pixels)",null,{tags:["Basic"]}),pa.prototype.publish("fontSizeTo",48,"number","Maximum font size (pixels)",null,{tags:["Basic"]}),pa.prototype.publish("angleFrom",-60,"number","Minimum angle (degrees)",null,{tags:["Basic"]}),pa.prototype.publish("angleTo",60,"number","Maximum angle (degrees)",null,{tags:["Basic"]}),pa.prototype.publish("angleCount",5,"number","Number of different angles",null,{tags:["Basic"]}),pa.prototype.publish("padding",0,"number","Padding between words (pixels)",null,{tags:["Intermediate"]}),pa.prototype.publish("scaleMode","linear","set","Text scaling mode",["linear","log","sqrt","pow"],{tags:["Intermediate"]}),pa.prototype.publish("spiral","archimedean","set","Text scaling mode",["archimedean","rectangular"],{tags:["Intermediate"]}),pa.prototype.publish("offsetX",0,"number","X offset",null,{tags:["Advanced"]}),pa.prototype.publish("offsetY",0,"number","Y offset",null,{tags:["Advanced"]}),pa.prototype.publish("zoom",1,"number","Zoom",null,{tags:["Advanced"]}),t.Area=Ft,t.Axis=Ct,t.BUILD_VERSION="2.105.2",t.Bar=Ot,t.Bubble=re,t.BubbleXY=se,t.Bullet=ze,t.Column=Dt,t.Contour=ln,t.Gantt=hn,t.Gauge=ko,t.HalfPie=Mo,t.Heat=To,t.HexBin=Do,t.Line=Oo,t.PKG_NAME="@hpcc-js/chart",t.PKG_VERSION="2.83.1",t.Pie=Ao,t.QuarterPie=Ro,t.QuartileCandlestick=jo,t.Radar=Eo,t.RadialBar=No,t.Scatter=It,t.StatChart=Ho,t.Step=Vo,t.Summary=Go,t.SummaryC=Xo,t.WordCloud=pa,t.XYAxis=zt,Object.defineProperty(t,"__esModule",{value:!0})}));
|
|
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,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 h=Math.PI,c=2*h,u=1e-6,p=c-u;function d(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function f(){return new d}function y(t){return function(){return t}}d.prototype=f.prototype={constructor:d,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,c=a-t,p=r-e,d=c*c+p*p;if(o<0)throw new Error("negative radius: "+o);if(null===this._x1)this._+="M"+(this._x1=t)+","+(this._y1=e);else if(d>u)if(Math.abs(p*s-l*c)>u&&o){var f=i-a,y=n-r,_=s*s+l*l,x=f*f+y*y,m=Math.sqrt(_),g=Math.sqrt(d),v=o*Math.tan((h-Math.acos((_+d-x)/(2*m*g)))/2),b=v/g,w=v/m;Math.abs(b-1)>u&&(this._+="L"+(t+b*c)+","+(e+b*p)),this._+="A"+o+","+o+",0,0,"+ +(p*f>c*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,d=e+s,f=1^a,y=a?n-o:o-n;if(i<0)throw new Error("negative radius: "+i);null===this._x1?this._+="M"+l+","+d:(Math.abs(this._x1-l)>u||Math.abs(this._y1-d)>u)&&(this._+="L"+l+","+d),i&&(y<0&&(y=y%c+c),y>p?this._+="A"+i+","+i+",0,1,"+f+","+(t-r)+","+(e-s)+"A"+i+","+i+",0,1,"+f+","+(this._x1=l)+","+(this._y1=d):y>u&&(this._+="A"+i+","+i+",0,"+ +(y>=h)+","+f+","+(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 _=Math.abs,x=Math.atan2,m=Math.cos,g=Math.max,v=Math.min,b=Math.sin,w=Math.sqrt,S=1e-12,k=Math.PI,A=k/2,M=2*k;function T(t){return t>=1?A:t<=-1?-A:Math.asin(t)}function P(t){return t.innerRadius}function C(t){return t.outerRadius}function z(t){return t.startAngle}function I(t){return t.endAngle}function F(t){return t&&t.padAngle}function D(t,e,i,n,o,a,r){var s=t-i,l=e-n,h=(r?a:-a)/w(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,v=y-d,b=m*m+v*v,S=o-a,k=p*y-f*d,A=(v<0?-1:1)*w(g(0,S*S*b-k*k)),M=(k*v-m*A)/b,T=(-k*m-v*A)/b,P=(k*v+m*A)/b,C=(-k*m+v*A)/b,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/S-1),y11:T*(o/S-1)}}function O(){var t=P,e=C,i=y(0),n=null,o=z,a=I,r=F,s=null;function l(){var l,h,c=+t.apply(this,arguments),u=+e.apply(this,arguments),p=o.apply(this,arguments)-A,d=a.apply(this,arguments)-A,y=_(d-p),g=d>p;if(s||(s=l=f()),u<c&&(h=u,u=c,c=h),u>S)if(y>M-S)s.moveTo(u*m(p),u*b(p)),s.arc(0,0,u,p,d,!g),c>S&&(s.moveTo(c*m(d),c*b(d)),s.arc(0,0,c,d,p,g));else{var P,C,z=p,I=d,F=p,O=d,R=y,j=y,E=r.apply(this,arguments)/2,N=E>S&&(n?+n.apply(this,arguments):w(c*c+u*u)),L=v(_(u-c)/2,+i.apply(this,arguments)),B=L,H=L;if(N>S){var V=T(N/c*b(E)),q=T(N/u*b(E));(R-=2*V)>S?(F+=V*=g?1:-1,O-=V):(R=0,F=O=(p+d)/2),(j-=2*q)>S?(z+=q*=g?1:-1,I-=q):(j=0,z=I=(p+d)/2)}var W=u*m(z),G=u*b(z),Y=c*m(O),X=c*b(O);if(L>S){var U,Q=u*m(I),Z=u*b(I),J=c*m(F),K=c*b(F);if(y<k&&(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<S))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/b(function(t){return t>1?0:t<-1?k:Math.acos(t)}(($*et+tt*it)/(w($*$+tt*tt)*w(et*et+it*it)))/2),ot=w(U[0]*U[0]+U[1]*U[1]);B=v(L,(c-ot)/(nt-1)),H=v(L,(u-ot)/(nt+1))}}j>S?H>S?(P=D(J,K,W,G,u,H,g),C=D(Q,Z,Y,X,u,H,g),s.moveTo(P.cx+P.x01,P.cy+P.y01),H<L?s.arc(P.cx,P.cy,H,x(P.y01,P.x01),x(C.y01,C.x01),!g):(s.arc(P.cx,P.cy,H,x(P.y01,P.x01),x(P.y11,P.x11),!g),s.arc(0,0,u,x(P.cy+P.y11,P.cx+P.x11),x(C.cy+C.y11,C.cx+C.x11),!g),s.arc(C.cx,C.cy,H,x(C.y11,C.x11),x(C.y01,C.x01),!g))):(s.moveTo(W,G),s.arc(0,0,u,z,I,!g)):s.moveTo(W,G),c>S&&R>S?B>S?(P=D(Y,X,Q,Z,c,-B,g),C=D(W,G,J,K,c,-B,g),s.lineTo(P.cx+P.x01,P.cy+P.y01),B<L?s.arc(P.cx,P.cy,B,x(P.y01,P.x01),x(C.y01,C.x01),!g):(s.arc(P.cx,P.cy,B,x(P.y01,P.x01),x(P.y11,P.x11),!g),s.arc(0,0,c,x(P.cy+P.y11,P.cx+P.x11),x(C.cy+C.y11,C.cx+C.x11),g),s.arc(C.cx,C.cy,B,x(C.y11,C.x11),x(C.y01,C.x01),!g))):s.arc(0,0,c,O,F,g):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-k/2;return[m(n)*i,b(n)*i]},l.innerRadius=function(e){return arguments.length?(t="function"==typeof e?e:y(+e),l):t},l.outerRadius=function(t){return arguments.length?(e="function"==typeof t?t:y(+t),l):e},l.cornerRadius=function(t){return arguments.length?(i="function"==typeof t?t:y(+t),l):i},l.padRadius=function(t){return arguments.length?(n=null==t?null:"function"==typeof t?t:y(+t),l):n},l.startAngle=function(t){return arguments.length?(o="function"==typeof t?t:y(+t),l):o},l.endAngle=function(t){return arguments.length?(a="function"==typeof t?t:y(+t),l):a},l.padAngle=function(t){return arguments.length?(r="function"==typeof t?t:y(+t),l):r},l.context=function(t){return arguments.length?(s=null==t?null:t,l):s},l}function R(t){this._context=t}function j(t){return new R(t)}function E(t){return t[0]}function N(t){return t[1]}function L(){var t=E,e=N,i=y(!0),n=null,o=j,a=null;function r(r){var s,l,h,c=r.length,u=!1;for(null==n&&(a=o(h=f())),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:y(+e),r):t},r.y=function(t){return arguments.length?(e="function"==typeof t?t:y(+t),r):e},r.defined=function(t){return arguments.length?(i="function"==typeof t?t:y(!!t),r):i},r.curve=function(t){return arguments.length?(o=t,null!=n&&(a=o(n)),r):o},r.context=function(t){return arguments.length?(null==t?n=a=null:a=o(n=t),r):n},r}function B(t,e){return e<t?-1:e>t?1:e>=t?0:NaN}function H(t){return t}function V(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 q(t){this._context=t}function W(t){return new q(t)}function G(t,e){this._basis=new q(t),this._beta=e}R.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)}}},q.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:V(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:V(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},G.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 Y=function t(e){function i(t){return 1===e?new q(t):new G(t,e)}return i.beta=function(e){return t(+e)},i}(.85);function X(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 U(t,e){this._context=t,this._k=(1-e)/6}U.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:X(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:X(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 Q=function t(e){function i(t){return new U(t,e)}return i.tension=function(e){return t(+e)},i}(0);function Z(t,e){this._context=t,this._alpha=e}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._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>S){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>S){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 J=function t(e){function i(t){return e?new Z(t,e):new U(t,0)}return i.alpha=function(e){return t(+e)},i}(.5);function K(t){return t<0?-1:1}function $(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(K(a)+K(r))*Math.min(Math.abs(a),Math.abs(r),.5*Math.abs(s))||0}function tt(t,e){var i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function et(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 it(t){this._context=t}function nt(t){return new it(t)}function ot(t){this._context=t}function at(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 rt(t){return new ot(t)}function st(t,e){this._context=t,this._t=e}function lt(t){return new st(t,.5)}function ht(t){return new st(t,0)}function ct(t){return new st(t,1)}it.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:et(this,this._t0,tt(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,et(this,tt(this,i=$(this,t,e)),i);break;default:et(this,this._t0,i=$(this,t,e))}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=i}}},Object.create(it.prototype).point=function(t,e){it.prototype.point.call(this,e,t)},ot.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=at(t),o=at(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)}},st.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 ut=Array.prototype.slice;function pt(t){return t}var dt=1,ft=2,yt=3,_t=4,xt=1e-6;function mt(t){return"translate("+(t+.5)+",0)"}function gt(t){return"translate(0,"+(t+.5)+")"}function vt(t){return function(e){return+t(e)}}function bt(t){var e=Math.max(0,t.bandwidth()-1)/2;return t.round()&&(e=Math.round(e)),function(i){return+t(i)+e}}function wt(){return!this.__axis}function St(t,e){var i=[],n=null,o=null,a=6,r=6,s=3,l=t===dt||t===_t?-1:1,h=t===_t||t===ft?"x":"y",c=t===dt||t===yt?mt:gt;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):pt:o,f=Math.max(a,0)+s,y=e.range(),_=+y[0]+.5,x=+y[y.length-1]+.5,m=(e.bandwidth?bt:vt)(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",t===dt?"0em":t===yt?"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",xt).attr("transform",(function(t){return isFinite(t=m(t))?c(t):this.getAttribute("transform")})),S.attr("opacity",xt).attr("transform",(function(t){var e=this.parentNode.__axis;return c(e&&isFinite(e=e(t))?e:m(t))}))),w.remove(),v.attr("d",t===_t||t==ft?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(wt).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",t===ft?"start":t===_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=ut.call(arguments),u},u.tickArguments=function(t){return arguments.length?(i=null==t?[]:ut.call(t),u):i.slice()},u.tickValues=function(t){return arguments.length?(n=null==t?null:ut.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 kt(t){return St(dt,t)}function At(t){return St(ft,t)}function Mt(t){return St(yt,t)}function Tt(t){return St(_t,t)}function Pt(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))}}Pt(".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 Ct=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=Tt(this.d3Scale),this.d3Guides=Tt(this.d3Scale);break;case"top":this.d3Axis=kt(this.d3Scale),this.d3Guides=kt(this.d3Scale);break;case"right":this.d3Axis=At(this.d3Scale),this.d3Guides=At(this.d3Scale);break;default:this.d3Axis=Mt(this.d3Scale),this.d3Guides=Mt(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);Ct.prototype._class+=" chart_Axis",Ct.prototype.publish("title",null,"string","Title"),Ct.prototype.publish("orientation","bottom","set","Placement/orientation of the axis",["left","top","right","bottom"]),Ct.prototype.publish("powExponent",2,"number","Power exponent (disabled when type is not 'pow')",null,{disable:function(t){return"pow"!==t.type()}}),Ct.prototype.publish("logBase",10,"number","Logarithmic base (disabled when type is not 'log')",null,{disable:function(t){return"log"!==t.type()}}),Ct.prototype.publish("ordinals",[],"array","Array of ordinal values to display (disabled when type is not 'ordinal')",null,{disable:function(t){return"ordinal"!==t.type()}}),Ct.prototype.publish("fontSize",null,"number","Size of tick label font (pixels)",null,{optional:!0}),Ct.prototype.publish("fontFamily",null,"string","Font family of tick labels",null,{optional:!0}),Ct.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()}}),Ct.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()}}),Ct.prototype.publish("tickLength",null,"number","Height (or width for left/right orientations) of the axis ticks (in pixels)",null,{optional:!0}),Ct.prototype.publish("ticks",[],"array","Custom tick labels",null,{optional:!0}),Ct.prototype.publish("low",null,"any","Minimum tick value (disabled when type is ordinal)",null,{optional:!0,disable:function(t){return"ordinal"===t.type()}}),Ct.prototype.publish("high",null,"any","Maximum tick value (disabled when type is ordinal)",null,{optional:!0,disable:function(t){return"ordinal"===t.type()}}),Ct.prototype.publish("overlapMode","none","set","Specifies the behavior when tick labels overlap",["none","stagger","hide","rotate","linebreak","wrap"]),Ct.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()}}),Ct.prototype.publish("shrinkToFit","both","set","shrinkToFit",["none","low","high","both"]),Ct.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()}}),Ct.prototype.publish("hidden",!1,"boolean","Hides axis when 'true'"),Ct.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()}}),Ct.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()}}),Ct.prototype.publish("ordinalMappings",null,"object","Alternative label mappings (icons)",null,{optional:!0}),Ct.prototype.publish("padding",0,"number","Padding space at top of axis (pixels)",null,{optional:!0});Pt(".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 zt=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 Ct).classed({domain:!0}).orientation_default("bottom").type("ordinal").overlapMode_default("stagger").shrinkToFit_default("high").extend_default(0),e.valueAxis=(new Ct).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(){r.copyPropsTo(r.focusChart,["layers"]);for(var t=0,e=0,i=r.layers();e<i.length;e++){i[e].copyPropsTo(r.focusChart.layers()[t]),t++}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?l([i[0]],n,!0):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){void 0===i&&(i=250),this.layerEnter(this,e,i);for(var n=0,o=this.layers();n<o.length;n++){var a=o[n];a.__xyAxisElement=e.append("g").attr("class",a.class()),a.target(a.__xyAxisElement.node()).layerEnter(this,e,i)}},e.prototype.chartsUpdate=function(t,e,i){this.layerUpdate(this,this.svgData,i);for(var n=0,o=this.layers();n<o.length;n++){var a=o[n];a.resize({width:t,height:e}).layerUpdate(this,a.__xyAxisElement,i)}},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);zt.prototype._class+=" chart_XYAxis",zt.prototype.mixin(i.Utility.SimpleSelectionMixin),zt.prototype.publish("orientation","horizontal","set","Selects orientation for the axis",["horizontal","vertical"]),zt.prototype.publish("pointSizeColumn",null,"string","pointSizeColumn",null,{optional:!0}),zt.prototype.publish("minPointSize",6,"number","minPointSize"),zt.prototype.publish("maxPointSize",26,"number","maxPointSize"),zt.prototype.publish("use2dSelection",!1,"boolean","2D Range Selector"),zt.prototype.publish("selectionMode",!1,"boolean","Range Selector"),zt.prototype.publishProxy("xAxisTitle","domainAxis","title"),zt.prototype.publishProxy("xAxisTickCount","domainAxis","tickCount"),zt.prototype.publishProxy("xAxisTickFormat","domainAxis","tickFormat"),zt.prototype.publishProxy("xAxisTicks","domainAxis","ticks"),zt.prototype.publishProxy("xAxisType","domainAxis","type"),zt.prototype.publishProxy("xAxisTypeTimePattern","domainAxis","timePattern"),zt.prototype.publish("xAxisDomainLow",null,"string","X-Axis Low",null,{optional:!0,disable:function(t){return"ordinal"===t.xAxisType()}}),zt.prototype.publish("xAxisDomainHigh",null,"string","X-Axis High",null,{optional:!0,disable:function(t){return"ordinal"===t.xAxisType()}}),zt.prototype.publishProxy("xAxisFontSize","domainAxis","fontSize"),zt.prototype.publishProxy("xAxisFontFamily","domainAxis","fontFamily"),zt.prototype.publishProxy("xAxisOrdinalPaddingInner","domainAxis","ordinalPaddingInner"),zt.prototype.publishProxy("xAxisOrdinalPaddingOuter","domainAxis","ordinalPaddingOuter"),zt.prototype.publishProxy("xAxisOverlapMode","domainAxis","overlapMode"),zt.prototype.publishProxy("xAxisLabelRotation","domainAxis","labelRotation"),zt.prototype.publishProxy("xAxisDomainPadding","domainAxis","extend"),zt.prototype.publish("xAxisGuideLines",!1,"boolean","Y-Axis Guide Lines"),zt.prototype.publish("xAxisFocus",!1,"boolean","X-Axis Focus",null,{disable:function(t){return"horizontal"!==t.orientation()}}),zt.prototype.publish("xAxisFocusHeight",80,"number","X-Axis Focus Height",null,{disable:function(t){return!t.xAxisFocus()}}),zt.prototype.publishProxy("xAxisHidden","domainAxis","hidden"),zt.prototype.publishProxy("yAxisFontSize","valueAxis","fontSize"),zt.prototype.publishProxy("yAxisFontFamily","valueAxis","fontFamily"),zt.prototype.publishProxy("yAxisTitle","valueAxis","title"),zt.prototype.publishProxy("yAxisTickCount","valueAxis","tickCount"),zt.prototype.publishProxy("yAxisTickFormat","valueAxis","tickFormat"),zt.prototype.publishProxy("yAxisTicks","valueAxis","ticks"),zt.prototype.publishProxy("yAxisType","valueAxis","type"),zt.prototype.publishProxy("yAxisTypeTimePattern","valueAxis","timePattern"),zt.prototype.publishProxy("yAxisTypePowExponent","valueAxis","powExponent"),zt.prototype.publishProxy("yAxisTypeLogBase","valueAxis","logBase"),zt.prototype.publish("yAxisStacked",!1,"boolean","Stacked Chart",null,{tags:["Basic"],disable:function(t){return"ordinal"!==t.xAxisType()||t._class.indexOf("chart_Column")<0}}),zt.prototype.publish("yAxisDomainLow",null,"string","Y-Axis Low",null,{optional:!0,disable:function(t){return"ordinal"===t.yAxisType()}}),zt.prototype.publish("yAxisDomainHigh",null,"string","Y-Axis High",null,{optional:!0,disable:function(t){return"ordinal"===t.yAxisType()}}),zt.prototype.publishProxy("yAxisDomainPadding","valueAxis","extend"),zt.prototype.publish("yAxisGuideLines",!0,"boolean","Y-Axis Guide Lines"),zt.prototype.publishProxy("yAxisHidden","valueAxis","hidden"),zt.prototype.publish("regions",[],"array","Regions"),zt.prototype.publish("layers",[],"widgetArray","Layers",null,{render:!1}),zt.prototype.publishProxy("xAxisPadding","domainAxis","padding"),zt.prototype.publishProxy("yAxisPadding","valueAxis","padding");Pt(".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 It=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 j;case"step":return lt;case"step-before":return ht;case"step-after":return ct;case"basis":return W;case"bundle":return Y;case"cardinal":return Q;case"catmullRom":return J;case"natural":return rt;default:return nt}},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),_=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})),x=n.selectAll(".area").data(p.filter((function(t,e){return u.interpolate()&&u.interpolateFill()&&e>0}))),m=x.enter().append("path"),g=function(){var t=E,e=null,i=y(0),n=N,o=y(!0),a=null,r=j,s=null;function l(l){var h,c,u,p,d,y=l.length,_=!1,x=new Array(y),m=new Array(y);for(null==a&&(s=r(d=f())),h=0;h<=y;++h){if(!(h<y&&o(p=l[h],h,l))===_)if(_=!_)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()}_&&(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 L().defined(o).curve(r).context(a)}return l.x=function(i){return arguments.length?(t="function"==typeof i?i:y(+i),e=null,l):t},l.x0=function(e){return arguments.length?(t="function"==typeof e?e:y(+e),l):t},l.x1=function(t){return arguments.length?(e=null==t?null:"function"==typeof t?t:y(+t),l):e},l.y=function(t){return arguments.length?(i="function"==typeof t?t:y(+t),n=null,l):i},l.y0=function(t){return arguments.length?(i="function"==typeof t?t:y(+t),l):i},l.y1=function(t){return arguments.length?(n=null==t?null:"function"==typeof t?t:y(+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:y(!!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(x).attr("class",(function(t){return"area series series-"+a.cssTag(t)})).each((function(t,e){i.select(this).attr("d",g(_.filter((function(t){return t.colIdx===e+1})))).style("opacity",u.interpolateFillOpacity()).style("stroke","none").style("fill",u.areaColor([],t,void 0,[]))})),x.exit().remove();var v=n.selectAll(".line").data(p.filter((function(t,e){return u.interpolate()&&e>0}))),b=v.enter().append("path"),w=L().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=_.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(_,(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}(zt);It.prototype._class+=" chart_Scatter",It.prototype.implements(e.INDChart.prototype),It.prototype.implements(e.ITooltip.prototype),It.prototype.publish("paletteID","default","set","Color palette for this widget",It.prototype._palette.switch(),{tags:["Basic","Shared"]}),It.prototype.publish("pointSizeScale","linear","set","pointSizeScale",["linear","pow","log","sqrt"]),It.prototype.publish("pointShape","cross","set","Shape of the data points",["circle","rectangle","cross"]),It.prototype.publish("pointSize",6,"number","Point Size",null,{range:{min:1,step:1,max:200}}),It.prototype.publish("interpolate","","set","Interpolate Data",["","linear","step","step-before","step-after","basis","bundle","cardinal","catmullRom","natural","monotone"]),It.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()}}),It.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()}}),It.prototype.publish("interpolateFill",!1,"boolean","If true, the area between the line and zero will be filled"),It.prototype.publish("interpolateFillOpacity",.66,"number","Fill interpolation Opacity",null,{range:{min:0,step:.01,max:1}}),It.prototype.publish("useClonedPalette",!1,"boolean","Enable or disable using a cloned palette",null,{tags:["Intermediate","Shared"]}),It.prototype.publish("showValue",!1,"boolean"),It.prototype.publish("valueAnchor","middle","set","text-anchor for shown value text",["start","middle","end"]),It.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 Ft=function(t){function e(){var e=t.call(this)||this;return e.interpolate_default("linear").interpolateFill_default(!0),e}return a(e,t),e}(It);Ft.prototype._class+=" chart_Area";Pt(".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 Dt=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,h=0;switch(e.xAxisType()){case"ordinal":l=e.bandwidth(),h=-l/2;break;case"linear":case"time":l=Math.max(Math.abs(e.dataPos(2)-e.dataPos(1))*(100-this._linearGap)/100,l),h=-l/2}this.tooltip.direction(a?"n":"e");var c=i.scaleBand().domain(r.layerColumns(e).filter((function(t,e){return e>0}))).rangeRound(a?[0,l]:[l,0]).paddingInner(this.xAxisSeriesPaddingInner()).paddingOuter(0),u=[],p=[],d=this.columns().length,f=this.data();this.showValue()&&"series"===this.showValueAsPercent()&&f.forEach((function(t){t.filter((function(t,e){return e>0&&e<d})).forEach((function(t,e){void 0===p[e+1]&&(p[e+1]=0),p[e+1]+=t}))})),(this.showDomainTotal()||this.showValue()&&"domain"===this.showValueAsPercent())&&(u=f.map((function(t){return t.filter((function(t,e){return e>0&&e<d})).reduce((function(t,e){return t+e}),0)})));var y=n.selectAll(".dataRow").data(this.adjustedData(e)),_=e.data(),x=this.getAxisSize(e);y.enter().append("g").attr("class","dataRow").merge(y).each((function(t,n){var f=i.select(this),y=f.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:_[n],value:i,idx:o}})).filter((function(t){return null!==t.value&&t.idx>0})),(function(t){return t.column})),m=y.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")}));m.transition().duration(o).style("opacity",1);var g=e.yAxisStacked()?l:c.bandwidth();m.merge(y).each((function(l){var f=i.select(this),y=e.dataPos(t[0])+(e.yAxisStacked()?0:c(l.column))+h,_=l.value instanceof Array?l.value[1]:l.value,m=l.origRow[l.idx];if(r.showValue()){var v=r.dataMeta();switch(r.showValueAsPercent()){case"series":var b=void 0!==v.sum?v.sum:p[l.idx];m=s(m/b);break;case"domain":var w=void 0!==v.sum?v.sum:u[n];m=s(m/w);break;default:m=i.format(r.showValueFormat())(m)}}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?y:A,y:a?A:y,width:a?g:M,height:a?M:g},{x:0,y:0,width:x.width,height:x.height}),z=f.select("rect").transition().duration(o).style("fill",(function(t){return r.fillColor(t.row,t.column,t.value,t.origRow)}));a?z.attr("x",y).attr("y",A).attr("width",g).attr("height",M):z.attr("y",y).attr("x",A).attr("height",g).attr("width",M);var I=f.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",y+g/2).attr("y",O+D).attr("transform","rotate(-90, ".concat(y+g/2,", ").concat(O,")"))}else I.attr("x",C.x+F).attr("y",y+g/2+D);I.attr("height",g).attr("width",M),r.showInnerText()&&I.text((function(t){var e=r.innerText(t.origRow,t.origRow[d],t.idx);if(e){var i=a?C.height:C.width,n=r.calcInnerText(i,e,m);return t.innerTextObj=n,n.text}return""}));var R=f.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(m,n,o),h=parseFloat(m)>=0,c=r.valueAnchor()?r.valueAnchor():a?"middle":"start",u=C.x,p=x.width-(C.x+C.width),d=C.y,f=x.height-(C.y+C.height);if(l.innerTextObj){var _=l.innerTextObj,v=_.padding,b=_.valueTextWidth;e=!1,a?(c="middle",i.x=y+g/2,4===l.innerTextObj.category?(e=!0,i.y=A-v-o/2):i.y=A+v+o/2):(c="start",4===l.innerTextObj.category?(e=!0,i.x=M+A+v):i.x=M+A-b-v,i.y=y+g/2)}else a?(t=C.height<s.height,e=!r.valueCentered()||t,i.x=C.x+C.width/2,e?h?d<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:f<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?p<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:u<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(c).fontFamily(n).fontSize(o).text("".concat(m)).colorFill(w).visible(r.showValue()&&!k).render()})),R.exit().each((function(t){r.textLocal.get(this).target(null)})).remove()})),y.exit().transition().duration(o).style("opacity",0).remove();var v=e.yAxisStacked()?u[n]:Math.max.apply(Math,t.filter((function(t,e){return e>0&&e<d}))),b=f.selectAll(".stackedTotalText").data(r.showDomainTotal()?[u[n]]:[]);b.enter().append("g").attr("class","stackedTotalText").each((function(t){r.stackedTextLocal.set(this,(new i.Text).target(this).colorStroke_default("transparent"))})).merge(b).each((function(i){var n={x:0,y:0},o=e.dataPos(t[0]),s=e.valuePos(v),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()})),b.exit().each((function(t){r.textLocal.get(this).target(null)})).remove()})),y.exit().transition().duration(o).remove()},n.prototype.calcInnerText=function(t,e,i){var n=this.innerTextFontFamily_exists()?this.innerTextFontFamily():"Verdana",o=this.innerTextFontSize(),a=this.valueFontFamily_exists()?this.valueFontFamily():"Verdana",r=this.valueFontSize(),s=this.innerTextPadding_exists()?this.innerTextPadding():o/2.5,l=this.isHorizontal?r:this.textSize(i,a,r).width,h=e,c=3*s+this.textSize("...",n,o).width+l,u=1*s+l,p=4;if(3*s+this.textSize(e,n,o).width+l<t)p=1;else if(c<t){for(var d=t-c,f="",y=0,_=e;y<_.length;y++){var x=_[y];if(this.textSize(f+x,n,o).width>d){e=f+"...";break}f+=x}p=2}else u<t?(e="",p=3):e="";return{text:e,isTruncated:h!==e,padding:s,category:p,valueTextWidth:l}},n.prototype.innerText=function(t,e,i){return t[0]},n.__inputs=[{id:"label",type:"string"},{id:"values",type:"number",multi:!0}],n}(zt);Dt.prototype._class+=" chart_Column",Dt.prototype.implements(e.INDChart.prototype),Dt.prototype.implements(e.ITooltip.prototype),Dt.prototype.publish("valueFontFamily",null,"string","Font family of value text",null,{optional:!0}),Dt.prototype.publish("valueFontSize",12,"number","Height of value text (pixels)"),Dt.prototype.publish("innerTextFontFamily",null,"string","Font family of inner text",null,{optional:!0}),Dt.prototype.publish("innerTextPadding",8,"number","Offset of inner text (pixels)",null,{optional:!0}),Dt.prototype.publish("innerTextFontSize",12,"number","Height of inner text (pixels)"),Dt.prototype.publish("paletteID","default","set","Color palette for this widget",(function(){return Dt.prototype._palette.switch()}),{tags:["Basic","Shared"]}),Dt.prototype.publish("useClonedPalette",!1,"boolean","Enable or disable using a cloned palette",null,{tags:["Intermediate","Shared"]}),Dt.prototype.publish("showValue",!1,"boolean","Show Value in column"),Dt.prototype.publish("showInnerText",!1,"boolean","Show Label in column"),Dt.prototype.publish("showValueFormat",",","string","D3 Format for Value",null,{disable:function(t){return!t.showValue()||!!t.showValueAsPercent()}}),Dt.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}),Dt.prototype.publish("showValueAsPercentFormat",".0%","string","D3 Format for %",null,{disable:function(t){return!t.showValue()||!t.showValueAsPercent()}}),Dt.prototype.publish("showDomainTotal",!1,"boolean","Show Total Value for Stacked Columns",null),Dt.prototype.publish("valueCentered",!1,"boolean","Show Value in center of column"),Dt.prototype.publish("valueAnchor","middle","set","text-anchor for shown value text",["start","middle","end"]),Dt.prototype.publish("xAxisSeriesPaddingInner",0,"number","Determines the ratio of the range that is reserved for blank space between band (0->1)"),Dt.prototype.publish("tooltipInnerTextEllipsedOnly",!1,"boolean","Show tooltip only when inner text is truncated with an ellipsis");var Ot=function(t){function e(){var e=t.call(this)||this;return e.orientation_default("vertical"),e}return a(e,t),e}(Dt);function Rt(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 jt(t,e){var i,n,o,a,r,s=new Bt(t),l=+t.value&&(s.value=t.value),h=[s];for(null==e&&(e=Et);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 Bt(o[a])),n.parent=i,n.depth=i.depth+1;return s.eachBefore(Lt)}function Et(t){return t.children}function Nt(t){t.data=t.data.data}function Lt(t){var e=0;do{t.height=e}while((t=t.parent)&&t.height<++e)}function Bt(t){this.data=t,this.depth=this.height=0,this.parent=null}Ot.prototype._class+=" chart_Bar",Bt.prototype=jt.prototype={constructor:Bt,count:function(){return this.eachAfter(Rt)},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 jt(this).eachBefore(Nt)}};var Ht=Array.prototype.slice;function Vt(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}(Ht.call(t))).length,a=[];n<o;)e=t[n],i&&Gt(i,e)?++n:(i=Xt(a=qt(a,e)),n=0);return i}function qt(t,e){var i,n;if(Yt(e,t))return[e];for(i=0;i<t.length;++i)if(Wt(e,t[i])&&Yt(Ut(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(Wt(Ut(t[i],t[n]),e)&&Wt(Ut(t[i],e),t[n])&&Wt(Ut(t[n],e),t[i])&&Yt(Qt(t[i],t[n],e),t))return[t[i],t[n],e];throw new Error}function Wt(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 Gt(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 Yt(t,e){for(var i=0;i<e.length;++i)if(!Gt(t,e[i]))return!1;return!0}function Xt(t){switch(t.length){case 1:return{x:(e=t[0]).x,y:e.y,r:e.r};case 2:return Ut(t[0],t[1]);case 3:return Qt(t[0],t[1],t[2])}var e}function Ut(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 Qt(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 Zt(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 Jt(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 Kt(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 $t(t){this._=t,this.next=null,this.previous=null}function te(t){return null==t?null:function(t){if("function"!=typeof t)throw new Error;return t}(t)}function ee(){return 0}function ie(t){return Math.sqrt(t.value)}function ne(t){return function(e){e.children||(e.r=Math.max(0,+t(e)||0))}}function oe(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;Zt(i,e,n=t[2]),e=new $t(e),i=new $t(i),n=new $t(n),e.next=n.previous=i,i.next=e.previous=n,n.next=i.previous=e;t:for(s=3;s<o;++s){Zt(e._,i._,n=t[s]),n=new $t(n),l=i.next,h=e.previous,c=i._.r,u=e._.r;do{if(c<=u){if(Jt(l._,n._)){i=l,e.next=i,i.previous=e,--s;continue t}c+=l._.r,l=l.next}else{if(Jt(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=Kt(e);(n=n.next)!==i;)(r=Kt(n))<a&&(e=n,a=r);i=e.next}for(e=[i._],n=i;(n=n.next)!==i;)e.push(n._);for(n=Vt(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 ae(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)}}Pt(".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 re=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=ee;function o(o){return o.x=e/2,o.y=i/2,t?o.eachBefore(ne(t)).eachAfter(oe(n,.5)).eachBefore(ae(1)):o.eachBefore(ne(ie)).eachAfter(oe(ee,1)).eachAfter(oe(n,o.r/Math.min(e,i))).eachBefore(ae(Math.min(e,i)/(2*o.r))),o}return o.radius=function(e){return arguments.length?(t=te(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=jt({children:this.cloneData()}).sum((function(t){return t[1]})).sort((function(t,e){return e[1]<t[1]?-1:e[1]>t[1]?1:0}));this.d3Pack(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);re.prototype._class+=" chart_Bubble",re.prototype.implements(e.I2DChart.prototype),re.prototype.implements(e.ITooltip.prototype),re.prototype.mixin(i.Utility.SimpleSelectionMixin),re.prototype.publish("paletteID","default","set","Color palette for this widget",re.prototype._palette.switch(),{tags:["Basic","Shared"]}),re.prototype.publish("useClonedPalette",!1,"boolean","Enable or disable using a cloned palette",null,{tags:["Intermediate","Shared"]});var se=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}(It);se.prototype._class+=" chart_BubbleXY";var le,he,ce=0,ue=0,pe=0,de=1e3,fe=0,ye=0,_e=0,xe="object"==typeof performance&&performance.now?performance:Date,me="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function ge(){return ye||(me(ve),ye=xe.now()+_e)}function ve(){ye=0}function be(){this._call=this._time=this._next=null}function we(){ge(),++ce;for(var t,e=le;e;)(t=ye-e._time)>=0&&e._call.call(null,t),e=e._next;--ce}function Se(){ye=(fe=xe.now())+_e,ce=ue=0;try{we()}finally{ce=0,function(){var t,e,i=le,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:le=e);he=t,Ae(n)}(),ye=0}}function ke(){var t=xe.now(),e=t-fe;e>de&&(_e-=e,fe=t)}function Ae(t){ce||(ue&&(ue=clearTimeout(ue)),t-ye>24?(t<1/0&&(ue=setTimeout(Se,t-xe.now()-_e)),pe&&(pe=clearInterval(pe))):(pe||(fe=xe.now(),pe=setInterval(ke,de)),ce=1,me(Se)))}function Me(t){return t.ranges}function Te(t){return t.markers}function Pe(t){return t.measures}function Ce(t){var e=t(0);return function(i){return Math.abs(t(i)-e)}}be.prototype={constructor:be,restart:function(t,e,i){if("function"!=typeof t)throw new TypeError("callback is not a function");i=(null==i?ge():+i)+(null==e?0:+e),this._next||he===this||(he?he._next=this:le=this,he=this),this._call=t,this._time=i,Ae()},stop:function(){this._call&&(this._call=null,this._time=1/0,Ae())}};Pt(".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 ze=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=Me,a=Te,r=Pe,s=380,l=30,h=Tt();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=Ce(g),b=Ce(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))})),we()}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);ze.prototype._class+=" chart_Bullet";var Ie=Array.prototype.slice;function Fe(t,e){return t-e}function De(t){return function(){return t}}function Oe(t,e){for(var i,n=-1,o=e.length;++n<o;)if(i=Re(t,e[n]))return i;return 0}function Re(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(je(l,u,e))return 0;c>n!=d>n&&i<(p-h)*(n-c)/(d-c)+h&&(o=-o)}return o}function je(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 Ee(){}var Ne=[[],[[[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 Le(){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(Fe);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,Ne[h<<1].forEach(f);for(;++a<t-1;)l=h,h=i[a+1]>=n,Ne[l|h<<1].forEach(f);Ne[h|0].forEach(f);for(;++r<e-1;){for(a=-1,h=i[r*t+t]>=n,c=i[r*t]>=n,Ne[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,Ne[l|h<<1|c<<2|u<<3].forEach(f);Ne[h|c<<3].forEach(f)}a=-1,c=i[r*t]>=n,Ne[c<<2].forEach(f);for(;++a<t-1;)u=c,c=i[r*t+a+1]>=n,Ne[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]}}Ne[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!==Oe((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)?De(Ie.call(t)):De(t),a):n},a.smooth=function(t){return arguments.length?(o=t?l:Ee,a):o===l},a}function Be(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 He(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 Ve(t){return t[0]}function qe(t){return t[1]}function We(){return 1}function Ge(){return new Ye}function Ye(){this.reset()}Ye.prototype={constructor:Ye,reset:function(){this.s=this.t=0},add:function(t){Ue(Xe,t,this.t),Ue(this,Xe.s,this.s),this.s?this.t+=Xe.t:this.s=Xe.t},valueOf:function(){return this.s}};var Xe=new Ye;function Ue(t,e,i){var n=t.s=e+i,o=n-e,a=n-o;t.t=e-a+(i-o)}var Qe=2*Math.PI,Ze=Math.abs,Je=Math.sqrt;function Ke(){}function $e(t,e){t&&ei.hasOwnProperty(t.type)&&ei[t.type](t,e)}var ti={Feature:function(t,e){$e(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,n=-1,o=i.length;++n<o;)$e(i[n].geometry,e)}},ei={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){ii(t.coordinates,e,0)},MultiLineString:function(t,e){for(var i=t.coordinates,n=-1,o=i.length;++n<o;)ii(i[n],e,0)},Polygon:function(t,e){ni(t.coordinates,e)},MultiPolygon:function(t,e){for(var i=t.coordinates,n=-1,o=i.length;++n<o;)ni(i[n],e)},GeometryCollection:function(t,e){for(var i=t.geometries,n=-1,o=i.length;++n<o;)$e(i[n],e)}};function ii(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 ni(t,e){var i=-1,n=t.length;for(e.polygonStart();++i<n;)ii(t[i],e,1);e.polygonEnd()}function oi(t,e){t&&ti.hasOwnProperty(t.type)?ti[t.type](t,e):$e(t,e)}function ai(t){return t}var ri,si,li,hi,ci=Ge(),ui=Ge(),pi={point:Ke,lineStart:Ke,lineEnd:Ke,polygonStart:function(){pi.lineStart=di,pi.lineEnd=_i},polygonEnd:function(){pi.lineStart=pi.lineEnd=pi.point=Ke,ci.add(Ze(ui)),ui.reset()},result:function(){var t=ci/2;return ci.reset(),t}};function di(){pi.point=fi}function fi(t,e){pi.point=yi,ri=li=t,si=hi=e}function yi(t,e){ui.add(hi*t-li*e),li=t,hi=e}function _i(){yi(ri,si)}var xi=pi,mi=1/0,gi=mi,vi=-mi,bi=vi,wi={point:function(t,e){t<mi&&(mi=t);t>vi&&(vi=t);e<gi&&(gi=e);e>bi&&(bi=e)},lineStart:Ke,lineEnd:Ke,polygonStart:Ke,polygonEnd:Ke,result:function(){var t=[[mi,gi],[vi,bi]];return vi=bi=-(gi=mi=1/0),t}};var Si,ki,Ai,Mi,Ti=wi,Pi=0,Ci=0,zi=0,Ii=0,Fi=0,Di=0,Oi=0,Ri=0,ji=0,Ei={point:Ni,lineStart:Li,lineEnd:Vi,polygonStart:function(){Ei.lineStart=qi,Ei.lineEnd=Wi},polygonEnd:function(){Ei.point=Ni,Ei.lineStart=Li,Ei.lineEnd=Vi},result:function(){var t=ji?[Oi/ji,Ri/ji]:Di?[Ii/Di,Fi/Di]:zi?[Pi/zi,Ci/zi]:[NaN,NaN];return Pi=Ci=zi=Ii=Fi=Di=Oi=Ri=ji=0,t}};function Ni(t,e){Pi+=t,Ci+=e,++zi}function Li(){Ei.point=Bi}function Bi(t,e){Ei.point=Hi,Ni(Ai=t,Mi=e)}function Hi(t,e){var i=t-Ai,n=e-Mi,o=Je(i*i+n*n);Ii+=o*(Ai+t)/2,Fi+=o*(Mi+e)/2,Di+=o,Ni(Ai=t,Mi=e)}function Vi(){Ei.point=Ni}function qi(){Ei.point=Gi}function Wi(){Yi(Si,ki)}function Gi(t,e){Ei.point=Yi,Ni(Si=Ai=t,ki=Mi=e)}function Yi(t,e){var i=t-Ai,n=e-Mi,o=Je(i*i+n*n);Ii+=o*(Ai+t)/2,Fi+=o*(Mi+e)/2,Di+=o,Oi+=(o=Mi*t-Ai*e)*(Ai+t),Ri+=o*(Mi+e),ji+=3*o,Ni(Ai=t,Mi=e)}var Xi=Ei;function Ui(t){this._context=t}Ui.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,Qe)}},result:Ke};var Qi,Zi,Ji,Ki,$i,tn=Ge(),en={point:Ke,lineStart:function(){en.point=nn},lineEnd:function(){Qi&&on(Zi,Ji),en.point=Ke},polygonStart:function(){Qi=!0},polygonEnd:function(){Qi=null},result:function(){var t=+tn;return tn.reset(),t}};function nn(t,e){en.point=on,Zi=Ki=t,Ji=$i=e}function on(t,e){Ki-=t,$i-=e,tn.add(Je(Ki*Ki+$i*$i)),Ki=t,$i=e}var an=en;function rn(){this._string=[]}function sn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}rn.prototype={_radius:4.5,_circle:sn(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=sn(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 ln=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=Ve,e=qe,n=We,o=960,a=500,r=20,s=2,l=3*r,h=o+2*l>>s,c=a+2*l>>s,u=De(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)})),Be({width:h,height:c,data:a},{width:h,height:c,data:p},r>>s),He({width:h,height:c,data:p},{width:h,height:c,data:a},r>>s),Be({width:h,height:c,data:a},{width:h,height:c,data:p},r>>s),He({width:h,height:c,data:p},{width:h,height:c,data:a},r>>s),Be({width:h,height:c,data:a},{width:h,height:c,data:p},r>>s),He({width:h,height:c,data:p},{width:h,height:c,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 Le().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:De(+e),p):t},p.y=function(t){return arguments.length?(e="function"==typeof t?t:De(+t),p):e},p.weight=function(t){return arguments.length?(n="function"==typeof t?t:De(+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)?De(Ie.call(t)):De(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)),oi(t,i(n))),n.result()}return a.area=function(t){return oi(t,i(xi)),xi.result()},a.measure=function(t){return oi(t,i(an)),an.result()},a.bounds=function(t){return oi(t,i(Ti)),Ti.result()},a.centroid=function(t){return oi(t,i(Xi)),Xi.result()},a.projection=function(e){return arguments.length?(i=null==e?(t=null,ai):(t=e).stream,a):t},a.context=function(t){return arguments.length?(n=null==t?(e=null,new rn):new Ui(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}(zt);ln.prototype._class+=" chart_Contour",ln.prototype.implements(e.I1DChart.prototype),ln.prototype.publish("paletteID","YlGnBu","string","Color palette for this widget"),ln.prototype.publish("useClonedPalette",!0,"boolean","Enable or disable using a cloned palette"),ln.prototype.publish("showContourFill",!0,"boolean","Show/hide the contour background colors"),ln.prototype.publish("showContour",!0,"boolean","Show/hide the contour border lines"),ln.prototype.publish("contourBandwidth",40,"number","Controls the sensitivity of the contour grouping algorithm"),ln.prototype.publish("contourStrokeColor","#2C3A47","html-color","Color of the contour border lines"),ln.prototype.publish("contourStrokeWidth",1,"number","Width of the contour border lines");var hn=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}(Ot);function cn(t){return function(){return t}}hn.prototype._class+=" chart_Gantt";var un=1e-12,pn=Math.PI,dn=pn/2,fn=2*pn;function yn(t){return t.innerRadius}function _n(t){return t.outerRadius}function xn(t){return t.startAngle}function mn(t){return t.endAngle}function gn(t){return t&&t.padAngle}function vn(t){return t>=1?dn:t<=-1?-dn:Math.asin(t)}function bn(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 wn(t){this._context=t}function Sn(t){return new wn(t)}function kn(t){return t[0]}function An(t){return t[1]}function Mn(){}function Tn(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 Pn(t){this._context=t}function Cn(t,e){this._basis=new Pn(t),this._beta=e}function zn(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 In(t,e){this._context=t,this._k=(1-e)/6}function Fn(t,e){this._context=t,this._k=(1-e)/6}function Dn(t,e){this._context=t,this._k=(1-e)/6}function On(t,e,i){var n=t._x1,o=t._y1,a=t._x2,r=t._y2;if(t._l01_a>un){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>un){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 Rn(t,e){this._context=t,this._alpha=e}wn.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)}}},Pn.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:Tn(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:Tn(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},Cn.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 Pn(t):new Cn(t,e)}return i.beta=function(e){return t(+e)},i}(.85),In.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:zn(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:zn(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}},function t(e){function i(t){return new In(t,e)}return i.tension=function(e){return t(+e)},i}(0),Fn.prototype={areaStart:Mn,areaEnd:Mn,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:zn(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 Fn(t,e)}return i.tension=function(e){return t(+e)},i}(0),Dn.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:zn(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 Dn(t,e)}return i.tension=function(e){return t(+e)},i}(0),Rn.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){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:On(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 jn=function t(e){function i(t){return e?new Rn(t,e):new In(t,0)}return i.alpha=function(e){return t(+e)},i}(.5);function En(t,e){this._context=t,this._alpha=e}function Nn(t,e){this._context=t,this._alpha=e}function Ln(t){return t<0?-1:1}function Bn(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(Ln(a)+Ln(r))*Math.min(Math.abs(a),Math.abs(r),.5*Math.abs(s))||0}function Hn(t,e){var i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function Vn(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 qn(t){this._context=t}En.prototype={areaStart:Mn,areaEnd:Mn,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:On(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 En(t,e):new Fn(t,0)}return i.alpha=function(e){return t(+e)},i}(.5),Nn.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:On(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 Nn(t,e):new Dn(t,0)}return i.alpha=function(e){return t(+e)},i}(.5),qn.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:Vn(this,this._t0,Hn(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,Vn(this,Hn(this,i=Bn(this,t,e)),i);break;default:Vn(this,this._t0,i=Bn(this,t,e))}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=i}}},Object.create(qn.prototype).point=function(t,e){qn.prototype.point.call(this,e,t)};var Wn="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},Gn=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},Yn=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}}(),Xn=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},Un=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},Qn=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)},Zn=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},Jn=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;Gn(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 Yn(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}(),Kn=function(){function t(e){var i=e.annotations,n=e.accessors,o=e.accessorsInverse;Gn(this,t),this.accessors=n,this.accessorsInverse=o,this.annotations=i}return Yn(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 Xn({},t.type.getNoteBBoxOffset(),{positionX:t.x,positionY:t.y})}))}}]),t}(),$n=function(t,e){return"dynamic"!==t&&"left"!==t&&"right"!==t||(t=e<0?"top":"bottom"),t},to=function(t,e){return"dynamic"!==t&&"top"!==t&&"bottom"!==t||(t=e<0?"right":"left"),t},eo=["topBottom","top","bottom"],io=["leftRight","left","right"],no=function(t){var e=t.data,i=t.curve,n=void 0===i?Sn:i,o=t.canvasContext,a=t.className,r=t.classID,s=function(){var t=kn,e=An,i=cn(!0),n=null,o=Sn,a=null;function r(r){var s,l,h,c=r.length,u=!1;for(null==n&&(a=o(h=f())),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:cn(+e),r):t},r.y=function(t){return arguments.length?(e="function"==typeof t?t:cn(+t),r):e},r.defined=function(t){return arguments.length?(i="function"==typeof t?t:cn(!!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},oo=function(t){var e=t.data,i=t.canvasContext,n={type:"path",className:t.className,classID:t.classID,data:e},o=function(){var t=yn,e=_n,i=cn(0),n=null,o=xn,a=mn,r=gn,s=null;function l(){var l,h,c=+t.apply(this,arguments),u=+e.apply(this,arguments),p=o.apply(this,arguments)-dn,d=a.apply(this,arguments)-dn,y=Math.abs(d-p),_=d>p;if(s||(s=l=f()),u<c&&(h=u,u=c,c=h),u>un)if(y>fn-un)s.moveTo(u*Math.cos(p),u*Math.sin(p)),s.arc(0,0,u,p,d,!_),c>un&&(s.moveTo(c*Math.cos(d),c*Math.sin(d)),s.arc(0,0,c,d,p,_));else{var x,m,g=p,v=d,b=p,w=d,S=y,k=y,A=r.apply(this,arguments)/2,M=A>un&&(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>un){var z=vn(M/c*Math.sin(A)),I=vn(M/u*Math.sin(A));(S-=2*z)>un?(b+=z*=_?1:-1,w-=z):(S=0,b=w=(p+d)/2),(k-=2*I)>un?(g+=I*=_?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>un){var j=u*Math.cos(v),E=u*Math.sin(v),N=c*Math.cos(b),L=c*Math.sin(b);if(y<pn){var B=S>un?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>un?C>un?(x=bn(N,L,F,D,u,C,_),m=bn(j,E,O,R,u,C,_),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),!_):(s.arc(x.cx,x.cy,C,Math.atan2(x.y01,x.x01),Math.atan2(x.y11,x.x11),!_),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),!_),s.arc(m.cx,m.cy,C,Math.atan2(m.y11,m.x11),Math.atan2(m.y01,m.x01),!_))):(s.moveTo(F,D),s.arc(0,0,u,g,v,!_)):s.moveTo(F,D),c>un&&S>un?P>un?(x=bn(O,R,j,E,c,-P,_),m=bn(F,D,N,L,c,-P,_),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),!_):(s.arc(x.cx,x.cy,P,Math.atan2(x.y01,x.x01),Math.atan2(x.y11,x.x11),!_),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),_),s.arc(m.cx,m.cy,P,Math.atan2(m.y11,m.x11),Math.atan2(m.y01,m.x01),!_))):s.arc(0,0,c,w,b,_):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-pn/2;return[Math.cos(n)*i,Math.sin(n)*i]},l.innerRadius=function(e){return arguments.length?(t="function"==typeof e?e:cn(+e),l):t},l.outerRadius=function(t){return arguments.length?(e="function"==typeof t?t:cn(+t),l):e},l.cornerRadius=function(t){return arguments.length?(i="function"==typeof t?t:cn(+t),l):i},l.padRadius=function(t){return arguments.length?(n=null==t?null:"function"==typeof t?t:cn(+t),l):n},l.startAngle=function(t){return arguments.length?(o="function"==typeof t?t:cn(+t),l):o},l.endAngle=function(t){return arguments.length?(a="function"==typeof t?t:cn(+t),l):a},l.padAngle=function(t){return arguments.length?(r="function"==typeof t?t:cn(+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},ao=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]]},ro=function(t){var e=t.type,n=t.connectorData,o=t.subjectType;n||(n={}),n.points&&"number"!=typeof n.points||(n.points=so(e.annotation.offset,n.points)),n.curve||(n.curve=jn);var a=[];if(e.editMode){var r=n.points.map((function(t,e){return Xn({},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 Xn({},t.move,{drag:s.bind(e,t.index)})})))}var l=ao({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:[no({data:l,curve:n.curve,className:"connector"})],handles:a}},so=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},lo=function(t){var e=t.subjectData,n=t.type;e.radius||e.outerRadius||(e.radius=20);var o=[],a=oo({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=[Xn({},r.r1,{drag:s.bind(n,void 0!==e.outerRadius?"outerRadius":"radius")})];e.innerRadius&&l.push(Xn({},r.r2,{drag:s.bind(n,"innerRadius")})),o=n.mapHandles(l)}return a.attrs["fill-opacity"]=0,{components:[a],handles:o}},ho=function(){function t(e){var i=e.a,n=e.annotation,o=e.editMode,a=e.dispatcher,r=e.notePadding,s=e.accessors;if(Gn(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=xo.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 Yn(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{_o(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 go(this.note,".annotation-note-content text")}},{key:"getNoteBBoxOffset",value:function(){var t=go(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=lo(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=no({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:[no({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=oo({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=oo({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=no({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=no({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?ro(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:[no({data:p,className:"connector"})]}}(o):function(t){var e=ao(t);return{components:[no({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:[no({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=oo({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=$n(e,s.y))?a-=r.height:"middle"===e&&(a-=r.height/2);var l=[[n,a],[n,a+r.height]];return{components:[no({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=to(e,r.x))?n-=s.width:"middle"===e&&(n-=s.width/2);var l=[[n,a],[n+s.width,a]];return{components:[no({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,y: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!==eo.indexOf(r)?(a=to(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!==io.indexOf(r)&&(a=$n(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 Xn({},t,{start:e.dragstarted.bind(e),end:e.dragended.bind(e)})}))}}]),t}(),co=function(t,e,i){return function(t){function n(t){Gn(this,n);var i=Zn(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 Qn(n,t),Yn(n,[{key:"className",value:function(){return""+(e.className||Un(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"className",this)&&Un(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"className",this).call(this)||"")}},{key:"drawSubject",value:function(t){return this.typeSettings.subject=Xn({},e.subject,this.typeSettings.subject),Un(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"drawSubject",this).call(this,Xn({},t,this.typeSettings.subject))}},{key:"drawConnector",value:function(t){return this.typeSettings.connector=Xn({},e.connector,this.typeSettings.connector),Un(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"drawConnector",this).call(this,Xn({},t,e.connector,this.typeSettings.connector))}},{key:"drawNote",value:function(t){return this.typeSettings.note=Xn({},e.note,this.typeSettings.note),Un(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"drawNote",this).call(this,Xn({},t,e.note,this.typeSettings.note))}},{key:"drawNoteContent",value:function(t){return Un(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"drawNoteContent",this).call(this,Xn({},t,e.note,this.typeSettings.note))}}],[{key:"init",value:function(t,e){return Un(n.__proto__||Object.getPrototypeOf(n),"init",this).call(this,t,e),i&&(t=i(t,e)),t}}]),n}(t)},uo=function(t){function e(t){Gn(this,e);var i=Zn(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return i.textWrap=t.textWrap||120,i.drawText(),i}return Qn(e,t),Yn(e,[{key:"updateTextWrap",value:function(t){this.textWrap=t,this.drawText()}},{key:"drawText",value:function(){if(this.note){_o(this.note,[this.annotation],"g","annotation-note-content");var t=this.note.select("g.annotation-note-content");_o(t,[this.annotation],"rect","annotation-note-bg"),_o(t,[this.annotation],"text","annotation-note-label"),_o(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":Wn(a))&&(r=Xn(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(mo,n,o),e=s.node().getBBox()}i.text(this.annotation.note.label).attr("dx","0"),i.call(mo,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}(ho);co(uo,{className:"label",note:{align:"middle"}});var po=co(uo,{className:"callout",note:{lineType:"horizontal"}}),fo=co(po,{className:"callout elbow",connector:{type:"elbow"}});co(po,{className:"callout curve",connector:{type:"curve"}}),co(ho,{className:"badge",subject:{type:"badge"},disable:["connector","note"]}),co(uo,{className:"callout circle",subject:{type:"circle"},note:{lineType:"horizontal"},connector:{type:"elbow"}}),co(uo,{className:"callout rect",subject:{type:"rect"},note:{lineType:"horizontal"},connector:{type:"elbow"}});var yo=function(t){function e(){return Gn(this,e),Zn(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return Qn(e,t),Yn(e,[{key:"mapY",value:function(t){Un(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){Un(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}(po);co(yo,{className:"callout xythreshold",subject:{type:"threshold"}});var _o=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},xo=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)}))},mo=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))}))},go=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 vo(t){return.65*(t-.5)*2*Math.PI}function bo(t,e){return{x:Math.cos(t-Math.PI/2)*e,y:Math.sin(t-Math.PI/2)*e}}function wo(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=bo(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 So(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 ko=function(t){function e(){var e=t.call(this)||this;return e._d3Arc=O().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=po,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 Jn(t)}));e=e||new Kn({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");_o(y,e.annotations,"g","annotation"),y.selectAll("g.annotation").each((function(t){var e=i.select(this);e.attr("class","annotation"),_o(e,[t],"g","annotation-connector"),_o(e,[t],"g","annotation-subject"),_o(e,[t],"g","annotation-note"),_o(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(fo).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:vo(0),endAngle:vo(0)}).style("fill","green").on("mousemove",(function(t){var e=n._d3Arc.centroid(t),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:vo(0),endAngle:vo(1)}).style("fill","lightGrey"),this._meanArc=i.append("path").datum({startAngle:vo(0),endAngle:vo(0)}).style("fill","black").on("mousemove",(function(t){var e=n._d3Arc.centroid(t),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:vo(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=o._d3Arc.centroid(o._meanArc.datum()),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",So(vo(0),vo(s),this._d3Arc)),this._freeArc.style("fill",this.emptyColor()).transition().duration(750).attrTween("d",So(vo(s),vo(1),this._d3Arc)),this._meanArc.style("fill",this.tickColor()).style("visibility",this.showTick()?"visible":"hidden").transition().duration(750).attrTween("d",So(vo(l-.001),vo(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",wo(vo(l),a,!0)),this._indOuter.style("fill",this.tickColor()).style("stroke",this.tickColor()).style("visibility",this.showTick()?"visible":"hidden").transition().duration(750).attrTween("transform",wo(vo(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=bo(vo(1),a-8);this.updateText(this._centerText,-h.x,-h.y,2*h.x,2*h.y);var c=bo(vo(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);ko.prototype._class+=" chart_Gauge",ko.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."),ko.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."),ko.prototype.publish("emptyColor","lightgrey","html-color","Color of the empty portion of the gauge"),ko.prototype.publish("tickColor","black","html-color","Color of the tick");Pt(".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 Ao=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=H,e=B,i=null,n=y(0),o=y(M),a=y(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(M,Math.max(-M,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:y(+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:y(+t),r):n},r.endAngle=function(t){return arguments.length?(o="function"==typeof t?t:y(+t),r):o},r.padAngle=function(t){return arguments.length?(a="function"==typeof t?t:y(+t),r):a},r}(),n.d3Arc=O(),n.d3LabelArc=O(),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(),h=s+12;this.d3Arc.innerRadius(r).padRadius(s).outerRadius(s),this._quadIdxArr=[[],[],[],[]];var c=l([],this.data(),!0).sort((function(t,e){return t[1]-e[1]>0?-1:1})),u=this._slices.selectAll(".arc").data(this.d3Pie(c),(function(t){return t.data[0]}));this._labelPositions=[],u.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",_(0,0)).on("mouseout",_(-5,150))})).merge(u).transition().attr("opacity",1).each((function(t,e){var n=a.getQuadrant(y(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]))})),u.exit().transition().style("opacity",0).remove(),this.d3LabelArc.innerRadius(h).outerRadius(h);var p=this._labels.selectAll("text").data(this.showLabels()?this.d3Pie(c):[],(function(t){return t.data[0]})),d=p.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(p).text((function(t){return o.getLabelText(t,!0)})).each((function(t,e){var i=a.d3LabelArc.centroid(t),n=y(t);i[0]=h*(a.isLeftSide(n)?1:-1),a._labelPositions.push({top:i[1],bottom:i[1]+a.labelHeight()})}));this.showLabels()&&(this.adjustForOverlap(),d.transition().style("font-size",this.labelHeight()+"px").attr("transform",(function(t,e){var i=a.d3LabelArc.centroid(t);return i[0]=h*(a.isLeftSide(y(t))?1:-1),i[1]=a._labelPositions[e].top,"translate("+i+")"})).style("text-anchor",(function(t){return o.isLeftSide(y(t))?"start":"end"}))),p.exit().remove();var f=this._labels.selectAll("polyline").data(this.showLabels()?this.d3Pie(c):[],(function(t){return o.getLabelText(t,!0)}));function y(t){return t.startAngle+(t.endAngle-t.startAngle)/2}function _(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)}}))}}f.enter().append("polyline").merge(f).transition().attr("points",(function(t,e){var i=a.d3LabelArc.centroid(t),n=a.d3Arc.centroid(t),o=l([],i,!0);return i[0]=h*(a.isLeftSide(y(t))?1:-1),i[1]=a._labelPositions[e].top,[n,o,i]})),f.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()));this.d3Pie.padAngle(.0025).startAngle(t).endAngle(2*Math.PI+t).sort((function(t,e){return e[1]<t[1]?-1:e[1]>t[1]?1:0})).value((function(t){return t[1]}))},o.__inputs=[{id:"label",type:"string"},{id:"value",type:"number"}],o}(i.SVGWidget);Ao.prototype._class+=" chart_Pie",Ao.prototype.implements(e.I2DChart.prototype),Ao.prototype.implements(e.ITooltip.prototype),Ao.prototype.mixin(i.Utility.SimpleSelectionMixin),Ao.prototype.publish("showLabels",!0,"boolean","If true, wedge labels will display"),Ao.prototype.publish("showSeriesValue",!1,"boolean","Append data series value next to label",null,{disable:function(t){return!t.showLabels()}}),Ao.prototype.publish("seriesValueFormat",",.0f","string","Number format used for formatting series values",null,{disable:function(t){return!t.showSeriesValue()}}),Ao.prototype.publish("showSeriesPercentage",!1,"boolean","Append data series percentage next to label",null,{disable:function(t){return!t.showLabels()}}),Ao.prototype.publish("seriesPercentageFormat",",.0f","string","Number format used for formatting series percentages",null,{disable:function(t){return!t.showSeriesPercentage()}}),Ao.prototype.publish("paletteID","default","set","Color palette for this widget",Ao.prototype._palette.switch(),{tags:["Basic","Shared"]}),Ao.prototype.publish("useClonedPalette",!1,"boolean","Enable or disable using a cloned palette",null,{tags:["Intermediate","Shared"]}),Ao.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}}),Ao.prototype.publish("minOuterRadius",20,"number","Minimum outer radius (pixels)"),Ao.prototype.publish("startAngle",0,"number","Starting angle of the first (and largest) wedge (degrees)"),Ao.prototype.publish("labelHeight",12,"number","Font size of labels (pixels)",null,{disable:function(t){return!t.showLabels()}});var Mo=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}(Ao);Mo.prototype._class+=" chart_HalfPie";var To=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=Po(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=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}(zt);function Po(t){if(!(this instanceof Po))return new Po(t);this._canvas=t="string"==typeof t?document.getElementById(t):t,this._ctx=t.getContext("2d"),this._width=t.width,this._height=t.height,this._max=1,this._data=[]}To.prototype._class+=" chart_Heat",To.prototype._palette=i.Palette.rainbow("default"),To.prototype.publish("paletteID","default","set","Color palette for this widget",To.prototype._palette.switch(),{tags:["Basic"]}),To.prototype.publish("useClonedPalette",!1,"boolean","Enable or disable using a cloned palette",null,{tags:["Intermediate","Shared"]}),To.prototype.publish("reversePalette",!1,"boolean","Reverse Palette Colors",null,{disable:function(t){return"default"===t.paletteID()}}),To.prototype.publish("radiusX",25,"number","Point X radius (25 by default)"),To.prototype.publish("radiusY",25,"number","Point Y radius (25 by default)"),To.prototype.publish("radiusAsPercent",!1,"boolean","Calculate RadiusX + RadiusY as % of size"),To.prototype.publish("blur",15,"number","Point blur radius (15 by default)"),To.prototype.publish("minOpacity",.05,"number","Minimum point opacity (0.05 by default)"),Po.prototype={defaultRadius:25,defaultGradient:{.4:"blue",.6:"cyan",.7:"lime",.8:"yellow",1:"red"},data:function(t){return this._data=t,this},max:function(t){return this._max=t,this},add:function(t){return this._data.push(t),this},clear:function(){return this._data=[],this},radius:function(t,e,i){i=void 0===i?15:i;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],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 Co=Math.PI/3,zo=[0,Co,2*Co,3*Co,4*Co,5*Co];function Io(t){return t[0]}function Fo(t){return t[1]}Pt(".chart_HexBin .hexagon{fill:none;stroke:#000;stroke-width:.5px}.chart_HexBin .hexagon.selected{stroke:red}");var Do=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=Io,l=Fo;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 zo.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(Co),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}(zt);Do.prototype._class+=" chart_HexBin",Do.prototype.implements(e.I2DAggrChart.prototype),Do.prototype.implements(e.ITooltip.prototype),Do.prototype.publish("paletteID","Blues","set","Color palette for this widget",Do.prototype._palette.switch(),{tags:["Basic","Shared"]}),Do.prototype.publish("useClonedPalette",!1,"boolean","Enable or disable using a cloned palette",null,{tags:["Intermediate","Shared"]}),Do.prototype.publish("binSize",20,"number","Bin radius",null,{range:{min:1,max:300,step:1}});Pt(".chart_Line .dataLine{fill:none;stroke:#4682b4;stroke-width:1.5px}");var Oo=function(t){function e(){var e=t.call(this)||this;return e.interpolate_default("linear"),e}return a(e,t),e}(It);Oo.prototype._class+=" chart_Line";var Ro=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}(Ao);Ro.prototype._class+=" chart_QuarterPie",Ro.prototype.publish("orientation","left","set","Determines the placement and start/end angle.",["left","right"]);var jo=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);jo.prototype._class+=" chart_QuartileCandlestick",jo.prototype.publish("textColor","black","html-color","Color of label and value text"),jo.prototype.publish("showLabels",!0,"boolean","If true, labels will be shown"),jo.prototype.publish("showValues",!0,"boolean","If true, values will be shown"),jo.prototype.publish("orientation","horizontal","set","Determines layout",["horizontal","vertical"]),jo.prototype.publish("valueFontSize",12,"number","Font size of value text (pixels)"),jo.prototype.publish("labelFontSize",12,"number","Font size of label text (pixels)"),jo.prototype.publish("roundedCorners",8,"number","Radius of rounded rect corners (pixels)"),jo.prototype.publish("lineWidth",4,"number","Width of lines (pixels)"),jo.prototype.publish("candleWidth",null,"number","Height of outer rect (pixels)",null,{optional:!0}),jo.prototype.publish("textPadding",8,"number","Padding between outer rect and text (pixels)"),jo.prototype.publish("edgePadding",30,"number","Padding between outer rect and left/right sides (pixels)"),jo.prototype.publish("lineColor","#333","html-color","Color of outer rect and lines"),jo.prototype.publish("innerRectColor","white","html-color","Color of the inner rects"),jo.prototype.publish("upperTextRotation",-60,"number","Rotation of label text (degrees)"),jo.prototype.publish("lowerTextRotation",-60,"number","Rotation of value text (degrees)");Pt(".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 Eo=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);Eo.prototype._class+=" chart_Radar",Eo.prototype.implements(e.INDChart.prototype),Eo.prototype.implements(e.ITooltip.prototype),Eo.prototype.mixin(i.Utility.SimpleSelectionMixin),Eo.prototype.publish("paletteID","default","set","Color palette for this widget",Eo.prototype._palette.switch()),Eo.prototype.publish("pointShape","cross","set","pointShape",["circle","rectangle","cross"]),Eo.prototype.publish("pointSize",6,"number","Point Size",null,{range:{min:1,step:1,max:200}}),Eo.prototype.publish("valueGuideRatios",[.2,.4,.6,.8,1],"array","Array of values between 0 and 1 that are multiplied by the widget radius to produce guide lines"),Eo.prototype.publish("fillOpacity",.66,"number","Opacity of the data polygon(s)"),Eo.prototype.publish("fontFamily","","string","fontFamily"),Eo.prototype.publish("fontSize",16,"number","fontSize"),Eo.prototype.publish("labelPaddingRatio",.9,"number","labelPaddingRatio");Pt(".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 No=function(t){function n(){var n=t.call(this)||this;return n._domainScale=i.scaleBand(),n._valueScale=i.scaleLinear(),n._d3Arc=O().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,l([this.valueDomainHigh_exists()?this.valueDomainHigh():0],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()),h=this.textSize(s.map((function(t){return""+t})),"Verdana",12).width,c=Math.min(this.width()-2*(10+h),this.height()-44)/2,u=this.data().map((function(t){return t[0]}));this._domainScale.domain(u).range([0,c]).padding(this.domainPadding());var p=this._domainScale.step()*this._domainScale.padding(),d=this._radialAxis.selectAll("circle").data(u);d.enter().append("circle").attr("fill","transparent").merge(d).attr("r",(function(t){return o._domainScale(t)+o._domainScale.step()-p/2})),d.exit().remove();var f=this._radialAxis.selectAll(".arc-text").data(u);f.enter().append("text").attr("class","arc-text").attr("x",-4).attr("alignment-baseline","middle").attr("text-anchor","end").merge(f).attr("y",(function(t){return-o._domainScale(t)-o._domainScale.bandwidth()/2})).text((function(t){return t})),f.exit().remove();var y=this._axialAxis.selectAll("line").data(s);y.enter().append("line").merge(y).attr("x2",(function(t){return c*Math.cos(o._valueScale(t)-o.radians(90))})).attr("y2",(function(t){return c*Math.sin(o._valueScale(t)-o.radians(90))})),y.exit().remove();var _=this._axialAxis.selectAll("text").data(s);_.enter().append("text").style("dominant-baseline","central").merge(_).attr("x",(function(t){return(c+10)*Math.cos(o._valueScale(t)-o.radians(90))})).attr("y",(function(t){return(c+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})),_.exit().remove();var x=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 m=this._arcs.selectAll("path").data(this.data(),(function(t){return t[0]}));m.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),x,a._selection.selected(this))})).on("dblclick",(function(t,e){a.dblclick(a.rowToObj(t),x,a._selection.selected(this))})).merge(m).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)}})),m.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);No.prototype._class+=" chart_RadialBar",No.prototype.implements(e.INDChart.prototype),No.prototype.implements(e.ITooltip.prototype),No.prototype.mixin(i.Utility.SimpleSelectionMixin),No.prototype.publish("paletteID","default","set","Color palette for this widget",No.prototype._palette.switch()),No.prototype.publish("tickCount",10,"number","Number of ticks to display"),No.prototype.publish("domainPadding",.25,"number","Padding between chart edge and container edge (0..1)"),No.prototype.publish("valueMaxAngle",270,"number","Maximum angular length of a bar (degrees)"),No.prototype.publish("valueDomainHigh",null,"number","Value domain high",void 0,{optional:!0}),No.prototype.publish("transitionDelay",100,"number","Delay between the start of each row animation (ms)"),No.prototype.publish("transitionDuration",750,"number","Duration of a row's animation (ms)");var Lo=i.Palette.rainbow("Blues"),Bo=i.Palette.ordinal("Quartile",[Lo(100,0,100),Lo(50,0,100),Lo(50,0,100),Lo(75,0,100)]);Bo("Std. Dev."),Bo("MinMax"),Bo("25%"),Bo("50%");var Ho=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._bellCurve=(new It).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 jo).columns(["Min","25%","50%","75%","Max"]).edgePadding(0).roundedCorners(1).lineWidth(1).upperTextRotation(-90).lowerTextRotation(-90).labelFontSize(0).valueFontSize(0).lineColor(Lo(90,0,100)).innerRectColor(Lo(10,0,100)),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.data()[0][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.mean=function(t){return arguments.length?(this._mean=t,this.data()[0]&&(this.data()[0][5]=t),this):this._mean},e.prototype.standardDeviation=function(t){return arguments.length?(this._standardDeviation=t,this.data()[0]&&(this.data()[0][6]=t),this):this._standardDeviation},e.prototype.quartiles=function(t){return arguments.length?(this._quartiles=t,this.data()[0]&&(this.data()[0]=t.concat(this.data()[0].slice(-2))),this):this._quartiles},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._selectMode=i.append("div").style("position","absolute").style("top","0px").style("right","0px").append("select").on("change",(function(){n.render()})),this._selectMode.append("option").attr("value","min_max").text("Min / Max"),this._selectMode.append("option").attr("value","25_75").text("25% / 75%"),this._selectMode.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=this.domain(this._selectMode.node().value),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._selectMode.node().value,e=this.domain(t),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.data()[0]&&7===this.data()[0].length&&(this.quartiles(this.data()[0].slice(0,5)),this.mean(this.data()[0][5]),this.standardDeviation(this.data()[0][6])),this.updateScatter(),this.updateCandle()},e}(i.HTMLWidget);Ho.prototype.publish("tickFormat",".2e","string","X-Axis Tick Format"),Ho.prototype.publish("candleHeight",20,"number","Height of candle widget (pixels)"),Ho.prototype.publish("domainPadding",10,"number","Domain value padding");var Vo=function(t){function e(){var e=t.call(this)||this;return e.interpolate_default("step"),e}return a(e,t),e}(It);Vo.prototype._class+=" chart_Step";Pt(".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 qo="text",Wo="html",Go=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()?Wo:qo](a.value),this._textDiv.style("font-size",this.textFontSize()+"px")[this.labelHTML()?Wo:qo](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);Go.prototype._class+=" chart_Summary",Go.prototype.implements(e.I2DChart.prototype),Go.prototype.publish("iconColumn",null,"set","Select Icon Column",(function(){return this.columns()}),{optional:!0}),Go.prototype.publish("icon","fa-briefcase","string","FA Char icon class",null,{disable:function(t){return t.iconColumn()}}),Go.prototype.publish("headerFontSize",null,"number","headerFontSize"),Go.prototype.publish("textFontSize",null,"number","textFontSize"),Go.prototype.publish("moreFontSize",null,"number","moreFontSize"),Go.prototype.publish("iconFontSize",null,"number","iconFontSize"),Go.prototype.publish("hideLabel",!1,"boolean","Hide label column"),Go.prototype.publish("labelColumn",null,"set","Select display value",(function(){return this.columns()}),{optional:!0,disable:function(t){return t.hideLabel()}}),Go.prototype.publish("labelHTML",!1,"boolean","Allow HTML",null,{disable:function(t){return t.hideLabel()}}),Go.prototype.publish("valueColumn",null,"set","Select display value",(function(){return this.columns()}),{optional:!0}),Go.prototype.publish("valueHTML",!1,"boolean","Allow HTML"),Go.prototype.publish("hideMore",!1,"boolean","Hide More Information"),Go.prototype.publish("hideMoreWrapper",!1,"boolean","Hide More Information Wrapper"),Go.prototype.publish("moreWrapperHeight",null,"number","Height of the 'more' text wrapper (pixels)"),Go.prototype.publish("moreIconColumn",null,"set","Select More Icon Column",(function(){return this.columns()}),{optional:!0,disable:function(t){return t.hideMore()}}),Go.prototype.publish("moreIcon","fa-info-circle","string","FA Char icon class",null,{disable:function(t){return t.hideMore()||t.moreIconColumn()}}),Go.prototype.publish("moreTextColumn",null,"set","Select display value",(function(){return this.columns()}),{optional:!0,disable:function(t){return t.hideMore()}}),Go.prototype.publish("moreText","More Info","string","More text",null,{disable:function(t){return t.hideMore()||t.moreTextColumn()}}),Go.prototype.publish("moreTextHTML",!1,"boolean","Allow HTML",null,{disable:function(t){return t.hideMore()}}),Go.prototype.publish("colorFillColumn",null,"set","Column for color",(function(){return this.columns()}),{optional:!0}),Go.prototype.publish("colorFill","#3498db","html-color","Fill Color",null,{disable:function(t){return t.colorFillColumn()}}),Go.prototype.publish("colorStrokeColumn",null,"set","Column for color",(function(){return this.columns()}),{optional:!0}),Go.prototype.publish("colorStroke","#ffffff","html-color","Fill Color",null,{disable:function(t){return t.colorStrokeColumn()}}),Go.prototype.publish("fixedSize",!0,"boolean","Fix Size to Min Width/Height"),Go.prototype.publish("minWidth",225,"number","Minimum Width"),Go.prototype.publish("minHeight",150,"number","Minimum Height"),Go.prototype.publish("playInterval",null,"number","Play Interval",null,{optional:!0});var Yo=Go.prototype.playInterval;Go.prototype.playInterval=function(t){var e=Yo.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 Xo=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);Xo.prototype._class+=" chart_SummaryC",Xo.prototype.implements(e.I2DChart.prototype),Xo.prototype.publish("iconBaseline","bottom","string","Text baseline for the icon",["top","middle","bottom"]),Xo.prototype.publish("iconAnchor","end","set","Anchors the icon either at the start, middle, or end of the summary",["start","middle","end"]),Xo.prototype.publish("valueAnchor","start","set","Anchors the value either at the start, middle, or end of the summary",["start","middle","end"]),Xo.prototype.publish("labelAnchor","start","set","Anchors the label either at the start, middle, or end of the summary",["start","middle","end"]),Xo.prototype.publish("iconColumn",null,"set","Select Icon Column",(function(){return this.columns()}),{optional:!0}),Xo.prototype.publish("icon","fa-briefcase","string","FA Char icon class",null,{disable:function(t){return t.iconColumn()}}),Xo.prototype.publish("fontFamily","Arial","string","Font Family"),Xo.prototype.publish("labelColumn",null,"set","Select display value",(function(){return this.columns()}),{optional:!0}),Xo.prototype.publish("valueColumn",null,"set","Select display value",(function(){return this.columns()}),{optional:!0}),Xo.prototype.publish("colorFillColumn",null,"set","Column for background color",(function(){return this.columns()}),{optional:!0}),Xo.prototype.publish("colorFill","#0097e6","html-color","Background Color",null,{disable:function(t){return t.colorFillColumn()}}),Xo.prototype.publish("colorStrokeColumn",null,"set","Column for font color",(function(){return this.columns()}),{optional:!0}),Xo.prototype.publish("colorStroke","#2f3640","html-color","Font Color",null,{disable:function(t){return t.colorStrokeColumn()}}),Xo.prototype.publish("fixedSize",!0,"boolean","Fix Size to Min Width/Height"),Xo.prototype.publish("minWidth",225,"number","Minimum Width"),Xo.prototype.publish("minHeight",150,"number","Minimum Height"),Xo.prototype.publish("playInterval",null,"number","Play Interval",null,{optional:!0}),Xo.prototype.publish("fontSizeRatio",.618,"number","Ratio between widget height and value font size"),Xo.prototype.publish("valueOpacity",1,"number","Opacity of value text (0..1)"),Xo.prototype.publish("labelOpacity",.9,"number","Opacity of label text (0..1)"),Xo.prototype.publish("iconOpacity",.3,"number","Opacity of icon text (0..1)"),Xo.prototype.publish("paddingSizeRatio",.1,"number","Ratio of the smallest dimension for edge padding (0..1)"),Xo.prototype.publish("iconSizeRatio",.9,"number","Ratio of the height for icon size (0..1)");var Uo=Xo.prototype.playInterval;Xo.prototype.playInterval=function(t){var e=Uo.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 Qo=Math.PI/180,Zo=64,Jo=2048;function Ko(){var t=i.dispatch("word","end"),e={},n=[256,256],o=$o,a=ta,r=ia,s=ea,l=ea,h=na,c=oa,u=[],p=la,d=1/0,f=null,y=Math.random,_=ha;function x(t,e,i){for(var o,a,r,s,l,h=e.x,c=e.y,u=Math.sqrt(n[0]*n[0]+n[1]*n[1]),d=p(n),f=y()<.5?1:-1,_=-f;(o=d(_+=f))&&(a=~~o[0],r=~~o[1],!(Math.min(Math.abs(a),Math.abs(r))>=u));)if(e.x=h+a,e.y=c+r,!(e.x+e.x0<0||e.y+e.y0<0||e.x+e.x1>n[0]||e.y+e.y1>n[1]||i&&ra(e,t,n[0])||i&&(l=i,!((s=e).x+s.x1>l[0].x&&s.x+s.x0<l[1].x&&s.y+s.y1>l[0].y&&s.y+s.y0<l[1].y)))){for(var x=e.sprite,m=e.width>>5,g=n[0]>>5,v=e.x-(m<<4),b=127&v,w=32-b,S=e.y1-e.y0,k=(e.y+e.y0)*g+(v>>5),A=void 0,M=0;M<S;M++){A=0;for(var T=0;T<=m;T++)t[k+T]|=A<<w|(T<m?(A=x[M*m+T])>>>b:0);k+=g}return delete e.sprite,!0}return!1}return e.canvas=function(t){return arguments.length?(_=ca(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=(Zo<<5)/e,t.height=Jo/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,aa(i,a,w,v),a.hasText&&x(p,a,m)&&(b.push(a),t.call("word",e,a),m?sa(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=ca(t),e):a},e.fontStyle=function(t){return arguments.length?(s=ca(t),e):s},e.fontWeight=function(t){return arguments.length?(l=ca(t),e):l},e.rotate=function(t){return arguments.length?(h=ca(t),e):h},e.text=function(t){return arguments.length?(o=ca(t),e):o},e.spiral=function(t){return arguments.length?(p=ua[t]||t,e):p},e.fontSize=function(t){return arguments.length?(r=ca(t),e):r},e.padding=function(t){return arguments.length?(c=ca(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 $o(t){return t.text}function ta(){return"serif"}function ea(){return"normal"}function ia(t){return Math.sqrt(t.value)}function na(){return 30*(~~(6*Math.random())-3)}function oa(){return 1}function aa(t,e,i,n){if(!e.sprite){var o=t.context,a=t.ratio;o.clearRect(0,0,(Zo<<5)/a,Jo/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*Qo),d=Math.cos(e.rotate*Qo),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>=Zo<<5&&(r=0,s+=l,l=0),s+u>=Jo)break;o.translate((r+(c>>1))/a,(s+(u>>1))/a),e.rotate&&o.rotate(e.rotate*Qo),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,(Zo<<5)/a,Jo/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[(s+k)*(Zo<<5)+(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 ra(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 sa(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 la(t){var e=t[0]/t[1];return function(t){return[e*(t*=.1)*Math.cos(t),t*Math.sin(t)]}}function ha(){return document.createElement("canvas")}function ca(t){return"function"==typeof t?t:function(){return t}}var ua={archimedean:la,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]}}};Pt(".other_Wordcloud text{cursor:pointer}");var pa=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=Ko().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);pa.prototype._class+=" chart_WordCloud",pa.prototype.implements(e.I2DChart.prototype),pa.prototype.implements(e.ITooltip.prototype),pa.prototype.mixin(i.Utility.SimpleSelectionMixin),pa.prototype.publish("paletteID","default","set","Color palette for this widget",pa.prototype._palette.switch(),{tags:["Basic","Shared"]}),pa.prototype.publish("useClonedPalette",!1,"boolean","Enable or disable using a cloned palette",null,{tags:["Intermediate","Shared"]}),pa.prototype.publish("fontFamily","Impact","string","Font Name",null,{tags:["Basic"]}),pa.prototype.publish("fontSizeFrom",6,"number","Minimum font size (pixels)",null,{tags:["Basic"]}),pa.prototype.publish("fontSizeTo",48,"number","Maximum font size (pixels)",null,{tags:["Basic"]}),pa.prototype.publish("angleFrom",-60,"number","Minimum angle (degrees)",null,{tags:["Basic"]}),pa.prototype.publish("angleTo",60,"number","Maximum angle (degrees)",null,{tags:["Basic"]}),pa.prototype.publish("angleCount",5,"number","Number of different angles",null,{tags:["Basic"]}),pa.prototype.publish("padding",0,"number","Padding between words (pixels)",null,{tags:["Intermediate"]}),pa.prototype.publish("scaleMode","linear","set","Text scaling mode",["linear","log","sqrt","pow"],{tags:["Intermediate"]}),pa.prototype.publish("spiral","archimedean","set","Text scaling mode",["archimedean","rectangular"],{tags:["Intermediate"]}),pa.prototype.publish("offsetX",0,"number","X offset",null,{tags:["Advanced"]}),pa.prototype.publish("offsetY",0,"number","Y offset",null,{tags:["Advanced"]}),pa.prototype.publish("zoom",1,"number","Zoom",null,{tags:["Advanced"]}),t.Area=Ft,t.Axis=Ct,t.BUILD_VERSION="2.105.6",t.Bar=Ot,t.Bubble=re,t.BubbleXY=se,t.Bullet=ze,t.Column=Dt,t.Contour=ln,t.Gantt=hn,t.Gauge=ko,t.HalfPie=Mo,t.Heat=To,t.HexBin=Do,t.Line=Oo,t.PKG_NAME="@hpcc-js/chart",t.PKG_VERSION="2.83.2",t.Pie=Ao,t.QuarterPie=Ro,t.QuartileCandlestick=jo,t.Radar=Eo,t.RadialBar=No,t.Scatter=It,t.StatChart=Ho,t.Step=Vo,t.Summary=Go,t.SummaryC=Xo,t.WordCloud=pa,t.XYAxis=zt,Object.defineProperty(t,"__esModule",{value:!0})}));
|
|
2
2
|
//# sourceMappingURL=index.min.js.map
|