import{executeQuery as r,executeCount as e}from"../../support/_graphicsQuery.js";import{isRouteLayer as t}from"../../utilities/_layers.js";import{_toRouteLayerGraphic as o}from"../support/_routeLayerUtils.js";import{IdentifyProviderBase as s}from"./IdentifyProviderBase.js";export class RouteLayerQueryIdentifyProvider extends s{isSupported(r,e,o){const{layer:s}=r;return t(s)&&r.capabilities.supportsQuery}_identify(e,t,o){const s={cancelToken:o.cancelToken,outFields:o.outFields??e.featureSettings.outFields,returnGeometry:o.returnGeometry,spatialFilter:t,maxResults:o.maxResults};return r("1=1",e,this._getAllGraphics(e),s)}_count(r,t,o){const s={cancelToken:o.cancelToken,spatialFilter:t,maxResults:o.maxResults};return e("1=1",r,this._getAllGraphics(r),s)}_getAllGraphics(r){const e=[...r.layer.stops?.toArray()??[],...r.layer.directionPoints?.toArray()??[],...r.layer.directionLines?.toArray()??[],...r.layer.pointBarriers?.toArray()??[],...r.layer.polylineBarriers?.toArray()??[],...r.layer.polygonBarriers?.toArray()??[]].map(o);return r.layer.routeInfo&&e.unshift(o(r.layer.routeInfo)),e}}