chunk-TLDCDW5L.js 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535
  1. import {
  2. g,
  3. r as r2
  4. } from "./chunk-TDS6IBMU.js";
  5. import {
  6. m
  7. } from "./chunk-RYY6632W.js";
  8. import {
  9. s as s2
  10. } from "./chunk-HZRKBTHJ.js";
  11. import {
  12. w2 as w
  13. } from "./chunk-6T6G6LCQ.js";
  14. import {
  15. R
  16. } from "./chunk-PQFTYGF5.js";
  17. import {
  18. f
  19. } from "./chunk-V6P2MAQQ.js";
  20. import {
  21. s2 as s
  22. } from "./chunk-E5O6P5I2.js";
  23. import {
  24. has
  25. } from "./chunk-SPWQ3AWG.js";
  26. import {
  27. t as t2
  28. } from "./chunk-2TIUKVZN.js";
  29. import {
  30. e,
  31. r,
  32. t
  33. } from "./chunk-YXWMMD76.js";
  34. // node_modules/@arcgis/core/layers/support/rasterFunctions/vectorFieldUtils.js
  35. var s3 = /* @__PURE__ */ new Map();
  36. s3.set("meter-per-second", 1), s3.set("kilometer-per-hour", 0.277778), s3.set("knots", 0.514444), s3.set("feet-per-second", 0.3048), s3.set("mile-per-hour", 0.44704);
  37. var a = 180 / Math.PI;
  38. var h = 5;
  39. var c = new s2({ esriMetersPerSecond: "meter-per-second", esriKilometersPerHour: "kilometer-per-hour", esriKnots: "knots", esriFeetPerSecond: "feet-per-second", esriMilesPerHour: "mile-per-hour" });
  40. function l(t3, e2) {
  41. return s3.get(t3) / s3.get(e2) || 1;
  42. }
  43. function u(t3) {
  44. return (450 - t3) % 360;
  45. }
  46. function f2(t3, e2 = "geographic") {
  47. const [n, r3] = t3, o = Math.sqrt(n * n + r3 * r3);
  48. let i = Math.atan2(r3, n) * a;
  49. return i = (360 + i) % 360, "geographic" === e2 && (i = u(i)), [o, i];
  50. }
  51. function p(t3, e2 = "geographic") {
  52. let n = t3[1];
  53. "geographic" === e2 && (n = u(n)), n %= 360;
  54. const r3 = t3[0];
  55. return [r3 * Math.cos(n / a), r3 * Math.sin(n / a)];
  56. }
  57. function m2(t3, r3, o, s5 = "geographic") {
  58. if (!r2(t3) || t(o))
  59. return t3;
  60. const a2 = "vector-magdir" === r3 ? t3.clone() : e(d(t3, r3)), h3 = a2.pixels[1];
  61. for (let e2 = 0; e2 < h3.length; e2++)
  62. h3[e2] = "geographic" === s5 ? (h3[e2] + o[e2] + 270) % 360 : (h3[e2] + 360 - o[e2]) % 360;
  63. return "vector-magdir" === r3 ? a2 : d(a2, "vector-magdir");
  64. }
  65. function d(t3, e2, n = "geographic", r3 = 1) {
  66. if (!r2(t3))
  67. return t3;
  68. const { pixels: s5, width: a2, height: h3 } = t3, c3 = a2 * h3, l2 = s5[0], u3 = s5[1], m4 = t3.pixelType.startsWith("f") ? t3.pixelType : "f32", d3 = g.createEmptyBand(m4, c3), g4 = g.createEmptyBand(m4, c3);
  69. let x3 = 0;
  70. for (let o = 0; o < h3; o++)
  71. for (let t4 = 0; t4 < a2; t4++)
  72. "vector-uv" === e2 ? ([d3[x3], g4[x3]] = f2([l2[x3], u3[x3]], n), d3[x3] *= r3) : ([d3[x3], g4[x3]] = p([l2[x3], u3[x3]], n), d3[x3] *= r3, g4[x3] *= r3), x3++;
  73. const M3 = new g({ pixelType: m4, width: t3.width, height: t3.height, mask: t3.mask, validPixelCount: t3.validPixelCount, maskIsAlpha: t3.maskIsAlpha, pixels: [d3, g4] });
  74. return M3.updateStatistics(), M3;
  75. }
  76. function g2(t3, e2, n = 1) {
  77. if (1 === n || !r2(t3))
  78. return t3;
  79. const r3 = t3.clone(), { pixels: o, width: s5, height: a2 } = r3, h3 = o[0], c3 = o[1];
  80. let l2 = 0;
  81. for (let i = 0; i < a2; i++)
  82. for (let t4 = 0; t4 < s5; t4++)
  83. "vector-uv" === e2 ? (h3[l2] *= n, c3[l2] *= n) : h3[l2] *= n, l2++;
  84. return r3.updateStatistics(), r3;
  85. }
  86. function x(t3, n, r3, o, i) {
  87. if (t(i) || !i.spatialReference.equals(t3.spatialReference))
  88. return { extent: t3, width: Math.round(n / o), height: Math.round(r3 / o), resolution: t3.width / n };
  89. const s5 = i.xmin, a2 = i.ymax, h3 = (t3.xmax - t3.xmin) / n * o, c3 = (t3.ymax - t3.ymin) / r3 * o, l2 = (h3 + c3) / 2;
  90. return t3.xmin = s5 + Math.floor((t3.xmin - s5) / h3) * h3, t3.xmax = s5 + Math.ceil((t3.xmax - s5) / h3) * h3, t3.ymin = a2 + Math.floor((t3.ymin - a2) / c3) * c3, t3.ymax = a2 + Math.ceil((t3.ymax - a2) / c3) * c3, { extent: t3, width: Math.round(t3.width / h3), height: Math.round(t3.height / c3), resolution: l2 };
  91. }
  92. var M = k(0, 0, 0);
  93. function k(t3 = 0, e2 = 0, n = Math.PI, r3 = true) {
  94. r3 && (n = (2 * Math.PI - n) % (2 * Math.PI));
  95. const o = r3 ? -1 : 1, i = 13 * o, s5 = -7 * o, a2 = -2 * o, h3 = -16 * o, c3 = 21.75, [l2, u3] = y(0, e2 + i, n, c3), [f4, p3] = y(t3 - 5.5, e2 + s5, n, c3), [m4, d3] = y(t3 + 5.5, e2 + s5, n, c3), [g4, x3] = y(t3 - 1.5, e2 + a2, n, c3), [M3, k2] = y(t3 + 1.5, e2 + a2, n, c3), [w4, P2] = y(t3 - 1.5, e2 + h3, n, c3), [b2, v2] = y(t3 + 1.5, e2 + h3, n, c3);
  96. return [l2, u3, f4, p3, g4, x3, M3, k2, m4, d3, w4, P2, b2, v2];
  97. }
  98. function w2(t3 = 0, e2 = Math.PI, n = true) {
  99. n && (e2 = (2 * Math.PI - e2) % (2 * Math.PI));
  100. const r3 = 10, o = n ? -1 : 1, i = 5 * o, s5 = 20 * o, a2 = 25 * o, c3 = 45, l2 = 0, u3 = 0, f4 = 2, p3 = 0, m4 = f4 * o, d3 = n ? 1 : -1, g4 = r3 / 2 * d3;
  101. let [x3, M3] = [l2 + g4, u3 - s5], [k2, w4] = [x3 + f4 * d3, M3], [P2, b2] = [k2 - p3 * d3, w4 + m4], [v2, I2] = [l2 - g4, u3 - a2], [A2, _2] = [v2 + p3 * d3, I2 - m4], U2 = Math.ceil(t3 / h), S2 = Math.floor(U2 / 10);
  102. U2 -= 8 * S2;
  103. const D2 = [], F2 = [];
  104. for (let h3 = 0; h3 < U2 / 2; h3++, S2--) {
  105. S2 <= 0 && U2 % 2 == 1 && h3 === (U2 - 1) / 2 && (v2 = l2, A2 = v2 + p3 * d3, I2 = (I2 + M3) / 2, _2 = I2 - m4);
  106. const [t4, n2] = y(v2, I2, e2, c3);
  107. if (S2 > 0) {
  108. const [r4, o2] = y(k2, I2, e2, c3), [i2, s6] = y(x3, M3, e2, c3);
  109. D2.push(r4), D2.push(o2), D2.push(t4), D2.push(n2), D2.push(i2), D2.push(s6);
  110. } else {
  111. const [r4, o2] = y(k2, w4, e2, c3), [i2, s6] = y(P2, b2, e2, c3), [a3, h4] = y(A2, _2, e2, c3);
  112. F2.push(t4), F2.push(n2), F2.push(a3), F2.push(h4), F2.push(i2), F2.push(s6), F2.push(r4), F2.push(o2);
  113. }
  114. I2 += i, M3 += i, w4 += i, b2 += i, _2 += i;
  115. }
  116. const [j2, N] = y(l2 + g4, u3 + s5, e2, c3), J = (r3 / 2 + f4) * d3, [O, q] = y(l2 + J, u3 + s5, e2, c3), [B, E] = y(l2 + g4, u3 - a2, e2, c3), [T, C] = y(l2 + J, u3 - a2, e2, c3);
  117. return { pennants: D2, barbs: F2, shaft: [j2, N, O, q, B, E, T, C] };
  118. }
  119. function y(t3, e2, n, r3 = 1) {
  120. const o = Math.sqrt(t3 * t3 + e2 * e2) / r3, i = (2 * Math.PI + Math.atan2(e2, t3)) % (2 * Math.PI);
  121. return [o, (2 * Math.PI + i - n) % (2 * Math.PI)];
  122. }
  123. var P = [0, 1, 3, 6, 10, 16, 21, 27, 33, 40, 47, 55, 63];
  124. var b = [0, 0.5, 1, 1.5, 2];
  125. var v = [0, 0.25, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4];
  126. function I(t3, e2, n, r3) {
  127. const o = l(r3 || "knots", n);
  128. let i;
  129. for (i = 1; i < e2.length; i++)
  130. if (i === e2.length - 1) {
  131. if (t3 < e2[i] * o)
  132. break;
  133. } else if (t3 <= e2[i] * o)
  134. break;
  135. return Math.min(i - 1, e2.length - 2);
  136. }
  137. function A(t3, e2, n, r3, o) {
  138. let i = 0;
  139. switch (e2) {
  140. case "beaufort_kn":
  141. i = I(t3, P, "knots", n);
  142. break;
  143. case "beaufort_km":
  144. i = I(t3, P, "kilometer-per-hour", n);
  145. break;
  146. case "beaufort_ft":
  147. i = I(t3, P, "feet-per-second", n);
  148. break;
  149. case "beaufort_m":
  150. i = I(t3, P, "meter-per-second", n);
  151. break;
  152. case "classified_arrow":
  153. i = I(t3, o != null ? o : [], r3, n);
  154. break;
  155. case "ocean_current_m":
  156. i = I(t3, b, "meter-per-second", n);
  157. break;
  158. case "ocean_current_kn":
  159. i = I(t3, v, "knots", n);
  160. }
  161. return i;
  162. }
  163. function _(t3, e2) {
  164. const { style: n, inputUnit: o, outputUnit: i, breakValues: s5 } = e2, a2 = c.fromJSON(o), h3 = c.fromJSON(i), l2 = 7 * 6, u3 = 15;
  165. let f4 = 0, p3 = 0;
  166. const { width: m4, height: d3, mask: g4 } = t3, x3 = t3.pixels[0], w4 = t3.pixels[1], y3 = r(g4) ? g4.filter((t4) => t4 > 0).length : m4 * d3, P2 = new Float32Array(y3 * l2), b2 = new Uint32Array(u3 * y3), v2 = e2.invertDirection ? k(0, 0, 0, false) : M;
  167. for (let r3 = 0; r3 < d3; r3++)
  168. for (let t4 = 0; t4 < m4; t4++) {
  169. const e3 = r3 * m4 + t4;
  170. if (!g4 || g4[r3 * m4 + t4]) {
  171. const o2 = (w4[e3] + 360) % 360 / 180 * Math.PI, i2 = A(x3[e3], n, a2, h3, s5);
  172. for (let n2 = 0; n2 < v2.length; n2 += 2)
  173. P2[f4++] = (t4 + 0.5) / m4, P2[f4++] = (r3 + 0.5) / d3, P2[f4++] = v2[n2], P2[f4++] = v2[n2 + 1] + o2, P2[f4++] = i2, P2[f4++] = x3[e3];
  174. const c3 = 7 * (f4 / l2 - 1);
  175. b2[p3++] = c3, b2[p3++] = c3 + 1, b2[p3++] = c3 + 2, b2[p3++] = c3 + 0, b2[p3++] = c3 + 4, b2[p3++] = c3 + 3, b2[p3++] = c3 + 0, b2[p3++] = c3 + 2, b2[p3++] = c3 + 3, b2[p3++] = c3 + 2, b2[p3++] = c3 + 5, b2[p3++] = c3 + 3, b2[p3++] = c3 + 5, b2[p3++] = c3 + 6, b2[p3++] = c3 + 3;
  176. }
  177. }
  178. return { vertexData: P2, indexData: b2 };
  179. }
  180. var U = [];
  181. function S(t3, e2) {
  182. if (0 === U.length)
  183. for (let h3 = 0; h3 < 30; h3++)
  184. U.push(w2(5 * h3, 0, !e2.invertDirection));
  185. const n = l(c.fromJSON(e2.inputUnit), "knots"), { width: r3, height: o, mask: i } = t3, s5 = t3.pixels[0], a2 = t3.pixels[1], u3 = 6, f4 = [], p3 = [];
  186. let m4 = 0, d3 = 0;
  187. for (let c3 = 0; c3 < o; c3++)
  188. for (let t4 = 0; t4 < r3; t4++) {
  189. const e3 = c3 * r3 + t4, l2 = s5[e3] * n;
  190. if ((!i || i[c3 * r3 + t4]) && l2 >= h) {
  191. const n2 = (a2[e3] + 360) % 360 / 180 * Math.PI, { pennants: i2, barbs: s6, shaft: h3 } = U[Math.min(Math.floor(l2 / 5), 29)];
  192. if (i2.length + s6.length === 0)
  193. continue;
  194. let g4 = f4.length / u3;
  195. const x3 = (t4 + 0.5) / r3, M3 = (c3 + 0.5) / o;
  196. for (let t5 = 0; t5 < i2.length; t5 += 2)
  197. f4[m4++] = x3, f4[m4++] = M3, f4[m4++] = i2[t5], f4[m4++] = i2[t5 + 1] + n2, f4[m4++] = 0, f4[m4++] = l2;
  198. for (let t5 = 0; t5 < s6.length; t5 += 2)
  199. f4[m4++] = x3, f4[m4++] = M3, f4[m4++] = s6[t5], f4[m4++] = s6[t5 + 1] + n2, f4[m4++] = 0, f4[m4++] = l2;
  200. for (let t5 = 0; t5 < h3.length; t5 += 2)
  201. f4[m4++] = x3, f4[m4++] = M3, f4[m4++] = h3[t5], f4[m4++] = h3[t5 + 1] + n2, f4[m4++] = 0, f4[m4++] = l2;
  202. for (let t5 = 0; t5 < i2.length / 6; t5++)
  203. p3[d3++] = g4, p3[d3++] = g4 + 1, p3[d3++] = g4 + 2, g4 += 3;
  204. for (let t5 = 0; t5 < s6.length / 8; t5++)
  205. p3[d3++] = g4, p3[d3++] = g4 + 1, p3[d3++] = g4 + 2, p3[d3++] = g4 + 1, p3[d3++] = g4 + 2, p3[d3++] = g4 + 3, g4 += 4;
  206. p3[d3++] = g4 + 0, p3[d3++] = g4 + 1, p3[d3++] = g4 + 2, p3[d3++] = g4 + 1, p3[d3++] = g4 + 3, p3[d3++] = g4 + 2, g4 += 4;
  207. }
  208. }
  209. return { vertexData: new Float32Array(f4), indexData: new Uint32Array(p3) };
  210. }
  211. function D(t3, e2) {
  212. const n = 4 * 6;
  213. let r3 = 0, o = 0;
  214. const { width: i, height: s5, mask: a2 } = t3, u3 = t3.pixels[0], f4 = [], p3 = [], m4 = l(c.fromJSON(e2.inputUnit), "knots"), d3 = "wind_speed" === e2.style ? h : Number.MAX_VALUE;
  215. for (let h3 = 0; h3 < s5; h3++)
  216. for (let t4 = 0; t4 < i; t4++) {
  217. const e3 = u3[h3 * i + t4] * m4;
  218. if ((!a2 || a2[h3 * i + t4]) && e3 < d3) {
  219. for (let n2 = 0; n2 < 4; n2++)
  220. f4[r3++] = (t4 + 0.5) / i, f4[r3++] = (h3 + 0.5) / s5, f4[r3++] = n2 < 2 ? -0.5 : 0.5, f4[r3++] = n2 % 2 == 0 ? -0.5 : 0.5, f4[r3++] = 0, f4[r3++] = e3;
  221. const a3 = 4 * (r3 / n - 1);
  222. p3[o++] = a3, p3[o++] = a3 + 1, p3[o++] = a3 + 2, p3[o++] = a3 + 1, p3[o++] = a3 + 2, p3[o++] = a3 + 3;
  223. }
  224. }
  225. return { vertexData: new Float32Array(f4), indexData: new Uint32Array(p3) };
  226. }
  227. function F(t3, e2) {
  228. return "simple_scalar" === e2.style ? D(t3, e2) : "wind_speed" === e2.style ? S(t3, e2) : _(t3, e2);
  229. }
  230. function j(t3, e2, n, r3 = [0, 0], i = 0.5) {
  231. const { width: s5, height: a2, mask: h3 } = t3, [c3, l2] = t3.pixels, [u3, m4] = r3, d3 = Math.round((s5 - u3) / n), g4 = Math.round((a2 - m4) / n), x3 = d3 * g4, M3 = new Float32Array(x3), k2 = new Float32Array(x3), w4 = new Uint8Array(x3), y3 = "vector-uv" === e2;
  232. for (let o = 0; o < g4; o++)
  233. for (let t4 = 0; t4 < d3; t4++) {
  234. let e3 = 0;
  235. const r4 = o * d3 + t4, g5 = Math.max(0, o * n + m4), x4 = Math.max(0, t4 * n + u3), P3 = Math.min(a2, g5 + n), b2 = Math.min(s5, x4 + n);
  236. for (let t5 = g5; t5 < P3; t5++)
  237. for (let n2 = x4; n2 < b2; n2++) {
  238. const o2 = t5 * s5 + n2;
  239. if (!h3 || h3[o2]) {
  240. e3++;
  241. const t6 = y3 ? [c3[o2], l2[o2]] : [c3[o2], (360 + l2[o2]) % 360], [n3, i2] = y3 ? t6 : p(t6);
  242. M3[r4] += n3, k2[r4] += i2;
  243. }
  244. }
  245. if (e3 >= (P3 - g5) * (b2 - x4) * (1 - i)) {
  246. w4[r4] = 1;
  247. const [t5, n2] = f2([M3[r4] / e3, k2[r4] / e3]);
  248. M3[r4] = t5, k2[r4] = n2;
  249. } else
  250. w4[r4] = 0, M3[r4] = 0, k2[r4] = 0;
  251. }
  252. const P2 = new g({ width: d3, height: g4, pixels: [M3, k2], mask: w4 });
  253. return P2.updateStatistics(), P2;
  254. }
  255. // node_modules/@arcgis/core/views/2d/engine/flow/dataUtils.js
  256. var s4 = s.getLogger("esri.views.2d.engine.flow.dataUtils");
  257. var c2 = 10;
  258. async function f3(t3, e2, n, r3) {
  259. const i = performance.now(), l2 = u2(e2, n), a2 = performance.now(), f4 = m3(e2, l2, n.width, n.height), h3 = performance.now(), d3 = w3(f4, true), y3 = performance.now(), x3 = "Streamlines" === t3 ? p2(d3, c2) : g3(d3), M3 = performance.now();
  260. return has("esri-2d-profiler") && (s4.info("I.1", "_createFlowFieldFromData (ms)", Math.round(a2 - i)), s4.info("I.2", "_getStreamlines (ms)", Math.round(h3 - a2)), s4.info("I.3", "createAnimatedLinesData (ms)", Math.round(y3 - h3)), s4.info("I.4", "create{Streamlines|Particles}Mesh (ms)", Math.round(M3 - y3)), s4.info("I.5", "createFlowMesh (ms)", Math.round(M3 - i)), s4.info("I.6", "Mesh size (bytes)", x3.vertexData.buffer.byteLength + x3.indexData.buffer.byteLength)), await Promise.resolve(), f(r3), x3;
  261. }
  262. function u2(t3, e2) {
  263. const n = d2(e2.data, e2.width, e2.height, t3.smoothing);
  264. if (t3.interpolate) {
  265. return (t4, r3) => {
  266. const o = Math.floor(t4), i = Math.floor(r3);
  267. if (o < 0 || o >= e2.width)
  268. return [0, 0];
  269. if (i < 0 || i >= e2.height)
  270. return [0, 0];
  271. const l2 = t4 - o, a2 = r3 - i, s5 = o, c3 = i, f4 = o < e2.width - 1 ? o + 1 : o, u3 = i < e2.height - 1 ? i + 1 : i, h3 = n[2 * (c3 * e2.width + s5)], m4 = n[2 * (c3 * e2.width + f4)], d3 = n[2 * (u3 * e2.width + s5)], w4 = n[2 * (u3 * e2.width + f4)], p3 = n[2 * (c3 * e2.width + s5) + 1], g4 = n[2 * (c3 * e2.width + f4) + 1];
  272. return [(h3 * (1 - a2) + d3 * a2) * (1 - l2) + (m4 * (1 - a2) + w4 * a2) * l2, (p3 * (1 - a2) + n[2 * (u3 * e2.width + s5) + 1] * a2) * (1 - l2) + (g4 * (1 - a2) + n[2 * (u3 * e2.width + f4) + 1] * a2) * l2];
  273. };
  274. }
  275. return (t4, r3) => {
  276. const o = Math.round(t4), i = Math.round(r3);
  277. return o < 0 || o >= e2.width || i < 0 || i >= e2.height ? [0, 0] : [n[2 * (i * e2.width + o) + 0], n[2 * (i * e2.width + o) + 1]];
  278. };
  279. }
  280. function h2(t3, e2, n, r3, o, i, l2, a2, s5) {
  281. const c3 = [];
  282. let f4 = n, u3 = r3, h3 = 0, [m4, d3] = e2(f4, u3);
  283. m4 *= t3.velocityScale, d3 *= t3.velocityScale;
  284. const w4 = Math.sqrt(m4 * m4 + d3 * d3);
  285. let p3, g4;
  286. c3.push({ x: f4, y: u3, t: h3, speed: w4 });
  287. for (let y3 = 0; y3 < t3.verticesPerLine; y3++) {
  288. let [n2, r4] = e2(f4, u3);
  289. n2 *= t3.velocityScale, r4 *= t3.velocityScale;
  290. const m5 = Math.sqrt(n2 * n2 + r4 * r4);
  291. if (m5 < t3.minSpeedThreshold)
  292. return c3;
  293. const d4 = n2 / m5, w5 = r4 / m5;
  294. f4 += d4 * t3.segmentLength, u3 += w5 * t3.segmentLength;
  295. if (h3 += t3.segmentLength / m5, Math.acos(d4 * p3 + w5 * g4) > t3.maxTurnAngle)
  296. return c3;
  297. if (t3.collisions) {
  298. const t4 = Math.round(f4 * s5), e3 = Math.round(u3 * s5);
  299. if (t4 < 0 || t4 > l2 - 1 || e3 < 0 || e3 > a2 - 1)
  300. return c3;
  301. const n3 = i[e3 * l2 + t4];
  302. if (-1 !== n3 && n3 !== o)
  303. return c3;
  304. i[e3 * l2 + t4] = o;
  305. }
  306. c3.push({ x: f4, y: u3, t: h3, speed: m5 }), p3 = d4, g4 = w5;
  307. }
  308. return c3;
  309. }
  310. function m3(t3, e2, n, r3) {
  311. const o = [], l2 = new t2(), a2 = 1 / Math.max(t3.lineCollisionWidth, 1), s5 = Math.round(n * a2), c3 = Math.round(r3 * a2), f4 = new Int32Array(s5 * c3);
  312. for (let i = 0; i < f4.length; i++)
  313. f4[i] = -1;
  314. const u3 = [];
  315. for (let i = 0; i < r3; i += t3.lineSpacing)
  316. for (let e3 = 0; e3 < n; e3 += t3.lineSpacing)
  317. u3.push({ x: e3, y: i, sort: l2.getFloat() });
  318. u3.sort((t4, e3) => t4.sort - e3.sort);
  319. for (const { x: i, y: m4 } of u3)
  320. if (l2.getFloat() < t3.density) {
  321. const n2 = h2(t3, e2, i, m4, o.length, f4, s5, c3, a2);
  322. if (n2.length < 2)
  323. continue;
  324. o.push(n2);
  325. }
  326. return o;
  327. }
  328. function d2(t3, e2, n, r3) {
  329. if (0 === r3)
  330. return t3;
  331. const o = Math.round(3 * r3), i = new Array(2 * o + 1);
  332. let l2 = 0;
  333. for (let c3 = -o; c3 <= o; c3++) {
  334. const t4 = Math.exp(-c3 * c3 / (r3 * r3));
  335. i[c3 + o] = t4, l2 += t4;
  336. }
  337. for (let c3 = -o; c3 <= o; c3++)
  338. i[c3 + o] /= l2;
  339. const a2 = new Float32Array(t3.length);
  340. for (let c3 = 0; c3 < n; c3++)
  341. for (let n2 = 0; n2 < e2; n2++) {
  342. let r4 = 0, l3 = 0;
  343. for (let a3 = -o; a3 <= o; a3++) {
  344. if (n2 + a3 < 0 || n2 + a3 >= e2)
  345. continue;
  346. const s6 = i[a3 + o];
  347. r4 += s6 * t3[2 * (c3 * e2 + (n2 + a3)) + 0], l3 += s6 * t3[2 * (c3 * e2 + (n2 + a3)) + 1];
  348. }
  349. a2[2 * (c3 * e2 + n2) + 0] = r4, a2[2 * (c3 * e2 + n2) + 1] = l3;
  350. }
  351. const s5 = new Float32Array(t3.length);
  352. for (let c3 = 0; c3 < e2; c3++)
  353. for (let t4 = 0; t4 < n; t4++) {
  354. let r4 = 0, l3 = 0;
  355. for (let s6 = -o; s6 <= o; s6++) {
  356. if (t4 + s6 < 0 || t4 + s6 >= n)
  357. continue;
  358. const f4 = i[s6 + o];
  359. r4 += f4 * a2[2 * ((t4 + s6) * e2 + c3) + 0], l3 += f4 * a2[2 * ((t4 + s6) * e2 + c3) + 1];
  360. }
  361. s5[2 * (t4 * e2 + c3) + 0] = r4, s5[2 * (t4 * e2 + c3) + 1] = l3;
  362. }
  363. return s5;
  364. }
  365. function w3(t3, e2) {
  366. const n = new t2(), r3 = t3.reduce((t4, e3) => t4 + e3.length, 0), o = new Float32Array(4 * r3), l2 = new Array(t3.length);
  367. let a2 = 0, s5 = 0;
  368. for (const i of t3) {
  369. const t4 = a2;
  370. for (const e3 of i)
  371. o[4 * a2 + 0] = e3.x, o[4 * a2 + 1] = e3.y, o[4 * a2 + 2] = e3.t, o[4 * a2 + 3] = e3.speed, a2++;
  372. l2[s5++] = { startVertex: t4, numberOfVertices: i.length, totalTime: i[i.length - 1].t, timeSeed: e2 ? n.getFloat() : 0 };
  373. }
  374. return { lineVertices: o, lineDescriptors: l2 };
  375. }
  376. function p2(t3, e2) {
  377. const n = 9, { lineVertices: r3, lineDescriptors: o } = t3;
  378. let i = 0, l2 = 0;
  379. for (const m4 of o) {
  380. i += 2 * m4.numberOfVertices;
  381. l2 += 6 * (m4.numberOfVertices - 1);
  382. }
  383. const a2 = new Float32Array(i * n), s5 = new Uint32Array(l2);
  384. let c3 = 0, f4 = 0;
  385. function u3() {
  386. s5[f4++] = c3 - 2, s5[f4++] = c3, s5[f4++] = c3 - 1, s5[f4++] = c3, s5[f4++] = c3 + 1, s5[f4++] = c3 - 1;
  387. }
  388. function h3(t4, e3, r4, o2, i2, l3, s6, f5) {
  389. const u4 = c3 * n;
  390. let h4 = 0;
  391. a2[u4 + h4++] = t4, a2[u4 + h4++] = e3, a2[u4 + h4++] = 1, a2[u4 + h4++] = r4, a2[u4 + h4++] = l3, a2[u4 + h4++] = s6, a2[u4 + h4++] = o2 / 2, a2[u4 + h4++] = i2 / 2, a2[u4 + h4++] = f5, c3++, a2[u4 + h4++] = t4, a2[u4 + h4++] = e3, a2[u4 + h4++] = -1, a2[u4 + h4++] = r4, a2[u4 + h4++] = l3, a2[u4 + h4++] = s6, a2[u4 + h4++] = -o2 / 2, a2[u4 + h4++] = -i2 / 2, a2[u4 + h4++] = f5, c3++;
  392. }
  393. for (const m4 of o) {
  394. const { totalTime: t4, timeSeed: n2 } = m4;
  395. let o2 = null, i2 = null, l3 = null, a3 = null, s6 = null, c4 = null;
  396. for (let f5 = 0; f5 < m4.numberOfVertices; f5++) {
  397. const d3 = r3[4 * (m4.startVertex + f5) + 0], w4 = r3[4 * (m4.startVertex + f5) + 1], p3 = r3[4 * (m4.startVertex + f5) + 2], g4 = r3[4 * (m4.startVertex + f5) + 3];
  398. let y3 = null, x3 = null, M3 = null, A2 = null;
  399. if (f5 > 0) {
  400. y3 = d3 - o2, x3 = w4 - i2;
  401. const r4 = Math.sqrt(y3 * y3 + x3 * x3);
  402. if (y3 /= r4, x3 /= r4, f5 > 1) {
  403. let t5 = y3 + s6, n3 = x3 + c4;
  404. const r5 = Math.sqrt(t5 * t5 + n3 * n3);
  405. t5 /= r5, n3 /= r5;
  406. const o3 = Math.min(1 / (t5 * y3 + n3 * x3), e2);
  407. t5 *= o3, n3 *= o3, M3 = -n3, A2 = t5;
  408. } else
  409. M3 = -x3, A2 = y3;
  410. null !== M3 && null !== A2 && (h3(o2, i2, l3, M3, A2, t4, n2, g4), u3());
  411. }
  412. o2 = d3, i2 = w4, l3 = p3, s6 = y3, c4 = x3, a3 = g4;
  413. }
  414. h3(o2, i2, l3, -c4, s6, t4, n2, a3);
  415. }
  416. return { vertexData: a2, indexData: s5 };
  417. }
  418. function g3(t3) {
  419. const e2 = 16, n = 1, r3 = 2, { lineVertices: o, lineDescriptors: i } = t3;
  420. let l2 = 0, a2 = 0;
  421. for (const j2 of i) {
  422. const t4 = j2.numberOfVertices - 1;
  423. l2 += 4 * t4 * 2, a2 += 6 * t4 * 2;
  424. }
  425. const s5 = new Float32Array(l2 * e2), c3 = new Uint32Array(a2);
  426. let f4, u3, h3, m4, d3, w4, p3, g4, y3, x3, M3, A2, I2, V, F2 = 0, D2 = 0;
  427. function b2() {
  428. c3[D2++] = F2 - 8, c3[D2++] = F2 - 7, c3[D2++] = F2 - 6, c3[D2++] = F2 - 7, c3[D2++] = F2 - 5, c3[D2++] = F2 - 6, c3[D2++] = F2 - 4, c3[D2++] = F2 - 3, c3[D2++] = F2 - 2, c3[D2++] = F2 - 3, c3[D2++] = F2 - 1, c3[D2++] = F2 - 2;
  429. }
  430. function v2(t4, o2, i2, l3, a3, c4, f5, u4, h4, m5, d4, w5, p4, g5) {
  431. const y4 = F2 * e2;
  432. let x4 = 0;
  433. for (const e3 of [n, r3])
  434. for (const n2 of [1, 2, 3, 4])
  435. s5[y4 + x4++] = t4, s5[y4 + x4++] = o2, s5[y4 + x4++] = i2, s5[y4 + x4++] = l3, s5[y4 + x4++] = f5, s5[y4 + x4++] = u4, s5[y4 + x4++] = h4, s5[y4 + x4++] = m5, s5[y4 + x4++] = e3, s5[y4 + x4++] = n2, s5[y4 + x4++] = p4, s5[y4 + x4++] = g5, s5[y4 + x4++] = a3 / 2, s5[y4 + x4++] = c4 / 2, s5[y4 + x4++] = d4 / 2, s5[y4 + x4++] = w5 / 2, F2++;
  436. }
  437. function S2(t4, e3) {
  438. let n2 = y3 + M3, r4 = x3 + A2;
  439. const o2 = Math.sqrt(n2 * n2 + r4 * r4);
  440. n2 /= o2, r4 /= o2;
  441. const i2 = y3 * n2 + x3 * r4;
  442. n2 /= i2, r4 /= i2;
  443. let l3 = M3 + I2, a3 = A2 + V;
  444. const s6 = Math.sqrt(l3 * l3 + a3 * a3);
  445. l3 /= s6, a3 /= s6;
  446. const c4 = M3 * l3 + A2 * a3;
  447. l3 /= c4, a3 /= c4, v2(f4, u3, h3, m4, -r4, n2, d3, w4, p3, g4, -a3, l3, t4, e3), b2();
  448. }
  449. function k2(t4, e3, n2, r4, o2, i2) {
  450. if (y3 = M3, x3 = A2, M3 = I2, A2 = V, null == y3 && null == x3 && (y3 = M3, x3 = A2), null != d3 && null != w4) {
  451. I2 = t4 - d3, V = e3 - w4;
  452. const n3 = Math.sqrt(I2 * I2 + V * V);
  453. I2 /= n3, V /= n3;
  454. }
  455. null != y3 && null != x3 && S2(o2, i2), f4 = d3, u3 = w4, h3 = p3, m4 = g4, d3 = t4, w4 = e3, p3 = n2, g4 = r4;
  456. }
  457. function L(t4, e3) {
  458. y3 = M3, x3 = A2, M3 = I2, A2 = V, null == y3 && null == x3 && (y3 = M3, x3 = A2), null != y3 && null != x3 && S2(t4, e3);
  459. }
  460. for (const j2 of i) {
  461. f4 = null, u3 = null, h3 = null, m4 = null, d3 = null, w4 = null, p3 = null, g4 = null, y3 = null, x3 = null, M3 = null, A2 = null, I2 = null, V = null;
  462. const { totalTime: t4, timeSeed: e3 } = j2;
  463. for (let n2 = 0; n2 < j2.numberOfVertices; n2++) {
  464. k2(o[4 * (j2.startVertex + n2) + 0], o[4 * (j2.startVertex + n2) + 1], o[4 * (j2.startVertex + n2) + 2], o[4 * (j2.startVertex + n2) + 3], t4, e3);
  465. }
  466. L(t4, e3);
  467. }
  468. return { vertexData: s5, indexData: c3 };
  469. }
  470. function y2(t3, n) {
  471. const r3 = n.pixels, { width: o, height: i } = n, l2 = new Float32Array(o * i * 2), a2 = n.mask || new Uint8Array(o * i * 2);
  472. if (n.mask || a2.fill(255), "vector-uv" === t3)
  473. for (let e2 = 0; e2 < o * i; e2++)
  474. l2[2 * e2 + 0] = r3[0][e2], l2[2 * e2 + 1] = -r3[1][e2];
  475. else if ("vector-magdir" === t3)
  476. for (let s5 = 0; s5 < o * i; s5++) {
  477. const t4 = r3[0][s5], n2 = m(r3[1][s5]), o2 = Math.cos(n2 - Math.PI / 2), i2 = Math.sin(n2 - Math.PI / 2);
  478. l2[2 * s5 + 0] = o2 * t4, l2[2 * s5 + 1] = i2 * t4;
  479. }
  480. return { data: l2, mask: a2, width: o, height: i };
  481. }
  482. async function x2(t3, e2, n, r3, o, i) {
  483. const c3 = performance.now(), f4 = R(e2.spatialReference);
  484. if (!f4) {
  485. const l2 = await M2(t3, e2, n, r3, o, i);
  486. return has("esri-2d-profiler") && s4.info("I.7", "loadImagery, early exit (ms)", Math.round(performance.now() - c3)), has("esri-2d-profiler") && s4.info("I.9", "Number of parts", 1), l2;
  487. }
  488. const [u3, h3] = f4.valid, m4 = h3 - u3, d3 = Math.ceil(e2.width / m4), w4 = e2.width / d3, p3 = Math.round(n / d3);
  489. let g4 = e2.xmin;
  490. const y3 = [], x3 = performance.now();
  491. for (let l2 = 0; l2 < d3; l2++) {
  492. const n2 = new w({ xmin: g4, xmax: g4 + w4, ymin: e2.ymin, ymax: e2.ymax, spatialReference: e2.spatialReference });
  493. y3.push(M2(t3, n2, p3, r3, o, i)), g4 += w4;
  494. }
  495. const A2 = await Promise.all(y3);
  496. has("esri-2d-profiler") && s4.info("I.8", "All calls to _fetchPart (ms)", Math.round(performance.now() - x3)), has("esri-2d-profiler") && s4.info("I.9", "Number of parts", A2.length);
  497. const I2 = { data: new Float32Array(n * r3 * 2), mask: new Uint8Array(n * r3), width: n, height: r3 };
  498. let V = 0;
  499. for (const l2 of A2) {
  500. for (let t4 = 0; t4 < l2.height; t4++)
  501. for (let e3 = 0; e3 < l2.width; e3++)
  502. V + e3 >= n || (I2.data[2 * (t4 * n + V + e3) + 0] = l2.data[2 * (t4 * l2.width + e3) + 0], I2.data[2 * (t4 * n + V + e3) + 1] = l2.data[2 * (t4 * l2.width + e3) + 1], I2.mask[t4 * n + V + e3] = l2.mask[t4 * l2.width + e3]);
  503. V += l2.width;
  504. }
  505. return has("esri-2d-profiler") && s4.info("I.10", "loadImagery, general exit (ms)", Math.round(performance.now() - c3)), I2;
  506. }
  507. async function M2(t3, e2, o, i, l2, a2) {
  508. const s5 = { requestProjectedLocalDirections: true, signal: a2 };
  509. if (r(l2) && (s5.timeExtent = l2), "imagery" === t3.type) {
  510. await t3.load({ signal: a2 });
  511. const r3 = t3.rasterInfo.dataType, l3 = await t3.fetchImage(e2, o, i, s5);
  512. return !l3 || t(l3.pixelData) || t(l3.pixelData.pixelBlock) ? { data: new Float32Array(o * i * 2), mask: new Uint8Array(o * i), width: o, height: i } : y2(r3, l3.pixelData.pixelBlock);
  513. }
  514. await t3.load({ signal: a2 });
  515. const c3 = t3.rasterInfo.dataType, f4 = await t3.fetchPixels(e2, o, i, s5);
  516. return !f4 || t(f4.pixelBlock) ? { data: new Float32Array(o * i * 2), mask: new Uint8Array(o * i), width: o, height: i } : y2(c3, f4.pixelBlock);
  517. }
  518. export {
  519. c,
  520. l,
  521. f2 as f,
  522. m2 as m,
  523. d,
  524. g2 as g,
  525. x,
  526. D,
  527. F,
  528. j,
  529. f3 as f2,
  530. x2
  531. };
  532. //# sourceMappingURL=chunk-TLDCDW5L.js.map