// 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
define("dojo/_base/declare dojo/_base/array dojo/_base/lang dojo/dom-class dojo/Stateful dojo/Deferred esri/geometry/Point esri/SpatialReference jimu/dijit/Message ./util ./dialogConfirm ./ConfirmNotation".split(" "),function(t,y,p,z,A,B,u,v,C,D,E,F){return t([A],{formatPrefix:!1,_formatPrefixSetter:function(a){this.formatPrefix=a},inputString:null,_inputStringSetter:function(a){this.inputString=a},formatString:"YN XE",_formatStringSetter:function(a){this.formatString=a},inputType:"UNKNOWN",formatType:"DD",
_formatTypeSetter:function(a){this.formatType=a;this.getFormattedValue()},outputString:"",coordinateEsriGeometry:null,_coordinateEsriGeometrySetter:function(a){null!==a&&(this.coordinateEsriGeometry=a,this.getFormattedValue())},constructor:function(a){t.safeMixin(this,a);this.util=new D({appConfig:this.appConfig,nls:this.nls})},getInputType:function(){this.inputTypeDef=new B;var a=this.util.getCleanInput(this.inputString);this.util.getCoordinateType(a).then(p.hitch(this,function(c){if(c)if(1===c.length){var f=
this.processCoordTextInput(a,c[0],!1);this.util.getXYNotation(f,c[0].conversionType).then(p.hitch(this,function(g){0>=g.length||!g[0][0]&&0!==g[0][0]?(this.hasError=!0,this.valid=!1,this.message=this.nls.invalidCoordinateMessage):(this.valid=this.isManual=!0,this.formatType=c[0].conversionType,this.inputType=c[0].conversionType,this.coordinateEsriGeometry=new u(g[0][0],g[0][1],new v({wkid:4326})),this.message="");this.inputTypeDef.resolve(this)}));p.hitch(this,function(){this.hasError=!0;this.valid=
!1;this.inputType="UNKNOWN";this.message=this.nls.invalidCoordinateMessage;this.inputTypeDef.resolve(this)})}else{var b=new E({title:this.nls.confirmInputNotationMessage,nls:this.nls,content:new F({nls:this.nls},c),style:"width: 400px",hasSkipCheckBox:!1});"DartTheme"===this.appConfig.theme.name&&z.add(b.domNode,"dartThemeClaroDijitTooltipContainerOverride");b.show().then(p.hitch(this,function(){var g=y.filter(c,function(d){return d.name===b.content.comboOptions.get("value")}),h=this.processCoordTextInput(a,
g[0],!1);this.util.getXYNotation(h,g[0].conversionType).then(p.hitch(this,function(d){0>=d.length||!d[0][0]&&0!==d[0][0]?(this.hasError=!0,this.valid=!1,this.message=this.nls.invalidCoordinateMessage):(this.valid=this.isManual=!0,this.inputType=c[0].conversionType,this.formatType=c[0].conversionType,this.coordinateEsriGeometry=new u(d[0][0],d[0][1],new v({wkid:4326})),this.message="");this.inputTypeDef.resolve(this)}));p.hitch(this,function(){this.hasError=!0;this.valid=!1;this.inputType="UNKNOWN";
this.message=this.nls.invalidCoordinateMessage;this.inputTypeDef.resolve(this)})},function(){this.inputTypeDef.reject()}))}else this.hasError=!0,this.valid=!1,this.inputType="UNKNOWN",this.message=this.nls.invalidCoordinateMessage,this.inputTypeDef.resolve(this)}));return this.inputTypeDef},processCoordTextInput:function(a,c,f){var b=c.pattern.exec(a),g=!1,h=c.name;switch(c.name){case "DD":var d=b[2];var k=b[7];var e=b[10];var l=b[16];var m=b[3].replace(/[,:]/,".");var n=b[11].replace(/[,:]/,".");
h="DD";break;case "DDrev":d=b[11];k=b[16];e=b[2];l=b[8];m=b[12].replace(/[,:]/,".");n=b[3].replace(/[,:]/,".");h="DD";break;case "DDM":d=b[2];k=b[7];e=b[10];l=b[15];m=b[3];var q=b[4].replace(/[,:]/,".");n=b[11];var r=b[12].replace(/[,:]/,".");h="DDM";break;case "DDMrev":d=b[10];k=b[15];e=b[2];l=b[7];m=b[11];q=b[12].replace(/[,:]/,".");n=b[3];r=b[4].replace(/[,:]/,".");h="DDM";break;case "DMS":d=b[2];k=b[8];e=b[11];l=b[17];m=b[3];q=b[4];var w=b[5].replace(/[,:]/,".");n=b[12];r=b[13];var x=b[14].replace(/[,:]/,
".");h="DMS";break;case "DMSrev":d=b[11],k=b[17],e=b[2],l=b[8],m=b[12],q=b[13],w=b[14].replace(/[,:]/,"."),n=b[3],r=b[4],x=b[5].replace(/[,:]/,"."),h="DMS"}d&&k?(g=!0,d=(new RegExp(/[Ss-]/)).test(d)?"-":"+"):d=d&&(new RegExp(/[Ss-]/)).test(d)?"-":k&&(new RegExp(/[Ss-]/)).test(k)?"-":"+";e&&l?(g=!0,e=(new RegExp(/[Ww-]/)).test(e)?"-":"+"):e=e&&(new RegExp(/[Ww-]/)).test(e)?"-":l&&(new RegExp(/[Ww-]/)).test(l)?"-":"+";g&&(f||new C({message:this.nls.prefixSuffixMessage}));switch(h){case "DD":a=d+m+","+
e+n;break;case "DDM":a=d+m+" "+q+","+e+n+" "+r;break;case "DMS":a=d+m+" "+q+" "+w+","+e+n+" "+r+" "+x}return a},getInputTypeSync:function(){return null!==this.util.getCoordinateType(this.inputString)},getFormattedValue:function(){this.coordinateEsriGeometry&&this.util.getCoordValues({x:this.coordinateEsriGeometry.x,y:this.coordinateEsriGeometry.y},this.formatType,6).then(p.hitch(this,function(a){this.set("outputString",this.getCoordUI(a))}))},getCoordUI:function(a){var c=this.get("formatPrefix");
switch(this.formatType){case "DD":a=this.util.getFormattedDDStr(a,this.formatString,c);var f=a.formatResult;break;case "DDM":a=this.util.getFormattedDDMStr(a,this.formatString,c);f=a.formatResult;break;case "DMS":a=this.util.getFormattedDMSStr(a,this.formatString,c);f=a.formatResult;break;case "USNG":a=this.util.getFormattedUSNGStr(a,this.formatString,c);f=a.formatResult;break;case "MGRS":a=this.util.getFormattedMGRSStr(a,this.formatString,c);f=a.formatResult;break;case "GARS":a=this.util.getFormattedGARSStr(a,
this.formatString,c);f=a.formatResult;break;case "GEOREF":a=this.util.getFormattedGEOREFStr(a,this.formatString,c);f=a.formatResult;break;case "UTM":a=this.util.getFormattedUTMStr(a,this.formatString,c);f=a.formatResult;break;case "UTM (H)":a=this.util.getFormattedUTMHStr(a,this.formatString,c),f=a.formatResult}return f}})});