diff --git a/dist/evzoom.js b/dist/evzoom.js index f5b368c..0d9b29e 100755 --- a/dist/evzoom.js +++ b/dist/evzoom.js @@ -1,4 +1,4 @@ -!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n():"function"==typeof define&&define.amd?define(n):n()}(this,function(){"use strict";function t(t){return function(n,e){return $r(t(n),e)}}function n(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>=no?o*=10:i>=eo?o*=5:i>=ro&&(o*=2),n=0&&(e=t.slice(r+1),t=t.slice(0,r)),t&&!n.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}})}function i(t,n){for(var e,r=0,o=t.length;r=0&&(n=t.slice(e+1),t=t.slice(0,e)),{type:t,name:n}})}function f(t){return function(){var n=this.__on;if(n){for(var e,r=0,o=-1,i=n.length;rn?1:t>=n?0:NaN}function _(t){return function(){this.removeAttribute(t)}}function w(t){return function(){this.removeAttributeNS(t.space,t.local)}}function b(t,n){return function(){this.setAttribute(t,n)}}function M(t,n){return function(){this.setAttributeNS(t.space,t.local,n)}}function T(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttribute(t):this.setAttribute(t,e)}}function k(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,e)}}function z(t){return function(){this.style.removeProperty(t)}}function S(t,n,e){return function(){this.style.setProperty(t,n,e)}}function C(t,n,e){return function(){var r=n.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,e)}}function N(t){return function(){delete this[t]}}function A(t,n){return function(){this[t]=n}}function j(t,n){return function(){var e=n.apply(this,arguments);null==e?delete this[t]:this[t]=e}}function D(t){return t.trim().split(/^|\s+/)}function L(t){return t.classList||new E(t)}function E(t){this._node=t,this._names=D(t.getAttribute("class")||"")}function Y(t,n){for(var e=L(t),r=-1,o=n.length;++r>8&15|n>>4&240,n>>4&15|240&n,(15&n)<<4|15&n,1)):(n=di.exec(t))?ot(parseInt(n[1],16)):(n=pi.exec(t))?new st(n[1],n[2],n[3],1):(n=gi.exec(t))?new st(255*n[1]/100,255*n[2]/100,255*n[3]/100,1):(n=yi.exec(t))?it(n[1],n[2],n[3],n[4]):(n=mi.exec(t))?it(255*n[1]/100,255*n[2]/100,255*n[3]/100,n[4]):(n=vi.exec(t))?lt(n[1],n[2]/100,n[3]/100,1):(n=xi.exec(t))?lt(n[1],n[2]/100,n[3]/100,n[4]):_i.hasOwnProperty(t)?ot(_i[t]):"transparent"===t?new st(NaN,NaN,NaN,0):null}function ot(t){return new st(t>>16&255,t>>8&255,255&t,1)}function it(t,n,e,r){return r<=0&&(t=n=e=NaN),new st(t,n,e,r)}function at(t){return t instanceof et||(t=rt(t)),t?(t=t.rgb(),new st(t.r,t.g,t.b,t.opacity)):new st}function ut(t,n,e,r){return 1===arguments.length?at(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 lt(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 ct(t){if(t instanceof ft)return new ft(t.h,t.s,t.l,t.opacity);if(t instanceof et||(t=rt(t)),!t)return new ft;if(t instanceof ft)return t;t=t.rgb();var n=t.r/255,e=t.g/255,r=t.b/255,o=Math.min(n,e,r),i=Math.max(n,e,r),a=NaN,u=i-o,s=(i+o)/2;return u?(a=n===i?(e-r)/u+6*(e0&&s<1?0:a,new ft(a,u,s,t.opacity)}function ht(t,n,e,r){return 1===arguments.length?ct(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 dt(t,n,e){return 255*(t<60?n+(e-n)*t/60:t<180?e:t<240?n+(e-n)*(240-t)/60:n)}function pt(t){if(t instanceof yt)return new yt(t.l,t.a,t.b,t.opacity);if(t instanceof Mt){var n=t.h*wi;return new yt(t.l,Math.cos(n)*t.c,Math.sin(n)*t.c,t.opacity)}t instanceof st||(t=at(t));var e=_t(t.r),r=_t(t.g),o=_t(t.b),i=mt((.4124564*e+.3575761*r+.1804375*o)/Ti),a=mt((.2126729*e+.7151522*r+.072175*o)/ki),u=mt((.0193339*e+.119192*r+.9503041*o)/zi);return new yt(116*a-16,500*(i-a),200*(a-u),t.opacity)}function gt(t,n,e,r){return 1===arguments.length?pt(t):new yt(t,n,e,null==r?1:r)}function yt(t,n,e,r){this.l=+t,this.a=+n,this.b=+e,this.opacity=+r}function mt(t){return t>Ai?Math.pow(t,1/3):t/Ni+Si}function vt(t){return t>Ci?t*t*t:Ni*(t-Si)}function xt(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function _t(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function wt(t){if(t instanceof Mt)return new Mt(t.h,t.c,t.l,t.opacity);t instanceof yt||(t=pt(t));var n=Math.atan2(t.b,t.a)*bi;return new Mt(n<0?n+360:n,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}function bt(t,n,e,r){return 1===arguments.length?wt(t):new Mt(t,n,e,null==r?1:r)}function Mt(t,n,e,r){this.h=+t,this.c=+n,this.l=+e,this.opacity=+r}function Tt(t){if(t instanceof zt)return new zt(t.h,t.s,t.l,t.opacity);t instanceof st||(t=at(t));var n=t.r/255,e=t.g/255,r=t.b/255,o=(Fi*r+Xi*n-Ui*e)/(Fi+Xi-Ui),i=r-o,a=(Yi*(e-o)-Li*i)/Ei,u=Math.sqrt(a*a+i*i)/(Yi*o*(1-o)),s=u?Math.atan2(a,i)*bi-120:NaN;return new zt(s<0?s+360:s,u,o,t.opacity)}function kt(t,n,e,r){return 1===arguments.length?Tt(t):new zt(t,n,e,null==r?1:r)}function zt(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function St(t,n){return function(e){return t+e*n}}function Ct(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)}}function Nt(t,n){var e=n-t;return e?St(t,e>180||e<-180?e-360*Math.round(e/360):e):Wi(isNaN(t)?n:t)}function At(t){return 1===(t=+t)?jt:function(n,e){return e-n?Ct(n,e,t):Wi(isNaN(n)?e:n)}}function jt(t,n){var e=n-t;return e?St(t,e):Wi(isNaN(t)?n:t)}function Dt(t){return function(){return t}}function Lt(t){return function(n){return t(n)+""}}function Et(t){return"none"===t?na:(Oi||(Oi=document.createElement("DIV"),Bi=document.documentElement,Hi=document.defaultView),Oi.style.transform=t,t=Hi.getComputedStyle(Bi.appendChild(Oi),null).getPropertyValue("transform"),Bi.removeChild(Oi),t=t.slice(7,-1).split(","),ea(+t[0],+t[1],+t[2],+t[3],+t[4],+t[5]))}function Yt(t){return null==t?na:(Pi||(Pi=document.createElementNS("http://www.w3.org/2000/svg","g")),Pi.setAttribute("transform",t),(t=Pi.transform.baseVal.consolidate())?(t=t.matrix,ea(t.a,t.b,t.c,t.d,t.e,t.f)):na)}function Xt(t,n,e,r){function o(t){return t.length?t.pop()+" ":""}function i(t,r,o,i,a,u){if(t!==o||r!==i){var s=a.push("translate(",null,n,null,e);u.push({i:s-4,x:Ri(t,o)},{i:s-2,x:Ri(r,i)})}else(o||i)&&a.push("translate("+o+n+i+e)}function a(t,n,e,i){t!==n?(t-n>180?n+=360:n-t>180&&(t+=360),i.push({i:e.push(o(e)+"rotate(",null,r)-2,x:Ri(t,n)})):n&&e.push(o(e)+"rotate("+n+r)}function u(t,n,e,i){t!==n?i.push({i:e.push(o(e)+"skewX(",null,r)-2,x:Ri(t,n)}):n&&e.push(o(e)+"skewX("+n+r)}function s(t,n,e,r,i,a){if(t!==e||n!==r){var u=i.push(o(i)+"scale(",null,",",null,")");a.push({i:u-4,x:Ri(t,e)},{i:u-2,x:Ri(n,r)})}else 1===e&&1===r||i.push(o(i)+"scale("+e+","+r+")")}return function(n,e){var r=[],o=[];return n=t(n),e=t(e),i(n.translateX,n.translateY,e.translateX,e.translateY,r,o),a(n.rotate,e.rotate,r,o),u(n.skewX,e.skewX,r,o),s(n.scaleX,n.scaleY,e.scaleX,e.scaleY,r,o),n=e=null,function(t){for(var n,e=-1,i=o.length;++e=0&&n._call.call(null,t),n=n._next;--sa}function Wt(){da=(fa=ga.now())+pa,sa=la=0;try{Pt()}finally{sa=0,qt(),da=0}}function Zt(){var t=ga.now(),n=t-fa;n>ha&&(pa-=n,fa=t)}function qt(){for(var t,n,e=ia,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:ia=n);aa=t,It(r)}function It(t){if(!sa){la&&(la=clearTimeout(la));var n=t-da;n>24?(t<1/0&&(la=setTimeout(Wt,n)),ca&&(ca=clearInterval(ca))):(ca||(fa=da,ca=setInterval(Zt,ha)),sa=1,ya(Wt))}}function Rt(t,n){var e=t.__transition;if(!e||!(e=e[n])||e.state>_a)throw new Error("too late");return e}function Gt(t,n){var e=t.__transition;if(!e||!(e=e[n])||e.state>ba)throw new Error("too late");return e}function Vt(t,n){var e=t.__transition;if(!e||!(e=e[n]))throw new Error("too late");return e}function $t(t,n,e){function r(t){e.state=wa,e.timer.restart(o,e.delay,e.time),e.delay<=t&&o(t-e.delay)}function o(r){var l,c,h,f;if(e.state!==wa)return a();for(l in s)if(f=s[l],f.name===e.name){if(f.state===Ma)return ma(o);f.state===Ta?(f.state=za,f.timer.stop(),f.on.call("interrupt",t,t.__data__,f.index,f.group),delete s[l]):+l=0&&(t=t.slice(0,n)),!t||"start"===t})}function gn(t,n,e){var r,o,i=pn(n)?Rt:Gt;return function(){var a=i(this,t),u=a.on;u!==r&&(o=(r=u).copy()).on(n,e),a.on=o}}function yn(t){return function(){var n=this.parentNode;for(var e in this.__transition)if(+e!==t)return;n&&n.removeChild(this)}}function mn(t,n){var e,r,o;return function(){var i=Zo(this).getComputedStyle(this,null),a=i.getPropertyValue(t),u=(this.style.removeProperty(t),i.getPropertyValue(t));return a===u?null:a===e&&u===r?o:o=n(e=a,r=u)}}function vn(t){return function(){this.style.removeProperty(t)}}function xn(t,n,e){var r,o;return function(){var i=Zo(this).getComputedStyle(this,null).getPropertyValue(t);return i===e?null:i===r?o:o=n(r=i,e)}}function _n(t,n,e){var r,o,i;return function(){var a=Zo(this).getComputedStyle(this,null),u=a.getPropertyValue(t),s=e(this);return null==s&&(this.style.removeProperty(t),s=a.getPropertyValue(t)),u===s?null:u===r&&s===o?i:i=n(r=u,o=s)}}function wn(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}function bn(t){return function(){this.textContent=t}}function Mn(t){return function(){var n=t(this);this.textContent=null==n?"":n}}function Tn(t,n,e,r){this._groups=t,this._parents=n,this._name=e,this._id=r}function kn(t){return tt().transition(t)}function zn(){return++Va}function Sn(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}function Cn(t,n){for(var e;!(e=t.__transition)||!(e=e[n]);)if(!(t=t.parentNode))return eu.time=Ft(),eu;return e}function Nn(t){return{type:t}}function An(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function jn(){return new An}function Dn(){}function Ln(t,n){var e=new Dn;if(t instanceof Dn)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(;++o=(i=(g+m)/2))?g=i:m=i,(c=e>=(a=(y+v)/2))?y=a:v=a,o=d,!(d=d[h=c<<1|l]))return o[h]=p,t;if(u=+t._x.call(null,d.data),s=+t._y.call(null,d.data),n===u&&e===s)return p.next=d,o?o[h]=p:t._root=p,t;do o=o?o[h]=new Array(4):t._root=new Array(4),(l=n>=(i=(g+m)/2))?g=i:m=i,(c=e>=(a=(y+v)/2))?y=a:v=a;while((h=c<<1|l)===(f=(s>=a)<<1|u>=i));return o[f]=d,o[h]=p,t}function Bn(t){var n,e,r,o,i=t.length,a=new Array(i),u=new Array(i),s=1/0,l=1/0,c=-(1/0),h=-(1/0);for(e=0;ec&&(c=r),oh&&(h=o));for(c",o=n[3]||"-",i=n[4]||"",a=!!n[5],u=n[6]&&+n[6],s=!!n[7],l=n[8]&&+n[8].slice(1),c=n[9]||"";"n"===c?(s=!0,c="g"):Xu[c]||(c=""),(a||"0"===e&&"="===r)&&(a=!0,e="0",r="="),this.fill=e,this.align=r,this.sign=o,this.symbol=i,this.zero=a,this.width=u,this.comma=s,this.precision=l,this.type=c}function Gn(t){return t}function Vn(t){return Ou=Wu(t),Bu=Ou.format,Hu=Ou.formatPrefix,Ou}function $n(){this.reset()}function Jn(t,n,e){var r=t.s=n+e,o=r-n,i=r-o;t.t=n-i+(e-o)}function Qn(t){return t>1?0:t<-1?$u:Math.acos(t)}function Kn(t){return t>1?Ju:t<-1?-Ju:Math.asin(t)}function te(){}function ne(t){var n=t[0],e=t[1],r=os(e);return[r*os(n),r*is(n),is(e)]}function ee(t,n){return[t[1]*n[2]-t[2]*n[1],t[2]*n[0]-t[0]*n[2],t[0]*n[1]-t[1]*n[0]]}function re(t){var n=as(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=n,t[1]/=n,t[2]/=n}function oe(t,n,e,r){this.x=t,this.z=n,this.o=e,this.e=r,this.v=!1,this.n=this.p=null}function ie(t){if(n=t.length){for(var n,e,r=0,o=t[0];++r1}function ue(t,n){return((t=t.x)[0]<0?t[1]-Ju-Vu:Ju-t[1])-((n=n.x)[0]<0?n[1]-Ju-Vu:Ju-n[1])}function se(t){var n,e=NaN,r=NaN,o=NaN;return{lineStart:function(){t.lineStart(),n=1},point:function(i,a){var u=i>0?$u:-$u,s=ns(i-e);ns(s-$u)0?Ju:-Ju),t.point(o,r),t.lineEnd(),t.lineStart(),t.point(u,r),t.point(i,r),n=0):o!==u&&s>=$u&&(ns(e-o)Vu?es((is(n)*(i=os(r))*is(e)-is(r)*(o=os(n))*is(t))/(o*i*a)):(n+r)/2}function ce(t,n,e,r){var o;if(null==t)o=e*Ju,r.point(-$u,o),r.point(0,o),r.point($u,o),r.point($u,0),r.point($u,-o),r.point(0,-o),r.point(-$u,-o),r.point(-$u,0),r.point(-$u,o);else if(ns(t[0]-n[0])>Vu){var i=t[0]=0;--i)l.push(r=e.children[i]=new xe(o[i])),r.parent=e,r.depth=e.depth+1;return u.eachBefore(ve)}function ge(){return pe(this).eachBefore(me)}function ye(t){return t.children}function me(t){t.data=t.data.data}function ve(t){var n=0;do t.height=n;while((t=t.parent)&&t.height<++n)}function xe(t){this.data=t,this.depth=this.height=0,this.parent=null}function _e(t,n){this._=t,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=n}function we(t){if(!t._start)try{be(t)}catch(n){if(t._tasks[t._ended+t._active-1])Te(t,n);else if(!t._data)throw n}}function be(t){for(;t._start=t._waiting&&t._active=0;)if((e=t._tasks[r])&&(t._tasks[r]=null,e.abort))try{e.abort()}catch(t){}t._active=NaN,ke(t)}function ke(t){if(!t._active&&t._call){var n=t._data;t._data=void 0,t._call(t._error,n)}}function ze(t){return function(n,e){t(null==n?e:null)}}function Se(t){var n=t.responseType;return n&&"text"!==n?t.response:t.responseText}function Ce(t,n){return function(e){return t(e.responseText,n)}}function Ne(t,n){return(n-=t=+t)?function(e){return(e-t)/n}:Ls(n)}function Ae(t){return function(n,e){var r=t(n=+n,e=+e);return function(t){return t<=n?0:t>=e?1:r(t)}}}function je(t){return function(n,e){var r=t(n=+n,e=+e);return function(t){return t<=0?n:t>=1?e:r(t)}}}function De(t,n,e,r){var o=t[0],i=t[1],a=n[0],u=n[1];return i2?Le:De,i=a=null,r}function r(n){return(i||(i=o(u,s,c?Ae(t):t,l)))(+n)}var o,i,a,u=Ys,s=Ys,l=Qi,c=!1;return r.invert=function(t){return(a||(a=o(s,u,Ne,c?je(n):n)))(+t)},r.domain=function(t){return arguments.length?(u=js.call(t,Es),e()):u.slice()},r.range=function(t){return arguments.length?(s=Ds.call(t),e()):s.slice()},r.rangeRound=function(t){return s=Ds.call(t),l=Ki,e()},r.clamp=function(t){return arguments.length?(c=!!t,e()):c},r.interpolate=function(t){return arguments.length?(l=t,e()):l},e()}function Xe(t){var e=t.domain;return t.ticks=function(t){var n=e();return oo(n[0],n[n.length-1],null==t?10:t)},t.tickFormat=function(t,n){return Xs(e(),t,n)},t.nice=function(r){var o=e(),i=o.length-1,a=null==r?10:r,u=o[0],s=o[i],l=n(u,s,a);return l&&(l=n(Math.floor(u/l)*l,Math.ceil(s/l)*l,a),o[0]=Math.floor(u/l)*l,o[i]=Math.ceil(s/l)*l,e(o)),t},t}function Ue(){var t=Ye(Ne,Ri);return t.copy=function(){return Ee(t,Ue())},Xe(t)}function Fe(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 a;do a.push(new Date(+e));while(n(e,i),t(e),e=n)for(;t(n),!e(n);)n.setTime(n-1)},function(t,r){if(t>=t)for(;--r>=0;)for(;n(t,1),!e(t););})},e&&(o.count=function(n,r){return Us.setTime(+n),Fs.setTime(+r),t(Us),t(Fs),Math.floor(e(Us,Fs))},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}function Oe(t){return Fe(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())*Hs)/Zs})}function Be(t){return Fe(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)/Zs})}function He(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 Pe(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 We(t){return{y:t,m:0,d:1,H:0,M:0,S:0,L:0}}function Ze(t){function n(t,n){return function(e){var r,o,i,a=[],u=-1,s=0,l=t.length;for(e instanceof Date||(e=new Date(+e));++u=s)return-1;if(o=n.charCodeAt(a++),37===o){if(o=n.charAt(a++),i=P[o in ol?n.charAt(a++):o],!i||(r=i(t,e,r))<0)return-1}else if(o!=e.charCodeAt(r++))return-1}return r}function o(t,n,e){var r=A.exec(n.slice(e));return r?(t.p=j[r[0].toLowerCase()],e+r[0].length):-1}function i(t,n,e){var r=E.exec(n.slice(e));return r?(t.w=Y[r[0].toLowerCase()],e+r[0].length):-1}function a(t,n,e){var r=D.exec(n.slice(e));return r?(t.w=L[r[0].toLowerCase()],e+r[0].length):-1}function u(t,n,e){var r=F.exec(n.slice(e));return r?(t.m=O[r[0].toLowerCase()],e+r[0].length):-1}function s(t,n,e){var r=X.exec(n.slice(e));return r?(t.m=U[r[0].toLowerCase()],e+r[0].length):-1}function l(t,n,e){return r(t,b,n,e)}function c(t,n,e){return r(t,M,n,e)}function h(t,n,e){return r(t,T,n,e)}function f(t){return S[t.getDay()]}function d(t){return z[t.getDay()]}function p(t){return N[t.getMonth()]}function g(t){return C[t.getMonth()]}function y(t){return k[+(t.getHours()>=12)]}function m(t){return S[t.getUTCDay()]}function v(t){return z[t.getUTCDay()]}function x(t){return N[t.getUTCMonth()]}function _(t){return C[t.getUTCMonth()]}function w(t){return k[+(t.getUTCHours()>=12)]}var b=t.dateTime,M=t.date,T=t.time,k=t.periods,z=t.days,S=t.shortDays,C=t.months,N=t.shortMonths,A=Re(k),j=Ge(k),D=Re(z),L=Ge(z),E=Re(S),Y=Ge(S),X=Re(C),U=Ge(C),F=Re(N),O=Ge(N),B={a:f,A:d,b:p,B:g,c:null,d:lr,e:lr,H:cr,I:hr,j:fr,L:dr,m:pr,M:gr,p:y,S:yr,U:mr,w:vr,W:xr,x:null,X:null,y:_r,Y:wr,Z:br,"%":Ur},H={a:m,A:v,b:x,B:_,c:null,d:Mr,e:Mr,H:Tr,I:kr,j:zr,L:Sr,m:Cr,M:Nr,p:w,S:Ar,U:jr,w:Dr,W:Lr,x:null,X:null,y:Er,Y:Yr,Z:Xr,"%":Ur},P={a:i,A:a,b:u,B:s,c:l,d:er,e:er,H:or,I:or,j:rr,L:ur,m:nr,M:ir,p:o,S:ar,U:$e,w:Ve,W:Je,x:c,X:h,y:Ke,Y:Qe,Z:tr,"%":sr};return B.x=n(M,B),B.X=n(T,B),B.c=n(b,B),H.x=n(M,H),H.X=n(T,H),H.c=n(b,H),{format:function(t){var e=n(t+="",B);return e.toString=function(){return t},e},parse:function(t){var n=e(t+="",He);return n.toString=function(){return t},n},utcFormat:function(t){var e=n(t+="",H);return e.toString=function(){return t},e},utcParse:function(t){var n=e(t,Pe);return n.toString=function(){return t},n}}}function qe(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 tr(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 nr(t,n,e){var r=il.exec(n.slice(e,e+2));return r?(t.m=r[0]-1,e+r[0].length):-1}function er(t,n,e){var r=il.exec(n.slice(e,e+2));return r?(t.d=+r[0],e+r[0].length):-1}function rr(t,n,e){var r=il.exec(n.slice(e,e+3));return r?(t.m=0,t.d=+r[0],e+r[0].length):-1}function or(t,n,e){var r=il.exec(n.slice(e,e+2));return r?(t.H=+r[0],e+r[0].length):-1}function ir(t,n,e){var r=il.exec(n.slice(e,e+2));return r?(t.M=+r[0],e+r[0].length):-1}function ar(t,n,e){var r=il.exec(n.slice(e,e+2));return r?(t.S=+r[0],e+r[0].length):-1}function ur(t,n,e){var r=il.exec(n.slice(e,e+3));return r?(t.L=+r[0],e+r[0].length):-1}function sr(t,n,e){var r=al.exec(n.slice(e,e+1));return r?e+r[0].length:-1}function lr(t,n){return qe(t.getDate(),n,2)}function cr(t,n){return qe(t.getHours(),n,2)}function hr(t,n){return qe(t.getHours()%12||12,n,2)}function fr(t,n){return qe(1+qs.count(Gs(t),t),n,3)}function dr(t,n){return qe(t.getMilliseconds(),n,3)}function pr(t,n){return qe(t.getMonth()+1,n,2)}function gr(t,n){return qe(t.getMinutes(),n,2)}function yr(t,n){return qe(t.getSeconds(),n,2)}function mr(t,n){return qe(Is.count(Gs(t),t),n,2)}function vr(t){return t.getDay()}function xr(t,n){return qe(Rs.count(Gs(t),t),n,2)}function _r(t,n){return qe(t.getFullYear()%100,n,2)}function wr(t,n){return qe(t.getFullYear()%1e4,n,4)}function br(t){var n=t.getTimezoneOffset();return(n>0?"-":(n*=-1,"+"))+qe(n/60|0,"0",2)+qe(n%60,"0",2)}function Mr(t,n){return qe(t.getUTCDate(),n,2)}function Tr(t,n){return qe(t.getUTCHours(),n,2)}function kr(t,n){return qe(t.getUTCHours()%12||12,n,2)}function zr(t,n){return qe(1+Vs.count(Qs(t),t),n,3)}function Sr(t,n){return qe(t.getUTCMilliseconds(),n,3)}function Cr(t,n){return qe(t.getUTCMonth()+1,n,2)}function Nr(t,n){return qe(t.getUTCMinutes(),n,2)}function Ar(t,n){return qe(t.getUTCSeconds(),n,2)}function jr(t,n){return qe($s.count(Qs(t),t),n,2); -}function Dr(t){return t.getUTCDay()}function Lr(t,n){return qe(Js.count(Qs(t),t),n,2)}function Er(t,n){return qe(t.getUTCFullYear()%100,n,2)}function Yr(t,n){return qe(t.getUTCFullYear()%1e4,n,4)}function Xr(){return"+0000"}function Ur(){return"%"}function Fr(t){return Ks=Ze(t),tl=Ks.format,nl=Ks.parse,el=Ks.utcFormat,rl=Ks.utcParse,Ks}function Or(t){return t.toISOString()}function Br(t){var n=new Date(t);return isNaN(n)?null:n}function Hr(t){this._context=t}function Pr(t){return t<0?-1:1}function Wr(t,n,e){var r=t._x1-t._x0,o=n-t._x1,i=(t._y1-t._y0)/(r||o<0&&-0),a=(e-t._y1)/(o||r<0&&-0),u=(i*o+a*r)/(r+o);return(Pr(i)+Pr(a))*Math.min(Math.abs(i),Math.abs(a),.5*Math.abs(u))||0}function Zr(t,n){var e=t._x1-t._x0;return e?(3*(t._y1-t._y0)/e-n)/2:n}function qr(t,n,e){var r=t._x0,o=t._y0,i=t._x1,a=t._y1,u=(i-r)/3;t._context.bezierCurveTo(r+u,o+u*n,i-u,a-u*e,i,a)}function Ir(t){this._context=t}function Rr(t){this._context=new Gr(t)}function Gr(t){this._context=t}function Vr(t,n,e,r){return Math.sqrt((t-e)*(t-e)+(n-r)*(n-r))}var $r=function(t,n){return tn?1:t>=n?0:NaN},Jr=function(n){return 1===n.length&&(n=t(n)),{left:function(t,e,r,o){for(null==r&&(r=0),null==o&&(o=t.length);r>>1;n(t[i],e)<0?r=i+1:o=i}return r},right:function(t,e,r,o){for(null==r&&(r=0),null==o&&(o=t.length);r>>1;n(t[i],e)>0?o=i:r=i+1}return r}}},Qr=Jr($r),Kr=Qr.right,to=function(t,n,e){t=+t,n=+n,e=(o=arguments.length)<2?(n=t,t=0,1):o<3?1:+e;for(var r=-1,o=0|Math.max(0,Math.ceil((n-t)/e)),i=new Array(o);++r=0;)for(r=t[o],n=r.length;--n>=0;)e[--a]=r[n];return e},ao={value:function(){}};r.prototype=e.prototype={constructor:r,on:function(t,n){var e,r=this._,u=o(t+"",r),s=-1,l=u.length;{if(!(arguments.length<2)){if(null!=n&&"function"!=typeof n)throw new Error("invalid callback: "+n);for(;++s0)for(var e,r,o=new Array(e),i=0;i=0&&"xmlns"!==(n=t.slice(0,e))&&(t=t.slice(e+1)),so.hasOwnProperty(n)?{space:so[n],local:t}:t},co=function(t){var n=lo(t);return(n.local?s:u)(n)},ho=function(t){return function(){return this.matches(t)}};if("undefined"!=typeof document){var fo=document.documentElement;if(!fo.matches){var po=fo.webkitMatchesSelector||fo.msMatchesSelector||fo.mozMatchesSelector||fo.oMatchesSelector;ho=function(t){return function(){return po.call(this,t)}}}}var go=ho,yo={},mo=null;if("undefined"!=typeof document){var vo=document.documentElement;"onmouseenter"in vo||(yo={mouseenter:"mouseover",mouseleave:"mouseout"})}var xo=function(t,n,e){var r,o,i=h(t+""),a=i.length;{if(!(arguments.length<2)){for(u=n?d:f,null==e&&(e=!1),r=0;r=M&&(M=b+1);!(w=y[M])&&++M=0;)(r=o[i])&&(a&&a!==r.nextSibling&&a.parentNode.insertBefore(r,a),a=r);return this},Xo=function(t){function n(n,e){return n&&e?t(n.__data__,e.__data__):!n-!e}t||(t=x);for(var e=this._groups,r=e.length,o=new Array(r),i=0;i1?this.each((null==n?z:"function"==typeof n?C:S)(t,n,null==e?"":e)):Zo(r=this.node()).getComputedStyle(r,null).getPropertyValue(t)},Io=function(t,n){return arguments.length>1?this.each((null==n?N:"function"==typeof n?j:A)(t,n)):this.node()[t]};E.prototype={add:function(t){var n=this._names.indexOf(t);n<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var n=this._names.indexOf(t);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var Ro=function(t,n){var e=D(t+"");if(arguments.length<2){for(var r=L(this.node()),o=-1,i=e.length;++o=240?t-240:t+120,o,r),dt(t,o,r),dt(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 wi=Math.PI/180,bi=180/Math.PI,Mi=18,Ti=.95047,ki=1,zi=1.08883,Si=4/29,Ci=6/29,Ni=3*Ci*Ci,Ai=Ci*Ci*Ci;ai(yt,gt,nt(et,{brighter:function(t){return new yt(this.l+Mi*(null==t?1:t),this.a,this.b,this.opacity)},darker:function(t){return new yt(this.l-Mi*(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 t=ki*vt(t),n=Ti*vt(n),e=zi*vt(e),new st(xt(3.2404542*n-1.5371385*t-.4985314*e),xt(-.969266*n+1.8760108*t+.041556*e),xt(.0556434*n-.2040259*t+1.0572252*e),this.opacity)}})),ai(Mt,bt,nt(et,{brighter:function(t){return new Mt(this.h,this.c,this.l+Mi*(null==t?1:t),this.opacity)},darker:function(t){return new Mt(this.h,this.c,this.l-Mi*(null==t?1:t),this.opacity)},rgb:function(){return pt(this).rgb()}}));var ji=-.14861,Di=1.78277,Li=-.29227,Ei=-.90649,Yi=1.97294,Xi=Yi*Ei,Ui=Yi*Di,Fi=Di*Li-Ei*ji;ai(zt,kt,nt(et,{brighter:function(t){return t=null==t?si:Math.pow(si,t),new zt(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?ui:Math.pow(ui,t),new zt(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=isNaN(this.h)?0:(this.h+120)*wi,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*(ji*r+Di*o)),255*(n+e*(Li*r+Ei*o)),255*(n+e*(Yi*r)),this.opacity)}}));var Oi,Bi,Hi,Pi,Wi=function(t){return function(){return t}},Zi=function t(n){function e(t,n){var e=r((t=ut(t)).r,(n=ut(n)).r),o=r(t.g,n.g),i=r(t.b,n.b),a=jt(t.opacity,n.opacity);return function(n){return t.r=e(n),t.g=o(n),t.b=i(n),t.opacity=a(n),t+""}}var r=At(n);return e.gamma=t,e}(1),qi=function(t,n){var e,r=n?n.length:0,o=t?Math.min(r,t.length):0,i=new Array(r),a=new Array(r);for(e=0;ei&&(o=n.slice(i,o),u[a]?u[a]+=o:u[++a]=o),(e=e[0])===(r=r[0])?u[a]?u[a]+=r:u[++a]=r:(u[++a]=null,s.push({i:a,x:Ri(e,r)})),i=$i.lastIndex;return iba&&e.stateau)if(Math.abs(c*u-s*l)>au&&o){var f=e-i,d=r-a,p=u*u+s*s,g=f*f+d*d,y=Math.sqrt(p),m=Math.sqrt(h),v=o*Math.tan((ou-Math.acos((p+h-g)/(2*y*m)))/2),x=v/m,_=v/y;Math.abs(x-1)>au&&(this._+="L"+(t+x*l)+","+(n+x*c)),this._+="A"+o+","+o+",0,0,"+ +(c*f>l*d)+","+(this._x1=t+_*u)+","+(this._y1=n+_*s)}else this._+="L"+(this._x1=t)+","+(this._y1=n);else;},arc:function(t,n,e,r,o,i){t=+t,n=+n,e=+e;var a=e*Math.cos(r),u=e*Math.sin(r),s=t+a,l=n+u,c=1^i,h=i?r-o:o-r;if(e<0)throw new Error("negative radius: "+e);null===this._x1?this._+="M"+s+","+l:(Math.abs(this._x1-s)>au||Math.abs(this._y1-l)>au)&&(this._+="L"+s+","+l),e&&(h>uu?this._+="A"+e+","+e+",0,1,"+c+","+(t-a)+","+(n-u)+"A"+e+","+e+",0,1,"+c+","+(this._x1=s)+","+(this._y1=l):(h<0&&(h=h%iu+iu),this._+="A"+e+","+e+",0,"+ +(h>=ou)+","+c+","+(this._x1=t+e*Math.cos(o))+","+(this._y1=n+e*Math.sin(o))))},rect:function(t,n,e,r){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+n)+"h"+ +e+"v"+ +r+"h"+-e+"Z"},toString:function(){return this._}};var su="$";Dn.prototype=Ln.prototype={constructor:Dn,has:function(t){return su+t in this},get:function(t){return this[su+t]},set:function(t,n){return this[su+t]=n,this},remove:function(t){var n=su+t;return n in this&&delete this[n]},clear:function(){for(var t in this)t[0]===su&&delete this[t]},keys:function(){var t=[];for(var n in this)n[0]===su&&t.push(n.slice(1));return t},values:function(){var t=[];for(var n in this)n[0]===su&&t.push(this[n]);return t},entries:function(){var t=[];for(var n in this)n[0]===su&&t.push({key:n.slice(1),value:this[n]});return t},size:function(){var t=0;for(var n in this)n[0]===su&&++t;return t},empty:function(){for(var t in this)if(t[0]===su)return!1;return!0},each:function(t){for(var n in this)n[0]===su&&t(this[n],n.slice(1),this)}};var lu=Ln.prototype;En.prototype=Yn.prototype={constructor:En,has:lu.has,add:function(t){return t+="",this[su+t]=t,this},remove:lu.remove,clear:lu.clear,values:lu.keys,size:lu.size,empty:lu.empty,each:lu.each};var cu=function(t){function n(t,n){var r,o,i=e(t,function(t,e){return r?r(t,e-1):(o=t,void(r=n?Un(t,n):Xn(t)))});return i.columns=o,i}function e(t,n){function e(){if(c>=l)return a;if(o)return o=!1,i;var n,e=c;if(34===t.charCodeAt(e)){for(var r=e;r++t||t>o||r>n||n>i))return this;var a,u,s=o-e,l=this._root;switch(u=(n<(r+i)/2)<<1|t<(e+o)/2){case 0:do a=new Array(4),a[u]=l,l=a;while(s*=2,o=e+s,i=r+s,t>o||n>i);break;case 1:do a=new Array(4),a[u]=l,l=a;while(s*=2,e=o-s,i=r+s,e>t||n>i);break;case 2:do a=new Array(4),a[u]=l,l=a;while(s*=2,o=e+s,r=i-s,t>o||r>n);break;case 3:do a=new Array(4),a[u]=l,l=a;while(s*=2,e=o-s,r=i-s,e>t||r>n)}this._root&&this._root.length&&(this._root=l)}return this._x0=e,this._y0=r,this._x1=o,this._y1=i,this},mu=function(){var t=[];return this.visit(function(n){if(!n.length)do t.push(n.data);while(n=n.next)}),t},vu=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]},xu=function(t,n,e,r,o){this.node=t,this.x0=n,this.y0=e,this.x1=r,this.y1=o},_u=function(t,n,e){var r,o,i,a,u,s,l,c=this._x0,h=this._y0,f=this._x1,d=this._y1,p=[],g=this._root;for(g&&p.push(new xu(g,c,h,f,d)),null==e?e=1/0:(c=t-e,h=n-e,f=t+e,d=n+e,e*=e);s=p.pop();)if(!(!(g=s.node)||(o=s.x0)>f||(i=s.y0)>d||(a=s.x1)=m)<<1|t>=y)&&(s=p[p.length-1],p[p.length-1]=p[p.length-1-l],p[p.length-1-l]=s)}else{var v=t-+this._x.call(null,g.data),x=n-+this._y.call(null,g.data),_=v*v+x*x;if(_=(u=(p+y)/2))?p=u:y=u,(c=a>=(s=(g+m)/2))?g=s:m=s,n=d,!(d=d[h=c<<1|l]))return this;if(!d.length)break;(n[h+1&3]||n[h+2&3]||n[h+3&3])&&(e=n,f=h)}for(;d.data!==t;)if(r=d,!(d=d.next))return this;return(o=d.next)&&delete d.next,r?(o?r.next=o:delete r.next,this):n?(o?n[h]=o:delete n[h],(d=n[0]||n[1]||n[2]||n[3])&&d===(n[3]||n[2]||n[1]||n[0])&&!d.length&&(e?e[f]=d:this._root=d),this):(this._root=o,this)},bu=function(){return this._root},Mu=function(){var t=0;return this.visit(function(n){if(!n.length)do++t;while(n=n.next)}),t},Tu=function(t){var n,e,r,o,i,a,u=[],s=this._root;for(s&&u.push(new xu(s,this._x0,this._y0,this._x1,this._y1));n=u.pop();)if(!t(s=n.node,r=n.x0,o=n.y0,i=n.x1,a=n.y1)&&s.length){var l=(r+i)/2,c=(o+a)/2;(e=s[3])&&u.push(new xu(e,l,c,i,a)),(e=s[2])&&u.push(new xu(e,r,c,l,a)),(e=s[1])&&u.push(new xu(e,l,o,i,c)),(e=s[0])&&u.push(new xu(e,r,o,l,c))}return this},ku=function(t){var n,e=[],r=[];for(this._root&&e.push(new xu(this._root,this._x0,this._y0,this._x1,this._y1));n=e.pop();){ -var o=n.node;if(o.length){var i,a=n.x0,u=n.y0,s=n.x1,l=n.y1,c=(a+s)/2,h=(u+l)/2;(i=o[0])&&e.push(new xu(i,a,u,c,h)),(i=o[1])&&e.push(new xu(i,c,u,s,h)),(i=o[2])&&e.push(new xu(i,a,h,c,l)),(i=o[3])&&e.push(new xu(i,c,h,s,l))}r.push(n)}for(;n=r.pop();)t(n.node,n.x0,n.y0,n.x1,n.y1);return this},zu=function(t){return arguments.length?(this._x=t,this):this._x},Su=function(t){return arguments.length?(this._y=t,this):this._y},Cu=Zn.prototype=qn.prototype;Cu.copy=function(){var t,n,e=new qn(this._x,this._y,this._x0,this._y0,this._x1,this._y1),r=this._root;if(!r)return e;if(!r.length)return e._root=In(r),e;for(t=[{source:r,target:e._root=new Array(4)}];r=t.pop();)for(var o=0;o<4;++o)(n=r.source[o])&&(n.length?t.push({source:n,target:r.target[o]=new Array(4)}):r.target[o]=In(n));return e},Cu.add=gu,Cu.addAll=Bn,Cu.cover=yu,Cu.data=mu,Cu.extent=vu,Cu.find=_u,Cu.remove=wu,Cu.removeAll=Hn,Cu.root=bu,Cu.size=Mu,Cu.visit=Tu,Cu.visitAfter=ku,Cu.x=zu,Cu.y=Su;var Nu,Au=function(t,n){if((e=(t=n?t.toExponential(n-1):t.toExponential()).indexOf("e"))<0)return null;var e,r=t.slice(0,e);return[r.length>1?r[0]+r.slice(2):r,+t.slice(e+1)]},ju=function(t){return t=Au(Math.abs(t)),t?t[1]:NaN},Du=function(t,n){return function(e,r){for(var o=e.length,i=[],a=0,u=t[0],s=0;o>0&&u>0&&(s+u+1>r&&(u=Math.max(1,r-s)),i.push(e.substring(o-=u,o+u)),!((s+=u+1)>r));)u=t[a=(a+1)%t.length];return i.reverse().join(n)}},Lu=function(t,n){t=t.toPrecision(n);t:for(var e,r=t.length,o=1,i=-1;o0&&(i=0)}return i>0?t.slice(0,i)+t.slice(e+1):t},Eu=function(t,n){var e=Au(t,n);if(!e)return t+"";var r=e[0],o=e[1],i=o-(Nu=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")+Au(t,Math.max(0,n+i-1))[0]},Yu=function(t,n){var e=Au(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")},Xu={"":Lu,"%":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 Yu(100*t,n)},r:Yu,s:Eu,X:function(t){return Math.round(t).toString(16).toUpperCase()},x:function(t){return Math.round(t).toString(16)}},Uu=/^(?:(.)?([<>=^]))?([+\-\( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?([a-z%])?$/i,Fu=function(t){return new Rn(t)};Rn.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.type};var Ou,Bu,Hu,Pu=["y","z","a","f","p","n","ยต","m","","k","M","G","T","P","E","Z","Y"],Wu=function(t){function n(t){function n(t){var n,o,s,v=p,x=g;if("c"===d)x=y(t)+x,t="";else{t=+t;var _=(t<0||1/t<0)&&(t*=-1,!0);if(t=y(t,f),_)for(n=-1,o=t.length,_=!1;++ns||s>57){x=(46===s?i+t.slice(n+1):t.slice(n))+x,t=t.slice(0,n);break}}h&&!l&&(t=r(t,1/0));var w=v.length+t.length+x.length,b=w>1)+v+t+x+b.slice(w)}return b+v+t+x}t=Fu(t);var e=t.fill,a=t.align,u=t.sign,s=t.symbol,l=t.zero,c=t.width,h=t.comma,f=t.precision,d=t.type,p="$"===s?o[0]:"#"===s&&/[boxX]/.test(d)?"0"+d.toLowerCase():"",g="$"===s?o[1]:/[%p]/.test(d)?"%":"",y=Xu[d],m=!d||/[defgprs%]/.test(d);return f=null==f?d?6:12:/[gprs]/.test(d)?Math.max(1,Math.min(21,f)):Math.max(0,Math.min(20,f)),n.toString=function(){return t+""},n}function e(t,e){var r=n((t=Fu(t),t.type="f",t)),o=3*Math.max(-8,Math.min(8,Math.floor(ju(e)/3))),i=Math.pow(10,-o),a=Pu[8+o/3];return function(t){return r(i*t)+a}}var r=t.grouping&&t.thousands?Du(t.grouping,t.thousands):Gn,o=t.currency,i=t.decimal;return{format:n,formatPrefix:e}};Vn({decimal:".",thousands:",",grouping:[3],currency:["$",""]});var Zu=function(t){return Math.max(0,-ju(Math.abs(t)))},qu=function(t,n){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(ju(n)/3)))-ju(Math.abs(t)))},Iu=function(t,n){return t=Math.abs(t),n=Math.abs(n)-t,Math.max(0,ju(n)-ju(t))+1},Ru=function(){return new $n};$n.prototype={constructor:$n,reset:function(){this.s=this.t=0},add:function(t){Jn(Gu,t,this.t),Jn(this,Gu.s,this.s),this.s?this.t+=Gu.t:this.s=Gu.t},valueOf:function(){return this.s}};var Gu=new $n,Vu=1e-6,$u=Math.PI,Ju=$u/2,Qu=$u/4,Ku=2*$u,ts=$u/180,ns=Math.abs,es=Math.atan,rs=Math.atan2,os=Math.cos,is=Math.sin,as=Math.sqrt,us=(Ru(),Ru(),Ru(),function(){var t,n=[];return{point:function(n,e){t.push([n,e])},lineStart:function(){n.push(t=[])},lineEnd:te,rejoin:function(){n.length>1&&n.push(n.pop().concat(n.shift()))},result:function(){var e=n;return n=[],t=null,e}}}),ss=function(t,n){return ns(t[0]-n[0])=0;--i)o.point((c=l[i])[0],c[1]);else r(f.x,f.p.x,-1,o);f=f.p}f=f.o,l=f.z,d=!d}while(!f.v);o.lineEnd()}}},cs=(Ru(),Ru(),Ru(),Ru()),hs=function(t,n){var e=n[0],r=n[1],o=[is(e),-os(e),0],i=0,a=0;cs.reset();for(var u=0,s=t.length;u=0?1:-1,T=M*b,k=T>$u,z=p*_;if(cs.add(rs(z*M*is(T),g*w+z*os(T))),i+=k?b+M*Ku:b,k^f>=e^v>=e){var S=ee(ne(h),ne(m));re(S);var C=ee(o,S);re(C);var N=(k^b>=0?-1:1)*Kn(C[2]);(r>N||r===N&&(S[0]||S[1]))&&(a+=k^b>=0?1:-1)}}return(i<-Vu||i0){for(_||(i.polygonStart(),_=!0),i.lineStart(),t=0;t1&&2&o&&a.push(a.pop().concat(a.shift())),p.push(a.filter(ae))}var d,p,g,y=n(i),m=o.invert(r[0],r[1]),v=us(),x=n(v),_=!1,w={point:a,lineStart:s,lineEnd:l,polygonStart:function(){w.point=c,w.lineStart=h,w.lineEnd=f,p=[],d=[]},polygonEnd:function(){w.point=a,w.lineStart=s,w.lineEnd=l,p=io(p);var t=hs(d,m);p.length?(_||(i.polygonStart(),_=!0),ls(p,ue,t,e,i)):t&&(_||(i.polygonStart(),_=!0),i.lineStart(),e(null,null,1,i),i.lineEnd()),_&&(i.polygonEnd(),_=!1),p=d=null},sphere:function(){i.polygonStart(),i.lineStart(),e(null,null,1,i),i.lineEnd(),i.polygonEnd()}};return w}};fs(function(){return!0},se,ce,[-$u,-Ju]);var ds=(os(30*ts),he(function(t){return as(2/(1+t))}));ds.invert=fe(function(t){return 2*Kn(t/2)});var ps=he(function(t){return(t=Qn(t))&&t/is(t)});ps.invert=fe(function(t){return t});var gs=function(t){var n,e,r,o,i=this,a=[i];do for(n=a.reverse(),a=[];i=n.pop();)if(t(i),e=i.children)for(r=0,o=e.length;r=0;--e)o.push(n[e]);return this},ms=function(t){for(var n,e,r,o=this,i=[o],a=[];o=i.pop();)if(a.push(o),n=o.children)for(e=0,r=n.length;e=0;)e+=r[o].value;n.value=e})},xs=function(t){return this.eachBefore(function(n){n.children&&n.children.sort(t)})},_s=function(t){for(var n=this,e=de(n,t),r=[n];n!==e;)n=n.parent,r.push(n);for(var o=r.length;t!==e;)r.splice(o,0,t),t=t.parent;return r},ws=function(){for(var t=this,n=[t];t=t.parent;)n.push(t);return n},bs=function(){var t=[];return this.each(function(n){t.push(n)}),t},Ms=function(){var t=[];return this.eachBefore(function(n){n.children||t.push(n)}),t},Ts=function(){var t=this,n=[];return t.each(function(e){e!==t&&n.push({source:e.parent,target:e})}),n};xe.prototype=pe.prototype={constructor:xe,each:gs,eachAfter:ms,eachBefore:ys,sum:vs,sort:xs,path:_s,ancestors:ws,descendants:bs,leaves:Ms,links:Ts,copy:ge};_e.prototype=Object.create(xe.prototype);var ks=([].slice,{}),zs=function(t,n){function r(t){var n,e=c.status;if(!e&&Se(c)||e>=200&&e<300||304===e){if(a)try{n=a.call(o,c)}catch(t){return void s.call("error",o,t)}else n=c;s.call("load",o,n)}else s.call("error",o,t)}var o,i,a,u,s=e("beforesend","progress","load","error"),l=Ln(),c=new XMLHttpRequest,h=null,f=null,d=0;if("undefined"==typeof XDomainRequest||"withCredentials"in c||!/^(http(s)?:)?\/\//.test(t)||(c=new XDomainRequest),"onload"in c?c.onload=c.onerror=c.ontimeout=r:c.onreadystatechange=function(t){c.readyState>3&&r(t)},c.onprogress=function(t){s.call("progress",o,t)},o={header:function(t,n){return t=(t+"").toLowerCase(),arguments.length<2?l.get(t):(null==n?l.remove(t):l.set(t,n+""),o)},mimeType:function(t){return arguments.length?(i=null==t?null:t+"",o):i},responseType:function(t){return arguments.length?(u=t,o):u},timeout:function(t){return arguments.length?(d=+t,o):d},user:function(t){return arguments.length<1?h:(h=null==t?null:t+"",o)},password:function(t){return arguments.length<1?f:(f=null==t?null:t+"",o)},response:function(t){return a=t,o},get:function(t,n){return o.send("GET",t,n)},post:function(t,n){return o.send("POST",t,n)},send:function(n,e,r){return c.open(n,t,!0,h,f),null==i||l.has("accept")||l.set("accept",i+",*/*"),c.setRequestHeader&&l.each(function(t,n){c.setRequestHeader(n,t)}),null!=i&&c.overrideMimeType&&c.overrideMimeType(i),null!=u&&(c.responseType=u),d>0&&(c.timeout=d),null==r&&"function"==typeof e&&(r=e,e=null),null!=r&&1===r.length&&(r=ze(r)),null!=r&&o.on("error",r).on("load",function(t){r(null,t)}),s.call("beforesend",o,c),c.send(null==e?null:e),o},abort:function(){return c.abort(),o},on:function(){var t=s.on.apply(s,arguments);return t===s?o:t}},null!=n){if("function"!=typeof n)throw new Error("invalid callback: "+n);return o.get(n)}return o},Ss=function(t,n){return function(e,r){var o=zs(e).mimeType(t).response(n);if(null!=r){if("function"!=typeof r)throw new Error("invalid callback: "+r);return o.get(r)}return o}};Ss("text/html",function(t){return document.createRange().createContextualFragment(t.responseText)});var Cs=Ss("application/json",function(t){return JSON.parse(t.responseText)});Ss("text/plain",function(t){return t.responseText}),Ss("application/xml",function(t){var n=t.responseXML;if(!n)throw new Error("parse error");return n});var Ns=function(t,n){return function(e,r,o){arguments.length<3&&(o=r,r=null);var i=zs(e).mimeType(t);return i.row=function(t){return arguments.length?i.response(Ce(n,r=t)):r},i.row(r),o?i.get(o):i}};Ns("text/csv",fu),Ns("text/tab-separated-values",pu);var As=Array.prototype,js=As.map,Ds=As.slice,Ls=function(t){return function(){return t}},Es=function(t){return+t},Ys=[0,1],Xs=function(t,e,r){var o,i=t[0],a=t[t.length-1],u=n(i,a,null==e?10:e);switch(r=Fu(null==r?",f":r),r.type){case"s":var s=Math.max(Math.abs(i),Math.abs(a));return null!=r.precision||isNaN(o=qu(u,s))||(r.precision=o),Hu(r,s);case"":case"e":case"g":case"p":case"r":null!=r.precision||isNaN(o=Iu(u,Math.max(Math.abs(i),Math.abs(a))))||(r.precision=o-("e"===r.type));break;case"f":case"%":null!=r.precision||isNaN(o=Zu(u))||(r.precision=o-2*("%"===r.type))}return Bu(r)},Us=new Date,Fs=new Date,Os=Fe(function(){},function(t,n){t.setTime(+t+n)},function(t,n){return n-t});Os.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?Fe(function(n){n.setTime(Math.floor(n/t)*t)},function(n,e){n.setTime(+n+e*t)},function(n,e){return(e-n)/t}):Os:null};var Bs=1e3,Hs=6e4,Ps=36e5,Ws=864e5,Zs=6048e5,qs=(Fe(function(t){t.setTime(Math.floor(t/Bs)*Bs)},function(t,n){t.setTime(+t+n*Bs)},function(t,n){return(n-t)/Bs},function(t){return t.getUTCSeconds()}),Fe(function(t){t.setTime(Math.floor(t/Hs)*Hs)},function(t,n){t.setTime(+t+n*Hs)},function(t,n){return(n-t)/Hs},function(t){return t.getMinutes()}),Fe(function(t){var n=t.getTimezoneOffset()*Hs%Ps;n<0&&(n+=Ps),t.setTime(Math.floor((+t-n)/Ps)*Ps+n)},function(t,n){t.setTime(+t+n*Ps)},function(t,n){return(n-t)/Ps},function(t){return t.getHours()}),Fe(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())*Hs)/Ws},function(t){return t.getDate()-1})),Is=Oe(0),Rs=Oe(1),Gs=(Oe(2),Oe(3),Oe(4),Oe(5),Oe(6),Fe(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()}),Fe(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()}));Gs.every=function(t){return isFinite(t=Math.floor(t))&&t>0?Fe(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 Vs=(Fe(function(t){t.setUTCSeconds(0,0)},function(t,n){t.setTime(+t+n*Hs)},function(t,n){return(n-t)/Hs},function(t){return t.getUTCMinutes()}),Fe(function(t){t.setUTCMinutes(0,0,0)},function(t,n){t.setTime(+t+n*Ps)},function(t,n){return(n-t)/Ps},function(t){return t.getUTCHours()}),Fe(function(t){t.setUTCHours(0,0,0,0)},function(t,n){t.setUTCDate(t.getUTCDate()+n)},function(t,n){return(n-t)/Ws},function(t){return t.getUTCDate()-1})),$s=Be(0),Js=Be(1),Qs=(Be(2),Be(3),Be(4),Be(5),Be(6),Fe(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()}),Fe(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()}));Qs.every=function(t){return isFinite(t=Math.floor(t))&&t>0?Fe(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 Ks,tl,nl,el,rl,ol={"-":"",_:" ",0:"0"},il=/^\s*\d+/,al=/^%/,ul=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;Fr({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"]});var sl="%Y-%m-%dT%H:%M:%S.%LZ",ll=(Date.prototype.toISOString?Or:el(sl),+new Date("2000-01-01T00:00:00.000Z")?Br:rl(sl),function(t){return t.match(/.{6}/g).map(function(t){return"#"+t})});ll("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf"),ll("393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6"),ll("3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9"),ll("1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5"),ua(kt(300,.5,0),kt(-240,.5,1));ua(kt(-100,.75,.35),kt(80,1.5,.8)),ua(kt(260,.75,.35),kt(80,1.5,.8)),kt();Hr.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;default:this._context.lineTo(t,n)}}};Ir.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:qr(this,this._t0,Zr(this,this._t0))}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){var e=NaN;if(t=+t,n=+n,t!==this._x1||n!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;break;case 2:this._point=3,qr(this,Zr(this,e=Wr(this,t,n)),e);break;default:qr(this,this._t0,e=Wr(this,t,n))}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n,this._t0=e}}},(Rr.prototype=Object.create(Ir.prototype)).point=function(t,n){Ir.prototype.point.call(this,n,t)},Gr.prototype={moveTo:function(t,n){this._context.moveTo(n,t)},closePath:function(){this._context.closePath()},lineTo:function(t,n){this._context.lineTo(n,t)},bezierCurveTo:function(t,n,e,r,o,i){this._context.bezierCurveTo(n,t,r,e,i,o)}};oi("body").append("link").attr("href","https://fonts.googleapis.com/css?family=Inconsolata").attr("rel","stylesheet");var cl={svg:{height:650,width:650},axis:{left:70,right:520,top:100,bottom:550,color:"white"},grid:{spacing:10,lineWidth:.5,color:"#D0D0D0",crosshairs:{opacity:.06,color:"gray",label:{font:"sans-serif",fontSize:"10px",padX:4,padY:11,duration:200}}},shadow:{dx:5,dy:5,std:8,scale:.2},legend:{left:70,right:520,top:565,bottom:590,rx:10,ry:10,padX:15,padY:5,fill:"none",stroke:"none",font:"sans-serif",fontSize:"10px",rows:2,columns:7,glyph:{width:6,height:6,textX:5,textY:3.5,content:[{idx:0,label:"Positive",group:"c4"},{idx:1,label:"Polar -OH",group:"c7"},{idx:2,label:"Hydrophobic",group:"c0"},{idx:3,label:"Cysteine",group:"c2"},{idx:7,label:"Negative",group:"c5"},{idx:8,label:"Polar -CON",group:"c6"},{idx:9,label:"Aromatic",group:"c1"}]},magnitude:{idx:4,textX:13,textY:3.5,shiftX:43,offsets:[-27,-16,-7,0,5],radii:[6,5,4,3,2]},cmap:{idx:11,leftX:-25,leftY:3.5,rightX:26,rightY:3.5,shiftX:30,height:6,width:42,blocks:7}},logo:{data:[],font:["Inconsolata","sans-serif"],height:25,fontScale:.2,bitScale:4,opacity:1,pad:2,axis:{pad:2,max:Math.log2(20),majorTicks:[0,1,2,3,4],minorTicks:[.5,1.5,2.5],majorLength:2.5,minorLength:1,textX:-6,stroke:"black",strokeWidth:.5},zoom:{height:60,lift:40,width:150,radius:5,fontScale:1.5,duration:100,destroyDuration:150,delay:0,opacity:0,easeFun:Sn,underline:{color:"gray",width:.5,pad:2.5,notchRadius:2.5,notchHeight:3,duration:300,delay:75}}},couplings:{data:[],fill:"#B8B8B8",highlight:"gray",matchColor:"white",stroke:"white",strokeWidth:.5,maxRadius:3.5},times:{globalTick:10,destroyDuration:0,buildDuration:300,matchedTimeThreshold:150},matrix:{x:335,y:650,cellSize:15,opacity:.8,gridColor:"#D0D0D0",gridWidth:.5,textUp:2,textOver:2.5,font:"Inconsolata",fontSize:"20px",background:{fill:"white",stroke:"#D0D0D0",strokeWidth:.5,padRight:19,padTop:19,padLeft:5,padBottom:5,opacity:.8},cscale:Ue().domain([-1,0,1]).range(["#3374FF","white","#FFBE33"])},state:{viewerLoaded:0,x:0,y:0,i:0,j:0,iOld:0,jOld:0,focus:-1,zoomBuilt:0,matchedTime:0,matchedBuilt:0}};cl.aaGroups={".":"gr","-":"gr",G:"c0",A:"c0",I:"c0",V:"c0",L:"c0",M:"c0",F:"c1",Y:"c1",W:"c1",H:"c4",C:"c2",P:"c3",K:"c4",R:"c4",D:"c5",E:"c5",Q:"c6",N:"c6",S:"c7",T:"c7",B:"c8",Z:"c8",X:"c8","?":"c9","*":"c8",U:"bl"},cl.groupColors={gr:"grey",bl:"black",m0:"blue",m1:"red",c0:"#33cc00",c1:"#009900",c2:"#ffff00",c3:"#33cc00",c4:"#cc0000",c5:"#0033ff",c6:"#6600cc",c7:"#0099ff",c8:"#666666",c9:"#999999"},cl.plotWidth=function(){return cl.axis.right-cl.axis.left},cl.plotHeight=function(){return cl.axis.bottom-cl.axis.top},cl.iToX=function(t){return cl.axis.left+t*(cl.axis.right-cl.axis.left)/cl.logo.data.length},cl.jToY=function(t){return cl.axis.top+t*(cl.axis.bottom-cl.axis.top)/cl.logo.data.length},cl.focusLength=function(t){return t*(cl.axis.right-cl.axis.left)/cl.logo.data.length},cl.barWidth=function(){return(cl.axis.right-cl.axis.left)/cl.logo.data.length},cl.radiusFun=function(t){return cl.couplings.maxRadius*Math.sqrt(t)},cl.tick=function(){var t=cl.state.i!=cl.state.iOld||cl.state.j!=cl.state.jOld;cl.state.viewerLoaded>0&&(0!=cl.state.matchedBuilt||t?cl.state.matchedTime=0:cl.state.matchedTime+=cl.times.globalTick);var n=cl.state.matchedTime-cl.times.matchedTimeThreshold;n>0&&ncl.axis.top&&cl.state.ycl.axis.left&&cl.state.xcl.times.matchedTimeThreshold;if(cl.state.viewerLoaded>0&&(r||o&&0==cl.state.matchedBuilt)){if(e&&(0==cl.state.matchedBuilt&&o||1==cl.state.matchedBuilt&&r)){cl.state.matchedBuilt=1;for(var i=-1,a=0;a=0&&(u=Vr(cl.state.i,cl.state.j,t[cl.state.focus].i-1,t[cl.state.focus].j-1)-cl.radiusFun(t[cl.state.focus].score)),u>cl.logo.zoom.radius){ii("#legendCmap").transition().attr("opacity",0).delay(0).duration(cl.times.destroyDuration),oi("#matrixBG").transition().attr("opacity",0).delay(0).duration(cl.times.buildDuration);for(var s=0;s<20;s++)for(var l=0;l<20;l++)oi("#disp"+s+"-"+l).transition().style("opacity",0).delay(0).duration(cl.times.destroyDuration),oi("#biC"+s).transition().style("opacity",0).delay(0).duration(cl.times.destroyDuration),oi("#bjC"+l).transition().style("opacity",0).delay(0).duration(cl.times.destroyDuration);cl.state.focus=-1,cl.state.matchedBuilt=0,cl.state.matchedTime=0}if(i>=0&&i!=cl.state.focus){console.log("Zooming at "+(cl.state.i+1)+", "+(cl.state.j+1));for(var s=0;s<20;s++)for(var l=0;l<20;l++)cl.matrix.nodes.cells[s][l].transition().style("opacity",0).delay(0).duration(cl.times.destroyDuration),cl.matrix.nodes.iLabels[s].transition().style("opacity",0),cl.matrix.nodes.jLabels[l].transition().style("opacity",0);cl.state.i+1,cl.state.j+1;cl.couplings.nodes.circles[i].transition().attr("fill",cl.couplings.fill).delay(0).duration(cl.times.buildDuration);var c=cl.iToX(cl.state.i)+cl.matrix.background.padLeft,h=cl.jToY(cl.state.j)+cl.matrix.background.padTop,f=t[i].matrix.length*cl.matrix.cellSize+cl.matrix.background.padRight+cl.matrix.background.padLeft,d=t[i].matrix[0].length*cl.matrix.cellSize+cl.matrix.background.padTop+cl.matrix.background.padBottom;ii("#legendCmap").transition().attr("opacity",1).delay(cl.times.destroyDuration).duration(cl.times.buildDuration),oi("#matrixBG").attr("x",c-cl.matrix.background.padLeft).attr("y",h-cl.matrix.background.padTop).attr("width",0).attr("height",0),oi("#matrixBG").transition().attr("width",f).attr("height",d).attr("opacity",cl.matrix.background.opacity).delay(cl.times.destroyDuration).duration(cl.times.buildDuration);for(var s=0;s=cl.state.i-cl.logo.zoom.radius&&t[a].i-1<=cl.state.i+cl.logo.zoom.radius||t[a].j-1>=cl.state.j-cl.logo.zoom.radius&&t[a].j-1<=cl.state.j+cl.logo.zoom.radius)?cl.couplings.nodes.circles[a].attr("fill",cl.couplings.highlight):cl.couplings.nodes.circles[a].attr("fill",cl.couplings.fill)}if(1==cl.state.zoomBuilt&&!e){console.log("Contracting logo");for(var y=Math.max(0,cl.state.iOld-cl.logo.zoom.radius),m=Math.min(n.length-1,cl.state.iOld+cl.logo.zoom.radius),s=y;s<=m;s++)for(var b=0,l=0;lm)for(var b=0,l=0;lm)for(var b=0,l=0;ln.bits?1:0:au?1:0})}},cl.prepareCouplings=function(){cl.couplings.data.sort(function(t,n){return t.score>n.score?-1:t.scoret&&(t=cl.couplings.data[n].score);for(var n=0;ne&&(e=Math.abs(cl.couplings.data[n].matrix[r][o]));for(var n=0;nn&&(cl.state.viewerLoaded=1)},0);setInterval(cl.tick,cl.times.globalTick)},cl.initialize=function(){var t="",n=oi("#evzoom-viewer");n.empty()||(t=n.node().getAttribute("data-couplings"));for(var e="",r=/([^&=]+)=?([^&]*)/g,o=window.location.search.substring(1);e=r.exec(o);)e.length>2&&"data"==e[1]&&(t=e[2]);console.log("Loading "+t),Cs(t).on("progress",function(){null!=mo&&mo.hasAttribute("loaded")&&console.log("progress",mo.loaded)}).on("load",cl.prepareData).on("error",function(t){console.log("failure!",t)}).get()},cl.initialize()}); +!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n():"function"==typeof define&&define.amd?define(n):n()}(this,function(){"use strict";function t(t){return function(n,e){return $r(t(n),e)}}function n(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>=no?o*=10:i>=eo?o*=5:i>=ro&&(o*=2),n=0&&(e=t.slice(r+1),t=t.slice(0,r)),t&&!n.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}})}function i(t,n){for(var e,r=0,o=t.length;r=0&&(n=t.slice(e+1),t=t.slice(0,e)),{type:t,name:n}})}function f(t){return function(){var n=this.__on;if(n){for(var e,r=0,o=-1,i=n.length;rn?1:t>=n?0:NaN}function _(t){return function(){this.removeAttribute(t)}}function w(t){return function(){this.removeAttributeNS(t.space,t.local)}}function b(t,n){return function(){this.setAttribute(t,n)}}function M(t,n){return function(){this.setAttributeNS(t.space,t.local,n)}}function T(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttribute(t):this.setAttribute(t,e)}}function k(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,e)}}function z(t){return function(){this.style.removeProperty(t)}}function S(t,n,e){return function(){this.style.setProperty(t,n,e)}}function C(t,n,e){return function(){var r=n.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,e)}}function N(t){return function(){delete this[t]}}function A(t,n){return function(){this[t]=n}}function j(t,n){return function(){var e=n.apply(this,arguments);null==e?delete this[t]:this[t]=e}}function D(t){return t.trim().split(/^|\s+/)}function L(t){return t.classList||new E(t)}function E(t){this._node=t,this._names=D(t.getAttribute("class")||"")}function F(t,n){for(var e=L(t),r=-1,o=n.length;++r>8&15|n>>4&240,n>>4&15|240&n,(15&n)<<4|15&n,1)):(n=di.exec(t))?ot(parseInt(n[1],16)):(n=pi.exec(t))?new st(n[1],n[2],n[3],1):(n=gi.exec(t))?new st(255*n[1]/100,255*n[2]/100,255*n[3]/100,1):(n=yi.exec(t))?it(n[1],n[2],n[3],n[4]):(n=mi.exec(t))?it(255*n[1]/100,255*n[2]/100,255*n[3]/100,n[4]):(n=vi.exec(t))?lt(n[1],n[2]/100,n[3]/100,1):(n=xi.exec(t))?lt(n[1],n[2]/100,n[3]/100,n[4]):_i.hasOwnProperty(t)?ot(_i[t]):"transparent"===t?new st(NaN,NaN,NaN,0):null}function ot(t){return new st(t>>16&255,t>>8&255,255&t,1)}function it(t,n,e,r){return r<=0&&(t=n=e=NaN),new st(t,n,e,r)}function at(t){return t instanceof et||(t=rt(t)),t?(t=t.rgb(),new st(t.r,t.g,t.b,t.opacity)):new st}function ut(t,n,e,r){return 1===arguments.length?at(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 lt(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 ct(t){if(t instanceof ft)return new ft(t.h,t.s,t.l,t.opacity);if(t instanceof et||(t=rt(t)),!t)return new ft;if(t instanceof ft)return t;t=t.rgb();var n=t.r/255,e=t.g/255,r=t.b/255,o=Math.min(n,e,r),i=Math.max(n,e,r),a=NaN,u=i-o,s=(i+o)/2;return u?(a=n===i?(e-r)/u+6*(e0&&s<1?0:a,new ft(a,u,s,t.opacity)}function ht(t,n,e,r){return 1===arguments.length?ct(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 dt(t,n,e){return 255*(t<60?n+(e-n)*t/60:t<180?e:t<240?n+(e-n)*(240-t)/60:n)}function pt(t){if(t instanceof yt)return new yt(t.l,t.a,t.b,t.opacity);if(t instanceof Mt){var n=t.h*wi;return new yt(t.l,Math.cos(n)*t.c,Math.sin(n)*t.c,t.opacity)}t instanceof st||(t=at(t));var e=_t(t.r),r=_t(t.g),o=_t(t.b),i=mt((.4124564*e+.3575761*r+.1804375*o)/Ti),a=mt((.2126729*e+.7151522*r+.072175*o)/ki),u=mt((.0193339*e+.119192*r+.9503041*o)/zi);return new yt(116*a-16,500*(i-a),200*(a-u),t.opacity)}function gt(t,n,e,r){return 1===arguments.length?pt(t):new yt(t,n,e,null==r?1:r)}function yt(t,n,e,r){this.l=+t,this.a=+n,this.b=+e,this.opacity=+r}function mt(t){return t>Ai?Math.pow(t,1/3):t/Ni+Si}function vt(t){return t>Ci?t*t*t:Ni*(t-Si)}function xt(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function _t(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function wt(t){if(t instanceof Mt)return new Mt(t.h,t.c,t.l,t.opacity);t instanceof yt||(t=pt(t));var n=Math.atan2(t.b,t.a)*bi;return new Mt(n<0?n+360:n,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}function bt(t,n,e,r){return 1===arguments.length?wt(t):new Mt(t,n,e,null==r?1:r)}function Mt(t,n,e,r){this.h=+t,this.c=+n,this.l=+e,this.opacity=+r}function Tt(t){if(t instanceof zt)return new zt(t.h,t.s,t.l,t.opacity);t instanceof st||(t=at(t));var n=t.r/255,e=t.g/255,r=t.b/255,o=(Ui*r+Yi*n-Xi*e)/(Ui+Yi-Xi),i=r-o,a=(Fi*(e-o)-Li*i)/Ei,u=Math.sqrt(a*a+i*i)/(Fi*o*(1-o)),s=u?Math.atan2(a,i)*bi-120:NaN;return new zt(s<0?s+360:s,u,o,t.opacity)}function kt(t,n,e,r){return 1===arguments.length?Tt(t):new zt(t,n,e,null==r?1:r)}function zt(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function St(t,n){return function(e){return t+e*n}}function Ct(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)}}function Nt(t,n){var e=n-t;return e?St(t,e>180||e<-180?e-360*Math.round(e/360):e):Wi(isNaN(t)?n:t)}function At(t){return 1===(t=+t)?jt:function(n,e){return e-n?Ct(n,e,t):Wi(isNaN(n)?e:n)}}function jt(t,n){var e=n-t;return e?St(t,e):Wi(isNaN(t)?n:t)}function Dt(t){return function(){return t}}function Lt(t){return function(n){return t(n)+""}}function Et(t){return"none"===t?na:(Bi||(Bi=document.createElement("DIV"),Oi=document.documentElement,Hi=document.defaultView),Bi.style.transform=t,t=Hi.getComputedStyle(Oi.appendChild(Bi),null).getPropertyValue("transform"),Oi.removeChild(Bi),t=t.slice(7,-1).split(","),ea(+t[0],+t[1],+t[2],+t[3],+t[4],+t[5]))}function Ft(t){return null==t?na:(Pi||(Pi=document.createElementNS("http://www.w3.org/2000/svg","g")),Pi.setAttribute("transform",t),(t=Pi.transform.baseVal.consolidate())?(t=t.matrix,ea(t.a,t.b,t.c,t.d,t.e,t.f)):na)}function Yt(t,n,e,r){function o(t){return t.length?t.pop()+" ":""}function i(t,r,o,i,a,u){if(t!==o||r!==i){var s=a.push("translate(",null,n,null,e);u.push({i:s-4,x:Ri(t,o)},{i:s-2,x:Ri(r,i)})}else(o||i)&&a.push("translate("+o+n+i+e)}function a(t,n,e,i){t!==n?(t-n>180?n+=360:n-t>180&&(t+=360),i.push({i:e.push(o(e)+"rotate(",null,r)-2,x:Ri(t,n)})):n&&e.push(o(e)+"rotate("+n+r)}function u(t,n,e,i){t!==n?i.push({i:e.push(o(e)+"skewX(",null,r)-2,x:Ri(t,n)}):n&&e.push(o(e)+"skewX("+n+r)}function s(t,n,e,r,i,a){if(t!==e||n!==r){var u=i.push(o(i)+"scale(",null,",",null,")");a.push({i:u-4,x:Ri(t,e)},{i:u-2,x:Ri(n,r)})}else 1===e&&1===r||i.push(o(i)+"scale("+e+","+r+")")}return function(n,e){var r=[],o=[];return n=t(n),e=t(e),i(n.translateX,n.translateY,e.translateX,e.translateY,r,o),a(n.rotate,e.rotate,r,o),u(n.skewX,e.skewX,r,o),s(n.scaleX,n.scaleY,e.scaleX,e.scaleY,r,o),n=e=null,function(t){for(var n,e=-1,i=o.length;++e=0&&n._call.call(null,t),n=n._next;--sa}function Wt(){da=(fa=ga.now())+pa,sa=la=0;try{Pt()}finally{sa=0,It(),da=0}}function qt(){var t=ga.now(),n=t-fa;n>ha&&(pa-=n,fa=t)}function It(){for(var t,n,e=ia,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:ia=n);aa=t,Zt(r)}function Zt(t){if(!sa){la&&(la=clearTimeout(la));var n=t-da;n>24?(t<1/0&&(la=setTimeout(Wt,n)),ca&&(ca=clearInterval(ca))):(ca||(fa=da,ca=setInterval(qt,ha)),sa=1,ya(Wt))}}function Rt(t,n){var e=t.__transition;if(!e||!(e=e[n])||e.state>_a)throw new Error("too late");return e}function Gt(t,n){var e=t.__transition;if(!e||!(e=e[n])||e.state>ba)throw new Error("too late");return e}function Vt(t,n){var e=t.__transition;if(!e||!(e=e[n]))throw new Error("too late");return e}function $t(t,n,e){function r(t){e.state=wa,e.timer.restart(o,e.delay,e.time),e.delay<=t&&o(t-e.delay)}function o(r){var l,c,h,f;if(e.state!==wa)return a();for(l in s)if(f=s[l],f.name===e.name){if(f.state===Ma)return ma(o);f.state===Ta?(f.state=za,f.timer.stop(),f.on.call("interrupt",t,t.__data__,f.index,f.group),delete s[l]):+l=0&&(t=t.slice(0,n)),!t||"start"===t})}function gn(t,n,e){var r,o,i=pn(n)?Rt:Gt;return function(){var a=i(this,t),u=a.on;u!==r&&(o=(r=u).copy()).on(n,e),a.on=o}}function yn(t){return function(){var n=this.parentNode;for(var e in this.__transition)if(+e!==t)return;n&&n.removeChild(this)}}function mn(t,n){var e,r,o;return function(){var i=qo(this).getComputedStyle(this,null),a=i.getPropertyValue(t),u=(this.style.removeProperty(t),i.getPropertyValue(t));return a===u?null:a===e&&u===r?o:o=n(e=a,r=u)}}function vn(t){return function(){this.style.removeProperty(t)}}function xn(t,n,e){var r,o;return function(){var i=qo(this).getComputedStyle(this,null).getPropertyValue(t);return i===e?null:i===r?o:o=n(r=i,e)}}function _n(t,n,e){var r,o,i;return function(){var a=qo(this).getComputedStyle(this,null),u=a.getPropertyValue(t),s=e(this);return null==s&&(this.style.removeProperty(t),s=a.getPropertyValue(t)),u===s?null:u===r&&s===o?i:i=n(r=u,o=s)}}function wn(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}function bn(t){return function(){this.textContent=t}}function Mn(t){return function(){var n=t(this);this.textContent=null==n?"":n}}function Tn(t,n,e,r){this._groups=t,this._parents=n,this._name=e,this._id=r}function kn(t){return tt().transition(t)}function zn(){return++Va}function Sn(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}function Cn(t,n){for(var e;!(e=t.__transition)||!(e=e[n]);)if(!(t=t.parentNode))return eu.time=Ut(),eu;return e}function Nn(t){return{type:t}}function An(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function jn(){return new An}function Dn(){}function Ln(t,n){var e=new Dn;if(t instanceof Dn)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(;++o=(i=(g+m)/2))?g=i:m=i,(c=e>=(a=(y+v)/2))?y=a:v=a,o=d,!(d=d[h=c<<1|l]))return o[h]=p,t;if(u=+t._x.call(null,d.data),s=+t._y.call(null,d.data),n===u&&e===s)return p.next=d,o?o[h]=p:t._root=p,t;do o=o?o[h]=new Array(4):t._root=new Array(4),(l=n>=(i=(g+m)/2))?g=i:m=i,(c=e>=(a=(y+v)/2))?y=a:v=a;while((h=c<<1|l)===(f=(s>=a)<<1|u>=i));return o[f]=d,o[h]=p,t}function On(t){var n,e,r,o,i=t.length,a=new Array(i),u=new Array(i),s=1/0,l=1/0,c=-(1/0),h=-(1/0);for(e=0;ec&&(c=r),oh&&(h=o));for(c",o=n[3]||"-",i=n[4]||"",a=!!n[5],u=n[6]&&+n[6],s=!!n[7],l=n[8]&&+n[8].slice(1),c=n[9]||"";"n"===c?(s=!0,c="g"):Yu[c]||(c=""),(a||"0"===e&&"="===r)&&(a=!0,e="0",r="="),this.fill=e,this.align=r,this.sign=o,this.symbol=i,this.zero=a,this.width=u,this.comma=s,this.precision=l,this.type=c}function Gn(t){return t}function Vn(t){return Bu=Wu(t),Ou=Bu.format,Hu=Bu.formatPrefix,Bu}function $n(){this.reset()}function Jn(t,n,e){var r=t.s=n+e,o=r-n,i=r-o;t.t=n-i+(e-o)}function Qn(t){return t>1?0:t<-1?$u:Math.acos(t)}function Kn(t){return t>1?Ju:t<-1?-Ju:Math.asin(t)}function te(){}function ne(t){var n=t[0],e=t[1],r=os(e);return[r*os(n),r*is(n),is(e)]}function ee(t,n){return[t[1]*n[2]-t[2]*n[1],t[2]*n[0]-t[0]*n[2],t[0]*n[1]-t[1]*n[0]]}function re(t){var n=as(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=n,t[1]/=n,t[2]/=n}function oe(t,n,e,r){this.x=t,this.z=n,this.o=e,this.e=r,this.v=!1,this.n=this.p=null}function ie(t){if(n=t.length){for(var n,e,r=0,o=t[0];++r1}function ue(t,n){return((t=t.x)[0]<0?t[1]-Ju-Vu:Ju-t[1])-((n=n.x)[0]<0?n[1]-Ju-Vu:Ju-n[1])}function se(t){var n,e=NaN,r=NaN,o=NaN;return{lineStart:function(){t.lineStart(),n=1},point:function(i,a){var u=i>0?$u:-$u,s=ns(i-e);ns(s-$u)0?Ju:-Ju),t.point(o,r),t.lineEnd(),t.lineStart(),t.point(u,r),t.point(i,r),n=0):o!==u&&s>=$u&&(ns(e-o)Vu?es((is(n)*(i=os(r))*is(e)-is(r)*(o=os(n))*is(t))/(o*i*a)):(n+r)/2}function ce(t,n,e,r){var o;if(null==t)o=e*Ju,r.point(-$u,o),r.point(0,o),r.point($u,o),r.point($u,0),r.point($u,-o),r.point(0,-o),r.point(-$u,-o),r.point(-$u,0),r.point(-$u,o);else if(ns(t[0]-n[0])>Vu){var i=t[0]=0;--i)l.push(r=e.children[i]=new xe(o[i])),r.parent=e,r.depth=e.depth+1;return u.eachBefore(ve)}function ge(){return pe(this).eachBefore(me)}function ye(t){return t.children}function me(t){t.data=t.data.data}function ve(t){var n=0;do t.height=n;while((t=t.parent)&&t.height<++n)}function xe(t){this.data=t,this.depth=this.height=0,this.parent=null}function _e(t,n){this._=t,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=n}function we(t){if(!t._start)try{be(t)}catch(n){if(t._tasks[t._ended+t._active-1])Te(t,n);else if(!t._data)throw n}}function be(t){for(;t._start=t._waiting&&t._active=0;)if((e=t._tasks[r])&&(t._tasks[r]=null,e.abort))try{e.abort()}catch(t){}t._active=NaN,ke(t)}function ke(t){if(!t._active&&t._call){var n=t._data;t._data=void 0,t._call(t._error,n)}}function ze(t){return function(n,e){t(null==n?e:null)}}function Se(t){var n=t.responseType;return n&&"text"!==n?t.response:t.responseText}function Ce(t,n){return function(e){return t(e.responseText,n)}}function Ne(t,n){return(n-=t=+t)?function(e){return(e-t)/n}:Ls(n)}function Ae(t){return function(n,e){var r=t(n=+n,e=+e);return function(t){return t<=n?0:t>=e?1:r(t)}}}function je(t){return function(n,e){var r=t(n=+n,e=+e);return function(t){return t<=0?n:t>=1?e:r(t)}}}function De(t,n,e,r){var o=t[0],i=t[1],a=n[0],u=n[1];return i2?Le:De,i=a=null,r}function r(n){return(i||(i=o(u,s,c?Ae(t):t,l)))(+n)}var o,i,a,u=Fs,s=Fs,l=Qi,c=!1;return r.invert=function(t){return(a||(a=o(s,u,Ne,c?je(n):n)))(+t)},r.domain=function(t){return arguments.length?(u=js.call(t,Es),e()):u.slice()},r.range=function(t){return arguments.length?(s=Ds.call(t),e()):s.slice()},r.rangeRound=function(t){return s=Ds.call(t),l=Ki,e()},r.clamp=function(t){return arguments.length?(c=!!t,e()):c},r.interpolate=function(t){return arguments.length?(l=t,e()):l},e()}function Ye(t){var e=t.domain;return t.ticks=function(t){var n=e();return oo(n[0],n[n.length-1],null==t?10:t)},t.tickFormat=function(t,n){return Ys(e(),t,n)},t.nice=function(r){var o=e(),i=o.length-1,a=null==r?10:r,u=o[0],s=o[i],l=n(u,s,a);return l&&(l=n(Math.floor(u/l)*l,Math.ceil(s/l)*l,a),o[0]=Math.floor(u/l)*l,o[i]=Math.ceil(s/l)*l,e(o)),t},t}function Xe(){var t=Fe(Ne,Ri);return t.copy=function(){return Ee(t,Xe())},Ye(t)}function Ue(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 a;do a.push(new Date(+e));while(n(e,i),t(e),e=n)for(;t(n),!e(n);)n.setTime(n-1)},function(t,r){if(t>=t)for(;--r>=0;)for(;n(t,1),!e(t););})},e&&(o.count=function(n,r){return Xs.setTime(+n),Us.setTime(+r),t(Xs),t(Us),Math.floor(e(Xs,Us))},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}function Be(t){return Ue(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())*Hs)/qs})}function Oe(t){return Ue(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)/qs})}function He(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 Pe(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 We(t){return{y:t,m:0,d:1,H:0,M:0,S:0,L:0}}function qe(t){function n(t,n){return function(e){var r,o,i,a=[],u=-1,s=0,l=t.length;for(e instanceof Date||(e=new Date(+e));++u=s)return-1;if(o=n.charCodeAt(a++),37===o){if(o=n.charAt(a++),i=P[o in ol?n.charAt(a++):o],!i||(r=i(t,e,r))<0)return-1}else if(o!=e.charCodeAt(r++))return-1}return r}function o(t,n,e){var r=A.exec(n.slice(e));return r?(t.p=j[r[0].toLowerCase()],e+r[0].length):-1}function i(t,n,e){var r=E.exec(n.slice(e));return r?(t.w=F[r[0].toLowerCase()],e+r[0].length):-1}function a(t,n,e){var r=D.exec(n.slice(e));return r?(t.w=L[r[0].toLowerCase()],e+r[0].length):-1}function u(t,n,e){var r=U.exec(n.slice(e));return r?(t.m=B[r[0].toLowerCase()],e+r[0].length):-1}function s(t,n,e){var r=Y.exec(n.slice(e));return r?(t.m=X[r[0].toLowerCase()],e+r[0].length):-1}function l(t,n,e){return r(t,b,n,e)}function c(t,n,e){return r(t,M,n,e)}function h(t,n,e){return r(t,T,n,e)}function f(t){return S[t.getDay()]}function d(t){return z[t.getDay()]}function p(t){return N[t.getMonth()]}function g(t){return C[t.getMonth()]}function y(t){return k[+(t.getHours()>=12)]}function m(t){return S[t.getUTCDay()]}function v(t){return z[t.getUTCDay()]}function x(t){return N[t.getUTCMonth()]}function _(t){return C[t.getUTCMonth()]}function w(t){return k[+(t.getUTCHours()>=12)]}var b=t.dateTime,M=t.date,T=t.time,k=t.periods,z=t.days,S=t.shortDays,C=t.months,N=t.shortMonths,A=Re(k),j=Ge(k),D=Re(z),L=Ge(z),E=Re(S),F=Ge(S),Y=Re(C),X=Ge(C),U=Re(N),B=Ge(N),O={a:f,A:d,b:p,B:g,c:null,d:lr,e:lr,H:cr,I:hr,j:fr,L:dr,m:pr,M:gr,p:y,S:yr,U:mr,w:vr,W:xr,x:null,X:null,y:_r,Y:wr,Z:br,"%":Xr},H={a:m,A:v,b:x,B:_,c:null,d:Mr,e:Mr,H:Tr,I:kr,j:zr,L:Sr,m:Cr,M:Nr,p:w,S:Ar,U:jr,w:Dr,W:Lr,x:null,X:null,y:Er,Y:Fr,Z:Yr,"%":Xr},P={a:i,A:a,b:u,B:s,c:l,d:er,e:er,H:or,I:or,j:rr,L:ur,m:nr,M:ir,p:o,S:ar,U:$e,w:Ve,W:Je,x:c,X:h,y:Ke,Y:Qe,Z:tr,"%":sr};return O.x=n(M,O),O.X=n(T,O),O.c=n(b,O),H.x=n(M,H),H.X=n(T,H),H.c=n(b,H),{format:function(t){var e=n(t+="",O);return e.toString=function(){return t},e},parse:function(t){var n=e(t+="",He);return n.toString=function(){return t},n},utcFormat:function(t){var e=n(t+="",H);return e.toString=function(){return t},e},utcParse:function(t){var n=e(t,Pe);return n.toString=function(){return t},n}}}function Ie(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 tr(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 nr(t,n,e){var r=il.exec(n.slice(e,e+2));return r?(t.m=r[0]-1,e+r[0].length):-1}function er(t,n,e){var r=il.exec(n.slice(e,e+2));return r?(t.d=+r[0],e+r[0].length):-1}function rr(t,n,e){var r=il.exec(n.slice(e,e+3));return r?(t.m=0,t.d=+r[0],e+r[0].length):-1}function or(t,n,e){var r=il.exec(n.slice(e,e+2));return r?(t.H=+r[0],e+r[0].length):-1}function ir(t,n,e){var r=il.exec(n.slice(e,e+2));return r?(t.M=+r[0],e+r[0].length):-1}function ar(t,n,e){var r=il.exec(n.slice(e,e+2));return r?(t.S=+r[0],e+r[0].length):-1}function ur(t,n,e){var r=il.exec(n.slice(e,e+3));return r?(t.L=+r[0],e+r[0].length):-1}function sr(t,n,e){var r=al.exec(n.slice(e,e+1));return r?e+r[0].length:-1}function lr(t,n){return Ie(t.getDate(),n,2)}function cr(t,n){return Ie(t.getHours(),n,2)}function hr(t,n){return Ie(t.getHours()%12||12,n,2)}function fr(t,n){return Ie(1+Is.count(Gs(t),t),n,3)}function dr(t,n){return Ie(t.getMilliseconds(),n,3)}function pr(t,n){return Ie(t.getMonth()+1,n,2)}function gr(t,n){return Ie(t.getMinutes(),n,2)}function yr(t,n){return Ie(t.getSeconds(),n,2)}function mr(t,n){return Ie(Zs.count(Gs(t),t),n,2)}function vr(t){return t.getDay()}function xr(t,n){return Ie(Rs.count(Gs(t),t),n,2)}function _r(t,n){return Ie(t.getFullYear()%100,n,2)}function wr(t,n){return Ie(t.getFullYear()%1e4,n,4)}function br(t){var n=t.getTimezoneOffset();return(n>0?"-":(n*=-1,"+"))+Ie(n/60|0,"0",2)+Ie(n%60,"0",2)}function Mr(t,n){return Ie(t.getUTCDate(),n,2)}function Tr(t,n){return Ie(t.getUTCHours(),n,2)}function kr(t,n){return Ie(t.getUTCHours()%12||12,n,2)}function zr(t,n){return Ie(1+Vs.count(Qs(t),t),n,3)}function Sr(t,n){return Ie(t.getUTCMilliseconds(),n,3)}function Cr(t,n){return Ie(t.getUTCMonth()+1,n,2)}function Nr(t,n){return Ie(t.getUTCMinutes(),n,2)}function Ar(t,n){return Ie(t.getUTCSeconds(),n,2)}function jr(t,n){return Ie($s.count(Qs(t),t),n,2); +}function Dr(t){return t.getUTCDay()}function Lr(t,n){return Ie(Js.count(Qs(t),t),n,2)}function Er(t,n){return Ie(t.getUTCFullYear()%100,n,2)}function Fr(t,n){return Ie(t.getUTCFullYear()%1e4,n,4)}function Yr(){return"+0000"}function Xr(){return"%"}function Ur(t){return Ks=qe(t),tl=Ks.format,nl=Ks.parse,el=Ks.utcFormat,rl=Ks.utcParse,Ks}function Br(t){return t.toISOString()}function Or(t){var n=new Date(t);return isNaN(n)?null:n}function Hr(t){this._context=t}function Pr(t){return t<0?-1:1}function Wr(t,n,e){var r=t._x1-t._x0,o=n-t._x1,i=(t._y1-t._y0)/(r||o<0&&-0),a=(e-t._y1)/(o||r<0&&-0),u=(i*o+a*r)/(r+o);return(Pr(i)+Pr(a))*Math.min(Math.abs(i),Math.abs(a),.5*Math.abs(u))||0}function qr(t,n){var e=t._x1-t._x0;return e?(3*(t._y1-t._y0)/e-n)/2:n}function Ir(t,n,e){var r=t._x0,o=t._y0,i=t._x1,a=t._y1,u=(i-r)/3;t._context.bezierCurveTo(r+u,o+u*n,i-u,a-u*e,i,a)}function Zr(t){this._context=t}function Rr(t){this._context=new Gr(t)}function Gr(t){this._context=t}function Vr(t,n,e,r){return Math.sqrt((t-e)*(t-e)+(n-r)*(n-r))}var $r=function(t,n){return tn?1:t>=n?0:NaN},Jr=function(n){return 1===n.length&&(n=t(n)),{left:function(t,e,r,o){for(null==r&&(r=0),null==o&&(o=t.length);r>>1;n(t[i],e)<0?r=i+1:o=i}return r},right:function(t,e,r,o){for(null==r&&(r=0),null==o&&(o=t.length);r>>1;n(t[i],e)>0?o=i:r=i+1}return r}}},Qr=Jr($r),Kr=Qr.right,to=function(t,n,e){t=+t,n=+n,e=(o=arguments.length)<2?(n=t,t=0,1):o<3?1:+e;for(var r=-1,o=0|Math.max(0,Math.ceil((n-t)/e)),i=new Array(o);++r=0;)for(r=t[o],n=r.length;--n>=0;)e[--a]=r[n];return e},ao={value:function(){}};r.prototype=e.prototype={constructor:r,on:function(t,n){var e,r=this._,u=o(t+"",r),s=-1,l=u.length;{if(!(arguments.length<2)){if(null!=n&&"function"!=typeof n)throw new Error("invalid callback: "+n);for(;++s0)for(var e,r,o=new Array(e),i=0;i=0&&"xmlns"!==(n=t.slice(0,e))&&(t=t.slice(e+1)),so.hasOwnProperty(n)?{space:so[n],local:t}:t},co=function(t){var n=lo(t);return(n.local?s:u)(n)},ho=function(t){return function(){return this.matches(t)}};if("undefined"!=typeof document){var fo=document.documentElement;if(!fo.matches){var po=fo.webkitMatchesSelector||fo.msMatchesSelector||fo.mozMatchesSelector||fo.oMatchesSelector;ho=function(t){return function(){return po.call(this,t)}}}}var go=ho,yo={},mo=null;if("undefined"!=typeof document){var vo=document.documentElement;"onmouseenter"in vo||(yo={mouseenter:"mouseover",mouseleave:"mouseout"})}var xo=function(t,n,e){var r,o,i=h(t+""),a=i.length;{if(!(arguments.length<2)){for(u=n?d:f,null==e&&(e=!1),r=0;r=M&&(M=b+1);!(w=y[M])&&++M=0;)(r=o[i])&&(a&&a!==r.nextSibling&&a.parentNode.insertBefore(r,a),a=r);return this},Yo=function(t){function n(n,e){return n&&e?t(n.__data__,e.__data__):!n-!e}t||(t=x);for(var e=this._groups,r=e.length,o=new Array(r),i=0;i1?this.each((null==n?z:"function"==typeof n?C:S)(t,n,null==e?"":e)):qo(r=this.node()).getComputedStyle(r,null).getPropertyValue(t)},Zo=function(t,n){return arguments.length>1?this.each((null==n?N:"function"==typeof n?j:A)(t,n)):this.node()[t]};E.prototype={add:function(t){var n=this._names.indexOf(t);n<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var n=this._names.indexOf(t);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var Ro=function(t,n){var e=D(t+"");if(arguments.length<2){for(var r=L(this.node()),o=-1,i=e.length;++o=240?t-240:t+120,o,r),dt(t,o,r),dt(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 wi=Math.PI/180,bi=180/Math.PI,Mi=18,Ti=.95047,ki=1,zi=1.08883,Si=4/29,Ci=6/29,Ni=3*Ci*Ci,Ai=Ci*Ci*Ci;ai(yt,gt,nt(et,{brighter:function(t){return new yt(this.l+Mi*(null==t?1:t),this.a,this.b,this.opacity)},darker:function(t){return new yt(this.l-Mi*(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 t=ki*vt(t),n=Ti*vt(n),e=zi*vt(e),new st(xt(3.2404542*n-1.5371385*t-.4985314*e),xt(-.969266*n+1.8760108*t+.041556*e),xt(.0556434*n-.2040259*t+1.0572252*e),this.opacity)}})),ai(Mt,bt,nt(et,{brighter:function(t){return new Mt(this.h,this.c,this.l+Mi*(null==t?1:t),this.opacity)},darker:function(t){return new Mt(this.h,this.c,this.l-Mi*(null==t?1:t),this.opacity)},rgb:function(){return pt(this).rgb()}}));var ji=-.14861,Di=1.78277,Li=-.29227,Ei=-.90649,Fi=1.97294,Yi=Fi*Ei,Xi=Fi*Di,Ui=Di*Li-Ei*ji;ai(zt,kt,nt(et,{brighter:function(t){return t=null==t?si:Math.pow(si,t),new zt(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?ui:Math.pow(ui,t),new zt(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=isNaN(this.h)?0:(this.h+120)*wi,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*(ji*r+Di*o)),255*(n+e*(Li*r+Ei*o)),255*(n+e*(Fi*r)),this.opacity)}}));var Bi,Oi,Hi,Pi,Wi=function(t){return function(){return t}},qi=function t(n){function e(t,n){var e=r((t=ut(t)).r,(n=ut(n)).r),o=r(t.g,n.g),i=r(t.b,n.b),a=jt(t.opacity,n.opacity);return function(n){return t.r=e(n),t.g=o(n),t.b=i(n),t.opacity=a(n),t+""}}var r=At(n);return e.gamma=t,e}(1),Ii=function(t,n){var e,r=n?n.length:0,o=t?Math.min(r,t.length):0,i=new Array(r),a=new Array(r);for(e=0;ei&&(o=n.slice(i,o),u[a]?u[a]+=o:u[++a]=o),(e=e[0])===(r=r[0])?u[a]?u[a]+=r:u[++a]=r:(u[++a]=null,s.push({i:a,x:Ri(e,r)})),i=$i.lastIndex;return iba&&e.stateau)if(Math.abs(c*u-s*l)>au&&o){var f=e-i,d=r-a,p=u*u+s*s,g=f*f+d*d,y=Math.sqrt(p),m=Math.sqrt(h),v=o*Math.tan((ou-Math.acos((p+h-g)/(2*y*m)))/2),x=v/m,_=v/y;Math.abs(x-1)>au&&(this._+="L"+(t+x*l)+","+(n+x*c)),this._+="A"+o+","+o+",0,0,"+ +(c*f>l*d)+","+(this._x1=t+_*u)+","+(this._y1=n+_*s)}else this._+="L"+(this._x1=t)+","+(this._y1=n);else;},arc:function(t,n,e,r,o,i){t=+t,n=+n,e=+e;var a=e*Math.cos(r),u=e*Math.sin(r),s=t+a,l=n+u,c=1^i,h=i?r-o:o-r;if(e<0)throw new Error("negative radius: "+e);null===this._x1?this._+="M"+s+","+l:(Math.abs(this._x1-s)>au||Math.abs(this._y1-l)>au)&&(this._+="L"+s+","+l),e&&(h>uu?this._+="A"+e+","+e+",0,1,"+c+","+(t-a)+","+(n-u)+"A"+e+","+e+",0,1,"+c+","+(this._x1=s)+","+(this._y1=l):(h<0&&(h=h%iu+iu),this._+="A"+e+","+e+",0,"+ +(h>=ou)+","+c+","+(this._x1=t+e*Math.cos(o))+","+(this._y1=n+e*Math.sin(o))))},rect:function(t,n,e,r){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+n)+"h"+ +e+"v"+ +r+"h"+-e+"Z"},toString:function(){return this._}};var su="$";Dn.prototype=Ln.prototype={constructor:Dn,has:function(t){return su+t in this},get:function(t){return this[su+t]},set:function(t,n){return this[su+t]=n,this},remove:function(t){var n=su+t;return n in this&&delete this[n]},clear:function(){for(var t in this)t[0]===su&&delete this[t]},keys:function(){var t=[];for(var n in this)n[0]===su&&t.push(n.slice(1));return t},values:function(){var t=[];for(var n in this)n[0]===su&&t.push(this[n]);return t},entries:function(){var t=[];for(var n in this)n[0]===su&&t.push({key:n.slice(1),value:this[n]});return t},size:function(){var t=0;for(var n in this)n[0]===su&&++t;return t},empty:function(){for(var t in this)if(t[0]===su)return!1;return!0},each:function(t){for(var n in this)n[0]===su&&t(this[n],n.slice(1),this)}};var lu=Ln.prototype;En.prototype=Fn.prototype={constructor:En,has:lu.has,add:function(t){return t+="",this[su+t]=t,this},remove:lu.remove,clear:lu.clear,values:lu.keys,size:lu.size,empty:lu.empty,each:lu.each};var cu=function(t){function n(t,n){var r,o,i=e(t,function(t,e){return r?r(t,e-1):(o=t,void(r=n?Xn(t,n):Yn(t)))});return i.columns=o,i}function e(t,n){function e(){if(c>=l)return a;if(o)return o=!1,i;var n,e=c;if(34===t.charCodeAt(e)){for(var r=e;r++t||t>o||r>n||n>i))return this;var a,u,s=o-e,l=this._root;switch(u=(n<(r+i)/2)<<1|t<(e+o)/2){case 0:do a=new Array(4),a[u]=l,l=a;while(s*=2,o=e+s,i=r+s,t>o||n>i);break;case 1:do a=new Array(4),a[u]=l,l=a;while(s*=2,e=o-s,i=r+s,e>t||n>i);break;case 2:do a=new Array(4),a[u]=l,l=a;while(s*=2,o=e+s,r=i-s,t>o||r>n);break;case 3:do a=new Array(4),a[u]=l,l=a;while(s*=2,e=o-s,r=i-s,e>t||r>n)}this._root&&this._root.length&&(this._root=l)}return this._x0=e,this._y0=r,this._x1=o,this._y1=i,this},mu=function(){var t=[];return this.visit(function(n){if(!n.length)do t.push(n.data);while(n=n.next)}),t},vu=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]},xu=function(t,n,e,r,o){this.node=t,this.x0=n,this.y0=e,this.x1=r,this.y1=o},_u=function(t,n,e){var r,o,i,a,u,s,l,c=this._x0,h=this._y0,f=this._x1,d=this._y1,p=[],g=this._root;for(g&&p.push(new xu(g,c,h,f,d)),null==e?e=1/0:(c=t-e,h=n-e,f=t+e,d=n+e,e*=e);s=p.pop();)if(!(!(g=s.node)||(o=s.x0)>f||(i=s.y0)>d||(a=s.x1)=m)<<1|t>=y)&&(s=p[p.length-1],p[p.length-1]=p[p.length-1-l],p[p.length-1-l]=s)}else{var v=t-+this._x.call(null,g.data),x=n-+this._y.call(null,g.data),_=v*v+x*x;if(_=(u=(p+y)/2))?p=u:y=u,(c=a>=(s=(g+m)/2))?g=s:m=s,n=d,!(d=d[h=c<<1|l]))return this;if(!d.length)break;(n[h+1&3]||n[h+2&3]||n[h+3&3])&&(e=n,f=h)}for(;d.data!==t;)if(r=d,!(d=d.next))return this;return(o=d.next)&&delete d.next,r?(o?r.next=o:delete r.next,this):n?(o?n[h]=o:delete n[h],(d=n[0]||n[1]||n[2]||n[3])&&d===(n[3]||n[2]||n[1]||n[0])&&!d.length&&(e?e[f]=d:this._root=d),this):(this._root=o,this)},bu=function(){return this._root},Mu=function(){var t=0;return this.visit(function(n){if(!n.length)do++t;while(n=n.next)}),t},Tu=function(t){var n,e,r,o,i,a,u=[],s=this._root;for(s&&u.push(new xu(s,this._x0,this._y0,this._x1,this._y1));n=u.pop();)if(!t(s=n.node,r=n.x0,o=n.y0,i=n.x1,a=n.y1)&&s.length){var l=(r+i)/2,c=(o+a)/2;(e=s[3])&&u.push(new xu(e,l,c,i,a)),(e=s[2])&&u.push(new xu(e,r,c,l,a)),(e=s[1])&&u.push(new xu(e,l,o,i,c)),(e=s[0])&&u.push(new xu(e,r,o,l,c))}return this},ku=function(t){var n,e=[],r=[];for(this._root&&e.push(new xu(this._root,this._x0,this._y0,this._x1,this._y1));n=e.pop();){ +var o=n.node;if(o.length){var i,a=n.x0,u=n.y0,s=n.x1,l=n.y1,c=(a+s)/2,h=(u+l)/2;(i=o[0])&&e.push(new xu(i,a,u,c,h)),(i=o[1])&&e.push(new xu(i,c,u,s,h)),(i=o[2])&&e.push(new xu(i,a,h,c,l)),(i=o[3])&&e.push(new xu(i,c,h,s,l))}r.push(n)}for(;n=r.pop();)t(n.node,n.x0,n.y0,n.x1,n.y1);return this},zu=function(t){return arguments.length?(this._x=t,this):this._x},Su=function(t){return arguments.length?(this._y=t,this):this._y},Cu=qn.prototype=In.prototype;Cu.copy=function(){var t,n,e=new In(this._x,this._y,this._x0,this._y0,this._x1,this._y1),r=this._root;if(!r)return e;if(!r.length)return e._root=Zn(r),e;for(t=[{source:r,target:e._root=new Array(4)}];r=t.pop();)for(var o=0;o<4;++o)(n=r.source[o])&&(n.length?t.push({source:n,target:r.target[o]=new Array(4)}):r.target[o]=Zn(n));return e},Cu.add=gu,Cu.addAll=On,Cu.cover=yu,Cu.data=mu,Cu.extent=vu,Cu.find=_u,Cu.remove=wu,Cu.removeAll=Hn,Cu.root=bu,Cu.size=Mu,Cu.visit=Tu,Cu.visitAfter=ku,Cu.x=zu,Cu.y=Su;var Nu,Au=function(t,n){if((e=(t=n?t.toExponential(n-1):t.toExponential()).indexOf("e"))<0)return null;var e,r=t.slice(0,e);return[r.length>1?r[0]+r.slice(2):r,+t.slice(e+1)]},ju=function(t){return t=Au(Math.abs(t)),t?t[1]:NaN},Du=function(t,n){return function(e,r){for(var o=e.length,i=[],a=0,u=t[0],s=0;o>0&&u>0&&(s+u+1>r&&(u=Math.max(1,r-s)),i.push(e.substring(o-=u,o+u)),!((s+=u+1)>r));)u=t[a=(a+1)%t.length];return i.reverse().join(n)}},Lu=function(t,n){t=t.toPrecision(n);t:for(var e,r=t.length,o=1,i=-1;o0&&(i=0)}return i>0?t.slice(0,i)+t.slice(e+1):t},Eu=function(t,n){var e=Au(t,n);if(!e)return t+"";var r=e[0],o=e[1],i=o-(Nu=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")+Au(t,Math.max(0,n+i-1))[0]},Fu=function(t,n){var e=Au(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")},Yu={"":Lu,"%":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 Fu(100*t,n)},r:Fu,s:Eu,X:function(t){return Math.round(t).toString(16).toUpperCase()},x:function(t){return Math.round(t).toString(16)}},Xu=/^(?:(.)?([<>=^]))?([+\-\( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?([a-z%])?$/i,Uu=function(t){return new Rn(t)};Rn.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.type};var Bu,Ou,Hu,Pu=["y","z","a","f","p","n","ยต","m","","k","M","G","T","P","E","Z","Y"],Wu=function(t){function n(t){function n(t){var n,o,s,v=p,x=g;if("c"===d)x=y(t)+x,t="";else{t=+t;var _=(t<0||1/t<0)&&(t*=-1,!0);if(t=y(t,f),_)for(n=-1,o=t.length,_=!1;++ns||s>57){x=(46===s?i+t.slice(n+1):t.slice(n))+x,t=t.slice(0,n);break}}h&&!l&&(t=r(t,1/0));var w=v.length+t.length+x.length,b=w>1)+v+t+x+b.slice(w)}return b+v+t+x}t=Uu(t);var e=t.fill,a=t.align,u=t.sign,s=t.symbol,l=t.zero,c=t.width,h=t.comma,f=t.precision,d=t.type,p="$"===s?o[0]:"#"===s&&/[boxX]/.test(d)?"0"+d.toLowerCase():"",g="$"===s?o[1]:/[%p]/.test(d)?"%":"",y=Yu[d],m=!d||/[defgprs%]/.test(d);return f=null==f?d?6:12:/[gprs]/.test(d)?Math.max(1,Math.min(21,f)):Math.max(0,Math.min(20,f)),n.toString=function(){return t+""},n}function e(t,e){var r=n((t=Uu(t),t.type="f",t)),o=3*Math.max(-8,Math.min(8,Math.floor(ju(e)/3))),i=Math.pow(10,-o),a=Pu[8+o/3];return function(t){return r(i*t)+a}}var r=t.grouping&&t.thousands?Du(t.grouping,t.thousands):Gn,o=t.currency,i=t.decimal;return{format:n,formatPrefix:e}};Vn({decimal:".",thousands:",",grouping:[3],currency:["$",""]});var qu=function(t){return Math.max(0,-ju(Math.abs(t)))},Iu=function(t,n){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(ju(n)/3)))-ju(Math.abs(t)))},Zu=function(t,n){return t=Math.abs(t),n=Math.abs(n)-t,Math.max(0,ju(n)-ju(t))+1},Ru=function(){return new $n};$n.prototype={constructor:$n,reset:function(){this.s=this.t=0},add:function(t){Jn(Gu,t,this.t),Jn(this,Gu.s,this.s),this.s?this.t+=Gu.t:this.s=Gu.t},valueOf:function(){return this.s}};var Gu=new $n,Vu=1e-6,$u=Math.PI,Ju=$u/2,Qu=$u/4,Ku=2*$u,ts=$u/180,ns=Math.abs,es=Math.atan,rs=Math.atan2,os=Math.cos,is=Math.sin,as=Math.sqrt,us=(Ru(),Ru(),Ru(),function(){var t,n=[];return{point:function(n,e){t.push([n,e])},lineStart:function(){n.push(t=[])},lineEnd:te,rejoin:function(){n.length>1&&n.push(n.pop().concat(n.shift()))},result:function(){var e=n;return n=[],t=null,e}}}),ss=function(t,n){return ns(t[0]-n[0])=0;--i)o.point((c=l[i])[0],c[1]);else r(f.x,f.p.x,-1,o);f=f.p}f=f.o,l=f.z,d=!d}while(!f.v);o.lineEnd()}}},cs=(Ru(),Ru(),Ru(),Ru()),hs=function(t,n){var e=n[0],r=n[1],o=[is(e),-os(e),0],i=0,a=0;cs.reset();for(var u=0,s=t.length;u=0?1:-1,T=M*b,k=T>$u,z=p*_;if(cs.add(rs(z*M*is(T),g*w+z*os(T))),i+=k?b+M*Ku:b,k^f>=e^v>=e){var S=ee(ne(h),ne(m));re(S);var C=ee(o,S);re(C);var N=(k^b>=0?-1:1)*Kn(C[2]);(r>N||r===N&&(S[0]||S[1]))&&(a+=k^b>=0?1:-1)}}return(i<-Vu||i0){for(_||(i.polygonStart(),_=!0),i.lineStart(),t=0;t1&&2&o&&a.push(a.pop().concat(a.shift())),p.push(a.filter(ae))}var d,p,g,y=n(i),m=o.invert(r[0],r[1]),v=us(),x=n(v),_=!1,w={point:a,lineStart:s,lineEnd:l,polygonStart:function(){w.point=c,w.lineStart=h,w.lineEnd=f,p=[],d=[]},polygonEnd:function(){w.point=a,w.lineStart=s,w.lineEnd=l,p=io(p);var t=hs(d,m);p.length?(_||(i.polygonStart(),_=!0),ls(p,ue,t,e,i)):t&&(_||(i.polygonStart(),_=!0),i.lineStart(),e(null,null,1,i),i.lineEnd()),_&&(i.polygonEnd(),_=!1),p=d=null},sphere:function(){i.polygonStart(),i.lineStart(),e(null,null,1,i),i.lineEnd(),i.polygonEnd()}};return w}};fs(function(){return!0},se,ce,[-$u,-Ju]);var ds=(os(30*ts),he(function(t){return as(2/(1+t))}));ds.invert=fe(function(t){return 2*Kn(t/2)});var ps=he(function(t){return(t=Qn(t))&&t/is(t)});ps.invert=fe(function(t){return t});var gs=function(t){var n,e,r,o,i=this,a=[i];do for(n=a.reverse(),a=[];i=n.pop();)if(t(i),e=i.children)for(r=0,o=e.length;r=0;--e)o.push(n[e]);return this},ms=function(t){for(var n,e,r,o=this,i=[o],a=[];o=i.pop();)if(a.push(o),n=o.children)for(e=0,r=n.length;e=0;)e+=r[o].value;n.value=e})},xs=function(t){return this.eachBefore(function(n){n.children&&n.children.sort(t)})},_s=function(t){for(var n=this,e=de(n,t),r=[n];n!==e;)n=n.parent,r.push(n);for(var o=r.length;t!==e;)r.splice(o,0,t),t=t.parent;return r},ws=function(){for(var t=this,n=[t];t=t.parent;)n.push(t);return n},bs=function(){var t=[];return this.each(function(n){t.push(n)}),t},Ms=function(){var t=[];return this.eachBefore(function(n){n.children||t.push(n)}),t},Ts=function(){var t=this,n=[];return t.each(function(e){e!==t&&n.push({source:e.parent,target:e})}),n};xe.prototype=pe.prototype={constructor:xe,each:gs,eachAfter:ms,eachBefore:ys,sum:vs,sort:xs,path:_s,ancestors:ws,descendants:bs,leaves:Ms,links:Ts,copy:ge};_e.prototype=Object.create(xe.prototype);var ks=([].slice,{}),zs=function(t,n){function r(t){var n,e=c.status;if(!e&&Se(c)||e>=200&&e<300||304===e){if(a)try{n=a.call(o,c)}catch(t){return void s.call("error",o,t)}else n=c;s.call("load",o,n)}else s.call("error",o,t)}var o,i,a,u,s=e("beforesend","progress","load","error"),l=Ln(),c=new XMLHttpRequest,h=null,f=null,d=0;if("undefined"==typeof XDomainRequest||"withCredentials"in c||!/^(http(s)?:)?\/\//.test(t)||(c=new XDomainRequest),"onload"in c?c.onload=c.onerror=c.ontimeout=r:c.onreadystatechange=function(t){c.readyState>3&&r(t)},c.onprogress=function(t){s.call("progress",o,t)},o={header:function(t,n){return t=(t+"").toLowerCase(),arguments.length<2?l.get(t):(null==n?l.remove(t):l.set(t,n+""),o)},mimeType:function(t){return arguments.length?(i=null==t?null:t+"",o):i},responseType:function(t){return arguments.length?(u=t,o):u},timeout:function(t){return arguments.length?(d=+t,o):d},user:function(t){return arguments.length<1?h:(h=null==t?null:t+"",o)},password:function(t){return arguments.length<1?f:(f=null==t?null:t+"",o)},response:function(t){return a=t,o},get:function(t,n){return o.send("GET",t,n)},post:function(t,n){return o.send("POST",t,n)},send:function(n,e,r){return c.open(n,t,!0,h,f),null==i||l.has("accept")||l.set("accept",i+",*/*"),c.setRequestHeader&&l.each(function(t,n){c.setRequestHeader(n,t)}),null!=i&&c.overrideMimeType&&c.overrideMimeType(i),null!=u&&(c.responseType=u),d>0&&(c.timeout=d),null==r&&"function"==typeof e&&(r=e,e=null),null!=r&&1===r.length&&(r=ze(r)),null!=r&&o.on("error",r).on("load",function(t){r(null,t)}),s.call("beforesend",o,c),c.send(null==e?null:e),o},abort:function(){return c.abort(),o},on:function(){var t=s.on.apply(s,arguments);return t===s?o:t}},null!=n){if("function"!=typeof n)throw new Error("invalid callback: "+n);return o.get(n)}return o},Ss=function(t,n){return function(e,r){var o=zs(e).mimeType(t).response(n);if(null!=r){if("function"!=typeof r)throw new Error("invalid callback: "+r);return o.get(r)}return o}};Ss("text/html",function(t){return document.createRange().createContextualFragment(t.responseText)});var Cs=Ss("application/json",function(t){return JSON.parse(t.responseText)});Ss("text/plain",function(t){return t.responseText}),Ss("application/xml",function(t){var n=t.responseXML;if(!n)throw new Error("parse error");return n});var Ns=function(t,n){return function(e,r,o){arguments.length<3&&(o=r,r=null);var i=zs(e).mimeType(t);return i.row=function(t){return arguments.length?i.response(Ce(n,r=t)):r},i.row(r),o?i.get(o):i}};Ns("text/csv",fu),Ns("text/tab-separated-values",pu);var As=Array.prototype,js=As.map,Ds=As.slice,Ls=function(t){return function(){return t}},Es=function(t){return+t},Fs=[0,1],Ys=function(t,e,r){var o,i=t[0],a=t[t.length-1],u=n(i,a,null==e?10:e);switch(r=Uu(null==r?",f":r),r.type){case"s":var s=Math.max(Math.abs(i),Math.abs(a));return null!=r.precision||isNaN(o=Iu(u,s))||(r.precision=o),Hu(r,s);case"":case"e":case"g":case"p":case"r":null!=r.precision||isNaN(o=Zu(u,Math.max(Math.abs(i),Math.abs(a))))||(r.precision=o-("e"===r.type));break;case"f":case"%":null!=r.precision||isNaN(o=qu(u))||(r.precision=o-2*("%"===r.type))}return Ou(r)},Xs=new Date,Us=new Date,Bs=Ue(function(){},function(t,n){t.setTime(+t+n)},function(t,n){return n-t});Bs.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?Ue(function(n){n.setTime(Math.floor(n/t)*t)},function(n,e){n.setTime(+n+e*t)},function(n,e){return(e-n)/t}):Bs:null};var Os=1e3,Hs=6e4,Ps=36e5,Ws=864e5,qs=6048e5,Is=(Ue(function(t){t.setTime(Math.floor(t/Os)*Os)},function(t,n){t.setTime(+t+n*Os)},function(t,n){return(n-t)/Os},function(t){return t.getUTCSeconds()}),Ue(function(t){t.setTime(Math.floor(t/Hs)*Hs)},function(t,n){t.setTime(+t+n*Hs)},function(t,n){return(n-t)/Hs},function(t){return t.getMinutes()}),Ue(function(t){var n=t.getTimezoneOffset()*Hs%Ps;n<0&&(n+=Ps),t.setTime(Math.floor((+t-n)/Ps)*Ps+n)},function(t,n){t.setTime(+t+n*Ps)},function(t,n){return(n-t)/Ps},function(t){return t.getHours()}),Ue(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())*Hs)/Ws},function(t){return t.getDate()-1})),Zs=Be(0),Rs=Be(1),Gs=(Be(2),Be(3),Be(4),Be(5),Be(6),Ue(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()}),Ue(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()}));Gs.every=function(t){return isFinite(t=Math.floor(t))&&t>0?Ue(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 Vs=(Ue(function(t){t.setUTCSeconds(0,0)},function(t,n){t.setTime(+t+n*Hs)},function(t,n){return(n-t)/Hs},function(t){return t.getUTCMinutes()}),Ue(function(t){t.setUTCMinutes(0,0,0)},function(t,n){t.setTime(+t+n*Ps)},function(t,n){return(n-t)/Ps},function(t){return t.getUTCHours()}),Ue(function(t){t.setUTCHours(0,0,0,0)},function(t,n){t.setUTCDate(t.getUTCDate()+n)},function(t,n){return(n-t)/Ws},function(t){return t.getUTCDate()-1})),$s=Oe(0),Js=Oe(1),Qs=(Oe(2),Oe(3),Oe(4),Oe(5),Oe(6),Ue(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()}),Ue(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()}));Qs.every=function(t){return isFinite(t=Math.floor(t))&&t>0?Ue(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 Ks,tl,nl,el,rl,ol={"-":"",_:" ",0:"0"},il=/^\s*\d+/,al=/^%/,ul=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;Ur({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"]});var sl="%Y-%m-%dT%H:%M:%S.%LZ",ll=(Date.prototype.toISOString?Br:el(sl),+new Date("2000-01-01T00:00:00.000Z")?Or:rl(sl),function(t){return t.match(/.{6}/g).map(function(t){return"#"+t})});ll("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf"),ll("393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6"),ll("3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9"),ll("1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5"),ua(kt(300,.5,0),kt(-240,.5,1));ua(kt(-100,.75,.35),kt(80,1.5,.8)),ua(kt(260,.75,.35),kt(80,1.5,.8)),kt();Hr.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;default:this._context.lineTo(t,n)}}};Zr.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:Ir(this,this._t0,qr(this,this._t0))}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){var e=NaN;if(t=+t,n=+n,t!==this._x1||n!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;break;case 2:this._point=3,Ir(this,qr(this,e=Wr(this,t,n)),e);break;default:Ir(this,this._t0,e=Wr(this,t,n))}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n,this._t0=e}}},(Rr.prototype=Object.create(Zr.prototype)).point=function(t,n){Zr.prototype.point.call(this,n,t)},Gr.prototype={moveTo:function(t,n){this._context.moveTo(n,t)},closePath:function(){this._context.closePath()},lineTo:function(t,n){this._context.lineTo(n,t)},bezierCurveTo:function(t,n,e,r,o,i){this._context.bezierCurveTo(n,t,r,e,i,o)}};oi("body").append("link").attr("href","https://fonts.googleapis.com/css?family=Inconsolata").attr("rel","stylesheet");var cl={svg:{height:650,width:650},axis:{left:70,right:520,top:100,bottom:550,color:"white"},grid:{spacing:10,lineWidth:.5,color:"#D0D0D0",crosshairs:{opacity:.06,color:"gray",label:{font:"sans-serif",fontSize:"10px",padX:4,padY:11,duration:200}}},shadow:{dx:5,dy:5,std:8,scale:.2},legend:{left:70,right:520,top:565,bottom:590,rx:10,ry:10,padX:15,padY:5,fill:"none",stroke:"none",font:"sans-serif",fontSize:"10px",rows:2,columns:7,glyph:{width:6,height:6,textX:5,textY:3.5,content:[{idx:0,label:"Positive",group:"positive"},{idx:1,label:"Polar -OH",group:"hydroxyl"},{idx:2,label:"Hydrophobic",group:"hydrophobic"},{idx:3,label:"Cysteine",group:"cysteine"},{idx:7,label:"Negative",group:"negative"},{idx:8,label:"Polar -CON",group:"amide"},{idx:9,label:"Aromatic",group:"aromatic"}]},magnitude:{idx:4,textX:13,textY:3.5,shiftX:43,offsets:[-27,-16,-7,0,5],radii:[6,5,4,3,2]},cmap:{idx:11,leftX:-25,leftY:3.5,rightX:26,rightY:3.5,shiftX:30,height:6,width:42,blocks:7}},logo:{data:[],font:["Inconsolata","sans-serif"],height:25,fontScale:.2,bitScale:4,opacity:1,pad:2,axis:{pad:2,max:Math.log2(20),majorTicks:[0,1,2,3,4],minorTicks:[.5,1.5,2.5],majorLength:2.5,minorLength:1,textX:-6,stroke:"black",strokeWidth:.5},zoom:{height:60,lift:40,width:150,radius:5,fontScale:1.5,duration:100,destroyDuration:150,delay:0,opacity:0,easeFun:Sn,underline:{color:"gray",width:.5,pad:2.5,notchRadius:2.5,notchHeight:3,duration:300,delay:75}}},couplings:{data:[],fill:"#B8B8B8",highlight:"gray",matchColor:"white",stroke:"white",strokeWidth:.5,maxRadius:3.5},times:{globalTick:10,destroyDuration:0,buildDuration:300,matchedTimeThreshold:150},matrix:{x:335,y:650,cellSize:15,opacity:.8,gridColor:"#D0D0D0",gridWidth:.5,textUp:2,textOver:2.5,font:"Inconsolata",fontSize:"20px",background:{fill:"white",stroke:"#D0D0D0",strokeWidth:.5,padRight:19,padTop:19,padLeft:5,padBottom:5,opacity:.8},cscale:Xe().domain([-1,0,1]).range(["#3A2CB1","white","#FFCF22"])},state:{viewerLoaded:0,x:0,y:0,i:0,j:0,iOld:0,jOld:0,focus:-1,zoomBuilt:0,matchedTime:0,matchedBuilt:0}};cl.aaGroups={".":"gr","-":"gr",G:"hydrophobic",A:"hydrophobic",I:"hydrophobic",V:"hydrophobic",L:"hydrophobic",M:"hydrophobic",F:"aromatic",Y:"aromatic",W:"aromatic",H:"positive",C:"cysteine",P:"hydrophobic",K:"positive",R:"positive",D:"negative",E:"negative",Q:"amide",N:"amide",S:"hydroxyl",T:"hydroxyl"},cl.groupColors={hydrophobic:"#33cc00",aromatic:"#009900",cysteine:"#ffff00",positive:"#cc0000",negative:"#0033ff",amide:"#6600cc",hydroxyl:"#0099ff"},cl.groupColors={hydrophobic:"#FFC107",aromatic:"#FF9800",cysteine:"#8BC34A",positive:"#FF4081",negative:"#448AFF",amide:"#5E35B1",hydroxyl:"#673AB7"},cl.groupColors={hydrophobic:"#E0E0E0",aromatic:"#BDBDBD",cysteine:"#FFC107",positive:"#FF4081",negative:"#448AFF",amide:"#7C4DFF",hydroxyl:"#7C4DFF"},cl.aaGroups={".":"gr","-":"gr",G:"hydrophobic",A:"hydrophobic",I:"hydrophobic",V:"hydrophobic",L:"hydrophobic",M:"hydrophobic",F:"aromatic",Y:"aromatic",W:"aromatic",H:"positive",C:"cysteine",P:"hydrophobic",K:"positive",R:"positive",D:"negative",E:"negative",Q:"polar",N:"polar",S:"polar",T:"polar"},cl.groupColors={hydrophobic:"#D0D0D0",aromatic:"#888888",cysteine:"#8BC34A",positive:"#F61C76",negative:"#03A9F4",polar:"#1565C0"},cl.groupColors={hydrophobic:"#B0B0B0",aromatic:"#707070",cysteine:"#8BC34A",positive:"#F61C76",negative:"#03A9F4",polar:"#1565C0"},cl.groupColors={hydrophobic:"#888888",aromatic:"#404040",cysteine:"#9E9D24",positive:"#F61C76",negative:"#03A9F4",polar:"#1565C0"},cl.legend.glyph.content=[{idx:0,label:"Positive",group:"positive"},{idx:1,label:"Polar",group:"polar"},{idx:2,label:"Hydrophobic",group:"hydrophobic"},{idx:8,label:"Cysteine",group:"cysteine"},{idx:7,label:"Negative",group:"negative"},{idx:9,label:"Aromatic",group:"aromatic"}],cl.plotWidth=function(){return cl.axis.right-cl.axis.left},cl.plotHeight=function(){return cl.axis.bottom-cl.axis.top},cl.iToX=function(t){return cl.axis.left+t*(cl.axis.right-cl.axis.left)/cl.logo.data.length},cl.jToY=function(t){return cl.axis.top+t*(cl.axis.bottom-cl.axis.top)/cl.logo.data.length},cl.focusLength=function(t){return t*(cl.axis.right-cl.axis.left)/cl.logo.data.length},cl.barWidth=function(){return(cl.axis.right-cl.axis.left)/cl.logo.data.length},cl.radiusFun=function(t){return cl.couplings.maxRadius*Math.sqrt(t)},cl.tick=function(){var t=cl.state.i!=cl.state.iOld||cl.state.j!=cl.state.jOld;cl.state.viewerLoaded>0&&(0!=cl.state.matchedBuilt||t?cl.state.matchedTime=0:cl.state.matchedTime+=cl.times.globalTick);var n=cl.state.matchedTime-cl.times.matchedTimeThreshold;n>0&&ncl.axis.top&&cl.state.ycl.axis.left&&cl.state.xcl.times.matchedTimeThreshold;if(cl.state.viewerLoaded>0&&(r||o&&0==cl.state.matchedBuilt)){if(e&&(0==cl.state.matchedBuilt&&o||1==cl.state.matchedBuilt&&r)){cl.state.matchedBuilt=1;for(var i=-1,a=0;a=0&&(u=Vr(cl.state.i,cl.state.j,t[cl.state.focus].i-1,t[cl.state.focus].j-1)-cl.radiusFun(t[cl.state.focus].score)),u>cl.logo.zoom.radius){ii("#legendCmap").transition().attr("opacity",0).delay(0).duration(cl.times.destroyDuration),oi("#matrixBG").transition().attr("opacity",0).delay(0).duration(cl.times.buildDuration);for(var s=0;s<20;s++)for(var l=0;l<20;l++)oi("#disp"+s+"-"+l).transition().style("opacity",0).delay(0).duration(cl.times.destroyDuration),oi("#biC"+s).transition().style("opacity",0).delay(0).duration(cl.times.destroyDuration),oi("#bjC"+l).transition().style("opacity",0).delay(0).duration(cl.times.destroyDuration);cl.state.focus=-1,cl.state.matchedBuilt=0,cl.state.matchedTime=0}if(i>=0&&i!=cl.state.focus){console.log("Zooming at "+(cl.state.i+1)+", "+(cl.state.j+1));for(var s=0;s<20;s++)for(var l=0;l<20;l++)cl.matrix.nodes.cells[s][l].transition().style("opacity",0).delay(0).duration(cl.times.destroyDuration),cl.matrix.nodes.iLabels[s].transition().style("opacity",0),cl.matrix.nodes.jLabels[l].transition().style("opacity",0);cl.state.i+1,cl.state.j+1;cl.couplings.nodes.circles[i].transition().attr("fill",cl.couplings.fill).delay(0).duration(cl.times.buildDuration);var c=cl.iToX(cl.state.i)+cl.matrix.background.padLeft,h=cl.jToY(cl.state.j)+cl.matrix.background.padTop,f=t[i].matrix.length*cl.matrix.cellSize+cl.matrix.background.padRight+cl.matrix.background.padLeft,d=t[i].matrix[0].length*cl.matrix.cellSize+cl.matrix.background.padTop+cl.matrix.background.padBottom;ii("#legendCmap").transition().attr("opacity",1).delay(cl.times.destroyDuration).duration(cl.times.buildDuration),oi("#matrixBG").attr("x",c-cl.matrix.background.padLeft).attr("y",h-cl.matrix.background.padTop).attr("width",0).attr("height",0),oi("#matrixBG").transition().attr("width",f).attr("height",d).attr("opacity",cl.matrix.background.opacity).delay(cl.times.destroyDuration).duration(cl.times.buildDuration);for(var s=0;s=cl.state.i-cl.logo.zoom.radius&&t[a].i-1<=cl.state.i+cl.logo.zoom.radius||t[a].j-1>=cl.state.j-cl.logo.zoom.radius&&t[a].j-1<=cl.state.j+cl.logo.zoom.radius)?cl.couplings.nodes.circles[a].attr("fill",cl.couplings.highlight):cl.couplings.nodes.circles[a].attr("fill",cl.couplings.fill)}if(1==cl.state.zoomBuilt&&!e){console.log("Contracting logo");for(var y=Math.max(0,cl.state.iOld-cl.logo.zoom.radius),m=Math.min(n.length-1,cl.state.iOld+cl.logo.zoom.radius),s=y;s<=m;s++)for(var b=0,l=0;lm)for(var b=0,l=0;lm)for(var b=0,l=0;ln.bits?1:0:au?1:0})}},cl.prepareCouplings=function(){cl.couplings.data.sort(function(t,n){return t.score>n.score?-1:t.scoret&&(t=cl.couplings.data[n].score);for(var n=0;ne&&(e=Math.abs(cl.couplings.data[n].matrix[r][o]));for(var n=0;nn&&(cl.state.viewerLoaded=1)},0);setInterval(cl.tick,cl.times.globalTick)},cl.initialize=function(){var t="",n=oi("#evzoom-viewer");n.empty()||(t=n.node().getAttribute("data-couplings"));for(var e="",r=/([^&=]+)=?([^&]*)/g,o=window.location.search.substring(1);e=r.exec(o);)e.length>2&&"data"==e[1]&&(t=e[2]);console.log("Loading "+t),Cs(t).on("progress",function(){null!=mo&&mo.hasAttribute("loaded")&&console.log("progress",mo.loaded)}).on("load",cl.prepareData).on("error",function(t){console.log("failure!",t)}).get()},cl.initialize()}); diff --git a/src/evzoom.js b/src/evzoom.js index dc172a5..854d8a7 100755 --- a/src/evzoom.js +++ b/src/evzoom.js @@ -70,13 +70,13 @@ var EVzoom = { textX: 5, textY: 3.5, content: [ - {idx: 0, label: "Positive", group: "c4"}, - {idx: 1, label: "Polar -OH", group: "c7"}, - {idx: 2, label: "Hydrophobic", group: "c0"}, - {idx: 3, label: "Cysteine", group: "c2"}, - {idx: 7, label: "Negative", group: "c5"}, - {idx: 8, label: "Polar -CON", group: "c6"}, - {idx: 9, label: "Aromatic", group: "c1"} + {idx: 0, label: "Positive", group: "positive"}, + {idx: 1, label: "Polar -OH", group: "hydroxyl"}, + {idx: 2, label: "Hydrophobic", group: "hydrophobic"}, + {idx: 3, label: "Cysteine", group: "cysteine"}, + {idx: 7, label: "Negative", group: "negative"}, + {idx: 8, label: "Polar -CON", group: "amide"}, + {idx: 9, label: "Aromatic", group: "aromatic"} ] }, magnitude: { @@ -176,10 +176,12 @@ var EVzoom = { padBottom: 5, opacity: 0.8 }, - cscale: d3.scaleLinear().domain([-1, 0, 1]).range(["#3374FF", "white", "#FFBE33"]) // Orange and Blue + // cscale: d3.scaleLinear().domain([-1, 0, 1]).range(["#3374FF", "white", "#FFBE33"]) // Orange and Blue // cscale: d3.scaleLinear().domain([-1, 0, 1]).range(["#018AFF", "white", "#FF7601"]) // Mandarin and Light Blue // cscale: d3.scaleLinear().domain([-1, 1]).range(["black", "white"]) // cscale: d3.scaleLinear().domain([-1, 0, 1]).range(["#FF01A5", "white", "#01FF5B"]) // Magenta and Lime + // cscale: d3.scaleLinear().domain([-1, 0, 1]).range(["#683AB7", "white", "#FFE83F"]) // Purple and gold FFE83F + cscale: d3.scaleLinear().domain([-1, 0, 1]).range(["#3A2CB1", "white", "#FFCF22"]) // Purple and gold FFE83F // cscale: d3.scaleLinear().domain([-2, -0.8, 0, 0.8, 2]).range(["#253259", "#1F4E88", "white", "#E29C29", "#c87711"]) // cscale: d3.scaleLinear().domain([-2, -0.8, 0, 0.8, 2]).range(["#253259", "#1F4E88", "white", "#E261A4", "#42124B"]) // cscale: d3.scaleLinear().domain([-1, 0, 1]).range(["blue", "white", "orange"]) @@ -199,16 +201,40 @@ var EVzoom = { } } +EVzoom.aaGroups = { ".":"gr", "-":"gr", "G":"hydrophobic", "A":"hydrophobic", "I":"hydrophobic", "V":"hydrophobic", + "L":"hydrophobic", "M":"hydrophobic", "F":"aromatic", "Y":"aromatic", "W":"aromatic", "H":"positive", + "C":"cysteine", "P":"hydrophobic", "K":"positive", "R":"positive", "D":"negative", "E":"negative", + "Q":"amide", "N":"amide", "S":"hydroxyl", "T":"hydroxyl"}; // Color scheme from MSAviewer.org -EVzoom.aaGroups = { ".":"gr", "-":"gr", "G":"c0", "A":"c0", "I":"c0", "V":"c0", - "L":"c0", "M":"c0", "F":"c1", "Y":"c1", "W":"c1", "H":"c4", - "C":"c2", "P":"c3", "K":"c4", "R":"c4", "D":"c5", "E":"c5", - "Q":"c6", "N":"c6", "S":"c7", "T":"c7", "B":"c8", "Z":"c8", - "X":"c8", "?":"c9", "*":"c8", "U":"bl"}; -EVzoom.groupColors = { gr:"grey", bl:"black", m0:"blue", m1:"red", c0:"#33cc00", - c1:"#009900", c2:"#ffff00", c3:"#33cc00", c4:"#cc0000", - c5:"#0033ff", c6:"#6600cc", c7:"#0099ff", c8:"#666666", - c9:"#999999"}; +EVzoom.groupColors = {hydrophobic:"#33cc00", aromatic:"#009900", cysteine:"#ffff00", positive:"#cc0000", + negative:"#0033ff", amide:"#6600cc", hydroxyl:"#0099ff"}; +// Color scheme 1 +EVzoom.groupColors = {hydrophobic:"#FFC107", aromatic:"#FF9800", cysteine:"#8BC34A", positive:"#FF4081", + negative:"#448AFF", amide:"#5E35B1", hydroxyl:"#673AB7"}; +// Color scheme 2 +EVzoom.groupColors = {hydrophobic:"#E0E0E0", aromatic:"#BDBDBD", cysteine:"#FFC107", positive:"#FF4081", + negative:"#448AFF", amide:"#7C4DFF", hydroxyl:"#7C4DFF"}; +// Color scheme 3 +EVzoom.aaGroups = { ".":"gr", "-":"gr", "G":"hydrophobic", "A":"hydrophobic", "I":"hydrophobic", "V":"hydrophobic", + "L":"hydrophobic", "M":"hydrophobic", "F":"aromatic", "Y":"aromatic", "W":"aromatic", "H":"positive", + "C":"cysteine", "P":"hydrophobic", "K":"positive", "R":"positive", "D":"negative", "E":"negative", + "Q":"polar", "N":"polar", "S":"polar", "T":"polar"}; +EVzoom.groupColors = {hydrophobic:"#D0D0D0", aromatic:"#888888", cysteine:"#8BC34A", positive:"#F61C76", + negative:"#03A9F4", polar:"#1565C0"}; +// Color scheme 4 +EVzoom.groupColors = {hydrophobic:"#B0B0B0", aromatic:"#707070", cysteine:"#8BC34A", positive:"#F61C76", + negative:"#03A9F4", polar:"#1565C0"}; +// Color scheme 4 +EVzoom.groupColors = {hydrophobic:"#888888", aromatic:"#404040", cysteine:"#9E9D24", positive:"#F61C76", + negative:"#03A9F4", polar:"#1565C0"}; +EVzoom.legend.glyph.content = [ + {idx: 0, label: "Positive", group: "positive"}, + {idx: 1, label: "Polar", group: "polar"}, + {idx: 2, label: "Hydrophobic", group: "hydrophobic"}, + {idx: 8, label: "Cysteine", group: "cysteine"}, + {idx: 7, label: "Negative", group: "negative"}, + {idx: 9, label: "Aromatic", group: "aromatic"} + ] // Functions for the coordinate system EVzoom.plotWidth = function() { return EVzoom.axis.right - EVzoom.axis.left; }; @@ -845,6 +871,7 @@ EVzoom.buildSVG = function() { .attr("width", EVzoom.svg.width) .attr("height", EVzoom.svg.height) .attr("overflow", "visible") + .style("overflow", "visible") .on("mousemove", EVzoom.mouseMove); // Draw axis