@flourish/sdk
Version:
The Flourish SDK
1 lines • 159 kB
JavaScript
var Flourish=function(e){"use strict";function n(e,t){return e<t?-1:t<e?1:t<=e?0:NaN}1===(t=n).length&&(r=t,t=function(e,t){return n(r(e),t)});var t,r,i={value:function(){}};function a(){for(var e,t=0,n=arguments.length,r={};t<n;++t){if(!(e=arguments[t]+"")||e in r)throw new Error("illegal type: "+e);r[e]=[]}return new o(r)}function o(e){this._=e}function c(e,t){for(var n,r=0,a=e.length;r<a;++r)if((n=e[r]).name===t)return n.value}function u(e,t,n){for(var r=0,a=e.length;r<a;++r)if(e[r].name===t){e[r]=i,e=e.slice(0,r).concat(e.slice(r+1));break}return null!=n&&e.push({name:t,value:n}),e}o.prototype=a.prototype={constructor:o,on:function(e,t){var n,r,a=this._,i=(r=a,(e+"").trim().split(/^|\s+/).map(function(e){var t="",n=e.indexOf(".");if(0<=n&&(t=e.slice(n+1),e=e.slice(0,n)),e&&!r.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:t}})),o=-1,f=i.length;if(!(arguments.length<2)){if(null!=t&&"function"!=typeof t)throw new Error("invalid callback: "+t);for(;++o<f;)if(n=(e=i[o]).type)a[n]=u(a[n],e.name,t);else if(null==t)for(n in a)a[n]=u(a[n],e.name,null);return this}for(;++o<f;)if((n=(e=i[o]).type)&&(n=c(a[n],e.name)))return n},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new o(e)},call:function(e,t){if(0<(n=arguments.length-2))for(var n,r,a=new Array(n),i=0;i<n;++i)a[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=0,n=(r=this._[e]).length;i<n;++i)r[i].value.apply(t,a)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],a=0,i=r.length;a<i;++a)r[a].value.apply(t,n)}};var f="http://www.w3.org/1999/xhtml",s={svg:"http://www.w3.org/2000/svg",xhtml:f,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function l(e){var t=e+="",n=t.indexOf(":");return 0<=n&&"xmlns"!==(t=e.slice(0,n))&&(e=e.slice(n+1)),s.hasOwnProperty(t)?{space:s[t],local:e}:e}function d(e){var t=l(e);return(t.local?function(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}:function(n){return function(){var e=this.ownerDocument,t=this.namespaceURI;return t===f&&e.documentElement.namespaceURI===f?e.createElement(n):e.createElementNS(t,n)}})(t)}function h(){}function p(e){return null==e?h:function(){return this.querySelector(e)}}function b(){return[]}function v(e){return null==e?b:function(){return this.querySelectorAll(e)}}var g=function(e){return function(){return this.matches(e)}};if("undefined"!=typeof document){var m=document.documentElement;if(!m.matches){var y=m.webkitMatchesSelector||m.msMatchesSelector||m.mozMatchesSelector||m.oMatchesSelector;g=function(e){return function(){return y.call(this,e)}}}}var w=g;function _(e){return new Array(e.length)}function x(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}x.prototype={constructor:x,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};var C="$";function A(e,t,n,r,a,i){for(var o,f=0,c=t.length,u=i.length;f<u;++f)(o=t[f])?(o.__data__=i[f],r[f]=o):n[f]=new x(e,i[f]);for(;f<c;++f)(o=t[f])&&(a[f]=o)}function M(e,t,n,r,a,i,o){var f,c,u,s={},l=t.length,d=i.length,h=new Array(l);for(f=0;f<l;++f)(c=t[f])&&(h[f]=u=C+o.call(c,c.__data__,f,t),u in s?a[f]=c:s[u]=c);for(f=0;f<d;++f)(c=s[u=C+o.call(e,i[f],f,i)])?((r[f]=c).__data__=i[f],s[u]=null):n[f]=new x(e,i[f]);for(f=0;f<l;++f)(c=t[f])&&s[h[f]]===c&&(a[f]=c)}function T(e,t){return e<t?-1:t<e?1:t<=e?0:NaN}function D(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function E(e,t){return e.style.getPropertyValue(t)||D(e).getComputedStyle(e,null).getPropertyValue(t)}function F(e){return e.trim().split(/^|\s+/)}function S(e){return e.classList||new k(e)}function k(e){this._node=e,this._names=F(e.getAttribute("class")||"")}function N(e,t){for(var n=S(e),r=-1,a=t.length;++r<a;)n.add(t[r])}function U(e,t){for(var n=S(e),r=-1,a=t.length;++r<a;)n.remove(t[r])}function L(){this.textContent=""}function B(){this.innerHTML=""}function H(){this.nextSibling&&this.parentNode.appendChild(this)}function O(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Y(){return null}function P(){var e=this.parentNode;e&&e.removeChild(this)}function j(){return this.parentNode.insertBefore(this.cloneNode(!1),this.nextSibling)}function z(){return this.parentNode.insertBefore(this.cloneNode(!0),this.nextSibling)}k.prototype={add:function(e){this._names.indexOf(e)<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);0<=t&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return 0<=this._names.indexOf(e)}};var q={},I=null;"undefined"!=typeof document&&("onmouseenter"in document.documentElement||(q={mouseenter:"mouseover",mouseleave:"mouseout"}));function R(n,e,t){return n=W(n,e,t),function(e){var t=e.relatedTarget;t&&(t===this||8&t.compareDocumentPosition(this))||n.call(this,e)}}function W(n,r,a){return function(e){var t=I;I=e;try{n.call(this,this.__data__,r,a)}finally{I=t}}}function X(i){return function(){var e=this.__on;if(e){for(var t,n=0,r=-1,a=e.length;n<a;++n)t=e[n],i.type&&t.type!==i.type||t.name!==i.name?e[++r]=t:this.removeEventListener(t.type,t.listener,t.capture);++r?e.length=r:delete this.__on}}}function V(c,u,s){var l=q.hasOwnProperty(c.type)?R:W;return function(e,t,n){var r,a=this.__on,i=l(u,t,n);if(a)for(var o=0,f=a.length;o<f;++o)if((r=a[o]).type===c.type&&r.name===c.name)return this.removeEventListener(r.type,r.listener,r.capture),this.addEventListener(r.type,r.listener=i,r.capture=s),void(r.value=u);this.addEventListener(c.type,i,s),r={type:c.type,name:c.name,value:u,listener:i,capture:s},a?a.push(r):this.__on=[r]}}function $(e,t,n){var r=D(e),a=r.CustomEvent;"function"==typeof a?a=new a(t,n):(a=r.document.createEvent("Event"),n?(a.initEvent(t,n.bubbles,n.cancelable),a.detail=n.detail):a.initEvent(t,!1,!1)),e.dispatchEvent(a)}var Z=[null];function J(e,t){this._groups=e,this._parents=t}function Q(){return new J([[document.documentElement]],Z)}function G(e){return"string"==typeof e?new J([[document.querySelector(e)]],[document.documentElement]):new J([[e]],Z)}function K(e){return"string"==typeof e?new J([document.querySelectorAll(e)],[document.documentElement]):new J([null==e?[]:e],Z)}function ee(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function te(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function ne(){}J.prototype=Q.prototype={constructor:J,select:function(e){"function"!=typeof e&&(e=p(e));for(var t=this._groups,n=t.length,r=new Array(n),a=0;a<n;++a)for(var i,o,f=t[a],c=f.length,u=r[a]=new Array(c),s=0;s<c;++s)(i=f[s])&&(o=e.call(i,i.__data__,s,f))&&("__data__"in i&&(o.__data__=i.__data__),u[s]=o);return new J(r,this._parents)},selectAll:function(e){"function"!=typeof e&&(e=v(e));for(var t=this._groups,n=t.length,r=[],a=[],i=0;i<n;++i)for(var o,f=t[i],c=f.length,u=0;u<c;++u)(o=f[u])&&(r.push(e.call(o,o.__data__,u,f)),a.push(o));return new J(r,a)},filter:function(e){"function"!=typeof e&&(e=w(e));for(var t=this._groups,n=t.length,r=new Array(n),a=0;a<n;++a)for(var i,o=t[a],f=o.length,c=r[a]=[],u=0;u<f;++u)(i=o[u])&&e.call(i,i.__data__,u,o)&&c.push(i);return new J(r,this._parents)},data:function(e,t){if(!e)return p=new Array(this.size()),s=-1,this.each(function(e){p[++s]=e}),p;var n,r=t?M:A,a=this._parents,i=this._groups;"function"!=typeof e&&(n=e,e=function(){return n});for(var o=i.length,f=new Array(o),c=new Array(o),u=new Array(o),s=0;s<o;++s){var l=a[s],d=i[s],h=d.length,p=e.call(l,l&&l.__data__,s,a),b=p.length,g=c[s]=new Array(b),v=f[s]=new Array(b);r(l,d,g,v,u[s]=new Array(h),p,t);for(var m,y,w=0,_=0;w<b;++w)if(m=g[w]){for(_<=w&&(_=w+1);!(y=v[_])&&++_<b;);m._next=y||null}}return(f=new J(f,a))._enter=c,f._exit=u,f},enter:function(){return new J(this._enter||this._groups.map(_),this._parents)},exit:function(){return new J(this._exit||this._groups.map(_),this._parents)},merge:function(e){for(var t=this._groups,n=e._groups,r=t.length,a=n.length,i=Math.min(r,a),o=new Array(r),f=0;f<i;++f)for(var c,u=t[f],s=n[f],l=u.length,d=o[f]=new Array(l),h=0;h<l;++h)(c=u[h]||s[h])&&(d[h]=c);for(;f<r;++f)o[f]=t[f];return new J(o,this._parents)},order:function(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r,a=e[t],i=a.length-1,o=a[i];0<=--i;)(r=a[i])&&(o&&o!==r.nextSibling&&o.parentNode.insertBefore(r,o),o=r);return this},sort:function(n){function e(e,t){return e&&t?n(e.__data__,t.__data__):!e-!t}n||(n=T);for(var t=this._groups,r=t.length,a=new Array(r),i=0;i<r;++i){for(var o,f=t[i],c=f.length,u=a[i]=new Array(c),s=0;s<c;++s)(o=f[s])&&(u[s]=o);u.sort(e)}return new J(a,this._parents).order()},call:function(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this},nodes:function(){var e=new Array(this.size()),t=-1;return this.each(function(){e[++t]=this}),e},node:function(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],a=0,i=r.length;a<i;++a){var o=r[a];if(o)return o}return null},size:function(){var e=0;return this.each(function(){++e}),e},empty:function(){return!this.node()},each:function(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var a,i=t[n],o=0,f=i.length;o<f;++o)(a=i[o])&&e.call(a,a.__data__,o,i);return this},attr:function(e,t){var n=l(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((null==t?n.local?function(e){return function(){this.removeAttributeNS(e.space,e.local)}}:function(e){return function(){this.removeAttribute(e)}}:"function"==typeof t?n.local?function(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(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttribute(t):this.setAttribute(t,e)}}:n.local?function(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}:function(e,t){return function(){this.setAttribute(e,t)}})(n,t))},style:function(e,t,n){return 1<arguments.length?this.each((null==t?function(e){return function(){this.style.removeProperty(e)}}:"function"==typeof t?function(t,n,r){return function(){var e=n.apply(this,arguments);null==e?this.style.removeProperty(t):this.style.setProperty(t,e,r)}}:function(e,t,n){return function(){this.style.setProperty(e,t,n)}})(e,t,null==n?"":n)):E(this.node(),e)},property:function(e,t){return 1<arguments.length?this.each((null==t?function(e){return function(){delete this[e]}}:"function"==typeof t?function(t,n){return function(){var e=n.apply(this,arguments);null==e?delete this[t]:this[t]=e}}:function(e,t){return function(){this[e]=t}})(e,t)):this.node()[e]},classed:function(e,t){var n=F(e+"");if(arguments.length<2){for(var r=S(this.node()),a=-1,i=n.length;++a<i;)if(!r.contains(n[a]))return!1;return!0}return this.each(("function"==typeof t?function(e,t){return function(){(t.apply(this,arguments)?N:U)(this,e)}}:t?function(e){return function(){N(this,e)}}:function(e){return function(){U(this,e)}})(n,t))},text:function(e){return arguments.length?this.each(null==e?L:("function"==typeof e?function(t){return function(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}}:function(e){return function(){this.textContent=e}})(e)):this.node().textContent},html:function(e){return arguments.length?this.each(null==e?B:("function"==typeof e?function(t){return function(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}}:function(e){return function(){this.innerHTML=e}})(e)):this.node().innerHTML},raise:function(){return this.each(H)},lower:function(){return this.each(O)},append:function(e){var t="function"==typeof e?e:d(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})},insert:function(e,t){var n="function"==typeof e?e:d(e),r=null==t?Y:"function"==typeof t?t:p(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})},remove:function(){return this.each(P)},clone:function(e){return this.select(e?z:j)},datum:function(e){return arguments.length?this.property("__data__",e):this.node().__data__},on:function(e,t,n){var r,a,i=(e+"").trim().split(/^|\s+/).map(function(e){var t="",n=e.indexOf(".");return 0<=n&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}}),o=i.length;if(!(arguments.length<2)){for(f=t?V:X,null==n&&(n=!1),r=0;r<o;++r)this.each(f(i[r],t,n));return this}var f=this.node().__on;if(f)for(var c,u=0,s=f.length;u<s;++u)for(r=0,c=f[u];r<o;++r)if((a=i[r]).type===c.type&&a.name===c.name)return c.value},dispatch:function(e,t){return this.each(("function"==typeof t?function(e,t){return function(){return $(this,e,t.apply(this,arguments))}}:function(e,t){return function(){return $(this,e,t)}})(e,t))}};var re=1/.7,ae="\\s*([+-]?\\d+)\\s*",ie="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",oe="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",fe=/^#([0-9a-f]{3})$/,ce=/^#([0-9a-f]{6})$/,ue=new RegExp("^rgb\\("+[ae,ae,ae]+"\\)$"),se=new RegExp("^rgb\\("+[oe,oe,oe]+"\\)$"),le=new RegExp("^rgba\\("+[ae,ae,ae,ie]+"\\)$"),de=new RegExp("^rgba\\("+[oe,oe,oe,ie]+"\\)$"),he=new RegExp("^hsl\\("+[ie,oe,oe]+"\\)$"),pe=new RegExp("^hsla\\("+[ie,oe,oe,ie]+"\\)$"),be={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function ge(e){var t;return e=(e+"").trim().toLowerCase(),(t=fe.exec(e))?new _e((t=parseInt(t[1],16))>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):(t=ce.exec(e))?ve(parseInt(t[1],16)):(t=ue.exec(e))?new _e(t[1],t[2],t[3],1):(t=se.exec(e))?new _e(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=le.exec(e))?me(t[1],t[2],t[3],t[4]):(t=de.exec(e))?me(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=he.exec(e))?Ce(t[1],t[2]/100,t[3]/100,1):(t=pe.exec(e))?Ce(t[1],t[2]/100,t[3]/100,t[4]):be.hasOwnProperty(e)?ve(be[e]):"transparent"===e?new _e(NaN,NaN,NaN,0):null}function ve(e){return new _e(e>>16&255,e>>8&255,255&e,1)}function me(e,t,n,r){return r<=0&&(e=t=n=NaN),new _e(e,t,n,r)}function ye(e){return e instanceof ne||(e=ge(e)),e?new _e((e=e.rgb()).r,e.g,e.b,e.opacity):new _e}function we(e,t,n,r){return 1===arguments.length?ye(e):new _e(e,t,n,null==r?1:r)}function _e(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}function xe(e){return((e=Math.max(0,Math.min(255,Math.round(e)||0)))<16?"0":"")+e.toString(16)}function Ce(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||1<=n?e=t=NaN:t<=0&&(e=NaN),new Ae(e,t,n,r)}function Ae(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}function Me(e,t,n){return 255*(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)}ee(ne,ge,{displayable:function(){return this.rgb().displayable()},hex:function(){return this.rgb().hex()},toString:function(){return this.rgb()+""}}),ee(_e,we,te(ne,{brighter:function(e){return e=null==e?re:Math.pow(re,e),new _e(this.r*e,this.g*e,this.b*e,this.opacity)},darker:function(e){return e=null==e?.7:Math.pow(.7,e),new _e(this.r*e,this.g*e,this.b*e,this.opacity)},rgb:function(){return this},displayable:function(){return 0<=this.r&&this.r<=255&&0<=this.g&&this.g<=255&&0<=this.b&&this.b<=255&&0<=this.opacity&&this.opacity<=1},hex:function(){return"#"+xe(this.r)+xe(this.g)+xe(this.b)},toString:function(){var e=this.opacity;return(1===(e=isNaN(e)?1:Math.max(0,Math.min(1,e)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===e?")":", "+e+")")}})),ee(Ae,function(e,t,n,r){return 1===arguments.length?function(e){if(e instanceof Ae)return new Ae(e.h,e.s,e.l,e.opacity);if(e instanceof ne||(e=ge(e)),!e)return new Ae;if(e instanceof Ae)return e;var t=(e=e.rgb()).r/255,n=e.g/255,r=e.b/255,a=Math.min(t,n,r),i=Math.max(t,n,r),o=NaN,f=i-a,c=(i+a)/2;return f?(o=t===i?(n-r)/f+6*(n<r):n===i?(r-t)/f+2:(t-n)/f+4,f/=c<.5?i+a:2-i-a,o*=60):f=0<c&&c<1?0:o,new Ae(o,f,c,e.opacity)}(e):new Ae(e,t,n,null==r?1:r)},te(ne,{brighter:function(e){return e=null==e?re:Math.pow(re,e),new Ae(this.h,this.s,this.l*e,this.opacity)},darker:function(e){return e=null==e?.7:Math.pow(.7,e),new Ae(this.h,this.s,this.l*e,this.opacity)},rgb:function(){var e=this.h%360+360*(this.h<0),t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,a=2*n-r;return new _e(Me(240<=e?e-240:e+120,a,r),Me(e,a,r),Me(e<120?e+240:e-120,a,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 Te=Math.PI/180,De=180/Math.PI,Ee=.96422,Fe=1,Se=.82521,ke=4/29,Ne=6/29,Ue=3*Ne*Ne,Le=Ne*Ne*Ne;function Be(e){if(e instanceof He)return new He(e.l,e.a,e.b,e.opacity);if(e instanceof ze){if(isNaN(e.h))return new He(e.l,0,0,e.opacity);var t=e.h*Te;return new He(e.l,Math.cos(t)*e.c,Math.sin(t)*e.c,e.opacity)}e instanceof _e||(e=ye(e));var n,r,a=je(e.r),i=je(e.g),o=je(e.b),f=Oe((.2225045*a+.7168786*i+.0606169*o)/Fe);return a===i&&i===o?n=r=f:(n=Oe((.4360747*a+.3850649*i+.1430804*o)/Ee),r=Oe((.0139322*a+.0971045*i+.7141733*o)/Se)),new He(116*f-16,500*(n-f),200*(f-r),e.opacity)}function He(e,t,n,r){this.l=+e,this.a=+t,this.b=+n,this.opacity=+r}function Oe(e){return Le<e?Math.pow(e,1/3):e/Ue+ke}function Ye(e){return Ne<e?e*e*e:Ue*(e-ke)}function Pe(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function je(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function ze(e,t,n,r){this.h=+e,this.c=+t,this.l=+n,this.opacity=+r}ee(He,function(e,t,n,r){return 1===arguments.length?Be(e):new He(e,t,n,null==r?1:r)},te(ne,{brighter:function(e){return new He(this.l+18*(null==e?1:e),this.a,this.b,this.opacity)},darker:function(e){return new He(this.l-18*(null==e?1:e),this.a,this.b,this.opacity)},rgb:function(){var e=(this.l+16)/116,t=isNaN(this.a)?e:e+this.a/500,n=isNaN(this.b)?e:e-this.b/200;return new _e(Pe(3.1338561*(t=Ee*Ye(t))-1.6168667*(e=Fe*Ye(e))-.4906146*(n=Se*Ye(n))),Pe(-.9787684*t+1.9161415*e+.033454*n),Pe(.0719453*t-.2289914*e+1.4052427*n),this.opacity)}})),ee(ze,function(e,t,n,r){return 1===arguments.length?function(e){if(e instanceof ze)return new ze(e.h,e.c,e.l,e.opacity);if(e instanceof He||(e=Be(e)),0===e.a&&0===e.b)return new ze(NaN,0,e.l,e.opacity);var t=Math.atan2(e.b,e.a)*De;return new ze(t<0?t+360:t,Math.sqrt(e.a*e.a+e.b*e.b),e.l,e.opacity)}(e):new ze(e,t,n,null==r?1:r)},te(ne,{brighter:function(e){return new ze(this.h,this.c,this.l+18*(null==e?1:e),this.opacity)},darker:function(e){return new ze(this.h,this.c,this.l-18*(null==e?1:e),this.opacity)},rgb:function(){return Be(this).rgb()}}));var qe=1.78277,Ie=-.29227,Re=-.90649,We=1.97294,Xe=We*Re,Ve=We*qe,$e=qe*Ie- -.14861*Re;function Ze(e,t,n,r){return 1===arguments.length?function(e){if(e instanceof Je)return new Je(e.h,e.s,e.l,e.opacity);e instanceof _e||(e=ye(e));var t=e.r/255,n=e.g/255,r=e.b/255,a=($e*r+Xe*t-Ve*n)/($e+Xe-Ve),i=r-a,o=(We*(n-a)-Ie*i)/Re,f=Math.sqrt(o*o+i*i)/(We*a*(1-a)),c=f?Math.atan2(o,i)*De-120:NaN;return new Je(c<0?c+360:c,f,a,e.opacity)}(e):new Je(e,t,n,null==r?1:r)}function Je(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}function Qe(e){return function(){return e}}function Ge(t,n){return function(e){return t+e*n}}function Ke(i){return 1==(i=+i)?et:function(e,t){return t-e?(n=e,r=t,a=i,n=Math.pow(n,a),r=Math.pow(r,a)-n,a=1/a,function(e){return Math.pow(n+e*r,a)}):Qe(isNaN(e)?t:e);var n,r,a}}function et(e,t){var n=t-e;return n?Ge(e,n):Qe(isNaN(e)?t:e)}ee(Je,Ze,te(ne,{brighter:function(e){return e=null==e?re:Math.pow(re,e),new Je(this.h,this.s,this.l*e,this.opacity)},darker:function(e){return e=null==e?.7:Math.pow(.7,e),new Je(this.h,this.s,this.l*e,this.opacity)},rgb:function(){var e=isNaN(this.h)?0:(this.h+120)*Te,t=+this.l,n=isNaN(this.s)?0:this.s*t*(1-t),r=Math.cos(e),a=Math.sin(e);return new _e(255*(t+n*(-.14861*r+qe*a)),255*(t+n*(Ie*r+Re*a)),255*(t+n*(We*r)),this.opacity)}}));var tt=function e(t){var o=Ke(t);function n(t,e){var n=o((t=we(t)).r,(e=we(e)).r),r=o(t.g,e.g),a=o(t.b,e.b),i=et(t.opacity,e.opacity);return function(e){return t.r=n(e),t.g=r(e),t.b=a(e),t.opacity=i(e),t+""}}return n.gamma=e,n}(1);var nt,rt=(nt=function(u){var s=u.length-1;return function(e){var t,n,r,a=e<=0?e=0:1<=e?s-(e=1):Math.floor(e*s),i=u[a],o=u[a+1],f=0<a?u[a-1]:2*i-o,c=a<s-1?u[a+2]:2*o-i;return((1-3*(t=(e-a/s)*s)+3*(n=t*t)-(r=n*t))*f+(4-6*n+3*r)*i+(1+3*t+3*n-3*r)*o+r*c)/6}},function(e){var t,n,r=e.length,a=new Array(r),i=new Array(r),o=new Array(r);for(t=0;t<r;++t)n=we(e[t]),a[t]=n.r||0,i[t]=n.g||0,o[t]=n.b||0;return a=nt(a),i=nt(i),o=nt(o),n.opacity=1,function(e){return n.r=a(e),n.g=i(e),n.b=o(e),n+""}});function at(t,n){return n-=t=+t,function(e){return t+n*e}}var it=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ot=new RegExp(it.source,"g");var ft,ct,ut,st,lt=180/Math.PI,dt={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function ht(e,t,n,r,a,i){var o,f,c;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(f=Math.sqrt(n*n+r*r))&&(n/=f,r/=f,c/=f),e*r<t*n&&(e=-e,t=-t,c=-c,o=-o),{translateX:a,translateY:i,rotate:Math.atan2(t,e)*lt,skewX:Math.atan(c)*lt,scaleX:o,scaleY:f}}function pt(d,h,p,b){function g(e){return e.length?e.pop()+" ":""}return function(e,t){var n,r,a,i,o,f,c,u,s=[],l=[];return e=d(e),t=d(t),function(e,t,n,r,a,i){if(e!==n||t!==r){var o=a.push("translate(",null,h,null,p);i.push({i:o-4,x:at(e,n)},{i:o-2,x:at(t,r)})}else(n||r)&&a.push("translate("+n+h+r+p)}(e.translateX,e.translateY,t.translateX,t.translateY,s,l),n=e.rotate,r=t.rotate,a=s,i=l,n!==r?(180<n-r?r+=360:180<r-n&&(n+=360),i.push({i:a.push(g(a)+"rotate(",null,b)-2,x:at(n,r)})):r&&a.push(g(a)+"rotate("+r+b),o=e.skewX,f=t.skewX,c=s,u=l,o!==f?u.push({i:c.push(g(c)+"skewX(",null,b)-2,x:at(o,f)}):f&&c.push(g(c)+"skewX("+f+b),function(e,t,n,r,a,i){if(e!==n||t!==r){var o=a.push(g(a)+"scale(",null,",",null,")");i.push({i:o-4,x:at(e,n)},{i:o-2,x:at(t,r)})}else 1===n&&1===r||a.push(g(a)+"scale("+n+","+r+")")}(e.scaleX,e.scaleY,t.scaleX,t.scaleY,s,l),e=t=null,function(e){for(var t,n=-1,r=l.length;++n<r;)s[(t=l[n]).i]=t.x(e);return s.join("")}}}var bt=pt(function(e){return"none"===e?dt:(ft||(ft=document.createElement("DIV"),ct=document.documentElement,ut=document.defaultView),ft.style.transform=e,e=ut.getComputedStyle(ct.appendChild(ft),null).getPropertyValue("transform"),ct.removeChild(ft),ht(+(e=e.slice(7,-1).split(","))[0],+e[1],+e[2],+e[3],+e[4],+e[5]))},"px, ","px)","deg)"),gt=pt(function(e){return null==e?dt:(st||(st=document.createElementNS("http://www.w3.org/2000/svg","g")),st.setAttribute("transform",e),(e=st.transform.baseVal.consolidate())?ht((e=e.matrix).a,e.b,e.c,e.d,e.e,e.f):dt)},", ",")",")");Math.SQRT2;function vt(f){return function e(o){function t(t,e){var n=f((t=Ze(t)).h,(e=Ze(e)).h),r=et(t.s,e.s),a=et(t.l,e.l),i=et(t.opacity,e.opacity);return function(e){return t.h=n(e),t.s=r(e),t.l=a(Math.pow(e,o)),t.opacity=i(e),t+""}}return o=+o,t.gamma=e,t}(1)}vt(function(e,t){var n=t-e;return n?Ge(e,180<n||n<-180?n-360*Math.round(n/360):n):Qe(isNaN(e)?t:e)});var mt,yt,wt=vt(et),_t=0,xt=0,Ct=0,At=1e3,Mt=0,Tt=0,Dt=0,Et="object"==typeof performance&&performance.now?performance:Date,Ft="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function St(){return Tt||(Ft(kt),Tt=Et.now()+Dt)}function kt(){Tt=0}function Nt(){this._call=this._time=this._next=null}function Ut(e,t,n){var r=new Nt;return r.restart(e,t,n),r}function Lt(){Tt=(Mt=Et.now())+Dt,_t=xt=0;try{!function(){St(),++_t;for(var e,t=mt;t;)0<=(e=Tt-t._time)&&t._call.call(null,e),t=t._next;--_t}()}finally{_t=0,function(){var e,t,n=mt,r=1/0;for(;n;)n=n._call?(r>n._time&&(r=n._time),(e=n)._next):(t=n._next,n._next=null,e?e._next=t:mt=t);yt=e,Ht(r)}(),Tt=0}}function Bt(){var e=Et.now(),t=e-Mt;At<t&&(Dt-=t,Mt=e)}function Ht(e){_t||(xt&&(xt=clearTimeout(xt)),24<e-Tt?(e<1/0&&(xt=setTimeout(Lt,e-Et.now()-Dt)),Ct&&(Ct=clearInterval(Ct))):(Ct||(Mt=Et.now(),Ct=setInterval(Bt,At)),_t=1,Ft(Lt)))}function Ot(t,n,e){var r=new Nt;return n=null==n?0:+n,r.restart(function(e){r.stop(),t(e+n)},n,e),r}Nt.prototype=Ut.prototype={constructor:Nt,restart:function(e,t,n){if("function"!=typeof e)throw new TypeError("callback is not a function");n=(null==n?St():+n)+(null==t?0:+t),this._next||yt===this||(yt?yt._next=this:mt=this,yt=this),this._call=e,this._time=n,Ht()},stop:function(){this._call&&(this._call=null,this._time=1/0,Ht())}};var Yt=a("start","end","interrupt"),Pt=[],jt=0,zt=1,qt=2,It=3,Rt=4,Wt=5,Xt=6;function Vt(e,t,n,r,a,i){var o=e.__transition;if(o){if(n in o)return}else e.__transition={};!function(i,o,f){var c,u=i.__transition;function s(e){var t,n,r,a;if(f.state!==zt)return d();for(t in u)if((a=u[t]).name===f.name){if(a.state===It)return Ot(s);a.state===Rt?(a.state=Xt,a.timer.stop(),a.on.call("interrupt",i,i.__data__,a.index,a.group),delete u[t]):+t<o&&(a.state=Xt,a.timer.stop(),delete u[t])}if(Ot(function(){f.state===It&&(f.state=Rt,f.timer.restart(l,f.delay,f.time),l(e))}),f.state=qt,f.on.call("start",i,i.__data__,f.index,f.group),f.state===qt){for(f.state=It,c=new Array(r=f.tween.length),t=0,n=-1;t<r;++t)(a=f.tween[t].value.call(i,i.__data__,f.index,f.group))&&(c[++n]=a);c.length=n+1}}function l(e){for(var t=e<f.duration?f.ease.call(null,e/f.duration):(f.timer.restart(d),f.state=Wt,1),n=-1,r=c.length;++n<r;)c[n].call(null,t);f.state===Wt&&(f.on.call("end",i,i.__data__,f.index,f.group),d())}function d(){for(var e in f.state=Xt,f.timer.stop(),delete u[o],u)return;delete i.__transition}(u[o]=f).timer=Ut(function(e){f.state=zt,f.timer.restart(s,f.delay,f.time),f.delay<=e&&s(e-f.delay)},0,f.time)}(e,n,{name:t,index:r,group:a,on:Yt,tween:Pt,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:jt})}function $t(e,t){var n=Jt(e,t);if(n.state>jt)throw new Error("too late; already scheduled");return n}function Zt(e,t){var n=Jt(e,t);if(n.state>qt)throw new Error("too late; already started");return n}function Jt(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Qt(e,t,n){var r=e._id;return e.each(function(){var e=Zt(this,r);(e.value||(e.value={}))[t]=n.apply(this,arguments)}),function(e){return Jt(e,r).value[t]}}function Gt(e,t){var n;return("number"==typeof t?at:t instanceof ge?tt:(n=ge(t))?(t=n,tt):function(e,r){var t,n,a,i,o,f=it.lastIndex=ot.lastIndex=0,c=-1,u=[],s=[];for(e+="",r+="";(t=it.exec(e))&&(n=ot.exec(r));)(a=n.index)>f&&(a=r.slice(f,a),u[c]?u[c]+=a:u[++c]=a),(t=t[0])===(n=n[0])?u[c]?u[c]+=n:u[++c]=n:(u[++c]=null,s.push({i:c,x:at(t,n)})),f=ot.lastIndex;return f<r.length&&(a=r.slice(f),u[c]?u[c]+=a:u[++c]=a),u.length<2?s[0]?(o=s[0].x,function(e){return o(e)+""}):(i=r,function(){return i}):(r=s.length,function(e){for(var t,n=0;n<r;++n)u[(t=s[n]).i]=t.x(e);return u.join("")})})(e,t)}var Kt=Q.prototype.constructor;var en=0;function tn(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function nn(){return++en}var rn=Q.prototype;tn.prototype=function(e){return Q().transition(e)}.prototype={constructor:tn,select:function(e){var t=this._name,n=this._id;"function"!=typeof e&&(e=p(e));for(var r=this._groups,a=r.length,i=new Array(a),o=0;o<a;++o)for(var f,c,u=r[o],s=u.length,l=i[o]=new Array(s),d=0;d<s;++d)(f=u[d])&&(c=e.call(f,f.__data__,d,u))&&("__data__"in f&&(c.__data__=f.__data__),l[d]=c,Vt(l[d],t,n,d,l,Jt(f,n)));return new tn(i,this._parents,t,n)},selectAll:function(e){var t=this._name,n=this._id;"function"!=typeof e&&(e=v(e));for(var r=this._groups,a=r.length,i=[],o=[],f=0;f<a;++f)for(var c,u=r[f],s=u.length,l=0;l<s;++l)if(c=u[l]){for(var d,h=e.call(c,c.__data__,l,u),p=Jt(c,n),b=0,g=h.length;b<g;++b)(d=h[b])&&Vt(d,t,n,b,h,p);i.push(h),o.push(c)}return new tn(i,o,t,n)},filter:function(e){"function"!=typeof e&&(e=w(e));for(var t=this._groups,n=t.length,r=new Array(n),a=0;a<n;++a)for(var i,o=t[a],f=o.length,c=r[a]=[],u=0;u<f;++u)(i=o[u])&&e.call(i,i.__data__,u,o)&&c.push(i);return new tn(r,this._parents,this._name,this._id)},merge:function(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,a=n.length,i=Math.min(r,a),o=new Array(r),f=0;f<i;++f)for(var c,u=t[f],s=n[f],l=u.length,d=o[f]=new Array(l),h=0;h<l;++h)(c=u[h]||s[h])&&(d[h]=c);for(;f<r;++f)o[f]=t[f];return new tn(o,this._parents,this._name,this._id)},selection:function(){return new Kt(this._groups,this._parents)},transition:function(){for(var e=this._name,t=this._id,n=nn(),r=this._groups,a=r.length,i=0;i<a;++i)for(var o,f=r[i],c=f.length,u=0;u<c;++u)if(o=f[u]){var s=Jt(o,t);Vt(o,e,n,u,f,{time:s.time+s.delay+s.duration,delay:0,duration:s.duration,ease:s.ease})}return new tn(r,this._parents,e,n)},call:rn.call,nodes:rn.nodes,node:rn.node,size:rn.size,empty:rn.empty,each:rn.each,on:function(e,t){var n,r,a,i,o,f,c=this._id;return arguments.length<2?Jt(this.node(),c).on.on(e):this.each((n=c,a=t,f=((r=e)+"").trim().split(/^|\s+/).every(function(e){var t=e.indexOf(".");return 0<=t&&(e=e.slice(0,t)),!e||"start"===e})?$t:Zt,function(){var e=f(this,n),t=e.on;t!==i&&(o=(i=t).copy()).on(r,a),e.on=o}))},attr:function(e,t){var n=l(e),r="transform"===n?gt:Gt;return this.attrTween(e,"function"==typeof t?(n.local?function(n,r,a){var i,o,f;return function(){var e,t=a(this);if(null!=t)return(e=this.getAttributeNS(n.space,n.local))===t?null:e===i&&t===o?f:f=r(i=e,o=t);this.removeAttributeNS(n.space,n.local)}}:function(n,r,a){var i,o,f;return function(){var e,t=a(this);if(null!=t)return(e=this.getAttribute(n))===t?null:e===i&&t===o?f:f=r(i=e,o=t);this.removeAttribute(n)}})(n,r,Qt(this,"attr."+e,t)):null==t?(n.local?function(e){return function(){this.removeAttributeNS(e.space,e.local)}}:function(e){return function(){this.removeAttribute(e)}})(n):(n.local?function(t,n,r){var a,i;return function(){var e=this.getAttributeNS(t.space,t.local);return e===r?null:e===a?i:i=n(a=e,r)}}:function(t,n,r){var a,i;return function(){var e=this.getAttribute(t);return e===r?null:e===a?i:i=n(a=e,r)}})(n,r,t+""))},attrTween:function(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==t)return this.tween(n,null);if("function"!=typeof t)throw new Error;var r=l(e);return this.tween(n,(r.local?function(r,e){function t(){var t=this,n=e.apply(t,arguments);return n&&function(e){t.setAttributeNS(r.space,r.local,n(e))}}return t._value=e,t}:function(r,e){function t(){var t=this,n=e.apply(t,arguments);return n&&function(e){t.setAttribute(r,n(e))}}return t._value=e,t})(r,t))},style:function(e,t,n){var r,a,i,o,f,c,u,s,l,d,h,p,b,g,v,m,y,w="transform"==(e+="")?bt:Gt;return null==t?this.styleTween(e,(b=e,g=w,function(){var e=E(this,b),t=(this.style.removeProperty(b),E(this,b));return e===t?null:e===v&&t===m?y:y=g(v=e,m=t)})).on("end.style."+e,(p=e,function(){this.style.removeProperty(p)})):this.styleTween(e,"function"==typeof t?(u=w,s=Qt(this,"style."+(c=e),t),function(){var e=E(this,c),t=s(this);return null==t&&(this.style.removeProperty(c),t=E(this,c)),e===t?null:e===l&&t===d?h:h=u(l=e,d=t)}):(r=e,a=w,i=t+"",function(){var e=E(this,r);return e===i?null:e===o?f:f=a(o=e,i)}),n)},styleTween:function(e,t,n){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==t)return this.tween(r,null);if("function"!=typeof t)throw new Error;return this.tween(r,function(r,e,a){function t(){var t=this,n=e.apply(t,arguments);return n&&function(e){t.style.setProperty(r,n(e),a)}}return t._value=e,t}(e,t,null==n?"":n))},text:function(e){return this.tween("text","function"==typeof e?(n=Qt(this,"text",e),function(){var e=n(this);this.textContent=null==e?"":e}):(t=null==e?"":e+"",function(){this.textContent=t}));var t,n},remove:function(){return this.on("end.remove",(n=this._id,function(){var e=this.parentNode;for(var t in this.__transition)if(+t!==n)return;e&&e.removeChild(this)}));var n},tween:function(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r,a=Jt(this.node(),n).tween,i=0,o=a.length;i<o;++i)if((r=a[i]).name===e)return r.value;return null}return this.each((null==t?function(a,i){var o,f;return function(){var e=Zt(this,a),t=e.tween;if(t!==o)for(var n=0,r=(f=o=t).length;n<r;++n)if(f[n].name===i){(f=f.slice()).splice(n,1);break}e.tween=f}}:function(i,o,f){var c,u;if("function"!=typeof f)throw new Error;return function(){var e=Zt(this,i),t=e.tween;if(t!==c){u=(c=t).slice();for(var n={name:o,value:f},r=0,a=u.length;r<a;++r)if(u[r].name===o){u[r]=n;break}r===a&&u.push(n)}e.tween=u}})(n,e,t))},delay:function(e){var t=this._id;return arguments.length?this.each(("function"==typeof e?function(e,t){return function(){$t(this,e).delay=+t.apply(this,arguments)}}:function(e,t){return t=+t,function(){$t(this,e).delay=t}})(t,e)):Jt(this.node(),t).delay},duration:function(e){var t=this._id;return arguments.length?this.each(("function"==typeof e?function(e,t){return function(){Zt(this,e).duration=+t.apply(this,arguments)}}:function(e,t){return t=+t,function(){Zt(this,e).duration=t}})(t,e)):Jt(this.node(),t).duration},ease:function(e){var t=this._id;return arguments.length?this.each(function(e,t){if("function"!=typeof t)throw new Error;return function(){Zt(this,e).ease=t}}(t,e)):Jt(this.node(),t).ease}};Math.PI,Math.PI;var an={time:null,delay:0,duration:250,ease:function(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}};function on(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))return an.time=St(),an;return n}Q.prototype.interrupt=function(e){return this.each(function(){!function(e,t){var n,r,a,i=e.__transition,o=!0;if(i){for(a in t=null==t?null:t+"",i)(n=i[a]).name===t?(r=n.state>qt&&n.state<Wt,n.state=Xt,n.timer.stop(),r&&n.on.call("interrupt",e,e.__data__,n.index,n.group),delete i[a]):o=!1;o&&delete e.__transition}}(this,e)})},Q.prototype.transition=function(e){var t,n;e=e instanceof tn?(t=e._id,e._name):(t=nn(),(n=an).time=St(),null==e?null:e+"");for(var r=this._groups,a=r.length,i=0;i<a;++i)for(var o,f=r[i],c=f.length,u=0;u<c;++u)(o=f[u])&&Vt(o,e,t,u,f,n||on(o,t));return new tn(r,this._parents,e,t)};Math.PI,Math.PI;var fn="$";function cn(){}function un(e,t){var n=new cn;if(e instanceof cn)e.each(function(e,t){n.set(t,e)});else if(Array.isArray(e)){var r,a=-1,i=e.length;if(null==t)for(;++a<i;)n.set(a,e[a]);else for(;++a<i;)n.set(t(r=e[a],a,e),r)}else if(e)for(var o in e)n.set(o,e[o]);return n}function sn(){}cn.prototype=un.prototype={constructor:cn,has:function(e){return fn+e in this},get:function(e){return this[fn+e]},set:function(e,t){return this[fn+e]=t,this},remove:function(e){var t=fn+e;return t in this&&delete this[t]},clear:function(){for(var e in this)e[0]===fn&&delete this[e]},keys:function(){var e=[];for(var t in this)t[0]===fn&&e.push(t.slice(1));return e},values:function(){var e=[];for(var t in this)t[0]===fn&&e.push(this[t]);return e},entries:function(){var e=[];for(var t in this)t[0]===fn&&e.push({key:t.slice(1),value:this[t]});return e},size:function(){var e=0;for(var t in this)t[0]===fn&&++e;return e},empty:function(){for(var e in this)if(e[0]===fn)return!1;return!0},each:function(e){for(var t in this)t[0]===fn&&e(this[t],t.slice(1),this)}};var ln=un.prototype;sn.prototype=function(e,t){var n=new sn;if(e instanceof sn)e.each(function(e){n.add(e)});else if(e){var r=-1,a=e.length;if(null==t)for(;++r<a;)n.add(e[r]);else for(;++r<a;)n.add(t(e[r],r,e))}return n}.prototype={constructor:sn,has:ln.has,add:function(e){return this[fn+(e+="")]=e,this},remove:ln.remove,clear:ln.clear,values:ln.keys,size:ln.size,empty:ln.empty,each:ln.each};var dn={},hn={};function pn(e){return new Function("d","return {"+e.map(function(e,t){return JSON.stringify(e)+": d["+t+"]"}).join(",")+"}")}function bn(i){var t=new RegExp('["'+i+"\n\r]"),l=i.charCodeAt(0);function n(r,e){var t,n=[],a=r.length,i=0,o=0,f=a<=0,c=!1;function u(){if(f)return hn;if(c)return c=!1,dn;var e,t,n=i;if(34===r.charCodeAt(n)){for(;i++<a&&34!==r.charCodeAt(i)||34===r.charCodeAt(++i););return(e=i)>=a?f=!0:10===(t=r.charCodeAt(i++))?c=!0:13===t&&(c=!0,10===r.charCodeAt(i)&&++i),r.slice(n+1,e-1).replace(/""/g,'"')}for(;i<a;){if(10===(t=r.charCodeAt(e=i++)))c=!0;else if(13===t)c=!0,10===r.charCodeAt(i)&&++i;else if(t!==l)continue;return r.slice(n,e)}return f=!0,r.slice(n,a)}for(10===r.charCodeAt(a-1)&&--a,13===r.charCodeAt(a-1)&&--a;(t=u())!==hn;){for(var s=[];t!==dn&&t!==hn;)s.push(t),t=u();e&&null==(s=e(s,o++))||n.push(s)}return n}function r(e){return e.map(o).join(i)}function o(e){return null==e?"":t.test(e+="")?'"'+e.replace(/"/g,'""')+'"':e}return{parse:function(e,i){var o,f,t=n(e,function(e,t){if(o)return o(e,t-1);var n,r,a;f=e,o=i?(r=i,a=pn(n=e),function(e,t){return r(a(e),t,n)}):pn(e)});return t.columns=f||[],t},parseRows:n,format:function(e,n){var t,r,a;return null==n&&(t=e,r=Object.create(null),a=[],t.forEach(function(e){for(var t in e)t in r||a.push(r[t]=t)}),n=a),[n.map(o).join(i)].concat(e.map(function(t){return n.map(function(e){return o(t[e])}).join(i)})).join("\n")},formatRows:function(e){return e.map(r).join("\n")}}}bn(","),bn("\t");function gn(e,t,n,r){if(isNaN(t)||isNaN(n))return e;var a,i,o,f,c,u,s,l,d,h=e._root,p={data:r},b=e._x0,g=e._y0,v=e._x1,m=e._y1;if(!h)return e._root=p,e;for(;h.length;)if((u=t>=(i=(b+v)/2))?b=i:v=i,(s=n>=(o=(g+m)/2))?g=o:m=o,!(h=(a=h)[l=s<<1|u]))return a[l]=p,e;if(f=+e._x.call(null,h.data),c=+e._y.call(null,h.data),t===f&&n===c)return p.next=h,a?a[l]=p:e._root=p,e;for(;a=a?a[l]=new Array(4):e._root=new Array(4),(u=t>=(i=(b+v)/2))?b=i:v=i,(s=n>=(o=(g+m)/2))?g=o:m=o,(l=s<<1|u)==(d=(o<=c)<<1|i<=f););return a[d]=h,a[l]=p,e}function vn(e,t,n,r,a){this.node=e,this.x0=t,this.y0=n,this.x1=r,this.y1=a}function mn(e){return e[0]}function yn(e){return e[1]}function wn(e,t,n,r,a,i){this._x=e,this._y=t,this._x0=n,this._y0=r,this._x1=a,this._y1=i,this._root=void 0}function _n(e){for(var t={data:e.data},n=t;e=e.next;)n=n.next={data:e.data};return t}var xn=function(e,t,n){var r=new wn(null==t?mn:t,null==n?yn:n,NaN,NaN,NaN,NaN);return null==e?r:r.addAll(e)}.prototype=wn.prototype;xn.copy=function(){var e,t,n=new wn(this._x,this._y,this._x0,this._y0,this._x1,this._y1),r=this._root;if(!r)return n;if(!r.length)return n._root=_n(r),n;for(e=[{source:r,target:n._root=new Array(4)}];r=e.pop();)for(var a=0;a<4;++a)(t=r.source[a])&&(t.length?e.push({source:t,target:r.target[a]=new Array(4)}):r.target[a]=_n(t));return n},xn.add=function(e){var t=+this._x.call(null,e),n=+this._y.call(null,e);return gn(this.cover(t,n),t,n,e)},xn.addAll=function(e){var t,n,r,a,i=e.length,o=new Array(i),f=new Array(i),c=1/0,u=1/0,s=-1/0,l=-1/0;for(n=0;n<i;++n)isNaN(r=+this._x.call(null,t=e[n]))||isNaN(a=+this._y.call(null,t))||((o[n]=r)<c&&(c=r),s<r&&(s=r),(f[n]=a)<u&&(u=a),l<a&&(l=a));for(s<c&&(c=this._x0,s=this._x1),l<u&&(u=this._y0,l=this._y1),this.cover(c,u).cover(s,l),n=0;n<i;++n)gn(this,o[n],f[n],e[n]);return this},xn.cover=function(e,t){if(isNaN(e=+e)||isNaN(t=+t))return this;var n=this._x0,r=this._y0,a=this._x1,i=this._y1;if(isNaN(n))a=(n=Math.floor(e))+1,i=(r=Math.floor(t))+1;else{if(!(e<n||a<e||t<r||i<t))return this;var o,f,c=a-n,u=this._root;switch(f=(t<(r+i)/2)<<1|e<(n+a)/2){case 0:for(;(o=new Array(4))[f]=u,u=o,i=r+(c*=2),(a=n+c)<e||i<t;);break;case 1:for(;(o=new Array(4))[f]=u,u=o,i=r+(c*=2),e<(n=a-c)||i<t;);break;case 2:for(;(o=new Array(4))[f]=u,u=o,r=i-(c*=2),(a=n+c)<e||t<r;);break;case 3:for(;(o=new Array(4))[f]=u,u=o,r=i-(c*=2),e<(n=a-c)||t<r;);}this._root&&this._root.length&&(this._root=u)}return this._x0=n,this._y0=r,this._x1=a,this._y1=i,this},xn.data=function(){var t=[];return this.visit(function(e){if(!e.length)for(;t.push(e.data),e=e.next;);}),t},xn.extent=function(e){return arguments.length?this.cover(+e[0][0],+e[0][1]).cover(+e[1][0],+e[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]},xn.find=function(e,t,n){var r,a,i,o,f,c,u,s=this._x0,l=this._y0,d=this._x1,h=this._y1,p=[],b=this._root;for(b&&p.push(new vn(b,s,l,d,h)),null==n?n=1/0:(s=e-n,l=t-n,d=e+n,h=t+n,n*=n);c=p.pop();)if(!(!(b=c.node)||(a=c.x0)>d||(i=c.y0)>h||(o=c.x1)<s||(f=c.y1)<l))if(b.length){var g=(a+o)/2,v=(i+f)/2;p.push(new vn(b[3],g,v,o,f),new vn(b[2],a,v,g,f),new vn(b[1],g,i,o,v),new vn(b[0],a,i,g,v)),(u=(v<=t)<<1|g<=e)&&(c=p[p.length-1],p[p.length-1]=p[p.length-1-u],p[p.length-1-u]=c)}else{var m=e-+this._x.call(null,b.data),y=t-+this._y.call(null,b.data),w=m*m+y*y;if(w<n){var _=Math.sqrt(n=w);s=e-_,l=t-_,d=e+_,h=t+_,r=b.data}}return r},xn.remove=function(e){if(isNaN(i=+this._x.call(null,e))||isNaN(o=+this._y.call(null,e)))return this;var t,n,r,a,i,o,f,c,u,s,l,d,h=this._root,p=this._x0,b=this._y0,g=this._x1,v=this._y1;if(!h)return this;if(h.length)for(;;){if((u=i>=(f=(p+g)/2))?p=f:g=f,(s=o>=(c=(b+v)/2))?b=c:v=c,!(h=(t=h)[l=s<<1|u]))return this;if(!h.length)break;(t[l+1&3]||t[l+2&3]||t[l+3&3])&&(n=t,d=l)}for(;h.data!==e;)if(!(h=(r=h).next))return this;return(a=h.next)&&delete h.next,r?a?r.next=a:delete r.next:t?(a?t[l]=a:delete t[l],(h=t[0]||t[1]||t[2]||t[3])&&h===(t[3]||t[2]||t[1]||t[0])&&!h.length&&(n?n[d]=h:this._root=h)):this._root=a,this},xn.removeAll=function(e){for(var t=0,n=e.length;t<n;++t)this.remove(e[t]);return this},xn.root=function(){return this._root},xn.size=function(){var t=0;return this.visit(function(e){if(!e.length)for(;++t,e=e.next;);}),t},xn.visit=function(e){var t,n,r,a,i,o,f=[],c=this._root;for(c&&f.push(new vn(c,this._x0,this._y0,this._x1,this._y1));t=f.pop();)if(!e(c=t.node,r=t.x0,a=t.y0,i=t.x1,o=t.y1)&&c.length){var u=(r+i)/2,s=(a+o)/2;(n=c[3])&&f.push(new vn(n,u,s,i,o)),(n=c[2])&&f.push(new vn(n,r,s,u,o)),(n=c[1])&&f.push(new vn(n,u,a,i,s)),(n=c[0])&&f.push(new vn(n,r,a,u,s))}return this},xn.visitAfter=function(e){var t,n=[],r=[];for(this._root&&n.push(new vn(this._root,this._x0,this._y0,this._x1,this._y1));t=n.pop();){var a=t.node;if(a.length){var i,o=t.x0,f=t.y0,c=t.x1,u=t.y1,s=(o+c)/2,l=(f+u)/2;(i=a[0])&&n.push(new vn(i,o,f,s,l)),(i=a[1])&&n.push(new vn(i,s,f,c,l)),(i=a[2])&&n.push(new vn(i,o,l,s,u)),(i=a[3])&&n.push(new vn(i,s,l,c,u))}r.push(t)}for(;t=r.pop();)e(t.node,t.x0,t.y0,t.x1,t.y1);return this},xn.x=function(e){return arguments.length?(this._x=e,this):this._x},xn.y=function(e){return arguments.length?(this._y=e,this):this._y};Math.PI,Math.sqrt(5);function Cn(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,r=e.slice(0,n);return[1<r.length?r[0]+r.slice(2):r,+e.slice(n+1)]}var An,Mn=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Tn(e){return new Dn(e)}function Dn(e){if(!(t=Mn.exec(e)))throw new Error("invalid format: "+e);var t;this.fill=t[1]||" ",this.align=t[2]||">",this.sign=t[3]||"-",this.symbol=t[4]||"",this.zero=!!t[5],this.width=t[6]&&+t[6],this.comma=!!t[7],this.precision=t[8]&&+t[8].slice(1),this.trim=!!t[9],this.type=t[10]||""}function En(e,t){var n=Cn(e,t);if(!n)return e+"";var r=n[0],a=n[1];return a<0?"0."+new Array(-a).join("0")+r:r.length>a+1?r.slice(0,a+1)+"."+r.slice(a+1):r+new Array(a-r.length+2).join("0")}Tn.prototype=Dn.prototype,Dn.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(null==this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(null==this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var Fn={"%":function(e,t){return(100*e).toFixed(t)},b:function(e){return Math.round(e).toString(2)},c:function(e){return e+""},d:function(e){return Math.round(e).toString(10)},e:function(e,t){return e.toExponential(t)},f:function(e,t){return e.toFixed(t)},g:function(e,t){return e.toPrecision(t)},o:function(e){return Math.round(e).toString(8)},p:function(e,t){return En(100*e,t)},r:En,s:function(e,t){var n=Cn(e,t);if(!n)return e+"";var r=n[0],a=n[1],i=a-(An=3*Math.max(-8,Math.min(8,Math.floor(a/3))))+1,o=r.length;return i===o?r:o<i?r+new Array(i-o+1).join("0"):0<i?r.slice(0,i)+"."+r.slice(i):"0."+new Array(1-i).join("0")+Cn(e,Math.max(0,t+i-1))[0]},X:function(e){return Math.round(e).toString(16).toUpperCase()},x:function(e){return Math.round(e).toString(16)}};function Sn(e){return e}var kn,Nn=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Un(e){var t,f,c,x=e.grouping&&e.thousands?(f=e.grouping,c=e.thousands,function(e,t){for(var n=e.length,r=[],a=0,i=f[0],o=0;0<n&&0<i&&(t<o+i+1&&(i=Math.max(1,t-o)),r.push(e.substring(n-=i,n+i)),!((o+=i+1)>t));)i=f[a=(a+1)%f.length];return r.reverse().join(c)}):Sn,r=e.currency,C=e.decimal,A=e.numerals?(t=e.numerals,function(e){return e.replace(/[0-9]/g,function(e){return t[+e]})}):Sn,a=e.percent||"%";function u(e){var u=(e=Tn(e)).fill,s=e.align,l=e.sign,t=e.symbol,d=e.zero,h=e.width,p=e.comma,b=e.precision,g=e.trim,v=e.type;"n"===v?(p=!0,v="g"):Fn[v]||(null==b&&(b=12),g=!0,v="g"),(d||"0"===u&&"="===s)&&(d=!0,u="0",s="=");var m="$"===t?r[0]:"#"===t&&/[boxX]/.test(v)?"0"+v.toLowerCase():"",y="$"===t?r[1]:/[%p]/.test(v)?a:"",w=Fn[v],_=/[defgprs%]/.test(v);function n(e){var t,n,r,a=m,i=y;if("c"===v)i=w(e)+i,e="";else{var o=(e=+e)<0;if(e=w(Math.abs(e),b),g&&(e=function(e){e:for(var t,n=e.length,r=1,a=-1;r<n;++r)switch(e[r]){case".":a=t=r;break;case"0":0===a&&(a=r),t=r;break;default:if(0<a){if(!+e[r])break e;a=0}}return 0<a?e.slice(0,a)+e.slice(t+1):e}(e)),o&&0==+e&&(o=!1),a=(o?"("===l?l:"-":"-"===l||"("===l?"":l)+a,i=("s"===v?Nn[8+An/3]:"")+i+(o&&"("===l?")":""),_)for(t=-1,n=e.length;++t<n;)if((r=e.charCodeAt(t))<48||57<r){i=(46===r?C+e.slice(t+1):e.slice(t))+i,e=e.slice(0,t);break}}p&&!d&&(e=x(e,1/0));var f=a.length+e.length+i.length,c=f<h?new Array(h-f+1).join(u):"";switch(p&&d&&(e=x(c+e,c.length?h-i.length:1/0),c=""),s){case"<":e=a+e+i+c;break;case"=":e=a+c+e+i;break;case"^":e=c.slice(0,f=c.length>>1)+a+e+i+c.slice(f);break;default:e=c+a+e+i}return A(e)}return b=null==b?6:/[gprs]/.test(v)?Math.max(1,Math.min(21,b)):Math.max(0,Math.min(20,b)),n.toString=function(){return e+""},n}return{format:u,formatPrefix:function(e,t){var n,r=u(((e=Tn(e)).type="f",e)),a=3*Math.max(-8,Math.min(8,Math.floor((n=t,((n=Cn(Math.abs(n)))?n[1]:NaN)/3)))),i=Math.pow(10,-a),o=Nn[8+a/3];return function(e){return r(i*e)+o}}}}function Ln(){return new Bn}function Bn(){this.reset()}kn=Un({decimal:".",thousands:",",grouping:[3],currency:["$",""]}),kn.format,kn.formatPrefix,Bn.prototype={constructor:Bn,reset:function(){this.s=this.t=0},add:function(e){On(Hn,e,this.t),On(this,Hn.s,this.s),this.s?this.t+=Hn.t:this.s=Hn.t},valueOf:function(){return this.s}};var Hn=new Bn;function On(e,t,n){var r=e.s=t+n,a=r-t,i=r-a;e.t=t-i+(n-a)}Math.PI,Ln(),Ln(),Ln(),Ln(),Ln(),Ln(),Ln(),Ln();function Yn(e,t){return e<t?-1:t<e?1:t<=e?0:NaN}var Pn,jn,zn;1===(Pn=Yn).length&&(jn=Pn,Pn=function(e,t){return Yn(jn(e),t)}),Math.PI,Math.SQRT2;function qn(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,r=e.slice(0,n);return[1<r.length?r[0]+r.slice(2):r,+e.slice(n+1)]}function In(e,t){var n=qn(e,t);if(!n)return e+"";var r=n[0],a=n[1];return a<0?"0."+new Array(-a).join("0")+r:r.length>a+1?r.slice(0,a+1)+"."+r.slice(a+1):r+new Array(a-r.length+2).join("0")}var Rn={"":function(e,t){e:for(var n,r=(e=e.toPrecision(t)).length,a=1,i=-1;a<r;++a)switch(e[a]){case".":i=n=a;break;case"0":0===i&&(i=a),n=a;break;case"e":break e;default:0<i&&(i=0)}return 0<i?e.slice(0,i)+e.slice(n+1):e},