/* COPYRIGHT Esri - https://js.arcgis.com/5.1.2/LICENSE.txt */
import{convertUnit as e}from"../../core/units.js";import t from"../Point.js";import{calculateDistanceAndAzimuth as r,load as n,movePointsByDistance as i,isLoaded as o}from"./gx/geodeticUtils.js";import{geodeticCurveType as s}from"./support/geodeticCurveType.js";let a,c,u;function m(){return!!a&&o()}async function p(){if(!m()){const[e]=await Promise.all([import("./support/apiConverter.js"),n()]);a=e.fromPoint,c=e.fromSpatialReference,u=e.getSpatialReference}}function f(t,n,i={}){const{curveType:o="geodesic",unit:m}=i,p=u(t),f=[0],d=[0];let g=r(c(p),a(t).getXY(),a(n).getXY(),s[o],f,d);g&&m&&(g=e(g,"meters",m));const y=t=>l(e(t,"radians","degrees"));return{distance:g,azimuth12:y(f[0]),azimuth21:y(d[0])}}function d(r,n,o,m={}){const{curveType:p="geodesic",unit:f}=m;f&&(n=e(n,f,"meters"));const d=u(r),l=[a(r).getXY()];i(c(d),l,1,n,e(o,"degrees","radians"),s[p]);const g=l[0];return g.isNAN()?null:new t({x:g.x,y:g.y,spatialReference:d})}function l(e){return e<0?e+360:e}export{f as calculateDistanceAndAzimuth,m as isLoaded,p as load,d as pointFromDistance,l as shiftDegreesTo360};
