/* COPYRIGHT Esri - https://js.arcgis.com/1.2/LICENSE.txt */
import e from"./T2ZUVHM7.js";import b from"./HUJP6DFF.js";import{a as m}from"./XN2LWKJE.js";import"./4BPRM7CL.js";import"./NIL6NWG5.js";import{b as p}from"./ODCCVHGI.js";import{F as h,G as d,H as u,h as n,i as a,r as i,u as c}from"./42WFQ3AX.js";import"./3QPJ2JCA.js";export default $arcgis.t(([{b:b},{d:g}])=>{var _=n`@layer{
/** @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 !important;
}

.display-none {
  display: none;
}

.padding-1 {
  padding: 1rem;
}

.position-relative {
  position: relative;
}

.overflow-auto {
  overflow: auto;
}

.height-full {
  height: 100%;
}

.position-static {
  position: static !important;
}

.z-index-500 {
  z-index: 500 !important;
}

card-manager {
  display: block;
}
}`,o=class extends u{constructor(){super(),this.customInfoText="",this.enableEditGeometry=!1,this.enableSnapping=!1,this.isMobile=!1,this.zoomAndScrollToSelected=!1,this.selectedFeaturesIds=[],this.enableCreateFeatures=!0,this.createBtnLabel="",this.selectingFeatureFromMap=!1,this.showSketchWidgets=!1,this._cardLoading=!1,this._graphics=[],this._showCreateFeatureComponent=!1,this._showSubmitBtn=!1,this._translations=m({name:"card-manager",blocking:!0}),this._isFeatureCreated=!1,this._createFeature=h(),this.createWorkFlowStarted=i(),this.backFromCreateWorkFlow=i(),this.featureOrRecordSubmitted=i(),this.listenOn(window,"featureSelectionChange",this.featureSelectionChange),this.listenOn(window,"layerSelectionChange",this.layerSelectionChange),this.listenOn(window,"relatedRecordToggled",this.relatedRecordToggled)}static{this.properties={customInfoText:1,enableEditGeometry:[5,{},{type:Boolean}],enableSnapping:[5,{},{type:Boolean}],isMobile:[5,{},{type:Boolean}],layerOrTable:[0,{},{attribute:!1}],mapView:[0,{},{attribute:!1}],zoomAndScrollToSelected:[5,{},{type:Boolean}],selectedFeaturesIds:[0,{},{attribute:!1}],enableCreateFeatures:[5,{},{type:Boolean}],createBtnLabel:1,selectingFeatureFromMap:[5,{},{type:Boolean}],showSketchWidgets:[5,{},{type:Boolean}],_cardLoading:[16,{},{state:!0}],_graphics:[16,{},{state:!0}],_showCreateFeatureComponent:[16,{},{state:!0}],_showSubmitBtn:[16,{},{state:!0}],_translations:[16,{},{state:!0}]}}static{this.styles=_}static{this.shadowRootOptions=c}async featureSelectionChange(e){this._showCreateFeatureComponent&&!this._isFeatureCreated&&this._backFromCreateFeature();let t=e.detail;this._graphics=await this._getFeaturesByIds(t)}async layerSelectionChange(e){this._showCreateFeatureComponent&&this._backFromCreateFeature();let t=e.detail[0];this.layerOrTable=this.mapView?await g(this.mapView,t):void 0}async relatedRecordToggled(e){let t=e.detail;this.layerOrTable=t}async load(){this.selectedFeaturesIds?.length>0&&(this._graphics=await this._getFeaturesByIds(this.selectedFeaturesIds))}render(){let e=this._graphics?.length>0?"":"display-none",t=this._graphics?.length===0&&this._showCreateFeatureComponent?"":"display-none",s=this._graphics?.length>0||this._showCreateFeatureComponent?"display-none":"",r=this.layerOrTable?.isTable,f=this.customInfoText?this.customInfoText:this.selectingFeatureFromMap?this._translations.selectFeaturesFromMapToStart:this._translations.selectFeaturesToStart,w=this.enableCreateFeatures&&this.layerOrTable?.capabilities?.operations?.supportsAdd,l=this.createBtnLabel?this.createBtnLabel:r?this._translations.createRecord:this._translations.createFeature,F=!this.layerOrTable,y=this.enableSnapping&&!this.layerOrTable?.isTable;return a`<div class="overflow-auto height-full"><calcite-shell class=${`position-relative ${e}`}><div class="position-static z-index-500 height-full"><info-card .allowEditing=${this.layerOrTable?.editingEnabled} .enableEditGeometry=${this.enableEditGeometry} .enableSnapping=${y} .graphics=${this._graphics} .isLoading=${this._cardLoading} .isMobile=${this.isMobile} .mapView=${this.mapView} position=relative show-close-btn></info-card></div></calcite-shell><calcite-shell class=${`position-relative ${s}`}><calcite-panel><div class=padding-1><calcite-notice .icon=${this.selectingFeatureFromMap?"map":"table"} icon-flip-rtl open><div slot=message>${f}</div></calcite-notice></div>${!this.isMobile&&w&&a`<calcite-button .disabled=${F} @click=${()=>this._createFeatureBtnClicked()} slot=footer width=full>${l}</calcite-button>`||""}</calcite-panel></calcite-shell><calcite-shell class=${`position-relative ${t}`}><calcite-flow-item selected><calcite-panel .heading=${l}><calcite-action appearance=solid class="back-button hydrated" icon=chevron-left @click=${this._backFromCreateFeature} scale=s slot=header-actions-start text></calcite-action>${this.getEditorComponent()}${this._showSubmitBtn&&a`<calcite-button appearance=solid class="footer-top-button footer-button" @click=${()=>this._createFeature.value&&void this._createFeature.value.submit()} slot=footer width=full>${this._translations.create}</calcite-button>`||""}</calcite-panel></calcite-flow-item></calcite-shell></div>`}getEditorComponent(){let e=this.enableSnapping&&!this.layerOrTable?.isTable&&this.enableCreateFeatures;return a`<div>${this._showCreateFeatureComponent&&a`<create-feature customize-submit .enableSnapping=${e} .mapView=${this.mapView} .isMobile=${this.isMobile} @drawComplete=${()=>{this._showSubmitBtn=!0}} @editingAttachment=${t=>{this._showSubmitBtn=!t.detail}} @progressStatus=${()=>{setTimeout(()=>{this._isFeatureCreated=!1},2e3)}} @success=${this._featureCreated} .showSketchWidgets=${this.showSketchWidgets} .selectedLayerId=${this.layerOrTable?.id} .showLayerVisibilityMsg=${this.layerOrTable?.visible===!1} ${d(this._createFeature)}></create-feature>`||""}</div>`}async _getFeaturesByIds(e){return(e.length>0&&this.layerOrTable&&this.mapView?await b(e,this.layerOrTable,[],!0,this.mapView?.spatialReference):[]).sort((s,r)=>e.indexOf(Number(s.getObjectId()))-e.indexOf(Number(r.getObjectId())))}_createFeatureBtnClicked(){this._showCreateFeatureComponent=!0,this.createWorkFlowStarted.emit()}async _backFromCreateFeature(){this._createFeature.value&&(this._showCreateFeatureComponent=!1,this.backFromCreateWorkFlow.emit()),this._showSubmitBtn=!1}_featureCreated(){this._showCreateFeatureComponent=!1,this._showSubmitBtn=!1,this._isFeatureCreated=!0,this.featureOrRecordSubmitted.emit(),setTimeout(()=>{this._showCreateFeatureComponent=!0},50)}};p("card-manager",o);return o},b,e)