chunk-B2HJOMLZ.js 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706
  1. import {
  2. l,
  3. n as n2,
  4. r as r2
  5. } from "./chunk-II7RCTF3.js";
  6. import {
  7. c as c2,
  8. e as e3,
  9. f,
  10. i,
  11. n,
  12. s as s3,
  13. u
  14. } from "./chunk-HWIURR7X.js";
  15. import {
  16. me as me2
  17. } from "./chunk-Q4LKAPDF.js";
  18. import {
  19. A as A2,
  20. t as t2
  21. } from "./chunk-P2L4QEOI.js";
  22. import {
  23. N,
  24. O,
  25. P,
  26. S,
  27. T,
  28. c
  29. } from "./chunk-WFSV2B2I.js";
  30. import {
  31. G
  32. } from "./chunk-MI7HWWFL.js";
  33. import {
  34. W,
  35. be,
  36. ce,
  37. ee,
  38. me,
  39. ne
  40. } from "./chunk-FYNVVMWY.js";
  41. import {
  42. e as e2
  43. } from "./chunk-HBMVUVZX.js";
  44. import {
  45. m
  46. } from "./chunk-LY74KTXV.js";
  47. import {
  48. d
  49. } from "./chunk-KMAHKQ2G.js";
  50. import {
  51. o2
  52. } from "./chunk-XNLG7T2T.js";
  53. import {
  54. D,
  55. g
  56. } from "./chunk-ULGDPLM2.js";
  57. import {
  58. s,
  59. s3 as s2
  60. } from "./chunk-EMJ4ZSM2.js";
  61. import {
  62. A,
  63. a,
  64. e,
  65. o,
  66. r,
  67. t,
  68. v
  69. } from "./chunk-GZT4BVFP.js";
  70. // node_modules/@arcgis/core/views/2d/layers/features/support/FeatureSetReaderJSON.js
  71. function c3({ coords: t3, lengths: e4 }) {
  72. let r5 = 0;
  73. for (const s4 of e4) {
  74. for (let e5 = 1; e5 < s4; e5++)
  75. t3[2 * (r5 + e5)] += t3[2 * (r5 + e5) - 2], t3[2 * (r5 + e5) + 1] += t3[2 * (r5 + e5) - 1];
  76. r5 += s4;
  77. }
  78. }
  79. var d2 = class extends A2 {
  80. constructor(t3, e4, r5) {
  81. super(t3, r5), this._featureIndex = -1, this._dateFields = new Set(), this._geometryType = r5?.geometryType, this._features = e4;
  82. }
  83. static fromFeatures(t3, e4) {
  84. const { objectIdField: s4, geometryType: i2 } = e4, n4 = W([], t3, i2, false, false, s4);
  85. for (let r5 = 0; r5 < n4.length; r5++)
  86. n4[r5].displayId = t3[r5].displayId;
  87. return d2.fromOptimizedFeatures(n4, e4);
  88. }
  89. static fromFeatureSet(t3, e4) {
  90. const r5 = ce(t3, e4.objectIdField);
  91. return d2.fromOptimizedFeatureSet(r5, e4);
  92. }
  93. static fromOptimizedFeatureSet(t3, e4) {
  94. const { features: r5 } = t3, s4 = d2.fromOptimizedFeatures(r5, e4);
  95. s4._exceededTransferLimit = t3.exceededTransferLimit, s4._transform = t3.transform;
  96. for (const i2 of t3.fields)
  97. i2.type === "esriFieldTypeDate" && s4._dateFields.add(i2.name);
  98. return s4;
  99. }
  100. static fromOptimizedFeatures(t3, e4, r5) {
  101. const s4 = A2.createInstance(), i2 = new d2(s4, t3, e4);
  102. return i2._transform = r5, i2;
  103. }
  104. get _current() {
  105. return this._features[this._featureIndex];
  106. }
  107. get geometryType() {
  108. return this._geometryType;
  109. }
  110. get hasFeatures() {
  111. return !!this._features.length;
  112. }
  113. get hasNext() {
  114. return this._featureIndex + 1 < this._features.length;
  115. }
  116. get exceededTransferLimit() {
  117. return this._exceededTransferLimit;
  118. }
  119. get hasZ() {
  120. return false;
  121. }
  122. get hasM() {
  123. return false;
  124. }
  125. removeIds(t3) {
  126. const e4 = new Set(t3);
  127. this._features = this._features.filter((t4) => !e4.has(t4.objectId));
  128. }
  129. append(t3) {
  130. for (const e4 of t3)
  131. this._features.push(e4);
  132. }
  133. getSize() {
  134. return this._features.length;
  135. }
  136. getCursor() {
  137. return this.copy();
  138. }
  139. getQuantizationTransform() {
  140. return this._transform;
  141. }
  142. getAttributeHash() {
  143. let t3 = "";
  144. for (const e4 in this._current.attributes)
  145. t3 += this._current.attributes[e4];
  146. return t3;
  147. }
  148. getIndex() {
  149. return this._featureIndex;
  150. }
  151. setIndex(t3) {
  152. this._featureIndex = t3;
  153. }
  154. getObjectId() {
  155. return this._current.objectId;
  156. }
  157. getDisplayId() {
  158. return this._current.displayId;
  159. }
  160. setDisplayId(t3) {
  161. this._current.displayId = t3;
  162. }
  163. getGroupId() {
  164. return this._current.groupId;
  165. }
  166. setGroupId(t3) {
  167. this._current.groupId = t3;
  168. }
  169. copy() {
  170. const t3 = new d2(this.instance, this._features, this.fullSchema());
  171. return this.copyInto(t3), t3;
  172. }
  173. next() {
  174. for (; ++this._featureIndex < this._features.length && !this._getExists(); )
  175. ;
  176. return this._featureIndex < this._features.length;
  177. }
  178. readLegacyFeature() {
  179. return ee(this._current, this.geometryType, this.hasZ, this.hasM);
  180. }
  181. readOptimizedFeature() {
  182. return this._current;
  183. }
  184. readLegacyPointGeometry() {
  185. return this.readGeometry() ? { x: this.getX(), y: this.getY() } : null;
  186. }
  187. readLegacyGeometry() {
  188. const t3 = this.readGeometry();
  189. return ne(t3, this.geometryType, this.hasZ, this.hasM);
  190. }
  191. readLegacyCentroid() {
  192. const e4 = this.readCentroid();
  193. return t(e4) ? null : { x: e4.coords[0] * this._sx + this._tx, y: e4.coords[1] * this._sy + this._ty };
  194. }
  195. readGeometryArea() {
  196. return e2(this._current) ? be(this._current.geometry, 2) : 0;
  197. }
  198. readUnquantizedGeometry() {
  199. const t3 = this.readGeometry();
  200. if (this.geometryType === "esriGeometryPoint" || !t3)
  201. return t3;
  202. const e4 = t3.clone();
  203. return c3(e4), e4;
  204. }
  205. readHydratedGeometry() {
  206. const r5 = this._current.geometry;
  207. if (t(r5))
  208. return null;
  209. const s4 = r5.clone();
  210. return r(this._transform) && me(s4, s4, this.hasZ, this.hasM, this._transform), s4;
  211. }
  212. getXHydrated() {
  213. if (!e2(this._current))
  214. return 0;
  215. const e4 = this._current.geometry.coords[0], r5 = this.getQuantizationTransform();
  216. return t(r5) ? e4 : e4 * r5.scale[0] + r5.translate[0];
  217. }
  218. getYHydrated() {
  219. if (!e2(this._current))
  220. return 0;
  221. const e4 = this._current.geometry.coords[1], r5 = this.getQuantizationTransform();
  222. return t(r5) ? e4 : r5.translate[1] - e4 * r5.scale[1];
  223. }
  224. getX() {
  225. return e2(this._current) ? this._current.geometry.coords[0] * this._sx + this._tx : 0;
  226. }
  227. getY() {
  228. return e2(this._current) ? this._current.geometry.coords[1] * this._sy + this._ty : 0;
  229. }
  230. readGeometry() {
  231. if (!e2(this._current))
  232. return null;
  233. const t3 = this._current.geometry.clone();
  234. if (t3.isPoint)
  235. return t3.coords[0] = t3.coords[0] * this._sx + this._tx, t3.coords[1] = t3.coords[1] * this._sy + this._ty, t3;
  236. let e4 = 0;
  237. for (const r5 of t3.lengths)
  238. t3.coords[2 * e4] = t3.coords[2 * e4] * this._sx + this._tx, t3.coords[2 * e4 + 1] = t3.coords[2 * e4 + 1] * this._sy + this._ty, e4 += r5;
  239. return t3;
  240. }
  241. readCentroid() {
  242. if (!e2(this._current))
  243. return null;
  244. if (t(this._current.centroid)) {
  245. const e5 = this._computeCentroid();
  246. if (t(e5))
  247. return null;
  248. e5.coords[0] = (e5.coords[0] - this._tx) / this._sx, e5.coords[1] = (e5.coords[1] - this._ty) / this._sy, this._current.centroid = e5;
  249. }
  250. const e4 = this._current.centroid.clone();
  251. return e4.coords[0] = e4.coords[0] * this._sx + this._tx, e4.coords[1] = e4.coords[1] * this._sx + this._ty, e4;
  252. }
  253. hasField(t3) {
  254. if (t3 in this._current.attributes)
  255. return true;
  256. return this.getFieldNames().map((t4) => t4.toLowerCase()).includes(t3.toLowerCase());
  257. }
  258. getFieldNames() {
  259. return Object.keys(this._current.attributes);
  260. }
  261. _readAttribute(t3, e4) {
  262. const r5 = this._current.attributes[t3];
  263. if (r5 !== void 0)
  264. return r5 != null && e4 && this._dateFields.has(t3) ? new Date(r5) : r5;
  265. const s4 = this.readAttributes(), i2 = t3.toLocaleLowerCase().trim();
  266. for (const n4 in s4)
  267. if (n4.toLocaleLowerCase().trim() === i2) {
  268. const t4 = this._current.attributes[n4];
  269. return t4 != null && e4 && this._dateFields.has(n4) ? new Date(t4) : t4;
  270. }
  271. }
  272. copyInto(t3) {
  273. super.copyInto(t3), t3._featureIndex = this._featureIndex, t3._transform = this._transform, t3._dateFields = this._dateFields;
  274. }
  275. _readAttributes() {
  276. return this._current.attributes;
  277. }
  278. };
  279. // node_modules/@arcgis/core/views/2d/layers/features/support/AttributeStore.js
  280. var C = s.getLogger("esri.views.layers.2d.features.support.AttributeStore");
  281. var F = n2(l, C);
  282. var M = { sharedArrayBuffer: a("esri-shared-array-buffer"), atomics: a("esri-atomics") };
  283. function B(t3, e4) {
  284. return (i2) => e4(t3(i2));
  285. }
  286. var v2 = class {
  287. constructor(t3, e4, i2, s4) {
  288. this.size = 0, this.texelSize = 4;
  289. const { pixelType: r5, layout: a2, textureOnly: o3 } = s4;
  290. this.textureOnly = o3 || false, this.pixelType = r5, this._ctype = e4, this.layout = a2, this._resetRange(), this._shared = t3, this.size = i2, o3 || (this.data = this._initData(r5, i2, t3, e4));
  291. }
  292. get buffer() {
  293. return o(this.data, (t3) => t3.buffer);
  294. }
  295. unsetComponentAllTexels(t3, e4) {
  296. const i2 = e(this.data);
  297. for (let s4 = 0; s4 < this.size * this.size; s4++)
  298. i2[s4 * this.texelSize + t3] &= ~e4;
  299. this.dirtyStart = 0, this.dirtyEnd = this.size * this.size - 1;
  300. }
  301. setComponentAllTexels(t3, e4) {
  302. const i2 = e(this.data);
  303. for (let s4 = 0; s4 < this.size * this.size; s4++)
  304. i2[s4 * this.texelSize + t3] |= 255 & e4;
  305. this.dirtyStart = 0, this.dirtyEnd = this.size * this.size - 1;
  306. }
  307. setComponent(t3, e4, i2) {
  308. const s4 = e(this.data);
  309. for (const r5 of i2)
  310. s4[r5 * this.texelSize + t3] |= e4, this.dirtyStart = Math.min(this.dirtyStart, r5), this.dirtyEnd = Math.max(this.dirtyEnd, r5);
  311. }
  312. setComponentTexel(t3, e4, i2) {
  313. e(this.data)[i2 * this.texelSize + t3] |= e4, this.dirtyStart = Math.min(this.dirtyStart, i2), this.dirtyEnd = Math.max(this.dirtyEnd, i2);
  314. }
  315. unsetComponentTexel(t3, e4, i2) {
  316. e(this.data)[i2 * this.texelSize + t3] &= ~e4, this.dirtyStart = Math.min(this.dirtyStart, i2), this.dirtyEnd = Math.max(this.dirtyEnd, i2);
  317. }
  318. getData(t3, e4) {
  319. const i2 = f(t3);
  320. return e(this.data)[i2 * this.texelSize + e4];
  321. }
  322. setData(t3, e4, i2) {
  323. const s4 = f(t3), r5 = 1 << e4;
  324. (this.layout & r5) != 0 ? (this.data[s4 * this.texelSize + e4] = i2, this.dirtyStart = Math.min(this.dirtyStart, s4), this.dirtyEnd = Math.max(this.dirtyEnd, s4)) : C.error("mapview-attributes-store", "Tried to set a value for a texel's readonly component");
  325. }
  326. lock() {
  327. this.pixelType === G.UNSIGNED_BYTE && this._shared && M.atomics && this._ctype !== "local" && Atomics.store(this.data, 0, 1);
  328. }
  329. unlock() {
  330. this.pixelType === G.UNSIGNED_BYTE && this._shared && M.atomics && this._ctype !== "local" && Atomics.store(this.data, 0, 0);
  331. }
  332. expand(t3) {
  333. if (this.size = t3, !this.textureOnly) {
  334. const e4 = this._initData(this.pixelType, t3, this._shared, this._ctype), i2 = e(this.data);
  335. e4.set(i2), this.data = e4;
  336. }
  337. }
  338. toMessage() {
  339. const t3 = this.dirtyStart, e4 = this.dirtyEnd, i2 = this.texelSize;
  340. if (t3 > e4)
  341. return null;
  342. this._resetRange();
  343. const s4 = !(this._shared || this._ctype === "local"), r5 = this.pixelType, a2 = this.layout, o3 = e(this.data);
  344. return { start: t3, end: e4, data: s4 && o3.slice(t3 * i2, (e4 + 1) * i2) || null, pixelType: r5, layout: a2 };
  345. }
  346. _initData(t3, e4, i2, s4) {
  347. const r5 = i2 && s4 !== "local" ? SharedArrayBuffer : ArrayBuffer, a2 = me2(t3), o3 = new a2(new r5(e4 * e4 * 4 * a2.BYTES_PER_ELEMENT));
  348. for (let n4 = 0; n4 < o3.length; n4 += 4)
  349. o3[n4 + 1] = 255;
  350. return o3;
  351. }
  352. _resetRange() {
  353. this.dirtyStart = 2147483647, this.dirtyEnd = 0;
  354. }
  355. };
  356. var R = class {
  357. constructor(t3, e4, i2 = () => {
  358. }) {
  359. this._client = t3, this.config = e4, this._notifyChange = i2, this._attributeComputeMap = new Map(), this._blocks = new Array(), this._filters = new Array(S), this._targetType = 0, this._abortController = new AbortController(), this._hasScaleExpr = false, this._size = 32, this._idsToHighlight = new Set();
  360. const s4 = e4.supportsTextureFloat ? G.FLOAT : G.UNSIGNED_BYTE;
  361. F(`Creating AttributeStore ${M.sharedArrayBuffer ? "with" : "without"} shared memory`), this._blockDescriptors = [{ pixelType: G.UNSIGNED_BYTE, layout: 1 }, { pixelType: G.UNSIGNED_BYTE, layout: 15, textureOnly: true }, { pixelType: G.UNSIGNED_BYTE, layout: 15, textureOnly: true }, { pixelType: s4, layout: 15 }, { pixelType: s4, layout: 15 }, { pixelType: s4, layout: 15 }, { pixelType: s4, layout: 15 }], this._blocks = this._blockDescriptors.map(() => null);
  362. }
  363. destroy() {
  364. this._abortController.abort();
  365. }
  366. get hasScaleExpr() {
  367. return this._hasScaleExpr;
  368. }
  369. get _signal() {
  370. return this._abortController.signal;
  371. }
  372. get hasHighlight() {
  373. return this._idsToHighlight.size > 0;
  374. }
  375. isUpdating() {
  376. return !!this._currUpdate || !!this._nextUpdate;
  377. }
  378. update(t3, i2) {
  379. this.config = i2;
  380. const s4 = i2.schema.processors[0].storage, o3 = m(this._schema, s4);
  381. if ((t3.targets.feature || t3.targets.aggregate) && (t3.storage.data = true), o3 && (a("esri-2d-update-debug") && console.debug("Applying Update - AttributeStore:", o3), t3.storage.data = true, this._schema = s4, this._attributeComputeMap.clear(), !t(s4))) {
  382. switch (s4.target) {
  383. case "feature":
  384. this._targetType = u;
  385. break;
  386. case "aggregate":
  387. this._targetType = c2;
  388. }
  389. if (s4.type === "subtype")
  390. for (const t4 in s4.mapping) {
  391. const e4 = s4.mapping[t4];
  392. if (r(e4) && r(e4.vvMapping))
  393. for (const t5 of e4.vvMapping)
  394. this._bindAttribute(t5);
  395. }
  396. else {
  397. if (r(s4.vvMapping))
  398. for (const t4 of s4.vvMapping)
  399. this._bindAttribute(t4);
  400. if (r(s4.attributeMapping))
  401. for (const t4 of s4.attributeMapping)
  402. this._bindAttribute(t4);
  403. }
  404. }
  405. }
  406. onTileData(t3, e4) {
  407. if (t(e4.addOrUpdate))
  408. return;
  409. const i2 = e4.addOrUpdate.getCursor();
  410. for (; i2.next(); ) {
  411. const t4 = i2.getDisplayId();
  412. this.setAttributeData(t4, i2);
  413. }
  414. }
  415. invalidateResources() {
  416. this._createResourcesPromise = null, this._abortController.abort(), this._abortController = new AbortController();
  417. }
  418. async setHighlight(t3, e4) {
  419. const i2 = 1, s4 = this._getBlock(0), r5 = e4.map((t4) => f(t4));
  420. s4.lock(), s4.unsetComponentAllTexels(0, i2), s4.setComponent(0, i2, r5), s4.unlock(), this._idsToHighlight.clear();
  421. for (const a2 of t3)
  422. this._idsToHighlight.add(a2);
  423. await this.sendUpdates();
  424. }
  425. async updateFilters(t3, i2, s4) {
  426. const { service: r5, spatialReference: a2 } = s4, { filters: o3 } = i2, n4 = o3.map((t4, e4) => this._updateFilter(t4, e4, r5, a2));
  427. (await Promise.all(n4)).some((t4) => t4) && (t3.storage.filters = true, a("esri-2d-update-debug") && console.debug("Applying Update - AttributeStore:", "Filters changed"));
  428. }
  429. setData(t3, e4, i2, s4) {
  430. const r5 = f(t3);
  431. this._ensureSizeForTexel(r5), this._getBlock(e4).setData(t3, i2, s4);
  432. }
  433. getData(t3, e4, i2) {
  434. return this._getBlock(e4).getData(t3, i2);
  435. }
  436. getHighlightFlag(t3) {
  437. return this._idsToHighlight.has(t3) ? T : 0;
  438. }
  439. unsetAttributeData(t3) {
  440. const e4 = f(t3);
  441. this._getBlock(0).setData(e4, 0, 0);
  442. }
  443. setAttributeData(t3, e4) {
  444. const i2 = f(t3);
  445. if (this._ensureSizeForTexel(i2), this._getBlock(0).setData(i2, 0, this.getFilterFlags(e4)), this._targetType !== e3(t3))
  446. return;
  447. const r5 = this._attributeComputeMap, a2 = this.config.supportsTextureFloat ? 1 : 2, o3 = 4;
  448. r5.size && r5.forEach((t4, r6) => {
  449. const n4 = r6 * a2 % o3, l2 = Math.floor(r6 * a2 / o3), h = this._getBlock(l2 + P), u2 = t4(e4);
  450. if (this.config.supportsTextureFloat)
  451. h.setData(i2, n4, u2);
  452. else if (u2 === c)
  453. h.setData(i2, n4, 255), h.setData(i2, n4 + 1, 255);
  454. else {
  455. const t5 = o2(Math.round(u2), -32767, 32766) + 32768, e5 = 255 & t5, r7 = (65280 & t5) >> 8;
  456. h.setData(i2, n4, e5), h.setData(i2, n4 + 1, r7);
  457. }
  458. });
  459. }
  460. sendUpdates() {
  461. if (a("esri-2d-update-debug") && console.debug("AttributeStore::sendUpdate"), this._notifyChange(), this._nextUpdate)
  462. return this._nextUpdate.promise;
  463. if (this._currUpdate)
  464. return this._nextUpdate = D(), this._nextUpdate.promise;
  465. const i2 = { blocks: this._blocks.map((t3) => r(t3) ? t3.toMessage() : null) };
  466. return this._currUpdate = this._createResources().then(() => {
  467. const t3 = () => {
  468. if (this._currUpdate = null, this._nextUpdate) {
  469. const t4 = this._nextUpdate;
  470. this._nextUpdate = null, this.sendUpdates().then(() => t4.resolve());
  471. } else
  472. a("esri-2d-update-debug") && console.debug("AttributeStore::sendUpdate::No additional updates queued");
  473. this._notifyChange();
  474. };
  475. a("esri-2d-update-debug") && console.debug("AttributeStore::sendUpdate::client.update");
  476. const s4 = this._client.update(i2, this._signal).then(t3).catch(t3);
  477. return this._client.render(this._signal), s4;
  478. }).catch((e4) => {
  479. if (g(e4))
  480. return this._createResourcesPromise = null, this._createResources();
  481. this._notifyChange(), C.error(new s2("mapview-attribute-store", "Encountered an error during client update", e4));
  482. }), this._currUpdate;
  483. }
  484. _ensureSizeForTexel(t3) {
  485. for (; t3 >= this._size * this._size; )
  486. if (this._expand())
  487. return;
  488. }
  489. _bindAttribute(t3) {
  490. function e4() {
  491. return t3.normalizationField ? (e5) => {
  492. const i3 = e5.readAttribute(t3.normalizationField);
  493. if (!i3)
  494. return null;
  495. return e5.readAttribute(t3.field) / i3;
  496. } : (e5) => e5.readAttribute(t3.field);
  497. }
  498. function i2() {
  499. return t3.normalizationField && C.warn("mapview-arcade", "Ignoring normalizationField specified with an arcade expression which is not supported."), (e5) => e5.getComputedNumericAtIndex(t3.fieldIndex);
  500. }
  501. let s4;
  502. if (t3.fieldIndex != null)
  503. s4 = i2();
  504. else {
  505. if (!t3.field)
  506. return;
  507. s4 = e4();
  508. }
  509. if (t3.valueRepresentation) {
  510. s4 = B(s4, (e5) => r2(e5, t3.valueRepresentation));
  511. }
  512. const r5 = (t4) => t4 === null || isNaN(t4) || t4 === 1 / 0 ? c : t4;
  513. this._attributeComputeMap.set(t3.binding, B(s4, r5));
  514. }
  515. _createResources() {
  516. if (r(this._createResourcesPromise))
  517. return this._createResourcesPromise;
  518. this._getBlock(N), this._getBlock(O), F("Initializing AttributeStore");
  519. const e4 = { shared: M.sharedArrayBuffer && !(this._client.type === "local"), size: this._size, blocks: v(this._blocks, (t3) => ({ textureOnly: t3.textureOnly, buffer: t3.buffer, pixelType: t3.pixelType })) }, i2 = this._client.initialize(e4, this._signal).catch((e5) => {
  520. g(e5) ? this._createResourcesPromise = null : C.error(new s2("mapview-attribute-store", "Encountered an error during client initialization", e5));
  521. });
  522. return this._createResourcesPromise = i2, i2.then(() => t(this._createResourcesPromise) ? this._createResources() : void 0), i2;
  523. }
  524. _getBlock(t3) {
  525. const e4 = this._blocks[t3];
  526. if (r(e4))
  527. return e4;
  528. F(`Initializing AttributeBlock at index ${t3}`);
  529. const i2 = M.sharedArrayBuffer, s4 = this._client.type, r5 = new v2(i2, s4, this._size, this._blockDescriptors[t3]);
  530. return this._blocks[t3] = r5, this._createResourcesPromise = null, r5;
  531. }
  532. _expand() {
  533. if (this._size < this.config.maxTextureSize) {
  534. const t3 = this._size <<= 1;
  535. return F("Expanding block size to", t3, this._blocks), A(this._blocks, (e4) => e4.expand(t3)), this._createResourcesPromise = null, this._size = t3, 0;
  536. }
  537. return C.error(new s2("mapview-limitations", "Maximum number of onscreen features exceeded.")), -1;
  538. }
  539. async _updateFilter(t3, e4, i2, s4) {
  540. const o3 = this._filters[e4], n4 = r(o3) && o3.hash;
  541. if (!o3 && !t3)
  542. return false;
  543. if (n4 === JSON.stringify(t3))
  544. return false;
  545. if (t(t3)) {
  546. if (!o3)
  547. return false;
  548. const t4 = 1 << e4 + 1, i3 = this._getBlock(0);
  549. return this._filters[e4] = null, i3.setComponentAllTexels(0, t4), this.sendUpdates(), true;
  550. }
  551. const l2 = await this._getFilter(e4, i2);
  552. return await l2.update(t3, s4), true;
  553. }
  554. async _getFilter(t3, e4) {
  555. const i2 = this._filters[t3];
  556. if (r(i2))
  557. return i2;
  558. const { default: s4 } = await import("./FeatureFilter-DN2CX36X.js"), r5 = new s4({ geometryType: e4.geometryType, hasM: false, hasZ: false, timeInfo: e4.timeInfo, fieldsIndex: new d(e4.fields) });
  559. return this._filters[t3] = r5, r5;
  560. }
  561. isVisible(t3) {
  562. return !!(2 & this._getBlock(0).getData(t3, 0));
  563. }
  564. getFilterFlags(t3) {
  565. let e4 = 0;
  566. const i2 = i(t3.getDisplayId());
  567. for (let a2 = 0; a2 < this._filters.length; a2++) {
  568. const s5 = !!(i2 & 1 << a2), o3 = this._filters[a2];
  569. e4 |= (!s5 || t(o3) || o3.check(t3) ? 1 : 0) << a2;
  570. }
  571. let s4 = 0;
  572. if (this._idsToHighlight.size) {
  573. const e5 = t3.getObjectId();
  574. s4 = this.getHighlightFlag(e5);
  575. }
  576. return e4 << 1 | s4;
  577. }
  578. };
  579. // node_modules/@arcgis/core/views/2d/layers/features/support/DisplayIdGenerator.js
  580. var r3 = class {
  581. constructor() {
  582. this._freeIds = [], this._idCounter = 1;
  583. }
  584. createId(r5 = false) {
  585. return s3(this._getFreeId(), r5);
  586. }
  587. releaseId(e4) {
  588. this._freeIds.push(e4);
  589. }
  590. _getFreeId() {
  591. return this._freeIds.length ? this._freeIds.pop() : this._idCounter++;
  592. }
  593. };
  594. // node_modules/@arcgis/core/views/2d/layers/features/support/ComputedAttributeStorage.js
  595. function n3(t3, e4, s4) {
  596. if (!(t3.length > e4))
  597. for (; t3.length <= e4; )
  598. t3.push(s4);
  599. }
  600. var r4 = class {
  601. constructor() {
  602. this._numerics = [], this._strings = [], this._idGenerator = new r3(), this._allocatedSize = 256, this._bitsets = [], this._instanceIds = [], this._bounds = [];
  603. }
  604. createBitset() {
  605. const e4 = this._bitsets.length;
  606. return this._bitsets.push(t2.create(this._allocatedSize, n)), e4 + 1;
  607. }
  608. getBitset(t3) {
  609. return this._bitsets[t3 - 1];
  610. }
  611. _expand() {
  612. this._allocatedSize <<= 1;
  613. for (const t3 of this._bitsets)
  614. t3.resize(this._allocatedSize);
  615. }
  616. _ensureNumeric(t3, e4) {
  617. this._numerics[t3] || (this._numerics[t3] = []);
  618. n3(this._numerics[t3], e4, 0);
  619. }
  620. _ensureInstanceId(t3) {
  621. n3(this._instanceIds, t3, 0);
  622. }
  623. _ensureString(t3, e4) {
  624. this._strings[t3] || (this._strings[t3] = []);
  625. n3(this._strings[t3], e4, null);
  626. }
  627. createDisplayId(t3 = false) {
  628. const s4 = this._idGenerator.createId();
  629. return s4 > this._allocatedSize && this._expand(), s3(s4, t3);
  630. }
  631. releaseDisplayId(e4) {
  632. for (const t3 of this._bitsets)
  633. t3.unset(e4);
  634. return this._idGenerator.releaseId(e4 & n);
  635. }
  636. getComputedNumeric(e4, s4) {
  637. return this.getComputedNumericAtIndex(e4 & n, 0);
  638. }
  639. setComputedNumeric(e4, s4, i2) {
  640. return this.setComputedNumericAtIndex(e4 & n, i2, 0);
  641. }
  642. getComputedString(e4, s4) {
  643. return this.getComputedStringAtIndex(e4 & n, 0);
  644. }
  645. setComputedString(e4, s4, i2) {
  646. return this.setComputedStringAtIndex(e4 & n, 0, i2);
  647. }
  648. getComputedNumericAtIndex(e4, s4) {
  649. const i2 = e4 & n;
  650. return this._ensureNumeric(s4, i2), this._numerics[s4][i2];
  651. }
  652. setComputedNumericAtIndex(e4, s4, i2) {
  653. const n4 = e4 & n;
  654. this._ensureNumeric(s4, n4), this._numerics[s4][n4] = i2;
  655. }
  656. getInstanceId(e4) {
  657. const s4 = e4 & n;
  658. return this._ensureInstanceId(s4), this._instanceIds[s4];
  659. }
  660. setInstanceId(e4, s4) {
  661. const i2 = e4 & n;
  662. this._ensureInstanceId(i2), this._instanceIds[i2] = s4;
  663. }
  664. getComputedStringAtIndex(e4, s4) {
  665. const i2 = e4 & n;
  666. return this._ensureString(s4, i2), this._strings[s4][i2];
  667. }
  668. setComputedStringAtIndex(e4, s4, i2) {
  669. const n4 = e4 & n;
  670. this._ensureString(s4, n4), this._strings[s4][n4] = i2;
  671. }
  672. getXMin(e4) {
  673. return this._bounds[4 * (e4 & n)];
  674. }
  675. getYMin(e4) {
  676. return this._bounds[4 * (e4 & n) + 1];
  677. }
  678. getXMax(e4) {
  679. return this._bounds[4 * (e4 & n) + 2];
  680. }
  681. getYMax(e4) {
  682. return this._bounds[4 * (e4 & n) + 3];
  683. }
  684. setBounds(e4, s4) {
  685. const i2 = s4.readHydratedGeometry();
  686. if (!i2 || !i2.coords.length)
  687. return false;
  688. let r5 = 1 / 0, u2 = 1 / 0, o3 = -1 / 0, h = -1 / 0;
  689. i2.forEachVertex((t3, e5) => {
  690. r5 = Math.min(r5, t3), u2 = Math.min(u2, e5), o3 = Math.max(o3, t3), h = Math.max(h, e5);
  691. });
  692. const d3 = e4 & n;
  693. return n3(this._bounds, 4 * d3 + 4, 0), this._bounds[4 * d3] = r5, this._bounds[4 * d3 + 1] = u2, this._bounds[4 * d3 + 2] = o3, this._bounds[4 * d3 + 3] = h, true;
  694. }
  695. };
  696. export {
  697. d2 as d,
  698. R,
  699. r4 as r
  700. };
  701. //# sourceMappingURL=chunk-B2HJOMLZ.js.map