/* COPYRIGHT Esri - https://js.arcgis.com/1.2/LICENSE.txt */
import{b as c}from"./ABSRNM72.js";import{F as n,G as h,H as d,h as a,i as o,r as t}from"./5CQPQ7AE.js";import"./3QPJ2JCA.js";export default $arcgis.t(([f,s])=>{var m=a`/** @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;
}`,r=class extends d{constructor(){super(...arguments),this.enabled=!1,this._floorFilterElement=n(),this.facilityChanged=t(),this.levelChanged=t(),this.siteChanged=t()}static{this.properties={enabled:[5,{},{type:Boolean}],floorFilterWidget:[0,{},{attribute:!1}],mapView:[0,{},{attribute:!1}]}}static{this.styles=m}willUpdate(i){i.has("mapView")&&this.mapViewWatchHandler(),i.has("enabled")&&this.enabledWatchHandler()}async mapViewWatchHandler(){this.mapView&&await this._initFloorFilter(this.mapView)}async enabledWatchHandler(){this.enabled?this.mapView&&await this._initFloorFilter(this.mapView):this.enabled||this._destroyWidget()}render(){return o`<div ${h(this._floorFilterElement)}></div>`}async loaded(){this.mapView&&!this.floorFilterWidget&&await this._initFloorFilter(this.mapView)}_destroyWidget(){this.floorFilterWidget&&(this.floorFilterWidget.destroy(),this.floorFilterWidget=void 0),this._floorFilterElement.value&&this._floorFilterElement.value.remove()}_initContainer(){this._destroyWidget(),this._floorFilterElement&&(this._floorFilterElement.value=document.createElement("div"))}async _initFloorFilter(i){let l=i?.map;l&&await l.when(()=>{i&&this.enabled&&l?.floorInfo&&(this._initContainer(),this.floorFilterWidget=new f({container:this._floorFilterElement.value,view:i}),this._facilityHandle?.remove(),this._facilityHandle=s?.watch(()=>this.floorFilterWidget?.facility,e=>{e&&this.facilityChanged.emit(e)}),this._levelHandle?.remove(),this._levelHandle=s.watch(()=>this.floorFilterWidget?.level,e=>{e&&this.levelChanged.emit(e)}),this._siteHandle?.remove(),this._siteHandle=s.watch(()=>this.floorFilterWidget?.site,e=>{e&&this.siteChanged.emit(e)}))})}};c("map-floor-filter",r);return r},"widgets/FloorFilter","core/reactiveUtils")