/*
All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
*/
import{convertUnit as t}from"../../core/units.js";import{load as e,isLoaded as r,supportsCurves as s,getNearestCoordinate as i,getNearestVertex as o,getNearestVertices as n}from"./gx/operatorProximityGeodesic.js";let a,m,c,u,p,d;function f(){return!!a&&r()}async function l(){if(!f()){const[t,r]=await Promise.all([import("./support/apiConverter.js"),import("./support/proximityResult.js"),e()]);a=t.fromGeometry,m=t.fromPoint,c=t.fromSpatialReference,u=t.getSpatialReference,p=r.toProximityResult,d=s()}}function g(e,r,s={}){let{calculateLeftRightSide:o=!1,maxDeviation:n=NaN,testPolygonInterior:d=!0,unit:f}=s;f&&n&&(n=t(n,f,"meters"));const l=u(e),g=i(a(e),m(r).getXY(),c(l),n,d,o);return f&&g.m_distance&&(g.m_distance=t(g.m_distance,"meters",f)),p(g,e,o)}function _(e,r,s={}){const{unit:i}=s,n=u(e),d=o(a(e),m(r).getXY(),c(n));return i&&d.m_distance&&(d.m_distance=t(d.m_distance,"meters",i)),p(d,e)}function x(e,r,s,i,o={}){const{unit:d}=o;d&&s&&(s=t(s,d,"meters"));const f=u(e);return n(a(e),m(r).getXY(),c(f),s,i).map(r=>(d&&r.m_distance&&(r.m_distance=t(r.m_distance,"meters",d)),p(r,e)))}export{g as getNearestCoordinate,_ as getNearestVertex,x as getNearestVertices,f as isLoaded,l as load,d as supportsCurves};
