/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["exports","../core/maybe","../symbols/support/unitConversionUtils"],(function(e,t,o){"use strict";function n(e,o){return t.isNone(o)||!o.mode?e?"absolute-height":"on-the-ground":o.mode}function r(e,o){return n(!!t.isSome(e)&&e.hasZ,o)}function i(e){const t=u(e);return r(e.geometry,t)}function s(e){const n=u(e),i=r(e.geometry,n);return{mode:i,offset:t.isSome(n)&&"on-the-ground"!==i?t.unwrapOr(n.offset,0)*o.getMetersPerUnit(t.unwrapOr(n.unit,"meters")):0}}function a(e){if("on-the-ground"===i(e))return!1;const o=u(e),n=t.isSome(o)&&o.featureExpressionInfo?o.featureExpressionInfo.expression:null;return!(!n||"0"===n)}function u(e){return e.layer&&"elevationInfo"in e.layer?e.layer.elevationInfo:null}function l(e,o,n){if(t.isNone(n)||!n.mode)return;const r=e.hasZ?e.z:0,i=t.isSome(n.offset)?n.offset:0;switch(n.mode){case"absolute-height":return r-i;case"on-the-ground":return 0;case"relative-to-ground":return r-(t.unwrapOr(o.elevationProvider.getElevation(e.x,e.y,e.z,e.spatialReference,"ground"),0)+i);case"relative-to-scene":return r-(t.unwrapOr(o.elevationProvider.getElevation(e.x,e.y,e.z,e.spatialReference,"scene"),0)+i)}}function c(e,t,o,n=null){return v(e,t.x,t.y,t.hasZ?t.z:0,t.spatialReference,o,n)}function f(e,t,o,n,r=null){return v(e,t[0],t[1],t.length>2?t[2]:0,o,n,r)}function v(e,o,n,r,i,s,a=null){if(t.isNone(s))return;const u=t.isSome(a)?a.mode:"absolute-height";if("on-the-ground"===u)return 0;const{absoluteZ:l}=g(o,n,r,i,e,s);return d(l,o,n,r,i,e,a,u)}function g(e,o,n,r,i,s){const a=t.isSome(s.offset)?s.offset:0;switch(s.mode){case"absolute-height":return{absoluteZ:n+a,elevation:0};case"on-the-ground":{const n=t.unwrapOr(i.elevationProvider.getElevation(e,o,0,r,"ground"),0);return{absoluteZ:n,elevation:n}}case"relative-to-ground":{const s=t.unwrapOr(i.elevationProvider.getElevation(e,o,n,r,"ground"),0);return{absoluteZ:n+s+a,elevation:s}}case"relative-to-scene":{const s=t.unwrapOr(i.elevationProvider.getElevation(e,o,n,r,"scene"),0);return{absoluteZ:n+s+a,elevation:s}}}}function d(e,o,n,r,i,s,a,u){const l=t.isSome(a)&&t.isSome(a.offset)?a.offset:0;switch(u){case"absolute-height":return e-l;case"relative-to-ground":return e-(t.unwrapOr(s.elevationProvider.getElevation(o,n,r,i,"ground"),0)+l);case"relative-to-scene":return e-(t.unwrapOr(s.elevationProvider.getElevation(o,n,r,i,"scene"),0)+l)}}const h={mode:"absolute-height",offset:0};e.absoluteHeightElevationInfo=h,e.getConvertedElevation=c,e.getConvertedElevationFromVector=f,e.getEffectiveElevationMode=n,e.getGeometryEffectiveElevationMode=r,e.getGraphicEffectiveElevationInfo=s,e.getGraphicEffectiveElevationMode=i,e.getZForElevationMode=l,e.hasGraphicFeatureExpressionInfo=a,e.zValueInAbsoluteHeightMode=g,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
