/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
import{e as c}from"./YQHYMLC7.js";import{a as y}from"./AJZDBHB6.js";var u=t=>{let[[e,n],[r,o]]=t;return f(e,n,r,o)},g=t=>t.map(e=>e.join(", ")).join(", ");function f(t,e,n,r,o=4326){return{xmin:t,ymin:e,xmax:n,ymax:r,spatialReference:{wkid:o}}}function h(t){return[[t.xmin,t.ymin],[t.xmax,t.ymax]]}var m={xmin:-180,ymin:-90,xmax:180,ymax:90,spatialReference:{wkid:4326}};function E(t){let e=t.portalSelf,n=e.defaultExtent,r=y(e,"helperServices.geometry.url");if(!r||!n)return Promise.resolve(m);let o=`${r}/project`,i={httpMethod:"POST",params:{geometries:JSON.stringify({geometryType:"esriGeometryEnvelope",geometries:[n]}),transformForward:!1,transformation:"",inSR:n.spatialReference.wkid,outSR:4326,f:"json"}};return t.authentication&&(i.authentication=t.authentication),c(o,i).then(a=>{let x=a.geometries[0];return{xmin:x.xmin,ymin:x.ymin,xmax:x.xmax,ymax:x.ymax,spatialReference:{wkid:4326}}}).catch(a=>m)}var d=t=>Array.isArray(t)&&Array.isArray(t[0])&&Array.isArray(t[1]);var S=t=>{let e=[].concat(...t);for(let n=0;n<e.length;n+=2){let[r,o]=[e[n],e[n+1]];if(o<-90||o>90||r<-180||r>180)return!1}return!0},B=t=>{let e=1/0,n=1/0,r=-1/0,o=-1/0;for(let s of t.coordinates)for(let[i,a]of s)e=Math.min(e,i),n=Math.min(n,a),r=Math.max(r,i),o=Math.max(o,a);return[[e,n],[r,o]]};export{u as a,g as b,h as c,E as d,d as e,S as f,B as g};
