/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
import { c as w } from "../../chunks/runtime.js";
import { e as L, h as S, c as m } from "../../chunks/mapViewUtils.js";
import { c as v, g as C, d as V } from "../../chunks/queryUtils.js";
import { u as $ } from "../../chunks/useT9n.js";
import { css as k, html as c } from "lit";
import { createRef as d, ref as u } from "lit-html/directives/ref.js";
import { LitElement as I, createEvent as G, noShadowRoot as T, safeClassMap as f, safeStyleMap as O } from "@arcgis/lumina";
import { useContextConsumer as E } from "@arcgis/lumina/context";
import { p as F } from "../../chunks/publicNotificationContext.js";
import D from "@arcgis/core/request.js";
import x from "@arcgis/core/layers/FeatureLayer.js";
import b from "@arcgis/core/Graphic.js";
import R from "@arcgis/core/layers/GraphicsLayer.js";
const N = k`@layer{:host{display:block}.div-visible{display:inherit}.div-not-visible{display:none}.padding-bottom-1{padding-bottom:1rem}.padding-top-1{padding-top:1rem}.search-widget{width:100%!important;border:1px solid var(--calcite-color-border-input)}.w-100{width:100%}.search-distance{display:flex;padding-top:1rem}.font-bold{font:bold}.border-bottom{border-bottom:1px solid var(--calcite-color-border-2)}.tooltip-container{display:flex}.padding-start-1-2{padding-inline-start:.5rem}.padding-end-1-2{padding-inline-end:.5rem}.icon{--calcite-color-icon-color: var(--calcite-color-brand)}.tooltip-message{padding:5px 8px;font-weight:var(--calcite-font-weight-normal);color:var(--calcite-color-text-2);max-width:400px}}`;
class U extends I {
  constructor() {
    super(), this.bufferColor = [227, 139, 79, 0.8], this.bufferOutlineColor = [255, 255, 255], this.customLabelEnabled = !1, this.enabledLayerIds = [], this.enableLayerFeatures = !0, this.enableLayerFeaturesOnLoad = !1, this.enableSearchDistance = !0, this.enableSearchDistanceOnLoad = !1, this.enableSketchTools = !0, this.geometries = [], this.headerLabelClass = "font-bold", this.isUpdate = !1, this.layerViews = [], this.noResultText = "", this.selectionLayerIds = [], this.searchDistanceEnabled = !1, this.useLayerFeaturesEnabled = !1, this._numSelected = 0, this._searchTerm = "", this._selectionLoading = !1, this._translations = $({ name: "map-select-tools", blocking: !0 }), this._bufferTools = d(), this._drawTools = d(), this._labelName = d(), this._pnContextConsumer = E({
      context: F,
      subscribe: !0
    }), this._searchElement = d(), this._selectedIds = [], this._selectionLabel = "", this._graphics = [], this._featuresCollection = {}, this.selectionSetChange = G(), this.listenOn(window, "searchConfigurationChange", this.searchConfigurationChangeChanged), this.listenOn(window, "distanceChanged", this.distanceChanged), this.listenOn(window, "unitChanged", this.unitChanged);
  }
  static {
    this.properties = { bufferColor: 1, bufferOutlineColor: 1, customLabelEnabled: 5, enabledLayerIds: 0, enableLayerFeatures: 5, enableLayerFeaturesOnLoad: 5, enableSearchDistance: 5, enableSearchDistanceOnLoad: 5, enableSketchTools: 5, defaultBufferDistance: 9, defaultBufferUnit: 1, geometries: 0, headerLabelClass: 1, isUpdate: 5, layerViews: 0, mapView: 0, noResultText: 1, searchConfiguration: 0, selectionSet: 0, selectionLayerIds: 0, selectLayerView: 0, sketchLineSymbol: 0, sketchPointSymbol: 0, sketchPolygonSymbol: 0, searchDistanceEnabled: 5, useLayerFeaturesEnabled: 5, _numSelected: 16, _searchTerm: 16, _selectionLoading: 16, _translations: 16 };
  }
  static {
    this.styles = N;
  }
  static {
    this.shadowRootOptions = T;
  }
  willUpdate(e) {
    e.has("geometries") && (this.hasUpdated || this.geometries?.length > 0) && this.watchGeometriesHandler(this.geometries, e.get("geometries")), e.has("mapView") && this.mapView && this.mapViewWatchHandler(this.mapView, e.get("mapView")), e.has("defaultBufferUnit") && this.hasUpdated && (this.selectionSet && (this.selectionSet.unit = this.defaultBufferUnit), this._bufferTools.value && this.defaultBufferUnit !== void 0 && (this._bufferTools.value.unit = this.defaultBufferUnit), this._updateLabel()), e.has("defaultBufferDistance") && this.hasUpdated && (this.selectionSet && (this.selectionSet.distance = this.defaultBufferDistance), this._updateLabel());
  }
  async watchGeometriesHandler(e, t) {
    if (e !== t && e.length > 0)
      return this._highlightWithOIDsOrGeoms();
  }
  async mapViewWatchHandler(e, t) {
    e && e !== t && await this._init();
  }
  async clearSelection() {
    return this._clearResults(!0, !0);
  }
  async getSelection() {
    return /\S+/gm.test(this._selectionLabel) || await this._updateLabel(), {
      id: this.isUpdate && this.selectionSet ? this.selectionSet.id : Date.now(),
      searchResult: this._searchResult,
      buffer: this._bufferGeometry,
      distance: this._bufferTools.value?.distance,
      download: !0,
      unit: this._bufferTools.value?.unit,
      label: this._selectionLabel,
      selectedIds: this._selectedIds,
      layerView: this.selectLayerView,
      geometries: this.geometries,
      graphics: this._graphics,
      selectLayers: this.layerViews,
      skipGeomOIDs: this._skipGeomOIDs,
      searchDistanceEnabled: this.searchDistanceEnabled,
      workflowType: this._workflowType,
      useLayerFeaturesEnabled: this.useLayerFeaturesEnabled,
      sketchGraphic: this._sketchGraphic
    };
  }
  searchConfigurationChangeChanged(e) {
    this.searchConfiguration = e.detail;
  }
  async distanceChanged(e) {
    await this._distanceChanged(e.detail);
  }
  async unitChanged(e) {
    e.detail.newValue !== e.detail.oldValue && (this._unit = e.detail.newValue, await this._updateLabel());
  }
  async loaded() {
    await this._init();
  }
  render() {
    const e = this.enableSketchTools ? "" : "display-none", t = this.enableSketchTools ? "padding-top-1" : "", s = this.searchConfiguration && this.mapView ? this._getSearchConfig(this.searchConfiguration, this.mapView) : void 0, i = this.searchConfiguration?.allPlaceholder && this.searchConfiguration.allPlaceholder.toLowerCase() !== "find address or place" ? this.searchConfiguration.allPlaceholder : this._translations.placeholder;
    return c`${this._getMapLayerPicker()}<div class="border-bottom"></div><div class="padding-top-sides-1"><arcgis-search class="search-widget" .activeSourceIndex=${s?.activeSourceIndex} .allPlaceholder=${i} .includeDefaultSourcesDisabled=${s?.includeDefaultSources === !1} @arcgisSearchClear=${() => {
      this._handleSearchClear();
    }} @arcgisSelectResult=${(a) => {
      this._handleSearchSelectResult(a);
    }} popup-disabled result-graphic-disabled .searchAllDisabled=${s?.searchAllEnabled === !1} .searchTerm=${this._searchTerm} .sources=${s?.sources} .view=${this.mapView} ${u(this._searchElement)}></arcgis-search><div class=${f(t)}><map-draw-tools active class=${f(e)} .editGraphicsEnabled=${!this.useLayerFeaturesEnabled} .graphics=${this._graphics} .mapView=${this.mapView} @sketchGraphicsChange=${(a) => {
      this._sketchGraphicsChanged(a);
    }} .pointSymbol=${this.sketchPointSymbol} .polygonSymbol=${this.sketchPolygonSymbol} .polylineSymbol=${this.sketchLineSymbol} ${u(this._drawTools)}></map-draw-tools></div>${this.enableSearchDistance ? this._getBufferOptions() : void 0}${this.enableLayerFeatures ? this._getUseLayerFeaturesOptions() : void 0}${this._getNumSelected()}</div><div class="border-bottom"></div>${this._getNameInput()}`;
  }
  _getBufferOptions() {
    this.enableSearchDistanceOnLoad && (this.searchDistanceEnabled = !0, this.enableSearchDistanceOnLoad = !1);
    const e = this.searchDistanceEnabled ? "search-distance" : "div-not-visible", t = typeof this.selectionSet?.distance == "number" ? this.selectionSet.distance : this.defaultBufferDistance;
    return c`<div><div class="padding-top-1 display-flex"><calcite-label class="label-margin-0 w-100" layout=inline-space-between><div class="tooltip-container">${this._translations.searchDistance}<calcite-icon aria-hidden=true class="padding-start-1-2 icon" .flipRtl=${this._translations._lang?.toLowerCase() !== "he"} icon=question id=search-distance-icon scale=s></calcite-icon></div></calcite-label><calcite-popover closable label overlay-positioning=fixed reference-element=search-distance-icon><span class="tooltip-message">${this._translations.useSearchDistanceTootip}</span></calcite-popover><calcite-switch .checked=${this.searchDistanceEnabled} @calciteSwitchChange=${() => this.searchDistanceEnabled = !this.searchDistanceEnabled}></calcite-switch></div><div class=${f(e)}><buffer-tools .disabled=${!this.searchDistanceEnabled} .distance=${t} .geometries=${this.geometries} @bufferComplete=${(s) => {
      this._bufferComplete(s);
    }} .unit=${this.selectionSet?.unit || this.defaultBufferUnit} ${u(this._bufferTools)}></buffer-tools></div></div>`;
  }
  _getUseLayerFeaturesOptions() {
    this.enableLayerFeaturesOnLoad && (this.useLayerFeaturesEnabled = !0, this.enableLayerFeaturesOnLoad = !1);
    const e = this.useLayerFeaturesEnabled ? "div-visible" : "div-not-visible";
    return c`<div><div class="padding-top-1 display-flex"><calcite-label class="label-margin-0 w-100" layout=inline-space-between><div class="tooltip-container">${this._translations.useLayerFeatures}<calcite-icon aria-hidden=true class="padding-start-1-2 icon" .flipRtl=${this._translations._lang?.toLowerCase() !== "he"} icon=question id=use-layer-features-icon scale=s></calcite-icon></div></calcite-label><calcite-popover closable label overlay-positioning=fixed reference-element=use-layer-features-icon><span class="tooltip-message">${this._translations.useLayerFeaturesTooltip}</span></calcite-popover><calcite-switch .checked=${this.useLayerFeaturesEnabled} @calciteSwitchChange=${() => {
      this._useLayerFeaturesEnabledChanged();
    }}></calcite-switch></div><div class=${`${e} padding-top-1`}><map-layer-picker .enabledLayerIds=${this.selectionLayerIds} .mapView=${this.mapView} @layerSelectionChange=${(t) => {
      this._layerSelectionChange(t);
    }} .selectedIds=${this.layerViews.map((t) => t.layer.id)}></map-layer-picker></div></div>`;
  }
  _getNumSelected() {
    const e = this._translations._lang === "en" ? `${this._translations.selectionLoading}...` : this._translations.selectionLoading;
    return c`<div class="padding-top-1 padding-bottom-1" style=${O({ "align-items": "end", display: "flex" })}>${this._selectionLoading ? c`<div><calcite-loader class="info-blue padding-end-1-2" inline .label=${e || ""} scale=m type=indeterminate></calcite-loader></div>` : c`<calcite-icon aria-hidden=true class="info-blue padding-end-1-2" icon=feature-layer scale=s></calcite-icon>`}<calcite-input-message class="info-blue" scale=m>${this._selectionLoading ? e : this.noResultText && this._numSelected === 0 ? this.noResultText : this._translations.selectedFeatures.replace("{{n}}", this._numSelected.toString())}</calcite-input-message></div>`;
  }
  _getNameInput() {
    const e = this.customLabelEnabled ? "" : "display-none";
    return c`<div class=${`padding-sides-1 padding-top-1 ${e}`}><calcite-label class=${f(this.headerLabelClass)}>${this._translations.listName}<calcite-input @input=${() => {
      this._selectionLabel = this._labelName.value ? this._labelName.value.value : "";
    }} .placeholder=${this._translations.listNamePlaceholder} .value=${this._selectionLabel || ""} ${u(this._labelName)}></calcite-input></calcite-label></div>`;
  }
  _getMapLayerPicker() {
    const e = this.selectionSet?.layerView?.layer.id;
    return c`<div class="display-flex padding-sides-1 padding-bottom-1"><calcite-label class=${`${this.headerLabelClass} width-full label-margin-0`}>${this._translations.inputLayer}<map-layer-picker .enabledLayerIds=${this.enabledLayerIds} .mapView=${this.mapView} @layerSelectionChange=${(t) => {
      this._inputLayerSelectionChange(t);
    }} .selectedIds=${this.selectLayerView ? [this.selectLayerView.layer.id] : this.selectionSet && e !== void 0 ? [e] : []}></map-layer-picker></calcite-label></div>`;
  }
  async _init() {
    this._initGraphicsLayer(), await this._initSelectionSet();
  }
  async _initSelectionSet() {
    this.selectionSet && (this._searchTerm = this.selectionSet.searchResult?.name, this._searchResult = this.selectionSet.searchResult, this._selectedIds = this.selectionSet.selectedIds, this._skipGeomOIDs = this.selectionSet.skipGeomOIDs || [], this.searchDistanceEnabled = this.selectionSet.searchDistanceEnabled, this.useLayerFeaturesEnabled = this.selectionSet.useLayerFeaturesEnabled, this._distance = this.selectionSet.searchDistanceEnabled ? this.selectionSet.distance : 0, this._unit = this.selectionSet.unit, this._workflowType = this.selectionSet.workflowType, this.selectLayerView = this.selectionSet.layerView, this._sketchGraphic = this.selectionSet.sketchGraphic, this.geometries = [...this.selectionSet?.geometries || []], this._graphics = this.geometries.reduce((e, t) => {
      const s = t.type === "point" ? this.sketchPointSymbol : t.type === "polyline" ? this.sketchLineSymbol : this.sketchPolygonSymbol;
      return e.push(new b({
        geometry: t,
        symbol: s
      })), e;
    }, []), this._selectionLabel = this.selectionSet?.label, this.useLayerFeaturesEnabled || await this._drawTools.value?.updateGraphics(), this.selectionSet.layerView && this.mapView && await L(this.selectionSet.selectedIds, this.selectionSet.layerView, this.mapView, !1));
  }
  async _handleSearchClear() {
    const e = this._searchClearLabel();
    this._searchResult?.name && await this._clearResults(!1, e);
  }
  async _handleSearchSelectResult(e) {
    await this._selectResult(e.detail.result);
  }
  async _selectResult(e) {
    if (e) {
      this._searchResult = e;
      const t = e.feature, s = t?.layer, i = this.selectLayerView?.layer, a = Number(t?.getObjectId());
      let l;
      s?.sourceJSON?.isView && s.url && (l = await this._getViewSourceUrl(s.url));
      let r;
      i?.sourceJSON?.isView && i.url && (r = await this._getViewSourceUrl(i.url));
      const h = s?.url?.toLowerCase(), o = l?.toLowerCase(), n = i?.url?.toLowerCase(), p = r?.toLowerCase(), y = h && n && (h === n || h === p || o === n || o === p) && !Number.isNaN(a), g = y ? [a] : void 0;
      this._workflowType = "SEARCH", this._updateLabel();
      const _ = [e.feature];
      this._updateSelection(_, y, g), this._drawTools.value && (this._drawTools.value.graphics = _);
    } else {
      const t = this._searchClearLabel();
      this._clearResults(!1, t);
    }
  }
  async _getViewSourceUrl(e) {
    let t = "";
    const s = `${e}/sources?f=json`;
    try {
      const i = await D(s, {
        query: {
          f: "json"
        }
      });
      i?.data?.services?.length === 1 && (t = i.data.services[0].url);
    } catch (i) {
      console.log(i);
    }
    return t;
  }
  _searchClearLabel() {
    return this._searchResult?.name && this._labelName.value && this._labelName.value.value.indexOf(this._searchResult.name) > -1;
  }
  _getSearchConfig(e, t) {
    const s = e?.sources;
    return s && s?.length > 0 ? (e = {
      ...e,
      includeDefaultSources: !1
    }, s.forEach((i) => {
      if (i.hasOwnProperty("layer")) {
        const l = i, r = l.layer?.id, h = r ? t.map?.findLayerById(r) : null, o = l?.layer?.url;
        h && l ? l.layer = h : o && (l.layer = new x(o));
      }
    }), s?.forEach((i) => {
      if (i.hasOwnProperty("locator")) {
        const l = i;
        if (l?.name === "ArcGIS World Geocoding Service") {
          const r = l.outFields || ["Addr_type", "Match_addr", "StAddr", "City"];
          l.outFields = r, l.singleLineFieldName = "SingleLine";
        }
        l.url = l.url, delete l.url;
      }
    })) : e = {
      ...e,
      includeDefaultSources: !0
    }, e;
  }
  _initGraphicsLayer() {
    const e = this._pnContextConsumer.value, t = this._translations.bufferLayer;
    if (this.mapView) {
      const s = this.mapView.map.layers.findIndex((i) => i.title === t);
      if (s > -1)
        this._bufferGraphicsLayer = this.mapView.map.layers.getItemAt(s);
      else if (this._bufferGraphicsLayer = new R({ title: t, listMode: "hide" }), this._bufferGraphicsLayer) {
        e.managedLayers[t] = "buffer";
        const i = this.mapView.map.layers.findIndex((a) => a.title === this._translations.sketchLayer);
        i > -1 ? this.mapView.map.layers.add(this._bufferGraphicsLayer, i) : this.mapView.map.layers.add(this._bufferGraphicsLayer);
      }
    }
  }
  async _sketchGraphicsChanged(e, t = !1) {
    const s = e.detail.graphics;
    if (s.length > 0 && s[0])
      if (t || (this._sketchGraphic = s[0]), this._workflowType = this.useLayerFeaturesEnabled ? "SELECT" : "SKETCH", this._workflowType === "SKETCH" && this._drawTools.value && await this._drawTools.value.updateGraphics(), await this._updateLabel(), this._clearSearchWidget(), this.useLayerFeaturesEnabled && !t) {
        const i = Array.isArray(s) ? s.map((a) => a.geometry) : this.geometries;
        await this._selectLayerFeatures(i[0]);
      } else {
        const i = s.reduce((l, r) => (r?.layer?.objectIdField ? l.push(Number(r.attributes[r.layer.objectIdField])) : r.getObjectId && l.push(Number(r.getObjectId())), l), []), a = e.detail.useOIDs && i.length > 0;
        this._updateSelection(s, a, i), a && await this._highlightFeatures(i);
      }
    else
      await this._clearResults(!0, !0);
  }
  async _highlightWithOIDsOrGeoms() {
    return this._skipGeomOIDs && this._skipGeomOIDs?.length > 0 ? (this._selectedIds = this._skipGeomOIDs, this._highlightFeatures(this._selectedIds)) : this._geomQuery(this.geometries);
  }
  async _highlightFeatures(e) {
    const t = this._pnContextConsumer.value;
    if (t.removeHandles(), e.length > 0 && this.selectLayerView && this.mapView) {
      const s = await S(e, this.selectLayerView, this.mapView);
      t.highlightHandles.push(s);
    }
    this._numSelected = e.length, this.selectionSetChange.emit(e.length);
  }
  async _selectFeatures(e) {
    this._selectionLoading = !0, this._selectedIds = this.selectLayerView && await v(e, this.selectLayerView.layer) || [], this._selectionLoading = !1, this._drawTools.value && (this._drawTools.value.graphics = this._graphics), await this._highlightFeatures(this._selectedIds);
  }
  async _bufferComplete(e) {
    this._bufferGeometry = Array.isArray(e.detail) ? e.detail[0] : e.detail;
    let t = this._bufferTools.value && Number(this._bufferTools.value.distance), s = 0;
    if (this._bufferGeometry) {
      const i = {
        type: "simple-fill",
        color: this.bufferColor,
        outline: {
          color: this.bufferOutlineColor,
          width: 1
        }
      }, a = new b({
        geometry: this._bufferGeometry,
        symbol: i
      });
      this._bufferGraphicsLayer && this.mapView && (this._bufferGraphicsLayer.removeAll(), this._bufferGraphicsLayer.add(a), await this._selectFeatures([this._bufferGeometry]), a.geometry?.extent && await this.mapView.goTo(a.geometry.extent)), s = t, t = 0;
    } else
      this._bufferGraphicsLayer && this._bufferGraphicsLayer.removeAll(), await this._highlightWithOIDsOrGeoms();
    await this._distanceChanged({
      oldValue: t,
      newValue: s
    });
  }
  async _geomQuery(e) {
    const t = C(e);
    return t ? this._selectFeatures(t) : Promise.resolve();
  }
  async _clearResults(e = !0, t = !1) {
    this._selectedIds = [], this._distance = void 0, this._unit = void 0, t && (this._selectionLabel = "", this._labelName.value && (this._labelName.value.value = "")), this._bufferGraphicsLayer && this._bufferGraphicsLayer.removeAll(), e && this._clearSearchWidget(), this._pnContextConsumer.value.removeHandles(), this._drawTools.value?.clear && (this._graphics = [], this.geometries = [], await this._drawTools.value.clear()), this._numSelected = this._selectedIds.length, this.selectionSetChange.emit(this._numSelected);
  }
  _clearSearchWidget() {
    this._searchElement.value?.clear(), this._searchResult = void 0;
  }
  _updateSelection(e, t, s) {
    this._selectedIds = t && s ? s : this._selectedIds, this._skipGeomOIDs = t ? s : void 0, this.geometries = Array.isArray(e) ? e.reduce((i, a) => (a.geometry && i.push(a.geometry), i), []) : this.geometries, this._graphics = e;
  }
  async _updateLabel() {
    if (this.enableSearchDistance) {
      const e = this._translations.sketch && this._selectionLabel.indexOf(this._translations.sketch) > -1, t = this._translations.select && this._selectionLabel.indexOf(this._translations.select) > -1, s = this._selectionLabel.indexOf(this._searchResult?.name) > -1, i = this._workflowType === "SEARCH" ? this._searchResult?.name : this._workflowType === "SELECT" ? this._translations.select : this._translations.sketch, a = this._bufferTools.value ? this._bufferTools.value.unit : this._unit, l = this._bufferTools.value && a && await this._bufferTools.value.getTranslatedUnit(a), r = Number.isNaN(Number(this._distance)) && this._bufferTools.value ? this._bufferTools.value.distance : this._distance;
      this._selectionLabel = e || t || s || !this._selectionLabel ? `${i} ${r} ${l}` : this._selectionLabel, this._labelName.value && (this._labelName.value.value = this._selectionLabel);
    }
  }
  async _layerSelectionChange(e) {
    if (Array.isArray(e.detail) && e.detail.length > 0) {
      const t = e.detail.reduce((s, i) => (this.mapView && s.push(m(this.mapView, i)), s), []);
      return Promise.all(t).then((s) => {
        this.layerViews = s.reduce((i, a) => (a && i.push(a), i), []), this._featuresCollection = {}, this._sketchGraphic && this._sketchGraphicsChanged({
          detail: {
            graphics: [this._sketchGraphic],
            useOIDs: !1
          }
        });
      });
    }
  }
  async _inputLayerSelectionChange(e) {
    const t = e?.detail?.length > 0 ? e.detail[0] : "";
    (!this.selectLayerView || t !== this.selectLayerView.layer.id) && (this.selectLayerView = this.mapView && await m(this.mapView, t), await this._updateLabel(), this._bufferGeometry ? await this._selectFeatures([this._bufferGeometry]) : await this._highlightWithOIDsOrGeoms());
  }
  async _distanceChanged(e) {
    e.newValue !== e.oldValue && (this._distance = e.newValue, await this._updateLabel());
  }
  async _selectLayerFeatures(e) {
    this._selectionLoading = !0;
    const t = this.layerViews.map((s) => (this._featuresCollection[s.layer.id] = [], V(0, s.layer, e, this._featuresCollection)));
    return Promise.all(t).then(async (s) => {
      this._selectionLoading = !1;
      let i = [];
      s.forEach((o) => {
        Object.keys(o).forEach((n) => {
          i = i.concat(o[n]);
        });
      });
      let a = !1;
      i.forEach((o) => {
        const n = o.geometry;
        o.symbol = n && n.type === "point" ? this.sketchPointSymbol : n && n.type === "polyline" ? this.sketchLineSymbol : n && n.type === "polygon" ? this.sketchPolygonSymbol : void 0, a = o?.layer?.hasOwnProperty("objectIdField") || o.hasOwnProperty("getObjectId");
      });
      const l = this.layerViews[0].layer, r = this.selectLayerView?.layer, h = a && l.url === r?.url && r?.layerId === l.layerId;
      await this._sketchGraphicsChanged({
        detail: {
          graphics: i,
          useOIDs: h
        }
      }, !0);
    });
  }
  _useLayerFeaturesEnabledChanged() {
    this.useLayerFeaturesEnabled = !this.useLayerFeaturesEnabled, this._sketchGraphic && this._sketchGraphicsChanged({
      detail: {
        graphics: [this._sketchGraphic],
        useOIDs: !1
      }
    });
  }
}
w("map-select-tools", U);
export {
  U as MapSelectTools
};
