/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["exports","../../core/quantityUtils","../../chunks/vec3f64","../../geometry/geometryEngine","../../geometry/projection","../../geometry/support/geodesicUtils","../../geometry/support/spatialReferenceUtils","./geodesicMeasurementUtils"],(function(e,t,n,r,o,c,s,i){"use strict";function a(e){const{spatialReference:t}=e;return i.geodesicMeasure(t,d,m,L,e)}function u(e,t){if(!s.equals(e.spatialReference,t.spatialReference))return null;const{spatialReference:n}=e;return v[0]=e.x,v[1]=e.y,v[2]=e.hasZ?e.z:0,S[0]=t.x,S[1]=t.y,S[2]=t.hasZ?t.z:0,l(v,S,n)}function l(e,t,n){return i.geodesicMeasure(n,g,f,p,e,t,n)}function g(e,n,r){return t.createLength(c.inverseGeodeticSolver(y,e,n,r).distance,"meters")}function f(e,n,o){return t.createLength(r.geodesicLength(h(e,n,o),"meters"),"meters")}function p(e,n,r){return o.projectVectorToWGS84ComparableLonLat(e,r,G)&&o.projectVectorToWGS84ComparableLonLat(n,r,R)?t.createLength(c.inverseGeodeticSolver(y,G,R).distance,"meters"):null}function d(e){return t.createLength(c.geodesicLengths([e],"meters")[0],"meters")}function m(e){return t.createLength(r.geodesicLength(e,"meters"),"meters")}function L(e){const n=[];if(!o.projectPolylineToWGS84ComparableLonLat(e,n))return null;let r=0;for(const t of n){let e=0;for(let n=1;n<t.length;++n)e+=c.inverseGeodeticSolver(y,t[n-1],t[n]).distance;r+=e}return t.createLength(r,"meters")}function h(e,t,n){return{type:"polyline",spatialReference:n,paths:[[[...e],[...t]]]}}const y={distance:null},v=n.create(),S=n.create(),G=n.create(),R=n.create();e.geodesicDistance=l,e.geodesicDistanceBetweenPoints=u,e.geodesicLength=a,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
