/*
All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
*/
import{isSome as e}from"../core/arrayUtils.js";import{convertUnit as t}from"../core/units.js";import{load as r,isLoaded as o,supportsCurves as s,execute as a,executeMany 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&&o()}async function y(){if(!l()){const[e]=await Promise.all([import("../geometry/operators/support/apiConverter.js"),r()]);p=e.fromGeometry,u=e.fromSpatialReference,m=e.getSpatialReference,c=e.toPolygon,f=s()}}function g(e,r,o={}){let{curveType:s="geodesic",maxDeviation:i=NaN,unit:f}=o;f&&(r=t(r,f,"meters"),i&&(i=t(i,f,"meters")));const l=m(e);return c(a(p(e),u(l),n[s],r,i),l)}function d(r,o,s={}){let{curveType:a="geodesic",maxDeviation:f=NaN,union:l=!1,unit:y}=s;y&&(o=o.map(e=>t(e,y,"meters")),f&&(f=t(f,y,"meters")));const g=r.map(p),d=m(r);return i(g,u(d),n[a],o,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};
