import { o, u as u2 } from "./chunk-5X5UDWFV.js"; import { Y } from "./chunk-3EZOER4E.js"; import "./chunk-XCIRV7CO.js"; import "./chunk-DMVKVC5I.js"; import "./chunk-EL3V6S4N.js"; import "./chunk-NFN2M2QU.js"; import "./chunk-3ZJXLJLL.js"; import "./chunk-OP2HNSVZ.js"; import "./chunk-4GGDRIJK.js"; import "./chunk-MZG75XMA.js"; import "./chunk-REMBDESU.js"; import "./chunk-CKZZYAPN.js"; import "./chunk-AFVJXEUJ.js"; import "./chunk-FZSI6IGI.js"; import "./chunk-SJGY5U4Q.js"; import "./chunk-27XWQUQA.js"; import "./chunk-NX2NCBAF.js"; import { gt, it, lt } from "./chunk-4VZNS7N2.js"; import "./chunk-IIAN3QNN.js"; import "./chunk-VYQHMPYW.js"; import { S, c as c4, f as f3, x as x2 } from "./chunk-BA3WIOU6.js"; import "./chunk-KAB3V7FU.js"; import { a } from "./chunk-O53KL66E.js"; import "./chunk-CFVLY6NB.js"; import "./chunk-WXUHXYJK.js"; import "./chunk-NTERQTPO.js"; import "./chunk-EDHROVWI.js"; import "./chunk-3IRT3YKJ.js"; import "./chunk-SOSOZIX6.js"; import { v } from "./chunk-VICJMAP2.js"; import { c as c5, s as s2, t as t4 } from "./chunk-OJ2HHY2O.js"; import { g } from "./chunk-SZFMKPVM.js"; import { x } from "./chunk-K6QDYFZU.js"; import { e as e3 } from "./chunk-EY2WJSAJ.js"; import "./chunk-YMULPZCD.js"; import { c as c3, d as d2 } from "./chunk-RDMCXRET.js"; import "./chunk-BQHWPTT7.js"; import "./chunk-DAWQAVQO.js"; import "./chunk-73AMYZFU.js"; import "./chunk-NKMX5M3L.js"; import "./chunk-MGUVQY3Q.js"; import "./chunk-QEWF7QPH.js"; import "./chunk-SQ2SY4BX.js"; import "./chunk-VLG7MMVR.js"; import { U, j as j2, l } from "./chunk-BWATQC2Y.js"; import { j as j3 } from "./chunk-6URCZZA6.js"; import { t as t3 } from "./chunk-U2WD23Z5.js"; import { r as r3, x as x3 } from "./chunk-3HZQM2NK.js"; import "./chunk-AR2YN3E2.js"; import "./chunk-U3LEOWJX.js"; import "./chunk-4ONPMX2F.js"; import "./chunk-47NSA4T4.js"; import "./chunk-FUODOQDM.js"; import "./chunk-CZBRZ6SU.js"; import "./chunk-VGWC3IKZ.js"; import { E, c as c2, f as f2, u, y as y3 } from "./chunk-SWMSD4RP.js"; import { L } from "./chunk-UKEN2UNL.js"; import "./chunk-X4SA4ELJ.js"; import "./chunk-XJCUT65M.js"; import { d, j } from "./chunk-PIFOHNWC.js"; import "./chunk-ZLNEXZAN.js"; import "./chunk-ZYRIJWLX.js"; import "./chunk-RYY6632W.js"; import "./chunk-DW42UVIT.js"; import "./chunk-TJNOJH33.js"; import "./chunk-YAEIHDJH.js"; import "./chunk-OSHI574D.js"; import "./chunk-44GMIOGP.js"; import "./chunk-75U5LM2V.js"; import "./chunk-ZHRAUKVQ.js"; import "./chunk-RZK6A2GY.js"; import "./chunk-X4LLOW7U.js"; import { n as n3 } from "./chunk-Z4JTBD7M.js"; import "./chunk-HZRKBTHJ.js"; import "./chunk-5DMBXPN2.js"; import "./chunk-QANZ6BFY.js"; import "./chunk-VEGAOVMY.js"; import { w2 } from "./chunk-CXCDYJ5R.js"; import "./chunk-GAOW3WRZ.js"; import { k2 as k } from "./chunk-QCKFNSN2.js"; import { e, m, n2 as n, n5 as n2, t2, y3 as y2 } from "./chunk-6SOHRC7T.js"; import "./chunk-U2XHEJM7.js"; import { r as r2 } from "./chunk-SQOPWYIT.js"; import "./chunk-6KZ2LTDA.js"; import { A, f, w } from "./chunk-V6P2MAQQ.js"; import { s2 as s } from "./chunk-E5O6P5I2.js"; import { c, y } from "./chunk-SPWQ3AWG.js"; import { i } from "./chunk-2TIUKVZN.js"; import { e as e2, r, t } from "./chunk-YXWMMD76.js"; import "./chunk-S5KM4IGW.js"; // node_modules/@arcgis/core/views/interactive/snapping/featureSources/snappingCandidateElevationAlignment.js function r4(e5 = false, t7) { if (e5) { const { elevationInfo: e6, alignPointsInFeatures: s4, spatialReference: n6 } = t7; return new l2(e6, s4, n6); } return new c6(); } var c6 = class { async alignCandidates(e5, t7) { return e5; } notifyElevationSourceChange() { } }; var h = 1024; var l2 = class { constructor(t7, s4, n6) { this._elevationInfo = t7, this._alignPointsInFeatures = s4, this.spatialReference = n6, this._alignmentsCache = new e3(h), this._cacheVersion = 0, this._metersPerVerticalUnit = L(n6); } async alignCandidates(e5, t7) { const n6 = this._elevationInfo; return r(n6) && "absolute-height" === n6.mode && !n6.featureExpressionInfo ? (this._alignAbsoluteElevationCandidates(e5, n6), e5) : this._alignComputedElevationCandidates(e5, t7); } notifyElevationSourceChange() { this._alignmentsCache.clear(), this._cacheVersion++; } _alignAbsoluteElevationCandidates(e5, t7) { const { offset: s4, unit: o4 } = t7; if (t(s4)) return; const i4 = s4 * (r3(o4 != null ? o4 : "meters") / this._metersPerVerticalUnit); for (const n6 of e5) switch (n6.type) { case "edge": n6.start.z += i4, n6.end.z += i4; continue; case "vertex": n6.target.z += i4; continue; } } async _alignComputedElevationCandidates(e5, s4) { const n6 = /* @__PURE__ */ new Map(); for (const o4 of e5) r2(n6, o4.objectId, p).push(o4); const [i4, a4, r8] = this._prepareQuery(n6), c9 = await this._alignPointsInFeatures(i4, s4); f(s4); if (r8 !== this._cacheVersion) return this._alignComputedElevationCandidates(e5, s4); this._applyCacheAndResponse(i4, c9, a4); const { drapedObjectIds: h2, failedObjectIds: l3 } = c9, d4 = []; for (const t7 of e5) { const { objectId: e6 } = t7; h2.has(e6) && "edge" === t7.type && (t7.draped = true), l3.has(e6) || d4.push(t7); } return d4; } _prepareQuery(e5) { const t7 = [], s4 = []; for (const [n6, o4] of e5) { const e6 = []; for (const t8 of o4) this._addToQueriesOrCachedResult(n6, t8.target, e6, s4), "edge" === t8.type && (this._addToQueriesOrCachedResult(n6, t8.start, e6, s4), this._addToQueriesOrCachedResult(n6, t8.end, e6, s4)); 0 !== e6.length && t7.push({ objectId: n6, points: e6 }); } return [t7, s4, this._cacheVersion]; } _addToQueriesOrCachedResult(e5, t7, n6, o4) { const i4 = u3(e5, t7), a4 = this._alignmentsCache.get(i4); r(a4) ? o4.push(new d3(t7, a4)) : n6.push(t7); } _applyCacheAndResponse(e5, { elevations: t7, drapedObjectIds: s4, failedObjectIds: n6 }, o4) { for (const r8 of o4) r8.apply(); let i4 = 0; const a4 = this._alignmentsCache; for (const { objectId: r8, points: c9 } of e5) { if (n6.has(r8)) { i4 += c9.length; continue; } const e6 = !s4.has(r8); for (const s5 of c9) { const n7 = u3(r8, s5), o5 = t7[i4++]; s5.z = o5, e6 && a4.put(n7, o5, 1); } } } }; var d3 = class { constructor(e5, t7) { this.point = e5, this.z = t7; } apply() { this.point.z = this.z; } }; function u3(e5, { x: t7, y: s4, z: n6 }) { return `${e5}-${t7}-${s4}-${n6 != null ? n6 : 0}}`; } function p() { return []; } // node_modules/@arcgis/core/views/interactive/snapping/featureSources/snappingCandidateElevationFilter.js var t5 = class { filter(t7, n6) { return n6; } notifyElevationSourceChange() { } }; var n4 = class { filter(t7, n6) { const { point: r8, distance: c9 } = t7, { z: i4 } = r8; if (!(null != i4)) return n6; if (0 === n6.length) return n6; const o4 = s3(c9), u5 = this._updateCandidatesTo3D(n6, r8, o4).filter(e4); return u5.sort(a2), u5; } _updateCandidatesTo3D(t7, n6, e5) { for (const r8 of t7) switch (r8.type) { case "edge": c7(r8, n6, e5); continue; case "vertex": o2(r8, n6, e5); continue; } return t7; } }; function e4(t7) { return t7.distance <= 1; } function r5(e5 = false) { return e5 ? new n4() : new t5(); } function c7(t7, n6, { x: e5, y: r8, z: c9 }) { const { start: o4, end: s4, target: a4 } = t7; t7.draped || i2(a4, n6, o4, s4); const u5 = (n6.x - a4.x) / e5, d4 = (n6.y - a4.y) / r8, f4 = (n6.z - a4.z) / c9; t7.distance = Math.sqrt(u5 * u5 + d4 * d4 + f4 * f4); } function i2(t7, n6, e5, r8) { const c9 = r8.x - e5.x, i4 = r8.y - e5.y, o4 = r8.z - e5.z, s4 = c9 * c9 + i4 * i4 + o4 * o4, a4 = (n6.x - e5.x) * c9 + (n6.y - e5.y) * i4 + o4 * (n6.z - e5.z), u5 = Math.min(1, Math.max(0, a4 / s4)), d4 = e5.x + c9 * u5, f4 = e5.y + i4 * u5, x6 = e5.z + o4 * u5; t7.x = d4, t7.y = f4, t7.z = x6; } function o2(t7, n6, { x: e5, y: r8, z: c9 }) { const { target: i4 } = t7, o4 = (n6.x - i4.x) / e5, s4 = (n6.y - i4.y) / r8, a4 = (n6.z - i4.z) / c9, u5 = Math.sqrt(o4 * o4 + s4 * s4 + a4 * a4); t7.distance = u5; } function s3(t7) { return "number" == typeof t7 ? { x: t7, y: t7, z: t7 } : t7; } function a2(t7, n6) { return t7.distance - n6.distance; } // node_modules/@arcgis/core/views/interactive/snapping/featureSources/symbologySnappingCandidates.js function n5(t7 = false, e5) { return t7 ? new i3(e5) : new c8(); } var c8 = class { async fetch() { return []; } notifySymbologyChange() { } }; var r6 = 1024; var i3 = class { constructor(t7) { this._getSymbologyCandidates = t7, this._candidatesCache = new e3(r6), this._cacheVersion = 0; } async fetch(e5, o4) { if (0 === e5.length) return []; const n6 = [], c9 = [], r8 = this._candidatesCache; for (const s4 of e5) { const e6 = a3(s4), o5 = r8.get(e6); if (o5) for (const s5 of o5) c9.push(y(s5)); else n6.push(s4), r8.put(e6, [], 1); } if (0 === n6.length) return c9; const i4 = this._cacheVersion, { candidates: h2, sourceCandidateIndices: d4 } = await this._getSymbologyCandidates(n6, o4); f(o4); if (i4 !== this._cacheVersion) return this.fetch(e5, o4); const f4 = [], { length: g2 } = h2; for (let s4 = 0; s4 < g2; ++s4) { const e6 = h2[s4], o5 = a3(n6[d4[s4]]), c10 = r8.get(o5); c10.push(e6), r8.put(o5, c10, c10.length), f4.push(y(e6)); } return c9.concat(f4); } notifySymbologyChange() { this._candidatesCache.clear(), this._cacheVersion++; } }; function a3(t7) { var _a, _b, _c; switch (t7.type) { case "vertex": { const { objectId: e5, target: s4 } = t7, n6 = `${e5}-vertex-${s4.x}-${s4.y}-${(_a = s4.z) != null ? _a : 0}`; return c(n6).toString(); } case "edge": { const { objectId: e5, start: s4, end: n6 } = t7, c9 = `${e5}-edge-${s4.x}-${s4.y}-${(_b = s4.z) != null ? _b : 0}-to-${n6.x}-${n6.y}-${(_c = n6.z) != null ? _c : 0}`; return c(c9).toString(); } default: return ""; } } // node_modules/@arcgis/core/core/AsyncSequence.js var r7 = class extends m { constructor() { super(...arguments), this.updating = false, this._pending = []; } push(s4, t7) { this._pending.push({ promise: s4, callback: t7 }), 1 === this._pending.length && this._process(); } _process() { if (!this._pending.length) return void (this.updating = false); this.updating = true; const s4 = this._pending[0]; s4.promise.then((t7) => s4.callback(t7)).catch(() => { }).then(() => { this._pending.shift(), this._process(); }); } }; e([y2()], r7.prototype, "updating", void 0), r7 = e([n2("esri.core.AsyncSequence")], r7); // node_modules/@arcgis/core/views/interactive/snapping/featureSources/featureServiceSource/PendingFeatureTile.js var o3 = class { constructor(t7, e5) { this.data = t7, this.resolution = e5, this.state = { type: u4.CREATED }, this.alive = true; } process(t7) { switch (this.state.type) { case u4.CREATED: return this.state = this._gotoFetchCount(this.state, t7), this.state.task.promise.then(t7.resume, t7.resume); case u4.FETCH_COUNT: break; case u4.FETCHED_COUNT: return this.state = this._gotoFetchFeatures(this.state, t7), this.state.task.promise.then(t7.resume, t7.resume); case u4.FETCH_FEATURES: break; case u4.FETCHED_FEATURES: this.state = this._goToDone(this.state, t7); case u4.DONE: } return null; } get debugInfo() { return { data: this.data, featureCount: this._featureCount, state: this._stateToString }; } get _featureCount() { switch (this.state.type) { case u4.CREATED: case u4.FETCH_COUNT: return 0; case u4.FETCHED_COUNT: return this.state.featureCount; case u4.FETCH_FEATURES: return this.state.previous.featureCount; case u4.FETCHED_FEATURES: return this.state.features.length; case u4.DONE: return this.state.previous.features.length; } } get _stateToString() { switch (this.state.type) { case u4.CREATED: return "created"; case u4.FETCH_COUNT: return "fetch-count"; case u4.FETCHED_COUNT: return "fetched-count"; case u4.FETCH_FEATURES: return "fetch-features"; case u4.FETCHED_FEATURES: return "fetched-features"; case u4.DONE: return "done"; } } _gotoFetchCount(s4, a4) { return { type: u4.FETCH_COUNT, previous: s4, task: j(async (t7) => { const s5 = await d(a4.fetchCount(this, t7)); this.state.type === u4.FETCH_COUNT && (this.state = this._gotoFetchedCount(this.state, s5.ok ? s5.value : 1 / 0)); }) }; } _gotoFetchedCount(t7, e5) { return { type: u4.FETCHED_COUNT, featureCount: e5, previous: t7 }; } _gotoFetchFeatures(s4, a4) { return { type: u4.FETCH_FEATURES, previous: s4, task: j(async (t7) => { const r8 = await d(a4.fetchFeatures(this, s4.featureCount, t7)); this.state.type === u4.FETCH_FEATURES && (this.state = this._gotoFetchedFeatures(this.state, r8.ok ? r8.value : [])); }) }; } _gotoFetchedFeatures(t7, e5) { return { type: u4.FETCHED_FEATURES, previous: t7, features: e5 }; } _goToDone(t7, e5) { return e5.finish(this, t7.features), { type: u4.DONE, previous: t7 }; } reset() { const t7 = this.state; switch (this.state = { type: u4.CREATED }, t7.type) { case u4.CREATED: case u4.FETCHED_COUNT: case u4.FETCHED_FEATURES: case u4.DONE: break; case u4.FETCH_COUNT: case u4.FETCH_FEATURES: t7.task.abort(); } } intersects(t7) { return !(!t(t7) && this.data.extent) || (c2(t7, T), E(this.data.extent, T)); } }; var u4; !function(t7) { t7[t7.CREATED = 0] = "CREATED", t7[t7.FETCH_COUNT = 1] = "FETCH_COUNT", t7[t7.FETCHED_COUNT = 2] = "FETCHED_COUNT", t7[t7.FETCH_FEATURES = 3] = "FETCH_FEATURES", t7[t7.FETCHED_FEATURES = 4] = "FETCHED_FEATURES", t7[t7.DONE = 5] = "DONE"; }(u4 || (u4 = {})); var T = u(); // node_modules/@arcgis/core/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiledFetcher.js var C = class extends d2 { constructor(e5) { super(e5), this.tilesOfInterest = [], this.availability = 0, this._pendingTiles = /* @__PURE__ */ new Map(), this._pendingEdits = new r7(), this._pendingEditsAbortController = new AbortController(); } get _minimumVerticesPerFeature() { var _a; switch ((_a = this.store) == null ? void 0 : _a.featureStore.geometryType) { case "esriGeometryPoint": case "esriGeometryMultipoint": return 1; case "esriGeometryPolygon": return 4; case "esriGeometryPolyline": return 2; } } set filter(e5) { const t7 = this._get("filter"), i4 = this._filterProperties(e5); JSON.stringify(t7) !== JSON.stringify(i4) && this._set("filter", i4); } set customParameters(e5) { const t7 = this._get("customParameters"); JSON.stringify(t7) !== JSON.stringify(e5) && this._set("customParameters", e5); } get _configuration() { return { filter: this.filter, customParameters: this.customParameters, tileInfo: this.tileInfo, tileSize: this.tileSize }; } set tileInfo(e5) { const t7 = this._get("tileInfo"); t7 !== e5 && (r(e5) && r(t7) && JSON.stringify(e5) === JSON.stringify(t7) || (this._set("tileInfo", e5), this.store.tileInfo = e5)); } set tileSize(e5) { this._get("tileSize") !== e5 && this._set("tileSize", e5); } get updating() { return this.updatingExcludingEdits || this._pendingEdits.updating; } get updatingExcludingEdits() { return this.updatingHandles.updating; } get hasZ() { return this.store.featureStore.hasZ; } initialize() { this._initializeFetchExtent(), this.updatingHandles.add(() => this._configuration, () => this.refresh()), this.updatingHandles.add(() => this.tilesOfInterest, (e5, i4) => { i(e5, i4, ({ id: e6 }, { id: t7 }) => e6 === t7) || this._process(); }, U); } destroy() { this._pendingTiles.forEach((e5) => this._deletePendingTile(e5)), this._pendingTiles.clear(), this.store.destroy(), this.tilesOfInterest.length = 0, this._pendingEditsAbortController.abort(), this._pendingEditsAbortController = null; } refresh() { this.store.refresh(), this._pendingTiles.forEach((e5) => this._deletePendingTile(e5)), this._process(); } applyEdits(e5) { this._pendingEdits.push(e5, async (e6) => { if (0 === e6.addedFeatures.length && 0 === e6.updatedFeatures.length && 0 === e6.deletedFeatures.length) return; for (const [, i4] of this._pendingTiles) i4.reset(); const t7 = { ...e6, deletedFeatures: e6.deletedFeatures.map(({ objectId: e7, globalId: t8 }) => e7 && -1 !== e7 ? e7 : this._lookupObjectIdByGlobalId(t8)) }; await this.updatingHandles.addPromise(this.store.processEdits(t7, (e7, t8) => this._queryFeaturesById(e7, t8), this._pendingEditsAbortController.signal)), this._processPendingTiles(); }); } _initializeFetchExtent() { if (!this.capabilities.query.supportsExtent || !g(this.url)) return; const e5 = j(async (e6) => { var _a; try { const t7 = await x2(this.url, new x({ where: "1=1", outSpatialReference: this.spatialReference, cacheHint: !!this.capabilities.query.supportsCacheHint || void 0 }), { query: this._configuration.customParameters, signal: e6 }); this.store.extent = w2.fromJSON((_a = t7.data) == null ? void 0 : _a.extent); } catch (t7) { w(t7), s.getLogger(this.declaredClass).warn("Failed to fetch data extent", t7); } }); this.updatingHandles.addPromise(e5.promise.then(() => this._process())), this.handles.add(n(() => e5.abort())); } get debugInfo() { return { numberOfFeatures: this.store.featureStore.numFeatures, tilesOfInterest: this.tilesOfInterest, pendingTiles: Array.from(this._pendingTiles.values()).map((e5) => e5.debugInfo), storedTiles: this.store.debugInfo }; } _process() { this._markTilesNotAlive(), this._createPendingTiles(), this._deletePendingTiles(), this._processPendingTiles(); } _markTilesNotAlive() { for (const [, e5] of this._pendingTiles) e5.alive = false; } _createPendingTiles() { const e5 = this._collectMissingTilesInfo(); if (this._setAvailability(t(e5) ? 1 : e5.coveredArea / e5.fullArea), !t(e5)) for (const { data: t7, resolution: i4 } of e5.missingTiles) { const e6 = this._pendingTiles.get(t7.id); e6 ? (e6.resolution = i4, e6.alive = true) : this._createPendingTile(t7, i4); } } _collectMissingTilesInfo() { let e5 = null; for (let t7 = this.tilesOfInterest.length - 1; t7 >= 0; t7--) { const i4 = this.tilesOfInterest[t7], s4 = this.store.process(i4, (e6, t8) => this._verifyTileComplexity(e6, t8)); t(e5) ? e5 = s4 : e5.prepend(s4); } return e5; } _deletePendingTiles() { for (const [, e5] of this._pendingTiles) e5.alive || this._deletePendingTile(e5); } _processPendingTiles() { const e5 = { fetchCount: (e6, t7) => this._fetchCount(e6, t7), fetchFeatures: (e6, t7, i4) => this._fetchFeatures(e6, t7, i4), finish: (e6, t7) => this._finishPendingTile(e6, t7), resume: () => this._processPendingTiles() }; if (this._ensureFetchAllCounts(e5)) for (const [, t7] of this._pendingTiles) this._verifyTileComplexity(this.store.getFeatureCount(t7.data), t7.resolution) && this.updatingHandles.addPromise(t7.process(e5)); } _verifyTileComplexity(e5, t7) { return this._verifyVertexComplexity(e5) && this._verifyFeatureDensity(e5, t7); } _verifyVertexComplexity(e5) { return e5 * this._minimumVerticesPerFeature < x4; } _verifyFeatureDensity(e5, t7) { if (t(this.tileInfo)) return false; const i4 = this.tileSize * t7; return e5 * (j4 / (i4 * i4)) < w3; } _ensureFetchAllCounts(e5) { let t7 = true; for (const [, i4] of this._pendingTiles) i4.state.type < u4.FETCHED_COUNT && this.updatingHandles.addPromise(i4.process(e5)), i4.state.type <= u4.FETCH_COUNT && (t7 = false); return t7; } _finishPendingTile(e5, t7) { this.store.add(e5.data, t7), this._deletePendingTile(e5), this._updateAvailability(); } _updateAvailability() { const e5 = this._collectMissingTilesInfo(); this._setAvailability(t(e5) ? 1 : e5.coveredArea / e5.fullArea); } _setAvailability(e5) { this._set("availability", e5); } _createPendingTile(e5, t7) { const i4 = new o3(e5, t7); return this._pendingTiles.set(e5.id, i4), i4; } _deletePendingTile(e5) { e5.reset(), this._pendingTiles.delete(e5.data.id); } async _fetchCount(e5, t7) { return this.store.fetchCount(e5.data, this.url, this._createCountQuery(e5), { query: this.customParameters, timeout: S2, signal: t7 }); } async _fetchFeatures(e5, t7, i4) { let s4, r8 = 0, o4 = 0, n6 = t7; for (; ; ) { const a4 = this._createFeaturesQuery(e5), l3 = this._setPagingParameters(a4, r8, n6), { features: c9, exceededTransferLimit: d4 } = await this._queryFeatures(a4, i4); if (l3 && (r8 += e2(a4.num)), o4 += c9.length, s4 = s4 ? s4.concat(c9) : c9, n6 = t7 - o4, !l3 || !d4 || n6 <= 0) return s4; } } _filterProperties(e5) { return t(e5) ? { where: "1=1", gdbVersion: void 0, timeExtent: void 0 } : { where: e5.where || "1=1", timeExtent: e5.timeExtent, gdbVersion: e5.gdbVersion }; } _lookupObjectIdByGlobalId(e5) { const t7 = this.globalIdField, i4 = this.objectIdField; if (t(t7)) throw new Error("Expected globalIdField to be defined"); let s4 = null; if (this.store.featureStore.forEach((r8) => { var _a; e5 === r8.attributes[t7] && (s4 = (_a = r8.objectId) != null ? _a : r8.attributes[i4]); }), t(s4)) throw new Error(`Expected to find a feature with globalId ${e5}`); return s4; } _queryFeaturesById(e5, t7) { const i4 = this._createFeaturesQuery(); return i4.objectIds = e5, this._queryFeatures(i4, t7); } _queryFeatures(e5, t7) { return this.capabilities.query.supportsFormatPBF ? this._queryFeaturesPBF(e5, t7) : this._queryFeaturesJSON(e5, t7); } async _queryFeaturesPBF(e5, t7) { const { sourceSpatialReference: i4 } = this, { data: s4 } = await f3(this.url, e5, new a({ sourceSpatialReference: i4 }), { query: this._configuration.customParameters, timeout: S2, signal: t7 }); return it(s4); } async _queryFeaturesJSON(e5, t7) { const { sourceSpatialReference: i4 } = this, { data: s4 } = await c4(this.url, e5, i4, { query: this._configuration.customParameters, timeout: S2, signal: t7 }); return lt(s4, this.objectIdField); } _createCountQuery(e5) { const t7 = this._createBaseQuery(e5); return this.capabilities.query.supportsCacheHint && (t7.cacheHint = true), t7; } _createFeaturesQuery(e5 = null) { const t7 = this._createBaseQuery(e5); return t7.outFields = this.globalIdField ? [this.globalIdField, this.objectIdField] : [this.objectIdField], t7.returnGeometry = true, r(e5) && (this.capabilities.query.supportsResultType ? t7.resultType = "tile" : this.capabilities.query.supportsCacheHint && (t7.cacheHint = true)), t7; } _createBaseQuery(e5) { const t7 = new x({ returnZ: this.hasZ, returnM: false, geometry: r(this.tileInfo) && r(e5) ? f2(e5.data.extent, this.tileInfo.spatialReference) : void 0 }), i4 = this._configuration.filter; return r(i4) && (t7.where = i4.where, t7.gdbVersion = i4.gdbVersion, t7.timeExtent = i4.timeExtent), t7.outSpatialReference = this.spatialReference, t7; } _setPagingParameters(e5, t7, i4) { if (!this.capabilities.query.supportsPagination) return false; const { supportsMaxRecordCountFactor: s4, supportsCacheHint: r8, tileMaxRecordCount: o4, maxRecordCount: n6, supportsResultType: a4 } = this.capabilities.query, l3 = s4 ? x.MAX_MAX_RECORD_COUNT_FACTOR : 1, u5 = l3 * ((a4 || r8) && o4 ? o4 : n6 || E2); return e5.start = t7, s4 ? (e5.maxRecordCountFactor = Math.min(l3, Math.ceil(i4 / u5)), e5.num = Math.min(i4, e5.maxRecordCountFactor * u5)) : e5.num = Math.min(i4, u5), true; } }; e([y2({ constructOnly: true })], C.prototype, "url", void 0), e([y2({ constructOnly: true })], C.prototype, "objectIdField", void 0), e([y2({ constructOnly: true })], C.prototype, "globalIdField", void 0), e([y2({ constructOnly: true })], C.prototype, "capabilities", void 0), e([y2({ constructOnly: true })], C.prototype, "sourceSpatialReference", void 0), e([y2({ constructOnly: true })], C.prototype, "spatialReference", void 0), e([y2({ constructOnly: true })], C.prototype, "store", void 0), e([y2({ readOnly: true })], C.prototype, "_minimumVerticesPerFeature", null), e([y2()], C.prototype, "filter", null), e([y2()], C.prototype, "customParameters", null), e([y2({ readOnly: true })], C.prototype, "_configuration", null), e([y2()], C.prototype, "tileInfo", null), e([y2()], C.prototype, "tileSize", null), e([y2()], C.prototype, "tilesOfInterest", void 0), e([y2({ readOnly: true })], C.prototype, "updating", null), e([y2({ readOnly: true })], C.prototype, "updatingExcludingEdits", null), e([y2({ readOnly: true })], C.prototype, "availability", void 0), e([y2()], C.prototype, "hasZ", null), C = e([n2("esri.views.interactive.snapping.featureSources.featureServiceSource.FeatureServiceTiledFetcher")], C); var E2 = 2e3; var S2 = 6e5; var x4 = 1e6; var j4 = 25; var w3 = 1; // node_modules/@arcgis/core/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTileCache.js var t6 = class { constructor() { this._store = /* @__PURE__ */ new Map(), this._byteSize = 0; } set(t7, e5) { this.delete(t7), this._store.set(t7, e5), this._byteSize += e5.byteSize; } delete(t7) { const e5 = this._store.get(t7); return !!this._store.delete(t7) && (null != e5 && (this._byteSize -= e5.byteSize), true); } get(t7) { return this._used(t7), this._store.get(t7); } has(t7) { return this._used(t7), this._store.has(t7); } clear() { this._store.clear(); } applyByteSizeLimit(t7, e5) { for (const [s4, r8] of this._store) { if (this._byteSize <= t7) break; this.delete(s4), e5(r8); } } values() { return this._store.values(); } [Symbol.iterator]() { return this._store[Symbol.iterator](); } _used(t7) { const e5 = this._store.get(t7); e5 && (this._store.delete(t7), this._store.set(t7, e5)); } }; // node_modules/@arcgis/core/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTileStore.js var v2 = class extends m { constructor(e5) { super(e5), this.tileInfo = null, this.extent = null, this.maximumByteSize = 10 * s2.MEGABYTES, this._tileBounds = new o(), this._tiles = new t6(), this._refCounts = /* @__PURE__ */ new Map(), this._tileFeatureCounts = /* @__PURE__ */ new Map(), this._tmpBoundingRect = u(); } add(e5, t7) { const s4 = []; for (const i4 of t7) this._referenceFeature(i4.objectId) === x5.ADDED && s4.push(i4); this._addTileStorage(e5, new Set(t7.map(({ objectId: e6 }) => e6)), C2(t7)), this.featureStore.addMany(s4), this._tiles.applyByteSizeLimit(this.maximumByteSize, (e6) => this._removeTileStorage(e6)); } destroy() { this.clear(), this._tileFeatureCounts.clear(); } clear() { this.featureStore.clear(), this._tileBounds.clear(), this._tiles.clear(), this._refCounts.clear(); } refresh() { this.clear(), this._tileFeatureCounts.clear(); } processEdits(e5, t7, s4) { return this._processEditsDelete(e5.deletedFeatures.concat(e5.updatedFeatures)), this._processEditsRefetch(e5.addedFeatures.concat(e5.updatedFeatures), t7, s4); } _addTileStorage(e5, t7, s4) { this._tiles.set(e5.id, new T2(e5, t7, s4)), this._tileBounds.set(e5.id, e5.extent), this._tileFeatureCounts.set(e5.id, t7.size); } _remove({ id: e5 }) { const t7 = this._tiles.get(e5); t7 && this._removeTileStorage(t7); } _removeTileStorage(e5) { const t7 = []; for (const i4 of e5.objectIds) this._unreferenceFeature(i4) === x5.REMOVED && t7.push(i4); this.featureStore.removeManyById(t7); const s4 = e5.data.id; this._tiles.delete(s4), this._tileBounds.delete(s4); } _processEditsDelete(e5) { this.featureStore.removeManyById(e5); for (const [, t7] of this._tiles) { for (const s4 of e5) t7.objectIds.delete(s4); this._tileFeatureCounts.set(t7.data.id, t7.objectIds.size); } for (const t7 of e5) this._refCounts.delete(t7); } async _processEditsRefetch(e5, t7, s4) { const i4 = (await t7(e5, s4)).features, { hasZ: r8, hasM: n6 } = this.featureStore; for (const l3 of i4) { const e6 = gt(this._tmpBoundingRect, l3.geometry, r8, n6); t(e6) || this._tileBounds.forEachInBounds(e6, (e7) => { const t8 = this._tiles.get(e7); this.featureStore.add(l3), t8.objectIds.has(l3.objectId) || (t8.objectIds.add(l3.objectId), this._referenceFeature(l3.objectId), this._tileFeatureCounts.set(t8.data.id, t8.objectIds.size)); }); } } process(e5, t7 = () => true) { if (t(this.tileInfo) || !e5.extent || r(this.extent) && !E(c2(this.extent, this._tmpBoundingRect), e5.extent)) return new j5(e5); if (this._tiles.has(e5.id)) return new j5(e5); const s4 = this._createTileTree(e5, this.tileInfo); return this._simplify(s4, t7, null, 0, 1), this._collectMissingTiles(e5, s4, this.tileInfo); } get debugInfo() { return Array.from(this._tiles.values()).map(({ data: e5 }) => ({ data: e5, featureCount: this._tileFeatureCounts.get(e5.id) || 0 })); } getFeatureCount(e5) { var _a; return (_a = this._tileFeatureCounts.get(e5.id)) != null ? _a : 0; } async fetchCount(e5, t7, s4, i4) { const r8 = this._tileFeatureCounts.get(e5.id); if (null != r8) return r8; const o4 = await S(t7, s4, i4); return this._tileFeatureCounts.set(e5.id, o4.data.count), o4.data.count; } _createTileTree(e5, t7) { const s4 = new I(e5.level, e5.row, e5.col); return t7.updateTileInfo(s4, j3.ExtrapolateOptions.POWER_OF_TWO), this._tileBounds.forEachInBounds(e5.extent, (i4) => { const r8 = this._tiles.get(i4).data; this._tilesAreRelated(e5, r8) && this._populateChildren(s4, r8, t7, this._tileFeatureCounts.get(r8.id) || 0); }), s4; } _tilesAreRelated(e5, t7) { if (!e5 || !t7) return false; if (e5.level === t7.level) return e5.row === t7.row && e5.col === t7.col; const s4 = e5.level < t7.level, i4 = s4 ? e5 : t7, r8 = s4 ? t7 : e5, o4 = 1 << r8.level - i4.level; return Math.floor(r8.row / o4) === i4.row && Math.floor(r8.col / o4) === i4.col; } _populateChildren(e5, t7, s4, i4) { const r8 = t7.level - e5.level - 1; if (r8 < 0) return void (e5.isLeaf = true); const o4 = t7.row >> r8, l3 = t7.col >> r8, a4 = e5.row << 1, c9 = l3 - (e5.col << 1) + (o4 - a4 << 1), h2 = e5.children[c9]; if (r(h2)) this._populateChildren(h2, t7, s4, i4); else { const r9 = new I(e5.level + 1, o4, l3); s4.updateTileInfo(r9, j3.ExtrapolateOptions.POWER_OF_TWO), e5.children[c9] = r9, this._populateChildren(r9, t7, s4, i4); } } _simplify(e5, t7, s4, i4, r8) { const o4 = r8 * r8; if (e5.isLeaf) return t7(this.getFeatureCount(e5), r8) ? 0 : (this._remove(e5), r(s4) && (s4.children[i4] = null), o4); const l3 = r8 / 2, a4 = l3 * l3; let c9 = 0; for (let h2 = 0; h2 < e5.children.length; h2++) { const s5 = e5.children[h2]; c9 += r(s5) ? this._simplify(s5, t7, e5, h2, l3) : a4; } return 0 === c9 ? this._mergeChildren(e5) : 1 - c9 / o4 < w4 && (this._purge(e5), r(s4) && (s4.children[i4] = null), c9 = o4), c9; } _mergeChildren(e5) { const t7 = /* @__PURE__ */ new Set(); let s4 = 0; this._forEachLeaf(e5, (e6) => { const i4 = this._tiles.get(e6.id); if (i4) { s4 += i4.byteSize; for (const e7 of i4.objectIds) t7.has(e7) || (t7.add(e7), this._referenceFeature(e7)); this._remove(e6); } }), this._addTileStorage(e5, t7, s4), e5.isLeaf = true, e5.children[0] = e5.children[1] = e5.children[2] = e5.children[3] = null, this._tileFeatureCounts.set(e5.id, t7.size); } _forEachLeaf(e5, t7) { for (const s4 of e5.children) t(s4) || (s4.isLeaf ? t7(s4) : this._forEachLeaf(s4, t7)); } _purge(e5) { if (!t(e5)) if (e5.isLeaf) this._remove(e5); else for (let t7 = 0; t7 < e5.children.length; t7++) { const s4 = e5.children[t7]; this._purge(s4), e5.children[t7] = null; } } _collectMissingTiles(e5, t7, s4) { const i4 = new F(s4, e5, this.extent); return this._collectMissingTilesRecurse(t7, i4, 1), i4.info; } _collectMissingTilesRecurse(e5, t7, s4) { if (e5.isLeaf) return; if (!e5.hasChildren) return void t7.addMissing(e5.level, e5.row, e5.col, s4); const i4 = s4 / 2; for (let r8 = 0; r8 < e5.children.length; r8++) { const s5 = e5.children[r8]; t(s5) ? t7.addMissing(e5.level + 1, (e5.row << 1) + ((2 & r8) >> 1), (e5.col << 1) + (1 & r8), i4) : this._collectMissingTilesRecurse(s5, t7, i4); } } _referenceFeature(e5) { const t7 = (this._refCounts.get(e5) || 0) + 1; return this._refCounts.set(e5, t7), 1 === t7 ? x5.ADDED : x5.UNCHANGED; } _unreferenceFeature(e5) { const t7 = (this._refCounts.get(e5) || 0) - 1; return 0 === t7 ? (this._refCounts.delete(e5), x5.REMOVED) : (t7 > 0 && this._refCounts.set(e5, t7), x5.UNCHANGED); } get test() { return { tiles: Array.from(this._tiles.values()).map((e5) => `${e5.data.id}:[${Array.from(e5.objectIds)}]`), featureReferences: Array.from(this._refCounts.keys()).map((e5) => `${e5}:${this._refCounts.get(e5)}`) }; } }; function C2(e5) { return e5.reduce((e6, t7) => e6 + E3(t7), 0); } function E3(e5) { return 32 + S3(e5.geometry) + t4(e5.attributes); } function S3(e5) { if (t(e5)) return 0; const t7 = c5(e5.lengths, 4); return 32 + c5(e5.coords, 8) + t7; } e([y2({ constructOnly: true })], v2.prototype, "featureStore", void 0), e([y2()], v2.prototype, "tileInfo", void 0), e([y2()], v2.prototype, "extent", void 0), e([y2()], v2.prototype, "maximumByteSize", void 0), v2 = e([n2("esri.views.interactive.snapping.featureSources.featureServiceSource.FeatureServiceTileStore")], v2); var T2 = class { constructor(e5, t7, s4) { this.data = e5, this.objectIds = t7, this.byteSize = s4; } }; var I = class { constructor(e5, t7, s4) { this.level = e5, this.row = t7, this.col = s4, this.isLeaf = false, this.extent = null, this.children = [null, null, null, null]; } get hasChildren() { return !this.isLeaf && (r(this.children[0]) || r(this.children[1]) || r(this.children[2]) || r(this.children[3])); } }; var j5 = class { constructor(e5, t7 = []) { this.missingTiles = t7, this.fullArea = 0, this.coveredArea = 0, this.fullArea = y3(e5.extent), this.coveredArea = this.fullArea; } prepend(e5) { this.missingTiles = e5.missingTiles.concat(this.missingTiles), this.coveredArea += e5.coveredArea, this.fullArea += e5.fullArea; } }; var F = class { constructor(e5, t7, s4) { this._tileInfo = e5, this._extent = null, this.info = new j5(t7), r(s4) && (this._extent = c2(s4)); } addMissing(e5, t7, s4, i4) { const r8 = new t3(null, e5, t7, s4); this._tileInfo.updateTileInfo(r8, j3.ExtrapolateOptions.POWER_OF_TWO), t(r8.extent) || r(this._extent) && !E(this._extent, r8.extent) || (this.info.missingTiles.push({ data: r8, resolution: i4 }), this.info.coveredArea -= y3(r8.extent)); } }; var w4 = 0.18751; var x5; !function(e5) { e5[e5.ADDED = 0] = "ADDED", e5[e5.REMOVED = 1] = "REMOVED", e5[e5.UNCHANGED = 2] = "UNCHANGED"; }(x5 || (x5 = {})); // node_modules/@arcgis/core/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceSnappingSourceWorker.js var E4 = class extends n3.EventedAccessor { constructor() { super(...arguments), this._isInitializing = true, this.remoteClient = null, this._whenSetup = A(), this._elevationAligner = r4(), this._elevationFilter = r5(), this._symbologyCandidatesFetcher = n5(), this._handles = new t2(), this._updatingHandles = new c3(), this._editsUpdatingHandles = new c3(), this._pendingApplyEdits = /* @__PURE__ */ new Map(), this._alignPointsInFeatures = async (e5, t7) => { const i4 = { points: e5 }, s4 = await this.remoteClient.invoke("alignElevation", i4, { signal: t7 }); return f(t7), s4; }, this._getSymbologyCandidates = async (e5, t7) => { const i4 = { candidates: e5, spatialReference: this._spatialReference.toJSON() }, s4 = await this.remoteClient.invoke("getSymbologyCandidates", i4, { signal: t7 }); return f(t7), s4; }; } get updating() { return this.updatingExcludingEdits || this._editsUpdatingHandles.updating || this._featureFetcher.updating; } get updatingExcludingEdits() { return this._featureFetcher.updatingExcludingEdits || this._isInitializing || this._updatingHandles.updating; } destroy() { this._featureFetcher.destroy(), this._queryEngine.destroy(), this._featureStore.clear(), this._handles.destroy(); } async setup(e5) { const { geometryType: t7, objectIdField: i4, timeInfo: r8, fields: n6 } = e5.serviceInfo, { hasZ: o4 } = e5, p2 = k.fromJSON(e5.spatialReference); this._spatialReference = p2, this._featureStore = new u2({ ...e5.serviceInfo, hasZ: o4, hasM: false }), this._queryEngine = new Y({ spatialReference: e5.spatialReference, featureStore: this._featureStore, geometryType: t7, fields: n6, hasZ: o4, hasM: false, objectIdField: i4, timeInfo: r8 ? v.fromJSON(r8) : null }), this._featureFetcher = new C({ store: new v2({ featureStore: this._featureStore }), url: e5.serviceInfo.url, objectIdField: e5.serviceInfo.objectIdField, globalIdField: e5.serviceInfo.globalIdField, capabilities: e5.serviceInfo.capabilities, spatialReference: p2, sourceSpatialReference: k.fromJSON(e5.serviceInfo.spatialReference) }); const d4 = "3d" === e5.configuration.viewType; return this._elevationAligner = r4(d4, { elevationInfo: r(e5.elevationInfo) ? x3.fromJSON(e5.elevationInfo) : null, alignPointsInFeatures: this._alignPointsInFeatures, spatialReference: p2 }), this._elevationFilter = r5(d4), this._handles.add([l(() => this._featureFetcher.availability, (e6) => this.emit("notify-availability", { availability: e6 }), U), l(() => this.updating, () => this._notifyUpdating())]), this._whenSetup.resolve(), this._isInitializing = false, this.configure(e5.configuration); } async configure(e5) { return await this._updatingHandles.addPromise(this._whenSetup.promise), this._updateFeatureFetcherConfiguration(e5), { result: {} }; } async fetchCandidates(e5, t7) { await this._whenSetup.promise, f(t7); const i4 = j6(e5), r8 = r(t7) ? t7.signal : null, a4 = await this._queryEngine.executeQueryForSnapping(i4, r8); f(r8); const o4 = await this._elevationAligner.alignCandidates(a4.candidates, r8); f(r8); const l3 = await this._symbologyCandidatesFetcher.fetch(o4, r8); f(r8); const p2 = 0 === l3.length ? o4 : o4.concat(l3); return { result: { candidates: this._elevationFilter.filter(i4, p2) } }; } async updateTiles(e5, t7) { return await this._updatingHandles.addPromise(this._whenSetup.promise), f(t7), this._featureFetcher.tileSize = e5.tileSize, this._featureFetcher.tilesOfInterest = e5.tiles, this._featureFetcher.tileInfo = r(e5.tileInfo) ? j3.fromJSON(e5.tileInfo) : null, C3; } async refresh(e5, t7) { return await this._updatingHandles.addPromise(this._whenSetup.promise), f(t7), this._featureFetcher.refresh(), C3; } async whenNotUpdating(e5, t7) { return await this._updatingHandles.addPromise(this._whenSetup.promise), f(t7), await j2(() => !this.updatingExcludingEdits, t7), f(t7), C3; } async getDebugInfo(e5, t7) { return f(t7), { result: this._featureFetcher.debugInfo }; } async beginApplyEdits(e5, t7) { this._updatingHandles.addPromise(this._whenSetup.promise), f(t7); const i4 = A(); return this._pendingApplyEdits.set(e5.id, i4), this._featureFetcher.applyEdits(i4.promise), this._editsUpdatingHandles.addPromise(i4.promise), C3; } async endApplyEdits(e5, t7) { const i4 = this._pendingApplyEdits.get(e5.id); return i4 && i4.resolve(e5.edits), f(t7), C3; } async notifyElevationSourceChange(e5, t7) { return this._elevationAligner.notifyElevationSourceChange(), C3; } async notifySymbologyChange(e5, t7) { return C3; } async setSymbologySnappingSupported(e5) { return this._symbologyCandidatesFetcher = n5(e5, this._getSymbologyCandidates), C3; } _updateFeatureFetcherConfiguration(e5) { this._featureFetcher.filter = r(e5.filter) ? x.fromJSON(e5.filter) : null, this._featureFetcher.customParameters = e5.customParameters; } _notifyUpdating() { this.emit("notify-updating", { updating: this.updating }); } }; e([y2({ readOnly: true })], E4.prototype, "updating", null), e([y2({ readOnly: true })], E4.prototype, "updatingExcludingEdits", null), e([y2()], E4.prototype, "_isInitializing", void 0), E4 = e([n2("esri.views.interactive.snapping.featureSources.featureServiceSource.FeatureServiceSnappingSourceWorker")], E4); var b = E4; function j6(e5) { return { point: e5.point, distance: e5.distance, types: e5.types, query: r(e5.filter) ? e5.filter : { where: "1=1" } }; } var C3 = { result: {} }; export { b as default }; //# sourceMappingURL=FeatureServiceSnappingSourceWorker-MVB6ESH2.js.map