import{executeQuery as e,executeCountByQuery as r}from"../../support/_query.js";import{isMapImageSublayerExtension as t}from"../../utilities/extensions.js";import{QueryProviderBase as s}from"./QueryProviderBase.js";export class ArcGISSublayerQueryProvider extends s{isSupported(e){return t(e)&&e.capabilities.supportsQuery}_query(r,t,s){const{sublayer:a}=r,i=a.createQuery();return i.where=t,i.outFields=s.outFields,i.returnGeometry=s.returnGeometry,i.outSpatialReference=s.outSpatialReference,i.maxAllowableOffset=s.maxAllowableOffset,i.returnZ=a.layer.sourceJSON?.hasZ,s.spatialFilter&&(i.spatialRelationship="intersects",i.geometry=s.spatialFilter),r.supportsPagination&&(i.num=s.maxResults),e(i,r,a,s.cancelToken)}_count(e,t,s){const{sublayer:a}=e,i=a.createQuery();return i.where=t,i.returnGeometry=s.returnGeometry,i.outFields=s.outFields,s.spatialFilter&&(i.spatialRelationship="intersects",i.geometry=s.spatialFilter),i.num=s.maxResults,r(i,e,a,s.cancelToken)}}