import{useCallback as e}from"react";var n=function(e,n,r,t,o){e.current&&(e.current.deleteAll(),e.current.changeMode("draw_polygon")),n(null),r(!0),t(!1),o(!1)},r=function(n){var r=n.drawRef,t=n.lassoState,o=n.drawingPointCount,a=n.onPolygonChange,i=n.setLassoState,l=n.setConfirmingPolygon,c=n.setIsDrawing,g=n.setIsEditingPolygon,u=n.setIsEditingVertices,s=n.setDrawingPointCount,d=n.enterConfirmingPhase;return{discardDrawing:e((function(){r.current&&(r.current.deleteAll(),r.current.changeMode("draw_polygon"),s(0))}),[r,s]),completeDrawing:e((function(){if(r.current&&!(o<3)){var e=r.current.getAll().features[0];if(e&&"Polygon"===e.geometry.type){var n=e.geometry.coordinates[0];!n||n.length<3||(d(n),r.current.changeMode("simple_select",{featureIds:[]}),g(!1),u(!1))}}}),[r,o,d,g,u]),deletePolygon:e((function(){r.current&&(r.current.deleteAll(),"confirming"!==t.phase&&a(void 0),l(null),r.current.changeMode("draw_polygon"),c(!0),g(!1),u(!1),i({phase:"drawing",pointCount:0}))}),[r,t.phase,a,i,l,c,g,u]),handleDrawDelete:e((function(){"confirming"===t.phase?(l(null),i({phase:"idle"})):a(void 0),r.current&&(r.current.changeMode("draw_polygon"),c(!0),i({phase:"drawing",pointCount:0}))}),[r,t.phase,a,i,l,c])}};export{n as resetLassoDrawState,r as useLassoDrawActions};
//# sourceMappingURL=useLassoDrawActions.js.map
