import{__decorate}from"tslib";import{validation}from"../../Validation.js";import{inline,isAbortable,schedulePromiseCancellation}from"./tools.js";import{MapProvider}from"./MapProvider.js";import{activate}from"../../Hooks.js";import Geoprocessor from"@arcgis/core/tasks/Geoprocessor";let Geoprocessing=class{execute(e,o,r){var s=validation.string("url",e.url,validation.never);const i=new Geoprocessor(s);i.outSpatialReference=r.getOutSR(e.outSpatialReference),i.processSpatialReference=r.getOutSR(e.processSpatialReference);r=validation.exists("arguments",e.arguments,{}),e=isAbortable(o.cancellationToken)?{signal:o.cancellationToken.signal}:void 0,e=i.execute(r,e);return schedulePromiseCancellation(o,e),inline(e,function(e){const o={};for(const r of Array.isArray(e)?e:e.results)o[r.paramName]=r.value;return{messages:Array.isArray(e)?[]:e.messages,results:o}})}};Geoprocessing.action="gcx:wf:arcgis::Geoprocessing",Geoprocessing.suite="gcx:wf:builtin",Geoprocessing=__decorate([activate(MapProvider)],Geoprocessing);export{Geoprocessing};