Custom Gis Application with Arcgis Javascript API with modern layouting
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

162 lines
81 KiB

// All material copyright Esri, All Rights Reserved, unless otherwise specified.
// See https://js.arcgis.com/4.30/esri/copyright.txt for details.
//>>built
require({cache:{"esri/widgets/Search/css":function(){define(["exports"],function(b){b.css={base:"esri-search",hasMultipleSources:"esri-search--multiple-sources",isLoading:"esri-search--loading",isSearching:"esri-search--searching",showSuggestions:"esri-search--show-suggestions",showSources:"esri-search--sources",showWarning:"esri-search--warning",container:"esri-search__container",input:"esri-search__input",inputContainer:"esri-search__input-container",form:"esri-search__form",submitButton:"esri-search__submit-button",
sourcesButton:"esri-search__sources-button",sourcesButtonDown:"esri-search__sources-button--down",sourcesButtonUp:"esri-search__sources-button--up",clearButton:"esri-search__clear-button",sourceName:"esri-search__source-name",suggestionsMenu:"esri-search__suggestions-menu",suggestionList:"esri-search__suggestions-list",suggestionListCurrentLocation:"esri-search__suggestions-list--current-location",sourcesMenu:"esri-search__sources-menu",source:"esri-search__source",warningMenu:"esri-search__warning-menu",
warningMenuBody:"esri-search__warning-body",warningMenuHeader:"esri-search__warning-header",warningMenuText:"esri-search__warning-text",noValueText:"esri-search__no-value-text"};Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})})},"esri/widgets/Search/SearchResultRenderer":function(){define("../../chunks/tslib.es6 ../../core/accessorSupport/decorators/property ../../core/has ../../core/Logger ../../core/RandomLCG ../../core/accessorSupport/decorators/subclass ../Widget ./searchResultRendererCSS ./SearchViewModel ../support/globalCss ../support/decorators/accessibleHandler ../support/decorators/messageBundle ../support/jsxFactory ../support/widgetUtils".split(" "),
function(b,d,l,h,F,f,x,r,A,u,K,n,y,N){l=class extends x{constructor(v,t){super(v,t);this.messages=null;this.showMoreResultsOpen=!1;this.viewModel=null}destroy(){this.viewModel=null}render(){const v={[r.css.showMoreResults]:this.showMoreResultsOpen};return y.tsx("div",{class:this.classes(r.css.base,u.globalCss.widget)},y.tsx("div",{class:this.classes(r.css.moreResults,v),key:"esri-search-renderer__container"},this._renderSearchResultName(),this._renderMoreResults()))}_renderMoreResults(){return y.tsx("div",
{key:"esri-search-renderer__more-results"},this._renderMoreResultsButton(),this._renderMoreResultsLists())}_renderSearchResultName(){return y.tsx("div",{class:r.css.moreResultsItem,key:"esri-search-renderer__result-name"},this.viewModel?.selectedResult?.name||"")}_renderMoreResultsLists(){var {viewModel:v}=this;if(!v)return[];if(2>(v.resultCount??0))return null;v=v.results?.map(t=>this._renderMoreResultsList(t));return y.tsx("div",{class:r.css.moreResultsList,key:"esri-search-renderer__more-results-container"},
v)}_renderMoreResultsButton(){const {messages:v,viewModel:t}=this;return!t||2>(t.resultCount??0)?null:y.tsx("div",{class:r.css.moreResultsItem,key:"esri-search-renderer__more-results-button"},y.tsx("a",{bind:this,class:u.globalCss.anchor,href:"#",onclick:this._showMoreResultsClick,onkeydown:this._showMoreResultsClick},this.showMoreResultsOpen?v.hideMoreResults:v.showMoreResults))}_renderMoreResultsHeader(v,t){return y.tsx("div",{class:r.css.moreResultsListHeader,key:`esri-search-result-renderer__header-${t}`},
v)}_renderMoreResultsList(v){var {results:t}=v,m=t?.length??0;const H=0<m;var D=this.viewModel?.selectedResult;m=1===m&&t[0]===D;D=this._getSourceName(v.source,v.sourceIndex);D=1<(this.viewModel?.results?.length??0)&&!m?this._renderMoreResultsHeader(D,v.sourceIndex):null;t=H&&t.map((z,V)=>this._renderMoreResultsListItem(z,V));t=H&&!m?y.tsx("ul",{key:`esri-search-result-renderer__list-${v.sourceIndex}`},t):null;return H?y.tsx("div",{key:`esri-search-result-renderer__results-${v.sourceIndex}`},D,t):
null}_renderMoreResultsListItem(v,t){return v!==this.viewModel?.selectedResult?y.tsx("li",{key:`esri-search-result-renderer__list-item-${t}`},y.tsx("a",{bind:this,class:u.globalCss.anchor,"data-result":v,href:"#",onclick:this._selectResultClick,onkeydown:this._selectResultClick,tabIndex:0},v.name)):null}_showMoreResultsClick(v){v.preventDefault();this.showMoreResultsOpen=!this.showMoreResultsOpen;(v=this.viewModel?.view?.popup)&&"reposition"in v&&v.reposition()}_selectResultClick(v){v.preventDefault();
v=v.currentTarget["data-result"];this.viewModel?.select(v)}_getSourceName(v,t){return t===A.ALL_INDEX?this.messages.all:v.name}};b.__decorate([d.property(),n.messageBundle("esri/widgets/Search/t9n/Search")],l.prototype,"messages",void 0);b.__decorate([d.property()],l.prototype,"showMoreResultsOpen",void 0);b.__decorate([d.property()],l.prototype,"viewModel",void 0);b.__decorate([K.accessibleHandler()],l.prototype,"_showMoreResultsClick",null);b.__decorate([K.accessibleHandler()],l.prototype,"_selectResultClick",
null);return l=b.__decorate([f.subclass("esri.widgets.Search.SearchResultRenderer")],l)})},"esri/widgets/Search/searchResultRendererCSS":function(){define(["exports"],function(b){b.css={base:"esri-search-result-renderer",showMoreResults:"esri-search-result-renderer__more-results--show-more-results",moreResults:"esri-search-result-renderer__more-results",moreResultsList:"esri-search-result-renderer__more-results-list",moreResultsHeader:"esri-search-result-renderer__more-results-header",moreResultsItem:"esri-search-result-renderer__more-results-item",
moreResultsListHeader:"esri-search-result-renderer__more-results-list-header"};Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})})},"esri/widgets/Search/SearchViewModel":function(){define("../../chunks/tslib.es6 ../../assets ../../config ../../Graphic ../../PopupTemplate ../../symbols ../../core/Accessor ../../core/arrayUtils ../../core/Collection ../../core/Error ../../core/Evented ../../core/Logger ../../core/maybe ../../core/promiseUtils ../../core/reactiveUtils ../../core/accessorSupport/decorators/property ../../core/has ../../core/accessorSupport/decorators/subclass ../../geometry/Point ../../geometry/SpatialReference ../../geometry/support/geometryUtils ../../intl/locale ../../intl/messages ../../portal/Portal ../../views/support/layerViewUtils ./LayerSearchSource ./LocatorSearchSource ./SearchSource ./support/locatorUtils ../support/geolocationUtils ../support/GoTo ../../symbols/PictureMarkerSymbol ../../symbols/SimpleLineSymbol ../../symbols/SimpleFillSymbol ../../symbols/TextSymbol".split(" "),
function(b,d,l,h,F,f,x,r,A,u,K,n,y,N,v,t,m,H,D,z,V,X,ba,c,g,w,G,R,W,Q,q,E,B,O,P){function M(a,e){return a.hasOwnProperty(e)&&null!=a[e]&&""!==a[e]}const J=A.ofType({key:a=>a.layer?"layer":"locator",base:R,typeMap:{layer:w,locator:G}}),Y=z.WGS84,T=/<[\s\S]*?>/g;f=class extends q.GoToMixin(K.EventedMixin(x)){constructor(a){super(a);this._updatingPromise=this._searching=this._gotoController=null;this._createdFeatureLayers=[];this.autoSelect=this.autoNavigate=!0;this.defaultPopupTemplate=null;this.defaultSources=
new J;this.defaultSymbols={point:new E({url:d.getAssetUrl("esri/images/search/search-symbol-32.png"),size:24,width:24,height:24}),polyline:new B({color:[130,130,130,1],width:2}),polygon:new O({color:[235,235,235,.4],outline:{color:[130,130,130,1],width:2}})};this.includeDefaultSources=!0;this.maxInputLength=128;this.maxSuggestions=this.maxResults=6;this.messages=null;this.minSuggestCharacters=3;this.popupEnabled=!0;this.popupTemplate=null;this.portal=c.getDefault();this.resultCount=null;this.resultGraphicEnabled=
!0;this.selectedSuggestion=this.results=this.resultGraphic=null;this.searchAllEnabled=!0;this.selectedResult=null;this.sources=new J;this.suggestionDelay=350;this.suggestions=this.suggestionCount=null;this.suggestionsEnabled=!0;this.view=null}initialize(){const a=async()=>{const e=await ba.fetchMessageBundle("esri/widgets/Search/t9n/Search");this.messages=e;this.defaultPopupTemplate=new F({title:e.searchResult,content:"{Match_addr}"})};a();this.addHandles([v.watch(()=>[this.includeDefaultSources,
this.view,this.portal],()=>this._update(),v.initial),X.onLocaleChange(a)])}destroy(){this._destroyFeatureLayers();this._abortGoTo();this.clearGraphics()}get activeSource(){return this.allSources.at(this.activeSourceIndex)??null}get activeSourceIndex(){return 1!==this.allSources.length&&this.searchAllEnabled?-1:0}set activeSourceIndex(a){this._overrideIfSome("activeSourceIndex",a)}get allPlaceholder(){return this.messages?.allPlaceholder}set allPlaceholder(a){this._overrideIfSome("allPlaceholder",
a)}get allSources(){const {sources:a,defaultSources:e,includeDefaultSources:k}=this,p="function"===typeof k?k.call(null,{sources:a,defaultSources:e}):k?e.concat(a):a,C=this._get("allSources")||new J;C.removeAll();C.addMany(p.filter(Boolean));return C}get locationEnabled(){return this._get("locationEnabled")||Q.supported()}set locationEnabled(a){if(void 0===a)this._clearOverride("locationEnabled");else{var e=Q.supported();if(a&&!e){const k=new u("locationEnabled:geolocation-unsupported","Geolocation API is unsupported.",
{geolocation:navigator.geolocation});n.getLogger(this).error(k)}this._override("locationEnabled",!!a&&e)}}get placeholder(){const {allSources:a,activeSourceIndex:e,allPlaceholder:k}=this;return-1===e?k??"":a.at(e)?.placeholder??""}set searchTerm(a){this._set("searchTerm",a||"");this.clearGraphics();this.selectedSuggestion&&this.selectedSuggestion.text!==a&&this._set("selectedSuggestion",null);""===a&&this._clear()}get searchTerm(){return this._get("searchTerm")||""}get state(){return this._searching?
"searching":this.updating?"loading":0===this.allSources.length?"disabled":"ready"}get updating(){return null!=this._updatingPromise}clear(){this.searchTerm=""}clearGraphics(){this._removeHighlight();this._closePopup();const {view:a,resultGraphic:e}=this;a&&e&&a.graphics.remove(e);this._set("resultGraphic",null)}search(a,e){this.emit("search-start");this.clearGraphics();const k=this._createSuggestionForSearch(a);return this._searching=a=(async()=>{try{await this.when();const p=await this._getResultsFromSources(k,
e);if(e?.signal?.aborted)return null;const C={activeSourceIndex:this.activeSourceIndex,searchTerm:k.text??"",numResults:0,numErrors:0,errors:[],results:[]};this._formatResponse(C,p,k);const L=this._getFirstResult(C.results),S=(k.location&&L?L.name:k.text)?.replace(T,"");this._set("searchTerm",S);(k.key&&"number"===typeof k.sourceIndex||k.location)&&this._set("selectedSuggestion",k);this._set("results",C.results);this._set("resultCount",C.results.reduce((I,U)=>I+(U.results?.length??0),0));this.emit("search-complete",
C);await this._selectFirstResult(L);return C}finally{this._clearSearching()}})()}async searchNearby(a){if(!this.locationEnabled){var e=new u("searchNearby:geolocation-unsupported","Geolocation API is unsupported.",{geolocation:navigator.geolocation});n.getLogger(this).error(e);throw e;}return this._searching=e=(async()=>{try{const k=await Q.getCurrentPosition(),p=await Q.positionToPoint({position:k,view:this.view},a);return await this.search(p,a)}finally{this._clearSearching()}})()}async select(a){this.clearGraphics();
if(!a)throw a=new u("select:missing-parameter","Cannot select without a searchResult.",{searchResult:a}),n.getLogger(this).error(a),a;const {view:e}=this,k=M(a,"sourceIndex")?a.sourceIndex:this._getSourceIndexOfResult(a),p=null!=k?this.allSources.at(k):null;if(!p)throw a=new u("select:missing-source","Cannot select without a source.",{source:p}),n.getLogger(this).error(a),a;var C=p instanceof w?this._getLayerSourcePopupTemplate(p):p.popupTemplate,L=p.resultSymbol||this._getDefaultSymbol(a);const S=
M(p,"resultGraphicEnabled")?p.resultGraphicEnabled:this.resultGraphicEnabled;var I=M(p,"autoNavigate")?p.autoNavigate:this.autoNavigate,U=M(p,"popupEnabled")?p.popupEnabled:this.popupEnabled;const fa=U?C||this.popupTemplate||this.defaultPopupTemplate:null,{feature:ca}=a;if(!ca)throw a=new u("select:missing-feature","Cannot select without a feature.",{feature:ca}),n.getLogger(this).error(a),a;const {attributes:Z,geometry:aa,layer:da,sourceLayer:ha}=ca;C=aa?V.getPointFromGeometry(aa):null;C={layerViewQuery:this._getLayerView(ca),
elevationQuery:e&&null!=C?V.getPointWithElevation(C,e):Promise.resolve(C)};var ea=await N.eachAlways(C);C=ea.layerViewQuery.value;ea=ea.elevationQuery.value;L instanceof P&&(L.text=a.name);I=e&&I?a.target||a.extent:null;await (null!=I?this._goToSearchResult(I):Promise.resolve());L=C?ca:new h({geometry:aa,symbol:L,attributes:Z,layer:da,sourceLayer:ha,popupTemplate:fa});(U=(I=e?.popup)&&U&&L.getEffectivePopupTemplate(I.defaultPopupTemplateEnabled))&&await e.openPopup({features:[L],location:ea});C&&
g.highlightsSupported(C)&&!U&&this._highlightFeature({graphic:L,layerView:C});!C&&S&&e&&e.graphics.push(L);this._setResultFloor(a);this._set("selectedResult",a);this._set("resultGraphic",L);this.emit("select-result",{result:a,source:p,sourceIndex:k});return a}async suggest(a,e,k){a=a||this.searchTerm;this.emit("suggest-start",{searchTerm:a});await this._suggestTimer(e,k);e=await this._suggestImmediate(a,k);this._set("suggestions",e?.results);this._set("suggestionCount",e?.results.reduce((p,C)=>p+
(C.results?.length??0),0)??null);this.emit("suggest-complete",e);return e}async when(){await v.whenOnce(()=>!this.updating)}async _update(){const {portal:a,view:e}=this;if(this.includeDefaultSources){const k=this._updatingPromise=N.eachAlways([a?.load(),e?.when()]);if(this.destroyed)return;await k;if(k!==this._updatingPromise)return}await v.whenOnce(()=>this.messages);this.destroyed||this._updateDefaultSources();this._updatingPromise=null}_clearSearching(){this._searching=null}_convertHelperServices(){const a=
this.portal?.helperServices?.geocode;return a?a.map(e=>{if(!1!==e.placefinding){var k=l.apiKey&&W.isArcGISWorldGeocoder(e.url)?{url:W.meteredArcGISLocatorUrl}:null;e=G.fromJSON({...e,...k});k=e.url;if(W.isArcGISWorldGeocoder(k)||W.isProxiedArcGISWorldGeocoder(k)||W.isMeteredArcGISWorldGeocoder(k)){k=e.outFields??["Addr_type","Match_addr","StAddr","City"];const p=(e.placeholder||this.messages?.placeholder)??"",C="number"===typeof e.defaultZoomScale?e.defaultZoomScale:2500;e.singleLineFieldName="SingleLine";
e.outFields=k;e.placeholder=p;e.defaultZoomScale=C}if(e.singleLineFieldName)return e}}).filter(r.isSome):[]}_destroyFeatureLayers(){this._createdFeatureLayers.forEach(a=>a?.destroy());this._createdFeatureLayers=[]}_getLayerSources(a,e){const k=this.view?.map;return a.map(p=>{const C=k.findLayerById(p.id);if(C){p=this._getLayerJSON(p);var L=w.fromJSON(p);L.placeholder=e;this._getLayer(C,p).then(S=>{L.layer=S});return L}}).filter(r.isSome).toArray()}_getTableSources(a,e){const k=this.view?.map;return a.map(p=>
{if(p.id){var C=k.findTableById(p.id);if(C){p=this._getLayerJSON(p);var L=w.fromJSON(p);L.placeholder=e;this._getLayer(C,p).then(S=>{L.layer=S});return L}}}).filter(r.isSome).toArray()}_convertApplicationProperties(){var a=this.view?.map?.applicationProperties?.viewing?.search;if(!a)return[];const {enabled:e,hintText:k,layers:p,tables:C}=a;if(!e)return[];a=this._getLayerSources(p,k);const L=this._getTableSources(C,k);return[...a,...L]}async _getSubLayer(a,e){await a.load();if(!a.allSublayers)throw Error();
a=a.allSublayers.find(k=>k.id===e.subLayer);if(!a)throw Error();a=await a.createFeatureLayer?.();if(!a)throw Error();this._createdFeatureLayers.push(a);return a}async _getBuildingSubLayer(a,e){await a.load();a=a.allSublayers.find(k=>k.id===e.subLayer);if("building-component"!==a?.type)throw Error();await a.load();if(null==a.associatedLayer)throw Error();await a.associatedLayer.load();return a}async _getLayer(a,e){if("feature"===a.type||"scene"===a.type||"csv"===a.type||"geojson"===a.type||"ogc-feature"===
a.type)return a;if("map-image"===a.type)try{return await this._getSubLayer(a,e)}catch(k){return a=new u("search:create-featurelayer","Could not create a FeatureLayer from the MapImageLayer",{layer:a}),n.getLogger(this).error(a),null}return"building-scene"===a.type?this._getBuildingSubLayer(a,e):null}_getLayerJSON(a){return"function"===typeof a.toJSON?a.toJSON():a}_updateDefaultSources(){const {defaultSources:a,includeDefaultSources:e}=this;this._destroyFeatureLayers();a.removeAll();e&&a.addMany([...this._convertApplicationProperties(),
...this._convertHelperServices()])}_abortGoTo(){this._gotoController&&this._gotoController.abort();this._gotoController=null}_clear(){this._abortGoTo();this._set("resultCount",null);this._set("results",null);this._set("suggestions",null);this._set("suggestionCount",null);this._set("selectedResult",null);this._set("selectedSuggestion",null);this.emit("search-clear")}_closePopup(){const a=this.view?.popup,{resultGraphic:e}=this;if(a&&e){var k="selectedFeature"in a,p=k?a.selectedFeature:null;k&&p&&p===
e&&a.close()}}_suggestTimer(a,e){return N.after(null!=a?a:this.suggestionDelay,null,e?.signal)}_createLocationForSearch(a){return a instanceof h&&a.geometry?V.getPointFromGeometry(a.geometry):a instanceof D?a:Array.isArray(a)&&2===a.length?new D({longitude:a[0],latitude:a[1]}):null}_createSuggestionForSearch(a){if(a&&M(a,"key")&&M(a,"text")&&M(a,"sourceIndex"))return a;const e=this._createLocationForSearch(a),k="string"===typeof a?a:this.searchTerm,{selectedSuggestion:p,selectedResult:C}=this,L=(a=
!a&&p&&C)&&p.location;return a&&p.key===C.key&&p.sourceIndex===C.sourceIndex||L?p:{location:e,text:e?"":k,sourceIndex:null,key:null}}_getFirstResult(a){return y.mappedFind(a,({results:e})=>e?.[0])??null}async _selectFirstResult(a){return this.autoSelect&&a?this.select(a):null}async _suggestImmediate(a,e){await this.when();const k=await this._getSuggestionsFromSources(a,e);if(e?.signal?.aborted)return null;a={activeSourceIndex:this.activeSourceIndex,searchTerm:a??"",numResults:0,numErrors:0,errors:[],
results:[]};this._formatResponse(a,k);return a}_formatSourceResponse(a,e,k){const p=e?.value||[];e=e?.error;const C=this.allSources.at(k);e?(a.errors.push({sourceIndex:k,source:C,error:e}),n.getLogger(this).error(e),a.numErrors++):(a.results.push({sourceIndex:k,source:C,results:p}),a.numResults+=p.length)}_formatResponse(a,e,k){if(e)if(-1===a.activeSourceIndex){const p=k&&M(k,"sourceIndex")&&-1!==k.sourceIndex?k.sourceIndex:void 0;e.forEach((C,L)=>{this._formatSourceResponse(a,C,void 0!==p?p:L)})}else this._formatSourceResponse(a,
e[0],a.activeSourceIndex)}async _getResultsFromSources(a,e){var {allSources:k}=this;const p=!a.location&&M(a,"sourceIndex")?a.sourceIndex:this.activeSourceIndex,C=[];if(!k.length)throw k=new u("search:no-sources-defined","At least one source is required.",{allSources:k}),n.getLogger(this).error(k),k;-1===p?k.forEach((L,S)=>{C.push(this._getResultsFromSource(a,S,e))}):C.push(this._getResultsFromSource(a,p,e));return N.eachAlways(C)}async _getSuggestionsFromSources(a,e){const {allSources:k,activeSourceIndex:p}=
this,C=[];if(!k.length){const L=new u("suggest:no-sources-defined","At least one source is required.",{allSources:k});n.getLogger(this).error(L);throw L;}-1===p?k.forEach((L,S)=>{C.push(this._getSuggestionsFromSource(a,S,e))}):C.push(this._getSuggestionsFromSource(a,p,e));return N.eachAlways(C)}async _getResultsFromSource(a,e,k){const p=null!=e?this.allSources.at(e):null;if(!p)return null;const {location:C=null}=a,L=this.view?.spatialReference||Y,S=M(p,"maxResults")?p.maxResults:this.maxResults,I=
p instanceof w&&M(p,"exactMatch")?p.exactMatch:!1,{view:U}=this;return p.getResults?.({view:U,sourceIndex:e,location:C,suggestResult:a,spatialReference:L,exactMatch:I,maxResults:S},k)}async _getSuggestionsFromSource(a,e,k){const p=this.allSources.at(e);if(!p)return null;a??="";var C=M(p,"suggestionsEnabled")?p.suggestionsEnabled:this.suggestionsEnabled,L=a?.length,S=M(p,"minSuggestCharacters")?p.minSuggestCharacters:this.minSuggestCharacters;if(C&&a.trim()&&L>=S){C=this.view?.spatialReference||Y;
L=M(p,"maxSuggestions")?p.maxSuggestions:this.maxSuggestions;({view:S}=this);const I=p instanceof w&&M(p,"exactMatch")?p.exactMatch:!1;return p.getSuggestions?.({view:S,sourceIndex:e,suggestTerm:a,spatialReference:C,maxSuggestions:L,exactMatch:I},k)}return null}_getLayerSourcePopupTemplate(a){const {layer:e}=a;if(e)return M(a,"popupTemplate")?a.popupTemplate:e.popupTemplate}_getSourceIndexOfResult(a){return y.mappedFind(this.results??[],({results:e,sourceIndex:k})=>e?.includes(a)?k:null)??null}async _goToSearchResult(a){this._abortGoTo();
var e=new AbortController;this._gotoController=e;e={target:{target:a},options:{signal:e.signal}};a||(e.options.animate=!1);await this.callGoTo(e);this._gotoController=null}_getDefaultSymbol(a){const {defaultSymbols:e}=this;a=a.feature?.geometry;if(null==a)return null;switch(a.type){case "point":case "multipoint":return e.point;case "polyline":return e.polyline;case "extent":case "polygon":return e.polygon;default:return null}}_removeHighlight(){this.removeHandles("highlight")}async _getLayerView(a){const {view:e}=
this;if(!a||!e||"building-component"===a.layer?.type||"subtype-sublayer"===a.layer?.type)return null;({layer:a}=a);if(!a)return null;await e.when();return e.whenLayerView(a)}_highlightFeature(a){const {graphic:e,layerView:k}=a,{attributes:p,layer:C}=e;({objectIdField:a}=C);a=k.highlight((a&&p?.[a])??null??e);this.addHandles(a,"highlight")}_setResultFloor(a){const {view:e}=this;var k=a.feature?.attributes;(a=a.feature?.sourceLayer)&&"floorInfo"in a&&a?.floorInfo?.floorField&&k&&(k=k[a.floorInfo.floorField],
e?.emit("select-result-floor",k))}};f.ALL_INDEX=-1;b.__decorate([t.property()],f.prototype,"_searching",void 0);b.__decorate([t.property()],f.prototype,"_updatingPromise",void 0);b.__decorate([t.property({readOnly:!0,value:null})],f.prototype,"activeSource",null);b.__decorate([t.property()],f.prototype,"activeSourceIndex",null);b.__decorate([t.property()],f.prototype,"allPlaceholder",null);b.__decorate([t.property({readOnly:!0})],f.prototype,"allSources",null);b.__decorate([t.property()],f.prototype,
"autoNavigate",void 0);b.__decorate([t.property()],f.prototype,"autoSelect",void 0);b.__decorate([t.property()],f.prototype,"defaultPopupTemplate",void 0);b.__decorate([t.property({readOnly:!0})],f.prototype,"defaultSources",void 0);b.__decorate([t.property()],f.prototype,"defaultSymbols",void 0);b.__decorate([t.property()],f.prototype,"includeDefaultSources",void 0);b.__decorate([t.property()],f.prototype,"locationEnabled",null);b.__decorate([t.property()],f.prototype,"maxInputLength",void 0);b.__decorate([t.property()],
f.prototype,"maxResults",void 0);b.__decorate([t.property()],f.prototype,"maxSuggestions",void 0);b.__decorate([t.property()],f.prototype,"messages",void 0);b.__decorate([t.property()],f.prototype,"minSuggestCharacters",void 0);b.__decorate([t.property({readOnly:!0})],f.prototype,"placeholder",null);b.__decorate([t.property()],f.prototype,"popupEnabled",void 0);b.__decorate([t.property({type:F})],f.prototype,"popupTemplate",void 0);b.__decorate([t.property({type:c})],f.prototype,"portal",void 0);
b.__decorate([t.property()],f.prototype,"resultCount",void 0);b.__decorate([t.property()],f.prototype,"resultGraphicEnabled",void 0);b.__decorate([t.property({readOnly:!0})],f.prototype,"resultGraphic",void 0);b.__decorate([t.property({readOnly:!0})],f.prototype,"results",void 0);b.__decorate([t.property({readOnly:!0})],f.prototype,"selectedSuggestion",void 0);b.__decorate([t.property()],f.prototype,"searchAllEnabled",void 0);b.__decorate([t.property({readOnly:!0})],f.prototype,"selectedResult",void 0);
b.__decorate([t.property()],f.prototype,"searchTerm",null);b.__decorate([t.property({type:J})],f.prototype,"sources",void 0);b.__decorate([t.property({readOnly:!0})],f.prototype,"state",null);b.__decorate([t.property()],f.prototype,"suggestionDelay",void 0);b.__decorate([t.property()],f.prototype,"suggestionCount",void 0);b.__decorate([t.property({readOnly:!0})],f.prototype,"suggestions",void 0);b.__decorate([t.property()],f.prototype,"suggestionsEnabled",void 0);b.__decorate([t.property({readOnly:!0})],
f.prototype,"updating",null);b.__decorate([t.property()],f.prototype,"view",void 0);b.__decorate([t.property()],f.prototype,"clear",null);return f=b.__decorate([H.subclass("esri.widgets.Search.SearchViewModel")],f)})},"esri/geometry/support/geometryUtils":function(){define(["exports","../../geometry","./scaleUtils","../Extent"],function(b,d,l,h){function F(f,x,r){const A=f.hasZ?f.z:void 0;if(x?.map)return(null!=r?l.getExtentForScale(x,r):x.extent).clone().centerAt(f).set({zmax:A,zmin:A});const {x:u,
y:K,spatialReference:n}=f;return new h({xmin:u-.25,ymin:K-.25,xmax:u+.25,ymax:K+.25,spatialReference:n,zmin:A,zmax:A})}b.createExtentFromGeometry=function(f,x,r){switch(f?.type){case "extent":return f;case "multipoint":case "polygon":case "polyline":return f.extent;case "point":return F(f,x,r);default:return null}};b.createExtentFromPoint=F;b.getPointFromGeometry=function(f){switch(f?.type){case "point":return f;case "extent":return f.center;case "polygon":return f.centroid;case "multipoint":case "polyline":return f.extent?.center;
default:return null}};b.getPointWithElevation=async function(f,x){if(f.hasZ||"2d"===x.type)return f;const r=x.map?.ground;if(!r?.layers.length)return f;({geometry:f}=await r.queryElevation(f,{cache:x.basemapTerrain?.elevationQueryCache}));return f};b.scaleExtent=function(f,x,r){return F(f.center,x,r)};Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})})},"esri/geometry/support/scaleUtils":function(){define(["exports","../../core/mathUtils","../../core/unitUtils"],function(b,d,l){function h(F,
f){f=l.getMetersPerUnitForSR(f);return F/(f*l.inchesPerMeter*96)}b.getExtentForScale=function(F,f){const x=F.extent;F=F.width-(F.padding?F.padding.left+F.padding.right:0);f=h(f,x.spatialReference);return x.clone().expand(f*F/x.width)};b.getResolutionForScale=h;b.getResolutionInMetersForScale=function(F){return F/(96*l.inchesPerMeter)};b.getScale=function(F,f){f=f||F.extent;F=F.width;const x=l.getMetersPerUnitForSR(f?.spatialReference);return f&&F?f.width/F*x*l.inchesPerMeter*96:0};b.getScaleForResolution=
function(F,f){f=l.getMetersPerUnitForSR(f);return F*f*l.inchesPerMeter*96};b.isInScaleRange=function(F,f,x){if(f=0===f||d.floatEqualAbsolute(F,f)||F<f)f=0===x||d.floatEqualAbsolute(F,x)||F>x;return f};Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})})},"esri/widgets/Search/LayerSearchSource":function(){define("../../chunks/tslib.es6 ../../core/lang ../../core/accessorSupport/decorators/property ../../core/has ../../core/Logger ../../core/accessorSupport/decorators/subclass ./SearchSource ./support/layerSearchUtils".split(" "),
function(b,d,l,h,F,f,x,r){var A;h=A=class extends x{constructor(u){super(u);this.suggestionTemplate=this.searchTemplate=this.searchFields=this.orderByFields=this.exactMatch=this.displayField=null;this.getResults=(K,n)=>r.getResults({source:this,...K},n);this.getSuggestions=(K,n)=>r.getSuggestions({source:this,...K},n)}set layer(u){this._set("layer",u);u&&u.load().catch(()=>{})}get name(){return this._getLayerTitle()??""}set name(u){this._overrideIfSome("name",u)}clone(){return new A({autoNavigate:this.autoNavigate,
filter:this.filter,maxResults:this.maxResults,maxSuggestions:this.maxSuggestions,minSuggestCharacters:this.minSuggestCharacters,outFields:this.outFields?d.clone(this.outFields):null,placeholder:this.placeholder,popupEnabled:this.popupEnabled,prefix:this.prefix,resultGraphicEnabled:this.resultGraphicEnabled,resultSymbol:this.resultSymbol?this.resultSymbol.clone():null,suggestionsEnabled:this.suggestionsEnabled,suffix:this.suffix,withinViewEnabled:this.withinViewEnabled,displayField:this.displayField,
exactMatch:this.exactMatch,layer:this.layer,searchFields:this.searchFields?d.clone(this.searchFields):null,suggestionTemplate:this.suggestionTemplate,zoomScale:this.zoomScale})}_getFirstStringField(){return this.layer.fieldsIndex?.fields.find(u=>"string"===u.type)?.name??""}_getDisplayField(){return this.displayField||this.layer.displayField||this._getFirstStringField()}_getSearchFieldsString(){const {layer:u,searchFields:K}=this;return u.loaded?`: ${(K||[this._getDisplayField()]).map(n=>u.getField(n)?.alias||
n).join(", ")}`:""}_getLayerTitle(){var {layer:u}=this;if(u&&({title:u}=u,u))return`${u}${this._getSearchFieldsString()}`}};b.__decorate([l.property({json:{read:{source:"field.name"},write:{target:"field.name"}}})],h.prototype,"displayField",void 0);b.__decorate([l.property({json:{read:{source:"field.exactMatch"},write:{target:"field.exactMatch"}}})],h.prototype,"exactMatch",void 0);b.__decorate([l.property({value:null})],h.prototype,"layer",null);b.__decorate([l.property()],h.prototype,"name",null);
b.__decorate([l.property({type:[String],json:{write:!0}})],h.prototype,"orderByFields",void 0);b.__decorate([l.property()],h.prototype,"searchFields",void 0);b.__decorate([l.property()],h.prototype,"searchTemplate",void 0);b.__decorate([l.property()],h.prototype,"suggestionTemplate",void 0);return h=A=b.__decorate([f.subclass("esri.widgets.Search.LayerSearchSource")],h)})},"esri/widgets/Search/SearchSource":function(){define("../../chunks/tslib.es6 ../../core/Identifiable ../../core/JSONSupport ../../core/accessorSupport/decorators/property ../../core/has ../../core/Logger ../../core/RandomLCG ../../core/accessorSupport/decorators/subclass".split(" "),
function(b,d,l,h,F,f,x,r){d=class extends d.IdentifiableMixin(l.JSONSupport){constructor(A){super(A);this.outFields=this.minSuggestCharacters=this.maxSuggestions=this.maxResults=this.getSuggestions=this.getResults=this.filter=this.autoNavigate=null;this.placeholder="";this.popupTemplate=this.popupEnabled=null;this.prefix="";this.suggestionsEnabled=this.resultSymbol=this.resultGraphicEnabled=null;this.suffix="";this.withinViewEnabled=!1;this.zoomScale=null}};b.__decorate([h.property()],d.prototype,
"autoNavigate",void 0);b.__decorate([h.property()],d.prototype,"filter",void 0);b.__decorate([h.property()],d.prototype,"getResults",void 0);b.__decorate([h.property()],d.prototype,"getSuggestions",void 0);b.__decorate([h.property()],d.prototype,"maxResults",void 0);b.__decorate([h.property()],d.prototype,"maxSuggestions",void 0);b.__decorate([h.property()],d.prototype,"minSuggestCharacters",void 0);b.__decorate([h.property()],d.prototype,"outFields",void 0);b.__decorate([h.property()],d.prototype,
"placeholder",void 0);b.__decorate([h.property()],d.prototype,"popupEnabled",void 0);b.__decorate([h.property()],d.prototype,"popupTemplate",void 0);b.__decorate([h.property()],d.prototype,"prefix",void 0);b.__decorate([h.property()],d.prototype,"resultGraphicEnabled",void 0);b.__decorate([h.property()],d.prototype,"resultSymbol",void 0);b.__decorate([h.property()],d.prototype,"suggestionsEnabled",void 0);b.__decorate([h.property()],d.prototype,"suffix",void 0);b.__decorate([h.property()],d.prototype,
"withinViewEnabled",void 0);b.__decorate([h.property()],d.prototype,"zoomScale",void 0);return d=b.__decorate([r.subclass("esri.widgets.Search.SearchSource")],d)})},"esri/widgets/Search/support/layerSearchUtils":function(){define("exports ../../../intl ../../../core/Error ../../../core/lang ../../../core/Logger ../../../core/maybe ../../../core/unitUtils ../../../geometry/Polygon ../../../geometry/support/geometryUtils ../../../rest/support/FullTextSearch ../../../intl/substitute ../../../intl/date".split(" "),
function(b,d,l,h,F,f,x,r,A,u,K,n){function y(q,E){const {filter:B,withinViewEnabled:O}=q;q=E?.extent;return B?.geometry??(O&&q?q:void 0)}async function N(q){q&&await q.load()}function v(q,E){return(q=q?.indexes)&&E?.length?q.filter(B=>"FullText"===B.indexType).some(B=>{const O=B.fields?.split(",").map(P=>P.trim().toLowerCase())||[];return E.every(P=>O.includes(P.toLowerCase()))}):!1}function t({text:q,searchFields:E}){return q.trim().split(" ").filter(B=>!!B.trim()).map(B=>new u({onFields:E,searchTerm:B,
searchType:"prefix"}))}function m(q){return q?.fieldsIndex?.fields?.find(E=>"string"===E.type)?.name??""}function H(q,E){return q&&E?.length?E.every(B=>!!q.getField(B)):!1}function D({codedValues:q},E,B){return f.mappedFind(q??[],O=>{var P=O.name;P=B?P:P.toLowerCase();return(B?E:E.toLowerCase())===P?O.code.toString():null})??null}function z(q,E){return(E=E?.where)?`(${q}) AND (${E})`:q}function V({currentTerm:q,field:E,filter:B,exactMatch:O,url:P,type:M}){var J=E?.type;E=E?.name;if("string"===J||
"date"===J||"global-id"===J){if(J=P=R.test(P??""))a:{for(J=0;J<q.length;J++)if(255<q.charCodeAt(J)){J=!0;break a}J=!1}J=J?"N":"";if(O&&"search"===M)return z(`${E} = ${J}'${q}'`,B);if(P)return z(`${E} LIKE ${J}${`'${q}%'`}`,B);O=`LOWER(${E})`;q=q.toLowerCase();return z(`${O} LIKE ${J}${`'${q}%'`}`,B)}return"oid"===J||"small-integer"===J||"integer"===J||"single"===J||"double"===J?(q=Number(q),isNaN(q)?null:z(`${E} = ${q}`,B)):z(`${E} = ${q}`,B)}function X({searchTerm:q,layer:E,searchFields:B,filter:O,
exactMatch:P,query:M,type:J}){const {definitionExpression:Y,url:T}=E;let a="";!M.fullText&&q&&B&&B.forEach(e=>{var k=E.getField(e);e=((e="function"===typeof E.getFieldDomain&&E.getFieldDomain(e))&&"coded-value"===e.type?D(e,q,P):null)||q||null;null!==e&&(k=V({currentTerm:e,field:k,filter:O,exactMatch:P,url:T,type:J}))&&(a+=a?` OR (${k})`:`(${k})`)});return Y&&a?`(${Y}) AND (${a})`:Y||a}function ba(q,E){let B=null;({codedValues:q}=q);q&&q.length&&q.some(O=>O.code===E?(B=O.name,!0):!1);return B}function c(q,
E){return q[E]??q[Object.keys(q).find(B=>B.toLowerCase()===E.toLowerCase())]}function g(q,E,B){const O=q.sourceLayer,{attributes:P}=q;q="function"===typeof O.getFieldDomain&&O.getFieldDomain(B);return E?K.substitute(E,P):B&&P?(E=O.getField(B),B=c(P,B),null==B?"":q&&"coded-value"===q.type?ba(q,B)??"":"date"===E?.type?n.formatDate(new Date(B)):"number"===typeof B?B.toString():"string"!==typeof B?"":B.trim()):""}function w(q,E,B,O){return q.features.map(P=>{var M=P.sourceLayer,{attributes:J}=P;({objectIdField:M}=
M);J=M?J[M]:null;return{text:g(P,E.suggestionTemplate,O),key:J,sourceIndex:B}})}function G(q,E,B,O,P,M,J){return q.features.map(Y=>{var T=M;const a=Y.clone(),e=Y.sourceLayer;var k=e?.objectIdField;k=k?Y.attributes[k]:null;const p=g(Y,B.searchTemplate,P);null!=T&&null!=e&&null!=e.minScale&&null!=e.maxScale&&(e.minScale&&e.minScale<T?T=e.minScale:e.maxScale&&e.maxScale>T&&(T=e.maxScale));T=a.geometry?A.createExtentFromGeometry(a.geometry,E??void 0,T??void 0):void 0;T="number"===typeof J&&T?A.scaleExtent(h.clone(T),
E??void 0,J):T;Y=Y.clone();null!=T&&(Y.geometry=r.fromExtent(T));return{extent:T,target:Y,feature:a,key:k,name:p,sourceIndex:O}})}const R=/https?:\/\/services.*\.arcgis\.com/i,W=/(?:\{([^}]+)\})/g,Q=()=>F.getLogger("esri.widgets.Search.support.layerSearchUtils");b.createFullTextSearchInfos=t;b.getResults=function(q,E){const {exactMatch:B=!1,location:O,maxResults:P,spatialReference:M,source:J,sourceIndex:Y,suggestResult:T,view:a}=q,{layer:e,filter:k,zoomScale:p}=J,C=a?.scale,L=y(J,a),S=E?.signal;return N(e).then(()=>
{const I=e.popupTemplate;return I?I.getRequiredFields(e.fieldsIndex):null}).then(I=>{const {objectIdField:U,returnZ:fa}=e,ca=J.displayField||J.layer.displayField||m(J.layer);if(!e.getField(ca))throw Q().error("invalid-field: displayField is invalid."),new l("getResults():invalid-field","displayField is invalid.");I=I?.length?I:[ca];var Z=J.outFields||I;I=Z&&Z.includes("*");Z.includes(U)||I||Z.push(U);e.floorInfo?.floorField&&Z.push(e.floorInfo.floorField);if(!I&&!H(e,Z))throw Q().error("invalid-field: outField is invalid."),
new l("getResults():invalid-field","outField is invalid.");I=e.createQuery();var {orderByFields:aa}=J;aa&&(I.orderByFields=aa);M&&(I.outSpatialReference=M,aa=1/x.getMetersPerUnitForSR(M))&&(I.maxAllowableOffset=aa);aa="mesh"===e.geometryType||"multipatch"===e.geometryType;I.returnZ=e.capabilities?.data?.supportsZ&&!aa&&!1!==fa;I.returnGeometry=!0;I.multipatchOption=aa?"xyFootprint":null;Z&&(I.outFields=Z);if(O)I.geometry=O;else if(T.key)I.objectIds=[T.key];else{Z=J.searchFields||[ca];if(!H(e,Z))throw Q().error("invalid-field: search field is invalid."),
new l("getResults():invalid-field","search field is invalid.");(e?.capabilities?.query?.supportsPagination??!1)&&(I.num=P);L&&(I.geometry=L);if(!T.text?.trim())return[];aa=T.text;const {prefix:da="",suffix:ha=""}=J,ea=`${da}${aa}${ha}`.replaceAll("'","''");(e?.capabilities?.query?.supportsFullTextSearch??!1)&&v(e,Z)&&!B&&aa&&(I.fullText=t({text:aa,searchFields:Z}));Z=X({searchTerm:ea,layer:e,searchFields:Z,filter:k,exactMatch:B,query:I,type:"search"});I.where=Z;if(!I.fullText&&!I.where)return[]}return e.queryFeatures(I,
{signal:S}).then(da=>G(da,a,J,Y,ca,C,p))})};b.getSuggestions=function(q,E){const {source:B,spatialReference:O,view:P,suggestTerm:M,maxSuggestions:J,sourceIndex:Y,exactMatch:T}=q,{layer:a,filter:e}=B,k=E?.signal,p=y(B,P);return N(a).then(()=>{if(!(a?.capabilities?.query?.supportsPagination??!1))return[];const C=B.displayField||B.layer.displayField||m(B.layer);var L=B.searchFields||[C];const S=[];B.suggestionTemplate?B.suggestionTemplate.replaceAll(W,(aa,da)=>{S.push(da);return aa}):S.push(C);var I=
S&&S.includes("*");S.includes(a.objectIdField)||I||S.push(a.objectIdField);var U=!!a.getField(C);I=I||H(a,S);const fa=H(a,L);if(!U)throw Q().error("invalid-field: displayField is invalid."),new l("getSuggestions():invalid-field","displayField is invalid.");if(!I)throw Q().error("invalid-field: outField is invalid."),new l("getSuggestions():invalid-field","outField is invalid.");if(!fa)throw Q().error("invalid-field: search field is invalid."),new l("getSuggestions():invalid-field","search field is invalid.");
U=a.createQuery();({orderByFields:I}=B);I&&(U.orderByFields=I);U.outSpatialReference=O;U.returnGeometry=!1;U.num=J;U.outFields=S;p&&(U.geometry=p);if(!M.trim())return[];const {prefix:ca="",suffix:Z=""}=B;I=`${ca}${M}${Z}`.replaceAll("'","''");(a?.capabilities?.query?.supportsFullTextSearch??!1)&&v(a,L)&&!T&&M&&(U.fullText=t({text:M,searchFields:L}));L=X({searchTerm:I,layer:a,searchFields:L,filter:e,exactMatch:T,query:U,type:"suggest"});U.where=L;return U.fullText||U.where?a.queryFeatures(U,{signal:k}).then(aa=>
w(aa,B,Y,C)):[]})};Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})})},"esri/widgets/Search/LocatorSearchSource":function(){define("../../chunks/tslib.es6 ../../core/lang ../../core/accessorSupport/decorators/property ../../core/has ../../core/Logger ../../core/accessorSupport/decorators/subclass ./SearchSource ./support/locatorUtils".split(" "),function(b,d,l,h,F,f,x,r){var A;h=A=class extends x{constructor(u){super(u);this.defaultZoomScale=this.countryCode=this.categories=this.apiKey=
null;this.localSearchDisabled=!1;this.locationType=null;this.searchTemplate=this.placeholder=this.name="";this.zoomScale=this.url=this.suggestionsEnabled=this.singleLineFieldName=null;this.getResults=(K,n)=>r.getResults({source:this,...K},n);this.getSuggestions=(K,n)=>r.getSuggestions({source:this,...K},n)}clone(){return new A({apiKey:this.apiKey,autoNavigate:this.autoNavigate,filter:this.filter,maxResults:this.maxResults,maxSuggestions:this.maxSuggestions,minSuggestCharacters:this.minSuggestCharacters,
outFields:this.outFields?d.clone(this.outFields):null,placeholder:this.placeholder,popupEnabled:this.popupEnabled,prefix:this.prefix,resultGraphicEnabled:this.resultGraphicEnabled,resultSymbol:this.resultSymbol?this.resultSymbol.clone():null,suggestionsEnabled:this.suggestionsEnabled,suffix:this.suffix,withinViewEnabled:this.withinViewEnabled,categories:this.categories?d.clone(this.categories):null,countryCode:this.countryCode,locationType:this.locationType,searchTemplate:this.searchTemplate,singleLineFieldName:this.singleLineFieldName,
zoomScale:this.zoomScale})}};b.__decorate([l.property()],h.prototype,"apiKey",void 0);b.__decorate([l.property()],h.prototype,"categories",void 0);b.__decorate([l.property()],h.prototype,"countryCode",void 0);b.__decorate([l.property({json:{write:!0}})],h.prototype,"defaultZoomScale",void 0);b.__decorate([l.property()],h.prototype,"localSearchDisabled",void 0);b.__decorate([l.property()],h.prototype,"locationType",void 0);b.__decorate([l.property({json:{write:!0}})],h.prototype,"name",void 0);b.__decorate([l.property({json:{write:!0}})],
h.prototype,"placeholder",void 0);b.__decorate([l.property()],h.prototype,"searchTemplate",void 0);b.__decorate([l.property({json:{write:!0}})],h.prototype,"singleLineFieldName",void 0);b.__decorate([l.property({json:{read:{source:"suggest"},write:{target:"suggest"}}})],h.prototype,"suggestionsEnabled",void 0);b.__decorate([l.property({json:{write:!0}})],h.prototype,"url",void 0);b.__decorate([l.property({json:{write:!0}})],h.prototype,"zoomScale",void 0);return h=A=b.__decorate([f.subclass("esri.widgets.Search.LocatorSearchSource")],
h)})},"esri/widgets/Search/support/locatorUtils":function(){define("exports ../../../Graphic ../../../geometry/Polygon ../../../geometry/support/geometryUtils ../../../rest/locator/addressToLocations ../../../rest/locator/locationToAddress ../../../rest/locator/suggestLocations ../../../rest/support/AddressToLocationsParameters ../../../rest/support/LocationToAddressParameters ../../../rest/support/SuggestLocationsParameters".split(" "),function(b,d,l,h,F,f,x,r,A,u){function K(m,H){if(H.localSearchDisabled)return null;
H=m?.scale;return"number"===typeof H&&3E5>=H?m?.extent?.center:null}async function n(m,H){const {source:D,spatialReference:z,location:V,sourceIndex:X,view:ba}=m,{apiKey:c,url:g,zoomScale:w,defaultZoomScale:G}=D;if(null==g)return[];m=ba?.scale;H=H?.signal;const R=new A({location:V});c&&(R.apiKey=c);z&&(R.outSpatialReference=z);try{const W=await f.locationToAddress(g,R,{signal:H});return t([W],{sourceIndex:X,scale:m,view:ba,zoomScale:w,defaultZoomScale:G})}catch(W){return[]}}function y(m,H){const {filter:D,
withinViewEnabled:z}=m;m=H?.extent;const V=D?.geometry;return(H=V?h.createExtentFromGeometry(V,H??void 0,H?.scale):void 0)||(z&&m?m:void 0)}async function N(m,H){const {source:D,suggestResult:z,spatialReference:V,view:X,maxResults:ba,sourceIndex:c}=m,g=D?.zoomScale,w=D?.defaultZoomScale;if(!z.text?.trim())return null;m=`${!z.key&&D.prefix?D.prefix:""}${z.text}${!z.key&&D.suffix?D.suffix:""}`;const G=new r,{apiKey:R,url:W}=D,Q=X?.scale;var q=y(D,X);H=H?.signal;R&&(G.apiKey=R);if(!W)return null;D.categories&&
(G.categories=D.categories);D.locationType&&(G.locationType=D.locationType);V&&(G.outSpatialReference=V);const E=K(X,D);E&&(G.location=E);G.maxLocations=ba;q&&(G.searchExtent=q);D.countryCode&&(G.countryCode=D.countryCode);({key:q}=z);const B=`${q}`;q&&(G.magicKey=B);G.address={};G.address[D.singleLineFieldName||"Single Line Input"]=m;D.outFields&&(G.outFields=D.outFields);return F.addressToLocations(W,G,{signal:H}).then(O=>t(O,{key:B,scale:Q,sourceIndex:c,view:X,zoomScale:g,defaultZoomScale:w}))}
function v(m,H){return m.map(D=>({text:D.text,key:D.magicKey,sourceIndex:H}))}function t(m,H){return m.filter(Boolean).map(D=>{const {key:z,scale:V,sourceIndex:X,view:ba,zoomScale:c,defaultZoomScale:g}=H,{attributes:w,extent:G,location:R,address:W}=D;D=new d({geometry:R,attributes:w});var Q=G||R,q=Q?h.createExtentFromGeometry(Q,ba??void 0,V??void 0):void 0;Q=q?"number"===typeof c?h.scaleExtent(q,ba??void 0,c):"number"===typeof g&&"point"===Q?.type?h.scaleExtent(q,ba??void 0,g):q:null;q=R?`${R.x},${R.y}`:
"";q=W||q;const E=D.clone();null!=Q&&(E.geometry=l.fromExtent(Q));return{extent:Q,feature:D,target:E,key:z,name:q,sourceIndex:X}})}b.getLocation=K;b.getResults=function(m,H){return m.location?n(m,H):N(m,H)};b.getSuggestions=async function(m,H){const {source:D,spatialReference:z,view:V,suggestTerm:X,maxSuggestions:ba,sourceIndex:c}=m;m=new u;const {apiKey:g,url:w}=D,G=y(D,V);H=H?.signal;if(!w)return null;g&&(m.apiKey=g);D.categories&&(m.categories=D.categories);z&&(m.outSpatialReference=z);const R=
K(V,D);R&&(m.location=R);if(!X.trim())return null;const {prefix:W="",suffix:Q=""}=D;m.text=`${W}${X}${Q}`;G&&(m.searchExtent=G);m.maxSuggestions=ba;D.countryCode&&(m.countryCode=D.countryCode);return x.suggestLocations(w,m,{signal:H}).then(q=>v(q,c))};b.isArcGISWorldGeocoder=function(m){return m?/(?:arcgis\.com\/arcgis\/rest\/services\/world\/geocodeserver).*/i.test(m):!1};b.isMeteredArcGISWorldGeocoder=function(m){return m?/(?:geocode-api\.arcgis\.com\/arcgis\/rest\/services\/world\/geocodeserver).*/i.test(m):
!1};b.isProxiedArcGISWorldGeocoder=function(m){return m?/(?:\/servers\/[\da-z.-]+\/rest\/services\/world\/geocodeserver).*/i.test(m):!1};b.meteredArcGISLocatorUrl="https://geocode-api.arcgis.com/arcgis/rest/services/World/GeocodeServer";Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})})},"esri/rest/locator/addressToLocations":function(){define("exports ../../request ../utils ./utils ../support/AddressCandidate ../support/AddressToLocationsParameters".split(" "),function(b,d,l,h,F,f){function x({data:r}){if(!r)return[];
const {candidates:A,spatialReference:u}=r;return A?A.map(K=>{if(K){var {extent:n,location:y}=K,N=n?h.isValidExtent(n):!0;if(h.isValidLocation(y)&&N)return n&&(n.spatialReference=u),y&&(y.spatialReference=u),F.fromJSON(K)}}):[]}b.addressToLocations=async function(r,A,u){A=f.from(A);r=l.parseUrl(r);const {address:K,...n}=A.toJSON();A=l.encode({...r.query,...K,...n,f:"json"});u=l.asValidOptions(A,u);return d(`${r.path}/findAddressCandidates`,u).then(x)};Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})})},
"esri/rest/locator/utils":function(){define(["exports"],function(b){b.isValidExtent=function(d){return d&&"number"===typeof d.xmin&&"number"===typeof d.ymin&&"number"===typeof d.xmax&&"number"===typeof d.ymax};b.isValidLocation=function(d){return!!d&&"number"===typeof d.x&&"number"===typeof d.y};Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})})},"esri/rest/support/AddressCandidate":function(){define("../../chunks/tslib.es6 ../../core/JSONSupport ../../core/accessorSupport/decorators/property ../../core/has ../../core/Logger ../../core/RandomLCG ../../core/accessorSupport/decorators/subclass ../../geometry/Extent ../../geometry/Point".split(" "),
function(b,d,l,h,F,f,x,r,A){d=class extends d.JSONSupport{constructor(u){super(u);this.score=this.location=this.extent=this.attributes=this.address=null}};b.__decorate([l.property({type:String,json:{write:!0}})],d.prototype,"address",void 0);b.__decorate([l.property({type:Object,json:{write:!0}})],d.prototype,"attributes",void 0);b.__decorate([l.property({type:r,json:{write:!0}})],d.prototype,"extent",void 0);b.__decorate([l.property({type:A,json:{write:!0}})],d.prototype,"location",void 0);b.__decorate([l.property({type:Number,
json:{write:!0}})],d.prototype,"score",void 0);return d=b.__decorate([x.subclass("esri.rest.support.AddressCandidate")],d)})},"esri/rest/support/AddressToLocationsParameters":function(){define("../../chunks/tslib.es6 ../../geometry ../../core/JSONSupport ../../core/accessorSupport/decorators/property ../../core/accessorSupport/ensureType ../../core/RandomLCG ../../core/has ../../core/accessorSupport/decorators/subclass ./commonProperties ../../geometry/Point ../../geometry/SpatialReference ../../geometry/Extent".split(" "),
function(b,d,l,h,F,f,x,r,A,u,K,n){d=class extends l.JSONSupport{constructor(y){super(y);this.searchExtent=this.outSpatialReference=this.outFields=this.maxLocations=this.magicKey=this.locationType=this.location=this.forStorage=this.countryCode=this.categories=this.apiKey=this.address=null}};b.__decorate([h.property({type:Object,json:{write:!0}})],d.prototype,"address",void 0);b.__decorate([h.property(A.apiKey)],d.prototype,"apiKey",void 0);b.__decorate([h.property({type:[String],json:{read:{source:"category",
reader:y=>y?y.split(","):null},write:{target:"category",writer:(y,N)=>{N.category=y?y.join(","):null}}}})],d.prototype,"categories",void 0);b.__decorate([h.property({type:String,json:{write:!0}})],d.prototype,"countryCode",void 0);b.__decorate([h.property({type:Boolean,json:{write:!0}})],d.prototype,"forStorage",void 0);b.__decorate([h.property({type:u,json:{write:{writer:(y,N)=>{N.location=y?y.clone().normalize():null}}}})],d.prototype,"location",void 0);b.__decorate([h.property({type:String,json:{write:!0}})],
d.prototype,"locationType",void 0);b.__decorate([h.property({type:String,json:{write:!0}})],d.prototype,"magicKey",void 0);b.__decorate([h.property({type:Number,json:{write:!0}})],d.prototype,"maxLocations",void 0);b.__decorate([h.property({type:[String],json:{write:{writer:(y,N)=>{N.outFields=y?y.join(","):null}}}})],d.prototype,"outFields",void 0);b.__decorate([h.property({type:K,json:{read:{source:"outSR"},write:{target:"outSR"}}})],d.prototype,"outSpatialReference",void 0);b.__decorate([h.property({type:n,
json:{write:{writer:(y,N)=>{y=y?y.shiftCentralMeridian():null;N.searchExtent=y}}}})],d.prototype,"searchExtent",void 0);d=b.__decorate([r.subclass("esri.rest.support.AddressToLocationsParameters")],d);d.from=F.ensureType(d);return d})},"esri/rest/support/commonProperties":function(){define(["exports"],function(b){b.apiKey={type:String,json:{read:{source:"token"},write:{target:"token"}}};Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})})},"esri/rest/locator/locationToAddress":function(){define(["exports",
"../../request","../utils","../support/AddressCandidate","../support/LocationToAddressParameters"],function(b,d,l,h,F){function f({data:x}){if(x){var {address:r,location:A}=x;return h.fromJSON({address:r?.Match_addr||"",attributes:r||{},location:A,score:100})}}b.locationToAddress=async function(x,r,A){r=F.from(r);x=l.parseUrl(x);r={...r.toJSON(),f:"json"};r=l.encode({...x.query,...r});A=l.asValidOptions(r,A);return d(`${x.path}/reverseGeocode`,A).then(f)};Object.defineProperty(b,Symbol.toStringTag,
{value:"Module"})})},"esri/rest/support/LocationToAddressParameters":function(){define("../../chunks/tslib.es6 ../../geometry ../../core/JSONSupport ../../core/accessorSupport/decorators/property ../../core/accessorSupport/ensureType ../../core/RandomLCG ../../core/has ../../core/accessorSupport/decorators/subclass ./commonProperties ../../geometry/Point ../../geometry/SpatialReference".split(" "),function(b,d,l,h,F,f,x,r,A,u,K){d=class extends l.JSONSupport{constructor(n){super(n);this.outSpatialReference=
this.locationType=this.location=this.apiKey=null}};b.__decorate([h.property(A.apiKey)],d.prototype,"apiKey",void 0);b.__decorate([h.property({type:u,json:{write:{writer:(n,y)=>{n=n?n.clone().normalize():null;y.location=void 0!==n?n:null}}}})],d.prototype,"location",void 0);b.__decorate([h.property({type:String,json:{write:!0}})],d.prototype,"locationType",void 0);b.__decorate([h.property({type:K,json:{read:{source:"outSR"},write:{target:"outSR"}}})],d.prototype,"outSpatialReference",void 0);d=b.__decorate([r.subclass("esri.rest.support.LocationToAddressParameters")],
d);d.from=F.ensureType(d);return d})},"esri/rest/locator/suggestLocations":function(){define(["exports","../../request","../utils","../support/SuggestionCandidate","../support/SuggestLocationsParameters"],function(b,d,l,h,F){function f(x){({data:x}=x);if(!x)return[];({suggestions:x}=x);return x?x.map(r=>new h(r)):[]}b.suggestLocations=async function(x,r,A){x=l.parseUrl(x);r=F.from(r);r={...r.toJSON(),f:"json"};r=l.encode({...x.query,...r});A=l.asValidOptions(r,A);return d(`${x.path}/suggest`,A).then(f)};
Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})})},"esri/rest/support/SuggestionCandidate":function(){define("../../chunks/tslib.es6 ../../core/JSONSupport ../../core/accessorSupport/decorators/property ../../core/has ../../core/Logger ../../core/RandomLCG ../../core/accessorSupport/decorators/subclass".split(" "),function(b,d,l,h,F,f,x){d=class extends d.JSONSupport{constructor(r){super(r);this.text=this.magicKey=this.isCollection=null}};b.__decorate([l.property({type:Boolean,json:{write:!0}})],
d.prototype,"isCollection",void 0);b.__decorate([l.property({type:String,json:{write:!0}})],d.prototype,"magicKey",void 0);b.__decorate([l.property({type:String,json:{write:!0}})],d.prototype,"text",void 0);return d=b.__decorate([x.subclass("esri.rest.support.SuggestionCandidate")],d)})},"esri/rest/support/SuggestLocationsParameters":function(){define("../../chunks/tslib.es6 ../../geometry ../../core/JSONSupport ../../core/accessorSupport/decorators/property ../../core/accessorSupport/ensureType ../../core/RandomLCG ../../core/has ../../core/accessorSupport/decorators/subclass ./commonProperties ../../geometry/Point ../../geometry/SpatialReference ../../geometry/Extent".split(" "),
function(b,d,l,h,F,f,x,r,A,u,K,n){d=class extends l.JSONSupport{constructor(y){super(y);this.text=this.searchExtent=this.outSpatialReference=this.maxSuggestions=this.location=this.countryCode=this.categories=this.apiKey=null}};b.__decorate([h.property(A.apiKey)],d.prototype,"apiKey",void 0);b.__decorate([h.property({type:[String],json:{read:{source:"category",reader:y=>y?y.split(","):null},write:{target:"category",writer:(y,N)=>{N.category=y?y.join(","):null}}}})],d.prototype,"categories",void 0);
b.__decorate([h.property({type:String,json:{write:!0}})],d.prototype,"countryCode",void 0);b.__decorate([h.property({type:u,json:{write:{writer:(y,N)=>{N.location=y?y.clone().normalize():null}}}})],d.prototype,"location",void 0);b.__decorate([h.property({type:Number,json:{write:!0}})],d.prototype,"maxSuggestions",void 0);b.__decorate([h.property({type:K,json:{read:{source:"outSR"},write:{target:"outSR"}}})],d.prototype,"outSpatialReference",void 0);b.__decorate([h.property({type:n,json:{write:{writer:(y,
N)=>{y=y?y.shiftCentralMeridian():null;N.searchExtent=JSON.stringify(y)}}}})],d.prototype,"searchExtent",void 0);b.__decorate([h.property({type:String,json:{write:!0}})],d.prototype,"text",void 0);d=b.__decorate([r.subclass("esri.rest.support.SuggestLocationsParameters")],d);d.from=F.ensureType(d);return d})},"esri/widgets/support/geolocationUtils":function(){define("exports ../../config ../../core/Error ../../core/has ../../core/Logger ../../geometry/Point ../../geometry/support/webMercatorUtils ../../portal/Portal ../../rest/geometryService/project ../../rest/support/ProjectParameters".split(" "),
function(b,d,l,h,F,f,x,r,A,u){function K({longitude:m,latitude:H,altitude:D}){return new f({longitude:m,latitude:H,z:D||void 0,spatialReference:{wkid:4326}})}function n(m,H,D){if(!H)return Promise.resolve(m);const z=H.spatialReference;return z.isWGS84?Promise.resolve(m):z.isWebMercator?Promise.resolve(x.geographicToWebMercator(m)):y(D).then(V=>{if(!V)throw new l("geometry-service:missing-url","Geometry service URL is missing");const X=new u({geometries:[m],outSpatialReference:z});return A.project(V,
X,D).then(ba=>ba[0])})}function y(m){if(d.geometryServiceUrl)return Promise.resolve(d.geometryServiceUrl);const H=r.getDefault();return H.load(m).catch(()=>{}).then(()=>H.helperServices?.geometry?.url)}const N=()=>F.getLogger("esri.widgets.support.geolocationUtils"),v={maximumAge:0,timeout:15E3,enableHighAccuracy:!0};let t;b.getCurrentPosition=function(m){m||=v;return new Promise((H,D)=>{setTimeout(()=>D(new l("geolocation:timeout","getting the current geolocation position timed out")),15E3);navigator.geolocation.getCurrentPosition(H,
D,m??void 0)})};b.overridePositionToPoint=function(m){t=m};b.positionToPoint=function(m,H){if(t)return t(m,H);const {position:D,view:z}=m;m=D&&D.coords||{};m={accuracy:m.accuracy,altitude:m.altitude,altitudeAccuracy:m.altitudeAccuracy,heading:m.heading,latitude:m.latitude,longitude:m.longitude,speed:m.speed};m=(D?{coords:m,timestamp:D.timestamp}:D)?.coords;if(!m)throw new l("geometry-service:no-coords","Geolocation has no coordinates");m=K(m);return n(m,z,H)};b.supported=function(){var m=h("esri-geolocation");
m||N().warn("geolocation-unsupported","Geolocation unsupported.");m&&((m=window.isSecureContext)||N().warn("insecure-context","Geolocation requires a secure origin."));return m};Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})})},"esri/rest/geometryService/project":function(){define("exports ../../request ../../core/accessorSupport/ensureType ../../geometry/support/jsonUtils ../utils ./utils ../support/ProjectParameters".split(" "),function(b,d,l,h,F,f,x){const r=l.ensureType(x);b.project=
async function(A,u,K){u=r(u);A=F.parseUrl(A);const n={...A.query,f:"json",...u.toJSON()},y=u.outSpatialReference,N=h.getJsonType(u.geometries[0]);u=F.asValidOptions(n,K);return d(A.path+"/project",u).then(({data:{geometries:v}})=>f.decodeGeometries(v,N,y))};Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})})},"esri/rest/support/ProjectParameters":function(){define("../../chunks/tslib.es6 ../../core/JSONSupport ../../core/accessorSupport/decorators/property ../../core/has ../../core/Logger ../../core/RandomLCG ../../core/accessorSupport/decorators/subclass ../../geometry/support/jsonUtils ../../geometry/support/spatialReferenceUtils".split(" "),
function(b,d,l,h,F,f,x,r,A){d=class extends d.JSONSupport{constructor(u){super(u);this.geometries=[];this.transformForward=this.transformation=this.outSpatialReference=null}toJSON(){const u=this.geometries.map(y=>y.toJSON()),K=this.geometries[0],n={};n.outSR=A.srToRESTValue(this.outSpatialReference);n.inSR=A.srToRESTValue(K.spatialReference);n.geometries=JSON.stringify({geometryType:r.getJsonType(K),geometries:u});this.transformation&&(n.transformation=this.transformation.wkid||JSON.stringify(this.transformation));
null!=this.transformForward&&(n.transformForward=this.transformForward);return n}};b.__decorate([l.property()],d.prototype,"geometries",void 0);b.__decorate([l.property({json:{read:{source:"outSR"}}})],d.prototype,"outSpatialReference",void 0);b.__decorate([l.property()],d.prototype,"transformation",void 0);b.__decorate([l.property()],d.prototype,"transformForward",void 0);return d=b.__decorate([x.subclass("esri.rest.support.ProjectParameters")],d)})},"esri/widgets/support/GoTo":function(){define("exports ../../chunks/tslib.es6 ../../core/maybe ../../core/accessorSupport/decorators/property ../../core/has ../../core/Logger ../../core/RandomLCG ../../core/accessorSupport/decorators/subclass".split(" "),
function(b,d,l,h,F,f,x,r){b.GoToMixin=A=>{A=class extends A{constructor(...u){super(...u);this.view=this.goToOverride=null}callGoTo(u){const {view:K}=this;l.assertIsSome(K);return this.goToOverride?this.goToOverride(K,u):K.goTo(u.target,u.options)}};d.__decorate([h.property()],A.prototype,"goToOverride",void 0);d.__decorate([h.property()],A.prototype,"view",void 0);return A=d.__decorate([r.subclass("esri.widgets.support.GoTo")],A)};Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})})},"esri/widgets/support/globalCss":function(){define(["exports"],
function(b){b.globalCss={anchor:"esri-widget__anchor",anchorDisabled:"esri-widget__anchor--disabled",button:"esri-button",buttonDisabled:"esri-button--disabled",buttonHalf:"esri-button--half",buttonSecondary:"esri-button--secondary",buttonSmall:"esri-button--small",buttonTertiary:"esri-button--tertiary",buttonThird:"esri-button--third",disabled:"esri-disabled",empty:"esri-widget__content--empty",emptyIllustration:"esri-widget__content-illustration--empty",heading:"esri-widget__heading",hidden:"esri-hidden",
input:"esri-input",interactive:"esri-interactive",loader:"esri-widget__loader",loaderAnimation:"esri-widget__loader-animation",loaderText:"esri-widget__loader-text",menu:"esri-menu",menuHeader:"esri-menu__header",menuItem:"esri-menu__list-item",menuItemActive:"esri-menu__list-item--active",menuItemFocus:"esri-menu__list-item--focus",menuList:"esri-menu__list",panel:"esri-widget--panel",panelHeightOnly:"esri-widget--panel-height-only",primaryTick:"primary-tick",primaryTickAmPm:"primary-tick__ampm",
primaryTickLabel:"primary-tick__label",rotating:"esri-rotating",secondaryTick:"secondary-tick",select:"esri-select",table:"esri-widget__table",widget:"esri-widget",widgetButton:"esri-widget--button",widgetButtonActive:"esri-widget--button-active",widgetDisabled:"esri-widget--disabled"};Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})})},"esri/widgets/support/legacyIcon":function(){define(["exports"],function(b){b.legacyIcon={checkMark:"esri-icon-check-mark",close:"esri-icon-close",collapse:"esri-icon-collapse",
down:"esri-icon-down",downArrow:"esri-icon-down-arrow",dragHorizontal:"esri-icon-drag-horizontal",dragVertical:"esri-icon-drag-vertical",duplicate:"esri-icon-duplicate",expand:"esri-icon-expand",fontFallbackText:"esri-icon-font-fallback-text",forward:"esri-icon-forward",handleVertical:"esri-icon-handle-vertical",icon:"esri-icon",left:"esri-icon-left",loadingIndicator:"esri-icon-loading-indicator",locateCircled:"esri-icon-locate-circled",minus:"esri-icon-minus",noticeTriangle:"esri-icon-notice-triangle",
pause:"esri-icon-pause",play:"esri-icon-play",plus:"esri-icon-plus",radioChecked:"esri-icon-radio-checked",radioUnchecked:"esri-icon-radio-unchecked",refresh:"esri-icon-refresh",reverse:"esri-icon-reverse",right:"esri-icon-right",search:"esri-icon-search",swap:"esri-icon-swap",table:"esri-icon-table",trash:"esri-icon-trash",up:"esri-icon-up",upArrow:"esri-icon-up-arrow",upDownArrows:"esri-icon-up-down-arrows",urbanModel:"esri-icon-urban-model",zoomInMagnifyingGlass:"esri-icon-zoom-in-magnifying-glass",
zoomToObject:"esri-icon-zoom-to-object"};Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})})},"*noref":1}});
define("../chunks/tslib.es6 ../intl ../core/maybe ../core/reactiveUtils ../core/string ../core/accessorSupport/decorators/property ../core/has ../core/Logger ../core/RandomLCG ../core/accessorSupport/decorators/subclass ./Widget ./Search/css ./Search/SearchResultRenderer ./Search/SearchViewModel ./support/globalCss ./support/legacyIcon ./support/widgetUtils ./support/decorators/messageBundle ./support/decorators/vmEvent ./support/jsxFactory ../intl/substitute".split(" "),function(b,d,l,h,F,f,x,r,
A,u,K,n,y,N,v,t,m,H,D,z,V){const X=/<[a-z/][\s\S]*>/i,ba=(c,g)=>{g=F.escapeRegExpString(g).split(/\s/);g=new RegExp(`(${g.join("|")})`,"gi");return c.replace(g,w=>`<strong>${w}</strong>`)};d=class extends K{constructor(c,g){super(c,g);this._activeMenuItemIndex=-1;this._inputNode=null;this._menuItemCount=0;this._suggestionListNode=this._sourceListNode=this._sourceMenuButtonNode=null;this._searchResultRenderer=new y;this._searchController=this._suggestController=null;this._locateFailed=!1;this._container=
null;this.activeMenu="none";this.disabled=!1;this.messagesCommon=this.messages=null;this.viewModel=new N;this._clearActiveMenu=()=>{this.activeMenu="none"};this._removeActiveMenu=w=>{(w=w.relatedTarget)&&this._container?.contains(w)||this._clearActiveMenu()};this.addHandles([h.watch(()=>this.searchTerm,w=>{(w&&"warning"===this.activeMenu||!w&&!this.viewModel?.selectedSuggestion?.location)&&this._clearActiveMenu()}),h.on(()=>this.viewModel?.allSources,"change",()=>this._watchSourceChanges()),h.watch(()=>
this.activeMenu,()=>this._resetActiveMenuItemIndex(),h.initial),h.watch(()=>this.viewModel?.defaultPopupTemplate,w=>{w&&(w.content=this._renderSearchResultsContent.bind(this))},h.initial)])}destroy(){this._cancelSuggest();this._cancelSearch();this._searchResultRenderer=l.destroyMaybe(this._searchResultRenderer)}get displayedSearchTerm(){return`${this.viewModel.searchTerm}`.trim()}get inputId(){return this._buildId("input")}get suggestionsMenuId(){return this._buildId("suggest-menu")}get sourceMenuId(){return this._buildId("source-menu")}get sourceMenuButtonId(){return this._buildId("source-menu-button")}get activeSource(){return this.viewModel?.activeSource}get activeSourceIndex(){return this.viewModel.activeSourceIndex}set activeSourceIndex(c){this.viewModel.activeSourceIndex=
c}get allPlaceholder(){return this.viewModel.allPlaceholder}set allPlaceholder(c){this.viewModel.allPlaceholder=c}get allSources(){return this.viewModel.allSources}get autoNavigate(){return this.viewModel.autoNavigate}set autoNavigate(c){this.viewModel.autoNavigate=c}get autoSelect(){return this.viewModel.autoSelect}set autoSelect(c){this.viewModel.autoSelect=c}get defaultSources(){return this.viewModel.defaultSources}get goToOverride(){return this.viewModel.goToOverride}set goToOverride(c){this.viewModel.goToOverride=
c}get icon(){return"search"}set icon(c){this._overrideIfSome("icon",c)}get includeDefaultSources(){return this.viewModel.includeDefaultSources}set includeDefaultSources(c){this.viewModel.includeDefaultSources=c}get label(){return this.messages?.widgetLabel??""}set label(c){this._overrideIfSome("label",c)}get locationEnabled(){return this.viewModel.locationEnabled}set locationEnabled(c){this.viewModel.locationEnabled=c}get maxResults(){return this.viewModel.maxResults}set maxResults(c){this.viewModel.maxResults=
c}get maxSuggestions(){return this.viewModel.maxSuggestions}set maxSuggestions(c){this.viewModel.maxSuggestions=c}get minSuggestCharacters(){return this.viewModel.minSuggestCharacters}set minSuggestCharacters(c){this.viewModel.minSuggestCharacters=c}get popupEnabled(){return this.viewModel.popupEnabled}set popupEnabled(c){this.viewModel.popupEnabled=c}get popupTemplate(){return this.viewModel.popupTemplate}set popupTemplate(c){this.viewModel.popupTemplate=c}get portal(){return this.viewModel?.portal}set portal(c){this.viewModel&&
(this.viewModel.portal=c)}get resultGraphic(){return this.viewModel.resultGraphic}set resultGraphic(c){this.viewModel.resultGraphic=c}get resultGraphicEnabled(){return this.viewModel.resultGraphicEnabled}set resultGraphicEnabled(c){this.viewModel.resultGraphicEnabled=c}get results(){return this.viewModel.results}get searchAllEnabled(){return this.viewModel.searchAllEnabled}set searchAllEnabled(c){this.viewModel.searchAllEnabled=c}get searchTerm(){return this.viewModel.searchTerm}set searchTerm(c){this.viewModel.searchTerm=
c}get selectedResult(){return this.viewModel.selectedResult}get sources(){return this.viewModel.sources}set sources(c){this.viewModel.sources=c}get suggestions(){return this.viewModel.suggestions}get suggestionsEnabled(){return this.viewModel.suggestionsEnabled}set suggestionsEnabled(c){this.viewModel.suggestionsEnabled=c}get view(){return this.viewModel.view}set view(c){this.viewModel.view=c}clear(){this.viewModel.clear()}focus(){this._inputNode?.focus();this.emit("search-focus")}blur(){this._inputNode?.blur();
this.emit("search-blur")}async search(c){this._clearActiveMenu();this._cancelSuggest();this._cancelSearch();const g=new AbortController,{signal:w}=g;this._searchController=g;try{const G=await this.viewModel.search(c,{signal:w});if(this._searchController===g)return this.activeMenu=G?.numResults?"none":"warning",this._searchController=null,G}catch(G){this._searchController===g&&(this._clearActiveMenu(),this._searchController=null)}}async suggest(c){this._cancelSuggest();const g=new AbortController,
{signal:w}=g;this._suggestController=g;try{const G=await this.viewModel.suggest(c,null,{signal:w});if(this._suggestController===g)return this._suggestController=null,G?.numResults&&this._openSuggestionMenu(),this._scrollToTopSuggestion(),G}catch(G){return this._suggestController!==g?null:this._suggestController=null}}render(){const {state:c}=this.viewModel;return z.tsx("div",{class:this.classes(n.css.base,v.globalCss.widget,{[v.globalCss.disabled]:"disabled"===c,[v.globalCss.widgetDisabled]:this.disabled})},
"loading"===c?this._renderLoader():this._renderContainer())}_renderSubmitButton(){const {messages:c,disabled:g}=this;return z.tsx("button",{"aria-label":c.searchButtonTitle,bind:this,class:this.classes(n.css.submitButton,v.globalCss.widgetButton),disabled:g,key:"esri-search__submit-button",onclick:this._handleSearchButtonClick,title:c.searchButtonTitle,type:"button"},z.tsx("span",{"aria-hidden":"true",class:t.legacyIcon.search}))}_renderWarningMenu(){return z.tsx("div",{class:this.classes(v.globalCss.menu,
n.css.warningMenu),key:"esri-search__error-menu"},z.tsx("div",{class:n.css.warningMenuBody},this._renderWarning()))}_renderSourceMenuButton(){const {messages:c,activeMenu:g,sourceMenuId:w,sourceMenuButtonId:G,disabled:R}=this,{activeSourceIndex:W,allSources:Q}=this.viewModel;return 1<Q.length?z.tsx("button",{afterCreate:m.storeNode,"aria-controls":w,"aria-expanded":("source"===g).toString(),"aria-haspopup":"true","aria-label":c.searchIn,bind:this,class:this.classes(n.css.sourcesButton,v.globalCss.widgetButton),
"data-node-ref":"_sourceMenuButtonNode",disabled:R,id:G,key:"esri-search__source-menu-button",onclick:this._handleSourcesMenuToggleClick,onfocus:this._handleSourcesMenuToggleFocus,title:c.searchIn,type:"button"},z.tsx("span",{"aria-hidden":"true",class:this.classes(t.legacyIcon.downArrow,n.css.sourcesButtonDown)}),z.tsx("span",{"aria-hidden":"true",class:this.classes(t.legacyIcon.upArrow,n.css.sourcesButtonUp)}),z.tsx("span",{class:n.css.sourceName},this._getSourceName(W))):null}_renderSourcesList(){const {allSources:c,
searchAllEnabled:g}=this.viewModel,{_activeMenuItemIndex:w,activeMenu:G,sourceMenuId:R,sourceMenuButtonId:W}=this,Q="source"===G&&-1<w?this._buildId("source-item",w):null;return 1<c.length?z.tsx("ul",{afterCreate:m.storeNode,"aria-activedescendant":Q,"aria-labelledby":W,bind:this,class:v.globalCss.menuList,"data-node-ref":"_sourceListNode",id:R,onkeydown:this._handleSourceMenuKeydown,onkeyup:this._handleSourceMenuKeyup,role:"menu",tabIndex:-1},g?this._renderSource(N.ALL_INDEX):null,c.map((q,E)=>this._renderSource(E)).toArray()):
null}_renderSourcesMenu(){const {allSources:c}=this.viewModel;return 1<c.length?z.tsx("div",{class:this.classes(v.globalCss.menu,n.css.sourcesMenu),key:"esri-search__source-menu"},this._renderSourcesList()):null}_renderLoader(){const {messages:c,messagesCommon:g,disabled:w}=this;return z.tsx("div",{class:v.globalCss.loader,key:"base-loader",tabIndex:w?-1:void 0},z.tsx("span",{"aria-hidden":"true",class:v.globalCss.loaderAnimation}),z.tsx("span",{class:t.legacyIcon.fontFallbackText},c.searchButtonTitle),
z.tsx("span",{class:v.globalCss.loaderText},g.loading))}_renderContainer(){const {allSources:c,state:g}=this.viewModel,{activeMenu:w}=this;return z.tsx("div",{afterCreate:G=>{this._container=G;G.addEventListener("focusout",this._removeActiveMenu)},afterRemoved:G=>{G.removeEventListener("focusout",this._removeActiveMenu)},class:this.classes({[n.css.hasMultipleSources]:1<c.length,[n.css.isLoading]:"loading"===g,[n.css.isSearching]:"searching"===g,[n.css.showWarning]:"warning"===w,[n.css.showSources]:"source"===
w,[n.css.showSuggestions]:"suggestion"===w},n.css.container),key:"base-container",tabIndex:-1},this._renderSourceMenuButton(),this._renderSourcesMenu(),this._renderInputContainer(),this._renderSubmitButton(),this._renderWarningMenu())}_renderClearButton(){return this.searchTerm?z.tsx("button",{bind:this,class:this.classes(n.css.clearButton,v.globalCss.widgetButton),disabled:this.disabled,key:"esri-search__clear-button",onclick:this._handleClearButtonClick,onfocus:this._clearActiveMenu,title:this.messages.clearButtonTitle,
type:"button"},z.tsx("span",{"aria-hidden":"true",class:t.legacyIcon.close})):null}_renderLocationGroup(){const {messages:c,locationEnabled:g,displayedSearchTerm:w}=this,G="suggestion"===this.activeMenu&&0===this._activeMenuItemIndex;return g&&!w?z.tsx("ul",{class:this.classes(v.globalCss.menuList,n.css.suggestionList,n.css.suggestionListCurrentLocation),key:"esri-search__suggestion-list-current-location",role:"group"},z.tsx("li",{"aria-selected":("suggestion"===this.activeMenu&&0===this._activeMenuItemIndex).toString(),
bind:this,class:this.classes(v.globalCss.menuItem,G?v.globalCss.menuItemFocus:null),"data-current-location-item":!0,id:this._buildId("suggestion-item",0),onclick:this._handleUseCurrentLocationClick,role:"option"},z.tsx("span",{"aria-hidden":"true",class:t.legacyIcon.locateCircled})," ",c.useCurrentLocation)):null}_renderInput(){const {activeMenu:c,locationEnabled:g,displayedSearchTerm:w,messages:G,suggestionsMenuId:R,inputId:W,_activeMenuItemIndex:Q,disabled:q}=this,{maxInputLength:E,placeholder:B,
searchTerm:O,suggestionCount:P}=this.viewModel,M=!!(g&&!w||P),J="suggestion"===c&&-1<Q?this._buildId("suggestion-item",Q):null;return z.tsx("input",{afterCreate:m.storeNode,"aria-activedescendant":J,"aria-autocomplete":"list","aria-controls":M?R:null,"aria-expanded":(M&&"suggestion"===c).toString(),"aria-haspopup":"listbox","aria-label":G.searchButtonTitle,autocomplete:"off",bind:this,class:this.classes(v.globalCss.input,n.css.input),"data-node-ref":"_inputNode",disabled:q,id:W,maxlength:E,onblur:this.blur,
onclick:this._openSuggestionMenu,onfocus:this.focus,oninput:this._handleInputPaste,onkeyup:this._handleInputKeyup,onpaste:this._handleInputPaste,placeholder:B,role:"combobox",title:O?"":B,type:"text",value:O})}_renderForm(){return z.tsx("form",{bind:this,class:n.css.form,disabled:this.disabled,key:"esri-search__form",onsubmit:this._formSubmit,role:"search"},this._renderInput())}_renderSuggestList(c){const {sourceIndex:g}=c;({results:c}=c);return c?.length?z.tsx("ul",{class:this.classes(v.globalCss.menuList,
n.css.suggestionList),key:`esri-search__suggestion-list-${g}`,role:"group"},c?.map(w=>this._renderSuggestion(w,this._menuItemCount++))):null}_renderSuggestionsGroup(){const {suggestions:c}=this.viewModel;return c?c.map(g=>[this._renderSuggestionHeader(g),this._renderSuggestList(g)]):[]}_renderSuggestionsMenu(){const {displayedSearchTerm:c,locationEnabled:g,suggestionsMenuId:w,inputId:G}=this,{suggestionCount:R}=this.viewModel;this._menuItemCount=0;return g&&!c||R?z.tsx("div",{afterCreate:m.storeNode,
"aria-labelledby":G,bind:this,class:this.classes(v.globalCss.menu,n.css.suggestionsMenu),"data-node-ref":"_suggestionListNode",id:w,key:"esri-search__suggestions-menu",role:"listbox"},this._renderLocationGroup(),this._renderSuggestionsGroup()):null}_renderInputContainer(){return z.tsx("div",{class:n.css.inputContainer,key:"esri-search__input-container"},this._renderForm(),this._renderSuggestionsMenu(),this._renderClearButton())}_renderSuggestionHeader(c){const {allSources:g,activeSourceIndex:w}=this.viewModel,
{sourceIndex:G}=c,R=1<g.length&&w===N.ALL_INDEX;return c.results?.length&&R?z.tsx("div",{class:v.globalCss.menuHeader,key:`esri-search__suggestion-header-${G}`},this._getSourceName(G)):null}_renderSuggestion(c,g){const {_activeMenuItemIndex:w,viewModel:{searchTerm:G}}=this;if(G)return z.tsx("li",{"aria-selected":("suggestion"===this.activeMenu&&this._activeMenuItemIndex===g).toString(),bind:this,class:this.classes(v.globalCss.menuItem,"suggestion"===this.activeMenu&&w===g?v.globalCss.menuItemFocus:
null),"data-suggestion":c,id:this._buildId("suggestion-item",g),innerHTML:this._getSuggestResultHTML(c.text,G),key:`esri-search__suggestion_${g}`,onclick:this._handleSuggestionClick,role:"option"})}_renderSource(c){const {activeSourceIndex:g,searchAllEnabled:w}=this.viewModel,G=w?c+1:c;return z.tsx("li",{"aria-checked":(c===g).toString(),bind:this,class:this.classes(n.css.source,v.globalCss.menuItem,{[v.globalCss.menuItemActive]:c===g,[v.globalCss.menuItemFocus]:"source"===this.activeMenu&&c===(w?
this._activeMenuItemIndex-1:this._activeMenuItemIndex)}),"data-source-index":c,id:this._buildId("source-item",G),key:`esri-search__source-${c}`,onclick:this._handleSourceClick,role:"menuitemradio"},this._getSourceName(c))}_renderNoResultsWarning(c){const {messages:g}=this;c=c?V.substitute(g.noResultsFoundForValue,{value:`"${c}"`}):g.noResultsFound;return z.tsx("div",{key:"esri-search__no_results"},z.tsx("div",{class:n.css.warningMenuHeader},g.noResults),z.tsx("div",{class:n.css.warningMenuText},c))}_renderEmptySearchWarning(){const {messages:c}=
this;return z.tsx("div",{key:"esri-search__empty-search"},z.tsx("span",{"aria-hidden":"true",class:t.legacyIcon.noticeTriangle}),z.tsx("span",{class:n.css.noValueText},c.emptyValue))}_renderLocateWarning(){const {messages:c}=this;return z.tsx("div",{key:"esri-search__locate-error"},z.tsx("span",{"aria-hidden":"true",class:t.legacyIcon.noticeTriangle}),z.tsx("span",{class:n.css.noValueText},c.locateError))}_renderWarning(){const {displayedSearchTerm:c,_locateFailed:g}=this,{viewModel:w}=this;return g?
this._renderLocateWarning():w.selectedSuggestion?.location||c?this._renderNoResultsWarning(c):this._renderEmptySearchWarning()}_resetActiveMenuItemIndex(){this._activeMenuItemIndex=-1}_buildId(c,g){return`${this.id}-${c}${void 0===g?"":`-${g}`}`}_watchSourceChanges(){const {viewModel:{allSources:c}}=this;this.removeHandles("sources");c.forEach(g=>this.addHandles(h.watch(()=>g.name,()=>this.scheduleRender()),"sources"))}_handleSourcesMenuToggleFocus(){"source"!==this.activeMenu&&this._clearActiveMenu()}_handleSourcesMenuToggleClick(){this.activeMenu=
"source"===this.activeMenu?"none":"source";this.renderNow();"source"===this.activeMenu&&this._sourceListNode?.focus()}_handleClearButtonClick(){this.viewModel.clear();this._focus()}_handleSearchButtonClick(){this.search()}_handleSuggestionClick(c){if(c=c.currentTarget?.["data-suggestion"])this._focus(),this.search(c)}_handleUseCurrentLocationClick(){this._useCurrentLocation()}_useCurrentLocation(){this._focus("none");this._cancelSuggest();this._cancelSearch();const c=new AbortController,{signal:g}=
c;this._searchController=c;(async()=>{try{this.activeMenu=(await this.viewModel.searchNearby({signal:g}))?.numResults?"none":"warning"}catch(w){this._locateFailed=!0,this.activeMenu="warning"}finally{this._searchController=null}})()}_handleSourceClick(c){this._setSourceFromMenuItem(c.currentTarget)}_setSourceFromMenuItem(c){c&&(c=c?.["data-source-index"],null!=c&&(this.viewModel.activeSourceIndex=c,this._clearActiveMenu(),this._sourceMenuButtonNode?.focus()))}_cancelSuggest(){this._suggestController=
l.abortMaybe(this._suggestController)}_cancelSearch(){this._searchController=l.abortMaybe(this._searchController);this._locateFailed=!1}_handleInputKeyup(c){var {key:g}=c;if(!c.ctrlKey&&!c.metaKey&&"Copy"!==g&&"ArrowLeft"!==g&&"ArrowRight"!==g&&"Shift"!==g)if("Tab"===g||"Escape"===g||c.shiftKey&&"Tab"===g)this._cancelSuggest(),"Escape"===g&&this._clearActiveMenu();else{var w="Home"===g||"End"===g||"ArrowUp"===g||"ArrowDown"===g;if("Enter"===g&&0>this._activeMenuItemIndex)this._cancelSuggest();else{var G=
this._suggestionListNode?.getElementsByTagName("li");if(G?.length){"suggestion"!==this.activeMenu&&this._openSuggestionMenu();if(w){c.preventDefault();this._cancelSuggest();this._handleItemNavigation(g,G,this._suggestionListNode);return}c=G[this._activeMenuItemIndex];if("Enter"===g&&c){(g=c?.["data-suggestion"])?(this._focus(),this.search(g)):c?.["data-current-location-item"]&&this._useCurrentLocation();return}}this.viewModel.searchTerm&&this.suggest()}}}_handleItemNavigation(c,g,w){const G=this._activeMenuItemIndex;
"Home"===c&&(this._activeMenuItemIndex=0);"End"===c&&(this._activeMenuItemIndex=g.length-1);"ArrowUp"===c&&(this._activeMenuItemIndex=0>=this._activeMenuItemIndex?g.length-1:this._activeMenuItemIndex-1);"ArrowDown"===c&&(this._activeMenuItemIndex=this._activeMenuItemIndex===g.length-1?0:this._activeMenuItemIndex+1);G!==this._activeMenuItemIndex&&w&&m.keepMenuItemWithinView(g[this._activeMenuItemIndex],w)}_scrollToTopSuggestion(){this._suggestionListNode&&(this._suggestionListNode.scrollTop=0)}_openSuggestionMenu(){this.activeMenu=
"suggestion"}_handleInputPaste(c){c=c.target;this.viewModel.searchTerm!==c.value&&(this.viewModel.searchTerm=c.value);this.viewModel.searchTerm&&this.suggest()}_handleSourceMenuKeydown(c){const {key:g}=c;m.isActivationKey(g)?(c.preventDefault(),c=this._sourceListNode?.getElementsByTagName("li")?.[this._activeMenuItemIndex],this._setSourceFromMenuItem(c)):"ArrowUp"!==g&&"ArrowDown"!==g&&"End"!==g&&"Home"!==g||c.preventDefault()}_handleSourceMenuKeyup(c){const {key:g}=c,w="ArrowUp"===g||"ArrowDown"===
g||"End"===g||"Home"===g;w&&c.preventDefault();"Escape"===g?(this._clearActiveMenu(),this._sourceMenuButtonNode?.focus()):(c=this._sourceListNode?.getElementsByTagName("li"))&&0!==c.length&&w&&("source"!==this.activeMenu&&(this.activeMenu="source"),this._handleItemNavigation(g,c,this._sourceListNode?.parentElement))}_focus(c){this.focus();c&&(this.activeMenu=c)}_formSubmit(c){c.preventDefault();-1===this._activeMenuItemIndex&&this.search()}_getSourceName(c){const {messages:g}=this;var {allSources:w}=
this.viewModel;w=w.at(c);return c===N.ALL_INDEX?g.all:w?w.name||g.untitledSource:g.untitledSource}_getSuggestResultHTML(c,g){return c?X.test(c)?c:ba(c,g):this.messages.untitledResult}_renderSearchResultsContent(){this._searchResultRenderer.showMoreResultsOpen=!1;this._searchResultRenderer.viewModel=this.viewModel;return this._searchResultRenderer}};b.__decorate([f.property()],d.prototype,"_activeMenuItemIndex",void 0);b.__decorate([f.property()],d.prototype,"displayedSearchTerm",null);b.__decorate([f.property({readOnly:!0})],
d.prototype,"inputId",null);b.__decorate([f.property({readOnly:!0})],d.prototype,"suggestionsMenuId",null);b.__decorate([f.property({readOnly:!0})],d.prototype,"sourceMenuId",null);b.__decorate([f.property({readOnly:!0})],d.prototype,"sourceMenuButtonId",null);b.__decorate([f.property()],d.prototype,"activeMenu",void 0);b.__decorate([f.property({readOnly:!0})],d.prototype,"activeSource",null);b.__decorate([f.property()],d.prototype,"activeSourceIndex",null);b.__decorate([f.property()],d.prototype,
"allPlaceholder",null);b.__decorate([f.property({readOnly:!0})],d.prototype,"allSources",null);b.__decorate([f.property()],d.prototype,"autoNavigate",null);b.__decorate([f.property()],d.prototype,"autoSelect",null);b.__decorate([f.property({readOnly:!0})],d.prototype,"defaultSources",null);b.__decorate([f.property()],d.prototype,"disabled",void 0);b.__decorate([f.property()],d.prototype,"goToOverride",null);b.__decorate([f.property()],d.prototype,"icon",null);b.__decorate([f.property()],d.prototype,
"includeDefaultSources",null);b.__decorate([f.property()],d.prototype,"label",null);b.__decorate([f.property()],d.prototype,"locationEnabled",null);b.__decorate([f.property()],d.prototype,"maxResults",null);b.__decorate([f.property()],d.prototype,"maxSuggestions",null);b.__decorate([f.property(),H.messageBundle("esri/widgets/Search/t9n/Search")],d.prototype,"messages",void 0);b.__decorate([f.property(),H.messageBundle("esri/t9n/common")],d.prototype,"messagesCommon",void 0);b.__decorate([f.property()],
d.prototype,"minSuggestCharacters",null);b.__decorate([f.property()],d.prototype,"popupEnabled",null);b.__decorate([f.property()],d.prototype,"popupTemplate",null);b.__decorate([f.property()],d.prototype,"portal",null);b.__decorate([f.property()],d.prototype,"resultGraphic",null);b.__decorate([f.property()],d.prototype,"resultGraphicEnabled",null);b.__decorate([f.property({readOnly:!0})],d.prototype,"results",null);b.__decorate([f.property()],d.prototype,"searchAllEnabled",null);b.__decorate([f.property()],
d.prototype,"searchTerm",null);b.__decorate([f.property({readOnly:!0})],d.prototype,"selectedResult",null);b.__decorate([f.property()],d.prototype,"sources",null);b.__decorate([f.property({readOnly:!0})],d.prototype,"suggestions",null);b.__decorate([f.property()],d.prototype,"suggestionsEnabled",null);b.__decorate([f.property()],d.prototype,"view",null);b.__decorate([D.vmEvent("search-complete search-clear search-start select-result suggest-start suggest-complete".split(" ")),f.property({type:N})],
d.prototype,"viewModel",void 0);return d=b.__decorate([u.subclass("esri.widgets.Search")],d)});