Skip to content

Instantly share code, notes, and snippets.

@adriano-arrigo
Last active June 30, 2016 20:40
Show Gist options
  • Save adriano-arrigo/65de3309800518ad1b0b7bbb5ceaa009 to your computer and use it in GitHub Desktop.
Save adriano-arrigo/65de3309800518ad1b0b7bbb5ceaa009 to your computer and use it in GitHub Desktop.
fresh block5
import {format} from "d3-format";
import {category20} from "d3-scale";
import {select} from "d3-selection";
import {sankey} from "d3-sankey";
import {json} from "d3-request";
import {rgb} from "d3-color";
export default {
format: format,
scale: {
category20: category20
},
select: select,
sankey: sankey,
json: json,
rgb: rgb
}
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define("d3",e):t.d3=e()}(this,function(){"use strict";function t(){}function e(t){var e;return t=(t+"").trim().toLowerCase(),(e=ln.exec(t))?(e=parseInt(e[1],16),u(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e)):(e=hn.exec(t))?n(parseInt(e[1],16)):(e=dn.exec(t))?u(e[1],e[2],e[3]):(e=gn.exec(t))?u(255*e[1]/100,255*e[2]/100,255*e[3]/100):(e=mn.exec(t))?r(e[1],e[2]/100,e[3]/100):pn.hasOwnProperty(t)?n(pn[t]):null}function n(t){return u(t>>16&255,t>>8&255,255&t)}function r(n,r,o){if(1===arguments.length)if(n instanceof i)o=n.l,r=n.s,n=n.h;else if(n instanceof t||(n=e(n)),n){if(n instanceof i)return n;n=n.rgb();var u=n.r/255,a=n.g/255,s=n.b/255,c=Math.min(u,a,s),f=Math.max(u,a,s),l=f-c;o=(f+c)/2,l?(r=.5>o?l/(f+c):l/(2-f-c),n=u===f?(a-s)/l+6*(s>a):a===f?(s-u)/l+2:(u-a)/l+4,n*=60):(n=NaN,r=o>0&&1>o?0:n)}else n=r=o=NaN;return new i(n,r,o)}function i(t,e,n){this.h=+t,this.s=+e,this.l=+n}function o(t,e,n){return 255*(60>t?e+(n-e)*t/60:180>t?n:240>t?e+(n-e)*(240-t)/60:e)}function u(n,r,i){return 1===arguments.length&&(n instanceof t||(n=e(n)),n?(n=n.rgb(),i=n.b,r=n.g,n=n.r):n=r=i=NaN),new a(n,r,i)}function a(t,e,n){this.r=+t,this.g=+e,this.b=+n}function s(t,e){return e>t?-1:t>e?1:t>=e?0:NaN}function c(t){return 1===t.length&&(t=f(t)),{left:function(e,n,r,i){for(arguments.length<3&&(r=0),arguments.length<4&&(i=e.length);i>r;){var o=r+i>>>1;t(e[o],n)<0?r=o+1:i=o}return r},right:function(e,n,r,i){for(arguments.length<3&&(r=0),arguments.length<4&&(i=e.length);i>r;){var o=r+i>>>1;t(e[o],n)>0?i=o:r=o+1}return r}}}function f(t){return function(e,n){return s(t(e),n)}}function l(){}function h(t,e){var n=new l;if(t instanceof l)t.each(function(t,e){n.set(e,t)});else if(Array.isArray(t)){var r,i=-1,o=t.length;if(1===arguments.length)for(;++i<o;)n.set(i,t[i]);else for(;++i<o;)n.set(e.call(t,r=t[i],i),r)}else if(t)for(var u in t)n.set(u,t[u]);return n}function d(){return new g(arguments)}function g(t){function e(t){var e=(t+="").indexOf("."),n=t;if(e>=0?t=t.slice(0,e):n+=".",t&&!u.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}}function n(t){return function(){for(var e,n,r=u[t],i=-1,o=r.length;++i<o;)(n=(e=r[i]).value)&&n.apply(this,arguments);return s}}var r,i=-1,o=t.length,u={},a={},s=this;for(s.on=function(t,n){if(t=e(t),arguments.length<2)return(n=a[t.name])&&n.value;if(t.type){var r,i=u[t.type],o=a[t.name];o&&(o.value=null,r=i.indexOf(o),u[t.type]=i=i.slice(0,r).concat(i.slice(r+1)),delete a[t.name]),n&&(n={value:n},a[t.name]=n,i.push(n))}else if(null==n)for(var c in u)if(n=a[c+t.name]){n.value=null;var i=u[c],r=i.indexOf(n);u[c]=i.slice(0,r).concat(i.slice(r+1)),delete a[n.name]}return s};++i<o;){if(r=t[i]+"",!r||r in s)throw new Error("illegal or duplicate type: "+r);u[r]=[],s[r]=n(r)}}function m(t,e){function n(){var t,e=c.status;if(!e&&y(c)||e>=200&&300>e||304===e){if(o)try{t=o.call(r,c)}catch(n){return void a.error.call(r,n)}else t=c;a.load.call(r,t)}else a.error.call(r,c)}var r,i,o,u,a=d("beforesend","progress","load","error"),s=h(),c=new XMLHttpRequest;return"undefined"==typeof XDomainRequest||"withCredentials"in c||!/^(http(s)?:)?\/\//.test(t)||(c=new XDomainRequest),"onload"in c?c.onload=c.onerror=n:c.onreadystatechange=function(){c.readyState>3&&n()},c.onprogress=function(t){a.progress.call(r,t)},r={header:function(t,e){return t=(t+"").toLowerCase(),arguments.length<2?s.get(t):(null==e?s.remove(t):s.set(t,e+""),r)},mimeType:function(t){return arguments.length?(i=null==t?null:t+"",r):i},responseType:function(t){return arguments.length?(u=t,r):u},response:function(t){return o=t,r},get:function(t,e){return r.send("GET",t,e)},post:function(t,e){return r.send("POST",t,e)},send:function(e,n,o){return o||"function"!=typeof n||(o=n,n=null),o&&1===o.length&&(o=p(o)),c.open(e,t,!0),null==i||s.has("accept")||s.set("accept",i+",*/*"),c.setRequestHeader&&s.each(function(t,e){c.setRequestHeader(e,t)}),null!=i&&c.overrideMimeType&&c.overrideMimeType(i),null!=u&&(c.responseType=u),o&&r.on("error",o).on("load",function(t){o(null,t)}),a.beforesend.call(r,c),c.send(null==n?null:n),r},abort:function(){return c.abort(),r},on:function(){var t=a.on.apply(a,arguments);return t===a?r:t}},e?r.get(e):r}function p(t){return function(e,n){t(null==e?n:null)}}function y(t){var e=t.responseType;return e&&"text"!==e?t.response:t.responseText}function v(t,e){return function(n,r){var i=m(n).mimeType(t).response(e);return r?i.get(r):i}}function b(t,e){return e>t?-1:t>e?1:t>=e?0:NaN}function M(t){return 1===t.length&&(t=w(t)),{left:function(e,n,r,i){for(arguments.length<3&&(r=0),arguments.length<4&&(i=e.length);i>r;){var o=r+i>>>1;t(e[o],n)<0?r=o+1:i=o}return r},right:function(e,n,r,i){for(arguments.length<3&&(r=0),arguments.length<4&&(i=e.length);i>r;){var o=r+i>>>1;t(e[o],n)>0?i=o:r=o+1}return r}}}function w(t){return function(e,n){return b(t(e),n)}}function _(){}function S(t,e){var n=new _;if(t instanceof _)t.each(function(t,e){n.set(e,t)});else if(Array.isArray(t)){var r,i=-1,o=t.length;if(1===arguments.length)for(;++i<o;)n.set(i,t[i]);else for(;++i<o;)n.set(e(r=t[i],i,t),r)}else if(t)for(var u in t)n.set(u,t[u]);return n}function A(t,e){var n,r,i=-1,o=t.length;if(1===arguments.length){for(;++i<o;)if(null!=(r=t[i])&&r>=r){n=r;break}for(;++i<o;)null!=(r=t[i])&&n>r&&(n=r)}else{for(;++i<o;)if(null!=(r=e(t[i],i,t))&&r>=r){n=r;break}for(;++i<o;)null!=(r=e(t[i],i,t))&&n>r&&(n=r)}return n}function k(){function t(e,i,u,a){if(i>=o.length)return r?r(e):n?e.sort(n):e;for(var s,c,f,l=-1,h=e.length,d=o[i++],g=S(),m=u();++l<h;)(f=g.get(s=d(c=e[l])+""))?f.push(c):g.set(s,[c]);return g.each(function(e,n){a(m,n,t(e,i,u,a))}),m}function e(t,n){if(n>=o.length)return t;var r=[],i=u[n++];return t.each(function(t,i){r.push({key:i,values:e(t,n)})}),i?r.sort(function(t,e){return i(t.key,e.key)}):r}var n,r,i,o=[],u=[];return i={object:function(e){return t(e,0,D,T)},map:function(e){return t(e,0,x,j)},entries:function(n){return e(t(n,0,x,j),0)},key:function(t){return o.push(t),i},sortKeys:function(t){return u[o.length-1]=t,i},sortValues:function(t){return n=t,i},rollup:function(t){return r=t,i}}}function D(){return{}}function T(t,e,n){t[e]=n}function x(){return S()}function j(t,e,n){t.set(e,n)}function N(t,e){var n,r=0,i=t.length,o=-1;if(1===arguments.length)for(;++o<i;)isNaN(n=+t[o])||(r+=n);else for(;++o<i;)isNaN(n=+e(t[o],o,t))||(r+=n);return r}function C(t,e,n){return 1===arguments.length&&(t instanceof Y?(n=t.l,e=t.c,t=t.h):(t instanceof z||(t=L(t)),n=t.l,e=Math.sqrt(t.a*t.a+t.b*t.b),t=Math.atan2(t.b,t.a)*kn,0>t&&(t+=360))),new Y(t,e,n)}function Y(t,e,n){this.h=+t,this.c=+e,this.l=+n}function L(t,e,n){if(1===arguments.length)if(t instanceof z)n=t.b,e=t.a,t=t.l;else if(t instanceof Y){var r=t.h*An;n=Math.sin(r)*t.c,e=Math.cos(r)*t.c,t=t.l}else{t instanceof a||(t=u(t));var i=P(t.r),o=P(t.g),n=P(t.b),s=H((.4124564*i+.3575761*o+.1804375*n)/xn),c=H((.2126729*i+.7151522*o+.072175*n)/jn),f=H((.0193339*i+.119192*o+.9503041*n)/Nn);n=200*(c-f),e=500*(s-c),t=116*c-16}return new z(t,e,n)}function z(t,e,n){this.l=+t,this.a=+e,this.b=+n}function H(t){return t>zn?Math.pow(t,1/3):t/Ln+Cn}function E(t){return t>Yn?t*t*t:Ln*(t-Cn)}function F(t){return 255*(.0031308>=t?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function P(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function J(t,e,n){if(1===arguments.length)if(t instanceof U)n=t.l,e=t.s,t=t.h;else{t instanceof a||(t=u(t));var r=t.r/255,i=t.g/255,o=t.b/255;n=(Bn*o+On*r-Xn*i)/(Bn+On-Xn);var s=o-n,c=(Un*(i-n)-Pn*s)/Jn;e=Math.sqrt(c*c+s*s)/(Un*n*(1-n)),t=e?Math.atan2(c,s)*kn-120:NaN,0>t&&(t+=360)}return new U(t,e,n)}function U(t,e,n){this.h=+t,this.s=+e,this.l=+n}function O(t,e){return t=+t,e-=t,function(n){return t+e*n}}function X(){function t(){d.forEach(function(t){t.sourceLinks=[],t.targetLinks=[]}),g.forEach(function(t){var e=t.source,n=t.target;"number"==typeof e&&(e=t.source=d[t.source]),"number"==typeof n&&(n=t.target=d[t.target]),e.sourceLinks.push(t),n.targetLinks.push(t)})}function e(){d.forEach(function(t){t.value=Math.max(N(t.sourceLinks,s),N(t.targetLinks,s))})}function n(){for(var t,e=d,n=0;e.length;)t=[],e.forEach(function(e){e.x=n,e.dx=f,e.sourceLinks.forEach(function(e){t.indexOf(e.target)<0&&t.push(e.target)})}),e=t,++n;r(n),i((h[0]-f)/(n-1))}function r(t){d.forEach(function(e){e.sourceLinks.length||(e.x=t-1)})}function i(t){d.forEach(function(e){e.x*=t})}function o(t){function e(){var t=A(u,function(t){return(h[1]-(t.length-1)*l)/N(t,s)});u.forEach(function(e){e.forEach(function(e,n){e.y=n,e.dy=e.value*t})}),g.forEach(function(e){e.dy=e.value*t})}function n(t){function e(t){return a(t.source)*t.value}u.forEach(function(n,r){n.forEach(function(n){if(n.targetLinks.length){var r=N(n.targetLinks,e)/N(n.targetLinks,s);n.y+=(r-a(n))*t}})})}function r(t){function e(t){return a(t.target)*t.value}u.slice().reverse().forEach(function(n){n.forEach(function(n){if(n.sourceLinks.length){var r=N(n.sourceLinks,e)/N(n.sourceLinks,s);n.y+=(r-a(n))*t}})})}function i(){u.forEach(function(t){var e,n,r,i=0,u=t.length;for(t.sort(o),r=0;u>r;++r)e=t[r],n=i-e.y,n>0&&(e.y+=n),i=e.y+e.dy+l;if(n=i-l-h[1],n>0)for(i=e.y-=n,r=u-2;r>=0;--r)e=t[r],n=e.y+e.dy+l-i,n>0&&(e.y-=n),i=e.y})}function o(t,e){return t.y-e.y}var u=k().key(function(t){return t.x}).sortKeys(b).entries(d).map(function(t){return t.values});e(),i();for(var c=1;t>0;--t)r(c*=.99),i(),n(c),i()}function u(){function t(t,e){return t.source.y-e.source.y}function e(t,e){return t.target.y-e.target.y}d.forEach(function(n){n.sourceLinks.sort(e),n.targetLinks.sort(t)}),d.forEach(function(t){var e=0,n=0;t.sourceLinks.forEach(function(t){t.sy=e,e+=t.dy}),t.targetLinks.forEach(function(t){t.ty=n,n+=t.dy})})}function a(t){return t.y+t.dy/2}function s(t){return t.value}var c={},f=24,l=8,h=[1,1],d=[],g=[];return c.nodeWidth=function(t){return arguments.length?(f=+t,c):f},c.nodePadding=function(t){return arguments.length?(l=+t,c):l},c.nodes=function(t){return arguments.length?(d=t,c):d},c.links=function(t){return arguments.length?(g=t,c):g},c.size=function(t){return arguments.length?(h=t,c):h},c.layout=function(r){return t(),e(),n(),o(r),u(),c},c.relayout=function(){return u(),c},c.link=function(){function t(t){var n=t.source.x+t.source.dx,r=t.target.x,i=O(n,r),o=i(e),u=i(1-e),a=t.source.y+t.sy+t.dy/2,s=t.target.y+t.ty+t.dy/2;return"M"+n+","+a+"C"+o+","+a+" "+u+","+s+" "+r+","+s}var e=.5;return t.curvature=function(n){return arguments.length?(e=+n,t):e},t},c}function B(t){return t&&(t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView)}function W(t,e){function n(){return $(this,t,e)}function r(){return $(this,t,e.apply(this,arguments))}return this.each("function"==typeof e?r:n)}function $(t,e,n){var r=B(t),i=r.CustomEvent;i?i=new i(e,n):(i=r.document.createEvent("Event"),n?(i.initEvent(e,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(e,!1,!1)),t.dispatchEvent(i)}function q(t){return t.replace($n,"\\$&")}function R(t,e,n){function r(){for(var r=c,o=arguments.length>>1,a=new Array(o);--o>=0;)r=r[arguments[(o<<1)+1]],a[o]=o?r._parent:r;var f=I(e,a,arguments);u&&(f=Z(f)),i.call(this),this.addEventListener(t,this[s]=f,f._capture=n),f._listener=e}function i(){var e=this[s];e&&(this.removeEventListener(t,e,e._capture),delete this[s])}function o(){var e,n=new RegExp("^__on([^.]+)"+q(t)+"$");for(var r in this)if(e=r.match(n)){var i=this[r];this.removeEventListener(e[1],i,i._capture),delete this[r]}}var u,a=arguments.length,s="__on"+t,c=this._root;return 2>a?(a=this.node()[s])&&a._listener:(3>a&&(n=!1),(a=t.indexOf("."))>0&&(t=t.slice(0,a)),(u=qn.hasOwnProperty(t))&&(t=qn[t]),this.each(e?a?r:G:a?i:o))}function I(t,e,n){return function(r){for(var i=e.length,o=Rn;--i>=0;)n[i<<1]=e[i].__data__;Rn=r;try{t.apply(e[0],n)}finally{Rn=o}}}function Z(t){return function(e){var n=e.relatedTarget;n&&(n===this||8&n.compareDocumentPosition(this))||t(e)}}function G(){}function K(t){return arguments.length?this.property("__data__",t):this.node().__data__}function V(){return this.each(function(){var t=this.parentNode;t&&t.removeChild(this)})}function Q(t){var e=t.indexOf(":"),n=t;return e>=0&&"xmlns"!==(n=t.slice(0,e))&&(t=t.slice(e+1)),Zn.hasOwnProperty(n)?{space:Zn[n],local:t}:t}function tt(t){return function(){return this.querySelector(t)}}function et(t,e){function n(){return this.appendChild(t.apply(this,arguments))}function r(){return this.insertBefore(t.apply(this,arguments),e.apply(this,arguments)||null)}return"function"!=typeof t&&(t=nt(t)),this.select(arguments.length<2?n:("function"!=typeof e&&(e=tt(e)),r))}function nt(t){function e(){var e=this.ownerDocument,n=this.namespaceURI;return n?e.createElementNS(n,t):e.createElement(t)}function n(){return this.ownerDocument.createElementNS(t.space,t.local)}return t=Q(t),t.local?n:e}function rt(t){function e(){this.innerHTML=t}function n(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}return arguments.length?(null==t&&(t=""),this.each("function"==typeof t?n:e)):this.node().innerHTML}function it(t){function e(){this.textContent=t}function n(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}return arguments.length?(null==t&&(t=""),this.each("function"==typeof t?n:e)):this.node().textContent}function ot(t,e){function n(){for(var n=-1;++n<i;)t[n](this,e)}function r(){for(var n=-1,r=e.apply(this,arguments);++n<i;)t[n](this,r)}t=(t+"").trim().split(/^|\s+/);var i=t.length;if(arguments.length<2){var o=this.node(),u=-1;if(e=o.classList){for(;++u<i;)if(!e.contains(t[u]))return!1}else for(e=o.getAttribute("class");++u<i;)if(!st(t[u]).test(e))return!1;return!0}return t=t.map(ut),this.each("function"==typeof e?r:n)}function ut(t){var e;return function(n,r){if(i=n.classList)return r?i.add(t):i.remove(t);e||(e=st(t));var i=n.getAttribute("class")||"";r?(e.lastIndex=0,e.test(i)||n.setAttribute("class",at(i+" "+t))):n.setAttribute("class",at(i.replace(e," ")))}}function at(t){return t.trim().replace(/\s+/g," ")}function st(t){return new RegExp("(?:^|\\s+)"+q(t)+"(?:\\s+|$)","g")}function ct(t,e){function n(){delete this[t]}function r(){this[t]=e}function i(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}return arguments.length<2?this.node()[t]:this.each(null==e?n:"function"==typeof e?i:r)}function ft(t,e,n){function r(){this.style.removeProperty(t)}function i(){this.style.setProperty(t,e,n)}function o(){var r=e.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,n)}var u=arguments.length;return 2>u?B(u=this.node()).getComputedStyle(u,null).getPropertyValue(t):(3>u&&(n=""),this.each(null==e?r:"function"==typeof e?o:i))}function lt(t,e){function n(){this.removeAttribute(t)}function r(){this.removeAttributeNS(t.space,t.local)}function i(){this.setAttribute(t,e)}function o(){this.setAttributeNS(t.space,t.local,e)}function u(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}function a(){var n=e.apply(this,arguments);null==n?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}if(t=Q(t),arguments.length<2){var s=this.node();return t.local?s.getAttributeNS(t.space,t.local):s.getAttribute(t)}return this.each(null==e?t.local?r:n:"function"==typeof e?t.local?a:u:t.local?o:i)}function ht(t){function e(n,i){var o,u=-1,a=n.length;if(--i)for(var s=2*i,c=s+1;++u<a;)(o=n[u])&&(r[s]=o._parent.__data__,r[c]=u,e(o,i));else for(;++u<a;)(o=n[u])&&(r[0]=o.__data__,r[1]=u,t.apply(o,r))}var n=this._depth,r=new Array(n);return e(this._root,n),this}function dt(){return!this.node()}function gt(){var t=0;return this.each(function(){++t}),t}function mt(){return pt(this._root,this._depth)}function pt(t,e){var n,r=-1,i=t.length;if(--e){for(;++r<i;)if((n=t[r])&&(n=pt(n,e)))return n}else for(;++r<i;)if(n=t[r])return n}function yt(){var t=new Array(this.size()),e=-1;return this.each(function(){t[++e]=this}),t}function vt(){var t=arguments[0];return t.apply(arguments[0]=this,arguments),this}function bt(t){return t._root=Mt(t._root,t._depth)}function Mt(t,e){var n,r=-1,i=t.length;if(--e)for(;++r<i;)(n=t[r])&&(t[r]=Mt(n,e));else if(!Array.isArray(t)){for(var o=new Array(i);++r<i;)o[r]=t[r];o._parent=t._parent,t=o}return t}function wt(t){function e(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}function n(t,r){if(--r)for(var i,o=-1,u=t.length;++o<u;)(i=t[o])&&n(i,r);else t.sort(e)}return t||(t=_t),n(bt(this),this._depth),this.order()}function _t(t,e){return e>t?-1:t>e?1:t>=e?0:NaN}function St(){return At(this._root,this._depth),this}function At(t,e){var n,r,i=t.length;if(--e)for(;--i>=0;)(n=t[i])&&At(n,e);else for(r=t[--i];--i>=0;)(n=t[i])&&(r&&r!==n.nextSibling&&r.parentNode.insertBefore(n,r),r=n)}function kt(t){return new Et(Dt(bt(t),t._depth),t._depth)}function Dt(t,e){var n,r=-1,i=t.length,o=new Array(i);if(--e)for(;++r<i;)(n=t[r])&&(o[r]=Dt(n,e));return o._parent=t._parent,o}function Tt(){return this._exit||(this._exit=kt(this))}function xt(){return this._enter||(this._enter=kt(this),this._enter._update=this),this._enter}function jt(t,e){function n(e,r,i,o){var u,a,f=-1;if(o--){var l=2*o,h=l+1;for(u=e.length;++f<u;)(a=e[f])&&(s[l]=a._parent.__data__,s[h]=f,n(a,r[f],i[f],o))}else{var d,g=0;for(c(e,r,i,t.apply(e._parent,s)),u=e.length;++f<u;)if(d=r[f]){for(f>=g&&(g=f+1);!(a=e[g])&&++g<u;);d._next=a||null}}}function r(t,e,n,r){var i,o=0,u=t.length,a=r.length,s=Math.min(u,a);for(e.length=0,e.length=a,n.length=0,n.length=u;s>o;++o)(i=t[o])?i.__data__=r[o]:e[o]=new Nt(t._parent,r[o]);for(;a>o;++o)e[o]=new Nt(t._parent,r[o]);for(;u>o;++o)(i=t[o])&&(n[o]=t[o]);t.length=a}function i(t,n,r,i){var o,u,a,c=i.length,f=t.length,l={},h=new Array(2).concat(s),d=new Array(f);for(n.length=0,n.length=c,r.length=0,r.length=f,o=0;f>o;++o)(u=t[o])&&(h[0]=u.__data__,h[1]=o,d[o]=a=Gn+e.apply(u,h),l[a]?r[o]=u:l[a]=u);for(t.length=0,t.length=c,o=0;c>o;++o)h[0]=i[o],h[1]=o,a=Gn+e.apply(t._parent,h),(u=l[a])?u!==!0&&(t[o]=u,u.__data__=i[o]):n[o]=new Nt(t._parent,i[o]),l[a]=!0;for(o=0;f>o;++o)(u=l[d[o]])!==!0&&(r[o]=u)}if(!t){var o=new Array(this.size()),u=-1;return this.each(function(t){o[++u]=t}),o}var a=this._depth-1,s=new Array(2*a),c=e?i:r;return"function"!=typeof t&&(t=Ct(t)),n(this._root,this.enter()._root,this.exit()._root,a),this}function Nt(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}function Ct(t){return function(){return t}}function Yt(t){function e(n,i){var o,u,a=-1,s=n.length;if(--i){var c=2*i,f=c+1;for(u=new Array(s);++a<s;)(o=n[a])&&(r[c]=o._parent.__data__,r[f]=a,u[a]=e(o,i))}else for(u=[];++a<s;)(o=n[a])&&(r[0]=o.__data__,r[1]=a,t.apply(o,r)&&u.push(o));return u._parent=n._parent,u}var n=this._depth,r=new Array(2*n);return"function"!=typeof t&&(t=Kn(t)),new Et(e(this._root,n),n)}function Lt(t){function e(n,i){var o,u,a=-1,s=n.length,c=new Array(s);if(--i)for(var f=2*i,l=f+1;++a<s;)(o=n[a])&&(r[f]=o._parent.__data__,r[l]=a,c[a]=e(o,i));else for(;++a<s;)(o=n[a])&&(r[0]=o.__data__,r[1]=a,c[a]=u=t.apply(o,r),u._parent=o);return c._parent=n._parent,c}var n=this._depth,r=new Array(2*n);return"function"!=typeof t&&(t=zt(t)),new Et(e(this._root,n),n+1)}function zt(t){return function(){return this.querySelectorAll(t)}}function Ht(t){function e(n,i,o){var u,a,s=-1,c=n.length,f=new Array(c);if(--o)for(var l=2*o,h=l+1;++s<c;)(u=n[s])&&(r[l]=u._parent.__data__,r[h]=s,f[s]=e(u,i&&i[s],o));else for(;++s<c;)(u=n[s])&&(r[0]=u.__data__,r[1]=s,(a=t.apply(u,r))&&("__data__"in u&&(a.__data__=u.__data__),i&&(i[s]=a,delete n[s]),f[s]=a));return f._parent=n._parent,f}var n=this._depth,r=new Array(2*n);return"function"!=typeof t&&(t=tt(t)),new Et(e(this._root,this._update&&this._update._root,n),n)}function Et(t,e){this._root=t,this._depth=e,this._enter=this._update=this._exit=null}function Ft(){return new Et([document.documentElement],1)}function Pt(t){return new Et(["string"==typeof t?document.querySelector(t):t],1)}function Jt(t,e){return e>t?-1:t>e?1:t>=e?0:NaN}function Ut(t){return 1===t.length&&(t=Ot(t)),{left:function(e,n,r,i){for(arguments.length<3&&(r=0),arguments.length<4&&(i=e.length);i>r;){var o=r+i>>>1;t(e[o],n)<0?r=o+1:i=o}return r},right:function(e,n,r,i){for(arguments.length<3&&(r=0),arguments.length<4&&(i=e.length);i>r;){var o=r+i>>>1;t(e[o],n)>0?i=o:r=o+1}return r}}}function Ot(t){return function(e,n){return Jt(t(e),n)}}function Xt(){}function Bt(t,e){var n=new Xt;if(t instanceof Xt)t.each(function(t,e){n.set(e,t)});else if(Array.isArray(t)){var r,i=-1,o=t.length;if(1===arguments.length)for(;++i<o;)n.set(i,t[i]);else for(;++i<o;)n.set(e(r=t[i],i,t),r)}else if(t)for(var u in t)n.set(u,t[u]);return n}function Wt(t,e,n){for(var r=new Array(t),i=-1;++i<t;)r[i]=e+n*i;return r}function $t(t,e){function n(n){var o=n+"",u=r.get(o);if(!u){if("range"!==e.t)return;r.set(o,u=t.push(n))}return i[(u-1)%i.length]}var r,i,o;return n.domain=function(i){if(!arguments.length)return t.slice();t=[],r=Bt();for(var o,u,a=-1,s=i.length;++a<s;)r.has(u=(o=i[a])+"")||r.set(u,t.push(o));return n[e.t].apply(n,e.a)},n.range=function(t){return arguments.length?(i=t.slice(),o=0,e={t:"range",a:arguments},n):i.slice()},n.rangePoints=function(r,u){u=arguments.length<2?0:+u;var a=+r[0],s=+r[1],c=t.length<2?(a=(a+s)/2,0):(s-a)/(t.length-1+u);return i=Wt(t.length,a+c*u/2,c),o=0,e={t:"rangePoints",a:arguments},n},n.rangeRoundPoints=function(r,u){u=arguments.length<2?0:+u;var a=+r[0],s=+r[1],c=t.length<2?(a=s=Math.round((a+s)/2),0):(s-a)/(t.length-1+u)|0;return i=Wt(t.length,a+Math.round(c*u/2+(s-a-(t.length-1+u)*c)/2),c),o=0,e={t:"rangeRoundPoints",a:arguments},n},n.rangeBands=function(r,u,a){u=arguments.length<2?0:+u,a=arguments.length<3?u:+a;var s=+r[1]<+r[0],c=+r[s-0],f=+r[1-s],l=(f-c)/(t.length-u+2*a);return i=Wt(t.length,c+l*a,l),s&&i.reverse(),o=l*(1-u),e={t:"rangeBands",a:arguments},n},n.rangeRoundBands=function(r,u,a){u=arguments.length<2?0:+u,a=arguments.length<3?u:+a;var s=+r[1]<+r[0],c=+r[s-0],f=+r[1-s],l=Math.floor((f-c)/(t.length-u+2*a));return i=Wt(t.length,c+Math.round((f-c-(t.length-u)*l)/2),l),s&&i.reverse(),o=Math.round(l*(1-u)),e={t:"rangeRoundBands",a:arguments},n},n.rangeBand=function(){return o},n.rangeExtent=function(){var t=e.a[0],n=t[0],r=t[t.length-1];return n>r&&(t=r,r=n,n=t),[n,r]},n.copy=function(){return $t(t,e)},n.domain(t)}function qt(){return $t([],{t:"range",a:[[]]})}function Rt(){return qt().range(["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"])}function It(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,r=t.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+t.slice(n+1)]}function Zt(t){return t=It(Math.abs(t)),t?t[1]:NaN}function Gt(t,e){return function(n,r){for(var i=n.length,o=[],u=0,a=t[0],s=0;i>0&&a>0&&(s+a+1>r&&(a=Math.max(1,r-s)),o.push(n.substring(i-=a,i+a)),!((s+=a+1)>r));)a=t[u=(u+1)%t.length];return o.reverse().join(e)}}function Kt(t,e){var n=It(t,e);if(!n)return t+"";var r=n[0],i=n[1],o=i-(er=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,u=r.length;return o===u?r:o>u?r+new Array(o-u+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+It(t,Math.max(0,e+o-1))[0]}function Vt(t,e){var n=It(t,e);if(!n)return t+"";var r=n[0],i=n[1];return 0>i?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}function Qt(t,e){t=t.toPrecision(e);t:for(var n,r=t.length,i=1,o=-1;r>i;++i)switch(t[i]){case".":o=n=i;break;case"0":0===o&&(o=i),n=i;break;case"e":break t;default:o>0&&(o=0)}return o>0?t.slice(0,o)+t.slice(n+1):t}function te(t){return new ee(t)}function ee(t){if(!(e=rr.exec(t)))throw new Error("invalid format: "+t);var e,n=e[1]||" ",r=e[2]||">",i=e[3]||"-",o=e[4]||"",u=!!e[5],a=e[6]&&+e[6],s=!!e[7],c=e[8]&&+e[8].slice(1),f=e[9]||"";"n"===f?(s=!0,f="g"):nr[f]||(f=""),(u||"0"===n&&"="===r)&&(u=!0,n="0",r="="),this.fill=n,this.align=r,this.sign=i,this.symbol=o,this.zero=u,this.width=a,this.comma=s,this.precision=c,this.type=f}function ne(t){return t}function re(t){function e(t){t=te(t);var e=t.fill,n=t.align,u=t.sign,a=t.symbol,s=t.zero,c=t.width,f=t.comma,l=t.precision,h=t.type,d="$"===a?i[0]:"#"===a&&/[boxX]/.test(h)?"0"+h.toLowerCase():"",g="$"===a?i[1]:/[%p]/.test(h)?"%":"",m=nr[h],p=!h||/[defgprs%]/.test(h);return l=null==l?h?6:12:/[gprs]/.test(h)?Math.max(1,Math.min(21,l)):Math.max(0,Math.min(20,l)),function(t){var i=d,a=g;if("c"===h)a=m(t)+a,t="";else{t=+t;var y=(0>t||0>1/t)&&(t*=-1,!0);if(t=m(t,l),y){var v,b=-1,M=t.length;for(y=!1;++b<M;)if(v=t.charCodeAt(b),v>48&&58>v||"x"===h&&v>96&&103>v||"X"===h&&v>64&&71>v){y=!0;break}}if(i=(y?"("===u?u:"-":"-"===u||"("===u?"":u)+i,a=a+("s"===h?ir[8+er/3]:"")+(y&&"("===u?")":""),p)for(var v,b=-1,M=t.length;++b<M;)if(v=t.charCodeAt(b),48>v||v>57){a=(46===v?o+t.slice(b+1):t.slice(b))+a,t=t.slice(0,b);break}}f&&!s&&(t=r(t,1/0));var w=i.length+t.length+a.length,_=c>w?new Array(c-w+1).join(e):"";switch(f&&s&&(t=r(_+t,_.length?c-a.length:1/0),_=""),n){case"<":return i+t+a+_;case"=":return i+_+t+a;case"^":return _.slice(0,w=_.length>>1)+i+t+a+_.slice(w)}return _+i+t+a}}function n(t,n){var r=e((t=te(t),t.type="f",t)),i=3*Math.max(-8,Math.min(8,Math.floor(Zt(n)/3))),o=Math.pow(10,-i),u=ir[8+i/3];return function(t){return r(o*t)+u}}var r=t.grouping&&t.thousands?Gt(t.grouping,t.thousands):ne,i=t.currency,o=t.decimal;return{format:e,formatPrefix:n}}function ie(t,e,n){function r(e){return t(e=new Date(+e)),e}return r.floor=r,r.round=function(n){var r=new Date(+n),i=new Date(n-1);return t(r),t(i),e(i,1),i-n>n-r?r:i},r.ceil=function(n){return t(n=new Date(n-1)),e(n,1),n},r.offset=function(t,n){return e(t=new Date(+t),null==n?1:Math.floor(n)),t},r.range=function(n,r,i){var o=[];if(n=new Date(n-1),r=new Date(+r),i=null==i?1:Math.floor(i),!(r>n&&i>0))return o;for(e(n,1),t(n),r>n&&o.push(new Date(+n));e(n,i),t(n),r>n;)o.push(new Date(+n));return o},r.filter=function(n){return ie(function(e){for(;t(e),!n(e);)e.setTime(e-1)},function(t,r){for(;--r>=0;)for(;e(t,1),!n(t););})},n&&(r.count=function(e,r){return ar.setTime(+e),sr.setTime(+r),t(ar),t(sr),Math.floor(n(ar,sr))}),r}function oe(t){return ie(function(e){e.setHours(0,0,0,0),e.setDate(e.getDate()-(e.getDay()+7-t)%7)},function(t,e){t.setDate(t.getDate()+7*e)},function(t,e){return(e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/6048e5})}function ue(t){return ie(function(e){e.setUTCHours(0,0,0,0),e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7)},function(t,e){t.setUTCDate(t.getUTCDate()+7*e)},function(t,e){return(e-t)/6048e5})}function ae(t){if(0<=t.y&&t.y<100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function se(t){if(0<=t.y&&t.y<100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function ce(t){return{y:t,m:0,d:1,H:0,M:0,S:0,L:0}}function fe(t){function e(t,e){return function(n){var r,i,o,u=[],a=-1,s=0,c=t.length;for(n instanceof Date||(n=new Date(+n));++a<c;)37===t.charCodeAt(a)&&(u.push(t.slice(s,a)),null!=(i=yr[r=t.charAt(++a)])?r=t.charAt(++a):i="e"===r?" ":"0",(o=e[r])&&(r=o(n,i)),u.push(r),s=a+1);return u.push(t.slice(s,a)),u.join("")}}function n(t,e){return function(n){var i=ce(1900),o=r(i,t,n+="",0);if(o!=n.length)return null;if("p"in i&&(i.H=i.H%12+12*i.p),"W"in i||"U"in i){"w"in i||(i.w="W"in i?1:0);var u="Z"in i?se(ce(i.y)).getUTCDay():e(ce(i.y)).getDay();i.m=0,i.d="W"in i?(i.w+6)%7+7*i.W-(u+5)%7:i.w+7*i.U-(u+6)%7}return"Z"in i?(i.H+=i.Z/100|0,i.M+=i.Z%100,se(i)):e(i)}}function r(t,e,n,r){for(var i,o,u=0,a=e.length,s=n.length;a>u;){if(r>=s)return-1;if(i=e.charCodeAt(u++),37===i){if(i=e.charAt(u++),o=X[i in yr?e.charAt(u++):i],!o||(r=o(t,n,r))<0)return-1}else if(i!=n.charCodeAt(r++))return-1}return r}function i(t,e,n){var r=N.exec(e.slice(n));return r?(t.p=C[r[0].toLowerCase()],n+r[0].length):-1}function o(t,e,n){var r=z.exec(e.slice(n));return r?(t.w=H[r[0].toLowerCase()],n+r[0].length):-1}function u(t,e,n){var r=Y.exec(e.slice(n));return r?(t.w=L[r[0].toLowerCase()],n+r[0].length):-1}function a(t,e,n){var r=P.exec(e.slice(n));return r?(t.m=J[r[0].toLowerCase()],n+r[0].length):-1}function s(t,e,n){var r=E.exec(e.slice(n));return r?(t.m=F[r[0].toLowerCase()],n+r[0].length):-1}function c(t,e,n){return r(t,_,e,n)}function f(t,e,n){return r(t,S,e,n)}function l(t,e,n){return r(t,A,e,n)}function h(t){return T[t.getDay()]}function d(t){return D[t.getDay()]}function g(t){return j[t.getMonth()]}function m(t){return x[t.getMonth()]}function p(t){return k[+(t.getHours()>=12)]}function y(t){return T[t.getUTCDay()]}function v(t){return D[t.getUTCDay()]}function b(t){return j[t.getUTCMonth()]}function M(t){return x[t.getUTCMonth()]}function w(t){return k[+(t.getUTCHours()>=12)]}var _=t.dateTime,S=t.date,A=t.time,k=t.periods,D=t.days,T=t.shortDays,x=t.months,j=t.shortMonths,N=de(k),C=ge(k),Y=de(D),L=ge(D),z=de(T),H=ge(T),E=de(x),F=ge(x),P=de(j),J=ge(j),U={a:h,A:d,b:g,B:m,c:null,d:je,e:je,H:Ne,I:Ce,j:Ye,L:Le,m:ze,M:He,p:p,S:Ee,U:Fe,w:Pe,W:Je,x:null,X:null,y:Ue,Y:Oe,Z:Xe,"%":rn},O={a:y,A:v,b:b,B:M,c:null,d:Be,e:Be,H:We,I:$e,j:qe,L:Re,m:Ie,M:Ze,p:w,S:Ge,U:Ke,w:Ve,W:Qe,x:null,X:null,y:tn,Y:en,Z:nn,"%":rn},X={a:o,A:u,b:a,B:s,c:c,d:_e,e:_e,H:Ae,I:Ae,j:Se,L:Te,m:we,M:ke,p:i,S:De,U:pe,w:me,W:ye,x:f,X:l,y:be,Y:ve,Z:Me,"%":xe};return U.x=e(S,U),U.X=e(A,U),U.c=e(_,U),O.x=e(S,O),O.X=e(A,O),O.c=e(_,O),{format:function(t){var r=e(t+="",U);return r.parse=n(t,ae),r.toString=function(){return t},r},utcFormat:function(t){var r=e(t+="",O);return r.parse=n(t,se),r.toString=function(){return t},r}}}function le(t,e,n){var r=0>t?"-":"",i=(r?-t:t)+"",o=i.length;return r+(n>o?new Array(n-o+1).join(e)+i:i)}function he(t){return t.replace(Mr,"\\$&")}function de(t){return new RegExp("^(?:"+t.map(he).join("|")+")","i")}function ge(t){for(var e={},n=-1,r=t.length;++n<r;)e[t[n].toLowerCase()]=n;return e}function me(t,e,n){var r=vr.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function pe(t,e,n){var r=vr.exec(e.slice(n));return r?(t.U=+r[0],n+r[0].length):-1}function ye(t,e,n){var r=vr.exec(e.slice(n));return r?(t.W=+r[0],n+r[0].length):-1}function ve(t,e,n){var r=vr.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function be(t,e,n){var r=vr.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function Me(t,e,n){var r=/^(Z)|([+-]\d\d)(?:\:?(\d\d))?/.exec(e.slice(n,n+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function we(t,e,n){var r=vr.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function _e(t,e,n){var r=vr.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function Se(t,e,n){var r=vr.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function Ae(t,e,n){var r=vr.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function ke(t,e,n){var r=vr.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function De(t,e,n){var r=vr.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function Te(t,e,n){var r=vr.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function xe(t,e,n){var r=br.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function je(t,e){return le(t.getDate(),e,2)}function Ne(t,e){return le(t.getHours(),e,2)}function Ce(t,e){return le(t.getHours()%12||12,e,2)}function Ye(t,e){return le(1+cr.count(hr(t),t),e,3)}function Le(t,e){return le(t.getMilliseconds(),e,3)}function ze(t,e){return le(t.getMonth()+1,e,2)}function He(t,e){return le(t.getMinutes(),e,2)}function Ee(t,e){return le(t.getSeconds(),e,2)}function Fe(t,e){return le(fr.count(hr(t),t),e,2)}function Pe(t){return t.getDay()}function Je(t,e){return le(lr.count(hr(t),t),e,2)}function Ue(t,e){return le(t.getFullYear()%100,e,2)}function Oe(t,e){return le(t.getFullYear()%1e4,e,4)}function Xe(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+le(e/60|0,"0",2)+le(e%60,"0",2);
}function Be(t,e){return le(t.getUTCDate(),e,2)}function We(t,e){return le(t.getUTCHours(),e,2)}function $e(t,e){return le(t.getUTCHours()%12||12,e,2)}function qe(t,e){return le(1+dr.count(pr(t),t),e,3)}function Re(t,e){return le(t.getUTCMilliseconds(),e,3)}function Ie(t,e){return le(t.getUTCMonth()+1,e,2)}function Ze(t,e){return le(t.getUTCMinutes(),e,2)}function Ge(t,e){return le(t.getUTCSeconds(),e,2)}function Ke(t,e){return le(gr.count(pr(t),t),e,2)}function Ve(t){return t.getUTCDay()}function Qe(t,e){return le(mr.count(pr(t),t),e,2)}function tn(t,e){return le(t.getUTCFullYear()%100,e,2)}function en(t,e){return le(t.getUTCFullYear()%1e4,e,4)}function nn(){return"+0000"}function rn(){return"%"}function on(t){return t.toISOString()}function un(t){return new fn(t)}function an(t){return new Function("d","return {"+t.map(function(t,e){return JSON.stringify(t)+": d["+e+"]"}).join(",")+"}")}function sn(t,e){var n=an(t);return function(t,r){return e(n(t),r)}}function cn(t){var e=Object.create(null),n=[];return t.forEach(function(t){for(var r in t)r in e||n.push(e[r]=r)}),n}function fn(t){function e(e){return e.map(n).join(t)}function n(t){return r.test(t)?'"'+t.replace(/\"/g,'""')+'"':t}var r=new RegExp('["'+t+"\n]"),i=t.charCodeAt(0);this.parse=function(t,e){var n,r,i=this.parseRows(t,function(t,i){return n?n(t,i-1):(r=t,void(n=e?sn(t,e):an(t)))});return i.columns=r,i},this.parseRows=function(t,e){function n(){if(f>=c)return a;if(o)return o=!1,u;var e=f;if(34===t.charCodeAt(e)){for(var n=e;n++<c;)if(34===t.charCodeAt(n)){if(34!==t.charCodeAt(n+1))break;++n}f=n+2;var r=t.charCodeAt(n+1);return 13===r?(o=!0,10===t.charCodeAt(n+2)&&++f):10===r&&(o=!0),t.slice(e+1,n).replace(/""/g,'"')}for(;c>f;){var r=t.charCodeAt(f++),s=1;if(10===r)o=!0;else if(13===r)o=!0,10===t.charCodeAt(f)&&(++f,++s);else if(r!==i)continue;return t.slice(e,f-s)}return t.slice(e)}for(var r,o,u={},a={},s=[],c=t.length,f=0,l=0;(r=n())!==a;){for(var h=[];r!==u&&r!==a;)h.push(r),r=n();e&&null==(h=e(h,l++))||s.push(h)}return s},this.format=function(e,r){return arguments.length<2&&(r=cn(e)),[r.map(n).join(t)].concat(e.map(function(e){return r.map(function(t){return n(e[t])}).join(t)})).join("\n")},this.formatRows=function(t){return t.map(e).join("\n")}}var ln=/^#([0-9a-f]{3})$/,hn=/^#([0-9a-f]{6})$/,dn=/^rgb\(\s*([-+]?\d+)\s*,\s*([-+]?\d+)\s*,\s*([-+]?\d+)\s*\)$/,gn=/^rgb\(\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*\)$/,mn=/^hsl\(\s*([-+]?\d+(?:\.\d+)?)\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*\)$/;e.prototype=t.prototype={displayable:function(){return this.rgb().displayable()},toString:function(){return this.rgb()+""}};var pn={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},yn=r.prototype=i.prototype=new t;yn.brighter=function(t){return t=null==t?bn:Math.pow(bn,t),new i(this.h,this.s,this.l*t)},yn.darker=function(t){return t=null==t?vn:Math.pow(vn,t),new i(this.h,this.s,this.l*t)},yn.rgb=function(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(.5>n?n:1-n)*e,i=2*n-r;return new a(o(t>=240?t-240:t+120,i,r),o(t,i,r),o(120>t?t+240:t-120,i,r))},yn.displayable=function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1};var vn=.7,bn=1/vn,Mn=u.prototype=a.prototype=new t;Mn.brighter=function(t){return t=null==t?bn:Math.pow(bn,t),new a(this.r*t,this.g*t,this.b*t)},Mn.darker=function(t){return t=null==t?vn:Math.pow(vn,t),new a(this.r*t,this.g*t,this.b*t)},Mn.rgb=function(){return this},Mn.displayable=function(){return 0<=this.r&&this.r<=255&&0<=this.g&&this.g<=255&&0<=this.b&&this.b<=255},Mn.toString=function(){var t=Math.round(this.r),e=Math.round(this.g),n=Math.round(this.b);return"#"+(isNaN(t)||0>=t?"00":16>t?"0"+t.toString(16):t>=255?"ff":t.toString(16))+(isNaN(e)||0>=e?"00":16>e?"0"+e.toString(16):e>=255?"ff":e.toString(16))+(isNaN(n)||0>=n?"00":16>n?"0"+n.toString(16):n>=255?"ff":n.toString(16))};var wn=(c(s),"$");l.prototype=h.prototype={has:function(t){return wn+t in this},get:function(t){return this[wn+t]},set:function(t,e){return this[wn+t]=e,this},remove:function(t){var e=wn+t;return e in this&&delete this[e]},clear:function(){for(var t in this)t[0]===wn&&delete this[t]},keys:function(){var t=[];for(var e in this)e[0]===wn&&t.push(e.slice(1));return t},values:function(){var t=[];for(var e in this)e[0]===wn&&t.push(this[e]);return t},entries:function(){var t=[];for(var e in this)e[0]===wn&&t.push({key:e.slice(1),value:this[e]});return t},size:function(){var t=0;for(var e in this)e[0]===wn&&++t;return t},empty:function(){for(var t in this)if(t[0]===wn)return!1;return!0},each:function(t){for(var e in this)e[0]===wn&&t.call(this,this[e],e.slice(1))}};h.prototype;d.prototype=g.prototype;var _n=v("application/json",function(t){return JSON.parse(t.responseText)}),Sn=(M(b),"$");_.prototype=S.prototype={has:function(t){return Sn+t in this},get:function(t){return this[Sn+t]},set:function(t,e){return this[Sn+t]=e,this},remove:function(t){var e=Sn+t;return e in this&&delete this[e]},clear:function(){for(var t in this)t[0]===Sn&&delete this[t]},keys:function(){var t=[];for(var e in this)e[0]===Sn&&t.push(e.slice(1));return t},values:function(){var t=[];for(var e in this)e[0]===Sn&&t.push(this[e]);return t},entries:function(){var t=[];for(var e in this)e[0]===Sn&&t.push({key:e.slice(1),value:this[e]});return t},size:function(){var t=0;for(var e in this)e[0]===Sn&&++t;return t},empty:function(){for(var t in this)if(t[0]===Sn)return!1;return!0},each:function(t){for(var e in this)e[0]===Sn&&t(this[e],e.slice(1),this)}};var An=(S.prototype,Math.PI/180),kn=180/Math.PI,Dn=C.prototype=Y.prototype=new t;Dn.brighter=function(t){return new Y(this.h,this.c,this.l+Tn*(null==t?1:t))},Dn.darker=function(t){return new Y(this.h,this.c,this.l-Tn*(null==t?1:t))},Dn.rgb=function(){return L(this).rgb()};var Tn=18,xn=.95047,jn=1,Nn=1.08883,Cn=4/29,Yn=6/29,Ln=3*Yn*Yn,zn=Yn*Yn*Yn,Hn=L.prototype=z.prototype=new t;Hn.brighter=function(t){return new z(this.l+Tn*(null==t?1:t),this.a,this.b)},Hn.darker=function(t){return new z(this.l-Tn*(null==t?1:t),this.a,this.b)},Hn.rgb=function(){var t=(this.l+16)/116,e=isNaN(this.a)?t:t+this.a/500,n=isNaN(this.b)?t:t-this.b/200;return t=jn*E(t),e=xn*E(e),n=Nn*E(n),new a(F(3.2404542*e-1.5371385*t-.4985314*n),F(-.969266*e+1.8760108*t+.041556*n),F(.0556434*e-.2040259*t+1.0572252*n))};var En=-.14861,Fn=1.78277,Pn=-.29227,Jn=-.90649,Un=1.97294,On=Un*Jn,Xn=Un*Fn,Bn=Fn*Pn-Jn*En,Wn=J.prototype=U.prototype=new t;Wn.brighter=function(t){return t=null==t?bn:Math.pow(bn,t),new U(this.h,this.s,this.l*t)},Wn.darker=function(t){return t=null==t?vn:Math.pow(vn,t),new U(this.h,this.s,this.l*t)},Wn.rgb=function(){var t=isNaN(this.h)?0:(this.h+120)*An,e=+this.l,n=isNaN(this.s)?0:this.s*e*(1-e),r=Math.cos(t),i=Math.sin(t);return new a(255*(e+n*(En*r+Fn*i)),255*(e+n*(Pn*r+Jn*i)),255*(e+n*(Un*r)))};var $n=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,qn={},Rn=null;if("undefined"!=typeof document){var In=document.documentElement;"onmouseenter"in In||(qn={mouseenter:"mouseover",mouseleave:"mouseout"})}var Zn={svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},Gn="$";Nt.prototype={appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e||this._next)}};var Kn=function(t){return function(){return this.matches(t)}};if("undefined"!=typeof document){var Vn=document.documentElement;if(!Vn.matches){var Qn=Vn.webkitMatchesSelector||Vn.msMatchesSelector||Vn.mozMatchesSelector||Vn.oMatchesSelector;Kn=function(t){return function(){return Qn.call(this,t)}}}}Et.prototype=Ft.prototype={select:Ht,selectAll:Lt,filter:Yt,data:jt,enter:xt,exit:Tt,order:St,sort:wt,call:vt,nodes:yt,node:mt,size:gt,empty:dt,each:ht,attr:lt,style:ft,property:ct,"class":ot,classed:ot,text:it,html:rt,append:et,insert:et,remove:V,datum:K,event:R,on:R,dispatch:W};var tr=(Ut(Jt),"$");Xt.prototype=Bt.prototype={has:function(t){return tr+t in this},get:function(t){return this[tr+t]},set:function(t,e){return this[tr+t]=e,this},remove:function(t){var e=tr+t;return e in this&&delete this[e]},clear:function(){for(var t in this)t[0]===tr&&delete this[t]},keys:function(){var t=[];for(var e in this)e[0]===tr&&t.push(e.slice(1));return t},values:function(){var t=[];for(var e in this)e[0]===tr&&t.push(this[e]);return t},entries:function(){var t=[];for(var e in this)e[0]===tr&&t.push({key:e.slice(1),value:this[e]});return t},size:function(){var t=0;for(var e in this)e[0]===tr&&++t;return t},empty:function(){for(var t in this)if(t[0]===tr)return!1;return!0},each:function(t){for(var e in this)e[0]===tr&&t(this[e],e.slice(1),this)}};var er,nr=(Bt.prototype,{"":Qt,"%":function(t,e){return(100*t).toFixed(e)},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,e){return t.toExponential(e)},f:function(t,e){return t.toFixed(e)},g:function(t,e){return t.toPrecision(e)},o:function(t){return Math.round(t).toString(8)},p:function(t,e){return Vt(100*t,e)},r:Vt,s:Kt,X:function(t){return Math.round(t).toString(16).toUpperCase()},x:function(t){return Math.round(t).toString(16)}}),rr=/^(?:(.)?([<>=^]))?([+\-\( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?([a-z%])?$/i;ee.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 ir=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"],or=re({decimal:".",thousands:",",grouping:[3],currency:["$",""]}),ur=or.format,ar=(ur(".0e"),ur(","),new Date),sr=new Date,cr=ie(function(t){t.setHours(0,0,0,0)},function(t,e){t.setDate(t.getDate()+e)},function(t,e){return(e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/864e5}),fr=oe(0),lr=oe(1),hr=ie(function(t){t.setHours(0,0,0,0),t.setMonth(0,1)},function(t,e){t.setFullYear(t.getFullYear()+e)},function(t,e){return e.getFullYear()-t.getFullYear()}),dr=ie(function(t){t.setUTCHours(0,0,0,0)},function(t,e){t.setUTCDate(t.getUTCDate()+e)},function(t,e){return(e-t)/864e5}),gr=ue(0),mr=ue(1),pr=ie(function(t){t.setUTCHours(0,0,0,0),t.setUTCMonth(0,1)},function(t,e){t.setUTCFullYear(t.getUTCFullYear()+e)},function(t,e){return e.getUTCFullYear()-t.getUTCFullYear()}),yr={"-":"",_:" ",0:"0"},vr=/^\s*\d+/,br=/^%/,Mr=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,wr=fe({dateTime:"%a %b %e %X %Y",date:"%m/%d/%Y",time:"%H:%M:%S",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"]});fe({dateTime:"%A, %e de %B de %Y, %X",date:"%d/%m/%Y",time:"%H:%M:%S",periods:["AM","PM"],days:["diumenge","dilluns","dimarts","dimecres","dijous","divendres","dissabte"],shortDays:["dg.","dl.","dt.","dc.","dj.","dv.","ds."],months:["gener","febrer","març","abril","maig","juny","juliol","agost","setembre","octubre","novembre","desembre"],shortMonths:["gen.","febr.","març","abr.","maig","juny","jul.","ag.","set.","oct.","nov.","des."]}),fe({dateTime:"%A, der %e. %B %Y, %X",date:"%d.%m.%Y",time:"%H:%M:%S",periods:["AM","PM"],days:["Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag"],shortDays:["So","Mo","Di","Mi","Do","Fr","Sa"],months:["Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"],shortMonths:["Jan","Feb","Mrz","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez"]}),fe({dateTime:"%A, der %e. %B %Y, %X",date:"%d.%m.%Y",time:"%H:%M:%S",periods:["AM","PM"],days:["Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag"],shortDays:["So","Mo","Di","Mi","Do","Fr","Sa"],months:["Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"],shortMonths:["Jan","Feb","Mrz","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez"]}),fe({dateTime:"%a %b %e %X %Y",date:"%Y-%m-%d",time:"%H:%M:%S",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"]}),fe({dateTime:"%a %e %b %X %Y",date:"%d/%m/%Y",time:"%H:%M:%S",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"]}),fe({dateTime:"%A, %e de %B de %Y, %X",date:"%d/%m/%Y",time:"%H:%M:%S",periods:["AM","PM"],days:["domingo","lunes","martes","miércoles","jueves","viernes","sábado"],shortDays:["dom","lun","mar","mié","jue","vie","sáb"],months:["enero","febrero","marzo","abril","mayo","junio","julio","agosto","septiembre","octubre","noviembre","diciembre"],shortMonths:["ene","feb","mar","abr","may","jun","jul","ago","sep","oct","nov","dic"]}),fe({dateTime:"%A, %-d. %Bta %Y klo %X",date:"%-d.%-m.%Y",time:"%H:%M:%S",periods:["a.m.","p.m."],days:["sunnuntai","maanantai","tiistai","keskiviikko","torstai","perjantai","lauantai"],shortDays:["Su","Ma","Ti","Ke","To","Pe","La"],months:["tammikuu","helmikuu","maaliskuu","huhtikuu","toukokuu","kesäkuu","heinäkuu","elokuu","syyskuu","lokakuu","marraskuu","joulukuu"],shortMonths:["Tammi","Helmi","Maalis","Huhti","Touko","Kesä","Heinä","Elo","Syys","Loka","Marras","Joulu"]}),fe({dateTime:"%a %e %b %Y %X",date:"%Y-%m-%d",time:"%H:%M:%S",periods:["",""],days:["dimanche","lundi","mardi","mercredi","jeudi","vendredi","samedi"],shortDays:["dim","lun","mar","mer","jeu","ven","sam"],months:["janvier","février","mars","avril","mai","juin","juillet","août","septembre","octobre","novembre","décembre"],shortMonths:["jan","fév","mar","avr","mai","jui","jul","aoû","sep","oct","nov","déc"]}),fe({dateTime:"%A, le %e %B %Y, %X",date:"%d/%m/%Y",time:"%H:%M:%S",periods:["AM","PM"],days:["dimanche","lundi","mardi","mercredi","jeudi","vendredi","samedi"],shortDays:["dim.","lun.","mar.","mer.","jeu.","ven.","sam."],months:["janvier","février","mars","avril","mai","juin","juillet","août","septembre","octobre","novembre","décembre"],shortMonths:["janv.","févr.","mars","avr.","mai","juin","juil.","août","sept.","oct.","nov.","déc."]}),fe({dateTime:"%A, %e ב%B %Y %X",date:"%d.%m.%Y",time:"%H:%M:%S",periods:["AM","PM"],days:["ראשון","שני","שלישי","רביעי","חמישי","שישי","שבת"],shortDays:["א׳","ב׳","ג׳","ד׳","ה׳","ו׳","ש׳"],months:["ינואר","פברואר","מרץ","אפריל","מאי","יוני","יולי","אוגוסט","ספטמבר","אוקטובר","נובמבר","דצמבר"],shortMonths:["ינו׳","פבר׳","מרץ","אפר׳","מאי","יוני","יולי","אוג׳","ספט׳","אוק׳","נוב׳","דצמ׳"]}),fe({dateTime:"%Y. %B %-e., %A %X",date:"%Y. %m. %d.",time:"%H:%M:%S",periods:["de.","du."],days:["vasárnap","hétfő","kedd","szerda","csütörtök","péntek","szombat"],shortDays:["V","H","K","Sze","Cs","P","Szo"],months:["január","február","március","április","május","június","július","augusztus","szeptember","október","november","december"],shortMonths:["jan.","feb.","már.","ápr.","máj.","jún.","júl.","aug.","szept.","okt.","nov.","dec."]}),fe({dateTime:"%A %e %B %Y, %X",date:"%d/%m/%Y",time:"%H:%M:%S",periods:["AM","PM"],days:["Domenica","Lunedì","Martedì","Mercoledì","Giovedì","Venerdì","Sabato"],shortDays:["Dom","Lun","Mar","Mer","Gio","Ven","Sab"],months:["Gennaio","Febbraio","Marzo","Aprile","Maggio","Giugno","Luglio","Agosto","Settembre","Ottobre","Novembre","Dicembre"],shortMonths:["Gen","Feb","Mar","Apr","Mag","Giu","Lug","Ago","Set","Ott","Nov","Dic"]}),fe({dateTime:"%Y %b %e %a %X",date:"%Y/%m/%d",time:"%H:%M:%S",periods:["AM","PM"],days:["日曜日","月曜日","火曜日","水曜日","木曜日","金曜日","土曜日"],shortDays:["日","月","火","水","木","金","土"],months:["睦月","如月","弥生","卯月","皐月","水無月","文月","葉月","長月","神無月","霜月","師走"],shortMonths:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"]}),fe({dateTime:"%Y/%m/%d %a %X",date:"%Y/%m/%d",time:"%H:%M:%S",periods:["오전","오후"],days:["일요일","월요일","화요일","수요일","목요일","금요일","토요일"],shortDays:["일","월","화","수","목","금","토"],months:["1월","2월","3월","4월","5월","6월","7월","8월","9월","10월","11월","12월"],shortMonths:["1월","2월","3월","4월","5월","6월","7월","8월","9월","10월","11월","12월"]}),fe({dateTime:"%A, %e %B %Y г. %X",date:"%d.%m.%Y",time:"%H:%M:%S",periods:["AM","PM"],days:["недела","понеделник","вторник","среда","четврток","петок","сабота"],shortDays:["нед","пон","вто","сре","чет","пет","саб"],months:["јануари","февруари","март","април","мај","јуни","јули","август","септември","октомври","ноември","декември"],shortMonths:["јан","фев","мар","апр","мај","јун","јул","авг","сеп","окт","ное","дек"]}),fe({dateTime:"%a %e %B %Y %T",date:"%d-%m-%Y",time:"%H:%M:%S",periods:["AM","PM"],days:["zondag","maandag","dinsdag","woensdag","donderdag","vrijdag","zaterdag"],shortDays:["zo","ma","di","wo","do","vr","za"],months:["januari","februari","maart","april","mei","juni","juli","augustus","september","oktober","november","december"],shortMonths:["jan","feb","mrt","apr","mei","jun","jul","aug","sep","okt","nov","dec"]}),fe({dateTime:"%A, %e %B %Y, %X",date:"%d/%m/%Y",time:"%H:%M:%S",periods:["AM","PM"],days:["Niedziela","Poniedziałek","Wtorek","Środa","Czwartek","Piątek","Sobota"],shortDays:["Niedz.","Pon.","Wt.","Śr.","Czw.","Pt.","Sob."],months:["Styczeń","Luty","Marzec","Kwiecień","Maj","Czerwiec","Lipiec","Sierpień","Wrzesień","Październik","Listopad","Grudzień"],shortMonths:["Stycz.","Luty","Marz.","Kwie.","Maj","Czerw.","Lipc.","Sierp.","Wrz.","Paźdz.","Listop.","Grudz."]}),fe({dateTime:"%A, %e de %B de %Y. %X",date:"%d/%m/%Y",time:"%H:%M:%S",periods:["AM","PM"],days:["Domingo","Segunda","Terça","Quarta","Quinta","Sexta","Sábado"],shortDays:["Dom","Seg","Ter","Qua","Qui","Sex","Sáb"],months:["Janeiro","Fevereiro","Março","Abril","Maio","Junho","Julho","Agosto","Setembro","Outubro","Novembro","Dezembro"],shortMonths:["Jan","Fev","Mar","Abr","Mai","Jun","Jul","Ago","Set","Out","Nov","Dez"]}),fe({dateTime:"%A, %e %B %Y г. %X",date:"%d.%m.%Y",time:"%H:%M:%S",periods:["AM","PM"],days:["воскресенье","понедельник","вторник","среда","четверг","пятница","суббота"],shortDays:["вс","пн","вт","ср","чт","пт","сб"],months:["января","февраля","марта","апреля","мая","июня","июля","августа","сентября","октября","ноября","декабря"],shortMonths:["янв","фев","мар","апр","май","июн","июл","авг","сен","окт","ноя","дек"]}),fe({dateTime:"%A den %d %B %Y %X",date:"%Y-%m-%d",time:"%H:%M:%S",periods:["fm","em"],days:["Söndag","Måndag","Tisdag","Onsdag","Torsdag","Fredag","Lördag"],shortDays:["Sön","Mån","Tis","Ons","Tor","Fre","Lör"],months:["Januari","Februari","Mars","April","Maj","Juni","Juli","Augusti","September","Oktober","November","December"],shortMonths:["Jan","Feb","Mar","Apr","Maj","Jun","Jul","Aug","Sep","Okt","Nov","Dec"]}),fe({dateTime:"%a %b %e %X %Y",date:"%Y/%-m/%-d",time:"%H:%M:%S",periods:["上午","下午"],days:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],shortDays:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],months:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],shortMonths:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]});var _r="%Y-%m-%dT%H:%M:%S.%LZ";on.parse=function(t){var e=new Date(t);return isNaN(e)?null:e},on.toString=function(){return _r};Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?on:wr.utcFormat(_r),Ut(function(t){return t[2]}).right,"undefined"!=typeof navigator&&/WebKit/.test(navigator.userAgent)?-1:0;un.prototype=fn.prototype;var Sr=(un(","),un(" "),{format:ur,scale:{category20:Rt},select:Pt,sankey:X,json:_n,rgb:u});return Sr});
{"nodes":[{"name":"ADALGICIO BARBOSA MENDONÇA","group":"NOME"},{"name":"ÁGATA RENATA Róbson Elias Dias","group":"NOME"},{"name":"ALDÊNIO SOUSA DO NASCIMENTO","group":"NOME"},{"name":"ALEXANDRE PEREIRA DE ARAÚJO","group":"NOME"},{"name":"ANDRÉIA GONÇALVES LEÃO","group":"NOME"},{"name":"BIA Carlos Maximiano da Silva","group":"NOME"},{"name":"BRUNA","group":"NOME"},{"name":"CAPITÚ Wanderson Maia dos Santos","group":"NOME"},{"name":"CARIOCA","group":"NOME"},{"name":"CARLOS DOS SANTOS","group":"NOME"},{"name":"CARLOS FERREIRA DA SILVA","group":"NOME"},{"name":"CAROLLINA XISTO ROCHA","group":"NOME"},{"name":"COSME DAMIÃO VENCESLAU","group":"NOME"},{"name":"CRISTIANO DOS SANTOS NUNES","group":"NOME"},{"name":"DARCKSON SILVA LIRA","group":"NOME"},{"name":"DIDINHA Luiz Carlos de Lima","group":"NOME"},{"name":"DIOGO LUCTEMBERG","group":"NOME"},{"name":"EDVALDO JOSÉ DA SILVA","group":"NOME"},{"name":"ELISAQUE NASCIMENTO SILVA","group":"NOME"},{"name":"FLÁVIO AUGUSTO ADARIO RIBEIRO","group":"NOME"},{"name":"GERALDO LACLAU","group":"NOME"},{"name":"GILMAR BONFIM DE JESUS","group":"NOME"},{"name":"GIOVANI APARECIDO MACHADO","group":"NOME"},{"name":"HELMITON JOSÉ GONÇALVES FIGUEIREDO JÚNIOR","group":"NOME"},{"name":"HERBANI DE OLIVEIRA FERNANDES","group":"NOME"},{"name":"IDALÉCIO FONTES REGO","group":"NOME"},{"name":"IELTON TARGINO DE OLIVEIRA","group":"NOME"},{"name":"INÁCIO JOSÉ DA SILVA","group":"NOME"},{"name":"JAISON OLIVEIRA FERREIRA","group":"NOME"},{"name":"JHONY LIMA FERNANDES","group":"NOME"},{"name":"JOÃO CHAVES NETO","group":"NOME"},{"name":"JOÃO FÁBIO DA SILVA SENNA","group":"NOME"},{"name":"JOÃO VITOR PEREIRA MACHADO","group":"NOME"},{"name":"JOSÉ CLAUDIO LEITE DA SILVA","group":"NOME"},{"name":"JOSÉ NELSON DA COSTA","group":"NOME"},{"name":"JOYCE AKIRA","group":"NOME"},{"name":"JUJU","group":"NOME"},{"name":"JÚLIO CÉSAR DA SILVA","group":"NOME"},{"name":"KEITY Itamar Sena Passos","group":"NOME"},{"name":"LARA Leonardo Machado","group":"NOME"},{"name":"LÉO","group":"NOME"},{"name":"LORENA BHALS Paulo Roberto Alves Viana","group":"NOME"},{"name":"LORISVALDO PEREIRA DA ROCHA","group":"NOME"},{"name":"M.H.L. Murilo Henrique Lopes","group":"NOME"},{"name":"MARIO CESAR DA SILVA","group":"NOME"},{"name":"MATEUS SANTANA PASSOS","group":"NOME"},{"name":"MAURÍCIO BARTZ DE MOURA","group":"NOME"},{"name":"MILENA LUCAS DE LACERDA","group":"NOME"},{"name":"NÃO IDENTIFICADA","group":"NOME"},{"name":"NÃO IDENTIFICADO","group":"NOME"},{"name":"NATÁLIA FERRAZ Dieronti Willian de Godoy","group":"NOME"},{"name":"PANDORA Leopoldo Luiz Lemes de Arruda","group":"NOME"},{"name":"PATA André Silva Costa","group":"NOME"},{"name":"PAULO LUIZ TENÓRIO PEIXOTO","group":"NOME"},{"name":"PETERSON RICARDO DE OLIVEIRA","group":"NOME"},{"name":"PIU Cláudio da Silva","group":"NOME"},{"name":"RAÍSSA Hênio Adamys Borges Marinho","group":"NOME"},{"name":"REINADO PERINOTTO","group":"NOME"},{"name":"RENATA CHRISTINA PEDROSA MOREIRA","group":"NOME"},{"name":"RODRIGO DOS SANTOS","group":"NOME"},{"name":"RONALDO PEPÊ SANTOS","group":"NOME"},{"name":"SAULO FERREIRA TAVARES","group":"NOME"},{"name":"SÁVIO DOS SANTOS BARBOSA","group":"NOME"},{"name":"SÉRGIO ANTÔNIO LOBO DO NASCIMENTO","group":"NOME"},{"name":"SIDNEY SANTOS DE MACEDO","group":"NOME"},{"name":"T.C. Tiago Chuves","group":"NOME"},{"name":"THIAGO FERREIRA BARROS","group":"NOME"},{"name":"VAGNER GOMES DE JESUS","group":"NOME"},{"name":"VALDOMIRO MAGNO","group":"NOME"},{"name":"VERÔNICA BISMARCK (Douglas dos Santos Pinheiro)","group":"NOME"},{"name":"WAGNER ARAÚJO CONCEIÇÃO DA PURIFICAÇÃO","group":"NOME"},{"name":"WLADIMIR UCHOA LIMA","group":"NOME"},{"name":"Y.F.O.S. Ygor Fernando Oliveira Santos","group":"NOME"},{"name":"AL","group":"UF"},{"name":"AM","group":"UF"},{"name":"AP","group":"UF"},{"name":"BA","group":"UF"},{"name":"CE","group":"UF"},{"name":"ES","group":"UF"},{"name":"GO","group":"UF"},{"name":"MA","group":"UF"},{"name":"MG","group":"UF"},{"name":"MS","group":"UF"},{"name":"MT","group":"UF"},{"name":"PA","group":"UF"},{"name":"PB","group":"UF"},{"name":"PE","group":"UF"},{"name":"PR","group":"UF"},{"name":"RJ","group":"UF"},{"name":"RN","group":"UF"},{"name":"RO","group":"UF"},{"name":"RS","group":"UF"},{"name":"SC","group":"UF"},{"name":"teste","group":"UF"},{"name":"SP","group":"UF"}],"links":[{"source":81,"target":19,"value":42},{"source":81,"target":37,"value":23},{"source":81,"target":11,"value":20},{"source":81,"target":32,"value":25},{"source":81,"target":12,"value":52},{"source":81,"target":48,"value":25},{"source":82,"target":69,"value":20},{"source":82,"target":70,"value":21},{"source":82,"target":1,"value":23},{"source":94,"target":25,"value":46},{"source":94,"target":36,"value":25},{"source":94,"target":5,"value":24},{"source":94,"target":43,"value":24},{"source":94,"target":4,"value":20},{"source":94,"target":8,"value":0},{"source":94,"target":58,"value":33},{"source":94,"target":47,"value":0},{"source":94,"target":48,"value":32},{"source":94,"target":22,"value":40},{"source":94,"target":49,"value":16},{"source":94,"target":50,"value":21},{"source":94,"target":59,"value":36},{"source":94,"target":54,"value":14},{"source":94,"target":57,"value":46},{"source":94,"target":64,"value":39},{"source":80,"target":68,"value":0},{"source":80,"target":9,"value":0},{"source":76,"target":21,"value":41},{"source":76,"target":40,"value":0},{"source":76,"target":45,"value":20},{"source":76,"target":48,"value":0},{"source":76,"target":38,"value":23},{"source":76,"target":18,"value":24},{"source":76,"target":13,"value":28},{"source":76,"target":67,"value":20},{"source":76,"target":49,"value":0},{"source":76,"target":60,"value":40},{"source":86,"target":49,"value":0},{"source":86,"target":33,"value":47},{"source":86,"target":15,"value":18},{"source":86,"target":63,"value":46},{"source":86,"target":27,"value":46},{"source":86,"target":23,"value":30},{"source":84,"target":48,"value":25},{"source":84,"target":39,"value":16},{"source":83,"target":49,"value":0},{"source":83,"target":6,"value":0},{"source":83,"target":51,"value":26},{"source":89,"target":24,"value":37},{"source":89,"target":26,"value":24},{"source":74,"target":48,"value":17},{"source":74,"target":3,"value":32},{"source":74,"target":71,"value":34},{"source":74,"target":34,"value":50},{"source":74,"target":10,"value":51},{"source":74,"target":7,"value":31},{"source":74,"target":28,"value":36},{"source":93,"target":0,"value":41},{"source":93,"target":49,"value":0},{"source":93,"target":62,"value":18},{"source":77,"target":2,"value":44},{"source":77,"target":66,"value":28},{"source":77,"target":14,"value":53},{"source":91,"target":46,"value":24},{"source":79,"target":30,"value":22},{"source":88,"target":55,"value":25},{"source":88,"target":49,"value":0},{"source":88,"target":20,"value":51},{"source":90,"target":31,"value":33},{"source":90,"target":42,"value":44},{"source":78,"target":29,"value":19},{"source":78,"target":61,"value":24},{"source":75,"target":52,"value":35},{"source":85,"target":35,"value":0},{"source":85,"target":56,"value":19},{"source":92,"target":44,"value":50},{"source":73,"target":17,"value":20},{"source":73,"target":72,"value":20},{"source":73,"target":53,"value":30},{"source":87,"target":16,"value":0},{"source":87,"target":41,"value":28},{"source":87,"target":65,"value":28}]}
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<title>Sankey Diagram</title>
<style>
#chart {
height: 2000px;
}
.node rect {
cursor: move;
fill-opacity: .9;
shape-rendering: crispEdges;
}
.node text {
pointer-events: none;
text-shadow: 0 1px 0 #fff;
}
.link {
fill: none;
stroke: #000;
stroke-opacity: .2;
}
.link:hover {
stroke-opacity: .5;
}
</style>
<body>
<div id="chart"></div>
<script src="d3.min.js"></script>
<script>
var margin = {
top: 1,
right: 1,
bottom: 6,
left: 1
},
width = 1000 - margin.left - margin.right,
height =1000 - margin.top - margin.bottom;
var formatNumber = d3.format(",.0f"),
format = function(d) {
return formatNumber(d) + " TWh";
},
color = d3.scale.category20();
var svg = d3.select("#chart").append("svg")
.attr("width", width + margin.left + margin.right)
.attr("height", height + margin.top + margin.bottom)
.append("g")
.attr("transform", "translate(" + margin.left + "," + margin.top + ")");
var sankey = d3.sankey()
.nodeWidth(15)
.nodePadding(10)
.size([width, height]);
var path = sankey.link();
d3.json("energy.json", function(energy) {
sankey
.nodes(energy.nodes)
.links(energy.links)
.layout(32);
var link = svg.append("g").selectAll(".link")
.data(energy.links)
.enter().append("path")
.attr("class", "link")
.attr("d", path)
.style("stroke-width", function(d) {
return Math.max(1, d.dy);
})
.sort(function(a, b) {
return b.dy - a.dy;
});
link.append("title")
.text(function(d) {
return d.source.name + " → " + d.target.name + "\n" + format(d.value);
});
var node = svg.append("g").selectAll(".node")
.data(energy.nodes)
.enter().append("g")
.attr("class", "node")
.attr("transform", function(d) {
return "translate(" + d.x + "," + d.y + ")";
});
// Not currently implemented in v4.0
// .call(d3.behavior.drag()
// .origin(function(d) {
// return d;
// })
// .on("dragstart", function() {
// this.parentNode.appendChild(this);
// })
// .on("drag", dragmove));
node.append("rect")
.attr("height", function(d) {
return d.dy;
})
.attr("width", sankey.nodeWidth())
.style("fill", function(d) {
return d.color = color(d.name.replace(/ .*/, ""));
})
.style("stroke", function(d) {
return d3.rgb(d.color).darker(2);
})
.append("title")
.text(function(d) {
return d.name + "\n" + format(d.value);
});
node.append("text")
.attr("x", -6)
.attr("y", function(d) {
return d.dy / 2;
})
.attr("dy", ".35em")
.attr("text-anchor", "end")
.attr("transform", null)
.text(function(d) {
return d.name;
})
.filter(function(d) {
return d.x < width / 2;
})
.attr("x", 6 + sankey.nodeWidth())
.attr("text-anchor", "start");
function dragmove(d) {
d3.select(this).attr("transform", "translate(" + d.x + "," + (d.y = Math.max(0, Math.min(height - d.dy, d3.event.y))) + ")");
sankey.relayout();
link.attr("d", path);
}
});
</script>
{
"private": true,
"scripts": {
"build": "rollup -c | uglifyjs -c -m > d3.min.js"
},
"dependencies": {
"d3-color": "^0.3.1",
"d3-format": "^0.4.0",
"d3-request": "^0.2.3",
"d3-sankey": "^0.1.2",
"d3-scale": "^0.2.0",
"d3-selection": "^0.4.12",
"rollup": "^0.21.1",
"rollup-plugin-npm": "^1.1.0",
"uglify-js": "^2.6.1"
}
}
import npm from "rollup-plugin-npm";
export default {
entry: "d3.js",
plugins: [npm({jsnext: true})],
moduleId: "d3",
moduleName: "d3",
format: "umd"
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment