/*
All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
*/
import"../../../core/has.js";import{createScreenPoint as e}from"../../../core/screenUtils.js";const t=()=>({maximumClickDelay:300}),n=(e={})=>({...t(),movementUntilMouseDrag:1.5,movementUntilPenDrag:6,movementUntilTouchDrag:6,holdDelay:500,...e}),r=(e={})=>({...t(),maximumDoubleClickDistance:10,maximumDoubleTouchDistance:35,maximumDoubleClickDelay:250,maximumDoubleTouchDelay:350,...e});function o(e,t){return Math.abs(t.x-e.x)+Math.abs(t.y-e.y)}function c(e,t){const n=t.x-e.x,r=t.y-e.y;return Math.sqrt(n*n+r*r)}function i(t,n){if(n?(n.radius=0,n.center.x=0,n.center.y=0):n={radius:0,center:e()},0===t.length)return n;if(1===t.length)return n.center.x=t[0].x,n.center.y=t[0].y,n;if(2===t.length){const[e,r]=t,[o,c]=[r.x-e.x,r.y-e.y];return n.radius=Math.sqrt(o*o+c*c)/2,n.center.x=(e.x+r.x)/2,n.center.y=(e.y+r.y)/2,n}let r=0,o=0;for(let e=0;e<t.length;e++)r+=t[e].x,o+=t[e].y;r/=t.length,o/=t.length;const c=t.map(e=>e.x-r),i=t.map(e=>e.y-o);let u=0,a=0,l=0,m=0,s=0,x=0,y=0;for(let e=0;e<c.length;e++){const t=c[e],n=i[e],r=t*t,o=n*n;u+=r,a+=o,l+=t*n,m+=r*t,s+=o*n,x+=t*o,y+=n*r}const h=.5*(m+x),D=.5*(s+y),g=u*a-l*l,f=(h*a-D*l)/g,p=(u*D-l*h)/g,b=e(f+r,p+o);return{radius:Math.sqrt(f*f+p*p+(u+a)/t.length),center:b}}function u(e){const{native:t}=e,{pointerId:n,button:r,pointerType:o}=t;return"mouse"===o?`${n}:${r}`:`${o}`}export{c as euclideanDistance,i as fitCircleLSQ,r as getDoubleClickParameters,n as getHoldAndDragParameters,u as getPointerId,o as manhattanDistance};
