UNPKG

@patricksurry/g3

Version:

A flexible Javascript framework for building steam gauge instrument panels that display live external metrics from flight (or other) simulators like XPlane or MS FS2020

1 lines 126 kB
var g3=function(t){"use strict";!function(){const t={};try{if(process)return process.env=Object.assign({},process.env),void Object.assign(process.env,t)}catch(t){}globalThis.process={env:t}}();var e=function(){function t(t){var e=this;this._insertTag=function(t){var n;n=0===e.tags.length?e.insertionPoint?e.insertionPoint.nextSibling:e.prepend?e.container.firstChild:e.before:e.tags[e.tags.length-1].nextSibling,e.container.insertBefore(t,n),e.tags.push(t)},this.isSpeedy=void 0===t.speedy||t.speedy,this.tags=[],this.ctr=0,this.nonce=t.nonce,this.key=t.key,this.container=t.container,this.prepend=t.prepend,this.insertionPoint=t.insertionPoint,this.before=null}var e=t.prototype;return e.hydrate=function(t){t.forEach(this._insertTag)},e.insert=function(t){this.ctr%(this.isSpeedy?65e3:1)==0&&this._insertTag(function(t){var e=document.createElement("style");return e.setAttribute("data-emotion",t.key),void 0!==t.nonce&&e.setAttribute("nonce",t.nonce),e.appendChild(document.createTextNode("")),e.setAttribute("data-s",""),e}(this));var e=this.tags[this.tags.length-1];if(this.isSpeedy){var n=function(t){if(t.sheet)return t.sheet;for(var e=0;e<document.styleSheets.length;e++)if(document.styleSheets[e].ownerNode===t)return document.styleSheets[e]}(e);try{n.insertRule(t,n.cssRules.length)}catch(t){}}else e.appendChild(document.createTextNode(t));this.ctr++},e.flush=function(){this.tags.forEach(function(t){var e;return null==(e=t.parentNode)?void 0:e.removeChild(t)}),this.tags=[],this.ctr=0},t}(),n="-ms-",r="-moz-",a="-webkit-",i="comm",o="rule",l="decl",s="@keyframes",u=Math.abs,c=String.fromCharCode,h=Object.assign;function f(t){return t.trim()}function p(t,e,n){return t.replace(e,n)}function m(t,e){return t.indexOf(e)}function g(t,e){return 0|t.charCodeAt(e)}function d(t,e,n){return t.slice(e,n)}function y(t){return t.length}function v(t){return t.length}function _(t,e){return e.push(t),t}var b=1,w=1,x=0,M=0,k=0,C="";function A(t,e,n,r,a,i,o){return{value:t,root:e,parent:n,type:r,props:a,children:i,line:b,column:w,length:o,return:""}}function $(t,e){return h(A("",null,null,"",null,null,0),t,{length:-t.length},e)}function S(){return k=M>0?g(C,--M):0,w--,10===k&&(w=1,b--),k}function N(){return k=M<x?g(C,M++):0,w++,10===k&&(w=1,b++),k}function E(){return g(C,M)}function j(){return M}function z(t,e){return d(C,t,e)}function G(t){switch(t){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function D(t){return b=w=1,x=y(C=t),M=0,[]}function O(t){return C="",t}function P(t){return f(z(M-1,L(91===t?t+2:40===t?t+1:t)))}function T(t){for(;(k=E())&&k<33;)N();return G(t)>2||G(k)>3?"":" "}function R(t,e){for(;--e&&N()&&!(k<48||k>102||k>57&&k<65||k>70&&k<97););return z(t,j()+(e<6&&32==E()&&32==N()))}function L(t){for(;N();)switch(k){case t:return M;case 34:case 39:34!==t&&39!==t&&L(k);break;case 40:41===t&&L(t);break;case 92:N()}return M}function K(t,e){for(;N()&&t+k!==57&&(t+k!==84||47!==E()););return"/*"+z(e,M-1)+"*"+c(47===t?t:N())}function q(t){for(;!G(E());)N();return z(t,M)}function I(t){return O(B("",null,null,null,[""],t=D(t),0,[0],t))}function B(t,e,n,r,a,i,o,l,s){for(var u=0,h=0,f=o,d=0,v=0,b=0,w=1,x=1,M=1,k=0,C="",A=a,$=i,z=r,G=C;x;)switch(b=k,k=N()){case 40:if(108!=b&&58==g(G,f-1)){-1!=m(G+=p(P(k),"&","&\f"),"&\f")&&(M=-1);break}case 34:case 39:case 91:G+=P(k);break;case 9:case 10:case 13:case 32:G+=T(b);break;case 92:G+=R(j()-1,7);continue;case 47:switch(E()){case 42:case 47:_(F(K(N(),j()),e,n),s);break;default:G+="/"}break;case 123*w:l[u++]=y(G)*M;case 125*w:case 59:case 0:switch(k){case 0:case 125:x=0;case 59+h:-1==M&&(G=p(G,/\f/g,"")),v>0&&y(G)-f&&_(v>32?V(G+";",r,n,f-1):V(p(G," ","")+";",r,n,f-2),s);break;case 59:G+=";";default:if(_(z=H(G,e,n,u,h,a,l,C,A=[],$=[],f),i),123===k)if(0===h)B(G,e,z,z,A,i,f,l,$);else switch(99===d&&110===g(G,3)?100:d){case 100:case 108:case 109:case 115:B(t,z,z,r&&_(H(t,z,z,0,0,a,l,C,a,A=[],f),$),a,$,f,l,r?A:$);break;default:B(G,z,z,z,[""],$,0,l,$)}}u=h=v=0,w=M=1,C=G="",f=o;break;case 58:f=1+y(G),v=b;default:if(w<1)if(123==k)--w;else if(125==k&&0==w++&&125==S())continue;switch(G+=c(k),k*w){case 38:M=h>0?1:(G+="\f",-1);break;case 44:l[u++]=(y(G)-1)*M,M=1;break;case 64:45===E()&&(G+=P(N())),d=E(),h=f=y(C=G+=q(j())),k++;break;case 45:45===b&&2==y(G)&&(w=0)}}return i}function H(t,e,n,r,a,i,l,s,c,h,m){for(var g=a-1,y=0===a?i:[""],_=v(y),b=0,w=0,x=0;b<r;++b)for(var M=0,k=d(t,g+1,g=u(w=l[b])),C=t;M<_;++M)(C=f(w>0?y[M]+" "+k:p(k,/&\f/g,y[M])))&&(c[x++]=C);return A(t,e,n,0===a?o:s,c,h,m)}function F(t,e,n){return A(t,e,n,i,c(k),d(t,2,-2),0)}function V(t,e,n,r){return A(t,e,n,l,d(t,0,r),d(t,r+1,-1),r)}function W(t,e){for(var n="",r=v(t),a=0;a<r;a++)n+=e(t[a],a,t,e)||"";return n}function U(t,e,n,r){switch(t.type){case"@layer":if(t.children.length)break;case"@import":case l:return t.return=t.return||t.value;case i:return"";case s:return t.return=t.value+"{"+W(t.children,r)+"}";case o:t.value=t.props.join(",")}return y(n=W(t.children,r))?t.return=t.value+"{"+n+"}":""}function X(t){var e=v(t);return function(n,r,a,i){for(var o="",l=0;l<e;l++)o+=t[l](n,r,a,i)||"";return o}}function Y(t){var e=Object.create(null);return function(n){return void 0===e[n]&&(e[n]=t(n)),e[n]}}var J="undefined"!=typeof document,Q=function(t,e,n){for(var r=0,a=0;r=a,a=E(),38===r&&12===a&&(e[n]=1),!G(a);)N();return z(t,M)},Z=function(t,e){return O(function(t,e){var n=-1,r=44;do{switch(G(r)){case 0:38===r&&12===E()&&(e[n]=1),t[n]+=Q(M-1,e,n);break;case 2:t[n]+=P(r);break;case 4:if(44===r){t[++n]=58===E()?"&\f":"",e[n]=t[n].length;break}default:t[n]+=c(r)}}while(r=N());return t}(D(t),e))},tt=new WeakMap,et=function(t){if("rule"===t.type&&t.parent&&!(t.length<1)){for(var e=t.value,n=t.parent,r=t.column===n.column&&t.line===n.line;"rule"!==n.type;)if(!(n=n.parent))return;if((1!==t.props.length||58===e.charCodeAt(0)||tt.get(n))&&!r){tt.set(t,!0);for(var a=[],i=Z(e,a),o=n.props,l=0,s=0;l<i.length;l++)for(var u=0;u<o.length;u++,s++)t.props[s]=a[l]?i[l].replace(/&\f/g,o[u]):o[u]+" "+i[l]}}},nt=function(t){if("decl"===t.type){var e=t.value;108===e.charCodeAt(0)&&98===e.charCodeAt(2)&&(t.return="",t.value="")}};function rt(t,e){switch(function(t,e){return 45^g(t,0)?(((e<<2^g(t,0))<<2^g(t,1))<<2^g(t,2))<<2^g(t,3):0}(t,e)){case 5103:return a+"print-"+t+t;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return a+t+t;case 5349:case 4246:case 4810:case 6968:case 2756:return a+t+r+t+n+t+t;case 6828:case 4268:return a+t+n+t+t;case 6165:return a+t+n+"flex-"+t+t;case 5187:return a+t+p(t,/(\w+).+(:[^]+)/,a+"box-$1$2"+n+"flex-$1$2")+t;case 5443:return a+t+n+"flex-item-"+p(t,/flex-|-self/,"")+t;case 4675:return a+t+n+"flex-line-pack"+p(t,/align-content|flex-|-self/,"")+t;case 5548:return a+t+n+p(t,"shrink","negative")+t;case 5292:return a+t+n+p(t,"basis","preferred-size")+t;case 6060:return a+"box-"+p(t,"-grow","")+a+t+n+p(t,"grow","positive")+t;case 4554:return a+p(t,/([^-])(transform)/g,"$1"+a+"$2")+t;case 6187:return p(p(p(t,/(zoom-|grab)/,a+"$1"),/(image-set)/,a+"$1"),t,"")+t;case 5495:case 3959:return p(t,/(image-set\([^]*)/,a+"$1$`$1");case 4968:return p(p(t,/(.+:)(flex-)?(.*)/,a+"box-pack:$3"+n+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+a+t+t;case 4095:case 3583:case 4068:case 2532:return p(t,/(.+)-inline(.+)/,a+"$1$2")+t;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(y(t)-1-e>6)switch(g(t,e+1)){case 109:if(45!==g(t,e+4))break;case 102:return p(t,/(.+:)(.+)-([^]+)/,"$1"+a+"$2-$3$1"+r+(108==g(t,e+3)?"$3":"$2-$3"))+t;case 115:return~m(t,"stretch")?rt(p(t,"stretch","fill-available"),e)+t:t}break;case 4949:if(115!==g(t,e+1))break;case 6444:switch(g(t,y(t)-3-(~m(t,"!important")&&10))){case 107:return p(t,":",":"+a)+t;case 101:return p(t,/(.+:)([^;!]+)(;|!.+)?/,"$1"+a+(45===g(t,14)?"inline-":"")+"box$3$1"+a+"$2$3$1"+n+"$2box$3")+t}break;case 5936:switch(g(t,e+11)){case 114:return a+t+n+p(t,/[svh]\w+-[tblr]{2}/,"tb")+t;case 108:return a+t+n+p(t,/[svh]\w+-[tblr]{2}/,"tb-rl")+t;case 45:return a+t+n+p(t,/[svh]\w+-[tblr]{2}/,"lr")+t}return a+t+n+t+t}return t}var at,it,ot=J?void 0:(at=function(){return Y(function(){return{}})},it=new WeakMap,function(t){if(it.has(t))return it.get(t);var e=at(t);return it.set(t,e),e}),lt=[function(t,e,r,i){if(t.length>-1&&!t.return)switch(t.type){case l:t.return=rt(t.value,t.length);break;case s:return W([$(t,{value:p(t.value,"@","@"+a)})],i);case o:if(t.length)return function(t,e){return t.map(e).join("")}(t.props,function(e){switch(function(t,e){return(t=e.exec(t))?t[0]:t}(e,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return W([$(t,{props:[p(e,/:(read-\w+)/,":-moz-$1")]})],i);case"::placeholder":return W([$(t,{props:[p(e,/:(plac\w+)/,":"+a+"input-$1")]}),$(t,{props:[p(e,/:(plac\w+)/,":-moz-$1")]}),$(t,{props:[p(e,/:(plac\w+)/,n+"input-$1")]})],i)}return""})}}],st=function(t){var n=t.key;if(J&&"css"===n){var r=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(r,function(t){-1!==t.getAttribute("data-emotion").indexOf(" ")&&(document.head.appendChild(t),t.setAttribute("data-s",""))})}var a,i,o=t.stylisPlugins||lt,l={},s=[];J&&(a=t.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+n+' "]'),function(t){for(var e=t.getAttribute("data-emotion").split(" "),n=1;n<e.length;n++)l[e[n]]=!0;s.push(t)}));var u,c=[et,nt];if(ot){var h=[U],f=X(c.concat(o,h)),p=ot(o)(n),m=function(t,e){var n=e.name;return void 0===p[n]&&(p[n]=W(I(t?t+"{"+e.styles+"}":e.styles),f)),p[n]};i=function(t,e,n,r){var a=e.name,i=m(t,e);return void 0===v.compat?(r&&(v.inserted[a]=!0),i):r?void(v.inserted[a]=i):i}}else{var g,d=[U,(u=function(t){g.insert(t)},function(t){t.root||(t=t.return)&&u(t)})],y=X(c.concat(o,d));i=function(t,e,n,r){g=n,W(I(t?t+"{"+e.styles+"}":e.styles),y),r&&(v.inserted[e.name]=!0)}}var v={key:n,sheet:new e({key:n,container:a,nonce:t.nonce,speedy:t.speedy,prepend:t.prepend,insertionPoint:t.insertionPoint}),nonce:t.nonce,inserted:l,registered:{},insert:i};return v.sheet.hydrate(s),v};var ut={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,scale:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},ct=/[A-Z]|^ms/g,ht=/_EMO_([^_]+?)_([^]*?)_EMO_/g,ft=function(t){return 45===t.charCodeAt(1)},pt=function(t){return null!=t&&"boolean"!=typeof t},mt=Y(function(t){return ft(t)?t:t.replace(ct,"-$&").toLowerCase()}),gt=function(t,e){switch(t){case"animation":case"animationName":if("string"==typeof e)return e.replace(ht,function(t,e,n){return yt={name:e,styles:n,next:yt},e})}return 1===ut[t]||ft(t)||"number"!=typeof e||0===e?e:e+"px"};function dt(t,e,n){if(null==n)return"";var r=n;if(void 0!==r.__emotion_styles)return r;switch(typeof n){case"boolean":return"";case"object":var a=n;if(1===a.anim)return yt={name:a.name,styles:a.styles,next:yt},a.name;var i=n;if(void 0!==i.styles){var o=i.next;if(void 0!==o)for(;void 0!==o;)yt={name:o.name,styles:o.styles,next:yt},o=o.next;return i.styles+";"}return function(t,e,n){var r="";if(Array.isArray(n))for(var a=0;a<n.length;a++)r+=dt(t,e,n[a])+";";else for(var i in n){var o=n[i];if("object"!=typeof o){var l=o;null!=e&&void 0!==e[l]?r+=i+"{"+e[l]+"}":pt(l)&&(r+=mt(i)+":"+gt(i,l)+";")}else if(!Array.isArray(o)||"string"!=typeof o[0]||null!=e&&void 0!==e[o[0]]){var s=dt(t,e,o);switch(i){case"animation":case"animationName":r+=mt(i)+":"+s+";";break;default:r+=i+"{"+s+"}"}}else for(var u=0;u<o.length;u++)pt(o[u])&&(r+=mt(i)+":"+gt(i,o[u])+";")}return r}(t,e,n);case"function":if(void 0!==t){var l=yt,s=n(t);return yt=l,dt(t,e,s)}}var u=n;if(null==e)return u;var c=e[u];return void 0!==c?c:u}var yt,vt=/label:\s*([^\s;{]+)\s*(;|$)/g;function _t(t,e,n){if(1===t.length&&"object"==typeof t[0]&&null!==t[0]&&void 0!==t[0].styles)return t[0];var r=!0,a="";yt=void 0;var i=t[0];null==i||void 0===i.raw?(r=!1,a+=dt(n,e,i)):a+=i[0];for(var o=1;o<t.length;o++){if(a+=dt(n,e,t[o]),r)a+=i[o]}vt.lastIndex=0;for(var l,s="";null!==(l=vt.exec(a));)s+="-"+l[1];var u=function(t){for(var e,n=0,r=0,a=t.length;a>=4;++r,a-=4)e=1540483477*(65535&(e=255&t.charCodeAt(r)|(255&t.charCodeAt(++r))<<8|(255&t.charCodeAt(++r))<<16|(255&t.charCodeAt(++r))<<24))+(59797*(e>>>16)<<16),n=1540483477*(65535&(e^=e>>>24))+(59797*(e>>>16)<<16)^1540483477*(65535&n)+(59797*(n>>>16)<<16);switch(a){case 3:n^=(255&t.charCodeAt(r+2))<<16;case 2:n^=(255&t.charCodeAt(r+1))<<8;case 1:n=1540483477*(65535&(n^=255&t.charCodeAt(r)))+(59797*(n>>>16)<<16)}return(((n=1540483477*(65535&(n^=n>>>13))+(59797*(n>>>16)<<16))^n>>>15)>>>0).toString(36)}(a)+s;return{name:u,styles:a,next:yt}}var bt="undefined"!=typeof document;function wt(t,e,n){var r="";return n.split(" ").forEach(function(n){void 0!==t[n]?e.push(t[n]+";"):n&&(r+=n+" ")}),r}var xt=function(t,e,n){!function(t,e,n){var r=t.key+"-"+e.name;(!1===n||!1===bt&&void 0!==t.compat)&&void 0===t.registered[r]&&(t.registered[r]=e.styles)}(t,e,n);var r=t.key+"-"+e.name;if(void 0===t.inserted[e.name]){var a="",i=e;do{var o=t.insert(e===i?"."+r:"",i,t.sheet,!0);bt||void 0===o||(a+=o),i=i.next}while(void 0!==i);if(!bt&&0!==a.length)return a}};function Mt(t,e){if(void 0===t.inserted[e.name])return t.insert("",e,t.sheet,!0)}function kt(t,e,n){var r=[],a=wt(t,r,n);return r.length<2?n:a+e(r)}var Ct=function t(e){for(var n="",r=0;r<e.length;r++){var a=e[r];if(null!=a){var i=void 0;switch(typeof a){case"boolean":break;case"object":if(Array.isArray(a))i=t(a);else for(var o in i="",a)a[o]&&o&&(i&&(i+=" "),i+=o);break;default:i=a}i&&(n&&(n+=" "),n+=i)}}return n},At=function(t){var e=st(t);e.sheet.speedy=function(t){this.isSpeedy=t},e.compat=!0;var n=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var a=_t(n,e.registered,void 0);return xt(e,a,!1),e.key+"-"+a.name};return{css:n,cx:function(){for(var t=arguments.length,r=new Array(t),a=0;a<t;a++)r[a]=arguments[a];return kt(e.registered,n,Ct(r))},injectGlobal:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var a=_t(n,e.registered);Mt(e,a)},keyframes:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var a=_t(n,e.registered),i="animation-"+a.name;return Mt(e,{name:a.name,styles:"@keyframes "+i+"{"+a.styles+"}"}),i},hydrate:function(t){t.forEach(function(t){e.inserted[t]=!0})},flush:function(){e.registered={},e.inserted={},e.sheet.flush()},sheet:e.sheet,cache:e,getRegisteredStyles:wt.bind(null,e.registered),merge:kt.bind(null,e.registered,n)}}({key:"css"}),$t=At.injectGlobal,St=At.css;function Nt(t,e){return null==t||null==e?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function Et(t,e){return null==t||null==e?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function jt(t){let e,n,r;function a(t,r,a=0,i=t.length){if(a<i){if(0!==e(r,r))return i;do{const e=a+i>>>1;n(t[e],r)<0?a=e+1:i=e}while(a<i)}return a}return 2!==t.length?(e=Nt,n=(e,n)=>Nt(t(e),n),r=(e,n)=>t(e)-n):(e=t===Nt||t===Et?t:zt,n=t,r=t),{left:a,center:function(t,e,n=0,i=t.length){const o=a(t,e,n,i-1);return o>n&&r(t[o-1],e)>-r(t[o],e)?o-1:o},right:function(t,r,a=0,i=t.length){if(a<i){if(0!==e(r,r))return i;do{const e=a+i>>>1;n(t[e],r)<=0?a=e+1:i=e}while(a<i)}return a}}}function zt(){return 0}const Gt=jt(Nt).right;jt(function(t){return null===t?NaN:+t}).center;var Dt=Gt;const Ot=Math.sqrt(50),Pt=Math.sqrt(10),Tt=Math.sqrt(2);function Rt(t,e,n){const r=(e-t)/Math.max(0,n),a=Math.floor(Math.log10(r)),i=r/Math.pow(10,a),o=i>=Ot?10:i>=Pt?5:i>=Tt?2:1;let l,s,u;return a<0?(u=Math.pow(10,-a)/o,l=Math.round(t*u),s=Math.round(e*u),l/u<t&&++l,s/u>e&&--s,u=-u):(u=Math.pow(10,a)*o,l=Math.round(t/u),s=Math.round(e/u),l*u<t&&++l,s*u>e&&--s),s<l&&.5<=n&&n<2?Rt(t,e,2*n):[l,s,u]}function Lt(t,e,n){return Rt(t=+t,e=+e,n=+n)[2]}function Kt(t,e,n){t=+t,e=+e,n=(a=arguments.length)<2?(e=t,t=0,1):a<3?1:+n;for(var r=-1,a=0|Math.max(0,Math.ceil((e-t)/n)),i=new Array(a);++r<a;)i[r]=t+r*n;return i}var qt={value:()=>{}};function It(){for(var t,e=0,n=arguments.length,r={};e<n;++e){if(!(t=arguments[e]+"")||t in r||/[\s.]/.test(t))throw new Error("illegal type: "+t);r[t]=[]}return new Bt(r)}function Bt(t){this._=t}function Ht(t,e){for(var n,r=0,a=t.length;r<a;++r)if((n=t[r]).name===e)return n.value}function Ft(t,e,n){for(var r=0,a=t.length;r<a;++r)if(t[r].name===e){t[r]=qt,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=n&&t.push({name:e,value:n}),t}Bt.prototype=It.prototype={constructor:Bt,on:function(t,e){var n,r,a=this._,i=(r=a,(t+"").trim().split(/^|\s+/).map(function(t){var e="",n=t.indexOf(".");if(n>=0&&(e=t.slice(n+1),t=t.slice(0,n)),t&&!r.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}})),o=-1,l=i.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++o<l;)if(n=(t=i[o]).type)a[n]=Ft(a[n],t.name,e);else if(null==e)for(n in a)a[n]=Ft(a[n],t.name,null);return this}for(;++o<l;)if((n=(t=i[o]).type)&&(n=Ht(a[n],t.name)))return n},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new Bt(t)},call:function(t,e){if((n=arguments.length-2)>0)for(var n,r,a=new Array(n),i=0;i<n;++i)a[i]=arguments[i+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(i=0,n=(r=this._[t]).length;i<n;++i)r[i].value.apply(e,a)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],a=0,i=r.length;a<i;++a)r[a].value.apply(e,n)}};var Vt="http://www.w3.org/1999/xhtml",Wt={svg:"http://www.w3.org/2000/svg",xhtml:Vt,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Ut(t){var e=t+="",n=e.indexOf(":");return n>=0&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),Wt.hasOwnProperty(e)?{space:Wt[e],local:t}:t}function Xt(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===Vt&&e.documentElement.namespaceURI===Vt?e.createElement(t):e.createElementNS(n,t)}}function Yt(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function Jt(t){var e=Ut(t);return(e.local?Yt:Xt)(e)}function Qt(){}function Zt(t){return null==t?Qt:function(){return this.querySelector(t)}}function te(t){return null==t?[]:Array.isArray(t)?t:Array.from(t)}function ee(){return[]}function ne(t){return null==t?ee:function(){return this.querySelectorAll(t)}}function re(t){return function(){return this.matches(t)}}function ae(t){return function(e){return e.matches(t)}}var ie=Array.prototype.find;function oe(){return this.firstElementChild}var le=Array.prototype.filter;function se(){return Array.from(this.children)}function ue(t){return new Array(t.length)}function ce(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}function he(t,e,n,r,a,i){for(var o,l=0,s=e.length,u=i.length;l<u;++l)(o=e[l])?(o.__data__=i[l],r[l]=o):n[l]=new ce(t,i[l]);for(;l<s;++l)(o=e[l])&&(a[l]=o)}function fe(t,e,n,r,a,i,o){var l,s,u,c=new Map,h=e.length,f=i.length,p=new Array(h);for(l=0;l<h;++l)(s=e[l])&&(p[l]=u=o.call(s,s.__data__,l,e)+"",c.has(u)?a[l]=s:c.set(u,s));for(l=0;l<f;++l)u=o.call(t,i[l],l,i)+"",(s=c.get(u))?(r[l]=s,s.__data__=i[l],c.delete(u)):n[l]=new ce(t,i[l]);for(l=0;l<h;++l)(s=e[l])&&c.get(p[l])===s&&(a[l]=s)}function pe(t){return t.__data__}function me(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function ge(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function de(t){return function(){this.removeAttribute(t)}}function ye(t){return function(){this.removeAttributeNS(t.space,t.local)}}function ve(t,e){return function(){this.setAttribute(t,e)}}function _e(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function be(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}}function we(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function xe(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function Me(t){return function(){this.style.removeProperty(t)}}function ke(t,e,n){return function(){this.style.setProperty(t,e,n)}}function Ce(t,e,n){return function(){var r=e.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function Ae(t,e){return t.style.getPropertyValue(e)||xe(t).getComputedStyle(t,null).getPropertyValue(e)}function $e(t){return function(){delete this[t]}}function Se(t,e){return function(){this[t]=e}}function Ne(t,e){return function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}}function Ee(t){return t.trim().split(/^|\s+/)}function je(t){return t.classList||new ze(t)}function ze(t){this._node=t,this._names=Ee(t.getAttribute("class")||"")}function Ge(t,e){for(var n=je(t),r=-1,a=e.length;++r<a;)n.add(e[r])}function De(t,e){for(var n=je(t),r=-1,a=e.length;++r<a;)n.remove(e[r])}function Oe(t){return function(){Ge(this,t)}}function Pe(t){return function(){De(this,t)}}function Te(t,e){return function(){(e.apply(this,arguments)?Ge:De)(this,t)}}function Re(){this.textContent=""}function Le(t){return function(){this.textContent=t}}function Ke(t){return function(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}}function qe(){this.innerHTML=""}function Ie(t){return function(){this.innerHTML=t}}function Be(t){return function(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}}function He(){this.nextSibling&&this.parentNode.appendChild(this)}function Fe(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Ve(){return null}function We(){var t=this.parentNode;t&&t.removeChild(this)}function Ue(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Xe(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Ye(t){return function(){var e=this.__on;if(e){for(var n,r=0,a=-1,i=e.length;r<i;++r)n=e[r],t.type&&n.type!==t.type||n.name!==t.name?e[++a]=n:this.removeEventListener(n.type,n.listener,n.options);++a?e.length=a:delete this.__on}}}function Je(t,e,n){return function(){var r,a=this.__on,i=function(t){return function(e){t.call(this,e,this.__data__)}}(e);if(a)for(var o=0,l=a.length;o<l;++o)if((r=a[o]).type===t.type&&r.name===t.name)return this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=i,r.options=n),void(r.value=e);this.addEventListener(t.type,i,n),r={type:t.type,name:t.name,value:e,listener:i,options:n},a?a.push(r):this.__on=[r]}}function Qe(t,e,n){var r=xe(t),a=r.CustomEvent;"function"==typeof a?a=new a(e,n):(a=r.document.createEvent("Event"),n?(a.initEvent(e,n.bubbles,n.cancelable),a.detail=n.detail):a.initEvent(e,!1,!1)),t.dispatchEvent(a)}function Ze(t,e){return function(){return Qe(this,t,e)}}function tn(t,e){return function(){return Qe(this,t,e.apply(this,arguments))}}ce.prototype={constructor:ce,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)}},ze.prototype={add:function(t){this._names.indexOf(t)<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var en=[null];function nn(t,e){this._groups=t,this._parents=e}function rn(){return new nn([[document.documentElement]],en)}function an(t){return"string"==typeof t?new nn([[document.querySelector(t)]],[document.documentElement]):new nn([[t]],en)}function on(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function ln(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function sn(){}nn.prototype=rn.prototype={constructor:nn,select:function(t){"function"!=typeof t&&(t=Zt(t));for(var e=this._groups,n=e.length,r=new Array(n),a=0;a<n;++a)for(var i,o,l=e[a],s=l.length,u=r[a]=new Array(s),c=0;c<s;++c)(i=l[c])&&(o=t.call(i,i.__data__,c,l))&&("__data__"in i&&(o.__data__=i.__data__),u[c]=o);return new nn(r,this._parents)},selectAll:function(t){t="function"==typeof t?function(t){return function(){return te(t.apply(this,arguments))}}(t):ne(t);for(var e=this._groups,n=e.length,r=[],a=[],i=0;i<n;++i)for(var o,l=e[i],s=l.length,u=0;u<s;++u)(o=l[u])&&(r.push(t.call(o,o.__data__,u,l)),a.push(o));return new nn(r,a)},selectChild:function(t){return this.select(null==t?oe:function(t){return function(){return ie.call(this.children,t)}}("function"==typeof t?t:ae(t)))},selectChildren:function(t){return this.selectAll(null==t?se:function(t){return function(){return le.call(this.children,t)}}("function"==typeof t?t:ae(t)))},filter:function(t){"function"!=typeof t&&(t=re(t));for(var e=this._groups,n=e.length,r=new Array(n),a=0;a<n;++a)for(var i,o=e[a],l=o.length,s=r[a]=[],u=0;u<l;++u)(i=o[u])&&t.call(i,i.__data__,u,o)&&s.push(i);return new nn(r,this._parents)},data:function(t,e){if(!arguments.length)return Array.from(this,pe);var n=e?fe:he,r=this._parents,a=this._groups;"function"!=typeof t&&(t=function(t){return function(){return t}}(t));for(var i=a.length,o=new Array(i),l=new Array(i),s=new Array(i),u=0;u<i;++u){var c=r[u],h=a[u],f=h.length,p=me(t.call(c,c&&c.__data__,u,r)),m=p.length,g=l[u]=new Array(m),d=o[u]=new Array(m);n(c,h,g,d,s[u]=new Array(f),p,e);for(var y,v,_=0,b=0;_<m;++_)if(y=g[_]){for(_>=b&&(b=_+1);!(v=d[b])&&++b<m;);y._next=v||null}}return(o=new nn(o,r))._enter=l,o._exit=s,o},enter:function(){return new nn(this._enter||this._groups.map(ue),this._parents)},exit:function(){return new nn(this._exit||this._groups.map(ue),this._parents)},join:function(t,e,n){var r=this.enter(),a=this,i=this.exit();return"function"==typeof t?(r=t(r))&&(r=r.selection()):r=r.append(t+""),null!=e&&(a=e(a))&&(a=a.selection()),null==n?i.remove():n(i),r&&a?r.merge(a).order():a},merge:function(t){for(var e=t.selection?t.selection():t,n=this._groups,r=e._groups,a=n.length,i=r.length,o=Math.min(a,i),l=new Array(a),s=0;s<o;++s)for(var u,c=n[s],h=r[s],f=c.length,p=l[s]=new Array(f),m=0;m<f;++m)(u=c[m]||h[m])&&(p[m]=u);for(;s<a;++s)l[s]=n[s];return new nn(l,this._parents)},selection:function(){return this},order:function(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var r,a=t[e],i=a.length-1,o=a[i];--i>=0;)(r=a[i])&&(o&&4^r.compareDocumentPosition(o)&&o.parentNode.insertBefore(r,o),o=r);return this},sort:function(t){function e(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}t||(t=ge);for(var n=this._groups,r=n.length,a=new Array(r),i=0;i<r;++i){for(var o,l=n[i],s=l.length,u=a[i]=new Array(s),c=0;c<s;++c)(o=l[c])&&(u[c]=o);u.sort(e)}return new nn(a,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,e=0,n=t.length;e<n;++e)for(var r=t[e],a=0,i=r.length;a<i;++a){var o=r[a];if(o)return o}return null},size:function(){let t=0;for(const e of this)++t;return t},empty:function(){return!this.node()},each:function(t){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var a,i=e[n],o=0,l=i.length;o<l;++o)(a=i[o])&&t.call(a,a.__data__,o,i);return this},attr:function(t,e){var n=Ut(t);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((null==e?n.local?ye:de:"function"==typeof e?n.local?we:be:n.local?_e:ve)(n,e))},style:function(t,e,n){return arguments.length>1?this.each((null==e?Me:"function"==typeof e?Ce:ke)(t,e,null==n?"":n)):Ae(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?$e:"function"==typeof e?Ne:Se)(t,e)):this.node()[t]},classed:function(t,e){var n=Ee(t+"");if(arguments.length<2){for(var r=je(this.node()),a=-1,i=n.length;++a<i;)if(!r.contains(n[a]))return!1;return!0}return this.each(("function"==typeof e?Te:e?Oe:Pe)(n,e))},text:function(t){return arguments.length?this.each(null==t?Re:("function"==typeof t?Ke:Le)(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?qe:("function"==typeof t?Be:Ie)(t)):this.node().innerHTML},raise:function(){return this.each(He)},lower:function(){return this.each(Fe)},append:function(t){var e="function"==typeof t?t:Jt(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})},insert:function(t,e){var n="function"==typeof t?t:Jt(t),r=null==e?Ve:"function"==typeof e?e:Zt(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})},remove:function(){return this.each(We)},clone:function(t){return this.select(t?Xe:Ue)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,e,n){var r,a,i=function(t){return t.trim().split(/^|\s+/).map(function(t){var e="",n=t.indexOf(".");return n>=0&&(e=t.slice(n+1),t=t.slice(0,n)),{type:t,name:e}})}(t+""),o=i.length;if(!(arguments.length<2)){for(l=e?Je:Ye,r=0;r<o;++r)this.each(l(i[r],e,n));return this}var l=this.node().__on;if(l)for(var s,u=0,c=l.length;u<c;++u)for(r=0,s=l[u];r<o;++r)if((a=i[r]).type===s.type&&a.name===s.name)return s.value},dispatch:function(t,e){return this.each(("function"==typeof e?tn:Ze)(t,e))},[Symbol.iterator]:function*(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r,a=t[e],i=0,o=a.length;i<o;++i)(r=a[i])&&(yield r)}};var un=.7,cn=1/un,hn="\\s*([+-]?\\d+)\\s*",fn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",pn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",mn=/^#([0-9a-f]{3,8})$/,gn=new RegExp(`^rgb\\(${hn},${hn},${hn}\\)$`),dn=new RegExp(`^rgb\\(${pn},${pn},${pn}\\)$`),yn=new RegExp(`^rgba\\(${hn},${hn},${hn},${fn}\\)$`),vn=new RegExp(`^rgba\\(${pn},${pn},${pn},${fn}\\)$`),_n=new RegExp(`^hsl\\(${fn},${pn},${pn}\\)$`),bn=new RegExp(`^hsla\\(${fn},${pn},${pn},${fn}\\)$`),wn={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 xn(){return this.rgb().formatHex()}function Mn(){return this.rgb().formatRgb()}function kn(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=mn.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?Cn(e):3===n?new Sn(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?An(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?An(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=gn.exec(t))?new Sn(e[1],e[2],e[3],1):(e=dn.exec(t))?new Sn(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=yn.exec(t))?An(e[1],e[2],e[3],e[4]):(e=vn.exec(t))?An(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=_n.exec(t))?Dn(e[1],e[2]/100,e[3]/100,1):(e=bn.exec(t))?Dn(e[1],e[2]/100,e[3]/100,e[4]):wn.hasOwnProperty(t)?Cn(wn[t]):"transparent"===t?new Sn(NaN,NaN,NaN,0):null}function Cn(t){return new Sn(t>>16&255,t>>8&255,255&t,1)}function An(t,e,n,r){return r<=0&&(t=e=n=NaN),new Sn(t,e,n,r)}function $n(t,e,n,r){return 1===arguments.length?((a=t)instanceof sn||(a=kn(a)),a?new Sn((a=a.rgb()).r,a.g,a.b,a.opacity):new Sn):new Sn(t,e,n,null==r?1:r);var a}function Sn(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function Nn(){return`#${Gn(this.r)}${Gn(this.g)}${Gn(this.b)}`}function En(){const t=jn(this.opacity);return`${1===t?"rgb(":"rgba("}${zn(this.r)}, ${zn(this.g)}, ${zn(this.b)}${1===t?")":`, ${t})`}`}function jn(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function zn(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Gn(t){return((t=zn(t))<16?"0":"")+t.toString(16)}function Dn(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Pn(t,e,n,r)}function On(t){if(t instanceof Pn)return new Pn(t.h,t.s,t.l,t.opacity);if(t instanceof sn||(t=kn(t)),!t)return new Pn;if(t instanceof Pn)return t;var e=(t=t.rgb()).r/255,n=t.g/255,r=t.b/255,a=Math.min(e,n,r),i=Math.max(e,n,r),o=NaN,l=i-a,s=(i+a)/2;return l?(o=e===i?(n-r)/l+6*(n<r):n===i?(r-e)/l+2:(e-n)/l+4,l/=s<.5?i+a:2-i-a,o*=60):l=s>0&&s<1?0:o,new Pn(o,l,s,t.opacity)}function Pn(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function Tn(t){return(t=(t||0)%360)<0?t+360:t}function Rn(t){return Math.max(0,Math.min(1,t||0))}function Ln(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}on(sn,kn,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:xn,formatHex:xn,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return On(this).formatHsl()},formatRgb:Mn,toString:Mn}),on(Sn,$n,ln(sn,{brighter(t){return t=null==t?cn:Math.pow(cn,t),new Sn(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?un:Math.pow(un,t),new Sn(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Sn(zn(this.r),zn(this.g),zn(this.b),jn(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:Nn,formatHex:Nn,formatHex8:function(){return`#${Gn(this.r)}${Gn(this.g)}${Gn(this.b)}${Gn(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:En,toString:En})),on(Pn,function(t,e,n,r){return 1===arguments.length?On(t):new Pn(t,e,n,null==r?1:r)},ln(sn,{brighter(t){return t=null==t?cn:Math.pow(cn,t),new Pn(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?un:Math.pow(un,t),new Pn(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,a=2*n-r;return new Sn(Ln(t>=240?t-240:t+120,a,r),Ln(t,a,r),Ln(t<120?t+240:t-120,a,r),this.opacity)},clamp(){return new Pn(Tn(this.h),Rn(this.s),Rn(this.l),jn(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=jn(this.opacity);return`${1===t?"hsl(":"hsla("}${Tn(this.h)}, ${100*Rn(this.s)}%, ${100*Rn(this.l)}%${1===t?")":`, ${t})`}`}}));var Kn=t=>()=>t;function qn(t){return 1===(t=+t)?In:function(e,n){return n-e?function(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}(e,n,t):Kn(isNaN(e)?n:e)}}function In(t,e){var n=e-t;return n?function(t,e){return function(n){return t+n*e}}(t,n):Kn(isNaN(t)?e:t)}var Bn=function t(e){var n=qn(e);function r(t,e){var r=n((t=$n(t)).r,(e=$n(e)).r),a=n(t.g,e.g),i=n(t.b,e.b),o=In(t.opacity,e.opacity);return function(e){return t.r=r(e),t.g=a(e),t.b=i(e),t.opacity=o(e),t+""}}return r.gamma=t,r}(1);function Hn(t,e){e||(e=[]);var n,r=t?Math.min(e.length,t.length):0,a=e.slice();return function(i){for(n=0;n<r;++n)a[n]=t[n]*(1-i)+e[n]*i;return a}}function Fn(t,e){var n,r=e?e.length:0,a=t?Math.min(r,t.length):0,i=new Array(a),o=new Array(r);for(n=0;n<a;++n)i[n]=Qn(t[n],e[n]);for(;n<r;++n)o[n]=e[n];return function(t){for(n=0;n<a;++n)o[n]=i[n](t);return o}}function Vn(t,e){var n=new Date;return t=+t,e=+e,function(r){return n.setTime(t*(1-r)+e*r),n}}function Wn(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function Un(t,e){var n,r={},a={};for(n in null!==t&&"object"==typeof t||(t={}),null!==e&&"object"==typeof e||(e={}),e)n in t?r[n]=Qn(t[n],e[n]):a[n]=e[n];return function(t){for(n in r)a[n]=r[n](t);return a}}var Xn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Yn=new RegExp(Xn.source,"g");function Jn(t,e){var n,r,a,i=Xn.lastIndex=Yn.lastIndex=0,o=-1,l=[],s=[];for(t+="",e+="";(n=Xn.exec(t))&&(r=Yn.exec(e));)(a=r.index)>i&&(a=e.slice(i,a),l[o]?l[o]+=a:l[++o]=a),(n=n[0])===(r=r[0])?l[o]?l[o]+=r:l[++o]=r:(l[++o]=null,s.push({i:o,x:Wn(n,r)})),i=Yn.lastIndex;return i<e.length&&(a=e.slice(i),l[o]?l[o]+=a:l[++o]=a),l.length<2?s[0]?function(t){return function(e){return t(e)+""}}(s[0].x):function(t){return function(){return t}}(e):(e=s.length,function(t){for(var n,r=0;r<e;++r)l[(n=s[r]).i]=n.x(t);return l.join("")})}function Qn(t,e){var n,r=typeof e;return null==e||"boolean"===r?Kn(e):("number"===r?Wn:"string"===r?(n=kn(e))?(e=n,Bn):Jn:e instanceof kn?Bn:e instanceof Date?Vn:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}(e)?Hn:Array.isArray(e)?Fn:"function"!=typeof e.valueOf&&"function"!=typeof e.toString||isNaN(e)?Un:Wn)(t,e)}function Zn(t,e){return t=+t,e=+e,function(n){return Math.round(t*(1-n)+e*n)}}var tr,er=180/Math.PI,nr={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function rr(t,e,n,r,a,i){var o,l,s;return(o=Math.sqrt(t*t+e*e))&&(t/=o,e/=o),(s=t*n+e*r)&&(n-=t*s,r-=e*s),(l=Math.sqrt(n*n+r*r))&&(n/=l,r/=l,s/=l),t*r<e*n&&(t=-t,e=-e,s=-s,o=-o),{translateX:a,translateY:i,rotate:Math.atan2(e,t)*er,skewX:Math.atan(s)*er,scaleX:o,scaleY:l}}function ar(t,e,n,r){function a(t){return t.length?t.pop()+" ":""}return function(i,o){var l=[],s=[];return i=t(i),o=t(o),function(t,r,a,i,o,l){if(t!==a||r!==i){var s=o.push("translate(",null,e,null,n);l.push({i:s-4,x:Wn(t,a)},{i:s-2,x:Wn(r,i)})}else(a||i)&&o.push("translate("+a+e+i+n)}(i.translateX,i.translateY,o.translateX,o.translateY,l,s),function(t,e,n,i){t!==e?(t-e>180?e+=360:e-t>180&&(t+=360),i.push({i:n.push(a(n)+"rotate(",null,r)-2,x:Wn(t,e)})):e&&n.push(a(n)+"rotate("+e+r)}(i.rotate,o.rotate,l,s),function(t,e,n,i){t!==e?i.push({i:n.push(a(n)+"skewX(",null,r)-2,x:Wn(t,e)}):e&&n.push(a(n)+"skewX("+e+r)}(i.skewX,o.skewX,l,s),function(t,e,n,r,i,o){if(t!==n||e!==r){var l=i.push(a(i)+"scale(",null,",",null,")");o.push({i:l-4,x:Wn(t,n)},{i:l-2,x:Wn(e,r)})}else 1===n&&1===r||i.push(a(i)+"scale("+n+","+r+")")}(i.scaleX,i.scaleY,o.scaleX,o.scaleY,l,s),i=o=null,function(t){for(var e,n=-1,r=s.length;++n<r;)l[(e=s[n]).i]=e.x(t);return l.join("")}}}var ir,or,lr=ar(function(t){const e=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?nr:rr(e.a,e.b,e.c,e.d,e.e,e.f)},"px, ","px)","deg)"),sr=ar(function(t){return null==t?nr:(tr||(tr=document.createElementNS("http://www.w3.org/2000/svg","g")),tr.setAttribute("transform",t),(t=tr.transform.baseVal.consolidate())?rr((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):nr)},", ",")",")"),ur=0,cr=0,hr=0,fr=0,pr=0,mr=0,gr="object"==typeof performance&&performance.now?performance:Date,dr="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function yr(){return pr||(dr(vr),pr=gr.now()+mr)}function vr(){pr=0}function _r(){this._call=this._time=this._next=null}function br(t,e,n){var r=new _r;return r.restart(t,e,n),r}function wr(){pr=(fr=gr.now())+mr,ur=cr=0;try{!function(){yr(),++ur;for(var t,e=ir;e;)(t=pr-e._time)>=0&&e._call.call(void 0,t),e=e._next;--ur}()}finally{ur=0,function(){var t,e,n=ir,r=1/0;for(;n;)n._call?(r>n._time&&(r=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:ir=e);or=t,Mr(r)}(),pr=0}}function xr(){var t=gr.now(),e=t-fr;e>1e3&&(mr-=e,fr=t)}function Mr(t){ur||(cr&&(cr=clearTimeout(cr)),t-pr>24?(t<1/0&&(cr=setTimeout(wr,t-gr.now()-mr)),hr&&(hr=clearInterval(hr))):(hr||(fr=gr.now(),hr=setInterval(xr,1e3)),ur=1,dr(wr)))}function kr(t,e,n){var r=new _r;return e=null==e?0:+e,r.restart(n=>{r.stop(),t(n+e)},e,n),r}_r.prototype=br.prototype={constructor:_r,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?yr():+n)+(null==e?0:+e),this._next||or===this||(or?or._next=this:ir=this,or=this),this._call=t,this._time=n,Mr()},stop:function(){this._call&&(this._call=null,this._time=1/0,Mr())}};var Cr=It("start","end","cancel","interrupt"),Ar=[];function $r(t,e,n,r,a,i){var o=t.__transition;if(o){if(n in o)return}else t.__transition={};!function(t,e,n){var r,a=t.__transition;function i(t){n.state=1,n.timer.restart(o,n.delay,n.time),n.delay<=t&&o(t-n.delay)}function o(i){var u,c,h,f;if(1!==n.state)return s();for(u in a)if((f=a[u]).name===n.name){if(3===f.state)return kr(o);4===f.state?(f.state=6,f.timer.stop(),f.on.call("interrupt",t,t.__data__,f.index,f.group),delete a[u]):+u<e&&(f.state=6,f.timer.stop(),f.on.call("cancel",t,t.__data__,f.index,f.group),delete a[u])}if(kr(function(){3===n.state&&(n.state=4,n.timer.restart(l,n.delay,n.time),l(i))}),n.state=2,n.on.call("start",t,t.__data__,n.index,n.group),2===n.state){for(n.state=3,r=new Array(h=n.tween.length),u=0,c=-1;u<h;++u)(f=n.tween[u].value.call(t,t.__data__,n.index,n.group))&&(r[++c]=f);r.length=c+1}}function l(e){for(var a=e<n.duration?n.ease.call(null,e/n.duration):(n.timer.restart(s),n.state=5,1),i=-1,o=r.length;++i<o;)r[i].call(t,a);5===n.state&&(n.on.call("end",t,t.__data__,n.index,n.group),s())}function s(){for(var r in n.state=6,n.timer.stop(),delete a[e],a)return;delete t.__transition}a[e]=n,n.timer=br(i,0,n.time)}(t,n,{name:e,index:r,group:a,on:Cr,tween:Ar,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:0})}function Sr(t,e){var n=Er(t,e);if(n.state>0)throw new Error("too late; already scheduled");return n}function Nr(t,e){var n=Er(t,e);if(n.state>3)throw new Error("too late; already running");return n}function Er(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function jr(t,e){var n,r;return function(){var a=Nr(this,t),i=a.tween;if(i!==n)for(var o=0,l=(r=n=i).length;o<l;++o)if(r[o].name===e){(r=r.slice()).splice(o,1);break}a.tween=r}}function zr(t,e,n){var r,a;if("function"!=typeof n)throw new Error;return function(){var i=Nr(this,t),o=i.tween;if(o!==r){a=(r=o).slice();for(var l={name:e,value:n},s=0,u=a.length;s<u;++s)if(a[s].name===e){a[s]=l;break}s===u&&a.push(l)}i.tween=a}}function Gr(t,e,n){var r=t._id;return t.each(function(){var t=Nr(this,r);(t.value||(t.value={}))[e]=n.apply(this,arguments)}),function(t){return Er(t,r).value[e]}}function Dr(t,e){var n;return("number"==typeof e?Wn:e instanceof kn?Bn:(n=kn(e))?(e=n,Bn):Jn)(t,e)}function Or(t){return function(){this.removeAttribute(t)}}function Pr(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Tr(t,e,n){var r,a,i=n+"";return function(){var o=this.getAttribute(t);return o===i?null:o===r?a:a=e(r=o,n)}}function Rr(t,e,n){var r,a,i=n+"";return function(){var o=this.getAttributeNS(t.space,t.local);return o===i?null:o===r?a:a=e(r=o,n)}}function Lr(t,e,n){var r,a,i;return function(){var o,l,s=n(this);if(null!=s)return(o=this.getAttribute(t))===(l=s+"")?null:o===r&&l===a?i:(a=l,i=e(r=o,s));this.removeAttribute(t)}}function Kr(t,e,n){var r,a,i;return function(){var o,l,s=n(this);if(null!=s)return(o=this.getAttributeNS(t.space,t.local))===(l=s+"")?null:o===r&&l===a?i:(a=l,i=e(r=o,s));this.removeAttributeNS(t.space,t.local)}}function qr(t,e){var n,r;function a(){var a=e.apply(this,arguments);return a!==r&&(n=(r=a)&&function(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}(t,a)),n}return a._value=e,a}function Ir(t,e){var n,r;function a(){var a=e.apply(this,arguments);return a!==r&&(n=(r=a)&&function(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}(t,a)),n}return a._value=e,a}function Br(t,e){return function(){Sr(this,t).delay=+e.apply(this,arguments)}}function Hr(t,e){return e=+e,function(){Sr(this,t).delay=e}}function Fr(t,e){return function(){Nr(this,t).duration=+e.apply(this,arguments)}}function Vr(t,e){return e=+e,function(){Nr(this,t).duration=e}}var Wr=rn.prototype.constructor;function Ur(t){return function(){this.style.removeProperty(t)}}var Xr=0;function Yr(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function Jr(){return++Xr}var Qr=rn.prototype;Yr.prototype={constructor:Yr,select:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=Zt(t));for(var r=this._groups,a=r.length,i=new Array(a),o=0;o<a;++o)for(var l,s,u=r[o],c=u.length,h=i[o]=new Array(c),f=0;f<c;++f)(l=u[f])&&(s=t.call(l,l.__data__,f,u))&&("__data__"in l&&(s.__data__=l.__data__),h[f]=s,$r(h[f],e,n,f,h,Er(l,n)));return new Yr(i,this._parents,e,n)},selectAll:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=ne(t));for(var r=this._groups,a=r.length,i=[],o=[],l=0;l<a;++l)for(var s,u=r[l],c=u.length,h=0;h<c;++h)if(s=u[h]){for(var f,p=t.call(s,s.__data__,h,u),m=Er(s,n),g=0,d=p.length;g<d;++g)(f=p[g])&&$r(f,e,n,g,p,m);i.push(p),o.push(s)}return new Yr(i,o,e,n)},selectChild:Qr.selectChild,selectChildren:Qr.selectChildren,filter:function(t){"function"!=typeof t&&(t=re(t));for(var e=this._groups,n=e.length,r=new Array(n),a=0;a<n;++a)for(var i,o=e[a],l=o.length,s=r[a]=[],u=0;u<l;++u)(i=o[u])&&t.call(i,i.__data__,u,o)&&s.push(i);return new Yr(r,this._parents,this._name,this._id)},merge:function(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,r=e.length,a=n.length,i=Math.min(r,a),o=new Array(r),l=0;l<i;++l)for(var s,u=e[l],c=n[l],h=u.length,f=o[l]=new Array(h),p=0;p<h;++p)(s=u[p]||c[p])&&(f[p]=s);for(;l<r;++l)o[l]=e[l];return new Yr(o,this._parents,this._name,this._id)},selection:function(){return new Wr(this._groups,this._parents)},transition:function(){for(var t=this._name,e=this._id,n=Jr(),r=this._groups,a=r.length,i=0;i<a;++i)for(var o,l=r[i],s=l.length,u=0;u<s;++u)if(o=l[u]){var c=Er(o,e);$r(o,t,n,u,l,{time:c.time+c.delay+c.duration,delay:0,duration:c.duration,ease:c.ease})}return new Yr(r,this._parents,t,n)},call:Qr.call,nodes:Qr.nodes,node:Qr.node,size:Qr.size,empty:Qr.empty,each:Qr.each,on:function(t,e){var n=this._id;return arguments.length<2?Er(this.node(),n).on.on(t):this.each(function(t,e,n){var r,a,i=function(t){return(t+"").trim().split(/^|\s+/).every(function(t){var e=t.indexOf(".");return e>=0&&(t=t.slice(0,e)),!t||"start"===t})}(e)?Sr:Nr;return function(){var o=i(this,t),l=o.on;l!==r&&(a=(r=l).copy()).on(e,n),o.on=a}}(n,t,e))},attr:function(t,e){var n=Ut(t),r="transform"===n?sr:Dr;return this.attrTween(t,"function"==typeof e?(n.local?Kr:Lr)(n,r,Gr(this,"attr."+t,e)):null==e?(n.local?Pr:Or)(n):(n.local?Rr:Tr)(n,r,e))},attrTween:function(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==e)return this.tween(n,null);if("function"!=typeof e)throw new Error;var r=Ut(t);return this.tween(n,(r.local?qr:Ir)(r,e))},style:function(t,e,n){var r="transform"==(t+="")?lr:Dr;return null==e?this.styleTween(t,function(t,e){var n,r,a;return function(){var i=Ae(this,t),o=(this.style.removeProperty(t),Ae(this,t));return i===o?null:i===n&&o===r?a:a=e(n=i,r=o)}}(t,r)).on("end.style."+t,Ur(t)):"function"==typeof e?this.styleTween(t,function(t,e,n){var r,a,i;return function(){var o=Ae(this,t),l=n(this),s=l+"";return null==l&&(this.style.removeProperty(t),s=l=Ae(this,t)),o===s?null:o===r&&s===a?i:(a=s,i=e(r=o,l))}}(t,r,Gr(this,"style."+t,e))).each(function(t,e){var n,r,a,i,o="style."+e,l="end."+o;return function(