How do I have so many partners??
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add main node option and improve simulation

aria 0fdcb823 998f4aef

+178 -24
+8
README.md
··· 30 30 | `-n, --name <prefix>` | input filename | Output filename prefix | 31 31 | `--width <px>` | `1400` | PNG output width in pixels | 32 32 | `--title <title>` | `Polycule Map` | HTML page title | 33 + | `--legend` | off | Render relationship legend on SVG/PNG exports | 34 + | `--no-labels` | on | Hide edge label text on SVG/PNG exports | 35 + | `--no-names` | on | Hide node name labels on SVG/PNG exports | 33 36 34 37 ### Examples 35 38 ··· 50 53 settings: 51 54 theme: dark # dark | light 52 55 nodeScale: uniform # uniform | connections (scales node size by number of relationships) 56 + mainNode: alice # optional — this person is placed at the centre of the graph 53 57 54 58 people: 55 59 - id: alice # unique identifier used in relationships ··· 74 78 75 79 | Type | Line style | 76 80 |---|---| 81 + | `primary_partner` | Solid thick, gold | 77 82 | `partner` | Solid, pink | 78 83 | `nesting_partner` | Double line, red | 79 84 | `anchor_partner` | Dashed thick, dark red | ··· 83 88 | `comet` | Long dash, grey | 84 89 | `friend` | Solid thin, light blue | 85 90 | `metamour` | Faint dotted, dark grey | 91 + | `tbd` | Dash-dot, grey | 86 92 87 93 ## Embedding in a website 88 94 ··· 108 114 - **Click** a node to open an info panel with name, pronouns, and links 109 115 - **☀ Light / ☾ Dark** button — toggle theme 110 116 - **Legend** button — show/hide relationship type key 117 + - **Labels On/Off** button — toggle edge label text 118 + - **Names On/Off** button — toggle node name labels 111 119 - **⊡ Fit** button — fit the whole graph into view 112 120 113 121 ## Development
+18 -6
src/client/graph.ts
··· 156 156 connectionCounts.set(r.to, (connectionCounts.get(r.to) ?? 0) + 1); 157 157 }); 158 158 159 + const mainNodeId = data.settings.mainNode; 159 160 const nodeCount = data.people.length; 160 - const nodes: NodeDatum[] = data.people.map((p, i) => { 161 - const angle = (i / nodeCount) * 2 * Math.PI; 162 - const r = 220; 161 + const nonMainCount = mainNodeId ? data.people.filter(p => p.id !== mainNodeId).length : nodeCount; 162 + let nonMainIdx = 0; 163 + const nodes: NodeDatum[] = data.people.map(p => { 164 + if (p.id === mainNodeId) { 165 + return { 166 + ...p, 167 + x: 480, y: 360, 168 + vx: 0, vy: 0, 169 + fx: 480, fy: 360, // pinned at center initially 170 + connectionCount: connectionCounts.get(p.id) ?? 0, 171 + }; 172 + } 173 + const angle = (nonMainIdx++ / Math.max(nonMainCount, 1)) * 2 * Math.PI; 163 174 return { 164 175 ...p, 165 - x: 480 + Math.cos(angle) * r, 166 - y: 360 + Math.sin(angle) * r, 176 + x: 480 + Math.cos(angle) * 220, 177 + y: 360 + Math.sin(angle) * 220, 167 178 vx: 0, vy: 0, fx: null, fy: null, 168 179 connectionCount: connectionCounts.get(p.id) ?? 0, 169 180 }; ··· 408 419 409 420 // ── Drag ───────────────────────────────────────────────────────────────── 410 421 411 - let pinnedNode: NodeDatum | null = null; 422 + // If a main node is configured, start with it pinned at center 423 + let pinnedNode: NodeDatum | null = mainNodeId ? (nodeById.get(mainNodeId) ?? null) : null; 412 424 413 425 const dragBehavior = d3drag<SVGGElement, NodeDatum>() 414 426 .on('start', (event, d) => {
+1 -1
src/generated/client-bundle.ts
··· 1 1 // AUTO-GENERATED — do not edit manually. 2 2 // Regenerate with: npm run build:client 3 - export const CLIENT_BUNDLE = "\"use strict\";var _PM=(()=>{var ue=Object.defineProperty,Li=Object.defineProperties,Pi=Object.getOwnPropertyDescriptor,Gi=Object.getOwnPropertyDescriptors,Vi=Object.getOwnPropertyNames,yn=Object.getOwnPropertySymbols;var wn=Object.prototype.hasOwnProperty,Fi=Object.prototype.propertyIsEnumerable;var vn=(t,e,n)=>e in t?ue(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,_n=(t,e)=>{for(var n in e||(e={}))wn.call(e,n)&&vn(t,n,e[n]);if(yn)for(var n of yn(e))Fi.call(e,n)&&vn(t,n,e[n]);return t},bn=(t,e)=>Li(t,Gi(e));var Hi=(t,e)=>{for(var n in e)ue(t,n,{get:e[n],enumerable:!0})},Xi=(t,e,n,r)=>{if(e&&typeof e==\"object\"||typeof e==\"function\")for(let i of Vi(e))!wn.call(t,i)&&i!==n&&ue(t,i,{get:()=>e[i],enumerable:!(r=Pi(e,i))||r.enumerable});return t};var Yi=t=>Xi(ue({},\"__esModule\",{value:!0}),t);var gs={};Hi(gs,{init:()=>Di});function Le(t,e){var n,r=1;t==null&&(t=0),e==null&&(e=0);function i(){var o,a=n.length,s,u=0,l=0;for(o=0;o<a;++o)s=n[o],u+=s.x,l+=s.y;for(u=(u/a-t)*r,l=(l/a-e)*r,o=0;o<a;++o)s=n[o],s.x-=u,s.y-=l}return i.initialize=function(o){n=o},i.x=function(o){return arguments.length?(t=+o,i):t},i.y=function(o){return arguments.length?(e=+o,i):e},i.strength=function(o){return arguments.length?(r=+o,i):r},i}function Nn(t){let e=+this._x.call(null,t),n=+this._y.call(null,t);return kn(this.cover(e,n),e,n,t)}function kn(t,e,n,r){if(isNaN(e)||isNaN(n))return t;var i,o=t._root,a={data:r},s=t._x0,u=t._y0,l=t._x1,f=t._y1,x,p,h,_,g,y,d,b;if(!o)return t._root=a,t;for(;o.length;)if((g=e>=(x=(s+l)/2))?s=x:l=x,(y=n>=(p=(u+f)/2))?u=p:f=p,i=o,!(o=o[d=y<<1|g]))return i[d]=a,t;if(h=+t._x.call(null,o.data),_=+t._y.call(null,o.data),e===h&&n===_)return a.next=o,i?i[d]=a:t._root=a,t;do i=i?i[d]=new Array(4):t._root=new Array(4),(g=e>=(x=(s+l)/2))?s=x:l=x,(y=n>=(p=(u+f)/2))?u=p:f=p;while((d=y<<1|g)===(b=(_>=p)<<1|h>=x));return i[b]=o,i[d]=a,t}function En(t){var e,n,r=t.length,i,o,a=new Array(r),s=new Array(r),u=1/0,l=1/0,f=-1/0,x=-1/0;for(n=0;n<r;++n)isNaN(i=+this._x.call(null,e=t[n]))||isNaN(o=+this._y.call(null,e))||(a[n]=i,s[n]=o,i<u&&(u=i),i>f&&(f=i),o<l&&(l=o),o>x&&(x=o));if(u>f||l>x)return this;for(this.cover(u,l).cover(f,x),n=0;n<r;++n)kn(this,a[n],s[n],t[n]);return this}function An(t,e){if(isNaN(t=+t)||isNaN(e=+e))return this;var n=this._x0,r=this._y0,i=this._x1,o=this._y1;if(isNaN(n))i=(n=Math.floor(t))+1,o=(r=Math.floor(e))+1;else{for(var a=i-n||1,s=this._root,u,l;n>t||t>=i||r>e||e>=o;)switch(l=(e<r)<<1|t<n,u=new Array(4),u[l]=s,s=u,a*=2,l){case 0:i=n+a,o=r+a;break;case 1:n=i-a,o=r+a;break;case 2:i=n+a,r=o-a;break;case 3:n=i-a,r=o-a;break}this._root&&this._root.length&&(this._root=s)}return this._x0=n,this._y0=r,this._x1=i,this._y1=o,this}function Mn(){var t=[];return this.visit(function(e){if(!e.length)do t.push(e.data);while(e=e.next)}),t}function Sn(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function K(t,e,n,r,i){this.node=t,this.x0=e,this.y0=n,this.x1=r,this.y1=i}function Tn(t,e,n){var r,i=this._x0,o=this._y0,a,s,u,l,f=this._x1,x=this._y1,p=[],h=this._root,_,g;for(h&&p.push(new K(h,i,o,f,x)),n==null?n=1/0:(i=t-n,o=e-n,f=t+n,x=e+n,n*=n);_=p.pop();)if(!(!(h=_.node)||(a=_.x0)>f||(s=_.y0)>x||(u=_.x1)<i||(l=_.y1)<o))if(h.length){var y=(a+u)/2,d=(s+l)/2;p.push(new K(h[3],y,d,u,l),new K(h[2],a,d,y,l),new K(h[1],y,s,u,d),new K(h[0],a,s,y,d)),(g=(e>=d)<<1|t>=y)&&(_=p[p.length-1],p[p.length-1]=p[p.length-1-g],p[p.length-1-g]=_)}else{var b=t-+this._x.call(null,h.data),A=e-+this._y.call(null,h.data),m=b*b+A*A;if(m<n){var E=Math.sqrt(n=m);i=t-E,o=e-E,f=t+E,x=e+E,r=h.data}}return r}function Cn(t){if(isNaN(f=+this._x.call(null,t))||isNaN(x=+this._y.call(null,t)))return this;var e,n=this._root,r,i,o,a=this._x0,s=this._y0,u=this._x1,l=this._y1,f,x,p,h,_,g,y,d;if(!n)return this;if(n.length)for(;;){if((_=f>=(p=(a+u)/2))?a=p:u=p,(g=x>=(h=(s+l)/2))?s=h:l=h,e=n,!(n=n[y=g<<1|_]))return this;if(!n.length)break;(e[y+1&3]||e[y+2&3]||e[y+3&3])&&(r=e,d=y)}for(;n.data!==t;)if(i=n,!(n=n.next))return this;return(o=n.next)&&delete n.next,i?(o?i.next=o:delete i.next,this):e?(o?e[y]=o:delete e[y],(n=e[0]||e[1]||e[2]||e[3])&&n===(e[3]||e[2]||e[1]||e[0])&&!n.length&&(r?r[d]=n:this._root=n),this):(this._root=o,this)}function In(t){for(var e=0,n=t.length;e<n;++e)this.remove(t[e]);return this}function zn(){return this._root}function $n(){var t=0;return this.visit(function(e){if(!e.length)do++t;while(e=e.next)}),t}function On(t){var e=[],n,r=this._root,i,o,a,s,u;for(r&&e.push(new K(r,this._x0,this._y0,this._x1,this._y1));n=e.pop();)if(!t(r=n.node,o=n.x0,a=n.y0,s=n.x1,u=n.y1)&&r.length){var l=(o+s)/2,f=(a+u)/2;(i=r[3])&&e.push(new K(i,l,f,s,u)),(i=r[2])&&e.push(new K(i,o,f,l,u)),(i=r[1])&&e.push(new K(i,l,a,s,f)),(i=r[0])&&e.push(new K(i,o,a,l,f))}return this}function Dn(t){var e=[],n=[],r;for(this._root&&e.push(new K(this._root,this._x0,this._y0,this._x1,this._y1));r=e.pop();){var i=r.node;if(i.length){var o,a=r.x0,s=r.y0,u=r.x1,l=r.y1,f=(a+u)/2,x=(s+l)/2;(o=i[0])&&e.push(new K(o,a,s,f,x)),(o=i[1])&&e.push(new K(o,f,s,u,x)),(o=i[2])&&e.push(new K(o,a,x,f,l)),(o=i[3])&&e.push(new K(o,f,x,u,l))}n.push(r)}for(;r=n.pop();)t(r.node,r.x0,r.y0,r.x1,r.y1);return this}function Bn(t){return t[0]}function Rn(t){return arguments.length?(this._x=t,this):this._x}function Ln(t){return t[1]}function Pn(t){return arguments.length?(this._y=t,this):this._y}function At(t,e,n){var r=new Pe(e==null?Bn:e,n==null?Ln:n,NaN,NaN,NaN,NaN);return t==null?r:r.addAll(t)}function Pe(t,e,n,r,i,o){this._x=t,this._y=e,this._x0=n,this._y0=r,this._x1=i,this._y1=o,this._root=void 0}function Gn(t){for(var e={data:t.data},n=e;t=t.next;)n=n.next={data:t.data};return e}var et=At.prototype=Pe.prototype;et.copy=function(){var t=new Pe(this._x,this._y,this._x0,this._y0,this._x1,this._y1),e=this._root,n,r;if(!e)return t;if(!e.length)return t._root=Gn(e),t;for(n=[{source:e,target:t._root=new Array(4)}];e=n.pop();)for(var i=0;i<4;++i)(r=e.source[i])&&(r.length?n.push({source:r,target:e.target[i]=new Array(4)}):e.target[i]=Gn(r));return t};et.add=Nn;et.addAll=En;et.cover=An;et.data=Mn;et.extent=Sn;et.find=Tn;et.remove=Cn;et.removeAll=In;et.root=zn;et.size=$n;et.visit=On;et.visitAfter=Dn;et.x=Rn;et.y=Pn;function ct(t){return function(){return t}}function lt(t){return(t()-.5)*1e-6}function qi(t){return t.x+t.vx}function Ui(t){return t.y+t.vy}function Ge(t){var e,n,r,i=1,o=1;typeof t!=\"function\"&&(t=ct(t==null?1:+t));function a(){for(var l,f=e.length,x,p,h,_,g,y,d=0;d<o;++d)for(x=At(e,qi,Ui).visitAfter(s),l=0;l<f;++l)p=e[l],g=n[p.index],y=g*g,h=p.x+p.vx,_=p.y+p.vy,x.visit(b);function b(A,m,E,T,I){var $=A.data,L=A.r,O=g+L;if($){if($.index>p.index){var F=h-$.x-$.vx,rt=_-$.y-$.vy,Z=F*F+rt*rt;Z<O*O&&(F===0&&(F=lt(r),Z+=F*F),rt===0&&(rt=lt(r),Z+=rt*rt),Z=(O-(Z=Math.sqrt(Z)))/Z*i,p.vx+=(F*=Z)*(O=(L*=L)/(y+L)),p.vy+=(rt*=Z)*O,$.vx-=F*(O=1-O),$.vy-=rt*O)}return}return m>h+O||T<h-O||E>_+O||I<_-O}}function s(l){if(l.data)return l.r=n[l.data.index];for(var f=l.r=0;f<4;++f)l[f]&&l[f].r>l.r&&(l.r=l[f].r)}function u(){if(e){var l,f=e.length,x;for(n=new Array(f),l=0;l<f;++l)x=e[l],n[x.index]=+t(x,l,e)}}return a.initialize=function(l,f){e=l,r=f,u()},a.iterations=function(l){return arguments.length?(o=+l,a):o},a.strength=function(l){return arguments.length?(i=+l,a):i},a.radius=function(l){return arguments.length?(t=typeof l==\"function\"?l:ct(+l),u(),a):t},a}function Qi(t){return t.index}function Vn(t,e){var n=t.get(e);if(!n)throw new Error(\"node not found: \"+e);return n}function Ve(t){var e=Qi,n=x,r,i=ct(30),o,a,s,u,l,f=1;t==null&&(t=[]);function x(y){return 1/Math.min(s[y.source.index],s[y.target.index])}function p(y){for(var d=0,b=t.length;d<f;++d)for(var A=0,m,E,T,I,$,L,O;A<b;++A)m=t[A],E=m.source,T=m.target,I=T.x+T.vx-E.x-E.vx||lt(l),$=T.y+T.vy-E.y-E.vy||lt(l),L=Math.sqrt(I*I+$*$),L=(L-o[A])/L*y*r[A],I*=L,$*=L,T.vx-=I*(O=u[A]),T.vy-=$*O,E.vx+=I*(O=1-O),E.vy+=$*O}function h(){if(a){var y,d=a.length,b=t.length,A=new Map(a.map((E,T)=>[e(E,T,a),E])),m;for(y=0,s=new Array(d);y<b;++y)m=t[y],m.index=y,typeof m.source!=\"object\"&&(m.source=Vn(A,m.source)),typeof m.target!=\"object\"&&(m.target=Vn(A,m.target)),s[m.source.index]=(s[m.source.index]||0)+1,s[m.target.index]=(s[m.target.index]||0)+1;for(y=0,u=new Array(b);y<b;++y)m=t[y],u[y]=s[m.source.index]/(s[m.source.index]+s[m.target.index]);r=new Array(b),_(),o=new Array(b),g()}}function _(){if(a)for(var y=0,d=t.length;y<d;++y)r[y]=+n(t[y],y,t)}function g(){if(a)for(var y=0,d=t.length;y<d;++y)o[y]=+i(t[y],y,t)}return p.initialize=function(y,d){a=y,l=d,h()},p.links=function(y){return arguments.length?(t=y,h(),p):t},p.id=function(y){return arguments.length?(e=y,p):e},p.iterations=function(y){return arguments.length?(f=+y,p):f},p.strength=function(y){return arguments.length?(n=typeof y==\"function\"?y:ct(+y),_(),p):n},p.distance=function(y){return arguments.length?(i=typeof y==\"function\"?y:ct(+y),g(),p):i},p}var Ki={value:()=>{}};function Hn(){for(var t=0,e=arguments.length,n={},r;t<e;++t){if(!(r=arguments[t]+\"\")||r in n||/[\\s.]/.test(r))throw new Error(\"illegal type: \"+r);n[r]=[]}return new fe(n)}function fe(t){this._=t}function Zi(t,e){return t.trim().split(/^|\\s+/).map(function(n){var r=\"\",i=n.indexOf(\".\");if(i>=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!e.hasOwnProperty(n))throw new Error(\"unknown type: \"+n);return{type:n,name:r}})}fe.prototype=Hn.prototype={constructor:fe,on:function(t,e){var n=this._,r=Zi(t+\"\",n),i,o=-1,a=r.length;if(arguments.length<2){for(;++o<a;)if((i=(t=r[o]).type)&&(i=Wi(n[i],t.name)))return i;return}if(e!=null&&typeof e!=\"function\")throw new Error(\"invalid callback: \"+e);for(;++o<a;)if(i=(t=r[o]).type)n[i]=Fn(n[i],t.name,e);else if(e==null)for(i in n)n[i]=Fn(n[i],t.name,null);return this},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new fe(t)},call:function(t,e){if((i=arguments.length-2)>0)for(var n=new Array(i),r=0,i,o;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(t))throw new Error(\"unknown type: \"+t);for(o=this._[t],r=0,i=o.length;r<i;++r)o[r].value.apply(e,n)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error(\"unknown type: \"+t);for(var r=this._[t],i=0,o=r.length;i<o;++i)r[i].value.apply(e,n)}};function Wi(t,e){for(var n=0,r=t.length,i;n<r;++n)if((i=t[n]).name===e)return i.value}function Fn(t,e,n){for(var r=0,i=t.length;r<i;++r)if(t[r].name===e){t[r]=Ki,t=t.slice(0,r).concat(t.slice(r+1));break}return n!=null&&t.push({name:e,value:n}),t}var dt=Hn;var Bt=0,Ht=0,Ft=0,Yn=1e3,ce,Xt,pe=0,Mt=0,he=0,Yt=typeof performance==\"object\"&&performance.now?performance:Date,qn=typeof window==\"object\"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Ut(){return Mt||(qn(Ji),Mt=Yt.now()+he)}function Ji(){Mt=0}function qt(){this._call=this._time=this._next=null}qt.prototype=Rt.prototype={constructor:qt,restart:function(t,e,n){if(typeof t!=\"function\")throw new TypeError(\"callback is not a function\");n=(n==null?Ut():+n)+(e==null?0:+e),!this._next&&Xt!==this&&(Xt?Xt._next=this:ce=this,Xt=this),this._call=t,this._time=n,Fe()},stop:function(){this._call&&(this._call=null,this._time=1/0,Fe())}};function Rt(t,e,n){var r=new qt;return r.restart(t,e,n),r}function Un(){Ut(),++Bt;for(var t=ce,e;t;)(e=Mt-t._time)>=0&&t._call.call(void 0,e),t=t._next;--Bt}function Xn(){Mt=(pe=Yt.now())+he,Bt=Ht=0;try{Un()}finally{Bt=0,to(),Mt=0}}function ji(){var t=Yt.now(),e=t-pe;e>Yn&&(he-=e,pe=t)}function to(){for(var t,e=ce,n,r=1/0;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:ce=n);Xt=t,Fe(r)}function Fe(t){if(!Bt){Ht&&(Ht=clearTimeout(Ht));var e=t-Mt;e>24?(t<1/0&&(Ht=setTimeout(Xn,t-Yt.now()-he)),Ft&&(Ft=clearInterval(Ft))):(Ft||(pe=Yt.now(),Ft=setInterval(ji,Yn)),Bt=1,qn(Xn))}}function me(t,e,n){var r=new qt;return e=e==null?0:+e,r.restart(i=>{r.stop(),t(i+e)},e,n),r}function Qn(){let t=1;return()=>(t=(1664525*t+1013904223)%4294967296)/4294967296}function Kn(t){return t.x}function Zn(t){return t.y}var eo=10,no=Math.PI*(3-Math.sqrt(5));function He(t){var e,n=1,r=.001,i=1-Math.pow(r,1/300),o=0,a=.6,s=new Map,u=Rt(x),l=dt(\"tick\",\"end\"),f=Qn();t==null&&(t=[]);function x(){p(),l.call(\"tick\",e),n<r&&(u.stop(),l.call(\"end\",e))}function p(g){var y,d=t.length,b;g===void 0&&(g=1);for(var A=0;A<g;++A)for(n+=(o-n)*i,s.forEach(function(m){m(n)}),y=0;y<d;++y)b=t[y],b.fx==null?b.x+=b.vx*=a:(b.x=b.fx,b.vx=0),b.fy==null?b.y+=b.vy*=a:(b.y=b.fy,b.vy=0);return e}function h(){for(var g=0,y=t.length,d;g<y;++g){if(d=t[g],d.index=g,d.fx!=null&&(d.x=d.fx),d.fy!=null&&(d.y=d.fy),isNaN(d.x)||isNaN(d.y)){var b=eo*Math.sqrt(.5+g),A=g*no;d.x=b*Math.cos(A),d.y=b*Math.sin(A)}(isNaN(d.vx)||isNaN(d.vy))&&(d.vx=d.vy=0)}}function _(g){return g.initialize&&g.initialize(t,f),g}return h(),e={tick:p,restart:function(){return u.restart(x),e},stop:function(){return u.stop(),e},nodes:function(g){return arguments.length?(t=g,h(),s.forEach(_),e):t},alpha:function(g){return arguments.length?(n=+g,e):n},alphaMin:function(g){return arguments.length?(r=+g,e):r},alphaDecay:function(g){return arguments.length?(i=+g,e):+i},alphaTarget:function(g){return arguments.length?(o=+g,e):o},velocityDecay:function(g){return arguments.length?(a=1-g,e):1-a},randomSource:function(g){return arguments.length?(f=g,s.forEach(_),e):f},force:function(g,y){return arguments.length>1?(y==null?s.delete(g):s.set(g,_(y)),e):s.get(g)},find:function(g,y,d){var b=0,A=t.length,m,E,T,I,$;for(d==null?d=1/0:d*=d,b=0;b<A;++b)I=t[b],m=g-I.x,E=y-I.y,T=m*m+E*E,T<d&&($=I,d=T);return $},on:function(g,y){return arguments.length>1?(l.on(g,y),e):l.on(g)}}}function Xe(){var t,e,n,r,i=ct(-30),o,a=1,s=1/0,u=.81;function l(h){var _,g=t.length,y=At(t,Kn,Zn).visitAfter(x);for(r=h,_=0;_<g;++_)e=t[_],y.visit(p)}function f(){if(t){var h,_=t.length,g;for(o=new Array(_),h=0;h<_;++h)g=t[h],o[g.index]=+i(g,h,t)}}function x(h){var _=0,g,y,d=0,b,A,m;if(h.length){for(b=A=m=0;m<4;++m)(g=h[m])&&(y=Math.abs(g.value))&&(_+=g.value,d+=y,b+=y*g.x,A+=y*g.y);h.x=b/d,h.y=A/d}else{g=h,g.x=g.data.x,g.y=g.data.y;do _+=o[g.data.index];while(g=g.next)}h.value=_}function p(h,_,g,y){if(!h.value)return!0;var d=h.x-e.x,b=h.y-e.y,A=y-_,m=d*d+b*b;if(A*A/u<m)return m<s&&(d===0&&(d=lt(n),m+=d*d),b===0&&(b=lt(n),m+=b*b),m<a&&(m=Math.sqrt(a*m)),e.vx+=d*h.value*r/m,e.vy+=b*h.value*r/m),!0;if(h.length||m>=s)return;(h.data!==e||h.next)&&(d===0&&(d=lt(n),m+=d*d),b===0&&(b=lt(n),m+=b*b),m<a&&(m=Math.sqrt(a*m)));do h.data!==e&&(A=o[h.data.index]*r/m,e.vx+=d*A,e.vy+=b*A);while(h=h.next)}return l.initialize=function(h,_){t=h,n=_,f()},l.strength=function(h){return arguments.length?(i=typeof h==\"function\"?h:ct(+h),f(),l):i},l.distanceMin=function(h){return arguments.length?(a=h*h,l):Math.sqrt(a)},l.distanceMax=function(h){return arguments.length?(s=h*h,l):Math.sqrt(s)},l.theta=function(h){return arguments.length?(u=h*h,l):Math.sqrt(u)},l}var de=\"http://www.w3.org/1999/xhtml\",Ye={svg:\"http://www.w3.org/2000/svg\",xhtml:de,xlink:\"http://www.w3.org/1999/xlink\",xml:\"http://www.w3.org/XML/1998/namespace\",xmlns:\"http://www.w3.org/2000/xmlns/\"};function gt(t){var e=t+=\"\",n=e.indexOf(\":\");return n>=0&&(e=t.slice(0,n))!==\"xmlns\"&&(t=t.slice(n+1)),Ye.hasOwnProperty(e)?{space:Ye[e],local:t}:t}function ro(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===de&&e.documentElement.namespaceURI===de?e.createElement(t):e.createElementNS(n,t)}}function io(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function ge(t){var e=gt(t);return(e.local?io:ro)(e)}function oo(){}function St(t){return t==null?oo:function(){return this.querySelector(t)}}function Wn(t){typeof t!=\"function\"&&(t=St(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var o=e[i],a=o.length,s=r[i]=new Array(a),u,l,f=0;f<a;++f)(u=o[f])&&(l=t.call(u,u.__data__,f,o))&&(\"__data__\"in u&&(l.__data__=u.__data__),s[f]=l);return new H(r,this._parents)}function qe(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function ao(){return[]}function Qt(t){return t==null?ao:function(){return this.querySelectorAll(t)}}function so(t){return function(){return qe(t.apply(this,arguments))}}function Jn(t){typeof t==\"function\"?t=so(t):t=Qt(t);for(var e=this._groups,n=e.length,r=[],i=[],o=0;o<n;++o)for(var a=e[o],s=a.length,u,l=0;l<s;++l)(u=a[l])&&(r.push(t.call(u,u.__data__,l,a)),i.push(u));return new H(r,i)}function Kt(t){return function(){return this.matches(t)}}function xe(t){return function(e){return e.matches(t)}}var lo=Array.prototype.find;function uo(t){return function(){return lo.call(this.children,t)}}function fo(){return this.firstElementChild}function jn(t){return this.select(t==null?fo:uo(typeof t==\"function\"?t:xe(t)))}var co=Array.prototype.filter;function po(){return Array.from(this.children)}function ho(t){return function(){return co.call(this.children,t)}}function tr(t){return this.selectAll(t==null?po:ho(typeof t==\"function\"?t:xe(t)))}function er(t){typeof t!=\"function\"&&(t=Kt(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var o=e[i],a=o.length,s=r[i]=[],u,l=0;l<a;++l)(u=o[l])&&t.call(u,u.__data__,l,o)&&s.push(u);return new H(r,this._parents)}function ye(t){return new Array(t.length)}function nr(){return new H(this._enter||this._groups.map(ye),this._parents)}function Zt(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}Zt.prototype={constructor:Zt,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 rr(t){return function(){return t}}function mo(t,e,n,r,i,o){for(var a=0,s,u=e.length,l=o.length;a<l;++a)(s=e[a])?(s.__data__=o[a],r[a]=s):n[a]=new Zt(t,o[a]);for(;a<u;++a)(s=e[a])&&(i[a]=s)}function go(t,e,n,r,i,o,a){var s,u,l=new Map,f=e.length,x=o.length,p=new Array(f),h;for(s=0;s<f;++s)(u=e[s])&&(p[s]=h=a.call(u,u.__data__,s,e)+\"\",l.has(h)?i[s]=u:l.set(h,u));for(s=0;s<x;++s)h=a.call(t,o[s],s,o)+\"\",(u=l.get(h))?(r[s]=u,u.__data__=o[s],l.delete(h)):n[s]=new Zt(t,o[s]);for(s=0;s<f;++s)(u=e[s])&&l.get(p[s])===u&&(i[s]=u)}function xo(t){return t.__data__}function ir(t,e){if(!arguments.length)return Array.from(this,xo);var n=e?go:mo,r=this._parents,i=this._groups;typeof t!=\"function\"&&(t=rr(t));for(var o=i.length,a=new Array(o),s=new Array(o),u=new Array(o),l=0;l<o;++l){var f=r[l],x=i[l],p=x.length,h=yo(t.call(f,f&&f.__data__,l,r)),_=h.length,g=s[l]=new Array(_),y=a[l]=new Array(_),d=u[l]=new Array(p);n(f,x,g,y,d,h,e);for(var b=0,A=0,m,E;b<_;++b)if(m=g[b]){for(b>=A&&(A=b+1);!(E=y[A])&&++A<_;);m._next=E||null}}return a=new H(a,r),a._enter=s,a._exit=u,a}function yo(t){return typeof t==\"object\"&&\"length\"in t?t:Array.from(t)}function or(){return new H(this._exit||this._groups.map(ye),this._parents)}function ar(t,e,n){var r=this.enter(),i=this,o=this.exit();return typeof t==\"function\"?(r=t(r),r&&(r=r.selection())):r=r.append(t+\"\"),e!=null&&(i=e(i),i&&(i=i.selection())),n==null?o.remove():n(o),r&&i?r.merge(i).order():i}function sr(t){for(var e=t.selection?t.selection():t,n=this._groups,r=e._groups,i=n.length,o=r.length,a=Math.min(i,o),s=new Array(i),u=0;u<a;++u)for(var l=n[u],f=r[u],x=l.length,p=s[u]=new Array(x),h,_=0;_<x;++_)(h=l[_]||f[_])&&(p[_]=h);for(;u<i;++u)s[u]=n[u];return new H(s,this._parents)}function lr(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var r=t[e],i=r.length-1,o=r[i],a;--i>=0;)(a=r[i])&&(o&&a.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(a,o),o=a);return this}function ur(t){t||(t=vo);function e(x,p){return x&&p?t(x.__data__,p.__data__):!x-!p}for(var n=this._groups,r=n.length,i=new Array(r),o=0;o<r;++o){for(var a=n[o],s=a.length,u=i[o]=new Array(s),l,f=0;f<s;++f)(l=a[f])&&(u[f]=l);u.sort(e)}return new H(i,this._parents).order()}function vo(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function fr(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function cr(){return Array.from(this)}function pr(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],i=0,o=r.length;i<o;++i){var a=r[i];if(a)return a}return null}function hr(){let t=0;for(let e of this)++t;return t}function mr(){return!this.node()}function dr(t){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var i=e[n],o=0,a=i.length,s;o<a;++o)(s=i[o])&&t.call(s,s.__data__,o,i);return this}function wo(t){return function(){this.removeAttribute(t)}}function _o(t){return function(){this.removeAttributeNS(t.space,t.local)}}function bo(t,e){return function(){this.setAttribute(t,e)}}function No(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function ko(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttribute(t):this.setAttribute(t,n)}}function Eo(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function gr(t,e){var n=gt(t);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((e==null?n.local?_o:wo:typeof e==\"function\"?n.local?Eo:ko:n.local?No:bo)(n,e))}function ve(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function Ao(t){return function(){this.style.removeProperty(t)}}function Mo(t,e,n){return function(){this.style.setProperty(t,e,n)}}function So(t,e,n){return function(){var r=e.apply(this,arguments);r==null?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function xr(t,e,n){return arguments.length>1?this.each((e==null?Ao:typeof e==\"function\"?So:Mo)(t,e,n==null?\"\":n)):vt(this.node(),t)}function vt(t,e){return t.style.getPropertyValue(e)||ve(t).getComputedStyle(t,null).getPropertyValue(e)}function To(t){return function(){delete this[t]}}function Co(t,e){return function(){this[t]=e}}function Io(t,e){return function(){var n=e.apply(this,arguments);n==null?delete this[t]:this[t]=n}}function yr(t,e){return arguments.length>1?this.each((e==null?To:typeof e==\"function\"?Io:Co)(t,e)):this.node()[t]}function vr(t){return t.trim().split(/^|\\s+/)}function Ue(t){return t.classList||new wr(t)}function wr(t){this._node=t,this._names=vr(t.getAttribute(\"class\")||\"\")}wr.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 _r(t,e){for(var n=Ue(t),r=-1,i=e.length;++r<i;)n.add(e[r])}function br(t,e){for(var n=Ue(t),r=-1,i=e.length;++r<i;)n.remove(e[r])}function zo(t){return function(){_r(this,t)}}function $o(t){return function(){br(this,t)}}function Oo(t,e){return function(){(e.apply(this,arguments)?_r:br)(this,t)}}function Nr(t,e){var n=vr(t+\"\");if(arguments.length<2){for(var r=Ue(this.node()),i=-1,o=n.length;++i<o;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof e==\"function\"?Oo:e?zo:$o)(n,e))}function Do(){this.textContent=\"\"}function Bo(t){return function(){this.textContent=t}}function Ro(t){return function(){var e=t.apply(this,arguments);this.textContent=e==null?\"\":e}}function kr(t){return arguments.length?this.each(t==null?Do:(typeof t==\"function\"?Ro:Bo)(t)):this.node().textContent}function Lo(){this.innerHTML=\"\"}function Po(t){return function(){this.innerHTML=t}}function Go(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e==null?\"\":e}}function Er(t){return arguments.length?this.each(t==null?Lo:(typeof t==\"function\"?Go:Po)(t)):this.node().innerHTML}function Vo(){this.nextSibling&&this.parentNode.appendChild(this)}function Ar(){return this.each(Vo)}function Fo(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Mr(){return this.each(Fo)}function Sr(t){var e=typeof t==\"function\"?t:ge(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function Ho(){return null}function Tr(t,e){var n=typeof t==\"function\"?t:ge(t),r=e==null?Ho:typeof e==\"function\"?e:St(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function Xo(){var t=this.parentNode;t&&t.removeChild(this)}function Cr(){return this.each(Xo)}function Yo(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function qo(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Ir(t){return this.select(t?qo:Yo)}function zr(t){return arguments.length?this.property(\"__data__\",t):this.node().__data__}function Uo(t){return function(e){t.call(this,e,this.__data__)}}function Qo(t){return t.trim().split(/^|\\s+/).map(function(e){var n=\"\",r=e.indexOf(\".\");return r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),{type:e,name:n}})}function Ko(t){return function(){var e=this.__on;if(e){for(var n=0,r=-1,i=e.length,o;n<i;++n)o=e[n],(!t.type||o.type===t.type)&&o.name===t.name?this.removeEventListener(o.type,o.listener,o.options):e[++r]=o;++r?e.length=r:delete this.__on}}}function Zo(t,e,n){return function(){var r=this.__on,i,o=Uo(e);if(r){for(var a=0,s=r.length;a<s;++a)if((i=r[a]).type===t.type&&i.name===t.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=o,i.options=n),i.value=e;return}}this.addEventListener(t.type,o,n),i={type:t.type,name:t.name,value:e,listener:o,options:n},r?r.push(i):this.__on=[i]}}function $r(t,e,n){var r=Qo(t+\"\"),i,o=r.length,a;if(arguments.length<2){var s=this.node().__on;if(s){for(var u=0,l=s.length,f;u<l;++u)for(i=0,f=s[u];i<o;++i)if((a=r[i]).type===f.type&&a.name===f.name)return f.value}return}for(s=e?Zo:Ko,i=0;i<o;++i)this.each(s(r[i],e,n));return this}function Or(t,e,n){var r=ve(t),i=r.CustomEvent;typeof i==\"function\"?i=new i(e,n):(i=r.document.createEvent(\"Event\"),n?(i.initEvent(e,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(e,!1,!1)),t.dispatchEvent(i)}function Wo(t,e){return function(){return Or(this,t,e)}}function Jo(t,e){return function(){return Or(this,t,e.apply(this,arguments))}}function Dr(t,e){return this.each((typeof e==\"function\"?Jo:Wo)(t,e))}function*Br(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],i=0,o=r.length,a;i<o;++i)(a=r[i])&&(yield a)}var Qe=[null];function H(t,e){this._groups=t,this._parents=e}function Rr(){return new H([[document.documentElement]],Qe)}function jo(){return this}H.prototype=Rr.prototype={constructor:H,select:Wn,selectAll:Jn,selectChild:jn,selectChildren:tr,filter:er,data:ir,enter:nr,exit:or,join:ar,merge:sr,selection:jo,order:lr,sort:ur,call:fr,nodes:cr,node:pr,size:hr,empty:mr,each:dr,attr:gr,style:xr,property:yr,classed:Nr,text:kr,html:Er,raise:Ar,lower:Mr,append:Sr,insert:Tr,remove:Cr,clone:Ir,datum:zr,on:$r,dispatch:Dr,[Symbol.iterator]:Br};var xt=Rr;function V(t){return typeof t==\"string\"?new H([[document.querySelector(t)]],[document.documentElement]):new H([[t]],Qe)}function Lr(t){let e;for(;e=t.sourceEvent;)t=e;return t}function ot(t,e){if(t=Lr(t),e===void 0&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=t.clientX,r.y=t.clientY,r=r.matrixTransform(e.getScreenCTM().inverse()),[r.x,r.y]}if(e.getBoundingClientRect){var i=e.getBoundingClientRect();return[t.clientX-i.left-e.clientLeft,t.clientY-i.top-e.clientTop]}}return[t.pageX,t.pageY]}var Pr={passive:!1},Tt={capture:!0,passive:!1};function we(t){t.stopImmediatePropagation()}function wt(t){t.preventDefault(),t.stopImmediatePropagation()}function Wt(t){var e=t.document.documentElement,n=V(t).on(\"dragstart.drag\",wt,Tt);\"onselectstart\"in e?n.on(\"selectstart.drag\",wt,Tt):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect=\"none\")}function Jt(t,e){var n=t.document.documentElement,r=V(t).on(\"dragstart.drag\",null);e&&(r.on(\"click.drag\",wt,Tt),setTimeout(function(){r.on(\"click.drag\",null)},0)),\"onselectstart\"in n?r.on(\"selectstart.drag\",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}var jt=t=>()=>t;function te(t,{sourceEvent:e,subject:n,target:r,identifier:i,active:o,x:a,y:s,dx:u,dy:l,dispatch:f}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:o,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:u,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:f}})}te.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};function ta(t){return!t.ctrlKey&&!t.button}function ea(){return this.parentNode}function na(t,e){return e==null?{x:t.x,y:t.y}:e}function ra(){return navigator.maxTouchPoints||\"ontouchstart\"in this}function Ke(){var t=ta,e=ea,n=na,r=ra,i={},o=dt(\"start\",\"drag\",\"end\"),a=0,s,u,l,f,x=0;function p(m){m.on(\"mousedown.drag\",h).filter(r).on(\"touchstart.drag\",y).on(\"touchmove.drag\",d,Pr).on(\"touchend.drag touchcancel.drag\",b).style(\"touch-action\",\"none\").style(\"-webkit-tap-highlight-color\",\"rgba(0,0,0,0)\")}function h(m,E){if(!(f||!t.call(this,m,E))){var T=A(this,e.call(this,m,E),m,E,\"mouse\");T&&(V(m.view).on(\"mousemove.drag\",_,Tt).on(\"mouseup.drag\",g,Tt),Wt(m.view),we(m),l=!1,s=m.clientX,u=m.clientY,T(\"start\",m))}}function _(m){if(wt(m),!l){var E=m.clientX-s,T=m.clientY-u;l=E*E+T*T>x}i.mouse(\"drag\",m)}function g(m){V(m.view).on(\"mousemove.drag mouseup.drag\",null),Jt(m.view,l),wt(m),i.mouse(\"end\",m)}function y(m,E){if(t.call(this,m,E)){var T=m.changedTouches,I=e.call(this,m,E),$=T.length,L,O;for(L=0;L<$;++L)(O=A(this,I,m,E,T[L].identifier,T[L]))&&(we(m),O(\"start\",m,T[L]))}}function d(m){var E=m.changedTouches,T=E.length,I,$;for(I=0;I<T;++I)($=i[E[I].identifier])&&(wt(m),$(\"drag\",m,E[I]))}function b(m){var E=m.changedTouches,T=E.length,I,$;for(f&&clearTimeout(f),f=setTimeout(function(){f=null},500),I=0;I<T;++I)($=i[E[I].identifier])&&(we(m),$(\"end\",m,E[I]))}function A(m,E,T,I,$,L){var O=o.copy(),F=ot(L||T,E),rt,Z,c;if((c=n.call(m,new te(\"beforestart\",{sourceEvent:T,target:p,identifier:$,active:a,x:F[0],y:F[1],dx:0,dy:0,dispatch:O}),I))!=null)return rt=c.x-F[0]||0,Z=c.y-F[1]||0,function k(w,N,C){var z=F,S;switch(w){case\"start\":i[$]=k,S=a++;break;case\"end\":delete i[$],--a;case\"drag\":F=ot(C||N,E),S=a;break}O.call(w,m,new te(w,{sourceEvent:N,subject:c,target:p,identifier:$,active:S,x:F[0]+rt,y:F[1]+Z,dx:F[0]-z[0],dy:F[1]-z[1],dispatch:O}),I)}}return p.filter=function(m){return arguments.length?(t=typeof m==\"function\"?m:jt(!!m),p):t},p.container=function(m){return arguments.length?(e=typeof m==\"function\"?m:jt(m),p):e},p.subject=function(m){return arguments.length?(n=typeof m==\"function\"?m:jt(m),p):n},p.touchable=function(m){return arguments.length?(r=typeof m==\"function\"?m:jt(!!m),p):r},p.on=function(){var m=o.on.apply(o,arguments);return m===o?p:m},p.clickDistance=function(m){return arguments.length?(x=(m=+m)*m,p):Math.sqrt(x)},p}function _e(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function Ze(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function re(){}var ee=.7,ke=1/ee,Lt=\"\\\\s*([+-]?\\\\d+)\\\\s*\",ne=\"\\\\s*([+-]?(?:\\\\d*\\\\.)?\\\\d+(?:[eE][+-]?\\\\d+)?)\\\\s*\",pt=\"\\\\s*([+-]?(?:\\\\d*\\\\.)?\\\\d+(?:[eE][+-]?\\\\d+)?)%\\\\s*\",ia=/^#([0-9a-f]{3,8})$/,oa=new RegExp(`^rgb\\\\(${Lt},${Lt},${Lt}\\\\)$`),aa=new RegExp(`^rgb\\\\(${pt},${pt},${pt}\\\\)$`),sa=new RegExp(`^rgba\\\\(${Lt},${Lt},${Lt},${ne}\\\\)$`),la=new RegExp(`^rgba\\\\(${pt},${pt},${pt},${ne}\\\\)$`),ua=new RegExp(`^hsl\\\\(${ne},${pt},${pt}\\\\)$`),fa=new RegExp(`^hsla\\\\(${ne},${pt},${pt},${ne}\\\\)$`),Gr={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};_e(re,_t,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Vr,formatHex:Vr,formatHex8:ca,formatHsl:pa,formatRgb:Fr,toString:Fr});function Vr(){return this.rgb().formatHex()}function ca(){return this.rgb().formatHex8()}function pa(){return Qr(this).formatHsl()}function Fr(){return this.rgb().formatRgb()}function _t(t){var e,n;return t=(t+\"\").trim().toLowerCase(),(e=ia.exec(t))?(n=e[1].length,e=parseInt(e[1],16),n===6?Hr(e):n===3?new it(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?be(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?be(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=oa.exec(t))?new it(e[1],e[2],e[3],1):(e=aa.exec(t))?new it(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=sa.exec(t))?be(e[1],e[2],e[3],e[4]):(e=la.exec(t))?be(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=ua.exec(t))?qr(e[1],e[2]/100,e[3]/100,1):(e=fa.exec(t))?qr(e[1],e[2]/100,e[3]/100,e[4]):Gr.hasOwnProperty(t)?Hr(Gr[t]):t===\"transparent\"?new it(NaN,NaN,NaN,0):null}function Hr(t){return new it(t>>16&255,t>>8&255,t&255,1)}function be(t,e,n,r){return r<=0&&(t=e=n=NaN),new it(t,e,n,r)}function ha(t){return t instanceof re||(t=_t(t)),t?(t=t.rgb(),new it(t.r,t.g,t.b,t.opacity)):new it}function Pt(t,e,n,r){return arguments.length===1?ha(t):new it(t,e,n,r==null?1:r)}function it(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}_e(it,Pt,Ze(re,{brighter(t){return t=t==null?ke:Math.pow(ke,t),new it(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?ee:Math.pow(ee,t),new it(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new it(It(this.r),It(this.g),It(this.b),Ee(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:Xr,formatHex:Xr,formatHex8:ma,formatRgb:Yr,toString:Yr}));function Xr(){return`#${Ct(this.r)}${Ct(this.g)}${Ct(this.b)}`}function ma(){return`#${Ct(this.r)}${Ct(this.g)}${Ct(this.b)}${Ct((isNaN(this.opacity)?1:this.opacity)*255)}`}function Yr(){let t=Ee(this.opacity);return`${t===1?\"rgb(\":\"rgba(\"}${It(this.r)}, ${It(this.g)}, ${It(this.b)}${t===1?\")\":`, ${t})`}`}function Ee(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function It(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Ct(t){return t=It(t),(t<16?\"0\":\"\")+t.toString(16)}function qr(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new ut(t,e,n,r)}function Qr(t){if(t instanceof ut)return new ut(t.h,t.s,t.l,t.opacity);if(t instanceof re||(t=_t(t)),!t)return new ut;if(t instanceof ut)return t;t=t.rgb();var e=t.r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),o=Math.max(e,n,r),a=NaN,s=o-i,u=(o+i)/2;return s?(e===o?a=(n-r)/s+(n<r)*6:n===o?a=(r-e)/s+2:a=(e-n)/s+4,s/=u<.5?o+i:2-o-i,a*=60):s=u>0&&u<1?0:a,new ut(a,s,u,t.opacity)}function Kr(t,e,n,r){return arguments.length===1?Qr(t):new ut(t,e,n,r==null?1:r)}function ut(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}_e(ut,Kr,Ze(re,{brighter(t){return t=t==null?ke:Math.pow(ke,t),new ut(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?ee:Math.pow(ee,t),new ut(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,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new it(We(t>=240?t-240:t+120,i,r),We(t,i,r),We(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new ut(Ur(this.h),Ne(this.s),Ne(this.l),Ee(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(){let t=Ee(this.opacity);return`${t===1?\"hsl(\":\"hsla(\"}${Ur(this.h)}, ${Ne(this.s)*100}%, ${Ne(this.l)*100}%${t===1?\")\":`, ${t})`}`}}));function Ur(t){return t=(t||0)%360,t<0?t+360:t}function Ne(t){return Math.max(0,Math.min(1,t||0))}function We(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}function Je(t,e,n,r,i){var o=t*t,a=o*t;return((1-3*t+3*o-a)*e+(4-6*o+3*a)*n+(1+3*t+3*o-3*a)*r+a*i)/6}function Zr(t){var e=t.length-1;return function(n){var r=n<=0?n=0:n>=1?(n=1,e-1):Math.floor(n*e),i=t[r],o=t[r+1],a=r>0?t[r-1]:2*i-o,s=r<e-1?t[r+2]:2*o-i;return Je((n-r/e)*e,a,i,o,s)}}function Wr(t){var e=t.length;return function(n){var r=Math.floor(((n%=1)<0?++n:n)*e),i=t[(r+e-1)%e],o=t[r%e],a=t[(r+1)%e],s=t[(r+2)%e];return Je((n-r/e)*e,i,o,a,s)}}var je=t=>()=>t;function da(t,e){return function(n){return t+n*e}}function ga(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}function Jr(t){return(t=+t)==1?Ae:function(e,n){return n-e?ga(e,n,t):je(isNaN(e)?n:e)}}function Ae(t,e){var n=e-t;return n?da(t,n):je(isNaN(t)?e:t)}var Me=(function t(e){var n=Jr(e);function r(i,o){var a=n((i=Pt(i)).r,(o=Pt(o)).r),s=n(i.g,o.g),u=n(i.b,o.b),l=Ae(i.opacity,o.opacity);return function(f){return i.r=a(f),i.g=s(f),i.b=u(f),i.opacity=l(f),i+\"\"}}return r.gamma=t,r})(1);function jr(t){return function(e){var n=e.length,r=new Array(n),i=new Array(n),o=new Array(n),a,s;for(a=0;a<n;++a)s=Pt(e[a]),r[a]=s.r||0,i[a]=s.g||0,o[a]=s.b||0;return r=t(r),i=t(i),o=t(o),s.opacity=1,function(u){return s.r=r(u),s.g=i(u),s.b=o(u),s+\"\"}}}var xa=jr(Zr),ya=jr(Wr);function at(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}var en=/[-+]?(?:\\d+\\.?\\d*|\\.?\\d+)(?:[eE][-+]?\\d+)?/g,tn=new RegExp(en.source,\"g\");function va(t){return function(){return t}}function wa(t){return function(e){return t(e)+\"\"}}function nn(t,e){var n=en.lastIndex=tn.lastIndex=0,r,i,o,a=-1,s=[],u=[];for(t=t+\"\",e=e+\"\";(r=en.exec(t))&&(i=tn.exec(e));)(o=i.index)>n&&(o=e.slice(n,o),s[a]?s[a]+=o:s[++a]=o),(r=r[0])===(i=i[0])?s[a]?s[a]+=i:s[++a]=i:(s[++a]=null,u.push({i:a,x:at(r,i)})),n=tn.lastIndex;return n<e.length&&(o=e.slice(n),s[a]?s[a]+=o:s[++a]=o),s.length<2?u[0]?wa(u[0].x):va(e):(e=u.length,function(l){for(var f=0,x;f<e;++f)s[(x=u[f]).i]=x.x(l);return s.join(\"\")})}var ti=180/Math.PI,Se={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function rn(t,e,n,r,i,o){var a,s,u;return(a=Math.sqrt(t*t+e*e))&&(t/=a,e/=a),(u=t*n+e*r)&&(n-=t*u,r-=e*u),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,u/=s),t*r<e*n&&(t=-t,e=-e,u=-u,a=-a),{translateX:i,translateY:o,rotate:Math.atan2(e,t)*ti,skewX:Math.atan(u)*ti,scaleX:a,scaleY:s}}var Te;function ei(t){let e=new(typeof DOMMatrix==\"function\"?DOMMatrix:WebKitCSSMatrix)(t+\"\");return e.isIdentity?Se:rn(e.a,e.b,e.c,e.d,e.e,e.f)}function ni(t){return t==null?Se:(Te||(Te=document.createElementNS(\"http://www.w3.org/2000/svg\",\"g\")),Te.setAttribute(\"transform\",t),(t=Te.transform.baseVal.consolidate())?(t=t.matrix,rn(t.a,t.b,t.c,t.d,t.e,t.f)):Se)}function ri(t,e,n,r){function i(l){return l.length?l.pop()+\" \":\"\"}function o(l,f,x,p,h,_){if(l!==x||f!==p){var g=h.push(\"translate(\",null,e,null,n);_.push({i:g-4,x:at(l,x)},{i:g-2,x:at(f,p)})}else(x||p)&&h.push(\"translate(\"+x+e+p+n)}function a(l,f,x,p){l!==f?(l-f>180?f+=360:f-l>180&&(l+=360),p.push({i:x.push(i(x)+\"rotate(\",null,r)-2,x:at(l,f)})):f&&x.push(i(x)+\"rotate(\"+f+r)}function s(l,f,x,p){l!==f?p.push({i:x.push(i(x)+\"skewX(\",null,r)-2,x:at(l,f)}):f&&x.push(i(x)+\"skewX(\"+f+r)}function u(l,f,x,p,h,_){if(l!==x||f!==p){var g=h.push(i(h)+\"scale(\",null,\",\",null,\")\");_.push({i:g-4,x:at(l,x)},{i:g-2,x:at(f,p)})}else(x!==1||p!==1)&&h.push(i(h)+\"scale(\"+x+\",\"+p+\")\")}return function(l,f){var x=[],p=[];return l=t(l),f=t(f),o(l.translateX,l.translateY,f.translateX,f.translateY,x,p),a(l.rotate,f.rotate,x,p),s(l.skewX,f.skewX,x,p),u(l.scaleX,l.scaleY,f.scaleX,f.scaleY,x,p),l=f=null,function(h){for(var _=-1,g=p.length,y;++_<g;)x[(y=p[_]).i]=y.x(h);return x.join(\"\")}}}var on=ri(ei,\"px, \",\"px)\",\"deg)\"),an=ri(ni,\", \",\")\",\")\");var _a=1e-12;function ii(t){return((t=Math.exp(t))+1/t)/2}function ba(t){return((t=Math.exp(t))-1/t)/2}function Na(t){return((t=Math.exp(2*t))-1)/(t+1)}var sn=(function t(e,n,r){function i(o,a){var s=o[0],u=o[1],l=o[2],f=a[0],x=a[1],p=a[2],h=f-s,_=x-u,g=h*h+_*_,y,d;if(g<_a)d=Math.log(p/l)/e,y=function(I){return[s+I*h,u+I*_,l*Math.exp(e*I*d)]};else{var b=Math.sqrt(g),A=(p*p-l*l+r*g)/(2*l*n*b),m=(p*p-l*l-r*g)/(2*p*n*b),E=Math.log(Math.sqrt(A*A+1)-A),T=Math.log(Math.sqrt(m*m+1)-m);d=(T-E)/e,y=function(I){var $=I*d,L=ii(E),O=l/(n*b)*(L*Na(e*$+E)-ba(E));return[s+O*h,u+O*_,l*L/ii(e*$+E)]}}return y.duration=d*1e3*e/Math.SQRT2,y}return i.rho=function(o){var a=Math.max(.001,+o),s=a*a,u=s*s;return t(a,s,u)},i})(Math.SQRT2,2,4);var ka=dt(\"start\",\"end\",\"cancel\",\"interrupt\"),Ea=[],si=0,oi=1,Ie=2,Ce=3,ai=4,ze=5,ie=6;function bt(t,e,n,r,i,o){var a=t.__transition;if(!a)t.__transition={};else if(n in a)return;Aa(t,n,{name:e,index:r,group:i,on:ka,tween:Ea,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:si})}function oe(t,e){var n=Y(t,e);if(n.state>si)throw new Error(\"too late; already scheduled\");return n}function J(t,e){var n=Y(t,e);if(n.state>Ce)throw new Error(\"too late; already running\");return n}function Y(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error(\"transition not found\");return n}function Aa(t,e,n){var r=t.__transition,i;r[e]=n,n.timer=Rt(o,0,n.time);function o(l){n.state=oi,n.timer.restart(a,n.delay,n.time),n.delay<=l&&a(l-n.delay)}function a(l){var f,x,p,h;if(n.state!==oi)return u();for(f in r)if(h=r[f],h.name===n.name){if(h.state===Ce)return me(a);h.state===ai?(h.state=ie,h.timer.stop(),h.on.call(\"interrupt\",t,t.__data__,h.index,h.group),delete r[f]):+f<e&&(h.state=ie,h.timer.stop(),h.on.call(\"cancel\",t,t.__data__,h.index,h.group),delete r[f])}if(me(function(){n.state===Ce&&(n.state=ai,n.timer.restart(s,n.delay,n.time),s(l))}),n.state=Ie,n.on.call(\"start\",t,t.__data__,n.index,n.group),n.state===Ie){for(n.state=Ce,i=new Array(p=n.tween.length),f=0,x=-1;f<p;++f)(h=n.tween[f].value.call(t,t.__data__,n.index,n.group))&&(i[++x]=h);i.length=x+1}}function s(l){for(var f=l<n.duration?n.ease.call(null,l/n.duration):(n.timer.restart(u),n.state=ze,1),x=-1,p=i.length;++x<p;)i[x].call(t,f);n.state===ze&&(n.on.call(\"end\",t,t.__data__,n.index,n.group),u())}function u(){n.state=ie,n.timer.stop(),delete r[e];for(var l in r)return;delete t.__transition}}function zt(t,e){var n=t.__transition,r,i,o=!0,a;if(n){e=e==null?null:e+\"\";for(a in n){if((r=n[a]).name!==e){o=!1;continue}i=r.state>Ie&&r.state<ze,r.state=ie,r.timer.stop(),r.on.call(i?\"interrupt\":\"cancel\",t,t.__data__,r.index,r.group),delete n[a]}o&&delete t.__transition}}function li(t){return this.each(function(){zt(this,t)})}function Ma(t,e){var n,r;return function(){var i=J(this,t),o=i.tween;if(o!==n){r=n=o;for(var a=0,s=r.length;a<s;++a)if(r[a].name===e){r=r.slice(),r.splice(a,1);break}}i.tween=r}}function Sa(t,e,n){var r,i;if(typeof n!=\"function\")throw new Error;return function(){var o=J(this,t),a=o.tween;if(a!==r){i=(r=a).slice();for(var s={name:e,value:n},u=0,l=i.length;u<l;++u)if(i[u].name===e){i[u]=s;break}u===l&&i.push(s)}o.tween=i}}function ui(t,e){var n=this._id;if(t+=\"\",arguments.length<2){for(var r=Y(this.node(),n).tween,i=0,o=r.length,a;i<o;++i)if((a=r[i]).name===t)return a.value;return null}return this.each((e==null?Ma:Sa)(n,t,e))}function Gt(t,e,n){var r=t._id;return t.each(function(){var i=J(this,r);(i.value||(i.value={}))[e]=n.apply(this,arguments)}),function(i){return Y(i,r).value[e]}}function $e(t,e){var n;return(typeof e==\"number\"?at:e instanceof _t?Me:(n=_t(e))?(e=n,Me):nn)(t,e)}function Ta(t){return function(){this.removeAttribute(t)}}function Ca(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Ia(t,e,n){var r,i=n+\"\",o;return function(){var a=this.getAttribute(t);return a===i?null:a===r?o:o=e(r=a,n)}}function za(t,e,n){var r,i=n+\"\",o;return function(){var a=this.getAttributeNS(t.space,t.local);return a===i?null:a===r?o:o=e(r=a,n)}}function $a(t,e,n){var r,i,o;return function(){var a,s=n(this),u;return s==null?void this.removeAttribute(t):(a=this.getAttribute(t),u=s+\"\",a===u?null:a===r&&u===i?o:(i=u,o=e(r=a,s)))}}function Oa(t,e,n){var r,i,o;return function(){var a,s=n(this),u;return s==null?void this.removeAttributeNS(t.space,t.local):(a=this.getAttributeNS(t.space,t.local),u=s+\"\",a===u?null:a===r&&u===i?o:(i=u,o=e(r=a,s)))}}function fi(t,e){var n=gt(t),r=n===\"transform\"?an:$e;return this.attrTween(t,typeof e==\"function\"?(n.local?Oa:$a)(n,r,Gt(this,\"attr.\"+t,e)):e==null?(n.local?Ca:Ta)(n):(n.local?za:Ia)(n,r,e))}function Da(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}function Ba(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}function Ra(t,e){var n,r;function i(){var o=e.apply(this,arguments);return o!==r&&(n=(r=o)&&Ba(t,o)),n}return i._value=e,i}function La(t,e){var n,r;function i(){var o=e.apply(this,arguments);return o!==r&&(n=(r=o)&&Da(t,o)),n}return i._value=e,i}function ci(t,e){var n=\"attr.\"+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!=\"function\")throw new Error;var r=gt(t);return this.tween(n,(r.local?Ra:La)(r,e))}function Pa(t,e){return function(){oe(this,t).delay=+e.apply(this,arguments)}}function Ga(t,e){return e=+e,function(){oe(this,t).delay=e}}function pi(t){var e=this._id;return arguments.length?this.each((typeof t==\"function\"?Pa:Ga)(e,t)):Y(this.node(),e).delay}function Va(t,e){return function(){J(this,t).duration=+e.apply(this,arguments)}}function Fa(t,e){return e=+e,function(){J(this,t).duration=e}}function hi(t){var e=this._id;return arguments.length?this.each((typeof t==\"function\"?Va:Fa)(e,t)):Y(this.node(),e).duration}function Ha(t,e){if(typeof e!=\"function\")throw new Error;return function(){J(this,t).ease=e}}function mi(t){var e=this._id;return arguments.length?this.each(Ha(e,t)):Y(this.node(),e).ease}function Xa(t,e){return function(){var n=e.apply(this,arguments);if(typeof n!=\"function\")throw new Error;J(this,t).ease=n}}function di(t){if(typeof t!=\"function\")throw new Error;return this.each(Xa(this._id,t))}function gi(t){typeof t!=\"function\"&&(t=Kt(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var o=e[i],a=o.length,s=r[i]=[],u,l=0;l<a;++l)(u=o[l])&&t.call(u,u.__data__,l,o)&&s.push(u);return new nt(r,this._parents,this._name,this._id)}function xi(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,r=e.length,i=n.length,o=Math.min(r,i),a=new Array(r),s=0;s<o;++s)for(var u=e[s],l=n[s],f=u.length,x=a[s]=new Array(f),p,h=0;h<f;++h)(p=u[h]||l[h])&&(x[h]=p);for(;s<r;++s)a[s]=e[s];return new nt(a,this._parents,this._name,this._id)}function Ya(t){return(t+\"\").trim().split(/^|\\s+/).every(function(e){var n=e.indexOf(\".\");return n>=0&&(e=e.slice(0,n)),!e||e===\"start\"})}function qa(t,e,n){var r,i,o=Ya(e)?oe:J;return function(){var a=o(this,t),s=a.on;s!==r&&(i=(r=s).copy()).on(e,n),a.on=i}}function yi(t,e){var n=this._id;return arguments.length<2?Y(this.node(),n).on.on(t):this.each(qa(n,t,e))}function Ua(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}function vi(){return this.on(\"end.remove\",Ua(this._id))}function wi(t){var e=this._name,n=this._id;typeof t!=\"function\"&&(t=St(t));for(var r=this._groups,i=r.length,o=new Array(i),a=0;a<i;++a)for(var s=r[a],u=s.length,l=o[a]=new Array(u),f,x,p=0;p<u;++p)(f=s[p])&&(x=t.call(f,f.__data__,p,s))&&(\"__data__\"in f&&(x.__data__=f.__data__),l[p]=x,bt(l[p],e,n,p,l,Y(f,n)));return new nt(o,this._parents,e,n)}function _i(t){var e=this._name,n=this._id;typeof t!=\"function\"&&(t=Qt(t));for(var r=this._groups,i=r.length,o=[],a=[],s=0;s<i;++s)for(var u=r[s],l=u.length,f,x=0;x<l;++x)if(f=u[x]){for(var p=t.call(f,f.__data__,x,u),h,_=Y(f,n),g=0,y=p.length;g<y;++g)(h=p[g])&&bt(h,e,n,g,p,_);o.push(p),a.push(f)}return new nt(o,a,e,n)}var Qa=xt.prototype.constructor;function bi(){return new Qa(this._groups,this._parents)}function Ka(t,e){var n,r,i;return function(){var o=vt(this,t),a=(this.style.removeProperty(t),vt(this,t));return o===a?null:o===n&&a===r?i:i=e(n=o,r=a)}}function Ni(t){return function(){this.style.removeProperty(t)}}function Za(t,e,n){var r,i=n+\"\",o;return function(){var a=vt(this,t);return a===i?null:a===r?o:o=e(r=a,n)}}function Wa(t,e,n){var r,i,o;return function(){var a=vt(this,t),s=n(this),u=s+\"\";return s==null&&(u=s=(this.style.removeProperty(t),vt(this,t))),a===u?null:a===r&&u===i?o:(i=u,o=e(r=a,s))}}function Ja(t,e){var n,r,i,o=\"style.\"+e,a=\"end.\"+o,s;return function(){var u=J(this,t),l=u.on,f=u.value[o]==null?s||(s=Ni(e)):void 0;(l!==n||i!==f)&&(r=(n=l).copy()).on(a,i=f),u.on=r}}function ki(t,e,n){var r=(t+=\"\")==\"transform\"?on:$e;return e==null?this.styleTween(t,Ka(t,r)).on(\"end.style.\"+t,Ni(t)):typeof e==\"function\"?this.styleTween(t,Wa(t,r,Gt(this,\"style.\"+t,e))).each(Ja(this._id,t)):this.styleTween(t,Za(t,r,e),n).on(\"end.style.\"+t,null)}function ja(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}function ts(t,e,n){var r,i;function o(){var a=e.apply(this,arguments);return a!==i&&(r=(i=a)&&ja(t,a,n)),r}return o._value=e,o}function Ei(t,e,n){var r=\"style.\"+(t+=\"\");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(e==null)return this.tween(r,null);if(typeof e!=\"function\")throw new Error;return this.tween(r,ts(t,e,n==null?\"\":n))}function es(t){return function(){this.textContent=t}}function ns(t){return function(){var e=t(this);this.textContent=e==null?\"\":e}}function Ai(t){return this.tween(\"text\",typeof t==\"function\"?ns(Gt(this,\"text\",t)):es(t==null?\"\":t+\"\"))}function rs(t){return function(e){this.textContent=t.call(this,e)}}function is(t){var e,n;function r(){var i=t.apply(this,arguments);return i!==n&&(e=(n=i)&&rs(i)),e}return r._value=t,r}function Mi(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,is(t))}function Si(){for(var t=this._name,e=this._id,n=Oe(),r=this._groups,i=r.length,o=0;o<i;++o)for(var a=r[o],s=a.length,u,l=0;l<s;++l)if(u=a[l]){var f=Y(u,e);bt(u,t,n,l,a,{time:f.time+f.delay+f.duration,delay:0,duration:f.duration,ease:f.ease})}return new nt(r,this._parents,t,n)}function Ti(){var t,e,n=this,r=n._id,i=n.size();return new Promise(function(o,a){var s={value:a},u={value:function(){--i===0&&o()}};n.each(function(){var l=J(this,r),f=l.on;f!==t&&(e=(t=f).copy(),e._.cancel.push(s),e._.interrupt.push(s),e._.end.push(u)),l.on=e}),i===0&&o()})}var os=0;function nt(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function Ci(t){return xt().transition(t)}function Oe(){return++os}var yt=xt.prototype;nt.prototype=Ci.prototype={constructor:nt,select:wi,selectAll:_i,selectChild:yt.selectChild,selectChildren:yt.selectChildren,filter:gi,merge:xi,selection:bi,transition:Si,call:yt.call,nodes:yt.nodes,node:yt.node,size:yt.size,empty:yt.empty,each:yt.each,on:yi,attr:fi,attrTween:ci,style:ki,styleTween:Ei,text:Ai,textTween:Mi,remove:vi,tween:ui,delay:pi,duration:hi,ease:mi,easeVarying:di,end:Ti,[Symbol.iterator]:yt[Symbol.iterator]};function De(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var as={time:null,delay:0,duration:250,ease:De};function ss(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}function Ii(t){var e,n;t instanceof nt?(e=t._id,t=t._name):(e=Oe(),(n=as).time=Ut(),t=t==null?null:t+\"\");for(var r=this._groups,i=r.length,o=0;o<i;++o)for(var a=r[o],s=a.length,u,l=0;l<s;++l)(u=a[l])&&bt(u,t,e,l,a,n||ss(u,e));return new nt(r,this._parents,t,e)}xt.prototype.interrupt=li;xt.prototype.transition=Ii;var ae=t=>()=>t;function ln(t,{sourceEvent:e,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function ft(t,e,n){this.k=t,this.x=e,this.y=n}ft.prototype={constructor:ft,scale:function(t){return t===1?this:new ft(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new ft(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return\"translate(\"+this.x+\",\"+this.y+\") scale(\"+this.k+\")\"}};var Nt=new ft(1,0,0);un.prototype=ft.prototype;function un(t){for(;!t.__zoom;)if(!(t=t.parentNode))return Nt;return t.__zoom}function Be(t){t.stopImmediatePropagation()}function Vt(t){t.preventDefault(),t.stopImmediatePropagation()}function ls(t){return(!t.ctrlKey||t.type===\"wheel\")&&!t.button}function us(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t,t.hasAttribute(\"viewBox\")?(t=t.viewBox.baseVal,[[t.x,t.y],[t.x+t.width,t.y+t.height]]):[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]):[[0,0],[t.clientWidth,t.clientHeight]]}function zi(){return this.__zoom||Nt}function fs(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function cs(){return navigator.maxTouchPoints||\"ontouchstart\"in this}function ps(t,e,n){var r=t.invertX(e[0][0])-n[0][0],i=t.invertX(e[1][0])-n[1][0],o=t.invertY(e[0][1])-n[0][1],a=t.invertY(e[1][1])-n[1][1];return t.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),a>o?(o+a)/2:Math.min(0,o)||Math.max(0,a))}function fn(){var t=ls,e=us,n=ps,r=fs,i=cs,o=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],s=250,u=sn,l=dt(\"start\",\"zoom\",\"end\"),f,x,p,h=500,_=150,g=0,y=10;function d(c){c.property(\"__zoom\",zi).on(\"wheel.zoom\",$,{passive:!1}).on(\"mousedown.zoom\",L).on(\"dblclick.zoom\",O).filter(i).on(\"touchstart.zoom\",F).on(\"touchmove.zoom\",rt).on(\"touchend.zoom touchcancel.zoom\",Z).style(\"-webkit-tap-highlight-color\",\"rgba(0,0,0,0)\")}d.transform=function(c,k,w,N){var C=c.selection?c.selection():c;C.property(\"__zoom\",zi),c!==C?E(c,k,w,N):C.interrupt().each(function(){T(this,arguments).event(N).start().zoom(null,typeof k==\"function\"?k.apply(this,arguments):k).end()})},d.scaleBy=function(c,k,w,N){d.scaleTo(c,function(){var C=this.__zoom.k,z=typeof k==\"function\"?k.apply(this,arguments):k;return C*z},w,N)},d.scaleTo=function(c,k,w,N){d.transform(c,function(){var C=e.apply(this,arguments),z=this.__zoom,S=w==null?m(C):typeof w==\"function\"?w.apply(this,arguments):w,B=z.invert(S),P=typeof k==\"function\"?k.apply(this,arguments):k;return n(A(b(z,P),S,B),C,a)},w,N)},d.translateBy=function(c,k,w,N){d.transform(c,function(){return n(this.__zoom.translate(typeof k==\"function\"?k.apply(this,arguments):k,typeof w==\"function\"?w.apply(this,arguments):w),e.apply(this,arguments),a)},null,N)},d.translateTo=function(c,k,w,N,C){d.transform(c,function(){var z=e.apply(this,arguments),S=this.__zoom,B=N==null?m(z):typeof N==\"function\"?N.apply(this,arguments):N;return n(Nt.translate(B[0],B[1]).scale(S.k).translate(typeof k==\"function\"?-k.apply(this,arguments):-k,typeof w==\"function\"?-w.apply(this,arguments):-w),z,a)},N,C)};function b(c,k){return k=Math.max(o[0],Math.min(o[1],k)),k===c.k?c:new ft(k,c.x,c.y)}function A(c,k,w){var N=k[0]-w[0]*c.k,C=k[1]-w[1]*c.k;return N===c.x&&C===c.y?c:new ft(c.k,N,C)}function m(c){return[(+c[0][0]+ +c[1][0])/2,(+c[0][1]+ +c[1][1])/2]}function E(c,k,w,N){c.on(\"start.zoom\",function(){T(this,arguments).event(N).start()}).on(\"interrupt.zoom end.zoom\",function(){T(this,arguments).event(N).end()}).tween(\"zoom\",function(){var C=this,z=arguments,S=T(C,z).event(N),B=e.apply(C,z),P=w==null?m(B):typeof w==\"function\"?w.apply(C,z):w,q=Math.max(B[1][0]-B[0][0],B[1][1]-B[0][1]),G=C.__zoom,U=typeof k==\"function\"?k.apply(C,z):k,j=u(G.invert(P).concat(q/G.k),U.invert(P).concat(q/U.k));return function(Q){if(Q===1)Q=U;else{var W=j(Q),st=q/W[2];Q=new ft(st,P[0]-W[0]*st,P[1]-W[1]*st)}S.zoom(null,Q)}})}function T(c,k,w){return!w&&c.__zooming||new I(c,k)}function I(c,k){this.that=c,this.args=k,this.active=0,this.sourceEvent=null,this.extent=e.apply(c,k),this.taps=0}I.prototype={event:function(c){return c&&(this.sourceEvent=c),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit(\"start\")),this},zoom:function(c,k){return this.mouse&&c!==\"mouse\"&&(this.mouse[1]=k.invert(this.mouse[0])),this.touch0&&c!==\"touch\"&&(this.touch0[1]=k.invert(this.touch0[0])),this.touch1&&c!==\"touch\"&&(this.touch1[1]=k.invert(this.touch1[0])),this.that.__zoom=k,this.emit(\"zoom\"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit(\"end\")),this},emit:function(c){var k=V(this.that).datum();l.call(c,this.that,new ln(c,{sourceEvent:this.sourceEvent,target:d,type:c,transform:this.that.__zoom,dispatch:l}),k)}};function $(c,...k){if(!t.apply(this,arguments))return;var w=T(this,k).event(c),N=this.__zoom,C=Math.max(o[0],Math.min(o[1],N.k*Math.pow(2,r.apply(this,arguments)))),z=ot(c);if(w.wheel)(w.mouse[0][0]!==z[0]||w.mouse[0][1]!==z[1])&&(w.mouse[1]=N.invert(w.mouse[0]=z)),clearTimeout(w.wheel);else{if(N.k===C)return;w.mouse=[z,N.invert(z)],zt(this),w.start()}Vt(c),w.wheel=setTimeout(S,_),w.zoom(\"mouse\",n(A(b(N,C),w.mouse[0],w.mouse[1]),w.extent,a));function S(){w.wheel=null,w.end()}}function L(c,...k){if(p||!t.apply(this,arguments))return;var w=c.currentTarget,N=T(this,k,!0).event(c),C=V(c.view).on(\"mousemove.zoom\",P,!0).on(\"mouseup.zoom\",q,!0),z=ot(c,w),S=c.clientX,B=c.clientY;Wt(c.view),Be(c),N.mouse=[z,this.__zoom.invert(z)],zt(this),N.start();function P(G){if(Vt(G),!N.moved){var U=G.clientX-S,j=G.clientY-B;N.moved=U*U+j*j>g}N.event(G).zoom(\"mouse\",n(A(N.that.__zoom,N.mouse[0]=ot(G,w),N.mouse[1]),N.extent,a))}function q(G){C.on(\"mousemove.zoom mouseup.zoom\",null),Jt(G.view,N.moved),Vt(G),N.event(G).end()}}function O(c,...k){if(t.apply(this,arguments)){var w=this.__zoom,N=ot(c.changedTouches?c.changedTouches[0]:c,this),C=w.invert(N),z=w.k*(c.shiftKey?.5:2),S=n(A(b(w,z),N,C),e.apply(this,k),a);Vt(c),s>0?V(this).transition().duration(s).call(E,S,N,c):V(this).call(d.transform,S,N,c)}}function F(c,...k){if(t.apply(this,arguments)){var w=c.touches,N=w.length,C=T(this,k,c.changedTouches.length===N).event(c),z,S,B,P;for(Be(c),S=0;S<N;++S)B=w[S],P=ot(B,this),P=[P,this.__zoom.invert(P),B.identifier],C.touch0?!C.touch1&&C.touch0[2]!==P[2]&&(C.touch1=P,C.taps=0):(C.touch0=P,z=!0,C.taps=1+!!f);f&&(f=clearTimeout(f)),z&&(C.taps<2&&(x=P[0],f=setTimeout(function(){f=null},h)),zt(this),C.start())}}function rt(c,...k){if(this.__zooming){var w=T(this,k).event(c),N=c.changedTouches,C=N.length,z,S,B,P;for(Vt(c),z=0;z<C;++z)S=N[z],B=ot(S,this),w.touch0&&w.touch0[2]===S.identifier?w.touch0[0]=B:w.touch1&&w.touch1[2]===S.identifier&&(w.touch1[0]=B);if(S=w.that.__zoom,w.touch1){var q=w.touch0[0],G=w.touch0[1],U=w.touch1[0],j=w.touch1[1],Q=(Q=U[0]-q[0])*Q+(Q=U[1]-q[1])*Q,W=(W=j[0]-G[0])*W+(W=j[1]-G[1])*W;S=b(S,Math.sqrt(Q/W)),B=[(q[0]+U[0])/2,(q[1]+U[1])/2],P=[(G[0]+j[0])/2,(G[1]+j[1])/2]}else if(w.touch0)B=w.touch0[0],P=w.touch0[1];else return;w.zoom(\"touch\",n(A(S,B,P),w.extent,a))}}function Z(c,...k){if(this.__zooming){var w=T(this,k).event(c),N=c.changedTouches,C=N.length,z,S;for(Be(c),p&&clearTimeout(p),p=setTimeout(function(){p=null},h),z=0;z<C;++z)S=N[z],w.touch0&&w.touch0[2]===S.identifier?delete w.touch0:w.touch1&&w.touch1[2]===S.identifier&&delete w.touch1;if(w.touch1&&!w.touch0&&(w.touch0=w.touch1,delete w.touch1),w.touch0)w.touch0[1]=this.__zoom.invert(w.touch0[0]);else if(w.end(),w.taps===2&&(S=ot(S,this),Math.hypot(x[0]-S[0],x[1]-S[1])<y)){var B=V(this).on(\"dblclick.zoom\");B&&B.apply(this,arguments)}}}return d.wheelDelta=function(c){return arguments.length?(r=typeof c==\"function\"?c:ae(+c),d):r},d.filter=function(c){return arguments.length?(t=typeof c==\"function\"?c:ae(!!c),d):t},d.touchable=function(c){return arguments.length?(i=typeof c==\"function\"?c:ae(!!c),d):i},d.extent=function(c){return arguments.length?(e=typeof c==\"function\"?c:ae([[+c[0][0],+c[0][1]],[+c[1][0],+c[1][1]]]),d):e},d.scaleExtent=function(c){return arguments.length?(o[0]=+c[0],o[1]=+c[1],d):[o[0],o[1]]},d.translateExtent=function(c){return arguments.length?(a[0][0]=+c[0][0],a[1][0]=+c[1][0],a[0][1]=+c[0][1],a[1][1]=+c[1][1],d):[[a[0][0],a[0][1]],[a[1][0],a[1][1]]]},d.constrain=function(c){return arguments.length?(n=c,d):n},d.duration=function(c){return arguments.length?(s=+c,d):s},d.interpolate=function(c){return arguments.length?(u=c,d):u},d.on=function(){var c=l.on.apply(l,arguments);return c===l?d:c},d.clickDistance=function(c){return arguments.length?(g=(c=+c)*c,d):Math.sqrt(g)},d.tapDistance=function(c){return arguments.length?(y=+c,d):y},d}var Re={primary_partner:{color:\"#f1c40f\",width:4,dashArray:\"\",label:\"Primary Partners\"},partner:{color:\"#ff6b9d\",width:3,dashArray:\"\",label:\"Partners\"},nesting_partner:{color:\"#ff4757\",width:3,dashArray:\"\",label:\"Nesting Partners\",double:!0},anchor_partner:{color:\"#c0392b\",width:4,dashArray:\"10,4\",label:\"Anchor Partners\"},fwb:{color:\"#a55eea\",width:2.5,dashArray:\"8,4\",label:\"Friends with Benefits\"},casual:{color:\"#45aaf2\",width:2,dashArray:\"3,5\",label:\"Casual\"},queerplatonic:{color:\"#26de81\",width:2,dashArray:\"12,3,3,3\",label:\"Queerplatonic\"},comet:{color:\"#a5b1c2\",width:1.5,dashArray:\"18,8\",label:\"Comet\"},friend:{color:\"#4fc3f7\",width:1.5,dashArray:\"\",label:\"Friends\"},metamour:{color:\"#546e7a\",width:1,dashArray:\"4,6\",label:\"Metamour\"},tbd:{color:\"#78909c\",width:1.5,dashArray:\"6,3,2,3\",label:\"TBD\"}},$i=[\"#e91e8c\",\"#9c27b0\",\"#3f51b5\",\"#2196f3\",\"#009688\",\"#4caf50\",\"#ff9800\",\"#f44336\",\"#00bcd4\",\"#8bc34a\"];function cn(t,e){if(e)return e;let n=0;for(let r=0;r<t.length;r++)n=(n<<5)-n+t.charCodeAt(r),n|=0;return $i[Math.abs(n)%$i.length]}function pn(t){return t.split(/\\s+/).slice(0,2).map(e=>{var n,r;return(r=(n=e[0])==null?void 0:n.toUpperCase())!=null?r:\"\"}).join(\"\")}var hn=28,hs=16;function Oi(t){return{bg:t?\"#0d1117\":\"#f0f4f8\",grid:t?\"rgba(255,255,255,0.025)\":\"rgba(0,0,0,0.04)\",text:t?\"#e6edf3\":\"#1c1e21\",textMuted:t?\"#8b949e\":\"#65676b\",nodeLabelBg:t?\"rgba(0,0,0,0.55)\":\"rgba(255,255,255,0.75)\",edgeLabelBg:t?\"rgba(13,17,23,0.75)\":\"rgba(240,244,248,0.8)\",panelBg:t?\"rgba(22,27,34,0.95)\":\"rgba(255,255,255,0.97)\",legendBg:t?\"rgba(13,17,23,0.45)\":\"rgba(255,255,255,0.5)\",panelBorder:t?\"rgba(48,54,61,0.9)\":\"rgba(208,215,222,0.9)\",panelText:t?\"#e6edf3\":\"#1c1e21\",panelMuted:t?\"#8b949e\":\"#65676b\",btnBg:t?\"rgba(33,38,45,0.9)\":\"rgba(255,255,255,0.9)\",btnBorder:t?\"rgba(48,54,61,0.8)\":\"rgba(208,215,222,0.8)\",btnText:t?\"#8b949e\":\"#65676b\"}}function ms(){if(document.getElementById(\"polymap-styles\"))return;let t=document.createElement(\"style\");t.id=\"polymap-styles\",t.textContent=`\n .polymap-wrap { position: relative; width: 100%; height: 100%; overflow: hidden; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }\n .polymap-wrap svg { display: block; width: 100%; height: 100%; cursor: grab; }\n .polymap-wrap svg:active { cursor: grabbing; }\n .polymap-node { cursor: pointer; }\n .polymap-node:hover .pm-halo { opacity: 0.35 !important; }\n .polymap-node:hover .pm-ring { stroke-width: 3 !important; }\n\n .pm-info-panel {\n position: absolute;\n min-width: 200px;\n max-width: 280px;\n border-radius: 12px;\n padding: 14px 16px;\n box-shadow: 0 8px 32px rgba(0,0,0,0.35);\n backdrop-filter: blur(12px);\n -webkit-backdrop-filter: blur(12px);\n border: 1px solid;\n pointer-events: auto;\n z-index: 100;\n transition: opacity 0.15s ease;\n }\n .pm-info-panel.hidden { opacity: 0; pointer-events: none; }\n .pm-info-header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }\n .pm-info-avatar {\n width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;\n display: flex; align-items: center; justify-content: center;\n font-size: 14px; font-weight: 700; color: #fff;\n background-size: cover; background-position: center;\n overflow: hidden;\n }\n .pm-info-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }\n .pm-info-name { font-size: 15px; font-weight: 600; line-height: 1.2; }\n .pm-info-pronouns { font-size: 12px; margin-top: 1px; }\n .pm-info-close {\n margin-left: auto; background: none; border: none; cursor: pointer;\n font-size: 18px; line-height: 1; padding: 0 2px; opacity: 0.5;\n transition: opacity 0.1s;\n }\n .pm-info-close:hover { opacity: 1; }\n .pm-info-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }\n .pm-info-link {\n font-size: 12px; padding: 3px 9px; border-radius: 20px;\n border: 1px solid; text-decoration: none; opacity: 0.85;\n transition: opacity 0.1s;\n }\n .pm-info-link:hover { opacity: 1; }\n\n .pm-controls {\n position: absolute; top: 12px; right: 12px;\n display: flex; flex-direction: column; gap: 6px; z-index: 50;\n }\n .pm-btn {\n border: 1px solid; border-radius: 8px; padding: 6px 12px;\n font-size: 12px; cursor: pointer; backdrop-filter: blur(8px);\n -webkit-backdrop-filter: blur(8px); transition: opacity 0.1s;\n white-space: nowrap;\n }\n .pm-btn:hover { opacity: 0.8; }\n\n .pm-legend {\n position: absolute; bottom: 12px; left: 12px; z-index: 50;\n border: 1px solid; border-radius: 10px; padding: 10px 14px;\n backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);\n min-width: 160px;\n }\n .pm-legend.hidden { display: none; }\n .pm-legend-title { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 8px; }\n .pm-legend-item { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; font-size: 12px; }\n .pm-legend-line { flex-shrink: 0; }\n `,document.head.appendChild(t)}function Di(t,e){ms();let n=e.settings.theme!==\"light\",r=!0,i=!0,o=!0,a=Nt,s=document.createElement(\"div\");s.className=\"polymap-wrap\",t.appendChild(s);let u=new Map;e.people.forEach(v=>u.set(v.id,0)),e.relationships.forEach(v=>{var M,R;u.set(v.from,((M=u.get(v.from))!=null?M:0)+1),u.set(v.to,((R=u.get(v.to))!=null?R:0)+1)});let l=e.people.length,f=e.people.map((v,M)=>{var X;let R=M/l*2*Math.PI,D=220;return bn(_n({},v),{x:480+Math.cos(R)*D,y:360+Math.sin(R)*D,vx:0,vy:0,fx:null,fy:null,connectionCount:(X=u.get(v.id))!=null?X:0})}),x=new Map(f.map(v=>[v.id,v])),p=e.relationships.map(v=>({source:x.get(v.from),target:x.get(v.to),relationship:v}));function h(v){return e.settings.nodeScale===\"connections\"?hn+v.connectionCount*4:hn}let _=document.createElementNS(\"http://www.w3.org/2000/svg\",\"svg\");s.appendChild(_);let g=V(_),y=g.append(\"defs\");y.append(\"pattern\").attr(\"id\",\"pm-grid\").attr(\"width\",40).attr(\"height\",40).attr(\"patternUnits\",\"userSpaceOnUse\").append(\"path\").attr(\"d\",\"M 40 0 L 0 0 0 40\").attr(\"fill\",\"none\").attr(\"class\",\"pm-grid-path\").attr(\"stroke-width\",\"1\"),y.append(\"clipPath\").attr(\"id\",\"pm-node-clip\").append(\"circle\").attr(\"r\",hn);let b=y.append(\"filter\").attr(\"id\",\"pm-node-glow\").attr(\"x\",\"-60%\").attr(\"y\",\"-60%\").attr(\"width\",\"220%\").attr(\"height\",\"220%\");b.append(\"feGaussianBlur\").attr(\"in\",\"SourceGraphic\").attr(\"stdDeviation\",\"5\").attr(\"result\",\"blur\");let A=b.append(\"feMerge\");A.append(\"feMergeNode\").attr(\"in\",\"blur\"),A.append(\"feMergeNode\").attr(\"in\",\"SourceGraphic\");let m=y.append(\"filter\").attr(\"id\",\"pm-edge-glow\").attr(\"x\",\"-40%\").attr(\"y\",\"-40%\").attr(\"width\",\"180%\").attr(\"height\",\"180%\");m.append(\"feGaussianBlur\").attr(\"in\",\"SourceGraphic\").attr(\"stdDeviation\",\"2.5\").attr(\"result\",\"blur\");let E=m.append(\"feMerge\");E.append(\"feMergeNode\").attr(\"in\",\"blur\"),E.append(\"feMergeNode\").attr(\"in\",\"SourceGraphic\");let T=g.append(\"rect\").attr(\"class\",\"pm-bg\").attr(\"width\",\"100%\").attr(\"height\",\"100%\");g.append(\"rect\").attr(\"class\",\"pm-grid-rect\").attr(\"width\",\"100%\").attr(\"height\",\"100%\").attr(\"fill\",\"url(#pm-grid)\");let I=g.append(\"g\").attr(\"class\",\"pm-graph-root\"),$=I.append(\"g\").attr(\"class\",\"pm-edges\"),L=I.append(\"g\").attr(\"class\",\"pm-nodes\"),O=$.selectAll(\"g.pm-edge\").data(p).join(\"g\").attr(\"class\",\"pm-edge\"),F=O.append(\"line\").attr(\"class\",\"pm-edge-bg\").attr(\"stroke-linecap\",\"round\"),rt=O.append(\"line\").attr(\"class\",\"pm-edge-line\").attr(\"stroke-linecap\",\"round\"),Z=O.append(\"g\").attr(\"class\",\"pm-edge-label\");Z.append(\"rect\").attr(\"rx\",4).attr(\"ry\",4).attr(\"x\",-28).attr(\"y\",-8).attr(\"width\",56).attr(\"height\",14),Z.append(\"text\").attr(\"text-anchor\",\"middle\").attr(\"dominant-baseline\",\"central\").attr(\"y\",0).attr(\"font-size\",\"9\").attr(\"font-family\",'-apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif').attr(\"font-weight\",\"500\"),O.each(function(v){var ht;let M=Re[v.relationship.type],R=(ht=v.relationship.label)!=null?ht:M.label,D=Math.max(40,R.length*5.5+12);V(this).select(\"rect\").attr(\"x\",-D/2).attr(\"width\",D);let X=V(this),tt=X.select(\".pm-edge-bg\"),kt=X.select(\".pm-edge-line\"),Dt=X.select(\".pm-edge-label\").select(\"text\");M.double?tt.attr(\"stroke-width\",M.width*2.6).style(\"visibility\",\"visible\"):tt.style(\"visibility\",\"hidden\"),kt.attr(\"stroke\",M.color).attr(\"stroke-width\",M.width).attr(\"stroke-dasharray\",M.dashArray||null).attr(\"opacity\",\"0.85\").attr(\"filter\",\"url(#pm-edge-glow)\"),Dt.text(R).attr(\"fill\",M.color)});let c=L.selectAll(\"g.polymap-node\").data(f).join(\"g\").attr(\"class\",\"polymap-node\").attr(\"data-id\",v=>v.id);c.each(function(v){let M=h(v),R=cn(v.id,v.color),D=V(this);if(D.append(\"circle\").attr(\"class\",\"pm-halo\").attr(\"r\",M+10).attr(\"fill\",R).attr(\"opacity\",.15),v.photo){let tt=`pm-clip-${v.id}`;V(_).select(\"defs\").append(\"clipPath\").attr(\"id\",tt).append(\"circle\").attr(\"r\",M),D.append(\"image\").attr(\"href\",v.photo).attr(\"x\",-M).attr(\"y\",-M).attr(\"width\",M*2).attr(\"height\",M*2).attr(\"clip-path\",`url(#${tt})`).attr(\"preserveAspectRatio\",\"xMidYMid slice\")}else D.append(\"circle\").attr(\"r\",M).attr(\"fill\",R).attr(\"filter\",\"url(#pm-node-glow)\"),D.append(\"text\").attr(\"text-anchor\",\"middle\").attr(\"dominant-baseline\",\"central\").attr(\"font-size\",Math.round(M*.5)).attr(\"font-weight\",\"700\").attr(\"font-family\",'-apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif').attr(\"fill\",\"#ffffff\").attr(\"pointer-events\",\"none\").text(pn(v.name));D.append(\"circle\").attr(\"class\",\"pm-ring\").attr(\"r\",M).attr(\"fill\",\"none\").attr(\"stroke\",R).attr(\"stroke-width\",2).attr(\"opacity\",.9);let X=M+hs;D.append(\"rect\").attr(\"class\",\"pm-label-bg\").attr(\"rx\",4).attr(\"ry\",4).attr(\"x\",-36).attr(\"y\",X-9).attr(\"width\",72).attr(\"height\",15),D.append(\"text\").attr(\"class\",\"pm-label-text\").attr(\"text-anchor\",\"middle\").attr(\"y\",X).attr(\"font-size\",\"11\").attr(\"font-family\",'-apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif').attr(\"pointer-events\",\"none\").text(v.name)});let k=He(f).force(\"link\",Ve(p).id(v=>v.id).distance(170).strength(.5)).force(\"charge\",Xe().strength(-500)).force(\"center\",Le(480,360).strength(.08)).force(\"collision\",Ge(v=>h(v)+24)).on(\"tick\",w);function w(){O.each(function(v){let M=V(this),R=v.source.x,D=v.source.y,X=v.target.x,tt=v.target.y;M.select(\".pm-edge-bg\").attr(\"x1\",R).attr(\"y1\",D).attr(\"x2\",X).attr(\"y2\",tt),M.select(\".pm-edge-line\").attr(\"x1\",R).attr(\"y1\",D).attr(\"x2\",X).attr(\"y2\",tt),M.select(\".pm-edge-label\").attr(\"transform\",`translate(${(R+X)/2},${(D+tt)/2})`)}),c.attr(\"transform\",v=>`translate(${v.x},${v.y})`)}let N=null,C=Ke().on(\"start\",(v,M)=>{N&&N!==M&&(N.fx=null,N.fy=null),v.active||k.alphaTarget(.3).restart(),M.fx=M.x,M.fy=M.y,N=M}).on(\"drag\",(v,M)=>{M.fx=v.x,M.fy=v.y}).on(\"end\",v=>{v.active||k.alphaTarget(0)});c.call(C),c.on(\"dblclick\",(v,M)=>{v.stopPropagation(),M.fx=null,M.fy=null,N===M&&(N=null),k.alphaTarget(.1).restart()});let z=fn().scaleExtent([.05,8]).filter(v=>v.type!==\"dblclick\").on(\"zoom\",v=>{a=v.transform,I.attr(\"transform\",v.transform.toString())});g.call(z),g.on(\"dblclick.zoom\",null),g.on(\"click\",()=>P()),c.on(\"click\",(v,M)=>{v.stopPropagation(),B(M,v)});let S=document.createElement(\"div\");S.className=\"pm-info-panel hidden\",s.appendChild(S);function B(v,M){var mn,dn,gn;let R=cn(v.id,v.color),D=Oi(n);S.style.background=D.panelBg,S.style.borderColor=D.panelBorder,S.style.color=D.panelText;let X=v.photo?`<img src=\"${$t(v.photo)}\" alt=\"${$t(v.name)}\"/>`:`<span style=\"width:100%;height:100%;display:flex;align-items:center;justify-content:center;background:${R}\">${$t(pn(v.name))}</span>`,tt=((mn=v.links)!=null?mn:[]).length>0?`<div class=\"pm-info-links\">${((dn=v.links)!=null?dn:[]).map(xn=>`<a class=\"pm-info-link\" href=\"${$t(xn.url)}\" target=\"_blank\" rel=\"noopener noreferrer\"\n style=\"color:${R};border-color:${R}22\">${$t(xn.label)}</a>`).join(\"\")}</div>`:\"\";S.innerHTML=`\n <div class=\"pm-info-header\">\n <div class=\"pm-info-avatar\" style=\"background:${R}\">${X}</div>\n <div>\n <div class=\"pm-info-name\" style=\"color:${D.panelText}\">${$t(v.name)}</div>\n ${v.pronouns?`<div class=\"pm-info-pronouns\" style=\"color:${D.panelMuted}\">${$t(v.pronouns)}</div>`:\"\"}\n </div>\n <button class=\"pm-info-close\" style=\"color:${D.panelText}\" aria-label=\"Close\">\\xD7</button>\n </div>\n ${tt}\n `,(gn=S.querySelector(\".pm-info-close\"))==null||gn.addEventListener(\"click\",P);let kt=s.getBoundingClientRect(),Ot=a.applyX(v.x),Dt=a.applyY(v.y),ht=240,le=120,Et=Ot+48,mt=Dt-40;Et+ht>kt.width-8&&(Et=Ot-ht-48),mt+le>kt.height-8&&(mt=kt.height-le-8),mt<8&&(mt=8),Et<8&&(Et=8),S.style.left=`${Et}px`,S.style.top=`${mt}px`,S.classList.remove(\"hidden\")}function P(){S.classList.add(\"hidden\")}let q=document.createElement(\"div\");q.className=\"pm-controls\",s.appendChild(q);let G=document.createElement(\"button\");G.className=\"pm-btn\",G.title=\"Toggle dark/light mode\",q.appendChild(G);let U=document.createElement(\"button\");U.className=\"pm-btn\",U.textContent=\"Legend\",U.title=\"Toggle legend\",q.appendChild(U);let j=document.createElement(\"button\");j.className=\"pm-btn\",j.title=\"Toggle edge labels\",q.appendChild(j);let Q=document.createElement(\"button\");Q.className=\"pm-btn\",Q.title=\"Toggle node names\",q.appendChild(Q);let W=document.createElement(\"button\");W.className=\"pm-btn\",W.textContent=\"\\u22A1 Fit\",W.title=\"Fit graph to view\",q.appendChild(W),W.addEventListener(\"click\",()=>{let v=_.getBoundingClientRect();if(!v.width)return;let M=f.map(mt=>mt.x),R=f.map(mt=>mt.y),D=Math.min(...M)-80,X=Math.min(...R)-80,tt=Math.max(...M)+80,kt=Math.max(...R)+80,Ot=tt-D,Dt=kt-X,ht=Math.min(.9,Math.min(v.width/Ot,v.height/Dt)),le=v.width/2-ht*(D+Ot/2),Et=v.height/2-ht*(X+Dt/2);g.transition().duration(500).call(z.transform,Nt.translate(le,Et).scale(ht))});let st=document.createElement(\"div\");st.className=\"pm-legend\",s.appendChild(st);let Bi=[...new Set(e.relationships.map(v=>v.type))];function Ri(v){st.style.background=v.legendBg,st.style.borderColor=v.panelBorder,st.style.color=v.panelText;let M=\"http://www.w3.org/2000/svg\";st.innerHTML=`<div class=\"pm-legend-title\" style=\"color:${v.panelMuted}\">Relationships</div>`+Bi.map(R=>{let D=Re[R],X=D.dashArray?`stroke-dasharray=\"${D.dashArray}\"`:\"\",tt=`<svg class=\"pm-legend-line\" width=\"32\" height=\"12\" viewBox=\"0 0 32 12\">\n ${D.double?`<line x1=\"0\" y1=\"6\" x2=\"32\" y2=\"6\" stroke=\"${v.panelBg}\" stroke-width=\"${D.width*2.6}\" stroke-linecap=\"round\"/>\n <line x1=\"0\" y1=\"6\" x2=\"32\" y2=\"6\" stroke=\"${D.color}\" stroke-width=\"${D.width}\" stroke-linecap=\"round\" ${X}/>`:`<line x1=\"0\" y1=\"6\" x2=\"32\" y2=\"6\" stroke=\"${D.color}\" stroke-width=\"${D.width}\" stroke-linecap=\"round\" ${X}/>`}\n </svg>`;return`<div class=\"pm-legend-item\" style=\"color:${v.panelText}\">${tt}<span>${D.label}</span></div>`}).join(\"\")}U.addEventListener(\"click\",()=>{r=!r,st.classList.toggle(\"hidden\",!r)}),j.addEventListener(\"click\",()=>{i=!i,O.selectAll(\".pm-edge-label\").style(\"display\",i?null:\"none\"),se()}),Q.addEventListener(\"click\",()=>{o=!o,c.selectAll(\".pm-label-bg, .pm-label-text\").style(\"display\",o?null:\"none\"),se()});function se(){let v=Oi(n);T.attr(\"fill\",v.bg),g.selectAll(\".pm-grid-path\").attr(\"stroke\",v.grid),O.each(function(M){let R=Re[M.relationship.type];V(this).select(\".pm-edge-label rect\").attr(\"fill\",v.edgeLabelBg),R.double&&V(this).select(\".pm-edge-bg\").attr(\"stroke\",v.bg)}),c.each(function(){V(this).select(\".pm-label-bg\").attr(\"fill\",v.nodeLabelBg),V(this).select(\".pm-label-text\").attr(\"fill\",v.text)}),[G,U,j,Q,W].forEach(M=>{M.style.background=v.btnBg,M.style.borderColor=v.btnBorder,M.style.color=v.btnText}),G.textContent=n?\"\\u2600 Light\":\"\\u263E Dark\",j.textContent=i?\"Labels On\":\"Labels Off\",Q.textContent=o?\"Names On\":\"Names Off\",Ri(v)}G.addEventListener(\"click\",()=>{n=!n,se()}),se(),setTimeout(()=>W.click(),600)}function $t(t){return t.replace(/&/g,\"&amp;\").replace(/</g,\"&lt;\").replace(/>/g,\"&gt;\").replace(/\"/g,\"&quot;\")}if(typeof window!=\"undefined\"){let t=function(){let e=window.__POLYMAP_DATA__,n=document.getElementById(\"polymap-root\");e&&n&&Di(n,e)};ds=t,document.readyState===\"loading\"?document.addEventListener(\"DOMContentLoaded\",t):t()}var ds;return Yi(gs);})();\n"; 3 + export const CLIENT_BUNDLE = "\"use strict\";var _PM=(()=>{var pe=Object.defineProperty,Fi=Object.defineProperties,Hi=Object.getOwnPropertyDescriptor,Xi=Object.getOwnPropertyDescriptors,Yi=Object.getOwnPropertyNames,kn=Object.getOwnPropertySymbols;var Mn=Object.prototype.hasOwnProperty,qi=Object.prototype.propertyIsEnumerable;var En=(t,e,n)=>e in t?pe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Ve=(t,e)=>{for(var n in e||(e={}))Mn.call(e,n)&&En(t,n,e[n]);if(kn)for(var n of kn(e))qi.call(e,n)&&En(t,n,e[n]);return t},Fe=(t,e)=>Fi(t,Xi(e));var Ui=(t,e)=>{for(var n in e)pe(t,n,{get:e[n],enumerable:!0})},Qi=(t,e,n,r)=>{if(e&&typeof e==\"object\"||typeof e==\"function\")for(let i of Yi(e))!Mn.call(t,i)&&i!==n&&pe(t,i,{get:()=>e[i],enumerable:!(r=Hi(e,i))||r.enumerable});return t};var Ki=t=>Qi(pe({},\"__esModule\",{value:!0}),t);var ws={};Ui(ws,{init:()=>Pi});function He(t,e){var n,r=1;t==null&&(t=0),e==null&&(e=0);function i(){var o,a=n.length,s,u=0,l=0;for(o=0;o<a;++o)s=n[o],u+=s.x,l+=s.y;for(u=(u/a-t)*r,l=(l/a-e)*r,o=0;o<a;++o)s=n[o],s.x-=u,s.y-=l}return i.initialize=function(o){n=o},i.x=function(o){return arguments.length?(t=+o,i):t},i.y=function(o){return arguments.length?(e=+o,i):e},i.strength=function(o){return arguments.length?(r=+o,i):r},i}function An(t){let e=+this._x.call(null,t),n=+this._y.call(null,t);return Sn(this.cover(e,n),e,n,t)}function Sn(t,e,n,r){if(isNaN(e)||isNaN(n))return t;var i,o=t._root,a={data:r},s=t._x0,u=t._y0,l=t._x1,f=t._y1,g,p,c,b,y,x,d,_;if(!o)return t._root=a,t;for(;o.length;)if((y=e>=(g=(s+l)/2))?s=g:l=g,(x=n>=(p=(u+f)/2))?u=p:f=p,i=o,!(o=o[d=x<<1|y]))return i[d]=a,t;if(c=+t._x.call(null,o.data),b=+t._y.call(null,o.data),e===c&&n===b)return a.next=o,i?i[d]=a:t._root=a,t;do i=i?i[d]=new Array(4):t._root=new Array(4),(y=e>=(g=(s+l)/2))?s=g:l=g,(x=n>=(p=(u+f)/2))?u=p:f=p;while((d=x<<1|y)===(_=(b>=p)<<1|c>=g));return i[_]=o,i[d]=a,t}function Tn(t){var e,n,r=t.length,i,o,a=new Array(r),s=new Array(r),u=1/0,l=1/0,f=-1/0,g=-1/0;for(n=0;n<r;++n)isNaN(i=+this._x.call(null,e=t[n]))||isNaN(o=+this._y.call(null,e))||(a[n]=i,s[n]=o,i<u&&(u=i),i>f&&(f=i),o<l&&(l=o),o>g&&(g=o));if(u>f||l>g)return this;for(this.cover(u,l).cover(f,g),n=0;n<r;++n)Sn(this,a[n],s[n],t[n]);return this}function Cn(t,e){if(isNaN(t=+t)||isNaN(e=+e))return this;var n=this._x0,r=this._y0,i=this._x1,o=this._y1;if(isNaN(n))i=(n=Math.floor(t))+1,o=(r=Math.floor(e))+1;else{for(var a=i-n||1,s=this._root,u,l;n>t||t>=i||r>e||e>=o;)switch(l=(e<r)<<1|t<n,u=new Array(4),u[l]=s,s=u,a*=2,l){case 0:i=n+a,o=r+a;break;case 1:n=i-a,o=r+a;break;case 2:i=n+a,r=o-a;break;case 3:n=i-a,r=o-a;break}this._root&&this._root.length&&(this._root=s)}return this._x0=n,this._y0=r,this._x1=i,this._y1=o,this}function In(){var t=[];return this.visit(function(e){if(!e.length)do t.push(e.data);while(e=e.next)}),t}function zn(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function K(t,e,n,r,i){this.node=t,this.x0=e,this.y0=n,this.x1=r,this.y1=i}function $n(t,e,n){var r,i=this._x0,o=this._y0,a,s,u,l,f=this._x1,g=this._y1,p=[],c=this._root,b,y;for(c&&p.push(new K(c,i,o,f,g)),n==null?n=1/0:(i=t-n,o=e-n,f=t+n,g=e+n,n*=n);b=p.pop();)if(!(!(c=b.node)||(a=b.x0)>f||(s=b.y0)>g||(u=b.x1)<i||(l=b.y1)<o))if(c.length){var x=(a+u)/2,d=(s+l)/2;p.push(new K(c[3],x,d,u,l),new K(c[2],a,d,x,l),new K(c[1],x,s,u,d),new K(c[0],a,s,x,d)),(y=(e>=d)<<1|t>=x)&&(b=p[p.length-1],p[p.length-1]=p[p.length-1-y],p[p.length-1-y]=b)}else{var _=t-+this._x.call(null,c.data),M=e-+this._y.call(null,c.data),m=_*_+M*M;if(m<n){var E=Math.sqrt(n=m);i=t-E,o=e-E,f=t+E,g=e+E,r=c.data}}return r}function On(t){if(isNaN(f=+this._x.call(null,t))||isNaN(g=+this._y.call(null,t)))return this;var e,n=this._root,r,i,o,a=this._x0,s=this._y0,u=this._x1,l=this._y1,f,g,p,c,b,y,x,d;if(!n)return this;if(n.length)for(;;){if((b=f>=(p=(a+u)/2))?a=p:u=p,(y=g>=(c=(s+l)/2))?s=c:l=c,e=n,!(n=n[x=y<<1|b]))return this;if(!n.length)break;(e[x+1&3]||e[x+2&3]||e[x+3&3])&&(r=e,d=x)}for(;n.data!==t;)if(i=n,!(n=n.next))return this;return(o=n.next)&&delete n.next,i?(o?i.next=o:delete i.next,this):e?(o?e[x]=o:delete e[x],(n=e[0]||e[1]||e[2]||e[3])&&n===(e[3]||e[2]||e[1]||e[0])&&!n.length&&(r?r[d]=n:this._root=n),this):(this._root=o,this)}function Dn(t){for(var e=0,n=t.length;e<n;++e)this.remove(t[e]);return this}function Bn(){return this._root}function Rn(){var t=0;return this.visit(function(e){if(!e.length)do++t;while(e=e.next)}),t}function Ln(t){var e=[],n,r=this._root,i,o,a,s,u;for(r&&e.push(new K(r,this._x0,this._y0,this._x1,this._y1));n=e.pop();)if(!t(r=n.node,o=n.x0,a=n.y0,s=n.x1,u=n.y1)&&r.length){var l=(o+s)/2,f=(a+u)/2;(i=r[3])&&e.push(new K(i,l,f,s,u)),(i=r[2])&&e.push(new K(i,o,f,l,u)),(i=r[1])&&e.push(new K(i,l,a,s,f)),(i=r[0])&&e.push(new K(i,o,a,l,f))}return this}function Pn(t){var e=[],n=[],r;for(this._root&&e.push(new K(this._root,this._x0,this._y0,this._x1,this._y1));r=e.pop();){var i=r.node;if(i.length){var o,a=r.x0,s=r.y0,u=r.x1,l=r.y1,f=(a+u)/2,g=(s+l)/2;(o=i[0])&&e.push(new K(o,a,s,f,g)),(o=i[1])&&e.push(new K(o,f,s,u,g)),(o=i[2])&&e.push(new K(o,a,g,f,l)),(o=i[3])&&e.push(new K(o,f,g,u,l))}n.push(r)}for(;r=n.pop();)t(r.node,r.x0,r.y0,r.x1,r.y1);return this}function Gn(t){return t[0]}function Vn(t){return arguments.length?(this._x=t,this):this._x}function Fn(t){return t[1]}function Hn(t){return arguments.length?(this._y=t,this):this._y}function St(t,e,n){var r=new Xe(e==null?Gn:e,n==null?Fn:n,NaN,NaN,NaN,NaN);return t==null?r:r.addAll(t)}function Xe(t,e,n,r,i,o){this._x=t,this._y=e,this._x0=n,this._y0=r,this._x1=i,this._y1=o,this._root=void 0}function Xn(t){for(var e={data:t.data},n=e;t=t.next;)n=n.next={data:t.data};return e}var et=St.prototype=Xe.prototype;et.copy=function(){var t=new Xe(this._x,this._y,this._x0,this._y0,this._x1,this._y1),e=this._root,n,r;if(!e)return t;if(!e.length)return t._root=Xn(e),t;for(n=[{source:e,target:t._root=new Array(4)}];e=n.pop();)for(var i=0;i<4;++i)(r=e.source[i])&&(r.length?n.push({source:r,target:e.target[i]=new Array(4)}):e.target[i]=Xn(r));return t};et.add=An;et.addAll=Tn;et.cover=Cn;et.data=In;et.extent=zn;et.find=$n;et.remove=On;et.removeAll=Dn;et.root=Bn;et.size=Rn;et.visit=Ln;et.visitAfter=Pn;et.x=Vn;et.y=Hn;function ct(t){return function(){return t}}function st(t){return(t()-.5)*1e-6}function Zi(t){return t.x+t.vx}function Wi(t){return t.y+t.vy}function Ye(t){var e,n,r,i=1,o=1;typeof t!=\"function\"&&(t=ct(t==null?1:+t));function a(){for(var l,f=e.length,g,p,c,b,y,x,d=0;d<o;++d)for(g=St(e,Zi,Wi).visitAfter(s),l=0;l<f;++l)p=e[l],y=n[p.index],x=y*y,c=p.x+p.vx,b=p.y+p.vy,g.visit(_);function _(M,m,E,S,I){var $=M.data,L=M.r,D=y+L;if($){if($.index>p.index){var V=c-$.x-$.vx,j=b-$.y-$.vy,F=V*V+j*j;F<D*D&&(V===0&&(V=st(r),F+=V*V),j===0&&(j=st(r),F+=j*j),F=(D-(F=Math.sqrt(F)))/F*i,p.vx+=(V*=F)*(D=(L*=L)/(x+L)),p.vy+=(j*=F)*D,$.vx-=V*(D=1-D),$.vy-=j*D)}return}return m>c+D||S<c-D||E>b+D||I<b-D}}function s(l){if(l.data)return l.r=n[l.data.index];for(var f=l.r=0;f<4;++f)l[f]&&l[f].r>l.r&&(l.r=l[f].r)}function u(){if(e){var l,f=e.length,g;for(n=new Array(f),l=0;l<f;++l)g=e[l],n[g.index]=+t(g,l,e)}}return a.initialize=function(l,f){e=l,r=f,u()},a.iterations=function(l){return arguments.length?(o=+l,a):o},a.strength=function(l){return arguments.length?(i=+l,a):i},a.radius=function(l){return arguments.length?(t=typeof l==\"function\"?l:ct(+l),u(),a):t},a}function Ji(t){return t.index}function Yn(t,e){var n=t.get(e);if(!n)throw new Error(\"node not found: \"+e);return n}function qe(t){var e=Ji,n=g,r,i=ct(30),o,a,s,u,l,f=1;t==null&&(t=[]);function g(x){return 1/Math.min(s[x.source.index],s[x.target.index])}function p(x){for(var d=0,_=t.length;d<f;++d)for(var M=0,m,E,S,I,$,L,D;M<_;++M)m=t[M],E=m.source,S=m.target,I=S.x+S.vx-E.x-E.vx||st(l),$=S.y+S.vy-E.y-E.vy||st(l),L=Math.sqrt(I*I+$*$),L=(L-o[M])/L*x*r[M],I*=L,$*=L,S.vx-=I*(D=u[M]),S.vy-=$*D,E.vx+=I*(D=1-D),E.vy+=$*D}function c(){if(a){var x,d=a.length,_=t.length,M=new Map(a.map((E,S)=>[e(E,S,a),E])),m;for(x=0,s=new Array(d);x<_;++x)m=t[x],m.index=x,typeof m.source!=\"object\"&&(m.source=Yn(M,m.source)),typeof m.target!=\"object\"&&(m.target=Yn(M,m.target)),s[m.source.index]=(s[m.source.index]||0)+1,s[m.target.index]=(s[m.target.index]||0)+1;for(x=0,u=new Array(_);x<_;++x)m=t[x],u[x]=s[m.source.index]/(s[m.source.index]+s[m.target.index]);r=new Array(_),b(),o=new Array(_),y()}}function b(){if(a)for(var x=0,d=t.length;x<d;++x)r[x]=+n(t[x],x,t)}function y(){if(a)for(var x=0,d=t.length;x<d;++x)o[x]=+i(t[x],x,t)}return p.initialize=function(x,d){a=x,l=d,c()},p.links=function(x){return arguments.length?(t=x,c(),p):t},p.id=function(x){return arguments.length?(e=x,p):e},p.iterations=function(x){return arguments.length?(f=+x,p):f},p.strength=function(x){return arguments.length?(n=typeof x==\"function\"?x:ct(+x),b(),p):n},p.distance=function(x){return arguments.length?(i=typeof x==\"function\"?x:ct(+x),y(),p):i},p}var ji={value:()=>{}};function Un(){for(var t=0,e=arguments.length,n={},r;t<e;++t){if(!(r=arguments[t]+\"\")||r in n||/[\\s.]/.test(r))throw new Error(\"illegal type: \"+r);n[r]=[]}return new he(n)}function he(t){this._=t}function to(t,e){return t.trim().split(/^|\\s+/).map(function(n){var r=\"\",i=n.indexOf(\".\");if(i>=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!e.hasOwnProperty(n))throw new Error(\"unknown type: \"+n);return{type:n,name:r}})}he.prototype=Un.prototype={constructor:he,on:function(t,e){var n=this._,r=to(t+\"\",n),i,o=-1,a=r.length;if(arguments.length<2){for(;++o<a;)if((i=(t=r[o]).type)&&(i=eo(n[i],t.name)))return i;return}if(e!=null&&typeof e!=\"function\")throw new Error(\"invalid callback: \"+e);for(;++o<a;)if(i=(t=r[o]).type)n[i]=qn(n[i],t.name,e);else if(e==null)for(i in n)n[i]=qn(n[i],t.name,null);return this},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new he(t)},call:function(t,e){if((i=arguments.length-2)>0)for(var n=new Array(i),r=0,i,o;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(t))throw new Error(\"unknown type: \"+t);for(o=this._[t],r=0,i=o.length;r<i;++r)o[r].value.apply(e,n)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error(\"unknown type: \"+t);for(var r=this._[t],i=0,o=r.length;i<o;++i)r[i].value.apply(e,n)}};function eo(t,e){for(var n=0,r=t.length,i;n<r;++n)if((i=t[n]).name===e)return i.value}function qn(t,e,n){for(var r=0,i=t.length;r<i;++r)if(t[r].name===e){t[r]=ji,t=t.slice(0,r).concat(t.slice(r+1));break}return n!=null&&t.push({name:e,value:n}),t}var dt=Un;var Pt=0,qt=0,Yt=0,Kn=1e3,me,Ut,de=0,Tt=0,ge=0,Qt=typeof performance==\"object\"&&performance.now?performance:Date,Zn=typeof window==\"object\"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Zt(){return Tt||(Zn(no),Tt=Qt.now()+ge)}function no(){Tt=0}function Kt(){this._call=this._time=this._next=null}Kt.prototype=Gt.prototype={constructor:Kt,restart:function(t,e,n){if(typeof t!=\"function\")throw new TypeError(\"callback is not a function\");n=(n==null?Zt():+n)+(e==null?0:+e),!this._next&&Ut!==this&&(Ut?Ut._next=this:me=this,Ut=this),this._call=t,this._time=n,Ue()},stop:function(){this._call&&(this._call=null,this._time=1/0,Ue())}};function Gt(t,e,n){var r=new Kt;return r.restart(t,e,n),r}function Wn(){Zt(),++Pt;for(var t=me,e;t;)(e=Tt-t._time)>=0&&t._call.call(void 0,e),t=t._next;--Pt}function Qn(){Tt=(de=Qt.now())+ge,Pt=qt=0;try{Wn()}finally{Pt=0,io(),Tt=0}}function ro(){var t=Qt.now(),e=t-de;e>Kn&&(ge-=e,de=t)}function io(){for(var t,e=me,n,r=1/0;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:me=n);Ut=t,Ue(r)}function Ue(t){if(!Pt){qt&&(qt=clearTimeout(qt));var e=t-Tt;e>24?(t<1/0&&(qt=setTimeout(Qn,t-Qt.now()-ge)),Yt&&(Yt=clearInterval(Yt))):(Yt||(de=Qt.now(),Yt=setInterval(ro,Kn)),Pt=1,Zn(Qn))}}function xe(t,e,n){var r=new Kt;return e=e==null?0:+e,r.restart(i=>{r.stop(),t(i+e)},e,n),r}function Jn(){let t=1;return()=>(t=(1664525*t+1013904223)%4294967296)/4294967296}function jn(t){return t.x}function tr(t){return t.y}var oo=10,ao=Math.PI*(3-Math.sqrt(5));function Qe(t){var e,n=1,r=.001,i=1-Math.pow(r,1/300),o=0,a=.6,s=new Map,u=Gt(g),l=dt(\"tick\",\"end\"),f=Jn();t==null&&(t=[]);function g(){p(),l.call(\"tick\",e),n<r&&(u.stop(),l.call(\"end\",e))}function p(y){var x,d=t.length,_;y===void 0&&(y=1);for(var M=0;M<y;++M)for(n+=(o-n)*i,s.forEach(function(m){m(n)}),x=0;x<d;++x)_=t[x],_.fx==null?_.x+=_.vx*=a:(_.x=_.fx,_.vx=0),_.fy==null?_.y+=_.vy*=a:(_.y=_.fy,_.vy=0);return e}function c(){for(var y=0,x=t.length,d;y<x;++y){if(d=t[y],d.index=y,d.fx!=null&&(d.x=d.fx),d.fy!=null&&(d.y=d.fy),isNaN(d.x)||isNaN(d.y)){var _=oo*Math.sqrt(.5+y),M=y*ao;d.x=_*Math.cos(M),d.y=_*Math.sin(M)}(isNaN(d.vx)||isNaN(d.vy))&&(d.vx=d.vy=0)}}function b(y){return y.initialize&&y.initialize(t,f),y}return c(),e={tick:p,restart:function(){return u.restart(g),e},stop:function(){return u.stop(),e},nodes:function(y){return arguments.length?(t=y,c(),s.forEach(b),e):t},alpha:function(y){return arguments.length?(n=+y,e):n},alphaMin:function(y){return arguments.length?(r=+y,e):r},alphaDecay:function(y){return arguments.length?(i=+y,e):+i},alphaTarget:function(y){return arguments.length?(o=+y,e):o},velocityDecay:function(y){return arguments.length?(a=1-y,e):1-a},randomSource:function(y){return arguments.length?(f=y,s.forEach(b),e):f},force:function(y,x){return arguments.length>1?(x==null?s.delete(y):s.set(y,b(x)),e):s.get(y)},find:function(y,x,d){var _=0,M=t.length,m,E,S,I,$;for(d==null?d=1/0:d*=d,_=0;_<M;++_)I=t[_],m=y-I.x,E=x-I.y,S=m*m+E*E,S<d&&($=I,d=S);return $},on:function(y,x){return arguments.length>1?(l.on(y,x),e):l.on(y)}}}function Ke(){var t,e,n,r,i=ct(-30),o,a=1,s=1/0,u=.81;function l(c){var b,y=t.length,x=St(t,jn,tr).visitAfter(g);for(r=c,b=0;b<y;++b)e=t[b],x.visit(p)}function f(){if(t){var c,b=t.length,y;for(o=new Array(b),c=0;c<b;++c)y=t[c],o[y.index]=+i(y,c,t)}}function g(c){var b=0,y,x,d=0,_,M,m;if(c.length){for(_=M=m=0;m<4;++m)(y=c[m])&&(x=Math.abs(y.value))&&(b+=y.value,d+=x,_+=x*y.x,M+=x*y.y);c.x=_/d,c.y=M/d}else{y=c,y.x=y.data.x,y.y=y.data.y;do b+=o[y.data.index];while(y=y.next)}c.value=b}function p(c,b,y,x){if(!c.value)return!0;var d=c.x-e.x,_=c.y-e.y,M=x-b,m=d*d+_*_;if(M*M/u<m)return m<s&&(d===0&&(d=st(n),m+=d*d),_===0&&(_=st(n),m+=_*_),m<a&&(m=Math.sqrt(a*m)),e.vx+=d*c.value*r/m,e.vy+=_*c.value*r/m),!0;if(c.length||m>=s)return;(c.data!==e||c.next)&&(d===0&&(d=st(n),m+=d*d),_===0&&(_=st(n),m+=_*_),m<a&&(m=Math.sqrt(a*m)));do c.data!==e&&(M=o[c.data.index]*r/m,e.vx+=d*M,e.vy+=_*M);while(c=c.next)}return l.initialize=function(c,b){t=c,n=b,f()},l.strength=function(c){return arguments.length?(i=typeof c==\"function\"?c:ct(+c),f(),l):i},l.distanceMin=function(c){return arguments.length?(a=c*c,l):Math.sqrt(a)},l.distanceMax=function(c){return arguments.length?(s=c*c,l):Math.sqrt(s)},l.theta=function(c){return arguments.length?(u=c*c,l):Math.sqrt(u)},l}var ye=\"http://www.w3.org/1999/xhtml\",Ze={svg:\"http://www.w3.org/2000/svg\",xhtml:ye,xlink:\"http://www.w3.org/1999/xlink\",xml:\"http://www.w3.org/XML/1998/namespace\",xmlns:\"http://www.w3.org/2000/xmlns/\"};function gt(t){var e=t+=\"\",n=e.indexOf(\":\");return n>=0&&(e=t.slice(0,n))!==\"xmlns\"&&(t=t.slice(n+1)),Ze.hasOwnProperty(e)?{space:Ze[e],local:t}:t}function so(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===ye&&e.documentElement.namespaceURI===ye?e.createElement(t):e.createElementNS(n,t)}}function lo(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function ve(t){var e=gt(t);return(e.local?lo:so)(e)}function uo(){}function Ct(t){return t==null?uo:function(){return this.querySelector(t)}}function er(t){typeof t!=\"function\"&&(t=Ct(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var o=e[i],a=o.length,s=r[i]=new Array(a),u,l,f=0;f<a;++f)(u=o[f])&&(l=t.call(u,u.__data__,f,o))&&(\"__data__\"in u&&(l.__data__=u.__data__),s[f]=l);return new X(r,this._parents)}function We(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function fo(){return[]}function Wt(t){return t==null?fo:function(){return this.querySelectorAll(t)}}function co(t){return function(){return We(t.apply(this,arguments))}}function nr(t){typeof t==\"function\"?t=co(t):t=Wt(t);for(var e=this._groups,n=e.length,r=[],i=[],o=0;o<n;++o)for(var a=e[o],s=a.length,u,l=0;l<s;++l)(u=a[l])&&(r.push(t.call(u,u.__data__,l,a)),i.push(u));return new X(r,i)}function Jt(t){return function(){return this.matches(t)}}function we(t){return function(e){return e.matches(t)}}var po=Array.prototype.find;function ho(t){return function(){return po.call(this.children,t)}}function mo(){return this.firstElementChild}function rr(t){return this.select(t==null?mo:ho(typeof t==\"function\"?t:we(t)))}var go=Array.prototype.filter;function xo(){return Array.from(this.children)}function yo(t){return function(){return go.call(this.children,t)}}function ir(t){return this.selectAll(t==null?xo:yo(typeof t==\"function\"?t:we(t)))}function or(t){typeof t!=\"function\"&&(t=Jt(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var o=e[i],a=o.length,s=r[i]=[],u,l=0;l<a;++l)(u=o[l])&&t.call(u,u.__data__,l,o)&&s.push(u);return new X(r,this._parents)}function _e(t){return new Array(t.length)}function ar(){return new X(this._enter||this._groups.map(_e),this._parents)}function jt(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}jt.prototype={constructor:jt,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 sr(t){return function(){return t}}function vo(t,e,n,r,i,o){for(var a=0,s,u=e.length,l=o.length;a<l;++a)(s=e[a])?(s.__data__=o[a],r[a]=s):n[a]=new jt(t,o[a]);for(;a<u;++a)(s=e[a])&&(i[a]=s)}function wo(t,e,n,r,i,o,a){var s,u,l=new Map,f=e.length,g=o.length,p=new Array(f),c;for(s=0;s<f;++s)(u=e[s])&&(p[s]=c=a.call(u,u.__data__,s,e)+\"\",l.has(c)?i[s]=u:l.set(c,u));for(s=0;s<g;++s)c=a.call(t,o[s],s,o)+\"\",(u=l.get(c))?(r[s]=u,u.__data__=o[s],l.delete(c)):n[s]=new jt(t,o[s]);for(s=0;s<f;++s)(u=e[s])&&l.get(p[s])===u&&(i[s]=u)}function _o(t){return t.__data__}function lr(t,e){if(!arguments.length)return Array.from(this,_o);var n=e?wo:vo,r=this._parents,i=this._groups;typeof t!=\"function\"&&(t=sr(t));for(var o=i.length,a=new Array(o),s=new Array(o),u=new Array(o),l=0;l<o;++l){var f=r[l],g=i[l],p=g.length,c=bo(t.call(f,f&&f.__data__,l,r)),b=c.length,y=s[l]=new Array(b),x=a[l]=new Array(b),d=u[l]=new Array(p);n(f,g,y,x,d,c,e);for(var _=0,M=0,m,E;_<b;++_)if(m=y[_]){for(_>=M&&(M=_+1);!(E=x[M])&&++M<b;);m._next=E||null}}return a=new X(a,r),a._enter=s,a._exit=u,a}function bo(t){return typeof t==\"object\"&&\"length\"in t?t:Array.from(t)}function ur(){return new X(this._exit||this._groups.map(_e),this._parents)}function fr(t,e,n){var r=this.enter(),i=this,o=this.exit();return typeof t==\"function\"?(r=t(r),r&&(r=r.selection())):r=r.append(t+\"\"),e!=null&&(i=e(i),i&&(i=i.selection())),n==null?o.remove():n(o),r&&i?r.merge(i).order():i}function cr(t){for(var e=t.selection?t.selection():t,n=this._groups,r=e._groups,i=n.length,o=r.length,a=Math.min(i,o),s=new Array(i),u=0;u<a;++u)for(var l=n[u],f=r[u],g=l.length,p=s[u]=new Array(g),c,b=0;b<g;++b)(c=l[b]||f[b])&&(p[b]=c);for(;u<i;++u)s[u]=n[u];return new X(s,this._parents)}function pr(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var r=t[e],i=r.length-1,o=r[i],a;--i>=0;)(a=r[i])&&(o&&a.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(a,o),o=a);return this}function hr(t){t||(t=No);function e(g,p){return g&&p?t(g.__data__,p.__data__):!g-!p}for(var n=this._groups,r=n.length,i=new Array(r),o=0;o<r;++o){for(var a=n[o],s=a.length,u=i[o]=new Array(s),l,f=0;f<s;++f)(l=a[f])&&(u[f]=l);u.sort(e)}return new X(i,this._parents).order()}function No(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function mr(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function dr(){return Array.from(this)}function gr(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],i=0,o=r.length;i<o;++i){var a=r[i];if(a)return a}return null}function xr(){let t=0;for(let e of this)++t;return t}function yr(){return!this.node()}function vr(t){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var i=e[n],o=0,a=i.length,s;o<a;++o)(s=i[o])&&t.call(s,s.__data__,o,i);return this}function ko(t){return function(){this.removeAttribute(t)}}function Eo(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Mo(t,e){return function(){this.setAttribute(t,e)}}function Ao(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function So(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttribute(t):this.setAttribute(t,n)}}function To(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function wr(t,e){var n=gt(t);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((e==null?n.local?Eo:ko:typeof e==\"function\"?n.local?To:So:n.local?Ao:Mo)(n,e))}function be(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function Co(t){return function(){this.style.removeProperty(t)}}function Io(t,e,n){return function(){this.style.setProperty(t,e,n)}}function zo(t,e,n){return function(){var r=e.apply(this,arguments);r==null?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function _r(t,e,n){return arguments.length>1?this.each((e==null?Co:typeof e==\"function\"?zo:Io)(t,e,n==null?\"\":n)):vt(this.node(),t)}function vt(t,e){return t.style.getPropertyValue(e)||be(t).getComputedStyle(t,null).getPropertyValue(e)}function $o(t){return function(){delete this[t]}}function Oo(t,e){return function(){this[t]=e}}function Do(t,e){return function(){var n=e.apply(this,arguments);n==null?delete this[t]:this[t]=n}}function br(t,e){return arguments.length>1?this.each((e==null?$o:typeof e==\"function\"?Do:Oo)(t,e)):this.node()[t]}function Nr(t){return t.trim().split(/^|\\s+/)}function Je(t){return t.classList||new kr(t)}function kr(t){this._node=t,this._names=Nr(t.getAttribute(\"class\")||\"\")}kr.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 Er(t,e){for(var n=Je(t),r=-1,i=e.length;++r<i;)n.add(e[r])}function Mr(t,e){for(var n=Je(t),r=-1,i=e.length;++r<i;)n.remove(e[r])}function Bo(t){return function(){Er(this,t)}}function Ro(t){return function(){Mr(this,t)}}function Lo(t,e){return function(){(e.apply(this,arguments)?Er:Mr)(this,t)}}function Ar(t,e){var n=Nr(t+\"\");if(arguments.length<2){for(var r=Je(this.node()),i=-1,o=n.length;++i<o;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof e==\"function\"?Lo:e?Bo:Ro)(n,e))}function Po(){this.textContent=\"\"}function Go(t){return function(){this.textContent=t}}function Vo(t){return function(){var e=t.apply(this,arguments);this.textContent=e==null?\"\":e}}function Sr(t){return arguments.length?this.each(t==null?Po:(typeof t==\"function\"?Vo:Go)(t)):this.node().textContent}function Fo(){this.innerHTML=\"\"}function Ho(t){return function(){this.innerHTML=t}}function Xo(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e==null?\"\":e}}function Tr(t){return arguments.length?this.each(t==null?Fo:(typeof t==\"function\"?Xo:Ho)(t)):this.node().innerHTML}function Yo(){this.nextSibling&&this.parentNode.appendChild(this)}function Cr(){return this.each(Yo)}function qo(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Ir(){return this.each(qo)}function zr(t){var e=typeof t==\"function\"?t:ve(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function Uo(){return null}function $r(t,e){var n=typeof t==\"function\"?t:ve(t),r=e==null?Uo:typeof e==\"function\"?e:Ct(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function Qo(){var t=this.parentNode;t&&t.removeChild(this)}function Or(){return this.each(Qo)}function Ko(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Zo(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Dr(t){return this.select(t?Zo:Ko)}function Br(t){return arguments.length?this.property(\"__data__\",t):this.node().__data__}function Wo(t){return function(e){t.call(this,e,this.__data__)}}function Jo(t){return t.trim().split(/^|\\s+/).map(function(e){var n=\"\",r=e.indexOf(\".\");return r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),{type:e,name:n}})}function jo(t){return function(){var e=this.__on;if(e){for(var n=0,r=-1,i=e.length,o;n<i;++n)o=e[n],(!t.type||o.type===t.type)&&o.name===t.name?this.removeEventListener(o.type,o.listener,o.options):e[++r]=o;++r?e.length=r:delete this.__on}}}function ta(t,e,n){return function(){var r=this.__on,i,o=Wo(e);if(r){for(var a=0,s=r.length;a<s;++a)if((i=r[a]).type===t.type&&i.name===t.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=o,i.options=n),i.value=e;return}}this.addEventListener(t.type,o,n),i={type:t.type,name:t.name,value:e,listener:o,options:n},r?r.push(i):this.__on=[i]}}function Rr(t,e,n){var r=Jo(t+\"\"),i,o=r.length,a;if(arguments.length<2){var s=this.node().__on;if(s){for(var u=0,l=s.length,f;u<l;++u)for(i=0,f=s[u];i<o;++i)if((a=r[i]).type===f.type&&a.name===f.name)return f.value}return}for(s=e?ta:jo,i=0;i<o;++i)this.each(s(r[i],e,n));return this}function Lr(t,e,n){var r=be(t),i=r.CustomEvent;typeof i==\"function\"?i=new i(e,n):(i=r.document.createEvent(\"Event\"),n?(i.initEvent(e,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(e,!1,!1)),t.dispatchEvent(i)}function ea(t,e){return function(){return Lr(this,t,e)}}function na(t,e){return function(){return Lr(this,t,e.apply(this,arguments))}}function Pr(t,e){return this.each((typeof e==\"function\"?na:ea)(t,e))}function*Gr(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],i=0,o=r.length,a;i<o;++i)(a=r[i])&&(yield a)}var je=[null];function X(t,e){this._groups=t,this._parents=e}function Vr(){return new X([[document.documentElement]],je)}function ra(){return this}X.prototype=Vr.prototype={constructor:X,select:er,selectAll:nr,selectChild:rr,selectChildren:ir,filter:or,data:lr,enter:ar,exit:ur,join:fr,merge:cr,selection:ra,order:pr,sort:hr,call:mr,nodes:dr,node:gr,size:xr,empty:yr,each:vr,attr:wr,style:_r,property:br,classed:Ar,text:Sr,html:Tr,raise:Cr,lower:Ir,append:zr,insert:$r,remove:Or,clone:Dr,datum:Br,on:Rr,dispatch:Pr,[Symbol.iterator]:Gr};var xt=Vr;function G(t){return typeof t==\"string\"?new X([[document.querySelector(t)]],[document.documentElement]):new X([[t]],je)}function Fr(t){let e;for(;e=t.sourceEvent;)t=e;return t}function ot(t,e){if(t=Fr(t),e===void 0&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=t.clientX,r.y=t.clientY,r=r.matrixTransform(e.getScreenCTM().inverse()),[r.x,r.y]}if(e.getBoundingClientRect){var i=e.getBoundingClientRect();return[t.clientX-i.left-e.clientLeft,t.clientY-i.top-e.clientTop]}}return[t.pageX,t.pageY]}var Hr={passive:!1},It={capture:!0,passive:!1};function Ne(t){t.stopImmediatePropagation()}function wt(t){t.preventDefault(),t.stopImmediatePropagation()}function te(t){var e=t.document.documentElement,n=G(t).on(\"dragstart.drag\",wt,It);\"onselectstart\"in e?n.on(\"selectstart.drag\",wt,It):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect=\"none\")}function ee(t,e){var n=t.document.documentElement,r=G(t).on(\"dragstart.drag\",null);e&&(r.on(\"click.drag\",wt,It),setTimeout(function(){r.on(\"click.drag\",null)},0)),\"onselectstart\"in n?r.on(\"selectstart.drag\",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}var ne=t=>()=>t;function re(t,{sourceEvent:e,subject:n,target:r,identifier:i,active:o,x:a,y:s,dx:u,dy:l,dispatch:f}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:o,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:u,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:f}})}re.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};function ia(t){return!t.ctrlKey&&!t.button}function oa(){return this.parentNode}function aa(t,e){return e==null?{x:t.x,y:t.y}:e}function sa(){return navigator.maxTouchPoints||\"ontouchstart\"in this}function tn(){var t=ia,e=oa,n=aa,r=sa,i={},o=dt(\"start\",\"drag\",\"end\"),a=0,s,u,l,f,g=0;function p(m){m.on(\"mousedown.drag\",c).filter(r).on(\"touchstart.drag\",x).on(\"touchmove.drag\",d,Hr).on(\"touchend.drag touchcancel.drag\",_).style(\"touch-action\",\"none\").style(\"-webkit-tap-highlight-color\",\"rgba(0,0,0,0)\")}function c(m,E){if(!(f||!t.call(this,m,E))){var S=M(this,e.call(this,m,E),m,E,\"mouse\");S&&(G(m.view).on(\"mousemove.drag\",b,It).on(\"mouseup.drag\",y,It),te(m.view),Ne(m),l=!1,s=m.clientX,u=m.clientY,S(\"start\",m))}}function b(m){if(wt(m),!l){var E=m.clientX-s,S=m.clientY-u;l=E*E+S*S>g}i.mouse(\"drag\",m)}function y(m){G(m.view).on(\"mousemove.drag mouseup.drag\",null),ee(m.view,l),wt(m),i.mouse(\"end\",m)}function x(m,E){if(t.call(this,m,E)){var S=m.changedTouches,I=e.call(this,m,E),$=S.length,L,D;for(L=0;L<$;++L)(D=M(this,I,m,E,S[L].identifier,S[L]))&&(Ne(m),D(\"start\",m,S[L]))}}function d(m){var E=m.changedTouches,S=E.length,I,$;for(I=0;I<S;++I)($=i[E[I].identifier])&&(wt(m),$(\"drag\",m,E[I]))}function _(m){var E=m.changedTouches,S=E.length,I,$;for(f&&clearTimeout(f),f=setTimeout(function(){f=null},500),I=0;I<S;++I)($=i[E[I].identifier])&&(Ne(m),$(\"end\",m,E[I]))}function M(m,E,S,I,$,L){var D=o.copy(),V=ot(L||S,E),j,F,h;if((h=n.call(m,new re(\"beforestart\",{sourceEvent:S,target:p,identifier:$,active:a,x:V[0],y:V[1],dx:0,dy:0,dispatch:D}),I))!=null)return j=h.x-V[0]||0,F=h.y-V[1]||0,function k(w,N,C){var z=V,T;switch(w){case\"start\":i[$]=k,T=a++;break;case\"end\":delete i[$],--a;case\"drag\":V=ot(C||N,E),T=a;break}D.call(w,m,new re(w,{sourceEvent:N,subject:h,target:p,identifier:$,active:T,x:V[0]+j,y:V[1]+F,dx:V[0]-z[0],dy:V[1]-z[1],dispatch:D}),I)}}return p.filter=function(m){return arguments.length?(t=typeof m==\"function\"?m:ne(!!m),p):t},p.container=function(m){return arguments.length?(e=typeof m==\"function\"?m:ne(m),p):e},p.subject=function(m){return arguments.length?(n=typeof m==\"function\"?m:ne(m),p):n},p.touchable=function(m){return arguments.length?(r=typeof m==\"function\"?m:ne(!!m),p):r},p.on=function(){var m=o.on.apply(o,arguments);return m===o?p:m},p.clickDistance=function(m){return arguments.length?(g=(m=+m)*m,p):Math.sqrt(g)},p}function ke(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function en(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function ae(){}var ie=.7,Ae=1/ie,Vt=\"\\\\s*([+-]?\\\\d+)\\\\s*\",oe=\"\\\\s*([+-]?(?:\\\\d*\\\\.)?\\\\d+(?:[eE][+-]?\\\\d+)?)\\\\s*\",pt=\"\\\\s*([+-]?(?:\\\\d*\\\\.)?\\\\d+(?:[eE][+-]?\\\\d+)?)%\\\\s*\",la=/^#([0-9a-f]{3,8})$/,ua=new RegExp(`^rgb\\\\(${Vt},${Vt},${Vt}\\\\)$`),fa=new RegExp(`^rgb\\\\(${pt},${pt},${pt}\\\\)$`),ca=new RegExp(`^rgba\\\\(${Vt},${Vt},${Vt},${oe}\\\\)$`),pa=new RegExp(`^rgba\\\\(${pt},${pt},${pt},${oe}\\\\)$`),ha=new RegExp(`^hsl\\\\(${oe},${pt},${pt}\\\\)$`),ma=new RegExp(`^hsla\\\\(${oe},${pt},${pt},${oe}\\\\)$`),Xr={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};ke(ae,_t,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Yr,formatHex:Yr,formatHex8:da,formatHsl:ga,formatRgb:qr,toString:qr});function Yr(){return this.rgb().formatHex()}function da(){return this.rgb().formatHex8()}function ga(){return Jr(this).formatHsl()}function qr(){return this.rgb().formatRgb()}function _t(t){var e,n;return t=(t+\"\").trim().toLowerCase(),(e=la.exec(t))?(n=e[1].length,e=parseInt(e[1],16),n===6?Ur(e):n===3?new it(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?Ee(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?Ee(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=ua.exec(t))?new it(e[1],e[2],e[3],1):(e=fa.exec(t))?new it(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=ca.exec(t))?Ee(e[1],e[2],e[3],e[4]):(e=pa.exec(t))?Ee(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=ha.exec(t))?Zr(e[1],e[2]/100,e[3]/100,1):(e=ma.exec(t))?Zr(e[1],e[2]/100,e[3]/100,e[4]):Xr.hasOwnProperty(t)?Ur(Xr[t]):t===\"transparent\"?new it(NaN,NaN,NaN,0):null}function Ur(t){return new it(t>>16&255,t>>8&255,t&255,1)}function Ee(t,e,n,r){return r<=0&&(t=e=n=NaN),new it(t,e,n,r)}function xa(t){return t instanceof ae||(t=_t(t)),t?(t=t.rgb(),new it(t.r,t.g,t.b,t.opacity)):new it}function Ft(t,e,n,r){return arguments.length===1?xa(t):new it(t,e,n,r==null?1:r)}function it(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}ke(it,Ft,en(ae,{brighter(t){return t=t==null?Ae:Math.pow(Ae,t),new it(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?ie:Math.pow(ie,t),new it(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new it($t(this.r),$t(this.g),$t(this.b),Se(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:Qr,formatHex:Qr,formatHex8:ya,formatRgb:Kr,toString:Kr}));function Qr(){return`#${zt(this.r)}${zt(this.g)}${zt(this.b)}`}function ya(){return`#${zt(this.r)}${zt(this.g)}${zt(this.b)}${zt((isNaN(this.opacity)?1:this.opacity)*255)}`}function Kr(){let t=Se(this.opacity);return`${t===1?\"rgb(\":\"rgba(\"}${$t(this.r)}, ${$t(this.g)}, ${$t(this.b)}${t===1?\")\":`, ${t})`}`}function Se(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function $t(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function zt(t){return t=$t(t),(t<16?\"0\":\"\")+t.toString(16)}function Zr(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new lt(t,e,n,r)}function Jr(t){if(t instanceof lt)return new lt(t.h,t.s,t.l,t.opacity);if(t instanceof ae||(t=_t(t)),!t)return new lt;if(t instanceof lt)return t;t=t.rgb();var e=t.r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),o=Math.max(e,n,r),a=NaN,s=o-i,u=(o+i)/2;return s?(e===o?a=(n-r)/s+(n<r)*6:n===o?a=(r-e)/s+2:a=(e-n)/s+4,s/=u<.5?o+i:2-o-i,a*=60):s=u>0&&u<1?0:a,new lt(a,s,u,t.opacity)}function jr(t,e,n,r){return arguments.length===1?Jr(t):new lt(t,e,n,r==null?1:r)}function lt(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}ke(lt,jr,en(ae,{brighter(t){return t=t==null?Ae:Math.pow(Ae,t),new lt(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?ie:Math.pow(ie,t),new lt(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,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new it(nn(t>=240?t-240:t+120,i,r),nn(t,i,r),nn(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new lt(Wr(this.h),Me(this.s),Me(this.l),Se(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(){let t=Se(this.opacity);return`${t===1?\"hsl(\":\"hsla(\"}${Wr(this.h)}, ${Me(this.s)*100}%, ${Me(this.l)*100}%${t===1?\")\":`, ${t})`}`}}));function Wr(t){return t=(t||0)%360,t<0?t+360:t}function Me(t){return Math.max(0,Math.min(1,t||0))}function nn(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}function rn(t,e,n,r,i){var o=t*t,a=o*t;return((1-3*t+3*o-a)*e+(4-6*o+3*a)*n+(1+3*t+3*o-3*a)*r+a*i)/6}function ti(t){var e=t.length-1;return function(n){var r=n<=0?n=0:n>=1?(n=1,e-1):Math.floor(n*e),i=t[r],o=t[r+1],a=r>0?t[r-1]:2*i-o,s=r<e-1?t[r+2]:2*o-i;return rn((n-r/e)*e,a,i,o,s)}}function ei(t){var e=t.length;return function(n){var r=Math.floor(((n%=1)<0?++n:n)*e),i=t[(r+e-1)%e],o=t[r%e],a=t[(r+1)%e],s=t[(r+2)%e];return rn((n-r/e)*e,i,o,a,s)}}var on=t=>()=>t;function va(t,e){return function(n){return t+n*e}}function wa(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}function ni(t){return(t=+t)==1?Te:function(e,n){return n-e?wa(e,n,t):on(isNaN(e)?n:e)}}function Te(t,e){var n=e-t;return n?va(t,n):on(isNaN(t)?e:t)}var Ce=(function t(e){var n=ni(e);function r(i,o){var a=n((i=Ft(i)).r,(o=Ft(o)).r),s=n(i.g,o.g),u=n(i.b,o.b),l=Te(i.opacity,o.opacity);return function(f){return i.r=a(f),i.g=s(f),i.b=u(f),i.opacity=l(f),i+\"\"}}return r.gamma=t,r})(1);function ri(t){return function(e){var n=e.length,r=new Array(n),i=new Array(n),o=new Array(n),a,s;for(a=0;a<n;++a)s=Ft(e[a]),r[a]=s.r||0,i[a]=s.g||0,o[a]=s.b||0;return r=t(r),i=t(i),o=t(o),s.opacity=1,function(u){return s.r=r(u),s.g=i(u),s.b=o(u),s+\"\"}}}var _a=ri(ti),ba=ri(ei);function at(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}var sn=/[-+]?(?:\\d+\\.?\\d*|\\.?\\d+)(?:[eE][-+]?\\d+)?/g,an=new RegExp(sn.source,\"g\");function Na(t){return function(){return t}}function ka(t){return function(e){return t(e)+\"\"}}function ln(t,e){var n=sn.lastIndex=an.lastIndex=0,r,i,o,a=-1,s=[],u=[];for(t=t+\"\",e=e+\"\";(r=sn.exec(t))&&(i=an.exec(e));)(o=i.index)>n&&(o=e.slice(n,o),s[a]?s[a]+=o:s[++a]=o),(r=r[0])===(i=i[0])?s[a]?s[a]+=i:s[++a]=i:(s[++a]=null,u.push({i:a,x:at(r,i)})),n=an.lastIndex;return n<e.length&&(o=e.slice(n),s[a]?s[a]+=o:s[++a]=o),s.length<2?u[0]?ka(u[0].x):Na(e):(e=u.length,function(l){for(var f=0,g;f<e;++f)s[(g=u[f]).i]=g.x(l);return s.join(\"\")})}var ii=180/Math.PI,Ie={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function un(t,e,n,r,i,o){var a,s,u;return(a=Math.sqrt(t*t+e*e))&&(t/=a,e/=a),(u=t*n+e*r)&&(n-=t*u,r-=e*u),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,u/=s),t*r<e*n&&(t=-t,e=-e,u=-u,a=-a),{translateX:i,translateY:o,rotate:Math.atan2(e,t)*ii,skewX:Math.atan(u)*ii,scaleX:a,scaleY:s}}var ze;function oi(t){let e=new(typeof DOMMatrix==\"function\"?DOMMatrix:WebKitCSSMatrix)(t+\"\");return e.isIdentity?Ie:un(e.a,e.b,e.c,e.d,e.e,e.f)}function ai(t){return t==null?Ie:(ze||(ze=document.createElementNS(\"http://www.w3.org/2000/svg\",\"g\")),ze.setAttribute(\"transform\",t),(t=ze.transform.baseVal.consolidate())?(t=t.matrix,un(t.a,t.b,t.c,t.d,t.e,t.f)):Ie)}function si(t,e,n,r){function i(l){return l.length?l.pop()+\" \":\"\"}function o(l,f,g,p,c,b){if(l!==g||f!==p){var y=c.push(\"translate(\",null,e,null,n);b.push({i:y-4,x:at(l,g)},{i:y-2,x:at(f,p)})}else(g||p)&&c.push(\"translate(\"+g+e+p+n)}function a(l,f,g,p){l!==f?(l-f>180?f+=360:f-l>180&&(l+=360),p.push({i:g.push(i(g)+\"rotate(\",null,r)-2,x:at(l,f)})):f&&g.push(i(g)+\"rotate(\"+f+r)}function s(l,f,g,p){l!==f?p.push({i:g.push(i(g)+\"skewX(\",null,r)-2,x:at(l,f)}):f&&g.push(i(g)+\"skewX(\"+f+r)}function u(l,f,g,p,c,b){if(l!==g||f!==p){var y=c.push(i(c)+\"scale(\",null,\",\",null,\")\");b.push({i:y-4,x:at(l,g)},{i:y-2,x:at(f,p)})}else(g!==1||p!==1)&&c.push(i(c)+\"scale(\"+g+\",\"+p+\")\")}return function(l,f){var g=[],p=[];return l=t(l),f=t(f),o(l.translateX,l.translateY,f.translateX,f.translateY,g,p),a(l.rotate,f.rotate,g,p),s(l.skewX,f.skewX,g,p),u(l.scaleX,l.scaleY,f.scaleX,f.scaleY,g,p),l=f=null,function(c){for(var b=-1,y=p.length,x;++b<y;)g[(x=p[b]).i]=x.x(c);return g.join(\"\")}}}var fn=si(oi,\"px, \",\"px)\",\"deg)\"),cn=si(ai,\", \",\")\",\")\");var Ea=1e-12;function li(t){return((t=Math.exp(t))+1/t)/2}function Ma(t){return((t=Math.exp(t))-1/t)/2}function Aa(t){return((t=Math.exp(2*t))-1)/(t+1)}var pn=(function t(e,n,r){function i(o,a){var s=o[0],u=o[1],l=o[2],f=a[0],g=a[1],p=a[2],c=f-s,b=g-u,y=c*c+b*b,x,d;if(y<Ea)d=Math.log(p/l)/e,x=function(I){return[s+I*c,u+I*b,l*Math.exp(e*I*d)]};else{var _=Math.sqrt(y),M=(p*p-l*l+r*y)/(2*l*n*_),m=(p*p-l*l-r*y)/(2*p*n*_),E=Math.log(Math.sqrt(M*M+1)-M),S=Math.log(Math.sqrt(m*m+1)-m);d=(S-E)/e,x=function(I){var $=I*d,L=li(E),D=l/(n*_)*(L*Aa(e*$+E)-Ma(E));return[s+D*c,u+D*b,l*L/li(e*$+E)]}}return x.duration=d*1e3*e/Math.SQRT2,x}return i.rho=function(o){var a=Math.max(.001,+o),s=a*a,u=s*s;return t(a,s,u)},i})(Math.SQRT2,2,4);var Sa=dt(\"start\",\"end\",\"cancel\",\"interrupt\"),Ta=[],ci=0,ui=1,Oe=2,$e=3,fi=4,De=5,se=6;function bt(t,e,n,r,i,o){var a=t.__transition;if(!a)t.__transition={};else if(n in a)return;Ca(t,n,{name:e,index:r,group:i,on:Sa,tween:Ta,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:ci})}function le(t,e){var n=q(t,e);if(n.state>ci)throw new Error(\"too late; already scheduled\");return n}function W(t,e){var n=q(t,e);if(n.state>$e)throw new Error(\"too late; already running\");return n}function q(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error(\"transition not found\");return n}function Ca(t,e,n){var r=t.__transition,i;r[e]=n,n.timer=Gt(o,0,n.time);function o(l){n.state=ui,n.timer.restart(a,n.delay,n.time),n.delay<=l&&a(l-n.delay)}function a(l){var f,g,p,c;if(n.state!==ui)return u();for(f in r)if(c=r[f],c.name===n.name){if(c.state===$e)return xe(a);c.state===fi?(c.state=se,c.timer.stop(),c.on.call(\"interrupt\",t,t.__data__,c.index,c.group),delete r[f]):+f<e&&(c.state=se,c.timer.stop(),c.on.call(\"cancel\",t,t.__data__,c.index,c.group),delete r[f])}if(xe(function(){n.state===$e&&(n.state=fi,n.timer.restart(s,n.delay,n.time),s(l))}),n.state=Oe,n.on.call(\"start\",t,t.__data__,n.index,n.group),n.state===Oe){for(n.state=$e,i=new Array(p=n.tween.length),f=0,g=-1;f<p;++f)(c=n.tween[f].value.call(t,t.__data__,n.index,n.group))&&(i[++g]=c);i.length=g+1}}function s(l){for(var f=l<n.duration?n.ease.call(null,l/n.duration):(n.timer.restart(u),n.state=De,1),g=-1,p=i.length;++g<p;)i[g].call(t,f);n.state===De&&(n.on.call(\"end\",t,t.__data__,n.index,n.group),u())}function u(){n.state=se,n.timer.stop(),delete r[e];for(var l in r)return;delete t.__transition}}function Ot(t,e){var n=t.__transition,r,i,o=!0,a;if(n){e=e==null?null:e+\"\";for(a in n){if((r=n[a]).name!==e){o=!1;continue}i=r.state>Oe&&r.state<De,r.state=se,r.timer.stop(),r.on.call(i?\"interrupt\":\"cancel\",t,t.__data__,r.index,r.group),delete n[a]}o&&delete t.__transition}}function pi(t){return this.each(function(){Ot(this,t)})}function Ia(t,e){var n,r;return function(){var i=W(this,t),o=i.tween;if(o!==n){r=n=o;for(var a=0,s=r.length;a<s;++a)if(r[a].name===e){r=r.slice(),r.splice(a,1);break}}i.tween=r}}function za(t,e,n){var r,i;if(typeof n!=\"function\")throw new Error;return function(){var o=W(this,t),a=o.tween;if(a!==r){i=(r=a).slice();for(var s={name:e,value:n},u=0,l=i.length;u<l;++u)if(i[u].name===e){i[u]=s;break}u===l&&i.push(s)}o.tween=i}}function hi(t,e){var n=this._id;if(t+=\"\",arguments.length<2){for(var r=q(this.node(),n).tween,i=0,o=r.length,a;i<o;++i)if((a=r[i]).name===t)return a.value;return null}return this.each((e==null?Ia:za)(n,t,e))}function Ht(t,e,n){var r=t._id;return t.each(function(){var i=W(this,r);(i.value||(i.value={}))[e]=n.apply(this,arguments)}),function(i){return q(i,r).value[e]}}function Be(t,e){var n;return(typeof e==\"number\"?at:e instanceof _t?Ce:(n=_t(e))?(e=n,Ce):ln)(t,e)}function $a(t){return function(){this.removeAttribute(t)}}function Oa(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Da(t,e,n){var r,i=n+\"\",o;return function(){var a=this.getAttribute(t);return a===i?null:a===r?o:o=e(r=a,n)}}function Ba(t,e,n){var r,i=n+\"\",o;return function(){var a=this.getAttributeNS(t.space,t.local);return a===i?null:a===r?o:o=e(r=a,n)}}function Ra(t,e,n){var r,i,o;return function(){var a,s=n(this),u;return s==null?void this.removeAttribute(t):(a=this.getAttribute(t),u=s+\"\",a===u?null:a===r&&u===i?o:(i=u,o=e(r=a,s)))}}function La(t,e,n){var r,i,o;return function(){var a,s=n(this),u;return s==null?void this.removeAttributeNS(t.space,t.local):(a=this.getAttributeNS(t.space,t.local),u=s+\"\",a===u?null:a===r&&u===i?o:(i=u,o=e(r=a,s)))}}function mi(t,e){var n=gt(t),r=n===\"transform\"?cn:Be;return this.attrTween(t,typeof e==\"function\"?(n.local?La:Ra)(n,r,Ht(this,\"attr.\"+t,e)):e==null?(n.local?Oa:$a)(n):(n.local?Ba:Da)(n,r,e))}function Pa(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}function Ga(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}function Va(t,e){var n,r;function i(){var o=e.apply(this,arguments);return o!==r&&(n=(r=o)&&Ga(t,o)),n}return i._value=e,i}function Fa(t,e){var n,r;function i(){var o=e.apply(this,arguments);return o!==r&&(n=(r=o)&&Pa(t,o)),n}return i._value=e,i}function di(t,e){var n=\"attr.\"+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!=\"function\")throw new Error;var r=gt(t);return this.tween(n,(r.local?Va:Fa)(r,e))}function Ha(t,e){return function(){le(this,t).delay=+e.apply(this,arguments)}}function Xa(t,e){return e=+e,function(){le(this,t).delay=e}}function gi(t){var e=this._id;return arguments.length?this.each((typeof t==\"function\"?Ha:Xa)(e,t)):q(this.node(),e).delay}function Ya(t,e){return function(){W(this,t).duration=+e.apply(this,arguments)}}function qa(t,e){return e=+e,function(){W(this,t).duration=e}}function xi(t){var e=this._id;return arguments.length?this.each((typeof t==\"function\"?Ya:qa)(e,t)):q(this.node(),e).duration}function Ua(t,e){if(typeof e!=\"function\")throw new Error;return function(){W(this,t).ease=e}}function yi(t){var e=this._id;return arguments.length?this.each(Ua(e,t)):q(this.node(),e).ease}function Qa(t,e){return function(){var n=e.apply(this,arguments);if(typeof n!=\"function\")throw new Error;W(this,t).ease=n}}function vi(t){if(typeof t!=\"function\")throw new Error;return this.each(Qa(this._id,t))}function wi(t){typeof t!=\"function\"&&(t=Jt(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var o=e[i],a=o.length,s=r[i]=[],u,l=0;l<a;++l)(u=o[l])&&t.call(u,u.__data__,l,o)&&s.push(u);return new nt(r,this._parents,this._name,this._id)}function _i(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,r=e.length,i=n.length,o=Math.min(r,i),a=new Array(r),s=0;s<o;++s)for(var u=e[s],l=n[s],f=u.length,g=a[s]=new Array(f),p,c=0;c<f;++c)(p=u[c]||l[c])&&(g[c]=p);for(;s<r;++s)a[s]=e[s];return new nt(a,this._parents,this._name,this._id)}function Ka(t){return(t+\"\").trim().split(/^|\\s+/).every(function(e){var n=e.indexOf(\".\");return n>=0&&(e=e.slice(0,n)),!e||e===\"start\"})}function Za(t,e,n){var r,i,o=Ka(e)?le:W;return function(){var a=o(this,t),s=a.on;s!==r&&(i=(r=s).copy()).on(e,n),a.on=i}}function bi(t,e){var n=this._id;return arguments.length<2?q(this.node(),n).on.on(t):this.each(Za(n,t,e))}function Wa(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}function Ni(){return this.on(\"end.remove\",Wa(this._id))}function ki(t){var e=this._name,n=this._id;typeof t!=\"function\"&&(t=Ct(t));for(var r=this._groups,i=r.length,o=new Array(i),a=0;a<i;++a)for(var s=r[a],u=s.length,l=o[a]=new Array(u),f,g,p=0;p<u;++p)(f=s[p])&&(g=t.call(f,f.__data__,p,s))&&(\"__data__\"in f&&(g.__data__=f.__data__),l[p]=g,bt(l[p],e,n,p,l,q(f,n)));return new nt(o,this._parents,e,n)}function Ei(t){var e=this._name,n=this._id;typeof t!=\"function\"&&(t=Wt(t));for(var r=this._groups,i=r.length,o=[],a=[],s=0;s<i;++s)for(var u=r[s],l=u.length,f,g=0;g<l;++g)if(f=u[g]){for(var p=t.call(f,f.__data__,g,u),c,b=q(f,n),y=0,x=p.length;y<x;++y)(c=p[y])&&bt(c,e,n,y,p,b);o.push(p),a.push(f)}return new nt(o,a,e,n)}var Ja=xt.prototype.constructor;function Mi(){return new Ja(this._groups,this._parents)}function ja(t,e){var n,r,i;return function(){var o=vt(this,t),a=(this.style.removeProperty(t),vt(this,t));return o===a?null:o===n&&a===r?i:i=e(n=o,r=a)}}function Ai(t){return function(){this.style.removeProperty(t)}}function ts(t,e,n){var r,i=n+\"\",o;return function(){var a=vt(this,t);return a===i?null:a===r?o:o=e(r=a,n)}}function es(t,e,n){var r,i,o;return function(){var a=vt(this,t),s=n(this),u=s+\"\";return s==null&&(u=s=(this.style.removeProperty(t),vt(this,t))),a===u?null:a===r&&u===i?o:(i=u,o=e(r=a,s))}}function ns(t,e){var n,r,i,o=\"style.\"+e,a=\"end.\"+o,s;return function(){var u=W(this,t),l=u.on,f=u.value[o]==null?s||(s=Ai(e)):void 0;(l!==n||i!==f)&&(r=(n=l).copy()).on(a,i=f),u.on=r}}function Si(t,e,n){var r=(t+=\"\")==\"transform\"?fn:Be;return e==null?this.styleTween(t,ja(t,r)).on(\"end.style.\"+t,Ai(t)):typeof e==\"function\"?this.styleTween(t,es(t,r,Ht(this,\"style.\"+t,e))).each(ns(this._id,t)):this.styleTween(t,ts(t,r,e),n).on(\"end.style.\"+t,null)}function rs(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}function is(t,e,n){var r,i;function o(){var a=e.apply(this,arguments);return a!==i&&(r=(i=a)&&rs(t,a,n)),r}return o._value=e,o}function Ti(t,e,n){var r=\"style.\"+(t+=\"\");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(e==null)return this.tween(r,null);if(typeof e!=\"function\")throw new Error;return this.tween(r,is(t,e,n==null?\"\":n))}function os(t){return function(){this.textContent=t}}function as(t){return function(){var e=t(this);this.textContent=e==null?\"\":e}}function Ci(t){return this.tween(\"text\",typeof t==\"function\"?as(Ht(this,\"text\",t)):os(t==null?\"\":t+\"\"))}function ss(t){return function(e){this.textContent=t.call(this,e)}}function ls(t){var e,n;function r(){var i=t.apply(this,arguments);return i!==n&&(e=(n=i)&&ss(i)),e}return r._value=t,r}function Ii(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,ls(t))}function zi(){for(var t=this._name,e=this._id,n=Re(),r=this._groups,i=r.length,o=0;o<i;++o)for(var a=r[o],s=a.length,u,l=0;l<s;++l)if(u=a[l]){var f=q(u,e);bt(u,t,n,l,a,{time:f.time+f.delay+f.duration,delay:0,duration:f.duration,ease:f.ease})}return new nt(r,this._parents,t,n)}function $i(){var t,e,n=this,r=n._id,i=n.size();return new Promise(function(o,a){var s={value:a},u={value:function(){--i===0&&o()}};n.each(function(){var l=W(this,r),f=l.on;f!==t&&(e=(t=f).copy(),e._.cancel.push(s),e._.interrupt.push(s),e._.end.push(u)),l.on=e}),i===0&&o()})}var us=0;function nt(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function Oi(t){return xt().transition(t)}function Re(){return++us}var yt=xt.prototype;nt.prototype=Oi.prototype={constructor:nt,select:ki,selectAll:Ei,selectChild:yt.selectChild,selectChildren:yt.selectChildren,filter:wi,merge:_i,selection:Mi,transition:zi,call:yt.call,nodes:yt.nodes,node:yt.node,size:yt.size,empty:yt.empty,each:yt.each,on:bi,attr:mi,attrTween:di,style:Si,styleTween:Ti,text:Ci,textTween:Ii,remove:Ni,tween:hi,delay:gi,duration:xi,ease:yi,easeVarying:vi,end:$i,[Symbol.iterator]:yt[Symbol.iterator]};function Le(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var fs={time:null,delay:0,duration:250,ease:Le};function cs(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}function Di(t){var e,n;t instanceof nt?(e=t._id,t=t._name):(e=Re(),(n=fs).time=Zt(),t=t==null?null:t+\"\");for(var r=this._groups,i=r.length,o=0;o<i;++o)for(var a=r[o],s=a.length,u,l=0;l<s;++l)(u=a[l])&&bt(u,t,e,l,a,n||cs(u,e));return new nt(r,this._parents,t,e)}xt.prototype.interrupt=pi;xt.prototype.transition=Di;var ue=t=>()=>t;function hn(t,{sourceEvent:e,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function ut(t,e,n){this.k=t,this.x=e,this.y=n}ut.prototype={constructor:ut,scale:function(t){return t===1?this:new ut(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new ut(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return\"translate(\"+this.x+\",\"+this.y+\") scale(\"+this.k+\")\"}};var Nt=new ut(1,0,0);mn.prototype=ut.prototype;function mn(t){for(;!t.__zoom;)if(!(t=t.parentNode))return Nt;return t.__zoom}function Pe(t){t.stopImmediatePropagation()}function Xt(t){t.preventDefault(),t.stopImmediatePropagation()}function ps(t){return(!t.ctrlKey||t.type===\"wheel\")&&!t.button}function hs(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t,t.hasAttribute(\"viewBox\")?(t=t.viewBox.baseVal,[[t.x,t.y],[t.x+t.width,t.y+t.height]]):[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]):[[0,0],[t.clientWidth,t.clientHeight]]}function Bi(){return this.__zoom||Nt}function ms(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function ds(){return navigator.maxTouchPoints||\"ontouchstart\"in this}function gs(t,e,n){var r=t.invertX(e[0][0])-n[0][0],i=t.invertX(e[1][0])-n[1][0],o=t.invertY(e[0][1])-n[0][1],a=t.invertY(e[1][1])-n[1][1];return t.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),a>o?(o+a)/2:Math.min(0,o)||Math.max(0,a))}function dn(){var t=ps,e=hs,n=gs,r=ms,i=ds,o=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],s=250,u=pn,l=dt(\"start\",\"zoom\",\"end\"),f,g,p,c=500,b=150,y=0,x=10;function d(h){h.property(\"__zoom\",Bi).on(\"wheel.zoom\",$,{passive:!1}).on(\"mousedown.zoom\",L).on(\"dblclick.zoom\",D).filter(i).on(\"touchstart.zoom\",V).on(\"touchmove.zoom\",j).on(\"touchend.zoom touchcancel.zoom\",F).style(\"-webkit-tap-highlight-color\",\"rgba(0,0,0,0)\")}d.transform=function(h,k,w,N){var C=h.selection?h.selection():h;C.property(\"__zoom\",Bi),h!==C?E(h,k,w,N):C.interrupt().each(function(){S(this,arguments).event(N).start().zoom(null,typeof k==\"function\"?k.apply(this,arguments):k).end()})},d.scaleBy=function(h,k,w,N){d.scaleTo(h,function(){var C=this.__zoom.k,z=typeof k==\"function\"?k.apply(this,arguments):k;return C*z},w,N)},d.scaleTo=function(h,k,w,N){d.transform(h,function(){var C=e.apply(this,arguments),z=this.__zoom,T=w==null?m(C):typeof w==\"function\"?w.apply(this,arguments):w,B=z.invert(T),P=typeof k==\"function\"?k.apply(this,arguments):k;return n(M(_(z,P),T,B),C,a)},w,N)},d.translateBy=function(h,k,w,N){d.transform(h,function(){return n(this.__zoom.translate(typeof k==\"function\"?k.apply(this,arguments):k,typeof w==\"function\"?w.apply(this,arguments):w),e.apply(this,arguments),a)},null,N)},d.translateTo=function(h,k,w,N,C){d.transform(h,function(){var z=e.apply(this,arguments),T=this.__zoom,B=N==null?m(z):typeof N==\"function\"?N.apply(this,arguments):N;return n(Nt.translate(B[0],B[1]).scale(T.k).translate(typeof k==\"function\"?-k.apply(this,arguments):-k,typeof w==\"function\"?-w.apply(this,arguments):-w),z,a)},N,C)};function _(h,k){return k=Math.max(o[0],Math.min(o[1],k)),k===h.k?h:new ut(k,h.x,h.y)}function M(h,k,w){var N=k[0]-w[0]*h.k,C=k[1]-w[1]*h.k;return N===h.x&&C===h.y?h:new ut(h.k,N,C)}function m(h){return[(+h[0][0]+ +h[1][0])/2,(+h[0][1]+ +h[1][1])/2]}function E(h,k,w,N){h.on(\"start.zoom\",function(){S(this,arguments).event(N).start()}).on(\"interrupt.zoom end.zoom\",function(){S(this,arguments).event(N).end()}).tween(\"zoom\",function(){var C=this,z=arguments,T=S(C,z).event(N),B=e.apply(C,z),P=w==null?m(B):typeof w==\"function\"?w.apply(C,z):w,H=Math.max(B[1][0]-B[0][0],B[1][1]-B[0][1]),Y=C.__zoom,rt=typeof k==\"function\"?k.apply(C,z):k,Z=u(Y.invert(P).concat(H/Y.k),rt.invert(P).concat(H/rt.k));return function(U){if(U===1)U=rt;else{var J=Z(U),ft=H/J[2];U=new ut(ft,P[0]-J[0]*ft,P[1]-J[1]*ft)}T.zoom(null,U)}})}function S(h,k,w){return!w&&h.__zooming||new I(h,k)}function I(h,k){this.that=h,this.args=k,this.active=0,this.sourceEvent=null,this.extent=e.apply(h,k),this.taps=0}I.prototype={event:function(h){return h&&(this.sourceEvent=h),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit(\"start\")),this},zoom:function(h,k){return this.mouse&&h!==\"mouse\"&&(this.mouse[1]=k.invert(this.mouse[0])),this.touch0&&h!==\"touch\"&&(this.touch0[1]=k.invert(this.touch0[0])),this.touch1&&h!==\"touch\"&&(this.touch1[1]=k.invert(this.touch1[0])),this.that.__zoom=k,this.emit(\"zoom\"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit(\"end\")),this},emit:function(h){var k=G(this.that).datum();l.call(h,this.that,new hn(h,{sourceEvent:this.sourceEvent,target:d,type:h,transform:this.that.__zoom,dispatch:l}),k)}};function $(h,...k){if(!t.apply(this,arguments))return;var w=S(this,k).event(h),N=this.__zoom,C=Math.max(o[0],Math.min(o[1],N.k*Math.pow(2,r.apply(this,arguments)))),z=ot(h);if(w.wheel)(w.mouse[0][0]!==z[0]||w.mouse[0][1]!==z[1])&&(w.mouse[1]=N.invert(w.mouse[0]=z)),clearTimeout(w.wheel);else{if(N.k===C)return;w.mouse=[z,N.invert(z)],Ot(this),w.start()}Xt(h),w.wheel=setTimeout(T,b),w.zoom(\"mouse\",n(M(_(N,C),w.mouse[0],w.mouse[1]),w.extent,a));function T(){w.wheel=null,w.end()}}function L(h,...k){if(p||!t.apply(this,arguments))return;var w=h.currentTarget,N=S(this,k,!0).event(h),C=G(h.view).on(\"mousemove.zoom\",P,!0).on(\"mouseup.zoom\",H,!0),z=ot(h,w),T=h.clientX,B=h.clientY;te(h.view),Pe(h),N.mouse=[z,this.__zoom.invert(z)],Ot(this),N.start();function P(Y){if(Xt(Y),!N.moved){var rt=Y.clientX-T,Z=Y.clientY-B;N.moved=rt*rt+Z*Z>y}N.event(Y).zoom(\"mouse\",n(M(N.that.__zoom,N.mouse[0]=ot(Y,w),N.mouse[1]),N.extent,a))}function H(Y){C.on(\"mousemove.zoom mouseup.zoom\",null),ee(Y.view,N.moved),Xt(Y),N.event(Y).end()}}function D(h,...k){if(t.apply(this,arguments)){var w=this.__zoom,N=ot(h.changedTouches?h.changedTouches[0]:h,this),C=w.invert(N),z=w.k*(h.shiftKey?.5:2),T=n(M(_(w,z),N,C),e.apply(this,k),a);Xt(h),s>0?G(this).transition().duration(s).call(E,T,N,h):G(this).call(d.transform,T,N,h)}}function V(h,...k){if(t.apply(this,arguments)){var w=h.touches,N=w.length,C=S(this,k,h.changedTouches.length===N).event(h),z,T,B,P;for(Pe(h),T=0;T<N;++T)B=w[T],P=ot(B,this),P=[P,this.__zoom.invert(P),B.identifier],C.touch0?!C.touch1&&C.touch0[2]!==P[2]&&(C.touch1=P,C.taps=0):(C.touch0=P,z=!0,C.taps=1+!!f);f&&(f=clearTimeout(f)),z&&(C.taps<2&&(g=P[0],f=setTimeout(function(){f=null},c)),Ot(this),C.start())}}function j(h,...k){if(this.__zooming){var w=S(this,k).event(h),N=h.changedTouches,C=N.length,z,T,B,P;for(Xt(h),z=0;z<C;++z)T=N[z],B=ot(T,this),w.touch0&&w.touch0[2]===T.identifier?w.touch0[0]=B:w.touch1&&w.touch1[2]===T.identifier&&(w.touch1[0]=B);if(T=w.that.__zoom,w.touch1){var H=w.touch0[0],Y=w.touch0[1],rt=w.touch1[0],Z=w.touch1[1],U=(U=rt[0]-H[0])*U+(U=rt[1]-H[1])*U,J=(J=Z[0]-Y[0])*J+(J=Z[1]-Y[1])*J;T=_(T,Math.sqrt(U/J)),B=[(H[0]+rt[0])/2,(H[1]+rt[1])/2],P=[(Y[0]+Z[0])/2,(Y[1]+Z[1])/2]}else if(w.touch0)B=w.touch0[0],P=w.touch0[1];else return;w.zoom(\"touch\",n(M(T,B,P),w.extent,a))}}function F(h,...k){if(this.__zooming){var w=S(this,k).event(h),N=h.changedTouches,C=N.length,z,T;for(Pe(h),p&&clearTimeout(p),p=setTimeout(function(){p=null},c),z=0;z<C;++z)T=N[z],w.touch0&&w.touch0[2]===T.identifier?delete w.touch0:w.touch1&&w.touch1[2]===T.identifier&&delete w.touch1;if(w.touch1&&!w.touch0&&(w.touch0=w.touch1,delete w.touch1),w.touch0)w.touch0[1]=this.__zoom.invert(w.touch0[0]);else if(w.end(),w.taps===2&&(T=ot(T,this),Math.hypot(g[0]-T[0],g[1]-T[1])<x)){var B=G(this).on(\"dblclick.zoom\");B&&B.apply(this,arguments)}}}return d.wheelDelta=function(h){return arguments.length?(r=typeof h==\"function\"?h:ue(+h),d):r},d.filter=function(h){return arguments.length?(t=typeof h==\"function\"?h:ue(!!h),d):t},d.touchable=function(h){return arguments.length?(i=typeof h==\"function\"?h:ue(!!h),d):i},d.extent=function(h){return arguments.length?(e=typeof h==\"function\"?h:ue([[+h[0][0],+h[0][1]],[+h[1][0],+h[1][1]]]),d):e},d.scaleExtent=function(h){return arguments.length?(o[0]=+h[0],o[1]=+h[1],d):[o[0],o[1]]},d.translateExtent=function(h){return arguments.length?(a[0][0]=+h[0][0],a[1][0]=+h[1][0],a[0][1]=+h[0][1],a[1][1]=+h[1][1],d):[[a[0][0],a[0][1]],[a[1][0],a[1][1]]]},d.constrain=function(h){return arguments.length?(n=h,d):n},d.duration=function(h){return arguments.length?(s=+h,d):s},d.interpolate=function(h){return arguments.length?(u=h,d):u},d.on=function(){var h=l.on.apply(l,arguments);return h===l?d:h},d.clickDistance=function(h){return arguments.length?(y=(h=+h)*h,d):Math.sqrt(y)},d.tapDistance=function(h){return arguments.length?(x=+h,d):x},d}var Ge={primary_partner:{color:\"#f1c40f\",width:4,dashArray:\"\",label:\"Primary Partners\"},partner:{color:\"#ff6b9d\",width:3,dashArray:\"\",label:\"Partners\"},nesting_partner:{color:\"#ff4757\",width:3,dashArray:\"\",label:\"Nesting Partners\",double:!0},anchor_partner:{color:\"#c0392b\",width:4,dashArray:\"10,4\",label:\"Anchor Partners\"},fwb:{color:\"#a55eea\",width:2.5,dashArray:\"8,4\",label:\"Friends with Benefits\"},casual:{color:\"#45aaf2\",width:2,dashArray:\"3,5\",label:\"Casual\"},queerplatonic:{color:\"#26de81\",width:2,dashArray:\"12,3,3,3\",label:\"Queerplatonic\"},comet:{color:\"#a5b1c2\",width:1.5,dashArray:\"18,8\",label:\"Comet\"},friend:{color:\"#4fc3f7\",width:1.5,dashArray:\"\",label:\"Friends\"},metamour:{color:\"#546e7a\",width:1,dashArray:\"4,6\",label:\"Metamour\"},tbd:{color:\"#78909c\",width:1.5,dashArray:\"6,3,2,3\",label:\"TBD\"}},Ri=[\"#e91e8c\",\"#9c27b0\",\"#3f51b5\",\"#2196f3\",\"#009688\",\"#4caf50\",\"#ff9800\",\"#f44336\",\"#00bcd4\",\"#8bc34a\"];function gn(t,e){if(e)return e;let n=0;for(let r=0;r<t.length;r++)n=(n<<5)-n+t.charCodeAt(r),n|=0;return Ri[Math.abs(n)%Ri.length]}function xn(t){return t.split(/\\s+/).slice(0,2).map(e=>{var n,r;return(r=(n=e[0])==null?void 0:n.toUpperCase())!=null?r:\"\"}).join(\"\")}var yn=28,xs=16;function Li(t){return{bg:t?\"#0d1117\":\"#f0f4f8\",grid:t?\"rgba(255,255,255,0.025)\":\"rgba(0,0,0,0.04)\",text:t?\"#e6edf3\":\"#1c1e21\",textMuted:t?\"#8b949e\":\"#65676b\",nodeLabelBg:t?\"rgba(0,0,0,0.55)\":\"rgba(255,255,255,0.75)\",edgeLabelBg:t?\"rgba(13,17,23,0.75)\":\"rgba(240,244,248,0.8)\",panelBg:t?\"rgba(22,27,34,0.95)\":\"rgba(255,255,255,0.97)\",legendBg:t?\"rgba(13,17,23,0.45)\":\"rgba(255,255,255,0.5)\",panelBorder:t?\"rgba(48,54,61,0.9)\":\"rgba(208,215,222,0.9)\",panelText:t?\"#e6edf3\":\"#1c1e21\",panelMuted:t?\"#8b949e\":\"#65676b\",btnBg:t?\"rgba(33,38,45,0.9)\":\"rgba(255,255,255,0.9)\",btnBorder:t?\"rgba(48,54,61,0.8)\":\"rgba(208,215,222,0.8)\",btnText:t?\"#8b949e\":\"#65676b\"}}function ys(){if(document.getElementById(\"polymap-styles\"))return;let t=document.createElement(\"style\");t.id=\"polymap-styles\",t.textContent=`\n .polymap-wrap { position: relative; width: 100%; height: 100%; overflow: hidden; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }\n .polymap-wrap svg { display: block; width: 100%; height: 100%; cursor: grab; }\n .polymap-wrap svg:active { cursor: grabbing; }\n .polymap-node { cursor: pointer; }\n .polymap-node:hover .pm-halo { opacity: 0.35 !important; }\n .polymap-node:hover .pm-ring { stroke-width: 3 !important; }\n\n .pm-info-panel {\n position: absolute;\n min-width: 200px;\n max-width: 280px;\n border-radius: 12px;\n padding: 14px 16px;\n box-shadow: 0 8px 32px rgba(0,0,0,0.35);\n backdrop-filter: blur(12px);\n -webkit-backdrop-filter: blur(12px);\n border: 1px solid;\n pointer-events: auto;\n z-index: 100;\n transition: opacity 0.15s ease;\n }\n .pm-info-panel.hidden { opacity: 0; pointer-events: none; }\n .pm-info-header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }\n .pm-info-avatar {\n width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;\n display: flex; align-items: center; justify-content: center;\n font-size: 14px; font-weight: 700; color: #fff;\n background-size: cover; background-position: center;\n overflow: hidden;\n }\n .pm-info-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }\n .pm-info-name { font-size: 15px; font-weight: 600; line-height: 1.2; }\n .pm-info-pronouns { font-size: 12px; margin-top: 1px; }\n .pm-info-close {\n margin-left: auto; background: none; border: none; cursor: pointer;\n font-size: 18px; line-height: 1; padding: 0 2px; opacity: 0.5;\n transition: opacity 0.1s;\n }\n .pm-info-close:hover { opacity: 1; }\n .pm-info-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }\n .pm-info-link {\n font-size: 12px; padding: 3px 9px; border-radius: 20px;\n border: 1px solid; text-decoration: none; opacity: 0.85;\n transition: opacity 0.1s;\n }\n .pm-info-link:hover { opacity: 1; }\n\n .pm-controls {\n position: absolute; top: 12px; right: 12px;\n display: flex; flex-direction: column; gap: 6px; z-index: 50;\n }\n .pm-btn {\n border: 1px solid; border-radius: 8px; padding: 6px 12px;\n font-size: 12px; cursor: pointer; backdrop-filter: blur(8px);\n -webkit-backdrop-filter: blur(8px); transition: opacity 0.1s;\n white-space: nowrap;\n }\n .pm-btn:hover { opacity: 0.8; }\n\n .pm-legend {\n position: absolute; bottom: 12px; left: 12px; z-index: 50;\n border: 1px solid; border-radius: 10px; padding: 10px 14px;\n backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);\n min-width: 160px;\n }\n .pm-legend.hidden { display: none; }\n .pm-legend-title { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 8px; }\n .pm-legend-item { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; font-size: 12px; }\n .pm-legend-line { flex-shrink: 0; }\n `,document.head.appendChild(t)}function Pi(t,e){var vn;ys();let n=e.settings.theme!==\"light\",r=!0,i=!0,o=!0,a=Nt,s=document.createElement(\"div\");s.className=\"polymap-wrap\",t.appendChild(s);let u=new Map;e.people.forEach(v=>u.set(v.id,0)),e.relationships.forEach(v=>{var A,R;u.set(v.from,((A=u.get(v.from))!=null?A:0)+1),u.set(v.to,((R=u.get(v.to))!=null?R:0)+1)});let l=e.settings.mainNode,f=e.people.length,g=l?e.people.filter(v=>v.id!==l).length:f,p=0,c=e.people.map(v=>{var R,O;if(v.id===l)return Fe(Ve({},v),{x:480,y:360,vx:0,vy:0,fx:480,fy:360,connectionCount:(R=u.get(v.id))!=null?R:0});let A=p++/Math.max(g,1)*2*Math.PI;return Fe(Ve({},v),{x:480+Math.cos(A)*220,y:360+Math.sin(A)*220,vx:0,vy:0,fx:null,fy:null,connectionCount:(O=u.get(v.id))!=null?O:0})}),b=new Map(c.map(v=>[v.id,v])),y=e.relationships.map(v=>({source:b.get(v.from),target:b.get(v.to),relationship:v}));function x(v){return e.settings.nodeScale===\"connections\"?yn+v.connectionCount*4:yn}let d=document.createElementNS(\"http://www.w3.org/2000/svg\",\"svg\");s.appendChild(d);let _=G(d),M=_.append(\"defs\");M.append(\"pattern\").attr(\"id\",\"pm-grid\").attr(\"width\",40).attr(\"height\",40).attr(\"patternUnits\",\"userSpaceOnUse\").append(\"path\").attr(\"d\",\"M 40 0 L 0 0 0 40\").attr(\"fill\",\"none\").attr(\"class\",\"pm-grid-path\").attr(\"stroke-width\",\"1\"),M.append(\"clipPath\").attr(\"id\",\"pm-node-clip\").append(\"circle\").attr(\"r\",yn);let E=M.append(\"filter\").attr(\"id\",\"pm-node-glow\").attr(\"x\",\"-60%\").attr(\"y\",\"-60%\").attr(\"width\",\"220%\").attr(\"height\",\"220%\");E.append(\"feGaussianBlur\").attr(\"in\",\"SourceGraphic\").attr(\"stdDeviation\",\"5\").attr(\"result\",\"blur\");let S=E.append(\"feMerge\");S.append(\"feMergeNode\").attr(\"in\",\"blur\"),S.append(\"feMergeNode\").attr(\"in\",\"SourceGraphic\");let I=M.append(\"filter\").attr(\"id\",\"pm-edge-glow\").attr(\"x\",\"-40%\").attr(\"y\",\"-40%\").attr(\"width\",\"180%\").attr(\"height\",\"180%\");I.append(\"feGaussianBlur\").attr(\"in\",\"SourceGraphic\").attr(\"stdDeviation\",\"2.5\").attr(\"result\",\"blur\");let $=I.append(\"feMerge\");$.append(\"feMergeNode\").attr(\"in\",\"blur\"),$.append(\"feMergeNode\").attr(\"in\",\"SourceGraphic\");let L=_.append(\"rect\").attr(\"class\",\"pm-bg\").attr(\"width\",\"100%\").attr(\"height\",\"100%\");_.append(\"rect\").attr(\"class\",\"pm-grid-rect\").attr(\"width\",\"100%\").attr(\"height\",\"100%\").attr(\"fill\",\"url(#pm-grid)\");let D=_.append(\"g\").attr(\"class\",\"pm-graph-root\"),V=D.append(\"g\").attr(\"class\",\"pm-edges\"),j=D.append(\"g\").attr(\"class\",\"pm-nodes\"),F=V.selectAll(\"g.pm-edge\").data(y).join(\"g\").attr(\"class\",\"pm-edge\"),h=F.append(\"line\").attr(\"class\",\"pm-edge-bg\").attr(\"stroke-linecap\",\"round\"),k=F.append(\"line\").attr(\"class\",\"pm-edge-line\").attr(\"stroke-linecap\",\"round\"),w=F.append(\"g\").attr(\"class\",\"pm-edge-label\");w.append(\"rect\").attr(\"rx\",4).attr(\"ry\",4).attr(\"x\",-28).attr(\"y\",-8).attr(\"width\",56).attr(\"height\",14),w.append(\"text\").attr(\"text-anchor\",\"middle\").attr(\"dominant-baseline\",\"central\").attr(\"y\",0).attr(\"font-size\",\"9\").attr(\"font-family\",'-apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif').attr(\"font-weight\",\"500\"),F.each(function(v){var ht;let A=Ge[v.relationship.type],R=(ht=v.relationship.label)!=null?ht:A.label,O=Math.max(40,R.length*5.5+12);G(this).select(\"rect\").attr(\"x\",-O/2).attr(\"width\",O);let Q=G(this),tt=Q.select(\".pm-edge-bg\"),Mt=Q.select(\".pm-edge-line\"),Lt=Q.select(\".pm-edge-label\").select(\"text\");A.double?tt.attr(\"stroke-width\",A.width*2.6).style(\"visibility\",\"visible\"):tt.style(\"visibility\",\"hidden\"),Mt.attr(\"stroke\",A.color).attr(\"stroke-width\",A.width).attr(\"stroke-dasharray\",A.dashArray||null).attr(\"opacity\",\"0.85\").attr(\"filter\",\"url(#pm-edge-glow)\"),Lt.text(R).attr(\"fill\",A.color)});let N=j.selectAll(\"g.polymap-node\").data(c).join(\"g\").attr(\"class\",\"polymap-node\").attr(\"data-id\",v=>v.id);N.each(function(v){let A=x(v),R=gn(v.id,v.color),O=G(this);if(O.append(\"circle\").attr(\"class\",\"pm-halo\").attr(\"r\",A+10).attr(\"fill\",R).attr(\"opacity\",.15),v.photo){let tt=`pm-clip-${v.id}`;G(d).select(\"defs\").append(\"clipPath\").attr(\"id\",tt).append(\"circle\").attr(\"r\",A),O.append(\"image\").attr(\"href\",v.photo).attr(\"x\",-A).attr(\"y\",-A).attr(\"width\",A*2).attr(\"height\",A*2).attr(\"clip-path\",`url(#${tt})`).attr(\"preserveAspectRatio\",\"xMidYMid slice\")}else O.append(\"circle\").attr(\"r\",A).attr(\"fill\",R).attr(\"filter\",\"url(#pm-node-glow)\"),O.append(\"text\").attr(\"text-anchor\",\"middle\").attr(\"dominant-baseline\",\"central\").attr(\"font-size\",Math.round(A*.5)).attr(\"font-weight\",\"700\").attr(\"font-family\",'-apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif').attr(\"fill\",\"#ffffff\").attr(\"pointer-events\",\"none\").text(xn(v.name));O.append(\"circle\").attr(\"class\",\"pm-ring\").attr(\"r\",A).attr(\"fill\",\"none\").attr(\"stroke\",R).attr(\"stroke-width\",2).attr(\"opacity\",.9);let Q=A+xs;O.append(\"rect\").attr(\"class\",\"pm-label-bg\").attr(\"rx\",4).attr(\"ry\",4).attr(\"x\",-36).attr(\"y\",Q-9).attr(\"width\",72).attr(\"height\",15),O.append(\"text\").attr(\"class\",\"pm-label-text\").attr(\"text-anchor\",\"middle\").attr(\"y\",Q).attr(\"font-size\",\"11\").attr(\"font-family\",'-apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif').attr(\"pointer-events\",\"none\").text(v.name)});let C=Qe(c).force(\"link\",qe(y).id(v=>v.id).distance(170).strength(.5)).force(\"charge\",Ke().strength(-500)).force(\"center\",He(480,360).strength(.08)).force(\"collision\",Ye(v=>x(v)+24)).on(\"tick\",z);function z(){F.each(function(v){let A=G(this),R=v.source.x,O=v.source.y,Q=v.target.x,tt=v.target.y;A.select(\".pm-edge-bg\").attr(\"x1\",R).attr(\"y1\",O).attr(\"x2\",Q).attr(\"y2\",tt),A.select(\".pm-edge-line\").attr(\"x1\",R).attr(\"y1\",O).attr(\"x2\",Q).attr(\"y2\",tt),A.select(\".pm-edge-label\").attr(\"transform\",`translate(${(R+Q)/2},${(O+tt)/2})`)}),N.attr(\"transform\",v=>`translate(${v.x},${v.y})`)}let T=l&&(vn=b.get(l))!=null?vn:null,B=tn().on(\"start\",(v,A)=>{T&&T!==A&&(T.fx=null,T.fy=null),v.active||C.alphaTarget(.3).restart(),A.fx=A.x,A.fy=A.y,T=A}).on(\"drag\",(v,A)=>{A.fx=v.x,A.fy=v.y}).on(\"end\",v=>{v.active||C.alphaTarget(0)});N.call(B),N.on(\"dblclick\",(v,A)=>{v.stopPropagation(),A.fx=null,A.fy=null,T===A&&(T=null),C.alphaTarget(.1).restart()});let P=dn().scaleExtent([.05,8]).filter(v=>v.type!==\"dblclick\").on(\"zoom\",v=>{a=v.transform,D.attr(\"transform\",v.transform.toString())});_.call(P),_.on(\"dblclick.zoom\",null),_.on(\"click\",()=>rt()),N.on(\"click\",(v,A)=>{v.stopPropagation(),Y(A,v)});let H=document.createElement(\"div\");H.className=\"pm-info-panel hidden\",s.appendChild(H);function Y(v,A){var wn,_n,bn;let R=gn(v.id,v.color),O=Li(n);H.style.background=O.panelBg,H.style.borderColor=O.panelBorder,H.style.color=O.panelText;let Q=v.photo?`<img src=\"${Dt(v.photo)}\" alt=\"${Dt(v.name)}\"/>`:`<span style=\"width:100%;height:100%;display:flex;align-items:center;justify-content:center;background:${R}\">${Dt(xn(v.name))}</span>`,tt=((wn=v.links)!=null?wn:[]).length>0?`<div class=\"pm-info-links\">${((_n=v.links)!=null?_n:[]).map(Nn=>`<a class=\"pm-info-link\" href=\"${Dt(Nn.url)}\" target=\"_blank\" rel=\"noopener noreferrer\"\n style=\"color:${R};border-color:${R}22\">${Dt(Nn.label)}</a>`).join(\"\")}</div>`:\"\";H.innerHTML=`\n <div class=\"pm-info-header\">\n <div class=\"pm-info-avatar\" style=\"background:${R}\">${Q}</div>\n <div>\n <div class=\"pm-info-name\" style=\"color:${O.panelText}\">${Dt(v.name)}</div>\n ${v.pronouns?`<div class=\"pm-info-pronouns\" style=\"color:${O.panelMuted}\">${Dt(v.pronouns)}</div>`:\"\"}\n </div>\n <button class=\"pm-info-close\" style=\"color:${O.panelText}\" aria-label=\"Close\">\\xD7</button>\n </div>\n ${tt}\n `,(bn=H.querySelector(\".pm-info-close\"))==null||bn.addEventListener(\"click\",rt);let Mt=s.getBoundingClientRect(),Rt=a.applyX(v.x),Lt=a.applyY(v.y),ht=240,ce=120,At=Rt+48,mt=Lt-40;At+ht>Mt.width-8&&(At=Rt-ht-48),mt+ce>Mt.height-8&&(mt=Mt.height-ce-8),mt<8&&(mt=8),At<8&&(At=8),H.style.left=`${At}px`,H.style.top=`${mt}px`,H.classList.remove(\"hidden\")}function rt(){H.classList.add(\"hidden\")}let Z=document.createElement(\"div\");Z.className=\"pm-controls\",s.appendChild(Z);let U=document.createElement(\"button\");U.className=\"pm-btn\",U.title=\"Toggle dark/light mode\",Z.appendChild(U);let J=document.createElement(\"button\");J.className=\"pm-btn\",J.textContent=\"Legend\",J.title=\"Toggle legend\",Z.appendChild(J);let ft=document.createElement(\"button\");ft.className=\"pm-btn\",ft.title=\"Toggle edge labels\",Z.appendChild(ft);let Bt=document.createElement(\"button\");Bt.className=\"pm-btn\",Bt.title=\"Toggle node names\",Z.appendChild(Bt);let kt=document.createElement(\"button\");kt.className=\"pm-btn\",kt.textContent=\"\\u22A1 Fit\",kt.title=\"Fit graph to view\",Z.appendChild(kt),kt.addEventListener(\"click\",()=>{let v=d.getBoundingClientRect();if(!v.width)return;let A=c.map(mt=>mt.x),R=c.map(mt=>mt.y),O=Math.min(...A)-80,Q=Math.min(...R)-80,tt=Math.max(...A)+80,Mt=Math.max(...R)+80,Rt=tt-O,Lt=Mt-Q,ht=Math.min(.9,Math.min(v.width/Rt,v.height/Lt)),ce=v.width/2-ht*(O+Rt/2),At=v.height/2-ht*(Q+Lt/2);_.transition().duration(500).call(P.transform,Nt.translate(ce,At).scale(ht))});let Et=document.createElement(\"div\");Et.className=\"pm-legend\",s.appendChild(Et);let Gi=[...new Set(e.relationships.map(v=>v.type))];function Vi(v){Et.style.background=v.legendBg,Et.style.borderColor=v.panelBorder,Et.style.color=v.panelText;let A=\"http://www.w3.org/2000/svg\";Et.innerHTML=`<div class=\"pm-legend-title\" style=\"color:${v.panelMuted}\">Relationships</div>`+Gi.map(R=>{let O=Ge[R],Q=O.dashArray?`stroke-dasharray=\"${O.dashArray}\"`:\"\",tt=`<svg class=\"pm-legend-line\" width=\"32\" height=\"12\" viewBox=\"0 0 32 12\">\n ${O.double?`<line x1=\"0\" y1=\"6\" x2=\"32\" y2=\"6\" stroke=\"${v.panelBg}\" stroke-width=\"${O.width*2.6}\" stroke-linecap=\"round\"/>\n <line x1=\"0\" y1=\"6\" x2=\"32\" y2=\"6\" stroke=\"${O.color}\" stroke-width=\"${O.width}\" stroke-linecap=\"round\" ${Q}/>`:`<line x1=\"0\" y1=\"6\" x2=\"32\" y2=\"6\" stroke=\"${O.color}\" stroke-width=\"${O.width}\" stroke-linecap=\"round\" ${Q}/>`}\n </svg>`;return`<div class=\"pm-legend-item\" style=\"color:${v.panelText}\">${tt}<span>${O.label}</span></div>`}).join(\"\")}J.addEventListener(\"click\",()=>{r=!r,Et.classList.toggle(\"hidden\",!r)}),ft.addEventListener(\"click\",()=>{i=!i,F.selectAll(\".pm-edge-label\").style(\"display\",i?null:\"none\"),fe()}),Bt.addEventListener(\"click\",()=>{o=!o,N.selectAll(\".pm-label-bg, .pm-label-text\").style(\"display\",o?null:\"none\"),fe()});function fe(){let v=Li(n);L.attr(\"fill\",v.bg),_.selectAll(\".pm-grid-path\").attr(\"stroke\",v.grid),F.each(function(A){let R=Ge[A.relationship.type];G(this).select(\".pm-edge-label rect\").attr(\"fill\",v.edgeLabelBg),R.double&&G(this).select(\".pm-edge-bg\").attr(\"stroke\",v.bg)}),N.each(function(){G(this).select(\".pm-label-bg\").attr(\"fill\",v.nodeLabelBg),G(this).select(\".pm-label-text\").attr(\"fill\",v.text)}),[U,J,ft,Bt,kt].forEach(A=>{A.style.background=v.btnBg,A.style.borderColor=v.btnBorder,A.style.color=v.btnText}),U.textContent=n?\"\\u2600 Light\":\"\\u263E Dark\",ft.textContent=i?\"Labels On\":\"Labels Off\",Bt.textContent=o?\"Names On\":\"Names Off\",Vi(v)}U.addEventListener(\"click\",()=>{n=!n,fe()}),fe(),setTimeout(()=>kt.click(),600)}function Dt(t){return t.replace(/&/g,\"&amp;\").replace(/</g,\"&lt;\").replace(/>/g,\"&gt;\").replace(/\"/g,\"&quot;\")}if(typeof window!=\"undefined\"){let t=function(){let e=window.__POLYMAP_DATA__,n=document.getElementById(\"polymap-root\");e&&n&&Pi(n,e)};vs=t,document.readyState===\"loading\"?document.addEventListener(\"DOMContentLoaded\",t):t()}var vs;return Ki(ws);})();\n";
+7
src/parser.ts
··· 24 24 const settings: Settings = { 25 25 theme: s?.['theme'] === 'light' ? 'light' : 'dark', 26 26 nodeScale: s?.['nodeScale'] === 'connections' ? 'connections' : 'uniform', 27 + // mainNode validated below once person IDs are known 27 28 }; 28 29 29 30 const people: Person[] = (data['people'] as unknown[]).map((p, i) => { ··· 46 47 }); 47 48 48 49 const ids = new Set(people.map(p => p.id)); 50 + 51 + const mainNodeRaw = s?.['mainNode'] != null ? String(s['mainNode']) : undefined; 52 + if (mainNodeRaw !== undefined) { 53 + if (!ids.has(mainNodeRaw)) throw new Error(`settings.mainNode "${mainNodeRaw}" is not a valid person id`); 54 + settings.mainNode = mainNodeRaw; 55 + } 49 56 50 57 const relationships: Relationship[] = (data['relationships'] as unknown[]).map((r, i) => { 51 58 const rel = r as Record<string, unknown>;
+143 -17
src/simulate.ts
··· 25 25 const HEIGHT = 720; 26 26 export const NODE_RADIUS = 28; 27 27 28 - export function simulate(data: PolyculeData): { nodes: SimNode[]; links: SimLink[] } { 29 - const count = data.people.length; 28 + /** Count edge crossings in the settled layout (lower = better) */ 29 + function countCrossings(links: SimLink[]): number { 30 + let count = 0; 31 + for (let i = 0; i < links.length - 1; i++) { 32 + for (let j = i + 1; j < links.length; j++) { 33 + const a = links[i].source, b = links[i].target; 34 + const c = links[j].source, d = links[j].target; 35 + // Edges sharing a node cannot cross 36 + if (a.id === c.id || a.id === d.id || b.id === c.id || b.id === d.id) continue; 37 + if (segmentsIntersect(a.x, a.y, b.x, b.y, c.x, c.y, d.x, d.y)) count++; 38 + } 39 + } 40 + return count; 41 + } 30 42 31 - // Pre-compute connection counts for node scaling 32 - const connCount = new Map<string, number>(); 33 - data.people.forEach(p => connCount.set(p.id, 0)); 34 - data.relationships.forEach(r => { 35 - connCount.set(r.from, (connCount.get(r.from) ?? 0) + 1); 36 - connCount.set(r.to, (connCount.get(r.to) ?? 0) + 1); 43 + function segmentsIntersect( 44 + ax: number, ay: number, bx: number, by: number, 45 + cx: number, cy: number, dx: number, dy: number, 46 + ): boolean { 47 + const d1x = bx - ax, d1y = by - ay; 48 + const d2x = dx - cx, d2y = dy - cy; 49 + const denom = d1x * d2y - d1y * d2x; 50 + if (Math.abs(denom) < 1e-10) return false; // parallel / collinear 51 + const t = ((cx - ax) * d2y - (cy - ay) * d2x) / denom; 52 + const u = ((cx - ax) * d1y - (cy - ay) * d1x) / denom; 53 + return t > 0 && t < 1 && u > 0 && u < 1; 54 + } 55 + 56 + /** 57 + * BFS order starting from `forcedStart` (if given) or the highest-degree node. 58 + * Places directly connected nodes consecutively on the initial circle so 59 + * the force simulation starts with fewer crossings to resolve. 60 + */ 61 + function bfsOrder(people: Person[], relationships: Relationship[], forcedStart?: string): Person[] { 62 + if (people.length === 0) return people; 63 + const adj = new Map<string, string[]>(); 64 + people.forEach(p => adj.set(p.id, [])); 65 + relationships.forEach(r => { 66 + adj.get(r.from)?.push(r.to); 67 + adj.get(r.to)?.push(r.from); 37 68 }); 38 69 39 - // Deterministic circle layout as starting positions 40 - const nodes: SimNode[] = data.people.map((p, i) => { 41 - const angle = (i / count) * 2 * Math.PI; 70 + const startId = forcedStart ?? [...adj.entries()].sort((a, b) => b[1].length - a[1].length)[0]?.[0] ?? people[0].id; 71 + const visited = new Set<string>(); 72 + const queue = [startId]; 73 + const order: string[] = []; 74 + 75 + while (queue.length > 0) { 76 + const id = queue.shift()!; 77 + if (visited.has(id)) continue; 78 + visited.add(id); 79 + order.push(id); 80 + // Enqueue neighbours highest-degree first so hubs stay clustered 81 + queue.push( 82 + ...(adj.get(id) ?? []) 83 + .filter(n => !visited.has(n)) 84 + .sort((a, b) => (adj.get(b)?.length ?? 0) - (adj.get(a)?.length ?? 0)), 85 + ); 86 + } 87 + 88 + const rank = new Map(order.map((id, i) => [id, i])); 89 + return [...people].sort((a, b) => (rank.get(a.id) ?? 0) - (rank.get(b.id) ?? 0)); 90 + } 91 + 92 + function runOnce( 93 + orderedPeople: Person[], 94 + data: PolyculeData, 95 + connCount: Map<string, number>, 96 + startAngle: number, 97 + chargeStrength: number, 98 + linkDistance: number, 99 + mainNodeId?: string, 100 + ): { nodes: SimNode[]; links: SimLink[] } { 101 + const count = orderedPeople.length; 102 + // Non-main nodes distributed on circle; main node starts at center 103 + const nonMain = orderedPeople.filter(p => p.id !== mainNodeId); 104 + const nodes: SimNode[] = orderedPeople.map((p, i) => { 105 + if (p.id === mainNodeId) { 106 + return { 107 + ...p, 108 + x: WIDTH / 2, 109 + y: HEIGHT / 2, 110 + connectionCount: connCount.get(p.id) ?? 0, 111 + }; 112 + } 113 + const circleIdx = nonMain.findIndex(n => n.id === p.id); 114 + const angle = startAngle + (circleIdx / Math.max(nonMain.length, 1)) * 2 * Math.PI; 42 115 return { 43 116 ...p, 44 117 x: WIDTH / 2 + Math.cos(angle) * 220, ··· 48 121 }); 49 122 50 123 const nodeById = new Map<string, SimNode>(nodes.map(n => [n.id, n])); 51 - 52 124 const links: SimLink[] = data.relationships.map(r => ({ 53 125 source: nodeById.get(r.from)!, 54 126 target: nodeById.get(r.to)!, 55 127 relationship: r, 56 128 })); 57 129 58 - // Scale forces with graph size so denser graphs spread out properly 59 - const chargeStrength = -Math.max(800, count * 140); 60 - const linkDistance = Math.max(180, 140 + count * 10); 130 + // Pin main node at center for the entire simulation so others orbit around it 131 + const mainNode = mainNodeId ? nodeById.get(mainNodeId) : undefined; 132 + if (mainNode) { 133 + mainNode.fx = WIDTH / 2; 134 + mainNode.fy = HEIGHT / 2; 135 + } 61 136 62 137 const sim = forceSimulation<SimNode>(nodes) 63 138 .force( ··· 65 140 forceLink<SimNode, SimLink>(links) 66 141 .id(d => d.id) 67 142 .distance(linkDistance) 68 - .strength(0.35) 143 + .strength(0.35), 69 144 ) 70 145 .force('charge', forceManyBody<SimNode>().strength(chargeStrength)) 71 146 .force('center', forceCenter(WIDTH / 2, HEIGHT / 2).strength(0.06)) 72 147 .force('collision', forceCollide<SimNode>(NODE_RADIUS + 40)) 73 - // Lower alphaDecay → more ticks before cooling, gives layout more time to settle 74 148 .alphaDecay(0.015) 75 149 .stop(); 76 150 77 151 const iterations = Math.ceil(Math.log(sim.alphaMin()) / Math.log(1 - sim.alphaDecay())); 78 152 for (let i = 0; i < iterations; ++i) sim.tick(); 79 153 154 + // Release pin — positions are baked in, no longer need fx/fy 155 + if (mainNode) { 156 + mainNode.fx = undefined; 157 + mainNode.fy = undefined; 158 + } 159 + 80 160 return { nodes, links }; 81 161 } 162 + 163 + export function simulate(data: PolyculeData): { nodes: SimNode[]; links: SimLink[] } { 164 + const count = data.people.length; 165 + if (count === 0) return { nodes: [], links: [] }; 166 + 167 + // Pre-compute connection counts for node scaling 168 + const connCount = new Map<string, number>(); 169 + data.people.forEach(p => connCount.set(p.id, 0)); 170 + data.relationships.forEach(r => { 171 + connCount.set(r.from, (connCount.get(r.from) ?? 0) + 1); 172 + connCount.set(r.to, (connCount.get(r.to) ?? 0) + 1); 173 + }); 174 + 175 + // Scale forces with graph size so denser graphs spread out properly 176 + const chargeStrength = -Math.max(800, count * 140); 177 + const linkDistance = Math.max(180, 140 + count * 10); 178 + 179 + const mainNodeId = data.settings.mainNode; 180 + 181 + // Three initial orderings × four circle rotations = up to 12 candidates. 182 + // Pick the settled layout with the fewest edge crossings. 183 + // When mainNode is set, always start BFS from it so its neighbours radiate outward. 184 + const orderings = [ 185 + data.people, 186 + bfsOrder(data.people, data.relationships, mainNodeId), 187 + [...data.people].sort((a, b) => (connCount.get(b.id) ?? 0) - (connCount.get(a.id) ?? 0)), 188 + ]; 189 + const ROTATIONS = 4; 190 + 191 + let best: { nodes: SimNode[]; links: SimLink[]; crossings: number } | null = null; 192 + 193 + outer: 194 + for (const ordering of orderings) { 195 + for (let r = 0; r < ROTATIONS; r++) { 196 + const startAngle = (r / ROTATIONS) * 2 * Math.PI; 197 + const result = runOnce(ordering, data, connCount, startAngle, chargeStrength, linkDistance, mainNodeId); 198 + const crossings = countCrossings(result.links); 199 + if (!best || crossings < best.crossings) { 200 + best = { ...result, crossings }; 201 + if (crossings === 0) break outer; // perfect layout — stop early 202 + } 203 + } 204 + } 205 + 206 + return { nodes: best!.nodes, links: best!.links }; 207 + }
+1
src/types.ts
··· 35 35 export interface Settings { 36 36 theme: 'dark' | 'light'; 37 37 nodeScale: 'uniform' | 'connections'; 38 + mainNode?: string; 38 39 } 39 40 40 41 export interface PolyculeData {