const t=window.webmapgl.h;import{a as e}from"./chunk-4fdec815.js";class a{constructor(){this.visible=!1,this.featureCount=0,this.cancelText=e("webmapgl.draw-toolbar.cancel"),this.color="primary",this.confirmText=e("webmapgl.draw-toolbar.confirm"),this.label=e("webmapgl.draw-toolbar.label"),this.maxFeatures=1,this.minFeatures=1}handleDrawEnter(t){t.detail.mapId==this.mapId&&(this.featureCount=0,this.visible=!0)}handleDrawExit(t){t.detail.mapId==this.mapId&&(this.visible=!1)}handleDrawCreate(t){t.detail.mapId==this.mapId&&(this.featureCount+=1)}handleDrawDelete(t){t.detail.mapId==this.mapId&&(this.featureCount-=1)}cancel(){this.glDrawCancel.emit({mapId:this.mapId})}confirm(){this.glDrawConfirm.emit({mapId:this.mapId})}render(){if(!this.visible)return;let e=screen.width<=640,a=this.featureCount>=this.minFeatures&&this.featureCount<=this.maxFeatures;return t("ion-toolbar",{color:this.color},t("ion-title",null,this.label),t("ion-buttons",{slot:"end"},t("ion-button",{onClick:()=>{this.cancel()}},t("ion-icon",{slot:e?"icon-only":"start",name:"close"}),e?null:this.cancelText),t("ion-button",{onClick:()=>{a&&this.confirm()},disabled:!a},t("ion-icon",{slot:e?"icon-only":"start",name:"checkmark"}),e?null:this.confirmText)))}static get is(){return"gl-draw-toolbar"}static get properties(){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}}}static get events(){return[{name:"glDrawCancel",method:"glDrawCancel",bubbles:!0,cancelable:!0,composed:!0},{name:"glDrawConfirm",method:"glDrawConfirm",bubbles:!0,cancelable:!0,composed:!0}]}static get listeners(){return[{name:"body:glDrawEnter",method:"handleDrawEnter"},{name:"body:glDrawExit",method:"handleDrawExit"},{name:"body:glDrawCreate",method:"handleDrawCreate"},{name:"body:glDrawDelete",method:"handleDrawDelete"}]}}export{a as GlDrawToolbar};