d3
Version:
2 lines • 280 kB
JavaScript
// https://d3js.org v7.8.3 Copyright 2010-2023 Mike Bostock
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((t="undefined"!=typeof globalThis?globalThis:t||self).d3=t.d3||{})}(this,(function(t){"use strict";function n(t,n){return null==t||null==n?NaN:t<n?-1:t>n?1:t>=n?0:NaN}function e(t,n){return null==t||null==n?NaN:n<t?-1:n>t?1:n>=t?0:NaN}function r(t){let r,o,a;function u(t,n,e=0,i=t.length){if(e<i){if(0!==r(n,n))return i;do{const r=e+i>>>1;o(t[r],n)<0?e=r+1:i=r}while(e<i)}return e}return 2!==t.length?(r=n,o=(e,r)=>n(t(e),r),a=(n,e)=>t(n)-e):(r=t===n||t===e?t:i,o=t,a=t),{left:u,center:function(t,n,e=0,r=t.length){const i=u(t,n,e,r-1);return i>e&&a(t[i-1],n)>-a(t[i],n)?i-1:i},right:function(t,n,e=0,i=t.length){if(e<i){if(0!==r(n,n))return i;do{const r=e+i>>>1;o(t[r],n)<=0?e=r+1:i=r}while(e<i)}return e}}}function i(){return 0}function o(t){return null===t?NaN:+t}function*a(t,n){if(void 0===n)for(let n of t)null!=n&&(n=+n)>=n&&(yield n);else{let e=-1;for(let r of t)null!=(r=n(r,++e,t))&&(r=+r)>=r&&(yield r)}}const u=r(n),c=u.right,f=u.left,s=r(o).center;var l=c;const h=p(v),d=p((function(t){const n=v(t);return(t,e,r,i,o)=>{n(t,e,(r<<=2)+0,(i<<=2)+0,o<<=2),n(t,e,r+1,i+1,o),n(t,e,r+2,i+2,o),n(t,e,r+3,i+3,o)}}));function p(t){return function(n,e,r=e){if(!((e=+e)>=0))throw new RangeError("invalid rx");if(!((r=+r)>=0))throw new RangeError("invalid ry");let{data:i,width:o,height:a}=n;if(!((o=Math.floor(o))>=0))throw new RangeError("invalid width");if(!((a=Math.floor(void 0!==a?a:i.length/o))>=0))throw new RangeError("invalid height");if(!o||!a||!e&&!r)return n;const u=e&&t(e),c=r&&t(r),f=i.slice();return u&&c?(g(u,f,i,o,a),g(u,i,f,o,a),g(u,f,i,o,a),y(c,i,f,o,a),y(c,f,i,o,a),y(c,i,f,o,a)):u?(g(u,i,f,o,a),g(u,f,i,o,a),g(u,i,f,o,a)):c&&(y(c,i,f,o,a),y(c,f,i,o,a),y(c,i,f,o,a)),n}}function g(t,n,e,r,i){for(let o=0,a=r*i;o<a;)t(n,e,o,o+=r,1)}function y(t,n,e,r,i){for(let o=0,a=r*i;o<r;++o)t(n,e,o,o+a,r)}function v(t){const n=Math.floor(t);if(n===t)return function(t){const n=2*t+1;return(e,r,i,o,a)=>{if(!((o-=a)>=i))return;let u=t*r[i];const c=a*t;for(let t=i,n=i+c;t<n;t+=a)u+=r[Math.min(o,t)];for(let t=i,f=o;t<=f;t+=a)u+=r[Math.min(o,t+c)],e[t]=u/n,u-=r[Math.max(i,t-c)]}}(t);const e=t-n,r=2*t+1;return(t,i,o,a,u)=>{if(!((a-=u)>=o))return;let c=n*i[o];const f=u*n,s=f+u;for(let t=o,n=o+f;t<n;t+=u)c+=i[Math.min(a,t)];for(let n=o,l=a;n<=l;n+=u)c+=i[Math.min(a,n+f)],t[n]=(c+e*(i[Math.max(o,n-s)]+i[Math.min(a,n+s)]))/r,c-=i[Math.max(o,n-f)]}}function _(t,n){let e=0;if(void 0===n)for(let n of t)null!=n&&(n=+n)>=n&&++e;else{let r=-1;for(let i of t)null!=(i=n(i,++r,t))&&(i=+i)>=i&&++e}return e}function b(t){return 0|t.length}function m(t){return!(t>0)}function x(t){return"object"!=typeof t||"length"in t?t:Array.from(t)}function w(t,n){let e,r=0,i=0,o=0;if(void 0===n)for(let n of t)null!=n&&(n=+n)>=n&&(e=n-i,i+=e/++r,o+=e*(n-i));else{let a=-1;for(let u of t)null!=(u=n(u,++a,t))&&(u=+u)>=u&&(e=u-i,i+=e/++r,o+=e*(u-i))}if(r>1)return o/(r-1)}function M(t,n){const e=w(t,n);return e?Math.sqrt(e):e}function T(t,n){let e,r;if(void 0===n)for(const n of t)null!=n&&(void 0===e?n>=n&&(e=r=n):(e>n&&(e=n),r<n&&(r=n)));else{let i=-1;for(let o of t)null!=(o=n(o,++i,t))&&(void 0===e?o>=o&&(e=r=o):(e>o&&(e=o),r<o&&(r=o)))}return[e,r]}class A{constructor(){this._partials=new Float64Array(32),this._n=0}add(t){const n=this._partials;let e=0;for(let r=0;r<this._n&&r<32;r++){const i=n[r],o=t+i,a=Math.abs(t)<Math.abs(i)?t-(o-i):i-(o-t);a&&(n[e++]=a),t=o}return n[e]=t,this._n=e+1,this}valueOf(){const t=this._partials;let n,e,r,i=this._n,o=0;if(i>0){for(o=t[--i];i>0&&(n=o,e=t[--i],o=n+e,r=e-(o-n),!r););i>0&&(r<0&&t[i-1]<0||r>0&&t[i-1]>0)&&(e=2*r,n=o+e,e==n-o&&(o=n))}return o}}class InternMap extends Map{constructor(t,n=k){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),null!=t)for(const[n,e]of t)this.set(n,e)}get(t){return super.get(S(this,t))}has(t){return super.has(S(this,t))}set(t,n){return super.set(E(this,t),n)}delete(t){return super.delete(N(this,t))}}class InternSet extends Set{constructor(t,n=k){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),null!=t)for(const n of t)this.add(n)}has(t){return super.has(S(this,t))}add(t){return super.add(E(this,t))}delete(t){return super.delete(N(this,t))}}function S({_intern:t,_key:n},e){const r=n(e);return t.has(r)?t.get(r):e}function E({_intern:t,_key:n},e){const r=n(e);return t.has(r)?t.get(r):(t.set(r,e),e)}function N({_intern:t,_key:n},e){const r=n(e);return t.has(r)&&(e=t.get(r),t.delete(r)),e}function k(t){return null!==t&&"object"==typeof t?t.valueOf():t}function C(t){return t}function P(t,...n){return q(t,C,C,n)}function z(t,...n){return q(t,Array.from,C,n)}function $(t,n){for(let e=1,r=n.length;e<r;++e)t=t.flatMap((t=>t.pop().map((([n,e])=>[...t,n,e]))));return t}function D(t,n,...e){return q(t,C,n,e)}function R(t,n,...e){return q(t,Array.from,n,e)}function F(t){if(1!==t.length)throw new Error("duplicate key");return t[0]}function q(t,n,e,r){return function t(i,o){if(o>=r.length)return e(i);const a=new InternMap,u=r[o++];let c=-1;for(const t of i){const n=u(t,++c,i),e=a.get(n);e?e.push(t):a.set(n,[t])}for(const[n,e]of a)a.set(n,t(e,o));return n(a)}(t,0)}function U(t,n){return Array.from(n,(n=>t[n]))}function I(t,...n){if("function"!=typeof t[Symbol.iterator])throw new TypeError("values is not iterable");t=Array.from(t);let[e]=n;if(e&&2!==e.length||n.length>1){const r=Uint32Array.from(t,((t,n)=>n));return n.length>1?(n=n.map((n=>t.map(n))),r.sort(((t,e)=>{for(const r of n){const n=B(r[t],r[e]);if(n)return n}}))):(e=t.map(e),r.sort(((t,n)=>B(e[t],e[n])))),U(t,r)}return t.sort(O(e))}function O(t=n){if(t===n)return B;if("function"!=typeof t)throw new TypeError("compare is not a function");return(n,e)=>{const r=t(n,e);return r||0===r?r:(0===t(e,e))-(0===t(n,n))}}function B(t,n){return(null==t||!(t>=t))-(null==n||!(n>=n))||(t<n?-1:t>n?1:0)}var Y=Array.prototype.slice;function L(t){return()=>t}const j=Math.sqrt(50),H=Math.sqrt(10),X=Math.sqrt(2);function G(t,n,e){const r=(n-t)/Math.max(0,e),i=Math.floor(Math.log10(r)),o=r/Math.pow(10,i),a=o>=j?10:o>=H?5:o>=X?2:1;let u,c,f;return i<0?(f=Math.pow(10,-i)/a,u=Math.round(t*f),c=Math.round(n*f),u/f<t&&++u,c/f>n&&--c,f=-f):(f=Math.pow(10,i)*a,u=Math.round(t/f),c=Math.round(n/f),u*f<t&&++u,c*f>n&&--c),c<u&&.5<=e&&e<2?G(t,n,2*e):[u,c,f]}function V(t,n,e){if(!((e=+e)>0))return[];if((t=+t)===(n=+n))return[t];const r=n<t,[i,o,a]=r?G(n,t,e):G(t,n,e);if(!(o>=i))return[];const u=o-i+1,c=new Array(u);if(r)if(a<0)for(let t=0;t<u;++t)c[t]=(o-t)/-a;else for(let t=0;t<u;++t)c[t]=(o-t)*a;else if(a<0)for(let t=0;t<u;++t)c[t]=(i+t)/-a;else for(let t=0;t<u;++t)c[t]=(i+t)*a;return c}function W(t,n,e){return G(t=+t,n=+n,e=+e)[2]}function Z(t,n,e){e=+e;const r=(n=+n)<(t=+t),i=r?W(n,t,e):W(t,n,e);return(r?-1:1)*(i<0?1/-i:i)}function K(t,n,e){let r;for(;;){const i=W(t,n,e);if(i===r||0===i||!isFinite(i))return[t,n];i>0?(t=Math.floor(t/i)*i,n=Math.ceil(n/i)*i):i<0&&(t=Math.ceil(t*i)/i,n=Math.floor(n*i)/i),r=i}}function Q(t){return Math.max(1,Math.ceil(Math.log(_(t))/Math.LN2)+1)}function J(){var t=C,n=T,e=Q;function r(r){Array.isArray(r)||(r=Array.from(r));var i,o,a,u=r.length,c=new Array(u);for(i=0;i<u;++i)c[i]=t(r[i],i,r);var f=n(c),s=f[0],h=f[1],d=e(c,s,h);if(!Array.isArray(d)){const t=h,e=+d;if(n===T&&([s,h]=K(s,h,e)),(d=V(s,h,e))[0]<=s&&(a=W(s,h,e)),d[d.length-1]>=h)if(t>=h&&n===T){const t=W(s,h,e);isFinite(t)&&(t>0?h=(Math.floor(h/t)+1)*t:t<0&&(h=(Math.ceil(h*-t)+1)/-t))}else d.pop()}for(var p=d.length,g=0,y=p;d[g]<=s;)++g;for(;d[y-1]>h;)--y;(g||y<p)&&(d=d.slice(g,y),p=y-g);var v,_=new Array(p+1);for(i=0;i<=p;++i)(v=_[i]=[]).x0=i>0?d[i-1]:s,v.x1=i<p?d[i]:h;if(isFinite(a)){if(a>0)for(i=0;i<u;++i)null!=(o=c[i])&&s<=o&&o<=h&&_[Math.min(p,Math.floor((o-s)/a))].push(r[i]);else if(a<0)for(i=0;i<u;++i)if(null!=(o=c[i])&&s<=o&&o<=h){const t=Math.floor((s-o)*a);_[Math.min(p,t+(d[t]<=o))].push(r[i])}}else for(i=0;i<u;++i)null!=(o=c[i])&&s<=o&&o<=h&&_[l(d,o,0,p)].push(r[i]);return _}return r.value=function(n){return arguments.length?(t="function"==typeof n?n:L(n),r):t},r.domain=function(t){return arguments.length?(n="function"==typeof t?t:L([t[0],t[1]]),r):n},r.thresholds=function(t){return arguments.length?(e="function"==typeof t?t:L(Array.isArray(t)?Y.call(t):t),r):e},r}function tt(t,n){let e;if(void 0===n)for(const n of t)null!=n&&(e<n||void 0===e&&n>=n)&&(e=n);else{let r=-1;for(let i of t)null!=(i=n(i,++r,t))&&(e<i||void 0===e&&i>=i)&&(e=i)}return e}function nt(t,n){let e,r=-1,i=-1;if(void 0===n)for(const n of t)++i,null!=n&&(e<n||void 0===e&&n>=n)&&(e=n,r=i);else for(let o of t)null!=(o=n(o,++i,t))&&(e<o||void 0===e&&o>=o)&&(e=o,r=i);return r}function et(t,n){let e;if(void 0===n)for(const n of t)null!=n&&(e>n||void 0===e&&n>=n)&&(e=n);else{let r=-1;for(let i of t)null!=(i=n(i,++r,t))&&(e>i||void 0===e&&i>=i)&&(e=i)}return e}function rt(t,n){let e,r=-1,i=-1;if(void 0===n)for(const n of t)++i,null!=n&&(e>n||void 0===e&&n>=n)&&(e=n,r=i);else for(let o of t)null!=(o=n(o,++i,t))&&(e>o||void 0===e&&o>=o)&&(e=o,r=i);return r}function it(t,n,e=0,r=1/0,i){if(n=Math.floor(n),e=Math.floor(Math.max(0,e)),r=Math.floor(Math.min(t.length-1,r)),!(e<=n&&n<=r))return t;for(i=void 0===i?B:O(i);r>e;){if(r-e>600){const o=r-e+1,a=n-e+1,u=Math.log(o),c=.5*Math.exp(2*u/3),f=.5*Math.sqrt(u*c*(o-c)/o)*(a-o/2<0?-1:1);it(t,n,Math.max(e,Math.floor(n-a*c/o+f)),Math.min(r,Math.floor(n+(o-a)*c/o+f)),i)}const o=t[n];let a=e,u=r;for(ot(t,e,n),i(t[r],o)>0&&ot(t,e,r);a<u;){for(ot(t,a,u),++a,--u;i(t[a],o)<0;)++a;for(;i(t[u],o)>0;)--u}0===i(t[e],o)?ot(t,e,u):(++u,ot(t,u,r)),u<=n&&(e=u+1),n<=u&&(r=u-1)}return t}function ot(t,n,e){const r=t[n];t[n]=t[e],t[e]=r}function at(t,e=n){let r,i=!1;if(1===e.length){let o;for(const a of t){const t=e(a);(i?n(t,o)>0:0===n(t,t))&&(r=a,o=t,i=!0)}}else for(const n of t)(i?e(n,r)>0:0===e(n,n))&&(r=n,i=!0);return r}function ut(t,n,e){if((r=(t=Float64Array.from(a(t,e))).length)&&!isNaN(n=+n)){if(n<=0||r<2)return et(t);if(n>=1)return tt(t);var r,i=(r-1)*n,o=Math.floor(i),u=tt(it(t,o).subarray(0,o+1));return u+(et(t.subarray(o+1))-u)*(i-o)}}function ct(t,n,e=o){if((r=t.length)&&!isNaN(n=+n)){if(n<=0||r<2)return+e(t[0],0,t);if(n>=1)return+e(t[r-1],r-1,t);var r,i=(r-1)*n,a=Math.floor(i),u=+e(t[a],a,t);return u+(+e(t[a+1],a+1,t)-u)*(i-a)}}function ft(t,n,e){if((r=(t=Float64Array.from(a(t,e))).length)&&!isNaN(n=+n)){if(n<=0||r<2)return rt(t);if(n>=1)return nt(t);var r,i=Math.floor((r-1)*n),o=it(Uint32Array.from(t,((t,n)=>n)),i,0,r-1,((n,e)=>B(t[n],t[e])));return at(o.subarray(0,i+1),(n=>t[n]))}}function st(t){return Array.from(function*(t){for(const n of t)yield*n}(t))}function lt(t,n){return[t,n]}function ht(t,n,e){t=+t,n=+n,e=(i=arguments.length)<2?(n=t,t=0,1):i<3?1:+e;for(var r=-1,i=0|Math.max(0,Math.ceil((n-t)/e)),o=new Array(i);++r<i;)o[r]=t+r*e;return o}function dt(t,e=n){if(1===e.length)return rt(t,e);let r,i=-1,o=-1;for(const n of t)++o,(i<0?0===e(n,n):e(n,r)<0)&&(r=n,i=o);return i}var pt=gt(Math.random);function gt(t){return function(n,e=0,r=n.length){let i=r-(e=+e);for(;i;){const r=t()*i--|0,o=n[i+e];n[i+e]=n[r+e],n[r+e]=o}return n}}function yt(t){if(!(i=t.length))return[];for(var n=-1,e=et(t,vt),r=new Array(e);++n<e;)for(var i,o=-1,a=r[n]=new Array(i);++o<i;)a[o]=t[o][n];return r}function vt(t){return t.length}function _t(t){return t instanceof InternSet?t:new InternSet(t)}function bt(t,n){const e=t[Symbol.iterator](),r=new Set;for(const t of n){const n=mt(t);if(r.has(n))continue;let i,o;for(;({value:i,done:o}=e.next());){if(o)return!1;const t=mt(i);if(r.add(t),Object.is(n,t))break}}return!0}function mt(t){return null!==t&&"object"==typeof t?t.valueOf():t}function xt(t){return t}var wt=1,Mt=2,Tt=3,At=4,St=1e-6;function Et(t){return"translate("+t+",0)"}function Nt(t){return"translate(0,"+t+")"}function kt(t){return n=>+t(n)}function Ct(t,n){return n=Math.max(0,t.bandwidth()-2*n)/2,t.round()&&(n=Math.round(n)),e=>+t(e)+n}function Pt(){return!this.__axis}function zt(t,n){var e=[],r=null,i=null,o=6,a=6,u=3,c="undefined"!=typeof window&&window.devicePixelRatio>1?0:.5,f=t===wt||t===At?-1:1,s=t===At||t===Mt?"x":"y",l=t===wt||t===Tt?Et:Nt;function h(h){var d=null==r?n.ticks?n.ticks.apply(n,e):n.domain():r,p=null==i?n.tickFormat?n.tickFormat.apply(n,e):xt:i,g=Math.max(o,0)+u,y=n.range(),v=+y[0]+c,_=+y[y.length-1]+c,b=(n.bandwidth?Ct:kt)(n.copy(),c),m=h.selection?h.selection():h,x=m.selectAll(".domain").data([null]),w=m.selectAll(".tick").data(d,n).order(),M=w.exit(),T=w.enter().append("g").attr("class","tick"),A=w.select("line"),S=w.select("text");x=x.merge(x.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),w=w.merge(T),A=A.merge(T.append("line").attr("stroke","currentColor").attr(s+"2",f*o)),S=S.merge(T.append("text").attr("fill","currentColor").attr(s,f*g).attr("dy",t===wt?"0em":t===Tt?"0.71em":"0.32em")),h!==m&&(x=x.transition(h),w=w.transition(h),A=A.transition(h),S=S.transition(h),M=M.transition(h).attr("opacity",St).attr("transform",(function(t){return isFinite(t=b(t))?l(t+c):this.getAttribute("transform")})),T.attr("opacity",St).attr("transform",(function(t){var n=this.parentNode.__axis;return l((n&&isFinite(n=n(t))?n:b(t))+c)}))),M.remove(),x.attr("d",t===At||t===Mt?a?"M"+f*a+","+v+"H"+c+"V"+_+"H"+f*a:"M"+c+","+v+"V"+_:a?"M"+v+","+f*a+"V"+c+"H"+_+"V"+f*a:"M"+v+","+c+"H"+_),w.attr("opacity",1).attr("transform",(function(t){return l(b(t)+c)})),A.attr(s+"2",f*o),S.attr(s,f*g).text(p),m.filter(Pt).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",t===Mt?"start":t===At?"end":"middle"),m.each((function(){this.__axis=b}))}return h.scale=function(t){return arguments.length?(n=t,h):n},h.ticks=function(){return e=Array.from(arguments),h},h.tickArguments=function(t){return arguments.length?(e=null==t?[]:Array.from(t),h):e.slice()},h.tickValues=function(t){return arguments.length?(r=null==t?null:Array.from(t),h):r&&r.slice()},h.tickFormat=function(t){return arguments.length?(i=t,h):i},h.tickSize=function(t){return arguments.length?(o=a=+t,h):o},h.tickSizeInner=function(t){return arguments.length?(o=+t,h):o},h.tickSizeOuter=function(t){return arguments.length?(a=+t,h):a},h.tickPadding=function(t){return arguments.length?(u=+t,h):u},h.offset=function(t){return arguments.length?(c=+t,h):c},h}var $t={value:()=>{}};function Dt(){for(var t,n=0,e=arguments.length,r={};n<e;++n){if(!(t=arguments[n]+"")||t in r||/[\s.]/.test(t))throw new Error("illegal type: "+t);r[t]=[]}return new Rt(r)}function Rt(t){this._=t}function Ft(t,n){for(var e,r=0,i=t.length;r<i;++r)if((e=t[r]).name===n)return e.value}function qt(t,n,e){for(var r=0,i=t.length;r<i;++r)if(t[r].name===n){t[r]=$t,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=e&&t.push({name:n,value:e}),t}Rt.prototype=Dt.prototype={constructor:Rt,on:function(t,n){var e,r,i=this._,o=(r=i,(t+"").trim().split(/^|\s+/).map((function(t){var n="",e=t.indexOf(".");if(e>=0&&(n=t.slice(e+1),t=t.slice(0,e)),t&&!r.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}}))),a=-1,u=o.length;if(!(arguments.length<2)){if(null!=n&&"function"!=typeof n)throw new Error("invalid callback: "+n);for(;++a<u;)if(e=(t=o[a]).type)i[e]=qt(i[e],t.name,n);else if(null==n)for(e in i)i[e]=qt(i[e],t.name,null);return this}for(;++a<u;)if((e=(t=o[a]).type)&&(e=Ft(i[e],t.name)))return e},copy:function(){var t={},n=this._;for(var e in n)t[e]=n[e].slice();return new Rt(t)},call:function(t,n){if((e=arguments.length-2)>0)for(var e,r,i=new Array(e),o=0;o<e;++o)i[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=0,e=(r=this._[t]).length;o<e;++o)r[o].value.apply(n,i)},apply:function(t,n,e){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,o=r.length;i<o;++i)r[i].value.apply(n,e)}};var Ut="http://www.w3.org/1999/xhtml",It={svg:"http://www.w3.org/2000/svg",xhtml:Ut,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Ot(t){var n=t+="",e=n.indexOf(":");return e>=0&&"xmlns"!==(n=t.slice(0,e))&&(t=t.slice(e+1)),It.hasOwnProperty(n)?{space:It[n],local:t}:t}function Bt(t){return function(){var n=this.ownerDocument,e=this.namespaceURI;return e===Ut&&n.documentElement.namespaceURI===Ut?n.createElement(t):n.createElementNS(e,t)}}function Yt(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function Lt(t){var n=Ot(t);return(n.local?Yt:Bt)(n)}function jt(){}function Ht(t){return null==t?jt:function(){return this.querySelector(t)}}function Xt(t){return null==t?[]:Array.isArray(t)?t:Array.from(t)}function Gt(){return[]}function Vt(t){return null==t?Gt:function(){return this.querySelectorAll(t)}}function Wt(t){return function(){return this.matches(t)}}function Zt(t){return function(n){return n.matches(t)}}var Kt=Array.prototype.find;function Qt(){return this.firstElementChild}var Jt=Array.prototype.filter;function tn(){return Array.from(this.children)}function nn(t){return new Array(t.length)}function en(t,n){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=n}function rn(t,n,e,r,i,o){for(var a,u=0,c=n.length,f=o.length;u<f;++u)(a=n[u])?(a.__data__=o[u],r[u]=a):e[u]=new en(t,o[u]);for(;u<c;++u)(a=n[u])&&(i[u]=a)}function on(t,n,e,r,i,o,a){var u,c,f,s=new Map,l=n.length,h=o.length,d=new Array(l);for(u=0;u<l;++u)(c=n[u])&&(d[u]=f=a.call(c,c.__data__,u,n)+"",s.has(f)?i[u]=c:s.set(f,c));for(u=0;u<h;++u)f=a.call(t,o[u],u,o)+"",(c=s.get(f))?(r[u]=c,c.__data__=o[u],s.delete(f)):e[u]=new en(t,o[u]);for(u=0;u<l;++u)(c=n[u])&&s.get(d[u])===c&&(i[u]=c)}function an(t){return t.__data__}function un(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function cn(t,n){return t<n?-1:t>n?1:t>=n?0:NaN}function fn(t){return function(){this.removeAttribute(t)}}function sn(t){return function(){this.removeAttributeNS(t.space,t.local)}}function ln(t,n){return function(){this.setAttribute(t,n)}}function hn(t,n){return function(){this.setAttributeNS(t.space,t.local,n)}}function dn(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttribute(t):this.setAttribute(t,e)}}function pn(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,e)}}function gn(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function yn(t){return function(){this.style.removeProperty(t)}}function vn(t,n,e){return function(){this.style.setProperty(t,n,e)}}function _n(t,n,e){return function(){var r=n.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,e)}}function bn(t,n){return t.style.getPropertyValue(n)||gn(t).getComputedStyle(t,null).getPropertyValue(n)}function mn(t){return function(){delete this[t]}}function xn(t,n){return function(){this[t]=n}}function wn(t,n){return function(){var e=n.apply(this,arguments);null==e?delete this[t]:this[t]=e}}function Mn(t){return t.trim().split(/^|\s+/)}function Tn(t){return t.classList||new An(t)}function An(t){this._node=t,this._names=Mn(t.getAttribute("class")||"")}function Sn(t,n){for(var e=Tn(t),r=-1,i=n.length;++r<i;)e.add(n[r])}function En(t,n){for(var e=Tn(t),r=-1,i=n.length;++r<i;)e.remove(n[r])}function Nn(t){return function(){Sn(this,t)}}function kn(t){return function(){En(this,t)}}function Cn(t,n){return function(){(n.apply(this,arguments)?Sn:En)(this,t)}}function Pn(){this.textContent=""}function zn(t){return function(){this.textContent=t}}function $n(t){return function(){var n=t.apply(this,arguments);this.textContent=null==n?"":n}}function Dn(){this.innerHTML=""}function Rn(t){return function(){this.innerHTML=t}}function Fn(t){return function(){var n=t.apply(this,arguments);this.innerHTML=null==n?"":n}}function qn(){this.nextSibling&&this.parentNode.appendChild(this)}function Un(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function In(){return null}function On(){var t=this.parentNode;t&&t.removeChild(this)}function Bn(){var t=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(t,this.nextSibling):t}function Yn(){var t=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(t,this.nextSibling):t}function Ln(t){return function(){var n=this.__on;if(n){for(var e,r=0,i=-1,o=n.length;r<o;++r)e=n[r],t.type&&e.type!==t.type||e.name!==t.name?n[++i]=e:this.removeEventListener(e.type,e.listener,e.options);++i?n.length=i:delete this.__on}}}function jn(t,n,e){return function(){var r,i=this.__on,o=function(t){return function(n){t.call(this,n,this.__data__)}}(n);if(i)for(var a=0,u=i.length;a<u;++a)if((r=i[a]).type===t.type&&r.name===t.name)return this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=o,r.options=e),void(r.value=n);this.addEventListener(t.type,o,e),r={type:t.type,name:t.name,value:n,listener:o,options:e},i?i.push(r):this.__on=[r]}}function Hn(t,n,e){var r=gn(t),i=r.CustomEvent;"function"==typeof i?i=new i(n,e):(i=r.document.createEvent("Event"),e?(i.initEvent(n,e.bubbles,e.cancelable),i.detail=e.detail):i.initEvent(n,!1,!1)),t.dispatchEvent(i)}function Xn(t,n){return function(){return Hn(this,t,n)}}function Gn(t,n){return function(){return Hn(this,t,n.apply(this,arguments))}}en.prototype={constructor:en,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,n){return this._parent.insertBefore(t,n)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}},An.prototype={add:function(t){this._names.indexOf(t)<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var n=this._names.indexOf(t);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var Vn=[null];function Wn(t,n){this._groups=t,this._parents=n}function Zn(){return new Wn([[document.documentElement]],Vn)}function Kn(t){return"string"==typeof t?new Wn([[document.querySelector(t)]],[document.documentElement]):new Wn([[t]],Vn)}Wn.prototype=Zn.prototype={constructor:Wn,select:function(t){"function"!=typeof t&&(t=Ht(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o,a,u=n[i],c=u.length,f=r[i]=new Array(c),s=0;s<c;++s)(o=u[s])&&(a=t.call(o,o.__data__,s,u))&&("__data__"in o&&(a.__data__=o.__data__),f[s]=a);return new Wn(r,this._parents)},selectAll:function(t){t="function"==typeof t?function(t){return function(){return Xt(t.apply(this,arguments))}}(t):Vt(t);for(var n=this._groups,e=n.length,r=[],i=[],o=0;o<e;++o)for(var a,u=n[o],c=u.length,f=0;f<c;++f)(a=u[f])&&(r.push(t.call(a,a.__data__,f,u)),i.push(a));return new Wn(r,i)},selectChild:function(t){return this.select(null==t?Qt:function(t){return function(){return Kt.call(this.children,t)}}("function"==typeof t?t:Zt(t)))},selectChildren:function(t){return this.selectAll(null==t?tn:function(t){return function(){return Jt.call(this.children,t)}}("function"==typeof t?t:Zt(t)))},filter:function(t){"function"!=typeof t&&(t=Wt(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o,a=n[i],u=a.length,c=r[i]=[],f=0;f<u;++f)(o=a[f])&&t.call(o,o.__data__,f,a)&&c.push(o);return new Wn(r,this._parents)},data:function(t,n){if(!arguments.length)return Array.from(this,an);var e=n?on:rn,r=this._parents,i=this._groups;"function"!=typeof t&&(t=function(t){return function(){return t}}(t));for(var o=i.length,a=new Array(o),u=new Array(o),c=new Array(o),f=0;f<o;++f){var s=r[f],l=i[f],h=l.length,d=un(t.call(s,s&&s.__data__,f,r)),p=d.length,g=u[f]=new Array(p),y=a[f]=new Array(p);e(s,l,g,y,c[f]=new Array(h),d,n);for(var v,_,b=0,m=0;b<p;++b)if(v=g[b]){for(b>=m&&(m=b+1);!(_=y[m])&&++m<p;);v._next=_||null}}return(a=new Wn(a,r))._enter=u,a._exit=c,a},enter:function(){return new Wn(this._enter||this._groups.map(nn),this._parents)},exit:function(){return new Wn(this._exit||this._groups.map(nn),this._parents)},join:function(t,n,e){var r=this.enter(),i=this,o=this.exit();return"function"==typeof t?(r=t(r))&&(r=r.selection()):r=r.append(t+""),null!=n&&(i=n(i))&&(i=i.selection()),null==e?o.remove():e(o),r&&i?r.merge(i).order():i},merge:function(t){for(var n=t.selection?t.selection():t,e=this._groups,r=n._groups,i=e.length,o=r.length,a=Math.min(i,o),u=new Array(i),c=0;c<a;++c)for(var f,s=e[c],l=r[c],h=s.length,d=u[c]=new Array(h),p=0;p<h;++p)(f=s[p]||l[p])&&(d[p]=f);for(;c<i;++c)u[c]=e[c];return new Wn(u,this._parents)},selection:function(){return this},order:function(){for(var t=this._groups,n=-1,e=t.length;++n<e;)for(var r,i=t[n],o=i.length-1,a=i[o];--o>=0;)(r=i[o])&&(a&&4^r.compareDocumentPosition(a)&&a.parentNode.insertBefore(r,a),a=r);return this},sort:function(t){function n(n,e){return n&&e?t(n.__data__,e.__data__):!n-!e}t||(t=cn);for(var e=this._groups,r=e.length,i=new Array(r),o=0;o<r;++o){for(var a,u=e[o],c=u.length,f=i[o]=new Array(c),s=0;s<c;++s)(a=u[s])&&(f[s]=a);f.sort(n)}return new Wn(i,this._parents).order()},call:function(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var t=this._groups,n=0,e=t.length;n<e;++n)for(var r=t[n],i=0,o=r.length;i<o;++i){var a=r[i];if(a)return a}return null},size:function(){let t=0;for(const n of this)++t;return t},empty:function(){return!this.node()},each:function(t){for(var n=this._groups,e=0,r=n.length;e<r;++e)for(var i,o=n[e],a=0,u=o.length;a<u;++a)(i=o[a])&&t.call(i,i.__data__,a,o);return this},attr:function(t,n){var e=Ot(t);if(arguments.length<2){var r=this.node();return e.local?r.getAttributeNS(e.space,e.local):r.getAttribute(e)}return this.each((null==n?e.local?sn:fn:"function"==typeof n?e.local?pn:dn:e.local?hn:ln)(e,n))},style:function(t,n,e){return arguments.length>1?this.each((null==n?yn:"function"==typeof n?_n:vn)(t,n,null==e?"":e)):bn(this.node(),t)},property:function(t,n){return arguments.length>1?this.each((null==n?mn:"function"==typeof n?wn:xn)(t,n)):this.node()[t]},classed:function(t,n){var e=Mn(t+"");if(arguments.length<2){for(var r=Tn(this.node()),i=-1,o=e.length;++i<o;)if(!r.contains(e[i]))return!1;return!0}return this.each(("function"==typeof n?Cn:n?Nn:kn)(e,n))},text:function(t){return arguments.length?this.each(null==t?Pn:("function"==typeof t?$n:zn)(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?Dn:("function"==typeof t?Fn:Rn)(t)):this.node().innerHTML},raise:function(){return this.each(qn)},lower:function(){return this.each(Un)},append:function(t){var n="function"==typeof t?t:Lt(t);return this.select((function(){return this.appendChild(n.apply(this,arguments))}))},insert:function(t,n){var e="function"==typeof t?t:Lt(t),r=null==n?In:"function"==typeof n?n:Ht(n);return this.select((function(){return this.insertBefore(e.apply(this,arguments),r.apply(this,arguments)||null)}))},remove:function(){return this.each(On)},clone:function(t){return this.select(t?Yn:Bn)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,n,e){var r,i,o=function(t){return t.trim().split(/^|\s+/).map((function(t){var n="",e=t.indexOf(".");return e>=0&&(n=t.slice(e+1),t=t.slice(0,e)),{type:t,name:n}}))}(t+""),a=o.length;if(!(arguments.length<2)){for(u=n?jn:Ln,r=0;r<a;++r)this.each(u(o[r],n,e));return this}var u=this.node().__on;if(u)for(var c,f=0,s=u.length;f<s;++f)for(r=0,c=u[f];r<a;++r)if((i=o[r]).type===c.type&&i.name===c.name)return c.value},dispatch:function(t,n){return this.each(("function"==typeof n?Gn:Xn)(t,n))},[Symbol.iterator]:function*(){for(var t=this._groups,n=0,e=t.length;n<e;++n)for(var r,i=t[n],o=0,a=i.length;o<a;++o)(r=i[o])&&(yield r)}};var Qn=0;function Jn(){return new te}function te(){this._="@"+(++Qn).toString(36)}function ne(t){let n;for(;n=t.sourceEvent;)t=n;return t}function ee(t,n){if(t=ne(t),void 0===n&&(n=t.currentTarget),n){var e=n.ownerSVGElement||n;if(e.createSVGPoint){var r=e.createSVGPoint();return r.x=t.clientX,r.y=t.clientY,[(r=r.matrixTransform(n.getScreenCTM().inverse())).x,r.y]}if(n.getBoundingClientRect){var i=n.getBoundingClientRect();return[t.clientX-i.left-n.clientLeft,t.clientY-i.top-n.clientTop]}}return[t.pageX,t.pageY]}te.prototype=Jn.prototype={constructor:te,get:function(t){for(var n=this._;!(n in t);)if(!(t=t.parentNode))return;return t[n]},set:function(t,n){return t[this._]=n},remove:function(t){return this._ in t&&delete t[this._]},toString:function(){return this._}};const re={passive:!1},ie={capture:!0,passive:!1};function oe(t){t.stopImmediatePropagation()}function ae(t){t.preventDefault(),t.stopImmediatePropagation()}function ue(t){var n=t.document.documentElement,e=Kn(t).on("dragstart.drag",ae,ie);"onselectstart"in n?e.on("selectstart.drag",ae,ie):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function ce(t,n){var e=t.document.documentElement,r=Kn(t).on("dragstart.drag",null);n&&(r.on("click.drag",ae,ie),setTimeout((function(){r.on("click.drag",null)}),0)),"onselectstart"in e?r.on("selectstart.drag",null):(e.style.MozUserSelect=e.__noselect,delete e.__noselect)}var fe=t=>()=>t;function se(t,{sourceEvent:n,subject:e,target:r,identifier:i,active:o,x:a,y:u,dx:c,dy:f,dispatch:s}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},subject:{value:e,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:o,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:u,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:f,enumerable:!0,configurable:!0},_:{value:s}})}function le(t){return!t.ctrlKey&&!t.button}function he(){return this.parentNode}function de(t,n){return null==n?{x:t.x,y:t.y}:n}function pe(){return navigator.maxTouchPoints||"ontouchstart"in this}function ge(t,n,e){t.prototype=n.prototype=e,e.constructor=t}function ye(t,n){var e=Object.create(t.prototype);for(var r in n)e[r]=n[r];return e}function ve(){}se.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};var _e=.7,be=1/_e,me="\\s*([+-]?\\d+)\\s*",xe="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",we="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Me=/^#([0-9a-f]{3,8})$/,Te=new RegExp(`^rgb\\(${me},${me},${me}\\)$`),Ae=new RegExp(`^rgb\\(${we},${we},${we}\\)$`),Se=new RegExp(`^rgba\\(${me},${me},${me},${xe}\\)$`),Ee=new RegExp(`^rgba\\(${we},${we},${we},${xe}\\)$`),Ne=new RegExp(`^hsl\\(${xe},${we},${we}\\)$`),ke=new RegExp(`^hsla\\(${xe},${we},${we},${xe}\\)$`),Ce={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 Pe(){return this.rgb().formatHex()}function ze(){return this.rgb().formatRgb()}function $e(t){var n,e;return t=(t+"").trim().toLowerCase(),(n=Me.exec(t))?(e=n[1].length,n=parseInt(n[1],16),6===e?De(n):3===e?new Ue(n>>8&15|n>>4&240,n>>4&15|240&n,(15&n)<<4|15&n,1):8===e?Re(n>>24&255,n>>16&255,n>>8&255,(255&n)/255):4===e?Re(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|240&n,((15&n)<<4|15&n)/255):null):(n=Te.exec(t))?new Ue(n[1],n[2],n[3],1):(n=Ae.exec(t))?new Ue(255*n[1]/100,255*n[2]/100,255*n[3]/100,1):(n=Se.exec(t))?Re(n[1],n[2],n[3],n[4]):(n=Ee.exec(t))?Re(255*n[1]/100,255*n[2]/100,255*n[3]/100,n[4]):(n=Ne.exec(t))?je(n[1],n[2]/100,n[3]/100,1):(n=ke.exec(t))?je(n[1],n[2]/100,n[3]/100,n[4]):Ce.hasOwnProperty(t)?De(Ce[t]):"transparent"===t?new Ue(NaN,NaN,NaN,0):null}function De(t){return new Ue(t>>16&255,t>>8&255,255&t,1)}function Re(t,n,e,r){return r<=0&&(t=n=e=NaN),new Ue(t,n,e,r)}function Fe(t){return t instanceof ve||(t=$e(t)),t?new Ue((t=t.rgb()).r,t.g,t.b,t.opacity):new Ue}function qe(t,n,e,r){return 1===arguments.length?Fe(t):new Ue(t,n,e,null==r?1:r)}function Ue(t,n,e,r){this.r=+t,this.g=+n,this.b=+e,this.opacity=+r}function Ie(){return`#${Le(this.r)}${Le(this.g)}${Le(this.b)}`}function Oe(){const t=Be(this.opacity);return`${1===t?"rgb(":"rgba("}${Ye(this.r)}, ${Ye(this.g)}, ${Ye(this.b)}${1===t?")":`, ${t})`}`}function Be(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Ye(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Le(t){return((t=Ye(t))<16?"0":"")+t.toString(16)}function je(t,n,e,r){return r<=0?t=n=e=NaN:e<=0||e>=1?t=n=NaN:n<=0&&(t=NaN),new Ge(t,n,e,r)}function He(t){if(t instanceof Ge)return new Ge(t.h,t.s,t.l,t.opacity);if(t instanceof ve||(t=$e(t)),!t)return new Ge;if(t instanceof Ge)return t;var n=(t=t.rgb()).r/255,e=t.g/255,r=t.b/255,i=Math.min(n,e,r),o=Math.max(n,e,r),a=NaN,u=o-i,c=(o+i)/2;return u?(a=n===o?(e-r)/u+6*(e<r):e===o?(r-n)/u+2:(n-e)/u+4,u/=c<.5?o+i:2-o-i,a*=60):u=c>0&&c<1?0:a,new Ge(a,u,c,t.opacity)}function Xe(t,n,e,r){return 1===arguments.length?He(t):new Ge(t,n,e,null==r?1:r)}function Ge(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function Ve(t){return(t=(t||0)%360)<0?t+360:t}function We(t){return Math.max(0,Math.min(1,t||0))}function Ze(t,n,e){return 255*(t<60?n+(e-n)*t/60:t<180?e:t<240?n+(e-n)*(240-t)/60:n)}ge(ve,$e,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Pe,formatHex:Pe,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return He(this).formatHsl()},formatRgb:ze,toString:ze}),ge(Ue,qe,ye(ve,{brighter(t){return t=null==t?be:Math.pow(be,t),new Ue(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?_e:Math.pow(_e,t),new Ue(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Ue(Ye(this.r),Ye(this.g),Ye(this.b),Be(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Ie,formatHex:Ie,formatHex8:function(){return`#${Le(this.r)}${Le(this.g)}${Le(this.b)}${Le(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:Oe,toString:Oe})),ge(Ge,Xe,ye(ve,{brighter(t){return t=null==t?be:Math.pow(be,t),new Ge(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?_e:Math.pow(_e,t),new Ge(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+360*(this.h<0),n=isNaN(t)||isNaN(this.s)?0:this.s,e=this.l,r=e+(e<.5?e:1-e)*n,i=2*e-r;return new Ue(Ze(t>=240?t-240:t+120,i,r),Ze(t,i,r),Ze(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new Ge(Ve(this.h),We(this.s),We(this.l),Be(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=Be(this.opacity);return`${1===t?"hsl(":"hsla("}${Ve(this.h)}, ${100*We(this.s)}%, ${100*We(this.l)}%${1===t?")":`, ${t})`}`}}));const Ke=Math.PI/180,Qe=180/Math.PI,Je=.96422,tr=1,nr=.82521,er=4/29,rr=6/29,ir=3*rr*rr,or=rr*rr*rr;function ar(t){if(t instanceof cr)return new cr(t.l,t.a,t.b,t.opacity);if(t instanceof gr)return yr(t);t instanceof Ue||(t=Fe(t));var n,e,r=hr(t.r),i=hr(t.g),o=hr(t.b),a=fr((.2225045*r+.7168786*i+.0606169*o)/tr);return r===i&&i===o?n=e=a:(n=fr((.4360747*r+.3850649*i+.1430804*o)/Je),e=fr((.0139322*r+.0971045*i+.7141733*o)/nr)),new cr(116*a-16,500*(n-a),200*(a-e),t.opacity)}function ur(t,n,e,r){return 1===arguments.length?ar(t):new cr(t,n,e,null==r?1:r)}function cr(t,n,e,r){this.l=+t,this.a=+n,this.b=+e,this.opacity=+r}function fr(t){return t>or?Math.pow(t,1/3):t/ir+er}function sr(t){return t>rr?t*t*t:ir*(t-er)}function lr(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function hr(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function dr(t){if(t instanceof gr)return new gr(t.h,t.c,t.l,t.opacity);if(t instanceof cr||(t=ar(t)),0===t.a&&0===t.b)return new gr(NaN,0<t.l&&t.l<100?0:NaN,t.l,t.opacity);var n=Math.atan2(t.b,t.a)*Qe;return new gr(n<0?n+360:n,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}function pr(t,n,e,r){return 1===arguments.length?dr(t):new gr(t,n,e,null==r?1:r)}function gr(t,n,e,r){this.h=+t,this.c=+n,this.l=+e,this.opacity=+r}function yr(t){if(isNaN(t.h))return new cr(t.l,0,0,t.opacity);var n=t.h*Ke;return new cr(t.l,Math.cos(n)*t.c,Math.sin(n)*t.c,t.opacity)}ge(cr,ur,ye(ve,{brighter(t){return new cr(this.l+18*(null==t?1:t),this.a,this.b,this.opacity)},darker(t){return new cr(this.l-18*(null==t?1:t),this.a,this.b,this.opacity)},rgb(){var t=(this.l+16)/116,n=isNaN(this.a)?t:t+this.a/500,e=isNaN(this.b)?t:t-this.b/200;return new Ue(lr(3.1338561*(n=Je*sr(n))-1.6168667*(t=tr*sr(t))-.4906146*(e=nr*sr(e))),lr(-.9787684*n+1.9161415*t+.033454*e),lr(.0719453*n-.2289914*t+1.4052427*e),this.opacity)}})),ge(gr,pr,ye(ve,{brighter(t){return new gr(this.h,this.c,this.l+18*(null==t?1:t),this.opacity)},darker(t){return new gr(this.h,this.c,this.l-18*(null==t?1:t),this.opacity)},rgb(){return yr(this).rgb()}}));var vr=-.14861,_r=1.78277,br=-.29227,mr=-.90649,xr=1.97294,wr=xr*mr,Mr=xr*_r,Tr=_r*br-mr*vr;function Ar(t,n,e,r){return 1===arguments.length?function(t){if(t instanceof Sr)return new Sr(t.h,t.s,t.l,t.opacity);t instanceof Ue||(t=Fe(t));var n=t.r/255,e=t.g/255,r=t.b/255,i=(Tr*r+wr*n-Mr*e)/(Tr+wr-Mr),o=r-i,a=(xr*(e-i)-br*o)/mr,u=Math.sqrt(a*a+o*o)/(xr*i*(1-i)),c=u?Math.atan2(a,o)*Qe-120:NaN;return new Sr(c<0?c+360:c,u,i,t.opacity)}(t):new Sr(t,n,e,null==r?1:r)}function Sr(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function Er(t,n,e,r,i){var o=t*t,a=o*t;return((1-3*t+3*o-a)*n+(4-6*o+3*a)*e+(1+3*t+3*o-3*a)*r+a*i)/6}function Nr(t){var n=t.length-1;return function(e){var r=e<=0?e=0:e>=1?(e=1,n-1):Math.floor(e*n),i=t[r],o=t[r+1],a=r>0?t[r-1]:2*i-o,u=r<n-1?t[r+2]:2*o-i;return Er((e-r/n)*n,a,i,o,u)}}function kr(t){var n=t.length;return function(e){var r=Math.floor(((e%=1)<0?++e:e)*n),i=t[(r+n-1)%n],o=t[r%n],a=t[(r+1)%n],u=t[(r+2)%n];return Er((e-r/n)*n,i,o,a,u)}}ge(Sr,Ar,ye(ve,{brighter(t){return t=null==t?be:Math.pow(be,t),new Sr(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?_e:Math.pow(_e,t),new Sr(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=isNaN(this.h)?0:(this.h+120)*Ke,n=+this.l,e=isNaN(this.s)?0:this.s*n*(1-n),r=Math.cos(t),i=Math.sin(t);return new Ue(255*(n+e*(vr*r+_r*i)),255*(n+e*(br*r+mr*i)),255*(n+e*(xr*r)),this.opacity)}}));var Cr=t=>()=>t;function Pr(t,n){return function(e){return t+e*n}}function zr(t,n){var e=n-t;return e?Pr(t,e>180||e<-180?e-360*Math.round(e/360):e):Cr(isNaN(t)?n:t)}function $r(t){return 1==(t=+t)?Dr:function(n,e){return e-n?function(t,n,e){return t=Math.pow(t,e),n=Math.pow(n,e)-t,e=1/e,function(r){return Math.pow(t+r*n,e)}}(n,e,t):Cr(isNaN(n)?e:n)}}function Dr(t,n){var e=n-t;return e?Pr(t,e):Cr(isNaN(t)?n:t)}var Rr=function t(n){var e=$r(n);function r(t,n){var r=e((t=qe(t)).r,(n=qe(n)).r),i=e(t.g,n.g),o=e(t.b,n.b),a=Dr(t.opacity,n.opacity);return function(n){return t.r=r(n),t.g=i(n),t.b=o(n),t.opacity=a(n),t+""}}return r.gamma=t,r}(1);function Fr(t){return function(n){var e,r,i=n.length,o=new Array(i),a=new Array(i),u=new Array(i);for(e=0;e<i;++e)r=qe(n[e]),o[e]=r.r||0,a[e]=r.g||0,u[e]=r.b||0;return o=t(o),a=t(a),u=t(u),r.opacity=1,function(t){return r.r=o(t),r.g=a(t),r.b=u(t),r+""}}}var qr=Fr(Nr),Ur=Fr(kr);function Ir(t,n){n||(n=[]);var e,r=t?Math.min(n.length,t.length):0,i=n.slice();return function(o){for(e=0;e<r;++e)i[e]=t[e]*(1-o)+n[e]*o;return i}}function Or(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function Br(t,n){var e,r=n?n.length:0,i=t?Math.min(r,t.length):0,o=new Array(i),a=new Array(r);for(e=0;e<i;++e)o[e]=Vr(t[e],n[e]);for(;e<r;++e)a[e]=n[e];return function(t){for(e=0;e<i;++e)a[e]=o[e](t);return a}}function Yr(t,n){var e=new Date;return t=+t,n=+n,function(r){return e.setTime(t*(1-r)+n*r),e}}function Lr(t,n){return t=+t,n=+n,function(e){return t*(1-e)+n*e}}function jr(t,n){var e,r={},i={};for(e in null!==t&&"object"==typeof t||(t={}),null!==n&&"object"==typeof n||(n={}),n)e in t?r[e]=Vr(t[e],n[e]):i[e]=n[e];return function(t){for(e in r)i[e]=r[e](t);return i}}var Hr=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Xr=new RegExp(Hr.source,"g");function Gr(t,n){var e,r,i,o=Hr.lastIndex=Xr.lastIndex=0,a=-1,u=[],c=[];for(t+="",n+="";(e=Hr.exec(t))&&(r=Xr.exec(n));)(i=r.index)>o&&(i=n.slice(o,i),u[a]?u[a]+=i:u[++a]=i),(e=e[0])===(r=r[0])?u[a]?u[a]+=r:u[++a]=r:(u[++a]=null,c.push({i:a,x:Lr(e,r)})),o=Xr.lastIndex;return o<n.length&&(i=n.slice(o),u[a]?u[a]+=i:u[++a]=i),u.length<2?c[0]?function(t){return function(n){return t(n)+""}}(c[0].x):function(t){return function(){return t}}(n):(n=c.length,function(t){for(var e,r=0;r<n;++r)u[(e=c[r]).i]=e.x(t);return u.join("")})}function Vr(t,n){var e,r=typeof n;return null==n||"boolean"===r?Cr(n):("number"===r?Lr:"string"===r?(e=$e(n))?(n=e,Rr):Gr:n instanceof $e?Rr:n instanceof Date?Yr:Or(n)?Ir:Array.isArray(n)?Br:"function"!=typeof n.valueOf&&"function"!=typeof n.toString||isNaN(n)?jr:Lr)(t,n)}function Wr(t,n){return t=+t,n=+n,function(e){return Math.round(t*(1-e)+n*e)}}var Zr,Kr=180/Math.PI,Qr={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Jr(t,n,e,r,i,o){var a,u,c;return(a=Math.sqrt(t*t+n*n))&&(t/=a,n/=a),(c=t*e+n*r)&&(e-=t*c,r-=n*c),(u=Math.sqrt(e*e+r*r))&&(e/=u,r/=u,c/=u),t*r<n*e&&(t=-t,n=-n,c=-c,a=-a),{translateX:i,translateY:o,rotate:Math.atan2(n,t)*Kr,skewX:Math.atan(c)*Kr,scaleX:a,scaleY:u}}function ti(t,n,e,r){function i(t){return t.length?t.pop()+" ":""}return function(o,a){var u=[],c=[];return o=t(o),a=t(a),function(t,r,i,o,a,u){if(t!==i||r!==o){var c=a.push("translate(",null,n,null,e);u.push({i:c-4,x:Lr(t,i)},{i:c-2,x:Lr(r,o)})}else(i||o)&&a.push("translate("+i+n+o+e)}(o.translateX,o.translateY,a.translateX,a.translateY,u,c),function(t,n,e,o){t!==n?(t-n>180?n+=360:n-t>180&&(t+=360),o.push({i:e.push(i(e)+"rotate(",null,r)-2,x:Lr(t,n)})):n&&e.push(i(e)+"rotate("+n+r)}(o.rotate,a.rotate,u,c),function(t,n,e,o){t!==n?o.push({i:e.push(i(e)+"skewX(",null,r)-2,x:Lr(t,n)}):n&&e.push(i(e)+"skewX("+n+r)}(o.skewX,a.skewX,u,c),function(t,n,e,r,o,a){if(t!==e||n!==r){var u=o.push(i(o)+"scale(",null,",",null,")");a.push({i:u-4,x:Lr(t,e)},{i:u-2,x:Lr(n,r)})}else 1===e&&1===r||o.push(i(o)+"scale("+e+","+r+")")}(o.scaleX,o.scaleY,a.scaleX,a.scaleY,u,c),o=a=null,function(t){for(var n,e=-1,r=c.length;++e<r;)u[(n=c[e]).i]=n.x(t);return u.join("")}}}var ni=ti((function(t){const n=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(t+"");return n.isIdentity?Qr:Jr(n.a,n.b,n.c,n.d,n.e,n.f)}),"px, ","px)","deg)"),ei=ti((function(t){return null==t?Qr:(Zr||(Zr=document.createElementNS("http://www.w3.org/2000/svg","g")),Zr.setAttribute("transform",t),(t=Zr.transform.baseVal.consolidate())?Jr((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):Qr)}),", ",")",")");function ri(t){return((t=Math.exp(t))+1/t)/2}var ii=function t(n,e,r){function i(t,i){var o,a,u=t[0],c=t[1],f=t[2],s=i[0],l=i[1],h=i[2],d=s-u,p=l-c,g=d*d+p*p;if(g<1e-12)a=Math.log(h/f)/n,o=function(t){return[u+t*d,c+t*p,f*Math.exp(n*t*a)]};else{var y=Math.sqrt(g),v=(h*h-f*f+r*g)/(2*f*e*y),_=(h*h-f*f-r*g)/(2*h*e*y),b=Math.log(Math.sqrt(v*v+1)-v),m=Math.log(Math.sqrt(_*_+1)-_);a=(m-b)/n,o=function(t){var r=t*a,i=ri(b),o=f/(e*y)*(i*function(t){return((t=Math.exp(2*t))-1)/(t+1)}(n*r+b)-function(t){return((t=Math.exp(t))-1/t)/2}(b));return[u+o*d,c+o*p,f*i/ri(n*r+b)]}}return o.duration=1e3*a*n/Math.SQRT2,o}return i.rho=function(n){var e=Math.max(.001,+n),r=e*e;return t(e,r,r*r)},i}(Math.SQRT2,2,4);function oi(t){return function(n,e){var r=t((n=Xe(n)).h,(e=Xe(e)).h),i=Dr(n.s,e.s),o=Dr(n.l,e.l),a=Dr(n.opacity,e.opacity);return function(t){return n.h=r(t),n.s=i(t),n.l=o(t),n.opacity=a(t),n+""}}}var ai=oi(zr),ui=oi(Dr);function ci(t){return function(n,e){var r=t((n=pr(n)).h,(e=pr(e)).h),i=Dr(n.c,e.c),o=Dr(n.l,e.l),a=Dr(n.opacity,e.opacity);return function(t){return n.h=r(t),n.c=i(t),n.l=o(t),n.opacity=a(t),n+""}}}var fi=ci(zr),si=ci(Dr);function li(t){return function n(e){function r(n,r){var i=t((n=Ar(n)).h,(r=Ar(r)).h),o=Dr(n.s,r.s),a=Dr(n.l,r.l),u=Dr(n.opacity,r.opacity);return function(t){return n.h=i(t),n.s=o(t),n.l=a(Math.pow(t,e)),n.opacity=u(t),n+""}}return e=+e,r.gamma=n,r}(1)}var hi=li(zr),di=li(Dr);function pi(t,n){void 0===n&&(n=t,t=Vr);for(var e=0,r=n.length-1,i=n[0],o=new Array(r<0?0:r);e<r;)o[e]=t(i,i=n[++e]);return function(t){var n=Math.max(0,Math.min(r-1,Math.floor(t*=r)));return o[n](t-n)}}var gi,yi,vi=0,_i=0,bi=0,mi=1e3,xi=0,wi=0,Mi=0,Ti="object"==typeof performance&&performance.now?performance:Date,Ai="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Si(){return wi||(Ai(Ei),wi=Ti.now()+Mi)}function Ei(){wi=0}function Ni(){this._call=this._time=this._next=null}function ki(t,n,e){var r=new Ni;return r.restart(t,n,e),r}function Ci(){Si(),++vi;for(var t,n=gi;n;)(t=wi-n._time)>=0&&n._call.call(void 0,t),n=n._next;--vi}function Pi(){wi=(xi=Ti.now())+Mi,vi=_i=0;try{Ci()}finally{vi=0,function(){var t,n,e=gi,r=1/0;for(;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:gi=n);yi=t,$i(r)}(),wi=0}}function zi(){var t=Ti.now(),n=t-xi;n>mi&&(Mi-=n,xi=t)}function $i(t){vi||(_i&&(_i=clearTimeout(_i)),t-wi>24?(t<1/0&&(_i=setTimeout(Pi,t-Ti.now()-Mi)),bi&&(bi=clearInterval(bi))):(bi||(xi=Ti.now(),bi=setInterval(zi,mi)),vi=1,Ai(Pi)))}function Di(t,n,e){var r=new Ni;return n=null==n?0:+n,r.restart((e=>{r.stop(),t(e+n)}),n,e),r}Ni.prototype=ki.prototype={constructor:Ni,restart:function(t,n,e){if("function"!=typeof t)throw new TypeError("callback is not a function");e=(null==e?Si():+e)+(null==n?0:+n),this._next||yi===this||(yi?yi._next=this:gi=this,yi=this),this._call=t,this._time=e,$i()},stop:function(){this._call&&(this._call=null,this._time=1/0,$i())}};var Ri=Dt("start","end","cancel","interrupt"),Fi=[],qi=0,Ui=1,Ii=2,Oi=3,Bi=4,Yi=5,Li=6;function ji(t,n,e,r,i,o){var a=t.__transition;if(a){if(e in a)return}else t.__transition={};!function(t,n,e){var r,i=t.__transition;function o(t){e.state=Ui,e.timer.restart(a,e.delay,e.time),e.delay<=t&&a(t-e.delay)}function a(o){var f,s,l,h;if(e.state!==Ui)return c();for(f in i)if((h=i[f]).name===e.name){if(h.state===Oi)return Di(a);h.state===Bi?(h.state=Li,h.timer.stop(),h.on.call("interrupt",t,t.__data__,h.index,h.group),delete i[f]):+f<n&&(h.state=Li,h.timer.stop(),h.on.call("cancel",t,t.__data__,h.index,h.group),delete i[f])}if(Di((function(){e.state===Oi&&(e.state=Bi,e.timer.restart(u,e.delay,e.time),u(o))})),e.state=Ii,e.on.call("start",t,t.__data__,e.index,e.group),e.state===Ii){for(e.state=Oi,r=new Array(l=e.tween.length),f=0,s=-1;f<l;++f)(h=e.tween[f].value.call(t,t.__data__,e.index,e.group))&&(r[++s]=h);r.length=s+1}}function u(n){for(var i=n<e.duration?e.ease.call(null,n/e.duration):(e.timer.restart(c),e.state=Yi,1),o=-1,a=r.length;++o<a;)r[o].call(t,i);e.state===Yi&&(e.on.call("end",t,t.__data__,e.index,e.group),c())}function c(){for(var r in e.state=Li,e.timer.stop(),delete i[n],i)return;delete t.__transition}i[n]=e,e.timer=ki(o,0,e.time)}(t,e,{name:n,index:r,group:i,on:Ri,tween:Fi,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:qi})}function Hi(t,n){var e=Gi(t,n);if(e.state>qi)throw new Error("too late; already scheduled");return e}function Xi(t,n){var e=Gi(t,n);if(e.state>Oi)throw new Error("too late; already running");return e}function Gi(t,n){var e=t.__transition;if(!e