/* COPYRIGHT Esri - https://js.arcgis.com/5.1.2/LICENSE.txt */
import{ElevationSamplerData as a}from"./ElevationSamplerData.js";class t{constructor(t,e=null){if(this.key=t,null!=e){const s=t.extent;this._samplerData=new a(e,s)}}get zmin(){return null!=this._samplerData?this._samplerData.data.minValue:0}get zmax(){return null!=this._samplerData?this._samplerData.data.maxValue:0}get hasNoDataValues(){return!!this._samplerData?.data.hasNoDataValues}sample(a,t){if(null==this._samplerData)return;const{safeWidth:s,data:l,dx:r,dy:n,y1:i,x0:u}=this._samplerData,{width:o,values:m,noDataValue:h}=l,p=e(n*(i-t),0,s),D=e(r*(a-u),0,s),d=Math.floor(p),f=Math.floor(D),_=d*o+f,c=_+o,x=m[_],V=m[c],g=m[_+1],y=m[c+1];if(x!==h&&V!==h&&g!==h&&y!==h){const a=D-f,t=x+(g-x)*a;return t+(V+(y-V)*a-t)*(p-d)}}}function e(a,t,e){return a<t?t:a>e?e:a}export{t as ElevationTile};
