// 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:{"widgets/Draw/setting/_build-generate_module":function(){define(["dojo/text!./Setting.html","dojo/text!./css/style.css","dojo/i18n!./nls/strings"],function(){})},"url:widgets/Draw/setting/Setting.html":'\x3cdiv style\x3d"width:100%;height:auto;"\x3e\r\n  \x3cdiv class\x3d"tip" style\x3d"margin-bottom:10px;"\x3e${nls.defineUnits}\x3c/div\x3e\r\n\t\x3cdiv class\x3d"query-setting-content" data-dojo-attach-point\x3d"content"\x3e\r\n\t\t\x3cdiv class\x3d"location-section" data-dojo-attach-point\x3d"locationTabNode" onselectstart\x3d"return false;"\x3e\r\n\t\t\t\x3cdiv class\x3d"add-with-icon"  data-dojo-attach-point\x3d"btnAddLocation"\x3e\r\n\t\t\t\t\x3cspan class\x3d"jimu-icon jimu-icon-add" data-dojo-attach-point\x3d"btnAddLocationIcon"\x3e\x3c/span\x3e\r\n\t\t\t\t\x3cspan class\x3d"add-label"\x3e${nls.addLocation}\x3c/span\x3e\r\n\t\t\t\x3c/div\x3e\r\n\t\t\t\x3cdiv data-dojo-attach-point\x3d"locationTableDiv"\x3e\x3c/div\x3e\r\n\t\t\x3c/div\x3e\r\n\t\t\x3cdiv class\x3d"distance-section" data-dojo-attach-point\x3d"distanceTabNode" onselectstart\x3d"return false;"\x3e\r\n\t\t\t\x3cdiv class\x3d"add-with-icon"  data-dojo-attach-point\x3d"btnAddDistance"\x3e\r\n\t\t\t\t\x3cspan class\x3d"jimu-icon jimu-icon-add" data-dojo-attach-point\x3d"btnAddDistanceIcon"\x3e\x3c/span\x3e\r\n\t\t\t\t\x3cspan class\x3d"add-label"\x3e${nls.addDistance}\x3c/span\x3e\r\n\t\t\t\x3c/div\x3e\r\n\t\t\t\x3cdiv data-dojo-attach-point\x3d"distanceTableDiv"\x3e\x3c/div\x3e\r\n\t\t\x3c/div\x3e\r\n\t\t\x3cdiv class\x3d"output-section" data-dojo-attach-point\x3d"areaTabNode" onselectstart\x3d"return false;"\x3e\r\n\t\t\t\x3cdiv class\x3d"add-with-icon" data-dojo-attach-point\x3d"btnAddArea"\x3e\r\n\t\t\t\t\x3cspan class\x3d"jimu-icon jimu-icon-add" data-dojo-attach-point\x3d"btnAddAreaIcon"\x3e\x3c/span\x3e\r\n\t\t\t\t\x3cspan class\x3d"add-label"\x3e${nls.addArea}\x3c/span\x3e\r\n\t\t\t\x3c/div\x3e\r\n\t\t\t\x3cdiv data-dojo-attach-point\x3d"areaTableDiv"\x3e\x3c/div\x3e\r\n\t\t\x3c/div\x3e\r\n\t\x3c/div\x3e\r\n\x3c/div\x3e',
"url:widgets/Draw/setting/css/style.css":".jimu-widget-draw-setting .add-with-icon{margin-top:8px; margin-bottom:3px;}.jimu-widget-draw-setting .jimu-tab{position: static;}.jimu-widget-draw-setting .jimu-tab\x3e.jimu-viewstack{position: static; top: auto; left: auto; right: auto; bottom: auto; height: auto;}.jimu-widget-draw-setting .jimu-viewstack\x3e.view{height: auto;}.jimu-widget-draw-setting .tip{color: #000; font-size: 14px;}.jimu-widget-draw-setting .add-with-icon.jimu-state-disabled{color: #ccc; cursor: default;}.jimu-widget-draw-setting .jimu-simple-table .simple-table-cell.empty-text-td {line-height: 20px;}.jimu-widget-draw-setting .jimu-simple-table .simple-table-cell .normal-text-div{color: #000;}.claro .jimu-widget-draw-setting .dijitSelectLabel,.claro .jimu-widget-draw-setting .dijitTextBox .dijitInputInner,.claro .jimu-widget-draw-setting .dijitValidationTextBox .dijitValidationContainer{max-height: 21px;}.jimu-widget-draw-setting .jimu-simple-table .simple-table-cell{font-size: 14px; padding-right: 3px;}.jimu-widget-draw-setting .jimu-simple-table .simple-table-field:first-child,.jimu-widget-draw-setting .jimu-simple-table .simple-table-cell:first-child{width: 265px;}",
"*now":function(r){r(['dojo/i18n!*preload*widgets/Draw/setting/nls/Setting*["ar","bs","ca","cs","da","de","en","el","es","et","fi","fr","he","hr","hu","id","it","ja","ko","lt","lv","nb","nl","pl","pt-br","pt-pt","ro","ru","sk","sl","sr","sv","th","tr","zh-cn","uk","vi","zh-hk","zh-tw","ROOT"]'])},"*noref":1}});
define("dojo/_base/declare dojo/_base/lang dojo/_base/array dojo/_base/html dojo/_base/query dojo/on dijit/_WidgetsInTemplateMixin jimu/BaseWidgetSetting jimu/dijit/TabContainer jimu/utils dijit/form/Select jimu/dijit/CheckBox jimu/dijit/SimpleTable".split(" "),function(r,d,e,h,t,m,w,x,y,l,u,z,v){return r([x,w],{baseClass:"jimu-widget-draw-setting",locationUnits:null,distanceUnits:null,areaUnits:null,_disabledClass:"jimu-state-disabled",postMixInProperties:function(){this.inherited(arguments);this.jimuNls=
window.jimuNls;this.locationUnits=[{value:"DEGREES",label:this.jimuNls.units.degrees,abbr:this.jimuNls.units.degreesAbbr||"dd",format:"YN XE"},{value:"DEGREE-MINUTE-SECOND",label:this.jimuNls.units.degreeMS,abbr:this.jimuNls.units.degreeMSAbbr||"dms",format:"A\u00b0B'C\"N X\u00b0Y'Z\"E"}];this.distanceUnits=[{value:"KILOMETERS",label:this.nls.kilometers,abbr:this.nls.kilometersAbbreviation||"km",conversion:l.localizeNumber(.001,{places:3})},{value:"MILES",label:this.nls.miles,abbr:this.nls.milesAbbreviation||
"mi",conversion:l.localizeNumber(6.21E-4,{places:6})},{value:"METERS",label:this.nls.meters,abbr:this.nls.metersAbbreviation||"m",conversion:l.localizeNumber(1)},{value:"FEET",label:this.nls.feet,abbr:this.nls.feetAbbreviation||"ft",conversion:l.localizeNumber(3.2808,{places:4})},{value:"YARDS",label:this.nls.yards,abbr:this.nls.yardsAbbreviation||"yd",conversion:l.localizeNumber(1.0936133,{places:7})},{value:"NAUTICAL_MILES",label:this.nls.nauticalmiles,abbr:this.nls.nauticalmilesAbbreviation||"nm",
conversion:l.localizeNumber(5.39956803455,{places:9})+"e-4"}];this.areaUnits=[{value:"SQUARE_KILOMETERS",label:this.nls.squareKilometers,abbr:this.nls.squareKilometersAbbreviation||"sq km",conversion:l.localizeNumber(1E-6,{places:6})},{value:"SQUARE_MILES",label:this.nls.squareMiles,abbr:this.nls.squareMilesAbbreviation||"sq mi",conversion:l.localizeNumber(3.861021,{places:6})+"e-7"},{value:"ACRES",label:this.nls.acres,abbr:this.nls.acresAbbreviation||"ac",conversion:l.localizeNumber(2.4710538147E-4,
{places:14})},{value:"HECTARES",label:this.nls.hectares,abbr:this.nls.hectaresAbbreviation||"ha",conversion:l.localizeNumber(1E-4,{places:4})},{value:"SQUARE_METERS",label:this.nls.squareMeters,abbr:this.nls.squareMetersAbbreviation||"sq m",conversion:l.localizeNumber(1)},{value:"SQUARE_FEET",label:this.nls.squareFeet,abbr:this.nls.squareFeetAbbreviation||"sq ft",conversion:l.localizeNumber(10.763910417,{places:9})},{value:"SQUARE_YARDS",label:this.nls.squareYards,abbr:this.nls.squareYardsAbbreviation||
"sq yd",conversion:l.localizeNumber(1.19599005,{places:8})}]},postCreate:function(){this.inherited(arguments);this.locationTable=new v({fields:[{name:"label",title:this.nls.label,"class":"label",type:"empty"},{name:"abbr",title:this.nls.abbr,"class":"abbr",type:"text",editable:!1},{name:"format",title:this.jimuNls.common.format,"class":"format",type:"text",editable:!1},{name:"actions",title:this.nls.actions,"class":"actions",type:"actions",actions:["up","down","delete"]}]});this.locationTable.placeAt(this.locationTableDiv);
this.distanceTable=new v({fields:[{name:"label",title:this.nls.label,"class":"label",type:"empty"},{name:"abbr",title:this.nls.abbr,"class":"abbr",type:"text",editable:!1},{name:"conversion",title:this.nls.conversion,"class":"conversion",type:"text",editable:!1},{name:"actions",title:this.nls.actions,"class":"actions",type:"actions",actions:["up","down","delete"]}]});this.distanceTable.placeAt(this.distanceTableDiv);this.areaTable=new v({fields:[{name:"label",title:this.nls.label,"class":"label",
type:"empty"},{name:"abbr",title:this.nls.abbr,"class":"abbr",type:"text",editable:!1},{name:"conversion",title:this.nls.conversion,"class":"conversion",type:"text",editable:!1},{name:"actions",title:this.nls.actions,"class":"actions",type:"actions",actions:["up","down","delete"]}]});this.areaTable.placeAt(this.areaTableDiv);this.cbxOperationalLayer=new z({label:this.nls.operationalLayer,style:"margin-top:10px;"});h.addClass(this.cbxOperationalLayer.domNode,"tip");this.cbxOperationalLayer.placeAt(this.domNode);
this.own(m(this.btnAddLocation,"click",d.hitch(this,this._addLocation)));this.own(m(this.btnAddDistance,"click",d.hitch(this,this._addDistance)));this.own(m(this.btnAddArea,"click",d.hitch(this,this._addArea)));this.own(m(this.locationTable,"row-delete",d.hitch(this,function(a){a.select&&(a.select.destroy(),delete a.select);this._resetLocationSelectOptions();this._checkStatusForBtnAddLocation()})));this.own(m(this.distanceTable,"row-delete",d.hitch(this,function(a){a.select&&(a.select.destroy(),delete a.select);
this._resetDistanceSelectOptions();this._checkStatusForBtnAddDistance()})));this.own(m(this.areaTable,"row-delete",d.hitch(this,function(a){a.select&&(a.select.destroy(),delete a.select);this._resetAreaSelectOptions();this._checkStatusForBtnAddArea()})));this.setConfig(this.config)},startup:function(){this.inherited(arguments);this.tabContainer=new y({tabs:[{title:this.nls.location,content:this.locationTabNode},{title:this.nls.distance,content:this.distanceTabNode},{title:this.nls.area,content:this.areaTabNode}],
isNested:!0},this.content);this.tabContainer.startup()},setConfig:function(a){a.isOperationalLayer=!!a.isOperationalLayer;this.config=a;if(!this.config.locationUnits){var b=[],c;for(c in this.locationUnits){var f=this.locationUnits[c];b.push({unit:f.value,addr:f.abbr,format:f.format})}this.config.locationUnits=b}this._setLocationTable(this.config.locationUnits);this._setDistanceTable(this.config.distanceUnits);this._setAreaTable(this.config.areaUnits);this.cbxOperationalLayer.setValue(a.isOperationalLayer)},
_setLocationTable:function(a){this.locationTable.clear();e.forEach(a,d.hitch(this,function(b){var c=this._getLocationUnitInfo(b.unit);c&&(c.abbr=b.abbr,this._addLocationUnitRow(c))}))},_setDistanceTable:function(a){this.distanceTable.clear();e.forEach(a,d.hitch(this,function(b){var c=this._getDistanceUnitInfo(b.unit);c&&(c.abbr=b.abbr,this._addDistanceUnitRow(c))}))},_setAreaTable:function(a){this.areaTable.clear();e.forEach(a,d.hitch(this,function(b){var c=this._getAreaUnitInfo(b.unit);c&&(c.abbr=
b.abbr,this._addAreaUnitRow(c))}))},getConfig:function(){var a={locationUnits:[],distanceUnits:[],areaUnits:[],isOperationalLayer:!1};a.locationUnits=this._getLocationConfig();a.distanceUnits=this._getDistanceConfig();a.areaUnits=this._getAreaConfig();a.isOperationalLayer=this.cbxOperationalLayer.getValue();return a},_getLocationConfig:function(){var a=[];a=this.locationTable.getRows();return a=e.map(a,d.hitch(this,function(b){var c=this.locationTable.getRowData(b);return{unit:b.select.get("value"),
abbr:c.abbr,format:c.format}}))},_getDistanceConfig:function(){var a=[];a=this.distanceTable.getRows();return a=e.map(a,d.hitch(this,function(b){var c=this.distanceTable.getRowData(b);return{unit:b.select.get("value"),abbr:c.abbr}}))},_getAreaConfig:function(){var a=[];a=this.areaTable.getRows();return a=e.map(a,d.hitch(this,function(b){var c=this.areaTable.getRowData(b);return{unit:b.select.get("value"),abbr:c.abbr}}))},_getAllLocationUnitValues:function(){return e.map(this.locationUnits,d.hitch(this,
function(a){return a.value}))},_getUsedLocationUnitValues:function(){var a=this.locationTable.getRows();return e.map(a,d.hitch(this,function(b){return b.select.get("value")}))},_getNotUsedLocationUnitValues:function(){var a=this._getAllLocationUnitValues(),b=this._getUsedLocationUnitValues();return e.filter(a,d.hitch(this,function(c){return 0>e.indexOf(b,c)}))},_getLocationUnitInfo:function(a){var b=null,c=e.filter(this.locationUnits,d.hitch(this,function(f){return f.value===a}));0<c.length&&(b=d.mixin({},
c[0]));return b},_addLocation:function(){var a=this._getNotUsedLocationUnitValues();0!==a.length&&(a=this._getLocationUnitInfo(a[0]),this._addLocationUnitRow(a))},_checkStatusForBtnAddLocation:function(){0===this._getNotUsedLocationUnitValues().length?(h.addClass(this.btnAddLocation,this._disabledClass),h.addClass(this.btnAddLocationIcon,this._disabledClass)):(h.removeClass(this.btnAddLocation,this._disabledClass),h.removeClass(this.btnAddLocationIcon,this._disabledClass))},_addLocationUnitRow:function(a){var b=
this.locationTable.addRow({abbr:a.abbr,format:a.format});if(b.success&&b.tr){b=b.tr;var c=t(".simple-table-cell",b)[0];h.setStyle(c,"verticalAlign","middle");var f=new u({style:"width:100%;height:18px;line-height:18px;"});f.placeAt(c);f.startup();f.addOption({value:a.value,label:a.label,selected:!0});this.own(m(f,"change",d.hitch(this,this._resetLocationSelectOptions)));b.select=f}this._resetLocationSelectOptions();this._checkStatusForBtnAddLocation()},_showCorrectLocationInfoBySelectedOption:function(a){var b=
this._getLocationUnitInfo(a.select.value);this.locationTable.editRow(a,{abbr:b.abbr,format:b.format})},_resetLocationSelectOptions:function(){var a=this.locationTable.getRows(),b=e.map(a,d.hitch(this,function(g){return g.select})),c=this._getNotUsedLocationUnitValues(),f=e.map(c,d.hitch(this,function(g){return this._getLocationUnitInfo(g)}));e.forEach(b,d.hitch(this,function(g,p){var n=g.get("value"),q=e.filter(g.getOptions(),d.hitch(this,function(k){return k.value!==n}));g.removeOption(q);e.forEach(f,
d.hitch(this,function(k){g.addOption({value:k.value,label:k.label})}));g.set("value",n);this._showCorrectLocationInfoBySelectedOption(a[p])}))},_getAllDistanceUnitValues:function(){return e.map(this.distanceUnits,d.hitch(this,function(a){return a.value}))},_getUsedDistanceUnitValues:function(){var a=this.distanceTable.getRows();return e.map(a,d.hitch(this,function(b){return b.select.get("value")}))},_getNotUsedDistanceUnitValues:function(){var a=this._getAllDistanceUnitValues(),b=this._getUsedDistanceUnitValues();
return e.filter(a,d.hitch(this,function(c){return 0>e.indexOf(b,c)}))},_getDistanceUnitInfo:function(a){var b=null,c=e.filter(this.distanceUnits,d.hitch(this,function(f){return f.value===a}));0<c.length&&(b=d.mixin({},c[0]));return b},_addDistance:function(){var a=this._getNotUsedDistanceUnitValues();0!==a.length&&(a=this._getDistanceUnitInfo(a[0]),this._addDistanceUnitRow(a))},_checkStatusForBtnAddDistance:function(){0===this._getNotUsedDistanceUnitValues().length?(h.addClass(this.btnAddDistance,
this._disabledClass),h.addClass(this.btnAddDistanceIcon,this._disabledClass)):(h.removeClass(this.btnAddDistance,this._disabledClass),h.removeClass(this.btnAddDistanceIcon,this._disabledClass))},_addDistanceUnitRow:function(a){var b=this.distanceTable.addRow({abbr:a.abbr,conversion:a.conversion});if(b.success&&b.tr){b=b.tr;var c=t(".simple-table-cell",b)[0];h.setStyle(c,"verticalAlign","middle");var f=new u({style:"width:100%;height:18px;line-height:18px;"});f.placeAt(c);f.startup();f.addOption({value:a.value,
label:a.label,selected:!0});this.own(m(f,"change",d.hitch(this,this._resetDistanceSelectOptions)));b.select=f}this._resetDistanceSelectOptions();this._checkStatusForBtnAddDistance()},_showCorrectDistanceInfoBySelectedOption:function(a){var b=this._getDistanceUnitInfo(a.select.value);this.distanceTable.editRow(a,{abbr:b.abbr,conversion:b.conversion})},_resetDistanceSelectOptions:function(){var a=this.distanceTable.getRows(),b=e.map(a,d.hitch(this,function(g){return g.select})),c=this._getNotUsedDistanceUnitValues(),
f=e.map(c,d.hitch(this,function(g){return this._getDistanceUnitInfo(g)}));e.forEach(b,d.hitch(this,function(g,p){var n=g.get("value"),q=e.filter(g.getOptions(),d.hitch(this,function(k){return k.value!==n}));g.removeOption(q);e.forEach(f,d.hitch(this,function(k){g.addOption({value:k.value,label:k.label})}));g.set("value",n);this._showCorrectDistanceInfoBySelectedOption(a[p])}))},_getAllAreaUnitValues:function(){return e.map(this.areaUnits,d.hitch(this,function(a){return a.value}))},_getUsedAreaUnitValues:function(){var a=
this.areaTable.getRows();return e.map(a,d.hitch(this,function(b){return b.select.get("value")}))},_getNotUsedAreaUnitValues:function(){var a=this._getAllAreaUnitValues(),b=this._getUsedAreaUnitValues();return e.filter(a,d.hitch(this,function(c){return 0>e.indexOf(b,c)}))},_getAreaUnitInfo:function(a){var b=null,c=e.filter(this.areaUnits,d.hitch(this,function(f){return f.value===a}));0<c.length&&(b=d.mixin({},c[0]));return b},_addArea:function(){var a=this._getNotUsedAreaUnitValues();0!==a.length&&
(a=this._getAreaUnitInfo(a[0]),this._addAreaUnitRow(a))},_checkStatusForBtnAddArea:function(){0===this._getNotUsedAreaUnitValues().length?(h.addClass(this.btnAddArea,this._disabledClass),h.addClass(this.btnAddAreaIcon,this._disabledClass)):(h.removeClass(this.btnAddArea,this._disabledClass),h.removeClass(this.btnAddAreaIcon,this._disabledClass))},_addAreaUnitRow:function(a){var b=this.areaTable.addRow({abbr:a.abbr,conversion:a.conversion});if(b.success&&b.tr){b=b.tr;var c=t(".simple-table-cell",b)[0];
h.setStyle(c,"verticalAlign","middle");var f=new u({style:"width:100%;height:18px;line-height:18px;"});f.placeAt(c);f.startup();f.addOption({value:a.value,label:a.label,selected:!0});this.own(m(f,"change",d.hitch(this,this._resetAreaSelectOptions)));b.select=f}this._resetAreaSelectOptions();this._checkStatusForBtnAddArea()},_showCorrectAreaInfoBySelectedOption:function(a){var b=this._getAreaUnitInfo(a.select.value);this.areaTable.editRow(a,{abbr:b.abbr,conversion:b.conversion})},_resetAreaSelectOptions:function(){var a=
this.areaTable.getRows(),b=e.map(a,d.hitch(this,function(g){return g.select})),c=this._getNotUsedAreaUnitValues(),f=e.map(c,d.hitch(this,function(g){return this._getAreaUnitInfo(g)}));e.forEach(b,d.hitch(this,function(g,p){var n=g.get("value"),q=e.filter(g.getOptions(),d.hitch(this,function(k){return k.value!==n}));g.removeOption(q);e.forEach(f,d.hitch(this,function(k){g.addOption({value:k.value,label:k.label})}));g.set("value",n);this._showCorrectAreaInfoBySelectedOption(a[p])}))}})});