// 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(h,n,g,p,q,m,l,f){var e=null,k=null,d=!1,b=h(null,function(){});h=require.toUrl("jimu");var r=m(h+"/SpatialReference/cs.json",{handleAs:"json"}),t=m(h+"/SpatialReference/transform.json",{handleAs:"json"});b.loadResource=function(){var a=new p;if(e&&k)return a.resolve(),a;q([r,t]).then(function(c){e=c[0];k=c[1];d=!0;a.resolve()},function(c){console.error(c);
d=!1;a.reject(c)});return a};b.getAllCSUnits=function(){if(d){var a=[];g.forEach(e.wkids,n.hitch(this,function(c){c=this.getCSUnit(c);-1===g.indexOf(a,c)&&a.push(c)}));return a}};b.convertUnit=function(a,c,u){if(d)return f.convertUnit(a,c,u)};b.getUnitRate=function(a,c){if(d)return f.getUnitRate(a,c)};b.isProjectUnit=function(a){if(d)return f.isProjectUnit(a)};b.isGeographicUnit=function(a){if(d)return f.isGeographicUnit(a)};b.getGeographicUnits=function(){if(d)return f.getGeographicUnits()};b.getProjectUnits=
function(){if(d)return f.getProjectUnits()};b.getCSUnit=function(a){if(d)return a=g.indexOf(e.wkids,a),e.units[a]};b.isSameSR=function(a,c){if(d)return a=this.indexOfWkid(a),c=this.indexOfWkid(c),e.labels[a]===e.labels[c]};b.isValidWkid=function(a){if(d)return-1<this.indexOfWkid(a)};b.getSRLabel=function(a){if(d&&this.isValidWkid(a))return a=this.indexOfWkid(a),e.labels[a]};b.indexOfWkid=function(a){if(d)return g.indexOf(e.wkids,a)};b.isWebMercator=function(a){return l.prototype._isWebMercator?l.prototype._isWebMercator.apply({wkid:parseInt(a,
10)},[]):(new l(parseInt(a,10))).isWebMercator()};b.standardizeWkid=function(a){return this.isWebMercator(a)?3857:parseInt(a,10)};b.isValidTfWkid=function(a){if(d)return-1<this.indexOfTfWkid(a)};b.getTransformationLabel=function(a){if(d)return this.isValidTfWkid(a)?(a=this.indexOfTfWkid(a),k.labels[a]):""};b.indexOfTfWkid=function(a){if(d)return g.indexOf(k.tfWkids,a)};b.isGeographicCS=function(a){if(d)return this.isValidWkid(a)?(a=this.indexOfWkid(a),!e.projSR[a]):!1};b.isProjectedCS=function(a){if(d)return this.isValidWkid(a)?
(a=this.indexOfWkid(a),e.projSR[a]):!1};b.getGeoCSByProj=function(a){if(d&&this.isProjectedCS(a))return a=this.indexOfWkid(a),e.spheroids[a]};b.getSpheroidStr=function(a){if(d)return this.isGeographicCS(a)?e.labels[this.indexOfWkid(a)]:this.isProjectedCS(a)?(a=b.getGeoCSByProj(a),e.labels[this.indexOfWkid(a)]):null};b.isSameSpheroid=function(a,c){if(d)return a=this.getSpheroidStr(a),c=this.getSpheroidStr(c),a&&c&&a===c?!0:!1};return b});