-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbundle.js
More file actions
1 lines (1 loc) · 18.3 KB
/
bundle.js
File metadata and controls
1 lines (1 loc) · 18.3 KB
1
!function(t){var i={};function e(n){if(i[n])return i[n].exports;var s=i[n]={i:n,l:!1,exports:{}};return t[n].call(s.exports,s,s.exports,e),s.l=!0,s.exports}e.m=t,e.c=i,e.d=function(t,i,n){e.o(t,i)||Object.defineProperty(t,i,{enumerable:!0,get:n})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,i){if(1&i&&(t=e(t)),8&i)return t;if(4&i&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(e.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&i&&"string"!=typeof t)for(var s in t)e.d(n,s,function(i){return t[i]}.bind(null,s));return n},e.n=function(t){var i=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(i,"a",i),i},e.o=function(t,i){return Object.prototype.hasOwnProperty.call(t,i)},e.p="",e(e.s=0)}([function(t,i,e){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var n=e(1);document.addEventListener("DOMContentLoaded",function(){(new n.default).start()},!1)},function(t,i,e){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var n=e(2),s=e(4),h=function(){function t(){this.canvas=document.getElementById("canvas"),this.ctx=this.canvas.getContext("2d"),this.foci=new n.default}return t.prototype.start=function(){this.foci.generateRandomFociWithinWindow(),this.tick()},t.prototype.draw=function(){this.canvas.height=window.innerHeight,this.canvas.width=window.innerWidth;for(var t=s.Delaunay.from(this.foci.toPrimitiveArray()),i=t.voronoi([0,0,window.innerWidth,window.innerHeight]),e=0;e<this.foci.collection.length;e++)this.ctx.beginPath(),i.renderCell(e,this.ctx),this.ctx.fillStyle=this.foci.collection[e].color,this.ctx.fill(),this.ctx.stroke();this.ctx.beginPath(),t.renderPoints(this.ctx),this.ctx.fillStyle="black",this.ctx.fill()},t.prototype.tick=function(){var t=this;setTimeout(function(){return t.tick()},20),this.draw(),this.foci.step()},t}();i.default=h},function(t,i,e){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var n=e(3),s=function(){function t(){this.collection=[]}return t.prototype.generateRandomFociWithinWindow=function(){for(var t=window.innerWidth*window.innerHeight,i=Math.floor(t/2e4),e=0;e<i;e++)this.collection.push(new n.default(window.innerWidth*Math.random(),window.innerHeight*Math.random()))},t.prototype.toPrimitiveArray=function(){return this.collection.map(function(t){return[t.x,t.y]})},t.prototype.step=function(){this.collection.forEach(function(t){return t.step()})},t}();i.default=s},function(t,i,e){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var n=function(){function t(t,i){this.x=t,this.y=i,this.heading=2*Math.random()*Math.PI,this.color="hsl("+360*Math.random()+", 100%, 50%)"}return t.prototype.step=function(){this.x=this.x+Math.cos(this.heading),this.y=this.y+Math.sin(this.heading),(this.x<0||this.x>window.innerWidth||this.y<0||this.y>window.innerHeight)&&(this.heading=2*Math.random()*Math.PI,this.x=Math.max(Math.min(this.x,window.innerWidth),0),this.y=Math.max(Math.min(this.y,window.innerHeight),0))},t}();i.default=n},function(t,i,e){"use strict";e.r(i);const n=Math.pow(2,-52),s=new Uint32Array(512);class h{static from(t,i=function(t){return t[0]},e=function(t){return t[1]}){const n=t.length,s=new Float64Array(2*n);for(let h=0;h<n;h++){const n=t[h];s[2*h]=i(n),s[2*h+1]=e(n)}return new h(s)}constructor(t){const i=t.length>>1;if(i>0&&"number"!=typeof t[0])throw new Error("Expected coords to contain numbers.");this.coords=t;const e=Math.max(2*i-5,0);this._triangles=new Uint32Array(3*e),this._halfedges=new Int32Array(3*e),this._hashSize=Math.ceil(Math.sqrt(i)),this._hullPrev=new Uint32Array(i),this._hullNext=new Uint32Array(i),this._hullTri=new Uint32Array(i),this._hullHash=new Int32Array(this._hashSize).fill(-1),this._ids=new Uint32Array(i),this._dists=new Float64Array(i),this.update()}update(){const{coords:t,_hullPrev:i,_hullNext:e,_hullTri:s,_hullHash:h}=this,o=t.length>>1;let u=1/0,f=1/0,d=-1/0,_=-1/0;for(let i=0;i<o;i++){const e=t[2*i],n=t[2*i+1];e<u&&(u=e),n<f&&(f=n),e>d&&(d=e),n>_&&(_=n),this._ids[i]=i}const g=(u+d)/2,y=(f+_)/2;let m,x,p,w=1/0;for(let i=0;i<o;i++){const e=r(g,y,t[2*i],t[2*i+1]);e<w&&(m=i,w=e)}const v=t[2*m],b=t[2*m+1];w=1/0;for(let i=0;i<o;i++){if(i===m)continue;const e=r(v,b,t[2*i],t[2*i+1]);e<w&&e>0&&(x=i,w=e)}let M=t[2*x],P=t[2*x+1],T=1/0;for(let i=0;i<o;i++){if(i===m||i===x)continue;const e=a(v,b,M,P,t[2*i],t[2*i+1]);e<T&&(p=i,T=e)}let A=t[2*p],S=t[2*p+1];if(T===1/0){for(let i=0;i<o;i++)this._dists[i]=t[2*i]-t[0]||t[2*i+1]-t[1];c(this._ids,this._dists,0,o-1);const i=new Uint32Array(o);let e=0;for(let t=0,n=-1/0;t<o;t++){const s=this._ids[t];this._dists[s]>n&&(i[e++]=s,n=this._dists[s])}return this.hull=i.subarray(0,e),this.triangles=new Uint32Array(0),void(this.halfedges=new Uint32Array(0))}if(l(v,b,M,P,A,S)){const t=x,i=M,e=P;x=p,M=A,P=S,p=t,A=i,S=e}const k=function(t,i,e,n,s,h){const r=e-t,l=n-i,o=s-t,a=h-i,c=r*r+l*l,u=o*o+a*a,f=.5/(r*a-l*o);return{x:t+(a*c-l*u)*f,y:i+(r*u-o*c)*f}}(v,b,M,P,A,S);this._cx=k.x,this._cy=k.y;for(let i=0;i<o;i++)this._dists[i]=r(t[2*i],t[2*i+1],k.x,k.y);c(this._ids,this._dists,0,o-1),this._hullStart=m;let $=3;e[m]=i[p]=x,e[x]=i[m]=p,e[p]=i[x]=m,s[m]=0,s[x]=1,s[p]=2,h.fill(-1),h[this._hashKey(v,b)]=m,h[this._hashKey(M,P)]=x,h[this._hashKey(A,S)]=p,this.trianglesLen=0,this._addTriangle(m,x,p,-1,-1,-1);for(let r,o,a=0;a<this._ids.length;a++){const c=this._ids[a],u=t[2*c],f=t[2*c+1];if(a>0&&Math.abs(u-r)<=n&&Math.abs(f-o)<=n)continue;if(r=u,o=f,c===m||c===x||c===p)continue;let d=0;for(let t=0,i=this._hashKey(u,f);t<this._hashSize&&(-1===(d=h[(i+t)%this._hashSize])||d===e[d]);t++);let _,g=d=i[d];for(;_=e[g],!l(u,f,t[2*g],t[2*g+1],t[2*_],t[2*_+1]);)if((g=_)===d){g=-1;break}if(-1===g)continue;let y=this._addTriangle(g,c,e[g],-1,-1,s[g]);s[c]=this._legalize(y+2),s[g]=y,$++;let w=e[g];for(;_=e[w],l(u,f,t[2*w],t[2*w+1],t[2*_],t[2*_+1]);)y=this._addTriangle(w,c,_,s[c],-1,s[w]),s[c]=this._legalize(y+2),e[w]=w,$--,w=_;if(g===d)for(;l(u,f,t[2*(_=i[g])],t[2*_+1],t[2*g],t[2*g+1]);)y=this._addTriangle(_,c,g,-1,s[g],s[_]),this._legalize(y+2),s[_]=y,e[g]=g,$--,g=_;this._hullStart=i[c]=g,e[g]=i[w]=c,e[c]=w,h[this._hashKey(u,f)]=c,h[this._hashKey(t[2*g],t[2*g+1])]=g}this.hull=new Uint32Array($);for(let t=0,i=this._hullStart;t<$;t++)this.hull[t]=i,i=e[i];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(t,i){return Math.floor(function(t,i){const e=t/(Math.abs(t)+Math.abs(i));return(i>0?3-e:1+e)/4}(t-this._cx,i-this._cy)*this._hashSize)%this._hashSize}_legalize(t){const{_triangles:i,_halfedges:e,coords:n}=this;let h=0,r=0;for(;;){const l=e[t],a=t-t%3;if(r=a+(t+2)%3,-1===l){if(0===h)break;t=s[--h];continue}const c=l-l%3,u=a+(t+1)%3,f=c+(l+2)%3,d=i[r],_=i[t],g=i[u],y=i[f];if(o(n[2*d],n[2*d+1],n[2*_],n[2*_+1],n[2*g],n[2*g+1],n[2*y],n[2*y+1])){i[t]=y,i[l]=d;const n=e[f];if(-1===n){let i=this._hullStart;do{if(this._hullTri[i]===f){this._hullTri[i]=t;break}i=this._hullPrev[i]}while(i!==this._hullStart)}this._link(t,n),this._link(l,e[r]),this._link(r,f);const o=c+(l+1)%3;h<s.length&&(s[h++]=o)}else{if(0===h)break;t=s[--h]}}return r}_link(t,i){this._halfedges[t]=i,-1!==i&&(this._halfedges[i]=t)}_addTriangle(t,i,e,n,s,h){const r=this.trianglesLen;return this._triangles[r]=t,this._triangles[r+1]=i,this._triangles[r+2]=e,this._link(r,n),this._link(r+1,s),this._link(r+2,h),this.trianglesLen+=3,r}}function r(t,i,e,n){const s=t-e,h=i-n;return s*s+h*h}function l(t,i,e,n,s,h){return(n-i)*(s-e)-(e-t)*(h-n)<0}function o(t,i,e,n,s,h,r,l){const o=t-r,a=i-l,c=e-r,u=n-l,f=s-r,d=h-l,_=c*c+u*u,g=f*f+d*d;return o*(u*g-_*d)-a*(c*g-_*f)+(o*o+a*a)*(c*d-u*f)<0}function a(t,i,e,n,s,h){const r=e-t,l=n-i,o=s-t,a=h-i,c=r*r+l*l,u=o*o+a*a,f=.5/(r*a-l*o),d=(a*c-l*u)*f,_=(r*u-o*c)*f;return d*d+_*_}function c(t,i,e,n){if(n-e<=20)for(let s=e+1;s<=n;s++){const n=t[s],h=i[n];let r=s-1;for(;r>=e&&i[t[r]]>h;)t[r+1]=t[r--];t[r+1]=n}else{let s=e+1,h=n;u(t,e+n>>1,s),i[t[e]]>i[t[n]]&&u(t,e,n),i[t[s]]>i[t[n]]&&u(t,s,n),i[t[e]]>i[t[s]]&&u(t,e,s);const r=t[s],l=i[r];for(;;){do{s++}while(i[t[s]]<l);do{h--}while(i[t[h]]>l);if(h<s)break;u(t,s,h)}t[e+1]=t[h],t[h]=r,n-s+1>=h-e?(c(t,i,s,n),c(t,i,e,h-1)):(c(t,i,e,h-1),c(t,i,s,n))}}function u(t,i,e){const n=t[i];t[i]=t[e],t[e]=n}const f=1e-6;class d{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(t,i){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+i}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(t,i){this._+=`L${this._x1=+t},${this._y1=+i}`}arc(t,i,e){const n=(t=+t)+(e=+e),s=i=+i;if(e<0)throw new Error("negative radius");null===this._x1?this._+=`M${n},${s}`:(Math.abs(this._x1-n)>f||Math.abs(this._y1-s)>f)&&(this._+="L"+n+","+s),e&&(this._+=`A${e},${e},0,1,1,${t-e},${i}A${e},${e},0,1,1,${this._x1=n},${this._y1=s}`)}rect(t,i,e,n){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+i}h${+e}v${+n}h${-e}Z`}value(){return this._||null}}class _{constructor(){this._=[]}moveTo(t,i){this._.push([t,i])}closePath(){this._.push(this._[0].slice())}lineTo(t,i){this._.push([t,i])}value(){return this._.length?this._:null}}class g{constructor(t,[i,e,n,s]=[0,0,960,500]){if(!((n=+n)>=(i=+i)&&(s=+s)>=(e=+e)))throw new Error("invalid bounds");this.delaunay=t,this._circumcenters=new Float64Array(2*t.points.length),this.vectors=new Float64Array(2*t.points.length),this.xmax=n,this.xmin=i,this.ymax=s,this.ymin=e,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){const{delaunay:{points:t,hull:i,triangles:e},vectors:n}=this,s=this.circumcenters=this._circumcenters.subarray(0,e.length/3*2);for(let i=0,n=0,h=e.length;i<h;i+=3,n+=2){const h=2*e[i],r=2*e[i+1],l=2*e[i+2],o=t[h],a=t[h+1],c=t[r],u=t[r+1],f=t[l],d=t[l+1],_=o-c,g=o-f,y=a-u,m=a-d,x=o*o+a*a,p=x-c*c-u*u,w=x-f*f-d*d,v=2*(g*y-_*m);v?(s[n]=(y*w-m*p)/v,s[n+1]=(g*p-_*w)/v):(s[n]=(o+f)/2+1e8*m,s[n+1]=(a+d)/2-1e8*g)}let h,r,l,o=i[i.length-1],a=4*o,c=t[2*o],u=t[2*o+1];n.fill(0);for(let e=0;e<i.length;++e)h=a,r=c,l=u,a=4*(o=i[e]),c=t[2*o],u=t[2*o+1],n[h+2]=n[a]=l-u,n[h+3]=n[a+1]=c-r}render(t){const i=null==t?t=new d:void 0,{delaunay:{halfedges:e,inedges:n,hull:s},circumcenters:h,vectors:r}=this;if(s.length<=1)return null;for(let i=0,n=e.length;i<n;++i){const n=e[i];if(n<i)continue;const s=2*Math.floor(i/3),r=2*Math.floor(n/3),l=h[s],o=h[s+1],a=h[r],c=h[r+1];this._renderSegment(l,o,a,c,t)}let l,o=s[s.length-1];for(let i=0;i<s.length;++i){l=o,o=s[i];const e=2*Math.floor(n[o]/3),a=h[e],c=h[e+1],u=4*l,f=this._project(a,c,r[u+2],r[u+3]);f&&this._renderSegment(a,c,f[0],f[1],t)}return i&&i.value()}renderBounds(t){const i=null==t?t=new d:void 0;return t.rect(this.xmin,this.ymin,this.xmax-this.xmin,this.ymax-this.ymin),i&&i.value()}renderCell(t,i){const e=null==i?i=new d:void 0,n=this._clip(t);if(null!==n){i.moveTo(n[0],n[1]);for(let t=2,e=n.length;t<e;t+=2)n[t]===n[t-2]&&n[t+1]===n[t-1]||i.lineTo(n[t],n[t+1]);return i.closePath(),e&&e.value()}}*cellPolygons(){const{delaunay:{points:t}}=this;for(let i=0,e=t.length/2;i<e;++i){const t=this.cellPolygon(i);t&&(yield t)}}cellPolygon(t){const i=new _;return this.renderCell(t,i),i.value()}_renderSegment(t,i,e,n,s){let h;const r=this._regioncode(t,i),l=this._regioncode(e,n);0===r&&0===l?(s.moveTo(t,i),s.lineTo(e,n)):(h=this._clipSegment(t,i,e,n,r,l))&&(s.moveTo(h[0],h[1]),s.lineTo(h[2],h[3]))}contains(t,i,e){return(i=+i)==i&&(e=+e)==e&&this.delaunay._step(t,i,e)===t}_cell(t){const{circumcenters:i,delaunay:{inedges:e,halfedges:n,triangles:s}}=this,h=e[t];if(-1===h)return null;const r=[];let l=h;do{const e=Math.floor(l/3);if(r.push(i[2*e],i[2*e+1]),s[l=l%3==2?l-2:l+1]!==t)break;l=n[l]}while(l!==h&&-1!==l);return r}_clip(t){if(0===t&&1===this.delaunay.hull.length)return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];const i=this._cell(t);if(null===i)return null;const{vectors:e}=this,n=4*t;return e[n]||e[n+1]?this._clipInfinite(t,i,e[n],e[n+1],e[n+2],e[n+3]):this._clipFinite(t,i)}_clipFinite(t,i){const e=i.length;let n,s,h,r,l,o=null,a=i[e-2],c=i[e-1],u=this._regioncode(a,c);for(let f=0;f<e;f+=2)if(n=a,s=c,a=i[f],c=i[f+1],h=u,u=this._regioncode(a,c),0===h&&0===u)r=l,l=0,o?o.push(a,c):o=[a,c];else{let i,e,f,d,_;if(0===h){if(null===(i=this._clipSegment(n,s,a,c,h,u)))continue;[e,f,d,_]=i}else{if(null===(i=this._clipSegment(a,c,n,s,u,h)))continue;[d,_,e,f]=i,r=l,l=this._edgecode(e,f),r&&l&&this._edge(t,r,l,o,o.length),o?o.push(e,f):o=[e,f]}r=l,l=this._edgecode(d,_),r&&l&&this._edge(t,r,l,o,o.length),o?o.push(d,_):o=[d,_]}if(o)r=l,l=this._edgecode(o[0],o[1]),r&&l&&this._edge(t,r,l,o,o.length);else if(this.contains(t,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2))return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];return o}_clipSegment(t,i,e,n,s,h){for(;;){if(0===s&&0===h)return[t,i,e,n];if(s&h)return null;let r,l,o=s||h;8&o?(r=t+(e-t)*(this.ymax-i)/(n-i),l=this.ymax):4&o?(r=t+(e-t)*(this.ymin-i)/(n-i),l=this.ymin):2&o?(l=i+(n-i)*(this.xmax-t)/(e-t),r=this.xmax):(l=i+(n-i)*(this.xmin-t)/(e-t),r=this.xmin),s?(t=r,i=l,s=this._regioncode(t,i)):(e=r,n=l,h=this._regioncode(e,n))}}_clipInfinite(t,i,e,n,s,h){let r,l=Array.from(i);if((r=this._project(l[0],l[1],e,n))&&l.unshift(r[0],r[1]),(r=this._project(l[l.length-2],l[l.length-1],s,h))&&l.push(r[0],r[1]),l=this._clipFinite(t,l))for(let i,e=0,n=l.length,s=this._edgecode(l[n-2],l[n-1]);e<n;e+=2)i=s,s=this._edgecode(l[e],l[e+1]),i&&s&&(e=this._edge(t,i,s,l,e),n=l.length);else this.contains(t,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2)&&(l=[this.xmin,this.ymin,this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax]);return l}_edge(t,i,e,n,s){for(;i!==e;){let e,h;switch(i){case 5:i=4;continue;case 4:i=6,e=this.xmax,h=this.ymin;break;case 6:i=2;continue;case 2:i=10,e=this.xmax,h=this.ymax;break;case 10:i=8;continue;case 8:i=9,e=this.xmin,h=this.ymax;break;case 9:i=1;continue;case 1:i=5,e=this.xmin,h=this.ymin}n[s]===e&&n[s+1]===h||!this.contains(t,e,h)||(n.splice(s,0,e,h),s+=2)}return s}_project(t,i,e,n){let s,h,r,l=1/0;if(n<0){if(i<=this.ymin)return null;(s=(this.ymin-i)/n)<l&&(r=this.ymin,h=t+(l=s)*e)}else if(n>0){if(i>=this.ymax)return null;(s=(this.ymax-i)/n)<l&&(r=this.ymax,h=t+(l=s)*e)}if(e>0){if(t>=this.xmax)return null;(s=(this.xmax-t)/e)<l&&(h=this.xmax,r=i+(l=s)*n)}else if(e<0){if(t<=this.xmin)return null;(s=(this.xmin-t)/e)<l&&(h=this.xmin,r=i+(l=s)*n)}return[h,r]}_edgecode(t,i){return(t===this.xmin?1:t===this.xmax?2:0)|(i===this.ymin?4:i===this.ymax?8:0)}_regioncode(t,i){return(t<this.xmin?1:t>this.xmax?2:0)|(i<this.ymin?4:i>this.ymax?8:0)}}const y=2*Math.PI;function m(t,i,e){return[t+Math.sin(t+i)*e,i+Math.cos(t-i)*e]}class x{constructor(t){this._delaunator=new h(t),this.inedges=new Int32Array(t.length/2),this._hullIndex=new Int32Array(t.length/2),this.points=this._delaunator.coords,this._init()}update(){return this._delaunator.update(),this._init(),this}_init(){const t=this._delaunator,i=this.points;if(t.hull&&t.hull.length>2&&function(t,i){let e,n,s=t.length,h=i[2*t[s-1]],r=i[2*t[s-1]+1],l=0;for(let o=0;o<s;o++)e=h,l+=(n=r)*(h=i[2*t[o]])-e*(r=i[2*t[o]+1]);return l/2}(t.hull,i)<1e-10){this.collinear=Int32Array.from({length:i.length/2},(t,i)=>i).sort((t,e)=>i[2*t]-i[2*e]||i[2*t+1]-i[2*e+1]);const t=this.collinear[0],e=this.collinear[this.collinear.length-1],n=[i[2*t],i[2*t+1],i[2*e],i[2*e+1]],s=1e-8*Math.sqrt((n[3]-n[1])**2+(n[2]-n[0])**2);for(let t=0,e=i.length/2;t<e;++t){const e=m(i[2*t],i[2*t+1],s);i[2*t]=e[0],i[2*t+1]=e[1]}this._delaunator=new h(i)}else delete this.collinear;const e=this.halfedges=this._delaunator.halfedges,n=this.hull=this._delaunator.hull,s=this.triangles=this._delaunator.triangles,r=this.inedges.fill(-1),l=this._hullIndex.fill(-1);for(let t=0,i=e.length;t<i;++t){const i=s[t%3==2?t-2:t+1];-1!==e[t]&&-1!==r[i]||(r[i]=t)}for(let t=0,i=n.length;t<i;++t)l[n[t]]=t;n.length<=2&&n.length>0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=n[0],this.triangles[1]=n[1],this.triangles[2]=n[1],r[n[0]]=1,2===n.length&&(r[n[1]]=0))}voronoi(t){return new g(this,t)}*neighbors(t){const{inedges:i,hull:e,_hullIndex:n,halfedges:s,triangles:h}=this;if(this.collinear){const i=this.collinear.indexOf(t);return i>0&&(yield this.collinear[i-1]),void(i<this.collinear.length-1&&(yield this.collinear[i+1]))}const r=i[t];if(-1===r)return;let l=r,o=-1;do{if(yield o=h[l],h[l=l%3==2?l-2:l+1]!==t)return;if(-1===(l=s[l])){const i=e[(n[t]+1)%e.length];return void(i!==o&&(yield i))}}while(l!==r)}find(t,i,e=0){if((t=+t)!=t||(i=+i)!=i)return-1;const n=e;let s;for(;(s=this._step(e,t,i))>=0&&s!==e&&s!==n;)e=s;return s}_step(t,i,e){const{inedges:n,hull:s,_hullIndex:h,halfedges:r,triangles:l,points:o}=this;if(-1===n[t]||!o.length)return(t+1)%(o.length>>1);let a=t,c=(i-o[2*t])**2+(e-o[2*t+1])**2;const u=n[t];let f=u;do{let n=l[f];const u=(i-o[2*n])**2+(e-o[2*n+1])**2;if(u<c&&(c=u,a=n),l[f=f%3==2?f-2:f+1]!==t)break;if(-1===(f=r[f])){if((f=s[(h[t]+1)%s.length])!==n&&(i-o[2*f])**2+(e-o[2*f+1])**2<c)return f;break}}while(f!==u);return a}render(t){const i=null==t?t=new d:void 0,{points:e,halfedges:n,triangles:s}=this;for(let i=0,h=n.length;i<h;++i){const h=n[i];if(h<i)continue;const r=2*s[i],l=2*s[h];t.moveTo(e[r],e[r+1]),t.lineTo(e[l],e[l+1])}return this.renderHull(t),i&&i.value()}renderPoints(t,i=2){const e=null==t?t=new d:void 0,{points:n}=this;for(let e=0,s=n.length;e<s;e+=2){const s=n[e],h=n[e+1];t.moveTo(s+i,h),t.arc(s,h,i,0,y)}return e&&e.value()}renderHull(t){const i=null==t?t=new d:void 0,{hull:e,points:n}=this,s=2*e[0],h=e.length;t.moveTo(n[s],n[s+1]);for(let i=1;i<h;++i){const s=2*e[i];t.lineTo(n[s],n[s+1])}return t.closePath(),i&&i.value()}hullPolygon(){const t=new _;return this.renderHull(t),t.value()}renderTriangle(t,i){const e=null==i?i=new d:void 0,{points:n,triangles:s}=this,h=2*s[t*=3],r=2*s[t+1],l=2*s[t+2];return i.moveTo(n[h],n[h+1]),i.lineTo(n[r],n[r+1]),i.lineTo(n[l],n[l+1]),i.closePath(),e&&e.value()}*trianglePolygons(){const{triangles:t}=this;for(let i=0,e=t.length/3;i<e;++i)yield this.trianglePolygon(i)}trianglePolygon(t){const i=new _;return this.renderTriangle(t,i),i.value()}}x.from=function(t,i=function(t){return t[0]},e=function(t){return t[1]},n){return new x("length"in t?function(t,i,e,n){const s=t.length,h=new Float64Array(2*s);for(let r=0;r<s;++r){const s=t[r];h[2*r]=i.call(n,s,r,t),h[2*r+1]=e.call(n,s,r,t)}return h}(t,i,e,n):Float64Array.from(function*(t,i,e,n){let s=0;for(const h of t)yield i.call(n,h,s,t),yield e.call(n,h,s,t),++s}(t,i,e,n)))},e.d(i,"Delaunay",function(){return x}),e.d(i,"Voronoi",function(){return g})}]);