/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
import{JSONMap as e}from"../../core/jsonMap.js";import{getJsonType as t}from"../../geometry/support/jsonTypeUtils.js";const o=new e({esriGeometryOffsetBevelled:"bevelled",esriGeometryOffsetMitered:"mitered",esriGeometryOffsetRounded:"rounded"}),s=new e({9001:"meters",9002:"feet",9036:"kilometers",9093:"miles",109012:"nautical-miles",109001:"yards"});function r(e){const{geometries:r,bevelRatio:i,offsetDistance:f,offsetHow:n,offsetUnit:m}=e.toJSON(),l={bevelRatio:i,offsetDistance:f};return r&&r.length&&(l.geometries=JSON.stringify({geometryType:t(r[0]),geometries:r}),l.sr=JSON.stringify(r[0].spatialReference)),n&&(l.offsetHow=o.toJSON(n)),m&&(l.offsetUnit=s.toJSON(m)),l}export{r as offsetToRESTParameters};
