/* COPYRIGHT Esri - https://js.arcgis.com/5.0.18/LICENSE.txt */
import{rad2deg as t,deg2rad as n}from"../../core/mathUtils.js";import{directionalPadCyclicalAngles as o}from"./constants.js";function r(t){const n=s(t),r=o.map(t=>({angle:t,offset:Math.abs(t-n)})).sort((t,n)=>t.offset-n.offset),e=r[0].angle;return-180===e?180:e}function s({x:n,y:o}){const r=Math.atan2(n,o);return t(r)}function e(t){const o=n(t);return{x:Math.sin(o),y:Math.cos(o)}}function c(t,n){const o=n.y-t.y,r=n.x-t.x,s=Math.sqrt(r*r+o*o);return{x:r/s,y:o/s}}function a(t){const{x:n,y:o,width:r,height:s}=t.getBoundingClientRect();return{x:n+r/2,y:o+s/2}}export{e as angleToUnitVector,a as findElementCenter,c as toUnitVector,s as unitVectorToAngle,r as vectorToClosestAngle};
