// All material copyright ESRI, All Rights Reserved, unless otherwise specified.
// See http://@sbaseurl@/jsapi/jsapi/esri/copyright.txt and http://www.arcgis.com/apps/webappbuilder/copyright.txt for details.

//>>built
require({cache:{"url:widgets/NearMe/setting/FilterSetting.html":'\x3cdiv\x3e\r\n\t\x3cdiv class\x3d"esriCTFilterMsg"\x3e${nls.filterSetting.addTaskTip}\x3c/div\x3e\r\n\t\x3cdiv class\x3d"content"\x3e\r\n\t\t\x3cdiv class\x3d"items-list jimu-not-selectable"\x3e\r\n\t\t\t\x3cdiv class\x3d"add-btn" data-dojo-attach-event\x3d"click:_onBtnAddItemClicked"\x3e\r\n\t\t\t\t\x3cdiv class\x3d"icon"\x3e\x3c/div\x3e\r\n\t\t\t\t\x3cdiv class\x3d"tip"\x3e${nls.filterSetting.newFilter}\x3c/div\x3e\r\n\t\t\t\x3c/div\x3e\r\n\t\t\t\x3cdiv class\x3d"items-list-content" data-dojo-attach-point\x3d"listContent" data-dojo-attach-event\x3d"click:_onListContentClicked"\x3e\x3c/div\x3e\r\n\t\t\x3c/div\x3e\r\n\t\t\x3cdiv class\x3d"separator not-visible" data-dojo-attach-point\x3d"separator"\x3e\x3c/div\x3e\r\n\t\t\x3cdiv class\x3d"single-setting-content" data-dojo-attach-point\x3d"singleSettingContent"\x3e\r\n\t\t\t\x3cdiv class\x3d"no-task-tip" data-dojo-attach-point\x3d"noTaskTip"\x3e\x3c/div\x3e\r\n\t\t\x3c/div\x3e\r\n\t\x3c/div\x3e\r\n\t\x3cdiv class\x3d"collapse-option" \x3e\r\n\t\t\x3cdiv data-dojo-attach-point\x3d"cbxCollapseFilters"\x3e\x3c/div\x3e\r\n\t\x3c/div\x3e\r\n\t\x3cdiv class\x3d"collapse-option" \x3e\r\n\t\t\x3cdiv data-dojo-attach-point\x3d"cbxGroupFiltersNode"\x3e\x3c/div\x3e\r\n\t\x3c/div\x3e\r\n\t\x3cdiv class\x3d"collapse-option" \x3e\r\n\t\t\x3cdiv data-dojo-attach-point\x3d"cbxExpandFiltersOnLoadNode"\x3e\x3c/div\x3e\r\n\t\x3c/div\x3e\r\n\t\x3cdiv data-dojo-attach-point\x3d"shelter" data-dojo-type\x3d"jimu/dijit/LoadingShelter" data-dojo-props\x3d\'hidden:true\'\x3e\x3c/div\x3e\r\n\x3c/div\x3e'}});
define("dojo/on dojo/query dojo/_base/html dojo/_base/lang dojo/_base/array dojo/_base/declare dijit/_WidgetsInTemplateMixin dojo/text!./FilterSetting.html esri/lang jimu/utils jimu/BaseWidgetSetting ./SingleFilterSetting jimu/LayerInfos/LayerInfos jimu/dijit/CheckBox jimu/dijit/LoadingShelter".split(" "),function(k,h,c,d,g,n,p,q,r,t,u,v,w,l){return n([u,p],{baseClass:"jimu-widget-nearme-filter-setting",templateString:q,singleSetting:null,layerChooserSelect:null,layerInfosObj:null,selectedSearchLayers:[],
postMixInProperties:function(){this.jimuNls=window.jimuNls;this.layerInfosObj=w.getInstanceSync();this.config&&(this.config=this._getConfigWithValidDataSource(this.config));this.noTaskNls=this.nls.filterSetting.noTasksTip;this.noTaskNls=r.substitute({newFilter:"\x3cspan\x3e"+this.nls.filterSetting.newFilter+"\x3c/span\x3e"},this.noTaskNls)},_getConfigWithValidDataSource:function(a){a.filterSettings||(a.filterSettings={},a.filterSettings.filters=[],a.filterSettings.collapse=!1);a.filterSettings.filters=
g.filter(a.filterSettings.filters,d.hitch(this,function(b){return b.layerId?!!this.layerInfosObj.getLayerInfoById(b.layerId):!0}));return a},postCreate:function(){this.inherited(arguments);this.selectedSearchLayers=[];this.noTaskTip.innerHTML=this.noTaskNls;this.updateLayerOptions();this.cbxCollapseFilterExp=new l({"class":"esriCTFilterLabel",label:this.nls.filterSetting.collapseFiltersTip||""});this.cbxCollapseFilterExp.placeAt(this.cbxCollapseFilters);this.cbxCollapseFilterExp.setValue(!1);this.cbxGroupFilters=
new l({"class":"esriCTFilterLabel",label:this.nls.filterSetting.groupFiltersTip||""});this.cbxGroupFilters.placeAt(this.cbxGroupFiltersNode);this.cbxGroupFilters.setValue(!1);this.cbxExpandFiltersOnLoad=new l({"class":"esriCTFilterLabel",label:this.nls.filterSetting.expandFiltersOnLoad||""});this.cbxExpandFiltersOnLoad.placeAt(this.cbxExpandFiltersOnLoadNode);this.cbxExpandFiltersOnLoad.setValue(!1);this.config&&this.setConfig(this.config)},_onListContentClicked:function(a){a=a.target||a.srcElement;
var b=t.getAncestorDom(a,function(e){return c.hasClass(e,"item")},3);b&&(c.hasClass(a,"action")?c.hasClass(a,"up")?b.previousElementSibling&&c.place(b,b.previousElementSibling,"before"):c.hasClass(a,"down")?b.nextElementSibling&&c.place(b,b.nextElementSibling,"after"):c.hasClass(a,"delete")&&(this._deleteItem(b),this._resetSelection()):this.singleSetting?this.singleSetting.target!==b&&this.singleSetting.getConfig()&&(this.singleSetting.destroy(),this.singleSetting=null,this._createSingleSetting(b)):
this._createSingleSetting(b))},_onBtnAddItemClicked:function(){if(this.singleSetting)if(this.singleSetting.getConfig())this.singleSetting.destroy(),this.singleSetting=null;else return;var a=this._createTarget();this._createSingleSetting(a,null)},_createSingleSetting:function(a){h(".item",this.listContent).removeClass("selected");this.singleSetting&&this.singleSetting.destroy();this.singleSetting=null;this.singleSetting=new v({map:this.map,nls:this.nls,target:a,folderUrl:this.folderUrl,layerInfosObj:this.layerInfosObj,
selectedSearchLayers:this.selectedSearchLayers});this.singleSetting.placeAt(this.singleSettingContent);this.own(k(this.singleSetting,"loading",d.hitch(this,function(){this.shelter.show()})));this.own(k(this.singleSetting,"unloading",d.hitch(this,function(){this.shelter.hide()})));this.own(k(this.singleSetting,"before-destroy",d.hitch(this,function(){c.addClass(this.separator,"not-visible")})));c.addClass(a,"selected");a.singleConfig?this.singleSetting.setConfig(a.singleConfig):setTimeout(d.hitch(this,
function(){this.singleSetting.showLayerChooserPopup()}),50);c.removeClass(this.separator,"not-visible");c.addClass(this.noTaskTip,"not-visible")},_createTarget:function(a){a=a||"";return c.create("div",{"class":"item",innerHTML:'\x3cdiv class\x3d"label jimu-ellipsis" title\x3d"'+a+'"\x3e'+a+'\x3c/div\x3e\x3cdiv class\x3d"actions jimu-float-trailing"\x3e\x3cdiv class\x3d"delete action jimu-float-trailing"\x3e\x3c/div\x3e\x3cdiv class\x3d"down action jimu-float-trailing"\x3e\x3c/div\x3e\x3cdiv class\x3d"up action jimu-float-trailing"\x3e\x3c/div\x3e\x3c/div\x3e'},
this.listContent)},_updateNoQueryTip:function(){0<h(".item",this.listContent).length?c.addClass(this.noTaskTip,"not-visible"):c.removeClass(this.noTaskTip,"not-visible")},setConfig:function(a){if(a.hasOwnProperty("filterSettings")){a.filterSettings.hasOwnProperty("collapse")&&this.cbxCollapseFilterExp.setValue(a.filterSettings.collapse);a.filterSettings.hasOwnProperty("groupFiltersByLayer")&&this.cbxGroupFilters.setValue(a.filterSettings.groupFiltersByLayer);a.filterSettings.hasOwnProperty("expandFiltersOnLoad")&&
this.cbxExpandFiltersOnLoad.setValue(a.filterSettings.expandFiltersOnLoad);var b=null;g.forEach(a.filterSettings.filters,d.hitch(this,function(e,f){var m=this._createTarget(e.name);m.singleConfig=e;0===f&&(b=m)}));b&&this._createSingleSetting(b)}this._updateNoQueryTip()},getConfig:function(){if(this.singleSetting&&!this.singleSetting.getConfig())return!1;var a=h(".item",this.listContent),b={collapse:this.cbxCollapseFilterExp.getValue(),groupFiltersByLayer:this.cbxGroupFilters.getValue(),expandFiltersOnLoad:this.cbxExpandFiltersOnLoad.getValue(),
filters:[]};b.filters=g.map(a,d.hitch(this,function(e){return e.singleConfig}));return b},destroy:function(){this.singleSetting&&this.singleSetting.destroy();this.singleSetting=null;this.inherited(arguments)},updateLayerOptions:function(a){var b=[];g.forEach(a||this.config.searchLayers,d.hitch(this,function(f){b.push(f.id)}));this.selectedSearchLayers=b;this.singleSetting&&this.singleSetting.updateLayerOptions(this.selectedSearchLayers);a=h(".item",this.listContent);var e=[];g.forEach(a,d.hitch(this,
function(f){(!f.singleConfig||0>this.selectedSearchLayers.indexOf(f.singleConfig.layerId))&&e.push(f)}));g.forEach(e,d.hitch(this,function(f){this._deleteItem(f)}));this._resetSelection()},_deleteItem:function(a){a&&(this.singleSetting&&this.singleSetting.target===a&&(this.singleSetting.destroy(),this.singleSetting=null),c.destroy(a))},_resetSelection:function(){var a=h(".item",this.listContent);0<a.length&&this._createSingleSetting(a[0]);this._updateNoQueryTip()}})});