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