interpolated-charts
Version:
Configurable d3 v4 charts with interpolation and missing data range
1 lines • 162 kB
JavaScript
!function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=0)}([function(t,e,n){t.exports=n(3)},function(t,e,n){},function(t,e,n){},function(t,e,n){"use strict";n.r(e);var r=function(t,e){return t<e?-1:t>e?1:t>=e?0:NaN},i=function(t){return 1===t.length&&(t=function(t){return function(e,n){return r(t(e),n)}}(t)),{left:function(e,n,r,i){for(null==r&&(r=0),null==i&&(i=e.length);r<i;){var a=r+i>>>1;t(e[a],n)<0?r=a+1:i=a}return r},right:function(e,n,r,i){for(null==r&&(r=0),null==i&&(i=e.length);r<i;){var a=r+i>>>1;t(e[a],n)>0?i=a:r=a+1}return r}}};var a=i(r),o=a.right,c=(a.left,o);var f=Array.prototype,u=(f.slice,f.map,Math.sqrt(50)),s=Math.sqrt(10),h=Math.sqrt(2),l=function(t,e,n){var r,i,a,o,c=-1;if(n=+n,(t=+t)===(e=+e)&&n>0)return[t];if((r=e<t)&&(i=t,t=e,e=i),0===(o=d(t,e,n))||!isFinite(o))return[];if(o>0)for(t=Math.ceil(t/o),e=Math.floor(e/o),a=new Array(i=Math.ceil(e-t+1));++c<i;)a[c]=(t+c)*o;else for(t=Math.floor(t*o),e=Math.ceil(e*o),a=new Array(i=Math.ceil(t-e+1));++c<i;)a[c]=(t-c)/o;return r&&a.reverse(),a};function d(t,e,n){var r=(e-t)/Math.max(0,n),i=Math.floor(Math.log(r)/Math.LN10),a=r/Math.pow(10,i);return i>=0?(a>=u?10:a>=s?5:a>=h?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(a>=u?10:a>=s?5:a>=h?2:1)}function p(t,e,n){var r=Math.abs(e-t)/Math.max(0,n),i=Math.pow(10,Math.floor(Math.log(r)/Math.LN10)),a=r/i;return a>=u?i*=10:a>=s?i*=5:a>=h&&(i*=2),e<t?-i:i}var _=function(t,e){var n,r,i=t.length,a=-1;if(null==e){for(;++a<i;)if(null!=(n=t[a])&&n>=n)for(r=n;++a<i;)null!=(n=t[a])&&n>r&&(r=n)}else for(;++a<i;)if(null!=(n=e(t[a],a,t))&&n>=n)for(r=n;++a<i;)null!=(n=e(t[a],a,t))&&n>r&&(r=n);return r},b=function(t){for(var e,n,r,i=t.length,a=-1,o=0;++a<i;)o+=t[a].length;for(n=new Array(o);--i>=0;)for(e=(r=t[i]).length;--e>=0;)n[--o]=r[e];return n},v=function(t,e){var n,r,i=t.length,a=-1;if(null==e){for(;++a<i;)if(null!=(n=t[a])&&n>=n)for(r=n;++a<i;)null!=(n=t[a])&&r>n&&(r=n)}else for(;++a<i;)if(null!=(n=e(t[a],a,t))&&n>=n)for(r=n;++a<i;)null!=(n=e(t[a],a,t))&&r>n&&(r=n);return r},g=function(t,e){var n,r=t.length,i=-1,a=0;if(null==e)for(;++i<r;)(n=+t[i])&&(a+=n);else for(;++i<r;)(n=+e(t[i],i,t))&&(a+=n);return a};var y=Array.prototype.slice,m=function(t){return t},x=1,w=2,M=3,T=4,k=1e-6;function A(t){return"translate("+(t+.5)+",0)"}function D(t){return"translate(0,"+(t+.5)+")"}function C(){return!this.__axis}function N(t,e){var n=[],r=null,i=null,a=6,o=6,c=3,f=t===x||t===T?-1:1,u=t===T||t===w?"x":"y",s=t===x||t===M?A:D;function h(h){var l=null==r?e.ticks?e.ticks.apply(e,n):e.domain():r,d=null==i?e.tickFormat?e.tickFormat.apply(e,n):m:i,p=Math.max(a,0)+c,_=e.range(),b=+_[0]+.5,v=+_[_.length-1]+.5,g=(e.bandwidth?function(t){var e=Math.max(0,t.bandwidth()-1)/2;return t.round()&&(e=Math.round(e)),function(n){return+t(n)+e}}:function(t){return function(e){return+t(e)}})(e.copy()),y=h.selection?h.selection():h,A=y.selectAll(".domain").data([null]),D=y.selectAll(".tick").data(l,e).order(),N=D.exit(),S=D.enter().append("g").attr("class","tick"),E=D.select("line"),L=D.select("text");A=A.merge(A.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),D=D.merge(S),E=E.merge(S.append("line").attr("stroke","currentColor").attr(u+"2",f*a)),L=L.merge(S.append("text").attr("fill","currentColor").attr(u,f*p).attr("dy",t===x?"0em":t===M?"0.71em":"0.32em")),h!==y&&(A=A.transition(h),D=D.transition(h),E=E.transition(h),L=L.transition(h),N=N.transition(h).attr("opacity",k).attr("transform",function(t){return isFinite(t=g(t))?s(t):this.getAttribute("transform")}),S.attr("opacity",k).attr("transform",function(t){var e=this.parentNode.__axis;return s(e&&isFinite(e=e(t))?e:g(t))})),N.remove(),A.attr("d",t===T||t==w?o?"M"+f*o+","+b+"H0.5V"+v+"H"+f*o:"M0.5,"+b+"V"+v:o?"M"+b+","+f*o+"V0.5H"+v+"V"+f*o:"M"+b+",0.5H"+v),D.attr("opacity",1).attr("transform",function(t){return s(g(t))}),E.attr(u+"2",f*a),L.attr(u,f*p).text(d),y.filter(C).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",t===w?"start":t===T?"end":"middle"),y.each(function(){this.__axis=g})}return h.scale=function(t){return arguments.length?(e=t,h):e},h.ticks=function(){return n=y.call(arguments),h},h.tickArguments=function(t){return arguments.length?(n=null==t?[]:y.call(t),h):n.slice()},h.tickValues=function(t){return arguments.length?(r=null==t?null:y.call(t),h):r&&r.slice()},h.tickFormat=function(t){return arguments.length?(i=t,h):i},h.tickSize=function(t){return arguments.length?(a=o=+t,h):a},h.tickSizeInner=function(t){return arguments.length?(a=+t,h):a},h.tickSizeOuter=function(t){return arguments.length?(o=+t,h):o},h.tickPadding=function(t){return arguments.length?(c=+t,h):c},h}function S(t){return N(M,t)}function E(t){return N(T,t)}var L={value:function(){}};function U(){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 F(r)}function F(t){this._=t}function P(t,e){for(var n,r=0,i=t.length;r<i;++r)if((n=t[r]).name===e)return n.value}function R(t,e,n){for(var r=0,i=t.length;r<i;++r)if(t[r].name===e){t[r]=L,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=n&&t.push({name:e,value:n}),t}F.prototype=U.prototype={constructor:F,on:function(t,e){var n,r=this._,i=function(t,e){return t.trim().split(/^|\s+/).map(function(t){var n="",r=t.indexOf(".");if(r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}})}(t+"",r),a=-1,o=i.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++a<o;)if(n=(t=i[a]).type)r[n]=R(r[n],t.name,e);else if(null==e)for(n in r)r[n]=R(r[n],t.name,null);return this}for(;++a<o;)if((n=(t=i[a]).type)&&(n=P(r[n],t.name)))return n},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new F(t)},call:function(t,e){if((n=arguments.length-2)>0)for(var n,r,i=new Array(n),a=0;a<n;++a)i[a]=arguments[a+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(a=0,n=(r=this._[t]).length;a<n;++a)r[a].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,a=r.length;i<a;++i)r[i].value.apply(e,n)}};var H=U,Y="http://www.w3.org/1999/xhtml",j={svg:"http://www.w3.org/2000/svg",xhtml:Y,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},O=function(t){var e=t+="",n=e.indexOf(":");return n>=0&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),j.hasOwnProperty(e)?{space:j[e],local:t}:t};var z=function(t){var e=O(t);return(e.local?function(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}:function(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===Y&&e.documentElement.namespaceURI===Y?e.createElement(t):e.createElementNS(n,t)}})(e)};function q(){}var V=function(t){return null==t?q:function(){return this.querySelector(t)}};function I(){return[]}var X=function(t){return null==t?I:function(){return this.querySelectorAll(t)}},$=function(t){return function(){return this.matches(t)}};if("undefined"!=typeof document){var W=document.documentElement;if(!W.matches){var B=W.webkitMatchesSelector||W.msMatchesSelector||W.mozMatchesSelector||W.oMatchesSelector;$=function(t){return function(){return B.call(this,t)}}}}var Z=$,Q=function(t){return new Array(t.length)};function J(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}J.prototype={constructor:J,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 G="$";function K(t,e,n,r,i,a){for(var o,c=0,f=e.length,u=a.length;c<u;++c)(o=e[c])?(o.__data__=a[c],r[c]=o):n[c]=new J(t,a[c]);for(;c<f;++c)(o=e[c])&&(i[c]=o)}function tt(t,e,n,r,i,a,o){var c,f,u,s={},h=e.length,l=a.length,d=new Array(h);for(c=0;c<h;++c)(f=e[c])&&(d[c]=u=G+o.call(f,f.__data__,c,e),u in s?i[c]=f:s[u]=f);for(c=0;c<l;++c)(f=s[u=G+o.call(t,a[c],c,a)])?(r[c]=f,f.__data__=a[c],s[u]=null):n[c]=new J(t,a[c]);for(c=0;c<h;++c)(f=e[c])&&s[d[c]]===f&&(i[c]=f)}function et(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}var nt=function(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView};function rt(t,e){return t.style.getPropertyValue(e)||nt(t).getComputedStyle(t,null).getPropertyValue(e)}function it(t){return t.trim().split(/^|\s+/)}function at(t){return t.classList||new ot(t)}function ot(t){this._node=t,this._names=it(t.getAttribute("class")||"")}function ct(t,e){for(var n=at(t),r=-1,i=e.length;++r<i;)n.add(e[r])}function ft(t,e){for(var n=at(t),r=-1,i=e.length;++r<i;)n.remove(e[r])}ot.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);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function ut(){this.textContent=""}function st(){this.innerHTML=""}function ht(){this.nextSibling&&this.parentNode.appendChild(this)}function lt(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function dt(){return null}function pt(){var t=this.parentNode;t&&t.removeChild(this)}function _t(){return this.parentNode.insertBefore(this.cloneNode(!1),this.nextSibling)}function bt(){return this.parentNode.insertBefore(this.cloneNode(!0),this.nextSibling)}var vt={},gt=null;"undefined"!=typeof document&&("onmouseenter"in document.documentElement||(vt={mouseenter:"mouseover",mouseleave:"mouseout"}));function yt(t,e,n){return t=mt(t,e,n),function(e){var n=e.relatedTarget;n&&(n===this||8&n.compareDocumentPosition(this))||t.call(this,e)}}function mt(t,e,n){return function(r){var i=gt;gt=r;try{t.call(this,this.__data__,e,n)}finally{gt=i}}}function xt(t){return function(){var e=this.__on;if(e){for(var n,r=0,i=-1,a=e.length;r<a;++r)n=e[r],t.type&&n.type!==t.type||n.name!==t.name?e[++i]=n:this.removeEventListener(n.type,n.listener,n.capture);++i?e.length=i:delete this.__on}}}function wt(t,e,n){var r=vt.hasOwnProperty(t.type)?yt:mt;return function(i,a,o){var c,f=this.__on,u=r(e,a,o);if(f)for(var s=0,h=f.length;s<h;++s)if((c=f[s]).type===t.type&&c.name===t.name)return this.removeEventListener(c.type,c.listener,c.capture),this.addEventListener(c.type,c.listener=u,c.capture=n),void(c.value=e);this.addEventListener(t.type,u,n),c={type:t.type,name:t.name,value:e,listener:u,capture:n},f?f.push(c):this.__on=[c]}}function Mt(t,e,n){var r=nt(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 Tt=[null];function kt(t,e){this._groups=t,this._parents=e}function At(){return new kt([[document.documentElement]],Tt)}kt.prototype=At.prototype={constructor:kt,select:function(t){"function"!=typeof t&&(t=V(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var a,o,c=e[i],f=c.length,u=r[i]=new Array(f),s=0;s<f;++s)(a=c[s])&&(o=t.call(a,a.__data__,s,c))&&("__data__"in a&&(o.__data__=a.__data__),u[s]=o);return new kt(r,this._parents)},selectAll:function(t){"function"!=typeof t&&(t=X(t));for(var e=this._groups,n=e.length,r=[],i=[],a=0;a<n;++a)for(var o,c=e[a],f=c.length,u=0;u<f;++u)(o=c[u])&&(r.push(t.call(o,o.__data__,u,c)),i.push(o));return new kt(r,i)},filter:function(t){"function"!=typeof t&&(t=Z(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var a,o=e[i],c=o.length,f=r[i]=[],u=0;u<c;++u)(a=o[u])&&t.call(a,a.__data__,u,o)&&f.push(a);return new kt(r,this._parents)},data:function(t,e){if(!t)return d=new Array(this.size()),u=-1,this.each(function(t){d[++u]=t}),d;var n=e?tt:K,r=this._parents,i=this._groups;"function"!=typeof t&&(t=function(t){return function(){return t}}(t));for(var a=i.length,o=new Array(a),c=new Array(a),f=new Array(a),u=0;u<a;++u){var s=r[u],h=i[u],l=h.length,d=t.call(s,s&&s.__data__,u,r),p=d.length,_=c[u]=new Array(p),b=o[u]=new Array(p);n(s,h,_,b,f[u]=new Array(l),d,e);for(var v,g,y=0,m=0;y<p;++y)if(v=_[y]){for(y>=m&&(m=y+1);!(g=b[m])&&++m<p;);v._next=g||null}}return(o=new kt(o,r))._enter=c,o._exit=f,o},enter:function(){return new kt(this._enter||this._groups.map(Q),this._parents)},exit:function(){return new kt(this._exit||this._groups.map(Q),this._parents)},merge:function(t){for(var e=this._groups,n=t._groups,r=e.length,i=n.length,a=Math.min(r,i),o=new Array(r),c=0;c<a;++c)for(var f,u=e[c],s=n[c],h=u.length,l=o[c]=new Array(h),d=0;d<h;++d)(f=u[d]||s[d])&&(l[d]=f);for(;c<r;++c)o[c]=e[c];return new kt(o,this._parents)},order:function(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var r,i=t[e],a=i.length-1,o=i[a];--a>=0;)(r=i[a])&&(o&&o!==r.nextSibling&&o.parentNode.insertBefore(r,o),o=r);return this},sort:function(t){function e(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}t||(t=et);for(var n=this._groups,r=n.length,i=new Array(r),a=0;a<r;++a){for(var o,c=n[a],f=c.length,u=i[a]=new Array(f),s=0;s<f;++s)(o=c[s])&&(u[s]=o);u.sort(e)}return new kt(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,a=r.length;i<a;++i){var o=r[i];if(o)return o}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,a=e[n],o=0,c=a.length;o<c;++o)(i=a[o])&&t.call(i,i.__data__,o,a);return this},attr:function(t,e){var n=O(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(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}:function(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}}: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 arguments.length>1?this.each((null==e?function(t){return function(){this.style.removeProperty(t)}}:"function"==typeof e?function(t,e,n){return function(){var r=e.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}:function(t,e,n){return function(){this.style.setProperty(t,e,n)}})(t,e,null==n?"":n)):rt(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?function(t){return function(){delete this[t]}}:"function"==typeof e?function(t,e){return function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}}:function(t,e){return function(){this[t]=e}})(t,e)):this.node()[t]},classed:function(t,e){var n=it(t+"");if(arguments.length<2){for(var r=at(this.node()),i=-1,a=n.length;++i<a;)if(!r.contains(n[i]))return!1;return!0}return this.each(("function"==typeof e?function(t,e){return function(){(e.apply(this,arguments)?ct:ft)(this,t)}}:e?function(t){return function(){ct(this,t)}}:function(t){return function(){ft(this,t)}})(n,e))},text:function(t){return arguments.length?this.each(null==t?ut:("function"==typeof t?function(t){return function(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}}:function(t){return function(){this.textContent=t}})(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?st:("function"==typeof t?function(t){return function(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}}:function(t){return function(){this.innerHTML=t}})(t)):this.node().innerHTML},raise:function(){return this.each(ht)},lower:function(){return this.each(lt)},append:function(t){var e="function"==typeof t?t:z(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})},insert:function(t,e){var n="function"==typeof t?t:z(t),r=null==e?dt:"function"==typeof e?e:V(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})},remove:function(){return this.each(pt)},clone:function(t){return this.select(t?bt:_t)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,e,n){var r,i,a=function(t){return t.trim().split(/^|\s+/).map(function(t){var e="",n=t.indexOf(".");return n>=0&&(e=t.slice(n+1),t=t.slice(0,n)),{type:t,name:e}})}(t+""),o=a.length;if(!(arguments.length<2)){for(c=e?wt:xt,null==n&&(n=!1),r=0;r<o;++r)this.each(c(a[r],e,n));return this}var c=this.node().__on;if(c)for(var f,u=0,s=c.length;u<s;++u)for(r=0,f=c[u];r<o;++r)if((i=a[r]).type===f.type&&i.name===f.name)return f.value},dispatch:function(t,e){return this.each(("function"==typeof e?function(t,e){return function(){return Mt(this,t,e.apply(this,arguments))}}:function(t,e){return function(){return Mt(this,t,e)}})(t,e))}};var Dt=At,Ct=function(t){return"string"==typeof t?new kt([[document.querySelector(t)]],[document.documentElement]):new kt([[t]],Tt)},Nt=0;function St(){this._="@"+(++Nt).toString(36)}St.prototype=function(){return new St}.prototype={constructor:St,get:function(t){for(var e=this._;!(e in t);)if(!(t=t.parentNode))return;return t[e]},set:function(t,e){return t[this._]=e},remove:function(t){return this._ in t&&delete t[this._]},toString:function(){return this._}};var Et=function(){for(var t,e=gt;t=e.sourceEvent;)e=t;return e},Lt=function(t,e){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,[(r=r.matrixTransform(t.getScreenCTM().inverse())).x,r.y]}var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]},Ut=function(t){var e=Et();return e.changedTouches&&(e=e.changedTouches[0]),Lt(t,e)};function Ft(t,e,n,r,i,a,o,c,f,u){this.target=t,this.type=e,this.subject=n,this.identifier=r,this.active=i,this.x=a,this.y=o,this.dx=c,this.dy=f,this._=u}Ft.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};var Pt=function(t,e,n){t.prototype=e.prototype=n,n.constructor=t};function Rt(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function Ht(){}var Yt="\\s*([+-]?\\d+)\\s*",jt="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",Ot="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",zt=/^#([0-9a-f]{3})$/,qt=/^#([0-9a-f]{6})$/,Vt=new RegExp("^rgb\\("+[Yt,Yt,Yt]+"\\)$"),It=new RegExp("^rgb\\("+[Ot,Ot,Ot]+"\\)$"),Xt=new RegExp("^rgba\\("+[Yt,Yt,Yt,jt]+"\\)$"),$t=new RegExp("^rgba\\("+[Ot,Ot,Ot,jt]+"\\)$"),Wt=new RegExp("^hsl\\("+[jt,Ot,Ot]+"\\)$"),Bt=new RegExp("^hsla\\("+[jt,Ot,Ot,jt]+"\\)$"),Zt={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 Qt(t){var e;return t=(t+"").trim().toLowerCase(),(e=zt.exec(t))?new ee((e=parseInt(e[1],16))>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):(e=qt.exec(t))?Jt(parseInt(e[1],16)):(e=Vt.exec(t))?new ee(e[1],e[2],e[3],1):(e=It.exec(t))?new ee(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=Xt.exec(t))?Gt(e[1],e[2],e[3],e[4]):(e=$t.exec(t))?Gt(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=Wt.exec(t))?re(e[1],e[2]/100,e[3]/100,1):(e=Bt.exec(t))?re(e[1],e[2]/100,e[3]/100,e[4]):Zt.hasOwnProperty(t)?Jt(Zt[t]):"transparent"===t?new ee(NaN,NaN,NaN,0):null}function Jt(t){return new ee(t>>16&255,t>>8&255,255&t,1)}function Gt(t,e,n,r){return r<=0&&(t=e=n=NaN),new ee(t,e,n,r)}function Kt(t){return t instanceof Ht||(t=Qt(t)),t?new ee((t=t.rgb()).r,t.g,t.b,t.opacity):new ee}function te(t,e,n,r){return 1===arguments.length?Kt(t):new ee(t,e,n,null==r?1:r)}function ee(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function ne(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function re(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new ae(t,e,n,r)}function ie(t,e,n,r){return 1===arguments.length?function(t){if(t instanceof ae)return new ae(t.h,t.s,t.l,t.opacity);if(t instanceof Ht||(t=Qt(t)),!t)return new ae;if(t instanceof ae)return t;var e=(t=t.rgb()).r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),a=Math.max(e,n,r),o=NaN,c=a-i,f=(a+i)/2;return c?(o=e===a?(n-r)/c+6*(n<r):n===a?(r-e)/c+2:(e-n)/c+4,c/=f<.5?a+i:2-a-i,o*=60):c=f>0&&f<1?0:o,new ae(o,c,f,t.opacity)}(t):new ae(t,e,n,null==r?1:r)}function ae(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function oe(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}Pt(Ht,Qt,{displayable:function(){return this.rgb().displayable()},hex:function(){return this.rgb().hex()},toString:function(){return this.rgb()+""}}),Pt(ee,te,Rt(Ht,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new ee(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new ee(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"#"+ne(this.r)+ne(this.g)+ne(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+")")}})),Pt(ae,ie,Rt(Ht,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new ae(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new ae(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 ee(oe(t>=240?t-240:t+120,i,r),oe(t,i,r),oe(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 ce=Math.PI/180,fe=180/Math.PI,ue=.96422,se=1,he=.82521,le=4/29,de=6/29,pe=3*de*de,_e=de*de*de;function be(t){if(t instanceof ge)return new ge(t.l,t.a,t.b,t.opacity);if(t instanceof ke){if(isNaN(t.h))return new ge(t.l,0,0,t.opacity);var e=t.h*ce;return new ge(t.l,Math.cos(e)*t.c,Math.sin(e)*t.c,t.opacity)}t instanceof ee||(t=Kt(t));var n,r,i=we(t.r),a=we(t.g),o=we(t.b),c=ye((.2225045*i+.7168786*a+.0606169*o)/se);return i===a&&a===o?n=r=c:(n=ye((.4360747*i+.3850649*a+.1430804*o)/ue),r=ye((.0139322*i+.0971045*a+.7141733*o)/he)),new ge(116*c-16,500*(n-c),200*(c-r),t.opacity)}function ve(t,e,n,r){return 1===arguments.length?be(t):new ge(t,e,n,null==r?1:r)}function ge(t,e,n,r){this.l=+t,this.a=+e,this.b=+n,this.opacity=+r}function ye(t){return t>_e?Math.pow(t,1/3):t/pe+le}function me(t){return t>de?t*t*t:pe*(t-le)}function xe(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function we(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Me(t){if(t instanceof ke)return new ke(t.h,t.c,t.l,t.opacity);if(t instanceof ge||(t=be(t)),0===t.a&&0===t.b)return new ke(NaN,0,t.l,t.opacity);var e=Math.atan2(t.b,t.a)*fe;return new ke(e<0?e+360:e,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}function Te(t,e,n,r){return 1===arguments.length?Me(t):new ke(t,e,n,null==r?1:r)}function ke(t,e,n,r){this.h=+t,this.c=+e,this.l=+n,this.opacity=+r}Pt(ge,ve,Rt(Ht,{brighter:function(t){return new ge(this.l+18*(null==t?1:t),this.a,this.b,this.opacity)},darker:function(t){return new ge(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 ee(xe(3.1338561*(e=ue*me(e))-1.6168667*(t=se*me(t))-.4906146*(n=he*me(n))),xe(-.9787684*e+1.9161415*t+.033454*n),xe(.0719453*e-.2289914*t+1.4052427*n),this.opacity)}})),Pt(ke,Te,Rt(Ht,{brighter:function(t){return new ke(this.h,this.c,this.l+18*(null==t?1:t),this.opacity)},darker:function(t){return new ke(this.h,this.c,this.l-18*(null==t?1:t),this.opacity)},rgb:function(){return be(this).rgb()}}));var Ae=-.29227,De=-.90649,Ce=1.97294,Ne=Ce*De,Se=1.78277*Ce,Ee=1.78277*Ae- -.14861*De;function Le(t,e,n,r){return 1===arguments.length?function(t){if(t instanceof Ue)return new Ue(t.h,t.s,t.l,t.opacity);t instanceof ee||(t=Kt(t));var e=t.r/255,n=t.g/255,r=t.b/255,i=(Ee*r+Ne*e-Se*n)/(Ee+Ne-Se),a=r-i,o=(Ce*(n-i)-Ae*a)/De,c=Math.sqrt(o*o+a*a)/(Ce*i*(1-i)),f=c?Math.atan2(o,a)*fe-120:NaN;return new Ue(f<0?f+360:f,c,i,t.opacity)}(t):new Ue(t,e,n,null==r?1:r)}function Ue(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function Fe(t,e,n,r,i){var a=t*t,o=a*t;return((1-3*t+3*a-o)*e+(4-6*a+3*o)*n+(1+3*t+3*a-3*o)*r+o*i)/6}Pt(Ue,Le,Rt(Ht,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new Ue(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new Ue(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=isNaN(this.h)?0:(this.h+120)*ce,e=+this.l,n=isNaN(this.s)?0:this.s*e*(1-e),r=Math.cos(t),i=Math.sin(t);return new ee(255*(e+n*(-.14861*r+1.78277*i)),255*(e+n*(Ae*r+De*i)),255*(e+n*(Ce*r)),this.opacity)}}));var Pe=function(t){return function(){return t}};function Re(t,e){return function(n){return t+n*e}}function He(t,e){var n=e-t;return n?Re(t,n>180||n<-180?n-360*Math.round(n/360):n):Pe(isNaN(t)?e:t)}function Ye(t){return 1==(t=+t)?je:function(e,n){return n-e?function(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}(e,n,t):Pe(isNaN(e)?n:e)}}function je(t,e){var n=e-t;return n?Re(t,n):Pe(isNaN(t)?e:t)}var Oe=function t(e){var n=Ye(e);function r(t,e){var r=n((t=te(t)).r,(e=te(e)).r),i=n(t.g,e.g),a=n(t.b,e.b),o=je(t.opacity,e.opacity);return function(e){return t.r=r(e),t.g=i(e),t.b=a(e),t.opacity=o(e),t+""}}return r.gamma=t,r}(1);function ze(t){return function(e){var n,r,i=e.length,a=new Array(i),o=new Array(i),c=new Array(i);for(n=0;n<i;++n)r=te(e[n]),a[n]=r.r||0,o[n]=r.g||0,c[n]=r.b||0;return a=t(a),o=t(o),c=t(c),r.opacity=1,function(t){return r.r=a(t),r.g=o(t),r.b=c(t),r+""}}}var qe=ze(function(t){var e=t.length-1;return function(n){var r=n<=0?n=0:n>=1?(n=1,e-1):Math.floor(n*e),i=t[r],a=t[r+1],o=r>0?t[r-1]:2*i-a,c=r<e-1?t[r+2]:2*a-i;return Fe((n-r/e)*e,o,i,a,c)}}),Ve=(ze(function(t){var e=t.length;return function(n){var r=Math.floor(((n%=1)<0?++n:n)*e),i=t[(r+e-1)%e],a=t[r%e],o=t[(r+1)%e],c=t[(r+2)%e];return Fe((n-r/e)*e,i,a,o,c)}}),function(t,e){return e-=t=+t,function(n){return t+e*n}}),Ie=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Xe=new RegExp(Ie.source,"g");var $e,We,Be,Ze,Qe=function(t,e){var n,r,i,a=Ie.lastIndex=Xe.lastIndex=0,o=-1,c=[],f=[];for(t+="",e+="";(n=Ie.exec(t))&&(r=Xe.exec(e));)(i=r.index)>a&&(i=e.slice(a,i),c[o]?c[o]+=i:c[++o]=i),(n=n[0])===(r=r[0])?c[o]?c[o]+=r:c[++o]=r:(c[++o]=null,f.push({i:o,x:Ve(n,r)})),a=Xe.lastIndex;return a<e.length&&(i=e.slice(a),c[o]?c[o]+=i:c[++o]=i),c.length<2?f[0]?function(t){return function(e){return t(e)+""}}(f[0].x):function(t){return function(){return t}}(e):(e=f.length,function(t){for(var n,r=0;r<e;++r)c[(n=f[r]).i]=n.x(t);return c.join("")})},Je=function(t,e){var n,r=typeof e;return null==e||"boolean"===r?Pe(e):("number"===r?Ve:"string"===r?(n=Qt(e))?(e=n,Oe):Qe:e instanceof Qt?Oe:e instanceof Date?function(t,e){var n=new Date;return e-=t=+t,function(r){return n.setTime(t+e*r),n}}:Array.isArray(e)?function(t,e){var n,r=e?e.length:0,i=t?Math.min(r,t.length):0,a=new Array(i),o=new Array(r);for(n=0;n<i;++n)a[n]=Je(t[n],e[n]);for(;n<r;++n)o[n]=e[n];return function(t){for(n=0;n<i;++n)o[n]=a[n](t);return o}}:"function"!=typeof e.valueOf&&"function"!=typeof e.toString||isNaN(e)?function(t,e){var n,r={},i={};for(n in null!==t&&"object"==typeof t||(t={}),null!==e&&"object"==typeof e||(e={}),e)n in t?r[n]=Je(t[n],e[n]):i[n]=e[n];return function(t){for(n in r)i[n]=r[n](t);return i}}:Ve)(t,e)},Ge=function(t,e){return e-=t=+t,function(n){return Math.round(t+e*n)}},Ke=180/Math.PI,tn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1},en=function(t,e,n,r,i,a){var o,c,f;return(o=Math.sqrt(t*t+e*e))&&(t/=o,e/=o),(f=t*n+e*r)&&(n-=t*f,r-=e*f),(c=Math.sqrt(n*n+r*r))&&(n/=c,r/=c,f/=c),t*r<e*n&&(t=-t,e=-e,f=-f,o=-o),{translateX:i,translateY:a,rotate:Math.atan2(e,t)*Ke,skewX:Math.atan(f)*Ke,scaleX:o,scaleY:c}};function nn(t,e,n,r){function i(t){return t.length?t.pop()+" ":""}return function(a,o){var c=[],f=[];return a=t(a),o=t(o),function(t,r,i,a,o,c){if(t!==i||r!==a){var f=o.push("translate(",null,e,null,n);c.push({i:f-4,x:Ve(t,i)},{i:f-2,x:Ve(r,a)})}else(i||a)&&o.push("translate("+i+e+a+n)}(a.translateX,a.translateY,o.translateX,o.translateY,c,f),function(t,e,n,a){t!==e?(t-e>180?e+=360:e-t>180&&(t+=360),a.push({i:n.push(i(n)+"rotate(",null,r)-2,x:Ve(t,e)})):e&&n.push(i(n)+"rotate("+e+r)}(a.rotate,o.rotate,c,f),function(t,e,n,a){t!==e?a.push({i:n.push(i(n)+"skewX(",null,r)-2,x:Ve(t,e)}):e&&n.push(i(n)+"skewX("+e+r)}(a.skewX,o.skewX,c,f),function(t,e,n,r,a,o){if(t!==n||e!==r){var c=a.push(i(a)+"scale(",null,",",null,")");o.push({i:c-4,x:Ve(t,n)},{i:c-2,x:Ve(e,r)})}else 1===n&&1===r||a.push(i(a)+"scale("+n+","+r+")")}(a.scaleX,a.scaleY,o.scaleX,o.scaleY,c,f),a=o=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 rn=nn(function(t){return"none"===t?tn:($e||($e=document.createElement("DIV"),We=document.documentElement,Be=document.defaultView),$e.style.transform=t,t=Be.getComputedStyle(We.appendChild($e),null).getPropertyValue("transform"),We.removeChild($e),t=t.slice(7,-1).split(","),en(+t[0],+t[1],+t[2],+t[3],+t[4],+t[5]))},"px, ","px)","deg)"),an=nn(function(t){return null==t?tn:(Ze||(Ze=document.createElementNS("http://www.w3.org/2000/svg","g")),Ze.setAttribute("transform",t),(t=Ze.transform.baseVal.consolidate())?(t=t.matrix,en(t.a,t.b,t.c,t.d,t.e,t.f)):tn)},", ",")",")");Math.SQRT2;function on(t){return function(e,n){var r=t((e=ie(e)).h,(n=ie(n)).h),i=je(e.s,n.s),a=je(e.l,n.l),o=je(e.opacity,n.opacity);return function(t){return e.h=r(t),e.s=i(t),e.l=a(t),e.opacity=o(t),e+""}}}on(He),on(je);function cn(t){return function(e,n){var r=t((e=Te(e)).h,(n=Te(n)).h),i=je(e.c,n.c),a=je(e.l,n.l),o=je(e.opacity,n.opacity);return function(t){return e.h=r(t),e.c=i(t),e.l=a(t),e.opacity=o(t),e+""}}}cn(He),cn(je);function fn(t){return function e(n){function r(e,r){var i=t((e=Le(e)).h,(r=Le(r)).h),a=je(e.s,r.s),o=je(e.l,r.l),c=je(e.opacity,r.opacity);return function(t){return e.h=i(t),e.s=a(t),e.l=o(Math.pow(t,n)),e.opacity=c(t),e+""}}return n=+n,r.gamma=e,r}(1)}fn(He);var un=fn(je);var sn,hn,ln=0,dn=0,pn=0,_n=1e3,bn=0,vn=0,gn=0,yn="object"==typeof performance&&performance.now?performance:Date,mn="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function xn(){return vn||(mn(wn),vn=yn.now()+gn)}function wn(){vn=0}function Mn(){this._call=this._time=this._next=null}function Tn(t,e,n){var r=new Mn;return r.restart(t,e,n),r}function kn(){vn=(bn=yn.now())+gn,ln=dn=0;try{!function(){xn(),++ln;for(var t,e=sn;e;)(t=vn-e._time)>=0&&e._call.call(null,t),e=e._next;--ln}()}finally{ln=0,function(){var t,e,n=sn,r=1/0;for(;n;)n._call?(r>n._time&&(r=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:sn=e);hn=t,Dn(r)}(),vn=0}}function An(){var t=yn.now(),e=t-bn;e>_n&&(gn-=e,bn=t)}function Dn(t){ln||(dn&&(dn=clearTimeout(dn)),t-vn>24?(t<1/0&&(dn=setTimeout(kn,t-yn.now()-gn)),pn&&(pn=clearInterval(pn))):(pn||(bn=yn.now(),pn=setInterval(An,_n)),ln=1,mn(kn)))}Mn.prototype=Tn.prototype={constructor:Mn,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?xn():+n)+(null==e?0:+e),this._next||hn===this||(hn?hn._next=this:sn=this,hn=this),this._call=t,this._time=n,Dn()},stop:function(){this._call&&(this._call=null,this._time=1/0,Dn())}};var Cn=function(t,e,n){var r=new Mn;return e=null==e?0:+e,r.restart(function(n){r.stop(),t(n+e)},e,n),r},Nn=H("start","end","interrupt"),Sn=[],En=0,Ln=1,Un=2,Fn=3,Pn=4,Rn=5,Hn=6,Yn=function(t,e,n,r,i,a){var o=t.__transition;if(o){if(n in o)return}else t.__transition={};!function(t,e,n){var r,i=t.__transition;function a(f){var u,s,h,l;if(n.state!==Ln)return c();for(u in i)if((l=i[u]).name===n.name){if(l.state===Fn)return Cn(a);l.state===Pn?(l.state=Hn,l.timer.stop(),l.on.call("interrupt",t,t.__data__,l.index,l.group),delete i[u]):+u<e&&(l.state=Hn,l.timer.stop(),delete i[u])}if(Cn(function(){n.state===Fn&&(n.state=Pn,n.timer.restart(o,n.delay,n.time),o(f))}),n.state=Un,n.on.call("start",t,t.__data__,n.index,n.group),n.state===Un){for(n.state=Fn,r=new Array(h=n.tween.length),u=0,s=-1;u<h;++u)(l=n.tween[u].value.call(t,t.__data__,n.index,n.group))&&(r[++s]=l);r.length=s+1}}function o(e){for(var i=e<n.duration?n.ease.call(null,e/n.duration):(n.timer.restart(c),n.state=Rn,1),a=-1,o=r.length;++a<o;)r[a].call(null,i);n.state===Rn&&(n.on.call("end",t,t.__data__,n.index,n.group),c())}function c(){for(var r in n.state=Hn,n.timer.stop(),delete i[e],i)return;delete t.__transition}i[e]=n,n.timer=Tn(function(t){n.state=Ln,n.timer.restart(a,n.delay,n.time),n.delay<=t&&a(t-n.delay)},0,n.time)}(t,n,{name:e,index:r,group:i,on:Nn,tween:Sn,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:En})};function jn(t,e){var n=zn(t,e);if(n.state>En)throw new Error("too late; already scheduled");return n}function On(t,e){var n=zn(t,e);if(n.state>Un)throw new Error("too late; already started");return n}function zn(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}var qn=function(t,e){var n,r,i,a=t.__transition,o=!0;if(a){for(i in e=null==e?null:e+"",a)(n=a[i]).name===e?(r=n.state>Un&&n.state<Rn,n.state=Hn,n.timer.stop(),r&&n.on.call("interrupt",t,t.__data__,n.index,n.group),delete a[i]):o=!1;o&&delete t.__transition}};function Vn(t,e,n){var r=t._id;return t.each(function(){var t=On(this,r);(t.value||(t.value={}))[e]=n.apply(this,arguments)}),function(t){return zn(t,r).value[e]}}var In=function(t,e){var n;return("number"==typeof e?Ve:e instanceof Qt?Oe:(n=Qt(e))?(e=n,Oe):Qe)(t,e)};var Xn=Dt.prototype.constructor;var $n=0;function Wn(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function Bn(){return++$n}var Zn=Dt.prototype;function Qn(t){return((t*=2)<=1?t*t:--t*(2-t)+1)/2}Wn.prototype=function(t){return Dt().transition(t)}.prototype={constructor:Wn,select:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=V(t));for(var r=this._groups,i=r.length,a=new Array(i),o=0;o<i;++o)for(var c,f,u=r[o],s=u.length,h=a[o]=new Array(s),l=0;l<s;++l)(c=u[l])&&(f=t.call(c,c.__data__,l,u))&&("__data__"in c&&(f.__data__=c.__data__),h[l]=f,Yn(h[l],e,n,l,h,zn(c,n)));return new Wn(a,this._parents,e,n)},selectAll:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=X(t));for(var r=this._groups,i=r.length,a=[],o=[],c=0;c<i;++c)for(var f,u=r[c],s=u.length,h=0;h<s;++h)if(f=u[h]){for(var l,d=t.call(f,f.__data__,h,u),p=zn(f,n),_=0,b=d.length;_<b;++_)(l=d[_])&&Yn(l,e,n,_,d,p);a.push(d),o.push(f)}return new Wn(a,o,e,n)},filter:function(t){"function"!=typeof t&&(t=Z(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var a,o=e[i],c=o.length,f=r[i]=[],u=0;u<c;++u)(a=o[u])&&t.call(a,a.__data__,u,o)&&f.push(a);return new Wn(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,a=Math.min(r,i),o=new Array(r),c=0;c<a;++c)for(var f,u=e[c],s=n[c],h=u.length,l=o[c]=new Array(h),d=0;d<h;++d)(f=u[d]||s[d])&&(l[d]=f);for(;c<r;++c)o[c]=e[c];return new Wn(o,this._parents,this._name,this._id)},selection:function(){return new Xn(this._groups,this._parents)},transition:function(){for(var t=this._name,e=this._id,n=Bn(),r=this._groups,i=r.length,a=0;a<i;++a)for(var o,c=r[a],f=c.length,u=0;u<f;++u)if(o=c[u]){var s=zn(o,e);Yn(o,t,n,u,c,{time:s.time+s.delay+s.duration,delay:0,duration:s.duration,ease:s.ease})}return new Wn(r,this._parents,t,n)},call:Zn.call,nodes:Zn.nodes,node:Zn.node,size:Zn.size,empty:Zn.empty,each:Zn.each,on:function(t,e){var n=this._id;return arguments.length<2?zn(this.node(),n).on.on(t):this.each(function(t,e,n){var r,i,a=function(t){return(t+"").trim().split(/^|\s+/).every(function(t){var e=t.indexOf(".");return e>=0&&(t=t.slice(0,e)),!t||"start"===t})}(e)?jn:On;return function(){var o=a(this,t),c=o.on;c!==r&&(i=(r=c).copy()).on(e,n),o.on=i}}(n,t,e))},attr:function(t,e){var n=O(t),r="transform"===n?an:In;return this.attrTween(t,"function"==typeof e?(n.local?function(t,e,n){var r,i,a;return function(){var o,c=n(this);if(null!=c)return(o=this.getAttributeNS(t.space,t.local))===c?null:o===r&&c===i?a:a=e(r=o,i=c);this.removeAttributeNS(t.space,t.local)}}:function(t,e,n){var r,i,a;return function(){var o,c=n(this);if(null!=c)return(o=this.getAttribute(t))===c?null:o===r&&c===i?a:a=e(r=o,i=c);this.removeAttribute(t)}})(n,r,Vn(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(t,e,n){var r,i;return function(){var a=this.getAttributeNS(t.space,t.local);return a===n?null:a===r?i:i=e(r=a,n)}}:function(t,e,n){var r,i;return function(){var a=this.getAttribute(t);return a===n?null:a===r?i:i=e(r=a,n)}})(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=O(t);return this.tween(n,(r.local?function(t,e){function n(){var n=this,r=e.apply(n,arguments);return r&&function(e){n.setAttributeNS(t.space,t.local,r(e))}}return n._value=e,n}:function(t,e){function n(){var n=this,r=e.apply(n,arguments);return r&&function(e){n.setAttribute(t,r(e))}}return n._value=e,n})(r,e))},style:function(t,e,n){var r="transform"==(t+="")?rn:In;return null==e?this.styleTween(t,function(t,e){var n,r,i;return function(){var a=rt(this,t),o=(this.style.removeProperty(t),rt(this,t));return a===o?null:a===n&&o===r?i:i=e(n=a,r=o)}}(t,r)).on("end.style."+t,function(t){return function(){this.style.removeProperty(t)}}(t)):this.styleTween(t,"function"==typeof e?function(t,e,n){var r,i,a;return function(){var o=rt(this,t),c=n(this);return null==c&&(this.style.removeProperty(t),c=rt(this,t)),o===c?null:o===r&&c===i?a:a=e(r=o,i=c)}}(t,r,Vn(this,"style."+t,e)):function(t,e,n){var r,i;return function(){var a=rt(this,t);return a===n?null:a===r?i:i=e(r=a,n)}}(t,r,e+""),n)},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(t,e,n){function r(){var r=this,i=e.apply(r,arguments);return i&&function(e){r.style.setProperty(t,i(e),n)}}return r._value=e,r}(t,e,null==n?"":n))},text:function(t){return this.tween("text","function"==typeof t?function(t){return function(){var e=t(this);this.textContent=null==e?"":e}}(Vn(this,"text",t)):function(t){return function(){this.textContent=t}}(null==t?"":t+""))},remove:function(){return this.on("end.remove",function(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}(this._id))},tween:function(t,e){var n=this._id;if(t+="",arguments.length<2){for(var r,i=zn(this.node(),n).tween,a=0,o=i.length;a<o;++a)if((r=i[a]).name===t)return r.value;return null}return this.each((null==e?function(t,e){var n,r;return function(){var i=On(this,t),a=i.tween;if(a!==n)for(var o=0,c=(r=n=a).length;o<c;++o)if(r[o].name===e){(r=r.slice()).splice(o,1);break}i.tween=r}}:function(t,e,n){var r,i;if("function"!=typeof n)throw new Error;return function(){var a=On(this,t),o=a.tween;if(o!==r){i=(r=o).slice();for(var c={name:e,value:n},f=0,u=i.length;f<u;++f)if(i[f].name===e){i[f]=c;break}f===u&&i.push(c)}a.tween=i}})(n,t,e))},delay:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?function(t,e){return function(){jn(this,t).delay=+e.apply(this,arguments)}}:function(t,e){return e=+e,function(){jn(this,t).delay=e}})(e,t)):zn(this.node(),e).delay},duration:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?function(t,e){return function(){On(this,t).duration=+e.apply(this,arguments)}}:function(t,e){return e=+e,function(){On(this,t).duration=e}})(e,t)):zn(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(){On(this,t).ease=e}}(e,t)):zn(this.node(),e).ease}};(function t(e){function n(t){return Math.pow(t,e)}return e=+e,n.exponent=t,n})(3),function t(e){function n(t){return 1-Math.pow(1-t,e)}return e=+e,n.exponent=t,n}(3),function t(e){function n(t){return((t*=2)<=1?Math.pow(t,e):2-Math.pow(2-t,e))/2}return e=+e,n.exponent=t,n}(3),Math.PI;(function t(e){function n(t){return t*t*((e+1)*t-e)}return e=+e,n.overshoot=t,n})(1.70158),function t(e){function n(t){return--t*t*((e+1)*t+e)+1}return e=+e,n.overshoot=t,n}(1.70158),function t(e){function n(t){return((t*=2)<1?t*t*((e+1)*t-e):(t-=2)*t*((e+1)*t+e)+2)/2}return e=+e,n.overshoot=t,n}(1.70158);var Jn=2*Math.PI,Gn=(function t(e,n){var r=Math.asin(1/(e=Math.max(1,e)))*(n/=Jn);function i(t){return e*Math.pow(2,10*--t)*Math.sin((r-t)/n)}return i.amplitude=function(e){return t(e,n*Jn)},i.period=function(n){return t(e,n)},i}(1,.3),function t(e,n){var r=Math.asin(1/(e=Math.max(1,e)))*(n/=Jn);function i(t){return 1-e*Math.pow(2,-10*(t=+t))*Math.sin((t+r)/n)}return i.amplitude=function(e){return t(e,n*Jn)},i.period=function(n){return t(e,n)},i}(1,.3),function t(e,n){var r=Math.asin(1/(e=Math.max(1,e)))*(n/=Jn);function i(t){return((t=2*t-1)<0?e*Math.pow(2,10*t)*Math.sin((r-t)/n):2-e*Math.pow(2,-10*t)*Math.sin((r+t)/n))/2}return i.amplitude=function(e){return t(e,n*Jn)},i.period=function(n){return t(e,n)},i}(1,.3),{time:null,delay:0,duration:250,ease:function(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}});function Kn(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))return Gn.time=xn(),Gn;return n}Dt.prototype.interrupt=function(t){return this.each(function(){qn(this,t)})},Dt.prototype.transition=function(t){var e,n;t instanceof Wn?(e=t._id,t=t._name):(e=Bn(),(n=Gn).time=xn(),t=null==t?null:t+"");for(var r=this._groups,i=r.length,a=0;a<i;++a)for(var o,c=r[a],f=c.length,u=0;u<f;++u)(o=c[u])&&Yn(o,t,e,u,c,n||Kn(o,e));return new Wn(r,this._parents,t,e)};["e","w"].map(tr),["n","s"].map(tr),["n","e","s","w","nw","ne","se","sw"].map(tr);function tr(t){return{type:t}}Math.cos,Math.sin,Math.PI,Math.max;Array.prototype.slice;var er=Math.PI,nr=2*er,rr=nr-1e-6;function ir(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function ar(){return new ir}ir.prototype=ar.prototype={constructor:ir,moveTo:function(t,e){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)},closePath:function(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(t,e){this._+="L"+(this._x1=+t)+","+(this._y1=+e)},quadraticCurveTo:function(t,e,n,r){this._+="Q"+ +t+","+ +e+","+(this._x1=+n)+","+(this._y1=+r)},bezierCurveTo:function(t,e,n,r,i,a){this._+="C"+ +t+","+ +e+","+ +n+","+ +r+","+(this._x1=+i)+","+(this._y1=+a)},arcTo:function(t,e,n,r,i){t=+t,e=+e,n=+n,r=+r,i=+i;var a=this._x1,o=this._y1,c=n-t,f=r-e,u=a-t,s=o-e,h=u*u+s*s;if(i<0)throw new Error("negative radius: "+i);if(null===this._x1)this._+="M"+(this._x1=t)+","+(this._y1=e);else if(h>1e-6)if(Math.abs(s*c-f*u)>1e-6&&i){var l=n-a,d=r-o,p=c*c+f*f,_=l*l+d*d,b=Math.sqrt(p),v=Math.sqrt(h),g=i*Math.tan((er-Math.acos((p+h-_)/(2*b*v)))/2),y=g/v,m=g/b;Math.abs(y-1)>1e-6&&(this._+="L"+(t+y*u)+","+(e+y*s)),this._+="A"+i+","+i+",0,0,"+ +(s*l>u*d)+","+(this._x1=t+m*c)+","+(this._y1=e+m*f)}else this._+="L"+(this._x1=t)+","+(this._y1=e);else;},arc:function(t,e,n,r,i,a){t=+t,e=+e;var o=(n=+n)*Math.cos(r),c=n*Math.sin(r),f=t+o,u=e+c,s=1^a,h=a?r-i:i-r;if(n<0)throw new Error("negative radius: "+n);null===this._x1?this._+="M"+f+","+u:(Math.abs(this._x1-f)>1e-6||Math.abs(this._y1-u)>1e-6)&&(this._+="L"+f+","+u),n&&(h<0&&(h=h%nr+nr),h>rr?this._+="A"+n+","+n+",0,1,"+s+","+(t-o)+","+(e-c)+"A"+n+","+n+",0,1,"+s+","+(this._x1=f)+","+(this._y1=u):h>1e-6&&(this._+="A"+n+","+n+",0,"+ +(h>=er)+","+s+","+(this._x1=t+n*Math.cos(i))+","+(this._y1=e+n*Math.sin(i))))},rect:function(t,e,n,r){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)+"h"+ +n+"v"+ +r+"h"+-n+"Z"},toString:function(){return this._}};var or=ar;function cr(){}function fr(t,e){var n=new cr;if(t instanceof cr)t.each(function(t,e){n.set(e,t)});else if(Array.isArray(t)){var r,i=-1,a=t.length;if(null==e)for(;++i<a;)n.set(i,t[i]);else for(;++i<a;)n.set(e(r=t[i],i,t),r)}else if(t)for(var o in t)n.set(o,t[o]);return n}cr.prototype=fr.prototype={constructor:cr,has:function(t){return"$"+t in this},get:function(t){return this["$"+t]},set:function(t,e){return this["$"+t]=e,this},remove:function(t){var e="$"+t;return e in this&&delete this[e]},clear:function(){for(var t in this)"$"===t[0]&&delete this[t]},keys:function(){var t=[];for(var e in this)"$"===e[0]&&t.push(e.slice(1));return t},values:function(){var t=[];for(var e in this)"$"===e[0]&&t.push(this[e]);return t},entries:function(){var t=[];for(var e in this)"$"===e[0]&&t.push({key:e.slice(1),value:this[e]});return t},size:function(){var t=0;for(var e in this)"$"===e[0]&&++t;return t},empty:function(){for(var t in this)if("$"===t[0])return!1;return!0},each:function(t){for(var e in this)"$"===e[0]&&t(this[e],e.slice(1),this)}};var ur=fr;function sr(){}var hr=ur.prototype;function lr(t,e){var n=new sr;if(t instanceof sr)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}sr.prototype=lr.prototype={constructor:sr,has:hr.has,add:function(t){return this["$"+(t+="")]=t,this},remove:hr.remove,clear:hr.clear,values:hr.keys,size:hr.size,empty:hr.empty,each:hr.each};Array.prototype.slice;var dr={},pr={},_r=34,br=10,vr=13;function gr(t){return new Fu