Skip to content

Instantly share code, notes, and snippets.

@mbostock
Last active January 26, 2021 12:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mbostock/97557a39b4bfc8229786c8bccb54074d to your computer and use it in GitHub Desktop.
Save mbostock/97557a39b4bfc8229786c8bccb54074d to your computer and use it in GitHub Desktop.
D3 Custom Bundle II
license: gpl-3.0
.DS_Store
node_modules
npm-debug.log
d3.js

Another demonstration of a custom D3 bundle using Rollup. This demonstrates importing d3-transition, which modifies selection.prototype to define selection.transition:

import "d3-transition";

(There are other features in d3-transition, but they are not imported here because they are not used.) Note that you must also import selection from d3-selection; otherwise, Rollup doesn’t know that it needs to include the imported code from d3-transition. Rollup isn’t perfect at detecting which code needs to be included (and which code shouldn’t be included), so sometimes you need to give it a hand.

!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(t.d3=t.d3||{})}(this,function(t){"use strict";function n(t){return function(){var n=this.ownerDocument,e=this.namespaceURI;return e===Sn&&n.documentElement.namespaceURI===Sn?n.createElement(t):n.createElementNS(e,t)}}function e(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function r(t,n,e){return t=i(t,n,e),function(n){var e=n.relatedTarget;e&&(e===this||8&e.compareDocumentPosition(this))||t.call(this,n)}}function i(n,e,r){return function(i){var o=t.event;t.event=i;try{n.call(this,this.__data__,e,r)}finally{t.event=o}}}function o(t){return t.trim().split(/^|\s+/).map(function(t){var n="",e=t.indexOf(".");return e>=0&&(n=t.slice(e+1),t=t.slice(0,e)),{type:t,name:n}})}function u(t){return function(){var n=this.__on;if(n){for(var e,r=0,i=-1,o=n.length;r<o;++r)e=n[r],t.type&&e.type!==t.type||e.name!==t.name?n[++i]=e:this.removeEventListener(e.type,e.listener,e.capture);++i?n.length=i:delete this.__on}}}function a(t,n,e){var o=Vn.hasOwnProperty(t.type)?r:i;return function(r,i,u){var a,s=this.__on,l=o(n,i,u);if(s)for(var c=0,h=s.length;c<h;++c)if((a=s[c]).type===t.type&&a.name===t.name)return this.removeEventListener(a.type,a.listener,a.capture),this.addEventListener(a.type,a.listener=l,a.capture=e),void(a.value=n);this.addEventListener(t.type,l,e),a={type:t.type,name:t.name,value:n,listener:l,capture:e},s?s.push(a):this.__on=[a]}}function s(){}function l(){return[]}function c(t,n){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=n}function h(t,n,e,r,i,o){for(var u,a=0,s=n.length,l=o.length;a<l;++a)(u=n[a])?(u.__data__=o[a],r[a]=u):e[a]=new c(t,o[a]);for(;a<s;++a)(u=n[a])&&(i[a]=u)}function f(t,n,e,r,i,o,u){var a,s,l,h={},f=n.length,p=o.length,d=new Array(f);for(a=0;a<f;++a)(s=n[a])&&(d[a]=l=Un+u.call(s,s.__data__,a,n),l in h?i[a]=s:h[l]=s);for(a=0;a<p;++a)l=Un+u.call(t,o[a],a,o),(s=h[l])?(r[a]=s,s.__data__=o[a],h[l]=null):e[a]=new c(t,o[a]);for(a=0;a<f;++a)(s=n[a])&&h[d[a]]===s&&(i[a]=s)}function p(t,n){return t<n?-1:t>n?1:t>=n?0:NaN}function d(t){return function(){this.removeAttribute(t)}}function y(t){return function(){this.removeAttributeNS(t.space,t.local)}}function v(t,n){return function(){this.setAttribute(t,n)}}function g(t,n){return function(){this.setAttributeNS(t.space,t.local,n)}}function _(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttribute(t):this.setAttribute(t,e)}}function m(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 w(t){return function(){this.style.removeProperty(t)}}function b(t,n,e){return function(){this.style.setProperty(t,n,e)}}function x(t,n,e){return function(){var r=n.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,e)}}function M(t){return function(){delete this[t]}}function N(t,n){return function(){this[t]=n}}function A(t,n){return function(){var e=n.apply(this,arguments);null==e?delete this[t]:this[t]=e}}function k(t){return t.trim().split(/^|\s+/)}function E(t){return t.classList||new S(t)}function S(t){this._node=t,this._names=k(t.getAttribute("class")||"")}function P(t,n){for(var e=E(t),r=-1,i=n.length;++r<i;)e.add(n[r])}function q(t,n){for(var e=E(t),r=-1,i=n.length;++r<i;)e.remove(n[r])}function C(t){return function(){P(this,t)}}function I(t){return function(){q(this,t)}}function O(t,n){return function(){(n.apply(this,arguments)?P:q)(this,t)}}function X(){this.textContent=""}function T(t){return function(){this.textContent=t}}function V(t){return function(){var n=t.apply(this,arguments);this.textContent=null==n?"":n}}function L(){this.innerHTML=""}function R(t){return function(){this.innerHTML=t}}function j(t){return function(){var n=t.apply(this,arguments);this.innerHTML=null==n?"":n}}function D(){this.nextSibling&&this.parentNode.appendChild(this)}function $(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Y(){return null}function z(){var t=this.parentNode;t&&t.removeChild(this)}function B(t,n,e){var r=oe(t),i=r.CustomEvent;i?i=new i(n,e):(i=r.document.createEvent("Event"),e?(i.initEvent(n,e.bubbles,e.cancelable),i.detail=e.detail):i.initEvent(n,!1,!1)),t.dispatchEvent(i)}function H(t,n){return function(){return B(this,t,n)}}function U(t,n){return function(){return B(this,t,n.apply(this,arguments))}}function F(t,n){this._groups=t,this._parents=n}function G(){return new F([[document.documentElement]],_e)}function J(){for(var t,n=0,e=arguments.length,r={};n<e;++n){if(!(t=arguments[n]+"")||t in r)throw new Error("illegal type: "+t);r[t]=[]}return new K(r)}function K(t){this._=t}function Q(t,n){return t.trim().split(/^|\s+/).map(function(t){var e="",r=t.indexOf(".");if(r>=0&&(e=t.slice(r+1),t=t.slice(0,r)),t&&!n.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}})}function W(t,n){for(var e,r=0,i=t.length;r<i;++r)if((e=t[r]).name===n)return e.value}function Z(t,n,e){for(var r=0,i=t.length;r<i;++r)if(t[r].name===n){t[r]=be,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=e&&t.push({name:n,value:e}),t}function tt(){return Pe||(Ie(nt),Pe=Ce.now()+qe)}function nt(){Pe=0}function et(){this._call=this._time=this._next=null}function rt(t,n,e){var r=new et;return r.restart(t,n,e),r}function it(){tt(),++Ne;for(var t,n=xe;n;)(t=Pe-n._time)>=0&&n._call.call(null,t),n=n._next;--Ne}function ot(){Pe=(Se=Ce.now())+qe,Ne=Ae=0;try{it()}finally{Ne=0,at(),Pe=0}}function ut(){var t=Ce.now(),n=t-Se;n>Ee&&(qe-=n,Se=t)}function at(){for(var t,n,e=xe,r=1/0;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:xe=n);Me=t,st(r)}function st(t){if(!Ne){Ae&&(Ae=clearTimeout(Ae));var n=t-Pe;n>24?(t<1/0&&(Ae=setTimeout(ot,n)),ke&&(ke=clearInterval(ke))):(ke||(Se=Pe,ke=setInterval(ut,Ee)),Ne=1,Ie(ot))}}function lt(t,n){var e=t.__transition;if(!e||!(e=e[n])||e.state>Ve)throw new Error("too late");return e}function ct(t,n){var e=t.__transition;if(!e||!(e=e[n])||e.state>Re)throw new Error("too late");return e}function ht(t,n){var e=t.__transition;if(!e||!(e=e[n]))throw new Error("too late");return e}function ft(t,n,e){function r(t){e.state=Le,e.timer.restart(i,e.delay,e.time),e.delay<=t&&i(t-e.delay)}function i(r){var l,c,h,f;if(e.state!==Le)return u();for(l in s)if(f=s[l],f.name===e.name){if(f.state===je)return Oe(i);f.state===De?(f.state=Ye,f.timer.stop(),f.on.call("interrupt",t,t.__data__,f.index,f.group),delete s[l]):+l<n&&(f.state=Ye,f.timer.stop(),delete s[l])}if(Oe(function(){e.state===je&&(e.state=De,e.timer.restart(o,e.delay,e.time),o(r))}),e.state=Re,e.on.call("start",t,t.__data__,e.index,e.group),e.state===Re){for(e.state=je,a=new Array(h=e.tween.length),l=0,c=-1;l<h;++l)(f=e.tween[l].value.call(t,t.__data__,e.index,e.group))&&(a[++c]=f);a.length=c+1}}function o(n){for(var r=n<e.duration?e.ease.call(null,n/e.duration):(e.timer.restart(u),e.state=$e,1),i=-1,o=a.length;++i<o;)a[i].call(null,r);e.state===$e&&(e.on.call("end",t,t.__data__,e.index,e.group),u())}function u(){e.state=Ye,e.timer.stop(),delete s[n];for(var r in s)return;delete t.__transition}var a,s=t.__transition;s[n]=e,e.timer=rt(r,0,e.time)}function pt(t,n){var e=Object.create(t.prototype);for(var r in n)e[r]=n[r];return e}function dt(){}function yt(t){var n;return t=(t+"").trim().toLowerCase(),(n=Ke.exec(t))?(n=parseInt(n[1],16),new wt(n>>8&15|n>>4&240,n>>4&15|240&n,(15&n)<<4|15&n,1)):(n=Qe.exec(t))?vt(parseInt(n[1],16)):(n=We.exec(t))?new wt(n[1],n[2],n[3],1):(n=Ze.exec(t))?new wt(255*n[1]/100,255*n[2]/100,255*n[3]/100,1):(n=tr.exec(t))?gt(n[1],n[2],n[3],n[4]):(n=nr.exec(t))?gt(255*n[1]/100,255*n[2]/100,255*n[3]/100,n[4]):(n=er.exec(t))?bt(n[1],n[2]/100,n[3]/100,1):(n=rr.exec(t))?bt(n[1],n[2]/100,n[3]/100,n[4]):ir.hasOwnProperty(t)?vt(ir[t]):"transparent"===t?new wt(NaN,NaN,NaN,0):null}function vt(t){return new wt(t>>16&255,t>>8&255,255&t,1)}function gt(t,n,e,r){return r<=0&&(t=n=e=NaN),new wt(t,n,e,r)}function _t(t){return t instanceof dt||(t=yt(t)),t?(t=t.rgb(),new wt(t.r,t.g,t.b,t.opacity)):new wt}function mt(t,n,e,r){return 1===arguments.length?_t(t):new wt(t,n,e,null==r?1:r)}function wt(t,n,e,r){this.r=+t,this.g=+n,this.b=+e,this.opacity=+r}function bt(t,n,e,r){return r<=0?t=n=e=NaN:e<=0||e>=1?t=n=NaN:n<=0&&(t=NaN),new Nt(t,n,e,r)}function xt(t){if(t instanceof Nt)return new Nt(t.h,t.s,t.l,t.opacity);if(t instanceof dt||(t=yt(t)),!t)return new Nt;if(t instanceof Nt)return t;t=t.rgb();var n=t.r/255,e=t.g/255,r=t.b/255,i=Math.min(n,e,r),o=Math.max(n,e,r),u=NaN,a=o-i,s=(o+i)/2;return a?(u=n===o?(e-r)/a+6*(e<r):e===o?(r-n)/a+2:(n-e)/a+4,a/=s<.5?o+i:2-o-i,u*=60):a=s>0&&s<1?0:u,new Nt(u,a,s,t.opacity)}function Mt(t,n,e,r){return 1===arguments.length?xt(t):new Nt(t,n,e,null==r?1:r)}function Nt(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function At(t,n,e){return 255*(t<60?n+(e-n)*t/60:t<180?e:t<240?n+(e-n)*(240-t)/60:n)}function kt(t){if(t instanceof St)return new St(t.l,t.a,t.b,t.opacity);if(t instanceof Tt){var n=t.h*or;return new St(t.l,Math.cos(n)*t.c,Math.sin(n)*t.c,t.opacity)}t instanceof wt||(t=_t(t));var e=It(t.r),r=It(t.g),i=It(t.b),o=Pt((.4124564*e+.3575761*r+.1804375*i)/ar),u=Pt((.2126729*e+.7151522*r+.072175*i)/sr);return new St(116*u-16,500*(o-u),200*(u-Pt((.0193339*e+.119192*r+.9503041*i)/lr)),t.opacity)}function Et(t,n,e,r){return 1===arguments.length?kt(t):new St(t,n,e,null==r?1:r)}function St(t,n,e,r){this.l=+t,this.a=+n,this.b=+e,this.opacity=+r}function Pt(t){return t>pr?Math.pow(t,1/3):t/fr+cr}function qt(t){return t>hr?t*t*t:fr*(t-cr)}function Ct(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function It(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Ot(t){if(t instanceof Tt)return new Tt(t.h,t.c,t.l,t.opacity);t instanceof St||(t=kt(t));var n=Math.atan2(t.b,t.a)*ur;return new Tt(n<0?n+360:n,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}function Xt(t,n,e,r){return 1===arguments.length?Ot(t):new Tt(t,n,e,null==r?1:r)}function Tt(t,n,e,r){this.h=+t,this.c=+n,this.l=+e,this.opacity=+r}function Vt(t){if(t instanceof Rt)return new Rt(t.h,t.s,t.l,t.opacity);t instanceof wt||(t=_t(t));var n=t.r/255,e=t.g/255,r=t.b/255,i=(br*r+mr*n-wr*e)/(br+mr-wr),o=r-i,u=(_r*(e-i)-vr*o)/gr,a=Math.sqrt(u*u+o*o)/(_r*i*(1-i)),s=a?Math.atan2(u,o)*ur-120:NaN;return new Rt(s<0?s+360:s,a,i,t.opacity)}function Lt(t,n,e,r){return 1===arguments.length?Vt(t):new Rt(t,n,e,null==r?1:r)}function Rt(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function jt(t,n){return function(e){return t+e*n}}function Dt(t,n,e){return t=Math.pow(t,e),n=Math.pow(n,e)-t,e=1/e,function(r){return Math.pow(t+r*n,e)}}function $t(t,n){var e=n-t;return e?jt(t,e>180||e<-180?e-360*Math.round(e/360):e):kr(isNaN(t)?n:t)}function Yt(t){return 1==(t=+t)?zt:function(n,e){return e-n?Dt(n,e,t):kr(isNaN(n)?e:n)}}function zt(t,n){var e=n-t;return e?jt(t,e):kr(isNaN(t)?n:t)}function Bt(t){return function(){return t}}function Ht(t){return function(n){return t(n)+""}}function Ut(t){return"none"===t?Or:(xr||(xr=document.createElement("DIV"),Mr=document.documentElement,Nr=document.defaultView),xr.style.transform=t,t=Nr.getComputedStyle(Mr.appendChild(xr),null).getPropertyValue("transform"),Mr.removeChild(xr),t=t.slice(7,-1).split(","),Xr(+t[0],+t[1],+t[2],+t[3],+t[4],+t[5]))}function Ft(t){return null==t?Or:(Ar||(Ar=document.createElementNS("http://www.w3.org/2000/svg","g")),Ar.setAttribute("transform",t),(t=Ar.transform.baseVal.consolidate())?(t=t.matrix,Xr(t.a,t.b,t.c,t.d,t.e,t.f)):Or)}function Gt(t,n,e,r){function i(t){return t.length?t.pop()+" ":""}function o(t,r,i,o,u,a){if(t!==i||r!==o){var s=u.push("translate(",null,n,null,e);a.push({i:s-4,x:Sr(t,i)},{i:s-2,x:Sr(r,o)})}else(i||o)&&u.push("translate("+i+n+o+e)}function u(t,n,e,o){t!==n?(t-n>180?n+=360:n-t>180&&(t+=360),o.push({i:e.push(i(e)+"rotate(",null,r)-2,x:Sr(t,n)})):n&&e.push(i(e)+"rotate("+n+r)}function a(t,n,e,o){t!==n?o.push({i:e.push(i(e)+"skewX(",null,r)-2,x:Sr(t,n)}):n&&e.push(i(e)+"skewX("+n+r)}function s(t,n,e,r,o,u){if(t!==e||n!==r){var a=o.push(i(o)+"scale(",null,",",null,")");u.push({i:a-4,x:Sr(t,e)},{i:a-2,x:Sr(n,r)})}else 1===e&&1===r||o.push(i(o)+"scale("+e+","+r+")")}return function(n,e){var r=[],i=[];return n=t(n),e=t(e),o(n.translateX,n.translateY,e.translateX,e.translateY,r,i),u(n.rotate,e.rotate,r,i),a(n.skewX,e.skewX,r,i),s(n.scaleX,n.scaleY,e.scaleX,e.scaleY,r,i),n=e=null,function(t){for(var n,e=-1,o=i.length;++e<o;)r[(n=i[e]).i]=n.x(t);return r.join("")}}}function Jt(t){return function n(e){function r(n,r){var i=t((n=Lt(n)).h,(r=Lt(r)).h),o=zt(n.s,r.s),u=zt(n.l,r.l),a=zt(n.opacity,r.opacity);return function(t){return n.h=i(t),n.s=o(t),n.l=u(Math.pow(t,e)),n.opacity=a(t),n+""}}return e=+e,r.gamma=n,r}(1)}function Kt(t,n){var e,r;return function(){var i=ct(this,t),o=i.tween;if(o!==e){r=e=o;for(var u=0,a=r.length;u<a;++u)if(r[u].name===n){r=r.slice(),r.splice(u,1);break}}i.tween=r}}function Qt(t,n,e){var r,i;if("function"!=typeof e)throw new Error;return function(){var o=ct(this,t),u=o.tween;if(u!==r){i=(r=u).slice();for(var a={name:n,value:e},s=0,l=i.length;s<l;++s)if(i[s].name===n){i[s]=a;break}s===l&&i.push(a)}o.tween=i}}function Wt(t,n,e){var r=t._id;return t.each(function(){var t=ct(this,r);(t.value||(t.value={}))[n]=e.apply(this,arguments)}),function(t){return ht(t,r).value[n]}}function Zt(t){return function(){this.removeAttribute(t)}}function tn(t){return function(){this.removeAttributeNS(t.space,t.local)}}function nn(t,n,e){var r,i;return function(){var o=this.getAttribute(t);return o===e?null:o===r?i:i=n(r=o,e)}}function en(t,n,e){var r,i;return function(){var o=this.getAttributeNS(t.space,t.local);return o===e?null:o===r?i:i=n(r=o,e)}}function rn(t,n,e){var r,i,o;return function(){var u,a=e(this);return null==a?void this.removeAttribute(t):(u=this.getAttribute(t),u===a?null:u===r&&a===i?o:o=n(r=u,i=a))}}function on(t,n,e){var r,i,o;return function(){var u,a=e(this);return null==a?void this.removeAttributeNS(t.space,t.local):(u=this.getAttributeNS(t.space,t.local),u===a?null:u===r&&a===i?o:o=n(r=u,i=a))}}function un(t,n){function e(){var e=this,r=n.apply(e,arguments);return r&&function(n){e.setAttributeNS(t.space,t.local,r(n))}}return e._value=n,e}function an(t,n){function e(){var e=this,r=n.apply(e,arguments);return r&&function(n){e.setAttribute(t,r(n))}}return e._value=n,e}function sn(t,n){return function(){lt(this,t).delay=+n.apply(this,arguments)}}function ln(t,n){return n=+n,function(){lt(this,t).delay=n}}function cn(t,n){return function(){ct(this,t).duration=+n.apply(this,arguments)}}function hn(t,n){return n=+n,function(){ct(this,t).duration=n}}function fn(t,n){if("function"!=typeof n)throw new Error;return function(){ct(this,t).ease=n}}function pn(t){return(t+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||"start"===t})}function dn(t,n,e){var r,i,o=pn(n)?lt:ct;return function(){var u=o(this,t),a=u.on;a!==r&&(i=(r=a).copy()).on(n,e),u.on=i}}function yn(t){return function(){var n=this.parentNode;for(var e in this.__transition)if(+e!==t)return;n&&n.removeChild(this)}}function vn(t,n){var e,r,i;return function(){var o=oe(this).getComputedStyle(this,null),u=o.getPropertyValue(t),a=(this.style.removeProperty(t),o.getPropertyValue(t));return u===a?null:u===e&&a===r?i:i=n(e=u,r=a)}}function gn(t){return function(){this.style.removeProperty(t)}}function _n(t,n,e){var r,i;return function(){var o=oe(this).getComputedStyle(this,null).getPropertyValue(t);return o===e?null:o===r?i:i=n(r=o,e)}}function mn(t,n,e){var r,i,o;return function(){var u=oe(this).getComputedStyle(this,null),a=u.getPropertyValue(t),s=e(this);return null==s&&(this.style.removeProperty(t),s=u.getPropertyValue(t)),a===s?null:a===r&&s===i?o:o=n(r=a,i=s)}}function wn(t,n,e){function r(){var r=this,i=n.apply(r,arguments);return i&&function(n){r.style.setProperty(t,i(n),e)}}return r._value=n,r}function bn(t){return function(){this.textContent=t}}function xn(t){return function(){var n=t(this);this.textContent=null==n?"":n}}function Mn(t,n,e,r){this._groups=t,this._parents=n,this._name=e,this._id=r}function Nn(t){return G().transition(t)}function An(){return++ei}function kn(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}function En(t,n){for(var e;!(e=t.__transition)||!(e=e[n]);)if(!(t=t.parentNode))return oi.time=tt(),oi;return e}var Sn="http://www.w3.org/1999/xhtml",Pn={svg:"http://www.w3.org/2000/svg",xhtml:Sn,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},qn=function(t){var n=t+="",e=n.indexOf(":");return e>=0&&"xmlns"!==(n=t.slice(0,e))&&(t=t.slice(e+1)),Pn.hasOwnProperty(n)?{space:Pn[n],local:t}:t},Cn=function(t){var r=qn(t);return(r.local?e:n)(r)},In=function(t){return function(){return this.matches(t)}};if("undefined"!=typeof document){var On=document.documentElement;if(!On.matches){var Xn=On.webkitMatchesSelector||On.msMatchesSelector||On.mozMatchesSelector||On.oMatchesSelector;In=function(t){return function(){return Xn.call(this,t)}}}}var Tn=In,Vn={};if(t.event=null,"undefined"!=typeof document){"onmouseenter"in document.documentElement||(Vn={mouseenter:"mouseover",mouseleave:"mouseout"})}var Ln=function(t,n,e){var r,i,s=o(t+""),l=s.length;{if(!(arguments.length<2)){for(c=n?a:u,null==e&&(e=!1),r=0;r<l;++r)this.each(c(s[r],n,e));return this}var c=this.node().__on;if(c)for(var h,f=0,p=c.length;f<p;++f)for(r=0,h=c[f];r<l;++r)if((i=s[r]).type===h.type&&i.name===h.name)return h.value}},Rn=function(t){return null==t?s:function(){return this.querySelector(t)}},jn=function(t){"function"!=typeof t&&(t=Rn(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o,u,a=n[i],s=a.length,l=r[i]=new Array(s),c=0;c<s;++c)(o=a[c])&&(u=t.call(o,o.__data__,c,a))&&("__data__"in o&&(u.__data__=o.__data__),l[c]=u);return new F(r,this._parents)},Dn=function(t){return null==t?l:function(){return this.querySelectorAll(t)}},$n=function(t){"function"!=typeof t&&(t=Dn(t));for(var n=this._groups,e=n.length,r=[],i=[],o=0;o<e;++o)for(var u,a=n[o],s=a.length,l=0;l<s;++l)(u=a[l])&&(r.push(t.call(u,u.__data__,l,a)),i.push(u));return new F(r,i)},Yn=function(t){"function"!=typeof t&&(t=Tn(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o,u=n[i],a=u.length,s=r[i]=[],l=0;l<a;++l)(o=u[l])&&t.call(o,o.__data__,l,u)&&s.push(o);return new F(r,this._parents)},zn=function(t){return new Array(t.length)},Bn=function(){return new F(this._enter||this._groups.map(zn),this._parents)};c.prototype={constructor:c,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,n){return this._parent.insertBefore(t,n)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};var Hn=function(t){return function(){return t}},Un="$",Fn=function(t,n){if(!t)return y=new Array(this.size()),l=-1,this.each(function(t){y[++l]=t}),y;var e=n?f:h,r=this._parents,i=this._groups;"function"!=typeof t&&(t=Hn(t));for(var o=i.length,u=new Array(o),a=new Array(o),s=new Array(o),l=0;l<o;++l){var c=r[l],p=i[l],d=p.length,y=t.call(c,c&&c.__data__,l,r),v=y.length,g=a[l]=new Array(v),_=u[l]=new Array(v);e(c,p,g,_,s[l]=new Array(d),y,n);for(var m,w,b=0,x=0;b<v;++b)if(m=g[b]){for(b>=x&&(x=b+1);!(w=_[x])&&++x<v;);m._next=w||null}}return u=new F(u,r),u._enter=a,u._exit=s,u},Gn=function(){return new F(this._exit||this._groups.map(zn),this._parents)},Jn=function(t){for(var n=this._groups,e=t._groups,r=n.length,i=e.length,o=Math.min(r,i),u=new Array(r),a=0;a<o;++a)for(var s,l=n[a],c=e[a],h=l.length,f=u[a]=new Array(h),p=0;p<h;++p)(s=l[p]||c[p])&&(f[p]=s);for(;a<r;++a)u[a]=n[a];return new F(u,this._parents)},Kn=function(){for(var t=this._groups,n=-1,e=t.length;++n<e;)for(var r,i=t[n],o=i.length-1,u=i[o];--o>=0;)(r=i[o])&&(u&&u!==r.nextSibling&&u.parentNode.insertBefore(r,u),u=r);return this},Qn=function(t){function n(n,e){return n&&e?t(n.__data__,e.__data__):!n-!e}t||(t=p);for(var e=this._groups,r=e.length,i=new Array(r),o=0;o<r;++o){for(var u,a=e[o],s=a.length,l=i[o]=new Array(s),c=0;c<s;++c)(u=a[c])&&(l[c]=u);l.sort(n)}return new F(i,this._parents).order()},Wn=function(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this},Zn=function(){var t=new Array(this.size()),n=-1;return this.each(function(){t[++n]=this}),t},te=function(){for(var t=this._groups,n=0,e=t.length;n<e;++n)for(var r=t[n],i=0,o=r.length;i<o;++i){var u=r[i];if(u)return u}return null},ne=function(){var t=0;return this.each(function(){++t}),t},ee=function(){return!this.node()},re=function(t){for(var n=this._groups,e=0,r=n.length;e<r;++e)for(var i,o=n[e],u=0,a=o.length;u<a;++u)(i=o[u])&&t.call(i,i.__data__,u,o);return this},ie=function(t,n){var e=qn(t);if(arguments.length<2){var r=this.node();return e.local?r.getAttributeNS(e.space,e.local):r.getAttribute(e)}return this.each((null==n?e.local?y:d:"function"==typeof n?e.local?m:_:e.local?g:v)(e,n))},oe=function(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView},ue=function(t,n,e){var r;return arguments.length>1?this.each((null==n?w:"function"==typeof n?x:b)(t,n,null==e?"":e)):oe(r=this.node()).getComputedStyle(r,null).getPropertyValue(t)},ae=function(t,n){return arguments.length>1?this.each((null==n?M:"function"==typeof n?A:N)(t,n)):this.node()[t]};S.prototype={add:function(t){this._names.indexOf(t)<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var n=this._names.indexOf(t);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var se=function(t,n){var e=k(t+"");if(arguments.length<2){for(var r=E(this.node()),i=-1,o=e.length;++i<o;)if(!r.contains(e[i]))return!1;return!0}return this.each(("function"==typeof n?O:n?C:I)(e,n))},le=function(t){return arguments.length?this.each(null==t?X:("function"==typeof t?V:T)(t)):this.node().textContent},ce=function(t){return arguments.length?this.each(null==t?L:("function"==typeof t?j:R)(t)):this.node().innerHTML},he=function(){return this.each(D)},fe=function(){return this.each($)},pe=function(t){var n="function"==typeof t?t:Cn(t);return this.select(function(){return this.appendChild(n.apply(this,arguments))})},de=function(t,n){var e="function"==typeof t?t:Cn(t),r=null==n?Y:"function"==typeof n?n:Rn(n);return this.select(function(){return this.insertBefore(e.apply(this,arguments),r.apply(this,arguments)||null)})},ye=function(){return this.each(z)},ve=function(t){return arguments.length?this.property("__data__",t):this.node().__data__},ge=function(t,n){return this.each(("function"==typeof n?U:H)(t,n))},_e=[null];F.prototype=G.prototype={constructor:F,select:jn,selectAll:$n,filter:Yn,data:Fn,enter:Bn,exit:Gn,merge:Jn,order:Kn,sort:Qn,call:Wn,nodes:Zn,node:te,size:ne,empty:ee,each:re,attr:ie,style:ue,property:ae,classed:se,text:le,html:ce,raise:he,lower:fe,append:pe,insert:de,remove:ye,datum:ve,on:Ln,dispatch:ge};var me=function(t){return"string"==typeof t?new F([[document.querySelector(t)]],[document.documentElement]):new F([[t]],_e)},we=function(t){return"string"==typeof t?new F([document.querySelectorAll(t)],[document.documentElement]):new F([null==t?[]:t],_e)},be={value:function(){}};K.prototype=J.prototype={constructor:K,on:function(t,n){var e,r=this._,i=Q(t+"",r),o=-1,u=i.length;{if(!(arguments.length<2)){if(null!=n&&"function"!=typeof n)throw new Error("invalid callback: "+n);for(;++o<u;)if(e=(t=i[o]).type)r[e]=Z(r[e],t.name,n);else if(null==n)for(e in r)r[e]=Z(r[e],t.name,null);return this}for(;++o<u;)if((e=(t=i[o]).type)&&(e=W(r[e],t.name)))return e}},copy:function(){var t={},n=this._;for(var e in n)t[e]=n[e].slice();return new K(t)},call:function(t,n){if((e=arguments.length-2)>0)for(var e,r,i=new Array(e),o=0;o<e;++o)i[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(r=this._[t],o=0,e=r.length;o<e;++o)r[o].value.apply(n,i)},apply:function(t,n,e){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,o=r.length;i<o;++i)r[i].value.apply(n,e)}};var xe,Me,Ne=0,Ae=0,ke=0,Ee=1e3,Se=0,Pe=0,qe=0,Ce="object"==typeof performance&&performance.now?performance:Date,Ie="function"==typeof requestAnimationFrame?requestAnimationFrame:function(t){setTimeout(t,17)};et.prototype=rt.prototype={constructor:et,restart:function(t,n,e){if("function"!=typeof t)throw new TypeError("callback is not a function");e=(null==e?tt():+e)+(null==n?0:+n),this._next||Me===this||(Me?Me._next=this:xe=this,Me=this),this._call=t,this._time=e,st()},stop:function(){this._call&&(this._call=null,this._time=1/0,st())}};var Oe=function(t,n,e){var r=new et;return n=null==n?0:+n,r.restart(function(e){r.stop(),t(e+n)},n,e),r},Xe=J("start","end","interrupt"),Te=[],Ve=0,Le=1,Re=2,je=3,De=4,$e=5,Ye=6,ze=function(t,n,e,r,i,o){var u=t.__transition;if(u){if(e in u)return}else t.__transition={};ft(t,e,{name:n,index:r,group:i,on:Xe,tween:Te,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:Ve})},Be=function(t,n){var e,r,i,o=t.__transition,u=!0;if(o){n=null==n?null:n+"";for(i in o)(e=o[i]).name===n?(r=e.state>Re&&e.state<$e,e.state=Ye,e.timer.stop(),r&&e.on.call("interrupt",t,t.__data__,e.index,e.group),delete o[i]):u=!1;u&&delete t.__transition}},He=function(t){return this.each(function(){Be(this,t)})},Ue=function(t,n,e){t.prototype=n.prototype=e,e.constructor=t},Fe="\\s*([+-]?\\d+)\\s*",Ge="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",Je="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Ke=/^#([0-9a-f]{3})$/,Qe=/^#([0-9a-f]{6})$/,We=new RegExp("^rgb\\("+[Fe,Fe,Fe]+"\\)$"),Ze=new RegExp("^rgb\\("+[Je,Je,Je]+"\\)$"),tr=new RegExp("^rgba\\("+[Fe,Fe,Fe,Ge]+"\\)$"),nr=new RegExp("^rgba\\("+[Je,Je,Je,Ge]+"\\)$"),er=new RegExp("^hsl\\("+[Ge,Je,Je]+"\\)$"),rr=new RegExp("^hsla\\("+[Ge,Je,Je,Ge]+"\\)$"),ir={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};Ue(dt,yt,{displayable:function(){return this.rgb().displayable()},toString:function(){return this.rgb()+""}}),Ue(wt,mt,pt(dt,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new wt(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new wt(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return 0<=this.r&&this.r<=255&&0<=this.g&&this.g<=255&&0<=this.b&&this.b<=255&&0<=this.opacity&&this.opacity<=1},toString:function(){var t=this.opacity;return t=isNaN(t)?1:Math.max(0,Math.min(1,t)),(1===t?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?")":", "+t+")")}})),Ue(Nt,Mt,pt(dt,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new Nt(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new Nt(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),n=isNaN(t)||isNaN(this.s)?0:this.s,e=this.l,r=e+(e<.5?e:1-e)*n,i=2*e-r;return new wt(At(t>=240?t-240:t+120,i,r),At(t,i,r),At(t<120?t+240:t-120,i,r),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1}}));var or=Math.PI/180,ur=180/Math.PI,ar=.95047,sr=1,lr=1.08883,cr=4/29,hr=6/29,fr=3*hr*hr,pr=hr*hr*hr;Ue(St,Et,pt(dt,{brighter:function(t){return new St(this.l+18*(null==t?1:t),this.a,this.b,this.opacity)},darker:function(t){return new St(this.l-18*(null==t?1:t),this.a,this.b,this.opacity)},rgb:function(){var t=(this.l+16)/116,n=isNaN(this.a)?t:t+this.a/500,e=isNaN(this.b)?t:t-this.b/200;return t=sr*qt(t),n=ar*qt(n),e=lr*qt(e),new wt(Ct(3.2404542*n-1.5371385*t-.4985314*e),Ct(-.969266*n+1.8760108*t+.041556*e),Ct(.0556434*n-.2040259*t+1.0572252*e),this.opacity)}})),Ue(Tt,Xt,pt(dt,{brighter:function(t){return new Tt(this.h,this.c,this.l+18*(null==t?1:t),this.opacity)},darker:function(t){return new Tt(this.h,this.c,this.l-18*(null==t?1:t),this.opacity)},rgb:function(){return kt(this).rgb()}}));var dr=-.14861,yr=1.78277,vr=-.29227,gr=-.90649,_r=1.97294,mr=_r*gr,wr=_r*yr,br=yr*vr-gr*dr;Ue(Rt,Lt,pt(dt,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new Rt(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new Rt(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=isNaN(this.h)?0:(this.h+120)*or,n=+this.l,e=isNaN(this.s)?0:this.s*n*(1-n),r=Math.cos(t),i=Math.sin(t);return new wt(255*(n+e*(dr*r+yr*i)),255*(n+e*(vr*r+gr*i)),255*(n+e*(_r*r)),this.opacity)}}));var xr,Mr,Nr,Ar,kr=function(t){return function(){return t}},Er=function t(n){function e(t,n){var e=r((t=mt(t)).r,(n=mt(n)).r),i=r(t.g,n.g),o=r(t.b,n.b),u=zt(t.opacity,n.opacity);return function(n){return t.r=e(n),t.g=i(n),t.b=o(n),t.opacity=u(n),t+""}}var r=Yt(n);return e.gamma=t,e}(1),Sr=function(t,n){return t=+t,n-=t,function(e){return t+n*e}},Pr=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,qr=new RegExp(Pr.source,"g"),Cr=function(t,n){var e,r,i,o=Pr.lastIndex=qr.lastIndex=0,u=-1,a=[],s=[];for(t+="",
n+="";(e=Pr.exec(t))&&(r=qr.exec(n));)(i=r.index)>o&&(i=n.slice(o,i),a[u]?a[u]+=i:a[++u]=i),(e=e[0])===(r=r[0])?a[u]?a[u]+=r:a[++u]=r:(a[++u]=null,s.push({i:u,x:Sr(e,r)})),o=qr.lastIndex;return o<n.length&&(i=n.slice(o),a[u]?a[u]+=i:a[++u]=i),a.length<2?s[0]?Ht(s[0].x):Bt(n):(n=s.length,function(t){for(var e,r=0;r<n;++r)a[(e=s[r]).i]=e.x(t);return a.join("")})},Ir=180/Math.PI,Or={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1},Xr=function(t,n,e,r,i,o){var u,a,s;return(u=Math.sqrt(t*t+n*n))&&(t/=u,n/=u),(s=t*e+n*r)&&(e-=t*s,r-=n*s),(a=Math.sqrt(e*e+r*r))&&(e/=a,r/=a,s/=a),t*r<n*e&&(t=-t,n=-n,s=-s,u=-u),{translateX:i,translateY:o,rotate:Math.atan2(n,t)*Ir,skewX:Math.atan(s)*Ir,scaleX:u,scaleY:a}},Tr=Gt(Ut,"px, ","px)","deg)"),Vr=Gt(Ft,", ",")",")");Jt($t);var Lr=(Jt(zt),function(t,n){var e=this._id;if(t+="",arguments.length<2){for(var r,i=ht(this.node(),e).tween,o=0,u=i.length;o<u;++o)if((r=i[o]).name===t)return r.value;return null}return this.each((null==n?Kt:Qt)(e,t,n))}),Rr=function(t,n){var e;return("number"==typeof n?Sr:n instanceof yt?Er:(e=yt(n))?(n=e,Er):Cr)(t,n)},jr=function(t,n){var e=qn(t),r="transform"===e?Vr:Rr;return this.attrTween(t,"function"==typeof n?(e.local?on:rn)(e,r,Wt(this,"attr."+t,n)):null==n?(e.local?tn:Zt)(e):(e.local?en:nn)(e,r,n+""))},Dr=function(t,n){var e="attr."+t;if(arguments.length<2)return(e=this.tween(e))&&e._value;if(null==n)return this.tween(e,null);if("function"!=typeof n)throw new Error;var r=qn(t);return this.tween(e,(r.local?un:an)(r,n))},$r=function(t){var n=this._id;return arguments.length?this.each(("function"==typeof t?sn:ln)(n,t)):ht(this.node(),n).delay},Yr=function(t){var n=this._id;return arguments.length?this.each(("function"==typeof t?cn:hn)(n,t)):ht(this.node(),n).duration},zr=function(t){var n=this._id;return arguments.length?this.each(fn(n,t)):ht(this.node(),n).ease},Br=function(t){"function"!=typeof t&&(t=Tn(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o,u=n[i],a=u.length,s=r[i]=[],l=0;l<a;++l)(o=u[l])&&t.call(o,o.__data__,l,u)&&s.push(o);return new Mn(r,this._parents,this._name,this._id)},Hr=function(t){if(t._id!==this._id)throw new Error;for(var n=this._groups,e=t._groups,r=n.length,i=e.length,o=Math.min(r,i),u=new Array(r),a=0;a<o;++a)for(var s,l=n[a],c=e[a],h=l.length,f=u[a]=new Array(h),p=0;p<h;++p)(s=l[p]||c[p])&&(f[p]=s);for(;a<r;++a)u[a]=n[a];return new Mn(u,this._parents,this._name,this._id)},Ur=function(t,n){var e=this._id;return arguments.length<2?ht(this.node(),e).on.on(t):this.each(dn(e,t,n))},Fr=function(){return this.on("end.remove",yn(this._id))},Gr=function(t){var n=this._name,e=this._id;"function"!=typeof t&&(t=Rn(t));for(var r=this._groups,i=r.length,o=new Array(i),u=0;u<i;++u)for(var a,s,l=r[u],c=l.length,h=o[u]=new Array(c),f=0;f<c;++f)(a=l[f])&&(s=t.call(a,a.__data__,f,l))&&("__data__"in a&&(s.__data__=a.__data__),h[f]=s,ze(h[f],n,e,f,h,ht(a,e)));return new Mn(o,this._parents,n,e)},Jr=function(t){var n=this._name,e=this._id;"function"!=typeof t&&(t=Dn(t));for(var r=this._groups,i=r.length,o=[],u=[],a=0;a<i;++a)for(var s,l=r[a],c=l.length,h=0;h<c;++h)if(s=l[h]){for(var f,p=t.call(s,s.__data__,h,l),d=ht(s,e),y=0,v=p.length;y<v;++y)(f=p[y])&&ze(f,n,e,y,p,d);o.push(p),u.push(s)}return new Mn(o,u,n,e)},Kr=G.prototype.constructor,Qr=function(){return new Kr(this._groups,this._parents)},Wr=function(t,n,e){var r="transform"==(t+="")?Tr:Rr;return null==n?this.styleTween(t,vn(t,r)).on("end.style."+t,gn(t)):this.styleTween(t,"function"==typeof n?mn(t,r,Wt(this,"style."+t,n)):_n(t,r,n+""),e)},Zr=function(t,n,e){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==n)return this.tween(r,null);if("function"!=typeof n)throw new Error;return this.tween(r,wn(t,n,null==e?"":e))},ti=function(t){return this.tween("text","function"==typeof t?xn(Wt(this,"text",t)):bn(null==t?"":t+""))},ni=function(){for(var t=this._name,n=this._id,e=An(),r=this._groups,i=r.length,o=0;o<i;++o)for(var u,a=r[o],s=a.length,l=0;l<s;++l)if(u=a[l]){var c=ht(u,n);ze(u,t,e,l,a,{time:c.time+c.delay+c.duration,delay:0,duration:c.duration,ease:c.ease})}return new Mn(r,this._parents,t,e)},ei=0,ri=G.prototype;Mn.prototype=Nn.prototype={constructor:Mn,select:Gr,selectAll:Jr,filter:Br,merge:Hr,selection:Qr,transition:ni,call:ri.call,nodes:ri.nodes,node:ri.node,size:ri.size,empty:ri.empty,each:ri.each,on:Ur,attr:jr,attrTween:Dr,style:Wr,styleTween:Zr,text:ti,remove:Fr,tween:Lr,delay:$r,duration:Yr,ease:zr};var ii=(function t(n){function e(t){return Math.pow(t,n)}return n=+n,e.exponent=t,e}(3),function t(n){function e(t){return 1-Math.pow(1-t,n)}return n=+n,e.exponent=t,e}(3),function t(n){function e(t){return((t*=2)<=1?Math.pow(t,n):2-Math.pow(2-t,n))/2}return n=+n,e.exponent=t,e}(3),function t(n){function e(t){return t*t*((n+1)*t-n)}return n=+n,e.overshoot=t,e}(1.70158),function t(n){function e(t){return--t*t*((n+1)*t+n)+1}return n=+n,e.overshoot=t,e}(1.70158),function t(n){function e(t){return((t*=2)<1?t*t*((n+1)*t-n):(t-=2)*t*((n+1)*t+n)+2)/2}return n=+n,e.overshoot=t,e}(1.70158),2*Math.PI),oi=(function t(n,e){function r(t){return n*Math.pow(2,10*--t)*Math.sin((i-t)/e)}var i=Math.asin(1/(n=Math.max(1,n)))*(e/=ii);return r.amplitude=function(n){return t(n,e*ii)},r.period=function(e){return t(n,e)},r}(1,.3),function t(n,e){function r(t){return 1-n*Math.pow(2,-10*(t=+t))*Math.sin((t+i)/e)}var i=Math.asin(1/(n=Math.max(1,n)))*(e/=ii);return r.amplitude=function(n){return t(n,e*ii)},r.period=function(e){return t(n,e)},r}(1,.3),function t(n,e){function r(t){return((t=2*t-1)<0?n*Math.pow(2,10*t)*Math.sin((i-t)/e):2-n*Math.pow(2,-10*t)*Math.sin((i+t)/e))/2}var i=Math.asin(1/(n=Math.max(1,n)))*(e/=ii);return r.amplitude=function(n){return t(n,e*ii)},r.period=function(e){return t(n,e)},r}(1,.3),{time:null,delay:0,duration:250,ease:kn}),ui=function(t){var n,e;t instanceof Mn?(n=t._id,t=t._name):(n=An(),(e=oi).time=tt(),t=null==t?null:t+"");for(var r=this._groups,i=r.length,o=0;o<i;++o)for(var u,a=r[o],s=a.length,l=0;l<s;++l)(u=a[l])&&ze(u,t,n,l,a,e||En(u,n));return new Mn(r,this._parents,t,n)};G.prototype.interrupt=He,G.prototype.transition=ui,t.selection=G,t.select=me,t.selectAll=we,Object.defineProperty(t,"__esModule",{value:!0})});
<!DOCTYPE html>
<meta charset="utf-8">
<body>
<script src="d3.min.js"></script>
<script>
d3.select("body").append("h1")
.text("Hello, world!")
.style("text-align", "center")
.style("line-height", "320px")
.style("font-size", "100px")
.style("transform", "rotate(-180deg) scale(0.001, 0.001)")
.transition()
.duration(1500)
.style("transform", null);
</script>
export {
event,
selection,
select,
selectAll
} from "d3-selection";
import "d3-transition";
{
"name": "d3-custom-example",
"version": "0.0.1",
"scripts": {
"prepublish": "rollup -c -f umd -n d3 -o d3.js -- index.js && uglifyjs d3.js -c -m -o d3.min.js"
},
"devDependencies": {
"d3-selection": "1",
"d3-transition": "1",
"rollup": "0.41",
"rollup-plugin-node-resolve": "2",
"uglify-js": "2"
}
}
import node from "rollup-plugin-node-resolve";
export default {
plugins: [node()]
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment