/*
 COPYRIGHT 2009 ESRI

 TRADE SECRETS: ESRI PROPRIETARY AND CONFIDENTIAL
 Unpublished material - all rights reserved under the
 Copyright Laws of the United States and applicable international
 laws, treaties, and conventions.

 For additional information, contact:
 Environmental Systems Research Institute, Inc.
 Attn: Contracts and Legal Services Department
 380 New York Street
 Redlands, California, 92373
 USA

 email: contracts@esri.com
 */
//>>built
require({cache:{"url:esri/dijit/analysis/templates/FindNearest.html":"<div class=\"esriAnalysis\">\r\n    <div data-dojo-type=\"dijit/layout/ContentPane\" style=\"margin-top:0.5em; margin-bottom: 0.5em;\">\r\n      <div data-dojo-attach-point=\"_aggregateToolContentTitle\" class=\"analysisTitle\">\r\n        <table class=\"esriFormTable\" > \r\n          <tr>\r\n            <td class=\"esriToolIconTd\"><div class=\"findClosestFacilityIcon\"></div></td>\r\n            <td class=\"esriAlignLeading\">${i18n.findNearest}</td>\r\n            <td>\r\n              <div class=\"esriFloatTrailing\" style=\"padding:0;\">\r\n                  <a href=\"#\" class='esriFloatLeading helpIcon' esriHelpTopic=\"toolDescription\"></a>\r\n                  <a href=\"#\" data-dojo-attach-point=\"_closeBtn\" title=\"${i18n.close}\" class=\"closeIcon\">              \r\n                  <img data-dojo-attach-point=\"_closeImg\" border=\"0\"/></a>            \r\n              </div>                \r\n            </td>\r\n          </tr>\r\n        </table>\r\n      </div>\r\n      <div style=\"clear:both; border-bottom: #333 thin solid; height:1px;width:100%;\"></div>\r\n    </div>\r\n    <div data-dojo-type=\"dijit/form/Form\" data-dojo-attach-point=\"_form\" readOnly=\"true\">\r\n       <table class=\"esriFormTable\"  data-dojo-attach-point=\"_aggregateTable\"  style=\"border-collapse:collapse;border-spacing:5px;\" cellpadding=\"5px\" cellspacing=\"5px\"> \r\n         <tbody>\r\n          <tr>\r\n            <td  colspan=\"3\" class=\"sectionHeader\" data-dojo-attach-point=\"_aggregateToolDescription\" >${i18n.summarizeDefine}</td>\r\n          </tr>      \r\n          <tr>\r\n            <td colspan=\"3\">\r\n              <label class=\"esriFloatLeading esriTrailingMargin025\">${i18n.oneLabel}</label>\r\n              <label class=\"\">${i18n.findLocationsIn}</label>\r\n              <a href=\"#\" class='esriFloatTrailing helpIcon' esriHelpTopic=\"NearbyLocationsLayer\"></a>\r\n              <select class=\"longInput esriLeadingMargin1\"  style=\"margin-top:1.0em;\" data-dojo-type=\"dijit/form/Select\" data-dojo-attach-point=\"_layersSelect\" data-dojo-attach-event=\"onChange:_handleLayerChange\"></select>\r\n            </td>\r\n          </tr>\r\n          <tr>\r\n          <tr>\r\n            <td colspan=\"3\" class=\"clear\"></td>\r\n          </tr>\r\n            \r\n          <tr>\r\n            <td colspan=\"2\">\r\n              <label data-dojo-attach-point=\"_labelTwo\" class=\"esriFloatLeading esriTrailingMargin025 \">${i18n.twoLabel}</label>\r\n              <label data-dojo-attach-point=\"_measurelabel\" class=\"\">${i18n.measureLabel}</label>\r\n            </td>\r\n            <td class=\"shortTextInput\">\r\n              <a href=\"#\" class='esriFloatTrailing helpIcon' data-dojo-attach-point=\"_analysisFieldHelpLink\" esriHelpTopic=\"MeasurementMethod\"></a>\r\n            </td>\r\n          </tr>\r\n          <tr>\r\n            <td style=\"padding:0.25em;width:34%\">\r\n              <div class=\"esriLeadingMargin1 bufferSelector selected\" data-dojo-attach-point=\"_straightLine\" >\r\n                <div class=\"bufferIcon esriStraightLineDistanceIcon\"></div>\r\n                <div><label class=\"esriFloatLeading esriTrailingMargin1 esriSelectLabel\">${i18n.straightLineDistance}</label></div>\r\n              </div>\r\n            </td>\r\n            <td style=\"padding:0.25em;width:33%\">\r\n              <div class=\"bufferSelector\" data-dojo-attach-point=\"_drivingDistance\">\r\n                <div class=\"bufferIcon esriDrivingDistanceIcon\"></div>\r\n                <div><label data-dojo-attach-point=\"_drivingDistanceLabel\" class=\"esriFloatLeading esriTrailingMargin1 esriSelectLabel\">${i18n.drivingDistance}</label></div>\r\n              </div>\r\n            </td>\r\n            <td style=\"esriTrailingMargin2 padding:0.25em;width:33%\">\r\n              <div class=\"bufferSelector\" data-dojo-attach-point=\"_drivingTime\" >\r\n                <div class=\"bufferIcon esriDrivingTimeIcon\"></div>\r\n                <div><label data-dojo-attach-point=\"_drivingTimeLabel\" class=\"esriFloatLeading esriSelectLabel\">${i18n.drivingTime}</label></div>\r\n              </div>\r\n            </td>\r\n          </tr>\r\n          <tr>\r\n            <td colspan=\"3\" class=\"clear\"></td>\r\n          </tr>\r\n          <tr>\r\n            <td colspan=\"3\">\r\n              <label class=\"esriFloatLeading esriTrailingMargin025\">${i18n.threeLabel}</label>\r\n              <label class=\"longTextInput\" data-dojo-attach-point=\"_forLocationLabel\"></label>\r\n              <a href=\"#\" class='esriFloatTrailing helpIcon' data-dojo-attach-point=\"_addStatsHelpLink\" esriHelpTopic=\"Cutoffs\"></a>\r\n            </td>\r\n          </tr>\r\n         <tr>\r\n           <td colspan=\"3\" style=\"padding-bottom:0;\">\r\n              <label class=\"esriLeadingMargin1\">\r\n                <div class=\"esriLeadingMargin1\" data-dojo-type=\"dijit/form/CheckBox\"  data-dojo-attach-point=\"_findNearestCheck\" data-dojo-attach-event=\"onChange:_handleFindNearestCheckChange\" data-dojo-props=\"checked:'true'\"></div>\r\n                <label data-dojo-attach-point=\"_findNearestLabel\">${i18n.findNearestLabel}</label>\r\n              </label>\r\n           </td>\r\n         </tr>\r\n         <tr>\r\n           <td colspan=\"3\" style=\"padding-bottom:0.25;padding-top:0.25;\">\r\n             <input data-dojo-type=\"dijit/form/NumberSpinner\"  class= \"esriMediumlabel esriLeadingMargin2\"  data-dojo-attach-point=\"_maxCountInput\" value=\"1\" data-dojo-props=\"style: 'width:25%',smallDelta:1,constraints: { min:1, max:100, places:0 }\"/>\r\n           </td>\r\n         </tr>\r\n         <tr>\r\n           <td colspan=\"3\" style=\"padding-bottom:0.25;padding-top:0.25;\">\r\n              <label class=\"esriLeadingMargin1\">\r\n                <div class=\"esriLeadingMargin1\" data-dojo-type=\"dijit/form/CheckBox\"  data-dojo-attach-point=\"_limitSearchRangeCheck\" data-dojo-attach-event=\"onChange:_handleLimitSearchCheckChange\" data-dojo-props=\"checked:'true'\"></div>\r\n                <label data-dojo-attach-point=\"_limitSearchRangeLabel\">${i18n.limitSearchRangeCheck}</label>\r\n              </label>\r\n           </td>\r\n         </tr>\r\n         <tr data-dojo-attach-point=\"_distanceLimitRow\">\r\n            <td style=\"padding-right:0;padding-top:0;width:20%;\">\r\n              <input type=\"text\" class=\"esriLeadingMargin2\" data-dojo-type=\"dijit/form/NumberTextBox\" data-dojo-attach-event=\"onChange:_handleDistUnitsChange\" data-dojo-props=\"intermediateChanges:true,value:'100',required:true,missingMessage:'${i18n.distanceMsg}'\" data-dojo-attach-point=\"_searchCutoffInput\" class=\"esriLeadingMargin1\"  style=\"width:50%;\">\r\n            </td>\r\n            <td colspan=\"2\" style=\"padding-left:0.25em;padding-top:0;width:60%;\">\r\n              <select class=\"mediumInput esriMediumlabel esriAnalysisSelect\" data-dojo-type=\"dijit/form/Select\" data-dojo-attach-event=\"onChange:_handleDistUnitsChange\" data-dojo-attach-point=\"_distanceUnitsSelect\" style=\"width:40%;table-layout:fixed;\">\r\n                <option value=\"Seconds\">${i18n.seconds}</option>\r\n                <option value=\"Minutes\" selected=\"selected\">${i18n.minutes}</option>\r\n                <option value=\"Hours\">${i18n.hours}</option>\r\n              </select>\r\n            </td>\r\n          </tr>\r\n          <tr data-dojo-attach-point=\"_timeLimitRow\" style=\"display:none;\">\r\n            <td style=\"padding-top:0;width:24%;\">\r\n              <label class=\"esriLeadingMargin2 esriTrailingMargin025\">\r\n                <input type=\"text\" class=\"\" style=\"width:40%\" data-dojo-type=\"dijit/form/NumberTextBox\" data-dojo-attach-event=\"onChange:_handleTimeUnitsChange\" data-dojo-props=\"intermediateChanges:true,value:'1',required:true,invalidMessage:'not valid', missingMessage:'${i18n.distanceMsg}'\" data-dojo-attach-point=\"_hoursInput\"></input>\r\n                ${i18n.hoursSmall}</label>\r\n            </td>\r\n            <td style=\"padding-top:0;width:24%;\">\r\n              <label class=\"esriLeadingMargin1 esriTrailingMargin025\">\r\n                <input type=\"text\" class=\"\" style=\"width:40%\" data-dojo-type=\"dijit/form/NumberTextBox\" data-dojo-attach-event=\"onChange:_handleTimeUnitsChange\" data-dojo-props=\"intermediateChanges:true,value:'0',required:true,invalidMessage:'not valid', missingMessage:'${i18n.distanceMsg}'\" data-dojo-attach-point=\"_minutesInput\"></input>\r\n                ${i18n.minutesSmall}</label>\r\n            </td>\r\n            <td style=\"padding-top:0;width:24%;\">\r\n              <label class=\"esriTrailingMargin025\">\r\n                <input type=\"text\" class=\"\" style=\"width:40%\" data-dojo-type=\"dijit/form/NumberTextBox\" data-dojo-attach-event=\"onChange:_handleTimeUnitsChange\" data-dojo-props=\"intermediateChanges:true,value:'0',required:true,invalidMessage:'not valid', missingMessage:'${i18n.distanceMsg}'\" data-dojo-attach-point=\"_secondsInput\"></input>\r\n                ${i18n.secondsSmall}</label>\r\n            </td>                        \r\n          </tr>\r\n                  \r\n          <tr data-dojo-attach-point=\"_useTrafficLabelRow\">\r\n            <td colspan=\"2\" style=\"padding-bottom: 0\">\r\n              <label class=\"esriFloatLeading esriTrailingMargin025\">${i18n.fourLabel}</label>\r\n              <label class=\"longTextInput\"></label>\r\n            </td>\r\n            <td class=\"shortTextInput\" style=\"padding-bottom: 0\">\r\n              <a href=\"#\" class='esriFloatTrailing helpIcon' esriHelpTopic=\"UseTypicalTraffic\"></a> \r\n            </td>             \r\n          </tr>          \r\n          <tr data-dojo-attach-point=\"_useTrafficRow\">\r\n            <td colspan=\"3\" style=\"padding:0;\">\r\n              <div style=\"width:100%;\" class=\"esriFloatLeading esriTrailingMargin3\" data-dojo-type=\"esri/dijit/analysis/TrafficTime\" data-dojo-attach-point=\"_trafficTimeWidget\"></div>\r\n            </td>\r\n          </tr>\r\n          <tr>\r\n            <td colspan=\"3\" class=\"clear\"></td>\r\n          </tr>\r\n          <tr>\r\n            <td colspan=\"2\">\r\n              <label class=\"esriFloatLeading esriTrailingMargin025\" data-dojo-attach-point=\"_outputNumberLabel\">${i18n.fourLabel}</label>\r\n              <label class=\"longTextInput\">${i18n.outputLayersLabel}</label>\r\n            </td>\r\n            <td class=\"shortTextInput\">\r\n              <a href=\"#\" class='esriFloatTrailing helpIcon' esriHelpTopic=\"OutputNearestLocationsLayer\"></a> \r\n            </td>             \r\n          </tr>\r\n          <tr>\r\n            <td colspan=\"3\">\r\n              <input type=\"text\" data-dojo-type=\"dijit/form/ValidationTextBox\" class=\"esriLeadingMargin1 esriOutputText\"  data-dojo-props=\"required:true\" data-dojo-attach-point=\"_outputLayerInput\" value=\"\"></input>\r\n            </td>                \r\n          </tr> \r\n          <!--<tr>\r\n            <td colspan=\"3\">\r\n              <input type=\"text\" data-dojo-type=\"dijit/form/ValidationTextBox\" class=\"esriLeadingMargin1 esriOutputText\"  data-dojo-props=\"required:true\" data-dojo-attach-point=\"_outputLayerInput2\" value=\"\"></input>\r\n            </td>                \r\n          </tr>-->           \r\n          <tr>\r\n            <td colspan=\"3\">\r\n               <div class=\"esriLeadingMargin1\" data-dojo-attach-point=\"_chooseFolderRow\">\r\n                 <label style=\"width:9px;font-size:smaller;\">${i18n.saveResultIn}</label>\r\n                 <input class=\"longInput esriFolderSelect\" dojoAttachPoint=\"_webMapFolderSelect\" dojotype=\"dijit/form/ComboBox\" trim=\"true\"></input>\r\n               </div>              \r\n            </td>\r\n          </tr>                                      \r\n        </tbody>         \r\n       </table>\r\n     </div>\r\n    <div data-dojo-attach-point=\"_aggregateToolContentButtons\" style=\"padding:5px;margin-top:5px;border-top:solid 1px #BBB;\">\r\n      <div style=\"width:100%;padding:0.5em 0 0.5em 0\">\r\n        <a class=\"esriFloatTrailing esriSmallFont\"  href=\"#\" data-dojo-attach-point=\"_showCreditsLink\" data-dojo-attach-event=\"onclick:_handleShowCreditsClick\">${i18n.showCredits}</a>\r\n       <label data-dojo-attach-point=\"_chooseExtentDiv\"class=\"esriSelectLabel\" style=\"font-size:smaller;\">\r\n         <input type=\"radio\" data-dojo-attach-point=\"_useExtentCheck\" data-dojo-type=\"dijit/form/CheckBox\" data-dojo-props=\"checked:true\" name=\"extent\" value=\"true\"/>\r\n           ${i18n.useMapExtent}\r\n       </label>\r\n      </div>\r\n      <button data-dojo-type=\"dijit/form/Button\" type=\"submit\" data-dojo-attach-point=\"_saveBtn\" class=\"esriLeadingMargin4\" data-dojo-attach-event=\"onClick:_handleSaveBtnClick\">\r\n          ${i18n.runAnalysis}\r\n      </button>\r\n    </div>\r\n    <div data-dojo-type=\"dijit/Dialog\" title=\"${i18n.creditTitle}\" data-dojo-attach-point=\"_usageDialog\" style=\"width:40em;\">\r\n      <div data-dojo-type=\"esri/dijit/analysis/CreditEstimator\"  data-dojo-attach-point=\"_usageForm\"></div>\r\n    </div>    \r\n</div>\r\n"}});define("esri/dijit/analysis/FindNearest",["require","dojo/_base/declare","dojo/_base/lang","dojo/_base/array","dojo/_base/connect","dojo/_base/json","dojo/has","dojo/i18n","dojo/json","dojo/string","dojo/dom-style","dojo/dom-attr","dojo/dom-construct","dojo/query","dojo/dom-class","dojo/number","dijit/_WidgetBase","dijit/_TemplatedMixin","dijit/_WidgetsInTemplateMixin","dijit/_OnDijitClickMixin","dijit/_FocusMixin","dijit/registry","dijit/form/Button","dijit/form/CheckBox","dijit/form/Form","dijit/form/Select","dijit/form/TextBox","dijit/form/ValidationTextBox","dijit/layout/ContentPane","dijit/form/ComboBox","dijit/form/NumberSpinner","dijit/form/NumberTextBox","esri/kernel","esri/dijit/analysis/AnalysisBase","esri/dijit/analysis/CreditEstimator","esri/dijit/analysis/utils","esri/dijit/analysis/TrafficTime","dojo/text!esri/dijit/analysis/templates/FindNearest.html"],function(_1,_2,_3,_4,_5,_6,_7,_8,_9,_a,_b,_c,_d,_e,_f,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_1a,_1b,_1c,_1d,_1e,_1f,_20,_21,_22,_23,_24,_25,_26){var _27=_2([_11,_12,_13,_14,_15,_22],{declaredClass:"esri.dijit.analysis.FindNearest",templateString:_26,basePath:_1.toUrl("esri/dijit/analysis"),widgetsInTemplate:true,analysisLayer:null,nearLayers:null,summaryFields:null,outputLayerName:null,nearLayer:null,searchCutoff:100,searchCutoffUnits:"Miles",maxCount:1,showSelectFolder:false,showChooseExtent:true,showCredits:true,_isDrivingSelectionEnabled:true,showHelp:true,i18n:null,toolName:"FindNearest",helpFileName:"FindNearest",resultParameter:"nearestLayer",_timeObj:null,constructor:function(_28){this.inherited(arguments);this._pbConnects=[];this._statsRows=[];this._timeObj={hours:1,minutes:0,seconds:0};if(_28.containerNode){this.container=_28.containerNode;}},destroy:function(){this.inherited(arguments);_4.forEach(this._pbConnects,_5.disconnect);delete this._pbConnects;},postMixInProperties:function(){this.inherited(arguments);_3.mixin(this.i18n,_8.getLocalization("esri","jsapi").bufferTool);_3.mixin(this.i18n,_8.getLocalization("esri","jsapi").driveTimes);_3.mixin(this.i18n,_8.getLocalization("esri","jsapi").FindNearestTool);},postCreate:function(){this.inherited(arguments);_f.add(this._form.domNode,"esriSimpleForm");_c.set(this._closeImg,"src",this.basePath+"/images/close.gif");this._outputLayerInput.set("validator",_3.hitch(this,this.validateServiceName,this._outputLayerInput));this._hoursInput.set("validator",_3.hitch(this,this.validateTime,"hours"));this._minutesInput.set("validator",_3.hitch(this,this.validateTime,"minutes"));this._secondsInput.set("validator",_3.hitch(this,this.validateTime,"seconds"));this.searchCutoff=100;this._buildUI();},startup:function(){},_onClose:function(_29){if(_29){this._save();this.onSave();}this.onClose();},_handleShowCreditsClick:function(e){e.preventDefault();if(!this._form.validate()){return;}var _2a={},_2b={},_2c;_2c=this.nearLayers[this._layersSelect.get("value")];_2a.nearLayer=_6.toJson(_24.constructAnalysisInputLyrObj(_2c));_2a.measurementType=this.get("measurementType");_2a.analysisLayer=_6.toJson(_24.constructAnalysisInputLyrObj(this.analysisLayer));if(this._searchCutoffInput.get("value")===true){_2a.searchCutoff=this.get("searchCutoff");if(this.get("measurementType")==="DrivingTIme"){_2a.searchCutoffUnits="Minutes";}else{_2a.searchCutoffUnits=this.get("searchCutoffUnits");}}else{_2a.searchCutoff=null;}if(this._limitSearchRangeCheck.get("value")===true){_2a.maxCount=this.get("maxCount");}else{_2a.maxCount=null;}if(this._trafficTimeWidget.get("checked")){_2a.TimeOfDay=this._trafficTimeWidget.get("timeOfDay");}_2a.OutputName=_6.toJson({serviceProperties:{name:this._outputLayerInput.get("value")}});if(this.showChooseExtent){if(this._useExtentCheck.get("checked")){_2a.context=_6.toJson({extent:this.map.extent});}}this.getCreditsEstimate(this.toolName,_2a).then(_3.hitch(this,function(_2d){this._usageForm.set("content",_2d);this._usageDialog.show();}));},_handleSaveBtnClick:function(){if(!this._form.validate()){return;}this._saveBtn.set("disabled",true);var _2e={},_2f={},_30;_30=this.nearLayers[this._layersSelect.get("value")];_2e.nearLayer=_6.toJson(_24.constructAnalysisInputLyrObj(_30));_2e.measurementType=this.get("measurementType");_2e.analysisLayer=_6.toJson(_24.constructAnalysisInputLyrObj(this.analysisLayer));if(this._limitSearchRangeCheck.get("checked")){_2e.searchCutoff=this.get("searchCutoff");if(this.get("measurementType")!=="DrivingTime"){_2e.searchCutoffUnits=this.get("searchCutoffUnits");}}else{_2e.searchCutoff=null;}if(this._findNearestCheck.get("checked")){_2e.maxCount=this.get("maxCount");}else{_2e.maxCount=null;}if(this._trafficTimeWidget.get("checked")){_2e.TimeOfDay=this._trafficTimeWidget.get("timeOfDay");}_2e.OutputName=_6.toJson({serviceProperties:{name:this._outputLayerInput.get("value")}});if(this.showChooseExtent){if(this._useExtentCheck.get("checked")){_2e.context=_6.toJson({extent:this.map.extent});}}_2f.jobParams=_2e;this._saveBtn.set("disabled",false);_2f.itemParams={"description":_a.substitute(this.i18n.itemDescription,{sumNearbyLayerName:this.analysisLayer.name,summaryLayerName:_30.name}),"tags":_a.substitute(this.i18n.itemTags,{sumNearbyLayerName:this.analysisLayer.name,summaryLayerName:_30.name}),"snippet":this.i18n.itemSnippet};if(this.showSelectFolder){_2f.itemParams.folder=this._webMapFolderSelect.item?this.folderStore.getValue(this._webMapFolderSelect.item,"id"):"";}console.log(_2f);this.execute(_2f);},_handleLayerChange:function(_31){var _32=this.nearLayers[_31];this.outputLayerName=_a.substitute(this.i18n.outputLayerName,{layer:_32.name,sumNearbyLayerName:this.analysisLayer.name});this._outputLayerInput.set("value",this.outputLayerName);},_handleLimitSearchCheckChange:function(_33){if(this.get("measurementType")==="DrivingTime"){this._hoursInput.set("disabled",!_33);this._minutesInput.set("disabled",!_33);this._secondsInput.set("disabled",!_33);}else{this._distanceUnitsSelect.set("disabled",!_33);this._searchCutoffInput.set("disabled",!_33);}},_handleFindNearestCheckChange:function(_34){this._maxCountInput.set("disabled",!_34);},_handleTimeUnitsChange:function(_35){},_handleDistUnitsChange:function(_36){this.set("outputLayerName");},_handleDistanceTypeChange:function(_37){this.set("measurementType",_37);_f.remove(this._straightLine,"selected");_f.remove(this._drivingTime,"selected");_f.remove(this._drivingDistance,"selected");if(_37){_f.add((_37==="time")?this._drivingTime:((_37==="distance")?this._drivingDistance:this._straightLine),"selected");_b.set(this._useTrafficRow,"display",_37==="time"?"":"none");_b.set(this._distanceLimitRow,"display",_37==="time"?"none":"");_b.set(this._timeLimitRow,"display",_37==="time"?"":"none");_b.set(this._useTrafficLabelRow,"display",_37==="time"?"":"none");this._trafficTimeWidget.set("disabled",_37!=="time");this._trafficTimeWidget.set("reset",_37!=="time");_c.set(this._outputNumberLabel,"innerHTML",_37==="time"?this.i18n.fiveLabel:this.i18n.fourLabel);}if(_37==="time"){this._distanceUnitsSelect.removeOption(this._distanceUnitsSelect.getOptions());this._distanceUnitsSelect.addOption([{value:"Seconds",label:this.i18n.seconds},{value:"Minutes",label:this.i18n.minutes,selected:"selected"},{value:"Hours",label:this.i18n.hours}]);}else{this._distanceUnitsSelect.removeOption(this._distanceUnitsSelect.getOptions());this._distanceUnitsSelect.addOption([{value:"Miles",label:this.i18n.miles},{value:"Yards",label:this.i18n.yards},{value:"Feet",label:this.i18n.feet},{type:"separator"},{value:"Kilometers",label:this.i18n.kilometers},{value:"Meters",label:this.i18n.meters}]);if(_37==="line"){this._distanceUnitsSelect.addOption([{type:"separator"},{value:"NauticalMiles",label:this.i18n.nautMiles}]);}}this.set("outputLayerName");},_save:function(){},_buildUI:function(){_24.initHelpLinks(this.domNode,this.showHelp);if(this.analysisLayer){_c.set(this._aggregateToolDescription,"innerHTML",_a.substitute(this.i18n.summarizeDefine,{sumNearbyLayerName:this.analysisLayer.name}));_c.set(this._forLocationLabel,"innerHTML",_a.substitute(this.i18n.forEachLocationLabel,{sumNearbyLayerName:this.analysisLayer.name}));if(this.analysisLayer.geometryType!=="esriGeometryPoint"){this._isDrivingSelectionEnabled=false;_f.add(this._drivingTime,"disabled");_f.add(this._drivingDistance,"disabled");_f.remove(this._drivingDistanceLabel,"esriSelectLabel");_f.remove(this._drivingTimeLabel,"esriSelectLabel");}}this._loadConnections();this._handleDistanceTypeChange("line");if(this.searchCutoffUnits){this._distanceUnitsSelect.set("value",this.searchCutOffUnits);}if(this.nearLayers){_4.forEach(this.nearLayers,function(_38,_39){if(_38!==this.analysisLayer){this._layersSelect.addOption({value:_39,label:_38.name});if(!this.outputLayerName){this.outputLayerName=_a.substitute(this.i18n.outputLayerName,{layer:_38.name,sumNearbyLayerName:this.analysisLayer.name});this.outputLinesLayerName=_a.substitute(this.i18n.outputConnectingLayerName,{layer:_38.name,sumNearbyLayerName:this.analysisLayer.name});}}},this);}if(this.outputLayerName){this._outputLayerInput.set("value",this.outputLayerName);}if(this.nearLayer){this._layersSelect.set();}_b.set(this._chooseFolderRow,"display",this.showSelectFolder===true?"block":"none");if(this.showSelectFolder){this.getFolderStore().then(_3.hitch(this,function(_3a){this.folderStore=_3a;this._webMapFolderSelect.set("store",_3a);this._webMapFolderSelect.set("value",this.portalUser.username);}));}_b.set(this._chooseExtentDiv,"display",this.showChooseExtent===true?"block":"none");},_loadConnections:function(){this._connect(this,"onExecute",_3.hitch(this,"_onClose",false));this._connect(this._closeBtn,"onclick",_3.hitch(this,"_onClose",false));if(this._isDrivingSelectionEnabled){_5.connect(this._drivingDistance,"onclick",_3.hitch(this,"_handleDistanceTypeChange","distance"));_5.connect(this._drivingTime,"onclick",_3.hitch(this,"_handleDistanceTypeChange","time"));_5.connect(this._straightLine,"onclick",_3.hitch(this,"_handleDistanceTypeChange","line"));}},_setAnalysisGpServerAttr:function(url){this.analysisGpServer=url;this.set("toolServiceUrl",this.analysisGpServer+"/"+this.toolName);},_setAnalysisLayerAttr:function(_3b){this.analysisLayer=_3b;},_getAnalysisLayerAttr:function(_3c){return this.analysisLayer;},_setNearLayersAttr:function(_3d){this.nearLayers=_3d;},_setLayersAttr:function(_3e){this.nearLayers=[];},_setDisableRunAnalysisAttr:function(_3f){this._saveBtn.set("disabled",_3f);},_setShowSelectFolderAttr:function(_40){this.showSelectFolder=_40;},_getShowSelectFolderAttr:function(){return this.showSelectFolder;},_setShowChooseExtentAttr:function(_41){this.showChooseExtent=_41;},_getShowChooseExtentAttr:function(){return this.showChooseExtent;},_setMapAttr:function(map){this.map=map;},_getMapAttr:function(){return this.map;},_setShowHelpAttr:function(_42){this.showHelp=_42;},_getShowHelpAttr:function(){return this.showHelp;},_setSearchCutoffUnitsAttr:function(_43){this.searchCutoffUnits=_43;},_getSearchCutoffUnitsAttr:function(){this.searchCutoffUnits=this._distanceUnitsSelect.get("value");return this.searchCutoffUnits;},_setMeasurementTypeAttr:function(_44){if(_44==="line"){this.measurementType="StraightLine";}else{if(_44==="distance"){this.measurementType="DrivingDistance";}else{if(_44==="time"){this.measurementType="DrivingTime";}}}},_getMeasurementTypeAttr:function(){return this.measurementType;},_getSearchCutoffAttr:function(){if(this.measurementType&&this.measurementType==="DrivingTime"){if(this._timeObj){this.searchCutoff=this._timeObj.hours*60+this._timeObj.minutes+(this._timeObj.seconds/60);}}else{this.searchCutoff=this._searchCutoffInput.get("value");}return this.searchCutoff;},_setSearchCutoffAttr:function(_45){if(_45){this.searchCutoff=_45;}},_getMaxCountAttr:function(){this.maxCount=this._maxCountInput.get("value");return this.maxCount;},_setMaxCountAttr:function(_46){this.maxCount=_46;},_setShowCreditsAttr:function(_47){this.showCredits=_47;},_getShowCreditsAttr:function(){return this.showCredits;},validateServiceName:function(_48,_49){var _4a=/(:|&|<|>|%|#|\?|\\|\"|\/|\+)/.test(_49);if(_49.length===0||((_a.trim(_49)).length===0)){this._outputLayerInput.set("invalidMessage",this.i18n.requiredValue);return false;}if(_4a){this._outputLayerInput.set("invalidMessage",this.i18n.invalidServiceName);return false;}if(_49.length>98){this._outputLayerInput.set("invalidMessage",this.i18n.invalidServiceNameLength);return false;}return true;},validateTime:function(_4b,_4c){var _4d=true,v;v=parseInt(_4c,10);if(_4b==="hours"){this._timeObj.hours=v;}else{if(_4b==="minutes"){this._timeObj.minutes=v;}else{if(_4b==="seconds"){this._timeObj.seconds=v;}}}if(this._timeObj.hours===0&&this._timeObj.minutes===0&&this._timeObj.seconds===0){_4d=false;}return _4d;},_connect:function(_4e,evt,_4f){this._pbConnects.push(_5.connect(_4e,evt,_4f));},onSave:function(){},onClose:function(){}});if(_7("extend-esri")){_3.setObject("dijit.analysis.FindNearest",_27,_21);}return _27;});