// 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/SmartEditor/setting/Coordinates.html":'\x3cdiv style\x3d"max-height: 445px;padding: 0 5px;"\x3e\r\n  \x3cdiv class\x3d"esriCTCoordinateWidth" data-dojo-attach-point\x3d"coordianteDijitMainWrapper"\x3e\r\n    \x3cdiv class\x3d"esriCTWrapper" data-dojo-attach-point\x3d"groupInfoNode1"\x3e\r\n      \x3cdiv class\x3d"esriCTCoordinatePopUpLabel"\x3e${nls.intersectionPage.groupNameLabel}\x3c/div\x3e\r\n      \x3cdiv class\x3d"esriCTCoordinatePopupdijitWrapper"\x3e\r\n        \x3cdiv data-dojo-attach-point\x3d"groupNameTextBoxNode"\x3e\r\n        \x3c/div\x3e\r\n      \x3c/div\x3e\r\n    \x3c/div\x3e\r\n\r\n\r\n    \x3cdiv class\x3d"esriCTWrapper"\x3e\r\n      \x3cdiv class\x3d"esriCTCoordinatePopUpLabel" title\x3d"${nls.coordinatesPage.coordinatesSourceTitle}"\x3e\r\n        ${nls.coordinatesPage.coordinatesSourceTitle}\x3c/div\x3e\r\n      \x3cdiv class\x3d"esriCTCoordinatePopupdijitWrapper"\x3e\r\n        \x3cdiv class\x3d"esriCTCoordinatePopupdijit" style\x3d"width: 100%;" data-dojo-attach-point\x3d"coordinatesSourceNode"\x3e\r\n        \x3c/div\x3e\r\n      \x3c/div\x3e\r\n    \x3c/div\x3e\r\n\r\n    \x3cdiv class\x3d"esriCTWrapper"\x3e\r\n      \x3cdiv class\x3d"esriCTCoordinatePopUpLabel" title\x3d"${nls.coordinatesPage.coordinatesSelectTitle}"\x3e\r\n        ${nls.coordinatesPage.coordinatesSelectTitle}\x3c/div\x3e\r\n      \x3cdiv class\x3d"esriCTCoordinatePopupdijitWrapper"\x3e\r\n        \x3cdiv class\x3d"esriCTCoordinatePopupdijit" style\x3d"width: 100%" data-dojo-attach-point\x3d"selectCoordinateNode"\x3e\x3c/div\x3e\r\n      \x3c/div\x3e\r\n    \x3c/div\x3e\r\n\r\n    \x3cdiv class\x3d"esriCTWrapper"\x3e\r\n      \x3cdiv class\x3d"esriCTCoordinatePopUpLabel" title\x3d"${nls.coordinatesPage.coordinatesAttributeTitle}"\x3e\r\n        ${nls.coordinatesPage.coordinatesAttributeTitle}\x3c/div\x3e\r\n      \x3cdiv class\x3d"esriCTCoordinatePopupdijitWrapper"\x3e\r\n        \x3cdiv class\x3d"esriCTCoordinatePopupdijit" style\x3d"width: 100%" data-dojo-attach-point\x3d"selectAttributeNode"\x3e\x3c/div\x3e\r\n      \x3c/div\x3e\r\n    \x3c/div\x3e\r\n  \x3c/div\x3e\r\n  \x3cdiv class\x3d"esriCTWrapper" data-dojo-attach-point\x3d"groupInfoNode2"\x3e\r\n    \x3cfieldset class\x3d"esriCTFieldset"\x3e\r\n      \x3clegend class\x3d"esriCTLegendTitle"\x3e${nls.intersectionPage.layerAndFieldsApplyLabel}\x3c/legend\x3e\r\n      \x3cdiv class\x3d"esriCTTableParentContainer" data-dojo-attach-point\x3d"tableParentContainer"\x3e\r\n      \x3c/div\x3e\r\n    \x3c/fieldset\x3e\r\n  \x3c/div\x3e\r\n\x3c/div\x3e'}});
define("dojo/_base/declare dojo/Evented dojo/_base/lang dojo/_base/array dojo/dom-construct dojo/on dojo/text!./Coordinates.html dijit/_TemplatedMixin jimu/BaseWidgetSetting jimu/dijit/Popup dijit/form/Select dijit/form/ValidationTextBox ./layersAndFieldsApplyOn dojo/dom-class".split(" "),function(u,v,e,h,l,q,w,x,y,z,r,A,B,p){return u([y,v,x],{baseClass:"jimu-widget-smartEditor-setting-coordinates",templateString:w,groupNameTextBox:null,postCreate:function(){this.inherited(arguments);this.fieldSelector=
this.groupNameTextBox=null;this._initControls();this._createLayersAndFields();this.isDelete||this.showDialog()},_onCoordinateSystemChanged:function(a){this.fieldSelector.set("options",this._getFieldsOptionsObj(a));0<this.fieldSelector.options.length&&this.fieldSelector.set("value",this.fieldSelector.options[0].value)},showDialog:function(){var a=!1;var b=675;var c=!1;if(this._fieldValues&&this._fieldValues.Coordinates&&this._fieldValues.Coordinates.hasOwnProperty("enabled")){a=this._fieldValues.Coordinates.enabled;
var m=this._fieldValues.Coordinates.coordinatesSystem;var d=this._fieldValues.Coordinates.field;var n=this._fieldValues.Coordinates.hasOwnProperty("coordinatesSource")?this._fieldValues.Coordinates.coordinatesSource:"featureLocation"}this.coordinatesSource=new r({options:this._addCoordinatesSourceOpt(),style:{width:"99%"}},l.create("div",{},this.coordinatesSourceNode));n&&this.coordinatesSource.set("value",n,!1);this.own(q(this.coordinatesSource,"change",e.hitch(this,function(g){f.set("options",this._createCoordinatesOptions(g));
0<f.options.length&&(f.set("value",f.options[0].value,!1),this._onCoordinateSystemChanged(f.options[0].value))})));var f=new r({style:{width:"99%"},options:this._createCoordinatesOptions(this.coordinatesSource.value)},l.create("div",{},this.selectCoordinateNode));this.own(q(f,"change",e.hitch(this,this._onCoordinateSystemChanged)));m&&f.set("value",m,!1);this.fieldSelector=new r({style:{width:"99%"},options:this._getFieldsOptionsObj(f.getValue())},l.create("div",{},this.selectAttributeNode));d&&(this.fieldSelector.set("value",
d),"MGRS"===d&&this._createLayersAndFields());this.own(q(this.fieldSelector,"change",e.hitch(this,function(){this._createLayersAndFields()})));this.isGroup||(p.add(this.groupInfoNode1,"esriCTHidden"),p.add(this.groupInfoNode2,"esriCTHidden"),p.remove(this.coordianteDijitMainWrapper,"esriCTCoordinateWidth"),p.add(this.coordianteDijitMainWrapper,"esriCTFullWidth"),c=!0,b=420);var t=new z({titleLabel:this.nls.coordinatesPage.popupTitle,width:b,maxHeight:500,autoHeight:c,content:this,buttons:[{label:this.nls.ok,
onClick:e.hitch(this,function(){var g={},k={};g.enabled=a;g.coordinatesSystem=f.get("value");g.field=this.fieldSelector.get("value");g.coordinatesSource=this.coordinatesSource.get("value");if(this.isGroup){if(!this.groupNameTextBox.isValid()){this.groupNameTextBox.focus();return}}else delete this._fieldValues.Coordinates.attributeActionGroupName;this._fieldValues.Coordinates||(this._fieldValues.Coordinates={actionName:"Coordinates"});e.mixin(this._fieldValues.Coordinates,g);this.isGroup?(k.name=this.groupNameTextBox.get("value"),
k.dataType=this.fieldSelector._getSelectedOptionsAttr().type,k.attributeInfo=g,k.appliedOn=this._layerAndFieldsApplyOnObj.getCheckedFields(k),this.emit("groupInfoUpdated",k)):this.emit("attributeActionUpdated");t.close()})},{label:this.nls.cancel,classNames:["jimu-btn-vacation"],onClick:e.hitch(this,function(){t.close()})}],onClose:e.hitch(this,function(){})});this.isGroup&&this.groupNameTextBox.focus()},_initControls:function(){this.groupNameTextBox=new A({style:{width:"99%"},required:!0,trim:!0},
l.create("div",{},this.groupNameTextBoxNode));this.groupNameTextBox.validator=e.hitch(this,function(a){return a?a!==this.prevName&&this.editUtils.isDuplicateGroupName(a,this.existingGroupNames)?(this.groupNameTextBox.set("invalidMessage",this.nls.smartActionsPage.uniqueGroupNameMsg),!1):!0:(this.groupNameTextBox.set("invalidMessage",this.nls.smartActionsPage.requiredGroupNameMsg),!1)});this.name&&this.groupNameTextBox.set("value",this.name)},_createCoordinatesOptions:function(a){var b=[];this.isGroup?
(0<this.coordinatesSavedDataTypes[a].MapSpatialReference.length&&b.push({label:this.nls.coordinatesPage.mapSpatialReferenceOptionLabel,value:"MapSpatialReference"}),0<this.coordinatesSavedDataTypes[a].LatLong.length&&b.push({label:this.nls.coordinatesPage.latLongOptionLabel,value:"LatLong"}),0<this.coordinatesSavedDataTypes[a].MGRS.length&&b.push({label:this.nls.coordinatesPage.MGRS,value:"MGRS"})):b.push({label:this.nls.coordinatesPage.mapSpatialReferenceOptionLabel,value:"MapSpatialReference"},
{label:this.nls.coordinatesPage.latLongOptionLabel,value:"LatLong"},{label:this.nls.coordinatesPage.MGRS,value:"MGRS"});return b},_getFieldsOptionsObj:function(a){var b=[],c=[];c=this._getCoordinateSystemOptions(a);var m=this.coordinatesSource.get("value");h.forEach(c,e.hitch(this,function(d){var n="MGRS"===a?this.nls.coordinatesPage.MGRS:this.nls.coordinatesPage[a][d.name];this.isGroup?(-1!==this.coordinatesSavedDataTypes[m][a].indexOf(d.alias)||-1!==this.coordinatesSavedDataTypes[m].LatLong.indexOf(d.alias))&&
b.push({label:n||d.name,value:d.name,type:d.alias}):("xy"!==d.name||"xy"===d.name&&"esriFieldTypeString"===this._fieldType||"yx"!==d.name||"yx"===d.name&&"esriFieldTypeString"===this._fieldType)&&b.push({label:n||d.name,value:d.name,type:d.alias})}));return b},_getCoordinateSystemOptions:function(a){switch(a){case "LatLong":var b=[{name:"y",alias:"Latitude"},{name:"x",alias:"Longitude"},{name:"xy",alias:"Longitude Latitude"},{name:"yx",alias:"Latitude Longitude"}];break;case "MapSpatialReference":b=
[{name:"x",alias:"X"},{name:"y",alias:"Y"},{name:"xy",alias:"X Y"},{name:"yx",alias:"Y X"}];break;case "MGRS":b=[{name:"MGRS",alias:"MGRS"}]}return b},_createLayerFieldsFilter:function(){var a={};!this.fieldSelector||"xy"!==this.fieldSelector.value&&"MGRS"!==this.fieldSelector.value&&"yx"!==this.fieldSelector.value?h.forEach(this._totalLayers,e.hitch(this,function(b){b.isTable||h.forEach(b.layerObject.fields,e.hitch(this,function(c){if("esriFieldTypeString"===c.type||"esriFieldTypeSmallInteger"===
c.type||"esriFieldTypeInteger"===c.type||"esriFieldTypeSingle"===c.type||"esriFieldTypeDouble"===c.type&&c.editable)a[b.id]||(a[b.id]={}),a[b.id][c.name]=c}))})):h.forEach(this._totalLayers,e.hitch(this,function(b){b.isTable||(a[b.id]={},h.forEach(b.layerObject.fields,e.hitch(this,function(c){"esriFieldTypeString"===c.type&&(a[b.id]||(a[b.id]={}),a[b.id][c.name]=c)})))}));return a},_createLayersAndFields:function(){this._layerAndFieldsApplyOnObj=new B({map:this.map,layerInfos:this.layerInfos,_configInfos:this._configInfos,
actionName:"Coordinates",nls:this.nls,prevName:this.prevName,existingGroups:this.existingGroups,layerDetails:this._createLayerFieldsFilter(),appliedOn:this.appliedOn});l.empty(this.tableParentContainer);this._layerAndFieldsApplyOnObj.placeAt(this.tableParentContainer);this._layerAndFieldsApplyOnObj.startup()},deleteGroup:function(){this._layerAndFieldsApplyOnObj.deleteGroup()},_addCoordinatesSourceOpt:function(){var a=[];a=[{label:this.nls.coordinatesPage.featureLocation,value:"featureLocation"},
{label:this.nls.coordinatesPage.myLocation,value:"myLocation"}];return a=this.removeCoordsSourceOption(a)},removeCoordsSourceOption:function(a){h.forEach(a,e.hitch(this,function(b,c){b&&this.isGroup&&(b=this.coordinatesSavedDataTypes[b.value],0===b.LatLong.length&&0===b.MGRS.length&&0===b.MapSpatialReference.length&&a.splice(c,1))}));return a}})});