define(["require","exports","tslib","./esriDelegate!esri/tasks/support/ClosestFacilityParameters","../../Validation","./tools","./MapProvider","../../Hooks","esri/tasks/ClosestFacilityTask"],function(i,t,e,n,o,s,r,a,l){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),l=e.__importDefault(l);u.prototype.execute=function(i,t,e){var r=o.validation.string("url",i.url,o.validation.never),a=new n.ClosestFacilityParameters;a.facilities=o.validation.exists("facilities",i.facilities),a.incidents=o.validation.exists("incidents",i.incidents),a.accumulateAttributes=o.validation.array("accumulateAttributes",i.accumulateAttributes,void 0),a.attributeParameterValues=o.validation.exists("attributeParameterValues",i.attributeParameterValues,void 0),a.defaultCutoff=o.validation.number("defaultCutoff",i.defaultCutoff,void 0),a.defaultTargetFacilityCount=o.validation.number("defaultTargetFacilityCount",i.defaultTargetFacilityCount,void 0),a.directionsLanguage=o.validation.string("directionsLanguage",i.directionsLanguage,void 0),a.directionsLengthUnits=o.validation.string("directionsLengthUnits",i.directionsLengthUnits,void 0),a.directionsOutputType=o.validation.string("directionsOutputType",i.directionsOutputType,void 0),a.directionsStyleName=o.validation.string("directionsStyleName",i.directionsStyleName,void 0),a.directionsTimeAttribute=o.validation.string("directionsTimeAttribute",i.directionsTimeAttribute,void 0),a.doNotLocateOnRestrictedElements=o.validation.boolean("doNotLocateOnRestrictedElements",i.doNotLocateOnRestrictedElements,void 0),a.impedanceAttribute=o.validation.string("impedanceAttribute",i.impedanceAttribute,void 0),a.impedanceAttribute||(a.impedanceAttribute=o.validation.string("impedenceAttribute",i.impedenceAttribute,void 0)),a.outputGeometryPrecision=o.validation.number("outputGeometryPrecision",i.outputGeometryPrecision,void 0),a.outputGeometryPrecisionUnits=o.validation.string("outputGeometryPrecisionUnits",i.outputGeometryPrecisionUnits,void 0),a.outputLines=o.validation.string("outputLines",i.outputLines,void 0),a.pointBarriers=o.validation.exists("pointBarriers",i.pointBarriers,void 0),a.polygonBarriers=o.validation.exists("polygonBarriers",i.polygonBarriers,void 0),a.polylineBarriers=o.validation.exists("polylineBarriers",i.polylineBarriers,void 0),a.restrictionAttributes=o.validation.exists("restrictionAttributes",i.restrictionAttributes,void 0),a.restrictUTurns=o.validation.string("restrictUTurns",i.restrictUTurns,void 0),a.returnDirections=o.validation.boolean("returnDirections",i.returnDirections,void 0),a.returnFacilities=o.validation.boolean("returnFacilities",i.returnFacilities,void 0),a.returnIncidents=o.validation.boolean("returnIncidents",i.returnIncidents,void 0),a.returnPointBarriers=o.validation.boolean("returnPointBarriers",i.returnPointBarriers,void 0),a.returnPolygonBarriers=o.validation.boolean("returnPolygonBarriers",i.returnPolygonBarriers,void 0),a.returnPolylineBarriers=o.validation.boolean("returnPolylineBarriers",i.returnPolylineBarriers,void 0),a.returnRoutes=o.validation.boolean("returnRoutes",i.returnRoutes,!0),a.timeOfDay=o.validation.exists("timeOfDay",i.timeOfDay,void 0),a.timeOfDayUsage=o.validation.string("timeOfDayUsage",i.timeOfDayUsage,void 0),a.travelDirection=o.validation.string("travelDirection",i.travelDirection,void 0),a.useHierarchy=o.validation.boolean("useHierarchy",i.useHierarchy,void 0);i=o.validation.exists("outSpatialReference",i.outSpatialReference,void 0);a.outSpatialReference=e.getOutSR(i);i=new l.default(r),r=s.isAbortable(t.cancellationToken)?{signal:t.cancellationToken.signal}:void 0,r=i.solve(a,r);return s.schedulePromiseCancellation(t,r),s.inline(r,function(i){return{directions:i.directions,facilities:i.facilities,incidents:i.incidents,messages:i.messages,pointBarriers:i.pointBarriers,polygonBarriers:i.polygonBarriers,polylineBarriers:i.polylineBarriers,routes:i.routes}})},u.action="gcx:wf:arcgis::ClosestFacilityTask",u.suite="gcx:wf:builtin",r=e.__decorate([a.activate(r.MapProvider)],u);function u(){}t.ClosestFacilityTask=r});