Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

d3plus-text

Package Overview
Dependencies
Maintainers
1
Versions
89
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

d3plus-text - npm Package Compare versions

Comparing version 0.4.1 to 0.4.2

8

.rollup.full.js

@@ -1,2 +0,2 @@

import babel from "rollup-plugin-babel";
import buble from "rollup-plugin-buble";
import json from "rollup-plugin-json";

@@ -12,7 +12,3 @@ import deps from "rollup-plugin-node-resolve";

moduleName: "d3plus_text",
plugins: [
json(),
deps({"jsnext": true, "main": true}),
babel({"presets": ["es2015-rollup"]})
]
plugins: [json(), deps({"jsnext": true, "main": true}), buble()]
};

@@ -1,2 +0,2 @@

import babel from "rollup-plugin-babel";
import buble from "rollup-plugin-buble";
import json from "rollup-plugin-json";

@@ -11,6 +11,3 @@

moduleName: "d3plus_text",
plugins: [
json(),
babel({"presets": ["es2015-rollup"]})
]
plugins: [json(), 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={})}(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)),nr.hasOwnProperty(n)?{space:nr[n],local:t}:t}function e(t){return function(){var n=this.ownerDocument,e=this.namespaceURI;return e===tr&&n.documentElement.namespaceURI===tr?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=ar;ar=r;try{t.call(this,this.__data__,n,e)}finally{ar=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.__on;if(n){for(var e,r=0,i=-1,o=n.length;o>r;++r)e=n[r],t.type&&e.type!==t.type||e.name!==t.name?n[++i]=e:this.removeEventListener(e.type,e.listener,e.capture);++i?n.length=i:delete this.__on}}}function l(t,n,e){var r=ur.hasOwnProperty(t.type)?o:u;return function(i,o,u){var a,s=this.__on,l=r(n,o,u);if(s)for(var c=0,f=s.length;f>c;++c)if((a=s[c]).type===t.type&&a.name===t.name)return this.removeEventListener(a.type,a.listener,a.capture),this.addEventListener(a.type,a.listener=l,a.capture=e),void(a.value=n);this.addEventListener(t.type,l,e),a={type:t.type,name:t.name,value:n,listener:l,capture:e},s?s.push(a):this.__on=[a]}}function c(t,n,e){var r,i,o=a(t+""),u=o.length;{if(!(arguments.length<2)){for(c=n?l:s,null==e&&(e=!1),r=0;u>r;++r)this.each(c(o[r],n,e));return this}var c=this.node().__on;if(c)for(var f,h=0,p=c.length;p>h;++h)for(r=0,f=c[h];u>r;++r)if((i=o[r]).type===f.type&&i.name===f.name)return f.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){"function"!=typeof t&&(t=h(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;e>i;++i)for(var o,u,a=n[i],s=a.length,l=r[i]=new Array(s),c=0;s>c;++c)(o=a[c])&&(u=t.call(o,o.__data__,c,a))&&("__data__"in o&&(u.__data__=o.__data__),l[c]=u);return new Et(r,this._parents)}function d(t){return function(){return this.querySelectorAll(t)}}function g(t){"function"!=typeof t&&(t=d(t));for(var n=this._groups,e=n.length,r=[],i=[],o=0;e>o;++o)for(var u,a=n[o],s=a.length,l=0;s>l;++l)(u=a[l])&&(r.push(t.call(u,u.__data__,l,a)),i.push(u));return new Et(r,i)}function m(t){"function"!=typeof t&&(t=or(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;e>i;++i)for(var o,u=n[i],a=u.length,s=r[i]=new Array(a),l=0;a>l;++l)(o=u[l])&&t.call(o,o.__data__,l,u)&&(s[l]=o);return new Et(r,this._parents)}function y(t){return function(){return t}}function v(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=lr+u.call(s,s.__data__,a,n),c[l]||(c[l]=s));for(a=0;h>a;++a)l=lr+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?_:v,r=this._parents,i=this._groups;"function"!=typeof t&&(t=y(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,g=a[l]=new Array(d),m=u[l]=new Array(d),w=s[l]=new Array(h);e(c,f,g,m,w,p,n);for(var b,x,M=0,A=0;d>M;++M)if(b=g[M]){for(M>=A&&(A=M+1);!(x=m[A])&&++A<d;);b._next=x||null}}return u=new Et(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 Et(this._enter||this._groups.map(x),this._parents)}function A(){return new Et(this._exit||this._groups.map(x),this._parents)}function N(t){for(var n=this._groups,e=t._groups,r=n.length,i=e.length,o=Math.min(r,i),u=new Array(r),a=0;o>a;++a)for(var s,l=n[a],c=e[a],f=l.length,h=u[a]=new Array(f),p=0;f>p;++p)(s=l[p]||c[p])&&(h[p]=s);for(;r>a;++a)u[a]=n[a];return new Et(u,this._parents)}function k(){for(var t=this._groups,n=-1,e=t.length;++n<e;)for(var r,i=t[n],o=i.length-1,u=i[o];--o>=0;)(r=i[o])&&(u&&u!==r.nextSibling&&u.parentNode.insertBefore(r,u),u=r);return this}function S(t){function n(n,e){return n&&e?t(n.__data__,e.__data__):!n-!e}t||(t=E);for(var e=this._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])&&(l[c]=u);l.sort(n)}return new Et(i,this._parents).order()}function E(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._groups,n=0,e=t.length;e>n;++n)for(var r=t[n],i=0,o=r.length;o>i;++i){var u=r[i];if(u)return u}return null}function z(){var t=0;return this.each(function(){++t}),t}function I(){return!this.node()}function T(t){for(var n=this._groups,e=0,r=n.length;r>e;++e)for(var i,o=n[e],u=0,a=o.length;a>u;++u)(i=o[u])&&t.call(i,i.__data__,u,o);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 gt(){this.parentNode.insertBefore(this,this.parentNode.firstChild)}function mt(){return this.each(gt)}function yt(t){return function(){return this.appendChild(t.apply(this,arguments))}}function vt(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?yt(e):vt(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 St(t,n){return this.each(("function"==typeof n?kt:Nt)(t,n))}function Et(t,n){this._groups=t,this._parents=n}function Pt(){return new Et([[document.documentElement]],cr)}function Ct(t){return"string"==typeof t?new Et([[document.querySelector(t)]],[document.documentElement]):new Et([[t]],cr)}function qt(){for(var t,n=0,e=arguments.length,r={};e>n;++n){if(!(t=arguments[n]+"")||t in r)throw new Error;r[t]=[]}return new zt(r)}function zt(t){this._=t}function It(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 Tt(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]=fr,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=e&&t.push({name:n,value:e}),t}function Ot(){return _r||(xr(Vt),_r=br.now()+wr)}function Vt(){_r=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(),++dr;for(var t,n=hr;n;)(t=_r-n._time)>=0&&n._call.call(null,t),n=n._next;--dr}function Rt(t){_r=(vr=t||br.now())+wr,dr=gr=0;try{Dt()}finally{dr=0,Yt(),_r=0}}function $t(){var t=br.now(),n=t-vr;n>yr&&(wr-=n,vr=t)}function Yt(){for(var t,n=hr,e=1/0;n;)n._call?(e>n._time&&(e=n._time),n=(t=n)._next):n=t?t._next=n._next:hr=n._next;pr=t,Bt(e)}function Bt(t){if(!dr){gr&&(gr=clearTimeout(gr));var n=t-_r;n>24?(1/0>t&&(gr=setTimeout(Rt,n)),mr&&(mr=clearInterval(mr))):(mr||(mr=setInterval($t,yr)),dr=1,xr(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:Mr,tween:Ar,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:Nr})}function Ut(t,n){var e=t.__transition;if(!e||!(e=e[n])||e.state>Nr)throw new Error("too late");return e}function Wt(t,n){var e=t.__transition;if(!e||!(e=e[n])||e.state>Sr)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=kr,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=Cr,c.timer.stop(),c.on.call("interrupt",t,t.__data__,c.index,c.group),delete a[i]):n>+i&&(c.state=Cr,c.timer.stop(),delete a[i]));if(Ht(function(){e.state===Er&&(e.timer.restart(o,e.delay,e.time),o(r))}),e.state=Sr,e.on.call("start",t,t.__data__,e.index,e.group),e.state===Sr){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=Pr,1),o=-1,s=u.length;++o<s;)u[o].call(null,i);if(e.state===Pr){e.state=Cr,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=Cr,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=Ir.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=Xr.exec(t))?new an(n[1],n[2],n[3],1):(n=Or.exec(t))?new an(255*n[1]/100,255*n[2]/100,255*n[3]/100,1):(n=Vr.exec(t))?rn(n[1],n[2],n[3],n[4]):(n=jr.exec(t))?rn(255*n[1]/100,255*n[2]/100,255*n[3]/100,n[4]):(n=Lr.exec(t))?sn(n[1],n[2]/100,n[3]/100,1):(n=Dr.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 gn)return new gn(t.l,t.a,t.b,t.opacity);if(t instanceof xn){var n=t.h*$r;return new gn(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=mn((.4124564*e+.3575761*r+.1804375*i)/Hr),u=mn((.2126729*e+.7151522*r+.072175*i)/Fr),a=mn((.0193339*e+.119192*r+.9503041*i)/Ur);return new gn(116*u-16,500*(o-u),200*(u-a),t.opacity)}function dn(t,n,e,r){return 1===arguments.length?pn(t):new gn(t,n,e,null==r?1:r)}function gn(t,n,e,r){this.l=+t,this.a=+n,this.b=+e,this.opacity=+r}function mn(t){return t>Jr?Math.pow(t,1/3):t/Gr+Wr}function yn(t){return t>Kr?t*t*t:Gr*(t-Wr)}function vn(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 gn||(t=pn(t));var n=Math.atan2(t.b,t.a)*Yr;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=(oi*r+ri*n-ii*e)/(oi+ri-ii),o=r-i,u=(ei*(e-i)-ti*o)/ni,a=Math.sqrt(u*u+o*o)/(ei*i*(1-i)),s=a?Math.atan2(u,o)*Yr-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 Sn(t,n){return function(e){return t+e*n}}function En(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?Sn(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?En(n,e,t):kn(isNaN(n)?e:n)}}function qn(t,n){var e=n-t;return e?Sn(t,e):kn(isNaN(t)?n:t)}function zn(t,n){return t=+t,n-=t,function(e){return t+n*e}}function In(t){return function(){return t}}function Tn(t){return function(n){return t(n)+""}}function Xn(t,n){var e,r,i,o=fi.lastIndex=hi.lastIndex=0,u=-1,a=[],s=[];for(t+="",n+="";(e=fi.exec(t))&&(r=hi.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=hi.lastIndex;return o<n.length&&(i=n.slice(o),a[u]?a[u]+=i:a[++u]=i),a.length<2?s[0]?Tn(s[0].x):In(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)*pi,skewX:Math.atan(a)*pi,scaleX:u,scaleY:s}}function Vn(t){if("none"===t)return di;ui||(ui=document.createElement("DIV"),ai=document.documentElement,si=document.defaultView),ui.style.transform=t,t=si.getComputedStyle(ai.appendChild(ui),null).getPropertyValue("transform"),ai.removeChild(ui);var n=t.slice(7,-1).split(",");return On(+n[0],+n[1],+n[2],+n[3],+n[4],+n[5])}function jn(t){li||(li=document.createElementNS("http://www.w3.org/2000/svg","g")),li.setAttribute("transform",null==t?"":t);var n=li.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 Cn(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=Cn,n}function Cn(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=Cn,n}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?ci:(e=nn(n))?(n=e,ci):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?mi: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){"function"!=typeof t&&(t=or(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;e>i;++i)for(var o,u=n[i],a=u.length,s=r[i]=new Array(a),l=0;a>l;++l)(o=u[l])&&t.call(o,o.__data__,l,u)&&(s[l]=o);return new Ce(r,this._parents,this._name,this._id)}function ce(t){if(t._id!==this._id)throw new Error;for(var n=this._groups,e=t._groups,r=n.length,i=e.length,o=Math.min(r,i),u=new Array(r),a=0;o>a;++a)for(var s,l=n[a],c=e[a],f=l.length,h=u[a]=new Array(f),p=0;f>p;++p)(s=l[p]||c[p])&&(h[p]=s);for(;r>a;++a)u[a]=n[a];return new Ce(u,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 ge(){return this.on("end.remove",de(this._id))}function me(t){var n=this._name,e=this._id;"function"!=typeof t&&(t=h(t));for(var r=this._groups,i=r.length,o=new Array(i),u=0;i>u;++u)for(var a,s,l=r[u],c=l.length,f=o[u]=new Array(c),p=0;c>p;++p)(a=l[p])&&(s=t.call(a,a.__data__,p,l))&&("__data__"in a&&(s.__data__=a.__data__),f[p]=s,Ft(f[p],n,e,p,f,Kt(a,e)));return new Ce(o,this._parents,n,e)}function ye(t){var n=this._name,e=this._id;"function"!=typeof t&&(t=d(t));for(var r=this._groups,i=r.length,o=[],u=[],a=0;i>a;++a)for(var s,l=r[a],c=l.length,f=0;c>f;++f)if(s=l[f]){for(var h,p=t.call(s,s.__data__,f,l),g=Kt(s,e),m=0,y=p.length;y>m;++m)(h=p[m])&&Ft(h,n,e,m,p,g);o.push(p),u.push(s)}return new Ce(o,u,n,e)}function ve(){return new yi(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+="")?gi: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 Se(t){return function(){var n=t(this);this.textContent=null==n?"":n}}function Ee(t){return this.tween("text","function"==typeof t?Se(Yn(this,"text",t)):ke(null==t?"":t+""))}function Pe(){for(var t=this._name,n=this._id,e=ze(),r=this._groups,i=r.length,o=0;i>o;++o)for(var u,a=r[o],s=a.length,l=0;s>l;++l)if(u=a[l]){var c=Kt(u,n);Ft(u,t,e,l,a,{time:c.time+c.delay+c.duration,delay:0,duration:c.duration,ease:c.ease})}return new Ce(r,this._parents,t,e)}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++vi}function Ie(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}function Te(t,n){for(var e;!(e=t.__transition)||!(e=e[n]);)if(!(t=t.parentNode))return Ni.time=Ot(),Ni;return e}function Xe(t){var n,e;t instanceof Ce?(n=t._id,t=t._name):(n=ze(),(e=Ni).time=Ot(),t=null==t?null:t+"");for(var r=this._groups,i=r.length,o=0;i>o;++o)for(var u,a=r[o],s=a.length,l=0;s>l;++l)(u=a[l])&&Ft(u,t,n,l,a,e||Te(u,n));return new Ce(r,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){var n=arguments.length<=1||void 0===arguments[1]?{"font-size":10,"font-family":"sans-serif"}:arguments[1],e=Ct("body").selectAll("canvas#d3plus-text-size").data([0]),r=e.enter().append("canvas").attr("id","d3plus-text-size").style("position","absolute").style("left","-9999px").style("top","-9999px").style("visibility","hidden").style("display","block").merge(e).node().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"]),r.font=i.join(" "),t instanceof Array?t.map(function(t){return r.measureText(t).width}):r.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(){function t(t){return t+"..."}function n(){void 0===m&&n.select(ki.select("body").append("svg").style("width",window.innerWidth+"px").style("height",window.innerHeight+"px").node());var t=m.selectAll(".d3plus-text-box").data(e,p);return t.exit().remove(),t.enter().append("text").attr("class","d3plus-text-box").attr("id",function(t,n){return"d3plus-text-box-"+p(t,n)}).merge(t).attr("y",function(t,n){return M(t,n)+"px"}).attr("fill",function(t,n){return u(t,n)}).attr("text-anchor",function(t,n){return _(t,n)}).attr("font-family",function(t,n){return a(t,n)}).each(function(t,n){function e(){if(A=1,N=[""],P>m)return void(N=[]);m>E&&(m=E);var t="",n=0;p&&(M=1.1*m,S["font-size"]=m,S["line-height"]=M),k=Ye(V,S);var r=!0,i=!1,u=void 0;try{for(var a,s=V[Symbol.iterator]();!(r=(a=s.next()).done);r=!0){var l=a.value,c=I.charAt(t.length+l.length),f=k[V.indexOf(l)];if(" "===c&&(l+=c),n+f>O-m){if(A++,M*A>C||f>O&&!q){if(p){if(m--,P>m){N=[];break}e()}else N[A-2]=o(N[A-2].trimRight());break}n=0,N.push(l)}else N[A-1]+=l;t+=l,n+=f," "===c&&(n+=z)}}catch(h){i=!0,u=h}finally{try{!r&&s["return"]&&s["return"]()}finally{if(i)throw u}}}function u(e){e.text(function(t){return t.trimRight()}).attr("x",x(t,n)+"px").attr("dx",j+"px").attr("dy",M+"px")}var p=c(t,n),m=p?s(t,n):f(t,n),M=p?1.1*m:d(t,n),A=1,N=[""],k=void 0,S={"font-family":a(t,n),"font-size":m,"line-height":M},E=s(t,n),P=l(t,n),C=h(t,n),q=g(t,n),z=Ye(" ",S),I=v(t,n),T=_(t,n),X=w(t,n),O=b(t,n),V=y(I,n),j="start"===T?0:"end"===T?O:O/2;if(C>M||p){if(p){k=Ye(V,S);var L=1.165+O/C*.1,D=O*C,R=ki.max(k),$=ki.sum(k,function(t){return t*M})*L;if(R>O||$>D){var Y=Math.sqrt(D/$),B=O/R,H=ki.min([Y,B]);m=Math.floor(m*H)}var F=Math.floor(.8*C);m>F&&(m=F)}e(),ki.select(this).attr("font-size",m+"px").style("font-size",m+"px")}var U=A*M,W="top"===X?0:"middle"===X?C/2-U/2:C-U;W-=.2*M,ki.select(this).transition().duration(i).attr("transform","translate(0,"+W+")");var K=ki.select(this).selectAll("tspan").data(N);K.transition().duration(i).call(u),K.exit().transition().duration(i).attr("opacity",0).remove(),K.enter().append("tspan").attr("dominant-baseline","alphabetic").style("baseline-shift","0%").attr("opacity",0).call(u).transition().duration(i).delay(r).attr("opacity",1)}),n}var e=arguments.length<=0||void 0===arguments[0]?[]:arguments[0],r=0,i=0,o=t,u=void 0,a=void 0,s=$e(50),l=$e(8),c=$e(!1),f=void 0,h=Be,p=He,d=void 0,g=$e(!1),m=void 0,y=Fe,v=Ue,_=$e("start"),w=$e("top"),b=We,x=Ke,M=Ge;return n.data=function(t){return arguments.length?(e=t,n):e},n.delay=function(t){return arguments.length?(r=t,n):r},n.duration=function(t){return arguments.length?(i=t,n):i},n.ellipsis=function(t){return arguments.length?(o="function"==typeof t?t:$e(t),n):o},n.fontColor=function(t){return arguments.length?(u="function"==typeof t?t:$e(t),n):u},n.fontFamily=function(t){return arguments.length?(a="function"==typeof t?t:$e(t),n):a},n.fontMax=function(t){return arguments.length?(s="function"==typeof t?t:$e(t),n):s},n.fontMin=function(t){return arguments.length?(l="function"==typeof t?t:$e(t),n):l},n.fontResize=function(t){return arguments.length?(c="function"==typeof t?t:$e(t),
n):c},n.fontSize=function(t){return arguments.length?(f="function"==typeof t?t:$e(t),void 0===d&&(d=$e(Math.ceil(1.1*f()))),n):f},n.height=function(t){return arguments.length?(h="function"==typeof t?t:$e(t),n):h},n.id=function(t){return arguments.length?(p="function"==typeof t?t:$e(t),n):p},n.lineHeight=function(t){return arguments.length?(d="function"==typeof t?t:$e(t),n):d},n.overflow=function(t){return arguments.length?(g="function"==typeof t?t:$e(t),n):g},n.select=function(t){return arguments.length?(m=ki.select(t),void 0===u&&n.fontColor(m.style("font-color")),void 0===a&&n.fontFamily(m.style("font-family")),void 0===f&&n.fontSize(parseFloat(m.style("font-size"),10)),n):m},n.split=function(t){return arguments.length?(y=t,n):y},n.text=function(t){return arguments.length?(v="function"==typeof t?t:$e(t),n):v},n.textAnchor=function(t){return arguments.length?(_="function"==typeof t?t:$e(t),n):_},n.verticalAlign=function(t){return arguments.length?(w="function"==typeof t?t:$e(t),n):w},n.width=function(t){return arguments.length?(b="function"==typeof t?t:$e(t),n):b},n.x=function(t){return arguments.length?(x="function"==typeof t?t:$e(t),n):x},n.y=function(t){return arguments.length?(M="function"==typeof t?t:$e(t),n):M},e.length?n():n}var Qe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t},Ze="0.4.1",tr="http://www.w3.org/1999/xhtml",nr={svg:"http://www.w3.org/2000/svg",xhtml:tr,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},er=function(t){return function(){return this.matches(t)}};if("undefined"!=typeof document){var rr=document.documentElement;if(!rr.matches){var ir=rr.webkitMatchesSelector||rr.msMatchesSelector||rr.mozMatchesSelector||rr.oMatchesSelector;er=function(t){return function(){return ir.call(this,t)}}}}var or=er,ur={},ar=null;if("undefined"!=typeof document){var sr=document.documentElement;"onmouseenter"in sr||(ur={mouseenter:"mouseover",mouseleave:"mouseout"})}var lr="$";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 cr=[null];Et.prototype=Pt.prototype={constructor:Et,select:p,selectAll:g,filter:m,data:w,enter:M,exit:A,merge:N,order:k,sort:S,call:P,nodes:C,node:q,size:z,empty:I,each:T,attr:R,style:H,property:K,classed:it,text:st,html:ht,raise:dt,lower:mt,append:wt,remove:xt,datum:Mt,on:c,dispatch:St};var fr=("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=It(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=Tt(r[e],t.name)))return e}},copy:function Pi(){var Pi={},t=this._;for(var n in t)Pi[n]=t[n].slice();return new zt(Pi)},call:function(t,n){if((e=arguments.length-2)>0)for(var e,r=new Array(e),i=0;e>i;++i)r[i]=arguments[i+2];this.apply(t,n,r)},apply:function(t,n,e){if(!this._.hasOwnProperty(t))throw new Error;for(var r=this._[t],i=0,o=r.length;o>i;++i)r[i].value.apply(n,e)}};var hr,pr,dr=0,gr=0,mr=0,yr=1e3,vr=0,_r=0,wr=0,br="object"===("undefined"==typeof performance?"undefined":Qe(performance))?performance:Date,xr="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||(pr?pr._next=this:hr=this,pr=this),this._call=t,this._time=e,Bt()},stop:function(){this._call&&(this._call=null,this._time=1/0,Bt())}};var Mr=qt("start","end","interrupt"),Ar=[],Nr=0,kr=1,Sr=2,Er=3,Pr=4,Cr=5,qr=.7,zr=1/qr,Ir=/^#([0-9a-f]{3})$/,Tr=/^#([0-9a-f]{6})$/,Xr=/^rgb\(\s*([-+]?\d+)\s*,\s*([-+]?\d+)\s*,\s*([-+]?\d+)\s*\)$/,Or=/^rgb\(\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*\)$/,Vr=/^rgba\(\s*([-+]?\d+)\s*,\s*([-+]?\d+)\s*,\s*([-+]?\d+)\s*,\s*([-+]?\d+(?:\.\d+)?)\s*\)$/,jr=/^rgba\(\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)\s*\)$/,Lr=/^hsl\(\s*([-+]?\d+(?:\.\d+)?)\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*\)$/,Dr=/^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?zr:Math.pow(zr,t),new an(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?qr:Math.pow(qr,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?zr:Math.pow(zr,t),new fn(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?qr:Math.pow(qr,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 $r=Math.PI/180,Yr=180/Math.PI,Br=18,Hr=.95047,Fr=1,Ur=1.08883,Wr=4/29,Kr=6/29,Gr=3*Kr*Kr,Jr=Kr*Kr*Kr;Qt(gn,dn,Zt(tn,{brighter:function(t){return new gn(this.l+Br*(null==t?1:t),this.a,this.b,this.opacity)},darker:function(t){return new gn(this.l-Br*(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=Fr*yn(t),n=Hr*yn(n),e=Ur*yn(e),new an(vn(3.2404542*n-1.5371385*t-.4985314*e),vn(-.969266*n+1.8760108*t+.041556*e),vn(.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+Br*(null==t?1:t),this.opacity)},darker:function(t){return new xn(this.h,this.c,this.l-Br*(null==t?1:t),this.opacity)},rgb:function(){return pn(this).rgb()}}));var Qr=-.14861,Zr=1.78277,ti=-.29227,ni=-.90649,ei=1.97294,ri=ei*ni,ii=ei*Zr,oi=Zr*ti-ni*Qr;Qt(Nn,An,Zt(tn,{brighter:function(t){return t=null==t?zr:Math.pow(zr,t),new Nn(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?qr:Math.pow(qr,t),new Nn(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=isNaN(this.h)?0:(this.h+120)*$r,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*(Qr*r+Zr*i)),255*(n+e*(ti*r+ni*i)),255*(n+e*(ei*r)),this.opacity)}}));var ui,ai,si,li,ci=function Ci(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=Ci,n}(1),fi=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,hi=new RegExp(fi.source,"g"),pi=180/Math.PI,di={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1},gi=Ln(Vn,"px, ","px)","deg)"),mi=Ln(jn,", ",")",")"),yi=Pt.prototype.constructor,vi=0,_i=Pt.prototype;Ce.prototype=qe.prototype={constructor:Ce,select:me,selectAll:ye,filter:le,merge:ce,selection:ve,transition:Pe,call:_i.call,nodes:_i.nodes,node:_i.node,size:_i.size,empty:_i.empty,each:_i.each,on:pe,attr:Jn,attrTween:te,style:Me,styleTween:Ne,text:Ee,remove:ge,tween:$n,delay:re,duration:ue,ease:se};var wi=3,bi=(function qi(t){function n(n){return Math.pow(n,t)}return t=+t,n.exponent=qi,n}(wi),function zi(t){function n(n){return 1-Math.pow(1-n,t)}return t=+t,n.exponent=zi,n}(wi),function Ii(t){function n(n){return((n*=2)<=1?Math.pow(n,t):2-Math.pow(2-n,t))/2}return t=+t,n.exponent=Ii,n}(wi),1.70158),xi=(function Ti(t){function n(n){return n*n*((t+1)*n-t)}return t=+t,n.overshoot=Ti,n}(bi),function Xi(t){function n(n){return--n*n*((t+1)*n+t)+1}return t=+t,n.overshoot=Xi,n}(bi),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}(bi),2*Math.PI),Mi=1,Ai=.3,Ni=(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/=xi);return e.amplitude=function(t){return Vi(t,n*xi)},e.period=function(n){return Vi(t,n)},e}(Mi,Ai),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/=xi);return e.amplitude=function(t){return ji(t,n*xi)},e.period=function(n){return ji(t,n)},e}(Mi,Ai),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/=xi);return e.amplitude=function(t){return Li(t,n*xi)},e.period=function(n){return Li(t,n)},e}(Mi,Ai),{time:null,delay:0,duration:250,ease:Ie});Pt.prototype.interrupt=Jt,Pt.prototype.transition=Xe;var ki=(Ve(Oe),{max:Le,min:De,select:Ct,sum:Re,transition:qe}),Si=["-","/",";",":","&"],Ei=new RegExp("[^\\s\\"+Si.join("\\")+"]+\\"+Si.join("?\\")+"?","g");t.version=Ze,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 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 (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-selection'), require('d3-transition'), require('d3-array')) :
typeof define === 'function' && define.amd ? define('d3plus-text', ['exports', 'd3-selection', 'd3-transition', 'd3-array'], factory) :
(factory((global.d3plus_text = {}),global.d3_selection,global.d3_transition,global.d3_array));
(factory((global.d3plus_text = global.d3plus_text || {}),global.d3_selection,global.d3_transition,global.d3_array));
}(this, function (exports,d3Selection,d3Transition,d3Array) { 'use strict';
var version = "0.4.1";
var version = "0.4.2";

@@ -13,3 +13,3 @@ /**

*/
function constant (x) {
function constant(x) {
return function constant() {

@@ -26,8 +26,7 @@ return x;

*/
function measure (text) {
var style = arguments.length <= 1 || arguments[1] === undefined ? { "font-size": 10, "font-family": "sans-serif" } : arguments[1];
function measure(text, style) {
var canvas = d3Selection.select("body").selectAll("canvas#d3plus-text-size").data([0]);
if ( style === void 0 ) style = {"font-size": 10, "font-family": "sans-serif"};
var context = canvas.enter().append("canvas").attr("id", "d3plus-text-size").style("position", "absolute").style("left", "-9999px").style("top", "-9999px").style("visibility", "hidden").style("display", "block").merge(canvas).node().getContext("2d");
var context = document.createElement("canvas").getContext("2d");

@@ -39,4 +38,4 @@ var font = [];

if ("font-size" in style) {
var s = style["font-size"] + "px";
if ("line-height" in style) s += "/" + style["line-height"] + "px";
var s = "" + (style["font-size"]) + "px";
if ("line-height" in style) s += "/" + (style["line-height"]) + "px";
font.push(s);

@@ -48,6 +47,5 @@ }

if (text instanceof Array) return text.map(function (t) {
return context.measureText(t).width;
});
if (text instanceof Array) return text.map(function (t) { return context.measureText(t).width; });
return context.measureText(text).width;
}

@@ -76,7 +74,7 @@

function boxId(d, i) {
return d.id || "" + i;
return d.id || ("" + i);
}
var splitChars = ["-", "/", ";", ":", "&"];
var splitRegex = new RegExp("[^\\s\\" + splitChars.join("\\") + "]+\\" + splitChars.join("?\\") + "?", "g");
var splitRegex = new RegExp(("[^\\s\\" + (splitChars.join("\\")) + "]+\\" + (splitChars.join("?\\")) + "?"), "g");
/**

@@ -122,2 +120,3 @@ The default word split function.

/**

@@ -140,5 +139,8 @@ @function box

</text>
@example <caption>this is shorthand for the following</caption>
box().data([data])();
@example <caption>which also allows a post-draw callback function</caption>
box().data([data])(function() { alert("draw complete!"); })
*/
function box () {
var data = arguments.length <= 0 || arguments[0] === undefined ? [] : arguments[0];
function box(data) {

@@ -149,4 +151,6 @@ /**

*/
if ( data === void 0 ) data = [];
function boxEllipsis(_) {
return _ + "...";
return ("" + _ + "...");
}

@@ -157,13 +161,13 @@

ellipsis = boxEllipsis,
fontColor = undefined,
fontFamily = undefined,
fontColor,
fontFamily,
fontMax = constant(50),
fontMin = constant(8),
fontResize = constant(false),
fontSize = undefined,
fontSize,
height = boxHeight,
id = boxId,
lineHeight = undefined,
lineHeight,
overflow = constant(false),
select = undefined,
select,
split = boxSplit,

@@ -181,5 +185,5 @@ text = boxText,

*/
function box() {
function box(callback) {
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());

@@ -190,168 +194,166 @@ var boxes = select.selectAll(".d3plus-text-box").data(data, id);

boxes.enter().append("text").attr("class", "d3plus-text-box").attr("id", function (d, i) {
return "d3plus-text-box-" + id(d, i);
}).merge(boxes).attr("y", function (d, i) {
return y(d, i) + "px";
}).attr("fill", function (d, i) {
return fontColor(d, i);
}).attr("text-anchor", function (d, i) {
return textAnchor(d, i);
}).attr("font-family", function (d, i) {
return fontFamily(d, i);
}).each(function (d, i) {
boxes.enter().append("text")
.attr("class", "d3plus-text-box")
.attr("id", function (d, i) { return ("d3plus-text-box-" + (id(d, i))); })
.merge(boxes)
.attr("y", function (d, i) { return ("" + (y(d, i)) + "px"); })
.attr("fill", function (d, i) { return fontColor(d, i); })
.attr("text-anchor", function (d, i) { return textAnchor(d, i); })
.attr("font-family", function (d, i) { return fontFamily(d, i); })
.each(function(d, i) {
var resize = fontResize(d, i);
var resize = fontResize(d, i);
var fS = resize ? fontMax(d, i) : fontSize(d, i),
lH = resize ? fS * 1.1 : lineHeight(d, i),
line = 1,
lineData = [""],
sizes = undefined;
var fS = resize ? fontMax(d, i) : fontSize(d, i),
lH = resize ? fS * 1.1 : lineHeight(d, i),
line = 1,
lineData = [""],
sizes;
var style = {
"font-family": fontFamily(d, i),
"font-size": fS,
"line-height": lH
};
var style = {
"font-family": fontFamily(d, i),
"font-size": fS,
"line-height": lH
};
var fMax = fontMax(d, i),
fMin = fontMin(d, i),
h = height(d, i),
oF = overflow(d, i),
space = measure(" ", style),
t = text(d, i),
tA = textAnchor(d, i),
vA = verticalAlign(d, i),
w = width(d, i),
words = split(t, i);
var fMax = fontMax(d, i),
fMin = fontMin(d, i),
h = height(d, i),
oF = overflow(d, i),
space = measure(" ", style),
t = text(d, i),
tA = textAnchor(d, i),
vA = verticalAlign(d, i),
w = width(d, i),
words = split(t, i);
var dx = tA === "start" ? 0 : tA === "end" ? w : w / 2;
var dx = tA === "start" ? 0 : tA === "end" ? w : w / 2;
/**
Figures out the lineData to be used for wrapping.
@private
*/
function checkSize() {
/**
Figures out the lineData to be used for wrapping.
@private
*/
function checkSize() {
line = 1;
lineData = [""];
line = 1;
lineData = [""];
if (fS < fMin) {
lineData = [];
return;
} else if (fS > fMax) fS = fMax;
if (fS < fMin) {
lineData = [];
return;
}
else if (fS > fMax) fS = fMax;
var textProg = "",
widthProg = 0;
var textProg = "",
widthProg = 0;
if (resize) {
lH = fS * 1.1;
style["font-size"] = fS;
style["line-height"] = lH;
}
if (resize) {
lH = fS * 1.1;
style["font-size"] = fS;
style["line-height"] = lH;
}
sizes = measure(words, style);
sizes = measure(words, style);
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
for (var _iterator = words[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var word = _step.value;
var nextChar = t.charAt(textProg.length + word.length),
wordWidth = sizes[words.indexOf(word)];
if (nextChar === " ") word += nextChar;
if (widthProg + wordWidth > w - fS) {
line++;
if (lH * line > h || wordWidth > w && !oF) {
if (resize) {
fS--;
if (fS < fMin) {
lineData = [];
break;
for (var i = 0; i < words.length; i++) {
var word = words[i];
var nextChar = t.charAt(textProg.length + word.length),
wordWidth = sizes[words.indexOf(word)];
if (nextChar === " ") word += nextChar;
if (widthProg + wordWidth > w - fS) {
line++;
if (lH * line > h || wordWidth > w && !oF) {
if (resize) {
fS--;
if (fS < fMin) {
lineData = [];
break;
}
checkSize();
}
checkSize();
} else lineData[line - 2] = ellipsis(lineData[line - 2].trimRight());
break;
else lineData[line - 2] = ellipsis(lineData[line - 2].trimRight());
break;
}
widthProg = 0;
lineData.push(word);
}
widthProg = 0;
lineData.push(word);
} else lineData[line - 1] += word;
textProg += word;
widthProg += wordWidth;
if (nextChar === " ") widthProg += space;
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator.return) {
_iterator.return();
else lineData[line - 1] += word;
textProg += word;
widthProg += wordWidth;
if (nextChar === " ") widthProg += space;
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}
}
if (h > lH || resize) {
if (h > lH || resize) {
if (resize) {
if (resize) {
sizes = measure(words, style);
sizes = measure(words, style);
var areaMod = 1.165 + w / h * 0.1,
boxArea = w * h,
maxWidth = d3.max(sizes),
textArea = d3.sum(sizes, function (d) {
return d * lH;
}) * areaMod;
var areaMod = 1.165 + w / h * 0.1,
boxArea = w * h,
maxWidth = d3.max(sizes),
textArea = d3.sum(sizes, function (d) { return d * lH; }) * areaMod;
if (maxWidth > w || textArea > boxArea) {
var areaRatio = Math.sqrt(boxArea / textArea),
widthRatio = w / maxWidth;
var sizeRatio = d3.min([areaRatio, widthRatio]);
fS = Math.floor(fS * sizeRatio);
if (maxWidth > w || textArea > boxArea) {
var areaRatio = Math.sqrt(boxArea / textArea),
widthRatio = w / maxWidth;
var sizeRatio = d3.min([areaRatio, widthRatio]);
fS = Math.floor(fS * sizeRatio);
}
var heightMax = Math.floor(h * 0.8);
if (fS > heightMax) fS = heightMax;
}
checkSize();
d3.select(this)
.attr("font-size", ("" + fS + "px"))
.style("font-size", ("" + fS + "px"));
}
var heightMax = Math.floor(h * 0.8);
if (fS > heightMax) fS = heightMax;
}
var tH = line * lH;
var y = vA === "top" ? 0 : vA === "middle" ? h / 2 - tH / 2 : h - tH;
y -= lH * 0.2;
checkSize();
d3.select(this).transition().duration(duration)
.attr("transform", ("translate(0," + y + ")"));
d3.select(this).attr("font-size", fS + "px").style("font-size", fS + "px");
}
/**
Styles to apply to each <tspan> element.
@private
*/
function tspanStyle(tspan) {
tspan
.text(function (d) { return d.trimRight(); })
.attr("x", ("" + (x(d, i)) + "px"))
.attr("dx", ("" + dx + "px"))
.attr("dy", ("" + lH + "px"));
}
var tH = line * lH;
var y = vA === "top" ? 0 : vA === "middle" ? h / 2 - tH / 2 : h - tH;
y -= lH * 0.2;
var tspans = d3.select(this).selectAll("tspan").data(lineData);
d3.select(this).transition().duration(duration).attr("transform", "translate(0," + y + ")");
tspans.transition().duration(duration).call(tspanStyle);
/**
Styles to apply to each <tspan> element.
@private
*/
function tspanStyle(tspan) {
tspan.text(function (d) {
return d.trimRight();
}).attr("x", x(d, i) + "px").attr("dx", dx + "px").attr("dy", lH + "px");
}
tspans.exit().transition().duration(duration)
.attr("opacity", 0).remove();
var tspans = d3.select(this).selectAll("tspan").data(lineData);
tspans.enter().append("tspan")
.attr("dominant-baseline", "alphabetic")
.style("baseline-shift", "0%")
.attr("opacity", 0)
.call(tspanStyle)
.transition().duration(duration).delay(delay)
.attr("opacity", 1);
tspans.transition().duration(duration).call(tspanStyle);
});
tspans.exit().transition().duration(duration).attr("opacity", 0).remove();
if (callback) setTimeout(callback, duration + 100);
tspans.enter().append("tspan").attr("dominant-baseline", "alphabetic").style("baseline-shift", "0%").attr("opacity", 0).call(tspanStyle).transition().duration(duration).delay(delay).attr("opacity", 1);
});
return box;
return box;
}

@@ -364,3 +366,3 @@

*/
box.data = function (_) {
box.data = function(_) {
return arguments.length ? (data = _, box) : data;

@@ -374,3 +376,3 @@ };

*/
box.delay = function (_) {
box.delay = function(_) {
return arguments.length ? (delay = _, box) : delay;

@@ -384,3 +386,3 @@ };

*/
box.duration = function (_) {
box.duration = function(_) {
return arguments.length ? (duration = _, box) : duration;

@@ -394,7 +396,7 @@ };

@example
function(d) {
function(d) {
return d + "...";
}
}
*/
box.ellipsis = function (_) {
box.ellipsis = function(_) {
return arguments.length ? (ellipsis = typeof _ === "function" ? _ : constant(_), box) : ellipsis;

@@ -408,3 +410,3 @@ };

*/
box.fontColor = function (_) {
box.fontColor = function(_) {
return arguments.length ? (fontColor = typeof _ === "function" ? _ : constant(_), box) : fontColor;

@@ -418,3 +420,3 @@ };

*/
box.fontFamily = function (_) {
box.fontFamily = function(_) {
return arguments.length ? (fontFamily = typeof _ === "function" ? _ : constant(_), box) : fontFamily;

@@ -428,3 +430,3 @@ };

*/
box.fontMax = function (_) {
box.fontMax = function(_) {
return arguments.length ? (fontMax = typeof _ === "function" ? _ : constant(_), box) : fontMax;

@@ -438,3 +440,3 @@ };

*/
box.fontMin = function (_) {
box.fontMin = function(_) {
return arguments.length ? (fontMin = typeof _ === "function" ? _ : constant(_), box) : fontMin;

@@ -448,3 +450,3 @@ };

*/
box.fontResize = function (_) {
box.fontResize = function(_) {
return arguments.length ? (fontResize = typeof _ === "function" ? _ : constant(_), box) : fontResize;

@@ -458,3 +460,3 @@ };

*/
box.fontSize = function (_) {
box.fontSize = function(_) {
if (arguments.length) {

@@ -473,7 +475,7 @@ fontSize = typeof _ === "function" ? _ : constant(_);

@example
function(d) {
function(d) {
return d.height || 200;
}
}
*/
box.height = function (_) {
box.height = function(_) {
return arguments.length ? (height = typeof _ === "function" ? _ : constant(_), box) : height;

@@ -487,7 +489,7 @@ };

@example
function(d, i) {
function(d, i) {
return d.id || i + "";
}
}
*/
box.id = function (_) {
box.id = function(_) {
return arguments.length ? (id = typeof _ === "function" ? _ : constant(_), box) : id;

@@ -501,3 +503,3 @@ };

*/
box.lineHeight = function (_) {
box.lineHeight = function(_) {
return arguments.length ? (lineHeight = typeof _ === "function" ? _ : constant(_), box) : lineHeight;

@@ -511,3 +513,3 @@ };

*/
box.overflow = function (_) {
box.overflow = function(_) {
return arguments.length ? (overflow = typeof _ === "function" ? _ : constant(_), box) : overflow;

@@ -521,3 +523,3 @@ };

*/
box.select = function (_) {
box.select = function(_) {
if (arguments.length) {

@@ -538,3 +540,3 @@ select = d3.select(_);

*/
box.split = function (_) {
box.split = function(_) {
return arguments.length ? (split = _, box) : split;

@@ -548,7 +550,7 @@ };

@example
function(d) {
function(d) {
return d.text;
}
}
*/
box.text = function (_) {
box.text = function(_) {
return arguments.length ? (text = typeof _ === "function" ? _ : constant(_), box) : text;

@@ -562,3 +564,3 @@ };

*/
box.textAnchor = function (_) {
box.textAnchor = function(_) {
return arguments.length ? (textAnchor = typeof _ === "function" ? _ : constant(_), box) : textAnchor;

@@ -572,3 +574,3 @@ };

*/
box.verticalAlign = function (_) {
box.verticalAlign = function(_) {
return arguments.length ? (verticalAlign = typeof _ === "function" ? _ : constant(_), box) : verticalAlign;

@@ -582,7 +584,7 @@ };

@example
function(d) {
function(d) {
return d.width || 200;
}
}
*/
box.width = function (_) {
box.width = function(_) {
return arguments.length ? (width = typeof _ === "function" ? _ : constant(_), box) : width;

@@ -596,7 +598,7 @@ };

@example
function(d) {
function(d) {
return d.x || 0;
}
}
*/
box.x = function (_) {
box.x = function(_) {
return arguments.length ? (x = typeof _ === "function" ? _ : constant(_), box) : x;

@@ -610,7 +612,7 @@ };

@example
function(d) {
function(d) {
return d.y || 0;
}
}
*/
box.y = function (_) {
box.y = function(_) {
return arguments.length ? (y = typeof _ === "function" ? _ : constant(_), box) : y;

@@ -620,2 +622,3 @@ };

return data.length ? box() : box;
}

@@ -622,0 +625,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.d3_selection,t.d3_transition,t.d3_array)}(this,function(t,n,e,i){"use strict";function r(t){return function(){return t}}function o(t){var e=arguments.length<=1||void 0===arguments[1]?{"font-size":10,"font-family":"sans-serif"}:arguments[1],i=n.select("body").selectAll("canvas#d3plus-text-size").data([0]),r=i.enter().append("canvas").attr("id","d3plus-text-size").style("position","absolute").style("left","-9999px").style("top","-9999px").style("visibility","hidden").style("display","block").merge(i).node().getContext("2d"),o=[];if("font-style"in e&&o.push(e["font-style"]),"font-variant"in e&&o.push(e["font-variant"]),"font-weight"in e&&o.push(e["font-weight"]),"font-size"in e){var u=e["font-size"]+"px";"line-height"in e&&(u+="/"+e["line-height"]+"px"),o.push(u)}return"font-family"in e&&o.push(e["font-family"]),r.font=o.join(" "),t instanceof Array?t.map(function(t){return r.measureText(t).width}):r.measureText(t).width}function u(t){return t.height||200}function a(t,n){return t.id||""+n}function f(t){return t.match(m)}function s(t){return t.text}function l(t){return t.width||200}function c(t){return t.x||0}function d(t){return t.y||0}function h(){function t(t){return t+"..."}function n(){void 0===q&&n.select(p.select("body").append("svg").style("width",window.innerWidth+"px").style("height",window.innerHeight+"px").node());var t=q.selectAll(".d3plus-text-box").data(e,A);return t.exit().remove(),t.enter().append("text").attr("class","d3plus-text-box").attr("id",function(t,n){return"d3plus-text-box-"+A(t,n)}).merge(t).attr("y",function(t,n){return H(t,n)+"px"}).attr("fill",function(t,n){return y(t,n)}).attr("text-anchor",function(t,n){return k(t,n)}).attr("font-family",function(t,n){return m(t,n)}).each(function(t,n){function e(){if(s=1,l=[""],A>a)return void(l=[]);a>y&&(a=y);var t="",n=0;u&&(f=1.1*a,d["font-size"]=a,d["line-height"]=f),c=o(D,d);var i=!0,r=!1,h=void 0;try{for(var p,m=D[Symbol.iterator]();!(i=(p=m.next()).done);i=!0){var x=p.value,v=E.charAt(t.length+x.length),b=c[D.indexOf(x)];if(" "===v&&(x+=v),n+b>B-a){if(s++,f*s>q||b>B&&!H){if(u){if(a--,A>a){l=[];break}e()}else l[s-2]=g(l[s-2].trimRight());break}n=0,l.push(x)}else l[s-1]+=x;t+=x,n+=b," "===v&&(n+=T)}}catch(w){r=!0,h=w}finally{try{!i&&m["return"]&&m["return"]()}finally{if(r)throw h}}}function r(e){e.text(function(t){return t.trimRight()}).attr("x",S(t,n)+"px").attr("dx",G+"px").attr("dy",f+"px")}var u=b(t,n),a=u?x(t,n):w(t,n),f=u?1.1*a:M(t,n),s=1,l=[""],c=void 0,d={"font-family":m(t,n),"font-size":a,"line-height":f},y=x(t,n),A=v(t,n),q=z(t,n),H=j(t,n),T=o(" ",d),E=_(t,n),O=k(t,n),W=C(t,n),B=F(t,n),D=R(E,n),G="start"===O?0:"end"===O?B:B/2;if(q>f||u){if(u){c=o(D,d);var I=1.165+B/q*.1,J=B*q,K=p.max(c),L=p.sum(c,function(t){return t*f})*I;if(K>B||L>J){var N=Math.sqrt(J/L),P=B/K,Q=p.min([N,P]);a=Math.floor(a*Q)}var U=Math.floor(.8*q);a>U&&(a=U)}e(),p.select(this).attr("font-size",a+"px").style("font-size",a+"px")}var V=s*f,X="top"===W?0:"middle"===W?q/2-V/2:q-V;X-=.2*f,p.select(this).transition().duration(h).attr("transform","translate(0,"+X+")");var Y=p.select(this).selectAll("tspan").data(l);Y.transition().duration(h).call(r),Y.exit().transition().duration(h).attr("opacity",0).remove(),Y.enter().append("tspan").attr("dominant-baseline","alphabetic").style("baseline-shift","0%").attr("opacity",0).call(r).transition().duration(h).delay(i).attr("opacity",1)}),n}var e=arguments.length<=0||void 0===arguments[0]?[]:arguments[0],i=0,h=0,g=t,y=void 0,m=void 0,x=r(50),v=r(8),b=r(!1),w=void 0,z=u,A=a,M=void 0,j=r(!1),q=void 0,R=f,_=s,k=r("start"),C=r("top"),F=l,S=c,H=d;return n.data=function(t){return arguments.length?(e=t,n):e},n.delay=function(t){return arguments.length?(i=t,n):i},n.duration=function(t){return arguments.length?(h=t,n):h},n.ellipsis=function(t){return arguments.length?(g="function"==typeof t?t:r(t),n):g},n.fontColor=function(t){return arguments.length?(y="function"==typeof t?t:r(t),n):y},n.fontFamily=function(t){return arguments.length?(m="function"==typeof t?t:r(t),n):m},n.fontMax=function(t){return arguments.length?(x="function"==typeof t?t:r(t),n):x},n.fontMin=function(t){return arguments.length?(v="function"==typeof t?t:r(t),n):v},n.fontResize=function(t){return arguments.length?(b="function"==typeof t?t:r(t),n):b},n.fontSize=function(t){return arguments.length?(w="function"==typeof t?t:r(t),void 0===M&&(M=r(Math.ceil(1.1*w()))),n):w},n.height=function(t){return arguments.length?(z="function"==typeof t?t:r(t),n):z},n.id=function(t){return arguments.length?(A="function"==typeof t?t:r(t),n):A},n.lineHeight=function(t){return arguments.length?(M="function"==typeof t?t:r(t),n):M},n.overflow=function(t){return arguments.length?(j="function"==typeof t?t:r(t),n):j},n.select=function(t){return arguments.length?(q=p.select(t),void 0===y&&n.fontColor(q.style("font-color")),void 0===m&&n.fontFamily(q.style("font-family")),void 0===w&&n.fontSize(parseFloat(q.style("font-size"),10)),n):q},n.split=function(t){return arguments.length?(R=t,n):R},n.text=function(t){return arguments.length?(_="function"==typeof t?t:r(t),n):_},n.textAnchor=function(t){return arguments.length?(k="function"==typeof t?t:r(t),n):k},n.verticalAlign=function(t){return arguments.length?(C="function"==typeof t?t:r(t),n):C},n.width=function(t){return arguments.length?(F="function"==typeof t?t:r(t),n):F},n.x=function(t){return arguments.length?(S="function"==typeof t?t:r(t),n):S},n.y=function(t){return arguments.length?(H="function"==typeof t?t:r(t),n):H},e.length?n():n}var g="0.4.1",p={max:i.max,min:i.min,select:n.select,sum:i.sum,transition:e.transition},y=["-","/",";",":","&"],m=new RegExp("[^\\s\\"+y.join("\\")+"]+\\"+y.join("?\\")+"?","g");t.version=g,t.box=h,t.width=o});
!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});
{
"name": "d3plus-text",
"version": "0.4.1",
"version": "0.4.2",
"description": "SVG text functions, including line wrapping with automatic font scaling.",

@@ -32,31 +32,30 @@ "main": "build/d3plus-text.js",

"babel-preset-es2015": "^6.6.0",
"babel-preset-es2015-rollup": "^1.1.1",
"babelify": "^7.2.0",
"browserify": "^13.0.0",
"eslint": "^2.7.0",
"faucet": "0.0.1",
"jsdoc-to-markdown": "^1.3.3",
"eslint": "^2.8.0",
"jsdoc-to-markdown": "^1.3.4",
"node-static": "^0.7.7",
"nodemon": "^1.8.1",
"rollup": "^0.25.1",
"rollup-plugin-babel": "^2.3.8",
"nodemon": "^1.9.1",
"rollup": "^0.26.0",
"rollup-plugin-buble": "^0.5.0",
"rollup-plugin-json": "^2.0.0",
"rollup-plugin-node-resolve": "^1.4.0",
"rollup-plugin-node-resolve": "^1.5.0",
"tap-spec": "^4.1.1",
"tape": "^4.5.1",
"tape-run": "^2.1.3",
"uglify-js": "^2.6.1"
"uglify-js": "^2.6.2"
},
"scripts": {
"dev": "npm run serve & nodemon --watch src/ -x \"npm run make:full\"",
"docs": "jsdoc2md 'src/**/*.js' -t README.hbs > README.md",
"lint": "eslint index.js src/* text/browser/*.js",
"make:lite": "mkdir -p build && rollup -c .rollup.js",
"make:full": "mkdir -p build && rollup -c .rollup.full.js",
"dev": "npm run serve & nodemon --watch src/ -x \"npm run make:full\"",
"docs": "jsdoc2md 'src/**/*.js' -t README.hbs > README.md",
"min:lite": "uglifyjs build/d3plus-text.js -c -m -o build/d3plus-text.min.js",
"min:full": "uglifyjs build/d3plus-text.full.js -c -m -o build/d3plus-text.full.min.js",
"lint": "eslint index.js src/* text/browser/*.js",
"release": "npm test && npm run docs && npm run make:lite && npm run make:full && npm run min:lite && npm run min:full && npm run zip && npm publish ./",
"serve": "static -p 4000",
"test": "npm run lint && browserify -t [ babelify --presets [ es2015 ] ] test/*.js | tape-run | faucet",
"test": "npm run lint && browserify -t [ babelify --presets [ es2015 ] ] test/*.js | tape-run --render='tap-spec'",
"zip": "rm -f build/d3plus-text.zip && zip -j build/d3plus-text.zip -- LICENSE README.md build/d3plus-text.js build/d3plus-text.min.js build/d3plus-text.full.js build/d3plus-text.full.min.js"
}
}

@@ -47,8 +47,2 @@ # d3plus-text

## ES6 Polyfill
This library was written in ES6 and compiled using Babel for use in modern browsers. If you'd like to use it in older browsers that may not support some features, you will need to include the Babel polyfill. We're hosting the latest version on [d3plus.org](https://d3plus.org), so just include this line before loading the library:
```html
<script src="http://d3plus.org/js/polyfill.min.js"></script>
```
Otherwise, [click here](https://github.com/d3plus/d3plus-text/releases/latest) to download the latest release.

@@ -79,2 +73,3 @@

<a name="box"></a>
## box([data])

@@ -108,2 +103,10 @@ Creates a wrapped text box based on an array of data. If *data* is specified, immediately wraps the text based on the specified array and returns this box generator. If *data* is not specified on instantiation, it can be passed/updated after instantiation using the [data](#box.data) method.

```
**Example** *(this is shorthand for the following)*
```js
box().data([data])();
```
**Example** *(which also allows a post-draw callback function)*
```js
box().data([data])(function() { alert("draw complete!"); })
```

@@ -135,2 +138,3 @@ * [box([data])](#box)

<a name="box.data"></a>
### box.data([*data*])

@@ -146,2 +150,3 @@ If *data* is specified, sets the data array to the specified array and returns this box generator. If *data* is not specified, returns the current data array. A text box will be drawn for each object in the array.

<a name="box.delay"></a>
### box.delay([*value*])

@@ -157,2 +162,3 @@ If *value* is specified, sets the animation delay to the specified number and returns this box generator. If *value* is not specified, returns the current animation delay.

<a name="box.duration"></a>
### box.duration([*value*])

@@ -168,2 +174,3 @@ If *value* is specified, sets the animation duration to the specified number and returns this box generator. If *value* is not specified, returns the current animation duration.

<a name="box.ellipsis"></a>
### box.ellipsis([*value*])

@@ -185,2 +192,3 @@ If *value* is specified, sets the ellipsis method to the specified function or string and returns this box generator. If *value* is not specified, returns the current ellipsis method, which simply adds an ellipsis to the string by default.

<a name="box.fontColor"></a>
### box.fontColor([*value*])

@@ -196,2 +204,3 @@ If *value* is specified, sets the font color accessor to the specified function or string and returns this box generator. If *value* is not specified, returns the current font color accessor, which is inferred from the [container element](#box.select) by default.

<a name="box.fontFamily"></a>
### box.fontFamily([*value*])

@@ -207,2 +216,3 @@ If *value* is specified, sets the font family accessor to the specified function or string and returns this box generator. If *value* is not specified, returns the current font family accessor, which is inferred from the [container element](#box.select) by default.

<a name="box.fontMax"></a>
### box.fontMax([*value*])

@@ -218,2 +228,3 @@ If *value* is specified, sets the maximum font size accessor to the specified function or number and returns this box generator. If *value* is not specified, returns the current maximum font size accessor. The maximum font size is used when [resizing fonts](#box.fontResize) dynamically.

<a name="box.fontMin"></a>
### box.fontMin([*value*])

@@ -229,2 +240,3 @@ If *value* is specified, sets the minimum font size accessor to the specified function or number and returns this box generator. If *value* is not specified, returns the current minimum font size accessor. The minimum font size is used when [resizing fonts](#box.fontResize) dynamically.

<a name="box.fontResize"></a>
### box.fontResize([*value*])

@@ -240,2 +252,3 @@ If *value* is specified, sets the font resizing accessor to the specified function or boolean and returns this box generator. If *value* is not specified, returns the current font resizing accessor.

<a name="box.fontSize"></a>
### box.fontSize([*value*])

@@ -251,2 +264,3 @@ If *value* is specified, sets the font size accessor to the specified function or number and returns this box generator. If *value* is not specified, returns the current font size accessor, which is inferred from the [container element](#box.select) by default.

<a name="box.height"></a>
### box.height([*value*])

@@ -268,2 +282,3 @@ If *value* is specified, sets the height accessor to the specified function or number and returns this box generator. If *value* is not specified, returns the current height accessor.

<a name="box.id"></a>
### box.id([*value*])

@@ -285,2 +300,3 @@ If *value* is specified, sets the id accessor to the specified function or number and returns this box generator. If *value* is not specified, returns the current id accessor.

<a name="box.lineHeight"></a>
### box.lineHeight([*value*])

@@ -296,2 +312,3 @@ If *value* is specified, sets the line height accessor to the specified function or number and returns this box generator. If *value* is not specified, returns the current line height accessor, which is 1.1 times the [font size](#box.fontSize) by default.

<a name="box.overflow"></a>
### box.overflow([*value*])

@@ -307,2 +324,3 @@ If *value* is specified, sets the overflow accessor to the specified function or boolean and returns this box generator. If *value* is not specified, returns the current overflow accessor.

<a name="box.select"></a>
### box.select([*selector*])

@@ -318,2 +336,3 @@ If *selector* is specified, sets the SVG container element to the specified d3 selector or DOM element and returns this box generator. If *selector* is not specified, returns the current SVG container element, which adds an SVG element to the page by default.

<a name="box.split"></a>
### box.split([*value*])

@@ -329,2 +348,3 @@ If *value* is specified, sets the word split function to the specified function and returns this box generator. If *value* is not specified, returns the current word split function.

<a name="box.text"></a>
### box.text([*value*])

@@ -346,2 +366,3 @@ If *value* is specified, sets the text accessor to the specified function or string and returns this box generator. If *value* is not specified, returns the current text accessor.

<a name="box.textAnchor"></a>
### box.textAnchor([*value*])

@@ -357,2 +378,3 @@ If *value* is specified, sets the horizontal text anchor accessor to the specified function or string and returns this box generator. If *value* is not specified, returns the current horizontal text anchor accessor.

<a name="box.verticalAlign"></a>
### box.verticalAlign([*value*])

@@ -368,2 +390,3 @@ If *value* is specified, sets the vertical alignment accessor to the specified function or string and returns this box generator. If *value* is not specified, returns the current vertical alignment accessor.

<a name="box.width"></a>
### box.width([*value*])

@@ -385,2 +408,3 @@ If *value* is specified, sets the width accessor to the specified function or number and returns this box generator. If *value* is not specified, returns the current width accessor.

<a name="box.x"></a>
### box.x([*value*])

@@ -402,2 +426,3 @@ If *value* is specified, sets the x accessor to the specified function or number and returns this box generator. If *value* is not specified, returns the current x accessor. The number returned should correspond to the left position of the box.

<a name="box.y"></a>
### box.y([*value*])

@@ -419,2 +444,3 @@ If *value* is specified, sets the y accessor to the specified function or number and returns this box generator. If *value* is not specified, returns the current y accessor. The number returned should correspond to the top position of the box.

<a name="width"></a>
## width(text, [style])

@@ -421,0 +447,0 @@ Given a text string, returns the predicted pixel width of the string when placed into DOM.

@@ -92,2 +92,6 @@ import {select as d3Select} from "d3-selection";

</text>
@example <caption>this is shorthand for the following</caption>
box().data([data])();
@example <caption>which also allows a post-draw callback function</caption>
box().data([data])(function() { alert("draw complete!"); })
*/

@@ -130,3 +134,3 @@ export default function(data = []) {

*/
function box() {
function box(callback) {

@@ -202,3 +206,4 @@ if (select === void 0) box.select(d3.select("body").append("svg").style("width", `${window.innerWidth}px`).style("height", `${window.innerHeight}px`).node());

for (let word of words) {
for (let i = 0; i < words.length; i++) {
let word = words[i];
const nextChar = t.charAt(textProg.length + word.length),

@@ -299,2 +304,4 @@ wordWidth = sizes[words.indexOf(word)];

if (callback) setTimeout(callback, duration + 100);
return box;

@@ -301,0 +308,0 @@

@@ -1,3 +0,1 @@

import {select} from "d3-selection";
/**

@@ -11,13 +9,4 @@ @function width

const canvas = select("body").selectAll("canvas#d3plus-text-size").data([0]);
const context = document.createElement("canvas").getContext("2d");
const context = canvas.enter().append("canvas")
.attr("id", "d3plus-text-size")
.style("position", "absolute")
.style("left", "-9999px")
.style("top", "-9999px")
.style("visibility", "hidden")
.style("display", "block")
.merge(canvas).node().getContext("2d");
const font = [];

@@ -24,0 +13,0 @@ if ("font-style" in style) font.push(style["font-style"]);

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc