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