/* COPYRIGHT Esri - https://js.arcgis.com/1.2/LICENSE.txt */
import{a as r}from"./XN2LWKJE.js";import"./4BPRM7CL.js";import"./NIL6NWG5.js";import{b as o}from"./ODCCVHGI.js";import{H as n,h as l,i as a,r as i}from"./42WFQ3AX.js";import"./3QPJ2JCA.js";var c=l`/** @license
 * Copyright 2025 Esri
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

:host {
  display: block;
}`,s=class extends n{constructor(){super(...arguments),this.ids=[],this.open=!1,this._isDeleting=!1,this._translations=r({name:"delete-dialog",blocking:!0}),this.editsComplete=i(),this.deleteDialogClose=i()}static{this.properties={ids:[0,{},{attribute:!1}],layer:[0,{},{attribute:!1}],open:[5,{},{type:Boolean}],_isDeleting:[16,{},{state:!0}],_translations:[16,{},{state:!0}]}}static{this.styles=c}render(){let e=this.layer?.title||"",t=this.ids.length===1?(this._translations.confirmSingle||"").replace("{{layer-name}}",e):(this._translations.confirmMultiple||"").replace("{{layer-name}}",e);return a`<calcite-dialog .heading=${this._translations.deleteFeature} kind=danger modal @calciteDialogClose=${()=>this._close()} .open=${this.open} width=s><div>${t}</div><calcite-button appearance=outline kind=danger @click=${()=>this._close()} slot=footer-end width=full>${this._translations.cancel}</calcite-button><calcite-button kind=danger .loading=${this._isDeleting} @click=${()=>void this._deleteFeatures()} slot=footer-end width=full>${this._translations.delete}</calcite-button></calcite-dialog>`}async _deleteFeatures(){if(this.layer){this._isDeleting=!0;let e=this.ids.map(t=>({objectId:Number(t)}));await this.layer.applyEdits({deleteFeatures:e}),this._isDeleting=!1,this._close(),this.editsComplete.emit("delete")}}_close(){this.open=!1,this.deleteDialogClose.emit()}};o("delete-dialog",s);export{s as DeleteDialog};
