UNPKG

@stg-247/react-d3-credit-score-guage

Version:

Guage graph using d3 and ReactJs for visualizing Credit Scores.

3 lines (2 loc) 48.1 kB
import t from"react";var n={value:()=>{}};function e(){for(var t,n=0,e=arguments.length,i={};n<e;++n){if(!(t=arguments[n]+"")||t in i||/[\s.]/.test(t))throw new Error("illegal type: "+t);i[t]=[]}return new r(i)}function r(t){this._=t}function i(t,n){for(var e,r=0,i=t.length;r<i;++r)if((e=t[r]).name===n)return e.value}function o(t,e,r){for(var i=0,o=t.length;i<o;++i)if(t[i].name===e){t[i]=n,t=t.slice(0,i).concat(t.slice(i+1));break}return null!=r&&t.push({name:e,value:r}),t}r.prototype=e.prototype={constructor:r,on:function(t,n){var e,r,a=this._,u=(r=a,(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}}))),s=-1,l=u.length;if(!(arguments.length<2)){if(null!=n&&"function"!=typeof n)throw new Error("invalid callback: "+n);for(;++s<l;)if(e=(t=u[s]).type)a[e]=o(a[e],t.name,n);else if(null==n)for(e in a)a[e]=o(a[e],t.name,null);return this}for(;++s<l;)if((e=(t=u[s]).type)&&(e=i(a[e],t.name)))return e},copy:function(){var t={},n=this._;for(var e in n)t[e]=n[e].slice();return new r(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 a="http://www.w3.org/1999/xhtml",u={svg:"http://www.w3.org/2000/svg",xhtml:a,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function s(t){var n=t+="",e=n.indexOf(":");return e>=0&&"xmlns"!==(n=t.slice(0,e))&&(t=t.slice(e+1)),u.hasOwnProperty(n)?{space:u[n],local:t}:t}function l(t){return function(){var n=this.ownerDocument,e=this.namespaceURI;return e===a&&n.documentElement.namespaceURI===a?n.createElement(t):n.createElementNS(e,t)}}function c(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function h(t){var n=s(t);return(n.local?c:l)(n)}function f(){}function p(t){return null==t?f:function(){return this.querySelector(t)}}function d(t){return null==t?[]:Array.isArray(t)?t:Array.from(t)}function y(){return[]}function g(t){return null==t?y:function(){return this.querySelectorAll(t)}}function _(t){return function(){return this.matches(t)}}function v(t){return function(n){return n.matches(t)}}var m=Array.prototype.find;function w(){return this.firstElementChild}var x=Array.prototype.filter;function b(){return Array.from(this.children)}function $(t){return new Array(t.length)}function A(t,n){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=n}function k(t,n,e,r,i,o){for(var a,u=0,s=n.length,l=o.length;u<l;++u)(a=n[u])?(a.__data__=o[u],r[u]=a):e[u]=new A(t,o[u]);for(;u<s;++u)(a=n[u])&&(i[u]=a)}function M(t,n,e,r,i,o,a){var u,s,l,c=new Map,h=n.length,f=o.length,p=new Array(h);for(u=0;u<h;++u)(s=n[u])&&(p[u]=l=a.call(s,s.__data__,u,n)+"",c.has(l)?i[u]=s:c.set(l,s));for(u=0;u<f;++u)l=a.call(t,o[u],u,o)+"",(s=c.get(l))?(r[u]=s,s.__data__=o[u],c.delete(l)):e[u]=new A(t,o[u]);for(u=0;u<h;++u)(s=n[u])&&c.get(p[u])===s&&(i[u]=s)}function N(t){return t.__data__}function E(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function S(t,n){return t<n?-1:t>n?1:t>=n?0:NaN}function C(t){return function(){this.removeAttribute(t)}}function T(t){return function(){this.removeAttributeNS(t.space,t.local)}}function R(t,n){return function(){this.setAttribute(t,n)}}function q(t,n){return function(){this.setAttributeNS(t.space,t.local,n)}}function P(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttribute(t):this.setAttribute(t,e)}}function X(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 O(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function j(t){return function(){this.style.removeProperty(t)}}function D(t,n,e){return function(){this.style.setProperty(t,n,e)}}function I(t,n,e){return function(){var r=n.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,e)}}function L(t,n){return t.style.getPropertyValue(n)||O(t).getComputedStyle(t,null).getPropertyValue(n)}function H(t){return function(){delete this[t]}}function Y(t,n){return function(){this[t]=n}}function B(t,n){return function(){var e=n.apply(this,arguments);null==e?delete this[t]:this[t]=e}}function z(t){return t.trim().split(/^|\s+/)}function V(t){return t.classList||new G(t)}function G(t){this._node=t,this._names=z(t.getAttribute("class")||"")}function U(t,n){for(var e=V(t),r=-1,i=n.length;++r<i;)e.add(n[r])}function F(t,n){for(var e=V(t),r=-1,i=n.length;++r<i;)e.remove(n[r])}function Z(t){return function(){U(this,t)}}function K(t){return function(){F(this,t)}}function Q(t,n){return function(){(n.apply(this,arguments)?U:F)(this,t)}}function W(){this.textContent=""}function J(t){return function(){this.textContent=t}}function tt(t){return function(){var n=t.apply(this,arguments);this.textContent=null==n?"":n}}function nt(){this.innerHTML=""}function et(t){return function(){this.innerHTML=t}}function rt(t){return function(){var n=t.apply(this,arguments);this.innerHTML=null==n?"":n}}function it(){this.nextSibling&&this.parentNode.appendChild(this)}function ot(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function at(){return null}function ut(){var t=this.parentNode;t&&t.removeChild(this)}function st(){var t=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(t,this.nextSibling):t}function lt(){var t=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(t,this.nextSibling):t}function ct(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 ht(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 ft(t,n,e){var r=O(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 pt(t,n){return function(){return ft(this,t,n)}}function dt(t,n){return function(){return ft(this,t,n.apply(this,arguments))}}A.prototype={constructor:A,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)}},G.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 yt=[null];function gt(t,n){this._groups=t,this._parents=n}function _t(){return new gt([[document.documentElement]],yt)}function vt(t){return"string"==typeof t?new gt([[document.querySelector(t)]],[document.documentElement]):new gt([[t]],yt)}function mt(t,n,e){t.prototype=n.prototype=e,e.constructor=t}function wt(t,n){var e=Object.create(t.prototype);for(var r in n)e[r]=n[r];return e}function xt(){}gt.prototype=_t.prototype={constructor:gt,select:function(t){"function"!=typeof t&&(t=p(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],s=u.length,l=r[i]=new Array(s),c=0;c<s;++c)(o=u[c])&&(a=t.call(o,o.__data__,c,u))&&("__data__"in o&&(a.__data__=o.__data__),l[c]=a);return new gt(r,this._parents)},selectAll:function(t){t="function"==typeof t?function(t){return function(){return d(t.apply(this,arguments))}}(t):g(t);for(var n=this._groups,e=n.length,r=[],i=[],o=0;o<e;++o)for(var a,u=n[o],s=u.length,l=0;l<s;++l)(a=u[l])&&(r.push(t.call(a,a.__data__,l,u)),i.push(a));return new gt(r,i)},selectChild:function(t){return this.select(null==t?w:function(t){return function(){return m.call(this.children,t)}}("function"==typeof t?t:v(t)))},selectChildren:function(t){return this.selectAll(null==t?b:function(t){return function(){return x.call(this.children,t)}}("function"==typeof t?t:v(t)))},filter:function(t){"function"!=typeof t&&(t=_(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,s=r[i]=[],l=0;l<u;++l)(o=a[l])&&t.call(o,o.__data__,l,a)&&s.push(o);return new gt(r,this._parents)},data:function(t,n){if(!arguments.length)return Array.from(this,N);var e,r=n?M:k,i=this._parents,o=this._groups;"function"!=typeof t&&(e=t,t=function(){return e});for(var a=o.length,u=new Array(a),s=new Array(a),l=new Array(a),c=0;c<a;++c){var h=i[c],f=o[c],p=f.length,d=E(t.call(h,h&&h.__data__,c,i)),y=d.length,g=s[c]=new Array(y),_=u[c]=new Array(y);r(h,f,g,_,l[c]=new Array(p),d,n);for(var v,m,w=0,x=0;w<y;++w)if(v=g[w]){for(w>=x&&(x=w+1);!(m=_[x])&&++x<y;);v._next=m||null}}return(u=new gt(u,i))._enter=s,u._exit=l,u},enter:function(){return new gt(this._enter||this._groups.map($),this._parents)},exit:function(){return new gt(this._exit||this._groups.map($),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),s=0;s<a;++s)for(var l,c=e[s],h=r[s],f=c.length,p=u[s]=new Array(f),d=0;d<f;++d)(l=c[d]||h[d])&&(p[d]=l);for(;s<i;++s)u[s]=e[s];return new gt(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=S);for(var e=this._groups,r=e.length,i=new Array(r),o=0;o<r;++o){for(var a,u=e[o],s=u.length,l=i[o]=new Array(s),c=0;c<s;++c)(a=u[c])&&(l[c]=a);l.sort(n)}return new gt(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=s(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?T:C:"function"==typeof n?e.local?X:P:e.local?q:R)(e,n))},style:function(t,n,e){return arguments.length>1?this.each((null==n?j:"function"==typeof n?I:D)(t,n,null==e?"":e)):L(this.node(),t)},property:function(t,n){return arguments.length>1?this.each((null==n?H:"function"==typeof n?B:Y)(t,n)):this.node()[t]},classed:function(t,n){var e=z(t+"");if(arguments.length<2){for(var r=V(this.node()),i=-1,o=e.length;++i<o;)if(!r.contains(e[i]))return!1;return!0}return this.each(("function"==typeof n?Q:n?Z:K)(e,n))},text:function(t){return arguments.length?this.each(null==t?W:("function"==typeof t?tt:J)(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?nt:("function"==typeof t?rt:et)(t)):this.node().innerHTML},raise:function(){return this.each(it)},lower:function(){return this.each(ot)},append:function(t){var n="function"==typeof t?t:h(t);return this.select((function(){return this.appendChild(n.apply(this,arguments))}))},insert:function(t,n){var e="function"==typeof t?t:h(t),r=null==n?at:"function"==typeof n?n:p(n);return this.select((function(){return this.insertBefore(e.apply(this,arguments),r.apply(this,arguments)||null)}))},remove:function(){return this.each(ut)},clone:function(t){return this.select(t?lt:st)},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?ht:ct,r=0;r<a;++r)this.each(u(o[r],n,e));return this}var u=this.node().__on;if(u)for(var s,l=0,c=u.length;l<c;++l)for(r=0,s=u[l];r<a;++r)if((i=o[r]).type===s.type&&i.name===s.name)return s.value},dispatch:function(t,n){return this.each(("function"==typeof n?dt:pt)(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 bt=.7,$t=1/bt,At="\\s*([+-]?\\d+)\\s*",kt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Mt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Nt=/^#([0-9a-f]{3,8})$/,Et=new RegExp(`^rgb\\(${At},${At},${At}\\)$`),St=new RegExp(`^rgb\\(${Mt},${Mt},${Mt}\\)$`),Ct=new RegExp(`^rgba\\(${At},${At},${At},${kt}\\)$`),Tt=new RegExp(`^rgba\\(${Mt},${Mt},${Mt},${kt}\\)$`),Rt=new RegExp(`^hsl\\(${kt},${Mt},${Mt}\\)$`),qt=new RegExp(`^hsla\\(${kt},${Mt},${Mt},${kt}\\)$`),Pt={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 Xt(){return this.rgb().formatHex()}function Ot(){return this.rgb().formatRgb()}function jt(t){var n,e;return t=(t+"").trim().toLowerCase(),(n=Nt.exec(t))?(e=n[1].length,n=parseInt(n[1],16),6===e?Dt(n):3===e?new Ht(n>>8&15|n>>4&240,n>>4&15|240&n,(15&n)<<4|15&n,1):8===e?It(n>>24&255,n>>16&255,n>>8&255,(255&n)/255):4===e?It(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=Et.exec(t))?new Ht(n[1],n[2],n[3],1):(n=St.exec(t))?new Ht(255*n[1]/100,255*n[2]/100,255*n[3]/100,1):(n=Ct.exec(t))?It(n[1],n[2],n[3],n[4]):(n=Tt.exec(t))?It(255*n[1]/100,255*n[2]/100,255*n[3]/100,n[4]):(n=Rt.exec(t))?Ut(n[1],n[2]/100,n[3]/100,1):(n=qt.exec(t))?Ut(n[1],n[2]/100,n[3]/100,n[4]):Pt.hasOwnProperty(t)?Dt(Pt[t]):"transparent"===t?new Ht(NaN,NaN,NaN,0):null}function Dt(t){return new Ht(t>>16&255,t>>8&255,255&t,1)}function It(t,n,e,r){return r<=0&&(t=n=e=NaN),new Ht(t,n,e,r)}function Lt(t,n,e,r){return 1===arguments.length?((i=t)instanceof xt||(i=jt(i)),i?new Ht((i=i.rgb()).r,i.g,i.b,i.opacity):new Ht):new Ht(t,n,e,null==r?1:r);var i}function Ht(t,n,e,r){this.r=+t,this.g=+n,this.b=+e,this.opacity=+r}function Yt(){return`#${Gt(this.r)}${Gt(this.g)}${Gt(this.b)}`}function Bt(){const t=zt(this.opacity);return`${1===t?"rgb(":"rgba("}${Vt(this.r)}, ${Vt(this.g)}, ${Vt(this.b)}${1===t?")":`, ${t})`}`}function zt(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Vt(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Gt(t){return((t=Vt(t))<16?"0":"")+t.toString(16)}function Ut(t,n,e,r){return r<=0?t=n=e=NaN:e<=0||e>=1?t=n=NaN:n<=0&&(t=NaN),new Zt(t,n,e,r)}function Ft(t){if(t instanceof Zt)return new Zt(t.h,t.s,t.l,t.opacity);if(t instanceof xt||(t=jt(t)),!t)return new Zt;if(t instanceof Zt)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,s=(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/=s<.5?o+i:2-o-i,a*=60):u=s>0&&s<1?0:a,new Zt(a,u,s,t.opacity)}function Zt(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function Kt(t){return(t=(t||0)%360)<0?t+360:t}function Qt(t){return Math.max(0,Math.min(1,t||0))}function Wt(t,n,e){return 255*(t<60?n+(e-n)*t/60:t<180?e:t<240?n+(e-n)*(240-t)/60:n)}mt(xt,jt,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Xt,formatHex:Xt,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Ft(this).formatHsl()},formatRgb:Ot,toString:Ot}),mt(Ht,Lt,wt(xt,{brighter(t){return t=null==t?$t:Math.pow($t,t),new Ht(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?bt:Math.pow(bt,t),new Ht(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Ht(Vt(this.r),Vt(this.g),Vt(this.b),zt(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:Yt,formatHex:Yt,formatHex8:function(){return`#${Gt(this.r)}${Gt(this.g)}${Gt(this.b)}${Gt(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:Bt,toString:Bt})),mt(Zt,(function(t,n,e,r){return 1===arguments.length?Ft(t):new Zt(t,n,e,null==r?1:r)}),wt(xt,{brighter(t){return t=null==t?$t:Math.pow($t,t),new Zt(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?bt:Math.pow(bt,t),new Zt(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 Ht(Wt(t>=240?t-240:t+120,i,r),Wt(t,i,r),Wt(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new Zt(Kt(this.h),Qt(this.s),Qt(this.l),zt(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=zt(this.opacity);return`${1===t?"hsl(":"hsla("}${Kt(this.h)}, ${100*Qt(this.s)}%, ${100*Qt(this.l)}%${1===t?")":`, ${t})`}`}}));var Jt=t=>()=>t;function tn(t){return 1==(t=+t)?nn: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):Jt(isNaN(n)?e:n)}}function nn(t,n){var e=n-t;return e?function(t,n){return function(e){return t+e*n}}(t,e):Jt(isNaN(t)?n:t)}var en=function t(n){var e=tn(n);function r(t,n){var r=e((t=Lt(t)).r,(n=Lt(n)).r),i=e(t.g,n.g),o=e(t.b,n.b),a=nn(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 rn(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 on(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]=fn(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 an(t,n){var e=new Date;return t=+t,n=+n,function(r){return e.setTime(t*(1-r)+n*r),e}}function un(t,n){return t=+t,n=+n,function(e){return t*(1-e)+n*e}}function sn(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]=fn(t[e],n[e]):i[e]=n[e];return function(t){for(e in r)i[e]=r[e](t);return i}}var ln=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,cn=new RegExp(ln.source,"g");function hn(t,n){var e,r,i,o=ln.lastIndex=cn.lastIndex=0,a=-1,u=[],s=[];for(t+="",n+="";(e=ln.exec(t))&&(r=cn.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,s.push({i:a,x:un(e,r)})),o=cn.lastIndex;return o<n.length&&(i=n.slice(o),u[a]?u[a]+=i:u[++a]=i),u.length<2?s[0]?function(t){return function(n){return t(n)+""}}(s[0].x):function(t){return function(){return t}}(n):(n=s.length,function(t){for(var e,r=0;r<n;++r)u[(e=s[r]).i]=e.x(t);return u.join("")})}function fn(t,n){var e,r,i=typeof n;return null==n||"boolean"===i?Jt(n):("number"===i?un:"string"===i?(e=jt(n))?(n=e,en):hn:n instanceof jt?en:n instanceof Date?an:(r=n,!ArrayBuffer.isView(r)||r instanceof DataView?Array.isArray(n)?on:"function"!=typeof n.valueOf&&"function"!=typeof n.toString||isNaN(n)?sn:un:rn))(t,n)}var pn,dn=180/Math.PI,yn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function gn(t,n,e,r,i,o){var a,u,s;return(a=Math.sqrt(t*t+n*n))&&(t/=a,n/=a),(s=t*e+n*r)&&(e-=t*s,r-=n*s),(u=Math.sqrt(e*e+r*r))&&(e/=u,r/=u,s/=u),t*r<n*e&&(t=-t,n=-n,s=-s,a=-a),{translateX:i,translateY:o,rotate:Math.atan2(n,t)*dn,skewX:Math.atan(s)*dn,scaleX:a,scaleY:u}}function _n(t,n,e,r){function i(t){return t.length?t.pop()+" ":""}return function(o,a){var u=[],s=[];return o=t(o),a=t(a),function(t,r,i,o,a,u){if(t!==i||r!==o){var s=a.push("translate(",null,n,null,e);u.push({i:s-4,x:un(t,i)},{i:s-2,x:un(r,o)})}else(i||o)&&a.push("translate("+i+n+o+e)}(o.translateX,o.translateY,a.translateX,a.translateY,u,s),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:un(t,n)})):n&&e.push(i(e)+"rotate("+n+r)}(o.rotate,a.rotate,u,s),function(t,n,e,o){t!==n?o.push({i:e.push(i(e)+"skewX(",null,r)-2,x:un(t,n)}):n&&e.push(i(e)+"skewX("+n+r)}(o.skewX,a.skewX,u,s),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:un(t,e)},{i:u-2,x:un(n,r)})}else 1===e&&1===r||o.push(i(o)+"scale("+e+","+r+")")}(o.scaleX,o.scaleY,a.scaleX,a.scaleY,u,s),o=a=null,function(t){for(var n,e=-1,r=s.length;++e<r;)u[(n=s[e]).i]=n.x(t);return u.join("")}}}var vn,mn,wn=_n((function(t){const n=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(t+"");return n.isIdentity?yn:gn(n.a,n.b,n.c,n.d,n.e,n.f)}),"px, ","px)","deg)"),xn=_n((function(t){return null==t?yn:(pn||(pn=document.createElementNS("http://www.w3.org/2000/svg","g")),pn.setAttribute("transform",t),(t=pn.transform.baseVal.consolidate())?gn((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):yn)}),", ",")",")"),bn=0,$n=0,An=0,kn=1e3,Mn=0,Nn=0,En=0,Sn="object"==typeof performance&&performance.now?performance:Date,Cn="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Tn(){return Nn||(Cn(Rn),Nn=Sn.now()+En)}function Rn(){Nn=0}function qn(){this._call=this._time=this._next=null}function Pn(t,n,e){var r=new qn;return r.restart(t,n,e),r}function Xn(){Nn=(Mn=Sn.now())+En,bn=$n=0;try{!function(){Tn(),++bn;for(var t,n=vn;n;)(t=Nn-n._time)>=0&&n._call.call(void 0,t),n=n._next;--bn}()}finally{bn=0,function(){var t,n,e=vn,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:vn=n);mn=t,jn(r)}(),Nn=0}}function On(){var t=Sn.now(),n=t-Mn;n>kn&&(En-=n,Mn=t)}function jn(t){bn||($n&&($n=clearTimeout($n)),t-Nn>24?(t<1/0&&($n=setTimeout(Xn,t-Sn.now()-En)),An&&(An=clearInterval(An))):(An||(Mn=Sn.now(),An=setInterval(On,kn)),bn=1,Cn(Xn)))}function Dn(t,n,e){var r=new qn;return n=null==n?0:+n,r.restart((e=>{r.stop(),t(e+n)}),n,e),r}qn.prototype=Pn.prototype={constructor:qn,restart:function(t,n,e){if("function"!=typeof t)throw new TypeError("callback is not a function");e=(null==e?Tn():+e)+(null==n?0:+n),this._next||mn===this||(mn?mn._next=this:vn=this,mn=this),this._call=t,this._time=e,jn()},stop:function(){this._call&&(this._call=null,this._time=1/0,jn())}};var In=e("start","end","cancel","interrupt"),Ln=[],Hn=0,Yn=1,Bn=2,zn=3,Vn=4,Gn=5,Un=6;function Fn(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=Yn,e.timer.restart(a,e.delay,e.time),e.delay<=t&&a(t-e.delay)}function a(o){var l,c,h,f;if(e.state!==Yn)return s();for(l in i)if((f=i[l]).name===e.name){if(f.state===zn)return Dn(a);f.state===Vn?(f.state=Un,f.timer.stop(),f.on.call("interrupt",t,t.__data__,f.index,f.group),delete i[l]):+l<n&&(f.state=Un,f.timer.stop(),f.on.call("cancel",t,t.__data__,f.index,f.group),delete i[l])}if(Dn((function(){e.state===zn&&(e.state=Vn,e.timer.restart(u,e.delay,e.time),u(o))})),e.state=Bn,e.on.call("start",t,t.__data__,e.index,e.group),e.state===Bn){for(e.state=zn,r=new Array(h=e.tween.length),l=0,c=-1;l<h;++l)(f=e.tween[l].value.call(t,t.__data__,e.index,e.group))&&(r[++c]=f);r.length=c+1}}function u(n){for(var i=n<e.duration?e.ease.call(null,n/e.duration):(e.timer.restart(s),e.state=Gn,1),o=-1,a=r.length;++o<a;)r[o].call(t,i);e.state===Gn&&(e.on.call("end",t,t.__data__,e.index,e.group),s())}function s(){for(var r in e.state=Un,e.timer.stop(),delete i[n],i)return;delete t.__transition}i[n]=e,e.timer=Pn(o,0,e.time)}(t,e,{name:n,index:r,group:i,on:In,tween:Ln,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:Hn})}function Zn(t,n){var e=Qn(t,n);if(e.state>Hn)throw new Error("too late; already scheduled");return e}function Kn(t,n){var e=Qn(t,n);if(e.state>zn)throw new Error("too late; already running");return e}function Qn(t,n){var e=t.__transition;if(!e||!(e=e[n]))throw new Error("transition not found");return e}function Wn(t,n){var e,r;return function(){var i=Kn(this,t),o=i.tween;if(o!==e)for(var a=0,u=(r=e=o).length;a<u;++a)if(r[a].name===n){(r=r.slice()).splice(a,1);break}i.tween=r}}function Jn(t,n,e){var r,i;if("function"!=typeof e)throw new Error;return function(){var o=Kn(this,t),a=o.tween;if(a!==r){i=(r=a).slice();for(var u={name:n,value:e},s=0,l=i.length;s<l;++s)if(i[s].name===n){i[s]=u;break}s===l&&i.push(u)}o.tween=i}}function te(t,n,e){var r=t._id;return t.each((function(){var t=Kn(this,r);(t.value||(t.value={}))[n]=e.apply(this,arguments)})),function(t){return Qn(t,r).value[n]}}function ne(t,n){var e;return("number"==typeof n?un:n instanceof jt?en:(e=jt(n))?(n=e,en):hn)(t,n)}function ee(t){return function(){this.removeAttribute(t)}}function re(t){return function(){this.removeAttributeNS(t.space,t.local)}}function ie(t,n,e){var r,i,o=e+"";return function(){var a=this.getAttribute(t);return a===o?null:a===r?i:i=n(r=a,e)}}function oe(t,n,e){var r,i,o=e+"";return function(){var a=this.getAttributeNS(t.space,t.local);return a===o?null:a===r?i:i=n(r=a,e)}}function ae(t,n,e){var r,i,o;return function(){var a,u,s=e(this);if(null!=s)return(a=this.getAttribute(t))===(u=s+"")?null:a===r&&u===i?o:(i=u,o=n(r=a,s));this.removeAttribute(t)}}function ue(t,n,e){var r,i,o;return function(){var a,u,s=e(this);if(null!=s)return(a=this.getAttributeNS(t.space,t.local))===(u=s+"")?null:a===r&&u===i?o:(i=u,o=n(r=a,s));this.removeAttributeNS(t.space,t.local)}}function se(t,n){var e,r;function i(){var i=n.apply(this,arguments);return i!==r&&(e=(r=i)&&function(t,n){return function(e){this.setAttributeNS(t.space,t.local,n.call(this,e))}}(t,i)),e}return i._value=n,i}function le(t,n){var e,r;function i(){var i=n.apply(this,arguments);return i!==r&&(e=(r=i)&&function(t,n){return function(e){this.setAttribute(t,n.call(this,e))}}(t,i)),e}return i._value=n,i}function ce(t,n){return function(){Zn(this,t).delay=+n.apply(this,arguments)}}function he(t,n){return n=+n,function(){Zn(this,t).delay=n}}function fe(t,n){return function(){Kn(this,t).duration=+n.apply(this,arguments)}}function pe(t,n){return n=+n,function(){Kn(this,t).duration=n}}var de=_t.prototype.constructor;function ye(t){return function(){this.style.removeProperty(t)}}var ge=0;function _e(t,n,e,r){this._groups=t,this._parents=n,this._name=e,this._id=r}function ve(){return++ge}var me=_t.prototype;_e.prototype={constructor:_e,select:function(t){var n=this._name,e=this._id;"function"!=typeof t&&(t=p(t));for(var r=this._groups,i=r.length,o=new Array(i),a=0;a<i;++a)for(var u,s,l=r[a],c=l.length,h=o[a]=new Array(c),f=0;f<c;++f)(u=l[f])&&(s=t.call(u,u.__data__,f,l))&&("__data__"in u&&(s.__data__=u.__data__),h[f]=s,Fn(h[f],n,e,f,h,Qn(u,e)));return new _e(o,this._parents,n,e)},selectAll:function(t){var n=this._name,e=this._id;"function"!=typeof t&&(t=g(t));for(var r=this._groups,i=r.length,o=[],a=[],u=0;u<i;++u)for(var s,l=r[u],c=l.length,h=0;h<c;++h)if(s=l[h]){for(var f,p=t.call(s,s.__data__,h,l),d=Qn(s,e),y=0,_=p.length;y<_;++y)(f=p[y])&&Fn(f,n,e,y,p,d);o.push(p),a.push(s)}return new _e(o,a,n,e)},selectChild:me.selectChild,selectChildren:me.selectChildren,filter:function(t){"function"!=typeof t&&(t=_(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,s=r[i]=[],l=0;l<u;++l)(o=a[l])&&t.call(o,o.__data__,l,a)&&s.push(o);return new _e(r,this._parents,this._name,this._id)},merge:function(t){if(t._id!==this._id)throw new Error;for(var n=this._groups,e=t._groups,r=n.length,i=e.length,o=Math.min(r,i),a=new Array(r),u=0;u<o;++u)for(var s,l=n[u],c=e[u],h=l.length,f=a[u]=new Array(h),p=0;p<h;++p)(s=l[p]||c[p])&&(f[p]=s);for(;u<r;++u)a[u]=n[u];return new _e(a,this._parents,this._name,this._id)},selection:function(){return new de(this._groups,this._parents)},transition:function(){for(var t=this._name,n=this._id,e=ve(),r=this._groups,i=r.length,o=0;o<i;++o)for(var a,u=r[o],s=u.length,l=0;l<s;++l)if(a=u[l]){var c=Qn(a,n);Fn(a,t,e,l,u,{time:c.time+c.delay+c.duration,delay:0,duration:c.duration,ease:c.ease})}return new _e(r,this._parents,t,e)},call:me.call,nodes:me.nodes,node:me.node,size:me.size,empty:me.empty,each:me.each,on:function(t,n){var e=this._id;return arguments.length<2?Qn(this.node(),e).on.on(t):this.each(function(t,n,e){var r,i,o=function(t){return(t+"").trim().split(/^|\s+/).every((function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||"start"===t}))}(n)?Zn:Kn;return function(){var a=o(this,t),u=a.on;u!==r&&(i=(r=u).copy()).on(n,e),a.on=i}}(e,t,n))},attr:function(t,n){var e=s(t),r="transform"===e?xn:ne;return this.attrTween(t,"function"==typeof n?(e.local?ue:ae)(e,r,te(this,"attr."+t,n)):null==n?(e.local?re:ee)(e):(e.local?oe:ie)(e,r,n))},attrTween:function(t,n){var e="attr."+t;if(arguments.length<2)return(e=this.tween(e))&&e._value;if(null==n)return this.tween(e,null);if("function"!=typeof n)throw new Error;var r=s(t);return this.tween(e,(r.local?se:le)(r,n))},style:function(t,n,e){var r="transform"==(t+="")?wn:ne;return null==n?this.styleTween(t,function(t,n){var e,r,i;return function(){var o=L(this,t),a=(this.style.removeProperty(t),L(this,t));return o===a?null:o===e&&a===r?i:i=n(e=o,r=a)}}(t,r)).on("end.style."+t,ye(t)):"function"==typeof n?this.styleTween(t,function(t,n,e){var r,i,o;return function(){var a=L(this,t),u=e(this),s=u+"";return null==u&&(this.style.removeProperty(t),s=u=L(this,t)),a===s?null:a===r&&s===i?o:(i=s,o=n(r=a,u))}}(t,r,te(this,"style."+t,n))).each(function(t,n){var e,r,i,o,a="style."+n,u="end."+a;return function(){var s=Kn(this,t),l=s.on,c=null==s.value[a]?o||(o=ye(n)):void 0;l===e&&i===c||(r=(e=l).copy()).on(u,i=c),s.on=r}}(this._id,t)):this.styleTween(t,function(t,n,e){var r,i,o=e+"";return function(){var a=L(this,t);return a===o?null:a===r?i:i=n(r=a,e)}}(t,r,n),e).on("end.style."+t,null)},styleTween:function(t,n,e){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==n)return this.tween(r,null);if("function"!=typeof n)throw new Error;return this.tween(r,function(t,n,e){var r,i;function o(){var o=n.apply(this,arguments);return o!==i&&(r=(i=o)&&function(t,n,e){return function(r){this.style.setProperty(t,n.call(this,r),e)}}(t,o,e)),r}return o._value=n,o}(t,n,null==e?"":e))},text:function(t){return this.tween("text","function"==typeof t?function(t){return function(){var n=t(this);this.textContent=null==n?"":n}}(te(this,"text",t)):function(t){return function(){this.textContent=t}}(null==t?"":t+""))},textTween:function(t){var n="text";if(arguments.length<1)return(n=this.tween(n))&&n._value;if(null==t)return this.tween(n,null);if("function"!=typeof t)throw new Error;return this.tween(n,function(t){var n,e;function r(){var r=t.apply(this,arguments);return r!==e&&(n=(e=r)&&function(t){return function(n){this.textContent=t.call(this,n)}}(r)),n}return r._value=t,r}(t))},remove:function(){return this.on("end.remove",function(t){return function(){var n=this.parentNode;for(var e in this.__transition)if(+e!==t)return;n&&n.removeChild(this)}}(this._id))},tween:function(t,n){var e=this._id;if(t+="",arguments.length<2){for(var r,i=Qn(this.node(),e).tween,o=0,a=i.length;o<a;++o)if((r=i[o]).name===t)return r.value;return null}return this.each((null==n?Wn:Jn)(e,t,n))},delay:function(t){var n=this._id;return arguments.length?this.each(("function"==typeof t?ce:he)(n,t)):Qn(this.node(),n).delay},duration:function(t){var n=this._id;return arguments.length?this.each(("function"==typeof t?fe:pe)(n,t)):Qn(this.node(),n).duration},ease:function(t){var n=this._id;return arguments.length?this.each(function(t,n){if("function"!=typeof n)throw new Error;return function(){Kn(this,t).ease=n}}(n,t)):Qn(this.node(),n).ease},easeVarying:function(t){if("function"!=typeof t)throw new Error;return this.each(function(t,n){return function(){var e=n.apply(this,arguments);if("function"!=typeof e)throw new Error;Kn(this,t).ease=e}}(this._id,t))},end:function(){var t,n,e=this,r=e._id,i=e.size();return new Promise((function(o,a){var u={value:a},s={value:function(){0==--i&&o()}};e.each((function(){var e=Kn(this,r),i=e.on;i!==t&&((n=(t=i).copy())._.cancel.push(u),n._.interrupt.push(u),n._.end.push(s)),e.on=n})),0===i&&o()}))},[Symbol.iterator]:me[Symbol.iterator]};var we={time:null,delay:0,duration:250,ease:function(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}};function xe(t,n){for(var e;!(e=t.__transition)||!(e=e[n]);)if(!(t=t.parentNode))throw new Error(`transition ${n} not found`);return e}_t.prototype.interrupt=function(t){return this.each((function(){!function(t,n){var e,r,i,o=t.__transition,a=!0;if(o){for(i in n=null==n?null:n+"",o)(e=o[i]).name===n?(r=e.state>Bn&&e.state<Gn,e.state=Un,e.timer.stop(),e.on.call(r?"interrupt":"cancel",t,t.__data__,e.index,e.group),delete o[i]):a=!1;a&&delete t.__transition}}(this,t)}))},_t.prototype.transition=function(t){var n,e;t instanceof _e?(n=t._id,t=t._name):(n=ve(),(e=we).time=Tn(),t=null==t?null:t+"");for(var r=this._groups,i=r.length,o=0;o<i;++o)for(var a,u=r[o],s=u.length,l=0;l<s;++l)(a=u[l])&&Fn(a,t,n,l,u,e||xe(a,n));return new _e(r,this._parents,t,n)};const be=Math.PI,$e=2*be,Ae=1e-6,ke=$e-Ae;function Me(t){this._+=t[0];for(let n=1,e=t.length;n<e;++n)this._+=arguments[n]+t[n]}class Ne{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=null==t?Me:function(t){let n=Math.floor(t);if(!(n>=0))throw new Error(`invalid digits: ${t}`);if(n>15)return Me;const e=10**n;return function(t){this._+=t[0];for(let n=1,r=t.length;n<r;++n)this._+=Math.round(arguments[n]*e)/e+t[n]}}(t)}moveTo(t,n){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,n){this._append`L${this._x1=+t},${this._y1=+n}`}quadraticCurveTo(t,n,e,r){this._append`Q${+t},${+n},${this._x1=+e},${this._y1=+r}`}bezierCurveTo(t,n,e,r,i,o){this._append`C${+t},${+n},${+e},${+r},${this._x1=+i},${this._y1=+o}`}arcTo(t,n,e,r,i){if(t=+t,n=+n,e=+e,r=+r,(i=+i)<0)throw new Error(`negative radius: ${i}`);let o=this._x1,a=this._y1,u=e-t,s=r-n,l=o-t,c=a-n,h=l*l+c*c;if(null===this._x1)this._append`M${this._x1=t},${this._y1=n}`;else if(h>Ae)if(Math.abs(c*u-s*l)>Ae&&i){let f=e-o,p=r-a,d=u*u+s*s,y=f*f+p*p,g=Math.sqrt(d),_=Math.sqrt(h),v=i*Math.tan((be-Math.acos((d+h-y)/(2*g*_)))/2),m=v/_,w=v/g;Math.abs(m-1)>Ae&&this._append`L${t+m*l},${n+m*c}`,this._append`A${i},${i},0,0,${+(c*f>l*p)},${this._x1=t+w*u},${this._y1=n+w*s}`}else this._append`L${this._x1=t},${this._y1=n}`;else;}arc(t,n,e,r,i,o){if(t=+t,n=+n,o=!!o,(e=+e)<0)throw new Error(`negative radius: ${e}`);let a=e*Math.cos(r),u=e*Math.sin(r),s=t+a,l=n+u,c=1^o,h=o?r-i:i-r;null===this._x1?this._append`M${s},${l}`:(Math.abs(this._x1-s)>Ae||Math.abs(this._y1-l)>Ae)&&this._append`L${s},${l}`,e&&(h<0&&(h=h%$e+$e),h>ke?this._append`A${e},${e},0,1,${c},${t-a},${n-u}A${e},${e},0,1,${c},${this._x1=s},${this._y1=l}`:h>Ae&&this._append`A${e},${e},0,${+(h>=be)},${c},${this._x1=t+e*Math.cos(i)},${this._y1=n+e*Math.sin(i)}`)}rect(t,n,e,r){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${e=+e}v${+r}h${-e}Z`}toString(){return this._}}function Ee(t){return function(){return t}}const Se=Math.abs,Ce=Math.atan2,Te=Math.cos,Re=Math.max,qe=Math.min,Pe=Math.sin,Xe=Math.sqrt,Oe=1e-12,je=Math.PI,De=je/2,Ie=2*je;function Le(t){return t>=1?De:t<=-1?-De:Math.asin(t)}function He(t){return t.innerRadius}function Ye(t){return t.outerRadius}function Be(t){return t.startAngle}function ze(t){return t.endAngle}function Ve(t){return t&&t.padAngle}function Ge(t,n,e,r,i,o,a){var u=t-e,s=n-r,l=(a?o:-o)/Xe(u*u+s*s),c=l*s,h=-l*u,f=t+c,p=n+h,d=e+c,y=r+h,g=(f+d)/2,_=(p+y)/2,v=d-f,m=y-p,w=v*v+m*m,x=i-o,b=f*y-d*p,$=(m<0?-1:1)*Xe(Re(0,x*x*w-b*b)),A=(b*m-v*$)/w,k=(-b*v-m*$)/w,M=(b*m+v*$)/w,N=(-b*v+m*$)/w,E=A-g,S=k-_,C=M-g,T=N-_;return E*E+S*S>C*C+T*T&&(A=M,k=N),{cx:A,cy:k,x01:-c,y01:-h,x11:A*(i/x-1),y11:k*(i/x-1)}}function Ue(){var t=He,n=Ye,e=Ee(0),r=null,i=Be,o=ze,a=Ve,u=null,s=function(t){let n=3;return t.digits=function(e){if(!arguments.length)return n;if(null==e)n=null;else{const t=Math.floor(e);if(!(t>=0))throw new RangeError(`invalid digits: ${e}`);n=t}return t},()=>new Ne(n)}(l);function l(){var l,c,h,f=+t.apply(this,arguments),p=+n.apply(this,arguments),d=i.apply(this,arguments)-De,y=o.apply(this,arguments)-De,g=Se(y-d),_=y>d;if(u||(u=l=s()),p<f&&(c=p,p=f,f=c),p>Oe)if(g>Ie-Oe)u.moveTo(p*Te(d),p*Pe(d)),u.arc(0,0,p,d,y,!_),f>Oe&&(u.moveTo(f*Te(y),f*Pe(y)),u.arc(0,0,f,y,d,_));else{var v,m,w=d,x=y,b=d,$=y,A=g,k=g,M=a.apply(this,arguments)/2,N=M>Oe&&(r?+r.apply(this,arguments):Xe(f*f+p*p)),E=qe(Se(p-f)/2,+e.apply(this,arguments)),S=E,C=E;if(N>Oe){var T=Le(N/f*Pe(M)),R=Le(N/p*Pe(M));(A-=2*T)>Oe?(b+=T*=_?1:-1,$-=T):(A=0,b=$=(d+y)/2),(k-=2*R)>Oe?(w+=R*=_?1:-1,x-=R):(k=0,w=x=(d+y)/2)}var q=p*Te(w),P=p*Pe(w),X=f*Te($),O=f*Pe($);if(E>Oe){var j,D=p*Te(x),I=p*Pe(x),L=f*Te(b),H=f*Pe(b);if(g<je)if(j=function(t,n,e,r,i,o,a,u){var s=e-t,l=r-n,c=a-i,h=u-o,f=h*s-c*l;if(!(f*f<Oe))return[t+(f=(c*(n-o)-h*(t-i))/f)*s,n+f*l]}(q,P,L,H,D,I,X,O)){var Y=q-j[0],B=P-j[1],z=D-j[0],V=I-j[1],G=1/Pe(((h=(Y*z+B*V)/(Xe(Y*Y+B*B)*Xe(z*z+V*V)))>1?0:h<-1?je:Math.acos(h))/2),U=Xe(j[0]*j[0]+j[1]*j[1]);S=qe(E,(f-U)/(G-1)),C=qe(E,(p-U)/(G+1))}else S=C=0}k>Oe?C>Oe?(v=Ge(L,H,q,P,p,C,_),m=Ge(D,I,X,O,p,C,_),u.moveTo(v.cx+v.x01,v.cy+v.y01),C<E?u.arc(v.cx,v.cy,C,Ce(v.y01,v.x01),Ce(m.y01,m.x01),!_):(u.arc(v.cx,v.cy,C,Ce(v.y01,v.x01),Ce(v.y11,v.x11),!_),u.arc(0,0,p,Ce(v.cy+v.y11,v.cx+v.x11),Ce(m.cy+m.y11,m.cx+m.x11),!_),u.arc(m.cx,m.cy,C,Ce(m.y11,m.x11),Ce(m.y01,m.x01),!_))):(u.moveTo(q,P),u.arc(0,0,p,w,x,!_)):u.moveTo(q,P),f>Oe&&A>Oe?S>Oe?(v=Ge(X,O,D,I,f,-S,_),m=Ge(q,P,L,H,f,-S,_),u.lineTo(v.cx+v.x01,v.cy+v.y01),S<E?u.arc(v.cx,v.cy,S,Ce(v.y01,v.x01),Ce(m.y01,m.x01),!_):(u.arc(v.cx,v.cy,S,Ce(v.y01,v.x01),Ce(v.y11,v.x11),!_),u.arc(0,0,f,Ce(v.cy+v.y11,v.cx+v.x11),Ce(m.cy+m.y11,m.cx+m.x11),_),u.arc(m.cx,m.cy,S,Ce(m.y11,m.x11),Ce(m.y01,m.x01),!_))):u.arc(0,0,f,$,b,_):u.lineTo(X,O)}else u.moveTo(0,0);if(u.closePath(),l)return u=null,l+""||null}return l.centroid=function(){var e=(+t.apply(this,arguments)+ +n.apply(this,arguments))/2,r=(+i.apply(this,arguments)+ +o.apply(this,arguments))/2-je/2;return[Te(r)*e,Pe(r)*e]},l.innerRadius=function(n){return arguments.length?(t="function"==typeof n?n:Ee(+n),l):t},l.outerRadius=function(t){return arguments.length?(n="function"==typeof t?t:Ee(+t),l):n},l.cornerRadius=function(t){return arguments.length?(e="function"==typeof t?t:Ee(+t),l):e},l.padRadius=function(t){return arguments.length?(r=null==t?null:"function"==typeof t?t:Ee(+t),l):r},l.startAngle=function(t){return arguments.length?(i="function"==typeof t?t:Ee(+t),l):i},l.endAngle=function(t){return arguments.length?(o="function"==typeof t?t:Ee(+t),l):o},l.padAngle=function(t){return arguments.length?(a="function"==typeof t?t:Ee(+t),l):a},l.context=function(t){return arguments.length?(u=null==t?null:t,l):u},l}function Fe(t,n,e){this.k=t,this.x=n,this.y=e}Fe.prototype={constructor:Fe,scale:function(t){return 1===t?this:new Fe(this.k*t,this.x,this.y)},translate:function(t,n){return 0===t&0===n?this:new Fe(this.k,this.x+this.k*t,this.y+this.k*n)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}},Fe.prototype;!function(t,n){void 0===n&&(n={});var e=n.insertAt;if(t&&"undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css","top"===e&&r.firstChild?r.insertBefore(i,r.firstChild):r.appendChild(i),i.styleSheet?i.styleSheet.cssText=t:i.appendChild(document.createTextNode(t))}}('@import url("https://fonts.googleapis.com/css?family=Rubik:300,300i,400,400i,500,500i,700,700i,900,900i&display=swap&subset=cyrillic");\nbody {\n background: #353353;\n padding: 0;\n height: 100vh;\n min-height: 100vh;\n font-family: "Rubik", sans-serif;\n display: flex;\n align-items: center;\n justify-content: center;\n flex-flow: column;\n}\n\n.dark .score-chart {\n background: #09132A;\n position: relative;\n padding: 30px;\n margin: 25px auto;\n}\n\n.light .score-chart {\n background: #fff;\n position: relative;\n padding: 30px;\n margin: 25px auto;\n}\n\n.score-chart p {\n text-align: center;\n font-size: 12px;\n z-index: 3;\n font-weight: 100;\n opacity: 0.8;\n margin: 0px;\n}\n\n.score-chart p.gaugue-score-bottom {\n padding-top: 0px;\n}\n\n.score-chart .score-chart-legend {\n background: transparent;\n vertical-align: middle;\n position: absolute;\n text-align: center;\n letter-spacing: 0.3em;\n}\n\n.score-chart #gaugue-score-middle {\n font-size: 45px;\n padding: 0;\n line-height: 1em;\n color: #26E79A;\n width: 100%;\n text-align: center;\n font-weight: 100;\n}\n\n.flex-center {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-flow: column;\n}\n\nsvg path {\n opacity: 1 !important;\n stroke-opacity: 1 !important;\n}\n\nsvg path:first-child {\n fill: rgb(249, 249, 249) !important;\n}\n\nsvg path:nth-child(2), .card.light svg path:nth-child(3) {\n fill: rgb(241, 241, 241) !important;\n}');class Ze extends t.Component{componentDidMount(){this.drawGauge(this.props.score)}componentDidUpdate(t){(function(t){return"string"==typeof t?new gt([document.querySelectorAll(t)],[document.documentElement]):new gt([d(t)],yt)})("svg > *").remove(),this.drawGauge(this.props.score)}drawGauge(t){const n=t=>{const n=2*Math.PI;let r=Ue().innerRadius(t.radius-10).outerRadius(t.radius).startAngle(0),i=Ue().innerRadius(t.radius+18).outerRadius(t.radius+20).startAngle(0),o=Ue().innerRadius(t.radius-1).outerRadius(t.radius+11).startAngle(0);vt(t.parent).attr("style","width:"+(2*t.radius+46)+"px; height:"+(2*t.radius+46)+"px");let a=vt(t.score.selector),u=vt(t.selector);const s=46+2*t.radius,l=46+2*t.radius;let c=u.append("g").attr("transform","translate("+s/2+","+l/2+")");u.attr("width",s).attr("height",l);let h=u.append("circle").style("fill",t.colour).attr("cx",0).attr("cy",0).attr("r",8);c.append("path").datum({endAngle:n}).style("fill",t.background).attr("d",r),c.append("path").datum({endAngle:n}).style("stroke-opacity",.1).style("opacity",.1).style("fill","#ffffff").attr("d",o),c.append("path").datum({endAngle:n}).style("stroke-opacity",.3).style("opacity",.3).style("fill","#ffffff").attr("d",i);var f;c.append("path").datum({endAngle:.1*n}).style("fill",t.colour).attr("d",r).transition().duration(3e3).attrTween("d",(f=t.percentage*n,n=>{let i=fn(n.endAngle,f);return o=>{n.endAngle=i(o);let u=r(n),s=t.score.value(e*o),l=Math.ceil(s/100*t.max_score);a.html(""+l);let c=t.radius+.97*Math.sin(n.endAngle)*t.radius,f=t.radius-.97*Math.cos(n.endAngle)*t.radius;return h.attr("cx",c+23).attr("cy",f+23),u}}))};let e=t/this.props.max_score;n({parent:"#crifCreditScoreGuage",selector:"#svg-chart-"+this.props.id,percentage:e,background:"#09132A",foreground:"#26E79A",colour:this.getColour(t),radius:100,label:"SCORE",max_score:this.props.max_score,min_score:this.props.min_score,score:{value:t=>100*t,selector:"#gaugue-score-middle"}})}getColour(t){const n=["0:#dd776e","1:#e0816d","2:#e2886c","3:#e5926b","4:#e79a69","5:#e9a268","6:#ecac67","7:#e6ad61","8:#e9b861","9:#f3c563","10:#f5ce62","11:#e2c965","12:#d4c86a","13:#c4c56d","14:#b0be6e","15:#a4c073","16:#94bd77","17:#84bb7b","18:#73b87e","19:#63b682","20:#57bb8a"];var e=n.length,r=this.props.min_score,i=this.props.max_score;let o=Math.floor(t/((i-r)/e));return o<e?n[o].split(":")[1]:n[20].split(":")[1]}render(){const n=void 0!==this.props.scale?{scale:this.props.scale}:{scale:1};return t.createElement("div",{style:n},t.createElement("div",{className:"score-chart flex-center",id:"crifCreditScoreGuage"},t.createElement("svg",{id:"svg-chart-"+this.props.id}),t.createElement("div",{className:"score-chart-legend"},t.createElement("div",{id:"gaugue-score-middle",style:{color:this.getColour(this.props.score)}},this.props.min_score),t.createElement("p",{className:"gaugue-score-top"},"out of ",this.props.max_score))))}}export{Ze as CreditScoreGuage}; //# sourceMappingURL=index.js.map