2 lines
45 KiB
JavaScript
2 lines
45 KiB
JavaScript
var ke={value:()=>{}};function Ut(){for(var t=0,e=arguments.length,n={},r;t<e;++t){if(!(r=arguments[t]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new J(n)}function J(t){this._=t}function Ne(t,e){return t.trim().split(/^|\s+/).map(function(n){var r="",i=n.indexOf(".");if(i>=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!e.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}J.prototype=Ut.prototype={constructor:J,on:function(t,e){var n=this._,r=Ne(t+"",n),i,a=-1,s=r.length;if(arguments.length<2){for(;++a<s;)if((i=(t=r[a]).type)&&(i=Ae(n[i],t.name)))return i;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++a<s;)if(i=(t=r[a]).type)n[i]=Et(n[i],t.name,e);else if(e==null)for(i in n)n[i]=Et(n[i],t.name,null);return this},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new J(t)},call:function(t,e){if((i=arguments.length-2)>0)for(var n=new Array(i),r=0,i,a;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(a=this._[t],r=0,i=a.length;r<i;++r)a[r].value.apply(e,n)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,a=r.length;i<a;++i)r[i].value.apply(e,n)}};function Ae(t,e){for(var n=0,r=t.length,i;n<r;++n)if((i=t[n]).name===e)return i.value}function Et(t,e,n){for(var r=0,i=t.length;r<i;++r)if(t[r].name===e){t[r]=ke,t=t.slice(0,r).concat(t.slice(r+1));break}return n!=null&&t.push({name:e,value:n}),t}var dt="http://www.w3.org/1999/xhtml";const Rt={svg:"http://www.w3.org/2000/svg",xhtml:dt,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 e=t+="",n=e.indexOf(":");return n>=0&&(e=t.slice(0,n))!=="xmlns"&&(t=t.slice(n+1)),Rt.hasOwnProperty(e)?{space:Rt[e],local:t}:t}function Se(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===dt&&e.documentElement.namespaceURI===dt?e.createElement(t):e.createElementNS(n,t)}}function Ce(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function Kt(t){var e=ot(t);return(e.local?Ce:Se)(e)}function $e(){}function xt(t){return t==null?$e:function(){return this.querySelector(t)}}function Me(t){typeof t!="function"&&(t=xt(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var a=e[i],s=a.length,o=r[i]=new Array(s),f,u,l=0;l<s;++l)(f=a[l])&&(u=t.call(f,f.__data__,l,a))&&("__data__"in f&&(u.__data__=f.__data__),o[l]=u);return new m(r,this._parents)}function Ee(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function Re(){return[]}function Wt(t){return t==null?Re:function(){return this.querySelectorAll(t)}}function Le(t){return function(){return Ee(t.apply(this,arguments))}}function Fe(t){typeof t=="function"?t=Le(t):t=Wt(t);for(var e=this._groups,n=e.length,r=[],i=[],a=0;a<n;++a)for(var s=e[a],o=s.length,f,u=0;u<o;++u)(f=s[u])&&(r.push(t.call(f,f.__data__,u,s)),i.push(f));return new m(r,i)}function Jt(t){return function(){return this.matches(t)}}function Qt(t){return function(e){return e.matches(t)}}var Te=Array.prototype.find;function He(t){return function(){return Te.call(this.children,t)}}function Ie(){return this.firstElementChild}function qe(t){return this.select(t==null?Ie:He(typeof t=="function"?t:Qt(t)))}var Pe=Array.prototype.filter;function Be(){return Array.from(this.children)}function Xe(t){return function(){return Pe.call(this.children,t)}}function De(t){return this.selectAll(t==null?Be:Xe(typeof t=="function"?t:Qt(t)))}function Oe(t){typeof t!="function"&&(t=Jt(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var a=e[i],s=a.length,o=r[i]=[],f,u=0;u<s;++u)(f=a[u])&&t.call(f,f.__data__,u,a)&&o.push(f);return new m(r,this._parents)}function Zt(t){return new Array(t.length)}function Ge(){return new m(this._enter||this._groups.map(Zt),this._parents)}function nt(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}nt.prototype={constructor:nt,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};function Ve(t){return function(){return t}}function Ye(t,e,n,r,i,a){for(var s=0,o,f=e.length,u=a.length;s<u;++s)(o=e[s])?(o.__data__=a[s],r[s]=o):n[s]=new nt(t,a[s]);for(;s<f;++s)(o=e[s])&&(i[s]=o)}function ze(t,e,n,r,i,a,s){var o,f,u=new Map,l=e.length,c=a.length,h=new Array(l),d;for(o=0;o<l;++o)(f=e[o])&&(h[o]=d=s.call(f,f.__data__,o,e)+"",u.has(d)?i[o]=f:u.set(d,f));for(o=0;o<c;++o)d=s.call(t,a[o],o,a)+"",(f=u.get(d))?(r[o]=f,f.__data__=a[o],u.delete(d)):n[o]=new nt(t,a[o]);for(o=0;o<l;++o)(f=e[o])&&u.get(h[o])===f&&(i[o]=f)}function Ue(t){return t.__data__}function Ke(t,e){if(!arguments.length)return Array.from(this,Ue);var n=e?ze:Ye,r=this._parents,i=this._groups;typeof t!="function"&&(t=Ve(t));for(var a=i.length,s=new Array(a),o=new Array(a),f=new Array(a),u=0;u<a;++u){var l=r[u],c=i[u],h=c.length,d=We(t.call(l,l&&l.__data__,u,r)),p=d.length,_=o[u]=new Array(p),$=s[u]=new Array(p),be=f[u]=new Array(h);n(l,c,_,$,be,d,e);for(var T=0,Y=0,$t,Mt;T<p;++T)if($t=_[T]){for(T>=Y&&(Y=T+1);!(Mt=$[Y])&&++Y<p;);$t._next=Mt||null}}return s=new m(s,r),s._enter=o,s._exit=f,s}function We(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function Je(){return new m(this._exit||this._groups.map(Zt),this._parents)}function Qe(t,e,n){var r=this.enter(),i=this,a=this.exit();return typeof t=="function"?(r=t(r),r&&(r=r.selection())):r=r.append(t+""),e!=null&&(i=e(i),i&&(i=i.selection())),n==null?a.remove():n(a),r&&i?r.merge(i).order():i}function Ze(t){for(var e=t.selection?t.selection():t,n=this._groups,r=e._groups,i=n.length,a=r.length,s=Math.min(i,a),o=new Array(i),f=0;f<s;++f)for(var u=n[f],l=r[f],c=u.length,h=o[f]=new Array(c),d,p=0;p<c;++p)(d=u[p]||l[p])&&(h[p]=d);for(;f<i;++f)o[f]=n[f];return new m(o,this._parents)}function je(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var r=t[e],i=r.length-1,a=r[i],s;--i>=0;)(s=r[i])&&(a&&s.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(s,a),a=s);return this}function tn(t){t||(t=en);function e(c,h){return c&&h?t(c.__data__,h.__data__):!c-!h}for(var n=this._groups,r=n.length,i=new Array(r),a=0;a<r;++a){for(var s=n[a],o=s.length,f=i[a]=new Array(o),u,l=0;l<o;++l)(u=s[l])&&(f[l]=u);f.sort(e)}return new m(i,this._parents).order()}function en(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function nn(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function rn(){return Array.from(this)}function an(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],i=0,a=r.length;i<a;++i){var s=r[i];if(s)return s}return null}function sn(){let t=0;for(const e of this)++t;return t}function on(){return!this.node()}function fn(t){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var i=e[n],a=0,s=i.length,o;a<s;++a)(o=i[a])&&t.call(o,o.__data__,a,i);return this}function un(t){return function(){this.removeAttribute(t)}}function ln(t){return function(){this.removeAttributeNS(t.space,t.local)}}function cn(t,e){return function(){this.setAttribute(t,e)}}function hn(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function dn(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttribute(t):this.setAttribute(t,n)}}function gn(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function pn(t,e){var n=ot(t);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((e==null?n.local?ln:un:typeof e=="function"?n.local?gn:dn:n.local?hn:cn)(n,e))}function jt(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function yn(t){return function(){this.style.removeProperty(t)}}function _n(t,e,n){return function(){this.style.setProperty(t,e,n)}}function wn(t,e,n){return function(){var r=e.apply(this,arguments);r==null?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function mn(t,e,n){return arguments.length>1?this.each((e==null?yn:typeof e=="function"?wn:_n)(t,e,n??"")):L(this.node(),t)}function L(t,e){return t.style.getPropertyValue(e)||jt(t).getComputedStyle(t,null).getPropertyValue(e)}function xn(t){return function(){delete this[t]}}function vn(t,e){return function(){this[t]=e}}function bn(t,e){return function(){var n=e.apply(this,arguments);n==null?delete this[t]:this[t]=n}}function kn(t,e){return arguments.length>1?this.each((e==null?xn:typeof e=="function"?bn:vn)(t,e)):this.node()[t]}function te(t){return t.trim().split(/^|\s+/)}function vt(t){return t.classList||new ee(t)}function ee(t){this._node=t,this._names=te(t.getAttribute("class")||"")}ee.prototype={add:function(t){var e=this._names.indexOf(t);e<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function ne(t,e){for(var n=vt(t),r=-1,i=e.length;++r<i;)n.add(e[r])}function re(t,e){for(var n=vt(t),r=-1,i=e.length;++r<i;)n.remove(e[r])}function Nn(t){return function(){ne(this,t)}}function An(t){return function(){re(this,t)}}function Sn(t,e){return function(){(e.apply(this,arguments)?ne:re)(this,t)}}function Cn(t,e){var n=te(t+"");if(arguments.length<2){for(var r=vt(this.node()),i=-1,a=n.length;++i<a;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof e=="function"?Sn:e?Nn:An)(n,e))}function $n(){this.textContent=""}function Mn(t){return function(){this.textContent=t}}function En(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function Rn(t){return arguments.length?this.each(t==null?$n:(typeof t=="function"?En:Mn)(t)):this.node().textContent}function Ln(){this.innerHTML=""}function Fn(t){return function(){this.innerHTML=t}}function Tn(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function Hn(t){return arguments.length?this.each(t==null?Ln:(typeof t=="function"?Tn:Fn)(t)):this.node().innerHTML}function In(){this.nextSibling&&this.parentNode.appendChild(this)}function qn(){return this.each(In)}function Pn(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Bn(){return this.each(Pn)}function Xn(t){var e=typeof t=="function"?t:Kt(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function Dn(){return null}function On(t,e){var n=typeof t=="function"?t:Kt(t),r=e==null?Dn:typeof e=="function"?e:xt(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function Gn(){var t=this.parentNode;t&&t.removeChild(this)}function Vn(){return this.each(Gn)}function Yn(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function zn(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Un(t){return this.select(t?zn:Yn)}function Kn(t){return arguments.length?this.property("__data__",t):this.node().__data__}function Wn(t){return function(e){t.call(this,e,this.__data__)}}function Jn(t){return t.trim().split(/^|\s+/).map(function(e){var n="",r=e.indexOf(".");return r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),{type:e,name:n}})}function Qn(t){return function(){var e=this.__on;if(e){for(var n=0,r=-1,i=e.length,a;n<i;++n)a=e[n],(!t.type||a.type===t.type)&&a.name===t.name?this.removeEventListener(a.type,a.listener,a.options):e[++r]=a;++r?e.length=r:delete this.__on}}}function Zn(t,e,n){return function(){var r=this.__on,i,a=Wn(e);if(r){for(var s=0,o=r.length;s<o;++s)if((i=r[s]).type===t.type&&i.name===t.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=a,i.options=n),i.value=e;return}}this.addEventListener(t.type,a,n),i={type:t.type,name:t.name,value:e,listener:a,options:n},r?r.push(i):this.__on=[i]}}function jn(t,e,n){var r=Jn(t+""),i,a=r.length,s;if(arguments.length<2){var o=this.node().__on;if(o){for(var f=0,u=o.length,l;f<u;++f)for(i=0,l=o[f];i<a;++i)if((s=r[i]).type===l.type&&s.name===l.name)return l.value}return}for(o=e?Zn:Qn,i=0;i<a;++i)this.each(o(r[i],e,n));return this}function ie(t,e,n){var r=jt(t),i=r.CustomEvent;typeof i=="function"?i=new i(e,n):(i=r.document.createEvent("Event"),n?(i.initEvent(e,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(e,!1,!1)),t.dispatchEvent(i)}function tr(t,e){return function(){return ie(this,t,e)}}function er(t,e){return function(){return ie(this,t,e.apply(this,arguments))}}function nr(t,e){return this.each((typeof e=="function"?er:tr)(t,e))}function*rr(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],i=0,a=r.length,s;i<a;++i)(s=r[i])&&(yield s)}var ae=[null];function m(t,e){this._groups=t,this._parents=e}function G(){return new m([[document.documentElement]],ae)}function ir(){return this}m.prototype=G.prototype={constructor:m,select:Me,selectAll:Fe,selectChild:qe,selectChildren:De,filter:Oe,data:Ke,enter:Ge,exit:Je,join:Qe,merge:Ze,selection:ir,order:je,sort:tn,call:nn,nodes:rn,node:an,size:sn,empty:on,each:fn,attr:pn,style:mn,property:kn,classed:Cn,text:Rn,html:Hn,raise:qn,lower:Bn,append:Xn,insert:On,remove:Vn,clone:Un,datum:Kn,on:jn,dispatch:nr,[Symbol.iterator]:rr};function Qi(t){return typeof t=="string"?new m([[document.querySelector(t)]],[document.documentElement]):new m([[t]],ae)}function bt(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function se(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function V(){}var B=.7,rt=1/B,R="\\s*([+-]?\\d+)\\s*",X="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",b="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",ar=/^#([0-9a-f]{3,8})$/,sr=new RegExp("^rgb\\("+[R,R,R]+"\\)$"),or=new RegExp("^rgb\\("+[b,b,b]+"\\)$"),fr=new RegExp("^rgba\\("+[R,R,R,X]+"\\)$"),ur=new RegExp("^rgba\\("+[b,b,b,X]+"\\)$"),lr=new RegExp("^hsl\\("+[X,b,b]+"\\)$"),cr=new RegExp("^hsla\\("+[X,b,b,X]+"\\)$"),Lt={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};bt(V,D,{copy:function(t){return Object.assign(new this.constructor,this,t)},displayable:function(){return this.rgb().displayable()},hex:Ft,formatHex:Ft,formatHsl:hr,formatRgb:Tt,toString:Tt});function Ft(){return this.rgb().formatHex()}function hr(){return oe(this).formatHsl()}function Tt(){return this.rgb().formatRgb()}function D(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=ar.exec(t))?(n=e[1].length,e=parseInt(e[1],16),n===6?Ht(e):n===3?new w(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?z(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?z(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=sr.exec(t))?new w(e[1],e[2],e[3],1):(e=or.exec(t))?new w(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=fr.exec(t))?z(e[1],e[2],e[3],e[4]):(e=ur.exec(t))?z(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=lr.exec(t))?Pt(e[1],e[2]/100,e[3]/100,1):(e=cr.exec(t))?Pt(e[1],e[2]/100,e[3]/100,e[4]):Lt.hasOwnProperty(t)?Ht(Lt[t]):t==="transparent"?new w(NaN,NaN,NaN,0):null}function Ht(t){return new w(t>>16&255,t>>8&255,t&255,1)}function z(t,e,n,r){return r<=0&&(t=e=n=NaN),new w(t,e,n,r)}function dr(t){return t instanceof V||(t=D(t)),t?(t=t.rgb(),new w(t.r,t.g,t.b,t.opacity)):new w}function gt(t,e,n,r){return arguments.length===1?dr(t):new w(t,e,n,r??1)}function w(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}bt(w,gt,se(V,{brighter:function(t){return t=t==null?rt:Math.pow(rt,t),new w(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=t==null?B:Math.pow(B,t),new w(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){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:It,formatHex:It,formatRgb:qt,toString:qt}));function It(){return"#"+lt(this.r)+lt(this.g)+lt(this.b)}function qt(){var t=this.opacity;return t=isNaN(t)?1:Math.max(0,Math.min(1,t)),(t===1?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(t===1?")":", "+t+")")}function lt(t){return t=Math.max(0,Math.min(255,Math.round(t)||0)),(t<16?"0":"")+t.toString(16)}function Pt(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new v(t,e,n,r)}function oe(t){if(t instanceof v)return new v(t.h,t.s,t.l,t.opacity);if(t instanceof V||(t=D(t)),!t)return new v;if(t instanceof v)return t;t=t.rgb();var e=t.r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),a=Math.max(e,n,r),s=NaN,o=a-i,f=(a+i)/2;return o?(e===a?s=(n-r)/o+(n<r)*6:n===a?s=(r-e)/o+2:s=(e-n)/o+4,o/=f<.5?a+i:2-a-i,s*=60):o=f>0&&f<1?0:s,new v(s,o,f,t.opacity)}function gr(t,e,n,r){return arguments.length===1?oe(t):new v(t,e,n,r??1)}function v(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}bt(v,gr,se(V,{brighter:function(t){return t=t==null?rt:Math.pow(rt,t),new v(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=t==null?B:Math.pow(B,t),new v(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new w(ct(t>=240?t-240:t+120,i,r),ct(t,i,r),ct(t<120?t+240:t-120,i,r),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var t=this.opacity;return t=isNaN(t)?1:Math.max(0,Math.min(1,t)),(t===1?"hsl(":"hsla(")+(this.h||0)+", "+(this.s||0)*100+"%, "+(this.l||0)*100+"%"+(t===1?")":", "+t+")")}}));function ct(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}const kt=t=>()=>t;function fe(t,e){return function(n){return t+n*e}}function pr(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}function Zi(t,e){var n=e-t;return n?fe(t,n>180||n<-180?n-360*Math.round(n/360):n):kt(isNaN(t)?e:t)}function yr(t){return(t=+t)==1?ue:function(e,n){return n-e?pr(e,n,t):kt(isNaN(e)?n:e)}}function ue(t,e){var n=e-t;return n?fe(t,n):kt(isNaN(t)?e:t)}const Bt=function t(e){var n=yr(e);function r(i,a){var s=n((i=gt(i)).r,(a=gt(a)).r),o=n(i.g,a.g),f=n(i.b,a.b),u=ue(i.opacity,a.opacity);return function(l){return i.r=s(l),i.g=o(l),i.b=f(l),i.opacity=u(l),i+""}}return r.gamma=t,r}(1);function C(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}var pt=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ht=new RegExp(pt.source,"g");function _r(t){return function(){return t}}function wr(t){return function(e){return t(e)+""}}function mr(t,e){var n=pt.lastIndex=ht.lastIndex=0,r,i,a,s=-1,o=[],f=[];for(t=t+"",e=e+"";(r=pt.exec(t))&&(i=ht.exec(e));)(a=i.index)>n&&(a=e.slice(n,a),o[s]?o[s]+=a:o[++s]=a),(r=r[0])===(i=i[0])?o[s]?o[s]+=i:o[++s]=i:(o[++s]=null,f.push({i:s,x:C(r,i)})),n=ht.lastIndex;return n<e.length&&(a=e.slice(n),o[s]?o[s]+=a:o[++s]=a),o.length<2?f[0]?wr(f[0].x):_r(e):(e=f.length,function(u){for(var l=0,c;l<e;++l)o[(c=f[l]).i]=c.x(u);return o.join("")})}var Xt=180/Math.PI,yt={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function le(t,e,n,r,i,a){var s,o,f;return(s=Math.sqrt(t*t+e*e))&&(t/=s,e/=s),(f=t*n+e*r)&&(n-=t*f,r-=e*f),(o=Math.sqrt(n*n+r*r))&&(n/=o,r/=o,f/=o),t*r<e*n&&(t=-t,e=-e,f=-f,s=-s),{translateX:i,translateY:a,rotate:Math.atan2(e,t)*Xt,skewX:Math.atan(f)*Xt,scaleX:s,scaleY:o}}var U;function xr(t){const e=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?yt:le(e.a,e.b,e.c,e.d,e.e,e.f)}function vr(t){return t==null||(U||(U=document.createElementNS("http://www.w3.org/2000/svg","g")),U.setAttribute("transform",t),!(t=U.transform.baseVal.consolidate()))?yt:(t=t.matrix,le(t.a,t.b,t.c,t.d,t.e,t.f))}function ce(t,e,n,r){function i(u){return u.length?u.pop()+" ":""}function a(u,l,c,h,d,p){if(u!==c||l!==h){var _=d.push("translate(",null,e,null,n);p.push({i:_-4,x:C(u,c)},{i:_-2,x:C(l,h)})}else(c||h)&&d.push("translate("+c+e+h+n)}function s(u,l,c,h){u!==l?(u-l>180?l+=360:l-u>180&&(u+=360),h.push({i:c.push(i(c)+"rotate(",null,r)-2,x:C(u,l)})):l&&c.push(i(c)+"rotate("+l+r)}function o(u,l,c,h){u!==l?h.push({i:c.push(i(c)+"skewX(",null,r)-2,x:C(u,l)}):l&&c.push(i(c)+"skewX("+l+r)}function f(u,l,c,h,d,p){if(u!==c||l!==h){var _=d.push(i(d)+"scale(",null,",",null,")");p.push({i:_-4,x:C(u,c)},{i:_-2,x:C(l,h)})}else(c!==1||h!==1)&&d.push(i(d)+"scale("+c+","+h+")")}return function(u,l){var c=[],h=[];return u=t(u),l=t(l),a(u.translateX,u.translateY,l.translateX,l.translateY,c,h),s(u.rotate,l.rotate,c,h),o(u.skewX,l.skewX,c,h),f(u.scaleX,u.scaleY,l.scaleX,l.scaleY,c,h),u=l=null,function(d){for(var p=-1,_=h.length,$;++p<_;)c[($=h[p]).i]=$.x(d);return c.join("")}}}var br=ce(xr,"px, ","px)","deg)"),kr=ce(vr,", ",")",")"),F=0,I=0,H=0,he=1e3,it,q,at=0,M=0,ft=0,O=typeof performance=="object"&&performance.now?performance:Date,de=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Nt(){return M||(de(Nr),M=O.now()+ft)}function Nr(){M=0}function st(){this._call=this._time=this._next=null}st.prototype=ge.prototype={constructor:st,restart:function(t,e,n){if(typeof t!="function")throw new TypeError("callback is not a function");n=(n==null?Nt():+n)+(e==null?0:+e),!this._next&&q!==this&&(q?q._next=this:it=this,q=this),this._call=t,this._time=n,_t()},stop:function(){this._call&&(this._call=null,this._time=1/0,_t())}};function ge(t,e,n){var r=new st;return r.restart(t,e,n),r}function Ar(){Nt(),++F;for(var t=it,e;t;)(e=M-t._time)>=0&&t._call.call(void 0,e),t=t._next;--F}function Dt(){M=(at=O.now())+ft,F=I=0;try{Ar()}finally{F=0,Cr(),M=0}}function Sr(){var t=O.now(),e=t-at;e>he&&(ft-=e,at=t)}function Cr(){for(var t,e=it,n,r=1/0;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:it=n);q=t,_t(r)}function _t(t){if(!F){I&&(I=clearTimeout(I));var e=t-M;e>24?(t<1/0&&(I=setTimeout(Dt,t-O.now()-ft)),H&&(H=clearInterval(H))):(H||(at=O.now(),H=setInterval(Sr,he)),F=1,de(Dt))}}function Ot(t,e,n){var r=new st;return e=e==null?0:+e,r.restart(i=>{r.stop(),t(i+e)},e,n),r}var $r=Ut("start","end","cancel","interrupt"),Mr=[],pe=0,Gt=1,wt=2,Q=3,Vt=4,mt=5,Z=6;function ut(t,e,n,r,i,a){var s=t.__transition;if(!s)t.__transition={};else if(n in s)return;Er(t,n,{name:e,index:r,group:i,on:$r,tween:Mr,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:pe})}function At(t,e){var n=x(t,e);if(n.state>pe)throw new Error("too late; already scheduled");return n}function k(t,e){var n=x(t,e);if(n.state>Q)throw new Error("too late; already running");return n}function x(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function Er(t,e,n){var r=t.__transition,i;r[e]=n,n.timer=ge(a,0,n.time);function a(u){n.state=Gt,n.timer.restart(s,n.delay,n.time),n.delay<=u&&s(u-n.delay)}function s(u){var l,c,h,d;if(n.state!==Gt)return f();for(l in r)if(d=r[l],d.name===n.name){if(d.state===Q)return Ot(s);d.state===Vt?(d.state=Z,d.timer.stop(),d.on.call("interrupt",t,t.__data__,d.index,d.group),delete r[l]):+l<e&&(d.state=Z,d.timer.stop(),d.on.call("cancel",t,t.__data__,d.index,d.group),delete r[l])}if(Ot(function(){n.state===Q&&(n.state=Vt,n.timer.restart(o,n.delay,n.time),o(u))}),n.state=wt,n.on.call("start",t,t.__data__,n.index,n.group),n.state===wt){for(n.state=Q,i=new Array(h=n.tween.length),l=0,c=-1;l<h;++l)(d=n.tween[l].value.call(t,t.__data__,n.index,n.group))&&(i[++c]=d);i.length=c+1}}function o(u){for(var l=u<n.duration?n.ease.call(null,u/n.duration):(n.timer.restart(f),n.state=mt,1),c=-1,h=i.length;++c<h;)i[c].call(t,l);n.state===mt&&(n.on.call("end",t,t.__data__,n.index,n.group),f())}function f(){n.state=Z,n.timer.stop(),delete r[e];for(var u in r)return;delete t.__transition}}function Rr(t,e){var n=t.__transition,r,i,a=!0,s;if(n){e=e==null?null:e+"";for(s in n){if((r=n[s]).name!==e){a=!1;continue}i=r.state>wt&&r.state<mt,r.state=Z,r.timer.stop(),r.on.call(i?"interrupt":"cancel",t,t.__data__,r.index,r.group),delete n[s]}a&&delete t.__transition}}function Lr(t){return this.each(function(){Rr(this,t)})}function Fr(t,e){var n,r;return function(){var i=k(this,t),a=i.tween;if(a!==n){r=n=a;for(var s=0,o=r.length;s<o;++s)if(r[s].name===e){r=r.slice(),r.splice(s,1);break}}i.tween=r}}function Tr(t,e,n){var r,i;if(typeof n!="function")throw new Error;return function(){var a=k(this,t),s=a.tween;if(s!==r){i=(r=s).slice();for(var o={name:e,value:n},f=0,u=i.length;f<u;++f)if(i[f].name===e){i[f]=o;break}f===u&&i.push(o)}a.tween=i}}function Hr(t,e){var n=this._id;if(t+="",arguments.length<2){for(var r=x(this.node(),n).tween,i=0,a=r.length,s;i<a;++i)if((s=r[i]).name===t)return s.value;return null}return this.each((e==null?Fr:Tr)(n,t,e))}function St(t,e,n){var r=t._id;return t.each(function(){var i=k(this,r);(i.value||(i.value={}))[e]=n.apply(this,arguments)}),function(i){return x(i,r).value[e]}}function ye(t,e){var n;return(typeof e=="number"?C:e instanceof D?Bt:(n=D(e))?(e=n,Bt):mr)(t,e)}function Ir(t){return function(){this.removeAttribute(t)}}function qr(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Pr(t,e,n){var r,i=n+"",a;return function(){var s=this.getAttribute(t);return s===i?null:s===r?a:a=e(r=s,n)}}function Br(t,e,n){var r,i=n+"",a;return function(){var s=this.getAttributeNS(t.space,t.local);return s===i?null:s===r?a:a=e(r=s,n)}}function Xr(t,e,n){var r,i,a;return function(){var s,o=n(this),f;return o==null?void this.removeAttribute(t):(s=this.getAttribute(t),f=o+"",s===f?null:s===r&&f===i?a:(i=f,a=e(r=s,o)))}}function Dr(t,e,n){var r,i,a;return function(){var s,o=n(this),f;return o==null?void this.removeAttributeNS(t.space,t.local):(s=this.getAttributeNS(t.space,t.local),f=o+"",s===f?null:s===r&&f===i?a:(i=f,a=e(r=s,o)))}}function Or(t,e){var n=ot(t),r=n==="transform"?kr:ye;return this.attrTween(t,typeof e=="function"?(n.local?Dr:Xr)(n,r,St(this,"attr."+t,e)):e==null?(n.local?qr:Ir)(n):(n.local?Br:Pr)(n,r,e))}function Gr(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}function Vr(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}function Yr(t,e){var n,r;function i(){var a=e.apply(this,arguments);return a!==r&&(n=(r=a)&&Vr(t,a)),n}return i._value=e,i}function zr(t,e){var n,r;function i(){var a=e.apply(this,arguments);return a!==r&&(n=(r=a)&&Gr(t,a)),n}return i._value=e,i}function Ur(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;var r=ot(t);return this.tween(n,(r.local?Yr:zr)(r,e))}function Kr(t,e){return function(){At(this,t).delay=+e.apply(this,arguments)}}function Wr(t,e){return e=+e,function(){At(this,t).delay=e}}function Jr(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?Kr:Wr)(e,t)):x(this.node(),e).delay}function Qr(t,e){return function(){k(this,t).duration=+e.apply(this,arguments)}}function Zr(t,e){return e=+e,function(){k(this,t).duration=e}}function jr(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?Qr:Zr)(e,t)):x(this.node(),e).duration}function ti(t,e){if(typeof e!="function")throw new Error;return function(){k(this,t).ease=e}}function ei(t){var e=this._id;return arguments.length?this.each(ti(e,t)):x(this.node(),e).ease}function ni(t,e){return function(){var n=e.apply(this,arguments);if(typeof n!="function")throw new Error;k(this,t).ease=n}}function ri(t){if(typeof t!="function")throw new Error;return this.each(ni(this._id,t))}function ii(t){typeof t!="function"&&(t=Jt(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var a=e[i],s=a.length,o=r[i]=[],f,u=0;u<s;++u)(f=a[u])&&t.call(f,f.__data__,u,a)&&o.push(f);return new A(r,this._parents,this._name,this._id)}function ai(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,r=e.length,i=n.length,a=Math.min(r,i),s=new Array(r),o=0;o<a;++o)for(var f=e[o],u=n[o],l=f.length,c=s[o]=new Array(l),h,d=0;d<l;++d)(h=f[d]||u[d])&&(c[d]=h);for(;o<r;++o)s[o]=e[o];return new A(s,this._parents,this._name,this._id)}function si(t){return(t+"").trim().split(/^|\s+/).every(function(e){var n=e.indexOf(".");return n>=0&&(e=e.slice(0,n)),!e||e==="start"})}function oi(t,e,n){var r,i,a=si(e)?At:k;return function(){var s=a(this,t),o=s.on;o!==r&&(i=(r=o).copy()).on(e,n),s.on=i}}function fi(t,e){var n=this._id;return arguments.length<2?x(this.node(),n).on.on(t):this.each(oi(n,t,e))}function ui(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}function li(){return this.on("end.remove",ui(this._id))}function ci(t){var e=this._name,n=this._id;typeof t!="function"&&(t=xt(t));for(var r=this._groups,i=r.length,a=new Array(i),s=0;s<i;++s)for(var o=r[s],f=o.length,u=a[s]=new Array(f),l,c,h=0;h<f;++h)(l=o[h])&&(c=t.call(l,l.__data__,h,o))&&("__data__"in l&&(c.__data__=l.__data__),u[h]=c,ut(u[h],e,n,h,u,x(l,n)));return new A(a,this._parents,e,n)}function hi(t){var e=this._name,n=this._id;typeof t!="function"&&(t=Wt(t));for(var r=this._groups,i=r.length,a=[],s=[],o=0;o<i;++o)for(var f=r[o],u=f.length,l,c=0;c<u;++c)if(l=f[c]){for(var h=t.call(l,l.__data__,c,f),d,p=x(l,n),_=0,$=h.length;_<$;++_)(d=h[_])&&ut(d,e,n,_,h,p);a.push(h),s.push(l)}return new A(a,s,e,n)}var di=G.prototype.constructor;function gi(){return new di(this._groups,this._parents)}function pi(t,e){var n,r,i;return function(){var a=L(this,t),s=(this.style.removeProperty(t),L(this,t));return a===s?null:a===n&&s===r?i:i=e(n=a,r=s)}}function _e(t){return function(){this.style.removeProperty(t)}}function yi(t,e,n){var r,i=n+"",a;return function(){var s=L(this,t);return s===i?null:s===r?a:a=e(r=s,n)}}function _i(t,e,n){var r,i,a;return function(){var s=L(this,t),o=n(this),f=o+"";return o==null&&(f=o=(this.style.removeProperty(t),L(this,t))),s===f?null:s===r&&f===i?a:(i=f,a=e(r=s,o))}}function wi(t,e){var n,r,i,a="style."+e,s="end."+a,o;return function(){var f=k(this,t),u=f.on,l=f.value[a]==null?o||(o=_e(e)):void 0;(u!==n||i!==l)&&(r=(n=u).copy()).on(s,i=l),f.on=r}}function mi(t,e,n){var r=(t+="")=="transform"?br:ye;return e==null?this.styleTween(t,pi(t,r)).on("end.style."+t,_e(t)):typeof e=="function"?this.styleTween(t,_i(t,r,St(this,"style."+t,e))).each(wi(this._id,t)):this.styleTween(t,yi(t,r,e),n).on("end.style."+t,null)}function xi(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}function vi(t,e,n){var r,i;function a(){var s=e.apply(this,arguments);return s!==i&&(r=(i=s)&&xi(t,s,n)),r}return a._value=e,a}function bi(t,e,n){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(e==null)return this.tween(r,null);if(typeof e!="function")throw new Error;return this.tween(r,vi(t,e,n??""))}function ki(t){return function(){this.textContent=t}}function Ni(t){return function(){var e=t(this);this.textContent=e??""}}function Ai(t){return this.tween("text",typeof t=="function"?Ni(St(this,"text",t)):ki(t==null?"":t+""))}function Si(t){return function(e){this.textContent=t.call(this,e)}}function Ci(t){var e,n;function r(){var i=t.apply(this,arguments);return i!==n&&(e=(n=i)&&Si(i)),e}return r._value=t,r}function $i(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(t==null)return this.tween(e,null);if(typeof t!="function")throw new Error;return this.tween(e,Ci(t))}function Mi(){for(var t=this._name,e=this._id,n=we(),r=this._groups,i=r.length,a=0;a<i;++a)for(var s=r[a],o=s.length,f,u=0;u<o;++u)if(f=s[u]){var l=x(f,e);ut(f,t,n,u,s,{time:l.time+l.delay+l.duration,delay:0,duration:l.duration,ease:l.ease})}return new A(r,this._parents,t,n)}function Ei(){var t,e,n=this,r=n._id,i=n.size();return new Promise(function(a,s){var o={value:s},f={value:function(){--i===0&&a()}};n.each(function(){var u=k(this,r),l=u.on;l!==t&&(e=(t=l).copy(),e._.cancel.push(o),e._.interrupt.push(o),e._.end.push(f)),u.on=e}),i===0&&a()})}var Ri=0;function A(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function we(){return++Ri}var N=G.prototype;A.prototype={constructor:A,select:ci,selectAll:hi,selectChild:N.selectChild,selectChildren:N.selectChildren,filter:ii,merge:ai,selection:gi,transition:Mi,call:N.call,nodes:N.nodes,node:N.node,size:N.size,empty:N.empty,each:N.each,on:fi,attr:Or,attrTween:Ur,style:mi,styleTween:bi,text:Ai,textTween:$i,remove:li,tween:Hr,delay:Jr,duration:jr,ease:ei,easeVarying:ri,end:Ei,[Symbol.iterator]:N[Symbol.iterator]};function Li(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var Fi={time:null,delay:0,duration:250,ease:Li};function Ti(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}function Hi(t){var e,n;t instanceof A?(e=t._id,t=t._name):(e=we(),(n=Fi).time=Nt(),t=t==null?null:t+"");for(var r=this._groups,i=r.length,a=0;a<i;++a)for(var s=r[a],o=s.length,f,u=0;u<o;++u)(f=s[u])&&ut(f,t,e,u,s,n||Ti(f,e));return new A(r,this._parents,t,e)}G.prototype.interrupt=Lr;G.prototype.transition=Hi;function E(t,e,n){this.k=t,this.x=e,this.y=n}E.prototype={constructor:E,scale:function(t){return t===1?this:new E(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new E(this.k,this.x+this.k*t,this.y+this.k*e)},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+")"}};new E(1,0,0);E.prototype;const j={min:{r:0,g:0,b:0,s:0,l:0,a:0},max:{r:255,g:255,b:255,h:360,s:100,l:100,a:1},clamp:{r:t=>t>=255?255:t<0?0:t,g:t=>t>=255?255:t<0?0:t,b:t=>t>=255?255:t<0?0:t,h:t=>t%360,s:t=>t>=100?100:t<0?0:t,l:t=>t>=100?100:t<0?0:t,a:t=>t>=1?1:t<0?0:t},toLinear:t=>{const e=t/255;return t>.03928?Math.pow((e+.055)/1.055,2.4):e/12.92},hue2rgb:(t,e,n)=>(n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*(2/3-n)*6:t),hsl2rgb:({h:t,s:e,l:n},r)=>{if(!e)return n*2.55;t/=360,e/=100,n/=100;const i=n<.5?n*(1+e):n+e-n*e,a=2*n-i;switch(r){case"r":return j.hue2rgb(a,i,t+1/3)*255;case"g":return j.hue2rgb(a,i,t)*255;case"b":return j.hue2rgb(a,i,t-1/3)*255}},rgb2hsl:({r:t,g:e,b:n},r)=>{t/=255,e/=255,n/=255;const i=Math.max(t,e,n),a=Math.min(t,e,n),s=(i+a)/2;if(r==="l")return s*100;if(i===a)return 0;const o=i-a,f=s>.5?o/(2-i-a):o/(i+a);if(r==="s")return f*100;switch(i){case t:return((e-n)/o+(e<n?6:0))*60;case e:return((n-t)/o+2)*60;case n:return((t-e)/o+4)*60;default:return-1}}},Ii=j,qi={clamp:(t,e,n)=>e>n?Math.min(e,Math.max(n,t)):Math.min(n,Math.max(e,t)),round:t=>Math.round(t*1e10)/1e10},Pi=qi,Bi={dec2hex:t=>{const e=Math.round(t).toString(16);return e.length>1?e:`0${e}`}},Xi=Bi,Di={channel:Ii,lang:Pi,unit:Xi},g=Di,S={};for(let t=0;t<=255;t++)S[t]=g.unit.dec2hex(t);const y={ALL:0,RGB:1,HSL:2};class Oi{constructor(){this.type=y.ALL}get(){return this.type}set(e){if(this.type&&this.type!==e)throw new Error("Cannot change both RGB and HSL channels at the same time");this.type=e}reset(){this.type=y.ALL}is(e){return this.type===e}}const Gi=Oi;class Vi{constructor(e,n){this.color=n,this.changed=!1,this.data=e,this.type=new Gi}set(e,n){return this.color=n,this.changed=!1,this.data=e,this.type.type=y.ALL,this}_ensureHSL(){const e=this.data,{h:n,s:r,l:i}=e;n===void 0&&(e.h=g.channel.rgb2hsl(e,"h")),r===void 0&&(e.s=g.channel.rgb2hsl(e,"s")),i===void 0&&(e.l=g.channel.rgb2hsl(e,"l"))}_ensureRGB(){const e=this.data,{r:n,g:r,b:i}=e;n===void 0&&(e.r=g.channel.hsl2rgb(e,"r")),r===void 0&&(e.g=g.channel.hsl2rgb(e,"g")),i===void 0&&(e.b=g.channel.hsl2rgb(e,"b"))}get r(){const e=this.data,n=e.r;return!this.type.is(y.HSL)&&n!==void 0?n:(this._ensureHSL(),g.channel.hsl2rgb(e,"r"))}get g(){const e=this.data,n=e.g;return!this.type.is(y.HSL)&&n!==void 0?n:(this._ensureHSL(),g.channel.hsl2rgb(e,"g"))}get b(){const e=this.data,n=e.b;return!this.type.is(y.HSL)&&n!==void 0?n:(this._ensureHSL(),g.channel.hsl2rgb(e,"b"))}get h(){const e=this.data,n=e.h;return!this.type.is(y.RGB)&&n!==void 0?n:(this._ensureRGB(),g.channel.rgb2hsl(e,"h"))}get s(){const e=this.data,n=e.s;return!this.type.is(y.RGB)&&n!==void 0?n:(this._ensureRGB(),g.channel.rgb2hsl(e,"s"))}get l(){const e=this.data,n=e.l;return!this.type.is(y.RGB)&&n!==void 0?n:(this._ensureRGB(),g.channel.rgb2hsl(e,"l"))}get a(){return this.data.a}set r(e){this.type.set(y.RGB),this.changed=!0,this.data.r=e}set g(e){this.type.set(y.RGB),this.changed=!0,this.data.g=e}set b(e){this.type.set(y.RGB),this.changed=!0,this.data.b=e}set h(e){this.type.set(y.HSL),this.changed=!0,this.data.h=e}set s(e){this.type.set(y.HSL),this.changed=!0,this.data.s=e}set l(e){this.type.set(y.HSL),this.changed=!0,this.data.l=e}set a(e){this.changed=!0,this.data.a=e}}const Yi=Vi,zi=new Yi({r:0,g:0,b:0,a:0},"transparent"),Ct=zi,me={re:/^#((?:[a-f0-9]{2}){2,4}|[a-f0-9]{3})$/i,parse:t=>{if(t.charCodeAt(0)!==35)return;const e=t.match(me.re);if(!e)return;const n=e[1],r=parseInt(n,16),i=n.length,a=i%4===0,s=i>4,o=s?1:17,f=s?8:4,u=a?0:-1,l=s?255:15;return Ct.set({r:(r>>f*(u+3)&l)*o,g:(r>>f*(u+2)&l)*o,b:(r>>f*(u+1)&l)*o,a:a?(r&l)*o/255:1},t)},stringify:t=>{const{r:e,g:n,b:r,a:i}=t;return i<1?`#${S[Math.round(e)]}${S[Math.round(n)]}${S[Math.round(r)]}${S[Math.round(i*255)]}`:`#${S[Math.round(e)]}${S[Math.round(n)]}${S[Math.round(r)]}`}},P=me,tt={re:/^hsla?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(?:deg|grad|rad|turn)?)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(%)?))?\s*?\)$/i,hueRe:/^(.+?)(deg|grad|rad|turn)$/i,_hue2deg:t=>{const e=t.match(tt.hueRe);if(e){const[,n,r]=e;switch(r){case"grad":return g.channel.clamp.h(parseFloat(n)*.9);case"rad":return g.channel.clamp.h(parseFloat(n)*180/Math.PI);case"turn":return g.channel.clamp.h(parseFloat(n)*360)}}return g.channel.clamp.h(parseFloat(t))},parse:t=>{const e=t.charCodeAt(0);if(e!==104&&e!==72)return;const n=t.match(tt.re);if(!n)return;const[,r,i,a,s,o]=n;return Ct.set({h:tt._hue2deg(r),s:g.channel.clamp.s(parseFloat(i)),l:g.channel.clamp.l(parseFloat(a)),a:s?g.channel.clamp.a(o?parseFloat(s)/100:parseFloat(s)):1},t)},stringify:t=>{const{h:e,s:n,l:r,a:i}=t;return i<1?`hsla(${g.lang.round(e)}, ${g.lang.round(n)}%, ${g.lang.round(r)}%, ${i})`:`hsl(${g.lang.round(e)}, ${g.lang.round(n)}%, ${g.lang.round(r)}%)`}},K=tt,et={colors:{aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyanaqua:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",transparent:"#00000000",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},parse:t=>{t=t.toLowerCase();const e=et.colors[t];if(e)return P.parse(e)},stringify:t=>{const e=P.stringify(t);for(const n in et.colors)if(et.colors[n]===e)return n}},Yt=et,xe={re:/^rgba?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?)))?\s*?\)$/i,parse:t=>{const e=t.charCodeAt(0);if(e!==114&&e!==82)return;const n=t.match(xe.re);if(!n)return;const[,r,i,a,s,o,f,u,l]=n;return Ct.set({r:g.channel.clamp.r(i?parseFloat(r)*2.55:parseFloat(r)),g:g.channel.clamp.g(s?parseFloat(a)*2.55:parseFloat(a)),b:g.channel.clamp.b(f?parseFloat(o)*2.55:parseFloat(o)),a:u?g.channel.clamp.a(l?parseFloat(u)/100:parseFloat(u)):1},t)},stringify:t=>{const{r:e,g:n,b:r,a:i}=t;return i<1?`rgba(${g.lang.round(e)}, ${g.lang.round(n)}, ${g.lang.round(r)}, ${g.lang.round(i)})`:`rgb(${g.lang.round(e)}, ${g.lang.round(n)}, ${g.lang.round(r)})`}},W=xe,Ui={format:{keyword:Yt,hex:P,rgb:W,rgba:W,hsl:K,hsla:K},parse:t=>{if(typeof t!="string")return t;const e=P.parse(t)||W.parse(t)||K.parse(t)||Yt.parse(t);if(e)return e;throw new Error(`Unsupported color format: "${t}"`)},stringify:t=>!t.changed&&t.color?t.color:t.type.is(y.HSL)||t.data.r===void 0?K.stringify(t):t.a<1||!Number.isInteger(t.r)||!Number.isInteger(t.g)||!Number.isInteger(t.b)?W.stringify(t):P.stringify(t)},zt=Ui,Ki=(t,e,n)=>{const r=zt.parse(t),i=r[e],a=g.channel.clamp[e](i+n);return i!==a&&(r[e]=a),zt.stringify(r)},ve=Ki,Wi=(t,e)=>ve(t,"l",e),ji=Wi,Ji=(t,e)=>ve(t,"l",-e),ta=Ji;export{V as C,w as R,m as S,g as _,Ee as a,dr as b,kt as c,bt as d,se as e,D as f,Bt as g,mr as h,C as i,Zi as j,zt as k,Ct as l,ji as m,ue as n,ta as o,ae as r,Qi as s};
|