// All material copyright Esri, All Rights Reserved, unless otherwise specified. // See https://js.arcgis.com/4.30/esri/copyright.txt for details. //>>built define(["exports","../core/unitUtils","../symbols/support/unitConversionUtils"],function(d,r,B){function t(a,b){return b?.mode?b.mode:(a?l:m).mode}function u(a,b){return null!=b?b:a?l:m}function n(a,b){return t(null!=a?a.hasZ:!1,b)}function v(a){const b=w(a);a=n(a.geometry,b);const c=null!=b&&"on-the-ground"!==a?x(b):0;return{mode:a,offset:c,featureExpressionInfo:b?.featureExpressionInfo}}function y(a){return"0"===a?.featureExpressionInfo?.expression}function p(a){if(!a||"on-the-ground"===a.mode)return!1; a=a?.featureExpressionInfo?a.featureExpressionInfo.expression:null;return!(!a||"0"===a)}function w(a){return a.layer&&"elevationInfo"in a.layer?a.layer.elevationInfo:null}function k(a,b){if(!a?.offset)return 0;const {offset:c,unit:e}=a;if("decimal-degrees"===e)return 0;a="unknown"!==e&&e?e:"meters";return(b=r.verticalLengthUnitFromSpatialReference(b))?r.convertUnit(c,a,b):0}function q(a,b,c,e,f,h,g=null){if(null!=h){var z=null!=g?g.mode:"absolute-height";if("on-the-ground"===z)return 0;({absoluteZ:h}= A(b,c,e,f,a,h));a:{g=k(g,f);switch(z){case "absolute-height":a=h-g;break a;case "relative-to-ground":a=h-((a.elevationProvider.getElevation(b,c,e,f,"ground")??0)+g);break a;case "relative-to-scene":a=h-((a.elevationProvider.getElevation(b,c,e,f,"scene")??0)+g);break a}a=void 0}return a}}function A(a,b,c,e,f,h){const g=k(h,e);switch(h.mode){case "absolute-height":return{absoluteZ:c+g,elevation:0};case "on-the-ground":return c=f.elevationProvider.getElevation(a,b,0,e,"ground")??0,{absoluteZ:c,elevation:c}; case "relative-to-ground":return a=f.elevationProvider.getElevation(a,b,c,e,"ground")??0,{absoluteZ:c+a+g,elevation:a};case "relative-to-scene":return a=f.elevationProvider.getElevation(a,b,c,e,"scene")??0,{absoluteZ:c+a+g,elevation:a}}}function x(a){return(a?.offset??0)*B.getMetersPerUnit(a?.unit)}const l={mode:"absolute-height",offset:0},m={mode:"on-the-ground",offset:null};d.absoluteHeightElevationInfo=l;d.elevationContextAffectsAlignment=function(a,b){if(null==b)return!1;({mode:b}=b);return null!= b&&("scene"===a&&"relative-to-scene"===b||"ground"===a&&"absolute-height"!==b)};d.elevationModeRequiredMessage=function(a,b,c){return c&&c.mode!==b?`${a} only support ${b} elevation mode`:null};d.elevationModeUnsupportedMessage=function(a,b,c){return c?.mode===b?`${a} do not support ${b} elevation mode`:null};d.featureExpressionInfoIsZero=y;d.featureExpressionUnsupportedMessage=function(a,b){return null!=b?.featureExpressionInfo&&"0"!==b.featureExpressionInfo.expression?`${a} do not support featureExpressionInfo`: null};d.getConvertedElevation=function(a,b,c,e=null){return q(a,b.x,b.y,b.hasZ?b.z:0,b.spatialReference,c,e)};d.getConvertedElevationFromVector=function(a,b,c,e,f=null){return q(a,b[0],b[1],2