define(["require","exports","tslib","./esriDelegate!esri/tasks/support/RouteParameters","./ArcGisApiVersion","../../Validation","./tools","./MapProvider","../../Hooks","esri/tasks/RouteTask"],function(e,i,t,a,s,u,l,r,o,d){"use strict";Object.defineProperty(i,"__esModule",{value:!0}),d=t.__importDefault(d);n.prototype.execute=function(e,i,t){var r=u.validation.string("url",e.url,u.validation.never),o=new a.RouteParameters;o.stops=u.validation.exists("stops",e.stops),o.accumulateAttributes=u.validation.array("accumulateAttributes",e.accumulateAttributes),o.attributeParameterValues=u.validation.exists("attributeParameterValues",e.attributeParameterValues,void 0);var n=(n=u.validation.exists("pointBarriers",e.pointBarriers,void 0))||u.validation.exists("barriers",e.barriers,void 0);s.isArcGisApiVersionAtLeast("4.11")?o.pointBarriers=n:o.barriers=n,o.directionsLanguage=u.validation.string("directionsLanguage",e.directionsLanguage,void 0),o.directionsLengthUnits=u.validation.string("directionsLengthUnits",e.directionsLengthUnits,void 0),o.directionsOutputType=u.validation.string("directionsOutputType",e.directionsOutputType,void 0),o.directionsStyleName=u.validation.string("directionsStyleName",e.directionsStyleName,void 0),o.directionsTimeAttribute=u.validation.string("directionsTimeAttribute",e.directionsTimeAttribute,void 0),o.doNotLocateOnRestrictedElements=u.validation.boolean("doNotLocateOnRestrictedElements",e.doNotLocateOnRestrictedElements,void 0),o.findBestSequence=u.validation.boolean("findBestSequence",e.findBestSequence,void 0),o.ignoreInvalidLocations=u.validation.boolean("ignoreInvalidLocations",e.ignoreInvalidLocations,void 0),o.impedanceAttribute=u.validation.string("impedanceAttribute",e.impedanceAttribute,void 0),o.impedanceAttribute||(o.impedanceAttribute=u.validation.string("impedenceAttribute",e.impedenceAttribute,void 0)),o.outputGeometryPrecision=u.validation.number("outputGeometryPrecision",e.outputGeometryPrecision,void 0),o.outputGeometryPrecisionUnits=u.validation.string("outputGeometryPrecisionUnits",e.outputGeometryPrecisionUnits,void 0),o.outputLines=u.validation.string("outputLines",e.outputLines,void 0),o.polygonBarriers=u.validation.exists("polygonBarriers",e.polygonBarriers,void 0),o.polylineBarriers=u.validation.exists("polylineBarriers",e.polylineBarriers,void 0),o.preserveFirstStop=u.validation.boolean("preserveFirstStop",e.preserveFirstStop,void 0),o.preserveLastStop=u.validation.boolean("preserveLastStop",e.preserveLastStop,void 0),o.restrictionAttributes=u.validation.exists("restrictionAttributes",e.restrictionAttributes,void 0),o.restrictUTurns=u.validation.string("restrictUTurns",e.restrictUTurns,void 0),o.returnBarriers=u.validation.boolean("returnBarriers",e.returnBarriers,void 0),o.returnDirections=u.validation.boolean("returnDirections",e.returnDirections,void 0),o.returnPolygonBarriers=u.validation.boolean("returnPolygonBarriers",e.returnPolygonBarriers,void 0),o.returnPolylineBarriers=u.validation.boolean("returnPolylineBarriers",e.returnPolylineBarriers,void 0),o.returnRoutes=u.validation.boolean("returnRoutes",e.returnRoutes,void 0),o.returnStops=u.validation.boolean("returnStops",e.returnStops,void 0),o.returnZ=u.validation.boolean("returnZ",e.returnZ,void 0),o.startTime=u.validation.exists("startTime",e.startTime,void 0),o.startTimeIsUTC=u.validation.boolean("startTimeIsUTC",e.startTimeIsUTC,void 0),o.useHierarchy=u.validation.boolean("useHierarchy",e.useHierarchy,void 0),o.useTimeWindows=u.validation.boolean("useTimeWindows",e.useTimeWindows,void 0);e=u.validation.exists("outSpatialReference",e.outSpatialReference,void 0);o.outSpatialReference=t.getOutSR(e);e=new d.default(r),r=l.isAbortable(i.cancellationToken)?{signal:i.cancellationToken.signal}:void 0,r=e.solve(o,r);return l.schedulePromiseCancellation(i,r),l.inline(r,function(e){return{barriers:e.barriers,messages:e.messages,polygonBarriers:e.polygonBarriers,polylineBarriers:e.polylineBarriers,routeResults:e.routeResults}})},n.action="gcx:wf:arcgis::RouteTask",n.suite="gcx:wf:builtin",r=t.__decorate([o.activate(r.MapProvider)],n);function n(){}i.RouteTask=r});