text: /*
   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/EnrichVariables.html":'\ufeff\x3cdiv data-dojo-type\x3d"dijit/layout/ContentPane" data-dojo-attach-point\x3d"_topPane" data-dojo-props\x3d"row: 0" style\x3d"padding-bottom: 0;"\x3e\n    \x3cdiv class\x3d"EnrichOptionsPage_Stacking EnrichOptionsPage_TrimWithEllipsis"\x3e\n        ${nls.selectedVariables}\n        \x3cspan data-dojo-attach-point\x3d"dataCollectionNames"\x3e\x3c/span\x3e\n    \x3c/div\x3e\n    \x3cdiv data-dojo-attach-point\x3d"bufferDiv" class\x3d"EnrichOptionsPage_Stacking"\x3e\n        ${nls.bufferOptions}\n        \x3cspan data-dojo-attach-point\x3d"bufferString"\x3e\x3c/span\x3e\n        \x3cspan data-dojo-attach-point\x3d"bufferEdit"\x3e(\x3cspan class\x3d"Wizard_Link" data-dojo-attach-event\x3d"click: _editBuffer"\x3e${nls.edit}\x3c/span\x3e)\x3c/span\x3e\n    \x3c/div\x3e\n    \x3cdiv data-dojo-attach-point\x3d"bufferEditDiv" class\x3d"Wizard_AltRow EnrichOptionsPage_Stacking" style\x3d"display: none;"\x3e\x3c/div\x3e\n    \x3cdiv data-dojo-attach-point\x3d"totalVars" class\x3d"EnrichOptionsPage_Stacking"\x3e\x26nbsp;\x3c/div\x3e\n\x3c/div\x3e\n\x3cdiv data-dojo-type\x3d"dijit/layout/ContentPane" data-dojo-attach-point\x3d"fieldsPane" data-dojo-props\x3d"row: 1" style\x3d"position:relative;width:100%;height:100%;padding-top: 0; padding-bottom: 0;"\x3e\n    \x3cdiv data-dojo-attach-point\x3d"fieldsDiv" class\x3d"EnrichOptionsPage_Fields"\x3e\x3c/div\x3e\n    \x3cdiv data-dojo-attach-point\x3d"progressDiv" class\x3d"Wizard_Progress"\x3e\x3c/div\x3e\n\x3c/div\x3e\n\x3cdiv data-dojo-type\x3d"dijit/layout/ContentPane" data-dojo-attach-point\x3d"_lastPane" data-dojo-props\x3d"row: 2" style\x3d"padding-top: 0;"\x3e\n    \x3cdiv data-dojo-attach-point\x3d"overwriteExisting" class\x3d"EnrichOptionsPage_OverwriteExisting EnrichOptionsPage_Stacking"\x3e${nls.overwriteExisting}\x3c/div\x3e\n    \x3cbutton class\x3d"Wizard_Button" data-dojo-attach-point\x3d"backButton" data-dojo-attach-event\x3d"click: _back"\x3e${nls.back}\x3c/button\x3e\n    \x3cbutton class\x3d"Wizard_Button" data-dojo-attach-point\x3d"finishButton" data-dojo-attach-event\x3d"click: _finish" disabled\x3d"disabled"\x3e${nls.finish}\x3c/button\x3e\n\x3c/div\x3e\n'}});
  define("esri/dijit/analysis/EnrichVariables","esri/declare dojo/_base/lang dojo/dom-construct dojo/dom-class dojo/Stateful dojo/number dojo/string dojo/aspect esri/dijit/analysis/_WizardPage dojo/i18n!esri/nls/jsapi dojo/text!esri/dijit/analysis/templates/EnrichVariables.html esri/tasks/geoenrichment/RingBuffer esri/tasks/geoenrichment/DriveBuffer esri/dijit/geoenrichment/BufferOptions dojox/html/entities esri/dijit/geoenrichment/_Invoke dgrid/OnDemandGrid dgrid/extensions/DijitRegistry dojo/store/Memory dojo/data/ObjectStore dgrid/tree dijit/form/Select dijit/form/CheckBox dojox/mvc/sync esri/dijit/geoenrichment/config esri/request esri/dijit/geoenrichment/lang dijit/layout/ContentPane dijit/form/NumberSpinner dijit/form/RadioButton".split(" "),
  function(g,h,m,s,k,t,n,u,v,e,w,x,y,z,q,A,B,C,D,E,F,G,H,r,p,I,J){e=e.geoenrichment.dijit.EnrichOptionsPage;var K=g([E],{getChildren:function(a){return a.getChildren()},mayHaveChildren:function(a){return!!a.getChildren}});k=g([k],{checked:!0,getLabel:function(){},getClass:function(){return""}});var M=g([k],{_children:null,constructor:function(a,c,b){this.set("id2",a.id);this._children=[];for(var d=0;d<a.variables.length;d++){var f=new L(a.variables[d],b),e=a.id+"."+a.variables[d].id;f.set("id2",e);
  e=c[e];f.set("checked",h.isString(e));e&&f.set("mapTo",e);this._children.push(f)}},_checkedSetter:function(a){this.checked=a;if(this._children)for(a=0;a<this._children.length;a++)this._children[a].set("checked",this.checked)},getLabel:function(){return this.metadata.title?this.metadata.title:this.metadata.name},getChildren:function(){return this._children}}),L=g([k],{mapTo:null,_page:null,constructor:function(a,c){this._page=c},_checkedSetter:function(a){this.checked!=a&&(this.checked=a,this._page.invoke("_updateTotalVars"))},
  _mapToSetter:function(a){this.mapTo!=a&&(this.mapTo=a,this._page.invoke("_updateTotalVars"))},getLabel:function(){return this.alias},getClass:function(){return"EnrichOptionsPage_VariableCheckbox"},getOptions:function(){var a=[];a.push({value:"_",label:q.encode(this._page.allowNewColumns?e.newColumn:e.noColumn)});if(this._page.fields)for(var c=0;c<this._page.fields.length;c++){var b=this._page.fields[c];if(b.type&&b.type!=this.type){var d=!1;"esriFieldTypeInteger"==b.type&&"esriFieldTypeDouble"==this.type&&
  0==this.precision?d=!0:"esriFieldTypeInteger"==this.type&&"esriFieldTypeDouble"==b.type&&(d=!0);if(!d)continue}a.push({value:b.id,label:q.encode(b.label||b.id)})}return a}}),N=g([B,C],{removeRow:function(a,c){var b=dijit.findWidgets(a);if(b)for(var d=0;d<b.length;d++)b[d].destroy();this.inherited(arguments)}});return g("esri.dijit.analysis.EnrichVariables",[v,A],{templateString:w,nls:e,geomType:null,buffer:null,fields:null,allowNewColumns:!0,dataCollections:null,studyAreaCount:null,_bufferOptions:null,
  _fieldSelects:null,_grid:null,_model:null,_eventMap:{back:!1,finish:!1},constructor:function(){this.buffer=new x},resize:function(){this.inherited(arguments);this.fieldsPane.resize()},_setGeomTypeAttr:function(a){this._set("geomType",a);switch(this.geomType){case "esriGeometryPolygon":this.bufferEdit.style.display="none";this.bufferString.innerHTML=e.bufferPolygon;break;case "esriGeometryPoint":this.bufferEdit.style.display="";this.bufferString.innerHTML=e.bufferRing;break;case "esriGeometryPolyline":this.bufferEdit.style.display=
  "",this.bufferString.innerHTML=e.bufferRing,this.driveTimeRadio.set("disabled",!0)}},_setFieldsMapAttr:function(a){var c={},b;for(b in a)c[b.split(".")[0]]=!0;b=[];var d;this._model=[];for(var f=0;f<this.dataCollections.length;f++)c[this.dataCollections[f].id]&&(d=this.dataCollections[f].metadata.title?this.dataCollections[f].metadata.title:this.dataCollections[f].metadata.name?this.dataCollections[f].metadata.name:this.dataCollections[f].id,b.push(d),this._model.push(new M(this.dataCollections[f],
  a,this)));this.dataCollectionNames.innerHTML=b.join(", ");this.dataCollectionNames.title=b.join("\n");a=new D({data:this._model,idProperty:"id2"});a=new K(a);this._grid?this._grid.set("store",a):(c=[F({label:" ",field:"expander",shouldExpand:h.hitch(this,this._shouldExpand)}),{label:"",field:"",sortable:!1,renderCell:h.hitch(this,this._renderCheckBox)}],this.fields&&c.push({label:e.column,field:"column",sortable:!1,renderCell:h.hitch(this,this._renderSelect)}),this._grid=new N({store:a,columns:c},
  this.fieldsDiv),u.after(this._grid,"expand",h.hitch(this,this.invoke,"resize")),this._grid.startup());this.invoke("_updateTotalVars")},_shouldExpand:function(a,c,b){return void 0!==b?b:1==this._model.length},_renderCheckBox:function(a,c,b,d){c=new H;b=a.getLabel();r(a,"checked",c,"checked");d=m.create("label",{"class":"EnrichOptionsPage_TrimWithEllipsis EnrichOptionsPage_CheckboxLabel",title:b});s.add(d,a.getClass());c.placeAt(d);m.create("span",{innerHTML:b},d);return d},_renderSelect:function(a,
  c,b,d){if(a.getOptions)return c=new G({options:a.getOptions(),maxHeight:151}),r(a,"mapTo",c,"value",{converter:{format:function(a){return a||"_"},parse:function(a){return"_"!=a?a:null}}}),c.domNode},_updateTotalVars:function(){function a(a,d){J.isNumber(a)&&(a=n.substitute(e.credits,{credits:t.format(a)}));var f={varCount:b,rowCount:k,credits:a};c.totalVars.innerHTML=n.substitute(g,f);void 0===d&&(d=n.substitute(h,f));c.totalVars.title=d}var c=this,b=0,d=!1;this._enumCheckedVars(function(a,c){b++;
  c.mapTo&&(d=!0)});this.overwriteExisting.style.visibility=d?"visible":"hidden";this.finishButton.disabled=0==b;var f={enrichVariableCount:b,f:"json"};this.get("buffer")instanceof y&&(f.serviceAreaCount=1);var g,h,k;this.studyAreaCount?(g=e.totalVars,h=e.totalVarsTooltip,k=this.studyAreaCount):(g=e.varsPerRow,h=e.varsPerRowTooltip,k=1);p.token&&(f.token=p.token);var l=p.portalUrl;0>l.indexOf("://")&&(l=window.location.protocol+"//"+l);a(e.creditsCalc,"");I({url:l+"/sharing/rest/portals/self/cost",
  content:f}).then(function(b){a(b.transactionCreditCost*k)},function(b){a("error",b.toString())})},_getBufferAttr:function(){return this._bufferOptions?this._bufferOptions.get("buffer"):this.buffer},_setBufferAttr:function(a){this._set("buffer",a);this._bufferOptions&&this._bufferOptions.set("buffer",a)},_editBuffer:function(){m.destroy(this.bufferDiv);this.bufferEditDiv.style.display="";this._bufferOptions=new z({buffer:this.buffer,onChange:h.hitch(this,this.invoke,"_updateTotalVars")});this.buffer=
  void 0;this._bufferOptions.placeAt(this.bufferEditDiv);this.resize()},_getFieldsMapAttr:function(){var a={};this._enumCheckedVars(function(c,b){a[c.id+"."+b.id]=b.mapTo||""});return a},_enumCheckedVars:function(a){for(var c=0;c<this._model.length;c++)for(var b=this._model[c].getChildren(),d=0;d<b.length;d++)b[d].checked&&(this.allowNewColumns||b[d].mapTo)&&a(this._model[c],b[d])},_back:function(){this.onBack()},onBack:function(){},_finish:function(){this.onFinish()},onFinish:function(){}})});