/* COPYRIGHT Esri - https://js.arcgis.com/5.1.2/LICENSE.txt */
import{isSome as e}from"../core/arrayUtils.js";import{convertUnit as t}from"../core/units.js";import{execute as r,executeMany as o,load as s,supportsCurves as a,isLoaded as i}from"../geometry/operators/gx/operatorGeodesicBuffer.js";import{geodeticCurveType as n}from"../geometry/operators/support/geodeticCurveType.js";let p,u,m,c,f;function l(){return!!p&&i()}async function y(){if(!l()){const[e]=await Promise.all([import("../geometry/operators/support/apiConverter.js"),s()]);p=e.fromGeometry,u=e.fromSpatialReference,m=e.getSpatialReference,c=e.toPolygon,f=a()}}function g(e,o,s={}){let{curveType:a="geodesic",maxDeviation:i=NaN,unit:f}=s;f&&(o=t(o,f,"meters"),i&&(i=t(i,f,"meters")));const l=m(e);return c(r(p(e),u(l),n[a],o,i),l)}function d(r,s,a={}){let{curveType:i="geodesic",maxDeviation:f=NaN,union:l=!1,unit:y}=a;y&&(s=s.map(e=>t(e,y,"meters")),f&&(f=t(f,y,"meters")));const g=r.map(p),d=m(r);return o(g,u(d),n[i],s,f,l).map(e=>c(e,d)).filter(e)}const v=Object.freeze(Object.defineProperty({__proto__:null,execute:g,executeMany:d,isLoaded:l,load:y,get supportsCurves(){return f}},Symbol.toStringTag,{value:"Module"}));export{d as a,g as e,v as g,l as i,y as l,f as s};
