/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["exports","../../../chunks/_rollupPluginBabelHelpers","../../../core/maybe","../../../chunks/vec2","../../../chunks/vec2f64","./SnappingAlgorithm","./snappingUtils","./candidates/RightAngleTriangleSnappingCandidate","../support/viewUtils","../../support/geometry2dUtils"],(function(e,t,n,i,o,r,s,a,p,l){"use strict";let c=function(e){function r(){return e.apply(this,arguments)||this}t._inheritsLoose(r,e);var c=r.prototype;return c.snapNewVertex=function(e,t){const n=t.editGeometryOperations.data.components[0],i=[],o=n.vertices.length;if("polygon"!==t.editGeometryOperations.data.type||o<2)return i;const r=n.vertices[0],s=n.vertices[o-1];return this._processCandidateProposal(r.pos,s.pos,e,t,i),i},c.snapExistingVertex=function(e,t){const i=[],o=n.unwrap(t.vertexHandle),r=o.component;return r.edges.length<2?i:"polyline"!==t.editGeometryOperations.data.type||0!==o.index&&o.index!==r.vertices.length-1?(this._processCandidateProposal(o.leftEdge.leftVertex.pos,o.rightEdge.rightVertex.pos,e,t,i),i):i},c._processCandidateProposal=function(e,t,n,r,c){if(!this.exceedsShortLineThreshold(e,t,r))return;const d=i.lerp(o.create(),e,t,.5),g=.5*i.distance(e,t),u=l.projectPointToCircle(o.create(),n,d,g),{coordinateHelper:h,elevationInfo:f,pointer:v}=r,y=h.fromXYZ(u,h.getZ(n,0)),m=p.anyMapPointToScreenPoint(n,h,f,this.view);s.squareDistance(m,p.anyMapPointToScreenPoint(y,h,f,this.view))<this.squaredProximityTreshold(v)&&c.push(new a.RightAngleTriangleSnappingCandidate({coordinateHelper:h,targetPoint:y,point1:e,point2:t,elevationInfo:f}))},r}(r.SnappingAlgorithm);e.RightAngleTriangleSnapper=c,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
