import{cancelifyWithAbortSignal as e}from"../../support/Cancellable.js";import{isPoint as t}from"../../utilities/esri.js";import{isFeatureLayer as i}from"../../utilities/layers.js";import{ClientSideIdentifyProvider as r}from"./ClientSideIdentifyProvider.js";import{hitTestForClusterFeatures as a}from"./_utilities.js";export class FeatureLayerClientSideIdentifyProvider extends r{isSupported(e,r,a){return i(e.layer)&&e.enableClientSideData&&r&&!!e._layerView?.view?.extent?.intersects(t(r)?r:r.extent)&&0!==e._layerView.availableFields.length&&(a?.outFields??e.featureSettings.outFields).every((t=>e._layerView.availableFields.includes(t)))}async _getClientSideLayerGraphics(t,i,r,l){let s=[];if("cluster"===t.layer?.featureReduction?.type&&"point"===l&&(s=await a(t,i)),s.length>0){const{_layerView:i}=t,a=await e((async e=>i.queryFeatures(super._createQuery(t,void 0,r,s.map((e=>e.getObjectId()??void 0))))),r.cancelToken);if(a?.features.length>0)return a.features}return super._getClientSideLayerGraphics(t,i,r)}}