WorkerTileHandler-RHSUEZH4.js 74 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763
  1. import {
  2. o as o3
  3. } from "./chunk-FCDUTNBY.js";
  4. import {
  5. a as a2,
  6. d,
  7. l,
  8. n,
  9. o
  10. } from "./chunk-MIWGTTJJ.js";
  11. import "./chunk-LL6JU3GU.js";
  12. import {
  13. C,
  14. t as t2
  15. } from "./chunk-LSDW2622.js";
  16. import {
  17. T,
  18. l as l3,
  19. m as m2,
  20. t as t5
  21. } from "./chunk-Y4YDGLMZ.js";
  22. import {
  23. I,
  24. L
  25. } from "./chunk-VGSBB3MM.js";
  26. import {
  27. a as a4,
  28. l as l2,
  29. m,
  30. n as n3,
  31. o as o2,
  32. p as p2,
  33. u
  34. } from "./chunk-3T4BXU2T.js";
  35. import {
  36. s,
  37. t as t3
  38. } from "./chunk-SRMDO2KR.js";
  39. import {
  40. P,
  41. a as a3,
  42. b,
  43. f,
  44. h,
  45. n as n2,
  46. r as r2,
  47. t as t4
  48. } from "./chunk-PZKZIMMP.js";
  49. import "./chunk-YLVXZ2PS.js";
  50. import {
  51. x
  52. } from "./chunk-773XI6MQ.js";
  53. import "./chunk-WFSV2B2I.js";
  54. import "./chunk-J525NRN3.js";
  55. import "./chunk-MI7HWWFL.js";
  56. import "./chunk-EZZVK4K6.js";
  57. import "./chunk-EGVIPYN2.js";
  58. import {
  59. a
  60. } from "./chunk-PK35UGFJ.js";
  61. import "./chunk-7XXXCK2A.js";
  62. import "./chunk-JXW4QTJA.js";
  63. import "./chunk-XNLG7T2T.js";
  64. import "./chunk-IR4PV7VK.js";
  65. import "./chunk-MXB2XLKV.js";
  66. import "./chunk-VNFRAYHO.js";
  67. import "./chunk-R5IG2D6H.js";
  68. import "./chunk-VBRY5KJM.js";
  69. import {
  70. t
  71. } from "./chunk-WSRBH7BF.js";
  72. import "./chunk-IHXECKQQ.js";
  73. import {
  74. g,
  75. p
  76. } from "./chunk-ULGDPLM2.js";
  77. import "./chunk-EMJ4ZSM2.js";
  78. import {
  79. c
  80. } from "./chunk-IKP3YN53.js";
  81. import {
  82. r
  83. } from "./chunk-GZT4BVFP.js";
  84. import "./chunk-A5ICIBVI.js";
  85. // node_modules/@arcgis/core/views/2d/engine/vectorTiles/ScriptUtils.js
  86. function e(e3) {
  87. return e3 === 746 || e3 === 747 || !(e3 < 4352) && (e3 >= 12704 && e3 <= 12735 || (e3 >= 12544 && e3 <= 12591 || (e3 >= 65072 && e3 <= 65103 && !(e3 >= 65097 && e3 <= 65103) || (e3 >= 63744 && e3 <= 64255 || (e3 >= 13056 && e3 <= 13311 || (e3 >= 11904 && e3 <= 12031 || (e3 >= 12736 && e3 <= 12783 || (e3 >= 12288 && e3 <= 12351 && !(e3 >= 12296 && e3 <= 12305 || e3 >= 12308 && e3 <= 12319 || e3 === 12336) || (e3 >= 13312 && e3 <= 19903 || (e3 >= 19968 && e3 <= 40959 || (e3 >= 12800 && e3 <= 13055 || (e3 >= 12592 && e3 <= 12687 || (e3 >= 43360 && e3 <= 43391 || (e3 >= 55216 && e3 <= 55295 || (e3 >= 4352 && e3 <= 4607 || (e3 >= 44032 && e3 <= 55215 || (e3 >= 12352 && e3 <= 12447 || (e3 >= 12272 && e3 <= 12287 || (e3 >= 12688 && e3 <= 12703 || (e3 >= 12032 && e3 <= 12255 || (e3 >= 12784 && e3 <= 12799 || (e3 >= 12448 && e3 <= 12543 && e3 !== 12540 || (e3 >= 65280 && e3 <= 65519 && !(e3 === 65288 || e3 === 65289 || e3 === 65293 || e3 >= 65306 && e3 <= 65310 || e3 === 65339 || e3 === 65341 || e3 === 65343 || e3 >= 65371 && e3 <= 65503 || e3 === 65507 || e3 >= 65512 && e3 <= 65519) || (e3 >= 65104 && e3 <= 65135 && !(e3 >= 65112 && e3 <= 65118 || e3 >= 65123 && e3 <= 65126) || (e3 >= 5120 && e3 <= 5759 || (e3 >= 6320 && e3 <= 6399 || (e3 >= 65040 && e3 <= 65055 || (e3 >= 19904 && e3 <= 19967 || (e3 >= 40960 && e3 <= 42127 || e3 >= 42128 && e3 <= 42191)))))))))))))))))))))))))))));
  88. }
  89. function c2(e3) {
  90. return !(e3 < 11904) && (e3 >= 12704 && e3 <= 12735 || (e3 >= 12544 && e3 <= 12591 || (e3 >= 65072 && e3 <= 65103 || (e3 >= 63744 && e3 <= 64255 || (e3 >= 13056 && e3 <= 13311 || (e3 >= 11904 && e3 <= 12031 || (e3 >= 12736 && e3 <= 12783 || (e3 >= 12288 && e3 <= 12351 || (e3 >= 13312 && e3 <= 19903 || (e3 >= 19968 && e3 <= 40959 || (e3 >= 12800 && e3 <= 13055 || (e3 >= 65280 && e3 <= 65519 || (e3 >= 12352 && e3 <= 12447 || (e3 >= 12272 && e3 <= 12287 || (e3 >= 12032 && e3 <= 12255 || (e3 >= 12784 && e3 <= 12799 || (e3 >= 12448 && e3 <= 12543 || (e3 >= 65040 && e3 <= 65055 || (e3 >= 42128 && e3 <= 42191 || e3 >= 40960 && e3 <= 42127)))))))))))))))))));
  91. }
  92. function s2(e3) {
  93. switch (e3) {
  94. case 10:
  95. case 32:
  96. case 38:
  97. case 40:
  98. case 41:
  99. case 43:
  100. case 45:
  101. case 47:
  102. case 173:
  103. case 183:
  104. case 8203:
  105. case 8208:
  106. case 8211:
  107. case 8231:
  108. return true;
  109. }
  110. return false;
  111. }
  112. function a5(e3) {
  113. switch (e3) {
  114. case 9:
  115. case 10:
  116. case 11:
  117. case 12:
  118. case 13:
  119. case 32:
  120. return true;
  121. }
  122. return false;
  123. }
  124. // node_modules/@arcgis/core/views/2d/engine/vectorTiles/TextShaping.js
  125. var c3 = 24;
  126. var h2 = 17;
  127. var a6 = class {
  128. constructor(t8, e3, i, s6, o6, c4, h4) {
  129. this._glyphItems = t8, this._maxWidth = e3, this._lineHeight = i, this._letterSpacing = s6, this._hAnchor = o6, this._vAnchor = c4, this._justify = h4;
  130. }
  131. getShaping(o6, c4, h4) {
  132. const a9 = this._letterSpacing, l5 = this._lineHeight, r7 = this._justify, n5 = this._maxWidth, m3 = [];
  133. let f3 = 0, p4 = 0;
  134. const g3 = o6.length;
  135. for (let t8 = 0; t8 < g3; t8++) {
  136. const e3 = o6.charCodeAt(t8), i = h4 && e(e3);
  137. let c5;
  138. for (const t9 of this._glyphItems)
  139. if (c5 = t9[e3], c5)
  140. break;
  141. m3.push({ codePoint: e3, x: f3, y: p4, vertical: i, glyphMosaicItem: c5 }), c5 && (f3 += c5.metrics.advance + a9);
  142. }
  143. let y2 = f3;
  144. if (n5 > 0) {
  145. y2 = f3 / Math.max(1, Math.ceil(f3 / n5));
  146. }
  147. const d2 = o6.includes("\u200B"), x3 = [];
  148. for (let e3 = 0; e3 < g3 - 1; e3++) {
  149. const s6 = m3[e3].codePoint, o7 = c2(s6);
  150. if (s2(s6) || o7) {
  151. let t8 = 0;
  152. if (s6 === 10)
  153. t8 -= 1e4;
  154. else if (o7 && d2)
  155. t8 += 150;
  156. else {
  157. s6 !== 40 && s6 !== 65288 || (t8 += 50);
  158. const i = m3[e3 + 1].codePoint;
  159. i !== 41 && i !== 65289 || (t8 += 50);
  160. }
  161. x3.push(this._buildBreak(e3 + 1, m3[e3].x, y2, x3, t8, false));
  162. }
  163. }
  164. const M = this._optimalBreaks(this._buildBreak(g3, f3, y2, x3, 0, true));
  165. let u4 = 0;
  166. const _ = c4 ? -l5 : l5;
  167. let I5 = 0;
  168. for (let t8 = 0; t8 < M.length; t8++) {
  169. const i = M[t8];
  170. let s6 = I5;
  171. for (; s6 < i && a5(m3[s6].codePoint); )
  172. m3[s6].glyphMosaicItem = null, ++s6;
  173. let o7 = i - 1;
  174. for (; o7 > s6 && a5(m3[o7].codePoint); )
  175. m3[o7].glyphMosaicItem = null, --o7;
  176. if (s6 <= o7) {
  177. const t9 = m3[s6].x;
  178. for (let i2 = s6; i2 <= o7; i2++)
  179. m3[i2].x -= t9, m3[i2].y = p4;
  180. let e3 = m3[o7].x;
  181. m3[o7].glyphMosaicItem && (e3 += m3[o7].glyphMosaicItem.metrics.advance), u4 = Math.max(e3, u4), r7 && this._applyJustification(m3, s6, o7);
  182. }
  183. I5 = i, p4 += _;
  184. }
  185. if (m3.length > 0) {
  186. const t8 = M.length - 1, e3 = (r7 - this._hAnchor) * u4;
  187. let i = (-this._vAnchor * (t8 + 1) + 0.5) * l5;
  188. c4 && t8 && (i += t8 * l5);
  189. for (const s6 of m3)
  190. s6.x += e3, s6.y += i;
  191. }
  192. return m3.filter((t8) => t8.glyphMosaicItem);
  193. }
  194. static getTextBox(t8, e3) {
  195. if (!t8.length)
  196. return null;
  197. let i = 1 / 0, s6 = 1 / 0, o6 = 0, c4 = 0;
  198. for (const a9 of t8) {
  199. const t9 = a9.glyphMosaicItem.metrics.advance, l5 = a9.x, r7 = a9.y - h2, n5 = l5 + t9, m3 = r7 + e3;
  200. i = Math.min(i, l5), o6 = Math.max(o6, n5), s6 = Math.min(s6, r7), c4 = Math.max(c4, m3);
  201. }
  202. return { x: i, y: s6, width: o6 - i, height: c4 - s6 };
  203. }
  204. static getBox(t8) {
  205. if (!t8.length)
  206. return null;
  207. let e3 = 1 / 0, i = 1 / 0, s6 = 0, o6 = 0;
  208. for (const c4 of t8) {
  209. const { height: t9, left: h4, top: a9, width: l5 } = c4.glyphMosaicItem.metrics, r7 = c4.x, n5 = c4.y - (t9 - Math.abs(a9)), m3 = r7 + l5 + h4, f3 = n5 + t9;
  210. e3 = Math.min(e3, r7), s6 = Math.max(s6, m3), i = Math.min(i, n5), o6 = Math.max(o6, f3);
  211. }
  212. return { x: e3, y: i, width: s6 - e3, height: o6 - i };
  213. }
  214. static addDecoration(t8, e3) {
  215. const i = t8.length;
  216. if (i === 0)
  217. return;
  218. const s6 = 3;
  219. let c4 = t8[0].x + t8[0].glyphMosaicItem.metrics.left, h4 = t8[0].y;
  220. for (let l5 = 1; l5 < i; l5++) {
  221. const i2 = t8[l5];
  222. if (i2.y !== h4) {
  223. const a10 = t8[l5 - 1].x + t8[l5 - 1].glyphMosaicItem.metrics.left + t8[l5 - 1].glyphMosaicItem.metrics.width;
  224. t8.push({ codePoint: 0, x: c4, y: h4 + e3 - s6, vertical: false, glyphMosaicItem: { sdf: true, rect: new t2(4, 0, 4, 8), metrics: { width: a10 - c4, height: 2 + 2 * s6, left: 0, top: 0, advance: 0 }, page: 0, code: 0 } }), h4 = i2.y, c4 = i2.x + i2.glyphMosaicItem.metrics.left;
  225. }
  226. }
  227. const a9 = t8[i - 1].x + t8[i - 1].glyphMosaicItem.metrics.left + t8[i - 1].glyphMosaicItem.metrics.width;
  228. t8.push({ codePoint: 0, x: c4, y: h4 + e3 - s6, vertical: false, glyphMosaicItem: { sdf: true, rect: new t2(4, 0, 4, 8), metrics: { width: a9 - c4, height: 2 + 2 * s6, left: 0, top: 0, advance: 0 }, page: 0, code: 0 } });
  229. }
  230. _breakScore(t8, e3, i, s6) {
  231. const o6 = (t8 - e3) * (t8 - e3);
  232. return s6 ? t8 < e3 ? o6 / 2 : 2 * o6 : o6 + Math.abs(i) * i;
  233. }
  234. _buildBreak(t8, e3, i, s6, o6, c4) {
  235. let h4 = null, a9 = this._breakScore(e3, i, o6, c4);
  236. for (const l5 of s6) {
  237. const t9 = e3 - l5.x, s7 = this._breakScore(t9, i, o6, c4) + l5.score;
  238. s7 <= a9 && (h4 = l5, a9 = s7);
  239. }
  240. return { index: t8, x: e3, score: a9, previousBreak: h4 };
  241. }
  242. _optimalBreaks(t8) {
  243. return t8 ? this._optimalBreaks(t8.previousBreak).concat(t8.index) : [];
  244. }
  245. _applyJustification(t8, e3, i) {
  246. const s6 = t8[i], o6 = s6.vertical ? c3 : s6.glyphMosaicItem ? s6.glyphMosaicItem.metrics.advance : 0, h4 = (s6.x + o6) * this._justify;
  247. for (let c4 = e3; c4 <= i; c4++)
  248. t8[c4].x -= h4;
  249. }
  250. };
  251. // node_modules/@arcgis/core/views/2d/engine/vectorTiles/Placement.js
  252. var x2 = 4096;
  253. var w = 8;
  254. var p3 = 0.5;
  255. var y = 2;
  256. var T2 = class {
  257. constructor(e3, t8, i = 0, n5 = -1, s6 = p3) {
  258. this.x = e3, this.y = t8, this.angle = i, this.segment = n5, this.minzoom = s6;
  259. }
  260. };
  261. var f2 = class {
  262. constructor(e3, t8, n5, s6, o6, a9 = p3, l5 = n2) {
  263. this.anchor = e3, this.labelAngle = t8, this.glyphAngle = n5, this.page = s6, this.alternateVerticalGlyph = o6, this.minzoom = a9, this.maxzoom = l5;
  264. }
  265. };
  266. var I2 = class {
  267. constructor(e3, t8, i, n5, s6, o6, a9, l5, h4, r7, c4, g3) {
  268. this.tl = e3, this.tr = t8, this.bl = i, this.br = n5, this.mosaicRect = s6, this.labelAngle = o6, this.minAngle = a9, this.maxAngle = l5, this.anchor = h4, this.minzoom = r7, this.maxzoom = c4, this.page = g3;
  269. }
  270. };
  271. var b2 = class {
  272. constructor(e3) {
  273. this.shapes = e3;
  274. }
  275. };
  276. var u2 = class {
  277. getIconPlacement(i, n5, s6) {
  278. const o6 = new t3(i.x, i.y), a9 = s6.rotationAlignment === l2.MAP, l5 = s6.keepUpright;
  279. let h4 = s6.rotate * f;
  280. a9 && (h4 += i.angle);
  281. const g3 = new b2([]);
  282. return s6.allowOverlap && s6.ignorePlacement || !o3 || (g3.iconColliders = []), this._addIconPlacement(g3, o6, n5, s6, h4), a9 && l5 && this._addIconPlacement(g3, o6, n5, s6, h4 + t4), g3;
  283. }
  284. _addIconPlacement(e3, t8, n5, s6, o6) {
  285. const a9 = n5.pixelRatio, l5 = n5.width / a9, h4 = n5.height / a9, c4 = s6.offset;
  286. let x3 = c4[0], d2 = c4[1];
  287. switch (s6.anchor) {
  288. case m.CENTER:
  289. x3 -= l5 / 2, d2 -= h4 / 2;
  290. break;
  291. case m.LEFT:
  292. d2 -= h4 / 2;
  293. break;
  294. case m.RIGHT:
  295. x3 -= l5, d2 -= h4 / 2;
  296. break;
  297. case m.TOP:
  298. x3 -= l5 / 2;
  299. break;
  300. case m.BOTTOM:
  301. x3 -= l5 / 2, d2 -= h4;
  302. break;
  303. case m.TOP_LEFT:
  304. break;
  305. case m.BOTTOM_LEFT:
  306. d2 -= h4;
  307. break;
  308. case m.TOP_RIGHT:
  309. x3 -= l5;
  310. break;
  311. case m.BOTTOM_RIGHT:
  312. x3 -= l5, d2 -= h4;
  313. }
  314. const w3 = n5.rect, y2 = 2 / a9, T4 = x3 - y2, f3 = d2 - y2, b4 = T4 + w3.width / a9, u4 = f3 + w3.height / a9, P2 = new t3(T4, f3), O = new t3(b4, u4), _ = new t3(T4, u4), k = new t3(b4, f3);
  315. if (o6 !== 0) {
  316. const e4 = Math.cos(o6), t9 = Math.sin(o6);
  317. P2.rotate(e4, t9), O.rotate(e4, t9), _.rotate(e4, t9), k.rotate(e4, t9);
  318. }
  319. const M = new I2(P2, k, _, O, w3, o6, 0, 256, t8, p3, n2, 0);
  320. if (e3.shapes.push(M), (!s6.allowOverlap || !s6.ignorePlacement) && o3) {
  321. const n6 = s6.size, a10 = s6.padding, r7 = { xTile: t8.x, yTile: t8.y, dxPixels: x3 * n6 - a10, dyPixels: d2 * n6 - a10, hard: !s6.optional, partIndex: 0, width: l5 * n6 + 2 * a10, height: h4 * n6 + 2 * a10, angle: o6, minLod: p3, maxLod: n2 };
  322. e3.iconColliders.push(r7);
  323. }
  324. }
  325. getTextPlacement(n5, s6, o6, r7) {
  326. const x3 = new t3(n5.x, n5.y), d2 = r7.rotate * f, T4 = r7.rotationAlignment === l2.MAP, u4 = r7.keepUpright, P2 = r7.padding;
  327. let O = p3;
  328. const _ = !T4 ? 0 : n5.angle, k = n5.segment >= 0 && T4, M = r7.allowOverlap && r7.ignorePlacement ? null : [], E = [], G = 4, N = !k;
  329. let A2 = Number.POSITIVE_INFINITY, L2 = Number.NEGATIVE_INFINITY, z = A2, F = L2;
  330. const v = (k || T4) && u4, R = r7.size / c3;
  331. let B2 = false;
  332. for (const e3 of s6)
  333. if (e3.vertical) {
  334. B2 = true;
  335. break;
  336. }
  337. let H, V = 0, j = 0;
  338. if (!k && B2) {
  339. const e3 = a6.getTextBox(s6, r7.lineHeight * c3);
  340. switch (r7.anchor) {
  341. case m.LEFT:
  342. V = e3.height / 2, j = -e3.width / 2;
  343. break;
  344. case m.RIGHT:
  345. V = -e3.height / 2, j = e3.width / 2;
  346. break;
  347. case m.TOP:
  348. V = e3.height / 2, j = e3.width / 2;
  349. break;
  350. case m.BOTTOM:
  351. V = -e3.height / 2, j = -e3.width / 2;
  352. break;
  353. case m.TOP_LEFT:
  354. V = e3.height;
  355. break;
  356. case m.BOTTOM_LEFT:
  357. j = -e3.width;
  358. break;
  359. case m.TOP_RIGHT:
  360. j = e3.width;
  361. break;
  362. case m.BOTTOM_RIGHT:
  363. V = -e3.height;
  364. }
  365. }
  366. V += r7.offset[0] * c3, j += r7.offset[1] * c3;
  367. for (const e3 of s6) {
  368. const s7 = e3.glyphMosaicItem;
  369. if (!s7 || s7.rect.isEmpty)
  370. continue;
  371. const a9 = s7.rect, l5 = s7.metrics, c4 = s7.page;
  372. if (M && N) {
  373. if (H !== void 0 && H !== e3.y) {
  374. let e4, t8, s8, o7;
  375. B2 ? (e4 = -F + V, t8 = A2 + j, s8 = F - z, o7 = L2 - A2) : (e4 = A2 + V, t8 = z + j, s8 = L2 - A2, o7 = F - z);
  376. const a10 = { xTile: n5.x, yTile: n5.y, dxPixels: e4 * R - P2, dyPixels: t8 * R - P2, hard: !r7.optional, partIndex: 1, width: s8 * R + 2 * P2, height: o7 * R + 2 * P2, angle: d2, minLod: p3, maxLod: n2 };
  377. M.push(a10), A2 = Number.POSITIVE_INFINITY, L2 = Number.NEGATIVE_INFINITY, z = A2, F = L2;
  378. }
  379. H = e3.y;
  380. }
  381. const g3 = [];
  382. if (k) {
  383. const t8 = 0.5 * s7.metrics.width, i = (e3.x + l5.left - G + t8) * R * w;
  384. if (O = this._placeGlyph(n5, O, i, o6, n5.segment, 1, e3.vertical, c4, g3), u4 && (O = this._placeGlyph(n5, O, i, o6, n5.segment, -1, e3.vertical, c4, g3)), O >= y)
  385. break;
  386. } else
  387. g3.push(new f2(x3, _, _, c4, false)), T4 && u4 && g3.push(new f2(x3, _ + t4, _ + t4, c4, false));
  388. const b4 = e3.x + l5.left, C3 = e3.y - h2 - l5.top, S = b4 + l5.width, Y = C3 + l5.height;
  389. let q, U, D, J, K, Q, W, X;
  390. if (!k && B2)
  391. if (e3.vertical) {
  392. const e4 = (b4 + S) / 2 - l5.height / 2, t8 = (C3 + Y) / 2 + l5.width / 2;
  393. q = new t3(-t8 - G + V, e4 - G + j), U = new t3(q.x + a9.width, q.y + a9.height), D = new t3(q.x, U.y), J = new t3(U.x, q.y);
  394. } else
  395. q = new t3(-C3 + G + V, b4 - G + j), U = new t3(q.x - a9.height, q.y + a9.width), D = new t3(U.x, q.y), J = new t3(q.x, U.y);
  396. else
  397. q = new t3(b4 - G + V, C3 - G + j), U = new t3(q.x + a9.width, q.y + a9.height), D = new t3(q.x, U.y), J = new t3(U.x, q.y);
  398. for (const t8 of g3) {
  399. let i, s8, o7, h4;
  400. if (t8.alternateVerticalGlyph) {
  401. if (!K) {
  402. const e4 = (C3 + Y) / 2 + j;
  403. K = new t3((b4 + S) / 2 + V - l5.height / 2 - G, e4 + l5.width / 2 + G), Q = new t3(K.x + a9.height, K.y - a9.width), W = new t3(Q.x, K.y), X = new t3(K.x, Q.y);
  404. }
  405. i = K, s8 = W, o7 = X, h4 = Q;
  406. } else
  407. i = q, s8 = D, o7 = J, h4 = U;
  408. const c5 = C3, g4 = Y, x4 = t8.glyphAngle + d2;
  409. if (x4 !== 0) {
  410. const e4 = Math.cos(x4), t9 = Math.sin(x4);
  411. i = i.clone(), s8 = s8.clone(), o7 = o7.clone(), h4 = h4.clone(), i.rotate(e4, t9), h4.rotate(e4, t9), s8.rotate(e4, t9), o7.rotate(e4, t9);
  412. }
  413. let w3 = 0, p4 = 256;
  414. if (k && B2 ? e3.vertical ? t8.alternateVerticalGlyph ? (w3 = 32, p4 = 96) : (w3 = 224, p4 = 32) : (w3 = 224, p4 = 96) : (w3 = 192, p4 = 64), E.push(new I2(i, o7, s8, h4, a9, t8.labelAngle, w3, p4, t8.anchor, t8.minzoom, t8.maxzoom, t8.page)), M && (!v || this._legible(t8.labelAngle))) {
  415. if (N)
  416. b4 < A2 && (A2 = b4), c5 < z && (z = c5), S > L2 && (L2 = S), g4 > F && (F = g4);
  417. else if (t8.minzoom < y) {
  418. const e4 = { xTile: n5.x, yTile: n5.y, dxPixels: (b4 + V) * R - P2, dyPixels: (c5 + V) * R - P2, hard: !r7.optional, partIndex: 1, width: (S - b4) * R + 2 * P2, height: (g4 - c5) * R + 2 * P2, angle: x4, minLod: t8.minzoom, maxLod: t8.maxzoom };
  419. M.push(e4);
  420. }
  421. }
  422. }
  423. }
  424. if (O >= y)
  425. return null;
  426. if (M && N) {
  427. let e3, t8, s7, o7;
  428. B2 ? (e3 = -F + V, t8 = A2 + j, s7 = F - z, o7 = L2 - A2) : (e3 = A2 + V, t8 = z + j, s7 = L2 - A2, o7 = F - z);
  429. const a9 = { xTile: n5.x, yTile: n5.y, dxPixels: e3 * R - P2, dyPixels: t8 * R - P2, hard: !r7.optional, partIndex: 1, width: s7 * R + 2 * P2, height: o7 * R + 2 * P2, angle: d2, minLod: p3, maxLod: n2 };
  430. M.push(a9);
  431. }
  432. const C2 = new b2(E);
  433. return M && M.length > 0 && (C2.textColliders = M), C2;
  434. }
  435. _legible(e3) {
  436. const t8 = h(e3);
  437. return t8 < 65 || t8 >= 193;
  438. }
  439. _placeGlyph(e3, n5, a9, l5, h4, r7, c4, g3, x3) {
  440. let d2 = r7;
  441. const w3 = d2 < 0 ? a3(e3.angle + t4, r2) : e3.angle;
  442. let p4 = 0;
  443. a9 < 0 && (d2 *= -1, a9 *= -1, p4 = t4), d2 > 0 && ++h4;
  444. let y2 = new t3(e3.x, e3.y), T4 = l5[h4], I5 = n2;
  445. if (l5.length <= h4)
  446. return I5;
  447. for (; ; ) {
  448. const e4 = T4.x - y2.x, t8 = T4.y - y2.y, i = Math.sqrt(e4 * e4 + t8 * t8), r8 = Math.max(a9 / i, n5), m3 = e4 / i, b4 = t8 / i, u4 = a3(Math.atan2(b4, m3) + p4, r2);
  449. if (x3.push(new f2(y2, w3, u4, g3, false, r8, I5)), c4 && x3.push(new f2(y2, w3, u4, g3, true, r8, I5)), r8 <= n5)
  450. return r8;
  451. y2 = T4.clone();
  452. do {
  453. if (h4 += d2, l5.length <= h4 || h4 < 0)
  454. return r8;
  455. T4 = l5[h4];
  456. } while (y2.isEqual(T4));
  457. let P2 = T4.x - y2.x, O = T4.y - y2.y;
  458. const _ = Math.sqrt(P2 * P2 + O * O);
  459. P2 *= i / _, O *= i / _, y2.x -= P2, y2.y -= O, I5 = r8;
  460. }
  461. }
  462. };
  463. // node_modules/@arcgis/core/views/2d/engine/vectorTiles/Feature.js
  464. var t6;
  465. !function(e3) {
  466. e3[e3.moveTo = 1] = "moveTo", e3[e3.lineTo = 2] = "lineTo", e3[e3.close = 7] = "close";
  467. }(t6 || (t6 = {}));
  468. var s3 = class {
  469. constructor(e3, t8) {
  470. this.values = {};
  471. const s6 = t8.keys, o6 = t8.values;
  472. for (; e3.next(); )
  473. switch (e3.tag()) {
  474. case 1:
  475. this.id = e3.getUInt64();
  476. break;
  477. case 2: {
  478. const t9 = e3.getMessage(), r7 = this.values;
  479. for (; !t9.empty(); ) {
  480. const e4 = t9.getUInt32(), a9 = t9.getUInt32();
  481. r7[s6[e4]] = o6[a9];
  482. }
  483. t9.release();
  484. break;
  485. }
  486. case 3:
  487. this.type = e3.getUInt32();
  488. break;
  489. case 4:
  490. this._pbfGeometry = e3.getMessage();
  491. break;
  492. default:
  493. e3.skip();
  494. }
  495. }
  496. getGeometry(s6) {
  497. if (this._geometry !== void 0)
  498. return this._geometry;
  499. if (!this._pbfGeometry)
  500. return null;
  501. const o6 = this._pbfGeometry;
  502. let r7, a9;
  503. this._pbfGeometry = null, s6 ? s6.reset(this.type) : r7 = [];
  504. let n5, l5 = t6.moveTo, i = 0, c4 = 0, h4 = 0;
  505. for (; !o6.empty(); ) {
  506. if (i === 0) {
  507. const e3 = o6.getUInt32();
  508. l5 = 7 & e3, i = e3 >> 3;
  509. }
  510. switch (i--, l5) {
  511. case t6.moveTo:
  512. c4 += o6.getSInt32(), h4 += o6.getSInt32(), s6 ? s6.moveTo(c4, h4) : (a9 && r7.push(a9), a9 = [], a9.push(new t3(c4, h4)));
  513. break;
  514. case t6.lineTo:
  515. c4 += o6.getSInt32(), h4 += o6.getSInt32(), s6 ? s6.lineTo(c4, h4) : a9.push(new t3(c4, h4));
  516. break;
  517. case t6.close:
  518. s6 ? s6.close() : a9 && !a9[0].equals(c4, h4) && a9.push(a9[0].clone());
  519. break;
  520. default:
  521. throw o6.release(), new Error("Invalid path operation");
  522. }
  523. }
  524. return s6 ? n5 = s6.result() : (a9 && r7.push(a9), n5 = r7), o6.release(), this._geometry = n5, n5;
  525. }
  526. };
  527. // node_modules/@arcgis/core/views/2d/engine/vectorTiles/IndexMemoryBuffer.js
  528. var r3 = class extends t5 {
  529. constructor() {
  530. super(12);
  531. }
  532. add(s6, r7, t8) {
  533. const e3 = this.array;
  534. e3.push(s6), e3.push(r7), e3.push(t8);
  535. }
  536. };
  537. // node_modules/@arcgis/core/views/2d/engine/vectorTiles/SourceLayerData.js
  538. var e2 = class {
  539. constructor(t8) {
  540. for (this.extent = 4096, this.keys = [], this.values = [], this._pbfLayer = t8.clone(); t8.next(); )
  541. switch (t8.tag()) {
  542. case 1:
  543. this.name = t8.getString();
  544. break;
  545. case 3:
  546. this.keys.push(t8.getString());
  547. break;
  548. case 4:
  549. this.values.push(t8.processMessage(e2._parseValue));
  550. break;
  551. case 5:
  552. this.extent = t8.getUInt32();
  553. break;
  554. default:
  555. t8.skip();
  556. }
  557. }
  558. getData() {
  559. return this._pbfLayer;
  560. }
  561. static _parseValue(e3) {
  562. for (; e3.next(); )
  563. switch (e3.tag()) {
  564. case 1:
  565. return e3.getString();
  566. case 2:
  567. return e3.getFloat();
  568. case 3:
  569. return e3.getDouble();
  570. case 4:
  571. return e3.getInt64();
  572. case 5:
  573. return e3.getUInt64();
  574. case 6:
  575. return e3.getSInt64();
  576. case 7:
  577. return e3.getBool();
  578. default:
  579. e3.skip();
  580. }
  581. return null;
  582. }
  583. };
  584. // node_modules/@arcgis/core/views/2d/engine/vectorTiles/VertexMemoryBuffer.js
  585. var o4 = class extends t5 {
  586. constructor(t8) {
  587. super(t8);
  588. }
  589. add(t8, o6, r7, u4, h4, a9, n5, d2, e3, p4, i, c4) {
  590. const M = this.array;
  591. let l5 = t5.i1616to32(t8, o6);
  592. M.push(l5);
  593. const m3 = 31;
  594. l5 = t5.i8888to32(Math.round(m3 * r7), Math.round(m3 * u4), Math.round(m3 * h4), Math.round(m3 * a9)), M.push(l5), l5 = t5.i8888to32(Math.round(m3 * n5), Math.round(m3 * d2), Math.round(m3 * e3), Math.round(m3 * p4)), M.push(l5), l5 = t5.i1616to32(i, 0), M.push(l5), c4 && M.push(...c4);
  595. }
  596. };
  597. var r4 = class extends t5 {
  598. constructor(t8) {
  599. super(t8);
  600. }
  601. add(t8, o6, r7) {
  602. const u4 = this.array;
  603. u4.push(t5.i1616to32(t8, o6)), r7 && u4.push(...r7);
  604. }
  605. };
  606. var u3 = class extends t5 {
  607. constructor(t8) {
  608. super(t8);
  609. }
  610. add(t8, o6, r7, u4, h4, a9, n5) {
  611. const d2 = this.array, e3 = this.index;
  612. let p4 = t5.i1616to32(t8, o6);
  613. d2.push(p4);
  614. const i = 15;
  615. return p4 = t5.i8888to32(Math.round(i * r7), Math.round(i * u4), h4, a9), d2.push(p4), n5 && d2.push(...n5), e3;
  616. }
  617. };
  618. var h3 = class extends t5 {
  619. constructor(t8) {
  620. super(t8);
  621. }
  622. add(o6, r7, u4, h4, a9, n5, d2, e3, p4, i, c4, M) {
  623. const l5 = this.array;
  624. let m3 = t5.i1616to32(o6, r7);
  625. l5.push(m3), m3 = t5.i1616to32(Math.round(8 * u4), Math.round(8 * h4)), l5.push(m3), m3 = t5.i8888to32(a9 / 4, n5 / 4, e3, p4), l5.push(m3), m3 = t5.i8888to32(0, h(d2), 10 * i, Math.min(10 * c4, 255)), l5.push(m3), M && l5.push(...M);
  626. }
  627. };
  628. var a7 = class extends t5 {
  629. constructor(t8) {
  630. super(t8);
  631. }
  632. add(t8, o6, r7, u4, h4) {
  633. const a9 = this.array, n5 = t5.i1616to32(2 * t8 + r7, 2 * o6 + u4);
  634. a9.push(n5), h4 && a9.push(...h4);
  635. }
  636. };
  637. // node_modules/@arcgis/core/views/2d/engine/vectorTiles/buckets/BaseBucket.js
  638. var t7 = class {
  639. constructor(t8, e3, s6) {
  640. this.layerExtent = 4096, this._features = [], this.layer = t8, this.zoom = e3, this._spriteInfo = s6, this._filter = t8.getFeatureFilter();
  641. }
  642. pushFeature(t8) {
  643. this._filter && !this._filter.filter(t8, this.zoom) || this._features.push(t8);
  644. }
  645. hasFeatures() {
  646. return this._features.length > 0;
  647. }
  648. getResources(t8, e3, s6) {
  649. }
  650. };
  651. // node_modules/@arcgis/core/views/2d/engine/vectorTiles/buckets/CircleBucket.js
  652. var r5 = class extends t7 {
  653. constructor(t8, r7, i, c4, s6) {
  654. super(t8, r7, i), this.type = I.CIRCLE, this._circleVertexBuffer = c4, this._circleIndexBuffer = s6;
  655. }
  656. get circleIndexStart() {
  657. return this._circleIndexStart;
  658. }
  659. get circleIndexCount() {
  660. return this._circleIndexCount;
  661. }
  662. processFeatures(e3) {
  663. const t8 = this._circleVertexBuffer, r7 = this._circleIndexBuffer;
  664. this._circleIndexStart = 3 * r7.index, this._circleIndexCount = 0;
  665. const i = this.layer, c4 = this.zoom;
  666. e3 && e3.setExtent(this.layerExtent);
  667. for (const s6 of this._features) {
  668. const n5 = s6.getGeometry(e3);
  669. if (!n5)
  670. continue;
  671. const l5 = i.circleMaterial.encodeAttributes(s6, c4, i);
  672. for (const e4 of n5)
  673. if (e4)
  674. for (const i2 of e4) {
  675. const e5 = t8.index;
  676. t8.add(i2.x, i2.y, 0, 0, l5), t8.add(i2.x, i2.y, 0, 1, l5), t8.add(i2.x, i2.y, 1, 0, l5), t8.add(i2.x, i2.y, 1, 1, l5), r7.add(e5 + 0, e5 + 1, e5 + 2), r7.add(e5 + 1, e5 + 2, e5 + 3), this._circleIndexCount += 6;
  677. }
  678. }
  679. }
  680. serialize() {
  681. let e3 = 6;
  682. e3 += this.layerUIDs.length, e3 += this._circleVertexBuffer.array.length, e3 += this._circleIndexBuffer.array.length;
  683. const t8 = new Uint32Array(e3), r7 = new Int32Array(t8.buffer);
  684. let i = 0;
  685. t8[i++] = this.type, t8[i++] = this.layerUIDs.length;
  686. for (let c4 = 0; c4 < this.layerUIDs.length; c4++)
  687. t8[i++] = this.layerUIDs[c4];
  688. t8[i++] = this._circleIndexStart, t8[i++] = this._circleIndexCount, t8[i++] = this._circleVertexBuffer.array.length;
  689. for (let c4 = 0; c4 < this._circleVertexBuffer.array.length; c4++)
  690. r7[i++] = this._circleVertexBuffer.array[c4];
  691. t8[i++] = this._circleIndexBuffer.array.length;
  692. for (let c4 = 0; c4 < this._circleIndexBuffer.array.length; c4++)
  693. t8[i++] = this._circleIndexBuffer.array[c4];
  694. return t8.buffer;
  695. }
  696. };
  697. // node_modules/@arcgis/core/views/2d/engine/vectorTiles/buckets/FillBucket.js
  698. var s4 = class extends t7 {
  699. constructor(t8, e3, i, l5, n5, s6, o6) {
  700. super(t8, e3, i), this.type = I.FILL, this._patternMap = new Map(), this._fillVertexBuffer = l5, this._fillIndexBuffer = n5, this._outlineVertexBuffer = s6, this._outlineIndexBuffer = o6;
  701. }
  702. get fillIndexStart() {
  703. return this._fillIndexStart;
  704. }
  705. get fillIndexCount() {
  706. return this._fillIndexCount;
  707. }
  708. get outlineIndexStart() {
  709. return this._outlineIndexStart;
  710. }
  711. get outlineIndexCount() {
  712. return this._outlineIndexCount;
  713. }
  714. getResources(t8, e3, i) {
  715. const r7 = this.layer, l5 = this.zoom, n5 = r7.getPaintProperty("fill-pattern");
  716. if (n5)
  717. if (n5.isDataDriven)
  718. for (const s6 of this._features)
  719. e3(n5.getValue(l5, s6), true);
  720. else
  721. e3(n5.getValue(l5), true);
  722. }
  723. processFeatures(t8) {
  724. this._fillIndexStart = 3 * this._fillIndexBuffer.index, this._fillIndexCount = 0, this._outlineIndexStart = 3 * this._outlineIndexBuffer.index, this._outlineIndexCount = 0;
  725. const e3 = this.layer, i = this.zoom, { fillMaterial: r7, outlineMaterial: l5, hasDataDrivenFill: n5, hasDataDrivenOutline: s6 } = e3;
  726. t8 && t8.setExtent(this.layerExtent);
  727. const o6 = e3.getPaintProperty("fill-pattern"), a9 = o6?.isDataDriven;
  728. let f3 = !o6 && e3.getPaintValue("fill-antialias", i);
  729. if (e3.outlineUsesFillColor) {
  730. if (f3 && !e3.hasDataDrivenOpacity) {
  731. const t9 = e3.getPaintValue("fill-opacity", i), r8 = e3.getPaintValue("fill-opacity", i + 1);
  732. t9 < 1 && r8 < 1 && (f3 = false);
  733. }
  734. if (f3 && !e3.hasDataDrivenColor) {
  735. const t9 = e3.getPaintValue("fill-color", i), r8 = e3.getPaintValue("fill-color", i + 1);
  736. t9[3] < 1 && r8[3] < 1 && (f3 = false);
  737. }
  738. }
  739. const u4 = this._features, d2 = t8?.validateTessellation;
  740. if (a9) {
  741. const n6 = [];
  742. for (const a10 of u4) {
  743. const u5 = o6.getValue(i, a10), h4 = this._spriteInfo[u5];
  744. if (!h4 || !h4.rect)
  745. continue;
  746. const x3 = r7.encodeAttributes(a10, i, e3, h4), c4 = f3 && s6 ? l5.encodeAttributes(a10, i, e3) : [], _ = a10.getGeometry(t8);
  747. n6.push({ ddFillAttributes: x3, ddOutlineAttributes: c4, page: h4.page, geometry: _ }), n6.sort((t9, e4) => t9.page - e4.page);
  748. for (const { ddFillAttributes: t9, ddOutlineAttributes: i2, page: r8, geometry: l6 } of n6)
  749. this._processFeature(l6, f3, e3.outlineUsesFillColor, t9, i2, d2, r8);
  750. }
  751. } else
  752. for (const h4 of u4) {
  753. const o7 = n5 ? r7.encodeAttributes(h4, i, e3) : null, a10 = f3 && s6 ? l5.encodeAttributes(h4, i, e3) : null, u5 = h4.getGeometry(t8);
  754. this._processFeature(u5, f3, e3.outlineUsesFillColor, o7, a10, d2);
  755. }
  756. }
  757. serialize() {
  758. let t8 = 10;
  759. t8 += this.layerUIDs.length, t8 += this._fillVertexBuffer.array.length, t8 += this._fillIndexBuffer.array.length, t8 += this._outlineVertexBuffer.array.length, t8 += this._outlineIndexBuffer.array.length, t8 += 3 * this._patternMap.size + 1;
  760. const e3 = new Uint32Array(t8), i = new Int32Array(e3.buffer);
  761. let r7 = 0;
  762. e3[r7++] = this.type, e3[r7++] = this.layerUIDs.length;
  763. for (let s6 = 0; s6 < this.layerUIDs.length; s6++)
  764. e3[r7++] = this.layerUIDs[s6];
  765. e3[r7++] = this._fillIndexStart, e3[r7++] = this._fillIndexCount, e3[r7++] = this._outlineIndexStart, e3[r7++] = this._outlineIndexCount;
  766. const l5 = this._patternMap, n5 = l5.size;
  767. if (e3[r7++] = n5, n5 > 0)
  768. for (const [s6, [o6, a9]] of l5)
  769. e3[r7++] = s6, e3[r7++] = o6, e3[r7++] = a9;
  770. e3[r7++] = this._fillVertexBuffer.array.length;
  771. for (let s6 = 0; s6 < this._fillVertexBuffer.array.length; s6++)
  772. i[r7++] = this._fillVertexBuffer.array[s6];
  773. e3[r7++] = this._fillIndexBuffer.array.length;
  774. for (let s6 = 0; s6 < this._fillIndexBuffer.array.length; s6++)
  775. e3[r7++] = this._fillIndexBuffer.array[s6];
  776. e3[r7++] = this._outlineVertexBuffer.array.length;
  777. for (let s6 = 0; s6 < this._outlineVertexBuffer.array.length; s6++)
  778. i[r7++] = this._outlineVertexBuffer.array[s6];
  779. e3[r7++] = this._outlineIndexBuffer.array.length;
  780. for (let s6 = 0; s6 < this._outlineIndexBuffer.array.length; s6++)
  781. e3[r7++] = this._outlineIndexBuffer.array[s6];
  782. return e3.buffer;
  783. }
  784. _processFeature(t8, e3, i, r7, l5, n5, o6) {
  785. if (!t8)
  786. return;
  787. const a9 = t8.length, f3 = !l5 || l5.length === 0;
  788. if (e3 && (!i || f3))
  789. for (let s6 = 0; s6 < a9; s6++)
  790. this._processOutline(t8[s6], l5);
  791. const u4 = 32;
  792. let d2;
  793. for (let h4 = 0; h4 < a9; h4++) {
  794. const e4 = s4._area(t8[h4]);
  795. e4 > u4 ? (d2 !== void 0 && this._processFill(t8, d2, r7, n5, o6), d2 = [h4]) : e4 < -u4 && d2 !== void 0 && d2.push(h4);
  796. }
  797. d2 !== void 0 && this._processFill(t8, d2, r7, n5, o6);
  798. }
  799. _processOutline(t8, e3) {
  800. const i = this._outlineVertexBuffer, r7 = this._outlineIndexBuffer, l5 = r7.index;
  801. let s6, o6, a9;
  802. const f3 = new t3(0, 0), u4 = new t3(0, 0), d2 = new t3(0, 0);
  803. let h4 = -1, x3 = -1, c4 = -1, _ = -1, y2 = -1, g3 = false;
  804. const p4 = 0;
  805. let I5 = t8.length;
  806. if (I5 < 2)
  807. return;
  808. const B2 = t8[p4];
  809. let m3 = t8[I5 - 1];
  810. for (; I5 && m3.isEqual(B2); )
  811. --I5, m3 = t8[I5 - 1];
  812. if (!(I5 - p4 < 2)) {
  813. for (let l6 = p4; l6 < I5; ++l6) {
  814. l6 === p4 ? (s6 = t8[I5 - 1], o6 = t8[p4], a9 = t8[p4 + 1], f3.assignSub(o6, s6), f3.normalize(), f3.rightPerpendicular()) : (s6 = o6, o6 = a9, a9 = l6 !== I5 - 1 ? t8[l6 + 1] : t8[p4], f3.assign(u4));
  815. const n5 = this._isClipEdge(s6, o6);
  816. _ === -1 && (g3 = n5), u4.assignSub(a9, o6), u4.normalize(), u4.rightPerpendicular();
  817. const B3 = f3.x * u4.y - f3.y * u4.x;
  818. d2.assignAdd(f3, u4), d2.normalize();
  819. const m4 = -d2.x * -f3.x + -d2.y * -f3.y;
  820. let V = Math.abs(m4 !== 0 ? 1 / m4 : 1);
  821. V > 8 && (V = 8), B3 >= 0 ? (c4 = i.add(o6.x, o6.y, f3.x, f3.y, 0, 1, e3), _ === -1 && (_ = c4), h4 >= 0 && x3 >= 0 && c4 >= 0 && !n5 && r7.add(h4, x3, c4), x3 = i.add(o6.x, o6.y, V * -d2.x, V * -d2.y, 0, -1, e3), y2 === -1 && (y2 = x3), h4 >= 0 && x3 >= 0 && c4 >= 0 && !n5 && r7.add(h4, x3, c4), h4 = x3, x3 = c4, c4 = i.add(o6.x, o6.y, d2.x, d2.y, 0, 1, e3), h4 >= 0 && x3 >= 0 && c4 >= 0 && !n5 && r7.add(h4, x3, c4), x3 = i.add(o6.x, o6.y, u4.x, u4.y, 0, 1, e3), h4 >= 0 && x3 >= 0 && c4 >= 0 && !n5 && r7.add(h4, x3, c4)) : (c4 = i.add(o6.x, o6.y, V * d2.x, V * d2.y, 0, 1, e3), _ === -1 && (_ = c4), h4 >= 0 && x3 >= 0 && c4 >= 0 && !n5 && r7.add(h4, x3, c4), x3 = i.add(o6.x, o6.y, -f3.x, -f3.y, 0, -1, e3), y2 === -1 && (y2 = x3), h4 >= 0 && x3 >= 0 && c4 >= 0 && !n5 && r7.add(h4, x3, c4), h4 = x3, x3 = c4, c4 = i.add(o6.x, o6.y, -d2.x, -d2.y, 0, -1, e3), h4 >= 0 && x3 >= 0 && c4 >= 0 && !n5 && r7.add(h4, x3, c4), h4 = i.add(o6.x, o6.y, -u4.x, -u4.y, 0, -1, e3), h4 >= 0 && x3 >= 0 && c4 >= 0 && !n5 && r7.add(h4, x3, c4));
  822. }
  823. h4 >= 0 && x3 >= 0 && _ >= 0 && !g3 && r7.add(h4, x3, _), h4 >= 0 && _ >= 0 && y2 >= 0 && !g3 && r7.add(h4, y2, _), this._outlineIndexCount += 3 * (r7.index - l5);
  824. }
  825. }
  826. _processFill(r7, l5, n5, s6, o6) {
  827. s6 = true;
  828. let a9;
  829. l5.length > 1 && (a9 = []);
  830. let f3 = 0;
  831. for (const t8 of l5)
  832. f3 !== 0 && a9.push(f3), f3 += r7[t8].length;
  833. const u4 = 2 * f3, d2 = t.acquire();
  834. for (const t8 of l5) {
  835. const e3 = r7[t8], i = e3.length;
  836. for (let t9 = 0; t9 < i; ++t9)
  837. d2.push(e3[t9].x, e3[t9].y);
  838. }
  839. const h4 = x(d2, a9, 2);
  840. if (s6 && x.deviation(d2, a9, 2, h4) > 0) {
  841. const t8 = l5.map((t9) => r7[t9].length), { buffer: e3, vertexCount: s7 } = a2(d2, t8);
  842. if (s7 > 0) {
  843. const t9 = this._fillVertexBuffer.index;
  844. for (let i = 0; i < s7; i++)
  845. this._fillVertexBuffer.add(e3[2 * i], e3[2 * i + 1], n5);
  846. for (let e4 = 0; e4 < s7; e4 += 3) {
  847. const i = t9 + e4;
  848. this._fillIndexBuffer.add(i, i + 1, i + 2);
  849. }
  850. if (o6 !== void 0) {
  851. const t10 = this._patternMap, e4 = t10.get(o6);
  852. e4 ? e4[1] += s7 : t10.set(o6, [this._fillIndexStart + this._fillIndexCount, s7]);
  853. }
  854. this._fillIndexCount += s7;
  855. }
  856. } else {
  857. const t8 = h4.length;
  858. if (t8 > 0) {
  859. const e3 = this._fillVertexBuffer.index;
  860. let i = 0;
  861. for (; i < u4; )
  862. this._fillVertexBuffer.add(d2[i++], d2[i++], n5);
  863. let r8 = 0;
  864. for (; r8 < t8; )
  865. this._fillIndexBuffer.add(e3 + h4[r8++], e3 + h4[r8++], e3 + h4[r8++]);
  866. if (o6 !== void 0) {
  867. const e4 = this._patternMap, i2 = e4.get(o6);
  868. i2 ? i2[1] += t8 : e4.set(o6, [this._fillIndexStart + this._fillIndexCount, t8]);
  869. }
  870. this._fillIndexCount += t8;
  871. }
  872. }
  873. t.release(d2);
  874. }
  875. _isClipEdge(t8, e3) {
  876. return t8.x === e3.x ? t8.x <= -64 || t8.x >= 4160 : t8.y === e3.y && (t8.y <= -64 || t8.y >= 4160);
  877. }
  878. static _area(t8) {
  879. let e3 = 0;
  880. const i = t8.length - 1;
  881. for (let r7 = 0; r7 < i; r7++)
  882. e3 += (t8[r7].x - t8[r7 + 1].x) * (t8[r7].y + t8[r7 + 1].y);
  883. return e3 += (t8[i].x - t8[0].x) * (t8[i].y + t8[0].y), 0.5 * e3;
  884. }
  885. };
  886. // node_modules/@arcgis/core/views/2d/engine/vectorTiles/buckets/LineBucket.js
  887. var s5 = 65535;
  888. var n4 = class extends t7 {
  889. constructor(t8, s6, n5, a9, o6) {
  890. super(t8, s6, n5), this.type = I.LINE, this._tessellationOptions = { pixelCoordRatio: 8, halfWidth: 0, offset: 0 }, this._patternMap = new Map(), this.tessellationProperties = { _lineVertexBuffer: null, _lineIndexBuffer: null, _ddValues: null }, this.tessellationProperties._lineVertexBuffer = a9, this.tessellationProperties._lineIndexBuffer = o6, this._lineTessellator = new d(r6(this.tessellationProperties), l4(this.tessellationProperties), t8.canUseThinTessellation);
  891. }
  892. get lineIndexStart() {
  893. return this._lineIndexStart;
  894. }
  895. get lineIndexCount() {
  896. return this._lineIndexCount;
  897. }
  898. getResources(e3, t8, i) {
  899. const s6 = this.layer, n5 = this.zoom, r7 = s6.hasDataDrivenLine, l5 = s6.getPaintProperty("line-pattern"), a9 = s6.getPaintProperty("line-dasharray"), o6 = s6.getLayoutProperty("line-cap");
  900. if (!l5 && !a9)
  901. return;
  902. const u4 = o6?.getValue(n5) || 0, f3 = o6?.isDataDriven;
  903. if (r7) {
  904. const e4 = l5?.isDataDriven, i2 = a9?.isDataDriven;
  905. if (!e4 && !i2)
  906. return;
  907. for (const r8 of this._features)
  908. t8(e4 ? l5.getValue(n5, r8) : this._getDashArrayKey(r8, n5, s6, a9, f3, o6, u4));
  909. } else if (l5)
  910. t8(l5.getValue(n5));
  911. else if (a9) {
  912. const e4 = a9.getValue(n5);
  913. t8(s6.getDashKey(e4, u4));
  914. }
  915. }
  916. processFeatures(e3) {
  917. this._lineIndexStart = 3 * this.tessellationProperties._lineIndexBuffer.index, this._lineIndexCount = 0;
  918. const t8 = this.layer, i = this.zoom, s6 = this._features, n5 = this._tessellationOptions, { hasDataDrivenLine: r7, lineMaterial: l5 } = t8;
  919. e3 && e3.setExtent(this.layerExtent);
  920. const a9 = t8.getPaintProperty("line-pattern"), o6 = t8.getPaintProperty("line-dasharray"), u4 = a9?.isDataDriven, f3 = o6?.isDataDriven;
  921. let h4;
  922. h4 = t8.getLayoutProperty("line-cap");
  923. const p4 = h4?.isDataDriven ? h4 : null, g3 = p4 ? null : t8.getLayoutValue("line-cap", i), y2 = g3 || 0, d2 = !!p4;
  924. h4 = t8.getLayoutProperty("line-join");
  925. const c4 = h4?.isDataDriven ? h4 : null, _ = c4 ? null : t8.getLayoutValue("line-join", i);
  926. h4 = t8.getLayoutProperty("line-miter-limit");
  927. const x3 = h4?.isDataDriven ? h4 : null, D = x3 ? null : t8.getLayoutValue("line-miter-limit", i);
  928. h4 = t8.getLayoutProperty("line-round-limit");
  929. const m3 = h4?.isDataDriven ? h4 : null, V = m3 ? null : t8.getLayoutValue("line-round-limit", i);
  930. h4 = t8.getPaintProperty("line-width");
  931. const P2 = h4?.isDataDriven ? h4 : null, I5 = P2 ? null : t8.getPaintValue("line-width", i);
  932. h4 = t8.getPaintProperty("line-offset");
  933. const L2 = h4?.isDataDriven ? h4 : null, B2 = L2 ? null : t8.getPaintValue("line-offset", i);
  934. if (u4 || f3) {
  935. const r8 = [];
  936. for (const n6 of s6) {
  937. const s7 = u4 ? a9.getValue(i, n6) : this._getDashArrayKey(n6, i, t8, o6, d2, p4, y2), f4 = this._spriteInfo[s7];
  938. if (!f4 || !f4.rect)
  939. continue;
  940. const h5 = l5.encodeAttributes(n6, i, t8, f4), v = n6.getGeometry(e3);
  941. r8.push({ ddAttributes: h5, page: f4.page, cap: p4 ? p4.getValue(i, n6) : g3, join: c4 ? c4.getValue(i, n6) : _, miterLimit: x3 ? x3.getValue(i, n6) : D, roundLimit: m3 ? m3.getValue(i, n6) : V, halfWidth: 0.5 * (P2 ? P2.getValue(i, n6) : I5), offset: L2 ? L2.getValue(i, n6) : B2, geometry: v });
  942. }
  943. r8.sort((e4, t9) => e4.page - t9.page), n5.textured = true;
  944. for (const { ddAttributes: e4, page: t9, cap: i2, join: s7, miterLimit: l6, roundLimit: a10, halfWidth: o7, offset: u5, geometry: f4 } of r8)
  945. n5.capType = i2, n5.joinType = s7, n5.miterLimit = l6, n5.roundLimit = a10, n5.halfWidth = o7, n5.offset = u5, this._processFeature(f4, e4, t9);
  946. } else {
  947. n5.textured = !(!a9 && !o6), n5.capType = g3, n5.joinType = _, n5.miterLimit = D, n5.roundLimit = V, n5.halfWidth = 0.5 * I5, n5.offset = B2;
  948. for (const a10 of s6) {
  949. const s7 = r7 ? l5.encodeAttributes(a10, i, t8) : null;
  950. p4 && (n5.capType = p4.getValue(i, a10)), c4 && (n5.joinType = c4.getValue(i, a10)), x3 && (n5.miterLimit = x3.getValue(i, a10)), m3 && (n5.roundLimit = m3.getValue(i, a10)), P2 && (n5.halfWidth = 0.5 * P2.getValue(i, a10)), L2 && (n5.offset = L2.getValue(i, a10));
  951. const o7 = a10.getGeometry(e3);
  952. this._processFeature(o7, s7);
  953. }
  954. }
  955. }
  956. serialize() {
  957. let e3 = 6;
  958. e3 += this.layerUIDs.length, e3 += this.tessellationProperties._lineVertexBuffer.array.length, e3 += this.tessellationProperties._lineIndexBuffer.array.length, e3 += 3 * this._patternMap.size + 1;
  959. const t8 = new Uint32Array(e3), i = new Int32Array(t8.buffer);
  960. let s6 = 0;
  961. t8[s6++] = this.type, t8[s6++] = this.layerUIDs.length;
  962. for (let l5 = 0; l5 < this.layerUIDs.length; l5++)
  963. t8[s6++] = this.layerUIDs[l5];
  964. t8[s6++] = this._lineIndexStart, t8[s6++] = this._lineIndexCount;
  965. const n5 = this._patternMap, r7 = n5.size;
  966. if (t8[s6++] = r7, r7 > 0)
  967. for (const [l5, [a9, o6]] of n5)
  968. t8[s6++] = l5, t8[s6++] = a9, t8[s6++] = o6;
  969. t8[s6++] = this.tessellationProperties._lineVertexBuffer.array.length;
  970. for (let l5 = 0; l5 < this.tessellationProperties._lineVertexBuffer.array.length; l5++)
  971. i[s6++] = this.tessellationProperties._lineVertexBuffer.array[l5];
  972. t8[s6++] = this.tessellationProperties._lineIndexBuffer.array.length;
  973. for (let l5 = 0; l5 < this.tessellationProperties._lineIndexBuffer.array.length; l5++)
  974. t8[s6++] = this.tessellationProperties._lineIndexBuffer.array[l5];
  975. return t8.buffer;
  976. }
  977. _processFeature(e3, t8, i) {
  978. if (!e3)
  979. return;
  980. const s6 = e3.length;
  981. for (let n5 = 0; n5 < s6; n5++)
  982. this._processGeometry(e3[n5], t8, i);
  983. }
  984. _processGeometry(e3, t8, i) {
  985. if (e3.length < 2)
  986. return;
  987. const n5 = 1e-3;
  988. let r7, l5, a9 = e3[0], o6 = 1;
  989. for (; o6 < e3.length; )
  990. r7 = e3[o6].x - a9.x, l5 = e3[o6].y - a9.y, r7 * r7 + l5 * l5 < n5 * n5 ? e3.splice(o6, 1) : (a9 = e3[o6], ++o6);
  991. if (e3.length < 2)
  992. return;
  993. const u4 = this.tessellationProperties._lineIndexBuffer, f3 = 3 * u4.index;
  994. this._tessellationOptions.initialDistance = 0, this._tessellationOptions.wrapDistance = s5, this.tessellationProperties._ddValues = t8, this._lineTessellator.tessellate(e3, this._tessellationOptions);
  995. const h4 = 3 * u4.index - f3;
  996. if (i !== void 0) {
  997. const e4 = this._patternMap, t9 = e4.get(i);
  998. t9 ? t9[1] += h4 : e4.set(i, [f3 + this._lineIndexCount, h4]);
  999. }
  1000. this._lineIndexCount += h4;
  1001. }
  1002. _getDashArrayKey(e3, t8, i, s6, n5, r7, l5) {
  1003. const a9 = n5 ? r7.getValue(t8, e3) : l5, o6 = s6.getValue(t8, e3);
  1004. return i.getDashKey(o6, a9);
  1005. }
  1006. };
  1007. var r6 = (e3) => (t8, i, s6, n5, r7, l5, a9, o6, u4, f3, h4) => (e3._lineVertexBuffer.add(t8, i, a9, o6, s6, n5, r7, l5, u4, f3, h4, e3._ddValues), e3._lineVertexBuffer.index - 1);
  1008. var l4 = (e3) => (t8, i, s6) => {
  1009. e3._lineIndexBuffer.add(t8, i, s6);
  1010. };
  1011. // node_modules/@arcgis/core/views/2d/engine/vectorTiles/buckets/SymbolBucket.js
  1012. var I3 = 10;
  1013. function b3(e3, t8) {
  1014. return e3.iconMosaicItem && t8.iconMosaicItem ? e3.iconMosaicItem.page === t8.iconMosaicItem.page ? 0 : e3.iconMosaicItem.page - t8.iconMosaicItem.page : e3.iconMosaicItem && !t8.iconMosaicItem ? 1 : !e3.iconMosaicItem && t8.iconMosaicItem ? -1 : 0;
  1015. }
  1016. var A = class extends t7 {
  1017. constructor(e3, t8, i, s6, a9, o6, r7, l5) {
  1018. super(e3, t8, l5.getSpriteItems()), this.type = I.SYMBOL, this._markerMap = new Map(), this._glyphMap = new Map(), this._glyphBufferDataStorage = new Map(), this._isIconSDF = false, this._iconVertexBuffer = i, this._iconIndexBuffer = s6, this._textVertexBuffer = a9, this._textIndexBuffer = o6, this._placementEngine = r7, this._workerTileHandler = l5;
  1019. }
  1020. get markerPageMap() {
  1021. return this._markerMap;
  1022. }
  1023. get glyphsPageMap() {
  1024. return this._glyphMap;
  1025. }
  1026. get symbolInstances() {
  1027. return this._symbolInstances;
  1028. }
  1029. getResources(e3, n5, i) {
  1030. const s6 = this.layer, a9 = this.zoom;
  1031. e3 && e3.setExtent(this.layerExtent);
  1032. const o6 = s6.getLayoutProperty("icon-image"), r7 = s6.getLayoutProperty("text-field");
  1033. let l5 = s6.getLayoutProperty("text-transform"), h4 = s6.getLayoutProperty("text-font");
  1034. const x3 = [];
  1035. let c4, g3, f3, y2;
  1036. o6 && !o6.isDataDriven && (c4 = o6.getValue(a9)), r7 && !r7.isDataDriven && (g3 = r7.getValue(a9)), l5 && l5.isDataDriven || (f3 = s6.getLayoutValue("text-transform", a9), l5 = null), h4 && h4.isDataDriven || (y2 = s6.getLayoutValue("text-font", a9), h4 = null);
  1037. for (const m3 of this._features) {
  1038. const u4 = m3.getGeometry(e3);
  1039. if (!u4 || u4.length === 0)
  1040. continue;
  1041. let p4, _;
  1042. o6 && (p4 = o6.isDataDriven ? o6.getValue(a9, m3) : this._replaceKeys(c4, m3.values), p4 && n5(p4));
  1043. let M = false;
  1044. if (r7 && (_ = r7.isDataDriven ? r7.getValue(a9, m3) : this._replaceKeys(g3, m3.values), _)) {
  1045. switch (_ = _.replace(/\\n/g, "\n"), l5 && (f3 = l5.getValue(a9, m3)), f3) {
  1046. case o2.LOWERCASE:
  1047. _ = _.toLowerCase();
  1048. break;
  1049. case o2.UPPERCASE:
  1050. _ = _.toUpperCase();
  1051. }
  1052. if (A._bidiEngine.hasBidiChar(_)) {
  1053. let e5;
  1054. e5 = A._bidiEngine.checkContextual(_) === "rtl" ? "IDNNN" : "ICNNN", _ = A._bidiEngine.bidiTransform(_, e5, "VLYSN"), M = true;
  1055. }
  1056. const e4 = _.length;
  1057. if (e4 > 0) {
  1058. h4 && (y2 = h4.getValue(a9, m3));
  1059. for (const t8 of y2) {
  1060. let n6 = i[t8];
  1061. n6 || (n6 = i[t8] = new Set());
  1062. for (let t9 = 0; t9 < e4; t9++) {
  1063. const e5 = _.charCodeAt(t9);
  1064. n6.add(e5);
  1065. }
  1066. }
  1067. }
  1068. }
  1069. if (!p4 && !_)
  1070. continue;
  1071. const P2 = s6.getLayoutValue("symbol-sort-key", a9, m3), I5 = { feature: m3, sprite: p4, label: _, rtl: M, geometry: u4, hash: (_ ? c(_) : 0) ^ (p4 ? c(p4) : 0), priority: P2, textFont: y2 };
  1072. x3.push(I5);
  1073. }
  1074. this._symbolFeatures = x3;
  1075. }
  1076. processFeatures(e3) {
  1077. e3 && e3.setExtent(this.layerExtent);
  1078. const t8 = this.layer, n5 = this.zoom, s6 = t8.getLayoutValue("symbol-placement", n5), a9 = s6 !== n3.POINT, c4 = t8.getLayoutValue("symbol-spacing", n5) * w, d2 = t8.getLayoutProperty("icon-image"), P2 = t8.getLayoutProperty("text-field"), I5 = d2 ? new m2(t8, n5, a9) : null, L2 = P2 ? new T(t8, n5, a9) : null, V = this._workerTileHandler;
  1079. let T4;
  1080. d2 && (T4 = V.getSpriteItems()), this._iconIndexStart = 3 * this._iconIndexBuffer.index, this._textIndexStart = 3 * this._textIndexBuffer.index, this._iconIndexCount = 0, this._textIndexCount = 0, this._markerMap.clear(), this._glyphMap.clear();
  1081. const w3 = [];
  1082. let B2 = 1;
  1083. L2 && L2.size && (B2 = L2.size / c3);
  1084. const C2 = L2 ? L2.maxAngle * f : 0, R = L2 ? L2.size * w : 0;
  1085. for (const i of this._symbolFeatures) {
  1086. let e4;
  1087. I5 && T4 && i.sprite && (e4 = T4[i.sprite], e4 && e4.sdf && (this._isIconSDF = true));
  1088. let t9;
  1089. !!e4 && I5.update(n5, i.feature);
  1090. let d3 = 0;
  1091. const p4 = i.label;
  1092. if (p4) {
  1093. L2.update(n5, i.feature);
  1094. const e5 = a9 ? L2.keepUpright : L2.writingMode && L2.writingMode.includes(p2.VERTICAL);
  1095. let s7 = 0.5;
  1096. switch (L2.anchor) {
  1097. case m.TOP_LEFT:
  1098. case m.LEFT:
  1099. case m.BOTTOM_LEFT:
  1100. s7 = 0;
  1101. break;
  1102. case m.TOP_RIGHT:
  1103. case m.RIGHT:
  1104. case m.BOTTOM_RIGHT:
  1105. s7 = 1;
  1106. }
  1107. let r7 = 0.5;
  1108. switch (L2.anchor) {
  1109. case m.TOP_LEFT:
  1110. case m.TOP:
  1111. case m.TOP_RIGHT:
  1112. r7 = 0;
  1113. break;
  1114. case m.BOTTOM_LEFT:
  1115. case m.BOTTOM:
  1116. case m.BOTTOM_RIGHT:
  1117. r7 = 1;
  1118. }
  1119. let l5 = 0.5;
  1120. switch (L2.justify) {
  1121. case u.AUTO:
  1122. l5 = s7;
  1123. break;
  1124. case u.LEFT:
  1125. l5 = 0;
  1126. break;
  1127. case u.RIGHT:
  1128. l5 = 1;
  1129. }
  1130. const c5 = L2.letterSpacing * c3, g3 = a9 ? 0 : L2.maxWidth * c3, u4 = L2.lineHeight * c3, _ = i.textFont.map((e6) => V.getGlyphItems(e6));
  1131. if (t9 = new a6(_, g3, u4, c5, s7, r7, l5).getShaping(p4, i.rtl, e5), t9 && t9.length > 0) {
  1132. let e6 = 1e30, n6 = -1e30;
  1133. for (const i2 of t9)
  1134. e6 = Math.min(e6, i2.x), n6 = Math.max(n6, i2.x);
  1135. d3 = (n6 - e6 + 2 * c3) * B2 * w;
  1136. }
  1137. }
  1138. for (let n6 of i.geometry) {
  1139. const h4 = [];
  1140. if (s6 === n3.LINE) {
  1141. if (t9 && t9.length > 0 && L2 && L2.size) {
  1142. const e5 = L2.size * w * (2 + Math.min(2, 4 * Math.abs(L2.offset[1])));
  1143. n6 = A._smoothVertices(n6, e5);
  1144. }
  1145. A._pushAnchors(h4, n6, c4, d3);
  1146. } else
  1147. s6 === n3.LINE_CENTER ? A._pushCenterAnchor(h4, n6) : i.feature.type === s.Polygon ? A._pushCentroid(h4, n6) : h4.push(new T2(n6[0].x, n6[0].y));
  1148. for (const s7 of h4) {
  1149. if (s7.x < 0 || s7.x > x2 || s7.y < 0 || s7.y > x2)
  1150. continue;
  1151. if (a9 && d3 > 0 && L2.rotationAlignment === l2.MAP && !A._honorsTextMaxAngle(n6, s7, d3, C2, R))
  1152. continue;
  1153. const o6 = { shaping: t9, line: n6, iconMosaicItem: e4, anchor: s7, symbolFeature: i, textColliders: [], iconColliders: [], textVertexRanges: [], iconVertexRanges: [] };
  1154. w3.push(o6), this._processFeature(o6, I5, L2);
  1155. }
  1156. }
  1157. }
  1158. w3.sort(b3), this._addPlacedGlyphs(), this._symbolInstances = w3;
  1159. }
  1160. serialize() {
  1161. let e3 = 11;
  1162. e3 += this.layerUIDs.length, e3 += 3 * this.markerPageMap.size, e3 += 3 * this.glyphsPageMap.size, e3 += A._symbolsSerializationLength(this._symbolInstances), e3 += this._iconVertexBuffer.array.length, e3 += this._iconIndexBuffer.array.length, e3 += this._textVertexBuffer.array.length, e3 += this._textIndexBuffer.array.length;
  1163. const t8 = new Uint32Array(e3), n5 = new Int32Array(t8.buffer), i = new Float32Array(t8.buffer);
  1164. let s6 = 0;
  1165. t8[s6++] = this.type, t8[s6++] = this.layerUIDs.length;
  1166. for (let a9 = 0; a9 < this.layerUIDs.length; a9++)
  1167. t8[s6++] = this.layerUIDs[a9];
  1168. t8[s6++] = this._isIconSDF ? 1 : 0, t8[s6++] = this.markerPageMap.size;
  1169. for (const [a9, [o6, r7]] of this.markerPageMap)
  1170. t8[s6++] = a9, t8[s6++] = o6, t8[s6++] = r7;
  1171. t8[s6++] = this.glyphsPageMap.size;
  1172. for (const [a9, [o6, r7]] of this.glyphsPageMap)
  1173. t8[s6++] = a9, t8[s6++] = o6, t8[s6++] = r7;
  1174. t8[s6++] = this._iconVertexBuffer.index / 4, t8[s6++] = this._textVertexBuffer.index / 4, s6 = A.serializeSymbols(t8, n5, i, s6, this._symbolInstances), t8[s6++] = this._iconVertexBuffer.array.length;
  1175. for (let a9 = 0; a9 < this._iconVertexBuffer.array.length; a9++)
  1176. n5[s6++] = this._iconVertexBuffer.array[a9];
  1177. t8[s6++] = this._iconIndexBuffer.array.length;
  1178. for (let a9 = 0; a9 < this._iconIndexBuffer.array.length; a9++)
  1179. t8[s6++] = this._iconIndexBuffer.array[a9];
  1180. t8[s6++] = this._textVertexBuffer.array.length;
  1181. for (let a9 = 0; a9 < this._textVertexBuffer.array.length; a9++)
  1182. n5[s6++] = this._textVertexBuffer.array[a9];
  1183. t8[s6++] = this._textIndexBuffer.array.length;
  1184. for (let a9 = 0; a9 < this._textIndexBuffer.array.length; a9++)
  1185. t8[s6++] = this._textIndexBuffer.array[a9];
  1186. return t8.buffer;
  1187. }
  1188. static _symbolsSerializationLength(e3) {
  1189. let t8 = 0;
  1190. t8 += 1;
  1191. for (const n5 of e3 || []) {
  1192. t8 += 4, t8 += 1;
  1193. for (const e4 of n5.textColliders)
  1194. t8 += I3;
  1195. for (const e4 of n5.iconColliders)
  1196. t8 += I3;
  1197. t8 += 1, t8 += 2 * n5.textVertexRanges.length, t8 += 1, t8 += 2 * n5.iconVertexRanges.length;
  1198. }
  1199. return t8;
  1200. }
  1201. static serializeSymbols(e3, t8, n5, i, s6) {
  1202. s6 = s6 || [], t8[i++] = s6.length;
  1203. for (const a9 of s6) {
  1204. t8[i++] = a9.anchor.x, t8[i++] = a9.anchor.y, t8[i++] = a9.symbolFeature.hash, t8[i++] = a9.symbolFeature.priority, t8[i++] = a9.textColliders.length + a9.iconColliders.length;
  1205. for (const e4 of a9.textColliders)
  1206. t8[i++] = e4.xTile, t8[i++] = e4.yTile, t8[i++] = e4.dxPixels, t8[i++] = e4.dyPixels, t8[i++] = e4.hard ? 1 : 0, t8[i++] = e4.partIndex, n5[i++] = e4.minLod, n5[i++] = e4.maxLod, t8[i++] = e4.width, t8[i++] = e4.height;
  1207. for (const e4 of a9.iconColliders)
  1208. t8[i++] = e4.xTile, t8[i++] = e4.yTile, t8[i++] = e4.dxPixels, t8[i++] = e4.dyPixels, t8[i++] = e4.hard ? 1 : 0, t8[i++] = e4.partIndex, n5[i++] = e4.minLod, n5[i++] = e4.maxLod, t8[i++] = e4.width, t8[i++] = e4.height;
  1209. t8[i++] = a9.textVertexRanges.length;
  1210. for (const [e4, n6] of a9.textVertexRanges)
  1211. t8[i++] = e4, t8[i++] = n6;
  1212. t8[i++] = a9.iconVertexRanges.length;
  1213. for (const [e4, n6] of a9.iconVertexRanges)
  1214. t8[i++] = e4, t8[i++] = n6;
  1215. }
  1216. return i;
  1217. }
  1218. _replaceKeys(e3, t8) {
  1219. return e3.replace(/{([^{}]+)}/g, (e4, n5) => n5 in t8 ? t8[n5] : "");
  1220. }
  1221. _processFeature(e3, t8, n5) {
  1222. const { line: i, iconMosaicItem: a9, shaping: o6, anchor: r7 } = e3, l5 = this.zoom, h4 = this.layer, x3 = !!a9;
  1223. let c4 = true;
  1224. x3 && (c4 = t8.optional || !a9);
  1225. const d2 = o6 && o6.length > 0;
  1226. let g3, f3, y2 = true;
  1227. if (d2 && (y2 = n5.optional), x3 && (g3 = this._placementEngine.getIconPlacement(r7, a9, t8)), (g3 || c4) && (d2 && (f3 = this._placementEngine.getTextPlacement(r7, o6, i, n5)), f3 || y2)) {
  1228. if (g3 && f3 || (y2 || c4 ? y2 || f3 ? c4 || g3 || (f3 = null) : g3 = null : (g3 = null, f3 = null)), f3) {
  1229. const t9 = h4.hasDataDrivenText ? h4.textMaterial.encodeAttributes(e3.symbolFeature.feature, l5, h4) : null;
  1230. if (this._storePlacedGlyphs(e3, f3.shapes, l5, n5.rotationAlignment, t9), f3.textColliders) {
  1231. e3.textColliders = f3.textColliders;
  1232. for (const e4 of f3.textColliders) {
  1233. e4.minLod = Math.max(l5 + P(e4.minLod), 0), e4.maxLod = Math.min(l5 + P(e4.maxLod), 25);
  1234. const t10 = e4.angle;
  1235. if (t10) {
  1236. const n6 = Math.cos(t10), i2 = Math.sin(t10), s6 = e4.dxPixels * n6 - e4.dyPixels * i2, a10 = e4.dxPixels * i2 + e4.dyPixels * n6, o7 = (e4.dxPixels + e4.width) * n6 - e4.dyPixels * i2, r8 = (e4.dxPixels + e4.width) * i2 + e4.dyPixels * n6, l6 = e4.dxPixels * n6 - (e4.dyPixels + e4.height) * i2, h5 = e4.dxPixels * i2 + (e4.dyPixels + e4.height) * n6, x4 = (e4.dxPixels + e4.width) * n6 - (e4.dyPixels + e4.height) * i2, c5 = (e4.dxPixels + e4.width) * i2 + (e4.dyPixels + e4.height) * n6, d3 = Math.min(s6, o7, l6, x4), g4 = Math.max(s6, o7, l6, x4), f4 = Math.min(a10, r8, h5, c5), y3 = Math.max(a10, r8, h5, c5);
  1237. e4.dxPixels = d3, e4.dyPixels = f4, e4.width = g4 - d3, e4.height = y3 - f4;
  1238. }
  1239. }
  1240. }
  1241. }
  1242. if (g3) {
  1243. const n6 = h4.hasDataDrivenIcon ? h4.iconMaterial.encodeAttributes(e3.symbolFeature.feature, l5, h4) : null;
  1244. if (this._addPlacedIcons(e3, g3.shapes, l5, a9.page, t8.rotationAlignment === l2.VIEWPORT, n6), g3.iconColliders) {
  1245. e3.iconColliders = g3.iconColliders;
  1246. for (const e4 of g3.iconColliders) {
  1247. e4.minLod = Math.max(l5 + P(e4.minLod), 0), e4.maxLod = Math.min(l5 + P(e4.maxLod), 25);
  1248. const t9 = e4.angle;
  1249. if (t9) {
  1250. const n7 = Math.cos(t9), i2 = Math.sin(t9), s6 = e4.dxPixels * n7 - e4.dyPixels * i2, a10 = e4.dxPixels * i2 + e4.dyPixels * n7, o7 = (e4.dxPixels + e4.width) * n7 - e4.dyPixels * i2, r8 = (e4.dxPixels + e4.width) * i2 + e4.dyPixels * n7, l6 = e4.dxPixels * n7 - (e4.dyPixels + e4.height) * i2, h5 = e4.dxPixels * i2 + (e4.dyPixels + e4.height) * n7, x4 = (e4.dxPixels + e4.width) * n7 - (e4.dyPixels + e4.height) * i2, c5 = (e4.dxPixels + e4.width) * i2 + (e4.dyPixels + e4.height) * n7, d3 = Math.min(s6, o7, l6, x4), g4 = Math.max(s6, o7, l6, x4), f4 = Math.min(a10, r8, h5, c5), y3 = Math.max(a10, r8, h5, c5);
  1251. e4.dxPixels = d3, e4.dyPixels = f4, e4.width = g4 - d3, e4.height = y3 - f4;
  1252. }
  1253. }
  1254. }
  1255. }
  1256. }
  1257. }
  1258. _addPlacedIcons(e3, t8, n5, i, a9, o6) {
  1259. const r7 = Math.max(n5 - 1, 0), l5 = this._iconVertexBuffer, h4 = this._iconIndexBuffer, x3 = this._markerMap;
  1260. for (const c4 of t8) {
  1261. const t9 = a9 ? 0 : Math.max(n5 + P(c4.minzoom), r7), d2 = a9 ? 25 : Math.min(n5 + P(c4.maxzoom), 25);
  1262. if (d2 <= t9)
  1263. continue;
  1264. const g3 = c4.tl, f3 = c4.tr, y2 = c4.bl, m3 = c4.br, u4 = c4.mosaicRect, p4 = c4.labelAngle, _ = c4.minAngle, M = c4.maxAngle, P2 = c4.anchor, I5 = l5.index, b4 = u4.x, A2 = u4.y, L2 = b4 + u4.width, V = A2 + u4.height, T4 = l5.index;
  1265. l5.add(P2.x, P2.y, g3.x, g3.y, b4, A2, p4, _, M, t9, d2, o6), l5.add(P2.x, P2.y, f3.x, f3.y, L2, A2, p4, _, M, t9, d2, o6), l5.add(P2.x, P2.y, y2.x, y2.y, b4, V, p4, _, M, t9, d2, o6), l5.add(P2.x, P2.y, m3.x, m3.y, L2, V, p4, _, M, t9, d2, o6), e3.iconVertexRanges.length > 0 && e3.iconVertexRanges[0][0] + e3.iconVertexRanges[0][1] === T4 ? e3.iconVertexRanges[0][1] += 4 : e3.iconVertexRanges.push([T4, 4]), h4.add(I5 + 0, I5 + 1, I5 + 2), h4.add(I5 + 1, I5 + 2, I5 + 3), x3.has(i) ? x3.get(i)[1] += 6 : x3.set(i, [this._iconIndexStart + this._iconIndexCount, 6]), this._iconIndexCount += 6;
  1266. }
  1267. }
  1268. _addPlacedGlyphs() {
  1269. const e3 = this._textVertexBuffer, t8 = this._textIndexBuffer, n5 = this._glyphMap;
  1270. for (const [i, s6] of this._glyphBufferDataStorage)
  1271. for (const a9 of s6) {
  1272. const s7 = e3.index, o6 = a9.symbolInstance, r7 = a9.ddAttributes, l5 = e3.index;
  1273. e3.add(a9.glyphAnchor[0], a9.glyphAnchor[1], a9.tl[0], a9.tl[1], a9.xmin, a9.ymin, a9.labelAngle, a9.minAngle, a9.maxAngle, a9.minLod, a9.maxLod, r7), e3.add(a9.glyphAnchor[0], a9.glyphAnchor[1], a9.tr[0], a9.tr[1], a9.xmax, a9.ymin, a9.labelAngle, a9.minAngle, a9.maxAngle, a9.minLod, a9.maxLod, r7), e3.add(a9.glyphAnchor[0], a9.glyphAnchor[1], a9.bl[0], a9.bl[1], a9.xmin, a9.ymax, a9.labelAngle, a9.minAngle, a9.maxAngle, a9.minLod, a9.maxLod, r7), e3.add(a9.glyphAnchor[0], a9.glyphAnchor[1], a9.br[0], a9.br[1], a9.xmax, a9.ymax, a9.labelAngle, a9.minAngle, a9.maxAngle, a9.minLod, a9.maxLod, r7), o6.textVertexRanges.length > 0 && o6.textVertexRanges[0][0] + o6.textVertexRanges[0][1] === l5 ? o6.textVertexRanges[0][1] += 4 : o6.textVertexRanges.push([l5, 4]), t8.add(s7 + 0, s7 + 1, s7 + 2), t8.add(s7 + 1, s7 + 2, s7 + 3), n5.has(i) ? n5.get(i)[1] += 6 : n5.set(i, [this._textIndexStart + this._textIndexCount, 6]), this._textIndexCount += 6;
  1274. }
  1275. this._glyphBufferDataStorage.clear();
  1276. }
  1277. _storePlacedGlyphs(e3, t8, n5, i, a9) {
  1278. const o6 = Math.max(n5 - 1, 0), r7 = i === l2.VIEWPORT;
  1279. let l5, h4, x3, c4, d2, g3, f3, y2, m3, p4, _;
  1280. for (const u4 of t8) {
  1281. if (l5 = r7 ? 0 : Math.max(n5 + P(u4.minzoom), o6), h4 = r7 ? 25 : Math.min(n5 + P(u4.maxzoom), 25), h4 <= l5)
  1282. continue;
  1283. x3 = u4.tl, c4 = u4.tr, d2 = u4.bl, g3 = u4.br, f3 = u4.labelAngle, y2 = u4.minAngle, m3 = u4.maxAngle, p4 = u4.anchor, _ = u4.mosaicRect, this._glyphBufferDataStorage.has(u4.page) || this._glyphBufferDataStorage.set(u4.page, []);
  1284. this._glyphBufferDataStorage.get(u4.page).push({ glyphAnchor: [p4.x, p4.y], tl: [x3.x, x3.y], tr: [c4.x, c4.y], bl: [d2.x, d2.y], br: [g3.x, g3.y], xmin: _.x, ymin: _.y, xmax: _.x + _.width, ymax: _.y + _.height, labelAngle: f3, minAngle: y2, maxAngle: m3, minLod: l5, maxLod: h4, placementLod: o6, symbolInstance: e3, ddAttributes: a9 });
  1285. }
  1286. }
  1287. static _pushAnchors(e3, t8, n5, i) {
  1288. n5 += i;
  1289. let s6 = 0;
  1290. const o6 = t8.length - 1;
  1291. for (let a9 = 0; a9 < o6; a9++)
  1292. s6 += t3.distance(t8[a9], t8[a9 + 1]);
  1293. let l5 = i || n5;
  1294. if (l5 *= 0.5, s6 <= l5)
  1295. return;
  1296. const h4 = l5 / s6;
  1297. let x3 = 0, c4 = -(n5 = s6 / Math.max(Math.round(s6 / n5), 1)) / 2;
  1298. const d2 = t8.length - 1;
  1299. for (let g3 = 0; g3 < d2; g3++) {
  1300. const i2 = t8[g3], s7 = t8[g3 + 1], o7 = s7.x - i2.x, l6 = s7.y - i2.y, d3 = Math.sqrt(o7 * o7 + l6 * l6);
  1301. let f3;
  1302. for (; c4 + n5 < x3 + d3; ) {
  1303. c4 += n5;
  1304. const t9 = (c4 - x3) / d3, y2 = b(i2.x, s7.x, t9), m3 = b(i2.y, s7.y, t9);
  1305. f3 === void 0 && (f3 = Math.atan2(l6, o7)), e3.push(new T2(y2, m3, f3, g3, h4));
  1306. }
  1307. x3 += d3;
  1308. }
  1309. }
  1310. static _pushCenterAnchor(e3, t8) {
  1311. let n5 = 0;
  1312. const i = t8.length - 1;
  1313. for (let a9 = 0; a9 < i; a9++)
  1314. n5 += t3.distance(t8[a9], t8[a9 + 1]);
  1315. const s6 = n5 / 2;
  1316. let o6 = 0;
  1317. const l5 = t8.length - 1;
  1318. for (let h4 = 0; h4 < l5; h4++) {
  1319. const n6 = t8[h4], i2 = t8[h4 + 1], l6 = i2.x - n6.x, x3 = i2.y - n6.y, c4 = Math.sqrt(l6 * l6 + x3 * x3);
  1320. if (s6 < o6 + c4) {
  1321. const t9 = (s6 - o6) / c4, d2 = b(n6.x, i2.x, t9), g3 = b(n6.y, i2.y, t9), f3 = Math.atan2(x3, l6);
  1322. return void e3.push(new T2(d2, g3, f3, h4, 0));
  1323. }
  1324. o6 += c4;
  1325. }
  1326. }
  1327. static _deviation(e3, t8, n5) {
  1328. const i = (t8.x - e3.x) * (n5.x - t8.x) + (t8.y - e3.y) * (n5.y - t8.y), s6 = (t8.x - e3.x) * (n5.y - t8.y) - (t8.y - e3.y) * (n5.x - t8.x);
  1329. return Math.atan2(s6, i);
  1330. }
  1331. static _honorsTextMaxAngle(e3, t8, n5, i, s6) {
  1332. let a9 = 0;
  1333. const o6 = n5 / 2;
  1334. let r7 = new t3(t8.x, t8.y), l5 = t8.segment + 1;
  1335. for (; a9 > -o6; ) {
  1336. if (--l5, l5 < 0)
  1337. return false;
  1338. a9 -= t3.distance(e3[l5], r7), r7 = e3[l5];
  1339. }
  1340. a9 += t3.distance(e3[l5], e3[l5 + 1]);
  1341. const h4 = [];
  1342. let x3 = 0;
  1343. const c4 = e3.length;
  1344. for (; a9 < o6; ) {
  1345. const t9 = e3[l5];
  1346. let n6, o7 = l5;
  1347. do {
  1348. if (++o7, o7 === c4)
  1349. return false;
  1350. n6 = e3[o7];
  1351. } while (n6.isEqual(t9));
  1352. let r8, d2 = o7;
  1353. do {
  1354. if (++d2, d2 === c4)
  1355. return false;
  1356. r8 = e3[d2];
  1357. } while (r8.isEqual(n6));
  1358. const g3 = this._deviation(t9, n6, r8);
  1359. for (h4.push({ deviation: g3, distToAnchor: a9 }), x3 += g3; a9 - h4[0].distToAnchor > s6; )
  1360. x3 -= h4.shift().deviation;
  1361. if (Math.abs(x3) > i)
  1362. return false;
  1363. a9 += t3.distance(n6, r8), l5 = o7;
  1364. }
  1365. return true;
  1366. }
  1367. static _smoothVertices(e3, t8) {
  1368. if (t8 <= 0)
  1369. return e3;
  1370. let n5 = e3.length;
  1371. if (n5 < 3)
  1372. return e3;
  1373. const i = [];
  1374. let s6 = 0, a9 = 0;
  1375. i.push(0);
  1376. for (let f3 = 1; f3 < n5; f3++) {
  1377. const t9 = t3.distance(e3[f3], e3[f3 - 1]);
  1378. t9 > 0 && (s6 += t9, i.push(s6), a9++, a9 !== f3 && (e3[a9] = e3[f3]));
  1379. }
  1380. if (n5 = a9 + 1, n5 < 3)
  1381. return e3;
  1382. t8 = Math.min(t8, 0.2 * s6);
  1383. const o6 = e3[0].x, r7 = e3[0].y, l5 = e3[n5 - 1].x, h4 = e3[n5 - 1].y, x3 = t3.sub(e3[0], e3[1]);
  1384. x3.normalize(), e3[0].x += t8 * x3.x, e3[0].y += t8 * x3.y, x3.assignSub(e3[n5 - 1], e3[n5 - 2]), x3.normalize(), e3[n5 - 1].x += t8 * x3.x, e3[n5 - 1].y += t8 * x3.y, i[0] -= t8, i[n5 - 1] += t8;
  1385. const c4 = [];
  1386. c4.push(new t3(o6, r7));
  1387. const d2 = 1e-6, g3 = 0.5 * t8;
  1388. for (let f3 = 1; f3 < n5 - 1; f3++) {
  1389. let s7 = 0, a10 = 0, o7 = 0;
  1390. for (let n6 = f3 - 1; n6 >= 0; n6--) {
  1391. const r8 = g3 + i[n6 + 1] - i[f3];
  1392. if (r8 < 0)
  1393. break;
  1394. const l6 = i[n6 + 1] - i[n6], h5 = i[f3] - i[n6] < g3 ? 1 : r8 / l6;
  1395. if (h5 < d2)
  1396. break;
  1397. const x4 = h5 * h5, c5 = h5 * r8 - 0.5 * x4 * l6, y2 = h5 * l6 / t8, m3 = e3[n6 + 1], u4 = e3[n6].x - m3.x, p4 = e3[n6].y - m3.y;
  1398. s7 += y2 / c5 * (m3.x * h5 * r8 + 0.5 * x4 * (r8 * u4 - l6 * m3.x) - x4 * h5 * l6 * u4 / 3), a10 += y2 / c5 * (m3.y * h5 * r8 + 0.5 * x4 * (r8 * p4 - l6 * m3.y) - x4 * h5 * l6 * p4 / 3), o7 += y2;
  1399. }
  1400. for (let r8 = f3 + 1; r8 < n5; r8++) {
  1401. const n6 = g3 - i[r8 - 1] + i[f3];
  1402. if (n6 < 0)
  1403. break;
  1404. const l6 = i[r8] - i[r8 - 1], h5 = i[r8] - i[f3] < g3 ? 1 : n6 / l6;
  1405. if (h5 < d2)
  1406. break;
  1407. const x4 = h5 * h5, c5 = h5 * n6 - 0.5 * x4 * l6, y2 = h5 * l6 / t8, m3 = e3[r8 - 1], u4 = e3[r8].x - m3.x, p4 = e3[r8].y - m3.y;
  1408. s7 += y2 / c5 * (m3.x * h5 * n6 + 0.5 * x4 * (n6 * u4 - l6 * m3.x) - x4 * h5 * l6 * u4 / 3), a10 += y2 / c5 * (m3.y * h5 * n6 + 0.5 * x4 * (n6 * p4 - l6 * m3.y) - x4 * h5 * l6 * p4 / 3), o7 += y2;
  1409. }
  1410. c4.push(new t3(s7 / o7, a10 / o7));
  1411. }
  1412. return c4.push(new t3(l5, h4)), e3[0].x = o6, e3[0].y = r7, e3[n5 - 1].x = l5, e3[n5 - 1].y = h4, c4;
  1413. }
  1414. static _pushCentroid(e3, t8) {
  1415. const n5 = 0, i = 0, s6 = 4096, a9 = 4096, o6 = t8.length - 1;
  1416. let l5 = 0, h4 = 0, x3 = 0, c4 = t8[0].x, d2 = t8[0].y;
  1417. c4 > s6 && (c4 = s6), c4 < n5 && (c4 = n5), d2 > a9 && (d2 = a9), d2 < i && (d2 = i);
  1418. for (let r7 = 1; r7 < o6; r7++) {
  1419. let e4 = t8[r7].x, o7 = t8[r7].y, g3 = t8[r7 + 1].x, f3 = t8[r7 + 1].y;
  1420. e4 > s6 && (e4 = s6), e4 < n5 && (e4 = n5), o7 > a9 && (o7 = a9), o7 < i && (o7 = i), g3 > s6 && (g3 = s6), g3 < n5 && (g3 = n5), f3 > a9 && (f3 = a9), f3 < i && (f3 = i);
  1421. const y2 = (e4 - c4) * (f3 - d2) - (g3 - c4) * (o7 - d2);
  1422. l5 += y2 * (c4 + e4 + g3), h4 += y2 * (d2 + o7 + f3), x3 += y2;
  1423. }
  1424. l5 /= 3 * x3, h4 /= 3 * x3, isNaN(l5) || isNaN(h4) || e3.push(new T2(l5, h4));
  1425. }
  1426. };
  1427. A._bidiEngine = new C();
  1428. // node_modules/@arcgis/core/views/2d/tiling/enums.js
  1429. var I4;
  1430. !function(I5) {
  1431. I5[I5.INITIALIZED = 0] = "INITIALIZED", I5[I5.NO_DATA = 1] = "NO_DATA", I5[I5.READY = 2] = "READY", I5[I5.MODIFIED = 3] = "MODIFIED", I5[I5.INVALID = 4] = "INVALID";
  1432. }(I4 || (I4 = {}));
  1433. // node_modules/@arcgis/core/views/2d/engine/vectorTiles/TileParser.js
  1434. var T3 = 8;
  1435. var g2 = 14;
  1436. var w2 = 5;
  1437. var B = class {
  1438. constructor(t8, r7, s6, i, o6) {
  1439. if (this._pbfTiles = {}, this._tileClippers = {}, this._client = s6, this._tile = r7, o6) {
  1440. this._styleLayerUIDs = new Set();
  1441. for (const e3 of o6)
  1442. this._styleLayerUIDs.add(e3);
  1443. }
  1444. this._styleRepository = i, this._layers = this._styleRepository.layers;
  1445. const [n5, c4, l5] = r7.tileKey.split("/").map(parseFloat);
  1446. this._level = n5;
  1447. const a9 = T3 + Math.max((this._level - g2) * w2, 0);
  1448. for (const u4 of Object.keys(t8)) {
  1449. const r8 = t8[u4];
  1450. this._pbfTiles[u4] = new a(new Uint8Array(r8.protobuff), new DataView(r8.protobuff));
  1451. if (r8.refKey) {
  1452. const [e3] = r8.refKey.split("/").map(parseFloat), t9 = n5 - e3;
  1453. if (t9 > 0) {
  1454. const e4 = (1 << t9) - 1, r9 = c4 & e4, s7 = l5 & e4;
  1455. this._tileClippers[u4] = new n(t9, r9, s7, 8, a9);
  1456. }
  1457. }
  1458. this._tileClippers[u4] || (this._tileClippers[u4] = new l());
  1459. }
  1460. }
  1461. _canParseStyleLayer(e3) {
  1462. return !this._styleLayerUIDs || this._styleLayerUIDs.has(e3);
  1463. }
  1464. async parse(e3) {
  1465. const t8 = o(), s6 = this._initialize(e3), { returnedBuckets: i } = s6;
  1466. this._processLayers(s6), this._linkReferences(s6), this._filterFeatures(s6);
  1467. const o6 = [], n5 = new Set(), c4 = (e4, t9) => {
  1468. n5.has(e4) || (o6.push({ name: e4, repeat: t9 }), n5.add(e4));
  1469. }, l5 = {};
  1470. for (const r7 of i)
  1471. r7.getResources(r7.tileClipper, c4, l5);
  1472. if (this._tile.status === I4.INVALID)
  1473. return [];
  1474. const a9 = this._fetchResources(o6, l5, e3);
  1475. return Promise.all([...a9, t8]).then(() => this._processFeatures(s6.returnedBuckets));
  1476. }
  1477. _initialize(e3) {
  1478. return { signal: e3 && e3.signal, sourceNameToTileData: this._parseTileData(this._pbfTiles), layers: this._layers, zoom: this._level, sourceNameToTileClipper: this._tileClippers, sourceNameToUniqueSourceLayerBuckets: {}, sourceNameToUniqueSourceLayers: {}, returnedBuckets: [], layerIdToBucket: {}, referencerUIDToReferencedId: new Map() };
  1479. }
  1480. _processLayers(e3) {
  1481. const { sourceNameToTileData: t8, layers: r7, zoom: s6, sourceNameToTileClipper: i, sourceNameToUniqueSourceLayerBuckets: o6, sourceNameToUniqueSourceLayers: n5, returnedBuckets: c4, layerIdToBucket: l5, referencerUIDToReferencedId: a9 } = e3;
  1482. for (let u4 = r7.length - 1; u4 >= 0; u4--) {
  1483. const e4 = r7[u4];
  1484. if (!this._canParseStyleLayer(e4.uid) || e4.minzoom && s6 < Math.floor(e4.minzoom) || e4.maxzoom && s6 >= e4.maxzoom || e4.type === a4.BACKGROUND)
  1485. continue;
  1486. if (!t8[e4.source] || !i[e4.source])
  1487. continue;
  1488. const f3 = t8[e4.source], p4 = i[e4.source], h4 = e4.sourceLayer, m3 = f3[h4];
  1489. if (m3) {
  1490. let t9 = n5[e4.source];
  1491. if (t9 || (t9 = n5[e4.source] = new Set()), t9.add(e4.sourceLayer), e4.refLayerId)
  1492. a9.set(e4.uid, e4.refLayerId);
  1493. else {
  1494. const t10 = this._createBucket(e4);
  1495. if (t10) {
  1496. t10.layerUIDs = [e4.uid], t10.layerExtent = m3.extent, t10.tileClipper = p4;
  1497. let r8 = o6[e4.source];
  1498. r8 || (r8 = o6[e4.source] = {});
  1499. let s7 = r8[h4];
  1500. s7 || (s7 = r8[h4] = []), s7.push(t10), c4.push(t10), l5[e4.id] = t10;
  1501. }
  1502. }
  1503. }
  1504. }
  1505. }
  1506. _linkReferences(e3) {
  1507. const { layerIdToBucket: t8, referencerUIDToReferencedId: r7 } = e3;
  1508. r7.forEach((e4, r8) => {
  1509. t8[e4] && t8[e4].layerUIDs.push(r8);
  1510. });
  1511. }
  1512. _filterFeatures(e3) {
  1513. const { signal: r7, sourceNameToTileData: i, sourceNameToUniqueSourceLayerBuckets: o6, sourceNameToUniqueSourceLayers: n5 } = e3, c4 = 10 * this._level, l5 = 10 * (this._level + 1), a9 = [], u4 = [];
  1514. for (const t8 of Object.keys(n5)) {
  1515. n5[t8].forEach((e4) => {
  1516. a9.push(e4), u4.push(t8);
  1517. });
  1518. }
  1519. for (let f3 = 0; f3 < a9.length; f3++) {
  1520. const e4 = u4[f3], n6 = a9[f3];
  1521. if (!i[e4] || !o6[e4])
  1522. continue;
  1523. const p4 = i[e4][n6], h4 = o6[e4][n6];
  1524. if (!h4 || h4.length === 0)
  1525. continue;
  1526. if (p(r7))
  1527. return;
  1528. const m3 = p4.getData();
  1529. for (; m3.nextTag(2); ) {
  1530. const e5 = m3.getMessage(), t8 = new s3(e5, p4);
  1531. e5.release();
  1532. const r8 = t8.values;
  1533. if (r8) {
  1534. const e6 = r8._minzoom;
  1535. if (e6 && e6 >= l5)
  1536. continue;
  1537. const t9 = r8._maxzoom;
  1538. if (t9 && t9 <= c4)
  1539. continue;
  1540. }
  1541. for (const s6 of h4)
  1542. s6.pushFeature(t8);
  1543. }
  1544. }
  1545. }
  1546. _fetchResources(e3, t8, r7) {
  1547. const s6 = [], i = this._tile.getWorkerTileHandler();
  1548. let o6, n5;
  1549. e3.length > 0 && (o6 = i.fetchSprites(e3, this._client, r7), s6.push(o6));
  1550. for (const c4 in t8) {
  1551. const e4 = t8[c4];
  1552. e4.size > 0 && (n5 = i.fetchGlyphs(this._tile.tileKey, c4, e4, this._client, r7), s6.push(n5));
  1553. }
  1554. return s6;
  1555. }
  1556. _processFeatures(e3) {
  1557. const t8 = e3.filter((e4) => e4.hasFeatures() || this._canParseStyleLayer(e4.layer.uid));
  1558. for (const r7 of t8)
  1559. r7.processFeatures(r7.tileClipper);
  1560. return t8;
  1561. }
  1562. _parseTileData(e3) {
  1563. const t8 = {};
  1564. for (const r7 of Object.keys(e3)) {
  1565. const s6 = e3[r7], i = {};
  1566. for (; s6.next(); )
  1567. switch (s6.tag()) {
  1568. case 3: {
  1569. const e4 = s6.getMessage(), t9 = new e2(e4);
  1570. e4.release(), i[t9.name] = t9;
  1571. break;
  1572. }
  1573. default:
  1574. s6.skip();
  1575. }
  1576. t8[r7] = i;
  1577. }
  1578. return t8;
  1579. }
  1580. _createBucket(e3) {
  1581. switch (e3.type) {
  1582. case a4.BACKGROUND:
  1583. return null;
  1584. case a4.FILL:
  1585. return this._createFillBucket(e3);
  1586. case a4.LINE:
  1587. return this._createLineBucket(e3);
  1588. case a4.CIRCLE:
  1589. return this._createCircleBucket(e3);
  1590. case a4.SYMBOL:
  1591. return this._createSymbolBucket(e3);
  1592. }
  1593. }
  1594. _createFillBucket(e3) {
  1595. return new s4(e3, this._level, this._tile.getWorkerTileHandler().getSpriteItems(), new r4(e3.fillMaterial.getStride()), new r3(), new u3(e3.outlineMaterial.getStride()), new r3());
  1596. }
  1597. _createLineBucket(e3) {
  1598. return new n4(e3, this._level, this._tile.getWorkerTileHandler().getSpriteItems(), new o4(e3.lineMaterial.getStride()), new r3());
  1599. }
  1600. _createCircleBucket(e3) {
  1601. return new r5(e3, this._level, this._tile.getWorkerTileHandler().getSpriteItems(), new a7(e3.circleMaterial.getStride()), new r3());
  1602. }
  1603. _createSymbolBucket(e3) {
  1604. const t8 = this._tile;
  1605. return new A(e3, this._level, new h3(e3.iconMaterial.getStride()), new r3(), new h3(e3.textMaterial.getStride()), new r3(), t8.placementEngine, t8.getWorkerTileHandler());
  1606. }
  1607. };
  1608. // node_modules/@arcgis/core/views/2d/engine/vectorTiles/WorkerTile.js
  1609. var a8 = class {
  1610. constructor(t8, e3, r7, a9) {
  1611. this.status = I4.INITIALIZED, this.placementEngine = new u2(), this.tileKey = t8, this.refKeys = e3, this._workerTileHandler = r7, this._styleRepository = a9;
  1612. }
  1613. release() {
  1614. this.tileKey = "", this.refKeys = null, this.status = I4.INITIALIZED, this._workerTileHandler = null;
  1615. }
  1616. async parse(s6, r7) {
  1617. const a9 = r7 && r7.signal;
  1618. if (r(a9)) {
  1619. const t8 = () => {
  1620. a9.removeEventListener("abort", t8), this.status = I4.INVALID;
  1621. };
  1622. a9.addEventListener("abort", t8);
  1623. }
  1624. let n5;
  1625. const l5 = { bucketsWithData: [], emptyBuckets: null };
  1626. try {
  1627. n5 = await this._parse(s6, r7);
  1628. } catch (y2) {
  1629. if (g(y2))
  1630. throw y2;
  1631. return { result: l5, transferList: [] };
  1632. }
  1633. this.status = I4.READY;
  1634. const o6 = l5.bucketsWithData, u4 = [];
  1635. for (const t8 of n5)
  1636. if (t8.hasFeatures()) {
  1637. const e3 = t8.serialize();
  1638. o6.push(e3);
  1639. } else
  1640. u4.push(t8.layer.uid);
  1641. const h4 = [...o6];
  1642. let c4 = null;
  1643. return u4.length > 0 && (c4 = Uint32Array.from(u4), h4.push(c4.buffer)), l5.emptyBuckets = c4, { result: l5, transferList: h4 };
  1644. }
  1645. setObsolete() {
  1646. this.status = I4.INVALID;
  1647. }
  1648. getLayers() {
  1649. return this._workerTileHandler.getLayers();
  1650. }
  1651. getWorkerTileHandler() {
  1652. return this._workerTileHandler;
  1653. }
  1654. async _parse(t8, e3) {
  1655. const s6 = t8.sourceName2DataAndRefKey;
  1656. if (Object.keys(s6).length === 0)
  1657. return [];
  1658. this.status = I4.MODIFIED;
  1659. return new B(s6, this, e3.client, this._styleRepository, t8.styleLayerUIDs).parse(e3);
  1660. }
  1661. };
  1662. // node_modules/@arcgis/core/views/2d/engine/vectorTiles/WorkerTileHandler.js
  1663. var o5 = class {
  1664. constructor() {
  1665. this._spriteInfo = {}, this._glyphInfo = {};
  1666. }
  1667. reset() {
  1668. return this._spriteInfo = {}, this._glyphInfo = {}, Promise.resolve();
  1669. }
  1670. getLayers() {
  1671. return this._styleRepository?.layers;
  1672. }
  1673. async createTileAndParse(t8, r7) {
  1674. const { key: o6 } = t8, i = {};
  1675. for (const e3 of Object.keys(t8.sourceName2DataAndRefKey)) {
  1676. const s6 = t8.sourceName2DataAndRefKey[e3];
  1677. i[e3] = s6.refKey;
  1678. }
  1679. const n5 = new a8(o6, i, this, this._styleRepository);
  1680. try {
  1681. return await n5.parse(t8, r7);
  1682. } catch (l5) {
  1683. if (n5.setObsolete(), n5.release(), !g(l5))
  1684. throw l5;
  1685. return null;
  1686. }
  1687. }
  1688. updateStyle(e3) {
  1689. if (!e3 || e3.length === 0 || !this._styleRepository)
  1690. return;
  1691. const s6 = this._styleRepository;
  1692. for (const r7 of e3) {
  1693. const e4 = r7.type, o6 = r7.data;
  1694. switch (e4) {
  1695. case L.PAINTER_CHANGED:
  1696. s6.setPaintProperties(o6.layer, o6.paint);
  1697. break;
  1698. case L.LAYOUT_CHANGED:
  1699. s6.setLayoutProperties(o6.layer, o6.layout);
  1700. break;
  1701. case L.LAYER_REMOVED:
  1702. s6.deleteStyleLayer(o6.layer);
  1703. break;
  1704. case L.LAYER_CHANGED:
  1705. s6.setStyleLayer(o6.layer, o6.index);
  1706. break;
  1707. case L.SPRITES_CHANGED:
  1708. this._spriteInfo = {};
  1709. }
  1710. }
  1711. }
  1712. setStyle(e3) {
  1713. this._styleRepository = new l3(e3), this._spriteInfo = {}, this._glyphInfo = {};
  1714. }
  1715. fetchSprites(e3, t8, s6) {
  1716. const r7 = [], o6 = this._spriteInfo;
  1717. for (const i of e3) {
  1718. o6[i.name] === void 0 && r7.push(i);
  1719. }
  1720. return r7.length === 0 ? Promise.resolve() : t8.invoke("getSprites", r7, { signal: s6 && s6.signal }).then((e4) => {
  1721. for (const t9 in e4) {
  1722. const s7 = e4[t9];
  1723. o6[t9] = s7;
  1724. }
  1725. });
  1726. }
  1727. getSpriteItems() {
  1728. return this._spriteInfo;
  1729. }
  1730. fetchGlyphs(e3, t8, s6, r7, o6) {
  1731. const i = [];
  1732. let n5 = this._glyphInfo[t8];
  1733. return n5 ? s6.forEach((e4) => {
  1734. n5[e4] || i.push(e4);
  1735. }) : (n5 = this._glyphInfo[t8] = [], s6.forEach((e4) => i.push(e4))), i.length === 0 ? Promise.resolve() : r7.invoke("getGlyphs", { tileID: e3, font: t8, codePoints: i }, o6).then((e4) => {
  1736. for (let t9 = 0; t9 < e4.length; t9++)
  1737. e4[t9] && (n5[t9] = e4[t9]);
  1738. });
  1739. }
  1740. getGlyphItems(e3) {
  1741. return this._glyphInfo[e3];
  1742. }
  1743. };
  1744. export {
  1745. o5 as default
  1746. };
  1747. //# sourceMappingURL=WorkerTileHandler-RHSUEZH4.js.map