/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
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";import{MeasurementWorkerHandle as f}from"./MeasurementWorkerHandle.js";const p=e=>({geodesicLength:d,geodesicDistanceBetweenPoints:y,geodesicDistance:j,geodesicLengthAsync:e.geodeticLength.bind(e)}),l={geodesicDistanceBetweenPoints:y};async function g(){await i();const e=new f;return e.preloadGeodetic(),p(e)}function d(e){const{spatialReference:t}=e,r=m(e);return u(t,r?x:R,x,e)}function y(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,j(v,D,r)}function j(e,t,r){return u(r,h,w,e,t,r)}function h(t,n,s){return e(r(U,t,n,s).distance,"meters")}function w(t,r,n){return e(c(L(t,r,n),{unit:"meters"}),"meters")}function R(t){return e(s([t],"meters")[0],"meters")}function x(t){return e(c(t,{unit:"meters"}),"meters")}function L(e,t,r){return new o({spatialReference:r,paths:[[[...e],[...t]]]})}const U=new n,v=t(),D=t();export{g as loadGeodesicLengthMeasurementUtils,l as test};
