/* COPYRIGHT Esri - https://js.arcgis.com/5.0.18/LICENSE.txt */
import{getMetersPerUnitForSR as e,getMetersPerVerticalUnitForSR as t}from"../../../core/units.js";import{set as r}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as o}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getGraphicEffectiveElevationInfo as i,zValueInAbsoluteHeightMode as n}from"../../../support/elevationInfoUtils.js";function s(o,s){const h=o?.geometry;if(!o||"mesh"!==h?.type||!s)return;const{renderCoordsHelper:f,elevationProvider:p}=s,{camera:u}=s.state,{extent:d}=h,{center:x,spatialReference:g}=d,v=e(g),j=t(g),z=e(f.spatialReference),R=d.width*v,b=d.height*j,y=(d.zmax??0)*j,C=y-(d.zmin??0)*j,w=Math.max(R,b,C)/z,{x:M,y:P}=x,S=x.z??0;r(l,M,P,S),f.toRenderCoords(l,g,l);const T=w/u.computeScreenPixelSizeAt(l);if(T>Math.min(u.width,u.height)/u.pixelRatio*a)return"meshTooClose";if(T<m)return"meshTooFar";const U=i(o),{absoluteZ:A}=n(M,P,y,g,s,U);return A<(p.getElevation(M,P,S,g,"ground")??0)*j+C*c?"meshUnderground":"mesh"}const m=20,a=1,c=.1,l=o();export{s as getDrawMeshHelpMessage};
