// 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/lang dojo/_base/array dojo/Deferred dojo/promise/all dojo/request esri/SpatialReference ./unitUtils".split(" "),function(c,p,h,q,r,m,l,f){var e=null,k=null,d=!1;c=c(null,function(){});var n=require.toUrl("jimu"),t=m(n+"/SpatialReference/wkidDetails.json",{handleAs:"json"}),u=m(n+"/SpatialReference/transform.json",{handleAs:"json"});c.loadResource=function(){var a=new q;if(e&&k)return a.resolve(),a;r([t,u]).then(function(b){e=b[0];k=b[1];d=!0;a.resolve()},function(b){console.error(b);
d=!1;a.reject(b)});return a};c.getAllCSUnits=function(){if(d){var a=[];h.forEach(e.wkids,p.hitch(this,function(b){b=this.getCSUnit(b);-1===h.indexOf(a,b)&&a.push(b)}));return a}};c.convertUnit=function(a,b,g){if(d)return f.convertUnit(a,b,g)};c.getUnitRate=function(a,b){if(d)return f.getUnitRate(a,b)};c.isProjectUnit=function(a){if(d)return f.isProjectUnit(a)};c.isGeographicUnit=function(a){if(d)return f.isGeographicUnit(a)};c.getGeographicUnits=function(){if(d)return f.getGeographicUnits()};c.getProjectUnits=
function(){if(d)return f.getProjectUnits()};c.getCSUnit=function(a){if(d){a=this.getCSStr(a);var b=0,g=0;b=a.lastIndexOf("UNIT");g=a.indexOf(",",b);return a.slice(b+6,g-1)}};c.isSameSR=function(a,b){if(d)return a=this.indexOfWkid(a),b=this.indexOfWkid(b),e.labels[a]===e.labels[b]};c.isValidWkid=function(a){if(d)return-1<this.indexOfWkid(a)};c.getSRLabel=function(a){if(d&&this.isValidWkid(a))return a=this.indexOfWkid(a),e.labels[a]};c.indexOfWkid=function(a){if(d)return h.indexOf(e.wkids,a)};c.isWebMercator=
function(a){return l.prototype._isWebMercator?l.prototype._isWebMercator.apply({wkid:parseInt(a,10)},[]):(new l(parseInt(a,10))).isWebMercator()};c.standardizeWkid=function(a){return this.isWebMercator(a)?3857:parseInt(a,10)};c.isValidTfWkid=function(a){if(d)return-1<this.indexOfTfWkid(a)};c.getTransformationLabel=function(a){if(d)return this.isValidTfWkid(a)?(a=this.indexOfTfWkid(a),k.labels[a]):""};c.indexOfTfWkid=function(a){if(d)return h.indexOf(k.tfWkids,a)};c.isGeographicCS=function(a){if(d)return this.isValidWkid(a)?
e.details[this.indexOfWkid(a)].startWith("GEOGCS"):!1};c.isProjectedCS=function(a){if(d)return this.isValidWkid(a)?e.details[this.indexOfWkid(a)].startWith("PROJCS"):!1};c.getGeoCSByProj=function(a){if(d&&this.isProjectedCS(a))return a=this.getSpheroidStr(a),a=h.indexOf(e.details,a),e.wkids[a]};c.getSpheroidStr=function(a){if(d){if(this.isGeographicCS(a))return e.details[this.indexOfWkid(a)];if(this.isProjectedCS(a)){a=e.details[this.indexOfWkid(a)];var b=a.indexOf("GEOGCS"),g=a.indexOf("PROJECTION")-
1;return a.slice(b,g)}return null}};c.getCSStr=function(a){if(d)return e.details[this.indexOfWkid(a)]};c.isSameSpheroid=function(a,b){if(d)return a=this.getSpheroidStr(a),b=this.getSpheroidStr(b),a&&b&&a===b?!0:!1};return c});