/*
All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
*/
import{createLength as e}from"../../core/quantity.js";import{create as t}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{inverseGeodeticSolver as r,InverseGeodeticSolverResult as n,geodesicLengths as s}from"../../geometry/geodesicUtils.js";import o from"../../geometry/Polyline.js";import{l as i,e as c}from"../../chunks/geodeticLengthOperator.js";import{equals as a}from"../../geometry/support/spatialReferenceUtils.js";import{isCurvedGeometry as m}from"../../geometry/support/curves/curveUtils.js";import{geodesicMeasure as u}from"./geodesicMeasurementUtils.js";function f(e){const{spatialReference:t}=e,r=m(e);return u(t,r?w:R,w,e)}function p(e,t){if(!a(e.spatialReference,t.spatialReference))return null;const{spatialReference:r}=e;return v[0]=e.x,v[1]=e.y,v[2]=e.hasZ?e.z:0,D[0]=t.x,D[1]=t.y,D[2]=t.hasZ?t.z:0,l(v,D,r)}function l(e,t,r){return u(r,j,h,e,t,r)}const g={geodesicLength:f,geodesicDistanceBetweenPoints:p,geodesicDistance:l},y={geodesicDistanceBetweenPoints:p};async function d(){return await i(),g}function j(t,n,s){return e(r(U,t,n,s).distance,"meters")}function h(t,r,n){return e(c(x(t,r,n),{unit:"meters"}),"meters")}function R(t){return e(s([t],"meters")[0],"meters")}function w(t){return e(c(t,{unit:"meters"}),"meters")}function x(e,t,r){return new o({spatialReference:r,paths:[[[...e],[...t]]]})}const U=new n,v=t(),D=t();export{d as loadGeodesicLengthMeasurementUtils,y as test};
