UNPKG

@mermaid-js/mermaid-mindmap

Version:

Mindmap diagram module for MermaidJS.

6 lines 515 kB
(function(qt,Ar){typeof exports=="object"&&typeof module<"u"?Ar(exports):typeof define=="function"&&define.amd?define(["exports"],Ar):(qt=typeof globalThis<"u"?globalThis:qt||self,Ar(qt["mermaid-mindmap-detector"]={}))})(this,function(qt){"use strict";const Ar="mindmap",Uf=t=>t.match(/^\s*mindmap/)!==null,Xf=async()=>{const{diagram:t}=await Promise.resolve().then(()=>fx);return{id:Ar,diagram:t}};var yi=function(){var t=function(b,p,m,y){for(m=m||{},y=b.length;y--;m[b[y]]=p);return m},e=[1,7],r=[1,9],n=[1,10],a=[1,14],i=[1,13],s=[1,19],o=[1,20],u=[6,9],l=[1,7,12,13,16,19],f=[1,28],c=[1,29],v=[1,6,7,9,12,13,16,19],h={trace:function(){},yy:{},symbols_:{error:2,start:3,MINDMAP:4,document:5,NL:6,SPACELIST:7,stop:8,EOF:9,statement:10,node:11,ICON:12,CLASS:13,nodeWithId:14,nodeWithoutId:15,NODE_DSTART:16,NODE_DESCR:17,NODE_DEND:18,NODE_ID:19,$accept:0,$end:1},terminals_:{2:"error",4:"MINDMAP",6:"NL",7:"SPACELIST",9:"EOF",12:"ICON",13:"CLASS",16:"NODE_DSTART",17:"NODE_DESCR",18:"NODE_DEND",19:"NODE_ID"},productions_:[0,[3,2],[3,3],[3,3],[8,1],[8,1],[8,2],[8,2],[5,3],[5,2],[10,2],[10,2],[10,2],[10,1],[10,1],[10,1],[10,1],[11,1],[11,1],[15,3],[14,1],[14,4]],performAction:function(p,m,y,E,C,D,w){var T=D.length-1;switch(C){case 1:case 2:case 3:return E;case 4:E.getLogger().trace("Stop NL ");break;case 5:E.getLogger().trace("Stop EOF ");break;case 6:E.getLogger().trace("Stop NL2 ");break;case 7:E.getLogger().trace("Stop EOF2 ");break;case 10:E.getLogger().trace("Node: ",D[T].id),E.addNode(D[T-1].length,D[T].id,D[T].descr,D[T].type);break;case 11:E.getLogger().trace("Icon: ",D[T]),E.decorateNode({icon:D[T]});break;case 12:case 15:E.decorateNode({class:D[T]});break;case 13:E.getLogger().trace("Node: ",D[T].id),E.addNode(0,D[T].id,D[T].descr,D[T].type);break;case 14:E.decorateNode({icon:D[T]});break;case 19:E.getLogger().trace("node found ..",D[T-2]),this.$={id:D[T-1],descr:D[T-1],type:E.getType(D[T-2],D[T])};break;case 20:this.$={id:D[T],descr:D[T],type:E.nodeType.DEFAULT};break;case 21:E.getLogger().trace("node found ..",D[T-3]),this.$={id:D[T-3],descr:D[T-1],type:E.getType(D[T-2],D[T])};break}},table:[{3:1,4:[1,2],7:[1,3]},{1:[3]},{5:4,6:[1,5],7:e,10:6,11:8,12:r,13:n,14:11,15:12,16:a,19:i},{4:[1,15]},{1:[2,1],7:e,10:16,11:8,12:r,13:n,14:11,15:12,16:a,19:i},{5:17,7:e,10:6,11:8,12:r,13:n,14:11,15:12,16:a,19:i},{6:s,8:18,9:o},t(u,[2,16],{14:11,15:12,11:21,12:[1,22],13:[1,23],16:a,19:i}),t(u,[2,13]),t(u,[2,14]),t(u,[2,15]),t(u,[2,17]),t(u,[2,18]),t(u,[2,20],{16:[1,24]}),{17:[1,25]},{5:26,7:e,10:6,11:8,12:r,13:n,14:11,15:12,16:a,19:i},{6:s,8:27,9:o},{1:[2,2],7:e,10:16,11:8,12:r,13:n,14:11,15:12,16:a,19:i},t(l,[2,9],{6:f,9:c}),t(v,[2,4]),t(v,[2,5]),t(u,[2,10]),t(u,[2,11]),t(u,[2,12]),{17:[1,30]},{18:[1,31]},{1:[2,3],7:e,10:16,11:8,12:r,13:n,14:11,15:12,16:a,19:i},t(l,[2,8],{6:f,9:c}),t(v,[2,6]),t(v,[2,7]),{18:[1,32]},t(u,[2,19]),t(u,[2,21])],defaultActions:{},parseError:function(p,m){if(m.recoverable)this.trace(p);else{var y=new Error(p);throw y.hash=m,y}},parse:function(p){var m=this,y=[0],E=[],C=[null],D=[],w=this.table,T="",x=0,S=0,L=2,A=1,O=D.slice.call(arguments,1),N=Object.create(this.lexer),R={yy:{}};for(var I in this.yy)Object.prototype.hasOwnProperty.call(this.yy,I)&&(R.yy[I]=this.yy[I]);N.setInput(p,R.yy),R.yy.lexer=N,R.yy.parser=this,typeof N.yylloc>"u"&&(N.yylloc={});var k=N.yylloc;D.push(k);var P=N.options&&N.options.ranges;typeof R.yy.parseError=="function"?this.parseError=R.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function B(){var Z;return Z=E.pop()||N.lex()||A,typeof Z!="number"&&(Z instanceof Array&&(E=Z,Z=E.pop()),Z=m.symbols_[Z]||Z),Z}for(var _,F,G,z,V={},U,Y,$,X;;){if(F=y[y.length-1],this.defaultActions[F]?G=this.defaultActions[F]:((_===null||typeof _>"u")&&(_=B()),G=w[F]&&w[F][_]),typeof G>"u"||!G.length||!G[0]){var K="";X=[];for(U in w[F])this.terminals_[U]&&U>L&&X.push("'"+this.terminals_[U]+"'");N.showPosition?K="Parse error on line "+(x+1)+`: `+N.showPosition()+` Expecting `+X.join(", ")+", got '"+(this.terminals_[_]||_)+"'":K="Parse error on line "+(x+1)+": Unexpected "+(_==A?"end of input":"'"+(this.terminals_[_]||_)+"'"),this.parseError(K,{text:N.match,token:this.terminals_[_]||_,line:N.yylineno,loc:k,expected:X})}if(G[0]instanceof Array&&G.length>1)throw new Error("Parse Error: multiple actions possible at state: "+F+", token: "+_);switch(G[0]){case 1:y.push(_),C.push(N.yytext),D.push(N.yylloc),y.push(G[1]),_=null,S=N.yyleng,T=N.yytext,x=N.yylineno,k=N.yylloc;break;case 2:if(Y=this.productions_[G[1]][1],V.$=C[C.length-Y],V._$={first_line:D[D.length-(Y||1)].first_line,last_line:D[D.length-1].last_line,first_column:D[D.length-(Y||1)].first_column,last_column:D[D.length-1].last_column},P&&(V._$.range=[D[D.length-(Y||1)].range[0],D[D.length-1].range[1]]),z=this.performAction.apply(V,[T,S,x,R.yy,G[1],C,D].concat(O)),typeof z<"u")return z;Y&&(y=y.slice(0,-1*Y*2),C=C.slice(0,-1*Y),D=D.slice(0,-1*Y)),y.push(this.productions_[G[1]][0]),C.push(V.$),D.push(V._$),$=w[y[y.length-2]][y[y.length-1]],y.push($);break;case 3:return!0}}return!0}},d=function(){var b={EOF:1,parseError:function(m,y){if(this.yy.parser)this.yy.parser.parseError(m,y);else throw new Error(m)},setInput:function(p,m){return this.yy=m||this.yy||{},this._input=p,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var p=this._input[0];this.yytext+=p,this.yyleng++,this.offset++,this.match+=p,this.matched+=p;var m=p.match(/(?:\r\n?|\n).*/g);return m?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),p},unput:function(p){var m=p.length,y=p.split(/(?:\r\n?|\n)/g);this._input=p+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-m),this.offset-=m;var E=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),y.length-1&&(this.yylineno-=y.length-1);var C=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:y?(y.length===E.length?this.yylloc.first_column:0)+E[E.length-y.length].length-y[0].length:this.yylloc.first_column-m},this.options.ranges&&(this.yylloc.range=[C[0],C[0]+this.yyleng-m]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},less:function(p){this.unput(this.match.slice(p))},pastInput:function(){var p=this.matched.substr(0,this.matched.length-this.match.length);return(p.length>20?"...":"")+p.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var p=this.match;return p.length<20&&(p+=this._input.substr(0,20-p.length)),(p.substr(0,20)+(p.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var p=this.pastInput(),m=new Array(p.length+1).join("-");return p+this.upcomingInput()+` `+m+"^"},test_match:function(p,m){var y,E,C;if(this.options.backtrack_lexer&&(C={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(C.yylloc.range=this.yylloc.range.slice(0))),E=p[0].match(/(?:\r\n?|\n).*/g),E&&(this.yylineno+=E.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:E?E[E.length-1].length-E[E.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+p[0].length},this.yytext+=p[0],this.match+=p[0],this.matches=p,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(p[0].length),this.matched+=p[0],y=this.performAction.call(this,this.yy,this,m,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),y)return y;if(this._backtrack){for(var D in C)this[D]=C[D];return!1}return!1},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var p,m,y,E;this._more||(this.yytext="",this.match="");for(var C=this._currentRules(),D=0;D<C.length;D++)if(y=this._input.match(this.rules[C[D]]),y&&(!m||y[0].length>m[0].length)){if(m=y,E=D,this.options.backtrack_lexer){if(p=this.test_match(y,C[D]),p!==!1)return p;if(this._backtrack){m=!1;continue}else return!1}else if(!this.options.flex)break}return m?(p=this.test_match(m,C[E]),p!==!1?p:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. `+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var m=this.next();return m||this.lex()},begin:function(m){this.conditionStack.push(m)},popState:function(){var m=this.conditionStack.length-1;return m>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(m){return m=this.conditionStack.length-1-Math.abs(m||0),m>=0?this.conditionStack[m]:"INITIAL"},pushState:function(m){this.begin(m)},stateStackSize:function(){return this.conditionStack.length},options:{"case-insensitive":!0},performAction:function(m,y,E,C){switch(E){case 0:m.getLogger().trace("Found comment",y.yytext);break;case 1:return 4;case 2:this.begin("CLASS");break;case 3:return this.popState(),13;case 4:this.popState();break;case 5:m.getLogger().trace("Begin icon"),this.begin("ICON");break;case 6:return 6;case 7:return 12;case 8:m.getLogger().trace("end icon"),this.popState();break;case 9:return m.getLogger().trace("Exploding node"),this.begin("NODE"),16;case 10:return m.getLogger().trace("Cloud"),this.begin("NODE"),16;case 11:return m.getLogger().trace("Explosion Bang"),this.begin("NODE"),16;case 12:return m.getLogger().trace("Cloud Bang"),this.begin("NODE"),16;case 13:return this.begin("NODE"),16;case 14:return this.begin("NODE"),16;case 15:return this.begin("NODE"),16;case 16:return 7;case 17:return 19;case 18:return 9;case 19:m.getLogger().trace("Starting NSTR"),this.begin("NSTR");break;case 20:return m.getLogger().trace("description:",y.yytext),"NODE_DESCR";case 21:this.popState();break;case 22:return this.popState(),m.getLogger().trace("node end ))"),"NODE_DEND";case 23:return this.popState(),m.getLogger().trace("node end )"),"NODE_DEND";case 24:return this.popState(),m.getLogger().trace("node end ...",y.yytext),"NODE_DEND";case 25:return this.popState(),m.getLogger().trace("node end (-"),"NODE_DEND";case 26:return this.popState(),m.getLogger().trace("node end (-"),"NODE_DEND";case 27:return this.popState(),m.getLogger().trace("node end (("),"NODE_DEND";case 28:return this.popState(),m.getLogger().trace("node end (("),"NODE_DEND";case 29:return m.getLogger().trace("Long description:",y.yytext),17;case 30:return m.getLogger().trace("Long description:",y.yytext),17}},rules:[/^(?:\s*%%.*)/i,/^(?:mindmap\b)/i,/^(?::::)/i,/^(?:.+)/i,/^(?:\n)/i,/^(?:::icon\()/i,/^(?:[\n]+)/i,/^(?:[^\)]+)/i,/^(?:\))/i,/^(?:-\))/i,/^(?:\(-)/i,/^(?:\)\))/i,/^(?:\))/i,/^(?:\(\()/i,/^(?:\()/i,/^(?:\[)/i,/^(?:[\s]+)/i,/^(?:[^\(\[\n\-\)]+)/i,/^(?:$)/i,/^(?:["])/i,/^(?:[^"]+)/i,/^(?:["])/i,/^(?:[\)]\))/i,/^(?:[\)])/i,/^(?:[\]])/i,/^(?:\(-)/i,/^(?:-\))/i,/^(?:\(\()/i,/^(?:\()/i,/^(?:[^\)\]\(]+)/i,/^(?:.+(?!\(\())/i],conditions:{CLASS:{rules:[3,4],inclusive:!1},ICON:{rules:[7,8],inclusive:!1},NSTR:{rules:[20,21],inclusive:!1},NODE:{rules:[19,22,23,24,25,26,27,28,29,30],inclusive:!1},INITIAL:{rules:[0,1,2,5,6,9,10,11,12,13,14,15,16,17,18],inclusive:!0}}};return b}();h.lexer=d;function g(){this.yy={}}return g.prototype=h,h.Parser=g,new g}();yi.parser=yi;const qf=yi,Nr=t=>{console.error("Log function was called before initialization",t)},vt={trace:Nr,debug:Nr,info:Nr,warn:Nr,error:Nr,fatal:Nr};let un,ln,Bs;const Wf=(t,e,r,n,a)=>{t.info("Mermaid utils injected"),vt.trace=t.trace,vt.debug=t.debug,vt.info=t.info,vt.warn=t.warn,vt.error=t.error,vt.fatal=t.fatal,un=r,ln=n,Bs=a};let yt=[],Fs=0,mi={};const Kf=()=>{yt=[],Fs=0,mi={}},Zf=function(t){for(let e=yt.length-1;e>=0;e--)if(yt[e].level<t)return yt[e];return null},Qf=()=>yt.length>0?yt[0]:null,Jf=(t,e,r,n)=>{vt.info("addNode",t,e,r,n);const a=un(),i={id:Fs++,nodeId:ln(e),level:t,descr:ln(r),type:n,children:[],width:un().mindmap.maxNodeWidth};switch(i.type){case Fe.ROUNDED_RECT:i.padding=2*a.mindmap.padding;break;case Fe.RECT:i.padding=2*a.mindmap.padding;break;default:i.padding=a.mindmap.padding}const s=Zf(t);if(s)s.children.push(i),yt.push(i);else if(yt.length===0)yt.push(i);else{let o=new Error('There can be only one root. No parent could be found for ("'+i.descr+'")');throw o.hash={text:"branch "+name,token:"branch "+name,line:"1",loc:{first_line:1,last_line:1,first_column:1,last_column:1},expected:['"checkout '+name+'"']},o}},Fe={DEFAULT:0,NO_BORDER:0,ROUNDED_RECT:1,RECT:2,CIRCLE:3,CLOUD:4,BANG:5},jf=(t,e)=>{switch(vt.debug("In get type",t,e),t){case"[":return Fe.RECT;case"(":return e===")"?Fe.ROUNDED_RECT:Fe.CLOUD;case"((":return Fe.CIRCLE;case")":return Fe.CLOUD;case"))":return Fe.BANG;default:return Fe.DEFAULT}},_s=(t,e)=>{mi[t]=e},ec=t=>{const e=yt[yt.length-1];t&&t.icon&&(e.icon=ln(t.icon)),t&&t.class&&(e.class=ln(t.class))},cr=t=>{switch(t){case Fe.DEFAULT:return"no-border";case Fe.RECT:return"rect";case Fe.ROUNDED_RECT:return"rounded-rect";case Fe.CIRCLE:return"circle";case Fe.CLOUD:return"cloud";case Fe.BANG:return"bang";default:return"no-border"}};let $s;const tc=t=>{$s=t},rc=()=>vt,nc=t=>yt[t],bi=t=>mi[t],ac=Object.freeze(Object.defineProperty({__proto__:null,clear:Kf,getMindmap:Qf,addNode:Jf,nodeType:Fe,getType:jf,setElementForId:_s,decorateNode:ec,type2Str:cr,get parseError(){return $s},setErrorHandler:tc,getLogger:rc,getNodeById:nc,getElementById:bi},Symbol.toStringTag,{value:"Module"}));var ic={value:()=>{}};function Gs(){for(var t=0,e=arguments.length,r={},n;t<e;++t){if(!(n=arguments[t]+"")||n in r||/[\s.]/.test(n))throw new Error("illegal type: "+n);r[n]=[]}return new ra(r)}function ra(t){this._=t}function sc(t,e){return t.trim().split(/^|\s+/).map(function(r){var n="",a=r.indexOf(".");if(a>=0&&(n=r.slice(a+1),r=r.slice(0,a)),r&&!e.hasOwnProperty(r))throw new Error("unknown type: "+r);return{type:r,name:n}})}ra.prototype=Gs.prototype={constructor:ra,on:function(t,e){var r=this._,n=sc(t+"",r),a,i=-1,s=n.length;if(arguments.length<2){for(;++i<s;)if((a=(t=n[i]).type)&&(a=oc(r[a],t.name)))return a;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++i<s;)if(a=(t=n[i]).type)r[a]=zs(r[a],t.name,e);else if(e==null)for(a in r)r[a]=zs(r[a],t.name,null);return this},copy:function(){var t={},e=this._;for(var r in e)t[r]=e[r].slice();return new ra(t)},call:function(t,e){if((a=arguments.length-2)>0)for(var r=new Array(a),n=0,a,i;n<a;++n)r[n]=arguments[n+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(i=this._[t],n=0,a=i.length;n<a;++n)i[n].value.apply(e,r)},apply:function(t,e,r){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var n=this._[t],a=0,i=n.length;a<i;++a)n[a].value.apply(e,r)}};function oc(t,e){for(var r=0,n=t.length,a;r<n;++r)if((a=t[r]).name===e)return a.value}function zs(t,e,r){for(var n=0,a=t.length;n<a;++n)if(t[n].name===e){t[n]=ic,t=t.slice(0,n).concat(t.slice(n+1));break}return r!=null&&t.push({name:e,value:r}),t}var wi="http://www.w3.org/1999/xhtml";const Hs={svg:"http://www.w3.org/2000/svg",xhtml:wi,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function na(t){var e=t+="",r=e.indexOf(":");return r>=0&&(e=t.slice(0,r))!=="xmlns"&&(t=t.slice(r+1)),Hs.hasOwnProperty(e)?{space:Hs[e],local:t}:t}function uc(t){return function(){var e=this.ownerDocument,r=this.namespaceURI;return r===wi&&e.documentElement.namespaceURI===wi?e.createElement(t):e.createElementNS(r,t)}}function lc(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function Vs(t){var e=na(t);return(e.local?lc:uc)(e)}function fc(){}function Ei(t){return t==null?fc:function(){return this.querySelector(t)}}function cc(t){typeof t!="function"&&(t=Ei(t));for(var e=this._groups,r=e.length,n=new Array(r),a=0;a<r;++a)for(var i=e[a],s=i.length,o=n[a]=new Array(s),u,l,f=0;f<s;++f)(u=i[f])&&(l=t.call(u,u.__data__,f,i))&&("__data__"in u&&(l.__data__=u.__data__),o[f]=l);return new dt(n,this._parents)}function hc(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function vc(){return[]}function Ys(t){return t==null?vc:function(){return this.querySelectorAll(t)}}function dc(t){return function(){return hc(t.apply(this,arguments))}}function gc(t){typeof t=="function"?t=dc(t):t=Ys(t);for(var e=this._groups,r=e.length,n=[],a=[],i=0;i<r;++i)for(var s=e[i],o=s.length,u,l=0;l<o;++l)(u=s[l])&&(n.push(t.call(u,u.__data__,l,s)),a.push(u));return new dt(n,a)}function Us(t){return function(){return this.matches(t)}}function Xs(t){return function(e){return e.matches(t)}}var pc=Array.prototype.find;function yc(t){return function(){return pc.call(this.children,t)}}function mc(){return this.firstElementChild}function bc(t){return this.select(t==null?mc:yc(typeof t=="function"?t:Xs(t)))}var wc=Array.prototype.filter;function Ec(){return Array.from(this.children)}function xc(t){return function(){return wc.call(this.children,t)}}function Tc(t){return this.selectAll(t==null?Ec:xc(typeof t=="function"?t:Xs(t)))}function Cc(t){typeof t!="function"&&(t=Us(t));for(var e=this._groups,r=e.length,n=new Array(r),a=0;a<r;++a)for(var i=e[a],s=i.length,o=n[a]=[],u,l=0;l<s;++l)(u=i[l])&&t.call(u,u.__data__,l,i)&&o.push(u);return new dt(n,this._parents)}function qs(t){return new Array(t.length)}function Dc(){return new dt(this._enter||this._groups.map(qs),this._parents)}function aa(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}aa.prototype={constructor:aa,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 Sc(t){return function(){return t}}function Lc(t,e,r,n,a,i){for(var s=0,o,u=e.length,l=i.length;s<l;++s)(o=e[s])?(o.__data__=i[s],n[s]=o):r[s]=new aa(t,i[s]);for(;s<u;++s)(o=e[s])&&(a[s]=o)}function Ac(t,e,r,n,a,i,s){var o,u,l=new Map,f=e.length,c=i.length,v=new Array(f),h;for(o=0;o<f;++o)(u=e[o])&&(v[o]=h=s.call(u,u.__data__,o,e)+"",l.has(h)?a[o]=u:l.set(h,u));for(o=0;o<c;++o)h=s.call(t,i[o],o,i)+"",(u=l.get(h))?(n[o]=u,u.__data__=i[o],l.delete(h)):r[o]=new aa(t,i[o]);for(o=0;o<f;++o)(u=e[o])&&l.get(v[o])===u&&(a[o]=u)}function Nc(t){return t.__data__}function Mc(t,e){if(!arguments.length)return Array.from(this,Nc);var r=e?Ac:Lc,n=this._parents,a=this._groups;typeof t!="function"&&(t=Sc(t));for(var i=a.length,s=new Array(i),o=new Array(i),u=new Array(i),l=0;l<i;++l){var f=n[l],c=a[l],v=c.length,h=Oc(t.call(f,f&&f.__data__,l,n)),d=h.length,g=o[l]=new Array(d),b=s[l]=new Array(d),p=u[l]=new Array(v);r(f,c,g,b,p,h,e);for(var m=0,y=0,E,C;m<d;++m)if(E=g[m]){for(m>=y&&(y=m+1);!(C=b[y])&&++y<d;);E._next=C||null}}return s=new dt(s,n),s._enter=o,s._exit=u,s}function Oc(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function Ic(){return new dt(this._exit||this._groups.map(qs),this._parents)}function kc(t,e,r){var n=this.enter(),a=this,i=this.exit();return typeof t=="function"?(n=t(n),n&&(n=n.selection())):n=n.append(t+""),e!=null&&(a=e(a),a&&(a=a.selection())),r==null?i.remove():r(i),n&&a?n.merge(a).order():a}function Rc(t){for(var e=t.selection?t.selection():t,r=this._groups,n=e._groups,a=r.length,i=n.length,s=Math.min(a,i),o=new Array(a),u=0;u<s;++u)for(var l=r[u],f=n[u],c=l.length,v=o[u]=new Array(c),h,d=0;d<c;++d)(h=l[d]||f[d])&&(v[d]=h);for(;u<a;++u)o[u]=r[u];return new dt(o,this._parents)}function Pc(){for(var t=this._groups,e=-1,r=t.length;++e<r;)for(var n=t[e],a=n.length-1,i=n[a],s;--a>=0;)(s=n[a])&&(i&&s.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(s,i),i=s);return this}function Bc(t){t||(t=Fc);function e(c,v){return c&&v?t(c.__data__,v.__data__):!c-!v}for(var r=this._groups,n=r.length,a=new Array(n),i=0;i<n;++i){for(var s=r[i],o=s.length,u=a[i]=new Array(o),l,f=0;f<o;++f)(l=s[f])&&(u[f]=l);u.sort(e)}return new dt(a,this._parents).order()}function Fc(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function _c(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function $c(){return Array.from(this)}function Gc(){for(var t=this._groups,e=0,r=t.length;e<r;++e)for(var n=t[e],a=0,i=n.length;a<i;++a){var s=n[a];if(s)return s}return null}function zc(){let t=0;for(const e of this)++t;return t}function Hc(){return!this.node()}function Vc(t){for(var e=this._groups,r=0,n=e.length;r<n;++r)for(var a=e[r],i=0,s=a.length,o;i<s;++i)(o=a[i])&&t.call(o,o.__data__,i,a);return this}function Yc(t){return function(){this.removeAttribute(t)}}function Uc(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Xc(t,e){return function(){this.setAttribute(t,e)}}function qc(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function Wc(t,e){return function(){var r=e.apply(this,arguments);r==null?this.removeAttribute(t):this.setAttribute(t,r)}}function Kc(t,e){return function(){var r=e.apply(this,arguments);r==null?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,r)}}function Zc(t,e){var r=na(t);if(arguments.length<2){var n=this.node();return r.local?n.getAttributeNS(r.space,r.local):n.getAttribute(r)}return this.each((e==null?r.local?Uc:Yc:typeof e=="function"?r.local?Kc:Wc:r.local?qc:Xc)(r,e))}function Ws(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function Qc(t){return function(){this.style.removeProperty(t)}}function Jc(t,e,r){return function(){this.style.setProperty(t,e,r)}}function jc(t,e,r){return function(){var n=e.apply(this,arguments);n==null?this.style.removeProperty(t):this.style.setProperty(t,n,r)}}function eh(t,e,r){return arguments.length>1?this.each((e==null?Qc:typeof e=="function"?jc:Jc)(t,e,r==null?"":r)):Mr(this.node(),t)}function Mr(t,e){return t.style.getPropertyValue(e)||Ws(t).getComputedStyle(t,null).getPropertyValue(e)}function th(t){return function(){delete this[t]}}function rh(t,e){return function(){this[t]=e}}function nh(t,e){return function(){var r=e.apply(this,arguments);r==null?delete this[t]:this[t]=r}}function ah(t,e){return arguments.length>1?this.each((e==null?th:typeof e=="function"?nh:rh)(t,e)):this.node()[t]}function Ks(t){return t.trim().split(/^|\s+/)}function xi(t){return t.classList||new Zs(t)}function Zs(t){this._node=t,this._names=Ks(t.getAttribute("class")||"")}Zs.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 Qs(t,e){for(var r=xi(t),n=-1,a=e.length;++n<a;)r.add(e[n])}function Js(t,e){for(var r=xi(t),n=-1,a=e.length;++n<a;)r.remove(e[n])}function ih(t){return function(){Qs(this,t)}}function sh(t){return function(){Js(this,t)}}function oh(t,e){return function(){(e.apply(this,arguments)?Qs:Js)(this,t)}}function uh(t,e){var r=Ks(t+"");if(arguments.length<2){for(var n=xi(this.node()),a=-1,i=r.length;++a<i;)if(!n.contains(r[a]))return!1;return!0}return this.each((typeof e=="function"?oh:e?ih:sh)(r,e))}function lh(){this.textContent=""}function fh(t){return function(){this.textContent=t}}function ch(t){return function(){var e=t.apply(this,arguments);this.textContent=e==null?"":e}}function hh(t){return arguments.length?this.each(t==null?lh:(typeof t=="function"?ch:fh)(t)):this.node().textContent}function vh(){this.innerHTML=""}function dh(t){return function(){this.innerHTML=t}}function gh(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e==null?"":e}}function ph(t){return arguments.length?this.each(t==null?vh:(typeof t=="function"?gh:dh)(t)):this.node().innerHTML}function yh(){this.nextSibling&&this.parentNode.appendChild(this)}function mh(){return this.each(yh)}function bh(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function wh(){return this.each(bh)}function Eh(t){var e=typeof t=="function"?t:Vs(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function xh(){return null}function Th(t,e){var r=typeof t=="function"?t:Vs(t),n=e==null?xh:typeof e=="function"?e:Ei(e);return this.select(function(){return this.insertBefore(r.apply(this,arguments),n.apply(this,arguments)||null)})}function Ch(){var t=this.parentNode;t&&t.removeChild(this)}function Dh(){return this.each(Ch)}function Sh(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Lh(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Ah(t){return this.select(t?Lh:Sh)}function Nh(t){return arguments.length?this.property("__data__",t):this.node().__data__}function Mh(t){return function(e){t.call(this,e,this.__data__)}}function Oh(t){return t.trim().split(/^|\s+/).map(function(e){var r="",n=e.indexOf(".");return n>=0&&(r=e.slice(n+1),e=e.slice(0,n)),{type:e,name:r}})}function Ih(t){return function(){var e=this.__on;if(!!e){for(var r=0,n=-1,a=e.length,i;r<a;++r)i=e[r],(!t.type||i.type===t.type)&&i.name===t.name?this.removeEventListener(i.type,i.listener,i.options):e[++n]=i;++n?e.length=n:delete this.__on}}}function kh(t,e,r){return function(){var n=this.__on,a,i=Mh(e);if(n){for(var s=0,o=n.length;s<o;++s)if((a=n[s]).type===t.type&&a.name===t.name){this.removeEventListener(a.type,a.listener,a.options),this.addEventListener(a.type,a.listener=i,a.options=r),a.value=e;return}}this.addEventListener(t.type,i,r),a={type:t.type,name:t.name,value:e,listener:i,options:r},n?n.push(a):this.__on=[a]}}function Rh(t,e,r){var n=Oh(t+""),a,i=n.length,s;if(arguments.length<2){var o=this.node().__on;if(o){for(var u=0,l=o.length,f;u<l;++u)for(a=0,f=o[u];a<i;++a)if((s=n[a]).type===f.type&&s.name===f.name)return f.value}return}for(o=e?kh:Ih,a=0;a<i;++a)this.each(o(n[a],e,r));return this}function js(t,e,r){var n=Ws(t),a=n.CustomEvent;typeof a=="function"?a=new a(e,r):(a=n.document.createEvent("Event"),r?(a.initEvent(e,r.bubbles,r.cancelable),a.detail=r.detail):a.initEvent(e,!1,!1)),t.dispatchEvent(a)}function Ph(t,e){return function(){return js(this,t,e)}}function Bh(t,e){return function(){return js(this,t,e.apply(this,arguments))}}function Fh(t,e){return this.each((typeof e=="function"?Bh:Ph)(t,e))}function*_h(){for(var t=this._groups,e=0,r=t.length;e<r;++e)for(var n=t[e],a=0,i=n.length,s;a<i;++a)(s=n[a])&&(yield s)}var eo=[null];function dt(t,e){this._groups=t,this._parents=e}function fn(){return new dt([[document.documentElement]],eo)}function $h(){return this}dt.prototype=fn.prototype={constructor:dt,select:cc,selectAll:gc,selectChild:bc,selectChildren:Tc,filter:Cc,data:Mc,enter:Dc,exit:Ic,join:kc,merge:Rc,selection:$h,order:Pc,sort:Bc,call:_c,nodes:$c,node:Gc,size:zc,empty:Hc,each:Vc,attr:Zc,style:eh,property:ah,classed:uh,text:hh,html:ph,raise:mh,lower:wh,append:Eh,insert:Th,remove:Dh,clone:Ah,datum:Nh,on:Rh,dispatch:Fh,[Symbol.iterator]:_h};function cn(t){return typeof t=="string"?new dt([[document.querySelector(t)]],[document.documentElement]):new dt([[t]],eo)}function Ti(t,e,r){t.prototype=e.prototype=r,r.constructor=t}function to(t,e){var r=Object.create(t.prototype);for(var n in e)r[n]=e[n];return r}function hn(){}var vn=.7,ia=1/vn,Or="\\s*([+-]?\\d+)\\s*",dn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Mt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Gh=/^#([0-9a-f]{3,8})$/,zh=new RegExp(`^rgb\\(${Or},${Or},${Or}\\)$`),Hh=new RegExp(`^rgb\\(${Mt},${Mt},${Mt}\\)$`),Vh=new RegExp(`^rgba\\(${Or},${Or},${Or},${dn}\\)$`),Yh=new RegExp(`^rgba\\(${Mt},${Mt},${Mt},${dn}\\)$`),Uh=new RegExp(`^hsl\\(${dn},${Mt},${Mt}\\)$`),Xh=new RegExp(`^hsla\\(${dn},${Mt},${Mt},${dn}\\)$`),ro={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};Ti(hn,gn,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:no,formatHex:no,formatHex8:qh,formatHsl:Wh,formatRgb:ao,toString:ao});function no(){return this.rgb().formatHex()}function qh(){return this.rgb().formatHex8()}function Wh(){return lo(this).formatHsl()}function ao(){return this.rgb().formatRgb()}function gn(t){var e,r;return t=(t+"").trim().toLowerCase(),(e=Gh.exec(t))?(r=e[1].length,e=parseInt(e[1],16),r===6?io(e):r===3?new ut(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):r===8?sa(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):r===4?sa(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=zh.exec(t))?new ut(e[1],e[2],e[3],1):(e=Hh.exec(t))?new ut(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=Vh.exec(t))?sa(e[1],e[2],e[3],e[4]):(e=Yh.exec(t))?sa(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=Uh.exec(t))?uo(e[1],e[2]/100,e[3]/100,1):(e=Xh.exec(t))?uo(e[1],e[2]/100,e[3]/100,e[4]):ro.hasOwnProperty(t)?io(ro[t]):t==="transparent"?new ut(NaN,NaN,NaN,0):null}function io(t){return new ut(t>>16&255,t>>8&255,t&255,1)}function sa(t,e,r,n){return n<=0&&(t=e=r=NaN),new ut(t,e,r,n)}function Kh(t){return t instanceof hn||(t=gn(t)),t?(t=t.rgb(),new ut(t.r,t.g,t.b,t.opacity)):new ut}function Ci(t,e,r,n){return arguments.length===1?Kh(t):new ut(t,e,r,n==null?1:n)}function ut(t,e,r,n){this.r=+t,this.g=+e,this.b=+r,this.opacity=+n}Ti(ut,Ci,to(hn,{brighter(t){return t=t==null?ia:Math.pow(ia,t),new ut(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?vn:Math.pow(vn,t),new ut(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new ut(hr(this.r),hr(this.g),hr(this.b),oa(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:so,formatHex:so,formatHex8:Zh,formatRgb:oo,toString:oo}));function so(){return`#${vr(this.r)}${vr(this.g)}${vr(this.b)}`}function Zh(){return`#${vr(this.r)}${vr(this.g)}${vr(this.b)}${vr((isNaN(this.opacity)?1:this.opacity)*255)}`}function oo(){const t=oa(this.opacity);return`${t===1?"rgb(":"rgba("}${hr(this.r)}, ${hr(this.g)}, ${hr(this.b)}${t===1?")":`, ${t})`}`}function oa(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function hr(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function vr(t){return t=hr(t),(t<16?"0":"")+t.toString(16)}function uo(t,e,r,n){return n<=0?t=e=r=NaN:r<=0||r>=1?t=e=NaN:e<=0&&(t=NaN),new Et(t,e,r,n)}function lo(t){if(t instanceof Et)return new Et(t.h,t.s,t.l,t.opacity);if(t instanceof hn||(t=gn(t)),!t)return new Et;if(t instanceof Et)return t;t=t.rgb();var e=t.r/255,r=t.g/255,n=t.b/255,a=Math.min(e,r,n),i=Math.max(e,r,n),s=NaN,o=i-a,u=(i+a)/2;return o?(e===i?s=(r-n)/o+(r<n)*6:r===i?s=(n-e)/o+2:s=(e-r)/o+4,o/=u<.5?i+a:2-i-a,s*=60):o=u>0&&u<1?0:s,new Et(s,o,u,t.opacity)}function Qh(t,e,r,n){return arguments.length===1?lo(t):new Et(t,e,r,n==null?1:n)}function Et(t,e,r,n){this.h=+t,this.s=+e,this.l=+r,this.opacity=+n}Ti(Et,Qh,to(hn,{brighter(t){return t=t==null?ia:Math.pow(ia,t),new Et(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?vn:Math.pow(vn,t),new Et(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*e,a=2*r-n;return new ut(Di(t>=240?t-240:t+120,a,n),Di(t,a,n),Di(t<120?t+240:t-120,a,n),this.opacity)},clamp(){return new Et(fo(this.h),ua(this.s),ua(this.l),oa(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=oa(this.opacity);return`${t===1?"hsl(":"hsla("}${fo(this.h)}, ${ua(this.s)*100}%, ${ua(this.l)*100}%${t===1?")":`, ${t})`}`}}));function fo(t){return t=(t||0)%360,t<0?t+360:t}function ua(t){return Math.max(0,Math.min(1,t||0))}function Di(t,e,r){return(t<60?e+(r-e)*t/60:t<180?r:t<240?e+(r-e)*(240-t)/60:e)*255}const co=t=>()=>t;function Jh(t,e){return function(r){return t+r*e}}function jh(t,e,r){return t=Math.pow(t,r),e=Math.pow(e,r)-t,r=1/r,function(n){return Math.pow(t+n*e,r)}}function ev(t){return(t=+t)==1?ho:function(e,r){return r-e?jh(e,r,t):co(isNaN(e)?r:e)}}function ho(t,e){var r=e-t;return r?Jh(t,r):co(isNaN(t)?e:t)}const vo=function t(e){var r=ev(e);function n(a,i){var s=r((a=Ci(a)).r,(i=Ci(i)).r),o=r(a.g,i.g),u=r(a.b,i.b),l=ho(a.opacity,i.opacity);return function(f){return a.r=s(f),a.g=o(f),a.b=u(f),a.opacity=l(f),a+""}}return n.gamma=t,n}(1);function Wt(t,e){return t=+t,e=+e,function(r){return t*(1-r)+e*r}}var Si=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Li=new RegExp(Si.source,"g");function tv(t){return function(){return t}}function rv(t){return function(e){return t(e)+""}}function nv(t,e){var r=Si.lastIndex=Li.lastIndex=0,n,a,i,s=-1,o=[],u=[];for(t=t+"",e=e+"";(n=Si.exec(t))&&(a=Li.exec(e));)(i=a.index)>r&&(i=e.slice(r,i),o[s]?o[s]+=i:o[++s]=i),(n=n[0])===(a=a[0])?o[s]?o[s]+=a:o[++s]=a:(o[++s]=null,u.push({i:s,x:Wt(n,a)})),r=Li.lastIndex;return r<e.length&&(i=e.slice(r),o[s]?o[s]+=i:o[++s]=i),o.length<2?u[0]?rv(u[0].x):tv(e):(e=u.length,function(l){for(var f=0,c;f<e;++f)o[(c=u[f]).i]=c.x(l);return o.join("")})}var go=180/Math.PI,Ai={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function po(t,e,r,n,a,i){var s,o,u;return(s=Math.sqrt(t*t+e*e))&&(t/=s,e/=s),(u=t*r+e*n)&&(r-=t*u,n-=e*u),(o=Math.sqrt(r*r+n*n))&&(r/=o,n/=o,u/=o),t*n<e*r&&(t=-t,e=-e,u=-u,s=-s),{translateX:a,translateY:i,rotate:Math.atan2(e,t)*go,skewX:Math.atan(u)*go,scaleX:s,scaleY:o}}var la;function av(t){const e=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?Ai:po(e.a,e.b,e.c,e.d,e.e,e.f)}function iv(t){return t==null||(la||(la=document.createElementNS("http://www.w3.org/2000/svg","g")),la.setAttribute("transform",t),!(t=la.transform.baseVal.consolidate()))?Ai:(t=t.matrix,po(t.a,t.b,t.c,t.d,t.e,t.f))}function yo(t,e,r,n){function a(l){return l.length?l.pop()+" ":""}function i(l,f,c,v,h,d){if(l!==c||f!==v){var g=h.push("translate(",null,e,null,r);d.push({i:g-4,x:Wt(l,c)},{i:g-2,x:Wt(f,v)})}else(c||v)&&h.push("translate("+c+e+v+r)}function s(l,f,c,v){l!==f?(l-f>180?f+=360:f-l>180&&(l+=360),v.push({i:c.push(a(c)+"rotate(",null,n)-2,x:Wt(l,f)})):f&&c.push(a(c)+"rotate("+f+n)}function o(l,f,c,v){l!==f?v.push({i:c.push(a(c)+"skewX(",null,n)-2,x:Wt(l,f)}):f&&c.push(a(c)+"skewX("+f+n)}function u(l,f,c,v,h,d){if(l!==c||f!==v){var g=h.push(a(h)+"scale(",null,",",null,")");d.push({i:g-4,x:Wt(l,c)},{i:g-2,x:Wt(f,v)})}else(c!==1||v!==1)&&h.push(a(h)+"scale("+c+","+v+")")}return function(l,f){var c=[],v=[];return l=t(l),f=t(f),i(l.translateX,l.translateY,f.translateX,f.translateY,c,v),s(l.rotate,f.rotate,c,v),o(l.skewX,f.skewX,c,v),u(l.scaleX,l.scaleY,f.scaleX,f.scaleY,c,v),l=f=null,function(h){for(var d=-1,g=v.length,b;++d<g;)c[(b=v[d]).i]=b.x(h);return c.join("")}}}var sv=yo(av,"px, ","px)","deg)"),ov=yo(iv,", ",")",")"),Ir=0,pn=0,yn=0,mo=1e3,fa,mn,ca=0,dr=0,ha=0,bn=typeof performance=="object"&&performance.now?performance:Date,bo=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Ni(){return dr||(bo(uv),dr=bn.now()+ha)}function uv(){dr=0}function va(){this._call=this._time=this._next=null}va.prototype=wo.prototype={constructor:va,restart:function(t,e,r){if(typeof t!="function")throw new TypeError("callback is not a function");r=(r==null?Ni():+r)+(e==null?0:+e),!this._next&&mn!==this&&(mn?mn._next=this:fa=this,mn=this),this._call=t,this._time=r,Mi()},stop:function(){this._call&&(this._call=null,this._time=1/0,Mi())}};function wo(t,e,r){var n=new va;return n.restart(t,e,r),n}function lv(){Ni(),++Ir;for(var t=fa,e;t;)(e=dr-t._time)>=0&&t._call.call(void 0,e),t=t._next;--Ir}function Eo(){dr=(ca=bn.now())+ha,Ir=pn=0;try{lv()}finally{Ir=0,cv(),dr=0}}function fv(){var t=bn.now(),e=t-ca;e>mo&&(ha-=e,ca=t)}function cv(){for(var t,e=fa,r,n=1/0;e;)e._call?(n>e._time&&(n=e._time),t=e,e=e._next):(r=e._next,e._next=null,e=t?t._next=r:fa=r);mn=t,Mi(n)}function Mi(t){if(!Ir){pn&&(pn=clearTimeout(pn));var e=t-dr;e>24?(t<1/0&&(pn=setTimeout(Eo,t-bn.now()-ha)),yn&&(yn=clearInterval(yn))):(yn||(ca=bn.now(),yn=setInterval(fv,mo)),Ir=1,bo(Eo))}}function xo(t,e,r){var n=new va;return e=e==null?0:+e,n.restart(a=>{n.stop(),t(a+e)},e,r),n}var hv=Gs("start","end","cancel","interrupt"),vv=[],To=0,Co=1,Oi=2,da=3,Do=4,Ii=5,ga=6;function pa(t,e,r,n,a,i){var s=t.__transition;if(!s)t.__transition={};else if(r in s)return;dv(t,r,{name:e,index:n,group:a,on:hv,tween:vv,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:To})}function ki(t,e){var r=xt(t,e);if(r.state>To)throw new Error("too late; already scheduled");return r}function Ot(t,e){var r=xt(t,e);if(r.state>da)throw new Error("too late; already running");return r}function xt(t,e){var r=t.__transition;if(!r||!(r=r[e]))throw new Error("transition not found");return r}function dv(t,e,r){var n=t.__transition,a;n[e]=r,r.timer=wo(i,0,r.time);function i(l){r.state=Co,r.timer.restart(s,r.delay,r.time),r.delay<=l&&s(l-r.delay)}function s(l){var f,c,v,h;if(r.state!==Co)return u();for(f in n)if(h=n[f],h.name===r.name){if(h.state===da)return xo(s);h.state===Do?(h.state=ga,h.timer.stop(),h.on.call("interrupt",t,t.__data__,h.index,h.group),delete n[f]):+f<e&&(h.state=ga,h.timer.stop(),h.on.call("cancel",t,t.__data__,h.index,h.group),delete n[f])}if(xo(function(){r.state===da&&(r.state=Do,r.timer.restart(o,r.delay,r.time),o(l))}),r.state=Oi,r.on.call("start",t,t.__data__,r.index,r.group),r.state===Oi){for(r.state=da,a=new Array(v=r.tween.length),f=0,c=-1;f<v;++f)(h=r.tween[f].value.call(t,t.__data__,r.index,r.group))&&(a[++c]=h);a.length=c+1}}function o(l){for(var f=l<r.duration?r.ease.call(null,l/r.duration):(r.timer.restart(u),r.state=Ii,1),c=-1,v=a.length;++c<v;)a[c].call(t,f);r.state===Ii&&(r.on.call("end",t,t.__data__,r.index,r.group),u())}function u(){r.state=ga,r.timer.stop(),delete n[e];for(var l in n)return;delete t.__transition}}function gv(t,e){var r=t.__transition,n,a,i=!0,s;if(!!r){e=e==null?null:e+"";for(s in r){if((n=r[s]).name!==e){i=!1;continue}a=n.state>Oi&&n.state<Ii,n.state=ga,n.timer.stop(),n.on.call(a?"interrupt":"cancel",t,t.__data__,n.index,n.group),delete r[s]}i&&delete t.__transition}}function pv(t){return this.each(function(){gv(this,t)})}function yv(t,e){var r,n;return function(){var a=Ot(this,t),i=a.tween;if(i!==r){n=r=i;for(var s=0,o=n.length;s<o;++s)if(n[s].name===e){n=n.slice(),n.splice(s,1);break}}a.tween=n}}function mv(t,e,r){var n,a;if(typeof r!="function")throw new Error;return function(){var i=Ot(this,t),s=i.tween;if(s!==n){a=(n=s).slice();for(var o={name:e,value:r},u=0,l=a.length;u<l;++u)if(a[u].name===e){a[u]=o;break}u===l&&a.push(o)}i.tween=a}}function bv(t,e){var r=this._id;if(t+="",arguments.length<2){for(var n=xt(this.node(),r).tween,a=0,i=n.length,s;a<i;++a)if((s=n[a]).name===t)return s.value;return null}return this.each((e==null?yv:mv)(r,t,e))}function Ri(t,e,r){var n=t._id;return t.each(function(){var a=Ot(this,n);(a.value||(a.value={}))[e]=r.apply(this,arguments)}),function(a){return xt(a,n).value[e]}}function So(t,e){var r;return(typeof e=="number"?Wt:e instanceof gn?vo:(r=gn(e))?(e=r,vo):nv)(t,e)}function wv(t){return function(){this.removeAttribute(t)}}function Ev(t){return function(){this.removeAttributeNS(t.space,t.local)}}function xv(t,e,r){var n,a=r+"",i;return function(){var s=this.getAttribute(t);return s===a?null:s===n?i:i=e(n=s,r)}}function Tv(t,e,r){var n,a=r+"",i;return function(){var s=this.getAttributeNS(t.space,t.local);return s===a?null:s===n?i:i=e(n=s,r)}}function Cv(t,e,r){var n,a,i;return function(){var s,o=r(this),u;return o==null?void this.removeAttribute(t):(s=this.getAttribute(t),u=o+"",s===u?null:s===n&&u===a?i:(a=u,i=e(n=s,o)))}}function Dv(t,e,r){var n,a,i;return function(){var s,o=r(this),u;return o==null?void this.removeAttributeNS(t.space,t.local):(s=this.getAttributeNS(t.space,t.local),u=o+"",s===u?null:s===n&&u===a?i:(a=u,i=e(n=s,o)))}}function Sv(t,e){var r=na(t),n=r==="transform"?ov:So;return this.attrTween(t,typeof e=="function"?(r.local?Dv:Cv)(r,n,Ri(this,"attr."+t,e)):e==null?(r.local?Ev:wv)(r):(r.local?Tv:xv)(r,n,e))}function Lv(t,e){return function(r){this.setAttribute(t,e.call(this,r))}}function Av(t,e){return function(r){this.setAttributeNS(t.space,t.local,e.call(this,r))}}function Nv(t,e){var r,n;function a(){var i=e.apply(this,arguments);return i!==n&&(r=(n=i)&&Av(t,i)),r}return a._value=e,a}function Mv(t,e){var r,n;function a(){var i=e.apply(this,arguments);return i!==n&&(r=(n=i)&&Lv(t,i)),r}return a._value=e,a}function Ov(t,e){var r="attr."+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;var n=na(t);return this.tween(r,(n.local?Nv:Mv)(n,e))}function Iv(t,e){return function(){ki(this,t).delay=+e.apply(this,arguments)}}function kv(t,e){return e=+e,function(){ki(this,t).delay=e}}function Rv(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?Iv:kv)(e,t)):xt(this.node(),e).delay}function Pv(t,e){return function(){Ot(this,t).duration=+e.apply(this,arguments)}}function Bv(t,e){return e=+e,function(){Ot(this,t).duration=e}}function Fv(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?Pv:Bv)(e,t)):xt(this.node(),e).duration}function _v(t,e){if(typeof e!="function")throw new Error;return function(){Ot(this,t).ease=e}}function $v(t){var e=this._id;return arguments.length?this.each(_v(e,t)):xt(this.node(),e).ease}function Gv(t,e){return function(){var r=e.apply(this,arguments);if(typeof r!="function")throw new Error;Ot(this,t).ease=r}}function zv(t){if(typeof t!="function")throw new Error;return this.each(Gv(this._id,t))}function Hv(t){typeof t!="function"&&(t=Us(t));for(var e=this._groups,r=e.length,n=new Array(r),a=0;a<r;++a)for(var i=e[a],s=i.length,o=n[a]=[],u,l=0;l<s;++l)(u=i[l])&&t.call(u,u.__data__,l,i)&&o.push(u);return new _t(n,this._parents,this._name,this._id)}function Vv(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,r=t._groups,n=e.length,a=r.length,i=Math.min(n,a),s=new Array(n),o=0;o<i;++o)for(var u=e[o],l=r[o],f=u.length,c=s[o]=new Array(f),v,h=0;h<f;++h)(v=u[h]||l[h])&&(c[h]=v);for(;o<n;++o)s[o]=e[o];return new _t(s,this._parents,this._name,this._id)}function Yv(t){return(t+"").trim().split(/^|\s+/).every(function(e){var r=e.indexOf(".");return r>=0&&(e=e.slice(0,r)),!e||e==="start"})}function Uv(t,e,r){var n,a,i=Yv(e)?ki:Ot;return function(){var s=i(this,t),o=s.on;o!==n&&(a=(n=o).copy()).on(e,r),s.on=a}}function Xv(t,e){var r=this._id;return arguments.length<2?xt(this.node(),r).on.on(t):this.each(Uv(r,t,e))}function qv(t){return function(){var e=this.parentNode;for(var r in this.__transition)if(+r!==t)return;e&&e.removeChild(this)}}function Wv(){return this.on("end.remove",qv(this._id))}function Kv(t){var e=this._name,r=this._id;typeof t!="function"&&(t=Ei(t));for(var n=this._groups,a=n.length,i=new Array(a),s=0;s<a;++s)for(var o=n[s],u=o.length,l=i[s]=new Array(u),f,c,v=0;v<u;++v)(f=o[v])&&(c=t.call(f,f.__data__,v,o))&&("__data__"in f&&(c.__data__=f.__data__),l[v]=c,pa(l[v],e,r,v,l,xt(f,r)));return new _t(i,this._parents,e,r)}function Zv(t){var e=this._name,r=this._id;typeof t!="function"&&(t=Ys(t));for(var n=this._groups,a=n.length,i=[],s=[],o=0;o<a;++o)for(var u=n[o],l=u.length,f,c=0;c<l;++c)if(f=u[c]){for(var v=t.call(f,f.__data__,c,u),h,d=xt(f,r),g=0,b=v.length;g<b;++g)(h=v[g])&&pa(h,e,r,g,v,d);i.push(v),s.push(f)}return new _t(i,s,e,r)}var Qv=fn.prototype.constructor;function Jv(){return new Qv(this._groups,this._parents)}function jv(t,e){var r,n,a;return function(){var i=Mr(this,t),s=(this.style.removeProperty(t),Mr(this,t));return i===s?null:i===r&&s===n?a:a=e(r=i,n=s)}}function Lo(t){return function(){this.style.removeProperty(t)}}function ed(t,e,r){var n,a=r+"",i;return function(){var s=Mr(this,t);return s===a?null:s===n?i:i=e(n=s,r)}}function td(t,e,r){var n,a,i;return function(){var s=Mr(this,t),o=r(this),u=o+"";return o==null&&(u=o=(this.style.removeProperty(t),Mr(this,t))),s===u?null:s===n&&u===a?i:(a=u,i=e(n=s,o))}}function rd(t,e){var r,n,a,i="style."+e,s="end."+i,o;return function(){var u=Ot(this,t),l=u.on,f=u.value[i]==null?o||(o=Lo(e)):void 0;(l!==r||a!==f)&&(n=(r=l).copy()).on(s,a=f),u.on=n}}function nd(t,e,r){var n=(t+="")=="transform"?sv:So;return e==null?this.styleTween(t,jv(t,n)).on("end.style."+t,Lo(t)):typeof e=="function"?this.styleTween(t,td(t,n,Ri(this,"style."+t,e))).each(rd(this._id,t)):this.styleTween(t,ed(t,n,e),r).on("end.style."+t,null)}function ad(t,e,r){return function(n){this.style.setProperty(t,e.call(this,n),r)}}function id(t,e,r){var n,a;function i(){var s=e.apply(this,arguments);return s!==a&&(n=(a=s)&&ad(t,s,r)),n}return i._value=e,i}function sd(t,e,r){var n="style."+(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;return this.tween(n,id(t,e,r==null?"":r))}function od(t){return function(){this.textContent=t}}function ud(t){return function(){var e=t(this);this.textContent=e==null?"":e}}function ld(t){return this.tween("text",typeof t=="function"?ud(Ri(this,"text",t)):od(t==null?"":t+""))}function fd(t){return function(e){this.textContent=t.call(this,e)}}function cd(t){var e,r;function n(){var a=t.apply(this,arguments);return a!==r&&(e=(r=a)&&fd(a)),e}return n._value=t,n}function hd(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,cd(t))}function vd(){for(var t=this._name,e=this._id,r=Ao(),n=this._groups,a=n.length,i=0;i<a;++i)for(var s=n[i],o=s.length,u,l=0;l<o;++l)if(u=s[l]){var f=xt(u,e);pa(u,t,r,l,s,{time:f.time+f.delay+f.duration,delay:0,duration:f.duration,ease:f.ease})}return new _t(n,this._parents,t,r)}function dd(){var t,e,r=this,n=r._id,a=r.size();return new Promise(function(i,s){var o={value:s},u={value:function(){--a===0&&i()}};r.each(function(){var l=Ot(this,n),f=l.on;f!==t&&(e=(t=f).copy(),e._.cancel.push(o),e._.interrupt.push(o),e._.end.push(u)),l.on=e}),a===0&&i()})}var gd=0;function _t(t,e,r,n){this._groups=t,this._parent