/* COPYRIGHT Esri - https://js.arcgis.com/5.1.2/LICENSE.txt */
import{Cyclical as t}from"../../../../core/Cyclical.js";import{height as e,fromExtent as n}from"../../../../geometry/support/aaBoundingRect.js";import{getInfo as i}from"../../../../geometry/support/spatialReferenceUtils.js";class o{constructor(t,e,n,i,o){this.extent=t,this.timeExtent=e,this.size=n,this.pixelRatio=i,this.time=o}get flowExtentInfo(){return{modelSize:this.size,valid:i(this.extent.spatialReference)?.valid,extent:n(this.extent)}}insideMapExtent(t,e){return r(this.flowExtentInfo,t,e)}modelToMapSpace(t,e,n){return l(this.flowExtentInfo,t,e,n)}}function r(t,e,n){const{extent:i,valid:o}=t,[r,l,s,a]=i;return!(n<l||n>a)&&(null!=o&&r>s?e>=s||e<=r:e>=r&&e<=s)}function l(n,i,o,r){const{extent:l,modelSize:s,valid:u}=n,[c,f,x]=l,m=a(c,x,u);let p=i/s[0]*m+c;if(null!=u&&r){p=new t(u[0],u[1]).normalize(p)}return[p,(s[1]-o)/s[1]*e(l)+f]}function s(t,e,n){return null!=n&&Math.abs(t-n.valid[0])<n.dx&&Math.abs(e-n.valid[1])<n.dx}function a(t,e,n){if(null!=n&&t>e){const[i,o]=n;return o-t+(e-i)}return e-t}export{o as FlowQuery3D,r as insideMapExtent,s as isFullExtent,l as modelToMapSpace,a as wrappedWidth};
