/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["exports","../../chunks/_rollupPluginBabelHelpers","../../request","../utils","./support/TraceResult"],(function(e,t,r,n,o){"use strict";function a(e,t,r){return s.apply(this,arguments)}function s(){return(s=t._asyncToGenerator((function*(e,t,o){const a=n.parseUrl(e),s=t.toJSON();s.traceLocations=JSON.stringify(t.traceLocations),t.resultTypes&&(s.resultTypes=JSON.stringify(t.resultTypes));const i={...s,f:"json"},u=n.encode({...a.query,...i}),c=n.asValidOptions(u,o),g=`${a.path}/trace`;return r(g,c).then((e=>l(e,t.outSpatialReference)))}))).apply(this,arguments)}function l(e,t){const{data:r}=e;if(!r)return null;const n=o.fromJSON(r.traceResults);return n.aggregatedGeometry&&t&&(n.aggregatedGeometry.line&&(n.aggregatedGeometry.line.spatialReference=t.clone()),n.aggregatedGeometry.multipoint&&(n.aggregatedGeometry.multipoint.spatialReference=t.clone()),n.aggregatedGeometry.polygon&&(n.aggregatedGeometry.polygon.spatialReference=t.clone())),n}e.trace=a,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
