/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
import e from"../../request.js";import{getJsonType as t}from"../../geometry/support/jsonTypeUtils.js";import{fromJSON as r}from"../../geometry/support/jsonUtils.js";import{parseUrl as o}from"../utils.js";import{encodeGeometries as s}from"./utils.js";async function i(i,m,p,n){const f=m[0].spatialReference,y=o(i);let g={query:{...y.query,f:"json",sr:JSON.stringify(f.toJSON()),geometries:JSON.stringify(s(m)),geometry:JSON.stringify({geometryType:t(p),geometry:p.toJSON()})}};return n&&(g={...n,...g}),e(y.path+"/difference",g).then(({data:e})=>(e.geometries||[]).map(e=>r(e).set({spatialReference:f})))}export{i as difference};
