=d)&&(n=d)}}catch(e){u.e(e)}finally{u.f()}}return n}function fr(e,t){var n;if(void 0===t){var a,r=sr(e);try{for(r.s();!(a=r.n()).done;){var i=a.value;null!=i&&(n>i||void 0===n&&i>=i)&&(n=i)}}catch(e){r.e(e)}finally{r.f()}}else{var o,s=-1,u=sr(e);try{for(u.s();!(o=u.n()).done;){var d=o.value;null!=(d=t(d,++s,e))&&(n>d||void 0===n&&d>=d)&&(n=d)}}catch(e){u.e(e)}finally{u.f()}}return n}function gr(e,t,n){var a=e[t];e[t]=e[n],e[n]=a}var hr=D.a.mark(Ar),pr=function(e){return null===e?NaN:+e};function Ar(e,t){var n,a,r,i,o,s,u;return D.a.wrap((function(d){for(;;)switch(d.prev=d.next){case 0:if(void 0!==t){d.next=21;break}n=sr(e),d.prev=2,n.s();case 4:if((a=n.n()).done){d.next=11;break}if(!(null!=(r=a.value)&&(r=+r)>=r)){d.next=9;break}return d.next=9,r;case 9:d.next=4;break;case 11:d.next=16;break;case 13:d.prev=13,d.t0=d.catch(2),n.e(d.t0);case 16:return d.prev=16,n.f(),d.finish(16);case 19:d.next=40;break;case 21:i=-1,o=sr(e),d.prev=23,o.s();case 25:if((s=o.n()).done){d.next=32;break}if(u=s.value,!(null!=(u=t(u,++i,e))&&(u=+u)>=u)){d.next=30;break}return d.next=30,u;case 30:d.next=25;break;case 32:d.next=37;break;case 34:d.prev=34,d.t1=d.catch(23),o.e(d.t1);case 37:return d.prev=37,o.f(),d.finish(37);case 40:case"end":return d.stop()}}),hr,null,[[2,13,16,19],[23,34,37,40]])}function vr(e,t,n){if(a=(e=Float64Array.from(Ar(e,n))).length){if((t=+t)<=0||a<2)return fr(e);if(t>=1)return lr(e);var a,r=(a-1)*t,i=Math.floor(r),o=lr(function e(t,n){for(var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:t.length-1,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:cr;r>a;){if(r-a>600){var o=r-a+1,s=n-a+1,u=Math.log(o),d=.5*Math.exp(2*u/3),c=.5*Math.sqrt(u*d*(o-d)/o)*(s-o/2<0?-1:1),l=Math.max(a,Math.floor(n-s*d/o+c)),f=Math.min(r,Math.floor(n+(o-s)*d/o+c));e(t,n,l,f,i)}var g=t[n],h=a,p=r;for(gr(t,a,n),i(t[r],g)>0&&gr(t,a,r);h0;)--p}0===i(t[a],g)?gr(t,a,p):gr(t,++p,r),p<=n&&(a=p+1),n<=p&&(r=p-1)}return t}(e,i).subarray(0,i+1));return o+(fr(e.subarray(i+1))-o)*(r-i)}}var mr=function(e,t,n){var a=Float64Array.from(dr(e,n));return a.sort(cr),t.map((function(e){return function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:pr;if(a=e.length){if((t=+t)<=0||a<2)return+n(e[0],0,e);if(t>=1)return+n(e[a-1],a-1,e);var a,r=(a-1)*t,i=Math.floor(r),o=+n(e[i],i,e),s=+n(e[i+1],i+1,e);return o+(s-o)*(r-i)}}(a,e)}))},yr=function(e,t){return mr(e,[.25,.5,.75],t)};var Rr=function(e,t){var n=e.length,a=function(e,t){var n=function(e,t){var n,a=0,r=0,i=0;if(void 0===t){var o,s=sr(e);try{for(s.s();!(o=s.n()).done;){var u=o.value;null!=u&&(u=+u)>=u&&(i+=(n=u-r)*(u-(r+=n/++a)))}}catch(e){s.e(e)}finally{s.f()}}else{var d,c=-1,l=sr(e);try{for(l.s();!(d=l.n()).done;){var f=d.value;null!=(f=t(f,++c,e))&&(f=+f)>=f&&(i+=(n=f-r)*(f-(r+=n/++a)))}}catch(e){l.e(e)}finally{l.f()}}if(a>1)return i/(a-1)}(e,t);return n?Math.sqrt(n):n}(e,t),r=yr(e,t),i=(r[2]-r[0])/1.34;return 1.06*(a=Math.min(a,i)||a||Math.abs(r[0])||1)*Math.pow(n,-.2)},br=function(e){var t,n,a,r,i,o,s,u,d=e.maxbins||20,c=e.base||10,l=Math.log(c),f=e.divide||[5,2],g=e.extent[0],h=e.extent[1],p=e.span||h-g||Math.abs(g)||1;if(e.step)t=e.step;else if(e.steps){for(i=p/d,o=0,s=e.steps.length;od;)t*=c;for(o=0,s=f.length;o=a&&p/i<=d&&(t=i)}return r=(i=Math.log(t))>=0?0:1+~~(-i/l),u=Math.pow(c,-r-1),(e.nice||void 0===e.nice)&&(g=g<(i=Math.floor(g/t+u)*t)?i-t:i,h=Math.ceil(h/t)*t),{start:g,stop:h===g?g+t:h,step:t}},wr=Math.random;function xr(e){wr=e}var _r=function(e,t,n,a){if(!e.length)return[void 0,void 0];var r,i,o,s,u=Float64Array.from(dr(e,a)),d=u.length,c=t;for(o=0,s=Array(c);o=l){for(c=(d+c)/2;i>1);ao;)e[a--]=e[i]}i=o,o=n}return e}(u,t+t/4):u},kr=function(e){return function(){return(e=(1103515245*e+12345)%2147483647)/2147483647}},Cr=function(e,t){null==t&&(t=e,e=0);var n,a,r,i={min:function(e){return arguments.length?(r=a-(n=e||0),i):n},max:function(e){return arguments.length?(r=(a=e||0)-n,i):a},sample:function(){return n+Math.floor(r*wr())},pdf:function(e){return e===Math.floor(e)&&e>=n&&e=a?1:(t-n+1)/r},icdf:function(e){return e>=0&&e<=1?n-1+Math.floor(e*r):NaN}};return i.min(e).max(t)},Or=Math.sqrt(2*Math.PI),Br=Math.SQRT2,Sr=NaN;function Fr(e,t){e=e||0,t=null==t?1:t;var n,a,r=0,i=0;if(Sr==Sr)r=Sr,Sr=NaN;else{do{n=(r=2*wr()-1)*r+(i=2*wr()-1)*i}while(0===n||n>1);r*=a=Math.sqrt(-2*Math.log(n)/n),Sr=i*a}return e+r*t}function jr(e,t,n){var a=(e-(t||0))/(n=null==n?1:n);return Math.exp(-.5*a*a)/(n*Or)}function Dr(e,t,n){var a,r=(e-(t=t||0))/(n=null==n?1:n),i=Math.abs(r);if(i>37)a=0;else{var o=Math.exp(-i*i/2);i<7.07106781186547?(a=o*((((((.0352624965998911*i+.700383064443688)*i+6.37396220353165)*i+33.912866078383)*i+112.079291497871)*i+221.213596169931)*i+220.206867912376),a/=((((((.0883883476483184*i+1.75566716318264)*i+16.064177579207)*i+86.7807322029461)*i+296.564248779674)*i+637.333633378831)*i+793.826512519948)*i+440.413735824752):a=o/(i+1/(i+2/(i+3/(i+4/(i+.65)))))/2.506628274631}return r>0?1-a:a}function Tr(e,t,n){return e<0||e>1?NaN:(t||0)+(null==n?1:n)*Br*function(e){var t,n=-Math.log((1-e)*(1+e));return n<6.25?t=1.6536545626831027+(t=.24015818242558962+(t=(t=(t=.00018673420803405714+(t=(t=(t=4.2347877827932404e-7+(t=(t=(t=1.0512122733215323e-9+(t=(t=(t=26335093153082323e-28+(t=(t=(t=6637638134358324e-30+(t=20972767875968562e-33+(t=(t=11157877678025181e-33+(t=128584807152564e-32+(t=(t=-364441206401782e-35)*(n-=3.125)-16850591381820166e-35)*n)*n)*n-1333171662854621e-31)*n)*n)*n-4054566272975207e-29)*n-8151934197605472e-29)*n)*n-12975133253453532e-27)*n-5415412054294628e-26)*n)*n-4.112633980346984e-9)*n-2.9070369957882005e-8)*n)*n-13654692000834679e-22)*n-13882523362786469e-21)*n)*n-.000740702534166267)*n-.006033670871430149)*n)*n:n<16?t=3.0838856104922208+(t=1.0052589676941592+(t=.005370914553590064+(t=(t=.002491442096107851+(t=(t=.0009532893797373805+(t=(t=24031110387097894e-21+(t=6828485145957318e-20+(t=(t=12475304481671779e-21+(t=29234449089955446e-22+(t=(t=15027403968909828e-22+(t=1.8239629214389228e-8+(t=(t=9.075656193888539e-8+(t=2.2137376921775787e-9)*(n=Math.sqrt(n)-3.25))*n-2.7517406297064545e-7)*n)*n)*n-4013867526981546e-21)*n)*n)*n-47318229009055734e-21)*n)*n)*n-.0003550375203628475)*n)*n-.0016882755560235047)*n)*n-.003751208507569241)*n)*n)*n:Number.isFinite(n)?t=4.849906401408584+(t=1.0103004648645344+(t=(t=(t=7599527703001776e-20+(t=(t=4526062597223154e-21+(t=(t=2.2900482228026655e-7+(t=(t=2.914795345090108e-8+(t=(t=7.61570120807834e-9+(t=(t=1.5076572693500548e-9+(t=(t=-27109920616438573e-27)*(n=Math.sqrt(n)-5)-2.555641816996525e-10)*n)*n-3.789465440126737e-9)*n)*n-1.496002662714924e-8)*n)*n-6.771199775845234e-8)*n)*n-9.9298272942317e-7)*n)*n-1968177810553167e-20)*n)*n-.00021503011930044477)*n-.00013871931833623122)*n)*n:t=1/0,t*e}(2*e-1)}var Mr=function(e,t){var n,a,r={mean:function(e){return arguments.length?(n=e||0,r):n},stdev:function(e){return arguments.length?(a=null==e?1:e,r):a},sample:function(){return Fr(n,a)},pdf:function(e){return jr(e,n,a)},cdf:function(e){return Dr(e,n,a)},icdf:function(e){return Tr(e,n,a)}};return r.mean(e).stdev(t)},Nr=function(e,t){var n=Mr(),a={},r=0;return a.data=function(n){return arguments.length?(e=n,r=n?n.length:0,a.bandwidth(t)):e},a.bandwidth=function(n){return arguments.length?(!(t=n)&&e&&(t=Rr(e)),a):t},a.sample=function(){return e[~~(wr()*r)]+t*n.sample()},a.pdf=function(a){for(var i=0,o=0;o=t&&e<=n?1/(n-t):0}function Vr(e,t,n){return null==n&&(n=null==t?1:t,t=0),en?1:(e-t)/(n-t)}function Wr(e,t,n){return null==n&&(n=null==t?1:t,t=0),e>=0&&e<=1?t+e*(n-t):NaN}var qr=function(e,t){var n,a,r={min:function(e){return arguments.length?(n=e||0,r):n},max:function(e){return arguments.length?(a=null==e?1:e,r):a},sample:function(){return zr(n,a)},pdf:function(e){return Kr(e,n,a)},cdf:function(e){return Vr(e,n,a)},icdf:function(e){return Wr(e,n,a)}};return null==t&&(t=null==e?1:e,e=0),r.min(e).max(t)},Gr=function(e,t,n,a){var r=a-e*e,i=Math.abs(r)<1e-24?0:(n-e*t)/r;return[t-i*e,i]};function Xr(e,t,n,a){e=e.filter((function(e){var a=t(e),r=n(e);return null!=a&&(a=+a)>=a&&null!=r&&(r=+r)>=r})),a&&e.sort((function(e,n){return t(e)-t(n)}));var r,i,o,s,u=e.length,d=new Float64Array(u),c=new Float64Array(u),l=0,f=0,g=0,h=sr(e);try{for(h.s();!(s=h.n()).done;)o=s.value,d[l]=r=+t(o),c[l]=i=+n(o),f+=(r-f)/++l,g+=(i-g)/l}catch(e){h.e(e)}finally{h.f()}for(l=0;l=r&&null!=i&&(i=+i)>=i&&a(r,i,++s)}}catch(e){u.e(e)}finally{u.f()}}var Jr=function(e,t,n,a,r){var i=0,o=0;return Yr(e,t,n,(function(e,t){var n=t-r(e),s=t-a;i+=n*n,o+=s*s})),1-i/o},$r=function(e,t,n){var a=0,r=0,i=0,o=0,s=0;Yr(e,t,n,(function(e,t){++s,a+=(e-a)/s,r+=(t-r)/s,i+=(e*t-i)/s,o+=(e*e-o)/s}));var u=Gr(a,r,i,o),d=function(e){return u[0]+u[1]*e};return{coef:u,predict:d,rSquared:Jr(e,t,n,r,d)}},Zr=function(e,t,n){var a=0,r=0,i=0,o=0,s=0;Yr(e,t,n,(function(e,t){++s,e=Math.log(e),a+=(e-a)/s,r+=(t-r)/s,i+=(e*t-i)/s,o+=(e*e-o)/s}));var u=Gr(a,r,i,o),d=function(e){return u[0]+u[1]*Math.log(e)};return{coef:u,predict:d,rSquared:Jr(e,t,n,r,d)}},ei=n(18),ti=function(e,t,n){var a,r,i,o=Xr(e,t,n),s=Object(ei.a)(o,4),u=s[0],d=(s[1],s[2]),c=s[3],l=0,f=0,g=0,h=0,p=0;Yr(e,t,n,(function(e,t){a=u[p++],r=Math.log(t),l+=(t*r-l)/p,f+=((i=a*t)-f)/p,g+=(i*r-g)/p,h+=(a*i-h)/p}));var A=Gr(f/c,l/c,g/c,h/c),v=Object(ei.a)(A,2),m=v[0],y=v[1],R=function(e){return Math.exp(m+y*(e-d))};return{coef:[Math.exp(m-y*d),y],predict:R,rSquared:Jr(e,t,n,c,R)}},ni=function(e,t,n){var a=0,r=0,i=0,o=0,s=0,u=0;Yr(e,t,n,(function(e,t){var n=Math.log(e),d=Math.log(t);++u,a+=(n-a)/u,r+=(d-r)/u,i+=(n*d-i)/u,o+=(n*n-o)/u,s+=(t-s)/u}));var d=Gr(a,r,i,o),c=function(e){return d[0]*Math.pow(e,d[1])};return d[0]=Math.exp(d[0]),{coef:d,predict:c,rSquared:Jr(e,t,n,s,c)}},ai=function(e,t,n){var a,r,i,o,s=Xr(e,t,n),u=Object(ei.a)(s,4),d=u[0],c=u[1],l=u[2],f=u[3],g=d.length,h=0,p=0,A=0,v=0,m=0;for(a=0;aMath.abs(e[t][r])&&(r=n);for(a=t;a=t;a--)e[a][n]-=e[a][t]*e[t][n]/e[t][t]}for(n=o-1;n>=0;--n){for(i=0,a=n+1;a=0;--r)for(o=t[r],s=1,u[r]+=o,i=1;i<=r;++i)s*=(r+1-i)/i,u[r-i]+=o*Math.pow(n,i)*s;return u[0]+=a,u}var oi=function(e,t){return vr(e,.5,t)},si=function(e,t,n,a){for(var r=Xr(e,t,n,!0),i=Object(ei.a)(r,4),o=i[0],s=i[1],u=i[2],d=i[3],c=o.length,l=Math.max(2,~~(a*c)),f=new Float64Array(c),g=new Float64Array(c),h=new Float64Array(c).fill(1),p=-1;++p<=2;){for(var A=[0,l-1],v=0;vo[R]-m?y:R,w=0,x=0,_=0,E=0,k=0,C=1/Math.abs(o[b]-m||1),O=y;O<=R;++O){var B=o[O],S=s[O],F=ui(Math.abs(m-B)*C)*h[O],j=B*F;w+=F,x+=j,_+=S*F,E+=S*j,k+=B*j}var D=Gr(x/w,_/w,E/w,k/w),T=Object(ei.a)(D,2),M=T[0],N=T[1];f[v]=M+N*m,g[v]=Math.abs(s[v]-f[v]),di(o,v+1,A)}if(2===p)break;var U=oi(g);if(Math.abs(U)<1e-12)break;for(var P,L,I=0;I=1?1e-12:(L=1-P*P)*L}return function(e,t,n,a){for(var r,i=e.length,o=[],s=0,u=0,d=[];s