import{executeQuery as e,executeCountByQuery as r}from"../../support/_query.js";import{empty as t}from"../../utilities/asyncIterable.js";import{isMapImageSublayer as s}from"../../utilities/layers.js";import{IdentifyProviderBase as u}from"./IdentifyProviderBase.js";export class ArcGISSublayerQueryIdentifyProvider extends u{isSupported(e,r,t){return s(e.sublayer)&&e.capabilities.supportsQuery}_identify(r,s,u){const o=r,a=o.sublayer.createQuery();return o.capabilities.supportsQuery?(a.geometry=s,a.outFields=u.outFields??r.featureSettings.outFields,a.returnGeometry=u.returnGeometry,a.outSpatialReference=u.outSpatialReference,a.maxAllowableOffset=u.maxAllowableOffset,a.returnZ=o.sublayer.layer.sourceJSON?.hasZ,r.supportsPagination&&(a.num=u.maxResults),e(a,o,o.sublayer,u.cancelToken)):t()}async _count(e,t,s){const u=e;if(!u.capabilities.supportsQuery)return{source:e,count:0};const o=u.sublayer.createQuery();return o.geometry=t,o.num=s.maxResults,o.returnGeometry=s.returnGeometry,o.outFields=s.outFields??e.featureSettings.outFields,r(o,u,u.sublayer,s.cancelToken)}}