// https://d3js.org/d3-voronoi/ Version 1.1.2. Copyright 2017 Mike Bostock. !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.d3=e.d3||{})}(this,function(e){"use strict";function t(e){return e[0]}function n(e){return e[1]}function r(){this._=null}function i(e){e.U=e.C=e.L=e.R=e.P=e.N=null}function f(e,t){var n=t,r=t.R,i=n.U;i?i.L===n?i.L=r:i.R=r:e._=r,r.U=i,n.U=r,n.R=r.L,n.R&&(n.R.U=n),r.L=n}function u(e,t){var n=t,r=t.L,i=n.U;i?i.L===n?i.L=r:i.R=r:e._=r,r.U=i,n.U=r,n.L=r.R,n.L&&(n.L.U=n),r.R=n}function s(e){for(;e.L;)e=e.L;return e}function l(e,t,n,r){var i=[null,null],f=D.push(i)-1;return i.left=e,i.right=t,n&&o(i,e,t,n),r&&o(i,t,e,r),O[e.index].halfedges.push(f),O[t.index].halfedges.push(f),i}function a(e,t,n){var r=[t,n];return r.left=e,r}function o(e,t,n,r){e[0]||e[1]?e.left===n?e[1]=r:e[0]=r:(e[0]=r,e.left=t,e.right=n)}function h(e,t,n,r,i){var f,u=e[0],s=e[1],l=u[0],a=u[1],o=s[0],h=s[1],c=0,d=1,v=o-l,g=h-a;if(f=t-l,v||!(f>0)){if(f/=v,v<0){if(f0){if(f>d)return;f>c&&(c=f)}if(f=r-l,v||!(f<0)){if(f/=v,v<0){if(f>d)return;f>c&&(c=f)}else if(v>0){if(f0)){if(f/=g,g<0){if(f0){if(f>d)return;f>c&&(c=f)}if(f=i-a,g||!(f<0)){if(f/=g,g<0){if(f>d)return;f>c&&(c=f)}else if(g>0){if(f0||d<1)||(c>0&&(e[0]=[l+c*v,a+c*g]),d<1&&(e[1]=[l+d*v,a+d*g]),!0)}}}}}function c(e,t,n,r,i){var f=e[1];if(f)return!0;var u,s,l=e[0],a=e.left,o=e.right,h=a[0],c=a[1],d=o[0],v=o[1],g=(h+d)/2,C=(c+v)/2;if(v===c){if(g=r)return;if(h>d){if(l){if(l[1]>=i)return}else l=[g,n];f=[g,i]}else{if(l){if(l[1]1)if(h>d){if(l){if(l[1]>=i)return}else l=[(n-s)/u,n];f=[(i-s)/u,i]}else{if(l){if(l[1]=r)return}else l=[t,u*t+s];f=[r,u*r+s]}else{if(l){if(l[0]H||Math.abs(i[0][1]-i[1][1])>H)||delete D[f]}function v(e){return O[e.index]={site:e,halfedges:[]}}function g(e,t){var n=e.site,r=t.left,i=t.right;return n===i&&(i=r,r=n),i?Math.atan2(i[1]-r[1],i[0]-r[0]):(n===r?(r=t[1],i=t[0]):(r=t[0],i=t[1]),Math.atan2(r[0]-i[0],i[1]-r[1]))}function C(e,t){return t[+(t.left!==e.site)]}function p(e,t){return t[+(t.left===e.site)]}function L(){for(var e,t,n,r,i=0,f=O.length;iH||Math.abs(L-d)>H)&&(l.splice(s,0,D.push(a(u,v,Math.abs(g-e)H?[e,Math.abs(c-e)H?[Math.abs(d-r)H?[n,Math.abs(c-n)H?[Math.abs(d-t)=-I)){var d=l*l+a*a,v=o*o+h*h,g=(h*d-a*v)/c,C=(l*v-o*d)/c,p=F.pop()||new y;p.arc=e,p.site=i,p.x=g+u,p.y=(p.cy=C+s)+Math.sqrt(g*g+C*C),e.circle=p;for(var L=null,R=B._;R;)if(p.yH)s=s.L;else{if(!((i=f-w(s,u))>H)){r>-H?(t=s.P,n=s):i>-H?(t=s,n=s.N):t=n=s;break}if(!s.R){t=s;break}s=s.R}v(e);var a=x(e);if(z.insert(t,a),t||n){if(t===n)return M(t),n=x(t.site),z.insert(a,n),a.edge=n.edge=l(t.site,a.site),b(t),void b(n);if(!n)return void(a.edge=l(t.site,a.site));M(t),M(n);var h=t.site,c=h[0],d=h[1],g=e[0]-c,C=e[1]-d,p=n.site,L=p[0]-c,R=p[1]-d,y=2*(g*R-C*L),U=g*g+C*C,N=L*L+R*R,P=[(R*U-C*N)/y+c,(g*N-L*U)/y+d];o(n.edge,h,p,P),a.edge=l(h,e,null,P),n.edge=l(e,p,null,P),b(t),b(n)}}function k(e,t){var n=e.site,r=n[0],i=n[1],f=i-t;if(!f)return r;var u=e.P;if(!u)return-(1/0);n=u.site;var s=n[0],l=n[1],a=l-t;if(!a)return s;var o=s-r,h=1/f-1/a,c=o/a;return h?(-c+Math.sqrt(c*c-2*h*(o*o/(-2*a)-l+a/2+i-f/2)))/h+r:(r+s)/2}function w(e,t){var n=e.N;if(n)return k(n,t);var r=e.site;return r[1]===t?r[0]:1/0}function m(e,t,n){return(e[0]-n[0])*(t[1]-e[1])-(e[0]-t[0])*(n[1]-e[1])}function A(e,t){return t[1]-e[1]||t[0]-e[0]}function j(e,t){var n,i,f,u=e.sort(A).pop();for(D=[],O=new Array(e.length),z=new r,B=new r;;)if(f=E,u&&(!f||u[1]=s)return null;var l=e-i.site[0],a=t-i.site[1],o=l*l+a*a;do{i=f.cells[r=u],u=null,i.halfedges.forEach(function(n){var r=f.edges[n],s=r.left;if(s!==i.site&&s||(s=r.right)){var l=e-s[0],a=t-s[1],h=l*l+a*a;h