/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
import{getMetersPerUnitForSR as e}from"../../../core/units.js";import n from"../../../geometry/Extent.js";import{getWebMercatorScalingFactor as t}from"../../../layers/orientedImagery/transformations/utils.js";import{clockwiseDirections as r}from"../constants.js";function o(r,o){const{x:s,y:i,spatialReference:f}=r,a=o*t(i,f)/e(f);return new n({xmin:s-a,xmax:s+a,ymin:i-a,ymax:i+a,spatialReference:r.spatialReference})}function s(e){return!e||null===e.previous||null===e.next}function i(e,n,t=1){if(null==e[n])return!0;const o=e=>e?r.reduce((n,t)=>e[t]?n+1:n,0):0,s=new Set,i=[{node:e,depth:0}];for(;i.length;){const{node:e,depth:n}=i.shift();if(e&&!s.has(e)){if(s.add(e),o(e)<2)return!0;if(n<t)for(const t of r){const r=e[t];r&&!s.has(r)&&i.push({node:r,depth:n+1})}}}return!1}export{o as createExtentAroundPoint,i as shouldQueryAndNavigate,s as shouldQueryAndNavigateSequentially};
