import{Transform as m}from"/-/vega-dataflow@v5.7.4-DrCzG6Luqf74SfPN5Hxw/dist=es2020,mode=imports,min/optimized/vega-dataflow.js";import{inherits as d}from"/-/vega-util@v1.17.0-uRskU0IBL2vWCP4Va8OC/dist=es2020,mode=imports,min/optimized/vega-util.js";import{Delaunay as f}from"/-/d3-delaunay@v6.0.2-W2uPNrmySJLg3U5jTBxc/dist=es2020,mode=imports,min/optimized/d3-delaunay.js";function a(e){m.call(this,null,e)}a.Definition={type:"Voronoi",metadata:{modifies:!0},params:[{name:"x",type:"field",required:!0},{name:"y",type:"field",required:!0},{name:"size",type:"number",array:!0,length:2},{name:"extent",type:"array",array:!0,length:2,default:[[-1e5,-1e5],[1e5,1e5]],content:{type:"number",array:!0,length:2}},{name:"as",type:"string",default:"path"}]};const y=[-1e5,-1e5,1e5,1e5];d(a,m,{transform(e,r){const n=e.as||"path",t=r.source;if(!t||!t.length)return r;let o=e.size;o=o?[0,0,o[0],o[1]]:(o=e.extent)?[o[0][0],o[0][1],o[1][0],o[1][1]]:y;const s=this.value=f.from(t,e.x,e.y).voronoi(o);for(let i=0,u=t.length;i<u;++i){const l=s.cellPolygon(i);t[i][n]=l?g(l):null}return r.reflow(e.modified()).modifies(n)}});function g(e){const r=e[0][0],n=e[0][1];let t=e.length-1;for(;e[t][0]===r&&e[t][1]===n;--t);return"M"+e.slice(0,t+1).join("L")+"Z"}export{a as voronoi};export default null;
