"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/toConsumableArray"),r=require("react"),t=require("../../utils/polygonCoords.js");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=o(e);exports.useDrawInitialization=function(e,o,u){var a=r.useRef(!1);r.useEffect((function(){o.current=e}),[e,o]),r.useEffect((function(){if(e&&!a.current)if(a.current=!0,u&&u.length>=3){var r=t.convertApiCoordsToGeoJSON(u),o=r[0],i=r[r.length-1],c=o[0]===i[0]&&o[1]===i[1]?r:[].concat(n.default(r),[o]);e.add({type:"Feature",geometry:{type:"Polygon",coordinates:[c]},properties:{}})}else e.changeMode("draw_polygon")}),[e,u])};
//# sourceMappingURL=useDrawInitialization.js.map
