d3plus-text
Advanced tools
Comparing version 0.4.2 to 0.4.3
@@ -12,3 +12,3 @@ import buble from "rollup-plugin-buble"; | ||
moduleName: "d3plus_text", | ||
plugins: [json(), deps({"jsnext": true, "main": true}), buble()] | ||
plugins: [json(), deps({"jsnext": true}), buble()] | ||
}; |
@@ -1,2 +0,2 @@ | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define("d3plus-text",["exports"],n):n(t.d3plus_text=t.d3plus_text||{})}(this,function(t){"use strict";function n(t){var n=t+="",e=n.indexOf(":");return e>=0&&"xmlns"!==(n=t.slice(0,e))&&(t=t.slice(e+1)),tr.hasOwnProperty(n)?{space:tr[n],local:t}:t}function e(t){return function(){var n=this.ownerDocument,e=this.namespaceURI;return e===Ze&&n.documentElement.namespaceURI===Ze?n.createElement(t):n.createElementNS(e,t)}}function r(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function i(t){var i=n(t);return(i.local?r:e)(i)}function o(t,n,e){return t=u(t,n,e),function(n){var e=n.relatedTarget;e&&(e===this||8&e.compareDocumentPosition(this))||t.call(this,n)}}function u(t,n,e){return function(r){var i=ur;ur=r;try{t.call(this,this.__data__,n,e)}finally{ur=i}}}function a(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 s(t){return function(){var n=this,e=this.__on;if(e){for(var r,i=0,o=-1,u=e.length;u>i;++i)r=e[i],t.type&&r.type!==t.type||r.name!==t.name?e[++o]=r:n.removeEventListener(r.type,r.listener,r.capture);++o?e.length=o:delete this.__on}}}function l(t,n,e){var r=or.hasOwnProperty(t.type)?o:u;return function(i,o,u){var a,s=this,l=this.__on,c=r(n,o,u);if(l)for(var f=0,h=l.length;h>f;++f)if((a=l[f]).type===t.type&&a.name===t.name)return s.removeEventListener(a.type,a.listener,a.capture),s.addEventListener(a.type,a.listener=c,a.capture=e),void(a.value=n);this.addEventListener(t.type,c,e),a={type:t.type,name:t.name,value:n,listener:c,capture:e},l?l.push(a):this.__on=[a]}}function c(t,n,e){var r,i,o=this,u=a(t+""),c=u.length;if(!(arguments.length<2)){for(f=n?l:s,null==e&&(e=!1),r=0;c>r;++r)o.each(f(u[r],n,e));return this}var f=this.node().__on;if(f)for(var h,p=0,d=f.length;d>p;++p)for(r=0,h=f[p];c>r;++r)if((i=u[r]).type===h.type&&i.name===h.name)return h.value}function f(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function h(t){return function(){return this.querySelector(t)}}function p(t){var n=this;"function"!=typeof t&&(t=h(t));for(var e=n._groups,r=e.length,i=new Array(r),o=0;r>o;++o)for(var u,a,s=e[o],l=s.length,c=i[o]=new Array(l),f=0;l>f;++f)(u=s[f])&&(a=t.call(u,u.__data__,f,s))&&("__data__"in u&&(a.__data__=u.__data__),c[f]=a);return new St(i,this._parents)}function d(t){return function(){return this.querySelectorAll(t)}}function y(t){var n=this;"function"!=typeof t&&(t=d(t));for(var e=n._groups,r=e.length,i=[],o=[],u=0;r>u;++u)for(var a,s=e[u],l=s.length,c=0;l>c;++c)(a=s[c])&&(i.push(t.call(a,a.__data__,c,s)),o.push(a));return new St(i,o)}function v(t){var n=this;"function"!=typeof t&&(t=ir(t));for(var e=n._groups,r=e.length,i=new Array(r),o=0;r>o;++o)for(var u,a=e[o],s=a.length,l=i[o]=new Array(s),c=0;s>c;++c)(u=a[c])&&t.call(u,u.__data__,c,a)&&(l[c]=u);return new St(i,this._parents)}function g(t){return function(){return t}}function m(t,n,e,r,i,o){for(var u,a=0,s=n.length,l=o.length;l>a;++a)(u=n[a])?(u.__data__=o[a],r[a]=u):e[a]=new b(t,o[a]);for(;s>a;++a)(u=n[a])&&(i[a]=u)}function _(t,n,e,r,i,o,u){var a,s,l,c={},f=n.length,h=o.length,p=new Array(f);for(a=0;f>a;++a)(s=n[a])&&(p[a]=l=sr+u.call(s,s.__data__,a,n),c[l]||(c[l]=s));for(a=0;h>a;++a)l=sr+u.call(t,o[a],a,o),(s=c[l])?s!==!0&&(r[a]=s,s.__data__=o[a]):e[a]=new b(t,o[a]),c[l]=!0;for(a=0;f>a;++a)(s=n[a])&&c[p[a]]!==!0&&(i[a]=s)}function w(t,n){if(!t)return p=new Array(this.size()),l=-1,this.each(function(t){p[++l]=t}),p;var e=n?_:m,r=this._parents,i=this._groups;"function"!=typeof t&&(t=g(t));for(var o=i.length,u=new Array(o),a=new Array(o),s=new Array(o),l=0;o>l;++l){var c=r[l],f=i[l],h=f.length,p=t.call(c,c&&c.__data__,l,r),d=p.length,y=a[l]=new Array(d),v=u[l]=new Array(d),w=s[l]=new Array(h);e(c,f,y,v,w,p,n);for(var b,x,M=0,A=0;d>M;++M)if(b=y[M]){for(M>=A&&(A=M+1);!(x=v[A])&&++A<d;);b._next=x||null}}return u=new St(u,r),u._enter=a,u._exit=s,u}function b(t,n){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=n}function x(t){return new Array(t.length)}function M(){return new St(this._enter||this._groups.map(x),this._parents)}function A(){return new St(this._exit||this._groups.map(x),this._parents)}function N(t){for(var n=this,e=n._groups,r=t._groups,i=e.length,o=r.length,u=Math.min(i,o),a=new Array(i),s=0;u>s;++s)for(var l,c=e[s],f=r[s],h=c.length,p=a[s]=new Array(h),d=0;h>d;++d)(l=c[d]||f[d])&&(p[d]=l);for(;i>s;++s)a[s]=e[s];return new St(a,this._parents)}function k(){for(var t=this,n=t._groups,e=-1,r=n.length;++e<r;)for(var i,o=n[e],u=o.length-1,a=o[u];--u>=0;)(i=o[u])&&(a&&a!==i.nextSibling&&a.parentNode.insertBefore(i,a),a=i);return this}function E(t){function n(n,e){return n&&e?t(n.__data__,e.__data__):!n-!e}var e=this;t||(t=S);for(var r=e._groups,i=r.length,o=new Array(i),u=0;i>u;++u){for(var a,s=r[u],l=s.length,c=o[u]=new Array(l),f=0;l>f;++f)(a=s[f])&&(c[f]=a);c.sort(n)}return new St(o,this._parents).order()}function S(t,n){return n>t?-1:t>n?1:t>=n?0:NaN}function P(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function C(){var t=new Array(this.size()),n=-1;return this.each(function(){t[++n]=this}),t}function q(){for(var t=this,n=t._groups,e=0,r=n.length;r>e;++e)for(var i=n[e],o=0,u=i.length;u>o;++o){var a=i[o];if(a)return a}return null}function z(){var t=0;return this.each(function(){++t}),t}function T(){return!this.node()}function I(t){for(var n=this,e=n._groups,r=0,i=e.length;i>r;++r)for(var o,u=e[r],a=0,s=u.length;s>a;++a)(o=u[a])&&t.call(o,o.__data__,a,u);return this}function X(t){return function(){this.removeAttribute(t)}}function O(t){return function(){this.removeAttributeNS(t.space,t.local)}}function V(t,n){return function(){this.setAttribute(t,n)}}function j(t,n){return function(){this.setAttributeNS(t.space,t.local,n)}}function L(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttribute(t):this.setAttribute(t,e)}}function D(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 R(t,e){var r=n(t);if(arguments.length<2){var i=this.node();return r.local?i.getAttributeNS(r.space,r.local):i.getAttribute(r)}return this.each((null==e?r.local?O:X:"function"==typeof e?r.local?D:L:r.local?j:V)(r,e))}function $(t){return function(){this.style.removeProperty(t)}}function Y(t,n,e){return function(){this.style.setProperty(t,n,e)}}function B(t,n,e){return function(){var r=n.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,e)}}function H(t,n,e){var r;return arguments.length>1?this.each((null==n?$:"function"==typeof n?B:Y)(t,n,null==e?"":e)):f(r=this.node()).getComputedStyle(r,null).getPropertyValue(t)}function F(t){return function(){delete this[t]}}function U(t,n){return function(){this[t]=n}}function W(t,n){return function(){var e=n.apply(this,arguments);null==e?delete this[t]:this[t]=e}}function K(t,n){return arguments.length>1?this.each((null==n?F:"function"==typeof n?W:U)(t,n)):this.node()[t]}function G(t){return t.trim().split(/^|\s+/)}function J(t){return t.classList||new Q(t)}function Q(t){this._node=t,this._names=G(t.getAttribute("class")||"")}function Z(t,n){for(var e=J(t),r=-1,i=n.length;++r<i;)e.add(n[r])}function tt(t,n){for(var e=J(t),r=-1,i=n.length;++r<i;)e.remove(n[r])}function nt(t){return function(){Z(this,t)}}function et(t){return function(){tt(this,t)}}function rt(t,n){return function(){(n.apply(this,arguments)?Z:tt)(this,t)}}function it(t,n){var e=G(t+"");if(arguments.length<2){for(var r=J(this.node()),i=-1,o=e.length;++i<o;)if(!r.contains(e[i]))return!1;return!0}return this.each(("function"==typeof n?rt:n?nt:et)(e,n))}function ot(){this.textContent=""}function ut(t){return function(){this.textContent=t}}function at(t){return function(){var n=t.apply(this,arguments);this.textContent=null==n?"":n}}function st(t){return arguments.length?this.each(null==t?ot:("function"==typeof t?at:ut)(t)):this.node().textContent}function lt(){this.innerHTML=""}function ct(t){return function(){this.innerHTML=t}}function ft(t){return function(){var n=t.apply(this,arguments);this.innerHTML=null==n?"":n}}function ht(t){return arguments.length?this.each(null==t?lt:("function"==typeof t?ft:ct)(t)):this.node().innerHTML}function pt(){this.parentNode.appendChild(this)}function dt(){return this.each(pt)}function yt(){this.parentNode.insertBefore(this,this.parentNode.firstChild)}function vt(){return this.each(yt)}function gt(t){return function(){return this.appendChild(t.apply(this,arguments))}}function mt(t,n){return function(){return this.insertBefore(t.apply(this,arguments),n.apply(this,arguments)||null)}}function _t(){return null}function wt(t,n){var e="function"==typeof t?t:i(t);return this.select(arguments.length<2?gt(e):mt(e,null==n?_t:"function"==typeof n?n:h(n)))}function bt(){var t=this.parentNode;t&&t.removeChild(this)}function xt(){return this.each(bt)}function Mt(t){return arguments.length?this.property("__data__",t):this.node().__data__}function At(t,n,e){var r=f(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 Nt(t,n){return function(){return At(this,t,n)}}function kt(t,n){return function(){return At(this,t,n.apply(this,arguments))}}function Et(t,n){return this.each(("function"==typeof n?kt:Nt)(t,n))}function St(t,n){this._groups=t,this._parents=n}function Pt(){return new St([[document.documentElement]],lr)}function Ct(t){return"string"==typeof t?new St([[document.querySelector(t)]],[document.documentElement]):new St([[t]],lr)}function qt(){for(var t,n=arguments,e=0,r=n.length,i={};r>e;++e){if(!(t=n[e]+"")||t in i)throw new Error;i[t]=[]}return new zt(i)}function zt(t){this._=t}function Tt(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;return{type:t,name:e}})}function It(t,n){for(var e,r=0,i=t.length;i>r;++r)if((e=t[r]).name===n)return e.value}function Xt(t,n,e){for(var r=0,i=t.length;i>r;++r)if(t[r].name===n){t[r]=cr,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=e&&t.push({name:n,value:e}),t}function Ot(){return mr||(br(Vt),mr=wr.now()+_r)}function Vt(){mr=0}function jt(){this._call=this._time=this._next=null}function Lt(t,n,e){var r=new jt;return r.restart(t,n,e),r}function Dt(){Ot(),++pr;for(var t,n=fr;n;)(t=mr-n._time)>=0&&n._call.call(null,t),n=n._next;--pr}function Rt(t){mr=(gr=t||wr.now())+_r,pr=dr=0;try{Dt()}finally{pr=0,Yt(),mr=0}}function $t(){var t=wr.now(),n=t-gr;n>vr&&(_r-=n,gr=t)}function Yt(){for(var t,n=fr,e=1/0;n;)n._call?(e>n._time&&(e=n._time),n=(t=n)._next):n=t?t._next=n._next:fr=n._next;hr=t,Bt(e)}function Bt(t){if(!pr){dr&&(dr=clearTimeout(dr));var n=t-mr;n>24?(1/0>t&&(dr=setTimeout(Rt,n)),yr&&(yr=clearInterval(yr))):(yr||(yr=setInterval($t,vr)),pr=1,br(Rt))}}function Ht(t,n,e){var r=new jt;return n=null==n?0:+n,r.restart(function(e){r.stop(),t(e+n)},n,e),r}function Ft(t,n,e,r,i,o){var u=t.__transition;if(u){if(e in u)return}else t.__transition={};Gt(t,e,{name:n,index:r,group:i,on:xr,tween:Mr,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:Ar})}function Ut(t,n){var e=t.__transition;if(!e||!(e=e[n])||e.state>Ar)throw new Error("too late");return e}function Wt(t,n){var e=t.__transition;if(!e||!(e=e[n])||e.state>kr)throw new Error("too late");return e}function Kt(t,n){var e=t.__transition;if(!e||!(e=e[n]))throw new Error("too late");return e}function Gt(t,n,e){function r(t){e.state=Nr,e.delay<=t?i(t-e.delay):e.timer.restart(i,e.delay,e.time)}function i(r){var i,s,l,c;for(i in a)c=a[i],c.name===e.name&&(c.state===Er?(c.state=Pr,c.timer.stop(),c.on.call("interrupt",t,t.__data__,c.index,c.group),delete a[i]):n>+i&&(c.state=Pr,c.timer.stop(),delete a[i]));if(Ht(function(){e.state===Er&&(e.timer.restart(o,e.delay,e.time),o(r))}),e.state=kr,e.on.call("start",t,t.__data__,e.index,e.group),e.state===kr){for(e.state=Er,u=new Array(l=e.tween.length),i=0,s=-1;l>i;++i)(c=e.tween[i].value.call(t,t.__data__,e.index,e.group))&&(u[++s]=c);u.length=s+1}}function o(r){for(var i=r<e.duration?e.ease.call(null,r/e.duration):(e.state=Sr,1),o=-1,s=u.length;++o<s;)u[o].call(null,i);if(e.state===Sr){e.state=Pr,e.timer.stop(),e.on.call("end",t,t.__data__,e.index,e.group);for(o in a)if(+o!==n)return void delete a[n];delete t.__transition}}var u,a=t.__transition;a[n]=e,e.timer=Lt(r,0,e.time)}function Jt(t){return t=null==t?null:t+"",this.each(function(){var n,e,r,i=this.__transition,o=!0;if(i){for(r in i)(n=i[r]).name===t?(e=n.state===Er,n.state=Pr,n.timer.stop(),e&&n.on.call("interrupt",this,this.__data__,n.index,n.group),delete i[r]):o=!1;o&&delete this.__transition}})}function Qt(t,n,e){t.prototype=n.prototype=e,e.constructor=t}function Zt(t,n){var e=Object.create(t.prototype);for(var r in n)e[r]=n[r];return e}function tn(){}function nn(t){var n;return t=(t+"").trim().toLowerCase(),(n=zr.exec(t))?(n=parseInt(n[1],16),new an(n>>8&15|n>>4&240,n>>4&15|240&n,(15&n)<<4|15&n,1)):(n=Tr.exec(t))?en(parseInt(n[1],16)):(n=Ir.exec(t))?new an(n[1],n[2],n[3],1):(n=Xr.exec(t))?new an(255*n[1]/100,255*n[2]/100,255*n[3]/100,1):(n=Or.exec(t))?rn(n[1],n[2],n[3],n[4]):(n=Vr.exec(t))?rn(255*n[1]/100,255*n[2]/100,255*n[3]/100,n[4]):(n=jr.exec(t))?sn(n[1],n[2]/100,n[3]/100,1):(n=Lr.exec(t))?sn(n[1],n[2]/100,n[3]/100,n[4]):Dr.hasOwnProperty(t)?en(Dr[t]):"transparent"===t?new an(NaN,NaN,NaN,0):null}function en(t){return new an(t>>16&255,t>>8&255,255&t,1)}function rn(t,n,e,r){return 0>=r&&(t=n=e=NaN),new an(t,n,e,r)}function on(t){return t instanceof tn||(t=nn(t)),t?(t=t.rgb(),new an(t.r,t.g,t.b,t.opacity)):new an}function un(t,n,e,r){return 1===arguments.length?on(t):new an(t,n,e,null==r?1:r)}function an(t,n,e,r){this.r=+t,this.g=+n,this.b=+e,this.opacity=+r}function sn(t,n,e,r){return 0>=r?t=n=e=NaN:0>=e||e>=1?t=n=NaN:0>=n&&(t=NaN),new fn(t,n,e,r)}function ln(t){if(t instanceof fn)return new fn(t.h,t.s,t.l,t.opacity);if(t instanceof tn||(t=nn(t)),!t)return new fn;if(t instanceof fn)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*(r>e):e===o?(r-n)/a+2:(n-e)/a+4,a/=.5>s?o+i:2-o-i,u*=60):a=s>0&&1>s?0:u,new fn(u,a,s,t.opacity)}function cn(t,n,e,r){return 1===arguments.length?ln(t):new fn(t,n,e,null==r?1:r)}function fn(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function hn(t,n,e){return 255*(60>t?n+(e-n)*t/60:180>t?e:240>t?n+(e-n)*(240-t)/60:n)}function pn(t){if(t instanceof yn)return new yn(t.l,t.a,t.b,t.opacity);if(t instanceof xn){var n=t.h*Rr;return new yn(t.l,Math.cos(n)*t.c,Math.sin(n)*t.c,t.opacity)}t instanceof an||(t=on(t));var e=_n(t.r),r=_n(t.g),i=_n(t.b),o=vn((.4124564*e+.3575761*r+.1804375*i)/Br),u=vn((.2126729*e+.7151522*r+.072175*i)/Hr),a=vn((.0193339*e+.119192*r+.9503041*i)/Fr);return new yn(116*u-16,500*(o-u),200*(u-a),t.opacity)}function dn(t,n,e,r){return 1===arguments.length?pn(t):new yn(t,n,e,null==r?1:r)}function yn(t,n,e,r){this.l=+t,this.a=+n,this.b=+e,this.opacity=+r}function vn(t){return t>Gr?Math.pow(t,1/3):t/Kr+Ur}function gn(t){return t>Wr?t*t*t:Kr*(t-Ur)}function mn(t){return 255*(.0031308>=t?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function _n(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function wn(t){if(t instanceof xn)return new xn(t.h,t.c,t.l,t.opacity);t instanceof yn||(t=pn(t));var n=Math.atan2(t.b,t.a)*$r;return new xn(0>n?n+360:n,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}function bn(t,n,e,r){return 1===arguments.length?wn(t):new xn(t,n,e,null==r?1:r)}function xn(t,n,e,r){this.h=+t,this.c=+n,this.l=+e,this.opacity=+r}function Mn(t){if(t instanceof Nn)return new Nn(t.h,t.s,t.l,t.opacity);t instanceof an||(t=on(t));var n=t.r/255,e=t.g/255,r=t.b/255,i=(ii*r+ei*n-ri*e)/(ii+ei-ri),o=r-i,u=(ni*(e-i)-Zr*o)/ti,a=Math.sqrt(u*u+o*o)/(ni*i*(1-i)),s=a?Math.atan2(u,o)*$r-120:NaN;return new Nn(0>s?s+360:s,a,i,t.opacity)}function An(t,n,e,r){return 1===arguments.length?Mn(t):new Nn(t,n,e,null==r?1:r)}function Nn(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function kn(t){return function(){return t}}function En(t,n){return function(e){return t+e*n}}function Sn(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 Pn(t,n){var e=n-t;return e?En(t,e>180||-180>e?e-360*Math.round(e/360):e):kn(isNaN(t)?n:t)}function Cn(t){return 1===(t=+t)?qn:function(n,e){return e-n?Sn(n,e,t):kn(isNaN(n)?e:n)}}function qn(t,n){var e=n-t;return e?En(t,e):kn(isNaN(t)?n:t)}function zn(t,n){return t=+t,n-=t,function(e){return t+n*e}}function Tn(t){return function(){return t}}function In(t){return function(n){return t(n)+""}}function Xn(t,n){var e,r,i,o=ci.lastIndex=fi.lastIndex=0,u=-1,a=[],s=[];for(t+="",n+="";(e=ci.exec(t))&&(r=fi.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:zn(e,r)})),o=fi.lastIndex;return o<n.length&&(i=n.slice(o),a[u]?a[u]+=i:a[++u]=i),a.length<2?s[0]?In(s[0].x):Tn(n):(n=s.length,function(t){for(var e,r=0;n>r;++r)a[(e=s[r]).i]=e.x(t);return a.join("")})}function On(t,n,e,r,i,o){if(t*r===n*e)return null;var u=Math.sqrt(t*t+n*n);t/=u,n/=u;var a=t*e+n*r;e-=t*a,r-=n*a;var s=Math.sqrt(e*e+r*r);return e/=s,r/=s,a/=s,n*e>t*r&&(t=-t,n=-n,a=-a,u=-u),{translateX:i,translateY:o,rotate:Math.atan2(n,t)*hi,skewX:Math.atan(a)*hi,scaleX:u,scaleY:s}}function Vn(t){if("none"===t)return pi;oi||(oi=document.createElement("DIV"),ui=document.documentElement,ai=document.defaultView),oi.style.transform=t,t=ai.getComputedStyle(ui.appendChild(oi),null).getPropertyValue("transform"),ui.removeChild(oi);var n=t.slice(7,-1).split(",");return On(+n[0],+n[1],+n[2],+n[3],+n[4],+n[5])}function jn(t){si||(si=document.createElementNS("http://www.w3.org/2000/svg","g")),si.setAttribute("transform",null==t?"":t);var n=si.transform.baseVal.consolidate().matrix;return On(n.a,n.b,n.c,n.d,n.e,n.f)}function Ln(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:zn(t,i)},{i:s-2,x:zn(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:zn(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:zn(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:zn(t,e)},{i:a-2,x:zn(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 Dn(t,n){var e,r;return function(){var i=Wt(this,t),o=i.tween;if(o!==e){r=e=o;for(var u=0,a=r.length;a>u;++u)if(r[u].name===n){r=r.slice(),r.splice(u,1);break}}i.tween=r}}function Rn(t,n,e){var r,i;if("function"!=typeof e)throw new Error;return function(){var o=Wt(this,t),u=o.tween;if(u!==r){i=(r=u).slice();for(var a={name:n,value:e},s=0,l=i.length;l>s;++s)if(i[s].name===n){i[s]=a;break}s===l&&i.push(a)}o.tween=i}}function $n(t,n){var e=this._id;if(t+="",arguments.length<2){for(var r,i=Kt(this.node(),e).tween,o=0,u=i.length;u>o;++o)if((r=i[o]).name===t)return r.value;return null}return this.each((null==n?Dn:Rn)(e,t,n))}function Yn(t,n,e){var r=t._id;return t.each(function(){var t=Wt(this,r);(t.value||(t.value={}))[n]=e.apply(this,arguments)}),function(t){return Kt(t,r).value[n]}}function Bn(t,n){var e;return("number"==typeof n?zn:n instanceof nn?li:(e=nn(n))?(n=e,li):Xn)(t,n)}function Hn(t){return function(){this.removeAttribute(t)}}function Fn(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Un(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 Wn(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 Kn(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 Gn(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 Jn(t,e){var r=n(t),i="transform"===r?yi:Bn;return this.attrTween(t,"function"==typeof e?(r.local?Gn:Kn)(r,i,Yn(this,"attr."+t,e)):null==e?(r.local?Fn:Hn)(r):(r.local?Wn:Un)(r,i,e))}function Qn(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 Zn(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 te(t,e){var r="attr."+t;if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==e)return this.tween(r,null);if("function"!=typeof e)throw new Error;var i=n(t);return this.tween(r,(i.local?Qn:Zn)(i,e))}function ne(t,n){return function(){Ut(this,t).delay=+n.apply(this,arguments)}}function ee(t,n){return n=+n,function(){Ut(this,t).delay=n}}function re(t){var n=this._id;return arguments.length?this.each(("function"==typeof t?ne:ee)(n,t)):Kt(this.node(),n).delay}function ie(t,n){return function(){Wt(this,t).duration=+n.apply(this,arguments)}}function oe(t,n){return n=+n,function(){Wt(this,t).duration=n}}function ue(t){var n=this._id;return arguments.length?this.each(("function"==typeof t?ie:oe)(n,t)):Kt(this.node(),n).duration}function ae(t,n){if("function"!=typeof n)throw new Error;return function(){Wt(this,t).ease=n}}function se(t){var n=this._id;return arguments.length?this.each(ae(n,t)):Kt(this.node(),n).ease}function le(t){var n=this;"function"!=typeof t&&(t=ir(t));for(var e=n._groups,r=e.length,i=new Array(r),o=0;r>o;++o)for(var u,a=e[o],s=a.length,l=i[o]=new Array(s),c=0;s>c;++c)(u=a[c])&&t.call(u,u.__data__,c,a)&&(l[c]=u);return new Ce(i,this._parents,this._name,this._id)}function ce(t){var n=this;if(t._id!==this._id)throw new Error;for(var e=n._groups,r=t._groups,i=e.length,o=r.length,u=Math.min(i,o),a=new Array(i),s=0;u>s;++s)for(var l,c=e[s],f=r[s],h=c.length,p=a[s]=new Array(h),d=0;h>d;++d)(l=c[d]||f[d])&&(p[d]=l);for(;i>s;++s)a[s]=e[s];return new Ce(a,this._parents,this._name,this._id)}function fe(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 he(t,n,e){var r,i,o=fe(n)?Ut:Wt;return function(){var u=o(this,t),a=u.on;a!==r&&(i=(r=a).copy()).on(n,e),u.on=i}}function pe(t,n){var e=this._id;return arguments.length<2?Kt(this.node(),e).on.on(t):this.each(he(e,t,n))}function de(t){return function(){var n=this.parentNode;for(var e in this.__transition)if(+e!==t)return;n&&n.removeChild(this)}}function ye(){return this.on("end.remove",de(this._id))}function ve(t){var n=this,e=this._name,r=this._id;"function"!=typeof t&&(t=h(t));for(var i=n._groups,o=i.length,u=new Array(o),a=0;o>a;++a)for(var s,l,c=i[a],f=c.length,p=u[a]=new Array(f),d=0;f>d;++d)(s=c[d])&&(l=t.call(s,s.__data__,d,c))&&("__data__"in s&&(l.__data__=s.__data__),p[d]=l,Ft(p[d],e,r,d,p,Kt(s,r)));return new Ce(u,this._parents,e,r)}function ge(t){var n=this,e=this._name,r=this._id;"function"!=typeof t&&(t=d(t));for(var i=n._groups,o=i.length,u=[],a=[],s=0;o>s;++s)for(var l,c=i[s],f=c.length,h=0;f>h;++h)if(l=c[h]){for(var p,y=t.call(l,l.__data__,h,c),v=Kt(l,r),g=0,m=y.length;m>g;++g)(p=y[g])&&Ft(p,e,r,g,y,v);u.push(y),a.push(l)}return new Ce(u,a,e,r)}function me(){return new vi(this._groups,this._parents)}function _e(t,n){var e,r,i;return function(){var o=f(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 we(t){return function(){this.style.removeProperty(t)}}function be(t,n,e){var r,i;return function(){var o=f(this).getComputedStyle(this,null).getPropertyValue(t);return o===e?null:o===r?i:i=n(r=o,e)}}function xe(t,n,e){var r,i,o;return function(){var u=f(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 Me(t,n,e){var r="transform"==(t+="")?di:Bn;return null==n?this.styleTween(t,_e(t,r)).on("end.style."+t,we(t)):this.styleTween(t,"function"==typeof n?xe(t,r,Yn(this,"style."+t,n)):be(t,r,n),e)}function Ae(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 Ne(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,Ae(t,n,null==e?"":e))}function ke(t){return function(){this.textContent=t}}function Ee(t){return function(){var n=t(this);this.textContent=null==n?"":n}}function Se(t){return this.tween("text","function"==typeof t?Ee(Yn(this,"text",t)):ke(null==t?"":t+""))}function Pe(){for(var t=this,n=this._name,e=this._id,r=ze(),i=t._groups,o=i.length,u=0;o>u;++u)for(var a,s=i[u],l=s.length,c=0;l>c;++c)if(a=s[c]){var f=Kt(a,e);Ft(a,n,r,c,s,{time:f.time+f.delay+f.duration,delay:0,duration:f.duration,ease:f.ease})}return new Ce(i,this._parents,n,r)}function Ce(t,n,e,r){this._groups=t,this._parents=n,this._name=e,this._id=r}function qe(t){return Pt().transition(t)}function ze(){return++gi}function Te(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}function Ie(t,n){for(var e;!(e=t.__transition)||!(e=e[n]);)if(!(t=t.parentNode))return Ai.time=Ot(),Ai;return e}function Xe(t){var n,e,r=this;t instanceof Ce?(n=t._id,t=t._name):(n=ze(),(e=Ai).time=Ot(),t=null==t?null:t+"");for(var i=r._groups,o=i.length,u=0;o>u;++u)for(var a,s=i[u],l=s.length,c=0;l>c;++c)(a=s[c])&&Ft(a,t,n,c,s,e||Ie(a,n));return new Ce(i,this._parents,t,n)}function Oe(t,n){return n>t?-1:t>n?1:t>=n?0:NaN}function Ve(t){return 1===t.length&&(t=je(t)),{left:function(n,e,r,i){for(null==r&&(r=0),null==i&&(i=n.length);i>r;){var o=r+i>>>1;t(n[o],e)<0?r=o+1:i=o}return r},right:function(n,e,r,i){for(null==r&&(r=0),null==i&&(i=n.length);i>r;){var o=r+i>>>1;t(n[o],e)>0?i=o:r=o+1}return r}}}function je(t){return function(n,e){return Oe(t(n),e)}}function Le(t,n){var e,r,i=-1,o=t.length;if(null==n){for(;++i<o;)if(null!=(r=t[i])&&r>=r){e=r;break}for(;++i<o;)null!=(r=t[i])&&r>e&&(e=r)}else{for(;++i<o;)if(null!=(r=n(t[i],i,t))&&r>=r){e=r;break}for(;++i<o;)null!=(r=n(t[i],i,t))&&r>e&&(e=r)}return e}function De(t,n){var e,r,i=-1,o=t.length;if(null==n){for(;++i<o;)if(null!=(r=t[i])&&r>=r){e=r;break}for(;++i<o;)null!=(r=t[i])&&e>r&&(e=r)}else{for(;++i<o;)if(null!=(r=n(t[i],i,t))&&r>=r){e=r;break}for(;++i<o;)null!=(r=n(t[i],i,t))&&e>r&&(e=r)}return e}function Re(t,n){var e,r=0,i=t.length,o=-1;if(null==n)for(;++o<i;)(e=+t[o])&&(r+=e);else for(;++o<i;)(e=+n(t[o],o,t))&&(r+=e);return r}function $e(t){return function(){return t}}function Ye(t,n){void 0===n&&(n={"font-size":10,"font-family":"sans-serif"});var e=document.createElement("canvas").getContext("2d"),r=[];if("font-style"in n&&r.push(n["font-style"]),"font-variant"in n&&r.push(n["font-variant"]),"font-weight"in n&&r.push(n["font-weight"]),"font-size"in n){var i=""+n["font-size"]+"px";"line-height"in n&&(i+="/"+n["line-height"]+"px"),r.push(i)}return"font-family"in n&&r.push(n["font-family"]),e.font=r.join(" "),t instanceof Array?t.map(function(t){return e.measureText(t).width}):e.measureText(t).width}function Be(t){return t.height||200}function He(t,n){return t.id||""+n}function Fe(t){return t.match(Ei)}function Ue(t){return t.text}function We(t){return t.width||200}function Ke(t){return t.x||0}function Ge(t){return t.y||0}function Je(t){function n(t){return""+t+"..."}function e(n){void 0===a&&e.select(Ni.select("body").append("svg").style("width",""+window.innerWidth+"px").style("height",""+window.innerHeight+"px").node());var A=a.selectAll(".d3plus-text-box").data(t,y);return A.exit().remove(),A.enter().append("text").attr("class","d3plus-text-box").attr("id",function(t,n){return"d3plus-text-box-"+y(t,n)}).merge(A).attr("y",function(t,n){return""+M(t,n)+"px"}).attr("fill",function(t,n){return r(t,n)}).attr("text-anchor",function(t,n){return _(t,n)}).attr("font-family",function(t,n){return i(t,n)}).each(function(t,n){function e(){if(N=1,k=[""],P>M)return void(k=[]);M>S&&(M=S);var t="",n=0;y&&(A=1.1*M,E["font-size"]=M,E["line-height"]=A),a=Ye(V,E);for(var r=0;r<V.length;r++){var i=V[r],o=T.charAt(t.length+i.length),u=a[V.indexOf(i)];if(" "===o&&(i+=o),n+u>O-M){if(N++,A*N>C||u>O&&!q){if(y){if(M--,P>M){k=[];break}e()}else k[N-2]=c(k[N-2].trimRight());break}n=0,k.push(i)}else k[N-1]+=i;t+=i,n+=u," "===o&&(n+=z)}}function r(e){e.text(function(t){return t.trimRight()}).attr("x",""+x(t,n)+"px").attr("dx",""+j+"px").attr("dy",""+A+"px")}var a,y=p(t,n),M=y?f(t,n):o(t,n),A=y?1.1*M:u(t,n),N=1,k=[""],E={"font-family":i(t,n),"font-size":M,"line-height":A},S=f(t,n),P=h(t,n),C=d(t,n),q=v(t,n),z=Ye(" ",E),T=m(t,n),I=_(t,n),X=w(t,n),O=b(t,n),V=g(T,n),j="start"===I?0:"end"===I?O:O/2;if(C>A||y){if(y){a=Ye(V,E);var L=1.165+O/C*.1,D=O*C,R=Ni.max(a),$=Ni.sum(a,function(t){return t*A})*L;if(R>O||$>D){var Y=Math.sqrt(D/$),B=O/R,H=Ni.min([Y,B]);M=Math.floor(M*H)}var F=Math.floor(.8*C);M>F&&(M=F)}e(),Ni.select(this).attr("font-size",""+M+"px").style("font-size",""+M+"px")}var U=N*A,W="top"===X?0:"middle"===X?C/2-U/2:C-U;W-=.2*A,Ni.select(this).transition().duration(l).attr("transform","translate(0,"+W+")");var K=Ni.select(this).selectAll("tspan").data(k);K.transition().duration(l).call(r),K.exit().transition().duration(l).attr("opacity",0).remove(),K.enter().append("tspan").attr("dominant-baseline","alphabetic").style("baseline-shift","0%").attr("opacity",0).call(r).transition().duration(l).delay(s).attr("opacity",1)}),n&&setTimeout(n,l+100),e}void 0===t&&(t=[]);var r,i,o,u,a,s=0,l=0,c=n,f=$e(50),h=$e(8),p=$e(!1),d=Be,y=He,v=$e(!1),g=Fe,m=Ue,_=$e("start"),w=$e("top"),b=We,x=Ke,M=Ge;return e.data=function(n){return arguments.length?(t=n,e):t},e.delay=function(t){return arguments.length?(s=t,e):s},e.duration=function(t){return arguments.length?(l=t,e):l},e.ellipsis=function(t){return arguments.length?(c="function"==typeof t?t:$e(t),e):c},e.fontColor=function(t){return arguments.length?(r="function"==typeof t?t:$e(t),e):r},e.fontFamily=function(t){return arguments.length?(i="function"==typeof t?t:$e(t),e):i},e.fontMax=function(t){return arguments.length?(f="function"==typeof t?t:$e(t),e):f},e.fontMin=function(t){return arguments.length?(h="function"==typeof t?t:$e(t),e):h},e.fontResize=function(t){return arguments.length?(p="function"==typeof t?t:$e(t),e):p},e.fontSize=function(t){return arguments.length?(o="function"==typeof t?t:$e(t),void 0===u&&(u=$e(Math.ceil(1.1*o()))),e):o},e.height=function(t){return arguments.length?(d="function"==typeof t?t:$e(t),e):d},e.id=function(t){return arguments.length?(y="function"==typeof t?t:$e(t),e):y},e.lineHeight=function(t){return arguments.length?(u="function"==typeof t?t:$e(t),e):u},e.overflow=function(t){return arguments.length?(v="function"==typeof t?t:$e(t),e):v},e.select=function(t){return arguments.length?(a=Ni.select(t),void 0===r&&e.fontColor(a.style("font-color")),void 0===i&&e.fontFamily(a.style("font-family")),void 0===o&&e.fontSize(parseFloat(a.style("font-size"),10)),e):a},e.split=function(t){return arguments.length?(g=t,e):g},e.text=function(t){return arguments.length?(m="function"==typeof t?t:$e(t), | ||
e):m},e.textAnchor=function(t){return arguments.length?(_="function"==typeof t?t:$e(t),e):_},e.verticalAlign=function(t){return arguments.length?(w="function"==typeof t?t:$e(t),e):w},e.width=function(t){return arguments.length?(b="function"==typeof t?t:$e(t),e):b},e.x=function(t){return arguments.length?(x="function"==typeof t?t:$e(t),e):x},e.y=function(t){return arguments.length?(M="function"==typeof t?t:$e(t),e):M},t.length?e():e}var Qe="0.4.2",Ze="http://www.w3.org/1999/xhtml",tr={svg:"http://www.w3.org/2000/svg",xhtml:Ze,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},nr=function(t){return function(){return this.matches(t)}};if("undefined"!=typeof document){var er=document.documentElement;if(!er.matches){var rr=er.webkitMatchesSelector||er.msMatchesSelector||er.mozMatchesSelector||er.oMatchesSelector;nr=function(t){return function(){return rr.call(this,t)}}}}var ir=nr,or={},ur=null;if("undefined"!=typeof document){var ar=document.documentElement;"onmouseenter"in ar||(or={mouseenter:"mouseover",mouseleave:"mouseout"})}var sr="$";b.prototype={constructor:b,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)}},Q.prototype={add:function(t){var n=this._names.indexOf(t);0>n&&(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 lr=[null];St.prototype=Pt.prototype={constructor:St,select:p,selectAll:y,filter:v,data:w,enter:M,exit:A,merge:N,order:k,sort:E,call:P,nodes:C,node:q,size:z,empty:T,each:I,attr:R,style:H,property:K,classed:it,text:st,html:ht,raise:dt,lower:vt,append:wt,remove:xt,datum:Mt,on:c,dispatch:Et};var cr=("undefined"!=typeof navigator&&/WebKit/.test(navigator.userAgent)?-1:0,{value:function(){}});zt.prototype=qt.prototype={constructor:zt,on:function(t,n){var e,r=this._,i=Tt(t+"",r),o=-1,u=i.length;{if(!(arguments.length<2)){if(null!=n&&"function"!=typeof n)throw new Error;for(;++o<u;)if(e=(t=i[o]).type)r[e]=Xt(r[e],t.name,n);else if(null==n)for(e in r)r[e]=Xt(r[e],t.name,null);return this}for(;++o<u;)if((e=(t=i[o]).type)&&(e=It(r[e],t.name)))return e}},copy:function(){var t={},n=this._;for(var e in n)t[e]=n[e].slice();return new zt(t)},call:function(t,n){var e=arguments;if((r=arguments.length-2)>0)for(var r,i=new Array(r),o=0;r>o;++o)i[o]=e[o+2];this.apply(t,n,i)},apply:function(t,n,e){var r=this;if(!this._.hasOwnProperty(t))throw new Error;for(var i=r._[t],o=0,u=i.length;u>o;++o)i[o].value.apply(n,e)}};var fr,hr,pr=0,dr=0,yr=0,vr=1e3,gr=0,mr=0,_r=0,wr="object"==typeof performance?performance:Date,br="function"==typeof requestAnimationFrame?requestAnimationFrame:function(t){return setTimeout(t,17)};jt.prototype=Lt.prototype={constructor:jt,restart:function(t,n,e){if("function"!=typeof t)throw new TypeError("callback is not a function");e=(null==e?Ot():+e)+(null==n?0:+n),this._call||(hr?hr._next=this:fr=this,hr=this),this._call=t,this._time=e,Bt()},stop:function(){this._call&&(this._call=null,this._time=1/0,Bt())}};var xr=qt("start","end","interrupt"),Mr=[],Ar=0,Nr=1,kr=2,Er=3,Sr=4,Pr=5,Cr=.7,qr=1/Cr,zr=/^#([0-9a-f]{3})$/,Tr=/^#([0-9a-f]{6})$/,Ir=/^rgb\(\s*([-+]?\d+)\s*,\s*([-+]?\d+)\s*,\s*([-+]?\d+)\s*\)$/,Xr=/^rgb\(\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*\)$/,Or=/^rgba\(\s*([-+]?\d+)\s*,\s*([-+]?\d+)\s*,\s*([-+]?\d+)\s*,\s*([-+]?\d+(?:\.\d+)?)\s*\)$/,Vr=/^rgba\(\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)\s*\)$/,jr=/^hsl\(\s*([-+]?\d+(?:\.\d+)?)\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*\)$/,Lr=/^hsla\(\s*([-+]?\d+(?:\.\d+)?)\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)\s*\)$/,Dr={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};Qt(tn,nn,{displayable:function(){return this.rgb().displayable()},toString:function(){return this.rgb()+""}}),Qt(an,un,Zt(tn,{brighter:function(t){return t=null==t?qr:Math.pow(qr,t),new an(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?Cr:Math.pow(Cr,t),new an(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+")")}})),Qt(fn,cn,Zt(tn,{brighter:function(t){return t=null==t?qr:Math.pow(qr,t),new fn(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?Cr:Math.pow(Cr,t),new fn(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+(.5>e?e:1-e)*n,i=2*e-r;return new an(hn(t>=240?t-240:t+120,i,r),hn(t,i,r),hn(120>t?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 Rr=Math.PI/180,$r=180/Math.PI,Yr=18,Br=.95047,Hr=1,Fr=1.08883,Ur=4/29,Wr=6/29,Kr=3*Wr*Wr,Gr=Wr*Wr*Wr;Qt(yn,dn,Zt(tn,{brighter:function(t){return new yn(this.l+Yr*(null==t?1:t),this.a,this.b,this.opacity)},darker:function(t){return new yn(this.l-Yr*(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=Hr*gn(t),n=Br*gn(n),e=Fr*gn(e),new an(mn(3.2404542*n-1.5371385*t-.4985314*e),mn(-.969266*n+1.8760108*t+.041556*e),mn(.0556434*n-.2040259*t+1.0572252*e),this.opacity)}})),Qt(xn,bn,Zt(tn,{brighter:function(t){return new xn(this.h,this.c,this.l+Yr*(null==t?1:t),this.opacity)},darker:function(t){return new xn(this.h,this.c,this.l-Yr*(null==t?1:t),this.opacity)},rgb:function(){return pn(this).rgb()}}));var Jr=-.14861,Qr=1.78277,Zr=-.29227,ti=-.90649,ni=1.97294,ei=ni*ti,ri=ni*Qr,ii=Qr*Zr-ti*Jr;Qt(Nn,An,Zt(tn,{brighter:function(t){return t=null==t?qr:Math.pow(qr,t),new Nn(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?Cr:Math.pow(Cr,t),new Nn(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=isNaN(this.h)?0:(this.h+120)*Rr,n=+this.l,e=isNaN(this.s)?0:this.s*n*(1-n),r=Math.cos(t),i=Math.sin(t);return new an(255*(n+e*(Jr*r+Qr*i)),255*(n+e*(Zr*r+ti*i)),255*(n+e*(ni*r)),this.opacity)}}));var oi,ui,ai,si,li=function Si(t){function n(t,n){var r=e((t=un(t)).r,(n=un(n)).r),i=e(t.g,n.g),o=e(t.b,n.b),u=e(t.opacity,n.opacity);return function(n){return t.r=r(n),t.g=i(n),t.b=o(n),t.opacity=u(n),t+""}}var e=Cn(t);return n.gamma=Si,n}(1),ci=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,fi=new RegExp(ci.source,"g"),hi=180/Math.PI,pi={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1},di=Ln(Vn,"px, ","px)","deg)"),yi=Ln(jn,", ",")",")");!function Pi(t){function n(n,e){var r=Pn((n=An(n)).h,(e=An(e)).h),i=qn(n.s,e.s),o=qn(n.l,e.l),u=qn(n.opacity,e.opacity);return function(e){return n.h=r(e),n.s=i(e),n.l=o(Math.pow(e,t)),n.opacity=u(e),n+""}}return t=+t,n.gamma=Pi,n}(1),function Ci(t){function n(n,e){var r=qn((n=An(n)).h,(e=An(e)).h),i=qn(n.s,e.s),o=qn(n.l,e.l),u=qn(n.opacity,e.opacity);return function(e){return n.h=r(e),n.s=i(e),n.l=o(Math.pow(e,t)),n.opacity=u(e),n+""}}return t=+t,n.gamma=Ci,n}(1);var vi=Pt.prototype.constructor,gi=0,mi=Pt.prototype;Ce.prototype=qe.prototype={constructor:Ce,select:ve,selectAll:ge,filter:le,merge:ce,selection:me,transition:Pe,call:mi.call,nodes:mi.nodes,node:mi.node,size:mi.size,empty:mi.empty,each:mi.each,on:pe,attr:Jn,attrTween:te,style:Me,styleTween:Ne,text:Se,remove:ye,tween:$n,delay:re,duration:ue,ease:se};var _i=3,wi=(function qi(t){function n(n){return Math.pow(n,t)}return t=+t,n.exponent=qi,n}(_i),function zi(t){function n(n){return 1-Math.pow(1-n,t)}return t=+t,n.exponent=zi,n}(_i),function Ti(t){function n(n){return((n*=2)<=1?Math.pow(n,t):2-Math.pow(2-n,t))/2}return t=+t,n.exponent=Ti,n}(_i),1.70158),bi=(function Ii(t){function n(n){return n*n*((t+1)*n-t)}return t=+t,n.overshoot=Ii,n}(wi),function Xi(t){function n(n){return--n*n*((t+1)*n+t)+1}return t=+t,n.overshoot=Xi,n}(wi),function Oi(t){function n(n){return((n*=2)<1?n*n*((t+1)*n-t):(n-=2)*n*((t+1)*n+t)+2)/2}return t=+t,n.overshoot=Oi,n}(wi),2*Math.PI),xi=1,Mi=.3,Ai=(function Vi(t,n){function e(e){return t*Math.pow(2,10*--e)*Math.sin((r-e)/n)}var r=Math.asin(1/(t=Math.max(1,t)))*(n/=bi);return e.amplitude=function(t){return Vi(t,n*bi)},e.period=function(n){return Vi(t,n)},e}(xi,Mi),function ji(t,n){function e(e){return 1-t*Math.pow(2,-10*(e=+e))*Math.sin((e+r)/n)}var r=Math.asin(1/(t=Math.max(1,t)))*(n/=bi);return e.amplitude=function(t){return ji(t,n*bi)},e.period=function(n){return ji(t,n)},e}(xi,Mi),function Li(t,n){function e(e){return((e=2*e-1)<0?t*Math.pow(2,10*e)*Math.sin((r-e)/n):2-t*Math.pow(2,-10*e)*Math.sin((r+e)/n))/2}var r=Math.asin(1/(t=Math.max(1,t)))*(n/=bi);return e.amplitude=function(t){return Li(t,n*bi)},e.period=function(n){return Li(t,n)},e}(xi,Mi),{time:null,delay:0,duration:250,ease:Te});Pt.prototype.interrupt=Jt,Pt.prototype.transition=Xe;var Ni=(Ve(Oe),{max:Le,min:De,select:Ct,sum:Re,transition:qe}),ki=["-","/",";",":","&"],Ei=new RegExp("[^\\s\\"+ki.join("\\")+"]+\\"+ki.join("?\\")+"?","g");t.version=Qe,t.box=Je,t.width=Ye}); | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define("d3plus-text",["exports"],n):n(t.d3plus_text=t.d3plus_text||{})}(this,function(t){"use strict";function n(t){var n=t+="",e=n.indexOf(":");return e>=0&&"xmlns"!==(n=t.slice(0,e))&&(t=t.slice(e+1)),tr.hasOwnProperty(n)?{space:tr[n],local:t}:t}function e(t){return function(){var n=this.ownerDocument,e=this.namespaceURI;return e===Ze&&n.documentElement.namespaceURI===Ze?n.createElement(t):n.createElementNS(e,t)}}function r(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function i(t){var i=n(t);return(i.local?r:e)(i)}function o(t,n,e){return t=u(t,n,e),function(n){var e=n.relatedTarget;e&&(e===this||8&e.compareDocumentPosition(this))||t.call(this,n)}}function u(t,n,e){return function(r){var i=ur;ur=r;try{t.call(this,this.__data__,n,e)}finally{ur=i}}}function a(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 s(t){return function(){var n=this,e=this.__on;if(e){for(var r,i=0,o=-1,u=e.length;u>i;++i)r=e[i],t.type&&r.type!==t.type||r.name!==t.name?e[++o]=r:n.removeEventListener(r.type,r.listener,r.capture);++o?e.length=o:delete this.__on}}}function l(t,n,e){var r=or.hasOwnProperty(t.type)?o:u;return function(i,o,u){var a,s=this,l=this.__on,c=r(n,o,u);if(l)for(var f=0,h=l.length;h>f;++f)if((a=l[f]).type===t.type&&a.name===t.name)return s.removeEventListener(a.type,a.listener,a.capture),s.addEventListener(a.type,a.listener=c,a.capture=e),void(a.value=n);this.addEventListener(t.type,c,e),a={type:t.type,name:t.name,value:n,listener:c,capture:e},l?l.push(a):this.__on=[a]}}function c(t,n,e){var r,i,o=this,u=a(t+""),c=u.length;if(!(arguments.length<2)){for(f=n?l:s,null==e&&(e=!1),r=0;c>r;++r)o.each(f(u[r],n,e));return this}var f=this.node().__on;if(f)for(var h,p=0,d=f.length;d>p;++p)for(r=0,h=f[p];c>r;++r)if((i=u[r]).type===h.type&&i.name===h.name)return h.value}function f(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function h(t){return function(){return this.querySelector(t)}}function p(t){var n=this;"function"!=typeof t&&(t=h(t));for(var e=n._groups,r=e.length,i=new Array(r),o=0;r>o;++o)for(var u,a,s=e[o],l=s.length,c=i[o]=new Array(l),f=0;l>f;++f)(u=s[f])&&(a=t.call(u,u.__data__,f,s))&&("__data__"in u&&(a.__data__=u.__data__),c[f]=a);return new St(i,this._parents)}function d(t){return function(){return this.querySelectorAll(t)}}function y(t){var n=this;"function"!=typeof t&&(t=d(t));for(var e=n._groups,r=e.length,i=[],o=[],u=0;r>u;++u)for(var a,s=e[u],l=s.length,c=0;l>c;++c)(a=s[c])&&(i.push(t.call(a,a.__data__,c,s)),o.push(a));return new St(i,o)}function v(t){var n=this;"function"!=typeof t&&(t=ir(t));for(var e=n._groups,r=e.length,i=new Array(r),o=0;r>o;++o)for(var u,a=e[o],s=a.length,l=i[o]=new Array(s),c=0;s>c;++c)(u=a[c])&&t.call(u,u.__data__,c,a)&&(l[c]=u);return new St(i,this._parents)}function g(t){return function(){return t}}function m(t,n,e,r,i,o){for(var u,a=0,s=n.length,l=o.length;l>a;++a)(u=n[a])?(u.__data__=o[a],r[a]=u):e[a]=new b(t,o[a]);for(;s>a;++a)(u=n[a])&&(i[a]=u)}function _(t,n,e,r,i,o,u){var a,s,l,c={},f=n.length,h=o.length,p=new Array(f);for(a=0;f>a;++a)(s=n[a])&&(p[a]=l=sr+u.call(s,s.__data__,a,n),c[l]||(c[l]=s));for(a=0;h>a;++a)l=sr+u.call(t,o[a],a,o),(s=c[l])?s!==!0&&(r[a]=s,s.__data__=o[a]):e[a]=new b(t,o[a]),c[l]=!0;for(a=0;f>a;++a)(s=n[a])&&c[p[a]]!==!0&&(i[a]=s)}function w(t,n){if(!t)return p=new Array(this.size()),l=-1,this.each(function(t){p[++l]=t}),p;var e=n?_:m,r=this._parents,i=this._groups;"function"!=typeof t&&(t=g(t));for(var o=i.length,u=new Array(o),a=new Array(o),s=new Array(o),l=0;o>l;++l){var c=r[l],f=i[l],h=f.length,p=t.call(c,c&&c.__data__,l,r),d=p.length,y=a[l]=new Array(d),v=u[l]=new Array(d),w=s[l]=new Array(h);e(c,f,y,v,w,p,n);for(var b,x,M=0,A=0;d>M;++M)if(b=y[M]){for(M>=A&&(A=M+1);!(x=v[A])&&++A<d;);b._next=x||null}}return u=new St(u,r),u._enter=a,u._exit=s,u}function b(t,n){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=n}function x(t){return new Array(t.length)}function M(){return new St(this._enter||this._groups.map(x),this._parents)}function A(){return new St(this._exit||this._groups.map(x),this._parents)}function N(t){for(var n=this,e=n._groups,r=t._groups,i=e.length,o=r.length,u=Math.min(i,o),a=new Array(i),s=0;u>s;++s)for(var l,c=e[s],f=r[s],h=c.length,p=a[s]=new Array(h),d=0;h>d;++d)(l=c[d]||f[d])&&(p[d]=l);for(;i>s;++s)a[s]=e[s];return new St(a,this._parents)}function k(){for(var t=this,n=t._groups,e=-1,r=n.length;++e<r;)for(var i,o=n[e],u=o.length-1,a=o[u];--u>=0;)(i=o[u])&&(a&&a!==i.nextSibling&&a.parentNode.insertBefore(i,a),a=i);return this}function E(t){function n(n,e){return n&&e?t(n.__data__,e.__data__):!n-!e}var e=this;t||(t=S);for(var r=e._groups,i=r.length,o=new Array(i),u=0;i>u;++u){for(var a,s=r[u],l=s.length,c=o[u]=new Array(l),f=0;l>f;++f)(a=s[f])&&(c[f]=a);c.sort(n)}return new St(o,this._parents).order()}function S(t,n){return n>t?-1:t>n?1:t>=n?0:NaN}function P(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function C(){var t=new Array(this.size()),n=-1;return this.each(function(){t[++n]=this}),t}function q(){for(var t=this,n=t._groups,e=0,r=n.length;r>e;++e)for(var i=n[e],o=0,u=i.length;u>o;++o){var a=i[o];if(a)return a}return null}function z(){var t=0;return this.each(function(){++t}),t}function T(){return!this.node()}function I(t){for(var n=this,e=n._groups,r=0,i=e.length;i>r;++r)for(var o,u=e[r],a=0,s=u.length;s>a;++a)(o=u[a])&&t.call(o,o.__data__,a,u);return this}function X(t){return function(){this.removeAttribute(t)}}function O(t){return function(){this.removeAttributeNS(t.space,t.local)}}function V(t,n){return function(){this.setAttribute(t,n)}}function j(t,n){return function(){this.setAttributeNS(t.space,t.local,n)}}function L(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttribute(t):this.setAttribute(t,e)}}function R(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 D(t,e){var r=n(t);if(arguments.length<2){var i=this.node();return r.local?i.getAttributeNS(r.space,r.local):i.getAttribute(r)}return this.each((null==e?r.local?O:X:"function"==typeof e?r.local?R:L:r.local?j:V)(r,e))}function $(t){return function(){this.style.removeProperty(t)}}function Y(t,n,e){return function(){this.style.setProperty(t,n,e)}}function B(t,n,e){return function(){var r=n.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,e)}}function H(t,n,e){var r;return arguments.length>1?this.each((null==n?$:"function"==typeof n?B:Y)(t,n,null==e?"":e)):f(r=this.node()).getComputedStyle(r,null).getPropertyValue(t)}function F(t){return function(){delete this[t]}}function U(t,n){return function(){this[t]=n}}function W(t,n){return function(){var e=n.apply(this,arguments);null==e?delete this[t]:this[t]=e}}function K(t,n){return arguments.length>1?this.each((null==n?F:"function"==typeof n?W:U)(t,n)):this.node()[t]}function G(t){return t.trim().split(/^|\s+/)}function J(t){return t.classList||new Q(t)}function Q(t){this._node=t,this._names=G(t.getAttribute("class")||"")}function Z(t,n){for(var e=J(t),r=-1,i=n.length;++r<i;)e.add(n[r])}function tt(t,n){for(var e=J(t),r=-1,i=n.length;++r<i;)e.remove(n[r])}function nt(t){return function(){Z(this,t)}}function et(t){return function(){tt(this,t)}}function rt(t,n){return function(){(n.apply(this,arguments)?Z:tt)(this,t)}}function it(t,n){var e=G(t+"");if(arguments.length<2){for(var r=J(this.node()),i=-1,o=e.length;++i<o;)if(!r.contains(e[i]))return!1;return!0}return this.each(("function"==typeof n?rt:n?nt:et)(e,n))}function ot(){this.textContent=""}function ut(t){return function(){this.textContent=t}}function at(t){return function(){var n=t.apply(this,arguments);this.textContent=null==n?"":n}}function st(t){return arguments.length?this.each(null==t?ot:("function"==typeof t?at:ut)(t)):this.node().textContent}function lt(){this.innerHTML=""}function ct(t){return function(){this.innerHTML=t}}function ft(t){return function(){var n=t.apply(this,arguments);this.innerHTML=null==n?"":n}}function ht(t){return arguments.length?this.each(null==t?lt:("function"==typeof t?ft:ct)(t)):this.node().innerHTML}function pt(){this.parentNode.appendChild(this)}function dt(){return this.each(pt)}function yt(){this.parentNode.insertBefore(this,this.parentNode.firstChild)}function vt(){return this.each(yt)}function gt(t){return function(){return this.appendChild(t.apply(this,arguments))}}function mt(t,n){return function(){return this.insertBefore(t.apply(this,arguments),n.apply(this,arguments)||null)}}function _t(){return null}function wt(t,n){var e="function"==typeof t?t:i(t);return this.select(arguments.length<2?gt(e):mt(e,null==n?_t:"function"==typeof n?n:h(n)))}function bt(){var t=this.parentNode;t&&t.removeChild(this)}function xt(){return this.each(bt)}function Mt(t){return arguments.length?this.property("__data__",t):this.node().__data__}function At(t,n,e){var r=f(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 Nt(t,n){return function(){return At(this,t,n)}}function kt(t,n){return function(){return At(this,t,n.apply(this,arguments))}}function Et(t,n){return this.each(("function"==typeof n?kt:Nt)(t,n))}function St(t,n){this._groups=t,this._parents=n}function Pt(){return new St([[document.documentElement]],lr)}function Ct(t){return"string"==typeof t?new St([[document.querySelector(t)]],[document.documentElement]):new St([[t]],lr)}function qt(){for(var t,n=arguments,e=0,r=n.length,i={};r>e;++e){if(!(t=n[e]+"")||t in i)throw new Error;i[t]=[]}return new zt(i)}function zt(t){this._=t}function Tt(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;return{type:t,name:e}})}function It(t,n){for(var e,r=0,i=t.length;i>r;++r)if((e=t[r]).name===n)return e.value}function Xt(t,n,e){for(var r=0,i=t.length;i>r;++r)if(t[r].name===n){t[r]=cr,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=e&&t.push({name:n,value:e}),t}function Ot(){return mr||(br(Vt),mr=wr.now()+_r)}function Vt(){mr=0}function jt(){this._call=this._time=this._next=null}function Lt(t,n,e){var r=new jt;return r.restart(t,n,e),r}function Rt(){Ot(),++pr;for(var t,n=fr;n;)(t=mr-n._time)>=0&&n._call.call(null,t),n=n._next;--pr}function Dt(t){mr=(gr=t||wr.now())+_r,pr=dr=0;try{Rt()}finally{pr=0,Yt(),mr=0}}function $t(){var t=wr.now(),n=t-gr;n>vr&&(_r-=n,gr=t)}function Yt(){for(var t,n=fr,e=1/0;n;)n._call?(e>n._time&&(e=n._time),n=(t=n)._next):n=t?t._next=n._next:fr=n._next;hr=t,Bt(e)}function Bt(t){if(!pr){dr&&(dr=clearTimeout(dr));var n=t-mr;n>24?(1/0>t&&(dr=setTimeout(Dt,n)),yr&&(yr=clearInterval(yr))):(yr||(yr=setInterval($t,vr)),pr=1,br(Dt))}}function Ht(t,n,e){var r=new jt;return n=null==n?0:+n,r.restart(function(e){r.stop(),t(e+n)},n,e),r}function Ft(t,n,e,r,i,o){var u=t.__transition;if(u){if(e in u)return}else t.__transition={};Gt(t,e,{name:n,index:r,group:i,on:xr,tween:Mr,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:Ar})}function Ut(t,n){var e=t.__transition;if(!e||!(e=e[n])||e.state>Ar)throw new Error("too late");return e}function Wt(t,n){var e=t.__transition;if(!e||!(e=e[n])||e.state>kr)throw new Error("too late");return e}function Kt(t,n){var e=t.__transition;if(!e||!(e=e[n]))throw new Error("too late");return e}function Gt(t,n,e){function r(t){e.state=Nr,e.delay<=t?i(t-e.delay):e.timer.restart(i,e.delay,e.time)}function i(r){var i,s,l,c;for(i in a)c=a[i],c.name===e.name&&(c.state===Er?(c.state=Pr,c.timer.stop(),c.on.call("interrupt",t,t.__data__,c.index,c.group),delete a[i]):n>+i&&(c.state=Pr,c.timer.stop(),delete a[i]));if(Ht(function(){e.state===Er&&(e.timer.restart(o,e.delay,e.time),o(r))}),e.state=kr,e.on.call("start",t,t.__data__,e.index,e.group),e.state===kr){for(e.state=Er,u=new Array(l=e.tween.length),i=0,s=-1;l>i;++i)(c=e.tween[i].value.call(t,t.__data__,e.index,e.group))&&(u[++s]=c);u.length=s+1}}function o(r){for(var i=r<e.duration?e.ease.call(null,r/e.duration):(e.state=Sr,1),o=-1,s=u.length;++o<s;)u[o].call(null,i);if(e.state===Sr){e.state=Pr,e.timer.stop(),e.on.call("end",t,t.__data__,e.index,e.group);for(o in a)if(+o!==n)return void delete a[n];delete t.__transition}}var u,a=t.__transition;a[n]=e,e.timer=Lt(r,0,e.time)}function Jt(t){return t=null==t?null:t+"",this.each(function(){var n,e,r,i=this.__transition,o=!0;if(i){for(r in i)(n=i[r]).name===t?(e=n.state===Er,n.state=Pr,n.timer.stop(),e&&n.on.call("interrupt",this,this.__data__,n.index,n.group),delete i[r]):o=!1;o&&delete this.__transition}})}function Qt(t,n,e){t.prototype=n.prototype=e,e.constructor=t}function Zt(t,n){var e=Object.create(t.prototype);for(var r in n)e[r]=n[r];return e}function tn(){}function nn(t){var n;return t=(t+"").trim().toLowerCase(),(n=zr.exec(t))?(n=parseInt(n[1],16),new an(n>>8&15|n>>4&240,n>>4&15|240&n,(15&n)<<4|15&n,1)):(n=Tr.exec(t))?en(parseInt(n[1],16)):(n=Ir.exec(t))?new an(n[1],n[2],n[3],1):(n=Xr.exec(t))?new an(255*n[1]/100,255*n[2]/100,255*n[3]/100,1):(n=Or.exec(t))?rn(n[1],n[2],n[3],n[4]):(n=Vr.exec(t))?rn(255*n[1]/100,255*n[2]/100,255*n[3]/100,n[4]):(n=jr.exec(t))?sn(n[1],n[2]/100,n[3]/100,1):(n=Lr.exec(t))?sn(n[1],n[2]/100,n[3]/100,n[4]):Rr.hasOwnProperty(t)?en(Rr[t]):"transparent"===t?new an(NaN,NaN,NaN,0):null}function en(t){return new an(t>>16&255,t>>8&255,255&t,1)}function rn(t,n,e,r){return 0>=r&&(t=n=e=NaN),new an(t,n,e,r)}function on(t){return t instanceof tn||(t=nn(t)),t?(t=t.rgb(),new an(t.r,t.g,t.b,t.opacity)):new an}function un(t,n,e,r){return 1===arguments.length?on(t):new an(t,n,e,null==r?1:r)}function an(t,n,e,r){this.r=+t,this.g=+n,this.b=+e,this.opacity=+r}function sn(t,n,e,r){return 0>=r?t=n=e=NaN:0>=e||e>=1?t=n=NaN:0>=n&&(t=NaN),new fn(t,n,e,r)}function ln(t){if(t instanceof fn)return new fn(t.h,t.s,t.l,t.opacity);if(t instanceof tn||(t=nn(t)),!t)return new fn;if(t instanceof fn)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*(r>e):e===o?(r-n)/a+2:(n-e)/a+4,a/=.5>s?o+i:2-o-i,u*=60):a=s>0&&1>s?0:u,new fn(u,a,s,t.opacity)}function cn(t,n,e,r){return 1===arguments.length?ln(t):new fn(t,n,e,null==r?1:r)}function fn(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function hn(t,n,e){return 255*(60>t?n+(e-n)*t/60:180>t?e:240>t?n+(e-n)*(240-t)/60:n)}function pn(t){if(t instanceof yn)return new yn(t.l,t.a,t.b,t.opacity);if(t instanceof xn){var n=t.h*Dr;return new yn(t.l,Math.cos(n)*t.c,Math.sin(n)*t.c,t.opacity)}t instanceof an||(t=on(t));var e=_n(t.r),r=_n(t.g),i=_n(t.b),o=vn((.4124564*e+.3575761*r+.1804375*i)/Br),u=vn((.2126729*e+.7151522*r+.072175*i)/Hr),a=vn((.0193339*e+.119192*r+.9503041*i)/Fr);return new yn(116*u-16,500*(o-u),200*(u-a),t.opacity)}function dn(t,n,e,r){return 1===arguments.length?pn(t):new yn(t,n,e,null==r?1:r)}function yn(t,n,e,r){this.l=+t,this.a=+n,this.b=+e,this.opacity=+r}function vn(t){return t>Gr?Math.pow(t,1/3):t/Kr+Ur}function gn(t){return t>Wr?t*t*t:Kr*(t-Ur)}function mn(t){return 255*(.0031308>=t?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function _n(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function wn(t){if(t instanceof xn)return new xn(t.h,t.c,t.l,t.opacity);t instanceof yn||(t=pn(t));var n=Math.atan2(t.b,t.a)*$r;return new xn(0>n?n+360:n,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}function bn(t,n,e,r){return 1===arguments.length?wn(t):new xn(t,n,e,null==r?1:r)}function xn(t,n,e,r){this.h=+t,this.c=+n,this.l=+e,this.opacity=+r}function Mn(t){if(t instanceof Nn)return new Nn(t.h,t.s,t.l,t.opacity);t instanceof an||(t=on(t));var n=t.r/255,e=t.g/255,r=t.b/255,i=(ii*r+ei*n-ri*e)/(ii+ei-ri),o=r-i,u=(ni*(e-i)-Zr*o)/ti,a=Math.sqrt(u*u+o*o)/(ni*i*(1-i)),s=a?Math.atan2(u,o)*$r-120:NaN;return new Nn(0>s?s+360:s,a,i,t.opacity)}function An(t,n,e,r){return 1===arguments.length?Mn(t):new Nn(t,n,e,null==r?1:r)}function Nn(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function kn(t){return function(){return t}}function En(t,n){return function(e){return t+e*n}}function Sn(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 Pn(t,n){var e=n-t;return e?En(t,e>180||-180>e?e-360*Math.round(e/360):e):kn(isNaN(t)?n:t)}function Cn(t){return 1===(t=+t)?qn:function(n,e){return e-n?Sn(n,e,t):kn(isNaN(n)?e:n)}}function qn(t,n){var e=n-t;return e?En(t,e):kn(isNaN(t)?n:t)}function zn(t,n){return t=+t,n-=t,function(e){return t+n*e}}function Tn(t){return function(){return t}}function In(t){return function(n){return t(n)+""}}function Xn(t,n){var e,r,i,o=ci.lastIndex=fi.lastIndex=0,u=-1,a=[],s=[];for(t+="",n+="";(e=ci.exec(t))&&(r=fi.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:zn(e,r)})),o=fi.lastIndex;return o<n.length&&(i=n.slice(o),a[u]?a[u]+=i:a[++u]=i),a.length<2?s[0]?In(s[0].x):Tn(n):(n=s.length,function(t){for(var e,r=0;n>r;++r)a[(e=s[r]).i]=e.x(t);return a.join("")})}function On(t,n,e,r,i,o){if(t*r===n*e)return null;var u=Math.sqrt(t*t+n*n);t/=u,n/=u;var a=t*e+n*r;e-=t*a,r-=n*a;var s=Math.sqrt(e*e+r*r);return e/=s,r/=s,a/=s,n*e>t*r&&(t=-t,n=-n,a=-a,u=-u),{translateX:i,translateY:o,rotate:Math.atan2(n,t)*hi,skewX:Math.atan(a)*hi,scaleX:u,scaleY:s}}function Vn(t){if("none"===t)return pi;oi||(oi=document.createElement("DIV"),ui=document.documentElement,ai=document.defaultView),oi.style.transform=t,t=ai.getComputedStyle(ui.appendChild(oi),null).getPropertyValue("transform"),ui.removeChild(oi);var n=t.slice(7,-1).split(",");return On(+n[0],+n[1],+n[2],+n[3],+n[4],+n[5])}function jn(t){si||(si=document.createElementNS("http://www.w3.org/2000/svg","g")),si.setAttribute("transform",null==t?"":t);var n=si.transform.baseVal.consolidate().matrix;return On(n.a,n.b,n.c,n.d,n.e,n.f)}function Ln(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:zn(t,i)},{i:s-2,x:zn(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:zn(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:zn(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:zn(t,e)},{i:a-2,x:zn(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 Rn(t,n){var e,r;return function(){var i=Wt(this,t),o=i.tween;if(o!==e){r=e=o;for(var u=0,a=r.length;a>u;++u)if(r[u].name===n){r=r.slice(),r.splice(u,1);break}}i.tween=r}}function Dn(t,n,e){var r,i;if("function"!=typeof e)throw new Error;return function(){var o=Wt(this,t),u=o.tween;if(u!==r){i=(r=u).slice();for(var a={name:n,value:e},s=0,l=i.length;l>s;++s)if(i[s].name===n){i[s]=a;break}s===l&&i.push(a)}o.tween=i}}function $n(t,n){var e=this._id;if(t+="",arguments.length<2){for(var r,i=Kt(this.node(),e).tween,o=0,u=i.length;u>o;++o)if((r=i[o]).name===t)return r.value;return null}return this.each((null==n?Rn:Dn)(e,t,n))}function Yn(t,n,e){var r=t._id;return t.each(function(){var t=Wt(this,r);(t.value||(t.value={}))[n]=e.apply(this,arguments)}),function(t){return Kt(t,r).value[n]}}function Bn(t,n){var e;return("number"==typeof n?zn:n instanceof nn?li:(e=nn(n))?(n=e,li):Xn)(t,n)}function Hn(t){return function(){this.removeAttribute(t)}}function Fn(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Un(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 Wn(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 Kn(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 Gn(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 Jn(t,e){var r=n(t),i="transform"===r?yi:Bn;return this.attrTween(t,"function"==typeof e?(r.local?Gn:Kn)(r,i,Yn(this,"attr."+t,e)):null==e?(r.local?Fn:Hn)(r):(r.local?Wn:Un)(r,i,e))}function Qn(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 Zn(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 te(t,e){var r="attr."+t;if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==e)return this.tween(r,null);if("function"!=typeof e)throw new Error;var i=n(t);return this.tween(r,(i.local?Qn:Zn)(i,e))}function ne(t,n){return function(){Ut(this,t).delay=+n.apply(this,arguments)}}function ee(t,n){return n=+n,function(){Ut(this,t).delay=n}}function re(t){var n=this._id;return arguments.length?this.each(("function"==typeof t?ne:ee)(n,t)):Kt(this.node(),n).delay}function ie(t,n){return function(){Wt(this,t).duration=+n.apply(this,arguments)}}function oe(t,n){return n=+n,function(){Wt(this,t).duration=n}}function ue(t){var n=this._id;return arguments.length?this.each(("function"==typeof t?ie:oe)(n,t)):Kt(this.node(),n).duration}function ae(t,n){if("function"!=typeof n)throw new Error;return function(){Wt(this,t).ease=n}}function se(t){var n=this._id;return arguments.length?this.each(ae(n,t)):Kt(this.node(),n).ease}function le(t){var n=this;"function"!=typeof t&&(t=ir(t));for(var e=n._groups,r=e.length,i=new Array(r),o=0;r>o;++o)for(var u,a=e[o],s=a.length,l=i[o]=new Array(s),c=0;s>c;++c)(u=a[c])&&t.call(u,u.__data__,c,a)&&(l[c]=u);return new Ce(i,this._parents,this._name,this._id)}function ce(t){var n=this;if(t._id!==this._id)throw new Error;for(var e=n._groups,r=t._groups,i=e.length,o=r.length,u=Math.min(i,o),a=new Array(i),s=0;u>s;++s)for(var l,c=e[s],f=r[s],h=c.length,p=a[s]=new Array(h),d=0;h>d;++d)(l=c[d]||f[d])&&(p[d]=l);for(;i>s;++s)a[s]=e[s];return new Ce(a,this._parents,this._name,this._id)}function fe(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 he(t,n,e){var r,i,o=fe(n)?Ut:Wt;return function(){var u=o(this,t),a=u.on;a!==r&&(i=(r=a).copy()).on(n,e),u.on=i}}function pe(t,n){var e=this._id;return arguments.length<2?Kt(this.node(),e).on.on(t):this.each(he(e,t,n))}function de(t){return function(){var n=this.parentNode;for(var e in this.__transition)if(+e!==t)return;n&&n.removeChild(this)}}function ye(){return this.on("end.remove",de(this._id))}function ve(t){var n=this,e=this._name,r=this._id;"function"!=typeof t&&(t=h(t));for(var i=n._groups,o=i.length,u=new Array(o),a=0;o>a;++a)for(var s,l,c=i[a],f=c.length,p=u[a]=new Array(f),d=0;f>d;++d)(s=c[d])&&(l=t.call(s,s.__data__,d,c))&&("__data__"in s&&(l.__data__=s.__data__),p[d]=l,Ft(p[d],e,r,d,p,Kt(s,r)));return new Ce(u,this._parents,e,r)}function ge(t){var n=this,e=this._name,r=this._id;"function"!=typeof t&&(t=d(t));for(var i=n._groups,o=i.length,u=[],a=[],s=0;o>s;++s)for(var l,c=i[s],f=c.length,h=0;f>h;++h)if(l=c[h]){for(var p,y=t.call(l,l.__data__,h,c),v=Kt(l,r),g=0,m=y.length;m>g;++g)(p=y[g])&&Ft(p,e,r,g,y,v);u.push(y),a.push(l)}return new Ce(u,a,e,r)}function me(){return new vi(this._groups,this._parents)}function _e(t,n){var e,r,i;return function(){var o=f(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 we(t){return function(){this.style.removeProperty(t)}}function be(t,n,e){var r,i;return function(){var o=f(this).getComputedStyle(this,null).getPropertyValue(t);return o===e?null:o===r?i:i=n(r=o,e)}}function xe(t,n,e){var r,i,o;return function(){var u=f(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 Me(t,n,e){var r="transform"==(t+="")?di:Bn;return null==n?this.styleTween(t,_e(t,r)).on("end.style."+t,we(t)):this.styleTween(t,"function"==typeof n?xe(t,r,Yn(this,"style."+t,n)):be(t,r,n),e)}function Ae(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 Ne(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,Ae(t,n,null==e?"":e))}function ke(t){return function(){this.textContent=t}}function Ee(t){return function(){var n=t(this);this.textContent=null==n?"":n}}function Se(t){return this.tween("text","function"==typeof t?Ee(Yn(this,"text",t)):ke(null==t?"":t+""))}function Pe(){for(var t=this,n=this._name,e=this._id,r=ze(),i=t._groups,o=i.length,u=0;o>u;++u)for(var a,s=i[u],l=s.length,c=0;l>c;++c)if(a=s[c]){var f=Kt(a,e);Ft(a,n,r,c,s,{time:f.time+f.delay+f.duration,delay:0,duration:f.duration,ease:f.ease})}return new Ce(i,this._parents,n,r)}function Ce(t,n,e,r){this._groups=t,this._parents=n,this._name=e,this._id=r}function qe(t){return Pt().transition(t)}function ze(){return++gi}function Te(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}function Ie(t,n){for(var e;!(e=t.__transition)||!(e=e[n]);)if(!(t=t.parentNode))return Ai.time=Ot(),Ai;return e}function Xe(t){var n,e,r=this;t instanceof Ce?(n=t._id,t=t._name):(n=ze(),(e=Ai).time=Ot(),t=null==t?null:t+"");for(var i=r._groups,o=i.length,u=0;o>u;++u)for(var a,s=i[u],l=s.length,c=0;l>c;++c)(a=s[c])&&Ft(a,t,n,c,s,e||Ie(a,n));return new Ce(i,this._parents,t,n)}function Oe(t,n){return n>t?-1:t>n?1:t>=n?0:NaN}function Ve(t){return 1===t.length&&(t=je(t)),{left:function(n,e,r,i){for(null==r&&(r=0),null==i&&(i=n.length);i>r;){var o=r+i>>>1;t(n[o],e)<0?r=o+1:i=o}return r},right:function(n,e,r,i){for(null==r&&(r=0),null==i&&(i=n.length);i>r;){var o=r+i>>>1;t(n[o],e)>0?i=o:r=o+1}return r}}}function je(t){return function(n,e){return Oe(t(n),e)}}function Le(t,n){var e,r,i=-1,o=t.length;if(null==n){for(;++i<o;)if(null!=(r=t[i])&&r>=r){e=r;break}for(;++i<o;)null!=(r=t[i])&&r>e&&(e=r)}else{for(;++i<o;)if(null!=(r=n(t[i],i,t))&&r>=r){e=r;break}for(;++i<o;)null!=(r=n(t[i],i,t))&&r>e&&(e=r)}return e}function Re(t,n){var e,r,i=-1,o=t.length;if(null==n){for(;++i<o;)if(null!=(r=t[i])&&r>=r){e=r;break}for(;++i<o;)null!=(r=t[i])&&e>r&&(e=r)}else{for(;++i<o;)if(null!=(r=n(t[i],i,t))&&r>=r){e=r;break}for(;++i<o;)null!=(r=n(t[i],i,t))&&e>r&&(e=r)}return e}function De(t,n){var e,r=0,i=t.length,o=-1;if(null==n)for(;++o<i;)(e=+t[o])&&(r+=e);else for(;++o<i;)(e=+n(t[o],o,t))&&(r+=e);return r}function $e(t){return function(){return t}}function Ye(t,n){void 0===n&&(n={"font-size":10,"font-family":"sans-serif"});var e=document.createElement("canvas").getContext("2d"),r=[];if("font-style"in n&&r.push(n["font-style"]),"font-variant"in n&&r.push(n["font-variant"]),"font-weight"in n&&r.push(n["font-weight"]),"font-size"in n){var i=n["font-size"]+"px";"line-height"in n&&(i+="/"+n["line-height"]+"px"),r.push(i)}return"font-family"in n&&r.push(n["font-family"]),e.font=r.join(" "),t instanceof Array?t.map(function(t){return e.measureText(t).width}):e.measureText(t).width}function Be(t){return t.height||200}function He(t,n){return t.id||""+n}function Fe(t){return t.match(Ei)}function Ue(t){return t.text}function We(t){return t.width||200}function Ke(t){return t.x||0}function Ge(t){return t.y||0}function Je(t){function n(t){return t+"..."}function e(n){void 0===a&&e.select(Ni.select("body").append("svg").style("width",window.innerWidth+"px").style("height",window.innerHeight+"px").node()),void 0===u&&(u=$e(Math.ceil(1.1*o())));var A=a.selectAll(".d3plus-text-box").data(t,y);return A.exit().remove(),A.enter().append("text").attr("class","d3plus-text-box").attr("id",function(t,n){return"d3plus-text-box-"+y(t,n)}).merge(A).attr("y",function(t,n){return M(t,n)+"px"}).attr("fill",function(t,n){return r(t,n)}).attr("text-anchor",function(t,n){return _(t,n)}).attr("font-family",function(t,n){return i(t,n)}).each(function(t,n){function e(){if(N=1,k=[""],P>M)return void(k=[]);M>S&&(M=S);var t="",n=0;y&&(A=1.1*M,E["font-size"]=M,E["line-height"]=A),a=Ye(V,E);for(var r=0;r<V.length;r++){var i=V[r],o=T.charAt(t.length+i.length),u=a[V.indexOf(i)];if(" "===o&&(i+=o),n+u>O-M){if(N++,A*N>C||u>O&&!q){if(y){if(M--,P>M){k=[];break}e()}else 2!==N||k[N-2].trimRight().length?k[N-2]=c(k[N-2].trimRight()):k=[];break}n=0,k.push(i)}else k[N-1]+=i;t+=i,n+=u," "===o&&(n+=z)}}function r(e){e.text(function(t){return t.trimRight()}).attr("x",x(t,n)+"px").attr("dx",j+"px").attr("dy",A+"px")}var a,y=p(t,n),M=y?f(t,n):o(t,n),A=y?1.1*M:u(t,n),N=1,k=[""],E={"font-family":i(t,n),"font-size":M,"line-height":A},S=f(t,n),P=h(t,n),C=d(t,n),q=v(t,n),z=Ye(" ",E),T=m(t,n),I=_(t,n),X=w(t,n),O=b(t,n),V=g(T,n),j="start"===I?0:"end"===I?O:O/2;if(C>A||y){if(y){a=Ye(V,E);var L=1.165+O/C*.1,R=O*C,D=Ni.max(a),$=Ni.sum(a,function(t){return t*A})*L;if(D>O||$>R){var Y=Math.sqrt(R/$),B=O/D,H=Ni.min([Y,B]);M=Math.floor(M*H)}var F=Math.floor(.8*C);M>F&&(M=F)}e(),Ni.select(this).attr("font-size",M+"px").style("font-size",M+"px")}var U=N*A,W="top"===X?0:"middle"===X?C/2-U/2:C-U;W-=.2*A,Ni.select(this).transition().duration(l).attr("transform","translate(0,"+W+")");var K=Ni.select(this).selectAll("tspan").data(k);K.transition().duration(l).call(r),K.exit().transition().duration(l).attr("opacity",0).remove(),K.enter().append("tspan").attr("dominant-baseline","alphabetic").style("baseline-shift","0%").attr("opacity",0).call(r).transition().duration(l).delay(s).attr("opacity",1)}),n&&setTimeout(n,l+100),e}void 0===t&&(t=[]);var r,i,o,u,a,s=0,l=0,c=n,f=$e(50),h=$e(8),p=$e(!1),d=Be,y=He,v=$e(!1),g=Fe,m=Ue,_=$e("start"),w=$e("top"),b=We,x=Ke,M=Ge;return e.data=function(n){return arguments.length?(t=n,e):t},e.delay=function(t){return arguments.length?(s=t,e):s},e.duration=function(t){return arguments.length?(l=t,e):l},e.ellipsis=function(t){return arguments.length?(c="function"==typeof t?t:$e(t),e):c},e.fontColor=function(t){return arguments.length?(r="function"==typeof t?t:$e(t),e):r},e.fontFamily=function(t){return arguments.length?(i="function"==typeof t?t:$e(t),e):i},e.fontMax=function(t){return arguments.length?(f="function"==typeof t?t:$e(t),e):f},e.fontMin=function(t){return arguments.length?(h="function"==typeof t?t:$e(t),e):h},e.fontResize=function(t){return arguments.length?(p="function"==typeof t?t:$e(t),e):p},e.fontSize=function(t){return arguments.length?(o="function"==typeof t?t:$e(t),e):o},e.height=function(t){return arguments.length?(d="function"==typeof t?t:$e(t),e):d},e.id=function(t){return arguments.length?(y="function"==typeof t?t:$e(t),e):y},e.lineHeight=function(t){return arguments.length?(u="function"==typeof t?t:$e(t),e):u},e.overflow=function(t){return arguments.length?(v="function"==typeof t?t:$e(t),e):v},e.select=function(t){return arguments.length?(a=Ni.select(t),void 0===r&&e.fontColor(a.style("font-color")),void 0===i&&e.fontFamily(a.style("font-family")),void 0===o&&e.fontSize(parseFloat(a.style("font-size"),10)),e):a},e.split=function(t){return arguments.length?(g=t,e):g},e.text=function(t){return arguments.length?(m="function"==typeof t?t:$e(t), | ||
e):m},e.textAnchor=function(t){return arguments.length?(_="function"==typeof t?t:$e(t),e):_},e.verticalAlign=function(t){return arguments.length?(w="function"==typeof t?t:$e(t),e):w},e.width=function(t){return arguments.length?(b="function"==typeof t?t:$e(t),e):b},e.x=function(t){return arguments.length?(x="function"==typeof t?t:$e(t),e):x},e.y=function(t){return arguments.length?(M="function"==typeof t?t:$e(t),e):M},t.length?e():e}var Qe="0.4.3",Ze="http://www.w3.org/1999/xhtml",tr={svg:"http://www.w3.org/2000/svg",xhtml:Ze,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},nr=function(t){return function(){return this.matches(t)}};if("undefined"!=typeof document){var er=document.documentElement;if(!er.matches){var rr=er.webkitMatchesSelector||er.msMatchesSelector||er.mozMatchesSelector||er.oMatchesSelector;nr=function(t){return function(){return rr.call(this,t)}}}}var ir=nr,or={},ur=null;if("undefined"!=typeof document){var ar=document.documentElement;"onmouseenter"in ar||(or={mouseenter:"mouseover",mouseleave:"mouseout"})}var sr="$";b.prototype={constructor:b,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)}},Q.prototype={add:function(t){var n=this._names.indexOf(t);0>n&&(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 lr=[null];St.prototype=Pt.prototype={constructor:St,select:p,selectAll:y,filter:v,data:w,enter:M,exit:A,merge:N,order:k,sort:E,call:P,nodes:C,node:q,size:z,empty:T,each:I,attr:D,style:H,property:K,classed:it,text:st,html:ht,raise:dt,lower:vt,append:wt,remove:xt,datum:Mt,on:c,dispatch:Et};var cr=("undefined"!=typeof navigator&&/WebKit/.test(navigator.userAgent)?-1:0,{value:function(){}});zt.prototype=qt.prototype={constructor:zt,on:function(t,n){var e,r=this._,i=Tt(t+"",r),o=-1,u=i.length;{if(!(arguments.length<2)){if(null!=n&&"function"!=typeof n)throw new Error;for(;++o<u;)if(e=(t=i[o]).type)r[e]=Xt(r[e],t.name,n);else if(null==n)for(e in r)r[e]=Xt(r[e],t.name,null);return this}for(;++o<u;)if((e=(t=i[o]).type)&&(e=It(r[e],t.name)))return e}},copy:function(){var t={},n=this._;for(var e in n)t[e]=n[e].slice();return new zt(t)},call:function(t,n){var e=arguments;if((r=arguments.length-2)>0)for(var r,i=new Array(r),o=0;r>o;++o)i[o]=e[o+2];this.apply(t,n,i)},apply:function(t,n,e){var r=this;if(!this._.hasOwnProperty(t))throw new Error;for(var i=r._[t],o=0,u=i.length;u>o;++o)i[o].value.apply(n,e)}};var fr,hr,pr=0,dr=0,yr=0,vr=1e3,gr=0,mr=0,_r=0,wr="object"==typeof performance?performance:Date,br="function"==typeof requestAnimationFrame?requestAnimationFrame:function(t){return setTimeout(t,17)};jt.prototype=Lt.prototype={constructor:jt,restart:function(t,n,e){if("function"!=typeof t)throw new TypeError("callback is not a function");e=(null==e?Ot():+e)+(null==n?0:+n),this._call||(hr?hr._next=this:fr=this,hr=this),this._call=t,this._time=e,Bt()},stop:function(){this._call&&(this._call=null,this._time=1/0,Bt())}};var xr=qt("start","end","interrupt"),Mr=[],Ar=0,Nr=1,kr=2,Er=3,Sr=4,Pr=5,Cr=.7,qr=1/Cr,zr=/^#([0-9a-f]{3})$/,Tr=/^#([0-9a-f]{6})$/,Ir=/^rgb\(\s*([-+]?\d+)\s*,\s*([-+]?\d+)\s*,\s*([-+]?\d+)\s*\)$/,Xr=/^rgb\(\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*\)$/,Or=/^rgba\(\s*([-+]?\d+)\s*,\s*([-+]?\d+)\s*,\s*([-+]?\d+)\s*,\s*([-+]?\d+(?:\.\d+)?)\s*\)$/,Vr=/^rgba\(\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)\s*\)$/,jr=/^hsl\(\s*([-+]?\d+(?:\.\d+)?)\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*\)$/,Lr=/^hsla\(\s*([-+]?\d+(?:\.\d+)?)\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)\s*\)$/,Rr={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};Qt(tn,nn,{displayable:function(){return this.rgb().displayable()},toString:function(){return this.rgb()+""}}),Qt(an,un,Zt(tn,{brighter:function(t){return t=null==t?qr:Math.pow(qr,t),new an(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?Cr:Math.pow(Cr,t),new an(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+")")}})),Qt(fn,cn,Zt(tn,{brighter:function(t){return t=null==t?qr:Math.pow(qr,t),new fn(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?Cr:Math.pow(Cr,t),new fn(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+(.5>e?e:1-e)*n,i=2*e-r;return new an(hn(t>=240?t-240:t+120,i,r),hn(t,i,r),hn(120>t?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 Dr=Math.PI/180,$r=180/Math.PI,Yr=18,Br=.95047,Hr=1,Fr=1.08883,Ur=4/29,Wr=6/29,Kr=3*Wr*Wr,Gr=Wr*Wr*Wr;Qt(yn,dn,Zt(tn,{brighter:function(t){return new yn(this.l+Yr*(null==t?1:t),this.a,this.b,this.opacity)},darker:function(t){return new yn(this.l-Yr*(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=Hr*gn(t),n=Br*gn(n),e=Fr*gn(e),new an(mn(3.2404542*n-1.5371385*t-.4985314*e),mn(-.969266*n+1.8760108*t+.041556*e),mn(.0556434*n-.2040259*t+1.0572252*e),this.opacity)}})),Qt(xn,bn,Zt(tn,{brighter:function(t){return new xn(this.h,this.c,this.l+Yr*(null==t?1:t),this.opacity)},darker:function(t){return new xn(this.h,this.c,this.l-Yr*(null==t?1:t),this.opacity)},rgb:function(){return pn(this).rgb()}}));var Jr=-.14861,Qr=1.78277,Zr=-.29227,ti=-.90649,ni=1.97294,ei=ni*ti,ri=ni*Qr,ii=Qr*Zr-ti*Jr;Qt(Nn,An,Zt(tn,{brighter:function(t){return t=null==t?qr:Math.pow(qr,t),new Nn(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?Cr:Math.pow(Cr,t),new Nn(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=isNaN(this.h)?0:(this.h+120)*Dr,n=+this.l,e=isNaN(this.s)?0:this.s*n*(1-n),r=Math.cos(t),i=Math.sin(t);return new an(255*(n+e*(Jr*r+Qr*i)),255*(n+e*(Zr*r+ti*i)),255*(n+e*(ni*r)),this.opacity)}}));var oi,ui,ai,si,li=function Si(t){function n(t,n){var r=e((t=un(t)).r,(n=un(n)).r),i=e(t.g,n.g),o=e(t.b,n.b),u=e(t.opacity,n.opacity);return function(n){return t.r=r(n),t.g=i(n),t.b=o(n),t.opacity=u(n),t+""}}var e=Cn(t);return n.gamma=Si,n}(1),ci=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,fi=new RegExp(ci.source,"g"),hi=180/Math.PI,pi={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1},di=Ln(Vn,"px, ","px)","deg)"),yi=Ln(jn,", ",")",")");!function Pi(t){function n(n,e){var r=Pn((n=An(n)).h,(e=An(e)).h),i=qn(n.s,e.s),o=qn(n.l,e.l),u=qn(n.opacity,e.opacity);return function(e){return n.h=r(e),n.s=i(e),n.l=o(Math.pow(e,t)),n.opacity=u(e),n+""}}return t=+t,n.gamma=Pi,n}(1),function Ci(t){function n(n,e){var r=qn((n=An(n)).h,(e=An(e)).h),i=qn(n.s,e.s),o=qn(n.l,e.l),u=qn(n.opacity,e.opacity);return function(e){return n.h=r(e),n.s=i(e),n.l=o(Math.pow(e,t)),n.opacity=u(e),n+""}}return t=+t,n.gamma=Ci,n}(1);var vi=Pt.prototype.constructor,gi=0,mi=Pt.prototype;Ce.prototype=qe.prototype={constructor:Ce,select:ve,selectAll:ge,filter:le,merge:ce,selection:me,transition:Pe,call:mi.call,nodes:mi.nodes,node:mi.node,size:mi.size,empty:mi.empty,each:mi.each,on:pe,attr:Jn,attrTween:te,style:Me,styleTween:Ne,text:Se,remove:ye,tween:$n,delay:re,duration:ue,ease:se};var _i=3,wi=(function qi(t){function n(n){return Math.pow(n,t)}return t=+t,n.exponent=qi,n}(_i),function zi(t){function n(n){return 1-Math.pow(1-n,t)}return t=+t,n.exponent=zi,n}(_i),function Ti(t){function n(n){return((n*=2)<=1?Math.pow(n,t):2-Math.pow(2-n,t))/2}return t=+t,n.exponent=Ti,n}(_i),1.70158),bi=(function Ii(t){function n(n){return n*n*((t+1)*n-t)}return t=+t,n.overshoot=Ii,n}(wi),function Xi(t){function n(n){return--n*n*((t+1)*n+t)+1}return t=+t,n.overshoot=Xi,n}(wi),function Oi(t){function n(n){return((n*=2)<1?n*n*((t+1)*n-t):(n-=2)*n*((t+1)*n+t)+2)/2}return t=+t,n.overshoot=Oi,n}(wi),2*Math.PI),xi=1,Mi=.3,Ai=(function Vi(t,n){function e(e){return t*Math.pow(2,10*--e)*Math.sin((r-e)/n)}var r=Math.asin(1/(t=Math.max(1,t)))*(n/=bi);return e.amplitude=function(t){return Vi(t,n*bi)},e.period=function(n){return Vi(t,n)},e}(xi,Mi),function ji(t,n){function e(e){return 1-t*Math.pow(2,-10*(e=+e))*Math.sin((e+r)/n)}var r=Math.asin(1/(t=Math.max(1,t)))*(n/=bi);return e.amplitude=function(t){return ji(t,n*bi)},e.period=function(n){return ji(t,n)},e}(xi,Mi),function Li(t,n){function e(e){return((e=2*e-1)<0?t*Math.pow(2,10*e)*Math.sin((r-e)/n):2-t*Math.pow(2,-10*e)*Math.sin((r+e)/n))/2}var r=Math.asin(1/(t=Math.max(1,t)))*(n/=bi);return e.amplitude=function(t){return Li(t,n*bi)},e.period=function(n){return Li(t,n)},e}(xi,Mi),{time:null,delay:0,duration:250,ease:Te});Pt.prototype.interrupt=Jt,Pt.prototype.transition=Xe;var Ni=(Ve(Oe),{max:Le,min:Re,select:Ct,sum:De,transition:qe}),ki=["-","/",";",":","&"],Ei=new RegExp("[^\\s\\"+ki.join("\\")+"]+\\"+ki.join("?\\")+"?","g");t.version=Qe,t.box=Je,t.width=Ye}); |
@@ -7,3 +7,3 @@ (function (global, factory) { | ||
var version = "0.4.2"; | ||
var version = "0.4.3"; | ||
@@ -37,3 +37,3 @@ /** | ||
if ("font-size" in style) { | ||
var s = "" + (style["font-size"]) + "px"; | ||
var s = (style["font-size"]) + "px"; | ||
if ("line-height" in style) s += "/" + (style["line-height"]) + "px"; | ||
@@ -149,3 +149,3 @@ font.push(s); | ||
function boxEllipsis(_) { | ||
return ("" + _ + "..."); | ||
return (_ + "..."); | ||
} | ||
@@ -181,3 +181,4 @@ | ||
if (select === void 0) box.select(d3.select("body").append("svg").style("width", ("" + (window.innerWidth) + "px")).style("height", ("" + (window.innerHeight) + "px")).node()); | ||
if (select === void 0) box.select(d3.select("body").append("svg").style("width", ((window.innerWidth) + "px")).style("height", ((window.innerHeight) + "px")).node()); | ||
if (lineHeight === void 0) lineHeight = constant(Math.ceil(fontSize() * 1.1)); | ||
@@ -192,3 +193,3 @@ var boxes = select.selectAll(".d3plus-text-box").data(data, id); | ||
.merge(boxes) | ||
.attr("y", function (d, i) { return ("" + (y(d, i)) + "px"); }) | ||
.attr("y", function (d, i) { return ((y(d, i)) + "px"); }) | ||
.attr("fill", function (d, i) { return fontColor(d, i); }) | ||
@@ -268,2 +269,3 @@ .attr("text-anchor", function (d, i) { return textAnchor(d, i); }) | ||
} | ||
else if (line === 2 && !lineData[line - 2].trimRight().length) lineData = []; | ||
else lineData[line - 2] = ellipsis(lineData[line - 2].trimRight()); | ||
@@ -309,4 +311,4 @@ break; | ||
d3.select(this) | ||
.attr("font-size", ("" + fS + "px")) | ||
.style("font-size", ("" + fS + "px")); | ||
.attr("font-size", (fS + "px")) | ||
.style("font-size", (fS + "px")); | ||
@@ -329,5 +331,5 @@ } | ||
.text(function (d) { return d.trimRight(); }) | ||
.attr("x", ("" + (x(d, i)) + "px")) | ||
.attr("dx", ("" + dx + "px")) | ||
.attr("dy", ("" + lH + "px")); | ||
.attr("x", ((x(d, i)) + "px")) | ||
.attr("dx", (dx + "px")) | ||
.attr("dy", (lH + "px")); | ||
} | ||
@@ -451,3 +453,2 @@ | ||
fontSize = typeof _ === "function" ? _ : constant(_); | ||
if (lineHeight === void 0) lineHeight = constant(Math.ceil(fontSize() * 1.1)); | ||
return box; | ||
@@ -454,0 +455,0 @@ } |
@@ -1,1 +0,1 @@ | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("d3-selection"),require("d3-transition"),require("d3-array")):"function"==typeof define&&define.amd?define("d3plus-text",["exports","d3-selection","d3-transition","d3-array"],n):n(t.d3plus_text=t.d3plus_text||{},t.d3_selection,t.d3_transition,t.d3_array)}(this,function(t,n,e,i){"use strict";function o(t){return function(){return t}}function r(t,n){void 0===n&&(n={"font-size":10,"font-family":"sans-serif"});var e=document.createElement("canvas").getContext("2d"),i=[];if("font-style"in n&&i.push(n["font-style"]),"font-variant"in n&&i.push(n["font-variant"]),"font-weight"in n&&i.push(n["font-weight"]),"font-size"in n){var o=""+n["font-size"]+"px";"line-height"in n&&(o+="/"+n["line-height"]+"px"),i.push(o)}return"font-family"in n&&i.push(n["font-family"]),e.font=i.join(" "),t instanceof Array?t.map(function(t){return e.measureText(t).width}):e.measureText(t).width}function f(t){return t.height||200}function u(t,n){return t.id||""+n}function a(t){return t.match(x)}function l(t){return t.text}function c(t){return t.width||200}function s(t){return t.x||0}function h(t){return t.y||0}function d(t){function n(t){return""+t+"..."}function e(n){void 0===x&&e.select(y.select("body").append("svg").style("width",""+window.innerWidth+"px").style("height",""+window.innerHeight+"px").node());var o=x.selectAll(".d3plus-text-box").data(t,_);return o.exit().remove(),o.enter().append("text").attr("class","d3plus-text-box").attr("id",function(t,n){return"d3plus-text-box-"+_(t,n)}).merge(o).attr("y",function(t,n){return""+E(t,n)+"px"}).attr("fill",function(t,n){return i(t,n)}).attr("text-anchor",function(t,n){return C(t,n)}).attr("font-family",function(t,n){return d(t,n)}).each(function(t,n){function e(){if(l=1,c=[""],x>u)return void(c=[]);u>h&&(u=h);var t="",n=0;f&&(a=1.1*u,s["font-size"]=u,s["line-height"]=a),o=r(D,s);for(var i=0;i<D.length;i++){var d=D[i],p=S.charAt(t.length+d.length),y=o[D.indexOf(d)];if(" "===p&&(d+=p),n+y>B-u){if(l++,a*l>_||y>B&&!E){if(f){if(u--,x>u){c=[];break}e()}else c[l-2]=w(c[l-2].trimRight());break}n=0,c.push(d)}else c[l-1]+=d;t+=d,n+=y," "===p&&(n+=H)}}function i(e){e.text(function(t){return t.trimRight()}).attr("x",""+k(t,n)+"px").attr("dx",""+G+"px").attr("dy",""+a+"px")}var o,f=A(t,n),u=f?b(t,n):p(t,n),a=f?1.1*u:g(t,n),l=1,c=[""],s={"font-family":d(t,n),"font-size":u,"line-height":a},h=b(t,n),x=z(t,n),_=M(t,n),E=j(t,n),H=r(" ",s),S=R(t,n),O=C(t,n),W=F(t,n),B=T(t,n),D=q(S,n),G="start"===O?0:"end"===O?B:B/2;if(_>a||f){if(f){o=r(D,s);var I=1.165+B/_*.1,J=B*_,K=y.max(o),L=y.sum(o,function(t){return t*a})*I;if(K>B||L>J){var N=Math.sqrt(J/L),P=B/K,Q=y.min([N,P]);u=Math.floor(u*Q)}var U=Math.floor(.8*_);u>U&&(u=U)}e(),y.select(this).attr("font-size",""+u+"px").style("font-size",""+u+"px")}var V=l*a,X="top"===W?0:"middle"===W?_/2-V/2:_-V;X-=.2*a,y.select(this).transition().duration(v).attr("transform","translate(0,"+X+")");var Y=y.select(this).selectAll("tspan").data(c);Y.transition().duration(v).call(i),Y.exit().transition().duration(v).attr("opacity",0).remove(),Y.enter().append("tspan").attr("dominant-baseline","alphabetic").style("baseline-shift","0%").attr("opacity",0).call(i).transition().duration(v).delay(m).attr("opacity",1)}),n&&setTimeout(n,v+100),e}void 0===t&&(t=[]);var i,d,p,g,x,m=0,v=0,w=n,b=o(50),z=o(8),A=o(!1),M=f,_=u,j=o(!1),q=a,R=l,C=o("start"),F=o("top"),T=c,k=s,E=h;return e.data=function(n){return arguments.length?(t=n,e):t},e.delay=function(t){return arguments.length?(m=t,e):m},e.duration=function(t){return arguments.length?(v=t,e):v},e.ellipsis=function(t){return arguments.length?(w="function"==typeof t?t:o(t),e):w},e.fontColor=function(t){return arguments.length?(i="function"==typeof t?t:o(t),e):i},e.fontFamily=function(t){return arguments.length?(d="function"==typeof t?t:o(t),e):d},e.fontMax=function(t){return arguments.length?(b="function"==typeof t?t:o(t),e):b},e.fontMin=function(t){return arguments.length?(z="function"==typeof t?t:o(t),e):z},e.fontResize=function(t){return arguments.length?(A="function"==typeof t?t:o(t),e):A},e.fontSize=function(t){return arguments.length?(p="function"==typeof t?t:o(t),void 0===g&&(g=o(Math.ceil(1.1*p()))),e):p},e.height=function(t){return arguments.length?(M="function"==typeof t?t:o(t),e):M},e.id=function(t){return arguments.length?(_="function"==typeof t?t:o(t),e):_},e.lineHeight=function(t){return arguments.length?(g="function"==typeof t?t:o(t),e):g},e.overflow=function(t){return arguments.length?(j="function"==typeof t?t:o(t),e):j},e.select=function(t){return arguments.length?(x=y.select(t),void 0===i&&e.fontColor(x.style("font-color")),void 0===d&&e.fontFamily(x.style("font-family")),void 0===p&&e.fontSize(parseFloat(x.style("font-size"),10)),e):x},e.split=function(t){return arguments.length?(q=t,e):q},e.text=function(t){return arguments.length?(R="function"==typeof t?t:o(t),e):R},e.textAnchor=function(t){return arguments.length?(C="function"==typeof t?t:o(t),e):C},e.verticalAlign=function(t){return arguments.length?(F="function"==typeof t?t:o(t),e):F},e.width=function(t){return arguments.length?(T="function"==typeof t?t:o(t),e):T},e.x=function(t){return arguments.length?(k="function"==typeof t?t:o(t),e):k},e.y=function(t){return arguments.length?(E="function"==typeof t?t:o(t),e):E},t.length?e():e}var p="0.4.2",y={max:i.max,min:i.min,select:n.select,sum:i.sum,transition:e.transition},g=["-","/",";",":","&"],x=new RegExp("[^\\s\\"+g.join("\\")+"]+\\"+g.join("?\\")+"?","g");t.version=p,t.box=d,t.width=r}); | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("d3-selection"),require("d3-transition"),require("d3-array")):"function"==typeof define&&define.amd?define("d3plus-text",["exports","d3-selection","d3-transition","d3-array"],n):n(t.d3plus_text=t.d3plus_text||{},t.d3_selection,t.d3_transition,t.d3_array)}(this,function(t,n,e,i){"use strict";function o(t){return function(){return t}}function r(t,n){void 0===n&&(n={"font-size":10,"font-family":"sans-serif"});var e=document.createElement("canvas").getContext("2d"),i=[];if("font-style"in n&&i.push(n["font-style"]),"font-variant"in n&&i.push(n["font-variant"]),"font-weight"in n&&i.push(n["font-weight"]),"font-size"in n){var o=n["font-size"]+"px";"line-height"in n&&(o+="/"+n["line-height"]+"px"),i.push(o)}return"font-family"in n&&i.push(n["font-family"]),e.font=i.join(" "),t instanceof Array?t.map(function(t){return e.measureText(t).width}):e.measureText(t).width}function f(t){return t.height||200}function u(t,n){return t.id||""+n}function a(t){return t.match(x)}function l(t){return t.text}function c(t){return t.width||200}function s(t){return t.x||0}function h(t){return t.y||0}function d(t){function n(t){return t+"..."}function e(n){void 0===x&&e.select(y.select("body").append("svg").style("width",window.innerWidth+"px").style("height",window.innerHeight+"px").node()),void 0===g&&(g=o(Math.ceil(1.1*p())));var f=x.selectAll(".d3plus-text-box").data(t,R);return f.exit().remove(),f.enter().append("text").attr("class","d3plus-text-box").attr("id",function(t,n){return"d3plus-text-box-"+R(t,n)}).merge(f).attr("y",function(t,n){return E(t,n)+"px"}).attr("fill",function(t,n){return i(t,n)}).attr("text-anchor",function(t,n){return C(t,n)}).attr("font-family",function(t,n){return d(t,n)}).each(function(t,n){function e(){if(l=1,c=[""],x>u)return void(c=[]);u>h&&(u=h);var t="",n=0;f&&(a=1.1*u,s["font-size"]=u,s["line-height"]=a),o=r(D,s);for(var i=0;i<D.length;i++){var d=D[i],p=S.charAt(t.length+d.length),y=o[D.indexOf(d)];if(" "===p&&(d+=p),n+y>B-u){if(l++,a*l>R||y>B&&!E){if(f){if(u--,x>u){c=[];break}e()}else 2!==l||c[l-2].trimRight().length?c[l-2]=w(c[l-2].trimRight()):c=[];break}n=0,c.push(d)}else c[l-1]+=d;t+=d,n+=y," "===p&&(n+=H)}}function i(e){e.text(function(t){return t.trimRight()}).attr("x",k(t,n)+"px").attr("dx",G+"px").attr("dy",a+"px")}var o,f=A(t,n),u=f?b(t,n):p(t,n),a=f?1.1*u:g(t,n),l=1,c=[""],s={"font-family":d(t,n),"font-size":u,"line-height":a},h=b(t,n),x=z(t,n),R=M(t,n),E=_(t,n),H=r(" ",s),S=q(t,n),O=C(t,n),W=F(t,n),B=T(t,n),D=j(S,n),G="start"===O?0:"end"===O?B:B/2;if(R>a||f){if(f){o=r(D,s);var I=1.165+B/R*.1,J=B*R,K=y.max(o),L=y.sum(o,function(t){return t*a})*I;if(K>B||L>J){var N=Math.sqrt(J/L),P=B/K,Q=y.min([N,P]);u=Math.floor(u*Q)}var U=Math.floor(.8*R);u>U&&(u=U)}e(),y.select(this).attr("font-size",u+"px").style("font-size",u+"px")}var V=l*a,X="top"===W?0:"middle"===W?R/2-V/2:R-V;X-=.2*a,y.select(this).transition().duration(v).attr("transform","translate(0,"+X+")");var Y=y.select(this).selectAll("tspan").data(c);Y.transition().duration(v).call(i),Y.exit().transition().duration(v).attr("opacity",0).remove(),Y.enter().append("tspan").attr("dominant-baseline","alphabetic").style("baseline-shift","0%").attr("opacity",0).call(i).transition().duration(v).delay(m).attr("opacity",1)}),n&&setTimeout(n,v+100),e}void 0===t&&(t=[]);var i,d,p,g,x,m=0,v=0,w=n,b=o(50),z=o(8),A=o(!1),M=f,R=u,_=o(!1),j=a,q=l,C=o("start"),F=o("top"),T=c,k=s,E=h;return e.data=function(n){return arguments.length?(t=n,e):t},e.delay=function(t){return arguments.length?(m=t,e):m},e.duration=function(t){return arguments.length?(v=t,e):v},e.ellipsis=function(t){return arguments.length?(w="function"==typeof t?t:o(t),e):w},e.fontColor=function(t){return arguments.length?(i="function"==typeof t?t:o(t),e):i},e.fontFamily=function(t){return arguments.length?(d="function"==typeof t?t:o(t),e):d},e.fontMax=function(t){return arguments.length?(b="function"==typeof t?t:o(t),e):b},e.fontMin=function(t){return arguments.length?(z="function"==typeof t?t:o(t),e):z},e.fontResize=function(t){return arguments.length?(A="function"==typeof t?t:o(t),e):A},e.fontSize=function(t){return arguments.length?(p="function"==typeof t?t:o(t),e):p},e.height=function(t){return arguments.length?(M="function"==typeof t?t:o(t),e):M},e.id=function(t){return arguments.length?(R="function"==typeof t?t:o(t),e):R},e.lineHeight=function(t){return arguments.length?(g="function"==typeof t?t:o(t),e):g},e.overflow=function(t){return arguments.length?(_="function"==typeof t?t:o(t),e):_},e.select=function(t){return arguments.length?(x=y.select(t),void 0===i&&e.fontColor(x.style("font-color")),void 0===d&&e.fontFamily(x.style("font-family")),void 0===p&&e.fontSize(parseFloat(x.style("font-size"),10)),e):x},e.split=function(t){return arguments.length?(j=t,e):j},e.text=function(t){return arguments.length?(q="function"==typeof t?t:o(t),e):q},e.textAnchor=function(t){return arguments.length?(C="function"==typeof t?t:o(t),e):C},e.verticalAlign=function(t){return arguments.length?(F="function"==typeof t?t:o(t),e):F},e.width=function(t){return arguments.length?(T="function"==typeof t?t:o(t),e):T},e.x=function(t){return arguments.length?(k="function"==typeof t?t:o(t),e):k},e.y=function(t){return arguments.length?(E="function"==typeof t?t:o(t),e):E},t.length?e():e}var p="0.4.3",y={max:i.max,min:i.min,select:n.select,sum:i.sum,transition:e.transition},g=["-","/",";",":","&"],x=new RegExp("[^\\s\\"+g.join("\\")+"]+\\"+g.join("?\\")+"?","g");t.version=p,t.box=d,t.width=r}); |
{ | ||
"name": "d3plus-text", | ||
"version": "0.4.2", | ||
"version": "0.4.3", | ||
"description": "SVG text functions, including line wrapping with automatic font scaling.", | ||
@@ -39,3 +39,3 @@ "main": "build/d3plus-text.js", | ||
"rollup": "^0.26.0", | ||
"rollup-plugin-buble": "^0.5.0", | ||
"rollup-plugin-buble": "^0.6.0", | ||
"rollup-plugin-json": "^2.0.0", | ||
@@ -51,3 +51,3 @@ "rollup-plugin-node-resolve": "^1.5.0", | ||
"docs": "jsdoc2md 'src/**/*.js' -t README.hbs > README.md", | ||
"lint": "eslint index.js src/* text/browser/*.js", | ||
"lint": "eslint index.js src/* test/*.js", | ||
"make:lite": "mkdir -p build && rollup -c .rollup.js", | ||
@@ -54,0 +54,0 @@ "make:full": "mkdir -p build && rollup -c .rollup.full.js", |
@@ -25,3 +25,3 @@ # d3plus-text | ||
### Browser | ||
In a vanilla environment, a `d3plus_text` global is exported. To use a compiled version hosted on [d3js.org](https://d3js.org) and [d3plus.org](https://d3plus.org) that includes all dependencies: | ||
In a vanilla environment, a `d3plus_text` global is exported. To use a compiled version hosted on [d3plus.org](https://d3plus.org) that includes all dependencies: | ||
@@ -48,4 +48,2 @@ ```html | ||
Otherwise, [click here](https://github.com/d3plus/d3plus-text/releases/latest) to download the latest release. | ||
<a name="install.amd"></a> | ||
@@ -52,0 +50,0 @@ ### AMD and CommonJS |
@@ -136,2 +136,3 @@ import {select as d3Select} from "d3-selection"; | ||
if (select === void 0) box.select(d3.select("body").append("svg").style("width", `${window.innerWidth}px`).style("height", `${window.innerHeight}px`).node()); | ||
if (lineHeight === void 0) lineHeight = constant(Math.ceil(fontSize() * 1.1)); | ||
@@ -221,2 +222,3 @@ const boxes = select.selectAll(".d3plus-text-box").data(data, id); | ||
} | ||
else if (line === 2 && !lineData[line - 2].trimRight().length) lineData = []; | ||
else lineData[line - 2] = ellipsis(lineData[line - 2].trimRight()); | ||
@@ -402,3 +404,2 @@ break; | ||
fontSize = typeof _ === "function" ? _ : constant(_); | ||
if (lineHeight === void 0) lineHeight = constant(Math.ceil(fontSize() * 1.1)); | ||
return box; | ||
@@ -405,0 +406,0 @@ } |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
4089
218841
428