chunk-NHCPFH5Y.js 53 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158
  1. import {
  2. F
  3. } from "./chunk-XYIYXU3I.js";
  4. import {
  5. e as e4
  6. } from "./chunk-T6DJ6UAT.js";
  7. import {
  8. h as h3
  9. } from "./chunk-WOGDHLUJ.js";
  10. import {
  11. i as i2
  12. } from "./chunk-YG7DNOY4.js";
  13. import {
  14. u as u2,
  15. y as y4
  16. } from "./chunk-KUAEOLV3.js";
  17. import {
  18. a as a2
  19. } from "./chunk-ZLQP3WDC.js";
  20. import {
  21. d as d2,
  22. s as s3
  23. } from "./chunk-TE2TRGVU.js";
  24. import {
  25. S
  26. } from "./chunk-XO5VJRK4.js";
  27. import {
  28. l as l4
  29. } from "./chunk-YFDOPEEZ.js";
  30. import {
  31. w as w3,
  32. y as y3
  33. } from "./chunk-JFSMKLAQ.js";
  34. import {
  35. b as b2,
  36. d,
  37. f,
  38. g as g3,
  39. m as m2
  40. } from "./chunk-LXOC7SMQ.js";
  41. import {
  42. u
  43. } from "./chunk-OUUXJOLT.js";
  44. import {
  45. l as l2
  46. } from "./chunk-QC7NCR5N.js";
  47. import {
  48. l as l3
  49. } from "./chunk-JQUWFKNU.js";
  50. import {
  51. x as x3
  52. } from "./chunk-NLLFSKB2.js";
  53. import {
  54. e as e3
  55. } from "./chunk-TFHLTN6F.js";
  56. import {
  57. o as o3
  58. } from "./chunk-OFTOCPN5.js";
  59. import {
  60. g as g2
  61. } from "./chunk-7C23ILQ4.js";
  62. import {
  63. x as x2
  64. } from "./chunk-WD4J43GZ.js";
  65. import {
  66. a,
  67. h,
  68. j as j3,
  69. l,
  70. w
  71. } from "./chunk-TJV6ODRM.js";
  72. import {
  73. g as g4
  74. } from "./chunk-GLSWDDR3.js";
  75. import {
  76. D as D2,
  77. O,
  78. T,
  79. W,
  80. h as h2,
  81. j as j4,
  82. v,
  83. w as w4,
  84. xe,
  85. z
  86. } from "./chunk-CRGY2SDS.js";
  87. import {
  88. i
  89. } from "./chunk-4T5ZGMEN.js";
  90. import {
  91. j as j2
  92. } from "./chunk-LBW34VZ2.js";
  93. import {
  94. _
  95. } from "./chunk-55RWC67C.js";
  96. import {
  97. o as o2,
  98. w2
  99. } from "./chunk-6T6G6LCQ.js";
  100. import {
  101. k2 as k
  102. } from "./chunk-PQFTYGF5.js";
  103. import {
  104. e,
  105. m,
  106. n5 as n,
  107. y3 as y2
  108. } from "./chunk-2Z2TG5CU.js";
  109. import {
  110. D,
  111. E,
  112. b,
  113. g,
  114. j,
  115. x
  116. } from "./chunk-V6P2MAQQ.js";
  117. import {
  118. s2 as s,
  119. s3 as s2
  120. } from "./chunk-E5O6P5I2.js";
  121. import {
  122. has,
  123. y
  124. } from "./chunk-SPWQ3AWG.js";
  125. import {
  126. e as e2,
  127. o,
  128. r,
  129. t
  130. } from "./chunk-YXWMMD76.js";
  131. // node_modules/@arcgis/core/AggregateGraphic.js
  132. var p = class extends g2 {
  133. constructor() {
  134. super(...arguments), this.isAggregate = true;
  135. }
  136. getEffectivePopupTemplate(e6 = false) {
  137. if (this.popupTemplate)
  138. return this.popupTemplate;
  139. const r3 = this.sourceLayer && this.sourceLayer.featureReduction;
  140. return r3 && "popupTemplate" in r3 && r3.popupEnabled ? r3.popupTemplate : null;
  141. }
  142. getObjectId() {
  143. return this.attributes.aggregateId;
  144. }
  145. };
  146. e([y2({ type: Boolean })], p.prototype, "isAggregate", void 0), p = e([n("esri.AggregateGraphic")], p);
  147. var s4 = p;
  148. // node_modules/@arcgis/core/layers/effects/FeatureEffectView.js
  149. var r2 = class extends m {
  150. constructor(e6) {
  151. super(e6), this._filter = null, this.duration = has("mapview-transitions-duration"), this._excludedEffectView = new a2(e6), this._includedEffectView = new a2(e6);
  152. }
  153. get excludedEffects() {
  154. return this._excludedEffectView.effects;
  155. }
  156. set featureEffect(e6) {
  157. this._get("featureEffect") !== e6 && this._transitionTo(e6);
  158. }
  159. get filter() {
  160. var _a;
  161. return this._filter || ((_a = e2(this.featureEffect)) == null ? void 0 : _a.filter) || null;
  162. }
  163. get hasEffects() {
  164. return this._excludedEffectView.hasEffects || this._includedEffectView.hasEffects;
  165. }
  166. get includedEffects() {
  167. return this._includedEffectView.effects;
  168. }
  169. set scale(e6) {
  170. this._set("scale", e6), this._excludedEffectView.scale = e6, this._includedEffectView.scale = e6;
  171. }
  172. get transitioning() {
  173. return this._excludedEffectView.transitioning || this._includedEffectView.transitioning;
  174. }
  175. transitionStep(e6, t2) {
  176. this._set("scale", t2), this.transitioning ? (this._includedEffectView.transitionStep(e6, t2), this._excludedEffectView.transitionStep(e6, t2), this.transitioning || (this._filter = null)) : (this._excludedEffectView.scale = t2, this._includedEffectView.scale = t2);
  177. }
  178. endTransitions() {
  179. this._includedEffectView.endTransitions(), this._excludedEffectView.endTransitions(), this._filter = null;
  180. }
  181. _transitionTo(e6) {
  182. const t2 = this._get("featureEffect"), s6 = e2(e6), f2 = e2(s6 == null ? void 0 : s6.includedEffect), c3 = e2(s6 == null ? void 0 : s6.excludedEffect), r3 = this._includedEffectView.canTransitionTo(f2) && this._excludedEffectView.canTransitionTo(c3);
  183. this._includedEffectView.effect = f2, this._excludedEffectView.effect = c3, this._set("featureEffect", s6), this._filter = (s6 == null ? void 0 : s6.filter) || (t2 == null ? void 0 : t2.filter) || null, r3 || this.endTransitions();
  184. }
  185. };
  186. e([y2()], r2.prototype, "_filter", void 0), e([y2()], r2.prototype, "_excludedEffectView", void 0), e([y2()], r2.prototype, "_includedEffectView", void 0), e([y2()], r2.prototype, "duration", void 0), e([y2()], r2.prototype, "excludedEffects", null), e([y2()], r2.prototype, "featureEffect", null), e([y2()], r2.prototype, "filter", null), e([y2()], r2.prototype, "hasEffects", null), e([y2()], r2.prototype, "includedEffects", null), e([y2({ value: 0 })], r2.prototype, "scale", null), e([y2()], r2.prototype, "transitioning", null), r2 = e([n("esri.layers.effects.FeatureEffectView")], r2);
  187. var o4 = r2;
  188. // node_modules/@arcgis/core/rest/support/AggregateFeatureSet.js
  189. var m3 = class extends x3 {
  190. constructor() {
  191. super(...arguments), this.features = [];
  192. }
  193. readFeatures(e6, o5) {
  194. var _a;
  195. const s6 = k.fromJSON(o5.spatialReference), a4 = [];
  196. for (let p2 = 0; p2 < e6.length; p2++) {
  197. const o6 = e6[p2], c3 = s4.fromJSON(o6), m4 = o6.geometry && o6.geometry.spatialReference;
  198. r(c3.geometry) && !m4 && (c3.geometry.spatialReference = s6);
  199. const i5 = o6.aggregateGeometries, f2 = c3.aggregateGeometries;
  200. if (i5 && r(f2))
  201. for (const e7 in f2) {
  202. const r3 = f2[e7], o7 = (_a = i5[e7]) == null ? void 0 : _a.spatialReference;
  203. r(r3) && !o7 && (r3.spatialReference = s6);
  204. }
  205. a4.push(c3);
  206. }
  207. return a4;
  208. }
  209. };
  210. e([y2({ type: [s4], json: { write: true } })], m3.prototype, "features", void 0), e([o2("features")], m3.prototype, "readFeatures", null), m3 = e([n("esri.rest.support.AggregateFeatureSet")], m3);
  211. var i3 = m3;
  212. // node_modules/@arcgis/core/views/2d/layers/features/tileRenderers.js
  213. async function e5(e6, r3) {
  214. if (!e6)
  215. return null;
  216. switch (e6.type) {
  217. case "symbol":
  218. return new (await import("./SymbolTileRenderer-4VQTMK6G.js")).default(r3);
  219. case "heatmap":
  220. return new (await import("./HeatmapTileRenderer-OVKMQRO5.js")).default(r3);
  221. }
  222. }
  223. // node_modules/@arcgis/core/views/2d/layers/support/FeatureCommandQueue.js
  224. function a3(e6) {
  225. return e6.some((e7) => e7.globalId);
  226. }
  227. function d3(e6) {
  228. return e6.filter((e7) => !e7.error).map((e7) => {
  229. var _a;
  230. return (_a = e7.objectId) != null ? _a : e7.globalId;
  231. });
  232. }
  233. function i4(e6, r3) {
  234. const s6 = new Set(e6);
  235. for (const t2 of r3.values())
  236. s6.add(t2);
  237. return s6;
  238. }
  239. function n2(e6, r3) {
  240. const s6 = new Set(e6);
  241. for (const t2 of r3.values())
  242. s6.delete(t2);
  243. return s6;
  244. }
  245. var c = class extends m {
  246. constructor(e6) {
  247. super(e6), this._hasGlobalIds = false;
  248. }
  249. normalizeCtorArgs(e6) {
  250. return this._queueProcessor = new l2({ concurrency: 1, process: e6.process }), {};
  251. }
  252. destroy() {
  253. this.clear();
  254. }
  255. get updating() {
  256. return this._queueProcessor.length > 0;
  257. }
  258. clear() {
  259. this._queueProcessor.clear();
  260. }
  261. push(e6) {
  262. const r3 = this._queueProcessor, s6 = r3.last();
  263. switch (e6.type) {
  264. case "update":
  265. case "refresh":
  266. if ((s6 == null ? void 0 : s6.type) === e6.type)
  267. return;
  268. r3.push(e6).finally(() => this.notifyChange("updating"));
  269. break;
  270. case "edit": {
  271. const t2 = "processed-edit" === (s6 == null ? void 0 : s6.type) ? s6 : null;
  272. t2 && r3.popLast();
  273. const o5 = this._mergeEdits(t2, e6);
  274. for (const e7 of o5)
  275. r3.push(e7).finally(() => this.notifyChange("updating"));
  276. break;
  277. }
  278. }
  279. this.notifyChange("updating");
  280. }
  281. _mergeEdits(e6, r3) {
  282. var _a, _b;
  283. const { addedFeatures: s6, deletedFeatures: t2, updatedFeatures: o5 } = r3.edits;
  284. if (this._hasGlobalIds = this._hasGlobalIds || a3(s6) || a3(o5) || a3(t2), this._hasGlobalIds) {
  285. return [e6, { type: "processed-edit", edits: { addOrModified: [...s6, ...o5], removed: t2 } }];
  286. }
  287. const c3 = new Set(d3((_a = e6 == null ? void 0 : e6.edits.addOrModified) != null ? _a : [])), u5 = new Set(d3((_b = e6 == null ? void 0 : e6.edits.removed) != null ? _b : [])), p2 = /* @__PURE__ */ new Set([...d3(s6), ...d3(o5)]), l7 = new Set(d3(t2));
  288. return [{ type: "processed-edit", edits: { addOrModified: Array.from(i4(n2(c3, l7), p2)).map((e7) => ({ objectId: e7 })), removed: Array.from(i4(n2(u5, p2), l7)).map((e7) => ({ objectId: e7 })) } }];
  289. }
  290. };
  291. e([y2({ readOnly: true })], c.prototype, "updating", null), c = e([n("esri.views.2d.layers.support.FeatureCommandQueue")], c);
  292. var u3 = c;
  293. // node_modules/@arcgis/core/views/2d/layers/support/FeatureLayerProxy.js
  294. function c2(e6) {
  295. return Array.isArray(e6);
  296. }
  297. var u4 = class extends _ {
  298. constructor(e6) {
  299. super(e6), this._startupResolver = D(), this.isReady = false;
  300. }
  301. initialize() {
  302. this._controller = new AbortController(), this.addResolvingPromise(this._startWorker(this._controller.signal));
  303. }
  304. destroy() {
  305. this._controller.abort(), this._connection && this._connection.close();
  306. }
  307. set tileRenderer(e6) {
  308. this.client.tileRenderer = e6;
  309. }
  310. get closed() {
  311. return this._connection.closed;
  312. }
  313. async startup(e6, t2, r3, s6) {
  314. await this.when();
  315. const o5 = this._controller.signal, i5 = c2(r3.source) ? { transferList: r3.source, signal: o5 } : void 0, n3 = { service: r3, config: t2, tileInfo: e6.tileInfo.toJSON(), tiles: s6 };
  316. await this._connection.invoke("startup", n3, i5), this._startupResolver.resolve(), this._set("isReady", true);
  317. }
  318. async updateTiles(e6) {
  319. return await this._startupResolver.promise, g(this._connection.invoke("updateTiles", e6));
  320. }
  321. async update(e6) {
  322. const t2 = { config: e6 };
  323. return await this._startupResolver.promise, this._connection.invoke("update", t2);
  324. }
  325. async applyUpdate(e6) {
  326. return await this._startupResolver.promise, this._connection.invoke("applyUpdate", e6);
  327. }
  328. async setHighlight(e6) {
  329. return await this._startupResolver.promise, g(this._connection.invoke("controller.setHighlight", e6));
  330. }
  331. async stop() {
  332. if (await this._startupResolver.promise, !this.closed)
  333. return g(this._connection.invoke("stop"));
  334. }
  335. async refresh(e6) {
  336. return await this._startupResolver.promise, g(this._connection.invoke("controller.refresh", e6));
  337. }
  338. async querySummaryStatistics(e6, t2, r3) {
  339. return await this._startupResolver.promise, this._connection.invoke("controller.querySummaryStatistics", { query: e6.toJSON(), params: t2 }, r3);
  340. }
  341. async queryAggregateSummaryStatistics(e6, t2, r3) {
  342. return await this._startupResolver.promise, this._connection.invoke("controller.queryAggregateSummaryStatistics", { query: e6.toJSON(), params: t2 }, r3);
  343. }
  344. async queryUniqueValues(e6, t2, r3) {
  345. return await this._startupResolver.promise, this._connection.invoke("controller.queryUniqueValues", { query: e6.toJSON(), params: t2 }, r3);
  346. }
  347. async queryAggregateUniqueValues(e6, t2, r3) {
  348. return await this._startupResolver.promise, this._connection.invoke("controller.queryAggregateUniqueValues", { query: e6.toJSON(), params: t2 }, r3);
  349. }
  350. async queryClassBreaks(e6, t2, r3) {
  351. return await this._startupResolver.promise, this._connection.invoke("controller.queryClassBreaks", { query: e6.toJSON(), params: t2 }, r3);
  352. }
  353. async queryAggregateClassBreaks(e6, t2, r3) {
  354. return await this._startupResolver.promise, this._connection.invoke("controller.queryAggregateClassBreaks", { query: e6.toJSON(), params: t2 }, r3);
  355. }
  356. async queryHistogram(e6, t2, r3) {
  357. return await this._startupResolver.promise, this._connection.invoke("controller.queryHistogram", { query: e6.toJSON(), params: t2 }, r3);
  358. }
  359. async queryAggregateHistogram(e6, t2, r3) {
  360. return await this._startupResolver.promise, this._connection.invoke("controller.queryAggregateHistogram", { query: e6.toJSON(), params: t2 }, r3);
  361. }
  362. async queryFeatures(e6, t2) {
  363. return await this._startupResolver.promise, this._connection.invoke("controller.queryFeatures", e6.toJSON(), t2);
  364. }
  365. async queryVisibleFeatures(e6, t2) {
  366. return await this._startupResolver.promise, this._connection.invoke("controller.queryVisibleFeatures", e6.toJSON(), t2);
  367. }
  368. async queryObjectIds(e6, t2) {
  369. return await this._startupResolver.promise, this._connection.invoke("controller.queryObjectIds", e6.toJSON(), t2);
  370. }
  371. async queryFeatureCount(e6, t2) {
  372. return await this._startupResolver.promise, this._connection.invoke("controller.queryFeatureCount", e6.toJSON(), t2);
  373. }
  374. async queryExtent(e6, t2) {
  375. return this._connection.invoke("controller.queryExtent", e6.toJSON(), t2);
  376. }
  377. async queryLatestObservations(e6, t2) {
  378. return await this._startupResolver.promise, this._connection.invoke("controller.queryLatestObservations", e6.toJSON(), t2);
  379. }
  380. async queryStatistics(e6) {
  381. return await this._startupResolver.promise, this._connection.invoke("controller.queryStatistics", e6);
  382. }
  383. async queryAggregates(e6, t2) {
  384. return await this._startupResolver.promise, this._connection.invoke("controller.queryAggregates", e6.toJSON(), t2);
  385. }
  386. async queryAggregateCount(e6, t2) {
  387. return await this._startupResolver.promise, this._connection.invoke("controller.queryAggregateCount", e6.toJSON(), t2);
  388. }
  389. async queryAggregateIds(e6, t2) {
  390. return await this._startupResolver.promise, this._connection.invoke("controller.queryAggregateIds", e6.toJSON(), t2);
  391. }
  392. async getObjectId(e6) {
  393. return await this._startupResolver.promise, this._connection.invoke("controller.getObjectId", e6);
  394. }
  395. async getDisplayId(e6) {
  396. return await this._startupResolver.promise, this._connection.invoke("controller.getDisplayId", e6);
  397. }
  398. async getFeatures(e6) {
  399. return await this._startupResolver.promise, this._connection.invoke("controller.getFeatures", e6);
  400. }
  401. async getAggregates() {
  402. return await this._startupResolver.promise, this._connection.invoke("controller.getAggregates");
  403. }
  404. async getAggregateValueRanges() {
  405. return await this._startupResolver.promise, this._connection.invoke("controller.getAggregateValueRanges");
  406. }
  407. async mapValidDisplayIds(e6) {
  408. return await this._startupResolver.promise, this._connection.invoke("controller.mapValidDisplayIds", e6);
  409. }
  410. async onEdits(e6) {
  411. return await this._startupResolver.promise, g(this._connection.invoke("controller.onEdits", e6));
  412. }
  413. async enableEvent(e6, t2) {
  414. return await this._startupResolver.promise, g(this._connection.invoke("controller.enableEvent", { name: e6, value: t2 }));
  415. }
  416. pauseStream() {
  417. return g(this._connection.invoke("controller.pauseStream"));
  418. }
  419. resumeStream() {
  420. return g(this._connection.invoke("controller.resumeStream"));
  421. }
  422. async _startWorker(e6) {
  423. try {
  424. this._connection = await u("Pipeline", { client: this.client, strategy: "dedicated", signal: e6 });
  425. } catch (t2) {
  426. b(t2);
  427. }
  428. }
  429. };
  430. e([y2()], u4.prototype, "isReady", void 0), e([y2({ constructOnly: true })], u4.prototype, "client", void 0), e([y2()], u4.prototype, "tileRenderer", null), u4 = e([n("esri.views.2d.layers.support.FeatureLayerProxy")], u4);
  431. var l5 = u4;
  432. // node_modules/@arcgis/core/views/2d/tiling/TileManager.js
  433. var s5 = 1e-6;
  434. var l6 = class {
  435. constructor(e6) {
  436. this._tiles = /* @__PURE__ */ new Map(), this.buffer = 0, this.acquireTile = e6.acquireTile, this.releaseTile = e6.releaseTile, this.tileInfoView = e6.tileInfoView, this.buffer = e6.buffer;
  437. }
  438. destroy() {
  439. }
  440. clear() {
  441. this._tiles.forEach((e6) => this._releaseTile(e6));
  442. }
  443. tileKeys() {
  444. const e6 = [];
  445. return this._tiles.forEach((i5, t2) => e6.push(t2)), e6;
  446. }
  447. update(e6) {
  448. const s6 = this.tileInfoView.getTileCoverage(e6.state, this.buffer, "closest"), { spans: l7, lodInfo: r3 } = s6, { level: a4 } = r3, o5 = [], d4 = [], h4 = /* @__PURE__ */ new Set(), n3 = /* @__PURE__ */ new Set();
  449. for (const { row: i5, colFrom: c3, colTo: f2 } of l7)
  450. for (let e7 = c3; e7 <= f2; e7++) {
  451. const s7 = e3.getId(a4, i5, r3.normalizeCol(e7), r3.getWorldForColumn(e7)), l8 = this._getOrAcquireTile(o5, s7);
  452. h4.add(s7), l8.isReady ? l8.visible = true : n3.add(l8.key);
  453. }
  454. n3.forEach((e7) => this._addPlaceholders(h4, e7)), this._tiles.forEach((e7) => {
  455. h4.has(e7.key.id) || (d4.push(e7.key.id), this._releaseTile(e7));
  456. }), l3.pool.release(s6);
  457. return { hasMissingTiles: n3.size > 0, added: o5, removed: d4 };
  458. }
  459. _getOrAcquireTile(e6, i5) {
  460. if (!this._tiles.has(i5)) {
  461. const s6 = this.acquireTile(new e3(i5));
  462. e6.push(i5), this._tiles.set(i5, s6), s6.visible = false;
  463. }
  464. return this._tiles.get(i5);
  465. }
  466. _getTile(e6) {
  467. return this._tiles.get(e6);
  468. }
  469. _releaseTile(e6) {
  470. this._tiles.delete(e6.key.id), this.releaseTile(e6);
  471. }
  472. _addPlaceholders(e6, i5) {
  473. const t2 = this._addPlaceholderChildren(e6, i5);
  474. if (!(Math.abs(1 - t2) < s5)) {
  475. if (!this._addPlaceholderParent(e6, i5)) {
  476. this._getTile(i5.id).visible = true;
  477. }
  478. }
  479. }
  480. _addPlaceholderChildren(e6, i5) {
  481. let t2 = 0;
  482. return this._tiles.forEach((s6) => {
  483. t2 += this._addPlaceholderChild(e6, s6, i5);
  484. }), t2;
  485. }
  486. _addPlaceholderChild(e6, i5, t2) {
  487. if (i5.key.level <= t2.level || !i5.hasData || !t2.contains(i5.key))
  488. return 0;
  489. i5.visible = true, e6.add(i5.key.id);
  490. return 1 / (1 << 2 * (i5.key.level - t2.level));
  491. }
  492. _addPlaceholderParent(i5, t2) {
  493. let s6 = t2.getParentKey(), l7 = 0, r3 = null;
  494. for (; r(s6); ) {
  495. if (i5.has(s6.id))
  496. return true;
  497. const e6 = this._getTile(s6.id);
  498. if (e6 == null ? void 0 : e6.isReady) {
  499. for (const e7 of i5) {
  500. const i6 = this._getTile(e7);
  501. s6.contains(i6.key) && (i6.visible = false);
  502. }
  503. return e6.visible = true, i5.add(e6.key.id), true;
  504. }
  505. (e6 == null ? void 0 : e6.hasData) && e6.patchCount > l7 && (l7 = e6.patchCount, r3 = e6), s6 = s6.getParentKey();
  506. }
  507. return !!r3 && (r3.visible = true, i5.add(r3.key.id), true);
  508. }
  509. };
  510. // node_modules/@arcgis/core/views/layers/FeatureLayerView.js
  511. var _2 = "esri.views.layers.FeatureLayerView";
  512. var O2 = s.getLogger(_2);
  513. var A = (r3) => {
  514. let A2 = class extends r3 {
  515. constructor(...e6) {
  516. super(...e6), this._updatingRequiredFieldsPromise = null, this.filter = null, this.timeExtent = null, this.layer = null, this.requiredFields = [], this.view = null;
  517. }
  518. initialize() {
  519. this.handles.add([l(() => {
  520. var _a;
  521. const e6 = this.layer;
  522. return [(_a = e6 == null ? void 0 : e6.elevationInfo) == null ? void 0 : _a.featureExpressionInfo, e6 && "displayField" in e6 ? e6.displayField : null, e6 == null ? void 0 : e6.timeInfo, e6 && "renderer" in e6 && e6.renderer, e6 && "labelingInfo" in e6 && e6.labelingInfo, e6 && "floorInfo" in e6 && e6.floorInfo, this.filter, this.featureEffect, this.timeExtent];
  523. }, () => this._handleRequiredFieldsChange(), w), a(() => {
  524. var _a;
  525. return (_a = this.view) == null ? void 0 : _a.floors;
  526. }, "change", () => this._handleRequiredFieldsChange()), a(() => {
  527. const e6 = this.layer;
  528. return e6 && "sublayers" in e6 && e6.sublayers;
  529. }, "change", () => this._handleRequiredFieldsChange())]);
  530. }
  531. get availableFields() {
  532. const { layer: e6, layer: { fieldsIndex: t2 }, requiredFields: r4 } = this;
  533. return "outFields" in e6 && e6.outFields ? T(t2, [...v(t2, e6.outFields), ...r4]) : T(t2, r4);
  534. }
  535. get featureEffect() {
  536. return this.layer && "featureEffect" in this.layer ? this.layer.featureEffect : null;
  537. }
  538. set featureEffect(e6) {
  539. this._override("featureEffect", e6);
  540. }
  541. get maximumNumberOfFeatures() {
  542. return 0;
  543. }
  544. set maximumNumberOfFeatures(e6) {
  545. O2.error("#maximumNumberOfFeatures=", "Setting maximum number of features is not supported");
  546. }
  547. get maximumNumberOfFeaturesExceeded() {
  548. return false;
  549. }
  550. highlight(e6) {
  551. throw new Error("missing implementation");
  552. }
  553. createQuery() {
  554. const e6 = { outFields: ["*"], returnGeometry: true, outSpatialReference: this.view.spatialReference }, t2 = r(this.filter) ? this.filter.createQuery(e6) : new x2(e6);
  555. if ("feature" === this.layer.type) {
  556. const e7 = o3(this);
  557. r(e7) && (t2.where = t2.where ? `(${t2.where}) AND (${e7})` : e7);
  558. }
  559. return r(this.timeExtent) && (t2.timeExtent = r(t2.timeExtent) ? t2.timeExtent.intersection(this.timeExtent) : this.timeExtent.clone()), t2;
  560. }
  561. createAggregateQuery() {
  562. const e6 = { outFields: ["*"], returnGeometry: true, outSpatialReference: this.view.spatialReference };
  563. return new x2(e6);
  564. }
  565. queryFeatures(e6, t2) {
  566. throw new Error("missing implementation");
  567. }
  568. queryObjectIds(e6, t2) {
  569. throw new Error("missing implementation");
  570. }
  571. queryFeatureCount(e6, t2) {
  572. throw new Error("missing implementation");
  573. }
  574. queryExtent(e6, t2) {
  575. throw new Error("missing implementation");
  576. }
  577. async fetchPopupFeatures(e6, t2) {
  578. const r4 = this.validateFetchPopupFeatures(t2);
  579. if (r4)
  580. throw r4;
  581. return this.fetchClientPopupFeatures(t2);
  582. }
  583. _loadArcadeModules(e6) {
  584. if (e6.get("expressionInfos.length") || Array.isArray(e6.content) && e6.content.some((e7) => "expression" === e7.type))
  585. return i();
  586. }
  587. _handleRequiredFieldsChange() {
  588. const e6 = this._updateRequiredFields();
  589. this._set("_updatingRequiredFieldsPromise", e6), e6.then(() => {
  590. this._updatingRequiredFieldsPromise === e6 && this._set("_updatingRequiredFieldsPromise", null);
  591. });
  592. }
  593. async _updateRequiredFields() {
  594. if (!this.layer || !this.view)
  595. return;
  596. const e6 = "3d" === this.view.type, { layer: t2, layer: { fieldsIndex: r4, objectIdField: s6 } } = this, n3 = "renderer" in t2 && t2.renderer, a4 = "orderBy" in t2 && t2.orderBy, l7 = "featureReduction" in t2 ? t2.featureReduction : null, u5 = /* @__PURE__ */ new Set(), p2 = await E([n3 ? n3.collectRequiredFields(u5, r4) : null, W(u5, t2), e6 ? D2(u5, t2) : null, r(this.filter) ? j4(u5, t2, this.filter) : null, r(this.featureEffect) ? j4(u5, t2, this.featureEffect.filter) : null, l7 ? O(u5, t2, l7) : null, a4 ? z(u5, t2, a4) : null]);
  597. if (t2.timeInfo && this.timeExtent && h2(u5, t2.fieldsIndex, [t2.timeInfo.startField, t2.timeInfo.endField]), "feature" === t2.type && (t2.floorInfo && h2(u5, t2.fieldsIndex, [t2.floorInfo.floorField]), e6 && r(t2.infoFor3D) && (null == t2.globalIdField && O2.error("globalIdField missing on 3DObjectFeatureLayer"), h2(u5, t2.fieldsIndex, [t2.globalIdField]))), "subtype-group" === t2.type) {
  598. w4(u5, r4, t2.subtypeField);
  599. const e7 = t2.sublayers.map((e8) => {
  600. var _a;
  601. return Promise.all([(_a = e8.renderer) == null ? void 0 : _a.collectRequiredFields(u5, r4), W(u5, e8)]);
  602. });
  603. await E(e7);
  604. }
  605. for (const i5 of p2)
  606. i5.error && O2.error(i5.error);
  607. w4(u5, r4, s6), e6 && "displayField" in t2 && t2.displayField && w4(u5, r4, t2.displayField);
  608. const d4 = Array.from(u5).sort();
  609. this._set("requiredFields", d4);
  610. }
  611. validateFetchPopupFeatures(e6) {
  612. if (t(e6))
  613. return null;
  614. for (const r4 of e6.clientGraphics) {
  615. const i5 = r4.layer;
  616. if ("popupEnabled" in i5 && !i5.popupEnabled)
  617. return new s2("featurelayerview:fetchPopupFeatures", "Popups are disabled", { layer: i5 });
  618. if (r4.isAggregate) {
  619. const e7 = "featureReduction" in i5 ? i5.featureReduction : null;
  620. if (!(e7 && "popupTemplate" in e7 && e7.popupEnabled && e7.popupTemplate))
  621. return new s2("featurelayerview:fetchPopupFeatures", "Popups are disabled", { layer: i5 });
  622. } else if ("popupTemplate" in i5) {
  623. if (!s3(i5, e6))
  624. return new s2("featurelayerview:fetchPopupFeatures", "Layer does not define a popup template", { layer: i5 });
  625. }
  626. }
  627. }
  628. async fetchClientPopupFeatures(e6) {
  629. const t2 = r(e6) ? e6.clientGraphics : null;
  630. if (!t2 || 0 === t2.length)
  631. return [];
  632. const r4 = new Array(t2.length), o5 = /* @__PURE__ */ new Map(), n3 = await this.createPopupQuery(e6);
  633. for (let i5 = 0; i5 < t2.length; i5++) {
  634. const a4 = t2[i5];
  635. if (a4.isAggregate) {
  636. r4[i5] = a4;
  637. continue;
  638. }
  639. const { layer: l7 } = a4;
  640. if (!("popupEnabled" in l7))
  641. continue;
  642. const u5 = v(this.layer.fieldsIndex, n3.outFields), p2 = s3(l7, e6);
  643. if (t(p2))
  644. continue;
  645. const d4 = await this._loadArcadeModules(p2);
  646. d4 && d4.arcadeUtils.hasGeometryOperations(p2) || !xe(u5, a4) ? o5.set(a4.getObjectId(), i5) : r4[i5] = a4;
  647. }
  648. if ("stream" === this.layer.type || 0 === o5.size)
  649. return r4.filter(Boolean);
  650. n3.objectIds = Array.from(o5.keys());
  651. try {
  652. const e7 = await this.layer.queryFeatures(n3);
  653. for (const t3 of e7.features) {
  654. r4[o5.get(t3.getObjectId())] = t3;
  655. }
  656. } catch {
  657. }
  658. return r4.filter(Boolean);
  659. }
  660. async createPopupQuery(e6) {
  661. const t2 = this.layer.createQuery(), r4 = /* @__PURE__ */ new Set();
  662. let o5 = false;
  663. const n3 = r(e6) && e6.clientGraphics ? e6.clientGraphics.map((e7) => e7.layer) : [this.layer];
  664. for (const i5 of n3) {
  665. if (!("popupEnabled" in i5))
  666. continue;
  667. const t3 = s3(i5, e6);
  668. if (t(t3))
  669. continue;
  670. const n4 = await this._loadArcadeModules(t3), a4 = n4 && n4.arcadeUtils.hasGeometryOperations(t3);
  671. o5 = !("point" !== this.layer.geometryType && !a4);
  672. const l7 = await d2(this.layer, t3);
  673. for (const e7 of l7)
  674. r4.add(e7);
  675. }
  676. if (t2.returnGeometry = o5, t2.returnZ = o5, t2.returnM = o5, t2.outFields = Array.from(r4), t2.outSpatialReference = this.view.spatialReference, "feature" === this.layer.type) {
  677. const e7 = o3(this);
  678. r(e7) && (t2.where = t2.where ? `(${t2.where}) AND (${e7})` : e7);
  679. }
  680. return t2;
  681. }
  682. canResume() {
  683. return !!super.canResume() && (!r(this.timeExtent) || !this.timeExtent.isEmpty);
  684. }
  685. };
  686. return e([y2()], A2.prototype, "_updatingRequiredFieldsPromise", void 0), e([y2({ readOnly: true })], A2.prototype, "availableFields", null), e([y2({ type: w3 })], A2.prototype, "featureEffect", null), e([y2({ type: y3 })], A2.prototype, "filter", void 0), e([y2(g4)], A2.prototype, "timeExtent", void 0), e([y2()], A2.prototype, "layer", void 0), e([y2({ type: Number })], A2.prototype, "maximumNumberOfFeatures", null), e([y2({ readOnly: true, type: Boolean })], A2.prototype, "maximumNumberOfFeaturesExceeded", null), e([y2({ readOnly: true })], A2.prototype, "requiredFields", void 0), e([y2()], A2.prototype, "suspended", void 0), e([y2()], A2.prototype, "view", void 0), A2 = e([n(_2)], A2), A2;
  687. };
  688. // node_modules/@arcgis/core/views/2d/layers/FeatureLayerView2D.js
  689. function J(e6) {
  690. return e6 && "openPorts" in e6;
  691. }
  692. var M = class extends A(i2(y4(u2))) {
  693. constructor() {
  694. super(...arguments), this._pipelineIsUpdating = true, this._commandsQueue = new u3({ process: (e6) => {
  695. switch (e6.type) {
  696. case "processed-edit":
  697. return this._doEdit(e6);
  698. case "refresh":
  699. return this._doRefresh(e6.dataChanged);
  700. case "update":
  701. return this._doUpdate();
  702. }
  703. } }), this._visibilityOverrides = /* @__PURE__ */ new Set(), this._highlightIds = /* @__PURE__ */ new Map(), this._updateHighlight = x(async () => this._proxy.setHighlight(Array.from(this._highlightIds.keys()))), this._uploadsLocked = false, this._needsClusterSizeUpdate = false, this.featureEffectView = new o4(), this._lastDefinitionExpression = null;
  704. }
  705. destroy() {
  706. var _a;
  707. o(this._updateClusterSizeTask, (e6) => e6.remove()), (_a = this._proxy) == null ? void 0 : _a.destroy(), this._commandsQueue.destroy();
  708. }
  709. initialize() {
  710. this.addResolvingPromise(Promise.all([this._initProxy(), this._initServiceOptions()])), this.handles.add([this.on("valueRangesChanged", (e6) => {
  711. this._set("_aggregateValueRanges", e6.valueRanges);
  712. }), l(() => this.featureEffect, (e6) => {
  713. this.featureEffectView.featureEffect = e6;
  714. }, w)]), this.featureEffectView.endTransitions();
  715. }
  716. async _initProxy() {
  717. const e6 = this.layer;
  718. if ("isTable" in e6 && e6.isTable)
  719. throw new s2("featurelayerview:table-not-supported", "table feature layer can't be displayed", { layer: this.layer });
  720. const t2 = "feature" === e6.type || "subtype-group" === e6.type, r3 = "capabilities" in e6 && e6.capabilities.operations.supportsQuery;
  721. if (t2 && !r3)
  722. throw new s2("featurelayerview:query-not-supported", "layer view requires a layer with query capability", { layer: e6 });
  723. this._proxy && this._proxy.destroy();
  724. const i5 = this._createClientOptions();
  725. return this._set("_proxy", new l5({ client: i5 })), this._proxy.when();
  726. }
  727. async _initServiceOptions() {
  728. return this._set("_serviceOptions", await this._createServiceOptions()), this._serviceOptions;
  729. }
  730. get orderByFields() {
  731. return "stream" !== this._serviceOptions.type && this._serviceOptions.orderByFields;
  732. }
  733. get labelsVisible() {
  734. const e6 = "subtype-group" === this.layer.type ? this.layer.sublayers.items : [this.layer];
  735. return !this.suspended && e6.some((e7) => e7.labelingInfo && e7.labelsVisible);
  736. }
  737. get queryMode() {
  738. return this._serviceOptions.type;
  739. }
  740. get renderingConfigHash() {
  741. var _a, _b;
  742. if (!this.layer)
  743. return null;
  744. const e6 = this.availableFields, t2 = this.layer, r3 = this.view.floors, { definitionExpression: i5 } = t2, s6 = "subtype-group" !== this.layer.type && this.layer.labelsVisible && this.layer.labelingInfo, a4 = "renderer" in t2 && t2.renderer, n3 = "gdbVersion" in t2 ? t2.gdbVersion : void 0, o5 = "historicMoment" in t2 ? (_a = t2.historicMoment) == null ? void 0 : _a.getTime() : void 0, { timeExtent: u5 } = this, h4 = "customParameters" in t2 ? JSON.stringify(t2.customParameters) : void 0, d4 = "apiKey" in t2 ? t2.apiKey : void 0, p2 = "stream" === t2.type ? `${JSON.stringify(t2.geometryDefinition)}${t2.definitionExpression}` : null, c3 = JSON.stringify(this.clips), y5 = "featureReduction" in t2 ? (_b = t2.featureReduction) == null ? void 0 : _b.toJSON() : null, g5 = "orderBy" in this.layer && JSON.stringify(this.layer.orderBy), f2 = "sublayers" in this.layer && this.layer.sublayers.items.reduce((e7, t3) => e7 + `${t3.visible ? 1 : 0}.${JSON.stringify(t3.renderer)}.${t3.labelsVisible}
  745. .${JSON.stringify(t3.labelingInfo)}`, ""), m4 = "subtypeCode" in this.layer && this.layer.subtypeCode;
  746. return JSON.stringify({ orderBy: g5, sublayerHash: f2, subtypeCode: m4, filterHash: r(this.filter) && this.filter.toJSON(), effectHash: r(this.featureEffect) && this.featureEffect.toJSON(), streamFilter: p2, gdbVersion: n3, definitionExpression: i5, historicMoment: o5, availableFields: e6, renderer: a4, labelingInfo: s6, timeExtent: u5, floors: r3, clipsHash: c3, featureReduction: y5, customParameters: h4, apiKey: d4 });
  747. }
  748. highlight(e6) {
  749. let t2;
  750. return e6 instanceof g2 ? t2 = [e6.getObjectId()] : "number" == typeof e6 || "string" == typeof e6 ? t2 = [e6] : j2.isCollection(e6) && e6.length > 0 ? t2 = e6.map((e7) => e7 == null ? void 0 : e7.getObjectId()).toArray() : Array.isArray(e6) && e6.length > 0 && (t2 = "number" == typeof e6[0] || "string" == typeof e6[0] ? e6 : e6.map((e7) => e7 == null ? void 0 : e7.getObjectId())), t2 = t2 == null ? void 0 : t2.filter((e7) => null != e7), t2 && t2.length ? (this._addHighlight(t2), { remove: () => this._removeHighlight(t2) }) : { remove: () => {
  751. } };
  752. }
  753. hasHighlight() {
  754. return !!this._highlightIds.size;
  755. }
  756. async hitTest(e6, i5) {
  757. if (!this.tileRenderer)
  758. return null;
  759. const s6 = await this.tileRenderer.hitTest(i5);
  760. if (0 === s6.length)
  761. return null;
  762. const { features: a4, aggregates: n3 } = await this._proxy.getFeatures(s6);
  763. return [...n3.map((r3) => this._createGraphicHit(e6, s4.fromJSON(r3))), ...a4.map((t2) => this._createGraphicHit(e6, g2.fromJSON(t2)))];
  764. }
  765. queryStatistics() {
  766. return this._proxy.queryStatistics();
  767. }
  768. async querySummaryStatistics(e6, t2, r3) {
  769. const i5 = { ...t2, scale: this.view.scale };
  770. return this._proxy.querySummaryStatistics(this._cleanUpQuery(e6), i5, r3);
  771. }
  772. async queryAggregateSummaryStatistics(e6, t2, r3) {
  773. const i5 = { ...t2, scale: this.view.scale };
  774. return this._proxy.queryAggregateSummaryStatistics(this._cleanUpAggregateQuery(e6), i5, r3);
  775. }
  776. async queryUniqueValues(e6, t2, r3) {
  777. const i5 = { ...t2, scale: this.view.scale };
  778. return this._proxy.queryUniqueValues(this._cleanUpQuery(e6), i5, r3);
  779. }
  780. async queryAggregateUniqueValues(e6, t2, r3) {
  781. const i5 = { ...t2, scale: this.view.scale };
  782. return this._proxy.queryAggregateUniqueValues(this._cleanUpAggregateQuery(e6), i5, r3);
  783. }
  784. async queryClassBreaks(e6, t2, r3) {
  785. const i5 = { ...t2, scale: this.view.scale };
  786. return this._proxy.queryClassBreaks(this._cleanUpQuery(e6), i5, r3);
  787. }
  788. async queryAggregateClassBreaks(e6, t2, r3) {
  789. const i5 = { ...t2, scale: this.view.scale };
  790. return this._proxy.queryAggregateClassBreaks(this._cleanUpAggregateQuery(e6), i5, r3);
  791. }
  792. async queryHistogram(e6, t2, r3) {
  793. const i5 = { ...t2, scale: this.view.scale };
  794. return this._proxy.queryHistogram(this._cleanUpQuery(e6), i5, r3);
  795. }
  796. async queryAggregateHistogram(e6, t2, r3) {
  797. const i5 = { ...t2, scale: this.view.scale };
  798. return this._proxy.queryAggregateHistogram(this._cleanUpAggregateQuery(e6), i5, r3);
  799. }
  800. queryFeatures(e6, t2) {
  801. return this.queryFeaturesJSON(e6, t2).then((e7) => {
  802. const t3 = x3.fromJSON(e7);
  803. return t3.features.forEach((e8) => this._setLayersForFeature(e8)), t3;
  804. });
  805. }
  806. queryVisibleFeatures(e6, t2) {
  807. return this._proxy.queryVisibleFeatures(this._cleanUpQuery(e6), t2).then((e7) => {
  808. const t3 = x3.fromJSON(e7);
  809. return t3.features.forEach((e8) => this._setLayersForFeature(e8)), t3;
  810. });
  811. }
  812. async queryAggregates(e6, t2) {
  813. const r3 = await this._proxy.queryAggregates(this._cleanUpAggregateQuery(e6), t2), i5 = i3.fromJSON(r3);
  814. return i5.features.forEach((e7) => this._setLayersForFeature(e7)), i5;
  815. }
  816. queryAggregateIds(e6, t2) {
  817. return this._proxy.queryAggregateIds(this._cleanUpAggregateQuery(e6), t2);
  818. }
  819. queryAggregateCount(e6, t2) {
  820. return this._proxy.queryAggregateCount(this._cleanUpAggregateQuery(e6), t2);
  821. }
  822. queryAggregateJSON(e6, t2) {
  823. return this._proxy.queryAggregates(this._cleanUpAggregateQuery(e6), t2);
  824. }
  825. queryFeaturesJSON(e6, t2) {
  826. return this._proxy.queryFeatures(this._cleanUpQuery(e6), t2);
  827. }
  828. queryObjectIds(e6, t2) {
  829. return this._proxy.queryObjectIds(this._cleanUpQuery(e6), t2);
  830. }
  831. queryFeatureCount(e6, t2) {
  832. return this._proxy.queryFeatureCount(this._cleanUpQuery(e6), t2);
  833. }
  834. queryExtent(e6, t2) {
  835. return this._proxy.queryExtent(this._cleanUpQuery(e6), t2).then((e7) => ({ count: e7.count, extent: w2.fromJSON(e7.extent) }));
  836. }
  837. setVisibility(e6, t2) {
  838. t2 ? this._visibilityOverrides.delete(e6) : this._visibilityOverrides.add(e6), this._update();
  839. }
  840. update(e6) {
  841. if (!this._tileStrategy || !this.tileRenderer)
  842. return;
  843. const { hasMissingTiles: t2, added: r3, removed: i5 } = this._tileStrategy.update(e6);
  844. (r3.length || i5.length) && this._proxy.updateTiles({ added: r3, removed: i5 }), t2 && this.requestUpdate(), this.notifyChange("updating");
  845. }
  846. attach() {
  847. this.view.timeline.record(`${this.layer.title} (FeatureLayer) Attach`), this._tileStrategy = new l6({ acquireTile: (e6) => this._acquireTile(e6), releaseTile: (e6) => this._releaseTile(e6), tileInfoView: this.view.featuresTilingScheme, buffer: 0 }), this.handles.add(l(() => this.renderingConfigHash, () => this._update(), h), "attach"), "stream" !== this.layer.type && this.handles.add(this.layer.on("edits", (e6) => this._edit(e6)), "attach");
  848. }
  849. detach() {
  850. var _a;
  851. this._commandsQueue.clear(), (_a = this._proxy) == null ? void 0 : _a.stop(), this.container.removeAllChildren(), this.handles.remove("attach"), this.tileRenderer && (this.tileRenderer.uninstall(this.container), this.tileRenderer = null), this._tileStrategy && (this._tileStrategy.destroy(), this._tileStrategy = null), this._tileRendererHash = null;
  852. }
  853. moveStart() {
  854. this.requestUpdate();
  855. }
  856. viewChange() {
  857. this.requestUpdate();
  858. }
  859. moveEnd() {
  860. this.requestUpdate();
  861. }
  862. isUpdating() {
  863. var _a;
  864. const e6 = "renderer" in this.layer && null != this.layer.renderer, t2 = this._commandsQueue.updating, r3 = null != this._updatingRequiredFieldsPromise, i5 = !this._proxy || !this._proxy.isReady, s6 = this._pipelineIsUpdating, a4 = null == this.tileRenderer || ((_a = this.tileRenderer) == null ? void 0 : _a.updating), n3 = e6 && (t2 || r3 || i5 || s6 || a4);
  865. return has("esri-2d-log-updating") && console.log(`Updating FLV2D: ${n3}
  866. -> hasRenderer ${e6}
  867. -> hasPendingCommand ${t2}
  868. -> updatingRequiredFields ${r3}
  869. -> updatingProxy ${i5}
  870. -> updatingPipeline ${s6}
  871. -> updatingTileRenderer ${a4}
  872. `), n3;
  873. }
  874. _createClientOptions() {
  875. return { setUpdating: (e6) => {
  876. this._set("_pipelineIsUpdating", e6);
  877. }, emitEvent: (e6) => {
  878. this.emit(e6.name, e6.event);
  879. } };
  880. }
  881. async _detectQueryMode(e6) {
  882. var _a;
  883. const t2 = "path" in e6, r3 = "editingInfo" in this.layer && ((_a = this.layer.editingInfo) == null ? void 0 : _a.lastEditDate), i5 = !!this.layer.refreshInterval, s6 = !r3 && i5;
  884. if (t2 && ("feature" === this.layer.type || "subtype-group" === this.layer.type) && "point" === this.layer.geometryType && this.layer.capabilities.query.supportsPagination && !this.layer.capabilities.operations.supportsEditing && !s6 && has("featurelayer-snapshot-enabled"))
  885. try {
  886. const e7 = await this.layer.queryFeatureCount();
  887. if (e7 <= has("featurelayer-snapshot-point-min-threshold"))
  888. return { mode: "snapshot", featureCount: e7 };
  889. const t3 = has("featurelayer-snapshot-point-max-threshold"), r4 = has("featurelayer-snapshot-point-coverage"), i6 = this.view.extent, s7 = e2(this.layer.fullExtent), a4 = s7 == null ? void 0 : s7.clone().intersection(i6), n3 = r(a4) ? a4.width * a4.height : 0, o5 = (s7 == null ? void 0 : s7.width) * (s7 == null ? void 0 : s7.height), h4 = 0 === o5 ? 0 : n3 / o5;
  890. if (e7 <= t3 && h4 >= r4)
  891. return { mode: "snapshot", featureCount: e7 };
  892. } catch (a4) {
  893. s.getLogger(this.declaredClass).warn("mapview-feature-layer", "Encountered an error when querying for featureCount", { error: a4 });
  894. }
  895. return { mode: "on-demand" };
  896. }
  897. async _createServiceOptions() {
  898. var _a;
  899. const e6 = this.layer;
  900. if ("stream" === e6.type)
  901. return null;
  902. const { capabilities: t2, objectIdField: r3 } = e6, i5 = e6.fields.map((e7) => e7.toJSON()), s6 = r(e6.fullExtent) && e6.fullExtent.toJSON(), n3 = e4(e6.geometryType), o5 = e6.timeInfo && e6.timeInfo.toJSON() || null, u5 = e6.spatialReference ? e6.spatialReference.toJSON() : null, h4 = "feature" === e6.type ? e6.globalIdField : null;
  903. let d4;
  904. "ogc-feature" === e6.type ? d4 = e6.source.getSource() : J(e6.source) ? d4 = await e6.source.openPorts() : e6.parsedUrl && (d4 = y(e6.parsedUrl), "dynamicDataSource" in e6 && e6.dynamicDataSource && (d4.query = { layer: JSON.stringify({ source: e6.dynamicDataSource }) }));
  905. const p2 = "datesInUnknownTimezone" in this.layer && this.layer.datesInUnknownTimezone, c3 = (_a = "subtypeField" in this.layer && this.layer.subtypeField) != null ? _a : null, { mode: y5, featureCount: g5 } = await this._detectQueryMode(d4);
  906. let f2 = this.layer.objectIdField;
  907. if ("feature" === this.layer.type && r(this.layer.orderBy) && this.layer.orderBy.length) {
  908. const e7 = !this.layer.orderBy[0].valueExpression && this.layer.orderBy[0].field;
  909. e7 && (f2 = e7);
  910. }
  911. return { type: y5, timeReferenceUnknownClient: p2, subtypeField: c3, featureCount: g5, globalIdField: h4, maxRecordCount: t2.query.maxRecordCount, tileMaxRecordCount: t2.query.tileMaxRecordCount, capabilities: t2, fields: i5, fullExtent: s6, geometryType: n3, objectIdField: r3, source: d4, timeInfo: o5, spatialReference: u5, orderByFields: f2 };
  912. }
  913. async _createMemoryServiceOptions(e6) {
  914. const t2 = await e6.openPorts();
  915. return { ...this._createServiceOptions(), type: "memory", source: t2 };
  916. }
  917. _cleanUpQuery(e6) {
  918. const t2 = x2.from(e6) || this.createQuery();
  919. return t2.outSpatialReference || (t2.outSpatialReference = this.view.spatialReference), t2;
  920. }
  921. _cleanUpAggregateQuery(e6) {
  922. const t2 = x2.from(e6) || this.createAggregateQuery();
  923. return t2.outSpatialReference || (t2.outSpatialReference = this.view.spatialReference), t2;
  924. }
  925. async _update() {
  926. return this._commandsQueue.push({ type: "update" });
  927. }
  928. async _edit(e6) {
  929. if (this.suspended)
  930. return void this._clearTiles();
  931. return this._validateEdit(e6) ? this._commandsQueue.push({ type: "edit", edits: e6 }) : void 0;
  932. }
  933. async doRefresh(e6) {
  934. if (this.attached && this._tileStrategy.tileKeys().length)
  935. return this.suspended && e6 ? void this._clearTiles() : this._commandsQueue.push({ type: "refresh", dataChanged: e6 });
  936. }
  937. _clearTiles() {
  938. this._tileStrategy.tileKeys().length && (this._proxy.updateTiles({ added: [], removed: this._tileStrategy.tileKeys() }), this._tileStrategy.clear(), this.requestUpdate(), this._commandsQueue.clear(), this._update());
  939. }
  940. _validateEdit(e6) {
  941. const t2 = "globalIdField" in this.layer && this.layer.globalIdField, r3 = e6.deletedFeatures.some((e7) => -1 === e7.objectId || !e7.objectId), i5 = t2 && this.availableFields.includes(t2);
  942. return r3 && !i5 ? (s.getLogger(this.declaredClass).error(new s2("mapview-apply-edits", `Editing the specified service requires the layer's globalIdField, ${t2} to be included the layer's outFields for updates to be reflected on the map`)), null) : e6;
  943. }
  944. async _doUpdate() {
  945. try {
  946. if (this.destroyed || !this._hasRequiredSupport(this.layer) || !this._tileStrategy)
  947. return;
  948. const { featureEffectView: t2, filter: r3 } = this;
  949. await this._updateRequiredFields();
  950. const { renderer: i5 } = this._getEffectiveRenderer();
  951. this._set("_effectiveRenderer", i5);
  952. const s6 = this._createSchemaConfig(), a4 = this._createConfiguration(s6, r3, t2.filter), o5 = this._lastDefinitionExpression !== a4.schema.source.definitionExpression;
  953. this._lastDefinitionExpression = a4.schema.source.definitionExpression;
  954. const l7 = a4.schema.tileRenderer, u5 = this._createTileRendererHash(l7);
  955. if ("snapshot" === this._serviceOptions.type && (a4.schema.source.initialFeatureCount = this._serviceOptions.featureCount), u5 !== this._tileRendererHash) {
  956. await this._initTileRenderer(l7, i5);
  957. const e6 = this.layer, t3 = "stream" === e6.type ? await this._initServiceOptions() : this._serviceOptions;
  958. this.tileRenderer.onConfigUpdate(i5), "stream" !== e6.type && J(e6.source) && (t3.source = await e6.source.openPorts());
  959. const r4 = { added: this._tileStrategy.tileKeys(), removed: [] };
  960. await this._proxy.startup(this.view.featuresTilingScheme, a4, t3, r4), this.hasHighlight() && await this._proxy.setHighlight(Array.from(this._highlightIds.keys())), await this._onceTilesUpdated(), this.tileRenderer.onConfigUpdate(i5);
  961. } else {
  962. "snapshot" === this._serviceOptions.type && o5 && (a4.schema.source.changedFeatureCount = await this.layer.queryFeatureCount());
  963. const t3 = await this._proxy.update(a4);
  964. (t3.mesh || t3.targets.aggregate) && this._lockGPUUploads();
  965. try {
  966. await this._proxy.applyUpdate(t3);
  967. } catch (e6) {
  968. j(e6) || s.getLogger(this.declaredClass).error(e6);
  969. }
  970. (t3.mesh || t3.targets.aggregate) && this._unlockGPUUploads(), this.tileRenderer.onConfigUpdate(i5), this._updateClusterSizeVariable(), this._forceAttributeTextureUpload();
  971. }
  972. this._tileRendererHash = u5, this.tileRenderer.invalidateLabels(), this.requestUpdate();
  973. } catch (e6) {
  974. }
  975. }
  976. async _doEdit(e6) {
  977. try {
  978. await this._proxy.onEdits(e6);
  979. } catch (t2) {
  980. j(t2), 0;
  981. }
  982. }
  983. async _doRefresh(e6) {
  984. this._lockGPUUploads();
  985. try {
  986. let t3;
  987. e6 && "snapshot" === this.queryMode && "queryFeatureCount" in this.layer && (t3 = await this.layer.queryFeatureCount()), await this._proxy.refresh({ dataChanged: e6, featureCount: t3 });
  988. } catch (r3) {
  989. j(r3), 0;
  990. }
  991. this._unlockGPUUploads();
  992. const t2 = this.layer;
  993. t2 && "featureReduction" in t2 && t2.featureReduction && this._updateClusterSizeVariable();
  994. }
  995. _updateClusterSizeVariable() {
  996. this._needsClusterSizeUpdate && (this.tileRenderer.onConfigUpdate(this._effectiveRenderer), this._needsClusterSizeUpdate = false);
  997. }
  998. _createUpdateClusterSizeTask(e6, t2) {
  999. return l(() => this._aggregateValueRanges, (r3) => {
  1000. this._updateClusterEffectiveRendererSizeVariable(e6, t2, r3), this._needsClusterSizeUpdate = true, this._uploadsLocked || this._updateClusterSizeVariable();
  1001. });
  1002. }
  1003. async _updateClusterEffectiveRendererSizeVariable(e6, t2, r3) {
  1004. if (e6.dynamicClusterSize && "visualVariables" in e6 && e6.visualVariables) {
  1005. const i5 = f(e6.visualVariables);
  1006. if (r(i5) && "cluster_count" === i5.field) {
  1007. const s6 = e6.visualVariables.indexOf(i5);
  1008. e6.visualVariables[s6] = b2(t2, r3);
  1009. const a4 = e6.clone();
  1010. a4.dynamicClusterSize = true, this._set("_effectiveRenderer", a4);
  1011. }
  1012. }
  1013. }
  1014. _getEffectiveRenderer() {
  1015. var _a;
  1016. const e6 = this.layer, t2 = "renderer" in e6 ? e6.renderer : null, r3 = "featureReduction" in e6 ? e6.featureReduction : null;
  1017. if (r(this._updateClusterSizeTask) && (this._updateClusterSizeTask.remove(), this._updateClusterSizeTask = null), r3 && "renderer" in r3 && r3.renderer && !((_a = r3.renderer.authoringInfo) == null ? void 0 : _a.isAutoGenerated)) {
  1018. const e7 = r3.fields;
  1019. if ("cluster" === r3.type) {
  1020. const { renderer: t3, didInject: i5 } = m2(r3.renderer, r3, this._aggregateValueRanges);
  1021. return i5 && (o(this._updateClusterSizeTask, (e8) => e8.remove()), this._updateClusterSizeTask = this._createUpdateClusterSizeTask(t3, r3)), { renderer: t3, aggregateFields: e7, featureReduction: r3 };
  1022. }
  1023. return { renderer: r3.renderer, aggregateFields: e7, featureReduction: r3 };
  1024. }
  1025. if (r3 && "cluster" === r3.type && g3(t2)) {
  1026. const e7 = r3, i5 = [], s6 = d(i5, t2, e7, this._aggregateValueRanges, true);
  1027. return o(this._updateClusterSizeTask, (e8) => e8.remove()), this._updateClusterSizeTask = this._createUpdateClusterSizeTask(s6, e7), { renderer: s6, aggregateFields: i5, featureReduction: r3 };
  1028. }
  1029. return { renderer: t2, aggregateFields: [], featureReduction: null };
  1030. }
  1031. _acquireTile(e6) {
  1032. const t2 = this.tileRenderer.acquireTile(e6);
  1033. return t2.once("attach", () => {
  1034. this.requestUpdate();
  1035. }), t2;
  1036. }
  1037. _releaseTile(e6) {
  1038. this.tileRenderer.releaseTile(e6);
  1039. }
  1040. async _initTileRenderer(e6, t2) {
  1041. const r3 = await e5(e6, { layerView: this, tileInfoView: this.view.featuresTilingScheme, layer: this.layer });
  1042. return this.tileRenderer && (this._tileStrategy.clear(), this.tileRenderer.uninstall(this.container), this.tileRenderer.destroy(), this.tileRenderer = null), this.destroyed ? null : (this._proxy.tileRenderer = r3, this._set("tileRenderer", r3), this.tileRenderer.install(this.container), this.tileRenderer.onConfigUpdate(t2), this.requestUpdate(), this.tileRenderer);
  1043. }
  1044. _createTileRendererHash(e6) {
  1045. return `${e6.type}`;
  1046. }
  1047. get hasFilter() {
  1048. const e6 = !!("floorInfo" in this.layer && this.layer.floorInfo && this.view.floors && this.view.floors.length);
  1049. return !!this.filter || e6 || !!this._visibilityOverrides.size || !!this.timeExtent;
  1050. }
  1051. _injectOverrides(e6) {
  1052. const t2 = r(e6) ? e6.timeExtent : null, r3 = r(this.timeExtent) && r(t2) ? this.timeExtent.intersection(t2) : this.timeExtent || t2;
  1053. let i5 = null;
  1054. const s6 = "floorInfo" in this.layer && this.layer.floorInfo;
  1055. if (s6) {
  1056. const t3 = r(e6) && e6.where;
  1057. i5 = this._addFloorFilterClause(t3);
  1058. }
  1059. if (!this._visibilityOverrides.size && !r3 && !s6)
  1060. return r(e6) ? e6.toJSON() : null;
  1061. (e6 = r(e6) && e6.clone() || new y3()).timeExtent = r3, i5 && (e6.where = i5);
  1062. const a4 = e6.toJSON();
  1063. return a4.hiddenIds = Array.from(this._visibilityOverrides), a4;
  1064. }
  1065. _addFloorFilterClause(e6) {
  1066. var _a;
  1067. const t2 = this.layer;
  1068. let r3 = e6 || "";
  1069. if ("floorInfo" in t2 && t2.floorInfo) {
  1070. let e7 = this.view.floors;
  1071. if (!e7 || !e7.length)
  1072. return r3;
  1073. ((_a = t2.floorInfo.viewAllLevelIds) == null ? void 0 : _a.length) && (e7 = t2.floorInfo.viewAllLevelIds);
  1074. const i5 = e7.filter((e8) => "" !== e8).map((e8) => "'" + e8 + "'");
  1075. i5.push("''");
  1076. const s6 = t2.floorInfo.floorField;
  1077. let a4 = "(" + s6 + " IN ({ids}) OR " + s6 + " IS NULL)";
  1078. if (a4 = a4.replace("{ids}", i5.join(", ")), r(r3) && r3.includes(s6)) {
  1079. let e8 = new RegExp("AND \\(" + s6 + ".*NULL\\)", "g");
  1080. r3 = r3.replace(e8, ""), e8 = new RegExp("\\(" + s6 + ".*NULL\\)", "g"), r3 = r3.replace(e8, ""), r3 = r3.replace(/\s+/g, " ").trim();
  1081. }
  1082. r3 = "" !== r3 ? "(" + r3 + ") AND " + a4 : a4;
  1083. }
  1084. return "" !== r3 ? r3 : null;
  1085. }
  1086. _createConfiguration(e6, t2, r3) {
  1087. const i5 = "feature" === this.layer.type && this.layer.historicMoment ? this.layer.historicMoment.getTime() : void 0, s6 = "feature" === this.layer.type ? this.layer.gdbVersion : void 0, a4 = new Array(S), n3 = this._injectOverrides(t2);
  1088. a4[0] = n3, a4[1] = r(r3) ? r3.toJSON() : null;
  1089. const o5 = F(e6);
  1090. if (t(o5))
  1091. return null;
  1092. const u5 = l4("2d");
  1093. return { availableFields: this.availableFields, gdbVersion: s6, historicMoment: i5, devicePixelRatio: window.devicePixelRatio || 1, filters: a4, schema: o5, supportsTextureFloat: u5.supportsTextureFloat, maxTextureSize: u5.maxTextureSize };
  1094. }
  1095. _hasRequiredSupport(e6) {
  1096. return !("renderer" in e6) || h3(e6.renderer);
  1097. }
  1098. _onceTilesUpdated() {
  1099. return this.requestUpdate(), j3(() => !this._pipelineIsUpdating);
  1100. }
  1101. _lockGPUUploads() {
  1102. this.tileRenderer && (this._uploadsLocked = true, this.tileRenderer.lockGPUUploads());
  1103. }
  1104. _unlockGPUUploads() {
  1105. this.tileRenderer && (this._uploadsLocked = false, this.tileRenderer.unlockGPUUploads());
  1106. }
  1107. _forceAttributeTextureUpload() {
  1108. this.tileRenderer && this.tileRenderer.forceAttributeTextureUpload();
  1109. }
  1110. _createSchemaConfig() {
  1111. const e6 = this.layer;
  1112. return { renderer: "renderer" in e6 ? e6.renderer : null, spatialReference: e6.spatialReference, timeExtent: e6.timeExtent, definitionExpression: e6.definitionExpression, featureReduction: "featureReduction" in e6 ? e6.featureReduction : null, fields: e6.fields, geometryType: e6.geometryType, historicMoment: "historicMoment" in e6 ? e6.historicMoment : null, labelsVisible: "labelsVisible" in e6 && e6.labelsVisible, labelingInfo: "labelingInfo" in e6 && e6.labelingInfo, availableFields: this.availableFields, featureEffect: this.featureEffect, filter: this.filter, gdbVersion: "gdbVersion" in e6 ? e6.gdbVersion : null, pixelBuffer: 0, orderBy: "orderBy" in e6 && e6.orderBy ? e6.orderBy : null, customParameters: { ..."customParameters" in e6 ? e6.customParameters : void 0, token: "apiKey" in e6 ? e6.apiKey : void 0 }, subtypeCode: "subtypeCode" in e6 ? e6.subtypeCode : void 0, subtypeField: "subtypeField" in e6 ? e6.subtypeField : void 0 };
  1113. }
  1114. _addHighlight(e6) {
  1115. for (const t2 of e6)
  1116. if (this._highlightIds.has(t2)) {
  1117. const e7 = this._highlightIds.get(t2);
  1118. this._highlightIds.set(t2, e7 + 1);
  1119. } else
  1120. this._highlightIds.set(t2, 1);
  1121. this._updateHighlight().catch((e7) => {
  1122. j(e7) || s.getLogger(this.declaredClass).error(e7);
  1123. });
  1124. }
  1125. _removeHighlight(e6) {
  1126. for (const t2 of e6)
  1127. if (this._highlightIds.has(t2)) {
  1128. const e7 = this._highlightIds.get(t2) - 1;
  1129. 0 === e7 ? this._highlightIds.delete(t2) : this._highlightIds.set(t2, e7);
  1130. }
  1131. this._updateHighlight().catch((e7) => {
  1132. j(e7) || s.getLogger(this.declaredClass).error(e7);
  1133. });
  1134. }
  1135. _setLayersForFeature(e6) {
  1136. const t2 = this.layer;
  1137. e6.layer = t2, e6.sourceLayer = t2;
  1138. }
  1139. _createGraphicHit(e6, t2) {
  1140. return this._setLayersForFeature(t2), r(t2.geometry) && (t2.geometry.spatialReference = this.view.spatialReference), { type: "graphic", graphic: t2, layer: this.layer, mapPoint: e6 };
  1141. }
  1142. };
  1143. e([y2()], M.prototype, "_serviceOptions", void 0), e([y2()], M.prototype, "_proxy", void 0), e([y2()], M.prototype, "_pipelineIsUpdating", void 0), e([y2()], M.prototype, "_effectiveRenderer", void 0), e([y2()], M.prototype, "_aggregateValueRanges", void 0), e([y2()], M.prototype, "_commandsQueue", void 0), e([y2()], M.prototype, "featureEffectView", void 0), e([y2()], M.prototype, "labelsVisible", null), e([y2({ readOnly: true })], M.prototype, "queryMode", null), e([y2()], M.prototype, "renderingConfigHash", null), e([y2()], M.prototype, "tileRenderer", void 0), e([y2()], M.prototype, "updating", void 0), M = e([n("esri.views.2d.layers.FeatureLayerView2D")], M);
  1144. var B = M;
  1145. export {
  1146. B
  1147. };
  1148. //# sourceMappingURL=chunk-NHCPFH5Y.js.map