From e0f67e63c568bb7a491f917514c5c41928df0e2e Mon Sep 17 00:00:00 2001 From: Paul Harrison Date: Sat, 17 Feb 2024 11:37:41 +1100 Subject: [PATCH] Allow pointSize per point. Default colorVariation reduced. --- NEWS.md | 2 + R/langevitour.R | 7 +- README.md | 2 +- example.html | 8 +- inst/htmlwidgets/lib/langevitour-pack.js | 2 +- inst/htmlwidgets/lib/langevitour-pack.js.map | 2 +- lib/langevitour.js | 19 +- lib/langevitour.js.map | 2 +- man/langevitour.Rd | 4 +- py/examples/langevitour.ipynb | 178 ++++--------------- py/langevitour/langevitour.py | 4 +- py/langevitour/static/langevitour-pack.js | 2 +- src/langevitour.ts | 21 ++- vignettes/examples.Rmd | 2 +- 14 files changed, 80 insertions(+), 175 deletions(-) diff --git a/NEWS.md b/NEWS.md index e2e9899..f36e71d 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,6 +2,8 @@ # langevitour 0.7 * Refine full-screen logic. +* Default colorVariation seemed a bit much, reduced to 0.1. +* pointSize can now be specified per-point. # langevitour 0.6 diff --git a/R/langevitour.R b/R/langevitour.R index b18fb53..ccfa891 100644 --- a/R/langevitour.R +++ b/R/langevitour.R @@ -32,7 +32,7 @@ #' #' @param colorVariation Number between 0 and 1. Individual points are given slightly different brightnesses. How strong should this effect be? #' -#' @param pointSize Point radius in pixels. +#' @param pointSize Point radius in pixels. A single number, or a number for each row in X. #' #' @param subsample For speed, randomly subsample down to this many rows. #' @@ -74,7 +74,7 @@ langevitour <- function( X, group=NULL, name=NULL, center=NULL, scale=NULL, extraAxes=NULL, lineFrom=NULL, lineTo=NULL, lineColors=NULL, - axisColors=NULL, levelColors=NULL, colorVariation=0.3, pointSize=1, subsample=NULL, + axisColors=NULL, levelColors=NULL, colorVariation=0.1, pointSize=1, subsample=NULL, state=NULL, width=NULL, height=NULL, elementId=NULL, link=NULL, link_filter=TRUE) { @@ -121,6 +121,7 @@ langevitour <- function( ncol(X) >= 2, length(columnNames) == ncol(X), length(group) == nrow(X), + length(pointSize) == 1 || length(pointSize) == nrow(X), is.null(name) || length(name) == nrow(X), length(lineFrom) == length(lineTo), is.null(lineColors) || length(lineColors) == length(lineFrom), @@ -227,7 +228,7 @@ langevitour <- function( axisColors=as.list(as.character(axisColors)), levelColors=as.list(as.character(levelColors)), colorVariation=as.numeric(colorVariation), - pointSize=as.numeric(pointSize), + pointSize=as.numeric(pointSize), # Javascript side can handle unboxing here (number|number[]) crosstalkGroup=crosstalkGroup, crosstalkKey=crosstalkKey, diff --git a/README.md b/README.md index 4355975..f8c1aa6 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ Further material: * useR! 2022 conference [slides](https://logarithmic.net/langevitour/2022-useR/) and [video (extended edition)](https://www.youtube.com/watch?v=vKv9P13UACw) -* IASC-ARS 2023 [slides](https://logarithmic.net/langevitour/2023-iasc-ars/) for *Visualising high-dimensional genomics data: what Non-Linear Dimension Reduction hides and misrepresents.* Demonstrates some advanced tricks setting the state of the widget using buttons in a Quarto presentation. +* IASC-ARS 2023 [slides](https://logarithmic.net/langevitour/2023-iasc-ars/) and [short video](https://www.youtube.com/watch?v=gwqU9OoFwjQ) for *Visualising high-dimensional genomics data: what Non-Linear Dimension Reduction hides and misrepresents.* Demonstrates some advanced tricks setting the state of the widget using buttons in a Quarto presentation. * [R examples](https://logarithmic.net/langevitour/articles/examples.html) diff --git a/example.html b/example.html index 719e9b6..8c46a02 100644 --- a/example.html +++ b/example.html @@ -30,13 +30,14 @@ "use strict"; // Generate a sample dataset -let X = [ ], group = [ ]; +let X = [ ], group = [ ], pointSize = [ ]; let r = ()=>jStat.normal.sample(0,0.02); -let n = 20000; +let n = 1000; for(let i=0;i{var t={162:function(t){var e;t.exports=(e=function(t,e){var n=Array.prototype.concat,r=Array.prototype.slice,i=Object.prototype.toString;function o(e,n){var r=e>n?e:n;return t.pow(10,17-~~(t.log(r>0?r:-r)*t.LOG10E))}var a=Array.isArray||function(t){return"[object Array]"===i.call(t)};function s(t){return"[object Function]"===i.call(t)}function u(t){return"number"==typeof t&&t-t==0}function l(){return new l._init(arguments)}function c(){return 0}function f(){return 1}function h(t,e){return t===e?1:0}l.fn=l.prototype,l._init=function(t){if(a(t[0]))if(a(t[0][0])){s(t[1])&&(t[0]=l.map(t[0],t[1]));for(var e=0;e=0;e--,r++)n[r]=[t[r][e]];return n},l.transpose=function(t){var e,n,r,i,o,s=[];for(a(t[0])||(t=[t]),n=t.length,r=t[0].length,o=0;o0&&(s[r][0]=t[r][0]),u=1;un&&r>0)return[];if(r>0)for(i=t;in;i+=r)o.push(i);return o},l.slice=function(){function t(t,n,r,i){var o,a=[],s=t.length;if(n===e&&r===e&&i===e)return l.copy(t);if(i=i||1,(n=(n=n||0)>=0?n:s+n)===(r=(r=r||t.length)>=0?r:s+r)||0===i)return[];if(nr&&i>0)return[];if(i>0)for(o=n;or;o+=i)a.push(t[o]);return a}return function(e,n){var r,i;return u((n=n||{}).row)?u(n.col)?e[n.row][n.col]:t(l.rowa(e,n.row),(r=n.col||{}).start,r.end,r.step):u(n.col)?t(l.cola(e,n.col),(i=n.row||{}).start,i.end,i.step):(i=n.row||{},r=n.col||{},t(e,i.start,i.end,i.step).map((function(e){return t(e,r.start,r.end,r.step)})))}}(),l.sliceAssign=function(n,r,i){var o,a;if(u(r.row)){if(u(r.col))return n[r.row][r.col]=i;r.col=r.col||{},r.col.start=r.col.start||0,r.col.end=r.col.end||n[0].length,r.col.step=r.col.step||1,o=l.arange(r.col.start,t.min(n.length,r.col.end),r.col.step);var s=r.row;return o.forEach((function(t,e){n[s][t]=i[e]})),n}if(u(r.col)){r.row=r.row||{},r.row.start=r.row.start||0,r.row.end=r.row.end||n.length,r.row.step=r.row.step||1,a=l.arange(r.row.start,t.min(n[0].length,r.row.end),r.row.step);var c=r.col;return a.forEach((function(t,e){n[t][c]=i[e]})),n}return i[0].length===e&&(i=[i]),r.row.start=r.row.start||0,r.row.end=r.row.end||n.length,r.row.step=r.row.step||1,r.col.start=r.col.start||0,r.col.end=r.col.end||n[0].length,r.col.step=r.col.step||1,a=l.arange(r.row.start,t.min(n.length,r.row.end),r.row.step),o=l.arange(r.col.start,t.min(n[0].length,r.col.end),r.col.step),a.forEach((function(t,e){o.forEach((function(r,o){n[t][r]=i[e][o]}))})),n},l.diagonal=function(t){var e=l.zeros(t.length,t.length);return t.forEach((function(t,n){e[n][n]=t})),e},l.copy=function(t){return t.map((function(t){return u(t)?t:t.map((function(t){return t}))}))};var d=l.prototype;return d.length=0,d.push=Array.prototype.push,d.sort=Array.prototype.sort,d.splice=Array.prototype.splice,d.slice=Array.prototype.slice,d.toArray=function(){return this.length>1?r.call(this):r.call(this)[0]},d.map=function(t,e){return l(l.map(this,t,e))},d.cumreduce=function(t,e){return l(l.cumreduce(this,t,e))},d.alter=function(t){return l.alter(this,t),this},function(t){for(var e=0;e=0;)e+=t[n];return e},t.sumsqrd=function(t){for(var e=0,n=t.length;--n>=0;)e+=t[n]*t[n];return e},t.sumsqerr=function(e){for(var n,r=t.mean(e),i=0,o=e.length;--o>=0;)i+=(n=e[o]-r)*n;return i},t.sumrow=function(t){for(var e=0,n=t.length;--n>=0;)e+=t[n];return e},t.product=function(t){for(var e=1,n=t.length;--n>=0;)e*=t[n];return e},t.min=function(t){for(var e=t[0],n=0;++ne&&(e=t[n]);return e},t.unique=function(t){for(var e={},n=[],r=0;ra?(u=[i[e]],a=o,s=0):o===a&&(u.push(i[e]),s++),o=1);return 0===s?u[0]:u},t.range=function(e){return t.max(e)-t.min(e)},t.variance=function(e,n){return t.sumsqerr(e)/(e.length-(n?1:0))},t.pooledvariance=function(e){return e.reduce((function(e,n){return e+t.sumsqerr(n)}),0)/(e.reduce((function(t,e){return t+e.length}),0)-e.length)},t.deviation=function(e){for(var n=t.mean(e),r=e.length,i=new Array(r),o=0;o=0;o--)i.push(e.abs(n[o]-r));return t.mean(i)},t.meddev=function(n){for(var r=t.median(n),i=[],o=n.length-1;o>=0;o--)i.push(e.abs(n[o]-r));return t.median(i)},t.coeffvar=function(e){return t.stdev(e)/t.mean(e)},t.quartiles=function(t){var n=t.length,i=t.slice().sort(r);return[i[e.round(n/4)-1],i[e.round(n/2)-1],i[e.round(3*n/4)-1]]},t.quantiles=function(t,n,o,a){var s,u,l,c,f,h=t.slice().sort(r),d=[n.length],p=t.length;for(void 0===o&&(o=3/8),void 0===a&&(a=3/8),s=0;s1){for(u=!0===r?this:this.transpose();s1){for("sumrow"!==e&&(u=!0===r?this:this.transpose());s1){for(s=s.transpose();a=0;s--)a*=r,a+=l[s];if(o=a/n+.5*e.log(i)+(n-.5)*e.log(n)-n,t<=7)for(s=1;s<=u;s++)o-=e.log(n-1),n-=1;return o},t.gammafn=function(t){var n,r,i,o,a=[-1.716185138865495,24.76565080557592,-379.80425647094563,629.3311553128184,866.9662027904133,-31451.272968848367,-36144.413418691176,66456.14382024054],s=[-30.8402300119739,315.35062697960416,-1015.1563674902192,-3107.771671572311,22538.11842098015,4755.846277527881,-134659.9598649693,-115132.2596755535],u=!1,l=0,c=0,f=0,h=t;if(t>171.6243769536076)return 1/0;if(h<=0){if(!(o=h%1+36e-17))return 1/0;u=(1&h?-1:1)*e.PI/e.sin(e.PI*o),h=1-h}for(i=h,r=h<1?h++:(h-=l=(0|h)-1)-1,n=0;n<8;++n)f=(f+a[n])*r,c=c*r+s[n];if(o=f/c+1,ih)for(n=0;n=1?n:1/n)+.4*n+17);if(r<0||n<=0)return NaN;if(r170||r>170?e.exp(t.combinationln(n,r)):t.factorial(n)/t.factorial(r)/t.factorial(n-r)},t.combinationln=function(e,n){return t.factorialln(e)-t.factorialln(n)-t.factorialln(e-n)},t.permutation=function(e,n){return t.factorial(e)/t.factorial(e-n)},t.betafn=function(n,r){if(!(n<=0||r<=0))return n+r>170?e.exp(t.betaln(n,r)):t.gammafn(n)*t.gammafn(r)/t.gammafn(n+r)},t.betaln=function(e,n){return t.gammaln(e)+t.gammaln(n)-t.gammaln(e+n)},t.betacf=function(t,n,r){var i,o,a,s,u=1e-30,l=1,c=n+r,f=n+1,h=n-1,d=1,p=1-c*t/f;for(e.abs(p)=1)return e.max(100,r+100*e.sqrt(r));if(n<=0)return 0;for(r>1?(u=e.log(f),l=e.exp(f*(u-1)-h),s=n<.5?n:1-n,i=(2.30753+.27061*(o=e.sqrt(-2*e.log(s))))/(1+o*(.99229+.04481*o))-o,n<.5&&(i=-i),i=e.max(.001,r*e.pow(1-1/(9*r)-i/(3*e.sqrt(r)),3))):i=n<(o=1-r*(.253+.12*r))?e.pow(n/o,1/r):1-e.log(1-(n-o)/(1-o));c<12;c++){if(i<=0)return 0;if((i-=o=(a=(t.lowRegGamma(r,i)-n)/(o=r>1?l*e.exp(-(i-f)+f*(e.log(i)-u)):e.exp(-i+f*e.log(i)-h)))/(1-.5*e.min(1,a*((r-1)/i-1))))<=0&&(i=.5*(i+o)),e.abs(o)<1e-8*i)break}return i},t.erf=function(t){var n,r,i,o,a=[-1.3026537197817094,.6419697923564902,.019476473204185836,-.00956151478680863,-.000946595344482036,.000366839497852761,42523324806907e-18,-20278578112534e-18,-1624290004647e-18,130365583558e-17,1.5626441722e-8,-8.5238095915e-8,6.529054439e-9,5.059343495e-9,-9.91364156e-10,-2.27365122e-10,96467911e-18,2394038e-18,-6886027e-18,894487e-18,313092e-18,-112708e-18,381e-18,7106e-18,-1523e-18,-94e-18,121e-18,-28e-18],s=a.length-1,u=!1,l=0,c=0;for(t<0&&(t=-t,u=!0),r=4*(n=2/(2+t))-2;s>0;s--)i=l,l=r*l-c+a[s],c=i;return o=n*e.exp(-t*t+.5*(a[0]+r*l)-c),u?o-1:1-o},t.erfc=function(e){return 1-t.erf(e)},t.erfcinv=function(n){var r,i,o,a,s=0;if(n>=2)return-100;if(n<=0)return 100;for(a=n<1?n:2-n,r=-.70711*((2.30753+.27061*(o=e.sqrt(-2*e.log(a/2))))/(1+o*(.99229+.04481*o))-o);s<2;s++)r+=(i=t.erfc(r)-a)/(1.1283791670955126*e.exp(-r*r)-r*i);return n<1?r:-r},t.ibetainv=function(n,r,i){var o,a,s,u,l,c,f,h,d,p,g=r-1,m=i-1,v=0;if(n<=0)return 0;if(n>=1)return 1;for(r>=1&&i>=1?(s=n<.5?n:1-n,c=(2.30753+.27061*(u=e.sqrt(-2*e.log(s))))/(1+u*(.99229+.04481*u))-u,n<.5&&(c=-c),f=(c*c-3)/6,h=2/(1/(2*r-1)+1/(2*i-1)),d=c*e.sqrt(f+h)/h-(1/(2*i-1)-1/(2*r-1))*(f+5/6-2/(3*h)),c=r/(r+i*e.exp(2*d))):(o=e.log(r/(r+i)),a=e.log(i/(r+i)),c=n<(u=e.exp(r*o)/r)/(d=u+(l=e.exp(i*a)/i))?e.pow(r*d*n,1/r):1-e.pow(i*d*(1-n),1/i)),p=-t.gammaln(r)-t.gammaln(i)+t.gammaln(r+i);v<10;v++){if(0===c||1===c)return c;if((c-=u=(l=(t.ibeta(c,r,i)-n)/(u=e.exp(g*e.log(c)+m*e.log(1-c)+p)))/(1-.5*e.min(1,l*(g/c-m/(1-c)))))<=0&&(c=.5*(c+u)),c>=1&&(c=.5*(c+u+1)),e.abs(u)<1e-8*c&&v>0)break}return c},t.ibeta=function(n,r,i){var o=0===n||1===n?0:e.exp(t.gammaln(r+i)-t.gammaln(r)-t.gammaln(i)+r*e.log(n)+i*e.log(1-n));return!(n<0||n>1)&&(n<(r+1)/(r+i+2)?o*t.betacf(n,r,i)/r:1-o*t.betacf(1-n,i,r)/i)},t.randn=function(n,r){var i,o,a,s,u;if(r||(r=n),n)return t.create(n,r,(function(){return t.randn()}));do{i=t._random_fn(),o=1.7156*(t._random_fn()-.5),u=(a=i-.449871)*a+(s=e.abs(o)+.386595)*(.196*s-.25472*a)}while(u>.27597&&(u>.27846||o*o>-4*e.log(i)*i*i));return o/i},t.randg=function(n,r,i){var o,a,s,u,l,c,f=n;if(i||(i=r),n||(n=1),r)return(c=t.zeros(r,i)).alter((function(){return t.randg(n)})),c;n<1&&(n+=1),o=n-1/3,a=1/e.sqrt(9*o);do{do{u=1+a*(l=t.randn())}while(u<=0);u*=u*u,s=t._random_fn()}while(s>1-.331*e.pow(l,4)&&e.log(s)>.5*l*l+o*(1-u+e.log(u)));if(n==f)return o*u;do{s=t._random_fn()}while(0===s);return e.pow(s,1/f)*o*u},function(e){for(var n=0;ni;)f=u,s=l+(o=-(n+c)*(n+r+c)*t/(n+2*c)/(n+2*c+1))*s,u=(a=u+o*a)+(o=(c+=1)*(r-c)*t/(n+2*c-1)/(n+2*c))*u,a/=l=s+o*l,s/=l,u/=l,l=1;return u/n}function r(n,r,i){var o=[.9815606342467192,.9041172563704749,.7699026741943047,.5873179542866175,.3678314989981802,.1252334085114689],a=[.04717533638651183,.10693932599531843,.16007832854334622,.20316742672306592,.2334925365383548,.24914704581340277],s=.5*n;if(s>=8)return 1;var u,l=2*t.normal.cdf(s,0,1,1,0)-1;l=l>=e.exp(-50/i)?e.pow(l,i):0;for(var c=s,f=(8-s)/(u=n>3?2:3),h=c+f,d=0,p=i-1,g=1;g<=u;g++){for(var m=0,v=.5*(h+c),b=.5*(h-c),y=1;y<=12;y++){var w,x=v+b*(660)break;var M=2*t.normal.cdf(x,0,1,1,0)*.5-2*t.normal.cdf(x,n,1,1,0)*.5;M>=e.exp(-30/p)&&(m+=M=a[w-1]*e.exp(-.5*_)*e.pow(M,p))}d+=m*=2*b*i/e.sqrt(2*e.PI),c=h,h+=f}return(l+=d)<=e.exp(-30/r)?0:(l=e.pow(l,r))>=1?1:l}!function(e){for(var n=0;n1||n<0?0:1==r&&1==i?1:r<512&&i<512?e.pow(n,r-1)*e.pow(1-n,i-1)/t.betafn(r,i):e.exp((r-1)*e.log(n)+(i-1)*e.log(1-n)-t.betaln(r,i))},cdf:function(e,n,r){return e>1||e<0?1*(e>1):t.ibeta(e,n,r)},inv:function(e,n,r){return t.ibetainv(e,n,r)},mean:function(t,e){return t/(t+e)},median:function(e,n){return t.ibetainv(.5,e,n)},mode:function(t,e){return(t-1)/(t+e-2)},sample:function(e,n){var r=t.randg(e);return r/(r+t.randg(n))},variance:function(t,n){return t*n/(e.pow(t+n,2)*(t+n+1))}}),t.extend(t.centralF,{pdf:function(n,r,i){var o;return n<0?0:r<=2?0===n&&r<2?1/0:0===n&&2===r?1:1/t.betafn(r/2,i/2)*e.pow(r/i,r/2)*e.pow(n,r/2-1)*e.pow(1+r/i*n,-(r+i)/2):(o=r*n/(i+n*r),r*(i/(i+n*r))/2*t.binomial.pdf((r-2)/2,(r+i-2)/2,o))},cdf:function(e,n,r){return e<0?0:t.ibeta(n*e/(n*e+r),n/2,r/2)},inv:function(e,n,r){return r/(n*(1/t.ibetainv(e,n/2,r/2)-1))},mean:function(t,e){return e>2?e/(e-2):void 0},mode:function(t,e){return t>2?e*(t-2)/(t*(e+2)):void 0},sample:function(e,n){return 2*t.randg(e/2)/e/(2*t.randg(n/2)/n)},variance:function(t,e){if(!(e<=4))return 2*e*e*(t+e-2)/(t*(e-2)*(e-2)*(e-4))}}),t.extend(t.cauchy,{pdf:function(t,n,r){return r<0?0:r/(e.pow(t-n,2)+e.pow(r,2))/e.PI},cdf:function(t,n,r){return e.atan((t-n)/r)/e.PI+.5},inv:function(t,n,r){return n+r*e.tan(e.PI*(t-.5))},median:function(t){return t},mode:function(t){return t},sample:function(n,r){return t.randn()*e.sqrt(1/(2*t.randg(.5)))*r+n}}),t.extend(t.chisquare,{pdf:function(n,r){return n<0?0:0===n&&2===r?.5:e.exp((r/2-1)*e.log(n)-n/2-r/2*e.log(2)-t.gammaln(r/2))},cdf:function(e,n){return e<0?0:t.lowRegGamma(n/2,e/2)},inv:function(e,n){return 2*t.gammapinv(e,.5*n)},mean:function(t){return t},median:function(t){return t*e.pow(1-2/(9*t),3)},mode:function(t){return t-2>0?t-2:0},sample:function(e){return 2*t.randg(e/2)},variance:function(t){return 2*t}}),t.extend(t.exponential,{pdf:function(t,n){return t<0?0:n*e.exp(-n*t)},cdf:function(t,n){return t<0?0:1-e.exp(-n*t)},inv:function(t,n){return-e.log(1-t)/n},mean:function(t){return 1/t},median:function(t){return 1/t*e.log(2)},mode:function(){return 0},sample:function(n){return-1/n*e.log(t._random_fn())},variance:function(t){return e.pow(t,-2)}}),t.extend(t.gamma,{pdf:function(n,r,i){return n<0?0:0===n&&1===r?1/i:e.exp((r-1)*e.log(n)-n/i-t.gammaln(r)-r*e.log(i))},cdf:function(e,n,r){return e<0?0:t.lowRegGamma(n,e/r)},inv:function(e,n,r){return t.gammapinv(e,n)*r},mean:function(t,e){return t*e},mode:function(t,e){if(t>1)return(t-1)*e},sample:function(e,n){return t.randg(e)*n},variance:function(t,e){return t*e*e}}),t.extend(t.invgamma,{pdf:function(n,r,i){return n<=0?0:e.exp(-(r+1)*e.log(n)-i/n-t.gammaln(r)+r*e.log(i))},cdf:function(e,n,r){return e<=0?0:1-t.lowRegGamma(n,r/e)},inv:function(e,n,r){return r/t.gammapinv(1-e,n)},mean:function(t,e){return t>1?e/(t-1):void 0},mode:function(t,e){return e/(t+1)},sample:function(e,n){return n/t.randg(e)},variance:function(t,e){if(!(t<=2))return e*e/((t-1)*(t-1)*(t-2))}}),t.extend(t.kumaraswamy,{pdf:function(t,n,r){return 0===t&&1===n?r:1===t&&1===r?n:e.exp(e.log(n)+e.log(r)+(n-1)*e.log(t)+(r-1)*e.log(1-e.pow(t,n)))},cdf:function(t,n,r){return t<0?0:t>1?1:1-e.pow(1-e.pow(t,n),r)},inv:function(t,n,r){return e.pow(1-e.pow(1-t,1/r),1/n)},mean:function(e,n){return n*t.gammafn(1+1/e)*t.gammafn(n)/t.gammafn(1+1/e+n)},median:function(t,n){return e.pow(1-e.pow(2,-1/n),1/t)},mode:function(t,n){if(t>=1&&n>=1&&1!==t&&1!==n)return e.pow((t-1)/(t*n-1),1/t)},variance:function(){throw new Error("variance not yet implemented")}}),t.extend(t.lognormal,{pdf:function(t,n,r){return t<=0?0:e.exp(-e.log(t)-.5*e.log(2*e.PI)-e.log(r)-e.pow(e.log(t)-n,2)/(2*r*r))},cdf:function(n,r,i){return n<0?0:.5+.5*t.erf((e.log(n)-r)/e.sqrt(2*i*i))},inv:function(n,r,i){return e.exp(-1.4142135623730951*i*t.erfcinv(2*n)+r)},mean:function(t,n){return e.exp(t+n*n/2)},median:function(t){return e.exp(t)},mode:function(t,n){return e.exp(t-n*n)},sample:function(n,r){return e.exp(t.randn()*r+n)},variance:function(t,n){return(e.exp(n*n)-1)*e.exp(2*t+n*n)}}),t.extend(t.noncentralt,{pdf:function(n,r,i){return e.abs(i)<1e-14?t.studentt.pdf(n,r):e.abs(n)<1e-14?e.exp(t.gammaln((r+1)/2)-i*i/2-.5*e.log(e.PI*r)-t.gammaln(r/2)):r/n*(t.noncentralt.cdf(n*e.sqrt(1+2/r),r+2,i)-t.noncentralt.cdf(n,r,i))},cdf:function(n,r,i){var o=1e-14;if(e.abs(i)o||u>o;)l=u,f>0&&(h*=i*i/(2*f),d*=i*i/(2*(f+.5))),s+=.5*(u=h*t.beta.cdf(c,f+.5,r/2)+d*t.beta.cdf(c,f+1,r/2)),f++;return a?1-s:s}}),t.extend(t.normal,{pdf:function(t,n,r){return e.exp(-.5*e.log(2*e.PI)-e.log(r)-e.pow(t-n,2)/(2*r*r))},cdf:function(n,r,i){return.5*(1+t.erf((n-r)/e.sqrt(2*i*i)))},inv:function(e,n,r){return-1.4142135623730951*r*t.erfcinv(2*e)+n},mean:function(t){return t},median:function(t){return t},mode:function(t){return t},sample:function(e,n){return t.randn()*n+e},variance:function(t,e){return e*e}}),t.extend(t.pareto,{pdf:function(t,n,r){return t1e100?1e100:r,1/(e.sqrt(r)*t.betafn(.5,r/2))*e.pow(1+n*n/r,-(r+1)/2)},cdf:function(n,r){var i=r/2;return t.ibeta((n+e.sqrt(n*n+r))/(2*e.sqrt(n*n+r)),i,i)},inv:function(n,r){var i=t.ibetainv(2*e.min(n,1-n),.5*r,.5);return i=e.sqrt(r*(1-i)/i),n>.5?i:-i},mean:function(t){return t>1?0:void 0},median:function(){return 0},mode:function(){return 0},sample:function(n){return t.randn()*e.sqrt(n/(2*t.randg(n/2)))},variance:function(t){return t>2?t/(t-2):t>1?1/0:void 0}}),t.extend(t.weibull,{pdf:function(t,n,r){return t<0||n<0||r<0?0:r/n*e.pow(t/n,r-1)*e.exp(-e.pow(t/n,r))},cdf:function(t,n,r){return t<0?0:1-e.exp(-e.pow(t/n,r))},inv:function(t,n,r){return n*e.pow(-e.log(1-t),1/r)},mean:function(e,n){return e*t.gammafn(1+1/n)},median:function(t,n){return t*e.pow(e.log(2),1/n)},mode:function(t,n){return n<=1?0:t*e.pow((n-1)/n,1/n)},sample:function(n,r){return n*e.pow(-e.log(t._random_fn()),1/r)},variance:function(n,r){return n*n*t.gammafn(1+2/r)-e.pow(t.weibull.mean(n,r),2)}}),t.extend(t.uniform,{pdf:function(t,e,n){return tn?0:1/(n-e)},cdf:function(t,e,n){return t=i)return 1;if(o<0||o>1||i<=0)return NaN;var u=o,l=(r=e.floor(r))+1,c=i-r,f=l+c,h=e.exp(t.gammaln(f)-t.gammaln(c)-t.gammaln(l)+l*e.log(u)+c*e.log(1-u));return a=u<(l+1)/(f+2)?h*n(u,l,c,s):1-h*n(1-u,c,l,s),e.round(1/s*(1-a))/(1/s)}}),t.extend(t.negbin,{pdf:function(n,r,i){return n===n>>>0&&(n<0?0:t.combination(n+r-1,r-1)*e.pow(1-i,n)*e.pow(i,r))},cdf:function(e,n,r){var i=0,o=0;if(e<0)return 0;for(;o<=e;o++)i+=t.negbin.pdf(o,n,r);return i}}),t.extend(t.hypgeom,{pdf:function(n,r,i,o){if(n!=n|0)return!1;if(n<0||no||n>i)return 0;if(2*i>r)return 2*o>r?t.hypgeom.pdf(r-i-o+n,r,r-i,r-o):t.hypgeom.pdf(o-n,r,r-i,o);if(2*o>r)return t.hypgeom.pdf(i-n,r,i,r-o);if(i1&&s=o||n>=i)return 1;if(2*i>r)return 2*o>r?t.hypgeom.cdf(r-i-o+n,r,r-i,r-o):1-t.hypgeom.cdf(o-n-1,r,r-i,o);if(2*o>r)return 1-t.hypgeom.cdf(i-n-1,r,i,r-o);if(i1&&uo);return i-1},sampleLarge:function(n){var r,i,o,a,s,u,l,c,f,h,d=n;for(a=e.sqrt(d),s=e.log(d),u=.02483*(l=.931+2.53*a)-.059,c=1.1239+1.1328/(l-3.4),f=.9277-3.6224/(l-2);;){if(i=e.random()-.5,o=e.random(),h=.5-e.abs(i),r=e.floor((2*u/h+l)*i+d+.43),h>=.07&&o<=f)return r;if(!(r<0||h<.013&&o>h)&&e.log(o)+e.log(c)-e.log(u/(h*h)+l)<=r*s-d-t.loggam(r+1))return r}},sample:function(t){return t<10?this.sampleSmall(t):this.sampleLarge(t)}}),t.extend(t.triangular,{pdf:function(t,e,n,r){return n<=e||rn?NaN:tn?0:tr?NaN:t<=n?0:t>=r?1:t<=i?e.pow(t-n,2)/((r-n)*(i-n)):1-e.pow(r-t,2)/((r-n)*(r-i))},inv:function(t,n,r,i){return r<=n||ir?NaN:t<=(i-n)/(r-n)?n+(r-n)*e.sqrt(t*((i-n)/(r-n))):n+(r-n)*(1-e.sqrt((1-t)*(1-(i-n)/(r-n))))},mean:function(t,e,n){return(t+e+n)/3},median:function(t,n,r){return r<=(t+n)/2?n-e.sqrt((n-t)*(n-r))/e.sqrt(2):r>(t+n)/2?t+e.sqrt((n-t)*(r-t))/e.sqrt(2):void 0},mode:function(t,e,n){return n},sample:function(n,r,i){var o=t._random_fn();return o<(i-n)/(r-n)?n+e.sqrt(o*(r-n)*(i-n)):r-e.sqrt((1-o)*(r-n)*(r-i))},variance:function(t,e,n){return(t*t+e*e+n*n-t*e-t*n-e*n)/18}}),t.extend(t.arcsine,{pdf:function(t,n,r){return r<=n?NaN:t<=n||t>=r?0:2/e.PI*e.pow(e.pow(r-n,2)-e.pow(2*t-n-r,2),-.5)},cdf:function(t,n,r){return t25e3)return r(n,1,a);var l,c=.5*o,f=c*e.log(o)-o*e.log(2)-t.gammaln(c),h=c-1,d=.25*o;l=o<=100?1:o<=800?.5:o<=5e3?.25:.125,f+=e.log(l);for(var p=0,g=1;g<=50;g++){for(var m=0,v=(2*g-1)*l,b=1;b<=16;b++){var y,w;8=-30&&(m+=r(8=1&&m<=1e-14)break;p+=m}if(m>1e-14)throw new Error("tukey.cdf failed to converge");return p>1&&(p=1),p},inv:function(n,r,i){if(i<2||r<2)return NaN;if(n<0||n>1)return NaN;if(0===n)return 0;if(1===n)return 1/0;var o,a=function(t,n,r){var i=.5-.5*t,o=e.sqrt(e.log(1/(i*i))),a=o+((((-453642210148e-16*o-.204231210125)*o-.342242088547)*o-1)*o+.322232421088)/((((.0038560700634*o+.10353775285)*o+.531103462366)*o+.588581570495)*o+.099348462606);r<120&&(a+=(a*a*a+a)/r/4);var s=.8832-.2368*a;return r<120&&(s+=-1.214/r+1.208*a/r),a*(s*e.log(n-1)+1.4142)}(n,r,i),s=t.tukey.cdf(a,r,i)-n;o=s>0?e.max(0,a-1):a+1;for(var u,l=t.tukey.cdf(o,r,i)-n,c=1;c<50;c++)if(u=o-l*(o-a)/(l-s),s=l,a=o,u<0&&(u=0,l=-n),l=t.tukey.cdf(u,r,i)-n,o=u,e.abs(o-a)<1e-4)return u;throw new Error("tukey.inv failed to converge")}})}(e,Math),function(t,e){var n,r,i=Array.prototype.push,o=t.utils.isArray;function a(e){return o(e)||e instanceof t}t.extend({add:function(e,n){return a(n)?(a(n[0])||(n=[n]),t.map(e,(function(t,e,r){return t+n[e][r]}))):t.map(e,(function(t){return t+n}))},subtract:function(e,n){return a(n)?(a(n[0])||(n=[n]),t.map(e,(function(t,e,r){return t-n[e][r]||0}))):t.map(e,(function(t){return t-n}))},divide:function(e,n){return a(n)?(a(n[0])||(n=[n]),t.multiply(e,t.inv(n))):t.map(e,(function(t){return t/n}))},multiply:function(e,n){var r,i,o,s,u,l,c,f;if(void 0===e.length&&void 0===n.length)return e*n;if(u=e.length,l=e[0].length,c=t.zeros(u,o=a(n)?n[0].length:l),f=0,a(n)){for(;f=0;u--){for(d=0,l=u+1;l<=c-1;l++)d+=p[l]*n[u][l];p[u]=(n[u][i-1]-d)/n[u][u]}return p},gauss_jordan:function(n,r){var i,o,a,s=t.aug(n,r),u=s.length,l=s[0].length,c=0;for(o=0;oe.abs(s[f][o])&&(f=a);var h=s[o];for(s[o]=s[f],s[f]=h,a=o+1;a=0;o--){for(c=s[o][o],a=0;ao-1;i--)s[a][i]-=s[o][i]*s[a][o]/c;for(s[o][o]/=c,i=u;if?(d[c][f]=n[c][f],p[c][f]=g[c][f]=0):co;)a=l,l=t.add(t.multiply(u,a),s),c++;return l},gauss_seidel:function(n,r,i,o){for(var a,s,u,l,c,f=0,h=n.length,d=[],p=[],g=[];fa?(d[f][a]=n[f][a],p[f][a]=g[f][a]=0):fo;)s=c,c=t.add(t.multiply(l,s),u),f+=1;return c},SOR:function(n,r,i,o,a){for(var s,u,l,c,f,h=0,d=n.length,p=[],g=[],m=[];hs?(p[h][s]=n[h][s],g[h][s]=m[h][s]=0):ho;)u=f,f=t.add(t.multiply(c,u),l),h++;return f},householder:function(n){for(var r,i,o,a,s=n.length,u=n[0].length,l=0,c=[],f=[];l0?-1:1)*e.sqrt(r),i=e.sqrt((r*r-n[l+1][l]*r)/2),(c=t.zeros(s,1))[l+1][0]=(n[l+1][l]-r)/(2*i),o=l+2;o0?e.PI/4:-e.PI/4:e.atan(2*n[o][a]/(n[o][o]-n[a][a]))/2,(l=t.identity(f,f))[o][o]=e.cos(u),l[o][a]=-e.sin(u),l[a][o]=e.sin(u),l[a][a]=e.cos(u),h=t.multiply(h,l),n=t.multiply(t.multiply(t.inv(l),n),l),c=0,r=1;r.001&&(c=1)}for(r=0;r=f;)a=o(t,r+i),s=o(t,r),d[h]=(n[a]-2*n[s]+n[2*s-a])/(i*i),i/=2,h++;for(l=d.length,u=1;1!=l;){for(c=0;cr);i++);return n[i-=1]+(r-e[i])*h[i]+t.sq(r-e[i])*o[i]+(r-e[i])*t.sq(r-e[i])*d[i]},gauss_quadrature:function(){throw new Error("gauss_quadrature not yet implemented")},PCA:function(e){var n,r,i,o,a,s=e.length,u=e[0].length,l=0,c=[],f=[],h=[],d=[],p=[],g=[],m=[];for(l=0;l1||r>1||t<=0||r<=0)throw new Error("Proportions should be greater than 0 and less than 1");var o=(t*n+r*i)/(n+i);return(t-r)/e.sqrt(o*(1-o)*(1/n+1/i))}t.extend({zscore:function(){var e=n.call(arguments);return r(e[1])?(e[0]-e[1])/e[2]:(e[0]-t.mean(e[1]))/t.stdev(e[1],e[2])},ztest:function(){var r,o=n.call(arguments);return i(o[1])?(r=t.zscore(o[0],o[1],o[3]),1===o[2]?t.normal.cdf(-e.abs(r),0,1):2*t.normal.cdf(-e.abs(r),0,1)):o.length>2?(r=t.zscore(o[0],o[1],o[2]),1===o[3]?t.normal.cdf(-e.abs(r),0,1):2*t.normal.cdf(-e.abs(r),0,1)):(r=o[0],1===o[1]?t.normal.cdf(-e.abs(r),0,1):2*t.normal.cdf(-e.abs(r),0,1))}}),t.extend(t.fn,{zscore:function(t,e){return(t-this.mean())/this.stdev(e)},ztest:function(n,r,i){var o=e.abs(this.zscore(n,i));return 1===r?t.normal.cdf(-o,0,1):2*t.normal.cdf(-o,0,1)}}),t.extend({tscore:function(){var r=n.call(arguments);return 4===r.length?(r[0]-r[1])/(r[2]/e.sqrt(r[3])):(r[0]-t.mean(r[1]))/(t.stdev(r[1],!0)/e.sqrt(r[1].length))},ttest:function(){var i,o=n.call(arguments);return 5===o.length?(i=e.abs(t.tscore(o[0],o[1],o[2],o[3])),1===o[4]?t.studentt.cdf(-i,o[3]-1):2*t.studentt.cdf(-i,o[3]-1)):r(o[1])?(i=e.abs(o[0]),1==o[2]?t.studentt.cdf(-i,o[1]-1):2*t.studentt.cdf(-i,o[1]-1)):(i=e.abs(t.tscore(o[0],o[1])),1==o[2]?t.studentt.cdf(-i,o[1].length-1):2*t.studentt.cdf(-i,o[1].length-1))}}),t.extend(t.fn,{tscore:function(t){return(t-this.mean())/(this.stdev(!0)/e.sqrt(this.cols()))},ttest:function(n,r){return 1===r?1-t.studentt.cdf(e.abs(this.tscore(n)),this.cols()-1):2*t.studentt.cdf(-e.abs(this.tscore(n)),this.cols()-1)}}),t.extend({anovafscore:function(){var r,i,o,a,s,u,l,c,f=n.call(arguments);if(1===f.length){for(s=new Array(f[0].length),l=0;l.5?1-r:r)})),c=e.studentt.inv(.975,n.df_resid),f=n.coef.map((function(t,e){var n=c*s[e];return[t-n,t+n]}));return{se:s,t:u,p:l,sigmaHat:a,interval95:f}}return{ols:function(r,i){var o=t(r,i),a=n(o),s=function(t){var n,r,i,o=t.R2/t.df_model/((1-t.R2)/t.df_resid);return{F_statistic:o,pvalue:1-(n=o,r=t.df_model,i=t.df_resid,e.beta.cdf(n/(i/r+n),r/2,i/2))}}(o),u=1-(1-o.R2)*((o.nobs-1)/o.df_resid);return o.t=a,o.f=s,o.adjust_R2=u,o}}}(),e.extend({buildxmatrix:function(){for(var t=new Array(arguments.length),n=0;n1){for(a=[],r=0;r{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var r={};(()=>{"use strict";n.r(r),n.d(r,{Langevitour:()=>Wr});var t=n(162),e=n(409);function i(){}function o(t){return null==t?i:function(){return this.querySelector(t)}}function a(){return[]}function s(t){return null==t?a:function(){return this.querySelectorAll(t)}}function u(t){return function(){return this.matches(t)}}function l(t){return function(e){return e.matches(t)}}var c=Array.prototype.find;function f(){return this.firstElementChild}var h=Array.prototype.filter;function d(){return Array.from(this.children)}function p(t){return new Array(t.length)}function g(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}function m(t,e,n,r,i,o){for(var a,s=0,u=e.length,l=o.length;se?1:t>=e?0:NaN}g.prototype={constructor:g,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};var x="http://www.w3.org/1999/xhtml";const _={svg:"http://www.w3.org/2000/svg",xhtml:x,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function M(t){var e=t+="",n=e.indexOf(":");return n>=0&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),_.hasOwnProperty(e)?{space:_[e],local:t}:t}function k(t){return function(){this.removeAttribute(t)}}function A(t){return function(){this.removeAttributeNS(t.space,t.local)}}function S(t,e){return function(){this.setAttribute(t,e)}}function N(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function q(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}}function E(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function C(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function I(t){return function(){this.style.removeProperty(t)}}function P(t,e,n){return function(){this.style.setProperty(t,e,n)}}function j(t,e,n){return function(){var r=e.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function D(t,e){return t.style.getPropertyValue(e)||C(t).getComputedStyle(t,null).getPropertyValue(e)}function T(t){return function(){delete this[t]}}function z(t,e){return function(){this[t]=e}}function $(t,e){return function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}}function B(t){return t.trim().split(/^|\s+/)}function F(t){return t.classList||new R(t)}function R(t){this._node=t,this._names=B(t.getAttribute("class")||"")}function X(t,e){for(var n=F(t),r=-1,i=e.length;++r=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var ht=[null];function dt(t,e){this._groups=t,this._parents=e}function pt(){return new dt([[document.documentElement]],ht)}dt.prototype=pt.prototype={constructor:dt,select:function(t){"function"!=typeof t&&(t=o(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i=A&&(A=k+1);!(M=x[A])&&++A=0;)(r=i[o])&&(a&&4^r.compareDocumentPosition(a)&&a.parentNode.insertBefore(r,a),a=r);return this},sort:function(t){function e(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}t||(t=w);for(var n=this._groups,r=n.length,i=new Array(r),o=0;o1?this.each((null==e?I:"function"==typeof e?j:P)(t,e,null==n?"":n)):D(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?T:"function"==typeof e?$:z)(t,e)):this.node()[t]},classed:function(t,e){var n=B(t+"");if(arguments.length<2){for(var r=F(this.node()),i=-1,o=n.length;++i=0&&(e=t.slice(n+1),t=t.slice(0,n)),{type:t,name:e}}))}(t+""),a=o.length;if(!(arguments.length<2)){for(s=e?ut:st,r=0;r{}};function vt(){for(var t,e=0,n=arguments.length,r={};e=0&&(e=t.slice(n+1),t=t.slice(0,n)),t&&!r.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}}))),a=-1,s=o.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++a0)for(var n,r,i=new Array(n),o=0;o=0&&e._call.call(void 0,t),e=e._next;--kt}()}finally{kt=0,function(){for(var t,e,n=_t,r=1/0;n;)n._call?(r>n._time&&(r=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:_t=e);Mt=t,Ft(r)}(),Et=0}}function Bt(){var t=It.now(),e=t-qt;e>Nt&&(Ct-=e,qt=t)}function Ft(t){kt||(At&&(At=clearTimeout(At)),t-Et>24?(t<1/0&&(At=setTimeout($t,t-It.now()-Ct)),St&&(St=clearInterval(St))):(St||(qt=It.now(),St=setInterval(Bt,Nt)),kt=1,Pt($t)))}function Rt(t,e,n){var r=new Tt;return e=null==e?0:+e,r.restart((n=>{r.stop(),t(n+e)}),e,n),r}Tt.prototype=zt.prototype={constructor:Tt,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?jt():+n)+(null==e?0:+e),this._next||Mt===this||(Mt?Mt._next=this:_t=this,Mt=this),this._call=t,this._time=n,Ft()},stop:function(){this._call&&(this._call=null,this._time=1/0,Ft())}};var Xt=xt("start","end","cancel","interrupt"),Lt=[],Ot=0,Ht=3;function Yt(t,e,n,r,i,o){var a=t.__transition;if(a){if(n in a)return}else t.__transition={};!function(t,e,n){var r,i=t.__transition;function o(u){var l,c,f,h;if(1!==n.state)return s();for(l in i)if((h=i[l]).name===n.name){if(h.state===Ht)return Rt(o);4===h.state?(h.state=6,h.timer.stop(),h.on.call("interrupt",t,t.__data__,h.index,h.group),delete i[l]):+lOt)throw new Error("too late; already scheduled");return n}function Ut(t,e){var n=Vt(t,e);if(n.state>Ht)throw new Error("too late; already running");return n}function Vt(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function Gt(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}var Kt,Jt=180/Math.PI,Qt={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Zt(t,e,n,r,i,o){var a,s,u;return(a=Math.sqrt(t*t+e*e))&&(t/=a,e/=a),(u=t*n+e*r)&&(n-=t*u,r-=e*u),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,u/=s),t*r180?e+=360:e-t>180&&(t+=360),o.push({i:n.push(i(n)+"rotate(",null,r)-2,x:Gt(t,e)})):e&&n.push(i(n)+"rotate("+e+r)}(o.rotate,a.rotate,s,u),function(t,e,n,o){t!==e?o.push({i:n.push(i(n)+"skewX(",null,r)-2,x:Gt(t,e)}):e&&n.push(i(n)+"skewX("+e+r)}(o.skewX,a.skewX,s,u),function(t,e,n,r,o,a){if(t!==n||e!==r){var s=o.push(i(o)+"scale(",null,",",null,")");a.push({i:s-4,x:Gt(t,n)},{i:s-2,x:Gt(e,r)})}else 1===n&&1===r||o.push(i(o)+"scale("+n+","+r+")")}(o.scaleX,o.scaleY,a.scaleX,a.scaleY,s,u),o=a=null,function(t){for(var e,n=-1,r=u.length;++n>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?Se(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?Se(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=ge.exec(t))?new qe(e[1],e[2],e[3],1):(e=me.exec(t))?new qe(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=ve.exec(t))?Se(e[1],e[2],e[3],e[4]):(e=be.exec(t))?Se(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=ye.exec(t))?De(e[1],e[2]/100,e[3]/100,1):(e=we.exec(t))?De(e[1],e[2]/100,e[3]/100,e[4]):xe.hasOwnProperty(t)?Ae(xe[t]):"transparent"===t?new qe(NaN,NaN,NaN,0):null}function Ae(t){return new qe(t>>16&255,t>>8&255,255&t,1)}function Se(t,e,n,r){return r<=0&&(t=e=n=NaN),new qe(t,e,n,r)}function Ne(t,e,n,r){return 1===arguments.length?((i=t)instanceof ue||(i=ke(i)),i?new qe((i=i.rgb()).r,i.g,i.b,i.opacity):new qe):new qe(t,e,n,null==r?1:r);var i}function qe(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function Ee(){return`#${je(this.r)}${je(this.g)}${je(this.b)}`}function Ce(){const t=Ie(this.opacity);return`${1===t?"rgb(":"rgba("}${Pe(this.r)}, ${Pe(this.g)}, ${Pe(this.b)}${1===t?")":`, ${t})`}`}function Ie(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Pe(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function je(t){return((t=Pe(t))<16?"0":"")+t.toString(16)}function De(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new ze(t,e,n,r)}function Te(t){if(t instanceof ze)return new ze(t.h,t.s,t.l,t.opacity);if(t instanceof ue||(t=ke(t)),!t)return new ze;if(t instanceof ze)return t;var e=(t=t.rgb()).r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),o=Math.max(e,n,r),a=NaN,s=o-i,u=(o+i)/2;return s?(a=e===o?(n-r)/s+6*(n0&&u<1?0:a,new ze(a,s,u,t.opacity)}function ze(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function $e(t){return(t=(t||0)%360)<0?t+360:t}function Be(t){return Math.max(0,Math.min(1,t||0))}function Fe(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}function Re(t,e,n,r,i){var o=t*t,a=o*t;return((1-3*t+3*o-a)*e+(4-6*o+3*a)*n+(1+3*t+3*o-3*a)*r+a*i)/6}ae(ue,ke,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:_e,formatHex:_e,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Te(this).formatHsl()},formatRgb:Me,toString:Me}),ae(qe,Ne,se(ue,{brighter(t){return t=null==t?ce:Math.pow(ce,t),new qe(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?le:Math.pow(le,t),new qe(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new qe(Pe(this.r),Pe(this.g),Pe(this.b),Ie(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Ee,formatHex:Ee,formatHex8:function(){return`#${je(this.r)}${je(this.g)}${je(this.b)}${je(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:Ce,toString:Ce})),ae(ze,(function(t,e,n,r){return 1===arguments.length?Te(t):new ze(t,e,n,null==r?1:r)}),se(ue,{brighter(t){return t=null==t?ce:Math.pow(ce,t),new ze(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?le:Math.pow(le,t),new ze(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new qe(Fe(t>=240?t-240:t+120,i,r),Fe(t,i,r),Fe(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new ze($e(this.h),Be(this.s),Be(this.l),Ie(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=Ie(this.opacity);return`${1===t?"hsl(":"hsla("}${$e(this.h)}, ${100*Be(this.s)}%, ${100*Be(this.l)}%${1===t?")":`, ${t})`}`}}));const Xe=t=>()=>t;function Le(t,e){var n=e-t;return n?function(t,e){return function(n){return t+n*e}}(t,n):Xe(isNaN(t)?e:t)}const Oe=function t(e){var n=function(t){return 1==(t=+t)?Le:function(e,n){return n-e?function(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}(e,n,t):Xe(isNaN(e)?n:e)}}(e);function r(t,e){var r=n((t=Ne(t)).r,(e=Ne(e)).r),i=n(t.g,e.g),o=n(t.b,e.b),a=Le(t.opacity,e.opacity);return function(e){return t.r=r(e),t.g=i(e),t.b=o(e),t.opacity=a(e),t+""}}return r.gamma=t,r}(1);function He(t){return function(e){var n,r,i=e.length,o=new Array(i),a=new Array(i),s=new Array(i);for(n=0;n=1?(n=1,e-1):Math.floor(n*e),i=t[r],o=t[r+1],a=r>0?t[r-1]:2*i-o,s=ro&&(i=e.slice(o,i),s[a]?s[a]+=i:s[++a]=i),(n=n[0])===(r=r[0])?s[a]?s[a]+=r:s[++a]=r:(s[++a]=null,u.push({i:a,x:Gt(n,r)})),o=We.lastIndex;return o=0&&(t=t.slice(0,e)),!t||"start"===t}))}(e)?Wt:Ut;return function(){var a=o(this,t),s=a.on;s!==r&&(i=(r=s).copy()).on(e,n),a.on=i}}(n,t,e))},attr:function(t,e){var n=M(t),r="transform"===n?ne:Ve;return this.attrTween(t,"function"==typeof e?(n.local?tn:Ze)(n,r,oe(this,"attr."+t,e)):null==e?(n.local?Ke:Ge)(n):(n.local?Qe:Je)(n,r,e))},attrTween:function(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==e)return this.tween(n,null);if("function"!=typeof e)throw new Error;var r=M(t);return this.tween(n,(r.local?en:nn)(r,e))},style:function(t,e,n){var r="transform"==(t+="")?ee:Ve;return null==e?this.styleTween(t,function(t,e){var n,r,i;return function(){var o=D(this,t),a=(this.style.removeProperty(t),D(this,t));return o===a?null:o===n&&a===r?i:i=e(n=o,r=a)}}(t,r)).on("end.style."+t,ln(t)):"function"==typeof e?this.styleTween(t,function(t,e,n){var r,i,o;return function(){var a=D(this,t),s=n(this),u=s+"";return null==s&&(this.style.removeProperty(t),u=s=D(this,t)),a===u?null:a===r&&u===i?o:(i=u,o=e(r=a,s))}}(t,r,oe(this,"style."+t,e))).each(function(t,e){var n,r,i,o,a="style."+e,s="end."+a;return function(){var u=Ut(this,t),l=u.on,c=null==u.value[a]?o||(o=ln(e)):void 0;l===n&&i===c||(r=(n=l).copy()).on(s,i=c),u.on=r}}(this._id,t)):this.styleTween(t,function(t,e,n){var r,i,o=n+"";return function(){var a=D(this,t);return a===o?null:a===r?i:i=e(r=a,n)}}(t,r,e),n).on("end.style."+t,null)},styleTween:function(t,e,n){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==e)return this.tween(r,null);if("function"!=typeof e)throw new Error;return this.tween(r,function(t,e,n){var r,i;function o(){var o=e.apply(this,arguments);return o!==i&&(r=(i=o)&&function(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}(t,o,n)),r}return o._value=e,o}(t,e,null==n?"":n))},text:function(t){return this.tween("text","function"==typeof t?function(t){return function(){var e=t(this);this.textContent=null==e?"":e}}(oe(this,"text",t)):function(t){return function(){this.textContent=t}}(null==t?"":t+""))},textTween:function(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(null==t)return this.tween(e,null);if("function"!=typeof t)throw new Error;return this.tween(e,function(t){var e,n;function r(){var r=t.apply(this,arguments);return r!==n&&(e=(n=r)&&function(t){return function(e){this.textContent=t.call(this,e)}}(r)),e}return r._value=t,r}(t))},remove:function(){return this.on("end.remove",function(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}(this._id))},tween:function(t,e){var n=this._id;if(t+="",arguments.length<2){for(var r,i=Vt(this.node(),n).tween,o=0,a=i.length;o2&&n.state<5,n.state=6,n.timer.stop(),n.on.call(r?"interrupt":"cancel",t,t.__data__,n.index,n.group),delete o[i]):a=!1;a&&delete t.__transition}}(this,t)}))},gt.prototype.transition=function(t){var e,n;t instanceof fn?(e=t._id,t=t._name):(e=hn(),(n=pn).time=jt(),t=null==t?null:t+"");for(var r=this._groups,i=r.length,o=0;o()=>t;function Nn(t,{sourceEvent:e,subject:n,target:r,identifier:i,active:o,x:a,y:s,dx:u,dy:l,dispatch:c}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:o,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:u,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:c}})}function qn(t){return!t.ctrlKey&&!t.button}function En(){return this.parentNode}function Cn(t,e){return null==e?{x:t.x,y:t.y}:e}function In(){return navigator.maxTouchPoints||"ontouchstart"in this}Nn.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};var Pn=Math.sqrt(50),jn=Math.sqrt(10),Dn=Math.sqrt(2);function Tn(t,e,n){var r=(e-t)/Math.max(0,n),i=Math.floor(Math.log(r)/Math.LN10),o=r/Math.pow(10,i);return i>=0?(o>=Pn?10:o>=jn?5:o>=Dn?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(o>=Pn?10:o>=jn?5:o>=Dn?2:1)}function zn(t,e){return null==t||null==e?NaN:te?1:t>=e?0:NaN}function $n(t,e){return null==t||null==e?NaN:et?1:e>=t?0:NaN}function Bn(t){let e,n,r;function i(t,r,i=0,o=t.length){if(i>>1;n(t[e],r)<0?i=e+1:o=e}while(izn(t(e),n),r=(e,n)=>t(e)-n):(e=t===zn||t===$n?t:Fn,n=t,r=t),{left:i,center:function(t,e,n=0,o=t.length){const a=i(t,e,n,o-1);return a>n&&r(t[a-1],e)>-r(t[a],e)?a-1:a},right:function(t,r,i=0,o=t.length){if(i>>1;n(t[e],r)<=0?i=e+1:o=e}while(i=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function ir(t){if(!(e=rr.exec(t)))throw new Error("invalid format: "+t);var e;return new or({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}function or(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}function ar(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,r=t.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+t.slice(n+1)]}function sr(t){return(t=ar(Math.abs(t)))?t[1]:NaN}function ur(t,e){var n=ar(t,e);if(!n)return t+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}ir.prototype=or.prototype,or.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};const lr={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>ur(100*t,e),r:ur,s:function(t,e){var n=ar(t,e);if(!n)return t+"";var r=n[0],i=n[1],o=i-(nr=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,a=r.length;return o===a?r:o>a?r+new Array(o-a+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+ar(t,Math.max(0,e+o-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function cr(t){return t}var fr,hr,dr,pr=Array.prototype.map,gr=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function mr(t){var e=t.domain;return t.ticks=function(t){var n=e();return function(t,e,n){var r,i,o,a,s=-1;if(n=+n,(t=+t)==(e=+e)&&n>0)return[t];if((r=e0){let n=Math.round(t/a),r=Math.round(e/a);for(n*ae&&--r,o=new Array(i=r-n+1);++se&&--r,o=new Array(i=r-n+1);++s=Pn?i*=10:o>=jn?i*=5:o>=Dn&&(i*=2),e0;){if((i=Tn(u,l,n))===r)return o[a]=u,o[s]=l,e(o);if(i>0)u=Math.floor(u/i)*i,l=Math.ceil(l/i)*i;else{if(!(i<0))break;u=Math.ceil(u*i)/i,l=Math.floor(l*i)/i}r=i}return t},t}function vr(){var t=function(){var t,e,n,r,i,o,a=Kn,s=Kn,u=Un,l=Jn;function c(){var t,e,n,u=Math.min(a.length,s.length);return l!==Jn&&(t=a[0],e=a[u-1],t>e&&(n=t,t=e,e=n),l=function(n){return Math.max(t,Math.min(e,n))}),r=u>2?tr:Zn,i=o=null,f}function f(e){return null==e||isNaN(e=+e)?n:(i||(i=r(a.map(t),s,u)))(t(l(e)))}return f.invert=function(n){return l(e((o||(o=r(s,a.map(t),Gt)))(n)))},f.domain=function(t){return arguments.length?(a=Array.from(t,Gn),c()):a.slice()},f.range=function(t){return arguments.length?(s=Array.from(t),c()):s.slice()},f.rangeRound=function(t){return s=Array.from(t),u=Vn,c()},f.clamp=function(t){return arguments.length?(l=!!t||Jn,c()):l!==Jn},f.interpolate=function(t){return arguments.length?(u=t,c()):u},f.unknown=function(t){return arguments.length?(n=t,f):n},function(n,r){return t=n,e=r,c()}}()(Jn,Jn);return t.copy=function(){return e=t,vr().domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown());var e},er.apply(t,arguments),mr(t)}function br(t){for(var e=t.length/6|0,n=new Array(e),r=0;r0&&s>0&&(u+s+1>r&&(s=Math.max(1,r-u)),o.push(t.substring(i-=s,i+s)),!((u+=s+1)>r));)s=e[a=(a+1)%e.length];return o.reverse().join(n)}),i=void 0===t.currency?"":t.currency[0]+"",o=void 0===t.currency?"":t.currency[1]+"",a=void 0===t.decimal?".":t.decimal+"",s=void 0===t.numerals?cr:function(t){return function(e){return e.replace(/[0-9]/g,(function(e){return t[+e]}))}}(pr.call(t.numerals,String)),u=void 0===t.percent?"%":t.percent+"",l=void 0===t.minus?"−":t.minus+"",c=void 0===t.nan?"NaN":t.nan+"";function f(t){var e=(t=ir(t)).fill,n=t.align,f=t.sign,h=t.symbol,d=t.zero,p=t.width,g=t.comma,m=t.precision,v=t.trim,b=t.type;"n"===b?(g=!0,b="g"):lr[b]||(void 0===m&&(m=12),v=!0,b="g"),(d||"0"===e&&"="===n)&&(d=!0,e="0",n="=");var y="$"===h?i:"#"===h&&/[boxX]/.test(b)?"0"+b.toLowerCase():"",w="$"===h?o:/[%p]/.test(b)?u:"",x=lr[b],_=/[defgprs%]/.test(b);function M(t){var i,o,u,h=y,M=w;if("c"===b)M=x(t)+M,t="";else{var k=(t=+t)<0||1/t<0;if(t=isNaN(t)?c:x(Math.abs(t),m),v&&(t=function(t){t:for(var e,n=t.length,r=1,i=-1;r0&&(i=0)}return i>0?t.slice(0,i)+t.slice(e+1):t}(t)),k&&0==+t&&"+"!==f&&(k=!1),h=(k?"("===f?f:l:"-"===f||"("===f?"":f)+h,M=("s"===b?gr[8+nr/3]:"")+M+(k&&"("===f?")":""),_)for(i=-1,o=t.length;++i(u=t.charCodeAt(i))||u>57){M=(46===u?a+t.slice(i+1):t.slice(i))+M,t=t.slice(0,i);break}}g&&!d&&(t=r(t,1/0));var A=h.length+t.length+M.length,S=A>1)+h+t+M+S.slice(A);break;default:t=S+h+t+M}return s(t)}return m=void 0===m?6:/[gprs]/.test(b)?Math.max(1,Math.min(21,m)):Math.max(0,Math.min(20,m)),M.toString=function(){return t+""},M}return{format:f,formatPrefix:function(t,e){var n=f(((t=ir(t)).type="f",t)),r=3*Math.max(-8,Math.min(8,Math.floor(sr(e)/3))),i=Math.pow(10,-r),o=gr[8+r/3];return function(t){return n(i*t)+o}}}}({thousands:",",grouping:[3],currency:["$",""]}),hr=fr.format,dr=fr.formatPrefix;const wr=yr(br("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725"));function xr(t,e,n){this.k=t,this.x=e,this.y=n}function _r(t){return Math.floor(Math.random()*t)}function Mr(t,e,...n){let r=Array(t);for(let i=0;it.map((t=>t*e))))}function jr(t,e){for(let n=0;nXr(t,e,-1,.05,.01),local:(t,e)=>Xr(t,e,0,.01,.5),pca:(t,e)=>Xr(t,e,1,0,.5),outlier:(t,e)=>Xr(t,e,2,0,5),push:(t,e)=>Lr(t,e,.5,.01,.5),pull:(t,e)=>Lr(t,e,.5,.01,-.2)};const{normal:Hr}=t;let Yr='~\n
~\n ~\n\n
~\n ~\n
~\n
~\n
~\n \n
\n \n
\n \n
\n \n \n \n \n \n \n \n
Brush size
Zoom
Damping
Heat
Label strength
Guide strength
\n
~\n
~\n\n
~\n ~\n \n ~\n \n ~\n \n
~\n Guide\n ~ \n
~\n \n
~\n \n
~\n \n
~\n
~\n
~\n'.replace(/~\s+/g,"");class Wr extends EventTarget{constructor(t,e,n){super(),this.width=1,this.height=1,this.size=1,this.fullscreen=!1,this.originalWidth=1,this.originalHeight=1,this.pointSize=1,this.center=[],this.scale=[],this.X=[[],[]],this.n=0,this.m=0,this.colnames=[],this.permutor=[],this.unpermutor=[],this.rownames=[],this.group=[],this.levels=[],this.levelColors=[],this.lineFrom=[],this.lineTo=[],this.lineColors=[],this.fills=[],this.filter=null,this.selection=null,this.selectionChanged=!1,this.axes=[],this.labelData=[],this.proj=[[],[]],this.vel=[[],[]],this.zoom=1,this.xScaleUnit=vr(),this.yScaleUnit=vr(),this.xScale=vr(),this.yScale=vr(),this.xScaleClamped=vr(),this.yScaleClamped=vr(),this.haveData=!1,this.playing=!0,this.frameScheduled=!1,this.lastTime=0,this.mouseInCheckbox=!1,this.dragging=!1,this.fps=[],this.computeMessage="",this.mousing=!1,this.mouseDown=!1,this.mouseWentDown=!1,this.mouseShiftKey=!1,this.mouseX=0,this.mouseY=0,this.rightMouseDown=!1,this.rightMouseWentDown=!1,this.tugging=!1,this.tugX=0,this.tugY=0,this.tugPoints=[],this.xy=[[],[]],this.fillsFrame=[],this.pointActive=[],this.container=t,this.shadowDiv=document.createElement("div"),this.container.appendChild(this.shadowDiv),this.shadowRoot=this.shadowDiv.attachShadow({mode:"open"}),this.shadowRoot.innerHTML=Yr,this.shadowChild=this.shadowRoot.firstChild,this.canvas=this.get("canvas"),this.overlay=this.get("overlay"),this.container.langevitour=this,this.resize(e,n);let r=this.get("plotDiv");r.addEventListener("mouseover",(t=>{this.mousing=!0,this.scheduleFrameIfNeeded()})),r.addEventListener("mouseout",(t=>{this.mousing=!1,this.mouseDown=!1,this.rightMouseDown=!1,this.scheduleFrameIfNeeded()}));let i=t=>([this.mouseX,this.mouseY]=Br(t,this.canvas),t.target.classList.contains("overlay")?(this.mouseDown=1==t.buttons&&!t.ctrlKey,this.rightMouseDown=2==t.buttons||1==t.buttons&&t.ctrlKey,this.scheduleFrameIfNeeded(),!0):(this.mouseDown=!1,this.rightMouseDown=!1,!1));r.addEventListener("mousemove",(t=>{i(t)})),r.addEventListener("mousedown",(t=>{if(!i(t))return;let e=this.get("infoBox");"visible"!=e.style.visibility?(this.mouseDown&&(this.mouseWentDown=!0,this.mouseShiftKey=t.shiftKey),this.rightMouseDown&&(this.rightMouseWentDown=!0),this.scheduleFrameIfNeeded()):e.style.visibility="hidden"})),r.addEventListener("mouseup",(t=>{this.mouseDown=!1,this.rightMouseDown=!1,this.scheduleFrameIfNeeded()})),null==this.container.requestFullscreen&&(this.get("fullscreenButton").style.display="none"),this.get("fullscreenButton").addEventListener("click",(()=>{document.fullscreenElement?document.fullscreenElement===this.shadowDiv&&document.exitFullscreen&&document.exitFullscreen():this.shadowDiv.requestFullscreen()}));let o=()=>{if(!this.fullscreen)return;let t=this.shadowDiv,e=window.innerWidth,n=window.innerHeight,r=Math.max(0,e-n)/2;t.style.paddingLeft=r+"px",this.width=e-r,this.height=n,this.configure()};this.shadowDiv.addEventListener("fullscreenchange",(()=>{let t=this.shadowDiv;document.fullscreenElement===t?(this.fullscreen||(this.fullscreen=!0,this.originalWidth=this.width,this.originalHeight=this.height,window.addEventListener("resize",o)),o()):this.fullscreen&&(this.fullscreen=!1,t.style.paddingLeft="0px",this.width=this.originalWidth,this.height=this.originalHeight,window.removeEventListener("resize",o),this.configure())})),this.get("infoButton").addEventListener("click",(()=>{let t=this.get("infoBox");"visible"!=t.style.visibility&&this.haveData?(t.style.visibility="visible",this.get("infoBoxProj").style.display="none",this.get("infoBoxState").style.display="none",this.get("infoBoxInfo").innerHTML=`

${this.X.length.toLocaleString("en-US")} points.

`):t.style.visibility="hidden"})),this.get("infoBoxProjButton").addEventListener("click",(()=>{let t=this.getInput("infoBoxProj");if(Fr(t),"none"!=t.style.display){let t="projection <- cbind(\n c(";t+=this.proj.map((t=>t.map(((t,e)=>(t/this.scale[e]).toFixed(Math.ceil(Math.log10(Math.max(0,this.scale[e]))+4)))).join(","))).join("),\n c("),t+="))\nprojected <- as.matrix(X) %*% projection",this.getInput("infoBoxProj").value=t}})),this.get("infoBoxStateButton").addEventListener("click",(()=>{let t=this.getInput("infoBoxState");Fr(t),"none"!=t.style.display&&(t.value=JSON.stringify(this.getState(),null,4))})),this.get("playButton").addEventListener("click",(()=>this.setState({playing:!this.playing})))}get(t){return this.shadowChild.getElementsByClassName(t)[0]}getInput(t){return this.get(t)}getString(t){return this.getInput(t).value}getNumber(t){return Number(this.getInput(t).value)}getChecked(t){return this.getInput(t).checked}emitChangeFilter(){setTimeout((()=>this.dispatchEvent(new Event("changeFilter"))),0)}emitChangeSelectionIfNeeded(){this.selectionChanged&&(this.selectionChanged=!1,setTimeout((()=>this.dispatchEvent(new Event("changeSelection"))),0))}renderValue(t){if(!t)return this.haveData=!1,void this.configure();this.haveData=!0,this.n=t.X.length,this.m=t.X[0].length,this.pointSize=null!=t.pointSize?t.pointSize:1;let e=t.axisColors||[];this.center=t.center||Array(this.m).fill(0),this.scale=t.scale||Array(this.m).fill(1),this.permutor=function(t){let e=Array(t).fill(0).map(((t,e)=>e));for(let t=e.length-1;t>0;t--){const n=_r(t+1);[e[t],e[n]]=[e[n],e[t]]}return e}(this.n),this.unpermutor=Array(this.n);for(let t=0;tt.X[e])),this.X=this.X.map((t=>t.map(((t,e)=>(t-this.center[e])/this.scale[e])))),t.rownames&&0!=t.rownames.length){let e=t.rownames;this.rownames=this.permutor.map((t=>e[t]))}else this.rownames=[];if(this.colnames=t.colnames,this.lineFrom=(t.lineFrom||[]).map((t=>this.unpermutor[t])),this.lineTo=(t.lineTo||[]).map((t=>this.unpermutor[t])),this.lineColors=t.lineColors||[],this.lineFrom.length&&!this.lineColors.length&&(this.lineColors=this.lineFrom.map((()=>"#00000088"))),this.axes=[],t.extraAxes&&t.extraAxesNames)for(let n=0;nt[n])),i=Nr(r,this.center),o=r.map(((t,e)=>t*this.scale[e])),a=Math.sqrt(Nr(o,o)),s=qr(o,1/a);this.axes.push({name:t.extraAxesNames[n],unit:s,scale:a,center:i,color:e[n+this.m],proj:[]})}for(let n=0;nNr(e,this.axes[t].unit)));this.levels=t.levels,this.group=this.permutor.map((e=>t.group[e]));let n=this.levels.length;this.levelColors=(t.levelColors||[]).slice();for(let t=this.levelColors.length;t1)for(let t=0;t\n \n \n':'\n \n',!this.haveData){this.get("messageArea").innerText="",this.overlay.style.opacity="0";let t=this.canvas.getContext("2d");return t.scale(1,1),void t.clearRect(0,0,this.canvas.width,this.canvas.height)}this.configureScales();let e=wn(this.overlay);e.selectAll("*").remove(),this.mouseInCheckbox=!1;let n=this,r=e.selectAll("div").data(this.labelData).join((t=>{let e=t.append("div").classed("labelDiv",!0);return e.append("input").attr("type","checkbox").property("checked",(t=>t.active)).on("change",(function(t,e){e.active=this.checked,n.scheduleFrameIfNeeded(),n.emitChangeFilter()})).on("mouseover",(()=>{this.mouseInCheckbox=!0})).on("mouseout",(()=>{this.mouseInCheckbox=!1})),e.append("span"),e}));function i(){let t=n.xScaleUnit.invert(n.width);for(let e of n.labelData)e.x=Math.max(-1,Math.min(t,e.x)),e.y=Math.max(-1,Math.min(1,e.y));r.style("left",(t=>n.xScaleUnit(t.x)-t.halfWidth+"px")).style("top",(t=>n.yScaleUnit(t.y)-t.halfHeight+"px")).style("background",(t=>t.selected?"#aaa":"#ddd"))}r.style("cursor","grab").on("mouseover",((t,e)=>{e.selected+=1,i()})).on("mouseout",((t,e)=>{e.selected=Math.max(0,e.selected-1),i()})),r.select("span").text((t=>t.label)).style("color",(t=>t.color)),r.each((function(t){t.halfWidth=this.offsetWidth/2,t.halfHeight=this.offsetHeight/2})),function(){var t,e,n,r,i=qn,o=En,a=Cn,s=In,u={},l=xt("start","drag","end"),c=0,f=0;function h(t){t.on("mousedown.drag",d).filter(s).on("touchstart.drag",m).on("touchmove.drag",v,_n).on("touchend.drag touchcancel.drag",b).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function d(a,s){if(!r&&i.call(this,a,s)){var u=y(this,o.call(this,a,s),a,s,"mouse");u&&(wn(a.view).on("mousemove.drag",p,Mn).on("mouseup.drag",g,Mn),function(t){var e=t.document.documentElement,n=wn(t).on("dragstart.drag",An,Mn);"onselectstart"in e?n.on("selectstart.drag",An,Mn):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}(a.view),kn(a),n=!1,t=a.clientX,e=a.clientY,u("start",a))}}function p(r){if(An(r),!n){var i=r.clientX-t,o=r.clientY-e;n=i*i+o*o>f}u.mouse("drag",r)}function g(t){wn(t.view).on("mousemove.drag mouseup.drag",null),function(t,e){var n=t.document.documentElement,r=wn(t).on("dragstart.drag",null);e&&(r.on("click.drag",An,Mn),setTimeout((function(){r.on("click.drag",null)}),0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}(t.view,n),An(t),u.mouse("end",t)}function m(t,e){if(i.call(this,t,e)){var n,r,a=t.changedTouches,s=o.call(this,t,e),u=a.length;for(n=0;nthis.selection[t])):t.selection=null,this.filter?t.filter=this.unpermutor.map((t=>this.filter[t])):t.filter=null,t}setState(t){let e=!1,n=!1;if("string"==typeof t&&(t=JSON.parse(t)),t){if($r(t,"playing")&&(!this.playing&&t.playing&&(this.lastTime=0),this.playing=t.playing),$r(t,"axesOn")&&(this.getInput("axesCheckbox").checked=t.axesOn),$r(t,"heatOn")&&(this.getInput("heatCheckbox").checked=t.heatOn),$r(t,"pointRepulsionType")&&(this.getInput("guideSelect").value=t.pointRepulsionType),$r(t,"guideType")&&(this.getInput("guideSelect").value=t.guideType),$r(t,"labelAttractionOn")&&(this.getInput("labelCheckbox").checked=t.labelAttractionOn),$r(t,"damping")&&(this.getInput("dampInput").value=t.damping),$r(t,"heat")&&(this.getInput("heatInput").value=t.heat),$r(t,"pointRepulsion")&&(this.getInput("guideInput").value=t.pointRepulsion),$r(t,"guide")&&(this.getInput("guideInput").value=t.guide),$r(t,"labelAttraction")&&(this.getInput("labelInput").value=t.labelAttraction),$r(t,"zoom")&&(this.getInput("zoomInput").value=t.zoom),$r(t,"brush")&&(this.getInput("brushInput").value=t.brush),$r(t,"labelInactive")){for(let e of this.labelData)e.active=!t.labelInactive.includes(e.label);e=!0}if($r(t,"labelPos"))for(let e of this.labelData)$r(t.labelPos,e.label)?(e.x=t.labelPos[e.label][0],e.y=t.labelPos[e.label][1]):e.x=1;$r(t,"projection")&&(this.proj=Array.from(t.projection.map((t=>Array.from(t))))),$r(t,"selection")&&(null===t.selection?this.selection=null:this.selection=this.permutor.map((e=>t.selection[e])),this.selectionChanged=!0,n=!0),$r(t,"filter")&&(null===t.filter?this.filter=null:this.filter=this.permutor.map((e=>t.filter[e]))),this.configure(),e&&this.emitChangeFilter(),n&&this.emitChangeSelectionIfNeeded()}}scheduleFrameIfNeeded(){!this.frameScheduled&&this.haveData&&(window.requestAnimationFrame(this.doFrame.bind(this)),this.frameScheduled=!0)}doFrame(t){if(this.frameScheduled=!1,!this.haveData)return;if(!function(t){let e=t;for(;;){let t=window.getComputedStyle(e);if("0"===t.opacity||"none"===t.display||"visible"!==t.visibility)return!1;if(!e.parentElement)break;e=e.parentElement}let n=t.getBoundingClientRect();return n.top=0&&n.left=0}(this.container))return this.lastTime=0,void window.setTimeout(this.scheduleFrameIfNeeded.bind(this),100);t/=1e3;let e=0;(this.playing||this.tugging)&&0!=this.lastTime&&(e=t-this.lastTime,this.fps.push(Math.round(1/e)),this.fps.length>100&&this.fps.shift()),this.lastTime=t,this.compute(e),this.configureScales();let n=null,r=null,i=this.labelData.filter((t=>t.selected));i.length&&("axis"==i[0].type?n=i[0].index:r=i[0].index);let o=this.getChecked("axesCheckbox"),a=Array(this.levels.length).fill(!0);for(let t of this.labelData)"level"==t.type&&(a[t.index]=t.active);let s=.05*this.size*Math.pow(10,this.getNumber("brushInput")),u=[];if(this.mouseXMath.pow(s,2)||u.push({index:t,d2:e})}u.sort(((t,e)=>t.d2-e.d2))}if(this.rightMouseWentDown&&(this.tugPoints=u.map((t=>t.index)),this.rightMouseWentDown=!1),this.tugging=this.rightMouseDown&&this.tugPoints.length>0,this.tugging&&(this.tugX=this.xScale.invert(this.mouseX),this.tugY=this.yScale.invert(this.mouseY)),this.mouseDown||this.mouseWentDown){if(this.mouseWentDown&&!this.mouseShiftKey&&(this.selection=null,this.selectionChanged=!0),u.length){this.selection||(this.selection=Array(this.n).fill(!1),this.selectionChanged=!0);for(let t=0;t=0;t--){let e=u[t].index,n=this.xScaleClamped(this.xy[0][e]),r=this.yScaleClamped(this.xy[1][e]);c.strokeText(this.rownames[e],n,r),c.fillText(this.rownames[e],n,r)}}if(c.restore(),c.textAlign="left",c.textBaseline="middle",c.font="15px sans-serif",!this.mousing)for(let t=0,e=0;t=1&&(o/=d,l/=d),f[0]=qr(e,(o-n)/i*t),f[1]=qr(e,(l-r)/i*t),a=!1,u=!1,s="none"}if(a){let t=1-d*d,e=Mr(h.length,Mr,this.m,Hr.sample,0,Math.sqrt(r*t));e=zr(e,h),Dr(f,e)}if("none"!=s){let t=this.X.filter(((t,e)=>this.pointActive[e]));if(t.length){let e=Or[s](h,t);jr(e,-i),Dr(f,e)}}if(u)for(let t of this.labelData){let e=t.x,n=t.y;if(e<=-1||n<=-1||e>=1||n>=1)continue;if("level"==t.type&&!l[t.index])continue;let r=4*(e*e+n*n);f[0]=Sr(f[0],qr(t.vec,e*r*o)),f[1]=Sr(f[1],qr(t.vec,n*r*o))}let p=[];for(let t of this.labelData)"axis"!=t.type||t.active||p.push(this.axes[t.index].unit);let g=p.length>=this.m-1,m=!1;if(p.length&&!g){let t=Math.min(2,1/c),{u:n,v:r,q:i}=(0,e.SVD)(Tr(p)),o=Math.max(...i);n=Tr(n);let a=Er(2,this.m);for(let e=0;e{var t={162:function(t){var e;t.exports=(e=function(t,e){var n=Array.prototype.concat,r=Array.prototype.slice,i=Object.prototype.toString;function o(e,n){var r=e>n?e:n;return t.pow(10,17-~~(t.log(r>0?r:-r)*t.LOG10E))}var a=Array.isArray||function(t){return"[object Array]"===i.call(t)};function s(t){return"[object Function]"===i.call(t)}function u(t){return"number"==typeof t&&t-t==0}function l(){return new l._init(arguments)}function f(){return 0}function c(){return 1}function h(t,e){return t===e?1:0}l.fn=l.prototype,l._init=function(t){if(a(t[0]))if(a(t[0][0])){s(t[1])&&(t[0]=l.map(t[0],t[1]));for(var e=0;e=0;e--,r++)n[r]=[t[r][e]];return n},l.transpose=function(t){var e,n,r,i,o,s=[];for(a(t[0])||(t=[t]),n=t.length,r=t[0].length,o=0;o0&&(s[r][0]=t[r][0]),u=1;un&&r>0)return[];if(r>0)for(i=t;in;i+=r)o.push(i);return o},l.slice=function(){function t(t,n,r,i){var o,a=[],s=t.length;if(n===e&&r===e&&i===e)return l.copy(t);if(i=i||1,(n=(n=n||0)>=0?n:s+n)===(r=(r=r||t.length)>=0?r:s+r)||0===i)return[];if(nr&&i>0)return[];if(i>0)for(o=n;or;o+=i)a.push(t[o]);return a}return function(e,n){var r,i;return u((n=n||{}).row)?u(n.col)?e[n.row][n.col]:t(l.rowa(e,n.row),(r=n.col||{}).start,r.end,r.step):u(n.col)?t(l.cola(e,n.col),(i=n.row||{}).start,i.end,i.step):(i=n.row||{},r=n.col||{},t(e,i.start,i.end,i.step).map((function(e){return t(e,r.start,r.end,r.step)})))}}(),l.sliceAssign=function(n,r,i){var o,a;if(u(r.row)){if(u(r.col))return n[r.row][r.col]=i;r.col=r.col||{},r.col.start=r.col.start||0,r.col.end=r.col.end||n[0].length,r.col.step=r.col.step||1,o=l.arange(r.col.start,t.min(n.length,r.col.end),r.col.step);var s=r.row;return o.forEach((function(t,e){n[s][t]=i[e]})),n}if(u(r.col)){r.row=r.row||{},r.row.start=r.row.start||0,r.row.end=r.row.end||n.length,r.row.step=r.row.step||1,a=l.arange(r.row.start,t.min(n[0].length,r.row.end),r.row.step);var f=r.col;return a.forEach((function(t,e){n[t][f]=i[e]})),n}return i[0].length===e&&(i=[i]),r.row.start=r.row.start||0,r.row.end=r.row.end||n.length,r.row.step=r.row.step||1,r.col.start=r.col.start||0,r.col.end=r.col.end||n[0].length,r.col.step=r.col.step||1,a=l.arange(r.row.start,t.min(n.length,r.row.end),r.row.step),o=l.arange(r.col.start,t.min(n[0].length,r.col.end),r.col.step),a.forEach((function(t,e){o.forEach((function(r,o){n[t][r]=i[e][o]}))})),n},l.diagonal=function(t){var e=l.zeros(t.length,t.length);return t.forEach((function(t,n){e[n][n]=t})),e},l.copy=function(t){return t.map((function(t){return u(t)?t:t.map((function(t){return t}))}))};var d=l.prototype;return d.length=0,d.push=Array.prototype.push,d.sort=Array.prototype.sort,d.splice=Array.prototype.splice,d.slice=Array.prototype.slice,d.toArray=function(){return this.length>1?r.call(this):r.call(this)[0]},d.map=function(t,e){return l(l.map(this,t,e))},d.cumreduce=function(t,e){return l(l.cumreduce(this,t,e))},d.alter=function(t){return l.alter(this,t),this},function(t){for(var e=0;e=0;)e+=t[n];return e},t.sumsqrd=function(t){for(var e=0,n=t.length;--n>=0;)e+=t[n]*t[n];return e},t.sumsqerr=function(e){for(var n,r=t.mean(e),i=0,o=e.length;--o>=0;)i+=(n=e[o]-r)*n;return i},t.sumrow=function(t){for(var e=0,n=t.length;--n>=0;)e+=t[n];return e},t.product=function(t){for(var e=1,n=t.length;--n>=0;)e*=t[n];return e},t.min=function(t){for(var e=t[0],n=0;++ne&&(e=t[n]);return e},t.unique=function(t){for(var e={},n=[],r=0;ra?(u=[i[e]],a=o,s=0):o===a&&(u.push(i[e]),s++),o=1);return 0===s?u[0]:u},t.range=function(e){return t.max(e)-t.min(e)},t.variance=function(e,n){return t.sumsqerr(e)/(e.length-(n?1:0))},t.pooledvariance=function(e){return e.reduce((function(e,n){return e+t.sumsqerr(n)}),0)/(e.reduce((function(t,e){return t+e.length}),0)-e.length)},t.deviation=function(e){for(var n=t.mean(e),r=e.length,i=new Array(r),o=0;o=0;o--)i.push(e.abs(n[o]-r));return t.mean(i)},t.meddev=function(n){for(var r=t.median(n),i=[],o=n.length-1;o>=0;o--)i.push(e.abs(n[o]-r));return t.median(i)},t.coeffvar=function(e){return t.stdev(e)/t.mean(e)},t.quartiles=function(t){var n=t.length,i=t.slice().sort(r);return[i[e.round(n/4)-1],i[e.round(n/2)-1],i[e.round(3*n/4)-1]]},t.quantiles=function(t,n,o,a){var s,u,l,f,c,h=t.slice().sort(r),d=[n.length],p=t.length;for(void 0===o&&(o=3/8),void 0===a&&(a=3/8),s=0;s1){for(u=!0===r?this:this.transpose();s1){for("sumrow"!==e&&(u=!0===r?this:this.transpose());s1){for(s=s.transpose();a=0;s--)a*=r,a+=l[s];if(o=a/n+.5*e.log(i)+(n-.5)*e.log(n)-n,t<=7)for(s=1;s<=u;s++)o-=e.log(n-1),n-=1;return o},t.gammafn=function(t){var n,r,i,o,a=[-1.716185138865495,24.76565080557592,-379.80425647094563,629.3311553128184,866.9662027904133,-31451.272968848367,-36144.413418691176,66456.14382024054],s=[-30.8402300119739,315.35062697960416,-1015.1563674902192,-3107.771671572311,22538.11842098015,4755.846277527881,-134659.9598649693,-115132.2596755535],u=!1,l=0,f=0,c=0,h=t;if(t>171.6243769536076)return 1/0;if(h<=0){if(!(o=h%1+36e-17))return 1/0;u=(1&h?-1:1)*e.PI/e.sin(e.PI*o),h=1-h}for(i=h,r=h<1?h++:(h-=l=(0|h)-1)-1,n=0;n<8;++n)c=(c+a[n])*r,f=f*r+s[n];if(o=c/f+1,ih)for(n=0;n=1?n:1/n)+.4*n+17);if(r<0||n<=0)return NaN;if(r170||r>170?e.exp(t.combinationln(n,r)):t.factorial(n)/t.factorial(r)/t.factorial(n-r)},t.combinationln=function(e,n){return t.factorialln(e)-t.factorialln(n)-t.factorialln(e-n)},t.permutation=function(e,n){return t.factorial(e)/t.factorial(e-n)},t.betafn=function(n,r){if(!(n<=0||r<=0))return n+r>170?e.exp(t.betaln(n,r)):t.gammafn(n)*t.gammafn(r)/t.gammafn(n+r)},t.betaln=function(e,n){return t.gammaln(e)+t.gammaln(n)-t.gammaln(e+n)},t.betacf=function(t,n,r){var i,o,a,s,u=1e-30,l=1,f=n+r,c=n+1,h=n-1,d=1,p=1-f*t/c;for(e.abs(p)=1)return e.max(100,r+100*e.sqrt(r));if(n<=0)return 0;for(r>1?(u=e.log(c),l=e.exp(c*(u-1)-h),s=n<.5?n:1-n,i=(2.30753+.27061*(o=e.sqrt(-2*e.log(s))))/(1+o*(.99229+.04481*o))-o,n<.5&&(i=-i),i=e.max(.001,r*e.pow(1-1/(9*r)-i/(3*e.sqrt(r)),3))):i=n<(o=1-r*(.253+.12*r))?e.pow(n/o,1/r):1-e.log(1-(n-o)/(1-o));f<12;f++){if(i<=0)return 0;if((i-=o=(a=(t.lowRegGamma(r,i)-n)/(o=r>1?l*e.exp(-(i-c)+c*(e.log(i)-u)):e.exp(-i+c*e.log(i)-h)))/(1-.5*e.min(1,a*((r-1)/i-1))))<=0&&(i=.5*(i+o)),e.abs(o)<1e-8*i)break}return i},t.erf=function(t){var n,r,i,o,a=[-1.3026537197817094,.6419697923564902,.019476473204185836,-.00956151478680863,-.000946595344482036,.000366839497852761,42523324806907e-18,-20278578112534e-18,-1624290004647e-18,130365583558e-17,1.5626441722e-8,-8.5238095915e-8,6.529054439e-9,5.059343495e-9,-9.91364156e-10,-2.27365122e-10,96467911e-18,2394038e-18,-6886027e-18,894487e-18,313092e-18,-112708e-18,381e-18,7106e-18,-1523e-18,-94e-18,121e-18,-28e-18],s=a.length-1,u=!1,l=0,f=0;for(t<0&&(t=-t,u=!0),r=4*(n=2/(2+t))-2;s>0;s--)i=l,l=r*l-f+a[s],f=i;return o=n*e.exp(-t*t+.5*(a[0]+r*l)-f),u?o-1:1-o},t.erfc=function(e){return 1-t.erf(e)},t.erfcinv=function(n){var r,i,o,a,s=0;if(n>=2)return-100;if(n<=0)return 100;for(a=n<1?n:2-n,r=-.70711*((2.30753+.27061*(o=e.sqrt(-2*e.log(a/2))))/(1+o*(.99229+.04481*o))-o);s<2;s++)r+=(i=t.erfc(r)-a)/(1.1283791670955126*e.exp(-r*r)-r*i);return n<1?r:-r},t.ibetainv=function(n,r,i){var o,a,s,u,l,f,c,h,d,p,g=r-1,m=i-1,v=0;if(n<=0)return 0;if(n>=1)return 1;for(r>=1&&i>=1?(s=n<.5?n:1-n,f=(2.30753+.27061*(u=e.sqrt(-2*e.log(s))))/(1+u*(.99229+.04481*u))-u,n<.5&&(f=-f),c=(f*f-3)/6,h=2/(1/(2*r-1)+1/(2*i-1)),d=f*e.sqrt(c+h)/h-(1/(2*i-1)-1/(2*r-1))*(c+5/6-2/(3*h)),f=r/(r+i*e.exp(2*d))):(o=e.log(r/(r+i)),a=e.log(i/(r+i)),f=n<(u=e.exp(r*o)/r)/(d=u+(l=e.exp(i*a)/i))?e.pow(r*d*n,1/r):1-e.pow(i*d*(1-n),1/i)),p=-t.gammaln(r)-t.gammaln(i)+t.gammaln(r+i);v<10;v++){if(0===f||1===f)return f;if((f-=u=(l=(t.ibeta(f,r,i)-n)/(u=e.exp(g*e.log(f)+m*e.log(1-f)+p)))/(1-.5*e.min(1,l*(g/f-m/(1-f)))))<=0&&(f=.5*(f+u)),f>=1&&(f=.5*(f+u+1)),e.abs(u)<1e-8*f&&v>0)break}return f},t.ibeta=function(n,r,i){var o=0===n||1===n?0:e.exp(t.gammaln(r+i)-t.gammaln(r)-t.gammaln(i)+r*e.log(n)+i*e.log(1-n));return!(n<0||n>1)&&(n<(r+1)/(r+i+2)?o*t.betacf(n,r,i)/r:1-o*t.betacf(1-n,i,r)/i)},t.randn=function(n,r){var i,o,a,s,u;if(r||(r=n),n)return t.create(n,r,(function(){return t.randn()}));do{i=t._random_fn(),o=1.7156*(t._random_fn()-.5),u=(a=i-.449871)*a+(s=e.abs(o)+.386595)*(.196*s-.25472*a)}while(u>.27597&&(u>.27846||o*o>-4*e.log(i)*i*i));return o/i},t.randg=function(n,r,i){var o,a,s,u,l,f,c=n;if(i||(i=r),n||(n=1),r)return(f=t.zeros(r,i)).alter((function(){return t.randg(n)})),f;n<1&&(n+=1),o=n-1/3,a=1/e.sqrt(9*o);do{do{u=1+a*(l=t.randn())}while(u<=0);u*=u*u,s=t._random_fn()}while(s>1-.331*e.pow(l,4)&&e.log(s)>.5*l*l+o*(1-u+e.log(u)));if(n==c)return o*u;do{s=t._random_fn()}while(0===s);return e.pow(s,1/c)*o*u},function(e){for(var n=0;ni;)c=u,s=l+(o=-(n+f)*(n+r+f)*t/(n+2*f)/(n+2*f+1))*s,u=(a=u+o*a)+(o=(f+=1)*(r-f)*t/(n+2*f-1)/(n+2*f))*u,a/=l=s+o*l,s/=l,u/=l,l=1;return u/n}function r(n,r,i){var o=[.9815606342467192,.9041172563704749,.7699026741943047,.5873179542866175,.3678314989981802,.1252334085114689],a=[.04717533638651183,.10693932599531843,.16007832854334622,.20316742672306592,.2334925365383548,.24914704581340277],s=.5*n;if(s>=8)return 1;var u,l=2*t.normal.cdf(s,0,1,1,0)-1;l=l>=e.exp(-50/i)?e.pow(l,i):0;for(var f=s,c=(8-s)/(u=n>3?2:3),h=f+c,d=0,p=i-1,g=1;g<=u;g++){for(var m=0,v=.5*(h+f),b=.5*(h-f),y=1;y<=12;y++){var w,x=v+b*(660)break;var M=2*t.normal.cdf(x,0,1,1,0)*.5-2*t.normal.cdf(x,n,1,1,0)*.5;M>=e.exp(-30/p)&&(m+=M=a[w-1]*e.exp(-.5*_)*e.pow(M,p))}d+=m*=2*b*i/e.sqrt(2*e.PI),f=h,h+=c}return(l+=d)<=e.exp(-30/r)?0:(l=e.pow(l,r))>=1?1:l}!function(e){for(var n=0;n1||n<0?0:1==r&&1==i?1:r<512&&i<512?e.pow(n,r-1)*e.pow(1-n,i-1)/t.betafn(r,i):e.exp((r-1)*e.log(n)+(i-1)*e.log(1-n)-t.betaln(r,i))},cdf:function(e,n,r){return e>1||e<0?1*(e>1):t.ibeta(e,n,r)},inv:function(e,n,r){return t.ibetainv(e,n,r)},mean:function(t,e){return t/(t+e)},median:function(e,n){return t.ibetainv(.5,e,n)},mode:function(t,e){return(t-1)/(t+e-2)},sample:function(e,n){var r=t.randg(e);return r/(r+t.randg(n))},variance:function(t,n){return t*n/(e.pow(t+n,2)*(t+n+1))}}),t.extend(t.centralF,{pdf:function(n,r,i){var o;return n<0?0:r<=2?0===n&&r<2?1/0:0===n&&2===r?1:1/t.betafn(r/2,i/2)*e.pow(r/i,r/2)*e.pow(n,r/2-1)*e.pow(1+r/i*n,-(r+i)/2):(o=r*n/(i+n*r),r*(i/(i+n*r))/2*t.binomial.pdf((r-2)/2,(r+i-2)/2,o))},cdf:function(e,n,r){return e<0?0:t.ibeta(n*e/(n*e+r),n/2,r/2)},inv:function(e,n,r){return r/(n*(1/t.ibetainv(e,n/2,r/2)-1))},mean:function(t,e){return e>2?e/(e-2):void 0},mode:function(t,e){return t>2?e*(t-2)/(t*(e+2)):void 0},sample:function(e,n){return 2*t.randg(e/2)/e/(2*t.randg(n/2)/n)},variance:function(t,e){if(!(e<=4))return 2*e*e*(t+e-2)/(t*(e-2)*(e-2)*(e-4))}}),t.extend(t.cauchy,{pdf:function(t,n,r){return r<0?0:r/(e.pow(t-n,2)+e.pow(r,2))/e.PI},cdf:function(t,n,r){return e.atan((t-n)/r)/e.PI+.5},inv:function(t,n,r){return n+r*e.tan(e.PI*(t-.5))},median:function(t){return t},mode:function(t){return t},sample:function(n,r){return t.randn()*e.sqrt(1/(2*t.randg(.5)))*r+n}}),t.extend(t.chisquare,{pdf:function(n,r){return n<0?0:0===n&&2===r?.5:e.exp((r/2-1)*e.log(n)-n/2-r/2*e.log(2)-t.gammaln(r/2))},cdf:function(e,n){return e<0?0:t.lowRegGamma(n/2,e/2)},inv:function(e,n){return 2*t.gammapinv(e,.5*n)},mean:function(t){return t},median:function(t){return t*e.pow(1-2/(9*t),3)},mode:function(t){return t-2>0?t-2:0},sample:function(e){return 2*t.randg(e/2)},variance:function(t){return 2*t}}),t.extend(t.exponential,{pdf:function(t,n){return t<0?0:n*e.exp(-n*t)},cdf:function(t,n){return t<0?0:1-e.exp(-n*t)},inv:function(t,n){return-e.log(1-t)/n},mean:function(t){return 1/t},median:function(t){return 1/t*e.log(2)},mode:function(){return 0},sample:function(n){return-1/n*e.log(t._random_fn())},variance:function(t){return e.pow(t,-2)}}),t.extend(t.gamma,{pdf:function(n,r,i){return n<0?0:0===n&&1===r?1/i:e.exp((r-1)*e.log(n)-n/i-t.gammaln(r)-r*e.log(i))},cdf:function(e,n,r){return e<0?0:t.lowRegGamma(n,e/r)},inv:function(e,n,r){return t.gammapinv(e,n)*r},mean:function(t,e){return t*e},mode:function(t,e){if(t>1)return(t-1)*e},sample:function(e,n){return t.randg(e)*n},variance:function(t,e){return t*e*e}}),t.extend(t.invgamma,{pdf:function(n,r,i){return n<=0?0:e.exp(-(r+1)*e.log(n)-i/n-t.gammaln(r)+r*e.log(i))},cdf:function(e,n,r){return e<=0?0:1-t.lowRegGamma(n,r/e)},inv:function(e,n,r){return r/t.gammapinv(1-e,n)},mean:function(t,e){return t>1?e/(t-1):void 0},mode:function(t,e){return e/(t+1)},sample:function(e,n){return n/t.randg(e)},variance:function(t,e){if(!(t<=2))return e*e/((t-1)*(t-1)*(t-2))}}),t.extend(t.kumaraswamy,{pdf:function(t,n,r){return 0===t&&1===n?r:1===t&&1===r?n:e.exp(e.log(n)+e.log(r)+(n-1)*e.log(t)+(r-1)*e.log(1-e.pow(t,n)))},cdf:function(t,n,r){return t<0?0:t>1?1:1-e.pow(1-e.pow(t,n),r)},inv:function(t,n,r){return e.pow(1-e.pow(1-t,1/r),1/n)},mean:function(e,n){return n*t.gammafn(1+1/e)*t.gammafn(n)/t.gammafn(1+1/e+n)},median:function(t,n){return e.pow(1-e.pow(2,-1/n),1/t)},mode:function(t,n){if(t>=1&&n>=1&&1!==t&&1!==n)return e.pow((t-1)/(t*n-1),1/t)},variance:function(){throw new Error("variance not yet implemented")}}),t.extend(t.lognormal,{pdf:function(t,n,r){return t<=0?0:e.exp(-e.log(t)-.5*e.log(2*e.PI)-e.log(r)-e.pow(e.log(t)-n,2)/(2*r*r))},cdf:function(n,r,i){return n<0?0:.5+.5*t.erf((e.log(n)-r)/e.sqrt(2*i*i))},inv:function(n,r,i){return e.exp(-1.4142135623730951*i*t.erfcinv(2*n)+r)},mean:function(t,n){return e.exp(t+n*n/2)},median:function(t){return e.exp(t)},mode:function(t,n){return e.exp(t-n*n)},sample:function(n,r){return e.exp(t.randn()*r+n)},variance:function(t,n){return(e.exp(n*n)-1)*e.exp(2*t+n*n)}}),t.extend(t.noncentralt,{pdf:function(n,r,i){return e.abs(i)<1e-14?t.studentt.pdf(n,r):e.abs(n)<1e-14?e.exp(t.gammaln((r+1)/2)-i*i/2-.5*e.log(e.PI*r)-t.gammaln(r/2)):r/n*(t.noncentralt.cdf(n*e.sqrt(1+2/r),r+2,i)-t.noncentralt.cdf(n,r,i))},cdf:function(n,r,i){var o=1e-14;if(e.abs(i)o||u>o;)l=u,c>0&&(h*=i*i/(2*c),d*=i*i/(2*(c+.5))),s+=.5*(u=h*t.beta.cdf(f,c+.5,r/2)+d*t.beta.cdf(f,c+1,r/2)),c++;return a?1-s:s}}),t.extend(t.normal,{pdf:function(t,n,r){return e.exp(-.5*e.log(2*e.PI)-e.log(r)-e.pow(t-n,2)/(2*r*r))},cdf:function(n,r,i){return.5*(1+t.erf((n-r)/e.sqrt(2*i*i)))},inv:function(e,n,r){return-1.4142135623730951*r*t.erfcinv(2*e)+n},mean:function(t){return t},median:function(t){return t},mode:function(t){return t},sample:function(e,n){return t.randn()*n+e},variance:function(t,e){return e*e}}),t.extend(t.pareto,{pdf:function(t,n,r){return t1e100?1e100:r,1/(e.sqrt(r)*t.betafn(.5,r/2))*e.pow(1+n*n/r,-(r+1)/2)},cdf:function(n,r){var i=r/2;return t.ibeta((n+e.sqrt(n*n+r))/(2*e.sqrt(n*n+r)),i,i)},inv:function(n,r){var i=t.ibetainv(2*e.min(n,1-n),.5*r,.5);return i=e.sqrt(r*(1-i)/i),n>.5?i:-i},mean:function(t){return t>1?0:void 0},median:function(){return 0},mode:function(){return 0},sample:function(n){return t.randn()*e.sqrt(n/(2*t.randg(n/2)))},variance:function(t){return t>2?t/(t-2):t>1?1/0:void 0}}),t.extend(t.weibull,{pdf:function(t,n,r){return t<0||n<0||r<0?0:r/n*e.pow(t/n,r-1)*e.exp(-e.pow(t/n,r))},cdf:function(t,n,r){return t<0?0:1-e.exp(-e.pow(t/n,r))},inv:function(t,n,r){return n*e.pow(-e.log(1-t),1/r)},mean:function(e,n){return e*t.gammafn(1+1/n)},median:function(t,n){return t*e.pow(e.log(2),1/n)},mode:function(t,n){return n<=1?0:t*e.pow((n-1)/n,1/n)},sample:function(n,r){return n*e.pow(-e.log(t._random_fn()),1/r)},variance:function(n,r){return n*n*t.gammafn(1+2/r)-e.pow(t.weibull.mean(n,r),2)}}),t.extend(t.uniform,{pdf:function(t,e,n){return tn?0:1/(n-e)},cdf:function(t,e,n){return t=i)return 1;if(o<0||o>1||i<=0)return NaN;var u=o,l=(r=e.floor(r))+1,f=i-r,c=l+f,h=e.exp(t.gammaln(c)-t.gammaln(f)-t.gammaln(l)+l*e.log(u)+f*e.log(1-u));return a=u<(l+1)/(c+2)?h*n(u,l,f,s):1-h*n(1-u,f,l,s),e.round(1/s*(1-a))/(1/s)}}),t.extend(t.negbin,{pdf:function(n,r,i){return n===n>>>0&&(n<0?0:t.combination(n+r-1,r-1)*e.pow(1-i,n)*e.pow(i,r))},cdf:function(e,n,r){var i=0,o=0;if(e<0)return 0;for(;o<=e;o++)i+=t.negbin.pdf(o,n,r);return i}}),t.extend(t.hypgeom,{pdf:function(n,r,i,o){if(n!=n|0)return!1;if(n<0||no||n>i)return 0;if(2*i>r)return 2*o>r?t.hypgeom.pdf(r-i-o+n,r,r-i,r-o):t.hypgeom.pdf(o-n,r,r-i,o);if(2*o>r)return t.hypgeom.pdf(i-n,r,i,r-o);if(i1&&s=o||n>=i)return 1;if(2*i>r)return 2*o>r?t.hypgeom.cdf(r-i-o+n,r,r-i,r-o):1-t.hypgeom.cdf(o-n-1,r,r-i,o);if(2*o>r)return 1-t.hypgeom.cdf(i-n-1,r,i,r-o);if(i1&&uo);return i-1},sampleLarge:function(n){var r,i,o,a,s,u,l,f,c,h,d=n;for(a=e.sqrt(d),s=e.log(d),u=.02483*(l=.931+2.53*a)-.059,f=1.1239+1.1328/(l-3.4),c=.9277-3.6224/(l-2);;){if(i=e.random()-.5,o=e.random(),h=.5-e.abs(i),r=e.floor((2*u/h+l)*i+d+.43),h>=.07&&o<=c)return r;if(!(r<0||h<.013&&o>h)&&e.log(o)+e.log(f)-e.log(u/(h*h)+l)<=r*s-d-t.loggam(r+1))return r}},sample:function(t){return t<10?this.sampleSmall(t):this.sampleLarge(t)}}),t.extend(t.triangular,{pdf:function(t,e,n,r){return n<=e||rn?NaN:tn?0:tr?NaN:t<=n?0:t>=r?1:t<=i?e.pow(t-n,2)/((r-n)*(i-n)):1-e.pow(r-t,2)/((r-n)*(r-i))},inv:function(t,n,r,i){return r<=n||ir?NaN:t<=(i-n)/(r-n)?n+(r-n)*e.sqrt(t*((i-n)/(r-n))):n+(r-n)*(1-e.sqrt((1-t)*(1-(i-n)/(r-n))))},mean:function(t,e,n){return(t+e+n)/3},median:function(t,n,r){return r<=(t+n)/2?n-e.sqrt((n-t)*(n-r))/e.sqrt(2):r>(t+n)/2?t+e.sqrt((n-t)*(r-t))/e.sqrt(2):void 0},mode:function(t,e,n){return n},sample:function(n,r,i){var o=t._random_fn();return o<(i-n)/(r-n)?n+e.sqrt(o*(r-n)*(i-n)):r-e.sqrt((1-o)*(r-n)*(r-i))},variance:function(t,e,n){return(t*t+e*e+n*n-t*e-t*n-e*n)/18}}),t.extend(t.arcsine,{pdf:function(t,n,r){return r<=n?NaN:t<=n||t>=r?0:2/e.PI*e.pow(e.pow(r-n,2)-e.pow(2*t-n-r,2),-.5)},cdf:function(t,n,r){return t25e3)return r(n,1,a);var l,f=.5*o,c=f*e.log(o)-o*e.log(2)-t.gammaln(f),h=f-1,d=.25*o;l=o<=100?1:o<=800?.5:o<=5e3?.25:.125,c+=e.log(l);for(var p=0,g=1;g<=50;g++){for(var m=0,v=(2*g-1)*l,b=1;b<=16;b++){var y,w;8=-30&&(m+=r(8=1&&m<=1e-14)break;p+=m}if(m>1e-14)throw new Error("tukey.cdf failed to converge");return p>1&&(p=1),p},inv:function(n,r,i){if(i<2||r<2)return NaN;if(n<0||n>1)return NaN;if(0===n)return 0;if(1===n)return 1/0;var o,a=function(t,n,r){var i=.5-.5*t,o=e.sqrt(e.log(1/(i*i))),a=o+((((-453642210148e-16*o-.204231210125)*o-.342242088547)*o-1)*o+.322232421088)/((((.0038560700634*o+.10353775285)*o+.531103462366)*o+.588581570495)*o+.099348462606);r<120&&(a+=(a*a*a+a)/r/4);var s=.8832-.2368*a;return r<120&&(s+=-1.214/r+1.208*a/r),a*(s*e.log(n-1)+1.4142)}(n,r,i),s=t.tukey.cdf(a,r,i)-n;o=s>0?e.max(0,a-1):a+1;for(var u,l=t.tukey.cdf(o,r,i)-n,f=1;f<50;f++)if(u=o-l*(o-a)/(l-s),s=l,a=o,u<0&&(u=0,l=-n),l=t.tukey.cdf(u,r,i)-n,o=u,e.abs(o-a)<1e-4)return u;throw new Error("tukey.inv failed to converge")}})}(e,Math),function(t,e){var n,r,i=Array.prototype.push,o=t.utils.isArray;function a(e){return o(e)||e instanceof t}t.extend({add:function(e,n){return a(n)?(a(n[0])||(n=[n]),t.map(e,(function(t,e,r){return t+n[e][r]}))):t.map(e,(function(t){return t+n}))},subtract:function(e,n){return a(n)?(a(n[0])||(n=[n]),t.map(e,(function(t,e,r){return t-n[e][r]||0}))):t.map(e,(function(t){return t-n}))},divide:function(e,n){return a(n)?(a(n[0])||(n=[n]),t.multiply(e,t.inv(n))):t.map(e,(function(t){return t/n}))},multiply:function(e,n){var r,i,o,s,u,l,f,c;if(void 0===e.length&&void 0===n.length)return e*n;if(u=e.length,l=e[0].length,f=t.zeros(u,o=a(n)?n[0].length:l),c=0,a(n)){for(;c=0;u--){for(d=0,l=u+1;l<=f-1;l++)d+=p[l]*n[u][l];p[u]=(n[u][i-1]-d)/n[u][u]}return p},gauss_jordan:function(n,r){var i,o,a,s=t.aug(n,r),u=s.length,l=s[0].length,f=0;for(o=0;oe.abs(s[c][o])&&(c=a);var h=s[o];for(s[o]=s[c],s[c]=h,a=o+1;a=0;o--){for(f=s[o][o],a=0;ao-1;i--)s[a][i]-=s[o][i]*s[a][o]/f;for(s[o][o]/=f,i=u;ic?(d[f][c]=n[f][c],p[f][c]=g[f][c]=0):fo;)a=l,l=t.add(t.multiply(u,a),s),f++;return l},gauss_seidel:function(n,r,i,o){for(var a,s,u,l,f,c=0,h=n.length,d=[],p=[],g=[];ca?(d[c][a]=n[c][a],p[c][a]=g[c][a]=0):co;)s=f,f=t.add(t.multiply(l,s),u),c+=1;return f},SOR:function(n,r,i,o,a){for(var s,u,l,f,c,h=0,d=n.length,p=[],g=[],m=[];hs?(p[h][s]=n[h][s],g[h][s]=m[h][s]=0):ho;)u=c,c=t.add(t.multiply(f,u),l),h++;return c},householder:function(n){for(var r,i,o,a,s=n.length,u=n[0].length,l=0,f=[],c=[];l0?-1:1)*e.sqrt(r),i=e.sqrt((r*r-n[l+1][l]*r)/2),(f=t.zeros(s,1))[l+1][0]=(n[l+1][l]-r)/(2*i),o=l+2;o0?e.PI/4:-e.PI/4:e.atan(2*n[o][a]/(n[o][o]-n[a][a]))/2,(l=t.identity(c,c))[o][o]=e.cos(u),l[o][a]=-e.sin(u),l[a][o]=e.sin(u),l[a][a]=e.cos(u),h=t.multiply(h,l),n=t.multiply(t.multiply(t.inv(l),n),l),f=0,r=1;r.001&&(f=1)}for(r=0;r=c;)a=o(t,r+i),s=o(t,r),d[h]=(n[a]-2*n[s]+n[2*s-a])/(i*i),i/=2,h++;for(l=d.length,u=1;1!=l;){for(f=0;fr);i++);return n[i-=1]+(r-e[i])*h[i]+t.sq(r-e[i])*o[i]+(r-e[i])*t.sq(r-e[i])*d[i]},gauss_quadrature:function(){throw new Error("gauss_quadrature not yet implemented")},PCA:function(e){var n,r,i,o,a,s=e.length,u=e[0].length,l=0,f=[],c=[],h=[],d=[],p=[],g=[],m=[];for(l=0;l1||r>1||t<=0||r<=0)throw new Error("Proportions should be greater than 0 and less than 1");var o=(t*n+r*i)/(n+i);return(t-r)/e.sqrt(o*(1-o)*(1/n+1/i))}t.extend({zscore:function(){var e=n.call(arguments);return r(e[1])?(e[0]-e[1])/e[2]:(e[0]-t.mean(e[1]))/t.stdev(e[1],e[2])},ztest:function(){var r,o=n.call(arguments);return i(o[1])?(r=t.zscore(o[0],o[1],o[3]),1===o[2]?t.normal.cdf(-e.abs(r),0,1):2*t.normal.cdf(-e.abs(r),0,1)):o.length>2?(r=t.zscore(o[0],o[1],o[2]),1===o[3]?t.normal.cdf(-e.abs(r),0,1):2*t.normal.cdf(-e.abs(r),0,1)):(r=o[0],1===o[1]?t.normal.cdf(-e.abs(r),0,1):2*t.normal.cdf(-e.abs(r),0,1))}}),t.extend(t.fn,{zscore:function(t,e){return(t-this.mean())/this.stdev(e)},ztest:function(n,r,i){var o=e.abs(this.zscore(n,i));return 1===r?t.normal.cdf(-o,0,1):2*t.normal.cdf(-o,0,1)}}),t.extend({tscore:function(){var r=n.call(arguments);return 4===r.length?(r[0]-r[1])/(r[2]/e.sqrt(r[3])):(r[0]-t.mean(r[1]))/(t.stdev(r[1],!0)/e.sqrt(r[1].length))},ttest:function(){var i,o=n.call(arguments);return 5===o.length?(i=e.abs(t.tscore(o[0],o[1],o[2],o[3])),1===o[4]?t.studentt.cdf(-i,o[3]-1):2*t.studentt.cdf(-i,o[3]-1)):r(o[1])?(i=e.abs(o[0]),1==o[2]?t.studentt.cdf(-i,o[1]-1):2*t.studentt.cdf(-i,o[1]-1)):(i=e.abs(t.tscore(o[0],o[1])),1==o[2]?t.studentt.cdf(-i,o[1].length-1):2*t.studentt.cdf(-i,o[1].length-1))}}),t.extend(t.fn,{tscore:function(t){return(t-this.mean())/(this.stdev(!0)/e.sqrt(this.cols()))},ttest:function(n,r){return 1===r?1-t.studentt.cdf(e.abs(this.tscore(n)),this.cols()-1):2*t.studentt.cdf(-e.abs(this.tscore(n)),this.cols()-1)}}),t.extend({anovafscore:function(){var r,i,o,a,s,u,l,f,c=n.call(arguments);if(1===c.length){for(s=new Array(c[0].length),l=0;l.5?1-r:r)})),f=e.studentt.inv(.975,n.df_resid),c=n.coef.map((function(t,e){var n=f*s[e];return[t-n,t+n]}));return{se:s,t:u,p:l,sigmaHat:a,interval95:c}}return{ols:function(r,i){var o=t(r,i),a=n(o),s=function(t){var n,r,i,o=t.R2/t.df_model/((1-t.R2)/t.df_resid);return{F_statistic:o,pvalue:1-(n=o,r=t.df_model,i=t.df_resid,e.beta.cdf(n/(i/r+n),r/2,i/2))}}(o),u=1-(1-o.R2)*((o.nobs-1)/o.df_resid);return o.t=a,o.f=s,o.adjust_R2=u,o}}}(),e.extend({buildxmatrix:function(){for(var t=new Array(arguments.length),n=0;n1){for(a=[],r=0;r{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var r={};(()=>{"use strict";n.r(r),n.d(r,{Langevitour:()=>Wr});var t=n(162),e=n(409);function i(){}function o(t){return null==t?i:function(){return this.querySelector(t)}}function a(){return[]}function s(t){return null==t?a:function(){return this.querySelectorAll(t)}}function u(t){return function(){return this.matches(t)}}function l(t){return function(e){return e.matches(t)}}var f=Array.prototype.find;function c(){return this.firstElementChild}var h=Array.prototype.filter;function d(){return Array.from(this.children)}function p(t){return new Array(t.length)}function g(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}function m(t,e,n,r,i,o){for(var a,s=0,u=e.length,l=o.length;se?1:t>=e?0:NaN}g.prototype={constructor:g,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};var x="http://www.w3.org/1999/xhtml";const _={svg:"http://www.w3.org/2000/svg",xhtml:x,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function M(t){var e=t+="",n=e.indexOf(":");return n>=0&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),_.hasOwnProperty(e)?{space:_[e],local:t}:t}function S(t){return function(){this.removeAttribute(t)}}function A(t){return function(){this.removeAttributeNS(t.space,t.local)}}function k(t,e){return function(){this.setAttribute(t,e)}}function N(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function q(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}}function E(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function C(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function I(t){return function(){this.style.removeProperty(t)}}function P(t,e,n){return function(){this.style.setProperty(t,e,n)}}function j(t,e,n){return function(){var r=e.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function D(t,e){return t.style.getPropertyValue(e)||C(t).getComputedStyle(t,null).getPropertyValue(e)}function z(t){return function(){delete this[t]}}function T(t,e){return function(){this[t]=e}}function $(t,e){return function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}}function B(t){return t.trim().split(/^|\s+/)}function F(t){return t.classList||new R(t)}function R(t){this._node=t,this._names=B(t.getAttribute("class")||"")}function X(t,e){for(var n=F(t),r=-1,i=e.length;++r=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var ht=[null];function dt(t,e){this._groups=t,this._parents=e}function pt(){return new dt([[document.documentElement]],ht)}dt.prototype=pt.prototype={constructor:dt,select:function(t){"function"!=typeof t&&(t=o(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i=A&&(A=S+1);!(M=x[A])&&++A=0;)(r=i[o])&&(a&&4^r.compareDocumentPosition(a)&&a.parentNode.insertBefore(r,a),a=r);return this},sort:function(t){function e(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}t||(t=w);for(var n=this._groups,r=n.length,i=new Array(r),o=0;o1?this.each((null==e?I:"function"==typeof e?j:P)(t,e,null==n?"":n)):D(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?z:"function"==typeof e?$:T)(t,e)):this.node()[t]},classed:function(t,e){var n=B(t+"");if(arguments.length<2){for(var r=F(this.node()),i=-1,o=n.length;++i=0&&(e=t.slice(n+1),t=t.slice(0,n)),{type:t,name:e}}))}(t+""),a=o.length;if(!(arguments.length<2)){for(s=e?ut:st,r=0;r{}};function vt(){for(var t,e=0,n=arguments.length,r={};e=0&&(e=t.slice(n+1),t=t.slice(0,n)),t&&!r.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}}))),a=-1,s=o.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++a0)for(var n,r,i=new Array(n),o=0;o=0&&e._call.call(void 0,t),e=e._next;--St}()}finally{St=0,function(){for(var t,e,n=_t,r=1/0;n;)n._call?(r>n._time&&(r=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:_t=e);Mt=t,Ft(r)}(),Et=0}}function Bt(){var t=It.now(),e=t-qt;e>Nt&&(Ct-=e,qt=t)}function Ft(t){St||(At&&(At=clearTimeout(At)),t-Et>24?(t<1/0&&(At=setTimeout($t,t-It.now()-Ct)),kt&&(kt=clearInterval(kt))):(kt||(qt=It.now(),kt=setInterval(Bt,Nt)),St=1,Pt($t)))}function Rt(t,e,n){var r=new zt;return e=null==e?0:+e,r.restart((n=>{r.stop(),t(n+e)}),e,n),r}zt.prototype=Tt.prototype={constructor:zt,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?jt():+n)+(null==e?0:+e),this._next||Mt===this||(Mt?Mt._next=this:_t=this,Mt=this),this._call=t,this._time=n,Ft()},stop:function(){this._call&&(this._call=null,this._time=1/0,Ft())}};var Xt=xt("start","end","cancel","interrupt"),Lt=[],Ot=0,Ht=3;function Yt(t,e,n,r,i,o){var a=t.__transition;if(a){if(n in a)return}else t.__transition={};!function(t,e,n){var r,i=t.__transition;function o(u){var l,f,c,h;if(1!==n.state)return s();for(l in i)if((h=i[l]).name===n.name){if(h.state===Ht)return Rt(o);4===h.state?(h.state=6,h.timer.stop(),h.on.call("interrupt",t,t.__data__,h.index,h.group),delete i[l]):+lOt)throw new Error("too late; already scheduled");return n}function Ut(t,e){var n=Vt(t,e);if(n.state>Ht)throw new Error("too late; already running");return n}function Vt(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function Gt(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}var Kt,Jt=180/Math.PI,Qt={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Zt(t,e,n,r,i,o){var a,s,u;return(a=Math.sqrt(t*t+e*e))&&(t/=a,e/=a),(u=t*n+e*r)&&(n-=t*u,r-=e*u),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,u/=s),t*r180?e+=360:e-t>180&&(t+=360),o.push({i:n.push(i(n)+"rotate(",null,r)-2,x:Gt(t,e)})):e&&n.push(i(n)+"rotate("+e+r)}(o.rotate,a.rotate,s,u),function(t,e,n,o){t!==e?o.push({i:n.push(i(n)+"skewX(",null,r)-2,x:Gt(t,e)}):e&&n.push(i(n)+"skewX("+e+r)}(o.skewX,a.skewX,s,u),function(t,e,n,r,o,a){if(t!==n||e!==r){var s=o.push(i(o)+"scale(",null,",",null,")");a.push({i:s-4,x:Gt(t,n)},{i:s-2,x:Gt(e,r)})}else 1===n&&1===r||o.push(i(o)+"scale("+n+","+r+")")}(o.scaleX,o.scaleY,a.scaleX,a.scaleY,s,u),o=a=null,function(t){for(var e,n=-1,r=u.length;++n>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?ke(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?ke(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=ge.exec(t))?new qe(e[1],e[2],e[3],1):(e=me.exec(t))?new qe(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=ve.exec(t))?ke(e[1],e[2],e[3],e[4]):(e=be.exec(t))?ke(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=ye.exec(t))?De(e[1],e[2]/100,e[3]/100,1):(e=we.exec(t))?De(e[1],e[2]/100,e[3]/100,e[4]):xe.hasOwnProperty(t)?Ae(xe[t]):"transparent"===t?new qe(NaN,NaN,NaN,0):null}function Ae(t){return new qe(t>>16&255,t>>8&255,255&t,1)}function ke(t,e,n,r){return r<=0&&(t=e=n=NaN),new qe(t,e,n,r)}function Ne(t,e,n,r){return 1===arguments.length?((i=t)instanceof ue||(i=Se(i)),i?new qe((i=i.rgb()).r,i.g,i.b,i.opacity):new qe):new qe(t,e,n,null==r?1:r);var i}function qe(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function Ee(){return`#${je(this.r)}${je(this.g)}${je(this.b)}`}function Ce(){const t=Ie(this.opacity);return`${1===t?"rgb(":"rgba("}${Pe(this.r)}, ${Pe(this.g)}, ${Pe(this.b)}${1===t?")":`, ${t})`}`}function Ie(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Pe(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function je(t){return((t=Pe(t))<16?"0":"")+t.toString(16)}function De(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Te(t,e,n,r)}function ze(t){if(t instanceof Te)return new Te(t.h,t.s,t.l,t.opacity);if(t instanceof ue||(t=Se(t)),!t)return new Te;if(t instanceof Te)return t;var e=(t=t.rgb()).r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),o=Math.max(e,n,r),a=NaN,s=o-i,u=(o+i)/2;return s?(a=e===o?(n-r)/s+6*(n0&&u<1?0:a,new Te(a,s,u,t.opacity)}function Te(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function $e(t){return(t=(t||0)%360)<0?t+360:t}function Be(t){return Math.max(0,Math.min(1,t||0))}function Fe(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}function Re(t,e,n,r,i){var o=t*t,a=o*t;return((1-3*t+3*o-a)*e+(4-6*o+3*a)*n+(1+3*t+3*o-3*a)*r+a*i)/6}ae(ue,Se,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:_e,formatHex:_e,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return ze(this).formatHsl()},formatRgb:Me,toString:Me}),ae(qe,Ne,se(ue,{brighter(t){return t=null==t?fe:Math.pow(fe,t),new qe(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?le:Math.pow(le,t),new qe(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new qe(Pe(this.r),Pe(this.g),Pe(this.b),Ie(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Ee,formatHex:Ee,formatHex8:function(){return`#${je(this.r)}${je(this.g)}${je(this.b)}${je(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:Ce,toString:Ce})),ae(Te,(function(t,e,n,r){return 1===arguments.length?ze(t):new Te(t,e,n,null==r?1:r)}),se(ue,{brighter(t){return t=null==t?fe:Math.pow(fe,t),new Te(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?le:Math.pow(le,t),new Te(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new qe(Fe(t>=240?t-240:t+120,i,r),Fe(t,i,r),Fe(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new Te($e(this.h),Be(this.s),Be(this.l),Ie(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=Ie(this.opacity);return`${1===t?"hsl(":"hsla("}${$e(this.h)}, ${100*Be(this.s)}%, ${100*Be(this.l)}%${1===t?")":`, ${t})`}`}}));const Xe=t=>()=>t;function Le(t,e){var n=e-t;return n?function(t,e){return function(n){return t+n*e}}(t,n):Xe(isNaN(t)?e:t)}const Oe=function t(e){var n=function(t){return 1==(t=+t)?Le:function(e,n){return n-e?function(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}(e,n,t):Xe(isNaN(e)?n:e)}}(e);function r(t,e){var r=n((t=Ne(t)).r,(e=Ne(e)).r),i=n(t.g,e.g),o=n(t.b,e.b),a=Le(t.opacity,e.opacity);return function(e){return t.r=r(e),t.g=i(e),t.b=o(e),t.opacity=a(e),t+""}}return r.gamma=t,r}(1);function He(t){return function(e){var n,r,i=e.length,o=new Array(i),a=new Array(i),s=new Array(i);for(n=0;n=1?(n=1,e-1):Math.floor(n*e),i=t[r],o=t[r+1],a=r>0?t[r-1]:2*i-o,s=ro&&(i=e.slice(o,i),s[a]?s[a]+=i:s[++a]=i),(n=n[0])===(r=r[0])?s[a]?s[a]+=r:s[++a]=r:(s[++a]=null,u.push({i:a,x:Gt(n,r)})),o=We.lastIndex;return o=0&&(t=t.slice(0,e)),!t||"start"===t}))}(e)?Wt:Ut;return function(){var a=o(this,t),s=a.on;s!==r&&(i=(r=s).copy()).on(e,n),a.on=i}}(n,t,e))},attr:function(t,e){var n=M(t),r="transform"===n?ne:Ve;return this.attrTween(t,"function"==typeof e?(n.local?tn:Ze)(n,r,oe(this,"attr."+t,e)):null==e?(n.local?Ke:Ge)(n):(n.local?Qe:Je)(n,r,e))},attrTween:function(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==e)return this.tween(n,null);if("function"!=typeof e)throw new Error;var r=M(t);return this.tween(n,(r.local?en:nn)(r,e))},style:function(t,e,n){var r="transform"==(t+="")?ee:Ve;return null==e?this.styleTween(t,function(t,e){var n,r,i;return function(){var o=D(this,t),a=(this.style.removeProperty(t),D(this,t));return o===a?null:o===n&&a===r?i:i=e(n=o,r=a)}}(t,r)).on("end.style."+t,ln(t)):"function"==typeof e?this.styleTween(t,function(t,e,n){var r,i,o;return function(){var a=D(this,t),s=n(this),u=s+"";return null==s&&(this.style.removeProperty(t),u=s=D(this,t)),a===u?null:a===r&&u===i?o:(i=u,o=e(r=a,s))}}(t,r,oe(this,"style."+t,e))).each(function(t,e){var n,r,i,o,a="style."+e,s="end."+a;return function(){var u=Ut(this,t),l=u.on,f=null==u.value[a]?o||(o=ln(e)):void 0;l===n&&i===f||(r=(n=l).copy()).on(s,i=f),u.on=r}}(this._id,t)):this.styleTween(t,function(t,e,n){var r,i,o=n+"";return function(){var a=D(this,t);return a===o?null:a===r?i:i=e(r=a,n)}}(t,r,e),n).on("end.style."+t,null)},styleTween:function(t,e,n){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==e)return this.tween(r,null);if("function"!=typeof e)throw new Error;return this.tween(r,function(t,e,n){var r,i;function o(){var o=e.apply(this,arguments);return o!==i&&(r=(i=o)&&function(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}(t,o,n)),r}return o._value=e,o}(t,e,null==n?"":n))},text:function(t){return this.tween("text","function"==typeof t?function(t){return function(){var e=t(this);this.textContent=null==e?"":e}}(oe(this,"text",t)):function(t){return function(){this.textContent=t}}(null==t?"":t+""))},textTween:function(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(null==t)return this.tween(e,null);if("function"!=typeof t)throw new Error;return this.tween(e,function(t){var e,n;function r(){var r=t.apply(this,arguments);return r!==n&&(e=(n=r)&&function(t){return function(e){this.textContent=t.call(this,e)}}(r)),e}return r._value=t,r}(t))},remove:function(){return this.on("end.remove",function(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}(this._id))},tween:function(t,e){var n=this._id;if(t+="",arguments.length<2){for(var r,i=Vt(this.node(),n).tween,o=0,a=i.length;o2&&n.state<5,n.state=6,n.timer.stop(),n.on.call(r?"interrupt":"cancel",t,t.__data__,n.index,n.group),delete o[i]):a=!1;a&&delete t.__transition}}(this,t)}))},gt.prototype.transition=function(t){var e,n;t instanceof cn?(e=t._id,t=t._name):(e=hn(),(n=pn).time=jt(),t=null==t?null:t+"");for(var r=this._groups,i=r.length,o=0;o()=>t;function Nn(t,{sourceEvent:e,subject:n,target:r,identifier:i,active:o,x:a,y:s,dx:u,dy:l,dispatch:f}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:o,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:u,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:f}})}function qn(t){return!t.ctrlKey&&!t.button}function En(){return this.parentNode}function Cn(t,e){return null==e?{x:t.x,y:t.y}:e}function In(){return navigator.maxTouchPoints||"ontouchstart"in this}Nn.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};var Pn=Math.sqrt(50),jn=Math.sqrt(10),Dn=Math.sqrt(2);function zn(t,e,n){var r=(e-t)/Math.max(0,n),i=Math.floor(Math.log(r)/Math.LN10),o=r/Math.pow(10,i);return i>=0?(o>=Pn?10:o>=jn?5:o>=Dn?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(o>=Pn?10:o>=jn?5:o>=Dn?2:1)}function Tn(t,e){return null==t||null==e?NaN:te?1:t>=e?0:NaN}function $n(t,e){return null==t||null==e?NaN:et?1:e>=t?0:NaN}function Bn(t){let e,n,r;function i(t,r,i=0,o=t.length){if(i>>1;n(t[e],r)<0?i=e+1:o=e}while(iTn(t(e),n),r=(e,n)=>t(e)-n):(e=t===Tn||t===$n?t:Fn,n=t,r=t),{left:i,center:function(t,e,n=0,o=t.length){const a=i(t,e,n,o-1);return a>n&&r(t[a-1],e)>-r(t[a],e)?a-1:a},right:function(t,r,i=0,o=t.length){if(i>>1;n(t[e],r)<=0?i=e+1:o=e}while(i=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function ir(t){if(!(e=rr.exec(t)))throw new Error("invalid format: "+t);var e;return new or({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}function or(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}function ar(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,r=t.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+t.slice(n+1)]}function sr(t){return(t=ar(Math.abs(t)))?t[1]:NaN}function ur(t,e){var n=ar(t,e);if(!n)return t+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}ir.prototype=or.prototype,or.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};const lr={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>ur(100*t,e),r:ur,s:function(t,e){var n=ar(t,e);if(!n)return t+"";var r=n[0],i=n[1],o=i-(nr=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,a=r.length;return o===a?r:o>a?r+new Array(o-a+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+ar(t,Math.max(0,e+o-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function fr(t){return t}var cr,hr,dr,pr=Array.prototype.map,gr=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function mr(t){var e=t.domain;return t.ticks=function(t){var n=e();return function(t,e,n){var r,i,o,a,s=-1;if(n=+n,(t=+t)==(e=+e)&&n>0)return[t];if((r=e0){let n=Math.round(t/a),r=Math.round(e/a);for(n*ae&&--r,o=new Array(i=r-n+1);++se&&--r,o=new Array(i=r-n+1);++s=Pn?i*=10:o>=jn?i*=5:o>=Dn&&(i*=2),e0;){if((i=zn(u,l,n))===r)return o[a]=u,o[s]=l,e(o);if(i>0)u=Math.floor(u/i)*i,l=Math.ceil(l/i)*i;else{if(!(i<0))break;u=Math.ceil(u*i)/i,l=Math.floor(l*i)/i}r=i}return t},t}function vr(){var t=function(){var t,e,n,r,i,o,a=Kn,s=Kn,u=Un,l=Jn;function f(){var t,e,n,u=Math.min(a.length,s.length);return l!==Jn&&(t=a[0],e=a[u-1],t>e&&(n=t,t=e,e=n),l=function(n){return Math.max(t,Math.min(e,n))}),r=u>2?tr:Zn,i=o=null,c}function c(e){return null==e||isNaN(e=+e)?n:(i||(i=r(a.map(t),s,u)))(t(l(e)))}return c.invert=function(n){return l(e((o||(o=r(s,a.map(t),Gt)))(n)))},c.domain=function(t){return arguments.length?(a=Array.from(t,Gn),f()):a.slice()},c.range=function(t){return arguments.length?(s=Array.from(t),f()):s.slice()},c.rangeRound=function(t){return s=Array.from(t),u=Vn,f()},c.clamp=function(t){return arguments.length?(l=!!t||Jn,f()):l!==Jn},c.interpolate=function(t){return arguments.length?(u=t,f()):u},c.unknown=function(t){return arguments.length?(n=t,c):n},function(n,r){return t=n,e=r,f()}}()(Jn,Jn);return t.copy=function(){return e=t,vr().domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown());var e},er.apply(t,arguments),mr(t)}function br(t){for(var e=t.length/6|0,n=new Array(e),r=0;r0&&s>0&&(u+s+1>r&&(s=Math.max(1,r-u)),o.push(t.substring(i-=s,i+s)),!((u+=s+1)>r));)s=e[a=(a+1)%e.length];return o.reverse().join(n)}),i=void 0===t.currency?"":t.currency[0]+"",o=void 0===t.currency?"":t.currency[1]+"",a=void 0===t.decimal?".":t.decimal+"",s=void 0===t.numerals?fr:function(t){return function(e){return e.replace(/[0-9]/g,(function(e){return t[+e]}))}}(pr.call(t.numerals,String)),u=void 0===t.percent?"%":t.percent+"",l=void 0===t.minus?"−":t.minus+"",f=void 0===t.nan?"NaN":t.nan+"";function c(t){var e=(t=ir(t)).fill,n=t.align,c=t.sign,h=t.symbol,d=t.zero,p=t.width,g=t.comma,m=t.precision,v=t.trim,b=t.type;"n"===b?(g=!0,b="g"):lr[b]||(void 0===m&&(m=12),v=!0,b="g"),(d||"0"===e&&"="===n)&&(d=!0,e="0",n="=");var y="$"===h?i:"#"===h&&/[boxX]/.test(b)?"0"+b.toLowerCase():"",w="$"===h?o:/[%p]/.test(b)?u:"",x=lr[b],_=/[defgprs%]/.test(b);function M(t){var i,o,u,h=y,M=w;if("c"===b)M=x(t)+M,t="";else{var S=(t=+t)<0||1/t<0;if(t=isNaN(t)?f:x(Math.abs(t),m),v&&(t=function(t){t:for(var e,n=t.length,r=1,i=-1;r0&&(i=0)}return i>0?t.slice(0,i)+t.slice(e+1):t}(t)),S&&0==+t&&"+"!==c&&(S=!1),h=(S?"("===c?c:l:"-"===c||"("===c?"":c)+h,M=("s"===b?gr[8+nr/3]:"")+M+(S&&"("===c?")":""),_)for(i=-1,o=t.length;++i(u=t.charCodeAt(i))||u>57){M=(46===u?a+t.slice(i+1):t.slice(i))+M,t=t.slice(0,i);break}}g&&!d&&(t=r(t,1/0));var A=h.length+t.length+M.length,k=A>1)+h+t+M+k.slice(A);break;default:t=k+h+t+M}return s(t)}return m=void 0===m?6:/[gprs]/.test(b)?Math.max(1,Math.min(21,m)):Math.max(0,Math.min(20,m)),M.toString=function(){return t+""},M}return{format:c,formatPrefix:function(t,e){var n=c(((t=ir(t)).type="f",t)),r=3*Math.max(-8,Math.min(8,Math.floor(sr(e)/3))),i=Math.pow(10,-r),o=gr[8+r/3];return function(t){return n(i*t)+o}}}}({thousands:",",grouping:[3],currency:["$",""]}),hr=cr.format,dr=cr.formatPrefix;const wr=yr(br("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725"));function xr(t,e,n){this.k=t,this.x=e,this.y=n}function _r(t){return Math.floor(Math.random()*t)}function Mr(t,e,...n){let r=Array(t);for(let i=0;it.map((t=>t*e))))}function jr(t,e){for(let n=0;nXr(t,e,-1,.05,.01),local:(t,e)=>Xr(t,e,0,.01,.5),pca:(t,e)=>Xr(t,e,1,0,.5),outlier:(t,e)=>Xr(t,e,2,0,5),push:(t,e)=>Lr(t,e,.5,.01,.5),pull:(t,e)=>Lr(t,e,.5,.01,-.2)};const{normal:Hr}=t;let Yr='~\n
~\n ~\n\n
~\n ~\n
~\n
~\n
~\n \n
\n \n
\n \n
\n \n \n \n \n \n \n \n
Brush size
Zoom
Damping
Heat
Label strength
Guide strength
\n
~\n
~\n\n
~\n ~\n \n ~\n \n ~\n \n
~\n Guide\n ~ \n
~\n \n
~\n \n
~\n \n
~\n
~\n
~\n'.replace(/~\s+/g,"");class Wr extends EventTarget{constructor(t,e,n){super(),this.width=1,this.height=1,this.size=1,this.fullscreen=!1,this.originalWidth=1,this.originalHeight=1,this.center=[],this.scale=[],this.X=[[],[]],this.n=0,this.m=0,this.colnames=[],this.permutor=[],this.unpermutor=[],this.rownames=[],this.group=[],this.pointSize=[],this.levels=[],this.levelColors=[],this.lineFrom=[],this.lineTo=[],this.lineColors=[],this.fills=[],this.filter=null,this.selection=null,this.selectionChanged=!1,this.axes=[],this.labelData=[],this.proj=[[],[]],this.vel=[[],[]],this.zoom=1,this.xScaleUnit=vr(),this.yScaleUnit=vr(),this.xScale=vr(),this.yScale=vr(),this.xScaleClamped=vr(),this.yScaleClamped=vr(),this.haveData=!1,this.playing=!0,this.frameScheduled=!1,this.lastTime=0,this.mouseInCheckbox=!1,this.dragging=!1,this.fps=[],this.computeMessage="",this.mousing=!1,this.mouseDown=!1,this.mouseWentDown=!1,this.mouseShiftKey=!1,this.mouseX=0,this.mouseY=0,this.rightMouseDown=!1,this.rightMouseWentDown=!1,this.tugging=!1,this.tugX=0,this.tugY=0,this.tugPoints=[],this.xy=[[],[]],this.fillsFrame=[],this.pointActive=[],this.container=t,this.shadowDiv=document.createElement("div"),this.container.appendChild(this.shadowDiv),this.shadowRoot=this.shadowDiv.attachShadow({mode:"open"}),this.shadowRoot.innerHTML=Yr,this.shadowChild=this.shadowRoot.firstChild,this.canvas=this.get("canvas"),this.overlay=this.get("overlay"),this.container.langevitour=this,this.resize(e,n);let r=this.get("plotDiv");r.addEventListener("mouseover",(t=>{this.mousing=!0,this.scheduleFrameIfNeeded()})),r.addEventListener("mouseout",(t=>{this.mousing=!1,this.mouseDown=!1,this.rightMouseDown=!1,this.scheduleFrameIfNeeded()}));let i=t=>([this.mouseX,this.mouseY]=Br(t,this.canvas),t.target.classList.contains("overlay")?(this.mouseDown=1==t.buttons&&!t.ctrlKey,this.rightMouseDown=2==t.buttons||1==t.buttons&&t.ctrlKey,this.scheduleFrameIfNeeded(),!0):(this.mouseDown=!1,this.rightMouseDown=!1,!1));r.addEventListener("mousemove",(t=>{i(t)})),r.addEventListener("mousedown",(t=>{if(!i(t))return;let e=this.get("infoBox");"visible"!=e.style.visibility?(this.mouseDown&&(this.mouseWentDown=!0,this.mouseShiftKey=t.shiftKey),this.rightMouseDown&&(this.rightMouseWentDown=!0),this.scheduleFrameIfNeeded()):e.style.visibility="hidden"})),r.addEventListener("mouseup",(t=>{this.mouseDown=!1,this.rightMouseDown=!1,this.scheduleFrameIfNeeded()})),null==this.container.requestFullscreen&&(this.get("fullscreenButton").style.display="none"),this.get("fullscreenButton").addEventListener("click",(()=>{document.fullscreenElement?document.fullscreenElement===this.shadowDiv&&document.exitFullscreen&&document.exitFullscreen():this.shadowDiv.requestFullscreen()}));let o=()=>{if(!this.fullscreen)return;let t=this.shadowDiv,e=window.innerWidth,n=window.innerHeight,r=Math.max(0,e-n)/2;t.style.paddingLeft=r+"px",this.width=e-r,this.height=n,this.configure()};this.shadowDiv.addEventListener("fullscreenchange",(()=>{let t=this.shadowDiv;document.fullscreenElement===t?(this.fullscreen||(this.fullscreen=!0,this.originalWidth=this.width,this.originalHeight=this.height,window.addEventListener("resize",o)),o()):this.fullscreen&&(this.fullscreen=!1,t.style.paddingLeft="0px",this.width=this.originalWidth,this.height=this.originalHeight,window.removeEventListener("resize",o),this.configure())})),this.get("infoButton").addEventListener("click",(()=>{let t=this.get("infoBox");"visible"!=t.style.visibility&&this.haveData?(t.style.visibility="visible",this.get("infoBoxProj").style.display="none",this.get("infoBoxState").style.display="none",this.get("infoBoxInfo").innerHTML=`

${this.X.length.toLocaleString("en-US")} points.

`):t.style.visibility="hidden"})),this.get("infoBoxProjButton").addEventListener("click",(()=>{let t=this.getInput("infoBoxProj");if(Fr(t),"none"!=t.style.display){let t="projection <- cbind(\n c(";t+=this.proj.map((t=>t.map(((t,e)=>(t/this.scale[e]).toFixed(Math.ceil(Math.log10(Math.max(0,this.scale[e]))+4)))).join(","))).join("),\n c("),t+="))\nprojected <- as.matrix(X) %*% projection",this.getInput("infoBoxProj").value=t}})),this.get("infoBoxStateButton").addEventListener("click",(()=>{let t=this.getInput("infoBoxState");Fr(t),"none"!=t.style.display&&(t.value=JSON.stringify(this.getState(),null,4))})),this.get("playButton").addEventListener("click",(()=>this.setState({playing:!this.playing})))}get(t){return this.shadowChild.getElementsByClassName(t)[0]}getInput(t){return this.get(t)}getString(t){return this.getInput(t).value}getNumber(t){return Number(this.getInput(t).value)}getChecked(t){return this.getInput(t).checked}emitChangeFilter(){setTimeout((()=>this.dispatchEvent(new Event("changeFilter"))),0)}emitChangeSelectionIfNeeded(){this.selectionChanged&&(this.selectionChanged=!1,setTimeout((()=>this.dispatchEvent(new Event("changeSelection"))),0))}renderValue(t){if(!t)return this.haveData=!1,void this.configure();this.haveData=!0,this.n=t.X.length,this.m=t.X[0].length;let e=t.axisColors||[];this.center=t.center||Array(this.m).fill(0),this.scale=t.scale||Array(this.m).fill(1),this.permutor=function(t){let e=Array(t).fill(0).map(((t,e)=>e));for(let t=e.length-1;t>0;t--){const n=_r(t+1);[e[t],e[n]]=[e[n],e[t]]}return e}(this.n),this.unpermutor=Array(this.n);for(let t=0;tt.X[e])),this.X=this.X.map((t=>t.map(((t,e)=>(t-this.center[e])/this.scale[e])))),null==t.pointSize)this.pointSize=Array(this.n).fill(1);else if("number"==typeof t.pointSize)this.pointSize=Array(this.n).fill(t.pointSize);else{let e=t.pointSize;this.pointSize=this.permutor.map((t=>e[t]))}if(t.rownames&&0!=t.rownames.length){let e=t.rownames;this.rownames=this.permutor.map((t=>e[t]))}else this.rownames=[];if(this.colnames=t.colnames,this.lineFrom=(t.lineFrom||[]).map((t=>this.unpermutor[t])),this.lineTo=(t.lineTo||[]).map((t=>this.unpermutor[t])),this.lineColors=t.lineColors||[],this.lineFrom.length&&!this.lineColors.length&&(this.lineColors=this.lineFrom.map((()=>"#00000088"))),this.axes=[],t.extraAxes&&t.extraAxesNames)for(let n=0;nt[n])),i=Nr(r,this.center),o=r.map(((t,e)=>t*this.scale[e])),a=Math.sqrt(Nr(o,o)),s=qr(o,1/a);this.axes.push({name:t.extraAxesNames[n],unit:s,scale:a,center:i,color:e[n+this.m],proj:[]})}for(let n=0;nNr(e,this.axes[t].unit)));this.levels=t.levels,this.group=this.permutor.map((e=>t.group[e]));let n=this.levels.length;this.levelColors=(t.levelColors||[]).slice();for(let t=this.levelColors.length;t1)for(let t=0;t\n \n \n':'\n \n',!this.haveData){this.get("messageArea").innerText="",this.overlay.style.opacity="0";let t=this.canvas.getContext("2d");return t.scale(1,1),void t.clearRect(0,0,this.canvas.width,this.canvas.height)}this.configureScales();let e=wn(this.overlay);e.selectAll("*").remove(),this.mouseInCheckbox=!1;let n=this,r=e.selectAll("div").data(this.labelData).join((t=>{let e=t.append("div").classed("labelDiv",!0);return e.append("input").attr("type","checkbox").property("checked",(t=>t.active)).on("change",(function(t,e){e.active=this.checked,n.scheduleFrameIfNeeded(),n.emitChangeFilter()})).on("mouseover",(()=>{this.mouseInCheckbox=!0})).on("mouseout",(()=>{this.mouseInCheckbox=!1})),e.append("span"),e}));function i(){let t=n.xScaleUnit.invert(n.width);for(let e of n.labelData)e.x=Math.max(-1,Math.min(t,e.x)),e.y=Math.max(-1,Math.min(1,e.y));r.style("left",(t=>n.xScaleUnit(t.x)-t.halfWidth+"px")).style("top",(t=>n.yScaleUnit(t.y)-t.halfHeight+"px")).style("background",(t=>t.selected?"#aaa":"#ddd"))}r.style("cursor","grab").on("mouseover",((t,e)=>{e.selected+=1,i()})).on("mouseout",((t,e)=>{e.selected=Math.max(0,e.selected-1),i()})),r.select("span").text((t=>t.label)).style("color",(t=>t.color)),r.each((function(t){t.halfWidth=this.offsetWidth/2,t.halfHeight=this.offsetHeight/2})),function(){var t,e,n,r,i=qn,o=En,a=Cn,s=In,u={},l=xt("start","drag","end"),f=0,c=0;function h(t){t.on("mousedown.drag",d).filter(s).on("touchstart.drag",m).on("touchmove.drag",v,_n).on("touchend.drag touchcancel.drag",b).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function d(a,s){if(!r&&i.call(this,a,s)){var u=y(this,o.call(this,a,s),a,s,"mouse");u&&(wn(a.view).on("mousemove.drag",p,Mn).on("mouseup.drag",g,Mn),function(t){var e=t.document.documentElement,n=wn(t).on("dragstart.drag",An,Mn);"onselectstart"in e?n.on("selectstart.drag",An,Mn):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}(a.view),Sn(a),n=!1,t=a.clientX,e=a.clientY,u("start",a))}}function p(r){if(An(r),!n){var i=r.clientX-t,o=r.clientY-e;n=i*i+o*o>c}u.mouse("drag",r)}function g(t){wn(t.view).on("mousemove.drag mouseup.drag",null),function(t,e){var n=t.document.documentElement,r=wn(t).on("dragstart.drag",null);e&&(r.on("click.drag",An,Mn),setTimeout((function(){r.on("click.drag",null)}),0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}(t.view,n),An(t),u.mouse("end",t)}function m(t,e){if(i.call(this,t,e)){var n,r,a=t.changedTouches,s=o.call(this,t,e),u=a.length;for(n=0;nthis.selection[t])):t.selection=null,this.filter?t.filter=this.unpermutor.map((t=>this.filter[t])):t.filter=null,t}setState(t){let e=!1,n=!1;if("string"==typeof t&&(t=JSON.parse(t)),t){if($r(t,"playing")&&(!this.playing&&t.playing&&(this.lastTime=0),this.playing=t.playing),$r(t,"axesOn")&&(this.getInput("axesCheckbox").checked=t.axesOn),$r(t,"heatOn")&&(this.getInput("heatCheckbox").checked=t.heatOn),$r(t,"pointRepulsionType")&&(this.getInput("guideSelect").value=t.pointRepulsionType),$r(t,"guideType")&&(this.getInput("guideSelect").value=t.guideType),$r(t,"labelAttractionOn")&&(this.getInput("labelCheckbox").checked=t.labelAttractionOn),$r(t,"damping")&&(this.getInput("dampInput").value=t.damping),$r(t,"heat")&&(this.getInput("heatInput").value=t.heat),$r(t,"pointRepulsion")&&(this.getInput("guideInput").value=t.pointRepulsion),$r(t,"guide")&&(this.getInput("guideInput").value=t.guide),$r(t,"labelAttraction")&&(this.getInput("labelInput").value=t.labelAttraction),$r(t,"zoom")&&(this.getInput("zoomInput").value=t.zoom),$r(t,"brush")&&(this.getInput("brushInput").value=t.brush),$r(t,"labelInactive")){for(let e of this.labelData)e.active=!t.labelInactive.includes(e.label);e=!0}if($r(t,"labelPos"))for(let e of this.labelData)$r(t.labelPos,e.label)?(e.x=t.labelPos[e.label][0],e.y=t.labelPos[e.label][1]):e.x=1;$r(t,"projection")&&(this.proj=Array.from(t.projection.map((t=>Array.from(t))))),$r(t,"selection")&&(null===t.selection?this.selection=null:this.selection=this.permutor.map((e=>t.selection[e])),this.selectionChanged=!0,n=!0),$r(t,"filter")&&(null===t.filter?this.filter=null:this.filter=this.permutor.map((e=>t.filter[e]))),this.configure(),e&&this.emitChangeFilter(),n&&this.emitChangeSelectionIfNeeded()}}scheduleFrameIfNeeded(){!this.frameScheduled&&this.haveData&&(window.requestAnimationFrame(this.doFrame.bind(this)),this.frameScheduled=!0)}doFrame(t){if(this.frameScheduled=!1,!this.haveData)return;if(!function(t){let e=t;for(;;){let t=window.getComputedStyle(e);if("0"===t.opacity||"none"===t.display||"visible"!==t.visibility)return!1;if(!e.parentElement)break;e=e.parentElement}let n=t.getBoundingClientRect();return n.top=0&&n.left=0}(this.container))return this.lastTime=0,void window.setTimeout(this.scheduleFrameIfNeeded.bind(this),100);t/=1e3;let e=0;(this.playing||this.tugging)&&0!=this.lastTime&&(e=t-this.lastTime,this.fps.push(Math.round(1/e)),this.fps.length>100&&this.fps.shift()),this.lastTime=t,this.compute(e),this.configureScales();let n=null,r=null,i=this.labelData.filter((t=>t.selected));i.length&&("axis"==i[0].type?n=i[0].index:r=i[0].index);let o=this.getChecked("axesCheckbox"),a=Array(this.levels.length).fill(!0);for(let t of this.labelData)"level"==t.type&&(a[t.index]=t.active);let s=.05*this.size*Math.pow(10,this.getNumber("brushInput")),u=[];if(this.mouseXMath.pow(s,2)||u.push({index:t,d2:e})}u.sort(((t,e)=>t.d2-e.d2))}if(this.rightMouseWentDown&&(this.tugPoints=u.map((t=>t.index)),this.rightMouseWentDown=!1),this.tugging=this.rightMouseDown&&this.tugPoints.length>0,this.tugging&&(this.tugX=this.xScale.invert(this.mouseX),this.tugY=this.yScale.invert(this.mouseY)),this.mouseDown||this.mouseWentDown){if(this.mouseWentDown&&!this.mouseShiftKey&&(this.selection=null,this.selectionChanged=!0),u.length){this.selection||(this.selection=Array(this.n).fill(!1),this.selectionChanged=!0);for(let t=0;t=0;t--){let e=u[t].index,n=this.xScaleClamped(this.xy[0][e]),r=this.yScaleClamped(this.xy[1][e]);f.strokeText(this.rownames[e],n,r),f.fillText(this.rownames[e],n,r)}}if(f.restore(),f.textAlign="left",f.textBaseline="middle",f.font="15px sans-serif",!this.mousing)for(let t=0,e=0;t=1&&(o/=d,l/=d),c[0]=qr(e,(o-n)/i*t),c[1]=qr(e,(l-r)/i*t),a=!1,u=!1,s="none"}if(a){let t=1-d*d,e=Mr(h.length,Mr,this.m,Hr.sample,0,Math.sqrt(r*t));e=Tr(e,h),Dr(c,e)}if("none"!=s){let t=this.X.filter(((t,e)=>this.pointActive[e]));if(t.length){let e=Or[s](h,t);jr(e,-i),Dr(c,e)}}if(u)for(let t of this.labelData){let e=t.x,n=t.y;if(e<=-1||n<=-1||e>=1||n>=1)continue;if("level"==t.type&&!l[t.index])continue;let r=4*(e*e+n*n);c[0]=kr(c[0],qr(t.vec,e*r*o)),c[1]=kr(c[1],qr(t.vec,n*r*o))}let p=[];for(let t of this.labelData)"axis"!=t.type||t.active||p.push(this.axes[t.index].unit);let g=p.length>=this.m-1,m=!1;if(p.length&&!g){let t=Math.min(2,1/f),{u:n,v:r,q:i}=(0,e.SVD)(zr(p)),o=Math.max(...i);n=zr(n);let a=Er(2,this.m);for(let e=0;e m ? n : m;\n return Math.pow(10,\n 17 - ~~(Math.log(((val > 0) ? val : -val)) * Math.LOG10E));\n}\n\n\nvar isArray = Array.isArray || function isArray(arg) {\n return toString.call(arg) === '[object Array]';\n};\n\n\nfunction isFunction(arg) {\n return toString.call(arg) === '[object Function]';\n}\n\n\nfunction isNumber(num) {\n return (typeof num === 'number') ? num - num === 0 : false;\n}\n\n\n// Converts the jStat matrix to vector.\nfunction toVector(arr) {\n return concat.apply([], arr);\n}\n\n\n// The one and only jStat constructor.\nfunction jStat() {\n return new jStat._init(arguments);\n}\n\n\n// TODO: Remove after all references in src files have been removed.\njStat.fn = jStat.prototype;\n\n\n// By separating the initializer from the constructor it's easier to handle\n// always returning a new instance whether \"new\" was used or not.\njStat._init = function _init(args) {\n // If first argument is an array, must be vector or matrix.\n if (isArray(args[0])) {\n // Check if matrix.\n if (isArray(args[0][0])) {\n // See if a mapping function was also passed.\n if (isFunction(args[1]))\n args[0] = jStat.map(args[0], args[1]);\n // Iterate over each is faster than this.push.apply(this, args[0].\n for (var i = 0; i < args[0].length; i++)\n this[i] = args[0][i];\n this.length = args[0].length;\n\n // Otherwise must be a vector.\n } else {\n this[0] = isFunction(args[1]) ? jStat.map(args[0], args[1]) : args[0];\n this.length = 1;\n }\n\n // If first argument is number, assume creation of sequence.\n } else if (isNumber(args[0])) {\n this[0] = jStat.seq.apply(null, args);\n this.length = 1;\n\n // Handle case when jStat object is passed to jStat.\n } else if (args[0] instanceof jStat) {\n // Duplicate the object and pass it back.\n return jStat(args[0].toArray());\n\n // Unexpected argument value, return empty jStat object.\n // TODO: This is strange behavior. Shouldn't this throw or some such to let\n // the user know they had bad arguments?\n } else {\n this[0] = [];\n this.length = 1;\n }\n\n return this;\n};\njStat._init.prototype = jStat.prototype;\njStat._init.constructor = jStat;\n\n\n// Utility functions.\n// TODO: for internal use only?\njStat.utils = {\n calcRdx: calcRdx,\n isArray: isArray,\n isFunction: isFunction,\n isNumber: isNumber,\n toVector: toVector\n};\n\n\njStat._random_fn = Math.random;\njStat.setRandom = function setRandom(fn) {\n if (typeof fn !== 'function')\n throw new TypeError('fn is not a function');\n jStat._random_fn = fn;\n};\n\n\n// Easily extend the jStat object.\n// TODO: is this seriously necessary?\njStat.extend = function extend(obj) {\n var i, j;\n\n if (arguments.length === 1) {\n for (j in obj)\n jStat[j] = obj[j];\n return this;\n }\n\n for (i = 1; i < arguments.length; i++) {\n for (j in arguments[i])\n obj[j] = arguments[i][j];\n }\n\n return obj;\n};\n\n\n// Returns the number of rows in the matrix.\njStat.rows = function rows(arr) {\n return arr.length || 1;\n};\n\n\n// Returns the number of columns in the matrix.\njStat.cols = function cols(arr) {\n return arr[0].length || 1;\n};\n\n\n// Returns the dimensions of the object { rows: i, cols: j }\njStat.dimensions = function dimensions(arr) {\n return {\n rows: jStat.rows(arr),\n cols: jStat.cols(arr)\n };\n};\n\n\n// Returns a specified row as a vector or return a sub matrix by pick some rows\njStat.row = function row(arr, index) {\n if (isArray(index)) {\n return index.map(function(i) {\n return jStat.row(arr, i);\n })\n }\n return arr[index];\n};\n\n\n// return row as array\n// rowa([[1,2],[3,4]],0) -> [1,2]\njStat.rowa = function rowa(arr, i) {\n return jStat.row(arr, i);\n};\n\n\n// Returns the specified column as a vector or return a sub matrix by pick some\n// columns\njStat.col = function col(arr, index) {\n if (isArray(index)) {\n var submat = jStat.arange(arr.length).map(function() {\n return new Array(index.length);\n });\n index.forEach(function(ind, i){\n jStat.arange(arr.length).forEach(function(j) {\n submat[j][i] = arr[j][ind];\n });\n });\n return submat;\n }\n var column = new Array(arr.length);\n for (var i = 0; i < arr.length; i++)\n column[i] = [arr[i][index]];\n return column;\n};\n\n\n// return column as array\n// cola([[1,2],[3,4]],0) -> [1,3]\njStat.cola = function cola(arr, i) {\n return jStat.col(arr, i).map(function(a){ return a[0] });\n};\n\n\n// Returns the diagonal of the matrix\njStat.diag = function diag(arr) {\n var nrow = jStat.rows(arr);\n var res = new Array(nrow);\n for (var row = 0; row < nrow; row++)\n res[row] = [arr[row][row]];\n return res;\n};\n\n\n// Returns the anti-diagonal of the matrix\njStat.antidiag = function antidiag(arr) {\n var nrow = jStat.rows(arr) - 1;\n var res = new Array(nrow);\n for (var i = 0; nrow >= 0; nrow--, i++)\n res[i] = [arr[i][nrow]];\n return res;\n};\n\n// Transpose a matrix or array.\njStat.transpose = function transpose(arr) {\n var obj = [];\n var objArr, rows, cols, j, i;\n\n // Make sure arr is in matrix format.\n if (!isArray(arr[0]))\n arr = [arr];\n\n rows = arr.length;\n cols = arr[0].length;\n\n for (i = 0; i < cols; i++) {\n objArr = new Array(rows);\n for (j = 0; j < rows; j++)\n objArr[j] = arr[j][i];\n obj.push(objArr);\n }\n\n // If obj is vector, return only single array.\n return obj.length === 1 ? obj[0] : obj;\n};\n\n\n// Map a function to an array or array of arrays.\n// \"toAlter\" is an internal variable.\njStat.map = function map(arr, func, toAlter) {\n var row, nrow, ncol, res, col;\n\n if (!isArray(arr[0]))\n arr = [arr];\n\n nrow = arr.length;\n ncol = arr[0].length;\n res = toAlter ? arr : new Array(nrow);\n\n for (row = 0; row < nrow; row++) {\n // if the row doesn't exist, create it\n if (!res[row])\n res[row] = new Array(ncol);\n for (col = 0; col < ncol; col++)\n res[row][col] = func(arr[row][col], row, col);\n }\n\n return res.length === 1 ? res[0] : res;\n};\n\n\n// Cumulatively combine the elements of an array or array of arrays using a function.\njStat.cumreduce = function cumreduce(arr, func, toAlter) {\n var row, nrow, ncol, res, col;\n\n if (!isArray(arr[0]))\n arr = [arr];\n\n nrow = arr.length;\n ncol = arr[0].length;\n res = toAlter ? arr : new Array(nrow);\n\n for (row = 0; row < nrow; row++) {\n // if the row doesn't exist, create it\n if (!res[row])\n res[row] = new Array(ncol);\n if (ncol > 0)\n res[row][0] = arr[row][0];\n for (col = 1; col < ncol; col++)\n res[row][col] = func(res[row][col-1], arr[row][col]);\n }\n return res.length === 1 ? res[0] : res;\n};\n\n\n// Destructively alter an array.\njStat.alter = function alter(arr, func) {\n return jStat.map(arr, func, true);\n};\n\n\n// Generate a rows x cols matrix according to the supplied function.\njStat.create = function create(rows, cols, func) {\n var res = new Array(rows);\n var i, j;\n\n if (isFunction(cols)) {\n func = cols;\n cols = rows;\n }\n\n for (i = 0; i < rows; i++) {\n res[i] = new Array(cols);\n for (j = 0; j < cols; j++)\n res[i][j] = func(i, j);\n }\n\n return res;\n};\n\n\nfunction retZero() { return 0; }\n\n\n// Generate a rows x cols matrix of zeros.\njStat.zeros = function zeros(rows, cols) {\n if (!isNumber(cols))\n cols = rows;\n return jStat.create(rows, cols, retZero);\n};\n\n\nfunction retOne() { return 1; }\n\n\n// Generate a rows x cols matrix of ones.\njStat.ones = function ones(rows, cols) {\n if (!isNumber(cols))\n cols = rows;\n return jStat.create(rows, cols, retOne);\n};\n\n\n// Generate a rows x cols matrix of uniformly random numbers.\njStat.rand = function rand(rows, cols) {\n if (!isNumber(cols))\n cols = rows;\n return jStat.create(rows, cols, jStat._random_fn);\n};\n\n\nfunction retIdent(i, j) { return i === j ? 1 : 0; }\n\n\n// Generate an identity matrix of size row x cols.\njStat.identity = function identity(rows, cols) {\n if (!isNumber(cols))\n cols = rows;\n return jStat.create(rows, cols, retIdent);\n};\n\n\n// Tests whether a matrix is symmetric\njStat.symmetric = function symmetric(arr) {\n var size = arr.length;\n var row, col;\n\n if (arr.length !== arr[0].length)\n return false;\n\n for (row = 0; row < size; row++) {\n for (col = 0; col < size; col++)\n if (arr[col][row] !== arr[row][col])\n return false;\n }\n\n return true;\n};\n\n\n// Set all values to zero.\njStat.clear = function clear(arr) {\n return jStat.alter(arr, retZero);\n};\n\n\n// Generate sequence.\njStat.seq = function seq(min, max, length, func) {\n if (!isFunction(func))\n func = false;\n\n var arr = [];\n var hival = calcRdx(min, max);\n var step = (max * hival - min * hival) / ((length - 1) * hival);\n var current = min;\n var cnt;\n\n // Current is assigned using a technique to compensate for IEEE error.\n // TODO: Needs better implementation.\n for (cnt = 0;\n current <= max && cnt < length;\n cnt++, current = (min * hival + step * hival * cnt) / hival) {\n arr.push((func ? func(current, cnt) : current));\n }\n\n return arr;\n};\n\n\n// arange(5) -> [0,1,2,3,4]\n// arange(1,5) -> [1,2,3,4]\n// arange(5,1,-1) -> [5,4,3,2]\njStat.arange = function arange(start, end, step) {\n var rl = [];\n var i;\n step = step || 1;\n if (end === undefined) {\n end = start;\n start = 0;\n }\n if (start === end || step === 0) {\n return [];\n }\n if (start < end && step < 0) {\n return [];\n }\n if (start > end && step > 0) {\n return [];\n }\n if (step > 0) {\n for (i = start; i < end; i += step) {\n rl.push(i);\n }\n } else {\n for (i = start; i > end; i += step) {\n rl.push(i);\n }\n }\n return rl;\n};\n\n\n// A=[[1,2,3],[4,5,6],[7,8,9]]\n// slice(A,{row:{end:2},col:{start:1}}) -> [[2,3],[5,6]]\n// slice(A,1,{start:1}) -> [5,6]\n// as numpy code A[:2,1:]\njStat.slice = (function(){\n function _slice(list, start, end, step) {\n // note it's not equal to range.map mode it's a bug\n var i;\n var rl = [];\n var length = list.length;\n if (start === undefined && end === undefined && step === undefined) {\n return jStat.copy(list);\n }\n\n start = start || 0;\n end = end || list.length;\n start = start >= 0 ? start : length + start;\n end = end >= 0 ? end : length + end;\n step = step || 1;\n if (start === end || step === 0) {\n return [];\n }\n if (start < end && step < 0) {\n return [];\n }\n if (start > end && step > 0) {\n return [];\n }\n if (step > 0) {\n for (i = start; i < end; i += step) {\n rl.push(list[i]);\n }\n } else {\n for (i = start; i > end;i += step) {\n rl.push(list[i]);\n }\n }\n return rl;\n }\n\n function slice(list, rcSlice) {\n var colSlice, rowSlice;\n rcSlice = rcSlice || {};\n if (isNumber(rcSlice.row)) {\n if (isNumber(rcSlice.col))\n return list[rcSlice.row][rcSlice.col];\n var row = jStat.rowa(list, rcSlice.row);\n colSlice = rcSlice.col || {};\n return _slice(row, colSlice.start, colSlice.end, colSlice.step);\n }\n\n if (isNumber(rcSlice.col)) {\n var col = jStat.cola(list, rcSlice.col);\n rowSlice = rcSlice.row || {};\n return _slice(col, rowSlice.start, rowSlice.end, rowSlice.step);\n }\n\n rowSlice = rcSlice.row || {};\n colSlice = rcSlice.col || {};\n var rows = _slice(list, rowSlice.start, rowSlice.end, rowSlice.step);\n return rows.map(function(row) {\n return _slice(row, colSlice.start, colSlice.end, colSlice.step);\n });\n }\n\n return slice;\n}());\n\n\n// A=[[1,2,3],[4,5,6],[7,8,9]]\n// sliceAssign(A,{row:{start:1},col:{start:1}},[[0,0],[0,0]])\n// A=[[1,2,3],[4,0,0],[7,0,0]]\njStat.sliceAssign = function sliceAssign(A, rcSlice, B) {\n var nl, ml;\n if (isNumber(rcSlice.row)) {\n if (isNumber(rcSlice.col))\n return A[rcSlice.row][rcSlice.col] = B;\n rcSlice.col = rcSlice.col || {};\n rcSlice.col.start = rcSlice.col.start || 0;\n rcSlice.col.end = rcSlice.col.end || A[0].length;\n rcSlice.col.step = rcSlice.col.step || 1;\n nl = jStat.arange(rcSlice.col.start,\n Math.min(A.length, rcSlice.col.end),\n rcSlice.col.step);\n var m = rcSlice.row;\n nl.forEach(function(n, i) {\n A[m][n] = B[i];\n });\n return A;\n }\n\n if (isNumber(rcSlice.col)) {\n rcSlice.row = rcSlice.row || {};\n rcSlice.row.start = rcSlice.row.start || 0;\n rcSlice.row.end = rcSlice.row.end || A.length;\n rcSlice.row.step = rcSlice.row.step || 1;\n ml = jStat.arange(rcSlice.row.start,\n Math.min(A[0].length, rcSlice.row.end),\n rcSlice.row.step);\n var n = rcSlice.col;\n ml.forEach(function(m, j) {\n A[m][n] = B[j];\n });\n return A;\n }\n\n if (B[0].length === undefined) {\n B = [B];\n }\n rcSlice.row.start = rcSlice.row.start || 0;\n rcSlice.row.end = rcSlice.row.end || A.length;\n rcSlice.row.step = rcSlice.row.step || 1;\n rcSlice.col.start = rcSlice.col.start || 0;\n rcSlice.col.end = rcSlice.col.end || A[0].length;\n rcSlice.col.step = rcSlice.col.step || 1;\n ml = jStat.arange(rcSlice.row.start,\n Math.min(A.length, rcSlice.row.end),\n rcSlice.row.step);\n nl = jStat.arange(rcSlice.col.start,\n Math.min(A[0].length, rcSlice.col.end),\n rcSlice.col.step);\n ml.forEach(function(m, i) {\n nl.forEach(function(n, j) {\n A[m][n] = B[i][j];\n });\n });\n return A;\n};\n\n\n// [1,2,3] ->\n// [[1,0,0],[0,2,0],[0,0,3]]\njStat.diagonal = function diagonal(diagArray) {\n var mat = jStat.zeros(diagArray.length, diagArray.length);\n diagArray.forEach(function(t, i) {\n mat[i][i] = t;\n });\n return mat;\n};\n\n\n// return copy of A\njStat.copy = function copy(A) {\n return A.map(function(row) {\n if (isNumber(row))\n return row;\n return row.map(function(t) {\n return t;\n });\n });\n};\n\n\n// TODO: Go over this entire implementation. Seems a tragic waste of resources\n// doing all this work. Instead, and while ugly, use new Function() to generate\n// a custom function for each static method.\n\n// Quick reference.\nvar jProto = jStat.prototype;\n\n// Default length.\njProto.length = 0;\n\n// For internal use only.\n// TODO: Check if they're actually used, and if they are then rename them\n// to _*\njProto.push = Array.prototype.push;\njProto.sort = Array.prototype.sort;\njProto.splice = Array.prototype.splice;\njProto.slice = Array.prototype.slice;\n\n\n// Return a clean array.\njProto.toArray = function toArray() {\n return this.length > 1 ? slice.call(this) : slice.call(this)[0];\n};\n\n\n// Map a function to a matrix or vector.\njProto.map = function map(func, toAlter) {\n return jStat(jStat.map(this, func, toAlter));\n};\n\n\n// Cumulatively combine the elements of a matrix or vector using a function.\njProto.cumreduce = function cumreduce(func, toAlter) {\n return jStat(jStat.cumreduce(this, func, toAlter));\n};\n\n\n// Destructively alter an array.\njProto.alter = function alter(func) {\n jStat.alter(this, func);\n return this;\n};\n\n\n// Extend prototype with methods that have no argument.\n(function(funcs) {\n for (var i = 0; i < funcs.length; i++) (function(passfunc) {\n jProto[passfunc] = function(func) {\n var self = this,\n results;\n // Check for callback.\n if (func) {\n setTimeout(function() {\n func.call(self, jProto[passfunc].call(self));\n });\n return this;\n }\n results = jStat[passfunc](this);\n return isArray(results) ? jStat(results) : results;\n };\n })(funcs[i]);\n})('transpose clear symmetric rows cols dimensions diag antidiag'.split(' '));\n\n\n// Extend prototype with methods that have one argument.\n(function(funcs) {\n for (var i = 0; i < funcs.length; i++) (function(passfunc) {\n jProto[passfunc] = function(index, func) {\n var self = this;\n // check for callback\n if (func) {\n setTimeout(function() {\n func.call(self, jProto[passfunc].call(self, index));\n });\n return this;\n }\n return jStat(jStat[passfunc](this, index));\n };\n })(funcs[i]);\n})('row col'.split(' '));\n\n\n// Extend prototype with simple shortcut methods.\n(function(funcs) {\n for (var i = 0; i < funcs.length; i++) (function(passfunc) {\n jProto[passfunc] = function() {\n return jStat(jStat[passfunc].apply(null, arguments));\n };\n })(funcs[i]);\n})('create zeros ones rand identity'.split(' '));\n\n\n// Exposing jStat.\nreturn jStat;\n\n}(Math));\n(function(jStat, Math) {\n\nvar isFunction = jStat.utils.isFunction;\n\n// Ascending functions for sort\nfunction ascNum(a, b) { return a - b; }\n\nfunction clip(arg, min, max) {\n return Math.max(min, Math.min(arg, max));\n}\n\n\n// sum of an array\njStat.sum = function sum(arr) {\n var sum = 0;\n var i = arr.length;\n while (--i >= 0)\n sum += arr[i];\n return sum;\n};\n\n\n// sum squared\njStat.sumsqrd = function sumsqrd(arr) {\n var sum = 0;\n var i = arr.length;\n while (--i >= 0)\n sum += arr[i] * arr[i];\n return sum;\n};\n\n\n// sum of squared errors of prediction (SSE)\njStat.sumsqerr = function sumsqerr(arr) {\n var mean = jStat.mean(arr);\n var sum = 0;\n var i = arr.length;\n var tmp;\n while (--i >= 0) {\n tmp = arr[i] - mean;\n sum += tmp * tmp;\n }\n return sum;\n};\n\n// sum of an array in each row\njStat.sumrow = function sumrow(arr) {\n var sum = 0;\n var i = arr.length;\n while (--i >= 0)\n sum += arr[i];\n return sum;\n};\n\n// product of an array\njStat.product = function product(arr) {\n var prod = 1;\n var i = arr.length;\n while (--i >= 0)\n prod *= arr[i];\n return prod;\n};\n\n\n// minimum value of an array\njStat.min = function min(arr) {\n var low = arr[0];\n var i = 0;\n while (++i < arr.length)\n if (arr[i] < low)\n low = arr[i];\n return low;\n};\n\n\n// maximum value of an array\njStat.max = function max(arr) {\n var high = arr[0];\n var i = 0;\n while (++i < arr.length)\n if (arr[i] > high)\n high = arr[i];\n return high;\n};\n\n\n// unique values of an array\njStat.unique = function unique(arr) {\n var hash = {}, _arr = [];\n for(var i = 0; i < arr.length; i++) {\n if (!hash[arr[i]]) {\n hash[arr[i]] = true;\n _arr.push(arr[i]);\n }\n }\n return _arr;\n};\n\n\n// mean value of an array\njStat.mean = function mean(arr) {\n return jStat.sum(arr) / arr.length;\n};\n\n\n// mean squared error (MSE)\njStat.meansqerr = function meansqerr(arr) {\n return jStat.sumsqerr(arr) / arr.length;\n};\n\n\n// geometric mean of an array\njStat.geomean = function geomean(arr) {\n return Math.pow(jStat.product(arr), 1 / arr.length);\n};\n\n\n// median of an array\njStat.median = function median(arr) {\n var arrlen = arr.length;\n var _arr = arr.slice().sort(ascNum);\n // check if array is even or odd, then return the appropriate\n return !(arrlen & 1)\n ? (_arr[(arrlen / 2) - 1 ] + _arr[(arrlen / 2)]) / 2\n : _arr[(arrlen / 2) | 0 ];\n};\n\n\n// cumulative sum of an array\njStat.cumsum = function cumsum(arr) {\n return jStat.cumreduce(arr, function (a, b) { return a + b; });\n};\n\n\n// cumulative product of an array\njStat.cumprod = function cumprod(arr) {\n return jStat.cumreduce(arr, function (a, b) { return a * b; });\n};\n\n\n// successive differences of a sequence\njStat.diff = function diff(arr) {\n var diffs = [];\n var arrLen = arr.length;\n var i;\n for (i = 1; i < arrLen; i++)\n diffs.push(arr[i] - arr[i - 1]);\n return diffs;\n};\n\n\n// ranks of an array\njStat.rank = function (arr) {\n var i;\n var distinctNumbers = [];\n var numberCounts = {};\n for (i = 0; i < arr.length; i++) {\n var number = arr[i];\n if (numberCounts[number]) {\n numberCounts[number]++;\n } else {\n numberCounts[number] = 1;\n distinctNumbers.push(number);\n }\n }\n\n var sortedDistinctNumbers = distinctNumbers.sort(ascNum);\n var numberRanks = {};\n var currentRank = 1;\n for (i = 0; i < sortedDistinctNumbers.length; i++) {\n var number = sortedDistinctNumbers[i];\n var count = numberCounts[number];\n var first = currentRank;\n var last = currentRank + count - 1;\n var rank = (first + last) / 2;\n numberRanks[number] = rank;\n currentRank += count;\n }\n\n return arr.map(function (number) {\n return numberRanks[number];\n });\n};\n\n\n// mode of an array\n// if there are multiple modes of an array, return all of them\n// is this the appropriate way of handling it?\njStat.mode = function mode(arr) {\n var arrLen = arr.length;\n var _arr = arr.slice().sort(ascNum);\n var count = 1;\n var maxCount = 0;\n var numMaxCount = 0;\n var mode_arr = [];\n var i;\n\n for (i = 0; i < arrLen; i++) {\n if (_arr[i] === _arr[i + 1]) {\n count++;\n } else {\n if (count > maxCount) {\n mode_arr = [_arr[i]];\n maxCount = count;\n numMaxCount = 0;\n }\n // are there multiple max counts\n else if (count === maxCount) {\n mode_arr.push(_arr[i]);\n numMaxCount++;\n }\n // resetting count for new value in array\n count = 1;\n }\n }\n\n return numMaxCount === 0 ? mode_arr[0] : mode_arr;\n};\n\n\n// range of an array\njStat.range = function range(arr) {\n return jStat.max(arr) - jStat.min(arr);\n};\n\n// variance of an array\n// flag = true indicates sample instead of population\njStat.variance = function variance(arr, flag) {\n return jStat.sumsqerr(arr) / (arr.length - (flag ? 1 : 0));\n};\n\n// pooled variance of an array of arrays\njStat.pooledvariance = function pooledvariance(arr) {\n var sumsqerr = arr.reduce(function (a, samples) {return a + jStat.sumsqerr(samples);}, 0);\n var count = arr.reduce(function (a, samples) {return a + samples.length;}, 0);\n return sumsqerr / (count - arr.length);\n};\n\n// deviation of an array\njStat.deviation = function (arr) {\n var mean = jStat.mean(arr);\n var arrlen = arr.length;\n var dev = new Array(arrlen);\n for (var i = 0; i < arrlen; i++) {\n dev[i] = arr[i] - mean;\n }\n return dev;\n};\n\n// standard deviation of an array\n// flag = true indicates sample instead of population\njStat.stdev = function stdev(arr, flag) {\n return Math.sqrt(jStat.variance(arr, flag));\n};\n\n// pooled standard deviation of an array of arrays\njStat.pooledstdev = function pooledstdev(arr) {\n return Math.sqrt(jStat.pooledvariance(arr));\n};\n\n// mean deviation (mean absolute deviation) of an array\njStat.meandev = function meandev(arr) {\n var mean = jStat.mean(arr);\n var a = [];\n for (var i = arr.length - 1; i >= 0; i--) {\n a.push(Math.abs(arr[i] - mean));\n }\n return jStat.mean(a);\n};\n\n\n// median deviation (median absolute deviation) of an array\njStat.meddev = function meddev(arr) {\n var median = jStat.median(arr);\n var a = [];\n for (var i = arr.length - 1; i >= 0; i--) {\n a.push(Math.abs(arr[i] - median));\n }\n return jStat.median(a);\n};\n\n\n// coefficient of variation\njStat.coeffvar = function coeffvar(arr) {\n return jStat.stdev(arr) / jStat.mean(arr);\n};\n\n\n// quartiles of an array\njStat.quartiles = function quartiles(arr) {\n var arrlen = arr.length;\n var _arr = arr.slice().sort(ascNum);\n return [\n _arr[ Math.round((arrlen) / 4) - 1 ],\n _arr[ Math.round((arrlen) / 2) - 1 ],\n _arr[ Math.round((arrlen) * 3 / 4) - 1 ]\n ];\n};\n\n\n// Arbitary quantiles of an array. Direct port of the scipy.stats\n// implementation by Pierre GF Gerard-Marchant.\njStat.quantiles = function quantiles(arr, quantilesArray, alphap, betap) {\n var sortedArray = arr.slice().sort(ascNum);\n var quantileVals = [quantilesArray.length];\n var n = arr.length;\n var i, p, m, aleph, k, gamma;\n\n if (typeof alphap === 'undefined')\n alphap = 3 / 8;\n if (typeof betap === 'undefined')\n betap = 3 / 8;\n\n for (i = 0; i < quantilesArray.length; i++) {\n p = quantilesArray[i];\n m = alphap + p * (1 - alphap - betap);\n aleph = n * p + m;\n k = Math.floor(clip(aleph, 1, n - 1));\n gamma = clip(aleph - k, 0, 1);\n quantileVals[i] = (1 - gamma) * sortedArray[k - 1] + gamma * sortedArray[k];\n }\n\n return quantileVals;\n};\n\n// Return the k-th percentile of values in a range, where k is in the range 0..1, inclusive.\n// Passing true for the exclusive parameter excludes both endpoints of the range.\njStat.percentile = function percentile(arr, k, exclusive) {\n var _arr = arr.slice().sort(ascNum);\n var realIndex = k * (_arr.length + (exclusive ? 1 : -1)) + (exclusive ? 0 : 1);\n var index = parseInt(realIndex);\n var frac = realIndex - index;\n if (index + 1 < _arr.length) {\n return _arr[index - 1] + frac * (_arr[index] - _arr[index - 1]);\n } else {\n return _arr[index - 1];\n }\n}\n\n// The percentile rank of score in a given array. Returns the percentage\n// of all values in the input array that are less than (kind='strict') or\n// less or equal than (kind='weak') score. Default is weak.\njStat.percentileOfScore = function percentileOfScore(arr, score, kind) {\n var counter = 0;\n var len = arr.length;\n var strict = false;\n var value, i;\n\n if (kind === 'strict')\n strict = true;\n\n for (i = 0; i < len; i++) {\n value = arr[i];\n if ((strict && value < score) ||\n (!strict && value <= score)) {\n counter++;\n }\n }\n\n return counter / len;\n};\n\n\n// Histogram (bin count) data\njStat.histogram = function histogram(arr, binCnt) {\n binCnt = binCnt || 4;\n var first = jStat.min(arr);\n var binWidth = (jStat.max(arr) - first) / binCnt;\n var len = arr.length;\n var bins = [];\n var i;\n\n for (i = 0; i < binCnt; i++)\n bins[i] = 0;\n for (i = 0; i < len; i++)\n bins[Math.min(Math.floor(((arr[i] - first) / binWidth)), binCnt - 1)] += 1;\n\n return bins;\n};\n\n\n// covariance of two arrays\njStat.covariance = function covariance(arr1, arr2) {\n var u = jStat.mean(arr1);\n var v = jStat.mean(arr2);\n var arr1Len = arr1.length;\n var sq_dev = new Array(arr1Len);\n var i;\n\n for (i = 0; i < arr1Len; i++)\n sq_dev[i] = (arr1[i] - u) * (arr2[i] - v);\n\n return jStat.sum(sq_dev) / (arr1Len - 1);\n};\n\n\n// (pearson's) population correlation coefficient, rho\njStat.corrcoeff = function corrcoeff(arr1, arr2) {\n return jStat.covariance(arr1, arr2) /\n jStat.stdev(arr1, 1) /\n jStat.stdev(arr2, 1);\n};\n\n // (spearman's) rank correlation coefficient, sp\njStat.spearmancoeff = function (arr1, arr2) {\n arr1 = jStat.rank(arr1);\n arr2 = jStat.rank(arr2);\n //return pearson's correlation of the ranks:\n return jStat.corrcoeff(arr1, arr2);\n}\n\n\n// statistical standardized moments (general form of skew/kurt)\njStat.stanMoment = function stanMoment(arr, n) {\n var mu = jStat.mean(arr);\n var sigma = jStat.stdev(arr);\n var len = arr.length;\n var skewSum = 0;\n\n for (var i = 0; i < len; i++)\n skewSum += Math.pow((arr[i] - mu) / sigma, n);\n\n return skewSum / arr.length;\n};\n\n// (pearson's) moment coefficient of skewness\njStat.skewness = function skewness(arr) {\n return jStat.stanMoment(arr, 3);\n};\n\n// (pearson's) (excess) kurtosis\njStat.kurtosis = function kurtosis(arr) {\n return jStat.stanMoment(arr, 4) - 3;\n};\n\n\nvar jProto = jStat.prototype;\n\n\n// Extend jProto with method for calculating cumulative sums and products.\n// This differs from the similar extension below as cumsum and cumprod should\n// not be run again in the case fullbool === true.\n// If a matrix is passed, automatically assume operation should be done on the\n// columns.\n(function(funcs) {\n for (var i = 0; i < funcs.length; i++) (function(passfunc) {\n // If a matrix is passed, automatically assume operation should be done on\n // the columns.\n jProto[passfunc] = function(fullbool, func) {\n var arr = [];\n var i = 0;\n var tmpthis = this;\n // Assignment reassignation depending on how parameters were passed in.\n if (isFunction(fullbool)) {\n func = fullbool;\n fullbool = false;\n }\n // Check if a callback was passed with the function.\n if (func) {\n setTimeout(function() {\n func.call(tmpthis, jProto[passfunc].call(tmpthis, fullbool));\n });\n return this;\n }\n // Check if matrix and run calculations.\n if (this.length > 1) {\n tmpthis = fullbool === true ? this : this.transpose();\n for (; i < tmpthis.length; i++)\n arr[i] = jStat[passfunc](tmpthis[i]);\n return arr;\n }\n // Pass fullbool if only vector, not a matrix. for variance and stdev.\n return jStat[passfunc](this[0], fullbool);\n };\n })(funcs[i]);\n})(('cumsum cumprod').split(' '));\n\n\n// Extend jProto with methods which don't require arguments and work on columns.\n(function(funcs) {\n for (var i = 0; i < funcs.length; i++) (function(passfunc) {\n // If a matrix is passed, automatically assume operation should be done on\n // the columns.\n jProto[passfunc] = function(fullbool, func) {\n var arr = [];\n var i = 0;\n var tmpthis = this;\n // Assignment reassignation depending on how parameters were passed in.\n if (isFunction(fullbool)) {\n func = fullbool;\n fullbool = false;\n }\n // Check if a callback was passed with the function.\n if (func) {\n setTimeout(function() {\n func.call(tmpthis, jProto[passfunc].call(tmpthis, fullbool));\n });\n return this;\n }\n // Check if matrix and run calculations.\n if (this.length > 1) {\n if (passfunc !== 'sumrow')\n tmpthis = fullbool === true ? this : this.transpose();\n for (; i < tmpthis.length; i++)\n arr[i] = jStat[passfunc](tmpthis[i]);\n return fullbool === true\n ? jStat[passfunc](jStat.utils.toVector(arr))\n : arr;\n }\n // Pass fullbool if only vector, not a matrix. for variance and stdev.\n return jStat[passfunc](this[0], fullbool);\n };\n })(funcs[i]);\n})(('sum sumsqrd sumsqerr sumrow product min max unique mean meansqerr ' +\n 'geomean median diff rank mode range variance deviation stdev meandev ' +\n 'meddev coeffvar quartiles histogram skewness kurtosis').split(' '));\n\n\n// Extend jProto with functions that take arguments. Operations on matrices are\n// done on columns.\n(function(funcs) {\n for (var i = 0; i < funcs.length; i++) (function(passfunc) {\n jProto[passfunc] = function() {\n var arr = [];\n var i = 0;\n var tmpthis = this;\n var args = Array.prototype.slice.call(arguments);\n var callbackFunction;\n\n // If the last argument is a function, we assume it's a callback; we\n // strip the callback out and call the function again.\n if (isFunction(args[args.length - 1])) {\n callbackFunction = args[args.length - 1];\n var argsToPass = args.slice(0, args.length - 1);\n\n setTimeout(function() {\n callbackFunction.call(tmpthis,\n jProto[passfunc].apply(tmpthis, argsToPass));\n });\n return this;\n\n // Otherwise we curry the function args and call normally.\n } else {\n callbackFunction = undefined;\n var curriedFunction = function curriedFunction(vector) {\n return jStat[passfunc].apply(tmpthis, [vector].concat(args));\n }\n }\n\n // If this is a matrix, run column-by-column.\n if (this.length > 1) {\n tmpthis = tmpthis.transpose();\n for (; i < tmpthis.length; i++)\n arr[i] = curriedFunction(tmpthis[i]);\n return arr;\n }\n\n // Otherwise run on the vector.\n return curriedFunction(this[0]);\n };\n })(funcs[i]);\n})('quantiles percentileOfScore'.split(' '));\n\n}(jStat, Math));\n// Special functions //\n(function(jStat, Math) {\n\n// Log-gamma function\njStat.gammaln = function gammaln(x) {\n var j = 0;\n var cof = [\n 76.18009172947146, -86.50532032941677, 24.01409824083091,\n -1.231739572450155, 0.1208650973866179e-2, -0.5395239384953e-5\n ];\n var ser = 1.000000000190015;\n var xx, y, tmp;\n tmp = (y = xx = x) + 5.5;\n tmp -= (xx + 0.5) * Math.log(tmp);\n for (; j < 6; j++)\n ser += cof[j] / ++y;\n return Math.log(2.5066282746310005 * ser / xx) - tmp;\n};\n\n/*\n * log-gamma function to support poisson distribution sampling. The\n * algorithm comes from SPECFUN by Shanjie Zhang and Jianming Jin and their\n * book \"Computation of Special Functions\", 1996, John Wiley & Sons, Inc.\n */\njStat.loggam = function loggam(x) {\n var x0, x2, xp, gl, gl0;\n var k, n;\n\n var a = [8.333333333333333e-02, -2.777777777777778e-03,\n 7.936507936507937e-04, -5.952380952380952e-04,\n 8.417508417508418e-04, -1.917526917526918e-03,\n 6.410256410256410e-03, -2.955065359477124e-02,\n 1.796443723688307e-01, -1.39243221690590e+00];\n x0 = x;\n n = 0;\n if ((x == 1.0) || (x == 2.0)) {\n return 0.0;\n }\n if (x <= 7.0) {\n n = Math.floor(7 - x);\n x0 = x + n;\n }\n x2 = 1.0 / (x0 * x0);\n xp = 2 * Math.PI;\n gl0 = a[9];\n for (k = 8; k >= 0; k--) {\n gl0 *= x2;\n gl0 += a[k];\n }\n gl = gl0 / x0 + 0.5 * Math.log(xp) + (x0 - 0.5) * Math.log(x0) - x0;\n if (x <= 7.0) {\n for (k = 1; k <= n; k++) {\n gl -= Math.log(x0 - 1.0);\n x0 -= 1.0;\n }\n }\n return gl;\n}\n\n// gamma of x\njStat.gammafn = function gammafn(x) {\n var p = [-1.716185138865495, 24.76565080557592, -379.80425647094563,\n 629.3311553128184, 866.9662027904133, -31451.272968848367,\n -36144.413418691176, 66456.14382024054\n ];\n var q = [-30.8402300119739, 315.35062697960416, -1015.1563674902192,\n -3107.771671572311, 22538.118420980151, 4755.8462775278811,\n -134659.9598649693, -115132.2596755535];\n var fact = false;\n var n = 0;\n var xden = 0;\n var xnum = 0;\n var y = x;\n var i, z, yi, res;\n if (x > 171.6243769536076) {\n return Infinity;\n }\n if (y <= 0) {\n res = y % 1 + 3.6e-16;\n if (res) {\n fact = (!(y & 1) ? 1 : -1) * Math.PI / Math.sin(Math.PI * res);\n y = 1 - y;\n } else {\n return Infinity;\n }\n }\n yi = y;\n if (y < 1) {\n z = y++;\n } else {\n z = (y -= n = (y | 0) - 1) - 1;\n }\n for (i = 0; i < 8; ++i) {\n xnum = (xnum + p[i]) * z;\n xden = xden * z + q[i];\n }\n res = xnum / xden + 1;\n if (yi < y) {\n res /= yi;\n } else if (yi > y) {\n for (i = 0; i < n; ++i) {\n res *= y;\n y++;\n }\n }\n if (fact) {\n res = fact / res;\n }\n return res;\n};\n\n\n// lower incomplete gamma function, which is usually typeset with a\n// lower-case greek gamma as the function symbol\njStat.gammap = function gammap(a, x) {\n return jStat.lowRegGamma(a, x) * jStat.gammafn(a);\n};\n\n\n// The lower regularized incomplete gamma function, usually written P(a,x)\njStat.lowRegGamma = function lowRegGamma(a, x) {\n var aln = jStat.gammaln(a);\n var ap = a;\n var sum = 1 / a;\n var del = sum;\n var b = x + 1 - a;\n var c = 1 / 1.0e-30;\n var d = 1 / b;\n var h = d;\n var i = 1;\n // calculate maximum number of itterations required for a\n var ITMAX = -~(Math.log((a >= 1) ? a : 1 / a) * 8.5 + a * 0.4 + 17);\n var an;\n\n if (x < 0 || a <= 0) {\n return NaN;\n } else if (x < a + 1) {\n for (; i <= ITMAX; i++) {\n sum += del *= x / ++ap;\n }\n return (sum * Math.exp(-x + a * Math.log(x) - (aln)));\n }\n\n for (; i <= ITMAX; i++) {\n an = -i * (i - a);\n b += 2;\n d = an * d + b;\n c = b + an / c;\n d = 1 / d;\n h *= d * c;\n }\n\n return (1 - h * Math.exp(-x + a * Math.log(x) - (aln)));\n};\n\n// natural log factorial of n\njStat.factorialln = function factorialln(n) {\n return n < 0 ? NaN : jStat.gammaln(n + 1);\n};\n\n// factorial of n\njStat.factorial = function factorial(n) {\n return n < 0 ? NaN : jStat.gammafn(n + 1);\n};\n\n// combinations of n, m\njStat.combination = function combination(n, m) {\n // make sure n or m don't exceed the upper limit of usable values\n return (n > 170 || m > 170)\n ? Math.exp(jStat.combinationln(n, m))\n : (jStat.factorial(n) / jStat.factorial(m)) / jStat.factorial(n - m);\n};\n\n\njStat.combinationln = function combinationln(n, m){\n return jStat.factorialln(n) - jStat.factorialln(m) - jStat.factorialln(n - m);\n};\n\n\n// permutations of n, m\njStat.permutation = function permutation(n, m) {\n return jStat.factorial(n) / jStat.factorial(n - m);\n};\n\n\n// beta function\njStat.betafn = function betafn(x, y) {\n // ensure arguments are positive\n if (x <= 0 || y <= 0)\n return undefined;\n // make sure x + y doesn't exceed the upper limit of usable values\n return (x + y > 170)\n ? Math.exp(jStat.betaln(x, y))\n : jStat.gammafn(x) * jStat.gammafn(y) / jStat.gammafn(x + y);\n};\n\n\n// natural logarithm of beta function\njStat.betaln = function betaln(x, y) {\n return jStat.gammaln(x) + jStat.gammaln(y) - jStat.gammaln(x + y);\n};\n\n\n// Evaluates the continued fraction for incomplete beta function by modified\n// Lentz's method.\njStat.betacf = function betacf(x, a, b) {\n var fpmin = 1e-30;\n var m = 1;\n var qab = a + b;\n var qap = a + 1;\n var qam = a - 1;\n var c = 1;\n var d = 1 - qab * x / qap;\n var m2, aa, del, h;\n\n // These q's will be used in factors that occur in the coefficients\n if (Math.abs(d) < fpmin)\n d = fpmin;\n d = 1 / d;\n h = d;\n\n for (; m <= 100; m++) {\n m2 = 2 * m;\n aa = m * (b - m) * x / ((qam + m2) * (a + m2));\n // One step (the even one) of the recurrence\n d = 1 + aa * d;\n if (Math.abs(d) < fpmin)\n d = fpmin;\n c = 1 + aa / c;\n if (Math.abs(c) < fpmin)\n c = fpmin;\n d = 1 / d;\n h *= d * c;\n aa = -(a + m) * (qab + m) * x / ((a + m2) * (qap + m2));\n // Next step of the recurrence (the odd one)\n d = 1 + aa * d;\n if (Math.abs(d) < fpmin)\n d = fpmin;\n c = 1 + aa / c;\n if (Math.abs(c) < fpmin)\n c = fpmin;\n d = 1 / d;\n del = d * c;\n h *= del;\n if (Math.abs(del - 1.0) < 3e-7)\n break;\n }\n\n return h;\n};\n\n\n// Returns the inverse of the lower regularized inomplete gamma function\njStat.gammapinv = function gammapinv(p, a) {\n var j = 0;\n var a1 = a - 1;\n var EPS = 1e-8;\n var gln = jStat.gammaln(a);\n var x, err, t, u, pp, lna1, afac;\n\n if (p >= 1)\n return Math.max(100, a + 100 * Math.sqrt(a));\n if (p <= 0)\n return 0;\n if (a > 1) {\n lna1 = Math.log(a1);\n afac = Math.exp(a1 * (lna1 - 1) - gln);\n pp = (p < 0.5) ? p : 1 - p;\n t = Math.sqrt(-2 * Math.log(pp));\n x = (2.30753 + t * 0.27061) / (1 + t * (0.99229 + t * 0.04481)) - t;\n if (p < 0.5)\n x = -x;\n x = Math.max(1e-3,\n a * Math.pow(1 - 1 / (9 * a) - x / (3 * Math.sqrt(a)), 3));\n } else {\n t = 1 - a * (0.253 + a * 0.12);\n if (p < t)\n x = Math.pow(p / t, 1 / a);\n else\n x = 1 - Math.log(1 - (p - t) / (1 - t));\n }\n\n for(; j < 12; j++) {\n if (x <= 0)\n return 0;\n err = jStat.lowRegGamma(a, x) - p;\n if (a > 1)\n t = afac * Math.exp(-(x - a1) + a1 * (Math.log(x) - lna1));\n else\n t = Math.exp(-x + a1 * Math.log(x) - gln);\n u = err / t;\n x -= (t = u / (1 - 0.5 * Math.min(1, u * ((a - 1) / x - 1))));\n if (x <= 0)\n x = 0.5 * (x + t);\n if (Math.abs(t) < EPS * x)\n break;\n }\n\n return x;\n};\n\n\n// Returns the error function erf(x)\njStat.erf = function erf(x) {\n var cof = [-1.3026537197817094, 6.4196979235649026e-1, 1.9476473204185836e-2,\n -9.561514786808631e-3, -9.46595344482036e-4, 3.66839497852761e-4,\n 4.2523324806907e-5, -2.0278578112534e-5, -1.624290004647e-6,\n 1.303655835580e-6, 1.5626441722e-8, -8.5238095915e-8,\n 6.529054439e-9, 5.059343495e-9, -9.91364156e-10,\n -2.27365122e-10, 9.6467911e-11, 2.394038e-12,\n -6.886027e-12, 8.94487e-13, 3.13092e-13,\n -1.12708e-13, 3.81e-16, 7.106e-15,\n -1.523e-15, -9.4e-17, 1.21e-16,\n -2.8e-17];\n var j = cof.length - 1;\n var isneg = false;\n var d = 0;\n var dd = 0;\n var t, ty, tmp, res;\n\n if (x < 0) {\n x = -x;\n isneg = true;\n }\n\n t = 2 / (2 + x);\n ty = 4 * t - 2;\n\n for(; j > 0; j--) {\n tmp = d;\n d = ty * d - dd + cof[j];\n dd = tmp;\n }\n\n res = t * Math.exp(-x * x + 0.5 * (cof[0] + ty * d) - dd);\n return isneg ? res - 1 : 1 - res;\n};\n\n\n// Returns the complmentary error function erfc(x)\njStat.erfc = function erfc(x) {\n return 1 - jStat.erf(x);\n};\n\n\n// Returns the inverse of the complementary error function\njStat.erfcinv = function erfcinv(p) {\n var j = 0;\n var x, err, t, pp;\n if (p >= 2)\n return -100;\n if (p <= 0)\n return 100;\n pp = (p < 1) ? p : 2 - p;\n t = Math.sqrt(-2 * Math.log(pp / 2));\n x = -0.70711 * ((2.30753 + t * 0.27061) /\n (1 + t * (0.99229 + t * 0.04481)) - t);\n for (; j < 2; j++) {\n err = jStat.erfc(x) - pp;\n x += err / (1.12837916709551257 * Math.exp(-x * x) - x * err);\n }\n return (p < 1) ? x : -x;\n};\n\n\n// Returns the inverse of the incomplete beta function\njStat.ibetainv = function ibetainv(p, a, b) {\n var EPS = 1e-8;\n var a1 = a - 1;\n var b1 = b - 1;\n var j = 0;\n var lna, lnb, pp, t, u, err, x, al, h, w, afac;\n if (p <= 0)\n return 0;\n if (p >= 1)\n return 1;\n if (a >= 1 && b >= 1) {\n pp = (p < 0.5) ? p : 1 - p;\n t = Math.sqrt(-2 * Math.log(pp));\n x = (2.30753 + t * 0.27061) / (1 + t* (0.99229 + t * 0.04481)) - t;\n if (p < 0.5)\n x = -x;\n al = (x * x - 3) / 6;\n h = 2 / (1 / (2 * a - 1) + 1 / (2 * b - 1));\n w = (x * Math.sqrt(al + h) / h) - (1 / (2 * b - 1) - 1 / (2 * a - 1)) *\n (al + 5 / 6 - 2 / (3 * h));\n x = a / (a + b * Math.exp(2 * w));\n } else {\n lna = Math.log(a / (a + b));\n lnb = Math.log(b / (a + b));\n t = Math.exp(a * lna) / a;\n u = Math.exp(b * lnb) / b;\n w = t + u;\n if (p < t / w)\n x = Math.pow(a * w * p, 1 / a);\n else\n x = 1 - Math.pow(b * w * (1 - p), 1 / b);\n }\n afac = -jStat.gammaln(a) - jStat.gammaln(b) + jStat.gammaln(a + b);\n for(; j < 10; j++) {\n if (x === 0 || x === 1)\n return x;\n err = jStat.ibeta(x, a, b) - p;\n t = Math.exp(a1 * Math.log(x) + b1 * Math.log(1 - x) + afac);\n u = err / t;\n x -= (t = u / (1 - 0.5 * Math.min(1, u * (a1 / x - b1 / (1 - x)))));\n if (x <= 0)\n x = 0.5 * (x + t);\n if (x >= 1)\n x = 0.5 * (x + t + 1);\n if (Math.abs(t) < EPS * x && j > 0)\n break;\n }\n return x;\n};\n\n\n// Returns the incomplete beta function I_x(a,b)\njStat.ibeta = function ibeta(x, a, b) {\n // Factors in front of the continued fraction.\n var bt = (x === 0 || x === 1) ? 0 :\n Math.exp(jStat.gammaln(a + b) - jStat.gammaln(a) -\n jStat.gammaln(b) + a * Math.log(x) + b *\n Math.log(1 - x));\n if (x < 0 || x > 1)\n return false;\n if (x < (a + 1) / (a + b + 2))\n // Use continued fraction directly.\n return bt * jStat.betacf(x, a, b) / a;\n // else use continued fraction after making the symmetry transformation.\n return 1 - bt * jStat.betacf(1 - x, b, a) / b;\n};\n\n\n// Returns a normal deviate (mu=0, sigma=1).\n// If n and m are specified it returns a object of normal deviates.\njStat.randn = function randn(n, m) {\n var u, v, x, y, q;\n if (!m)\n m = n;\n if (n)\n return jStat.create(n, m, function() { return jStat.randn(); });\n do {\n u = jStat._random_fn();\n v = 1.7156 * (jStat._random_fn() - 0.5);\n x = u - 0.449871;\n y = Math.abs(v) + 0.386595;\n q = x * x + y * (0.19600 * y - 0.25472 * x);\n } while (q > 0.27597 && (q > 0.27846 || v * v > -4 * Math.log(u) * u * u));\n return v / u;\n};\n\n\n// Returns a gamma deviate by the method of Marsaglia and Tsang.\njStat.randg = function randg(shape, n, m) {\n var oalph = shape;\n var a1, a2, u, v, x, mat;\n if (!m)\n m = n;\n if (!shape)\n shape = 1;\n if (n) {\n mat = jStat.zeros(n,m);\n mat.alter(function() { return jStat.randg(shape); });\n return mat;\n }\n if (shape < 1)\n shape += 1;\n a1 = shape - 1 / 3;\n a2 = 1 / Math.sqrt(9 * a1);\n do {\n do {\n x = jStat.randn();\n v = 1 + a2 * x;\n } while(v <= 0);\n v = v * v * v;\n u = jStat._random_fn();\n } while(u > 1 - 0.331 * Math.pow(x, 4) &&\n Math.log(u) > 0.5 * x*x + a1 * (1 - v + Math.log(v)));\n // alpha > 1\n if (shape == oalph)\n return a1 * v;\n // alpha < 1\n do {\n u = jStat._random_fn();\n } while(u === 0);\n return Math.pow(u, 1 / oalph) * a1 * v;\n};\n\n\n// making use of static methods on the instance\n(function(funcs) {\n for (var i = 0; i < funcs.length; i++) (function(passfunc) {\n jStat.fn[passfunc] = function() {\n return jStat(\n jStat.map(this, function(value) { return jStat[passfunc](value); }));\n }\n })(funcs[i]);\n})('gammaln gammafn factorial factorialln'.split(' '));\n\n\n(function(funcs) {\n for (var i = 0; i < funcs.length; i++) (function(passfunc) {\n jStat.fn[passfunc] = function() {\n return jStat(jStat[passfunc].apply(null, arguments));\n };\n })(funcs[i]);\n})('randn'.split(' '));\n\n}(jStat, Math));\n(function(jStat, Math) {\n\n// generate all distribution instance methods\n(function(list) {\n for (var i = 0; i < list.length; i++) (function(func) {\n // distribution instance method\n jStat[func] = function f(a, b, c) {\n if (!(this instanceof f))\n return new f(a, b, c);\n this._a = a;\n this._b = b;\n this._c = c;\n return this;\n };\n // distribution method to be used on a jStat instance\n jStat.fn[func] = function(a, b, c) {\n var newthis = jStat[func](a, b, c);\n newthis.data = this;\n return newthis;\n };\n // sample instance method\n jStat[func].prototype.sample = function(arr) {\n var a = this._a;\n var b = this._b;\n var c = this._c;\n if (arr)\n return jStat.alter(arr, function() {\n return jStat[func].sample(a, b, c);\n });\n else\n return jStat[func].sample(a, b, c);\n };\n // generate the pdf, cdf and inv instance methods\n (function(vals) {\n for (var i = 0; i < vals.length; i++) (function(fnfunc) {\n jStat[func].prototype[fnfunc] = function(x) {\n var a = this._a;\n var b = this._b;\n var c = this._c;\n if (!x && x !== 0)\n x = this.data;\n if (typeof x !== 'number') {\n return jStat.fn.map.call(x, function(x) {\n return jStat[func][fnfunc](x, a, b, c);\n });\n }\n return jStat[func][fnfunc](x, a, b, c);\n };\n })(vals[i]);\n })('pdf cdf inv'.split(' '));\n // generate the mean, median, mode and variance instance methods\n (function(vals) {\n for (var i = 0; i < vals.length; i++) (function(fnfunc) {\n jStat[func].prototype[fnfunc] = function() {\n return jStat[func][fnfunc](this._a, this._b, this._c);\n };\n })(vals[i]);\n })('mean median mode variance'.split(' '));\n })(list[i]);\n})((\n 'beta centralF cauchy chisquare exponential gamma invgamma kumaraswamy ' +\n 'laplace lognormal noncentralt normal pareto studentt weibull uniform ' +\n 'binomial negbin hypgeom poisson triangular tukey arcsine'\n).split(' '));\n\n\n\n// extend beta function with static methods\njStat.extend(jStat.beta, {\n pdf: function pdf(x, alpha, beta) {\n // PDF is zero outside the support\n if (x > 1 || x < 0)\n return 0;\n // PDF is one for the uniform case\n if (alpha == 1 && beta == 1)\n return 1;\n\n if (alpha < 512 && beta < 512) {\n return (Math.pow(x, alpha - 1) * Math.pow(1 - x, beta - 1)) /\n jStat.betafn(alpha, beta);\n } else {\n return Math.exp((alpha - 1) * Math.log(x) +\n (beta - 1) * Math.log(1 - x) -\n jStat.betaln(alpha, beta));\n }\n },\n\n cdf: function cdf(x, alpha, beta) {\n return (x > 1 || x < 0) ? (x > 1) * 1 : jStat.ibeta(x, alpha, beta);\n },\n\n inv: function inv(x, alpha, beta) {\n return jStat.ibetainv(x, alpha, beta);\n },\n\n mean: function mean(alpha, beta) {\n return alpha / (alpha + beta);\n },\n\n median: function median(alpha, beta) {\n return jStat.ibetainv(0.5, alpha, beta);\n },\n\n mode: function mode(alpha, beta) {\n return (alpha - 1 ) / ( alpha + beta - 2);\n },\n\n // return a random sample\n sample: function sample(alpha, beta) {\n var u = jStat.randg(alpha);\n return u / (u + jStat.randg(beta));\n },\n\n variance: function variance(alpha, beta) {\n return (alpha * beta) / (Math.pow(alpha + beta, 2) * (alpha + beta + 1));\n }\n});\n\n// extend F function with static methods\njStat.extend(jStat.centralF, {\n // This implementation of the pdf function avoids float overflow\n // See the way that R calculates this value:\n // https://svn.r-project.org/R/trunk/src/nmath/df.c\n pdf: function pdf(x, df1, df2) {\n var p, q, f;\n\n if (x < 0)\n return 0;\n\n if (df1 <= 2) {\n if (x === 0 && df1 < 2) {\n return Infinity;\n }\n if (x === 0 && df1 === 2) {\n return 1;\n }\n return (1 / jStat.betafn(df1 / 2, df2 / 2)) *\n Math.pow(df1 / df2, df1 / 2) *\n Math.pow(x, (df1/2) - 1) *\n Math.pow((1 + (df1 / df2) * x), -(df1 + df2) / 2);\n }\n\n p = (df1 * x) / (df2 + x * df1);\n q = df2 / (df2 + x * df1);\n f = df1 * q / 2.0;\n return f * jStat.binomial.pdf((df1 - 2) / 2, (df1 + df2 - 2) / 2, p);\n },\n\n cdf: function cdf(x, df1, df2) {\n if (x < 0)\n return 0;\n return jStat.ibeta((df1 * x) / (df1 * x + df2), df1 / 2, df2 / 2);\n },\n\n inv: function inv(x, df1, df2) {\n return df2 / (df1 * (1 / jStat.ibetainv(x, df1 / 2, df2 / 2) - 1));\n },\n\n mean: function mean(df1, df2) {\n return (df2 > 2) ? df2 / (df2 - 2) : undefined;\n },\n\n mode: function mode(df1, df2) {\n return (df1 > 2) ? (df2 * (df1 - 2)) / (df1 * (df2 + 2)) : undefined;\n },\n\n // return a random sample\n sample: function sample(df1, df2) {\n var x1 = jStat.randg(df1 / 2) * 2;\n var x2 = jStat.randg(df2 / 2) * 2;\n return (x1 / df1) / (x2 / df2);\n },\n\n variance: function variance(df1, df2) {\n if (df2 <= 4)\n return undefined;\n return 2 * df2 * df2 * (df1 + df2 - 2) /\n (df1 * (df2 - 2) * (df2 - 2) * (df2 - 4));\n }\n});\n\n\n// extend cauchy function with static methods\njStat.extend(jStat.cauchy, {\n pdf: function pdf(x, local, scale) {\n if (scale < 0) { return 0; }\n\n return (scale / (Math.pow(x - local, 2) + Math.pow(scale, 2))) / Math.PI;\n },\n\n cdf: function cdf(x, local, scale) {\n return Math.atan((x - local) / scale) / Math.PI + 0.5;\n },\n\n inv: function(p, local, scale) {\n return local + scale * Math.tan(Math.PI * (p - 0.5));\n },\n\n median: function median(local/*, scale*/) {\n return local;\n },\n\n mode: function mode(local/*, scale*/) {\n return local;\n },\n\n sample: function sample(local, scale) {\n return jStat.randn() *\n Math.sqrt(1 / (2 * jStat.randg(0.5))) * scale + local;\n }\n});\n\n\n\n// extend chisquare function with static methods\njStat.extend(jStat.chisquare, {\n pdf: function pdf(x, dof) {\n if (x < 0)\n return 0;\n return (x === 0 && dof === 2) ? 0.5 :\n Math.exp((dof / 2 - 1) * Math.log(x) - x / 2 - (dof / 2) *\n Math.log(2) - jStat.gammaln(dof / 2));\n },\n\n cdf: function cdf(x, dof) {\n if (x < 0)\n return 0;\n return jStat.lowRegGamma(dof / 2, x / 2);\n },\n\n inv: function(p, dof) {\n return 2 * jStat.gammapinv(p, 0.5 * dof);\n },\n\n mean : function(dof) {\n return dof;\n },\n\n // TODO: this is an approximation (is there a better way?)\n median: function median(dof) {\n return dof * Math.pow(1 - (2 / (9 * dof)), 3);\n },\n\n mode: function mode(dof) {\n return (dof - 2 > 0) ? dof - 2 : 0;\n },\n\n sample: function sample(dof) {\n return jStat.randg(dof / 2) * 2;\n },\n\n variance: function variance(dof) {\n return 2 * dof;\n }\n});\n\n\n\n// extend exponential function with static methods\njStat.extend(jStat.exponential, {\n pdf: function pdf(x, rate) {\n return x < 0 ? 0 : rate * Math.exp(-rate * x);\n },\n\n cdf: function cdf(x, rate) {\n return x < 0 ? 0 : 1 - Math.exp(-rate * x);\n },\n\n inv: function(p, rate) {\n return -Math.log(1 - p) / rate;\n },\n\n mean : function(rate) {\n return 1 / rate;\n },\n\n median: function (rate) {\n return (1 / rate) * Math.log(2);\n },\n\n mode: function mode(/*rate*/) {\n return 0;\n },\n\n sample: function sample(rate) {\n return -1 / rate * Math.log(jStat._random_fn());\n },\n\n variance : function(rate) {\n return Math.pow(rate, -2);\n }\n});\n\n\n\n// extend gamma function with static methods\njStat.extend(jStat.gamma, {\n pdf: function pdf(x, shape, scale) {\n if (x < 0)\n return 0;\n return (x === 0 && shape === 1) ? 1 / scale :\n Math.exp((shape - 1) * Math.log(x) - x / scale -\n jStat.gammaln(shape) - shape * Math.log(scale));\n },\n\n cdf: function cdf(x, shape, scale) {\n if (x < 0)\n return 0;\n return jStat.lowRegGamma(shape, x / scale);\n },\n\n inv: function(p, shape, scale) {\n return jStat.gammapinv(p, shape) * scale;\n },\n\n mean : function(shape, scale) {\n return shape * scale;\n },\n\n mode: function mode(shape, scale) {\n if(shape > 1) return (shape - 1) * scale;\n return undefined;\n },\n\n sample: function sample(shape, scale) {\n return jStat.randg(shape) * scale;\n },\n\n variance: function variance(shape, scale) {\n return shape * scale * scale;\n }\n});\n\n// extend inverse gamma function with static methods\njStat.extend(jStat.invgamma, {\n pdf: function pdf(x, shape, scale) {\n if (x <= 0)\n return 0;\n return Math.exp(-(shape + 1) * Math.log(x) - scale / x -\n jStat.gammaln(shape) + shape * Math.log(scale));\n },\n\n cdf: function cdf(x, shape, scale) {\n if (x <= 0)\n return 0;\n return 1 - jStat.lowRegGamma(shape, scale / x);\n },\n\n inv: function(p, shape, scale) {\n return scale / jStat.gammapinv(1 - p, shape);\n },\n\n mean : function(shape, scale) {\n return (shape > 1) ? scale / (shape - 1) : undefined;\n },\n\n mode: function mode(shape, scale) {\n return scale / (shape + 1);\n },\n\n sample: function sample(shape, scale) {\n return scale / jStat.randg(shape);\n },\n\n variance: function variance(shape, scale) {\n if (shape <= 2)\n return undefined;\n return scale * scale / ((shape - 1) * (shape - 1) * (shape - 2));\n }\n});\n\n\n// extend kumaraswamy function with static methods\njStat.extend(jStat.kumaraswamy, {\n pdf: function pdf(x, alpha, beta) {\n if (x === 0 && alpha === 1)\n return beta;\n else if (x === 1 && beta === 1)\n return alpha;\n return Math.exp(Math.log(alpha) + Math.log(beta) + (alpha - 1) *\n Math.log(x) + (beta - 1) *\n Math.log(1 - Math.pow(x, alpha)));\n },\n\n cdf: function cdf(x, alpha, beta) {\n if (x < 0)\n return 0;\n else if (x > 1)\n return 1;\n return (1 - Math.pow(1 - Math.pow(x, alpha), beta));\n },\n\n inv: function inv(p, alpha, beta) {\n return Math.pow(1 - Math.pow(1 - p, 1 / beta), 1 / alpha);\n },\n\n mean : function(alpha, beta) {\n return (beta * jStat.gammafn(1 + 1 / alpha) *\n jStat.gammafn(beta)) / (jStat.gammafn(1 + 1 / alpha + beta));\n },\n\n median: function median(alpha, beta) {\n return Math.pow(1 - Math.pow(2, -1 / beta), 1 / alpha);\n },\n\n mode: function mode(alpha, beta) {\n if (!(alpha >= 1 && beta >= 1 && (alpha !== 1 && beta !== 1)))\n return undefined;\n return Math.pow((alpha - 1) / (alpha * beta - 1), 1 / alpha);\n },\n\n variance: function variance(/*alpha, beta*/) {\n throw new Error('variance not yet implemented');\n // TODO: complete this\n }\n});\n\n\n\n// extend lognormal function with static methods\njStat.extend(jStat.lognormal, {\n pdf: function pdf(x, mu, sigma) {\n if (x <= 0)\n return 0;\n return Math.exp(-Math.log(x) - 0.5 * Math.log(2 * Math.PI) -\n Math.log(sigma) - Math.pow(Math.log(x) - mu, 2) /\n (2 * sigma * sigma));\n },\n\n cdf: function cdf(x, mu, sigma) {\n if (x < 0)\n return 0;\n return 0.5 +\n (0.5 * jStat.erf((Math.log(x) - mu) / Math.sqrt(2 * sigma * sigma)));\n },\n\n inv: function(p, mu, sigma) {\n return Math.exp(-1.41421356237309505 * sigma * jStat.erfcinv(2 * p) + mu);\n },\n\n mean: function mean(mu, sigma) {\n return Math.exp(mu + sigma * sigma / 2);\n },\n\n median: function median(mu/*, sigma*/) {\n return Math.exp(mu);\n },\n\n mode: function mode(mu, sigma) {\n return Math.exp(mu - sigma * sigma);\n },\n\n sample: function sample(mu, sigma) {\n return Math.exp(jStat.randn() * sigma + mu);\n },\n\n variance: function variance(mu, sigma) {\n return (Math.exp(sigma * sigma) - 1) * Math.exp(2 * mu + sigma * sigma);\n }\n});\n\n\n\n// extend noncentralt function with static methods\njStat.extend(jStat.noncentralt, {\n pdf: function pdf(x, dof, ncp) {\n var tol = 1e-14;\n if (Math.abs(ncp) < tol) // ncp approx 0; use student-t\n return jStat.studentt.pdf(x, dof)\n\n if (Math.abs(x) < tol) { // different formula for x == 0\n return Math.exp(jStat.gammaln((dof + 1) / 2) - ncp * ncp / 2 -\n 0.5 * Math.log(Math.PI * dof) - jStat.gammaln(dof / 2));\n }\n\n // formula for x != 0\n return dof / x *\n (jStat.noncentralt.cdf(x * Math.sqrt(1 + 2 / dof), dof+2, ncp) -\n jStat.noncentralt.cdf(x, dof, ncp));\n },\n\n cdf: function cdf(x, dof, ncp) {\n var tol = 1e-14;\n var min_iterations = 200;\n\n if (Math.abs(ncp) < tol) // ncp approx 0; use student-t\n return jStat.studentt.cdf(x, dof);\n\n // turn negative x into positive and flip result afterwards\n var flip = false;\n if (x < 0) {\n flip = true;\n ncp = -ncp;\n }\n\n var prob = jStat.normal.cdf(-ncp, 0, 1);\n var value = tol + 1;\n // use value at last two steps to determine convergence\n var lastvalue = value;\n var y = x * x / (x * x + dof);\n var j = 0;\n var p = Math.exp(-ncp * ncp / 2);\n var q = Math.exp(-ncp * ncp / 2 - 0.5 * Math.log(2) -\n jStat.gammaln(3 / 2)) * ncp;\n while (j < min_iterations || lastvalue > tol || value > tol) {\n lastvalue = value;\n if (j > 0) {\n p *= (ncp * ncp) / (2 * j);\n q *= (ncp * ncp) / (2 * (j + 1 / 2));\n }\n value = p * jStat.beta.cdf(y, j + 0.5, dof / 2) +\n q * jStat.beta.cdf(y, j+1, dof/2);\n prob += 0.5 * value;\n j++;\n }\n\n return flip ? (1 - prob) : prob;\n }\n});\n\n\n// extend normal function with static methods\njStat.extend(jStat.normal, {\n pdf: function pdf(x, mean, std) {\n return Math.exp(-0.5 * Math.log(2 * Math.PI) -\n Math.log(std) - Math.pow(x - mean, 2) / (2 * std * std));\n },\n\n cdf: function cdf(x, mean, std) {\n return 0.5 * (1 + jStat.erf((x - mean) / Math.sqrt(2 * std * std)));\n },\n\n inv: function(p, mean, std) {\n return -1.41421356237309505 * std * jStat.erfcinv(2 * p) + mean;\n },\n\n mean : function(mean/*, std*/) {\n return mean;\n },\n\n median: function median(mean/*, std*/) {\n return mean;\n },\n\n mode: function (mean/*, std*/) {\n return mean;\n },\n\n sample: function sample(mean, std) {\n return jStat.randn() * std + mean;\n },\n\n variance : function(mean, std) {\n return std * std;\n }\n});\n\n\n\n// extend pareto function with static methods\njStat.extend(jStat.pareto, {\n pdf: function pdf(x, scale, shape) {\n if (x < scale)\n return 0;\n return (shape * Math.pow(scale, shape)) / Math.pow(x, shape + 1);\n },\n\n cdf: function cdf(x, scale, shape) {\n if (x < scale)\n return 0;\n return 1 - Math.pow(scale / x, shape);\n },\n\n inv: function inv(p, scale, shape) {\n return scale / Math.pow(1 - p, 1 / shape);\n },\n\n mean: function mean(scale, shape) {\n if (shape <= 1)\n return undefined;\n return (shape * Math.pow(scale, shape)) / (shape - 1);\n },\n\n median: function median(scale, shape) {\n return scale * (shape * Math.SQRT2);\n },\n\n mode: function mode(scale/*, shape*/) {\n return scale;\n },\n\n variance : function(scale, shape) {\n if (shape <= 2)\n return undefined;\n return (scale*scale * shape) / (Math.pow(shape - 1, 2) * (shape - 2));\n }\n});\n\n\n\n// extend studentt function with static methods\njStat.extend(jStat.studentt, {\n pdf: function pdf(x, dof) {\n dof = dof > 1e100 ? 1e100 : dof;\n return (1/(Math.sqrt(dof) * jStat.betafn(0.5, dof/2))) *\n Math.pow(1 + ((x * x) / dof), -((dof + 1) / 2));\n },\n\n cdf: function cdf(x, dof) {\n var dof2 = dof / 2;\n return jStat.ibeta((x + Math.sqrt(x * x + dof)) /\n (2 * Math.sqrt(x * x + dof)), dof2, dof2);\n },\n\n inv: function(p, dof) {\n var x = jStat.ibetainv(2 * Math.min(p, 1 - p), 0.5 * dof, 0.5);\n x = Math.sqrt(dof * (1 - x) / x);\n return (p > 0.5) ? x : -x;\n },\n\n mean: function mean(dof) {\n return (dof > 1) ? 0 : undefined;\n },\n\n median: function median(/*dof*/) {\n return 0;\n },\n\n mode: function mode(/*dof*/) {\n return 0;\n },\n\n sample: function sample(dof) {\n return jStat.randn() * Math.sqrt(dof / (2 * jStat.randg(dof / 2)));\n },\n\n variance: function variance(dof) {\n return (dof > 2) ? dof / (dof - 2) : (dof > 1) ? Infinity : undefined;\n }\n});\n\n\n\n// extend weibull function with static methods\njStat.extend(jStat.weibull, {\n pdf: function pdf(x, scale, shape) {\n if (x < 0 || scale < 0 || shape < 0)\n return 0;\n return (shape / scale) * Math.pow((x / scale), (shape - 1)) *\n Math.exp(-(Math.pow((x / scale), shape)));\n },\n\n cdf: function cdf(x, scale, shape) {\n return x < 0 ? 0 : 1 - Math.exp(-Math.pow((x / scale), shape));\n },\n\n inv: function(p, scale, shape) {\n return scale * Math.pow(-Math.log(1 - p), 1 / shape);\n },\n\n mean : function(scale, shape) {\n return scale * jStat.gammafn(1 + 1 / shape);\n },\n\n median: function median(scale, shape) {\n return scale * Math.pow(Math.log(2), 1 / shape);\n },\n\n mode: function mode(scale, shape) {\n if (shape <= 1)\n return 0;\n return scale * Math.pow((shape - 1) / shape, 1 / shape);\n },\n\n sample: function sample(scale, shape) {\n return scale * Math.pow(-Math.log(jStat._random_fn()), 1 / shape);\n },\n\n variance: function variance(scale, shape) {\n return scale * scale * jStat.gammafn(1 + 2 / shape) -\n Math.pow(jStat.weibull.mean(scale, shape), 2);\n }\n});\n\n\n\n// extend uniform function with static methods\njStat.extend(jStat.uniform, {\n pdf: function pdf(x, a, b) {\n return (x < a || x > b) ? 0 : 1 / (b - a);\n },\n\n cdf: function cdf(x, a, b) {\n if (x < a)\n return 0;\n else if (x < b)\n return (x - a) / (b - a);\n return 1;\n },\n\n inv: function(p, a, b) {\n return a + (p * (b - a));\n },\n\n mean: function mean(a, b) {\n return 0.5 * (a + b);\n },\n\n median: function median(a, b) {\n return jStat.mean(a, b);\n },\n\n mode: function mode(/*a, b*/) {\n throw new Error('mode is not yet implemented');\n },\n\n sample: function sample(a, b) {\n return (a / 2 + b / 2) + (b / 2 - a / 2) * (2 * jStat._random_fn() - 1);\n },\n\n variance: function variance(a, b) {\n return Math.pow(b - a, 2) / 12;\n }\n});\n\n\n// Got this from http://www.math.ucla.edu/~tom/distributions/binomial.html\nfunction betinc(x, a, b, eps) {\n var a0 = 0;\n var b0 = 1;\n var a1 = 1;\n var b1 = 1;\n var m9 = 0;\n var a2 = 0;\n var c9;\n\n while (Math.abs((a1 - a2) / a1) > eps) {\n a2 = a1;\n c9 = -(a + m9) * (a + b + m9) * x / (a + 2 * m9) / (a + 2 * m9 + 1);\n a0 = a1 + c9 * a0;\n b0 = b1 + c9 * b0;\n m9 = m9 + 1;\n c9 = m9 * (b - m9) * x / (a + 2 * m9 - 1) / (a + 2 * m9);\n a1 = a0 + c9 * a1;\n b1 = b0 + c9 * b1;\n a0 = a0 / b1;\n b0 = b0 / b1;\n a1 = a1 / b1;\n b1 = 1;\n }\n\n return a1 / a;\n}\n\n\n// extend uniform function with static methods\njStat.extend(jStat.binomial, {\n pdf: function pdf(k, n, p) {\n return (p === 0 || p === 1) ?\n ((n * p) === k ? 1 : 0) :\n jStat.combination(n, k) * Math.pow(p, k) * Math.pow(1 - p, n - k);\n },\n\n cdf: function cdf(x, n, p) {\n var betacdf;\n var eps = 1e-10;\n\n if (x < 0)\n return 0;\n if (x >= n)\n return 1;\n if (p < 0 || p > 1 || n <= 0)\n return NaN;\n\n x = Math.floor(x);\n var z = p;\n var a = x + 1;\n var b = n - x;\n var s = a + b;\n var bt = Math.exp(jStat.gammaln(s) - jStat.gammaln(b) -\n jStat.gammaln(a) + a * Math.log(z) + b * Math.log(1 - z));\n\n if (z < (a + 1) / (s + 2))\n betacdf = bt * betinc(z, a, b, eps);\n else\n betacdf = 1 - bt * betinc(1 - z, b, a, eps);\n\n return Math.round((1 - betacdf) * (1 / eps)) / (1 / eps);\n }\n});\n\n\n\n// extend uniform function with static methods\njStat.extend(jStat.negbin, {\n pdf: function pdf(k, r, p) {\n if (k !== k >>> 0)\n return false;\n if (k < 0)\n return 0;\n return jStat.combination(k + r - 1, r - 1) *\n Math.pow(1 - p, k) * Math.pow(p, r);\n },\n\n cdf: function cdf(x, r, p) {\n var sum = 0,\n k = 0;\n if (x < 0) return 0;\n for (; k <= x; k++) {\n sum += jStat.negbin.pdf(k, r, p);\n }\n return sum;\n }\n});\n\n\n\n// extend uniform function with static methods\njStat.extend(jStat.hypgeom, {\n pdf: function pdf(k, N, m, n) {\n // Hypergeometric PDF.\n\n // A simplification of the CDF algorithm below.\n\n // k = number of successes drawn\n // N = population size\n // m = number of successes in population\n // n = number of items drawn from population\n\n if(k !== k | 0) {\n return false;\n } else if(k < 0 || k < m - (N - n)) {\n // It's impossible to have this few successes drawn.\n return 0;\n } else if(k > n || k > m) {\n // It's impossible to have this many successes drawn.\n return 0;\n } else if (m * 2 > N) {\n // More than half the population is successes.\n\n if(n * 2 > N) {\n // More than half the population is sampled.\n\n return jStat.hypgeom.pdf(N - m - n + k, N, N - m, N - n)\n } else {\n // Half or less of the population is sampled.\n\n return jStat.hypgeom.pdf(n - k, N, N - m, n);\n }\n\n } else if(n * 2 > N) {\n // Half or less is successes.\n\n return jStat.hypgeom.pdf(m - k, N, m, N - n);\n\n } else if(m < n) {\n // We want to have the number of things sampled to be less than the\n // successes available. So swap the definitions of successful and sampled.\n return jStat.hypgeom.pdf(k, N, n, m);\n } else {\n // If we get here, half or less of the population was sampled, half or\n // less of it was successes, and we had fewer sampled things than\n // successes. Now we can do this complicated iterative algorithm in an\n // efficient way.\n\n // The basic premise of the algorithm is that we partially normalize our\n // intermediate product to keep it in a numerically good region, and then\n // finish the normalization at the end.\n\n // This variable holds the scaled probability of the current number of\n // successes.\n var scaledPDF = 1;\n\n // This keeps track of how much we have normalized.\n var samplesDone = 0;\n\n for(var i = 0; i < k; i++) {\n // For every possible number of successes up to that observed...\n\n while(scaledPDF > 1 && samplesDone < n) {\n // Intermediate result is growing too big. Apply some of the\n // normalization to shrink everything.\n\n scaledPDF *= 1 - (m / (N - samplesDone));\n\n // Say we've normalized by this sample already.\n samplesDone++;\n }\n\n // Work out the partially-normalized hypergeometric PDF for the next\n // number of successes\n scaledPDF *= (n - i) * (m - i) / ((i + 1) * (N - m - n + i + 1));\n }\n\n for(; samplesDone < n; samplesDone++) {\n // Apply all the rest of the normalization\n scaledPDF *= 1 - (m / (N - samplesDone));\n }\n\n // Bound answer sanely before returning.\n return Math.min(1, Math.max(0, scaledPDF));\n }\n },\n\n cdf: function cdf(x, N, m, n) {\n // Hypergeometric CDF.\n\n // This algorithm is due to Prof. Thomas S. Ferguson, ,\n // and comes from his hypergeometric test calculator at\n // .\n\n // x = number of successes drawn\n // N = population size\n // m = number of successes in population\n // n = number of items drawn from population\n\n if(x < 0 || x < m - (N - n)) {\n // It's impossible to have this few successes drawn or fewer.\n return 0;\n } else if(x >= n || x >= m) {\n // We will always have this many successes or fewer.\n return 1;\n } else if (m * 2 > N) {\n // More than half the population is successes.\n\n if(n * 2 > N) {\n // More than half the population is sampled.\n\n return jStat.hypgeom.cdf(N - m - n + x, N, N - m, N - n)\n } else {\n // Half or less of the population is sampled.\n\n return 1 - jStat.hypgeom.cdf(n - x - 1, N, N - m, n);\n }\n\n } else if(n * 2 > N) {\n // Half or less is successes.\n\n return 1 - jStat.hypgeom.cdf(m - x - 1, N, m, N - n);\n\n } else if(m < n) {\n // We want to have the number of things sampled to be less than the\n // successes available. So swap the definitions of successful and sampled.\n return jStat.hypgeom.cdf(x, N, n, m);\n } else {\n // If we get here, half or less of the population was sampled, half or\n // less of it was successes, and we had fewer sampled things than\n // successes. Now we can do this complicated iterative algorithm in an\n // efficient way.\n\n // The basic premise of the algorithm is that we partially normalize our\n // intermediate sum to keep it in a numerically good region, and then\n // finish the normalization at the end.\n\n // Holds the intermediate, scaled total CDF.\n var scaledCDF = 1;\n\n // This variable holds the scaled probability of the current number of\n // successes.\n var scaledPDF = 1;\n\n // This keeps track of how much we have normalized.\n var samplesDone = 0;\n\n for(var i = 0; i < x; i++) {\n // For every possible number of successes up to that observed...\n\n while(scaledCDF > 1 && samplesDone < n) {\n // Intermediate result is growing too big. Apply some of the\n // normalization to shrink everything.\n\n var factor = 1 - (m / (N - samplesDone));\n\n scaledPDF *= factor;\n scaledCDF *= factor;\n\n // Say we've normalized by this sample already.\n samplesDone++;\n }\n\n // Work out the partially-normalized hypergeometric PDF for the next\n // number of successes\n scaledPDF *= (n - i) * (m - i) / ((i + 1) * (N - m - n + i + 1));\n\n // Add to the CDF answer.\n scaledCDF += scaledPDF;\n }\n\n for(; samplesDone < n; samplesDone++) {\n // Apply all the rest of the normalization\n scaledCDF *= 1 - (m / (N - samplesDone));\n }\n\n // Bound answer sanely before returning.\n return Math.min(1, Math.max(0, scaledCDF));\n }\n }\n});\n\n\n\n// extend uniform function with static methods\njStat.extend(jStat.poisson, {\n pdf: function pdf(k, l) {\n if (l < 0 || (k % 1) !== 0 || k < 0) {\n return 0;\n }\n\n return Math.pow(l, k) * Math.exp(-l) / jStat.factorial(k);\n },\n\n cdf: function cdf(x, l) {\n var sumarr = [],\n k = 0;\n if (x < 0) return 0;\n for (; k <= x; k++) {\n sumarr.push(jStat.poisson.pdf(k, l));\n }\n return jStat.sum(sumarr);\n },\n\n mean : function(l) {\n return l;\n },\n\n variance : function(l) {\n return l;\n },\n\n sampleSmall: function sampleSmall(l) {\n var p = 1, k = 0, L = Math.exp(-l);\n do {\n k++;\n p *= jStat._random_fn();\n } while (p > L);\n return k - 1;\n },\n\n sampleLarge: function sampleLarge(l) {\n var lam = l;\n var k;\n var U, V, slam, loglam, a, b, invalpha, vr, us;\n\n slam = Math.sqrt(lam);\n loglam = Math.log(lam);\n b = 0.931 + 2.53 * slam;\n a = -0.059 + 0.02483 * b;\n invalpha = 1.1239 + 1.1328 / (b - 3.4);\n vr = 0.9277 - 3.6224 / (b - 2);\n\n while (1) {\n U = Math.random() - 0.5;\n V = Math.random();\n us = 0.5 - Math.abs(U);\n k = Math.floor((2 * a / us + b) * U + lam + 0.43);\n if ((us >= 0.07) && (V <= vr)) {\n return k;\n }\n if ((k < 0) || ((us < 0.013) && (V > us))) {\n continue;\n }\n /* log(V) == log(0.0) ok here */\n /* if U==0.0 so that us==0.0, log is ok since always returns */\n if ((Math.log(V) + Math.log(invalpha) - Math.log(a / (us * us) + b)) <= (-lam + k * loglam - jStat.loggam(k + 1))) {\n return k;\n }\n }\n },\n\n sample: function sample(l) {\n if (l < 10)\n return this.sampleSmall(l);\n else\n return this.sampleLarge(l);\n }\n});\n\n// extend triangular function with static methods\njStat.extend(jStat.triangular, {\n pdf: function pdf(x, a, b, c) {\n if (b <= a || c < a || c > b) {\n return NaN;\n } else {\n if (x < a || x > b) {\n return 0;\n } else if (x < c) {\n return (2 * (x - a)) / ((b - a) * (c - a));\n } else if (x === c) {\n return (2 / (b - a));\n } else { // x > c\n return (2 * (b - x)) / ((b - a) * (b - c));\n }\n }\n },\n\n cdf: function cdf(x, a, b, c) {\n if (b <= a || c < a || c > b)\n return NaN;\n if (x <= a)\n return 0;\n else if (x >= b)\n return 1;\n if (x <= c)\n return Math.pow(x - a, 2) / ((b - a) * (c - a));\n else // x > c\n return 1 - Math.pow(b - x, 2) / ((b - a) * (b - c));\n },\n\n inv: function inv(p, a, b, c) {\n if (b <= a || c < a || c > b) {\n return NaN;\n } else {\n if (p <= ((c - a) / (b - a))) {\n return a + (b - a) * Math.sqrt(p * ((c - a) / (b - a)));\n } else { // p > ((c - a) / (b - a))\n return a + (b - a) * (1 - Math.sqrt((1 - p) * (1 - ((c - a) / (b - a)))));\n }\n }\n },\n\n mean: function mean(a, b, c) {\n return (a + b + c) / 3;\n },\n\n median: function median(a, b, c) {\n if (c <= (a + b) / 2) {\n return b - Math.sqrt((b - a) * (b - c)) / Math.sqrt(2);\n } else if (c > (a + b) / 2) {\n return a + Math.sqrt((b - a) * (c - a)) / Math.sqrt(2);\n }\n },\n\n mode: function mode(a, b, c) {\n return c;\n },\n\n sample: function sample(a, b, c) {\n var u = jStat._random_fn();\n if (u < ((c - a) / (b - a)))\n return a + Math.sqrt(u * (b - a) * (c - a))\n return b - Math.sqrt((1 - u) * (b - a) * (b - c));\n },\n\n variance: function variance(a, b, c) {\n return (a * a + b * b + c * c - a * b - a * c - b * c) / 18;\n }\n});\n\n\n// extend arcsine function with static methods\njStat.extend(jStat.arcsine, {\n pdf: function pdf(x, a, b) {\n if (b <= a) return NaN;\n\n return (x <= a || x >= b) ? 0 :\n (2 / Math.PI) *\n Math.pow(Math.pow(b - a, 2) -\n Math.pow(2 * x - a - b, 2), -0.5);\n },\n\n cdf: function cdf(x, a, b) {\n if (x < a)\n return 0;\n else if (x < b)\n return (2 / Math.PI) * Math.asin(Math.sqrt((x - a)/(b - a)));\n return 1;\n },\n\n inv: function(p, a, b) {\n return a + (0.5 - 0.5 * Math.cos(Math.PI * p)) * (b - a);\n },\n\n mean: function mean(a, b) {\n if (b <= a) return NaN;\n return (a + b) / 2;\n },\n\n median: function median(a, b) {\n if (b <= a) return NaN;\n return (a + b) / 2;\n },\n\n mode: function mode(/*a, b*/) {\n throw new Error('mode is not yet implemented');\n },\n\n sample: function sample(a, b) {\n return ((a + b) / 2) + ((b - a) / 2) *\n Math.sin(2 * Math.PI * jStat.uniform.sample(0, 1));\n },\n\n variance: function variance(a, b) {\n if (b <= a) return NaN;\n return Math.pow(b - a, 2) / 8;\n }\n});\n\n\nfunction laplaceSign(x) { return x / Math.abs(x); }\n\njStat.extend(jStat.laplace, {\n pdf: function pdf(x, mu, b) {\n return (b <= 0) ? 0 : (Math.exp(-Math.abs(x - mu) / b)) / (2 * b);\n },\n\n cdf: function cdf(x, mu, b) {\n if (b <= 0) { return 0; }\n\n if(x < mu) {\n return 0.5 * Math.exp((x - mu) / b);\n } else {\n return 1 - 0.5 * Math.exp(- (x - mu) / b);\n }\n },\n\n mean: function(mu/*, b*/) {\n return mu;\n },\n\n median: function(mu/*, b*/) {\n return mu;\n },\n\n mode: function(mu/*, b*/) {\n return mu;\n },\n\n variance: function(mu, b) {\n return 2 * b * b;\n },\n\n sample: function sample(mu, b) {\n var u = jStat._random_fn() - 0.5;\n\n return mu - (b * laplaceSign(u) * Math.log(1 - (2 * Math.abs(u))));\n }\n});\n\nfunction tukeyWprob(w, rr, cc) {\n var nleg = 12;\n var ihalf = 6;\n\n var C1 = -30;\n var C2 = -50;\n var C3 = 60;\n var bb = 8;\n var wlar = 3;\n var wincr1 = 2;\n var wincr2 = 3;\n var xleg = [\n 0.981560634246719250690549090149,\n 0.904117256370474856678465866119,\n 0.769902674194304687036893833213,\n 0.587317954286617447296702418941,\n 0.367831498998180193752691536644,\n 0.125233408511468915472441369464\n ];\n var aleg = [\n 0.047175336386511827194615961485,\n 0.106939325995318430960254718194,\n 0.160078328543346226334652529543,\n 0.203167426723065921749064455810,\n 0.233492536538354808760849898925,\n 0.249147045813402785000562436043\n ];\n\n var qsqz = w * 0.5;\n\n // if w >= 16 then the integral lower bound (occurs for c=20)\n // is 0.99999999999995 so return a value of 1.\n\n if (qsqz >= bb)\n return 1.0;\n\n // find (f(w/2) - 1) ^ cc\n // (first term in integral of hartley's form).\n\n var pr_w = 2 * jStat.normal.cdf(qsqz, 0, 1, 1, 0) - 1; // erf(qsqz / M_SQRT2)\n // if pr_w ^ cc < 2e-22 then set pr_w = 0\n if (pr_w >= Math.exp(C2 / cc))\n pr_w = Math.pow(pr_w, cc);\n else\n pr_w = 0.0;\n\n // if w is large then the second component of the\n // integral is small, so fewer intervals are needed.\n\n var wincr;\n if (w > wlar)\n wincr = wincr1;\n else\n wincr = wincr2;\n\n // find the integral of second term of hartley's form\n // for the integral of the range for equal-length\n // intervals using legendre quadrature. limits of\n // integration are from (w/2, 8). two or three\n // equal-length intervals are used.\n\n // blb and bub are lower and upper limits of integration.\n\n var blb = qsqz;\n var binc = (bb - qsqz) / wincr;\n var bub = blb + binc;\n var einsum = 0.0;\n\n // integrate over each interval\n\n var cc1 = cc - 1.0;\n for (var wi = 1; wi <= wincr; wi++) {\n var elsum = 0.0;\n var a = 0.5 * (bub + blb);\n\n // legendre quadrature with order = nleg\n\n var b = 0.5 * (bub - blb);\n\n for (var jj = 1; jj <= nleg; jj++) {\n var j, xx;\n if (ihalf < jj) {\n j = (nleg - jj) + 1;\n xx = xleg[j-1];\n } else {\n j = jj;\n xx = -xleg[j-1];\n }\n var c = b * xx;\n var ac = a + c;\n\n // if exp(-qexpo/2) < 9e-14,\n // then doesn't contribute to integral\n\n var qexpo = ac * ac;\n if (qexpo > C3)\n break;\n\n var pplus = 2 * jStat.normal.cdf(ac, 0, 1, 1, 0);\n var pminus= 2 * jStat.normal.cdf(ac, w, 1, 1, 0);\n\n // if rinsum ^ (cc-1) < 9e-14,\n // then doesn't contribute to integral\n\n var rinsum = (pplus * 0.5) - (pminus * 0.5);\n if (rinsum >= Math.exp(C1 / cc1)) {\n rinsum = (aleg[j-1] * Math.exp(-(0.5 * qexpo))) * Math.pow(rinsum, cc1);\n elsum += rinsum;\n }\n }\n elsum *= (((2.0 * b) * cc) / Math.sqrt(2 * Math.PI));\n einsum += elsum;\n blb = bub;\n bub += binc;\n }\n\n // if pr_w ^ rr < 9e-14, then return 0\n pr_w += einsum;\n if (pr_w <= Math.exp(C1 / rr))\n return 0;\n\n pr_w = Math.pow(pr_w, rr);\n if (pr_w >= 1) // 1 was iMax was eps\n return 1;\n return pr_w;\n}\n\nfunction tukeyQinv(p, c, v) {\n var p0 = 0.322232421088;\n var q0 = 0.993484626060e-01;\n var p1 = -1.0;\n var q1 = 0.588581570495;\n var p2 = -0.342242088547;\n var q2 = 0.531103462366;\n var p3 = -0.204231210125;\n var q3 = 0.103537752850;\n var p4 = -0.453642210148e-04;\n var q4 = 0.38560700634e-02;\n var c1 = 0.8832;\n var c2 = 0.2368;\n var c3 = 1.214;\n var c4 = 1.208;\n var c5 = 1.4142;\n var vmax = 120.0;\n\n var ps = 0.5 - 0.5 * p;\n var yi = Math.sqrt(Math.log(1.0 / (ps * ps)));\n var t = yi + (((( yi * p4 + p3) * yi + p2) * yi + p1) * yi + p0)\n / (((( yi * q4 + q3) * yi + q2) * yi + q1) * yi + q0);\n if (v < vmax) t += (t * t * t + t) / v / 4.0;\n var q = c1 - c2 * t;\n if (v < vmax) q += -c3 / v + c4 * t / v;\n return t * (q * Math.log(c - 1.0) + c5);\n}\n\njStat.extend(jStat.tukey, {\n cdf: function cdf(q, nmeans, df) {\n // Identical implementation as the R ptukey() function as of commit 68947\n var rr = 1;\n var cc = nmeans;\n\n var nlegq = 16;\n var ihalfq = 8;\n\n var eps1 = -30.0;\n var eps2 = 1.0e-14;\n var dhaf = 100.0;\n var dquar = 800.0;\n var deigh = 5000.0;\n var dlarg = 25000.0;\n var ulen1 = 1.0;\n var ulen2 = 0.5;\n var ulen3 = 0.25;\n var ulen4 = 0.125;\n var xlegq = [\n 0.989400934991649932596154173450,\n 0.944575023073232576077988415535,\n 0.865631202387831743880467897712,\n 0.755404408355003033895101194847,\n 0.617876244402643748446671764049,\n 0.458016777657227386342419442984,\n 0.281603550779258913230460501460,\n 0.950125098376374401853193354250e-1\n ];\n var alegq = [\n 0.271524594117540948517805724560e-1,\n 0.622535239386478928628438369944e-1,\n 0.951585116824927848099251076022e-1,\n 0.124628971255533872052476282192,\n 0.149595988816576732081501730547,\n 0.169156519395002538189312079030,\n 0.182603415044923588866763667969,\n 0.189450610455068496285396723208\n ];\n\n if (q <= 0)\n return 0;\n\n // df must be > 1\n // there must be at least two values\n\n if (df < 2 || rr < 1 || cc < 2) return NaN;\n\n if (!Number.isFinite(q))\n return 1;\n\n if (df > dlarg)\n return tukeyWprob(q, rr, cc);\n\n // calculate leading constant\n\n var f2 = df * 0.5;\n var f2lf = ((f2 * Math.log(df)) - (df * Math.log(2))) - jStat.gammaln(f2);\n var f21 = f2 - 1.0;\n\n // integral is divided into unit, half-unit, quarter-unit, or\n // eighth-unit length intervals depending on the value of the\n // degrees of freedom.\n\n var ff4 = df * 0.25;\n var ulen;\n if (df <= dhaf) ulen = ulen1;\n else if (df <= dquar) ulen = ulen2;\n else if (df <= deigh) ulen = ulen3;\n else ulen = ulen4;\n\n f2lf += Math.log(ulen);\n\n // integrate over each subinterval\n\n var ans = 0.0;\n\n for (var i = 1; i <= 50; i++) {\n var otsum = 0.0;\n\n // legendre quadrature with order = nlegq\n // nodes (stored in xlegq) are symmetric around zero.\n\n var twa1 = (2 * i - 1) * ulen;\n\n for (var jj = 1; jj <= nlegq; jj++) {\n var j, t1;\n if (ihalfq < jj) {\n j = jj - ihalfq - 1;\n t1 = (f2lf + (f21 * Math.log(twa1 + (xlegq[j] * ulen))))\n - (((xlegq[j] * ulen) + twa1) * ff4);\n } else {\n j = jj - 1;\n t1 = (f2lf + (f21 * Math.log(twa1 - (xlegq[j] * ulen))))\n + (((xlegq[j] * ulen) - twa1) * ff4);\n }\n\n // if exp(t1) < 9e-14, then doesn't contribute to integral\n var qsqz;\n if (t1 >= eps1) {\n if (ihalfq < jj) {\n qsqz = q * Math.sqrt(((xlegq[j] * ulen) + twa1) * 0.5);\n } else {\n qsqz = q * Math.sqrt(((-(xlegq[j] * ulen)) + twa1) * 0.5);\n }\n\n // call wprob to find integral of range portion\n\n var wprb = tukeyWprob(qsqz, rr, cc);\n var rotsum = (wprb * alegq[j]) * Math.exp(t1);\n otsum += rotsum;\n }\n // end legendre integral for interval i\n // L200:\n }\n\n // if integral for interval i < 1e-14, then stop.\n // However, in order to avoid small area under left tail,\n // at least 1 / ulen intervals are calculated.\n if (i * ulen >= 1.0 && otsum <= eps2)\n break;\n\n // end of interval i\n // L330:\n\n ans += otsum;\n }\n\n if (otsum > eps2) { // not converged\n throw new Error('tukey.cdf failed to converge');\n }\n if (ans > 1)\n ans = 1;\n return ans;\n },\n\n inv: function(p, nmeans, df) {\n // Identical implementation as the R qtukey() function as of commit 68947\n var rr = 1;\n var cc = nmeans;\n\n var eps = 0.0001;\n var maxiter = 50;\n\n // df must be > 1 ; there must be at least two values\n if (df < 2 || rr < 1 || cc < 2) return NaN;\n\n if (p < 0 || p > 1) return NaN;\n if (p === 0) return 0;\n if (p === 1) return Infinity;\n\n // Initial value\n\n var x0 = tukeyQinv(p, cc, df);\n\n // Find prob(value < x0)\n\n var valx0 = jStat.tukey.cdf(x0, nmeans, df) - p;\n\n // Find the second iterate and prob(value < x1).\n // If the first iterate has probability value\n // exceeding p then second iterate is 1 less than\n // first iterate; otherwise it is 1 greater.\n\n var x1;\n if (valx0 > 0.0)\n x1 = Math.max(0.0, x0 - 1.0);\n else\n x1 = x0 + 1.0;\n var valx1 = jStat.tukey.cdf(x1, nmeans, df) - p;\n\n // Find new iterate\n\n var ans;\n for(var iter = 1; iter < maxiter; iter++) {\n ans = x1 - ((valx1 * (x1 - x0)) / (valx1 - valx0));\n valx0 = valx1;\n\n // New iterate must be >= 0\n\n x0 = x1;\n if (ans < 0.0) {\n ans = 0.0;\n valx1 = -p;\n }\n // Find prob(value < new iterate)\n\n valx1 = jStat.tukey.cdf(ans, nmeans, df) - p;\n x1 = ans;\n\n // If the difference between two successive\n // iterates is less than eps, stop\n\n var xabs = Math.abs(x1 - x0);\n if (xabs < eps)\n return ans;\n }\n\n throw new Error('tukey.inv failed to converge');\n }\n});\n\n}(jStat, Math));\n/* Provides functions for the solution of linear system of equations, integration, extrapolation,\n * interpolation, eigenvalue problems, differential equations and PCA analysis. */\n\n(function(jStat, Math) {\n\nvar push = Array.prototype.push;\nvar isArray = jStat.utils.isArray;\n\nfunction isUsable(arg) {\n return isArray(arg) || arg instanceof jStat;\n}\n\njStat.extend({\n\n // add a vector/matrix to a vector/matrix or scalar\n add: function add(arr, arg) {\n // check if arg is a vector or scalar\n if (isUsable(arg)) {\n if (!isUsable(arg[0])) arg = [ arg ];\n return jStat.map(arr, function(value, row, col) {\n return value + arg[row][col];\n });\n }\n return jStat.map(arr, function(value) { return value + arg; });\n },\n\n // subtract a vector or scalar from the vector\n subtract: function subtract(arr, arg) {\n // check if arg is a vector or scalar\n if (isUsable(arg)) {\n if (!isUsable(arg[0])) arg = [ arg ];\n return jStat.map(arr, function(value, row, col) {\n return value - arg[row][col] || 0;\n });\n }\n return jStat.map(arr, function(value) { return value - arg; });\n },\n\n // matrix division\n divide: function divide(arr, arg) {\n if (isUsable(arg)) {\n if (!isUsable(arg[0])) arg = [ arg ];\n return jStat.multiply(arr, jStat.inv(arg));\n }\n return jStat.map(arr, function(value) { return value / arg; });\n },\n\n // matrix multiplication\n multiply: function multiply(arr, arg) {\n var row, col, nrescols, sum, nrow, ncol, res, rescols;\n // eg: arr = 2 arg = 3 -> 6 for res[0][0] statement closure\n if (arr.length === undefined && arg.length === undefined) {\n return arr * arg;\n }\n nrow = arr.length,\n ncol = arr[0].length,\n res = jStat.zeros(nrow, nrescols = (isUsable(arg)) ? arg[0].length : ncol),\n rescols = 0;\n if (isUsable(arg)) {\n for (; rescols < nrescols; rescols++) {\n for (row = 0; row < nrow; row++) {\n sum = 0;\n for (col = 0; col < ncol; col++)\n sum += arr[row][col] * arg[col][rescols];\n res[row][rescols] = sum;\n }\n }\n return (nrow === 1 && rescols === 1) ? res[0][0] : res;\n }\n return jStat.map(arr, function(value) { return value * arg; });\n },\n\n // outer([1,2,3],[4,5,6])\n // ===\n // [[1],[2],[3]] times [[4,5,6]]\n // ->\n // [[4,5,6],[8,10,12],[12,15,18]]\n outer:function outer(A, B) {\n return jStat.multiply(A.map(function(t){ return [t] }), [B]);\n },\n\n\n // Returns the dot product of two matricies\n dot: function dot(arr, arg) {\n if (!isUsable(arr[0])) arr = [ arr ];\n if (!isUsable(arg[0])) arg = [ arg ];\n // convert column to row vector\n var left = (arr[0].length === 1 && arr.length !== 1) ? jStat.transpose(arr) : arr,\n right = (arg[0].length === 1 && arg.length !== 1) ? jStat.transpose(arg) : arg,\n res = [],\n row = 0,\n nrow = left.length,\n ncol = left[0].length,\n sum, col;\n for (; row < nrow; row++) {\n res[row] = [];\n sum = 0;\n for (col = 0; col < ncol; col++)\n sum += left[row][col] * right[row][col];\n res[row] = sum;\n }\n return (res.length === 1) ? res[0] : res;\n },\n\n // raise every element by a scalar\n pow: function pow(arr, arg) {\n return jStat.map(arr, function(value) { return Math.pow(value, arg); });\n },\n\n // exponentiate every element\n exp: function exp(arr) {\n return jStat.map(arr, function(value) { return Math.exp(value); });\n },\n\n // generate the natural log of every element\n log: function exp(arr) {\n return jStat.map(arr, function(value) { return Math.log(value); });\n },\n\n // generate the absolute values of the vector\n abs: function abs(arr) {\n return jStat.map(arr, function(value) { return Math.abs(value); });\n },\n\n // computes the p-norm of the vector\n // In the case that a matrix is passed, uses the first row as the vector\n norm: function norm(arr, p) {\n var nnorm = 0,\n i = 0;\n // check the p-value of the norm, and set for most common case\n if (isNaN(p)) p = 2;\n // check if multi-dimensional array, and make vector correction\n if (isUsable(arr[0])) arr = arr[0];\n // vector norm\n for (; i < arr.length; i++) {\n nnorm += Math.pow(Math.abs(arr[i]), p);\n }\n return Math.pow(nnorm, 1 / p);\n },\n\n // computes the angle between two vectors in rads\n // In case a matrix is passed, this uses the first row as the vector\n angle: function angle(arr, arg) {\n return Math.acos(jStat.dot(arr, arg) / (jStat.norm(arr) * jStat.norm(arg)));\n },\n\n // augment one matrix by another\n // Note: this function returns a matrix, not a jStat object\n aug: function aug(a, b) {\n var newarr = [];\n var i;\n for (i = 0; i < a.length; i++) {\n newarr.push(a[i].slice());\n }\n for (i = 0; i < newarr.length; i++) {\n push.apply(newarr[i], b[i]);\n }\n return newarr;\n },\n\n // The inv() function calculates the inverse of a matrix\n // Create the inverse by augmenting the matrix by the identity matrix of the\n // appropriate size, and then use G-J elimination on the augmented matrix.\n inv: function inv(a) {\n var rows = a.length;\n var cols = a[0].length;\n var b = jStat.identity(rows, cols);\n var c = jStat.gauss_jordan(a, b);\n var result = [];\n var i = 0;\n var j;\n\n //We need to copy the inverse portion to a new matrix to rid G-J artifacts\n for (; i < rows; i++) {\n result[i] = [];\n for (j = cols; j < c[0].length; j++)\n result[i][j - cols] = c[i][j];\n }\n return result;\n },\n\n // calculate the determinant of a matrix\n det: function det(a) {\n var alen = a.length,\n alend = alen * 2,\n vals = new Array(alend),\n rowshift = alen - 1,\n colshift = alend - 1,\n mrow = rowshift - alen + 1,\n mcol = colshift,\n i = 0,\n result = 0,\n j;\n // check for special 2x2 case\n if (alen === 2) {\n return a[0][0] * a[1][1] - a[0][1] * a[1][0];\n }\n for (; i < alend; i++) {\n vals[i] = 1;\n }\n for (i = 0; i < alen; i++) {\n for (j = 0; j < alen; j++) {\n vals[(mrow < 0) ? mrow + alen : mrow ] *= a[i][j];\n vals[(mcol < alen) ? mcol + alen : mcol ] *= a[i][j];\n mrow++;\n mcol--;\n }\n mrow = --rowshift - alen + 1;\n mcol = --colshift;\n }\n for (i = 0; i < alen; i++) {\n result += vals[i];\n }\n for (; i < alend; i++) {\n result -= vals[i];\n }\n return result;\n },\n\n gauss_elimination: function gauss_elimination(a, b) {\n var i = 0,\n j = 0,\n n = a.length,\n m = a[0].length,\n factor = 1,\n sum = 0,\n x = [],\n maug, pivot, temp, k;\n a = jStat.aug(a, b);\n maug = a[0].length;\n for(i = 0; i < n; i++) {\n pivot = a[i][i];\n j = i;\n for (k = i + 1; k < m; k++) {\n if (pivot < Math.abs(a[k][i])) {\n pivot = a[k][i];\n j = k;\n }\n }\n if (j != i) {\n for(k = 0; k < maug; k++) {\n temp = a[i][k];\n a[i][k] = a[j][k];\n a[j][k] = temp;\n }\n }\n for (j = i + 1; j < n; j++) {\n factor = a[j][i] / a[i][i];\n for(k = i; k < maug; k++) {\n a[j][k] = a[j][k] - factor * a[i][k];\n }\n }\n }\n for (i = n - 1; i >= 0; i--) {\n sum = 0;\n for (j = i + 1; j<= n - 1; j++) {\n sum = sum + x[j] * a[i][j];\n }\n x[i] =(a[i][maug - 1] - sum) / a[i][i];\n }\n return x;\n },\n\n gauss_jordan: function gauss_jordan(a, b) {\n var m = jStat.aug(a, b);\n var h = m.length;\n var w = m[0].length;\n var c = 0;\n var x, y, y2;\n // find max pivot\n for (y = 0; y < h; y++) {\n var maxrow = y;\n for (y2 = y+1; y2 < h; y2++) {\n if (Math.abs(m[y2][y]) > Math.abs(m[maxrow][y]))\n maxrow = y2;\n }\n var tmp = m[y];\n m[y] = m[maxrow];\n m[maxrow] = tmp\n for (y2 = y+1; y2 < h; y2++) {\n c = m[y2][y] / m[y][y];\n for (x = y; x < w; x++) {\n m[y2][x] -= m[y][x] * c;\n }\n }\n }\n // backsubstitute\n for (y = h-1; y >= 0; y--) {\n c = m[y][y];\n for (y2 = 0; y2 < y; y2++) {\n for (x = w-1; x > y-1; x--) {\n m[y2][x] -= m[y][x] * m[y2][y] / c;\n }\n }\n m[y][y] /= c;\n for (x = h; x < w; x++) {\n m[y][x] /= c;\n }\n }\n return m;\n },\n\n // solve equation\n // Ax=b\n // A is upper triangular matrix\n // A=[[1,2,3],[0,4,5],[0,6,7]]\n // b=[1,2,3]\n // triaUpSolve(A,b) // -> [2.666,0.1666,1.666]\n // if you use matrix style\n // A=[[1,2,3],[0,4,5],[0,6,7]]\n // b=[[1],[2],[3]]\n // will return [[2.666],[0.1666],[1.666]]\n triaUpSolve: function triaUpSolve(A, b) {\n var size = A[0].length;\n var x = jStat.zeros(1, size)[0];\n var parts;\n var matrix_mode = false;\n\n if (b[0].length != undefined) {\n b = b.map(function(i){ return i[0] });\n matrix_mode = true;\n }\n\n jStat.arange(size - 1, -1, -1).forEach(function(i) {\n parts = jStat.arange(i + 1, size).map(function(j) {\n return x[j] * A[i][j];\n });\n x[i] = (b[i] - jStat.sum(parts)) / A[i][i];\n });\n\n if (matrix_mode)\n return x.map(function(i){ return [i] });\n return x;\n },\n\n triaLowSolve: function triaLowSolve(A, b) {\n // like to triaUpSolve but A is lower triangular matrix\n var size = A[0].length;\n var x = jStat.zeros(1, size)[0];\n var parts;\n\n var matrix_mode=false;\n if (b[0].length != undefined) {\n b = b.map(function(i){ return i[0] });\n matrix_mode = true;\n }\n\n jStat.arange(size).forEach(function(i) {\n parts = jStat.arange(i).map(function(j) {\n return A[i][j] * x[j];\n });\n x[i] = (b[i] - jStat.sum(parts)) / A[i][i];\n })\n\n if (matrix_mode)\n return x.map(function(i){ return [i] });\n return x;\n },\n\n\n // A -> [L,U]\n // A=LU\n // L is lower triangular matrix\n // U is upper triangular matrix\n lu: function lu(A) {\n var size = A.length;\n //var L=jStat.diagonal(jStat.ones(1,size)[0]);\n var L = jStat.identity(size);\n var R = jStat.zeros(A.length, A[0].length);\n var parts;\n jStat.arange(size).forEach(function(t) {\n R[0][t] = A[0][t];\n });\n jStat.arange(1, size).forEach(function(l) {\n jStat.arange(l).forEach(function(i) {\n parts = jStat.arange(i).map(function(jj) {\n return L[l][jj] * R[jj][i];\n });\n L[l][i] = (A[l][i] - jStat.sum(parts)) / R[i][i];\n });\n jStat.arange(l, size).forEach(function(j) {\n parts = jStat.arange(l).map(function(jj) {\n return L[l][jj] * R[jj][j];\n });\n R[l][j] = A[parts.length][j] - jStat.sum(parts);\n });\n });\n return [L, R];\n },\n\n // A -> T\n // A=TT'\n // T is lower triangular matrix\n cholesky: function cholesky(A) {\n var size = A.length;\n var T = jStat.zeros(A.length, A[0].length);\n var parts;\n jStat.arange(size).forEach(function(i) {\n parts = jStat.arange(i).map(function(t) {\n return Math.pow(T[i][t],2);\n });\n T[i][i] = Math.sqrt(A[i][i] - jStat.sum(parts));\n jStat.arange(i + 1, size).forEach(function(j) {\n parts = jStat.arange(i).map(function(t) {\n return T[i][t] * T[j][t];\n });\n T[j][i] = (A[i][j] - jStat.sum(parts)) / T[i][i];\n });\n });\n return T;\n },\n\n\n gauss_jacobi: function gauss_jacobi(a, b, x, r) {\n var i = 0;\n var j = 0;\n var n = a.length;\n var l = [];\n var u = [];\n var d = [];\n var xv, c, h, xk;\n for (; i < n; i++) {\n l[i] = [];\n u[i] = [];\n d[i] = [];\n for (j = 0; j < n; j++) {\n if (i > j) {\n l[i][j] = a[i][j];\n u[i][j] = d[i][j] = 0;\n } else if (i < j) {\n u[i][j] = a[i][j];\n l[i][j] = d[i][j] = 0;\n } else {\n d[i][j] = a[i][j];\n l[i][j] = u[i][j] = 0;\n }\n }\n }\n h = jStat.multiply(jStat.multiply(jStat.inv(d), jStat.add(l, u)), -1);\n c = jStat.multiply(jStat.inv(d), b);\n xv = x;\n xk = jStat.add(jStat.multiply(h, x), c);\n i = 2;\n while (Math.abs(jStat.norm(jStat.subtract(xk,xv))) > r) {\n xv = xk;\n xk = jStat.add(jStat.multiply(h, xv), c);\n i++;\n }\n return xk;\n },\n\n gauss_seidel: function gauss_seidel(a, b, x, r) {\n var i = 0;\n var n = a.length;\n var l = [];\n var u = [];\n var d = [];\n var j, xv, c, h, xk;\n for (; i < n; i++) {\n l[i] = [];\n u[i] = [];\n d[i] = [];\n for (j = 0; j < n; j++) {\n if (i > j) {\n l[i][j] = a[i][j];\n u[i][j] = d[i][j] = 0;\n } else if (i < j) {\n u[i][j] = a[i][j];\n l[i][j] = d[i][j] = 0;\n } else {\n d[i][j] = a[i][j];\n l[i][j] = u[i][j] = 0;\n }\n }\n }\n h = jStat.multiply(jStat.multiply(jStat.inv(jStat.add(d, l)), u), -1);\n c = jStat.multiply(jStat.inv(jStat.add(d, l)), b);\n xv = x;\n xk = jStat.add(jStat.multiply(h, x), c);\n i = 2;\n while (Math.abs(jStat.norm(jStat.subtract(xk, xv))) > r) {\n xv = xk;\n xk = jStat.add(jStat.multiply(h, xv), c);\n i = i + 1;\n }\n return xk;\n },\n\n SOR: function SOR(a, b, x, r, w) {\n var i = 0;\n var n = a.length;\n var l = [];\n var u = [];\n var d = [];\n var j, xv, c, h, xk;\n for (; i < n; i++) {\n l[i] = [];\n u[i] = [];\n d[i] = [];\n for (j = 0; j < n; j++) {\n if (i > j) {\n l[i][j] = a[i][j];\n u[i][j] = d[i][j] = 0;\n } else if (i < j) {\n u[i][j] = a[i][j];\n l[i][j] = d[i][j] = 0;\n } else {\n d[i][j] = a[i][j];\n l[i][j] = u[i][j] = 0;\n }\n }\n }\n h = jStat.multiply(jStat.inv(jStat.add(d, jStat.multiply(l, w))),\n jStat.subtract(jStat.multiply(d, 1 - w),\n jStat.multiply(u, w)));\n c = jStat.multiply(jStat.multiply(jStat.inv(jStat.add(d,\n jStat.multiply(l, w))), b), w);\n xv = x;\n xk = jStat.add(jStat.multiply(h, x), c);\n i = 2;\n while (Math.abs(jStat.norm(jStat.subtract(xk, xv))) > r) {\n xv = xk;\n xk = jStat.add(jStat.multiply(h, xv), c);\n i++;\n }\n return xk;\n },\n\n householder: function householder(a) {\n var m = a.length;\n var n = a[0].length;\n var i = 0;\n var w = [];\n var p = [];\n var alpha, r, k, j, factor;\n for (; i < m - 1; i++) {\n alpha = 0;\n for (j = i + 1; j < n; j++)\n alpha += (a[j][i] * a[j][i]);\n factor = (a[i + 1][i] > 0) ? -1 : 1;\n alpha = factor * Math.sqrt(alpha);\n r = Math.sqrt((((alpha * alpha) - a[i + 1][i] * alpha) / 2));\n w = jStat.zeros(m, 1);\n w[i + 1][0] = (a[i + 1][i] - alpha) / (2 * r);\n for (k = i + 2; k < m; k++) w[k][0] = a[k][i] / (2 * r);\n p = jStat.subtract(jStat.identity(m, n),\n jStat.multiply(jStat.multiply(w, jStat.transpose(w)), 2));\n a = jStat.multiply(p, jStat.multiply(a, p));\n }\n return a;\n },\n\n // A -> [Q,R]\n // Q is orthogonal matrix\n // R is upper triangular\n QR: (function() {\n // x -> Q\n // find a orthogonal matrix Q st.\n // Qx=y\n // y is [||x||,0,0,...]\n\n // quick ref\n var sum = jStat.sum;\n var range = jStat.arange;\n\n function qr2(x) {\n // quick impletation\n // https://www.stat.wisc.edu/~larget/math496/qr.html\n\n var n = x.length;\n var p = x[0].length;\n\n var r = jStat.zeros(p, p);\n x = jStat.copy(x);\n\n var i,j,k;\n for(j = 0; j < p; j++){\n r[j][j] = Math.sqrt(sum(range(n).map(function(i){\n return x[i][j] * x[i][j];\n })));\n for(i = 0; i < n; i++){\n x[i][j] = x[i][j] / r[j][j];\n }\n for(k = j+1; k < p; k++){\n r[j][k] = sum(range(n).map(function(i){\n return x[i][j] * x[i][k];\n }));\n for(i = 0; i < n; i++){\n x[i][k] = x[i][k] - x[i][j]*r[j][k];\n }\n }\n }\n return [x, r];\n }\n\n return qr2;\n }()),\n\n lstsq: (function() {\n // solve least squard problem for Ax=b as QR decomposition way if b is\n // [[b1],[b2],[b3]] form will return [[x1],[x2],[x3]] array form solution\n // else b is [b1,b2,b3] form will return [x1,x2,x3] array form solution\n function R_I(A) {\n A = jStat.copy(A);\n var size = A.length;\n var I = jStat.identity(size);\n jStat.arange(size - 1, -1, -1).forEach(function(i) {\n jStat.sliceAssign(\n I, { row: i }, jStat.divide(jStat.slice(I, { row: i }), A[i][i]));\n jStat.sliceAssign(\n A, { row: i }, jStat.divide(jStat.slice(A, { row: i }), A[i][i]));\n jStat.arange(i).forEach(function(j) {\n var c = jStat.multiply(A[j][i], -1);\n var Aj = jStat.slice(A, { row: j });\n var cAi = jStat.multiply(jStat.slice(A, { row: i }), c);\n jStat.sliceAssign(A, { row: j }, jStat.add(Aj, cAi));\n var Ij = jStat.slice(I, { row: j });\n var cIi = jStat.multiply(jStat.slice(I, { row: i }), c);\n jStat.sliceAssign(I, { row: j }, jStat.add(Ij, cIi));\n })\n });\n return I;\n }\n\n function qr_solve(A, b){\n var array_mode = false;\n if (b[0].length === undefined) {\n // [c1,c2,c3] mode\n b = b.map(function(x){ return [x] });\n array_mode = true;\n }\n var QR = jStat.QR(A);\n var Q = QR[0];\n var R = QR[1];\n var attrs = A[0].length;\n var Q1 = jStat.slice(Q,{col:{end:attrs}});\n var R1 = jStat.slice(R,{row:{end:attrs}});\n var RI = R_I(R1);\n var Q2 = jStat.transpose(Q1);\n\n if(Q2[0].length === undefined){\n Q2 = [Q2]; // The confusing jStat.multifly implementation threat nature process again.\n }\n\n var x = jStat.multiply(jStat.multiply(RI, Q2), b);\n\n if(x.length === undefined){\n x = [[x]]; // The confusing jStat.multifly implementation threat nature process again.\n }\n\n\n if (array_mode)\n return x.map(function(i){ return i[0] });\n return x;\n }\n\n return qr_solve;\n }()),\n\n jacobi: function jacobi(a) {\n var condition = 1;\n var n = a.length;\n var e = jStat.identity(n, n);\n var ev = [];\n var b, i, j, p, q, maxim, theta, s;\n // condition === 1 only if tolerance is not reached\n while (condition === 1) {\n maxim = a[0][1];\n p = 0;\n q = 1;\n for (i = 0; i < n; i++) {\n for (j = 0; j < n; j++) {\n if (i != j) {\n if (maxim < Math.abs(a[i][j])) {\n maxim = Math.abs(a[i][j]);\n p = i;\n q = j;\n }\n }\n }\n }\n if (a[p][p] === a[q][q])\n theta = (a[p][q] > 0) ? Math.PI / 4 : -Math.PI / 4;\n else\n theta = Math.atan(2 * a[p][q] / (a[p][p] - a[q][q])) / 2;\n s = jStat.identity(n, n);\n s[p][p] = Math.cos(theta);\n s[p][q] = -Math.sin(theta);\n s[q][p] = Math.sin(theta);\n s[q][q] = Math.cos(theta);\n // eigen vector matrix\n e = jStat.multiply(e, s);\n b = jStat.multiply(jStat.multiply(jStat.inv(s), a), s);\n a = b;\n condition = 0;\n for (i = 1; i < n; i++) {\n for (j = 1; j < n; j++) {\n if (i != j && Math.abs(a[i][j]) > 0.001) {\n condition = 1;\n }\n }\n }\n }\n for (i = 0; i < n; i++) ev.push(a[i][i]);\n //returns both the eigenvalue and eigenmatrix\n return [e, ev];\n },\n\n rungekutta: function rungekutta(f, h, p, t_j, u_j, order) {\n var k1, k2, u_j1, k3, k4;\n if (order === 2) {\n while (t_j <= p) {\n k1 = h * f(t_j, u_j);\n k2 = h * f(t_j + h, u_j + k1);\n u_j1 = u_j + (k1 + k2) / 2;\n u_j = u_j1;\n t_j = t_j + h;\n }\n }\n if (order === 4) {\n while (t_j <= p) {\n k1 = h * f(t_j, u_j);\n k2 = h * f(t_j + h / 2, u_j + k1 / 2);\n k3 = h * f(t_j + h / 2, u_j + k2 / 2);\n k4 = h * f(t_j +h, u_j + k3);\n u_j1 = u_j + (k1 + 2 * k2 + 2 * k3 + k4) / 6;\n u_j = u_j1;\n t_j = t_j + h;\n }\n }\n return u_j;\n },\n\n romberg: function romberg(f, a, b, order) {\n var i = 0;\n var h = (b - a) / 2;\n var x = [];\n var h1 = [];\n var g = [];\n var m, a1, j, k, I;\n while (i < order / 2) {\n I = f(a);\n for (j = a, k = 0; j <= b; j = j + h, k++) x[k] = j;\n m = x.length;\n for (j = 1; j < m - 1; j++) {\n I += (((j % 2) !== 0) ? 4 : 2) * f(x[j]);\n }\n I = (h / 3) * (I + f(b));\n g[i] = I;\n h /= 2;\n i++;\n }\n a1 = g.length;\n m = 1;\n while (a1 !== 1) {\n for (j = 0; j < a1 - 1; j++)\n h1[j] = ((Math.pow(4, m)) * g[j + 1] - g[j]) / (Math.pow(4, m) - 1);\n a1 = h1.length;\n g = h1;\n h1 = [];\n m++;\n }\n return g;\n },\n\n richardson: function richardson(X, f, x, h) {\n function pos(X, x) {\n var i = 0;\n var n = X.length;\n var p;\n for (; i < n; i++)\n if (X[i] === x) p = i;\n return p;\n }\n var h_min = Math.abs(x - X[pos(X, x) + 1]);\n var i = 0;\n var g = [];\n var h1 = [];\n var y1, y2, m, a, j;\n while (h >= h_min) {\n y1 = pos(X, x + h);\n y2 = pos(X, x);\n g[i] = (f[y1] - 2 * f[y2] + f[2 * y2 - y1]) / (h * h);\n h /= 2;\n i++;\n }\n a = g.length;\n m = 1;\n while (a != 1) {\n for (j = 0; j < a - 1; j++)\n h1[j] = ((Math.pow(4, m)) * g[j + 1] - g[j]) / (Math.pow(4, m) - 1);\n a = h1.length;\n g = h1;\n h1 = [];\n m++;\n }\n return g;\n },\n\n simpson: function simpson(f, a, b, n) {\n var h = (b - a) / n;\n var I = f(a);\n var x = [];\n var j = a;\n var k = 0;\n var i = 1;\n var m;\n for (; j <= b; j = j + h, k++)\n x[k] = j;\n m = x.length;\n for (; i < m - 1; i++) {\n I += ((i % 2 !== 0) ? 4 : 2) * f(x[i]);\n }\n return (h / 3) * (I + f(b));\n },\n\n hermite: function hermite(X, F, dF, value) {\n var n = X.length;\n var p = 0;\n var i = 0;\n var l = [];\n var dl = [];\n var A = [];\n var B = [];\n var j;\n for (; i < n; i++) {\n l[i] = 1;\n for (j = 0; j < n; j++) {\n if (i != j) l[i] *= (value - X[j]) / (X[i] - X[j]);\n }\n dl[i] = 0;\n for (j = 0; j < n; j++) {\n if (i != j) dl[i] += 1 / (X [i] - X[j]);\n }\n A[i] = (1 - 2 * (value - X[i]) * dl[i]) * (l[i] * l[i]);\n B[i] = (value - X[i]) * (l[i] * l[i]);\n p += (A[i] * F[i] + B[i] * dF[i]);\n }\n return p;\n },\n\n lagrange: function lagrange(X, F, value) {\n var p = 0;\n var i = 0;\n var j, l;\n var n = X.length;\n for (; i < n; i++) {\n l = F[i];\n for (j = 0; j < n; j++) {\n // calculating the lagrange polynomial L_i\n if (i != j) l *= (value - X[j]) / (X[i] - X[j]);\n }\n // adding the lagrange polynomials found above\n p += l;\n }\n return p;\n },\n\n cubic_spline: function cubic_spline(X, F, value) {\n var n = X.length;\n var i = 0, j;\n var A = [];\n var B = [];\n var alpha = [];\n var c = [];\n var h = [];\n var b = [];\n var d = [];\n for (; i < n - 1; i++)\n h[i] = X[i + 1] - X[i];\n alpha[0] = 0;\n for (i = 1; i < n - 1; i++) {\n alpha[i] = (3 / h[i]) * (F[i + 1] - F[i]) -\n (3 / h[i-1]) * (F[i] - F[i-1]);\n }\n for (i = 1; i < n - 1; i++) {\n A[i] = [];\n B[i] = [];\n A[i][i-1] = h[i-1];\n A[i][i] = 2 * (h[i - 1] + h[i]);\n A[i][i+1] = h[i];\n B[i][0] = alpha[i];\n }\n c = jStat.multiply(jStat.inv(A), B);\n for (j = 0; j < n - 1; j++) {\n b[j] = (F[j + 1] - F[j]) / h[j] - h[j] * (c[j + 1][0] + 2 * c[j][0]) / 3;\n d[j] = (c[j + 1][0] - c[j][0]) / (3 * h[j]);\n }\n for (j = 0; j < n; j++) {\n if (X[j] > value) break;\n }\n j -= 1;\n return F[j] + (value - X[j]) * b[j] + jStat.sq(value-X[j]) *\n c[j] + (value - X[j]) * jStat.sq(value - X[j]) * d[j];\n },\n\n gauss_quadrature: function gauss_quadrature() {\n throw new Error('gauss_quadrature not yet implemented');\n },\n\n PCA: function PCA(X) {\n var m = X.length;\n var n = X[0].length;\n var i = 0;\n var j, temp1;\n var u = [];\n var D = [];\n var result = [];\n var temp2 = [];\n var Y = [];\n var Bt = [];\n var B = [];\n var C = [];\n var V = [];\n var Vt = [];\n for (i = 0; i < m; i++) {\n u[i] = jStat.sum(X[i]) / n;\n }\n for (i = 0; i < n; i++) {\n B[i] = [];\n for(j = 0; j < m; j++) {\n B[i][j] = X[j][i] - u[j];\n }\n }\n B = jStat.transpose(B);\n for (i = 0; i < m; i++) {\n C[i] = [];\n for (j = 0; j < m; j++) {\n C[i][j] = (jStat.dot([B[i]], [B[j]])) / (n - 1);\n }\n }\n result = jStat.jacobi(C);\n V = result[0];\n D = result[1];\n Vt = jStat.transpose(V);\n for (i = 0; i < D.length; i++) {\n for (j = i; j < D.length; j++) {\n if(D[i] < D[j]) {\n temp1 = D[i];\n D[i] = D[j];\n D[j] = temp1;\n temp2 = Vt[i];\n Vt[i] = Vt[j];\n Vt[j] = temp2;\n }\n }\n }\n Bt = jStat.transpose(B);\n for (i = 0; i < m; i++) {\n Y[i] = [];\n for (j = 0; j < Bt.length; j++) {\n Y[i][j] = jStat.dot([Vt[i]], [Bt[j]]);\n }\n }\n return [X, D, Vt, Y];\n }\n});\n\n// extend jStat.fn with methods that require one argument\n(function(funcs) {\n for (var i = 0; i < funcs.length; i++) (function(passfunc) {\n jStat.fn[passfunc] = function(arg, func) {\n var tmpthis = this;\n // check for callback\n if (func) {\n setTimeout(function() {\n func.call(tmpthis, jStat.fn[passfunc].call(tmpthis, arg));\n }, 15);\n return this;\n }\n if (typeof jStat[passfunc](this, arg) === 'number')\n return jStat[passfunc](this, arg);\n else\n return jStat(jStat[passfunc](this, arg));\n };\n }(funcs[i]));\n}('add divide multiply subtract dot pow exp log abs norm angle'.split(' ')));\n\n}(jStat, Math));\n(function(jStat, Math) {\n\nvar slice = [].slice;\nvar isNumber = jStat.utils.isNumber;\nvar isArray = jStat.utils.isArray;\n\n// flag==true denotes use of sample standard deviation\n// Z Statistics\njStat.extend({\n // 2 different parameter lists:\n // (value, mean, sd)\n // (value, array, flag)\n zscore: function zscore() {\n var args = slice.call(arguments);\n if (isNumber(args[1])) {\n return (args[0] - args[1]) / args[2];\n }\n return (args[0] - jStat.mean(args[1])) / jStat.stdev(args[1], args[2]);\n },\n\n // 3 different paramter lists:\n // (value, mean, sd, sides)\n // (zscore, sides)\n // (value, array, sides, flag)\n ztest: function ztest() {\n var args = slice.call(arguments);\n var z;\n if (isArray(args[1])) {\n // (value, array, sides, flag)\n z = jStat.zscore(args[0],args[1],args[3]);\n return (args[2] === 1) ?\n (jStat.normal.cdf(-Math.abs(z), 0, 1)) :\n (jStat.normal.cdf(-Math.abs(z), 0, 1)*2);\n } else {\n if (args.length > 2) {\n // (value, mean, sd, sides)\n z = jStat.zscore(args[0],args[1],args[2]);\n return (args[3] === 1) ?\n (jStat.normal.cdf(-Math.abs(z),0,1)) :\n (jStat.normal.cdf(-Math.abs(z),0,1)* 2);\n } else {\n // (zscore, sides)\n z = args[0];\n return (args[1] === 1) ?\n (jStat.normal.cdf(-Math.abs(z),0,1)) :\n (jStat.normal.cdf(-Math.abs(z),0,1)*2);\n }\n }\n }\n});\n\njStat.extend(jStat.fn, {\n zscore: function zscore(value, flag) {\n return (value - this.mean()) / this.stdev(flag);\n },\n\n ztest: function ztest(value, sides, flag) {\n var zscore = Math.abs(this.zscore(value, flag));\n return (sides === 1) ?\n (jStat.normal.cdf(-zscore, 0, 1)) :\n (jStat.normal.cdf(-zscore, 0, 1) * 2);\n }\n});\n\n// T Statistics\njStat.extend({\n // 2 parameter lists\n // (value, mean, sd, n)\n // (value, array)\n tscore: function tscore() {\n var args = slice.call(arguments);\n return (args.length === 4) ?\n ((args[0] - args[1]) / (args[2] / Math.sqrt(args[3]))) :\n ((args[0] - jStat.mean(args[1])) /\n (jStat.stdev(args[1], true) / Math.sqrt(args[1].length)));\n },\n\n // 3 different paramter lists:\n // (value, mean, sd, n, sides)\n // (tscore, n, sides)\n // (value, array, sides)\n ttest: function ttest() {\n var args = slice.call(arguments);\n var tscore;\n if (args.length === 5) {\n tscore = Math.abs(jStat.tscore(args[0], args[1], args[2], args[3]));\n return (args[4] === 1) ?\n (jStat.studentt.cdf(-tscore, args[3]-1)) :\n (jStat.studentt.cdf(-tscore, args[3]-1)*2);\n }\n if (isNumber(args[1])) {\n tscore = Math.abs(args[0])\n return (args[2] == 1) ?\n (jStat.studentt.cdf(-tscore, args[1]-1)) :\n (jStat.studentt.cdf(-tscore, args[1]-1) * 2);\n }\n tscore = Math.abs(jStat.tscore(args[0], args[1]))\n return (args[2] == 1) ?\n (jStat.studentt.cdf(-tscore, args[1].length-1)) :\n (jStat.studentt.cdf(-tscore, args[1].length-1) * 2);\n }\n});\n\njStat.extend(jStat.fn, {\n tscore: function tscore(value) {\n return (value - this.mean()) / (this.stdev(true) / Math.sqrt(this.cols()));\n },\n\n ttest: function ttest(value, sides) {\n return (sides === 1) ?\n (1 - jStat.studentt.cdf(Math.abs(this.tscore(value)), this.cols()-1)) :\n (jStat.studentt.cdf(-Math.abs(this.tscore(value)), this.cols()-1)*2);\n }\n});\n\n// F Statistics\njStat.extend({\n // Paramter list is as follows:\n // (array1, array2, array3, ...)\n // or it is an array of arrays\n // array of arrays conversion\n anovafscore: function anovafscore() {\n var args = slice.call(arguments),\n expVar, sample, sampMean, sampSampMean, tmpargs, unexpVar, i, j;\n if (args.length === 1) {\n tmpargs = new Array(args[0].length);\n for (i = 0; i < args[0].length; i++) {\n tmpargs[i] = args[0][i];\n }\n args = tmpargs;\n }\n // Builds sample array\n sample = new Array();\n for (i = 0; i < args.length; i++) {\n sample = sample.concat(args[i]);\n }\n sampMean = jStat.mean(sample);\n // Computes the explained variance\n expVar = 0;\n for (i = 0; i < args.length; i++) {\n expVar = expVar + args[i].length * Math.pow(jStat.mean(args[i]) - sampMean, 2);\n }\n expVar /= (args.length - 1);\n // Computes unexplained variance\n unexpVar = 0;\n for (i = 0; i < args.length; i++) {\n sampSampMean = jStat.mean(args[i]);\n for (j = 0; j < args[i].length; j++) {\n unexpVar += Math.pow(args[i][j] - sampSampMean, 2);\n }\n }\n unexpVar /= (sample.length - args.length);\n return expVar / unexpVar;\n },\n\n // 2 different paramter setups\n // (array1, array2, array3, ...)\n // (anovafscore, df1, df2)\n anovaftest: function anovaftest() {\n var args = slice.call(arguments),\n df1, df2, n, i;\n if (isNumber(args[0])) {\n return 1 - jStat.centralF.cdf(args[0], args[1], args[2]);\n }\n var anovafscore = jStat.anovafscore(args);\n df1 = args.length - 1;\n n = 0;\n for (i = 0; i < args.length; i++) {\n n = n + args[i].length;\n }\n df2 = n - df1 - 1;\n return 1 - jStat.centralF.cdf(anovafscore, df1, df2);\n },\n\n ftest: function ftest(fscore, df1, df2) {\n return 1 - jStat.centralF.cdf(fscore, df1, df2);\n }\n});\n\njStat.extend(jStat.fn, {\n anovafscore: function anovafscore() {\n return jStat.anovafscore(this.toArray());\n },\n\n anovaftes: function anovaftes() {\n var n = 0;\n var i;\n for (i = 0; i < this.length; i++) {\n n = n + this[i].length;\n }\n return jStat.ftest(this.anovafscore(), this.length - 1, n - this.length);\n }\n});\n\n// Tukey's range test\njStat.extend({\n // 2 parameter lists\n // (mean1, mean2, n1, n2, sd)\n // (array1, array2, sd)\n qscore: function qscore() {\n var args = slice.call(arguments);\n var mean1, mean2, n1, n2, sd;\n if (isNumber(args[0])) {\n mean1 = args[0];\n mean2 = args[1];\n n1 = args[2];\n n2 = args[3];\n sd = args[4];\n } else {\n mean1 = jStat.mean(args[0]);\n mean2 = jStat.mean(args[1]);\n n1 = args[0].length;\n n2 = args[1].length;\n sd = args[2];\n }\n return Math.abs(mean1 - mean2) / (sd * Math.sqrt((1 / n1 + 1 / n2) / 2));\n },\n\n // 3 different parameter lists:\n // (qscore, n, k)\n // (mean1, mean2, n1, n2, sd, n, k)\n // (array1, array2, sd, n, k)\n qtest: function qtest() {\n var args = slice.call(arguments);\n\n var qscore;\n if (args.length === 3) {\n qscore = args[0];\n args = args.slice(1);\n } else if (args.length === 7) {\n qscore = jStat.qscore(args[0], args[1], args[2], args[3], args[4]);\n args = args.slice(5);\n } else {\n qscore = jStat.qscore(args[0], args[1], args[2]);\n args = args.slice(3);\n }\n\n var n = args[0];\n var k = args[1];\n\n return 1 - jStat.tukey.cdf(qscore, k, n - k);\n },\n\n tukeyhsd: function tukeyhsd(arrays) {\n var sd = jStat.pooledstdev(arrays);\n var means = arrays.map(function (arr) {return jStat.mean(arr);});\n var n = arrays.reduce(function (n, arr) {return n + arr.length;}, 0);\n\n var results = [];\n for (var i = 0; i < arrays.length; ++i) {\n for (var j = i + 1; j < arrays.length; ++j) {\n var p = jStat.qtest(means[i], means[j], arrays[i].length, arrays[j].length, sd, n, arrays.length);\n results.push([[i, j], p]);\n }\n }\n\n return results;\n }\n});\n\n// Error Bounds\njStat.extend({\n // 2 different parameter setups\n // (value, alpha, sd, n)\n // (value, alpha, array)\n normalci: function normalci() {\n var args = slice.call(arguments),\n ans = new Array(2),\n change;\n if (args.length === 4) {\n change = Math.abs(jStat.normal.inv(args[1] / 2, 0, 1) *\n args[2] / Math.sqrt(args[3]));\n } else {\n change = Math.abs(jStat.normal.inv(args[1] / 2, 0, 1) *\n jStat.stdev(args[2]) / Math.sqrt(args[2].length));\n }\n ans[0] = args[0] - change;\n ans[1] = args[0] + change;\n return ans;\n },\n\n // 2 different parameter setups\n // (value, alpha, sd, n)\n // (value, alpha, array)\n tci: function tci() {\n var args = slice.call(arguments),\n ans = new Array(2),\n change;\n if (args.length === 4) {\n change = Math.abs(jStat.studentt.inv(args[1] / 2, args[3] - 1) *\n args[2] / Math.sqrt(args[3]));\n } else {\n change = Math.abs(jStat.studentt.inv(args[1] / 2, args[2].length - 1) *\n jStat.stdev(args[2], true) / Math.sqrt(args[2].length));\n }\n ans[0] = args[0] - change;\n ans[1] = args[0] + change;\n return ans;\n },\n\n significant: function significant(pvalue, alpha) {\n return pvalue < alpha;\n }\n});\n\njStat.extend(jStat.fn, {\n normalci: function normalci(value, alpha) {\n return jStat.normalci(value, alpha, this.toArray());\n },\n\n tci: function tci(value, alpha) {\n return jStat.tci(value, alpha, this.toArray());\n }\n});\n\n// internal method for calculating the z-score for a difference of proportions test\nfunction differenceOfProportions(p1, n1, p2, n2) {\n if (p1 > 1 || p2 > 1 || p1 <= 0 || p2 <= 0) {\n throw new Error(\"Proportions should be greater than 0 and less than 1\")\n }\n var pooled = (p1 * n1 + p2 * n2) / (n1 + n2);\n var se = Math.sqrt(pooled * (1 - pooled) * ((1/n1) + (1/n2)));\n return (p1 - p2) / se;\n}\n\n// Difference of Proportions\njStat.extend(jStat.fn, {\n oneSidedDifferenceOfProportions: function oneSidedDifferenceOfProportions(p1, n1, p2, n2) {\n var z = differenceOfProportions(p1, n1, p2, n2);\n return jStat.ztest(z, 1);\n },\n\n twoSidedDifferenceOfProportions: function twoSidedDifferenceOfProportions(p1, n1, p2, n2) {\n var z = differenceOfProportions(p1, n1, p2, n2);\n return jStat.ztest(z, 2);\n }\n});\n\n}(jStat, Math));\njStat.models = (function(){\n function sub_regress(exog) {\n var var_count = exog[0].length;\n var modelList = jStat.arange(var_count).map(function(endog_index) {\n var exog_index =\n jStat.arange(var_count).filter(function(i){return i!==endog_index});\n return ols(jStat.col(exog, endog_index).map(function(x){ return x[0] }),\n jStat.col(exog, exog_index))\n });\n return modelList;\n }\n\n // do OLS model regress\n // exog have include const columns ,it will not generate it .In fact, exog is\n // \"design matrix\" look at\n //https://en.wikipedia.org/wiki/Design_matrix\n function ols(endog, exog) {\n var nobs = endog.length;\n var df_model = exog[0].length - 1;\n var df_resid = nobs-df_model - 1;\n var coef = jStat.lstsq(exog, endog);\n var predict =\n jStat.multiply(exog, coef.map(function(x) { return [x] }))\n .map(function(p) { return p[0] });\n var resid = jStat.subtract(endog, predict);\n var ybar = jStat.mean(endog);\n // constant cause problem\n // var SST = jStat.sum(endog.map(function(y) {\n // return Math.pow(y-ybar,2);\n // }));\n var SSE = jStat.sum(predict.map(function(f) {\n return Math.pow(f - ybar, 2);\n }));\n var SSR = jStat.sum(endog.map(function(y, i) {\n return Math.pow(y - predict[i], 2);\n }));\n var SST = SSE + SSR;\n var R2 = (SSE / SST);\n return {\n exog:exog,\n endog:endog,\n nobs:nobs,\n df_model:df_model,\n df_resid:df_resid,\n coef:coef,\n predict:predict,\n resid:resid,\n ybar:ybar,\n SST:SST,\n SSE:SSE,\n SSR:SSR,\n R2:R2\n };\n }\n\n // H0: b_I=0\n // H1: b_I!=0\n function t_test(model) {\n var subModelList = sub_regress(model.exog);\n //var sigmaHat=jStat.stdev(model.resid);\n var sigmaHat = Math.sqrt(model.SSR / (model.df_resid));\n var seBetaHat = subModelList.map(function(mod) {\n var SST = mod.SST;\n var R2 = mod.R2;\n return sigmaHat / Math.sqrt(SST * (1 - R2));\n });\n var tStatistic = model.coef.map(function(coef, i) {\n return (coef - 0) / seBetaHat[i];\n });\n var pValue = tStatistic.map(function(t) {\n var leftppf = jStat.studentt.cdf(t, model.df_resid);\n return (leftppf > 0.5 ? 1 - leftppf : leftppf) * 2;\n });\n var c = jStat.studentt.inv(0.975, model.df_resid);\n var interval95 = model.coef.map(function(coef, i) {\n var d = c * seBetaHat[i];\n return [coef - d, coef + d];\n })\n return {\n se: seBetaHat,\n t: tStatistic,\n p: pValue,\n sigmaHat: sigmaHat,\n interval95: interval95\n };\n }\n\n function F_test(model) {\n var F_statistic =\n (model.R2 / model.df_model) / ((1 - model.R2) / model.df_resid);\n var fcdf = function(x, n1, n2) {\n return jStat.beta.cdf(x / (n2 / n1 + x), n1 / 2, n2 / 2)\n }\n var pvalue = 1 - fcdf(F_statistic, model.df_model, model.df_resid);\n return { F_statistic: F_statistic, pvalue: pvalue };\n }\n\n function ols_wrap(endog, exog) {\n var model = ols(endog,exog);\n var ttest = t_test(model);\n var ftest = F_test(model);\n // Provide the Wherry / Ezekiel / McNemar / Cohen Adjusted R^2\n // Which matches the 'adjusted R^2' provided by R's lm package\n var adjust_R2 =\n 1 - (1 - model.R2) * ((model.nobs - 1) / (model.df_resid));\n model.t = ttest;\n model.f = ftest;\n model.adjust_R2 = adjust_R2;\n return model;\n }\n\n return { ols: ols_wrap };\n})();\n//To regress, simply build X matrix\n//(append column of 1's) using\n//buildxmatrix and build the Y\n//matrix using buildymatrix\n//(simply the transpose)\n//and run regress.\n\n\n\n//Regressions\n\njStat.extend({\n buildxmatrix: function buildxmatrix(){\n //Parameters will be passed in as such\n //(array1,array2,array3,...)\n //as (x1,x2,x3,...)\n //needs to be (1,x1,x2,x3,...)\n var matrixRows = new Array(arguments.length);\n for(var i=0;i1){\n result = [];\n for (i = 0; i < A.rows(); i++) {\n result[i] = [];\n for (j = 0; j < B.cols(); j++) {\n sum = 0;\n for (k = 0; k < A.cols(); k++) {\n sum += A.toArray()[i][k] * B.toArray()[k][j];\n }\n result[i][j] = sum;\n }\n }\n return jStat(result);\n }\n result = [];\n for (i = 0; i < A.rows(); i++) {\n result[i] = [];\n for (j = 0; j < B.cols(); j++) {\n sum = 0;\n for (k = 0; k < A.cols(); k++) {\n sum += A.toArray()[i][k] * B.toArray()[j];\n }\n result[i][j] = sum;\n }\n }\n return jStat(result);\n }\n },\n\n //regress and regresst to be fixed\n\n regress: function regress(jMatX,jMatY){\n //print(\"regressin!\");\n //print(jMatX.toArray());\n var innerinv = jStat.xtranspxinv(jMatX);\n //print(innerinv);\n var xtransp = jMatX.transpose();\n var next = jStat.matrixmult(jStat(innerinv),xtransp);\n return jStat.matrixmult(next,jMatY);\n\n },\n\n regresst: function regresst(jMatX,jMatY,sides){\n var beta = jStat.regress(jMatX,jMatY);\n\n var compile = {};\n compile.anova = {};\n var jMatYBar = jStat.jMatYBar(jMatX, beta);\n compile.yBar = jMatYBar;\n var yAverage = jMatY.mean();\n compile.anova.residuals = jStat.residuals(jMatY, jMatYBar);\n\n compile.anova.ssr = jStat.ssr(jMatYBar, yAverage);\n compile.anova.msr = compile.anova.ssr / (jMatX[0].length - 1);\n\n compile.anova.sse = jStat.sse(jMatY, jMatYBar);\n compile.anova.mse =\n compile.anova.sse / (jMatY.length - (jMatX[0].length - 1) - 1);\n\n compile.anova.sst = jStat.sst(jMatY, yAverage);\n compile.anova.mst = compile.anova.sst / (jMatY.length - 1);\n\n compile.anova.r2 = 1 - (compile.anova.sse / compile.anova.sst);\n if (compile.anova.r2 < 0) compile.anova.r2 = 0;\n\n compile.anova.fratio = compile.anova.msr / compile.anova.mse;\n compile.anova.pvalue =\n jStat.anovaftest(compile.anova.fratio,\n jMatX[0].length - 1,\n jMatY.length - (jMatX[0].length - 1) - 1);\n\n compile.anova.rmse = Math.sqrt(compile.anova.mse);\n\n compile.anova.r2adj = 1 - (compile.anova.mse / compile.anova.mst);\n if (compile.anova.r2adj < 0) compile.anova.r2adj = 0;\n\n compile.stats = new Array(jMatX[0].length);\n var covar = jStat.xtranspxinv(jMatX);\n var sds, ts, ps;\n\n for(var i=0; i {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","function none() {}\n\nexport default function(selector) {\n return selector == null ? none : function() {\n return this.querySelector(selector);\n };\n}\n","function empty() {\n return [];\n}\n\nexport default function(selector) {\n return selector == null ? empty : function() {\n return this.querySelectorAll(selector);\n };\n}\n","export default function(selector) {\n return function() {\n return this.matches(selector);\n };\n}\n\nexport function childMatcher(selector) {\n return function(node) {\n return node.matches(selector);\n };\n}\n\n","import {childMatcher} from \"../matcher.js\";\n\nvar find = Array.prototype.find;\n\nfunction childFind(match) {\n return function() {\n return find.call(this.children, match);\n };\n}\n\nfunction childFirst() {\n return this.firstElementChild;\n}\n\nexport default function(match) {\n return this.select(match == null ? childFirst\n : childFind(typeof match === \"function\" ? match : childMatcher(match)));\n}\n","import {childMatcher} from \"../matcher.js\";\n\nvar filter = Array.prototype.filter;\n\nfunction children() {\n return Array.from(this.children);\n}\n\nfunction childrenFilter(match) {\n return function() {\n return filter.call(this.children, match);\n };\n}\n\nexport default function(match) {\n return this.selectAll(match == null ? children\n : childrenFilter(typeof match === \"function\" ? match : childMatcher(match)));\n}\n","export default function(update) {\n return new Array(update.length);\n}\n","import sparse from \"./sparse.js\";\nimport {Selection} from \"./index.js\";\n\nexport default function() {\n return new Selection(this._enter || this._groups.map(sparse), this._parents);\n}\n\nexport function EnterNode(parent, datum) {\n this.ownerDocument = parent.ownerDocument;\n this.namespaceURI = parent.namespaceURI;\n this._next = null;\n this._parent = parent;\n this.__data__ = datum;\n}\n\nEnterNode.prototype = {\n constructor: EnterNode,\n appendChild: function(child) { return this._parent.insertBefore(child, this._next); },\n insertBefore: function(child, next) { return this._parent.insertBefore(child, next); },\n querySelector: function(selector) { return this._parent.querySelector(selector); },\n querySelectorAll: function(selector) { return this._parent.querySelectorAll(selector); }\n};\n","import {Selection} from \"./index.js\";\nimport {EnterNode} from \"./enter.js\";\nimport constant from \"../constant.js\";\n\nfunction bindIndex(parent, group, enter, update, exit, data) {\n var i = 0,\n node,\n groupLength = group.length,\n dataLength = data.length;\n\n // Put any non-null nodes that fit into update.\n // Put any null nodes into enter.\n // Put any remaining data into enter.\n for (; i < dataLength; ++i) {\n if (node = group[i]) {\n node.__data__ = data[i];\n update[i] = node;\n } else {\n enter[i] = new EnterNode(parent, data[i]);\n }\n }\n\n // Put any non-null nodes that don’t fit into exit.\n for (; i < groupLength; ++i) {\n if (node = group[i]) {\n exit[i] = node;\n }\n }\n}\n\nfunction bindKey(parent, group, enter, update, exit, data, key) {\n var i,\n node,\n nodeByKeyValue = new Map,\n groupLength = group.length,\n dataLength = data.length,\n keyValues = new Array(groupLength),\n keyValue;\n\n // Compute the key for each node.\n // If multiple nodes have the same key, the duplicates are added to exit.\n for (i = 0; i < groupLength; ++i) {\n if (node = group[i]) {\n keyValues[i] = keyValue = key.call(node, node.__data__, i, group) + \"\";\n if (nodeByKeyValue.has(keyValue)) {\n exit[i] = node;\n } else {\n nodeByKeyValue.set(keyValue, node);\n }\n }\n }\n\n // Compute the key for each datum.\n // If there a node associated with this key, join and add it to update.\n // If there is not (or the key is a duplicate), add it to enter.\n for (i = 0; i < dataLength; ++i) {\n keyValue = key.call(parent, data[i], i, data) + \"\";\n if (node = nodeByKeyValue.get(keyValue)) {\n update[i] = node;\n node.__data__ = data[i];\n nodeByKeyValue.delete(keyValue);\n } else {\n enter[i] = new EnterNode(parent, data[i]);\n }\n }\n\n // Add any remaining nodes that were not bound to data to exit.\n for (i = 0; i < groupLength; ++i) {\n if ((node = group[i]) && (nodeByKeyValue.get(keyValues[i]) === node)) {\n exit[i] = node;\n }\n }\n}\n\nfunction datum(node) {\n return node.__data__;\n}\n\nexport default function(value, key) {\n if (!arguments.length) return Array.from(this, datum);\n\n var bind = key ? bindKey : bindIndex,\n parents = this._parents,\n groups = this._groups;\n\n if (typeof value !== \"function\") value = constant(value);\n\n for (var m = groups.length, update = new Array(m), enter = new Array(m), exit = new Array(m), j = 0; j < m; ++j) {\n var parent = parents[j],\n group = groups[j],\n groupLength = group.length,\n data = arraylike(value.call(parent, parent && parent.__data__, j, parents)),\n dataLength = data.length,\n enterGroup = enter[j] = new Array(dataLength),\n updateGroup = update[j] = new Array(dataLength),\n exitGroup = exit[j] = new Array(groupLength);\n\n bind(parent, group, enterGroup, updateGroup, exitGroup, data, key);\n\n // Now connect the enter nodes to their following update node, such that\n // appendChild can insert the materialized enter node before this node,\n // rather than at the end of the parent node.\n for (var i0 = 0, i1 = 0, previous, next; i0 < dataLength; ++i0) {\n if (previous = enterGroup[i0]) {\n if (i0 >= i1) i1 = i0 + 1;\n while (!(next = updateGroup[i1]) && ++i1 < dataLength);\n previous._next = next || null;\n }\n }\n }\n\n update = new Selection(update, parents);\n update._enter = enter;\n update._exit = exit;\n return update;\n}\n\n// Given some data, this returns an array-like view of it: an object that\n// exposes a length property and allows numeric indexing. Note that unlike\n// selectAll, this isn’t worried about “live” collections because the resulting\n// array will only be used briefly while data is being bound. (It is possible to\n// cause the data to change while iterating by using a key function, but please\n// don’t; we’d rather avoid a gratuitous copy.)\nfunction arraylike(data) {\n return typeof data === \"object\" && \"length\" in data\n ? data // Array, TypedArray, NodeList, array-like\n : Array.from(data); // Map, Set, iterable, string, or anything else\n}\n","import {Selection} from \"./index.js\";\n\nexport default function(compare) {\n if (!compare) compare = ascending;\n\n function compareNode(a, b) {\n return a && b ? compare(a.__data__, b.__data__) : !a - !b;\n }\n\n for (var groups = this._groups, m = groups.length, sortgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, sortgroup = sortgroups[j] = new Array(n), node, i = 0; i < n; ++i) {\n if (node = group[i]) {\n sortgroup[i] = node;\n }\n }\n sortgroup.sort(compareNode);\n }\n\n return new Selection(sortgroups, this._parents).order();\n}\n\nfunction ascending(a, b) {\n return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;\n}\n","export var xhtml = \"http://www.w3.org/1999/xhtml\";\n\nexport default {\n svg: \"http://www.w3.org/2000/svg\",\n xhtml: xhtml,\n xlink: \"http://www.w3.org/1999/xlink\",\n xml: \"http://www.w3.org/XML/1998/namespace\",\n xmlns: \"http://www.w3.org/2000/xmlns/\"\n};\n","import namespaces from \"./namespaces.js\";\n\nexport default function(name) {\n var prefix = name += \"\", i = prefix.indexOf(\":\");\n if (i >= 0 && (prefix = name.slice(0, i)) !== \"xmlns\") name = name.slice(i + 1);\n return namespaces.hasOwnProperty(prefix) ? {space: namespaces[prefix], local: name} : name; // eslint-disable-line no-prototype-builtins\n}\n","import namespace from \"../namespace.js\";\n\nfunction attrRemove(name) {\n return function() {\n this.removeAttribute(name);\n };\n}\n\nfunction attrRemoveNS(fullname) {\n return function() {\n this.removeAttributeNS(fullname.space, fullname.local);\n };\n}\n\nfunction attrConstant(name, value) {\n return function() {\n this.setAttribute(name, value);\n };\n}\n\nfunction attrConstantNS(fullname, value) {\n return function() {\n this.setAttributeNS(fullname.space, fullname.local, value);\n };\n}\n\nfunction attrFunction(name, value) {\n return function() {\n var v = value.apply(this, arguments);\n if (v == null) this.removeAttribute(name);\n else this.setAttribute(name, v);\n };\n}\n\nfunction attrFunctionNS(fullname, value) {\n return function() {\n var v = value.apply(this, arguments);\n if (v == null) this.removeAttributeNS(fullname.space, fullname.local);\n else this.setAttributeNS(fullname.space, fullname.local, v);\n };\n}\n\nexport default function(name, value) {\n var fullname = namespace(name);\n\n if (arguments.length < 2) {\n var node = this.node();\n return fullname.local\n ? node.getAttributeNS(fullname.space, fullname.local)\n : node.getAttribute(fullname);\n }\n\n return this.each((value == null\n ? (fullname.local ? attrRemoveNS : attrRemove) : (typeof value === \"function\"\n ? (fullname.local ? attrFunctionNS : attrFunction)\n : (fullname.local ? attrConstantNS : attrConstant)))(fullname, value));\n}\n","export default function(node) {\n return (node.ownerDocument && node.ownerDocument.defaultView) // node is a Node\n || (node.document && node) // node is a Window\n || node.defaultView; // node is a Document\n}\n","import defaultView from \"../window.js\";\n\nfunction styleRemove(name) {\n return function() {\n this.style.removeProperty(name);\n };\n}\n\nfunction styleConstant(name, value, priority) {\n return function() {\n this.style.setProperty(name, value, priority);\n };\n}\n\nfunction styleFunction(name, value, priority) {\n return function() {\n var v = value.apply(this, arguments);\n if (v == null) this.style.removeProperty(name);\n else this.style.setProperty(name, v, priority);\n };\n}\n\nexport default function(name, value, priority) {\n return arguments.length > 1\n ? this.each((value == null\n ? styleRemove : typeof value === \"function\"\n ? styleFunction\n : styleConstant)(name, value, priority == null ? \"\" : priority))\n : styleValue(this.node(), name);\n}\n\nexport function styleValue(node, name) {\n return node.style.getPropertyValue(name)\n || defaultView(node).getComputedStyle(node, null).getPropertyValue(name);\n}\n","function propertyRemove(name) {\n return function() {\n delete this[name];\n };\n}\n\nfunction propertyConstant(name, value) {\n return function() {\n this[name] = value;\n };\n}\n\nfunction propertyFunction(name, value) {\n return function() {\n var v = value.apply(this, arguments);\n if (v == null) delete this[name];\n else this[name] = v;\n };\n}\n\nexport default function(name, value) {\n return arguments.length > 1\n ? this.each((value == null\n ? propertyRemove : typeof value === \"function\"\n ? propertyFunction\n : propertyConstant)(name, value))\n : this.node()[name];\n}\n","function classArray(string) {\n return string.trim().split(/^|\\s+/);\n}\n\nfunction classList(node) {\n return node.classList || new ClassList(node);\n}\n\nfunction ClassList(node) {\n this._node = node;\n this._names = classArray(node.getAttribute(\"class\") || \"\");\n}\n\nClassList.prototype = {\n add: function(name) {\n var i = this._names.indexOf(name);\n if (i < 0) {\n this._names.push(name);\n this._node.setAttribute(\"class\", this._names.join(\" \"));\n }\n },\n remove: function(name) {\n var i = this._names.indexOf(name);\n if (i >= 0) {\n this._names.splice(i, 1);\n this._node.setAttribute(\"class\", this._names.join(\" \"));\n }\n },\n contains: function(name) {\n return this._names.indexOf(name) >= 0;\n }\n};\n\nfunction classedAdd(node, names) {\n var list = classList(node), i = -1, n = names.length;\n while (++i < n) list.add(names[i]);\n}\n\nfunction classedRemove(node, names) {\n var list = classList(node), i = -1, n = names.length;\n while (++i < n) list.remove(names[i]);\n}\n\nfunction classedTrue(names) {\n return function() {\n classedAdd(this, names);\n };\n}\n\nfunction classedFalse(names) {\n return function() {\n classedRemove(this, names);\n };\n}\n\nfunction classedFunction(names, value) {\n return function() {\n (value.apply(this, arguments) ? classedAdd : classedRemove)(this, names);\n };\n}\n\nexport default function(name, value) {\n var names = classArray(name + \"\");\n\n if (arguments.length < 2) {\n var list = classList(this.node()), i = -1, n = names.length;\n while (++i < n) if (!list.contains(names[i])) return false;\n return true;\n }\n\n return this.each((typeof value === \"function\"\n ? classedFunction : value\n ? classedTrue\n : classedFalse)(names, value));\n}\n","function textRemove() {\n this.textContent = \"\";\n}\n\nfunction textConstant(value) {\n return function() {\n this.textContent = value;\n };\n}\n\nfunction textFunction(value) {\n return function() {\n var v = value.apply(this, arguments);\n this.textContent = v == null ? \"\" : v;\n };\n}\n\nexport default function(value) {\n return arguments.length\n ? this.each(value == null\n ? textRemove : (typeof value === \"function\"\n ? textFunction\n : textConstant)(value))\n : this.node().textContent;\n}\n","function htmlRemove() {\n this.innerHTML = \"\";\n}\n\nfunction htmlConstant(value) {\n return function() {\n this.innerHTML = value;\n };\n}\n\nfunction htmlFunction(value) {\n return function() {\n var v = value.apply(this, arguments);\n this.innerHTML = v == null ? \"\" : v;\n };\n}\n\nexport default function(value) {\n return arguments.length\n ? this.each(value == null\n ? htmlRemove : (typeof value === \"function\"\n ? htmlFunction\n : htmlConstant)(value))\n : this.node().innerHTML;\n}\n","function raise() {\n if (this.nextSibling) this.parentNode.appendChild(this);\n}\n\nexport default function() {\n return this.each(raise);\n}\n","function lower() {\n if (this.previousSibling) this.parentNode.insertBefore(this, this.parentNode.firstChild);\n}\n\nexport default function() {\n return this.each(lower);\n}\n","import namespace from \"./namespace.js\";\nimport {xhtml} from \"./namespaces.js\";\n\nfunction creatorInherit(name) {\n return function() {\n var document = this.ownerDocument,\n uri = this.namespaceURI;\n return uri === xhtml && document.documentElement.namespaceURI === xhtml\n ? document.createElement(name)\n : document.createElementNS(uri, name);\n };\n}\n\nfunction creatorFixed(fullname) {\n return function() {\n return this.ownerDocument.createElementNS(fullname.space, fullname.local);\n };\n}\n\nexport default function(name) {\n var fullname = namespace(name);\n return (fullname.local\n ? creatorFixed\n : creatorInherit)(fullname);\n}\n","import creator from \"../creator.js\";\nimport selector from \"../selector.js\";\n\nfunction constantNull() {\n return null;\n}\n\nexport default function(name, before) {\n var create = typeof name === \"function\" ? name : creator(name),\n select = before == null ? constantNull : typeof before === \"function\" ? before : selector(before);\n return this.select(function() {\n return this.insertBefore(create.apply(this, arguments), select.apply(this, arguments) || null);\n });\n}\n","function remove() {\n var parent = this.parentNode;\n if (parent) parent.removeChild(this);\n}\n\nexport default function() {\n return this.each(remove);\n}\n","function selection_cloneShallow() {\n var clone = this.cloneNode(false), parent = this.parentNode;\n return parent ? parent.insertBefore(clone, this.nextSibling) : clone;\n}\n\nfunction selection_cloneDeep() {\n var clone = this.cloneNode(true), parent = this.parentNode;\n return parent ? parent.insertBefore(clone, this.nextSibling) : clone;\n}\n\nexport default function(deep) {\n return this.select(deep ? selection_cloneDeep : selection_cloneShallow);\n}\n","function contextListener(listener) {\n return function(event) {\n listener.call(this, event, this.__data__);\n };\n}\n\nfunction parseTypenames(typenames) {\n return typenames.trim().split(/^|\\s+/).map(function(t) {\n var name = \"\", i = t.indexOf(\".\");\n if (i >= 0) name = t.slice(i + 1), t = t.slice(0, i);\n return {type: t, name: name};\n });\n}\n\nfunction onRemove(typename) {\n return function() {\n var on = this.__on;\n if (!on) return;\n for (var j = 0, i = -1, m = on.length, o; j < m; ++j) {\n if (o = on[j], (!typename.type || o.type === typename.type) && o.name === typename.name) {\n this.removeEventListener(o.type, o.listener, o.options);\n } else {\n on[++i] = o;\n }\n }\n if (++i) on.length = i;\n else delete this.__on;\n };\n}\n\nfunction onAdd(typename, value, options) {\n return function() {\n var on = this.__on, o, listener = contextListener(value);\n if (on) for (var j = 0, m = on.length; j < m; ++j) {\n if ((o = on[j]).type === typename.type && o.name === typename.name) {\n this.removeEventListener(o.type, o.listener, o.options);\n this.addEventListener(o.type, o.listener = listener, o.options = options);\n o.value = value;\n return;\n }\n }\n this.addEventListener(typename.type, listener, options);\n o = {type: typename.type, name: typename.name, value: value, listener: listener, options: options};\n if (!on) this.__on = [o];\n else on.push(o);\n };\n}\n\nexport default function(typename, value, options) {\n var typenames = parseTypenames(typename + \"\"), i, n = typenames.length, t;\n\n if (arguments.length < 2) {\n var on = this.node().__on;\n if (on) for (var j = 0, m = on.length, o; j < m; ++j) {\n for (i = 0, o = on[j]; i < n; ++i) {\n if ((t = typenames[i]).type === o.type && t.name === o.name) {\n return o.value;\n }\n }\n }\n return;\n }\n\n on = value ? onAdd : onRemove;\n for (i = 0; i < n; ++i) this.each(on(typenames[i], value, options));\n return this;\n}\n","import defaultView from \"../window.js\";\n\nfunction dispatchEvent(node, type, params) {\n var window = defaultView(node),\n event = window.CustomEvent;\n\n if (typeof event === \"function\") {\n event = new event(type, params);\n } else {\n event = window.document.createEvent(\"Event\");\n if (params) event.initEvent(type, params.bubbles, params.cancelable), event.detail = params.detail;\n else event.initEvent(type, false, false);\n }\n\n node.dispatchEvent(event);\n}\n\nfunction dispatchConstant(type, params) {\n return function() {\n return dispatchEvent(this, type, params);\n };\n}\n\nfunction dispatchFunction(type, params) {\n return function() {\n return dispatchEvent(this, type, params.apply(this, arguments));\n };\n}\n\nexport default function(type, params) {\n return this.each((typeof params === \"function\"\n ? dispatchFunction\n : dispatchConstant)(type, params));\n}\n","import selection_select from \"./select.js\";\nimport selection_selectAll from \"./selectAll.js\";\nimport selection_selectChild from \"./selectChild.js\";\nimport selection_selectChildren from \"./selectChildren.js\";\nimport selection_filter from \"./filter.js\";\nimport selection_data from \"./data.js\";\nimport selection_enter from \"./enter.js\";\nimport selection_exit from \"./exit.js\";\nimport selection_join from \"./join.js\";\nimport selection_merge from \"./merge.js\";\nimport selection_order from \"./order.js\";\nimport selection_sort from \"./sort.js\";\nimport selection_call from \"./call.js\";\nimport selection_nodes from \"./nodes.js\";\nimport selection_node from \"./node.js\";\nimport selection_size from \"./size.js\";\nimport selection_empty from \"./empty.js\";\nimport selection_each from \"./each.js\";\nimport selection_attr from \"./attr.js\";\nimport selection_style from \"./style.js\";\nimport selection_property from \"./property.js\";\nimport selection_classed from \"./classed.js\";\nimport selection_text from \"./text.js\";\nimport selection_html from \"./html.js\";\nimport selection_raise from \"./raise.js\";\nimport selection_lower from \"./lower.js\";\nimport selection_append from \"./append.js\";\nimport selection_insert from \"./insert.js\";\nimport selection_remove from \"./remove.js\";\nimport selection_clone from \"./clone.js\";\nimport selection_datum from \"./datum.js\";\nimport selection_on from \"./on.js\";\nimport selection_dispatch from \"./dispatch.js\";\nimport selection_iterator from \"./iterator.js\";\n\nexport var root = [null];\n\nexport function Selection(groups, parents) {\n this._groups = groups;\n this._parents = parents;\n}\n\nfunction selection() {\n return new Selection([[document.documentElement]], root);\n}\n\nfunction selection_selection() {\n return this;\n}\n\nSelection.prototype = selection.prototype = {\n constructor: Selection,\n select: selection_select,\n selectAll: selection_selectAll,\n selectChild: selection_selectChild,\n selectChildren: selection_selectChildren,\n filter: selection_filter,\n data: selection_data,\n enter: selection_enter,\n exit: selection_exit,\n join: selection_join,\n merge: selection_merge,\n selection: selection_selection,\n order: selection_order,\n sort: selection_sort,\n call: selection_call,\n nodes: selection_nodes,\n node: selection_node,\n size: selection_size,\n empty: selection_empty,\n each: selection_each,\n attr: selection_attr,\n style: selection_style,\n property: selection_property,\n classed: selection_classed,\n text: selection_text,\n html: selection_html,\n raise: selection_raise,\n lower: selection_lower,\n append: selection_append,\n insert: selection_insert,\n remove: selection_remove,\n clone: selection_clone,\n datum: selection_datum,\n on: selection_on,\n dispatch: selection_dispatch,\n [Symbol.iterator]: selection_iterator\n};\n\nexport default selection;\n","import {Selection} from \"./index.js\";\nimport selector from \"../selector.js\";\n\nexport default function(select) {\n if (typeof select !== \"function\") select = selector(select);\n\n for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, subgroup = subgroups[j] = new Array(n), node, subnode, i = 0; i < n; ++i) {\n if ((node = group[i]) && (subnode = select.call(node, node.__data__, i, group))) {\n if (\"__data__\" in node) subnode.__data__ = node.__data__;\n subgroup[i] = subnode;\n }\n }\n }\n\n return new Selection(subgroups, this._parents);\n}\n","import {Selection} from \"./index.js\";\nimport array from \"../array.js\";\nimport selectorAll from \"../selectorAll.js\";\n\nfunction arrayAll(select) {\n return function() {\n return array(select.apply(this, arguments));\n };\n}\n\nexport default function(select) {\n if (typeof select === \"function\") select = arrayAll(select);\n else select = selectorAll(select);\n\n for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {\n if (node = group[i]) {\n subgroups.push(select.call(node, node.__data__, i, group));\n parents.push(node);\n }\n }\n }\n\n return new Selection(subgroups, parents);\n}\n","// Given something array like (or null), returns something that is strictly an\n// array. This is used to ensure that array-like objects passed to d3.selectAll\n// or selection.selectAll are converted into proper arrays when creating a\n// selection; we don’t ever want to create a selection backed by a live\n// HTMLCollection or NodeList. However, note that selection.selectAll will use a\n// static NodeList as a group, since it safely derived from querySelectorAll.\nexport default function array(x) {\n return x == null ? [] : Array.isArray(x) ? x : Array.from(x);\n}\n","import {Selection} from \"./index.js\";\nimport matcher from \"../matcher.js\";\n\nexport default function(match) {\n if (typeof match !== \"function\") match = matcher(match);\n\n for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, subgroup = subgroups[j] = [], node, i = 0; i < n; ++i) {\n if ((node = group[i]) && match.call(node, node.__data__, i, group)) {\n subgroup.push(node);\n }\n }\n }\n\n return new Selection(subgroups, this._parents);\n}\n","export default function(x) {\n return function() {\n return x;\n };\n}\n","import sparse from \"./sparse.js\";\nimport {Selection} from \"./index.js\";\n\nexport default function() {\n return new Selection(this._exit || this._groups.map(sparse), this._parents);\n}\n","export default function(onenter, onupdate, onexit) {\n var enter = this.enter(), update = this, exit = this.exit();\n if (typeof onenter === \"function\") {\n enter = onenter(enter);\n if (enter) enter = enter.selection();\n } else {\n enter = enter.append(onenter + \"\");\n }\n if (onupdate != null) {\n update = onupdate(update);\n if (update) update = update.selection();\n }\n if (onexit == null) exit.remove(); else onexit(exit);\n return enter && update ? enter.merge(update).order() : update;\n}\n","import {Selection} from \"./index.js\";\n\nexport default function(context) {\n var selection = context.selection ? context.selection() : context;\n\n for (var groups0 = this._groups, groups1 = selection._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j = 0; j < m; ++j) {\n for (var group0 = groups0[j], group1 = groups1[j], n = group0.length, merge = merges[j] = new Array(n), node, i = 0; i < n; ++i) {\n if (node = group0[i] || group1[i]) {\n merge[i] = node;\n }\n }\n }\n\n for (; j < m0; ++j) {\n merges[j] = groups0[j];\n }\n\n return new Selection(merges, this._parents);\n}\n","export default function() {\n\n for (var groups = this._groups, j = -1, m = groups.length; ++j < m;) {\n for (var group = groups[j], i = group.length - 1, next = group[i], node; --i >= 0;) {\n if (node = group[i]) {\n if (next && node.compareDocumentPosition(next) ^ 4) next.parentNode.insertBefore(node, next);\n next = node;\n }\n }\n }\n\n return this;\n}\n","export default function() {\n var callback = arguments[0];\n arguments[0] = this;\n callback.apply(null, arguments);\n return this;\n}\n","export default function() {\n return Array.from(this);\n}\n","export default function() {\n\n for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {\n for (var group = groups[j], i = 0, n = group.length; i < n; ++i) {\n var node = group[i];\n if (node) return node;\n }\n }\n\n return null;\n}\n","export default function() {\n let size = 0;\n for (const node of this) ++size; // eslint-disable-line no-unused-vars\n return size;\n}\n","export default function() {\n return !this.node();\n}\n","export default function(callback) {\n\n for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {\n for (var group = groups[j], i = 0, n = group.length, node; i < n; ++i) {\n if (node = group[i]) callback.call(node, node.__data__, i, group);\n }\n }\n\n return this;\n}\n","import creator from \"../creator.js\";\n\nexport default function(name) {\n var create = typeof name === \"function\" ? name : creator(name);\n return this.select(function() {\n return this.appendChild(create.apply(this, arguments));\n });\n}\n","export default function(value) {\n return arguments.length\n ? this.property(\"__data__\", value)\n : this.node().__data__;\n}\n","export default function*() {\n for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {\n for (var group = groups[j], i = 0, n = group.length, node; i < n; ++i) {\n if (node = group[i]) yield node;\n }\n }\n}\n","var noop = {value: () => {}};\n\nfunction dispatch() {\n for (var i = 0, n = arguments.length, _ = {}, t; i < n; ++i) {\n if (!(t = arguments[i] + \"\") || (t in _) || /[\\s.]/.test(t)) throw new Error(\"illegal type: \" + t);\n _[t] = [];\n }\n return new Dispatch(_);\n}\n\nfunction Dispatch(_) {\n this._ = _;\n}\n\nfunction parseTypenames(typenames, types) {\n return typenames.trim().split(/^|\\s+/).map(function(t) {\n var name = \"\", i = t.indexOf(\".\");\n if (i >= 0) name = t.slice(i + 1), t = t.slice(0, i);\n if (t && !types.hasOwnProperty(t)) throw new Error(\"unknown type: \" + t);\n return {type: t, name: name};\n });\n}\n\nDispatch.prototype = dispatch.prototype = {\n constructor: Dispatch,\n on: function(typename, callback) {\n var _ = this._,\n T = parseTypenames(typename + \"\", _),\n t,\n i = -1,\n n = T.length;\n\n // If no callback was specified, return the callback of the given type and name.\n if (arguments.length < 2) {\n while (++i < n) if ((t = (typename = T[i]).type) && (t = get(_[t], typename.name))) return t;\n return;\n }\n\n // If a type was specified, set the callback for the given type and name.\n // Otherwise, if a null callback was specified, remove callbacks of the given name.\n if (callback != null && typeof callback !== \"function\") throw new Error(\"invalid callback: \" + callback);\n while (++i < n) {\n if (t = (typename = T[i]).type) _[t] = set(_[t], typename.name, callback);\n else if (callback == null) for (t in _) _[t] = set(_[t], typename.name, null);\n }\n\n return this;\n },\n copy: function() {\n var copy = {}, _ = this._;\n for (var t in _) copy[t] = _[t].slice();\n return new Dispatch(copy);\n },\n call: function(type, that) {\n if ((n = arguments.length - 2) > 0) for (var args = new Array(n), i = 0, n, t; i < n; ++i) args[i] = arguments[i + 2];\n if (!this._.hasOwnProperty(type)) throw new Error(\"unknown type: \" + type);\n for (t = this._[type], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args);\n },\n apply: function(type, that, args) {\n if (!this._.hasOwnProperty(type)) throw new Error(\"unknown type: \" + type);\n for (var t = this._[type], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args);\n }\n};\n\nfunction get(type, name) {\n for (var i = 0, n = type.length, c; i < n; ++i) {\n if ((c = type[i]).name === name) {\n return c.value;\n }\n }\n}\n\nfunction set(type, name, callback) {\n for (var i = 0, n = type.length; i < n; ++i) {\n if (type[i].name === name) {\n type[i] = noop, type = type.slice(0, i).concat(type.slice(i + 1));\n break;\n }\n }\n if (callback != null) type.push({name: name, value: callback});\n return type;\n}\n\nexport default dispatch;\n","var frame = 0, // is an animation frame pending?\n timeout = 0, // is a timeout pending?\n interval = 0, // are any timers active?\n pokeDelay = 1000, // how frequently we check for clock skew\n taskHead,\n taskTail,\n clockLast = 0,\n clockNow = 0,\n clockSkew = 0,\n clock = typeof performance === \"object\" && performance.now ? performance : Date,\n setFrame = typeof window === \"object\" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(f) { setTimeout(f, 17); };\n\nexport function now() {\n return clockNow || (setFrame(clearNow), clockNow = clock.now() + clockSkew);\n}\n\nfunction clearNow() {\n clockNow = 0;\n}\n\nexport function Timer() {\n this._call =\n this._time =\n this._next = null;\n}\n\nTimer.prototype = timer.prototype = {\n constructor: Timer,\n restart: function(callback, delay, time) {\n if (typeof callback !== \"function\") throw new TypeError(\"callback is not a function\");\n time = (time == null ? now() : +time) + (delay == null ? 0 : +delay);\n if (!this._next && taskTail !== this) {\n if (taskTail) taskTail._next = this;\n else taskHead = this;\n taskTail = this;\n }\n this._call = callback;\n this._time = time;\n sleep();\n },\n stop: function() {\n if (this._call) {\n this._call = null;\n this._time = Infinity;\n sleep();\n }\n }\n};\n\nexport function timer(callback, delay, time) {\n var t = new Timer;\n t.restart(callback, delay, time);\n return t;\n}\n\nexport function timerFlush() {\n now(); // Get the current time, if not already set.\n ++frame; // Pretend we’ve set an alarm, if we haven’t already.\n var t = taskHead, e;\n while (t) {\n if ((e = clockNow - t._time) >= 0) t._call.call(undefined, e);\n t = t._next;\n }\n --frame;\n}\n\nfunction wake() {\n clockNow = (clockLast = clock.now()) + clockSkew;\n frame = timeout = 0;\n try {\n timerFlush();\n } finally {\n frame = 0;\n nap();\n clockNow = 0;\n }\n}\n\nfunction poke() {\n var now = clock.now(), delay = now - clockLast;\n if (delay > pokeDelay) clockSkew -= delay, clockLast = now;\n}\n\nfunction nap() {\n var t0, t1 = taskHead, t2, time = Infinity;\n while (t1) {\n if (t1._call) {\n if (time > t1._time) time = t1._time;\n t0 = t1, t1 = t1._next;\n } else {\n t2 = t1._next, t1._next = null;\n t1 = t0 ? t0._next = t2 : taskHead = t2;\n }\n }\n taskTail = t0;\n sleep(time);\n}\n\nfunction sleep(time) {\n if (frame) return; // Soonest alarm already set, or will be.\n if (timeout) timeout = clearTimeout(timeout);\n var delay = time - clockNow; // Strictly less than if we recomputed clockNow.\n if (delay > 24) {\n if (time < Infinity) timeout = setTimeout(wake, time - clock.now() - clockSkew);\n if (interval) interval = clearInterval(interval);\n } else {\n if (!interval) clockLast = clock.now(), interval = setInterval(poke, pokeDelay);\n frame = 1, setFrame(wake);\n }\n}\n","import {Timer} from \"./timer.js\";\n\nexport default function(callback, delay, time) {\n var t = new Timer;\n delay = delay == null ? 0 : +delay;\n t.restart(elapsed => {\n t.stop();\n callback(elapsed + delay);\n }, delay, time);\n return t;\n}\n","import {dispatch} from \"d3-dispatch\";\nimport {timer, timeout} from \"d3-timer\";\n\nvar emptyOn = dispatch(\"start\", \"end\", \"cancel\", \"interrupt\");\nvar emptyTween = [];\n\nexport var CREATED = 0;\nexport var SCHEDULED = 1;\nexport var STARTING = 2;\nexport var STARTED = 3;\nexport var RUNNING = 4;\nexport var ENDING = 5;\nexport var ENDED = 6;\n\nexport default function(node, name, id, index, group, timing) {\n var schedules = node.__transition;\n if (!schedules) node.__transition = {};\n else if (id in schedules) return;\n create(node, id, {\n name: name,\n index: index, // For context during callback.\n group: group, // For context during callback.\n on: emptyOn,\n tween: emptyTween,\n time: timing.time,\n delay: timing.delay,\n duration: timing.duration,\n ease: timing.ease,\n timer: null,\n state: CREATED\n });\n}\n\nexport function init(node, id) {\n var schedule = get(node, id);\n if (schedule.state > CREATED) throw new Error(\"too late; already scheduled\");\n return schedule;\n}\n\nexport function set(node, id) {\n var schedule = get(node, id);\n if (schedule.state > STARTED) throw new Error(\"too late; already running\");\n return schedule;\n}\n\nexport function get(node, id) {\n var schedule = node.__transition;\n if (!schedule || !(schedule = schedule[id])) throw new Error(\"transition not found\");\n return schedule;\n}\n\nfunction create(node, id, self) {\n var schedules = node.__transition,\n tween;\n\n // Initialize the self timer when the transition is created.\n // Note the actual delay is not known until the first callback!\n schedules[id] = self;\n self.timer = timer(schedule, 0, self.time);\n\n function schedule(elapsed) {\n self.state = SCHEDULED;\n self.timer.restart(start, self.delay, self.time);\n\n // If the elapsed delay is less than our first sleep, start immediately.\n if (self.delay <= elapsed) start(elapsed - self.delay);\n }\n\n function start(elapsed) {\n var i, j, n, o;\n\n // If the state is not SCHEDULED, then we previously errored on start.\n if (self.state !== SCHEDULED) return stop();\n\n for (i in schedules) {\n o = schedules[i];\n if (o.name !== self.name) continue;\n\n // While this element already has a starting transition during this frame,\n // defer starting an interrupting transition until that transition has a\n // chance to tick (and possibly end); see d3/d3-transition#54!\n if (o.state === STARTED) return timeout(start);\n\n // Interrupt the active transition, if any.\n if (o.state === RUNNING) {\n o.state = ENDED;\n o.timer.stop();\n o.on.call(\"interrupt\", node, node.__data__, o.index, o.group);\n delete schedules[i];\n }\n\n // Cancel any pre-empted transitions.\n else if (+i < id) {\n o.state = ENDED;\n o.timer.stop();\n o.on.call(\"cancel\", node, node.__data__, o.index, o.group);\n delete schedules[i];\n }\n }\n\n // Defer the first tick to end of the current frame; see d3/d3#1576.\n // Note the transition may be canceled after start and before the first tick!\n // Note this must be scheduled before the start event; see d3/d3-transition#16!\n // Assuming this is successful, subsequent callbacks go straight to tick.\n timeout(function() {\n if (self.state === STARTED) {\n self.state = RUNNING;\n self.timer.restart(tick, self.delay, self.time);\n tick(elapsed);\n }\n });\n\n // Dispatch the start event.\n // Note this must be done before the tween are initialized.\n self.state = STARTING;\n self.on.call(\"start\", node, node.__data__, self.index, self.group);\n if (self.state !== STARTING) return; // interrupted\n self.state = STARTED;\n\n // Initialize the tween, deleting null tween.\n tween = new Array(n = self.tween.length);\n for (i = 0, j = -1; i < n; ++i) {\n if (o = self.tween[i].value.call(node, node.__data__, self.index, self.group)) {\n tween[++j] = o;\n }\n }\n tween.length = j + 1;\n }\n\n function tick(elapsed) {\n var t = elapsed < self.duration ? self.ease.call(null, elapsed / self.duration) : (self.timer.restart(stop), self.state = ENDING, 1),\n i = -1,\n n = tween.length;\n\n while (++i < n) {\n tween[i].call(node, t);\n }\n\n // Dispatch the end event.\n if (self.state === ENDING) {\n self.on.call(\"end\", node, node.__data__, self.index, self.group);\n stop();\n }\n }\n\n function stop() {\n self.state = ENDED;\n self.timer.stop();\n delete schedules[id];\n for (var i in schedules) return; // eslint-disable-line no-unused-vars\n delete node.__transition;\n }\n}\n","export default function(a, b) {\n return a = +a, b = +b, function(t) {\n return a * (1 - t) + b * t;\n };\n}\n","var degrees = 180 / Math.PI;\n\nexport var identity = {\n translateX: 0,\n translateY: 0,\n rotate: 0,\n skewX: 0,\n scaleX: 1,\n scaleY: 1\n};\n\nexport default function(a, b, c, d, e, f) {\n var scaleX, scaleY, skewX;\n if (scaleX = Math.sqrt(a * a + b * b)) a /= scaleX, b /= scaleX;\n if (skewX = a * c + b * d) c -= a * skewX, d -= b * skewX;\n if (scaleY = Math.sqrt(c * c + d * d)) c /= scaleY, d /= scaleY, skewX /= scaleY;\n if (a * d < b * c) a = -a, b = -b, skewX = -skewX, scaleX = -scaleX;\n return {\n translateX: e,\n translateY: f,\n rotate: Math.atan2(b, a) * degrees,\n skewX: Math.atan(skewX) * degrees,\n scaleX: scaleX,\n scaleY: scaleY\n };\n}\n","import decompose, {identity} from \"./decompose.js\";\n\nvar svgNode;\n\n/* eslint-disable no-undef */\nexport function parseCss(value) {\n const m = new (typeof DOMMatrix === \"function\" ? DOMMatrix : WebKitCSSMatrix)(value + \"\");\n return m.isIdentity ? identity : decompose(m.a, m.b, m.c, m.d, m.e, m.f);\n}\n\nexport function parseSvg(value) {\n if (value == null) return identity;\n if (!svgNode) svgNode = document.createElementNS(\"http://www.w3.org/2000/svg\", \"g\");\n svgNode.setAttribute(\"transform\", value);\n if (!(value = svgNode.transform.baseVal.consolidate())) return identity;\n value = value.matrix;\n return decompose(value.a, value.b, value.c, value.d, value.e, value.f);\n}\n","import number from \"../number.js\";\nimport {parseCss, parseSvg} from \"./parse.js\";\n\nfunction interpolateTransform(parse, pxComma, pxParen, degParen) {\n\n function pop(s) {\n return s.length ? s.pop() + \" \" : \"\";\n }\n\n function translate(xa, ya, xb, yb, s, q) {\n if (xa !== xb || ya !== yb) {\n var i = s.push(\"translate(\", null, pxComma, null, pxParen);\n q.push({i: i - 4, x: number(xa, xb)}, {i: i - 2, x: number(ya, yb)});\n } else if (xb || yb) {\n s.push(\"translate(\" + xb + pxComma + yb + pxParen);\n }\n }\n\n function rotate(a, b, s, q) {\n if (a !== b) {\n if (a - b > 180) b += 360; else if (b - a > 180) a += 360; // shortest path\n q.push({i: s.push(pop(s) + \"rotate(\", null, degParen) - 2, x: number(a, b)});\n } else if (b) {\n s.push(pop(s) + \"rotate(\" + b + degParen);\n }\n }\n\n function skewX(a, b, s, q) {\n if (a !== b) {\n q.push({i: s.push(pop(s) + \"skewX(\", null, degParen) - 2, x: number(a, b)});\n } else if (b) {\n s.push(pop(s) + \"skewX(\" + b + degParen);\n }\n }\n\n function scale(xa, ya, xb, yb, s, q) {\n if (xa !== xb || ya !== yb) {\n var i = s.push(pop(s) + \"scale(\", null, \",\", null, \")\");\n q.push({i: i - 4, x: number(xa, xb)}, {i: i - 2, x: number(ya, yb)});\n } else if (xb !== 1 || yb !== 1) {\n s.push(pop(s) + \"scale(\" + xb + \",\" + yb + \")\");\n }\n }\n\n return function(a, b) {\n var s = [], // string constants and placeholders\n q = []; // number interpolators\n a = parse(a), b = parse(b);\n translate(a.translateX, a.translateY, b.translateX, b.translateY, s, q);\n rotate(a.rotate, b.rotate, s, q);\n skewX(a.skewX, b.skewX, s, q);\n scale(a.scaleX, a.scaleY, b.scaleX, b.scaleY, s, q);\n a = b = null; // gc\n return function(t) {\n var i = -1, n = q.length, o;\n while (++i < n) s[(o = q[i]).i] = o.x(t);\n return s.join(\"\");\n };\n };\n}\n\nexport var interpolateTransformCss = interpolateTransform(parseCss, \"px, \", \"px)\", \"deg)\");\nexport var interpolateTransformSvg = interpolateTransform(parseSvg, \", \", \")\", \")\");\n","import {get, set} from \"./schedule.js\";\n\nfunction tweenRemove(id, name) {\n var tween0, tween1;\n return function() {\n var schedule = set(this, id),\n tween = schedule.tween;\n\n // If this node shared tween with the previous node,\n // just assign the updated shared tween and we’re done!\n // Otherwise, copy-on-write.\n if (tween !== tween0) {\n tween1 = tween0 = tween;\n for (var i = 0, n = tween1.length; i < n; ++i) {\n if (tween1[i].name === name) {\n tween1 = tween1.slice();\n tween1.splice(i, 1);\n break;\n }\n }\n }\n\n schedule.tween = tween1;\n };\n}\n\nfunction tweenFunction(id, name, value) {\n var tween0, tween1;\n if (typeof value !== \"function\") throw new Error;\n return function() {\n var schedule = set(this, id),\n tween = schedule.tween;\n\n // If this node shared tween with the previous node,\n // just assign the updated shared tween and we’re done!\n // Otherwise, copy-on-write.\n if (tween !== tween0) {\n tween1 = (tween0 = tween).slice();\n for (var t = {name: name, value: value}, i = 0, n = tween1.length; i < n; ++i) {\n if (tween1[i].name === name) {\n tween1[i] = t;\n break;\n }\n }\n if (i === n) tween1.push(t);\n }\n\n schedule.tween = tween1;\n };\n}\n\nexport default function(name, value) {\n var id = this._id;\n\n name += \"\";\n\n if (arguments.length < 2) {\n var tween = get(this.node(), id).tween;\n for (var i = 0, n = tween.length, t; i < n; ++i) {\n if ((t = tween[i]).name === name) {\n return t.value;\n }\n }\n return null;\n }\n\n return this.each((value == null ? tweenRemove : tweenFunction)(id, name, value));\n}\n\nexport function tweenValue(transition, name, value) {\n var id = transition._id;\n\n transition.each(function() {\n var schedule = set(this, id);\n (schedule.value || (schedule.value = {}))[name] = value.apply(this, arguments);\n });\n\n return function(node) {\n return get(node, id).value[name];\n };\n}\n","export default function(constructor, factory, prototype) {\n constructor.prototype = factory.prototype = prototype;\n prototype.constructor = constructor;\n}\n\nexport function extend(parent, definition) {\n var prototype = Object.create(parent.prototype);\n for (var key in definition) prototype[key] = definition[key];\n return prototype;\n}\n","import define, {extend} from \"./define.js\";\n\nexport function Color() {}\n\nexport var darker = 0.7;\nexport var brighter = 1 / darker;\n\nvar reI = \"\\\\s*([+-]?\\\\d+)\\\\s*\",\n reN = \"\\\\s*([+-]?(?:\\\\d*\\\\.)?\\\\d+(?:[eE][+-]?\\\\d+)?)\\\\s*\",\n reP = \"\\\\s*([+-]?(?:\\\\d*\\\\.)?\\\\d+(?:[eE][+-]?\\\\d+)?)%\\\\s*\",\n reHex = /^#([0-9a-f]{3,8})$/,\n reRgbInteger = new RegExp(`^rgb\\\\(${reI},${reI},${reI}\\\\)$`),\n reRgbPercent = new RegExp(`^rgb\\\\(${reP},${reP},${reP}\\\\)$`),\n reRgbaInteger = new RegExp(`^rgba\\\\(${reI},${reI},${reI},${reN}\\\\)$`),\n reRgbaPercent = new RegExp(`^rgba\\\\(${reP},${reP},${reP},${reN}\\\\)$`),\n reHslPercent = new RegExp(`^hsl\\\\(${reN},${reP},${reP}\\\\)$`),\n reHslaPercent = new RegExp(`^hsla\\\\(${reN},${reP},${reP},${reN}\\\\)$`);\n\nvar named = {\n aliceblue: 0xf0f8ff,\n antiquewhite: 0xfaebd7,\n aqua: 0x00ffff,\n aquamarine: 0x7fffd4,\n azure: 0xf0ffff,\n beige: 0xf5f5dc,\n bisque: 0xffe4c4,\n black: 0x000000,\n blanchedalmond: 0xffebcd,\n blue: 0x0000ff,\n blueviolet: 0x8a2be2,\n brown: 0xa52a2a,\n burlywood: 0xdeb887,\n cadetblue: 0x5f9ea0,\n chartreuse: 0x7fff00,\n chocolate: 0xd2691e,\n coral: 0xff7f50,\n cornflowerblue: 0x6495ed,\n cornsilk: 0xfff8dc,\n crimson: 0xdc143c,\n cyan: 0x00ffff,\n darkblue: 0x00008b,\n darkcyan: 0x008b8b,\n darkgoldenrod: 0xb8860b,\n darkgray: 0xa9a9a9,\n darkgreen: 0x006400,\n darkgrey: 0xa9a9a9,\n darkkhaki: 0xbdb76b,\n darkmagenta: 0x8b008b,\n darkolivegreen: 0x556b2f,\n darkorange: 0xff8c00,\n darkorchid: 0x9932cc,\n darkred: 0x8b0000,\n darksalmon: 0xe9967a,\n darkseagreen: 0x8fbc8f,\n darkslateblue: 0x483d8b,\n darkslategray: 0x2f4f4f,\n darkslategrey: 0x2f4f4f,\n darkturquoise: 0x00ced1,\n darkviolet: 0x9400d3,\n deeppink: 0xff1493,\n deepskyblue: 0x00bfff,\n dimgray: 0x696969,\n dimgrey: 0x696969,\n dodgerblue: 0x1e90ff,\n firebrick: 0xb22222,\n floralwhite: 0xfffaf0,\n forestgreen: 0x228b22,\n fuchsia: 0xff00ff,\n gainsboro: 0xdcdcdc,\n ghostwhite: 0xf8f8ff,\n gold: 0xffd700,\n goldenrod: 0xdaa520,\n gray: 0x808080,\n green: 0x008000,\n greenyellow: 0xadff2f,\n grey: 0x808080,\n honeydew: 0xf0fff0,\n hotpink: 0xff69b4,\n indianred: 0xcd5c5c,\n indigo: 0x4b0082,\n ivory: 0xfffff0,\n khaki: 0xf0e68c,\n lavender: 0xe6e6fa,\n lavenderblush: 0xfff0f5,\n lawngreen: 0x7cfc00,\n lemonchiffon: 0xfffacd,\n lightblue: 0xadd8e6,\n lightcoral: 0xf08080,\n lightcyan: 0xe0ffff,\n lightgoldenrodyellow: 0xfafad2,\n lightgray: 0xd3d3d3,\n lightgreen: 0x90ee90,\n lightgrey: 0xd3d3d3,\n lightpink: 0xffb6c1,\n lightsalmon: 0xffa07a,\n lightseagreen: 0x20b2aa,\n lightskyblue: 0x87cefa,\n lightslategray: 0x778899,\n lightslategrey: 0x778899,\n lightsteelblue: 0xb0c4de,\n lightyellow: 0xffffe0,\n lime: 0x00ff00,\n limegreen: 0x32cd32,\n linen: 0xfaf0e6,\n magenta: 0xff00ff,\n maroon: 0x800000,\n mediumaquamarine: 0x66cdaa,\n mediumblue: 0x0000cd,\n mediumorchid: 0xba55d3,\n mediumpurple: 0x9370db,\n mediumseagreen: 0x3cb371,\n mediumslateblue: 0x7b68ee,\n mediumspringgreen: 0x00fa9a,\n mediumturquoise: 0x48d1cc,\n mediumvioletred: 0xc71585,\n midnightblue: 0x191970,\n mintcream: 0xf5fffa,\n mistyrose: 0xffe4e1,\n moccasin: 0xffe4b5,\n navajowhite: 0xffdead,\n navy: 0x000080,\n oldlace: 0xfdf5e6,\n olive: 0x808000,\n olivedrab: 0x6b8e23,\n orange: 0xffa500,\n orangered: 0xff4500,\n orchid: 0xda70d6,\n palegoldenrod: 0xeee8aa,\n palegreen: 0x98fb98,\n paleturquoise: 0xafeeee,\n palevioletred: 0xdb7093,\n papayawhip: 0xffefd5,\n peachpuff: 0xffdab9,\n peru: 0xcd853f,\n pink: 0xffc0cb,\n plum: 0xdda0dd,\n powderblue: 0xb0e0e6,\n purple: 0x800080,\n rebeccapurple: 0x663399,\n red: 0xff0000,\n rosybrown: 0xbc8f8f,\n royalblue: 0x4169e1,\n saddlebrown: 0x8b4513,\n salmon: 0xfa8072,\n sandybrown: 0xf4a460,\n seagreen: 0x2e8b57,\n seashell: 0xfff5ee,\n sienna: 0xa0522d,\n silver: 0xc0c0c0,\n skyblue: 0x87ceeb,\n slateblue: 0x6a5acd,\n slategray: 0x708090,\n slategrey: 0x708090,\n snow: 0xfffafa,\n springgreen: 0x00ff7f,\n steelblue: 0x4682b4,\n tan: 0xd2b48c,\n teal: 0x008080,\n thistle: 0xd8bfd8,\n tomato: 0xff6347,\n turquoise: 0x40e0d0,\n violet: 0xee82ee,\n wheat: 0xf5deb3,\n white: 0xffffff,\n whitesmoke: 0xf5f5f5,\n yellow: 0xffff00,\n yellowgreen: 0x9acd32\n};\n\ndefine(Color, color, {\n copy(channels) {\n return Object.assign(new this.constructor, this, channels);\n },\n displayable() {\n return this.rgb().displayable();\n },\n hex: color_formatHex, // Deprecated! Use color.formatHex.\n formatHex: color_formatHex,\n formatHex8: color_formatHex8,\n formatHsl: color_formatHsl,\n formatRgb: color_formatRgb,\n toString: color_formatRgb\n});\n\nfunction color_formatHex() {\n return this.rgb().formatHex();\n}\n\nfunction color_formatHex8() {\n return this.rgb().formatHex8();\n}\n\nfunction color_formatHsl() {\n return hslConvert(this).formatHsl();\n}\n\nfunction color_formatRgb() {\n return this.rgb().formatRgb();\n}\n\nexport default function color(format) {\n var m, l;\n format = (format + \"\").trim().toLowerCase();\n return (m = reHex.exec(format)) ? (l = m[1].length, m = parseInt(m[1], 16), l === 6 ? rgbn(m) // #ff0000\n : l === 3 ? new Rgb((m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), ((m & 0xf) << 4) | (m & 0xf), 1) // #f00\n : l === 8 ? rgba(m >> 24 & 0xff, m >> 16 & 0xff, m >> 8 & 0xff, (m & 0xff) / 0xff) // #ff000000\n : l === 4 ? rgba((m >> 12 & 0xf) | (m >> 8 & 0xf0), (m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), (((m & 0xf) << 4) | (m & 0xf)) / 0xff) // #f000\n : null) // invalid hex\n : (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) // rgb(255, 0, 0)\n : (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) // rgb(100%, 0%, 0%)\n : (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4]) // rgba(255, 0, 0, 1)\n : (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) // rgb(100%, 0%, 0%, 1)\n : (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) // hsl(120, 50%, 50%)\n : (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) // hsla(120, 50%, 50%, 1)\n : named.hasOwnProperty(format) ? rgbn(named[format]) // eslint-disable-line no-prototype-builtins\n : format === \"transparent\" ? new Rgb(NaN, NaN, NaN, 0)\n : null;\n}\n\nfunction rgbn(n) {\n return new Rgb(n >> 16 & 0xff, n >> 8 & 0xff, n & 0xff, 1);\n}\n\nfunction rgba(r, g, b, a) {\n if (a <= 0) r = g = b = NaN;\n return new Rgb(r, g, b, a);\n}\n\nexport function rgbConvert(o) {\n if (!(o instanceof Color)) o = color(o);\n if (!o) return new Rgb;\n o = o.rgb();\n return new Rgb(o.r, o.g, o.b, o.opacity);\n}\n\nexport function rgb(r, g, b, opacity) {\n return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity);\n}\n\nexport function Rgb(r, g, b, opacity) {\n this.r = +r;\n this.g = +g;\n this.b = +b;\n this.opacity = +opacity;\n}\n\ndefine(Rgb, rgb, extend(Color, {\n brighter(k) {\n k = k == null ? brighter : Math.pow(brighter, k);\n return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);\n },\n darker(k) {\n k = k == null ? darker : Math.pow(darker, k);\n return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);\n },\n rgb() {\n return this;\n },\n clamp() {\n return new Rgb(clampi(this.r), clampi(this.g), clampi(this.b), clampa(this.opacity));\n },\n displayable() {\n return (-0.5 <= this.r && this.r < 255.5)\n && (-0.5 <= this.g && this.g < 255.5)\n && (-0.5 <= this.b && this.b < 255.5)\n && (0 <= this.opacity && this.opacity <= 1);\n },\n hex: rgb_formatHex, // Deprecated! Use color.formatHex.\n formatHex: rgb_formatHex,\n formatHex8: rgb_formatHex8,\n formatRgb: rgb_formatRgb,\n toString: rgb_formatRgb\n}));\n\nfunction rgb_formatHex() {\n return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}`;\n}\n\nfunction rgb_formatHex8() {\n return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}${hex((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`;\n}\n\nfunction rgb_formatRgb() {\n const a = clampa(this.opacity);\n return `${a === 1 ? \"rgb(\" : \"rgba(\"}${clampi(this.r)}, ${clampi(this.g)}, ${clampi(this.b)}${a === 1 ? \")\" : `, ${a})`}`;\n}\n\nfunction clampa(opacity) {\n return isNaN(opacity) ? 1 : Math.max(0, Math.min(1, opacity));\n}\n\nfunction clampi(value) {\n return Math.max(0, Math.min(255, Math.round(value) || 0));\n}\n\nfunction hex(value) {\n value = clampi(value);\n return (value < 16 ? \"0\" : \"\") + value.toString(16);\n}\n\nfunction hsla(h, s, l, a) {\n if (a <= 0) h = s = l = NaN;\n else if (l <= 0 || l >= 1) h = s = NaN;\n else if (s <= 0) h = NaN;\n return new Hsl(h, s, l, a);\n}\n\nexport function hslConvert(o) {\n if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity);\n if (!(o instanceof Color)) o = color(o);\n if (!o) return new Hsl;\n if (o instanceof Hsl) return o;\n o = o.rgb();\n var r = o.r / 255,\n g = o.g / 255,\n b = o.b / 255,\n min = Math.min(r, g, b),\n max = Math.max(r, g, b),\n h = NaN,\n s = max - min,\n l = (max + min) / 2;\n if (s) {\n if (r === max) h = (g - b) / s + (g < b) * 6;\n else if (g === max) h = (b - r) / s + 2;\n else h = (r - g) / s + 4;\n s /= l < 0.5 ? max + min : 2 - max - min;\n h *= 60;\n } else {\n s = l > 0 && l < 1 ? 0 : h;\n }\n return new Hsl(h, s, l, o.opacity);\n}\n\nexport function hsl(h, s, l, opacity) {\n return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity);\n}\n\nfunction Hsl(h, s, l, opacity) {\n this.h = +h;\n this.s = +s;\n this.l = +l;\n this.opacity = +opacity;\n}\n\ndefine(Hsl, hsl, extend(Color, {\n brighter(k) {\n k = k == null ? brighter : Math.pow(brighter, k);\n return new Hsl(this.h, this.s, this.l * k, this.opacity);\n },\n darker(k) {\n k = k == null ? darker : Math.pow(darker, k);\n return new Hsl(this.h, this.s, this.l * k, this.opacity);\n },\n rgb() {\n var h = this.h % 360 + (this.h < 0) * 360,\n s = isNaN(h) || isNaN(this.s) ? 0 : this.s,\n l = this.l,\n m2 = l + (l < 0.5 ? l : 1 - l) * s,\n m1 = 2 * l - m2;\n return new Rgb(\n hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2),\n hsl2rgb(h, m1, m2),\n hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2),\n this.opacity\n );\n },\n clamp() {\n return new Hsl(clamph(this.h), clampt(this.s), clampt(this.l), clampa(this.opacity));\n },\n displayable() {\n return (0 <= this.s && this.s <= 1 || isNaN(this.s))\n && (0 <= this.l && this.l <= 1)\n && (0 <= this.opacity && this.opacity <= 1);\n },\n formatHsl() {\n const a = clampa(this.opacity);\n return `${a === 1 ? \"hsl(\" : \"hsla(\"}${clamph(this.h)}, ${clampt(this.s) * 100}%, ${clampt(this.l) * 100}%${a === 1 ? \")\" : `, ${a})`}`;\n }\n}));\n\nfunction clamph(value) {\n value = (value || 0) % 360;\n return value < 0 ? value + 360 : value;\n}\n\nfunction clampt(value) {\n return Math.max(0, Math.min(1, value || 0));\n}\n\n/* From FvD 13.37, CSS Color Module Level 3 */\nfunction hsl2rgb(h, m1, m2) {\n return (h < 60 ? m1 + (m2 - m1) * h / 60\n : h < 180 ? m2\n : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60\n : m1) * 255;\n}\n","export function basis(t1, v0, v1, v2, v3) {\n var t2 = t1 * t1, t3 = t2 * t1;\n return ((1 - 3 * t1 + 3 * t2 - t3) * v0\n + (4 - 6 * t2 + 3 * t3) * v1\n + (1 + 3 * t1 + 3 * t2 - 3 * t3) * v2\n + t3 * v3) / 6;\n}\n\nexport default function(values) {\n var n = values.length - 1;\n return function(t) {\n var i = t <= 0 ? (t = 0) : t >= 1 ? (t = 1, n - 1) : Math.floor(t * n),\n v1 = values[i],\n v2 = values[i + 1],\n v0 = i > 0 ? values[i - 1] : 2 * v1 - v2,\n v3 = i < n - 1 ? values[i + 2] : 2 * v2 - v1;\n return basis((t - i / n) * n, v0, v1, v2, v3);\n };\n}\n","export default x => () => x;\n","import constant from \"./constant.js\";\n\nfunction linear(a, d) {\n return function(t) {\n return a + t * d;\n };\n}\n\nfunction exponential(a, b, y) {\n return a = Math.pow(a, y), b = Math.pow(b, y) - a, y = 1 / y, function(t) {\n return Math.pow(a + t * b, y);\n };\n}\n\nexport function hue(a, b) {\n var d = b - a;\n return d ? linear(a, d > 180 || d < -180 ? d - 360 * Math.round(d / 360) : d) : constant(isNaN(a) ? b : a);\n}\n\nexport function gamma(y) {\n return (y = +y) === 1 ? nogamma : function(a, b) {\n return b - a ? exponential(a, b, y) : constant(isNaN(a) ? b : a);\n };\n}\n\nexport default function nogamma(a, b) {\n var d = b - a;\n return d ? linear(a, d) : constant(isNaN(a) ? b : a);\n}\n","import {rgb as colorRgb} from \"d3-color\";\nimport basis from \"./basis.js\";\nimport basisClosed from \"./basisClosed.js\";\nimport nogamma, {gamma} from \"./color.js\";\n\nexport default (function rgbGamma(y) {\n var color = gamma(y);\n\n function rgb(start, end) {\n var r = color((start = colorRgb(start)).r, (end = colorRgb(end)).r),\n g = color(start.g, end.g),\n b = color(start.b, end.b),\n opacity = nogamma(start.opacity, end.opacity);\n return function(t) {\n start.r = r(t);\n start.g = g(t);\n start.b = b(t);\n start.opacity = opacity(t);\n return start + \"\";\n };\n }\n\n rgb.gamma = rgbGamma;\n\n return rgb;\n})(1);\n\nfunction rgbSpline(spline) {\n return function(colors) {\n var n = colors.length,\n r = new Array(n),\n g = new Array(n),\n b = new Array(n),\n i, color;\n for (i = 0; i < n; ++i) {\n color = colorRgb(colors[i]);\n r[i] = color.r || 0;\n g[i] = color.g || 0;\n b[i] = color.b || 0;\n }\n r = spline(r);\n g = spline(g);\n b = spline(b);\n color.opacity = 1;\n return function(t) {\n color.r = r(t);\n color.g = g(t);\n color.b = b(t);\n return color + \"\";\n };\n };\n}\n\nexport var rgbBasis = rgbSpline(basis);\nexport var rgbBasisClosed = rgbSpline(basisClosed);\n","import {basis} from \"./basis.js\";\n\nexport default function(values) {\n var n = values.length;\n return function(t) {\n var i = Math.floor(((t %= 1) < 0 ? ++t : t) * n),\n v0 = values[(i + n - 1) % n],\n v1 = values[i % n],\n v2 = values[(i + 1) % n],\n v3 = values[(i + 2) % n];\n return basis((t - i / n) * n, v0, v1, v2, v3);\n };\n}\n","import number from \"./number.js\";\n\nvar reA = /[-+]?(?:\\d+\\.?\\d*|\\.?\\d+)(?:[eE][-+]?\\d+)?/g,\n reB = new RegExp(reA.source, \"g\");\n\nfunction zero(b) {\n return function() {\n return b;\n };\n}\n\nfunction one(b) {\n return function(t) {\n return b(t) + \"\";\n };\n}\n\nexport default function(a, b) {\n var bi = reA.lastIndex = reB.lastIndex = 0, // scan index for next number in b\n am, // current match in a\n bm, // current match in b\n bs, // string preceding current number in b, if any\n i = -1, // index in s\n s = [], // string constants and placeholders\n q = []; // number interpolators\n\n // Coerce inputs to strings.\n a = a + \"\", b = b + \"\";\n\n // Interpolate pairs of numbers in a & b.\n while ((am = reA.exec(a))\n && (bm = reB.exec(b))) {\n if ((bs = bm.index) > bi) { // a string precedes the next number in b\n bs = b.slice(bi, bs);\n if (s[i]) s[i] += bs; // coalesce with previous string\n else s[++i] = bs;\n }\n if ((am = am[0]) === (bm = bm[0])) { // numbers in a & b match\n if (s[i]) s[i] += bm; // coalesce with previous string\n else s[++i] = bm;\n } else { // interpolate non-matching numbers\n s[++i] = null;\n q.push({i: i, x: number(am, bm)});\n }\n bi = reB.lastIndex;\n }\n\n // Add remains of b.\n if (bi < b.length) {\n bs = b.slice(bi);\n if (s[i]) s[i] += bs; // coalesce with previous string\n else s[++i] = bs;\n }\n\n // Special optimization for only a single match.\n // Otherwise, interpolate each of the numbers and rejoin the string.\n return s.length < 2 ? (q[0]\n ? one(q[0].x)\n : zero(b))\n : (b = q.length, function(t) {\n for (var i = 0, o; i < b; ++i) s[(o = q[i]).i] = o.x(t);\n return s.join(\"\");\n });\n}\n","import {color} from \"d3-color\";\nimport {interpolateNumber, interpolateRgb, interpolateString} from \"d3-interpolate\";\n\nexport default function(a, b) {\n var c;\n return (typeof b === \"number\" ? interpolateNumber\n : b instanceof color ? interpolateRgb\n : (c = color(b)) ? (b = c, interpolateRgb)\n : interpolateString)(a, b);\n}\n","import {interpolateTransformSvg as interpolateTransform} from \"d3-interpolate\";\nimport {namespace} from \"d3-selection\";\nimport {tweenValue} from \"./tween.js\";\nimport interpolate from \"./interpolate.js\";\n\nfunction attrRemove(name) {\n return function() {\n this.removeAttribute(name);\n };\n}\n\nfunction attrRemoveNS(fullname) {\n return function() {\n this.removeAttributeNS(fullname.space, fullname.local);\n };\n}\n\nfunction attrConstant(name, interpolate, value1) {\n var string00,\n string1 = value1 + \"\",\n interpolate0;\n return function() {\n var string0 = this.getAttribute(name);\n return string0 === string1 ? null\n : string0 === string00 ? interpolate0\n : interpolate0 = interpolate(string00 = string0, value1);\n };\n}\n\nfunction attrConstantNS(fullname, interpolate, value1) {\n var string00,\n string1 = value1 + \"\",\n interpolate0;\n return function() {\n var string0 = this.getAttributeNS(fullname.space, fullname.local);\n return string0 === string1 ? null\n : string0 === string00 ? interpolate0\n : interpolate0 = interpolate(string00 = string0, value1);\n };\n}\n\nfunction attrFunction(name, interpolate, value) {\n var string00,\n string10,\n interpolate0;\n return function() {\n var string0, value1 = value(this), string1;\n if (value1 == null) return void this.removeAttribute(name);\n string0 = this.getAttribute(name);\n string1 = value1 + \"\";\n return string0 === string1 ? null\n : string0 === string00 && string1 === string10 ? interpolate0\n : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));\n };\n}\n\nfunction attrFunctionNS(fullname, interpolate, value) {\n var string00,\n string10,\n interpolate0;\n return function() {\n var string0, value1 = value(this), string1;\n if (value1 == null) return void this.removeAttributeNS(fullname.space, fullname.local);\n string0 = this.getAttributeNS(fullname.space, fullname.local);\n string1 = value1 + \"\";\n return string0 === string1 ? null\n : string0 === string00 && string1 === string10 ? interpolate0\n : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));\n };\n}\n\nexport default function(name, value) {\n var fullname = namespace(name), i = fullname === \"transform\" ? interpolateTransform : interpolate;\n return this.attrTween(name, typeof value === \"function\"\n ? (fullname.local ? attrFunctionNS : attrFunction)(fullname, i, tweenValue(this, \"attr.\" + name, value))\n : value == null ? (fullname.local ? attrRemoveNS : attrRemove)(fullname)\n : (fullname.local ? attrConstantNS : attrConstant)(fullname, i, value));\n}\n","import {namespace} from \"d3-selection\";\n\nfunction attrInterpolate(name, i) {\n return function(t) {\n this.setAttribute(name, i.call(this, t));\n };\n}\n\nfunction attrInterpolateNS(fullname, i) {\n return function(t) {\n this.setAttributeNS(fullname.space, fullname.local, i.call(this, t));\n };\n}\n\nfunction attrTweenNS(fullname, value) {\n var t0, i0;\n function tween() {\n var i = value.apply(this, arguments);\n if (i !== i0) t0 = (i0 = i) && attrInterpolateNS(fullname, i);\n return t0;\n }\n tween._value = value;\n return tween;\n}\n\nfunction attrTween(name, value) {\n var t0, i0;\n function tween() {\n var i = value.apply(this, arguments);\n if (i !== i0) t0 = (i0 = i) && attrInterpolate(name, i);\n return t0;\n }\n tween._value = value;\n return tween;\n}\n\nexport default function(name, value) {\n var key = \"attr.\" + name;\n if (arguments.length < 2) return (key = this.tween(key)) && key._value;\n if (value == null) return this.tween(key, null);\n if (typeof value !== \"function\") throw new Error;\n var fullname = namespace(name);\n return this.tween(key, (fullname.local ? attrTweenNS : attrTween)(fullname, value));\n}\n","import {get, init} from \"./schedule.js\";\n\nfunction delayFunction(id, value) {\n return function() {\n init(this, id).delay = +value.apply(this, arguments);\n };\n}\n\nfunction delayConstant(id, value) {\n return value = +value, function() {\n init(this, id).delay = value;\n };\n}\n\nexport default function(value) {\n var id = this._id;\n\n return arguments.length\n ? this.each((typeof value === \"function\"\n ? delayFunction\n : delayConstant)(id, value))\n : get(this.node(), id).delay;\n}\n","import {get, set} from \"./schedule.js\";\n\nfunction durationFunction(id, value) {\n return function() {\n set(this, id).duration = +value.apply(this, arguments);\n };\n}\n\nfunction durationConstant(id, value) {\n return value = +value, function() {\n set(this, id).duration = value;\n };\n}\n\nexport default function(value) {\n var id = this._id;\n\n return arguments.length\n ? this.each((typeof value === \"function\"\n ? durationFunction\n : durationConstant)(id, value))\n : get(this.node(), id).duration;\n}\n","import {selection} from \"d3-selection\";\n\nvar Selection = selection.prototype.constructor;\n\nexport default function() {\n return new Selection(this._groups, this._parents);\n}\n","import {interpolateTransformCss as interpolateTransform} from \"d3-interpolate\";\nimport {style} from \"d3-selection\";\nimport {set} from \"./schedule.js\";\nimport {tweenValue} from \"./tween.js\";\nimport interpolate from \"./interpolate.js\";\n\nfunction styleNull(name, interpolate) {\n var string00,\n string10,\n interpolate0;\n return function() {\n var string0 = style(this, name),\n string1 = (this.style.removeProperty(name), style(this, name));\n return string0 === string1 ? null\n : string0 === string00 && string1 === string10 ? interpolate0\n : interpolate0 = interpolate(string00 = string0, string10 = string1);\n };\n}\n\nfunction styleRemove(name) {\n return function() {\n this.style.removeProperty(name);\n };\n}\n\nfunction styleConstant(name, interpolate, value1) {\n var string00,\n string1 = value1 + \"\",\n interpolate0;\n return function() {\n var string0 = style(this, name);\n return string0 === string1 ? null\n : string0 === string00 ? interpolate0\n : interpolate0 = interpolate(string00 = string0, value1);\n };\n}\n\nfunction styleFunction(name, interpolate, value) {\n var string00,\n string10,\n interpolate0;\n return function() {\n var string0 = style(this, name),\n value1 = value(this),\n string1 = value1 + \"\";\n if (value1 == null) string1 = value1 = (this.style.removeProperty(name), style(this, name));\n return string0 === string1 ? null\n : string0 === string00 && string1 === string10 ? interpolate0\n : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));\n };\n}\n\nfunction styleMaybeRemove(id, name) {\n var on0, on1, listener0, key = \"style.\" + name, event = \"end.\" + key, remove;\n return function() {\n var schedule = set(this, id),\n on = schedule.on,\n listener = schedule.value[key] == null ? remove || (remove = styleRemove(name)) : undefined;\n\n // If this node shared a dispatch with the previous node,\n // just assign the updated shared dispatch and we’re done!\n // Otherwise, copy-on-write.\n if (on !== on0 || listener0 !== listener) (on1 = (on0 = on).copy()).on(event, listener0 = listener);\n\n schedule.on = on1;\n };\n}\n\nexport default function(name, value, priority) {\n var i = (name += \"\") === \"transform\" ? interpolateTransform : interpolate;\n return value == null ? this\n .styleTween(name, styleNull(name, i))\n .on(\"end.style.\" + name, styleRemove(name))\n : typeof value === \"function\" ? this\n .styleTween(name, styleFunction(name, i, tweenValue(this, \"style.\" + name, value)))\n .each(styleMaybeRemove(this._id, name))\n : this\n .styleTween(name, styleConstant(name, i, value), priority)\n .on(\"end.style.\" + name, null);\n}\n","import {selection} from \"d3-selection\";\nimport transition_attr from \"./attr.js\";\nimport transition_attrTween from \"./attrTween.js\";\nimport transition_delay from \"./delay.js\";\nimport transition_duration from \"./duration.js\";\nimport transition_ease from \"./ease.js\";\nimport transition_easeVarying from \"./easeVarying.js\";\nimport transition_filter from \"./filter.js\";\nimport transition_merge from \"./merge.js\";\nimport transition_on from \"./on.js\";\nimport transition_remove from \"./remove.js\";\nimport transition_select from \"./select.js\";\nimport transition_selectAll from \"./selectAll.js\";\nimport transition_selection from \"./selection.js\";\nimport transition_style from \"./style.js\";\nimport transition_styleTween from \"./styleTween.js\";\nimport transition_text from \"./text.js\";\nimport transition_textTween from \"./textTween.js\";\nimport transition_transition from \"./transition.js\";\nimport transition_tween from \"./tween.js\";\nimport transition_end from \"./end.js\";\n\nvar id = 0;\n\nexport function Transition(groups, parents, name, id) {\n this._groups = groups;\n this._parents = parents;\n this._name = name;\n this._id = id;\n}\n\nexport default function transition(name) {\n return selection().transition(name);\n}\n\nexport function newId() {\n return ++id;\n}\n\nvar selection_prototype = selection.prototype;\n\nTransition.prototype = transition.prototype = {\n constructor: Transition,\n select: transition_select,\n selectAll: transition_selectAll,\n selectChild: selection_prototype.selectChild,\n selectChildren: selection_prototype.selectChildren,\n filter: transition_filter,\n merge: transition_merge,\n selection: transition_selection,\n transition: transition_transition,\n call: selection_prototype.call,\n nodes: selection_prototype.nodes,\n node: selection_prototype.node,\n size: selection_prototype.size,\n empty: selection_prototype.empty,\n each: selection_prototype.each,\n on: transition_on,\n attr: transition_attr,\n attrTween: transition_attrTween,\n style: transition_style,\n styleTween: transition_styleTween,\n text: transition_text,\n textTween: transition_textTween,\n remove: transition_remove,\n tween: transition_tween,\n delay: transition_delay,\n duration: transition_duration,\n ease: transition_ease,\n easeVarying: transition_easeVarying,\n end: transition_end,\n [Symbol.iterator]: selection_prototype[Symbol.iterator]\n};\n","import {selector} from \"d3-selection\";\nimport {Transition} from \"./index.js\";\nimport schedule, {get} from \"./schedule.js\";\n\nexport default function(select) {\n var name = this._name,\n id = this._id;\n\n if (typeof select !== \"function\") select = selector(select);\n\n for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, subgroup = subgroups[j] = new Array(n), node, subnode, i = 0; i < n; ++i) {\n if ((node = group[i]) && (subnode = select.call(node, node.__data__, i, group))) {\n if (\"__data__\" in node) subnode.__data__ = node.__data__;\n subgroup[i] = subnode;\n schedule(subgroup[i], name, id, i, subgroup, get(node, id));\n }\n }\n }\n\n return new Transition(subgroups, this._parents, name, id);\n}\n","import {selectorAll} from \"d3-selection\";\nimport {Transition} from \"./index.js\";\nimport schedule, {get} from \"./schedule.js\";\n\nexport default function(select) {\n var name = this._name,\n id = this._id;\n\n if (typeof select !== \"function\") select = selectorAll(select);\n\n for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {\n if (node = group[i]) {\n for (var children = select.call(node, node.__data__, i, group), child, inherit = get(node, id), k = 0, l = children.length; k < l; ++k) {\n if (child = children[k]) {\n schedule(child, name, id, k, children, inherit);\n }\n }\n subgroups.push(children);\n parents.push(node);\n }\n }\n }\n\n return new Transition(subgroups, parents, name, id);\n}\n","import {matcher} from \"d3-selection\";\nimport {Transition} from \"./index.js\";\n\nexport default function(match) {\n if (typeof match !== \"function\") match = matcher(match);\n\n for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, subgroup = subgroups[j] = [], node, i = 0; i < n; ++i) {\n if ((node = group[i]) && match.call(node, node.__data__, i, group)) {\n subgroup.push(node);\n }\n }\n }\n\n return new Transition(subgroups, this._parents, this._name, this._id);\n}\n","import {Transition} from \"./index.js\";\n\nexport default function(transition) {\n if (transition._id !== this._id) throw new Error;\n\n for (var groups0 = this._groups, groups1 = transition._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j = 0; j < m; ++j) {\n for (var group0 = groups0[j], group1 = groups1[j], n = group0.length, merge = merges[j] = new Array(n), node, i = 0; i < n; ++i) {\n if (node = group0[i] || group1[i]) {\n merge[i] = node;\n }\n }\n }\n\n for (; j < m0; ++j) {\n merges[j] = groups0[j];\n }\n\n return new Transition(merges, this._parents, this._name, this._id);\n}\n","import {Transition, newId} from \"./index.js\";\nimport schedule, {get} from \"./schedule.js\";\n\nexport default function() {\n var name = this._name,\n id0 = this._id,\n id1 = newId();\n\n for (var groups = this._groups, m = groups.length, j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {\n if (node = group[i]) {\n var inherit = get(node, id0);\n schedule(node, name, id1, i, group, {\n time: inherit.time + inherit.delay + inherit.duration,\n delay: 0,\n duration: inherit.duration,\n ease: inherit.ease\n });\n }\n }\n }\n\n return new Transition(groups, this._parents, name, id1);\n}\n","import {get, set, init} from \"./schedule.js\";\n\nfunction start(name) {\n return (name + \"\").trim().split(/^|\\s+/).every(function(t) {\n var i = t.indexOf(\".\");\n if (i >= 0) t = t.slice(0, i);\n return !t || t === \"start\";\n });\n}\n\nfunction onFunction(id, name, listener) {\n var on0, on1, sit = start(name) ? init : set;\n return function() {\n var schedule = sit(this, id),\n on = schedule.on;\n\n // If this node shared a dispatch with the previous node,\n // just assign the updated shared dispatch and we’re done!\n // Otherwise, copy-on-write.\n if (on !== on0) (on1 = (on0 = on).copy()).on(name, listener);\n\n schedule.on = on1;\n };\n}\n\nexport default function(name, listener) {\n var id = this._id;\n\n return arguments.length < 2\n ? get(this.node(), id).on.on(name)\n : this.each(onFunction(id, name, listener));\n}\n","function styleInterpolate(name, i, priority) {\n return function(t) {\n this.style.setProperty(name, i.call(this, t), priority);\n };\n}\n\nfunction styleTween(name, value, priority) {\n var t, i0;\n function tween() {\n var i = value.apply(this, arguments);\n if (i !== i0) t = (i0 = i) && styleInterpolate(name, i, priority);\n return t;\n }\n tween._value = value;\n return tween;\n}\n\nexport default function(name, value, priority) {\n var key = \"style.\" + (name += \"\");\n if (arguments.length < 2) return (key = this.tween(key)) && key._value;\n if (value == null) return this.tween(key, null);\n if (typeof value !== \"function\") throw new Error;\n return this.tween(key, styleTween(name, value, priority == null ? \"\" : priority));\n}\n","import {tweenValue} from \"./tween.js\";\n\nfunction textConstant(value) {\n return function() {\n this.textContent = value;\n };\n}\n\nfunction textFunction(value) {\n return function() {\n var value1 = value(this);\n this.textContent = value1 == null ? \"\" : value1;\n };\n}\n\nexport default function(value) {\n return this.tween(\"text\", typeof value === \"function\"\n ? textFunction(tweenValue(this, \"text\", value))\n : textConstant(value == null ? \"\" : value + \"\"));\n}\n","function textInterpolate(i) {\n return function(t) {\n this.textContent = i.call(this, t);\n };\n}\n\nfunction textTween(value) {\n var t0, i0;\n function tween() {\n var i = value.apply(this, arguments);\n if (i !== i0) t0 = (i0 = i) && textInterpolate(i);\n return t0;\n }\n tween._value = value;\n return tween;\n}\n\nexport default function(value) {\n var key = \"text\";\n if (arguments.length < 1) return (key = this.tween(key)) && key._value;\n if (value == null) return this.tween(key, null);\n if (typeof value !== \"function\") throw new Error;\n return this.tween(key, textTween(value));\n}\n","function removeFunction(id) {\n return function() {\n var parent = this.parentNode;\n for (var i in this.__transition) if (+i !== id) return;\n if (parent) parent.removeChild(this);\n };\n}\n\nexport default function() {\n return this.on(\"end.remove\", removeFunction(this._id));\n}\n","import {get, set} from \"./schedule.js\";\n\nfunction easeConstant(id, value) {\n if (typeof value !== \"function\") throw new Error;\n return function() {\n set(this, id).ease = value;\n };\n}\n\nexport default function(value) {\n var id = this._id;\n\n return arguments.length\n ? this.each(easeConstant(id, value))\n : get(this.node(), id).ease;\n}\n","import {set} from \"./schedule.js\";\n\nfunction easeVarying(id, value) {\n return function() {\n var v = value.apply(this, arguments);\n if (typeof v !== \"function\") throw new Error;\n set(this, id).ease = v;\n };\n}\n\nexport default function(value) {\n if (typeof value !== \"function\") throw new Error;\n return this.each(easeVarying(this._id, value));\n}\n","import {set} from \"./schedule.js\";\n\nexport default function() {\n var on0, on1, that = this, id = that._id, size = that.size();\n return new Promise(function(resolve, reject) {\n var cancel = {value: reject},\n end = {value: function() { if (--size === 0) resolve(); }};\n\n that.each(function() {\n var schedule = set(this, id),\n on = schedule.on;\n\n // If this node shared a dispatch with the previous node,\n // just assign the updated shared dispatch and we’re done!\n // Otherwise, copy-on-write.\n if (on !== on0) {\n on1 = (on0 = on).copy();\n on1._.cancel.push(cancel);\n on1._.interrupt.push(cancel);\n on1._.end.push(end);\n }\n\n schedule.on = on1;\n });\n\n // The selection was empty, resolve end immediately\n if (size === 0) resolve();\n });\n}\n","import {Transition, newId} from \"../transition/index.js\";\nimport schedule from \"../transition/schedule.js\";\nimport {easeCubicInOut} from \"d3-ease\";\nimport {now} from \"d3-timer\";\n\nvar defaultTiming = {\n time: null, // Set on use.\n delay: 0,\n duration: 250,\n ease: easeCubicInOut\n};\n\nfunction inherit(node, id) {\n var timing;\n while (!(timing = node.__transition) || !(timing = timing[id])) {\n if (!(node = node.parentNode)) {\n throw new Error(`transition ${id} not found`);\n }\n }\n return timing;\n}\n\nexport default function(name) {\n var id,\n timing;\n\n if (name instanceof Transition) {\n id = name._id, name = name._name;\n } else {\n id = newId(), (timing = defaultTiming).time = now(), name = name == null ? null : name + \"\";\n }\n\n for (var groups = this._groups, m = groups.length, j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {\n if (node = group[i]) {\n schedule(node, name, id, i, group, timing || inherit(node, id));\n }\n }\n }\n\n return new Transition(groups, this._parents, name, id);\n}\n","export function cubicIn(t) {\n return t * t * t;\n}\n\nexport function cubicOut(t) {\n return --t * t * t + 1;\n}\n\nexport function cubicInOut(t) {\n return ((t *= 2) <= 1 ? t * t * t : (t -= 2) * t * t + 2) / 2;\n}\n","import {selection} from \"d3-selection\";\nimport selection_interrupt from \"./interrupt.js\";\nimport selection_transition from \"./transition.js\";\n\nselection.prototype.interrupt = selection_interrupt;\nselection.prototype.transition = selection_transition;\n","import interrupt from \"../interrupt.js\";\n\nexport default function(name) {\n return this.each(function() {\n interrupt(this, name);\n });\n}\n","import {STARTING, ENDING, ENDED} from \"./transition/schedule.js\";\n\nexport default function(node, name) {\n var schedules = node.__transition,\n schedule,\n active,\n empty = true,\n i;\n\n if (!schedules) return;\n\n name = name == null ? null : name + \"\";\n\n for (i in schedules) {\n if ((schedule = schedules[i]).name !== name) { empty = false; continue; }\n active = schedule.state > STARTING && schedule.state < ENDING;\n schedule.state = ENDED;\n schedule.timer.stop();\n schedule.on.call(active ? \"interrupt\" : \"cancel\", node, node.__data__, schedule.index, schedule.group);\n delete schedules[i];\n }\n\n if (empty) delete node.__transition;\n}\n","import {dispatch} from \"d3-dispatch\";\nimport {dragDisable, dragEnable} from \"d3-drag\";\nimport {interpolate} from \"d3-interpolate\";\nimport {pointer, select} from \"d3-selection\";\nimport {interrupt} from \"d3-transition\";\nimport constant from \"./constant.js\";\nimport BrushEvent from \"./event.js\";\nimport noevent, {nopropagation} from \"./noevent.js\";\n\nvar MODE_DRAG = {name: \"drag\"},\n MODE_SPACE = {name: \"space\"},\n MODE_HANDLE = {name: \"handle\"},\n MODE_CENTER = {name: \"center\"};\n\nconst {abs, max, min} = Math;\n\nfunction number1(e) {\n return [+e[0], +e[1]];\n}\n\nfunction number2(e) {\n return [number1(e[0]), number1(e[1])];\n}\n\nvar X = {\n name: \"x\",\n handles: [\"w\", \"e\"].map(type),\n input: function(x, e) { return x == null ? null : [[+x[0], e[0][1]], [+x[1], e[1][1]]]; },\n output: function(xy) { return xy && [xy[0][0], xy[1][0]]; }\n};\n\nvar Y = {\n name: \"y\",\n handles: [\"n\", \"s\"].map(type),\n input: function(y, e) { return y == null ? null : [[e[0][0], +y[0]], [e[1][0], +y[1]]]; },\n output: function(xy) { return xy && [xy[0][1], xy[1][1]]; }\n};\n\nvar XY = {\n name: \"xy\",\n handles: [\"n\", \"w\", \"e\", \"s\", \"nw\", \"ne\", \"sw\", \"se\"].map(type),\n input: function(xy) { return xy == null ? null : number2(xy); },\n output: function(xy) { return xy; }\n};\n\nvar cursors = {\n overlay: \"crosshair\",\n selection: \"move\",\n n: \"ns-resize\",\n e: \"ew-resize\",\n s: \"ns-resize\",\n w: \"ew-resize\",\n nw: \"nwse-resize\",\n ne: \"nesw-resize\",\n se: \"nwse-resize\",\n sw: \"nesw-resize\"\n};\n\nvar flipX = {\n e: \"w\",\n w: \"e\",\n nw: \"ne\",\n ne: \"nw\",\n se: \"sw\",\n sw: \"se\"\n};\n\nvar flipY = {\n n: \"s\",\n s: \"n\",\n nw: \"sw\",\n ne: \"se\",\n se: \"ne\",\n sw: \"nw\"\n};\n\nvar signsX = {\n overlay: +1,\n selection: +1,\n n: null,\n e: +1,\n s: null,\n w: -1,\n nw: -1,\n ne: +1,\n se: +1,\n sw: -1\n};\n\nvar signsY = {\n overlay: +1,\n selection: +1,\n n: -1,\n e: null,\n s: +1,\n w: null,\n nw: -1,\n ne: -1,\n se: +1,\n sw: +1\n};\n\nfunction type(t) {\n return {type: t};\n}\n\n// Ignore right-click, since that should open the context menu.\nfunction defaultFilter(event) {\n return !event.ctrlKey && !event.button;\n}\n\nfunction defaultExtent() {\n var svg = this.ownerSVGElement || this;\n if (svg.hasAttribute(\"viewBox\")) {\n svg = svg.viewBox.baseVal;\n return [[svg.x, svg.y], [svg.x + svg.width, svg.y + svg.height]];\n }\n return [[0, 0], [svg.width.baseVal.value, svg.height.baseVal.value]];\n}\n\nfunction defaultTouchable() {\n return navigator.maxTouchPoints || (\"ontouchstart\" in this);\n}\n\n// Like d3.local, but with the name “__brush” rather than auto-generated.\nfunction local(node) {\n while (!node.__brush) if (!(node = node.parentNode)) return;\n return node.__brush;\n}\n\nfunction empty(extent) {\n return extent[0][0] === extent[1][0]\n || extent[0][1] === extent[1][1];\n}\n\nexport function brushSelection(node) {\n var state = node.__brush;\n return state ? state.dim.output(state.selection) : null;\n}\n\nexport function brushX() {\n return brush(X);\n}\n\nexport function brushY() {\n return brush(Y);\n}\n\nexport default function() {\n return brush(XY);\n}\n\nfunction brush(dim) {\n var extent = defaultExtent,\n filter = defaultFilter,\n touchable = defaultTouchable,\n keys = true,\n listeners = dispatch(\"start\", \"brush\", \"end\"),\n handleSize = 6,\n touchending;\n\n function brush(group) {\n var overlay = group\n .property(\"__brush\", initialize)\n .selectAll(\".overlay\")\n .data([type(\"overlay\")]);\n\n overlay.enter().append(\"rect\")\n .attr(\"class\", \"overlay\")\n .attr(\"pointer-events\", \"all\")\n .attr(\"cursor\", cursors.overlay)\n .merge(overlay)\n .each(function() {\n var extent = local(this).extent;\n select(this)\n .attr(\"x\", extent[0][0])\n .attr(\"y\", extent[0][1])\n .attr(\"width\", extent[1][0] - extent[0][0])\n .attr(\"height\", extent[1][1] - extent[0][1]);\n });\n\n group.selectAll(\".selection\")\n .data([type(\"selection\")])\n .enter().append(\"rect\")\n .attr(\"class\", \"selection\")\n .attr(\"cursor\", cursors.selection)\n .attr(\"fill\", \"#777\")\n .attr(\"fill-opacity\", 0.3)\n .attr(\"stroke\", \"#fff\")\n .attr(\"shape-rendering\", \"crispEdges\");\n\n var handle = group.selectAll(\".handle\")\n .data(dim.handles, function(d) { return d.type; });\n\n handle.exit().remove();\n\n handle.enter().append(\"rect\")\n .attr(\"class\", function(d) { return \"handle handle--\" + d.type; })\n .attr(\"cursor\", function(d) { return cursors[d.type]; });\n\n group\n .each(redraw)\n .attr(\"fill\", \"none\")\n .attr(\"pointer-events\", \"all\")\n .on(\"mousedown.brush\", started)\n .filter(touchable)\n .on(\"touchstart.brush\", started)\n .on(\"touchmove.brush\", touchmoved)\n .on(\"touchend.brush touchcancel.brush\", touchended)\n .style(\"touch-action\", \"none\")\n .style(\"-webkit-tap-highlight-color\", \"rgba(0,0,0,0)\");\n }\n\n brush.move = function(group, selection, event) {\n if (group.tween) {\n group\n .on(\"start.brush\", function(event) { emitter(this, arguments).beforestart().start(event); })\n .on(\"interrupt.brush end.brush\", function(event) { emitter(this, arguments).end(event); })\n .tween(\"brush\", function() {\n var that = this,\n state = that.__brush,\n emit = emitter(that, arguments),\n selection0 = state.selection,\n selection1 = dim.input(typeof selection === \"function\" ? selection.apply(this, arguments) : selection, state.extent),\n i = interpolate(selection0, selection1);\n\n function tween(t) {\n state.selection = t === 1 && selection1 === null ? null : i(t);\n redraw.call(that);\n emit.brush();\n }\n\n return selection0 !== null && selection1 !== null ? tween : tween(1);\n });\n } else {\n group\n .each(function() {\n var that = this,\n args = arguments,\n state = that.__brush,\n selection1 = dim.input(typeof selection === \"function\" ? selection.apply(that, args) : selection, state.extent),\n emit = emitter(that, args).beforestart();\n\n interrupt(that);\n state.selection = selection1 === null ? null : selection1;\n redraw.call(that);\n emit.start(event).brush(event).end(event);\n });\n }\n };\n\n brush.clear = function(group, event) {\n brush.move(group, null, event);\n };\n\n function redraw() {\n var group = select(this),\n selection = local(this).selection;\n\n if (selection) {\n group.selectAll(\".selection\")\n .style(\"display\", null)\n .attr(\"x\", selection[0][0])\n .attr(\"y\", selection[0][1])\n .attr(\"width\", selection[1][0] - selection[0][0])\n .attr(\"height\", selection[1][1] - selection[0][1]);\n\n group.selectAll(\".handle\")\n .style(\"display\", null)\n .attr(\"x\", function(d) { return d.type[d.type.length - 1] === \"e\" ? selection[1][0] - handleSize / 2 : selection[0][0] - handleSize / 2; })\n .attr(\"y\", function(d) { return d.type[0] === \"s\" ? selection[1][1] - handleSize / 2 : selection[0][1] - handleSize / 2; })\n .attr(\"width\", function(d) { return d.type === \"n\" || d.type === \"s\" ? selection[1][0] - selection[0][0] + handleSize : handleSize; })\n .attr(\"height\", function(d) { return d.type === \"e\" || d.type === \"w\" ? selection[1][1] - selection[0][1] + handleSize : handleSize; });\n }\n\n else {\n group.selectAll(\".selection,.handle\")\n .style(\"display\", \"none\")\n .attr(\"x\", null)\n .attr(\"y\", null)\n .attr(\"width\", null)\n .attr(\"height\", null);\n }\n }\n\n function emitter(that, args, clean) {\n var emit = that.__brush.emitter;\n return emit && (!clean || !emit.clean) ? emit : new Emitter(that, args, clean);\n }\n\n function Emitter(that, args, clean) {\n this.that = that;\n this.args = args;\n this.state = that.__brush;\n this.active = 0;\n this.clean = clean;\n }\n\n Emitter.prototype = {\n beforestart: function() {\n if (++this.active === 1) this.state.emitter = this, this.starting = true;\n return this;\n },\n start: function(event, mode) {\n if (this.starting) this.starting = false, this.emit(\"start\", event, mode);\n else this.emit(\"brush\", event);\n return this;\n },\n brush: function(event, mode) {\n this.emit(\"brush\", event, mode);\n return this;\n },\n end: function(event, mode) {\n if (--this.active === 0) delete this.state.emitter, this.emit(\"end\", event, mode);\n return this;\n },\n emit: function(type, event, mode) {\n var d = select(this.that).datum();\n listeners.call(\n type,\n this.that,\n new BrushEvent(type, {\n sourceEvent: event,\n target: brush,\n selection: dim.output(this.state.selection),\n mode,\n dispatch: listeners\n }),\n d\n );\n }\n };\n\n function started(event) {\n if (touchending && !event.touches) return;\n if (!filter.apply(this, arguments)) return;\n\n var that = this,\n type = event.target.__data__.type,\n mode = (keys && event.metaKey ? type = \"overlay\" : type) === \"selection\" ? MODE_DRAG : (keys && event.altKey ? MODE_CENTER : MODE_HANDLE),\n signX = dim === Y ? null : signsX[type],\n signY = dim === X ? null : signsY[type],\n state = local(that),\n extent = state.extent,\n selection = state.selection,\n W = extent[0][0], w0, w1,\n N = extent[0][1], n0, n1,\n E = extent[1][0], e0, e1,\n S = extent[1][1], s0, s1,\n dx = 0,\n dy = 0,\n moving,\n shifting = signX && signY && keys && event.shiftKey,\n lockX,\n lockY,\n points = Array.from(event.touches || [event], t => {\n const i = t.identifier;\n t = pointer(t, that);\n t.point0 = t.slice();\n t.identifier = i;\n return t;\n });\n\n interrupt(that);\n var emit = emitter(that, arguments, true).beforestart();\n\n if (type === \"overlay\") {\n if (selection) moving = true;\n const pts = [points[0], points[1] || points[0]];\n state.selection = selection = [[\n w0 = dim === Y ? W : min(pts[0][0], pts[1][0]),\n n0 = dim === X ? N : min(pts[0][1], pts[1][1])\n ], [\n e0 = dim === Y ? E : max(pts[0][0], pts[1][0]),\n s0 = dim === X ? S : max(pts[0][1], pts[1][1])\n ]];\n if (points.length > 1) move(event);\n } else {\n w0 = selection[0][0];\n n0 = selection[0][1];\n e0 = selection[1][0];\n s0 = selection[1][1];\n }\n\n w1 = w0;\n n1 = n0;\n e1 = e0;\n s1 = s0;\n\n var group = select(that)\n .attr(\"pointer-events\", \"none\");\n\n var overlay = group.selectAll(\".overlay\")\n .attr(\"cursor\", cursors[type]);\n\n if (event.touches) {\n emit.moved = moved;\n emit.ended = ended;\n } else {\n var view = select(event.view)\n .on(\"mousemove.brush\", moved, true)\n .on(\"mouseup.brush\", ended, true);\n if (keys) view\n .on(\"keydown.brush\", keydowned, true)\n .on(\"keyup.brush\", keyupped, true)\n\n dragDisable(event.view);\n }\n\n redraw.call(that);\n emit.start(event, mode.name);\n\n function moved(event) {\n for (const p of event.changedTouches || [event]) {\n for (const d of points)\n if (d.identifier === p.identifier) d.cur = pointer(p, that);\n }\n if (shifting && !lockX && !lockY && points.length === 1) {\n const point = points[0];\n if (abs(point.cur[0] - point[0]) > abs(point.cur[1] - point[1]))\n lockY = true;\n else\n lockX = true;\n }\n for (const point of points)\n if (point.cur) point[0] = point.cur[0], point[1] = point.cur[1];\n moving = true;\n noevent(event);\n move(event);\n }\n\n function move(event) {\n const point = points[0], point0 = point.point0;\n var t;\n\n dx = point[0] - point0[0];\n dy = point[1] - point0[1];\n\n switch (mode) {\n case MODE_SPACE:\n case MODE_DRAG: {\n if (signX) dx = max(W - w0, min(E - e0, dx)), w1 = w0 + dx, e1 = e0 + dx;\n if (signY) dy = max(N - n0, min(S - s0, dy)), n1 = n0 + dy, s1 = s0 + dy;\n break;\n }\n case MODE_HANDLE: {\n if (points[1]) {\n if (signX) w1 = max(W, min(E, points[0][0])), e1 = max(W, min(E, points[1][0])), signX = 1;\n if (signY) n1 = max(N, min(S, points[0][1])), s1 = max(N, min(S, points[1][1])), signY = 1;\n } else {\n if (signX < 0) dx = max(W - w0, min(E - w0, dx)), w1 = w0 + dx, e1 = e0;\n else if (signX > 0) dx = max(W - e0, min(E - e0, dx)), w1 = w0, e1 = e0 + dx;\n if (signY < 0) dy = max(N - n0, min(S - n0, dy)), n1 = n0 + dy, s1 = s0;\n else if (signY > 0) dy = max(N - s0, min(S - s0, dy)), n1 = n0, s1 = s0 + dy;\n }\n break;\n }\n case MODE_CENTER: {\n if (signX) w1 = max(W, min(E, w0 - dx * signX)), e1 = max(W, min(E, e0 + dx * signX));\n if (signY) n1 = max(N, min(S, n0 - dy * signY)), s1 = max(N, min(S, s0 + dy * signY));\n break;\n }\n }\n\n if (e1 < w1) {\n signX *= -1;\n t = w0, w0 = e0, e0 = t;\n t = w1, w1 = e1, e1 = t;\n if (type in flipX) overlay.attr(\"cursor\", cursors[type = flipX[type]]);\n }\n\n if (s1 < n1) {\n signY *= -1;\n t = n0, n0 = s0, s0 = t;\n t = n1, n1 = s1, s1 = t;\n if (type in flipY) overlay.attr(\"cursor\", cursors[type = flipY[type]]);\n }\n\n if (state.selection) selection = state.selection; // May be set by brush.move!\n if (lockX) w1 = selection[0][0], e1 = selection[1][0];\n if (lockY) n1 = selection[0][1], s1 = selection[1][1];\n\n if (selection[0][0] !== w1\n || selection[0][1] !== n1\n || selection[1][0] !== e1\n || selection[1][1] !== s1) {\n state.selection = [[w1, n1], [e1, s1]];\n redraw.call(that);\n emit.brush(event, mode.name);\n }\n }\n\n function ended(event) {\n nopropagation(event);\n if (event.touches) {\n if (event.touches.length) return;\n if (touchending) clearTimeout(touchending);\n touchending = setTimeout(function() { touchending = null; }, 500); // Ghost clicks are delayed!\n } else {\n dragEnable(event.view, moving);\n view.on(\"keydown.brush keyup.brush mousemove.brush mouseup.brush\", null);\n }\n group.attr(\"pointer-events\", \"all\");\n overlay.attr(\"cursor\", cursors.overlay);\n if (state.selection) selection = state.selection; // May be set by brush.move (on start)!\n if (empty(selection)) state.selection = null, redraw.call(that);\n emit.end(event, mode.name);\n }\n\n function keydowned(event) {\n switch (event.keyCode) {\n case 16: { // SHIFT\n shifting = signX && signY;\n break;\n }\n case 18: { // ALT\n if (mode === MODE_HANDLE) {\n if (signX) e0 = e1 - dx * signX, w0 = w1 + dx * signX;\n if (signY) s0 = s1 - dy * signY, n0 = n1 + dy * signY;\n mode = MODE_CENTER;\n move(event);\n }\n break;\n }\n case 32: { // SPACE; takes priority over ALT\n if (mode === MODE_HANDLE || mode === MODE_CENTER) {\n if (signX < 0) e0 = e1 - dx; else if (signX > 0) w0 = w1 - dx;\n if (signY < 0) s0 = s1 - dy; else if (signY > 0) n0 = n1 - dy;\n mode = MODE_SPACE;\n overlay.attr(\"cursor\", cursors.selection);\n move(event);\n }\n break;\n }\n default: return;\n }\n noevent(event);\n }\n\n function keyupped(event) {\n switch (event.keyCode) {\n case 16: { // SHIFT\n if (shifting) {\n lockX = lockY = shifting = false;\n move(event);\n }\n break;\n }\n case 18: { // ALT\n if (mode === MODE_CENTER) {\n if (signX < 0) e0 = e1; else if (signX > 0) w0 = w1;\n if (signY < 0) s0 = s1; else if (signY > 0) n0 = n1;\n mode = MODE_HANDLE;\n move(event);\n }\n break;\n }\n case 32: { // SPACE\n if (mode === MODE_SPACE) {\n if (event.altKey) {\n if (signX) e0 = e1 - dx * signX, w0 = w1 + dx * signX;\n if (signY) s0 = s1 - dy * signY, n0 = n1 + dy * signY;\n mode = MODE_CENTER;\n } else {\n if (signX < 0) e0 = e1; else if (signX > 0) w0 = w1;\n if (signY < 0) s0 = s1; else if (signY > 0) n0 = n1;\n mode = MODE_HANDLE;\n }\n overlay.attr(\"cursor\", cursors[type]);\n move(event);\n }\n break;\n }\n default: return;\n }\n noevent(event);\n }\n }\n\n function touchmoved(event) {\n emitter(this, arguments).moved(event);\n }\n\n function touchended(event) {\n emitter(this, arguments).ended(event);\n }\n\n function initialize() {\n var state = this.__brush || {selection: null};\n state.extent = number2(extent.apply(this, arguments));\n state.dim = dim;\n return state;\n }\n\n brush.extent = function(_) {\n return arguments.length ? (extent = typeof _ === \"function\" ? _ : constant(number2(_)), brush) : extent;\n };\n\n brush.filter = function(_) {\n return arguments.length ? (filter = typeof _ === \"function\" ? _ : constant(!!_), brush) : filter;\n };\n\n brush.touchable = function(_) {\n return arguments.length ? (touchable = typeof _ === \"function\" ? _ : constant(!!_), brush) : touchable;\n };\n\n brush.handleSize = function(_) {\n return arguments.length ? (handleSize = +_, brush) : handleSize;\n };\n\n brush.keyModifiers = function(_) {\n return arguments.length ? (keys = !!_, brush) : keys;\n };\n\n brush.on = function() {\n var value = listeners.on.apply(listeners, arguments);\n return value === listeners ? brush : value;\n };\n\n return brush;\n}\n","import {Selection, root} from \"./selection/index.js\";\n\nexport default function(selector) {\n return typeof selector === \"string\"\n ? new Selection([[document.querySelector(selector)]], [document.documentElement])\n : new Selection([[selector]], root);\n}\n","import sourceEvent from \"./sourceEvent.js\";\n\nexport default function(event, node) {\n event = sourceEvent(event);\n if (node === undefined) node = event.currentTarget;\n if (node) {\n var svg = node.ownerSVGElement || node;\n if (svg.createSVGPoint) {\n var point = svg.createSVGPoint();\n point.x = event.clientX, point.y = event.clientY;\n point = point.matrixTransform(node.getScreenCTM().inverse());\n return [point.x, point.y];\n }\n if (node.getBoundingClientRect) {\n var rect = node.getBoundingClientRect();\n return [event.clientX - rect.left - node.clientLeft, event.clientY - rect.top - node.clientTop];\n }\n }\n return [event.pageX, event.pageY];\n}\n","export default function(event) {\n let sourceEvent;\n while (sourceEvent = event.sourceEvent) event = sourceEvent;\n return event;\n}\n","// These are typically used in conjunction with noevent to ensure that we can\n// preventDefault on the event.\nexport const nonpassive = {passive: false};\nexport const nonpassivecapture = {capture: true, passive: false};\n\nexport function nopropagation(event) {\n event.stopImmediatePropagation();\n}\n\nexport default function(event) {\n event.preventDefault();\n event.stopImmediatePropagation();\n}\n","export default x => () => x;\n","export default function DragEvent(type, {\n sourceEvent,\n subject,\n target,\n identifier,\n active,\n x, y, dx, dy,\n dispatch\n}) {\n Object.defineProperties(this, {\n type: {value: type, enumerable: true, configurable: true},\n sourceEvent: {value: sourceEvent, enumerable: true, configurable: true},\n subject: {value: subject, enumerable: true, configurable: true},\n target: {value: target, enumerable: true, configurable: true},\n identifier: {value: identifier, enumerable: true, configurable: true},\n active: {value: active, enumerable: true, configurable: true},\n x: {value: x, enumerable: true, configurable: true},\n y: {value: y, enumerable: true, configurable: true},\n dx: {value: dx, enumerable: true, configurable: true},\n dy: {value: dy, enumerable: true, configurable: true},\n _: {value: dispatch}\n });\n}\n\nDragEvent.prototype.on = function() {\n var value = this._.on.apply(this._, arguments);\n return value === this._ ? this : value;\n};\n","import {dispatch} from \"d3-dispatch\";\nimport {select, pointer} from \"d3-selection\";\nimport nodrag, {yesdrag} from \"./nodrag.js\";\nimport noevent, {nonpassive, nonpassivecapture, nopropagation} from \"./noevent.js\";\nimport constant from \"./constant.js\";\nimport DragEvent from \"./event.js\";\n\n// Ignore right-click, since that should open the context menu.\nfunction defaultFilter(event) {\n return !event.ctrlKey && !event.button;\n}\n\nfunction defaultContainer() {\n return this.parentNode;\n}\n\nfunction defaultSubject(event, d) {\n return d == null ? {x: event.x, y: event.y} : d;\n}\n\nfunction defaultTouchable() {\n return navigator.maxTouchPoints || (\"ontouchstart\" in this);\n}\n\nexport default function() {\n var filter = defaultFilter,\n container = defaultContainer,\n subject = defaultSubject,\n touchable = defaultTouchable,\n gestures = {},\n listeners = dispatch(\"start\", \"drag\", \"end\"),\n active = 0,\n mousedownx,\n mousedowny,\n mousemoving,\n touchending,\n clickDistance2 = 0;\n\n function drag(selection) {\n selection\n .on(\"mousedown.drag\", mousedowned)\n .filter(touchable)\n .on(\"touchstart.drag\", touchstarted)\n .on(\"touchmove.drag\", touchmoved, nonpassive)\n .on(\"touchend.drag touchcancel.drag\", touchended)\n .style(\"touch-action\", \"none\")\n .style(\"-webkit-tap-highlight-color\", \"rgba(0,0,0,0)\");\n }\n\n function mousedowned(event, d) {\n if (touchending || !filter.call(this, event, d)) return;\n var gesture = beforestart(this, container.call(this, event, d), event, d, \"mouse\");\n if (!gesture) return;\n select(event.view)\n .on(\"mousemove.drag\", mousemoved, nonpassivecapture)\n .on(\"mouseup.drag\", mouseupped, nonpassivecapture);\n nodrag(event.view);\n nopropagation(event);\n mousemoving = false;\n mousedownx = event.clientX;\n mousedowny = event.clientY;\n gesture(\"start\", event);\n }\n\n function mousemoved(event) {\n noevent(event);\n if (!mousemoving) {\n var dx = event.clientX - mousedownx, dy = event.clientY - mousedowny;\n mousemoving = dx * dx + dy * dy > clickDistance2;\n }\n gestures.mouse(\"drag\", event);\n }\n\n function mouseupped(event) {\n select(event.view).on(\"mousemove.drag mouseup.drag\", null);\n yesdrag(event.view, mousemoving);\n noevent(event);\n gestures.mouse(\"end\", event);\n }\n\n function touchstarted(event, d) {\n if (!filter.call(this, event, d)) return;\n var touches = event.changedTouches,\n c = container.call(this, event, d),\n n = touches.length, i, gesture;\n\n for (i = 0; i < n; ++i) {\n if (gesture = beforestart(this, c, event, d, touches[i].identifier, touches[i])) {\n nopropagation(event);\n gesture(\"start\", event, touches[i]);\n }\n }\n }\n\n function touchmoved(event) {\n var touches = event.changedTouches,\n n = touches.length, i, gesture;\n\n for (i = 0; i < n; ++i) {\n if (gesture = gestures[touches[i].identifier]) {\n noevent(event);\n gesture(\"drag\", event, touches[i]);\n }\n }\n }\n\n function touchended(event) {\n var touches = event.changedTouches,\n n = touches.length, i, gesture;\n\n if (touchending) clearTimeout(touchending);\n touchending = setTimeout(function() { touchending = null; }, 500); // Ghost clicks are delayed!\n for (i = 0; i < n; ++i) {\n if (gesture = gestures[touches[i].identifier]) {\n nopropagation(event);\n gesture(\"end\", event, touches[i]);\n }\n }\n }\n\n function beforestart(that, container, event, d, identifier, touch) {\n var dispatch = listeners.copy(),\n p = pointer(touch || event, container), dx, dy,\n s;\n\n if ((s = subject.call(that, new DragEvent(\"beforestart\", {\n sourceEvent: event,\n target: drag,\n identifier,\n active,\n x: p[0],\n y: p[1],\n dx: 0,\n dy: 0,\n dispatch\n }), d)) == null) return;\n\n dx = s.x - p[0] || 0;\n dy = s.y - p[1] || 0;\n\n return function gesture(type, event, touch) {\n var p0 = p, n;\n switch (type) {\n case \"start\": gestures[identifier] = gesture, n = active++; break;\n case \"end\": delete gestures[identifier], --active; // falls through\n case \"drag\": p = pointer(touch || event, container), n = active; break;\n }\n dispatch.call(\n type,\n that,\n new DragEvent(type, {\n sourceEvent: event,\n subject: s,\n target: drag,\n identifier,\n active: n,\n x: p[0] + dx,\n y: p[1] + dy,\n dx: p[0] - p0[0],\n dy: p[1] - p0[1],\n dispatch\n }),\n d\n );\n };\n }\n\n drag.filter = function(_) {\n return arguments.length ? (filter = typeof _ === \"function\" ? _ : constant(!!_), drag) : filter;\n };\n\n drag.container = function(_) {\n return arguments.length ? (container = typeof _ === \"function\" ? _ : constant(_), drag) : container;\n };\n\n drag.subject = function(_) {\n return arguments.length ? (subject = typeof _ === \"function\" ? _ : constant(_), drag) : subject;\n };\n\n drag.touchable = function(_) {\n return arguments.length ? (touchable = typeof _ === \"function\" ? _ : constant(!!_), drag) : touchable;\n };\n\n drag.on = function() {\n var value = listeners.on.apply(listeners, arguments);\n return value === listeners ? drag : value;\n };\n\n drag.clickDistance = function(_) {\n return arguments.length ? (clickDistance2 = (_ = +_) * _, drag) : Math.sqrt(clickDistance2);\n };\n\n return drag;\n}\n","var e10 = Math.sqrt(50),\n e5 = Math.sqrt(10),\n e2 = Math.sqrt(2);\n\nexport default function ticks(start, stop, count) {\n var reverse,\n i = -1,\n n,\n ticks,\n step;\n\n stop = +stop, start = +start, count = +count;\n if (start === stop && count > 0) return [start];\n if (reverse = stop < start) n = start, start = stop, stop = n;\n if ((step = tickIncrement(start, stop, count)) === 0 || !isFinite(step)) return [];\n\n if (step > 0) {\n let r0 = Math.round(start / step), r1 = Math.round(stop / step);\n if (r0 * step < start) ++r0;\n if (r1 * step > stop) --r1;\n ticks = new Array(n = r1 - r0 + 1);\n while (++i < n) ticks[i] = (r0 + i) * step;\n } else {\n step = -step;\n let r0 = Math.round(start * step), r1 = Math.round(stop * step);\n if (r0 / step < start) ++r0;\n if (r1 / step > stop) --r1;\n ticks = new Array(n = r1 - r0 + 1);\n while (++i < n) ticks[i] = (r0 + i) / step;\n }\n\n if (reverse) ticks.reverse();\n\n return ticks;\n}\n\nexport function tickIncrement(start, stop, count) {\n var step = (stop - start) / Math.max(0, count),\n power = Math.floor(Math.log(step) / Math.LN10),\n error = step / Math.pow(10, power);\n return power >= 0\n ? (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1) * Math.pow(10, power)\n : -Math.pow(10, -power) / (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1);\n}\n\nexport function tickStep(start, stop, count) {\n var step0 = Math.abs(stop - start) / Math.max(0, count),\n step1 = Math.pow(10, Math.floor(Math.log(step0) / Math.LN10)),\n error = step0 / step1;\n if (error >= e10) step1 *= 10;\n else if (error >= e5) step1 *= 5;\n else if (error >= e2) step1 *= 2;\n return stop < start ? -step1 : step1;\n}\n","export default function ascending(a, b) {\n return a == null || b == null ? NaN : a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;\n}\n","export default function descending(a, b) {\n return a == null || b == null ? NaN\n : b < a ? -1\n : b > a ? 1\n : b >= a ? 0\n : NaN;\n}\n","import ascending from \"./ascending.js\";\nimport descending from \"./descending.js\";\n\nexport default function bisector(f) {\n let compare1, compare2, delta;\n\n // If an accessor is specified, promote it to a comparator. In this case we\n // can test whether the search value is (self-) comparable. We can’t do this\n // for a comparator (except for specific, known comparators) because we can’t\n // tell if the comparator is symmetric, and an asymmetric comparator can’t be\n // used to test whether a single value is comparable.\n if (f.length !== 2) {\n compare1 = ascending;\n compare2 = (d, x) => ascending(f(d), x);\n delta = (d, x) => f(d) - x;\n } else {\n compare1 = f === ascending || f === descending ? f : zero;\n compare2 = f;\n delta = f;\n }\n\n function left(a, x, lo = 0, hi = a.length) {\n if (lo < hi) {\n if (compare1(x, x) !== 0) return hi;\n do {\n const mid = (lo + hi) >>> 1;\n if (compare2(a[mid], x) < 0) lo = mid + 1;\n else hi = mid;\n } while (lo < hi);\n }\n return lo;\n }\n\n function right(a, x, lo = 0, hi = a.length) {\n if (lo < hi) {\n if (compare1(x, x) !== 0) return hi;\n do {\n const mid = (lo + hi) >>> 1;\n if (compare2(a[mid], x) <= 0) lo = mid + 1;\n else hi = mid;\n } while (lo < hi);\n }\n return lo;\n }\n\n function center(a, x, lo = 0, hi = a.length) {\n const i = left(a, x, lo, hi - 1);\n return i > lo && delta(a[i - 1], x) > -delta(a[i], x) ? i - 1 : i;\n }\n\n return {left, center, right};\n}\n\nfunction zero() {\n return 0;\n}\n","import ascending from \"./ascending.js\";\nimport bisector from \"./bisector.js\";\nimport number from \"./number.js\";\n\nconst ascendingBisect = bisector(ascending);\nexport const bisectRight = ascendingBisect.right;\nexport const bisectLeft = ascendingBisect.left;\nexport const bisectCenter = bisector(number).center;\nexport default bisectRight;\n","export default function number(x) {\n return x === null ? NaN : +x;\n}\n\nexport function* numbers(values, valueof) {\n if (valueof === undefined) {\n for (let value of values) {\n if (value != null && (value = +value) >= value) {\n yield value;\n }\n }\n } else {\n let index = -1;\n for (let value of values) {\n if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) {\n yield value;\n }\n }\n }\n}\n","import value from \"./value.js\";\nimport numberArray, {isNumberArray} from \"./numberArray.js\";\n\nexport default function(a, b) {\n return (isNumberArray(b) ? numberArray : genericArray)(a, b);\n}\n\nexport function genericArray(a, b) {\n var nb = b ? b.length : 0,\n na = a ? Math.min(nb, a.length) : 0,\n x = new Array(na),\n c = new Array(nb),\n i;\n\n for (i = 0; i < na; ++i) x[i] = value(a[i], b[i]);\n for (; i < nb; ++i) c[i] = b[i];\n\n return function(t) {\n for (i = 0; i < na; ++i) c[i] = x[i](t);\n return c;\n };\n}\n","export default function(a, b) {\n var d = new Date;\n return a = +a, b = +b, function(t) {\n return d.setTime(a * (1 - t) + b * t), d;\n };\n}\n","import value from \"./value.js\";\n\nexport default function(a, b) {\n var i = {},\n c = {},\n k;\n\n if (a === null || typeof a !== \"object\") a = {};\n if (b === null || typeof b !== \"object\") b = {};\n\n for (k in b) {\n if (k in a) {\n i[k] = value(a[k], b[k]);\n } else {\n c[k] = b[k];\n }\n }\n\n return function(t) {\n for (k in i) c[k] = i[k](t);\n return c;\n };\n}\n","export default function(a, b) {\n if (!b) b = [];\n var n = a ? Math.min(b.length, a.length) : 0,\n c = b.slice(),\n i;\n return function(t) {\n for (i = 0; i < n; ++i) c[i] = a[i] * (1 - t) + b[i] * t;\n return c;\n };\n}\n\nexport function isNumberArray(x) {\n return ArrayBuffer.isView(x) && !(x instanceof DataView);\n}\n","import {color} from \"d3-color\";\nimport rgb from \"./rgb.js\";\nimport {genericArray} from \"./array.js\";\nimport date from \"./date.js\";\nimport number from \"./number.js\";\nimport object from \"./object.js\";\nimport string from \"./string.js\";\nimport constant from \"./constant.js\";\nimport numberArray, {isNumberArray} from \"./numberArray.js\";\n\nexport default function(a, b) {\n var t = typeof b, c;\n return b == null || t === \"boolean\" ? constant(b)\n : (t === \"number\" ? number\n : t === \"string\" ? ((c = color(b)) ? (b = c, rgb) : string)\n : b instanceof color ? rgb\n : b instanceof Date ? date\n : isNumberArray(b) ? numberArray\n : Array.isArray(b) ? genericArray\n : typeof b.valueOf !== \"function\" && typeof b.toString !== \"function\" || isNaN(b) ? object\n : number)(a, b);\n}\n","export default function(a, b) {\n return a = +a, b = +b, function(t) {\n return Math.round(a * (1 - t) + b * t);\n };\n}\n","export default function number(x) {\n return +x;\n}\n","import {bisect} from \"d3-array\";\nimport {interpolate as interpolateValue, interpolateNumber, interpolateRound} from \"d3-interpolate\";\nimport constant from \"./constant.js\";\nimport number from \"./number.js\";\n\nvar unit = [0, 1];\n\nexport function identity(x) {\n return x;\n}\n\nfunction normalize(a, b) {\n return (b -= (a = +a))\n ? function(x) { return (x - a) / b; }\n : constant(isNaN(b) ? NaN : 0.5);\n}\n\nfunction clamper(a, b) {\n var t;\n if (a > b) t = a, a = b, b = t;\n return function(x) { return Math.max(a, Math.min(b, x)); };\n}\n\n// normalize(a, b)(x) takes a domain value x in [a,b] and returns the corresponding parameter t in [0,1].\n// interpolate(a, b)(t) takes a parameter t in [0,1] and returns the corresponding range value x in [a,b].\nfunction bimap(domain, range, interpolate) {\n var d0 = domain[0], d1 = domain[1], r0 = range[0], r1 = range[1];\n if (d1 < d0) d0 = normalize(d1, d0), r0 = interpolate(r1, r0);\n else d0 = normalize(d0, d1), r0 = interpolate(r0, r1);\n return function(x) { return r0(d0(x)); };\n}\n\nfunction polymap(domain, range, interpolate) {\n var j = Math.min(domain.length, range.length) - 1,\n d = new Array(j),\n r = new Array(j),\n i = -1;\n\n // Reverse descending domains.\n if (domain[j] < domain[0]) {\n domain = domain.slice().reverse();\n range = range.slice().reverse();\n }\n\n while (++i < j) {\n d[i] = normalize(domain[i], domain[i + 1]);\n r[i] = interpolate(range[i], range[i + 1]);\n }\n\n return function(x) {\n var i = bisect(domain, x, 1, j) - 1;\n return r[i](d[i](x));\n };\n}\n\nexport function copy(source, target) {\n return target\n .domain(source.domain())\n .range(source.range())\n .interpolate(source.interpolate())\n .clamp(source.clamp())\n .unknown(source.unknown());\n}\n\nexport function transformer() {\n var domain = unit,\n range = unit,\n interpolate = interpolateValue,\n transform,\n untransform,\n unknown,\n clamp = identity,\n piecewise,\n output,\n input;\n\n function rescale() {\n var n = Math.min(domain.length, range.length);\n if (clamp !== identity) clamp = clamper(domain[0], domain[n - 1]);\n piecewise = n > 2 ? polymap : bimap;\n output = input = null;\n return scale;\n }\n\n function scale(x) {\n return x == null || isNaN(x = +x) ? unknown : (output || (output = piecewise(domain.map(transform), range, interpolate)))(transform(clamp(x)));\n }\n\n scale.invert = function(y) {\n return clamp(untransform((input || (input = piecewise(range, domain.map(transform), interpolateNumber)))(y)));\n };\n\n scale.domain = function(_) {\n return arguments.length ? (domain = Array.from(_, number), rescale()) : domain.slice();\n };\n\n scale.range = function(_) {\n return arguments.length ? (range = Array.from(_), rescale()) : range.slice();\n };\n\n scale.rangeRound = function(_) {\n return range = Array.from(_), interpolate = interpolateRound, rescale();\n };\n\n scale.clamp = function(_) {\n return arguments.length ? (clamp = _ ? true : identity, rescale()) : clamp !== identity;\n };\n\n scale.interpolate = function(_) {\n return arguments.length ? (interpolate = _, rescale()) : interpolate;\n };\n\n scale.unknown = function(_) {\n return arguments.length ? (unknown = _, scale) : unknown;\n };\n\n return function(t, u) {\n transform = t, untransform = u;\n return rescale();\n };\n}\n\nexport default function continuous() {\n return transformer()(identity, identity);\n}\n","export default function constants(x) {\n return function() {\n return x;\n };\n}\n","export function initRange(domain, range) {\n switch (arguments.length) {\n case 0: break;\n case 1: this.range(domain); break;\n default: this.range(range).domain(domain); break;\n }\n return this;\n}\n\nexport function initInterpolator(domain, interpolator) {\n switch (arguments.length) {\n case 0: break;\n case 1: {\n if (typeof domain === \"function\") this.interpolator(domain);\n else this.range(domain);\n break;\n }\n default: {\n this.domain(domain);\n if (typeof interpolator === \"function\") this.interpolator(interpolator);\n else this.range(interpolator);\n break;\n }\n }\n return this;\n}\n","// [[fill]align][sign][symbol][0][width][,][.precision][~][type]\nvar re = /^(?:(.)?([<>=^]))?([+\\-( ])?([$#])?(0)?(\\d+)?(,)?(\\.\\d+)?(~)?([a-z%])?$/i;\n\nexport default function formatSpecifier(specifier) {\n if (!(match = re.exec(specifier))) throw new Error(\"invalid format: \" + specifier);\n var match;\n return new FormatSpecifier({\n fill: match[1],\n align: match[2],\n sign: match[3],\n symbol: match[4],\n zero: match[5],\n width: match[6],\n comma: match[7],\n precision: match[8] && match[8].slice(1),\n trim: match[9],\n type: match[10]\n });\n}\n\nformatSpecifier.prototype = FormatSpecifier.prototype; // instanceof\n\nexport function FormatSpecifier(specifier) {\n this.fill = specifier.fill === undefined ? \" \" : specifier.fill + \"\";\n this.align = specifier.align === undefined ? \">\" : specifier.align + \"\";\n this.sign = specifier.sign === undefined ? \"-\" : specifier.sign + \"\";\n this.symbol = specifier.symbol === undefined ? \"\" : specifier.symbol + \"\";\n this.zero = !!specifier.zero;\n this.width = specifier.width === undefined ? undefined : +specifier.width;\n this.comma = !!specifier.comma;\n this.precision = specifier.precision === undefined ? undefined : +specifier.precision;\n this.trim = !!specifier.trim;\n this.type = specifier.type === undefined ? \"\" : specifier.type + \"\";\n}\n\nFormatSpecifier.prototype.toString = function() {\n return this.fill\n + this.align\n + this.sign\n + this.symbol\n + (this.zero ? \"0\" : \"\")\n + (this.width === undefined ? \"\" : Math.max(1, this.width | 0))\n + (this.comma ? \",\" : \"\")\n + (this.precision === undefined ? \"\" : \".\" + Math.max(0, this.precision | 0))\n + (this.trim ? \"~\" : \"\")\n + this.type;\n};\n","import {formatDecimalParts} from \"./formatDecimal.js\";\n\nexport var prefixExponent;\n\nexport default function(x, p) {\n var d = formatDecimalParts(x, p);\n if (!d) return x + \"\";\n var coefficient = d[0],\n exponent = d[1],\n i = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1,\n n = coefficient.length;\n return i === n ? coefficient\n : i > n ? coefficient + new Array(i - n + 1).join(\"0\")\n : i > 0 ? coefficient.slice(0, i) + \".\" + coefficient.slice(i)\n : \"0.\" + new Array(1 - i).join(\"0\") + formatDecimalParts(x, Math.max(0, p + i - 1))[0]; // less than 1y!\n}\n","export default function(x) {\n return Math.abs(x = Math.round(x)) >= 1e21\n ? x.toLocaleString(\"en\").replace(/,/g, \"\")\n : x.toString(10);\n}\n\n// Computes the decimal coefficient and exponent of the specified number x with\n// significant digits p, where x is positive and p is in [1, 21] or undefined.\n// For example, formatDecimalParts(1.23) returns [\"123\", 0].\nexport function formatDecimalParts(x, p) {\n if ((i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf(\"e\")) < 0) return null; // NaN, ±Infinity\n var i, coefficient = x.slice(0, i);\n\n // The string returned by toExponential either has the form \\d\\.\\d+e[-+]\\d+\n // (e.g., 1.2e+3) or the form \\de[-+]\\d+ (e.g., 1e+3).\n return [\n coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient,\n +x.slice(i + 1)\n ];\n}\n","import {formatDecimalParts} from \"./formatDecimal.js\";\n\nexport default function(x) {\n return x = formatDecimalParts(Math.abs(x)), x ? x[1] : NaN;\n}\n","import {formatDecimalParts} from \"./formatDecimal.js\";\n\nexport default function(x, p) {\n var d = formatDecimalParts(x, p);\n if (!d) return x + \"\";\n var coefficient = d[0],\n exponent = d[1];\n return exponent < 0 ? \"0.\" + new Array(-exponent).join(\"0\") + coefficient\n : coefficient.length > exponent + 1 ? coefficient.slice(0, exponent + 1) + \".\" + coefficient.slice(exponent + 1)\n : coefficient + new Array(exponent - coefficient.length + 2).join(\"0\");\n}\n","import formatDecimal from \"./formatDecimal.js\";\nimport formatPrefixAuto from \"./formatPrefixAuto.js\";\nimport formatRounded from \"./formatRounded.js\";\n\nexport default {\n \"%\": (x, p) => (x * 100).toFixed(p),\n \"b\": (x) => Math.round(x).toString(2),\n \"c\": (x) => x + \"\",\n \"d\": formatDecimal,\n \"e\": (x, p) => x.toExponential(p),\n \"f\": (x, p) => x.toFixed(p),\n \"g\": (x, p) => x.toPrecision(p),\n \"o\": (x) => Math.round(x).toString(8),\n \"p\": (x, p) => formatRounded(x * 100, p),\n \"r\": formatRounded,\n \"s\": formatPrefixAuto,\n \"X\": (x) => Math.round(x).toString(16).toUpperCase(),\n \"x\": (x) => Math.round(x).toString(16)\n};\n","export default function(x) {\n return x;\n}\n","import exponent from \"./exponent.js\";\nimport formatGroup from \"./formatGroup.js\";\nimport formatNumerals from \"./formatNumerals.js\";\nimport formatSpecifier from \"./formatSpecifier.js\";\nimport formatTrim from \"./formatTrim.js\";\nimport formatTypes from \"./formatTypes.js\";\nimport {prefixExponent} from \"./formatPrefixAuto.js\";\nimport identity from \"./identity.js\";\n\nvar map = Array.prototype.map,\n prefixes = [\"y\",\"z\",\"a\",\"f\",\"p\",\"n\",\"µ\",\"m\",\"\",\"k\",\"M\",\"G\",\"T\",\"P\",\"E\",\"Z\",\"Y\"];\n\nexport default function(locale) {\n var group = locale.grouping === undefined || locale.thousands === undefined ? identity : formatGroup(map.call(locale.grouping, Number), locale.thousands + \"\"),\n currencyPrefix = locale.currency === undefined ? \"\" : locale.currency[0] + \"\",\n currencySuffix = locale.currency === undefined ? \"\" : locale.currency[1] + \"\",\n decimal = locale.decimal === undefined ? \".\" : locale.decimal + \"\",\n numerals = locale.numerals === undefined ? identity : formatNumerals(map.call(locale.numerals, String)),\n percent = locale.percent === undefined ? \"%\" : locale.percent + \"\",\n minus = locale.minus === undefined ? \"−\" : locale.minus + \"\",\n nan = locale.nan === undefined ? \"NaN\" : locale.nan + \"\";\n\n function newFormat(specifier) {\n specifier = formatSpecifier(specifier);\n\n var fill = specifier.fill,\n align = specifier.align,\n sign = specifier.sign,\n symbol = specifier.symbol,\n zero = specifier.zero,\n width = specifier.width,\n comma = specifier.comma,\n precision = specifier.precision,\n trim = specifier.trim,\n type = specifier.type;\n\n // The \"n\" type is an alias for \",g\".\n if (type === \"n\") comma = true, type = \"g\";\n\n // The \"\" type, and any invalid type, is an alias for \".12~g\".\n else if (!formatTypes[type]) precision === undefined && (precision = 12), trim = true, type = \"g\";\n\n // If zero fill is specified, padding goes after sign and before digits.\n if (zero || (fill === \"0\" && align === \"=\")) zero = true, fill = \"0\", align = \"=\";\n\n // Compute the prefix and suffix.\n // For SI-prefix, the suffix is lazily computed.\n var prefix = symbol === \"$\" ? currencyPrefix : symbol === \"#\" && /[boxX]/.test(type) ? \"0\" + type.toLowerCase() : \"\",\n suffix = symbol === \"$\" ? currencySuffix : /[%p]/.test(type) ? percent : \"\";\n\n // What format function should we use?\n // Is this an integer type?\n // Can this type generate exponential notation?\n var formatType = formatTypes[type],\n maybeSuffix = /[defgprs%]/.test(type);\n\n // Set the default precision if not specified,\n // or clamp the specified precision to the supported range.\n // For significant precision, it must be in [1, 21].\n // For fixed precision, it must be in [0, 20].\n precision = precision === undefined ? 6\n : /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision))\n : Math.max(0, Math.min(20, precision));\n\n function format(value) {\n var valuePrefix = prefix,\n valueSuffix = suffix,\n i, n, c;\n\n if (type === \"c\") {\n valueSuffix = formatType(value) + valueSuffix;\n value = \"\";\n } else {\n value = +value;\n\n // Determine the sign. -0 is not less than 0, but 1 / -0 is!\n var valueNegative = value < 0 || 1 / value < 0;\n\n // Perform the initial formatting.\n value = isNaN(value) ? nan : formatType(Math.abs(value), precision);\n\n // Trim insignificant zeros.\n if (trim) value = formatTrim(value);\n\n // If a negative value rounds to zero after formatting, and no explicit positive sign is requested, hide the sign.\n if (valueNegative && +value === 0 && sign !== \"+\") valueNegative = false;\n\n // Compute the prefix and suffix.\n valuePrefix = (valueNegative ? (sign === \"(\" ? sign : minus) : sign === \"-\" || sign === \"(\" ? \"\" : sign) + valuePrefix;\n valueSuffix = (type === \"s\" ? prefixes[8 + prefixExponent / 3] : \"\") + valueSuffix + (valueNegative && sign === \"(\" ? \")\" : \"\");\n\n // Break the formatted value into the integer “value” part that can be\n // grouped, and fractional or exponential “suffix” part that is not.\n if (maybeSuffix) {\n i = -1, n = value.length;\n while (++i < n) {\n if (c = value.charCodeAt(i), 48 > c || c > 57) {\n valueSuffix = (c === 46 ? decimal + value.slice(i + 1) : value.slice(i)) + valueSuffix;\n value = value.slice(0, i);\n break;\n }\n }\n }\n }\n\n // If the fill character is not \"0\", grouping is applied before padding.\n if (comma && !zero) value = group(value, Infinity);\n\n // Compute the padding.\n var length = valuePrefix.length + value.length + valueSuffix.length,\n padding = length < width ? new Array(width - length + 1).join(fill) : \"\";\n\n // If the fill character is \"0\", grouping is applied after padding.\n if (comma && zero) value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = \"\";\n\n // Reconstruct the final output based on the desired alignment.\n switch (align) {\n case \"<\": value = valuePrefix + value + valueSuffix + padding; break;\n case \"=\": value = valuePrefix + padding + value + valueSuffix; break;\n case \"^\": value = padding.slice(0, length = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length); break;\n default: value = padding + valuePrefix + value + valueSuffix; break;\n }\n\n return numerals(value);\n }\n\n format.toString = function() {\n return specifier + \"\";\n };\n\n return format;\n }\n\n function formatPrefix(specifier, value) {\n var f = newFormat((specifier = formatSpecifier(specifier), specifier.type = \"f\", specifier)),\n e = Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3,\n k = Math.pow(10, -e),\n prefix = prefixes[8 + e / 3];\n return function(value) {\n return f(k * value) + prefix;\n };\n }\n\n return {\n format: newFormat,\n formatPrefix: formatPrefix\n };\n}\n","import formatLocale from \"./locale.js\";\n\nvar locale;\nexport var format;\nexport var formatPrefix;\n\ndefaultLocale({\n thousands: \",\",\n grouping: [3],\n currency: [\"$\", \"\"]\n});\n\nexport default function defaultLocale(definition) {\n locale = formatLocale(definition);\n format = locale.format;\n formatPrefix = locale.formatPrefix;\n return locale;\n}\n","import {ticks, tickIncrement} from \"d3-array\";\nimport continuous, {copy} from \"./continuous.js\";\nimport {initRange} from \"./init.js\";\nimport tickFormat from \"./tickFormat.js\";\n\nexport function linearish(scale) {\n var domain = scale.domain;\n\n scale.ticks = function(count) {\n var d = domain();\n return ticks(d[0], d[d.length - 1], count == null ? 10 : count);\n };\n\n scale.tickFormat = function(count, specifier) {\n var d = domain();\n return tickFormat(d[0], d[d.length - 1], count == null ? 10 : count, specifier);\n };\n\n scale.nice = function(count) {\n if (count == null) count = 10;\n\n var d = domain();\n var i0 = 0;\n var i1 = d.length - 1;\n var start = d[i0];\n var stop = d[i1];\n var prestep;\n var step;\n var maxIter = 10;\n\n if (stop < start) {\n step = start, start = stop, stop = step;\n step = i0, i0 = i1, i1 = step;\n }\n \n while (maxIter-- > 0) {\n step = tickIncrement(start, stop, count);\n if (step === prestep) {\n d[i0] = start\n d[i1] = stop\n return domain(d);\n } else if (step > 0) {\n start = Math.floor(start / step) * step;\n stop = Math.ceil(stop / step) * step;\n } else if (step < 0) {\n start = Math.ceil(start * step) / step;\n stop = Math.floor(stop * step) / step;\n } else {\n break;\n }\n prestep = step;\n }\n\n return scale;\n };\n\n return scale;\n}\n\nexport default function linear() {\n var scale = continuous();\n\n scale.copy = function() {\n return copy(scale, linear());\n };\n\n initRange.apply(scale, arguments);\n\n return linearish(scale);\n}\n","import {tickStep} from \"d3-array\";\nimport {format, formatPrefix, formatSpecifier, precisionFixed, precisionPrefix, precisionRound} from \"d3-format\";\n\nexport default function tickFormat(start, stop, count, specifier) {\n var step = tickStep(start, stop, count),\n precision;\n specifier = formatSpecifier(specifier == null ? \",f\" : specifier);\n switch (specifier.type) {\n case \"s\": {\n var value = Math.max(Math.abs(start), Math.abs(stop));\n if (specifier.precision == null && !isNaN(precision = precisionPrefix(step, value))) specifier.precision = precision;\n return formatPrefix(specifier, value);\n }\n case \"\":\n case \"e\":\n case \"g\":\n case \"p\":\n case \"r\": {\n if (specifier.precision == null && !isNaN(precision = precisionRound(step, Math.max(Math.abs(start), Math.abs(stop))))) specifier.precision = precision - (specifier.type === \"e\");\n break;\n }\n case \"f\":\n case \"%\": {\n if (specifier.precision == null && !isNaN(precision = precisionFixed(step))) specifier.precision = precision - (specifier.type === \"%\") * 2;\n break;\n }\n }\n return format(specifier);\n}\n","import exponent from \"./exponent.js\";\n\nexport default function(step, value) {\n return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3 - exponent(Math.abs(step)));\n}\n","import exponent from \"./exponent.js\";\n\nexport default function(step, max) {\n step = Math.abs(step), max = Math.abs(max) - step;\n return Math.max(0, exponent(max) - exponent(step)) + 1;\n}\n","import exponent from \"./exponent.js\";\n\nexport default function(step) {\n return Math.max(0, -exponent(Math.abs(step)));\n}\n","export default function(specifier) {\n var n = specifier.length / 6 | 0, colors = new Array(n), i = 0;\n while (i < n) colors[i] = \"#\" + specifier.slice(i * 6, ++i * 6);\n return colors;\n}\n","import colors from \"../colors.js\";\n\nfunction ramp(range) {\n var n = range.length;\n return function(t) {\n return range[Math.max(0, Math.min(n - 1, Math.floor(t * n)))];\n };\n}\n\nexport default ramp(colors(\"44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725\"));\n\nexport var magma = ramp(colors(\"00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf\"));\n\nexport var inferno = ramp(colors(\"00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4\"));\n\nexport var plasma = ramp(colors(\"0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921\"));\n","export default function(grouping, thousands) {\n return function(value, width) {\n var i = value.length,\n t = [],\n j = 0,\n g = grouping[0],\n length = 0;\n\n while (i > 0 && g > 0) {\n if (length + g + 1 > width) g = Math.max(1, width - length);\n t.push(value.substring(i -= g, i + g));\n if ((length += g + 1) > width) break;\n g = grouping[j = (j + 1) % grouping.length];\n }\n\n return t.reverse().join(thousands);\n };\n}\n","export default function(numerals) {\n return function(value) {\n return value.replace(/[0-9]/g, function(i) {\n return numerals[+i];\n });\n };\n}\n","// Trims insignificant zeros, e.g., replaces 1.2000k with 1.2k.\nexport default function(s) {\n out: for (var n = s.length, i = 1, i0 = -1, i1; i < n; ++i) {\n switch (s[i]) {\n case \".\": i0 = i1 = i; break;\n case \"0\": if (i0 === 0) i0 = i; i1 = i; break;\n default: if (!+s[i]) break out; if (i0 > 0) i0 = 0; break;\n }\n }\n return i0 > 0 ? s.slice(0, i0) + s.slice(i1 + 1) : s;\n}\n","export function Transform(k, x, y) {\n this.k = k;\n this.x = x;\n this.y = y;\n}\n\nTransform.prototype = {\n constructor: Transform,\n scale: function(k) {\n return k === 1 ? this : new Transform(this.k * k, this.x, this.y);\n },\n translate: function(x, y) {\n return x === 0 & y === 0 ? this : new Transform(this.k, this.x + this.k * x, this.y + this.k * y);\n },\n apply: function(point) {\n return [point[0] * this.k + this.x, point[1] * this.k + this.y];\n },\n applyX: function(x) {\n return x * this.k + this.x;\n },\n applyY: function(y) {\n return y * this.k + this.y;\n },\n invert: function(location) {\n return [(location[0] - this.x) / this.k, (location[1] - this.y) / this.k];\n },\n invertX: function(x) {\n return (x - this.x) / this.k;\n },\n invertY: function(y) {\n return (y - this.y) / this.k;\n },\n rescaleX: function(x) {\n return x.copy().domain(x.range().map(this.invertX, this).map(x.invert, x));\n },\n rescaleY: function(y) {\n return y.copy().domain(y.range().map(this.invertY, this).map(y.invert, y));\n },\n toString: function() {\n return \"translate(\" + this.x + \",\" + this.y + \") scale(\" + this.k + \")\";\n }\n};\n\nexport var identity = new Transform(1, 0, 0);\n\ntransform.prototype = Transform.prototype;\n\nexport default function transform(node) {\n while (!node.__zoom) if (!(node = node.parentNode)) return identity;\n return node.__zoom;\n}\n","export function randInt(n) {\n return Math.floor(Math.random() * n);\n}\nexport function permutation(n) {\n let array = Array(n).fill(0).map((x, i) => i);\n for (let i = array.length - 1; i > 0; i--) {\n const j = randInt(i + 1);\n [array[i], array[j]] = [array[j], array[i]];\n }\n return array;\n}\nexport function times(n, func, ...args) {\n let result = Array(n);\n for (let i = 0; i < n; i++)\n result[i] = func(...args);\n return result;\n}\nexport function zeros(n) {\n return Array(n).fill(0);\n}\nexport function vecSub(a, b) {\n let result = Array(a.length);\n for (let i = 0; i < result.length; i++)\n result[i] = a[i] - b[i];\n return result;\n}\nexport function vecAdd(a, b) {\n let result = Array(a.length);\n for (let i = 0; i < result.length; i++)\n result[i] = a[i] + b[i];\n return result;\n}\nexport function vecDot(a, b) {\n let result = 0;\n for (let i = 0; i < a.length; i++)\n result += a[i] * b[i];\n return result;\n}\nexport function vecScale(a, b) {\n let result = Array(a.length);\n for (let i = 0; i < result.length; i++)\n result[i] = a[i] * b;\n return result;\n}\nexport function zeroMat(n, m) {\n return times(n, zeros, m);\n}\nexport function matMulInto(result, A, B) {\n let a = A.length, b = A[0].length, c = B[0].length;\n for (let i = 0; i < a; i++)\n for (let k = 0; k < c; k++) {\n let s = 0;\n for (let j = 0; j < b; j++)\n s += A[i][j] * B[j][k];\n result[i][k] = s;\n }\n}\nexport function matMul(A, B) {\n let result = times(A.length, () => Array(B[0].length));\n matMulInto(result, A, B);\n return result;\n}\nexport function matTcrossprodInto(result, A, B) {\n let a = A.length, b = A[0].length, c = B.length;\n for (let i = 0; i < a; i++)\n for (let k = 0; k < c; k++) {\n let s = 0;\n for (let j = 0; j < b; j++)\n s += A[i][j] * B[k][j];\n result[i][k] = s;\n }\n}\nexport function matTcrossprod(A, B) {\n let result = times(A.length, Array, B.length);\n matTcrossprodInto(result, A, B);\n return result;\n}\nexport function matAdd(A, B) {\n let result = times(A.length, Array, A[0].length);\n for (let i = 0; i < A.length; i++)\n for (let j = 0; j < A[0].length; j++)\n result[i][j] = A[i][j] + B[i][j];\n return result;\n}\nexport function matScale(A, b) {\n return A.map(row => row.map(value => value * b));\n}\nexport function matScaleInto(A, b) {\n for (let i = 0; i < A.length; i++)\n for (let j = 0; j < A[0].length; j++)\n A[i][j] *= b;\n}\nexport function matAddInto(A, B) {\n for (let i = 0; i < A.length; i++)\n for (let j = 0; j < A[0].length; j++)\n A[i][j] += B[i][j];\n}\nexport function matTranspose(A) {\n let result = times(A[0].length, Array, A.length);\n for (let i = 0; i < A.length; i++)\n for (let j = 0; j < A[0].length; j++)\n result[j][i] = A[i][j];\n return result;\n}\nexport function removeSpin(motion, proj) {\n /* Ensure each row of motion is in the null space of the rows of proj.\n proj rows are assumed to be orthonormal.\n \n This is used to avoid adding random spin to the projection. */\n let result = [...motion];\n for (let i = 0; i < result.length; i++)\n for (let j = 0; j < proj.length; j++)\n result[i] = vecSub(result[i], vecScale(proj[j], vecDot(motion[i], proj[j])));\n return result;\n}\n//# sourceMappingURL=math.js.map","/**** Utility functions ****/\nexport function has(object, name) {\n return object.hasOwnProperty(name);\n}\nexport function elementVisible(el) {\n // Check several ways of hiding an element or its parents.\n // Hopefully this will work for slideshows.\n let parent = el;\n while (true) {\n let style = window.getComputedStyle(parent);\n if (style.opacity === \"0\" || style.display === \"none\" || style.visibility !== \"visible\")\n return false;\n if (!parent.parentElement)\n break;\n parent = parent.parentElement;\n }\n //https://stackoverflow.com/a/22480938 \n let rect = el.getBoundingClientRect();\n return rect.top < window.innerHeight && rect.bottom >= 0 &&\n rect.left < window.innerWidth && rect.right >= 0;\n}\nexport function locateEventInElement(event, el) {\n let rect = el.getBoundingClientRect();\n return [\n (event.x - rect.left) / rect.width * el.offsetWidth,\n (event.y - rect.top) / rect.height * el.offsetHeight\n ];\n}\nexport function toggleVisible(el) {\n if (el.style.display == \"none\")\n el.style.display = \"block\";\n else\n el.style.display = \"none\";\n}\nexport function hexByte(value) {\n value = Math.max(0, Math.min(255, Math.round(value)));\n return (value < 16 ? '0' : '') + value.toString(16);\n}\n//# sourceMappingURL=util.js.map","/* \"Guide\" gradients for projection pursuit.\n\n A guide is defined by a potential energy function.\n \n The only thing that matters for the guide is the gradient of this function.\n */\nimport { vecSub, vecDot, zeroMat, randInt, matScaleInto } from './math.js';\n/*\nI tried TensorFlow (tfjs) for gradients, but in the end did them by hand.\n\n\nfunction gradRepulsion(proj, X, power, fineScale) {\n let k = 1000;\n let A = Array(k);\n \n for(let i=0;i mag2[j]-mag2[i]);\n \n let grad = zeroMat(m,n);\n for(let j=0;j<3;j++)\n for(let i=0;i gradSparseRank(proj, 0.1),\n \"ultralocal\": (proj, X) => gradRepulsion(proj, X, -1, 0.05, 0.01),\n \"local\": (proj, X) => gradRepulsion(proj, X, 0, 0.01, 0.5),\n \"pca\": (proj, X) => gradRepulsion(proj, X, 1, 0, 0.5),\n \"outlier\": (proj, X) => gradRepulsion(proj, X, 2, 0, 5),\n \"push\": (proj, X) => gradCentralRepulsion(proj, X, 0.5, 0.01, 0.5),\n \"pull\": (proj, X) => gradCentralRepulsion(proj, X, 0.5, 0.01, -0.2),\n};\n//# sourceMappingURL=guides.js.map","import jstat from 'jstat';\nconst { normal } = jstat;\nimport { SVD } from 'svd-js';\nimport { rgb, scaleLinear, select, drag, interpolateViridis } from 'd3';\nimport { vecAdd, vecScale, vecDot, times, zeros, zeroMat, matAddInto, matScaleInto, matTcrossprodInto, matTranspose, matAdd, matScale, removeSpin, permutation } from './math.js';\nimport { has, elementVisible, locateEventInElement, toggleVisible, hexByte } from './util.js';\nimport { gradTable } from './guides.js';\nlet template = `~\n
~\n ~\n\n
~\n ~\n
~\n
~\n
~\n \n
\n \n
\n \n
\n \n \n \n \n \n \n \n
Brush size
Zoom
Damping
Heat
Label strength
Guide strength
\n
~\n
~\n\n
~\n ~\n \n ~\n \n ~\n \n
~\n Guide\n ~ \n
~\n \n
~\n \n
~\n \n
~\n
~\n
~\n`.replace(/~\\s+/g, ''); // Strip whitespace marked with initial '~'.\nlet playSvg = `\n \n`;\nlet pauseSvg = `\n \n \n`;\n/** Class to create and animate a Langevin Tour widget\n *\n * Emits a \"changeFilter\" event when a label checkbox is checked/unchecked.\n *\n * Emits a \"changeSelection\" event when brushing occurs.\n */\nexport class Langevitour extends EventTarget {\n /**\n * Create a Langevin Tour widget.\n * @param container Element to insert widget into.\n * @param width Desired initial width of widget.\n * @param height Desired initial height of widget.\n */\n constructor(container, width, height) {\n super();\n this.width = 1;\n this.height = 1;\n this.size = 1;\n // We stash the original size when we go full-screen\n this.fullscreen = false;\n this.originalWidth = 1;\n this.originalHeight = 1;\n this.pointSize = 1;\n this.center = [];\n this.scale = [];\n this.X = [[], []];\n this.n = 0;\n this.m = 0;\n this.colnames = [];\n this.permutor = [];\n this.unpermutor = [];\n this.rownames = [];\n this.group = [];\n this.levels = [];\n this.levelColors = [];\n this.lineFrom = [];\n this.lineTo = [];\n this.lineColors = [];\n this.fills = [];\n //Filters from outside, primarily to support \"crosstalk\"\n this.filter = null;\n //Selection both from crosstalk and internal\n this.selection = null;\n this.selectionChanged = false; // Do we need to emit a changeSelection event -- delayed to mouse up\n this.axes = [];\n this.labelData = [];\n // State of the system!\n this.proj = [[], []];\n this.vel = [[], []];\n this.zoom = 1;\n this.xScaleUnit = scaleLinear(); // Used for labels\n this.yScaleUnit = scaleLinear();\n this.xScale = scaleLinear(); // Used for points\n this.yScale = scaleLinear();\n this.xScaleClamped = scaleLinear();\n this.yScaleClamped = scaleLinear();\n this.haveData = false;\n this.playing = true;\n this.frameScheduled = false;\n this.lastTime = 0; // Last frame time, in seconds. Set to zero to cause no step on the next frame.\n this.mouseInCheckbox = false; // Track is mouse in checkbox. Do not drag if in checkbox.\n this.dragging = false; // Used to avoid dragging from checkbox. Also adjusts physics during drag.\n this.fps = []; // FPS for up to the last 100 frames\n this.computeMessage = \"\"; // Warnings such as hiding too many variables.\n this.mousing = false; // Should overlay be visible?\n this.mouseDown = false; // While this mouse is down, the selection continues to be updated.\n this.mouseWentDown = false; // Set when mouse button goes down. Unset once selection updated.\n this.mouseShiftKey = false; // Shift was pressed at mouse down, we want to extend the current selection.\n this.mouseX = 0;\n this.mouseY = 0;\n this.rightMouseDown = false; // Used to directly interact with projection. Note ctrl+left also triggers this, as right drag is difficult on trackpad.\n this.rightMouseWentDown = false;\n this.tugging = false;\n this.tugX = 0; // Desired position in projection space.\n this.tugY = 0;\n this.tugPoints = []; // Indices of points being tugged.\n // Only used during doFrame. \n // Properties only to avoid re-allocation.\n this.xy = [[], []];\n this.fillsFrame = [];\n this.pointActive = [];\n // Set up elements in a shadow DOM to isolate from document style.\n // The extra div seems necessary to avoid weird shrinkage with resizing.\n this.container = container;\n this.shadowDiv = document.createElement(\"div\");\n this.container.appendChild(this.shadowDiv);\n this.shadowRoot = this.shadowDiv.attachShadow({ mode: 'open' });\n this.shadowRoot.innerHTML = template;\n this.shadowChild = this.shadowRoot.firstChild;\n this.canvas = this.get('canvas');\n this.overlay = this.get('overlay');\n // Allow this to be found using document.getElementById(name).langevitour\n // @ts-ignore\n this.container.langevitour = this;\n this.resize(width, height);\n // Track mouse:\n // svg overlay only appears when mouse in plot area\n // row name labels use mouse position\n let plotDiv = this.get('plotDiv');\n plotDiv.addEventListener('mouseover', (e) => {\n this.mousing = true;\n this.scheduleFrameIfNeeded();\n });\n plotDiv.addEventListener('mouseout', (e) => {\n this.mousing = false;\n this.mouseDown = false;\n this.rightMouseDown = false;\n this.scheduleFrameIfNeeded();\n });\n let handleMouseMove = (e) => {\n [this.mouseX, this.mouseY] = locateEventInElement(e, this.canvas);\n if (!e.target.classList.contains(\"overlay\")) {\n this.mouseDown = false;\n this.rightMouseDown = false;\n return false;\n }\n // Ctrl+left click and right click are treated the same\n this.mouseDown = e.buttons == 1 && !e.ctrlKey;\n this.rightMouseDown = e.buttons == 2 || (e.buttons == 1 && e.ctrlKey);\n this.scheduleFrameIfNeeded();\n return true;\n };\n plotDiv.addEventListener('mousemove', (e) => {\n handleMouseMove(e);\n });\n plotDiv.addEventListener('mousedown', (e) => {\n if (!handleMouseMove(e))\n return; //Interacting with infoBox.\n let el = this.get('infoBox');\n if (el.style.visibility == 'visible') {\n el.style.visibility = 'hidden';\n return;\n }\n if (this.mouseDown) {\n this.mouseWentDown = true;\n this.mouseShiftKey = e.shiftKey;\n }\n if (this.rightMouseDown) {\n this.rightMouseWentDown = true;\n }\n this.scheduleFrameIfNeeded();\n });\n plotDiv.addEventListener('mouseup', (e) => {\n this.mouseDown = false;\n this.rightMouseDown = false;\n this.scheduleFrameIfNeeded();\n });\n // Hide fullscreen button if not available\n if (this.container.requestFullscreen == null)\n this.get('fullscreenButton').style.display = 'none';\n // Handle fullscreen\n // Complication: Window may resize after getting fullscreenchange event, so we have to handle window resize.\n // - Window does not resize immediately in Chrome.\n // - Macs with webcam cutout do something weird on Firefox.\n this.get('fullscreenButton').addEventListener('click', () => {\n if (!document.fullscreenElement) {\n this.shadowDiv.requestFullscreen();\n }\n else if (document.fullscreenElement === this.shadowDiv && document.exitFullscreen) {\n document.exitFullscreen();\n }\n });\n let handleWindowSize = () => {\n if (!this.fullscreen)\n return;\n let el = this.shadowDiv;\n let width = window.innerWidth;\n let height = window.innerHeight;\n let pad = Math.max(0, width - height) / 2;\n el.style.paddingLeft = pad + 'px';\n this.width = width - pad;\n this.height = height;\n this.configure();\n };\n this.shadowDiv.addEventListener('fullscreenchange', () => {\n let el = this.shadowDiv;\n if (document.fullscreenElement === el) {\n // Stash original size\n if (!this.fullscreen) {\n this.fullscreen = true;\n this.originalWidth = this.width;\n this.originalHeight = this.height;\n window.addEventListener('resize', handleWindowSize);\n }\n handleWindowSize();\n // ... further window resize events may occur while full screen ...\n }\n else if (this.fullscreen) {\n // Restore original size\n this.fullscreen = false;\n el.style.paddingLeft = '0px';\n this.width = this.originalWidth;\n this.height = this.originalHeight;\n window.removeEventListener('resize', handleWindowSize);\n this.configure();\n }\n });\n // Info box\n this.get('infoButton').addEventListener('click', () => {\n let el = this.get('infoBox');\n if (el.style.visibility == 'visible' || !this.haveData) {\n el.style.visibility = 'hidden';\n }\n else {\n el.style.visibility = 'visible';\n this.get('infoBoxProj').style.display = 'none';\n this.get('infoBoxState').style.display = 'none';\n this.get('infoBoxInfo').innerHTML = `

${this.X.length.toLocaleString(\"en-US\")} points.

`;\n }\n });\n this.get('infoBoxProjButton').addEventListener('click', () => {\n let el = this.getInput('infoBoxProj');\n toggleVisible(el);\n if (el.style.display != 'none') {\n let matStr = 'projection <- cbind(\\n c(';\n matStr += this.proj.map(line => line.map((item, i) => (item / this.scale[i]).toFixed(Math.ceil(Math.log10(Math.max(0, this.scale[i])) + 4))).join(',')).join('),\\n c(');\n matStr += '))\\nprojected <- as.matrix(X) %*% projection';\n this.getInput('infoBoxProj').value = matStr;\n }\n });\n this.get('infoBoxStateButton').addEventListener('click', () => {\n let el = this.getInput('infoBoxState');\n toggleVisible(el);\n if (el.style.display != 'none')\n el.value = JSON.stringify(this.getState(), null, 4);\n });\n // Play button\n this.get('playButton').addEventListener('click', () => this.setState({ playing: !this.playing }));\n }\n get(className) {\n return this.shadowChild.getElementsByClassName(className)[0];\n }\n getInput(className) {\n return this.get(className);\n }\n getString(className) {\n return this.getInput(className).value;\n }\n getNumber(className) {\n return Number(this.getInput(className).value);\n }\n getChecked(className) {\n return this.getInput(className).checked;\n }\n /* Notify listeners of label checkbox change. */\n emitChangeFilter() {\n setTimeout(() => this.dispatchEvent(new Event(\"changeFilter\")), 0);\n }\n emitChangeSelectionIfNeeded() {\n if (!this.selectionChanged)\n return;\n this.selectionChanged = false;\n setTimeout(() => this.dispatchEvent(new Event(\"changeSelection\")), 0);\n }\n /**\n * Show data in the widget. Use \"null\" to clear the widget.\n *\n * data.X A row-major matrix, where each row represents a point and each column represents a variable.\n *\n * data.colnames A name for each column in X.\n *\n * data.group Group number for each point. Integer values starting from 0.\n *\n * data.levels Group names for each group in data.group.\n *\n * [data.scale] Scale for each column.\n *\n * [data.center] Center for each column.\n *\n * [data.rownames] A name for each point.\n *\n * [data.extraAxes] A matrix with each column defining a projection of interest.\n *\n * [data.extraAxesNames] A name for each extra axis.\n *\n * [data.lineFrom] Rows of X to draw lines from.\n *\n * [data.lineTo] Rows of X to draw lines to.\n *\n * [data.lineColors] Color for each line.\n *\n * [data.axisColors] CSS colors for each variable and then optionally for each extra axis.\n *\n * [data.levelColors] CSS colors for each level.\n *\n * [data.colorVariation] Amount of brightness variation of points, between 0 and 1.\n *\n * [data.pointSize] Radius of points in pixels.\n *\n * [data.state] State to be passed on to setState().\n */\n renderValue(data) {\n if (!data) {\n this.haveData = false;\n this.configure();\n return;\n }\n this.haveData = true;\n //TODO: checking\n this.n = data.X.length;\n this.m = data.X[0].length;\n this.pointSize = data.pointSize != null ? data.pointSize : 1;\n let axisColors = data.axisColors || [];\n this.center = data.center || Array(this.m).fill(0);\n this.scale = data.scale || Array(this.m).fill(1);\n // Shuffling is not optional.\n this.permutor = permutation(this.n);\n this.unpermutor = Array(this.n);\n for (let i = 0; i < this.n; i++)\n this.unpermutor[this.permutor[i]] = i;\n this.X = this.permutor.map(i => data.X[i]);\n // Store data internally in centered and scaled form.\n this.X = this.X.map(item => item.map((value, i) => (value - this.center[i]) / this.scale[i]));\n if (!data.rownames || data.rownames.length == 0) {\n this.rownames = [];\n }\n else {\n let rownames = data.rownames;\n this.rownames = this.permutor.map(i => rownames[i]);\n }\n this.colnames = data.colnames;\n this.lineFrom = (data.lineFrom || []).map(i => this.unpermutor[i]);\n this.lineTo = (data.lineTo || []).map(i => this.unpermutor[i]);\n this.lineColors = (data.lineColors || []);\n // Default to semi-transparent black lines\n if (this.lineFrom.length && !this.lineColors.length)\n this.lineColors = this.lineFrom.map(() => \"#00000088\");\n this.axes = [];\n if (data.extraAxes && data.extraAxesNames)\n for (let i = 0; i < data.extraAxes[0].length; i++) {\n let proj = data.extraAxes.map(row => row[i]);\n let center = vecDot(proj, this.center);\n let projFromScaled = proj.map((value, j) => value * this.scale[j]);\n let scale = Math.sqrt(vecDot(projFromScaled, projFromScaled));\n let unit = vecScale(projFromScaled, 1 / scale);\n this.axes.push({\n name: data.extraAxesNames[i],\n unit: unit,\n scale: scale,\n center: center,\n color: axisColors[i + this.m],\n proj: [] //Filled in below.\n });\n }\n for (let i = 0; i < this.m; i++) {\n let unit = zeros(this.m);\n unit[i] = 1;\n this.axes.push({\n name: data.colnames[i],\n center: this.center[i],\n scale: this.scale[i],\n unit: unit,\n color: axisColors[i],\n proj: [] //Filled in below.\n });\n }\n // Precompute projection of all data onto all axes\n for (let i = 0; i < this.axes.length; i++) {\n this.axes[i].proj = this.X.map(vec => vecDot(vec, this.axes[i].unit));\n }\n this.levels = data.levels;\n this.group = this.permutor.map(i => data.group[i]);\n let nGroups = this.levels.length;\n this.levelColors = (data.levelColors || []).slice();\n // Pick a palette if not given\n for (let i = this.levelColors.length; i < nGroups; i++) {\n let angle = (i + 1 / 3) / nGroups;\n let value = 104;\n let r = value * (1 + Math.cos(angle * Math.PI * 2));\n let g = value * (1 + Math.cos((angle + 1 / 3) * Math.PI * 2));\n let b = value * (1 + Math.cos((angle + 2 / 3) * Math.PI * 2));\n this.levelColors[i] = rgb(r, g, b).formatHex();\n }\n // Point colors are given a small back-to-front brightness gradient,\n // to add some variation and give a pseudo-3D effect.\n let colorVariation = data.colorVariation == null ? 0.3 : data.colorVariation;\n this.fills = [];\n for (let i = 0; i < this.n; i++) {\n let pointColor = rgb(this.levelColors[this.group[i]]);\n let value = 1 + colorVariation * (i / this.n * 2 - 1);\n pointColor.r *= value;\n pointColor.g *= value;\n pointColor.b *= value;\n this.fills[i] = pointColor.formatHex();\n }\n this.labelData = [];\n if (this.levels.length > 1)\n for (let i = 0; i < this.levels.length; i++) {\n let vec = zeros(this.m);\n for (let j = 0; j < this.n; j++)\n if (this.group[j] == i)\n vec = vecAdd(vec, this.X[j]);\n vec = vecScale(vec, 1 / Math.sqrt(vecDot(vec, vec)));\n this.labelData.push({\n type: 'level',\n index: i,\n label: this.levels[i],\n vec: vec,\n color: this.levelColors[i],\n active: true,\n x: 2, y: 0,\n halfWidth: 0, halfHeight: 0, selected: 0,\n });\n }\n for (let i = 0; i < this.axes.length; i++) {\n this.labelData.push({\n type: 'axis',\n index: i,\n label: this.axes[i].name,\n vec: this.axes[i].unit,\n color: this.axes[i].color || '#000000',\n active: true,\n x: 2, y: 0,\n halfWidth: 0, halfHeight: 0, selected: 0,\n });\n }\n // Set initial projection state \n this.proj = zeroMat(2, this.m);\n this.proj[0][0] = 1;\n this.proj[1][1] = 1;\n this.vel = zeroMat(2, this.m);\n // Only used in doFrame. However this is a fairly large amount of memory that needs to be used each time.\n this.xy = zeroMat(2, this.n);\n this.fillsFrame = Array(this.n).fill(\"\");\n this.pointActive = Array(this.n).fill(true);\n this.configure();\n if (data.state)\n this.setState(data.state);\n }\n /**\n * Resize the widget.\n *\n * @param {number} width New width.\n * @param {number} height New height.\n */\n resize(width, height) {\n width = Math.max(200, width);\n height = Math.max(200, height);\n if (this.fullscreen) {\n this.originalWidth = width;\n this.originalHeight = height;\n }\n else {\n this.width = Math.max(200, width);\n this.height = Math.max(200, height);\n this.configure();\n }\n }\n configure() {\n this.canvas.style.width = this.width + 'px';\n this.overlay.style.width = this.width + 'px';\n // Scrollbars will appear if very small\n let controlHeight = this.get('controlDiv').offsetHeight + 5;\n this.size = Math.max(100, Math.min(this.width - 100, this.height - controlHeight));\n this.canvas.style.height = this.size + 'px';\n this.overlay.style.height = this.size + 'px';\n this.get('playButton').innerHTML = this.playing ? pauseSvg : playSvg;\n // Clean up and return if no data.\n if (!this.haveData) {\n // Clear any old display\n this.get('messageArea').innerText = '';\n this.overlay.style.opacity = \"0\";\n let ctx = this.canvas.getContext(\"2d\");\n ctx.scale(1, 1);\n ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);\n return;\n }\n this.configureScales();\n /* Draggable labels */\n let overlay = select(this.overlay);\n overlay.selectAll('*').remove();\n this.mouseInCheckbox = false;\n let thys = this; //sigh\n let divs = overlay\n .selectAll('div')\n .data(this.labelData)\n .join(enter => {\n let div = enter.append('div')\n .classed('labelDiv', true);\n div.append('input')\n .attr('type', 'checkbox')\n .property('checked', d => d.active)\n .on('change', function (e, d) {\n d.active = this.checked;\n thys.scheduleFrameIfNeeded();\n thys.emitChangeFilter();\n })\n .on('mouseover', () => { this.mouseInCheckbox = true; })\n .on('mouseout', () => { this.mouseInCheckbox = false; });\n div.append('span');\n return div;\n });\n divs\n .style('cursor', 'grab')\n .on('mouseover', (e, d) => { d.selected += 1; refreshLabels(); })\n .on('mouseout', (e, d) => { d.selected = Math.max(0, d.selected - 1); refreshLabels(); });\n divs\n .select('span')\n .text(d => d.label)\n .style('color', d => d.color);\n divs.each(function (d) {\n d.halfWidth = this.offsetWidth / 2;\n d.halfHeight = this.offsetHeight / 2;\n });\n function refreshLabels() {\n let maxX = thys.xScaleUnit.invert(thys.width);\n for (let item of thys.labelData) {\n item.x = Math.max(-1, Math.min(maxX, item.x));\n item.y = Math.max(-1, Math.min(1, item.y));\n }\n divs\n .style('left', d => thys.xScaleUnit(d.x) - d.halfWidth + 'px')\n .style('top', d => thys.yScaleUnit(d.y) - d.halfHeight + 'px')\n .style('background', d => d.selected ? '#aaa' : '#ddd');\n }\n let makeDraggable = drag()\n .subject(function (e, d) {\n return { x: d.x, y: d.y };\n })\n .on('start', function (e, d) {\n // Do not drag checkbox.\n if (thys.mouseInCheckbox)\n return;\n thys.dragging = true;\n this.style.cursor = 'grabbing';\n d.selected += 1;\n })\n .on('drag', function (e, d) {\n // We decided not to drag because we started on the checkbox.\n if (!thys.dragging)\n return;\n let [x, y] = locateEventInElement(e.sourceEvent, thys.canvas);\n d.x = thys.xScaleUnit.invert(x);\n d.y = thys.yScaleUnit.invert(y);\n refreshLabels();\n })\n .on('end', function (e, d) {\n if (!thys.dragging)\n return;\n thys.dragging = false;\n this.style.cursor = 'grab';\n d.selected = Math.max(0, d.selected - 1);\n });\n makeDraggable(divs);\n /* Set all as not selected.\n Reposition labels that are not currently in use. */\n let cols = Math.ceil((25 * this.labelData.length) / (this.size - 40));\n for (let i = 0; i < this.labelData.length; i++) {\n let d = this.labelData[i];\n d.selected = 0;\n if (d.x < 1)\n continue;\n let col = i % cols, row = (i - col) / cols;\n d.x = this.xScaleUnit.invert(this.size + 10 + d.halfWidth + (i % cols) * (this.width - this.size - 10) / cols);\n d.y = this.yScaleUnit.invert(20 + row * 25);\n }\n refreshLabels();\n this.scheduleFrameIfNeeded();\n }\n configureScales() {\n this.zoom = Math.pow(10, -this.getNumber('zoomInput'));\n this.xScaleUnit = scaleLinear()\n .domain([-1, 1]).range([2.5, this.size - 2.5]);\n this.yScaleUnit = scaleLinear()\n .domain([-1, 1]).range([this.size - 2.5, 2.5]);\n this.xScale = scaleLinear()\n .domain([-this.zoom, this.zoom]).range([2.5, this.size - 2.5]);\n this.yScale = scaleLinear()\n .domain([-this.zoom, this.zoom]).range([this.size - 2.5, 2.5]);\n this.xScaleClamped = this.xScale.copy().clamp(true);\n this.yScaleClamped = this.yScale.copy().clamp(true);\n }\n /**\n * Get the current widget state.\n */\n getState() {\n let result = {};\n result.playing = this.playing;\n result.axesOn = this.getChecked('axesCheckbox');\n result.heatOn = this.getChecked('heatCheckbox');\n result.guideType = this.getString('guideSelect');\n result.labelAttractionOn = this.getChecked('labelCheckbox');\n result.damping = this.getNumber('dampInput');\n result.heat = this.getNumber('heatInput');\n result.guide = this.getNumber('guideInput');\n result.labelAttraction = this.getNumber('labelInput');\n result.zoom = this.getNumber('zoomInput');\n result.brush = this.getNumber('brushInput');\n result.labelInactive = [];\n result.labelPos = {};\n for (let item of this.labelData) {\n if (!item.active)\n result.labelInactive.push(item.label);\n if (item.x < 1)\n result.labelPos[item.label] = [item.x, item.y];\n }\n result.projection = this.proj;\n // Potentially large.\n if (this.selection)\n result.selection = this.unpermutor.map(i => this.selection[i]);\n else\n result.selection = null;\n // Potentially large.\n if (this.filter)\n result.filter = this.unpermutor.map(i => this.filter[i]);\n else\n result.filter = null;\n return result;\n }\n /**\n * Set the widget state.\n *\n * Can be used to restore a previous state of the widget obtained with getState().\n *\n * @param state A JSON string or an Object containing the desired state.\n */\n setState(state) {\n let needChangeFilter = false;\n let needChangeSelection = false;\n if (typeof state == \"string\")\n state = JSON.parse(state);\n if (!state)\n return;\n if (has(state, 'playing')) {\n // Don't leap forward in time when we start playing again.\n if (!this.playing && state.playing)\n this.lastTime = 0;\n this.playing = state.playing;\n }\n if (has(state, 'axesOn'))\n this.getInput('axesCheckbox').checked = state.axesOn;\n if (has(state, 'heatOn'))\n this.getInput('heatCheckbox').checked = state.heatOn;\n // Old \n if (has(state, 'pointRepulsionType'))\n this.getInput('guideSelect').value = state.pointRepulsionType;\n // New\n if (has(state, 'guideType'))\n this.getInput('guideSelect').value = state.guideType;\n if (has(state, 'labelAttractionOn'))\n this.getInput('labelCheckbox').checked = state.labelAttractionOn;\n if (has(state, 'damping'))\n this.getInput('dampInput').value = state.damping;\n if (has(state, 'heat'))\n this.getInput('heatInput').value = state.heat;\n // Old\n if (has(state, 'pointRepulsion'))\n this.getInput('guideInput').value = state.pointRepulsion;\n // New\n if (has(state, 'guide'))\n this.getInput('guideInput').value = state.guide;\n if (has(state, 'labelAttraction'))\n this.getInput('labelInput').value = state.labelAttraction;\n if (has(state, 'zoom'))\n this.getInput('zoomInput').value = state.zoom;\n if (has(state, 'brush'))\n this.getInput('brushInput').value = state.brush;\n if (has(state, 'labelInactive')) {\n for (let item of this.labelData)\n item.active = !state.labelInactive.includes(item.label);\n needChangeFilter = true;\n }\n if (has(state, 'labelPos')) {\n for (let item of this.labelData) {\n if (has(state.labelPos, item.label)) {\n item.x = state.labelPos[item.label][0];\n item.y = state.labelPos[item.label][1];\n }\n else {\n item.x = 1;\n }\n }\n }\n if (has(state, 'projection'))\n this.proj = Array.from(state.projection.map(item => Array.from(item)));\n if (has(state, 'selection')) {\n if (state.selection === null)\n this.selection = null;\n else\n this.selection = this.permutor.map(i => state.selection[i]);\n this.selectionChanged = true;\n needChangeSelection = true;\n }\n if (has(state, 'filter')) {\n if (state.filter === null)\n this.filter = null;\n else\n this.filter = this.permutor.map(i => state.filter[i]);\n }\n this.configure();\n if (needChangeFilter)\n this.emitChangeFilter();\n if (needChangeSelection)\n this.emitChangeSelectionIfNeeded();\n }\n scheduleFrameIfNeeded() {\n if (this.frameScheduled || !this.haveData)\n return;\n window.requestAnimationFrame(this.doFrame.bind(this));\n this.frameScheduled = true;\n }\n /* Update display.\n \n Also updates selection if mouse is down.\n \n Also schedules another frame if needed.\n */\n doFrame(time) {\n this.frameScheduled = false;\n if (!this.haveData)\n return;\n if (!elementVisible(this.container)) {\n // Don't leap forward in time when we become visible again.\n this.lastTime = 0;\n // We aren't visible. Wait a while.\n window.setTimeout(this.scheduleFrameIfNeeded.bind(this), 100);\n return;\n }\n time /= 1000.0; //Convert to seconds\n let elapsed = 0;\n if ((this.playing || this.tugging) && this.lastTime != 0) {\n elapsed = time - this.lastTime;\n this.fps.push(Math.round(1 / elapsed));\n if (this.fps.length > 100)\n this.fps.shift();\n }\n this.lastTime = time;\n this.compute(elapsed);\n this.configureScales();\n let selectedAxis = null;\n let selectedLevel = null;\n let selected = this.labelData.filter(d => d.selected);\n if (selected.length) {\n if (selected[0].type == 'axis')\n selectedAxis = selected[0].index;\n else\n selectedLevel = selected[0].index;\n }\n let showAxes = this.getChecked('axesCheckbox');\n let levelActive = Array(this.levels.length).fill(true);\n for (let item of this.labelData)\n if (item.type == 'level')\n levelActive[item.index] = item.active;\n // Note: pointActive is updated in compute.\n // Points within brush distance, for brushing and row label\n let brushRadius = this.size * 0.05 * Math.pow(10, this.getNumber('brushInput'));\n let brushPoints = [];\n if (this.mouseX < this.size) {\n for (let i = 0; i < this.n; i++) {\n if (!this.pointActive[i])\n continue;\n let d2 = Math.pow((this.xScaleClamped(this.xy[0][i]) - this.mouseX), 2) +\n Math.pow((this.yScaleClamped(this.xy[1][i]) - this.mouseY), 2);\n if (d2 > Math.pow(brushRadius, 2))\n continue;\n brushPoints.push({ index: i, d2: d2 });\n }\n brushPoints.sort((a, b) => a.d2 - b.d2);\n }\n // Respond to right-mouse tugging\n if (this.rightMouseWentDown) {\n this.tugPoints = brushPoints.map(item => item.index);\n this.rightMouseWentDown = false;\n }\n this.tugging = this.rightMouseDown && this.tugPoints.length > 0;\n if (this.tugging) {\n this.tugX = this.xScale.invert(this.mouseX);\n this.tugY = this.yScale.invert(this.mouseY);\n }\n // Update selection.\n // This is kind of an odd place to do this.\n if (this.mouseDown || this.mouseWentDown) {\n // Clear selection on mouse down unless shift was pressed.\n if (this.mouseWentDown && !this.mouseShiftKey) {\n this.selection = null;\n this.selectionChanged = true;\n }\n if (brushPoints.length) {\n if (!this.selection) {\n this.selection = Array(this.n).fill(false);\n this.selectionChanged = true;\n }\n for (let i = 0; i < brushPoints.length; i++) {\n if (!this.selection[brushPoints[i].index]) {\n this.selection[brushPoints[i].index] = true;\n this.selectionChanged = true;\n }\n }\n }\n this.mouseWentDown = false;\n //Note: at end of this function, we decide if it's time to emit a changeSelection event\n }\n this.overlay.style.opacity = this.mousing ? \"1\" : \"0\";\n // Setup canvas and get context\n // Adjust for HiDPI screens and zoom level\n // see https://developer.mozilla.org/en-US/docs/Web/API/Window/devicePixelRatio\n let ratio = window.devicePixelRatio;\n this.canvas.width = Math.floor(this.width * ratio);\n this.canvas.height = Math.floor(this.size * ratio);\n let ctx = this.canvas.getContext(\"2d\");\n ctx.scale(ratio, ratio);\n ctx.clearRect(0, 0, this.width, this.size);\n let rx = this.xScale.range(), ry = this.yScale.range();\n ctx.strokeStyle = '#000';\n ctx.fillStyle = '#fff';\n ctx.fillRect(rx[0], ry[0], rx[1] - rx[0], ry[1] - ry[0]);\n ctx.strokeRect(rx[0], ry[0], rx[1] - rx[0], ry[1] - ry[0]);\n // Axes\n let axisScale = 0.75 * this.zoom;\n ctx.strokeStyle = '#ccc';\n if (showAxes)\n for (let i = 0; i < this.axes.length; i++) {\n let xProj = vecDot(this.proj[0], this.axes[i].unit);\n let yProj = vecDot(this.proj[1], this.axes[i].unit);\n ctx.beginPath();\n ctx.moveTo(this.xScale(0), this.yScale(0));\n ctx.lineTo(this.xScale(axisScale * xProj), this.yScale(axisScale * yProj));\n ctx.stroke();\n }\n // Projection\n matTcrossprodInto(this.xy, this.proj, this.X);\n // Lines\n for (let i = 0; i < this.lineFrom.length; i++) {\n let a = this.lineFrom[i], b = this.lineTo[i];\n if (!this.pointActive[a] || !this.pointActive[b])\n continue;\n ctx.strokeStyle = (!this.selection || (this.selection[a] && this.selection[b])) ? this.lineColors[i] : '#bbbbbb';\n // Make short lines thicker so they have equal visual weight to longer lines\n // Clipped for d < 1/4, d > 1\n let d = Math.sqrt(Math.pow((this.xy[0][a] - this.xy[0][b]), 2) + Math.pow((this.xy[1][a] - this.xy[1][b]), 2));\n d = Math.max(1 / 4, Math.min(1, d));\n ctx.lineWidth = 0.25 / d;\n ctx.beginPath();\n ctx.moveTo(this.xScaleClamped(this.xy[0][a]), this.yScaleClamped(this.xy[1][a]));\n ctx.lineTo(this.xScaleClamped(this.xy[0][b]), this.yScaleClamped(this.xy[1][b]));\n ctx.stroke();\n }\n ctx.lineWidth = 1;\n // Points\n // Default to group colors\n for (let i = 0; i < this.n; i++)\n this.fillsFrame[i] = this.fills[i];\n // If a crosstalk selection is active, gray the inactive points\n if (this.selection) {\n for (let i = 0; i < this.n; i++) {\n if (!this.selection[i])\n this.fillsFrame[i] = '#bbbbbb';\n }\n }\n // If we're mousing over a level, gray the other levels\n if (selectedLevel !== null && levelActive[selectedLevel]) {\n for (let i = 0; i < this.n; i++) {\n if (this.group[i] != selected[0].index)\n this.fillsFrame[i] = '#bbbbbb';\n }\n }\n // If we're mousing over an axis, color by position on axis\n if (selectedAxis !== null) {\n for (let i = 0; i < this.n; i++) {\n let c = this.axes[selectedAxis].proj[i];\n c = Math.tanh(c * 2); // Extreme values compressed so -1= 0; i--) {\n let j = brushPoints[i].index;\n let x = this.xScaleClamped(this.xy[0][j]), y = this.yScaleClamped(this.xy[1][j]);\n ctx.strokeText(this.rownames[j], x, y);\n ctx.fillText(this.rownames[j], x, y);\n }\n }\n ctx.restore();\n //Legend\n ctx.textAlign = 'left';\n ctx.textBaseline = 'middle';\n ctx.font = '15px sans-serif';\n if (!this.mousing)\n for (let i = 0, j = 0; i < this.levels.length; i++)\n if (levelActive[i]) {\n ctx.fillStyle = this.levelColors[i];\n ctx.fillText(this.levels[i], this.size + 10, 11 + j * 20);\n j++;\n }\n //Hints and messages text\n let hint = '';\n if (this.tugging) {\n hint = \"drag to tug\\n\";\n }\n else if (this.mouseInCheckbox && selected.length) {\n if (selected[0].active)\n hint = \"click to hide\\n\";\n else\n hint = \"click to show\\n\";\n }\n else if (selectedAxis !== null || selectedLevel !== null) {\n hint = \"drag to position\\n\";\n }\n else if (brushPoints.length && !this.mouseDown) {\n if (this.selection)\n hint = \"shift+click to enlarge\\n\";\n else\n hint = \"click to select\\nctrl+drag to tug\\n\";\n }\n else if (this.selection && this.mousing && !brushPoints.length && !this.mouseDown) {\n hint = \"click to clear\\n\";\n }\n this.get('messageArea').innerText = `${this.computeMessage || hint}${Math.min(...this.fps)} to ${Math.max(...this.fps)} FPS`;\n // Schedule another frame if needed\n if (this.playing || this.tugging) {\n // Schedule a frame normally.\n // Add a slight delay so we never run at 100% CPU.\n // (I think the browser may start putting off things that it really shouldn't if we run at 100%.)\n window.setTimeout(this.scheduleFrameIfNeeded.bind(this), 5);\n }\n // Emit updated selection\n if (this.selectionChanged && !this.mouseDown)\n this.emitChangeSelectionIfNeeded();\n }\n compute(realElapsed) {\n let damping = 0.1 * Math.pow(10, this.getNumber('dampInput'));\n let heat = 0.1 * Math.pow(10, this.getNumber('heatInput'));\n let guide = 1.0 * Math.pow(10, this.getNumber('guideInput'));\n let attraction = 1.0 * Math.pow(10, this.getNumber('labelInput'));\n let doHeat = this.getChecked('heatCheckbox');\n let whatGuide = this.getString('guideSelect');\n let doAttraction = this.getChecked('labelCheckbox');\n let levelActive = Array(this.levels.length).fill(true);\n for (let item of this.labelData)\n if (item.type == 'level')\n levelActive[item.index] = item.active;\n for (let i = 0; i < this.n; i++)\n this.pointActive[i] = levelActive[this.group[i]];\n if (this.filter !== null) {\n for (let i = 0; i < this.n; i++)\n this.pointActive[i] = this.pointActive[i] && this.filter[i];\n }\n // Cut down oscillation during dragging\n if (this.dragging && doAttraction) {\n damping = Math.max(damping, attraction * 5.0);\n }\n let elapsed = Math.max(1e-6, Math.min(1, realElapsed));\n this.computeMessage = '';\n let vel = this.vel;\n let proj = this.proj;\n //Integrate dv/dt = -damping * v\n let velKeep = Math.exp(-elapsed * damping);\n matScaleInto(vel, velKeep);\n if (this.tugging) {\n // Calculate tugging based position update.\n let tugAmount = Math.min(100, 1 / elapsed);\n let tugCenter = zeros(this.m);\n for (let i = 0; i < this.tugPoints.length; i++)\n tugCenter = vecAdd(tugCenter, this.X[this.tugPoints[i]]);\n tugCenter = vecScale(tugCenter, 1 / this.tugPoints.length);\n let currentX = vecDot(tugCenter, proj[0]);\n let currentY = vecDot(tugCenter, proj[1]);\n let length2 = vecDot(tugCenter, tugCenter) + 1e-4;\n // Don't tug beyond what is possible\n let tugX = this.tugX;\n let tugY = this.tugY;\n let tugAdjust = Math.sqrt((tugX * tugX + tugY * tugY) / length2);\n if (tugAdjust >= 1.0) {\n tugX /= tugAdjust;\n tugY /= tugAdjust;\n }\n vel[0] = vecScale(tugCenter, (tugX - currentX) / length2 * tugAmount);\n vel[1] = vecScale(tugCenter, (tugY - currentY) / length2 * tugAmount);\n // Note this removes any existing velocity!\n // Don't do any other velocity adjustments.\n doHeat = false;\n doAttraction = false;\n whatGuide = 'none';\n }\n if (doHeat) {\n // Damping reduces the variance * velKeep^2\n // We need to add velReplaceVar * desired steady state variance of temperature\n // Note the sqrt(2) that appears in the continuous form of the Langevin equation arises from \n // sqrt(1-velKeep*velKeep) approx= sqrt(2*elapsed*damping) for small elapsed*damping\n let velReplaceVar = 1 - velKeep * velKeep;\n let noise = times(proj.length, times, this.m, normal.sample, 0, Math.sqrt(heat * velReplaceVar));\n noise = removeSpin(noise, proj);\n matAddInto(vel, noise);\n }\n if (whatGuide != 'none') {\n let activeX = this.X.filter((item, i) => this.pointActive[i]);\n if (activeX.length) {\n let grad = gradTable[whatGuide](proj, activeX);\n matScaleInto(grad, -guide);\n matAddInto(vel, grad);\n }\n }\n if (doAttraction)\n for (let label of this.labelData) {\n let x = label.x;\n let y = label.y;\n if (x <= -1 || y <= -1 || x >= 1 || y >= 1)\n continue;\n if (label.type == 'level' && !levelActive[label.index])\n continue;\n let adjustment = 4 * (x * x + y * y);\n vel[0] = vecAdd(vel[0], vecScale(label.vec, x * adjustment * attraction));\n vel[1] = vecAdd(vel[1], vecScale(label.vec, y * adjustment * attraction));\n }\n // Nuke inactive axes\n // - remove from velocity\n // - gradually remove from position\n let inactive = [];\n for (let item of this.labelData)\n if (item.type == 'axis' && !item.active)\n inactive.push(this.axes[item.index].unit);\n let tooMany = inactive.length >= this.m - 1;\n let anyDropped = false;\n if (inactive.length && !tooMany) {\n // How fast inactive axes are removed\n let nuke_amount = Math.min(2, 1 / elapsed);\n let { u, v, q } = SVD(matTranspose(inactive));\n let maxQ = Math.max(...q);\n u = matTranspose(u);\n let remove = zeroMat(2, this.m);\n for (let i = 0; i < u.length; i++) {\n // Don't nuke tiny directions (could arise from redundant nukings). TODO: make tolerance level an option\n if (q[i] < maxQ * 1e-6) {\n anyDropped = true;\n continue;\n }\n let vec = u[i];\n for (let j = 0; j < 2; j++) {\n // Remove any velocity and part of the projection along u[i]\n remove[j] = vecAdd(remove[j], vecScale(vec, -vecDot(vec, vel[j]) - nuke_amount * vecDot(vec, proj[j])));\n }\n }\n // Don't introduce spin while removing\n matAddInto(vel, removeSpin(remove, proj));\n }\n if (tooMany)\n this.computeMessage += 'Error: too many axes removed\\n';\n if (anyDropped)\n this.computeMessage += 'Note: redundant axes removed\\n';\n // Velocity step \n let newProj = matAdd(proj, matScale(vel, elapsed));\n // Project onto Stiefel manifold \n let { u, v, q } = SVD(matTranspose(newProj));\n matTcrossprodInto(newProj, v, u);\n // \"Position based dynamics\"\n vel = matScale(matAdd(newProj, matScale(proj, -1)), 1 / elapsed);\n // No velocity during tugging\n if (this.tugging)\n vel = [zeros(this.m), zeros(this.m)];\n this.proj = newProj;\n this.vel = vel;\n }\n}\n//# sourceMappingURL=langevitour.js.map","import {select} from \"d3-selection\";\nimport noevent, {nonpassivecapture} from \"./noevent.js\";\n\nexport default function(view) {\n var root = view.document.documentElement,\n selection = select(view).on(\"dragstart.drag\", noevent, nonpassivecapture);\n if (\"onselectstart\" in root) {\n selection.on(\"selectstart.drag\", noevent, nonpassivecapture);\n } else {\n root.__noselect = root.style.MozUserSelect;\n root.style.MozUserSelect = \"none\";\n }\n}\n\nexport function yesdrag(view, noclick) {\n var root = view.document.documentElement,\n selection = select(view).on(\"dragstart.drag\", null);\n if (noclick) {\n selection.on(\"click.drag\", noevent, nonpassivecapture);\n setTimeout(function() { selection.on(\"click.drag\", null); }, 0);\n }\n if (\"onselectstart\" in root) {\n selection.on(\"selectstart.drag\", null);\n } else {\n root.style.MozUserSelect = root.__noselect;\n delete root.__noselect;\n }\n}\n"],"names":["jStat","module","exports","Math","undefined","concat","Array","prototype","slice","toString","Object","calcRdx","n","m","val","pow","log","LOG10E","isArray","arg","call","isFunction","isNumber","num","_init","arguments","retZero","retOne","retIdent","i","j","fn","args","map","length","this","seq","apply","toArray","constructor","utils","toVector","arr","_random_fn","random","setRandom","TypeError","extend","obj","rows","cols","dimensions","row","index","rowa","col","submat","arange","forEach","ind","column","cola","a","diag","nrow","res","antidiag","transpose","objArr","push","func","toAlter","ncol","cumreduce","alter","create","zeros","ones","rand","identity","symmetric","size","clear","min","max","cnt","hival","step","current","start","end","rl","_slice","list","copy","rcSlice","colSlice","rowSlice","sliceAssign","A","B","nl","ml","diagonal","diagArray","mat","t","jProto","sort","splice","funcs","passfunc","results","self","setTimeout","split","ascNum","b","clip","sum","sumsqrd","sumsqerr","tmp","mean","sumrow","product","prod","low","high","unique","hash","_arr","meansqerr","geomean","median","arrlen","cumsum","cumprod","diff","diffs","arrLen","rank","distinctNumbers","numberCounts","number","sortedDistinctNumbers","numberRanks","currentRank","count","mode","maxCount","numMaxCount","mode_arr","range","variance","flag","pooledvariance","reduce","samples","deviation","dev","stdev","sqrt","pooledstdev","meandev","abs","meddev","coeffvar","quartiles","round","quantiles","quantilesArray","alphap","betap","p","aleph","k","gamma","sortedArray","quantileVals","floor","percentile","exclusive","realIndex","parseInt","frac","percentileOfScore","score","kind","value","counter","len","strict","histogram","binCnt","first","binWidth","bins","covariance","arr1","arr2","u","v","arr1Len","sq_dev","corrcoeff","spearmancoeff","stanMoment","mu","sigma","skewSum","skewness","kurtosis","fullbool","tmpthis","callbackFunction","argsToPass","curriedFunction","vector","gammaln","x","xx","y","cof","ser","loggam","x0","x2","xp","gl","gl0","PI","gammafn","z","yi","q","fact","xden","xnum","Infinity","sin","gammap","lowRegGamma","an","aln","ap","del","c","d","h","ITMAX","NaN","exp","factorialln","factorial","combination","combinationln","permutation","betafn","betaln","betacf","m2","aa","fpmin","qab","qap","qam","gammapinv","pp","lna1","afac","a1","gln","erf","ty","isneg","dd","erfc","erfcinv","err","ibetainv","lna","lnb","al","w","b1","ibeta","bt","randn","randg","shape","a2","oalph","betinc","eps","c9","a0","b0","m9","tukeyWprob","rr","cc","xleg","aleg","qsqz","wincr","pr_w","normal","cdf","blb","binc","bub","einsum","cc1","wi","elsum","jj","ac","qexpo","rinsum","f","_a","_b","_c","newthis","data","sample","vals","fnfunc","beta","pdf","alpha","inv","centralF","df1","df2","binomial","cauchy","local","scale","atan","tan","chisquare","dof","exponential","rate","invgamma","kumaraswamy","Error","lognormal","noncentralt","ncp","studentt","tol","flip","prob","lastvalue","std","pareto","SQRT2","dof2","weibull","uniform","betacdf","s","negbin","r","hypgeom","N","scaledPDF","samplesDone","scaledCDF","factor","poisson","l","sumarr","sampleSmall","L","sampleLarge","U","V","slam","loglam","invalpha","vr","us","lam","triangular","arcsine","asin","cos","laplace","tukey","nmeans","df","xlegq","alegq","Number","isFinite","ulen","f2","f2lf","f21","ff4","ans","otsum","twa1","t1","x1","ps","tukeyQinv","valx0","valx1","iter","isUsable","add","subtract","divide","multiply","nrescols","rescols","outer","dot","left","right","norm","nnorm","isNaN","angle","acos","aug","newarr","gauss_jordan","result","det","alen","alend","rowshift","colshift","mrow","mcol","gauss_elimination","maug","pivot","temp","y2","maxrow","triaUpSolve","parts","matrix_mode","triaLowSolve","lu","R","cholesky","T","gauss_jacobi","xv","xk","gauss_seidel","SOR","householder","QR","lstsq","array_mode","Q","attrs","Q1","RI","I","Aj","cAi","Ij","cIi","R_I","Q2","jacobi","maxim","theta","condition","e","ev","rungekutta","t_j","u_j","order","k1","k2","k3","romberg","h1","g","richardson","X","pos","y1","h_min","simpson","hermite","F","dF","dl","lagrange","cubic_spline","sq","gauss_quadrature","PCA","temp1","Bt","D","temp2","Y","C","Vt","differenceOfProportions","p1","n1","p2","n2","pooled","zscore","ztest","sides","tscore","ttest","anovafscore","expVar","sampMean","sampSampMean","tmpargs","unexpVar","anovaftest","ftest","fscore","anovaftes","qscore","mean1","mean2","sd","qtest","tukeyhsd","arrays","means","normalci","change","tci","significant","pvalue","oneSidedDifferenceOfProportions","twoSidedDifferenceOfProportions","models","ols","endog","exog","nobs","df_model","df_resid","coef","predict","resid","ybar","SSE","SSR","SST","R2","t_test","model","var_count","subModelList","endog_index","exog_index","filter","sigmaHat","seBetaHat","mod","tStatistic","pValue","leftppf","interval95","se","F_statistic","F_test","adjust_R2","buildxmatrix","matrixRows","builddxmatrix","buildjxmatrix","jMat","pass","buildymatrix","array","buildjymatrix","matrixmult","regress","jMatX","jMatY","innerinv","xtranspxinv","xtransp","next","regresst","compile","jMatYBar","yBar","yAverage","anova","residuals","ssr","msr","sse","mse","sst","mst","r2","fratio","rmse","r2adj","stats","sds","ts","covar","xtranspx","inner","matrixsubtract","SVD","o","M","fill","S","VERSION","defineProperty","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__","definition","key","enumerable","get","prop","hasOwnProperty","Symbol","toStringTag","none","selector","querySelector","empty","querySelectorAll","matches","childMatcher","node","find","childFirst","firstElementChild","children","from","update","EnterNode","parent","datum","ownerDocument","namespaceURI","_next","_parent","__data__","bindIndex","group","enter","exit","groupLength","dataLength","bindKey","keyValue","nodeByKeyValue","Map","keyValues","has","set","delete","arraylike","ascending","appendChild","child","insertBefore","xhtml","svg","xlink","xml","xmlns","name","prefix","indexOf","namespaces","space","attrRemove","removeAttribute","attrRemoveNS","fullname","removeAttributeNS","attrConstant","setAttribute","attrConstantNS","setAttributeNS","attrFunction","attrFunctionNS","defaultView","document","styleRemove","style","removeProperty","styleConstant","priority","setProperty","styleFunction","styleValue","getPropertyValue","getComputedStyle","propertyRemove","propertyConstant","propertyFunction","classArray","string","trim","classList","ClassList","_node","_names","getAttribute","classedAdd","names","classedRemove","remove","classedTrue","classedFalse","classedFunction","textRemove","textContent","textConstant","textFunction","htmlRemove","innerHTML","htmlConstant","htmlFunction","raise","nextSibling","parentNode","lower","previousSibling","firstChild","creatorInherit","uri","documentElement","createElement","createElementNS","creatorFixed","namespace","constantNull","removeChild","selection_cloneShallow","clone","cloneNode","selection_cloneDeep","onRemove","typename","on","__on","type","removeEventListener","listener","options","onAdd","event","contextListener","addEventListener","dispatchEvent","params","window","CustomEvent","createEvent","initEvent","bubbles","cancelable","detail","dispatchConstant","dispatchFunction","join","contains","root","Selection","groups","parents","_groups","_parents","selection","select","subgroups","subnode","subgroup","selectAll","arrayAll","selectorAll","selectChild","match","childFind","selectChildren","childrenFilter","matcher","bind","enterGroup","updateGroup","previous","i0","i1","_enter","_exit","sparse","onenter","onupdate","onexit","append","merge","context","groups0","groups1","m0","m1","merges","group0","group1","compareDocumentPosition","compare","compareNode","sortgroups","sortgroup","callback","nodes","each","attr","getAttributeNS","property","classed","text","html","creator","insert","before","deep","typenames","parseTypenames","dispatch","iterator","noop","_","test","Dispatch","types","that","taskHead","taskTail","timeout","interval","pokeDelay","clockLast","clockNow","clockSkew","clock","performance","now","Date","setFrame","requestAnimationFrame","clearNow","Timer","_call","_time","timer","delay","time","restart","wake","timerFlush","t0","t2","sleep","nap","poke","clearTimeout","clearInterval","setInterval","elapsed","stop","emptyOn","emptyTween","CREATED","STARTED","id","timing","schedules","__transition","tween","state","tick","duration","ease","init","schedule","svgNode","degrees","translateX","translateY","rotate","skewX","scaleX","scaleY","atan2","interpolateTransform","parse","pxComma","pxParen","degParen","pop","xa","ya","xb","yb","translate","interpolateTransformCss","DOMMatrix","WebKitCSSMatrix","isIdentity","decompose","interpolateTransformSvg","transform","baseVal","consolidate","matrix","tweenRemove","tween0","tween1","tweenFunction","tweenValue","transition","_id","factory","Color","darker","brighter","reI","reN","reP","reHex","reRgbInteger","RegExp","reRgbPercent","reRgbaInteger","reRgbaPercent","reHslPercent","reHslaPercent","named","aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen","color_formatHex","rgb","formatHex","color_formatRgb","formatRgb","color","format","toLowerCase","exec","rgbn","Rgb","rgba","hsla","opacity","rgb_formatHex","hex","rgb_formatRgb","clampa","clampi","Hsl","hslConvert","clamph","clampt","hsl2rgb","basis","v0","v1","v2","v3","t3","channels","assign","displayable","formatHex8","formatHsl","clamp","nogamma","linear","rgbGamma","rgbSpline","spline","colors","values","reA","reB","source","am","bm","bs","bi","lastIndex","one","zero","interpolate","value1","string00","interpolate0","string1","string0","string10","attrTweenNS","attrInterpolateNS","_value","attrTween","attrInterpolate","delayFunction","delayConstant","durationFunction","durationConstant","Transition","_name","newId","selection_prototype","inherit","id0","id1","on0","on1","sit","every","onFunction","styleTween","styleNull","listener0","styleMaybeRemove","styleInterpolate","textTween","textInterpolate","removeFunction","easeConstant","easeVarying","Promise","resolve","reject","cancel","interrupt","defaultTiming","active","sourceEvent","currentTarget","ownerSVGElement","createSVGPoint","point","clientX","clientY","matrixTransform","getScreenCTM","inverse","getBoundingClientRect","rect","clientLeft","top","clientTop","pageX","pageY","nonpassive","passive","nonpassivecapture","capture","stopImmediatePropagation","preventDefault","DragEvent","subject","target","identifier","dx","dy","defineProperties","configurable","ctrlKey","button","defaultContainer","defaultSubject","navigator","maxTouchPoints","e10","e5","e2","tickIncrement","power","LN10","error","descending","bisector","compare1","compare2","delta","lo","hi","mid","center","ascendingBisect","bisectRight","genericArray","nb","na","setTime","date","ArrayBuffer","isView","DataView","valueOf","object","unit","normalize","bimap","domain","d0","d1","r0","r1","polymap","reverse","bisect","initRange","prefixExponent","re","formatSpecifier","specifier","FormatSpecifier","align","sign","symbol","width","comma","precision","formatDecimalParts","toExponential","coefficient","exponent","toFixed","toLocaleString","replace","toPrecision","formatRounded","toUpperCase","formatPrefix","prefixes","linearish","ticks","tickFormat","step0","step1","tickStep","precisionPrefix","precisionRound","precisionFixed","nice","prestep","maxIter","ceil","untransform","unknown","piecewise","output","input","rescale","invert","rangeRound","transformer","ramp","locale","grouping","thousands","substring","currencyPrefix","currency","currencySuffix","decimal","numerals","formatNumerals","String","percent","minus","nan","newFormat","formatTypes","suffix","formatType","maybeSuffix","valuePrefix","valueSuffix","valueNegative","out","formatTrim","charCodeAt","padding","randInt","times","vecSub","vecAdd","vecDot","vecScale","zeroMat","matTcrossprodInto","matAdd","matScale","matScaleInto","matAddInto","matTranspose","removeSpin","motion","proj","locateEventInElement","el","offsetWidth","height","offsetHeight","toggleVisible","display","hexByte","gradRepulsion","fineScale","strength","grad","off1","off2","gradCentralRepulsion","applyX","applyY","location","invertX","invertY","rescaleX","rescaleY","gradTable","jstat","template","Langevitour","EventTarget","container","super","fullscreen","originalWidth","originalHeight","pointSize","colnames","permutor","unpermutor","rownames","levels","levelColors","lineFrom","lineTo","lineColors","fills","selectionChanged","axes","labelData","vel","zoom","xScaleUnit","yScaleUnit","xScale","yScale","xScaleClamped","yScaleClamped","haveData","playing","frameScheduled","lastTime","mouseInCheckbox","dragging","fps","computeMessage","mousing","mouseDown","mouseWentDown","mouseShiftKey","mouseX","mouseY","rightMouseDown","rightMouseWentDown","tugging","tugX","tugY","tugPoints","xy","fillsFrame","pointActive","shadowDiv","shadowRoot","attachShadow","shadowChild","canvas","overlay","langevitour","resize","plotDiv","scheduleFrameIfNeeded","handleMouseMove","buttons","visibility","shiftKey","requestFullscreen","fullscreenElement","exitFullscreen","handleWindowSize","innerWidth","innerHeight","pad","paddingLeft","configure","getInput","matStr","line","item","log10","JSON","stringify","getState","setState","className","getElementsByClassName","getString","getNumber","getChecked","checked","emitChangeFilter","Event","emitChangeSelectionIfNeeded","renderValue","axisColors","extraAxes","extraAxesNames","projFromScaled","vec","nGroups","colorVariation","pointColor","label","halfWidth","halfHeight","selected","controlHeight","innerText","ctx","getContext","clearRect","configureScales","thys","divs","div","refreshLabels","maxX","mousedownx","mousedowny","mousemoving","touchending","touchable","gestures","listeners","clickDistance2","drag","mousedowned","touchstarted","touchmoved","touchended","gesture","beforestart","view","mousemoved","mouseupped","__noselect","MozUserSelect","nodrag","mouse","noclick","yesdrag","touches","changedTouches","touch","p0","clickDistance","cursor","makeDraggable","axesOn","heatOn","guideType","labelAttractionOn","damping","heat","guide","labelAttraction","brush","labelInactive","labelPos","projection","needChangeFilter","needChangeSelection","pointRepulsionType","pointRepulsion","includes","doFrame","parentElement","bottom","elementVisible","shift","compute","selectedAxis","selectedLevel","showAxes","levelActive","brushRadius","brushPoints","d2","ratio","devicePixelRatio","rx","ry","strokeStyle","fillStyle","fillRect","strokeRect","axisScale","xProj","yProj","beginPath","moveTo","stroke","lineWidth","tanh","ox","rug","rounding","pA","pB","arc","save","textAlign","textBaseline","lineJoin","font","scaled","strokeText","fillText","restore","hint","realElapsed","attraction","doHeat","whatGuide","doAttraction","velKeep","tugAmount","tugCenter","currentX","currentY","length2","tugAdjust","velReplaceVar","noise","activeX","adjustment","inactive","tooMany","anyDropped","nuke_amount","maxQ","newProj"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"langevitour-pack.js","mappings":"6CAAA,IASIA,EAPIC,EAAOC,SAOXF,EAAS,SAASG,EAAMC,GAG5B,IAAIC,EAASC,MAAMC,UAAUF,OACzBG,EAAQF,MAAMC,UAAUC,MACxBC,EAAWC,OAAOH,UAAUE,SAIhC,SAASE,EAAQC,EAAGC,GAClB,IAAIC,EAAMF,EAAIC,EAAID,EAAIC,EACtB,OAAOV,EAAKY,IAAI,GACA,MAAQZ,EAAKa,IAAMF,EAAM,EAAKA,GAAOA,GAAQX,EAAKc,QACpE,CAGA,IAAIC,EAAUZ,MAAMY,SAAW,SAAiBC,GAC9C,MAA8B,mBAAvBV,EAASW,KAAKD,EACvB,EAGA,SAASE,EAAWF,GAClB,MAA8B,sBAAvBV,EAASW,KAAKD,EACvB,CAGA,SAASG,EAASC,GAChB,MAAuB,iBAARA,GAAoBA,EAAMA,GAAQ,CACnD,CAUA,SAASvB,IACP,OAAO,IAAIA,EAAMwB,MAAMC,UACzB,CAmRA,SAASC,IAAY,OAAO,CAAG,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nB,EAAO7rB,GAAIgzC,GAASsI,GAAMvI,GAAOuI,EAAK7E,EAAIz2C,IAAMyjD,EAAc1Q,GAAOuI,EAAK5H,EAAK1zC,KAE1G,CAEAszC,GAAWmD,EAAKjD,GAAW3nB,EAAQ6nB,GACvC,CACI6P,IACAljD,KAAKm3C,gBAAkB,kCACvBgM,IACAnjD,KAAKm3C,gBAAkB,kCAE3B,IAAImM,EAAUxQ,GAAOO,EAAMN,GAASqD,EAAK9gB,KAErC,EAAEhrB,EAAC,EAAEC,EAAC,EAAEiC,IAAM,IAAAoY,KAAIsuB,GAAaoQ,IACnCzQ,GAAkByQ,EAAS/4C,EAAGD,GAE9B8rC,EAAMrD,GAASD,GAAOwQ,EAASvQ,GAASM,GAAO,IAAK,EAAI/d,GAEpDt1B,KAAK43C,UACLxB,EAAM,CAAC3zC,GAAMzC,KAAKtB,GAAI+D,GAAMzC,KAAKtB,KACrCsB,KAAKqzC,KAAOiQ,EACZtjD,KAAKo2C,IAAMA,CACf,E","sources":["webpack://langevitour/./node_modules/jstat/dist/jstat.js","webpack://langevitour/./node_modules/svd-js/build-umd/svd-js.min.js","webpack://langevitour/webpack/bootstrap","webpack://langevitour/webpack/runtime/define property getters","webpack://langevitour/webpack/runtime/hasOwnProperty shorthand","webpack://langevitour/webpack/runtime/make namespace object","webpack://langevitour/./node_modules/d3-selection/src/selector.js","webpack://langevitour/./node_modules/d3-selection/src/selectorAll.js","webpack://langevitour/./node_modules/d3-selection/src/matcher.js","webpack://langevitour/./node_modules/d3-selection/src/selection/selectChild.js","webpack://langevitour/./node_modules/d3-selection/src/selection/selectChildren.js","webpack://langevitour/./node_modules/d3-selection/src/selection/sparse.js","webpack://langevitour/./node_modules/d3-selection/src/selection/enter.js","webpack://langevitour/./node_modules/d3-selection/src/selection/data.js","webpack://langevitour/./node_modules/d3-selection/src/selection/sort.js","webpack://langevitour/./node_modules/d3-selection/src/namespaces.js","webpack://langevitour/./node_modules/d3-selection/src/namespace.js","webpack://langevitour/./node_modules/d3-selection/src/selection/attr.js","webpack://langevitour/./node_modules/d3-selection/src/window.js","webpack://langevitour/./node_modules/d3-selection/src/selection/style.js","webpack://langevitour/./node_modules/d3-selection/src/selection/property.js","webpack://langevitour/./node_modules/d3-selection/src/selection/classed.js","webpack://langevitour/./node_modules/d3-selection/src/selection/text.js","webpack://langevitour/./node_modules/d3-selection/src/selection/html.js","webpack://langevitour/./node_modules/d3-selection/src/selection/raise.js","webpack://langevitour/./node_modules/d3-selection/src/selection/lower.js","webpack://langevitour/./node_modules/d3-selection/src/creator.js","webpack://langevitour/./node_modules/d3-selection/src/selection/insert.js","webpack://langevitour/./node_modules/d3-selection/src/selection/remove.js","webpack://langevitour/./node_modules/d3-selection/src/selection/clone.js","webpack://langevitour/./node_modules/d3-selection/src/selection/on.js","webpack://langevitour/./node_modules/d3-selection/src/selection/dispatch.js","webpack://langevitour/./node_modules/d3-selection/src/selection/index.js","webpack://langevitour/./node_modules/d3-selection/src/selection/select.js","webpack://langevitour/./node_modules/d3-selection/src/selection/selectAll.js","webpack://langevitour/./node_modules/d3-selection/src/array.js","webpack://langevitour/./node_modules/d3-selection/src/selection/filter.js","webpack://langevitour/./node_modules/d3-selection/src/constant.js","webpack://langevitour/./node_modules/d3-selection/src/selection/exit.js","webpack://langevitour/./node_modules/d3-selection/src/selection/join.js","webpack://langevitour/./node_modules/d3-selection/src/selection/merge.js","webpack://langevitour/./node_modules/d3-selection/src/selection/order.js","webpack://langevitour/./node_modules/d3-selection/src/selection/call.js","webpack://langevitour/./node_modules/d3-selection/src/selection/nodes.js","webpack://langevitour/./node_modules/d3-selection/src/selection/node.js","webpack://langevitour/./node_modules/d3-selection/src/selection/size.js","webpack://langevitour/./node_modules/d3-selection/src/selection/empty.js","webpack://langevitour/./node_modules/d3-selection/src/selection/each.js","webpack://langevitour/./node_modules/d3-selection/src/selection/append.js","webpack://langevitour/./node_modules/d3-selection/src/selection/datum.js","webpack://langevitour/./node_modules/d3-selection/src/selection/iterator.js","webpack://langevitour/./node_modules/d3-dispatch/src/dispatch.js","webpack://langevitour/./node_modules/d3-timer/src/timer.js","webpack://langevitour/./node_modules/d3-timer/src/timeout.js","webpack://langevitour/./node_modules/d3-transition/src/transition/schedule.js","webpack://langevitour/./node_modules/d3-interpolate/src/number.js","webpack://langevitour/./node_modules/d3-interpolate/src/transform/decompose.js","webpack://langevitour/./node_modules/d3-interpolate/src/transform/parse.js","webpack://langevitour/./node_modules/d3-interpolate/src/transform/index.js","webpack://langevitour/./node_modules/d3-transition/src/transition/tween.js","webpack://langevitour/./node_modules/d3-color/src/define.js","webpack://langevitour/./node_modules/d3-color/src/color.js","webpack://langevitour/./node_modules/d3-interpolate/src/basis.js","webpack://langevitour/./node_modules/d3-interpolate/src/constant.js","webpack://langevitour/./node_modules/d3-interpolate/src/color.js","webpack://langevitour/./node_modules/d3-interpolate/src/rgb.js","webpack://langevitour/./node_modules/d3-interpolate/src/basisClosed.js","webpack://langevitour/./node_modules/d3-interpolate/src/string.js","webpack://langevitour/./node_modules/d3-transition/src/transition/interpolate.js","webpack://langevitour/./node_modules/d3-transition/src/transition/attr.js","webpack://langevitour/./node_modules/d3-transition/src/transition/attrTween.js","webpack://langevitour/./node_modules/d3-transition/src/transition/delay.js","webpack://langevitour/./node_modules/d3-transition/src/transition/duration.js","webpack://langevitour/./node_modules/d3-transition/src/transition/selection.js","webpack://langevitour/./node_modules/d3-transition/src/transition/style.js","webpack://langevitour/./node_modules/d3-transition/src/transition/index.js","webpack://langevitour/./node_modules/d3-transition/src/transition/select.js","webpack://langevitour/./node_modules/d3-transition/src/transition/selectAll.js","webpack://langevitour/./node_modules/d3-transition/src/transition/filter.js","webpack://langevitour/./node_modules/d3-transition/src/transition/merge.js","webpack://langevitour/./node_modules/d3-transition/src/transition/transition.js","webpack://langevitour/./node_modules/d3-transition/src/transition/on.js","webpack://langevitour/./node_modules/d3-transition/src/transition/styleTween.js","webpack://langevitour/./node_modules/d3-transition/src/transition/text.js","webpack://langevitour/./node_modules/d3-transition/src/transition/textTween.js","webpack://langevitour/./node_modules/d3-transition/src/transition/remove.js","webpack://langevitour/./node_modules/d3-transition/src/transition/ease.js","webpack://langevitour/./node_modules/d3-transition/src/transition/easeVarying.js","webpack://langevitour/./node_modules/d3-transition/src/transition/end.js","webpack://langevitour/./node_modules/d3-transition/src/selection/transition.js","webpack://langevitour/./node_modules/d3-ease/src/cubic.js","webpack://langevitour/./node_modules/d3-transition/src/selection/index.js","webpack://langevitour/./node_modules/d3-transition/src/selection/interrupt.js","webpack://langevitour/./node_modules/d3-transition/src/interrupt.js","webpack://langevitour/./node_modules/d3-brush/src/brush.js","webpack://langevitour/./node_modules/d3-selection/src/select.js","webpack://langevitour/./node_modules/d3-selection/src/pointer.js","webpack://langevitour/./node_modules/d3-selection/src/sourceEvent.js","webpack://langevitour/./node_modules/d3-drag/src/noevent.js","webpack://langevitour/./node_modules/d3-drag/src/constant.js","webpack://langevitour/./node_modules/d3-drag/src/event.js","webpack://langevitour/./node_modules/d3-drag/src/drag.js","webpack://langevitour/./node_modules/d3-array/src/ticks.js","webpack://langevitour/./node_modules/d3-array/src/ascending.js","webpack://langevitour/./node_modules/d3-array/src/descending.js","webpack://langevitour/./node_modules/d3-array/src/bisector.js","webpack://langevitour/./node_modules/d3-array/src/bisect.js","webpack://langevitour/./node_modules/d3-array/src/number.js","webpack://langevitour/./node_modules/d3-interpolate/src/array.js","webpack://langevitour/./node_modules/d3-interpolate/src/date.js","webpack://langevitour/./node_modules/d3-interpolate/src/object.js","webpack://langevitour/./node_modules/d3-interpolate/src/numberArray.js","webpack://langevitour/./node_modules/d3-interpolate/src/value.js","webpack://langevitour/./node_modules/d3-interpolate/src/round.js","webpack://langevitour/./node_modules/d3-scale/src/number.js","webpack://langevitour/./node_modules/d3-scale/src/continuous.js","webpack://langevitour/./node_modules/d3-scale/src/constant.js","webpack://langevitour/./node_modules/d3-scale/src/init.js","webpack://langevitour/./node_modules/d3-format/src/formatSpecifier.js","webpack://langevitour/./node_modules/d3-format/src/formatPrefixAuto.js","webpack://langevitour/./node_modules/d3-format/src/formatDecimal.js","webpack://langevitour/./node_modules/d3-format/src/exponent.js","webpack://langevitour/./node_modules/d3-format/src/formatRounded.js","webpack://langevitour/./node_modules/d3-format/src/formatTypes.js","webpack://langevitour/./node_modules/d3-format/src/identity.js","webpack://langevitour/./node_modules/d3-format/src/locale.js","webpack://langevitour/./node_modules/d3-format/src/defaultLocale.js","webpack://langevitour/./node_modules/d3-scale/src/linear.js","webpack://langevitour/./node_modules/d3-scale/src/tickFormat.js","webpack://langevitour/./node_modules/d3-format/src/precisionPrefix.js","webpack://langevitour/./node_modules/d3-format/src/precisionRound.js","webpack://langevitour/./node_modules/d3-format/src/precisionFixed.js","webpack://langevitour/./node_modules/d3-scale-chromatic/src/colors.js","webpack://langevitour/./node_modules/d3-scale-chromatic/src/sequential-multi/viridis.js","webpack://langevitour/./node_modules/d3-format/src/formatGroup.js","webpack://langevitour/./node_modules/d3-format/src/formatNumerals.js","webpack://langevitour/./node_modules/d3-format/src/formatTrim.js","webpack://langevitour/./node_modules/d3-zoom/src/transform.js","webpack://langevitour/./lib/math.js","webpack://langevitour/./lib/util.js","webpack://langevitour/./lib/guides.js","webpack://langevitour/./lib/langevitour.js","webpack://langevitour/./node_modules/d3-drag/src/nodrag.js"],"sourcesContent":["(function (window, factory) {\n if (typeof exports === 'object') {\n module.exports = factory();\n } else if (typeof define === 'function' && define.amd) {\n define(factory);\n } else {\n window.jStat = factory();\n }\n})(this, function () {\nvar jStat = (function(Math, undefined) {\n\n// For quick reference.\nvar concat = Array.prototype.concat;\nvar slice = Array.prototype.slice;\nvar toString = Object.prototype.toString;\n\n// Calculate correction for IEEE error\n// TODO: This calculation can be improved.\nfunction calcRdx(n, m) {\n var val = n > m ? n : m;\n return Math.pow(10,\n 17 - ~~(Math.log(((val > 0) ? val : -val)) * Math.LOG10E));\n}\n\n\nvar isArray = Array.isArray || function isArray(arg) {\n return toString.call(arg) === '[object Array]';\n};\n\n\nfunction isFunction(arg) {\n return toString.call(arg) === '[object Function]';\n}\n\n\nfunction isNumber(num) {\n return (typeof num === 'number') ? num - num === 0 : false;\n}\n\n\n// Converts the jStat matrix to vector.\nfunction toVector(arr) {\n return concat.apply([], arr);\n}\n\n\n// The one and only jStat constructor.\nfunction jStat() {\n return new jStat._init(arguments);\n}\n\n\n// TODO: Remove after all references in src files have been removed.\njStat.fn = jStat.prototype;\n\n\n// By separating the initializer from the constructor it's easier to handle\n// always returning a new instance whether \"new\" was used or not.\njStat._init = function _init(args) {\n // If first argument is an array, must be vector or matrix.\n if (isArray(args[0])) {\n // Check if matrix.\n if (isArray(args[0][0])) {\n // See if a mapping function was also passed.\n if (isFunction(args[1]))\n args[0] = jStat.map(args[0], args[1]);\n // Iterate over each is faster than this.push.apply(this, args[0].\n for (var i = 0; i < args[0].length; i++)\n this[i] = args[0][i];\n this.length = args[0].length;\n\n // Otherwise must be a vector.\n } else {\n this[0] = isFunction(args[1]) ? jStat.map(args[0], args[1]) : args[0];\n this.length = 1;\n }\n\n // If first argument is number, assume creation of sequence.\n } else if (isNumber(args[0])) {\n this[0] = jStat.seq.apply(null, args);\n this.length = 1;\n\n // Handle case when jStat object is passed to jStat.\n } else if (args[0] instanceof jStat) {\n // Duplicate the object and pass it back.\n return jStat(args[0].toArray());\n\n // Unexpected argument value, return empty jStat object.\n // TODO: This is strange behavior. Shouldn't this throw or some such to let\n // the user know they had bad arguments?\n } else {\n this[0] = [];\n this.length = 1;\n }\n\n return this;\n};\njStat._init.prototype = jStat.prototype;\njStat._init.constructor = jStat;\n\n\n// Utility functions.\n// TODO: for internal use only?\njStat.utils = {\n calcRdx: calcRdx,\n isArray: isArray,\n isFunction: isFunction,\n isNumber: isNumber,\n toVector: toVector\n};\n\n\njStat._random_fn = Math.random;\njStat.setRandom = function setRandom(fn) {\n if (typeof fn !== 'function')\n throw new TypeError('fn is not a function');\n jStat._random_fn = fn;\n};\n\n\n// Easily extend the jStat object.\n// TODO: is this seriously necessary?\njStat.extend = function extend(obj) {\n var i, j;\n\n if (arguments.length === 1) {\n for (j in obj)\n jStat[j] = obj[j];\n return this;\n }\n\n for (i = 1; i < arguments.length; i++) {\n for (j in arguments[i])\n obj[j] = arguments[i][j];\n }\n\n return obj;\n};\n\n\n// Returns the number of rows in the matrix.\njStat.rows = function rows(arr) {\n return arr.length || 1;\n};\n\n\n// Returns the number of columns in the matrix.\njStat.cols = function cols(arr) {\n return arr[0].length || 1;\n};\n\n\n// Returns the dimensions of the object { rows: i, cols: j }\njStat.dimensions = function dimensions(arr) {\n return {\n rows: jStat.rows(arr),\n cols: jStat.cols(arr)\n };\n};\n\n\n// Returns a specified row as a vector or return a sub matrix by pick some rows\njStat.row = function row(arr, index) {\n if (isArray(index)) {\n return index.map(function(i) {\n return jStat.row(arr, i);\n })\n }\n return arr[index];\n};\n\n\n// return row as array\n// rowa([[1,2],[3,4]],0) -> [1,2]\njStat.rowa = function rowa(arr, i) {\n return jStat.row(arr, i);\n};\n\n\n// Returns the specified column as a vector or return a sub matrix by pick some\n// columns\njStat.col = function col(arr, index) {\n if (isArray(index)) {\n var submat = jStat.arange(arr.length).map(function() {\n return new Array(index.length);\n });\n index.forEach(function(ind, i){\n jStat.arange(arr.length).forEach(function(j) {\n submat[j][i] = arr[j][ind];\n });\n });\n return submat;\n }\n var column = new Array(arr.length);\n for (var i = 0; i < arr.length; i++)\n column[i] = [arr[i][index]];\n return column;\n};\n\n\n// return column as array\n// cola([[1,2],[3,4]],0) -> [1,3]\njStat.cola = function cola(arr, i) {\n return jStat.col(arr, i).map(function(a){ return a[0] });\n};\n\n\n// Returns the diagonal of the matrix\njStat.diag = function diag(arr) {\n var nrow = jStat.rows(arr);\n var res = new Array(nrow);\n for (var row = 0; row < nrow; row++)\n res[row] = [arr[row][row]];\n return res;\n};\n\n\n// Returns the anti-diagonal of the matrix\njStat.antidiag = function antidiag(arr) {\n var nrow = jStat.rows(arr) - 1;\n var res = new Array(nrow);\n for (var i = 0; nrow >= 0; nrow--, i++)\n res[i] = [arr[i][nrow]];\n return res;\n};\n\n// Transpose a matrix or array.\njStat.transpose = function transpose(arr) {\n var obj = [];\n var objArr, rows, cols, j, i;\n\n // Make sure arr is in matrix format.\n if (!isArray(arr[0]))\n arr = [arr];\n\n rows = arr.length;\n cols = arr[0].length;\n\n for (i = 0; i < cols; i++) {\n objArr = new Array(rows);\n for (j = 0; j < rows; j++)\n objArr[j] = arr[j][i];\n obj.push(objArr);\n }\n\n // If obj is vector, return only single array.\n return obj.length === 1 ? obj[0] : obj;\n};\n\n\n// Map a function to an array or array of arrays.\n// \"toAlter\" is an internal variable.\njStat.map = function map(arr, func, toAlter) {\n var row, nrow, ncol, res, col;\n\n if (!isArray(arr[0]))\n arr = [arr];\n\n nrow = arr.length;\n ncol = arr[0].length;\n res = toAlter ? arr : new Array(nrow);\n\n for (row = 0; row < nrow; row++) {\n // if the row doesn't exist, create it\n if (!res[row])\n res[row] = new Array(ncol);\n for (col = 0; col < ncol; col++)\n res[row][col] = func(arr[row][col], row, col);\n }\n\n return res.length === 1 ? res[0] : res;\n};\n\n\n// Cumulatively combine the elements of an array or array of arrays using a function.\njStat.cumreduce = function cumreduce(arr, func, toAlter) {\n var row, nrow, ncol, res, col;\n\n if (!isArray(arr[0]))\n arr = [arr];\n\n nrow = arr.length;\n ncol = arr[0].length;\n res = toAlter ? arr : new Array(nrow);\n\n for (row = 0; row < nrow; row++) {\n // if the row doesn't exist, create it\n if (!res[row])\n res[row] = new Array(ncol);\n if (ncol > 0)\n res[row][0] = arr[row][0];\n for (col = 1; col < ncol; col++)\n res[row][col] = func(res[row][col-1], arr[row][col]);\n }\n return res.length === 1 ? res[0] : res;\n};\n\n\n// Destructively alter an array.\njStat.alter = function alter(arr, func) {\n return jStat.map(arr, func, true);\n};\n\n\n// Generate a rows x cols matrix according to the supplied function.\njStat.create = function create(rows, cols, func) {\n var res = new Array(rows);\n var i, j;\n\n if (isFunction(cols)) {\n func = cols;\n cols = rows;\n }\n\n for (i = 0; i < rows; i++) {\n res[i] = new Array(cols);\n for (j = 0; j < cols; j++)\n res[i][j] = func(i, j);\n }\n\n return res;\n};\n\n\nfunction retZero() { return 0; }\n\n\n// Generate a rows x cols matrix of zeros.\njStat.zeros = function zeros(rows, cols) {\n if (!isNumber(cols))\n cols = rows;\n return jStat.create(rows, cols, retZero);\n};\n\n\nfunction retOne() { return 1; }\n\n\n// Generate a rows x cols matrix of ones.\njStat.ones = function ones(rows, cols) {\n if (!isNumber(cols))\n cols = rows;\n return jStat.create(rows, cols, retOne);\n};\n\n\n// Generate a rows x cols matrix of uniformly random numbers.\njStat.rand = function rand(rows, cols) {\n if (!isNumber(cols))\n cols = rows;\n return jStat.create(rows, cols, jStat._random_fn);\n};\n\n\nfunction retIdent(i, j) { return i === j ? 1 : 0; }\n\n\n// Generate an identity matrix of size row x cols.\njStat.identity = function identity(rows, cols) {\n if (!isNumber(cols))\n cols = rows;\n return jStat.create(rows, cols, retIdent);\n};\n\n\n// Tests whether a matrix is symmetric\njStat.symmetric = function symmetric(arr) {\n var size = arr.length;\n var row, col;\n\n if (arr.length !== arr[0].length)\n return false;\n\n for (row = 0; row < size; row++) {\n for (col = 0; col < size; col++)\n if (arr[col][row] !== arr[row][col])\n return false;\n }\n\n return true;\n};\n\n\n// Set all values to zero.\njStat.clear = function clear(arr) {\n return jStat.alter(arr, retZero);\n};\n\n\n// Generate sequence.\njStat.seq = function seq(min, max, length, func) {\n if (!isFunction(func))\n func = false;\n\n var arr = [];\n var hival = calcRdx(min, max);\n var step = (max * hival - min * hival) / ((length - 1) * hival);\n var current = min;\n var cnt;\n\n // Current is assigned using a technique to compensate for IEEE error.\n // TODO: Needs better implementation.\n for (cnt = 0;\n current <= max && cnt < length;\n cnt++, current = (min * hival + step * hival * cnt) / hival) {\n arr.push((func ? func(current, cnt) : current));\n }\n\n return arr;\n};\n\n\n// arange(5) -> [0,1,2,3,4]\n// arange(1,5) -> [1,2,3,4]\n// arange(5,1,-1) -> [5,4,3,2]\njStat.arange = function arange(start, end, step) {\n var rl = [];\n var i;\n step = step || 1;\n if (end === undefined) {\n end = start;\n start = 0;\n }\n if (start === end || step === 0) {\n return [];\n }\n if (start < end && step < 0) {\n return [];\n }\n if (start > end && step > 0) {\n return [];\n }\n if (step > 0) {\n for (i = start; i < end; i += step) {\n rl.push(i);\n }\n } else {\n for (i = start; i > end; i += step) {\n rl.push(i);\n }\n }\n return rl;\n};\n\n\n// A=[[1,2,3],[4,5,6],[7,8,9]]\n// slice(A,{row:{end:2},col:{start:1}}) -> [[2,3],[5,6]]\n// slice(A,1,{start:1}) -> [5,6]\n// as numpy code A[:2,1:]\njStat.slice = (function(){\n function _slice(list, start, end, step) {\n // note it's not equal to range.map mode it's a bug\n var i;\n var rl = [];\n var length = list.length;\n if (start === undefined && end === undefined && step === undefined) {\n return jStat.copy(list);\n }\n\n start = start || 0;\n end = end || list.length;\n start = start >= 0 ? start : length + start;\n end = end >= 0 ? end : length + end;\n step = step || 1;\n if (start === end || step === 0) {\n return [];\n }\n if (start < end && step < 0) {\n return [];\n }\n if (start > end && step > 0) {\n return [];\n }\n if (step > 0) {\n for (i = start; i < end; i += step) {\n rl.push(list[i]);\n }\n } else {\n for (i = start; i > end;i += step) {\n rl.push(list[i]);\n }\n }\n return rl;\n }\n\n function slice(list, rcSlice) {\n var colSlice, rowSlice;\n rcSlice = rcSlice || {};\n if (isNumber(rcSlice.row)) {\n if (isNumber(rcSlice.col))\n return list[rcSlice.row][rcSlice.col];\n var row = jStat.rowa(list, rcSlice.row);\n colSlice = rcSlice.col || {};\n return _slice(row, colSlice.start, colSlice.end, colSlice.step);\n }\n\n if (isNumber(rcSlice.col)) {\n var col = jStat.cola(list, rcSlice.col);\n rowSlice = rcSlice.row || {};\n return _slice(col, rowSlice.start, rowSlice.end, rowSlice.step);\n }\n\n rowSlice = rcSlice.row || {};\n colSlice = rcSlice.col || {};\n var rows = _slice(list, rowSlice.start, rowSlice.end, rowSlice.step);\n return rows.map(function(row) {\n return _slice(row, colSlice.start, colSlice.end, colSlice.step);\n });\n }\n\n return slice;\n}());\n\n\n// A=[[1,2,3],[4,5,6],[7,8,9]]\n// sliceAssign(A,{row:{start:1},col:{start:1}},[[0,0],[0,0]])\n// A=[[1,2,3],[4,0,0],[7,0,0]]\njStat.sliceAssign = function sliceAssign(A, rcSlice, B) {\n var nl, ml;\n if (isNumber(rcSlice.row)) {\n if (isNumber(rcSlice.col))\n return A[rcSlice.row][rcSlice.col] = B;\n rcSlice.col = rcSlice.col || {};\n rcSlice.col.start = rcSlice.col.start || 0;\n rcSlice.col.end = rcSlice.col.end || A[0].length;\n rcSlice.col.step = rcSlice.col.step || 1;\n nl = jStat.arange(rcSlice.col.start,\n Math.min(A.length, rcSlice.col.end),\n rcSlice.col.step);\n var m = rcSlice.row;\n nl.forEach(function(n, i) {\n A[m][n] = B[i];\n });\n return A;\n }\n\n if (isNumber(rcSlice.col)) {\n rcSlice.row = rcSlice.row || {};\n rcSlice.row.start = rcSlice.row.start || 0;\n rcSlice.row.end = rcSlice.row.end || A.length;\n rcSlice.row.step = rcSlice.row.step || 1;\n ml = jStat.arange(rcSlice.row.start,\n Math.min(A[0].length, rcSlice.row.end),\n rcSlice.row.step);\n var n = rcSlice.col;\n ml.forEach(function(m, j) {\n A[m][n] = B[j];\n });\n return A;\n }\n\n if (B[0].length === undefined) {\n B = [B];\n }\n rcSlice.row.start = rcSlice.row.start || 0;\n rcSlice.row.end = rcSlice.row.end || A.length;\n rcSlice.row.step = rcSlice.row.step || 1;\n rcSlice.col.start = rcSlice.col.start || 0;\n rcSlice.col.end = rcSlice.col.end || A[0].length;\n rcSlice.col.step = rcSlice.col.step || 1;\n ml = jStat.arange(rcSlice.row.start,\n Math.min(A.length, rcSlice.row.end),\n rcSlice.row.step);\n nl = jStat.arange(rcSlice.col.start,\n Math.min(A[0].length, rcSlice.col.end),\n rcSlice.col.step);\n ml.forEach(function(m, i) {\n nl.forEach(function(n, j) {\n A[m][n] = B[i][j];\n });\n });\n return A;\n};\n\n\n// [1,2,3] ->\n// [[1,0,0],[0,2,0],[0,0,3]]\njStat.diagonal = function diagonal(diagArray) {\n var mat = jStat.zeros(diagArray.length, diagArray.length);\n diagArray.forEach(function(t, i) {\n mat[i][i] = t;\n });\n return mat;\n};\n\n\n// return copy of A\njStat.copy = function copy(A) {\n return A.map(function(row) {\n if (isNumber(row))\n return row;\n return row.map(function(t) {\n return t;\n });\n });\n};\n\n\n// TODO: Go over this entire implementation. Seems a tragic waste of resources\n// doing all this work. Instead, and while ugly, use new Function() to generate\n// a custom function for each static method.\n\n// Quick reference.\nvar jProto = jStat.prototype;\n\n// Default length.\njProto.length = 0;\n\n// For internal use only.\n// TODO: Check if they're actually used, and if they are then rename them\n// to _*\njProto.push = Array.prototype.push;\njProto.sort = Array.prototype.sort;\njProto.splice = Array.prototype.splice;\njProto.slice = Array.prototype.slice;\n\n\n// Return a clean array.\njProto.toArray = function toArray() {\n return this.length > 1 ? slice.call(this) : slice.call(this)[0];\n};\n\n\n// Map a function to a matrix or vector.\njProto.map = function map(func, toAlter) {\n return jStat(jStat.map(this, func, toAlter));\n};\n\n\n// Cumulatively combine the elements of a matrix or vector using a function.\njProto.cumreduce = function cumreduce(func, toAlter) {\n return jStat(jStat.cumreduce(this, func, toAlter));\n};\n\n\n// Destructively alter an array.\njProto.alter = function alter(func) {\n jStat.alter(this, func);\n return this;\n};\n\n\n// Extend prototype with methods that have no argument.\n(function(funcs) {\n for (var i = 0; i < funcs.length; i++) (function(passfunc) {\n jProto[passfunc] = function(func) {\n var self = this,\n results;\n // Check for callback.\n if (func) {\n setTimeout(function() {\n func.call(self, jProto[passfunc].call(self));\n });\n return this;\n }\n results = jStat[passfunc](this);\n return isArray(results) ? jStat(results) : results;\n };\n })(funcs[i]);\n})('transpose clear symmetric rows cols dimensions diag antidiag'.split(' '));\n\n\n// Extend prototype with methods that have one argument.\n(function(funcs) {\n for (var i = 0; i < funcs.length; i++) (function(passfunc) {\n jProto[passfunc] = function(index, func) {\n var self = this;\n // check for callback\n if (func) {\n setTimeout(function() {\n func.call(self, jProto[passfunc].call(self, index));\n });\n return this;\n }\n return jStat(jStat[passfunc](this, index));\n };\n })(funcs[i]);\n})('row col'.split(' '));\n\n\n// Extend prototype with simple shortcut methods.\n(function(funcs) {\n for (var i = 0; i < funcs.length; i++) (function(passfunc) {\n jProto[passfunc] = function() {\n return jStat(jStat[passfunc].apply(null, arguments));\n };\n })(funcs[i]);\n})('create zeros ones rand identity'.split(' '));\n\n\n// Exposing jStat.\nreturn jStat;\n\n}(Math));\n(function(jStat, Math) {\n\nvar isFunction = jStat.utils.isFunction;\n\n// Ascending functions for sort\nfunction ascNum(a, b) { return a - b; }\n\nfunction clip(arg, min, max) {\n return Math.max(min, Math.min(arg, max));\n}\n\n\n// sum of an array\njStat.sum = function sum(arr) {\n var sum = 0;\n var i = arr.length;\n while (--i >= 0)\n sum += arr[i];\n return sum;\n};\n\n\n// sum squared\njStat.sumsqrd = function sumsqrd(arr) {\n var sum = 0;\n var i = arr.length;\n while (--i >= 0)\n sum += arr[i] * arr[i];\n return sum;\n};\n\n\n// sum of squared errors of prediction (SSE)\njStat.sumsqerr = function sumsqerr(arr) {\n var mean = jStat.mean(arr);\n var sum = 0;\n var i = arr.length;\n var tmp;\n while (--i >= 0) {\n tmp = arr[i] - mean;\n sum += tmp * tmp;\n }\n return sum;\n};\n\n// sum of an array in each row\njStat.sumrow = function sumrow(arr) {\n var sum = 0;\n var i = arr.length;\n while (--i >= 0)\n sum += arr[i];\n return sum;\n};\n\n// product of an array\njStat.product = function product(arr) {\n var prod = 1;\n var i = arr.length;\n while (--i >= 0)\n prod *= arr[i];\n return prod;\n};\n\n\n// minimum value of an array\njStat.min = function min(arr) {\n var low = arr[0];\n var i = 0;\n while (++i < arr.length)\n if (arr[i] < low)\n low = arr[i];\n return low;\n};\n\n\n// maximum value of an array\njStat.max = function max(arr) {\n var high = arr[0];\n var i = 0;\n while (++i < arr.length)\n if (arr[i] > high)\n high = arr[i];\n return high;\n};\n\n\n// unique values of an array\njStat.unique = function unique(arr) {\n var hash = {}, _arr = [];\n for(var i = 0; i < arr.length; i++) {\n if (!hash[arr[i]]) {\n hash[arr[i]] = true;\n _arr.push(arr[i]);\n }\n }\n return _arr;\n};\n\n\n// mean value of an array\njStat.mean = function mean(arr) {\n return jStat.sum(arr) / arr.length;\n};\n\n\n// mean squared error (MSE)\njStat.meansqerr = function meansqerr(arr) {\n return jStat.sumsqerr(arr) / arr.length;\n};\n\n\n// geometric mean of an array\njStat.geomean = function geomean(arr) {\n return Math.pow(jStat.product(arr), 1 / arr.length);\n};\n\n\n// median of an array\njStat.median = function median(arr) {\n var arrlen = arr.length;\n var _arr = arr.slice().sort(ascNum);\n // check if array is even or odd, then return the appropriate\n return !(arrlen & 1)\n ? (_arr[(arrlen / 2) - 1 ] + _arr[(arrlen / 2)]) / 2\n : _arr[(arrlen / 2) | 0 ];\n};\n\n\n// cumulative sum of an array\njStat.cumsum = function cumsum(arr) {\n return jStat.cumreduce(arr, function (a, b) { return a + b; });\n};\n\n\n// cumulative product of an array\njStat.cumprod = function cumprod(arr) {\n return jStat.cumreduce(arr, function (a, b) { return a * b; });\n};\n\n\n// successive differences of a sequence\njStat.diff = function diff(arr) {\n var diffs = [];\n var arrLen = arr.length;\n var i;\n for (i = 1; i < arrLen; i++)\n diffs.push(arr[i] - arr[i - 1]);\n return diffs;\n};\n\n\n// ranks of an array\njStat.rank = function (arr) {\n var i;\n var distinctNumbers = [];\n var numberCounts = {};\n for (i = 0; i < arr.length; i++) {\n var number = arr[i];\n if (numberCounts[number]) {\n numberCounts[number]++;\n } else {\n numberCounts[number] = 1;\n distinctNumbers.push(number);\n }\n }\n\n var sortedDistinctNumbers = distinctNumbers.sort(ascNum);\n var numberRanks = {};\n var currentRank = 1;\n for (i = 0; i < sortedDistinctNumbers.length; i++) {\n var number = sortedDistinctNumbers[i];\n var count = numberCounts[number];\n var first = currentRank;\n var last = currentRank + count - 1;\n var rank = (first + last) / 2;\n numberRanks[number] = rank;\n currentRank += count;\n }\n\n return arr.map(function (number) {\n return numberRanks[number];\n });\n};\n\n\n// mode of an array\n// if there are multiple modes of an array, return all of them\n// is this the appropriate way of handling it?\njStat.mode = function mode(arr) {\n var arrLen = arr.length;\n var _arr = arr.slice().sort(ascNum);\n var count = 1;\n var maxCount = 0;\n var numMaxCount = 0;\n var mode_arr = [];\n var i;\n\n for (i = 0; i < arrLen; i++) {\n if (_arr[i] === _arr[i + 1]) {\n count++;\n } else {\n if (count > maxCount) {\n mode_arr = [_arr[i]];\n maxCount = count;\n numMaxCount = 0;\n }\n // are there multiple max counts\n else if (count === maxCount) {\n mode_arr.push(_arr[i]);\n numMaxCount++;\n }\n // resetting count for new value in array\n count = 1;\n }\n }\n\n return numMaxCount === 0 ? mode_arr[0] : mode_arr;\n};\n\n\n// range of an array\njStat.range = function range(arr) {\n return jStat.max(arr) - jStat.min(arr);\n};\n\n// variance of an array\n// flag = true indicates sample instead of population\njStat.variance = function variance(arr, flag) {\n return jStat.sumsqerr(arr) / (arr.length - (flag ? 1 : 0));\n};\n\n// pooled variance of an array of arrays\njStat.pooledvariance = function pooledvariance(arr) {\n var sumsqerr = arr.reduce(function (a, samples) {return a + jStat.sumsqerr(samples);}, 0);\n var count = arr.reduce(function (a, samples) {return a + samples.length;}, 0);\n return sumsqerr / (count - arr.length);\n};\n\n// deviation of an array\njStat.deviation = function (arr) {\n var mean = jStat.mean(arr);\n var arrlen = arr.length;\n var dev = new Array(arrlen);\n for (var i = 0; i < arrlen; i++) {\n dev[i] = arr[i] - mean;\n }\n return dev;\n};\n\n// standard deviation of an array\n// flag = true indicates sample instead of population\njStat.stdev = function stdev(arr, flag) {\n return Math.sqrt(jStat.variance(arr, flag));\n};\n\n// pooled standard deviation of an array of arrays\njStat.pooledstdev = function pooledstdev(arr) {\n return Math.sqrt(jStat.pooledvariance(arr));\n};\n\n// mean deviation (mean absolute deviation) of an array\njStat.meandev = function meandev(arr) {\n var mean = jStat.mean(arr);\n var a = [];\n for (var i = arr.length - 1; i >= 0; i--) {\n a.push(Math.abs(arr[i] - mean));\n }\n return jStat.mean(a);\n};\n\n\n// median deviation (median absolute deviation) of an array\njStat.meddev = function meddev(arr) {\n var median = jStat.median(arr);\n var a = [];\n for (var i = arr.length - 1; i >= 0; i--) {\n a.push(Math.abs(arr[i] - median));\n }\n return jStat.median(a);\n};\n\n\n// coefficient of variation\njStat.coeffvar = function coeffvar(arr) {\n return jStat.stdev(arr) / jStat.mean(arr);\n};\n\n\n// quartiles of an array\njStat.quartiles = function quartiles(arr) {\n var arrlen = arr.length;\n var _arr = arr.slice().sort(ascNum);\n return [\n _arr[ Math.round((arrlen) / 4) - 1 ],\n _arr[ Math.round((arrlen) / 2) - 1 ],\n _arr[ Math.round((arrlen) * 3 / 4) - 1 ]\n ];\n};\n\n\n// Arbitary quantiles of an array. Direct port of the scipy.stats\n// implementation by Pierre GF Gerard-Marchant.\njStat.quantiles = function quantiles(arr, quantilesArray, alphap, betap) {\n var sortedArray = arr.slice().sort(ascNum);\n var quantileVals = [quantilesArray.length];\n var n = arr.length;\n var i, p, m, aleph, k, gamma;\n\n if (typeof alphap === 'undefined')\n alphap = 3 / 8;\n if (typeof betap === 'undefined')\n betap = 3 / 8;\n\n for (i = 0; i < quantilesArray.length; i++) {\n p = quantilesArray[i];\n m = alphap + p * (1 - alphap - betap);\n aleph = n * p + m;\n k = Math.floor(clip(aleph, 1, n - 1));\n gamma = clip(aleph - k, 0, 1);\n quantileVals[i] = (1 - gamma) * sortedArray[k - 1] + gamma * sortedArray[k];\n }\n\n return quantileVals;\n};\n\n// Return the k-th percentile of values in a range, where k is in the range 0..1, inclusive.\n// Passing true for the exclusive parameter excludes both endpoints of the range.\njStat.percentile = function percentile(arr, k, exclusive) {\n var _arr = arr.slice().sort(ascNum);\n var realIndex = k * (_arr.length + (exclusive ? 1 : -1)) + (exclusive ? 0 : 1);\n var index = parseInt(realIndex);\n var frac = realIndex - index;\n if (index + 1 < _arr.length) {\n return _arr[index - 1] + frac * (_arr[index] - _arr[index - 1]);\n } else {\n return _arr[index - 1];\n }\n}\n\n// The percentile rank of score in a given array. Returns the percentage\n// of all values in the input array that are less than (kind='strict') or\n// less or equal than (kind='weak') score. Default is weak.\njStat.percentileOfScore = function percentileOfScore(arr, score, kind) {\n var counter = 0;\n var len = arr.length;\n var strict = false;\n var value, i;\n\n if (kind === 'strict')\n strict = true;\n\n for (i = 0; i < len; i++) {\n value = arr[i];\n if ((strict && value < score) ||\n (!strict && value <= score)) {\n counter++;\n }\n }\n\n return counter / len;\n};\n\n\n// Histogram (bin count) data\njStat.histogram = function histogram(arr, binCnt) {\n binCnt = binCnt || 4;\n var first = jStat.min(arr);\n var binWidth = (jStat.max(arr) - first) / binCnt;\n var len = arr.length;\n var bins = [];\n var i;\n\n for (i = 0; i < binCnt; i++)\n bins[i] = 0;\n for (i = 0; i < len; i++)\n bins[Math.min(Math.floor(((arr[i] - first) / binWidth)), binCnt - 1)] += 1;\n\n return bins;\n};\n\n\n// covariance of two arrays\njStat.covariance = function covariance(arr1, arr2) {\n var u = jStat.mean(arr1);\n var v = jStat.mean(arr2);\n var arr1Len = arr1.length;\n var sq_dev = new Array(arr1Len);\n var i;\n\n for (i = 0; i < arr1Len; i++)\n sq_dev[i] = (arr1[i] - u) * (arr2[i] - v);\n\n return jStat.sum(sq_dev) / (arr1Len - 1);\n};\n\n\n// (pearson's) population correlation coefficient, rho\njStat.corrcoeff = function corrcoeff(arr1, arr2) {\n return jStat.covariance(arr1, arr2) /\n jStat.stdev(arr1, 1) /\n jStat.stdev(arr2, 1);\n};\n\n // (spearman's) rank correlation coefficient, sp\njStat.spearmancoeff = function (arr1, arr2) {\n arr1 = jStat.rank(arr1);\n arr2 = jStat.rank(arr2);\n //return pearson's correlation of the ranks:\n return jStat.corrcoeff(arr1, arr2);\n}\n\n\n// statistical standardized moments (general form of skew/kurt)\njStat.stanMoment = function stanMoment(arr, n) {\n var mu = jStat.mean(arr);\n var sigma = jStat.stdev(arr);\n var len = arr.length;\n var skewSum = 0;\n\n for (var i = 0; i < len; i++)\n skewSum += Math.pow((arr[i] - mu) / sigma, n);\n\n return skewSum / arr.length;\n};\n\n// (pearson's) moment coefficient of skewness\njStat.skewness = function skewness(arr) {\n return jStat.stanMoment(arr, 3);\n};\n\n// (pearson's) (excess) kurtosis\njStat.kurtosis = function kurtosis(arr) {\n return jStat.stanMoment(arr, 4) - 3;\n};\n\n\nvar jProto = jStat.prototype;\n\n\n// Extend jProto with method for calculating cumulative sums and products.\n// This differs from the similar extension below as cumsum and cumprod should\n// not be run again in the case fullbool === true.\n// If a matrix is passed, automatically assume operation should be done on the\n// columns.\n(function(funcs) {\n for (var i = 0; i < funcs.length; i++) (function(passfunc) {\n // If a matrix is passed, automatically assume operation should be done on\n // the columns.\n jProto[passfunc] = function(fullbool, func) {\n var arr = [];\n var i = 0;\n var tmpthis = this;\n // Assignment reassignation depending on how parameters were passed in.\n if (isFunction(fullbool)) {\n func = fullbool;\n fullbool = false;\n }\n // Check if a callback was passed with the function.\n if (func) {\n setTimeout(function() {\n func.call(tmpthis, jProto[passfunc].call(tmpthis, fullbool));\n });\n return this;\n }\n // Check if matrix and run calculations.\n if (this.length > 1) {\n tmpthis = fullbool === true ? this : this.transpose();\n for (; i < tmpthis.length; i++)\n arr[i] = jStat[passfunc](tmpthis[i]);\n return arr;\n }\n // Pass fullbool if only vector, not a matrix. for variance and stdev.\n return jStat[passfunc](this[0], fullbool);\n };\n })(funcs[i]);\n})(('cumsum cumprod').split(' '));\n\n\n// Extend jProto with methods which don't require arguments and work on columns.\n(function(funcs) {\n for (var i = 0; i < funcs.length; i++) (function(passfunc) {\n // If a matrix is passed, automatically assume operation should be done on\n // the columns.\n jProto[passfunc] = function(fullbool, func) {\n var arr = [];\n var i = 0;\n var tmpthis = this;\n // Assignment reassignation depending on how parameters were passed in.\n if (isFunction(fullbool)) {\n func = fullbool;\n fullbool = false;\n }\n // Check if a callback was passed with the function.\n if (func) {\n setTimeout(function() {\n func.call(tmpthis, jProto[passfunc].call(tmpthis, fullbool));\n });\n return this;\n }\n // Check if matrix and run calculations.\n if (this.length > 1) {\n if (passfunc !== 'sumrow')\n tmpthis = fullbool === true ? this : this.transpose();\n for (; i < tmpthis.length; i++)\n arr[i] = jStat[passfunc](tmpthis[i]);\n return fullbool === true\n ? jStat[passfunc](jStat.utils.toVector(arr))\n : arr;\n }\n // Pass fullbool if only vector, not a matrix. for variance and stdev.\n return jStat[passfunc](this[0], fullbool);\n };\n })(funcs[i]);\n})(('sum sumsqrd sumsqerr sumrow product min max unique mean meansqerr ' +\n 'geomean median diff rank mode range variance deviation stdev meandev ' +\n 'meddev coeffvar quartiles histogram skewness kurtosis').split(' '));\n\n\n// Extend jProto with functions that take arguments. Operations on matrices are\n// done on columns.\n(function(funcs) {\n for (var i = 0; i < funcs.length; i++) (function(passfunc) {\n jProto[passfunc] = function() {\n var arr = [];\n var i = 0;\n var tmpthis = this;\n var args = Array.prototype.slice.call(arguments);\n var callbackFunction;\n\n // If the last argument is a function, we assume it's a callback; we\n // strip the callback out and call the function again.\n if (isFunction(args[args.length - 1])) {\n callbackFunction = args[args.length - 1];\n var argsToPass = args.slice(0, args.length - 1);\n\n setTimeout(function() {\n callbackFunction.call(tmpthis,\n jProto[passfunc].apply(tmpthis, argsToPass));\n });\n return this;\n\n // Otherwise we curry the function args and call normally.\n } else {\n callbackFunction = undefined;\n var curriedFunction = function curriedFunction(vector) {\n return jStat[passfunc].apply(tmpthis, [vector].concat(args));\n }\n }\n\n // If this is a matrix, run column-by-column.\n if (this.length > 1) {\n tmpthis = tmpthis.transpose();\n for (; i < tmpthis.length; i++)\n arr[i] = curriedFunction(tmpthis[i]);\n return arr;\n }\n\n // Otherwise run on the vector.\n return curriedFunction(this[0]);\n };\n })(funcs[i]);\n})('quantiles percentileOfScore'.split(' '));\n\n}(jStat, Math));\n// Special functions //\n(function(jStat, Math) {\n\n// Log-gamma function\njStat.gammaln = function gammaln(x) {\n var j = 0;\n var cof = [\n 76.18009172947146, -86.50532032941677, 24.01409824083091,\n -1.231739572450155, 0.1208650973866179e-2, -0.5395239384953e-5\n ];\n var ser = 1.000000000190015;\n var xx, y, tmp;\n tmp = (y = xx = x) + 5.5;\n tmp -= (xx + 0.5) * Math.log(tmp);\n for (; j < 6; j++)\n ser += cof[j] / ++y;\n return Math.log(2.5066282746310005 * ser / xx) - tmp;\n};\n\n/*\n * log-gamma function to support poisson distribution sampling. The\n * algorithm comes from SPECFUN by Shanjie Zhang and Jianming Jin and their\n * book \"Computation of Special Functions\", 1996, John Wiley & Sons, Inc.\n */\njStat.loggam = function loggam(x) {\n var x0, x2, xp, gl, gl0;\n var k, n;\n\n var a = [8.333333333333333e-02, -2.777777777777778e-03,\n 7.936507936507937e-04, -5.952380952380952e-04,\n 8.417508417508418e-04, -1.917526917526918e-03,\n 6.410256410256410e-03, -2.955065359477124e-02,\n 1.796443723688307e-01, -1.39243221690590e+00];\n x0 = x;\n n = 0;\n if ((x == 1.0) || (x == 2.0)) {\n return 0.0;\n }\n if (x <= 7.0) {\n n = Math.floor(7 - x);\n x0 = x + n;\n }\n x2 = 1.0 / (x0 * x0);\n xp = 2 * Math.PI;\n gl0 = a[9];\n for (k = 8; k >= 0; k--) {\n gl0 *= x2;\n gl0 += a[k];\n }\n gl = gl0 / x0 + 0.5 * Math.log(xp) + (x0 - 0.5) * Math.log(x0) - x0;\n if (x <= 7.0) {\n for (k = 1; k <= n; k++) {\n gl -= Math.log(x0 - 1.0);\n x0 -= 1.0;\n }\n }\n return gl;\n}\n\n// gamma of x\njStat.gammafn = function gammafn(x) {\n var p = [-1.716185138865495, 24.76565080557592, -379.80425647094563,\n 629.3311553128184, 866.9662027904133, -31451.272968848367,\n -36144.413418691176, 66456.14382024054\n ];\n var q = [-30.8402300119739, 315.35062697960416, -1015.1563674902192,\n -3107.771671572311, 22538.118420980151, 4755.8462775278811,\n -134659.9598649693, -115132.2596755535];\n var fact = false;\n var n = 0;\n var xden = 0;\n var xnum = 0;\n var y = x;\n var i, z, yi, res;\n if (x > 171.6243769536076) {\n return Infinity;\n }\n if (y <= 0) {\n res = y % 1 + 3.6e-16;\n if (res) {\n fact = (!(y & 1) ? 1 : -1) * Math.PI / Math.sin(Math.PI * res);\n y = 1 - y;\n } else {\n return Infinity;\n }\n }\n yi = y;\n if (y < 1) {\n z = y++;\n } else {\n z = (y -= n = (y | 0) - 1) - 1;\n }\n for (i = 0; i < 8; ++i) {\n xnum = (xnum + p[i]) * z;\n xden = xden * z + q[i];\n }\n res = xnum / xden + 1;\n if (yi < y) {\n res /= yi;\n } else if (yi > y) {\n for (i = 0; i < n; ++i) {\n res *= y;\n y++;\n }\n }\n if (fact) {\n res = fact / res;\n }\n return res;\n};\n\n\n// lower incomplete gamma function, which is usually typeset with a\n// lower-case greek gamma as the function symbol\njStat.gammap = function gammap(a, x) {\n return jStat.lowRegGamma(a, x) * jStat.gammafn(a);\n};\n\n\n// The lower regularized incomplete gamma function, usually written P(a,x)\njStat.lowRegGamma = function lowRegGamma(a, x) {\n var aln = jStat.gammaln(a);\n var ap = a;\n var sum = 1 / a;\n var del = sum;\n var b = x + 1 - a;\n var c = 1 / 1.0e-30;\n var d = 1 / b;\n var h = d;\n var i = 1;\n // calculate maximum number of itterations required for a\n var ITMAX = -~(Math.log((a >= 1) ? a : 1 / a) * 8.5 + a * 0.4 + 17);\n var an;\n\n if (x < 0 || a <= 0) {\n return NaN;\n } else if (x < a + 1) {\n for (; i <= ITMAX; i++) {\n sum += del *= x / ++ap;\n }\n return (sum * Math.exp(-x + a * Math.log(x) - (aln)));\n }\n\n for (; i <= ITMAX; i++) {\n an = -i * (i - a);\n b += 2;\n d = an * d + b;\n c = b + an / c;\n d = 1 / d;\n h *= d * c;\n }\n\n return (1 - h * Math.exp(-x + a * Math.log(x) - (aln)));\n};\n\n// natural log factorial of n\njStat.factorialln = function factorialln(n) {\n return n < 0 ? NaN : jStat.gammaln(n + 1);\n};\n\n// factorial of n\njStat.factorial = function factorial(n) {\n return n < 0 ? NaN : jStat.gammafn(n + 1);\n};\n\n// combinations of n, m\njStat.combination = function combination(n, m) {\n // make sure n or m don't exceed the upper limit of usable values\n return (n > 170 || m > 170)\n ? Math.exp(jStat.combinationln(n, m))\n : (jStat.factorial(n) / jStat.factorial(m)) / jStat.factorial(n - m);\n};\n\n\njStat.combinationln = function combinationln(n, m){\n return jStat.factorialln(n) - jStat.factorialln(m) - jStat.factorialln(n - m);\n};\n\n\n// permutations of n, m\njStat.permutation = function permutation(n, m) {\n return jStat.factorial(n) / jStat.factorial(n - m);\n};\n\n\n// beta function\njStat.betafn = function betafn(x, y) {\n // ensure arguments are positive\n if (x <= 0 || y <= 0)\n return undefined;\n // make sure x + y doesn't exceed the upper limit of usable values\n return (x + y > 170)\n ? Math.exp(jStat.betaln(x, y))\n : jStat.gammafn(x) * jStat.gammafn(y) / jStat.gammafn(x + y);\n};\n\n\n// natural logarithm of beta function\njStat.betaln = function betaln(x, y) {\n return jStat.gammaln(x) + jStat.gammaln(y) - jStat.gammaln(x + y);\n};\n\n\n// Evaluates the continued fraction for incomplete beta function by modified\n// Lentz's method.\njStat.betacf = function betacf(x, a, b) {\n var fpmin = 1e-30;\n var m = 1;\n var qab = a + b;\n var qap = a + 1;\n var qam = a - 1;\n var c = 1;\n var d = 1 - qab * x / qap;\n var m2, aa, del, h;\n\n // These q's will be used in factors that occur in the coefficients\n if (Math.abs(d) < fpmin)\n d = fpmin;\n d = 1 / d;\n h = d;\n\n for (; m <= 100; m++) {\n m2 = 2 * m;\n aa = m * (b - m) * x / ((qam + m2) * (a + m2));\n // One step (the even one) of the recurrence\n d = 1 + aa * d;\n if (Math.abs(d) < fpmin)\n d = fpmin;\n c = 1 + aa / c;\n if (Math.abs(c) < fpmin)\n c = fpmin;\n d = 1 / d;\n h *= d * c;\n aa = -(a + m) * (qab + m) * x / ((a + m2) * (qap + m2));\n // Next step of the recurrence (the odd one)\n d = 1 + aa * d;\n if (Math.abs(d) < fpmin)\n d = fpmin;\n c = 1 + aa / c;\n if (Math.abs(c) < fpmin)\n c = fpmin;\n d = 1 / d;\n del = d * c;\n h *= del;\n if (Math.abs(del - 1.0) < 3e-7)\n break;\n }\n\n return h;\n};\n\n\n// Returns the inverse of the lower regularized inomplete gamma function\njStat.gammapinv = function gammapinv(p, a) {\n var j = 0;\n var a1 = a - 1;\n var EPS = 1e-8;\n var gln = jStat.gammaln(a);\n var x, err, t, u, pp, lna1, afac;\n\n if (p >= 1)\n return Math.max(100, a + 100 * Math.sqrt(a));\n if (p <= 0)\n return 0;\n if (a > 1) {\n lna1 = Math.log(a1);\n afac = Math.exp(a1 * (lna1 - 1) - gln);\n pp = (p < 0.5) ? p : 1 - p;\n t = Math.sqrt(-2 * Math.log(pp));\n x = (2.30753 + t * 0.27061) / (1 + t * (0.99229 + t * 0.04481)) - t;\n if (p < 0.5)\n x = -x;\n x = Math.max(1e-3,\n a * Math.pow(1 - 1 / (9 * a) - x / (3 * Math.sqrt(a)), 3));\n } else {\n t = 1 - a * (0.253 + a * 0.12);\n if (p < t)\n x = Math.pow(p / t, 1 / a);\n else\n x = 1 - Math.log(1 - (p - t) / (1 - t));\n }\n\n for(; j < 12; j++) {\n if (x <= 0)\n return 0;\n err = jStat.lowRegGamma(a, x) - p;\n if (a > 1)\n t = afac * Math.exp(-(x - a1) + a1 * (Math.log(x) - lna1));\n else\n t = Math.exp(-x + a1 * Math.log(x) - gln);\n u = err / t;\n x -= (t = u / (1 - 0.5 * Math.min(1, u * ((a - 1) / x - 1))));\n if (x <= 0)\n x = 0.5 * (x + t);\n if (Math.abs(t) < EPS * x)\n break;\n }\n\n return x;\n};\n\n\n// Returns the error function erf(x)\njStat.erf = function erf(x) {\n var cof = [-1.3026537197817094, 6.4196979235649026e-1, 1.9476473204185836e-2,\n -9.561514786808631e-3, -9.46595344482036e-4, 3.66839497852761e-4,\n 4.2523324806907e-5, -2.0278578112534e-5, -1.624290004647e-6,\n 1.303655835580e-6, 1.5626441722e-8, -8.5238095915e-8,\n 6.529054439e-9, 5.059343495e-9, -9.91364156e-10,\n -2.27365122e-10, 9.6467911e-11, 2.394038e-12,\n -6.886027e-12, 8.94487e-13, 3.13092e-13,\n -1.12708e-13, 3.81e-16, 7.106e-15,\n -1.523e-15, -9.4e-17, 1.21e-16,\n -2.8e-17];\n var j = cof.length - 1;\n var isneg = false;\n var d = 0;\n var dd = 0;\n var t, ty, tmp, res;\n\n if (x < 0) {\n x = -x;\n isneg = true;\n }\n\n t = 2 / (2 + x);\n ty = 4 * t - 2;\n\n for(; j > 0; j--) {\n tmp = d;\n d = ty * d - dd + cof[j];\n dd = tmp;\n }\n\n res = t * Math.exp(-x * x + 0.5 * (cof[0] + ty * d) - dd);\n return isneg ? res - 1 : 1 - res;\n};\n\n\n// Returns the complmentary error function erfc(x)\njStat.erfc = function erfc(x) {\n return 1 - jStat.erf(x);\n};\n\n\n// Returns the inverse of the complementary error function\njStat.erfcinv = function erfcinv(p) {\n var j = 0;\n var x, err, t, pp;\n if (p >= 2)\n return -100;\n if (p <= 0)\n return 100;\n pp = (p < 1) ? p : 2 - p;\n t = Math.sqrt(-2 * Math.log(pp / 2));\n x = -0.70711 * ((2.30753 + t * 0.27061) /\n (1 + t * (0.99229 + t * 0.04481)) - t);\n for (; j < 2; j++) {\n err = jStat.erfc(x) - pp;\n x += err / (1.12837916709551257 * Math.exp(-x * x) - x * err);\n }\n return (p < 1) ? x : -x;\n};\n\n\n// Returns the inverse of the incomplete beta function\njStat.ibetainv = function ibetainv(p, a, b) {\n var EPS = 1e-8;\n var a1 = a - 1;\n var b1 = b - 1;\n var j = 0;\n var lna, lnb, pp, t, u, err, x, al, h, w, afac;\n if (p <= 0)\n return 0;\n if (p >= 1)\n return 1;\n if (a >= 1 && b >= 1) {\n pp = (p < 0.5) ? p : 1 - p;\n t = Math.sqrt(-2 * Math.log(pp));\n x = (2.30753 + t * 0.27061) / (1 + t* (0.99229 + t * 0.04481)) - t;\n if (p < 0.5)\n x = -x;\n al = (x * x - 3) / 6;\n h = 2 / (1 / (2 * a - 1) + 1 / (2 * b - 1));\n w = (x * Math.sqrt(al + h) / h) - (1 / (2 * b - 1) - 1 / (2 * a - 1)) *\n (al + 5 / 6 - 2 / (3 * h));\n x = a / (a + b * Math.exp(2 * w));\n } else {\n lna = Math.log(a / (a + b));\n lnb = Math.log(b / (a + b));\n t = Math.exp(a * lna) / a;\n u = Math.exp(b * lnb) / b;\n w = t + u;\n if (p < t / w)\n x = Math.pow(a * w * p, 1 / a);\n else\n x = 1 - Math.pow(b * w * (1 - p), 1 / b);\n }\n afac = -jStat.gammaln(a) - jStat.gammaln(b) + jStat.gammaln(a + b);\n for(; j < 10; j++) {\n if (x === 0 || x === 1)\n return x;\n err = jStat.ibeta(x, a, b) - p;\n t = Math.exp(a1 * Math.log(x) + b1 * Math.log(1 - x) + afac);\n u = err / t;\n x -= (t = u / (1 - 0.5 * Math.min(1, u * (a1 / x - b1 / (1 - x)))));\n if (x <= 0)\n x = 0.5 * (x + t);\n if (x >= 1)\n x = 0.5 * (x + t + 1);\n if (Math.abs(t) < EPS * x && j > 0)\n break;\n }\n return x;\n};\n\n\n// Returns the incomplete beta function I_x(a,b)\njStat.ibeta = function ibeta(x, a, b) {\n // Factors in front of the continued fraction.\n var bt = (x === 0 || x === 1) ? 0 :\n Math.exp(jStat.gammaln(a + b) - jStat.gammaln(a) -\n jStat.gammaln(b) + a * Math.log(x) + b *\n Math.log(1 - x));\n if (x < 0 || x > 1)\n return false;\n if (x < (a + 1) / (a + b + 2))\n // Use continued fraction directly.\n return bt * jStat.betacf(x, a, b) / a;\n // else use continued fraction after making the symmetry transformation.\n return 1 - bt * jStat.betacf(1 - x, b, a) / b;\n};\n\n\n// Returns a normal deviate (mu=0, sigma=1).\n// If n and m are specified it returns a object of normal deviates.\njStat.randn = function randn(n, m) {\n var u, v, x, y, q;\n if (!m)\n m = n;\n if (n)\n return jStat.create(n, m, function() { return jStat.randn(); });\n do {\n u = jStat._random_fn();\n v = 1.7156 * (jStat._random_fn() - 0.5);\n x = u - 0.449871;\n y = Math.abs(v) + 0.386595;\n q = x * x + y * (0.19600 * y - 0.25472 * x);\n } while (q > 0.27597 && (q > 0.27846 || v * v > -4 * Math.log(u) * u * u));\n return v / u;\n};\n\n\n// Returns a gamma deviate by the method of Marsaglia and Tsang.\njStat.randg = function randg(shape, n, m) {\n var oalph = shape;\n var a1, a2, u, v, x, mat;\n if (!m)\n m = n;\n if (!shape)\n shape = 1;\n if (n) {\n mat = jStat.zeros(n,m);\n mat.alter(function() { return jStat.randg(shape); });\n return mat;\n }\n if (shape < 1)\n shape += 1;\n a1 = shape - 1 / 3;\n a2 = 1 / Math.sqrt(9 * a1);\n do {\n do {\n x = jStat.randn();\n v = 1 + a2 * x;\n } while(v <= 0);\n v = v * v * v;\n u = jStat._random_fn();\n } while(u > 1 - 0.331 * Math.pow(x, 4) &&\n Math.log(u) > 0.5 * x*x + a1 * (1 - v + Math.log(v)));\n // alpha > 1\n if (shape == oalph)\n return a1 * v;\n // alpha < 1\n do {\n u = jStat._random_fn();\n } while(u === 0);\n return Math.pow(u, 1 / oalph) * a1 * v;\n};\n\n\n// making use of static methods on the instance\n(function(funcs) {\n for (var i = 0; i < funcs.length; i++) (function(passfunc) {\n jStat.fn[passfunc] = function() {\n return jStat(\n jStat.map(this, function(value) { return jStat[passfunc](value); }));\n }\n })(funcs[i]);\n})('gammaln gammafn factorial factorialln'.split(' '));\n\n\n(function(funcs) {\n for (var i = 0; i < funcs.length; i++) (function(passfunc) {\n jStat.fn[passfunc] = function() {\n return jStat(jStat[passfunc].apply(null, arguments));\n };\n })(funcs[i]);\n})('randn'.split(' '));\n\n}(jStat, Math));\n(function(jStat, Math) {\n\n// generate all distribution instance methods\n(function(list) {\n for (var i = 0; i < list.length; i++) (function(func) {\n // distribution instance method\n jStat[func] = function f(a, b, c) {\n if (!(this instanceof f))\n return new f(a, b, c);\n this._a = a;\n this._b = b;\n this._c = c;\n return this;\n };\n // distribution method to be used on a jStat instance\n jStat.fn[func] = function(a, b, c) {\n var newthis = jStat[func](a, b, c);\n newthis.data = this;\n return newthis;\n };\n // sample instance method\n jStat[func].prototype.sample = function(arr) {\n var a = this._a;\n var b = this._b;\n var c = this._c;\n if (arr)\n return jStat.alter(arr, function() {\n return jStat[func].sample(a, b, c);\n });\n else\n return jStat[func].sample(a, b, c);\n };\n // generate the pdf, cdf and inv instance methods\n (function(vals) {\n for (var i = 0; i < vals.length; i++) (function(fnfunc) {\n jStat[func].prototype[fnfunc] = function(x) {\n var a = this._a;\n var b = this._b;\n var c = this._c;\n if (!x && x !== 0)\n x = this.data;\n if (typeof x !== 'number') {\n return jStat.fn.map.call(x, function(x) {\n return jStat[func][fnfunc](x, a, b, c);\n });\n }\n return jStat[func][fnfunc](x, a, b, c);\n };\n })(vals[i]);\n })('pdf cdf inv'.split(' '));\n // generate the mean, median, mode and variance instance methods\n (function(vals) {\n for (var i = 0; i < vals.length; i++) (function(fnfunc) {\n jStat[func].prototype[fnfunc] = function() {\n return jStat[func][fnfunc](this._a, this._b, this._c);\n };\n })(vals[i]);\n })('mean median mode variance'.split(' '));\n })(list[i]);\n})((\n 'beta centralF cauchy chisquare exponential gamma invgamma kumaraswamy ' +\n 'laplace lognormal noncentralt normal pareto studentt weibull uniform ' +\n 'binomial negbin hypgeom poisson triangular tukey arcsine'\n).split(' '));\n\n\n\n// extend beta function with static methods\njStat.extend(jStat.beta, {\n pdf: function pdf(x, alpha, beta) {\n // PDF is zero outside the support\n if (x > 1 || x < 0)\n return 0;\n // PDF is one for the uniform case\n if (alpha == 1 && beta == 1)\n return 1;\n\n if (alpha < 512 && beta < 512) {\n return (Math.pow(x, alpha - 1) * Math.pow(1 - x, beta - 1)) /\n jStat.betafn(alpha, beta);\n } else {\n return Math.exp((alpha - 1) * Math.log(x) +\n (beta - 1) * Math.log(1 - x) -\n jStat.betaln(alpha, beta));\n }\n },\n\n cdf: function cdf(x, alpha, beta) {\n return (x > 1 || x < 0) ? (x > 1) * 1 : jStat.ibeta(x, alpha, beta);\n },\n\n inv: function inv(x, alpha, beta) {\n return jStat.ibetainv(x, alpha, beta);\n },\n\n mean: function mean(alpha, beta) {\n return alpha / (alpha + beta);\n },\n\n median: function median(alpha, beta) {\n return jStat.ibetainv(0.5, alpha, beta);\n },\n\n mode: function mode(alpha, beta) {\n return (alpha - 1 ) / ( alpha + beta - 2);\n },\n\n // return a random sample\n sample: function sample(alpha, beta) {\n var u = jStat.randg(alpha);\n return u / (u + jStat.randg(beta));\n },\n\n variance: function variance(alpha, beta) {\n return (alpha * beta) / (Math.pow(alpha + beta, 2) * (alpha + beta + 1));\n }\n});\n\n// extend F function with static methods\njStat.extend(jStat.centralF, {\n // This implementation of the pdf function avoids float overflow\n // See the way that R calculates this value:\n // https://svn.r-project.org/R/trunk/src/nmath/df.c\n pdf: function pdf(x, df1, df2) {\n var p, q, f;\n\n if (x < 0)\n return 0;\n\n if (df1 <= 2) {\n if (x === 0 && df1 < 2) {\n return Infinity;\n }\n if (x === 0 && df1 === 2) {\n return 1;\n }\n return (1 / jStat.betafn(df1 / 2, df2 / 2)) *\n Math.pow(df1 / df2, df1 / 2) *\n Math.pow(x, (df1/2) - 1) *\n Math.pow((1 + (df1 / df2) * x), -(df1 + df2) / 2);\n }\n\n p = (df1 * x) / (df2 + x * df1);\n q = df2 / (df2 + x * df1);\n f = df1 * q / 2.0;\n return f * jStat.binomial.pdf((df1 - 2) / 2, (df1 + df2 - 2) / 2, p);\n },\n\n cdf: function cdf(x, df1, df2) {\n if (x < 0)\n return 0;\n return jStat.ibeta((df1 * x) / (df1 * x + df2), df1 / 2, df2 / 2);\n },\n\n inv: function inv(x, df1, df2) {\n return df2 / (df1 * (1 / jStat.ibetainv(x, df1 / 2, df2 / 2) - 1));\n },\n\n mean: function mean(df1, df2) {\n return (df2 > 2) ? df2 / (df2 - 2) : undefined;\n },\n\n mode: function mode(df1, df2) {\n return (df1 > 2) ? (df2 * (df1 - 2)) / (df1 * (df2 + 2)) : undefined;\n },\n\n // return a random sample\n sample: function sample(df1, df2) {\n var x1 = jStat.randg(df1 / 2) * 2;\n var x2 = jStat.randg(df2 / 2) * 2;\n return (x1 / df1) / (x2 / df2);\n },\n\n variance: function variance(df1, df2) {\n if (df2 <= 4)\n return undefined;\n return 2 * df2 * df2 * (df1 + df2 - 2) /\n (df1 * (df2 - 2) * (df2 - 2) * (df2 - 4));\n }\n});\n\n\n// extend cauchy function with static methods\njStat.extend(jStat.cauchy, {\n pdf: function pdf(x, local, scale) {\n if (scale < 0) { return 0; }\n\n return (scale / (Math.pow(x - local, 2) + Math.pow(scale, 2))) / Math.PI;\n },\n\n cdf: function cdf(x, local, scale) {\n return Math.atan((x - local) / scale) / Math.PI + 0.5;\n },\n\n inv: function(p, local, scale) {\n return local + scale * Math.tan(Math.PI * (p - 0.5));\n },\n\n median: function median(local/*, scale*/) {\n return local;\n },\n\n mode: function mode(local/*, scale*/) {\n return local;\n },\n\n sample: function sample(local, scale) {\n return jStat.randn() *\n Math.sqrt(1 / (2 * jStat.randg(0.5))) * scale + local;\n }\n});\n\n\n\n// extend chisquare function with static methods\njStat.extend(jStat.chisquare, {\n pdf: function pdf(x, dof) {\n if (x < 0)\n return 0;\n return (x === 0 && dof === 2) ? 0.5 :\n Math.exp((dof / 2 - 1) * Math.log(x) - x / 2 - (dof / 2) *\n Math.log(2) - jStat.gammaln(dof / 2));\n },\n\n cdf: function cdf(x, dof) {\n if (x < 0)\n return 0;\n return jStat.lowRegGamma(dof / 2, x / 2);\n },\n\n inv: function(p, dof) {\n return 2 * jStat.gammapinv(p, 0.5 * dof);\n },\n\n mean : function(dof) {\n return dof;\n },\n\n // TODO: this is an approximation (is there a better way?)\n median: function median(dof) {\n return dof * Math.pow(1 - (2 / (9 * dof)), 3);\n },\n\n mode: function mode(dof) {\n return (dof - 2 > 0) ? dof - 2 : 0;\n },\n\n sample: function sample(dof) {\n return jStat.randg(dof / 2) * 2;\n },\n\n variance: function variance(dof) {\n return 2 * dof;\n }\n});\n\n\n\n// extend exponential function with static methods\njStat.extend(jStat.exponential, {\n pdf: function pdf(x, rate) {\n return x < 0 ? 0 : rate * Math.exp(-rate * x);\n },\n\n cdf: function cdf(x, rate) {\n return x < 0 ? 0 : 1 - Math.exp(-rate * x);\n },\n\n inv: function(p, rate) {\n return -Math.log(1 - p) / rate;\n },\n\n mean : function(rate) {\n return 1 / rate;\n },\n\n median: function (rate) {\n return (1 / rate) * Math.log(2);\n },\n\n mode: function mode(/*rate*/) {\n return 0;\n },\n\n sample: function sample(rate) {\n return -1 / rate * Math.log(jStat._random_fn());\n },\n\n variance : function(rate) {\n return Math.pow(rate, -2);\n }\n});\n\n\n\n// extend gamma function with static methods\njStat.extend(jStat.gamma, {\n pdf: function pdf(x, shape, scale) {\n if (x < 0)\n return 0;\n return (x === 0 && shape === 1) ? 1 / scale :\n Math.exp((shape - 1) * Math.log(x) - x / scale -\n jStat.gammaln(shape) - shape * Math.log(scale));\n },\n\n cdf: function cdf(x, shape, scale) {\n if (x < 0)\n return 0;\n return jStat.lowRegGamma(shape, x / scale);\n },\n\n inv: function(p, shape, scale) {\n return jStat.gammapinv(p, shape) * scale;\n },\n\n mean : function(shape, scale) {\n return shape * scale;\n },\n\n mode: function mode(shape, scale) {\n if(shape > 1) return (shape - 1) * scale;\n return undefined;\n },\n\n sample: function sample(shape, scale) {\n return jStat.randg(shape) * scale;\n },\n\n variance: function variance(shape, scale) {\n return shape * scale * scale;\n }\n});\n\n// extend inverse gamma function with static methods\njStat.extend(jStat.invgamma, {\n pdf: function pdf(x, shape, scale) {\n if (x <= 0)\n return 0;\n return Math.exp(-(shape + 1) * Math.log(x) - scale / x -\n jStat.gammaln(shape) + shape * Math.log(scale));\n },\n\n cdf: function cdf(x, shape, scale) {\n if (x <= 0)\n return 0;\n return 1 - jStat.lowRegGamma(shape, scale / x);\n },\n\n inv: function(p, shape, scale) {\n return scale / jStat.gammapinv(1 - p, shape);\n },\n\n mean : function(shape, scale) {\n return (shape > 1) ? scale / (shape - 1) : undefined;\n },\n\n mode: function mode(shape, scale) {\n return scale / (shape + 1);\n },\n\n sample: function sample(shape, scale) {\n return scale / jStat.randg(shape);\n },\n\n variance: function variance(shape, scale) {\n if (shape <= 2)\n return undefined;\n return scale * scale / ((shape - 1) * (shape - 1) * (shape - 2));\n }\n});\n\n\n// extend kumaraswamy function with static methods\njStat.extend(jStat.kumaraswamy, {\n pdf: function pdf(x, alpha, beta) {\n if (x === 0 && alpha === 1)\n return beta;\n else if (x === 1 && beta === 1)\n return alpha;\n return Math.exp(Math.log(alpha) + Math.log(beta) + (alpha - 1) *\n Math.log(x) + (beta - 1) *\n Math.log(1 - Math.pow(x, alpha)));\n },\n\n cdf: function cdf(x, alpha, beta) {\n if (x < 0)\n return 0;\n else if (x > 1)\n return 1;\n return (1 - Math.pow(1 - Math.pow(x, alpha), beta));\n },\n\n inv: function inv(p, alpha, beta) {\n return Math.pow(1 - Math.pow(1 - p, 1 / beta), 1 / alpha);\n },\n\n mean : function(alpha, beta) {\n return (beta * jStat.gammafn(1 + 1 / alpha) *\n jStat.gammafn(beta)) / (jStat.gammafn(1 + 1 / alpha + beta));\n },\n\n median: function median(alpha, beta) {\n return Math.pow(1 - Math.pow(2, -1 / beta), 1 / alpha);\n },\n\n mode: function mode(alpha, beta) {\n if (!(alpha >= 1 && beta >= 1 && (alpha !== 1 && beta !== 1)))\n return undefined;\n return Math.pow((alpha - 1) / (alpha * beta - 1), 1 / alpha);\n },\n\n variance: function variance(/*alpha, beta*/) {\n throw new Error('variance not yet implemented');\n // TODO: complete this\n }\n});\n\n\n\n// extend lognormal function with static methods\njStat.extend(jStat.lognormal, {\n pdf: function pdf(x, mu, sigma) {\n if (x <= 0)\n return 0;\n return Math.exp(-Math.log(x) - 0.5 * Math.log(2 * Math.PI) -\n Math.log(sigma) - Math.pow(Math.log(x) - mu, 2) /\n (2 * sigma * sigma));\n },\n\n cdf: function cdf(x, mu, sigma) {\n if (x < 0)\n return 0;\n return 0.5 +\n (0.5 * jStat.erf((Math.log(x) - mu) / Math.sqrt(2 * sigma * sigma)));\n },\n\n inv: function(p, mu, sigma) {\n return Math.exp(-1.41421356237309505 * sigma * jStat.erfcinv(2 * p) + mu);\n },\n\n mean: function mean(mu, sigma) {\n return Math.exp(mu + sigma * sigma / 2);\n },\n\n median: function median(mu/*, sigma*/) {\n return Math.exp(mu);\n },\n\n mode: function mode(mu, sigma) {\n return Math.exp(mu - sigma * sigma);\n },\n\n sample: function sample(mu, sigma) {\n return Math.exp(jStat.randn() * sigma + mu);\n },\n\n variance: function variance(mu, sigma) {\n return (Math.exp(sigma * sigma) - 1) * Math.exp(2 * mu + sigma * sigma);\n }\n});\n\n\n\n// extend noncentralt function with static methods\njStat.extend(jStat.noncentralt, {\n pdf: function pdf(x, dof, ncp) {\n var tol = 1e-14;\n if (Math.abs(ncp) < tol) // ncp approx 0; use student-t\n return jStat.studentt.pdf(x, dof)\n\n if (Math.abs(x) < tol) { // different formula for x == 0\n return Math.exp(jStat.gammaln((dof + 1) / 2) - ncp * ncp / 2 -\n 0.5 * Math.log(Math.PI * dof) - jStat.gammaln(dof / 2));\n }\n\n // formula for x != 0\n return dof / x *\n (jStat.noncentralt.cdf(x * Math.sqrt(1 + 2 / dof), dof+2, ncp) -\n jStat.noncentralt.cdf(x, dof, ncp));\n },\n\n cdf: function cdf(x, dof, ncp) {\n var tol = 1e-14;\n var min_iterations = 200;\n\n if (Math.abs(ncp) < tol) // ncp approx 0; use student-t\n return jStat.studentt.cdf(x, dof);\n\n // turn negative x into positive and flip result afterwards\n var flip = false;\n if (x < 0) {\n flip = true;\n ncp = -ncp;\n }\n\n var prob = jStat.normal.cdf(-ncp, 0, 1);\n var value = tol + 1;\n // use value at last two steps to determine convergence\n var lastvalue = value;\n var y = x * x / (x * x + dof);\n var j = 0;\n var p = Math.exp(-ncp * ncp / 2);\n var q = Math.exp(-ncp * ncp / 2 - 0.5 * Math.log(2) -\n jStat.gammaln(3 / 2)) * ncp;\n while (j < min_iterations || lastvalue > tol || value > tol) {\n lastvalue = value;\n if (j > 0) {\n p *= (ncp * ncp) / (2 * j);\n q *= (ncp * ncp) / (2 * (j + 1 / 2));\n }\n value = p * jStat.beta.cdf(y, j + 0.5, dof / 2) +\n q * jStat.beta.cdf(y, j+1, dof/2);\n prob += 0.5 * value;\n j++;\n }\n\n return flip ? (1 - prob) : prob;\n }\n});\n\n\n// extend normal function with static methods\njStat.extend(jStat.normal, {\n pdf: function pdf(x, mean, std) {\n return Math.exp(-0.5 * Math.log(2 * Math.PI) -\n Math.log(std) - Math.pow(x - mean, 2) / (2 * std * std));\n },\n\n cdf: function cdf(x, mean, std) {\n return 0.5 * (1 + jStat.erf((x - mean) / Math.sqrt(2 * std * std)));\n },\n\n inv: function(p, mean, std) {\n return -1.41421356237309505 * std * jStat.erfcinv(2 * p) + mean;\n },\n\n mean : function(mean/*, std*/) {\n return mean;\n },\n\n median: function median(mean/*, std*/) {\n return mean;\n },\n\n mode: function (mean/*, std*/) {\n return mean;\n },\n\n sample: function sample(mean, std) {\n return jStat.randn() * std + mean;\n },\n\n variance : function(mean, std) {\n return std * std;\n }\n});\n\n\n\n// extend pareto function with static methods\njStat.extend(jStat.pareto, {\n pdf: function pdf(x, scale, shape) {\n if (x < scale)\n return 0;\n return (shape * Math.pow(scale, shape)) / Math.pow(x, shape + 1);\n },\n\n cdf: function cdf(x, scale, shape) {\n if (x < scale)\n return 0;\n return 1 - Math.pow(scale / x, shape);\n },\n\n inv: function inv(p, scale, shape) {\n return scale / Math.pow(1 - p, 1 / shape);\n },\n\n mean: function mean(scale, shape) {\n if (shape <= 1)\n return undefined;\n return (shape * Math.pow(scale, shape)) / (shape - 1);\n },\n\n median: function median(scale, shape) {\n return scale * (shape * Math.SQRT2);\n },\n\n mode: function mode(scale/*, shape*/) {\n return scale;\n },\n\n variance : function(scale, shape) {\n if (shape <= 2)\n return undefined;\n return (scale*scale * shape) / (Math.pow(shape - 1, 2) * (shape - 2));\n }\n});\n\n\n\n// extend studentt function with static methods\njStat.extend(jStat.studentt, {\n pdf: function pdf(x, dof) {\n dof = dof > 1e100 ? 1e100 : dof;\n return (1/(Math.sqrt(dof) * jStat.betafn(0.5, dof/2))) *\n Math.pow(1 + ((x * x) / dof), -((dof + 1) / 2));\n },\n\n cdf: function cdf(x, dof) {\n var dof2 = dof / 2;\n return jStat.ibeta((x + Math.sqrt(x * x + dof)) /\n (2 * Math.sqrt(x * x + dof)), dof2, dof2);\n },\n\n inv: function(p, dof) {\n var x = jStat.ibetainv(2 * Math.min(p, 1 - p), 0.5 * dof, 0.5);\n x = Math.sqrt(dof * (1 - x) / x);\n return (p > 0.5) ? x : -x;\n },\n\n mean: function mean(dof) {\n return (dof > 1) ? 0 : undefined;\n },\n\n median: function median(/*dof*/) {\n return 0;\n },\n\n mode: function mode(/*dof*/) {\n return 0;\n },\n\n sample: function sample(dof) {\n return jStat.randn() * Math.sqrt(dof / (2 * jStat.randg(dof / 2)));\n },\n\n variance: function variance(dof) {\n return (dof > 2) ? dof / (dof - 2) : (dof > 1) ? Infinity : undefined;\n }\n});\n\n\n\n// extend weibull function with static methods\njStat.extend(jStat.weibull, {\n pdf: function pdf(x, scale, shape) {\n if (x < 0 || scale < 0 || shape < 0)\n return 0;\n return (shape / scale) * Math.pow((x / scale), (shape - 1)) *\n Math.exp(-(Math.pow((x / scale), shape)));\n },\n\n cdf: function cdf(x, scale, shape) {\n return x < 0 ? 0 : 1 - Math.exp(-Math.pow((x / scale), shape));\n },\n\n inv: function(p, scale, shape) {\n return scale * Math.pow(-Math.log(1 - p), 1 / shape);\n },\n\n mean : function(scale, shape) {\n return scale * jStat.gammafn(1 + 1 / shape);\n },\n\n median: function median(scale, shape) {\n return scale * Math.pow(Math.log(2), 1 / shape);\n },\n\n mode: function mode(scale, shape) {\n if (shape <= 1)\n return 0;\n return scale * Math.pow((shape - 1) / shape, 1 / shape);\n },\n\n sample: function sample(scale, shape) {\n return scale * Math.pow(-Math.log(jStat._random_fn()), 1 / shape);\n },\n\n variance: function variance(scale, shape) {\n return scale * scale * jStat.gammafn(1 + 2 / shape) -\n Math.pow(jStat.weibull.mean(scale, shape), 2);\n }\n});\n\n\n\n// extend uniform function with static methods\njStat.extend(jStat.uniform, {\n pdf: function pdf(x, a, b) {\n return (x < a || x > b) ? 0 : 1 / (b - a);\n },\n\n cdf: function cdf(x, a, b) {\n if (x < a)\n return 0;\n else if (x < b)\n return (x - a) / (b - a);\n return 1;\n },\n\n inv: function(p, a, b) {\n return a + (p * (b - a));\n },\n\n mean: function mean(a, b) {\n return 0.5 * (a + b);\n },\n\n median: function median(a, b) {\n return jStat.mean(a, b);\n },\n\n mode: function mode(/*a, b*/) {\n throw new Error('mode is not yet implemented');\n },\n\n sample: function sample(a, b) {\n return (a / 2 + b / 2) + (b / 2 - a / 2) * (2 * jStat._random_fn() - 1);\n },\n\n variance: function variance(a, b) {\n return Math.pow(b - a, 2) / 12;\n }\n});\n\n\n// Got this from http://www.math.ucla.edu/~tom/distributions/binomial.html\nfunction betinc(x, a, b, eps) {\n var a0 = 0;\n var b0 = 1;\n var a1 = 1;\n var b1 = 1;\n var m9 = 0;\n var a2 = 0;\n var c9;\n\n while (Math.abs((a1 - a2) / a1) > eps) {\n a2 = a1;\n c9 = -(a + m9) * (a + b + m9) * x / (a + 2 * m9) / (a + 2 * m9 + 1);\n a0 = a1 + c9 * a0;\n b0 = b1 + c9 * b0;\n m9 = m9 + 1;\n c9 = m9 * (b - m9) * x / (a + 2 * m9 - 1) / (a + 2 * m9);\n a1 = a0 + c9 * a1;\n b1 = b0 + c9 * b1;\n a0 = a0 / b1;\n b0 = b0 / b1;\n a1 = a1 / b1;\n b1 = 1;\n }\n\n return a1 / a;\n}\n\n\n// extend uniform function with static methods\njStat.extend(jStat.binomial, {\n pdf: function pdf(k, n, p) {\n return (p === 0 || p === 1) ?\n ((n * p) === k ? 1 : 0) :\n jStat.combination(n, k) * Math.pow(p, k) * Math.pow(1 - p, n - k);\n },\n\n cdf: function cdf(x, n, p) {\n var betacdf;\n var eps = 1e-10;\n\n if (x < 0)\n return 0;\n if (x >= n)\n return 1;\n if (p < 0 || p > 1 || n <= 0)\n return NaN;\n\n x = Math.floor(x);\n var z = p;\n var a = x + 1;\n var b = n - x;\n var s = a + b;\n var bt = Math.exp(jStat.gammaln(s) - jStat.gammaln(b) -\n jStat.gammaln(a) + a * Math.log(z) + b * Math.log(1 - z));\n\n if (z < (a + 1) / (s + 2))\n betacdf = bt * betinc(z, a, b, eps);\n else\n betacdf = 1 - bt * betinc(1 - z, b, a, eps);\n\n return Math.round((1 - betacdf) * (1 / eps)) / (1 / eps);\n }\n});\n\n\n\n// extend uniform function with static methods\njStat.extend(jStat.negbin, {\n pdf: function pdf(k, r, p) {\n if (k !== k >>> 0)\n return false;\n if (k < 0)\n return 0;\n return jStat.combination(k + r - 1, r - 1) *\n Math.pow(1 - p, k) * Math.pow(p, r);\n },\n\n cdf: function cdf(x, r, p) {\n var sum = 0,\n k = 0;\n if (x < 0) return 0;\n for (; k <= x; k++) {\n sum += jStat.negbin.pdf(k, r, p);\n }\n return sum;\n }\n});\n\n\n\n// extend uniform function with static methods\njStat.extend(jStat.hypgeom, {\n pdf: function pdf(k, N, m, n) {\n // Hypergeometric PDF.\n\n // A simplification of the CDF algorithm below.\n\n // k = number of successes drawn\n // N = population size\n // m = number of successes in population\n // n = number of items drawn from population\n\n if(k !== k | 0) {\n return false;\n } else if(k < 0 || k < m - (N - n)) {\n // It's impossible to have this few successes drawn.\n return 0;\n } else if(k > n || k > m) {\n // It's impossible to have this many successes drawn.\n return 0;\n } else if (m * 2 > N) {\n // More than half the population is successes.\n\n if(n * 2 > N) {\n // More than half the population is sampled.\n\n return jStat.hypgeom.pdf(N - m - n + k, N, N - m, N - n)\n } else {\n // Half or less of the population is sampled.\n\n return jStat.hypgeom.pdf(n - k, N, N - m, n);\n }\n\n } else if(n * 2 > N) {\n // Half or less is successes.\n\n return jStat.hypgeom.pdf(m - k, N, m, N - n);\n\n } else if(m < n) {\n // We want to have the number of things sampled to be less than the\n // successes available. So swap the definitions of successful and sampled.\n return jStat.hypgeom.pdf(k, N, n, m);\n } else {\n // If we get here, half or less of the population was sampled, half or\n // less of it was successes, and we had fewer sampled things than\n // successes. Now we can do this complicated iterative algorithm in an\n // efficient way.\n\n // The basic premise of the algorithm is that we partially normalize our\n // intermediate product to keep it in a numerically good region, and then\n // finish the normalization at the end.\n\n // This variable holds the scaled probability of the current number of\n // successes.\n var scaledPDF = 1;\n\n // This keeps track of how much we have normalized.\n var samplesDone = 0;\n\n for(var i = 0; i < k; i++) {\n // For every possible number of successes up to that observed...\n\n while(scaledPDF > 1 && samplesDone < n) {\n // Intermediate result is growing too big. Apply some of the\n // normalization to shrink everything.\n\n scaledPDF *= 1 - (m / (N - samplesDone));\n\n // Say we've normalized by this sample already.\n samplesDone++;\n }\n\n // Work out the partially-normalized hypergeometric PDF for the next\n // number of successes\n scaledPDF *= (n - i) * (m - i) / ((i + 1) * (N - m - n + i + 1));\n }\n\n for(; samplesDone < n; samplesDone++) {\n // Apply all the rest of the normalization\n scaledPDF *= 1 - (m / (N - samplesDone));\n }\n\n // Bound answer sanely before returning.\n return Math.min(1, Math.max(0, scaledPDF));\n }\n },\n\n cdf: function cdf(x, N, m, n) {\n // Hypergeometric CDF.\n\n // This algorithm is due to Prof. Thomas S. Ferguson, ,\n // and comes from his hypergeometric test calculator at\n // .\n\n // x = number of successes drawn\n // N = population size\n // m = number of successes in population\n // n = number of items drawn from population\n\n if(x < 0 || x < m - (N - n)) {\n // It's impossible to have this few successes drawn or fewer.\n return 0;\n } else if(x >= n || x >= m) {\n // We will always have this many successes or fewer.\n return 1;\n } else if (m * 2 > N) {\n // More than half the population is successes.\n\n if(n * 2 > N) {\n // More than half the population is sampled.\n\n return jStat.hypgeom.cdf(N - m - n + x, N, N - m, N - n)\n } else {\n // Half or less of the population is sampled.\n\n return 1 - jStat.hypgeom.cdf(n - x - 1, N, N - m, n);\n }\n\n } else if(n * 2 > N) {\n // Half or less is successes.\n\n return 1 - jStat.hypgeom.cdf(m - x - 1, N, m, N - n);\n\n } else if(m < n) {\n // We want to have the number of things sampled to be less than the\n // successes available. So swap the definitions of successful and sampled.\n return jStat.hypgeom.cdf(x, N, n, m);\n } else {\n // If we get here, half or less of the population was sampled, half or\n // less of it was successes, and we had fewer sampled things than\n // successes. Now we can do this complicated iterative algorithm in an\n // efficient way.\n\n // The basic premise of the algorithm is that we partially normalize our\n // intermediate sum to keep it in a numerically good region, and then\n // finish the normalization at the end.\n\n // Holds the intermediate, scaled total CDF.\n var scaledCDF = 1;\n\n // This variable holds the scaled probability of the current number of\n // successes.\n var scaledPDF = 1;\n\n // This keeps track of how much we have normalized.\n var samplesDone = 0;\n\n for(var i = 0; i < x; i++) {\n // For every possible number of successes up to that observed...\n\n while(scaledCDF > 1 && samplesDone < n) {\n // Intermediate result is growing too big. Apply some of the\n // normalization to shrink everything.\n\n var factor = 1 - (m / (N - samplesDone));\n\n scaledPDF *= factor;\n scaledCDF *= factor;\n\n // Say we've normalized by this sample already.\n samplesDone++;\n }\n\n // Work out the partially-normalized hypergeometric PDF for the next\n // number of successes\n scaledPDF *= (n - i) * (m - i) / ((i + 1) * (N - m - n + i + 1));\n\n // Add to the CDF answer.\n scaledCDF += scaledPDF;\n }\n\n for(; samplesDone < n; samplesDone++) {\n // Apply all the rest of the normalization\n scaledCDF *= 1 - (m / (N - samplesDone));\n }\n\n // Bound answer sanely before returning.\n return Math.min(1, Math.max(0, scaledCDF));\n }\n }\n});\n\n\n\n// extend uniform function with static methods\njStat.extend(jStat.poisson, {\n pdf: function pdf(k, l) {\n if (l < 0 || (k % 1) !== 0 || k < 0) {\n return 0;\n }\n\n return Math.pow(l, k) * Math.exp(-l) / jStat.factorial(k);\n },\n\n cdf: function cdf(x, l) {\n var sumarr = [],\n k = 0;\n if (x < 0) return 0;\n for (; k <= x; k++) {\n sumarr.push(jStat.poisson.pdf(k, l));\n }\n return jStat.sum(sumarr);\n },\n\n mean : function(l) {\n return l;\n },\n\n variance : function(l) {\n return l;\n },\n\n sampleSmall: function sampleSmall(l) {\n var p = 1, k = 0, L = Math.exp(-l);\n do {\n k++;\n p *= jStat._random_fn();\n } while (p > L);\n return k - 1;\n },\n\n sampleLarge: function sampleLarge(l) {\n var lam = l;\n var k;\n var U, V, slam, loglam, a, b, invalpha, vr, us;\n\n slam = Math.sqrt(lam);\n loglam = Math.log(lam);\n b = 0.931 + 2.53 * slam;\n a = -0.059 + 0.02483 * b;\n invalpha = 1.1239 + 1.1328 / (b - 3.4);\n vr = 0.9277 - 3.6224 / (b - 2);\n\n while (1) {\n U = Math.random() - 0.5;\n V = Math.random();\n us = 0.5 - Math.abs(U);\n k = Math.floor((2 * a / us + b) * U + lam + 0.43);\n if ((us >= 0.07) && (V <= vr)) {\n return k;\n }\n if ((k < 0) || ((us < 0.013) && (V > us))) {\n continue;\n }\n /* log(V) == log(0.0) ok here */\n /* if U==0.0 so that us==0.0, log is ok since always returns */\n if ((Math.log(V) + Math.log(invalpha) - Math.log(a / (us * us) + b)) <= (-lam + k * loglam - jStat.loggam(k + 1))) {\n return k;\n }\n }\n },\n\n sample: function sample(l) {\n if (l < 10)\n return this.sampleSmall(l);\n else\n return this.sampleLarge(l);\n }\n});\n\n// extend triangular function with static methods\njStat.extend(jStat.triangular, {\n pdf: function pdf(x, a, b, c) {\n if (b <= a || c < a || c > b) {\n return NaN;\n } else {\n if (x < a || x > b) {\n return 0;\n } else if (x < c) {\n return (2 * (x - a)) / ((b - a) * (c - a));\n } else if (x === c) {\n return (2 / (b - a));\n } else { // x > c\n return (2 * (b - x)) / ((b - a) * (b - c));\n }\n }\n },\n\n cdf: function cdf(x, a, b, c) {\n if (b <= a || c < a || c > b)\n return NaN;\n if (x <= a)\n return 0;\n else if (x >= b)\n return 1;\n if (x <= c)\n return Math.pow(x - a, 2) / ((b - a) * (c - a));\n else // x > c\n return 1 - Math.pow(b - x, 2) / ((b - a) * (b - c));\n },\n\n inv: function inv(p, a, b, c) {\n if (b <= a || c < a || c > b) {\n return NaN;\n } else {\n if (p <= ((c - a) / (b - a))) {\n return a + (b - a) * Math.sqrt(p * ((c - a) / (b - a)));\n } else { // p > ((c - a) / (b - a))\n return a + (b - a) * (1 - Math.sqrt((1 - p) * (1 - ((c - a) / (b - a)))));\n }\n }\n },\n\n mean: function mean(a, b, c) {\n return (a + b + c) / 3;\n },\n\n median: function median(a, b, c) {\n if (c <= (a + b) / 2) {\n return b - Math.sqrt((b - a) * (b - c)) / Math.sqrt(2);\n } else if (c > (a + b) / 2) {\n return a + Math.sqrt((b - a) * (c - a)) / Math.sqrt(2);\n }\n },\n\n mode: function mode(a, b, c) {\n return c;\n },\n\n sample: function sample(a, b, c) {\n var u = jStat._random_fn();\n if (u < ((c - a) / (b - a)))\n return a + Math.sqrt(u * (b - a) * (c - a))\n return b - Math.sqrt((1 - u) * (b - a) * (b - c));\n },\n\n variance: function variance(a, b, c) {\n return (a * a + b * b + c * c - a * b - a * c - b * c) / 18;\n }\n});\n\n\n// extend arcsine function with static methods\njStat.extend(jStat.arcsine, {\n pdf: function pdf(x, a, b) {\n if (b <= a) return NaN;\n\n return (x <= a || x >= b) ? 0 :\n (2 / Math.PI) *\n Math.pow(Math.pow(b - a, 2) -\n Math.pow(2 * x - a - b, 2), -0.5);\n },\n\n cdf: function cdf(x, a, b) {\n if (x < a)\n return 0;\n else if (x < b)\n return (2 / Math.PI) * Math.asin(Math.sqrt((x - a)/(b - a)));\n return 1;\n },\n\n inv: function(p, a, b) {\n return a + (0.5 - 0.5 * Math.cos(Math.PI * p)) * (b - a);\n },\n\n mean: function mean(a, b) {\n if (b <= a) return NaN;\n return (a + b) / 2;\n },\n\n median: function median(a, b) {\n if (b <= a) return NaN;\n return (a + b) / 2;\n },\n\n mode: function mode(/*a, b*/) {\n throw new Error('mode is not yet implemented');\n },\n\n sample: function sample(a, b) {\n return ((a + b) / 2) + ((b - a) / 2) *\n Math.sin(2 * Math.PI * jStat.uniform.sample(0, 1));\n },\n\n variance: function variance(a, b) {\n if (b <= a) return NaN;\n return Math.pow(b - a, 2) / 8;\n }\n});\n\n\nfunction laplaceSign(x) { return x / Math.abs(x); }\n\njStat.extend(jStat.laplace, {\n pdf: function pdf(x, mu, b) {\n return (b <= 0) ? 0 : (Math.exp(-Math.abs(x - mu) / b)) / (2 * b);\n },\n\n cdf: function cdf(x, mu, b) {\n if (b <= 0) { return 0; }\n\n if(x < mu) {\n return 0.5 * Math.exp((x - mu) / b);\n } else {\n return 1 - 0.5 * Math.exp(- (x - mu) / b);\n }\n },\n\n mean: function(mu/*, b*/) {\n return mu;\n },\n\n median: function(mu/*, b*/) {\n return mu;\n },\n\n mode: function(mu/*, b*/) {\n return mu;\n },\n\n variance: function(mu, b) {\n return 2 * b * b;\n },\n\n sample: function sample(mu, b) {\n var u = jStat._random_fn() - 0.5;\n\n return mu - (b * laplaceSign(u) * Math.log(1 - (2 * Math.abs(u))));\n }\n});\n\nfunction tukeyWprob(w, rr, cc) {\n var nleg = 12;\n var ihalf = 6;\n\n var C1 = -30;\n var C2 = -50;\n var C3 = 60;\n var bb = 8;\n var wlar = 3;\n var wincr1 = 2;\n var wincr2 = 3;\n var xleg = [\n 0.981560634246719250690549090149,\n 0.904117256370474856678465866119,\n 0.769902674194304687036893833213,\n 0.587317954286617447296702418941,\n 0.367831498998180193752691536644,\n 0.125233408511468915472441369464\n ];\n var aleg = [\n 0.047175336386511827194615961485,\n 0.106939325995318430960254718194,\n 0.160078328543346226334652529543,\n 0.203167426723065921749064455810,\n 0.233492536538354808760849898925,\n 0.249147045813402785000562436043\n ];\n\n var qsqz = w * 0.5;\n\n // if w >= 16 then the integral lower bound (occurs for c=20)\n // is 0.99999999999995 so return a value of 1.\n\n if (qsqz >= bb)\n return 1.0;\n\n // find (f(w/2) - 1) ^ cc\n // (first term in integral of hartley's form).\n\n var pr_w = 2 * jStat.normal.cdf(qsqz, 0, 1, 1, 0) - 1; // erf(qsqz / M_SQRT2)\n // if pr_w ^ cc < 2e-22 then set pr_w = 0\n if (pr_w >= Math.exp(C2 / cc))\n pr_w = Math.pow(pr_w, cc);\n else\n pr_w = 0.0;\n\n // if w is large then the second component of the\n // integral is small, so fewer intervals are needed.\n\n var wincr;\n if (w > wlar)\n wincr = wincr1;\n else\n wincr = wincr2;\n\n // find the integral of second term of hartley's form\n // for the integral of the range for equal-length\n // intervals using legendre quadrature. limits of\n // integration are from (w/2, 8). two or three\n // equal-length intervals are used.\n\n // blb and bub are lower and upper limits of integration.\n\n var blb = qsqz;\n var binc = (bb - qsqz) / wincr;\n var bub = blb + binc;\n var einsum = 0.0;\n\n // integrate over each interval\n\n var cc1 = cc - 1.0;\n for (var wi = 1; wi <= wincr; wi++) {\n var elsum = 0.0;\n var a = 0.5 * (bub + blb);\n\n // legendre quadrature with order = nleg\n\n var b = 0.5 * (bub - blb);\n\n for (var jj = 1; jj <= nleg; jj++) {\n var j, xx;\n if (ihalf < jj) {\n j = (nleg - jj) + 1;\n xx = xleg[j-1];\n } else {\n j = jj;\n xx = -xleg[j-1];\n }\n var c = b * xx;\n var ac = a + c;\n\n // if exp(-qexpo/2) < 9e-14,\n // then doesn't contribute to integral\n\n var qexpo = ac * ac;\n if (qexpo > C3)\n break;\n\n var pplus = 2 * jStat.normal.cdf(ac, 0, 1, 1, 0);\n var pminus= 2 * jStat.normal.cdf(ac, w, 1, 1, 0);\n\n // if rinsum ^ (cc-1) < 9e-14,\n // then doesn't contribute to integral\n\n var rinsum = (pplus * 0.5) - (pminus * 0.5);\n if (rinsum >= Math.exp(C1 / cc1)) {\n rinsum = (aleg[j-1] * Math.exp(-(0.5 * qexpo))) * Math.pow(rinsum, cc1);\n elsum += rinsum;\n }\n }\n elsum *= (((2.0 * b) * cc) / Math.sqrt(2 * Math.PI));\n einsum += elsum;\n blb = bub;\n bub += binc;\n }\n\n // if pr_w ^ rr < 9e-14, then return 0\n pr_w += einsum;\n if (pr_w <= Math.exp(C1 / rr))\n return 0;\n\n pr_w = Math.pow(pr_w, rr);\n if (pr_w >= 1) // 1 was iMax was eps\n return 1;\n return pr_w;\n}\n\nfunction tukeyQinv(p, c, v) {\n var p0 = 0.322232421088;\n var q0 = 0.993484626060e-01;\n var p1 = -1.0;\n var q1 = 0.588581570495;\n var p2 = -0.342242088547;\n var q2 = 0.531103462366;\n var p3 = -0.204231210125;\n var q3 = 0.103537752850;\n var p4 = -0.453642210148e-04;\n var q4 = 0.38560700634e-02;\n var c1 = 0.8832;\n var c2 = 0.2368;\n var c3 = 1.214;\n var c4 = 1.208;\n var c5 = 1.4142;\n var vmax = 120.0;\n\n var ps = 0.5 - 0.5 * p;\n var yi = Math.sqrt(Math.log(1.0 / (ps * ps)));\n var t = yi + (((( yi * p4 + p3) * yi + p2) * yi + p1) * yi + p0)\n / (((( yi * q4 + q3) * yi + q2) * yi + q1) * yi + q0);\n if (v < vmax) t += (t * t * t + t) / v / 4.0;\n var q = c1 - c2 * t;\n if (v < vmax) q += -c3 / v + c4 * t / v;\n return t * (q * Math.log(c - 1.0) + c5);\n}\n\njStat.extend(jStat.tukey, {\n cdf: function cdf(q, nmeans, df) {\n // Identical implementation as the R ptukey() function as of commit 68947\n var rr = 1;\n var cc = nmeans;\n\n var nlegq = 16;\n var ihalfq = 8;\n\n var eps1 = -30.0;\n var eps2 = 1.0e-14;\n var dhaf = 100.0;\n var dquar = 800.0;\n var deigh = 5000.0;\n var dlarg = 25000.0;\n var ulen1 = 1.0;\n var ulen2 = 0.5;\n var ulen3 = 0.25;\n var ulen4 = 0.125;\n var xlegq = [\n 0.989400934991649932596154173450,\n 0.944575023073232576077988415535,\n 0.865631202387831743880467897712,\n 0.755404408355003033895101194847,\n 0.617876244402643748446671764049,\n 0.458016777657227386342419442984,\n 0.281603550779258913230460501460,\n 0.950125098376374401853193354250e-1\n ];\n var alegq = [\n 0.271524594117540948517805724560e-1,\n 0.622535239386478928628438369944e-1,\n 0.951585116824927848099251076022e-1,\n 0.124628971255533872052476282192,\n 0.149595988816576732081501730547,\n 0.169156519395002538189312079030,\n 0.182603415044923588866763667969,\n 0.189450610455068496285396723208\n ];\n\n if (q <= 0)\n return 0;\n\n // df must be > 1\n // there must be at least two values\n\n if (df < 2 || rr < 1 || cc < 2) return NaN;\n\n if (!Number.isFinite(q))\n return 1;\n\n if (df > dlarg)\n return tukeyWprob(q, rr, cc);\n\n // calculate leading constant\n\n var f2 = df * 0.5;\n var f2lf = ((f2 * Math.log(df)) - (df * Math.log(2))) - jStat.gammaln(f2);\n var f21 = f2 - 1.0;\n\n // integral is divided into unit, half-unit, quarter-unit, or\n // eighth-unit length intervals depending on the value of the\n // degrees of freedom.\n\n var ff4 = df * 0.25;\n var ulen;\n if (df <= dhaf) ulen = ulen1;\n else if (df <= dquar) ulen = ulen2;\n else if (df <= deigh) ulen = ulen3;\n else ulen = ulen4;\n\n f2lf += Math.log(ulen);\n\n // integrate over each subinterval\n\n var ans = 0.0;\n\n for (var i = 1; i <= 50; i++) {\n var otsum = 0.0;\n\n // legendre quadrature with order = nlegq\n // nodes (stored in xlegq) are symmetric around zero.\n\n var twa1 = (2 * i - 1) * ulen;\n\n for (var jj = 1; jj <= nlegq; jj++) {\n var j, t1;\n if (ihalfq < jj) {\n j = jj - ihalfq - 1;\n t1 = (f2lf + (f21 * Math.log(twa1 + (xlegq[j] * ulen))))\n - (((xlegq[j] * ulen) + twa1) * ff4);\n } else {\n j = jj - 1;\n t1 = (f2lf + (f21 * Math.log(twa1 - (xlegq[j] * ulen))))\n + (((xlegq[j] * ulen) - twa1) * ff4);\n }\n\n // if exp(t1) < 9e-14, then doesn't contribute to integral\n var qsqz;\n if (t1 >= eps1) {\n if (ihalfq < jj) {\n qsqz = q * Math.sqrt(((xlegq[j] * ulen) + twa1) * 0.5);\n } else {\n qsqz = q * Math.sqrt(((-(xlegq[j] * ulen)) + twa1) * 0.5);\n }\n\n // call wprob to find integral of range portion\n\n var wprb = tukeyWprob(qsqz, rr, cc);\n var rotsum = (wprb * alegq[j]) * Math.exp(t1);\n otsum += rotsum;\n }\n // end legendre integral for interval i\n // L200:\n }\n\n // if integral for interval i < 1e-14, then stop.\n // However, in order to avoid small area under left tail,\n // at least 1 / ulen intervals are calculated.\n if (i * ulen >= 1.0 && otsum <= eps2)\n break;\n\n // end of interval i\n // L330:\n\n ans += otsum;\n }\n\n if (otsum > eps2) { // not converged\n throw new Error('tukey.cdf failed to converge');\n }\n if (ans > 1)\n ans = 1;\n return ans;\n },\n\n inv: function(p, nmeans, df) {\n // Identical implementation as the R qtukey() function as of commit 68947\n var rr = 1;\n var cc = nmeans;\n\n var eps = 0.0001;\n var maxiter = 50;\n\n // df must be > 1 ; there must be at least two values\n if (df < 2 || rr < 1 || cc < 2) return NaN;\n\n if (p < 0 || p > 1) return NaN;\n if (p === 0) return 0;\n if (p === 1) return Infinity;\n\n // Initial value\n\n var x0 = tukeyQinv(p, cc, df);\n\n // Find prob(value < x0)\n\n var valx0 = jStat.tukey.cdf(x0, nmeans, df) - p;\n\n // Find the second iterate and prob(value < x1).\n // If the first iterate has probability value\n // exceeding p then second iterate is 1 less than\n // first iterate; otherwise it is 1 greater.\n\n var x1;\n if (valx0 > 0.0)\n x1 = Math.max(0.0, x0 - 1.0);\n else\n x1 = x0 + 1.0;\n var valx1 = jStat.tukey.cdf(x1, nmeans, df) - p;\n\n // Find new iterate\n\n var ans;\n for(var iter = 1; iter < maxiter; iter++) {\n ans = x1 - ((valx1 * (x1 - x0)) / (valx1 - valx0));\n valx0 = valx1;\n\n // New iterate must be >= 0\n\n x0 = x1;\n if (ans < 0.0) {\n ans = 0.0;\n valx1 = -p;\n }\n // Find prob(value < new iterate)\n\n valx1 = jStat.tukey.cdf(ans, nmeans, df) - p;\n x1 = ans;\n\n // If the difference between two successive\n // iterates is less than eps, stop\n\n var xabs = Math.abs(x1 - x0);\n if (xabs < eps)\n return ans;\n }\n\n throw new Error('tukey.inv failed to converge');\n }\n});\n\n}(jStat, Math));\n/* Provides functions for the solution of linear system of equations, integration, extrapolation,\n * interpolation, eigenvalue problems, differential equations and PCA analysis. */\n\n(function(jStat, Math) {\n\nvar push = Array.prototype.push;\nvar isArray = jStat.utils.isArray;\n\nfunction isUsable(arg) {\n return isArray(arg) || arg instanceof jStat;\n}\n\njStat.extend({\n\n // add a vector/matrix to a vector/matrix or scalar\n add: function add(arr, arg) {\n // check if arg is a vector or scalar\n if (isUsable(arg)) {\n if (!isUsable(arg[0])) arg = [ arg ];\n return jStat.map(arr, function(value, row, col) {\n return value + arg[row][col];\n });\n }\n return jStat.map(arr, function(value) { return value + arg; });\n },\n\n // subtract a vector or scalar from the vector\n subtract: function subtract(arr, arg) {\n // check if arg is a vector or scalar\n if (isUsable(arg)) {\n if (!isUsable(arg[0])) arg = [ arg ];\n return jStat.map(arr, function(value, row, col) {\n return value - arg[row][col] || 0;\n });\n }\n return jStat.map(arr, function(value) { return value - arg; });\n },\n\n // matrix division\n divide: function divide(arr, arg) {\n if (isUsable(arg)) {\n if (!isUsable(arg[0])) arg = [ arg ];\n return jStat.multiply(arr, jStat.inv(arg));\n }\n return jStat.map(arr, function(value) { return value / arg; });\n },\n\n // matrix multiplication\n multiply: function multiply(arr, arg) {\n var row, col, nrescols, sum, nrow, ncol, res, rescols;\n // eg: arr = 2 arg = 3 -> 6 for res[0][0] statement closure\n if (arr.length === undefined && arg.length === undefined) {\n return arr * arg;\n }\n nrow = arr.length,\n ncol = arr[0].length,\n res = jStat.zeros(nrow, nrescols = (isUsable(arg)) ? arg[0].length : ncol),\n rescols = 0;\n if (isUsable(arg)) {\n for (; rescols < nrescols; rescols++) {\n for (row = 0; row < nrow; row++) {\n sum = 0;\n for (col = 0; col < ncol; col++)\n sum += arr[row][col] * arg[col][rescols];\n res[row][rescols] = sum;\n }\n }\n return (nrow === 1 && rescols === 1) ? res[0][0] : res;\n }\n return jStat.map(arr, function(value) { return value * arg; });\n },\n\n // outer([1,2,3],[4,5,6])\n // ===\n // [[1],[2],[3]] times [[4,5,6]]\n // ->\n // [[4,5,6],[8,10,12],[12,15,18]]\n outer:function outer(A, B) {\n return jStat.multiply(A.map(function(t){ return [t] }), [B]);\n },\n\n\n // Returns the dot product of two matricies\n dot: function dot(arr, arg) {\n if (!isUsable(arr[0])) arr = [ arr ];\n if (!isUsable(arg[0])) arg = [ arg ];\n // convert column to row vector\n var left = (arr[0].length === 1 && arr.length !== 1) ? jStat.transpose(arr) : arr,\n right = (arg[0].length === 1 && arg.length !== 1) ? jStat.transpose(arg) : arg,\n res = [],\n row = 0,\n nrow = left.length,\n ncol = left[0].length,\n sum, col;\n for (; row < nrow; row++) {\n res[row] = [];\n sum = 0;\n for (col = 0; col < ncol; col++)\n sum += left[row][col] * right[row][col];\n res[row] = sum;\n }\n return (res.length === 1) ? res[0] : res;\n },\n\n // raise every element by a scalar\n pow: function pow(arr, arg) {\n return jStat.map(arr, function(value) { return Math.pow(value, arg); });\n },\n\n // exponentiate every element\n exp: function exp(arr) {\n return jStat.map(arr, function(value) { return Math.exp(value); });\n },\n\n // generate the natural log of every element\n log: function exp(arr) {\n return jStat.map(arr, function(value) { return Math.log(value); });\n },\n\n // generate the absolute values of the vector\n abs: function abs(arr) {\n return jStat.map(arr, function(value) { return Math.abs(value); });\n },\n\n // computes the p-norm of the vector\n // In the case that a matrix is passed, uses the first row as the vector\n norm: function norm(arr, p) {\n var nnorm = 0,\n i = 0;\n // check the p-value of the norm, and set for most common case\n if (isNaN(p)) p = 2;\n // check if multi-dimensional array, and make vector correction\n if (isUsable(arr[0])) arr = arr[0];\n // vector norm\n for (; i < arr.length; i++) {\n nnorm += Math.pow(Math.abs(arr[i]), p);\n }\n return Math.pow(nnorm, 1 / p);\n },\n\n // computes the angle between two vectors in rads\n // In case a matrix is passed, this uses the first row as the vector\n angle: function angle(arr, arg) {\n return Math.acos(jStat.dot(arr, arg) / (jStat.norm(arr) * jStat.norm(arg)));\n },\n\n // augment one matrix by another\n // Note: this function returns a matrix, not a jStat object\n aug: function aug(a, b) {\n var newarr = [];\n var i;\n for (i = 0; i < a.length; i++) {\n newarr.push(a[i].slice());\n }\n for (i = 0; i < newarr.length; i++) {\n push.apply(newarr[i], b[i]);\n }\n return newarr;\n },\n\n // The inv() function calculates the inverse of a matrix\n // Create the inverse by augmenting the matrix by the identity matrix of the\n // appropriate size, and then use G-J elimination on the augmented matrix.\n inv: function inv(a) {\n var rows = a.length;\n var cols = a[0].length;\n var b = jStat.identity(rows, cols);\n var c = jStat.gauss_jordan(a, b);\n var result = [];\n var i = 0;\n var j;\n\n //We need to copy the inverse portion to a new matrix to rid G-J artifacts\n for (; i < rows; i++) {\n result[i] = [];\n for (j = cols; j < c[0].length; j++)\n result[i][j - cols] = c[i][j];\n }\n return result;\n },\n\n // calculate the determinant of a matrix\n det: function det(a) {\n var alen = a.length,\n alend = alen * 2,\n vals = new Array(alend),\n rowshift = alen - 1,\n colshift = alend - 1,\n mrow = rowshift - alen + 1,\n mcol = colshift,\n i = 0,\n result = 0,\n j;\n // check for special 2x2 case\n if (alen === 2) {\n return a[0][0] * a[1][1] - a[0][1] * a[1][0];\n }\n for (; i < alend; i++) {\n vals[i] = 1;\n }\n for (i = 0; i < alen; i++) {\n for (j = 0; j < alen; j++) {\n vals[(mrow < 0) ? mrow + alen : mrow ] *= a[i][j];\n vals[(mcol < alen) ? mcol + alen : mcol ] *= a[i][j];\n mrow++;\n mcol--;\n }\n mrow = --rowshift - alen + 1;\n mcol = --colshift;\n }\n for (i = 0; i < alen; i++) {\n result += vals[i];\n }\n for (; i < alend; i++) {\n result -= vals[i];\n }\n return result;\n },\n\n gauss_elimination: function gauss_elimination(a, b) {\n var i = 0,\n j = 0,\n n = a.length,\n m = a[0].length,\n factor = 1,\n sum = 0,\n x = [],\n maug, pivot, temp, k;\n a = jStat.aug(a, b);\n maug = a[0].length;\n for(i = 0; i < n; i++) {\n pivot = a[i][i];\n j = i;\n for (k = i + 1; k < m; k++) {\n if (pivot < Math.abs(a[k][i])) {\n pivot = a[k][i];\n j = k;\n }\n }\n if (j != i) {\n for(k = 0; k < maug; k++) {\n temp = a[i][k];\n a[i][k] = a[j][k];\n a[j][k] = temp;\n }\n }\n for (j = i + 1; j < n; j++) {\n factor = a[j][i] / a[i][i];\n for(k = i; k < maug; k++) {\n a[j][k] = a[j][k] - factor * a[i][k];\n }\n }\n }\n for (i = n - 1; i >= 0; i--) {\n sum = 0;\n for (j = i + 1; j<= n - 1; j++) {\n sum = sum + x[j] * a[i][j];\n }\n x[i] =(a[i][maug - 1] - sum) / a[i][i];\n }\n return x;\n },\n\n gauss_jordan: function gauss_jordan(a, b) {\n var m = jStat.aug(a, b);\n var h = m.length;\n var w = m[0].length;\n var c = 0;\n var x, y, y2;\n // find max pivot\n for (y = 0; y < h; y++) {\n var maxrow = y;\n for (y2 = y+1; y2 < h; y2++) {\n if (Math.abs(m[y2][y]) > Math.abs(m[maxrow][y]))\n maxrow = y2;\n }\n var tmp = m[y];\n m[y] = m[maxrow];\n m[maxrow] = tmp\n for (y2 = y+1; y2 < h; y2++) {\n c = m[y2][y] / m[y][y];\n for (x = y; x < w; x++) {\n m[y2][x] -= m[y][x] * c;\n }\n }\n }\n // backsubstitute\n for (y = h-1; y >= 0; y--) {\n c = m[y][y];\n for (y2 = 0; y2 < y; y2++) {\n for (x = w-1; x > y-1; x--) {\n m[y2][x] -= m[y][x] * m[y2][y] / c;\n }\n }\n m[y][y] /= c;\n for (x = h; x < w; x++) {\n m[y][x] /= c;\n }\n }\n return m;\n },\n\n // solve equation\n // Ax=b\n // A is upper triangular matrix\n // A=[[1,2,3],[0,4,5],[0,6,7]]\n // b=[1,2,3]\n // triaUpSolve(A,b) // -> [2.666,0.1666,1.666]\n // if you use matrix style\n // A=[[1,2,3],[0,4,5],[0,6,7]]\n // b=[[1],[2],[3]]\n // will return [[2.666],[0.1666],[1.666]]\n triaUpSolve: function triaUpSolve(A, b) {\n var size = A[0].length;\n var x = jStat.zeros(1, size)[0];\n var parts;\n var matrix_mode = false;\n\n if (b[0].length != undefined) {\n b = b.map(function(i){ return i[0] });\n matrix_mode = true;\n }\n\n jStat.arange(size - 1, -1, -1).forEach(function(i) {\n parts = jStat.arange(i + 1, size).map(function(j) {\n return x[j] * A[i][j];\n });\n x[i] = (b[i] - jStat.sum(parts)) / A[i][i];\n });\n\n if (matrix_mode)\n return x.map(function(i){ return [i] });\n return x;\n },\n\n triaLowSolve: function triaLowSolve(A, b) {\n // like to triaUpSolve but A is lower triangular matrix\n var size = A[0].length;\n var x = jStat.zeros(1, size)[0];\n var parts;\n\n var matrix_mode=false;\n if (b[0].length != undefined) {\n b = b.map(function(i){ return i[0] });\n matrix_mode = true;\n }\n\n jStat.arange(size).forEach(function(i) {\n parts = jStat.arange(i).map(function(j) {\n return A[i][j] * x[j];\n });\n x[i] = (b[i] - jStat.sum(parts)) / A[i][i];\n })\n\n if (matrix_mode)\n return x.map(function(i){ return [i] });\n return x;\n },\n\n\n // A -> [L,U]\n // A=LU\n // L is lower triangular matrix\n // U is upper triangular matrix\n lu: function lu(A) {\n var size = A.length;\n //var L=jStat.diagonal(jStat.ones(1,size)[0]);\n var L = jStat.identity(size);\n var R = jStat.zeros(A.length, A[0].length);\n var parts;\n jStat.arange(size).forEach(function(t) {\n R[0][t] = A[0][t];\n });\n jStat.arange(1, size).forEach(function(l) {\n jStat.arange(l).forEach(function(i) {\n parts = jStat.arange(i).map(function(jj) {\n return L[l][jj] * R[jj][i];\n });\n L[l][i] = (A[l][i] - jStat.sum(parts)) / R[i][i];\n });\n jStat.arange(l, size).forEach(function(j) {\n parts = jStat.arange(l).map(function(jj) {\n return L[l][jj] * R[jj][j];\n });\n R[l][j] = A[parts.length][j] - jStat.sum(parts);\n });\n });\n return [L, R];\n },\n\n // A -> T\n // A=TT'\n // T is lower triangular matrix\n cholesky: function cholesky(A) {\n var size = A.length;\n var T = jStat.zeros(A.length, A[0].length);\n var parts;\n jStat.arange(size).forEach(function(i) {\n parts = jStat.arange(i).map(function(t) {\n return Math.pow(T[i][t],2);\n });\n T[i][i] = Math.sqrt(A[i][i] - jStat.sum(parts));\n jStat.arange(i + 1, size).forEach(function(j) {\n parts = jStat.arange(i).map(function(t) {\n return T[i][t] * T[j][t];\n });\n T[j][i] = (A[i][j] - jStat.sum(parts)) / T[i][i];\n });\n });\n return T;\n },\n\n\n gauss_jacobi: function gauss_jacobi(a, b, x, r) {\n var i = 0;\n var j = 0;\n var n = a.length;\n var l = [];\n var u = [];\n var d = [];\n var xv, c, h, xk;\n for (; i < n; i++) {\n l[i] = [];\n u[i] = [];\n d[i] = [];\n for (j = 0; j < n; j++) {\n if (i > j) {\n l[i][j] = a[i][j];\n u[i][j] = d[i][j] = 0;\n } else if (i < j) {\n u[i][j] = a[i][j];\n l[i][j] = d[i][j] = 0;\n } else {\n d[i][j] = a[i][j];\n l[i][j] = u[i][j] = 0;\n }\n }\n }\n h = jStat.multiply(jStat.multiply(jStat.inv(d), jStat.add(l, u)), -1);\n c = jStat.multiply(jStat.inv(d), b);\n xv = x;\n xk = jStat.add(jStat.multiply(h, x), c);\n i = 2;\n while (Math.abs(jStat.norm(jStat.subtract(xk,xv))) > r) {\n xv = xk;\n xk = jStat.add(jStat.multiply(h, xv), c);\n i++;\n }\n return xk;\n },\n\n gauss_seidel: function gauss_seidel(a, b, x, r) {\n var i = 0;\n var n = a.length;\n var l = [];\n var u = [];\n var d = [];\n var j, xv, c, h, xk;\n for (; i < n; i++) {\n l[i] = [];\n u[i] = [];\n d[i] = [];\n for (j = 0; j < n; j++) {\n if (i > j) {\n l[i][j] = a[i][j];\n u[i][j] = d[i][j] = 0;\n } else if (i < j) {\n u[i][j] = a[i][j];\n l[i][j] = d[i][j] = 0;\n } else {\n d[i][j] = a[i][j];\n l[i][j] = u[i][j] = 0;\n }\n }\n }\n h = jStat.multiply(jStat.multiply(jStat.inv(jStat.add(d, l)), u), -1);\n c = jStat.multiply(jStat.inv(jStat.add(d, l)), b);\n xv = x;\n xk = jStat.add(jStat.multiply(h, x), c);\n i = 2;\n while (Math.abs(jStat.norm(jStat.subtract(xk, xv))) > r) {\n xv = xk;\n xk = jStat.add(jStat.multiply(h, xv), c);\n i = i + 1;\n }\n return xk;\n },\n\n SOR: function SOR(a, b, x, r, w) {\n var i = 0;\n var n = a.length;\n var l = [];\n var u = [];\n var d = [];\n var j, xv, c, h, xk;\n for (; i < n; i++) {\n l[i] = [];\n u[i] = [];\n d[i] = [];\n for (j = 0; j < n; j++) {\n if (i > j) {\n l[i][j] = a[i][j];\n u[i][j] = d[i][j] = 0;\n } else if (i < j) {\n u[i][j] = a[i][j];\n l[i][j] = d[i][j] = 0;\n } else {\n d[i][j] = a[i][j];\n l[i][j] = u[i][j] = 0;\n }\n }\n }\n h = jStat.multiply(jStat.inv(jStat.add(d, jStat.multiply(l, w))),\n jStat.subtract(jStat.multiply(d, 1 - w),\n jStat.multiply(u, w)));\n c = jStat.multiply(jStat.multiply(jStat.inv(jStat.add(d,\n jStat.multiply(l, w))), b), w);\n xv = x;\n xk = jStat.add(jStat.multiply(h, x), c);\n i = 2;\n while (Math.abs(jStat.norm(jStat.subtract(xk, xv))) > r) {\n xv = xk;\n xk = jStat.add(jStat.multiply(h, xv), c);\n i++;\n }\n return xk;\n },\n\n householder: function householder(a) {\n var m = a.length;\n var n = a[0].length;\n var i = 0;\n var w = [];\n var p = [];\n var alpha, r, k, j, factor;\n for (; i < m - 1; i++) {\n alpha = 0;\n for (j = i + 1; j < n; j++)\n alpha += (a[j][i] * a[j][i]);\n factor = (a[i + 1][i] > 0) ? -1 : 1;\n alpha = factor * Math.sqrt(alpha);\n r = Math.sqrt((((alpha * alpha) - a[i + 1][i] * alpha) / 2));\n w = jStat.zeros(m, 1);\n w[i + 1][0] = (a[i + 1][i] - alpha) / (2 * r);\n for (k = i + 2; k < m; k++) w[k][0] = a[k][i] / (2 * r);\n p = jStat.subtract(jStat.identity(m, n),\n jStat.multiply(jStat.multiply(w, jStat.transpose(w)), 2));\n a = jStat.multiply(p, jStat.multiply(a, p));\n }\n return a;\n },\n\n // A -> [Q,R]\n // Q is orthogonal matrix\n // R is upper triangular\n QR: (function() {\n // x -> Q\n // find a orthogonal matrix Q st.\n // Qx=y\n // y is [||x||,0,0,...]\n\n // quick ref\n var sum = jStat.sum;\n var range = jStat.arange;\n\n function qr2(x) {\n // quick impletation\n // https://www.stat.wisc.edu/~larget/math496/qr.html\n\n var n = x.length;\n var p = x[0].length;\n\n var r = jStat.zeros(p, p);\n x = jStat.copy(x);\n\n var i,j,k;\n for(j = 0; j < p; j++){\n r[j][j] = Math.sqrt(sum(range(n).map(function(i){\n return x[i][j] * x[i][j];\n })));\n for(i = 0; i < n; i++){\n x[i][j] = x[i][j] / r[j][j];\n }\n for(k = j+1; k < p; k++){\n r[j][k] = sum(range(n).map(function(i){\n return x[i][j] * x[i][k];\n }));\n for(i = 0; i < n; i++){\n x[i][k] = x[i][k] - x[i][j]*r[j][k];\n }\n }\n }\n return [x, r];\n }\n\n return qr2;\n }()),\n\n lstsq: (function() {\n // solve least squard problem for Ax=b as QR decomposition way if b is\n // [[b1],[b2],[b3]] form will return [[x1],[x2],[x3]] array form solution\n // else b is [b1,b2,b3] form will return [x1,x2,x3] array form solution\n function R_I(A) {\n A = jStat.copy(A);\n var size = A.length;\n var I = jStat.identity(size);\n jStat.arange(size - 1, -1, -1).forEach(function(i) {\n jStat.sliceAssign(\n I, { row: i }, jStat.divide(jStat.slice(I, { row: i }), A[i][i]));\n jStat.sliceAssign(\n A, { row: i }, jStat.divide(jStat.slice(A, { row: i }), A[i][i]));\n jStat.arange(i).forEach(function(j) {\n var c = jStat.multiply(A[j][i], -1);\n var Aj = jStat.slice(A, { row: j });\n var cAi = jStat.multiply(jStat.slice(A, { row: i }), c);\n jStat.sliceAssign(A, { row: j }, jStat.add(Aj, cAi));\n var Ij = jStat.slice(I, { row: j });\n var cIi = jStat.multiply(jStat.slice(I, { row: i }), c);\n jStat.sliceAssign(I, { row: j }, jStat.add(Ij, cIi));\n })\n });\n return I;\n }\n\n function qr_solve(A, b){\n var array_mode = false;\n if (b[0].length === undefined) {\n // [c1,c2,c3] mode\n b = b.map(function(x){ return [x] });\n array_mode = true;\n }\n var QR = jStat.QR(A);\n var Q = QR[0];\n var R = QR[1];\n var attrs = A[0].length;\n var Q1 = jStat.slice(Q,{col:{end:attrs}});\n var R1 = jStat.slice(R,{row:{end:attrs}});\n var RI = R_I(R1);\n var Q2 = jStat.transpose(Q1);\n\n if(Q2[0].length === undefined){\n Q2 = [Q2]; // The confusing jStat.multifly implementation threat nature process again.\n }\n\n var x = jStat.multiply(jStat.multiply(RI, Q2), b);\n\n if(x.length === undefined){\n x = [[x]]; // The confusing jStat.multifly implementation threat nature process again.\n }\n\n\n if (array_mode)\n return x.map(function(i){ return i[0] });\n return x;\n }\n\n return qr_solve;\n }()),\n\n jacobi: function jacobi(a) {\n var condition = 1;\n var n = a.length;\n var e = jStat.identity(n, n);\n var ev = [];\n var b, i, j, p, q, maxim, theta, s;\n // condition === 1 only if tolerance is not reached\n while (condition === 1) {\n maxim = a[0][1];\n p = 0;\n q = 1;\n for (i = 0; i < n; i++) {\n for (j = 0; j < n; j++) {\n if (i != j) {\n if (maxim < Math.abs(a[i][j])) {\n maxim = Math.abs(a[i][j]);\n p = i;\n q = j;\n }\n }\n }\n }\n if (a[p][p] === a[q][q])\n theta = (a[p][q] > 0) ? Math.PI / 4 : -Math.PI / 4;\n else\n theta = Math.atan(2 * a[p][q] / (a[p][p] - a[q][q])) / 2;\n s = jStat.identity(n, n);\n s[p][p] = Math.cos(theta);\n s[p][q] = -Math.sin(theta);\n s[q][p] = Math.sin(theta);\n s[q][q] = Math.cos(theta);\n // eigen vector matrix\n e = jStat.multiply(e, s);\n b = jStat.multiply(jStat.multiply(jStat.inv(s), a), s);\n a = b;\n condition = 0;\n for (i = 1; i < n; i++) {\n for (j = 1; j < n; j++) {\n if (i != j && Math.abs(a[i][j]) > 0.001) {\n condition = 1;\n }\n }\n }\n }\n for (i = 0; i < n; i++) ev.push(a[i][i]);\n //returns both the eigenvalue and eigenmatrix\n return [e, ev];\n },\n\n rungekutta: function rungekutta(f, h, p, t_j, u_j, order) {\n var k1, k2, u_j1, k3, k4;\n if (order === 2) {\n while (t_j <= p) {\n k1 = h * f(t_j, u_j);\n k2 = h * f(t_j + h, u_j + k1);\n u_j1 = u_j + (k1 + k2) / 2;\n u_j = u_j1;\n t_j = t_j + h;\n }\n }\n if (order === 4) {\n while (t_j <= p) {\n k1 = h * f(t_j, u_j);\n k2 = h * f(t_j + h / 2, u_j + k1 / 2);\n k3 = h * f(t_j + h / 2, u_j + k2 / 2);\n k4 = h * f(t_j +h, u_j + k3);\n u_j1 = u_j + (k1 + 2 * k2 + 2 * k3 + k4) / 6;\n u_j = u_j1;\n t_j = t_j + h;\n }\n }\n return u_j;\n },\n\n romberg: function romberg(f, a, b, order) {\n var i = 0;\n var h = (b - a) / 2;\n var x = [];\n var h1 = [];\n var g = [];\n var m, a1, j, k, I;\n while (i < order / 2) {\n I = f(a);\n for (j = a, k = 0; j <= b; j = j + h, k++) x[k] = j;\n m = x.length;\n for (j = 1; j < m - 1; j++) {\n I += (((j % 2) !== 0) ? 4 : 2) * f(x[j]);\n }\n I = (h / 3) * (I + f(b));\n g[i] = I;\n h /= 2;\n i++;\n }\n a1 = g.length;\n m = 1;\n while (a1 !== 1) {\n for (j = 0; j < a1 - 1; j++)\n h1[j] = ((Math.pow(4, m)) * g[j + 1] - g[j]) / (Math.pow(4, m) - 1);\n a1 = h1.length;\n g = h1;\n h1 = [];\n m++;\n }\n return g;\n },\n\n richardson: function richardson(X, f, x, h) {\n function pos(X, x) {\n var i = 0;\n var n = X.length;\n var p;\n for (; i < n; i++)\n if (X[i] === x) p = i;\n return p;\n }\n var h_min = Math.abs(x - X[pos(X, x) + 1]);\n var i = 0;\n var g = [];\n var h1 = [];\n var y1, y2, m, a, j;\n while (h >= h_min) {\n y1 = pos(X, x + h);\n y2 = pos(X, x);\n g[i] = (f[y1] - 2 * f[y2] + f[2 * y2 - y1]) / (h * h);\n h /= 2;\n i++;\n }\n a = g.length;\n m = 1;\n while (a != 1) {\n for (j = 0; j < a - 1; j++)\n h1[j] = ((Math.pow(4, m)) * g[j + 1] - g[j]) / (Math.pow(4, m) - 1);\n a = h1.length;\n g = h1;\n h1 = [];\n m++;\n }\n return g;\n },\n\n simpson: function simpson(f, a, b, n) {\n var h = (b - a) / n;\n var I = f(a);\n var x = [];\n var j = a;\n var k = 0;\n var i = 1;\n var m;\n for (; j <= b; j = j + h, k++)\n x[k] = j;\n m = x.length;\n for (; i < m - 1; i++) {\n I += ((i % 2 !== 0) ? 4 : 2) * f(x[i]);\n }\n return (h / 3) * (I + f(b));\n },\n\n hermite: function hermite(X, F, dF, value) {\n var n = X.length;\n var p = 0;\n var i = 0;\n var l = [];\n var dl = [];\n var A = [];\n var B = [];\n var j;\n for (; i < n; i++) {\n l[i] = 1;\n for (j = 0; j < n; j++) {\n if (i != j) l[i] *= (value - X[j]) / (X[i] - X[j]);\n }\n dl[i] = 0;\n for (j = 0; j < n; j++) {\n if (i != j) dl[i] += 1 / (X [i] - X[j]);\n }\n A[i] = (1 - 2 * (value - X[i]) * dl[i]) * (l[i] * l[i]);\n B[i] = (value - X[i]) * (l[i] * l[i]);\n p += (A[i] * F[i] + B[i] * dF[i]);\n }\n return p;\n },\n\n lagrange: function lagrange(X, F, value) {\n var p = 0;\n var i = 0;\n var j, l;\n var n = X.length;\n for (; i < n; i++) {\n l = F[i];\n for (j = 0; j < n; j++) {\n // calculating the lagrange polynomial L_i\n if (i != j) l *= (value - X[j]) / (X[i] - X[j]);\n }\n // adding the lagrange polynomials found above\n p += l;\n }\n return p;\n },\n\n cubic_spline: function cubic_spline(X, F, value) {\n var n = X.length;\n var i = 0, j;\n var A = [];\n var B = [];\n var alpha = [];\n var c = [];\n var h = [];\n var b = [];\n var d = [];\n for (; i < n - 1; i++)\n h[i] = X[i + 1] - X[i];\n alpha[0] = 0;\n for (i = 1; i < n - 1; i++) {\n alpha[i] = (3 / h[i]) * (F[i + 1] - F[i]) -\n (3 / h[i-1]) * (F[i] - F[i-1]);\n }\n for (i = 1; i < n - 1; i++) {\n A[i] = [];\n B[i] = [];\n A[i][i-1] = h[i-1];\n A[i][i] = 2 * (h[i - 1] + h[i]);\n A[i][i+1] = h[i];\n B[i][0] = alpha[i];\n }\n c = jStat.multiply(jStat.inv(A), B);\n for (j = 0; j < n - 1; j++) {\n b[j] = (F[j + 1] - F[j]) / h[j] - h[j] * (c[j + 1][0] + 2 * c[j][0]) / 3;\n d[j] = (c[j + 1][0] - c[j][0]) / (3 * h[j]);\n }\n for (j = 0; j < n; j++) {\n if (X[j] > value) break;\n }\n j -= 1;\n return F[j] + (value - X[j]) * b[j] + jStat.sq(value-X[j]) *\n c[j] + (value - X[j]) * jStat.sq(value - X[j]) * d[j];\n },\n\n gauss_quadrature: function gauss_quadrature() {\n throw new Error('gauss_quadrature not yet implemented');\n },\n\n PCA: function PCA(X) {\n var m = X.length;\n var n = X[0].length;\n var i = 0;\n var j, temp1;\n var u = [];\n var D = [];\n var result = [];\n var temp2 = [];\n var Y = [];\n var Bt = [];\n var B = [];\n var C = [];\n var V = [];\n var Vt = [];\n for (i = 0; i < m; i++) {\n u[i] = jStat.sum(X[i]) / n;\n }\n for (i = 0; i < n; i++) {\n B[i] = [];\n for(j = 0; j < m; j++) {\n B[i][j] = X[j][i] - u[j];\n }\n }\n B = jStat.transpose(B);\n for (i = 0; i < m; i++) {\n C[i] = [];\n for (j = 0; j < m; j++) {\n C[i][j] = (jStat.dot([B[i]], [B[j]])) / (n - 1);\n }\n }\n result = jStat.jacobi(C);\n V = result[0];\n D = result[1];\n Vt = jStat.transpose(V);\n for (i = 0; i < D.length; i++) {\n for (j = i; j < D.length; j++) {\n if(D[i] < D[j]) {\n temp1 = D[i];\n D[i] = D[j];\n D[j] = temp1;\n temp2 = Vt[i];\n Vt[i] = Vt[j];\n Vt[j] = temp2;\n }\n }\n }\n Bt = jStat.transpose(B);\n for (i = 0; i < m; i++) {\n Y[i] = [];\n for (j = 0; j < Bt.length; j++) {\n Y[i][j] = jStat.dot([Vt[i]], [Bt[j]]);\n }\n }\n return [X, D, Vt, Y];\n }\n});\n\n// extend jStat.fn with methods that require one argument\n(function(funcs) {\n for (var i = 0; i < funcs.length; i++) (function(passfunc) {\n jStat.fn[passfunc] = function(arg, func) {\n var tmpthis = this;\n // check for callback\n if (func) {\n setTimeout(function() {\n func.call(tmpthis, jStat.fn[passfunc].call(tmpthis, arg));\n }, 15);\n return this;\n }\n if (typeof jStat[passfunc](this, arg) === 'number')\n return jStat[passfunc](this, arg);\n else\n return jStat(jStat[passfunc](this, arg));\n };\n }(funcs[i]));\n}('add divide multiply subtract dot pow exp log abs norm angle'.split(' ')));\n\n}(jStat, Math));\n(function(jStat, Math) {\n\nvar slice = [].slice;\nvar isNumber = jStat.utils.isNumber;\nvar isArray = jStat.utils.isArray;\n\n// flag==true denotes use of sample standard deviation\n// Z Statistics\njStat.extend({\n // 2 different parameter lists:\n // (value, mean, sd)\n // (value, array, flag)\n zscore: function zscore() {\n var args = slice.call(arguments);\n if (isNumber(args[1])) {\n return (args[0] - args[1]) / args[2];\n }\n return (args[0] - jStat.mean(args[1])) / jStat.stdev(args[1], args[2]);\n },\n\n // 3 different paramter lists:\n // (value, mean, sd, sides)\n // (zscore, sides)\n // (value, array, sides, flag)\n ztest: function ztest() {\n var args = slice.call(arguments);\n var z;\n if (isArray(args[1])) {\n // (value, array, sides, flag)\n z = jStat.zscore(args[0],args[1],args[3]);\n return (args[2] === 1) ?\n (jStat.normal.cdf(-Math.abs(z), 0, 1)) :\n (jStat.normal.cdf(-Math.abs(z), 0, 1)*2);\n } else {\n if (args.length > 2) {\n // (value, mean, sd, sides)\n z = jStat.zscore(args[0],args[1],args[2]);\n return (args[3] === 1) ?\n (jStat.normal.cdf(-Math.abs(z),0,1)) :\n (jStat.normal.cdf(-Math.abs(z),0,1)* 2);\n } else {\n // (zscore, sides)\n z = args[0];\n return (args[1] === 1) ?\n (jStat.normal.cdf(-Math.abs(z),0,1)) :\n (jStat.normal.cdf(-Math.abs(z),0,1)*2);\n }\n }\n }\n});\n\njStat.extend(jStat.fn, {\n zscore: function zscore(value, flag) {\n return (value - this.mean()) / this.stdev(flag);\n },\n\n ztest: function ztest(value, sides, flag) {\n var zscore = Math.abs(this.zscore(value, flag));\n return (sides === 1) ?\n (jStat.normal.cdf(-zscore, 0, 1)) :\n (jStat.normal.cdf(-zscore, 0, 1) * 2);\n }\n});\n\n// T Statistics\njStat.extend({\n // 2 parameter lists\n // (value, mean, sd, n)\n // (value, array)\n tscore: function tscore() {\n var args = slice.call(arguments);\n return (args.length === 4) ?\n ((args[0] - args[1]) / (args[2] / Math.sqrt(args[3]))) :\n ((args[0] - jStat.mean(args[1])) /\n (jStat.stdev(args[1], true) / Math.sqrt(args[1].length)));\n },\n\n // 3 different paramter lists:\n // (value, mean, sd, n, sides)\n // (tscore, n, sides)\n // (value, array, sides)\n ttest: function ttest() {\n var args = slice.call(arguments);\n var tscore;\n if (args.length === 5) {\n tscore = Math.abs(jStat.tscore(args[0], args[1], args[2], args[3]));\n return (args[4] === 1) ?\n (jStat.studentt.cdf(-tscore, args[3]-1)) :\n (jStat.studentt.cdf(-tscore, args[3]-1)*2);\n }\n if (isNumber(args[1])) {\n tscore = Math.abs(args[0])\n return (args[2] == 1) ?\n (jStat.studentt.cdf(-tscore, args[1]-1)) :\n (jStat.studentt.cdf(-tscore, args[1]-1) * 2);\n }\n tscore = Math.abs(jStat.tscore(args[0], args[1]))\n return (args[2] == 1) ?\n (jStat.studentt.cdf(-tscore, args[1].length-1)) :\n (jStat.studentt.cdf(-tscore, args[1].length-1) * 2);\n }\n});\n\njStat.extend(jStat.fn, {\n tscore: function tscore(value) {\n return (value - this.mean()) / (this.stdev(true) / Math.sqrt(this.cols()));\n },\n\n ttest: function ttest(value, sides) {\n return (sides === 1) ?\n (1 - jStat.studentt.cdf(Math.abs(this.tscore(value)), this.cols()-1)) :\n (jStat.studentt.cdf(-Math.abs(this.tscore(value)), this.cols()-1)*2);\n }\n});\n\n// F Statistics\njStat.extend({\n // Paramter list is as follows:\n // (array1, array2, array3, ...)\n // or it is an array of arrays\n // array of arrays conversion\n anovafscore: function anovafscore() {\n var args = slice.call(arguments),\n expVar, sample, sampMean, sampSampMean, tmpargs, unexpVar, i, j;\n if (args.length === 1) {\n tmpargs = new Array(args[0].length);\n for (i = 0; i < args[0].length; i++) {\n tmpargs[i] = args[0][i];\n }\n args = tmpargs;\n }\n // Builds sample array\n sample = new Array();\n for (i = 0; i < args.length; i++) {\n sample = sample.concat(args[i]);\n }\n sampMean = jStat.mean(sample);\n // Computes the explained variance\n expVar = 0;\n for (i = 0; i < args.length; i++) {\n expVar = expVar + args[i].length * Math.pow(jStat.mean(args[i]) - sampMean, 2);\n }\n expVar /= (args.length - 1);\n // Computes unexplained variance\n unexpVar = 0;\n for (i = 0; i < args.length; i++) {\n sampSampMean = jStat.mean(args[i]);\n for (j = 0; j < args[i].length; j++) {\n unexpVar += Math.pow(args[i][j] - sampSampMean, 2);\n }\n }\n unexpVar /= (sample.length - args.length);\n return expVar / unexpVar;\n },\n\n // 2 different paramter setups\n // (array1, array2, array3, ...)\n // (anovafscore, df1, df2)\n anovaftest: function anovaftest() {\n var args = slice.call(arguments),\n df1, df2, n, i;\n if (isNumber(args[0])) {\n return 1 - jStat.centralF.cdf(args[0], args[1], args[2]);\n }\n var anovafscore = jStat.anovafscore(args);\n df1 = args.length - 1;\n n = 0;\n for (i = 0; i < args.length; i++) {\n n = n + args[i].length;\n }\n df2 = n - df1 - 1;\n return 1 - jStat.centralF.cdf(anovafscore, df1, df2);\n },\n\n ftest: function ftest(fscore, df1, df2) {\n return 1 - jStat.centralF.cdf(fscore, df1, df2);\n }\n});\n\njStat.extend(jStat.fn, {\n anovafscore: function anovafscore() {\n return jStat.anovafscore(this.toArray());\n },\n\n anovaftes: function anovaftes() {\n var n = 0;\n var i;\n for (i = 0; i < this.length; i++) {\n n = n + this[i].length;\n }\n return jStat.ftest(this.anovafscore(), this.length - 1, n - this.length);\n }\n});\n\n// Tukey's range test\njStat.extend({\n // 2 parameter lists\n // (mean1, mean2, n1, n2, sd)\n // (array1, array2, sd)\n qscore: function qscore() {\n var args = slice.call(arguments);\n var mean1, mean2, n1, n2, sd;\n if (isNumber(args[0])) {\n mean1 = args[0];\n mean2 = args[1];\n n1 = args[2];\n n2 = args[3];\n sd = args[4];\n } else {\n mean1 = jStat.mean(args[0]);\n mean2 = jStat.mean(args[1]);\n n1 = args[0].length;\n n2 = args[1].length;\n sd = args[2];\n }\n return Math.abs(mean1 - mean2) / (sd * Math.sqrt((1 / n1 + 1 / n2) / 2));\n },\n\n // 3 different parameter lists:\n // (qscore, n, k)\n // (mean1, mean2, n1, n2, sd, n, k)\n // (array1, array2, sd, n, k)\n qtest: function qtest() {\n var args = slice.call(arguments);\n\n var qscore;\n if (args.length === 3) {\n qscore = args[0];\n args = args.slice(1);\n } else if (args.length === 7) {\n qscore = jStat.qscore(args[0], args[1], args[2], args[3], args[4]);\n args = args.slice(5);\n } else {\n qscore = jStat.qscore(args[0], args[1], args[2]);\n args = args.slice(3);\n }\n\n var n = args[0];\n var k = args[1];\n\n return 1 - jStat.tukey.cdf(qscore, k, n - k);\n },\n\n tukeyhsd: function tukeyhsd(arrays) {\n var sd = jStat.pooledstdev(arrays);\n var means = arrays.map(function (arr) {return jStat.mean(arr);});\n var n = arrays.reduce(function (n, arr) {return n + arr.length;}, 0);\n\n var results = [];\n for (var i = 0; i < arrays.length; ++i) {\n for (var j = i + 1; j < arrays.length; ++j) {\n var p = jStat.qtest(means[i], means[j], arrays[i].length, arrays[j].length, sd, n, arrays.length);\n results.push([[i, j], p]);\n }\n }\n\n return results;\n }\n});\n\n// Error Bounds\njStat.extend({\n // 2 different parameter setups\n // (value, alpha, sd, n)\n // (value, alpha, array)\n normalci: function normalci() {\n var args = slice.call(arguments),\n ans = new Array(2),\n change;\n if (args.length === 4) {\n change = Math.abs(jStat.normal.inv(args[1] / 2, 0, 1) *\n args[2] / Math.sqrt(args[3]));\n } else {\n change = Math.abs(jStat.normal.inv(args[1] / 2, 0, 1) *\n jStat.stdev(args[2]) / Math.sqrt(args[2].length));\n }\n ans[0] = args[0] - change;\n ans[1] = args[0] + change;\n return ans;\n },\n\n // 2 different parameter setups\n // (value, alpha, sd, n)\n // (value, alpha, array)\n tci: function tci() {\n var args = slice.call(arguments),\n ans = new Array(2),\n change;\n if (args.length === 4) {\n change = Math.abs(jStat.studentt.inv(args[1] / 2, args[3] - 1) *\n args[2] / Math.sqrt(args[3]));\n } else {\n change = Math.abs(jStat.studentt.inv(args[1] / 2, args[2].length - 1) *\n jStat.stdev(args[2], true) / Math.sqrt(args[2].length));\n }\n ans[0] = args[0] - change;\n ans[1] = args[0] + change;\n return ans;\n },\n\n significant: function significant(pvalue, alpha) {\n return pvalue < alpha;\n }\n});\n\njStat.extend(jStat.fn, {\n normalci: function normalci(value, alpha) {\n return jStat.normalci(value, alpha, this.toArray());\n },\n\n tci: function tci(value, alpha) {\n return jStat.tci(value, alpha, this.toArray());\n }\n});\n\n// internal method for calculating the z-score for a difference of proportions test\nfunction differenceOfProportions(p1, n1, p2, n2) {\n if (p1 > 1 || p2 > 1 || p1 <= 0 || p2 <= 0) {\n throw new Error(\"Proportions should be greater than 0 and less than 1\")\n }\n var pooled = (p1 * n1 + p2 * n2) / (n1 + n2);\n var se = Math.sqrt(pooled * (1 - pooled) * ((1/n1) + (1/n2)));\n return (p1 - p2) / se;\n}\n\n// Difference of Proportions\njStat.extend(jStat.fn, {\n oneSidedDifferenceOfProportions: function oneSidedDifferenceOfProportions(p1, n1, p2, n2) {\n var z = differenceOfProportions(p1, n1, p2, n2);\n return jStat.ztest(z, 1);\n },\n\n twoSidedDifferenceOfProportions: function twoSidedDifferenceOfProportions(p1, n1, p2, n2) {\n var z = differenceOfProportions(p1, n1, p2, n2);\n return jStat.ztest(z, 2);\n }\n});\n\n}(jStat, Math));\njStat.models = (function(){\n function sub_regress(exog) {\n var var_count = exog[0].length;\n var modelList = jStat.arange(var_count).map(function(endog_index) {\n var exog_index =\n jStat.arange(var_count).filter(function(i){return i!==endog_index});\n return ols(jStat.col(exog, endog_index).map(function(x){ return x[0] }),\n jStat.col(exog, exog_index))\n });\n return modelList;\n }\n\n // do OLS model regress\n // exog have include const columns ,it will not generate it .In fact, exog is\n // \"design matrix\" look at\n //https://en.wikipedia.org/wiki/Design_matrix\n function ols(endog, exog) {\n var nobs = endog.length;\n var df_model = exog[0].length - 1;\n var df_resid = nobs-df_model - 1;\n var coef = jStat.lstsq(exog, endog);\n var predict =\n jStat.multiply(exog, coef.map(function(x) { return [x] }))\n .map(function(p) { return p[0] });\n var resid = jStat.subtract(endog, predict);\n var ybar = jStat.mean(endog);\n // constant cause problem\n // var SST = jStat.sum(endog.map(function(y) {\n // return Math.pow(y-ybar,2);\n // }));\n var SSE = jStat.sum(predict.map(function(f) {\n return Math.pow(f - ybar, 2);\n }));\n var SSR = jStat.sum(endog.map(function(y, i) {\n return Math.pow(y - predict[i], 2);\n }));\n var SST = SSE + SSR;\n var R2 = (SSE / SST);\n return {\n exog:exog,\n endog:endog,\n nobs:nobs,\n df_model:df_model,\n df_resid:df_resid,\n coef:coef,\n predict:predict,\n resid:resid,\n ybar:ybar,\n SST:SST,\n SSE:SSE,\n SSR:SSR,\n R2:R2\n };\n }\n\n // H0: b_I=0\n // H1: b_I!=0\n function t_test(model) {\n var subModelList = sub_regress(model.exog);\n //var sigmaHat=jStat.stdev(model.resid);\n var sigmaHat = Math.sqrt(model.SSR / (model.df_resid));\n var seBetaHat = subModelList.map(function(mod) {\n var SST = mod.SST;\n var R2 = mod.R2;\n return sigmaHat / Math.sqrt(SST * (1 - R2));\n });\n var tStatistic = model.coef.map(function(coef, i) {\n return (coef - 0) / seBetaHat[i];\n });\n var pValue = tStatistic.map(function(t) {\n var leftppf = jStat.studentt.cdf(t, model.df_resid);\n return (leftppf > 0.5 ? 1 - leftppf : leftppf) * 2;\n });\n var c = jStat.studentt.inv(0.975, model.df_resid);\n var interval95 = model.coef.map(function(coef, i) {\n var d = c * seBetaHat[i];\n return [coef - d, coef + d];\n })\n return {\n se: seBetaHat,\n t: tStatistic,\n p: pValue,\n sigmaHat: sigmaHat,\n interval95: interval95\n };\n }\n\n function F_test(model) {\n var F_statistic =\n (model.R2 / model.df_model) / ((1 - model.R2) / model.df_resid);\n var fcdf = function(x, n1, n2) {\n return jStat.beta.cdf(x / (n2 / n1 + x), n1 / 2, n2 / 2)\n }\n var pvalue = 1 - fcdf(F_statistic, model.df_model, model.df_resid);\n return { F_statistic: F_statistic, pvalue: pvalue };\n }\n\n function ols_wrap(endog, exog) {\n var model = ols(endog,exog);\n var ttest = t_test(model);\n var ftest = F_test(model);\n // Provide the Wherry / Ezekiel / McNemar / Cohen Adjusted R^2\n // Which matches the 'adjusted R^2' provided by R's lm package\n var adjust_R2 =\n 1 - (1 - model.R2) * ((model.nobs - 1) / (model.df_resid));\n model.t = ttest;\n model.f = ftest;\n model.adjust_R2 = adjust_R2;\n return model;\n }\n\n return { ols: ols_wrap };\n})();\n//To regress, simply build X matrix\n//(append column of 1's) using\n//buildxmatrix and build the Y\n//matrix using buildymatrix\n//(simply the transpose)\n//and run regress.\n\n\n\n//Regressions\n\njStat.extend({\n buildxmatrix: function buildxmatrix(){\n //Parameters will be passed in as such\n //(array1,array2,array3,...)\n //as (x1,x2,x3,...)\n //needs to be (1,x1,x2,x3,...)\n var matrixRows = new Array(arguments.length);\n for(var i=0;i1){\n result = [];\n for (i = 0; i < A.rows(); i++) {\n result[i] = [];\n for (j = 0; j < B.cols(); j++) {\n sum = 0;\n for (k = 0; k < A.cols(); k++) {\n sum += A.toArray()[i][k] * B.toArray()[k][j];\n }\n result[i][j] = sum;\n }\n }\n return jStat(result);\n }\n result = [];\n for (i = 0; i < A.rows(); i++) {\n result[i] = [];\n for (j = 0; j < B.cols(); j++) {\n sum = 0;\n for (k = 0; k < A.cols(); k++) {\n sum += A.toArray()[i][k] * B.toArray()[j];\n }\n result[i][j] = sum;\n }\n }\n return jStat(result);\n }\n },\n\n //regress and regresst to be fixed\n\n regress: function regress(jMatX,jMatY){\n //print(\"regressin!\");\n //print(jMatX.toArray());\n var innerinv = jStat.xtranspxinv(jMatX);\n //print(innerinv);\n var xtransp = jMatX.transpose();\n var next = jStat.matrixmult(jStat(innerinv),xtransp);\n return jStat.matrixmult(next,jMatY);\n\n },\n\n regresst: function regresst(jMatX,jMatY,sides){\n var beta = jStat.regress(jMatX,jMatY);\n\n var compile = {};\n compile.anova = {};\n var jMatYBar = jStat.jMatYBar(jMatX, beta);\n compile.yBar = jMatYBar;\n var yAverage = jMatY.mean();\n compile.anova.residuals = jStat.residuals(jMatY, jMatYBar);\n\n compile.anova.ssr = jStat.ssr(jMatYBar, yAverage);\n compile.anova.msr = compile.anova.ssr / (jMatX[0].length - 1);\n\n compile.anova.sse = jStat.sse(jMatY, jMatYBar);\n compile.anova.mse =\n compile.anova.sse / (jMatY.length - (jMatX[0].length - 1) - 1);\n\n compile.anova.sst = jStat.sst(jMatY, yAverage);\n compile.anova.mst = compile.anova.sst / (jMatY.length - 1);\n\n compile.anova.r2 = 1 - (compile.anova.sse / compile.anova.sst);\n if (compile.anova.r2 < 0) compile.anova.r2 = 0;\n\n compile.anova.fratio = compile.anova.msr / compile.anova.mse;\n compile.anova.pvalue =\n jStat.anovaftest(compile.anova.fratio,\n jMatX[0].length - 1,\n jMatY.length - (jMatX[0].length - 1) - 1);\n\n compile.anova.rmse = Math.sqrt(compile.anova.mse);\n\n compile.anova.r2adj = 1 - (compile.anova.mse / compile.anova.mst);\n if (compile.anova.r2adj < 0) compile.anova.r2adj = 0;\n\n compile.stats = new Array(jMatX[0].length);\n var covar = jStat.xtranspxinv(jMatX);\n var sds, ts, ps;\n\n for(var i=0; i {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","function none() {}\n\nexport default function(selector) {\n return selector == null ? none : function() {\n return this.querySelector(selector);\n };\n}\n","function empty() {\n return [];\n}\n\nexport default function(selector) {\n return selector == null ? empty : function() {\n return this.querySelectorAll(selector);\n };\n}\n","export default function(selector) {\n return function() {\n return this.matches(selector);\n };\n}\n\nexport function childMatcher(selector) {\n return function(node) {\n return node.matches(selector);\n };\n}\n\n","import {childMatcher} from \"../matcher.js\";\n\nvar find = Array.prototype.find;\n\nfunction childFind(match) {\n return function() {\n return find.call(this.children, match);\n };\n}\n\nfunction childFirst() {\n return this.firstElementChild;\n}\n\nexport default function(match) {\n return this.select(match == null ? childFirst\n : childFind(typeof match === \"function\" ? match : childMatcher(match)));\n}\n","import {childMatcher} from \"../matcher.js\";\n\nvar filter = Array.prototype.filter;\n\nfunction children() {\n return Array.from(this.children);\n}\n\nfunction childrenFilter(match) {\n return function() {\n return filter.call(this.children, match);\n };\n}\n\nexport default function(match) {\n return this.selectAll(match == null ? children\n : childrenFilter(typeof match === \"function\" ? match : childMatcher(match)));\n}\n","export default function(update) {\n return new Array(update.length);\n}\n","import sparse from \"./sparse.js\";\nimport {Selection} from \"./index.js\";\n\nexport default function() {\n return new Selection(this._enter || this._groups.map(sparse), this._parents);\n}\n\nexport function EnterNode(parent, datum) {\n this.ownerDocument = parent.ownerDocument;\n this.namespaceURI = parent.namespaceURI;\n this._next = null;\n this._parent = parent;\n this.__data__ = datum;\n}\n\nEnterNode.prototype = {\n constructor: EnterNode,\n appendChild: function(child) { return this._parent.insertBefore(child, this._next); },\n insertBefore: function(child, next) { return this._parent.insertBefore(child, next); },\n querySelector: function(selector) { return this._parent.querySelector(selector); },\n querySelectorAll: function(selector) { return this._parent.querySelectorAll(selector); }\n};\n","import {Selection} from \"./index.js\";\nimport {EnterNode} from \"./enter.js\";\nimport constant from \"../constant.js\";\n\nfunction bindIndex(parent, group, enter, update, exit, data) {\n var i = 0,\n node,\n groupLength = group.length,\n dataLength = data.length;\n\n // Put any non-null nodes that fit into update.\n // Put any null nodes into enter.\n // Put any remaining data into enter.\n for (; i < dataLength; ++i) {\n if (node = group[i]) {\n node.__data__ = data[i];\n update[i] = node;\n } else {\n enter[i] = new EnterNode(parent, data[i]);\n }\n }\n\n // Put any non-null nodes that don’t fit into exit.\n for (; i < groupLength; ++i) {\n if (node = group[i]) {\n exit[i] = node;\n }\n }\n}\n\nfunction bindKey(parent, group, enter, update, exit, data, key) {\n var i,\n node,\n nodeByKeyValue = new Map,\n groupLength = group.length,\n dataLength = data.length,\n keyValues = new Array(groupLength),\n keyValue;\n\n // Compute the key for each node.\n // If multiple nodes have the same key, the duplicates are added to exit.\n for (i = 0; i < groupLength; ++i) {\n if (node = group[i]) {\n keyValues[i] = keyValue = key.call(node, node.__data__, i, group) + \"\";\n if (nodeByKeyValue.has(keyValue)) {\n exit[i] = node;\n } else {\n nodeByKeyValue.set(keyValue, node);\n }\n }\n }\n\n // Compute the key for each datum.\n // If there a node associated with this key, join and add it to update.\n // If there is not (or the key is a duplicate), add it to enter.\n for (i = 0; i < dataLength; ++i) {\n keyValue = key.call(parent, data[i], i, data) + \"\";\n if (node = nodeByKeyValue.get(keyValue)) {\n update[i] = node;\n node.__data__ = data[i];\n nodeByKeyValue.delete(keyValue);\n } else {\n enter[i] = new EnterNode(parent, data[i]);\n }\n }\n\n // Add any remaining nodes that were not bound to data to exit.\n for (i = 0; i < groupLength; ++i) {\n if ((node = group[i]) && (nodeByKeyValue.get(keyValues[i]) === node)) {\n exit[i] = node;\n }\n }\n}\n\nfunction datum(node) {\n return node.__data__;\n}\n\nexport default function(value, key) {\n if (!arguments.length) return Array.from(this, datum);\n\n var bind = key ? bindKey : bindIndex,\n parents = this._parents,\n groups = this._groups;\n\n if (typeof value !== \"function\") value = constant(value);\n\n for (var m = groups.length, update = new Array(m), enter = new Array(m), exit = new Array(m), j = 0; j < m; ++j) {\n var parent = parents[j],\n group = groups[j],\n groupLength = group.length,\n data = arraylike(value.call(parent, parent && parent.__data__, j, parents)),\n dataLength = data.length,\n enterGroup = enter[j] = new Array(dataLength),\n updateGroup = update[j] = new Array(dataLength),\n exitGroup = exit[j] = new Array(groupLength);\n\n bind(parent, group, enterGroup, updateGroup, exitGroup, data, key);\n\n // Now connect the enter nodes to their following update node, such that\n // appendChild can insert the materialized enter node before this node,\n // rather than at the end of the parent node.\n for (var i0 = 0, i1 = 0, previous, next; i0 < dataLength; ++i0) {\n if (previous = enterGroup[i0]) {\n if (i0 >= i1) i1 = i0 + 1;\n while (!(next = updateGroup[i1]) && ++i1 < dataLength);\n previous._next = next || null;\n }\n }\n }\n\n update = new Selection(update, parents);\n update._enter = enter;\n update._exit = exit;\n return update;\n}\n\n// Given some data, this returns an array-like view of it: an object that\n// exposes a length property and allows numeric indexing. Note that unlike\n// selectAll, this isn’t worried about “live” collections because the resulting\n// array will only be used briefly while data is being bound. (It is possible to\n// cause the data to change while iterating by using a key function, but please\n// don’t; we’d rather avoid a gratuitous copy.)\nfunction arraylike(data) {\n return typeof data === \"object\" && \"length\" in data\n ? data // Array, TypedArray, NodeList, array-like\n : Array.from(data); // Map, Set, iterable, string, or anything else\n}\n","import {Selection} from \"./index.js\";\n\nexport default function(compare) {\n if (!compare) compare = ascending;\n\n function compareNode(a, b) {\n return a && b ? compare(a.__data__, b.__data__) : !a - !b;\n }\n\n for (var groups = this._groups, m = groups.length, sortgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, sortgroup = sortgroups[j] = new Array(n), node, i = 0; i < n; ++i) {\n if (node = group[i]) {\n sortgroup[i] = node;\n }\n }\n sortgroup.sort(compareNode);\n }\n\n return new Selection(sortgroups, this._parents).order();\n}\n\nfunction ascending(a, b) {\n return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;\n}\n","export var xhtml = \"http://www.w3.org/1999/xhtml\";\n\nexport default {\n svg: \"http://www.w3.org/2000/svg\",\n xhtml: xhtml,\n xlink: \"http://www.w3.org/1999/xlink\",\n xml: \"http://www.w3.org/XML/1998/namespace\",\n xmlns: \"http://www.w3.org/2000/xmlns/\"\n};\n","import namespaces from \"./namespaces.js\";\n\nexport default function(name) {\n var prefix = name += \"\", i = prefix.indexOf(\":\");\n if (i >= 0 && (prefix = name.slice(0, i)) !== \"xmlns\") name = name.slice(i + 1);\n return namespaces.hasOwnProperty(prefix) ? {space: namespaces[prefix], local: name} : name; // eslint-disable-line no-prototype-builtins\n}\n","import namespace from \"../namespace.js\";\n\nfunction attrRemove(name) {\n return function() {\n this.removeAttribute(name);\n };\n}\n\nfunction attrRemoveNS(fullname) {\n return function() {\n this.removeAttributeNS(fullname.space, fullname.local);\n };\n}\n\nfunction attrConstant(name, value) {\n return function() {\n this.setAttribute(name, value);\n };\n}\n\nfunction attrConstantNS(fullname, value) {\n return function() {\n this.setAttributeNS(fullname.space, fullname.local, value);\n };\n}\n\nfunction attrFunction(name, value) {\n return function() {\n var v = value.apply(this, arguments);\n if (v == null) this.removeAttribute(name);\n else this.setAttribute(name, v);\n };\n}\n\nfunction attrFunctionNS(fullname, value) {\n return function() {\n var v = value.apply(this, arguments);\n if (v == null) this.removeAttributeNS(fullname.space, fullname.local);\n else this.setAttributeNS(fullname.space, fullname.local, v);\n };\n}\n\nexport default function(name, value) {\n var fullname = namespace(name);\n\n if (arguments.length < 2) {\n var node = this.node();\n return fullname.local\n ? node.getAttributeNS(fullname.space, fullname.local)\n : node.getAttribute(fullname);\n }\n\n return this.each((value == null\n ? (fullname.local ? attrRemoveNS : attrRemove) : (typeof value === \"function\"\n ? (fullname.local ? attrFunctionNS : attrFunction)\n : (fullname.local ? attrConstantNS : attrConstant)))(fullname, value));\n}\n","export default function(node) {\n return (node.ownerDocument && node.ownerDocument.defaultView) // node is a Node\n || (node.document && node) // node is a Window\n || node.defaultView; // node is a Document\n}\n","import defaultView from \"../window.js\";\n\nfunction styleRemove(name) {\n return function() {\n this.style.removeProperty(name);\n };\n}\n\nfunction styleConstant(name, value, priority) {\n return function() {\n this.style.setProperty(name, value, priority);\n };\n}\n\nfunction styleFunction(name, value, priority) {\n return function() {\n var v = value.apply(this, arguments);\n if (v == null) this.style.removeProperty(name);\n else this.style.setProperty(name, v, priority);\n };\n}\n\nexport default function(name, value, priority) {\n return arguments.length > 1\n ? this.each((value == null\n ? styleRemove : typeof value === \"function\"\n ? styleFunction\n : styleConstant)(name, value, priority == null ? \"\" : priority))\n : styleValue(this.node(), name);\n}\n\nexport function styleValue(node, name) {\n return node.style.getPropertyValue(name)\n || defaultView(node).getComputedStyle(node, null).getPropertyValue(name);\n}\n","function propertyRemove(name) {\n return function() {\n delete this[name];\n };\n}\n\nfunction propertyConstant(name, value) {\n return function() {\n this[name] = value;\n };\n}\n\nfunction propertyFunction(name, value) {\n return function() {\n var v = value.apply(this, arguments);\n if (v == null) delete this[name];\n else this[name] = v;\n };\n}\n\nexport default function(name, value) {\n return arguments.length > 1\n ? this.each((value == null\n ? propertyRemove : typeof value === \"function\"\n ? propertyFunction\n : propertyConstant)(name, value))\n : this.node()[name];\n}\n","function classArray(string) {\n return string.trim().split(/^|\\s+/);\n}\n\nfunction classList(node) {\n return node.classList || new ClassList(node);\n}\n\nfunction ClassList(node) {\n this._node = node;\n this._names = classArray(node.getAttribute(\"class\") || \"\");\n}\n\nClassList.prototype = {\n add: function(name) {\n var i = this._names.indexOf(name);\n if (i < 0) {\n this._names.push(name);\n this._node.setAttribute(\"class\", this._names.join(\" \"));\n }\n },\n remove: function(name) {\n var i = this._names.indexOf(name);\n if (i >= 0) {\n this._names.splice(i, 1);\n this._node.setAttribute(\"class\", this._names.join(\" \"));\n }\n },\n contains: function(name) {\n return this._names.indexOf(name) >= 0;\n }\n};\n\nfunction classedAdd(node, names) {\n var list = classList(node), i = -1, n = names.length;\n while (++i < n) list.add(names[i]);\n}\n\nfunction classedRemove(node, names) {\n var list = classList(node), i = -1, n = names.length;\n while (++i < n) list.remove(names[i]);\n}\n\nfunction classedTrue(names) {\n return function() {\n classedAdd(this, names);\n };\n}\n\nfunction classedFalse(names) {\n return function() {\n classedRemove(this, names);\n };\n}\n\nfunction classedFunction(names, value) {\n return function() {\n (value.apply(this, arguments) ? classedAdd : classedRemove)(this, names);\n };\n}\n\nexport default function(name, value) {\n var names = classArray(name + \"\");\n\n if (arguments.length < 2) {\n var list = classList(this.node()), i = -1, n = names.length;\n while (++i < n) if (!list.contains(names[i])) return false;\n return true;\n }\n\n return this.each((typeof value === \"function\"\n ? classedFunction : value\n ? classedTrue\n : classedFalse)(names, value));\n}\n","function textRemove() {\n this.textContent = \"\";\n}\n\nfunction textConstant(value) {\n return function() {\n this.textContent = value;\n };\n}\n\nfunction textFunction(value) {\n return function() {\n var v = value.apply(this, arguments);\n this.textContent = v == null ? \"\" : v;\n };\n}\n\nexport default function(value) {\n return arguments.length\n ? this.each(value == null\n ? textRemove : (typeof value === \"function\"\n ? textFunction\n : textConstant)(value))\n : this.node().textContent;\n}\n","function htmlRemove() {\n this.innerHTML = \"\";\n}\n\nfunction htmlConstant(value) {\n return function() {\n this.innerHTML = value;\n };\n}\n\nfunction htmlFunction(value) {\n return function() {\n var v = value.apply(this, arguments);\n this.innerHTML = v == null ? \"\" : v;\n };\n}\n\nexport default function(value) {\n return arguments.length\n ? this.each(value == null\n ? htmlRemove : (typeof value === \"function\"\n ? htmlFunction\n : htmlConstant)(value))\n : this.node().innerHTML;\n}\n","function raise() {\n if (this.nextSibling) this.parentNode.appendChild(this);\n}\n\nexport default function() {\n return this.each(raise);\n}\n","function lower() {\n if (this.previousSibling) this.parentNode.insertBefore(this, this.parentNode.firstChild);\n}\n\nexport default function() {\n return this.each(lower);\n}\n","import namespace from \"./namespace.js\";\nimport {xhtml} from \"./namespaces.js\";\n\nfunction creatorInherit(name) {\n return function() {\n var document = this.ownerDocument,\n uri = this.namespaceURI;\n return uri === xhtml && document.documentElement.namespaceURI === xhtml\n ? document.createElement(name)\n : document.createElementNS(uri, name);\n };\n}\n\nfunction creatorFixed(fullname) {\n return function() {\n return this.ownerDocument.createElementNS(fullname.space, fullname.local);\n };\n}\n\nexport default function(name) {\n var fullname = namespace(name);\n return (fullname.local\n ? creatorFixed\n : creatorInherit)(fullname);\n}\n","import creator from \"../creator.js\";\nimport selector from \"../selector.js\";\n\nfunction constantNull() {\n return null;\n}\n\nexport default function(name, before) {\n var create = typeof name === \"function\" ? name : creator(name),\n select = before == null ? constantNull : typeof before === \"function\" ? before : selector(before);\n return this.select(function() {\n return this.insertBefore(create.apply(this, arguments), select.apply(this, arguments) || null);\n });\n}\n","function remove() {\n var parent = this.parentNode;\n if (parent) parent.removeChild(this);\n}\n\nexport default function() {\n return this.each(remove);\n}\n","function selection_cloneShallow() {\n var clone = this.cloneNode(false), parent = this.parentNode;\n return parent ? parent.insertBefore(clone, this.nextSibling) : clone;\n}\n\nfunction selection_cloneDeep() {\n var clone = this.cloneNode(true), parent = this.parentNode;\n return parent ? parent.insertBefore(clone, this.nextSibling) : clone;\n}\n\nexport default function(deep) {\n return this.select(deep ? selection_cloneDeep : selection_cloneShallow);\n}\n","function contextListener(listener) {\n return function(event) {\n listener.call(this, event, this.__data__);\n };\n}\n\nfunction parseTypenames(typenames) {\n return typenames.trim().split(/^|\\s+/).map(function(t) {\n var name = \"\", i = t.indexOf(\".\");\n if (i >= 0) name = t.slice(i + 1), t = t.slice(0, i);\n return {type: t, name: name};\n });\n}\n\nfunction onRemove(typename) {\n return function() {\n var on = this.__on;\n if (!on) return;\n for (var j = 0, i = -1, m = on.length, o; j < m; ++j) {\n if (o = on[j], (!typename.type || o.type === typename.type) && o.name === typename.name) {\n this.removeEventListener(o.type, o.listener, o.options);\n } else {\n on[++i] = o;\n }\n }\n if (++i) on.length = i;\n else delete this.__on;\n };\n}\n\nfunction onAdd(typename, value, options) {\n return function() {\n var on = this.__on, o, listener = contextListener(value);\n if (on) for (var j = 0, m = on.length; j < m; ++j) {\n if ((o = on[j]).type === typename.type && o.name === typename.name) {\n this.removeEventListener(o.type, o.listener, o.options);\n this.addEventListener(o.type, o.listener = listener, o.options = options);\n o.value = value;\n return;\n }\n }\n this.addEventListener(typename.type, listener, options);\n o = {type: typename.type, name: typename.name, value: value, listener: listener, options: options};\n if (!on) this.__on = [o];\n else on.push(o);\n };\n}\n\nexport default function(typename, value, options) {\n var typenames = parseTypenames(typename + \"\"), i, n = typenames.length, t;\n\n if (arguments.length < 2) {\n var on = this.node().__on;\n if (on) for (var j = 0, m = on.length, o; j < m; ++j) {\n for (i = 0, o = on[j]; i < n; ++i) {\n if ((t = typenames[i]).type === o.type && t.name === o.name) {\n return o.value;\n }\n }\n }\n return;\n }\n\n on = value ? onAdd : onRemove;\n for (i = 0; i < n; ++i) this.each(on(typenames[i], value, options));\n return this;\n}\n","import defaultView from \"../window.js\";\n\nfunction dispatchEvent(node, type, params) {\n var window = defaultView(node),\n event = window.CustomEvent;\n\n if (typeof event === \"function\") {\n event = new event(type, params);\n } else {\n event = window.document.createEvent(\"Event\");\n if (params) event.initEvent(type, params.bubbles, params.cancelable), event.detail = params.detail;\n else event.initEvent(type, false, false);\n }\n\n node.dispatchEvent(event);\n}\n\nfunction dispatchConstant(type, params) {\n return function() {\n return dispatchEvent(this, type, params);\n };\n}\n\nfunction dispatchFunction(type, params) {\n return function() {\n return dispatchEvent(this, type, params.apply(this, arguments));\n };\n}\n\nexport default function(type, params) {\n return this.each((typeof params === \"function\"\n ? dispatchFunction\n : dispatchConstant)(type, params));\n}\n","import selection_select from \"./select.js\";\nimport selection_selectAll from \"./selectAll.js\";\nimport selection_selectChild from \"./selectChild.js\";\nimport selection_selectChildren from \"./selectChildren.js\";\nimport selection_filter from \"./filter.js\";\nimport selection_data from \"./data.js\";\nimport selection_enter from \"./enter.js\";\nimport selection_exit from \"./exit.js\";\nimport selection_join from \"./join.js\";\nimport selection_merge from \"./merge.js\";\nimport selection_order from \"./order.js\";\nimport selection_sort from \"./sort.js\";\nimport selection_call from \"./call.js\";\nimport selection_nodes from \"./nodes.js\";\nimport selection_node from \"./node.js\";\nimport selection_size from \"./size.js\";\nimport selection_empty from \"./empty.js\";\nimport selection_each from \"./each.js\";\nimport selection_attr from \"./attr.js\";\nimport selection_style from \"./style.js\";\nimport selection_property from \"./property.js\";\nimport selection_classed from \"./classed.js\";\nimport selection_text from \"./text.js\";\nimport selection_html from \"./html.js\";\nimport selection_raise from \"./raise.js\";\nimport selection_lower from \"./lower.js\";\nimport selection_append from \"./append.js\";\nimport selection_insert from \"./insert.js\";\nimport selection_remove from \"./remove.js\";\nimport selection_clone from \"./clone.js\";\nimport selection_datum from \"./datum.js\";\nimport selection_on from \"./on.js\";\nimport selection_dispatch from \"./dispatch.js\";\nimport selection_iterator from \"./iterator.js\";\n\nexport var root = [null];\n\nexport function Selection(groups, parents) {\n this._groups = groups;\n this._parents = parents;\n}\n\nfunction selection() {\n return new Selection([[document.documentElement]], root);\n}\n\nfunction selection_selection() {\n return this;\n}\n\nSelection.prototype = selection.prototype = {\n constructor: Selection,\n select: selection_select,\n selectAll: selection_selectAll,\n selectChild: selection_selectChild,\n selectChildren: selection_selectChildren,\n filter: selection_filter,\n data: selection_data,\n enter: selection_enter,\n exit: selection_exit,\n join: selection_join,\n merge: selection_merge,\n selection: selection_selection,\n order: selection_order,\n sort: selection_sort,\n call: selection_call,\n nodes: selection_nodes,\n node: selection_node,\n size: selection_size,\n empty: selection_empty,\n each: selection_each,\n attr: selection_attr,\n style: selection_style,\n property: selection_property,\n classed: selection_classed,\n text: selection_text,\n html: selection_html,\n raise: selection_raise,\n lower: selection_lower,\n append: selection_append,\n insert: selection_insert,\n remove: selection_remove,\n clone: selection_clone,\n datum: selection_datum,\n on: selection_on,\n dispatch: selection_dispatch,\n [Symbol.iterator]: selection_iterator\n};\n\nexport default selection;\n","import {Selection} from \"./index.js\";\nimport selector from \"../selector.js\";\n\nexport default function(select) {\n if (typeof select !== \"function\") select = selector(select);\n\n for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, subgroup = subgroups[j] = new Array(n), node, subnode, i = 0; i < n; ++i) {\n if ((node = group[i]) && (subnode = select.call(node, node.__data__, i, group))) {\n if (\"__data__\" in node) subnode.__data__ = node.__data__;\n subgroup[i] = subnode;\n }\n }\n }\n\n return new Selection(subgroups, this._parents);\n}\n","import {Selection} from \"./index.js\";\nimport array from \"../array.js\";\nimport selectorAll from \"../selectorAll.js\";\n\nfunction arrayAll(select) {\n return function() {\n return array(select.apply(this, arguments));\n };\n}\n\nexport default function(select) {\n if (typeof select === \"function\") select = arrayAll(select);\n else select = selectorAll(select);\n\n for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {\n if (node = group[i]) {\n subgroups.push(select.call(node, node.__data__, i, group));\n parents.push(node);\n }\n }\n }\n\n return new Selection(subgroups, parents);\n}\n","// Given something array like (or null), returns something that is strictly an\n// array. This is used to ensure that array-like objects passed to d3.selectAll\n// or selection.selectAll are converted into proper arrays when creating a\n// selection; we don’t ever want to create a selection backed by a live\n// HTMLCollection or NodeList. However, note that selection.selectAll will use a\n// static NodeList as a group, since it safely derived from querySelectorAll.\nexport default function array(x) {\n return x == null ? [] : Array.isArray(x) ? x : Array.from(x);\n}\n","import {Selection} from \"./index.js\";\nimport matcher from \"../matcher.js\";\n\nexport default function(match) {\n if (typeof match !== \"function\") match = matcher(match);\n\n for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, subgroup = subgroups[j] = [], node, i = 0; i < n; ++i) {\n if ((node = group[i]) && match.call(node, node.__data__, i, group)) {\n subgroup.push(node);\n }\n }\n }\n\n return new Selection(subgroups, this._parents);\n}\n","export default function(x) {\n return function() {\n return x;\n };\n}\n","import sparse from \"./sparse.js\";\nimport {Selection} from \"./index.js\";\n\nexport default function() {\n return new Selection(this._exit || this._groups.map(sparse), this._parents);\n}\n","export default function(onenter, onupdate, onexit) {\n var enter = this.enter(), update = this, exit = this.exit();\n if (typeof onenter === \"function\") {\n enter = onenter(enter);\n if (enter) enter = enter.selection();\n } else {\n enter = enter.append(onenter + \"\");\n }\n if (onupdate != null) {\n update = onupdate(update);\n if (update) update = update.selection();\n }\n if (onexit == null) exit.remove(); else onexit(exit);\n return enter && update ? enter.merge(update).order() : update;\n}\n","import {Selection} from \"./index.js\";\n\nexport default function(context) {\n var selection = context.selection ? context.selection() : context;\n\n for (var groups0 = this._groups, groups1 = selection._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j = 0; j < m; ++j) {\n for (var group0 = groups0[j], group1 = groups1[j], n = group0.length, merge = merges[j] = new Array(n), node, i = 0; i < n; ++i) {\n if (node = group0[i] || group1[i]) {\n merge[i] = node;\n }\n }\n }\n\n for (; j < m0; ++j) {\n merges[j] = groups0[j];\n }\n\n return new Selection(merges, this._parents);\n}\n","export default function() {\n\n for (var groups = this._groups, j = -1, m = groups.length; ++j < m;) {\n for (var group = groups[j], i = group.length - 1, next = group[i], node; --i >= 0;) {\n if (node = group[i]) {\n if (next && node.compareDocumentPosition(next) ^ 4) next.parentNode.insertBefore(node, next);\n next = node;\n }\n }\n }\n\n return this;\n}\n","export default function() {\n var callback = arguments[0];\n arguments[0] = this;\n callback.apply(null, arguments);\n return this;\n}\n","export default function() {\n return Array.from(this);\n}\n","export default function() {\n\n for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {\n for (var group = groups[j], i = 0, n = group.length; i < n; ++i) {\n var node = group[i];\n if (node) return node;\n }\n }\n\n return null;\n}\n","export default function() {\n let size = 0;\n for (const node of this) ++size; // eslint-disable-line no-unused-vars\n return size;\n}\n","export default function() {\n return !this.node();\n}\n","export default function(callback) {\n\n for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {\n for (var group = groups[j], i = 0, n = group.length, node; i < n; ++i) {\n if (node = group[i]) callback.call(node, node.__data__, i, group);\n }\n }\n\n return this;\n}\n","import creator from \"../creator.js\";\n\nexport default function(name) {\n var create = typeof name === \"function\" ? name : creator(name);\n return this.select(function() {\n return this.appendChild(create.apply(this, arguments));\n });\n}\n","export default function(value) {\n return arguments.length\n ? this.property(\"__data__\", value)\n : this.node().__data__;\n}\n","export default function*() {\n for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {\n for (var group = groups[j], i = 0, n = group.length, node; i < n; ++i) {\n if (node = group[i]) yield node;\n }\n }\n}\n","var noop = {value: () => {}};\n\nfunction dispatch() {\n for (var i = 0, n = arguments.length, _ = {}, t; i < n; ++i) {\n if (!(t = arguments[i] + \"\") || (t in _) || /[\\s.]/.test(t)) throw new Error(\"illegal type: \" + t);\n _[t] = [];\n }\n return new Dispatch(_);\n}\n\nfunction Dispatch(_) {\n this._ = _;\n}\n\nfunction parseTypenames(typenames, types) {\n return typenames.trim().split(/^|\\s+/).map(function(t) {\n var name = \"\", i = t.indexOf(\".\");\n if (i >= 0) name = t.slice(i + 1), t = t.slice(0, i);\n if (t && !types.hasOwnProperty(t)) throw new Error(\"unknown type: \" + t);\n return {type: t, name: name};\n });\n}\n\nDispatch.prototype = dispatch.prototype = {\n constructor: Dispatch,\n on: function(typename, callback) {\n var _ = this._,\n T = parseTypenames(typename + \"\", _),\n t,\n i = -1,\n n = T.length;\n\n // If no callback was specified, return the callback of the given type and name.\n if (arguments.length < 2) {\n while (++i < n) if ((t = (typename = T[i]).type) && (t = get(_[t], typename.name))) return t;\n return;\n }\n\n // If a type was specified, set the callback for the given type and name.\n // Otherwise, if a null callback was specified, remove callbacks of the given name.\n if (callback != null && typeof callback !== \"function\") throw new Error(\"invalid callback: \" + callback);\n while (++i < n) {\n if (t = (typename = T[i]).type) _[t] = set(_[t], typename.name, callback);\n else if (callback == null) for (t in _) _[t] = set(_[t], typename.name, null);\n }\n\n return this;\n },\n copy: function() {\n var copy = {}, _ = this._;\n for (var t in _) copy[t] = _[t].slice();\n return new Dispatch(copy);\n },\n call: function(type, that) {\n if ((n = arguments.length - 2) > 0) for (var args = new Array(n), i = 0, n, t; i < n; ++i) args[i] = arguments[i + 2];\n if (!this._.hasOwnProperty(type)) throw new Error(\"unknown type: \" + type);\n for (t = this._[type], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args);\n },\n apply: function(type, that, args) {\n if (!this._.hasOwnProperty(type)) throw new Error(\"unknown type: \" + type);\n for (var t = this._[type], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args);\n }\n};\n\nfunction get(type, name) {\n for (var i = 0, n = type.length, c; i < n; ++i) {\n if ((c = type[i]).name === name) {\n return c.value;\n }\n }\n}\n\nfunction set(type, name, callback) {\n for (var i = 0, n = type.length; i < n; ++i) {\n if (type[i].name === name) {\n type[i] = noop, type = type.slice(0, i).concat(type.slice(i + 1));\n break;\n }\n }\n if (callback != null) type.push({name: name, value: callback});\n return type;\n}\n\nexport default dispatch;\n","var frame = 0, // is an animation frame pending?\n timeout = 0, // is a timeout pending?\n interval = 0, // are any timers active?\n pokeDelay = 1000, // how frequently we check for clock skew\n taskHead,\n taskTail,\n clockLast = 0,\n clockNow = 0,\n clockSkew = 0,\n clock = typeof performance === \"object\" && performance.now ? performance : Date,\n setFrame = typeof window === \"object\" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(f) { setTimeout(f, 17); };\n\nexport function now() {\n return clockNow || (setFrame(clearNow), clockNow = clock.now() + clockSkew);\n}\n\nfunction clearNow() {\n clockNow = 0;\n}\n\nexport function Timer() {\n this._call =\n this._time =\n this._next = null;\n}\n\nTimer.prototype = timer.prototype = {\n constructor: Timer,\n restart: function(callback, delay, time) {\n if (typeof callback !== \"function\") throw new TypeError(\"callback is not a function\");\n time = (time == null ? now() : +time) + (delay == null ? 0 : +delay);\n if (!this._next && taskTail !== this) {\n if (taskTail) taskTail._next = this;\n else taskHead = this;\n taskTail = this;\n }\n this._call = callback;\n this._time = time;\n sleep();\n },\n stop: function() {\n if (this._call) {\n this._call = null;\n this._time = Infinity;\n sleep();\n }\n }\n};\n\nexport function timer(callback, delay, time) {\n var t = new Timer;\n t.restart(callback, delay, time);\n return t;\n}\n\nexport function timerFlush() {\n now(); // Get the current time, if not already set.\n ++frame; // Pretend we’ve set an alarm, if we haven’t already.\n var t = taskHead, e;\n while (t) {\n if ((e = clockNow - t._time) >= 0) t._call.call(undefined, e);\n t = t._next;\n }\n --frame;\n}\n\nfunction wake() {\n clockNow = (clockLast = clock.now()) + clockSkew;\n frame = timeout = 0;\n try {\n timerFlush();\n } finally {\n frame = 0;\n nap();\n clockNow = 0;\n }\n}\n\nfunction poke() {\n var now = clock.now(), delay = now - clockLast;\n if (delay > pokeDelay) clockSkew -= delay, clockLast = now;\n}\n\nfunction nap() {\n var t0, t1 = taskHead, t2, time = Infinity;\n while (t1) {\n if (t1._call) {\n if (time > t1._time) time = t1._time;\n t0 = t1, t1 = t1._next;\n } else {\n t2 = t1._next, t1._next = null;\n t1 = t0 ? t0._next = t2 : taskHead = t2;\n }\n }\n taskTail = t0;\n sleep(time);\n}\n\nfunction sleep(time) {\n if (frame) return; // Soonest alarm already set, or will be.\n if (timeout) timeout = clearTimeout(timeout);\n var delay = time - clockNow; // Strictly less than if we recomputed clockNow.\n if (delay > 24) {\n if (time < Infinity) timeout = setTimeout(wake, time - clock.now() - clockSkew);\n if (interval) interval = clearInterval(interval);\n } else {\n if (!interval) clockLast = clock.now(), interval = setInterval(poke, pokeDelay);\n frame = 1, setFrame(wake);\n }\n}\n","import {Timer} from \"./timer.js\";\n\nexport default function(callback, delay, time) {\n var t = new Timer;\n delay = delay == null ? 0 : +delay;\n t.restart(elapsed => {\n t.stop();\n callback(elapsed + delay);\n }, delay, time);\n return t;\n}\n","import {dispatch} from \"d3-dispatch\";\nimport {timer, timeout} from \"d3-timer\";\n\nvar emptyOn = dispatch(\"start\", \"end\", \"cancel\", \"interrupt\");\nvar emptyTween = [];\n\nexport var CREATED = 0;\nexport var SCHEDULED = 1;\nexport var STARTING = 2;\nexport var STARTED = 3;\nexport var RUNNING = 4;\nexport var ENDING = 5;\nexport var ENDED = 6;\n\nexport default function(node, name, id, index, group, timing) {\n var schedules = node.__transition;\n if (!schedules) node.__transition = {};\n else if (id in schedules) return;\n create(node, id, {\n name: name,\n index: index, // For context during callback.\n group: group, // For context during callback.\n on: emptyOn,\n tween: emptyTween,\n time: timing.time,\n delay: timing.delay,\n duration: timing.duration,\n ease: timing.ease,\n timer: null,\n state: CREATED\n });\n}\n\nexport function init(node, id) {\n var schedule = get(node, id);\n if (schedule.state > CREATED) throw new Error(\"too late; already scheduled\");\n return schedule;\n}\n\nexport function set(node, id) {\n var schedule = get(node, id);\n if (schedule.state > STARTED) throw new Error(\"too late; already running\");\n return schedule;\n}\n\nexport function get(node, id) {\n var schedule = node.__transition;\n if (!schedule || !(schedule = schedule[id])) throw new Error(\"transition not found\");\n return schedule;\n}\n\nfunction create(node, id, self) {\n var schedules = node.__transition,\n tween;\n\n // Initialize the self timer when the transition is created.\n // Note the actual delay is not known until the first callback!\n schedules[id] = self;\n self.timer = timer(schedule, 0, self.time);\n\n function schedule(elapsed) {\n self.state = SCHEDULED;\n self.timer.restart(start, self.delay, self.time);\n\n // If the elapsed delay is less than our first sleep, start immediately.\n if (self.delay <= elapsed) start(elapsed - self.delay);\n }\n\n function start(elapsed) {\n var i, j, n, o;\n\n // If the state is not SCHEDULED, then we previously errored on start.\n if (self.state !== SCHEDULED) return stop();\n\n for (i in schedules) {\n o = schedules[i];\n if (o.name !== self.name) continue;\n\n // While this element already has a starting transition during this frame,\n // defer starting an interrupting transition until that transition has a\n // chance to tick (and possibly end); see d3/d3-transition#54!\n if (o.state === STARTED) return timeout(start);\n\n // Interrupt the active transition, if any.\n if (o.state === RUNNING) {\n o.state = ENDED;\n o.timer.stop();\n o.on.call(\"interrupt\", node, node.__data__, o.index, o.group);\n delete schedules[i];\n }\n\n // Cancel any pre-empted transitions.\n else if (+i < id) {\n o.state = ENDED;\n o.timer.stop();\n o.on.call(\"cancel\", node, node.__data__, o.index, o.group);\n delete schedules[i];\n }\n }\n\n // Defer the first tick to end of the current frame; see d3/d3#1576.\n // Note the transition may be canceled after start and before the first tick!\n // Note this must be scheduled before the start event; see d3/d3-transition#16!\n // Assuming this is successful, subsequent callbacks go straight to tick.\n timeout(function() {\n if (self.state === STARTED) {\n self.state = RUNNING;\n self.timer.restart(tick, self.delay, self.time);\n tick(elapsed);\n }\n });\n\n // Dispatch the start event.\n // Note this must be done before the tween are initialized.\n self.state = STARTING;\n self.on.call(\"start\", node, node.__data__, self.index, self.group);\n if (self.state !== STARTING) return; // interrupted\n self.state = STARTED;\n\n // Initialize the tween, deleting null tween.\n tween = new Array(n = self.tween.length);\n for (i = 0, j = -1; i < n; ++i) {\n if (o = self.tween[i].value.call(node, node.__data__, self.index, self.group)) {\n tween[++j] = o;\n }\n }\n tween.length = j + 1;\n }\n\n function tick(elapsed) {\n var t = elapsed < self.duration ? self.ease.call(null, elapsed / self.duration) : (self.timer.restart(stop), self.state = ENDING, 1),\n i = -1,\n n = tween.length;\n\n while (++i < n) {\n tween[i].call(node, t);\n }\n\n // Dispatch the end event.\n if (self.state === ENDING) {\n self.on.call(\"end\", node, node.__data__, self.index, self.group);\n stop();\n }\n }\n\n function stop() {\n self.state = ENDED;\n self.timer.stop();\n delete schedules[id];\n for (var i in schedules) return; // eslint-disable-line no-unused-vars\n delete node.__transition;\n }\n}\n","export default function(a, b) {\n return a = +a, b = +b, function(t) {\n return a * (1 - t) + b * t;\n };\n}\n","var degrees = 180 / Math.PI;\n\nexport var identity = {\n translateX: 0,\n translateY: 0,\n rotate: 0,\n skewX: 0,\n scaleX: 1,\n scaleY: 1\n};\n\nexport default function(a, b, c, d, e, f) {\n var scaleX, scaleY, skewX;\n if (scaleX = Math.sqrt(a * a + b * b)) a /= scaleX, b /= scaleX;\n if (skewX = a * c + b * d) c -= a * skewX, d -= b * skewX;\n if (scaleY = Math.sqrt(c * c + d * d)) c /= scaleY, d /= scaleY, skewX /= scaleY;\n if (a * d < b * c) a = -a, b = -b, skewX = -skewX, scaleX = -scaleX;\n return {\n translateX: e,\n translateY: f,\n rotate: Math.atan2(b, a) * degrees,\n skewX: Math.atan(skewX) * degrees,\n scaleX: scaleX,\n scaleY: scaleY\n };\n}\n","import decompose, {identity} from \"./decompose.js\";\n\nvar svgNode;\n\n/* eslint-disable no-undef */\nexport function parseCss(value) {\n const m = new (typeof DOMMatrix === \"function\" ? DOMMatrix : WebKitCSSMatrix)(value + \"\");\n return m.isIdentity ? identity : decompose(m.a, m.b, m.c, m.d, m.e, m.f);\n}\n\nexport function parseSvg(value) {\n if (value == null) return identity;\n if (!svgNode) svgNode = document.createElementNS(\"http://www.w3.org/2000/svg\", \"g\");\n svgNode.setAttribute(\"transform\", value);\n if (!(value = svgNode.transform.baseVal.consolidate())) return identity;\n value = value.matrix;\n return decompose(value.a, value.b, value.c, value.d, value.e, value.f);\n}\n","import number from \"../number.js\";\nimport {parseCss, parseSvg} from \"./parse.js\";\n\nfunction interpolateTransform(parse, pxComma, pxParen, degParen) {\n\n function pop(s) {\n return s.length ? s.pop() + \" \" : \"\";\n }\n\n function translate(xa, ya, xb, yb, s, q) {\n if (xa !== xb || ya !== yb) {\n var i = s.push(\"translate(\", null, pxComma, null, pxParen);\n q.push({i: i - 4, x: number(xa, xb)}, {i: i - 2, x: number(ya, yb)});\n } else if (xb || yb) {\n s.push(\"translate(\" + xb + pxComma + yb + pxParen);\n }\n }\n\n function rotate(a, b, s, q) {\n if (a !== b) {\n if (a - b > 180) b += 360; else if (b - a > 180) a += 360; // shortest path\n q.push({i: s.push(pop(s) + \"rotate(\", null, degParen) - 2, x: number(a, b)});\n } else if (b) {\n s.push(pop(s) + \"rotate(\" + b + degParen);\n }\n }\n\n function skewX(a, b, s, q) {\n if (a !== b) {\n q.push({i: s.push(pop(s) + \"skewX(\", null, degParen) - 2, x: number(a, b)});\n } else if (b) {\n s.push(pop(s) + \"skewX(\" + b + degParen);\n }\n }\n\n function scale(xa, ya, xb, yb, s, q) {\n if (xa !== xb || ya !== yb) {\n var i = s.push(pop(s) + \"scale(\", null, \",\", null, \")\");\n q.push({i: i - 4, x: number(xa, xb)}, {i: i - 2, x: number(ya, yb)});\n } else if (xb !== 1 || yb !== 1) {\n s.push(pop(s) + \"scale(\" + xb + \",\" + yb + \")\");\n }\n }\n\n return function(a, b) {\n var s = [], // string constants and placeholders\n q = []; // number interpolators\n a = parse(a), b = parse(b);\n translate(a.translateX, a.translateY, b.translateX, b.translateY, s, q);\n rotate(a.rotate, b.rotate, s, q);\n skewX(a.skewX, b.skewX, s, q);\n scale(a.scaleX, a.scaleY, b.scaleX, b.scaleY, s, q);\n a = b = null; // gc\n return function(t) {\n var i = -1, n = q.length, o;\n while (++i < n) s[(o = q[i]).i] = o.x(t);\n return s.join(\"\");\n };\n };\n}\n\nexport var interpolateTransformCss = interpolateTransform(parseCss, \"px, \", \"px)\", \"deg)\");\nexport var interpolateTransformSvg = interpolateTransform(parseSvg, \", \", \")\", \")\");\n","import {get, set} from \"./schedule.js\";\n\nfunction tweenRemove(id, name) {\n var tween0, tween1;\n return function() {\n var schedule = set(this, id),\n tween = schedule.tween;\n\n // If this node shared tween with the previous node,\n // just assign the updated shared tween and we’re done!\n // Otherwise, copy-on-write.\n if (tween !== tween0) {\n tween1 = tween0 = tween;\n for (var i = 0, n = tween1.length; i < n; ++i) {\n if (tween1[i].name === name) {\n tween1 = tween1.slice();\n tween1.splice(i, 1);\n break;\n }\n }\n }\n\n schedule.tween = tween1;\n };\n}\n\nfunction tweenFunction(id, name, value) {\n var tween0, tween1;\n if (typeof value !== \"function\") throw new Error;\n return function() {\n var schedule = set(this, id),\n tween = schedule.tween;\n\n // If this node shared tween with the previous node,\n // just assign the updated shared tween and we’re done!\n // Otherwise, copy-on-write.\n if (tween !== tween0) {\n tween1 = (tween0 = tween).slice();\n for (var t = {name: name, value: value}, i = 0, n = tween1.length; i < n; ++i) {\n if (tween1[i].name === name) {\n tween1[i] = t;\n break;\n }\n }\n if (i === n) tween1.push(t);\n }\n\n schedule.tween = tween1;\n };\n}\n\nexport default function(name, value) {\n var id = this._id;\n\n name += \"\";\n\n if (arguments.length < 2) {\n var tween = get(this.node(), id).tween;\n for (var i = 0, n = tween.length, t; i < n; ++i) {\n if ((t = tween[i]).name === name) {\n return t.value;\n }\n }\n return null;\n }\n\n return this.each((value == null ? tweenRemove : tweenFunction)(id, name, value));\n}\n\nexport function tweenValue(transition, name, value) {\n var id = transition._id;\n\n transition.each(function() {\n var schedule = set(this, id);\n (schedule.value || (schedule.value = {}))[name] = value.apply(this, arguments);\n });\n\n return function(node) {\n return get(node, id).value[name];\n };\n}\n","export default function(constructor, factory, prototype) {\n constructor.prototype = factory.prototype = prototype;\n prototype.constructor = constructor;\n}\n\nexport function extend(parent, definition) {\n var prototype = Object.create(parent.prototype);\n for (var key in definition) prototype[key] = definition[key];\n return prototype;\n}\n","import define, {extend} from \"./define.js\";\n\nexport function Color() {}\n\nexport var darker = 0.7;\nexport var brighter = 1 / darker;\n\nvar reI = \"\\\\s*([+-]?\\\\d+)\\\\s*\",\n reN = \"\\\\s*([+-]?(?:\\\\d*\\\\.)?\\\\d+(?:[eE][+-]?\\\\d+)?)\\\\s*\",\n reP = \"\\\\s*([+-]?(?:\\\\d*\\\\.)?\\\\d+(?:[eE][+-]?\\\\d+)?)%\\\\s*\",\n reHex = /^#([0-9a-f]{3,8})$/,\n reRgbInteger = new RegExp(`^rgb\\\\(${reI},${reI},${reI}\\\\)$`),\n reRgbPercent = new RegExp(`^rgb\\\\(${reP},${reP},${reP}\\\\)$`),\n reRgbaInteger = new RegExp(`^rgba\\\\(${reI},${reI},${reI},${reN}\\\\)$`),\n reRgbaPercent = new RegExp(`^rgba\\\\(${reP},${reP},${reP},${reN}\\\\)$`),\n reHslPercent = new RegExp(`^hsl\\\\(${reN},${reP},${reP}\\\\)$`),\n reHslaPercent = new RegExp(`^hsla\\\\(${reN},${reP},${reP},${reN}\\\\)$`);\n\nvar named = {\n aliceblue: 0xf0f8ff,\n antiquewhite: 0xfaebd7,\n aqua: 0x00ffff,\n aquamarine: 0x7fffd4,\n azure: 0xf0ffff,\n beige: 0xf5f5dc,\n bisque: 0xffe4c4,\n black: 0x000000,\n blanchedalmond: 0xffebcd,\n blue: 0x0000ff,\n blueviolet: 0x8a2be2,\n brown: 0xa52a2a,\n burlywood: 0xdeb887,\n cadetblue: 0x5f9ea0,\n chartreuse: 0x7fff00,\n chocolate: 0xd2691e,\n coral: 0xff7f50,\n cornflowerblue: 0x6495ed,\n cornsilk: 0xfff8dc,\n crimson: 0xdc143c,\n cyan: 0x00ffff,\n darkblue: 0x00008b,\n darkcyan: 0x008b8b,\n darkgoldenrod: 0xb8860b,\n darkgray: 0xa9a9a9,\n darkgreen: 0x006400,\n darkgrey: 0xa9a9a9,\n darkkhaki: 0xbdb76b,\n darkmagenta: 0x8b008b,\n darkolivegreen: 0x556b2f,\n darkorange: 0xff8c00,\n darkorchid: 0x9932cc,\n darkred: 0x8b0000,\n darksalmon: 0xe9967a,\n darkseagreen: 0x8fbc8f,\n darkslateblue: 0x483d8b,\n darkslategray: 0x2f4f4f,\n darkslategrey: 0x2f4f4f,\n darkturquoise: 0x00ced1,\n darkviolet: 0x9400d3,\n deeppink: 0xff1493,\n deepskyblue: 0x00bfff,\n dimgray: 0x696969,\n dimgrey: 0x696969,\n dodgerblue: 0x1e90ff,\n firebrick: 0xb22222,\n floralwhite: 0xfffaf0,\n forestgreen: 0x228b22,\n fuchsia: 0xff00ff,\n gainsboro: 0xdcdcdc,\n ghostwhite: 0xf8f8ff,\n gold: 0xffd700,\n goldenrod: 0xdaa520,\n gray: 0x808080,\n green: 0x008000,\n greenyellow: 0xadff2f,\n grey: 0x808080,\n honeydew: 0xf0fff0,\n hotpink: 0xff69b4,\n indianred: 0xcd5c5c,\n indigo: 0x4b0082,\n ivory: 0xfffff0,\n khaki: 0xf0e68c,\n lavender: 0xe6e6fa,\n lavenderblush: 0xfff0f5,\n lawngreen: 0x7cfc00,\n lemonchiffon: 0xfffacd,\n lightblue: 0xadd8e6,\n lightcoral: 0xf08080,\n lightcyan: 0xe0ffff,\n lightgoldenrodyellow: 0xfafad2,\n lightgray: 0xd3d3d3,\n lightgreen: 0x90ee90,\n lightgrey: 0xd3d3d3,\n lightpink: 0xffb6c1,\n lightsalmon: 0xffa07a,\n lightseagreen: 0x20b2aa,\n lightskyblue: 0x87cefa,\n lightslategray: 0x778899,\n lightslategrey: 0x778899,\n lightsteelblue: 0xb0c4de,\n lightyellow: 0xffffe0,\n lime: 0x00ff00,\n limegreen: 0x32cd32,\n linen: 0xfaf0e6,\n magenta: 0xff00ff,\n maroon: 0x800000,\n mediumaquamarine: 0x66cdaa,\n mediumblue: 0x0000cd,\n mediumorchid: 0xba55d3,\n mediumpurple: 0x9370db,\n mediumseagreen: 0x3cb371,\n mediumslateblue: 0x7b68ee,\n mediumspringgreen: 0x00fa9a,\n mediumturquoise: 0x48d1cc,\n mediumvioletred: 0xc71585,\n midnightblue: 0x191970,\n mintcream: 0xf5fffa,\n mistyrose: 0xffe4e1,\n moccasin: 0xffe4b5,\n navajowhite: 0xffdead,\n navy: 0x000080,\n oldlace: 0xfdf5e6,\n olive: 0x808000,\n olivedrab: 0x6b8e23,\n orange: 0xffa500,\n orangered: 0xff4500,\n orchid: 0xda70d6,\n palegoldenrod: 0xeee8aa,\n palegreen: 0x98fb98,\n paleturquoise: 0xafeeee,\n palevioletred: 0xdb7093,\n papayawhip: 0xffefd5,\n peachpuff: 0xffdab9,\n peru: 0xcd853f,\n pink: 0xffc0cb,\n plum: 0xdda0dd,\n powderblue: 0xb0e0e6,\n purple: 0x800080,\n rebeccapurple: 0x663399,\n red: 0xff0000,\n rosybrown: 0xbc8f8f,\n royalblue: 0x4169e1,\n saddlebrown: 0x8b4513,\n salmon: 0xfa8072,\n sandybrown: 0xf4a460,\n seagreen: 0x2e8b57,\n seashell: 0xfff5ee,\n sienna: 0xa0522d,\n silver: 0xc0c0c0,\n skyblue: 0x87ceeb,\n slateblue: 0x6a5acd,\n slategray: 0x708090,\n slategrey: 0x708090,\n snow: 0xfffafa,\n springgreen: 0x00ff7f,\n steelblue: 0x4682b4,\n tan: 0xd2b48c,\n teal: 0x008080,\n thistle: 0xd8bfd8,\n tomato: 0xff6347,\n turquoise: 0x40e0d0,\n violet: 0xee82ee,\n wheat: 0xf5deb3,\n white: 0xffffff,\n whitesmoke: 0xf5f5f5,\n yellow: 0xffff00,\n yellowgreen: 0x9acd32\n};\n\ndefine(Color, color, {\n copy(channels) {\n return Object.assign(new this.constructor, this, channels);\n },\n displayable() {\n return this.rgb().displayable();\n },\n hex: color_formatHex, // Deprecated! Use color.formatHex.\n formatHex: color_formatHex,\n formatHex8: color_formatHex8,\n formatHsl: color_formatHsl,\n formatRgb: color_formatRgb,\n toString: color_formatRgb\n});\n\nfunction color_formatHex() {\n return this.rgb().formatHex();\n}\n\nfunction color_formatHex8() {\n return this.rgb().formatHex8();\n}\n\nfunction color_formatHsl() {\n return hslConvert(this).formatHsl();\n}\n\nfunction color_formatRgb() {\n return this.rgb().formatRgb();\n}\n\nexport default function color(format) {\n var m, l;\n format = (format + \"\").trim().toLowerCase();\n return (m = reHex.exec(format)) ? (l = m[1].length, m = parseInt(m[1], 16), l === 6 ? rgbn(m) // #ff0000\n : l === 3 ? new Rgb((m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), ((m & 0xf) << 4) | (m & 0xf), 1) // #f00\n : l === 8 ? rgba(m >> 24 & 0xff, m >> 16 & 0xff, m >> 8 & 0xff, (m & 0xff) / 0xff) // #ff000000\n : l === 4 ? rgba((m >> 12 & 0xf) | (m >> 8 & 0xf0), (m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), (((m & 0xf) << 4) | (m & 0xf)) / 0xff) // #f000\n : null) // invalid hex\n : (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) // rgb(255, 0, 0)\n : (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) // rgb(100%, 0%, 0%)\n : (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4]) // rgba(255, 0, 0, 1)\n : (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) // rgb(100%, 0%, 0%, 1)\n : (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) // hsl(120, 50%, 50%)\n : (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) // hsla(120, 50%, 50%, 1)\n : named.hasOwnProperty(format) ? rgbn(named[format]) // eslint-disable-line no-prototype-builtins\n : format === \"transparent\" ? new Rgb(NaN, NaN, NaN, 0)\n : null;\n}\n\nfunction rgbn(n) {\n return new Rgb(n >> 16 & 0xff, n >> 8 & 0xff, n & 0xff, 1);\n}\n\nfunction rgba(r, g, b, a) {\n if (a <= 0) r = g = b = NaN;\n return new Rgb(r, g, b, a);\n}\n\nexport function rgbConvert(o) {\n if (!(o instanceof Color)) o = color(o);\n if (!o) return new Rgb;\n o = o.rgb();\n return new Rgb(o.r, o.g, o.b, o.opacity);\n}\n\nexport function rgb(r, g, b, opacity) {\n return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity);\n}\n\nexport function Rgb(r, g, b, opacity) {\n this.r = +r;\n this.g = +g;\n this.b = +b;\n this.opacity = +opacity;\n}\n\ndefine(Rgb, rgb, extend(Color, {\n brighter(k) {\n k = k == null ? brighter : Math.pow(brighter, k);\n return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);\n },\n darker(k) {\n k = k == null ? darker : Math.pow(darker, k);\n return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);\n },\n rgb() {\n return this;\n },\n clamp() {\n return new Rgb(clampi(this.r), clampi(this.g), clampi(this.b), clampa(this.opacity));\n },\n displayable() {\n return (-0.5 <= this.r && this.r < 255.5)\n && (-0.5 <= this.g && this.g < 255.5)\n && (-0.5 <= this.b && this.b < 255.5)\n && (0 <= this.opacity && this.opacity <= 1);\n },\n hex: rgb_formatHex, // Deprecated! Use color.formatHex.\n formatHex: rgb_formatHex,\n formatHex8: rgb_formatHex8,\n formatRgb: rgb_formatRgb,\n toString: rgb_formatRgb\n}));\n\nfunction rgb_formatHex() {\n return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}`;\n}\n\nfunction rgb_formatHex8() {\n return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}${hex((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`;\n}\n\nfunction rgb_formatRgb() {\n const a = clampa(this.opacity);\n return `${a === 1 ? \"rgb(\" : \"rgba(\"}${clampi(this.r)}, ${clampi(this.g)}, ${clampi(this.b)}${a === 1 ? \")\" : `, ${a})`}`;\n}\n\nfunction clampa(opacity) {\n return isNaN(opacity) ? 1 : Math.max(0, Math.min(1, opacity));\n}\n\nfunction clampi(value) {\n return Math.max(0, Math.min(255, Math.round(value) || 0));\n}\n\nfunction hex(value) {\n value = clampi(value);\n return (value < 16 ? \"0\" : \"\") + value.toString(16);\n}\n\nfunction hsla(h, s, l, a) {\n if (a <= 0) h = s = l = NaN;\n else if (l <= 0 || l >= 1) h = s = NaN;\n else if (s <= 0) h = NaN;\n return new Hsl(h, s, l, a);\n}\n\nexport function hslConvert(o) {\n if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity);\n if (!(o instanceof Color)) o = color(o);\n if (!o) return new Hsl;\n if (o instanceof Hsl) return o;\n o = o.rgb();\n var r = o.r / 255,\n g = o.g / 255,\n b = o.b / 255,\n min = Math.min(r, g, b),\n max = Math.max(r, g, b),\n h = NaN,\n s = max - min,\n l = (max + min) / 2;\n if (s) {\n if (r === max) h = (g - b) / s + (g < b) * 6;\n else if (g === max) h = (b - r) / s + 2;\n else h = (r - g) / s + 4;\n s /= l < 0.5 ? max + min : 2 - max - min;\n h *= 60;\n } else {\n s = l > 0 && l < 1 ? 0 : h;\n }\n return new Hsl(h, s, l, o.opacity);\n}\n\nexport function hsl(h, s, l, opacity) {\n return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity);\n}\n\nfunction Hsl(h, s, l, opacity) {\n this.h = +h;\n this.s = +s;\n this.l = +l;\n this.opacity = +opacity;\n}\n\ndefine(Hsl, hsl, extend(Color, {\n brighter(k) {\n k = k == null ? brighter : Math.pow(brighter, k);\n return new Hsl(this.h, this.s, this.l * k, this.opacity);\n },\n darker(k) {\n k = k == null ? darker : Math.pow(darker, k);\n return new Hsl(this.h, this.s, this.l * k, this.opacity);\n },\n rgb() {\n var h = this.h % 360 + (this.h < 0) * 360,\n s = isNaN(h) || isNaN(this.s) ? 0 : this.s,\n l = this.l,\n m2 = l + (l < 0.5 ? l : 1 - l) * s,\n m1 = 2 * l - m2;\n return new Rgb(\n hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2),\n hsl2rgb(h, m1, m2),\n hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2),\n this.opacity\n );\n },\n clamp() {\n return new Hsl(clamph(this.h), clampt(this.s), clampt(this.l), clampa(this.opacity));\n },\n displayable() {\n return (0 <= this.s && this.s <= 1 || isNaN(this.s))\n && (0 <= this.l && this.l <= 1)\n && (0 <= this.opacity && this.opacity <= 1);\n },\n formatHsl() {\n const a = clampa(this.opacity);\n return `${a === 1 ? \"hsl(\" : \"hsla(\"}${clamph(this.h)}, ${clampt(this.s) * 100}%, ${clampt(this.l) * 100}%${a === 1 ? \")\" : `, ${a})`}`;\n }\n}));\n\nfunction clamph(value) {\n value = (value || 0) % 360;\n return value < 0 ? value + 360 : value;\n}\n\nfunction clampt(value) {\n return Math.max(0, Math.min(1, value || 0));\n}\n\n/* From FvD 13.37, CSS Color Module Level 3 */\nfunction hsl2rgb(h, m1, m2) {\n return (h < 60 ? m1 + (m2 - m1) * h / 60\n : h < 180 ? m2\n : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60\n : m1) * 255;\n}\n","export function basis(t1, v0, v1, v2, v3) {\n var t2 = t1 * t1, t3 = t2 * t1;\n return ((1 - 3 * t1 + 3 * t2 - t3) * v0\n + (4 - 6 * t2 + 3 * t3) * v1\n + (1 + 3 * t1 + 3 * t2 - 3 * t3) * v2\n + t3 * v3) / 6;\n}\n\nexport default function(values) {\n var n = values.length - 1;\n return function(t) {\n var i = t <= 0 ? (t = 0) : t >= 1 ? (t = 1, n - 1) : Math.floor(t * n),\n v1 = values[i],\n v2 = values[i + 1],\n v0 = i > 0 ? values[i - 1] : 2 * v1 - v2,\n v3 = i < n - 1 ? values[i + 2] : 2 * v2 - v1;\n return basis((t - i / n) * n, v0, v1, v2, v3);\n };\n}\n","export default x => () => x;\n","import constant from \"./constant.js\";\n\nfunction linear(a, d) {\n return function(t) {\n return a + t * d;\n };\n}\n\nfunction exponential(a, b, y) {\n return a = Math.pow(a, y), b = Math.pow(b, y) - a, y = 1 / y, function(t) {\n return Math.pow(a + t * b, y);\n };\n}\n\nexport function hue(a, b) {\n var d = b - a;\n return d ? linear(a, d > 180 || d < -180 ? d - 360 * Math.round(d / 360) : d) : constant(isNaN(a) ? b : a);\n}\n\nexport function gamma(y) {\n return (y = +y) === 1 ? nogamma : function(a, b) {\n return b - a ? exponential(a, b, y) : constant(isNaN(a) ? b : a);\n };\n}\n\nexport default function nogamma(a, b) {\n var d = b - a;\n return d ? linear(a, d) : constant(isNaN(a) ? b : a);\n}\n","import {rgb as colorRgb} from \"d3-color\";\nimport basis from \"./basis.js\";\nimport basisClosed from \"./basisClosed.js\";\nimport nogamma, {gamma} from \"./color.js\";\n\nexport default (function rgbGamma(y) {\n var color = gamma(y);\n\n function rgb(start, end) {\n var r = color((start = colorRgb(start)).r, (end = colorRgb(end)).r),\n g = color(start.g, end.g),\n b = color(start.b, end.b),\n opacity = nogamma(start.opacity, end.opacity);\n return function(t) {\n start.r = r(t);\n start.g = g(t);\n start.b = b(t);\n start.opacity = opacity(t);\n return start + \"\";\n };\n }\n\n rgb.gamma = rgbGamma;\n\n return rgb;\n})(1);\n\nfunction rgbSpline(spline) {\n return function(colors) {\n var n = colors.length,\n r = new Array(n),\n g = new Array(n),\n b = new Array(n),\n i, color;\n for (i = 0; i < n; ++i) {\n color = colorRgb(colors[i]);\n r[i] = color.r || 0;\n g[i] = color.g || 0;\n b[i] = color.b || 0;\n }\n r = spline(r);\n g = spline(g);\n b = spline(b);\n color.opacity = 1;\n return function(t) {\n color.r = r(t);\n color.g = g(t);\n color.b = b(t);\n return color + \"\";\n };\n };\n}\n\nexport var rgbBasis = rgbSpline(basis);\nexport var rgbBasisClosed = rgbSpline(basisClosed);\n","import {basis} from \"./basis.js\";\n\nexport default function(values) {\n var n = values.length;\n return function(t) {\n var i = Math.floor(((t %= 1) < 0 ? ++t : t) * n),\n v0 = values[(i + n - 1) % n],\n v1 = values[i % n],\n v2 = values[(i + 1) % n],\n v3 = values[(i + 2) % n];\n return basis((t - i / n) * n, v0, v1, v2, v3);\n };\n}\n","import number from \"./number.js\";\n\nvar reA = /[-+]?(?:\\d+\\.?\\d*|\\.?\\d+)(?:[eE][-+]?\\d+)?/g,\n reB = new RegExp(reA.source, \"g\");\n\nfunction zero(b) {\n return function() {\n return b;\n };\n}\n\nfunction one(b) {\n return function(t) {\n return b(t) + \"\";\n };\n}\n\nexport default function(a, b) {\n var bi = reA.lastIndex = reB.lastIndex = 0, // scan index for next number in b\n am, // current match in a\n bm, // current match in b\n bs, // string preceding current number in b, if any\n i = -1, // index in s\n s = [], // string constants and placeholders\n q = []; // number interpolators\n\n // Coerce inputs to strings.\n a = a + \"\", b = b + \"\";\n\n // Interpolate pairs of numbers in a & b.\n while ((am = reA.exec(a))\n && (bm = reB.exec(b))) {\n if ((bs = bm.index) > bi) { // a string precedes the next number in b\n bs = b.slice(bi, bs);\n if (s[i]) s[i] += bs; // coalesce with previous string\n else s[++i] = bs;\n }\n if ((am = am[0]) === (bm = bm[0])) { // numbers in a & b match\n if (s[i]) s[i] += bm; // coalesce with previous string\n else s[++i] = bm;\n } else { // interpolate non-matching numbers\n s[++i] = null;\n q.push({i: i, x: number(am, bm)});\n }\n bi = reB.lastIndex;\n }\n\n // Add remains of b.\n if (bi < b.length) {\n bs = b.slice(bi);\n if (s[i]) s[i] += bs; // coalesce with previous string\n else s[++i] = bs;\n }\n\n // Special optimization for only a single match.\n // Otherwise, interpolate each of the numbers and rejoin the string.\n return s.length < 2 ? (q[0]\n ? one(q[0].x)\n : zero(b))\n : (b = q.length, function(t) {\n for (var i = 0, o; i < b; ++i) s[(o = q[i]).i] = o.x(t);\n return s.join(\"\");\n });\n}\n","import {color} from \"d3-color\";\nimport {interpolateNumber, interpolateRgb, interpolateString} from \"d3-interpolate\";\n\nexport default function(a, b) {\n var c;\n return (typeof b === \"number\" ? interpolateNumber\n : b instanceof color ? interpolateRgb\n : (c = color(b)) ? (b = c, interpolateRgb)\n : interpolateString)(a, b);\n}\n","import {interpolateTransformSvg as interpolateTransform} from \"d3-interpolate\";\nimport {namespace} from \"d3-selection\";\nimport {tweenValue} from \"./tween.js\";\nimport interpolate from \"./interpolate.js\";\n\nfunction attrRemove(name) {\n return function() {\n this.removeAttribute(name);\n };\n}\n\nfunction attrRemoveNS(fullname) {\n return function() {\n this.removeAttributeNS(fullname.space, fullname.local);\n };\n}\n\nfunction attrConstant(name, interpolate, value1) {\n var string00,\n string1 = value1 + \"\",\n interpolate0;\n return function() {\n var string0 = this.getAttribute(name);\n return string0 === string1 ? null\n : string0 === string00 ? interpolate0\n : interpolate0 = interpolate(string00 = string0, value1);\n };\n}\n\nfunction attrConstantNS(fullname, interpolate, value1) {\n var string00,\n string1 = value1 + \"\",\n interpolate0;\n return function() {\n var string0 = this.getAttributeNS(fullname.space, fullname.local);\n return string0 === string1 ? null\n : string0 === string00 ? interpolate0\n : interpolate0 = interpolate(string00 = string0, value1);\n };\n}\n\nfunction attrFunction(name, interpolate, value) {\n var string00,\n string10,\n interpolate0;\n return function() {\n var string0, value1 = value(this), string1;\n if (value1 == null) return void this.removeAttribute(name);\n string0 = this.getAttribute(name);\n string1 = value1 + \"\";\n return string0 === string1 ? null\n : string0 === string00 && string1 === string10 ? interpolate0\n : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));\n };\n}\n\nfunction attrFunctionNS(fullname, interpolate, value) {\n var string00,\n string10,\n interpolate0;\n return function() {\n var string0, value1 = value(this), string1;\n if (value1 == null) return void this.removeAttributeNS(fullname.space, fullname.local);\n string0 = this.getAttributeNS(fullname.space, fullname.local);\n string1 = value1 + \"\";\n return string0 === string1 ? null\n : string0 === string00 && string1 === string10 ? interpolate0\n : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));\n };\n}\n\nexport default function(name, value) {\n var fullname = namespace(name), i = fullname === \"transform\" ? interpolateTransform : interpolate;\n return this.attrTween(name, typeof value === \"function\"\n ? (fullname.local ? attrFunctionNS : attrFunction)(fullname, i, tweenValue(this, \"attr.\" + name, value))\n : value == null ? (fullname.local ? attrRemoveNS : attrRemove)(fullname)\n : (fullname.local ? attrConstantNS : attrConstant)(fullname, i, value));\n}\n","import {namespace} from \"d3-selection\";\n\nfunction attrInterpolate(name, i) {\n return function(t) {\n this.setAttribute(name, i.call(this, t));\n };\n}\n\nfunction attrInterpolateNS(fullname, i) {\n return function(t) {\n this.setAttributeNS(fullname.space, fullname.local, i.call(this, t));\n };\n}\n\nfunction attrTweenNS(fullname, value) {\n var t0, i0;\n function tween() {\n var i = value.apply(this, arguments);\n if (i !== i0) t0 = (i0 = i) && attrInterpolateNS(fullname, i);\n return t0;\n }\n tween._value = value;\n return tween;\n}\n\nfunction attrTween(name, value) {\n var t0, i0;\n function tween() {\n var i = value.apply(this, arguments);\n if (i !== i0) t0 = (i0 = i) && attrInterpolate(name, i);\n return t0;\n }\n tween._value = value;\n return tween;\n}\n\nexport default function(name, value) {\n var key = \"attr.\" + name;\n if (arguments.length < 2) return (key = this.tween(key)) && key._value;\n if (value == null) return this.tween(key, null);\n if (typeof value !== \"function\") throw new Error;\n var fullname = namespace(name);\n return this.tween(key, (fullname.local ? attrTweenNS : attrTween)(fullname, value));\n}\n","import {get, init} from \"./schedule.js\";\n\nfunction delayFunction(id, value) {\n return function() {\n init(this, id).delay = +value.apply(this, arguments);\n };\n}\n\nfunction delayConstant(id, value) {\n return value = +value, function() {\n init(this, id).delay = value;\n };\n}\n\nexport default function(value) {\n var id = this._id;\n\n return arguments.length\n ? this.each((typeof value === \"function\"\n ? delayFunction\n : delayConstant)(id, value))\n : get(this.node(), id).delay;\n}\n","import {get, set} from \"./schedule.js\";\n\nfunction durationFunction(id, value) {\n return function() {\n set(this, id).duration = +value.apply(this, arguments);\n };\n}\n\nfunction durationConstant(id, value) {\n return value = +value, function() {\n set(this, id).duration = value;\n };\n}\n\nexport default function(value) {\n var id = this._id;\n\n return arguments.length\n ? this.each((typeof value === \"function\"\n ? durationFunction\n : durationConstant)(id, value))\n : get(this.node(), id).duration;\n}\n","import {selection} from \"d3-selection\";\n\nvar Selection = selection.prototype.constructor;\n\nexport default function() {\n return new Selection(this._groups, this._parents);\n}\n","import {interpolateTransformCss as interpolateTransform} from \"d3-interpolate\";\nimport {style} from \"d3-selection\";\nimport {set} from \"./schedule.js\";\nimport {tweenValue} from \"./tween.js\";\nimport interpolate from \"./interpolate.js\";\n\nfunction styleNull(name, interpolate) {\n var string00,\n string10,\n interpolate0;\n return function() {\n var string0 = style(this, name),\n string1 = (this.style.removeProperty(name), style(this, name));\n return string0 === string1 ? null\n : string0 === string00 && string1 === string10 ? interpolate0\n : interpolate0 = interpolate(string00 = string0, string10 = string1);\n };\n}\n\nfunction styleRemove(name) {\n return function() {\n this.style.removeProperty(name);\n };\n}\n\nfunction styleConstant(name, interpolate, value1) {\n var string00,\n string1 = value1 + \"\",\n interpolate0;\n return function() {\n var string0 = style(this, name);\n return string0 === string1 ? null\n : string0 === string00 ? interpolate0\n : interpolate0 = interpolate(string00 = string0, value1);\n };\n}\n\nfunction styleFunction(name, interpolate, value) {\n var string00,\n string10,\n interpolate0;\n return function() {\n var string0 = style(this, name),\n value1 = value(this),\n string1 = value1 + \"\";\n if (value1 == null) string1 = value1 = (this.style.removeProperty(name), style(this, name));\n return string0 === string1 ? null\n : string0 === string00 && string1 === string10 ? interpolate0\n : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));\n };\n}\n\nfunction styleMaybeRemove(id, name) {\n var on0, on1, listener0, key = \"style.\" + name, event = \"end.\" + key, remove;\n return function() {\n var schedule = set(this, id),\n on = schedule.on,\n listener = schedule.value[key] == null ? remove || (remove = styleRemove(name)) : undefined;\n\n // If this node shared a dispatch with the previous node,\n // just assign the updated shared dispatch and we’re done!\n // Otherwise, copy-on-write.\n if (on !== on0 || listener0 !== listener) (on1 = (on0 = on).copy()).on(event, listener0 = listener);\n\n schedule.on = on1;\n };\n}\n\nexport default function(name, value, priority) {\n var i = (name += \"\") === \"transform\" ? interpolateTransform : interpolate;\n return value == null ? this\n .styleTween(name, styleNull(name, i))\n .on(\"end.style.\" + name, styleRemove(name))\n : typeof value === \"function\" ? this\n .styleTween(name, styleFunction(name, i, tweenValue(this, \"style.\" + name, value)))\n .each(styleMaybeRemove(this._id, name))\n : this\n .styleTween(name, styleConstant(name, i, value), priority)\n .on(\"end.style.\" + name, null);\n}\n","import {selection} from \"d3-selection\";\nimport transition_attr from \"./attr.js\";\nimport transition_attrTween from \"./attrTween.js\";\nimport transition_delay from \"./delay.js\";\nimport transition_duration from \"./duration.js\";\nimport transition_ease from \"./ease.js\";\nimport transition_easeVarying from \"./easeVarying.js\";\nimport transition_filter from \"./filter.js\";\nimport transition_merge from \"./merge.js\";\nimport transition_on from \"./on.js\";\nimport transition_remove from \"./remove.js\";\nimport transition_select from \"./select.js\";\nimport transition_selectAll from \"./selectAll.js\";\nimport transition_selection from \"./selection.js\";\nimport transition_style from \"./style.js\";\nimport transition_styleTween from \"./styleTween.js\";\nimport transition_text from \"./text.js\";\nimport transition_textTween from \"./textTween.js\";\nimport transition_transition from \"./transition.js\";\nimport transition_tween from \"./tween.js\";\nimport transition_end from \"./end.js\";\n\nvar id = 0;\n\nexport function Transition(groups, parents, name, id) {\n this._groups = groups;\n this._parents = parents;\n this._name = name;\n this._id = id;\n}\n\nexport default function transition(name) {\n return selection().transition(name);\n}\n\nexport function newId() {\n return ++id;\n}\n\nvar selection_prototype = selection.prototype;\n\nTransition.prototype = transition.prototype = {\n constructor: Transition,\n select: transition_select,\n selectAll: transition_selectAll,\n selectChild: selection_prototype.selectChild,\n selectChildren: selection_prototype.selectChildren,\n filter: transition_filter,\n merge: transition_merge,\n selection: transition_selection,\n transition: transition_transition,\n call: selection_prototype.call,\n nodes: selection_prototype.nodes,\n node: selection_prototype.node,\n size: selection_prototype.size,\n empty: selection_prototype.empty,\n each: selection_prototype.each,\n on: transition_on,\n attr: transition_attr,\n attrTween: transition_attrTween,\n style: transition_style,\n styleTween: transition_styleTween,\n text: transition_text,\n textTween: transition_textTween,\n remove: transition_remove,\n tween: transition_tween,\n delay: transition_delay,\n duration: transition_duration,\n ease: transition_ease,\n easeVarying: transition_easeVarying,\n end: transition_end,\n [Symbol.iterator]: selection_prototype[Symbol.iterator]\n};\n","import {selector} from \"d3-selection\";\nimport {Transition} from \"./index.js\";\nimport schedule, {get} from \"./schedule.js\";\n\nexport default function(select) {\n var name = this._name,\n id = this._id;\n\n if (typeof select !== \"function\") select = selector(select);\n\n for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, subgroup = subgroups[j] = new Array(n), node, subnode, i = 0; i < n; ++i) {\n if ((node = group[i]) && (subnode = select.call(node, node.__data__, i, group))) {\n if (\"__data__\" in node) subnode.__data__ = node.__data__;\n subgroup[i] = subnode;\n schedule(subgroup[i], name, id, i, subgroup, get(node, id));\n }\n }\n }\n\n return new Transition(subgroups, this._parents, name, id);\n}\n","import {selectorAll} from \"d3-selection\";\nimport {Transition} from \"./index.js\";\nimport schedule, {get} from \"./schedule.js\";\n\nexport default function(select) {\n var name = this._name,\n id = this._id;\n\n if (typeof select !== \"function\") select = selectorAll(select);\n\n for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {\n if (node = group[i]) {\n for (var children = select.call(node, node.__data__, i, group), child, inherit = get(node, id), k = 0, l = children.length; k < l; ++k) {\n if (child = children[k]) {\n schedule(child, name, id, k, children, inherit);\n }\n }\n subgroups.push(children);\n parents.push(node);\n }\n }\n }\n\n return new Transition(subgroups, parents, name, id);\n}\n","import {matcher} from \"d3-selection\";\nimport {Transition} from \"./index.js\";\n\nexport default function(match) {\n if (typeof match !== \"function\") match = matcher(match);\n\n for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, subgroup = subgroups[j] = [], node, i = 0; i < n; ++i) {\n if ((node = group[i]) && match.call(node, node.__data__, i, group)) {\n subgroup.push(node);\n }\n }\n }\n\n return new Transition(subgroups, this._parents, this._name, this._id);\n}\n","import {Transition} from \"./index.js\";\n\nexport default function(transition) {\n if (transition._id !== this._id) throw new Error;\n\n for (var groups0 = this._groups, groups1 = transition._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j = 0; j < m; ++j) {\n for (var group0 = groups0[j], group1 = groups1[j], n = group0.length, merge = merges[j] = new Array(n), node, i = 0; i < n; ++i) {\n if (node = group0[i] || group1[i]) {\n merge[i] = node;\n }\n }\n }\n\n for (; j < m0; ++j) {\n merges[j] = groups0[j];\n }\n\n return new Transition(merges, this._parents, this._name, this._id);\n}\n","import {Transition, newId} from \"./index.js\";\nimport schedule, {get} from \"./schedule.js\";\n\nexport default function() {\n var name = this._name,\n id0 = this._id,\n id1 = newId();\n\n for (var groups = this._groups, m = groups.length, j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {\n if (node = group[i]) {\n var inherit = get(node, id0);\n schedule(node, name, id1, i, group, {\n time: inherit.time + inherit.delay + inherit.duration,\n delay: 0,\n duration: inherit.duration,\n ease: inherit.ease\n });\n }\n }\n }\n\n return new Transition(groups, this._parents, name, id1);\n}\n","import {get, set, init} from \"./schedule.js\";\n\nfunction start(name) {\n return (name + \"\").trim().split(/^|\\s+/).every(function(t) {\n var i = t.indexOf(\".\");\n if (i >= 0) t = t.slice(0, i);\n return !t || t === \"start\";\n });\n}\n\nfunction onFunction(id, name, listener) {\n var on0, on1, sit = start(name) ? init : set;\n return function() {\n var schedule = sit(this, id),\n on = schedule.on;\n\n // If this node shared a dispatch with the previous node,\n // just assign the updated shared dispatch and we’re done!\n // Otherwise, copy-on-write.\n if (on !== on0) (on1 = (on0 = on).copy()).on(name, listener);\n\n schedule.on = on1;\n };\n}\n\nexport default function(name, listener) {\n var id = this._id;\n\n return arguments.length < 2\n ? get(this.node(), id).on.on(name)\n : this.each(onFunction(id, name, listener));\n}\n","function styleInterpolate(name, i, priority) {\n return function(t) {\n this.style.setProperty(name, i.call(this, t), priority);\n };\n}\n\nfunction styleTween(name, value, priority) {\n var t, i0;\n function tween() {\n var i = value.apply(this, arguments);\n if (i !== i0) t = (i0 = i) && styleInterpolate(name, i, priority);\n return t;\n }\n tween._value = value;\n return tween;\n}\n\nexport default function(name, value, priority) {\n var key = \"style.\" + (name += \"\");\n if (arguments.length < 2) return (key = this.tween(key)) && key._value;\n if (value == null) return this.tween(key, null);\n if (typeof value !== \"function\") throw new Error;\n return this.tween(key, styleTween(name, value, priority == null ? \"\" : priority));\n}\n","import {tweenValue} from \"./tween.js\";\n\nfunction textConstant(value) {\n return function() {\n this.textContent = value;\n };\n}\n\nfunction textFunction(value) {\n return function() {\n var value1 = value(this);\n this.textContent = value1 == null ? \"\" : value1;\n };\n}\n\nexport default function(value) {\n return this.tween(\"text\", typeof value === \"function\"\n ? textFunction(tweenValue(this, \"text\", value))\n : textConstant(value == null ? \"\" : value + \"\"));\n}\n","function textInterpolate(i) {\n return function(t) {\n this.textContent = i.call(this, t);\n };\n}\n\nfunction textTween(value) {\n var t0, i0;\n function tween() {\n var i = value.apply(this, arguments);\n if (i !== i0) t0 = (i0 = i) && textInterpolate(i);\n return t0;\n }\n tween._value = value;\n return tween;\n}\n\nexport default function(value) {\n var key = \"text\";\n if (arguments.length < 1) return (key = this.tween(key)) && key._value;\n if (value == null) return this.tween(key, null);\n if (typeof value !== \"function\") throw new Error;\n return this.tween(key, textTween(value));\n}\n","function removeFunction(id) {\n return function() {\n var parent = this.parentNode;\n for (var i in this.__transition) if (+i !== id) return;\n if (parent) parent.removeChild(this);\n };\n}\n\nexport default function() {\n return this.on(\"end.remove\", removeFunction(this._id));\n}\n","import {get, set} from \"./schedule.js\";\n\nfunction easeConstant(id, value) {\n if (typeof value !== \"function\") throw new Error;\n return function() {\n set(this, id).ease = value;\n };\n}\n\nexport default function(value) {\n var id = this._id;\n\n return arguments.length\n ? this.each(easeConstant(id, value))\n : get(this.node(), id).ease;\n}\n","import {set} from \"./schedule.js\";\n\nfunction easeVarying(id, value) {\n return function() {\n var v = value.apply(this, arguments);\n if (typeof v !== \"function\") throw new Error;\n set(this, id).ease = v;\n };\n}\n\nexport default function(value) {\n if (typeof value !== \"function\") throw new Error;\n return this.each(easeVarying(this._id, value));\n}\n","import {set} from \"./schedule.js\";\n\nexport default function() {\n var on0, on1, that = this, id = that._id, size = that.size();\n return new Promise(function(resolve, reject) {\n var cancel = {value: reject},\n end = {value: function() { if (--size === 0) resolve(); }};\n\n that.each(function() {\n var schedule = set(this, id),\n on = schedule.on;\n\n // If this node shared a dispatch with the previous node,\n // just assign the updated shared dispatch and we’re done!\n // Otherwise, copy-on-write.\n if (on !== on0) {\n on1 = (on0 = on).copy();\n on1._.cancel.push(cancel);\n on1._.interrupt.push(cancel);\n on1._.end.push(end);\n }\n\n schedule.on = on1;\n });\n\n // The selection was empty, resolve end immediately\n if (size === 0) resolve();\n });\n}\n","import {Transition, newId} from \"../transition/index.js\";\nimport schedule from \"../transition/schedule.js\";\nimport {easeCubicInOut} from \"d3-ease\";\nimport {now} from \"d3-timer\";\n\nvar defaultTiming = {\n time: null, // Set on use.\n delay: 0,\n duration: 250,\n ease: easeCubicInOut\n};\n\nfunction inherit(node, id) {\n var timing;\n while (!(timing = node.__transition) || !(timing = timing[id])) {\n if (!(node = node.parentNode)) {\n throw new Error(`transition ${id} not found`);\n }\n }\n return timing;\n}\n\nexport default function(name) {\n var id,\n timing;\n\n if (name instanceof Transition) {\n id = name._id, name = name._name;\n } else {\n id = newId(), (timing = defaultTiming).time = now(), name = name == null ? null : name + \"\";\n }\n\n for (var groups = this._groups, m = groups.length, j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {\n if (node = group[i]) {\n schedule(node, name, id, i, group, timing || inherit(node, id));\n }\n }\n }\n\n return new Transition(groups, this._parents, name, id);\n}\n","export function cubicIn(t) {\n return t * t * t;\n}\n\nexport function cubicOut(t) {\n return --t * t * t + 1;\n}\n\nexport function cubicInOut(t) {\n return ((t *= 2) <= 1 ? t * t * t : (t -= 2) * t * t + 2) / 2;\n}\n","import {selection} from \"d3-selection\";\nimport selection_interrupt from \"./interrupt.js\";\nimport selection_transition from \"./transition.js\";\n\nselection.prototype.interrupt = selection_interrupt;\nselection.prototype.transition = selection_transition;\n","import interrupt from \"../interrupt.js\";\n\nexport default function(name) {\n return this.each(function() {\n interrupt(this, name);\n });\n}\n","import {STARTING, ENDING, ENDED} from \"./transition/schedule.js\";\n\nexport default function(node, name) {\n var schedules = node.__transition,\n schedule,\n active,\n empty = true,\n i;\n\n if (!schedules) return;\n\n name = name == null ? null : name + \"\";\n\n for (i in schedules) {\n if ((schedule = schedules[i]).name !== name) { empty = false; continue; }\n active = schedule.state > STARTING && schedule.state < ENDING;\n schedule.state = ENDED;\n schedule.timer.stop();\n schedule.on.call(active ? \"interrupt\" : \"cancel\", node, node.__data__, schedule.index, schedule.group);\n delete schedules[i];\n }\n\n if (empty) delete node.__transition;\n}\n","import {dispatch} from \"d3-dispatch\";\nimport {dragDisable, dragEnable} from \"d3-drag\";\nimport {interpolate} from \"d3-interpolate\";\nimport {pointer, select} from \"d3-selection\";\nimport {interrupt} from \"d3-transition\";\nimport constant from \"./constant.js\";\nimport BrushEvent from \"./event.js\";\nimport noevent, {nopropagation} from \"./noevent.js\";\n\nvar MODE_DRAG = {name: \"drag\"},\n MODE_SPACE = {name: \"space\"},\n MODE_HANDLE = {name: \"handle\"},\n MODE_CENTER = {name: \"center\"};\n\nconst {abs, max, min} = Math;\n\nfunction number1(e) {\n return [+e[0], +e[1]];\n}\n\nfunction number2(e) {\n return [number1(e[0]), number1(e[1])];\n}\n\nvar X = {\n name: \"x\",\n handles: [\"w\", \"e\"].map(type),\n input: function(x, e) { return x == null ? null : [[+x[0], e[0][1]], [+x[1], e[1][1]]]; },\n output: function(xy) { return xy && [xy[0][0], xy[1][0]]; }\n};\n\nvar Y = {\n name: \"y\",\n handles: [\"n\", \"s\"].map(type),\n input: function(y, e) { return y == null ? null : [[e[0][0], +y[0]], [e[1][0], +y[1]]]; },\n output: function(xy) { return xy && [xy[0][1], xy[1][1]]; }\n};\n\nvar XY = {\n name: \"xy\",\n handles: [\"n\", \"w\", \"e\", \"s\", \"nw\", \"ne\", \"sw\", \"se\"].map(type),\n input: function(xy) { return xy == null ? null : number2(xy); },\n output: function(xy) { return xy; }\n};\n\nvar cursors = {\n overlay: \"crosshair\",\n selection: \"move\",\n n: \"ns-resize\",\n e: \"ew-resize\",\n s: \"ns-resize\",\n w: \"ew-resize\",\n nw: \"nwse-resize\",\n ne: \"nesw-resize\",\n se: \"nwse-resize\",\n sw: \"nesw-resize\"\n};\n\nvar flipX = {\n e: \"w\",\n w: \"e\",\n nw: \"ne\",\n ne: \"nw\",\n se: \"sw\",\n sw: \"se\"\n};\n\nvar flipY = {\n n: \"s\",\n s: \"n\",\n nw: \"sw\",\n ne: \"se\",\n se: \"ne\",\n sw: \"nw\"\n};\n\nvar signsX = {\n overlay: +1,\n selection: +1,\n n: null,\n e: +1,\n s: null,\n w: -1,\n nw: -1,\n ne: +1,\n se: +1,\n sw: -1\n};\n\nvar signsY = {\n overlay: +1,\n selection: +1,\n n: -1,\n e: null,\n s: +1,\n w: null,\n nw: -1,\n ne: -1,\n se: +1,\n sw: +1\n};\n\nfunction type(t) {\n return {type: t};\n}\n\n// Ignore right-click, since that should open the context menu.\nfunction defaultFilter(event) {\n return !event.ctrlKey && !event.button;\n}\n\nfunction defaultExtent() {\n var svg = this.ownerSVGElement || this;\n if (svg.hasAttribute(\"viewBox\")) {\n svg = svg.viewBox.baseVal;\n return [[svg.x, svg.y], [svg.x + svg.width, svg.y + svg.height]];\n }\n return [[0, 0], [svg.width.baseVal.value, svg.height.baseVal.value]];\n}\n\nfunction defaultTouchable() {\n return navigator.maxTouchPoints || (\"ontouchstart\" in this);\n}\n\n// Like d3.local, but with the name “__brush” rather than auto-generated.\nfunction local(node) {\n while (!node.__brush) if (!(node = node.parentNode)) return;\n return node.__brush;\n}\n\nfunction empty(extent) {\n return extent[0][0] === extent[1][0]\n || extent[0][1] === extent[1][1];\n}\n\nexport function brushSelection(node) {\n var state = node.__brush;\n return state ? state.dim.output(state.selection) : null;\n}\n\nexport function brushX() {\n return brush(X);\n}\n\nexport function brushY() {\n return brush(Y);\n}\n\nexport default function() {\n return brush(XY);\n}\n\nfunction brush(dim) {\n var extent = defaultExtent,\n filter = defaultFilter,\n touchable = defaultTouchable,\n keys = true,\n listeners = dispatch(\"start\", \"brush\", \"end\"),\n handleSize = 6,\n touchending;\n\n function brush(group) {\n var overlay = group\n .property(\"__brush\", initialize)\n .selectAll(\".overlay\")\n .data([type(\"overlay\")]);\n\n overlay.enter().append(\"rect\")\n .attr(\"class\", \"overlay\")\n .attr(\"pointer-events\", \"all\")\n .attr(\"cursor\", cursors.overlay)\n .merge(overlay)\n .each(function() {\n var extent = local(this).extent;\n select(this)\n .attr(\"x\", extent[0][0])\n .attr(\"y\", extent[0][1])\n .attr(\"width\", extent[1][0] - extent[0][0])\n .attr(\"height\", extent[1][1] - extent[0][1]);\n });\n\n group.selectAll(\".selection\")\n .data([type(\"selection\")])\n .enter().append(\"rect\")\n .attr(\"class\", \"selection\")\n .attr(\"cursor\", cursors.selection)\n .attr(\"fill\", \"#777\")\n .attr(\"fill-opacity\", 0.3)\n .attr(\"stroke\", \"#fff\")\n .attr(\"shape-rendering\", \"crispEdges\");\n\n var handle = group.selectAll(\".handle\")\n .data(dim.handles, function(d) { return d.type; });\n\n handle.exit().remove();\n\n handle.enter().append(\"rect\")\n .attr(\"class\", function(d) { return \"handle handle--\" + d.type; })\n .attr(\"cursor\", function(d) { return cursors[d.type]; });\n\n group\n .each(redraw)\n .attr(\"fill\", \"none\")\n .attr(\"pointer-events\", \"all\")\n .on(\"mousedown.brush\", started)\n .filter(touchable)\n .on(\"touchstart.brush\", started)\n .on(\"touchmove.brush\", touchmoved)\n .on(\"touchend.brush touchcancel.brush\", touchended)\n .style(\"touch-action\", \"none\")\n .style(\"-webkit-tap-highlight-color\", \"rgba(0,0,0,0)\");\n }\n\n brush.move = function(group, selection, event) {\n if (group.tween) {\n group\n .on(\"start.brush\", function(event) { emitter(this, arguments).beforestart().start(event); })\n .on(\"interrupt.brush end.brush\", function(event) { emitter(this, arguments).end(event); })\n .tween(\"brush\", function() {\n var that = this,\n state = that.__brush,\n emit = emitter(that, arguments),\n selection0 = state.selection,\n selection1 = dim.input(typeof selection === \"function\" ? selection.apply(this, arguments) : selection, state.extent),\n i = interpolate(selection0, selection1);\n\n function tween(t) {\n state.selection = t === 1 && selection1 === null ? null : i(t);\n redraw.call(that);\n emit.brush();\n }\n\n return selection0 !== null && selection1 !== null ? tween : tween(1);\n });\n } else {\n group\n .each(function() {\n var that = this,\n args = arguments,\n state = that.__brush,\n selection1 = dim.input(typeof selection === \"function\" ? selection.apply(that, args) : selection, state.extent),\n emit = emitter(that, args).beforestart();\n\n interrupt(that);\n state.selection = selection1 === null ? null : selection1;\n redraw.call(that);\n emit.start(event).brush(event).end(event);\n });\n }\n };\n\n brush.clear = function(group, event) {\n brush.move(group, null, event);\n };\n\n function redraw() {\n var group = select(this),\n selection = local(this).selection;\n\n if (selection) {\n group.selectAll(\".selection\")\n .style(\"display\", null)\n .attr(\"x\", selection[0][0])\n .attr(\"y\", selection[0][1])\n .attr(\"width\", selection[1][0] - selection[0][0])\n .attr(\"height\", selection[1][1] - selection[0][1]);\n\n group.selectAll(\".handle\")\n .style(\"display\", null)\n .attr(\"x\", function(d) { return d.type[d.type.length - 1] === \"e\" ? selection[1][0] - handleSize / 2 : selection[0][0] - handleSize / 2; })\n .attr(\"y\", function(d) { return d.type[0] === \"s\" ? selection[1][1] - handleSize / 2 : selection[0][1] - handleSize / 2; })\n .attr(\"width\", function(d) { return d.type === \"n\" || d.type === \"s\" ? selection[1][0] - selection[0][0] + handleSize : handleSize; })\n .attr(\"height\", function(d) { return d.type === \"e\" || d.type === \"w\" ? selection[1][1] - selection[0][1] + handleSize : handleSize; });\n }\n\n else {\n group.selectAll(\".selection,.handle\")\n .style(\"display\", \"none\")\n .attr(\"x\", null)\n .attr(\"y\", null)\n .attr(\"width\", null)\n .attr(\"height\", null);\n }\n }\n\n function emitter(that, args, clean) {\n var emit = that.__brush.emitter;\n return emit && (!clean || !emit.clean) ? emit : new Emitter(that, args, clean);\n }\n\n function Emitter(that, args, clean) {\n this.that = that;\n this.args = args;\n this.state = that.__brush;\n this.active = 0;\n this.clean = clean;\n }\n\n Emitter.prototype = {\n beforestart: function() {\n if (++this.active === 1) this.state.emitter = this, this.starting = true;\n return this;\n },\n start: function(event, mode) {\n if (this.starting) this.starting = false, this.emit(\"start\", event, mode);\n else this.emit(\"brush\", event);\n return this;\n },\n brush: function(event, mode) {\n this.emit(\"brush\", event, mode);\n return this;\n },\n end: function(event, mode) {\n if (--this.active === 0) delete this.state.emitter, this.emit(\"end\", event, mode);\n return this;\n },\n emit: function(type, event, mode) {\n var d = select(this.that).datum();\n listeners.call(\n type,\n this.that,\n new BrushEvent(type, {\n sourceEvent: event,\n target: brush,\n selection: dim.output(this.state.selection),\n mode,\n dispatch: listeners\n }),\n d\n );\n }\n };\n\n function started(event) {\n if (touchending && !event.touches) return;\n if (!filter.apply(this, arguments)) return;\n\n var that = this,\n type = event.target.__data__.type,\n mode = (keys && event.metaKey ? type = \"overlay\" : type) === \"selection\" ? MODE_DRAG : (keys && event.altKey ? MODE_CENTER : MODE_HANDLE),\n signX = dim === Y ? null : signsX[type],\n signY = dim === X ? null : signsY[type],\n state = local(that),\n extent = state.extent,\n selection = state.selection,\n W = extent[0][0], w0, w1,\n N = extent[0][1], n0, n1,\n E = extent[1][0], e0, e1,\n S = extent[1][1], s0, s1,\n dx = 0,\n dy = 0,\n moving,\n shifting = signX && signY && keys && event.shiftKey,\n lockX,\n lockY,\n points = Array.from(event.touches || [event], t => {\n const i = t.identifier;\n t = pointer(t, that);\n t.point0 = t.slice();\n t.identifier = i;\n return t;\n });\n\n interrupt(that);\n var emit = emitter(that, arguments, true).beforestart();\n\n if (type === \"overlay\") {\n if (selection) moving = true;\n const pts = [points[0], points[1] || points[0]];\n state.selection = selection = [[\n w0 = dim === Y ? W : min(pts[0][0], pts[1][0]),\n n0 = dim === X ? N : min(pts[0][1], pts[1][1])\n ], [\n e0 = dim === Y ? E : max(pts[0][0], pts[1][0]),\n s0 = dim === X ? S : max(pts[0][1], pts[1][1])\n ]];\n if (points.length > 1) move(event);\n } else {\n w0 = selection[0][0];\n n0 = selection[0][1];\n e0 = selection[1][0];\n s0 = selection[1][1];\n }\n\n w1 = w0;\n n1 = n0;\n e1 = e0;\n s1 = s0;\n\n var group = select(that)\n .attr(\"pointer-events\", \"none\");\n\n var overlay = group.selectAll(\".overlay\")\n .attr(\"cursor\", cursors[type]);\n\n if (event.touches) {\n emit.moved = moved;\n emit.ended = ended;\n } else {\n var view = select(event.view)\n .on(\"mousemove.brush\", moved, true)\n .on(\"mouseup.brush\", ended, true);\n if (keys) view\n .on(\"keydown.brush\", keydowned, true)\n .on(\"keyup.brush\", keyupped, true)\n\n dragDisable(event.view);\n }\n\n redraw.call(that);\n emit.start(event, mode.name);\n\n function moved(event) {\n for (const p of event.changedTouches || [event]) {\n for (const d of points)\n if (d.identifier === p.identifier) d.cur = pointer(p, that);\n }\n if (shifting && !lockX && !lockY && points.length === 1) {\n const point = points[0];\n if (abs(point.cur[0] - point[0]) > abs(point.cur[1] - point[1]))\n lockY = true;\n else\n lockX = true;\n }\n for (const point of points)\n if (point.cur) point[0] = point.cur[0], point[1] = point.cur[1];\n moving = true;\n noevent(event);\n move(event);\n }\n\n function move(event) {\n const point = points[0], point0 = point.point0;\n var t;\n\n dx = point[0] - point0[0];\n dy = point[1] - point0[1];\n\n switch (mode) {\n case MODE_SPACE:\n case MODE_DRAG: {\n if (signX) dx = max(W - w0, min(E - e0, dx)), w1 = w0 + dx, e1 = e0 + dx;\n if (signY) dy = max(N - n0, min(S - s0, dy)), n1 = n0 + dy, s1 = s0 + dy;\n break;\n }\n case MODE_HANDLE: {\n if (points[1]) {\n if (signX) w1 = max(W, min(E, points[0][0])), e1 = max(W, min(E, points[1][0])), signX = 1;\n if (signY) n1 = max(N, min(S, points[0][1])), s1 = max(N, min(S, points[1][1])), signY = 1;\n } else {\n if (signX < 0) dx = max(W - w0, min(E - w0, dx)), w1 = w0 + dx, e1 = e0;\n else if (signX > 0) dx = max(W - e0, min(E - e0, dx)), w1 = w0, e1 = e0 + dx;\n if (signY < 0) dy = max(N - n0, min(S - n0, dy)), n1 = n0 + dy, s1 = s0;\n else if (signY > 0) dy = max(N - s0, min(S - s0, dy)), n1 = n0, s1 = s0 + dy;\n }\n break;\n }\n case MODE_CENTER: {\n if (signX) w1 = max(W, min(E, w0 - dx * signX)), e1 = max(W, min(E, e0 + dx * signX));\n if (signY) n1 = max(N, min(S, n0 - dy * signY)), s1 = max(N, min(S, s0 + dy * signY));\n break;\n }\n }\n\n if (e1 < w1) {\n signX *= -1;\n t = w0, w0 = e0, e0 = t;\n t = w1, w1 = e1, e1 = t;\n if (type in flipX) overlay.attr(\"cursor\", cursors[type = flipX[type]]);\n }\n\n if (s1 < n1) {\n signY *= -1;\n t = n0, n0 = s0, s0 = t;\n t = n1, n1 = s1, s1 = t;\n if (type in flipY) overlay.attr(\"cursor\", cursors[type = flipY[type]]);\n }\n\n if (state.selection) selection = state.selection; // May be set by brush.move!\n if (lockX) w1 = selection[0][0], e1 = selection[1][0];\n if (lockY) n1 = selection[0][1], s1 = selection[1][1];\n\n if (selection[0][0] !== w1\n || selection[0][1] !== n1\n || selection[1][0] !== e1\n || selection[1][1] !== s1) {\n state.selection = [[w1, n1], [e1, s1]];\n redraw.call(that);\n emit.brush(event, mode.name);\n }\n }\n\n function ended(event) {\n nopropagation(event);\n if (event.touches) {\n if (event.touches.length) return;\n if (touchending) clearTimeout(touchending);\n touchending = setTimeout(function() { touchending = null; }, 500); // Ghost clicks are delayed!\n } else {\n dragEnable(event.view, moving);\n view.on(\"keydown.brush keyup.brush mousemove.brush mouseup.brush\", null);\n }\n group.attr(\"pointer-events\", \"all\");\n overlay.attr(\"cursor\", cursors.overlay);\n if (state.selection) selection = state.selection; // May be set by brush.move (on start)!\n if (empty(selection)) state.selection = null, redraw.call(that);\n emit.end(event, mode.name);\n }\n\n function keydowned(event) {\n switch (event.keyCode) {\n case 16: { // SHIFT\n shifting = signX && signY;\n break;\n }\n case 18: { // ALT\n if (mode === MODE_HANDLE) {\n if (signX) e0 = e1 - dx * signX, w0 = w1 + dx * signX;\n if (signY) s0 = s1 - dy * signY, n0 = n1 + dy * signY;\n mode = MODE_CENTER;\n move(event);\n }\n break;\n }\n case 32: { // SPACE; takes priority over ALT\n if (mode === MODE_HANDLE || mode === MODE_CENTER) {\n if (signX < 0) e0 = e1 - dx; else if (signX > 0) w0 = w1 - dx;\n if (signY < 0) s0 = s1 - dy; else if (signY > 0) n0 = n1 - dy;\n mode = MODE_SPACE;\n overlay.attr(\"cursor\", cursors.selection);\n move(event);\n }\n break;\n }\n default: return;\n }\n noevent(event);\n }\n\n function keyupped(event) {\n switch (event.keyCode) {\n case 16: { // SHIFT\n if (shifting) {\n lockX = lockY = shifting = false;\n move(event);\n }\n break;\n }\n case 18: { // ALT\n if (mode === MODE_CENTER) {\n if (signX < 0) e0 = e1; else if (signX > 0) w0 = w1;\n if (signY < 0) s0 = s1; else if (signY > 0) n0 = n1;\n mode = MODE_HANDLE;\n move(event);\n }\n break;\n }\n case 32: { // SPACE\n if (mode === MODE_SPACE) {\n if (event.altKey) {\n if (signX) e0 = e1 - dx * signX, w0 = w1 + dx * signX;\n if (signY) s0 = s1 - dy * signY, n0 = n1 + dy * signY;\n mode = MODE_CENTER;\n } else {\n if (signX < 0) e0 = e1; else if (signX > 0) w0 = w1;\n if (signY < 0) s0 = s1; else if (signY > 0) n0 = n1;\n mode = MODE_HANDLE;\n }\n overlay.attr(\"cursor\", cursors[type]);\n move(event);\n }\n break;\n }\n default: return;\n }\n noevent(event);\n }\n }\n\n function touchmoved(event) {\n emitter(this, arguments).moved(event);\n }\n\n function touchended(event) {\n emitter(this, arguments).ended(event);\n }\n\n function initialize() {\n var state = this.__brush || {selection: null};\n state.extent = number2(extent.apply(this, arguments));\n state.dim = dim;\n return state;\n }\n\n brush.extent = function(_) {\n return arguments.length ? (extent = typeof _ === \"function\" ? _ : constant(number2(_)), brush) : extent;\n };\n\n brush.filter = function(_) {\n return arguments.length ? (filter = typeof _ === \"function\" ? _ : constant(!!_), brush) : filter;\n };\n\n brush.touchable = function(_) {\n return arguments.length ? (touchable = typeof _ === \"function\" ? _ : constant(!!_), brush) : touchable;\n };\n\n brush.handleSize = function(_) {\n return arguments.length ? (handleSize = +_, brush) : handleSize;\n };\n\n brush.keyModifiers = function(_) {\n return arguments.length ? (keys = !!_, brush) : keys;\n };\n\n brush.on = function() {\n var value = listeners.on.apply(listeners, arguments);\n return value === listeners ? brush : value;\n };\n\n return brush;\n}\n","import {Selection, root} from \"./selection/index.js\";\n\nexport default function(selector) {\n return typeof selector === \"string\"\n ? new Selection([[document.querySelector(selector)]], [document.documentElement])\n : new Selection([[selector]], root);\n}\n","import sourceEvent from \"./sourceEvent.js\";\n\nexport default function(event, node) {\n event = sourceEvent(event);\n if (node === undefined) node = event.currentTarget;\n if (node) {\n var svg = node.ownerSVGElement || node;\n if (svg.createSVGPoint) {\n var point = svg.createSVGPoint();\n point.x = event.clientX, point.y = event.clientY;\n point = point.matrixTransform(node.getScreenCTM().inverse());\n return [point.x, point.y];\n }\n if (node.getBoundingClientRect) {\n var rect = node.getBoundingClientRect();\n return [event.clientX - rect.left - node.clientLeft, event.clientY - rect.top - node.clientTop];\n }\n }\n return [event.pageX, event.pageY];\n}\n","export default function(event) {\n let sourceEvent;\n while (sourceEvent = event.sourceEvent) event = sourceEvent;\n return event;\n}\n","// These are typically used in conjunction with noevent to ensure that we can\n// preventDefault on the event.\nexport const nonpassive = {passive: false};\nexport const nonpassivecapture = {capture: true, passive: false};\n\nexport function nopropagation(event) {\n event.stopImmediatePropagation();\n}\n\nexport default function(event) {\n event.preventDefault();\n event.stopImmediatePropagation();\n}\n","export default x => () => x;\n","export default function DragEvent(type, {\n sourceEvent,\n subject,\n target,\n identifier,\n active,\n x, y, dx, dy,\n dispatch\n}) {\n Object.defineProperties(this, {\n type: {value: type, enumerable: true, configurable: true},\n sourceEvent: {value: sourceEvent, enumerable: true, configurable: true},\n subject: {value: subject, enumerable: true, configurable: true},\n target: {value: target, enumerable: true, configurable: true},\n identifier: {value: identifier, enumerable: true, configurable: true},\n active: {value: active, enumerable: true, configurable: true},\n x: {value: x, enumerable: true, configurable: true},\n y: {value: y, enumerable: true, configurable: true},\n dx: {value: dx, enumerable: true, configurable: true},\n dy: {value: dy, enumerable: true, configurable: true},\n _: {value: dispatch}\n });\n}\n\nDragEvent.prototype.on = function() {\n var value = this._.on.apply(this._, arguments);\n return value === this._ ? this : value;\n};\n","import {dispatch} from \"d3-dispatch\";\nimport {select, pointer} from \"d3-selection\";\nimport nodrag, {yesdrag} from \"./nodrag.js\";\nimport noevent, {nonpassive, nonpassivecapture, nopropagation} from \"./noevent.js\";\nimport constant from \"./constant.js\";\nimport DragEvent from \"./event.js\";\n\n// Ignore right-click, since that should open the context menu.\nfunction defaultFilter(event) {\n return !event.ctrlKey && !event.button;\n}\n\nfunction defaultContainer() {\n return this.parentNode;\n}\n\nfunction defaultSubject(event, d) {\n return d == null ? {x: event.x, y: event.y} : d;\n}\n\nfunction defaultTouchable() {\n return navigator.maxTouchPoints || (\"ontouchstart\" in this);\n}\n\nexport default function() {\n var filter = defaultFilter,\n container = defaultContainer,\n subject = defaultSubject,\n touchable = defaultTouchable,\n gestures = {},\n listeners = dispatch(\"start\", \"drag\", \"end\"),\n active = 0,\n mousedownx,\n mousedowny,\n mousemoving,\n touchending,\n clickDistance2 = 0;\n\n function drag(selection) {\n selection\n .on(\"mousedown.drag\", mousedowned)\n .filter(touchable)\n .on(\"touchstart.drag\", touchstarted)\n .on(\"touchmove.drag\", touchmoved, nonpassive)\n .on(\"touchend.drag touchcancel.drag\", touchended)\n .style(\"touch-action\", \"none\")\n .style(\"-webkit-tap-highlight-color\", \"rgba(0,0,0,0)\");\n }\n\n function mousedowned(event, d) {\n if (touchending || !filter.call(this, event, d)) return;\n var gesture = beforestart(this, container.call(this, event, d), event, d, \"mouse\");\n if (!gesture) return;\n select(event.view)\n .on(\"mousemove.drag\", mousemoved, nonpassivecapture)\n .on(\"mouseup.drag\", mouseupped, nonpassivecapture);\n nodrag(event.view);\n nopropagation(event);\n mousemoving = false;\n mousedownx = event.clientX;\n mousedowny = event.clientY;\n gesture(\"start\", event);\n }\n\n function mousemoved(event) {\n noevent(event);\n if (!mousemoving) {\n var dx = event.clientX - mousedownx, dy = event.clientY - mousedowny;\n mousemoving = dx * dx + dy * dy > clickDistance2;\n }\n gestures.mouse(\"drag\", event);\n }\n\n function mouseupped(event) {\n select(event.view).on(\"mousemove.drag mouseup.drag\", null);\n yesdrag(event.view, mousemoving);\n noevent(event);\n gestures.mouse(\"end\", event);\n }\n\n function touchstarted(event, d) {\n if (!filter.call(this, event, d)) return;\n var touches = event.changedTouches,\n c = container.call(this, event, d),\n n = touches.length, i, gesture;\n\n for (i = 0; i < n; ++i) {\n if (gesture = beforestart(this, c, event, d, touches[i].identifier, touches[i])) {\n nopropagation(event);\n gesture(\"start\", event, touches[i]);\n }\n }\n }\n\n function touchmoved(event) {\n var touches = event.changedTouches,\n n = touches.length, i, gesture;\n\n for (i = 0; i < n; ++i) {\n if (gesture = gestures[touches[i].identifier]) {\n noevent(event);\n gesture(\"drag\", event, touches[i]);\n }\n }\n }\n\n function touchended(event) {\n var touches = event.changedTouches,\n n = touches.length, i, gesture;\n\n if (touchending) clearTimeout(touchending);\n touchending = setTimeout(function() { touchending = null; }, 500); // Ghost clicks are delayed!\n for (i = 0; i < n; ++i) {\n if (gesture = gestures[touches[i].identifier]) {\n nopropagation(event);\n gesture(\"end\", event, touches[i]);\n }\n }\n }\n\n function beforestart(that, container, event, d, identifier, touch) {\n var dispatch = listeners.copy(),\n p = pointer(touch || event, container), dx, dy,\n s;\n\n if ((s = subject.call(that, new DragEvent(\"beforestart\", {\n sourceEvent: event,\n target: drag,\n identifier,\n active,\n x: p[0],\n y: p[1],\n dx: 0,\n dy: 0,\n dispatch\n }), d)) == null) return;\n\n dx = s.x - p[0] || 0;\n dy = s.y - p[1] || 0;\n\n return function gesture(type, event, touch) {\n var p0 = p, n;\n switch (type) {\n case \"start\": gestures[identifier] = gesture, n = active++; break;\n case \"end\": delete gestures[identifier], --active; // falls through\n case \"drag\": p = pointer(touch || event, container), n = active; break;\n }\n dispatch.call(\n type,\n that,\n new DragEvent(type, {\n sourceEvent: event,\n subject: s,\n target: drag,\n identifier,\n active: n,\n x: p[0] + dx,\n y: p[1] + dy,\n dx: p[0] - p0[0],\n dy: p[1] - p0[1],\n dispatch\n }),\n d\n );\n };\n }\n\n drag.filter = function(_) {\n return arguments.length ? (filter = typeof _ === \"function\" ? _ : constant(!!_), drag) : filter;\n };\n\n drag.container = function(_) {\n return arguments.length ? (container = typeof _ === \"function\" ? _ : constant(_), drag) : container;\n };\n\n drag.subject = function(_) {\n return arguments.length ? (subject = typeof _ === \"function\" ? _ : constant(_), drag) : subject;\n };\n\n drag.touchable = function(_) {\n return arguments.length ? (touchable = typeof _ === \"function\" ? _ : constant(!!_), drag) : touchable;\n };\n\n drag.on = function() {\n var value = listeners.on.apply(listeners, arguments);\n return value === listeners ? drag : value;\n };\n\n drag.clickDistance = function(_) {\n return arguments.length ? (clickDistance2 = (_ = +_) * _, drag) : Math.sqrt(clickDistance2);\n };\n\n return drag;\n}\n","var e10 = Math.sqrt(50),\n e5 = Math.sqrt(10),\n e2 = Math.sqrt(2);\n\nexport default function ticks(start, stop, count) {\n var reverse,\n i = -1,\n n,\n ticks,\n step;\n\n stop = +stop, start = +start, count = +count;\n if (start === stop && count > 0) return [start];\n if (reverse = stop < start) n = start, start = stop, stop = n;\n if ((step = tickIncrement(start, stop, count)) === 0 || !isFinite(step)) return [];\n\n if (step > 0) {\n let r0 = Math.round(start / step), r1 = Math.round(stop / step);\n if (r0 * step < start) ++r0;\n if (r1 * step > stop) --r1;\n ticks = new Array(n = r1 - r0 + 1);\n while (++i < n) ticks[i] = (r0 + i) * step;\n } else {\n step = -step;\n let r0 = Math.round(start * step), r1 = Math.round(stop * step);\n if (r0 / step < start) ++r0;\n if (r1 / step > stop) --r1;\n ticks = new Array(n = r1 - r0 + 1);\n while (++i < n) ticks[i] = (r0 + i) / step;\n }\n\n if (reverse) ticks.reverse();\n\n return ticks;\n}\n\nexport function tickIncrement(start, stop, count) {\n var step = (stop - start) / Math.max(0, count),\n power = Math.floor(Math.log(step) / Math.LN10),\n error = step / Math.pow(10, power);\n return power >= 0\n ? (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1) * Math.pow(10, power)\n : -Math.pow(10, -power) / (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1);\n}\n\nexport function tickStep(start, stop, count) {\n var step0 = Math.abs(stop - start) / Math.max(0, count),\n step1 = Math.pow(10, Math.floor(Math.log(step0) / Math.LN10)),\n error = step0 / step1;\n if (error >= e10) step1 *= 10;\n else if (error >= e5) step1 *= 5;\n else if (error >= e2) step1 *= 2;\n return stop < start ? -step1 : step1;\n}\n","export default function ascending(a, b) {\n return a == null || b == null ? NaN : a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;\n}\n","export default function descending(a, b) {\n return a == null || b == null ? NaN\n : b < a ? -1\n : b > a ? 1\n : b >= a ? 0\n : NaN;\n}\n","import ascending from \"./ascending.js\";\nimport descending from \"./descending.js\";\n\nexport default function bisector(f) {\n let compare1, compare2, delta;\n\n // If an accessor is specified, promote it to a comparator. In this case we\n // can test whether the search value is (self-) comparable. We can’t do this\n // for a comparator (except for specific, known comparators) because we can’t\n // tell if the comparator is symmetric, and an asymmetric comparator can’t be\n // used to test whether a single value is comparable.\n if (f.length !== 2) {\n compare1 = ascending;\n compare2 = (d, x) => ascending(f(d), x);\n delta = (d, x) => f(d) - x;\n } else {\n compare1 = f === ascending || f === descending ? f : zero;\n compare2 = f;\n delta = f;\n }\n\n function left(a, x, lo = 0, hi = a.length) {\n if (lo < hi) {\n if (compare1(x, x) !== 0) return hi;\n do {\n const mid = (lo + hi) >>> 1;\n if (compare2(a[mid], x) < 0) lo = mid + 1;\n else hi = mid;\n } while (lo < hi);\n }\n return lo;\n }\n\n function right(a, x, lo = 0, hi = a.length) {\n if (lo < hi) {\n if (compare1(x, x) !== 0) return hi;\n do {\n const mid = (lo + hi) >>> 1;\n if (compare2(a[mid], x) <= 0) lo = mid + 1;\n else hi = mid;\n } while (lo < hi);\n }\n return lo;\n }\n\n function center(a, x, lo = 0, hi = a.length) {\n const i = left(a, x, lo, hi - 1);\n return i > lo && delta(a[i - 1], x) > -delta(a[i], x) ? i - 1 : i;\n }\n\n return {left, center, right};\n}\n\nfunction zero() {\n return 0;\n}\n","import ascending from \"./ascending.js\";\nimport bisector from \"./bisector.js\";\nimport number from \"./number.js\";\n\nconst ascendingBisect = bisector(ascending);\nexport const bisectRight = ascendingBisect.right;\nexport const bisectLeft = ascendingBisect.left;\nexport const bisectCenter = bisector(number).center;\nexport default bisectRight;\n","export default function number(x) {\n return x === null ? NaN : +x;\n}\n\nexport function* numbers(values, valueof) {\n if (valueof === undefined) {\n for (let value of values) {\n if (value != null && (value = +value) >= value) {\n yield value;\n }\n }\n } else {\n let index = -1;\n for (let value of values) {\n if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) {\n yield value;\n }\n }\n }\n}\n","import value from \"./value.js\";\nimport numberArray, {isNumberArray} from \"./numberArray.js\";\n\nexport default function(a, b) {\n return (isNumberArray(b) ? numberArray : genericArray)(a, b);\n}\n\nexport function genericArray(a, b) {\n var nb = b ? b.length : 0,\n na = a ? Math.min(nb, a.length) : 0,\n x = new Array(na),\n c = new Array(nb),\n i;\n\n for (i = 0; i < na; ++i) x[i] = value(a[i], b[i]);\n for (; i < nb; ++i) c[i] = b[i];\n\n return function(t) {\n for (i = 0; i < na; ++i) c[i] = x[i](t);\n return c;\n };\n}\n","export default function(a, b) {\n var d = new Date;\n return a = +a, b = +b, function(t) {\n return d.setTime(a * (1 - t) + b * t), d;\n };\n}\n","import value from \"./value.js\";\n\nexport default function(a, b) {\n var i = {},\n c = {},\n k;\n\n if (a === null || typeof a !== \"object\") a = {};\n if (b === null || typeof b !== \"object\") b = {};\n\n for (k in b) {\n if (k in a) {\n i[k] = value(a[k], b[k]);\n } else {\n c[k] = b[k];\n }\n }\n\n return function(t) {\n for (k in i) c[k] = i[k](t);\n return c;\n };\n}\n","export default function(a, b) {\n if (!b) b = [];\n var n = a ? Math.min(b.length, a.length) : 0,\n c = b.slice(),\n i;\n return function(t) {\n for (i = 0; i < n; ++i) c[i] = a[i] * (1 - t) + b[i] * t;\n return c;\n };\n}\n\nexport function isNumberArray(x) {\n return ArrayBuffer.isView(x) && !(x instanceof DataView);\n}\n","import {color} from \"d3-color\";\nimport rgb from \"./rgb.js\";\nimport {genericArray} from \"./array.js\";\nimport date from \"./date.js\";\nimport number from \"./number.js\";\nimport object from \"./object.js\";\nimport string from \"./string.js\";\nimport constant from \"./constant.js\";\nimport numberArray, {isNumberArray} from \"./numberArray.js\";\n\nexport default function(a, b) {\n var t = typeof b, c;\n return b == null || t === \"boolean\" ? constant(b)\n : (t === \"number\" ? number\n : t === \"string\" ? ((c = color(b)) ? (b = c, rgb) : string)\n : b instanceof color ? rgb\n : b instanceof Date ? date\n : isNumberArray(b) ? numberArray\n : Array.isArray(b) ? genericArray\n : typeof b.valueOf !== \"function\" && typeof b.toString !== \"function\" || isNaN(b) ? object\n : number)(a, b);\n}\n","export default function(a, b) {\n return a = +a, b = +b, function(t) {\n return Math.round(a * (1 - t) + b * t);\n };\n}\n","export default function number(x) {\n return +x;\n}\n","import {bisect} from \"d3-array\";\nimport {interpolate as interpolateValue, interpolateNumber, interpolateRound} from \"d3-interpolate\";\nimport constant from \"./constant.js\";\nimport number from \"./number.js\";\n\nvar unit = [0, 1];\n\nexport function identity(x) {\n return x;\n}\n\nfunction normalize(a, b) {\n return (b -= (a = +a))\n ? function(x) { return (x - a) / b; }\n : constant(isNaN(b) ? NaN : 0.5);\n}\n\nfunction clamper(a, b) {\n var t;\n if (a > b) t = a, a = b, b = t;\n return function(x) { return Math.max(a, Math.min(b, x)); };\n}\n\n// normalize(a, b)(x) takes a domain value x in [a,b] and returns the corresponding parameter t in [0,1].\n// interpolate(a, b)(t) takes a parameter t in [0,1] and returns the corresponding range value x in [a,b].\nfunction bimap(domain, range, interpolate) {\n var d0 = domain[0], d1 = domain[1], r0 = range[0], r1 = range[1];\n if (d1 < d0) d0 = normalize(d1, d0), r0 = interpolate(r1, r0);\n else d0 = normalize(d0, d1), r0 = interpolate(r0, r1);\n return function(x) { return r0(d0(x)); };\n}\n\nfunction polymap(domain, range, interpolate) {\n var j = Math.min(domain.length, range.length) - 1,\n d = new Array(j),\n r = new Array(j),\n i = -1;\n\n // Reverse descending domains.\n if (domain[j] < domain[0]) {\n domain = domain.slice().reverse();\n range = range.slice().reverse();\n }\n\n while (++i < j) {\n d[i] = normalize(domain[i], domain[i + 1]);\n r[i] = interpolate(range[i], range[i + 1]);\n }\n\n return function(x) {\n var i = bisect(domain, x, 1, j) - 1;\n return r[i](d[i](x));\n };\n}\n\nexport function copy(source, target) {\n return target\n .domain(source.domain())\n .range(source.range())\n .interpolate(source.interpolate())\n .clamp(source.clamp())\n .unknown(source.unknown());\n}\n\nexport function transformer() {\n var domain = unit,\n range = unit,\n interpolate = interpolateValue,\n transform,\n untransform,\n unknown,\n clamp = identity,\n piecewise,\n output,\n input;\n\n function rescale() {\n var n = Math.min(domain.length, range.length);\n if (clamp !== identity) clamp = clamper(domain[0], domain[n - 1]);\n piecewise = n > 2 ? polymap : bimap;\n output = input = null;\n return scale;\n }\n\n function scale(x) {\n return x == null || isNaN(x = +x) ? unknown : (output || (output = piecewise(domain.map(transform), range, interpolate)))(transform(clamp(x)));\n }\n\n scale.invert = function(y) {\n return clamp(untransform((input || (input = piecewise(range, domain.map(transform), interpolateNumber)))(y)));\n };\n\n scale.domain = function(_) {\n return arguments.length ? (domain = Array.from(_, number), rescale()) : domain.slice();\n };\n\n scale.range = function(_) {\n return arguments.length ? (range = Array.from(_), rescale()) : range.slice();\n };\n\n scale.rangeRound = function(_) {\n return range = Array.from(_), interpolate = interpolateRound, rescale();\n };\n\n scale.clamp = function(_) {\n return arguments.length ? (clamp = _ ? true : identity, rescale()) : clamp !== identity;\n };\n\n scale.interpolate = function(_) {\n return arguments.length ? (interpolate = _, rescale()) : interpolate;\n };\n\n scale.unknown = function(_) {\n return arguments.length ? (unknown = _, scale) : unknown;\n };\n\n return function(t, u) {\n transform = t, untransform = u;\n return rescale();\n };\n}\n\nexport default function continuous() {\n return transformer()(identity, identity);\n}\n","export default function constants(x) {\n return function() {\n return x;\n };\n}\n","export function initRange(domain, range) {\n switch (arguments.length) {\n case 0: break;\n case 1: this.range(domain); break;\n default: this.range(range).domain(domain); break;\n }\n return this;\n}\n\nexport function initInterpolator(domain, interpolator) {\n switch (arguments.length) {\n case 0: break;\n case 1: {\n if (typeof domain === \"function\") this.interpolator(domain);\n else this.range(domain);\n break;\n }\n default: {\n this.domain(domain);\n if (typeof interpolator === \"function\") this.interpolator(interpolator);\n else this.range(interpolator);\n break;\n }\n }\n return this;\n}\n","// [[fill]align][sign][symbol][0][width][,][.precision][~][type]\nvar re = /^(?:(.)?([<>=^]))?([+\\-( ])?([$#])?(0)?(\\d+)?(,)?(\\.\\d+)?(~)?([a-z%])?$/i;\n\nexport default function formatSpecifier(specifier) {\n if (!(match = re.exec(specifier))) throw new Error(\"invalid format: \" + specifier);\n var match;\n return new FormatSpecifier({\n fill: match[1],\n align: match[2],\n sign: match[3],\n symbol: match[4],\n zero: match[5],\n width: match[6],\n comma: match[7],\n precision: match[8] && match[8].slice(1),\n trim: match[9],\n type: match[10]\n });\n}\n\nformatSpecifier.prototype = FormatSpecifier.prototype; // instanceof\n\nexport function FormatSpecifier(specifier) {\n this.fill = specifier.fill === undefined ? \" \" : specifier.fill + \"\";\n this.align = specifier.align === undefined ? \">\" : specifier.align + \"\";\n this.sign = specifier.sign === undefined ? \"-\" : specifier.sign + \"\";\n this.symbol = specifier.symbol === undefined ? \"\" : specifier.symbol + \"\";\n this.zero = !!specifier.zero;\n this.width = specifier.width === undefined ? undefined : +specifier.width;\n this.comma = !!specifier.comma;\n this.precision = specifier.precision === undefined ? undefined : +specifier.precision;\n this.trim = !!specifier.trim;\n this.type = specifier.type === undefined ? \"\" : specifier.type + \"\";\n}\n\nFormatSpecifier.prototype.toString = function() {\n return this.fill\n + this.align\n + this.sign\n + this.symbol\n + (this.zero ? \"0\" : \"\")\n + (this.width === undefined ? \"\" : Math.max(1, this.width | 0))\n + (this.comma ? \",\" : \"\")\n + (this.precision === undefined ? \"\" : \".\" + Math.max(0, this.precision | 0))\n + (this.trim ? \"~\" : \"\")\n + this.type;\n};\n","import {formatDecimalParts} from \"./formatDecimal.js\";\n\nexport var prefixExponent;\n\nexport default function(x, p) {\n var d = formatDecimalParts(x, p);\n if (!d) return x + \"\";\n var coefficient = d[0],\n exponent = d[1],\n i = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1,\n n = coefficient.length;\n return i === n ? coefficient\n : i > n ? coefficient + new Array(i - n + 1).join(\"0\")\n : i > 0 ? coefficient.slice(0, i) + \".\" + coefficient.slice(i)\n : \"0.\" + new Array(1 - i).join(\"0\") + formatDecimalParts(x, Math.max(0, p + i - 1))[0]; // less than 1y!\n}\n","export default function(x) {\n return Math.abs(x = Math.round(x)) >= 1e21\n ? x.toLocaleString(\"en\").replace(/,/g, \"\")\n : x.toString(10);\n}\n\n// Computes the decimal coefficient and exponent of the specified number x with\n// significant digits p, where x is positive and p is in [1, 21] or undefined.\n// For example, formatDecimalParts(1.23) returns [\"123\", 0].\nexport function formatDecimalParts(x, p) {\n if ((i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf(\"e\")) < 0) return null; // NaN, ±Infinity\n var i, coefficient = x.slice(0, i);\n\n // The string returned by toExponential either has the form \\d\\.\\d+e[-+]\\d+\n // (e.g., 1.2e+3) or the form \\de[-+]\\d+ (e.g., 1e+3).\n return [\n coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient,\n +x.slice(i + 1)\n ];\n}\n","import {formatDecimalParts} from \"./formatDecimal.js\";\n\nexport default function(x) {\n return x = formatDecimalParts(Math.abs(x)), x ? x[1] : NaN;\n}\n","import {formatDecimalParts} from \"./formatDecimal.js\";\n\nexport default function(x, p) {\n var d = formatDecimalParts(x, p);\n if (!d) return x + \"\";\n var coefficient = d[0],\n exponent = d[1];\n return exponent < 0 ? \"0.\" + new Array(-exponent).join(\"0\") + coefficient\n : coefficient.length > exponent + 1 ? coefficient.slice(0, exponent + 1) + \".\" + coefficient.slice(exponent + 1)\n : coefficient + new Array(exponent - coefficient.length + 2).join(\"0\");\n}\n","import formatDecimal from \"./formatDecimal.js\";\nimport formatPrefixAuto from \"./formatPrefixAuto.js\";\nimport formatRounded from \"./formatRounded.js\";\n\nexport default {\n \"%\": (x, p) => (x * 100).toFixed(p),\n \"b\": (x) => Math.round(x).toString(2),\n \"c\": (x) => x + \"\",\n \"d\": formatDecimal,\n \"e\": (x, p) => x.toExponential(p),\n \"f\": (x, p) => x.toFixed(p),\n \"g\": (x, p) => x.toPrecision(p),\n \"o\": (x) => Math.round(x).toString(8),\n \"p\": (x, p) => formatRounded(x * 100, p),\n \"r\": formatRounded,\n \"s\": formatPrefixAuto,\n \"X\": (x) => Math.round(x).toString(16).toUpperCase(),\n \"x\": (x) => Math.round(x).toString(16)\n};\n","export default function(x) {\n return x;\n}\n","import exponent from \"./exponent.js\";\nimport formatGroup from \"./formatGroup.js\";\nimport formatNumerals from \"./formatNumerals.js\";\nimport formatSpecifier from \"./formatSpecifier.js\";\nimport formatTrim from \"./formatTrim.js\";\nimport formatTypes from \"./formatTypes.js\";\nimport {prefixExponent} from \"./formatPrefixAuto.js\";\nimport identity from \"./identity.js\";\n\nvar map = Array.prototype.map,\n prefixes = [\"y\",\"z\",\"a\",\"f\",\"p\",\"n\",\"µ\",\"m\",\"\",\"k\",\"M\",\"G\",\"T\",\"P\",\"E\",\"Z\",\"Y\"];\n\nexport default function(locale) {\n var group = locale.grouping === undefined || locale.thousands === undefined ? identity : formatGroup(map.call(locale.grouping, Number), locale.thousands + \"\"),\n currencyPrefix = locale.currency === undefined ? \"\" : locale.currency[0] + \"\",\n currencySuffix = locale.currency === undefined ? \"\" : locale.currency[1] + \"\",\n decimal = locale.decimal === undefined ? \".\" : locale.decimal + \"\",\n numerals = locale.numerals === undefined ? identity : formatNumerals(map.call(locale.numerals, String)),\n percent = locale.percent === undefined ? \"%\" : locale.percent + \"\",\n minus = locale.minus === undefined ? \"−\" : locale.minus + \"\",\n nan = locale.nan === undefined ? \"NaN\" : locale.nan + \"\";\n\n function newFormat(specifier) {\n specifier = formatSpecifier(specifier);\n\n var fill = specifier.fill,\n align = specifier.align,\n sign = specifier.sign,\n symbol = specifier.symbol,\n zero = specifier.zero,\n width = specifier.width,\n comma = specifier.comma,\n precision = specifier.precision,\n trim = specifier.trim,\n type = specifier.type;\n\n // The \"n\" type is an alias for \",g\".\n if (type === \"n\") comma = true, type = \"g\";\n\n // The \"\" type, and any invalid type, is an alias for \".12~g\".\n else if (!formatTypes[type]) precision === undefined && (precision = 12), trim = true, type = \"g\";\n\n // If zero fill is specified, padding goes after sign and before digits.\n if (zero || (fill === \"0\" && align === \"=\")) zero = true, fill = \"0\", align = \"=\";\n\n // Compute the prefix and suffix.\n // For SI-prefix, the suffix is lazily computed.\n var prefix = symbol === \"$\" ? currencyPrefix : symbol === \"#\" && /[boxX]/.test(type) ? \"0\" + type.toLowerCase() : \"\",\n suffix = symbol === \"$\" ? currencySuffix : /[%p]/.test(type) ? percent : \"\";\n\n // What format function should we use?\n // Is this an integer type?\n // Can this type generate exponential notation?\n var formatType = formatTypes[type],\n maybeSuffix = /[defgprs%]/.test(type);\n\n // Set the default precision if not specified,\n // or clamp the specified precision to the supported range.\n // For significant precision, it must be in [1, 21].\n // For fixed precision, it must be in [0, 20].\n precision = precision === undefined ? 6\n : /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision))\n : Math.max(0, Math.min(20, precision));\n\n function format(value) {\n var valuePrefix = prefix,\n valueSuffix = suffix,\n i, n, c;\n\n if (type === \"c\") {\n valueSuffix = formatType(value) + valueSuffix;\n value = \"\";\n } else {\n value = +value;\n\n // Determine the sign. -0 is not less than 0, but 1 / -0 is!\n var valueNegative = value < 0 || 1 / value < 0;\n\n // Perform the initial formatting.\n value = isNaN(value) ? nan : formatType(Math.abs(value), precision);\n\n // Trim insignificant zeros.\n if (trim) value = formatTrim(value);\n\n // If a negative value rounds to zero after formatting, and no explicit positive sign is requested, hide the sign.\n if (valueNegative && +value === 0 && sign !== \"+\") valueNegative = false;\n\n // Compute the prefix and suffix.\n valuePrefix = (valueNegative ? (sign === \"(\" ? sign : minus) : sign === \"-\" || sign === \"(\" ? \"\" : sign) + valuePrefix;\n valueSuffix = (type === \"s\" ? prefixes[8 + prefixExponent / 3] : \"\") + valueSuffix + (valueNegative && sign === \"(\" ? \")\" : \"\");\n\n // Break the formatted value into the integer “value” part that can be\n // grouped, and fractional or exponential “suffix” part that is not.\n if (maybeSuffix) {\n i = -1, n = value.length;\n while (++i < n) {\n if (c = value.charCodeAt(i), 48 > c || c > 57) {\n valueSuffix = (c === 46 ? decimal + value.slice(i + 1) : value.slice(i)) + valueSuffix;\n value = value.slice(0, i);\n break;\n }\n }\n }\n }\n\n // If the fill character is not \"0\", grouping is applied before padding.\n if (comma && !zero) value = group(value, Infinity);\n\n // Compute the padding.\n var length = valuePrefix.length + value.length + valueSuffix.length,\n padding = length < width ? new Array(width - length + 1).join(fill) : \"\";\n\n // If the fill character is \"0\", grouping is applied after padding.\n if (comma && zero) value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = \"\";\n\n // Reconstruct the final output based on the desired alignment.\n switch (align) {\n case \"<\": value = valuePrefix + value + valueSuffix + padding; break;\n case \"=\": value = valuePrefix + padding + value + valueSuffix; break;\n case \"^\": value = padding.slice(0, length = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length); break;\n default: value = padding + valuePrefix + value + valueSuffix; break;\n }\n\n return numerals(value);\n }\n\n format.toString = function() {\n return specifier + \"\";\n };\n\n return format;\n }\n\n function formatPrefix(specifier, value) {\n var f = newFormat((specifier = formatSpecifier(specifier), specifier.type = \"f\", specifier)),\n e = Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3,\n k = Math.pow(10, -e),\n prefix = prefixes[8 + e / 3];\n return function(value) {\n return f(k * value) + prefix;\n };\n }\n\n return {\n format: newFormat,\n formatPrefix: formatPrefix\n };\n}\n","import formatLocale from \"./locale.js\";\n\nvar locale;\nexport var format;\nexport var formatPrefix;\n\ndefaultLocale({\n thousands: \",\",\n grouping: [3],\n currency: [\"$\", \"\"]\n});\n\nexport default function defaultLocale(definition) {\n locale = formatLocale(definition);\n format = locale.format;\n formatPrefix = locale.formatPrefix;\n return locale;\n}\n","import {ticks, tickIncrement} from \"d3-array\";\nimport continuous, {copy} from \"./continuous.js\";\nimport {initRange} from \"./init.js\";\nimport tickFormat from \"./tickFormat.js\";\n\nexport function linearish(scale) {\n var domain = scale.domain;\n\n scale.ticks = function(count) {\n var d = domain();\n return ticks(d[0], d[d.length - 1], count == null ? 10 : count);\n };\n\n scale.tickFormat = function(count, specifier) {\n var d = domain();\n return tickFormat(d[0], d[d.length - 1], count == null ? 10 : count, specifier);\n };\n\n scale.nice = function(count) {\n if (count == null) count = 10;\n\n var d = domain();\n var i0 = 0;\n var i1 = d.length - 1;\n var start = d[i0];\n var stop = d[i1];\n var prestep;\n var step;\n var maxIter = 10;\n\n if (stop < start) {\n step = start, start = stop, stop = step;\n step = i0, i0 = i1, i1 = step;\n }\n \n while (maxIter-- > 0) {\n step = tickIncrement(start, stop, count);\n if (step === prestep) {\n d[i0] = start\n d[i1] = stop\n return domain(d);\n } else if (step > 0) {\n start = Math.floor(start / step) * step;\n stop = Math.ceil(stop / step) * step;\n } else if (step < 0) {\n start = Math.ceil(start * step) / step;\n stop = Math.floor(stop * step) / step;\n } else {\n break;\n }\n prestep = step;\n }\n\n return scale;\n };\n\n return scale;\n}\n\nexport default function linear() {\n var scale = continuous();\n\n scale.copy = function() {\n return copy(scale, linear());\n };\n\n initRange.apply(scale, arguments);\n\n return linearish(scale);\n}\n","import {tickStep} from \"d3-array\";\nimport {format, formatPrefix, formatSpecifier, precisionFixed, precisionPrefix, precisionRound} from \"d3-format\";\n\nexport default function tickFormat(start, stop, count, specifier) {\n var step = tickStep(start, stop, count),\n precision;\n specifier = formatSpecifier(specifier == null ? \",f\" : specifier);\n switch (specifier.type) {\n case \"s\": {\n var value = Math.max(Math.abs(start), Math.abs(stop));\n if (specifier.precision == null && !isNaN(precision = precisionPrefix(step, value))) specifier.precision = precision;\n return formatPrefix(specifier, value);\n }\n case \"\":\n case \"e\":\n case \"g\":\n case \"p\":\n case \"r\": {\n if (specifier.precision == null && !isNaN(precision = precisionRound(step, Math.max(Math.abs(start), Math.abs(stop))))) specifier.precision = precision - (specifier.type === \"e\");\n break;\n }\n case \"f\":\n case \"%\": {\n if (specifier.precision == null && !isNaN(precision = precisionFixed(step))) specifier.precision = precision - (specifier.type === \"%\") * 2;\n break;\n }\n }\n return format(specifier);\n}\n","import exponent from \"./exponent.js\";\n\nexport default function(step, value) {\n return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3 - exponent(Math.abs(step)));\n}\n","import exponent from \"./exponent.js\";\n\nexport default function(step, max) {\n step = Math.abs(step), max = Math.abs(max) - step;\n return Math.max(0, exponent(max) - exponent(step)) + 1;\n}\n","import exponent from \"./exponent.js\";\n\nexport default function(step) {\n return Math.max(0, -exponent(Math.abs(step)));\n}\n","export default function(specifier) {\n var n = specifier.length / 6 | 0, colors = new Array(n), i = 0;\n while (i < n) colors[i] = \"#\" + specifier.slice(i * 6, ++i * 6);\n return colors;\n}\n","import colors from \"../colors.js\";\n\nfunction ramp(range) {\n var n = range.length;\n return function(t) {\n return range[Math.max(0, Math.min(n - 1, Math.floor(t * n)))];\n };\n}\n\nexport default ramp(colors(\"44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725\"));\n\nexport var magma = ramp(colors(\"00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf\"));\n\nexport var inferno = ramp(colors(\"00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4\"));\n\nexport var plasma = ramp(colors(\"0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921\"));\n","export default function(grouping, thousands) {\n return function(value, width) {\n var i = value.length,\n t = [],\n j = 0,\n g = grouping[0],\n length = 0;\n\n while (i > 0 && g > 0) {\n if (length + g + 1 > width) g = Math.max(1, width - length);\n t.push(value.substring(i -= g, i + g));\n if ((length += g + 1) > width) break;\n g = grouping[j = (j + 1) % grouping.length];\n }\n\n return t.reverse().join(thousands);\n };\n}\n","export default function(numerals) {\n return function(value) {\n return value.replace(/[0-9]/g, function(i) {\n return numerals[+i];\n });\n };\n}\n","// Trims insignificant zeros, e.g., replaces 1.2000k with 1.2k.\nexport default function(s) {\n out: for (var n = s.length, i = 1, i0 = -1, i1; i < n; ++i) {\n switch (s[i]) {\n case \".\": i0 = i1 = i; break;\n case \"0\": if (i0 === 0) i0 = i; i1 = i; break;\n default: if (!+s[i]) break out; if (i0 > 0) i0 = 0; break;\n }\n }\n return i0 > 0 ? s.slice(0, i0) + s.slice(i1 + 1) : s;\n}\n","export function Transform(k, x, y) {\n this.k = k;\n this.x = x;\n this.y = y;\n}\n\nTransform.prototype = {\n constructor: Transform,\n scale: function(k) {\n return k === 1 ? this : new Transform(this.k * k, this.x, this.y);\n },\n translate: function(x, y) {\n return x === 0 & y === 0 ? this : new Transform(this.k, this.x + this.k * x, this.y + this.k * y);\n },\n apply: function(point) {\n return [point[0] * this.k + this.x, point[1] * this.k + this.y];\n },\n applyX: function(x) {\n return x * this.k + this.x;\n },\n applyY: function(y) {\n return y * this.k + this.y;\n },\n invert: function(location) {\n return [(location[0] - this.x) / this.k, (location[1] - this.y) / this.k];\n },\n invertX: function(x) {\n return (x - this.x) / this.k;\n },\n invertY: function(y) {\n return (y - this.y) / this.k;\n },\n rescaleX: function(x) {\n return x.copy().domain(x.range().map(this.invertX, this).map(x.invert, x));\n },\n rescaleY: function(y) {\n return y.copy().domain(y.range().map(this.invertY, this).map(y.invert, y));\n },\n toString: function() {\n return \"translate(\" + this.x + \",\" + this.y + \") scale(\" + this.k + \")\";\n }\n};\n\nexport var identity = new Transform(1, 0, 0);\n\ntransform.prototype = Transform.prototype;\n\nexport default function transform(node) {\n while (!node.__zoom) if (!(node = node.parentNode)) return identity;\n return node.__zoom;\n}\n","export function randInt(n) {\n return Math.floor(Math.random() * n);\n}\nexport function permutation(n) {\n let array = Array(n).fill(0).map((x, i) => i);\n for (let i = array.length - 1; i > 0; i--) {\n const j = randInt(i + 1);\n [array[i], array[j]] = [array[j], array[i]];\n }\n return array;\n}\nexport function times(n, func, ...args) {\n let result = Array(n);\n for (let i = 0; i < n; i++)\n result[i] = func(...args);\n return result;\n}\nexport function zeros(n) {\n return Array(n).fill(0);\n}\nexport function vecSub(a, b) {\n let result = Array(a.length);\n for (let i = 0; i < result.length; i++)\n result[i] = a[i] - b[i];\n return result;\n}\nexport function vecAdd(a, b) {\n let result = Array(a.length);\n for (let i = 0; i < result.length; i++)\n result[i] = a[i] + b[i];\n return result;\n}\nexport function vecDot(a, b) {\n let result = 0;\n for (let i = 0; i < a.length; i++)\n result += a[i] * b[i];\n return result;\n}\nexport function vecScale(a, b) {\n let result = Array(a.length);\n for (let i = 0; i < result.length; i++)\n result[i] = a[i] * b;\n return result;\n}\nexport function zeroMat(n, m) {\n return times(n, zeros, m);\n}\nexport function matMulInto(result, A, B) {\n let a = A.length, b = A[0].length, c = B[0].length;\n for (let i = 0; i < a; i++)\n for (let k = 0; k < c; k++) {\n let s = 0;\n for (let j = 0; j < b; j++)\n s += A[i][j] * B[j][k];\n result[i][k] = s;\n }\n}\nexport function matMul(A, B) {\n let result = times(A.length, () => Array(B[0].length));\n matMulInto(result, A, B);\n return result;\n}\nexport function matTcrossprodInto(result, A, B) {\n let a = A.length, b = A[0].length, c = B.length;\n for (let i = 0; i < a; i++)\n for (let k = 0; k < c; k++) {\n let s = 0;\n for (let j = 0; j < b; j++)\n s += A[i][j] * B[k][j];\n result[i][k] = s;\n }\n}\nexport function matTcrossprod(A, B) {\n let result = times(A.length, Array, B.length);\n matTcrossprodInto(result, A, B);\n return result;\n}\nexport function matAdd(A, B) {\n let result = times(A.length, Array, A[0].length);\n for (let i = 0; i < A.length; i++)\n for (let j = 0; j < A[0].length; j++)\n result[i][j] = A[i][j] + B[i][j];\n return result;\n}\nexport function matScale(A, b) {\n return A.map(row => row.map(value => value * b));\n}\nexport function matScaleInto(A, b) {\n for (let i = 0; i < A.length; i++)\n for (let j = 0; j < A[0].length; j++)\n A[i][j] *= b;\n}\nexport function matAddInto(A, B) {\n for (let i = 0; i < A.length; i++)\n for (let j = 0; j < A[0].length; j++)\n A[i][j] += B[i][j];\n}\nexport function matTranspose(A) {\n let result = times(A[0].length, Array, A.length);\n for (let i = 0; i < A.length; i++)\n for (let j = 0; j < A[0].length; j++)\n result[j][i] = A[i][j];\n return result;\n}\nexport function removeSpin(motion, proj) {\n /* Ensure each row of motion is in the null space of the rows of proj.\n proj rows are assumed to be orthonormal.\n \n This is used to avoid adding random spin to the projection. */\n let result = [...motion];\n for (let i = 0; i < result.length; i++)\n for (let j = 0; j < proj.length; j++)\n result[i] = vecSub(result[i], vecScale(proj[j], vecDot(motion[i], proj[j])));\n return result;\n}\n//# sourceMappingURL=math.js.map","/**** Utility functions ****/\nexport function has(object, name) {\n return object.hasOwnProperty(name);\n}\nexport function elementVisible(el) {\n // Check several ways of hiding an element or its parents.\n // Hopefully this will work for slideshows.\n let parent = el;\n while (true) {\n let style = window.getComputedStyle(parent);\n if (style.opacity === \"0\" || style.display === \"none\" || style.visibility !== \"visible\")\n return false;\n if (!parent.parentElement)\n break;\n parent = parent.parentElement;\n }\n //https://stackoverflow.com/a/22480938 \n let rect = el.getBoundingClientRect();\n return rect.top < window.innerHeight && rect.bottom >= 0 &&\n rect.left < window.innerWidth && rect.right >= 0;\n}\nexport function locateEventInElement(event, el) {\n let rect = el.getBoundingClientRect();\n return [\n (event.x - rect.left) / rect.width * el.offsetWidth,\n (event.y - rect.top) / rect.height * el.offsetHeight\n ];\n}\nexport function toggleVisible(el) {\n if (el.style.display == \"none\")\n el.style.display = \"block\";\n else\n el.style.display = \"none\";\n}\nexport function hexByte(value) {\n value = Math.max(0, Math.min(255, Math.round(value)));\n return (value < 16 ? '0' : '') + value.toString(16);\n}\n//# sourceMappingURL=util.js.map","/* \"Guide\" gradients for projection pursuit.\n\n A guide is defined by a potential energy function.\n \n The only thing that matters for the guide is the gradient of this function.\n */\nimport { vecSub, vecDot, zeroMat, randInt, matScaleInto } from './math.js';\n/*\nI tried TensorFlow (tfjs) for gradients, but in the end did them by hand.\n\n\nfunction gradRepulsion(proj, X, power, fineScale) {\n let k = 1000;\n let A = Array(k);\n \n for(let i=0;i mag2[j]-mag2[i]);\n \n let grad = zeroMat(m,n);\n for(let j=0;j<3;j++)\n for(let i=0;i gradSparseRank(proj, 0.1),\n \"ultralocal\": (proj, X) => gradRepulsion(proj, X, -1, 0.05, 0.01),\n \"local\": (proj, X) => gradRepulsion(proj, X, 0, 0.01, 0.5),\n \"pca\": (proj, X) => gradRepulsion(proj, X, 1, 0, 0.5),\n \"outlier\": (proj, X) => gradRepulsion(proj, X, 2, 0, 5),\n \"push\": (proj, X) => gradCentralRepulsion(proj, X, 0.5, 0.01, 0.5),\n \"pull\": (proj, X) => gradCentralRepulsion(proj, X, 0.5, 0.01, -0.2),\n};\n//# sourceMappingURL=guides.js.map","import jstat from 'jstat';\nconst { normal } = jstat;\nimport { SVD } from 'svd-js';\nimport { rgb, scaleLinear, select, drag, interpolateViridis } from 'd3';\nimport { vecAdd, vecScale, vecDot, times, zeros, zeroMat, matAddInto, matScaleInto, matTcrossprodInto, matTranspose, matAdd, matScale, removeSpin, permutation } from './math.js';\nimport { has, elementVisible, locateEventInElement, toggleVisible, hexByte } from './util.js';\nimport { gradTable } from './guides.js';\nlet template = `~\n
~\n ~\n\n
~\n ~\n
~\n
~\n
~\n \n
\n \n
\n \n
\n \n \n \n \n \n \n \n
Brush size
Zoom
Damping
Heat
Label strength
Guide strength
\n
~\n
~\n\n
~\n ~\n \n ~\n \n ~\n \n
~\n Guide\n ~ \n
~\n \n
~\n \n
~\n \n
~\n
~\n
~\n`.replace(/~\\s+/g, ''); // Strip whitespace marked with initial '~'.\nlet playSvg = `\n \n`;\nlet pauseSvg = `\n \n \n`;\n/** Class to create and animate a Langevin Tour widget\n *\n * Emits a \"changeFilter\" event when a label checkbox is checked/unchecked.\n *\n * Emits a \"changeSelection\" event when brushing occurs.\n */\nexport class Langevitour extends EventTarget {\n /**\n * Create a Langevin Tour widget.\n * @param container Element to insert widget into.\n * @param width Desired initial width of widget.\n * @param height Desired initial height of widget.\n */\n constructor(container, width, height) {\n super();\n this.width = 1;\n this.height = 1;\n this.size = 1;\n // We stash the original size when we go full-screen\n this.fullscreen = false;\n this.originalWidth = 1;\n this.originalHeight = 1;\n this.center = [];\n this.scale = [];\n this.X = [[], []];\n this.n = 0;\n this.m = 0;\n this.colnames = [];\n this.permutor = [];\n this.unpermutor = [];\n this.rownames = [];\n this.group = [];\n this.pointSize = [];\n this.levels = [];\n this.levelColors = [];\n this.lineFrom = [];\n this.lineTo = [];\n this.lineColors = [];\n this.fills = [];\n //Filters from outside, primarily to support \"crosstalk\"\n this.filter = null;\n //Selection both from crosstalk and internal\n this.selection = null;\n this.selectionChanged = false; // Do we need to emit a changeSelection event -- delayed to mouse up\n this.axes = [];\n this.labelData = [];\n // State of the system!\n this.proj = [[], []];\n this.vel = [[], []];\n this.zoom = 1;\n this.xScaleUnit = scaleLinear(); // Used for labels\n this.yScaleUnit = scaleLinear();\n this.xScale = scaleLinear(); // Used for points\n this.yScale = scaleLinear();\n this.xScaleClamped = scaleLinear();\n this.yScaleClamped = scaleLinear();\n this.haveData = false;\n this.playing = true;\n this.frameScheduled = false;\n this.lastTime = 0; // Last frame time, in seconds. Set to zero to cause no step on the next frame.\n this.mouseInCheckbox = false; // Track is mouse in checkbox. Do not drag if in checkbox.\n this.dragging = false; // Used to avoid dragging from checkbox. Also adjusts physics during drag.\n this.fps = []; // FPS for up to the last 100 frames\n this.computeMessage = \"\"; // Warnings such as hiding too many variables.\n this.mousing = false; // Should overlay be visible?\n this.mouseDown = false; // While this mouse is down, the selection continues to be updated.\n this.mouseWentDown = false; // Set when mouse button goes down. Unset once selection updated.\n this.mouseShiftKey = false; // Shift was pressed at mouse down, we want to extend the current selection.\n this.mouseX = 0;\n this.mouseY = 0;\n this.rightMouseDown = false; // Used to directly interact with projection. Note ctrl+left also triggers this, as right drag is difficult on trackpad.\n this.rightMouseWentDown = false;\n this.tugging = false;\n this.tugX = 0; // Desired position in projection space.\n this.tugY = 0;\n this.tugPoints = []; // Indices of points being tugged.\n // Only used during doFrame. \n // Properties only to avoid re-allocation.\n this.xy = [[], []];\n this.fillsFrame = [];\n this.pointActive = [];\n // Set up elements in a shadow DOM to isolate from document style.\n // The extra div seems necessary to avoid weird shrinkage with resizing.\n this.container = container;\n this.shadowDiv = document.createElement(\"div\");\n this.container.appendChild(this.shadowDiv);\n this.shadowRoot = this.shadowDiv.attachShadow({ mode: 'open' });\n this.shadowRoot.innerHTML = template;\n this.shadowChild = this.shadowRoot.firstChild;\n this.canvas = this.get('canvas');\n this.overlay = this.get('overlay');\n // Allow this to be found using document.getElementById(name).langevitour\n // @ts-ignore\n this.container.langevitour = this;\n this.resize(width, height);\n // Track mouse:\n // svg overlay only appears when mouse in plot area\n // row name labels use mouse position\n let plotDiv = this.get('plotDiv');\n plotDiv.addEventListener('mouseover', (e) => {\n this.mousing = true;\n this.scheduleFrameIfNeeded();\n });\n plotDiv.addEventListener('mouseout', (e) => {\n this.mousing = false;\n this.mouseDown = false;\n this.rightMouseDown = false;\n this.scheduleFrameIfNeeded();\n });\n let handleMouseMove = (e) => {\n [this.mouseX, this.mouseY] = locateEventInElement(e, this.canvas);\n if (!e.target.classList.contains(\"overlay\")) {\n this.mouseDown = false;\n this.rightMouseDown = false;\n return false;\n }\n // Ctrl+left click and right click are treated the same\n this.mouseDown = e.buttons == 1 && !e.ctrlKey;\n this.rightMouseDown = e.buttons == 2 || (e.buttons == 1 && e.ctrlKey);\n this.scheduleFrameIfNeeded();\n return true;\n };\n plotDiv.addEventListener('mousemove', (e) => {\n handleMouseMove(e);\n });\n plotDiv.addEventListener('mousedown', (e) => {\n if (!handleMouseMove(e))\n return; //Interacting with infoBox.\n let el = this.get('infoBox');\n if (el.style.visibility == 'visible') {\n el.style.visibility = 'hidden';\n return;\n }\n if (this.mouseDown) {\n this.mouseWentDown = true;\n this.mouseShiftKey = e.shiftKey;\n }\n if (this.rightMouseDown) {\n this.rightMouseWentDown = true;\n }\n this.scheduleFrameIfNeeded();\n });\n plotDiv.addEventListener('mouseup', (e) => {\n this.mouseDown = false;\n this.rightMouseDown = false;\n this.scheduleFrameIfNeeded();\n });\n // Hide fullscreen button if not available\n if (this.container.requestFullscreen == null)\n this.get('fullscreenButton').style.display = 'none';\n // Handle fullscreen\n // Complication: Window may resize after getting fullscreenchange event, so we have to handle window resize.\n // - Window does not resize immediately in Chrome.\n // - Macs with webcam cutout do something weird on Firefox.\n this.get('fullscreenButton').addEventListener('click', () => {\n if (!document.fullscreenElement) {\n this.shadowDiv.requestFullscreen();\n }\n else if (document.fullscreenElement === this.shadowDiv && document.exitFullscreen) {\n document.exitFullscreen();\n }\n });\n let handleWindowSize = () => {\n if (!this.fullscreen)\n return;\n let el = this.shadowDiv;\n let width = window.innerWidth;\n let height = window.innerHeight;\n let pad = Math.max(0, width - height) / 2;\n el.style.paddingLeft = pad + 'px';\n this.width = width - pad;\n this.height = height;\n this.configure();\n };\n this.shadowDiv.addEventListener('fullscreenchange', () => {\n let el = this.shadowDiv;\n if (document.fullscreenElement === el) {\n // Stash original size\n if (!this.fullscreen) {\n this.fullscreen = true;\n this.originalWidth = this.width;\n this.originalHeight = this.height;\n window.addEventListener('resize', handleWindowSize);\n }\n handleWindowSize();\n // ... further window resize events may occur while full screen ...\n }\n else if (this.fullscreen) {\n // Restore original size\n this.fullscreen = false;\n el.style.paddingLeft = '0px';\n this.width = this.originalWidth;\n this.height = this.originalHeight;\n window.removeEventListener('resize', handleWindowSize);\n this.configure();\n }\n });\n // Info box\n this.get('infoButton').addEventListener('click', () => {\n let el = this.get('infoBox');\n if (el.style.visibility == 'visible' || !this.haveData) {\n el.style.visibility = 'hidden';\n }\n else {\n el.style.visibility = 'visible';\n this.get('infoBoxProj').style.display = 'none';\n this.get('infoBoxState').style.display = 'none';\n this.get('infoBoxInfo').innerHTML = `

${this.X.length.toLocaleString(\"en-US\")} points.

`;\n }\n });\n this.get('infoBoxProjButton').addEventListener('click', () => {\n let el = this.getInput('infoBoxProj');\n toggleVisible(el);\n if (el.style.display != 'none') {\n let matStr = 'projection <- cbind(\\n c(';\n matStr += this.proj.map(line => line.map((item, i) => (item / this.scale[i]).toFixed(Math.ceil(Math.log10(Math.max(0, this.scale[i])) + 4))).join(',')).join('),\\n c(');\n matStr += '))\\nprojected <- as.matrix(X) %*% projection';\n this.getInput('infoBoxProj').value = matStr;\n }\n });\n this.get('infoBoxStateButton').addEventListener('click', () => {\n let el = this.getInput('infoBoxState');\n toggleVisible(el);\n if (el.style.display != 'none')\n el.value = JSON.stringify(this.getState(), null, 4);\n });\n // Play button\n this.get('playButton').addEventListener('click', () => this.setState({ playing: !this.playing }));\n }\n get(className) {\n return this.shadowChild.getElementsByClassName(className)[0];\n }\n getInput(className) {\n return this.get(className);\n }\n getString(className) {\n return this.getInput(className).value;\n }\n getNumber(className) {\n return Number(this.getInput(className).value);\n }\n getChecked(className) {\n return this.getInput(className).checked;\n }\n /* Notify listeners of label checkbox change. */\n emitChangeFilter() {\n setTimeout(() => this.dispatchEvent(new Event(\"changeFilter\")), 0);\n }\n emitChangeSelectionIfNeeded() {\n if (!this.selectionChanged)\n return;\n this.selectionChanged = false;\n setTimeout(() => this.dispatchEvent(new Event(\"changeSelection\")), 0);\n }\n /**\n * Show data in the widget. Use \"null\" to clear the widget.\n *\n * data.X A row-major matrix, where each row represents a point and each column represents a variable.\n *\n * data.colnames A name for each column in X.\n *\n * data.group Group number for each point. Integer values starting from 0.\n *\n * data.levels Group names for each group in data.group.\n *\n * [data.scale] Scale for each column.\n *\n * [data.center] Center for each column.\n *\n * [data.rownames] A name for each point.\n *\n * [data.extraAxes] A matrix with each column defining a projection of interest.\n *\n * [data.extraAxesNames] A name for each extra axis.\n *\n * [data.lineFrom] Rows of X to draw lines from.\n *\n * [data.lineTo] Rows of X to draw lines to.\n *\n * [data.lineColors] Color for each line.\n *\n * [data.axisColors] CSS colors for each variable and then optionally for each extra axis.\n *\n * [data.levelColors] CSS colors for each level.\n *\n * [data.colorVariation] Amount of brightness variation of points, between 0 and 1.\n *\n * [data.pointSize] Radius of points in pixels either, a number or an array of numbers for each point.\n *\n * [data.state] State to be passed on to setState().\n */\n renderValue(data) {\n if (!data) {\n this.haveData = false;\n this.configure();\n return;\n }\n this.haveData = true;\n //TODO: checking\n this.n = data.X.length;\n this.m = data.X[0].length;\n let axisColors = data.axisColors || [];\n this.center = data.center || Array(this.m).fill(0);\n this.scale = data.scale || Array(this.m).fill(1);\n // Shuffling is not optional.\n this.permutor = permutation(this.n);\n this.unpermutor = Array(this.n);\n for (let i = 0; i < this.n; i++)\n this.unpermutor[this.permutor[i]] = i;\n this.X = this.permutor.map(i => data.X[i]);\n // Store data internally in centered and scaled form.\n this.X = this.X.map(item => item.map((value, i) => (value - this.center[i]) / this.scale[i]));\n if (data.pointSize == null) { //check for null or undefined\n this.pointSize = Array(this.n).fill(1);\n }\n else if (typeof (data.pointSize) === \"number\") {\n this.pointSize = Array(this.n).fill(data.pointSize);\n }\n else {\n let pointSize = data.pointSize;\n this.pointSize = this.permutor.map(i => pointSize[i]);\n }\n if (!data.rownames || data.rownames.length == 0) {\n this.rownames = [];\n }\n else {\n let rownames = data.rownames;\n this.rownames = this.permutor.map(i => rownames[i]);\n }\n this.colnames = data.colnames;\n this.lineFrom = (data.lineFrom || []).map(i => this.unpermutor[i]);\n this.lineTo = (data.lineTo || []).map(i => this.unpermutor[i]);\n this.lineColors = (data.lineColors || []);\n // Default to semi-transparent black lines\n if (this.lineFrom.length && !this.lineColors.length)\n this.lineColors = this.lineFrom.map(() => \"#00000088\");\n this.axes = [];\n if (data.extraAxes && data.extraAxesNames)\n for (let i = 0; i < data.extraAxes[0].length; i++) {\n let proj = data.extraAxes.map(row => row[i]);\n let center = vecDot(proj, this.center);\n let projFromScaled = proj.map((value, j) => value * this.scale[j]);\n let scale = Math.sqrt(vecDot(projFromScaled, projFromScaled));\n let unit = vecScale(projFromScaled, 1 / scale);\n this.axes.push({\n name: data.extraAxesNames[i],\n unit: unit,\n scale: scale,\n center: center,\n color: axisColors[i + this.m],\n proj: [] //Filled in below.\n });\n }\n for (let i = 0; i < this.m; i++) {\n let unit = zeros(this.m);\n unit[i] = 1;\n this.axes.push({\n name: data.colnames[i],\n center: this.center[i],\n scale: this.scale[i],\n unit: unit,\n color: axisColors[i],\n proj: [] //Filled in below.\n });\n }\n // Precompute projection of all data onto all axes\n for (let i = 0; i < this.axes.length; i++) {\n this.axes[i].proj = this.X.map(vec => vecDot(vec, this.axes[i].unit));\n }\n this.levels = data.levels;\n this.group = this.permutor.map(i => data.group[i]);\n let nGroups = this.levels.length;\n this.levelColors = (data.levelColors || []).slice();\n // Pick a palette if not given\n for (let i = this.levelColors.length; i < nGroups; i++) {\n let angle = (i + 1 / 3) / nGroups;\n let value = 104;\n let r = value * (1 + Math.cos(angle * Math.PI * 2));\n let g = value * (1 + Math.cos((angle + 1 / 3) * Math.PI * 2));\n let b = value * (1 + Math.cos((angle + 2 / 3) * Math.PI * 2));\n this.levelColors[i] = rgb(r, g, b).formatHex();\n }\n // Point colors are given a small back-to-front brightness gradient,\n // to add some variation and give a pseudo-3D effect.\n let colorVariation = data.colorVariation == null ? 0.1 : data.colorVariation;\n this.fills = [];\n for (let i = 0; i < this.n; i++) {\n let pointColor = rgb(this.levelColors[this.group[i]]);\n let value = 1 + colorVariation * (i / this.n * 2 - 1);\n pointColor.r *= value;\n pointColor.g *= value;\n pointColor.b *= value;\n this.fills[i] = pointColor.formatHex();\n }\n this.labelData = [];\n if (this.levels.length > 1)\n for (let i = 0; i < this.levels.length; i++) {\n let vec = zeros(this.m);\n for (let j = 0; j < this.n; j++)\n if (this.group[j] == i)\n vec = vecAdd(vec, this.X[j]);\n vec = vecScale(vec, 1 / Math.sqrt(vecDot(vec, vec)));\n this.labelData.push({\n type: 'level',\n index: i,\n label: this.levels[i],\n vec: vec,\n color: this.levelColors[i],\n active: true,\n x: 2, y: 0,\n halfWidth: 0, halfHeight: 0, selected: 0,\n });\n }\n for (let i = 0; i < this.axes.length; i++) {\n this.labelData.push({\n type: 'axis',\n index: i,\n label: this.axes[i].name,\n vec: this.axes[i].unit,\n color: this.axes[i].color || '#000000',\n active: true,\n x: 2, y: 0,\n halfWidth: 0, halfHeight: 0, selected: 0,\n });\n }\n // Set initial projection state \n this.proj = zeroMat(2, this.m);\n this.proj[0][0] = 1;\n this.proj[1][1] = 1;\n this.vel = zeroMat(2, this.m);\n // Only used in doFrame. However this is a fairly large amount of memory that needs to be used each time.\n this.xy = zeroMat(2, this.n);\n this.fillsFrame = Array(this.n).fill(\"\");\n this.pointActive = Array(this.n).fill(true);\n this.configure();\n if (data.state)\n this.setState(data.state);\n }\n /**\n * Resize the widget.\n *\n * @param {number} width New width.\n * @param {number} height New height.\n */\n resize(width, height) {\n width = Math.max(200, width);\n height = Math.max(200, height);\n if (this.fullscreen) {\n this.originalWidth = width;\n this.originalHeight = height;\n }\n else {\n this.width = Math.max(200, width);\n this.height = Math.max(200, height);\n this.configure();\n }\n }\n configure() {\n this.canvas.style.width = this.width + 'px';\n this.overlay.style.width = this.width + 'px';\n // Scrollbars will appear if very small\n let controlHeight = this.get('controlDiv').offsetHeight + 5;\n this.size = Math.max(100, Math.min(this.width - 100, this.height - controlHeight));\n this.canvas.style.height = this.size + 'px';\n this.overlay.style.height = this.size + 'px';\n this.get('playButton').innerHTML = this.playing ? pauseSvg : playSvg;\n // Clean up and return if no data.\n if (!this.haveData) {\n // Clear any old display\n this.get('messageArea').innerText = '';\n this.overlay.style.opacity = \"0\";\n let ctx = this.canvas.getContext(\"2d\");\n ctx.scale(1, 1);\n ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);\n return;\n }\n this.configureScales();\n /* Draggable labels */\n let overlay = select(this.overlay);\n overlay.selectAll('*').remove();\n this.mouseInCheckbox = false;\n let thys = this; //sigh\n let divs = overlay\n .selectAll('div')\n .data(this.labelData)\n .join(enter => {\n let div = enter.append('div')\n .classed('labelDiv', true);\n div.append('input')\n .attr('type', 'checkbox')\n .property('checked', d => d.active)\n .on('change', function (e, d) {\n d.active = this.checked;\n thys.scheduleFrameIfNeeded();\n thys.emitChangeFilter();\n })\n .on('mouseover', () => { this.mouseInCheckbox = true; })\n .on('mouseout', () => { this.mouseInCheckbox = false; });\n div.append('span');\n return div;\n });\n divs\n .style('cursor', 'grab')\n .on('mouseover', (e, d) => { d.selected += 1; refreshLabels(); })\n .on('mouseout', (e, d) => { d.selected = Math.max(0, d.selected - 1); refreshLabels(); });\n divs\n .select('span')\n .text(d => d.label)\n .style('color', d => d.color);\n divs.each(function (d) {\n d.halfWidth = this.offsetWidth / 2;\n d.halfHeight = this.offsetHeight / 2;\n });\n function refreshLabels() {\n let maxX = thys.xScaleUnit.invert(thys.width);\n for (let item of thys.labelData) {\n item.x = Math.max(-1, Math.min(maxX, item.x));\n item.y = Math.max(-1, Math.min(1, item.y));\n }\n divs\n .style('left', d => thys.xScaleUnit(d.x) - d.halfWidth + 'px')\n .style('top', d => thys.yScaleUnit(d.y) - d.halfHeight + 'px')\n .style('background', d => d.selected ? '#aaa' : '#ddd');\n }\n let makeDraggable = drag()\n .subject(function (e, d) {\n return { x: d.x, y: d.y };\n })\n .on('start', function (e, d) {\n // Do not drag checkbox.\n if (thys.mouseInCheckbox)\n return;\n thys.dragging = true;\n this.style.cursor = 'grabbing';\n d.selected += 1;\n })\n .on('drag', function (e, d) {\n // We decided not to drag because we started on the checkbox.\n if (!thys.dragging)\n return;\n let [x, y] = locateEventInElement(e.sourceEvent, thys.canvas);\n d.x = thys.xScaleUnit.invert(x);\n d.y = thys.yScaleUnit.invert(y);\n refreshLabels();\n })\n .on('end', function (e, d) {\n if (!thys.dragging)\n return;\n thys.dragging = false;\n this.style.cursor = 'grab';\n d.selected = Math.max(0, d.selected - 1);\n });\n makeDraggable(divs);\n /* Set all as not selected.\n Reposition labels that are not currently in use. */\n let cols = Math.ceil((25 * this.labelData.length) / (this.size - 40));\n for (let i = 0; i < this.labelData.length; i++) {\n let d = this.labelData[i];\n d.selected = 0;\n if (d.x < 1)\n continue;\n let col = i % cols, row = (i - col) / cols;\n d.x = this.xScaleUnit.invert(this.size + 10 + d.halfWidth + (i % cols) * (this.width - this.size - 10) / cols);\n d.y = this.yScaleUnit.invert(20 + row * 25);\n }\n refreshLabels();\n this.scheduleFrameIfNeeded();\n }\n configureScales() {\n this.zoom = Math.pow(10, -this.getNumber('zoomInput'));\n this.xScaleUnit = scaleLinear()\n .domain([-1, 1]).range([2.5, this.size - 2.5]);\n this.yScaleUnit = scaleLinear()\n .domain([-1, 1]).range([this.size - 2.5, 2.5]);\n this.xScale = scaleLinear()\n .domain([-this.zoom, this.zoom]).range([2.5, this.size - 2.5]);\n this.yScale = scaleLinear()\n .domain([-this.zoom, this.zoom]).range([this.size - 2.5, 2.5]);\n this.xScaleClamped = this.xScale.copy().clamp(true);\n this.yScaleClamped = this.yScale.copy().clamp(true);\n }\n /**\n * Get the current widget state.\n */\n getState() {\n let result = {};\n result.playing = this.playing;\n result.axesOn = this.getChecked('axesCheckbox');\n result.heatOn = this.getChecked('heatCheckbox');\n result.guideType = this.getString('guideSelect');\n result.labelAttractionOn = this.getChecked('labelCheckbox');\n result.damping = this.getNumber('dampInput');\n result.heat = this.getNumber('heatInput');\n result.guide = this.getNumber('guideInput');\n result.labelAttraction = this.getNumber('labelInput');\n result.zoom = this.getNumber('zoomInput');\n result.brush = this.getNumber('brushInput');\n result.labelInactive = [];\n result.labelPos = {};\n for (let item of this.labelData) {\n if (!item.active)\n result.labelInactive.push(item.label);\n if (item.x < 1)\n result.labelPos[item.label] = [item.x, item.y];\n }\n result.projection = this.proj;\n // Potentially large.\n if (this.selection)\n result.selection = this.unpermutor.map(i => this.selection[i]);\n else\n result.selection = null;\n // Potentially large.\n if (this.filter)\n result.filter = this.unpermutor.map(i => this.filter[i]);\n else\n result.filter = null;\n return result;\n }\n /**\n * Set the widget state.\n *\n * Can be used to restore a previous state of the widget obtained with getState().\n *\n * @param state A JSON string or an Object containing the desired state.\n */\n setState(state) {\n let needChangeFilter = false;\n let needChangeSelection = false;\n if (typeof state == \"string\")\n state = JSON.parse(state);\n if (!state)\n return;\n if (has(state, 'playing')) {\n // Don't leap forward in time when we start playing again.\n if (!this.playing && state.playing)\n this.lastTime = 0;\n this.playing = state.playing;\n }\n if (has(state, 'axesOn'))\n this.getInput('axesCheckbox').checked = state.axesOn;\n if (has(state, 'heatOn'))\n this.getInput('heatCheckbox').checked = state.heatOn;\n // Old \n if (has(state, 'pointRepulsionType'))\n this.getInput('guideSelect').value = state.pointRepulsionType;\n // New\n if (has(state, 'guideType'))\n this.getInput('guideSelect').value = state.guideType;\n if (has(state, 'labelAttractionOn'))\n this.getInput('labelCheckbox').checked = state.labelAttractionOn;\n if (has(state, 'damping'))\n this.getInput('dampInput').value = state.damping;\n if (has(state, 'heat'))\n this.getInput('heatInput').value = state.heat;\n // Old\n if (has(state, 'pointRepulsion'))\n this.getInput('guideInput').value = state.pointRepulsion;\n // New\n if (has(state, 'guide'))\n this.getInput('guideInput').value = state.guide;\n if (has(state, 'labelAttraction'))\n this.getInput('labelInput').value = state.labelAttraction;\n if (has(state, 'zoom'))\n this.getInput('zoomInput').value = state.zoom;\n if (has(state, 'brush'))\n this.getInput('brushInput').value = state.brush;\n if (has(state, 'labelInactive')) {\n for (let item of this.labelData)\n item.active = !state.labelInactive.includes(item.label);\n needChangeFilter = true;\n }\n if (has(state, 'labelPos')) {\n for (let item of this.labelData) {\n if (has(state.labelPos, item.label)) {\n item.x = state.labelPos[item.label][0];\n item.y = state.labelPos[item.label][1];\n }\n else {\n item.x = 1;\n }\n }\n }\n if (has(state, 'projection'))\n this.proj = Array.from(state.projection.map(item => Array.from(item)));\n if (has(state, 'selection')) {\n if (state.selection === null)\n this.selection = null;\n else\n this.selection = this.permutor.map(i => state.selection[i]);\n this.selectionChanged = true;\n needChangeSelection = true;\n }\n if (has(state, 'filter')) {\n if (state.filter === null)\n this.filter = null;\n else\n this.filter = this.permutor.map(i => state.filter[i]);\n }\n this.configure();\n if (needChangeFilter)\n this.emitChangeFilter();\n if (needChangeSelection)\n this.emitChangeSelectionIfNeeded();\n }\n scheduleFrameIfNeeded() {\n if (this.frameScheduled || !this.haveData)\n return;\n window.requestAnimationFrame(this.doFrame.bind(this));\n this.frameScheduled = true;\n }\n /* Update display.\n \n Also updates selection if mouse is down.\n \n Also schedules another frame if needed.\n */\n doFrame(time) {\n this.frameScheduled = false;\n if (!this.haveData)\n return;\n if (!elementVisible(this.container)) {\n // Don't leap forward in time when we become visible again.\n this.lastTime = 0;\n // We aren't visible. Wait a while.\n window.setTimeout(this.scheduleFrameIfNeeded.bind(this), 100);\n return;\n }\n time /= 1000.0; //Convert to seconds\n let elapsed = 0;\n if ((this.playing || this.tugging) && this.lastTime != 0) {\n elapsed = time - this.lastTime;\n this.fps.push(Math.round(1 / elapsed));\n if (this.fps.length > 100)\n this.fps.shift();\n }\n this.lastTime = time;\n this.compute(elapsed);\n this.configureScales();\n let selectedAxis = null;\n let selectedLevel = null;\n let selected = this.labelData.filter(d => d.selected);\n if (selected.length) {\n if (selected[0].type == 'axis')\n selectedAxis = selected[0].index;\n else\n selectedLevel = selected[0].index;\n }\n let showAxes = this.getChecked('axesCheckbox');\n let levelActive = Array(this.levels.length).fill(true);\n for (let item of this.labelData)\n if (item.type == 'level')\n levelActive[item.index] = item.active;\n // Note: pointActive is updated in compute.\n // Points within brush distance, for brushing and row label\n let brushRadius = this.size * 0.05 * Math.pow(10, this.getNumber('brushInput'));\n let brushPoints = [];\n if (this.mouseX < this.size) {\n for (let i = 0; i < this.n; i++) {\n if (!this.pointActive[i])\n continue;\n let d2 = Math.pow((this.xScaleClamped(this.xy[0][i]) - this.mouseX), 2) +\n Math.pow((this.yScaleClamped(this.xy[1][i]) - this.mouseY), 2);\n if (d2 > Math.pow(brushRadius, 2))\n continue;\n brushPoints.push({ index: i, d2: d2 });\n }\n brushPoints.sort((a, b) => a.d2 - b.d2);\n }\n // Respond to right-mouse tugging\n if (this.rightMouseWentDown) {\n this.tugPoints = brushPoints.map(item => item.index);\n this.rightMouseWentDown = false;\n }\n this.tugging = this.rightMouseDown && this.tugPoints.length > 0;\n if (this.tugging) {\n this.tugX = this.xScale.invert(this.mouseX);\n this.tugY = this.yScale.invert(this.mouseY);\n }\n // Update selection.\n // This is kind of an odd place to do this.\n if (this.mouseDown || this.mouseWentDown) {\n // Clear selection on mouse down unless shift was pressed.\n if (this.mouseWentDown && !this.mouseShiftKey) {\n this.selection = null;\n this.selectionChanged = true;\n }\n if (brushPoints.length) {\n if (!this.selection) {\n this.selection = Array(this.n).fill(false);\n this.selectionChanged = true;\n }\n for (let i = 0; i < brushPoints.length; i++) {\n if (!this.selection[brushPoints[i].index]) {\n this.selection[brushPoints[i].index] = true;\n this.selectionChanged = true;\n }\n }\n }\n this.mouseWentDown = false;\n //Note: at end of this function, we decide if it's time to emit a changeSelection event\n }\n this.overlay.style.opacity = this.mousing ? \"1\" : \"0\";\n // Setup canvas and get context\n // Adjust for HiDPI screens and zoom level\n // see https://developer.mozilla.org/en-US/docs/Web/API/Window/devicePixelRatio\n let ratio = window.devicePixelRatio;\n this.canvas.width = Math.floor(this.width * ratio);\n this.canvas.height = Math.floor(this.size * ratio);\n let ctx = this.canvas.getContext(\"2d\");\n ctx.scale(ratio, ratio);\n ctx.clearRect(0, 0, this.width, this.size);\n let rx = this.xScale.range(), ry = this.yScale.range();\n ctx.strokeStyle = '#000';\n ctx.fillStyle = '#fff';\n ctx.fillRect(rx[0], ry[0], rx[1] - rx[0], ry[1] - ry[0]);\n ctx.strokeRect(rx[0], ry[0], rx[1] - rx[0], ry[1] - ry[0]);\n // Axes\n let axisScale = 0.75 * this.zoom;\n ctx.strokeStyle = '#ccc';\n if (showAxes)\n for (let i = 0; i < this.axes.length; i++) {\n let xProj = vecDot(this.proj[0], this.axes[i].unit);\n let yProj = vecDot(this.proj[1], this.axes[i].unit);\n ctx.beginPath();\n ctx.moveTo(this.xScale(0), this.yScale(0));\n ctx.lineTo(this.xScale(axisScale * xProj), this.yScale(axisScale * yProj));\n ctx.stroke();\n }\n // Projection\n matTcrossprodInto(this.xy, this.proj, this.X);\n // Lines\n for (let i = 0; i < this.lineFrom.length; i++) {\n let a = this.lineFrom[i], b = this.lineTo[i];\n if (!this.pointActive[a] || !this.pointActive[b])\n continue;\n ctx.strokeStyle = (!this.selection || (this.selection[a] && this.selection[b])) ? this.lineColors[i] : '#bbbbbb';\n // Make short lines thicker so they have equal visual weight to longer lines\n // Clipped for d < 1/4, d > 1\n let d = Math.sqrt(Math.pow((this.xy[0][a] - this.xy[0][b]), 2) + Math.pow((this.xy[1][a] - this.xy[1][b]), 2));\n d = Math.max(1 / 4, Math.min(1, d));\n ctx.lineWidth = 0.25 / d;\n ctx.beginPath();\n ctx.moveTo(this.xScaleClamped(this.xy[0][a]), this.yScaleClamped(this.xy[1][a]));\n ctx.lineTo(this.xScaleClamped(this.xy[0][b]), this.yScaleClamped(this.xy[1][b]));\n ctx.stroke();\n }\n ctx.lineWidth = 1;\n // Points\n // Default to group colors\n for (let i = 0; i < this.n; i++)\n this.fillsFrame[i] = this.fills[i];\n // If a crosstalk selection is active, gray the inactive points\n if (this.selection) {\n for (let i = 0; i < this.n; i++) {\n if (!this.selection[i])\n this.fillsFrame[i] = '#bbbbbb';\n }\n }\n // If we're mousing over a level, gray the other levels\n if (selectedLevel !== null && levelActive[selectedLevel]) {\n for (let i = 0; i < this.n; i++) {\n if (this.group[i] != selected[0].index)\n this.fillsFrame[i] = '#bbbbbb';\n }\n }\n // If we're mousing over an axis, color by position on axis\n if (selectedAxis !== null) {\n for (let i = 0; i < this.n; i++) {\n let c = this.axes[selectedAxis].proj[i];\n c = Math.tanh(c * 2); // Extreme values compressed so -1= 0; i--) {\n let j = brushPoints[i].index;\n let x = this.xScaleClamped(this.xy[0][j]), y = this.yScaleClamped(this.xy[1][j]);\n ctx.strokeText(this.rownames[j], x, y);\n ctx.fillText(this.rownames[j], x, y);\n }\n }\n ctx.restore();\n //Legend\n ctx.textAlign = 'left';\n ctx.textBaseline = 'middle';\n ctx.font = '15px sans-serif';\n if (!this.mousing)\n for (let i = 0, j = 0; i < this.levels.length; i++)\n if (levelActive[i]) {\n ctx.fillStyle = this.levelColors[i];\n ctx.fillText(this.levels[i], this.size + 10, 11 + j * 20);\n j++;\n }\n //Hints and messages text\n let hint = '';\n if (this.tugging) {\n hint = \"drag to tug\\n\";\n }\n else if (this.mouseInCheckbox && selected.length) {\n if (selected[0].active)\n hint = \"click to hide\\n\";\n else\n hint = \"click to show\\n\";\n }\n else if (selectedAxis !== null || selectedLevel !== null) {\n hint = \"drag to position\\n\";\n }\n else if (brushPoints.length && !this.mouseDown) {\n if (this.selection)\n hint = \"shift+click to enlarge\\n\";\n else\n hint = \"click to select\\nctrl+drag to tug\\n\";\n }\n else if (this.selection && this.mousing && !brushPoints.length && !this.mouseDown) {\n hint = \"click to clear\\n\";\n }\n this.get('messageArea').innerText = `${this.computeMessage || hint}${Math.min(...this.fps)} to ${Math.max(...this.fps)} FPS`;\n // Schedule another frame if needed\n if (this.playing || this.tugging) {\n // Schedule a frame normally.\n // Add a slight delay so we never run at 100% CPU.\n // (I think the browser may start putting off things that it really shouldn't if we run at 100%.)\n window.setTimeout(this.scheduleFrameIfNeeded.bind(this), 5);\n }\n // Emit updated selection\n if (this.selectionChanged && !this.mouseDown)\n this.emitChangeSelectionIfNeeded();\n }\n compute(realElapsed) {\n let damping = 0.1 * Math.pow(10, this.getNumber('dampInput'));\n let heat = 0.1 * Math.pow(10, this.getNumber('heatInput'));\n let guide = 1.0 * Math.pow(10, this.getNumber('guideInput'));\n let attraction = 1.0 * Math.pow(10, this.getNumber('labelInput'));\n let doHeat = this.getChecked('heatCheckbox');\n let whatGuide = this.getString('guideSelect');\n let doAttraction = this.getChecked('labelCheckbox');\n let levelActive = Array(this.levels.length).fill(true);\n for (let item of this.labelData)\n if (item.type == 'level')\n levelActive[item.index] = item.active;\n for (let i = 0; i < this.n; i++)\n this.pointActive[i] = levelActive[this.group[i]];\n if (this.filter !== null) {\n for (let i = 0; i < this.n; i++)\n this.pointActive[i] = this.pointActive[i] && this.filter[i];\n }\n // Cut down oscillation during dragging\n if (this.dragging && doAttraction) {\n damping = Math.max(damping, attraction * 5.0);\n }\n let elapsed = Math.max(1e-6, Math.min(1, realElapsed));\n this.computeMessage = '';\n let vel = this.vel;\n let proj = this.proj;\n //Integrate dv/dt = -damping * v\n let velKeep = Math.exp(-elapsed * damping);\n matScaleInto(vel, velKeep);\n if (this.tugging) {\n // Calculate tugging based position update.\n let tugAmount = Math.min(100, 1 / elapsed);\n let tugCenter = zeros(this.m);\n for (let i = 0; i < this.tugPoints.length; i++)\n tugCenter = vecAdd(tugCenter, this.X[this.tugPoints[i]]);\n tugCenter = vecScale(tugCenter, 1 / this.tugPoints.length);\n let currentX = vecDot(tugCenter, proj[0]);\n let currentY = vecDot(tugCenter, proj[1]);\n let length2 = vecDot(tugCenter, tugCenter) + 1e-4;\n // Don't tug beyond what is possible\n let tugX = this.tugX;\n let tugY = this.tugY;\n let tugAdjust = Math.sqrt((tugX * tugX + tugY * tugY) / length2);\n if (tugAdjust >= 1.0) {\n tugX /= tugAdjust;\n tugY /= tugAdjust;\n }\n vel[0] = vecScale(tugCenter, (tugX - currentX) / length2 * tugAmount);\n vel[1] = vecScale(tugCenter, (tugY - currentY) / length2 * tugAmount);\n // Note this removes any existing velocity!\n // Don't do any other velocity adjustments.\n doHeat = false;\n doAttraction = false;\n whatGuide = 'none';\n }\n if (doHeat) {\n // Damping reduces the variance * velKeep^2\n // We need to add velReplaceVar * desired steady state variance of temperature\n // Note the sqrt(2) that appears in the continuous form of the Langevin equation arises from \n // sqrt(1-velKeep*velKeep) approx= sqrt(2*elapsed*damping) for small elapsed*damping\n let velReplaceVar = 1 - velKeep * velKeep;\n let noise = times(proj.length, times, this.m, normal.sample, 0, Math.sqrt(heat * velReplaceVar));\n noise = removeSpin(noise, proj);\n matAddInto(vel, noise);\n }\n if (whatGuide != 'none') {\n let activeX = this.X.filter((item, i) => this.pointActive[i]);\n if (activeX.length) {\n let grad = gradTable[whatGuide](proj, activeX);\n matScaleInto(grad, -guide);\n matAddInto(vel, grad);\n }\n }\n if (doAttraction)\n for (let label of this.labelData) {\n let x = label.x;\n let y = label.y;\n if (x <= -1 || y <= -1 || x >= 1 || y >= 1)\n continue;\n if (label.type == 'level' && !levelActive[label.index])\n continue;\n let adjustment = 4 * (x * x + y * y);\n vel[0] = vecAdd(vel[0], vecScale(label.vec, x * adjustment * attraction));\n vel[1] = vecAdd(vel[1], vecScale(label.vec, y * adjustment * attraction));\n }\n // Nuke inactive axes\n // - remove from velocity\n // - gradually remove from position\n let inactive = [];\n for (let item of this.labelData)\n if (item.type == 'axis' && !item.active)\n inactive.push(this.axes[item.index].unit);\n let tooMany = inactive.length >= this.m - 1;\n let anyDropped = false;\n if (inactive.length && !tooMany) {\n // How fast inactive axes are removed\n let nuke_amount = Math.min(2, 1 / elapsed);\n let { u, v, q } = SVD(matTranspose(inactive));\n let maxQ = Math.max(...q);\n u = matTranspose(u);\n let remove = zeroMat(2, this.m);\n for (let i = 0; i < u.length; i++) {\n // Don't nuke tiny directions (could arise from redundant nukings). TODO: make tolerance level an option\n if (q[i] < maxQ * 1e-6) {\n anyDropped = true;\n continue;\n }\n let vec = u[i];\n for (let j = 0; j < 2; j++) {\n // Remove any velocity and part of the projection along u[i]\n remove[j] = vecAdd(remove[j], vecScale(vec, -vecDot(vec, vel[j]) - nuke_amount * vecDot(vec, proj[j])));\n }\n }\n // Don't introduce spin while removing\n matAddInto(vel, removeSpin(remove, proj));\n }\n if (tooMany)\n this.computeMessage += 'Error: too many axes removed\\n';\n if (anyDropped)\n this.computeMessage += 'Note: redundant axes removed\\n';\n // Velocity step \n let newProj = matAdd(proj, matScale(vel, elapsed));\n // Project onto Stiefel manifold \n let { u, v, q } = SVD(matTranspose(newProj));\n matTcrossprodInto(newProj, v, u);\n // \"Position based dynamics\"\n vel = matScale(matAdd(newProj, matScale(proj, -1)), 1 / elapsed);\n // No velocity during tugging\n if (this.tugging)\n vel = [zeros(this.m), zeros(this.m)];\n this.proj = newProj;\n this.vel = vel;\n }\n}\n//# sourceMappingURL=langevitour.js.map","import {select} from \"d3-selection\";\nimport noevent, {nonpassivecapture} from \"./noevent.js\";\n\nexport default function(view) {\n var root = view.document.documentElement,\n selection = select(view).on(\"dragstart.drag\", noevent, nonpassivecapture);\n if (\"onselectstart\" in root) {\n selection.on(\"selectstart.drag\", noevent, nonpassivecapture);\n } else {\n root.__noselect = root.style.MozUserSelect;\n root.style.MozUserSelect = \"none\";\n }\n}\n\nexport function yesdrag(view, noclick) {\n var root = view.document.documentElement,\n selection = select(view).on(\"dragstart.drag\", null);\n if (noclick) {\n selection.on(\"click.drag\", noevent, nonpassivecapture);\n setTimeout(function() { selection.on(\"click.drag\", null); }, 0);\n }\n if (\"onselectstart\" in root) {\n selection.on(\"selectstart.drag\", null);\n } else {\n root.style.MozUserSelect = root.__noselect;\n delete root.__noselect;\n }\n}\n"],"names":["jStat","module","exports","Math","undefined","concat","Array","prototype","slice","toString","Object","calcRdx","n","m","val","pow","log","LOG10E","isArray","arg","call","isFunction","isNumber","num","_init","arguments","retZero","retOne","retIdent","i","j","fn","args","map","length","this","seq","apply","toArray","constructor","utils","toVector","arr","_random_fn","random","setRandom","TypeError","extend","obj","rows","cols","dimensions","row","index","rowa","col","submat","arange","forEach","ind","column","cola","a","diag","nrow","res","antidiag","transpose","objArr","push","func","toAlter","ncol","cumreduce","alter","create","zeros","ones","rand","identity","symmetric","size","clear","min","max","cnt","hival","step","current","start","end","rl","_slice","list","copy","rcSlice","colSlice","rowSlice","sliceAssign","A","B","nl","ml","diagonal","diagArray","mat","t","jProto","sort","splice","funcs","passfunc","results","self","setTimeout","split","ascNum","b","clip","sum","sumsqrd","sumsqerr","tmp","mean","sumrow","product","prod","low","high","unique","hash","_arr","meansqerr","geomean","median","arrlen","cumsum","cumprod","diff","diffs","arrLen","rank","distinctNumbers","numberCounts","number","sortedDistinctNumbers","numberRanks","currentRank","count","mode","maxCount","numMaxCount","mode_arr","range","variance","flag","pooledvariance","reduce","samples","deviation","dev","stdev","sqrt","pooledstdev","meandev","abs","meddev","coeffvar","quartiles","round","quantiles","quantilesArray","alphap","betap","p","aleph","k","gamma","sortedArray","quantileVals","floor","percentile","exclusive","realIndex","parseInt","frac","percentileOfScore","score","kind","value","counter","len","strict","histogram","binCnt","first","binWidth","bins","covariance","arr1","arr2","u","v","arr1Len","sq_dev","corrcoeff","spearmancoeff","stanMoment","mu","sigma","skewSum","skewness","kurtosis","fullbool","tmpthis","callbackFunction","argsToPass","curriedFunction","vector","gammaln","x","xx","y","cof","ser","loggam","x0","x2","xp","gl","gl0","PI","gammafn","z","yi","q","fact","xden","xnum","Infinity","sin","gammap","lowRegGamma","an","aln","ap","del","c","d","h","ITMAX","NaN","exp","factorialln","factorial","combination","combinationln","permutation","betafn","betaln","betacf","m2","aa","fpmin","qab","qap","qam","gammapinv","pp","lna1","afac","a1","gln","erf","ty","isneg","dd","erfc","erfcinv","err","ibetainv","lna","lnb","al","w","b1","ibeta","bt","randn","randg","shape","a2","oalph","betinc","eps","c9","a0","b0","m9","tukeyWprob","rr","cc","xleg","aleg","qsqz","wincr","pr_w","normal","cdf","blb","binc","bub","einsum","cc1","wi","elsum","jj","ac","qexpo","rinsum","f","_a","_b","_c","newthis","data","sample","vals","fnfunc","beta","pdf","alpha","inv","centralF","df1","df2","binomial","cauchy","local","scale","atan","tan","chisquare","dof","exponential","rate","invgamma","kumaraswamy","Error","lognormal","noncentralt","ncp","studentt","tol","flip","prob","lastvalue","std","pareto","SQRT2","dof2","weibull","uniform","betacdf","s","negbin","r","hypgeom","N","scaledPDF","samplesDone","scaledCDF","factor","poisson","l","sumarr","sampleSmall","L","sampleLarge","U","V","slam","loglam","invalpha","vr","us","lam","triangular","arcsine","asin","cos","laplace","tukey","nmeans","df","xlegq","alegq","Number","isFinite","ulen","f2","f2lf","f21","ff4","ans","otsum","twa1","t1","x1","ps","tukeyQinv","valx0","valx1","iter","isUsable","add","subtract","divide","multiply","nrescols","rescols","outer","dot","left","right","norm","nnorm","isNaN","angle","acos","aug","newarr","gauss_jordan","result","det","alen","alend","rowshift","colshift","mrow","mcol","gauss_elimination","maug","pivot","temp","y2","maxrow","triaUpSolve","parts","matrix_mode","triaLowSolve","lu","R","cholesky","T","gauss_jacobi","xv","xk","gauss_seidel","SOR","householder","QR","lstsq","array_mode","Q","attrs","Q1","RI","I","Aj","cAi","Ij","cIi","R_I","Q2","jacobi","maxim","theta","condition","e","ev","rungekutta","t_j","u_j","order","k1","k2","k3","romberg","h1","g","richardson","X","pos","y1","h_min","simpson","hermite","F","dF","dl","lagrange","cubic_spline","sq","gauss_quadrature","PCA","temp1","Bt","D","temp2","Y","C","Vt","differenceOfProportions","p1","n1","p2","n2","pooled","zscore","ztest","sides","tscore","ttest","anovafscore","expVar","sampMean","sampSampMean","tmpargs","unexpVar","anovaftest","ftest","fscore","anovaftes","qscore","mean1","mean2","sd","qtest","tukeyhsd","arrays","means","normalci","change","tci","significant","pvalue","oneSidedDifferenceOfProportions","twoSidedDifferenceOfProportions","models","ols","endog","exog","nobs","df_model","df_resid","coef","predict","resid","ybar","SSE","SSR","SST","R2","t_test","model","var_count","subModelList","endog_index","exog_index","filter","sigmaHat","seBetaHat","mod","tStatistic","pValue","leftppf","interval95","se","F_statistic","F_test","adjust_R2","buildxmatrix","matrixRows","builddxmatrix","buildjxmatrix","jMat","pass","buildymatrix","array","buildjymatrix","matrixmult","regress","jMatX","jMatY","innerinv","xtranspxinv","xtransp","next","regresst","compile","jMatYBar","yBar","yAverage","anova","residuals","ssr","msr","sse","mse","sst","mst","r2","fratio","rmse","r2adj","stats","sds","ts","covar","xtranspx","inner","matrixsubtract","SVD","o","M","fill","S","VERSION","defineProperty","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__","definition","key","enumerable","get","prop","hasOwnProperty","Symbol","toStringTag","none","selector","querySelector","empty","querySelectorAll","matches","childMatcher","node","find","childFirst","firstElementChild","children","from","update","EnterNode","parent","datum","ownerDocument","namespaceURI","_next","_parent","__data__","bindIndex","group","enter","exit","groupLength","dataLength","bindKey","keyValue","nodeByKeyValue","Map","keyValues","has","set","delete","arraylike","ascending","appendChild","child","insertBefore","xhtml","svg","xlink","xml","xmlns","name","prefix","indexOf","namespaces","space","attrRemove","removeAttribute","attrRemoveNS","fullname","removeAttributeNS","attrConstant","setAttribute","attrConstantNS","setAttributeNS","attrFunction","attrFunctionNS","defaultView","document","styleRemove","style","removeProperty","styleConstant","priority","setProperty","styleFunction","styleValue","getPropertyValue","getComputedStyle","propertyRemove","propertyConstant","propertyFunction","classArray","string","trim","classList","ClassList","_node","_names","getAttribute","classedAdd","names","classedRemove","remove","classedTrue","classedFalse","classedFunction","textRemove","textContent","textConstant","textFunction","htmlRemove","innerHTML","htmlConstant","htmlFunction","raise","nextSibling","parentNode","lower","previousSibling","firstChild","creatorInherit","uri","documentElement","createElement","createElementNS","creatorFixed","namespace","constantNull","removeChild","selection_cloneShallow","clone","cloneNode","selection_cloneDeep","onRemove","typename","on","__on","type","removeEventListener","listener","options","onAdd","event","contextListener","addEventListener","dispatchEvent","params","window","CustomEvent","createEvent","initEvent","bubbles","cancelable","detail","dispatchConstant","dispatchFunction","join","contains","root","Selection","groups","parents","_groups","_parents","selection","select","subgroups","subnode","subgroup","selectAll","arrayAll","selectorAll","selectChild","match","childFind","selectChildren","childrenFilter","matcher","bind","enterGroup","updateGroup","previous","i0","i1","_enter","_exit","sparse","onenter","onupdate","onexit","append","merge","context","groups0","groups1","m0","m1","merges","group0","group1","compareDocumentPosition","compare","compareNode","sortgroups","sortgroup","callback","nodes","each","attr","getAttributeNS","property","classed","text","html","creator","insert","before","deep","typenames","parseTypenames","dispatch","iterator","noop","_","test","Dispatch","types","that","taskHead","taskTail","timeout","interval","pokeDelay","clockLast","clockNow","clockSkew","clock","performance","now","Date","setFrame","requestAnimationFrame","clearNow","Timer","_call","_time","timer","delay","time","restart","wake","timerFlush","t0","t2","sleep","nap","poke","clearTimeout","clearInterval","setInterval","elapsed","stop","emptyOn","emptyTween","CREATED","STARTED","id","timing","schedules","__transition","tween","state","tick","duration","ease","init","schedule","svgNode","degrees","translateX","translateY","rotate","skewX","scaleX","scaleY","atan2","interpolateTransform","parse","pxComma","pxParen","degParen","pop","xa","ya","xb","yb","translate","interpolateTransformCss","DOMMatrix","WebKitCSSMatrix","isIdentity","decompose","interpolateTransformSvg","transform","baseVal","consolidate","matrix","tweenRemove","tween0","tween1","tweenFunction","tweenValue","transition","_id","factory","Color","darker","brighter","reI","reN","reP","reHex","reRgbInteger","RegExp","reRgbPercent","reRgbaInteger","reRgbaPercent","reHslPercent","reHslaPercent","named","aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen","color_formatHex","rgb","formatHex","color_formatRgb","formatRgb","color","format","toLowerCase","exec","rgbn","Rgb","rgba","hsla","opacity","rgb_formatHex","hex","rgb_formatRgb","clampa","clampi","Hsl","hslConvert","clamph","clampt","hsl2rgb","basis","v0","v1","v2","v3","t3","channels","assign","displayable","formatHex8","formatHsl","clamp","nogamma","linear","rgbGamma","rgbSpline","spline","colors","values","reA","reB","source","am","bm","bs","bi","lastIndex","one","zero","interpolate","value1","string00","interpolate0","string1","string0","string10","attrTweenNS","attrInterpolateNS","_value","attrTween","attrInterpolate","delayFunction","delayConstant","durationFunction","durationConstant","Transition","_name","newId","selection_prototype","inherit","id0","id1","on0","on1","sit","every","onFunction","styleTween","styleNull","listener0","styleMaybeRemove","styleInterpolate","textTween","textInterpolate","removeFunction","easeConstant","easeVarying","Promise","resolve","reject","cancel","interrupt","defaultTiming","active","sourceEvent","currentTarget","ownerSVGElement","createSVGPoint","point","clientX","clientY","matrixTransform","getScreenCTM","inverse","getBoundingClientRect","rect","clientLeft","top","clientTop","pageX","pageY","nonpassive","passive","nonpassivecapture","capture","stopImmediatePropagation","preventDefault","DragEvent","subject","target","identifier","dx","dy","defineProperties","configurable","ctrlKey","button","defaultContainer","defaultSubject","navigator","maxTouchPoints","e10","e5","e2","tickIncrement","power","LN10","error","descending","bisector","compare1","compare2","delta","lo","hi","mid","center","ascendingBisect","bisectRight","genericArray","nb","na","setTime","date","ArrayBuffer","isView","DataView","valueOf","object","unit","normalize","bimap","domain","d0","d1","r0","r1","polymap","reverse","bisect","initRange","prefixExponent","re","formatSpecifier","specifier","FormatSpecifier","align","sign","symbol","width","comma","precision","formatDecimalParts","toExponential","coefficient","exponent","toFixed","toLocaleString","replace","toPrecision","formatRounded","toUpperCase","formatPrefix","prefixes","linearish","ticks","tickFormat","step0","step1","tickStep","precisionPrefix","precisionRound","precisionFixed","nice","prestep","maxIter","ceil","untransform","unknown","piecewise","output","input","rescale","invert","rangeRound","transformer","ramp","locale","grouping","thousands","substring","currencyPrefix","currency","currencySuffix","decimal","numerals","formatNumerals","String","percent","minus","nan","newFormat","formatTypes","suffix","formatType","maybeSuffix","valuePrefix","valueSuffix","valueNegative","out","formatTrim","charCodeAt","padding","randInt","times","vecSub","vecAdd","vecDot","vecScale","zeroMat","matTcrossprodInto","matAdd","matScale","matScaleInto","matAddInto","matTranspose","removeSpin","motion","proj","locateEventInElement","el","offsetWidth","height","offsetHeight","toggleVisible","display","hexByte","gradRepulsion","fineScale","strength","grad","off1","off2","gradCentralRepulsion","applyX","applyY","location","invertX","invertY","rescaleX","rescaleY","gradTable","jstat","template","Langevitour","EventTarget","container","super","fullscreen","originalWidth","originalHeight","colnames","permutor","unpermutor","rownames","pointSize","levels","levelColors","lineFrom","lineTo","lineColors","fills","selectionChanged","axes","labelData","vel","zoom","xScaleUnit","yScaleUnit","xScale","yScale","xScaleClamped","yScaleClamped","haveData","playing","frameScheduled","lastTime","mouseInCheckbox","dragging","fps","computeMessage","mousing","mouseDown","mouseWentDown","mouseShiftKey","mouseX","mouseY","rightMouseDown","rightMouseWentDown","tugging","tugX","tugY","tugPoints","xy","fillsFrame","pointActive","shadowDiv","shadowRoot","attachShadow","shadowChild","canvas","overlay","langevitour","resize","plotDiv","scheduleFrameIfNeeded","handleMouseMove","buttons","visibility","shiftKey","requestFullscreen","fullscreenElement","exitFullscreen","handleWindowSize","innerWidth","innerHeight","pad","paddingLeft","configure","getInput","matStr","line","item","log10","JSON","stringify","getState","setState","className","getElementsByClassName","getString","getNumber","getChecked","checked","emitChangeFilter","Event","emitChangeSelectionIfNeeded","renderValue","axisColors","extraAxes","extraAxesNames","projFromScaled","vec","nGroups","colorVariation","pointColor","label","halfWidth","halfHeight","selected","controlHeight","innerText","ctx","getContext","clearRect","configureScales","thys","divs","div","refreshLabels","maxX","mousedownx","mousedowny","mousemoving","touchending","touchable","gestures","listeners","clickDistance2","drag","mousedowned","touchstarted","touchmoved","touchended","gesture","beforestart","view","mousemoved","mouseupped","__noselect","MozUserSelect","nodrag","mouse","noclick","yesdrag","touches","changedTouches","touch","p0","clickDistance","cursor","makeDraggable","axesOn","heatOn","guideType","labelAttractionOn","damping","heat","guide","labelAttraction","brush","labelInactive","labelPos","projection","needChangeFilter","needChangeSelection","pointRepulsionType","pointRepulsion","includes","doFrame","parentElement","bottom","elementVisible","shift","compute","selectedAxis","selectedLevel","showAxes","levelActive","brushRadius","brushPoints","d2","ratio","devicePixelRatio","rx","ry","strokeStyle","fillStyle","fillRect","strokeRect","axisScale","xProj","yProj","beginPath","moveTo","stroke","lineWidth","tanh","ox","rug","rounding","pA","pB","arc","save","textAlign","textBaseline","lineJoin","font","scaled","strokeText","fillText","restore","hint","realElapsed","attraction","doHeat","whatGuide","doAttraction","velKeep","tugAmount","tugCenter","currentX","currentY","length2","tugAdjust","velReplaceVar","noise","activeX","adjustment","inactive","tooMany","anyDropped","nuke_amount","maxQ","newProj"],"sourceRoot":""} \ No newline at end of file diff --git a/lib/langevitour.js b/lib/langevitour.js index b5a77b9..b68e1d7 100644 --- a/lib/langevitour.js +++ b/lib/langevitour.js @@ -205,7 +205,6 @@ export class Langevitour extends EventTarget { this.fullscreen = false; this.originalWidth = 1; this.originalHeight = 1; - this.pointSize = 1; this.center = []; this.scale = []; this.X = [[], []]; @@ -216,6 +215,7 @@ export class Langevitour extends EventTarget { this.unpermutor = []; this.rownames = []; this.group = []; + this.pointSize = []; this.levels = []; this.levelColors = []; this.lineFrom = []; @@ -470,7 +470,7 @@ export class Langevitour extends EventTarget { * * [data.colorVariation] Amount of brightness variation of points, between 0 and 1. * - * [data.pointSize] Radius of points in pixels. + * [data.pointSize] Radius of points in pixels either, a number or an array of numbers for each point. * * [data.state] State to be passed on to setState(). */ @@ -484,7 +484,6 @@ export class Langevitour extends EventTarget { //TODO: checking this.n = data.X.length; this.m = data.X[0].length; - this.pointSize = data.pointSize != null ? data.pointSize : 1; let axisColors = data.axisColors || []; this.center = data.center || Array(this.m).fill(0); this.scale = data.scale || Array(this.m).fill(1); @@ -496,6 +495,16 @@ export class Langevitour extends EventTarget { this.X = this.permutor.map(i => data.X[i]); // Store data internally in centered and scaled form. this.X = this.X.map(item => item.map((value, i) => (value - this.center[i]) / this.scale[i])); + if (data.pointSize == null) { //check for null or undefined + this.pointSize = Array(this.n).fill(1); + } + else if (typeof (data.pointSize) === "number") { + this.pointSize = Array(this.n).fill(data.pointSize); + } + else { + let pointSize = data.pointSize; + this.pointSize = this.permutor.map(i => pointSize[i]); + } if (!data.rownames || data.rownames.length == 0) { this.rownames = []; } @@ -558,7 +567,7 @@ export class Langevitour extends EventTarget { } // Point colors are given a small back-to-front brightness gradient, // to add some variation and give a pseudo-3D effect. - let colorVariation = data.colorVariation == null ? 0.3 : data.colorVariation; + let colorVariation = data.colorVariation == null ? 0.1 : data.colorVariation; this.fills = []; for (let i = 0; i < this.n; i++) { let pointColor = rgb(this.levelColors[this.group[i]]); @@ -1048,9 +1057,9 @@ export class Langevitour extends EventTarget { } } // Draw points that aren't hidden - let size = this.pointSize; for (let i = 0; i < this.n; i++) { if (this.pointActive[i]) { + let size = this.pointSize[i]; ctx.fillStyle = this.fillsFrame[i]; ctx.fillRect(this.xScaleClamped(this.xy[0][i]) - size, this.yScaleClamped(this.xy[1][i]) - size, size * 2, size * 2); } diff --git a/lib/langevitour.js.map b/lib/langevitour.js.map index d4a10a9..79a1c43 100644 --- a/lib/langevitour.js.map +++ b/lib/langevitour.js.map @@ -1 +1 @@ -{"version":3,"file":"langevitour.js","sourceRoot":"","sources":["../src/langevitour.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,MAAM,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;AAEzB,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAE7B,OAAO,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,kBAAkB,EAAE,MAAM,IAAI,CAAC;AAExE,OAAO,EACH,MAAM,EAAU,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EACvD,UAAU,EAAE,YAAY,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAA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CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;SAC7C;QAED,IAAI,OAAO;YAAE,IAAI,CAAC,cAAc,IAAI,gCAAgC,CAAC;QACrE,IAAI,UAAU;YAAE,IAAI,CAAC,cAAc,IAAI,gCAAgC,CAAC;QAGxE,wBAAwB;QACxB,IAAI,OAAO,GAAG,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC;QAEnD,gDAAgD;QAChD,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,GAAG,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC;QAC7C,iBAAiB,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QAEjC,4BAA4B;QAC5B,GAAG,GAAG,QAAQ,CAAC,MAAM,CAAC,OAAO,EAAC,QAAQ,CAAC,IAAI,EAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,GAAC,OAAO,CAAC,CAAC;QAE7D,6BAA6B;QAC7B,IAAI,IAAI,CAAC,OAAO;YACZ,GAAG,GAAG,CAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAE,CAAC;QAE3C,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC;QACpB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACnB,CAAC;CACJ"} \ No newline at end of file diff --git a/man/langevitour.Rd b/man/langevitour.Rd index ed89ed5..e2fb7a7 100644 --- a/man/langevitour.Rd +++ b/man/langevitour.Rd @@ -16,7 +16,7 @@ langevitour( lineColors = NULL, axisColors = NULL, levelColors = NULL, - colorVariation = 0.3, + colorVariation = 0.1, pointSize = 1, subsample = NULL, state = NULL, @@ -52,7 +52,7 @@ langevitour( \item{colorVariation}{Number between 0 and 1. Individual points are given slightly different brightnesses. How strong should this effect be?} -\item{pointSize}{Point radius in pixels.} +\item{pointSize}{Point radius in pixels. A single number, or a number for each row in X.} \item{subsample}{For speed, randomly subsample down to this many rows.} diff --git a/py/examples/langevitour.ipynb b/py/examples/langevitour.ipynb index a39f647..ed27348 100644 --- a/py/examples/langevitour.ipynb +++ b/py/examples/langevitour.ipynb @@ -4,7 +4,9 @@ "cell_type": "code", "execution_count": null, "id": "2de626d3", - "metadata": {}, + "metadata": { + "scrolled": true + }, "outputs": [], "source": [ "%pip install langevitour" @@ -12,122 +14,10 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "c4e5d57f-6eae-40a4-8287-de1826412ca5", "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
speciesislandbill_length_mmbill_depth_mmflipper_length_mmbody_mass_gsexyear
0AdelieTorgersen39.118.7181.03750.0male2007
1AdelieTorgersen39.517.4186.03800.0female2007
2AdelieTorgersen40.318.0195.03250.0female2007
3AdelieTorgersenNaNNaNNaNNaNNaN2007
4AdelieTorgersen36.719.3193.03450.0female2007
\n", - "
" - ], - "text/plain": [ - " species island bill_length_mm bill_depth_mm flipper_length_mm \\\n", - "0 Adelie Torgersen 39.1 18.7 181.0 \n", - "1 Adelie Torgersen 39.5 17.4 186.0 \n", - "2 Adelie Torgersen 40.3 18.0 195.0 \n", - "3 Adelie Torgersen NaN NaN NaN \n", - "4 Adelie Torgersen 36.7 19.3 193.0 \n", - "\n", - " body_mass_g sex year \n", - "0 3750.0 male 2007 \n", - "1 3800.0 female 2007 \n", - "2 3250.0 female 2007 \n", - "3 NaN NaN 2007 \n", - "4 3450.0 female 2007 " - ] - }, - "execution_count": 2, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "import pandas as pd\n", "from langevitour import Langevitour\n", @@ -139,40 +29,10 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "id": "f9cfb930-9416-4687-bfd4-511c44a6d90b", "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "\n", - "
\n", - " \n", - " " - ], - "text/plain": [ - "" - ] - }, - "execution_count": 3, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "complete_penguins = penguins[\n", " [\n", @@ -195,6 +55,30 @@ " point_size=2, # pointSize\n", " )" ] + }, + { + "cell_type": "markdown", + "id": "582bf490-8ac0-4ea6-b033-4950dce9c52a", + "metadata": {}, + "source": [ + "# Point size can be specified per-point" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "74bc579e-4b7b-4b35-8bef-233aee8b4af5", + "metadata": {}, + "outputs": [], + "source": [ + "Langevitour(\n", + " complete_penguins.iloc[:, 1:], # X\n", + " group=complete_penguins['species'].tolist(), # group\n", + " levels=[\"Adelie\", \"Chinstrap\", \"Gentoo\"],\n", + " scale=scale_factors.tolist(), # scale\n", + " point_size=(penguins.body_mass_g/1000).tolist(), # pointSize\n", + " )" + ] } ], "metadata": { diff --git a/py/langevitour/langevitour.py b/py/langevitour/langevitour.py index 765ad6d..fd1f868 100644 --- a/py/langevitour/langevitour.py +++ b/py/langevitour/langevitour.py @@ -30,7 +30,7 @@ class Langevitour: axis_colors (list[str], optional): CSS colors for each variable and extra axis. level_colors (list[str], optional): CSS colors for each level of `group`. color_variation (float, 0-1, optional): Brightness variation among individual points. Defaults to 0.3. - point_size (int, optional): Point radius in pixels. Defaults to 1. + point_size (float|list[float], optional): Point radius in pixels. Defaults to 1. A single value or a value for each point. subsample (int, optional): Randomly subsample to this many rows for speed. Defaults to None. state (str, optional): Initial widget state settings. Defaults to None. width (int, optional): Width of widget in pixels. Defaults to 700. @@ -58,7 +58,7 @@ def __init__( line_colors=None, axis_colors=None, level_colors=None, - color_variation=0.3, + color_variation=0.1, point_size=1, subsample=None, state=None, diff --git a/py/langevitour/static/langevitour-pack.js b/py/langevitour/static/langevitour-pack.js index a7e199f..4cacdce 100644 --- a/py/langevitour/static/langevitour-pack.js +++ b/py/langevitour/static/langevitour-pack.js @@ -1,2 +1,2 @@ -var langevitour;(()=>{var t={162:function(t){var e;t.exports=(e=function(t,e){var n=Array.prototype.concat,r=Array.prototype.slice,i=Object.prototype.toString;function o(e,n){var r=e>n?e:n;return t.pow(10,17-~~(t.log(r>0?r:-r)*t.LOG10E))}var a=Array.isArray||function(t){return"[object Array]"===i.call(t)};function s(t){return"[object Function]"===i.call(t)}function u(t){return"number"==typeof t&&t-t==0}function l(){return new l._init(arguments)}function c(){return 0}function f(){return 1}function h(t,e){return t===e?1:0}l.fn=l.prototype,l._init=function(t){if(a(t[0]))if(a(t[0][0])){s(t[1])&&(t[0]=l.map(t[0],t[1]));for(var e=0;e=0;e--,r++)n[r]=[t[r][e]];return n},l.transpose=function(t){var e,n,r,i,o,s=[];for(a(t[0])||(t=[t]),n=t.length,r=t[0].length,o=0;o0&&(s[r][0]=t[r][0]),u=1;un&&r>0)return[];if(r>0)for(i=t;in;i+=r)o.push(i);return o},l.slice=function(){function t(t,n,r,i){var o,a=[],s=t.length;if(n===e&&r===e&&i===e)return l.copy(t);if(i=i||1,(n=(n=n||0)>=0?n:s+n)===(r=(r=r||t.length)>=0?r:s+r)||0===i)return[];if(nr&&i>0)return[];if(i>0)for(o=n;or;o+=i)a.push(t[o]);return a}return function(e,n){var r,i;return u((n=n||{}).row)?u(n.col)?e[n.row][n.col]:t(l.rowa(e,n.row),(r=n.col||{}).start,r.end,r.step):u(n.col)?t(l.cola(e,n.col),(i=n.row||{}).start,i.end,i.step):(i=n.row||{},r=n.col||{},t(e,i.start,i.end,i.step).map((function(e){return t(e,r.start,r.end,r.step)})))}}(),l.sliceAssign=function(n,r,i){var o,a;if(u(r.row)){if(u(r.col))return n[r.row][r.col]=i;r.col=r.col||{},r.col.start=r.col.start||0,r.col.end=r.col.end||n[0].length,r.col.step=r.col.step||1,o=l.arange(r.col.start,t.min(n.length,r.col.end),r.col.step);var s=r.row;return o.forEach((function(t,e){n[s][t]=i[e]})),n}if(u(r.col)){r.row=r.row||{},r.row.start=r.row.start||0,r.row.end=r.row.end||n.length,r.row.step=r.row.step||1,a=l.arange(r.row.start,t.min(n[0].length,r.row.end),r.row.step);var c=r.col;return a.forEach((function(t,e){n[t][c]=i[e]})),n}return i[0].length===e&&(i=[i]),r.row.start=r.row.start||0,r.row.end=r.row.end||n.length,r.row.step=r.row.step||1,r.col.start=r.col.start||0,r.col.end=r.col.end||n[0].length,r.col.step=r.col.step||1,a=l.arange(r.row.start,t.min(n.length,r.row.end),r.row.step),o=l.arange(r.col.start,t.min(n[0].length,r.col.end),r.col.step),a.forEach((function(t,e){o.forEach((function(r,o){n[t][r]=i[e][o]}))})),n},l.diagonal=function(t){var e=l.zeros(t.length,t.length);return t.forEach((function(t,n){e[n][n]=t})),e},l.copy=function(t){return t.map((function(t){return u(t)?t:t.map((function(t){return t}))}))};var d=l.prototype;return d.length=0,d.push=Array.prototype.push,d.sort=Array.prototype.sort,d.splice=Array.prototype.splice,d.slice=Array.prototype.slice,d.toArray=function(){return this.length>1?r.call(this):r.call(this)[0]},d.map=function(t,e){return l(l.map(this,t,e))},d.cumreduce=function(t,e){return l(l.cumreduce(this,t,e))},d.alter=function(t){return l.alter(this,t),this},function(t){for(var e=0;e=0;)e+=t[n];return e},t.sumsqrd=function(t){for(var e=0,n=t.length;--n>=0;)e+=t[n]*t[n];return e},t.sumsqerr=function(e){for(var n,r=t.mean(e),i=0,o=e.length;--o>=0;)i+=(n=e[o]-r)*n;return i},t.sumrow=function(t){for(var e=0,n=t.length;--n>=0;)e+=t[n];return e},t.product=function(t){for(var e=1,n=t.length;--n>=0;)e*=t[n];return e},t.min=function(t){for(var e=t[0],n=0;++ne&&(e=t[n]);return e},t.unique=function(t){for(var e={},n=[],r=0;ra?(u=[i[e]],a=o,s=0):o===a&&(u.push(i[e]),s++),o=1);return 0===s?u[0]:u},t.range=function(e){return t.max(e)-t.min(e)},t.variance=function(e,n){return t.sumsqerr(e)/(e.length-(n?1:0))},t.pooledvariance=function(e){return e.reduce((function(e,n){return e+t.sumsqerr(n)}),0)/(e.reduce((function(t,e){return t+e.length}),0)-e.length)},t.deviation=function(e){for(var n=t.mean(e),r=e.length,i=new Array(r),o=0;o=0;o--)i.push(e.abs(n[o]-r));return t.mean(i)},t.meddev=function(n){for(var r=t.median(n),i=[],o=n.length-1;o>=0;o--)i.push(e.abs(n[o]-r));return t.median(i)},t.coeffvar=function(e){return t.stdev(e)/t.mean(e)},t.quartiles=function(t){var n=t.length,i=t.slice().sort(r);return[i[e.round(n/4)-1],i[e.round(n/2)-1],i[e.round(3*n/4)-1]]},t.quantiles=function(t,n,o,a){var s,u,l,c,f,h=t.slice().sort(r),d=[n.length],p=t.length;for(void 0===o&&(o=3/8),void 0===a&&(a=3/8),s=0;s1){for(u=!0===r?this:this.transpose();s1){for("sumrow"!==e&&(u=!0===r?this:this.transpose());s1){for(s=s.transpose();a=0;s--)a*=r,a+=l[s];if(o=a/n+.5*e.log(i)+(n-.5)*e.log(n)-n,t<=7)for(s=1;s<=u;s++)o-=e.log(n-1),n-=1;return o},t.gammafn=function(t){var n,r,i,o,a=[-1.716185138865495,24.76565080557592,-379.80425647094563,629.3311553128184,866.9662027904133,-31451.272968848367,-36144.413418691176,66456.14382024054],s=[-30.8402300119739,315.35062697960416,-1015.1563674902192,-3107.771671572311,22538.11842098015,4755.846277527881,-134659.9598649693,-115132.2596755535],u=!1,l=0,c=0,f=0,h=t;if(t>171.6243769536076)return 1/0;if(h<=0){if(!(o=h%1+36e-17))return 1/0;u=(1&h?-1:1)*e.PI/e.sin(e.PI*o),h=1-h}for(i=h,r=h<1?h++:(h-=l=(0|h)-1)-1,n=0;n<8;++n)f=(f+a[n])*r,c=c*r+s[n];if(o=f/c+1,ih)for(n=0;n=1?n:1/n)+.4*n+17);if(r<0||n<=0)return NaN;if(r170||r>170?e.exp(t.combinationln(n,r)):t.factorial(n)/t.factorial(r)/t.factorial(n-r)},t.combinationln=function(e,n){return t.factorialln(e)-t.factorialln(n)-t.factorialln(e-n)},t.permutation=function(e,n){return t.factorial(e)/t.factorial(e-n)},t.betafn=function(n,r){if(!(n<=0||r<=0))return n+r>170?e.exp(t.betaln(n,r)):t.gammafn(n)*t.gammafn(r)/t.gammafn(n+r)},t.betaln=function(e,n){return t.gammaln(e)+t.gammaln(n)-t.gammaln(e+n)},t.betacf=function(t,n,r){var i,o,a,s,u=1e-30,l=1,c=n+r,f=n+1,h=n-1,d=1,p=1-c*t/f;for(e.abs(p)=1)return e.max(100,r+100*e.sqrt(r));if(n<=0)return 0;for(r>1?(u=e.log(f),l=e.exp(f*(u-1)-h),s=n<.5?n:1-n,i=(2.30753+.27061*(o=e.sqrt(-2*e.log(s))))/(1+o*(.99229+.04481*o))-o,n<.5&&(i=-i),i=e.max(.001,r*e.pow(1-1/(9*r)-i/(3*e.sqrt(r)),3))):i=n<(o=1-r*(.253+.12*r))?e.pow(n/o,1/r):1-e.log(1-(n-o)/(1-o));c<12;c++){if(i<=0)return 0;if((i-=o=(a=(t.lowRegGamma(r,i)-n)/(o=r>1?l*e.exp(-(i-f)+f*(e.log(i)-u)):e.exp(-i+f*e.log(i)-h)))/(1-.5*e.min(1,a*((r-1)/i-1))))<=0&&(i=.5*(i+o)),e.abs(o)<1e-8*i)break}return i},t.erf=function(t){var n,r,i,o,a=[-1.3026537197817094,.6419697923564902,.019476473204185836,-.00956151478680863,-.000946595344482036,.000366839497852761,42523324806907e-18,-20278578112534e-18,-1624290004647e-18,130365583558e-17,1.5626441722e-8,-8.5238095915e-8,6.529054439e-9,5.059343495e-9,-9.91364156e-10,-2.27365122e-10,96467911e-18,2394038e-18,-6886027e-18,894487e-18,313092e-18,-112708e-18,381e-18,7106e-18,-1523e-18,-94e-18,121e-18,-28e-18],s=a.length-1,u=!1,l=0,c=0;for(t<0&&(t=-t,u=!0),r=4*(n=2/(2+t))-2;s>0;s--)i=l,l=r*l-c+a[s],c=i;return o=n*e.exp(-t*t+.5*(a[0]+r*l)-c),u?o-1:1-o},t.erfc=function(e){return 1-t.erf(e)},t.erfcinv=function(n){var r,i,o,a,s=0;if(n>=2)return-100;if(n<=0)return 100;for(a=n<1?n:2-n,r=-.70711*((2.30753+.27061*(o=e.sqrt(-2*e.log(a/2))))/(1+o*(.99229+.04481*o))-o);s<2;s++)r+=(i=t.erfc(r)-a)/(1.1283791670955126*e.exp(-r*r)-r*i);return n<1?r:-r},t.ibetainv=function(n,r,i){var o,a,s,u,l,c,f,h,d,p,g=r-1,m=i-1,v=0;if(n<=0)return 0;if(n>=1)return 1;for(r>=1&&i>=1?(s=n<.5?n:1-n,c=(2.30753+.27061*(u=e.sqrt(-2*e.log(s))))/(1+u*(.99229+.04481*u))-u,n<.5&&(c=-c),f=(c*c-3)/6,h=2/(1/(2*r-1)+1/(2*i-1)),d=c*e.sqrt(f+h)/h-(1/(2*i-1)-1/(2*r-1))*(f+5/6-2/(3*h)),c=r/(r+i*e.exp(2*d))):(o=e.log(r/(r+i)),a=e.log(i/(r+i)),c=n<(u=e.exp(r*o)/r)/(d=u+(l=e.exp(i*a)/i))?e.pow(r*d*n,1/r):1-e.pow(i*d*(1-n),1/i)),p=-t.gammaln(r)-t.gammaln(i)+t.gammaln(r+i);v<10;v++){if(0===c||1===c)return c;if((c-=u=(l=(t.ibeta(c,r,i)-n)/(u=e.exp(g*e.log(c)+m*e.log(1-c)+p)))/(1-.5*e.min(1,l*(g/c-m/(1-c)))))<=0&&(c=.5*(c+u)),c>=1&&(c=.5*(c+u+1)),e.abs(u)<1e-8*c&&v>0)break}return c},t.ibeta=function(n,r,i){var o=0===n||1===n?0:e.exp(t.gammaln(r+i)-t.gammaln(r)-t.gammaln(i)+r*e.log(n)+i*e.log(1-n));return!(n<0||n>1)&&(n<(r+1)/(r+i+2)?o*t.betacf(n,r,i)/r:1-o*t.betacf(1-n,i,r)/i)},t.randn=function(n,r){var i,o,a,s,u;if(r||(r=n),n)return t.create(n,r,(function(){return t.randn()}));do{i=t._random_fn(),o=1.7156*(t._random_fn()-.5),u=(a=i-.449871)*a+(s=e.abs(o)+.386595)*(.196*s-.25472*a)}while(u>.27597&&(u>.27846||o*o>-4*e.log(i)*i*i));return o/i},t.randg=function(n,r,i){var o,a,s,u,l,c,f=n;if(i||(i=r),n||(n=1),r)return(c=t.zeros(r,i)).alter((function(){return t.randg(n)})),c;n<1&&(n+=1),o=n-1/3,a=1/e.sqrt(9*o);do{do{u=1+a*(l=t.randn())}while(u<=0);u*=u*u,s=t._random_fn()}while(s>1-.331*e.pow(l,4)&&e.log(s)>.5*l*l+o*(1-u+e.log(u)));if(n==f)return o*u;do{s=t._random_fn()}while(0===s);return e.pow(s,1/f)*o*u},function(e){for(var n=0;ni;)f=u,s=l+(o=-(n+c)*(n+r+c)*t/(n+2*c)/(n+2*c+1))*s,u=(a=u+o*a)+(o=(c+=1)*(r-c)*t/(n+2*c-1)/(n+2*c))*u,a/=l=s+o*l,s/=l,u/=l,l=1;return u/n}function r(n,r,i){var o=[.9815606342467192,.9041172563704749,.7699026741943047,.5873179542866175,.3678314989981802,.1252334085114689],a=[.04717533638651183,.10693932599531843,.16007832854334622,.20316742672306592,.2334925365383548,.24914704581340277],s=.5*n;if(s>=8)return 1;var u,l=2*t.normal.cdf(s,0,1,1,0)-1;l=l>=e.exp(-50/i)?e.pow(l,i):0;for(var c=s,f=(8-s)/(u=n>3?2:3),h=c+f,d=0,p=i-1,g=1;g<=u;g++){for(var m=0,v=.5*(h+c),b=.5*(h-c),y=1;y<=12;y++){var w,x=v+b*(660)break;var M=2*t.normal.cdf(x,0,1,1,0)*.5-2*t.normal.cdf(x,n,1,1,0)*.5;M>=e.exp(-30/p)&&(m+=M=a[w-1]*e.exp(-.5*_)*e.pow(M,p))}d+=m*=2*b*i/e.sqrt(2*e.PI),c=h,h+=f}return(l+=d)<=e.exp(-30/r)?0:(l=e.pow(l,r))>=1?1:l}!function(e){for(var n=0;n1||n<0?0:1==r&&1==i?1:r<512&&i<512?e.pow(n,r-1)*e.pow(1-n,i-1)/t.betafn(r,i):e.exp((r-1)*e.log(n)+(i-1)*e.log(1-n)-t.betaln(r,i))},cdf:function(e,n,r){return e>1||e<0?1*(e>1):t.ibeta(e,n,r)},inv:function(e,n,r){return t.ibetainv(e,n,r)},mean:function(t,e){return t/(t+e)},median:function(e,n){return t.ibetainv(.5,e,n)},mode:function(t,e){return(t-1)/(t+e-2)},sample:function(e,n){var r=t.randg(e);return r/(r+t.randg(n))},variance:function(t,n){return t*n/(e.pow(t+n,2)*(t+n+1))}}),t.extend(t.centralF,{pdf:function(n,r,i){var o;return n<0?0:r<=2?0===n&&r<2?1/0:0===n&&2===r?1:1/t.betafn(r/2,i/2)*e.pow(r/i,r/2)*e.pow(n,r/2-1)*e.pow(1+r/i*n,-(r+i)/2):(o=r*n/(i+n*r),r*(i/(i+n*r))/2*t.binomial.pdf((r-2)/2,(r+i-2)/2,o))},cdf:function(e,n,r){return e<0?0:t.ibeta(n*e/(n*e+r),n/2,r/2)},inv:function(e,n,r){return r/(n*(1/t.ibetainv(e,n/2,r/2)-1))},mean:function(t,e){return e>2?e/(e-2):void 0},mode:function(t,e){return t>2?e*(t-2)/(t*(e+2)):void 0},sample:function(e,n){return 2*t.randg(e/2)/e/(2*t.randg(n/2)/n)},variance:function(t,e){if(!(e<=4))return 2*e*e*(t+e-2)/(t*(e-2)*(e-2)*(e-4))}}),t.extend(t.cauchy,{pdf:function(t,n,r){return r<0?0:r/(e.pow(t-n,2)+e.pow(r,2))/e.PI},cdf:function(t,n,r){return e.atan((t-n)/r)/e.PI+.5},inv:function(t,n,r){return n+r*e.tan(e.PI*(t-.5))},median:function(t){return t},mode:function(t){return t},sample:function(n,r){return t.randn()*e.sqrt(1/(2*t.randg(.5)))*r+n}}),t.extend(t.chisquare,{pdf:function(n,r){return n<0?0:0===n&&2===r?.5:e.exp((r/2-1)*e.log(n)-n/2-r/2*e.log(2)-t.gammaln(r/2))},cdf:function(e,n){return e<0?0:t.lowRegGamma(n/2,e/2)},inv:function(e,n){return 2*t.gammapinv(e,.5*n)},mean:function(t){return t},median:function(t){return t*e.pow(1-2/(9*t),3)},mode:function(t){return t-2>0?t-2:0},sample:function(e){return 2*t.randg(e/2)},variance:function(t){return 2*t}}),t.extend(t.exponential,{pdf:function(t,n){return t<0?0:n*e.exp(-n*t)},cdf:function(t,n){return t<0?0:1-e.exp(-n*t)},inv:function(t,n){return-e.log(1-t)/n},mean:function(t){return 1/t},median:function(t){return 1/t*e.log(2)},mode:function(){return 0},sample:function(n){return-1/n*e.log(t._random_fn())},variance:function(t){return e.pow(t,-2)}}),t.extend(t.gamma,{pdf:function(n,r,i){return n<0?0:0===n&&1===r?1/i:e.exp((r-1)*e.log(n)-n/i-t.gammaln(r)-r*e.log(i))},cdf:function(e,n,r){return e<0?0:t.lowRegGamma(n,e/r)},inv:function(e,n,r){return t.gammapinv(e,n)*r},mean:function(t,e){return t*e},mode:function(t,e){if(t>1)return(t-1)*e},sample:function(e,n){return t.randg(e)*n},variance:function(t,e){return t*e*e}}),t.extend(t.invgamma,{pdf:function(n,r,i){return n<=0?0:e.exp(-(r+1)*e.log(n)-i/n-t.gammaln(r)+r*e.log(i))},cdf:function(e,n,r){return e<=0?0:1-t.lowRegGamma(n,r/e)},inv:function(e,n,r){return r/t.gammapinv(1-e,n)},mean:function(t,e){return t>1?e/(t-1):void 0},mode:function(t,e){return e/(t+1)},sample:function(e,n){return n/t.randg(e)},variance:function(t,e){if(!(t<=2))return e*e/((t-1)*(t-1)*(t-2))}}),t.extend(t.kumaraswamy,{pdf:function(t,n,r){return 0===t&&1===n?r:1===t&&1===r?n:e.exp(e.log(n)+e.log(r)+(n-1)*e.log(t)+(r-1)*e.log(1-e.pow(t,n)))},cdf:function(t,n,r){return t<0?0:t>1?1:1-e.pow(1-e.pow(t,n),r)},inv:function(t,n,r){return e.pow(1-e.pow(1-t,1/r),1/n)},mean:function(e,n){return n*t.gammafn(1+1/e)*t.gammafn(n)/t.gammafn(1+1/e+n)},median:function(t,n){return e.pow(1-e.pow(2,-1/n),1/t)},mode:function(t,n){if(t>=1&&n>=1&&1!==t&&1!==n)return e.pow((t-1)/(t*n-1),1/t)},variance:function(){throw new Error("variance not yet implemented")}}),t.extend(t.lognormal,{pdf:function(t,n,r){return t<=0?0:e.exp(-e.log(t)-.5*e.log(2*e.PI)-e.log(r)-e.pow(e.log(t)-n,2)/(2*r*r))},cdf:function(n,r,i){return n<0?0:.5+.5*t.erf((e.log(n)-r)/e.sqrt(2*i*i))},inv:function(n,r,i){return e.exp(-1.4142135623730951*i*t.erfcinv(2*n)+r)},mean:function(t,n){return e.exp(t+n*n/2)},median:function(t){return e.exp(t)},mode:function(t,n){return e.exp(t-n*n)},sample:function(n,r){return e.exp(t.randn()*r+n)},variance:function(t,n){return(e.exp(n*n)-1)*e.exp(2*t+n*n)}}),t.extend(t.noncentralt,{pdf:function(n,r,i){return e.abs(i)<1e-14?t.studentt.pdf(n,r):e.abs(n)<1e-14?e.exp(t.gammaln((r+1)/2)-i*i/2-.5*e.log(e.PI*r)-t.gammaln(r/2)):r/n*(t.noncentralt.cdf(n*e.sqrt(1+2/r),r+2,i)-t.noncentralt.cdf(n,r,i))},cdf:function(n,r,i){var o=1e-14;if(e.abs(i)o||u>o;)l=u,f>0&&(h*=i*i/(2*f),d*=i*i/(2*(f+.5))),s+=.5*(u=h*t.beta.cdf(c,f+.5,r/2)+d*t.beta.cdf(c,f+1,r/2)),f++;return a?1-s:s}}),t.extend(t.normal,{pdf:function(t,n,r){return e.exp(-.5*e.log(2*e.PI)-e.log(r)-e.pow(t-n,2)/(2*r*r))},cdf:function(n,r,i){return.5*(1+t.erf((n-r)/e.sqrt(2*i*i)))},inv:function(e,n,r){return-1.4142135623730951*r*t.erfcinv(2*e)+n},mean:function(t){return t},median:function(t){return t},mode:function(t){return t},sample:function(e,n){return t.randn()*n+e},variance:function(t,e){return e*e}}),t.extend(t.pareto,{pdf:function(t,n,r){return t1e100?1e100:r,1/(e.sqrt(r)*t.betafn(.5,r/2))*e.pow(1+n*n/r,-(r+1)/2)},cdf:function(n,r){var i=r/2;return t.ibeta((n+e.sqrt(n*n+r))/(2*e.sqrt(n*n+r)),i,i)},inv:function(n,r){var i=t.ibetainv(2*e.min(n,1-n),.5*r,.5);return i=e.sqrt(r*(1-i)/i),n>.5?i:-i},mean:function(t){return t>1?0:void 0},median:function(){return 0},mode:function(){return 0},sample:function(n){return t.randn()*e.sqrt(n/(2*t.randg(n/2)))},variance:function(t){return t>2?t/(t-2):t>1?1/0:void 0}}),t.extend(t.weibull,{pdf:function(t,n,r){return t<0||n<0||r<0?0:r/n*e.pow(t/n,r-1)*e.exp(-e.pow(t/n,r))},cdf:function(t,n,r){return t<0?0:1-e.exp(-e.pow(t/n,r))},inv:function(t,n,r){return n*e.pow(-e.log(1-t),1/r)},mean:function(e,n){return e*t.gammafn(1+1/n)},median:function(t,n){return t*e.pow(e.log(2),1/n)},mode:function(t,n){return n<=1?0:t*e.pow((n-1)/n,1/n)},sample:function(n,r){return n*e.pow(-e.log(t._random_fn()),1/r)},variance:function(n,r){return n*n*t.gammafn(1+2/r)-e.pow(t.weibull.mean(n,r),2)}}),t.extend(t.uniform,{pdf:function(t,e,n){return tn?0:1/(n-e)},cdf:function(t,e,n){return t=i)return 1;if(o<0||o>1||i<=0)return NaN;var u=o,l=(r=e.floor(r))+1,c=i-r,f=l+c,h=e.exp(t.gammaln(f)-t.gammaln(c)-t.gammaln(l)+l*e.log(u)+c*e.log(1-u));return a=u<(l+1)/(f+2)?h*n(u,l,c,s):1-h*n(1-u,c,l,s),e.round(1/s*(1-a))/(1/s)}}),t.extend(t.negbin,{pdf:function(n,r,i){return n===n>>>0&&(n<0?0:t.combination(n+r-1,r-1)*e.pow(1-i,n)*e.pow(i,r))},cdf:function(e,n,r){var i=0,o=0;if(e<0)return 0;for(;o<=e;o++)i+=t.negbin.pdf(o,n,r);return i}}),t.extend(t.hypgeom,{pdf:function(n,r,i,o){if(n!=n|0)return!1;if(n<0||no||n>i)return 0;if(2*i>r)return 2*o>r?t.hypgeom.pdf(r-i-o+n,r,r-i,r-o):t.hypgeom.pdf(o-n,r,r-i,o);if(2*o>r)return t.hypgeom.pdf(i-n,r,i,r-o);if(i1&&s=o||n>=i)return 1;if(2*i>r)return 2*o>r?t.hypgeom.cdf(r-i-o+n,r,r-i,r-o):1-t.hypgeom.cdf(o-n-1,r,r-i,o);if(2*o>r)return 1-t.hypgeom.cdf(i-n-1,r,i,r-o);if(i1&&uo);return i-1},sampleLarge:function(n){var r,i,o,a,s,u,l,c,f,h,d=n;for(a=e.sqrt(d),s=e.log(d),u=.02483*(l=.931+2.53*a)-.059,c=1.1239+1.1328/(l-3.4),f=.9277-3.6224/(l-2);;){if(i=e.random()-.5,o=e.random(),h=.5-e.abs(i),r=e.floor((2*u/h+l)*i+d+.43),h>=.07&&o<=f)return r;if(!(r<0||h<.013&&o>h)&&e.log(o)+e.log(c)-e.log(u/(h*h)+l)<=r*s-d-t.loggam(r+1))return r}},sample:function(t){return t<10?this.sampleSmall(t):this.sampleLarge(t)}}),t.extend(t.triangular,{pdf:function(t,e,n,r){return n<=e||rn?NaN:tn?0:tr?NaN:t<=n?0:t>=r?1:t<=i?e.pow(t-n,2)/((r-n)*(i-n)):1-e.pow(r-t,2)/((r-n)*(r-i))},inv:function(t,n,r,i){return r<=n||ir?NaN:t<=(i-n)/(r-n)?n+(r-n)*e.sqrt(t*((i-n)/(r-n))):n+(r-n)*(1-e.sqrt((1-t)*(1-(i-n)/(r-n))))},mean:function(t,e,n){return(t+e+n)/3},median:function(t,n,r){return r<=(t+n)/2?n-e.sqrt((n-t)*(n-r))/e.sqrt(2):r>(t+n)/2?t+e.sqrt((n-t)*(r-t))/e.sqrt(2):void 0},mode:function(t,e,n){return n},sample:function(n,r,i){var o=t._random_fn();return o<(i-n)/(r-n)?n+e.sqrt(o*(r-n)*(i-n)):r-e.sqrt((1-o)*(r-n)*(r-i))},variance:function(t,e,n){return(t*t+e*e+n*n-t*e-t*n-e*n)/18}}),t.extend(t.arcsine,{pdf:function(t,n,r){return r<=n?NaN:t<=n||t>=r?0:2/e.PI*e.pow(e.pow(r-n,2)-e.pow(2*t-n-r,2),-.5)},cdf:function(t,n,r){return t25e3)return r(n,1,a);var l,c=.5*o,f=c*e.log(o)-o*e.log(2)-t.gammaln(c),h=c-1,d=.25*o;l=o<=100?1:o<=800?.5:o<=5e3?.25:.125,f+=e.log(l);for(var p=0,g=1;g<=50;g++){for(var m=0,v=(2*g-1)*l,b=1;b<=16;b++){var y,w;8=-30&&(m+=r(8=1&&m<=1e-14)break;p+=m}if(m>1e-14)throw new Error("tukey.cdf failed to converge");return p>1&&(p=1),p},inv:function(n,r,i){if(i<2||r<2)return NaN;if(n<0||n>1)return NaN;if(0===n)return 0;if(1===n)return 1/0;var o,a=function(t,n,r){var i=.5-.5*t,o=e.sqrt(e.log(1/(i*i))),a=o+((((-453642210148e-16*o-.204231210125)*o-.342242088547)*o-1)*o+.322232421088)/((((.0038560700634*o+.10353775285)*o+.531103462366)*o+.588581570495)*o+.099348462606);r<120&&(a+=(a*a*a+a)/r/4);var s=.8832-.2368*a;return r<120&&(s+=-1.214/r+1.208*a/r),a*(s*e.log(n-1)+1.4142)}(n,r,i),s=t.tukey.cdf(a,r,i)-n;o=s>0?e.max(0,a-1):a+1;for(var u,l=t.tukey.cdf(o,r,i)-n,c=1;c<50;c++)if(u=o-l*(o-a)/(l-s),s=l,a=o,u<0&&(u=0,l=-n),l=t.tukey.cdf(u,r,i)-n,o=u,e.abs(o-a)<1e-4)return u;throw new Error("tukey.inv failed to converge")}})}(e,Math),function(t,e){var n,r,i=Array.prototype.push,o=t.utils.isArray;function a(e){return o(e)||e instanceof t}t.extend({add:function(e,n){return a(n)?(a(n[0])||(n=[n]),t.map(e,(function(t,e,r){return t+n[e][r]}))):t.map(e,(function(t){return t+n}))},subtract:function(e,n){return a(n)?(a(n[0])||(n=[n]),t.map(e,(function(t,e,r){return t-n[e][r]||0}))):t.map(e,(function(t){return t-n}))},divide:function(e,n){return a(n)?(a(n[0])||(n=[n]),t.multiply(e,t.inv(n))):t.map(e,(function(t){return t/n}))},multiply:function(e,n){var r,i,o,s,u,l,c,f;if(void 0===e.length&&void 0===n.length)return e*n;if(u=e.length,l=e[0].length,c=t.zeros(u,o=a(n)?n[0].length:l),f=0,a(n)){for(;f=0;u--){for(d=0,l=u+1;l<=c-1;l++)d+=p[l]*n[u][l];p[u]=(n[u][i-1]-d)/n[u][u]}return p},gauss_jordan:function(n,r){var i,o,a,s=t.aug(n,r),u=s.length,l=s[0].length,c=0;for(o=0;oe.abs(s[f][o])&&(f=a);var h=s[o];for(s[o]=s[f],s[f]=h,a=o+1;a=0;o--){for(c=s[o][o],a=0;ao-1;i--)s[a][i]-=s[o][i]*s[a][o]/c;for(s[o][o]/=c,i=u;if?(d[c][f]=n[c][f],p[c][f]=g[c][f]=0):co;)a=l,l=t.add(t.multiply(u,a),s),c++;return l},gauss_seidel:function(n,r,i,o){for(var a,s,u,l,c,f=0,h=n.length,d=[],p=[],g=[];fa?(d[f][a]=n[f][a],p[f][a]=g[f][a]=0):fo;)s=c,c=t.add(t.multiply(l,s),u),f+=1;return c},SOR:function(n,r,i,o,a){for(var s,u,l,c,f,h=0,d=n.length,p=[],g=[],m=[];hs?(p[h][s]=n[h][s],g[h][s]=m[h][s]=0):ho;)u=f,f=t.add(t.multiply(c,u),l),h++;return f},householder:function(n){for(var r,i,o,a,s=n.length,u=n[0].length,l=0,c=[],f=[];l0?-1:1)*e.sqrt(r),i=e.sqrt((r*r-n[l+1][l]*r)/2),(c=t.zeros(s,1))[l+1][0]=(n[l+1][l]-r)/(2*i),o=l+2;o0?e.PI/4:-e.PI/4:e.atan(2*n[o][a]/(n[o][o]-n[a][a]))/2,(l=t.identity(f,f))[o][o]=e.cos(u),l[o][a]=-e.sin(u),l[a][o]=e.sin(u),l[a][a]=e.cos(u),h=t.multiply(h,l),n=t.multiply(t.multiply(t.inv(l),n),l),c=0,r=1;r.001&&(c=1)}for(r=0;r=f;)a=o(t,r+i),s=o(t,r),d[h]=(n[a]-2*n[s]+n[2*s-a])/(i*i),i/=2,h++;for(l=d.length,u=1;1!=l;){for(c=0;cr);i++);return n[i-=1]+(r-e[i])*h[i]+t.sq(r-e[i])*o[i]+(r-e[i])*t.sq(r-e[i])*d[i]},gauss_quadrature:function(){throw new Error("gauss_quadrature not yet implemented")},PCA:function(e){var n,r,i,o,a,s=e.length,u=e[0].length,l=0,c=[],f=[],h=[],d=[],p=[],g=[],m=[];for(l=0;l1||r>1||t<=0||r<=0)throw new Error("Proportions should be greater than 0 and less than 1");var o=(t*n+r*i)/(n+i);return(t-r)/e.sqrt(o*(1-o)*(1/n+1/i))}t.extend({zscore:function(){var e=n.call(arguments);return r(e[1])?(e[0]-e[1])/e[2]:(e[0]-t.mean(e[1]))/t.stdev(e[1],e[2])},ztest:function(){var r,o=n.call(arguments);return i(o[1])?(r=t.zscore(o[0],o[1],o[3]),1===o[2]?t.normal.cdf(-e.abs(r),0,1):2*t.normal.cdf(-e.abs(r),0,1)):o.length>2?(r=t.zscore(o[0],o[1],o[2]),1===o[3]?t.normal.cdf(-e.abs(r),0,1):2*t.normal.cdf(-e.abs(r),0,1)):(r=o[0],1===o[1]?t.normal.cdf(-e.abs(r),0,1):2*t.normal.cdf(-e.abs(r),0,1))}}),t.extend(t.fn,{zscore:function(t,e){return(t-this.mean())/this.stdev(e)},ztest:function(n,r,i){var o=e.abs(this.zscore(n,i));return 1===r?t.normal.cdf(-o,0,1):2*t.normal.cdf(-o,0,1)}}),t.extend({tscore:function(){var r=n.call(arguments);return 4===r.length?(r[0]-r[1])/(r[2]/e.sqrt(r[3])):(r[0]-t.mean(r[1]))/(t.stdev(r[1],!0)/e.sqrt(r[1].length))},ttest:function(){var i,o=n.call(arguments);return 5===o.length?(i=e.abs(t.tscore(o[0],o[1],o[2],o[3])),1===o[4]?t.studentt.cdf(-i,o[3]-1):2*t.studentt.cdf(-i,o[3]-1)):r(o[1])?(i=e.abs(o[0]),1==o[2]?t.studentt.cdf(-i,o[1]-1):2*t.studentt.cdf(-i,o[1]-1)):(i=e.abs(t.tscore(o[0],o[1])),1==o[2]?t.studentt.cdf(-i,o[1].length-1):2*t.studentt.cdf(-i,o[1].length-1))}}),t.extend(t.fn,{tscore:function(t){return(t-this.mean())/(this.stdev(!0)/e.sqrt(this.cols()))},ttest:function(n,r){return 1===r?1-t.studentt.cdf(e.abs(this.tscore(n)),this.cols()-1):2*t.studentt.cdf(-e.abs(this.tscore(n)),this.cols()-1)}}),t.extend({anovafscore:function(){var r,i,o,a,s,u,l,c,f=n.call(arguments);if(1===f.length){for(s=new Array(f[0].length),l=0;l.5?1-r:r)})),c=e.studentt.inv(.975,n.df_resid),f=n.coef.map((function(t,e){var n=c*s[e];return[t-n,t+n]}));return{se:s,t:u,p:l,sigmaHat:a,interval95:f}}return{ols:function(r,i){var o=t(r,i),a=n(o),s=function(t){var n,r,i,o=t.R2/t.df_model/((1-t.R2)/t.df_resid);return{F_statistic:o,pvalue:1-(n=o,r=t.df_model,i=t.df_resid,e.beta.cdf(n/(i/r+n),r/2,i/2))}}(o),u=1-(1-o.R2)*((o.nobs-1)/o.df_resid);return o.t=a,o.f=s,o.adjust_R2=u,o}}}(),e.extend({buildxmatrix:function(){for(var t=new Array(arguments.length),n=0;n1){for(a=[],r=0;r{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var r={};(()=>{"use strict";n.r(r),n.d(r,{Langevitour:()=>Wr});var t=n(162),e=n(409);function i(){}function o(t){return null==t?i:function(){return this.querySelector(t)}}function a(){return[]}function s(t){return null==t?a:function(){return this.querySelectorAll(t)}}function u(t){return function(){return this.matches(t)}}function l(t){return function(e){return e.matches(t)}}var c=Array.prototype.find;function f(){return this.firstElementChild}var h=Array.prototype.filter;function d(){return Array.from(this.children)}function p(t){return new Array(t.length)}function g(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}function m(t,e,n,r,i,o){for(var a,s=0,u=e.length,l=o.length;se?1:t>=e?0:NaN}g.prototype={constructor:g,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};var x="http://www.w3.org/1999/xhtml";const _={svg:"http://www.w3.org/2000/svg",xhtml:x,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function M(t){var e=t+="",n=e.indexOf(":");return n>=0&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),_.hasOwnProperty(e)?{space:_[e],local:t}:t}function k(t){return function(){this.removeAttribute(t)}}function A(t){return function(){this.removeAttributeNS(t.space,t.local)}}function S(t,e){return function(){this.setAttribute(t,e)}}function N(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function q(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}}function E(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function C(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function I(t){return function(){this.style.removeProperty(t)}}function P(t,e,n){return function(){this.style.setProperty(t,e,n)}}function j(t,e,n){return function(){var r=e.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function D(t,e){return t.style.getPropertyValue(e)||C(t).getComputedStyle(t,null).getPropertyValue(e)}function T(t){return function(){delete this[t]}}function z(t,e){return function(){this[t]=e}}function $(t,e){return function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}}function B(t){return t.trim().split(/^|\s+/)}function F(t){return t.classList||new R(t)}function R(t){this._node=t,this._names=B(t.getAttribute("class")||"")}function X(t,e){for(var n=F(t),r=-1,i=e.length;++r=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var ht=[null];function dt(t,e){this._groups=t,this._parents=e}function pt(){return new dt([[document.documentElement]],ht)}dt.prototype=pt.prototype={constructor:dt,select:function(t){"function"!=typeof t&&(t=o(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i=A&&(A=k+1);!(M=x[A])&&++A=0;)(r=i[o])&&(a&&4^r.compareDocumentPosition(a)&&a.parentNode.insertBefore(r,a),a=r);return this},sort:function(t){function e(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}t||(t=w);for(var n=this._groups,r=n.length,i=new Array(r),o=0;o1?this.each((null==e?I:"function"==typeof e?j:P)(t,e,null==n?"":n)):D(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?T:"function"==typeof e?$:z)(t,e)):this.node()[t]},classed:function(t,e){var n=B(t+"");if(arguments.length<2){for(var r=F(this.node()),i=-1,o=n.length;++i=0&&(e=t.slice(n+1),t=t.slice(0,n)),{type:t,name:e}}))}(t+""),a=o.length;if(!(arguments.length<2)){for(s=e?ut:st,r=0;r{}};function vt(){for(var t,e=0,n=arguments.length,r={};e=0&&(e=t.slice(n+1),t=t.slice(0,n)),t&&!r.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}}))),a=-1,s=o.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++a0)for(var n,r,i=new Array(n),o=0;o=0&&e._call.call(void 0,t),e=e._next;--kt}()}finally{kt=0,function(){for(var t,e,n=_t,r=1/0;n;)n._call?(r>n._time&&(r=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:_t=e);Mt=t,Ft(r)}(),Et=0}}function Bt(){var t=It.now(),e=t-qt;e>Nt&&(Ct-=e,qt=t)}function Ft(t){kt||(At&&(At=clearTimeout(At)),t-Et>24?(t<1/0&&(At=setTimeout($t,t-It.now()-Ct)),St&&(St=clearInterval(St))):(St||(qt=It.now(),St=setInterval(Bt,Nt)),kt=1,Pt($t)))}function Rt(t,e,n){var r=new Tt;return e=null==e?0:+e,r.restart((n=>{r.stop(),t(n+e)}),e,n),r}Tt.prototype=zt.prototype={constructor:Tt,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?jt():+n)+(null==e?0:+e),this._next||Mt===this||(Mt?Mt._next=this:_t=this,Mt=this),this._call=t,this._time=n,Ft()},stop:function(){this._call&&(this._call=null,this._time=1/0,Ft())}};var Xt=xt("start","end","cancel","interrupt"),Lt=[],Ot=0,Ht=3;function Yt(t,e,n,r,i,o){var a=t.__transition;if(a){if(n in a)return}else t.__transition={};!function(t,e,n){var r,i=t.__transition;function o(u){var l,c,f,h;if(1!==n.state)return s();for(l in i)if((h=i[l]).name===n.name){if(h.state===Ht)return Rt(o);4===h.state?(h.state=6,h.timer.stop(),h.on.call("interrupt",t,t.__data__,h.index,h.group),delete i[l]):+lOt)throw new Error("too late; already scheduled");return n}function Ut(t,e){var n=Vt(t,e);if(n.state>Ht)throw new Error("too late; already running");return n}function Vt(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function Gt(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}var Kt,Jt=180/Math.PI,Qt={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Zt(t,e,n,r,i,o){var a,s,u;return(a=Math.sqrt(t*t+e*e))&&(t/=a,e/=a),(u=t*n+e*r)&&(n-=t*u,r-=e*u),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,u/=s),t*r180?e+=360:e-t>180&&(t+=360),o.push({i:n.push(i(n)+"rotate(",null,r)-2,x:Gt(t,e)})):e&&n.push(i(n)+"rotate("+e+r)}(o.rotate,a.rotate,s,u),function(t,e,n,o){t!==e?o.push({i:n.push(i(n)+"skewX(",null,r)-2,x:Gt(t,e)}):e&&n.push(i(n)+"skewX("+e+r)}(o.skewX,a.skewX,s,u),function(t,e,n,r,o,a){if(t!==n||e!==r){var s=o.push(i(o)+"scale(",null,",",null,")");a.push({i:s-4,x:Gt(t,n)},{i:s-2,x:Gt(e,r)})}else 1===n&&1===r||o.push(i(o)+"scale("+n+","+r+")")}(o.scaleX,o.scaleY,a.scaleX,a.scaleY,s,u),o=a=null,function(t){for(var e,n=-1,r=u.length;++n>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?Se(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?Se(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=ge.exec(t))?new qe(e[1],e[2],e[3],1):(e=me.exec(t))?new qe(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=ve.exec(t))?Se(e[1],e[2],e[3],e[4]):(e=be.exec(t))?Se(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=ye.exec(t))?De(e[1],e[2]/100,e[3]/100,1):(e=we.exec(t))?De(e[1],e[2]/100,e[3]/100,e[4]):xe.hasOwnProperty(t)?Ae(xe[t]):"transparent"===t?new qe(NaN,NaN,NaN,0):null}function Ae(t){return new qe(t>>16&255,t>>8&255,255&t,1)}function Se(t,e,n,r){return r<=0&&(t=e=n=NaN),new qe(t,e,n,r)}function Ne(t,e,n,r){return 1===arguments.length?((i=t)instanceof ue||(i=ke(i)),i?new qe((i=i.rgb()).r,i.g,i.b,i.opacity):new qe):new qe(t,e,n,null==r?1:r);var i}function qe(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function Ee(){return`#${je(this.r)}${je(this.g)}${je(this.b)}`}function Ce(){const t=Ie(this.opacity);return`${1===t?"rgb(":"rgba("}${Pe(this.r)}, ${Pe(this.g)}, ${Pe(this.b)}${1===t?")":`, ${t})`}`}function Ie(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Pe(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function je(t){return((t=Pe(t))<16?"0":"")+t.toString(16)}function De(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new ze(t,e,n,r)}function Te(t){if(t instanceof ze)return new ze(t.h,t.s,t.l,t.opacity);if(t instanceof ue||(t=ke(t)),!t)return new ze;if(t instanceof ze)return t;var e=(t=t.rgb()).r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),o=Math.max(e,n,r),a=NaN,s=o-i,u=(o+i)/2;return s?(a=e===o?(n-r)/s+6*(n0&&u<1?0:a,new ze(a,s,u,t.opacity)}function ze(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function $e(t){return(t=(t||0)%360)<0?t+360:t}function Be(t){return Math.max(0,Math.min(1,t||0))}function Fe(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}function Re(t,e,n,r,i){var o=t*t,a=o*t;return((1-3*t+3*o-a)*e+(4-6*o+3*a)*n+(1+3*t+3*o-3*a)*r+a*i)/6}ae(ue,ke,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:_e,formatHex:_e,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Te(this).formatHsl()},formatRgb:Me,toString:Me}),ae(qe,Ne,se(ue,{brighter(t){return t=null==t?ce:Math.pow(ce,t),new qe(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?le:Math.pow(le,t),new qe(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new qe(Pe(this.r),Pe(this.g),Pe(this.b),Ie(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Ee,formatHex:Ee,formatHex8:function(){return`#${je(this.r)}${je(this.g)}${je(this.b)}${je(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:Ce,toString:Ce})),ae(ze,(function(t,e,n,r){return 1===arguments.length?Te(t):new ze(t,e,n,null==r?1:r)}),se(ue,{brighter(t){return t=null==t?ce:Math.pow(ce,t),new ze(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?le:Math.pow(le,t),new ze(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new qe(Fe(t>=240?t-240:t+120,i,r),Fe(t,i,r),Fe(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new ze($e(this.h),Be(this.s),Be(this.l),Ie(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=Ie(this.opacity);return`${1===t?"hsl(":"hsla("}${$e(this.h)}, ${100*Be(this.s)}%, ${100*Be(this.l)}%${1===t?")":`, ${t})`}`}}));const Xe=t=>()=>t;function Le(t,e){var n=e-t;return n?function(t,e){return function(n){return t+n*e}}(t,n):Xe(isNaN(t)?e:t)}const Oe=function t(e){var n=function(t){return 1==(t=+t)?Le:function(e,n){return n-e?function(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}(e,n,t):Xe(isNaN(e)?n:e)}}(e);function r(t,e){var r=n((t=Ne(t)).r,(e=Ne(e)).r),i=n(t.g,e.g),o=n(t.b,e.b),a=Le(t.opacity,e.opacity);return function(e){return t.r=r(e),t.g=i(e),t.b=o(e),t.opacity=a(e),t+""}}return r.gamma=t,r}(1);function He(t){return function(e){var n,r,i=e.length,o=new Array(i),a=new Array(i),s=new Array(i);for(n=0;n=1?(n=1,e-1):Math.floor(n*e),i=t[r],o=t[r+1],a=r>0?t[r-1]:2*i-o,s=ro&&(i=e.slice(o,i),s[a]?s[a]+=i:s[++a]=i),(n=n[0])===(r=r[0])?s[a]?s[a]+=r:s[++a]=r:(s[++a]=null,u.push({i:a,x:Gt(n,r)})),o=We.lastIndex;return o=0&&(t=t.slice(0,e)),!t||"start"===t}))}(e)?Wt:Ut;return function(){var a=o(this,t),s=a.on;s!==r&&(i=(r=s).copy()).on(e,n),a.on=i}}(n,t,e))},attr:function(t,e){var n=M(t),r="transform"===n?ne:Ve;return this.attrTween(t,"function"==typeof e?(n.local?tn:Ze)(n,r,oe(this,"attr."+t,e)):null==e?(n.local?Ke:Ge)(n):(n.local?Qe:Je)(n,r,e))},attrTween:function(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==e)return this.tween(n,null);if("function"!=typeof e)throw new Error;var r=M(t);return this.tween(n,(r.local?en:nn)(r,e))},style:function(t,e,n){var r="transform"==(t+="")?ee:Ve;return null==e?this.styleTween(t,function(t,e){var n,r,i;return function(){var o=D(this,t),a=(this.style.removeProperty(t),D(this,t));return o===a?null:o===n&&a===r?i:i=e(n=o,r=a)}}(t,r)).on("end.style."+t,ln(t)):"function"==typeof e?this.styleTween(t,function(t,e,n){var r,i,o;return function(){var a=D(this,t),s=n(this),u=s+"";return null==s&&(this.style.removeProperty(t),u=s=D(this,t)),a===u?null:a===r&&u===i?o:(i=u,o=e(r=a,s))}}(t,r,oe(this,"style."+t,e))).each(function(t,e){var n,r,i,o,a="style."+e,s="end."+a;return function(){var u=Ut(this,t),l=u.on,c=null==u.value[a]?o||(o=ln(e)):void 0;l===n&&i===c||(r=(n=l).copy()).on(s,i=c),u.on=r}}(this._id,t)):this.styleTween(t,function(t,e,n){var r,i,o=n+"";return function(){var a=D(this,t);return a===o?null:a===r?i:i=e(r=a,n)}}(t,r,e),n).on("end.style."+t,null)},styleTween:function(t,e,n){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==e)return this.tween(r,null);if("function"!=typeof e)throw new Error;return this.tween(r,function(t,e,n){var r,i;function o(){var o=e.apply(this,arguments);return o!==i&&(r=(i=o)&&function(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}(t,o,n)),r}return o._value=e,o}(t,e,null==n?"":n))},text:function(t){return this.tween("text","function"==typeof t?function(t){return function(){var e=t(this);this.textContent=null==e?"":e}}(oe(this,"text",t)):function(t){return function(){this.textContent=t}}(null==t?"":t+""))},textTween:function(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(null==t)return this.tween(e,null);if("function"!=typeof t)throw new Error;return this.tween(e,function(t){var e,n;function r(){var r=t.apply(this,arguments);return r!==n&&(e=(n=r)&&function(t){return function(e){this.textContent=t.call(this,e)}}(r)),e}return r._value=t,r}(t))},remove:function(){return this.on("end.remove",function(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}(this._id))},tween:function(t,e){var n=this._id;if(t+="",arguments.length<2){for(var r,i=Vt(this.node(),n).tween,o=0,a=i.length;o2&&n.state<5,n.state=6,n.timer.stop(),n.on.call(r?"interrupt":"cancel",t,t.__data__,n.index,n.group),delete o[i]):a=!1;a&&delete t.__transition}}(this,t)}))},gt.prototype.transition=function(t){var e,n;t instanceof fn?(e=t._id,t=t._name):(e=hn(),(n=pn).time=jt(),t=null==t?null:t+"");for(var r=this._groups,i=r.length,o=0;o()=>t;function Nn(t,{sourceEvent:e,subject:n,target:r,identifier:i,active:o,x:a,y:s,dx:u,dy:l,dispatch:c}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:o,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:u,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:c}})}function qn(t){return!t.ctrlKey&&!t.button}function En(){return this.parentNode}function Cn(t,e){return null==e?{x:t.x,y:t.y}:e}function In(){return navigator.maxTouchPoints||"ontouchstart"in this}Nn.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};var Pn=Math.sqrt(50),jn=Math.sqrt(10),Dn=Math.sqrt(2);function Tn(t,e,n){var r=(e-t)/Math.max(0,n),i=Math.floor(Math.log(r)/Math.LN10),o=r/Math.pow(10,i);return i>=0?(o>=Pn?10:o>=jn?5:o>=Dn?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(o>=Pn?10:o>=jn?5:o>=Dn?2:1)}function zn(t,e){return null==t||null==e?NaN:te?1:t>=e?0:NaN}function $n(t,e){return null==t||null==e?NaN:et?1:e>=t?0:NaN}function Bn(t){let e,n,r;function i(t,r,i=0,o=t.length){if(i>>1;n(t[e],r)<0?i=e+1:o=e}while(izn(t(e),n),r=(e,n)=>t(e)-n):(e=t===zn||t===$n?t:Fn,n=t,r=t),{left:i,center:function(t,e,n=0,o=t.length){const a=i(t,e,n,o-1);return a>n&&r(t[a-1],e)>-r(t[a],e)?a-1:a},right:function(t,r,i=0,o=t.length){if(i>>1;n(t[e],r)<=0?i=e+1:o=e}while(i=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function ir(t){if(!(e=rr.exec(t)))throw new Error("invalid format: "+t);var e;return new or({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}function or(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}function ar(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,r=t.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+t.slice(n+1)]}function sr(t){return(t=ar(Math.abs(t)))?t[1]:NaN}function ur(t,e){var n=ar(t,e);if(!n)return t+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}ir.prototype=or.prototype,or.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};const lr={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>ur(100*t,e),r:ur,s:function(t,e){var n=ar(t,e);if(!n)return t+"";var r=n[0],i=n[1],o=i-(nr=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,a=r.length;return o===a?r:o>a?r+new Array(o-a+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+ar(t,Math.max(0,e+o-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function cr(t){return t}var fr,hr,dr,pr=Array.prototype.map,gr=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function mr(t){var e=t.domain;return t.ticks=function(t){var n=e();return function(t,e,n){var r,i,o,a,s=-1;if(n=+n,(t=+t)==(e=+e)&&n>0)return[t];if((r=e0){let n=Math.round(t/a),r=Math.round(e/a);for(n*ae&&--r,o=new Array(i=r-n+1);++se&&--r,o=new Array(i=r-n+1);++s=Pn?i*=10:o>=jn?i*=5:o>=Dn&&(i*=2),e0;){if((i=Tn(u,l,n))===r)return o[a]=u,o[s]=l,e(o);if(i>0)u=Math.floor(u/i)*i,l=Math.ceil(l/i)*i;else{if(!(i<0))break;u=Math.ceil(u*i)/i,l=Math.floor(l*i)/i}r=i}return t},t}function vr(){var t=function(){var t,e,n,r,i,o,a=Kn,s=Kn,u=Un,l=Jn;function c(){var t,e,n,u=Math.min(a.length,s.length);return l!==Jn&&(t=a[0],e=a[u-1],t>e&&(n=t,t=e,e=n),l=function(n){return Math.max(t,Math.min(e,n))}),r=u>2?tr:Zn,i=o=null,f}function f(e){return null==e||isNaN(e=+e)?n:(i||(i=r(a.map(t),s,u)))(t(l(e)))}return f.invert=function(n){return l(e((o||(o=r(s,a.map(t),Gt)))(n)))},f.domain=function(t){return arguments.length?(a=Array.from(t,Gn),c()):a.slice()},f.range=function(t){return arguments.length?(s=Array.from(t),c()):s.slice()},f.rangeRound=function(t){return s=Array.from(t),u=Vn,c()},f.clamp=function(t){return arguments.length?(l=!!t||Jn,c()):l!==Jn},f.interpolate=function(t){return arguments.length?(u=t,c()):u},f.unknown=function(t){return arguments.length?(n=t,f):n},function(n,r){return t=n,e=r,c()}}()(Jn,Jn);return t.copy=function(){return e=t,vr().domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown());var e},er.apply(t,arguments),mr(t)}function br(t){for(var e=t.length/6|0,n=new Array(e),r=0;r0&&s>0&&(u+s+1>r&&(s=Math.max(1,r-u)),o.push(t.substring(i-=s,i+s)),!((u+=s+1)>r));)s=e[a=(a+1)%e.length];return o.reverse().join(n)}),i=void 0===t.currency?"":t.currency[0]+"",o=void 0===t.currency?"":t.currency[1]+"",a=void 0===t.decimal?".":t.decimal+"",s=void 0===t.numerals?cr:function(t){return function(e){return e.replace(/[0-9]/g,(function(e){return t[+e]}))}}(pr.call(t.numerals,String)),u=void 0===t.percent?"%":t.percent+"",l=void 0===t.minus?"−":t.minus+"",c=void 0===t.nan?"NaN":t.nan+"";function f(t){var e=(t=ir(t)).fill,n=t.align,f=t.sign,h=t.symbol,d=t.zero,p=t.width,g=t.comma,m=t.precision,v=t.trim,b=t.type;"n"===b?(g=!0,b="g"):lr[b]||(void 0===m&&(m=12),v=!0,b="g"),(d||"0"===e&&"="===n)&&(d=!0,e="0",n="=");var y="$"===h?i:"#"===h&&/[boxX]/.test(b)?"0"+b.toLowerCase():"",w="$"===h?o:/[%p]/.test(b)?u:"",x=lr[b],_=/[defgprs%]/.test(b);function M(t){var i,o,u,h=y,M=w;if("c"===b)M=x(t)+M,t="";else{var k=(t=+t)<0||1/t<0;if(t=isNaN(t)?c:x(Math.abs(t),m),v&&(t=function(t){t:for(var e,n=t.length,r=1,i=-1;r0&&(i=0)}return i>0?t.slice(0,i)+t.slice(e+1):t}(t)),k&&0==+t&&"+"!==f&&(k=!1),h=(k?"("===f?f:l:"-"===f||"("===f?"":f)+h,M=("s"===b?gr[8+nr/3]:"")+M+(k&&"("===f?")":""),_)for(i=-1,o=t.length;++i(u=t.charCodeAt(i))||u>57){M=(46===u?a+t.slice(i+1):t.slice(i))+M,t=t.slice(0,i);break}}g&&!d&&(t=r(t,1/0));var A=h.length+t.length+M.length,S=A>1)+h+t+M+S.slice(A);break;default:t=S+h+t+M}return s(t)}return m=void 0===m?6:/[gprs]/.test(b)?Math.max(1,Math.min(21,m)):Math.max(0,Math.min(20,m)),M.toString=function(){return t+""},M}return{format:f,formatPrefix:function(t,e){var n=f(((t=ir(t)).type="f",t)),r=3*Math.max(-8,Math.min(8,Math.floor(sr(e)/3))),i=Math.pow(10,-r),o=gr[8+r/3];return function(t){return n(i*t)+o}}}}({thousands:",",grouping:[3],currency:["$",""]}),hr=fr.format,dr=fr.formatPrefix;const wr=yr(br("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725"));function xr(t,e,n){this.k=t,this.x=e,this.y=n}function _r(t){return Math.floor(Math.random()*t)}function Mr(t,e,...n){let r=Array(t);for(let i=0;it.map((t=>t*e))))}function jr(t,e){for(let n=0;nXr(t,e,-1,.05,.01),local:(t,e)=>Xr(t,e,0,.01,.5),pca:(t,e)=>Xr(t,e,1,0,.5),outlier:(t,e)=>Xr(t,e,2,0,5),push:(t,e)=>Lr(t,e,.5,.01,.5),pull:(t,e)=>Lr(t,e,.5,.01,-.2)};const{normal:Hr}=t;let Yr='~\n
~\n ~\n\n
~\n ~\n
~\n
~\n
~\n \n
\n \n
\n \n
\n \n \n \n \n \n \n \n
Brush size
Zoom
Damping
Heat
Label strength
Guide strength
\n
~\n
~\n\n
~\n ~\n \n ~\n \n ~\n \n
~\n Guide\n ~ \n
~\n \n
~\n \n
~\n \n
~\n
~\n
~\n'.replace(/~\s+/g,"");class Wr extends EventTarget{constructor(t,e,n){super(),this.width=1,this.height=1,this.size=1,this.fullscreen=!1,this.originalWidth=1,this.originalHeight=1,this.pointSize=1,this.center=[],this.scale=[],this.X=[[],[]],this.n=0,this.m=0,this.colnames=[],this.permutor=[],this.unpermutor=[],this.rownames=[],this.group=[],this.levels=[],this.levelColors=[],this.lineFrom=[],this.lineTo=[],this.lineColors=[],this.fills=[],this.filter=null,this.selection=null,this.selectionChanged=!1,this.axes=[],this.labelData=[],this.proj=[[],[]],this.vel=[[],[]],this.zoom=1,this.xScaleUnit=vr(),this.yScaleUnit=vr(),this.xScale=vr(),this.yScale=vr(),this.xScaleClamped=vr(),this.yScaleClamped=vr(),this.haveData=!1,this.playing=!0,this.frameScheduled=!1,this.lastTime=0,this.mouseInCheckbox=!1,this.dragging=!1,this.fps=[],this.computeMessage="",this.mousing=!1,this.mouseDown=!1,this.mouseWentDown=!1,this.mouseShiftKey=!1,this.mouseX=0,this.mouseY=0,this.rightMouseDown=!1,this.rightMouseWentDown=!1,this.tugging=!1,this.tugX=0,this.tugY=0,this.tugPoints=[],this.xy=[[],[]],this.fillsFrame=[],this.pointActive=[],this.container=t,this.shadowDiv=document.createElement("div"),this.container.appendChild(this.shadowDiv),this.shadowRoot=this.shadowDiv.attachShadow({mode:"open"}),this.shadowRoot.innerHTML=Yr,this.shadowChild=this.shadowRoot.firstChild,this.canvas=this.get("canvas"),this.overlay=this.get("overlay"),this.container.langevitour=this,this.resize(e,n);let r=this.get("plotDiv");r.addEventListener("mouseover",(t=>{this.mousing=!0,this.scheduleFrameIfNeeded()})),r.addEventListener("mouseout",(t=>{this.mousing=!1,this.mouseDown=!1,this.rightMouseDown=!1,this.scheduleFrameIfNeeded()}));let i=t=>([this.mouseX,this.mouseY]=Br(t,this.canvas),t.target.classList.contains("overlay")?(this.mouseDown=1==t.buttons&&!t.ctrlKey,this.rightMouseDown=2==t.buttons||1==t.buttons&&t.ctrlKey,this.scheduleFrameIfNeeded(),!0):(this.mouseDown=!1,this.rightMouseDown=!1,!1));r.addEventListener("mousemove",(t=>{i(t)})),r.addEventListener("mousedown",(t=>{if(!i(t))return;let e=this.get("infoBox");"visible"!=e.style.visibility?(this.mouseDown&&(this.mouseWentDown=!0,this.mouseShiftKey=t.shiftKey),this.rightMouseDown&&(this.rightMouseWentDown=!0),this.scheduleFrameIfNeeded()):e.style.visibility="hidden"})),r.addEventListener("mouseup",(t=>{this.mouseDown=!1,this.rightMouseDown=!1,this.scheduleFrameIfNeeded()})),null==this.container.requestFullscreen&&(this.get("fullscreenButton").style.display="none"),this.get("fullscreenButton").addEventListener("click",(()=>{document.fullscreenElement?document.fullscreenElement===this.shadowDiv&&document.exitFullscreen&&document.exitFullscreen():this.shadowDiv.requestFullscreen()}));let o=()=>{if(!this.fullscreen)return;let t=this.shadowDiv,e=window.innerWidth,n=window.innerHeight,r=Math.max(0,e-n)/2;t.style.paddingLeft=r+"px",this.width=e-r,this.height=n,this.configure()};this.shadowDiv.addEventListener("fullscreenchange",(()=>{let t=this.shadowDiv;document.fullscreenElement===t?(this.fullscreen||(this.fullscreen=!0,this.originalWidth=this.width,this.originalHeight=this.height,window.addEventListener("resize",o)),o()):this.fullscreen&&(this.fullscreen=!1,t.style.paddingLeft="0px",this.width=this.originalWidth,this.height=this.originalHeight,window.removeEventListener("resize",o),this.configure())})),this.get("infoButton").addEventListener("click",(()=>{let t=this.get("infoBox");"visible"!=t.style.visibility&&this.haveData?(t.style.visibility="visible",this.get("infoBoxProj").style.display="none",this.get("infoBoxState").style.display="none",this.get("infoBoxInfo").innerHTML=`

${this.X.length.toLocaleString("en-US")} points.

`):t.style.visibility="hidden"})),this.get("infoBoxProjButton").addEventListener("click",(()=>{let t=this.getInput("infoBoxProj");if(Fr(t),"none"!=t.style.display){let t="projection <- cbind(\n c(";t+=this.proj.map((t=>t.map(((t,e)=>(t/this.scale[e]).toFixed(Math.ceil(Math.log10(Math.max(0,this.scale[e]))+4)))).join(","))).join("),\n c("),t+="))\nprojected <- as.matrix(X) %*% projection",this.getInput("infoBoxProj").value=t}})),this.get("infoBoxStateButton").addEventListener("click",(()=>{let t=this.getInput("infoBoxState");Fr(t),"none"!=t.style.display&&(t.value=JSON.stringify(this.getState(),null,4))})),this.get("playButton").addEventListener("click",(()=>this.setState({playing:!this.playing})))}get(t){return this.shadowChild.getElementsByClassName(t)[0]}getInput(t){return this.get(t)}getString(t){return this.getInput(t).value}getNumber(t){return Number(this.getInput(t).value)}getChecked(t){return this.getInput(t).checked}emitChangeFilter(){setTimeout((()=>this.dispatchEvent(new Event("changeFilter"))),0)}emitChangeSelectionIfNeeded(){this.selectionChanged&&(this.selectionChanged=!1,setTimeout((()=>this.dispatchEvent(new Event("changeSelection"))),0))}renderValue(t){if(!t)return this.haveData=!1,void this.configure();this.haveData=!0,this.n=t.X.length,this.m=t.X[0].length,this.pointSize=null!=t.pointSize?t.pointSize:1;let e=t.axisColors||[];this.center=t.center||Array(this.m).fill(0),this.scale=t.scale||Array(this.m).fill(1),this.permutor=function(t){let e=Array(t).fill(0).map(((t,e)=>e));for(let t=e.length-1;t>0;t--){const n=_r(t+1);[e[t],e[n]]=[e[n],e[t]]}return e}(this.n),this.unpermutor=Array(this.n);for(let t=0;tt.X[e])),this.X=this.X.map((t=>t.map(((t,e)=>(t-this.center[e])/this.scale[e])))),t.rownames&&0!=t.rownames.length){let e=t.rownames;this.rownames=this.permutor.map((t=>e[t]))}else this.rownames=[];if(this.colnames=t.colnames,this.lineFrom=(t.lineFrom||[]).map((t=>this.unpermutor[t])),this.lineTo=(t.lineTo||[]).map((t=>this.unpermutor[t])),this.lineColors=t.lineColors||[],this.lineFrom.length&&!this.lineColors.length&&(this.lineColors=this.lineFrom.map((()=>"#00000088"))),this.axes=[],t.extraAxes&&t.extraAxesNames)for(let n=0;nt[n])),i=Nr(r,this.center),o=r.map(((t,e)=>t*this.scale[e])),a=Math.sqrt(Nr(o,o)),s=qr(o,1/a);this.axes.push({name:t.extraAxesNames[n],unit:s,scale:a,center:i,color:e[n+this.m],proj:[]})}for(let n=0;nNr(e,this.axes[t].unit)));this.levels=t.levels,this.group=this.permutor.map((e=>t.group[e]));let n=this.levels.length;this.levelColors=(t.levelColors||[]).slice();for(let t=this.levelColors.length;t1)for(let t=0;t\n \n \n':'\n \n',!this.haveData){this.get("messageArea").innerText="",this.overlay.style.opacity="0";let t=this.canvas.getContext("2d");return t.scale(1,1),void t.clearRect(0,0,this.canvas.width,this.canvas.height)}this.configureScales();let e=wn(this.overlay);e.selectAll("*").remove(),this.mouseInCheckbox=!1;let n=this,r=e.selectAll("div").data(this.labelData).join((t=>{let e=t.append("div").classed("labelDiv",!0);return e.append("input").attr("type","checkbox").property("checked",(t=>t.active)).on("change",(function(t,e){e.active=this.checked,n.scheduleFrameIfNeeded(),n.emitChangeFilter()})).on("mouseover",(()=>{this.mouseInCheckbox=!0})).on("mouseout",(()=>{this.mouseInCheckbox=!1})),e.append("span"),e}));function i(){let t=n.xScaleUnit.invert(n.width);for(let e of n.labelData)e.x=Math.max(-1,Math.min(t,e.x)),e.y=Math.max(-1,Math.min(1,e.y));r.style("left",(t=>n.xScaleUnit(t.x)-t.halfWidth+"px")).style("top",(t=>n.yScaleUnit(t.y)-t.halfHeight+"px")).style("background",(t=>t.selected?"#aaa":"#ddd"))}r.style("cursor","grab").on("mouseover",((t,e)=>{e.selected+=1,i()})).on("mouseout",((t,e)=>{e.selected=Math.max(0,e.selected-1),i()})),r.select("span").text((t=>t.label)).style("color",(t=>t.color)),r.each((function(t){t.halfWidth=this.offsetWidth/2,t.halfHeight=this.offsetHeight/2})),function(){var t,e,n,r,i=qn,o=En,a=Cn,s=In,u={},l=xt("start","drag","end"),c=0,f=0;function h(t){t.on("mousedown.drag",d).filter(s).on("touchstart.drag",m).on("touchmove.drag",v,_n).on("touchend.drag touchcancel.drag",b).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function d(a,s){if(!r&&i.call(this,a,s)){var u=y(this,o.call(this,a,s),a,s,"mouse");u&&(wn(a.view).on("mousemove.drag",p,Mn).on("mouseup.drag",g,Mn),function(t){var e=t.document.documentElement,n=wn(t).on("dragstart.drag",An,Mn);"onselectstart"in e?n.on("selectstart.drag",An,Mn):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}(a.view),kn(a),n=!1,t=a.clientX,e=a.clientY,u("start",a))}}function p(r){if(An(r),!n){var i=r.clientX-t,o=r.clientY-e;n=i*i+o*o>f}u.mouse("drag",r)}function g(t){wn(t.view).on("mousemove.drag mouseup.drag",null),function(t,e){var n=t.document.documentElement,r=wn(t).on("dragstart.drag",null);e&&(r.on("click.drag",An,Mn),setTimeout((function(){r.on("click.drag",null)}),0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}(t.view,n),An(t),u.mouse("end",t)}function m(t,e){if(i.call(this,t,e)){var n,r,a=t.changedTouches,s=o.call(this,t,e),u=a.length;for(n=0;nthis.selection[t])):t.selection=null,this.filter?t.filter=this.unpermutor.map((t=>this.filter[t])):t.filter=null,t}setState(t){let e=!1,n=!1;if("string"==typeof t&&(t=JSON.parse(t)),t){if($r(t,"playing")&&(!this.playing&&t.playing&&(this.lastTime=0),this.playing=t.playing),$r(t,"axesOn")&&(this.getInput("axesCheckbox").checked=t.axesOn),$r(t,"heatOn")&&(this.getInput("heatCheckbox").checked=t.heatOn),$r(t,"pointRepulsionType")&&(this.getInput("guideSelect").value=t.pointRepulsionType),$r(t,"guideType")&&(this.getInput("guideSelect").value=t.guideType),$r(t,"labelAttractionOn")&&(this.getInput("labelCheckbox").checked=t.labelAttractionOn),$r(t,"damping")&&(this.getInput("dampInput").value=t.damping),$r(t,"heat")&&(this.getInput("heatInput").value=t.heat),$r(t,"pointRepulsion")&&(this.getInput("guideInput").value=t.pointRepulsion),$r(t,"guide")&&(this.getInput("guideInput").value=t.guide),$r(t,"labelAttraction")&&(this.getInput("labelInput").value=t.labelAttraction),$r(t,"zoom")&&(this.getInput("zoomInput").value=t.zoom),$r(t,"brush")&&(this.getInput("brushInput").value=t.brush),$r(t,"labelInactive")){for(let e of this.labelData)e.active=!t.labelInactive.includes(e.label);e=!0}if($r(t,"labelPos"))for(let e of this.labelData)$r(t.labelPos,e.label)?(e.x=t.labelPos[e.label][0],e.y=t.labelPos[e.label][1]):e.x=1;$r(t,"projection")&&(this.proj=Array.from(t.projection.map((t=>Array.from(t))))),$r(t,"selection")&&(null===t.selection?this.selection=null:this.selection=this.permutor.map((e=>t.selection[e])),this.selectionChanged=!0,n=!0),$r(t,"filter")&&(null===t.filter?this.filter=null:this.filter=this.permutor.map((e=>t.filter[e]))),this.configure(),e&&this.emitChangeFilter(),n&&this.emitChangeSelectionIfNeeded()}}scheduleFrameIfNeeded(){!this.frameScheduled&&this.haveData&&(window.requestAnimationFrame(this.doFrame.bind(this)),this.frameScheduled=!0)}doFrame(t){if(this.frameScheduled=!1,!this.haveData)return;if(!function(t){let e=t;for(;;){let t=window.getComputedStyle(e);if("0"===t.opacity||"none"===t.display||"visible"!==t.visibility)return!1;if(!e.parentElement)break;e=e.parentElement}let n=t.getBoundingClientRect();return n.top=0&&n.left=0}(this.container))return this.lastTime=0,void window.setTimeout(this.scheduleFrameIfNeeded.bind(this),100);t/=1e3;let e=0;(this.playing||this.tugging)&&0!=this.lastTime&&(e=t-this.lastTime,this.fps.push(Math.round(1/e)),this.fps.length>100&&this.fps.shift()),this.lastTime=t,this.compute(e),this.configureScales();let n=null,r=null,i=this.labelData.filter((t=>t.selected));i.length&&("axis"==i[0].type?n=i[0].index:r=i[0].index);let o=this.getChecked("axesCheckbox"),a=Array(this.levels.length).fill(!0);for(let t of this.labelData)"level"==t.type&&(a[t.index]=t.active);let s=.05*this.size*Math.pow(10,this.getNumber("brushInput")),u=[];if(this.mouseXMath.pow(s,2)||u.push({index:t,d2:e})}u.sort(((t,e)=>t.d2-e.d2))}if(this.rightMouseWentDown&&(this.tugPoints=u.map((t=>t.index)),this.rightMouseWentDown=!1),this.tugging=this.rightMouseDown&&this.tugPoints.length>0,this.tugging&&(this.tugX=this.xScale.invert(this.mouseX),this.tugY=this.yScale.invert(this.mouseY)),this.mouseDown||this.mouseWentDown){if(this.mouseWentDown&&!this.mouseShiftKey&&(this.selection=null,this.selectionChanged=!0),u.length){this.selection||(this.selection=Array(this.n).fill(!1),this.selectionChanged=!0);for(let t=0;t=0;t--){let e=u[t].index,n=this.xScaleClamped(this.xy[0][e]),r=this.yScaleClamped(this.xy[1][e]);c.strokeText(this.rownames[e],n,r),c.fillText(this.rownames[e],n,r)}}if(c.restore(),c.textAlign="left",c.textBaseline="middle",c.font="15px sans-serif",!this.mousing)for(let t=0,e=0;t=1&&(o/=d,l/=d),f[0]=qr(e,(o-n)/i*t),f[1]=qr(e,(l-r)/i*t),a=!1,u=!1,s="none"}if(a){let t=1-d*d,e=Mr(h.length,Mr,this.m,Hr.sample,0,Math.sqrt(r*t));e=zr(e,h),Dr(f,e)}if("none"!=s){let t=this.X.filter(((t,e)=>this.pointActive[e]));if(t.length){let e=Or[s](h,t);jr(e,-i),Dr(f,e)}}if(u)for(let t of this.labelData){let e=t.x,n=t.y;if(e<=-1||n<=-1||e>=1||n>=1)continue;if("level"==t.type&&!l[t.index])continue;let r=4*(e*e+n*n);f[0]=Sr(f[0],qr(t.vec,e*r*o)),f[1]=Sr(f[1],qr(t.vec,n*r*o))}let p=[];for(let t of this.labelData)"axis"!=t.type||t.active||p.push(this.axes[t.index].unit);let g=p.length>=this.m-1,m=!1;if(p.length&&!g){let t=Math.min(2,1/c),{u:n,v:r,q:i}=(0,e.SVD)(Tr(p)),o=Math.max(...i);n=Tr(n);let a=Er(2,this.m);for(let e=0;e{var t={162:function(t){var e;t.exports=(e=function(t,e){var n=Array.prototype.concat,r=Array.prototype.slice,i=Object.prototype.toString;function o(e,n){var r=e>n?e:n;return t.pow(10,17-~~(t.log(r>0?r:-r)*t.LOG10E))}var a=Array.isArray||function(t){return"[object Array]"===i.call(t)};function s(t){return"[object Function]"===i.call(t)}function u(t){return"number"==typeof t&&t-t==0}function l(){return new l._init(arguments)}function f(){return 0}function c(){return 1}function h(t,e){return t===e?1:0}l.fn=l.prototype,l._init=function(t){if(a(t[0]))if(a(t[0][0])){s(t[1])&&(t[0]=l.map(t[0],t[1]));for(var e=0;e=0;e--,r++)n[r]=[t[r][e]];return n},l.transpose=function(t){var e,n,r,i,o,s=[];for(a(t[0])||(t=[t]),n=t.length,r=t[0].length,o=0;o0&&(s[r][0]=t[r][0]),u=1;un&&r>0)return[];if(r>0)for(i=t;in;i+=r)o.push(i);return o},l.slice=function(){function t(t,n,r,i){var o,a=[],s=t.length;if(n===e&&r===e&&i===e)return l.copy(t);if(i=i||1,(n=(n=n||0)>=0?n:s+n)===(r=(r=r||t.length)>=0?r:s+r)||0===i)return[];if(nr&&i>0)return[];if(i>0)for(o=n;or;o+=i)a.push(t[o]);return a}return function(e,n){var r,i;return u((n=n||{}).row)?u(n.col)?e[n.row][n.col]:t(l.rowa(e,n.row),(r=n.col||{}).start,r.end,r.step):u(n.col)?t(l.cola(e,n.col),(i=n.row||{}).start,i.end,i.step):(i=n.row||{},r=n.col||{},t(e,i.start,i.end,i.step).map((function(e){return t(e,r.start,r.end,r.step)})))}}(),l.sliceAssign=function(n,r,i){var o,a;if(u(r.row)){if(u(r.col))return n[r.row][r.col]=i;r.col=r.col||{},r.col.start=r.col.start||0,r.col.end=r.col.end||n[0].length,r.col.step=r.col.step||1,o=l.arange(r.col.start,t.min(n.length,r.col.end),r.col.step);var s=r.row;return o.forEach((function(t,e){n[s][t]=i[e]})),n}if(u(r.col)){r.row=r.row||{},r.row.start=r.row.start||0,r.row.end=r.row.end||n.length,r.row.step=r.row.step||1,a=l.arange(r.row.start,t.min(n[0].length,r.row.end),r.row.step);var f=r.col;return a.forEach((function(t,e){n[t][f]=i[e]})),n}return i[0].length===e&&(i=[i]),r.row.start=r.row.start||0,r.row.end=r.row.end||n.length,r.row.step=r.row.step||1,r.col.start=r.col.start||0,r.col.end=r.col.end||n[0].length,r.col.step=r.col.step||1,a=l.arange(r.row.start,t.min(n.length,r.row.end),r.row.step),o=l.arange(r.col.start,t.min(n[0].length,r.col.end),r.col.step),a.forEach((function(t,e){o.forEach((function(r,o){n[t][r]=i[e][o]}))})),n},l.diagonal=function(t){var e=l.zeros(t.length,t.length);return t.forEach((function(t,n){e[n][n]=t})),e},l.copy=function(t){return t.map((function(t){return u(t)?t:t.map((function(t){return t}))}))};var d=l.prototype;return d.length=0,d.push=Array.prototype.push,d.sort=Array.prototype.sort,d.splice=Array.prototype.splice,d.slice=Array.prototype.slice,d.toArray=function(){return this.length>1?r.call(this):r.call(this)[0]},d.map=function(t,e){return l(l.map(this,t,e))},d.cumreduce=function(t,e){return l(l.cumreduce(this,t,e))},d.alter=function(t){return l.alter(this,t),this},function(t){for(var e=0;e=0;)e+=t[n];return e},t.sumsqrd=function(t){for(var e=0,n=t.length;--n>=0;)e+=t[n]*t[n];return e},t.sumsqerr=function(e){for(var n,r=t.mean(e),i=0,o=e.length;--o>=0;)i+=(n=e[o]-r)*n;return i},t.sumrow=function(t){for(var e=0,n=t.length;--n>=0;)e+=t[n];return e},t.product=function(t){for(var e=1,n=t.length;--n>=0;)e*=t[n];return e},t.min=function(t){for(var e=t[0],n=0;++ne&&(e=t[n]);return e},t.unique=function(t){for(var e={},n=[],r=0;ra?(u=[i[e]],a=o,s=0):o===a&&(u.push(i[e]),s++),o=1);return 0===s?u[0]:u},t.range=function(e){return t.max(e)-t.min(e)},t.variance=function(e,n){return t.sumsqerr(e)/(e.length-(n?1:0))},t.pooledvariance=function(e){return e.reduce((function(e,n){return e+t.sumsqerr(n)}),0)/(e.reduce((function(t,e){return t+e.length}),0)-e.length)},t.deviation=function(e){for(var n=t.mean(e),r=e.length,i=new Array(r),o=0;o=0;o--)i.push(e.abs(n[o]-r));return t.mean(i)},t.meddev=function(n){for(var r=t.median(n),i=[],o=n.length-1;o>=0;o--)i.push(e.abs(n[o]-r));return t.median(i)},t.coeffvar=function(e){return t.stdev(e)/t.mean(e)},t.quartiles=function(t){var n=t.length,i=t.slice().sort(r);return[i[e.round(n/4)-1],i[e.round(n/2)-1],i[e.round(3*n/4)-1]]},t.quantiles=function(t,n,o,a){var s,u,l,f,c,h=t.slice().sort(r),d=[n.length],p=t.length;for(void 0===o&&(o=3/8),void 0===a&&(a=3/8),s=0;s1){for(u=!0===r?this:this.transpose();s1){for("sumrow"!==e&&(u=!0===r?this:this.transpose());s1){for(s=s.transpose();a=0;s--)a*=r,a+=l[s];if(o=a/n+.5*e.log(i)+(n-.5)*e.log(n)-n,t<=7)for(s=1;s<=u;s++)o-=e.log(n-1),n-=1;return o},t.gammafn=function(t){var n,r,i,o,a=[-1.716185138865495,24.76565080557592,-379.80425647094563,629.3311553128184,866.9662027904133,-31451.272968848367,-36144.413418691176,66456.14382024054],s=[-30.8402300119739,315.35062697960416,-1015.1563674902192,-3107.771671572311,22538.11842098015,4755.846277527881,-134659.9598649693,-115132.2596755535],u=!1,l=0,f=0,c=0,h=t;if(t>171.6243769536076)return 1/0;if(h<=0){if(!(o=h%1+36e-17))return 1/0;u=(1&h?-1:1)*e.PI/e.sin(e.PI*o),h=1-h}for(i=h,r=h<1?h++:(h-=l=(0|h)-1)-1,n=0;n<8;++n)c=(c+a[n])*r,f=f*r+s[n];if(o=c/f+1,ih)for(n=0;n=1?n:1/n)+.4*n+17);if(r<0||n<=0)return NaN;if(r170||r>170?e.exp(t.combinationln(n,r)):t.factorial(n)/t.factorial(r)/t.factorial(n-r)},t.combinationln=function(e,n){return t.factorialln(e)-t.factorialln(n)-t.factorialln(e-n)},t.permutation=function(e,n){return t.factorial(e)/t.factorial(e-n)},t.betafn=function(n,r){if(!(n<=0||r<=0))return n+r>170?e.exp(t.betaln(n,r)):t.gammafn(n)*t.gammafn(r)/t.gammafn(n+r)},t.betaln=function(e,n){return t.gammaln(e)+t.gammaln(n)-t.gammaln(e+n)},t.betacf=function(t,n,r){var i,o,a,s,u=1e-30,l=1,f=n+r,c=n+1,h=n-1,d=1,p=1-f*t/c;for(e.abs(p)=1)return e.max(100,r+100*e.sqrt(r));if(n<=0)return 0;for(r>1?(u=e.log(c),l=e.exp(c*(u-1)-h),s=n<.5?n:1-n,i=(2.30753+.27061*(o=e.sqrt(-2*e.log(s))))/(1+o*(.99229+.04481*o))-o,n<.5&&(i=-i),i=e.max(.001,r*e.pow(1-1/(9*r)-i/(3*e.sqrt(r)),3))):i=n<(o=1-r*(.253+.12*r))?e.pow(n/o,1/r):1-e.log(1-(n-o)/(1-o));f<12;f++){if(i<=0)return 0;if((i-=o=(a=(t.lowRegGamma(r,i)-n)/(o=r>1?l*e.exp(-(i-c)+c*(e.log(i)-u)):e.exp(-i+c*e.log(i)-h)))/(1-.5*e.min(1,a*((r-1)/i-1))))<=0&&(i=.5*(i+o)),e.abs(o)<1e-8*i)break}return i},t.erf=function(t){var n,r,i,o,a=[-1.3026537197817094,.6419697923564902,.019476473204185836,-.00956151478680863,-.000946595344482036,.000366839497852761,42523324806907e-18,-20278578112534e-18,-1624290004647e-18,130365583558e-17,1.5626441722e-8,-8.5238095915e-8,6.529054439e-9,5.059343495e-9,-9.91364156e-10,-2.27365122e-10,96467911e-18,2394038e-18,-6886027e-18,894487e-18,313092e-18,-112708e-18,381e-18,7106e-18,-1523e-18,-94e-18,121e-18,-28e-18],s=a.length-1,u=!1,l=0,f=0;for(t<0&&(t=-t,u=!0),r=4*(n=2/(2+t))-2;s>0;s--)i=l,l=r*l-f+a[s],f=i;return o=n*e.exp(-t*t+.5*(a[0]+r*l)-f),u?o-1:1-o},t.erfc=function(e){return 1-t.erf(e)},t.erfcinv=function(n){var r,i,o,a,s=0;if(n>=2)return-100;if(n<=0)return 100;for(a=n<1?n:2-n,r=-.70711*((2.30753+.27061*(o=e.sqrt(-2*e.log(a/2))))/(1+o*(.99229+.04481*o))-o);s<2;s++)r+=(i=t.erfc(r)-a)/(1.1283791670955126*e.exp(-r*r)-r*i);return n<1?r:-r},t.ibetainv=function(n,r,i){var o,a,s,u,l,f,c,h,d,p,g=r-1,m=i-1,v=0;if(n<=0)return 0;if(n>=1)return 1;for(r>=1&&i>=1?(s=n<.5?n:1-n,f=(2.30753+.27061*(u=e.sqrt(-2*e.log(s))))/(1+u*(.99229+.04481*u))-u,n<.5&&(f=-f),c=(f*f-3)/6,h=2/(1/(2*r-1)+1/(2*i-1)),d=f*e.sqrt(c+h)/h-(1/(2*i-1)-1/(2*r-1))*(c+5/6-2/(3*h)),f=r/(r+i*e.exp(2*d))):(o=e.log(r/(r+i)),a=e.log(i/(r+i)),f=n<(u=e.exp(r*o)/r)/(d=u+(l=e.exp(i*a)/i))?e.pow(r*d*n,1/r):1-e.pow(i*d*(1-n),1/i)),p=-t.gammaln(r)-t.gammaln(i)+t.gammaln(r+i);v<10;v++){if(0===f||1===f)return f;if((f-=u=(l=(t.ibeta(f,r,i)-n)/(u=e.exp(g*e.log(f)+m*e.log(1-f)+p)))/(1-.5*e.min(1,l*(g/f-m/(1-f)))))<=0&&(f=.5*(f+u)),f>=1&&(f=.5*(f+u+1)),e.abs(u)<1e-8*f&&v>0)break}return f},t.ibeta=function(n,r,i){var o=0===n||1===n?0:e.exp(t.gammaln(r+i)-t.gammaln(r)-t.gammaln(i)+r*e.log(n)+i*e.log(1-n));return!(n<0||n>1)&&(n<(r+1)/(r+i+2)?o*t.betacf(n,r,i)/r:1-o*t.betacf(1-n,i,r)/i)},t.randn=function(n,r){var i,o,a,s,u;if(r||(r=n),n)return t.create(n,r,(function(){return t.randn()}));do{i=t._random_fn(),o=1.7156*(t._random_fn()-.5),u=(a=i-.449871)*a+(s=e.abs(o)+.386595)*(.196*s-.25472*a)}while(u>.27597&&(u>.27846||o*o>-4*e.log(i)*i*i));return o/i},t.randg=function(n,r,i){var o,a,s,u,l,f,c=n;if(i||(i=r),n||(n=1),r)return(f=t.zeros(r,i)).alter((function(){return t.randg(n)})),f;n<1&&(n+=1),o=n-1/3,a=1/e.sqrt(9*o);do{do{u=1+a*(l=t.randn())}while(u<=0);u*=u*u,s=t._random_fn()}while(s>1-.331*e.pow(l,4)&&e.log(s)>.5*l*l+o*(1-u+e.log(u)));if(n==c)return o*u;do{s=t._random_fn()}while(0===s);return e.pow(s,1/c)*o*u},function(e){for(var n=0;ni;)c=u,s=l+(o=-(n+f)*(n+r+f)*t/(n+2*f)/(n+2*f+1))*s,u=(a=u+o*a)+(o=(f+=1)*(r-f)*t/(n+2*f-1)/(n+2*f))*u,a/=l=s+o*l,s/=l,u/=l,l=1;return u/n}function r(n,r,i){var o=[.9815606342467192,.9041172563704749,.7699026741943047,.5873179542866175,.3678314989981802,.1252334085114689],a=[.04717533638651183,.10693932599531843,.16007832854334622,.20316742672306592,.2334925365383548,.24914704581340277],s=.5*n;if(s>=8)return 1;var u,l=2*t.normal.cdf(s,0,1,1,0)-1;l=l>=e.exp(-50/i)?e.pow(l,i):0;for(var f=s,c=(8-s)/(u=n>3?2:3),h=f+c,d=0,p=i-1,g=1;g<=u;g++){for(var m=0,v=.5*(h+f),b=.5*(h-f),y=1;y<=12;y++){var w,x=v+b*(660)break;var M=2*t.normal.cdf(x,0,1,1,0)*.5-2*t.normal.cdf(x,n,1,1,0)*.5;M>=e.exp(-30/p)&&(m+=M=a[w-1]*e.exp(-.5*_)*e.pow(M,p))}d+=m*=2*b*i/e.sqrt(2*e.PI),f=h,h+=c}return(l+=d)<=e.exp(-30/r)?0:(l=e.pow(l,r))>=1?1:l}!function(e){for(var n=0;n1||n<0?0:1==r&&1==i?1:r<512&&i<512?e.pow(n,r-1)*e.pow(1-n,i-1)/t.betafn(r,i):e.exp((r-1)*e.log(n)+(i-1)*e.log(1-n)-t.betaln(r,i))},cdf:function(e,n,r){return e>1||e<0?1*(e>1):t.ibeta(e,n,r)},inv:function(e,n,r){return t.ibetainv(e,n,r)},mean:function(t,e){return t/(t+e)},median:function(e,n){return t.ibetainv(.5,e,n)},mode:function(t,e){return(t-1)/(t+e-2)},sample:function(e,n){var r=t.randg(e);return r/(r+t.randg(n))},variance:function(t,n){return t*n/(e.pow(t+n,2)*(t+n+1))}}),t.extend(t.centralF,{pdf:function(n,r,i){var o;return n<0?0:r<=2?0===n&&r<2?1/0:0===n&&2===r?1:1/t.betafn(r/2,i/2)*e.pow(r/i,r/2)*e.pow(n,r/2-1)*e.pow(1+r/i*n,-(r+i)/2):(o=r*n/(i+n*r),r*(i/(i+n*r))/2*t.binomial.pdf((r-2)/2,(r+i-2)/2,o))},cdf:function(e,n,r){return e<0?0:t.ibeta(n*e/(n*e+r),n/2,r/2)},inv:function(e,n,r){return r/(n*(1/t.ibetainv(e,n/2,r/2)-1))},mean:function(t,e){return e>2?e/(e-2):void 0},mode:function(t,e){return t>2?e*(t-2)/(t*(e+2)):void 0},sample:function(e,n){return 2*t.randg(e/2)/e/(2*t.randg(n/2)/n)},variance:function(t,e){if(!(e<=4))return 2*e*e*(t+e-2)/(t*(e-2)*(e-2)*(e-4))}}),t.extend(t.cauchy,{pdf:function(t,n,r){return r<0?0:r/(e.pow(t-n,2)+e.pow(r,2))/e.PI},cdf:function(t,n,r){return e.atan((t-n)/r)/e.PI+.5},inv:function(t,n,r){return n+r*e.tan(e.PI*(t-.5))},median:function(t){return t},mode:function(t){return t},sample:function(n,r){return t.randn()*e.sqrt(1/(2*t.randg(.5)))*r+n}}),t.extend(t.chisquare,{pdf:function(n,r){return n<0?0:0===n&&2===r?.5:e.exp((r/2-1)*e.log(n)-n/2-r/2*e.log(2)-t.gammaln(r/2))},cdf:function(e,n){return e<0?0:t.lowRegGamma(n/2,e/2)},inv:function(e,n){return 2*t.gammapinv(e,.5*n)},mean:function(t){return t},median:function(t){return t*e.pow(1-2/(9*t),3)},mode:function(t){return t-2>0?t-2:0},sample:function(e){return 2*t.randg(e/2)},variance:function(t){return 2*t}}),t.extend(t.exponential,{pdf:function(t,n){return t<0?0:n*e.exp(-n*t)},cdf:function(t,n){return t<0?0:1-e.exp(-n*t)},inv:function(t,n){return-e.log(1-t)/n},mean:function(t){return 1/t},median:function(t){return 1/t*e.log(2)},mode:function(){return 0},sample:function(n){return-1/n*e.log(t._random_fn())},variance:function(t){return e.pow(t,-2)}}),t.extend(t.gamma,{pdf:function(n,r,i){return n<0?0:0===n&&1===r?1/i:e.exp((r-1)*e.log(n)-n/i-t.gammaln(r)-r*e.log(i))},cdf:function(e,n,r){return e<0?0:t.lowRegGamma(n,e/r)},inv:function(e,n,r){return t.gammapinv(e,n)*r},mean:function(t,e){return t*e},mode:function(t,e){if(t>1)return(t-1)*e},sample:function(e,n){return t.randg(e)*n},variance:function(t,e){return t*e*e}}),t.extend(t.invgamma,{pdf:function(n,r,i){return n<=0?0:e.exp(-(r+1)*e.log(n)-i/n-t.gammaln(r)+r*e.log(i))},cdf:function(e,n,r){return e<=0?0:1-t.lowRegGamma(n,r/e)},inv:function(e,n,r){return r/t.gammapinv(1-e,n)},mean:function(t,e){return t>1?e/(t-1):void 0},mode:function(t,e){return e/(t+1)},sample:function(e,n){return n/t.randg(e)},variance:function(t,e){if(!(t<=2))return e*e/((t-1)*(t-1)*(t-2))}}),t.extend(t.kumaraswamy,{pdf:function(t,n,r){return 0===t&&1===n?r:1===t&&1===r?n:e.exp(e.log(n)+e.log(r)+(n-1)*e.log(t)+(r-1)*e.log(1-e.pow(t,n)))},cdf:function(t,n,r){return t<0?0:t>1?1:1-e.pow(1-e.pow(t,n),r)},inv:function(t,n,r){return e.pow(1-e.pow(1-t,1/r),1/n)},mean:function(e,n){return n*t.gammafn(1+1/e)*t.gammafn(n)/t.gammafn(1+1/e+n)},median:function(t,n){return e.pow(1-e.pow(2,-1/n),1/t)},mode:function(t,n){if(t>=1&&n>=1&&1!==t&&1!==n)return e.pow((t-1)/(t*n-1),1/t)},variance:function(){throw new Error("variance not yet implemented")}}),t.extend(t.lognormal,{pdf:function(t,n,r){return t<=0?0:e.exp(-e.log(t)-.5*e.log(2*e.PI)-e.log(r)-e.pow(e.log(t)-n,2)/(2*r*r))},cdf:function(n,r,i){return n<0?0:.5+.5*t.erf((e.log(n)-r)/e.sqrt(2*i*i))},inv:function(n,r,i){return e.exp(-1.4142135623730951*i*t.erfcinv(2*n)+r)},mean:function(t,n){return e.exp(t+n*n/2)},median:function(t){return e.exp(t)},mode:function(t,n){return e.exp(t-n*n)},sample:function(n,r){return e.exp(t.randn()*r+n)},variance:function(t,n){return(e.exp(n*n)-1)*e.exp(2*t+n*n)}}),t.extend(t.noncentralt,{pdf:function(n,r,i){return e.abs(i)<1e-14?t.studentt.pdf(n,r):e.abs(n)<1e-14?e.exp(t.gammaln((r+1)/2)-i*i/2-.5*e.log(e.PI*r)-t.gammaln(r/2)):r/n*(t.noncentralt.cdf(n*e.sqrt(1+2/r),r+2,i)-t.noncentralt.cdf(n,r,i))},cdf:function(n,r,i){var o=1e-14;if(e.abs(i)o||u>o;)l=u,c>0&&(h*=i*i/(2*c),d*=i*i/(2*(c+.5))),s+=.5*(u=h*t.beta.cdf(f,c+.5,r/2)+d*t.beta.cdf(f,c+1,r/2)),c++;return a?1-s:s}}),t.extend(t.normal,{pdf:function(t,n,r){return e.exp(-.5*e.log(2*e.PI)-e.log(r)-e.pow(t-n,2)/(2*r*r))},cdf:function(n,r,i){return.5*(1+t.erf((n-r)/e.sqrt(2*i*i)))},inv:function(e,n,r){return-1.4142135623730951*r*t.erfcinv(2*e)+n},mean:function(t){return t},median:function(t){return t},mode:function(t){return t},sample:function(e,n){return t.randn()*n+e},variance:function(t,e){return e*e}}),t.extend(t.pareto,{pdf:function(t,n,r){return t1e100?1e100:r,1/(e.sqrt(r)*t.betafn(.5,r/2))*e.pow(1+n*n/r,-(r+1)/2)},cdf:function(n,r){var i=r/2;return t.ibeta((n+e.sqrt(n*n+r))/(2*e.sqrt(n*n+r)),i,i)},inv:function(n,r){var i=t.ibetainv(2*e.min(n,1-n),.5*r,.5);return i=e.sqrt(r*(1-i)/i),n>.5?i:-i},mean:function(t){return t>1?0:void 0},median:function(){return 0},mode:function(){return 0},sample:function(n){return t.randn()*e.sqrt(n/(2*t.randg(n/2)))},variance:function(t){return t>2?t/(t-2):t>1?1/0:void 0}}),t.extend(t.weibull,{pdf:function(t,n,r){return t<0||n<0||r<0?0:r/n*e.pow(t/n,r-1)*e.exp(-e.pow(t/n,r))},cdf:function(t,n,r){return t<0?0:1-e.exp(-e.pow(t/n,r))},inv:function(t,n,r){return n*e.pow(-e.log(1-t),1/r)},mean:function(e,n){return e*t.gammafn(1+1/n)},median:function(t,n){return t*e.pow(e.log(2),1/n)},mode:function(t,n){return n<=1?0:t*e.pow((n-1)/n,1/n)},sample:function(n,r){return n*e.pow(-e.log(t._random_fn()),1/r)},variance:function(n,r){return n*n*t.gammafn(1+2/r)-e.pow(t.weibull.mean(n,r),2)}}),t.extend(t.uniform,{pdf:function(t,e,n){return tn?0:1/(n-e)},cdf:function(t,e,n){return t=i)return 1;if(o<0||o>1||i<=0)return NaN;var u=o,l=(r=e.floor(r))+1,f=i-r,c=l+f,h=e.exp(t.gammaln(c)-t.gammaln(f)-t.gammaln(l)+l*e.log(u)+f*e.log(1-u));return a=u<(l+1)/(c+2)?h*n(u,l,f,s):1-h*n(1-u,f,l,s),e.round(1/s*(1-a))/(1/s)}}),t.extend(t.negbin,{pdf:function(n,r,i){return n===n>>>0&&(n<0?0:t.combination(n+r-1,r-1)*e.pow(1-i,n)*e.pow(i,r))},cdf:function(e,n,r){var i=0,o=0;if(e<0)return 0;for(;o<=e;o++)i+=t.negbin.pdf(o,n,r);return i}}),t.extend(t.hypgeom,{pdf:function(n,r,i,o){if(n!=n|0)return!1;if(n<0||no||n>i)return 0;if(2*i>r)return 2*o>r?t.hypgeom.pdf(r-i-o+n,r,r-i,r-o):t.hypgeom.pdf(o-n,r,r-i,o);if(2*o>r)return t.hypgeom.pdf(i-n,r,i,r-o);if(i1&&s=o||n>=i)return 1;if(2*i>r)return 2*o>r?t.hypgeom.cdf(r-i-o+n,r,r-i,r-o):1-t.hypgeom.cdf(o-n-1,r,r-i,o);if(2*o>r)return 1-t.hypgeom.cdf(i-n-1,r,i,r-o);if(i1&&uo);return i-1},sampleLarge:function(n){var r,i,o,a,s,u,l,f,c,h,d=n;for(a=e.sqrt(d),s=e.log(d),u=.02483*(l=.931+2.53*a)-.059,f=1.1239+1.1328/(l-3.4),c=.9277-3.6224/(l-2);;){if(i=e.random()-.5,o=e.random(),h=.5-e.abs(i),r=e.floor((2*u/h+l)*i+d+.43),h>=.07&&o<=c)return r;if(!(r<0||h<.013&&o>h)&&e.log(o)+e.log(f)-e.log(u/(h*h)+l)<=r*s-d-t.loggam(r+1))return r}},sample:function(t){return t<10?this.sampleSmall(t):this.sampleLarge(t)}}),t.extend(t.triangular,{pdf:function(t,e,n,r){return n<=e||rn?NaN:tn?0:tr?NaN:t<=n?0:t>=r?1:t<=i?e.pow(t-n,2)/((r-n)*(i-n)):1-e.pow(r-t,2)/((r-n)*(r-i))},inv:function(t,n,r,i){return r<=n||ir?NaN:t<=(i-n)/(r-n)?n+(r-n)*e.sqrt(t*((i-n)/(r-n))):n+(r-n)*(1-e.sqrt((1-t)*(1-(i-n)/(r-n))))},mean:function(t,e,n){return(t+e+n)/3},median:function(t,n,r){return r<=(t+n)/2?n-e.sqrt((n-t)*(n-r))/e.sqrt(2):r>(t+n)/2?t+e.sqrt((n-t)*(r-t))/e.sqrt(2):void 0},mode:function(t,e,n){return n},sample:function(n,r,i){var o=t._random_fn();return o<(i-n)/(r-n)?n+e.sqrt(o*(r-n)*(i-n)):r-e.sqrt((1-o)*(r-n)*(r-i))},variance:function(t,e,n){return(t*t+e*e+n*n-t*e-t*n-e*n)/18}}),t.extend(t.arcsine,{pdf:function(t,n,r){return r<=n?NaN:t<=n||t>=r?0:2/e.PI*e.pow(e.pow(r-n,2)-e.pow(2*t-n-r,2),-.5)},cdf:function(t,n,r){return t25e3)return r(n,1,a);var l,f=.5*o,c=f*e.log(o)-o*e.log(2)-t.gammaln(f),h=f-1,d=.25*o;l=o<=100?1:o<=800?.5:o<=5e3?.25:.125,c+=e.log(l);for(var p=0,g=1;g<=50;g++){for(var m=0,v=(2*g-1)*l,b=1;b<=16;b++){var y,w;8=-30&&(m+=r(8=1&&m<=1e-14)break;p+=m}if(m>1e-14)throw new Error("tukey.cdf failed to converge");return p>1&&(p=1),p},inv:function(n,r,i){if(i<2||r<2)return NaN;if(n<0||n>1)return NaN;if(0===n)return 0;if(1===n)return 1/0;var o,a=function(t,n,r){var i=.5-.5*t,o=e.sqrt(e.log(1/(i*i))),a=o+((((-453642210148e-16*o-.204231210125)*o-.342242088547)*o-1)*o+.322232421088)/((((.0038560700634*o+.10353775285)*o+.531103462366)*o+.588581570495)*o+.099348462606);r<120&&(a+=(a*a*a+a)/r/4);var s=.8832-.2368*a;return r<120&&(s+=-1.214/r+1.208*a/r),a*(s*e.log(n-1)+1.4142)}(n,r,i),s=t.tukey.cdf(a,r,i)-n;o=s>0?e.max(0,a-1):a+1;for(var u,l=t.tukey.cdf(o,r,i)-n,f=1;f<50;f++)if(u=o-l*(o-a)/(l-s),s=l,a=o,u<0&&(u=0,l=-n),l=t.tukey.cdf(u,r,i)-n,o=u,e.abs(o-a)<1e-4)return u;throw new Error("tukey.inv failed to converge")}})}(e,Math),function(t,e){var n,r,i=Array.prototype.push,o=t.utils.isArray;function a(e){return o(e)||e instanceof t}t.extend({add:function(e,n){return a(n)?(a(n[0])||(n=[n]),t.map(e,(function(t,e,r){return t+n[e][r]}))):t.map(e,(function(t){return t+n}))},subtract:function(e,n){return a(n)?(a(n[0])||(n=[n]),t.map(e,(function(t,e,r){return t-n[e][r]||0}))):t.map(e,(function(t){return t-n}))},divide:function(e,n){return a(n)?(a(n[0])||(n=[n]),t.multiply(e,t.inv(n))):t.map(e,(function(t){return t/n}))},multiply:function(e,n){var r,i,o,s,u,l,f,c;if(void 0===e.length&&void 0===n.length)return e*n;if(u=e.length,l=e[0].length,f=t.zeros(u,o=a(n)?n[0].length:l),c=0,a(n)){for(;c=0;u--){for(d=0,l=u+1;l<=f-1;l++)d+=p[l]*n[u][l];p[u]=(n[u][i-1]-d)/n[u][u]}return p},gauss_jordan:function(n,r){var i,o,a,s=t.aug(n,r),u=s.length,l=s[0].length,f=0;for(o=0;oe.abs(s[c][o])&&(c=a);var h=s[o];for(s[o]=s[c],s[c]=h,a=o+1;a=0;o--){for(f=s[o][o],a=0;ao-1;i--)s[a][i]-=s[o][i]*s[a][o]/f;for(s[o][o]/=f,i=u;ic?(d[f][c]=n[f][c],p[f][c]=g[f][c]=0):fo;)a=l,l=t.add(t.multiply(u,a),s),f++;return l},gauss_seidel:function(n,r,i,o){for(var a,s,u,l,f,c=0,h=n.length,d=[],p=[],g=[];ca?(d[c][a]=n[c][a],p[c][a]=g[c][a]=0):co;)s=f,f=t.add(t.multiply(l,s),u),c+=1;return f},SOR:function(n,r,i,o,a){for(var s,u,l,f,c,h=0,d=n.length,p=[],g=[],m=[];hs?(p[h][s]=n[h][s],g[h][s]=m[h][s]=0):ho;)u=c,c=t.add(t.multiply(f,u),l),h++;return c},householder:function(n){for(var r,i,o,a,s=n.length,u=n[0].length,l=0,f=[],c=[];l0?-1:1)*e.sqrt(r),i=e.sqrt((r*r-n[l+1][l]*r)/2),(f=t.zeros(s,1))[l+1][0]=(n[l+1][l]-r)/(2*i),o=l+2;o0?e.PI/4:-e.PI/4:e.atan(2*n[o][a]/(n[o][o]-n[a][a]))/2,(l=t.identity(c,c))[o][o]=e.cos(u),l[o][a]=-e.sin(u),l[a][o]=e.sin(u),l[a][a]=e.cos(u),h=t.multiply(h,l),n=t.multiply(t.multiply(t.inv(l),n),l),f=0,r=1;r.001&&(f=1)}for(r=0;r=c;)a=o(t,r+i),s=o(t,r),d[h]=(n[a]-2*n[s]+n[2*s-a])/(i*i),i/=2,h++;for(l=d.length,u=1;1!=l;){for(f=0;fr);i++);return n[i-=1]+(r-e[i])*h[i]+t.sq(r-e[i])*o[i]+(r-e[i])*t.sq(r-e[i])*d[i]},gauss_quadrature:function(){throw new Error("gauss_quadrature not yet implemented")},PCA:function(e){var n,r,i,o,a,s=e.length,u=e[0].length,l=0,f=[],c=[],h=[],d=[],p=[],g=[],m=[];for(l=0;l1||r>1||t<=0||r<=0)throw new Error("Proportions should be greater than 0 and less than 1");var o=(t*n+r*i)/(n+i);return(t-r)/e.sqrt(o*(1-o)*(1/n+1/i))}t.extend({zscore:function(){var e=n.call(arguments);return r(e[1])?(e[0]-e[1])/e[2]:(e[0]-t.mean(e[1]))/t.stdev(e[1],e[2])},ztest:function(){var r,o=n.call(arguments);return i(o[1])?(r=t.zscore(o[0],o[1],o[3]),1===o[2]?t.normal.cdf(-e.abs(r),0,1):2*t.normal.cdf(-e.abs(r),0,1)):o.length>2?(r=t.zscore(o[0],o[1],o[2]),1===o[3]?t.normal.cdf(-e.abs(r),0,1):2*t.normal.cdf(-e.abs(r),0,1)):(r=o[0],1===o[1]?t.normal.cdf(-e.abs(r),0,1):2*t.normal.cdf(-e.abs(r),0,1))}}),t.extend(t.fn,{zscore:function(t,e){return(t-this.mean())/this.stdev(e)},ztest:function(n,r,i){var o=e.abs(this.zscore(n,i));return 1===r?t.normal.cdf(-o,0,1):2*t.normal.cdf(-o,0,1)}}),t.extend({tscore:function(){var r=n.call(arguments);return 4===r.length?(r[0]-r[1])/(r[2]/e.sqrt(r[3])):(r[0]-t.mean(r[1]))/(t.stdev(r[1],!0)/e.sqrt(r[1].length))},ttest:function(){var i,o=n.call(arguments);return 5===o.length?(i=e.abs(t.tscore(o[0],o[1],o[2],o[3])),1===o[4]?t.studentt.cdf(-i,o[3]-1):2*t.studentt.cdf(-i,o[3]-1)):r(o[1])?(i=e.abs(o[0]),1==o[2]?t.studentt.cdf(-i,o[1]-1):2*t.studentt.cdf(-i,o[1]-1)):(i=e.abs(t.tscore(o[0],o[1])),1==o[2]?t.studentt.cdf(-i,o[1].length-1):2*t.studentt.cdf(-i,o[1].length-1))}}),t.extend(t.fn,{tscore:function(t){return(t-this.mean())/(this.stdev(!0)/e.sqrt(this.cols()))},ttest:function(n,r){return 1===r?1-t.studentt.cdf(e.abs(this.tscore(n)),this.cols()-1):2*t.studentt.cdf(-e.abs(this.tscore(n)),this.cols()-1)}}),t.extend({anovafscore:function(){var r,i,o,a,s,u,l,f,c=n.call(arguments);if(1===c.length){for(s=new Array(c[0].length),l=0;l.5?1-r:r)})),f=e.studentt.inv(.975,n.df_resid),c=n.coef.map((function(t,e){var n=f*s[e];return[t-n,t+n]}));return{se:s,t:u,p:l,sigmaHat:a,interval95:c}}return{ols:function(r,i){var o=t(r,i),a=n(o),s=function(t){var n,r,i,o=t.R2/t.df_model/((1-t.R2)/t.df_resid);return{F_statistic:o,pvalue:1-(n=o,r=t.df_model,i=t.df_resid,e.beta.cdf(n/(i/r+n),r/2,i/2))}}(o),u=1-(1-o.R2)*((o.nobs-1)/o.df_resid);return o.t=a,o.f=s,o.adjust_R2=u,o}}}(),e.extend({buildxmatrix:function(){for(var t=new Array(arguments.length),n=0;n1){for(a=[],r=0;r{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var r={};(()=>{"use strict";n.r(r),n.d(r,{Langevitour:()=>Wr});var t=n(162),e=n(409);function i(){}function o(t){return null==t?i:function(){return this.querySelector(t)}}function a(){return[]}function s(t){return null==t?a:function(){return this.querySelectorAll(t)}}function u(t){return function(){return this.matches(t)}}function l(t){return function(e){return e.matches(t)}}var f=Array.prototype.find;function c(){return this.firstElementChild}var h=Array.prototype.filter;function d(){return Array.from(this.children)}function p(t){return new Array(t.length)}function g(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}function m(t,e,n,r,i,o){for(var a,s=0,u=e.length,l=o.length;se?1:t>=e?0:NaN}g.prototype={constructor:g,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};var x="http://www.w3.org/1999/xhtml";const _={svg:"http://www.w3.org/2000/svg",xhtml:x,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function M(t){var e=t+="",n=e.indexOf(":");return n>=0&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),_.hasOwnProperty(e)?{space:_[e],local:t}:t}function S(t){return function(){this.removeAttribute(t)}}function A(t){return function(){this.removeAttributeNS(t.space,t.local)}}function k(t,e){return function(){this.setAttribute(t,e)}}function N(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function q(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}}function E(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function C(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function I(t){return function(){this.style.removeProperty(t)}}function P(t,e,n){return function(){this.style.setProperty(t,e,n)}}function j(t,e,n){return function(){var r=e.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function D(t,e){return t.style.getPropertyValue(e)||C(t).getComputedStyle(t,null).getPropertyValue(e)}function z(t){return function(){delete this[t]}}function T(t,e){return function(){this[t]=e}}function $(t,e){return function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}}function B(t){return t.trim().split(/^|\s+/)}function F(t){return t.classList||new R(t)}function R(t){this._node=t,this._names=B(t.getAttribute("class")||"")}function X(t,e){for(var n=F(t),r=-1,i=e.length;++r=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var ht=[null];function dt(t,e){this._groups=t,this._parents=e}function pt(){return new dt([[document.documentElement]],ht)}dt.prototype=pt.prototype={constructor:dt,select:function(t){"function"!=typeof t&&(t=o(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i=A&&(A=S+1);!(M=x[A])&&++A=0;)(r=i[o])&&(a&&4^r.compareDocumentPosition(a)&&a.parentNode.insertBefore(r,a),a=r);return this},sort:function(t){function e(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}t||(t=w);for(var n=this._groups,r=n.length,i=new Array(r),o=0;o1?this.each((null==e?I:"function"==typeof e?j:P)(t,e,null==n?"":n)):D(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?z:"function"==typeof e?$:T)(t,e)):this.node()[t]},classed:function(t,e){var n=B(t+"");if(arguments.length<2){for(var r=F(this.node()),i=-1,o=n.length;++i=0&&(e=t.slice(n+1),t=t.slice(0,n)),{type:t,name:e}}))}(t+""),a=o.length;if(!(arguments.length<2)){for(s=e?ut:st,r=0;r{}};function vt(){for(var t,e=0,n=arguments.length,r={};e=0&&(e=t.slice(n+1),t=t.slice(0,n)),t&&!r.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}}))),a=-1,s=o.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++a0)for(var n,r,i=new Array(n),o=0;o=0&&e._call.call(void 0,t),e=e._next;--St}()}finally{St=0,function(){for(var t,e,n=_t,r=1/0;n;)n._call?(r>n._time&&(r=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:_t=e);Mt=t,Ft(r)}(),Et=0}}function Bt(){var t=It.now(),e=t-qt;e>Nt&&(Ct-=e,qt=t)}function Ft(t){St||(At&&(At=clearTimeout(At)),t-Et>24?(t<1/0&&(At=setTimeout($t,t-It.now()-Ct)),kt&&(kt=clearInterval(kt))):(kt||(qt=It.now(),kt=setInterval(Bt,Nt)),St=1,Pt($t)))}function Rt(t,e,n){var r=new zt;return e=null==e?0:+e,r.restart((n=>{r.stop(),t(n+e)}),e,n),r}zt.prototype=Tt.prototype={constructor:zt,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?jt():+n)+(null==e?0:+e),this._next||Mt===this||(Mt?Mt._next=this:_t=this,Mt=this),this._call=t,this._time=n,Ft()},stop:function(){this._call&&(this._call=null,this._time=1/0,Ft())}};var Xt=xt("start","end","cancel","interrupt"),Lt=[],Ot=0,Ht=3;function Yt(t,e,n,r,i,o){var a=t.__transition;if(a){if(n in a)return}else t.__transition={};!function(t,e,n){var r,i=t.__transition;function o(u){var l,f,c,h;if(1!==n.state)return s();for(l in i)if((h=i[l]).name===n.name){if(h.state===Ht)return Rt(o);4===h.state?(h.state=6,h.timer.stop(),h.on.call("interrupt",t,t.__data__,h.index,h.group),delete i[l]):+lOt)throw new Error("too late; already scheduled");return n}function Ut(t,e){var n=Vt(t,e);if(n.state>Ht)throw new Error("too late; already running");return n}function Vt(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function Gt(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}var Kt,Jt=180/Math.PI,Qt={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Zt(t,e,n,r,i,o){var a,s,u;return(a=Math.sqrt(t*t+e*e))&&(t/=a,e/=a),(u=t*n+e*r)&&(n-=t*u,r-=e*u),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,u/=s),t*r180?e+=360:e-t>180&&(t+=360),o.push({i:n.push(i(n)+"rotate(",null,r)-2,x:Gt(t,e)})):e&&n.push(i(n)+"rotate("+e+r)}(o.rotate,a.rotate,s,u),function(t,e,n,o){t!==e?o.push({i:n.push(i(n)+"skewX(",null,r)-2,x:Gt(t,e)}):e&&n.push(i(n)+"skewX("+e+r)}(o.skewX,a.skewX,s,u),function(t,e,n,r,o,a){if(t!==n||e!==r){var s=o.push(i(o)+"scale(",null,",",null,")");a.push({i:s-4,x:Gt(t,n)},{i:s-2,x:Gt(e,r)})}else 1===n&&1===r||o.push(i(o)+"scale("+n+","+r+")")}(o.scaleX,o.scaleY,a.scaleX,a.scaleY,s,u),o=a=null,function(t){for(var e,n=-1,r=u.length;++n>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?ke(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?ke(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=ge.exec(t))?new qe(e[1],e[2],e[3],1):(e=me.exec(t))?new qe(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=ve.exec(t))?ke(e[1],e[2],e[3],e[4]):(e=be.exec(t))?ke(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=ye.exec(t))?De(e[1],e[2]/100,e[3]/100,1):(e=we.exec(t))?De(e[1],e[2]/100,e[3]/100,e[4]):xe.hasOwnProperty(t)?Ae(xe[t]):"transparent"===t?new qe(NaN,NaN,NaN,0):null}function Ae(t){return new qe(t>>16&255,t>>8&255,255&t,1)}function ke(t,e,n,r){return r<=0&&(t=e=n=NaN),new qe(t,e,n,r)}function Ne(t,e,n,r){return 1===arguments.length?((i=t)instanceof ue||(i=Se(i)),i?new qe((i=i.rgb()).r,i.g,i.b,i.opacity):new qe):new qe(t,e,n,null==r?1:r);var i}function qe(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function Ee(){return`#${je(this.r)}${je(this.g)}${je(this.b)}`}function Ce(){const t=Ie(this.opacity);return`${1===t?"rgb(":"rgba("}${Pe(this.r)}, ${Pe(this.g)}, ${Pe(this.b)}${1===t?")":`, ${t})`}`}function Ie(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Pe(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function je(t){return((t=Pe(t))<16?"0":"")+t.toString(16)}function De(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Te(t,e,n,r)}function ze(t){if(t instanceof Te)return new Te(t.h,t.s,t.l,t.opacity);if(t instanceof ue||(t=Se(t)),!t)return new Te;if(t instanceof Te)return t;var e=(t=t.rgb()).r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),o=Math.max(e,n,r),a=NaN,s=o-i,u=(o+i)/2;return s?(a=e===o?(n-r)/s+6*(n0&&u<1?0:a,new Te(a,s,u,t.opacity)}function Te(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function $e(t){return(t=(t||0)%360)<0?t+360:t}function Be(t){return Math.max(0,Math.min(1,t||0))}function Fe(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}function Re(t,e,n,r,i){var o=t*t,a=o*t;return((1-3*t+3*o-a)*e+(4-6*o+3*a)*n+(1+3*t+3*o-3*a)*r+a*i)/6}ae(ue,Se,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:_e,formatHex:_e,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return ze(this).formatHsl()},formatRgb:Me,toString:Me}),ae(qe,Ne,se(ue,{brighter(t){return t=null==t?fe:Math.pow(fe,t),new qe(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?le:Math.pow(le,t),new qe(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new qe(Pe(this.r),Pe(this.g),Pe(this.b),Ie(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Ee,formatHex:Ee,formatHex8:function(){return`#${je(this.r)}${je(this.g)}${je(this.b)}${je(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:Ce,toString:Ce})),ae(Te,(function(t,e,n,r){return 1===arguments.length?ze(t):new Te(t,e,n,null==r?1:r)}),se(ue,{brighter(t){return t=null==t?fe:Math.pow(fe,t),new Te(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?le:Math.pow(le,t),new Te(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new qe(Fe(t>=240?t-240:t+120,i,r),Fe(t,i,r),Fe(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new Te($e(this.h),Be(this.s),Be(this.l),Ie(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=Ie(this.opacity);return`${1===t?"hsl(":"hsla("}${$e(this.h)}, ${100*Be(this.s)}%, ${100*Be(this.l)}%${1===t?")":`, ${t})`}`}}));const Xe=t=>()=>t;function Le(t,e){var n=e-t;return n?function(t,e){return function(n){return t+n*e}}(t,n):Xe(isNaN(t)?e:t)}const Oe=function t(e){var n=function(t){return 1==(t=+t)?Le:function(e,n){return n-e?function(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}(e,n,t):Xe(isNaN(e)?n:e)}}(e);function r(t,e){var r=n((t=Ne(t)).r,(e=Ne(e)).r),i=n(t.g,e.g),o=n(t.b,e.b),a=Le(t.opacity,e.opacity);return function(e){return t.r=r(e),t.g=i(e),t.b=o(e),t.opacity=a(e),t+""}}return r.gamma=t,r}(1);function He(t){return function(e){var n,r,i=e.length,o=new Array(i),a=new Array(i),s=new Array(i);for(n=0;n=1?(n=1,e-1):Math.floor(n*e),i=t[r],o=t[r+1],a=r>0?t[r-1]:2*i-o,s=ro&&(i=e.slice(o,i),s[a]?s[a]+=i:s[++a]=i),(n=n[0])===(r=r[0])?s[a]?s[a]+=r:s[++a]=r:(s[++a]=null,u.push({i:a,x:Gt(n,r)})),o=We.lastIndex;return o=0&&(t=t.slice(0,e)),!t||"start"===t}))}(e)?Wt:Ut;return function(){var a=o(this,t),s=a.on;s!==r&&(i=(r=s).copy()).on(e,n),a.on=i}}(n,t,e))},attr:function(t,e){var n=M(t),r="transform"===n?ne:Ve;return this.attrTween(t,"function"==typeof e?(n.local?tn:Ze)(n,r,oe(this,"attr."+t,e)):null==e?(n.local?Ke:Ge)(n):(n.local?Qe:Je)(n,r,e))},attrTween:function(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==e)return this.tween(n,null);if("function"!=typeof e)throw new Error;var r=M(t);return this.tween(n,(r.local?en:nn)(r,e))},style:function(t,e,n){var r="transform"==(t+="")?ee:Ve;return null==e?this.styleTween(t,function(t,e){var n,r,i;return function(){var o=D(this,t),a=(this.style.removeProperty(t),D(this,t));return o===a?null:o===n&&a===r?i:i=e(n=o,r=a)}}(t,r)).on("end.style."+t,ln(t)):"function"==typeof e?this.styleTween(t,function(t,e,n){var r,i,o;return function(){var a=D(this,t),s=n(this),u=s+"";return null==s&&(this.style.removeProperty(t),u=s=D(this,t)),a===u?null:a===r&&u===i?o:(i=u,o=e(r=a,s))}}(t,r,oe(this,"style."+t,e))).each(function(t,e){var n,r,i,o,a="style."+e,s="end."+a;return function(){var u=Ut(this,t),l=u.on,f=null==u.value[a]?o||(o=ln(e)):void 0;l===n&&i===f||(r=(n=l).copy()).on(s,i=f),u.on=r}}(this._id,t)):this.styleTween(t,function(t,e,n){var r,i,o=n+"";return function(){var a=D(this,t);return a===o?null:a===r?i:i=e(r=a,n)}}(t,r,e),n).on("end.style."+t,null)},styleTween:function(t,e,n){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==e)return this.tween(r,null);if("function"!=typeof e)throw new Error;return this.tween(r,function(t,e,n){var r,i;function o(){var o=e.apply(this,arguments);return o!==i&&(r=(i=o)&&function(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}(t,o,n)),r}return o._value=e,o}(t,e,null==n?"":n))},text:function(t){return this.tween("text","function"==typeof t?function(t){return function(){var e=t(this);this.textContent=null==e?"":e}}(oe(this,"text",t)):function(t){return function(){this.textContent=t}}(null==t?"":t+""))},textTween:function(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(null==t)return this.tween(e,null);if("function"!=typeof t)throw new Error;return this.tween(e,function(t){var e,n;function r(){var r=t.apply(this,arguments);return r!==n&&(e=(n=r)&&function(t){return function(e){this.textContent=t.call(this,e)}}(r)),e}return r._value=t,r}(t))},remove:function(){return this.on("end.remove",function(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}(this._id))},tween:function(t,e){var n=this._id;if(t+="",arguments.length<2){for(var r,i=Vt(this.node(),n).tween,o=0,a=i.length;o2&&n.state<5,n.state=6,n.timer.stop(),n.on.call(r?"interrupt":"cancel",t,t.__data__,n.index,n.group),delete o[i]):a=!1;a&&delete t.__transition}}(this,t)}))},gt.prototype.transition=function(t){var e,n;t instanceof cn?(e=t._id,t=t._name):(e=hn(),(n=pn).time=jt(),t=null==t?null:t+"");for(var r=this._groups,i=r.length,o=0;o()=>t;function Nn(t,{sourceEvent:e,subject:n,target:r,identifier:i,active:o,x:a,y:s,dx:u,dy:l,dispatch:f}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:o,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:u,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:f}})}function qn(t){return!t.ctrlKey&&!t.button}function En(){return this.parentNode}function Cn(t,e){return null==e?{x:t.x,y:t.y}:e}function In(){return navigator.maxTouchPoints||"ontouchstart"in this}Nn.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};var Pn=Math.sqrt(50),jn=Math.sqrt(10),Dn=Math.sqrt(2);function zn(t,e,n){var r=(e-t)/Math.max(0,n),i=Math.floor(Math.log(r)/Math.LN10),o=r/Math.pow(10,i);return i>=0?(o>=Pn?10:o>=jn?5:o>=Dn?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(o>=Pn?10:o>=jn?5:o>=Dn?2:1)}function Tn(t,e){return null==t||null==e?NaN:te?1:t>=e?0:NaN}function $n(t,e){return null==t||null==e?NaN:et?1:e>=t?0:NaN}function Bn(t){let e,n,r;function i(t,r,i=0,o=t.length){if(i>>1;n(t[e],r)<0?i=e+1:o=e}while(iTn(t(e),n),r=(e,n)=>t(e)-n):(e=t===Tn||t===$n?t:Fn,n=t,r=t),{left:i,center:function(t,e,n=0,o=t.length){const a=i(t,e,n,o-1);return a>n&&r(t[a-1],e)>-r(t[a],e)?a-1:a},right:function(t,r,i=0,o=t.length){if(i>>1;n(t[e],r)<=0?i=e+1:o=e}while(i=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function ir(t){if(!(e=rr.exec(t)))throw new Error("invalid format: "+t);var e;return new or({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}function or(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}function ar(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,r=t.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+t.slice(n+1)]}function sr(t){return(t=ar(Math.abs(t)))?t[1]:NaN}function ur(t,e){var n=ar(t,e);if(!n)return t+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}ir.prototype=or.prototype,or.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};const lr={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>ur(100*t,e),r:ur,s:function(t,e){var n=ar(t,e);if(!n)return t+"";var r=n[0],i=n[1],o=i-(nr=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,a=r.length;return o===a?r:o>a?r+new Array(o-a+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+ar(t,Math.max(0,e+o-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function fr(t){return t}var cr,hr,dr,pr=Array.prototype.map,gr=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function mr(t){var e=t.domain;return t.ticks=function(t){var n=e();return function(t,e,n){var r,i,o,a,s=-1;if(n=+n,(t=+t)==(e=+e)&&n>0)return[t];if((r=e0){let n=Math.round(t/a),r=Math.round(e/a);for(n*ae&&--r,o=new Array(i=r-n+1);++se&&--r,o=new Array(i=r-n+1);++s=Pn?i*=10:o>=jn?i*=5:o>=Dn&&(i*=2),e0;){if((i=zn(u,l,n))===r)return o[a]=u,o[s]=l,e(o);if(i>0)u=Math.floor(u/i)*i,l=Math.ceil(l/i)*i;else{if(!(i<0))break;u=Math.ceil(u*i)/i,l=Math.floor(l*i)/i}r=i}return t},t}function vr(){var t=function(){var t,e,n,r,i,o,a=Kn,s=Kn,u=Un,l=Jn;function f(){var t,e,n,u=Math.min(a.length,s.length);return l!==Jn&&(t=a[0],e=a[u-1],t>e&&(n=t,t=e,e=n),l=function(n){return Math.max(t,Math.min(e,n))}),r=u>2?tr:Zn,i=o=null,c}function c(e){return null==e||isNaN(e=+e)?n:(i||(i=r(a.map(t),s,u)))(t(l(e)))}return c.invert=function(n){return l(e((o||(o=r(s,a.map(t),Gt)))(n)))},c.domain=function(t){return arguments.length?(a=Array.from(t,Gn),f()):a.slice()},c.range=function(t){return arguments.length?(s=Array.from(t),f()):s.slice()},c.rangeRound=function(t){return s=Array.from(t),u=Vn,f()},c.clamp=function(t){return arguments.length?(l=!!t||Jn,f()):l!==Jn},c.interpolate=function(t){return arguments.length?(u=t,f()):u},c.unknown=function(t){return arguments.length?(n=t,c):n},function(n,r){return t=n,e=r,f()}}()(Jn,Jn);return t.copy=function(){return e=t,vr().domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown());var e},er.apply(t,arguments),mr(t)}function br(t){for(var e=t.length/6|0,n=new Array(e),r=0;r0&&s>0&&(u+s+1>r&&(s=Math.max(1,r-u)),o.push(t.substring(i-=s,i+s)),!((u+=s+1)>r));)s=e[a=(a+1)%e.length];return o.reverse().join(n)}),i=void 0===t.currency?"":t.currency[0]+"",o=void 0===t.currency?"":t.currency[1]+"",a=void 0===t.decimal?".":t.decimal+"",s=void 0===t.numerals?fr:function(t){return function(e){return e.replace(/[0-9]/g,(function(e){return t[+e]}))}}(pr.call(t.numerals,String)),u=void 0===t.percent?"%":t.percent+"",l=void 0===t.minus?"−":t.minus+"",f=void 0===t.nan?"NaN":t.nan+"";function c(t){var e=(t=ir(t)).fill,n=t.align,c=t.sign,h=t.symbol,d=t.zero,p=t.width,g=t.comma,m=t.precision,v=t.trim,b=t.type;"n"===b?(g=!0,b="g"):lr[b]||(void 0===m&&(m=12),v=!0,b="g"),(d||"0"===e&&"="===n)&&(d=!0,e="0",n="=");var y="$"===h?i:"#"===h&&/[boxX]/.test(b)?"0"+b.toLowerCase():"",w="$"===h?o:/[%p]/.test(b)?u:"",x=lr[b],_=/[defgprs%]/.test(b);function M(t){var i,o,u,h=y,M=w;if("c"===b)M=x(t)+M,t="";else{var S=(t=+t)<0||1/t<0;if(t=isNaN(t)?f:x(Math.abs(t),m),v&&(t=function(t){t:for(var e,n=t.length,r=1,i=-1;r0&&(i=0)}return i>0?t.slice(0,i)+t.slice(e+1):t}(t)),S&&0==+t&&"+"!==c&&(S=!1),h=(S?"("===c?c:l:"-"===c||"("===c?"":c)+h,M=("s"===b?gr[8+nr/3]:"")+M+(S&&"("===c?")":""),_)for(i=-1,o=t.length;++i(u=t.charCodeAt(i))||u>57){M=(46===u?a+t.slice(i+1):t.slice(i))+M,t=t.slice(0,i);break}}g&&!d&&(t=r(t,1/0));var A=h.length+t.length+M.length,k=A>1)+h+t+M+k.slice(A);break;default:t=k+h+t+M}return s(t)}return m=void 0===m?6:/[gprs]/.test(b)?Math.max(1,Math.min(21,m)):Math.max(0,Math.min(20,m)),M.toString=function(){return t+""},M}return{format:c,formatPrefix:function(t,e){var n=c(((t=ir(t)).type="f",t)),r=3*Math.max(-8,Math.min(8,Math.floor(sr(e)/3))),i=Math.pow(10,-r),o=gr[8+r/3];return function(t){return n(i*t)+o}}}}({thousands:",",grouping:[3],currency:["$",""]}),hr=cr.format,dr=cr.formatPrefix;const wr=yr(br("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725"));function xr(t,e,n){this.k=t,this.x=e,this.y=n}function _r(t){return Math.floor(Math.random()*t)}function Mr(t,e,...n){let r=Array(t);for(let i=0;it.map((t=>t*e))))}function jr(t,e){for(let n=0;nXr(t,e,-1,.05,.01),local:(t,e)=>Xr(t,e,0,.01,.5),pca:(t,e)=>Xr(t,e,1,0,.5),outlier:(t,e)=>Xr(t,e,2,0,5),push:(t,e)=>Lr(t,e,.5,.01,.5),pull:(t,e)=>Lr(t,e,.5,.01,-.2)};const{normal:Hr}=t;let Yr='~\n
~\n ~\n\n
~\n ~\n
~\n
~\n
~\n \n
\n \n
\n \n
\n \n \n \n \n \n \n \n
Brush size
Zoom
Damping
Heat
Label strength
Guide strength
\n
~\n
~\n\n
~\n ~\n \n ~\n \n ~\n \n
~\n Guide\n ~ \n
~\n \n
~\n \n
~\n \n
~\n
~\n
~\n'.replace(/~\s+/g,"");class Wr extends EventTarget{constructor(t,e,n){super(),this.width=1,this.height=1,this.size=1,this.fullscreen=!1,this.originalWidth=1,this.originalHeight=1,this.center=[],this.scale=[],this.X=[[],[]],this.n=0,this.m=0,this.colnames=[],this.permutor=[],this.unpermutor=[],this.rownames=[],this.group=[],this.pointSize=[],this.levels=[],this.levelColors=[],this.lineFrom=[],this.lineTo=[],this.lineColors=[],this.fills=[],this.filter=null,this.selection=null,this.selectionChanged=!1,this.axes=[],this.labelData=[],this.proj=[[],[]],this.vel=[[],[]],this.zoom=1,this.xScaleUnit=vr(),this.yScaleUnit=vr(),this.xScale=vr(),this.yScale=vr(),this.xScaleClamped=vr(),this.yScaleClamped=vr(),this.haveData=!1,this.playing=!0,this.frameScheduled=!1,this.lastTime=0,this.mouseInCheckbox=!1,this.dragging=!1,this.fps=[],this.computeMessage="",this.mousing=!1,this.mouseDown=!1,this.mouseWentDown=!1,this.mouseShiftKey=!1,this.mouseX=0,this.mouseY=0,this.rightMouseDown=!1,this.rightMouseWentDown=!1,this.tugging=!1,this.tugX=0,this.tugY=0,this.tugPoints=[],this.xy=[[],[]],this.fillsFrame=[],this.pointActive=[],this.container=t,this.shadowDiv=document.createElement("div"),this.container.appendChild(this.shadowDiv),this.shadowRoot=this.shadowDiv.attachShadow({mode:"open"}),this.shadowRoot.innerHTML=Yr,this.shadowChild=this.shadowRoot.firstChild,this.canvas=this.get("canvas"),this.overlay=this.get("overlay"),this.container.langevitour=this,this.resize(e,n);let r=this.get("plotDiv");r.addEventListener("mouseover",(t=>{this.mousing=!0,this.scheduleFrameIfNeeded()})),r.addEventListener("mouseout",(t=>{this.mousing=!1,this.mouseDown=!1,this.rightMouseDown=!1,this.scheduleFrameIfNeeded()}));let i=t=>([this.mouseX,this.mouseY]=Br(t,this.canvas),t.target.classList.contains("overlay")?(this.mouseDown=1==t.buttons&&!t.ctrlKey,this.rightMouseDown=2==t.buttons||1==t.buttons&&t.ctrlKey,this.scheduleFrameIfNeeded(),!0):(this.mouseDown=!1,this.rightMouseDown=!1,!1));r.addEventListener("mousemove",(t=>{i(t)})),r.addEventListener("mousedown",(t=>{if(!i(t))return;let e=this.get("infoBox");"visible"!=e.style.visibility?(this.mouseDown&&(this.mouseWentDown=!0,this.mouseShiftKey=t.shiftKey),this.rightMouseDown&&(this.rightMouseWentDown=!0),this.scheduleFrameIfNeeded()):e.style.visibility="hidden"})),r.addEventListener("mouseup",(t=>{this.mouseDown=!1,this.rightMouseDown=!1,this.scheduleFrameIfNeeded()})),null==this.container.requestFullscreen&&(this.get("fullscreenButton").style.display="none"),this.get("fullscreenButton").addEventListener("click",(()=>{document.fullscreenElement?document.fullscreenElement===this.shadowDiv&&document.exitFullscreen&&document.exitFullscreen():this.shadowDiv.requestFullscreen()}));let o=()=>{if(!this.fullscreen)return;let t=this.shadowDiv,e=window.innerWidth,n=window.innerHeight,r=Math.max(0,e-n)/2;t.style.paddingLeft=r+"px",this.width=e-r,this.height=n,this.configure()};this.shadowDiv.addEventListener("fullscreenchange",(()=>{let t=this.shadowDiv;document.fullscreenElement===t?(this.fullscreen||(this.fullscreen=!0,this.originalWidth=this.width,this.originalHeight=this.height,window.addEventListener("resize",o)),o()):this.fullscreen&&(this.fullscreen=!1,t.style.paddingLeft="0px",this.width=this.originalWidth,this.height=this.originalHeight,window.removeEventListener("resize",o),this.configure())})),this.get("infoButton").addEventListener("click",(()=>{let t=this.get("infoBox");"visible"!=t.style.visibility&&this.haveData?(t.style.visibility="visible",this.get("infoBoxProj").style.display="none",this.get("infoBoxState").style.display="none",this.get("infoBoxInfo").innerHTML=`

${this.X.length.toLocaleString("en-US")} points.

`):t.style.visibility="hidden"})),this.get("infoBoxProjButton").addEventListener("click",(()=>{let t=this.getInput("infoBoxProj");if(Fr(t),"none"!=t.style.display){let t="projection <- cbind(\n c(";t+=this.proj.map((t=>t.map(((t,e)=>(t/this.scale[e]).toFixed(Math.ceil(Math.log10(Math.max(0,this.scale[e]))+4)))).join(","))).join("),\n c("),t+="))\nprojected <- as.matrix(X) %*% projection",this.getInput("infoBoxProj").value=t}})),this.get("infoBoxStateButton").addEventListener("click",(()=>{let t=this.getInput("infoBoxState");Fr(t),"none"!=t.style.display&&(t.value=JSON.stringify(this.getState(),null,4))})),this.get("playButton").addEventListener("click",(()=>this.setState({playing:!this.playing})))}get(t){return this.shadowChild.getElementsByClassName(t)[0]}getInput(t){return this.get(t)}getString(t){return this.getInput(t).value}getNumber(t){return Number(this.getInput(t).value)}getChecked(t){return this.getInput(t).checked}emitChangeFilter(){setTimeout((()=>this.dispatchEvent(new Event("changeFilter"))),0)}emitChangeSelectionIfNeeded(){this.selectionChanged&&(this.selectionChanged=!1,setTimeout((()=>this.dispatchEvent(new Event("changeSelection"))),0))}renderValue(t){if(!t)return this.haveData=!1,void this.configure();this.haveData=!0,this.n=t.X.length,this.m=t.X[0].length;let e=t.axisColors||[];this.center=t.center||Array(this.m).fill(0),this.scale=t.scale||Array(this.m).fill(1),this.permutor=function(t){let e=Array(t).fill(0).map(((t,e)=>e));for(let t=e.length-1;t>0;t--){const n=_r(t+1);[e[t],e[n]]=[e[n],e[t]]}return e}(this.n),this.unpermutor=Array(this.n);for(let t=0;tt.X[e])),this.X=this.X.map((t=>t.map(((t,e)=>(t-this.center[e])/this.scale[e])))),null==t.pointSize)this.pointSize=Array(this.n).fill(1);else if("number"==typeof t.pointSize)this.pointSize=Array(this.n).fill(t.pointSize);else{let e=t.pointSize;this.pointSize=this.permutor.map((t=>e[t]))}if(t.rownames&&0!=t.rownames.length){let e=t.rownames;this.rownames=this.permutor.map((t=>e[t]))}else this.rownames=[];if(this.colnames=t.colnames,this.lineFrom=(t.lineFrom||[]).map((t=>this.unpermutor[t])),this.lineTo=(t.lineTo||[]).map((t=>this.unpermutor[t])),this.lineColors=t.lineColors||[],this.lineFrom.length&&!this.lineColors.length&&(this.lineColors=this.lineFrom.map((()=>"#00000088"))),this.axes=[],t.extraAxes&&t.extraAxesNames)for(let n=0;nt[n])),i=Nr(r,this.center),o=r.map(((t,e)=>t*this.scale[e])),a=Math.sqrt(Nr(o,o)),s=qr(o,1/a);this.axes.push({name:t.extraAxesNames[n],unit:s,scale:a,center:i,color:e[n+this.m],proj:[]})}for(let n=0;nNr(e,this.axes[t].unit)));this.levels=t.levels,this.group=this.permutor.map((e=>t.group[e]));let n=this.levels.length;this.levelColors=(t.levelColors||[]).slice();for(let t=this.levelColors.length;t1)for(let t=0;t\n \n \n':'\n \n',!this.haveData){this.get("messageArea").innerText="",this.overlay.style.opacity="0";let t=this.canvas.getContext("2d");return t.scale(1,1),void t.clearRect(0,0,this.canvas.width,this.canvas.height)}this.configureScales();let e=wn(this.overlay);e.selectAll("*").remove(),this.mouseInCheckbox=!1;let n=this,r=e.selectAll("div").data(this.labelData).join((t=>{let e=t.append("div").classed("labelDiv",!0);return e.append("input").attr("type","checkbox").property("checked",(t=>t.active)).on("change",(function(t,e){e.active=this.checked,n.scheduleFrameIfNeeded(),n.emitChangeFilter()})).on("mouseover",(()=>{this.mouseInCheckbox=!0})).on("mouseout",(()=>{this.mouseInCheckbox=!1})),e.append("span"),e}));function i(){let t=n.xScaleUnit.invert(n.width);for(let e of n.labelData)e.x=Math.max(-1,Math.min(t,e.x)),e.y=Math.max(-1,Math.min(1,e.y));r.style("left",(t=>n.xScaleUnit(t.x)-t.halfWidth+"px")).style("top",(t=>n.yScaleUnit(t.y)-t.halfHeight+"px")).style("background",(t=>t.selected?"#aaa":"#ddd"))}r.style("cursor","grab").on("mouseover",((t,e)=>{e.selected+=1,i()})).on("mouseout",((t,e)=>{e.selected=Math.max(0,e.selected-1),i()})),r.select("span").text((t=>t.label)).style("color",(t=>t.color)),r.each((function(t){t.halfWidth=this.offsetWidth/2,t.halfHeight=this.offsetHeight/2})),function(){var t,e,n,r,i=qn,o=En,a=Cn,s=In,u={},l=xt("start","drag","end"),f=0,c=0;function h(t){t.on("mousedown.drag",d).filter(s).on("touchstart.drag",m).on("touchmove.drag",v,_n).on("touchend.drag touchcancel.drag",b).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function d(a,s){if(!r&&i.call(this,a,s)){var u=y(this,o.call(this,a,s),a,s,"mouse");u&&(wn(a.view).on("mousemove.drag",p,Mn).on("mouseup.drag",g,Mn),function(t){var e=t.document.documentElement,n=wn(t).on("dragstart.drag",An,Mn);"onselectstart"in e?n.on("selectstart.drag",An,Mn):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}(a.view),Sn(a),n=!1,t=a.clientX,e=a.clientY,u("start",a))}}function p(r){if(An(r),!n){var i=r.clientX-t,o=r.clientY-e;n=i*i+o*o>c}u.mouse("drag",r)}function g(t){wn(t.view).on("mousemove.drag mouseup.drag",null),function(t,e){var n=t.document.documentElement,r=wn(t).on("dragstart.drag",null);e&&(r.on("click.drag",An,Mn),setTimeout((function(){r.on("click.drag",null)}),0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}(t.view,n),An(t),u.mouse("end",t)}function m(t,e){if(i.call(this,t,e)){var n,r,a=t.changedTouches,s=o.call(this,t,e),u=a.length;for(n=0;nthis.selection[t])):t.selection=null,this.filter?t.filter=this.unpermutor.map((t=>this.filter[t])):t.filter=null,t}setState(t){let e=!1,n=!1;if("string"==typeof t&&(t=JSON.parse(t)),t){if($r(t,"playing")&&(!this.playing&&t.playing&&(this.lastTime=0),this.playing=t.playing),$r(t,"axesOn")&&(this.getInput("axesCheckbox").checked=t.axesOn),$r(t,"heatOn")&&(this.getInput("heatCheckbox").checked=t.heatOn),$r(t,"pointRepulsionType")&&(this.getInput("guideSelect").value=t.pointRepulsionType),$r(t,"guideType")&&(this.getInput("guideSelect").value=t.guideType),$r(t,"labelAttractionOn")&&(this.getInput("labelCheckbox").checked=t.labelAttractionOn),$r(t,"damping")&&(this.getInput("dampInput").value=t.damping),$r(t,"heat")&&(this.getInput("heatInput").value=t.heat),$r(t,"pointRepulsion")&&(this.getInput("guideInput").value=t.pointRepulsion),$r(t,"guide")&&(this.getInput("guideInput").value=t.guide),$r(t,"labelAttraction")&&(this.getInput("labelInput").value=t.labelAttraction),$r(t,"zoom")&&(this.getInput("zoomInput").value=t.zoom),$r(t,"brush")&&(this.getInput("brushInput").value=t.brush),$r(t,"labelInactive")){for(let e of this.labelData)e.active=!t.labelInactive.includes(e.label);e=!0}if($r(t,"labelPos"))for(let e of this.labelData)$r(t.labelPos,e.label)?(e.x=t.labelPos[e.label][0],e.y=t.labelPos[e.label][1]):e.x=1;$r(t,"projection")&&(this.proj=Array.from(t.projection.map((t=>Array.from(t))))),$r(t,"selection")&&(null===t.selection?this.selection=null:this.selection=this.permutor.map((e=>t.selection[e])),this.selectionChanged=!0,n=!0),$r(t,"filter")&&(null===t.filter?this.filter=null:this.filter=this.permutor.map((e=>t.filter[e]))),this.configure(),e&&this.emitChangeFilter(),n&&this.emitChangeSelectionIfNeeded()}}scheduleFrameIfNeeded(){!this.frameScheduled&&this.haveData&&(window.requestAnimationFrame(this.doFrame.bind(this)),this.frameScheduled=!0)}doFrame(t){if(this.frameScheduled=!1,!this.haveData)return;if(!function(t){let e=t;for(;;){let t=window.getComputedStyle(e);if("0"===t.opacity||"none"===t.display||"visible"!==t.visibility)return!1;if(!e.parentElement)break;e=e.parentElement}let n=t.getBoundingClientRect();return n.top=0&&n.left=0}(this.container))return this.lastTime=0,void window.setTimeout(this.scheduleFrameIfNeeded.bind(this),100);t/=1e3;let e=0;(this.playing||this.tugging)&&0!=this.lastTime&&(e=t-this.lastTime,this.fps.push(Math.round(1/e)),this.fps.length>100&&this.fps.shift()),this.lastTime=t,this.compute(e),this.configureScales();let n=null,r=null,i=this.labelData.filter((t=>t.selected));i.length&&("axis"==i[0].type?n=i[0].index:r=i[0].index);let o=this.getChecked("axesCheckbox"),a=Array(this.levels.length).fill(!0);for(let t of this.labelData)"level"==t.type&&(a[t.index]=t.active);let s=.05*this.size*Math.pow(10,this.getNumber("brushInput")),u=[];if(this.mouseXMath.pow(s,2)||u.push({index:t,d2:e})}u.sort(((t,e)=>t.d2-e.d2))}if(this.rightMouseWentDown&&(this.tugPoints=u.map((t=>t.index)),this.rightMouseWentDown=!1),this.tugging=this.rightMouseDown&&this.tugPoints.length>0,this.tugging&&(this.tugX=this.xScale.invert(this.mouseX),this.tugY=this.yScale.invert(this.mouseY)),this.mouseDown||this.mouseWentDown){if(this.mouseWentDown&&!this.mouseShiftKey&&(this.selection=null,this.selectionChanged=!0),u.length){this.selection||(this.selection=Array(this.n).fill(!1),this.selectionChanged=!0);for(let t=0;t=0;t--){let e=u[t].index,n=this.xScaleClamped(this.xy[0][e]),r=this.yScaleClamped(this.xy[1][e]);f.strokeText(this.rownames[e],n,r),f.fillText(this.rownames[e],n,r)}}if(f.restore(),f.textAlign="left",f.textBaseline="middle",f.font="15px sans-serif",!this.mousing)for(let t=0,e=0;t=1&&(o/=d,l/=d),c[0]=qr(e,(o-n)/i*t),c[1]=qr(e,(l-r)/i*t),a=!1,u=!1,s="none"}if(a){let t=1-d*d,e=Mr(h.length,Mr,this.m,Hr.sample,0,Math.sqrt(r*t));e=Tr(e,h),Dr(c,e)}if("none"!=s){let t=this.X.filter(((t,e)=>this.pointActive[e]));if(t.length){let e=Or[s](h,t);jr(e,-i),Dr(c,e)}}if(u)for(let t of this.labelData){let e=t.x,n=t.y;if(e<=-1||n<=-1||e>=1||n>=1)continue;if("level"==t.type&&!l[t.index])continue;let r=4*(e*e+n*n);c[0]=kr(c[0],qr(t.vec,e*r*o)),c[1]=kr(c[1],qr(t.vec,n*r*o))}let p=[];for(let t of this.labelData)"axis"!=t.type||t.active||p.push(this.axes[t.index].unit);let g=p.length>=this.m-1,m=!1;if(p.length&&!g){let t=Math.min(2,1/f),{u:n,v:r,q:i}=(0,e.SVD)(zr(p)),o=Math.max(...i);n=zr(n);let a=Er(2,this.m);for(let e=0;e item.map((value, i) => (value-this.center[i])/this.scale[i] )); + if (data.pointSize == null) { //check for null or undefined + this.pointSize = Array(this.n).fill(1) + } else if (typeof(data.pointSize) === "number") { + this.pointSize = Array(this.n).fill(data.pointSize); + } else { + let pointSize = data.pointSize; + this.pointSize = this.permutor.map(i => pointSize[i]); + } + if (!data.rownames || data.rownames.length == 0) { this.rownames = [ ]; } else { @@ -692,7 +699,7 @@ export class Langevitour extends EventTarget { // Point colors are given a small back-to-front brightness gradient, // to add some variation and give a pseudo-3D effect. - let colorVariation = data.colorVariation == null ? 0.3 : data.colorVariation; + let colorVariation = data.colorVariation == null ? 0.1 : data.colorVariation; this.fills = [ ]; for(let i=0;i