import r from"@babel/runtime/helpers/toConsumableArray";import{useRef as o,useEffect as e}from"react";import{convertApiCoordsToGeoJSON as t}from"../../utils/polygonCoords.js";var n=function(n,a,i){var c=o(!1);e((function(){a.current=n}),[n,a]),e((function(){if(n&&!c.current)if(c.current=!0,i&&i.length>=3){var o=t(i),e=o[0],a=o[o.length-1],p=e[0]===a[0]&&e[1]===a[1]?o:[].concat(r(o),[e]);n.add({type:"Feature",geometry:{type:"Polygon",coordinates:[p]},properties:{}})}else n.changeMode("draw_polygon")}),[n,i])};export{n as useDrawInitialization};
//# sourceMappingURL=useDrawInitialization.js.map
