diff --git a/CHANGELOG.md b/CHANGELOG.md index 7df31c044..86291147d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,8 @@ ## Unreleased - ??? ### Fixed -* [#562](https://github.com/plotly/dash-bio/pull/576) Fixed abnormal memory consumption with Molecule3dViewer component when selecting residues or rotating the molecule (for more info see [#511](https://github.com/plotly/dash-bio/issues/511)). +* [#576](https://github.com/plotly/dash-bio/pull/576) Fixed abnormal memory consumption with Molecule3dViewer component when selecting residues or rotating the molecule (for more info see [#511](https://github.com/plotly/dash-bio/issues/511)). +* [#575](https://github.com/plotly/dash-bio/pull/575) Bumped Ideogram version to 1.6.0 to fix erratic annotations behavior (for more info see [#524](https://github.com/plotly/dash-bio/issues/524)). ## [0.7.1] - 2021-07-26 diff --git a/dash_bio/async-ideogram.js b/dash_bio/async-ideogram.js index 1e5d96393..27f5f90eb 100644 --- a/dash_bio/async-ideogram.js +++ b/dash_bio/async-ideogram.js @@ -1,3 +1,3 @@ (window.webpackJsonpdash_bio=window.webpackJsonpdash_bio||[]).push([[3],{249:function(module,exports,__webpack_require__){(function(module){var __WEBPACK_AMD_DEFINE_FACTORY__,__WEBPACK_AMD_DEFINE_ARRAY__,__WEBPACK_AMD_DEFINE_RESULT__,n;function _possibleConstructorReturn(t,n){return!n||"object"!==_typeof(n)&&"function"!=typeof n?_assertThisInitialized(t):n}function _assertThisInitialized(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function _getPrototypeOf(t){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function _inherits(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),n&&_setPrototypeOf(t,n)}function _setPrototypeOf(t,n){return(_setPrototypeOf=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}function _classCallCheck(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,n){for(var e=0;e=0&&"xmlns"!==(n=t.slice(0,e))&&(t=t.slice(e+1)),o.hasOwnProperty(n)?{space:o[n],local:t}:t},a=function(t){var n=i(t);return(n.local?function(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}:function(t){return function(){var n=this.ownerDocument,e=this.namespaceURI;return e===r&&n.documentElement.namespaceURI===r?n.createElement(t):n.createElementNS(e,t)}})(n)};function s(){}var c=function(t){return null==t?s:function(){return this.querySelector(t)}};function u(){return[]}var l=function(t){return null==t?u:function(){return this.querySelectorAll(t)}},f=function(t){return function(){return this.matches(t)}};if("undefined"!=typeof document){var h=document.documentElement;if(!h.matches){var d=h.webkitMatchesSelector||h.msMatchesSelector||h.mozMatchesSelector||h.oMatchesSelector;f=function(t){return function(){return d.call(this,t)}}}}var g=f,p=function(t){return new Array(t.length)};function m(t,n){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=n}function v(t,n,e,r,o,i){for(var a,s=0,c=n.length,u=i.length;sn?1:t>=n?0:NaN}m.prototype={constructor:m,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 _=function(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView};function w(t,n){return t.style.getPropertyValue(n)||_(t).getComputedStyle(t,null).getPropertyValue(n)}function x(t){return t.trim().split(/^|\s+/)}function A(t){return t.classList||new k(t)}function k(t){this._node=t,this._names=x(t.getAttribute("class")||"")}function C(t,n){for(var e=A(t),r=-1,o=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 E={},N=null;function H(t,n,e){return t=I(t,n,e),function(n){var e=n.relatedTarget;e&&(e===this||8&e.compareDocumentPosition(this))||t.call(this,n)}}function I(t,n,e){return function(r){var o=N;N=r;try{t.call(this,this.__data__,n,e)}finally{N=o}}}function j(t){return function(){var n=this.__on;if(n){for(var e,r=0,o=-1,i=n.length;r=x&&(x=w+1);!(_=m[x])&&++x=0;)(r=o[i])&&(a&&a!==r.nextSibling&&a.parentNode.insertBefore(r,a),a=r);return this},sort:function(t){function n(n,e){return n&&e?t(n.__data__,e.__data__):!n-!e}t||(t=b);for(var e=this._groups,r=e.length,o=new Array(r),i=0;i1?this.each((null==n?function(t){return function(){this.style.removeProperty(t)}}:"function"==typeof n?function(t,n,e){return function(){var r=n.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,e)}}:function(t,n,e){return function(){this.style.setProperty(t,n,e)}})(t,n,null==e?"":e)):w(this.node(),t)},property:function(t,n){return arguments.length>1?this.each((null==n?function(t){return function(){delete this[t]}}:"function"==typeof n?function(t,n){return function(){var e=n.apply(this,arguments);null==e?delete this[t]:this[t]=e}}:function(t,n){return function(){this[t]=n}})(t,n)):this.node()[t]},classed:function(t,n){var e=x(t+"");if(arguments.length<2){for(var r=A(this.node()),o=-1,i=e.length;++o=0&&(n=t.slice(e+1),t=t.slice(0,e)),{type:t,name:n}}))}(t+""),a=i.length;if(!(arguments.length<2)){for(s=n?R:j,null==e&&(e=!1),r=0;r=i?l=!0:10===(r=t.charCodeAt(a++))?f=!0:13===r&&(f=!0,10===t.charCodeAt(a)&&++a),t.slice(o+1,n-1).replace(/""/g,'"')}for(;a>>1;e>>1;t(n[i])>>1);--i>0;)e(t,i,o,n);return t}function e(n,e,r,o){for(var i,a=n[--o+e],s=t(a);(i=e<<1)<=r&&(it(n[o+i+1])&&i++,!(s<=t(n[o+i])));)n[o+e]=n[o+i],e=i;n[o+e]=a}return n.sort=function(t,n,r){for(var o,i=r-n;--i>0;)o=t[n],t[n]=t[n+i],t[n+i]=o,e(t,1,i,n);return t},n}function a(t){var n=i(t);return function(e,r,o,i){var a,s,c,u=new Array(i=Math.min(o-r,i));for(s=0;sa&&(u[0]=c,a=t(n(u,0,i)[0]))}while(++re&&t(n[i-1])>s;--i)n[i]=n[i-1];n[i]=a}return n}}function c(t){var n=s(t);return function e(r,o,i){return(i-o>1,l=u-a,f=u+a,h=n[s],d=t(h),g=n[l],p=t(g),m=n[u],v=t(m),y=n[f],b=t(y),_=n[c],w=t(_);d>p&&(i=h,h=g,g=i,i=d,d=p,p=i),b>w&&(i=y,y=_,_=i,i=b,b=w,w=i),d>v&&(i=h,h=m,m=i,i=d,d=v,v=i),p>v&&(i=g,g=m,m=i,i=p,p=v,v=i),d>b&&(i=h,h=y,y=i,i=d,d=b,b=i),v>b&&(i=m,m=y,y=i,i=v,v=b,b=i),p>w&&(i=g,g=_,_=i,i=p,p=w,w=i),p>v&&(i=g,g=m,m=i,i=p,p=v,v=i),b>w&&(i=y,y=_,_=i,i=b,b=w,w=i);var x=g,A=p,k=y,C=b;n[s]=h,n[l]=n[r],n[u]=m,n[f]=n[o-1],n[c]=_;var T=r+1,M=o-2,S=A<=C&&A>=C;if(S)for(var L=T;L<=M;++L){var D=n[L];if((O=t(D))A)for(;;){if(!((P=t(n[M]))>A)){if(PC)for(;;){if(!((P=t(n[M]))>C)){Pc){for(var B;(B=t(n[T]))<=A&&B>=A;)++T;for(;(P=t(n[M]))<=C&&P>=C;)--M;for(L=T;L<=M;L++){var O;if(D=n[L],(O=t(D))<=A&&O>=A)L!==T&&(n[L]=n[T],n[T]=D),T++;else if(O<=C&&O>=C)for(;;){var P;if(!((P=t(n[M]))<=C&&P>=C)){P32)throw new Error("invalid array width!");return t};function p(t){for(var n=new Array(t),e=-1;++er;)h[--s]=0},dimension:function(t){var l,M,S,L,D,B={filter:function(t){return null==t?X():Array.isArray(t)?q(t):"function"==typeof t?$(t):z(t)},filterExact:z,filterRange:q,filterFunction:$,filterAll:X,top:function(t){for(var n,e=[],r=j;--r>=I&&t>0;)h[n=M[r]]||(e.push(o[n]),--t);return e},bottom:function(t){for(var n,e=[],r=I;r0;)h[n=M[r]]||(e.push(o[n]),--t),r++;return e},group:G,groupAll:function(){var t=G(v),n=t.all;return delete t.all,delete t.top,delete t.order,delete t.orderNatural,delete t.size,t.value=function(){return n()[0].value},t},dispose:Q,remove:Q},O=~u&-~u,P=~O,F=c((function(t){return S[t]})),E=m,N=[],H=[],I=0,j=0;function R(n,r,o){S=n.map(t),L=F(function(t){for(var n=k(t,t),e=-1;++eI)for(r=I,o=Math.min(n,j);rj)for(r=Math.max(n,j),o=e;r1?d(c,s):k(s,D),M&&(f=(l=w[0]).key);N=y);)++N;for(;N_||(c[u=e[N]+i]=B,h[u]&P||(b.value=A(b.value,o[u])),++N>=a));)y=t(n[N]);H()}for(;OO)for(O=0;O1?(F=U,E=z):(!B&&j&&(B=1,r=[{key:null,value:T()}]),1===B?(F=Y,E=q):(F=v,E=v),c=null),p[u]=F}function W(){if(B>1){for(var t=B,n=r,e=k(t,t),o=0,i=0;o1)for(o=0;o1?(E=z,F=U):1===B?(E=q,F=Y):E=F=v}else if(1===B){if(j)return;for(o=0;o=0&&p.splice(t,1),(t=N.indexOf(R))>=0&&N.splice(t,1),(t=T.indexOf(W))>=0&&T.splice(t,1),e}return arguments.length<1&&(t=n),p.push(F),N.push(R),T.push(W),R(l,M,0,s),V().orderNatural()}function Q(){H.forEach((function(t){t.dispose()}));var t=A.indexOf(R);return t>=0&&A.splice(t,1),(t=A.indexOf(W))>=0&&A.splice(t,1),(t=T.indexOf(U))>=0&&T.splice(t,1),u&=P,X()}return A.unshift(R),A.push(W),T.push(U),u|=O,(f>=32?!O:u&-(1<=0&&p.splice(t),(t=A.indexOf(c))>=0&&A.splice(t),i}return p.push(u),A.push(c),c(0,0),f()},size:function(){return s}},o=[],s=0,u=0,f=8,h=l(0),p=[],A=[],T=[];function M(n){var e=s,r=n.length;return r&&(o=o.concat(n),h=d(h,s+=r),A.forEach((function(t){t(n,e,r)}))),t}return arguments.length?M(arguments[0]):t}function k(t,n){return(n<257?l:n<65537?f:h)(t)}function C(t){return 8===t?256:16===t?65536:4294967296}"undefined"!=typeof Uint8Array&&(l=function(t){return new Uint8Array(t)},f=function(t){return new Uint16Array(t)},h=function(t){return new Uint32Array(t)},d=function(t,n){if(t.length>=n)return t;var e=new t.constructor(n);return e.set(t),e},g=function(t,n){var e;switch(n){case 16:e=f(t.length);break;case 32:e=h(t.length);break;default:throw new Error("invalid array width!")}return e.set(t),e}),t.crossfilter=A}(void 0!==n&&n||this)},function(t,n,e){"use strict";e.r(n);var r={};e.r(r),e.d(r,"dispatch",(function(){return h}));var o={};e.r(o),e.d(o,"brush",(function(){return qn})),e.d(o,"brushX",(function(){return Yn})),e.d(o,"brushY",(function(){return zn})),e.d(o,"brushSelection",(function(){return Un}));var i=e(0),a=e(2),s={value:function(){}};function c(){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}}))}(t+"",r),i=-1,a=o.length;if(!(arguments.length<2)){if(null!=n&&"function"!=typeof n)throw new Error("invalid callback: "+n);for(;++i0)for(var e,r,o=new Array(e),i=0;i>8&15|n>>4&240,n>>4&15|240&n,(15&n)<<4|15&n,1):(n=A.exec(t))?O(parseInt(n[1],16)):(n=k.exec(t))?new N(n[1],n[2],n[3],1):(n=C.exec(t))?new N(255*n[1]/100,255*n[2]/100,255*n[3]/100,1):(n=T.exec(t))?P(n[1],n[2],n[3],n[4]):(n=M.exec(t))?P(255*n[1]/100,255*n[2]/100,255*n[3]/100,n[4]):(n=S.exec(t))?I(n[1],n[2]/100,n[3]/100,1):(n=L.exec(t))?I(n[1],n[2]/100,n[3]/100,n[4]):D.hasOwnProperty(t)?O(D[t]):"transparent"===t?new N(NaN,NaN,NaN,0):null}function O(t){return new N(t>>16&255,t>>8&255,255&t,1)}function P(t,n,e,r){return r<=0&&(t=n=e=NaN),new N(t,n,e,r)}function F(t){return t instanceof y||(t=B(t)),t?new N((t=t.rgb()).r,t.g,t.b,t.opacity):new N}function E(t,n,e,r){return 1===arguments.length?F(t):new N(t,n,e,null==r?1:r)}function N(t,n,e,r){this.r=+t,this.g=+n,this.b=+e,this.opacity=+r}function H(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function I(t,n,e,r){return r<=0?t=n=e=NaN:e<=0||e>=1?t=n=NaN:n<=0&&(t=NaN),new R(t,n,e,r)}function j(t,n,e,r){return 1===arguments.length?function(t){if(t instanceof R)return new R(t.h,t.s,t.l,t.opacity);if(t instanceof y||(t=B(t)),!t)return new R;if(t instanceof R)return t;var n=(t=t.rgb()).r/255,e=t.g/255,r=t.b/255,o=Math.min(n,e,r),i=Math.max(n,e,r),a=NaN,s=i-o,c=(i+o)/2;return s?(a=n===i?(e-r)/s+6*(e0&&c<1?0:a,new R(a,s,c,t.opacity)}(t):new R(t,n,e,null==r?1:r)}function R(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function W(t,n,e){return 255*(t<60?n+(e-n)*t/60:t<180?e:t<240?n+(e-n)*(240-t)/60:n)}m(y,B,{displayable:function(){return this.rgb().displayable()},hex:function(){return this.rgb().hex()},toString:function(){return this.rgb()+""}}),m(N,E,v(y,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new N(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new N(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return 0<=this.r&&this.r<=255&&0<=this.g&&this.g<=255&&0<=this.b&&this.b<=255&&0<=this.opacity&&this.opacity<=1},hex:function(){return"#"+H(this.r)+H(this.g)+H(this.b)},toString:function(){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+")")}})),m(R,j,v(y,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new R(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new R(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,o=2*e-r;return new N(W(t>=240?t-240:t+120,o,r),W(t,o,r),W(t<120?t+240:t-120,o,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}}));var U=Math.PI/180,Y=180/Math.PI,z=.96422,q=.82521,X=6/29,$=3*X*X;function V(t){if(t instanceof G)return new G(t.l,t.a,t.b,t.opacity);if(t instanceof et){if(isNaN(t.h))return new G(t.l,0,0,t.opacity);var n=t.h*U;return new G(t.l,Math.cos(n)*t.c,Math.sin(n)*t.c,t.opacity)}t instanceof N||(t=F(t));var e,r,o=J(t.r),i=J(t.g),a=J(t.b),s=Q((.2225045*o+.7168786*i+.0606169*a)/1);return o===i&&i===a?e=r=s:(e=Q((.4360747*o+.3850649*i+.1430804*a)/z),r=Q((.0139322*o+.0971045*i+.7141733*a)/q)),new G(116*s-16,500*(e-s),200*(s-r),t.opacity)}function G(t,n,e,r){this.l=+t,this.a=+n,this.b=+e,this.opacity=+r}function Q(t){return t>.008856451679035631?Math.pow(t,1/3):t/$+4/29}function K(t){return t>X?t*t*t:$*(t-4/29)}function Z(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function J(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function tt(t){if(t instanceof et)return new et(t.h,t.c,t.l,t.opacity);if(t instanceof G||(t=V(t)),0===t.a&&0===t.b)return new et(NaN,0,t.l,t.opacity);var n=Math.atan2(t.b,t.a)*Y;return new et(n<0?n+360:n,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}function nt(t,n,e,r){return 1===arguments.length?tt(t):new et(t,n,e,null==r?1:r)}function et(t,n,e,r){this.h=+t,this.c=+n,this.l=+e,this.opacity=+r}m(G,(function(t,n,e,r){return 1===arguments.length?V(t):new G(t,n,e,null==r?1:r)}),v(y,{brighter:function(t){return new G(this.l+18*(null==t?1:t),this.a,this.b,this.opacity)},darker:function(t){return new G(this.l-18*(null==t?1:t),this.a,this.b,this.opacity)},rgb:function(){var t=(this.l+16)/116,n=isNaN(this.a)?t:t+this.a/500,e=isNaN(this.b)?t:t-this.b/200;return new N(Z(3.1338561*(n=z*K(n))-1.6168667*(t=1*K(t))-.4906146*(e=q*K(e))),Z(-.9787684*n+1.9161415*t+.033454*e),Z(.0719453*n-.2289914*t+1.4052427*e),this.opacity)}})),m(et,nt,v(y,{brighter:function(t){return new et(this.h,this.c,this.l+18*(null==t?1:t),this.opacity)},darker:function(t){return new et(this.h,this.c,this.l-18*(null==t?1:t),this.opacity)},rgb:function(){return V(this).rgb()}}));var rt=1.78277,ot=-.29227,it=-.90649,at=1.97294,st=at*it,ct=at*rt,ut=rt*ot- -.14861*it;function lt(t,n,e,r){return 1===arguments.length?function(t){if(t instanceof ft)return new ft(t.h,t.s,t.l,t.opacity);t instanceof N||(t=F(t));var n=t.r/255,e=t.g/255,r=t.b/255,o=(ut*r+st*n-ct*e)/(ut+st-ct),i=r-o,a=(at*(e-o)-ot*i)/it,s=Math.sqrt(a*a+i*i)/(at*o*(1-o)),c=s?Math.atan2(a,i)*Y-120:NaN;return new ft(c<0?c+360:c,s,o,t.opacity)}(t):new ft(t,n,e,null==r?1:r)}function ft(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function ht(t,n,e,r,o){var i=t*t,a=i*t;return((1-3*t+3*i-a)*n+(4-6*i+3*a)*e+(1+3*t+3*i-3*a)*r+a*o)/6}m(ft,lt,v(y,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new ft(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new ft(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=isNaN(this.h)?0:(this.h+120)*U,n=+this.l,e=isNaN(this.s)?0:this.s*n*(1-n),r=Math.cos(t),o=Math.sin(t);return new N(255*(n+e*(-.14861*r+rt*o)),255*(n+e*(ot*r+it*o)),255*(n+e*(at*r)),this.opacity)}}));var dt=function(t){return function(){return t}};function gt(t,n){return function(e){return t+e*n}}function pt(t,n){var e=n-t;return e?gt(t,e>180||e<-180?e-360*Math.round(e/360):e):dt(isNaN(t)?n:t)}function mt(t,n){var e=n-t;return e?gt(t,e):dt(isNaN(t)?n:t)}var vt=function t(n){var e=function(t){return 1==(t=+t)?mt: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):dt(isNaN(n)?e:n)}}(n);function r(t,n){var r=e((t=E(t)).r,(n=E(n)).r),o=e(t.g,n.g),i=e(t.b,n.b),a=mt(t.opacity,n.opacity);return function(n){return t.r=r(n),t.g=o(n),t.b=i(n),t.opacity=a(n),t+""}}return r.gamma=t,r}(1);function yt(t){return function(n){var e,r,o=n.length,i=new Array(o),a=new Array(o),s=new Array(o);for(e=0;e=1?(e=1,n-1):Math.floor(e*n),o=t[r],i=t[r+1],a=r>0?t[r-1]:2*o-i,s=ri&&(o=n.slice(i,o),s[a]?s[a]+=o:s[++a]=o),(e=e[0])===(r=r[0])?s[a]?s[a]+=r:s[++a]=r:(s[++a]=null,c.push({i:a,x:At(e,r)})),i=Ct.lastIndex;return i180?n+=360:n-t>180&&(t+=360),i.push({i:e.push(o(e)+"rotate(",null,r)-2,x:At(t,n)})):n&&e.push(o(e)+"rotate("+n+r)}(i.rotate,a.rotate,s,c),function(t,n,e,i){t!==n?i.push({i:e.push(o(e)+"skewX(",null,r)-2,x:At(t,n)}):n&&e.push(o(e)+"skewX("+n+r)}(i.skewX,a.skewX,s,c),function(t,n,e,r,i,a){if(t!==e||n!==r){var s=i.push(o(i)+"scale(",null,",",null,")");a.push({i:s-4,x:At(t,e)},{i:s-2,x:At(n,r)})}else 1===e&&1===r||i.push(o(i)+"scale("+e+","+r+")")}(i.scaleX,i.scaleY,a.scaleX,a.scaleY,s,c),i=a=null,function(t){for(var n,e=-1,r=c.length;++e=0&&n._call.call(null,t),n=n._next;--Wt}()}finally{Wt=0,function(){for(var t,n,e=It,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:It=n);jt=t,nn(r)}(),qt=0}}function tn(){var t=$t.now(),n=t-zt;n>1e3&&(Xt-=n,zt=t)}function nn(t){Wt||(Ut&&(Ut=clearTimeout(Ut)),t-qt>24?(t<1/0&&(Ut=setTimeout(Jt,t-$t.now()-Xt)),Yt&&(Yt=clearInterval(Yt))):(Yt||(zt=$t.now(),Yt=setInterval(tn,1e3)),Wt=1,Vt(Jt)))}Kt.prototype=Zt.prototype={constructor:Kt,restart:function(t,n,e){if("function"!=typeof t)throw new TypeError("callback is not a function");e=(null==e?Gt():+e)+(null==n?0:+n),this._next||jt===this||(jt?jt._next=this:It=this,jt=this),this._call=t,this._time=e,nn()},stop:function(){this._call&&(this._call=null,this._time=1/0,nn())}};var en=function(t,n,e){var r=new Kt;return n=null==n?0:+n,r.restart((function(e){r.stop(),t(e+n)}),n,e),r},rn=h("start","end","interrupt"),on=[],an=function(t,n,e,r,o,i){var a=t.__transition;if(a){if(e in a)return}else t.__transition={};!function(t,n,e){var r,o=t.__transition;function i(c){var u,l,f,h;if(1!==e.state)return s();for(u in o)if((h=o[u]).name===e.name){if(3===h.state)return en(i);4===h.state?(h.state=6,h.timer.stop(),h.on.call("interrupt",t,t.__data__,h.index,h.group),delete o[u]):+u0)throw new Error("too late; already scheduled");return e}function cn(t,n){var e=un(t,n);if(e.state>2)throw new Error("too late; already started");return e}function un(t,n){var e=t.__transition;if(!e||!(e=e[n]))throw new Error("transition not found");return e}var ln=function(t,n){var e,r,o,i=t.__transition,a=!0;if(i){for(o in n=null==n?null:n+"",i)(e=i[o]).name===n?(r=e.state>2&&e.state<5,e.state=6,e.timer.stop(),r&&e.on.call("interrupt",t,t.__data__,e.index,e.group),delete i[o]):a=!1;a&&delete t.__transition}};function fn(t,n,e){var r=t._id;return t.each((function(){var t=cn(this,r);(t.value||(t.value={}))[n]=e.apply(this,arguments)})),function(t){return un(t,r).value[n]}}var hn=function(t,n){var e;return("number"==typeof n?At:n instanceof B?vt:(e=B(n))?(n=e,vt):Tt)(t,n)},dn=i.selection.prototype.constructor,gn=0;function pn(t,n,e,r){this._groups=t,this._parents=n,this._name=e,this._id=r}function mn(){return++gn}var vn=i.selection.prototype;pn.prototype=function(t){return Object(i.selection)().transition(t)}.prototype={constructor:pn,select:function(t){var n=this._name,e=this._id;"function"!=typeof t&&(t=Object(i.selector)(t));for(var r=this._groups,o=r.length,a=new Array(o),s=0;s=0&&(t=t.slice(0,n)),!t||"start"===t}))}(n)?sn:cn;return function(){var a=i(this,t),s=a.on;s!==r&&(o=(r=s).copy()).on(n,e),a.on=o}}(e,t,n))},attr:function(t,n){var e=Object(i.namespace)(t),r="transform"===e?Ft:hn;return this.attrTween(t,"function"==typeof n?(e.local?function(t,n,e){var r,o,i;return function(){var a,s=e(this);if(null!=s)return(a=this.getAttributeNS(t.space,t.local))===s?null:a===r&&s===o?i:i=n(r=a,o=s);this.removeAttributeNS(t.space,t.local)}}:function(t,n,e){var r,o,i;return function(){var a,s=e(this);if(null!=s)return(a=this.getAttribute(t))===s?null:a===r&&s===o?i:i=n(r=a,o=s);this.removeAttribute(t)}})(e,r,fn(this,"attr."+t,n)):null==n?(e.local?function(t){return function(){this.removeAttributeNS(t.space,t.local)}}:function(t){return function(){this.removeAttribute(t)}})(e):(e.local?function(t,n,e){var r,o;return function(){var i=this.getAttributeNS(t.space,t.local);return i===e?null:i===r?o:o=n(r=i,e)}}:function(t,n,e){var r,o;return function(){var i=this.getAttribute(t);return i===e?null:i===r?o:o=n(r=i,e)}})(e,r,n+""))},attrTween:function(t,n){var e="attr."+t;if(arguments.length<2)return(e=this.tween(e))&&e._value;if(null==n)return this.tween(e,null);if("function"!=typeof n)throw new Error;var r=Object(i.namespace)(t);return this.tween(e,(r.local?function(t,n){function e(){var e=this,r=n.apply(e,arguments);return r&&function(n){e.setAttributeNS(t.space,t.local,r(n))}}return e._value=n,e}:function(t,n){function e(){var e=this,r=n.apply(e,arguments);return r&&function(n){e.setAttribute(t,r(n))}}return e._value=n,e})(r,n))},style:function(t,n,e){var r="transform"==(t+="")?Pt:hn;return null==n?this.styleTween(t,function(t,n){var e,r,o;return function(){var a=Object(i.style)(this,t),s=(this.style.removeProperty(t),Object(i.style)(this,t));return a===s?null:a===e&&s===r?o:o=n(e=a,r=s)}}(t,r)).on("end.style."+t,function(t){return function(){this.style.removeProperty(t)}}(t)):this.styleTween(t,"function"==typeof n?function(t,n,e){var r,o,a;return function(){var s=Object(i.style)(this,t),c=e(this);return null==c&&(this.style.removeProperty(t),c=Object(i.style)(this,t)),s===c?null:s===r&&c===o?a:a=n(r=s,o=c)}}(t,r,fn(this,"style."+t,n)):function(t,n,e){var r,o;return function(){var a=Object(i.style)(this,t);return a===e?null:a===r?o:o=n(r=a,e)}}(t,r,n+""),e)},styleTween:function(t,n,e){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==n)return this.tween(r,null);if("function"!=typeof n)throw new Error;return this.tween(r,function(t,n,e){function r(){var r=this,o=n.apply(r,arguments);return o&&function(n){r.style.setProperty(t,o(n),e)}}return r._value=n,r}(t,n,null==e?"":e))},text:function(t){return this.tween("text","function"==typeof t?function(t){return function(){var n=t(this);this.textContent=null==n?"":n}}(fn(this,"text",t)):function(t){return function(){this.textContent=t}}(null==t?"":t+""))},remove:function(){return this.on("end.remove",function(t){return function(){var n=this.parentNode;for(var e in this.__transition)if(+e!==t)return;n&&n.removeChild(this)}}(this._id))},tween:function(t,n){var e=this._id;if(t+="",arguments.length<2){for(var r,o=un(this.node(),e).tween,i=0,a=o.length;i0&&(e=o-m),C<0?h=d-v:C>0&&(a=s-v),A=Tn,I.attr("cursor",On.selection),W());break;default:return}kn()}),!0).on("keyup.brush",(function(){switch(i.event.keyCode){case 16:P&&(b=_=P=!1,W());break;case 18:A===Sn&&(k<0?l=f:k>0&&(e=o),C<0?h=d:C>0&&(a=s),A=Mn,W());break;case 32:A===Tn&&(i.event.altKey?(k&&(l=f-m*k,e=o+m*k),C&&(h=d-v*C,a=s+v*C),A=Sn):(k<0?l=f:k>0&&(e=o),C<0?h=d:C>0&&(a=s),A=Mn),I.attr("cursor",On[x]),W());break;default:return}kn()}),!0).on("mousemove.brush",R,!0).on("mouseup.brush",U,!0);g(i.event.view)}An(),ln(w),c.call(w),N.start()}function R(){var t=Object(i.mouse)(w);!P||b||_||(Math.abs(t[0]-E[0])>Math.abs(t[1]-E[1])?_=!0:b=!0),E=t,y=!0,kn(),W()}function W(){var t;switch(m=E[0]-F[0],v=E[1]-F[1],A){case Tn:case Cn:k&&(m=Math.max(L-e,Math.min(B-l,m)),o=e+m,f=l+m),C&&(v=Math.max(D-a,Math.min(O-h,v)),s=a+v,d=h+v);break;case Mn:k<0?(m=Math.max(L-e,Math.min(B-e,m)),o=e+m,f=l):k>0&&(m=Math.max(L-l,Math.min(B-l,m)),o=e,f=l+m),C<0?(v=Math.max(D-a,Math.min(O-a,v)),s=a+v,d=h):C>0&&(v=Math.max(D-h,Math.min(O-h,v)),s=a,d=h+v);break;case Sn:k&&(o=Math.max(L,Math.min(B,e-m*k)),f=Math.max(L,Math.min(B,l+m*k))),C&&(s=Math.max(D,Math.min(O,a-v*C)),d=Math.max(D,Math.min(O,h+v*C)))}fn?1:t>=n?0:NaN},Vn=function(t){return 1===t.length&&(t=function(t){return function(n,e){return $n(t(n),e)}}(t)),{left:function(n,e,r,o){for(null==r&&(r=0),null==o&&(o=n.length);r>>1;t(n[i],e)<0?r=i+1:o=i}return r},right:function(n,e,r,o){for(null==r&&(r=0),null==o&&(o=n.length);r>>1;t(n[i],e)>0?o=i:r=i+1}return r}}}($n),Gn=Vn.right,Qn=(Vn.left,Gn),Kn=Array.prototype,Zn=(Kn.slice,Kn.map,Math.sqrt(50)),Jn=Math.sqrt(10),te=Math.sqrt(2);function ne(t,n,e){var r=(n-t)/Math.max(0,e),o=Math.floor(Math.log(r)/Math.LN10),i=r/Math.pow(10,o);return o>=0?(i>=Zn?10:i>=Jn?5:i>=te?2:1)*Math.pow(10,o):-Math.pow(10,-o)/(i>=Zn?10:i>=Jn?5:i>=te?2:1)}var ee=function(t,n){var e,r,o=t.length,i=-1;if(null==n){for(;++i=e)for(r=e;++ir&&(r=e)}else for(;++i=e)for(r=e;++ir&&(r=e);return r};function re(){}function oe(t,n){var e=new re;if(t instanceof re)t.each((function(t,n){e.set(n,t)}));else if(Array.isArray(t)){var r,o=-1,i=t.length;if(null==n)for(;++o1?r[0]+r.slice(2):r,+t.slice(e+1)]},me=function(t){return(t=pe(Math.abs(t)))?t[1]:NaN},ve=/^(?:(.)?([<>=^]))?([+\-\( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function ye(t){return new be(t)}function be(t){if(!(n=ve.exec(t)))throw new Error("invalid format: "+t);var n;this.fill=n[1]||" ",this.align=n[2]||">",this.sign=n[3]||"-",this.symbol=n[4]||"",this.zero=!!n[5],this.width=n[6]&&+n[6],this.comma=!!n[7],this.precision=n[8]&&+n[8].slice(1),this.trim=!!n[9],this.type=n[10]||""}ye.prototype=be.prototype,be.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(null==this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(null==this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var _e,we,xe,Ae,ke=function(t,n){var e=pe(t,n);if(!e)return t+"";var r=e[0],o=e[1];return o<0?"0."+new Array(-o).join("0")+r:r.length>o+1?r.slice(0,o+1)+"."+r.slice(o+1):r+new Array(o-r.length+2).join("0")},Ce={"%":function(t,n){return(100*t).toFixed(n)},b:function(t){return Math.round(t).toString(2)},c:function(t){return t+""},d:function(t){return Math.round(t).toString(10)},e:function(t,n){return t.toExponential(n)},f:function(t,n){return t.toFixed(n)},g:function(t,n){return t.toPrecision(n)},o:function(t){return Math.round(t).toString(8)},p:function(t,n){return ke(100*t,n)},r:ke,s:function(t,n){var e=pe(t,n);if(!e)return t+"";var r=e[0],o=e[1],i=o-(_e=3*Math.max(-8,Math.min(8,Math.floor(o/3))))+1,a=r.length;return i===a?r:i>a?r+new Array(i-a+1).join("0"):i>0?r.slice(0,i)+"."+r.slice(i):"0."+new Array(1-i).join("0")+pe(t,Math.max(0,n+i-1))[0]},X:function(t){return Math.round(t).toString(16).toUpperCase()},x:function(t){return Math.round(t).toString(16)}},Te=function(t){return t},Me=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];we=function(t){var n=t.grouping&&t.thousands?function(t,n){return function(e,r){for(var o=e.length,i=[],a=0,s=t[0],c=0;o>0&&s>0&&(c+s+1>r&&(s=Math.max(1,r-c)),i.push(e.substring(o-=s,o+s)),!((c+=s+1)>r));)s=t[a=(a+1)%t.length];return i.reverse().join(n)}}(t.grouping,t.thousands):Te,e=t.currency,r=t.decimal,o=t.numerals?function(t){return function(n){return n.replace(/[0-9]/g,(function(n){return t[+n]}))}}(t.numerals):Te,i=t.percent||"%";function a(t){var a=(t=ye(t)).fill,s=t.align,c=t.sign,u=t.symbol,l=t.zero,f=t.width,h=t.comma,d=t.precision,g=t.trim,p=t.type;"n"===p?(h=!0,p="g"):Ce[p]||(null==d&&(d=12),g=!0,p="g"),(l||"0"===a&&"="===s)&&(l=!0,a="0",s="=");var m="$"===u?e[0]:"#"===u&&/[boxX]/.test(p)?"0"+p.toLowerCase():"",v="$"===u?e[1]:/[%p]/.test(p)?i:"",y=Ce[p],b=/[defgprs%]/.test(p);function _(t){var e,i,u,_=m,w=v;if("c"===p)w=y(t)+w,t="";else{var x=(t=+t)<0;if(t=y(Math.abs(t),d),g&&(t=function(t){t:for(var n,e=t.length,r=1,o=-1;r0){if(!+t[r])break t;o=0}}return o>0?t.slice(0,o)+t.slice(n+1):t}(t)),x&&0==+t&&(x=!1),_=(x?"("===c?c:"-":"-"===c||"("===c?"":c)+_,w=("s"===p?Me[8+_e/3]:"")+w+(x&&"("===c?")":""),b)for(e=-1,i=t.length;++e(u=t.charCodeAt(e))||u>57){w=(46===u?r+t.slice(e+1):t.slice(e))+w,t=t.slice(0,e);break}}h&&!l&&(t=n(t,1/0));var A=_.length+t.length+w.length,k=A>1)+_+t+w+k.slice(A);break;default:t=k+_+t+w}return o(t)}return d=null==d?6:/[gprs]/.test(p)?Math.max(1,Math.min(21,d)):Math.max(0,Math.min(20,d)),_.toString=function(){return t+""},_}return{format:a,formatPrefix:function(t,n){var e=a(((t=ye(t)).type="f",t)),r=3*Math.max(-8,Math.min(8,Math.floor(me(n)/3))),o=Math.pow(10,-r),i=Me[8+r/3];return function(t){return e(o*t)+i}}}}({decimal:".",thousands:",",grouping:[3],currency:["$",""]}),xe=we.format,Ae=we.formatPrefix;var Se=function(t,n,e){var r,o=t[0],i=t[t.length-1],a=function(t,n,e){var r=Math.abs(n-t)/Math.max(0,e),o=Math.pow(10,Math.floor(Math.log(r)/Math.LN10)),i=r/o;return i>=Zn?o*=10:i>=Jn?o*=5:i>=te&&(o*=2),n0)return[t];if((r=n0)for(t=Math.ceil(t/a),n=Math.floor(n/a),i=new Array(o=Math.ceil(n-t+1));++s0?r=ne(s=Math.floor(s/r)*r,c=Math.ceil(c/r)*r,e):r<0&&(r=ne(s=Math.ceil(s*r)/r,c=Math.floor(c*r)/r,e)),r>0?(o[i]=Math.floor(s/r)*r,o[a]=Math.ceil(c/r)*r,n(o)):r<0&&(o[i]=Math.ceil(s*r)/r,o[a]=Math.floor(c*r)/r,n(o)),t},t}function De(){var t=function(t,n){var e,r,o,i=fe,a=fe,s=Mt,c=!1;function u(){return e=Math.min(i.length,a.length)>2?ge:de,r=o=null,l}function l(n){return(r||(r=e(i,a,c?function(t){return function(n,e){var r=t(n=+n,e=+e);return function(t){return t<=n?0:t>=e?1:r(t)}}}(t):t,s)))(+n)}return l.invert=function(t){return(o||(o=e(a,i,he,c?function(t){return function(n,e){var r=t(n=+n,e=+e);return function(t){return t<=0?n:t>=1?e:r(t)}}}(n):n)))(+t)},l.domain=function(t){return arguments.length?(i=ce.call(t,le),u()):i.slice()},l.range=function(t){return arguments.length?(a=ue.call(t),u()):a.slice()},l.rangeRound=function(t){return a=ue.call(t),s=St,u()},l.clamp=function(t){return arguments.length?(c=!!t,u()):c},l.interpolate=function(t){return arguments.length?(s=t,u()):s},u()}(he,At);return t.copy=function(){return function(t,n){return n.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp())}(t,De())},Le(t)}var Be=new Date,Oe=new Date;function Pe(t,n,e,r){function o(n){return t(n=new Date(+n)),n}return o.floor=o,o.ceil=function(e){return t(e=new Date(e-1)),n(e,1),t(e),e},o.round=function(t){var n=o(t),e=o.ceil(t);return t-n0))return s;do{s.push(a=new Date(+e)),n(e,i),t(e)}while(a=n)for(;t(n),!e(n);)n.setTime(n-1)}),(function(t,r){if(t>=t)if(r<0)for(;++r<=0;)for(;n(t,-1),!e(t););else for(;--r>=0;)for(;n(t,1),!e(t););}))},e&&(o.count=function(n,r){return Be.setTime(+n),Oe.setTime(+r),t(Be),t(Oe),Math.floor(e(Be,Oe))},o.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?o.filter(r?function(n){return r(n)%t==0}:function(n){return o.count(0,n)%t==0}):o:null}),o}var Fe=Pe((function(){}),(function(t,n){t.setTime(+t+n)}),(function(t,n){return n-t}));Fe.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?Pe((function(n){n.setTime(Math.floor(n/t)*t)}),(function(n,e){n.setTime(+n+e*t)}),(function(n,e){return(e-n)/t})):Fe:null},Fe.range;var Ee=6e4,Ne=(((Pe((function(t){t.setTime(1e3*Math.floor(t/1e3))}),(function(t,n){t.setTime(+t+1e3*n)}),(function(t,n){return(n-t)/1e3}),(function(t){return t.getUTCSeconds()})).range,Pe((function(t){t.setTime(Math.floor(t/Ee)*Ee)}),(function(t,n){t.setTime(+t+n*Ee)}),(function(t,n){return(n-t)/Ee}),(function(t){return t.getMinutes()}))).range,Pe((function(t){var n=t.getTimezoneOffset()*Ee%36e5;n<0&&(n+=36e5),t.setTime(36e5*Math.floor((+t-n)/36e5)+n)}),(function(t,n){t.setTime(+t+36e5*n)}),(function(t,n){return(n-t)/36e5}),(function(t){return t.getHours()}))).range,Pe((function(t){t.setHours(0,0,0,0)}),(function(t,n){t.setDate(t.getDate()+n)}),(function(t,n){return(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*Ee)/864e5}),(function(t){return t.getDate()-1}))),He=Ne;function Ie(t){return Pe((function(n){n.setDate(n.getDate()-(n.getDay()+7-t)%7),n.setHours(0,0,0,0)}),(function(t,n){t.setDate(t.getDate()+7*n)}),(function(t,n){return(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*Ee)/6048e5}))}Ne.range;var je=Ie(0),Re=Ie(1),We=Ie(2),Ue=Ie(3),Ye=Ie(4),ze=Ie(5),qe=Ie(6),Xe=((je.range,Re.range,We.range,Ue.range,Ye.range,ze.range,qe.range,Pe((function(t){t.setDate(1),t.setHours(0,0,0,0)}),(function(t,n){t.setMonth(t.getMonth()+n)}),(function(t,n){return n.getMonth()-t.getMonth()+12*(n.getFullYear()-t.getFullYear())}),(function(t){return t.getMonth()}))).range,Pe((function(t){t.setMonth(0,1),t.setHours(0,0,0,0)}),(function(t,n){t.setFullYear(t.getFullYear()+n)}),(function(t,n){return n.getFullYear()-t.getFullYear()}),(function(t){return t.getFullYear()})));Xe.every=function(t){return isFinite(t=Math.floor(t))&&t>0?Pe((function(n){n.setFullYear(Math.floor(n.getFullYear()/t)*t),n.setMonth(0,1),n.setHours(0,0,0,0)}),(function(n,e){n.setFullYear(n.getFullYear()+e*t)})):null};var $e=Xe,Ve=(((Xe.range,Pe((function(t){t.setUTCSeconds(0,0)}),(function(t,n){t.setTime(+t+n*Ee)}),(function(t,n){return(n-t)/Ee}),(function(t){return t.getUTCMinutes()}))).range,Pe((function(t){t.setUTCMinutes(0,0,0)}),(function(t,n){t.setTime(+t+36e5*n)}),(function(t,n){return(n-t)/36e5}),(function(t){return t.getUTCHours()}))).range,Pe((function(t){t.setUTCHours(0,0,0,0)}),(function(t,n){t.setUTCDate(t.getUTCDate()+n)}),(function(t,n){return(n-t)/864e5}),(function(t){return t.getUTCDate()-1}))),Ge=Ve;function Qe(t){return Pe((function(n){n.setUTCDate(n.getUTCDate()-(n.getUTCDay()+7-t)%7),n.setUTCHours(0,0,0,0)}),(function(t,n){t.setUTCDate(t.getUTCDate()+7*n)}),(function(t,n){return(n-t)/6048e5}))}Ve.range;var Ke=Qe(0),Ze=Qe(1),Je=Qe(2),tr=Qe(3),nr=Qe(4),er=Qe(5),rr=Qe(6),or=((Ke.range,Ze.range,Je.range,tr.range,nr.range,er.range,rr.range,Pe((function(t){t.setUTCDate(1),t.setUTCHours(0,0,0,0)}),(function(t,n){t.setUTCMonth(t.getUTCMonth()+n)}),(function(t,n){return n.getUTCMonth()-t.getUTCMonth()+12*(n.getUTCFullYear()-t.getUTCFullYear())}),(function(t){return t.getUTCMonth()}))).range,Pe((function(t){t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),(function(t,n){t.setUTCFullYear(t.getUTCFullYear()+n)}),(function(t,n){return n.getUTCFullYear()-t.getUTCFullYear()}),(function(t){return t.getUTCFullYear()})));or.every=function(t){return isFinite(t=Math.floor(t))&&t>0?Pe((function(n){n.setUTCFullYear(Math.floor(n.getUTCFullYear()/t)*t),n.setUTCMonth(0,1),n.setUTCHours(0,0,0,0)}),(function(n,e){n.setUTCFullYear(n.getUTCFullYear()+e*t)})):null};var ir=or;function ar(t){if(0<=t.y&&t.y<100){var n=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return n.setFullYear(t.y),n}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function sr(t){if(0<=t.y&&t.y<100){var n=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return n.setUTCFullYear(t.y),n}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function cr(t){return{y:t,m:0,d:1,H:0,M:0,S:0,L:0}}or.range;var ur,lr,fr,hr={"-":"",_:" ",0:"0"},dr=/^\s*\d+/,gr=/^%/,pr=/[\\^$*+?|[\]().{}]/g;function mr(t,n,e){var r=t<0?"-":"",o=(r?-t:t)+"",i=o.length;return r+(i68?1900:2e3),e+r[0].length):-1}function Mr(t,n,e){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(n.slice(e,e+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),e+r[0].length):-1}function Sr(t,n,e){var r=dr.exec(n.slice(e,e+2));return r?(t.m=r[0]-1,e+r[0].length):-1}function Lr(t,n,e){var r=dr.exec(n.slice(e,e+2));return r?(t.d=+r[0],e+r[0].length):-1}function Dr(t,n,e){var r=dr.exec(n.slice(e,e+3));return r?(t.m=0,t.d=+r[0],e+r[0].length):-1}function Br(t,n,e){var r=dr.exec(n.slice(e,e+2));return r?(t.H=+r[0],e+r[0].length):-1}function Or(t,n,e){var r=dr.exec(n.slice(e,e+2));return r?(t.M=+r[0],e+r[0].length):-1}function Pr(t,n,e){var r=dr.exec(n.slice(e,e+2));return r?(t.S=+r[0],e+r[0].length):-1}function Fr(t,n,e){var r=dr.exec(n.slice(e,e+3));return r?(t.L=+r[0],e+r[0].length):-1}function Er(t,n,e){var r=dr.exec(n.slice(e,e+6));return r?(t.L=Math.floor(r[0]/1e3),e+r[0].length):-1}function Nr(t,n,e){var r=gr.exec(n.slice(e,e+1));return r?e+r[0].length:-1}function Hr(t,n,e){var r=dr.exec(n.slice(e));return r?(t.Q=+r[0],e+r[0].length):-1}function Ir(t,n,e){var r=dr.exec(n.slice(e));return r?(t.Q=1e3*+r[0],e+r[0].length):-1}function jr(t,n){return mr(t.getDate(),n,2)}function Rr(t,n){return mr(t.getHours(),n,2)}function Wr(t,n){return mr(t.getHours()%12||12,n,2)}function Ur(t,n){return mr(1+He.count($e(t),t),n,3)}function Yr(t,n){return mr(t.getMilliseconds(),n,3)}function zr(t,n){return Yr(t,n)+"000"}function qr(t,n){return mr(t.getMonth()+1,n,2)}function Xr(t,n){return mr(t.getMinutes(),n,2)}function $r(t,n){return mr(t.getSeconds(),n,2)}function Vr(t){var n=t.getDay();return 0===n?7:n}function Gr(t,n){return mr(je.count($e(t),t),n,2)}function Qr(t,n){var e=t.getDay();return t=e>=4||0===e?Ye(t):Ye.ceil(t),mr(Ye.count($e(t),t)+(4===$e(t).getDay()),n,2)}function Kr(t){return t.getDay()}function Zr(t,n){return mr(Re.count($e(t),t),n,2)}function Jr(t,n){return mr(t.getFullYear()%100,n,2)}function to(t,n){return mr(t.getFullYear()%1e4,n,4)}function no(t){var n=t.getTimezoneOffset();return(n>0?"-":(n*=-1,"+"))+mr(n/60|0,"0",2)+mr(n%60,"0",2)}function eo(t,n){return mr(t.getUTCDate(),n,2)}function ro(t,n){return mr(t.getUTCHours(),n,2)}function oo(t,n){return mr(t.getUTCHours()%12||12,n,2)}function io(t,n){return mr(1+Ge.count(ir(t),t),n,3)}function ao(t,n){return mr(t.getUTCMilliseconds(),n,3)}function so(t,n){return ao(t,n)+"000"}function co(t,n){return mr(t.getUTCMonth()+1,n,2)}function uo(t,n){return mr(t.getUTCMinutes(),n,2)}function lo(t,n){return mr(t.getUTCSeconds(),n,2)}function fo(t){var n=t.getUTCDay();return 0===n?7:n}function ho(t,n){return mr(Ke.count(ir(t),t),n,2)}function go(t,n){var e=t.getUTCDay();return t=e>=4||0===e?nr(t):nr.ceil(t),mr(nr.count(ir(t),t)+(4===ir(t).getUTCDay()),n,2)}function po(t){return t.getUTCDay()}function mo(t,n){return mr(Ze.count(ir(t),t),n,2)}function vo(t,n){return mr(t.getUTCFullYear()%100,n,2)}function yo(t,n){return mr(t.getUTCFullYear()%1e4,n,4)}function bo(){return"+0000"}function _o(){return"%"}function wo(t){return+t}function xo(t){return Math.floor(+t/1e3)}(ur=function(t){var n=t.dateTime,e=t.date,r=t.time,o=t.periods,i=t.days,a=t.shortDays,s=t.months,c=t.shortMonths,u=yr(o),l=br(o),f=yr(i),h=br(i),d=yr(a),g=br(a),p=yr(s),m=br(s),v=yr(c),y=br(c),b={a:function(t){return a[t.getDay()]},A:function(t){return i[t.getDay()]},b:function(t){return c[t.getMonth()]},B:function(t){return s[t.getMonth()]},c:null,d:jr,e:jr,f:zr,H:Rr,I:Wr,j:Ur,L:Yr,m:qr,M:Xr,p:function(t){return o[+(t.getHours()>=12)]},Q:wo,s:xo,S:$r,u:Vr,U:Gr,V:Qr,w:Kr,W:Zr,x:null,X:null,y:Jr,Y:to,Z:no,"%":_o},_={a:function(t){return a[t.getUTCDay()]},A:function(t){return i[t.getUTCDay()]},b:function(t){return c[t.getUTCMonth()]},B:function(t){return s[t.getUTCMonth()]},c:null,d:eo,e:eo,f:so,H:ro,I:oo,j:io,L:ao,m:co,M:uo,p:function(t){return o[+(t.getUTCHours()>=12)]},Q:wo,s:xo,S:lo,u:fo,U:ho,V:go,w:po,W:mo,x:null,X:null,y:vo,Y:yo,Z:bo,"%":_o},w={a:function(t,n,e){var r=d.exec(n.slice(e));return r?(t.w=g[r[0].toLowerCase()],e+r[0].length):-1},A:function(t,n,e){var r=f.exec(n.slice(e));return r?(t.w=h[r[0].toLowerCase()],e+r[0].length):-1},b:function(t,n,e){var r=v.exec(n.slice(e));return r?(t.m=y[r[0].toLowerCase()],e+r[0].length):-1},B:function(t,n,e){var r=p.exec(n.slice(e));return r?(t.m=m[r[0].toLowerCase()],e+r[0].length):-1},c:function(t,e,r){return k(t,n,e,r)},d:Lr,e:Lr,f:Er,H:Br,I:Br,j:Dr,L:Fr,m:Sr,M:Or,p:function(t,n,e){var r=u.exec(n.slice(e));return r?(t.p=l[r[0].toLowerCase()],e+r[0].length):-1},Q:Hr,s:Ir,S:Pr,u:wr,U:xr,V:Ar,w:_r,W:kr,x:function(t,n,r){return k(t,e,n,r)},X:function(t,n,e){return k(t,r,n,e)},y:Tr,Y:Cr,Z:Mr,"%":Nr};function x(t,n){return function(e){var r,o,i,a=[],s=-1,c=0,u=t.length;for(e instanceof Date||(e=new Date(+e));++s53)return null;"w"in i||(i.w=1),"Z"in i?(r=(o=(r=sr(cr(i.y))).getUTCDay())>4||0===o?Ze.ceil(r):Ze(r),r=Ge.offset(r,7*(i.V-1)),i.y=r.getUTCFullYear(),i.m=r.getUTCMonth(),i.d=r.getUTCDate()+(i.w+6)%7):(r=(o=(r=n(cr(i.y))).getDay())>4||0===o?Re.ceil(r):Re(r),r=He.offset(r,7*(i.V-1)),i.y=r.getFullYear(),i.m=r.getMonth(),i.d=r.getDate()+(i.w+6)%7)}else("W"in i||"U"in i)&&("w"in i||(i.w="u"in i?i.u%7:"W"in i?1:0),o="Z"in i?sr(cr(i.y)).getUTCDay():n(cr(i.y)).getDay(),i.m=0,i.d="W"in i?(i.w+6)%7+7*i.W-(o+5)%7:i.w+7*i.U-(o+6)%7);return"Z"in i?(i.H+=i.Z/100|0,i.M+=i.Z%100,sr(i)):n(i)}}function k(t,n,e,r){for(var o,i,a=0,s=n.length,c=e.length;a=c)return-1;if(37===(o=n.charCodeAt(a++))){if(o=n.charAt(a++),!(i=w[o in hr?n.charAt(a++):o])||(r=i(t,e,r))<0)return-1}else if(o!=e.charCodeAt(r++))return-1}return r}return b.x=x(e,b),b.X=x(r,b),b.c=x(n,b),_.x=x(e,_),_.X=x(r,_),_.c=x(n,_),{format:function(t){var n=x(t+="",b);return n.toString=function(){return t},n},parse:function(t){var n=A(t+="",ar);return n.toString=function(){return t},n},utcFormat:function(t){var n=x(t+="",_);return n.toString=function(){return t},n},utcParse:function(t){var n=A(t,sr);return n.toString=function(){return t},n}}}({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]})).format,ur.parse,lr=ur.utcFormat,fr=ur.utcParse,Date.prototype.toISOString||lr("%Y-%m-%dT%H:%M:%S.%LZ"),+new Date("2000-01-01T00:00:00.000Z")||fr("%Y-%m-%dT%H:%M:%S.%LZ");var Ao=function(t){return t.match(/.{6}/g).map((function(t){return"#"+t}))};function ko(t){var n=t.length;return function(e){return t[Math.max(0,Math.min(n-1,Math.floor(e*n)))]}}function Co(t,n){var e,r,o=/(^([+\-]?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?(?=\D|\s|$))|^0x[\da-fA-F]+$|\d+)/g,i=/^\s+|\s+$/g,a=/\s+/g,s=/^0x[0-9a-f]+$/i,c=/^0/,u=function(t){return(Co.insensitive&&(""+t).toLowerCase()||""+t).replace(i,"")},l=u(t),f=u(n),h=l.replace(o,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),d=f.replace(o,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),g=parseInt(l.match(s),16)||1!==h.length&&Date.parse(l),p=parseInt(f.match(s),16)||g&&f.match(/(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/)&&Date.parse(f)||null,m=function(t,n){return(!t.match(c)||1==n)&&parseFloat(t)||t.replace(a," ").replace(i,"")||0};if(p){if(gp)return 1}for(var v=0,y=h.length,b=d.length,_=Math.max(y,b);v<_;v++){if(e=m(h[v]||"",y),r=m(d[v]||"",b),isNaN(e)!==isNaN(r))return isNaN(e)?1:-1;if(/[^\x00-\x80]/.test(e+r)&&e.localeCompare){var w=e.localeCompare(r);return w/Math.abs(w)}if(er)return 1}}Ao("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf"),Ao("393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6"),Ao("3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9"),Ao("1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5"),Rt(lt(300,.5,0),lt(-240,.5,1)),Rt(lt(-100,.75,.35),lt(80,1.5,.8)),Rt(lt(260,.75,.35),lt(80,1.5,.8)),lt(),ko(Ao("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725")),ko(Ao("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),ko(Ao("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),ko(Ao("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));var To=e(1);function Mo(t){this.config=JSON.parse(JSON.stringify(t)),function(t){t.chromosomesArray=[],t.coordinateSystem="iscn",t.maxLength={bp:0,iscn:0},t.chromosomes={},t.numChromosomes=0,t.config.debug||(t.config.debug=!1),t.config.dataDir||(t.config.dataDir=t.getDataDir()),t.config.container||(t.config.container="body"),t.selector=t.config.container+" #_ideogram",t.config.resolution||(t.config.resolution=""),t.config.orientation||(t.config.orientation="vertical"),t.config.brush||(t.config.brush=null),t.config.rows||(t.config.rows=1),"showChromosomeLabels"in t.config==0&&(t.config.showChromosomeLabels=!0),t.config.showNonNuclearChromosomes||(t.config.showNonNuclearChromosomes=!1)}(this),function(t){t.config.ploidy||(t.config.ploidy=1),t.config.ploidy>1&&(t.sexChromosomes={},t.config.sex||(t.config.sex="male"),2!==t.config.ploidy||t.config.ancestors||(t.config.ancestors={M:"#ffb6c1",P:"#add8e6"},t.config.ploidyDesc="MP"))}(this),function(t){t.config.showBandLabels||(t.config.showBandLabels=!1),"showFullyBanded"in t.config?t.config.showFullyBanded=t.config.showFullyBanded:t.config.showFullyBanded=!0,t.bandsToShow=[],t.bandData={}}(this),function(t){var n,e,r;t.config.chrHeight||(n=t.config.container,e=document.querySelector(n).getBoundingClientRect(),r="vertical"===t.config.orientation?e.height:e.width,"body"!==n&&0!==r||(r=400),t.config.chrHeight=r)}(this),function(t){var n,e;t.config.chrWidth||(n=10,(e=t.config.chrHeight)<900&&e>500?n=Math.round(e/40):e>=900&&(n=Math.round(e/45)),t.config.chrWidth=n)}(this),function(t){t.config.chrMargin||(1===t.config.ploidy?t.config.chrMargin=10:t.config.chrMargin=Math.round(t.config.chrWidth/4)),t.config.showBandLabels&&(t.config.chrMargin+=20)}(this),function(t,n){t.onLoad&&(n.onLoadCallback=t.onLoad),t.onLoadAnnots&&(n.onLoadAnnotsCallback=t.onLoadAnnots),t.onDrawAnnots&&(n.onDrawAnnotsCallback=t.onDrawAnnots),t.onBrushMove&&(n.onBrushMoveCallback=t.onBrushMove),t.onDidRotate&&(n.onDidRotateCallback=t.onDidRotate),t.onWillShowAnnotTooltip&&(n.onWillShowAnnotTooltipCallback=t.onWillShowAnnotTooltip)}(t,this),function(t){t.organisms={9606:{commonName:"Human",scientificName:"Homo sapiens",scientificNameAbbr:"H. sapiens",assemblies:{default:"GCF_000001405.26",GRCh38:"GCF_000001405.26",GRCh37:"GCF_000001405.13"}},10090:{commonName:"Mouse",scientificName:"Mus musculus",scientificNameAbbr:"M. musculus",assemblies:{default:"GCF_000001635.20"}},4641:{commonName:"banana",scientificName:"Musa acuminata",scientificNameAbbr:"M. acuminata",assemblies:{default:"mock"}}}}(this),function(t){t.bump=Math.round(t.config.chrHeight/125),t.adjustedBump=!1,t.config.chrHeight<200&&(t.adjustedBump=!0,t.bump=4)}(this),function(t,n){t.chromosome&&(n.config.chromosomes=[t.chromosome],"showBandLabels"in t==0&&(n.config.showBandLabels=!0),"rotatable"in t==0&&(n.config.rotatable=!1))}(t,this),this.initAnnotSettings(),this.config.chrMargin+=this.config.chrWidth,"heatmap"===this.config.annotationsLayout?this.config.chrMargin+=this.config.annotTracksHeight:this.config.chrMargin+=2*this.config.annotTracksHeight,this.init()}var So=To.a.assign({},i);function Lo(t){void 0!==t.timeout&&window.clearTimeout(t.timeout),t.rawAnnots=t.setOriginalTrackIndexes(t.rawAnnots),t.config.annotationsDisplayedTracks?t.annots=t.updateDisplayedTracks(t.config.annotationsDisplayedTracks):(t.annots=t.processAnnotData(t.rawAnnots),t.config.filterable&&t.initCrossFilter(),t.drawProcessedAnnots(t.annots))}function Do(t,n){var e=(new Date).getTime(),r=this.config;this.initDrawChromosomes(t),r.annotationsPath&&function(t){t.rawAnnots?Lo(t):function n(){t.timeout=setTimeout((function(){t.rawAnnots?Lo(t):n()}),50)}()}(this),function(t,n){var e,r,o,i;if(!0===t.showBandLabels&&(o=(new Date).getTime(),n.hideUnshownBandLabels(),i=(new Date).getTime(),t.debug&&console.log("Time in showing bands: "+(i-o)+" ms"),"vertical"===t.orientation))for(e=0;e0}return!0}}]),t}(),Oo=To.a.assign({},i),Po=function(){function t(n){_classCallCheck(this,t),this._node=n}return _createClass(t,[{key:"getLabel",value:function(){return Oo.select(this._node.parentNode).select("text.chrLabel").text()}},{key:"getSetLabel",value:function(){return Oo.select(this._node.parentNode).select("text.chrSetLabel").text()}}]),t}(),Fo=To.a.assign({},i),Eo=function(){function t(n,e){if(_classCallCheck(this,t),this._config=n,this._ideo=e,this._ploidy=this._ideo._ploidy,this._translate=void 0,"chrSetMargin"in n)this.chrSetMargin=n.chrSetMargin;else{var r=this._config.chrMargin;this.chrSetMargin=this._config.ploidy>1?r:0}this._tickSize=8,this._isRotated=!1}return _createClass(t,[{key:"_getLeftMargin",value:function(){return this.margin.left}},{key:"_getYScale",value:function(){return 20/this._config.chrWidth}},{key:"getChromosomeLabels",value:function(t){var n=new Po(t),e=[];return this._ideo.config.ploidy>1&&e.push(n.getSetLabel()),e.push(n.getLabel()),e.filter((function(t){return t.length>0}))}},{key:"getChromosomeBandLabelTranslate",value:function(t){var n,e,r,o=this._ideo,i=this._tickSize,a=o.config.orientation;return"vertical"===a?r="rotate(-90)translate("+(n=i)+","+(e=o.round(2+t.px.start+t.px.width/2))+")":"horizontal"===a&&(r="translate("+(n=o.round(-i+t.px.start+t.px.width/2))+","+(e=-10)+")"),{x:n,y:e,translate:r}}},{key:"didRotate",value:function(t,n){var e,r,o,i,a,s,c,u,l;r=(e=this._ideo).config.taxid,o=n.id.split("-")[0].replace("chr",""),i=(a=e.chromosomes[r][o]).bands,u=(c=Fo.select(n.parentNode)).attr("transform"),l=/scale\(.*\)/.exec(u),u=u.replace(l,""),c.attr("transform",u),s=a.width,(a=e.getChromosomeModel(i,o,r,t)).oldWidth=s,e.chromosomes[r][o]=a,e.drawChromosome(a),e.handleRotateOnClick(),e.rawAnnots&&(e.displayedTrackIndexes?e.updateDisplayedTracks(e.displayedTrackIndexes):(e.annots=e.processAnnotData(e.rawAnnots),e.drawProcessedAnnots(e.annots),e.config.filterable&&e.initCrossFilter())),!0===e.config.showBandLabels&&(e.drawBandLabels(e.chromosomes),e.hideUnshownBandLabels()),e.onDidRotateCallback&&e.onDidRotateCallback(a)}},{key:"rotate",value:function(t,n,e){var r,o,i,a;r=this._ideo,a=r.selector+" .chrSetLabel, "+r.selector+" .chrLabel",i=document.querySelector(r.selector).getBoundingClientRect(),o=Fo.selectAll(r.selector+" g.chromosome").filter((function(){return this!==e})),this._isRotated?(this._isRotated=!1,r.config.chrHeight=r.config.chrHeightOriginal,r.config.chrWidth=r.config.chrWidthOriginal,r.config.annotationHeight=r.config.annotationHeightOriginal,this.rotateBack(t,n,e,(function(){o.style("display",null),Fo.selectAll(a).style("display",null),r._layout.didRotate(n,e)}))):(this._isRotated=!0,o.style("display","none"),Fo.selectAll(a).style("display","none"),this.rotateForward(t,n,e,(function(){var t,o,a;r.config.chrHeightOriginal=r.config.chrHeight,r.config.chrWidthOriginal=r.config.chrWidth,r.config.annotationHeightOriginal=r.config.annotationHeight,"VerticalLayout"===r._layout._class?(o=i.width,a=window.innerWidth):(o=i.height-10,a=window.innerHeight-10),t=a0?n:n+4+2*t);if(!this._translate){var i;this._translate=[this._ploidy.getSetSize(0)*o*2];for(var a=1;a1&&(t*=1.8),t}},{key:"rotateForward",value:function(t,n,e,r){var o;Io.select(e.parentNode).transition().attr("transform","rotate(90) translate(30, -37.5) ").on("end",r),o=this.getChromosomeLabels(e),Io.select(this._ideo.getSvg()).append("g").attr("class","tmp").selectAll("text").data(o).enter().append("text").attr("class",(function(t,n){return 0===n&&2===o.length?"chrSetLabel":null})).attr("x",26).attr("y",(function(t,n){return 12*(n+1+o.length%2)})).style("text-anchor","middle").style("opacity",0).text(String).transition().style("opacity",1),this._ideo.config.orientation="vertical"}},{key:"rotateBack",value:function(t,n,e,r){var o=this.getChromosomeSetTranslate(t);Io.select(e.parentNode).transition().attr("transform",o).on("end",r),Io.selectAll(this._ideo.selector+" g.tmp").style("opacity",0).remove(),this._ideo.config.orientation="horizontal"}},{key:"getHeight",value:function(t){var n=this._config.chromosomes[t].length,e=this.getChromosomeSetYTranslate(n-1);return(e+=this._getChromosomeSetSize(n-1))+2*this._getAdditionalOffset()}},{key:"getWidth",value:function(){return this._config.chrHeight+1.5*this.margin.top}},{key:"getChromosomeSetLabelAnchor",value:function(){return"end"}},{key:"getChromosomeBandLabelAnchor",value:function(){return null}},{key:"getChromosomeBandTickY1",value:function(){return 2}},{key:"getChromosomeBandTickY2",value:function(){return 10}},{key:"getChromosomeSetLabelTranslate",value:function(){return null}},{key:"getChromosomeSetTranslate",value:function(t){return"translate("+this._getLeftMargin()+", "+this.getChromosomeSetYTranslate(t)+")"}},{key:"getChromosomeSetYTranslate",value:function(t){if(!this._config.ploidyDesc)return this._config.chrMargin*(t+1);if(!this._translate){this._translate=[1];for(var n=1;no-1?(e=this.margin.left+1.4*this._config.chrHeight,r=this.getChromosomeSetYTranslate(t-o)):(e=this.margin.left,r=this.getChromosomeSetYTranslate(t)),"rotate(90) translate("+e+", -"+r+")"}},{key:"getChromosomeSetYTranslate",value:function(t){var n=this._getAdditionalOffset();return this.margin.left*t+this._config.chrWidth+2*n+n*t}},{key:"getChromosomeSetLabelXPosition",value:function(t){return(this._ploidy.getSetSize(t)*this._config.chrWidth+20)/-2+(this._config.ploidy>1?0:this._config.chrWidth)}},{key:"getChromosomeLabelXPosition",value:function(){return this._config.chrWidth/-2}}]),n}(Eo),Uo=To.a.assign({},i);function Yo(t,n,e){this.config.annotationsPath&&this.fetchAnnots(this.config.annotationsPath),function(t){if("ploidyDesc"in t.config&&"string"==typeof t.config.ploidyDesc){for(var n=[],e=0;e1?new Wo(n,t):"vertical"===n.orientation?new Ho(n,t):"horizontal"===n.orientation?new jo(n,t):new Ho(n,t)}(this),function(t,n){Uo.selectAll(n.config.container+" #_ideogramOuterWrap").remove(),Uo.select(n.config.container).append("div").attr("id","_ideogramOuterWrap").append("div").attr("id","_ideogramTrackLabelContainer").style("position","absolute"),Uo.select(n.config.container+" #_ideogramOuterWrap").append("div").attr("id","_ideogramMiddleWrap").style("position","relative").style("overflow-x","auto").append("div").attr("id","_ideogramInnerWrap").append("svg").attr("id","_ideogram").attr("class",function(t){var n="";return t.config.showChromosomeLabels&&("horizontal"===t.config.orientation?n+="labeledLeft ":n+="labeled "),t.config.annotationsLayout&&"overlay"===t.config.annotationsLayout&&(n+="faint"),n}(n)).attr("width",n._layout.getWidth(t)).attr("height",n._layout.getHeight(t)).html(n.getBandColorGradients())}(n,this),this.isOnlyIdeogram=1===document.querySelectorAll("#_ideogram").length,function(t){Uo.select(t.config.container+" #_ideogramOuterWrap").append("div").attr("class","_ideogramTooltip").attr("id","_ideogramTooltip").style("opacity",0).style("position","fixed").style("text-align","center").style("padding","4px").style("font","12px sans-serif").style("background","white").style("border","1px solid black").style("border-radius","5px").style("z-index","100")}(this),this.finishInit(t,e)}var zo=e(5),qo=To.a.assign({},a,i);function Xo(t,n,e){var r=e.config.ploidy;return"sex"in e.config&&(2===r&&e.sexChromosomes.index+2===n||"female"===e.config.sex&&"Y"===t.name)}function $o(t,n,e,r,o){var i,a,s,c;for(i=0;i=chrBands.length/2&&(n.coordinateSystem="bp")}function Go(t){var n,e,r,o=this.config.taxids,i=0;for(t.length>0&&(this.bandsArray={}),e=0;e=4&&(f=h[3],i[0]=f),h.length>=8&&(u=h[8].split(","),l=t.rgbToHex(u[0],u[1],u[2]),i.push(l)),[a,i])}},{key:"parseRawAnnots",value:function(t,n,e,r){var o,i,a,s,c,u;for(u=!0,!1===isNaN(parseInt(e[n],10))&&(u=!1),o=n;o=8&&c.push("color"),{keys:c,annots:t}}},{key:"parseBed",value:function(t,n){var e,r,o,i,a=[],s=t.split(/\r\n|\n/);for(r=Object.keys(n.chromosomes[n.config.taxid]),e=0;e")}(n),ei.select(n.config.container+" #_ideogramTrackLabel").interrupt().style("top","").style("left","").style("transform",null).style("transform","rotate(-90deg)").html(o),e=function(t,n,e){var r,o,i,a,s;return r=n.id.split("-").slice(0,-1).join("-")+"-0",o=ei.select(e.config.container+" #"+r).nodes()[0].getBoundingClientRect(),i=ei.select(e.config.container+" #_ideogramTrackLabel").nodes()[0].getBoundingClientRect(),a=ei.select(e.config.container).nodes()[0].getBoundingClientRect(),s=Math.round(o.left+i.width)-o.width-1,[s-=a.left-7,-(t.split("
").length-2)*o.width+2]}(o,t,n),i=(r=_slicedToArray(e,2))[0],function(t,n,e){ei.select(e.config.container+" #_ideogramTrackLabel").style("opacity",1).style("left",n+"px").style("top",t+"px").style("width","max-content").style("transform-origin","bottom left").style("text-align","left").on("mouseover",(function(){clearTimeout(e.hideTrackLabelTimeout)})).on("mouseout",(function(){oi(e)}))}(r[1],i,n)}(this,i)})).on("mouseout",(function(){oi(i)})),i.onDrawAnnotsCallback&&i.onDrawAnnotsCallback()}function ui(t,n,e,r,o){return t===n&&"+"===o&&e>r||e===o||0!==t&&t!==n&&e<=o&&e>r||0===t&&e<=o}function li(t,n){var e,r,o,i,a,s,c,u;for(e=0;e0&&(r+="-"+t.stop.toLocaleString()),n=r,e=24,t.name&&(n=(t.displayName?t.displayName:t.name)+"
"+n,e+=8),[n,e]}(t),function(t,n,e,r,o){t.html(n).style("opacity",1).style("left",e.e+"px").style("top",e.f-r+"px").style("pointer-events",null).on("mouseover",(function(){clearTimeout(o.hideAnnotTooltipTimeout)})).on("mouseout",(function(){o.startHideAnnotTooltipTimeout()}))}(i,(r=_slicedToArray(e,2))[0],o,r[1],this))}function bi(t){var n,e,r=!1,o=(new Date).getTime();return n=this.chromosomes[this.config.taxid],function(t){"histogramScaling"in t.config==0&&(t.config.histogramScaling="absolute")}(this),void 0===this.maxAnnotsPerBar&&(this.maxAnnotsPerBar={},r=!0),function(t,n,e){var r,o,i,a,s,c,u;if(n||"relative"===e.config.histogramScaling){for(r=0,o=0;oi&&(i=u),u>r&&(r=u);e.maxAnnotsPerBar[s]=i}e.maxAnnotsPerBarAllChrs=r}}(e=function(t,n,e,r){var o,i,a,s,c,u,l,f,h,d,g=r.config.barWidth;for(o in t)for(i=t[o].annots,s=n[(a=e[t[o].chr]).chrIndex].annots,c=0;c=h&&l":"triangle"===r&&(n='"):n='",n}function xi(t,n,e){var r,o,i;for(r=0;r"+(i=e.rows[r]).name+"",o=19*r,"name"in e&&(o+=19),n+=''+wi(i)+"";return[t,n]}var Ai=Object.assign({},i);function ki(t){var n,e,r=[],o=this.chromosomes[this.config.taxid];if("annots"in t[0])return this.drawProcessedAnnots(t);for(e in o)r.push({chr:e,annots:[]});r=function(t,n){var e,r,o,i;for(e=0;e"+i.name+""),o=(s=_slicedToArray(xi(o,r='',i),2))[0],r=s[1],a+=(r+="")+"
    "+o+"
"}var c=_i.select(t.config.container+" #_ideogramOuterWrap");c.append("style").html("#_ideogramLegend {font: 12px Arial; line-height: 19px;} #_ideogramLegend svg {float: left;} #_ideogramLegend ul {position: relative; left: -14px; list-style: none; float: left; padding-left: 10px; margin-top: 0px;} #_ideogramLegend ul span {position: relative; left: -15px;} "),c.append("div").attr("id","_ideogramLegend").html(a)}(this),"heatmap"!==n?(function(t,n,e){var r;!function(t,n){var e,r;if("heatmap"!==t&&"histogram"!==t){for(r=0,e=0;e2e3&&console.warn('Rendering more than 2000 annotations in Ideogram?\nTry setting "annotationsLayout" to "heatmap" or "histogram" in your Ideogram configuration object for better layout and performance.')}}(t,n),"histogram"===t&&(n=e.getHistogramBars(n)),r=function(t,n){return Ai.selectAll(n.selector+" .chromosome").data(t).selectAll("path.annot").data((function(t){return t.annots})).enter()}(e.fillAnnots(n),e),"tracks"===t?function(t,n){var e,r=n.config.annotationHeight;e=function(t){var n;return{triangle:"m0,0 l -"+t+" "+2*t+" l "+2*t+" 0 z",circle:"m -"+(n=t)+", "+n+"a "+n+","+n+" 0 1,0 "+2*n+",0a "+n+","+n+" 0 1,0 -"+2*n+",0",rectangle:"m0,0 l 0 "+2*t+"l "+t+" 0l 0 -"+2*t+"z"}}(r),t.append("g").attr("id",(function(t){return t.id})).attr("class","annot").attr("transform",(function(t){var e=n.config.chrWidth+t.trackIndex*r*2;return"translate("+t.px+","+e+")"})).append("path").attr("d",(function(t){return function(t,n){return t.shape&&"triangle"!==t.shape?"circle"===t.shape?n.circle:"rectangle"===t.shape?n.rectangle:t.shape:n.triangle}(t,e)})).attr("fill",(function(t){return t.color})).on("mouseover",(function(t){n.showAnnotTooltip(t,this)})).on("mouseout",(function(){n.startHideAnnotTooltipTimeout()}))}(r,e):"overlay"===t?function(t,n){t.append("polygon").attr("id",(function(t){return t.id})).attr("class","annot").attr("points",(function(t){var e,r,o=n.config.chrWidth;return t.stopPx-t.startPx>1?(e=t.startPx,r=t.stopPx):(e=t.px-.5,r=t.px+.5),e+","+o+" "+r+","+o+" "+r+",0 "+e+",0"})).attr("fill",(function(t){return t.color})).on("mouseover",(function(t){n.showAnnotTooltip(t,this)})).on("mouseout",(function(){n.startHideAnnotTooltipTimeout()}))}(r,e):"histogram"===t&&function(t,n){var e,r,o={},i=n.config.chrWidth;for(r in e=n.chromosomes[n.config.taxid])o[r]=e[r];t.append("polygon").attr("class","annot").attr("points",(function(t){return function(t,n,e,r){var o,i,a,s;o=t.px+r.bump,i=t.px+r.config.barWidth+r.bump,a=n,s=n+t.height;var c=e[t.chr];return i>c&&(i=c),o+","+a+" "+i+","+a+" "+i+","+s+" "+o+","+s}(t,i,o,n)})).attr("fill",(function(t){return t.color}))}(r,e)}(n,t,this),this.onDrawAnnotsCallback&&this.onDrawAnnotsCallback()):this.drawHeatmaps(t)}var Ti=Object.assign({},i);function Mi(t,n,e){return t.append("g").attr("class","syntenicRegion").attr("id",n).on("click",(function(){var t=this,n=Ti.selectAll(e.selector+" .syntenicRegion").filter((function(){return this!==t}));n.classed("hidden",!n.classed("hidden"))})).on("mouseover",(function(){var t=this;Ti.selectAll(e.selector+" .syntenicRegion").filter((function(){return this!==t})).classed("ghost",!0)})).on("mouseout",(function(){Ti.selectAll(e.selector+" .syntenicRegion").classed("ghost",!1)}))}function Si(t,n,e){var r,o;return r=t.r1,o=t.r2,r.startPx=e.convertBpToPx(r.chr,r.start)+n,r.stopPx=e.convertBpToPx(r.chr,r.stop)+n,o.startPx=e.convertBpToPx(o.chr,o.start)+n,o.stopPx=e.convertBpToPx(o.chr,o.stop)+n,[r,o]}function Li(t,n,e,r,o,i){var a,s;a="color"in i?i.color:"#CFC",s="opacity"in i?i.opacity:1,t.append("polygon").attr("points",n+", "+r.startPx+" "+n+", "+r.stopPx+" "+e+", "+o.stopPx+" "+e+", "+o.startPx).attr("style","fill: "+a+"; fill-opacity: "+s)}function Di(t,n,e,r,o){t.append("line").attr("class","syntenyBorder").attr("x1",n).attr("x2",e).attr("y1",r.startPx).attr("y2",o.startPx),t.append("line").attr("class","syntenyBorder").attr("x1",n).attr("x2",e).attr("y1",r.stopPx).attr("y2",o.stopPx)}function Bi(t){var n=(new Date).getTime();(function(t,n,e,r){var o,i,a,s,c,u,l,f;for(o=0;oc&&(c=s+1),i.splice(4,0,s),a.push(i);u.push({chr:o.chr,annots:a})}return n.numAvailTracks=c,u}(t.annots,this),n.splice(4,0,"trackIndexOriginal"),t={keys:n,annots:e},this.rawAnnots.metadata&&(t.metadata=this.rawAnnots.metadata),t)}var Ni=[["F00"],["F00","88F"],["F00","CCC","88F"],["F00","FA0","0AF","88F"],["F00","FA0","CCC","0AF","88F"],["F00","FA0","875","578","0AF","88F"],["F00","FA0","875","CCC","578","0AF","88F"],["F00","FA0","7A0","875","0A7","578","0AF","88F"],["F00","FA0","7A0","875","CCC","0A7","578","0AF","88F"],["F00","FA0","7A0","875","552","255","0A7","578","0AF","88F"]];function Hi(t,n,e,r,o,i,a){var s;return a.config.annotationTracks?o=function(t,n,e,r,o){var i;return n.trackIndex=e[3],(i=o.config.annotationTracks[n.trackIndex]).color&&(n.color=i.color),i.shape&&(n.shape=i.shape),t[r].annots.push(n),t}(o,t,e,i,a):"trackIndex"===n[3]&&1!==a.numAvailTracks?(o=(s=_slicedToArray(function(t,n,e,r,o,i){var a=Ni[i.numAvailTracks-1];return t.trackIndex=n[3],t.trackIndexOriginal=n[4],t.color="#"+a[t.trackIndexOriginal],t.trackIndex>i.config.numTracks-1?(t.trackIndex in e?e[t.trackIndex].push(t):e[t.trackIndex]=[t],[r,e]):(r[o].annots.push(t),[r,e])}(t,e,r,o,i,a),2))[0],r=s[1]):o=function(t,n,e,r){return n.trackIndex=0,n.color||(n.color=r.config.annotationsColor),n.shape||(n.shape="triangle"),t[e].annots.push(n),t}(o,t,i,a),[o,r]}function Ii(t,n,e,r,o,i,a){var s,c,u,l;for(s=0;s10&&console.error("Ideogram only displays up to 10 tracks at a time. You specified "+r+" tracks. Perhaps consider a different way to visualize your data."),(e=Object.keys(t).length)&&console.warn("Ideogram configuration specified "+r+" tracks, but loaded annotations contain "+e+" extra tracks.")}(i,this),o}var Wi=To.a.assign({},i,a);function Ui(){var t=this.config;t.annotationsPath||t.localAnnotationsPath||this.annots||t.annotations?function(t,n){var e;n.annotationHeight||(e="heatmap"===n.annotationsLayout?n.chrWidth-1:Math.round(n.chrHeight/100),t.config.annotationHeight=e),n.annotationTracks?t.config.numAnnotTracks=n.annotationTracks.length:n.annotationsNumTracks?t.config.numAnnotTracks=n.annotationsNumTracks:t.config.numAnnotTracks=1,t.config.annotTracksHeight=n.annotationHeight*n.numAnnotTracks,void 0===n.barWidth&&(t.config.barWidth=3)}(this,t):this.config.annotTracksHeight=0,void 0===t.annotationsColor&&(this.config.annotationsColor="#F00"),function(t,n){!1!==n.showAnnotTooltip&&(t.config.showAnnotTooltip=!0),n.onWillShowAnnotTooltip&&(t.onWillShowAnnotTooltipCallback=n.onWillShowAnnotTooltip)}(this,t)}function Yi(t){t.rawAnnots.annots=t.rawAnnots.annots.sort((function(t,n){return Co(t.chr,n.chr)})),t.onLoadAnnotsCallback&&t.onLoadAnnotsCallback(),t.config.heatmaps&&t.deserializeAnnotsForHeatmap(t.rawAnnots)}function zi(t){var n,e=this;"http"===t.slice(0,4)?(n=function(t){var n,e;return"bed"!==(e=(n=t.split("?")[0].split("."))[n.length-1])&&"json"!==e?(e=e.toUpperCase(),void alert("Ideogram.js only supports BED and Ideogram JSON at the moment. Sorry, check back soon for "+e+" support!")):e}(t),Wi.text(t).then((function(t){e.rawAnnots="bed"===n?new ni(t,e).rawAnnots:JSON.parse(t),Yi(e)}))):Wi.json(e.config.annotationsPath).then((function(t){e.rawAnnots=t,Yi(e)}))}function qi(t){var n,e,r,o,i,a,s;for(n=[],e=[],r=this.chromosomesArray,o=0;o100){if(void 0===e.recovering)return o.getAssemblyAndChromosomesFromEutils(e.callback,!0),Promise.reject("Unexpectedly found genomic scaffolds instead of chromosomes while querying RefSeq. Recovering.");throw Error("Failed to find chromosomes for genome "+r)}}(t,n,e),r=t.linksets[0].linksetdbs[0].links.join(","),o=e.ideo.esummary+"&db=nucleotide&id="+r,$i.json(o)}(t,o,a)})).then((function(n){return o=function(t,n,e){var r,o,i=[];for(r in t)"uids"!==r&&(o=Vi(t[r],e),i.push(o));return i=i.sort(Ideogram.sortChromosomes),e.coordinateSystem="bp",n.push(i),n}(n.result,o,i),t(o)}),(function(t){console.warn(t)}))}var Qi,Ki=To.a.assign({},i);function Zi(){var t=this.bandsToShow.join(",");Ki.selectAll(this.selector+" .bandLabel, .bandLabelStalk").style("display","none"),Ki.selectAll(t).style("display","")}function Ji(t,n,e,r,o){return n!==e&&(t=r[o.id][e]+36),t}function ta(t,n,e,r,o,i,a){var s,c;return e',a+="gneg"===e?'':'',a+=""}return a}(Qi),''+(t+=' ')+""}var ua=e(4);function la(t,n,e,r){var o,i;return o=n[t],e.push(o),(i={iscn:o[o.length-1].iscn.stop,bp:o[o.length-1].bp.stop}).iscn>r.maxLength.iscn&&(r.maxLength.iscn=i.iscn),i.bp>r.maxLength.bp&&(r.maxLength.bp=i.bp),e}function fa(t,n,e,r){var o,i;if("iscn"===r.coordinateSystem||r.config.multiorganism)e=function(t,n,e,r){var o,i,a;for(o=r.bandData[t],i=r.parseBands(o,t,n),n=Object.keys(i).sort((function(t,n){return Co(t,n)})),r.config.chromosomes[t]=n.slice(),r.numChromosomes+=r.config.chromosomes[t].length,a=0;ar.maxLength.bp&&(r.maxLength.bp=o.length);return e}function ha(){var t,n,e,r,o,i,a,s,c=(new Date).getTime();e=[],t=function(t){var n,e,r;if(!0===t.config.multiorganism)for(t.coordinateSystem="bp",r=t.config.taxids,n=0;n1&&o.length>1&&(t=r[0].replace("chr",""),o=r[1].split("-"),n=parseInt(o[0]),e=parseInt(o[1]-1)),[t,n,e]}(t,n,e),t=(o=_slicedToArray(r,3))[0],n=o[1],e=o[2],u=(a=_slicedToArray(function(t,n){var e,r,o=[1],i=[1],a=t.bands.slice(-1)[0];for(r=0;r1){if(o=function(t,n){var e,r,o,i,a,s,c,u,l;for(e=0;e=a&&n<=s)return[u+l*(o+i/c*(n-a)-o)/i,r];return[null,r]}(t,n),r=(i=_slicedToArray(o,2))[0],e=i[1],null!==r)return r}else if(n>=1&&n<=t.length)return t.scale.bp*n;!function(t,n,e){throw new Error("Base pair out of range. bp: "+t+"; length of chr"+n.name+": "+e.bp.stop)}(n,t,e)}function ba(t,n,e,r,o,i,a){var s,c,u,l;return a=t-n,s=r-o,c=i.bp.stop-i.bp.start,u=n+a/s*(e-o),l=i.bp.start+c*(u-n)/a,Math.round(l)}function _a(t,n){var e,r,o,i,a,s;for(0===n&&(n=t.bands[0].px.start),e=0;e=o&&n<=i)return ba(s,a,n,i,o,r,void 0);!function(t,n,e){throw new Error("Pixel out of range. px: "+t+"; length of chr"+n.name+": "+e)}(n,t,i)}da.scaleLinear=De,da.max=ee;var wa=e(6),xa=Object.assign({},i);function Aa(){var t,n,e=[],r=this.annots;for(n=0;n1&&this._model.bands.push({name:"q",px:{start:0,stop:this._model.width,width:this._model.width},bp:{start:1,stop:this._model.length}}),this._model}},{key:"getCssClass",value:function(){return"noBands"}}]),n}(La),Ba=function(){function t(n){_classCallCheck(this,t),this._config=n,this._ploidy=new Bo(this._config)}return _createClass(t,[{key:"getArmColor",value:function(t,n,e){return this._config.armColors?this._config.armColors[e]:this._config.ancestors?this._getPolyploidArmColor(t,n,e):null}},{key:"getBorderColor",value:function(t,n,e){return n1&&(r=this._ploidy.getChromosomesNumber(n)),i=0;i1||""===n.orientation)&&(t-=1),t}(n,s),o=-4,!0===s.showBandLabels&&(o=s.chrMargin+s.chrWidth+26),i=s.chrMargin*n,s.numAnnotTracks>1==0&&(i+=1),a=i+o,t.selectAll("text.chrLabel").attr("transform",e.scaleSvg).selectAll("tspan").attr("x",e.x).attr("y",a)}(t,n,o,this):function(t,n,e,r){var o,i,a,s=r.config;o=-s.chrWidth-2,!0===s.showBandLabels&&(o=s.chrMargin+8),i=s.annotTracksHeight,"overlay"!==s.annotationsLayout&&(i*=2),a=3-(s.chrMargin*n+o)+i,a/=e.scale.x,t.selectAll("text.chrLabel").attr("transform","rotate(-90)"+e.scaleSvg).selectAll("tspan").attr("x",a).attr("y",e.y)}(t,n,o,this)}var za=To.a.assign({},i,a,o,r);za.scaleLinear=De,za.max=ee;var qa=function(){function t(n){_classCallCheck(this,t),this.configure=Mo,this.initDrawChromosomes=Go,this.onLoad=Ko,this.handleRotateOnClick=Qo,this.init=ti,this.finishInit=Do,this.writeContainer=Yo,this.onLoadAnnots=gi,this.onDrawAnnots=pi,this.processAnnotData=Ri,this.restoreDefaultTracks=Pi,this.updateDisplayedTracks=Fi,this.initAnnotSettings=Ui,this.fetchAnnots=zi,this.drawAnnots=ki,this.getHistogramBars=bi,this.drawHeatmaps=ci,this.deserializeAnnotsForHeatmap=hi,this.fillAnnots=qi,this.drawProcessedAnnots=Ci,this.drawSynteny=Bi,this.startHideAnnotTooltipTimeout=mi,this.showAnnotTooltip=yi,this.onWillShowAnnotTooltip=vi,this.setOriginalTrackIndexes=Ei,this.esearch="https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?retmode=json&api_key=7e33ac6a08a6955ec3b83d214d22b21a2808",this.esummary="https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esummary.fcgi?retmode=json&api_key=7e33ac6a08a6955ec3b83d214d22b21a2808",this.elink="https://eutils.ncbi.nlm.nih.gov/entrez/eutils/elink.fcgi?retmode=json&api_key=7e33ac6a08a6955ec3b83d214d22b21a2808",this.getTaxidFromEutils=Xi.b,this.setTaxidData=Xi.e,this.setTaxidAndAssemblyAndChromosomes=Xi.d,this.getOrganismFromEutils=Xi.a,this.getTaxids=Xi.c,this.getAssemblyAndChromosomesFromEutils=Gi,this.parseBands=ua.a,this.drawBandLabels=aa,this.getBandColorGradients=ca,this.processBandData=ha,this.setBandsToShow=ea,this.hideUnshownBandLabels=Zi,this.drawBandLabelText=oa,this.drawBandLabelStalk=ia,this.onBrushMove=ga,this.createBrush=pa,this.drawSexChromosomes=ma,this.setSexChromosomes=va,this.convertBpToPx=ya,this.convertPxToBp=_a,this.unpackAnnots=Aa,this.packAnnots=ka,this.initCrossFilter=Ca,this.filterAnnots=Ta,this.assemblyIsAccession=To.b,this.getDataDir=To.c,this.round=To.h,this.onDidRotate=To.g,this.getSvg=To.d,this.getChromosomeModel=Sa,this.getChromosomePixels=Ma,this.drawChromosomeLabels=Ua,this.rotateChromosomeLabels=Ya,this.appendHomolog=Ha,this.drawChromosome=Ia,this.rotateAndToggleDisplay=ja,this.setOverflowScroll=Ra,this.configure(n)}return _createClass(t,null,[{key:"slugify",value:function(t){return t.toLowerCase().replace(" ","-")}},{key:"sortChromosomes",value:function(t,n){var e="nuclear"===t.type,r="nuclear"===n.type,o="chloroplast"===t.type,i="chloroplast"===n.type,a="mitochondrion"===t.type,s="mitochondrion"===n.type,c="apicoplast"===t.type,u="apicoplast"===n.type;return e&&r?Co(t.name,n.name):!e&&r?1:a&&i?1:o&&s?-1:c||a||o||!(s||i||u)?void 0:-1}},{key:"version",get:function(){return"1.4.1"}},{key:"d3",get:function(){return za}}]),t}();window.Ideogram=qa,n.default=qa}])},"object"==_typeof(exports)&&"object"==_typeof(module)?module.exports=n():(__WEBPACK_AMD_DEFINE_ARRAY__=[],void 0===(__WEBPACK_AMD_DEFINE_RESULT__="function"==typeof(__WEBPACK_AMD_DEFINE_FACTORY__=n)?__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports,__WEBPACK_AMD_DEFINE_ARRAY__):__WEBPACK_AMD_DEFINE_FACTORY__)||(module.exports=__WEBPACK_AMD_DEFINE_RESULT__))}).call(this,__webpack_require__(75)(module))},41:function(t,n,e){"use strict";e.r(n),e.d(n,"default",(function(){return p}));var r=e(1),o=e.n(r),i=e(249),a=e.n(i),s=e(466),c=e(14);function u(t){return(u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function l(){return(l=Object.assign||function(t){for(var n=1;n=i?c=!0:10===(r=t.charCodeAt(a++))?u=!0:13===r&&(u=!0,10===t.charCodeAt(a)&&++a),t.slice(o+1,n-1).replace(/""/g,'"')}for(;a=0&&(n=t.slice(e+1),t=t.slice(0,e)),t&&!r.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}}))),a=-1,s=i.length;if(!(arguments.length<2)){if(null!=n&&"function"!=typeof n)throw new Error("invalid callback: "+n);for(;++a0)for(var e,r,o=new Array(e),i=0;i>8&15|n>>4&240,n>>4&15|240&n,(15&n)<<4|15&n,1):(n=V.exec(t))?rt(parseInt(n[1],16)):(n=G.exec(t))?new st(n[1],n[2],n[3],1):(n=Q.exec(t))?new st(255*n[1]/100,255*n[2]/100,255*n[3]/100,1):(n=K.exec(t))?ot(n[1],n[2],n[3],n[4]):(n=Z.exec(t))?ot(255*n[1]/100,255*n[2]/100,255*n[3]/100,n[4]):(n=J.exec(t))?ut(n[1],n[2]/100,n[3]/100,1):(n=tt.exec(t))?ut(n[1],n[2]/100,n[3]/100,n[4]):nt.hasOwnProperty(t)?rt(nt[t]):"transparent"===t?new st(NaN,NaN,NaN,0):null}function rt(t){return new st(t>>16&255,t>>8&255,255&t,1)}function ot(t,n,e,r){return r<=0&&(t=n=e=NaN),new st(t,n,e,r)}function it(t){return t instanceof Y||(t=et(t)),t?new st((t=t.rgb()).r,t.g,t.b,t.opacity):new st}function at(t,n,e,r){return 1===arguments.length?it(t):new st(t,n,e,null==r?1:r)}function st(t,n,e,r){this.r=+t,this.g=+n,this.b=+e,this.opacity=+r}function ct(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function ut(t,n,e,r){return r<=0?t=n=e=NaN:e<=0||e>=1?t=n=NaN:n<=0&&(t=NaN),new ft(t,n,e,r)}function lt(t,n,e,r){return 1===arguments.length?function(t){if(t instanceof ft)return new ft(t.h,t.s,t.l,t.opacity);if(t instanceof Y||(t=et(t)),!t)return new ft;if(t instanceof ft)return t;var n=(t=t.rgb()).r/255,e=t.g/255,r=t.b/255,o=Math.min(n,e,r),i=Math.max(n,e,r),a=NaN,s=i-o,c=(i+o)/2;return s?(a=n===i?(e-r)/s+6*(e0&&c<1?0:a,new ft(a,s,c,t.opacity)}(t):new ft(t,n,e,null==r?1:r)}function ft(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function ht(t,n,e){return 255*(t<60?n+(e-n)*t/60:t<180?e:t<240?n+(e-n)*(240-t)/60:n)}W(Y,et,{displayable:function(){return this.rgb().displayable()},hex:function(){return this.rgb().hex()},toString:function(){return this.rgb()+""}}),W(st,at,U(Y,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new st(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new st(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return 0<=this.r&&this.r<=255&&0<=this.g&&this.g<=255&&0<=this.b&&this.b<=255&&0<=this.opacity&&this.opacity<=1},hex:function(){return"#"+ct(this.r)+ct(this.g)+ct(this.b)},toString:function(){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+")")}})),W(ft,lt,U(Y,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new ft(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new ft(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,o=2*e-r;return new st(ht(t>=240?t-240:t+120,o,r),ht(t,o,r),ht(t<120?t+240:t-120,o,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}}));var dt=Math.PI/180,gt=180/Math.PI,pt=6/29,mt=3*pt*pt;function bt(t){if(t instanceof yt)return new yt(t.l,t.a,t.b,t.opacity);if(t instanceof Ct){if(isNaN(t.h))return new yt(t.l,0,0,t.opacity);var n=t.h*dt;return new yt(t.l,Math.cos(n)*t.c,Math.sin(n)*t.c,t.opacity)}t instanceof st||(t=it(t));var e,r,o=xt(t.r),i=xt(t.g),a=xt(t.b),s=vt((.2225045*o+.7168786*i+.0606169*a)/1);return o===i&&i===a?e=r=s:(e=vt((.4360747*o+.3850649*i+.1430804*a)/.96422),r=vt((.0139322*o+.0971045*i+.7141733*a)/.82521)),new yt(116*s-16,500*(e-s),200*(s-r),t.opacity)}function yt(t,n,e,r){this.l=+t,this.a=+n,this.b=+e,this.opacity=+r}function vt(t){return t>.008856451679035631?Math.pow(t,1/3):t/mt+4/29}function _t(t){return t>pt?t*t*t:mt*(t-4/29)}function wt(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function xt(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function At(t){if(t instanceof Ct)return new Ct(t.h,t.c,t.l,t.opacity);if(t instanceof yt||(t=bt(t)),0===t.a&&0===t.b)return new Ct(NaN,0,t.l,t.opacity);var n=Math.atan2(t.b,t.a)*gt;return new Ct(n<0?n+360:n,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}function kt(t,n,e,r){return 1===arguments.length?At(t):new Ct(t,n,e,null==r?1:r)}function Ct(t,n,e,r){this.h=+t,this.c=+n,this.l=+e,this.opacity=+r}W(yt,(function(t,n,e,r){return 1===arguments.length?bt(t):new yt(t,n,e,null==r?1:r)}),U(Y,{brighter:function(t){return new yt(this.l+18*(null==t?1:t),this.a,this.b,this.opacity)},darker:function(t){return new yt(this.l-18*(null==t?1:t),this.a,this.b,this.opacity)},rgb:function(){var t=(this.l+16)/116,n=isNaN(this.a)?t:t+this.a/500,e=isNaN(this.b)?t:t-this.b/200;return new st(wt(3.1338561*(n=.96422*_t(n))-1.6168667*(t=1*_t(t))-.4906146*(e=.82521*_t(e))),wt(-.9787684*n+1.9161415*t+.033454*e),wt(.0719453*n-.2289914*t+1.4052427*e),this.opacity)}})),W(Ct,kt,U(Y,{brighter:function(t){return new Ct(this.h,this.c,this.l+18*(null==t?1:t),this.opacity)},darker:function(t){return new Ct(this.h,this.c,this.l-18*(null==t?1:t),this.opacity)},rgb:function(){return bt(this).rgb()}}));var Tt=1.78277,Mt=-.29227,St=-.90649,Lt=1.97294,Dt=Lt*St,Bt=Lt*Tt,Ot=Tt*Mt- -.14861*St;function Pt(t,n,e,r){return 1===arguments.length?function(t){if(t instanceof Ft)return new Ft(t.h,t.s,t.l,t.opacity);t instanceof st||(t=it(t));var n=t.r/255,e=t.g/255,r=t.b/255,o=(Ot*r+Dt*n-Bt*e)/(Ot+Dt-Bt),i=r-o,a=(Lt*(e-o)-Mt*i)/St,s=Math.sqrt(a*a+i*i)/(Lt*o*(1-o)),c=s?Math.atan2(a,i)*gt-120:NaN;return new Ft(c<0?c+360:c,s,o,t.opacity)}(t):new Ft(t,n,e,null==r?1:r)}function Ft(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function Et(t,n,e,r,o){var i=t*t,a=i*t;return((1-3*t+3*i-a)*n+(4-6*i+3*a)*e+(1+3*t+3*i-3*a)*r+a*o)/6}W(Ft,Pt,U(Y,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new Ft(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new Ft(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=isNaN(this.h)?0:(this.h+120)*dt,n=+this.l,e=isNaN(this.s)?0:this.s*n*(1-n),r=Math.cos(t),o=Math.sin(t);return new st(255*(n+e*(-.14861*r+Tt*o)),255*(n+e*(Mt*r+St*o)),255*(n+e*(Lt*r)),this.opacity)}}));var Nt=function(t){return function(){return t}};function Ht(t,n){return function(e){return t+e*n}}function It(t,n){var e=n-t;return e?Ht(t,e>180||e<-180?e-360*Math.round(e/360):e):Nt(isNaN(t)?n:t)}function jt(t,n){var e=n-t;return e?Ht(t,e):Nt(isNaN(t)?n:t)}var Rt=function t(n){var e=function(t){return 1==(t=+t)?jt: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):Nt(isNaN(n)?e:n)}}(n);function r(t,n){var r=e((t=at(t)).r,(n=at(n)).r),o=e(t.g,n.g),i=e(t.b,n.b),a=jt(t.opacity,n.opacity);return function(n){return t.r=r(n),t.g=o(n),t.b=i(n),t.opacity=a(n),t+""}}return r.gamma=t,r}(1);function Wt(t){return function(n){var e,r,o=n.length,i=new Array(o),a=new Array(o),s=new Array(o);for(e=0;e=1?(e=1,n-1):Math.floor(e*n),o=t[r],i=t[r+1],a=r>0?t[r-1]:2*o-i,s=ri&&(o=n.slice(i,o),s[a]?s[a]+=o:s[++a]=o),(e=e[0])===(r=r[0])?s[a]?s[a]+=r:s[++a]=r:(s[++a]=null,c.push({i:a,x:Xt(e,r)})),i=Vt.lastIndex;return i180?n+=360:n-t>180&&(t+=360),i.push({i:e.push(o(e)+"rotate(",null,r)-2,x:Xt(t,n)})):n&&e.push(o(e)+"rotate("+n+r)}(i.rotate,a.rotate,s,c),function(t,n,e,i){t!==n?i.push({i:e.push(o(e)+"skewX(",null,r)-2,x:Xt(t,n)}):n&&e.push(o(e)+"skewX("+n+r)}(i.skewX,a.skewX,s,c),function(t,n,e,r,i,a){if(t!==e||n!==r){var s=i.push(o(i)+"scale(",null,",",null,")");a.push({i:s-4,x:Xt(t,e)},{i:s-2,x:Xt(n,r)})}else 1===e&&1===r||i.push(o(i)+"scale("+e+","+r+")")}(i.scaleX,i.scaleY,a.scaleX,a.scaleY,s,c),i=a=null,function(t){for(var n,e=-1,r=c.length;++e=0&&n._call.call(null,t),n=n._next;--fn}()}finally{fn=0,function(){for(var t,n,e=cn,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:cn=n);un=t,Cn(r)}(),pn=0}}function kn(){var t=bn.now(),n=t-gn;n>1e3&&(mn-=n,gn=t)}function Cn(t){fn||(hn&&(hn=clearTimeout(hn)),t-pn>24?(t<1/0&&(hn=setTimeout(An,t-bn.now()-mn)),dn&&(dn=clearInterval(dn))):(dn||(gn=bn.now(),dn=setInterval(kn,1e3)),fn=1,yn(An)))}wn.prototype=xn.prototype={constructor:wn,restart:function(t,n,e){if("function"!=typeof t)throw new TypeError("callback is not a function");e=(null==e?vn():+e)+(null==n?0:+n),this._next||un===this||(un?un._next=this:cn=this,un=this),this._call=t,this._time=e,Cn()},stop:function(){this._call&&(this._call=null,this._time=1/0,Cn())}};var Tn=function(t,n,e){var r=new wn;return n=null==n?0:+n,r.restart((function(e){r.stop(),t(e+n)}),n,e),r},Mn=H("start","end","interrupt"),Sn=[],Ln=function(t,n,e,r,o,i){var a=t.__transition;if(a){if(e in a)return}else t.__transition={};!function(t,n,e){var r,o=t.__transition;function i(c){var u,l,f,h;if(1!==e.state)return s();for(u in o)if((h=o[u]).name===e.name){if(3===h.state)return Tn(i);4===h.state?(h.state=6,h.timer.stop(),h.on.call("interrupt",t,t.__data__,h.index,h.group),delete o[u]):+u0)throw new Error("too late; already scheduled");return e}function Bn(t,n){var e=On(t,n);if(e.state>2)throw new Error("too late; already started");return e}function On(t,n){var e=t.__transition;if(!e||!(e=e[n]))throw new Error("transition not found");return e}var Pn=function(t,n){var e,r,o,i=t.__transition,a=!0;if(i){for(o in n=null==n?null:n+"",i)(e=i[o]).name===n?(r=e.state>2&&e.state<5,e.state=6,e.timer.stop(),r&&e.on.call("interrupt",t,t.__data__,e.index,e.group),delete i[o]):a=!1;a&&delete t.__transition}};function Fn(t,n,e){var r=t._id;return t.each((function(){var t=Bn(this,r);(t.value||(t.value={}))[n]=e.apply(this,arguments)})),function(t){return On(t,r).value[n]}}var En=function(t,n){var e;return("number"==typeof n?Xt:n instanceof et?Rt:(e=et(n))?(n=e,Rt):Gt)(t,n)},Nn=a.h.prototype.constructor,Hn=0;function In(t,n,e,r){this._groups=t,this._parents=n,this._name=e,this._id=r}function jn(){return++Hn}var Rn=a.h.prototype;In.prototype=function(t){return Object(a.h)().transition(t)}.prototype={constructor:In,select:function(t){var n=this._name,e=this._id;"function"!=typeof t&&(t=Object(a.i)(t));for(var r=this._groups,o=r.length,i=new Array(o),s=0;s=0&&(t=t.slice(0,n)),!t||"start"===t}))}(n)?Dn:Bn;return function(){var a=i(this,t),s=a.on;s!==r&&(o=(r=s).copy()).on(n,e),a.on=o}}(e,t,n))},attr:function(t,n){var e=Object(a.e)(t),r="transform"===e?rn:En;return this.attrTween(t,"function"==typeof n?(e.local?function(t,n,e){var r,o,i;return function(){var a,s=e(this);if(null!=s)return(a=this.getAttributeNS(t.space,t.local))===s?null:a===r&&s===o?i:i=n(r=a,o=s);this.removeAttributeNS(t.space,t.local)}}:function(t,n,e){var r,o,i;return function(){var a,s=e(this);if(null!=s)return(a=this.getAttribute(t))===s?null:a===r&&s===o?i:i=n(r=a,o=s);this.removeAttribute(t)}})(e,r,Fn(this,"attr."+t,n)):null==n?(e.local?function(t){return function(){this.removeAttributeNS(t.space,t.local)}}:function(t){return function(){this.removeAttribute(t)}})(e):(e.local?function(t,n,e){var r,o;return function(){var i=this.getAttributeNS(t.space,t.local);return i===e?null:i===r?o:o=n(r=i,e)}}:function(t,n,e){var r,o;return function(){var i=this.getAttribute(t);return i===e?null:i===r?o:o=n(r=i,e)}})(e,r,n+""))},attrTween:function(t,n){var e="attr."+t;if(arguments.length<2)return(e=this.tween(e))&&e._value;if(null==n)return this.tween(e,null);if("function"!=typeof n)throw new Error;var r=Object(a.e)(t);return this.tween(e,(r.local?function(t,n){function e(){var e=this,r=n.apply(e,arguments);return r&&function(n){e.setAttributeNS(t.space,t.local,r(n))}}return e._value=n,e}:function(t,n){function e(){var e=this,r=n.apply(e,arguments);return r&&function(n){e.setAttribute(t,r(n))}}return e._value=n,e})(r,n))},style:function(t,n,e){var r="transform"==(t+="")?en:En;return null==n?this.styleTween(t,function(t,n){var e,r,o;return function(){var i=Object(a.k)(this,t),s=(this.style.removeProperty(t),Object(a.k)(this,t));return i===s?null:i===e&&s===r?o:o=n(e=i,r=s)}}(t,r)).on("end.style."+t,function(t){return function(){this.style.removeProperty(t)}}(t)):this.styleTween(t,"function"==typeof n?function(t,n,e){var r,o,i;return function(){var s=Object(a.k)(this,t),c=e(this);return null==c&&(this.style.removeProperty(t),c=Object(a.k)(this,t)),s===c?null:s===r&&c===o?i:i=n(r=s,o=c)}}(t,r,Fn(this,"style."+t,n)):function(t,n,e){var r,o;return function(){var i=Object(a.k)(this,t);return i===e?null:i===r?o:o=n(r=i,e)}}(t,r,n+""),e)},styleTween:function(t,n,e){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==n)return this.tween(r,null);if("function"!=typeof n)throw new Error;return this.tween(r,function(t,n,e){function r(){var r=this,o=n.apply(r,arguments);return o&&function(n){r.style.setProperty(t,o(n),e)}}return r._value=n,r}(t,n,null==e?"":e))},text:function(t){return this.tween("text","function"==typeof t?function(t){return function(){var n=t(this);this.textContent=null==n?"":n}}(Fn(this,"text",t)):function(t){return function(){this.textContent=t}}(null==t?"":t+""))},remove:function(){return this.on("end.remove",(t=this._id,function(){var n=this.parentNode;for(var e in this.__transition)if(+e!==t)return;n&&n.removeChild(this)}));var t},tween:function(t,n){var e=this._id;if(t+="",arguments.length<2){for(var r,o=On(this.node(),e).tween,i=0,a=o.length;i0&&(e=o-g),A<0?h=d-p:A>0&&(i=s-p),w=Gn,N.attr("cursor",ne.selection),W());break;default:return}$n()}),!0).on("keyup.brush",(function(){switch(a.b.keyCode){case 16:B&&(b=y=B=!1,W());break;case 18:w===Kn&&(x<0?l=f:x>0&&(e=o),A<0?h=d:A>0&&(i=s),w=Qn,W());break;case 32:w===Gn&&(a.b.altKey?(x&&(l=f-g*x,e=o+g*x),A&&(h=d-p*A,i=s+p*A),w=Kn):(x<0?l=f:x>0&&(e=o),A<0?h=d:A>0&&(i=s),w=Qn),N.attr("cursor",ne[_]),W());break;default:return}$n()}),!0).on("mousemove.brush",I,!0).on("mouseup.brush",U,!0);j(a.b.view)}Xn(),Pn(v),c.call(v),F.start()}function I(){var t=Object(a.d)(v);!B||b||y||(Math.abs(t[0]-P[0])>Math.abs(t[1]-P[1])?y=!0:b=!0),P=t,m=!0,$n(),W()}function W(){var t;switch(g=P[0]-O[0],p=P[1]-O[1],w){case Gn:case Vn:x&&(g=Math.max(M-e,Math.min(L-l,g)),o=e+g,f=l+g),A&&(p=Math.max(S-i,Math.min(D-h,p)),s=i+p,d=h+p);break;case Qn:x<0?(g=Math.max(M-e,Math.min(L-e,g)),o=e+g,f=l):x>0&&(g=Math.max(M-l,Math.min(L-l,g)),o=e,f=l+g),A<0?(p=Math.max(S-i,Math.min(D-i,p)),s=i+p,d=h):A>0&&(p=Math.max(S-h,Math.min(D-h,p)),s=i,d=h+p);break;case Kn:x&&(o=Math.max(M,Math.min(L,e-g*x)),f=Math.max(M,Math.min(L,l+g*x))),A&&(s=Math.max(S,Math.min(D,i-p*A)),d=Math.max(S,Math.min(D,h+p*A)))}fn?1:t>=n?0:NaN},be=function(t){var n;return 1===t.length&&(n=t,t=function(t,e){return me(n(t),e)}),{left:function(n,e,r,o){for(null==r&&(r=0),null==o&&(o=n.length);r>>1;t(n[i],e)<0?r=i+1:o=i}return r},right:function(n,e,r,o){for(null==r&&(r=0),null==o&&(o=n.length);r>>1;t(n[i],e)>0?o=i:r=i+1}return r}}}(me),ye=be.right,ve=(be.left,ye),_e=Array.prototype,we=(_e.slice,_e.map,Math.sqrt(50)),xe=Math.sqrt(10),Ae=Math.sqrt(2);function ke(t,n,e){var r=(n-t)/Math.max(0,e),o=Math.floor(Math.log(r)/Math.LN10),i=r/Math.pow(10,o);return o>=0?(i>=we?10:i>=xe?5:i>=Ae?2:1)*Math.pow(10,o):-Math.pow(10,-o)/(i>=we?10:i>=xe?5:i>=Ae?2:1)}function Ce(){}function Te(t,n){var e=new Ce;if(t instanceof Ce)t.each((function(t,n){e.set(n,t)}));else if(Array.isArray(t)){var r,o=-1,i=t.length;if(null==n)for(;++o1?r[0]+r.slice(2):r,+t.slice(e+1)]},Ie=function(t){return(t=He(Math.abs(t)))?t[1]:NaN},je=/^(?:(.)?([<>=^]))?([+\-\( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Re(t){return new We(t)}function We(t){if(!(n=je.exec(t)))throw new Error("invalid format: "+t);var n;this.fill=n[1]||" ",this.align=n[2]||">",this.sign=n[3]||"-",this.symbol=n[4]||"",this.zero=!!n[5],this.width=n[6]&&+n[6],this.comma=!!n[7],this.precision=n[8]&&+n[8].slice(1),this.trim=!!n[9],this.type=n[10]||""}Re.prototype=We.prototype,We.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(null==this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(null==this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var Ue,Ye,ze,qe,Xe=function(t,n){var e=He(t,n);if(!e)return t+"";var r=e[0],o=e[1];return o<0?"0."+new Array(-o).join("0")+r:r.length>o+1?r.slice(0,o+1)+"."+r.slice(o+1):r+new Array(o-r.length+2).join("0")},$e={"%":function(t,n){return(100*t).toFixed(n)},b:function(t){return Math.round(t).toString(2)},c:function(t){return t+""},d:function(t){return Math.round(t).toString(10)},e:function(t,n){return t.toExponential(n)},f:function(t,n){return t.toFixed(n)},g:function(t,n){return t.toPrecision(n)},o:function(t){return Math.round(t).toString(8)},p:function(t,n){return Xe(100*t,n)},r:Xe,s:function(t,n){var e=He(t,n);if(!e)return t+"";var r=e[0],o=e[1],i=o-(Ue=3*Math.max(-8,Math.min(8,Math.floor(o/3))))+1,a=r.length;return i===a?r:i>a?r+new Array(i-a+1).join("0"):i>0?r.slice(0,i)+"."+r.slice(i):"0."+new Array(1-i).join("0")+He(t,Math.max(0,n+i-1))[0]},X:function(t){return Math.round(t).toString(16).toUpperCase()},x:function(t){return Math.round(t).toString(16)}},Ve=function(t){return t},Ge=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];Ye=function(t){var n,e,r=t.grouping&&t.thousands?(n=t.grouping,e=t.thousands,function(t,r){for(var o=t.length,i=[],a=0,s=n[0],c=0;o>0&&s>0&&(c+s+1>r&&(s=Math.max(1,r-c)),i.push(t.substring(o-=s,o+s)),!((c+=s+1)>r));)s=n[a=(a+1)%n.length];return i.reverse().join(e)}):Ve,o=t.currency,i=t.decimal,a=t.numerals?function(t){return function(n){return n.replace(/[0-9]/g,(function(n){return t[+n]}))}}(t.numerals):Ve,s=t.percent||"%";function c(t){var n=(t=Re(t)).fill,e=t.align,c=t.sign,u=t.symbol,l=t.zero,f=t.width,h=t.comma,d=t.precision,g=t.trim,p=t.type;"n"===p?(h=!0,p="g"):$e[p]||(null==d&&(d=12),g=!0,p="g"),(l||"0"===n&&"="===e)&&(l=!0,n="0",e="=");var m="$"===u?o[0]:"#"===u&&/[boxX]/.test(p)?"0"+p.toLowerCase():"",b="$"===u?o[1]:/[%p]/.test(p)?s:"",y=$e[p],v=/[defgprs%]/.test(p);function _(t){var o,s,u,_=m,w=b;if("c"===p)w=y(t)+w,t="";else{var x=(t=+t)<0;if(t=y(Math.abs(t),d),g&&(t=function(t){t:for(var n,e=t.length,r=1,o=-1;r0){if(!+t[r])break t;o=0}}return o>0?t.slice(0,o)+t.slice(n+1):t}(t)),x&&0==+t&&(x=!1),_=(x?"("===c?c:"-":"-"===c||"("===c?"":c)+_,w=("s"===p?Ge[8+Ue/3]:"")+w+(x&&"("===c?")":""),v)for(o=-1,s=t.length;++o(u=t.charCodeAt(o))||u>57){w=(46===u?i+t.slice(o+1):t.slice(o))+w,t=t.slice(0,o);break}}h&&!l&&(t=r(t,1/0));var A=_.length+t.length+w.length,k=A>1)+_+t+w+k.slice(A);break;default:t=k+_+t+w}return a(t)}return d=null==d?6:/[gprs]/.test(p)?Math.max(1,Math.min(21,d)):Math.max(0,Math.min(20,d)),_.toString=function(){return t+""},_}return{format:c,formatPrefix:function(t,n){var e=c(((t=Re(t)).type="f",t)),r=3*Math.max(-8,Math.min(8,Math.floor(Ie(n)/3))),o=Math.pow(10,-r),i=Ge[8+r/3];return function(t){return e(o*t)+i}}}}({decimal:".",thousands:",",grouping:[3],currency:["$",""]}),ze=Ye.format,qe=Ye.formatPrefix;var Qe=function(t,n,e){var r,o=t[0],i=t[t.length-1],a=function(t,n,e){var r=Math.abs(n-t)/Math.max(0,e),o=Math.pow(10,Math.floor(Math.log(r)/Math.LN10)),i=r/o;return i>=we?o*=10:i>=xe?o*=5:i>=Ae&&(o*=2),n0)return[t];if((r=n0)for(t=Math.ceil(t/a),n=Math.floor(n/a),i=new Array(o=Math.ceil(n-t+1));++s0?r=ke(s=Math.floor(s/r)*r,c=Math.ceil(c/r)*r,e):r<0&&(r=ke(s=Math.ceil(s*r)/r,c=Math.floor(c*r)/r,e)),r>0?(o[i]=Math.floor(s/r)*r,o[a]=Math.ceil(c/r)*r,n(o)):r<0&&(o[i]=Math.ceil(s*r)/r,o[a]=Math.floor(c*r)/r,n(o)),t},t}var Ze=new Date,Je=new Date;function tr(t,n,e,r){function o(n){return t(n=new Date(+n)),n}return o.floor=o,o.ceil=function(e){return t(e=new Date(e-1)),n(e,1),t(e),e},o.round=function(t){var n=o(t),e=o.ceil(t);return t-n0))return s;do{s.push(a=new Date(+e)),n(e,i),t(e)}while(a=n)for(;t(n),!e(n);)n.setTime(n-1)}),(function(t,r){if(t>=t)if(r<0)for(;++r<=0;)for(;n(t,-1),!e(t););else for(;--r>=0;)for(;n(t,1),!e(t););}))},e&&(o.count=function(n,r){return Ze.setTime(+n),Je.setTime(+r),t(Ze),t(Je),Math.floor(e(Ze,Je))},o.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?o.filter(r?function(n){return r(n)%t==0}:function(n){return o.count(0,n)%t==0}):o:null}),o}var nr=tr((function(){}),(function(t,n){t.setTime(+t+n)}),(function(t,n){return n-t}));nr.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?tr((function(n){n.setTime(Math.floor(n/t)*t)}),(function(n,e){n.setTime(+n+e*t)}),(function(n,e){return(e-n)/t})):nr:null},nr.range;var er=6e4,rr=(((tr((function(t){t.setTime(1e3*Math.floor(t/1e3))}),(function(t,n){t.setTime(+t+1e3*n)}),(function(t,n){return(n-t)/1e3}),(function(t){return t.getUTCSeconds()})).range,tr((function(t){t.setTime(Math.floor(t/er)*er)}),(function(t,n){t.setTime(+t+n*er)}),(function(t,n){return(n-t)/er}),(function(t){return t.getMinutes()}))).range,tr((function(t){var n=t.getTimezoneOffset()*er%36e5;n<0&&(n+=36e5),t.setTime(36e5*Math.floor((+t-n)/36e5)+n)}),(function(t,n){t.setTime(+t+36e5*n)}),(function(t,n){return(n-t)/36e5}),(function(t){return t.getHours()}))).range,tr((function(t){t.setHours(0,0,0,0)}),(function(t,n){t.setDate(t.getDate()+n)}),(function(t,n){return(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*er)/864e5}),(function(t){return t.getDate()-1}))),or=rr;function ir(t){return tr((function(n){n.setDate(n.getDate()-(n.getDay()+7-t)%7),n.setHours(0,0,0,0)}),(function(t,n){t.setDate(t.getDate()+7*n)}),(function(t,n){return(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*er)/6048e5}))}rr.range;var ar=ir(0),sr=ir(1),cr=ir(2),ur=ir(3),lr=ir(4),fr=ir(5),hr=ir(6),dr=((ar.range,sr.range,cr.range,ur.range,lr.range,fr.range,hr.range,tr((function(t){t.setDate(1),t.setHours(0,0,0,0)}),(function(t,n){t.setMonth(t.getMonth()+n)}),(function(t,n){return n.getMonth()-t.getMonth()+12*(n.getFullYear()-t.getFullYear())}),(function(t){return t.getMonth()}))).range,tr((function(t){t.setMonth(0,1),t.setHours(0,0,0,0)}),(function(t,n){t.setFullYear(t.getFullYear()+n)}),(function(t,n){return n.getFullYear()-t.getFullYear()}),(function(t){return t.getFullYear()})));dr.every=function(t){return isFinite(t=Math.floor(t))&&t>0?tr((function(n){n.setFullYear(Math.floor(n.getFullYear()/t)*t),n.setMonth(0,1),n.setHours(0,0,0,0)}),(function(n,e){n.setFullYear(n.getFullYear()+e*t)})):null};var gr=dr,pr=(((dr.range,tr((function(t){t.setUTCSeconds(0,0)}),(function(t,n){t.setTime(+t+n*er)}),(function(t,n){return(n-t)/er}),(function(t){return t.getUTCMinutes()}))).range,tr((function(t){t.setUTCMinutes(0,0,0)}),(function(t,n){t.setTime(+t+36e5*n)}),(function(t,n){return(n-t)/36e5}),(function(t){return t.getUTCHours()}))).range,tr((function(t){t.setUTCHours(0,0,0,0)}),(function(t,n){t.setUTCDate(t.getUTCDate()+n)}),(function(t,n){return(n-t)/864e5}),(function(t){return t.getUTCDate()-1}))),mr=pr;function br(t){return tr((function(n){n.setUTCDate(n.getUTCDate()-(n.getUTCDay()+7-t)%7),n.setUTCHours(0,0,0,0)}),(function(t,n){t.setUTCDate(t.getUTCDate()+7*n)}),(function(t,n){return(n-t)/6048e5}))}pr.range;var yr=br(0),vr=br(1),_r=br(2),wr=br(3),xr=br(4),Ar=br(5),kr=br(6),Cr=((yr.range,vr.range,_r.range,wr.range,xr.range,Ar.range,kr.range,tr((function(t){t.setUTCDate(1),t.setUTCHours(0,0,0,0)}),(function(t,n){t.setUTCMonth(t.getUTCMonth()+n)}),(function(t,n){return n.getUTCMonth()-t.getUTCMonth()+12*(n.getUTCFullYear()-t.getUTCFullYear())}),(function(t){return t.getUTCMonth()}))).range,tr((function(t){t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),(function(t,n){t.setUTCFullYear(t.getUTCFullYear()+n)}),(function(t,n){return n.getUTCFullYear()-t.getUTCFullYear()}),(function(t){return t.getUTCFullYear()})));Cr.every=function(t){return isFinite(t=Math.floor(t))&&t>0?tr((function(n){n.setUTCFullYear(Math.floor(n.getUTCFullYear()/t)*t),n.setUTCMonth(0,1),n.setUTCHours(0,0,0,0)}),(function(n,e){n.setUTCFullYear(n.getUTCFullYear()+e*t)})):null};var Tr=Cr;function Mr(t){if(0<=t.y&&t.y<100){var n=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return n.setFullYear(t.y),n}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function Sr(t){if(0<=t.y&&t.y<100){var n=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return n.setUTCFullYear(t.y),n}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function Lr(t){return{y:t,m:0,d:1,H:0,M:0,S:0,L:0}}Cr.range;var Dr,Br,Or,Pr={"-":"",_:" ",0:"0"},Fr=/^\s*\d+/,Er=/^%/,Nr=/[\\^$*+?|[\]().{}]/g;function Hr(t,n,e){var r=t<0?"-":"",o=(r?-t:t)+"",i=o.length;return r+(i68?1900:2e3),e+r[0].length):-1}function Vr(t,n,e){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(n.slice(e,e+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),e+r[0].length):-1}function Gr(t,n,e){var r=Fr.exec(n.slice(e,e+2));return r?(t.m=r[0]-1,e+r[0].length):-1}function Qr(t,n,e){var r=Fr.exec(n.slice(e,e+2));return r?(t.d=+r[0],e+r[0].length):-1}function Kr(t,n,e){var r=Fr.exec(n.slice(e,e+3));return r?(t.m=0,t.d=+r[0],e+r[0].length):-1}function Zr(t,n,e){var r=Fr.exec(n.slice(e,e+2));return r?(t.H=+r[0],e+r[0].length):-1}function Jr(t,n,e){var r=Fr.exec(n.slice(e,e+2));return r?(t.M=+r[0],e+r[0].length):-1}function to(t,n,e){var r=Fr.exec(n.slice(e,e+2));return r?(t.S=+r[0],e+r[0].length):-1}function no(t,n,e){var r=Fr.exec(n.slice(e,e+3));return r?(t.L=+r[0],e+r[0].length):-1}function eo(t,n,e){var r=Fr.exec(n.slice(e,e+6));return r?(t.L=Math.floor(r[0]/1e3),e+r[0].length):-1}function ro(t,n,e){var r=Er.exec(n.slice(e,e+1));return r?e+r[0].length:-1}function oo(t,n,e){var r=Fr.exec(n.slice(e));return r?(t.Q=+r[0],e+r[0].length):-1}function io(t,n,e){var r=Fr.exec(n.slice(e));return r?(t.Q=1e3*+r[0],e+r[0].length):-1}function ao(t,n){return Hr(t.getDate(),n,2)}function so(t,n){return Hr(t.getHours(),n,2)}function co(t,n){return Hr(t.getHours()%12||12,n,2)}function uo(t,n){return Hr(1+or.count(gr(t),t),n,3)}function lo(t,n){return Hr(t.getMilliseconds(),n,3)}function fo(t,n){return lo(t,n)+"000"}function ho(t,n){return Hr(t.getMonth()+1,n,2)}function go(t,n){return Hr(t.getMinutes(),n,2)}function po(t,n){return Hr(t.getSeconds(),n,2)}function mo(t){var n=t.getDay();return 0===n?7:n}function bo(t,n){return Hr(ar.count(gr(t),t),n,2)}function yo(t,n){var e=t.getDay();return t=e>=4||0===e?lr(t):lr.ceil(t),Hr(lr.count(gr(t),t)+(4===gr(t).getDay()),n,2)}function vo(t){return t.getDay()}function _o(t,n){return Hr(sr.count(gr(t),t),n,2)}function wo(t,n){return Hr(t.getFullYear()%100,n,2)}function xo(t,n){return Hr(t.getFullYear()%1e4,n,4)}function Ao(t){var n=t.getTimezoneOffset();return(n>0?"-":(n*=-1,"+"))+Hr(n/60|0,"0",2)+Hr(n%60,"0",2)}function ko(t,n){return Hr(t.getUTCDate(),n,2)}function Co(t,n){return Hr(t.getUTCHours(),n,2)}function To(t,n){return Hr(t.getUTCHours()%12||12,n,2)}function Mo(t,n){return Hr(1+mr.count(Tr(t),t),n,3)}function So(t,n){return Hr(t.getUTCMilliseconds(),n,3)}function Lo(t,n){return So(t,n)+"000"}function Do(t,n){return Hr(t.getUTCMonth()+1,n,2)}function Bo(t,n){return Hr(t.getUTCMinutes(),n,2)}function Oo(t,n){return Hr(t.getUTCSeconds(),n,2)}function Po(t){var n=t.getUTCDay();return 0===n?7:n}function Fo(t,n){return Hr(yr.count(Tr(t),t),n,2)}function Eo(t,n){var e=t.getUTCDay();return t=e>=4||0===e?xr(t):xr.ceil(t),Hr(xr.count(Tr(t),t)+(4===Tr(t).getUTCDay()),n,2)}function No(t){return t.getUTCDay()}function Ho(t,n){return Hr(vr.count(Tr(t),t),n,2)}function Io(t,n){return Hr(t.getUTCFullYear()%100,n,2)}function jo(t,n){return Hr(t.getUTCFullYear()%1e4,n,4)}function Ro(){return"+0000"}function Wo(){return"%"}function Uo(t){return+t}function Yo(t){return Math.floor(+t/1e3)}(Dr=function(t){var n=t.dateTime,e=t.date,r=t.time,o=t.periods,i=t.days,a=t.shortDays,s=t.months,c=t.shortMonths,u=jr(o),l=Rr(o),f=jr(i),h=Rr(i),d=jr(a),g=Rr(a),p=jr(s),m=Rr(s),b=jr(c),y=Rr(c),v={a:function(t){return a[t.getDay()]},A:function(t){return i[t.getDay()]},b:function(t){return c[t.getMonth()]},B:function(t){return s[t.getMonth()]},c:null,d:ao,e:ao,f:fo,H:so,I:co,j:uo,L:lo,m:ho,M:go,p:function(t){return o[+(t.getHours()>=12)]},Q:Uo,s:Yo,S:po,u:mo,U:bo,V:yo,w:vo,W:_o,x:null,X:null,y:wo,Y:xo,Z:Ao,"%":Wo},_={a:function(t){return a[t.getUTCDay()]},A:function(t){return i[t.getUTCDay()]},b:function(t){return c[t.getUTCMonth()]},B:function(t){return s[t.getUTCMonth()]},c:null,d:ko,e:ko,f:Lo,H:Co,I:To,j:Mo,L:So,m:Do,M:Bo,p:function(t){return o[+(t.getUTCHours()>=12)]},Q:Uo,s:Yo,S:Oo,u:Po,U:Fo,V:Eo,w:No,W:Ho,x:null,X:null,y:Io,Y:jo,Z:Ro,"%":Wo},w={a:function(t,n,e){var r=d.exec(n.slice(e));return r?(t.w=g[r[0].toLowerCase()],e+r[0].length):-1},A:function(t,n,e){var r=f.exec(n.slice(e));return r?(t.w=h[r[0].toLowerCase()],e+r[0].length):-1},b:function(t,n,e){var r=b.exec(n.slice(e));return r?(t.m=y[r[0].toLowerCase()],e+r[0].length):-1},B:function(t,n,e){var r=p.exec(n.slice(e));return r?(t.m=m[r[0].toLowerCase()],e+r[0].length):-1},c:function(t,e,r){return k(t,n,e,r)},d:Qr,e:Qr,f:eo,H:Zr,I:Zr,j:Kr,L:no,m:Gr,M:Jr,p:function(t,n,e){var r=u.exec(n.slice(e));return r?(t.p=l[r[0].toLowerCase()],e+r[0].length):-1},Q:oo,s:io,S:to,u:Ur,U:Yr,V:zr,w:Wr,W:qr,x:function(t,n,r){return k(t,e,n,r)},X:function(t,n,e){return k(t,r,n,e)},y:$r,Y:Xr,Z:Vr,"%":ro};function x(t,n){return function(e){var r,o,i,a=[],s=-1,c=0,u=t.length;for(e instanceof Date||(e=new Date(+e));++s53)return null;"w"in i||(i.w=1),"Z"in i?(o=(r=Sr(Lr(i.y))).getUTCDay(),r=o>4||0===o?vr.ceil(r):vr(r),r=mr.offset(r,7*(i.V-1)),i.y=r.getUTCFullYear(),i.m=r.getUTCMonth(),i.d=r.getUTCDate()+(i.w+6)%7):(o=(r=n(Lr(i.y))).getDay(),r=o>4||0===o?sr.ceil(r):sr(r),r=or.offset(r,7*(i.V-1)),i.y=r.getFullYear(),i.m=r.getMonth(),i.d=r.getDate()+(i.w+6)%7)}else("W"in i||"U"in i)&&("w"in i||(i.w="u"in i?i.u%7:"W"in i?1:0),o="Z"in i?Sr(Lr(i.y)).getUTCDay():n(Lr(i.y)).getDay(),i.m=0,i.d="W"in i?(i.w+6)%7+7*i.W-(o+5)%7:i.w+7*i.U-(o+6)%7);return"Z"in i?(i.H+=i.Z/100|0,i.M+=i.Z%100,Sr(i)):n(i)}}function k(t,n,e,r){for(var o,i,a=0,s=n.length,c=e.length;a=c)return-1;if(37===(o=n.charCodeAt(a++))){if(o=n.charAt(a++),!(i=w[o in Pr?n.charAt(a++):o])||(r=i(t,e,r))<0)return-1}else if(o!=e.charCodeAt(r++))return-1}return r}return v.x=x(e,v),v.X=x(r,v),v.c=x(n,v),_.x=x(e,_),_.X=x(r,_),_.c=x(n,_),{format:function(t){var n=x(t+="",v);return n.toString=function(){return t},n},parse:function(t){var n=A(t+="",Mr);return n.toString=function(){return t},n},utcFormat:function(t){var n=x(t+="",_);return n.toString=function(){return t},n},utcParse:function(t){var n=A(t,Sr);return n.toString=function(){return t},n}}}({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]})).format,Dr.parse,Br=Dr.utcFormat,Or=Dr.utcParse,Date.prototype.toISOString||Br("%Y-%m-%dT%H:%M:%S.%LZ"),+new Date("2000-01-01T00:00:00.000Z")||Or("%Y-%m-%dT%H:%M:%S.%LZ");var zo=function(t){return t.match(/.{6}/g).map((function(t){return"#"+t}))};function qo(t){var n=t.length;return function(e){return t[Math.max(0,Math.min(n-1,Math.floor(e*n)))]}}zo("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf"),zo("393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6"),zo("3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9"),zo("1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5"),ln(Pt(300,.5,0),Pt(-240,.5,1)),ln(Pt(-100,.75,.35),Pt(80,1.5,.8)),ln(Pt(260,.75,.35),Pt(80,1.5,.8)),Pt(),qo(zo("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725")),qo(zo("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),qo(zo("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),qo(zo("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921")),e.d(n,"a",(function(){return $o})),e.d(n,"f",(function(){return Vo})),e.d(n,"e",(function(){return Go})),e.d(n,"c",(function(){return Qo})),e.d(n,"h",(function(){return Ko})),e.d(n,"g",(function(){return Zo})),e.d(n,"d",(function(){return Jo})),e.d(n,"b",(function(){return Xo}));var Xo=Object.assign({},r,i,o);function $o(){return"assembly"in this.config&&/(GCF_|GCA_)/.test(this.config.assembly)}function Vo(t){return"assembly"in t.config&&!1===/(GCA_)/.test(t.config.assembly)}function Go(t){return"assembly"in t.config&&/(GCA_)/.test(t.config.assembly)}function Qo(){var t,n,e,r=document.scripts,o=location.host.split(":")[0],i=Ideogram.version;if("localhost"!==o&&"127.0.0.1"!==o)return"https://unpkg.com/ideogram@"+i+"/dist/data/bands/native/";for(var a=0;a2?Ne:Ee,r=o=null,l}function l(n){return(r||(r=e(i,a,c?function(t){return function(n,e){var r=t(n=+n,e=+e);return function(t){return t<=n?0:t>=e?1:r(t)}}}(t):t,s)))(+n)}return l.invert=function(t){return(o||(o=e(a,i,Fe,c?function(t){return function(n,e){var r=t(n=+n,e=+e);return function(t){return t<=0?n:t>=1?e:r(t)}}}(n):n)))(+t)},l.domain=function(t){return arguments.length?(i=De.call(t,Oe),u()):i.slice()},l.range=function(t){return arguments.length?(a=Be.call(t),u()):a.slice()},l.rangeRound=function(t){return a=Be.call(t),s=Kt,u()},l.clamp=function(t){return arguments.length?(c=!!t,u()):c},l.interpolate=function(t){return arguments.length?(s=t,u()):s},u()}(Fe,Xt);return n.copy=function(){return function(t,n){return n.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp())}(n,t())},Ke(n)},Xo.max=function(t,n){var e,r,o=t.length,i=-1;if(null==n){for(;++i=e)for(r=e;++ir&&(r=e)}else for(;++i=e)for(r=e;++ir&&(r=e);return r}},function(t,n,e){"use strict";var r="http://www.w3.org/1999/xhtml",o={svg:"http://www.w3.org/2000/svg",xhtml:r,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},i=function(t){var n=t+="",e=n.indexOf(":");return e>=0&&"xmlns"!==(n=t.slice(0,e))&&(t=t.slice(e+1)),o.hasOwnProperty(n)?{space:o[n],local:t}:t},a=function(t){var n=i(t);return(n.local?function(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}:function(t){return function(){var n=this.ownerDocument,e=this.namespaceURI;return e===r&&n.documentElement.namespaceURI===r?n.createElement(t):n.createElementNS(e,t)}})(n)};function s(){}var c=function(t){return null==t?s:function(){return this.querySelector(t)}};function u(){return[]}var l=function(t){return null==t?u:function(){return this.querySelectorAll(t)}},f=function(t){return function(){return this.matches(t)}};if("undefined"!=typeof document){var h=document.documentElement;if(!h.matches){var d=h.webkitMatchesSelector||h.msMatchesSelector||h.mozMatchesSelector||h.oMatchesSelector;f=function(t){return function(){return d.call(this,t)}}}}var g=f,p=function(t){return new Array(t.length)};function m(t,n){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=n}function b(t,n,e,r,o,i){for(var a,s=0,c=n.length,u=i.length;sn?1:t>=n?0:NaN}m.prototype={constructor:m,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 _=function(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView};function w(t,n){return t.style.getPropertyValue(n)||_(t).getComputedStyle(t,null).getPropertyValue(n)}function x(t){return t.trim().split(/^|\s+/)}function A(t){return t.classList||new k(t)}function k(t){this._node=t,this._names=x(t.getAttribute("class")||"")}function C(t,n){for(var e=A(t),r=-1,o=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 E={},N=null;function H(t,n,e){return t=I(t,n,e),function(n){var e=n.relatedTarget;e&&(e===this||8&e.compareDocumentPosition(this))||t.call(this,n)}}function I(t,n,e){return function(r){var o=N;N=r;try{t.call(this,this.__data__,n,e)}finally{N=o}}}function j(t){return function(){var n=this.__on;if(n){for(var e,r=0,o=-1,i=n.length;r=A&&(A=x+1);!(w=v[A])&&++A=0;)(r=o[i])&&(a&&a!==r.nextSibling&&a.parentNode.insertBefore(r,a),a=r);return this},sort:function(t){function n(n,e){return n&&e?t(n.__data__,e.__data__):!n-!e}t||(t=v);for(var e=this._groups,r=e.length,o=new Array(r),i=0;i1?this.each((null==n?function(t){return function(){this.style.removeProperty(t)}}:"function"==typeof n?function(t,n,e){return function(){var r=n.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,e)}}:function(t,n,e){return function(){this.style.setProperty(t,n,e)}})(t,n,null==e?"":e)):w(this.node(),t)},property:function(t,n){return arguments.length>1?this.each((null==n?function(t){return function(){delete this[t]}}:"function"==typeof n?function(t,n){return function(){var e=n.apply(this,arguments);null==e?delete this[t]:this[t]=e}}:function(t,n){return function(){this[t]=n}})(t,n)):this.node()[t]},classed:function(t,n){var e=x(t+"");if(arguments.length<2){for(var r=A(this.node()),o=-1,i=e.length;++o=0&&(n=t.slice(e+1),t=t.slice(0,e)),{type:t,name:n}}))}(t+""),a=i.length;if(!(arguments.length<2)){for(s=n?R:j,null==e&&(e=!1),r=0;r>>1;e>>1;t(n[i])>>1);--i>0;)e(t,i,o,n);return t}function e(n,e,r,o){for(var i,a=n[--o+e],s=t(a);(i=e<<1)<=r&&(it(n[o+i+1])&&i++,!(s<=t(n[o+i])));)n[o+e]=n[o+i],e=i;n[o+e]=a}return n.sort=function(t,n,r){for(var o,i=r-n;--i>0;)o=t[n],t[n]=t[n+i],t[n+i]=o,e(t,1,i,n);return t},n}function a(t){var n=i(t);return function(e,r,o,i){var a,s,c,u=new Array(i=Math.min(o-r,i));for(s=0;sa&&(u[0]=c,a=t(n(u,0,i)[0]))}while(++re&&t(n[i-1])>s;--i)n[i]=n[i-1];n[i]=a}return n}}function c(t){var n=s(t);return function e(r,o,i){return(i-o>1,l=u-a,f=u+a,h=n[s],d=t(h),g=n[l],p=t(g),m=n[u],b=t(m),y=n[f],v=t(y),_=n[c],w=t(_);d>p&&(i=h,h=g,g=i,i=d,d=p,p=i),v>w&&(i=y,y=_,_=i,i=v,v=w,w=i),d>b&&(i=h,h=m,m=i,i=d,d=b,b=i),p>b&&(i=g,g=m,m=i,i=p,p=b,b=i),d>v&&(i=h,h=y,y=i,i=d,d=v,v=i),b>v&&(i=m,m=y,y=i,i=b,b=v,v=i),p>w&&(i=g,g=_,_=i,i=p,p=w,w=i),p>b&&(i=g,g=m,m=i,i=p,p=b,b=i),v>w&&(i=y,y=_,_=i,i=v,v=w,w=i);var x=g,A=p,k=y,C=v;n[s]=h,n[l]=n[r],n[u]=m,n[f]=n[o-1],n[c]=_;var T=r+1,M=o-2,S=A<=C&&A>=C;if(S)for(var L=T;L<=M;++L){var D=n[L];if((O=t(D))A)for(;;){if(!((P=t(n[M]))>A)){if(PC)for(;;){if(!((P=t(n[M]))>C)){Pc){for(var B;(B=t(n[T]))<=A&&B>=A;)++T;for(;(P=t(n[M]))<=C&&P>=C;)--M;for(L=T;L<=M;L++){var O;if(D=n[L],(O=t(D))<=A&&O>=A)L!==T&&(n[L]=n[T],n[T]=D),T++;else if(O<=C&&O>=C)for(;;){var P;if(!((P=t(n[M]))<=C&&P>=C)){P32)throw new Error("invalid array width!");return t};function p(t){for(var n=new Array(t),e=-1;++er;)h[--s]=0},dimension:function(t){var l,M,S,L,D,B={filter:function(t){return null==t?X():Array.isArray(t)?q(t):"function"==typeof t?$(t):z(t)},filterExact:z,filterRange:q,filterFunction:$,filterAll:X,top:function(t){for(var n,e=[],r=j;--r>=I&&t>0;)h[n=M[r]]||(e.push(o[n]),--t);return e},bottom:function(t){for(var n,e=[],r=I;r0;)h[n=M[r]]||(e.push(o[n]),--t),r++;return e},group:G,groupAll:function(){var t=G(b),n=t.all;return delete t.all,delete t.top,delete t.order,delete t.orderNatural,delete t.size,t.value=function(){return n()[0].value},t},dispose:Q,remove:Q},O=~u&-~u,P=~O,F=c((function(t){return S[t]})),E=m,N=[],H=[],I=0,j=0;function R(n,r,o){S=n.map(t),L=F(function(t){for(var n=k(t,t),e=-1;++eI)for(r=I,o=Math.min(n,j);rj)for(r=Math.max(n,j),o=e;r1?d(c,s):k(s,D),M&&(f=(l=w[0]).key);N=y);)++N;for(;N_||(c[u=e[N]+i]=B,h[u]&P||(v.value=A(v.value,o[u])),++N>=a));)y=t(n[N]);H()}for(;OO)for(O=0;O1?(F=U,E=z):(!B&&j&&(B=1,r=[{key:null,value:T()}]),1===B?(F=Y,E=q):(F=b,E=b),c=null),p[u]=F}function W(){if(B>1){for(var t=B,n=r,e=k(t,t),o=0,i=0;o1)for(o=0;o1?(E=z,F=U):1===B?(E=q,F=Y):E=F=b}else if(1===B){if(j)return;for(o=0;o=0&&p.splice(t,1),(t=N.indexOf(R))>=0&&N.splice(t,1),(t=T.indexOf(W))>=0&&T.splice(t,1),e}return arguments.length<1&&(t=n),p.push(F),N.push(R),T.push(W),R(l,M,0,s),V().orderNatural()}function Q(){H.forEach((function(t){t.dispose()}));var t=A.indexOf(R);return t>=0&&A.splice(t,1),(t=A.indexOf(W))>=0&&A.splice(t,1),(t=T.indexOf(U))>=0&&T.splice(t,1),u&=P,X()}return A.unshift(R),A.push(W),T.push(U),u|=O,(f>=32?!O:u&-(1<=0&&p.splice(t),(t=A.indexOf(c))>=0&&A.splice(t),i}return p.push(u),A.push(c),c(0,0),f()},size:function(){return s}},o=[],s=0,u=0,f=8,h=l(0),p=[],A=[],T=[];function M(n){var e=s,r=n.length;return r&&(o=o.concat(n),h=d(h,s+=r),A.forEach((function(t){t(n,e,r)}))),t}return arguments.length?M(arguments[0]):t}function k(t,n){return(n<257?l:n<65537?f:h)(t)}function C(t){return 8===t?256:16===t?65536:4294967296}"undefined"!=typeof Uint8Array&&(l=function(t){return new Uint8Array(t)},f=function(t){return new Uint16Array(t)},h=function(t){return new Uint32Array(t)},d=function(t,n){if(t.length>=n)return t;var e=new t.constructor(n);return e.set(t),e},g=function(t,n){var e;switch(n){case 16:e=f(t.length);break;case 32:e=h(t.length);break;default:throw new Error("invalid array width!")}return e.set(t),e}),t.crossfilter=A}(n||this)},function(t,n,e){"use strict";function r(t,n){var e,o,i=/(^([+\-]?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?(?=\D|\s|$))|^0x[\da-fA-F]+$|\d+)/g,a=/^\s+|\s+$/g,s=/\s+/g,c=/^0x[0-9a-f]+$/i,u=/^0/,l=function(t){return(r.insensitive&&(""+t).toLowerCase()||""+t).replace(a,"")},f=l(t),h=l(n),d=f.replace(i,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),g=h.replace(i,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),p=parseInt(f.match(c),16)||1!==d.length&&Date.parse(f),m=parseInt(h.match(c),16)||p&&h.match(/(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/)&&Date.parse(h)||null,b=function(t,n){return(!t.match(u)||1==n)&&parseFloat(t)||t.replace(s," ").replace(a,"")||0};if(m){if(pm)return 1}for(var y=0,v=d.length,_=g.length,w=Math.max(v,_);yo)return 1}}e.r(n);var o=e(0);function i(t){var n;this.config=JSON.parse(JSON.stringify(t)),(n=this).chromosomesArray=[],n.coordinateSystem="iscn",n.maxLength={bp:0,iscn:0},n.chromosomes={},n.numChromosomes=0,n.config.debug||(n.config.debug=!1),n.config.dataDir||(n.config.dataDir=n.getDataDir()),n.config.container||(n.config.container="body"),n.selector=n.config.container+" #_ideogram",n.config.resolution||(n.config.resolution=""),n.config.orientation||(n.config.orientation="vertical"),n.config.brush||(n.config.brush=null),n.config.rows||(n.config.rows=1),"showChromosomeLabels"in n.config==0&&(n.config.showChromosomeLabels=!0),n.config.showNonNuclearChromosomes||(n.config.showNonNuclearChromosomes=!1),function(t){t.config.ploidy||(t.config.ploidy=1),t.config.ploidy>1&&(t.sexChromosomes={},t.config.sex||(t.config.sex="male"),2!==t.config.ploidy||t.config.ancestors||(t.config.ancestors={M:"#ffb6c1",P:"#add8e6"},t.config.ploidyDesc="MP"))}(this),function(t){t.config.showBandLabels||(t.config.showBandLabels=!1),"showFullyBanded"in t.config?t.config.showFullyBanded=t.config.showFullyBanded:t.config.showFullyBanded=!0,t.bandsToShow=[],t.bandData={}}(this),function(t){var n,e,r;t.config.chrHeight||(n=t.config.container,e=document.querySelector(n).getBoundingClientRect(),r="vertical"===t.config.orientation?e.height:e.width,"body"!==n&&0!==r||(r=400),t.config.chrHeight=r)}(this),function(t){var n,e;t.config.chrWidth||(n=10,(e=t.config.chrHeight)<900&&e>500?n=Math.round(e/40):e>=900&&(n=Math.round(e/45)),t.config.chrWidth=n)}(this),function(t){t.config.geometry?"chrMargin"in t.config==0&&(t.config.chrMargin=0):(t.config.chrMargin||(1===t.config.ploidy?t.config.chrMargin=10:t.config.chrMargin=Math.round(t.config.chrWidth/4)),t.config.showBandLabels&&(t.config.chrMargin+=20))}(this),function(t,n){t.onLoad&&(n.onLoadCallback=t.onLoad),t.onLoadAnnots&&(n.onLoadAnnotsCallback=t.onLoadAnnots),t.onDrawAnnots&&(n.onDrawAnnotsCallback=t.onDrawAnnots),t.onBrushMove&&(n.onBrushMoveCallback=t.onBrushMove),t.onDidRotate&&(n.onDidRotateCallback=t.onDidRotate),t.onWillShowAnnotTooltip&&(n.onWillShowAnnotTooltipCallback=t.onWillShowAnnotTooltip)}(t,this),function(t){t.organisms={9606:{commonName:"Human",scientificName:"Homo sapiens",scientificNameAbbr:"H. sapiens",assemblies:{default:"GCF_000001405.26",GRCh38:"GCF_000001405.26",GRCh37:"GCF_000001405.13"}},10090:{commonName:"Mouse",scientificName:"Mus musculus",scientificNameAbbr:"M. musculus",assemblies:{default:"GCF_000001635.20"}},4641:{commonName:"banana",scientificName:"Musa acuminata",scientificNameAbbr:"M. acuminata",assemblies:{default:"mock"}}}}(this),function(t){t.bump=Math.round(t.config.chrHeight/125),t.adjustedBump=!1,t.config.chrHeight<200&&(t.adjustedBump=!0,t.bump=4)}(this),function(t,n){t.chromosome&&(n.config.chromosomes=[t.chromosome],"showBandLabels"in t==0&&(n.config.showBandLabels=!0),"rotatable"in t==0&&(n.config.rotatable=!1))}(t,this),this.initAnnotSettings(),"geometry"in this.config==0&&(this.config.chrMargin+=this.config.chrWidth,"heatmap"===this.config.annotationsLayout?this.config.chrMargin+=this.config.annotTracksHeight:this.config.chrMargin+=2*this.config.annotTracksHeight),this.init()}var a=e(4),s=e.n(a),c=function(t){var n,e,r,i=t.config,a=i.annotationHeight;if("vertical"!==i.orientation){t.config.annotLabelHeight=12;var c=t.config.annotLabelHeight;"demarcateCollinearChromosomes"in t.config==0&&(t.config.demarcateCollinearChromosomes=!0),n=document.querySelectorAll(".chromosome-set"),e=i.numAnnotTracks*(a+c+4)-i.chrWidth+1,function(t,n,e,r){var o,i,a;for(o=0;o0}return!0}}]),t}(),h=function(){function t(n){_classCallCheck(this,t),this._node=n}return _createClass(t,[{key:"getLabel",value:function(){return o.b.select(this._node.parentNode).select("text.chrLabel").text()}},{key:"getSetLabel",value:function(){return o.b.select(this._node.parentNode).select("text.chrSetLabel").text()}}]),t}(),d=function(){function t(n,e){if(_classCallCheck(this,t),this._config=n,this._ideo=e,this._ploidy=this._ideo._ploidy,this._translate=void 0,"chrSetMargin"in n)this.chrSetMargin=n.chrSetMargin;else{var r=this._config.chrMargin;this.chrSetMargin=this._config.ploidy>1?r:0}this._tickSize=8,this._isRotated=!1}return _createClass(t,[{key:"_getLeftMargin",value:function(){return this.margin.left}},{key:"_getYScale",value:function(){return 20/this._config.chrWidth}},{key:"getChromosomeLabels",value:function(t){var n=new h(t),e=[];return this._ideo.config.ploidy>1&&e.push(n.getSetLabel()),e.push(n.getLabel()),e.filter((function(t){return t.length>0}))}},{key:"getChromosomeBandLabelTranslate",value:function(t){var n,e,r,o=this._ideo,i=this._tickSize,a=o.config.orientation;return"vertical"===a?r="rotate(-90)translate("+(n=i)+","+(e=o.round(2+t.px.start+t.px.width/2))+")":"horizontal"===a&&(r="translate("+(n=o.round(-i+t.px.start+t.px.width/2))+","+(e=-10)+")"),{x:n,y:e,translate:r}}},{key:"didRotate",value:function(t,n){var e,r,i,a,s,c,u,l,f;r=(e=this._ideo).config.taxid,i=n.id.split("-")[0].replace("chr",""),a=(s=e.chromosomes[r][i]).bands,l=(u=o.b.select(n.parentNode)).attr("transform"),f=/scale\(.*\)/.exec(l),l=l.replace(f,""),u.attr("transform",l),c=s.width,(s=e.getChromosomeModel(a,i,r,t)).oldWidth=c,e.chromosomes[r][i]=s,e.drawChromosome(s),e.handleRotateOnClick(),e.rawAnnots&&(e.displayedTrackIndexes?e.updateDisplayedTracks(e.displayedTrackIndexes):(e.annots=e.processAnnotData(e.rawAnnots),e.drawProcessedAnnots(e.annots),e.config.filterable&&e.initCrossFilter())),!0===e.config.showBandLabels&&(e.drawBandLabels(e.chromosomes),e.hideUnshownBandLabels()),e.onDidRotateCallback&&e.onDidRotateCallback(s)}},{key:"rotate",value:function(t,n,e){var r,i,a,s;r=this._ideo,s=r.selector+" .chrSetLabel, "+r.selector+" .chrLabel",a=document.querySelector(r.selector).getBoundingClientRect(),i=o.b.selectAll(r.selector+" g.chromosome").filter((function(){return this!==e})),this._isRotated?(this._isRotated=!1,r.config.chrHeight=r.config.chrHeightOriginal,r.config.chrWidth=r.config.chrWidthOriginal,r.config.annotationHeight=r.config.annotationHeightOriginal,this.rotateBack(t,n,e,(function(){i.style("display",null),o.b.selectAll(s).style("display",null),r._layout.didRotate(n,e)}))):(this._isRotated=!0,i.style("display","none"),o.b.selectAll(s).style("display","none"),this.rotateForward(t,n,e,(function(){var t,o,i;r.config.chrHeightOriginal=r.config.chrHeight,r.config.chrWidthOriginal=r.config.chrWidth,r.config.annotationHeightOriginal=r.config.annotationHeight,"VerticalLayout"===r._layout._class?(o=a.width,i=window.innerWidth):(o=a.height-10,i=window.innerHeight-10),t=i0?n:n+4+2*t);if(!this._translate){var i;this._translate=[this._ploidy.getSetSize(0)*o*2];for(var a=1;a1&&(t*=1.8),t}},{key:"rotateForward",value:function(t,n,e,r){var i;o.b.select(e.parentNode).transition().attr("transform","rotate(90) translate(30, -37.5) ").on("end",r),i=this.getChromosomeLabels(e),o.b.select(this._ideo.getSvg()).append("g").attr("class","tmp").selectAll("text").data(i).enter().append("text").attr("class",(function(t,n){return 0===n&&2===i.length?"chrSetLabel":null})).attr("x",26).attr("y",(function(t,n){return 12*(n+1+i.length%2)})).style("text-anchor","middle").style("opacity",0).text(String).transition().style("opacity",1),this._ideo.config.orientation="vertical"}},{key:"rotateBack",value:function(t,n,e,r){var i=this.getChromosomeSetTranslate(t);o.b.select(e.parentNode).transition().attr("transform",i).on("end",r),o.b.selectAll(this._ideo.selector+" g.tmp").style("opacity",0).remove(),this._ideo.config.orientation="horizontal"}},{key:"getHeight",value:function(t){var n=this._config.chromosomes[t].length,e=this.getChromosomeSetYTranslate(n-1);return(e+=this._getChromosomeSetSize(n-1))+2*this._getAdditionalOffset()}},{key:"getWidth",value:function(){return this._config.chrHeight+1.5*this.margin.top}},{key:"getChromosomeSetLabelAnchor",value:function(){return"end"}},{key:"getChromosomeBandLabelAnchor",value:function(){return null}},{key:"getChromosomeBandTickY1",value:function(){return 2}},{key:"getChromosomeBandTickY2",value:function(){return 10}},{key:"getChromosomeSetLabelTranslate",value:function(){return null}},{key:"getChromosomeSetTranslate",value:function(t){return"translate("+this._getLeftMargin()+", "+this.getChromosomeSetYTranslate(t)+")"}},{key:"getChromosomeSetYTranslate",value:function(t){if(!this._config.ploidyDesc)return this._config.chrMargin*(t+1);if(!this._translate){this._translate=[1];for(var n=1;no-1?(e=this.margin.left+1.4*this._config.chrHeight,r=this.getChromosomeSetYTranslate(t-o)):(e=this.margin.left,r=this.getChromosomeSetYTranslate(t)),"rotate(90) translate("+e+", -"+r+")"}},{key:"getChromosomeSetYTranslate",value:function(t){var n=this._getAdditionalOffset();return this.margin.left*t+this._config.chrWidth+2*n+n*t}},{key:"getChromosomeSetLabelXPosition",value:function(t){return(this._ploidy.getSetSize(t)*this._config.chrWidth+20)/-2+(this._config.ploidy>1?0:this._config.chrWidth)}},{key:"getChromosomeLabelXPosition",value:function(){return this._config.chrWidth/-2}}]),n}(d);function y(t,n,e){this.config.annotationsPath&&this.fetchAnnots(this.config.annotationsPath),function(t){if("ploidyDesc"in t.config&&"string"==typeof t.config.ploidyDesc){for(var n=[],e=0;e1?new b(n,t):"vertical"===n.orientation?new g(n,t):"horizontal"===n.orientation?new p(n,t):new g(n,t)}(this),function(t,n){o.b.selectAll(n.config.container+" #_ideogramOuterWrap").remove(),o.b.select(n.config.container).append("div").attr("id","_ideogramOuterWrap").append("div").attr("id","_ideogramTrackLabelContainer").style("position","absolute"),o.b.select(n.config.container+" #_ideogramOuterWrap").append("div").attr("id","_ideogramMiddleWrap").style("position","relative").style("overflow-x","auto").append("div").attr("id","_ideogramInnerWrap").append("svg").attr("id","_ideogram").attr("class",function(t){var n="";return t.config.showChromosomeLabels&&("horizontal"===t.config.orientation?n+="labeledLeft ":n+="labeled "),t.config.annotationsLayout&&"overlay"===t.config.annotationsLayout&&(n+="faint"),n}(n)).attr("width",n._layout.getWidth(t)).attr("height",n._layout.getHeight(t)).html(n.getBandColorGradients())}(n,this),this.isOnlyIdeogram=1===document.querySelectorAll("#_ideogram").length,function(t){o.b.select(t.config.container+" #_ideogramOuterWrap").append("div").attr("class","_ideogramTooltip").attr("id","_ideogramTooltip").style("opacity",0).style("position","fixed").style("text-align","center").style("padding","4px").style("font","12px sans-serif").style("background","white").style("border","1px solid black").style("border-radius","5px").style("z-index","100")}(this),this.finishInit(t,e)}var v=e(5);function _(t,n,e){var r=e.config.ploidy;return"sex"in e.config&&(2===r&&e.sexChromosomes.index+2===n||"female"===e.config.sex&&"Y"===t.name)}function w(t,n,e,r,o){var i,a,s,c;for(i=0;i=chrBands.length/2&&(n.coordinateSystem="bp")}function A(t){var n,e,r,o=this.config.taxids,i=0;for(t.length>0&&(this.bandsArray={}),e=0;e=4&&(f=h[3],i[0]=f),h.length>=8&&(u=h[8].split(","),l=t.rgbToHex(u[0],u[1],u[2]),i.push(l)),[a,i])}},{key:"parseRawAnnots",value:function(t,n,e,r){var o,i,a,s,c,u;for(u=!0,!1===isNaN(parseInt(e[n],10))&&(u=!1),o=n;o=8&&c.push("color"),{keys:c,annots:t}}},{key:"parseBed",value:function(t,n){var e,r,o,i,a=[],s=t.split(/\r\n|\n/);for(r=Object.keys(n.chromosomes[n.config.taxid]),e=0;er||e===o||0!==t&&t!==n&&e<=o&&e>r||0===t&&e<=o}function E(t,n){var e,r,o,i,a,s,c,u;for(e=0;e0&&(i+=e.config.chrMargin*t.chrIndex-1),s=o.b.select(e.config.container+" #_ideogramInnerWrap").append("canvas").attr("id",c).attr("width",u+1).attr("height",a).style("position","absolute").style("left",i+"px").style("top",a*r+1+"px").nodes()[0].getContext("2d"),l.push([s,t]);return l}function H(t,n,e){var r,o,i,a,s=e.config.annotLabelHeight,c=e.config.annotationHeight,u=e.config.demarcateCollinearChromosomes,l=c+s+4;for(r=0;ro.startPx||o.startPx>a.width-1)continue;i.fillRect(o.startPx,1,.5,l)}else i.fillRect(o.startPx,s+1,.5,c);if(u)for(r=0;r"),o.b.select(n.config.container+" #_ideogramTrackLabel").interrupt().style("top","").style("left","").style("transform",null).style("transform","rotate(-90deg)").html(i),e=function(t,n,e){var r,i,a,s,c;return r=n.id.split("-").slice(0,-1).join("-")+"-0",i=o.b.select(e.config.container+" #"+r).nodes()[0].getBoundingClientRect(),a=o.b.select(e.config.container+" #_ideogramTrackLabel").nodes()[0].getBoundingClientRect(),s=o.b.select(e.config.container).nodes()[0].getBoundingClientRect(),c=Math.round(i.left+a.width)-i.width-1,[c-=s.left-7,-(t.split("
").length-2)*i.width+2]}(i,t,n),a=(r=_slicedToArray(e,2))[0],function(t,n,e){o.b.select(e.config.container+" #_ideogramTrackLabel").style("opacity",1).style("left",n+"px").style("top",t+"px").style("width","max-content").style("transform-origin","bottom left").style("text-align","left").on("mouseover",(function(){clearTimeout(e.hideTrackLabelTimeout)})).on("mouseout",(function(){R(e)}))}(r[1],a,n)}(this,a)})).on("mouseout",(function(){R(a)})),a.onDrawAnnotsCallback&&a.onDrawAnnotsCallback()}function z(t,n,e){var r,o,i,a,s,c,u,l=[];for(r=0;r0&&(r+="-"+t.stop.toLocaleString()),n=r,e=24,t.name&&(n=(t.displayName?t.displayName:t.name)+"
"+n,e+=8),[n,e]}(t),function(t,n,e,r,o){t.html(n).style("opacity",1).style("left",e.e+"px").style("top",e.f-r+"px").style("pointer-events",null).on("mouseover",(function(){clearTimeout(o.hideAnnotTooltipTimeout)})).on("mouseout",(function(){o.startHideAnnotTooltipTimeout()}))}(a,(r=_slicedToArray(e,2))[0],i,r[1],this))}function K(t){var n,e,r=!1,o=(new Date).getTime();return n=this.chromosomes[this.config.taxid],function(t){"histogramScaling"in t.config==0&&(t.config.histogramScaling="absolute")}(this),void 0===this.maxAnnotsPerBar&&(this.maxAnnotsPerBar={},r=!0),function(t,n,e){var r,o,i,a,s,c,u;if(n||"relative"===e.config.histogramScaling){for(r=0,o=0;oi&&(i=u),u>r&&(r=u);e.maxAnnotsPerBar[s]=i}e.maxAnnotsPerBarAllChrs=r}}(e=function(t,n,e,r){var o,i,a,s,c,u,l,f,h,d,g=r.config.barWidth;for(o in t)for(i=t[o].annots,s=n[(a=e[t[o].chr]).chrIndex].annots,c=0;c=h&&l":"triangle"===r&&(n='"):n='",n}function J(t,n,e){var r,o,i;for(r=0;r"+(i=e.rows[r]).name+"",o=19*r,"name"in e&&(o+=19),n+=''+Z(i)+"";return[t,n]}function tt(t){var n,e,r=[],o=this.chromosomes[this.config.taxid];if("annots"in t[0]||"values"in t[0])return this.drawProcessedAnnots(t);for(e in o)r.push({chr:e,annots:[]});r=function(t,n){var e,r,o,i;for(e=0;e"+a.name+""),i=(c=_slicedToArray(J(i,r='',a),2))[0],r=c[1],s+=(r+="")+"
    "+i+"
"}var u=o.b.select(t.config.container+" #_ideogramOuterWrap");u.append("style").html("#_ideogramLegend {font: 12px Arial; line-height: 19px; overflow: auto;} #_ideogramLegend svg {float: left;} #_ideogramLegend ul {position: relative; left: -14px; list-style: none; float: left; padding-left: 10px; margin: 0 0 1em 0; width: auto; border: none;} #_ideogramLegend li {float: none; margin: 0;}#_ideogramLegend ul span {position: relative; left: -15px;} "),u.append("div").attr("id","_ideogramLegend").html(s)}(this),/heatmap/.test(n)?this.drawHeatmaps(t):(function(t,n,e){var r;!function(t,n){var e,r;if(!/heatmap/.test(t)&&"histogram"!==t){for(r=0,e=0;e2e3&&console.warn('Rendering more than 2000 annotations in Ideogram?\nTry setting "annotationsLayout" to "heatmap" or "histogram" in your Ideogram configuration object for better layout and performance.')}}(t,n),"histogram"===t&&(n=e.getHistogramBars(n)),r=function(t,n){return o.b.selectAll(n.selector+" .chromosome").data(t).selectAll("path.annot").data((function(t){return t.annots})).enter()}(e.fillAnnots(n),e),"tracks"===t?function(t,n){var e,r=n.config.annotationHeight;e=function(t){var n;return{triangle:"m0,0 l -"+t+" "+2*t+" l "+2*t+" 0 z",circle:"m -"+(n=t)+", "+n+"a "+n+","+n+" 0 1,0 "+2*n+",0a "+n+","+n+" 0 1,0 -"+2*n+",0",rectangle:"m0,0 l 0 "+2*t+"l "+t+" 0l 0 -"+2*t+"z"}}(r),t.append("g").attr("id",(function(t){return t.id})).attr("class","annot").attr("transform",(function(t){var e=n.config.chrWidth+t.trackIndex*r*2;return"translate("+t.px+","+e+")"})).append("path").attr("d",(function(t){return function(t,n){return t.shape&&"triangle"!==t.shape?"circle"===t.shape?n.circle:"rectangle"===t.shape?n.rectangle:t.shape:n.triangle}(t,e)})).attr("fill",(function(t){return t.color})).on("mouseover",(function(t){n.showAnnotTooltip(t,this)})).on("mouseout",(function(){n.startHideAnnotTooltipTimeout()}))}(r,e):"overlay"===t?function(t,n){t.append("polygon").attr("id",(function(t){return t.id})).attr("class","annot").attr("points",(function(t){var e,r,o=n.config.chrWidth;return t.stopPx-t.startPx>1?(e=t.startPx,r=t.stopPx):(e=t.px-.5,r=t.px+.5),e+","+o+" "+r+","+o+" "+r+",0 "+e+",0"})).attr("fill",(function(t){return t.color})).on("mouseover",(function(t){n.showAnnotTooltip(t,this)})).on("mouseout",(function(){n.startHideAnnotTooltipTimeout()}))}(r,e):"histogram"===t&&function(t,n){var e,r,o={},i=n.config.chrWidth;for(r in e=n.chromosomes[n.config.taxid])o[r]=e[r];t.append("polygon").attr("class","annot").attr("points",(function(t){return function(t,n,e,r){var o,i,a,s;o=t.px+r.bump,i=t.px+r.config.barWidth+r.bump,a=n,s=n+t.height;var c=e[t.chr];return i>c&&(i=c),o+","+a+" "+i+","+a+" "+i+","+s+" "+o+","+s}(t,i,o,n)})).attr("fill",(function(t){return t.color}))}(r,e)}(n,t,this),this.onDrawAnnotsCallback&&this.onDrawAnnotsCallback())}function et(t,n,e){return t.append("g").attr("class","syntenicRegion").attr("id",n).on("click",(function(){var t=this,n=o.b.selectAll(e.selector+" .syntenicRegion").filter((function(){return this!==t}));n.classed("hidden",!n.classed("hidden"))})).on("mouseover",(function(){var t=this;o.b.selectAll(e.selector+" .syntenicRegion").filter((function(){return this!==t})).classed("ghost",!0)})).on("mouseout",(function(){o.b.selectAll(e.selector+" .syntenicRegion").classed("ghost",!1)}))}function rt(t,n,e){var r,o;return r=t.r1,o=t.r2,r.startPx=e.convertBpToPx(r.chr,r.start)+n,r.stopPx=e.convertBpToPx(r.chr,r.stop)+n,o.startPx=e.convertBpToPx(o.chr,o.start)+n,o.stopPx=e.convertBpToPx(o.chr,o.stop)+n,[r,o]}function ot(t,n,e,r,o,i){var a,s;a="color"in i?i.color:"#CFC",s="opacity"in i?i.opacity:1,t.append("polygon").attr("points",n+", "+r.startPx+" "+n+", "+r.stopPx+" "+e+", "+o.stopPx+" "+e+", "+o.startPx).style("fill",a).style("fill-opacity",s)}function it(t,n,e,r,o){t.append("line").attr("class","syntenyBorder").attr("x1",n).attr("x2",e).attr("y1",r.startPx).attr("y2",o.startPx),t.append("line").attr("class","syntenyBorder").attr("x1",n).attr("x2",e).attr("y1",r.stopPx).attr("y2",o.stopPx)}function at(t){var n=(new Date).getTime();(function(t,n,e,r){var o,i,a,s,c,u,l,f;for(o=0;oc&&(c=s+1),i.splice(4,0,s),a.push(i);u.push({chr:o.chr,annots:a})}return n.numAvailTracks=c,u}(t.annots,this),n.splice(4,0,"trackIndexOriginal"),t={keys:n,annots:e},this.rawAnnots.metadata&&(t.metadata=this.rawAnnots.metadata),t)}var lt=[["F00"],["F00","88F"],["F00","CCC","88F"],["F00","FA0","0AF","88F"],["F00","FA0","CCC","0AF","88F"],["F00","FA0","875","578","0AF","88F"],["F00","FA0","875","CCC","578","0AF","88F"],["F00","FA0","7A0","875","0A7","578","0AF","88F"],["F00","FA0","7A0","875","CCC","0A7","578","0AF","88F"],["F00","FA0","7A0","875","552","255","0A7","578","0AF","88F"]];function ft(t,n,e,r,o,i,a){var s;return a.config.annotationTracks?o=function(t,n,e,r,o){var i;return n.trackIndex=e[3],(i=o.config.annotationTracks[n.trackIndex]).color&&(n.color=i.color),i.shape&&(n.shape=i.shape),t[r].annots.push(n),t}(o,t,e,i,a):"trackIndex"===n[3]&&1!==a.numAvailTracks?(o=(s=_slicedToArray(function(t,n,e,r,o,i){var a=lt[i.numAvailTracks-1];return t.trackIndex=n[3],t.trackIndexOriginal=n[4],t.color="#"+a[t.trackIndexOriginal],t.trackIndex>i.config.numTracks-1?(t.trackIndex in e?e[t.trackIndex].push(t):e[t.trackIndex]=[t],[r,e]):(r[o].annots.push(t),[r,e])}(t,e,r,o,i,a),2))[0],r=s[1]):o=function(t,n,e,r){return n.trackIndex=0,n.color||(n.color=r.config.annotationsColor),n.shape||(n.shape="triangle"),t[e].annots.push(n),t}(o,t,i,a),[o,r]}function ht(t,n,e,r,o,i,a){var s,c,u,l;for(s=0;s10&&console.error("Ideogram only displays up to 10 tracks at a time. You specified "+o+" tracks. Perhaps consider a different way to visualize your data."),(e=Object.keys(t).length)&&console.warn("Ideogram configuration specified "+o+" tracks, but loaded annotations contain "+e+" extra tracks.")}(i,this),o}var pt=function(){function t(n,e){_classCallCheck(this,t),this.matrix=n,this.ideo=e}return _createClass(t,[{key:"setRawAnnots",value:function(){var t,n,e;return t=this,n=this.ideo,e=this.matrix,new Promise((function(r){t.rawAnnots=t.fetchCoordinates(n).then((function(o){t.coordinates=o,r(t.parseExpressionMatrix(e,n))}))}))}},{key:"fetchCoordinates",value:function(t){var n={};if("human"===t.config.organism){var e=t.config.dataDir+"../../annotations/Homo_sapiens,_Ensembl_80.tsv";return new Promise((function(t){o.b.text(e).then((function(e){var r,o,i,a,s,c,u;for(r=e.split(/\r\n|\n/).slice(1),o=0;o100){if(void 0===e.recovering)return o.getAssemblyAndChromosomesFromEutils(e.callback,!0),Promise.reject("Unexpectedly found genomic scaffolds instead of chromosomes while querying RefSeq. Recovering.");throw Error("Failed to find chromosomes for genome "+r)}}(t,n,e),r=t.linksets[0].linksetdbs[0].links.join(","),i=e.ideo.esummary+"&db=nucleotide&id="+r,o.b.json(i)}(t,i,s)})).then((function(n){return i=function(t,n,e){var r,o,i=[];for(r in t)"uids"!==r&&(o=kt(t[r],e),i.push(o));return i=i.sort(Ideogram.sortChromosomes),e.coordinateSystem="bp",n.push(i),n}(n.result,i,a),t(i)}),(function(t){console.warn(t)}))}function Tt(){var t=this.bandsToShow.join(",");o.b.selectAll(this.selector+" .bandLabel, .bandLabelStalk").style("display","none"),o.b.selectAll(t).style("display","")}function Mt(t,n,e,r,o){return n!==e&&(t=r[o.id][e]+36),t}function St(t,n,e,r,o,i,a){var s,c;return e',a+="gneg"===e?'':'',a+=""}return a}(_t),wt+""+(t+=xt)+""}_t=[["gneg","#FFF","#FFF","#DDD"],["gpos25","#C8C8C8","#DDD","#BBB"],["gpos33","#BBB","#BBB","#AAA"],["gpos50","#999","#AAA","#888"],["gpos66","#888","#888","#666"],["gpos75","#777","#777","#444"],["gpos100","#444","#666","#000"],["acen","#FEE","#FEE","#FDD"],["noBands","#BBB","#BBB","#AAA"]],wt='',xt=' ';var Nt=e(3);function Ht(t,n,e,r){var o,i;return o=n[t],e.push(o),(i={iscn:o[o.length-1].iscn.stop,bp:o[o.length-1].bp.stop}).iscn>r.maxLength.iscn&&(r.maxLength.iscn=i.iscn),i.bp>r.maxLength.bp&&(r.maxLength.bp=i.bp),e}function It(t,n,e,o){var i,a;if("iscn"===o.coordinateSystem||o.config.multiorganism)e=function(t,n,e,o){var i,a,s;for(i=o.bandData[t],a=o.parseBands(i,t,n),n=Object.keys(a).sort((function(t,n){return r(t,n)})),o.config.chromosomes[t]=n.slice(),o.numChromosomes+=o.config.chromosomes[t].length,s=0;so.maxLength.bp&&(o.maxLength.bp=i.length);return e}function jt(){var t,n,e,r,o,i,a,s,c=(new Date).getTime();e=[],t=function(t){var n,e,r;if(!0===t.config.multiorganism)for(t.coordinateSystem="bp",r=t.config.taxids,n=0;n1&&o.length>1&&(t=r[0].replace("chr",""),o=r[1].split("-"),n=parseInt(o[0]),e=parseInt(o[1]-1)),[t,n,e]}(t,n,e),t=(i=_slicedToArray(r,3))[0],n=i[1],e=i[2],u=(a=_slicedToArray(function(t,n){var e,r,o=[1],i=[1],a=t.bands.slice(-1)[0];for(r=0;r1){if(o=function(t,n){var e,r,o,i,a,s,c,u,l;for(e=0;e=a&&n<=s)return[u+l*(o+i/c*(n-a)-o)/i,r];return[null,r]}(t,n),r=(i=_slicedToArray(o,2))[0],e=i[1],null!==r)return r}else if(n>=1&&n<=t.length)return t.scale.bp*n;!function(t,n,e){throw new Error("Base pair out of range. bp: "+t+"; length of chr"+n.name+": "+e.bp.stop)}(n,t,e)}function Xt(t,n,e,r,o,i,a){var s,c,u,l;return a=t-n,s=r-o,c=i.bp.stop-i.bp.start,u=n+a/s*(e-o),l=i.bp.start+c*(u-n)/a,Math.round(l)}function $t(t,n){var e,r,o,i,a,s;for(0===n&&(n=t.bands[0].px.start),e=0;e=o&&n<=i)return Xt(s,a,n,i,o,r,void 0);!function(t,n,e){throw new Error("Pixel out of range. px: "+t+"; length of chr"+n.name+": "+e)}(n,t,i)}var Vt=e(6);function Gt(){var t,n,e=[],r=this.annots;for(n=0;n1&&this._model.bands.push({name:"q",px:{start:0,stop:this._model.width,width:this._model.width},bp:{start:1,stop:this._model.length}}),this._model}},{key:"getCssClass",value:function(){return"noBands"}}]),n}(nn),rn=function(){function t(n){_classCallCheck(this,t),this._config=n,this._ploidy=new f(this._config)}return _createClass(t,[{key:"getArmColor",value:function(t,n,e){return this._config.armColors?this._config.armColors[e]:this._config.ancestors?this._getPolyploidArmColor(t,n,e):null}},{key:"getBorderColor",value:function(t,n,e){return n1&&(r=this._ploidy.getChromosomesNumber(n)),a=0;a1||""===n.orientation)&&(t-=1),t}(n,s),o=-4,!0===s.showBandLabels&&(o=s.chrMargin+s.chrWidth+26),i=s.chrMargin*n,s.numAnnotTracks>1==0&&(i+=1),a=i+o,t.selectAll("text.chrLabel").attr("transform",e.scaleSvg).selectAll("tspan").attr("x",e.x).attr("y",a)}(t,n,o,this):function(t,n,e,r){var o,i,a,s=r.config;o=-s.chrWidth-2,!0===s.showBandLabels&&(o=s.chrMargin+8),i=s.annotTracksHeight,"overlay"!==s.annotationsLayout&&(i*=2),a=3-(s.chrMargin*n+o)+i,a/=e.scale.x,t.selectAll("text.chrLabel").attr("transform","rotate(-90)"+e.scaleSvg).selectAll("tspan").attr("x",a).attr("y",e.y)}(t,n,o,this)}var pn=function(){function t(n){_classCallCheck(this,t),this.configure=i,this.initDrawChromosomes=A,this.onLoad=C,this.handleRotateOnClick=k,this.init=S,this.finishInit=l,this.writeContainer=y,this.onLoadAnnots=X,this.onDrawAnnots=$,this.processAnnotData=gt,this.restoreDefaultTracks=st,this.updateDisplayedTracks=ct,this.initAnnotSettings=mt,this.fetchAnnots=yt,this.drawAnnots=tt,this.getHistogramBars=K,this.drawHeatmaps=Y,this.deserializeAnnotsForHeatmap=q,this.fillAnnots=vt,this.drawProcessedAnnots=nt,this.drawSynteny=at,this.startHideAnnotTooltipTimeout=V,this.showAnnotTooltip=Q,this.onWillShowAnnotTooltip=G,this.setOriginalTrackIndexes=ut,this.afterRawAnnots=bt,this.esearch="https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?retmode=json&api_key=7e33ac6a08a6955ec3b83d214d22b21a2808",this.esummary="https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esummary.fcgi?retmode=json&api_key=7e33ac6a08a6955ec3b83d214d22b21a2808",this.elink="https://eutils.ncbi.nlm.nih.gov/entrez/eutils/elink.fcgi?retmode=json&api_key=7e33ac6a08a6955ec3b83d214d22b21a2808",this.getTaxidFromEutils=At.b,this.setTaxidData=At.e,this.setTaxidAndAssemblyAndChromosomes=At.d,this.getOrganismFromEutils=At.a,this.getTaxids=At.c,this.getAssemblyAndChromosomesFromEutils=Ct,this.parseBands=Nt.a,this.drawBandLabels=Pt,this.getBandColorGradients=Et,this.processBandData=jt,this.setBandsToShow=Dt,this.hideUnshownBandLabels=Tt,this.drawBandLabelText=Bt,this.drawBandLabelStalk=Ot,this.onBrushMove=Wt,this.createBrush=Ut,this.drawSexChromosomes=Yt,this.setSexChromosomes=zt,this.convertBpToPx=qt,this.convertPxToBp=$t,this.unpackAnnots=Gt,this.packAnnots=Qt,this.initCrossFilter=Kt,this.filterAnnots=Zt,this.assemblyIsAccession=o.a,this.getDataDir=o.c,this.round=o.h,this.onDidRotate=o.g,this.getSvg=o.d,this.getChromosomeModel=tn,this.getChromosomePixels=Jt,this.drawChromosomeLabels=dn,this.rotateChromosomeLabels=gn,this.appendHomolog=un,this.drawChromosome=ln,this.rotateAndToggleDisplay=fn,this.setOverflowScroll=hn,this.configure(n)}return _createClass(t,null,[{key:"slugify",value:function(t){return t.toLowerCase().replace(" ","-")}},{key:"sortChromosomes",value:function(t,n){var e="nuclear"===t.type,o="nuclear"===n.type,i="chloroplast"===t.type,a="chloroplast"===n.type,s="mitochondrion"===t.type,c="mitochondrion"===n.type,u="apicoplast"===t.type,l="apicoplast"===n.type;return e&&o?r(t.name,n.name):!e&&o?1:s&&a?1:i&&c?-1:u||s||i||!(c||a||l)?void 0:-1}},{key:"version",get:function(){return"1.6.0"}},{key:"d3",get:function(){return o.b}}]),t}();window.Ideogram=pn,n.default=pn}])},"object"==_typeof(exports)&&"object"==_typeof(module)?module.exports=n():(__WEBPACK_AMD_DEFINE_ARRAY__=[],void 0===(__WEBPACK_AMD_DEFINE_RESULT__="function"==typeof(__WEBPACK_AMD_DEFINE_FACTORY__=n)?__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports,__WEBPACK_AMD_DEFINE_ARRAY__):__WEBPACK_AMD_DEFINE_FACTORY__)||(module.exports=__WEBPACK_AMD_DEFINE_RESULT__))}).call(this,__webpack_require__(75)(module))},41:function(t,n,e){"use strict";e.r(n),e.d(n,"default",(function(){return p}));var r=e(1),o=e.n(r),i=e(249),a=e.n(i),s=e(466),c=e(14);function u(t){return(u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function l(){return(l=Object.assign||function(t){for(var n=1;n= 0 && (prefix = name.slice(0, i)) !== \"xmlns\") name = name.slice(i + 1);\n return namespaces.hasOwnProperty(prefix) ? {space: namespaces[prefix], local: name} : name;\n}\n","import namespace from \"./namespace\";\nimport {xhtml} from \"./namespaces\";\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","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","var matcher = function(selector) {\n return function() {\n return this.matches(selector);\n };\n};\n\nif (typeof document !== \"undefined\") {\n var element = document.documentElement;\n if (!element.matches) {\n var vendorMatches = element.webkitMatchesSelector\n || element.msMatchesSelector\n || element.mozMatchesSelector\n || element.oMatchesSelector;\n matcher = function(selector) {\n return function() {\n return vendorMatches.call(this, selector);\n };\n };\n }\n}\n\nexport default matcher;\n","export default function(update) {\n return new Array(update.length);\n}\n","import sparse from \"./sparse\";\nimport {Selection} from \"./index\";\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\";\nimport {EnterNode} from \"./enter\";\nimport constant from \"../constant\";\n\nvar keyPrefix = \"$\"; // Protect against keys like “__proto__”.\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 = {},\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 = keyPrefix + key.call(node, node.__data__, i, group);\n if (keyValue in nodeByKeyValue) {\n exit[i] = node;\n } else {\n nodeByKeyValue[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 = keyPrefix + key.call(parent, data[i], i, data);\n if (node = nodeByKeyValue[keyValue]) {\n update[i] = node;\n node.__data__ = data[i];\n nodeByKeyValue[keyValue] = null;\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[keyValues[i]] === node)) {\n exit[i] = node;\n }\n }\n}\n\nexport default function(value, key) {\n if (!value) {\n data = new Array(this.size()), j = -1;\n this.each(function(d) { data[++j] = d; });\n return data;\n }\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 = 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","import {Selection} from \"./index\";\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","import namespace from \"../namespace\";\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\";\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 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 creator from \"../creator\";\nimport selector from \"../selector\";\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 return this.parentNode.insertBefore(this.cloneNode(false), this.nextSibling);\n}\n\nfunction selection_cloneDeep() {\n return this.parentNode.insertBefore(this.cloneNode(true), this.nextSibling);\n}\n\nexport default function(deep) {\n return this.select(deep ? selection_cloneDeep : selection_cloneShallow);\n}\n","var filterEvents = {};\n\nexport var event = null;\n\nif (typeof document !== \"undefined\") {\n var element = document.documentElement;\n if (!(\"onmouseenter\" in element)) {\n filterEvents = {mouseenter: \"mouseover\", mouseleave: \"mouseout\"};\n }\n}\n\nfunction filterContextListener(listener, index, group) {\n listener = contextListener(listener, index, group);\n return function(event) {\n var related = event.relatedTarget;\n if (!related || (related !== this && !(related.compareDocumentPosition(this) & 8))) {\n listener.call(this, event);\n }\n };\n}\n\nfunction contextListener(listener, index, group) {\n return function(event1) {\n var event0 = event; // Events can be reentrant (e.g., focus).\n event = event1;\n try {\n listener.call(this, this.__data__, index, group);\n } finally {\n event = event0;\n }\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.capture);\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, capture) {\n var wrap = filterEvents.hasOwnProperty(typename.type) ? filterContextListener : contextListener;\n return function(d, i, group) {\n var on = this.__on, o, listener = wrap(value, i, group);\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.capture);\n this.addEventListener(o.type, o.listener = listener, o.capture = capture);\n o.value = value;\n return;\n }\n }\n this.addEventListener(typename.type, listener, capture);\n o = {type: typename.type, name: typename.name, value: value, listener: listener, capture: capture};\n if (!on) this.__on = [o];\n else on.push(o);\n };\n}\n\nexport default function(typename, value, capture) {\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 if (capture == null) capture = false;\n for (i = 0; i < n; ++i) this.each(on(typenames[i], value, capture));\n return this;\n}\n\nexport function customEvent(event1, listener, that, args) {\n var event0 = event;\n event1.sourceEvent = event;\n event = event1;\n try {\n return listener.apply(that, args);\n } finally {\n event = event0;\n }\n}\n","import defaultView from \"../window\";\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\";\nimport selection_selectAll from \"./selectAll\";\nimport selection_filter from \"./filter\";\nimport selection_data from \"./data\";\nimport selection_enter from \"./enter\";\nimport selection_exit from \"./exit\";\nimport selection_merge from \"./merge\";\nimport selection_order from \"./order\";\nimport selection_sort from \"./sort\";\nimport selection_call from \"./call\";\nimport selection_nodes from \"./nodes\";\nimport selection_node from \"./node\";\nimport selection_size from \"./size\";\nimport selection_empty from \"./empty\";\nimport selection_each from \"./each\";\nimport selection_attr from \"./attr\";\nimport selection_style from \"./style\";\nimport selection_property from \"./property\";\nimport selection_classed from \"./classed\";\nimport selection_text from \"./text\";\nimport selection_html from \"./html\";\nimport selection_raise from \"./raise\";\nimport selection_lower from \"./lower\";\nimport selection_append from \"./append\";\nimport selection_insert from \"./insert\";\nimport selection_remove from \"./remove\";\nimport selection_clone from \"./clone\";\nimport selection_datum from \"./datum\";\nimport selection_on from \"./on\";\nimport selection_dispatch from \"./dispatch\";\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\nSelection.prototype = selection.prototype = {\n constructor: Selection,\n select: selection_select,\n selectAll: selection_selectAll,\n filter: selection_filter,\n data: selection_data,\n enter: selection_enter,\n exit: selection_exit,\n merge: selection_merge,\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};\n\nexport default selection;\n","import {Selection} from \"./index\";\nimport selector from \"../selector\";\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\";\nimport selectorAll from \"../selectorAll\";\n\nexport default function(select) {\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 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","import {Selection} from \"./index\";\nimport matcher from \"../matcher\";\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\";\nimport {Selection} from \"./index\";\n\nexport default function() {\n return new Selection(this._exit || this._groups.map(sparse), this._parents);\n}\n","import {Selection} from \"./index\";\n\nexport default function(selection) {\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 && next !== node.nextSibling) 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 var nodes = new Array(this.size()), i = -1;\n this.each(function() { nodes[++i] = this; });\n return nodes;\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 var size = 0;\n this.each(function() { ++size; });\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","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","import creator from \"../creator\";\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","import {Selection, root} from \"./selection/index\";\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 creator from \"./creator\";\nimport select from \"./select\";\n\nexport default function(name) {\n return select(creator(name).call(document.documentElement));\n}\n","var nextId = 0;\n\nexport default function local() {\n return new Local;\n}\n\nfunction Local() {\n this._ = \"@\" + (++nextId).toString(36);\n}\n\nLocal.prototype = local.prototype = {\n constructor: Local,\n get: function(node) {\n var id = this._;\n while (!(id in node)) if (!(node = node.parentNode)) return;\n return node[id];\n },\n set: function(node, value) {\n return node[this._] = value;\n },\n remove: function(node) {\n return this._ in node && delete node[this._];\n },\n toString: function() {\n return this._;\n }\n};\n","import {event} from \"./selection/on\";\n\nexport default function() {\n var current = event, source;\n while (source = current.sourceEvent) current = source;\n return current;\n}\n","export default function(node, event) {\n var svg = node.ownerSVGElement || node;\n\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\n var rect = node.getBoundingClientRect();\n return [event.clientX - rect.left - node.clientLeft, event.clientY - rect.top - node.clientTop];\n}\n","import sourceEvent from \"./sourceEvent\";\nimport point from \"./point\";\n\nexport default function(node) {\n var event = sourceEvent();\n if (event.changedTouches) event = event.changedTouches[0];\n return point(node, event);\n}\n","import {Selection, root} from \"./selection/index\";\n\nexport default function(selector) {\n return typeof selector === \"string\"\n ? new Selection([document.querySelectorAll(selector)], [document.documentElement])\n : new Selection([selector == null ? [] : selector], root);\n}\n","import sourceEvent from \"./sourceEvent\";\nimport point from \"./point\";\n\nexport default function(node, touches, identifier) {\n if (arguments.length < 3) identifier = touches, touches = sourceEvent().changedTouches;\n\n for (var i = 0, n = touches ? touches.length : 0, touch; i < n; ++i) {\n if ((touch = touches[i]).identifier === identifier) {\n return point(node, touch);\n }\n }\n\n return null;\n}\n","import sourceEvent from \"./sourceEvent\";\nimport point from \"./point\";\n\nexport default function(node, touches) {\n if (touches == null) touches = sourceEvent().touches;\n\n for (var i = 0, n = touches ? touches.length : 0, points = new Array(n); i < n; ++i) {\n points[i] = point(node, touches[i]);\n }\n\n return points;\n}\n","/**\n * @fileoverview A collection of Ideogram methods that don't fit elsewhere.\n */\n\nimport * as d3selection from 'd3-selection';\n\nvar d3 = Object.assign({}, d3selection);\n\n/**\n * Is the assembly in this.config an NCBI Assembly accession?\n *\n * @returns {boolean}\n */\nfunction assemblyIsAccession() {\n return (\n 'assembly' in this.config &&\n /(GCF_|GCA_)/.test(this.config.assembly)\n );\n}\n\n/**\n * Is the assembly in this.config not from GenBank?\n *\n * @returns {boolean}\n */\nfunction hasNonGenBankAssembly(ideo) {\n return (\n 'assembly' in ideo.config &&\n /(GCA_)/.test(ideo.config.assembly) === false\n );\n}\n\n/**\n * Is the assembly in this.config from GenBank?\n *\n * @returns {boolean}\n */\nfunction hasGenBankAssembly(ideo) {\n return (\n 'assembly' in ideo.config &&\n /(GCA_)/.test(ideo.config.assembly)\n );\n}\n\n/**\n * Returns directory used to fetch data for bands and annotations\n *\n * This simplifies ideogram configuration. By default, the dataDir is\n * set to an external CDN unless we're serving from the local host, in\n * which case dataDir is deduced from the \"src\" attribute of the ideogram\n * script loaded in the document.\n *\n * @returns {String}\n */\nfunction getDataDir() {\n var script, tmp, protocol, dataDir, ideogramInLeaf,\n scripts = document.scripts,\n host = location.host.split(':')[0],\n version = Ideogram.version;\n\n if (host !== 'localhost' && host !== '127.0.0.1') {\n return (\n 'https://unpkg.com/ideogram@' + version + '/dist/data/bands/native/'\n );\n }\n\n for (var i = 0; i < scripts.length; i++) {\n script = scripts[i];\n ideogramInLeaf = /ideogram/.test(script.src.split('/').slice(-1));\n if ('src' in script && ideogramInLeaf) {\n tmp = script.src.split('//');\n protocol = tmp[0];\n tmp = '/' + tmp[1].split('/').slice(0,-2).join('/');\n dataDir = protocol + '//' + tmp + '/data/bands/native/';\n return dataDir;\n }\n }\n return '../data/bands/native/';\n}\n\n/**\n * Rounds an SVG coordinates to two decimal places\n *\n * @param coord SVG coordinate, e.g. 42.1234567890\n * @returns {number} Rounded value, e.g. 42.12\n */\nfunction round(coord) {\n // Per http://stackoverflow.com/a/9453447, below method is fastest\n return Math.round(coord * 100) / 100;\n}\n\nfunction onDidRotate(chrModel) {\n call(this.onDidRotateCallback, chrModel);\n}\n\n/**\n * Get ideogram SVG container\n */\nfunction getSvg() {\n return d3.select(this.selector).node();\n}\n\nexport {\n assemblyIsAccession, hasNonGenBankAssembly, hasGenBankAssembly, getDataDir,\n drawChromosomeLabels, rotateChromosomeLabels, round, appendHomolog,\n drawChromosome, rotateAndToggleDisplay, onDidRotate, getSvg,\n setOverflowScroll, Object\n};\n","function responseBlob(response) {\n if (!response.ok) throw new Error(response.status + \" \" + response.statusText);\n return response.blob();\n}\n\nexport default function(input, init) {\n return fetch(input, init).then(responseBlob);\n}\n","function responseArrayBuffer(response) {\n if (!response.ok) throw new Error(response.status + \" \" + response.statusText);\n return response.arrayBuffer();\n}\n\nexport default function(input, init) {\n return fetch(input, init).then(responseArrayBuffer);\n}\n","var EOL = {},\n EOF = {},\n QUOTE = 34,\n NEWLINE = 10,\n RETURN = 13;\n\nfunction objectConverter(columns) {\n return new Function(\"d\", \"return {\" + columns.map(function(name, i) {\n return JSON.stringify(name) + \": d[\" + i + \"]\";\n }).join(\",\") + \"}\");\n}\n\nfunction customConverter(columns, f) {\n var object = objectConverter(columns);\n return function(row, i) {\n return f(object(row), i, columns);\n };\n}\n\n// Compute unique columns in order of discovery.\nfunction inferColumns(rows) {\n var columnSet = Object.create(null),\n columns = [];\n\n rows.forEach(function(row) {\n for (var column in row) {\n if (!(column in columnSet)) {\n columns.push(columnSet[column] = column);\n }\n }\n });\n\n return columns;\n}\n\nexport default function(delimiter) {\n var reFormat = new RegExp(\"[\\\"\" + delimiter + \"\\n\\r]\"),\n DELIMITER = delimiter.charCodeAt(0);\n\n function parse(text, f) {\n var convert, columns, rows = parseRows(text, function(row, i) {\n if (convert) return convert(row, i - 1);\n columns = row, convert = f ? customConverter(row, f) : objectConverter(row);\n });\n rows.columns = columns || [];\n return rows;\n }\n\n function parseRows(text, f) {\n var rows = [], // output rows\n N = text.length,\n I = 0, // current character index\n n = 0, // current line number\n t, // current token\n eof = N <= 0, // current token followed by EOF?\n eol = false; // current token followed by EOL?\n\n // Strip the trailing newline.\n if (text.charCodeAt(N - 1) === NEWLINE) --N;\n if (text.charCodeAt(N - 1) === RETURN) --N;\n\n function token() {\n if (eof) return EOF;\n if (eol) return eol = false, EOL;\n\n // Unescape quotes.\n var i, j = I, c;\n if (text.charCodeAt(j) === QUOTE) {\n while (I++ < N && text.charCodeAt(I) !== QUOTE || text.charCodeAt(++I) === QUOTE);\n if ((i = I) >= N) eof = true;\n else if ((c = text.charCodeAt(I++)) === NEWLINE) eol = true;\n else if (c === RETURN) { eol = true; if (text.charCodeAt(I) === NEWLINE) ++I; }\n return text.slice(j + 1, i - 1).replace(/\"\"/g, \"\\\"\");\n }\n\n // Find next delimiter or newline.\n while (I < N) {\n if ((c = text.charCodeAt(i = I++)) === NEWLINE) eol = true;\n else if (c === RETURN) { eol = true; if (text.charCodeAt(I) === NEWLINE) ++I; }\n else if (c !== DELIMITER) continue;\n return text.slice(j, i);\n }\n\n // Return last token before EOF.\n return eof = true, text.slice(j, N);\n }\n\n while ((t = token()) !== EOF) {\n var row = [];\n while (t !== EOL && t !== EOF) row.push(t), t = token();\n if (f && (row = f(row, n++)) == null) continue;\n rows.push(row);\n }\n\n return rows;\n }\n\n function format(rows, columns) {\n if (columns == null) columns = inferColumns(rows);\n return [columns.map(formatValue).join(delimiter)].concat(rows.map(function(row) {\n return columns.map(function(column) {\n return formatValue(row[column]);\n }).join(delimiter);\n })).join(\"\\n\");\n }\n\n function formatRows(rows) {\n return rows.map(formatRow).join(\"\\n\");\n }\n\n function formatRow(row) {\n return row.map(formatValue).join(delimiter);\n }\n\n function formatValue(text) {\n return text == null ? \"\"\n : reFormat.test(text += \"\") ? \"\\\"\" + text.replace(/\"/g, \"\\\"\\\"\") + \"\\\"\"\n : text;\n }\n\n return {\n parse: parse,\n parseRows: parseRows,\n format: format,\n formatRows: formatRows\n };\n}\n","import dsv from \"./dsv\";\n\nvar csv = dsv(\",\");\n\nexport var csvParse = csv.parse;\nexport var csvParseRows = csv.parseRows;\nexport var csvFormat = csv.format;\nexport var csvFormatRows = csv.formatRows;\n","import dsv from \"./dsv\";\n\nvar tsv = dsv(\"\\t\");\n\nexport var tsvParse = tsv.parse;\nexport var tsvParseRows = tsv.parseRows;\nexport var tsvFormat = tsv.format;\nexport var tsvFormatRows = tsv.formatRows;\n","function responseText(response) {\n if (!response.ok) throw new Error(response.status + \" \" + response.statusText);\n return response.text();\n}\n\nexport default function(input, init) {\n return fetch(input, init).then(responseText);\n}\n","import {csvParse, dsvFormat, tsvParse} from \"d3-dsv\";\nimport text from \"./text\";\n\nfunction dsvParse(parse) {\n return function(input, init, row) {\n if (arguments.length === 2 && typeof init === \"function\") row = init, init = undefined;\n return text(input, init).then(function(response) {\n return parse(response, row);\n });\n };\n}\n\nexport default function dsv(delimiter, input, init, row) {\n if (arguments.length === 3 && typeof init === \"function\") row = init, init = undefined;\n var format = dsvFormat(delimiter);\n return text(input, init).then(function(response) {\n return format.parse(response, row);\n });\n}\n\nexport var csv = dsvParse(csvParse);\nexport var tsv = dsvParse(tsvParse);\n","export default function(input, init) {\n return new Promise(function(resolve, reject) {\n var image = new Image;\n for (var key in init) image[key] = init[key];\n image.onerror = reject;\n image.onload = function() { resolve(image); };\n image.src = input;\n });\n}\n","function responseJson(response) {\n if (!response.ok) throw new Error(response.status + \" \" + response.statusText);\n return response.json();\n}\n\nexport default function(input, init) {\n return fetch(input, init).then(responseJson);\n}\n","import text from \"./text\";\n\nfunction parser(type) {\n return function(input, init) {\n return text(input, init).then(function(text) {\n return (new DOMParser).parseFromString(text, type);\n });\n };\n}\n\nexport default parser(\"application/xml\");\n\nexport var html = parser(\"text/html\");\n\nexport var svg = parser(\"image/svg+xml\");\n","import * as d3fetch from 'd3-fetch';\n\nvar d3 = Object.assign({}, d3fetch);\n\n/**\n * Returns an NCBI taxonomy identifier (taxid) for the configured organism\n */\nfunction getTaxidFromEutils(callback) {\n var organism, taxonomySearch, taxid,\n ideo = this;\n\n organism = ideo.config.organism;\n\n taxonomySearch = ideo.esearch + '&db=taxonomy&term=' + organism;\n\n d3.json(taxonomySearch).then(function(data) {\n taxid = data.esearchresult.idlist[0];\n if (typeof ideo.config.taxids === 'undefined') {\n ideo.config.taxids = [taxid];\n } else {\n ideo.config.taxids.push(taxid);\n }\n return callback(taxid);\n });\n}\n\nfunction setTaxidData(taxid) {\n var organism, dataDir, urlOrg, taxids,\n ideo = this;\n\n organism = ideo.config.organism;\n dataDir = ideo.config.dataDir;\n urlOrg = organism.replace(' ', '-');\n\n taxids = [taxid];\n\n ideo.organisms[taxid] = {\n commonName: '',\n scientificName: organism,\n scientificNameAbbr: ''\n };\n\n var fullyBandedTaxids = ['9606', '10090', '10116'];\n if (fullyBandedTaxids.includes(taxid) && !ideo.config.showFullyBanded) {\n urlOrg += '-no-bands';\n }\n var chromosomesUrl = dataDir + urlOrg + '.js';\n\n var promise2 = new Promise(function(resolve, reject) {\n fetch(chromosomesUrl).then(function(response) {\n if (response.ok === false) {\n reject(Error('Fetch failed for ' + chromosomesUrl));\n } else {\n return response.text().then(function(text) {\n resolve(text);\n });\n }\n });\n });\n\n return promise2\n .then(function(data) {\n // Check if chromosome data exists locally.\n // This is used for pre-processed centromere data,\n // which is not accessible via EUtils. See get_chromosomes.py.\n\n var asmAndChrTaxidsArray = [''],\n chromosomes = [],\n seenChrs = {},\n chr;\n\n eval(data);\n\n for (var i = 0; i < chrBands.length; i++) {\n chr = chrBands[i].split(' ')[0];\n if (chr in seenChrs) {\n continue;\n } else {\n chromosomes.push({name: chr, type: 'nuclear'});\n seenChrs[chr] = 1;\n }\n }\n chromosomes = chromosomes.sort(Ideogram.sortChromosomes);\n asmAndChrTaxidsArray.push(chromosomes);\n asmAndChrTaxidsArray.push(taxids);\n ideo.coordinateSystem = 'iscn';\n return asmAndChrTaxidsArray;\n },\n function() {\n return new Promise(function(resolve) {\n ideo.coordinateSystem = 'bp';\n ideo.getAssemblyAndChromosomesFromEutils(resolve);\n });\n });\n}\n\nfunction setTaxidAndAssemblyAndChromosomes(callback) {\n var assembly, chromosomes, getTaxidsFromEutils, taxid, taxids,\n ideo = this;\n\n getTaxidsFromEutils = new Promise(function(resolve) {\n ideo.getTaxidFromEutils(resolve);\n });\n\n getTaxidsFromEutils\n .then(function(data) {\n taxid = data;\n return ideo.setTaxidData(taxid);\n })\n .then(function(asmChrTaxidsArray) {\n assembly = asmChrTaxidsArray[0];\n chromosomes = asmChrTaxidsArray[1];\n taxids = ideo.config.taxids;\n ideo.config.chromosomes = chromosomes;\n ideo.organisms[taxid].assemblies = {\n default: assembly\n };\n\n callback(taxids);\n });\n}\n\nfunction prepareTmpChrsAndTaxids(ideo) {\n var orgs, taxids, tmpChrs, i, org, taxid,\n config = ideo.config;\n\n taxids = [];\n tmpChrs = {};\n orgs = (config.multiorganism) ? config.organism : [config.organism];\n\n for (i = 0; i < orgs.length; i++) {\n // Gets a list of taxids from common organism names\n org = orgs[i];\n for (taxid in ideo.organisms) {\n if (ideo.organisms[taxid].commonName.toLowerCase() === org) {\n taxids.push(taxid);\n if (config.multiorganism) {\n // Adjusts 'chromosomes' configuration parameter to make object\n // keys use taxid instead of common organism name\n tmpChrs[taxid] = config.chromosomes[org];\n }\n }\n }\n }\n\n return [tmpChrs, taxids];\n}\n\nfunction getTaxidsForOrganismInConfig(taxids, callback, ideo) {\n\n var tmpChrs;\n\n [tmpChrs, taxids] = prepareTmpChrsAndTaxids(ideo);\n\n if (\n taxids.length === 0 ||\n ideo.assemblyIsAccession() && /GCA_/.test(ideo.config.assembly)\n ) {\n ideo.setTaxidAndAssemblyAndChromosomes(callback);\n } else {\n ideo.config.taxids = taxids;\n if (ideo.config.multiorganism) {\n ideo.config.chromosomes = tmpChrs;\n }\n callback(taxids);\n }\n}\n\nfunction getIsMultiorganism(taxidInit, ideo) {\n return (\n ('organism' in ideo.config && ideo.config.organism instanceof Array) ||\n (taxidInit && ideo.config.taxid instanceof Array)\n );\n}\n\nfunction getTaxidsForOrganismNotInConfig(taxids, taxidInit, callback, ideo) {\n if (ideo.config.multiorganism) {\n ideo.coordinateSystem = 'bp';\n if (taxidInit) {\n taxids = ideo.config.taxid;\n }\n } else {\n if (taxidInit) {\n taxids = [ideo.config.taxid];\n }\n ideo.config.taxids = taxids;\n }\n callback(taxids);\n}\n\n/**\n * Returns an array of taxids for the current ideogram\n * Also sets configuration parameters related to taxid(s), whether ideogram is\n * multiorganism, and adjusts chromosomes parameters as needed\n **/\nfunction getTaxids(callback) {\n var taxids, taxidInit,\n ideo = this;\n\n taxidInit = 'taxid' in ideo.config;\n\n ideo.config.multiorganism = getIsMultiorganism(taxidInit, ideo);\n\n if ('organism' in ideo.config) {\n getTaxidsForOrganismInConfig(taxids, callback, ideo)\n } else {\n getTaxidsForOrganismNotInConfig(taxids, taxidInit, callback, ideo);\n }\n}\n\n/**\n * Searches NCBI EUtils for the common organism name for this ideogram\n * instance's taxid (i.e. NCBI Taxonomy ID)\n *\n * @param callback Function to call upon completing ESearch request\n */\nfunction getOrganismFromEutils(callback) {\n var organism, taxonomySearch, taxid,\n ideo = this;\n\n taxid = ideo.config.organism;\n\n taxonomySearch = ideo.esummary + '&db=taxonomy&id=' + taxid;\n\n d3.json(taxonomySearch).then(function(data) {\n organism = data.result[String(taxid)].commonname;\n ideo.config.organism = organism;\n return callback(organism);\n });\n}\n\nexport {\n getTaxidFromEutils, setTaxidAndAssemblyAndChromosomes, getTaxids,\n setTaxidData, getOrganismFromEutils\n}","import {Object} from '../lib';\n\nfunction getDelimiterTsvLinesAndInit(source, content) {\n var delimiter, tsvLines, init;\n\n if (typeof chrBands === 'undefined' && source !== 'native') {\n delimiter = /\\t/;\n tsvLines = content.split(/\\r\\n|\\n/);\n init = 1;\n } else {\n delimiter = / /;\n if (source === 'native') {\n tsvLines = eval(content);\n } else {\n tsvLines = content;\n }\n init = 0;\n }\n\n return [delimiter, tsvLines, init];\n}\n\nfunction updateChromosomes(chromosomes) {\n var tmp, i;\n\n if (chromosomes instanceof Array && typeof chromosomes[0] === 'object') {\n tmp = [];\n for (i = 0; i < chromosomes.length; i++) {\n tmp.push(chromosomes[i].name);\n }\n chromosomes = tmp;\n }\n\n return chromosomes;\n}\n\nfunction getLineObject(chr, columns, stain, taxid) {\n return {\n chr: chr,\n bp: {\n start: parseInt(columns[5], 10),\n stop: parseInt(columns[6], 10)\n },\n iscn: {\n start: parseInt(columns[3], 10),\n stop: parseInt(columns[4], 10)\n },\n px: {\n start: -1,\n stop: -1,\n width: -1\n },\n name: columns[1] + columns[2],\n stain: stain,\n taxid: taxid\n };\n}\n\nfunction getStain(columns) {\n var stain = columns[7];\n // For e.g. acen and gvar, columns[8] (density) is undefined\n if (columns[8]) stain += columns[8];\n return stain;\n}\n\nfunction updateLines(lines, columns, taxid) {\n var chr, stain, line;\n\n chr = columns[0];\n if (chr in lines === false) lines[chr] = [];\n \n stain = getStain(columns)\n\n line = getLineObject(chr, columns, stain, taxid);\n lines[chr].push(line);\n\n return lines;\n}\n\n/**\n * Parses cytogenetic band data from a TSV file, or, if band data is\n * prefetched, from an array\n *\n * NCBI:\n * #chromosome arm band iscn_start iscn_stop bp_start bp_stop stain density\n * ftp://ftp.ncbi.nlm.nih.gov/pub/gdp/ideogram_9606_GCF_000001305.14_550_V1\n */\nfunction parseBands(content, taxid, chromosomes) {\n var delimiter, tsvLines, columns, chr, i, init, source,\n lines = {};\n\n if (content.slice(0, 15) === 'window.chrBands') source = 'native';\n \n chromosomes = updateChromosomes(chromosomes);\n\n [delimiter, tsvLines, init] = getDelimiterTsvLinesAndInit(source, content);\n\n for (i = init; i < tsvLines.length; i++) {\n columns = tsvLines[i].split(delimiter);\n\n chr = columns[0];\n\n if (\n typeof (chromosomes) !== 'undefined' &&\n chromosomes.indexOf(chr) === -1\n ) {\n // If a specific set of chromosomes has been requested, and\n // the current chromosome\n continue;\n }\n\n lines = updateLines(lines, columns, taxid);\n }\n\n return lines;\n}\n\nexport {parseBands}","function setBandData(url, fileNames, chrBands, ideo) {\n var taxid, fetchedTaxid, fileName;\n\n // Ensures correct taxid is processed in response callback;\n // using simply upstream 'taxid' variable gives the last\n // *requested* taxid, which fails when dealing with multiple taxa.\n for (taxid in fileNames) {\n fileName = fileNames[taxid];\n if (url.includes(fileName) && fileName !== '') {\n fetchedTaxid = taxid;\n }\n }\n\n ideo.bandData[fetchedTaxid] = chrBands;\n}\n\nfunction fetchBands(bandDataFileNames, taxid, t0, ideo) {\n var bandDataUrl = ideo.config.dataDir + bandDataFileNames[taxid];\n\n if (!ideo.numBandDataResponses) ideo.numBandDataResponses = 0;\n\n fetch(bandDataUrl)\n .then(function(response) {\n return response.text().then(function(rawBands) {\n\n delete window.chrBands; // Remove any previous chrBands variable\n eval(rawBands); // Fetched data is a JS variable 'chrBands'; assign it\n\n setBandData(response.url, bandDataFileNames, chrBands, ideo);\n\n ideo.numBandDataResponses += 1;\n\n if (ideo.numBandDataResponses === ideo.config.taxids.length) {\n var bandsArray = ideo.processBandData();\n ideo.writeContainer(bandsArray, taxid, t0);\n delete ideo.numBandDataResponses;\n }\n });\n });\n}\n\nexport {fetchBands}","module.exports = require(\"./crossfilter\").crossfilter;\n","(function(exports){\ncrossfilter.version = \"1.3.12\";\nfunction crossfilter_identity(d) {\n return d;\n}\ncrossfilter.permute = permute;\n\nfunction permute(array, index) {\n for (var i = 0, n = index.length, copy = new Array(n); i < n; ++i) {\n copy[i] = array[index[i]];\n }\n return copy;\n}\nvar bisect = crossfilter.bisect = bisect_by(crossfilter_identity);\n\nbisect.by = bisect_by;\n\nfunction bisect_by(f) {\n\n // Locate the insertion point for x in a to maintain sorted order. The\n // arguments lo and hi may be used to specify a subset of the array which\n // should be considered; by default the entire array is used. If x is already\n // present in a, the insertion point will be before (to the left of) any\n // existing entries. The return value is suitable for use as the first\n // argument to `array.splice` assuming that a is already sorted.\n //\n // The returned insertion point i partitions the array a into two halves so\n // that all v < x for v in a[lo:i] for the left side and all v >= x for v in\n // a[i:hi] for the right side.\n function bisectLeft(a, x, lo, hi) {\n while (lo < hi) {\n var mid = lo + hi >>> 1;\n if (f(a[mid]) < x) lo = mid + 1;\n else hi = mid;\n }\n return lo;\n }\n\n // Similar to bisectLeft, but returns an insertion point which comes after (to\n // the right of) any existing entries of x in a.\n //\n // The returned insertion point i partitions the array into two halves so that\n // all v <= x for v in a[lo:i] for the left side and all v > x for v in\n // a[i:hi] for the right side.\n function bisectRight(a, x, lo, hi) {\n while (lo < hi) {\n var mid = lo + hi >>> 1;\n if (x < f(a[mid])) hi = mid;\n else lo = mid + 1;\n }\n return lo;\n }\n\n bisectRight.right = bisectRight;\n bisectRight.left = bisectLeft;\n return bisectRight;\n}\nvar heap = crossfilter.heap = heap_by(crossfilter_identity);\n\nheap.by = heap_by;\n\nfunction heap_by(f) {\n\n // Builds a binary heap within the specified array a[lo:hi]. The heap has the\n // property such that the parent a[lo+i] is always less than or equal to its\n // two children: a[lo+2*i+1] and a[lo+2*i+2].\n function heap(a, lo, hi) {\n var n = hi - lo,\n i = (n >>> 1) + 1;\n while (--i > 0) sift(a, i, n, lo);\n return a;\n }\n\n // Sorts the specified array a[lo:hi] in descending order, assuming it is\n // already a heap.\n function sort(a, lo, hi) {\n var n = hi - lo,\n t;\n while (--n > 0) t = a[lo], a[lo] = a[lo + n], a[lo + n] = t, sift(a, 1, n, lo);\n return a;\n }\n\n // Sifts the element a[lo+i-1] down the heap, where the heap is the contiguous\n // slice of array a[lo:lo+n]. This method can also be used to update the heap\n // incrementally, without incurring the full cost of reconstructing the heap.\n function sift(a, i, n, lo) {\n var d = a[--lo + i],\n x = f(d),\n child;\n while ((child = i << 1) <= n) {\n if (child < n && f(a[lo + child]) > f(a[lo + child + 1])) child++;\n if (x <= f(a[lo + child])) break;\n a[lo + i] = a[lo + child];\n i = child;\n }\n a[lo + i] = d;\n }\n\n heap.sort = sort;\n return heap;\n}\nvar heapselect = crossfilter.heapselect = heapselect_by(crossfilter_identity);\n\nheapselect.by = heapselect_by;\n\nfunction heapselect_by(f) {\n var heap = heap_by(f);\n\n // Returns a new array containing the top k elements in the array a[lo:hi].\n // The returned array is not sorted, but maintains the heap property. If k is\n // greater than hi - lo, then fewer than k elements will be returned. The\n // order of elements in a is unchanged by this operation.\n function heapselect(a, lo, hi, k) {\n var queue = new Array(k = Math.min(hi - lo, k)),\n min,\n i,\n x,\n d;\n\n for (i = 0; i < k; ++i) queue[i] = a[lo++];\n heap(queue, 0, k);\n\n if (lo < hi) {\n min = f(queue[0]);\n do {\n if (x = f(d = a[lo]) > min) {\n queue[0] = d;\n min = f(heap(queue, 0, k)[0]);\n }\n } while (++lo < hi);\n }\n\n return queue;\n }\n\n return heapselect;\n}\nvar insertionsort = crossfilter.insertionsort = insertionsort_by(crossfilter_identity);\n\ninsertionsort.by = insertionsort_by;\n\nfunction insertionsort_by(f) {\n\n function insertionsort(a, lo, hi) {\n for (var i = lo + 1; i < hi; ++i) {\n for (var j = i, t = a[i], x = f(t); j > lo && f(a[j - 1]) > x; --j) {\n a[j] = a[j - 1];\n }\n a[j] = t;\n }\n return a;\n }\n\n return insertionsort;\n}\n// Algorithm designed by Vladimir Yaroslavskiy.\n// Implementation based on the Dart project; see lib/dart/LICENSE for details.\n\nvar quicksort = crossfilter.quicksort = quicksort_by(crossfilter_identity);\n\nquicksort.by = quicksort_by;\n\nfunction quicksort_by(f) {\n var insertionsort = insertionsort_by(f);\n\n function sort(a, lo, hi) {\n return (hi - lo < quicksort_sizeThreshold\n ? insertionsort\n : quicksort)(a, lo, hi);\n }\n\n function quicksort(a, lo, hi) {\n // Compute the two pivots by looking at 5 elements.\n var sixth = (hi - lo) / 6 | 0,\n i1 = lo + sixth,\n i5 = hi - 1 - sixth,\n i3 = lo + hi - 1 >> 1, // The midpoint.\n i2 = i3 - sixth,\n i4 = i3 + sixth;\n\n var e1 = a[i1], x1 = f(e1),\n e2 = a[i2], x2 = f(e2),\n e3 = a[i3], x3 = f(e3),\n e4 = a[i4], x4 = f(e4),\n e5 = a[i5], x5 = f(e5);\n\n var t;\n\n // Sort the selected 5 elements using a sorting network.\n if (x1 > x2) t = e1, e1 = e2, e2 = t, t = x1, x1 = x2, x2 = t;\n if (x4 > x5) t = e4, e4 = e5, e5 = t, t = x4, x4 = x5, x5 = t;\n if (x1 > x3) t = e1, e1 = e3, e3 = t, t = x1, x1 = x3, x3 = t;\n if (x2 > x3) t = e2, e2 = e3, e3 = t, t = x2, x2 = x3, x3 = t;\n if (x1 > x4) t = e1, e1 = e4, e4 = t, t = x1, x1 = x4, x4 = t;\n if (x3 > x4) t = e3, e3 = e4, e4 = t, t = x3, x3 = x4, x4 = t;\n if (x2 > x5) t = e2, e2 = e5, e5 = t, t = x2, x2 = x5, x5 = t;\n if (x2 > x3) t = e2, e2 = e3, e3 = t, t = x2, x2 = x3, x3 = t;\n if (x4 > x5) t = e4, e4 = e5, e5 = t, t = x4, x4 = x5, x5 = t;\n\n var pivot1 = e2, pivotValue1 = x2,\n pivot2 = e4, pivotValue2 = x4;\n\n // e2 and e4 have been saved in the pivot variables. They will be written\n // back, once the partitioning is finished.\n a[i1] = e1;\n a[i2] = a[lo];\n a[i3] = e3;\n a[i4] = a[hi - 1];\n a[i5] = e5;\n\n var less = lo + 1, // First element in the middle partition.\n great = hi - 2; // Last element in the middle partition.\n\n // Note that for value comparison, <, <=, >= and > coerce to a primitive via\n // Object.prototype.valueOf; == and === do not, so in order to be consistent\n // with natural order (such as for Date objects), we must do two compares.\n var pivotsEqual = pivotValue1 <= pivotValue2 && pivotValue1 >= pivotValue2;\n if (pivotsEqual) {\n\n // Degenerated case where the partitioning becomes a dutch national flag\n // problem.\n //\n // [ | < pivot | == pivot | unpartitioned | > pivot | ]\n // ^ ^ ^ ^ ^\n // left less k great right\n //\n // a[left] and a[right] are undefined and are filled after the\n // partitioning.\n //\n // Invariants:\n // 1) for x in ]left, less[ : x < pivot.\n // 2) for x in [less, k[ : x == pivot.\n // 3) for x in ]great, right[ : x > pivot.\n for (var k = less; k <= great; ++k) {\n var ek = a[k], xk = f(ek);\n if (xk < pivotValue1) {\n if (k !== less) {\n a[k] = a[less];\n a[less] = ek;\n }\n ++less;\n } else if (xk > pivotValue1) {\n\n // Find the first element <= pivot in the range [k - 1, great] and\n // put [:ek:] there. We know that such an element must exist:\n // When k == less, then el3 (which is equal to pivot) lies in the\n // interval. Otherwise a[k - 1] == pivot and the search stops at k-1.\n // Note that in the latter case invariant 2 will be violated for a\n // short amount of time. The invariant will be restored when the\n // pivots are put into their final positions.\n while (true) {\n var greatValue = f(a[great]);\n if (greatValue > pivotValue1) {\n great--;\n // This is the only location in the while-loop where a new\n // iteration is started.\n continue;\n } else if (greatValue < pivotValue1) {\n // Triple exchange.\n a[k] = a[less];\n a[less++] = a[great];\n a[great--] = ek;\n break;\n } else {\n a[k] = a[great];\n a[great--] = ek;\n // Note: if great < k then we will exit the outer loop and fix\n // invariant 2 (which we just violated).\n break;\n }\n }\n }\n }\n } else {\n\n // We partition the list into three parts:\n // 1. < pivot1\n // 2. >= pivot1 && <= pivot2\n // 3. > pivot2\n //\n // During the loop we have:\n // [ | < pivot1 | >= pivot1 && <= pivot2 | unpartitioned | > pivot2 | ]\n // ^ ^ ^ ^ ^\n // left less k great right\n //\n // a[left] and a[right] are undefined and are filled after the\n // partitioning.\n //\n // Invariants:\n // 1. for x in ]left, less[ : x < pivot1\n // 2. for x in [less, k[ : pivot1 <= x && x <= pivot2\n // 3. for x in ]great, right[ : x > pivot2\n for (var k = less; k <= great; k++) {\n var ek = a[k], xk = f(ek);\n if (xk < pivotValue1) {\n if (k !== less) {\n a[k] = a[less];\n a[less] = ek;\n }\n ++less;\n } else {\n if (xk > pivotValue2) {\n while (true) {\n var greatValue = f(a[great]);\n if (greatValue > pivotValue2) {\n great--;\n if (great < k) break;\n // This is the only location inside the loop where a new\n // iteration is started.\n continue;\n } else {\n // a[great] <= pivot2.\n if (greatValue < pivotValue1) {\n // Triple exchange.\n a[k] = a[less];\n a[less++] = a[great];\n a[great--] = ek;\n } else {\n // a[great] >= pivot1.\n a[k] = a[great];\n a[great--] = ek;\n }\n break;\n }\n }\n }\n }\n }\n }\n\n // Move pivots into their final positions.\n // We shrunk the list from both sides (a[left] and a[right] have\n // meaningless values in them) and now we move elements from the first\n // and third partition into these locations so that we can store the\n // pivots.\n a[lo] = a[less - 1];\n a[less - 1] = pivot1;\n a[hi - 1] = a[great + 1];\n a[great + 1] = pivot2;\n\n // The list is now partitioned into three partitions:\n // [ < pivot1 | >= pivot1 && <= pivot2 | > pivot2 ]\n // ^ ^ ^ ^\n // left less great right\n\n // Recursive descent. (Don't include the pivot values.)\n sort(a, lo, less - 1);\n sort(a, great + 2, hi);\n\n if (pivotsEqual) {\n // All elements in the second partition are equal to the pivot. No\n // need to sort them.\n return a;\n }\n\n // In theory it should be enough to call _doSort recursively on the second\n // partition.\n // The Android source however removes the pivot elements from the recursive\n // call if the second partition is too large (more than 2/3 of the list).\n if (less < i1 && great > i5) {\n var lessValue, greatValue;\n while ((lessValue = f(a[less])) <= pivotValue1 && lessValue >= pivotValue1) ++less;\n while ((greatValue = f(a[great])) <= pivotValue2 && greatValue >= pivotValue2) --great;\n\n // Copy paste of the previous 3-way partitioning with adaptions.\n //\n // We partition the list into three parts:\n // 1. == pivot1\n // 2. > pivot1 && < pivot2\n // 3. == pivot2\n //\n // During the loop we have:\n // [ == pivot1 | > pivot1 && < pivot2 | unpartitioned | == pivot2 ]\n // ^ ^ ^\n // less k great\n //\n // Invariants:\n // 1. for x in [ *, less[ : x == pivot1\n // 2. for x in [less, k[ : pivot1 < x && x < pivot2\n // 3. for x in ]great, * ] : x == pivot2\n for (var k = less; k <= great; k++) {\n var ek = a[k], xk = f(ek);\n if (xk <= pivotValue1 && xk >= pivotValue1) {\n if (k !== less) {\n a[k] = a[less];\n a[less] = ek;\n }\n less++;\n } else {\n if (xk <= pivotValue2 && xk >= pivotValue2) {\n while (true) {\n var greatValue = f(a[great]);\n if (greatValue <= pivotValue2 && greatValue >= pivotValue2) {\n great--;\n if (great < k) break;\n // This is the only location inside the loop where a new\n // iteration is started.\n continue;\n } else {\n // a[great] < pivot2.\n if (greatValue < pivotValue1) {\n // Triple exchange.\n a[k] = a[less];\n a[less++] = a[great];\n a[great--] = ek;\n } else {\n // a[great] == pivot1.\n a[k] = a[great];\n a[great--] = ek;\n }\n break;\n }\n }\n }\n }\n }\n }\n\n // The second partition has now been cleared of pivot elements and looks\n // as follows:\n // [ * | > pivot1 && < pivot2 | * ]\n // ^ ^\n // less great\n // Sort the second partition using recursive descent.\n\n // The second partition looks as follows:\n // [ * | >= pivot1 && <= pivot2 | * ]\n // ^ ^\n // less great\n // Simply sort it by recursive descent.\n\n return sort(a, less, great + 1);\n }\n\n return sort;\n}\n\nvar quicksort_sizeThreshold = 32;\nvar crossfilter_array8 = crossfilter_arrayUntyped,\n crossfilter_array16 = crossfilter_arrayUntyped,\n crossfilter_array32 = crossfilter_arrayUntyped,\n crossfilter_arrayLengthen = crossfilter_arrayLengthenUntyped,\n crossfilter_arrayWiden = crossfilter_arrayWidenUntyped;\n\nif (typeof Uint8Array !== \"undefined\") {\n crossfilter_array8 = function(n) { return new Uint8Array(n); };\n crossfilter_array16 = function(n) { return new Uint16Array(n); };\n crossfilter_array32 = function(n) { return new Uint32Array(n); };\n\n crossfilter_arrayLengthen = function(array, length) {\n if (array.length >= length) return array;\n var copy = new array.constructor(length);\n copy.set(array);\n return copy;\n };\n\n crossfilter_arrayWiden = function(array, width) {\n var copy;\n switch (width) {\n case 16: copy = crossfilter_array16(array.length); break;\n case 32: copy = crossfilter_array32(array.length); break;\n default: throw new Error(\"invalid array width!\");\n }\n copy.set(array);\n return copy;\n };\n}\n\nfunction crossfilter_arrayUntyped(n) {\n var array = new Array(n), i = -1;\n while (++i < n) array[i] = 0;\n return array;\n}\n\nfunction crossfilter_arrayLengthenUntyped(array, length) {\n var n = array.length;\n while (n < length) array[n++] = 0;\n return array;\n}\n\nfunction crossfilter_arrayWidenUntyped(array, width) {\n if (width > 32) throw new Error(\"invalid array width!\");\n return array;\n}\nfunction crossfilter_filterExact(bisect, value) {\n return function(values) {\n var n = values.length;\n return [bisect.left(values, value, 0, n), bisect.right(values, value, 0, n)];\n };\n}\n\nfunction crossfilter_filterRange(bisect, range) {\n var min = range[0],\n max = range[1];\n return function(values) {\n var n = values.length;\n return [bisect.left(values, min, 0, n), bisect.left(values, max, 0, n)];\n };\n}\n\nfunction crossfilter_filterAll(values) {\n return [0, values.length];\n}\nfunction crossfilter_null() {\n return null;\n}\nfunction crossfilter_zero() {\n return 0;\n}\nfunction crossfilter_reduceIncrement(p) {\n return p + 1;\n}\n\nfunction crossfilter_reduceDecrement(p) {\n return p - 1;\n}\n\nfunction crossfilter_reduceAdd(f) {\n return function(p, v) {\n return p + +f(v);\n };\n}\n\nfunction crossfilter_reduceSubtract(f) {\n return function(p, v) {\n return p - f(v);\n };\n}\nexports.crossfilter = crossfilter;\n\nfunction crossfilter() {\n var crossfilter = {\n add: add,\n remove: removeData,\n dimension: dimension,\n groupAll: groupAll,\n size: size\n };\n\n var data = [], // the records\n n = 0, // the number of records; data.length\n m = 0, // a bit mask representing which dimensions are in use\n M = 8, // number of dimensions that can fit in `filters`\n filters = crossfilter_array8(0), // M bits per record; 1 is filtered out\n filterListeners = [], // when the filters change\n dataListeners = [], // when data is added\n removeDataListeners = []; // when data is removed\n\n // Adds the specified new records to this crossfilter.\n function add(newData) {\n var n0 = n,\n n1 = newData.length;\n\n // If there's actually new data to add…\n // Merge the new data into the existing data.\n // Lengthen the filter bitset to handle the new records.\n // Notify listeners (dimensions and groups) that new data is available.\n if (n1) {\n data = data.concat(newData);\n filters = crossfilter_arrayLengthen(filters, n += n1);\n dataListeners.forEach(function(l) { l(newData, n0, n1); });\n }\n\n return crossfilter;\n }\n\n // Removes all records that match the current filters.\n function removeData() {\n var newIndex = crossfilter_index(n, n),\n removed = [];\n for (var i = 0, j = 0; i < n; ++i) {\n if (filters[i]) newIndex[i] = j++;\n else removed.push(i);\n }\n\n // Remove all matching records from groups.\n filterListeners.forEach(function(l) { l(0, [], removed); });\n\n // Update indexes.\n removeDataListeners.forEach(function(l) { l(newIndex); });\n\n // Remove old filters and data by overwriting.\n for (var i = 0, j = 0, k; i < n; ++i) {\n if (k = filters[i]) {\n if (i !== j) filters[j] = k, data[j] = data[i];\n ++j;\n }\n }\n data.length = j;\n while (n > j) filters[--n] = 0;\n }\n\n // Adds a new dimension with the specified value accessor function.\n function dimension(value) {\n var dimension = {\n filter: filter,\n filterExact: filterExact,\n filterRange: filterRange,\n filterFunction: filterFunction,\n filterAll: filterAll,\n top: top,\n bottom: bottom,\n group: group,\n groupAll: groupAll,\n dispose: dispose,\n remove: dispose // for backwards-compatibility\n };\n\n var one = ~m & -~m, // lowest unset bit as mask, e.g., 00001000\n zero = ~one, // inverted one, e.g., 11110111\n values, // sorted, cached array\n index, // value rank ↦ object id\n newValues, // temporary array storing newly-added values\n newIndex, // temporary array storing newly-added index\n sort = quicksort_by(function(i) { return newValues[i]; }),\n refilter = crossfilter_filterAll, // for recomputing filter\n refilterFunction, // the custom filter function in use\n indexListeners = [], // when data is added\n dimensionGroups = [],\n lo0 = 0,\n hi0 = 0;\n\n // Updating a dimension is a two-stage process. First, we must update the\n // associated filters for the newly-added records. Once all dimensions have\n // updated their filters, the groups are notified to update.\n dataListeners.unshift(preAdd);\n dataListeners.push(postAdd);\n\n removeDataListeners.push(removeData);\n\n // Incorporate any existing data into this dimension, and make sure that the\n // filter bitset is wide enough to handle the new dimension.\n m |= one;\n if (M >= 32 ? !one : m & -(1 << M)) {\n filters = crossfilter_arrayWiden(filters, M <<= 1);\n }\n preAdd(data, 0, n);\n postAdd(data, 0, n);\n\n // Incorporates the specified new records into this dimension.\n // This function is responsible for updating filters, values, and index.\n function preAdd(newData, n0, n1) {\n\n // Permute new values into natural order using a sorted index.\n newValues = newData.map(value);\n newIndex = sort(crossfilter_range(n1), 0, n1);\n newValues = permute(newValues, newIndex);\n\n // Bisect newValues to determine which new records are selected.\n var bounds = refilter(newValues), lo1 = bounds[0], hi1 = bounds[1], i;\n if (refilterFunction) {\n for (i = 0; i < n1; ++i) {\n if (!refilterFunction(newValues[i], i)) filters[newIndex[i] + n0] |= one;\n }\n } else {\n for (i = 0; i < lo1; ++i) filters[newIndex[i] + n0] |= one;\n for (i = hi1; i < n1; ++i) filters[newIndex[i] + n0] |= one;\n }\n\n // If this dimension previously had no data, then we don't need to do the\n // more expensive merge operation; use the new values and index as-is.\n if (!n0) {\n values = newValues;\n index = newIndex;\n lo0 = lo1;\n hi0 = hi1;\n return;\n }\n\n var oldValues = values,\n oldIndex = index,\n i0 = 0,\n i1 = 0;\n\n // Otherwise, create new arrays into which to merge new and old.\n values = new Array(n);\n index = crossfilter_index(n, n);\n\n // Merge the old and new sorted values, and old and new index.\n for (i = 0; i0 < n0 && i1 < n1; ++i) {\n if (oldValues[i0] < newValues[i1]) {\n values[i] = oldValues[i0];\n index[i] = oldIndex[i0++];\n } else {\n values[i] = newValues[i1];\n index[i] = newIndex[i1++] + n0;\n }\n }\n\n // Add any remaining old values.\n for (; i0 < n0; ++i0, ++i) {\n values[i] = oldValues[i0];\n index[i] = oldIndex[i0];\n }\n\n // Add any remaining new values.\n for (; i1 < n1; ++i1, ++i) {\n values[i] = newValues[i1];\n index[i] = newIndex[i1] + n0;\n }\n\n // Bisect again to recompute lo0 and hi0.\n bounds = refilter(values), lo0 = bounds[0], hi0 = bounds[1];\n }\n\n // When all filters have updated, notify index listeners of the new values.\n function postAdd(newData, n0, n1) {\n indexListeners.forEach(function(l) { l(newValues, newIndex, n0, n1); });\n newValues = newIndex = null;\n }\n\n function removeData(reIndex) {\n for (var i = 0, j = 0, k; i < n; ++i) {\n if (filters[k = index[i]]) {\n if (i !== j) values[j] = values[i];\n index[j] = reIndex[k];\n ++j;\n }\n }\n values.length = j;\n while (j < n) index[j++] = 0;\n\n // Bisect again to recompute lo0 and hi0.\n var bounds = refilter(values);\n lo0 = bounds[0], hi0 = bounds[1];\n }\n\n // Updates the selected values based on the specified bounds [lo, hi].\n // This implementation is used by all the public filter methods.\n function filterIndexBounds(bounds) {\n var lo1 = bounds[0],\n hi1 = bounds[1];\n\n if (refilterFunction) {\n refilterFunction = null;\n filterIndexFunction(function(d, i) { return lo1 <= i && i < hi1; });\n lo0 = lo1;\n hi0 = hi1;\n return dimension;\n }\n\n var i,\n j,\n k,\n added = [],\n removed = [];\n\n // Fast incremental update based on previous lo index.\n if (lo1 < lo0) {\n for (i = lo1, j = Math.min(lo0, hi1); i < j; ++i) {\n filters[k = index[i]] ^= one;\n added.push(k);\n }\n } else if (lo1 > lo0) {\n for (i = lo0, j = Math.min(lo1, hi0); i < j; ++i) {\n filters[k = index[i]] ^= one;\n removed.push(k);\n }\n }\n\n // Fast incremental update based on previous hi index.\n if (hi1 > hi0) {\n for (i = Math.max(lo1, hi0), j = hi1; i < j; ++i) {\n filters[k = index[i]] ^= one;\n added.push(k);\n }\n } else if (hi1 < hi0) {\n for (i = Math.max(lo0, hi1), j = hi0; i < j; ++i) {\n filters[k = index[i]] ^= one;\n removed.push(k);\n }\n }\n\n lo0 = lo1;\n hi0 = hi1;\n filterListeners.forEach(function(l) { l(one, added, removed); });\n return dimension;\n }\n\n // Filters this dimension using the specified range, value, or null.\n // If the range is null, this is equivalent to filterAll.\n // If the range is an array, this is equivalent to filterRange.\n // Otherwise, this is equivalent to filterExact.\n function filter(range) {\n return range == null\n ? filterAll() : Array.isArray(range)\n ? filterRange(range) : typeof range === \"function\"\n ? filterFunction(range)\n : filterExact(range);\n }\n\n // Filters this dimension to select the exact value.\n function filterExact(value) {\n return filterIndexBounds((refilter = crossfilter_filterExact(bisect, value))(values));\n }\n\n // Filters this dimension to select the specified range [lo, hi].\n // The lower bound is inclusive, and the upper bound is exclusive.\n function filterRange(range) {\n return filterIndexBounds((refilter = crossfilter_filterRange(bisect, range))(values));\n }\n\n // Clears any filters on this dimension.\n function filterAll() {\n return filterIndexBounds((refilter = crossfilter_filterAll)(values));\n }\n\n // Filters this dimension using an arbitrary function.\n function filterFunction(f) {\n refilter = crossfilter_filterAll;\n\n filterIndexFunction(refilterFunction = f);\n\n lo0 = 0;\n hi0 = n;\n\n return dimension;\n }\n\n function filterIndexFunction(f) {\n var i,\n k,\n x,\n added = [],\n removed = [];\n\n for (i = 0; i < n; ++i) {\n if (!(filters[k = index[i]] & one) ^ !!(x = f(values[i], i))) {\n if (x) filters[k] &= zero, added.push(k);\n else filters[k] |= one, removed.push(k);\n }\n }\n filterListeners.forEach(function(l) { l(one, added, removed); });\n }\n\n // Returns the top K selected records based on this dimension's order.\n // Note: observes this dimension's filter, unlike group and groupAll.\n function top(k) {\n var array = [],\n i = hi0,\n j;\n\n while (--i >= lo0 && k > 0) {\n if (!filters[j = index[i]]) {\n array.push(data[j]);\n --k;\n }\n }\n\n return array;\n }\n\n // Returns the bottom K selected records based on this dimension's order.\n // Note: observes this dimension's filter, unlike group and groupAll.\n function bottom(k) {\n var array = [],\n i = lo0,\n j;\n\n while (i < hi0 && k > 0) {\n if (!filters[j = index[i]]) {\n array.push(data[j]);\n --k;\n }\n i++;\n }\n\n return array;\n }\n\n // Adds a new group to this dimension, using the specified key function.\n function group(key) {\n var group = {\n top: top,\n all: all,\n reduce: reduce,\n reduceCount: reduceCount,\n reduceSum: reduceSum,\n order: order,\n orderNatural: orderNatural,\n size: size,\n dispose: dispose,\n remove: dispose // for backwards-compatibility\n };\n\n // Ensure that this group will be removed when the dimension is removed.\n dimensionGroups.push(group);\n\n var groups, // array of {key, value}\n groupIndex, // object id ↦ group id\n groupWidth = 8,\n groupCapacity = crossfilter_capacity(groupWidth),\n k = 0, // cardinality\n select,\n heap,\n reduceAdd,\n reduceRemove,\n reduceInitial,\n update = crossfilter_null,\n reset = crossfilter_null,\n resetNeeded = true,\n groupAll = key === crossfilter_null;\n\n if (arguments.length < 1) key = crossfilter_identity;\n\n // The group listens to the crossfilter for when any dimension changes, so\n // that it can update the associated reduce values. It must also listen to\n // the parent dimension for when data is added, and compute new keys.\n filterListeners.push(update);\n indexListeners.push(add);\n removeDataListeners.push(removeData);\n\n // Incorporate any existing data into the grouping.\n add(values, index, 0, n);\n\n // Incorporates the specified new values into this group.\n // This function is responsible for updating groups and groupIndex.\n function add(newValues, newIndex, n0, n1) {\n var oldGroups = groups,\n reIndex = crossfilter_index(k, groupCapacity),\n add = reduceAdd,\n initial = reduceInitial,\n k0 = k, // old cardinality\n i0 = 0, // index of old group\n i1 = 0, // index of new record\n j, // object id\n g0, // old group\n x0, // old key\n x1, // new key\n g, // group to add\n x; // key of group to add\n\n // If a reset is needed, we don't need to update the reduce values.\n if (resetNeeded) add = initial = crossfilter_null;\n\n // Reset the new groups (k is a lower bound).\n // Also, make sure that groupIndex exists and is long enough.\n groups = new Array(k), k = 0;\n groupIndex = k0 > 1 ? crossfilter_arrayLengthen(groupIndex, n) : crossfilter_index(n, groupCapacity);\n\n // Get the first old key (x0 of g0), if it exists.\n if (k0) x0 = (g0 = oldGroups[0]).key;\n\n // Find the first new key (x1), skipping NaN keys.\n while (i1 < n1 && !((x1 = key(newValues[i1])) >= x1)) ++i1;\n\n // While new keys remain…\n while (i1 < n1) {\n\n // Determine the lesser of the two current keys; new and old.\n // If there are no old keys remaining, then always add the new key.\n if (g0 && x0 <= x1) {\n g = g0, x = x0;\n\n // Record the new index of the old group.\n reIndex[i0] = k;\n\n // Retrieve the next old key.\n if (g0 = oldGroups[++i0]) x0 = g0.key;\n } else {\n g = {key: x1, value: initial()}, x = x1;\n }\n\n // Add the lesser group.\n groups[k] = g;\n\n // Add any selected records belonging to the added group, while\n // advancing the new key and populating the associated group index.\n while (!(x1 > x)) {\n groupIndex[j = newIndex[i1] + n0] = k;\n if (!(filters[j] & zero)) g.value = add(g.value, data[j]);\n if (++i1 >= n1) break;\n x1 = key(newValues[i1]);\n }\n\n groupIncrement();\n }\n\n // Add any remaining old groups that were greater than all new keys.\n // No incremental reduce is needed; these groups have no new records.\n // Also record the new index of the old group.\n while (i0 < k0) {\n groups[reIndex[i0] = k] = oldGroups[i0++];\n groupIncrement();\n }\n\n // If we added any new groups before any old groups,\n // update the group index of all the old records.\n if (k > i0) for (i0 = 0; i0 < n0; ++i0) {\n groupIndex[i0] = reIndex[groupIndex[i0]];\n }\n\n // Modify the update and reset behavior based on the cardinality.\n // If the cardinality is less than or equal to one, then the groupIndex\n // is not needed. If the cardinality is zero, then there are no records\n // and therefore no groups to update or reset. Note that we also must\n // change the registered listener to point to the new method.\n j = filterListeners.indexOf(update);\n if (k > 1) {\n update = updateMany;\n reset = resetMany;\n } else {\n if (!k && groupAll) {\n k = 1;\n groups = [{key: null, value: initial()}];\n }\n if (k === 1) {\n update = updateOne;\n reset = resetOne;\n } else {\n update = crossfilter_null;\n reset = crossfilter_null;\n }\n groupIndex = null;\n }\n filterListeners[j] = update;\n\n // Count the number of added groups,\n // and widen the group index as needed.\n function groupIncrement() {\n if (++k === groupCapacity) {\n reIndex = crossfilter_arrayWiden(reIndex, groupWidth <<= 1);\n groupIndex = crossfilter_arrayWiden(groupIndex, groupWidth);\n groupCapacity = crossfilter_capacity(groupWidth);\n }\n }\n }\n\n function removeData() {\n if (k > 1) {\n var oldK = k,\n oldGroups = groups,\n seenGroups = crossfilter_index(oldK, oldK);\n\n // Filter out non-matches by copying matching group index entries to\n // the beginning of the array.\n for (var i = 0, j = 0; i < n; ++i) {\n if (filters[i]) {\n seenGroups[groupIndex[j] = groupIndex[i]] = 1;\n ++j;\n }\n }\n\n // Reassemble groups including only those groups that were referred\n // to by matching group index entries. Note the new group index in\n // seenGroups.\n groups = [], k = 0;\n for (i = 0; i < oldK; ++i) {\n if (seenGroups[i]) {\n seenGroups[i] = k++;\n groups.push(oldGroups[i]);\n }\n }\n\n if (k > 1) {\n // Reindex the group index using seenGroups to find the new index.\n for (var i = 0; i < j; ++i) groupIndex[i] = seenGroups[groupIndex[i]];\n } else {\n groupIndex = null;\n }\n filterListeners[filterListeners.indexOf(update)] = k > 1\n ? (reset = resetMany, update = updateMany)\n : k === 1 ? (reset = resetOne, update = updateOne)\n : reset = update = crossfilter_null;\n } else if (k === 1) {\n if (groupAll) return;\n for (var i = 0; i < n; ++i) if (filters[i]) return;\n groups = [], k = 0;\n filterListeners[filterListeners.indexOf(update)] =\n update = reset = crossfilter_null;\n }\n }\n\n // Reduces the specified selected or deselected records.\n // This function is only used when the cardinality is greater than 1.\n function updateMany(filterOne, added, removed) {\n if (filterOne === one || resetNeeded) return;\n\n var i,\n k,\n n,\n g;\n\n // Add the added values.\n for (i = 0, n = added.length; i < n; ++i) {\n if (!(filters[k = added[i]] & zero)) {\n g = groups[groupIndex[k]];\n g.value = reduceAdd(g.value, data[k]);\n }\n }\n\n // Remove the removed values.\n for (i = 0, n = removed.length; i < n; ++i) {\n if ((filters[k = removed[i]] & zero) === filterOne) {\n g = groups[groupIndex[k]];\n g.value = reduceRemove(g.value, data[k]);\n }\n }\n }\n\n // Reduces the specified selected or deselected records.\n // This function is only used when the cardinality is 1.\n function updateOne(filterOne, added, removed) {\n if (filterOne === one || resetNeeded) return;\n\n var i,\n k,\n n,\n g = groups[0];\n\n // Add the added values.\n for (i = 0, n = added.length; i < n; ++i) {\n if (!(filters[k = added[i]] & zero)) {\n g.value = reduceAdd(g.value, data[k]);\n }\n }\n\n // Remove the removed values.\n for (i = 0, n = removed.length; i < n; ++i) {\n if ((filters[k = removed[i]] & zero) === filterOne) {\n g.value = reduceRemove(g.value, data[k]);\n }\n }\n }\n\n // Recomputes the group reduce values from scratch.\n // This function is only used when the cardinality is greater than 1.\n function resetMany() {\n var i,\n g;\n\n // Reset all group values.\n for (i = 0; i < k; ++i) {\n groups[i].value = reduceInitial();\n }\n\n // Add any selected records.\n for (i = 0; i < n; ++i) {\n if (!(filters[i] & zero)) {\n g = groups[groupIndex[i]];\n g.value = reduceAdd(g.value, data[i]);\n }\n }\n }\n\n // Recomputes the group reduce values from scratch.\n // This function is only used when the cardinality is 1.\n function resetOne() {\n var i,\n g = groups[0];\n\n // Reset the singleton group values.\n g.value = reduceInitial();\n\n // Add any selected records.\n for (i = 0; i < n; ++i) {\n if (!(filters[i] & zero)) {\n g.value = reduceAdd(g.value, data[i]);\n }\n }\n }\n\n // Returns the array of group values, in the dimension's natural order.\n function all() {\n if (resetNeeded) reset(), resetNeeded = false;\n return groups;\n }\n\n // Returns a new array containing the top K group values, in reduce order.\n function top(k) {\n var top = select(all(), 0, groups.length, k);\n return heap.sort(top, 0, top.length);\n }\n\n // Sets the reduce behavior for this group to use the specified functions.\n // This method lazily recomputes the reduce values, waiting until needed.\n function reduce(add, remove, initial) {\n reduceAdd = add;\n reduceRemove = remove;\n reduceInitial = initial;\n resetNeeded = true;\n return group;\n }\n\n // A convenience method for reducing by count.\n function reduceCount() {\n return reduce(crossfilter_reduceIncrement, crossfilter_reduceDecrement, crossfilter_zero);\n }\n\n // A convenience method for reducing by sum(value).\n function reduceSum(value) {\n return reduce(crossfilter_reduceAdd(value), crossfilter_reduceSubtract(value), crossfilter_zero);\n }\n\n // Sets the reduce order, using the specified accessor.\n function order(value) {\n select = heapselect_by(valueOf);\n heap = heap_by(valueOf);\n function valueOf(d) { return value(d.value); }\n return group;\n }\n\n // A convenience method for natural ordering by reduce value.\n function orderNatural() {\n return order(crossfilter_identity);\n }\n\n // Returns the cardinality of this group, irrespective of any filters.\n function size() {\n return k;\n }\n\n // Removes this group and associated event listeners.\n function dispose() {\n var i = filterListeners.indexOf(update);\n if (i >= 0) filterListeners.splice(i, 1);\n i = indexListeners.indexOf(add);\n if (i >= 0) indexListeners.splice(i, 1);\n i = removeDataListeners.indexOf(removeData);\n if (i >= 0) removeDataListeners.splice(i, 1);\n return group;\n }\n\n return reduceCount().orderNatural();\n }\n\n // A convenience function for generating a singleton group.\n function groupAll() {\n var g = group(crossfilter_null), all = g.all;\n delete g.all;\n delete g.top;\n delete g.order;\n delete g.orderNatural;\n delete g.size;\n g.value = function() { return all()[0].value; };\n return g;\n }\n\n // Removes this dimension and associated groups and event listeners.\n function dispose() {\n dimensionGroups.forEach(function(group) { group.dispose(); });\n var i = dataListeners.indexOf(preAdd);\n if (i >= 0) dataListeners.splice(i, 1);\n i = dataListeners.indexOf(postAdd);\n if (i >= 0) dataListeners.splice(i, 1);\n i = removeDataListeners.indexOf(removeData);\n if (i >= 0) removeDataListeners.splice(i, 1);\n m &= zero;\n return filterAll();\n }\n\n return dimension;\n }\n\n // A convenience method for groupAll on a dummy dimension.\n // This implementation can be optimized since it always has cardinality 1.\n function groupAll() {\n var group = {\n reduce: reduce,\n reduceCount: reduceCount,\n reduceSum: reduceSum,\n value: value,\n dispose: dispose,\n remove: dispose // for backwards-compatibility\n };\n\n var reduceValue,\n reduceAdd,\n reduceRemove,\n reduceInitial,\n resetNeeded = true;\n\n // The group listens to the crossfilter for when any dimension changes, so\n // that it can update the reduce value. It must also listen to the parent\n // dimension for when data is added.\n filterListeners.push(update);\n dataListeners.push(add);\n\n // For consistency; actually a no-op since resetNeeded is true.\n add(data, 0, n);\n\n // Incorporates the specified new values into this group.\n function add(newData, n0) {\n var i;\n\n if (resetNeeded) return;\n\n // Add the added values.\n for (i = n0; i < n; ++i) {\n if (!filters[i]) {\n reduceValue = reduceAdd(reduceValue, data[i]);\n }\n }\n }\n\n // Reduces the specified selected or deselected records.\n function update(filterOne, added, removed) {\n var i,\n k,\n n;\n\n if (resetNeeded) return;\n\n // Add the added values.\n for (i = 0, n = added.length; i < n; ++i) {\n if (!filters[k = added[i]]) {\n reduceValue = reduceAdd(reduceValue, data[k]);\n }\n }\n\n // Remove the removed values.\n for (i = 0, n = removed.length; i < n; ++i) {\n if (filters[k = removed[i]] === filterOne) {\n reduceValue = reduceRemove(reduceValue, data[k]);\n }\n }\n }\n\n // Recomputes the group reduce value from scratch.\n function reset() {\n var i;\n\n reduceValue = reduceInitial();\n\n for (i = 0; i < n; ++i) {\n if (!filters[i]) {\n reduceValue = reduceAdd(reduceValue, data[i]);\n }\n }\n }\n\n // Sets the reduce behavior for this group to use the specified functions.\n // This method lazily recomputes the reduce value, waiting until needed.\n function reduce(add, remove, initial) {\n reduceAdd = add;\n reduceRemove = remove;\n reduceInitial = initial;\n resetNeeded = true;\n return group;\n }\n\n // A convenience method for reducing by count.\n function reduceCount() {\n return reduce(crossfilter_reduceIncrement, crossfilter_reduceDecrement, crossfilter_zero);\n }\n\n // A convenience method for reducing by sum(value).\n function reduceSum(value) {\n return reduce(crossfilter_reduceAdd(value), crossfilter_reduceSubtract(value), crossfilter_zero);\n }\n\n // Returns the computed reduce value.\n function value() {\n if (resetNeeded) reset(), resetNeeded = false;\n return reduceValue;\n }\n\n // Removes this group and associated event listeners.\n function dispose() {\n var i = filterListeners.indexOf(update);\n if (i >= 0) filterListeners.splice(i);\n i = dataListeners.indexOf(add);\n if (i >= 0) dataListeners.splice(i);\n return group;\n }\n\n return reduceCount();\n }\n\n // Returns the number of records in this crossfilter, irrespective of any filters.\n function size() {\n return n;\n }\n\n return arguments.length\n ? add(arguments[0])\n : crossfilter;\n}\n\n// Returns an array of size n, big enough to store ids up to m.\nfunction crossfilter_index(n, m) {\n return (m < 0x101\n ? crossfilter_array8 : m < 0x10001\n ? crossfilter_array16\n : crossfilter_array32)(n);\n}\n\n// Constructs a new array of size n, with sequential values from 0 to n - 1.\nfunction crossfilter_range(n) {\n var range = crossfilter_index(n, n);\n for (var i = -1; ++i < n;) range[i] = i;\n return range;\n}\n\nfunction crossfilter_capacity(w) {\n return w === 8\n ? 0x100 : w === 16\n ? 0x10000\n : 0x100000000;\n}\n})(typeof exports !== 'undefined' && exports || this);\n","var noop = {value: function() {}};\n\nfunction dispatch() {\n for (var i = 0, n = arguments.length, _ = {}, t; i < n; ++i) {\n if (!(t = arguments[i] + \"\") || (t in _)) 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","import {event} from \"d3-selection\";\n\nexport function nopropagation() {\n event.stopImmediatePropagation();\n}\n\nexport default function() {\n event.preventDefault();\n event.stopImmediatePropagation();\n}\n","import {select} from \"d3-selection\";\nimport noevent from \"./noevent\";\n\nexport default function(view) {\n var root = view.document.documentElement,\n selection = select(view).on(\"dragstart.drag\", noevent, true);\n if (\"onselectstart\" in root) {\n selection.on(\"selectstart.drag\", noevent, true);\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, true);\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","import {dispatch} from \"d3-dispatch\";\nimport {event, customEvent, select, mouse, touch} from \"d3-selection\";\nimport nodrag, {yesdrag} from \"./nodrag\";\nimport noevent, {nopropagation} from \"./noevent\";\nimport constant from \"./constant\";\nimport DragEvent from \"./event\";\n\n// Ignore right-click, since that should open the context menu.\nfunction defaultFilter() {\n return !event.button;\n}\n\nfunction defaultContainer() {\n return this.parentNode;\n}\n\nfunction defaultSubject(d) {\n return d == null ? {x: event.x, y: event.y} : d;\n}\n\nfunction defaultTouchable() {\n return \"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)\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() {\n if (touchending || !filter.apply(this, arguments)) return;\n var gesture = beforestart(\"mouse\", container.apply(this, arguments), mouse, this, arguments);\n if (!gesture) return;\n select(event.view).on(\"mousemove.drag\", mousemoved, true).on(\"mouseup.drag\", mouseupped, true);\n nodrag(event.view);\n nopropagation();\n mousemoving = false;\n mousedownx = event.clientX;\n mousedowny = event.clientY;\n gesture(\"start\");\n }\n\n function mousemoved() {\n noevent();\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\");\n }\n\n function mouseupped() {\n select(event.view).on(\"mousemove.drag mouseup.drag\", null);\n yesdrag(event.view, mousemoving);\n noevent();\n gestures.mouse(\"end\");\n }\n\n function touchstarted() {\n if (!filter.apply(this, arguments)) return;\n var touches = event.changedTouches,\n c = container.apply(this, arguments),\n n = touches.length, i, gesture;\n\n for (i = 0; i < n; ++i) {\n if (gesture = beforestart(touches[i].identifier, c, touch, this, arguments)) {\n nopropagation();\n gesture(\"start\");\n }\n }\n }\n\n function touchmoved() {\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();\n gesture(\"drag\");\n }\n }\n }\n\n function touchended() {\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();\n gesture(\"end\");\n }\n }\n }\n\n function beforestart(id, container, point, that, args) {\n var p = point(container, id), s, dx, dy,\n sublisteners = listeners.copy();\n\n if (!customEvent(new DragEvent(drag, \"beforestart\", s, id, active, p[0], p[1], 0, 0, sublisteners), function() {\n if ((event.subject = s = subject.apply(that, args)) == null) return false;\n dx = s.x - p[0] || 0;\n dy = s.y - p[1] || 0;\n return true;\n })) return;\n\n return function gesture(type) {\n var p0 = p, n;\n switch (type) {\n case \"start\": gestures[id] = gesture, n = active++; break;\n case \"end\": delete gestures[id], --active; // nobreak\n case \"drag\": p = point(container, id), n = active; break;\n }\n customEvent(new DragEvent(drag, type, s, id, n, p[0] + dx, p[1] + dy, p[0] - p0[0], p[1] - p0[1], sublisteners), sublisteners.apply, sublisteners, [type, that, args]);\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","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\";\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 reHex3 = /^#([0-9a-f]{3})$/,\n reHex6 = /^#([0-9a-f]{6})$/,\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 displayable: function() {\n return this.rgb().displayable();\n },\n hex: function() {\n return this.rgb().hex();\n },\n toString: function() {\n return this.rgb() + \"\";\n }\n});\n\nexport default function color(format) {\n var m;\n format = (format + \"\").trim().toLowerCase();\n return (m = reHex3.exec(format)) ? (m = parseInt(m[1], 16), new Rgb((m >> 8 & 0xf) | (m >> 4 & 0x0f0), (m >> 4 & 0xf) | (m & 0xf0), ((m & 0xf) << 4) | (m & 0xf), 1)) // #f00\n : (m = reHex6.exec(format)) ? rgbn(parseInt(m[1], 16)) // #ff0000\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])\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: function(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: function(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: function() {\n return this;\n },\n displayable: function() {\n return (0 <= this.r && this.r <= 255)\n && (0 <= this.g && this.g <= 255)\n && (0 <= this.b && this.b <= 255)\n && (0 <= this.opacity && this.opacity <= 1);\n },\n hex: function() {\n return \"#\" + hex(this.r) + hex(this.g) + hex(this.b);\n },\n toString: function() {\n var a = this.opacity; a = isNaN(a) ? 1 : Math.max(0, Math.min(1, a));\n return (a === 1 ? \"rgb(\" : \"rgba(\")\n + Math.max(0, Math.min(255, Math.round(this.r) || 0)) + \", \"\n + Math.max(0, Math.min(255, Math.round(this.g) || 0)) + \", \"\n + Math.max(0, Math.min(255, Math.round(this.b) || 0))\n + (a === 1 ? \")\" : \", \" + a + \")\");\n }\n}));\n\nfunction hex(value) {\n value = Math.max(0, Math.min(255, Math.round(value) || 0));\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: function(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: function(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: function() {\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 displayable: function() {\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}));\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 var deg2rad = Math.PI / 180;\nexport var rad2deg = 180 / Math.PI;\n","import define, {extend} from \"./define\";\nimport {Color, rgbConvert, Rgb} from \"./color\";\nimport {deg2rad, rad2deg} from \"./math\";\n\n// https://beta.observablehq.com/@mbostock/lab-and-rgb\nvar K = 18,\n Xn = 0.96422,\n Yn = 1,\n Zn = 0.82521,\n t0 = 4 / 29,\n t1 = 6 / 29,\n t2 = 3 * t1 * t1,\n t3 = t1 * t1 * t1;\n\nfunction labConvert(o) {\n if (o instanceof Lab) return new Lab(o.l, o.a, o.b, o.opacity);\n if (o instanceof Hcl) {\n if (isNaN(o.h)) return new Lab(o.l, 0, 0, o.opacity);\n var h = o.h * deg2rad;\n return new Lab(o.l, Math.cos(h) * o.c, Math.sin(h) * o.c, o.opacity);\n }\n if (!(o instanceof Rgb)) o = rgbConvert(o);\n var r = rgb2lrgb(o.r),\n g = rgb2lrgb(o.g),\n b = rgb2lrgb(o.b),\n y = xyz2lab((0.2225045 * r + 0.7168786 * g + 0.0606169 * b) / Yn), x, z;\n if (r === g && g === b) x = z = y; else {\n x = xyz2lab((0.4360747 * r + 0.3850649 * g + 0.1430804 * b) / Xn);\n z = xyz2lab((0.0139322 * r + 0.0971045 * g + 0.7141733 * b) / Zn);\n }\n return new Lab(116 * y - 16, 500 * (x - y), 200 * (y - z), o.opacity);\n}\n\nexport function gray(l, opacity) {\n return new Lab(l, 0, 0, opacity == null ? 1 : opacity);\n}\n\nexport default function lab(l, a, b, opacity) {\n return arguments.length === 1 ? labConvert(l) : new Lab(l, a, b, opacity == null ? 1 : opacity);\n}\n\nexport function Lab(l, a, b, opacity) {\n this.l = +l;\n this.a = +a;\n this.b = +b;\n this.opacity = +opacity;\n}\n\ndefine(Lab, lab, extend(Color, {\n brighter: function(k) {\n return new Lab(this.l + K * (k == null ? 1 : k), this.a, this.b, this.opacity);\n },\n darker: function(k) {\n return new Lab(this.l - K * (k == null ? 1 : k), this.a, this.b, this.opacity);\n },\n rgb: function() {\n var y = (this.l + 16) / 116,\n x = isNaN(this.a) ? y : y + this.a / 500,\n z = isNaN(this.b) ? y : y - this.b / 200;\n x = Xn * lab2xyz(x);\n y = Yn * lab2xyz(y);\n z = Zn * lab2xyz(z);\n return new Rgb(\n lrgb2rgb( 3.1338561 * x - 1.6168667 * y - 0.4906146 * z),\n lrgb2rgb(-0.9787684 * x + 1.9161415 * y + 0.0334540 * z),\n lrgb2rgb( 0.0719453 * x - 0.2289914 * y + 1.4052427 * z),\n this.opacity\n );\n }\n}));\n\nfunction xyz2lab(t) {\n return t > t3 ? Math.pow(t, 1 / 3) : t / t2 + t0;\n}\n\nfunction lab2xyz(t) {\n return t > t1 ? t * t * t : t2 * (t - t0);\n}\n\nfunction lrgb2rgb(x) {\n return 255 * (x <= 0.0031308 ? 12.92 * x : 1.055 * Math.pow(x, 1 / 2.4) - 0.055);\n}\n\nfunction rgb2lrgb(x) {\n return (x /= 255) <= 0.04045 ? x / 12.92 : Math.pow((x + 0.055) / 1.055, 2.4);\n}\n\nfunction hclConvert(o) {\n if (o instanceof Hcl) return new Hcl(o.h, o.c, o.l, o.opacity);\n if (!(o instanceof Lab)) o = labConvert(o);\n if (o.a === 0 && o.b === 0) return new Hcl(NaN, 0, o.l, o.opacity);\n var h = Math.atan2(o.b, o.a) * rad2deg;\n return new Hcl(h < 0 ? h + 360 : h, Math.sqrt(o.a * o.a + o.b * o.b), o.l, o.opacity);\n}\n\nexport function lch(l, c, h, opacity) {\n return arguments.length === 1 ? hclConvert(l) : new Hcl(h, c, l, opacity == null ? 1 : opacity);\n}\n\nexport function hcl(h, c, l, opacity) {\n return arguments.length === 1 ? hclConvert(h) : new Hcl(h, c, l, opacity == null ? 1 : opacity);\n}\n\nexport function Hcl(h, c, l, opacity) {\n this.h = +h;\n this.c = +c;\n this.l = +l;\n this.opacity = +opacity;\n}\n\ndefine(Hcl, hcl, extend(Color, {\n brighter: function(k) {\n return new Hcl(this.h, this.c, this.l + K * (k == null ? 1 : k), this.opacity);\n },\n darker: function(k) {\n return new Hcl(this.h, this.c, this.l - K * (k == null ? 1 : k), this.opacity);\n },\n rgb: function() {\n return labConvert(this).rgb();\n }\n}));\n","import define, {extend} from \"./define\";\nimport {Color, rgbConvert, Rgb, darker, brighter} from \"./color\";\nimport {deg2rad, rad2deg} from \"./math\";\n\nvar A = -0.14861,\n B = +1.78277,\n C = -0.29227,\n D = -0.90649,\n E = +1.97294,\n ED = E * D,\n EB = E * B,\n BC_DA = B * C - D * A;\n\nfunction cubehelixConvert(o) {\n if (o instanceof Cubehelix) return new Cubehelix(o.h, o.s, o.l, o.opacity);\n if (!(o instanceof Rgb)) o = rgbConvert(o);\n var r = o.r / 255,\n g = o.g / 255,\n b = o.b / 255,\n l = (BC_DA * b + ED * r - EB * g) / (BC_DA + ED - EB),\n bl = b - l,\n k = (E * (g - l) - C * bl) / D,\n s = Math.sqrt(k * k + bl * bl) / (E * l * (1 - l)), // NaN if l=0 or l=1\n h = s ? Math.atan2(k, bl) * rad2deg - 120 : NaN;\n return new Cubehelix(h < 0 ? h + 360 : h, s, l, o.opacity);\n}\n\nexport default function cubehelix(h, s, l, opacity) {\n return arguments.length === 1 ? cubehelixConvert(h) : new Cubehelix(h, s, l, opacity == null ? 1 : opacity);\n}\n\nexport function Cubehelix(h, s, l, opacity) {\n this.h = +h;\n this.s = +s;\n this.l = +l;\n this.opacity = +opacity;\n}\n\ndefine(Cubehelix, cubehelix, extend(Color, {\n brighter: function(k) {\n k = k == null ? brighter : Math.pow(brighter, k);\n return new Cubehelix(this.h, this.s, this.l * k, this.opacity);\n },\n darker: function(k) {\n k = k == null ? darker : Math.pow(darker, k);\n return new Cubehelix(this.h, this.s, this.l * k, this.opacity);\n },\n rgb: function() {\n var h = isNaN(this.h) ? 0 : (this.h + 120) * deg2rad,\n l = +this.l,\n a = isNaN(this.s) ? 0 : this.s * l * (1 - l),\n cosh = Math.cos(h),\n sinh = Math.sin(h);\n return new Rgb(\n 255 * (l + a * (A * cosh + B * sinh)),\n 255 * (l + a * (C * cosh + D * sinh)),\n 255 * (l + a * (E * cosh)),\n this.opacity\n );\n }\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 function(x) {\n return function() {\n return x;\n };\n}\n","import constant from \"./constant\";\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\";\nimport basisClosed from \"./basisClosed\";\nimport nogamma, {gamma} from \"./color\";\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\";\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 decompose, {identity} from \"./decompose\";\n\nvar cssNode,\n cssRoot,\n cssView,\n svgNode;\n\nexport function parseCss(value) {\n if (value === \"none\") return identity;\n if (!cssNode) cssNode = document.createElement(\"DIV\"), cssRoot = document.documentElement, cssView = document.defaultView;\n cssNode.style.transform = value;\n value = cssView.getComputedStyle(cssRoot.appendChild(cssNode), null).getPropertyValue(\"transform\");\n cssRoot.removeChild(cssNode);\n value = value.slice(7, -1).split(\",\");\n return decompose(+value[0], +value[1], +value[2], +value[3], +value[4], +value[5]);\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","export default function(a, b) {\n return a = +a, b -= a, function(t) {\n return a + b * t;\n };\n}\n","import number from \"./number\";\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 rgb from \"./rgb\";\nimport array from \"./array\";\nimport date from \"./date\";\nimport number from \"./number\";\nimport object from \"./object\";\nimport string from \"./string\";\nimport constant from \"./constant\";\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 : Array.isArray(b) ? array\n : typeof b.valueOf !== \"function\" && typeof b.toString !== \"function\" || isNaN(b) ? object\n : number)(a, b);\n}\n","export default function(a, b) {\n var d = new Date;\n return a = +a, b -= a, function(t) {\n return d.setTime(a + b * t), d;\n };\n}\n","import value from \"./value\";\n\nexport default function(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","import value from \"./value\";\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 return a = +a, b -= a, function(t) {\n return Math.round(a + 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 number from \"../number\";\nimport {parseCss, parseSvg} from \"./parse\";\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 {hsl as colorHsl} from \"d3-color\";\nimport color, {hue} from \"./color\";\n\nfunction hsl(hue) {\n return function(start, end) {\n var h = hue((start = colorHsl(start)).h, (end = colorHsl(end)).h),\n s = color(start.s, end.s),\n l = color(start.l, end.l),\n opacity = color(start.opacity, end.opacity);\n return function(t) {\n start.h = h(t);\n start.s = s(t);\n start.l = l(t);\n start.opacity = opacity(t);\n return start + \"\";\n };\n }\n}\n\nexport default hsl(hue);\nexport var hslLong = hsl(color);\n","import {hcl as colorHcl} from \"d3-color\";\nimport color, {hue} from \"./color\";\n\nfunction hcl(hue) {\n return function(start, end) {\n var h = hue((start = colorHcl(start)).h, (end = colorHcl(end)).h),\n c = color(start.c, end.c),\n l = color(start.l, end.l),\n opacity = color(start.opacity, end.opacity);\n return function(t) {\n start.h = h(t);\n start.c = c(t);\n start.l = l(t);\n start.opacity = opacity(t);\n return start + \"\";\n };\n }\n}\n\nexport default hcl(hue);\nexport var hclLong = hcl(color);\n","import {cubehelix as colorCubehelix} from \"d3-color\";\nimport color, {hue} from \"./color\";\n\nfunction cubehelix(hue) {\n return (function cubehelixGamma(y) {\n y = +y;\n\n function cubehelix(start, end) {\n var h = hue((start = colorCubehelix(start)).h, (end = colorCubehelix(end)).h),\n s = color(start.s, end.s),\n l = color(start.l, end.l),\n opacity = color(start.opacity, end.opacity);\n return function(t) {\n start.h = h(t);\n start.s = s(t);\n start.l = l(Math.pow(t, y));\n start.opacity = opacity(t);\n return start + \"\";\n };\n }\n\n cubehelix.gamma = cubehelixGamma;\n\n return cubehelix;\n })(1);\n}\n\nexport default cubehelix(hue);\nexport var cubehelixLong = cubehelix(color);\n","var rho = Math.SQRT2,\n rho2 = 2,\n rho4 = 4,\n epsilon2 = 1e-12;\n\nfunction cosh(x) {\n return ((x = Math.exp(x)) + 1 / x) / 2;\n}\n\nfunction sinh(x) {\n return ((x = Math.exp(x)) - 1 / x) / 2;\n}\n\nfunction tanh(x) {\n return ((x = Math.exp(2 * x)) - 1) / (x + 1);\n}\n\n// p0 = [ux0, uy0, w0]\n// p1 = [ux1, uy1, w1]\nexport default function(p0, p1) {\n var ux0 = p0[0], uy0 = p0[1], w0 = p0[2],\n ux1 = p1[0], uy1 = p1[1], w1 = p1[2],\n dx = ux1 - ux0,\n dy = uy1 - uy0,\n d2 = dx * dx + dy * dy,\n i,\n S;\n\n // Special case for u0 ≅ u1.\n if (d2 < epsilon2) {\n S = Math.log(w1 / w0) / rho;\n i = function(t) {\n return [\n ux0 + t * dx,\n uy0 + t * dy,\n w0 * Math.exp(rho * t * S)\n ];\n }\n }\n\n // General case.\n else {\n var d1 = Math.sqrt(d2),\n b0 = (w1 * w1 - w0 * w0 + rho4 * d2) / (2 * w0 * rho2 * d1),\n b1 = (w1 * w1 - w0 * w0 - rho4 * d2) / (2 * w1 * rho2 * d1),\n r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0),\n r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1);\n S = (r1 - r0) / rho;\n i = function(t) {\n var s = t * S,\n coshr0 = cosh(r0),\n u = w0 / (rho2 * d1) * (coshr0 * tanh(rho * s + r0) - sinh(r0));\n return [\n ux0 + u * dx,\n uy0 + u * dy,\n w0 * coshr0 / cosh(rho * s + r0)\n ];\n }\n }\n\n i.duration = S * 1000;\n\n return i;\n}\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(null, 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","export default function(interpolator, n) {\n var samples = new Array(n);\n for (var i = 0; i < n; ++i) samples[i] = interpolator(i / (n - 1));\n return samples;\n}\n","import {Timer} from \"./timer\";\n\nexport default function(callback, delay, time) {\n var t = new Timer;\n delay = delay == null ? 0 : +delay;\n t.restart(function(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\", \"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 > STARTING) throw new Error(\"too late; already started\");\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 // Dispatch the interrupt event.\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. No interrupt event is dispatched\n // because the cancelled transitions never started. Note that this also\n // removes this transition from the pending list!\n else if (+i < id) {\n o.state = ENDED;\n o.timer.stop();\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(null, 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","import {STARTING, ENDING, ENDED} from \"./transition/schedule\";\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 if (active) schedule.on.call(\"interrupt\", node, node.__data__, schedule.index, schedule.group);\n delete schedules[i];\n }\n\n if (empty) delete node.__transition;\n}\n","import {get, set} from \"./schedule\";\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","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 {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 {selection} from \"d3-selection\";\nimport transition_attr from \"./attr\";\nimport transition_attrTween from \"./attrTween\";\nimport transition_delay from \"./delay\";\nimport transition_duration from \"./duration\";\nimport transition_ease from \"./ease\";\nimport transition_filter from \"./filter\";\nimport transition_merge from \"./merge\";\nimport transition_on from \"./on\";\nimport transition_remove from \"./remove\";\nimport transition_select from \"./select\";\nimport transition_selectAll from \"./selectAll\";\nimport transition_selection from \"./selection\";\nimport transition_style from \"./style\";\nimport transition_styleTween from \"./styleTween\";\nimport transition_text from \"./text\";\nimport transition_transition from \"./transition\";\nimport transition_tween from \"./tween\";\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 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 remove: transition_remove,\n tween: transition_tween,\n delay: transition_delay,\n duration: transition_duration,\n ease: transition_ease\n};\n","import {selector} from \"d3-selection\";\nimport {Transition} from \"./index\";\nimport schedule, {get} from \"./schedule\";\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\";\nimport schedule, {get} from \"./schedule\";\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\";\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\";\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\";\nimport schedule, {get} from \"./schedule\";\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\";\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","import {interpolateTransformSvg as interpolateTransform} from \"d3-interpolate\";\nimport {namespace} from \"d3-selection\";\nimport {tweenValue} from \"./tween\";\nimport interpolate from \"./interpolate\";\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 value00,\n interpolate0;\n return function() {\n var value0 = this.getAttribute(name);\n return value0 === value1 ? null\n : value0 === value00 ? interpolate0\n : interpolate0 = interpolate(value00 = value0, value1);\n };\n}\n\nfunction attrConstantNS(fullname, interpolate, value1) {\n var value00,\n interpolate0;\n return function() {\n var value0 = this.getAttributeNS(fullname.space, fullname.local);\n return value0 === value1 ? null\n : value0 === value00 ? interpolate0\n : interpolate0 = interpolate(value00 = value0, value1);\n };\n}\n\nfunction attrFunction(name, interpolate, value) {\n var value00,\n value10,\n interpolate0;\n return function() {\n var value0, value1 = value(this);\n if (value1 == null) return void this.removeAttribute(name);\n value0 = this.getAttribute(name);\n return value0 === value1 ? null\n : value0 === value00 && value1 === value10 ? interpolate0\n : interpolate0 = interpolate(value00 = value0, value10 = value1);\n };\n}\n\nfunction attrFunctionNS(fullname, interpolate, value) {\n var value00,\n value10,\n interpolate0;\n return function() {\n var value0, value1 = value(this);\n if (value1 == null) return void this.removeAttributeNS(fullname.space, fullname.local);\n value0 = this.getAttributeNS(fullname.space, fullname.local);\n return value0 === value1 ? null\n : value0 === value00 && value1 === value10 ? interpolate0\n : interpolate0 = interpolate(value00 = value0, value10 = 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 attrTweenNS(fullname, value) {\n function tween() {\n var node = this, i = value.apply(node, arguments);\n return i && function(t) {\n node.setAttributeNS(fullname.space, fullname.local, i(t));\n };\n }\n tween._value = value;\n return tween;\n}\n\nfunction attrTween(name, value) {\n function tween() {\n var node = this, i = value.apply(node, arguments);\n return i && function(t) {\n node.setAttribute(name, i(t));\n };\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 {interpolateTransformCss as interpolateTransform} from \"d3-interpolate\";\nimport {style} from \"d3-selection\";\nimport {tweenValue} from \"./tween\";\nimport interpolate from \"./interpolate\";\n\nfunction styleRemove(name, interpolate) {\n var value00,\n value10,\n interpolate0;\n return function() {\n var value0 = style(this, name),\n value1 = (this.style.removeProperty(name), style(this, name));\n return value0 === value1 ? null\n : value0 === value00 && value1 === value10 ? interpolate0\n : interpolate0 = interpolate(value00 = value0, value10 = value1);\n };\n}\n\nfunction styleRemoveEnd(name) {\n return function() {\n this.style.removeProperty(name);\n };\n}\n\nfunction styleConstant(name, interpolate, value1) {\n var value00,\n interpolate0;\n return function() {\n var value0 = style(this, name);\n return value0 === value1 ? null\n : value0 === value00 ? interpolate0\n : interpolate0 = interpolate(value00 = value0, value1);\n };\n}\n\nfunction styleFunction(name, interpolate, value) {\n var value00,\n value10,\n interpolate0;\n return function() {\n var value0 = style(this, name),\n value1 = value(this);\n if (value1 == null) value1 = (this.style.removeProperty(name), style(this, name));\n return value0 === value1 ? null\n : value0 === value00 && value1 === value10 ? interpolate0\n : interpolate0 = interpolate(value00 = value0, value10 = value1);\n };\n}\n\nexport default function(name, value, priority) {\n var i = (name += \"\") === \"transform\" ? interpolateTransform : interpolate;\n return value == null ? this\n .styleTween(name, styleRemove(name, i))\n .on(\"end.style.\" + name, styleRemoveEnd(name))\n : this.styleTween(name, typeof value === \"function\"\n ? styleFunction(name, i, tweenValue(this, \"style.\" + name, value))\n : styleConstant(name, i, value + \"\"), priority);\n}\n","function styleTween(name, value, priority) {\n function tween() {\n var node = this, i = value.apply(node, arguments);\n return i && function(t) {\n node.style.setProperty(name, i(t), priority);\n };\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\";\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 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, init} from \"./schedule\";\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\";\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 {get, set} from \"./schedule\";\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","var exponent = 3;\n\nexport var polyIn = (function custom(e) {\n e = +e;\n\n function polyIn(t) {\n return Math.pow(t, e);\n }\n\n polyIn.exponent = custom;\n\n return polyIn;\n})(exponent);\n\nexport var polyOut = (function custom(e) {\n e = +e;\n\n function polyOut(t) {\n return 1 - Math.pow(1 - t, e);\n }\n\n polyOut.exponent = custom;\n\n return polyOut;\n})(exponent);\n\nexport var polyInOut = (function custom(e) {\n e = +e;\n\n function polyInOut(t) {\n return ((t *= 2) <= 1 ? Math.pow(t, e) : 2 - Math.pow(2 - t, e)) / 2;\n }\n\n polyInOut.exponent = custom;\n\n return polyInOut;\n})(exponent);\n","var pi = Math.PI,\n halfPi = pi / 2;\n\nexport function sinIn(t) {\n return 1 - Math.cos(t * halfPi);\n}\n\nexport function sinOut(t) {\n return Math.sin(t * halfPi);\n}\n\nexport function sinInOut(t) {\n return (1 - Math.cos(pi * t)) / 2;\n}\n","var overshoot = 1.70158;\n\nexport var backIn = (function custom(s) {\n s = +s;\n\n function backIn(t) {\n return t * t * ((s + 1) * t - s);\n }\n\n backIn.overshoot = custom;\n\n return backIn;\n})(overshoot);\n\nexport var backOut = (function custom(s) {\n s = +s;\n\n function backOut(t) {\n return --t * t * ((s + 1) * t + s) + 1;\n }\n\n backOut.overshoot = custom;\n\n return backOut;\n})(overshoot);\n\nexport var backInOut = (function custom(s) {\n s = +s;\n\n function backInOut(t) {\n return ((t *= 2) < 1 ? t * t * ((s + 1) * t - s) : (t -= 2) * t * ((s + 1) * t + s) + 2) / 2;\n }\n\n backInOut.overshoot = custom;\n\n return backInOut;\n})(overshoot);\n","var tau = 2 * Math.PI,\n amplitude = 1,\n period = 0.3;\n\nexport var elasticIn = (function custom(a, p) {\n var s = Math.asin(1 / (a = Math.max(1, a))) * (p /= tau);\n\n function elasticIn(t) {\n return a * Math.pow(2, 10 * --t) * Math.sin((s - t) / p);\n }\n\n elasticIn.amplitude = function(a) { return custom(a, p * tau); };\n elasticIn.period = function(p) { return custom(a, p); };\n\n return elasticIn;\n})(amplitude, period);\n\nexport var elasticOut = (function custom(a, p) {\n var s = Math.asin(1 / (a = Math.max(1, a))) * (p /= tau);\n\n function elasticOut(t) {\n return 1 - a * Math.pow(2, -10 * (t = +t)) * Math.sin((t + s) / p);\n }\n\n elasticOut.amplitude = function(a) { return custom(a, p * tau); };\n elasticOut.period = function(p) { return custom(a, p); };\n\n return elasticOut;\n})(amplitude, period);\n\nexport var elasticInOut = (function custom(a, p) {\n var s = Math.asin(1 / (a = Math.max(1, a))) * (p /= tau);\n\n function elasticInOut(t) {\n return ((t = t * 2 - 1) < 0\n ? a * Math.pow(2, 10 * t) * Math.sin((s - t) / p)\n : 2 - a * Math.pow(2, -10 * t) * Math.sin((s + t) / p)) / 2;\n }\n\n elasticInOut.amplitude = function(a) { return custom(a, p * tau); };\n elasticInOut.period = function(p) { return custom(a, p); };\n\n return elasticInOut;\n})(amplitude, period);\n","import {Transition, newId} from \"../transition/index\";\nimport schedule from \"../transition/schedule\";\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 return defaultTiming.time = now(), defaultTiming;\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\";\nimport selection_transition from \"./transition\";\n\nselection.prototype.interrupt = selection_interrupt;\nselection.prototype.transition = selection_transition;\n","import interrupt from \"../interrupt\";\n\nexport default function(name) {\n return this.each(function() {\n interrupt(this, name);\n });\n}\n","import {Transition} from \"./transition/index\";\nimport {SCHEDULED} from \"./transition/schedule\";\n\nvar root = [null];\n\nexport default function(node, name) {\n var schedules = node.__transition,\n schedule,\n i;\n\n if (schedules) {\n name = name == null ? null : name + \"\";\n for (i in schedules) {\n if ((schedule = schedules[i]).state > SCHEDULED && schedule.name === name) {\n return new Transition([[node]], root, name, +i);\n }\n }\n }\n\n return null;\n}\n","export default function(x) {\n return function() {\n return x;\n };\n}\n","export default function(target, type, selection) {\n this.target = target;\n this.type = type;\n this.selection = selection;\n}\n","import {event} from \"d3-selection\";\n\nexport function nopropagation() {\n event.stopImmediatePropagation();\n}\n\nexport default function() {\n event.preventDefault();\n event.stopImmediatePropagation();\n}\n","import {dispatch} from \"d3-dispatch\";\nimport {dragDisable, dragEnable} from \"d3-drag\";\nimport {interpolate} from \"d3-interpolate\";\nimport {customEvent, event, mouse, select} from \"d3-selection\";\nimport {interrupt} from \"d3-transition\";\nimport constant from \"./constant\";\nimport BrushEvent from \"./event\";\nimport noevent, {nopropagation} from \"./noevent\";\n\nvar MODE_DRAG = {name: \"drag\"},\n MODE_SPACE = {name: \"space\"},\n MODE_HANDLE = {name: \"handle\"},\n MODE_CENTER = {name: \"center\"};\n\nvar X = {\n name: \"x\",\n handles: [\"e\", \"w\"].map(type),\n input: function(x, e) { return x && [[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 && [[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\", \"e\", \"s\", \"w\", \"nw\", \"ne\", \"se\", \"sw\"].map(type),\n input: function(xy) { return 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() {\n return !event.button;\n}\n\nfunction defaultExtent() {\n var svg = this.ownerSVGElement || this;\n return [[0, 0], [svg.width.baseVal.value, svg.height.baseVal.value]];\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 listeners = dispatch(brush, \"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 .style(\"-webkit-tap-highlight-color\", \"rgba(0,0,0,0)\")\n .on(\"mousedown.brush touchstart.brush\", started);\n }\n\n brush.move = function(group, selection) {\n if (group.selection) {\n group\n .on(\"start.brush\", function() { emitter(this, arguments).beforestart().start(); })\n .on(\"interrupt.brush end.brush\", function() { emitter(this, arguments).end(); })\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 && empty(selection1) ? null : i(t);\n redraw.call(that);\n emit.brush();\n }\n\n return selection0 && selection1 ? 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 || empty(selection1) ? null : selection1;\n redraw.call(that);\n emit.start().brush().end();\n });\n }\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) {\n return that.__brush.emitter || new Emitter(that, args);\n }\n\n function Emitter(that, args) {\n this.that = that;\n this.args = args;\n this.state = that.__brush;\n this.active = 0;\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() {\n if (this.starting) this.starting = false, this.emit(\"start\");\n return this;\n },\n brush: function() {\n this.emit(\"brush\");\n return this;\n },\n end: function() {\n if (--this.active === 0) delete this.state.emitter, this.emit(\"end\");\n return this;\n },\n emit: function(type) {\n customEvent(new BrushEvent(brush, type, dim.output(this.state.selection)), listeners.apply, listeners, [type, this.that, this.args]);\n }\n };\n\n function started() {\n if (event.touches) { if (event.changedTouches.length < event.touches.length) return noevent(); }\n else if (touchending) return;\n if (!filter.apply(this, arguments)) return;\n\n var that = this,\n type = event.target.__data__.type,\n mode = (event.metaKey ? type = \"overlay\" : type) === \"selection\" ? MODE_DRAG : (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,\n dy,\n moving,\n shifting = signX && signY && event.shiftKey,\n lockX,\n lockY,\n point0 = mouse(that),\n point = point0,\n emit = emitter(that, arguments).beforestart();\n\n if (type === \"overlay\") {\n state.selection = selection = [\n [w0 = dim === Y ? W : point0[0], n0 = dim === X ? N : point0[1]],\n [e0 = dim === Y ? E : w0, s0 = dim === X ? S : n0]\n ];\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 group\n .on(\"touchmove.brush\", moved, true)\n .on(\"touchend.brush touchcancel.brush\", ended, true);\n } else {\n var view = select(event.view)\n .on(\"keydown.brush\", keydowned, true)\n .on(\"keyup.brush\", keyupped, true)\n .on(\"mousemove.brush\", moved, true)\n .on(\"mouseup.brush\", ended, true);\n\n dragDisable(event.view);\n }\n\n nopropagation();\n interrupt(that);\n redraw.call(that);\n emit.start();\n\n function moved() {\n var point1 = mouse(that);\n if (shifting && !lockX && !lockY) {\n if (Math.abs(point1[0] - point[0]) > Math.abs(point1[1] - point[1])) lockY = true;\n else lockX = true;\n }\n point = point1;\n moving = true;\n noevent();\n move();\n }\n\n function move() {\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 = Math.max(W - w0, Math.min(E - e0, dx)), w1 = w0 + dx, e1 = e0 + dx;\n if (signY) dy = Math.max(N - n0, Math.min(S - s0, dy)), n1 = n0 + dy, s1 = s0 + dy;\n break;\n }\n case MODE_HANDLE: {\n if (signX < 0) dx = Math.max(W - w0, Math.min(E - w0, dx)), w1 = w0 + dx, e1 = e0;\n else if (signX > 0) dx = Math.max(W - e0, Math.min(E - e0, dx)), w1 = w0, e1 = e0 + dx;\n if (signY < 0) dy = Math.max(N - n0, Math.min(S - n0, dy)), n1 = n0 + dy, s1 = s0;\n else if (signY > 0) dy = Math.max(N - s0, Math.min(S - s0, dy)), n1 = n0, s1 = s0 + dy;\n break;\n }\n case MODE_CENTER: {\n if (signX) w1 = Math.max(W, Math.min(E, w0 - dx * signX)), e1 = Math.max(W, Math.min(E, e0 + dx * signX));\n if (signY) n1 = Math.max(N, Math.min(S, n0 - dy * signY)), s1 = Math.max(N, Math.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();\n }\n }\n\n function ended() {\n nopropagation();\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 group.on(\"touchmove.brush touchend.brush touchcancel.brush\", null);\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();\n }\n\n function keydowned() {\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();\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();\n }\n break;\n }\n default: return;\n }\n noevent();\n }\n\n function keyupped() {\n switch (event.keyCode) {\n case 16: { // SHIFT\n if (shifting) {\n lockX = lockY = shifting = false;\n move();\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();\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();\n }\n break;\n }\n default: return;\n }\n noevent();\n }\n }\n\n function initialize() {\n var state = this.__brush || {selection: null};\n state.extent = 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([[+_[0][0], +_[0][1]], [+_[1][0], +_[1][1]]]), brush) : extent;\n };\n\n brush.filter = function(_) {\n return arguments.length ? (filter = typeof _ === \"function\" ? _ : constant(!!_), brush) : filter;\n };\n\n brush.handleSize = function(_) {\n return arguments.length ? (handleSize = +_, brush) : handleSize;\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","export default function(a, b) {\n return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;\n}\n","import ascending from \"./ascending\";\nimport bisector from \"./bisector\";\n\nvar ascendingBisect = bisector(ascending);\nexport var bisectRight = ascendingBisect.right;\nexport var bisectLeft = ascendingBisect.left;\nexport default bisectRight;\n","import ascending from \"./ascending\";\n\nexport default function(compare) {\n if (compare.length === 1) compare = ascendingComparator(compare);\n return {\n left: function(a, x, lo, hi) {\n if (lo == null) lo = 0;\n if (hi == null) hi = a.length;\n while (lo < hi) {\n var mid = lo + hi >>> 1;\n if (compare(a[mid], x) < 0) lo = mid + 1;\n else hi = mid;\n }\n return lo;\n },\n right: function(a, x, lo, hi) {\n if (lo == null) lo = 0;\n if (hi == null) hi = a.length;\n while (lo < hi) {\n var mid = lo + hi >>> 1;\n if (compare(a[mid], x) > 0) hi = mid;\n else lo = mid + 1;\n }\n return lo;\n }\n };\n}\n\nfunction ascendingComparator(f) {\n return function(d, x) {\n return ascending(f(d), x);\n };\n}\n","var array = Array.prototype;\n\nexport var slice = array.slice;\nexport var map = array.map;\n","var e10 = Math.sqrt(50),\n e5 = Math.sqrt(10),\n e2 = Math.sqrt(2);\n\nexport default function(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 start = Math.ceil(start / step);\n stop = Math.floor(stop / step);\n ticks = new Array(n = Math.ceil(stop - start + 1));\n while (++i < n) ticks[i] = (start + i) * step;\n } else {\n start = Math.floor(start * step);\n stop = Math.ceil(stop * step);\n ticks = new Array(n = Math.ceil(start - stop + 1));\n while (++i < n) ticks[i] = (start - 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(values) {\n return Math.ceil(Math.log(values.length) / Math.LN2) + 1;\n}\n","export default function(values, valueof) {\n var n = values.length,\n i = -1,\n value,\n max;\n\n if (valueof == null) {\n while (++i < n) { // Find the first comparable value.\n if ((value = values[i]) != null && value >= value) {\n max = value;\n while (++i < n) { // Compare the remaining values.\n if ((value = values[i]) != null && value > max) {\n max = value;\n }\n }\n }\n }\n }\n\n else {\n while (++i < n) { // Find the first comparable value.\n if ((value = valueof(values[i], i, values)) != null && value >= value) {\n max = value;\n while (++i < n) { // Compare the remaining values.\n if ((value = valueof(values[i], i, values)) != null && value > max) {\n max = value;\n }\n }\n }\n }\n }\n\n return max;\n}\n","export var prefix = \"$\";\n\nfunction Map() {}\n\nMap.prototype = map.prototype = {\n constructor: Map,\n has: function(key) {\n return (prefix + key) in this;\n },\n get: function(key) {\n return this[prefix + key];\n },\n set: function(key, value) {\n this[prefix + key] = value;\n return this;\n },\n remove: function(key) {\n var property = prefix + key;\n return property in this && delete this[property];\n },\n clear: function() {\n for (var property in this) if (property[0] === prefix) delete this[property];\n },\n keys: function() {\n var keys = [];\n for (var property in this) if (property[0] === prefix) keys.push(property.slice(1));\n return keys;\n },\n values: function() {\n var values = [];\n for (var property in this) if (property[0] === prefix) values.push(this[property]);\n return values;\n },\n entries: function() {\n var entries = [];\n for (var property in this) if (property[0] === prefix) entries.push({key: property.slice(1), value: this[property]});\n return entries;\n },\n size: function() {\n var size = 0;\n for (var property in this) if (property[0] === prefix) ++size;\n return size;\n },\n empty: function() {\n for (var property in this) if (property[0] === prefix) return false;\n return true;\n },\n each: function(f) {\n for (var property in this) if (property[0] === prefix) f(this[property], property.slice(1), this);\n }\n};\n\nfunction map(object, f) {\n var map = new Map;\n\n // Copy constructor.\n if (object instanceof Map) object.each(function(value, key) { map.set(key, value); });\n\n // Index array by numeric index or specified key function.\n else if (Array.isArray(object)) {\n var i = -1,\n n = object.length,\n o;\n\n if (f == null) while (++i < n) map.set(i, object[i]);\n else while (++i < n) map.set(f(o = object[i], i, object), o);\n }\n\n // Convert object to map.\n else if (object) for (var key in object) map.set(key, object[key]);\n\n return map;\n}\n\nexport default map;\n","import {default as map, prefix} from \"./map\";\n\nfunction Set() {}\n\nvar proto = map.prototype;\n\nSet.prototype = set.prototype = {\n constructor: Set,\n has: proto.has,\n add: function(value) {\n value += \"\";\n this[prefix + value] = value;\n return this;\n },\n remove: proto.remove,\n clear: proto.clear,\n values: proto.keys,\n size: proto.size,\n empty: proto.empty,\n each: proto.each\n};\n\nfunction set(object, f) {\n var set = new Set;\n\n // Copy constructor.\n if (object instanceof Set) object.each(function(value) { set.add(value); });\n\n // Otherwise, assume it’s an array.\n else if (object) {\n var i = -1, n = object.length;\n if (f == null) while (++i < n) set.add(object[i]);\n else while (++i < n) set.add(f(object[i], i, object));\n }\n\n return set;\n}\n\nexport default set;\n","var array = Array.prototype;\n\nexport var map = array.map;\nexport var slice = array.slice;\n","export default function(x) {\n return +x;\n}\n","import {bisect} from \"d3-array\";\nimport {interpolate as interpolateValue, interpolateRound} from \"d3-interpolate\";\nimport {map, slice} from \"./array\";\nimport constant from \"./constant\";\nimport number from \"./number\";\n\nvar unit = [0, 1];\n\nexport function deinterpolateLinear(a, b) {\n return (b -= (a = +a))\n ? function(x) { return (x - a) / b; }\n : constant(b);\n}\n\nfunction deinterpolateClamp(deinterpolate) {\n return function(a, b) {\n var d = deinterpolate(a = +a, b = +b);\n return function(x) { return x <= a ? 0 : x >= b ? 1 : d(x); };\n };\n}\n\nfunction reinterpolateClamp(reinterpolate) {\n return function(a, b) {\n var r = reinterpolate(a = +a, b = +b);\n return function(t) { return t <= 0 ? a : t >= 1 ? b : r(t); };\n };\n}\n\nfunction bimap(domain, range, deinterpolate, reinterpolate) {\n var d0 = domain[0], d1 = domain[1], r0 = range[0], r1 = range[1];\n if (d1 < d0) d0 = deinterpolate(d1, d0), r0 = reinterpolate(r1, r0);\n else d0 = deinterpolate(d0, d1), r0 = reinterpolate(r0, r1);\n return function(x) { return r0(d0(x)); };\n}\n\nfunction polymap(domain, range, deinterpolate, reinterpolate) {\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] = deinterpolate(domain[i], domain[i + 1]);\n r[i] = reinterpolate(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}\n\n// deinterpolate(a, b)(x) takes a domain value x in [a,b] and returns the corresponding parameter t in [0,1].\n// reinterpolate(a, b)(t) takes a parameter t in [0,1] and returns the corresponding domain value x in [a,b].\nexport default function continuous(deinterpolate, reinterpolate) {\n var domain = unit,\n range = unit,\n interpolate = interpolateValue,\n clamp = false,\n piecewise,\n output,\n input;\n\n function rescale() {\n piecewise = Math.min(domain.length, range.length) > 2 ? polymap : bimap;\n output = input = null;\n return scale;\n }\n\n function scale(x) {\n return (output || (output = piecewise(domain, range, clamp ? deinterpolateClamp(deinterpolate) : deinterpolate, interpolate)))(+x);\n }\n\n scale.invert = function(y) {\n return (input || (input = piecewise(range, domain, deinterpolateLinear, clamp ? reinterpolateClamp(reinterpolate) : reinterpolate)))(+y);\n };\n\n scale.domain = function(_) {\n return arguments.length ? (domain = map.call(_, number), rescale()) : domain.slice();\n };\n\n scale.range = function(_) {\n return arguments.length ? (range = slice.call(_), rescale()) : range.slice();\n };\n\n scale.rangeRound = function(_) {\n return range = slice.call(_), interpolate = interpolateRound, rescale();\n };\n\n scale.clamp = function(_) {\n return arguments.length ? (clamp = !!_, rescale()) : clamp;\n };\n\n scale.interpolate = function(_) {\n return arguments.length ? (interpolate = _, rescale()) : interpolate;\n };\n\n return rescale();\n}\n","export default function(x) {\n return function() {\n return x;\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, formatDecimal(1.23) returns [\"123\", 0].\nexport default function(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 formatDecimal from \"./formatDecimal\";\n\nexport default function(x) {\n return x = formatDecimal(Math.abs(x)), x ? x[1] : NaN;\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 return new FormatSpecifier(specifier);\n}\n\nformatSpecifier.prototype = FormatSpecifier.prototype; // instanceof\n\nfunction FormatSpecifier(specifier) {\n if (!(match = re.exec(specifier))) throw new Error(\"invalid format: \" + specifier);\n var match;\n this.fill = match[1] || \" \";\n this.align = match[2] || \">\";\n this.sign = match[3] || \"-\";\n this.symbol = match[4] || \"\";\n this.zero = !!match[5];\n this.width = match[6] && +match[6];\n this.comma = !!match[7];\n this.precision = match[8] && +match[8].slice(1);\n this.trim = !!match[9];\n this.type = match[10] || \"\";\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 == null ? \"\" : Math.max(1, this.width | 0))\n + (this.comma ? \",\" : \"\")\n + (this.precision == null ? \"\" : \".\" + Math.max(0, this.precision | 0))\n + (this.trim ? \"~\" : \"\")\n + this.type;\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 (i0 > 0) { if (!+s[i]) break out; i0 = 0; } break;\n }\n }\n return i0 > 0 ? s.slice(0, i0) + s.slice(i1 + 1) : s;\n}\n","import formatDecimal from \"./formatDecimal\";\n\nexport var prefixExponent;\n\nexport default function(x, p) {\n var d = formatDecimal(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\") + formatDecimal(x, Math.max(0, p + i - 1))[0]; // less than 1y!\n}\n","import formatLocale from \"./locale\";\n\nvar locale;\nexport var format;\nexport var formatPrefix;\n\ndefaultLocale({\n decimal: \".\",\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 formatDecimal from \"./formatDecimal\";\n\nexport default function(x, p) {\n var d = formatDecimal(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 formatPrefixAuto from \"./formatPrefixAuto\";\nimport formatRounded from \"./formatRounded\";\n\nexport default {\n \"%\": function(x, p) { return (x * 100).toFixed(p); },\n \"b\": function(x) { return Math.round(x).toString(2); },\n \"c\": function(x) { return x + \"\"; },\n \"d\": function(x) { return Math.round(x).toString(10); },\n \"e\": function(x, p) { return x.toExponential(p); },\n \"f\": function(x, p) { return x.toFixed(p); },\n \"g\": function(x, p) { return x.toPrecision(p); },\n \"o\": function(x) { return Math.round(x).toString(8); },\n \"p\": function(x, p) { return formatRounded(x * 100, p); },\n \"r\": formatRounded,\n \"s\": formatPrefixAuto,\n \"X\": function(x) { return Math.round(x).toString(16).toUpperCase(); },\n \"x\": function(x) { return Math.round(x).toString(16); }\n};\n","export default function(x) {\n return x;\n}\n","import exponent from \"./exponent\";\nimport formatGroup from \"./formatGroup\";\nimport formatNumerals from \"./formatNumerals\";\nimport formatSpecifier from \"./formatSpecifier\";\nimport formatTrim from \"./formatTrim\";\nimport formatTypes from \"./formatTypes\";\nimport {prefixExponent} from \"./formatPrefixAuto\";\nimport identity from \"./identity\";\n\nvar 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 && locale.thousands ? formatGroup(locale.grouping, locale.thousands) : identity,\n currency = locale.currency,\n decimal = locale.decimal,\n numerals = locale.numerals ? formatNumerals(locale.numerals) : identity,\n percent = locale.percent || \"%\";\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 == null && (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 === \"$\" ? currency[0] : symbol === \"#\" && /[boxX]/.test(type) ? \"0\" + type.toLowerCase() : \"\",\n suffix = symbol === \"$\" ? currency[1] : /[%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 == null ? 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 // Perform the initial formatting.\n var valueNegative = value < 0;\n value = 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 during formatting, treat as positive.\n if (valueNegative && +value === 0) valueNegative = false;\n\n // Compute the prefix and suffix.\n valuePrefix = (valueNegative ? (sign === \"(\" ? sign : \"-\") : 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","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","import exponent from \"./exponent\";\n\nexport default function(step) {\n return Math.max(0, -exponent(Math.abs(step)));\n}\n","import {tickStep} from \"d3-array\";\nimport {format, formatPrefix, formatSpecifier, precisionFixed, precisionPrefix, precisionRound} from \"d3-format\";\n\nexport default function(domain, count, specifier) {\n var start = domain[0],\n stop = domain[domain.length - 1],\n step = tickStep(start, stop, count == null ? 10 : 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\";\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\";\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 {ticks, tickIncrement} from \"d3-array\";\nimport {interpolateNumber as reinterpolate} from \"d3-interpolate\";\nimport {default as continuous, copy, deinterpolateLinear as deinterpolate} from \"./continuous\";\nimport tickFormat from \"./tickFormat\";\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 return tickFormat(domain(), count, specifier);\n };\n\n scale.nice = function(count) {\n if (count == null) count = 10;\n\n var d = domain(),\n i0 = 0,\n i1 = d.length - 1,\n start = d[i0],\n stop = d[i1],\n step;\n\n if (stop < start) {\n step = start, start = stop, stop = step;\n step = i0, i0 = i1, i1 = step;\n }\n\n step = tickIncrement(start, stop, count);\n\n if (step > 0) {\n start = Math.floor(start / step) * step;\n stop = Math.ceil(stop / step) * step;\n step = tickIncrement(start, stop, count);\n } else if (step < 0) {\n start = Math.ceil(start * step) / step;\n stop = Math.floor(stop * step) / step;\n step = tickIncrement(start, stop, count);\n }\n\n if (step > 0) {\n d[i0] = Math.floor(start / step) * step;\n d[i1] = Math.ceil(stop / step) * step;\n domain(d);\n } else if (step < 0) {\n d[i0] = Math.ceil(start * step) / step;\n d[i1] = Math.floor(stop * step) / step;\n domain(d);\n }\n\n return scale;\n };\n\n return scale;\n}\n\nexport default function linear() {\n var scale = continuous(deinterpolate, reinterpolate);\n\n scale.copy = function() {\n return copy(scale, linear());\n };\n\n return linearish(scale);\n}\n","var t0 = new Date,\n t1 = new Date;\n\nexport default function newInterval(floori, offseti, count, field) {\n\n function interval(date) {\n return floori(date = new Date(+date)), date;\n }\n\n interval.floor = interval;\n\n interval.ceil = function(date) {\n return floori(date = new Date(date - 1)), offseti(date, 1), floori(date), date;\n };\n\n interval.round = function(date) {\n var d0 = interval(date),\n d1 = interval.ceil(date);\n return date - d0 < d1 - date ? d0 : d1;\n };\n\n interval.offset = function(date, step) {\n return offseti(date = new Date(+date), step == null ? 1 : Math.floor(step)), date;\n };\n\n interval.range = function(start, stop, step) {\n var range = [], previous;\n start = interval.ceil(start);\n step = step == null ? 1 : Math.floor(step);\n if (!(start < stop) || !(step > 0)) return range; // also handles Invalid Date\n do range.push(previous = new Date(+start)), offseti(start, step), floori(start);\n while (previous < start && start < stop);\n return range;\n };\n\n interval.filter = function(test) {\n return newInterval(function(date) {\n if (date >= date) while (floori(date), !test(date)) date.setTime(date - 1);\n }, function(date, step) {\n if (date >= date) {\n if (step < 0) while (++step <= 0) {\n while (offseti(date, -1), !test(date)) {} // eslint-disable-line no-empty\n } else while (--step >= 0) {\n while (offseti(date, +1), !test(date)) {} // eslint-disable-line no-empty\n }\n }\n });\n };\n\n if (count) {\n interval.count = function(start, end) {\n t0.setTime(+start), t1.setTime(+end);\n floori(t0), floori(t1);\n return Math.floor(count(t0, t1));\n };\n\n interval.every = function(step) {\n step = Math.floor(step);\n return !isFinite(step) || !(step > 0) ? null\n : !(step > 1) ? interval\n : interval.filter(field\n ? function(d) { return field(d) % step === 0; }\n : function(d) { return interval.count(0, d) % step === 0; });\n };\n }\n\n return interval;\n}\n","import interval from \"./interval\";\n\nvar millisecond = interval(function() {\n // noop\n}, function(date, step) {\n date.setTime(+date + step);\n}, function(start, end) {\n return end - start;\n});\n\n// An optimized implementation for this simple case.\nmillisecond.every = function(k) {\n k = Math.floor(k);\n if (!isFinite(k) || !(k > 0)) return null;\n if (!(k > 1)) return millisecond;\n return interval(function(date) {\n date.setTime(Math.floor(date / k) * k);\n }, function(date, step) {\n date.setTime(+date + step * k);\n }, function(start, end) {\n return (end - start) / k;\n });\n};\n\nexport default millisecond;\nexport var milliseconds = millisecond.range;\n","export var durationSecond = 1e3;\nexport var durationMinute = 6e4;\nexport var durationHour = 36e5;\nexport var durationDay = 864e5;\nexport var durationWeek = 6048e5;\n","import interval from \"./interval\";\nimport {durationDay, durationMinute} from \"./duration\";\n\nvar day = interval(function(date) {\n date.setHours(0, 0, 0, 0);\n}, function(date, step) {\n date.setDate(date.getDate() + step);\n}, function(start, end) {\n return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute) / durationDay;\n}, function(date) {\n return date.getDate() - 1;\n});\n\nexport default day;\nexport var days = day.range;\n","import interval from \"./interval\";\nimport {durationSecond} from \"./duration\";\n\nvar second = interval(function(date) {\n date.setTime(Math.floor(date / durationSecond) * durationSecond);\n}, function(date, step) {\n date.setTime(+date + step * durationSecond);\n}, function(start, end) {\n return (end - start) / durationSecond;\n}, function(date) {\n return date.getUTCSeconds();\n});\n\nexport default second;\nexport var seconds = second.range;\n","import interval from \"./interval\";\nimport {durationMinute} from \"./duration\";\n\nvar minute = interval(function(date) {\n date.setTime(Math.floor(date / durationMinute) * durationMinute);\n}, function(date, step) {\n date.setTime(+date + step * durationMinute);\n}, function(start, end) {\n return (end - start) / durationMinute;\n}, function(date) {\n return date.getMinutes();\n});\n\nexport default minute;\nexport var minutes = minute.range;\n","import interval from \"./interval\";\nimport {durationHour, durationMinute} from \"./duration\";\n\nvar hour = interval(function(date) {\n var offset = date.getTimezoneOffset() * durationMinute % durationHour;\n if (offset < 0) offset += durationHour;\n date.setTime(Math.floor((+date - offset) / durationHour) * durationHour + offset);\n}, function(date, step) {\n date.setTime(+date + step * durationHour);\n}, function(start, end) {\n return (end - start) / durationHour;\n}, function(date) {\n return date.getHours();\n});\n\nexport default hour;\nexport var hours = hour.range;\n","import interval from \"./interval\";\nimport {durationMinute, durationWeek} from \"./duration\";\n\nfunction weekday(i) {\n return interval(function(date) {\n date.setDate(date.getDate() - (date.getDay() + 7 - i) % 7);\n date.setHours(0, 0, 0, 0);\n }, function(date, step) {\n date.setDate(date.getDate() + step * 7);\n }, function(start, end) {\n return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute) / durationWeek;\n });\n}\n\nexport var sunday = weekday(0);\nexport var monday = weekday(1);\nexport var tuesday = weekday(2);\nexport var wednesday = weekday(3);\nexport var thursday = weekday(4);\nexport var friday = weekday(5);\nexport var saturday = weekday(6);\n\nexport var sundays = sunday.range;\nexport var mondays = monday.range;\nexport var tuesdays = tuesday.range;\nexport var wednesdays = wednesday.range;\nexport var thursdays = thursday.range;\nexport var fridays = friday.range;\nexport var saturdays = saturday.range;\n","import interval from \"./interval\";\n\nvar year = interval(function(date) {\n date.setMonth(0, 1);\n date.setHours(0, 0, 0, 0);\n}, function(date, step) {\n date.setFullYear(date.getFullYear() + step);\n}, function(start, end) {\n return end.getFullYear() - start.getFullYear();\n}, function(date) {\n return date.getFullYear();\n});\n\n// An optimized implementation for this simple case.\nyear.every = function(k) {\n return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : interval(function(date) {\n date.setFullYear(Math.floor(date.getFullYear() / k) * k);\n date.setMonth(0, 1);\n date.setHours(0, 0, 0, 0);\n }, function(date, step) {\n date.setFullYear(date.getFullYear() + step * k);\n });\n};\n\nexport default year;\nexport var years = year.range;\n","import interval from \"./interval\";\n\nvar month = interval(function(date) {\n date.setDate(1);\n date.setHours(0, 0, 0, 0);\n}, function(date, step) {\n date.setMonth(date.getMonth() + step);\n}, function(start, end) {\n return end.getMonth() - start.getMonth() + (end.getFullYear() - start.getFullYear()) * 12;\n}, function(date) {\n return date.getMonth();\n});\n\nexport default month;\nexport var months = month.range;\n","import interval from \"./interval\";\nimport {durationDay} from \"./duration\";\n\nvar utcDay = interval(function(date) {\n date.setUTCHours(0, 0, 0, 0);\n}, function(date, step) {\n date.setUTCDate(date.getUTCDate() + step);\n}, function(start, end) {\n return (end - start) / durationDay;\n}, function(date) {\n return date.getUTCDate() - 1;\n});\n\nexport default utcDay;\nexport var utcDays = utcDay.range;\n","import interval from \"./interval\";\nimport {durationMinute} from \"./duration\";\n\nvar utcMinute = interval(function(date) {\n date.setUTCSeconds(0, 0);\n}, function(date, step) {\n date.setTime(+date + step * durationMinute);\n}, function(start, end) {\n return (end - start) / durationMinute;\n}, function(date) {\n return date.getUTCMinutes();\n});\n\nexport default utcMinute;\nexport var utcMinutes = utcMinute.range;\n","import interval from \"./interval\";\nimport {durationHour} from \"./duration\";\n\nvar utcHour = interval(function(date) {\n date.setUTCMinutes(0, 0, 0);\n}, function(date, step) {\n date.setTime(+date + step * durationHour);\n}, function(start, end) {\n return (end - start) / durationHour;\n}, function(date) {\n return date.getUTCHours();\n});\n\nexport default utcHour;\nexport var utcHours = utcHour.range;\n","import interval from \"./interval\";\nimport {durationWeek} from \"./duration\";\n\nfunction utcWeekday(i) {\n return interval(function(date) {\n date.setUTCDate(date.getUTCDate() - (date.getUTCDay() + 7 - i) % 7);\n date.setUTCHours(0, 0, 0, 0);\n }, function(date, step) {\n date.setUTCDate(date.getUTCDate() + step * 7);\n }, function(start, end) {\n return (end - start) / durationWeek;\n });\n}\n\nexport var utcSunday = utcWeekday(0);\nexport var utcMonday = utcWeekday(1);\nexport var utcTuesday = utcWeekday(2);\nexport var utcWednesday = utcWeekday(3);\nexport var utcThursday = utcWeekday(4);\nexport var utcFriday = utcWeekday(5);\nexport var utcSaturday = utcWeekday(6);\n\nexport var utcSundays = utcSunday.range;\nexport var utcMondays = utcMonday.range;\nexport var utcTuesdays = utcTuesday.range;\nexport var utcWednesdays = utcWednesday.range;\nexport var utcThursdays = utcThursday.range;\nexport var utcFridays = utcFriday.range;\nexport var utcSaturdays = utcSaturday.range;\n","import interval from \"./interval\";\n\nvar utcYear = interval(function(date) {\n date.setUTCMonth(0, 1);\n date.setUTCHours(0, 0, 0, 0);\n}, function(date, step) {\n date.setUTCFullYear(date.getUTCFullYear() + step);\n}, function(start, end) {\n return end.getUTCFullYear() - start.getUTCFullYear();\n}, function(date) {\n return date.getUTCFullYear();\n});\n\n// An optimized implementation for this simple case.\nutcYear.every = function(k) {\n return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : interval(function(date) {\n date.setUTCFullYear(Math.floor(date.getUTCFullYear() / k) * k);\n date.setUTCMonth(0, 1);\n date.setUTCHours(0, 0, 0, 0);\n }, function(date, step) {\n date.setUTCFullYear(date.getUTCFullYear() + step * k);\n });\n};\n\nexport default utcYear;\nexport var utcYears = utcYear.range;\n","import interval from \"./interval\";\n\nvar utcMonth = interval(function(date) {\n date.setUTCDate(1);\n date.setUTCHours(0, 0, 0, 0);\n}, function(date, step) {\n date.setUTCMonth(date.getUTCMonth() + step);\n}, function(start, end) {\n return end.getUTCMonth() - start.getUTCMonth() + (end.getUTCFullYear() - start.getUTCFullYear()) * 12;\n}, function(date) {\n return date.getUTCMonth();\n});\n\nexport default utcMonth;\nexport var utcMonths = utcMonth.range;\n","import {\n timeDay,\n timeSunday,\n timeMonday,\n timeThursday,\n timeYear,\n utcDay,\n utcSunday,\n utcMonday,\n utcThursday,\n utcYear\n} from \"d3-time\";\n\nfunction localDate(d) {\n if (0 <= d.y && d.y < 100) {\n var date = new Date(-1, d.m, d.d, d.H, d.M, d.S, d.L);\n date.setFullYear(d.y);\n return date;\n }\n return new Date(d.y, d.m, d.d, d.H, d.M, d.S, d.L);\n}\n\nfunction utcDate(d) {\n if (0 <= d.y && d.y < 100) {\n var date = new Date(Date.UTC(-1, d.m, d.d, d.H, d.M, d.S, d.L));\n date.setUTCFullYear(d.y);\n return date;\n }\n return new Date(Date.UTC(d.y, d.m, d.d, d.H, d.M, d.S, d.L));\n}\n\nfunction newYear(y) {\n return {y: y, m: 0, d: 1, H: 0, M: 0, S: 0, L: 0};\n}\n\nexport default function formatLocale(locale) {\n var locale_dateTime = locale.dateTime,\n locale_date = locale.date,\n locale_time = locale.time,\n locale_periods = locale.periods,\n locale_weekdays = locale.days,\n locale_shortWeekdays = locale.shortDays,\n locale_months = locale.months,\n locale_shortMonths = locale.shortMonths;\n\n var periodRe = formatRe(locale_periods),\n periodLookup = formatLookup(locale_periods),\n weekdayRe = formatRe(locale_weekdays),\n weekdayLookup = formatLookup(locale_weekdays),\n shortWeekdayRe = formatRe(locale_shortWeekdays),\n shortWeekdayLookup = formatLookup(locale_shortWeekdays),\n monthRe = formatRe(locale_months),\n monthLookup = formatLookup(locale_months),\n shortMonthRe = formatRe(locale_shortMonths),\n shortMonthLookup = formatLookup(locale_shortMonths);\n\n var formats = {\n \"a\": formatShortWeekday,\n \"A\": formatWeekday,\n \"b\": formatShortMonth,\n \"B\": formatMonth,\n \"c\": null,\n \"d\": formatDayOfMonth,\n \"e\": formatDayOfMonth,\n \"f\": formatMicroseconds,\n \"H\": formatHour24,\n \"I\": formatHour12,\n \"j\": formatDayOfYear,\n \"L\": formatMilliseconds,\n \"m\": formatMonthNumber,\n \"M\": formatMinutes,\n \"p\": formatPeriod,\n \"Q\": formatUnixTimestamp,\n \"s\": formatUnixTimestampSeconds,\n \"S\": formatSeconds,\n \"u\": formatWeekdayNumberMonday,\n \"U\": formatWeekNumberSunday,\n \"V\": formatWeekNumberISO,\n \"w\": formatWeekdayNumberSunday,\n \"W\": formatWeekNumberMonday,\n \"x\": null,\n \"X\": null,\n \"y\": formatYear,\n \"Y\": formatFullYear,\n \"Z\": formatZone,\n \"%\": formatLiteralPercent\n };\n\n var utcFormats = {\n \"a\": formatUTCShortWeekday,\n \"A\": formatUTCWeekday,\n \"b\": formatUTCShortMonth,\n \"B\": formatUTCMonth,\n \"c\": null,\n \"d\": formatUTCDayOfMonth,\n \"e\": formatUTCDayOfMonth,\n \"f\": formatUTCMicroseconds,\n \"H\": formatUTCHour24,\n \"I\": formatUTCHour12,\n \"j\": formatUTCDayOfYear,\n \"L\": formatUTCMilliseconds,\n \"m\": formatUTCMonthNumber,\n \"M\": formatUTCMinutes,\n \"p\": formatUTCPeriod,\n \"Q\": formatUnixTimestamp,\n \"s\": formatUnixTimestampSeconds,\n \"S\": formatUTCSeconds,\n \"u\": formatUTCWeekdayNumberMonday,\n \"U\": formatUTCWeekNumberSunday,\n \"V\": formatUTCWeekNumberISO,\n \"w\": formatUTCWeekdayNumberSunday,\n \"W\": formatUTCWeekNumberMonday,\n \"x\": null,\n \"X\": null,\n \"y\": formatUTCYear,\n \"Y\": formatUTCFullYear,\n \"Z\": formatUTCZone,\n \"%\": formatLiteralPercent\n };\n\n var parses = {\n \"a\": parseShortWeekday,\n \"A\": parseWeekday,\n \"b\": parseShortMonth,\n \"B\": parseMonth,\n \"c\": parseLocaleDateTime,\n \"d\": parseDayOfMonth,\n \"e\": parseDayOfMonth,\n \"f\": parseMicroseconds,\n \"H\": parseHour24,\n \"I\": parseHour24,\n \"j\": parseDayOfYear,\n \"L\": parseMilliseconds,\n \"m\": parseMonthNumber,\n \"M\": parseMinutes,\n \"p\": parsePeriod,\n \"Q\": parseUnixTimestamp,\n \"s\": parseUnixTimestampSeconds,\n \"S\": parseSeconds,\n \"u\": parseWeekdayNumberMonday,\n \"U\": parseWeekNumberSunday,\n \"V\": parseWeekNumberISO,\n \"w\": parseWeekdayNumberSunday,\n \"W\": parseWeekNumberMonday,\n \"x\": parseLocaleDate,\n \"X\": parseLocaleTime,\n \"y\": parseYear,\n \"Y\": parseFullYear,\n \"Z\": parseZone,\n \"%\": parseLiteralPercent\n };\n\n // These recursive directive definitions must be deferred.\n formats.x = newFormat(locale_date, formats);\n formats.X = newFormat(locale_time, formats);\n formats.c = newFormat(locale_dateTime, formats);\n utcFormats.x = newFormat(locale_date, utcFormats);\n utcFormats.X = newFormat(locale_time, utcFormats);\n utcFormats.c = newFormat(locale_dateTime, utcFormats);\n\n function newFormat(specifier, formats) {\n return function(date) {\n var string = [],\n i = -1,\n j = 0,\n n = specifier.length,\n c,\n pad,\n format;\n\n if (!(date instanceof Date)) date = new Date(+date);\n\n while (++i < n) {\n if (specifier.charCodeAt(i) === 37) {\n string.push(specifier.slice(j, i));\n if ((pad = pads[c = specifier.charAt(++i)]) != null) c = specifier.charAt(++i);\n else pad = c === \"e\" ? \" \" : \"0\";\n if (format = formats[c]) c = format(date, pad);\n string.push(c);\n j = i + 1;\n }\n }\n\n string.push(specifier.slice(j, i));\n return string.join(\"\");\n };\n }\n\n function newParse(specifier, newDate) {\n return function(string) {\n var d = newYear(1900),\n i = parseSpecifier(d, specifier, string += \"\", 0),\n week, day;\n if (i != string.length) return null;\n\n // If a UNIX timestamp is specified, return it.\n if (\"Q\" in d) return new Date(d.Q);\n\n // The am-pm flag is 0 for AM, and 1 for PM.\n if (\"p\" in d) d.H = d.H % 12 + d.p * 12;\n\n // Convert day-of-week and week-of-year to day-of-year.\n if (\"V\" in d) {\n if (d.V < 1 || d.V > 53) return null;\n if (!(\"w\" in d)) d.w = 1;\n if (\"Z\" in d) {\n week = utcDate(newYear(d.y)), day = week.getUTCDay();\n week = day > 4 || day === 0 ? utcMonday.ceil(week) : utcMonday(week);\n week = utcDay.offset(week, (d.V - 1) * 7);\n d.y = week.getUTCFullYear();\n d.m = week.getUTCMonth();\n d.d = week.getUTCDate() + (d.w + 6) % 7;\n } else {\n week = newDate(newYear(d.y)), day = week.getDay();\n week = day > 4 || day === 0 ? timeMonday.ceil(week) : timeMonday(week);\n week = timeDay.offset(week, (d.V - 1) * 7);\n d.y = week.getFullYear();\n d.m = week.getMonth();\n d.d = week.getDate() + (d.w + 6) % 7;\n }\n } else if (\"W\" in d || \"U\" in d) {\n if (!(\"w\" in d)) d.w = \"u\" in d ? d.u % 7 : \"W\" in d ? 1 : 0;\n day = \"Z\" in d ? utcDate(newYear(d.y)).getUTCDay() : newDate(newYear(d.y)).getDay();\n d.m = 0;\n d.d = \"W\" in d ? (d.w + 6) % 7 + d.W * 7 - (day + 5) % 7 : d.w + d.U * 7 - (day + 6) % 7;\n }\n\n // If a time zone is specified, all fields are interpreted as UTC and then\n // offset according to the specified time zone.\n if (\"Z\" in d) {\n d.H += d.Z / 100 | 0;\n d.M += d.Z % 100;\n return utcDate(d);\n }\n\n // Otherwise, all fields are in local time.\n return newDate(d);\n };\n }\n\n function parseSpecifier(d, specifier, string, j) {\n var i = 0,\n n = specifier.length,\n m = string.length,\n c,\n parse;\n\n while (i < n) {\n if (j >= m) return -1;\n c = specifier.charCodeAt(i++);\n if (c === 37) {\n c = specifier.charAt(i++);\n parse = parses[c in pads ? specifier.charAt(i++) : c];\n if (!parse || ((j = parse(d, string, j)) < 0)) return -1;\n } else if (c != string.charCodeAt(j++)) {\n return -1;\n }\n }\n\n return j;\n }\n\n function parsePeriod(d, string, i) {\n var n = periodRe.exec(string.slice(i));\n return n ? (d.p = periodLookup[n[0].toLowerCase()], i + n[0].length) : -1;\n }\n\n function parseShortWeekday(d, string, i) {\n var n = shortWeekdayRe.exec(string.slice(i));\n return n ? (d.w = shortWeekdayLookup[n[0].toLowerCase()], i + n[0].length) : -1;\n }\n\n function parseWeekday(d, string, i) {\n var n = weekdayRe.exec(string.slice(i));\n return n ? (d.w = weekdayLookup[n[0].toLowerCase()], i + n[0].length) : -1;\n }\n\n function parseShortMonth(d, string, i) {\n var n = shortMonthRe.exec(string.slice(i));\n return n ? (d.m = shortMonthLookup[n[0].toLowerCase()], i + n[0].length) : -1;\n }\n\n function parseMonth(d, string, i) {\n var n = monthRe.exec(string.slice(i));\n return n ? (d.m = monthLookup[n[0].toLowerCase()], i + n[0].length) : -1;\n }\n\n function parseLocaleDateTime(d, string, i) {\n return parseSpecifier(d, locale_dateTime, string, i);\n }\n\n function parseLocaleDate(d, string, i) {\n return parseSpecifier(d, locale_date, string, i);\n }\n\n function parseLocaleTime(d, string, i) {\n return parseSpecifier(d, locale_time, string, i);\n }\n\n function formatShortWeekday(d) {\n return locale_shortWeekdays[d.getDay()];\n }\n\n function formatWeekday(d) {\n return locale_weekdays[d.getDay()];\n }\n\n function formatShortMonth(d) {\n return locale_shortMonths[d.getMonth()];\n }\n\n function formatMonth(d) {\n return locale_months[d.getMonth()];\n }\n\n function formatPeriod(d) {\n return locale_periods[+(d.getHours() >= 12)];\n }\n\n function formatUTCShortWeekday(d) {\n return locale_shortWeekdays[d.getUTCDay()];\n }\n\n function formatUTCWeekday(d) {\n return locale_weekdays[d.getUTCDay()];\n }\n\n function formatUTCShortMonth(d) {\n return locale_shortMonths[d.getUTCMonth()];\n }\n\n function formatUTCMonth(d) {\n return locale_months[d.getUTCMonth()];\n }\n\n function formatUTCPeriod(d) {\n return locale_periods[+(d.getUTCHours() >= 12)];\n }\n\n return {\n format: function(specifier) {\n var f = newFormat(specifier += \"\", formats);\n f.toString = function() { return specifier; };\n return f;\n },\n parse: function(specifier) {\n var p = newParse(specifier += \"\", localDate);\n p.toString = function() { return specifier; };\n return p;\n },\n utcFormat: function(specifier) {\n var f = newFormat(specifier += \"\", utcFormats);\n f.toString = function() { return specifier; };\n return f;\n },\n utcParse: function(specifier) {\n var p = newParse(specifier, utcDate);\n p.toString = function() { return specifier; };\n return p;\n }\n };\n}\n\nvar pads = {\"-\": \"\", \"_\": \" \", \"0\": \"0\"},\n numberRe = /^\\s*\\d+/, // note: ignores next directive\n percentRe = /^%/,\n requoteRe = /[\\\\^$*+?|[\\]().{}]/g;\n\nfunction pad(value, fill, width) {\n var sign = value < 0 ? \"-\" : \"\",\n string = (sign ? -value : value) + \"\",\n length = string.length;\n return sign + (length < width ? new Array(width - length + 1).join(fill) + string : string);\n}\n\nfunction requote(s) {\n return s.replace(requoteRe, \"\\\\$&\");\n}\n\nfunction formatRe(names) {\n return new RegExp(\"^(?:\" + names.map(requote).join(\"|\") + \")\", \"i\");\n}\n\nfunction formatLookup(names) {\n var map = {}, i = -1, n = names.length;\n while (++i < n) map[names[i].toLowerCase()] = i;\n return map;\n}\n\nfunction parseWeekdayNumberSunday(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 1));\n return n ? (d.w = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseWeekdayNumberMonday(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 1));\n return n ? (d.u = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseWeekNumberSunday(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.U = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseWeekNumberISO(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.V = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseWeekNumberMonday(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.W = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseFullYear(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 4));\n return n ? (d.y = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseYear(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.y = +n[0] + (+n[0] > 68 ? 1900 : 2000), i + n[0].length) : -1;\n}\n\nfunction parseZone(d, string, i) {\n var n = /^(Z)|([+-]\\d\\d)(?::?(\\d\\d))?/.exec(string.slice(i, i + 6));\n return n ? (d.Z = n[1] ? 0 : -(n[2] + (n[3] || \"00\")), i + n[0].length) : -1;\n}\n\nfunction parseMonthNumber(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.m = n[0] - 1, i + n[0].length) : -1;\n}\n\nfunction parseDayOfMonth(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.d = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseDayOfYear(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 3));\n return n ? (d.m = 0, d.d = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseHour24(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.H = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseMinutes(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.M = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseSeconds(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 2));\n return n ? (d.S = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseMilliseconds(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 3));\n return n ? (d.L = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseMicroseconds(d, string, i) {\n var n = numberRe.exec(string.slice(i, i + 6));\n return n ? (d.L = Math.floor(n[0] / 1000), i + n[0].length) : -1;\n}\n\nfunction parseLiteralPercent(d, string, i) {\n var n = percentRe.exec(string.slice(i, i + 1));\n return n ? i + n[0].length : -1;\n}\n\nfunction parseUnixTimestamp(d, string, i) {\n var n = numberRe.exec(string.slice(i));\n return n ? (d.Q = +n[0], i + n[0].length) : -1;\n}\n\nfunction parseUnixTimestampSeconds(d, string, i) {\n var n = numberRe.exec(string.slice(i));\n return n ? (d.Q = (+n[0]) * 1000, i + n[0].length) : -1;\n}\n\nfunction formatDayOfMonth(d, p) {\n return pad(d.getDate(), p, 2);\n}\n\nfunction formatHour24(d, p) {\n return pad(d.getHours(), p, 2);\n}\n\nfunction formatHour12(d, p) {\n return pad(d.getHours() % 12 || 12, p, 2);\n}\n\nfunction formatDayOfYear(d, p) {\n return pad(1 + timeDay.count(timeYear(d), d), p, 3);\n}\n\nfunction formatMilliseconds(d, p) {\n return pad(d.getMilliseconds(), p, 3);\n}\n\nfunction formatMicroseconds(d, p) {\n return formatMilliseconds(d, p) + \"000\";\n}\n\nfunction formatMonthNumber(d, p) {\n return pad(d.getMonth() + 1, p, 2);\n}\n\nfunction formatMinutes(d, p) {\n return pad(d.getMinutes(), p, 2);\n}\n\nfunction formatSeconds(d, p) {\n return pad(d.getSeconds(), p, 2);\n}\n\nfunction formatWeekdayNumberMonday(d) {\n var day = d.getDay();\n return day === 0 ? 7 : day;\n}\n\nfunction formatWeekNumberSunday(d, p) {\n return pad(timeSunday.count(timeYear(d), d), p, 2);\n}\n\nfunction formatWeekNumberISO(d, p) {\n var day = d.getDay();\n d = (day >= 4 || day === 0) ? timeThursday(d) : timeThursday.ceil(d);\n return pad(timeThursday.count(timeYear(d), d) + (timeYear(d).getDay() === 4), p, 2);\n}\n\nfunction formatWeekdayNumberSunday(d) {\n return d.getDay();\n}\n\nfunction formatWeekNumberMonday(d, p) {\n return pad(timeMonday.count(timeYear(d), d), p, 2);\n}\n\nfunction formatYear(d, p) {\n return pad(d.getFullYear() % 100, p, 2);\n}\n\nfunction formatFullYear(d, p) {\n return pad(d.getFullYear() % 10000, p, 4);\n}\n\nfunction formatZone(d) {\n var z = d.getTimezoneOffset();\n return (z > 0 ? \"-\" : (z *= -1, \"+\"))\n + pad(z / 60 | 0, \"0\", 2)\n + pad(z % 60, \"0\", 2);\n}\n\nfunction formatUTCDayOfMonth(d, p) {\n return pad(d.getUTCDate(), p, 2);\n}\n\nfunction formatUTCHour24(d, p) {\n return pad(d.getUTCHours(), p, 2);\n}\n\nfunction formatUTCHour12(d, p) {\n return pad(d.getUTCHours() % 12 || 12, p, 2);\n}\n\nfunction formatUTCDayOfYear(d, p) {\n return pad(1 + utcDay.count(utcYear(d), d), p, 3);\n}\n\nfunction formatUTCMilliseconds(d, p) {\n return pad(d.getUTCMilliseconds(), p, 3);\n}\n\nfunction formatUTCMicroseconds(d, p) {\n return formatUTCMilliseconds(d, p) + \"000\";\n}\n\nfunction formatUTCMonthNumber(d, p) {\n return pad(d.getUTCMonth() + 1, p, 2);\n}\n\nfunction formatUTCMinutes(d, p) {\n return pad(d.getUTCMinutes(), p, 2);\n}\n\nfunction formatUTCSeconds(d, p) {\n return pad(d.getUTCSeconds(), p, 2);\n}\n\nfunction formatUTCWeekdayNumberMonday(d) {\n var dow = d.getUTCDay();\n return dow === 0 ? 7 : dow;\n}\n\nfunction formatUTCWeekNumberSunday(d, p) {\n return pad(utcSunday.count(utcYear(d), d), p, 2);\n}\n\nfunction formatUTCWeekNumberISO(d, p) {\n var day = d.getUTCDay();\n d = (day >= 4 || day === 0) ? utcThursday(d) : utcThursday.ceil(d);\n return pad(utcThursday.count(utcYear(d), d) + (utcYear(d).getUTCDay() === 4), p, 2);\n}\n\nfunction formatUTCWeekdayNumberSunday(d) {\n return d.getUTCDay();\n}\n\nfunction formatUTCWeekNumberMonday(d, p) {\n return pad(utcMonday.count(utcYear(d), d), p, 2);\n}\n\nfunction formatUTCYear(d, p) {\n return pad(d.getUTCFullYear() % 100, p, 2);\n}\n\nfunction formatUTCFullYear(d, p) {\n return pad(d.getUTCFullYear() % 10000, p, 4);\n}\n\nfunction formatUTCZone() {\n return \"+0000\";\n}\n\nfunction formatLiteralPercent() {\n return \"%\";\n}\n\nfunction formatUnixTimestamp(d) {\n return +d;\n}\n\nfunction formatUnixTimestampSeconds(d) {\n return Math.floor(+d / 1000);\n}\n","import formatLocale from \"./locale\";\n\nvar locale;\nexport var timeFormat;\nexport var timeParse;\nexport var utcFormat;\nexport var utcParse;\n\ndefaultLocale({\n dateTime: \"%x, %X\",\n date: \"%-m/%-d/%Y\",\n time: \"%-I:%M:%S %p\",\n periods: [\"AM\", \"PM\"],\n days: [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"],\n shortDays: [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"],\n months: [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"],\n shortMonths: [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"]\n});\n\nexport default function defaultLocale(definition) {\n locale = formatLocale(definition);\n timeFormat = locale.format;\n timeParse = locale.parse;\n utcFormat = locale.utcFormat;\n utcParse = locale.utcParse;\n return locale;\n}\n","import {utcFormat} from \"./defaultLocale\";\n\nexport var isoSpecifier = \"%Y-%m-%dT%H:%M:%S.%LZ\";\n\nfunction formatIsoNative(date) {\n return date.toISOString();\n}\n\nvar formatIso = Date.prototype.toISOString\n ? formatIsoNative\n : utcFormat(isoSpecifier);\n\nexport default formatIso;\n","import {isoSpecifier} from \"./isoFormat\";\nimport {utcParse} from \"./defaultLocale\";\n\nfunction parseIsoNative(string) {\n var date = new Date(string);\n return isNaN(date) ? null : date;\n}\n\nvar parseIso = +new Date(\"2000-01-01T00:00:00.000Z\")\n ? parseIsoNative\n : utcParse(isoSpecifier);\n\nexport default parseIso;\n","import {bisector, tickStep} from \"d3-array\";\nimport {interpolateNumber as reinterpolate} from \"d3-interpolate\";\nimport {timeYear, timeMonth, timeWeek, timeDay, timeHour, timeMinute, timeSecond, timeMillisecond} from \"d3-time\";\nimport {timeFormat} from \"d3-time-format\";\nimport {map} from \"./array\";\nimport {default as continuous, copy, deinterpolateLinear as deinterpolate} from \"./continuous\";\nimport nice from \"./nice\";\n\nvar durationSecond = 1000,\n durationMinute = durationSecond * 60,\n durationHour = durationMinute * 60,\n durationDay = durationHour * 24,\n durationWeek = durationDay * 7,\n durationMonth = durationDay * 30,\n durationYear = durationDay * 365;\n\nfunction date(t) {\n return new Date(t);\n}\n\nfunction number(t) {\n return t instanceof Date ? +t : +new Date(+t);\n}\n\nexport function calendar(year, month, week, day, hour, minute, second, millisecond, format) {\n var scale = continuous(deinterpolate, reinterpolate),\n invert = scale.invert,\n domain = scale.domain;\n\n var formatMillisecond = format(\".%L\"),\n formatSecond = format(\":%S\"),\n formatMinute = format(\"%I:%M\"),\n formatHour = format(\"%I %p\"),\n formatDay = format(\"%a %d\"),\n formatWeek = format(\"%b %d\"),\n formatMonth = format(\"%B\"),\n formatYear = format(\"%Y\");\n\n var tickIntervals = [\n [second, 1, durationSecond],\n [second, 5, 5 * durationSecond],\n [second, 15, 15 * durationSecond],\n [second, 30, 30 * durationSecond],\n [minute, 1, durationMinute],\n [minute, 5, 5 * durationMinute],\n [minute, 15, 15 * durationMinute],\n [minute, 30, 30 * durationMinute],\n [ hour, 1, durationHour ],\n [ hour, 3, 3 * durationHour ],\n [ hour, 6, 6 * durationHour ],\n [ hour, 12, 12 * durationHour ],\n [ day, 1, durationDay ],\n [ day, 2, 2 * durationDay ],\n [ week, 1, durationWeek ],\n [ month, 1, durationMonth ],\n [ month, 3, 3 * durationMonth ],\n [ year, 1, durationYear ]\n ];\n\n function tickFormat(date) {\n return (second(date) < date ? formatMillisecond\n : minute(date) < date ? formatSecond\n : hour(date) < date ? formatMinute\n : day(date) < date ? formatHour\n : month(date) < date ? (week(date) < date ? formatDay : formatWeek)\n : year(date) < date ? formatMonth\n : formatYear)(date);\n }\n\n function tickInterval(interval, start, stop, step) {\n if (interval == null) interval = 10;\n\n // If a desired tick count is specified, pick a reasonable tick interval\n // based on the extent of the domain and a rough estimate of tick size.\n // Otherwise, assume interval is already a time interval and use it.\n if (typeof interval === \"number\") {\n var target = Math.abs(stop - start) / interval,\n i = bisector(function(i) { return i[2]; }).right(tickIntervals, target);\n if (i === tickIntervals.length) {\n step = tickStep(start / durationYear, stop / durationYear, interval);\n interval = year;\n } else if (i) {\n i = tickIntervals[target / tickIntervals[i - 1][2] < tickIntervals[i][2] / target ? i - 1 : i];\n step = i[1];\n interval = i[0];\n } else {\n step = Math.max(tickStep(start, stop, interval), 1);\n interval = millisecond;\n }\n }\n\n return step == null ? interval : interval.every(step);\n }\n\n scale.invert = function(y) {\n return new Date(invert(y));\n };\n\n scale.domain = function(_) {\n return arguments.length ? domain(map.call(_, number)) : domain().map(date);\n };\n\n scale.ticks = function(interval, step) {\n var d = domain(),\n t0 = d[0],\n t1 = d[d.length - 1],\n r = t1 < t0,\n t;\n if (r) t = t0, t0 = t1, t1 = t;\n t = tickInterval(interval, t0, t1, step);\n t = t ? t.range(t0, t1 + 1) : []; // inclusive stop\n return r ? t.reverse() : t;\n };\n\n scale.tickFormat = function(count, specifier) {\n return specifier == null ? tickFormat : format(specifier);\n };\n\n scale.nice = function(interval, step) {\n var d = domain();\n return (interval = tickInterval(interval, d[0], d[d.length - 1], step))\n ? domain(nice(d, interval))\n : scale;\n };\n\n scale.copy = function() {\n return copy(scale, calendar(year, month, week, day, hour, minute, second, millisecond, format));\n };\n\n return scale;\n}\n\nexport default function() {\n return calendar(timeYear, timeMonth, timeWeek, timeDay, timeHour, timeMinute, timeSecond, timeMillisecond, timeFormat).domain([new Date(2000, 0, 1), new Date(2000, 0, 2)]);\n}\n","export default function(s) {\n return s.match(/.{6}/g).map(function(x) {\n return \"#\" + x;\n });\n}\n","import colors from \"./colors\";\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 naturalSort(e,a){var r,t,n=/(^([+\\-]?\\d+(?:\\.\\d*)?(?:[eE][+\\-]?\\d+)?(?=\\D|\\s|$))|^0x[\\da-fA-F]+$|\\d+)/g,l=/^\\s+|\\s+$/g,i=/\\s+/g,s=/^0x[0-9a-f]+$/i,c=/^0/,p=function(e){return(naturalSort.insensitive&&(\"\"+e).toLowerCase()||\"\"+e).replace(l,\"\")},u=p(e),d=p(a),f=u.replace(n,\"\\0$1\\0\").replace(/\\0$/,\"\").replace(/^\\0/,\"\").split(\"\\0\"),o=d.replace(n,\"\\0$1\\0\").replace(/\\0$/,\"\").replace(/^\\0/,\"\").split(\"\\0\"),h=parseInt(u.match(s),16)||1!==f.length&&Date.parse(u),w=parseInt(d.match(s),16)||h&&d.match(/(^([\\w ]+,?[\\w ]+)?[\\w ]+,?[\\w ]+\\d+:\\d+(:\\d+)?[\\w ]?|^\\d{1,4}[\\/\\-]\\d{1,4}[\\/\\-]\\d{1,4}|^\\w+, \\w+ \\d+, \\d{4})/)&&Date.parse(d)||null,$=function(e,a){return(!e.match(c)||1==a)&&parseFloat(e)||e.replace(i,\" \").replace(l,\"\")||0};if(w){if(hw)return 1}for(var m=0,g=f.length,N=o.length,x=Math.max(g,N);mt)return 1}}","import {cubehelix} from \"d3-color\";\nimport {interpolateCubehelixLong} from \"d3-interpolate\";\n\nexport default interpolateCubehelixLong(cubehelix(300, 0.5, 0.0), cubehelix(-240, 0.5, 1.0));\n","import {cubehelix} from \"d3-color\";\nimport {interpolateCubehelixLong} from \"d3-interpolate\";\n\nexport var warm = interpolateCubehelixLong(cubehelix(-100, 0.75, 0.35), cubehelix(80, 1.50, 0.8));\n\nexport var cool = interpolateCubehelixLong(cubehelix(260, 0.75, 0.35), cubehelix(80, 1.50, 0.8));\n\nvar rainbow = cubehelix();\n\nexport default function(t) {\n if (t < 0 || t > 1) t -= Math.floor(t);\n var ts = Math.abs(t - 0.5);\n rainbow.h = 360 * t - 100;\n rainbow.s = 1.5 - 1.5 * ts;\n rainbow.l = 0.8 - 0.9 * ts;\n return rainbow + \"\";\n}\n","var version = '1.4.1';\nexport default version;","function configurePloidy(ideo) {\n if (!ideo.config.ploidy) ideo.config.ploidy = 1;\n\n if (ideo.config.ploidy > 1) {\n ideo.sexChromosomes = {};\n if (!ideo.config.sex) {\n // Default to 'male' per human, mouse reference genomes.\n // TODO: The default sex value should probably be the heterogametic sex,\n // i.e. whichever sex has allosomes that differ in morphology.\n // In mammals and most insects that is the male.\n // However, in birds and reptiles, that is female.\n ideo.config.sex = 'male';\n }\n if (ideo.config.ploidy === 2 && !ideo.config.ancestors) {\n ideo.config.ancestors = {M: '#ffb6c1', P: '#add8e6'};\n ideo.config.ploidyDesc = 'MP';\n }\n }\n}\n\nfunction configureHeight(ideo) {\n var container, rect, chrHeight;\n\n if (!ideo.config.chrHeight) {\n container = ideo.config.container;\n rect = document.querySelector(container).getBoundingClientRect();\n\n if (ideo.config.orientation === 'vertical') {\n chrHeight = rect.height;\n } else {\n chrHeight = rect.width;\n }\n\n if (container === 'body' || chrHeight === 0) chrHeight = 400;\n ideo.config.chrHeight = chrHeight;\n }\n}\n\nfunction configureWidth(ideo) {\n var chrWidth, chrHeight;\n\n if (!ideo.config.chrWidth) {\n chrWidth = 10;\n chrHeight = ideo.config.chrHeight;\n\n if (chrHeight < 900 && chrHeight > 500) {\n chrWidth = Math.round(chrHeight / 40);\n } else if (chrHeight >= 900) {\n chrWidth = Math.round(chrHeight / 45);\n }\n ideo.config.chrWidth = chrWidth;\n }\n}\n\nfunction configureMargin(ideo) {\n if (!ideo.config.chrMargin) {\n if (ideo.config.ploidy === 1) {\n ideo.config.chrMargin = 10;\n } else {\n // Defaults polyploid chromosomes to relatively small interchromatid gap\n ideo.config.chrMargin = Math.round(ideo.config.chrWidth / 4);\n }\n }\n if (ideo.config.showBandLabels) ideo.config.chrMargin += 20;\n}\n\nfunction configureBump(ideo) {\n ideo.bump = Math.round(ideo.config.chrHeight / 125);\n ideo.adjustedBump = false;\n if (ideo.config.chrHeight < 200) {\n ideo.adjustedBump = true;\n ideo.bump = 4;\n }\n}\n\nfunction configureSingleChromosome(config, ideo) {\n if (config.chromosome) {\n ideo.config.chromosomes = [config.chromosome];\n if ('showBandLabels' in config === false) {\n ideo.config.showBandLabels = true;\n }\n if ('rotatable' in config === false) ideo.config.rotatable = false;\n }\n}\n\nfunction configureOrganisms(ideo) {\n ideo.organisms = {\n 9606: {\n commonName: 'Human',\n scientificName: 'Homo sapiens',\n scientificNameAbbr: 'H. sapiens',\n assemblies: {\n default: 'GCF_000001405.26', // GRCh38\n GRCh38: 'GCF_000001405.26',\n GRCh37: 'GCF_000001405.13'\n }\n },\n 10090: {\n commonName: 'Mouse',\n scientificName: 'Mus musculus',\n scientificNameAbbr: 'M. musculus',\n assemblies: {\n default: 'GCF_000001635.20'\n }\n },\n 4641: {\n commonName: 'banana',\n scientificName: 'Musa acuminata',\n scientificNameAbbr: 'M. acuminata',\n assemblies: {\n default: 'mock'\n }\n }\n }\n}\n\nfunction configureCallbacks(config, ideo) {\n if (config.onLoad) ideo.onLoadCallback = config.onLoad;\n if (config.onLoadAnnots) ideo.onLoadAnnotsCallback = config.onLoadAnnots;\n if (config.onDrawAnnots) ideo.onDrawAnnotsCallback = config.onDrawAnnots;\n if (config.onBrushMove) ideo.onBrushMoveCallback = config.onBrushMove;\n if (config.onDidRotate) ideo.onDidRotateCallback = config.onDidRotate;\n if (config.onWillShowAnnotTooltip) {\n ideo.onWillShowAnnotTooltipCallback = config.onWillShowAnnotTooltip;\n }\n}\n\nfunction configureMiscellaneous(ideo) {\n ideo.chromosomesArray = [];\n ideo.coordinateSystem = 'iscn';\n ideo.maxLength = {bp: 0, iscn: 0};\n ideo.chromosomes = {};\n ideo.numChromosomes = 0;\n if (!ideo.config.debug) ideo.config.debug = false;\n if (!ideo.config.dataDir) ideo.config.dataDir = ideo.getDataDir();\n if (!ideo.config.container) ideo.config.container = 'body';\n ideo.selector = ideo.config.container + ' #_ideogram';\n if (!ideo.config.resolution) ideo.config.resolution = '';\n if (!ideo.config.orientation) ideo.config.orientation = 'vertical';\n if (!ideo.config.brush) ideo.config.brush = null;\n if (!ideo.config.rows) ideo.config.rows = 1;\n if ('showChromosomeLabels' in ideo.config === false) {\n ideo.config.showChromosomeLabels = true;\n }\n if (!ideo.config.showNonNuclearChromosomes) {\n ideo.config.showNonNuclearChromosomes = false;\n }\n}\n\nfunction configureBands(ideo) {\n if (!ideo.config.showBandLabels) ideo.config.showBandLabels = false;\n\n if ('showFullyBanded' in ideo.config) {\n ideo.config.showFullyBanded = ideo.config.showFullyBanded;\n } else {\n ideo.config.showFullyBanded = true;\n }\n\n ideo.bandsToShow = [];\n ideo.bandData = {};\n}\n\n/**\n * High-level helper method for Ideogram constructor.\n *\n * @param config Configuration object. Enables setting Ideogram properties.\n */\nfunction configure(config) {\n \n // Clone the config object, to allow multiple instantiations\n // without picking up prior ideogram's settings\n this.config = JSON.parse(JSON.stringify(config));\n\n configureMiscellaneous(this);\n configurePloidy(this);\n configureBands(this);\n configureHeight(this);\n configureWidth(this);\n configureMargin(this);\n configureCallbacks(config, this);\n configureOrganisms(this);\n configureBump(this);\n configureSingleChromosome(config, this);\n this.initAnnotSettings();\n this.config.chrMargin += this.config.chrWidth;\n if (this.config.annotationsLayout === 'heatmap') {\n this.config.chrMargin += this.config.annotTracksHeight;\n } else {\n this.config.chrMargin += this.config.annotTracksHeight * 2;\n }\n this.init();\n}\n\nexport {configure}","import * as d3selection from 'd3-selection';\nimport {Object} from '../lib';\n\nvar d3 = Object.assign({}, d3selection);\n\nfunction processLabels(config, ideo) {\n var i, chrID, t0C, t1C;\n\n if (config.showBandLabels === true) {\n t0C = new Date().getTime();\n ideo.hideUnshownBandLabels();\n t1C = new Date().getTime();\n if (config.debug) {\n console.log('Time in showing bands: ' + (t1C - t0C) + ' ms');\n }\n\n if (config.orientation === 'vertical') {\n for (i = 0; i < ideo.chromosomesArray.length; i++) {\n chrID = '#' + ideo.chromosomesArray[i].id;\n ideo.rotateChromosomeLabels(d3.select(chrID), i);\n }\n }\n }\n\n if (config.showChromosomeLabels === true) {\n ideo.drawChromosomeLabels(ideo.chromosomes);\n }\n}\n\nfunction processAnnots(ideo) {\n if (typeof ideo.timeout !== 'undefined') window.clearTimeout(ideo.timeout);\n\n ideo.rawAnnots = ideo.setOriginalTrackIndexes(ideo.rawAnnots);\n\n if (ideo.config.annotationsDisplayedTracks) {\n ideo.annots =\n ideo.updateDisplayedTracks(ideo.config.annotationsDisplayedTracks);\n } else {\n ideo.annots = ideo.processAnnotData(ideo.rawAnnots);\n if (ideo.config.filterable) ideo.initCrossFilter();\n ideo.drawProcessedAnnots(ideo.annots);\n }\n}\n\n/**\n * Waits for potentially large annotation dataset\n * to be received by the client, then triggers annotation processing.\n */\nfunction waitForAndProcessAnnots(ideo) {\n if (ideo.rawAnnots) {\n processAnnots(ideo);\n } else {\n (function checkAnnotData() {\n ideo.timeout = setTimeout(function() {\n if (!ideo.rawAnnots) {\n checkAnnotData();\n } else {\n processAnnots(ideo);\n }\n }, 50);\n })();\n }\n}\n\nfunction reportDebugTimings(config, t0, t0A) {\n\n var t1A = new Date().getTime();\n if (config.debug) {\n console.log('Time in drawChromosome: ' + (t1A - t0A) + ' ms');\n }\n\n var t1 = new Date().getTime();\n if (config.debug) {\n console.log('Time constructing ideogram: ' + (t1 - t0) + ' ms');\n }\n}\n\n/**\n * Completes high-level initialization.\n * Draws chromosomes and band labels, rotating as needed;\n * processes and draws annotations;\n * creates brush, emits notification of load completion, etc.\n */\nfunction finishInit(bandsArray, t0) {\n var t0A = new Date().getTime(),\n ideo = this,\n config = ideo.config;\n\n ideo.initDrawChromosomes(bandsArray);\n\n if (config.annotationsPath) waitForAndProcessAnnots(ideo);\n\n processLabels(config, ideo);\n\n if (config.brush) ideo.createBrush(config.brush);\n if (config.annotations) ideo.drawAnnots(config.annotations);\n\n reportDebugTimings(config, t0, t0A);\n\n ideo.setOverflowScroll();\n\n if (ideo.onLoadCallback) ideo.onLoadCallback();\n}\n\nexport {finishInit}","export class Ploidy {\n\n constructor(config) {\n this._config = config;\n this._description = this._normalize(this._config.ploidyDesc);\n }\n\n // Get number of chromosomes in a chromosome set\n getChromosomesNumber(setIndex) {\n if (this._config.ploidyDesc) {\n var chrSetCode = this._config.ploidyDesc[setIndex];\n if (chrSetCode instanceof Object) {\n return Object.keys(chrSetCode)[0].length;\n } else {\n return chrSetCode.length;\n }\n } else {\n return this._config.ploidy || 1;\n }\n }\n\n // Normalize use defined description\n _normalize(description) {\n var key, descValue,\n normalized = [];\n\n if (!description) return description;\n\n // Loop through description and normalize\n for (key in description) {\n descValue = description[key];\n if (typeof descValue === 'string') {\n if (this._config.orientation === 'vertical') {\n descValue = descValue.split('').reverse();\n }\n normalized.push({\n ancestors: descValue,\n existence: this._getexistenceArray(descValue.length)\n });\n } else {\n normalized.push({\n ancestors: Object.keys(descValue)[0],\n existence: descValue[Object.keys(descValue)[0]]\n });\n }\n }\n\n return normalized;\n }\n\n // Get array filled by '11' elements\n _getexistenceArray(length) {\n var array = [];\n\n for (var i = 0; i < length; i++) {\n array.push('11');\n }\n\n return array;\n }\n\n getSetSize(chrSetIndex) {\n if (this._description) {\n return this._description[chrSetIndex].ancestors.length;\n } else {\n return 1;\n }\n }\n\n // Get ancestor letter\n getAncestor(chrSetIndex, chrIndex) {\n if (this._description) {\n return this._description[chrSetIndex].ancestors[chrIndex];\n } else {\n return '';\n }\n }\n\n // Check if chromosome's arm should be rendered.\n // If no description was provided, method returns true and\n // something another depending on user provided description.\n exists(chrSetIndex, chrIndex, armIndex) {\n if (this._description) {\n var desc =\n this._description[chrSetIndex].existence[chrIndex][armIndex];\n return Number(desc) > 0;\n } else {\n return true;\n }\n }\n\n}\n","import * as d3selection from 'd3-selection';\n\nimport {Object} from './../lib';\n\nvar d3 = Object.assign({}, d3selection);\n\n/**\n * Chromosome's view utility class\n */\nexport class ChromosomeUtil {\n\n constructor(node) {\n this._node = node;\n }\n\n getLabel() {\n var label =\n d3\n .select(this._node.parentNode)\n .select('text.chrLabel')\n .text();\n return label;\n }\n\n /**\n * Get chromosome set label\n */\n getSetLabel() {\n var setLabel =\n d3\n .select(this._node.parentNode)\n .select('text.chrSetLabel')\n .text();\n return setLabel;\n }\n}\n","import * as d3selection from 'd3-selection';\n\nimport {ChromosomeUtil} from './../views/chromosome-util';\nimport {Object} from './../lib';\n\nvar d3 = Object.assign({}, d3selection);\n\nclass Layout {\n\n constructor(config, ideo) {\n this._config = config;\n this._ideo = ideo;\n this._ploidy = this._ideo._ploidy;\n this._translate = undefined;\n\n if ('chrSetMargin' in config) {\n this.chrSetMargin = config.chrSetMargin;\n } else {\n var chrMargin = this._config.chrMargin;\n this.chrSetMargin = (this._config.ploidy > 1 ? chrMargin : 0);\n }\n\n // Chromosome band's size.\n this._tickSize = 8;\n\n // Chromosome rotation state.\n this._isRotated = false;\n }\n\n // Get chart left margin\n _getLeftMargin() {\n return this.margin.left;\n }\n\n // Get rotated chromosome y scale\n _getYScale() {\n // 20 is width of rotated chromosome.\n return 20 / this._config.chrWidth;\n }\n\n // Get chromosome labels\n getChromosomeLabels(chrElement) {\n var util = new ChromosomeUtil(chrElement),\n labels = [];\n\n if (this._ideo.config.ploidy > 1) {\n labels.push(util.getSetLabel());\n }\n labels.push(util.getLabel());\n\n return labels.filter(function(d) {\n return d.length > 0;\n });\n }\n\n getChromosomeBandLabelTranslate(band) {\n var x, y, translate,\n ideo = this._ideo,\n tickSize = this._tickSize,\n orientation = ideo.config.orientation;\n\n if (orientation === 'vertical') {\n x = tickSize;\n y = ideo.round(2 + band.px.start + band.px.width/2);\n translate = \"rotate(-90)translate(\" + x + \",\" + y + \")\";\n } else if (orientation === 'horizontal') {\n x = ideo.round(-tickSize + band.px.start + band.px.width / 2);\n y = -10;\n translate = 'translate(' + x + ',' + y + ')';\n }\n\n return {\n x: x,\n y: y,\n translate: translate\n };\n }\n\n didRotate(chrIndex, chrElement) {\n var ideo, taxid, chrName, bands, chrModel, oldWidth,\n chrSetElement, transform, scale, scaleRE;\n\n ideo = this._ideo;\n taxid = ideo.config.taxid;\n chrName = chrElement.id.split('-')[0].replace('chr', '');\n chrModel = ideo.chromosomes[taxid][chrName];\n bands = chrModel.bands;\n\n chrSetElement = d3.select(chrElement.parentNode);\n transform = chrSetElement.attr('transform');\n scaleRE = /scale\\(.*\\)/;\n scale = scaleRE.exec(transform);\n transform = transform.replace(scale, '');\n chrSetElement.attr('transform', transform);\n\n oldWidth = chrModel.width;\n\n chrModel = ideo.getChromosomeModel(bands, chrName, taxid, chrIndex);\n\n chrModel.oldWidth = oldWidth;\n\n ideo.chromosomes[taxid][chrName] = chrModel;\n ideo.drawChromosome(chrModel);\n\n ideo.handleRotateOnClick();\n\n if (ideo.rawAnnots) {\n if (ideo.displayedTrackIndexes) {\n ideo.updateDisplayedTracks(ideo.displayedTrackIndexes);\n } else {\n ideo.annots = ideo.processAnnotData(ideo.rawAnnots);\n ideo.drawProcessedAnnots(ideo.annots);\n\n if (ideo.config.filterable) {\n ideo.initCrossFilter();\n }\n }\n }\n\n if (ideo.config.showBandLabels === true) {\n ideo.drawBandLabels(ideo.chromosomes);\n ideo.hideUnshownBandLabels();\n }\n\n if (ideo.onDidRotateCallback) {\n ideo.onDidRotateCallback(chrModel);\n }\n }\n\n rotate(chrSetIndex, chrIndex, chrElement) {\n var ideo, otherChrs, ideoBounds, labelSelectors;\n ideo = this._ideo;\n\n labelSelectors = (\n ideo.selector + ' .chrSetLabel, ' + ideo.selector + ' .chrLabel'\n );\n\n ideoBounds = document.querySelector(ideo.selector).getBoundingClientRect();\n\n // Find chromosomes which should be hidden\n otherChrs = d3.selectAll(ideo.selector + ' g.chromosome')\n .filter(function() {return this !== chrElement;});\n\n if (this._isRotated) {\n\n this._isRotated = false;\n\n ideo.config.chrHeight = ideo.config.chrHeightOriginal;\n ideo.config.chrWidth = ideo.config.chrWidthOriginal;\n ideo.config.annotationHeight = ideo.config.annotationHeightOriginal;\n\n // Rotate chromosome back\n this.rotateBack(chrSetIndex, chrIndex, chrElement, function() {\n // Show all other chromosomes and chromosome labels\n otherChrs.style('display', null);\n d3.selectAll(labelSelectors).style('display', null);\n ideo._layout.didRotate(chrIndex, chrElement);\n });\n\n } else {\n\n this._isRotated = true;\n\n // Hide all other chromosomes and chromosome labels\n otherChrs.style('display', 'none');\n d3.selectAll(labelSelectors).style('display', 'none');\n\n // Rotate chromosome\n this.rotateForward(chrSetIndex, chrIndex, chrElement, function() {\n\n var chrHeight, elementLength, windowLength;\n\n ideo.config.chrHeightOriginal = ideo.config.chrHeight;\n ideo.config.chrWidthOriginal = ideo.config.chrWidth;\n ideo.config.annotationHeightOriginal = ideo.config.annotationHeight;\n\n if (ideo._layout._class === 'VerticalLayout') {\n elementLength = ideoBounds.width;\n windowLength = window.innerWidth;\n } else {\n elementLength = ideoBounds.height - 10;\n windowLength = window.innerHeight - 10;\n }\n\n // Set chromosome height to window length or ideogram element length,\n // whichever is smaller. This keeps whole chromosome viewable, while\n // also ensuring the height doesn't exceed what the user specified.\n chrHeight = (windowLength < elementLength ? windowLength : elementLength);\n chrHeight -= ideo.config.chrMargin * 2;\n ideo.config.chrHeight = chrHeight;\n\n // Account for chromosome label\n // TODO: Make this dynamic, not hard-coded\n ideo.config.chrWidth *= 2.3;\n\n ideo.config.annotationHeight *= 1.7;\n\n ideo._layout.didRotate(chrIndex, chrElement);\n });\n }\n }\n\n getChromosomeLabelClass() {\n if (this._config.ploidy === 1) {\n return 'chrLabel';\n } else {\n return 'chrSetLabel';\n }\n }\n\n _getAdditionalOffset() {\n return (\n (this._config.annotationHeight || 0) * (this._config.annotationsNumTracks || 1)\n );\n }\n\n _getChromosomeSetSize(chrSetIndex) {\n // Get last chromosome set size.\n var setSize = this._ploidy.getSetSize(chrSetIndex);\n\n // Increase offset by last chromosome set size\n return (\n setSize * this._config.chrWidth * 2 + (this.chrSetMargin)\n );\n }\n\n // Get chromosome set label anchor property\n getChromosomeSetLabelAnchor() {\n return 'middle';\n }\n\n // Get chromosome label y position.\n getChromosomeLabelYPosition() {\n return -5.5;\n }\n\n getChromosomeSetLabelYPosition(chrIndex) {\n if (this._config.ploidy === 1) {\n return this.getChromosomeLabelYPosition(chrIndex);\n } else {\n return -2 * this._config.chrWidth;\n }\n }\n\n}\n\nexport default Layout","/**\n* @fileoverview Vertical layout class\n* Ideogram instances with vertical layout are oriented with each chromosome\n* starting at top and ending at bottom, and aligned as columns.\n*/\n\n\nimport * as d3selection from 'd3-selection';\n\nimport Layout from './layout';\nimport {Object} from './../lib';\n\nvar d3 = Object.assign({}, d3selection);\n\nclass VerticalLayout extends Layout {\n\n constructor(config, ideo) {\n super(config, ideo);\n this._class = 'VerticalLayout';\n // Layout margins\n this.margin = {\n top: 30,\n left: 15\n };\n }\n\n rotateForward(setIndex, chrIndex, chrElement, callback) {\n\n var self = this;\n\n var xOffset = 20;\n\n var scale = this.getChromosomeScale(chrElement);\n\n var transform =\n 'translate(' + xOffset + ', 25) ' + scale;\n\n d3.select(chrElement.parentNode)\n .transition()\n .attr('transform', transform)\n .on('end', callback);\n\n // Append new chromosome labels\n var labels = this.getChromosomeLabels(chrElement);\n var y = (xOffset + self._config.chrWidth) * 1.3;\n d3.select(this._ideo.getSvg())\n .append('g')\n .attr('class', 'tmp')\n .selectAll('text')\n .data(labels)\n .enter()\n .append('text')\n .attr('class', function(d, i) {\n return i === 0 && labels.length === 2 ? 'chrSetLabel' : null;\n })\n .attr('x', 0)\n .attr('y', y).style('opacity', 0)\n .text(String)\n .transition()\n .style('opacity', 1);\n\n this._ideo.config.orientation = 'horizontal';\n }\n\n rotateBack(setIndex, chrIndex, chrElement, callback) {\n\n var scale = this.getChromosomeScaleBack(chrElement);\n var translate = this.getChromosomeSetTranslate(setIndex);\n\n d3.select(chrElement.parentNode)\n .transition()\n .attr('transform', translate + ' ' + scale)\n .on('end', callback);\n\n d3.selectAll(this._ideo.selector + ' g.tmp')\n .style('opacity', 0)\n .remove();\n\n this._ideo.config.orientation = 'vertical';\n }\n\n getHeight() {\n return this._config.chrHeight + this.margin.top * 1.5;\n }\n\n getWidth() {\n return '97%';\n }\n\n getChromosomeBandTickY1() {\n return 2;\n }\n\n getChromosomeBandTickY2() {\n return 10;\n }\n\n getChromosomeSetLabelTranslate() {\n return 'rotate(-90)';\n }\n\n getChromosomeBandLabelAnchor() {\n return null;\n }\n\n getChromosomeScale(chrElement) {\n var ideoBox, chrBox, scaleX, scaleY;\n\n ideoBox = d3.select(this._ideo.selector).node().getBoundingClientRect();\n chrBox = chrElement.getBoundingClientRect();\n\n scaleX = (ideoBox.width / chrBox.height) * 0.97;\n scaleY = this._getYScale();\n\n return 'scale(' + scaleX + ', ' + scaleY + ')';\n }\n\n getChromosomeScaleBack(chrElement) {\n var scale, scaleX, scaleY, chrName, chrModel, taxid, ideo, config;\n\n ideo = this._ideo;\n config = ideo.config;\n taxid = config.taxid;\n\n chrName = chrElement.id.split('-')[0].replace('chr', '');\n chrModel = this._ideo.chromosomes[taxid][chrName];\n scaleX = (chrModel.oldWidth/(config.chrHeight*3)) * 0.97;\n scaleY = 1/this._getYScale();\n scale = 'scale(' + scaleX + ', ' + scaleY + ')';\n return scale;\n }\n\n getChromosomeSetTranslate(setIndex) {\n var marginTop = this.margin.top;\n var chromosomeSetYTranslate = this.getChromosomeSetYTranslate(setIndex);\n return (\n 'rotate(90) ' +\n 'translate(' + marginTop + ', -' + chromosomeSetYTranslate + ')'\n );\n }\n\n getChromosomeSetYTranslate(setIndex) {\n // Get additional padding caused by annotation/histogram tracks\n var pad = this._getAdditionalOffset(),\n margin = this._config.chrMargin,\n width = this._config.chrWidth,\n translate;\n\n // If no detailed description provided just use one formula for all cases\n if (!this._config.ploidyDesc) {\n // TODO:\n // This part of code contains a lot magic numbers and if\n // statements for exactly corresponing to original ideogram examples.\n // But all this stuff should be removed. Calculation of translate\n // should be a simple formula applied for all cases listed below.\n // Now they are diffirent because of Layout:_getAdditionalOffset do\n // not meet for cases when no annotation, when annotation exists and\n // when histogram used\n\n if (this._config.annotationsLayout === 'histogram') {\n return margin / 2 + setIndex * (margin + width + 2) + pad * 2 + 1;\n } else {\n translate = width + setIndex * (margin + width) + pad * 2;\n if (pad > 0) {\n return translate;\n } else {\n return translate + 4 + (2 * setIndex);\n }\n }\n }\n\n // If detailed description provided start to calculate offsets\n // for each chromosome set separately. This should be done only once\n if (!this._translate) {\n // First offset equals to zero\n this._translate = [this._ploidy.getSetSize(0) * width * 2];\n var prevTranslate;\n // Loop through description set\n for (var i = 1; i < this._config.ploidyDesc.length; i++) {\n prevTranslate = this._translate[i - 1];\n this._translate[i] = prevTranslate + this._getChromosomeSetSize(i - 1);\n }\n }\n\n return this._translate[setIndex];\n }\n\n getChromosomeSetLabelXPosition() {\n return (this._config.chrWidth * this._config.ploidy) / -2;\n }\n\n getChromosomeLabelXPosition() {\n return this._config.chrWidth / -2;\n }\n}\n\nexport default VerticalLayout","/**\n* @fileoverview Horizontal layout class\n* Ideogram instances with horizontal layout are oriented with each chromosome\n* starting at left and ending at right, and aligned as rows.\n*/\n\nimport * as d3selection from 'd3-selection';\n\nimport Layout from './layout';\nimport {Object} from './../lib';\n\nvar d3 = Object.assign({}, d3selection);\n\nclass HorizontalLayout extends Layout {\n\n constructor(config, ideo) {\n super(config, ideo);\n this._class = 'HorizontalLayout';\n this.margin = {\n left: 20,\n top: 30\n };\n }\n\n _getLeftMargin() {\n var margin = Layout.prototype._getLeftMargin.call(this);\n if (this._config.ploidy > 1) {\n margin *= 1.8;\n }\n\n return margin;\n }\n\n rotateForward(setIndex, chrIndex, chrElement, callback) {\n\n var xOffset, yOffset, transform, labels;\n\n xOffset = 30;\n\n yOffset = xOffset + 7.5;\n\n transform = (\n 'rotate(90) ' +\n 'translate(' + xOffset + ', -' + yOffset + ') '\n );\n\n d3.select(chrElement.parentNode)\n .transition()\n .attr(\"transform\", transform)\n .on('end', callback);\n\n // Append new chromosome labels\n labels = this.getChromosomeLabels(chrElement);\n d3.select(this._ideo.getSvg())\n .append('g')\n .attr('class', 'tmp')\n .selectAll('text')\n .data(labels)\n .enter()\n .append('text')\n .attr('class', function(d, i) {\n return i === 0 && labels.length === 2 ? 'chrSetLabel' : null;\n })\n .attr('x', xOffset - 4)\n .attr('y', function(d, i) {\n return (i + 1 + labels.length % 2) * 12;\n })\n .style('text-anchor', 'middle')\n .style('opacity', 0)\n .text(String)\n .transition()\n .style('opacity', 1);\n\n this._ideo.config.orientation = 'vertical';\n }\n\n rotateBack(setIndex, chrIndex, chrElement, callback) {\n var translate = this.getChromosomeSetTranslate(setIndex);\n\n d3.select(chrElement.parentNode)\n .transition()\n .attr(\"transform\", translate)\n .on('end', callback);\n\n d3.selectAll(this._ideo.selector + ' g.tmp')\n .style('opacity', 0)\n .remove();\n\n this._ideo.config.orientation = 'horizontal';\n }\n\n getHeight(taxid) {\n // Get last chromosome set offset.\n var numChromosomes = this._config.chromosomes[taxid].length;\n var lastSetOffset = this.getChromosomeSetYTranslate(numChromosomes - 1);\n\n // Get last chromosome set size.\n var lastSetSize = this._getChromosomeSetSize(numChromosomes - 1);\n\n // Increase offset by last chromosome set size\n lastSetOffset += lastSetSize;\n\n return lastSetOffset + this._getAdditionalOffset() * 2;\n }\n\n getWidth() {\n return this._config.chrHeight + this.margin.top * 1.5;\n }\n\n getChromosomeSetLabelAnchor() {\n return 'end';\n }\n\n getChromosomeBandLabelAnchor() {\n return null;\n }\n\n getChromosomeBandTickY1() {\n return 2;\n }\n\n getChromosomeBandTickY2() {\n return 10;\n }\n\n getChromosomeSetLabelTranslate() {\n return null;\n }\n\n getChromosomeSetTranslate(setIndex) {\n var leftMargin = this._getLeftMargin();\n var yTranslate = this.getChromosomeSetYTranslate(setIndex);\n return 'translate(' + leftMargin + ', ' + yTranslate + ')';\n }\n\n getChromosomeSetYTranslate(setIndex) {\n // If no detailed description provided just use one formula for all cases.\n if (!this._config.ploidyDesc) {\n return this._config.chrMargin * (setIndex + 1);\n }\n\n // Id detailed description provided start to calculate offsets\n // for each chromosome set separately. This should be done only once.\n if (!this._translate) {\n // First offset equals to zero.\n this._translate = [1];\n\n // Loop through description set\n for (var i = 1; i < this._config.ploidyDesc.length; i++) {\n this._translate[i] =\n this._translate[i - 1] + this._getChromosomeSetSize(i - 1);\n }\n }\n\n return this._translate[setIndex];\n }\n\n getChromosomeSetLabelXPosition(i) {\n if (this._config.ploidy === 1) {\n return this.getChromosomeLabelXPosition(i);\n } else {\n return -20;\n }\n }\n\n getChromosomeSetLabelYPosition(i) {\n var setSize = this._ploidy.getSetSize(i),\n config = this._config,\n chrMargin = config.chrMargin,\n chrWidth = config.chrWidth,\n y;\n\n if (config.ploidy === 1) {\n y = chrWidth / 2 + 3;\n } else {\n y = (setSize * chrMargin) / 2;\n }\n\n return y;\n }\n\n getChromosomeLabelXPosition() {\n return -8;\n }\n\n getChromosomeLabelYPosition() {\n return this._config.chrWidth;\n }\n\n}\n\nexport default HorizontalLayout","/**\n* @fileoverview Paired layout class\n* Ideograms with paired layout group each chromosome in a chromosome set.\n* This enables ploidy support beyond the default haploid; e.g. diploid genomes.\n*/\n\nimport * as d3selection from 'd3-selection';\n\nimport Layout from './layout';\nimport {Object} from './../lib';\n\nvar d3 = Object.assign({}, d3selection);\n\nclass PairedLayout extends Layout {\n\n constructor(config, ideo) {\n super(config, ideo);\n\n this._class = 'PairedLayout';\n\n this.margin = {\n left: 30\n };\n }\n\n rotateForward(setIndex, chrIndex, chrElement, callback) {\n console.warn('rotateForward not implemented for PairedLayout');\n // var self = this;\n // var ideo = this._ideo;\n //\n // // Get ideo container and chromosome set dimensions\n // var ideoBox = d3.select(ideo.selector).node().getBoundingClientRect();\n // var chrBox = chrElement.getBoundingClientRect();\n //\n // // Evaluate dimensions scale coefficients\n // var scaleX = (ideoBox.width / chrBox.height) * 0.97;\n // var scaleY = this._getYScale();\n //\n // // Evaluate y offset of chromosome.\n // // It is different for first and the second one\n // var yOffset = setIndex ? 150 : 25;\n //\n // var transform =\n // 'translate(15, ' + yOffset + ') scale(' + scaleX + ', ' + scaleY + ')';\n //\n // // Run rotation procedure\n // d3.select(chrElement.parentNode)\n // .transition()\n // .attr(\"transform\", transform)\n // .on('end', function() {\n // // Run callback function if provided\n // if (callback) {\n // callback();\n // }\n //\n // var translateY = (6 * Number(!setIndex));\n //\n // // Rotate band labels\n // d3.select(chrElement.parentNode).selectAll('g.bandLabel text')\n // .attr('transform', 'rotate(90) translate(0, ' + translateY + ')')\n // .attr('text-anchor', 'middle');\n //\n // // Hide syntenic regions\n // d3.selectAll(ideo.selector + ' .syntenicRegion')\n // .style('display', 'none');\n // });\n //\n // // Append new chromosome labels\n // var labels = this.getChromosomeLabels(chrElement);\n //\n // d3.select(this._ideo.getSvg())\n // .append('g')\n // .attr('class', 'tmp')\n // .selectAll('text')\n // .data(this.getChromosomeLabels(chrElement))\n // .enter()\n // .append('text')\n // .attr('class', function(d, i) {\n // return i === 0 && labels.length === 2 ? 'chrSetLabel' : null;\n // })\n // .attr('x', 0)\n // .attr('y', yOffset + (self._config.chrWidth * scaleX / 2) * 1.15)\n // .style('opacity', 0)\n // .text(String)\n // .transition()\n // .style('opacity', 1);\n }\n\n rotateBack(setIndex, chrIndex, chrElement, callback) {\n console.warn('rotateBack not implemented for PairedLayout');\n //\n // var ideo = this._ideo;\n //\n // // Get intial transformation string for chromosome set\n // var translate = this.getChromosomeSetTranslate(setIndex);\n //\n // // Run rotation procedure\n // d3.select(chrElement.parentNode)\n // .transition()\n // .attr('transform', translate)\n // .on('end', function() {\n // // Run callback fnuction if provided\n // callback();\n //\n // // Show syntenic regions\n // d3.selectAll(ideo.select + ' .syntenicRegion')\n // .style('display', null);\n //\n // // Reset changed attributes to original state\n // d3.select(chrElement.parentNode).selectAll('g.bandLabel text')\n // .attr('transform', null)\n // .attr('text-anchor', setIndex ? null : 'end');\n // });\n //\n // d3.selectAll(ideo.selector + ' g.tmp')\n // .style('opacity', 0)\n // .remove();\n }\n\n getHeight() {\n return this._config.chrHeight + this.margin.left * 1.5;\n }\n\n getWidth() {\n return '97%';\n }\n\n getChromosomeBandTickY1(chrIndex) {\n return chrIndex % 2 ? this._config.chrWidth : this._config.chrWidth * 2;\n }\n\n getChromosomeBandTickY2(chrIndex) {\n var width = this._config.chrWidth;\n return chrIndex % 2 ? width - this._tickSize : width * 2 + this._tickSize;\n }\n\n getChromosomeBandLabelAnchor(chrIndex) {\n return chrIndex % 2 ? null : 'end';\n }\n\n getChromosomeBandLabelTranslate(band, chrIndex) {\n var x = chrIndex % 2 ? 10 : -this._config.chrWidth - 10;\n var y = this._ideo.round(band.px.start + band.px.width / 2) + 3;\n\n return {\n x: y,\n y: y,\n translate: 'rotate(-90) translate(' + x + ', ' + y + ')'\n };\n }\n\n getChromosomeLabelXPosition() {\n return -this._tickSize;\n }\n\n getChromosomeSetLabelXPosition() {\n return this._config.chrWidth / -2;\n }\n\n getChromosomeSetLabelTranslate() {\n return 'rotate(-90)';\n }\n\n getChromosomeSetTranslate(setIndex) {\n var chromosomeSetYTranslate = this.getChromosomeSetYTranslate(setIndex);\n return (\n 'rotate(90) ' +\n 'translate(' + this.margin.left + ', -' + chromosomeSetYTranslate + ')'\n );\n }\n\n getChromosomeSetYTranslate(setIndex) {\n return 200 * (setIndex + 1);\n }\n\n}\n\nexport default PairedLayout","import * as d3selection from 'd3-selection';\n\nimport Layout from './layout';\nimport {Object} from './../lib';\n\nvar d3 = Object.assign({}, d3selection);\n\nclass SmallLayout extends Layout {\n\n constructor(config, ideo) {\n super(config, ideo);\n\n this._class = 'SmallLayout';\n\n this.margin = {\n left: 36.5,\n top: 10\n };\n }\n\n // rotateForward(setIndex, chrIndex, chrElement, callback) {\n // var ideoBox = d3.select(this._ideo.selector).node().getBoundingClientRect();\n // var chrBox = chrElement.getBoundingClientRect();\n //\n // var scaleX = (ideoBox.width / chrBox.height) * 0.97;\n // var scaleY = this._getYScale();\n //\n // transform = 'translate(5, 25) scale(' + scaleX + ', ' + scaleY + ')';\n //\n // d3.select(chrElement.parentNode)\n // .transition()\n // .attr('transform', transform)\n // .on('end', callback);\n // }\n //\n // rotateBack(setIndex, chrIndex, chrElement, callback) {\n // var translate = this.getChromosomeSetTranslate(setIndex);\n //\n // d3.select(chrElement.parentNode)\n // .transition()\n // .attr('transform', translate)\n // .on('end', callback);\n // }\n\n getHeight() {\n var chrHeight = this._config.chrHeight;\n return this._config.rows * (chrHeight + this.margin.top * 1.5);\n }\n\n getWidth() {\n return '97%';\n }\n\n getChromosomeBandLabelTranslate() {\n\n }\n\n getChromosomeSetLabelTranslate() {\n return 'rotate(-90)';\n }\n\n getChromosomeSetTranslate(setIndex) {\n // Get organisms id list\n var organisms = [];\n this._ideo.getTaxids(function(taxidList) {\n organisms = taxidList;\n });\n // Get first organism chromosomes amount\n var size = this._ideo.config.chromosomes[organisms[0]].length;\n // Amount of chromosomes per number\n var rowSize = size / this._config.rows;\n\n var xOffset;\n var yOffset;\n\n if (setIndex > rowSize - 1) {\n xOffset = this.margin.left + this._config.chrHeight * 1.4;\n yOffset = this.getChromosomeSetYTranslate(setIndex - rowSize);\n } else {\n xOffset = this.margin.left;\n yOffset = this.getChromosomeSetYTranslate(setIndex);\n }\n\n return 'rotate(90) translate(' + xOffset + ', -' + yOffset + ')';\n }\n\n getChromosomeSetYTranslate(setIndex) {\n // Get additional padding caused by annotation tracks\n var additionalPadding = this._getAdditionalOffset();\n // If no detailed description provided just use one formula for all cases\n return (\n this.margin.left * (setIndex) + this._config.chrWidth +\n additionalPadding * 2 + additionalPadding * setIndex\n );\n }\n\n getChromosomeSetLabelXPosition(setIndex) {\n return (\n ((this._ploidy.getSetSize(setIndex) * this._config.chrWidth + 20) / -2) +\n (this._config.ploidy > 1 ? 0 : this._config.chrWidth)\n );\n }\n\n getChromosomeLabelXPosition() {\n return this._config.chrWidth / -2;\n }\n\n}\n\nexport default SmallLayout","import * as d3selection from 'd3-selection';\n\nimport {Object} from '../lib';\nimport {Ploidy} from '../ploidy';\nimport {getLayout} from '../layouts/layout-adapter';\n\nvar d3 = Object.assign({}, d3selection);\n\n/**\n * If ploidy description is a string, then convert it to the canonical\n * array format. String ploidyDesc is used when depicting e.g. parental\n * origin each member of chromosome pair in a human genome.\n * See ploidy-basic.html for usage example.\n */\nfunction setPloidy(ideo) {\n if (\n 'ploidyDesc' in ideo.config &&\n typeof ideo.config.ploidyDesc === 'string'\n ) {\n var tmp = [];\n for (var i = 0; i < ideo.numChromosomes; i++) {\n tmp.push(ideo.config.ploidyDesc);\n }\n ideo.config.ploidyDesc = tmp;\n }\n // Organism ploidy description\n ideo._ploidy = new Ploidy(ideo.config);\n}\n\nfunction getContainerSvgClass(ideo) {\n var svgClass = '';\n if (ideo.config.showChromosomeLabels) {\n if (ideo.config.orientation === 'horizontal') {\n svgClass += 'labeledLeft ';\n } else {\n svgClass += 'labeled ';\n }\n }\n\n if (\n ideo.config.annotationsLayout &&\n ideo.config.annotationsLayout === 'overlay'\n ) {\n svgClass += 'faint';\n }\n\n return svgClass\n}\n\n/**\n * Write tooltip div setup with default styling.\n */\nfunction writeTooltipContainer(ideo) {\n d3.select(ideo.config.container + ' #_ideogramOuterWrap').append('div')\n .attr('class', '_ideogramTooltip')\n .attr('id', '_ideogramTooltip')\n .style('opacity', 0)\n .style('position', 'fixed')\n .style('text-align', 'center')\n .style('padding', '4px')\n .style('font', '12px sans-serif')\n .style('background', 'white')\n .style('border', '1px solid black')\n .style('border-radius', '5px')\n .style('z-index', '100');\n}\n\nfunction writeContainerDom(taxid, ideo) {\n\n // Remove any previous container content\n d3.selectAll(ideo.config.container + ' #_ideogramOuterWrap').remove();\n\n d3.select(ideo.config.container)\n .append('div')\n .attr('id', '_ideogramOuterWrap')\n .append('div')\n .attr('id', '_ideogramTrackLabelContainer')\n .style('position', 'absolute');\n\n d3.select(ideo.config.container + ' #_ideogramOuterWrap').append('div')\n .attr('id', '_ideogramMiddleWrap') // needed for overflow and scrolling\n .style('position', 'relative')\n .style('overflow-x', 'auto')\n .append('div')\n .attr('id', '_ideogramInnerWrap') // needed for overflow and scrolling\n .append('svg')\n .attr('id', '_ideogram')\n .attr('class', getContainerSvgClass(ideo))\n .attr('width', ideo._layout.getWidth(taxid))\n .attr('height', ideo._layout.getHeight(taxid))\n .html(ideo.getBandColorGradients());\n}\n\n/**\n * Writes the HTML elements that contain this ideogram instance.\n */\nfunction writeContainer(bandsArray, taxid, t0) {\n var ideo = this;\n\n if (ideo.config.annotationsPath) {\n ideo.fetchAnnots(ideo.config.annotationsPath);\n }\n\n setPloidy(ideo);\n\n ideo._layout = getLayout(ideo);\n\n writeContainerDom(taxid, ideo);\n\n ideo.isOnlyIdeogram = document.querySelectorAll('#_ideogram').length === 1;\n writeTooltipContainer(ideo);\n ideo.finishInit(bandsArray, t0);\n}\n\nexport {writeContainer}","import VerticalLayout from './vertical-layout';\nimport HorizontalLayout from './horizontal-layout';\nimport PairedLayout from './paired-layout';\nimport SmallLayout from './small-layout';\n\nfunction getLayout(ideo) {\n var config = ideo.config;\n\n if ('perspective' in config && config.perspective === 'comparative') {\n return new PairedLayout(config, ideo);\n } else if ('rows' in config && config.rows > 1) {\n return new SmallLayout(config, ideo);\n } else if (config.orientation === 'vertical') {\n return new VerticalLayout(config, ideo);\n } else if (config.orientation === 'horizontal') {\n return new HorizontalLayout(config, ideo);\n } else {\n return new VerticalLayout(config, ideo);\n }\n}\n\nexport {getLayout}","/**\n * @fileoveriew Methods for initialization\n */\n\nimport * as d3fetch from 'd3-fetch';\nimport * as d3selection from 'd3-selection';\n\nimport {Object, hasNonGenBankAssembly} from '../lib';\nimport {configure} from './configure';\nimport {finishInit} from './finish-init';\nimport {writeContainer} from './write-container';\nimport {fetchBands} from '../bands/fetch';\n\nvar d3 = Object.assign({}, d3fetch, d3selection);\n\nfunction isHeterogameticChromosome(chrModel, chrIndex, ideo) {\n var ploidy = ideo.config.ploidy;\n return (\n 'sex' in ideo.config &&\n (\n ploidy === 2 && ideo.sexChromosomes.index + 2 === chrIndex ||\n ideo.config.sex === 'female' && chrModel.name === 'Y'\n )\n );\n}\n\nfunction prepareChromosomes(bandsArray, chrs, taxid, chrIndex, ideo) {\n var j, bands, chromosome, chrModel\n\n for (j = 0; j < chrs.length; j++) {\n chromosome = chrs[j];\n if ('bandsArray' in ideo) bands = bandsArray[chrIndex];\n\n chrModel = ideo.getChromosomeModel(bands, chromosome, taxid, chrIndex);\n\n chrIndex += 1;\n\n if (typeof chromosome !== 'string') chromosome = chromosome.name;\n\n ideo.chromosomes[taxid][chromosome] = chrModel;\n ideo.chromosomesArray.push(chrModel);\n\n if (isHeterogameticChromosome(chrModel, chrIndex, ideo)) continue;\n\n ideo.drawChromosome(chrModel);\n }\n\n return chrIndex;\n}\n\nfunction setCoordinateSystem(chrs, ideo) {\n if (\n typeof chrBands !== 'undefined' &&\n chrs.length >= chrBands.length / 2\n ) {\n ideo.coordinateSystem = 'bp';\n }\n}\n\n/**\n * Configures chromosome data and calls downstream chromosome drawing functions\n */\nfunction initDrawChromosomes(bandsArray) {\n var ideo = this,\n taxids = ideo.config.taxids,\n chrIndex = 0,\n taxid, i, chrs;\n\n if (bandsArray.length > 0) ideo.bandsArray = {};\n\n for (i = 0; i < taxids.length; i++) {\n taxid = taxids[i];\n chrs = ideo.config.chromosomes[taxid];\n\n setCoordinateSystem(chrs, ideo);\n\n ideo.chromosomes[taxid] = {};\n ideo.setSexChromosomes(chrs);\n\n if ('bandsArray' in ideo) ideo.bandsArray[taxid] = bandsArray;\n\n chrIndex = prepareChromosomes(bandsArray, chrs, taxid, chrIndex, ideo);\n\n if (ideo.config.showBandLabels) ideo.drawBandLabels(ideo.chromosomes);\n ideo.handleRotateOnClick();\n ideo._gotChrModels = true; // Prevent issue with errant rat centromeres\n }\n}\n\n/**\n * Attach any click handlers to rotate and toggle chromosomes\n */\nfunction handleRotateOnClick() {\n var ideo = this;\n\n if (!('rotatable' in ideo.config && ideo.config.rotatable === false)) {\n d3.selectAll(ideo.selector + ' .chromosome').on('click', function () {\n ideo.rotateAndToggleDisplay(this);\n });\n } else {\n d3.selectAll(ideo.selector + ' .chromosome')\n .style('cursor', 'default');\n }\n}\n\n/**\n * Called when Ideogram has finished initializing.\n * Accounts for certain ideogram properties not being set until\n * asynchronous requests succeed, etc.\n */\nfunction onLoad() {\n call(this.onLoadCallback);\n}\n\nfunction getBandFileName(taxid, accession, ideo) {\n var organism = ideo.organisms[taxid];\n var bandFileName = [Ideogram.slugify(organism.scientificName)];\n var assemblies = organism.assemblies;\n var resolution = ideo.config.resolution;\n\n if (accession !== assemblies.default) {\n bandFileName.push(accession);\n }\n if (\n taxid === '9606' &&\n (accession in assemblies === 'false' &&\n Object.values(assemblies).includes(config.assembly) ||\n (resolution !== '' && resolution !== 850))\n ) {\n bandFileName.push(resolution);\n }\n bandFileName = bandFileName.join('-') + '.js';\n\n return bandFileName;\n}\n\nfunction getBandFileNames(taxid, bandFileNames, ideo) {\n var organism, assemblies, accession, bandFileName,\n config = ideo.config;\n\n organism = ideo.organisms[taxid];\n\n if (!config.assembly) ideo.config.assembly = 'default';\n\n assemblies = organism.assemblies;\n\n if (ideo.assemblyIsAccession()) {\n accession = config.assembly;\n } else {\n accession = assemblies[config.assembly];\n }\n\n bandFileName = getBandFileName(taxid, accession, ideo);\n\n if (taxid === '9606' || taxid === '10090') {\n bandFileNames[taxid] = bandFileName;\n }\n return bandFileNames;\n}\n\nfunction prepareContainer(taxid, bandFileNames, t0, ideo) {\n var bandsArray;\n\n if (\n hasNonGenBankAssembly(ideo) &&\n typeof chrBands === 'undefined' && taxid in bandFileNames\n ) {\n fetchBands(bandFileNames, taxid, t0, ideo);\n } else {\n if (typeof chrBands !== 'undefined') {\n // If bands already available,\n // e.g. via