import{executeQuery as e,executeCount as t}from"../../support/_query.js";import{isGeoJSONLayer as r}from"../../utilities/_layers.js";import{removeZValues as s}from"../../utilities/geometry.js";import{QueryProviderBase as a}from"./QueryProviderBase.js";export class GeoJSONLayerClientSideQueryProvider extends a{isSupported(e){const{layer:t}=e;return r(t)}_query(t,r,a){const{layer:i}=t,o=i.createQuery();o.where=r,o.outFields=a.outFields,o.returnGeometry=a.returnGeometry,o.outSpatialReference=a.outSpatialReference,o.maxAllowableOffset=a.maxAllowableOffset,o.returnZ=i.hasZ;let l=a.spatialFilter;return l&&(o.spatialRelationship="intersects",i.capabilities?.data?.supportsZ||(l=s(l.clone())),o.geometry=l),i.capabilities.query.supportsPagination&&(o.num=a.maxResults),e(o,t,i,a.cancelToken)}async _count(e,r,a){const{layer:i}=e,o=i.createQuery();o.where=r,o.outFields=a.outFields,o.returnGeometry=a.returnGeometry;let l=a.spatialFilter;return l&&(o.spatialRelationship="intersects",l&&!i.capabilities?.data?.supportsZ&&(l=s(l.clone())),o.geometry=l),o.num=a.maxResults,t(o,e,i,a.cancelToken)}}