(self.webpackChunkeodag_labextension=self.webpackChunkeodag_labextension||[]).push([[943],{3943:(e,t,o)=>{"use strict";o.r(t),o.d(t,{EditControl:()=>v});var r=o(1141),n=(o(5578),o(5741)),p=o(8297),a=o(614),i=o.n(a);function l(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{},r=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(o).filter((function(e){return Object.getOwnPropertyDescriptor(o,e).enumerable})))),r.forEach((function(t){w(e,t,o[t])}))}return e}function s(e){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function f(e,t){for(var o=0;o<t.length;o++){var r=t[o];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function u(e,t){return!t||"object"!==s(t)&&"function"!=typeof t?T(e):t}function y(e,t,o){return(y="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,o){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=d(e)););return e}(e,t);if(r){var n=Object.getOwnPropertyDescriptor(r,t);return n.get?n.get.call(o):n.value}})(e,t,o||e)}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function b(e,t){return(b=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function T(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function w(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}var h={onEdited:"draw:edited",onDrawStart:"draw:drawstart",onDrawStop:"draw:drawstop",onDrawVertex:"draw:drawvertex",onEditStart:"draw:editstart",onEditMove:"draw:editmove",onEditResize:"draw:editresize",onEditVertex:"draw:editvertex",onEditStop:"draw:editstop",onDeleted:"draw:deleted",onDeleteStart:"draw:deletestart",onDeleteStop:"draw:deletestop"},P=function(e){function t(){var e,o;c(this,t);for(var r=arguments.length,n=new Array(r),p=0;p<r;p++)n[p]=arguments[p];return w(T(T(o=u(this,(e=d(t)).call.apply(e,[this].concat(n))))),"onDrawCreate",(function(e){var t=o.props.onCreated;o.props.leaflet.layerContainer.addLayer(e.layer),t&&t(e)})),o}var o,r;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&b(e,t)}(t,e),o=t,(r=[{key:"createLeafletElement",value:function(e){return m(e)}},{key:"componentDidMount",value:function(){y(d(t.prototype),"componentDidMount",this).call(this);var e=this.props.leaflet.map,o=this.props.onMounted;for(var r in h)this.props[r]&&e.on(h[r],this.props[r]);e.on(i().Draw.Event.CREATED,this.onDrawCreate),o&&o(this.leafletElement)}},{key:"componentWillUnmount",value:function(){y(d(t.prototype),"componentWillUnmount",this).call(this);var e=this.props.leaflet.map;for(var o in e.off(i().Draw.Event.CREATED,this.onDrawCreate),h)this.props[o]&&e.off(h[o],this.props[o])}},{key:"componentDidUpdate",value:function(e){if(y(d(t.prototype),"componentDidUpdate",this).call(this,e),(0,n.Z)(this.props.draw,e.draw)||this.props.position!==e.position)return!1;var o=this.props.leaflet.map;return this.leafletElement.remove(o),this.leafletElement=m(this.props),this.leafletElement.addTo(o),null}}])&&f(o.prototype,r),t}(p.MapControl);function m(e){var t=e.leaflet.layerContainer,o=e.draw,r=e.edit,n=e.position,p={edit:l({},r,{featureGroup:t})};return o&&(p.draw=l({},o)),n&&(p.position=n),new a.Control.Draw(p)}w(P,"propTypes",l({},Object.keys(h).reduce((function(e,t){return e[t]=r.PropTypes.func,e}),{}),{onCreated:r.PropTypes.func,onMounted:r.PropTypes.func,draw:r.PropTypes.shape({polyline:r.PropTypes.oneOfType([r.PropTypes.object,r.PropTypes.bool]),polygon:r.PropTypes.oneOfType([r.PropTypes.object,r.PropTypes.bool]),rectangle:r.PropTypes.oneOfType([r.PropTypes.object,r.PropTypes.bool]),circle:r.PropTypes.oneOfType([r.PropTypes.object,r.PropTypes.bool]),marker:r.PropTypes.oneOfType([r.PropTypes.object,r.PropTypes.bool])}),edit:r.PropTypes.shape({edit:r.PropTypes.oneOfType([r.PropTypes.object,r.PropTypes.bool]),remove:r.PropTypes.oneOfType([r.PropTypes.object,r.PropTypes.bool]),poly:r.PropTypes.oneOfType([r.PropTypes.object,r.PropTypes.bool]),allowIntersection:r.PropTypes.bool}),position:r.PropTypes.oneOf(["topright","topleft","bottomright","bottomleft"]),leaflet:r.PropTypes.shape({map:r.PropTypes.instanceOf(a.Map),layerContainer:r.PropTypes.shape({addLayer:r.PropTypes.func.isRequired,removeLayer:r.PropTypes.func.isRequired})})}));const v=(0,p.withLeaflet)(P)}}]);