import { u as u2 } from "./chunk-U2FIWR5R.js"; import "./chunk-P2L4QEOI.js"; import "./chunk-D6FGJON6.js"; import { n, v as v2 } from "./chunk-HSPVIAVJ.js"; import { v } from "./chunk-XIEPNAEI.js"; import "./chunk-M5BTTMP6.js"; import "./chunk-XZA4MVET.js"; import "./chunk-VAY3LZG7.js"; import "./chunk-P4UZNLD5.js"; import "./chunk-FYNVVMWY.js"; import "./chunk-Q52DVFYK.js"; import "./chunk-HBMVUVZX.js"; import "./chunk-QOV6ITMI.js"; import "./chunk-DH2OBAUC.js"; import "./chunk-TNLRDNTC.js"; import { b } from "./chunk-UD63WBG3.js"; import "./chunk-LY74KTXV.js"; import "./chunk-EWE6EXPY.js"; import "./chunk-WNCU6BFU.js"; import "./chunk-BJHM4JNS.js"; import "./chunk-F6A2QQ26.js"; import "./chunk-7ZIDBK7B.js"; import "./chunk-EG5OI4V4.js"; import "./chunk-LRDX4TO7.js"; import "./chunk-TERAW6FT.js"; import { u } from "./chunk-N2663GRX.js"; import "./chunk-O4FY3ITT.js"; import "./chunk-UXF37FQ4.js"; import "./chunk-ZOEK6QHJ.js"; import "./chunk-XNLG7T2T.js"; import "./chunk-IR4PV7VK.js"; import "./chunk-2Z6LERTI.js"; import { c } from "./chunk-OWVBLVP3.js"; import "./chunk-MXB2XLKV.js"; import "./chunk-ALDCDSPV.js"; import "./chunk-DT6EAZQ5.js"; import "./chunk-HNOZUNJ4.js"; import "./chunk-VNFRAYHO.js"; import "./chunk-R5IG2D6H.js"; import "./chunk-VBRY5KJM.js"; import "./chunk-PDKDCAAD.js"; import "./chunk-ECW2QABR.js"; import "./chunk-GCDJLKH4.js"; import "./chunk-MRJEICT6.js"; import "./chunk-Y3WMVFTW.js"; import "./chunk-SAS7RONY.js"; import "./chunk-WSRBH7BF.js"; import "./chunk-IHXECKQQ.js"; import "./chunk-ULGDPLM2.js"; import { s, s3 as s2 } from "./chunk-EMJ4ZSM2.js"; import "./chunk-IKP3YN53.js"; import { t } from "./chunk-GZT4BVFP.js"; import "./chunk-A5ICIBVI.js"; // node_modules/@arcgis/core/views/2d/layers/features/support/whereUtils.js var t2 = s.getLogger("esri.views.2d.layers.features.support.whereUtils"); var a = { getAttribute: (e, r) => e.field(r) }; async function s3(r, s4) { const n2 = await import("./WhereClause-3WNNGKYX.js"); try { const o = n2.WhereClause.create(r, s4); if (!o.isStandardized) { const r2 = new s2("mapview - bad input", "Unable to apply filter's definition expression, as expression is not standardized.", o); t2.error(r2); } return (e) => { const r2 = e.readArcadeFeature(); return o.testFeature(r2, a); }; } catch (o) { return t2.warn("mapview-bad-where-clause", "Encountered an error when evaluating where clause", r), (e) => true; } } // node_modules/@arcgis/core/views/2d/layers/features/support/FeatureFilter.js var m = s.getLogger("esri.views.2d.layers.features.controllers.FeatureFilter"); var _ = 1; var p = 2; var y = class { constructor(t3) { this._geometryBounds = u(), this._idToVisibility = new Map(), this._serviceInfo = t3; } get hash() { return this._hash; } check(t3) { return this._applyFilter(t3); } clear() { const t3 = this._resetAllHiddenIds(); return this.update(), { show: t3, hide: [] }; } invalidate() { this._idToVisibility.forEach((t3, e) => { this._idToVisibility.set(e, 0); }); } setKnownIds(t3) { for (const e of t3) this._idToVisibility.set(e, _); } setTrue(t3) { const e = [], i = [], s4 = new Set(t3); return this._idToVisibility.forEach((t4, r) => { const o = !!(this._idToVisibility.get(r) & _), h = s4.has(r); !o && h ? e.push(r) : o && !h && i.push(r), this._idToVisibility.set(r, h ? _ | p : 0); }), { show: e, hide: i }; } createQuery() { const { geometry: t3, spatialRel: e, where: i, timeExtent: s4, objectIds: r } = this; return b.fromJSON({ geometry: t3, spatialRel: e, where: i, timeExtent: s4, objectIds: r }); } async update(t3, e) { this._hash = JSON.stringify(t3); const i = await v(t3, null, e); await Promise.all([this._setGeometryFilter(i), this._setIdFilter(i), this._setAttributeFilter(i), this._setTimeFilter(i)]); } async _setAttributeFilter(t3) { if (!t3 || !t3.where) return this._clause = null, void (this.where = null); this._clause = await s3(t3.where, this._serviceInfo.fieldsIndex), this.where = t3.where; } _setIdFilter(t3) { this._idsToShow = t3 && t3.objectIds && new Set(t3.objectIds), this._idsToHide = t3 && t3.hiddenIds && new Set(t3.hiddenIds), this.objectIds = t3 && t3.objectIds; } async _setGeometryFilter(t3) { if (!t3 || !t3.geometry) return this._spatialQueryOperator = null, this.geometry = null, void (this.spatialRel = null); const e = t3.geometry, i = t3.spatialRel || "esriSpatialRelIntersects", s4 = await v2(i, e, this._serviceInfo.geometryType, this._serviceInfo.hasZ, this._serviceInfo.hasM); c(this._geometryBounds, e), this._spatialQueryOperator = s4, this.geometry = e, this.spatialRel = i; } _setTimeFilter(e) { if (this.timeExtent = this._timeOperator = null, e && e.timeExtent) if (this._serviceInfo.timeInfo) this.timeExtent = e.timeExtent, this._timeOperator = n(this._serviceInfo.timeInfo, e.timeExtent, u2); else { const i = new s2("feature-layer-view:time-filter-not-available", "Unable to apply time filter, as layer doesn't have time metadata.", e.timeExtent); m.error(i); } } _applyFilter(t3) { return this._filterByGeometry(t3) && this._filterById(t3) && this._filterByTime(t3) && this._filterByExpression(t3); } _filterByExpression(t3) { return !this.where || this._clause(t3); } _filterById(t3) { return (!this._idsToHide || !this._idsToHide.size || !this._idsToHide.has(t3.getObjectId())) && (!this._idsToShow || !this._idsToShow.size || this._idsToShow.has(t3.getObjectId())); } _filterByGeometry(t3) { if (!this.geometry) return true; const e = t3.readHydratedGeometry(); return !!e && this._spatialQueryOperator(e); } _filterByTime(t3) { return !!t(this._timeOperator) || this._timeOperator(t3); } _resetAllHiddenIds() { const t3 = []; return this._idToVisibility.forEach((e, i) => { e & _ || (this._idToVisibility.set(i, _), t3.push(i)); }), t3; } }; export { y as default }; //# sourceMappingURL=FeatureFilter-DN2CX36X.js.map