import { n as n4, s as s3 } from "./chunk-4JM5IOYA.js"; import { u } from "./chunk-4D6PVVFX.js"; import "./chunk-WQJRLXWG.js"; import { a as a2, l } from "./chunk-MTFA4FTA.js"; import { n as n3 } from "./chunk-YASLQAXE.js"; import { i as i2 } from "./chunk-JGOAMEPM.js"; import { S as S2, c, d as d4 } from "./chunk-Z64YKYHD.js"; import { x as x3 } from "./chunk-2VFJVI2I.js"; import { d as d3, t as t2, x as x2 } from "./chunk-GS2NUWMB.js"; import { r as r2 } from "./chunk-FUEX356Y.js"; import "./chunk-54AOZV5X.js"; import "./chunk-PK35UGFJ.js"; import { L } from "./chunk-P4UZNLD5.js"; import { me, ne } from "./chunk-FYNVVMWY.js"; import "./chunk-Q52DVFYK.js"; import "./chunk-HBMVUVZX.js"; import { o as o2 } from "./chunk-TNLRDNTC.js"; import { g } from "./chunk-RZFGRBD7.js"; import "./chunk-PUSPZYFZ.js"; import "./chunk-EN7YGJWG.js"; import "./chunk-VBNMTM7L.js"; import "./chunk-3D3QEPRE.js"; import "./chunk-JFNNSBWL.js"; import { K, b } from "./chunk-UD63WBG3.js"; import "./chunk-EWE6EXPY.js"; import "./chunk-KUXNUNAI.js"; import "./chunk-WNCU6BFU.js"; import "./chunk-PIGRDDRG.js"; import "./chunk-BJHM4JNS.js"; import "./chunk-F6A2QQ26.js"; import "./chunk-C43UE3Z5.js"; import { n as n2 } from "./chunk-H2KDMZTR.js"; import "./chunk-7XXXCK2A.js"; import "./chunk-7ZIDBK7B.js"; import { y as y3 } from "./chunk-EG5OI4V4.js"; import "./chunk-65BYCSII.js"; import "./chunk-WZQZRKNH.js"; import "./chunk-LRDX4TO7.js"; import "./chunk-6A4U74YA.js"; import "./chunk-N2663GRX.js"; import "./chunk-O4FY3ITT.js"; import "./chunk-WEMIK25H.js"; import "./chunk-7N4X6GF3.js"; import "./chunk-JXW4QTJA.js"; import "./chunk-UXF37FQ4.js"; import "./chunk-ZOEK6QHJ.js"; import "./chunk-XNLG7T2T.js"; import "./chunk-IR4PV7VK.js"; import { d as d2, v } from "./chunk-2Z6LERTI.js"; import "./chunk-OWVBLVP3.js"; import "./chunk-AFZ7XSEW.js"; import "./chunk-4NKD334K.js"; import "./chunk-65K7LC56.js"; import "./chunk-ATPLLI5W.js"; import "./chunk-XH7RUGVZ.js"; import { m } from "./chunk-TBBTRX4O.js"; import "./chunk-YBSUITLL.js"; import "./chunk-ALDCDSPV.js"; import "./chunk-DT6EAZQ5.js"; import "./chunk-HNOZUNJ4.js"; import { U } from "./chunk-VNFRAYHO.js"; import { i } from "./chunk-R5IG2D6H.js"; import { G, S, j, nt } from "./chunk-VBRY5KJM.js"; import { s as s2 } from "./chunk-PDKDCAAD.js"; import { M2 as M } from "./chunk-ECW2QABR.js"; import "./chunk-GCDJLKH4.js"; import { k2 as k } from "./chunk-MRJEICT6.js"; import { d, e, n2 as n, y3 as y2 } from "./chunk-Y3WMVFTW.js"; import "./chunk-SAS7RONY.js"; import "./chunk-WSRBH7BF.js"; import "./chunk-IHXECKQQ.js"; import { x, y } from "./chunk-ULGDPLM2.js"; import { s3 as s } from "./chunk-EMJ4ZSM2.js"; import { o } from "./chunk-IKP3YN53.js"; import { a, r, t } from "./chunk-GZT4BVFP.js"; import "./chunk-A5ICIBVI.js"; // node_modules/@arcgis/core/rest/query/operations/pbfJSONFeatureSet.js function i3(e2, t3) { return t3; } function n5(e2, t3, r4, s8) { switch (r4) { case 0: return d5(e2, t3 + s8, 0); case 1: return e2.originPosition === "lowerLeft" ? d5(e2, t3 + s8, 1) : l2(e2, t3 + s8, 1); } } function a3(e2, t3, r4, s8) { return r4 === 2 ? d5(e2, t3, 2) : n5(e2, t3, r4, s8); } function h(e2, t3, r4, s8) { return r4 === 2 ? d5(e2, t3, 3) : n5(e2, t3, r4, s8); } function u2(e2, t3, r4, s8) { return r4 === 3 ? d5(e2, t3, 3) : a3(e2, t3, r4, s8); } function d5({ translate: e2, scale: t3 }, r4, s8) { return e2[s8] + r4 * t3[s8]; } function l2({ translate: e2, scale: t3 }, r4, s8) { return e2[s8] - r4 * t3[s8]; } var c2 = class { constructor(e2) { this.options = e2, this.geometryTypes = ["esriGeometryPoint", "esriGeometryMultipoint", "esriGeometryPolyline", "esriGeometryPolygon"], this.previousCoordinate = [0, 0], this.transform = null, this.applyTransform = i3, this.lengths = [], this.currentLengthIndex = 0, this.toAddInCurrentPath = 0, this.vertexDimension = 0, this.coordinateBuffer = null, this.coordinateBufferPtr = 0, this._attributesConstructor = () => { }; } createFeatureResult() { return { fields: [], features: [] }; } finishFeatureResult(e2) { if (this.options.applyTransform && (e2.transform = null), this._attributesConstructor = () => { }, this.coordinateBuffer = null, this.lengths.length = 0, !e2.hasZ) return; const s8 = o2(e2.geometryType, this.options.sourceSpatialReference, e2.spatialReference); if (!t(s8)) for (const t3 of e2.features) s8(t3.geometry); } createSpatialReference() { return {}; } addField(e2, t3) { e2.fields.push(t3); const r4 = e2.fields.map((e3) => e3.name); this._attributesConstructor = function() { for (const e3 of r4) this[e3] = null; }; } addFeature(e2, t3) { e2.features.push(t3); } prepareFeatures(t3) { switch (this.transform = t3.transform, this.options.applyTransform && t3.transform && (this.applyTransform = this._deriveApplyTransform(t3)), this.vertexDimension = 2, t3.hasZ && this.vertexDimension++, t3.hasM && this.vertexDimension++, t3.geometryType) { case "esriGeometryPoint": this.addCoordinate = (e2, t4, r4) => this.addCoordinatePoint(e2, t4, r4), this.createGeometry = (e2) => this.createPointGeometry(e2); break; case "esriGeometryPolygon": this.addCoordinate = (e2, t4, r4) => this._addCoordinatePolygon(e2, t4, r4), this.createGeometry = (e2) => this._createPolygonGeometry(e2); break; case "esriGeometryPolyline": this.addCoordinate = (e2, t4, r4) => this._addCoordinatePolyline(e2, t4, r4), this.createGeometry = (e2) => this._createPolylineGeometry(e2); break; case "esriGeometryMultipoint": this.addCoordinate = (e2, t4, r4) => this._addCoordinateMultipoint(e2, t4, r4), this.createGeometry = (e2) => this._createMultipointGeometry(e2); break; default: n2(t3.geometryType); } } createFeature() { return this.lengths.length = 0, this.currentLengthIndex = 0, this.previousCoordinate[0] = 0, this.previousCoordinate[1] = 0, this.coordinateBuffer = null, this.coordinateBufferPtr = 0, { attributes: new this._attributesConstructor() }; } allocateCoordinates() { } addLength(e2, t3, r4) { this.lengths.length === 0 && (this.toAddInCurrentPath = t3), this.lengths.push(t3); } addQueryGeometry(e2, t3) { const { queryGeometry: r4, queryGeometryType: i5 } = t3, n10 = me(r4.clone(), r4, false, false, this.transform), a7 = ne(n10, i5, false, false); e2.queryGeometryType = i5, e2.queryGeometry = { ...a7 }; } createPointGeometry(e2) { const t3 = { x: 0, y: 0, spatialReference: e2.spatialReference }; return e2.hasZ && (t3.z = 0), e2.hasM && (t3.m = 0), t3; } addCoordinatePoint(e2, t3, r4) { switch (t3 = this.applyTransform(this.transform, t3, r4, 0), r4) { case 0: e2.x = t3; break; case 1: e2.y = t3; break; case 2: "z" in e2 ? e2.z = t3 : e2.m = t3; break; case 3: e2.m = t3; } } _transformPathLikeValue(e2, t3) { let r4 = 0; return t3 <= 1 && (r4 = this.previousCoordinate[t3], this.previousCoordinate[t3] += e2), this.applyTransform(this.transform, e2, t3, r4); } _addCoordinatePolyline(e2, t3, r4) { this._dehydratedAddPointsCoordinate(e2.paths, t3, r4); } _addCoordinatePolygon(e2, t3, r4) { this._dehydratedAddPointsCoordinate(e2.rings, t3, r4); } _addCoordinateMultipoint(e2, t3, r4) { r4 === 0 && e2.points.push([]); const s8 = this._transformPathLikeValue(t3, r4); e2.points[e2.points.length - 1].push(s8); } _createPolygonGeometry(e2) { return { rings: [[]], spatialReference: e2.spatialReference, hasZ: !!e2.hasZ, hasM: !!e2.hasM }; } _createPolylineGeometry(e2) { return { paths: [[]], spatialReference: e2.spatialReference, hasZ: !!e2.hasZ, hasM: !!e2.hasM }; } _createMultipointGeometry(e2) { return { points: [], spatialReference: e2.spatialReference, hasZ: !!e2.hasZ, hasM: !!e2.hasM }; } _dehydratedAddPointsCoordinate(e2, t3, r4) { r4 === 0 && this.toAddInCurrentPath-- == 0 && (e2.push([]), this.toAddInCurrentPath = this.lengths[++this.currentLengthIndex] - 1, this.previousCoordinate[0] = 0, this.previousCoordinate[1] = 0); const s8 = this._transformPathLikeValue(t3, r4), o4 = e2[e2.length - 1]; r4 === 0 && (this.coordinateBufferPtr = 0, this.coordinateBuffer = new Array(this.vertexDimension), o4.push(this.coordinateBuffer)), this.coordinateBuffer[this.coordinateBufferPtr++] = s8; } _deriveApplyTransform(e2) { const { hasZ: t3, hasM: r4 } = e2; return t3 && r4 ? u2 : t3 ? a3 : r4 ? h : n5; } }; // node_modules/@arcgis/core/rest/query/executeQueryPBF.js async function n6(o4, s8, n10) { const p2 = n3(o4), i5 = { ...n10 }, u4 = b.from(s8), m5 = !u4.quantizationParameters, { data: f } = await d3(p2, u4, new c2({ sourceSpatialReference: u4.sourceSpatialReference, applyTransform: m5 }), i5); return f; } // node_modules/@arcgis/core/rest/query/operations/queryAttachments.js function n7(t3) { const o4 = t3.toJSON(); return o4.attachmentTypes && (o4.attachmentTypes = o4.attachmentTypes.join(",")), o4.keywords && (o4.keywords = o4.keywords.join(",")), o4.globalIds && (o4.globalIds = o4.globalIds.join(",")), o4.objectIds && (o4.objectIds = o4.objectIds.join(",")), o4.size && (o4.size = o4.size.join(",")), o4; } function a4(o4, r4) { const n10 = {}; for (const a7 of o4) { const { parentObjectId: o5, parentGlobalId: c5, attachmentInfos: i5 } = a7; for (const a8 of i5) { const { id: i6 } = a8, m5 = S(i(`${r4}/${o5}/attachments/${i6}`)), p2 = l.fromJSON(a8); p2.set({ url: m5, parentObjectId: o5, parentGlobalId: c5 }), n10[o5] ? n10[o5].push(p2) : n10[o5] = [p2]; } } return n10; } function c3(t3, e2, s8) { let a7 = { query: t2({ ...t3.query, f: "json", ...n7(e2) }) }; return s8 && (a7 = { ...s8, ...a7, query: { ...s8.query, ...a7.query } }), U(t3.path + "/queryAttachments", a7); } // node_modules/@arcgis/core/rest/query/executeAttachmentQuery.js async function a5(a7, m5, n10) { const s8 = n3(a7); return c3(s8, c.from(m5), { ...n10 }).then((t3) => a4(t3.data.attachmentGroups, s8.path)); } // node_modules/@arcgis/core/rest/query/executeForExtent.js async function m2(m5, n10, s8) { const p2 = n3(m5); return x2(p2, b.from(n10), { ...s8 }).then((t3) => ({ count: t3.data.count, extent: M.fromJSON(t3.data.extent) })); } // node_modules/@arcgis/core/rest/query/operations/queryRelatedRecords.js function o3(e2, t3) { const o4 = e2.toJSON(); return o4.objectIds && (o4.objectIds = o4.objectIds.join(",")), o4.orderByFields && (o4.orderByFields = o4.orderByFields.join(",")), o4.outFields && !t3?.returnCountOnly ? o4.outFields.includes("*") ? o4.outFields = "*" : o4.outFields = o4.outFields.join(",") : delete o4.outFields, o4.outSpatialReference && (o4.outSR = o4.outSR.wkid || JSON.stringify(o4.outSR.toJSON()), delete o4.outSpatialReference), o4.dynamicDataSource && (o4.layer = JSON.stringify({ source: o4.dynamicDataSource }), delete o4.dynamicDataSource), o4; } async function r3(e2, t3, o4) { const r4 = await s4(e2, t3, o4), n10 = r4.data, a7 = n10.geometryType, d7 = n10.spatialReference, c5 = {}; for (const s8 of n10.relatedRecordGroups) { const e3 = { fields: void 0, objectIdFieldName: void 0, geometryType: a7, spatialReference: d7, hasZ: !!n10.hasZ, hasM: !!n10.hasM, features: s8.relatedRecords }; if (s8.objectId != null) c5[s8.objectId] = e3; else for (const t4 in s8) s8.hasOwnProperty(t4) && t4 !== "relatedRecords" && (c5[s8[t4]] = e3); } return { ...r4, data: c5 }; } async function n8(e2, t3, o4) { const r4 = await s4(e2, t3, o4, { returnCountOnly: true }), n10 = r4.data, a7 = {}; for (const s8 of n10.relatedRecordGroups) s8.objectId != null && (a7[s8.objectId] = s8.count); return { ...r4, data: a7 }; } async function s4(r4, n10, s8 = {}, a7) { const d7 = t2({ ...r4.query, f: "json", ...a7, ...o3(n10, a7) }); return U(r4.path + "/queryRelatedRecords", { ...s8, query: { ...s8.query, ...d7 } }); } // node_modules/@arcgis/core/rest/query/executeRelationshipQuery.js async function n9(e2, n10, u4) { n10 = d4.from(n10); const a7 = n3(e2); return r3(a7, n10, u4).then((t3) => { const r4 = t3.data, e3 = {}; return Object.keys(r4).forEach((t4) => e3[t4] = x3.fromJSON(r4[t4])), e3; }); } async function u3(r4, o4, n10) { o4 = d4.from(o4); const u4 = n3(r4); return n8(u4, o4, { ...n10 }).then((t3) => t3.data); } // node_modules/@arcgis/core/rest/query/operations/queryTopFeatures.js var l3 = "Layer does not support extent calculation."; function y4(t3, r4) { const o4 = t3.geometry, i5 = t3.toJSON(), s8 = i5; if (r(o4) && (s8.geometry = JSON.stringify(o4), s8.geometryType = v(o4), s8.inSR = o4.spatialReference.wkid || JSON.stringify(o4.spatialReference)), i5.topFilter?.groupByFields && (s8.topFilter.groupByFields = i5.topFilter.groupByFields.join(",")), i5.topFilter?.orderByFields && (s8.topFilter.orderByFields = i5.topFilter.orderByFields.join(",")), i5.topFilter && (s8.topFilter = JSON.stringify(s8.topFilter)), i5.objectIds && (s8.objectIds = i5.objectIds.join(",")), i5.orderByFields && (s8.orderByFields = i5.orderByFields.join(",")), i5.outFields && !(r4?.returnCountOnly || r4?.returnExtentOnly || r4?.returnIdsOnly) ? i5.outFields.includes("*") ? s8.outFields = "*" : s8.outFields = i5.outFields.join(",") : delete s8.outFields, i5.outSR ? s8.outSR = i5.outSR.wkid || JSON.stringify(i5.outSR) : o4 && i5.returnGeometry && (s8.outSR = s8.inSR), i5.returnGeometry && delete i5.returnGeometry, i5.timeExtent) { const t4 = i5.timeExtent, { start: e2, end: r5 } = t4; e2 == null && r5 == null || (s8.time = e2 === r5 ? e2 : `${e2 == null ? "null" : e2},${r5 == null ? "null" : r5}`), delete i5.timeExtent; } return s8; } async function d6(t3, e2, r4, o4) { const n10 = await c4(t3, e2, "json", o4); return r2(e2, r4, n10.data), n10; } async function m3(t3, r4, o4) { return r(r4.timeExtent) && r4.timeExtent.isEmpty ? { data: { objectIds: [] } } : c4(t3, r4, "json", o4, { returnIdsOnly: true }); } async function p(t3, r4, o4) { return r(r4.timeExtent) && r4.timeExtent.isEmpty ? { data: { count: 0, extent: null } } : c4(t3, r4, "json", o4, { returnExtentOnly: true, returnCountOnly: true }).then((t4) => { const e2 = t4.data; if (e2.hasOwnProperty("extent")) return t4; if (e2.features) throw new Error(l3); if (e2.hasOwnProperty("count")) throw new Error(l3); return t4; }); } function a6(t3, r4, o4) { return r(r4.timeExtent) && r4.timeExtent.isEmpty ? Promise.resolve({ data: { count: 0 } }) : c4(t3, r4, "json", o4, { returnIdsOnly: true, returnCountOnly: true }); } function c4(n10, u4, l5, d7 = {}, m5 = {}) { const p2 = typeof n10 == "string" ? j(n10) : n10, a7 = u4.geometry ? [u4.geometry] : []; return d7.responseType = l5 === "pbf" ? "array-buffer" : "json", L(a7, null, d7).then((o4) => { const n11 = o4 && o4[0]; r(n11) && ((u4 = u4.clone()).geometry = n11); const i5 = t2({ ...p2.query, f: l5, ...m5, ...y4(u4, m5) }); return U(G(p2.path, "queryTopFeatures"), { ...d7, query: { ...i5, ...d7.query } }); }); } // node_modules/@arcgis/core/rest/query/executeTopFeaturesQuery.js async function s5(s8, p2, u4, a7) { const m5 = n3(s8), i5 = { ...a7 }, { data: f } = await d6(m5, S2.from(p2), u4, i5); return x3.fromJSON(f); } // node_modules/@arcgis/core/rest/query/executeForTopIds.js async function s6(s8, e2, p2) { const a7 = n3(s8); return (await m3(a7, S2.from(e2), { ...p2 })).data.objectIds; } // node_modules/@arcgis/core/rest/query/executeForTopExtents.js async function m4(m5, s8, n10) { const p2 = n3(m5), a7 = await p(p2, S2.from(s8), { ...n10 }); return { count: a7.data.count, extent: M.fromJSON(a7.data.extent) }; } // node_modules/@arcgis/core/rest/query/executeForTopCount.js async function s7(s8, e2, p2) { const u4 = n3(s8); return (await a6(u4, S2.from(e2), { ...p2 })).data.count; } // node_modules/@arcgis/core/tasks/Task.js var i4 = class extends y2 { constructor(...r4) { super(...r4), this.requestOptions = null, this.url = null; } normalizeCtorArgs(r4, s8) { return typeof r4 != "string" ? r4 : { url: r4, ...s8 }; } get parsedUrl() { return this._parseUrl(this.url); } _parseUrl(r4) { return r4 ? j(r4) : null; } _encode(r4, s8, t3) { const o4 = {}; for (const e2 in r4) { if (e2 === "declaredClass") continue; const i5 = r4[e2]; if (i5 != null && typeof i5 != "function") if (Array.isArray(i5)) { o4[e2] = []; for (let r5 = 0; r5 < i5.length; r5++) o4[e2][r5] = this._encode(i5[r5]); } else if (typeof i5 == "object") if (i5.toJSON) { const r5 = i5.toJSON(t3 && t3[e2]); o4[e2] = s8 ? r5 : JSON.stringify(r5); } else o4[e2] = s8 ? i5 : JSON.stringify(i5); else o4[e2] = i5; } return o4; } }; e([d({ readOnly: true })], i4.prototype, "parsedUrl", null), e([d()], i4.prototype, "requestOptions", void 0), e([d({ type: String })], i4.prototype, "url", void 0), i4 = e([n("esri.tasks.Task")], i4); var l4 = i4; // node_modules/@arcgis/core/layers/graphics/sources/support/QueryTask.js var g2 = class extends l4 { constructor(t3) { super(t3), this.dynamicDataSource = null, this.fieldsIndex = null, this.format = "json", this.gdbVersion = null, this.infoFor3D = null, this.sourceSpatialReference = null; } execute(t3, e2) { return this.executeJSON(t3, e2).then((r4) => this.featureSetFromJSON(t3, r4, e2)); } async executeJSON(t3, e2) { const o4 = { ...this.requestOptions, ...e2 }, s8 = this._normalizeQuery(t3), i5 = t3.outStatistics?.[0] != null, u4 = a("featurelayer-pbf-statistics"), n10 = !i5 || u4; let a7; if (this.format === "pbf" && n10) try { a7 = await n6(this.url, s8, o4); } catch (m5) { if (m5.name !== "query:parsing-pbf") throw m5; this.format = "json"; } return this.format !== "json" && n10 || (a7 = await a2(this.url, s8, o4)), this._normalizeFields(a7.fields), a7; } async featureSetFromJSON(t3, e2, r4) { if (!this._queryIs3DObjectFormat(t3) || t(this.infoFor3D) || !e2.features || !e2.features.length) return x3.fromJSON(e2); const { meshFeatureSetFromJSON: s8 } = await y(import("./meshFeatureSet-77HDYLJC.js"), r4); return s8(t3, this.infoFor3D, e2); } executeForCount(t3, e2) { const r4 = { ...this.requestOptions, ...e2 }, o4 = this._normalizeQuery(t3); return n4(this.url, o4, r4); } executeForExtent(t3, e2) { const r4 = { ...this.requestOptions, ...e2 }, o4 = this._normalizeQuery(t3); return m2(this.url, o4, r4); } executeForIds(t3, e2) { const r4 = { ...this.requestOptions, ...e2 }, o4 = this._normalizeQuery(t3); return s3(this.url, o4, r4); } executeRelationshipQuery(t3, e2) { t3 = d4.from(t3); const r4 = { ...this.requestOptions, ...e2 }; return (this.gdbVersion || this.dynamicDataSource) && ((t3 = t3.clone()).gdbVersion = t3.gdbVersion || this.gdbVersion, t3.dynamicDataSource = t3.dynamicDataSource || this.dynamicDataSource), n9(this.url, t3, r4); } executeRelationshipQueryForCount(t3, e2) { t3 = d4.from(t3); const r4 = { ...this.requestOptions, ...e2 }; return (this.gdbVersion || this.dynamicDataSource) && ((t3 = t3.clone()).gdbVersion = t3.gdbVersion || this.gdbVersion, t3.dynamicDataSource = t3.dynamicDataSource || this.dynamicDataSource), u3(this.url, t3, r4); } executeAttachmentQuery(t3, e2) { const r4 = { ...this.requestOptions, ...e2 }; return a5(this.url, t3, r4); } executeTopFeaturesQuery(t3, e2) { const r4 = { ...this.requestOptions, ...e2 }; return s5(this.parsedUrl, t3, this.sourceSpatialReference, r4); } executeForTopIds(t3, e2) { const r4 = { ...this.requestOptions, ...e2 }; return s6(this.parsedUrl, t3, r4); } executeForTopExtents(t3, e2) { const r4 = { ...this.requestOptions, ...e2 }; return m4(this.parsedUrl, t3, r4); } executeForTopCount(t3, e2) { const r4 = { ...this.requestOptions, ...e2 }; return s7(this.parsedUrl, t3, r4); } _normalizeQuery(t3) { let r4 = b.from(t3); if (r4.sourceSpatialReference = r4.sourceSpatialReference || this.sourceSpatialReference, (this.gdbVersion || this.dynamicDataSource) && (r4 = r4 === t3 ? r4.clone() : r4, r4.gdbVersion = t3.gdbVersion || this.gdbVersion, r4.dynamicDataSource = t3.dynamicDataSource ? K.from(t3.dynamicDataSource) : this.dynamicDataSource), r(this.infoFor3D) && this._queryIs3DObjectFormat(t3)) { r4 = r4 === t3 ? r4.clone() : r4, r4.formatOf3DObjects = null; for (const t4 of this.infoFor3D.queryFormats) { if (t4.id === "3D_glb") { r4.formatOf3DObjects = t4.id; break; } t4.id !== "3D_gltf" || r4.formatOf3DObjects || (r4.formatOf3DObjects = t4.id); } if (!r4.formatOf3DObjects) throw new s("query:unsupported-3d-query-formats", "Could not find any supported 3D object query format. Only supported formats are 3D_glb and 3D_gltf"); if (t(r4.outFields) || !r4.outFields.includes("*")) { r4 = r4 === t3 ? r4.clone() : r4, t(r4.outFields) && (r4.outFields = []); const { originX: e2, originY: s8, originZ: i5, translationX: u4, translationY: n10, translationZ: a7, scaleX: c5, scaleY: p2, scaleZ: m5, rotationX: f, rotationY: l5, rotationZ: h2, rotationDeg: d7 } = this.infoFor3D.transformFieldRoles; r4.outFields.push(e2, s8, i5, u4, n10, a7, c5, p2, m5, f, l5, h2, d7); } } return r4; } _normalizeFields(t3) { if (r(this.fieldsIndex) && r(t3)) for (const e2 of t3) { const t4 = this.fieldsIndex.get(e2.name); t4 && Object.assign(e2, t4.toJSON()); } } _queryIs3DObjectFormat(t3) { return r(this.infoFor3D) && t3.returnGeometry && t3.multipatchOption !== "xyFootprint" && !t3.outStatistics; } }; e([d({ type: K })], g2.prototype, "dynamicDataSource", void 0), e([d()], g2.prototype, "fieldsIndex", void 0), e([d()], g2.prototype, "format", void 0), e([d()], g2.prototype, "gdbVersion", void 0), e([d()], g2.prototype, "infoFor3D", void 0), e([d()], g2.prototype, "sourceSpatialReference", void 0), g2 = e([n("esri.tasks.QueryTask")], g2); var Q = g2; // node_modules/@arcgis/core/layers/graphics/sources/FeatureLayerSource.js var I = new s2({ originalAndCurrentFeatures: "original-and-current-features", none: "none" }); async function _(e2) { if (typeof e2 == "string") { const t3 = nt(e2); return t3 || { data: e2 }; } return new Promise((t3, r4) => { const s8 = new FileReader(); s8.readAsDataURL(e2), s8.onload = () => t3(nt(s8.result)), s8.onerror = (e3) => r4(e3); }); } var O = new Set(["Feature Layer", "Table"]); var S3 = class extends m { constructor() { super(...arguments), this.type = "feature-layer", this.refresh = x(async () => { await this.load(); const e2 = this.sourceJSON.editingInfo?.lastEditDate; if (e2 == null) return { dataChanged: true, updates: {} }; try { await this._fetchService(null); } catch { return { dataChanged: true, updates: {} }; } const t3 = e2 !== this.sourceJSON.editingInfo?.lastEditDate; return { dataChanged: t3, updates: t3 ? { editingInfo: this.sourceJSON.editingInfo, extent: this.sourceJSON.extent } : null }; }); } load(e2) { const t3 = r(e2) ? e2.signal : null; return this.addResolvingPromise(this._fetchService(this.layer.sourceJSON, t3)), Promise.resolve(this); } get queryTask() { const { capabilities: { query: { supportsFormatPBF: e2 } }, parsedUrl: t3, dynamicDataSource: r4, infoFor3D: s8, gdbVersion: a7, spatialReference: o4, fieldsIndex: n10 } = this.layer, u4 = a("featurelayer-pbf") && e2 && t(s8) ? "pbf" : "json"; return new Q({ url: t3.path, format: u4, fieldsIndex: n10, infoFor3D: s8, dynamicDataSource: r4, gdbVersion: a7, sourceSpatialReference: o4 }); } async addAttachment(e2, t3) { await this.load(); const s8 = e2.attributes[this.layer.objectIdField], a7 = this.layer.parsedUrl.path + "/" + s8 + "/addAttachment", i5 = this._getLayerRequestOptions(), o4 = this._getFormDataForAttachment(t3, i5.query); try { const e3 = await U(a7, { body: o4 }); return this._createFeatureEditResult(e3.data.addAttachmentResult); } catch (n10) { throw this._createAttachmentErrorResult(s8, n10); } } async updateAttachment(e2, t3, s8) { await this.load(); const a7 = e2.attributes[this.layer.objectIdField], i5 = this.layer.parsedUrl.path + "/" + a7 + "/updateAttachment", o4 = this._getLayerRequestOptions({ query: { attachmentId: t3 } }), n10 = this._getFormDataForAttachment(s8, o4.query); try { const e3 = await U(i5, { body: n10 }); return this._createFeatureEditResult(e3.data.updateAttachmentResult); } catch (u4) { throw this._createAttachmentErrorResult(a7, u4); } } async applyEdits(e2, t3) { await this.load(); const s8 = e2.addFeatures.map(this._serializeFeature, this), a7 = e2.updateFeatures.map(this._serializeFeature, this), i5 = this._getFeatureIds(e2.deleteFeatures, t3?.globalIdUsed); i2(s8, a7, this.layer.spatialReference); const o4 = [], n10 = [], u4 = [...e2.deleteAttachments]; for (const r4 of e2.addAttachments) o4.push(await this._serializeAttachment(r4)); for (const r4 of e2.updateAttachments) n10.push(await this._serializeAttachment(r4)); const d7 = o4.length || n10.length || u4.length ? { adds: o4, updates: n10, deletes: u4 } : null, l5 = { gdbVersion: t3?.gdbVersion || this.layer.gdbVersion, rollbackOnFailure: t3?.rollbackOnFailureEnabled, useGlobalIds: t3?.globalIdUsed, returnEditMoment: t3?.returnEditMoment, usePreviousEditMoment: t3?.usePreviousEditMoment, sessionId: t3?.sessionId }; t3?.returnServiceEditsOption ? (l5.edits = JSON.stringify([{ id: this.layer.layerId, adds: s8, updates: a7, deletes: i5, attachments: d7 }]), l5.returnServiceEditsOption = I.toJSON(t3?.returnServiceEditsOption), l5.returnServiceEditsInSourceSR = t3?.returnServiceEditsInSourceSR) : (l5.adds = s8.length ? JSON.stringify(s8) : null, l5.updates = a7.length ? JSON.stringify(a7) : null, l5.deletes = i5.length ? t3?.globalIdUsed ? JSON.stringify(i5) : i5.join(",") : null, l5.attachments = d7 && JSON.stringify(d7)); const c5 = this._getLayerRequestOptions({ method: "post", query: l5 }), h2 = t3?.returnServiceEditsOption ? this.layer.url : this.layer.parsedUrl.path, p2 = await U(h2 + "/applyEdits", c5); return this._createEditsResult(p2); } async deleteAttachments(e2, t3) { await this.load(); const s8 = e2.attributes[this.layer.objectIdField], a7 = this.layer.parsedUrl.path + "/" + s8 + "/deleteAttachments"; try { return (await U(a7, this._getLayerRequestOptions({ query: { attachmentIds: t3.join(",") }, method: "post" }))).data.deleteAttachmentResults.map(this._createFeatureEditResult); } catch (i5) { throw this._createAttachmentErrorResult(s8, i5); } } fetchRecomputedExtents(e2 = {}) { const t3 = e2.signal; return this.load({ signal: t3 }).then(async () => { const t4 = this._getLayerRequestOptions({ ...e2, query: { returnUpdates: true } }), { layerId: a7, url: i5 } = this.layer, { data: o4 } = await U(`${i5}/${a7}`, t4), { id: n10, extent: u4, fullExtent: d7, timeExtent: l5 } = o4, c5 = u4 || d7; return { id: n10, fullExtent: c5 && M.fromJSON(c5), timeExtent: l5 && y3.fromJSON({ start: l5[0], end: l5[1] }) }; }); } async queryAttachments(e2, t3 = {}) { const { parsedUrl: s8 } = this.layer, a7 = s8.path; await this.load(); const i5 = this._getLayerRequestOptions(t3); if (!this.layer.get("capabilities.operations.supportsQueryAttachments")) { const { objectIds: t4 } = e2, s9 = []; for (const e3 of t4) { const t5 = a7 + "/" + e3 + "/attachments"; s9.push(U(t5, i5)); } return Promise.all(s9).then((e3) => t4.map((t5, r4) => ({ parentObjectId: t5, attachmentInfos: e3[r4].data.attachmentInfos }))).then((e3) => a4(e3, a7)); } return this.queryTask.executeAttachmentQuery(e2, i5); } async queryFeatures(e2, t3) { return await this.load(), this.queryTask.execute(e2, { ...t3, query: this._createRequestQueryOptions(t3) }); } async queryFeaturesJSON(e2, t3) { return await this.load(), this.queryTask.executeJSON(e2, { ...t3, query: this._createRequestQueryOptions(t3) }); } async queryObjectIds(e2, t3) { return await this.load(), this.queryTask.executeForIds(e2, { ...t3, query: this._createRequestQueryOptions(t3) }); } async queryFeatureCount(e2, t3) { return await this.load(), this.queryTask.executeForCount(e2, { ...t3, query: this._createRequestQueryOptions(t3) }); } async queryExtent(e2, t3) { return await this.load(), this.queryTask.executeForExtent(e2, { ...t3, query: this._createRequestQueryOptions(t3) }); } async queryRelatedFeatures(e2, t3) { return await this.load(), this.queryTask.executeRelationshipQuery(e2, { ...t3, query: this._createRequestQueryOptions(t3) }); } async queryRelatedFeaturesCount(e2, t3) { return await this.load(), this.queryTask.executeRelationshipQueryForCount(e2, { ...t3, query: this._createRequestQueryOptions(t3) }); } async queryTopFeatures(e2, t3) { return await this.load(), this.queryTask.executeTopFeaturesQuery(e2, { ...t3, query: this._createRequestQueryOptions(t3) }); } async queryTopObjectIds(e2, t3) { return await this.load(), this.queryTask.executeForTopIds(e2, { ...t3, query: this._createRequestQueryOptions(t3) }); } async queryTopExtents(e2, t3) { return await this.load(), this.queryTask.executeForTopExtents(e2, { ...t3, query: this._createRequestQueryOptions(t3) }); } async queryTopCount(e2, t3) { return await this.load(), this.queryTask.executeForTopCount(e2, { ...t3, query: this._createRequestQueryOptions(t3) }); } _createRequestQueryOptions(e2) { const t3 = { ...this.layer.customParameters, token: this.layer.apiKey, ...e2?.query }; return this.layer.datesInUnknownTimezone && (t3.timeReferenceUnknownClient = true), t3; } async _fetchService(e2, t3) { if (!e2) { const { data: s9 } = await U(this.layer.parsedUrl.path, this._getLayerRequestOptions({ query: a("featurelayer-advanced-symbols") ? { returnAdvancedSymbols: true } : {}, signal: t3 })); e2 = s9; } this.sourceJSON = this._patchServiceJSON(e2); const s8 = e2.type; if (!O.has(s8)) throw new s("feature-layer-source:unsupported-type", `Source type "${s8}" is not supported`); } _patchServiceJSON(e2) { if (e2.type !== "Table" && e2.geometryType && !e2?.drawingInfo?.renderer && !e2.defaultSymbol) { const t3 = u(e2.geometryType).renderer; o("drawingInfo.renderer", t3, e2); } return e2.geometryType === "esriGeometryMultiPatch" && e2.infoFor3D && (e2.geometryType = "mesh"), e2; } _serializeFeature(e2) { const { geometry: t3, attributes: r4 } = e2; return t(t3) ? { attributes: r4 } : t3.type === "mesh" || t3.type === "extent" ? null : { geometry: t3.toJSON(), attributes: r4 }; } async _serializeAttachment(e2) { const { feature: t3, attachment: r4 } = e2, { globalId: s8, name: a7, contentType: i5, data: o4, uploadId: n10 } = r4, u4 = { globalId: s8, parentGlobalId: null, contentType: null, name: null, uploadId: null, data: null }; if (t3 && (u4.parentGlobalId = "attributes" in t3 ? t3.attributes && t3.attributes[this.layer.globalIdField] : t3.globalId), n10) u4.uploadId = n10; else if (o4) { const e3 = await _(o4); u4.contentType = e3.mediaType, u4.data = e3.data, o4 instanceof File && (u4.name = o4.name); } return a7 && (u4.name = a7), i5 && (u4.contentType = i5), u4; } _getFeatureIds(e2, t3) { const r4 = e2[0]; return r4 ? this._canUseGlobalIds(t3, e2) ? this._getGlobalIdsFromFeatureIdentifier(e2) : "objectId" in r4 ? this._getObjectIdsFromFeatureIdentifier(e2) : this._getIdsFromFeatures(e2) : []; } _getIdsFromFeatures(e2) { const t3 = this.layer.objectIdField; return e2.map((e3) => e3.attributes && e3.attributes[t3]); } _canUseGlobalIds(e2, t3) { return e2 && "globalId" in t3[0]; } _getObjectIdsFromFeatureIdentifier(e2) { return e2.map((e3) => e3.objectId); } _getGlobalIdsFromFeatureIdentifier(e2) { return e2.map((e3) => e3.globalId); } _createEditsResult(e2) { const t3 = e2.data, { layerId: r4 } = this.layer, s8 = []; let a7 = null; if (Array.isArray(t3)) for (const n10 of t3) s8.push({ id: n10.id, editedFeatures: n10.editedFeatures }), n10.id === r4 && (a7 = { addResults: n10.addResults, updateResults: n10.updateResults, deleteResults: n10.deleteResults, attachments: n10.attachments, editMoment: n10.editMoment }); else a7 = t3; const i5 = a7?.attachments, o4 = { addFeatureResults: a7.addResults ? a7.addResults.map(this._createFeatureEditResult, this) : [], updateFeatureResults: a7.updateResults ? a7.updateResults.map(this._createFeatureEditResult, this) : [], deleteFeatureResults: a7.deleteResults ? a7.deleteResults.map(this._createFeatureEditResult, this) : [], addAttachmentResults: i5 && i5.addResults ? i5.addResults.map(this._createFeatureEditResult, this) : [], updateAttachmentResults: i5 && i5.updateResults ? i5.updateResults.map(this._createFeatureEditResult, this) : [], deleteAttachmentResults: i5 && i5.deleteResults ? i5.deleteResults.map(this._createFeatureEditResult, this) : [] }; if (a7.editMoment && (o4.editMoment = a7.editMoment), s8.length > 0) { o4.editedFeatureResults = []; for (const e3 of s8) { const { adds: t4, updates: r5, deletes: s9, spatialReference: a8 } = e3.editedFeatures, i6 = a8 ? new k(a8) : null; o4.editedFeatureResults.push({ layerId: e3.id, editedFeatures: { adds: t4?.map((e4) => this._createEditedFeature(e4, i6)) || [], updates: r5?.map((e4) => ({ original: this._createEditedFeature(e4[0], i6), current: this._createEditedFeature(e4[1], i6) })) || [], deletes: s9?.map((e4) => this._createEditedFeature(e4, i6)) || [], spatialReference: i6 } }); } } return o4; } _createEditedFeature(e2, r4) { return new g({ attributes: e2.attributes, geometry: d2({ ...e2.geometry, spatialReference: r4 }) }); } _createFeatureEditResult(e2) { const t3 = e2.success === true ? null : e2.error || { code: void 0, description: void 0 }; return { objectId: e2.objectId, globalId: e2.globalId, error: t3 ? new s("feature-layer-source:edit-failure", t3.description, { code: t3.code }) : null }; } _createAttachmentErrorResult(e2, t3) { const r4 = t3.details.messages && t3.details.messages[0] || t3.message, s8 = t3.details.httpStatus || t3.details.messageCode; return { objectId: e2, globalId: null, error: new s("feature-layer-source:attachment-failure", r4, { code: s8 }) }; } _getFormDataForAttachment(e2, t3) { const r4 = e2 instanceof FormData ? e2 : e2 && e2.elements ? new FormData(e2) : null; if (r4) for (const s8 in t3) { const e3 = t3[s8]; e3 != null && (r4.set ? r4.set(s8, e3) : r4.append(s8, e3)); } return r4; } _getLayerRequestOptions(e2 = {}) { const { parsedUrl: t3, gdbVersion: r4, dynamicDataSource: s8 } = this.layer; return { ...e2, query: { gdbVersion: r4, layer: s8 ? JSON.stringify({ source: s8 }) : void 0, ...t3.query, f: "json", ...this._createRequestQueryOptions(e2) }, responseType: "json" }; } }; e([d()], S3.prototype, "type", void 0), e([d({ constructOnly: true })], S3.prototype, "layer", void 0), e([d({ readOnly: true })], S3.prototype, "queryTask", null), S3 = e([n("esri.layers.graphics.sources.FeatureLayerSource")], S3); var E = S3; export { E as default }; //# sourceMappingURL=FeatureLayerSource-B6VXBL6Z.js.map