/*
All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
*/
class t{filter(t,n){return n}notifyElevationSourceChange(){}}class n{filter(t,n){const{point:r,distance:c}=t,{z:i}=r;if(!(null!=i))return n;if(0===n.length)return n;const a=o(c),u=this._updateCandidatesTo3D(n,r,a).filter(e);return u.sort(s),u}_updateCandidatesTo3D(t,n,e){for(const r of t)switch(r.type){case"edge":c(r,n,e);continue;case"vertex":a(r,n,e);continue}return t}}function e(t){return t.distance<=1}function r(e=!1){return e?new n:new t}function c(t,n,{x:e,y:r,z:c}){const{start:a,end:o,target:s}=t;t.draped||i(s,n,a,o);const u=(n.x-s.x)/e,d=(n.y-s.y)/r,f=(n.z-s.z)/c;t.distance=Math.sqrt(u*u+d*d+f*f)}function i(t,n,e,r){const c=r.x-e.x,i=r.y-e.y,a=r.z-e.z,o=c*c+i*i+a*a,s=(n.x-e.x)*c+(n.y-e.y)*i+a*(n.z-e.z),u=Math.min(1,Math.max(0,s/o)),d=e.x+c*u,f=e.y+i*u,x=e.z+a*u;t.x=d,t.y=f,t.z=x}function a(t,n,{x:e,y:r,z:c}){const{target:i}=t,a=(n.x-i.x)/e,o=(n.y-i.y)/r,s=(n.z-i.z)/c,u=Math.sqrt(a*a+o*o+s*s);t.distance=u}function o(t){return"number"==typeof t?{x:t,y:t,z:t}:t}function s(t,n){return t.distance-n.distance}export{r as getSnappingCandidateElevationFilter};
