VectorTileLayerView2D-ANKA365Z.js 94 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135
  1. import {
  2. u as u3,
  3. y as y4
  4. } from "./chunk-ZOTXRPGC.js";
  5. import {
  6. i as i2,
  7. r as r6
  8. } from "./chunk-J2PY6ANL.js";
  9. import "./chunk-MH3GGTFP.js";
  10. import {
  11. r as r5
  12. } from "./chunk-2ZACOQZJ.js";
  13. import "./chunk-JBMHQ5RK.js";
  14. import {
  15. e as e7
  16. } from "./chunk-42RTSVHV.js";
  17. import {
  18. E as E5,
  19. a as a3
  20. } from "./chunk-WBWQJQK4.js";
  21. import {
  22. c,
  23. e as e5,
  24. t as t4
  25. } from "./chunk-DBT4KOKX.js";
  26. import {
  27. l as l4
  28. } from "./chunk-LC47RING.js";
  29. import {
  30. I as I3,
  31. L
  32. } from "./chunk-L553EHL3.js";
  33. import {
  34. a as a2,
  35. i,
  36. l as l3,
  37. n as n4,
  38. r as r3
  39. } from "./chunk-2GP5D74I.js";
  40. import "./chunk-SCZJ2KEY.js";
  41. import "./chunk-WPDBODJM.js";
  42. import "./chunk-EPMXCACW.js";
  43. import {
  44. t as t3
  45. } from "./chunk-KFLNKWNF.js";
  46. import "./chunk-R24MO4IV.js";
  47. import "./chunk-YQBYWPBD.js";
  48. import "./chunk-T2SKWJGU.js";
  49. import "./chunk-UO3LS2M5.js";
  50. import {
  51. E as E4
  52. } from "./chunk-H2VOWDMO.js";
  53. import "./chunk-QISOH77W.js";
  54. import "./chunk-UWKVAZQ6.js";
  55. import "./chunk-3WXSWAUV.js";
  56. import "./chunk-27YO3FKC.js";
  57. import {
  58. I as I2
  59. } from "./chunk-EQNT4A7P.js";
  60. import "./chunk-XO5VJRK4.js";
  61. import {
  62. t as t2
  63. } from "./chunk-4OM3EX6P.js";
  64. import {
  65. C,
  66. D as D2,
  67. E as E3,
  68. F,
  69. G,
  70. I,
  71. O,
  72. P,
  73. R
  74. } from "./chunk-3OFVLRSL.js";
  75. import {
  76. e as e6,
  77. r as r4
  78. } from "./chunk-IQBIGNPU.js";
  79. import "./chunk-5FHRTN6L.js";
  80. import "./chunk-NDUYF7XW.js";
  81. import "./chunk-K7B6OWCU.js";
  82. import {
  83. u as u2
  84. } from "./chunk-7FZX4UI7.js";
  85. import "./chunk-IR3DRB65.js";
  86. import {
  87. y as y3
  88. } from "./chunk-PQGNKUMB.js";
  89. import "./chunk-UDYHZLTE.js";
  90. import "./chunk-DGINNG7Z.js";
  91. import {
  92. h as h3
  93. } from "./chunk-KK6FUQQU.js";
  94. import {
  95. l as l2
  96. } from "./chunk-JQUWFKNU.js";
  97. import "./chunk-RWQH5X3O.js";
  98. import "./chunk-6334AFGG.js";
  99. import {
  100. e as e4
  101. } from "./chunk-TFHLTN6F.js";
  102. import "./chunk-4VZNS7N2.js";
  103. import {
  104. M,
  105. f,
  106. h as h2,
  107. r as r2
  108. } from "./chunk-O3JQY77G.js";
  109. import "./chunk-E3G7BRZB.js";
  110. import {
  111. n as n3
  112. } from "./chunk-CFVLY6NB.js";
  113. import "./chunk-EDHROVWI.js";
  114. import "./chunk-3IRT3YKJ.js";
  115. import "./chunk-FM5OVTDI.js";
  116. import {
  117. g
  118. } from "./chunk-KJZ6SS3P.js";
  119. import "./chunk-OER54WCN.js";
  120. import "./chunk-HOCLACFL.js";
  121. import "./chunk-3MLCBRBA.js";
  122. import "./chunk-WTRZAXRY.js";
  123. import {
  124. e as e3
  125. } from "./chunk-EY2WJSAJ.js";
  126. import "./chunk-YMULPZCD.js";
  127. import {
  128. a,
  129. m
  130. } from "./chunk-4PNYPUDB.js";
  131. import "./chunk-RDMCXRET.js";
  132. import "./chunk-73AMYZFU.js";
  133. import "./chunk-NKMX5M3L.js";
  134. import "./chunk-PJNBFKPF.js";
  135. import "./chunk-C7742RNZ.js";
  136. import "./chunk-VLG7MMVR.js";
  137. import "./chunk-TV3CFJQR.js";
  138. import {
  139. h,
  140. l
  141. } from "./chunk-BWATQC2Y.js";
  142. import {
  143. j as j2
  144. } from "./chunk-6URCZZA6.js";
  145. import "./chunk-U2WD23Z5.js";
  146. import "./chunk-4ONPMX2F.js";
  147. import "./chunk-47NSA4T4.js";
  148. import "./chunk-FUODOQDM.js";
  149. import "./chunk-3WQOA5CB.js";
  150. import "./chunk-FZQZIM7U.js";
  151. import "./chunk-CZBRZ6SU.js";
  152. import "./chunk-VGWC3IKZ.js";
  153. import {
  154. u
  155. } from "./chunk-SWMSD4RP.js";
  156. import "./chunk-UKEN2UNL.js";
  157. import "./chunk-UVVU4UUO.js";
  158. import "./chunk-HWSWTWZD.js";
  159. import "./chunk-X4SA4ELJ.js";
  160. import "./chunk-XJCUT65M.js";
  161. import "./chunk-PE24J2I5.js";
  162. import "./chunk-P3XKUGLS.js";
  163. import "./chunk-U7RKABRB.js";
  164. import "./chunk-X7CNGECX.js";
  165. import "./chunk-PSEI52P3.js";
  166. import "./chunk-ZLNEXZAN.js";
  167. import "./chunk-5UVJ64RB.js";
  168. import "./chunk-AUOH2VSO.js";
  169. import "./chunk-ZYRIJWLX.js";
  170. import "./chunk-RYY6632W.js";
  171. import "./chunk-DW42UVIT.js";
  172. import "./chunk-TJNOJH33.js";
  173. import "./chunk-YAEIHDJH.js";
  174. import "./chunk-OSHI574D.js";
  175. import "./chunk-44GMIOGP.js";
  176. import "./chunk-75U5LM2V.js";
  177. import "./chunk-ZHRAUKVQ.js";
  178. import "./chunk-RZK6A2GY.js";
  179. import "./chunk-4NQ74ZR6.js";
  180. import "./chunk-X4LLOW7U.js";
  181. import "./chunk-BDA6VH2A.js";
  182. import {
  183. n as n2
  184. } from "./chunk-Z4JTBD7M.js";
  185. import "./chunk-MSBIHK67.js";
  186. import "./chunk-HZRKBTHJ.js";
  187. import {
  188. U
  189. } from "./chunk-5DMBXPN2.js";
  190. import "./chunk-QANZ6BFY.js";
  191. import {
  192. Bt
  193. } from "./chunk-VEGAOVMY.js";
  194. import "./chunk-CXCDYJ5R.js";
  195. import "./chunk-GAOW3WRZ.js";
  196. import {
  197. E as E2
  198. } from "./chunk-QCKFNSN2.js";
  199. import {
  200. e,
  201. n5 as n,
  202. y3 as y2
  203. } from "./chunk-6SOHRC7T.js";
  204. import "./chunk-U2XHEJM7.js";
  205. import "./chunk-SQOPWYIT.js";
  206. import "./chunk-6KZ2LTDA.js";
  207. import {
  208. D,
  209. E,
  210. b,
  211. j
  212. } from "./chunk-V6P2MAQQ.js";
  213. import {
  214. s2 as s
  215. } from "./chunk-E5O6P5I2.js";
  216. import {
  217. y
  218. } from "./chunk-SPWQ3AWG.js";
  219. import "./chunk-2TIUKVZN.js";
  220. import {
  221. e as e2,
  222. r,
  223. t
  224. } from "./chunk-YXWMMD76.js";
  225. import "./chunk-S5KM4IGW.js";
  226. // node_modules/@arcgis/core/views/2d/engine/vectorTiles/RectangleBinPack.js
  227. var e8 = class {
  228. constructor(e9, t9) {
  229. this._width = 0, this._height = 0, this._free = [], this._width = e9, this._height = t9, this._free.push(new t3(0, 0, e9, t9));
  230. }
  231. get width() {
  232. return this._width;
  233. }
  234. get height() {
  235. return this._height;
  236. }
  237. allocate(e9, t9) {
  238. if (e9 > this._width || t9 > this._height)
  239. return new t3();
  240. let i7 = null, s5 = -1;
  241. for (let h6 = 0; h6 < this._free.length; ++h6) {
  242. const w = this._free[h6];
  243. e9 <= w.width && t9 <= w.height && (null === i7 || w.y <= i7.y && w.x <= i7.x) && (i7 = w, s5 = h6);
  244. }
  245. return null === i7 ? new t3() : (this._free.splice(s5, 1), i7.width < i7.height ? (i7.width > e9 && this._free.push(new t3(i7.x + e9, i7.y, i7.width - e9, t9)), i7.height > t9 && this._free.push(new t3(i7.x, i7.y + t9, i7.width, i7.height - t9))) : (i7.width > e9 && this._free.push(new t3(i7.x + e9, i7.y, i7.width - e9, i7.height)), i7.height > t9 && this._free.push(new t3(i7.x, i7.y + t9, e9, i7.height - t9))), new t3(i7.x, i7.y, e9, t9));
  246. }
  247. release(h6) {
  248. for (let e9 = 0; e9 < this._free.length; ++e9) {
  249. const t9 = this._free[e9];
  250. if (t9.y === h6.y && t9.height === h6.height && t9.x + t9.width === h6.x)
  251. t9.width += h6.width;
  252. else if (t9.x === h6.x && t9.width === h6.width && t9.y + t9.height === h6.y)
  253. t9.height += h6.height;
  254. else if (h6.y === t9.y && h6.height === t9.height && h6.x + h6.width === t9.x)
  255. t9.x = h6.x, t9.width += h6.width;
  256. else {
  257. if (h6.x !== t9.x || h6.width !== t9.width || h6.y + h6.height !== t9.y)
  258. continue;
  259. t9.y = h6.y, t9.height += h6.height;
  260. }
  261. this._free.splice(e9, 1), this.release(h6);
  262. }
  263. this._free.push(h6);
  264. }
  265. };
  266. // node_modules/@arcgis/core/views/2d/engine/vectorTiles/GlyphMosaic.js
  267. var r7 = class {
  268. constructor(e9, i7, s5) {
  269. this.width = 0, this.height = 0, this._dirties = [], this._glyphData = [], this._currentPage = 0, this._glyphIndex = {}, this._textures = [], this._rangePromises = /* @__PURE__ */ new Map(), this.width = e9, this.height = i7, this._glyphSource = s5, this._binPack = new e8(e9 - 4, i7 - 4), this._glyphData.push(new Uint8Array(e9 * i7)), this._dirties.push(true), this._textures.push(void 0);
  270. }
  271. getGlyphItems(i7, s5) {
  272. const h6 = [], r11 = this._glyphSource, n11 = /* @__PURE__ */ new Set(), a8 = 1 / 256;
  273. for (const t9 of s5) {
  274. const e9 = Math.floor(t9 * a8);
  275. n11.add(e9);
  276. }
  277. const o3 = [];
  278. return n11.forEach((t9) => {
  279. if (t9 <= 256) {
  280. const e9 = i7 + t9;
  281. if (this._rangePromises.has(e9))
  282. o3.push(this._rangePromises.get(e9));
  283. else {
  284. const s6 = r11.getRange(i7, t9).then(() => {
  285. this._rangePromises.delete(e9);
  286. }, () => {
  287. this._rangePromises.delete(e9);
  288. });
  289. this._rangePromises.set(e9, s6), o3.push(s6);
  290. }
  291. }
  292. }), Promise.all(o3).then(() => {
  293. let n12 = this._glyphIndex[i7];
  294. n12 || (n12 = {}, this._glyphIndex[i7] = n12);
  295. for (const a9 of s5) {
  296. const s6 = n12[a9];
  297. if (s6) {
  298. h6[a9] = { sdf: true, rect: s6.rect, metrics: s6.metrics, page: s6.page, code: a9 };
  299. continue;
  300. }
  301. const o4 = r11.getGlyph(i7, a9);
  302. if (!o4 || !o4.metrics)
  303. continue;
  304. const l10 = o4.metrics;
  305. let c5;
  306. if (0 === l10.width)
  307. c5 = new t3(0, 0, 0, 0);
  308. else {
  309. const e9 = 3, i8 = l10.width + 2 * e9, s7 = l10.height + 2 * e9;
  310. let h7 = i8 % 4 ? 4 - i8 % 4 : 4, r12 = s7 % 4 ? 4 - s7 % 4 : 4;
  311. 1 === h7 && (h7 = 5), 1 === r12 && (r12 = 5), c5 = this._binPack.allocate(i8 + h7, s7 + r12), c5.isEmpty && (this._dirties[this._currentPage] || (this._glyphData[this._currentPage] = null), this._currentPage = this._glyphData.length, this._glyphData.push(new Uint8Array(this.width * this.height)), this._dirties.push(true), this._textures.push(void 0), this._binPack = new e8(this.width - 4, this.height - 4), c5 = this._binPack.allocate(i8 + h7, s7 + r12));
  312. const n13 = this._glyphData[this._currentPage], a10 = o4.bitmap;
  313. let g2, _4;
  314. if (a10)
  315. for (let t9 = 0; t9 < s7; t9++) {
  316. g2 = i8 * t9, _4 = this.width * (c5.y + t9 + 1) + c5.x;
  317. for (let t10 = 0; t10 < i8; t10++)
  318. n13[_4 + t10 + 1] = a10[g2 + t10];
  319. }
  320. }
  321. n12[a9] = { rect: c5, metrics: l10, tileIDs: null, page: this._currentPage }, h6[a9] = { sdf: true, rect: c5, metrics: l10, page: this._currentPage, code: a9 }, this._dirties[this._currentPage] = true;
  322. }
  323. return h6;
  324. });
  325. }
  326. removeGlyphs(t9) {
  327. for (const e9 in this._glyphIndex) {
  328. const i7 = this._glyphIndex[e9];
  329. if (!i7)
  330. continue;
  331. let s5;
  332. for (const e10 in i7)
  333. if (s5 = i7[e10], s5.tileIDs.delete(t9), 0 === s5.tileIDs.size) {
  334. const t10 = this._glyphData[s5.page], h6 = s5.rect;
  335. let r11, n11;
  336. for (let e11 = 0; e11 < h6.height; e11++)
  337. for (r11 = this.width * (h6.y + e11) + h6.x, n11 = 0; n11 < h6.width; n11++)
  338. t10[r11 + n11] = 0;
  339. delete i7[e10], this._dirties[s5.page] = true;
  340. }
  341. }
  342. }
  343. bind(t9, e9, r11, n11 = 0) {
  344. this._textures[r11] || (this._textures[r11] = new E4(t9, { pixelFormat: P.ALPHA, dataType: G.UNSIGNED_BYTE, width: this.width, height: this.height }, new Uint8Array(this.width * this.height)));
  345. const a8 = this._textures[r11];
  346. a8.setSamplingMode(e9), this._dirties[r11] && a8.setData(this._glyphData[r11]), t9.bindTexture(a8, n11), this._dirties[r11] = false;
  347. }
  348. dispose() {
  349. this._binPack = null;
  350. for (const t9 of this._textures)
  351. t9 && t9.dispose();
  352. this._textures.length = 0;
  353. }
  354. };
  355. // node_modules/@arcgis/core/views/2d/engine/vectorTiles/GlyphSource.js
  356. var s2 = class {
  357. constructor(e9) {
  358. if (this._metrics = [], this._bitmaps = [], e9)
  359. for (; e9.next(); )
  360. switch (e9.tag()) {
  361. case 1: {
  362. const t9 = e9.getMessage();
  363. for (; t9.next(); )
  364. switch (t9.tag()) {
  365. case 3: {
  366. const e10 = t9.getMessage();
  367. let s5, a8, r11, n11, i7, c5, g2;
  368. for (; e10.next(); )
  369. switch (e10.tag()) {
  370. case 1:
  371. s5 = e10.getUInt32();
  372. break;
  373. case 2:
  374. a8 = e10.getBytes();
  375. break;
  376. case 3:
  377. r11 = e10.getUInt32();
  378. break;
  379. case 4:
  380. n11 = e10.getUInt32();
  381. break;
  382. case 5:
  383. i7 = e10.getSInt32();
  384. break;
  385. case 6:
  386. c5 = e10.getSInt32();
  387. break;
  388. case 7:
  389. g2 = e10.getUInt32();
  390. break;
  391. default:
  392. e10.skip();
  393. }
  394. e10.release(), s5 && (this._metrics[s5] = { width: r11, height: n11, left: i7, top: c5, advance: g2 }, this._bitmaps[s5] = a8);
  395. break;
  396. }
  397. default:
  398. t9.skip();
  399. }
  400. t9.release();
  401. break;
  402. }
  403. default:
  404. e9.skip();
  405. }
  406. }
  407. getMetrics(e9) {
  408. return this._metrics[e9];
  409. }
  410. getBitmap(e9) {
  411. return this._bitmaps[e9];
  412. }
  413. };
  414. var a4 = class {
  415. constructor() {
  416. this._ranges = [];
  417. }
  418. getRange(e9) {
  419. return this._ranges[e9];
  420. }
  421. addRange(e9, t9) {
  422. this._ranges[e9] = t9;
  423. }
  424. };
  425. var r8 = class {
  426. constructor(e9) {
  427. this._glyphInfo = {}, this._baseURL = e9;
  428. }
  429. getRange(a8, r11) {
  430. const n11 = this._getFontStack(a8);
  431. if (n11.getRange(r11))
  432. return Promise.resolve();
  433. const i7 = 256 * r11, c5 = i7 + 255;
  434. if (this._baseURL) {
  435. const g2 = this._baseURL.replace("{fontstack}", a8).replace("{range}", i7 + "-" + c5);
  436. return U(g2, { responseType: "array-buffer" }).then((e9) => {
  437. n11.addRange(r11, new s2(new n3(new Uint8Array(e9.data), new DataView(e9.data))));
  438. }).catch(() => {
  439. n11.addRange(r11, new s2());
  440. });
  441. }
  442. return n11.addRange(r11, new s2()), Promise.resolve();
  443. }
  444. getGlyph(e9, t9) {
  445. const s5 = this._getFontStack(e9);
  446. if (!s5)
  447. return;
  448. const a8 = Math.floor(t9 / 256);
  449. if (a8 > 256)
  450. return;
  451. const r11 = s5.getRange(a8);
  452. return r11 ? { metrics: r11.getMetrics(t9), bitmap: r11.getBitmap(t9) } : void 0;
  453. }
  454. _getFontStack(e9) {
  455. let t9 = this._glyphInfo[e9];
  456. return t9 || (t9 = this._glyphInfo[e9] = new a4()), t9;
  457. }
  458. };
  459. // node_modules/@arcgis/core/views/2d/engine/vectorTiles/SpriteMosaic.js
  460. var o = "dasharray-";
  461. var n5 = class {
  462. constructor(t9, e9, s5 = 0) {
  463. this._size = [], this._mosaicsData = [], this._textures = [], this._dirties = [], this._maxItemSize = 0, this._currentPage = 0, this._pageWidth = 0, this._pageHeight = 0, this._mosaicRects = {}, this.pixelRatio = 1, (t9 <= 0 || e9 <= 0) && console.error("Sprites mosaic defaultWidth and defaultHeight must be greater than zero!"), this._pageWidth = t9, this._pageHeight = e9, s5 > 0 && (this._maxItemSize = s5), this._binPack = new e8(t9 - 4, e9 - 4);
  464. }
  465. dispose() {
  466. this._binPack = null, this._mosaicRects = {};
  467. for (const t9 of this._textures)
  468. t9 && t9.dispose();
  469. this._textures.length = 0;
  470. }
  471. getWidth(t9) {
  472. return t9 >= this._size.length ? -1 : this._size[t9][0];
  473. }
  474. getHeight(t9) {
  475. return t9 >= this._size.length ? -1 : this._size[t9][1];
  476. }
  477. getPageSize(t9) {
  478. return t9 >= this._size.length ? null : this._size[t9];
  479. }
  480. setSpriteSource(t9) {
  481. if (this.dispose(), this.pixelRatio = t9.devicePixelRatio, 0 === this._mosaicsData.length) {
  482. this._binPack = new e8(this._pageWidth - 4, this._pageHeight - 4);
  483. const t10 = Math.floor(this._pageWidth), e9 = Math.floor(this._pageHeight), s5 = new Uint32Array(t10 * e9);
  484. this._mosaicsData[0] = s5, this._dirties.push(true), this._size.push([this._pageWidth, this._pageHeight]), this._textures.push(void 0);
  485. }
  486. this._sprites = t9;
  487. }
  488. getSpriteItem(t9, i7 = false) {
  489. let e9, s5, h6 = this._mosaicRects[t9];
  490. if (h6)
  491. return h6;
  492. if (!this._sprites || "loaded" !== this._sprites.loadStatus)
  493. return null;
  494. if (t9 && t9.startsWith(o) ? ([e9, s5] = this._rasterizeDash(t9), i7 = true) : e9 = this._sprites.getSpriteInfo(t9), !e9 || !e9.width || !e9.height || e9.width < 0 || e9.height < 0)
  495. return null;
  496. const a8 = e9.width, r11 = e9.height, [n11, _4, g2] = this._allocateImage(a8, r11);
  497. return n11.width <= 0 ? null : (this._copy(n11, e9, _4, g2, i7, s5), h6 = { rect: n11, width: a8, height: r11, sdf: e9.sdf, simplePattern: false, pixelRatio: e9.pixelRatio, page: _4 }, this._mosaicRects[t9] = h6, h6);
  498. }
  499. getSpriteItems(t9) {
  500. const i7 = {};
  501. for (const e9 of t9)
  502. i7[e9.name] = this.getSpriteItem(e9.name, e9.repeat);
  503. return i7;
  504. }
  505. getMosaicItemPosition(t9, i7) {
  506. const e9 = this.getSpriteItem(t9, i7), s5 = e9 && e9.rect;
  507. if (!s5)
  508. return null;
  509. s5.width = e9.width, s5.height = e9.height;
  510. const h6 = e9.width, a8 = e9.height, r11 = 2;
  511. return { tl: [s5.x + r11, s5.y + r11], br: [s5.x + r11 + h6, s5.y + r11 + a8], page: e9.page };
  512. }
  513. bind(t9, i7, e9 = 0, o3 = 0) {
  514. if (e9 >= this._size.length || e9 >= this._mosaicsData.length)
  515. return;
  516. this._textures[e9] || (this._textures[e9] = new E4(t9, { pixelFormat: P.RGBA, dataType: G.UNSIGNED_BYTE, wrapMode: D2.CLAMP_TO_EDGE, width: this._size[e9][0], height: this._size[e9][1] }, new Uint8Array(this._mosaicsData[e9].buffer)));
  517. const n11 = this._textures[e9];
  518. n11.setSamplingMode(i7), this._dirties[e9] && n11.setData(new Uint8Array(this._mosaicsData[e9].buffer)), t9.bindTexture(n11, o3), this._dirties[e9] = false;
  519. }
  520. static _copyBits(t9, i7, e9, s5, h6, a8, r11, o3, n11, _4, g2) {
  521. let c5 = s5 * i7 + e9, l10 = o3 * a8 + r11;
  522. if (g2) {
  523. l10 -= a8;
  524. for (let r12 = -1; r12 <= _4; r12++, c5 = ((r12 + _4) % _4 + s5) * i7 + e9, l10 += a8)
  525. for (let i8 = -1; i8 <= n11; i8++)
  526. h6[l10 + i8] = t9[c5 + (i8 + n11) % n11];
  527. } else
  528. for (let p = 0; p < _4; p++) {
  529. for (let i8 = 0; i8 < n11; i8++)
  530. h6[l10 + i8] = t9[c5 + i8];
  531. c5 += i7, l10 += a8;
  532. }
  533. }
  534. _copy(t9, i7, e9, s5, h6, a8) {
  535. if (!this._sprites || "loaded" !== this._sprites.loadStatus || e9 >= this._mosaicsData.length)
  536. return;
  537. const r11 = new Uint32Array(a8 ? a8.buffer : this._sprites.image.buffer), o3 = this._mosaicsData[e9];
  538. o3 && r11 || console.error("Source or target images are uninitialized!");
  539. const _4 = 2, g2 = a8 ? i7.width : this._sprites.width;
  540. n5._copyBits(r11, g2, i7.x, i7.y, o3, s5[0], t9.x + _4, t9.y + _4, i7.width, i7.height, h6), this._dirties[e9] = true;
  541. }
  542. _allocateImage(t9, s5) {
  543. t9 += 2, s5 += 2;
  544. const h6 = Math.max(t9, s5);
  545. if (this._maxItemSize && this._maxItemSize < h6) {
  546. const i7 = new t3(0, 0, t9, s5);
  547. return this._mosaicsData.push(new Uint32Array(t9 * s5)), this._dirties.push(true), this._size.push([t9, s5]), this._textures.push(void 0), [i7, this._mosaicsData.length - 1, [t9, s5]];
  548. }
  549. let a8 = t9 % 4 ? 4 - t9 % 4 : 4, r11 = s5 % 4 ? 4 - s5 % 4 : 4;
  550. 1 === a8 && (a8 = 5), 1 === r11 && (r11 = 5);
  551. const o3 = this._binPack.allocate(t9 + a8, s5 + r11);
  552. return o3.width <= 0 ? (this._dirties[this._currentPage] || (this._mosaicsData[this._currentPage] = null), this._currentPage = this._mosaicsData.length, this._mosaicsData.push(new Uint32Array(this._pageWidth * this._pageHeight)), this._dirties.push(true), this._size.push([this._pageWidth, this._pageHeight]), this._textures.push(void 0), this._binPack = new e8(this._pageWidth - 4, this._pageHeight - 4), this._allocateImage(t9, s5)) : [o3, this._currentPage, [this._pageWidth, this._pageHeight]];
  553. }
  554. _rasterizeDash(i7) {
  555. const e9 = /\[(.*?)\]/, s5 = i7.match(e9);
  556. if (!s5)
  557. return null;
  558. const h6 = s5[1].split(",").map(Number), a8 = i7.slice(i7.lastIndexOf("-") + 1), [r11, o3, n11] = e7(h6, a8);
  559. return [{ x: 0, y: 0, width: o3, height: n11, sdf: true, pixelRatio: 1 }, new Uint8Array(r11.buffer)];
  560. }
  561. };
  562. // node_modules/@arcgis/core/views/2d/engine/vectorTiles/TileHandler.js
  563. var n6 = class {
  564. constructor(e9, t9, s5) {
  565. this._layer = e9, this._styleRepository = t9, this.devicePixelRatio = s5, this._spriteMosaic = null, this._glyphMosaic = null, this._connection = null;
  566. }
  567. destroy() {
  568. this._connection && (this._connection.close(), this._connection = null), this._styleRepository = null, this._layer = null, this._spriteMosaic && (this._spriteMosaic = null), this._glyphMosaic && (this._glyphMosaic = null);
  569. }
  570. get spriteMosaic() {
  571. return this._spriteSourcePromise.then(() => this._spriteMosaic);
  572. }
  573. get glyphMosaic() {
  574. return this._glyphMosaic;
  575. }
  576. async start(t9) {
  577. this._spriteSourcePromise = this._layer.loadSpriteSource(this.devicePixelRatio, t9), this._spriteSourcePromise.then((e9) => {
  578. this._spriteMosaic = new n5(1024, 1024, 250), this._spriteMosaic.setSpriteSource(e9);
  579. });
  580. const s5 = new r8(this._layer.currentStyleInfo.glyphsUrl ? Bt(this._layer.currentStyleInfo.glyphsUrl, { ...this._layer.customParameters, token: this._layer.apiKey }) : null);
  581. this._glyphMosaic = new r7(1024, 1024, s5), this._broadcastPromise = u2("WorkerTileHandler", { client: this, schedule: t9.schedule, signal: t9.signal }).then((s6) => {
  582. if (this._connection = s6, this._layer && !this._connection.closed) {
  583. const r11 = s6.broadcast("setStyle", this._layer.currentStyleInfo.style, t9);
  584. Promise.all(r11).catch((t10) => b(t10));
  585. }
  586. });
  587. }
  588. async updateStyle(e9) {
  589. return await this._broadcastPromise, this._broadcastPromise = Promise.all(this._connection.broadcast("updateStyle", e9)), this._broadcastPromise;
  590. }
  591. setSpriteSource(e9) {
  592. const t9 = new n5(1024, 1024, 250);
  593. return t9.setSpriteSource(e9), this._spriteMosaic = t9, this._spriteSourcePromise = Promise.resolve(e9), t9;
  594. }
  595. async setStyle(e9, t9) {
  596. await this._broadcastPromise, this._styleRepository = e9, this._spriteSourcePromise = this._layer.loadSpriteSource(this.devicePixelRatio, null), this._spriteSourcePromise.then((e10) => {
  597. this._spriteMosaic = new n5(1024, 1024, 250), this._spriteMosaic.setSpriteSource(e10);
  598. });
  599. const s5 = new r8(this._layer.currentStyleInfo.glyphsUrl ? Bt(this._layer.currentStyleInfo.glyphsUrl, { ...this._layer.customParameters, token: this._layer.apiKey }) : null);
  600. return this._glyphMosaic = new r7(1024, 1024, s5), this._broadcastPromise = Promise.all(this._connection.broadcast("setStyle", t9)), this._broadcastPromise;
  601. }
  602. fetchTileData(e9, t9) {
  603. return this._getRefKeys(e9, t9).then((e10) => {
  604. const s5 = this._layer.sourceNameToSource, r11 = [];
  605. for (const t10 in s5)
  606. r11.push(t10);
  607. return this._getSourcesData(r11, e10, t9);
  608. });
  609. }
  610. parseTileData(e9, t9) {
  611. const s5 = e9 && e9.data;
  612. if (!s5)
  613. return Promise.resolve(null);
  614. const { sourceName2DataAndRefKey: r11, transferList: i7 } = s5;
  615. return 0 === Object.keys(r11).length ? Promise.resolve(null) : this._broadcastPromise.then(() => this._connection.invoke("createTileAndParse", { key: e9.key.id, sourceName2DataAndRefKey: r11, styleLayerUIDs: e9.styleLayerUIDs }, { ...t9, transferList: i7 }));
  616. }
  617. async getSprites(e9) {
  618. return await this._spriteSourcePromise, this._spriteMosaic.getSpriteItems(e9);
  619. }
  620. getGlyphs(e9) {
  621. return this._glyphMosaic.getGlyphItems(e9.font, e9.codePoints);
  622. }
  623. async _getTilePayload(e9, s5, r11) {
  624. const i7 = e4.pool.acquire(e9.id), o3 = this._layer.sourceNameToSource[s5], { level: a8, row: l10, col: n11 } = i7;
  625. e4.pool.release(i7);
  626. try {
  627. return { protobuff: await o3.requestTile(a8, l10, n11, r11), sourceName: s5 };
  628. } catch (h6) {
  629. if (j(h6))
  630. throw h6;
  631. return { protobuff: null, sourceName: s5 };
  632. }
  633. }
  634. _getRefKeys(e9, t9) {
  635. const r11 = this._layer.sourceNameToSource, i7 = new Array();
  636. for (const s5 in r11) {
  637. const o3 = r11[s5].getRefKey(e9, t9);
  638. i7.push(o3);
  639. }
  640. return E(i7);
  641. }
  642. _getSourcesData(e9, t9, r11) {
  643. const i7 = [];
  644. for (let s5 = 0; s5 < t9.length; s5++)
  645. if (null == t9[s5].value || null == e9[s5])
  646. i7.push(null);
  647. else {
  648. const o3 = this._getTilePayload(t9[s5].value, e9[s5], r11);
  649. i7.push(o3);
  650. }
  651. return E(i7).then((e10) => {
  652. const s5 = {}, r12 = [];
  653. for (let i8 = 0; i8 < e10.length; i8++)
  654. if (e10[i8].value && e10[i8].value && e10[i8].value.protobuff && e10[i8].value.protobuff.byteLength > 0) {
  655. const o3 = t9[i8].value.id;
  656. s5[e10[i8].value.sourceName] = { refKey: o3, protobuff: e10[i8].value.protobuff }, r12.push(e10[i8].value.protobuff);
  657. }
  658. return { sourceName2DataAndRefKey: s5, transferList: r12 };
  659. });
  660. }
  661. };
  662. // node_modules/@arcgis/core/views/2d/engine/vectorTiles/TileManager.js
  663. var r9 = 512;
  664. var o2 = 1e-6;
  665. var n7 = (e9, i7) => e9 + 1 / (1 << 2 * i7);
  666. var a5 = class {
  667. constructor(i7, t9) {
  668. this._tiles = /* @__PURE__ */ new Map(), this._tileCache = new e3(40, (e9) => e9.dispose()), this._viewSize = [0, 0], this._visibleTiles = /* @__PURE__ */ new Map(), this.acquireTile = i7.acquireTile, this.releaseTile = i7.releaseTile, this.tileInfoView = i7.tileInfoView, this._container = t9;
  669. }
  670. destroy() {
  671. for (const [e9, i7] of this._tiles)
  672. i7.dispose();
  673. this._tiles = null, this._tileCache.clear(), this._tileCache = null;
  674. }
  675. update(e9) {
  676. this._updateCacheSize(e9);
  677. const i7 = this.tileInfoView, t9 = i7.getTileCoverage(e9.state, 0, "smallest"), { spans: r11, lodInfo: o3 } = t9, { level: n11 } = o3, a8 = this._tiles, c5 = /* @__PURE__ */ new Set(), h6 = /* @__PURE__ */ new Set();
  678. for (const { row: s5, colFrom: _4, colTo: f3 } of r11)
  679. for (let e10 = _4; e10 <= f3; e10++) {
  680. const i8 = e4.getId(n11, s5, o3.normalizeCol(e10), o3.getWorldForColumn(e10)), t10 = this._getOrAcquireTile(i8);
  681. c5.add(i8), t10.processed() ? this._addToContainer(t10) : h6.add(new e4(i8));
  682. }
  683. for (const [s5, l10] of a8)
  684. l10.isCoverage = c5.has(s5);
  685. for (const s5 of h6)
  686. this._findPlaceholdersForMissingTiles(s5, c5);
  687. let d2 = false;
  688. for (const [s5, l10] of a8)
  689. l10.neededForCoverage = c5.has(s5), l10.neededForCoverage || l10.isHoldingForFade && i7.intersects(t9, l10.key) && c5.add(s5), l10.isFading && (d2 = true);
  690. for (const [s5, l10] of this._tiles)
  691. c5.has(s5) || this._releaseTile(s5);
  692. return l2.pool.release(t9), !d2;
  693. }
  694. clear() {
  695. this._tiles.clear(), this._tileCache.clear(), this._visibleTiles.clear();
  696. }
  697. clearCache() {
  698. this._tileCache.clear();
  699. }
  700. _findPlaceholdersForMissingTiles(e9, i7) {
  701. const t9 = [];
  702. for (const [l10, r11] of this._tiles)
  703. this._addPlaceholderChild(t9, r11, e9, i7);
  704. const s5 = t9.reduce(n7, 0);
  705. Math.abs(1 - s5) < o2 || this._addPlaceholderParent(e9.id, i7);
  706. }
  707. _addPlaceholderChild(e9, i7, t9, s5) {
  708. i7.key.level <= t9.level || !i7.hasData() || h4(t9, i7.key) && (this._addToContainer(i7), s5.add(i7.id), e9.push(i7.key.level - t9.level));
  709. }
  710. _addPlaceholderParent(e9, i7) {
  711. const t9 = this._tiles;
  712. let s5 = e9;
  713. for (; ; ) {
  714. if (s5 = c2(s5), !s5 || i7.has(s5))
  715. return;
  716. const e10 = t9.get(s5);
  717. if (e10 && e10.hasData())
  718. return this._addToContainer(e10), void i7.add(e10.id);
  719. }
  720. }
  721. _getOrAcquireTile(e9) {
  722. let i7 = this._tiles.get(e9);
  723. return i7 || (i7 = this._tileCache.pop(e9), i7 || (i7 = this.acquireTile(new e4(e9))), this._tiles.set(e9, i7), i7);
  724. }
  725. _releaseTile(e9) {
  726. const i7 = this._tiles.get(e9);
  727. this.releaseTile(i7), this._removeFromContainer(i7), this._tiles.delete(e9), i7.hasData() ? this._tileCache.put(e9, i7, 1) : i7.dispose();
  728. }
  729. _addToContainer(e9) {
  730. let s5;
  731. const l10 = [], r11 = this._container;
  732. if (r11.contains(e9))
  733. return;
  734. const o3 = this._visibleTiles;
  735. for (const [t9, n11] of o3)
  736. this._canConnectDirectly(e9, n11) && l10.push(n11), t(s5) && this._canConnectDirectly(n11, e9) && (s5 = n11);
  737. if (r(s5)) {
  738. for (const i7 of l10)
  739. s5.childrenTiles.delete(i7), e9.childrenTiles.add(i7), i7.parentTile = e9;
  740. s5.childrenTiles.add(e9), e9.parentTile = s5;
  741. } else
  742. for (const i7 of l10)
  743. e9.childrenTiles.add(i7), i7.parentTile = e9;
  744. o3.set(e9.id, e9), r11.addChild(e9);
  745. }
  746. _removeFromContainer(e9) {
  747. if (this._visibleTiles.delete(e9.id), this._container.removeChild(e9), r(e9.parentTile)) {
  748. e9.parentTile.childrenTiles.delete(e9);
  749. for (const i7 of e9.childrenTiles)
  750. r(e9.parentTile) && e9.parentTile.childrenTiles.add(i7);
  751. }
  752. for (const i7 of e9.childrenTiles)
  753. i7.parentTile = e9.parentTile;
  754. e9.parentTile = null, e9.childrenTiles.clear();
  755. }
  756. _canConnectDirectly(e9, i7) {
  757. const t9 = e9.key;
  758. let { level: s5, row: l10, col: r11, world: o3 } = i7.key;
  759. const n11 = this._visibleTiles;
  760. for (; s5 > 0; ) {
  761. if (s5--, l10 >>= 1, r11 >>= 1, t9.level === s5 && t9.row === l10 && t9.col === r11 && t9.world === o3)
  762. return true;
  763. if (n11.has(`${s5}/${l10}/${r11}/${o3}`))
  764. return false;
  765. }
  766. return false;
  767. }
  768. _updateCacheSize(e9) {
  769. const i7 = e9.state.size;
  770. if (i7[0] === this._viewSize[0] && i7[1] === this._viewSize[1])
  771. return;
  772. const t9 = Math.ceil(i7[0] / r9) + 1, s5 = Math.ceil(i7[1] / r9) + 1;
  773. this._viewSize[0] = i7[0], this._viewSize[1] = i7[1], this._tileCache.maxSize = 5 * t9 * s5;
  774. }
  775. };
  776. function c2(e9) {
  777. const [i7, t9, s5, l10] = e9.split("/"), r11 = parseInt(i7, 10);
  778. return 0 === r11 ? null : `${r11 - 1}/${parseInt(t9, 10) >> 1}/${parseInt(s5, 10) >> 1}/${parseInt(l10, 10)}`;
  779. }
  780. function h4(e9, i7) {
  781. const t9 = i7.level - e9.level;
  782. return e9.row === i7.row >> t9 && e9.col === i7.col >> t9 && e9.world === i7.world;
  783. }
  784. // node_modules/@arcgis/core/views/2d/engine/vectorTiles/decluttering/core.js
  785. var t5 = class {
  786. constructor(t9) {
  787. this.xTile = 0, this.yTile = 0, this.hash = 0, this.priority = 1, this.colliders = [], this.textVertexRanges = [], this.iconVertexRanges = [], this.tile = t9;
  788. }
  789. };
  790. var s3 = class {
  791. constructor() {
  792. this.tileSymbols = [], this.parts = [{ startTime: 0, startOpacity: 0, targetOpacity: 0, show: false }, { startTime: 0, startOpacity: 0, targetOpacity: 0, show: false }], this.show = false;
  793. }
  794. };
  795. // node_modules/@arcgis/core/views/2d/engine/vectorTiles/decluttering/util.js
  796. function l5(t9, e9, s5, o3, r11, l10) {
  797. const i7 = s5 - r11;
  798. if (i7 >= 0)
  799. return (e9 >> i7) + (o3 - (l10 << i7)) * (t9 >> i7);
  800. const n11 = -i7;
  801. return e9 - (l10 - (o3 << n11)) * (t9 >> n11) << n11;
  802. }
  803. var i3 = class {
  804. constructor(t9, e9, s5) {
  805. this._rows = Math.ceil(e9 / s5), this._columns = Math.ceil(t9 / s5), this._cellSize = s5, this.cells = new Array(this._rows);
  806. for (let o3 = 0; o3 < this._rows; o3++) {
  807. this.cells[o3] = new Array(this._columns);
  808. for (let t10 = 0; t10 < this._columns; t10++)
  809. this.cells[o3][t10] = [];
  810. }
  811. }
  812. getCell(t9, e9) {
  813. const s5 = Math.min(Math.max(Math.floor(e9 / this._cellSize), 0), this._rows - 1), o3 = Math.min(Math.max(Math.floor(t9 / this._cellSize), 0), this._columns - 1);
  814. return this.cells[s5] && this.cells[s5][o3] || null;
  815. }
  816. getCellSpan(t9, e9, s5, o3) {
  817. return [Math.min(Math.max(Math.floor(t9 / this._cellSize), 0), this.columns - 1), Math.min(Math.max(Math.floor(e9 / this._cellSize), 0), this.rows - 1), Math.min(Math.max(Math.floor(s5 / this._cellSize), 0), this.columns - 1), Math.min(Math.max(Math.floor(o3 / this._cellSize), 0), this.rows - 1)];
  818. }
  819. get cellSize() {
  820. return this._cellSize;
  821. }
  822. get columns() {
  823. return this._columns;
  824. }
  825. get rows() {
  826. return this._rows;
  827. }
  828. };
  829. function n8(t9, e9, o3, r11, l10, i7) {
  830. const n11 = e9[r11++];
  831. for (let c5 = 0; c5 < n11; c5++) {
  832. const n12 = new t5(i7);
  833. n12.xTile = e9[r11++], n12.yTile = e9[r11++], n12.hash = e9[r11++], n12.priority = e9[r11++];
  834. const c6 = e9[r11++];
  835. for (let t10 = 0; t10 < c6; t10++) {
  836. const t11 = e9[r11++], s5 = e9[r11++], l11 = e9[r11++], i8 = e9[r11++], c7 = !!e9[r11++], a9 = e9[r11++], h7 = o3[r11++], d2 = o3[r11++], f3 = e9[r11++], u7 = e9[r11++];
  837. n12.colliders.push({ xTile: t11, yTile: s5, dxPixels: l11, dyPixels: i8, hard: c7, partIndex: a9, width: f3, height: u7, minLod: h7, maxLod: d2 });
  838. }
  839. const a8 = t9[r11++];
  840. for (let e10 = 0; e10 < a8; e10++)
  841. n12.textVertexRanges.push([t9[r11++], t9[r11++]]);
  842. const h6 = t9[r11++];
  843. for (let e10 = 0; e10 < h6; e10++)
  844. n12.iconVertexRanges.push([t9[r11++], t9[r11++]]);
  845. l10.push(n12);
  846. }
  847. return r11;
  848. }
  849. function c3(t9, e9, s5) {
  850. for (const [o3, r11] of t9.symbols)
  851. a6(t9, e9, s5, r11, o3);
  852. }
  853. function a6(t9, s5, o3, r11, l10) {
  854. const i7 = t9.layerData.get(l10);
  855. if (i7.type === I3.SYMBOL) {
  856. for (const e9 of r11) {
  857. const s6 = e9.unique;
  858. let r12;
  859. if (e9.selectedForRendering) {
  860. const e10 = s6.parts[0], l11 = e10.startOpacity, i8 = e10.targetOpacity;
  861. t9.allSymbolsFadingOut = t9.allSymbolsFadingOut && 0 === i8;
  862. const n11 = o3 ? Math.floor(127 * l11) | i8 << 7 : i8 ? 255 : 0;
  863. r12 = n11 << 24 | n11 << 16 | n11 << 8 | n11;
  864. } else
  865. r12 = 0;
  866. for (const [t10, o4] of e9.iconVertexRanges)
  867. for (let e10 = t10; e10 < t10 + o4; e10 += 4)
  868. i7.iconOpacity[e10 / 4] = r12;
  869. if (e9.selectedForRendering) {
  870. const e10 = s6.parts[1], l11 = e10.startOpacity, i8 = e10.targetOpacity;
  871. t9.allSymbolsFadingOut = t9.allSymbolsFadingOut && 0 === i8;
  872. const n11 = o3 ? Math.floor(127 * l11) | i8 << 7 : i8 ? 255 : 0;
  873. r12 = n11 << 24 | n11 << 16 | n11 << 8 | n11;
  874. } else
  875. r12 = 0;
  876. for (const [t10, o4] of e9.textVertexRanges)
  877. for (let e10 = t10; e10 < t10 + o4; e10 += 4)
  878. i7.textOpacity[e10 / 4] = r12;
  879. }
  880. i7.lastOpacityUpdate = s5, i7.opacityChanged = true;
  881. }
  882. }
  883. // node_modules/@arcgis/core/views/2d/engine/vectorTiles/RenderBucket.js
  884. var a7 = class {
  885. constructor(e9, t9) {
  886. this.layerUIDs = [], this.isDestroyed = false, this._data = e9, this.memoryUsed = e9.byteLength;
  887. let r11 = 1;
  888. const i7 = new Uint32Array(e9);
  889. this.layerUIDs = [];
  890. const s5 = i7[r11++];
  891. for (let n11 = 0; n11 < s5; n11++)
  892. this.layerUIDs[n11] = i7[r11++];
  893. this.bufferDataOffset = r11, t9 && (this.layer = t9.getStyleLayerByUID(this.layerUIDs[0]));
  894. }
  895. get isPreparedForRendering() {
  896. return t(this._data);
  897. }
  898. get offset() {
  899. return this.bufferDataOffset;
  900. }
  901. destroy() {
  902. this.isDestroyed || (this.doDestroy(), this.isDestroyed = true);
  903. }
  904. prepareForRendering(t9) {
  905. t(this._data) || (this.doPrepareForRendering(t9, this._data, this.bufferDataOffset), this._data = null);
  906. }
  907. };
  908. var l6 = class extends a7 {
  909. constructor(e9, t9) {
  910. super(e9, t9), this.type = I3.LINE, this.lineIndexStart = 0, this.lineIndexCount = 0;
  911. const r11 = new Uint32Array(e9);
  912. let s5 = this.bufferDataOffset;
  913. this.lineIndexStart = r11[s5++], this.lineIndexCount = r11[s5++];
  914. const n11 = r11[s5++];
  915. if (n11 > 0) {
  916. const e10 = /* @__PURE__ */ new Map();
  917. for (let t10 = 0; t10 < n11; t10++) {
  918. const t11 = r11[s5++], i7 = r11[s5++], n12 = r11[s5++];
  919. e10.set(t11, [i7, n12]);
  920. }
  921. this.patternMap = e10;
  922. }
  923. this.bufferDataOffset = s5;
  924. }
  925. hasData() {
  926. return this.lineIndexCount > 0;
  927. }
  928. triangleCount() {
  929. return this.lineIndexCount / 3;
  930. }
  931. doDestroy() {
  932. r(this.lineVertexArrayObject) && this.lineVertexArrayObject.dispose(), r(this.lineVertexBuffer) && this.lineVertexBuffer.dispose(), r(this.lineIndexBuffer) && this.lineIndexBuffer.dispose(), this.lineVertexArrayObject = null, this.lineVertexBuffer = null, this.lineIndexBuffer = null, this.memoryUsed = 0;
  933. }
  934. doPrepareForRendering(e9, t9, r11) {
  935. const i7 = new Uint32Array(t9), s5 = new Int32Array(i7.buffer), a8 = i7[r11++];
  936. this.lineVertexBuffer = E5.createVertex(e9, F.STATIC_DRAW, new Int32Array(s5.buffer, 4 * r11, a8)), r11 += a8;
  937. const l10 = i7[r11++];
  938. this.lineIndexBuffer = E5.createIndex(e9, F.STATIC_DRAW, new Uint32Array(i7.buffer, 4 * r11, l10)), r11 += l10;
  939. const u7 = this.layer.lineMaterial;
  940. this.lineVertexArrayObject = new a3(e9, u7.getAttributeLocations(), u7.getLayoutInfo(), { geometry: this.lineVertexBuffer }, this.lineIndexBuffer);
  941. }
  942. };
  943. var u4 = class extends a7 {
  944. constructor(e9, t9) {
  945. super(e9, t9), this.type = I3.FILL, this.fillIndexStart = 0, this.fillIndexCount = 0, this.outlineIndexStart = 0, this.outlineIndexCount = 0;
  946. const r11 = new Uint32Array(e9);
  947. let s5 = this.bufferDataOffset;
  948. this.fillIndexStart = r11[s5++], this.fillIndexCount = r11[s5++], this.outlineIndexStart = r11[s5++], this.outlineIndexCount = r11[s5++];
  949. const n11 = r11[s5++];
  950. if (n11 > 0) {
  951. const e10 = /* @__PURE__ */ new Map();
  952. for (let t10 = 0; t10 < n11; t10++) {
  953. const t11 = r11[s5++], i7 = r11[s5++], n12 = r11[s5++];
  954. e10.set(t11, [i7, n12]);
  955. }
  956. this.patternMap = e10;
  957. }
  958. this.bufferDataOffset = s5;
  959. }
  960. hasData() {
  961. return this.fillIndexCount > 0 || this.outlineIndexCount > 0;
  962. }
  963. triangleCount() {
  964. return (this.fillIndexCount + this.outlineIndexCount) / 3;
  965. }
  966. doDestroy() {
  967. r(this.fillVertexArrayObject) && this.fillVertexArrayObject.dispose(), r(this.fillVertexBuffer) && this.fillVertexBuffer.dispose(), r(this.fillIndexBuffer) && this.fillIndexBuffer.dispose(), this.fillVertexArrayObject = null, this.fillVertexBuffer = null, this.fillIndexBuffer = null, r(this.outlineVertexArrayObject) && this.outlineVertexArrayObject.dispose(), r(this.outlineVertexBuffer) && this.outlineVertexBuffer.dispose(), r(this.outlineIndexBuffer) && this.outlineIndexBuffer.dispose(), this.outlineVertexArrayObject = null, this.outlineVertexBuffer = null, this.outlineIndexBuffer = null, this.memoryUsed = 0;
  968. }
  969. doPrepareForRendering(e9, t9, r11) {
  970. const i7 = new Uint32Array(t9), s5 = new Int32Array(i7.buffer), a8 = i7[r11++];
  971. this.fillVertexBuffer = E5.createVertex(e9, F.STATIC_DRAW, new Int32Array(s5.buffer, 4 * r11, a8)), r11 += a8;
  972. const l10 = i7[r11++];
  973. this.fillIndexBuffer = E5.createIndex(e9, F.STATIC_DRAW, new Uint32Array(i7.buffer, 4 * r11, l10)), r11 += l10;
  974. const u7 = i7[r11++];
  975. this.outlineVertexBuffer = E5.createVertex(e9, F.STATIC_DRAW, new Int32Array(s5.buffer, 4 * r11, u7)), r11 += u7;
  976. const h6 = i7[r11++];
  977. this.outlineIndexBuffer = E5.createIndex(e9, F.STATIC_DRAW, new Uint32Array(i7.buffer, 4 * r11, h6)), r11 += h6;
  978. const c5 = this.layer, x = c5.fillMaterial, y5 = c5.outlineMaterial;
  979. this.fillVertexArrayObject = new a3(e9, x.getAttributeLocations(), x.getLayoutInfo(), { geometry: this.fillVertexBuffer }, this.fillIndexBuffer), this.outlineVertexArrayObject = new a3(e9, y5.getAttributeLocations(), y5.getLayoutInfo(), { geometry: this.outlineVertexBuffer }, this.outlineIndexBuffer);
  980. }
  981. };
  982. var h5 = class extends a7 {
  983. constructor(e9, t9, r11) {
  984. super(e9, t9), this.type = I3.SYMBOL, this.iconPerPageElementsMap = /* @__PURE__ */ new Map(), this.glyphPerPageElementsMap = /* @__PURE__ */ new Map(), this.symbolInstances = [], this.isIconSDF = false, this.opacityChanged = false, this.lastOpacityUpdate = 0, this.symbols = [];
  985. const n11 = new Uint32Array(e9), f3 = new Int32Array(e9), o3 = new Float32Array(e9);
  986. let a8 = this.bufferDataOffset;
  987. this.isIconSDF = !!n11[a8++];
  988. const l10 = n11[a8++];
  989. for (let i7 = 0; i7 < l10; i7++) {
  990. const e10 = n11[a8++], t10 = n11[a8++], r12 = n11[a8++];
  991. this.iconPerPageElementsMap.set(e10, [t10, r12]);
  992. }
  993. const u7 = n11[a8++];
  994. for (let i7 = 0; i7 < u7; i7++) {
  995. const e10 = n11[a8++], t10 = n11[a8++], r12 = n11[a8++];
  996. this.glyphPerPageElementsMap.set(e10, [t10, r12]);
  997. }
  998. const h6 = n11[a8++], c5 = n11[a8++];
  999. this.iconOpacity = new Int32Array(h6), this.textOpacity = new Int32Array(c5), a8 = n8(n11, f3, o3, a8, this.symbols, r11), this.bufferDataOffset = a8;
  1000. }
  1001. hasData() {
  1002. return this.iconPerPageElementsMap.size > 0 || this.glyphPerPageElementsMap.size > 0;
  1003. }
  1004. triangleCount() {
  1005. let e9 = 0;
  1006. for (const [t9, r11] of this.iconPerPageElementsMap)
  1007. e9 += r11[1];
  1008. for (const [t9, r11] of this.glyphPerPageElementsMap)
  1009. e9 += r11[1];
  1010. return e9 / 3;
  1011. }
  1012. doDestroy() {
  1013. r(this.iconVertexArrayObject) && this.iconVertexArrayObject.dispose(), r(this.iconVertexBuffer) && this.iconVertexBuffer.dispose(), r(this.iconOpacityBuffer) && this.iconOpacityBuffer.dispose(), r(this.iconIndexBuffer) && this.iconIndexBuffer.dispose(), this.iconVertexArrayObject = null, this.iconVertexBuffer = null, this.iconOpacityBuffer = null, this.iconIndexBuffer = null, r(this.textVertexArrayObject) && this.textVertexArrayObject.dispose(), r(this.textVertexBuffer) && this.textVertexBuffer.dispose(), r(this.textOpacityBuffer) && this.textOpacityBuffer.dispose(), r(this.textIndexBuffer) && this.textIndexBuffer.dispose(), this.textVertexArrayObject = null, this.textVertexBuffer = null, this.textOpacityBuffer = null, this.textIndexBuffer = null, this.memoryUsed = 0;
  1014. }
  1015. updateOpacityInfo() {
  1016. if (!this.opacityChanged)
  1017. return;
  1018. this.opacityChanged = false;
  1019. const e9 = e2(this.iconOpacity), t9 = e2(this.iconOpacityBuffer);
  1020. e9.length > 0 && e9.byteLength === t9.size && t9.setSubData(e9, 0, 0, e9.length);
  1021. const i7 = e2(this.textOpacity), s5 = e2(this.textOpacityBuffer);
  1022. i7.length > 0 && i7.byteLength === s5.size && s5.setSubData(i7, 0, 0, i7.length);
  1023. }
  1024. doPrepareForRendering(e9, t9, i7) {
  1025. const s5 = new Uint32Array(t9), a8 = new Int32Array(s5.buffer), l10 = s5[i7++];
  1026. this.iconVertexBuffer = E5.createVertex(e9, F.STATIC_DRAW, new Int32Array(a8.buffer, 4 * i7, l10)), i7 += l10;
  1027. const u7 = s5[i7++];
  1028. this.iconIndexBuffer = E5.createIndex(e9, F.STATIC_DRAW, new Uint32Array(s5.buffer, 4 * i7, u7)), i7 += u7;
  1029. const h6 = s5[i7++];
  1030. this.textVertexBuffer = E5.createVertex(e9, F.STATIC_DRAW, new Int32Array(a8.buffer, 4 * i7, h6)), i7 += h6;
  1031. const c5 = s5[i7++];
  1032. this.textIndexBuffer = E5.createIndex(e9, F.STATIC_DRAW, new Uint32Array(s5.buffer, 4 * i7, c5)), i7 += c5, this.iconOpacityBuffer = E5.createVertex(e9, F.STATIC_DRAW, e2(this.iconOpacity).buffer), this.textOpacityBuffer = E5.createVertex(e9, F.STATIC_DRAW, e2(this.textOpacity).buffer);
  1033. const x = this.layer, y5 = x.iconMaterial, d2 = x.textMaterial;
  1034. this.iconVertexArrayObject = new a3(e9, y5.getAttributeLocations(), y5.getLayoutInfo(), { geometry: this.iconVertexBuffer, opacity: this.iconOpacityBuffer }, this.iconIndexBuffer), this.textVertexArrayObject = new a3(e9, d2.getAttributeLocations(), d2.getLayoutInfo(), { geometry: this.textVertexBuffer, opacity: this.textOpacityBuffer }, this.textIndexBuffer);
  1035. }
  1036. };
  1037. var c4 = class extends a7 {
  1038. constructor(e9, t9) {
  1039. super(e9, t9), this.type = I3.CIRCLE, this.circleIndexStart = 0, this.circleIndexCount = 0;
  1040. const r11 = new Uint32Array(e9);
  1041. let s5 = this.bufferDataOffset;
  1042. this.circleIndexStart = r11[s5++], this.circleIndexCount = r11[s5++], this.bufferDataOffset = s5;
  1043. }
  1044. hasData() {
  1045. return this.circleIndexCount > 0;
  1046. }
  1047. triangleCount() {
  1048. return this.circleIndexCount / 3;
  1049. }
  1050. doDestroy() {
  1051. r(this.circleVertexArrayObject) && this.circleVertexArrayObject.dispose(), r(this.circleVertexBuffer) && this.circleVertexBuffer.dispose(), r(this.circleIndexBuffer) && this.circleIndexBuffer.dispose(), this.circleVertexArrayObject = null, this.circleVertexBuffer = null, this.circleIndexBuffer = null, this.memoryUsed = 0;
  1052. }
  1053. doPrepareForRendering(e9, t9, r11) {
  1054. const i7 = new Uint32Array(t9), s5 = new Int32Array(i7.buffer), a8 = i7[r11++];
  1055. this.circleVertexBuffer = E5.createVertex(e9, F.STATIC_DRAW, new Int32Array(s5.buffer, 4 * r11, a8)), r11 += a8;
  1056. const l10 = i7[r11++];
  1057. this.circleIndexBuffer = E5.createIndex(e9, F.STATIC_DRAW, new Uint32Array(i7.buffer, 4 * r11, l10)), r11 += l10;
  1058. const u7 = this.layer.circleMaterial;
  1059. this.circleVertexArrayObject = new a3(e9, u7.getAttributeLocations(), u7.getLayoutInfo(), { geometry: this.circleVertexBuffer }, this.circleIndexBuffer);
  1060. }
  1061. };
  1062. // node_modules/@arcgis/core/views/2d/engine/vectorTiles/VectorTile.js
  1063. var m2 = class extends r6 {
  1064. constructor(e9, t9, s5, a8, r11, i7, o3, h6 = null) {
  1065. super(e9, t9, s5, a8, r11, i7, 4096, 4096), this._memCache = h6, this.type = "vector-tile", this._referenced = 0, this._hasSymbolBuckets = false, this._memoryUsedByLayerData = 0, this.layerData = /* @__PURE__ */ new Map(), this.layerCount = 0, this.status = "loading", this.allSymbolsFadingOut = false, this.lastOpacityUpdate = 0, this.symbols = /* @__PURE__ */ new Map(), this.isCoverage = false, this.neededForCoverage = false, this.decluttered = false, this.invalidating = false, this.parentTile = null, this.childrenTiles = /* @__PURE__ */ new Set(), this._processed = false, this._referenced = 1, this.styleRepository = o3, this.id = e9.id;
  1066. }
  1067. get hasSymbolBuckets() {
  1068. return this._hasSymbolBuckets;
  1069. }
  1070. get isFading() {
  1071. return this._hasSymbolBuckets && performance.now() - this.lastOpacityUpdate < e5;
  1072. }
  1073. get isHoldingForFade() {
  1074. return this._hasSymbolBuckets && (!this.allSymbolsFadingOut || performance.now() - this.lastOpacityUpdate < e5);
  1075. }
  1076. get wasRequested() {
  1077. return "errored" === this.status || "loaded" === this.status || "reloading" === this.status;
  1078. }
  1079. setData(e9) {
  1080. this.changeDataImpl(e9), this.requestRender(), this.ready(), this.invalidating = false, this._processed = true;
  1081. }
  1082. deleteLayerData(t9) {
  1083. let s5 = false;
  1084. for (const e9 of t9)
  1085. if (this.layerData.has(e9)) {
  1086. const t10 = this.layerData.get(e9);
  1087. this._memoryUsedByLayerData -= t10.memoryUsed, t10.type === I3.SYMBOL && this.symbols.has(e9) && (this.symbols.delete(e9), s5 = true), t10.destroy(), this.layerData.delete(e9), this.layerCount--;
  1088. }
  1089. r(this._memCache) && this._memCache.updateSize(this.key.id, this, this._memoryUsedByLayerData), s5 && this.emit("symbols-changed"), this.requestRender();
  1090. }
  1091. processed() {
  1092. return this._processed;
  1093. }
  1094. hasData() {
  1095. return this.layerCount > 0;
  1096. }
  1097. dispose() {
  1098. "unloaded" !== this.status && (u5.delete(this), m2._destroyRenderBuckets(this.layerData), this.layerData = null, this.layerCount = 0, this._memoryUsedByLayerData = 0, this.destroy(), this.status = "unloaded");
  1099. }
  1100. release() {
  1101. return 0 == --this._referenced && (this.dispose(), this.stage = null, true);
  1102. }
  1103. retain() {
  1104. ++this._referenced;
  1105. }
  1106. get referenced() {
  1107. return this._referenced;
  1108. }
  1109. get memoryUsage() {
  1110. return (this._memoryUsedByLayerData + 256) / (this._referenced || 1);
  1111. }
  1112. changeDataImpl(t9) {
  1113. let s5 = false;
  1114. if (t9) {
  1115. const { bucketsWithData: a8, emptyBuckets: r11 } = t9, i7 = this._createRenderBuckets(a8);
  1116. if (r11 && r11.byteLength > 0) {
  1117. const e9 = new Uint32Array(r11);
  1118. for (const t10 of e9)
  1119. this._deleteLayerData(t10);
  1120. }
  1121. for (const [e9, t10] of i7)
  1122. this._deleteLayerData(e9), t10.type === I3.SYMBOL && (this.symbols.set(e9, t10.symbols), s5 = true), this._memoryUsedByLayerData += t10.memoryUsed, this.layerData.set(e9, t10), this.layerCount++;
  1123. r(this._memCache) && this._memCache.updateSize(this.key.id, this, this._memoryUsedByLayerData);
  1124. }
  1125. this._hasSymbolBuckets = false;
  1126. for (const [e9, a8] of this.layerData)
  1127. a8.type === I3.SYMBOL && (this._hasSymbolBuckets = true);
  1128. s5 && this.emit("symbols-changed");
  1129. }
  1130. attachWithContext(e9) {
  1131. this.stage = { context: e9, trashDisplayObject(e10) {
  1132. e10.processDetach();
  1133. }, untrashDisplayObject: () => false };
  1134. }
  1135. setTransform(e9) {
  1136. super.setTransform(e9);
  1137. const i7 = this.resolution / (e9.resolution * e9.pixelRatio), o3 = this.width / this.rangeX * i7, h6 = this.height / this.rangeY * i7, n11 = [0, 0];
  1138. e9.toScreen(n11, [this.x, this.y]);
  1139. const l10 = this.transforms.tileUnitsToPixels;
  1140. r2(l10), M(l10, l10, n11), h2(l10, l10, Math.PI * e9.rotation / 180), f(l10, l10, [o3, h6, 1]);
  1141. }
  1142. _createTransforms() {
  1143. return { dvs: e6(), tileMat3: e6(), tileUnitsToPixels: e6() };
  1144. }
  1145. static _destroyRenderBuckets(e9) {
  1146. if (!e9)
  1147. return;
  1148. const t9 = /* @__PURE__ */ new Set();
  1149. e9.forEach((e10) => {
  1150. t9.has(e10) || (e10.destroy(), t9.add(e10));
  1151. }), e9.clear();
  1152. }
  1153. _createRenderBuckets(e9) {
  1154. const t9 = /* @__PURE__ */ new Map(), s5 = /* @__PURE__ */ new Map();
  1155. for (const a8 of e9) {
  1156. const e10 = this._deserializeBucket(a8, s5);
  1157. for (const s6 of e10.layerUIDs)
  1158. t9.set(s6, e10);
  1159. }
  1160. return t9;
  1161. }
  1162. _deserializeBucket(e9, t9) {
  1163. let s5 = t9.get(e9);
  1164. if (s5)
  1165. return s5;
  1166. switch (new Uint32Array(e9)[0]) {
  1167. case I3.FILL:
  1168. s5 = new u4(e9, this.styleRepository);
  1169. break;
  1170. case I3.LINE:
  1171. s5 = new l6(e9, this.styleRepository);
  1172. break;
  1173. case I3.SYMBOL:
  1174. s5 = new h5(e9, this.styleRepository, this);
  1175. break;
  1176. case I3.CIRCLE:
  1177. s5 = new c4(e9, this.styleRepository);
  1178. }
  1179. return t9.set(e9, s5), s5;
  1180. }
  1181. _deleteLayerData(e9) {
  1182. if (!this.layerData.has(e9))
  1183. return;
  1184. const t9 = this.layerData.get(e9);
  1185. this._memoryUsedByLayerData -= t9.memoryUsed, t9.destroy(), this.layerData.delete(e9), this.layerCount--;
  1186. }
  1187. };
  1188. var u5 = /* @__PURE__ */ new Map();
  1189. // node_modules/@arcgis/core/views/2d/engine/vectorTiles/decluttering/jobs.js
  1190. function i4(e9, t9, n11, o3, i7, l10) {
  1191. const { iconRotationAlignment: a8, textRotationAlignment: c5, iconTranslate: h6, iconTranslateAnchor: u7, textTranslate: d2, textTranslateAnchor: y5 } = o3;
  1192. let x = 0;
  1193. for (const g2 of e9.colliders) {
  1194. const [e10, o4] = 0 === g2.partIndex ? h6 : d2, m4 = 0 === g2.partIndex ? u7 : y5, f3 = g2.minLod <= l10 && l10 <= g2.maxLod;
  1195. x += f3 ? 0 : 1, g2.enabled = f3, g2.xScreen = g2.xTile * i7[0] + g2.yTile * i7[3] + i7[6], g2.yScreen = g2.xTile * i7[1] + g2.yTile * i7[4] + i7[7], m4 === r3.MAP ? (g2.xScreen += n11 * e10 - t9 * o4, g2.yScreen += t9 * e10 + n11 * o4) : (g2.xScreen += e10, g2.yScreen += o4), l3.VIEWPORT === (0 === g2.partIndex ? a8 : c5) ? (g2.dxScreen = g2.dxPixels, g2.dyScreen = g2.dyPixels) : (g2.dxScreen = n11 * (g2.dxPixels + g2.width / 2) - t9 * (g2.dyPixels + g2.height / 2) - g2.width / 2, g2.dyScreen = t9 * (g2.dxPixels + g2.width / 2) + n11 * (g2.dyPixels + g2.height / 2) - g2.height / 2);
  1196. }
  1197. e9.colliders.length > 0 && x === e9.colliders.length && (e9.unique.show = false);
  1198. }
  1199. var l7 = class {
  1200. constructor(o3, r11, s5, i7, l10, a8) {
  1201. this._symbols = o3, this._styleRepository = i7, this._zoom = l10, this._currentLayerCursor = 0, this._currentSymbolCursor = 0, this._styleProps = /* @__PURE__ */ new Map(), this._allNeededMatrices = /* @__PURE__ */ new Map(), this._gridIndex = new i3(r11, s5, t4), this._si = Math.sin(Math.PI * a8 / 180), this._co = Math.cos(Math.PI * a8 / 180);
  1202. for (const t9 of o3)
  1203. for (const n11 of t9.symbols)
  1204. this._allNeededMatrices.has(n11.tile) || this._allNeededMatrices.set(n11.tile, r4(n11.tile.transforms.tileUnitsToPixels));
  1205. }
  1206. work(e9) {
  1207. const t9 = this._gridIndex;
  1208. function n11(e10) {
  1209. const n12 = e10.xScreen + e10.dxScreen, o4 = e10.yScreen + e10.dyScreen, r11 = n12 + e10.width, s5 = o4 + e10.height, [i7, l10, a8, c5] = t9.getCellSpan(n12, o4, r11, s5);
  1210. for (let h6 = l10; h6 <= c5; h6++)
  1211. for (let e11 = i7; e11 <= a8; e11++) {
  1212. const i8 = t9.cells[h6][e11];
  1213. for (const e12 of i8) {
  1214. const t10 = e12.xScreen + e12.dxScreen, i9 = e12.yScreen + e12.dyScreen, l11 = t10 + e12.width, a9 = i9 + e12.height;
  1215. if (!(r11 < t10 || n12 > l11 || s5 < i9 || o4 > a9))
  1216. return true;
  1217. }
  1218. }
  1219. return false;
  1220. }
  1221. const o3 = performance.now();
  1222. for (; this._currentLayerCursor < this._symbols.length; this._currentLayerCursor++, this._currentSymbolCursor = 0) {
  1223. const t10 = this._symbols[this._currentLayerCursor], r11 = this._getProperties(t10.styleLayerUID);
  1224. for (; this._currentSymbolCursor < t10.symbols.length; this._currentSymbolCursor++) {
  1225. if (this._currentSymbolCursor % 100 == 99 && performance.now() - o3 > e9)
  1226. return false;
  1227. const s5 = t10.symbols[this._currentSymbolCursor];
  1228. if (!s5.unique.show)
  1229. continue;
  1230. i4(s5, this._si, this._co, r11, this._allNeededMatrices.get(s5.tile), this._zoom);
  1231. const l10 = s5.unique;
  1232. if (!l10.show)
  1233. continue;
  1234. const { iconAllowOverlap: a8, iconIgnorePlacement: c5, textAllowOverlap: h6, textIgnorePlacement: u7 } = r11;
  1235. for (const e10 of s5.colliders) {
  1236. if (!e10.enabled)
  1237. continue;
  1238. const t11 = l10.parts[e10.partIndex];
  1239. if (!t11.show)
  1240. continue;
  1241. !(e10.partIndex ? h6 : a8) && n11(e10) && (e10.hard ? l10.show = false : t11.show = false);
  1242. }
  1243. if (l10.show)
  1244. for (const e10 of s5.colliders) {
  1245. if (!e10.enabled)
  1246. continue;
  1247. if (e10.partIndex ? u7 : c5)
  1248. continue;
  1249. if (!l10.parts[e10.partIndex].show)
  1250. continue;
  1251. const t11 = e10.xScreen + e10.dxScreen, n12 = e10.yScreen + e10.dyScreen, o4 = t11 + e10.width, r12 = n12 + e10.height, [s6, i7, a9, h7] = this._gridIndex.getCellSpan(t11, n12, o4, r12);
  1252. for (let l11 = i7; l11 <= h7; l11++)
  1253. for (let t12 = s6; t12 <= a9; t12++) {
  1254. this._gridIndex.cells[l11][t12].push(e10);
  1255. }
  1256. }
  1257. }
  1258. }
  1259. return true;
  1260. }
  1261. _getProperties(e9) {
  1262. const t9 = this._styleProps.get(e9);
  1263. if (t9)
  1264. return t9;
  1265. const n11 = this._zoom, s5 = this._styleRepository.getStyleLayerByUID(e9), i7 = s5.getLayoutValue("symbol-placement", n11) !== n4.POINT;
  1266. let l10 = s5.getLayoutValue("icon-rotation-alignment", n11);
  1267. l10 === l3.AUTO && (l10 = i7 ? l3.MAP : l3.VIEWPORT);
  1268. let a8 = s5.getLayoutValue("text-rotation-alignment", n11);
  1269. a8 === l3.AUTO && (a8 = i7 ? l3.MAP : l3.VIEWPORT);
  1270. const c5 = s5.getPaintValue("icon-translate", n11), h6 = s5.getPaintValue("icon-translate-anchor", n11), u7 = s5.getPaintValue("text-translate", n11), d2 = s5.getPaintValue("text-translate-anchor", n11), y5 = { iconAllowOverlap: s5.getLayoutValue("icon-allow-overlap", n11), iconIgnorePlacement: s5.getLayoutValue("icon-ignore-placement", n11), textAllowOverlap: s5.getLayoutValue("text-allow-overlap", n11), textIgnorePlacement: s5.getLayoutValue("text-ignore-placement", n11), iconRotationAlignment: l10, textRotationAlignment: a8, iconTranslateAnchor: h6, iconTranslate: c5, textTranslateAnchor: d2, textTranslate: u7 };
  1271. return this._styleProps.set(e9, y5), y5;
  1272. }
  1273. };
  1274. // node_modules/@arcgis/core/views/2d/engine/vectorTiles/decluttering/SymbolDeclutterer.js
  1275. function t6(o3, e9) {
  1276. if (o3.priority - e9.priority)
  1277. return o3.priority - e9.priority;
  1278. const t9 = o3.tile.key, i7 = e9.tile.key;
  1279. return t9.world - i7.world ? t9.world - i7.world : t9.level - i7.level ? t9.level - i7.level : t9.row - i7.row ? t9.row - i7.row : t9.col - i7.col ? t9.col - i7.col : o3.xTile - e9.xTile ? o3.xTile - e9.xTile : o3.yTile - e9.yTile;
  1280. }
  1281. var i5 = class {
  1282. constructor(o3, e9, t9, i7, s5, r11) {
  1283. this._visibleTiles = o3, this._symbolRepository = e9, this._createCollisionJob = t9, this._assignTileSymbolsOpacity = i7, this._symbolLayerSorter = s5, this._isLayerVisible = r11, this._selectionJob = null, this._selectionJobCompleted = false, this._collisionJob = null, this._collisionJobCompleted = false, this._opacityJob = null, this._opacityJobCompleted = false, this._running = true;
  1284. }
  1285. get running() {
  1286. return this._running;
  1287. }
  1288. setScreenSize(o3, e9) {
  1289. this._screenWidth === o3 && this._screenHeight === e9 || this.restart(), this._screenWidth = o3, this._screenHeight = e9;
  1290. }
  1291. restart() {
  1292. this._selectionJob = null, this._selectionJobCompleted = false, this._collisionJob = null, this._collisionJobCompleted = false, this._opacityJob = null, this._opacityJobCompleted = false, this._running = true;
  1293. }
  1294. continue(o3) {
  1295. if (this._selectionJob || (this._selectionJob = this._createSelectionJob()), !this._selectionJobCompleted) {
  1296. const e9 = performance.now();
  1297. if (!this._selectionJob.work(o3))
  1298. return false;
  1299. if (this._selectionJobCompleted = true, 0 === (o3 = Math.max(0, o3 - (performance.now() - e9))))
  1300. return false;
  1301. }
  1302. if (this._collisionJob || (this._collisionJob = this._createCollisionJob(this._selectionJob.sortedSymbols, this._screenWidth, this._screenHeight)), !this._collisionJobCompleted) {
  1303. const e9 = performance.now();
  1304. if (!this._collisionJob.work(o3))
  1305. return false;
  1306. if (this._collisionJobCompleted = true, 0 === (o3 = Math.max(0, o3 - (performance.now() - e9))))
  1307. return false;
  1308. }
  1309. if (this._opacityJob || (this._opacityJob = this._createOpacityJob()), !this._opacityJobCompleted) {
  1310. const e9 = performance.now();
  1311. if (!this._opacityJob.work(o3))
  1312. return false;
  1313. if (this._opacityJobCompleted = true, 0 === (o3 = Math.max(0, o3 - (performance.now() - e9))))
  1314. return false;
  1315. }
  1316. return this._running = false, true;
  1317. }
  1318. _createSelectionJob() {
  1319. const o3 = this._symbolRepository.uniqueSymbols;
  1320. for (let t9 = 0; t9 < o3.length; t9++) {
  1321. const e10 = o3[t9];
  1322. for (let o4 = 0; o4 < e10.uniqueSymbols.length; o4++) {
  1323. const t10 = e10.uniqueSymbols[o4];
  1324. for (const o5 of t10.tileSymbols)
  1325. o5.selectedForRendering = false;
  1326. }
  1327. }
  1328. const e9 = [];
  1329. let i7 = 0, s5 = 0;
  1330. const r11 = this._isLayerVisible;
  1331. function n11(n12) {
  1332. let l11;
  1333. const c5 = performance.now();
  1334. for (; s5 < o3.length; s5++, i7 = 0) {
  1335. const t9 = o3[s5], h6 = t9.styleLayerUID;
  1336. if (!r11(h6)) {
  1337. e9[s5] || (e9[s5] = { styleLayerUID: h6, symbols: [] });
  1338. continue;
  1339. }
  1340. e9[s5] = e9[s5] || { styleLayerUID: h6, symbols: [] };
  1341. const a8 = e9[s5];
  1342. for (; i7 < t9.uniqueSymbols.length; i7++) {
  1343. if (l11 = t9.uniqueSymbols[i7], i7 % 100 == 99 && performance.now() - c5 > n12)
  1344. return false;
  1345. let o4 = null, e10 = false, s6 = false;
  1346. for (const t10 of l11.tileSymbols)
  1347. if (!s6 || !e10) {
  1348. const i8 = t10.tile;
  1349. (!o4 || i8.isCoverage || i8.neededForCoverage && !e10) && (o4 = t10, (i8.neededForCoverage || i8.isCoverage) && (s6 = true), i8.isCoverage && (e10 = true));
  1350. }
  1351. if (o4.selectedForRendering = true, s6) {
  1352. a8.symbols.push(o4), l11.show = true;
  1353. for (const o5 of l11.parts)
  1354. o5.show = true;
  1355. } else
  1356. l11.show = false;
  1357. }
  1358. }
  1359. for (const o4 of e9)
  1360. o4.symbols.sort(t6);
  1361. return true;
  1362. }
  1363. const l10 = this._symbolLayerSorter;
  1364. return { work: n11, get sortedSymbols() {
  1365. return e9.sort(l10);
  1366. } };
  1367. }
  1368. _createOpacityJob() {
  1369. const e9 = this._assignTileSymbolsOpacity, t9 = this._visibleTiles;
  1370. let i7 = 0;
  1371. function r11(o3, t10) {
  1372. const i8 = o3.symbols;
  1373. for (const [e10, r12] of i8)
  1374. s4(r12, t10);
  1375. e9(o3, t10);
  1376. for (const e10 of o3.childrenTiles)
  1377. r11(e10, t10);
  1378. }
  1379. return { work(e10) {
  1380. const s5 = performance.now();
  1381. for (; i7 < t9.length; i7++) {
  1382. if (performance.now() - s5 > e10)
  1383. return false;
  1384. const n11 = t9[i7];
  1385. if (r(n11.parentTile))
  1386. continue;
  1387. r11(n11, performance.now());
  1388. }
  1389. return true;
  1390. } };
  1391. }
  1392. };
  1393. function s4(o3, t9) {
  1394. for (const i7 of o3) {
  1395. const o4 = i7.unique;
  1396. for (const i8 of o4.parts) {
  1397. const s5 = i8.targetOpacity > 0.5 ? 1 : -1;
  1398. i8.startOpacity += s5 * ((t9 - i8.startTime) / e5), i8.startOpacity = Math.min(Math.max(i8.startOpacity, 0), 1), i8.startTime = t9, i8.targetOpacity = o4.show && i8.show ? 1 : 0;
  1399. }
  1400. }
  1401. }
  1402. // node_modules/@arcgis/core/views/2d/engine/vectorTiles/decluttering/SymbolRepository.js
  1403. var l8 = 32;
  1404. var i6 = 8;
  1405. var n9 = 64;
  1406. var r10 = class {
  1407. constructor(e9, s5, o3) {
  1408. this.tileCoordRange = e9, this._visibleTiles = s5, this._createUnique = o3, this._tiles = /* @__PURE__ */ new Map(), this._uniqueSymbolsReferences = /* @__PURE__ */ new Map();
  1409. }
  1410. get uniqueSymbols() {
  1411. return t(this._uniqueSymbolLayerArray) && (this._uniqueSymbolLayerArray = this._createUniqueSymbolLayerArray()), this._uniqueSymbolLayerArray;
  1412. }
  1413. add(e9, s5) {
  1414. this._uniqueSymbolLayerArray = null;
  1415. let t9 = this._tiles.get(e9.id);
  1416. t9 || (t9 = { symbols: /* @__PURE__ */ new Map() }, this._tiles.set(e9.id, t9));
  1417. const r11 = /* @__PURE__ */ new Map();
  1418. if (s5)
  1419. for (const o3 of s5)
  1420. t9.symbols.has(o3) && (r11.set(o3, t9.symbols.get(o3)), t9.symbols.delete(o3));
  1421. else
  1422. for (const [o3, l10] of e9.layerData)
  1423. t9.symbols.has(o3) && (r11.set(o3, t9.symbols.get(o3)), t9.symbols.delete(o3));
  1424. this._removeSymbols(r11);
  1425. const y5 = e9.symbols, a8 = /* @__PURE__ */ new Map();
  1426. for (const [f3, c5] of y5) {
  1427. let e10 = c5.length;
  1428. if (e10 >= l8) {
  1429. let s6 = this.tileCoordRange;
  1430. do {
  1431. s6 /= 2, e10 /= 4;
  1432. } while (e10 > i6 && s6 > n9);
  1433. const l10 = new i3(this.tileCoordRange, this.tileCoordRange, s6);
  1434. a8.set(f3, { flat: c5, index: l10 }), t9.symbols.set(f3, { flat: c5, index: l10 });
  1435. for (const e11 of c5)
  1436. l10.getCell(e11.xTile, e11.yTile).push(e11);
  1437. } else
  1438. a8.set(f3, { flat: c5 }), t9.symbols.set(f3, { flat: c5 });
  1439. }
  1440. this._addSymbols(e9.key, y5);
  1441. }
  1442. deleteStyleLayers(e9) {
  1443. this._uniqueSymbolLayerArray = null;
  1444. for (const [s5, o3] of this._tiles) {
  1445. const t9 = /* @__PURE__ */ new Map();
  1446. for (const s6 of e9)
  1447. o3.symbols.has(s6) && (t9.set(s6, o3.symbols.get(s6)), o3.symbols.delete(s6));
  1448. this._removeSymbols(t9), 0 === o3.symbols.size && this._tiles.delete(s5);
  1449. }
  1450. }
  1451. removeTile(e9) {
  1452. this._uniqueSymbolLayerArray = null;
  1453. const s5 = this._tiles.get(e9.id);
  1454. if (!s5)
  1455. return;
  1456. const o3 = /* @__PURE__ */ new Map();
  1457. for (const [t9, l10] of e9.symbols)
  1458. s5.symbols.has(t9) && (o3.set(t9, s5.symbols.get(t9)), s5.symbols.delete(t9));
  1459. this._removeSymbols(o3), 0 === s5.symbols.size && this._tiles.delete(e9.id);
  1460. }
  1461. _removeSymbols(e9) {
  1462. for (const [s5, { flat: o3 }] of e9)
  1463. for (const e10 of o3) {
  1464. const o4 = e10.unique, t9 = o4.tileSymbols, l10 = t9.length - 1;
  1465. for (let s6 = 0; s6 < l10; s6++)
  1466. if (t9[s6] === e10) {
  1467. t9[s6] = t9[l10];
  1468. break;
  1469. }
  1470. if (t9.length = l10, 0 === l10) {
  1471. const e11 = this._uniqueSymbolsReferences.get(s5);
  1472. e11.delete(o4), 0 === e11.size && this._uniqueSymbolsReferences.delete(s5);
  1473. }
  1474. e10.unique = null;
  1475. }
  1476. }
  1477. _addSymbols(s5, o3) {
  1478. if (0 === o3.size)
  1479. return;
  1480. const t9 = this._visibleTiles;
  1481. for (const e9 of t9)
  1482. e9.parentTile || e9.key.world !== s5.world || e9.key.level === s5.level && !e9.key.equals(s5) || this._matchSymbols(e9, s5, o3);
  1483. for (const [l10, i7] of o3)
  1484. for (const s6 of i7)
  1485. if (t(s6.unique)) {
  1486. const e9 = this._createUnique();
  1487. s6.unique = e9, e9.tileSymbols.push(s6);
  1488. let o4 = this._uniqueSymbolsReferences.get(l10);
  1489. o4 || (o4 = /* @__PURE__ */ new Set(), this._uniqueSymbolsReferences.set(l10, o4)), o4.add(e9);
  1490. }
  1491. }
  1492. _matchSymbols(e9, o3, l10) {
  1493. if (e9.key.level > o3.level) {
  1494. const s5 = e9.key.level - o3.level;
  1495. if (e9.key.row >> s5 !== o3.row || e9.key.col >> s5 !== o3.col)
  1496. return;
  1497. }
  1498. if (o3.level > e9.key.level) {
  1499. const s5 = o3.level - e9.key.level;
  1500. if (o3.row >> s5 !== e9.key.row || o3.col >> s5 !== e9.key.col)
  1501. return;
  1502. }
  1503. if (o3.equals(e9.key)) {
  1504. for (const s5 of e9.childrenTiles)
  1505. this._matchSymbols(s5, o3, l10);
  1506. return;
  1507. }
  1508. const i7 = /* @__PURE__ */ new Map();
  1509. for (const [n11, r11] of l10) {
  1510. const l11 = [];
  1511. for (const s5 of r11) {
  1512. const i8 = l5(this.tileCoordRange, s5.xTile, o3.level, o3.col, e9.key.level, e9.key.col), n12 = l5(this.tileCoordRange, s5.yTile, o3.level, o3.row, e9.key.level, e9.key.row);
  1513. i8 >= 0 && i8 < this.tileCoordRange && n12 >= 0 && n12 < this.tileCoordRange && l11.push({ symbol: s5, xTransformed: i8, yTransformed: n12 });
  1514. }
  1515. const y5 = [], a8 = e9.key.level < o3.level ? 1 : 1 << e9.key.level - o3.level, f3 = this._tiles.get(e9.id).symbols.get(n11);
  1516. if (f3) {
  1517. const e10 = f3.flat;
  1518. for (const o4 of l11) {
  1519. let t9, l12 = false;
  1520. const i8 = o4.xTransformed, n12 = o4.yTransformed;
  1521. t9 = r(f3.index) ? f3.index.getCell(i8, n12) : e10;
  1522. const r12 = o4.symbol, c5 = r12.hash;
  1523. for (const e11 of t9)
  1524. if (c5 === e11.hash && Math.abs(i8 - e11.xTile) <= a8 && Math.abs(n12 - e11.yTile) <= a8) {
  1525. const s5 = e11.unique;
  1526. r12.unique = s5, s5.tileSymbols.push(r12), l12 = true;
  1527. break;
  1528. }
  1529. l12 || y5.push(r12);
  1530. }
  1531. }
  1532. y5.length > 0 && i7.set(n11, y5);
  1533. }
  1534. for (const s5 of e9.childrenTiles)
  1535. this._matchSymbols(s5, o3, i7);
  1536. }
  1537. _createUniqueSymbolLayerArray() {
  1538. const e9 = this._uniqueSymbolsReferences, s5 = new Array(e9.size);
  1539. let o3, t9 = 0;
  1540. for (const [l10, i7] of e9) {
  1541. const e10 = new Array(i7.size);
  1542. o3 = 0;
  1543. for (const s6 of i7)
  1544. e10[o3++] = s6;
  1545. s5[t9] = { styleLayerUID: l10, uniqueSymbols: e10 }, t9++;
  1546. }
  1547. return s5;
  1548. }
  1549. };
  1550. // node_modules/@arcgis/core/views/2d/engine/vectorTiles/decluttering/SymbolFader.js
  1551. var n10 = 0.5;
  1552. var _ = 1e-6;
  1553. var m3 = class extends n2 {
  1554. constructor(t9, e9) {
  1555. super(), this.styleRepository = t9, this._tileToHandle = /* @__PURE__ */ new Map(), this._viewState = { scale: 0, rotation: 0, center: [0, 0], size: [0, 0] }, this._declutterViewState = { scale: 0, rotation: 0, center: [0, 0], size: [0, 0] }, this._completed = false, this._symbolRepository = new r10(4096, e9, () => new s3()), this._symbolDeclutterer = new i5(e9, this._symbolRepository, (t10, e10, i7) => new l7(t10, e10, i7, this.styleRepository, this._zoom, this._viewState.rotation), (t10, e10) => {
  1556. t10.allSymbolsFadingOut = true, t10.lastOpacityUpdate = e10, c3(t10, e10, true), t10.decluttered = true, t10.requestRender();
  1557. }, (t10, e10) => this.styleRepository.getStyleLayerByUID(t10.styleLayerUID).z - this.styleRepository.getStyleLayerByUID(e10.styleLayerUID).z, (t10) => {
  1558. const e10 = this.styleRepository.getStyleLayerByUID(t10);
  1559. if (this._zoom + _ < e10.minzoom || this._zoom - _ >= e10.maxzoom)
  1560. return false;
  1561. const i7 = e10.getLayoutProperty("visibility");
  1562. return !i7 || i7.getValue() !== i.NONE;
  1563. });
  1564. }
  1565. addTile(t9) {
  1566. t9.decluttered = false, this._tileToHandle.set(t9, t9.on("symbols-changed", () => {
  1567. this._symbolRepository.add(t9), this.restartDeclutter();
  1568. })), this._symbolRepository.add(t9), this.restartDeclutter();
  1569. }
  1570. removeTile(t9) {
  1571. const e9 = this._tileToHandle.get(t9);
  1572. e9 && (this._symbolRepository.removeTile(t9), this.restartDeclutter(), e9.remove(), this._tileToHandle.delete(t9));
  1573. }
  1574. update(t9, e9) {
  1575. return this._zoom = t9, this._viewState = { scale: e9.scale, rotation: e9.rotation, center: [e9.center[0], e9.center[1]], size: [e9.size[0], e9.size[1]] }, this._continueDeclutter(), this._completed;
  1576. }
  1577. restartDeclutter() {
  1578. this._completed = false, this._symbolDeclutterer.restart(), this._notifyUnstable();
  1579. }
  1580. clear() {
  1581. this._completed = false, this._symbolRepository = null, this._symbolDeclutterer.restart(), this._tileToHandle.forEach((t9) => t9.remove()), this._tileToHandle.clear();
  1582. }
  1583. get stale() {
  1584. return this._zoom !== this._declutterZoom || this._viewState.size[0] !== this._declutterViewState.size[0] || this._viewState.size[1] !== this._declutterViewState.size[1] || this._viewState.scale !== this._declutterViewState.scale || this._viewState.rotation !== this._declutterViewState.rotation;
  1585. }
  1586. deleteStyleLayers(t9) {
  1587. this._symbolRepository.deleteStyleLayers(t9);
  1588. }
  1589. _continueDeclutter() {
  1590. this._completed && !this.stale || (this._symbolDeclutterer.running || (this._declutterZoom = this._zoom, this._declutterViewState.center[0] = this._viewState.center[0], this._declutterViewState.center[1] = this._viewState.center[1], this._declutterViewState.rotation = this._viewState.rotation, this._declutterViewState.scale = this._viewState.scale, this._declutterViewState.size[0] = this._viewState.size[0], this._declutterViewState.size[1] = this._viewState.size[1], this._symbolDeclutterer.restart()), this._symbolDeclutterer.setScreenSize(this._viewState.size[0], this._viewState.size[1]), this._completed = this._symbolDeclutterer.continue(c), this._completed && this._scheduleNotifyStable());
  1591. }
  1592. _scheduleNotifyStable() {
  1593. r(this._stableNotificationHandle) && clearTimeout(this._stableNotificationHandle), this._stableNotificationHandle = setTimeout(() => {
  1594. this._stableNotificationHandle = null, this.emit("fade-complete");
  1595. }, (1 + n10) * e5);
  1596. }
  1597. _notifyUnstable() {
  1598. r(this._stableNotificationHandle) && (clearTimeout(this._stableNotificationHandle), this._stableNotificationHandle = null), this.emit("fade-start");
  1599. }
  1600. };
  1601. // node_modules/@arcgis/core/views/2d/engine/webgl/RenderableTile.js
  1602. var t7 = class extends r6 {
  1603. _createTransforms() {
  1604. return { dvs: e6(), tileMat3: e6() };
  1605. }
  1606. };
  1607. // node_modules/@arcgis/core/views/2d/engine/vectorTiles/VectorTileContainer.js
  1608. var _2 = 1e-6;
  1609. function f2(e9, t9) {
  1610. if (e9) {
  1611. const s5 = e9.getLayoutProperty("visibility");
  1612. if (!s5 || s5.getValue() !== i.NONE && (void 0 === e9.minzoom || e9.minzoom < t9 + _2) && (void 0 === e9.maxzoom || e9.maxzoom >= t9 - _2))
  1613. return true;
  1614. }
  1615. return false;
  1616. }
  1617. var b2 = class extends i2 {
  1618. constructor(e9) {
  1619. super(e9), this._backgroundTiles = [], this._pointToCallbacks = /* @__PURE__ */ new Map();
  1620. }
  1621. destroy() {
  1622. this.removeAllChildren(), this._spriteMosaic && (this._spriteMosaic.dispose(), this._spriteMosaic = null), this._glyphMosaic && (this._glyphMosaic.dispose(), this._glyphMosaic = null), r(this._symbolFader) && (this._symbolFader.clear(), this._symbolFader = null), this._styleRepository = null, this._backgroundTiles = [], this._pointToCallbacks.clear();
  1623. }
  1624. setStyleResources(e9, r11, i7) {
  1625. if (this._spriteMosaic = e9, this._glyphMosaic = r11, this._styleRepository = i7, t(this._symbolFader)) {
  1626. const e10 = new m3(this._styleRepository, this.children);
  1627. e10.on("fade-start", () => {
  1628. this.emit("fade-start"), this.requestRender();
  1629. }), e10.on("fade-complete", () => {
  1630. this.emit("fade-complete"), this.requestRender();
  1631. }), this._symbolFader = e10;
  1632. }
  1633. e2(this._symbolFader).styleRepository = i7;
  1634. }
  1635. setSpriteMosaic(e9) {
  1636. this._spriteMosaic.dispose(), this._spriteMosaic = e9;
  1637. }
  1638. deleteStyleLayers(t9) {
  1639. r(this._symbolFader) && this._symbolFader.deleteStyleLayers(t9);
  1640. }
  1641. async hitTest(e9) {
  1642. const t9 = D();
  1643. return this._pointToCallbacks.set(e9, t9), this.requestRender(), t9.promise;
  1644. }
  1645. enterTileInvalidation() {
  1646. for (const e9 of this.children)
  1647. e9.invalidating = true;
  1648. }
  1649. createRenderParams(e9) {
  1650. return { ...super.createRenderParams(e9), renderPass: null, styleLayer: null, styleLayerUID: -1, glyphMosaic: this._glyphMosaic, spriteMosaic: this._spriteMosaic, hasClipping: !!this._clippingInfos };
  1651. }
  1652. doRender(e9) {
  1653. !this.visible || e9.drawPhase !== I2.MAP && e9.drawPhase !== I2.DEBUG || void 0 === this._spriteMosaic || super.doRender(e9);
  1654. }
  1655. addChild(t9) {
  1656. return super.addChild(t9), r(this._symbolFader) ? this._symbolFader.addTile(t9) : t9.decluttered = true, this.requestRender(), t9;
  1657. }
  1658. removeChild(t9) {
  1659. return r(this._symbolFader) && this._symbolFader.removeTile(t9), this.requestRender(), super.removeChild(t9);
  1660. }
  1661. renderChildren(e9) {
  1662. const { drawPhase: t9 } = e9;
  1663. if (t9 !== I2.DEBUG) {
  1664. if (this._doRender(e9), this._pointToCallbacks.size > 0) {
  1665. e9.drawPhase = I2.HITTEST;
  1666. const s5 = e9.painter.effects.hittestVTL;
  1667. s5.bind(e9), this._doRender(e9), s5.draw(e9, this._pointToCallbacks), s5.unbind(e9), e9.drawPhase = t9;
  1668. }
  1669. } else
  1670. super.renderChildren(e9);
  1671. }
  1672. removeAllChildren() {
  1673. for (let t9 = 0; t9 < this.children.length; t9++) {
  1674. const s5 = this.children[t9];
  1675. r(this._symbolFader) && this._symbolFader.removeTile(s5), s5.dispose();
  1676. }
  1677. super.removeAllChildren();
  1678. }
  1679. getStencilTarget() {
  1680. return this.children.filter((e9) => e9.neededForCoverage && e9.hasData());
  1681. }
  1682. restartDeclutter() {
  1683. r(this._symbolFader) && this._symbolFader.restartDeclutter();
  1684. }
  1685. _doRender(e9) {
  1686. const { context: t9 } = e9, s5 = this._styleRepository;
  1687. if (!s5)
  1688. return;
  1689. const r11 = s5.layers;
  1690. let i7 = true;
  1691. e9.drawPhase === I2.HITTEST && (i7 = false), s5.backgroundBucketIds.length > 0 && (e9.renderPass = "background", this._renderBackgroundLayers(e9, s5.backgroundBucketIds)), super.renderChildren(e9), e9.drawPhase === I2.MAP && this._fade(e9.displayLevel, e9.state);
  1692. const o3 = this.children.filter((e10) => e10.visible && e10.hasData());
  1693. if (!o3 || 0 === o3.length)
  1694. return t9.bindVAO(), t9.setStencilTestEnabled(true), void t9.setBlendingEnabled(true);
  1695. for (const l10 of o3)
  1696. l10.triangleCount = 0;
  1697. t9.setStencilWriteMask(0), t9.setColorMask(true, true, true, true), t9.setStencilOp(O.KEEP, O.KEEP, O.REPLACE), t9.setStencilTestEnabled(true), t9.setBlendingEnabled(false), t9.setDepthTestEnabled(true), t9.setDepthWriteEnabled(true), t9.setDepthFunction(I.LEQUAL), t9.setClearDepth(1), t9.clear(t9.gl.DEPTH_BUFFER_BIT), e9.renderPass = "opaque";
  1698. for (let l10 = r11.length - 1; l10 >= 0; l10--)
  1699. this._renderStyleLayer(r11[l10], e9, o3);
  1700. t9.setDepthWriteEnabled(false), t9.setBlendingEnabled(i7), t9.setBlendFunctionSeparate(R.ONE, R.ONE_MINUS_SRC_ALPHA, R.ONE, R.ONE_MINUS_SRC_ALPHA), e9.renderPass = "translucent";
  1701. for (let l10 = 0; l10 < r11.length; l10++)
  1702. this._renderStyleLayer(r11[l10], e9, o3);
  1703. t9.bindVAO(), t9.setStencilTestEnabled(true), t9.setBlendingEnabled(true);
  1704. }
  1705. _fade(t9, s5) {
  1706. r(this._symbolFader) && (this._symbolFader.update(t9, s5) || this.requestRender());
  1707. }
  1708. _renderStyleLayer(e9, t9, s5) {
  1709. const { painter: r11, renderPass: i7 } = t9;
  1710. if (void 0 === e9)
  1711. return;
  1712. const o3 = e9.getLayoutProperty("visibility");
  1713. if (o3 && o3.getValue() === i.NONE)
  1714. return;
  1715. let a8;
  1716. switch (e9.type) {
  1717. case a2.BACKGROUND:
  1718. return;
  1719. case a2.FILL:
  1720. if ("opaque" !== i7 && "translucent" !== t9.renderPass)
  1721. return;
  1722. a8 = "vtlFill";
  1723. break;
  1724. case a2.LINE:
  1725. if ("translucent" !== i7)
  1726. return;
  1727. a8 = "vtlLine";
  1728. break;
  1729. case a2.CIRCLE:
  1730. if ("translucent" !== i7)
  1731. return;
  1732. a8 = "vtlCircle";
  1733. break;
  1734. case a2.SYMBOL:
  1735. if ("translucent" !== i7)
  1736. return;
  1737. a8 = "vtlSymbol";
  1738. }
  1739. if (s5 = e9.type === a2.SYMBOL ? s5.filter((e10) => e10.decluttered) : s5.filter((e10) => e10.neededForCoverage), "vtlSymbol" !== a8) {
  1740. const r12 = t9.displayLevel;
  1741. if (0 === s5.length || void 0 !== e9.minzoom && e9.minzoom >= r12 + _2 || void 0 !== e9.maxzoom && e9.maxzoom < r12 - _2)
  1742. return;
  1743. }
  1744. const d2 = e9.uid;
  1745. t9.styleLayerUID = d2, t9.styleLayer = e9;
  1746. for (const l10 of s5)
  1747. if (l10.layerData.has(d2)) {
  1748. r11.renderObjects(t9, s5, a8);
  1749. break;
  1750. }
  1751. }
  1752. _renderBackgroundLayers(t9, s5) {
  1753. const { context: r11, displayLevel: o3, painter: l10, state: h6 } = t9, m4 = this._styleRepository;
  1754. let _4 = false;
  1755. for (const e9 of s5) {
  1756. if (m4.getLayerById(e9).type === a2.BACKGROUND && f2(m4.getLayerById(e9), o3)) {
  1757. _4 = true;
  1758. break;
  1759. }
  1760. }
  1761. if (!_4)
  1762. return;
  1763. const b3 = this._tileInfoView.getTileCoverage(t9.state, 0, "smallest"), { spans: g2, lodInfo: T } = b3, { level: E6 } = T, C2 = u(), L3 = [];
  1764. if (this._renderPasses) {
  1765. const s6 = this._renderPasses[0];
  1766. r(this._clippingInfos) && (s6.brushes[0].prepareState(t9), s6.brushes[0].drawMany(t9, this._clippingInfos));
  1767. }
  1768. const v = this._backgroundTiles;
  1769. let R2, S = 0;
  1770. for (const { row: e9, colFrom: n11, colTo: a8 } of g2)
  1771. for (let t10 = n11; t10 <= a8; t10++) {
  1772. if (S < v.length)
  1773. R2 = v[S], R2.key.set(E6, e9, T.normalizeCol(t10), T.getWorldForColumn(t10)), this._tileInfoView.getTileBounds(C2, R2.key, false), R2.x = C2[0], R2.y = C2[3], R2.resolution = this._tileInfoView.getTileResolution(E6);
  1774. else {
  1775. const s6 = new e4(E6, e9, T.normalizeCol(t10), T.getWorldForColumn(t10)), r12 = this._tileInfoView.getTileBounds(u(), s6), o4 = this._tileInfoView.getTileResolution(E6);
  1776. R2 = new t7(s6, o4, r12[0], r12[3], 512, 512, 4096, 4096), v.push(R2);
  1777. }
  1778. R2.setTransform(h6), L3.push(R2), S++;
  1779. }
  1780. r11.setStencilWriteMask(0), r11.setColorMask(true, true, true, true), r11.setStencilOp(O.KEEP, O.KEEP, O.REPLACE), r11.setStencilFunction(I.EQUAL, 0, 255);
  1781. let F2 = true;
  1782. t9.drawPhase === I2.HITTEST && (F2 = false), r11.setStencilTestEnabled(F2);
  1783. for (const e9 of s5) {
  1784. const s6 = m4.getLayerById(e9);
  1785. s6.type === a2.BACKGROUND && f2(s6, o3) && (t9.styleLayerUID = s6.uid, t9.styleLayer = s6, l10.renderObjects(t9, L3, "vtlBackground"));
  1786. }
  1787. l2.pool.release(b3);
  1788. }
  1789. };
  1790. // node_modules/@arcgis/core/views/2d/layers/support/DebugOverlay.js
  1791. var _3 = { geometry: [new t2("a_PositionAndFlags", 3, C.SHORT, 0, 6)] };
  1792. var u6 = /* @__PURE__ */ new Map();
  1793. u6.set("a_PositionAndFlags", 0);
  1794. var l9 = { vsPath: "debug/overlay", fsPath: "debug/overlay", attributes: u6 };
  1795. var d = class extends r5 {
  1796. constructor(e9) {
  1797. super(), this._conf = e9;
  1798. }
  1799. static makeFlags(e9, t9) {
  1800. return e9 | t9 << 2;
  1801. }
  1802. _createTransforms() {
  1803. return { dvs: e6() };
  1804. }
  1805. doRender(e9) {
  1806. this._updateTransforms(e9), this._ensureResources(e9);
  1807. const { context: t9 } = e9;
  1808. t9.useProgram(this._program), this._program.setUniformMatrix3fv("u_dvsMat3", this.transforms.dvs), this._program.setUniform4fv("u_colors", this._conf.getColors(e9)), this._program.setUniform1fv("u_opacities", this._conf.getOpacities(e9));
  1809. const { vertexData: s5, indexData: r11 } = this._conf.getMesh(e9);
  1810. this._vertexBuffer.setData(s5), this._indexBuffer.setData(r11), t9.bindVAO(this._vertexArray), t9.setBlendingEnabled(true), t9.setBlendFunction(R.ONE, R.ONE_MINUS_SRC_ALPHA), t9.setDepthTestEnabled(false), t9.setStencilTestEnabled(false), t9.setColorMask(true, true, true, true), t9.drawElements(E3.TRIANGLES, r11.length, C.UNSIGNED_INT, 0);
  1811. }
  1812. onDetach() {
  1813. this._vertexArray && (this._vertexArray.dispose(), this._vertexArray = null);
  1814. }
  1815. _updateTransforms(r11) {
  1816. r2(this.transforms.dvs), M(this.transforms.dvs, this.transforms.dvs, [-1, 1]), f(this.transforms.dvs, this.transforms.dvs, [2 / r11.state.size[0], -2 / r11.state.size[1], 1]);
  1817. }
  1818. _ensureResources(e9) {
  1819. const { context: t9 } = e9;
  1820. this._program || (this._program = e9.painter.materialManager.getProgram(l9)), this._vertexBuffer || (this._vertexBuffer = E5.createVertex(t9, F.STREAM_DRAW)), this._indexBuffer || (this._indexBuffer = E5.createIndex(t9, F.STREAM_DRAW)), this._vertexArray || (this._vertexArray = new a3(t9, u6, _3, { geometry: this._vertexBuffer }, this._indexBuffer));
  1821. }
  1822. };
  1823. // node_modules/@arcgis/core/views/2d/tiling/TileInfoViewPOT.js
  1824. var t8 = class extends h3 {
  1825. constructor() {
  1826. super(...arguments), this._fullCacheLodInfos = null, this._levelByScale = {};
  1827. }
  1828. getTileParentId(e9) {
  1829. const l10 = e4.pool.acquire(e9), t9 = 0 === l10.level ? null : e4.getId(l10.level - 1, l10.row >> 1, l10.col >> 1, l10.world);
  1830. return e4.pool.release(l10), t9;
  1831. }
  1832. getTileCoverage(e9, l10, s5) {
  1833. const t9 = super.getTileCoverage(e9, l10, s5);
  1834. if (!t9)
  1835. return t9;
  1836. const o3 = 1 << t9.lodInfo.level;
  1837. return t9.spans = t9.spans.filter((e10) => e10.row >= 0 && e10.row < o3), t9;
  1838. }
  1839. scaleToLevel(e9) {
  1840. if (this._fullCacheLodInfos || this._initializeFullCacheLODs(this._lodInfos), this._levelByScale[e9])
  1841. return this._levelByScale[e9];
  1842. {
  1843. const l10 = this._fullCacheLodInfos;
  1844. if (e9 > l10[0].scale)
  1845. return l10[0].level;
  1846. let s5, t9;
  1847. for (let o3 = 0; o3 < l10.length - 1; o3++)
  1848. if (t9 = l10[o3 + 1], e9 > t9.scale)
  1849. return s5 = l10[o3], s5.level + (s5.scale - e9) / (s5.scale - t9.scale);
  1850. return l10[l10.length - 1].level;
  1851. }
  1852. }
  1853. _initializeFullCacheLODs(l10) {
  1854. let s5;
  1855. if (0 === l10[0].level)
  1856. s5 = l10.map((e9) => ({ level: e9.level, resolution: e9.resolution, scale: e9.scale }));
  1857. else {
  1858. const l11 = this.tileInfo.size[0], t9 = this.tileInfo.spatialReference;
  1859. s5 = j2.create({ size: l11, spatialReference: t9 }).lods.map((e9) => ({ level: e9.level, resolution: e9.resolution, scale: e9.scale }));
  1860. }
  1861. for (let e9 = 0; e9 < s5.length; e9++)
  1862. this._levelByScale[s5[e9].scale] = s5[e9].level;
  1863. this._fullCacheLodInfos = s5;
  1864. }
  1865. };
  1866. // node_modules/@arcgis/core/views/2d/layers/VectorTileLayerView2D.js
  1867. var D3 = class extends y4(u3) {
  1868. constructor() {
  1869. super(...arguments), this._styleChanges = [], this._fetchQueue = null, this._parseQueue = null, this._isTileHandlerReady = false, this.fading = false, this._getCollidersMesh = (e9) => {
  1870. const { pixelRatio: t9 } = e9.state;
  1871. let i7 = 0;
  1872. const s5 = [], r11 = [];
  1873. for (const a8 of this._vectorTileContainer.children)
  1874. if (a8.symbols)
  1875. for (const [e10, l10] of a8.symbols)
  1876. for (const a9 of l10)
  1877. for (const e11 of a9.colliders) {
  1878. const l11 = (e11.xScreen + e11.dxScreen) * t9, n11 = (e11.yScreen + e11.dyScreen) * t9, o3 = e11.width * t9, h6 = e11.height * t9, u7 = a9.unique.parts[e11.partIndex].targetOpacity > 0.5;
  1879. if (!u7 && "all" !== this.layer.showCollisionBoxes)
  1880. continue;
  1881. const c5 = 2, y5 = 0, p = 3, d2 = 0, _4 = 3, f3 = 1, g2 = 3, m4 = 0, C2 = u7 ? c5 : y5, T = u7 ? p : d2, v = d.makeFlags(C2, T);
  1882. s5.push(l11, n11, v, l11 + o3, n11, v, l11, n11 + h6, v, l11 + o3, n11 + h6, v), r11.push(i7 + 0, i7 + 1, i7 + 2, i7 + 1, i7 + 3, i7 + 2), i7 += 4;
  1883. const H = u7 ? _4 : f3, w = u7 ? g2 : m4, S = d.makeFlags(H, w);
  1884. s5.push(l11, n11, S, l11 + o3, n11, S, l11, n11 + 1, S, l11 + o3, n11 + 1, S), r11.push(i7 + 0, i7 + 1, i7 + 2, i7 + 1, i7 + 3, i7 + 2), i7 += 4, s5.push(l11, n11 + h6 - 1, S, l11 + o3, n11 + h6 - 1, S, l11, n11 + h6, S, l11 + o3, n11 + h6, S), r11.push(i7 + 0, i7 + 1, i7 + 2, i7 + 1, i7 + 3, i7 + 2), i7 += 4, s5.push(l11, n11, S, l11 + 1, n11, S, l11, n11 + h6, S, l11 + 1, n11 + h6, S), r11.push(i7 + 0, i7 + 1, i7 + 2, i7 + 1, i7 + 3, i7 + 2), i7 += 4, s5.push(l11 + o3 - 1, n11, S, l11 + o3, n11, S, l11 + o3 - 1, n11 + h6, S, l11 + o3, n11 + h6, S), r11.push(i7 + 0, i7 + 1, i7 + 2, i7 + 1, i7 + 3, i7 + 2), i7 += 4;
  1885. }
  1886. return { vertexData: new Int16Array(s5), indexData: new Uint32Array(r11) };
  1887. }, this._getCollidersColors = () => [1, 0.5, 0, 1, 1, 0, 0, 1, 0, 1, 0.5, 1, 0, 0.5, 0, 1], this._getCollidersOpacities = () => [0.05, 0.01, 0.15, 0.2];
  1888. }
  1889. async hitTest(e9, i7) {
  1890. if (!this._tileHandlerPromise)
  1891. return null;
  1892. await this._tileHandlerPromise;
  1893. const s5 = await this._vectorTileContainer.hitTest(i7);
  1894. if (!s5 || 0 === s5.length)
  1895. return null;
  1896. const r11 = s5[0] - 1, a8 = this._styleRepository, l10 = a8.getStyleLayerByUID(r11);
  1897. if (!l10)
  1898. return null;
  1899. const n11 = a8.getStyleLayerIndex(l10.id);
  1900. return [{ type: "graphic", mapPoint: e9, layer: this.layer, graphic: new g({ attributes: { layerId: n11, layerName: l10.id, layerUID: r11 }, layer: this.layer, sourceLayer: this.layer }) }];
  1901. }
  1902. update(e9) {
  1903. if (this._tileHandlerPromise && this._isTileHandlerReady)
  1904. return e9.pixelRatio !== this._tileHandler.devicePixelRatio ? (this._start(), void (this._tileHandler.devicePixelRatio = e9.pixelRatio)) : void (this._styleChanges.length > 0 ? this._tileHandlerPromise = this._applyStyleChanges() : (this._fetchQueue.pause(), this._parseQueue.pause(), this._fetchQueue.state = e9.state, this._parseQueue.state = e9.state, this._tileManager.update(e9) || this.requestUpdate(), this._parseQueue.resume(), this._fetchQueue.resume()));
  1905. }
  1906. attach() {
  1907. const { style: e9 } = this.layer.currentStyleInfo;
  1908. this._styleRepository = new l4(e9), this._tileInfoView = new t8(this.layer.tileInfo, this.layer.fullExtent), this._vectorTileContainer = new b2(this._tileInfoView), this._tileHandler = new n6(this.layer, this._styleRepository, window.devicePixelRatio || 1), this.container.addChild(this._vectorTileContainer), this._start(), this.handles.add([this._vectorTileContainer.on("fade-start", () => {
  1909. this.fading = true, this.notifyChange("updating"), this.requestUpdate();
  1910. }), this._vectorTileContainer.on("fade-complete", () => {
  1911. var _a;
  1912. (_a = this._collisionOverlay) == null ? void 0 : _a.requestRender(), this.fading = false, this.notifyChange("updating"), this.requestUpdate();
  1913. }), l(() => this.layer.showCollisionBoxes, (e10) => {
  1914. "none" !== e10 ? this._collisionOverlay || (this._collisionOverlay = new d({ getMesh: this._getCollidersMesh, getColors: this._getCollidersColors, getOpacities: this._getCollidersOpacities }), this.container.addChild(this._collisionOverlay)) : (this.container.removeChild(this._collisionOverlay), this._collisionOverlay = null), this.container.requestRender();
  1915. }, h), this.layer.on("paint-change", (e10) => {
  1916. if (e10.isDataDriven)
  1917. this._styleChanges.push({ type: L.PAINTER_CHANGED, data: e10 }), this.notifyChange("updating"), this.requestUpdate();
  1918. else {
  1919. const t9 = this._styleRepository, i7 = t9.getLayerById(e10.layer);
  1920. if (!i7)
  1921. return;
  1922. const s5 = i7.type === a2.SYMBOL;
  1923. t9.setPaintProperties(e10.layer, e10.paint), s5 && this._vectorTileContainer.restartDeclutter(), this._vectorTileContainer.requestRender();
  1924. }
  1925. }), this.layer.on("layout-change", (e10) => {
  1926. const t9 = this._styleRepository, i7 = t9.getLayerById(e10.layer);
  1927. if (!i7)
  1928. return;
  1929. const s5 = m(i7.layout, e10.layout);
  1930. if (!t(s5)) {
  1931. if (a(s5, "visibility") && 1 === Q(s5))
  1932. return t9.setLayoutProperties(e10.layer, e10.layout), i7.type === a2.SYMBOL && this._vectorTileContainer.restartDeclutter(), void this._vectorTileContainer.requestRender();
  1933. this._styleChanges.push({ type: L.LAYOUT_CHANGED, data: e10 }), this.notifyChange("updating"), this.requestUpdate();
  1934. }
  1935. }), this.layer.on("style-layer-visibility-change", (e10) => {
  1936. const t9 = this._styleRepository, i7 = t9.getLayerById(e10.layer);
  1937. i7 && (t9.setStyleLayerVisibility(e10.layer, e10.visibility), i7.type === a2.SYMBOL && this._vectorTileContainer.restartDeclutter(), this._vectorTileContainer.requestRender());
  1938. }), this.layer.on("style-layer-change", (e10) => {
  1939. this._styleChanges.push({ type: L.LAYER_CHANGED, data: e10 }), this.notifyChange("updating"), this.requestUpdate();
  1940. }), this.layer.on("delete-style-layer", (e10) => {
  1941. this._styleChanges.push({ type: L.LAYER_REMOVED, data: e10 }), this.notifyChange("updating"), this.requestUpdate();
  1942. }), this.layer.on("load-style", () => this._loadStyle()), this.layer.on("spriteSource-change", (e10) => {
  1943. this._newSpriteSource = e10.spriteSource, this._styleChanges.push({ type: L.SPRITES_CHANGED, data: null });
  1944. const t9 = this._styleRepository.layers;
  1945. for (const i7 of t9)
  1946. switch (i7.type) {
  1947. case a2.SYMBOL:
  1948. i7.getLayoutProperty("icon-image") && this._styleChanges.push({ type: L.LAYOUT_CHANGED, data: { layer: i7.id, layout: i7.layout } });
  1949. break;
  1950. case a2.LINE:
  1951. i7.getPaintProperty("line-pattern") && this._styleChanges.push({ type: L.PAINTER_CHANGED, data: { layer: i7.id, paint: i7.paint, isDataDriven: i7.isPainterDataDriven() } });
  1952. break;
  1953. case a2.FILL:
  1954. i7.getLayoutProperty("fill-pattern") && this._styleChanges.push({ type: L.PAINTER_CHANGED, data: { layer: i7.id, paint: i7.paint, isDataDriven: i7.isPainterDataDriven() } });
  1955. }
  1956. this.notifyChange("updating"), this.requestUpdate();
  1957. })], this.declaredClass);
  1958. }
  1959. detach() {
  1960. var _a, _b;
  1961. this._stop(), this.container.removeAllChildren(), (_a = this._vectorTileContainer) == null ? void 0 : _a.destroy(), this._vectorTileContainer = null, (_b = this._tileHandler) == null ? void 0 : _b.destroy(), this._tileHandler = null, this.handles.remove(this.declaredClass);
  1962. }
  1963. moveStart() {
  1964. this.requestUpdate();
  1965. }
  1966. viewChange() {
  1967. this.requestUpdate();
  1968. }
  1969. moveEnd() {
  1970. this._collisionOverlay && this._vectorTileContainer.restartDeclutter(), this.requestUpdate();
  1971. }
  1972. supportsSpatialReference(e9) {
  1973. var _a;
  1974. return E2((_a = this.layer.tileInfo) == null ? void 0 : _a.spatialReference, e9);
  1975. }
  1976. canResume() {
  1977. let e9 = super.canResume();
  1978. const { currentStyleInfo: t9 } = this.layer;
  1979. if (e9 && (t9 == null ? void 0 : t9.layerDefinition)) {
  1980. const i7 = this.view.scale, { minScale: s5, maxScale: r11 } = t9.layerDefinition;
  1981. t9 && t9.layerDefinition && (s5 && s5 < i7 && (e9 = false), r11 && r11 > i7 && (e9 = false));
  1982. }
  1983. return e9;
  1984. }
  1985. isUpdating() {
  1986. const e9 = this._vectorTileContainer.children;
  1987. return !this._isTileHandlerReady || !this._fetchQueue || !this._parseQueue || this._fetchQueue.updating || this._parseQueue.updating || e9.length > 0 && e9.some((e10) => e10.invalidating) || this.fading;
  1988. }
  1989. acquireTile(e9) {
  1990. const t9 = this._createVectorTile(e9);
  1991. return this._tileHandlerPromise.then(() => {
  1992. this._fetchQueue.push(t9.key).then((e10) => this._parseQueue.push({ key: t9.key, data: e10 })).then((e10) => {
  1993. t9.once("attach", () => this.requestUpdate()), t9.setData(e10), this.requestUpdate(), this.notifyChange("updating");
  1994. }).catch((e10) => {
  1995. this.notifyChange("updating"), j(e10) || s.getLogger(this.declaredClass).error(e10);
  1996. });
  1997. }), t9;
  1998. }
  1999. releaseTile(e9) {
  2000. const t9 = e9.key.id;
  2001. this._fetchQueue.abort(t9), this._parseQueue.abort(t9), this.requestUpdate();
  2002. }
  2003. _start() {
  2004. if (this._stop(), this._tileManager = new a5({ acquireTile: (e10) => this.acquireTile(e10), releaseTile: (e10) => this.releaseTile(e10), tileInfoView: this._tileInfoView }, this._vectorTileContainer), !this.layer.currentStyleInfo)
  2005. return;
  2006. const e9 = new AbortController(), t9 = this._tileHandler.start({ signal: e9.signal }).then(() => {
  2007. this._fetchQueue = new y3({ tileInfoView: this._tileInfoView, process: (e10, t10) => this._getTileData(e10, t10), concurrency: 15 }), this._parseQueue = new y3({ tileInfoView: this._tileInfoView, process: (e10, t10) => this._parseTileData(e10, t10), concurrency: 8 }), this.requestUpdate(), this._isTileHandlerReady = true;
  2008. });
  2009. this._tileHandler.spriteMosaic.then((e10) => {
  2010. this._vectorTileContainer.setStyleResources(e10, this._tileHandler.glyphMosaic, this._styleRepository), this.requestUpdate();
  2011. }), this._tileHandlerAbortController = e9, this._tileHandlerPromise = t9;
  2012. }
  2013. _stop() {
  2014. if (!this._tileHandlerAbortController || !this._vectorTileContainer)
  2015. return;
  2016. const e9 = this._tileHandlerAbortController;
  2017. e9 && e9.abort(), this._tileHandlerPromise = null, this._isTileHandlerReady = false, this._fetchQueue && (this._fetchQueue.destroy(), this._fetchQueue = null), this._parseQueue && (this._parseQueue.destroy(), this._parseQueue = null), this._tileManager && (this._tileManager.destroy(), this._tileManager = null), this._vectorTileContainer.removeAllChildren();
  2018. }
  2019. async _getTileData(e9, t9) {
  2020. const i7 = await this._tileHandler.fetchTileData(e9, t9);
  2021. return this.notifyChange("updating"), i7;
  2022. }
  2023. async _parseTileData(e9, t9) {
  2024. return this._tileHandler.parseTileData(e9, t9);
  2025. }
  2026. async _applyStyleChanges() {
  2027. this._isTileHandlerReady = false, this._fetchQueue.pause(), this._parseQueue.pause(), this._fetchQueue.clear(), this._parseQueue.clear(), this._tileManager.clearCache();
  2028. const e9 = this._styleChanges;
  2029. try {
  2030. await this._tileHandler.updateStyle(e9);
  2031. } catch (n11) {
  2032. s.getLogger(this.declaredClass).error("error applying vector-tiles style update", n11.message), this._fetchQueue.resume(), this._parseQueue.resume(), this._isTileHandlerReady = true;
  2033. }
  2034. const t9 = this._styleRepository, i7 = [];
  2035. e9.forEach((e10) => {
  2036. if (e10.type !== L.LAYER_REMOVED)
  2037. return;
  2038. const s5 = e10.data, r12 = t9.getLayerById(s5.layer);
  2039. r12 && i7.push(r12.uid);
  2040. });
  2041. const r11 = [];
  2042. let a8;
  2043. e9.forEach((e10) => {
  2044. const i8 = e10.type, s5 = e10.data;
  2045. switch (i8) {
  2046. case L.PAINTER_CHANGED:
  2047. t9.setPaintProperties(s5.layer, s5.paint), a8 = s5.layer;
  2048. break;
  2049. case L.LAYOUT_CHANGED:
  2050. t9.setLayoutProperties(s5.layer, s5.layout), a8 = s5.layer;
  2051. break;
  2052. case L.LAYER_REMOVED:
  2053. return void t9.deleteStyleLayer(s5.layer);
  2054. case L.LAYER_CHANGED:
  2055. t9.setStyleLayer(s5.layer, s5.index), a8 = s5.layer.id;
  2056. break;
  2057. case L.SPRITES_CHANGED:
  2058. this._vectorTileContainer.setSpriteMosaic(this._tileHandler.setSpriteSource(this._newSpriteSource)), this._newSpriteSource = null, a8 = null;
  2059. }
  2060. const l11 = t9.getLayerById(a8);
  2061. l11 && r11.push(l11.uid);
  2062. });
  2063. const l10 = this._vectorTileContainer.children;
  2064. if (i7.length > 0) {
  2065. this._vectorTileContainer.deleteStyleLayers(i7);
  2066. for (const e10 of l10)
  2067. e10.deleteLayerData(i7);
  2068. }
  2069. if (this._fetchQueue.resume(), this._parseQueue.resume(), r11.length > 0) {
  2070. const e10 = [];
  2071. for (const t10 of l10) {
  2072. const i8 = this._fetchQueue.push(t10.key).then((e11) => this._parseQueue.push({ key: t10.key, data: e11, styleLayerUIDs: r11 })).then((e11) => t10.setData(e11));
  2073. e10.push(i8);
  2074. }
  2075. await Promise.all(e10);
  2076. }
  2077. this._styleChanges = [], this._isTileHandlerReady = true, this.notifyChange("updating"), this.requestUpdate();
  2078. }
  2079. async _loadStyle() {
  2080. const { style: e9 } = this.layer.currentStyleInfo, t9 = y(e9);
  2081. this._isTileHandlerReady = false, this._fetchQueue.pause(), this._parseQueue.pause(), this._fetchQueue.clear(), this._parseQueue.clear(), this.notifyChange("updating"), this._styleRepository = new l4(t9), this._vectorTileContainer.destroy(), this._tileManager.clear(), this._tileHandlerAbortController.abort(), this._tileHandlerAbortController = new AbortController();
  2082. const { signal: s5 } = this._tileHandlerAbortController;
  2083. try {
  2084. this._tileHandlerPromise = this._tileHandler.setStyle(this._styleRepository, t9), await this._tileHandlerPromise;
  2085. } catch (l10) {
  2086. if (!j(l10))
  2087. throw l10;
  2088. }
  2089. if (s5.aborted)
  2090. return this._fetchQueue.resume(), this._parseQueue.resume(), this._isTileHandlerReady = true, this.notifyChange("updating"), void this.requestUpdate();
  2091. const r11 = await this._tileHandler.spriteMosaic;
  2092. this._vectorTileContainer.setStyleResources(r11, this._tileHandler.glyphMosaic, this._styleRepository), this._fetchQueue.resume(), this._parseQueue.resume(), this._isTileHandlerReady = true, this.notifyChange("updating"), this.requestUpdate();
  2093. }
  2094. _createVectorTile(e9) {
  2095. const t9 = this._tileInfoView.getTileBounds(u(), e9), i7 = this._tileInfoView.getTileResolution(e9.level);
  2096. return new m2(e9, i7, t9[0], t9[3], 512, 512, this._styleRepository);
  2097. }
  2098. };
  2099. function Q(e9) {
  2100. if (t(e9))
  2101. return 0;
  2102. switch (e9.type) {
  2103. case "partial":
  2104. return Object.keys(e9.diff).length;
  2105. case "complete":
  2106. return Math.max(Object.keys(e9.oldValue).length, Object.keys(e9.newValue).length);
  2107. case "collection":
  2108. return Object.keys(e9.added).length + Object.keys(e9.changed).length + Object.keys(e9.removed).length;
  2109. }
  2110. }
  2111. e([y2()], D3.prototype, "_fetchQueue", void 0), e([y2()], D3.prototype, "_parseQueue", void 0), e([y2()], D3.prototype, "_isTileHandlerReady", void 0), e([y2()], D3.prototype, "fading", void 0), D3 = e([n("esri.views.2d.layers.VectorTileLayerView2D")], D3);
  2112. var L2 = D3;
  2113. export {
  2114. L2 as default
  2115. };
  2116. //# sourceMappingURL=VectorTileLayerView2D-ANKA365Z.js.map