// COPYRIGHT © 201 Esri
//
// All rights reserved under the copyright laws of the United States
// and applicable international laws, treaties, and conventions.
//
// This material is licensed for use under the Esri Master License
// Agreement (MLA), and is bound by the terms of that agreement.
// You may redistribute and use this code without modification,
// provided you adhere to the terms of the MLA and include this
// copyright notice.
//
// See use restrictions at http://www.esri.com/legal/pdfs/mla_e204_e300/english
//
// For additional information, contact:
// Environmental Systems Research Institute, Inc.
// Attn: Contracts and Legal Services Department
// 380 New York Street
// Redlands, California, USA 92373
// USA
//
// email: contracts@esri.com
//
// See http://js.arcgis.com/3.34/esri/copyright.txt for details.

define(["require","dojo/_base/declare","dojo/_base/lang","dojo/_base/array","dojo/_base/connect","dojo/_base/json","dojo/_base/Deferred","dojo/has","dojo/json","dojo/string","dojo/dom-style","dojo/dom-attr","dojo/dom-construct","dojo/query","dojo/dom-class","dojo/NodeList","dojo/NodeList-dom","dojo/on","dojo/Deferred","dojo/promise/all","dojo/Evented","dijit/_WidgetBase","dijit/_TemplatedMixin","dijit/_WidgetsInTemplateMixin","dijit/_OnDijitClickMixin","dijit/_FocusMixin","dijit/registry","dijit/form/Button","dijit/form/CheckBox","dijit/form/ValidationTextBox","dijit/form/Form","dijit/layout/ContentPane","./_Widget","./_AnalysisOptions","./utils","./GPWidgetViewModel","./customgp/editorManager","./customgp/resultRendererManager","./customgp/common/dijit/Message","../../kernel","../../lang","../../tasks/Geoprocessor","../../tasks/GPMessage","../../tasks/JobInfo","../../layers/ImageParameters","../../graphicsUtils","../../deferredUtils","../../request","dojo/i18n!../../nls/jsapi","dojo/i18n!./customgp/common/nls/main","dojo/i18n!./customgp/nls/strings","dojo/text!./templates/GPWidget.html"],(function(e,t,s,i,a,r,n,o,l,h,u,d,c,m,p,f,N,g,_,y,v,b,M,L,w,j,P,I,T,S,R,E,x,C,A,F,G,D,U,O,k,W,B,H,J,q,Y,V,z,K,Q,X){var Z=x.createSubclass([M,L,w,j,v,C],{declaredClass:"esri.dijit.analysis.GPWidget",templateString:X,widgetsInTemplate:!0,viewModelType:F,showChooseExtent:!0,i18n:null,toolName:"GPWidget",helpFileName:"GPWidget",_resultLayerGPTypes:["GPFeatureRecordSetLayer","GPRecordSet"],constructor:function(e){e.containerNode&&(this.container=e.containerNode),this.drawTools=[]},destroy:function(){this._clearLastInput(),this._clearLastResult(),this._clearMessageInterval(),this.inherited(arguments)},_onClose:function(e){e&&this.emit("save",{save:!0}),e||(this._clearLastInput(),this._clearLastResult(),this._clearMessageInterval()),this.emit("close",s.mixin({save:e},{isWebTool:!0,addToMap:this.resultLayerNames.length>0}))},postMixInProperties:function(){this.inherited(arguments),this.i18n={},s.mixin(this.i18n,z.common),s.mixin(this.i18n,z.analysisTools),s.mixin(this.i18n,z.analysisMsgCodes),s.mixin(this.i18n,z.analysisSettings),s.mixin(this.i18n,z.aggregatePointsTool),s.mixin(this.i18n,K.common),s.mixin(this.i18n,K.units),s.mixin(this.i18n,Q),this._initModelWatchers()},postCreate:function(){this.inherited(arguments),this._loadConnections(),u.set(this._chooseExtentDiv,"display",!0===this.showChooseExtent?"inline-block":"none"),u.set(this._showCreditsLink,"display",!0===this.showCredits?"block":"none"),u.set(this._cancelBtn.domNode,"display","none"),this.renderUI(),this.resultLayerNames=[]},_loadConnections:function(){a.connect(this._closeBtn,"onclick",s.hitch(this,this._onClose,!1)),this.own(this.on("start",s.hitch(this,(function(){this._onClose(!0)}))))},startup:function(){},renderUI:function(){G.setMap(this.viewModel.map),G.setNls(this.i18n),D.setMap(this.viewModel.map),D.setNls(this.i18n),this.viewModel.title&&this._updateTitle(),this.viewModel.inputParams&&this._createInputNodes(),this.viewModel.outputParams&&this._createResultNameNodes(),this.viewModel.taskUrl&&this._setUpGP(),this.viewModel.helpUrl&&this._updateHelpUrl(),this.viewModel.map&&this._updateMap()},_initModelWatchers:function(){this.own(this.viewModel.watch("title",s.hitch(this,this._updateTitle)),this.viewModel.watch("inputParams",s.hitch(this,this._createInputNodes)),this.viewModel.watch("outputParams",s.hitch(this,this._createResultNameNodes)),this.viewModel.watch("taskUrl",s.hitch(this,this._setUpGP)),this.viewModel.watch("helpUrl",s.hitch(this,this._updateHelpUrl)),this.viewModel.watch("helpUrl",s.hitch(this,this._updateMap)))},_setUpGP:function(){this.gp=new W(this.viewModel.taskUrl),this.gp.setOutSpatialReference(this.viewModel.map.spatialReference),this.own(g(this.gp,"execute-complete",s.hitch(this,this.onExecuteComplete))),this.own(g(this.gp,"job-complete",s.hitch(this,this.onJobComplete))),this.own(g(this.gp,"job-cancel",s.hitch(this,this.onJobCancel))),this.own(g(this.gp,"status-update",s.hitch(this,this.onStatusUpdate))),this.own(g(this.gp,"get-result-data-complete",s.hitch(this,this.onGetResultDataComplate))),this.own(g(this.gp,"get-result-image-layer-complete",s.hitch(this,this.onGetResultImageLayerComplete))),this.own(g(this.gp,"error",s.hitch(this,this.onError)))},_createInputNodes:function(){this.inputNodes&&this.inputNodes.length>0&&i.forEach(this.inputNodes,(function(e,t){c.destroy(e)}),this),this.inputNodes=[],this.drawnLayers=[],this.hasESRIFSOutput=this.viewModel.inputParams.some((function(e){return"esri_out_feature_service_name"===e.name})),i.forEach(this.viewModel.inputParams,(function(e,t){this._createInputNode(e,t)}),this),this._createInputFieldNodes()},_createInputNode:function(e,t){var i=c.create("div",{class:"esriAnalysisPadding1"},this.inputSectionNode),a=c.create("div",{class:"esriAnalysisStepsLabel",title:e.tooltip||e.label||""},i);c.create("span",{class:"esriTrailingMargin025 esriAnalysisNumberLabel",innerHTML:t+1+""},a),c.create("span",{class:"",innerHTML:e.label},a),e.required&&c.create("span",{class:"label-star",innerHTML:"*"},a);var r=c.create("div",{class:"esriLeadingMargin1"},i),n=G.createEditor(e,"input","widget",{uid:this.id,config:this.viewModel,widget:this});return n.placeAt(r),"SelectFeatureSetFromLayer"===n.editorName&&this.drawTools.push(n),i.param=e,i.inputEditor=n,"GPFeatureRecordSetLayer"===e.dataType&&i.inputEditor.on("analysislayer-change",s.hitch(this,this._handleInputLayerChange,i)),"esri_out_feature_service_name"===e.name&&(this.featureServiceInpututNode=i,this.own(i.inputEditor.gEditor.on("change",s.hitch(this,this._handleFSNameChange)))),this.inputNodes.push(i),!1===e.visible&&u.set(i,"display","none"),i},_createInputFieldNodes:function(){this.inputNodes&&0!==this.inputNodes.length&&(this.inputFieldNodes=this.inputNodes.filter((function(e){return!!e&&!!e.param&&"Field"===e.param.dataType&&e.param.dependency}),this),this.inputFieldNodes&&this.inputFieldNodes.length>0&&this.inputFieldNodes.forEach((function(e){e.inputEditor.set("dependencyParam",this._getInputFieldDepNode(e.param.dependency))}),this))},_getInputFieldDepNode:function(e){return this.inputNodes.filter((function(t){if(t.param.name===e)return t}))[0].param},_createResultNameNodes:function(){this.resultNameNodes&&this.resultNameNodes.length>0&&i.forEach(this.resultNameNodes,(function(e,t){c.destroy(e)}),this),this.resultLayerParams=[],this.resultNameNodes=[];var e=[],t=[];i.forEach(this.viewModel.outputParams,(function(e,t){-1!==this._resultLayerGPTypes.indexOf(e.dataType)&&this.resultLayerParams.push(e)}),this),this.resultLayerParams.length>0&&(e=this.resultLayerParams.filter((function(e){return"GPFeatureRecordSetLayer"===e.dataType})),t=e.map((function(e){return e.name})));var s=null;i.forEach(this.resultLayerParams,(function(e,i){t.length<2||t.length>2&&-1===t.indexOf(e.name)?this._createResultNameNode(e,this.inputNodes.length+i):(k.isDefined(s)||(s=i,this._createResultLabel({label:this.i18n.outputFClass},this.inputNodes.length+i)),this._createResultNameNode(e,this.inputNodes.length+s,{addStep:!1}))}),this)},_createResultLabel:function(e,t,s,i){s||(s=c.create("div",{class:"esriAnalysisPadding1"},this.inputSectionNode));var a=c.create("div",{class:i&&!i.addStep?"":"esriAnalysisStepsLabel",title:e.tooltip||e.label||""},s);(!i||i&&i.addStep)&&c.create("span",{class:"esriTrailingMargin025 esriAnalysisNumberLabel",innerHTML:t+1+""},a),c.create("span",{class:i&&!i.addStep?"esriLeadingMargin1":"",innerHTML:e.label},a),e.required&&!this.hasESRIFSOutput&&c.create("span",{class:"label-star",innerHTML:"*"},a)},_createResultNameNode:function(e,t,i){if(!i||!i.node)var a=c.create("div",{class:"esriAnalysisPadding1"},this.inputSectionNode);this._createResultLabel(e,t,a,i);var r=c.create("div",{class:(i&&i.addStep,"esriLeadingMargin1")},a),n=new S({class:"one-width"});return n.placeAt(r),this.hasESRIFSOutput||n.set("value",e.name),!1===e.visible&&u.set(a,"display","none"),a.param=e,a.resultNameNode=n,a.resultNameNode.on("change",s.hitch(this,this._handleResultNameNodeChange)),this.resultNameNodes.push(a),a},_handleFSNameChange:function(e){var t=e.length>0;this.resultNameNodes.forEach((function(e){e.param&&"GPFeatureRecordSetLayer"===e.param.dataType&&e.resultNameNode&&(e.resultNameNode.set("disabled",t),e.resultNameNode.set("required",t),m(".esriAnalysisStepsLabel",e).forEach((function(e){p.toggle(e,"esriAnalysisTextDisabled",t)}),this))}),this)},_handleResultNameNodeChange:function(e){var t=this.resultNameNodes.some((function(e){return e.resultNameNode.get("value").length>0}));this.featureServiceInpututNode&&(this.featureServiceInpututNode.inputEditor.gEditor.set("disabled",t),m(".esriAnalysisStepsLabel",this.featureServiceInpututNode).forEach((function(e){p.toggle(e,"esriAnalysisTextDisabled",t)}),this))},validateOutputNames:function(){if(!(this.resultNameNodes&&0!==this.resultNameNodes.length||this.featureServiceInpututNode))return!0;var e=this.resultNameNodes.some((function(e){return e.resultNameNode.get("value").length>0}));return(e=e||this.featureServiceInpututNode&&this.featureServiceInpututNode.inputEditor.gEditor.get("value").length>0)||this._showMessage(this.i18n.outputnameMissingMsg,"error"),e},_handleCancelBtnClick:function(){this._cancelBtn.set("disabled",!0),this.cancel(this.jobInfo)},_handleSaveBtnClick:function(){this._form.validate()&&this.validateOutputNames()&&(this.set("disableRunAnalysis",!0),this._clearLastResult(),this._getInputParamValues().then(s.hitch(this,(function(e){this.jobParams=e,this.resultLayerNames=[],this.resultNameNodes&&this.resultNameNodes.length>0&&i.forEach(this.resultNameNodes,(function(t,s){(t.param&&"GPFeatureRecordSetLayer"===t.param.dataType||"GPFeatureRecordSetLayer"!==t.param.dataType&&e.esri_out_feature_service_name&&t.resultNameNode)&&this.resultLayerNames.push(t.resultNameNode.get("value"))}),this),this.showChooseExtent&&this._useExtentCheck.get("checked")&&(e.context=r.toJson({extent:this.map.extent._normalize(!0)})),this.resultLayerNames.length>0&&(e.resultName=e.esri_out_feature_service_name?e.esri_out_feature_service_name:this.resultLayerNames[0],e.returnFeatureCollection=!(this.viewModel.serverInfo.resultMapServerName||e.esri_out_feature_service_name)),e.esri_out_feature_service_name&&e.esri_out_feature_service_name.length>0?this.viewModel.checkServiceNameAvailable(e.esri_out_feature_service_name).then(s.hitch(this,(function(t){t.available?this._submitJob(e):(this._showMessage(this.i18n.servNameExists,"error"),this.set("disableRunAnalysis",!1))})),s.hitch(this,(function(e){console.log(e),this.set("disableRunAnalysis",!1)}))):this._submitJob(e)})),s.hitch(this,(function(e){this._showMessage(e,"error"),this.set("disableRunAnalysis",!1)}))))},_submitJob:function(e){this.emit("start",s.mixin({},e,{isWebTool:!0,addToMap:this.resultLayerNames.length>0})),this.viewModel.serverInfo.isSynchronous||"esriExecutionTypeAsynchronous"!==this.viewModel.taskInfo.executionType?this.gp.execute(e):this.gp.submitJob(e),this.emit("job-submit",s.mixin({},e,{isWebTool:!0,addToMap:this.resultLayerNames.length>0}))},_getInputParamValues:function(){var e,t=new _,a={},r=[],n="";return i.forEach(this.inputNodes,(function(t){(e=t.inputEditor.getGPValue()).param=t.param,r.push(e)}),this),y(r).then(s.hitch(this,(function(e){for(var s=0;s<e.length;s++)!r[s].param.required||null!==e[s]&&void 0!==e[s]?a[r[s].param.name]=e[s]:(n=r[s].param.label+" "+this.i18n.requiredInfo,t.reject(n));t.resolve(a)})),(function(e){t.reject(e)})),t},_createOutputNodes:function(e){var t=[];if(this.resultNodes=[],this.resultLayers=[],i.forEach(this.viewModel.outputParams,(function(s,i){t.push(this._createOutputNode(s,e[i]))}),this),i.some(t,(function(e){return null!==e}))){var a=[];if(i.forEach(e,s.hitch(this,(function(e){if("GPFeatureRecordSetLayer"===e.dataType){var t=e.value&&e.value.features;t&&t.length>0&&(a=a.concat(t))}}))),a.length>0)try{var r=q.graphicsExtent(a);r&&this.viewModel.map.setExtent(r.expand(1.4))}catch(e){console.error(e)}}},_createOutputNode:function(e,t){var s;if(e.visible){try{s=D.createResultRenderer(e,t,{uid:this.id,config:this.viewModel})}catch(e){console.error(e),s=D.createResultRenderer("error",t,{uid:this.id,config:this.viewModel})}var i=c.create("div",{class:"output-node"},this.outputSectionNode);this.resultNodes.push(i);var a=c.create("div",{class:"output-label",title:e.tooltip||e.label||"",innerHTML:e.label},i);i.param=e,i.labelNode=a;var r=c.create("div",{class:"renderer-container"},i);return s.placeAt(r),s.startup(),i.resultRenderer=s,i}return null},_updateTitle:function(){d.set(this._titleLbl,"innerHTML",this.viewModel.title)},_showMessage:function(e,t){p.toggle(this.infoTextNode,"esriFormWarning esriRoundedBox",t&&"error"===t),this.infoTextNode.innerHTML=e,u.set(this._msgCloseIcon,"display",e&&e.length>0?"block":"none")},_handleCloseMsg:function(){this._showMessage("")},_handleInputLayerChange:function(e,t){var s=[];this.inputFieldNodes&&this.inputFieldNodes.length>0&&(s=this.inputFieldNodes.filter((function(t){return t.param.dependency===e.param.name}),this)).length>0&&s.forEach((function(e){e.inputEditor.set("analysisLayer",t.analysisLayer)}),this)},_setDisableRunAnalysisAttr:function(e){this._saveBtn.set("disabled",e),this._saveBtn.set("iconClass",e?"esriLoading":""),u.set(this._cancelBtn.domNode,"display",e?"block":"none")},_getDrawLayerAttr:function(){return this.drawLayer},_setDrawLayerAttr:function(e){this.drawLayer||(this.drawLayer=[]),this.drawLayer.push(e)},_setDrawnLayerNameAttr:function(e){this.drawnLayerName=e},_setDrawPointLayerNameAttr:function(e){this.drawPointLayerName=e},_setDrawLineLayerNameAttr:function(e){this.drawLineLayerName=e},_setDrawPolyLayerNameAttr:function(e){this.drawPolyLayerName=e},_getDrawnLayerNameAttr:function(e){return this.drawnLayerName},clear:function(){i.forEach(this.drawTools,(function(e){e.clear()}))},onExecuteComplete:function(e){var t;this.set("disableRunAnalysis",!1),e.messages&&e.messages.length>0&&(t=i.filter(e.messages,(function(e){return e.type===B.TYPE_WARNING||e.type===B.TYPE_ERROR}))).length>0&&this._createErrorMessages(t),this._createOutputNodes(e.results)},onJobComplete:function(e){var t;if((this.set("disableRunAnalysis",!1),-1===[H.STATUS_CANCELLED,H.STATUS_CANCELLING].indexOf(e.jobInfo.jobStatus))&&(this._clearMessageInterval(),e.jobParams=this.jobParams,this.resultLayerNames&&this.resultLayerNames.length>0&&(e.jobParams.resultName=this.resultLayerNames[0]),!(e.jobInfo.messages&&e.jobInfo.messages.length>0&&(t=i.filter(e.jobInfo.messages,(function(e){return e.type===B.TYPE_WARNING||e.type===B.TYPE_ERROR}))).length>0&&(this._createErrorMessages(t,e),e.jobInfo.jobStatus!==H.STATUS_SUCCEEDED))))if(this.emit("job-success",s.mixin({},e,{isWebTool:!0,addToMap:this.resultLayerNames.length>0})),this.viewModel.useResultMapServer){var a=this.viewModel.taskUrl.replace("GPServer","MapServer");a=a.substring(0,a.lastIndexOf("/")),a+="/jobs/"+e.jobInfo.jobId;var r=i.filter(this.resultNameNodes,(function(t,s){return t.param&&t.param.name===e.jobParams.resultName}),this),n=r.length>0&&r[0].resultNameNode?r[0].resultNameNode.get("value"):e.jobParams.resultName;this.emit("job-result",{value:{url:a,type:"ArcGISDynamicMapServiceLayer"},outputLayerName:n,isWebTool:!0,addToMap:!0});i.some(this.viewModel.outputParams,(function(e){if("MapServiceLayer"===e.dataType)return e.layerNames,!0})),i.forEach(this.viewModel.outputParams,(function(t){t.visible&&"GPFeatureRecordSetLayer"!==t.dataType&&"GPRasterDataLayer"!==t.dataType&&"GPRecordSet"!==t.dataType&&this.gp.getResultData(e.jobInfo.jobId,t.name)}),this)}else i.forEach(this.viewModel.outputParams,(function(t){t.visible&&("GPFeatureRecordSetLayer"!==t.dataType||!this.viewModel.serverInfo||this.viewModel.serverInfo.resultMapServerName||this.jobParams.esri_out_feature_service_name?this.gp.getResultData(e.jobInfo.jobId,t.name):this._getCustomResultData(e.jobInfo.jobId,t.name,{returnFeatureCollection:!0}))}),this)},_getCustomResultData:function(e,t,i,a,r){var o=this.gp._getResultDataHandler,l=this.gp._errorHandler,h=new n(Y._dfdCanceller);return h._pendingDfd=V({url:this.gp._url.path+"/jobs/"+e+"/results/"+t,content:s.mixin({},this.gp._url.query,{f:"json",returnType:"data"},i),callbackParamName:"callback",load:function(e,t){o(e,t,a,r,h)},error:function(e){l(e,r,h)}}),h},cancel:function(e){this.gp.cancelJob(e.jobId)},onJobCancel:function(e){this._showMessage(this.i18n.BD_101031,"error"),this._clearMessageInterval(),this.resultLayerNames&&this.resultLayerNames.length>0&&(e.resultName=this.resultLayerNames[0]),this._cancelBtn.set("disabled",!1),this.emit("job-cancel",s.mixin({},e,{isWebTool:!0,addToMap:this.resultLayerNames.length>0}))},onStatusUpdate:function(e){this.jobId=e.jobInfo.jobId,s.mixin(e,e.jobInfo),e.jobInfo.jobStatus===H.STATUS_SUCCEEDED&&(this.set("disableRunAnalysis",!1),this._clearMessageInterval()),!this.messageInterval&&this.jobId&&this._setupMessageInterval(),e.jobParams=this.jobParams,this.resultLayerNames&&this.resultLayerNames.length>0&&(e.jobParams.resultName=this.resultLayerNames[0]),this.jobInfo=e,this.emit("job-status",s.mixin({},e,{isWebTool:!0,addToMap:this.resultLayerNames.length>0}))},onGetResultDataComplate:function(e){e.result&&("GPFeatureRecordSetLayer"!==e.result.dataType&&0===this.resultLayerNames.length||"GPFeatureRecordSetLayer"===e.result.dataType&&this.shouldAddToMap)&&this._createOutputNode(this._getOutputParamByName(e.result.paramName),e.result);var t=i.filter(this.resultNameNodes,(function(t,s){return t.param&&t.param.name===e.result.paramName}),this);e.result.outputLayerName=t.length>0&&t[0].resultNameNode?t[0].resultNameNode.get("value")?t[0].resultNameNode.get("value"):this.jobParams.esri_out_feature_service_name:e.result.paramName,this.emit("job-result",s.mixin({},e.result,{param:this._getOutputParamByName(e.result.paramName),isWebTool:!0,addToMap:this.resultLayerNames.length>0}))},onGetResultImageLayerComplete:function(e){var t=e.layer;if(t){var s=t.url.substring(t.url.lastIndexOf("/")+1),i={name:s,title:s,tooltip:s,dataType:"result map service",visible:!0};t._wab_type="ArcGISDynamicMapServiceLayer";var a=this._getResultMapServiceParam();a&&(i.label=a.label,i.tooltip=a.tooltip,t.title=a.label),null!==this._createOutputNode(i,t)&&this.resultLayers.push(t)}},onError:function(e){this._showMessage(e.error.message,"error"),this._clearMessageInterval()},_createErrorMessages:function(e,t){var a="",r=0;i.forEach(e,(function(e){e.type!==B.TYPE_WARNING&&e.type!==B.TYPE_ERROR||(e.type===B.TYPE_ERROR&&r++,a+=e.description+"\n")}));var n={message:a};t&&t.jobParams&&t.jobParams.resultName&&s.mixin(n,{jobParams:t.jobParams,resultName:t.jobParams.resultName}),0===r&&a&&(n.type="warning"),n.isWebTool=!0,this.emit("job-fail",n)},_setupMessageInterval:function(){this.messageInterval=setInterval(s.hitch(this,this._updateJobMessage),1e3)},_updateJobMessage:function(){},_clearMessageInterval:function(){this.jobId="",this.messageInterval&&(clearInterval(this.messageInterval),this.messageInterval=null)},_getResultMapServiceParam:function(){var e;return i.some(this.viewModel.outputParams,(function(t){if("MapServiceLayer"===t.dataType)return e=t,!0})),e},_getOutputParamByName:function(e){for(var t=0;t<this.viewModel.outputParams.length;t++)if(this.viewModel.outputParams[t].name===e)return this.viewModel.outputParams[t]},_clearLastInput:function(){i.forEach(this.inputNodes,(function(e){e.inputEditor.clear&&s.isFunction(e.inputEditor.clear)&&e.inputEditor.clear()}),this)},_clearLastResult:function(){c.empty(this.infoTextNode),i.forEach(this.resultNodes,(function(e){c.destroy(e.labelNode),e.resultRenderer&&e.resultRenderer.destroy(),c.destroy(e)})),i.forEach(this.resultLayers,(function(e){null!==e&&this.viewModel.map.removeLayer(e)}),this),this.resultNodes=[],this.resultLayers=[]},_showLoading:function(){},_hideLoading:function(){},_updateHelpUrl:function(){A.initHelpLinks(this.domNode,!0,{isSingleTenant:!0,helpUrl:this.viewModel.helpUrl,showHelpFromUrl:!0})},_updateMap:function(){this.viewModel.map&&this.set("map",this.viewModel.map)}});return o("extend-esri")&&s.setObject("dijit.analysis.GPWidget",Z,O),Z}));