/* COPYRIGHT Esri - https://js.arcgis.com/5.1.0/LICENSE.txt */
import o from"../../request.js";import{parseUrl as r,encode as t,asValidOptions as e}from"../utils.js";import s from"../support/AddressCandidate.js";import n from"../support/AddressesToLocationsParameters.js";async function a(s,a,c){const p=n.from(a),f=r(s),m={...p.toJSON(),f:"json"},u=t({...f.query,...m}),d=e(u,c),j=`${f.path}/geocodeAddresses`;return o(j,d).then(i)}function i(o){const{data:r}=o;if(!r)return[];const{locations:t,spatialReference:e}=r;return t?t.map(o=>{const{location:r}=o;return r&&(r.spatialReference=e),s.fromJSON(o)}):[]}export{a as addressesToLocations};
