From 98c8c5bb68a0bfa7cb7d1e5fbf8b342f9e3f8917 Mon Sep 17 00:00:00 2001 From: "Watal M. Iwasaki" Date: Tue, 5 Jul 2022 08:55:47 +0900 Subject: [PATCH] :arrow_up: Update dependencies --- driftr.js | 2 +- package.json | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/driftr.js b/driftr.js index 993179c..00153df 100644 --- a/driftr.js +++ b/driftr.js @@ -1 +1 @@ -(()=>{"use strict";var t={d:(n,e)=>{for(var r in e)t.o(e,r)&&!t.o(n,r)&&Object.defineProperty(n,r,{enumerable:!0,get:e[r]})},o:(t,n)=>Object.prototype.hasOwnProperty.call(t,n),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},n={};function e(t){return t}t.r(n),t.d(n,{heterozygoteAdvantage:()=>Lr,moranHaploid:()=>Xr,wrightFisher:()=>zr,wrightFisherDiploid:()=>Hr,wrightFisherHaploid:()=>Ir});var r=1e-6;function i(t){return"translate("+t+",0)"}function a(t){return"translate(0,"+t+")"}function o(t){return n=>+t(n)}function u(t,n){return n=Math.max(0,t.bandwidth()-2*n)/2,t.round()&&(n=Math.round(n)),e=>+t(e)+n}function s(){return!this.__axis}function l(t,n){var l=[],c=null,h=null,f=6,p=6,d=3,m="undefined"!=typeof window&&window.devicePixelRatio>1?0:.5,g=1===t||4===t?-1:1,v=4===t||2===t?"x":"y",y=1===t||3===t?i:a;function _(i){var a=null==c?n.ticks?n.ticks.apply(n,l):n.domain():c,_=null==h?n.tickFormat?n.tickFormat.apply(n,l):e:h,w=Math.max(f,0)+d,x=n.range(),b=+x[0]+m,M=+x[x.length-1]+m,k=(n.bandwidth?u:o)(n.copy(),m),A=i.selection?i.selection():i,N=A.selectAll(".domain").data([null]),S=A.selectAll(".tick").data(a,n).order(),E=S.exit(),q=S.enter().append("g").attr("class","tick"),C=S.select("line"),P=S.select("text");N=N.merge(N.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),S=S.merge(q),C=C.merge(q.append("line").attr("stroke","currentColor").attr(v+"2",g*f)),P=P.merge(q.append("text").attr("fill","currentColor").attr(v,g*w).attr("dy",1===t?"0em":3===t?"0.71em":"0.32em")),i!==A&&(N=N.transition(i),S=S.transition(i),C=C.transition(i),P=P.transition(i),E=E.transition(i).attr("opacity",r).attr("transform",(function(t){return isFinite(t=k(t))?y(t+m):this.getAttribute("transform")})),q.attr("opacity",r).attr("transform",(function(t){var n=this.parentNode.__axis;return y((n&&isFinite(n=n(t))?n:k(t))+m)}))),E.remove(),N.attr("d",4===t||2===t?p?"M"+g*p+","+b+"H"+m+"V"+M+"H"+g*p:"M"+m+","+b+"V"+M:p?"M"+b+","+g*p+"V"+m+"H"+M+"V"+g*p:"M"+b+","+m+"H"+M),S.attr("opacity",1).attr("transform",(function(t){return y(k(t)+m)})),C.attr(v+"2",g*f),P.attr(v,g*w).text(_),A.filter(s).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",2===t?"start":4===t?"end":"middle"),A.each((function(){this.__axis=k}))}return _.scale=function(t){return arguments.length?(n=t,_):n},_.ticks=function(){return l=Array.from(arguments),_},_.tickArguments=function(t){return arguments.length?(l=null==t?[]:Array.from(t),_):l.slice()},_.tickValues=function(t){return arguments.length?(c=null==t?null:Array.from(t),_):c&&c.slice()},_.tickFormat=function(t){return arguments.length?(h=t,_):h},_.tickSize=function(t){return arguments.length?(f=p=+t,_):f},_.tickSizeInner=function(t){return arguments.length?(f=+t,_):f},_.tickSizeOuter=function(t){return arguments.length?(p=+t,_):p},_.tickPadding=function(t){return arguments.length?(d=+t,_):d},_.offset=function(t){return arguments.length?(m=+t,_):m},_}function c(){}function h(t){return null==t?c:function(){return this.querySelector(t)}}function f(t){return null==t?[]:Array.isArray(t)?t:Array.from(t)}function p(){return[]}function d(t){return null==t?p:function(){return this.querySelectorAll(t)}}function m(t){return function(){return this.matches(t)}}function g(t){return function(n){return n.matches(t)}}var v=Array.prototype.find;function y(){return this.firstElementChild}var _=Array.prototype.filter;function w(){return Array.from(this.children)}function x(t){return new Array(t.length)}function b(t,n){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=n}function M(t){return function(){return t}}function k(t,n,e,r,i,a){for(var o,u=0,s=n.length,l=a.length;un?1:t>=n?0:NaN}b.prototype={constructor:b,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,n){return this._parent.insertBefore(t,n)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};var q="http://www.w3.org/1999/xhtml";const C={svg:"http://www.w3.org/2000/svg",xhtml:q,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function P(t){var n=t+="",e=n.indexOf(":");return e>=0&&"xmlns"!==(n=t.slice(0,e))&&(t=t.slice(e+1)),C.hasOwnProperty(n)?{space:C[n],local:t}:t}function T(t){return function(){this.removeAttribute(t)}}function j(t){return function(){this.removeAttributeNS(t.space,t.local)}}function O(t,n){return function(){this.setAttribute(t,n)}}function F(t,n){return function(){this.setAttributeNS(t.space,t.local,n)}}function z(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttribute(t):this.setAttribute(t,e)}}function I(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,e)}}function H(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function L(t){return function(){this.style.removeProperty(t)}}function X(t,n,e){return function(){this.style.setProperty(t,n,e)}}function D(t,n,e){return function(){var r=n.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,e)}}function R(t,n){return t.style.getPropertyValue(n)||H(t).getComputedStyle(t,null).getPropertyValue(n)}function V(t){return function(){delete this[t]}}function Y(t,n){return function(){this[t]=n}}function $(t,n){return function(){var e=n.apply(this,arguments);null==e?delete this[t]:this[t]=e}}function B(t){return t.trim().split(/^|\s+/)}function U(t){return t.classList||new W(t)}function W(t){this._node=t,this._names=B(t.getAttribute("class")||"")}function Z(t,n){for(var e=U(t),r=-1,i=n.length;++r=0&&(n=t.slice(e+1),t=t.slice(0,e)),{type:t,name:n}}))}function gt(t){return function(){var n=this.__on;if(n){for(var e,r=0,i=-1,a=n.length;r=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var xt=[null];function bt(t,n){this._groups=t,this._parents=n}function Mt(){return new bt([[document.documentElement]],xt)}bt.prototype=Mt.prototype={constructor:bt,select:function(t){"function"!=typeof t&&(t=h(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i=x&&(x=w+1);!(_=g[x])&&++x=0;)(r=i[a])&&(o&&4^r.compareDocumentPosition(o)&&o.parentNode.insertBefore(r,o),o=r);return this},sort:function(t){function n(n,e){return n&&e?t(n.__data__,e.__data__):!n-!e}t||(t=E);for(var e=this._groups,r=e.length,i=new Array(r),a=0;a1?this.each((null==n?L:"function"==typeof n?D:X)(t,n,null==e?"":e)):R(this.node(),t)},property:function(t,n){return arguments.length>1?this.each((null==n?V:"function"==typeof n?$:Y)(t,n)):this.node()[t]},classed:function(t,n){var e=B(t+"");if(arguments.length<2){for(var r=U(this.node()),i=-1,a=e.length;++i{}};function Nt(){for(var t,n=0,e=arguments.length,r={};n=0&&(e=t.slice(r+1),t=t.slice(0,r)),t&&!n.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}}))}function qt(t,n){for(var e,r=0,i=t.length;r0)for(var e,r,i=new Array(e),a=0;a=0&&n._call.call(void 0,t),n=n._next;--Ot}()}finally{Ot=0,function(){for(var t,n,e=Tt,r=1/0;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:Tt=n);jt=t,Wt(r)}(),Ht=0}}function Ut(){var t=Xt.now(),n=t-It;n>1e3&&(Lt-=n,It=t)}function Wt(t){Ot||(Ft&&(Ft=clearTimeout(Ft)),t-Ht>24?(t<1/0&&(Ft=setTimeout(Bt,t-Xt.now()-Lt)),zt&&(zt=clearInterval(zt))):(zt||(It=Xt.now(),zt=setInterval(Ut,1e3)),Ot=1,Dt(Bt)))}function Zt(t,n,e){var r=new Yt;return n=null==n?0:+n,r.restart((e=>{r.stop(),t(e+n)}),n,e),r}Yt.prototype=$t.prototype={constructor:Yt,restart:function(t,n,e){if("function"!=typeof t)throw new TypeError("callback is not a function");e=(null==e?Rt():+e)+(null==n?0:+n),this._next||jt===this||(jt?jt._next=this:Tt=this,jt=this),this._call=t,this._time=e,Wt()},stop:function(){this._call&&(this._call=null,this._time=1/0,Wt())}};var Gt=Pt("start","end","cancel","interrupt"),Jt=[];function Kt(t,n,e,r,i,a){var o=t.__transition;if(o){if(e in o)return}else t.__transition={};!function(t,n,e){var r,i=t.__transition;function a(s){var l,c,h,f;if(1!==e.state)return u();for(l in i)if((f=i[l]).name===e.name){if(3===f.state)return Zt(a);4===f.state?(f.state=6,f.timer.stop(),f.on.call("interrupt",t,t.__data__,f.index,f.group),delete i[l]):+l0)throw new Error("too late; already scheduled");return e}function tn(t,n){var e=nn(t,n);if(e.state>3)throw new Error("too late; already running");return e}function nn(t,n){var e=t.__transition;if(!e||!(e=e[n]))throw new Error("transition not found");return e}function en(t,n){return t=+t,n=+n,function(e){return t*(1-e)+n*e}}var rn,an=180/Math.PI,on={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function un(t,n,e,r,i,a){var o,u,s;return(o=Math.sqrt(t*t+n*n))&&(t/=o,n/=o),(s=t*e+n*r)&&(e-=t*s,r-=n*s),(u=Math.sqrt(e*e+r*r))&&(e/=u,r/=u,s/=u),t*r180?n+=360:n-t>180&&(t+=360),a.push({i:e.push(i(e)+"rotate(",null,r)-2,x:en(t,n)})):n&&e.push(i(e)+"rotate("+n+r)}(a.rotate,o.rotate,u,s),function(t,n,e,a){t!==n?a.push({i:e.push(i(e)+"skewX(",null,r)-2,x:en(t,n)}):n&&e.push(i(e)+"skewX("+n+r)}(a.skewX,o.skewX,u,s),function(t,n,e,r,a,o){if(t!==e||n!==r){var u=a.push(i(a)+"scale(",null,",",null,")");o.push({i:u-4,x:en(t,e)},{i:u-2,x:en(n,r)})}else 1===e&&1===r||a.push(i(a)+"scale("+e+","+r+")")}(a.scaleX,a.scaleY,o.scaleX,o.scaleY,u,s),a=o=null,function(t){for(var n,e=-1,r=s.length;++e>8&15|n>>4&240,n>>4&15|240&n,(15&n)<<4|15&n,1):8===e?On(n>>24&255,n>>16&255,n>>8&255,(255&n)/255):4===e?On(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|240&n,((15&n)<<4|15&n)/255):null):(n=Mn.exec(t))?new In(n[1],n[2],n[3],1):(n=kn.exec(t))?new In(255*n[1]/100,255*n[2]/100,255*n[3]/100,1):(n=An.exec(t))?On(n[1],n[2],n[3],n[4]):(n=Nn.exec(t))?On(255*n[1]/100,255*n[2]/100,255*n[3]/100,n[4]):(n=Sn.exec(t))?Dn(n[1],n[2]/100,n[3]/100,1):(n=En.exec(t))?Dn(n[1],n[2]/100,n[3]/100,n[4]):qn.hasOwnProperty(t)?jn(qn[t]):"transparent"===t?new In(NaN,NaN,NaN,0):null}function jn(t){return new In(t>>16&255,t>>8&255,255&t,1)}function On(t,n,e,r){return r<=0&&(t=n=e=NaN),new In(t,n,e,r)}function Fn(t){return t instanceof gn||(t=Tn(t)),t?new In((t=t.rgb()).r,t.g,t.b,t.opacity):new In}function zn(t,n,e,r){return 1===arguments.length?Fn(t):new In(t,n,e,null==r?1:r)}function In(t,n,e,r){this.r=+t,this.g=+n,this.b=+e,this.opacity=+r}function Hn(){return"#"+Xn(this.r)+Xn(this.g)+Xn(this.b)}function Ln(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?")":", "+t+")")}function Xn(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Dn(t,n,e,r){return r<=0?t=n=e=NaN:e<=0||e>=1?t=n=NaN:n<=0&&(t=NaN),new Vn(t,n,e,r)}function Rn(t){if(t instanceof Vn)return new Vn(t.h,t.s,t.l,t.opacity);if(t instanceof gn||(t=Tn(t)),!t)return new Vn;if(t instanceof Vn)return t;var n=(t=t.rgb()).r/255,e=t.g/255,r=t.b/255,i=Math.min(n,e,r),a=Math.max(n,e,r),o=NaN,u=a-i,s=(a+i)/2;return u?(o=n===a?(e-r)/u+6*(e0&&s<1?0:o,new Vn(o,u,s,t.opacity)}function Vn(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function Yn(t,n,e){return 255*(t<60?n+(e-n)*t/60:t<180?e:t<240?n+(e-n)*(240-t)/60:n)}function $n(t,n,e,r,i){var a=t*t,o=a*t;return((1-3*t+3*a-o)*n+(4-6*a+3*o)*e+(1+3*t+3*a-3*o)*r+o*i)/6}dn(gn,Tn,{copy:function(t){return Object.assign(new this.constructor,this,t)},displayable:function(){return this.rgb().displayable()},hex:Cn,formatHex:Cn,formatHsl:function(){return Rn(this).formatHsl()},formatRgb:Pn,toString:Pn}),dn(In,zn,mn(gn,{brighter:function(t){return t=null==t?yn:Math.pow(yn,t),new In(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?vn:Math.pow(vn,t),new In(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){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:Hn,formatHex:Hn,formatRgb:Ln,toString:Ln})),dn(Vn,(function(t,n,e,r){return 1===arguments.length?Rn(t):new Vn(t,n,e,null==r?1:r)}),mn(gn,{brighter:function(t){return t=null==t?yn:Math.pow(yn,t),new Vn(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?vn:Math.pow(vn,t),new Vn(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),n=isNaN(t)||isNaN(this.s)?0:this.s,e=this.l,r=e+(e<.5?e:1-e)*n,i=2*e-r;return new In(Yn(t>=240?t-240:t+120,i,r),Yn(t,i,r),Yn(t<120?t+240:t-120,i,r),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"hsl(":"hsla(")+(this.h||0)+", "+100*(this.s||0)+"%, "+100*(this.l||0)+"%"+(1===t?")":", "+t+")")}}));const Bn=t=>()=>t;function Un(t,n){var e=n-t;return e?function(t,n){return function(e){return t+e*n}}(t,e):Bn(isNaN(t)?n:t)}const Wn=function t(n){var e=function(t){return 1==(t=+t)?Un:function(n,e){return e-n?function(t,n,e){return t=Math.pow(t,e),n=Math.pow(n,e)-t,e=1/e,function(r){return Math.pow(t+r*n,e)}}(n,e,t):Bn(isNaN(n)?e:n)}}(n);function r(t,n){var r=e((t=zn(t)).r,(n=zn(n)).r),i=e(t.g,n.g),a=e(t.b,n.b),o=Un(t.opacity,n.opacity);return function(n){return t.r=r(n),t.g=i(n),t.b=a(n),t.opacity=o(n),t+""}}return r.gamma=t,r}(1);function Zn(t){return function(n){var e,r,i=n.length,a=new Array(i),o=new Array(i),u=new Array(i);for(e=0;e=1?(e=1,n-1):Math.floor(e*n),i=t[r],a=t[r+1],o=r>0?t[r-1]:2*i-a,u=ra&&(i=n.slice(a,i),u[o]?u[o]+=i:u[++o]=i),(e=e[0])===(r=r[0])?u[o]?u[o]+=r:u[++o]=r:(u[++o]=null,s.push({i:o,x:en(e,r)})),a=Jn.lastIndex;return a=0&&(t=t.slice(0,n)),!t||"start"===t}))}(n)?Qt:tn;return function(){var o=a(this,t),u=o.on;u!==r&&(i=(r=u).copy()).on(n,e),o.on=i}}var ge=kt.prototype.constructor;function ve(t){return function(){this.style.removeProperty(t)}}function ye(t,n,e){return function(r){this.style.setProperty(t,n.call(this,r),e)}}function _e(t,n,e){var r,i;function a(){var a=n.apply(this,arguments);return a!==i&&(r=(i=a)&&ye(t,a,e)),r}return a._value=n,a}function we(t){return function(n){this.textContent=t.call(this,n)}}function xe(t){var n,e;function r(){var r=t.apply(this,arguments);return r!==e&&(n=(e=r)&&we(r)),n}return r._value=t,r}var be=0;function Me(t,n,e,r){this._groups=t,this._parents=n,this._name=e,this._id=r}function ke(){return++be}var Ae=kt.prototype;Me.prototype=function(t){return kt().transition(t)}.prototype={constructor:Me,select:function(t){var n=this._name,e=this._id;"function"!=typeof t&&(t=h(t));for(var r=this._groups,i=r.length,a=new Array(i),o=0;o2&&e.state<5,e.state=6,e.timer.stop(),e.on.call(r?"interrupt":"cancel",t,t.__data__,e.index,e.group),delete a[i]):o=!1;o&&delete t.__transition}}(this,t)}))},kt.prototype.transition=function(t){var n,e;t instanceof Me?(n=t._id,t=t._name):(n=ke(),(e=Ne).time=Rt(),t=null==t?null:t+"");for(var r=this._groups,i=r.length,a=0;a+t;var je=Math.sqrt(50),Oe=Math.sqrt(10),Fe=Math.sqrt(2);function ze(t,n,e){var r=(n-t)/Math.max(0,e),i=Math.floor(Math.log(r)/Math.LN10),a=r/Math.pow(10,i);return i>=0?(a>=je?10:a>=Oe?5:a>=Fe?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(a>=je?10:a>=Oe?5:a>=Fe?2:1)}function Ie(t,n){return null==t||null==n?NaN:tn?1:t>=n?0:NaN}function He(t){let n=t,e=t,r=t;function i(t,n,i=0,a=t.length){if(i>>1;r(t[e],n)<0?i=e+1:a=e}while(it(n)-e,e=Ie,r=(n,e)=>Ie(t(n),e)),{left:i,center:function(t,e,r=0,a=t.length){const o=i(t,e,r,a-1);return o>r&&n(t[o-1],e)>-n(t[o],e)?o-1:o},right:function(t,n,i=0,a=t.length){if(i>>1;r(t[e],n)<=0?i=e+1:a=e}while(in&&(e=t,t=n,n=e),l=function(e){return Math.max(t,Math.min(n,e))}),r=s>2?Qe:Ke,i=a=null,h}function h(n){return null==n||isNaN(n=+n)?e:(i||(i=r(o.map(t),u,s)))(t(l(n)))}return h.invert=function(e){return l(n((a||(a=r(u,o.map(t),en)))(e)))},h.domain=function(t){return arguments.length?(o=Array.from(t,We),c()):o.slice()},h.range=function(t){return arguments.length?(u=Array.from(t),c()):u.slice()},h.rangeRound=function(t){return u=Array.from(t),s=Ue,c()},h.clamp=function(t){return arguments.length?(l=!!t||Ge,c()):l!==Ge},h.interpolate=function(t){return arguments.length?(s=t,c()):s},h.unknown=function(t){return arguments.length?(e=t,h):e},function(e,r){return t=e,n=r,c()}}()(Ge,Ge)}function er(t,n){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(n).domain(t)}return this}var rr,ir=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function ar(t){if(!(n=ir.exec(t)))throw new Error("invalid format: "+t);var n;return new or({fill:n[1],align:n[2],sign:n[3],symbol:n[4],zero:n[5],width:n[6],comma:n[7],precision:n[8]&&n[8].slice(1),trim:n[9],type:n[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 ur(t,n){if((e=(t=n?t.toExponential(n-1):t.toExponential()).indexOf("e"))<0)return null;var e,r=t.slice(0,e);return[r.length>1?r[0]+r.slice(2):r,+t.slice(e+1)]}function sr(t){return(t=ur(Math.abs(t)))?t[1]:NaN}function lr(t,n){var e=ur(t,n);if(!e)return t+"";var r=e[0],i=e[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")}ar.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 cr={"%":(t,n)=>(100*t).toFixed(n),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,n)=>t.toExponential(n),f:(t,n)=>t.toFixed(n),g:(t,n)=>t.toPrecision(n),o:t=>Math.round(t).toString(8),p:(t,n)=>lr(100*t,n),r:lr,s:function(t,n){var e=ur(t,n);if(!e)return t+"";var r=e[0],i=e[1],a=i-(rr=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,o=r.length;return a===o?r:a>o?r+new Array(a-o+1).join("0"):a>0?r.slice(0,a)+"."+r.slice(a):"0."+new Array(1-a).join("0")+ur(t,Math.max(0,n+a-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function hr(t){return t}var fr,pr,dr,mr=Array.prototype.map,gr=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function vr(t){var n=t.domain;return t.ticks=function(t){var e=n();return function(t,n,e){var r,i,a,o,u=-1;if(e=+e,(t=+t)==(n=+n)&&e>0)return[t];if((r=n0){let e=Math.round(t/o),r=Math.round(n/o);for(e*on&&--r,a=new Array(i=r-e+1);++un&&--r,a=new Array(i=r-e+1);++u=je?i*=10:a>=Oe?i*=5:a>=Fe&&(i*=2),n0;){if((i=ze(s,l,e))===r)return a[o]=s,a[u]=l,n(a);if(i>0)s=Math.floor(s/i)*i,l=Math.ceil(l/i)*i;else{if(!(i<0))break;s=Math.ceil(s*i)/i,l=Math.floor(l*i)/i}r=i}return t},t}function yr(){var t=nr();return t.copy=function(){return tr(t,yr())},er.apply(t,arguments),vr(t)}function _r(t){return"string"==typeof t?new bt([[document.querySelector(t)]],[document.documentElement]):new bt([[t]],xt)}fr=function(t){var n,e,r=void 0===t.grouping||void 0===t.thousands?hr:(n=mr.call(t.grouping,Number),e=t.thousands+"",function(t,r){for(var i=t.length,a=[],o=0,u=n[0],s=0;i>0&&u>0&&(s+u+1>r&&(u=Math.max(1,r-s)),a.push(t.substring(i-=u,i+u)),!((s+=u+1)>r));)u=n[o=(o+1)%n.length];return a.reverse().join(e)}),i=void 0===t.currency?"":t.currency[0]+"",a=void 0===t.currency?"":t.currency[1]+"",o=void 0===t.decimal?".":t.decimal+"",u=void 0===t.numerals?hr:function(t){return function(n){return n.replace(/[0-9]/g,(function(n){return t[+n]}))}}(mr.call(t.numerals,String)),s=void 0===t.percent?"%":t.percent+"",l=void 0===t.minus?"−":t.minus+"",c=void 0===t.nan?"NaN":t.nan+"";function h(t){var n=(t=ar(t)).fill,e=t.align,h=t.sign,f=t.symbol,p=t.zero,d=t.width,m=t.comma,g=t.precision,v=t.trim,y=t.type;"n"===y?(m=!0,y="g"):cr[y]||(void 0===g&&(g=12),v=!0,y="g"),(p||"0"===n&&"="===e)&&(p=!0,n="0",e="=");var _="$"===f?i:"#"===f&&/[boxX]/.test(y)?"0"+y.toLowerCase():"",w="$"===f?a:/[%p]/.test(y)?s:"",x=cr[y],b=/[defgprs%]/.test(y);function M(t){var i,a,s,f=_,M=w;if("c"===y)M=x(t)+M,t="";else{var k=(t=+t)<0||1/t<0;if(t=isNaN(t)?c:x(Math.abs(t),g),v&&(t=function(t){t:for(var n,e=t.length,r=1,i=-1;r0&&(i=0)}return i>0?t.slice(0,i)+t.slice(n+1):t}(t)),k&&0==+t&&"+"!==h&&(k=!1),f=(k?"("===h?h:l:"-"===h||"("===h?"":h)+f,M=("s"===y?gr[8+rr/3]:"")+M+(k&&"("===h?")":""),b)for(i=-1,a=t.length;++i(s=t.charCodeAt(i))||s>57){M=(46===s?o+t.slice(i+1):t.slice(i))+M,t=t.slice(0,i);break}}m&&!p&&(t=r(t,1/0));var A=f.length+t.length+M.length,N=A>1)+f+t+M+N.slice(A);break;default:t=N+f+t+M}return u(t)}return g=void 0===g?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,g)):Math.max(0,Math.min(20,g)),M.toString=function(){return t+""},M}return{format:h,formatPrefix:function(t,n){var e=h(((t=ar(t)).type="f",t)),r=3*Math.max(-8,Math.min(8,Math.floor(sr(n)/3))),i=Math.pow(10,-r),a=gr[8+r/3];return function(t){return e(i*t)+a}}}}({thousands:",",grouping:[3],currency:["$",""]}),pr=fr.format,dr=fr.formatPrefix;const wr=Math.PI,xr=2*wr,br=1e-6,Mr=xr-br;function kr(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function Ar(){return new kr}kr.prototype=Ar.prototype={constructor:kr,moveTo:function(t,n){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+n)},closePath:function(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(t,n){this._+="L"+(this._x1=+t)+","+(this._y1=+n)},quadraticCurveTo:function(t,n,e,r){this._+="Q"+ +t+","+ +n+","+(this._x1=+e)+","+(this._y1=+r)},bezierCurveTo:function(t,n,e,r,i,a){this._+="C"+ +t+","+ +n+","+ +e+","+ +r+","+(this._x1=+i)+","+(this._y1=+a)},arcTo:function(t,n,e,r,i){t=+t,n=+n,e=+e,r=+r,i=+i;var a=this._x1,o=this._y1,u=e-t,s=r-n,l=a-t,c=o-n,h=l*l+c*c;if(i<0)throw new Error("negative radius: "+i);if(null===this._x1)this._+="M"+(this._x1=t)+","+(this._y1=n);else if(h>br)if(Math.abs(c*u-s*l)>br&&i){var f=e-a,p=r-o,d=u*u+s*s,m=f*f+p*p,g=Math.sqrt(d),v=Math.sqrt(h),y=i*Math.tan((wr-Math.acos((d+h-m)/(2*g*v)))/2),_=y/v,w=y/g;Math.abs(_-1)>br&&(this._+="L"+(t+_*l)+","+(n+_*c)),this._+="A"+i+","+i+",0,0,"+ +(c*f>l*p)+","+(this._x1=t+w*u)+","+(this._y1=n+w*s)}else this._+="L"+(this._x1=t)+","+(this._y1=n)},arc:function(t,n,e,r,i,a){t=+t,n=+n,a=!!a;var o=(e=+e)*Math.cos(r),u=e*Math.sin(r),s=t+o,l=n+u,c=1^a,h=a?r-i:i-r;if(e<0)throw new Error("negative radius: "+e);null===this._x1?this._+="M"+s+","+l:(Math.abs(this._x1-s)>br||Math.abs(this._y1-l)>br)&&(this._+="L"+s+","+l),e&&(h<0&&(h=h%xr+xr),h>Mr?this._+="A"+e+","+e+",0,1,"+c+","+(t-o)+","+(n-u)+"A"+e+","+e+",0,1,"+c+","+(this._x1=s)+","+(this._y1=l):h>br&&(this._+="A"+e+","+e+",0,"+ +(h>=wr)+","+c+","+(this._x1=t+e*Math.cos(i))+","+(this._y1=n+e*Math.sin(i))))},rect:function(t,n,e,r){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+n)+"h"+ +e+"v"+ +r+"h"+-e+"Z"},toString:function(){return this._}};const Nr=Ar;function Sr(t){return function(){return t}}function Er(t){this._context=t}function qr(t){return new Er(t)}function Cr(t){return t[0]}function Pr(t){return t[1]}function Tr(t,n,e){this.k=t,this.x=n,this.y=e}Array.prototype.slice,Er.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;default:this._context.lineTo(t,n)}}},Tr.prototype={constructor:Tr,scale:function(t){return 1===t?this:new Tr(this.k*t,this.x,this.y)},translate:function(t,n){return 0===t&0===n?this:new Tr(this.k,this.x+this.k*t,this.y+this.k*n)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}},new Tr(1,0,0),Tr.prototype;const jr=function t(n){function e(t,e){var r,i;return t=null==t?0:+t,e=null==e?1:+e,function(){var a;if(null!=r)a=r,r=null;else do{r=2*n()-1,a=2*n()-1,i=r*r+a*a}while(!i||i>1);return t+e*a*Math.sqrt(-2*Math.log(i)/i)}}return e.source=t,e}(Math.random);function Or(t){return Math.random()10&&t*i>10)return e=jr(r,Math.sqrt(r*i))(),e=Math.floor(e+.5),Math.max(Math.min(e,t),0);for(let r=0;rN)",name:"popsize",min:100,max:1e4,step:100,value:1e3},{label:"Selection coefficient (s)",name:"selection",min:-.025,max:.025,step:.001,value:0},{label:"Initital frequency (q0)",name:"frequency",min:0,max:1,step:.01,value:.1},{label:"Observation period",name:"observation",min:500,max:4e4,step:500,value:1e3},{label:"Number of replicates",name:"replicates",min:10,max:50,step:10,value:20}];!function(){!function(t){_r("main").append("form");const n=_r("form").selectAll("dl").data(t).enter().append("dl").attr("id",(function(t){return t.name})).attr("class","parameter");n.append("label").attr("class","value").attr("for",(function(t){return t.name})).text((function(t){return t.value})),n.append("dt").append("label").attr("class","name").attr("for",(function(t){return t.name})).html((function(t){return t.label}));const e=n.append("dd").attr("class","param_range");e.append("input").attr("type","range").attr("name",(function(t){return t.name})).attr("min",(function(t){return t.min})).attr("max",(function(t){return t.max})).attr("step",(function(t){return t.step})).attr("value",(function(t){return t.value})).on("input",(function(t,n){_r("#"+this.name+" label.value").text(this.value),n.value=this.value})),e.append("label").attr("class","min").attr("for",(function(t){return t.name})).text((function(t){return t.min})),e.append("label").attr("class","max").attr("for",(function(t){return t.name})).text((function(t){return t.max}));const r=_r("form").append("dl").attr("class","parameter");r.append("dt").append("label").attr("class","name").text("Model"),r.append("dd").each((function(){_r(this).append("input").attr("type","radio").attr("name","model").attr("value","wrightFisherHaploid").attr("id","wrightFisherHaploid").property("checked",!0),_r(this).append("label").attr("class","radio").attr("for","wrightFisherHaploid").text("Wright-Fisher haploid"),_r(this).append("br"),_r(this).append("input").attr("type","radio").attr("name","model").attr("value","wrightFisherDiploid").attr("id","wrightFisherDiploid"),_r(this).append("label").attr("class","radio").attr("for","wrightFisherDiploid").text("Wright-Fisher diploid (h=0.5)"),_r(this).append("br"),_r(this).append("input").attr("type","radio").attr("name","model").attr("value","heterozygoteAdvantage").attr("id","heterozygoteAdvantage"),_r(this).append("label").attr("class","radio").attr("for","heterozygoteAdvantage").text("Wright-Fisher heterozygote advantage"),_r(this).append("br"),_r(this).append("input").attr("type","radio").attr("name","model").attr("value","moranHaploid").attr("id","moranHaploid"),_r(this).append("label").attr("class","radio").attr("for","moranHaploid").text("Moran haploid")})),_r("form").append("button").attr("type","button").attr("class","start button").text("START!")}(Dr);_r("main").append("div").attr("class","plot");const t=_r(".plot").append("svg"),e=_r(".plot").append("div").attr("class","fixation").selectAll("label").data(["fixed","polymorphic","lost"]).enter().append("div").attr("id",(function(t){return t}));e.append("label").attr("class",(function(){return"name"})).text((function(t){return t})),e.append("label").attr("class",(function(){return"value"}));const r=parseInt(t.style("height"))-20-60,i=t.append("g").attr("class","plot").attr("transform","translate(80,20)");i.append("rect").attr("class","panel_background").attr("height",r),i.append("g").attr("class","panel");const a=yr().domain([0,Dr[3].value]),o=yr().domain([0,1]).range([r,0]),u=l(3,a),s=l(4,o);i.append("g").attr("class","axis x").attr("transform","translate(0,"+r+")").call(u),i.append("g").attr("class","axis y").call(s),i.append("text").attr("class","title x").attr("text-anchor","middle").text("Time (generations)"),i.append("text").attr("class","title y").attr("text-anchor","middle").text("Derived Allele Frequency (q)").attr("transform","translate(-50,"+r/2+") rotate(-90)");const c=function(t,n){var e=Sr(!0),r=null,i=qr,a=null;function o(o){var u,s,l,c=(o=function(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}(o)).length,h=!1;for(null==r&&(a=i(l=Nr())),u=0;u<=c;++u)!(u{"use strict";var t={d:(n,e)=>{for(var r in e)t.o(e,r)&&!t.o(n,r)&&Object.defineProperty(n,r,{enumerable:!0,get:e[r]})},o:(t,n)=>Object.prototype.hasOwnProperty.call(t,n),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},n={};function e(t){return t}t.r(n),t.d(n,{heterozygoteAdvantage:()=>Yr,moranHaploid:()=>Br,wrightFisher:()=>Dr,wrightFisherDiploid:()=>Vr,wrightFisherHaploid:()=>Rr});var r=1e-6;function i(t){return"translate("+t+",0)"}function a(t){return"translate(0,"+t+")"}function o(t){return n=>+t(n)}function u(t,n){return n=Math.max(0,t.bandwidth()-2*n)/2,t.round()&&(n=Math.round(n)),e=>+t(e)+n}function s(){return!this.__axis}function l(t,n){var l=[],c=null,h=null,f=6,p=6,d=3,m="undefined"!=typeof window&&window.devicePixelRatio>1?0:.5,g=1===t||4===t?-1:1,y=4===t||2===t?"x":"y",v=1===t||3===t?i:a;function _(i){var a=null==c?n.ticks?n.ticks.apply(n,l):n.domain():c,_=null==h?n.tickFormat?n.tickFormat.apply(n,l):e:h,w=Math.max(f,0)+d,x=n.range(),b=+x[0]+m,M=+x[x.length-1]+m,k=(n.bandwidth?u:o)(n.copy(),m),A=i.selection?i.selection():i,N=A.selectAll(".domain").data([null]),S=A.selectAll(".tick").data(a,n).order(),E=S.exit(),$=S.enter().append("g").attr("class","tick"),q=S.select("line"),C=S.select("text");N=N.merge(N.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),S=S.merge($),q=q.merge($.append("line").attr("stroke","currentColor").attr(y+"2",g*f)),C=C.merge($.append("text").attr("fill","currentColor").attr(y,g*w).attr("dy",1===t?"0em":3===t?"0.71em":"0.32em")),i!==A&&(N=N.transition(i),S=S.transition(i),q=q.transition(i),C=C.transition(i),E=E.transition(i).attr("opacity",r).attr("transform",(function(t){return isFinite(t=k(t))?v(t+m):this.getAttribute("transform")})),$.attr("opacity",r).attr("transform",(function(t){var n=this.parentNode.__axis;return v((n&&isFinite(n=n(t))?n:k(t))+m)}))),E.remove(),N.attr("d",4===t||2===t?p?"M"+g*p+","+b+"H"+m+"V"+M+"H"+g*p:"M"+m+","+b+"V"+M:p?"M"+b+","+g*p+"V"+m+"H"+M+"V"+g*p:"M"+b+","+m+"H"+M),S.attr("opacity",1).attr("transform",(function(t){return v(k(t)+m)})),q.attr(y+"2",g*f),C.attr(y,g*w).text(_),A.filter(s).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",2===t?"start":4===t?"end":"middle"),A.each((function(){this.__axis=k}))}return _.scale=function(t){return arguments.length?(n=t,_):n},_.ticks=function(){return l=Array.from(arguments),_},_.tickArguments=function(t){return arguments.length?(l=null==t?[]:Array.from(t),_):l.slice()},_.tickValues=function(t){return arguments.length?(c=null==t?null:Array.from(t),_):c&&c.slice()},_.tickFormat=function(t){return arguments.length?(h=t,_):h},_.tickSize=function(t){return arguments.length?(f=p=+t,_):f},_.tickSizeInner=function(t){return arguments.length?(f=+t,_):f},_.tickSizeOuter=function(t){return arguments.length?(p=+t,_):p},_.tickPadding=function(t){return arguments.length?(d=+t,_):d},_.offset=function(t){return arguments.length?(m=+t,_):m},_}function c(){}function h(t){return null==t?c:function(){return this.querySelector(t)}}function f(t){return null==t?[]:Array.isArray(t)?t:Array.from(t)}function p(){return[]}function d(t){return null==t?p:function(){return this.querySelectorAll(t)}}function m(t){return function(){return this.matches(t)}}function g(t){return function(n){return n.matches(t)}}var y=Array.prototype.find;function v(){return this.firstElementChild}var _=Array.prototype.filter;function w(){return Array.from(this.children)}function x(t){return new Array(t.length)}function b(t,n){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=n}function M(t){return function(){return t}}function k(t,n,e,r,i,a){for(var o,u=0,s=n.length,l=a.length;un?1:t>=n?0:NaN}b.prototype={constructor:b,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,n){return this._parent.insertBefore(t,n)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};var $="http://www.w3.org/1999/xhtml";const q={svg:"http://www.w3.org/2000/svg",xhtml:$,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function C(t){var n=t+="",e=n.indexOf(":");return e>=0&&"xmlns"!==(n=t.slice(0,e))&&(t=t.slice(e+1)),q.hasOwnProperty(n)?{space:q[n],local:t}:t}function P(t){return function(){this.removeAttribute(t)}}function T(t){return function(){this.removeAttributeNS(t.space,t.local)}}function j(t,n){return function(){this.setAttribute(t,n)}}function O(t,n){return function(){this.setAttributeNS(t.space,t.local,n)}}function F(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttribute(t):this.setAttribute(t,e)}}function z(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,e)}}function H(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function I(t){return function(){this.style.removeProperty(t)}}function L(t,n,e){return function(){this.style.setProperty(t,n,e)}}function X(t,n,e){return function(){var r=n.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,e)}}function D(t,n){return t.style.getPropertyValue(n)||H(t).getComputedStyle(t,null).getPropertyValue(n)}function R(t){return function(){delete this[t]}}function V(t,n){return function(){this[t]=n}}function Y(t,n){return function(){var e=n.apply(this,arguments);null==e?delete this[t]:this[t]=e}}function B(t){return t.trim().split(/^|\s+/)}function U(t){return t.classList||new W(t)}function W(t){this._node=t,this._names=B(t.getAttribute("class")||"")}function Z(t,n){for(var e=U(t),r=-1,i=n.length;++r=0&&(n=t.slice(e+1),t=t.slice(0,e)),{type:t,name:n}}))}function gt(t){return function(){var n=this.__on;if(n){for(var e,r=0,i=-1,a=n.length;r=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var xt=[null];function bt(t,n){this._groups=t,this._parents=n}function Mt(){return new bt([[document.documentElement]],xt)}bt.prototype=Mt.prototype={constructor:bt,select:function(t){"function"!=typeof t&&(t=h(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i=x&&(x=w+1);!(_=g[x])&&++x=0;)(r=i[a])&&(o&&4^r.compareDocumentPosition(o)&&o.parentNode.insertBefore(r,o),o=r);return this},sort:function(t){function n(n,e){return n&&e?t(n.__data__,e.__data__):!n-!e}t||(t=E);for(var e=this._groups,r=e.length,i=new Array(r),a=0;a1?this.each((null==n?I:"function"==typeof n?X:L)(t,n,null==e?"":e)):D(this.node(),t)},property:function(t,n){return arguments.length>1?this.each((null==n?R:"function"==typeof n?Y:V)(t,n)):this.node()[t]},classed:function(t,n){var e=B(t+"");if(arguments.length<2){for(var r=U(this.node()),i=-1,a=e.length;++i{}};function Nt(){for(var t,n=0,e=arguments.length,r={};n=0&&(e=t.slice(r+1),t=t.slice(0,r)),t&&!n.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}}))}function $t(t,n){for(var e,r=0,i=t.length;r0)for(var e,r,i=new Array(e),a=0;a=0&&n._call.call(void 0,t),n=n._next;--jt}()}finally{jt=0,function(){for(var t,n,e=Pt,r=1/0;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:Pt=n);Tt=t,Wt(r)}(),Ht=0}}function Ut(){var t=Lt.now(),n=t-zt;n>1e3&&(It-=n,zt=t)}function Wt(t){jt||(Ot&&(Ot=clearTimeout(Ot)),t-Ht>24?(t<1/0&&(Ot=setTimeout(Bt,t-Lt.now()-It)),Ft&&(Ft=clearInterval(Ft))):(Ft||(zt=Lt.now(),Ft=setInterval(Ut,1e3)),jt=1,Xt(Bt)))}function Zt(t,n,e){var r=new Vt;return n=null==n?0:+n,r.restart((e=>{r.stop(),t(e+n)}),n,e),r}Vt.prototype=Yt.prototype={constructor:Vt,restart:function(t,n,e){if("function"!=typeof t)throw new TypeError("callback is not a function");e=(null==e?Dt():+e)+(null==n?0:+n),this._next||Tt===this||(Tt?Tt._next=this:Pt=this,Tt=this),this._call=t,this._time=e,Wt()},stop:function(){this._call&&(this._call=null,this._time=1/0,Wt())}};var Gt=Ct("start","end","cancel","interrupt"),Jt=[];function Kt(t,n,e,r,i,a){var o=t.__transition;if(o){if(e in o)return}else t.__transition={};!function(t,n,e){var r,i=t.__transition;function a(s){var l,c,h,f;if(1!==e.state)return u();for(l in i)if((f=i[l]).name===e.name){if(3===f.state)return Zt(a);4===f.state?(f.state=6,f.timer.stop(),f.on.call("interrupt",t,t.__data__,f.index,f.group),delete i[l]):+l0)throw new Error("too late; already scheduled");return e}function tn(t,n){var e=nn(t,n);if(e.state>3)throw new Error("too late; already running");return e}function nn(t,n){var e=t.__transition;if(!e||!(e=e[n]))throw new Error("transition not found");return e}function en(t,n){return t=+t,n=+n,function(e){return t*(1-e)+n*e}}var rn,an=180/Math.PI,on={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function un(t,n,e,r,i,a){var o,u,s;return(o=Math.sqrt(t*t+n*n))&&(t/=o,n/=o),(s=t*e+n*r)&&(e-=t*s,r-=n*s),(u=Math.sqrt(e*e+r*r))&&(e/=u,r/=u,s/=u),t*r180?n+=360:n-t>180&&(t+=360),a.push({i:e.push(i(e)+"rotate(",null,r)-2,x:en(t,n)})):n&&e.push(i(e)+"rotate("+n+r)}(a.rotate,o.rotate,u,s),function(t,n,e,a){t!==n?a.push({i:e.push(i(e)+"skewX(",null,r)-2,x:en(t,n)}):n&&e.push(i(e)+"skewX("+n+r)}(a.skewX,o.skewX,u,s),function(t,n,e,r,a,o){if(t!==e||n!==r){var u=a.push(i(a)+"scale(",null,",",null,")");o.push({i:u-4,x:en(t,e)},{i:u-2,x:en(n,r)})}else 1===e&&1===r||a.push(i(a)+"scale("+e+","+r+")")}(a.scaleX,a.scaleY,o.scaleX,o.scaleY,u,s),a=o=null,function(t){for(var n,e=-1,r=s.length;++e>8&15|n>>4&240,n>>4&15|240&n,(15&n)<<4|15&n,1):8===e?jn(n>>24&255,n>>16&255,n>>8&255,(255&n)/255):4===e?jn(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|240&n,((15&n)<<4|15&n)/255):null):(n=Mn.exec(t))?new zn(n[1],n[2],n[3],1):(n=kn.exec(t))?new zn(255*n[1]/100,255*n[2]/100,255*n[3]/100,1):(n=An.exec(t))?jn(n[1],n[2],n[3],n[4]):(n=Nn.exec(t))?jn(255*n[1]/100,255*n[2]/100,255*n[3]/100,n[4]):(n=Sn.exec(t))?Rn(n[1],n[2]/100,n[3]/100,1):(n=En.exec(t))?Rn(n[1],n[2]/100,n[3]/100,n[4]):$n.hasOwnProperty(t)?Tn($n[t]):"transparent"===t?new zn(NaN,NaN,NaN,0):null}function Tn(t){return new zn(t>>16&255,t>>8&255,255&t,1)}function jn(t,n,e,r){return r<=0&&(t=n=e=NaN),new zn(t,n,e,r)}function On(t){return t instanceof gn||(t=Pn(t)),t?new zn((t=t.rgb()).r,t.g,t.b,t.opacity):new zn}function Fn(t,n,e,r){return 1===arguments.length?On(t):new zn(t,n,e,null==r?1:r)}function zn(t,n,e,r){this.r=+t,this.g=+n,this.b=+e,this.opacity=+r}function Hn(){return`#${Dn(this.r)}${Dn(this.g)}${Dn(this.b)}`}function In(){const t=Ln(this.opacity);return`${1===t?"rgb(":"rgba("}${Xn(this.r)}, ${Xn(this.g)}, ${Xn(this.b)}${1===t?")":`, ${t})`}`}function Ln(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Xn(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Dn(t){return((t=Xn(t))<16?"0":"")+t.toString(16)}function Rn(t,n,e,r){return r<=0?t=n=e=NaN:e<=0||e>=1?t=n=NaN:n<=0&&(t=NaN),new Yn(t,n,e,r)}function Vn(t){if(t instanceof Yn)return new Yn(t.h,t.s,t.l,t.opacity);if(t instanceof gn||(t=Pn(t)),!t)return new Yn;if(t instanceof Yn)return t;var n=(t=t.rgb()).r/255,e=t.g/255,r=t.b/255,i=Math.min(n,e,r),a=Math.max(n,e,r),o=NaN,u=a-i,s=(a+i)/2;return u?(o=n===a?(e-r)/u+6*(e0&&s<1?0:o,new Yn(o,u,s,t.opacity)}function Yn(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function Bn(t){return(t=(t||0)%360)<0?t+360:t}function Un(t){return Math.max(0,Math.min(1,t||0))}function Wn(t,n,e){return 255*(t<60?n+(e-n)*t/60:t<180?e:t<240?n+(e-n)*(240-t)/60:n)}function Zn(t,n,e,r,i){var a=t*t,o=a*t;return((1-3*t+3*a-o)*n+(4-6*a+3*o)*e+(1+3*t+3*a-3*o)*r+o*i)/6}dn(gn,Pn,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:qn,formatHex:qn,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Vn(this).formatHsl()},formatRgb:Cn,toString:Cn}),dn(zn,Fn,mn(gn,{brighter(t){return t=null==t?vn:Math.pow(vn,t),new zn(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?yn:Math.pow(yn,t),new zn(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new zn(Xn(this.r),Xn(this.g),Xn(this.b),Ln(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:Hn,formatHex:Hn,formatHex8:function(){return`#${Dn(this.r)}${Dn(this.g)}${Dn(this.b)}${Dn(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:In,toString:In})),dn(Yn,(function(t,n,e,r){return 1===arguments.length?Vn(t):new Yn(t,n,e,null==r?1:r)}),mn(gn,{brighter(t){return t=null==t?vn:Math.pow(vn,t),new Yn(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?yn:Math.pow(yn,t),new Yn(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+360*(this.h<0),n=isNaN(t)||isNaN(this.s)?0:this.s,e=this.l,r=e+(e<.5?e:1-e)*n,i=2*e-r;return new zn(Wn(t>=240?t-240:t+120,i,r),Wn(t,i,r),Wn(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new Yn(Bn(this.h),Un(this.s),Un(this.l),Ln(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=Ln(this.opacity);return`${1===t?"hsl(":"hsla("}${Bn(this.h)}, ${100*Un(this.s)}%, ${100*Un(this.l)}%${1===t?")":`, ${t})`}`}}));const Gn=t=>()=>t;function Jn(t,n){var e=n-t;return e?function(t,n){return function(e){return t+e*n}}(t,e):Gn(isNaN(t)?n:t)}const Kn=function t(n){var e=function(t){return 1==(t=+t)?Jn:function(n,e){return e-n?function(t,n,e){return t=Math.pow(t,e),n=Math.pow(n,e)-t,e=1/e,function(r){return Math.pow(t+r*n,e)}}(n,e,t):Gn(isNaN(n)?e:n)}}(n);function r(t,n){var r=e((t=Fn(t)).r,(n=Fn(n)).r),i=e(t.g,n.g),a=e(t.b,n.b),o=Jn(t.opacity,n.opacity);return function(n){return t.r=r(n),t.g=i(n),t.b=a(n),t.opacity=o(n),t+""}}return r.gamma=t,r}(1);function Qn(t){return function(n){var e,r,i=n.length,a=new Array(i),o=new Array(i),u=new Array(i);for(e=0;e=1?(e=1,n-1):Math.floor(e*n),i=t[r],a=t[r+1],o=r>0?t[r-1]:2*i-a,u=ra&&(i=n.slice(a,i),u[o]?u[o]+=i:u[++o]=i),(e=e[0])===(r=r[0])?u[o]?u[o]+=r:u[++o]=r:(u[++o]=null,s.push({i:o,x:en(e,r)})),a=ne.lastIndex;return a=0&&(t=t.slice(0,n)),!t||"start"===t}))}(n)?Qt:tn;return function(){var o=a(this,t),u=o.on;u!==r&&(i=(r=u).copy()).on(n,e),o.on=i}}var we=kt.prototype.constructor;function xe(t){return function(){this.style.removeProperty(t)}}function be(t,n,e){return function(r){this.style.setProperty(t,n.call(this,r),e)}}function Me(t,n,e){var r,i;function a(){var a=n.apply(this,arguments);return a!==i&&(r=(i=a)&&be(t,a,e)),r}return a._value=n,a}function ke(t){return function(n){this.textContent=t.call(this,n)}}function Ae(t){var n,e;function r(){var r=t.apply(this,arguments);return r!==e&&(n=(e=r)&&ke(r)),n}return r._value=t,r}var Ne=0;function Se(t,n,e,r){this._groups=t,this._parents=n,this._name=e,this._id=r}function Ee(){return++Ne}var $e=kt.prototype;Se.prototype=function(t){return kt().transition(t)}.prototype={constructor:Se,select:function(t){var n=this._name,e=this._id;"function"!=typeof t&&(t=h(t));for(var r=this._groups,i=r.length,a=new Array(i),o=0;o2&&e.state<5,e.state=6,e.timer.stop(),e.on.call(r?"interrupt":"cancel",t,t.__data__,e.index,e.group),delete a[i]):o=!1;o&&delete t.__transition}}(this,t)}))},kt.prototype.transition=function(t){var n,e;t instanceof Se?(n=t._id,t=t._name):(n=Ee(),(e=qe).time=Dt(),t=null==t?null:t+"");for(var r=this._groups,i=r.length,a=0;a+t;var ze=Math.sqrt(50),He=Math.sqrt(10),Ie=Math.sqrt(2);function Le(t,n,e){var r=(n-t)/Math.max(0,e),i=Math.floor(Math.log(r)/Math.LN10),a=r/Math.pow(10,i);return i>=0?(a>=ze?10:a>=He?5:a>=Ie?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(a>=ze?10:a>=He?5:a>=Ie?2:1)}function Xe(t,n){return null==t||null==n?NaN:tn?1:t>=n?0:NaN}function De(t,n){return null==t||null==n?NaN:nt?1:n>=t?0:NaN}function Re(t){let n,e,r;function i(t,r,i=0,a=t.length){if(i>>1;e(t[n],r)<0?i=n+1:a=n}while(iXe(t(n),e),r=(n,e)=>t(n)-e):(n=t===Xe||t===De?t:Ve,e=t,r=t),{left:i,center:function(t,n,e=0,a=t.length){const o=i(t,n,e,a-1);return o>e&&r(t[o-1],n)>-r(t[o],n)?o-1:o},right:function(t,r,i=0,a=t.length){if(i>>1;e(t[n],r)<=0?i=n+1:a=n}while(in&&(e=t,t=n,n=e),l=function(e){return Math.max(t,Math.min(n,e))}),r=s>2?ar:ir,i=a=null,h}function h(n){return null==n||isNaN(n=+n)?e:(i||(i=r(o.map(t),u,s)))(t(l(n)))}return h.invert=function(e){return l(n((a||(a=r(u,o.map(t),en)))(e)))},h.domain=function(t){return arguments.length?(o=Array.from(t,tr),c()):o.slice()},h.range=function(t){return arguments.length?(u=Array.from(t),c()):u.slice()},h.rangeRound=function(t){return u=Array.from(t),s=Qe,c()},h.clamp=function(t){return arguments.length?(l=!!t||er,c()):l!==er},h.interpolate=function(t){return arguments.length?(s=t,c()):s},h.unknown=function(t){return arguments.length?(e=t,h):e},function(e,r){return t=e,n=r,c()}}()(er,er)}function sr(t,n){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(n).domain(t)}return this}var lr,cr=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function hr(t){if(!(n=cr.exec(t)))throw new Error("invalid format: "+t);var n;return new fr({fill:n[1],align:n[2],sign:n[3],symbol:n[4],zero:n[5],width:n[6],comma:n[7],precision:n[8]&&n[8].slice(1),trim:n[9],type:n[10]})}function fr(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 pr(t,n){if((e=(t=n?t.toExponential(n-1):t.toExponential()).indexOf("e"))<0)return null;var e,r=t.slice(0,e);return[r.length>1?r[0]+r.slice(2):r,+t.slice(e+1)]}function dr(t){return(t=pr(Math.abs(t)))?t[1]:NaN}function mr(t,n){var e=pr(t,n);if(!e)return t+"";var r=e[0],i=e[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")}hr.prototype=fr.prototype,fr.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 gr={"%":(t,n)=>(100*t).toFixed(n),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,n)=>t.toExponential(n),f:(t,n)=>t.toFixed(n),g:(t,n)=>t.toPrecision(n),o:t=>Math.round(t).toString(8),p:(t,n)=>mr(100*t,n),r:mr,s:function(t,n){var e=pr(t,n);if(!e)return t+"";var r=e[0],i=e[1],a=i-(lr=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,o=r.length;return a===o?r:a>o?r+new Array(a-o+1).join("0"):a>0?r.slice(0,a)+"."+r.slice(a):"0."+new Array(1-a).join("0")+pr(t,Math.max(0,n+a-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function yr(t){return t}var vr,_r,wr,xr=Array.prototype.map,br=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Mr(t){var n=t.domain;return t.ticks=function(t){var e=n();return function(t,n,e){var r,i,a,o,u=-1;if(e=+e,(t=+t)==(n=+n)&&e>0)return[t];if((r=n0){let e=Math.round(t/o),r=Math.round(n/o);for(e*on&&--r,a=new Array(i=r-e+1);++un&&--r,a=new Array(i=r-e+1);++u=ze?i*=10:a>=He?i*=5:a>=Ie&&(i*=2),n0;){if((i=Le(s,l,e))===r)return a[o]=s,a[u]=l,n(a);if(i>0)s=Math.floor(s/i)*i,l=Math.ceil(l/i)*i;else{if(!(i<0))break;s=Math.ceil(s*i)/i,l=Math.floor(l*i)/i}r=i}return t},t}function kr(){var t=ur();return t.copy=function(){return or(t,kr())},sr.apply(t,arguments),Mr(t)}function Ar(t){return"string"==typeof t?new bt([[document.querySelector(t)]],[document.documentElement]):new bt([[t]],xt)}vr=function(t){var n,e,r=void 0===t.grouping||void 0===t.thousands?yr:(n=xr.call(t.grouping,Number),e=t.thousands+"",function(t,r){for(var i=t.length,a=[],o=0,u=n[0],s=0;i>0&&u>0&&(s+u+1>r&&(u=Math.max(1,r-s)),a.push(t.substring(i-=u,i+u)),!((s+=u+1)>r));)u=n[o=(o+1)%n.length];return a.reverse().join(e)}),i=void 0===t.currency?"":t.currency[0]+"",a=void 0===t.currency?"":t.currency[1]+"",o=void 0===t.decimal?".":t.decimal+"",u=void 0===t.numerals?yr:function(t){return function(n){return n.replace(/[0-9]/g,(function(n){return t[+n]}))}}(xr.call(t.numerals,String)),s=void 0===t.percent?"%":t.percent+"",l=void 0===t.minus?"−":t.minus+"",c=void 0===t.nan?"NaN":t.nan+"";function h(t){var n=(t=hr(t)).fill,e=t.align,h=t.sign,f=t.symbol,p=t.zero,d=t.width,m=t.comma,g=t.precision,y=t.trim,v=t.type;"n"===v?(m=!0,v="g"):gr[v]||(void 0===g&&(g=12),y=!0,v="g"),(p||"0"===n&&"="===e)&&(p=!0,n="0",e="=");var _="$"===f?i:"#"===f&&/[boxX]/.test(v)?"0"+v.toLowerCase():"",w="$"===f?a:/[%p]/.test(v)?s:"",x=gr[v],b=/[defgprs%]/.test(v);function M(t){var i,a,s,f=_,M=w;if("c"===v)M=x(t)+M,t="";else{var k=(t=+t)<0||1/t<0;if(t=isNaN(t)?c:x(Math.abs(t),g),y&&(t=function(t){t:for(var n,e=t.length,r=1,i=-1;r0&&(i=0)}return i>0?t.slice(0,i)+t.slice(n+1):t}(t)),k&&0==+t&&"+"!==h&&(k=!1),f=(k?"("===h?h:l:"-"===h||"("===h?"":h)+f,M=("s"===v?br[8+lr/3]:"")+M+(k&&"("===h?")":""),b)for(i=-1,a=t.length;++i(s=t.charCodeAt(i))||s>57){M=(46===s?o+t.slice(i+1):t.slice(i))+M,t=t.slice(0,i);break}}m&&!p&&(t=r(t,1/0));var A=f.length+t.length+M.length,N=A>1)+f+t+M+N.slice(A);break;default:t=N+f+t+M}return u(t)}return g=void 0===g?6:/[gprs]/.test(v)?Math.max(1,Math.min(21,g)):Math.max(0,Math.min(20,g)),M.toString=function(){return t+""},M}return{format:h,formatPrefix:function(t,n){var e=h(((t=hr(t)).type="f",t)),r=3*Math.max(-8,Math.min(8,Math.floor(dr(n)/3))),i=Math.pow(10,-r),a=br[8+r/3];return function(t){return e(i*t)+a}}}}({thousands:",",grouping:[3],currency:["$",""]}),_r=vr.format,wr=vr.formatPrefix;const Nr=Math.PI,Sr=2*Nr,Er=1e-6,$r=Sr-Er;function qr(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function Cr(){return new qr}qr.prototype=Cr.prototype={constructor:qr,moveTo:function(t,n){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+n)},closePath:function(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(t,n){this._+="L"+(this._x1=+t)+","+(this._y1=+n)},quadraticCurveTo:function(t,n,e,r){this._+="Q"+ +t+","+ +n+","+(this._x1=+e)+","+(this._y1=+r)},bezierCurveTo:function(t,n,e,r,i,a){this._+="C"+ +t+","+ +n+","+ +e+","+ +r+","+(this._x1=+i)+","+(this._y1=+a)},arcTo:function(t,n,e,r,i){t=+t,n=+n,e=+e,r=+r,i=+i;var a=this._x1,o=this._y1,u=e-t,s=r-n,l=a-t,c=o-n,h=l*l+c*c;if(i<0)throw new Error("negative radius: "+i);if(null===this._x1)this._+="M"+(this._x1=t)+","+(this._y1=n);else if(h>Er)if(Math.abs(c*u-s*l)>Er&&i){var f=e-a,p=r-o,d=u*u+s*s,m=f*f+p*p,g=Math.sqrt(d),y=Math.sqrt(h),v=i*Math.tan((Nr-Math.acos((d+h-m)/(2*g*y)))/2),_=v/y,w=v/g;Math.abs(_-1)>Er&&(this._+="L"+(t+_*l)+","+(n+_*c)),this._+="A"+i+","+i+",0,0,"+ +(c*f>l*p)+","+(this._x1=t+w*u)+","+(this._y1=n+w*s)}else this._+="L"+(this._x1=t)+","+(this._y1=n)},arc:function(t,n,e,r,i,a){t=+t,n=+n,a=!!a;var o=(e=+e)*Math.cos(r),u=e*Math.sin(r),s=t+o,l=n+u,c=1^a,h=a?r-i:i-r;if(e<0)throw new Error("negative radius: "+e);null===this._x1?this._+="M"+s+","+l:(Math.abs(this._x1-s)>Er||Math.abs(this._y1-l)>Er)&&(this._+="L"+s+","+l),e&&(h<0&&(h=h%Sr+Sr),h>$r?this._+="A"+e+","+e+",0,1,"+c+","+(t-o)+","+(n-u)+"A"+e+","+e+",0,1,"+c+","+(this._x1=s)+","+(this._y1=l):h>Er&&(this._+="A"+e+","+e+",0,"+ +(h>=Nr)+","+c+","+(this._x1=t+e*Math.cos(i))+","+(this._y1=n+e*Math.sin(i))))},rect:function(t,n,e,r){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+n)+"h"+ +e+"v"+ +r+"h"+-e+"Z"},toString:function(){return this._}};const Pr=Cr;function Tr(t){return function(){return t}}function jr(t){this._context=t}function Or(t){return new jr(t)}function Fr(t){return t[0]}function zr(t){return t[1]}function Hr(t,n,e){this.k=t,this.x=n,this.y=e}Array.prototype.slice,jr.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;default:this._context.lineTo(t,n)}}},Hr.prototype={constructor:Hr,scale:function(t){return 1===t?this:new Hr(this.k*t,this.x,this.y)},translate:function(t,n){return 0===t&0===n?this:new Hr(this.k,this.x+this.k*t,this.y+this.k*n)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}},new Hr(1,0,0),Hr.prototype;const Ir=function t(n){function e(t,e){var r,i;return t=null==t?0:+t,e=null==e?1:+e,function(){var a;if(null!=r)a=r,r=null;else do{r=2*n()-1,a=2*n()-1,i=r*r+a*a}while(!i||i>1);return t+e*a*Math.sqrt(-2*Math.log(i)/i)}}return e.source=t,e}(Math.random);function Lr(t){return Math.random()10&&t*i>10)return e=Ir(r,Math.sqrt(r*i))(),e=Math.floor(e+.5),Math.max(Math.min(e,t),0);for(let r=0;rN)",name:"popsize",min:100,max:1e4,step:100,value:1e3},{label:"Selection coefficient (s)",name:"selection",min:-.025,max:.025,step:.001,value:0},{label:"Initital frequency (q0)",name:"frequency",min:0,max:1,step:.01,value:.1},{label:"Observation period",name:"observation",min:500,max:4e4,step:500,value:1e3},{label:"Number of replicates",name:"replicates",min:10,max:50,step:10,value:20}];!function(){!function(t){Ar("main").append("form");const n=Ar("form").selectAll("dl").data(t).enter().append("dl").attr("id",(function(t){return t.name})).attr("class","parameter");n.append("label").attr("class","value").attr("for",(function(t){return t.name})).text((function(t){return t.value})),n.append("dt").append("label").attr("class","name").attr("for",(function(t){return t.name})).html((function(t){return t.label}));const e=n.append("dd").attr("class","param_range");e.append("input").attr("type","range").attr("name",(function(t){return t.name})).attr("min",(function(t){return t.min})).attr("max",(function(t){return t.max})).attr("step",(function(t){return t.step})).attr("value",(function(t){return t.value})).on("input",(function(t,n){Ar("#"+this.name+" label.value").text(this.value),n.value=this.value})),e.append("label").attr("class","min").attr("for",(function(t){return t.name})).text((function(t){return t.min})),e.append("label").attr("class","max").attr("for",(function(t){return t.name})).text((function(t){return t.max}));const r=Ar("form").append("dl").attr("class","parameter");r.append("dt").append("label").attr("class","name").text("Model"),r.append("dd").each((function(){Ar(this).append("input").attr("type","radio").attr("name","model").attr("value","wrightFisherHaploid").attr("id","wrightFisherHaploid").property("checked",!0),Ar(this).append("label").attr("class","radio").attr("for","wrightFisherHaploid").text("Wright-Fisher haploid"),Ar(this).append("br"),Ar(this).append("input").attr("type","radio").attr("name","model").attr("value","wrightFisherDiploid").attr("id","wrightFisherDiploid"),Ar(this).append("label").attr("class","radio").attr("for","wrightFisherDiploid").text("Wright-Fisher diploid (h=0.5)"),Ar(this).append("br"),Ar(this).append("input").attr("type","radio").attr("name","model").attr("value","heterozygoteAdvantage").attr("id","heterozygoteAdvantage"),Ar(this).append("label").attr("class","radio").attr("for","heterozygoteAdvantage").text("Wright-Fisher heterozygote advantage"),Ar(this).append("br"),Ar(this).append("input").attr("type","radio").attr("name","model").attr("value","moranHaploid").attr("id","moranHaploid"),Ar(this).append("label").attr("class","radio").attr("for","moranHaploid").text("Moran haploid")})),Ar("form").append("button").attr("type","button").attr("class","start button").text("START!")}(Ur);Ar("main").append("div").attr("class","plot");const t=Ar(".plot").append("svg"),e=Ar(".plot").append("div").attr("class","fixation").selectAll("label").data(["fixed","polymorphic","lost"]).enter().append("div").attr("id",(function(t){return t}));e.append("label").attr("class",(function(){return"name"})).text((function(t){return t})),e.append("label").attr("class",(function(){return"value"}));const r=parseInt(t.style("height"))-20-60,i=t.append("g").attr("class","plot").attr("transform","translate(80,20)");i.append("rect").attr("class","panel_background").attr("height",r),i.append("g").attr("class","panel");const a=kr().domain([0,Ur[3].value]),o=kr().domain([0,1]).range([r,0]),u=l(3,a),s=l(4,o);i.append("g").attr("class","axis x").attr("transform","translate(0,"+r+")").call(u),i.append("g").attr("class","axis y").call(s),i.append("text").attr("class","title x").attr("text-anchor","middle").text("Time (generations)"),i.append("text").attr("class","title y").attr("text-anchor","middle").text("Derived Allele Frequency (q)").attr("transform","translate(-50,"+r/2+") rotate(-90)");const c=function(t,n){var e=Tr(!0),r=null,i=Or,a=null;function o(o){var u,s,l,c=(o=function(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}(o)).length,h=!1;for(null==r&&(a=i(l=Pr())),u=0;u<=c;++u)!(u