/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
import{b as u}from"./2I5LGZNX.js";import{E as l,F as p,G as d,h,i as n}from"./FFF5HUPM.js";import"./EXBEKVP5.js";export default $arcgis.t(([g])=>{var y=h`:host{display:block}.search-widget{width:100%!important;border:1px solid var(--calcite-color-border-input)}`,i=class extends d{constructor(){super(...arguments),this.popupEnabled=!1,this.resultGraphicEnabled=!1,this.searchTerm="",this.searchComponent=l()}static{this.properties={mapView:0,popupEnabled:5,resultGraphicEnabled:5,searchConfiguration:0,searchTerm:1,searchComponent:0}}static{this.styles=y}render(){let r=this.searchConfiguration&&this.mapView?this._getSearchConfig(this.searchConfiguration,this.mapView):void 0;return this.mapView&&n`<arcgis-search auto-destroy-disabled class="search-widget" .view=${this.mapView} .popupDisabled=${!this.popupEnabled} .resultGraphicDisabled=${!this.resultGraphicEnabled} .sources=${r?.sources} .searchTerm=${this.searchTerm} ${p(this.searchComponent)}></arcgis-search>`||""}_getSearchConfig(r,m){let f="includeDefaultSources",a=r.sources;return a&&a?.length>0?(r[f]=!1,a.forEach(s=>{if(s.hasOwnProperty("layer")){let e=s,t=e.layer?.id,o=t?m.map?.findLayerById(t):null,c=e?.layer?.url;o?e.layer=o:c&&(e.layer=new g(c))}}),a?.forEach(s=>{if(s.hasOwnProperty("locator")){let e=s;if(e?.name==="ArcGIS World Geocoding Service"){let t=e.outFields||["Addr_type","Match_addr","StAddr","City"];e.outFields=t,e.singleLineFieldName="SingleLine"}e.url=e.url,delete e.url}})):r={...r,includeDefaultSources:!0},r}};u("map-search",i);return i},"layers/FeatureLayer")