/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
import{floatEqualAbsolute as n}from"../../../core/mathUtils.js";import{squaredDistance as t}from"../../../core/libs/gl-matrix-2/math/vec2.js";function r(n,t,r,o){return n[0]=t[0]*(1-o)+r[0]*o,n[1]=t[1]*(1-o)+r[1]*o,n}function o(n,r){return t(n,r)}function u(n,t,r){const u=o(t,r);if(0===u)return o(t,n);const i=(t[0]-n[0])*(r[1]-n[1])-(t[1]-n[1])*(r[0]-n[0]);return i*i/u}function i(n,t,r,o,u){const[i,c]=t,[e,m]=r,[a,f]=o,[s,x]=u,h=(i-e)*(f-x)-(c-m)*(a-s);if(0===h)return null;const l=(i*m-c*e)*(a-s)-(i-e)*(a*x-f*s),M=(i*m-c*e)*(f-x)-(c-m)*(a*x-f*s);return n[0]=l/h,n[1]=M/h,n}const c=2*Math.PI;function e(n,t){const r=Math.atan2(n,t);return r<0?r+c:r}function m(n){return Math.abs(n)%c}function a(n){const t=m(n);return t<Math.PI?t:c-t}function f(n,t){return{min:Math.min(n,t),max:Math.max(n,t)}}function s(t,r,o,u){if(n(m(t-r),0))return o?[t,t]:[t,u?t-c:t+c];const[i,e]=u?[t-c,t]:[t,t+c];return[t,x({min:i,max:e},r)]}function x({min:n,max:t},r){let o;return o=t-r,o>=c?(o-=o%c,r+o):(o=r-n,o>=c?(o-=o%c,r-o):r)}function h(n,t){const r=x(n,t);return r>n.min&&r<n.max?r:a(r-n.min)<a(r-n.max)?n.min:n.max}function l(n,t,r,o=10){return t.map(t=>{let u=t;for(let i=0;i<o;i++){const[t,o,i,c,e,m]=r(u),a=n[0]-t,f=n[1]-o,s=-i,x=-c;u+=-(2*a*s+2*f*x)/(2*s*s+2*a*-e+2*x*x+2*f*-m||1e-6)}return u})}export{m as angularDistance,a as angularDistanceAlongMinorArc,f as angularRange,h as angularRangeClamp,s as angularRangeOriented,x as angularRangeWrap,o as distance2,l as findClosestAndFurthestCurveParametersToPoint,r as interpolateSegment,i as intersectLineLine,u as pointToSegmentDistance2,e as wrapAtan2};
