import{h}from"../webmapgl.core.js";import{a as _t}from"./chunk-4fdec815.js";var DrawToolbar=function(){function t(){this.visible=!1,this.featureCount=0,this.cancelText=_t("webmapgl.draw-toolbar.cancel"),this.color="primary",this.confirmText=_t("webmapgl.draw-toolbar.confirm"),this.label=_t("webmapgl.draw-toolbar.label"),this.maxFeatures=1,this.minFeatures=1}return t.prototype.handleDrawEnter=function(t){t.detail.mapId==this.mapId&&(this.featureCount=0,this.visible=!0)},t.prototype.handleDrawExit=function(t){t.detail.mapId==this.mapId&&(this.visible=!1)},t.prototype.handleDrawCreate=function(t){t.detail.mapId==this.mapId&&(this.featureCount+=1)},t.prototype.handleDrawDelete=function(t){t.detail.mapId==this.mapId&&(this.featureCount-=1)},t.prototype.cancel=function(){this.glDrawCancel.emit({mapId:this.mapId})},t.prototype.confirm=function(){this.glDrawConfirm.emit({mapId:this.mapId})},t.prototype.render=function(){var t=this;if(this.visible){var e=screen.width<=640,a=this.featureCount>=this.minFeatures&&this.featureCount<=this.maxFeatures;return h("ion-toolbar",{color:this.color},h("ion-title",null,this.label),h("ion-buttons",{slot:"end"},h("ion-button",{onClick:function(){t.cancel()}},h("ion-icon",{slot:e?"icon-only":"start",name:"close"}),e?null:this.cancelText),h("ion-button",{onClick:function(){a&&t.confirm()},disabled:!a},h("ion-icon",{slot:e?"icon-only":"start",name:"checkmark"}),e?null:this.confirmText)))}},Object.defineProperty(t,"is",{get:function(){return"gl-draw-toolbar"},enumerable:!0,configurable:!0}),Object.defineProperty(t,"properties",{get:function(){return{cancelText:{type:String,attr:"cancel-text"},color:{type:String,attr:"color"},confirmText:{type:String,attr:"confirm-text"},featureCount:{state:!0},label:{type:String,attr:"label"},mapId:{type:String,attr:"map-id"},maxFeatures:{type:Number,attr:"max-features"},minFeatures:{type:Number,attr:"min-features"},visible:{state:!0}}},enumerable:!0,configurable:!0}),Object.defineProperty(t,"events",{get:function(){return[{name:"glDrawCancel",method:"glDrawCancel",bubbles:!0,cancelable:!0,composed:!0},{name:"glDrawConfirm",method:"glDrawConfirm",bubbles:!0,cancelable:!0,composed:!0}]},enumerable:!0,configurable:!0}),Object.defineProperty(t,"listeners",{get:function(){return[{name:"body:glDrawEnter",method:"handleDrawEnter"},{name:"body:glDrawExit",method:"handleDrawExit"},{name:"body:glDrawCreate",method:"handleDrawCreate"},{name:"body:glDrawDelete",method:"handleDrawDelete"}]},enumerable:!0,configurable:!0}),t}();export{DrawToolbar as GlDrawToolbar};