chunk-XNVWGZWL.js 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630
  1. import {
  2. i as i2,
  3. o
  4. } from "./chunk-264YGWEE.js";
  5. import {
  6. r as r3
  7. } from "./chunk-ZLQP3WDC.js";
  8. import {
  9. E as E3,
  10. a
  11. } from "./chunk-WBWQJQK4.js";
  12. import {
  13. D as D2,
  14. F as F2,
  15. x2 as x
  16. } from "./chunk-TLDCDW5L.js";
  17. import {
  18. ge
  19. } from "./chunk-T2SKWJGU.js";
  20. import {
  21. E as E2
  22. } from "./chunk-H2VOWDMO.js";
  23. import {
  24. I
  25. } from "./chunk-EQNT4A7P.js";
  26. import {
  27. t as t2
  28. } from "./chunk-4OM3EX6P.js";
  29. import {
  30. C,
  31. D,
  32. E,
  33. F,
  34. G,
  35. L,
  36. P,
  37. R
  38. } from "./chunk-3OFVLRSL.js";
  39. import {
  40. e as e2
  41. } from "./chunk-IQBIGNPU.js";
  42. import {
  43. t as t3
  44. } from "./chunk-UDYHZLTE.js";
  45. import {
  46. M,
  47. b,
  48. f as f2,
  49. h,
  50. i,
  51. l as l2,
  52. r as r2
  53. } from "./chunk-O3JQY77G.js";
  54. import {
  55. g
  56. } from "./chunk-7C23ILQ4.js";
  57. import {
  58. d
  59. } from "./chunk-YZVAB3DF.js";
  60. import {
  61. l
  62. } from "./chunk-TJV6ODRM.js";
  63. import {
  64. u
  65. } from "./chunk-UVVU4UUO.js";
  66. import {
  67. m as m2
  68. } from "./chunk-RYY6632W.js";
  69. import {
  70. w,
  71. w2
  72. } from "./chunk-6T6G6LCQ.js";
  73. import {
  74. e,
  75. m,
  76. n5 as n,
  77. y3 as y
  78. } from "./chunk-2Z2TG5CU.js";
  79. import {
  80. f,
  81. j
  82. } from "./chunk-V6P2MAQQ.js";
  83. import {
  84. s2 as s
  85. } from "./chunk-E5O6P5I2.js";
  86. import {
  87. r,
  88. t
  89. } from "./chunk-YXWMMD76.js";
  90. // node_modules/@arcgis/core/views/2d/engine/flow/utils.js
  91. function n2(e4) {
  92. const n3 = i3(a2(e4)), o3 = n3, s4 = true, r5 = Math.max(n3 / 2, 5), l6 = Math.round(u(e4.maxPathLength) / r5) + 1, u6 = 10, { density: c3 } = e4;
  93. return { smoothing: u(e4.smoothing), interpolate: true, velocityScale: "flow-from" === e4.flowRepresentation ? 1 : -1, verticesPerLine: l6, minSpeedThreshold: 1e-3, segmentLength: r5, maxTurnAngle: 1, collisions: s4, lineCollisionWidth: o3, lineSpacing: u6, density: c3 };
  94. }
  95. function i3(e4) {
  96. return "constant" === e4.kind ? e4.value[0] : e4.values[e4.values.length - 1];
  97. }
  98. function o2(e4) {
  99. const t6 = e4.toRgba();
  100. return [t6[0] / 255, t6[1] / 255, t6[2] / 255, t6[3]];
  101. }
  102. function s2(e4) {
  103. return { kind: "constant", value: [0.1, 0.1, 0.1, 1] };
  104. }
  105. function a2(e4) {
  106. if (!e4.hasVisualVariables("size"))
  107. return { kind: "constant", value: [u(e4.trailWidth)] };
  108. const n3 = e4.getVisualVariablesForType("size")[0], i4 = [], o3 = [];
  109. let s4;
  110. if (n3.stops) {
  111. for (const e5 of n3.stops)
  112. i4.push(e5.value), o3.push(u(e5.size));
  113. s4 = n3.stops.length;
  114. } else
  115. i4.push(n3.minDataValue, n3.maxDataValue), o3.push(u(n3.minSize), u(n3.maxSize)), s4 = 2;
  116. return { kind: "ramp", stops: i4, values: o3, count: s4 };
  117. }
  118. function r4(e4) {
  119. if (!e4.hasVisualVariables("color"))
  120. return { kind: "constant", value: o2(e4.color) };
  121. const t6 = e4.getVisualVariablesForType("color")[0], n3 = [], i4 = [];
  122. for (const s4 of t6.stops)
  123. n3.push(s4.value), Array.prototype.push.apply(i4, o2(s4.color));
  124. return { kind: "ramp", stops: n3, values: i4, count: t6.stops.length };
  125. }
  126. function l3(e4) {
  127. if (!e4.hasVisualVariables("opacity"))
  128. return { kind: "constant", value: [1] };
  129. const t6 = e4.getVisualVariablesForType("opacity")[0], n3 = [], i4 = [];
  130. for (const o3 of t6.stops)
  131. n3.push(o3.value), i4.push(o3.opacity);
  132. return { kind: "ramp", stops: n3, values: i4, count: t6.stops.length };
  133. }
  134. function u2(e4, t6, n3, i4) {
  135. switch (t6) {
  136. case "int":
  137. e4.setUniform1iv(n3, i4);
  138. break;
  139. case "float":
  140. e4.setUniform1fv(n3, i4);
  141. break;
  142. case "vec2":
  143. e4.setUniform2fv(n3, i4);
  144. break;
  145. case "vec3":
  146. e4.setUniform3fv(n3, i4);
  147. break;
  148. case "vec4":
  149. e4.setUniform4fv(n3, i4);
  150. }
  151. }
  152. function c(e4, t6, n3, i4) {
  153. "constant" === i4.kind ? u2(e4, n3, `u_${t6}`, i4.value) : (u2(e4, "float", `u_${t6}_stops`, i4.stops), u2(e4, n3, `u_${t6}_values`, i4.values), e4.setUniform1i(`u_${t6}_count`, i4.count));
  154. }
  155. function p(e4, t6) {
  156. let n3 = true;
  157. return n3 = n3 && e4.collisions === t6.collisions, n3 = n3 && e4.density === t6.density, n3 = n3 && e4.interpolate === t6.interpolate, n3 = n3 && e4.lineCollisionWidth === t6.lineCollisionWidth, n3 = n3 && e4.lineSpacing === t6.lineSpacing, n3 = n3 && e4.maxTurnAngle === t6.maxTurnAngle, n3 = n3 && e4.minSpeedThreshold === t6.minSpeedThreshold, n3 = n3 && e4.segmentLength === t6.segmentLength, n3 = n3 && e4.smoothing === t6.smoothing, n3 = n3 && e4.velocityScale === t6.velocityScale, n3 = n3 && e4.verticesPerLine === t6.verticesPerLine, n3;
  158. }
  159. function f3(t6, n3) {
  160. return t6 === n3 || !(!r(t6) || !r(n3)) && t6.equals(n3);
  161. }
  162. function m3(e4, t6) {
  163. if (!p(e4.simulationSettings, t6.simulationSettings))
  164. return false;
  165. if (!f3(e4.timeExtent, t6.timeExtent))
  166. return false;
  167. let n3 = true;
  168. return n3 = n3 && e4.loadImagery === t6.loadImagery, n3 = n3 && e4.createFlowMesh === t6.createFlowMesh, n3 = n3 && e4.color.kind === t6.color.kind, n3 = n3 && e4.opacity.kind === t6.opacity.kind, n3 = n3 && e4.size.kind === t6.size.kind, n3;
  169. }
  170. // node_modules/@arcgis/core/views/2d/engine/flow/styles/Imagery.js
  171. var d2 = class {
  172. constructor(t6) {
  173. this._params = t6, this.animated = false;
  174. }
  175. isCompatible(t6) {
  176. if (!(t6 instanceof d2))
  177. return false;
  178. if (!f3(this._params.timeExtent, t6._params.timeExtent))
  179. return false;
  180. let r5 = true;
  181. return r5 = r5 && this._params.loadImagery === t6._params.loadImagery, r5 = r5 && this._params.color.kind === t6._params.color.kind, r5 = r5 && this._params.opacity.kind === t6._params.opacity.kind, r5;
  182. }
  183. async load(a3, r5) {
  184. const { extent: e4, size: s4 } = a3;
  185. f(r5);
  186. const i4 = await this._params.loadImagery(e4, s4[0], s4[1], this._params.timeExtent, r5);
  187. return new g2(i4, { color: this._params.color, opacity: this._params.opacity });
  188. }
  189. render(t6, a3, e4) {
  190. const { context: s4 } = t6, { program: n3 } = e4;
  191. s4.setFaceCullingEnabled(false), s4.setBlendingEnabled(true), s4.setBlendFunction(R.ONE, R.ONE_MINUS_SRC_ALPHA), s4.useProgram(n3), n3.setUniformMatrix3fv("u_dvsMat3", a3.dvsMat3), s4.bindTexture(e4.texture, 0), n3.setUniform1i("u_texture", 0), n3.setUniform1f("u_Min", e4.min), n3.setUniform1f("u_Max", e4.max), c(n3, "color", "vec4", this._params.color), c(n3, "opacity", "float", this._params.opacity), s4.bindVAO(e4.vertexArray), s4.drawArrays(E.TRIANGLE_STRIP, 0, 4);
  192. }
  193. };
  194. var u3 = /* @__PURE__ */ new Map();
  195. u3.set("a_position", 0), u3.set("a_texcoord", 1);
  196. var w3 = { geometry: [new t2("a_position", 2, C.UNSIGNED_SHORT, 0, 8), new t2("a_texcoord", 2, C.UNSIGNED_SHORT, 4, 8)] };
  197. var x2 = { vsPath: "raster/flow/imagery", fsPath: "raster/flow/imagery", attributes: u3 };
  198. var g2 = class {
  199. constructor(t6, a3) {
  200. this._flowData = t6, this._values = a3;
  201. }
  202. attach(t6) {
  203. const { context: a3 } = t6, { width: r5, height: s4 } = this._flowData, i4 = E3.createVertex(a3, F.STATIC_DRAW, new Uint16Array([0, 0, 0, 1, r5, 0, 1, 1, 0, s4, 0, 0, r5, s4, 1, 0])), o3 = new a(a3, u3, w3, { geometry: i4 }), f8 = [];
  204. "ramp" === this._values.color.kind && f8.push("vvColor"), "ramp" === this._values.opacity.kind && f8.push("vvOpacity");
  205. const d6 = t6.painter.materialManager.getProgram(x2, f8);
  206. let g4 = 1e6, y5 = -1e6;
  207. for (let e4 = 0; e4 < s4; e4++)
  208. for (let t7 = 0; t7 < r5; t7++)
  209. if (0 !== this._flowData.mask[e4 * r5 + t7]) {
  210. const a4 = this._flowData.data[2 * (e4 * r5 + t7) + 0], s5 = this._flowData.data[2 * (e4 * r5 + t7) + 1], i5 = Math.sqrt(a4 * a4 + s5 * s5);
  211. g4 = Math.min(g4, i5), y5 = Math.max(y5, i5);
  212. }
  213. const A = new Uint8Array(4 * r5 * s4);
  214. for (let e4 = 0; e4 < s4; e4++)
  215. for (let t7 = 0; t7 < r5; t7++)
  216. if (0 !== this._flowData.mask[e4 * r5 + t7]) {
  217. const a4 = this._flowData.data[2 * (e4 * r5 + t7) + 0], s5 = this._flowData.data[2 * (e4 * r5 + t7) + 1], i5 = (Math.sqrt(a4 * a4 + s5 * s5) - g4) / (y5 - g4);
  218. A[4 * (e4 * r5 + t7) + 0] = 255 * i5, A[4 * (e4 * r5 + t7) + 1] = 0, A[4 * (e4 * r5 + t7) + 2] = 0, A[4 * (e4 * r5 + t7) + 3] = 255;
  219. } else
  220. A[4 * (e4 * r5 + t7) + 0] = 0, A[4 * (e4 * r5 + t7) + 1] = 0, A[4 * (e4 * r5 + t7) + 2] = 0, A[4 * (e4 * r5 + t7) + 3] = 0;
  221. const E4 = new E2(a3, { pixelFormat: P.RGBA, internalFormat: P.RGBA, samplingMode: L.LINEAR, dataType: G.UNSIGNED_BYTE, wrapMode: D.CLAMP_TO_EDGE, flipped: true, width: r5, height: s4 }, A);
  222. this.vertexArray = o3, this.program = d6, this.texture = E4, this.min = g4, this.max = y5, this._flowData = null;
  223. }
  224. detach() {
  225. this.vertexArray.dispose(), this.texture.dispose();
  226. }
  227. get ready() {
  228. return this.program.isCompiled;
  229. }
  230. };
  231. // node_modules/@arcgis/core/views/2d/engine/flow/styles/Particles.js
  232. var _ = class {
  233. constructor(t6) {
  234. this._params = t6;
  235. }
  236. get animated() {
  237. return this._params.flowSpeed > 0;
  238. }
  239. isCompatible(t6) {
  240. return t6 instanceof _ && m3(this._params, t6._params);
  241. }
  242. async load(e4, a3) {
  243. const { extent: s4, size: r5 } = e4;
  244. f(a3);
  245. const i4 = await this._params.loadImagery(s4, r5[0], r5[1], this._params.timeExtent, a3), { vertexData: o3, indexData: n3 } = await this._params.createFlowMesh("Particles", this._params.simulationSettings, i4, a3);
  246. return new c2(o3, n3, { color: this._params.color, opacity: this._params.opacity, size: this._params.size });
  247. }
  248. render(t6, e4, s4) {
  249. const { context: n3 } = t6, { program: m5 } = s4;
  250. n3.setFaceCullingEnabled(false), n3.setBlendingEnabled(true), n3.setBlendFunction(R.ONE, R.ONE_MINUS_SRC_ALPHA), n3.useProgram(m5), m5.setUniform1f("u_time", e4.time), m5.setUniform1f("u_trailLength", this._params.trailLength), m5.setUniform1f("u_flowSpeed", this._params.flowSpeed), m5.setUniform1f("u_featheringSize", this._params.featheringSize), m5.setUniform1f("u_featheringOffset", this._params.featheringOffset), m5.setUniform1f("u_introFade", this._params.introFade ? 1 : 0), m5.setUniform1f("u_fadeToZero", this._params.fadeToZero ? 1 : 0), m5.setUniform1f("u_decayRate", this._params.decayRate), m5.setUniformMatrix3fv("u_dvsMat3", e4.dvsMat3), m5.setUniformMatrix3fv("u_displayViewMat3", e4.displayViewMat3), c(m5, "color", "vec4", this._params.color), c(m5, "opacity", "float", this._params.opacity), c(m5, "size", "float", this._params.size), n3.bindVAO(s4.vertexArray), n3.drawElements(E.TRIANGLES, s4.indexCount, C.UNSIGNED_INT, 0);
  251. }
  252. };
  253. var l4 = /* @__PURE__ */ new Map();
  254. l4.set("a_xyts0", 0), l4.set("a_xyts1", 1), l4.set("a_typeIdDurationSeed", 2), l4.set("a_extrudeInfo", 3);
  255. var h2 = { geometry: [new t2("a_xyts0", 4, C.FLOAT, 0, 64), new t2("a_xyts1", 4, C.FLOAT, 16, 64), new t2("a_typeIdDurationSeed", 4, C.FLOAT, 32, 64), new t2("a_extrudeInfo", 4, C.FLOAT, 48, 64)] };
  256. var f4 = { vsPath: "raster/flow/particles", fsPath: "raster/flow/particles", attributes: l4 };
  257. var c2 = class {
  258. constructor(t6, e4, a3) {
  259. this._vertexData = t6, this._indexData = e4, this._values = a3;
  260. }
  261. attach(t6) {
  262. const { context: e4 } = t6, a3 = E3.createVertex(e4, F.STATIC_DRAW, this._vertexData), r5 = E3.createIndex(e4, F.STATIC_DRAW, this._indexData), i4 = new a(e4, l4, h2, { geometry: a3 }, r5), o3 = [];
  263. "ramp" === this._values.color.kind && o3.push("vvColor"), "ramp" === this._values.opacity.kind && o3.push("vvOpacity"), "ramp" === this._values.size.kind && o3.push("vvSize");
  264. const p3 = t6.painter.materialManager.getProgram(f4, o3);
  265. this.vertexArray = i4, this.program = p3, this.indexCount = this._indexData.length, this._vertexData = null, this._indexData = null;
  266. }
  267. detach() {
  268. this.vertexArray.dispose();
  269. }
  270. get ready() {
  271. return this.program.isCompiled;
  272. }
  273. };
  274. // node_modules/@arcgis/core/views/2d/engine/flow/styles/Stack.js
  275. var t4 = class {
  276. constructor(t6) {
  277. this._styles = t6;
  278. }
  279. get animated() {
  280. return this._styles.reduce((t6, s4) => t6 || s4.animated, false);
  281. }
  282. isCompatible(s4) {
  283. if (!(s4 instanceof t4))
  284. return false;
  285. if (this._styles.length !== s4._styles.length)
  286. return false;
  287. const e4 = this._styles.length;
  288. for (let t6 = 0; t6 < e4; t6++)
  289. if (!this._styles[t6].isCompatible(s4._styles[t6]))
  290. return false;
  291. return true;
  292. }
  293. async load(t6, e4) {
  294. const r5 = await Promise.all(this._styles.map((s4) => s4.load(t6, e4)));
  295. return new s3(r5);
  296. }
  297. render(t6, s4, e4) {
  298. for (let r5 = 0; r5 < this._styles.length; r5++)
  299. this._styles[r5].render(t6, s4, e4.resources[r5]);
  300. }
  301. };
  302. var s3 = class {
  303. constructor(t6) {
  304. this.resources = t6;
  305. }
  306. attach(t6) {
  307. for (const s4 of this.resources)
  308. s4.attach(t6);
  309. }
  310. detach() {
  311. for (const t6 of this.resources)
  312. t6.detach();
  313. }
  314. get ready() {
  315. return this.resources.reduce((t6, s4) => t6 && s4.ready, true);
  316. }
  317. };
  318. // node_modules/@arcgis/core/views/2d/engine/flow/styles/Streamlines.js
  319. var _2 = class {
  320. constructor(t6) {
  321. this._params = t6;
  322. }
  323. get animated() {
  324. return this._params.flowSpeed > 0;
  325. }
  326. isCompatible(t6) {
  327. return t6 instanceof _2 && m3(this._params, t6._params);
  328. }
  329. async load(e4, a3) {
  330. const { extent: s4, size: r5 } = e4;
  331. f(a3);
  332. const i4 = await this._params.loadImagery(s4, r5[0], r5[1], this._params.timeExtent, a3), { vertexData: o3, indexData: n3 } = await this._params.createFlowMesh("Streamlines", this._params.simulationSettings, i4, a3);
  333. return new d3(o3, n3, { color: this._params.color, opacity: this._params.opacity, size: this._params.size });
  334. }
  335. render(t6, e4, s4) {
  336. const { context: n3 } = t6, { program: m5 } = s4;
  337. n3.setFaceCullingEnabled(false), n3.setBlendingEnabled(true), n3.setBlendFunction(R.ONE, R.ONE_MINUS_SRC_ALPHA), n3.useProgram(m5), m5.setUniform1f("u_time", e4.time), m5.setUniform1f("u_trailLength", this._params.trailLength), m5.setUniform1f("u_flowSpeed", this._params.flowSpeed), m5.setUniform1f("u_featheringSize", this._params.featheringSize), m5.setUniform1f("u_featheringOffset", this._params.featheringOffset), m5.setUniform1f("u_introFade", this._params.introFade ? 1 : 0), m5.setUniform1f("u_fadeToZero", this._params.fadeToZero ? 1 : 0), m5.setUniform1f("u_decayRate", this._params.decayRate), m5.setUniformMatrix3fv("u_dvsMat3", e4.dvsMat3), m5.setUniformMatrix3fv("u_displayViewMat3", e4.displayViewMat3), c(m5, "color", "vec4", this._params.color), c(m5, "opacity", "float", this._params.opacity), c(m5, "size", "float", this._params.size), n3.bindVAO(s4.vertexArray), n3.drawElements(E.TRIANGLES, s4.indexCount, C.UNSIGNED_INT, 0);
  338. }
  339. };
  340. var l5 = /* @__PURE__ */ new Map();
  341. l5.set("a_positionAndSide", 0), l5.set("a_timeInfo", 1), l5.set("a_extrude", 2), l5.set("a_speed", 3);
  342. var h3 = { geometry: [new t2("a_positionAndSide", 3, C.FLOAT, 0, 36), new t2("a_timeInfo", 3, C.FLOAT, 12, 36), new t2("a_extrude", 2, C.FLOAT, 24, 36), new t2("a_speed", 1, C.FLOAT, 32, 36)] };
  343. var f5 = { vsPath: "raster/flow/streamlines", fsPath: "raster/flow/streamlines", attributes: l5 };
  344. var d3 = class {
  345. constructor(t6, e4, a3) {
  346. this._vertexData = t6, this._indexData = e4, this._values = a3;
  347. }
  348. attach(t6) {
  349. const { context: e4 } = t6, a3 = E3.createVertex(e4, F.STATIC_DRAW, this._vertexData), r5 = E3.createIndex(e4, F.STATIC_DRAW, this._indexData), i4 = new a(e4, l5, h3, { geometry: a3 }, r5), o3 = [];
  350. "ramp" === this._values.color.kind && o3.push("vvColor"), "ramp" === this._values.opacity.kind && o3.push("vvOpacity"), "ramp" === this._values.size.kind && o3.push("vvSize");
  351. const p3 = t6.painter.materialManager.getProgram(f5, o3);
  352. this.vertexArray = i4, this.program = p3, this.indexCount = this._indexData.length, this._vertexData = null, this._indexData = null;
  353. }
  354. detach() {
  355. this.vertexArray.dispose();
  356. }
  357. get ready() {
  358. return this.program.isCompiled;
  359. }
  360. };
  361. // node_modules/@arcgis/core/views/2d/engine/flow/createFlowStyle.js
  362. var f6 = 4;
  363. var p2 = 1;
  364. var u4 = 0.5;
  365. var y2 = true;
  366. var d4 = true;
  367. var g3 = 2.3;
  368. function w4(w5, h6) {
  369. const { flowSpeed: j2, trailLength: v } = w5, S = n2(w5);
  370. let k = null;
  371. const x3 = { opacity: l3(w5), size: a2(w5) };
  372. let I2 = r4(w5);
  373. if ("none" === w5.background)
  374. x3.color = I2;
  375. else {
  376. "constant" === I2.kind && (I2 = { kind: "ramp", stops: [0, 1], values: [0, 0, 0, 1, I2.value[0], I2.value[1], I2.value[2], I2.value[3]], count: 2 });
  377. const e4 = { loadImagery: h6.loadImagery, timeExtent: h6.timeExtent, color: I2, opacity: { kind: "constant", value: [1] } };
  378. k = new d2(e4), x3.color = s2();
  379. }
  380. const z = { loadImagery: h6.loadImagery, createFlowMesh: h6.createFlowMesh, simulationSettings: S, timeExtent: h6.timeExtent, trailLength: v, flowSpeed: j2, featheringSize: p2, featheringOffset: u4, introFade: y2, fadeToZero: d4, decayRate: g3, color: x3.color, opacity: x3.opacity, size: x3.size }, E4 = "butt" === w5.trailCap || i3(a2(w5)) <= f6 ? new _2(z) : new _(z);
  381. return r(k) ? new t4([k, E4]) : E4;
  382. }
  383. // node_modules/@arcgis/core/views/2d/engine/flow/FlowContainer.js
  384. var t5 = class extends o {
  385. constructor() {
  386. super(...arguments), this.flowStyle = null;
  387. }
  388. get requiresDedicatedFBO() {
  389. return false;
  390. }
  391. doRender(e4) {
  392. super.doRender(e4);
  393. }
  394. prepareRenderPasses(s4) {
  395. const t6 = s4.registerRenderPass({ name: "flow", brushes: [i2], target: () => this.children, drawPhase: I.MAP });
  396. return [...super.prepareRenderPasses(s4), t6];
  397. }
  398. };
  399. // node_modules/@arcgis/core/views/2d/engine/flow/FlowDisplayData.js
  400. var e3 = class {
  401. constructor(t6, e4, s4, a3) {
  402. this.state = { name: "created" }, this.flowStyle = t6, this.extent = e4, this.size = s4, this.pixelRatio = a3;
  403. }
  404. async load() {
  405. const t6 = new AbortController();
  406. this.state = { name: "loading", abortController: t6 };
  407. const e4 = { extent: this.extent, size: this.size, pixelRatio: this.pixelRatio }, s4 = await this.flowStyle.load(e4, t6.signal);
  408. this.state = { name: "loaded", resources: s4 };
  409. }
  410. attach(e4) {
  411. if ("loaded" !== this.state.name)
  412. return void s.getLogger("esri.views.2d.engine.flow.FlowDisplayData").error("Only loaded resources can be attached.");
  413. const s4 = this.state.resources;
  414. s4.attach(e4), this.state = { name: "attached", resources: s4 };
  415. }
  416. detach() {
  417. if ("loading" === this.state.name)
  418. return this.state.abortController.abort(), void (this.state = { name: "detached" });
  419. "attached" === this.state.name && (this.state.resources.detach(), this.state = { name: "detached" });
  420. }
  421. update(t6) {
  422. if (!this.flowStyle.isCompatible(t6.flowStyle))
  423. return false;
  424. return !(!this.extent.equals(t6.extent) || this.size[0] !== t6.size[0] || this.size[1] !== t6.size[1] || this.pixelRatio !== t6.pixelRatio) && (this.flowStyle = t6.flowStyle, true);
  425. }
  426. };
  427. // node_modules/@arcgis/core/views/2d/engine/flow/FlowDisplayObject.js
  428. var m4 = class extends r3 {
  429. constructor() {
  430. super(...arguments), this._displayData = null;
  431. }
  432. get displayData() {
  433. return this._displayData;
  434. }
  435. set displayData(t6) {
  436. this._displayData = t6, this.requestRender();
  437. }
  438. clear() {
  439. r(this._displayData) && (this._displayData.detach(), this._displayData = null, this.requestRender());
  440. }
  441. setTransform(s4) {
  442. const { displayData: n3 } = this;
  443. if (t(n3))
  444. return;
  445. const l6 = n3.extent.xmin, m5 = n3.extent.ymax, p3 = [0, 0];
  446. s4.toScreen(p3, [l6, m5]);
  447. const c3 = (n3.extent.xmax - n3.extent.xmin) / n3.size[0] / s4.resolution, d6 = m2(s4.rotation), { dvs: h6 } = this.transforms;
  448. l2(h6, [-1, 1, 0]), f2(h6, h6, [2 / (s4.size[0] * s4.pixelRatio), -2 / (s4.size[1] * s4.pixelRatio), 1]), M(h6, h6, [p3[0], p3[1], 0]), h(h6, h6, d6), f2(h6, h6, [c3 * s4.pixelRatio, c3 * s4.pixelRatio, 1]);
  449. }
  450. _createTransforms() {
  451. return { dvs: e2() };
  452. }
  453. };
  454. // node_modules/@arcgis/core/views/2d/engine/flow/FlowStrategy.js
  455. var h4 = 1.15;
  456. var y3 = class extends m {
  457. constructor(t6) {
  458. super(t6), this._flowDisplayObject = new m4(), this._loading = null;
  459. }
  460. initialize() {
  461. this.flowContainer.addChild(this._flowDisplayObject);
  462. }
  463. destroy() {
  464. this._clear(), this.flowContainer.removeAllChildren();
  465. }
  466. get updating() {
  467. return null != this._loading;
  468. }
  469. update(t6) {
  470. const { flowStyle: o3 } = this.flowContainer;
  471. if (t(o3))
  472. return void this._clear();
  473. const { extent: i4, rotation: l6, resolution: n3, pixelRatio: p3 } = t6.state, m5 = u5(i4, l6);
  474. m5.expand(h4);
  475. const d6 = [Math.round((m5.xmax - m5.xmin) / n3), Math.round((m5.ymax - m5.ymin) / n3)], y5 = new e3(o3, m5, d6, p3);
  476. if (r(this._loading)) {
  477. if (this._loading.update(y5))
  478. return;
  479. this._loading.detach(), this._loading = null;
  480. }
  481. !t(this._flowDisplayObject.displayData) && this._flowDisplayObject.displayData.update(y5) || (y5.load().then(() => {
  482. this._flowDisplayObject.clear(), this._flowDisplayObject.displayData = this._loading, this._loading = null;
  483. }, (t7) => {
  484. j(t7) || (s.getLogger(this.declaredClass).error("A resource failed to load.", t7), this._loading = null);
  485. }), this._loading = y5);
  486. }
  487. _clear() {
  488. this._flowDisplayObject.clear(), r(this._loading) && (this._loading.detach(), this._loading = null);
  489. }
  490. };
  491. e([y()], y3.prototype, "_loading", void 0), e([y()], y3.prototype, "flowContainer", void 0), e([y()], y3.prototype, "updating", null), y3 = e([n("esri.views.2d.engine.flow.FlowStrategy")], y3);
  492. var f7 = y3;
  493. function u5(t6, o3) {
  494. const e4 = new w({ x: (t6.xmax + t6.xmin) / 2, y: (t6.ymax + t6.ymin) / 2, spatialReference: t6.spatialReference }), s4 = t6.xmax - t6.xmin, r5 = t6.ymax - t6.ymin, a3 = Math.abs(Math.cos(m2(o3))), l6 = Math.abs(Math.sin(m2(o3))), n3 = a3 * s4 + l6 * r5, c3 = l6 * s4 + a3 * r5, m5 = new w2({ xmin: e4.x - n3 / 2, ymin: e4.y - c3 / 2, xmax: e4.x + n3 / 2, ymax: e4.y + c3 / 2, spatialReference: t6.spatialReference });
  495. return m5.centerAt(e4), m5;
  496. }
  497. // node_modules/@arcgis/core/views/2d/engine/flow/FlowView2D.js
  498. var h5 = class extends d {
  499. constructor() {
  500. super(...arguments), this._loadImagery = (t6, e4, i4, r5, o3) => x(this.layer, t6, e4, i4, r5, o3), this._createFlowMesh = (t6, e4, i4, r5) => this.layer.createFlowMesh({ meshType: t6, flowData: i4, simulationSettings: e4 }, { signal: r5 }), this.attached = false, this.container = null, this.layer = null, this.type = "flow", this.timeExtent = null, this.redrawOrRefetch = async () => {
  501. this._updateVisualization();
  502. };
  503. }
  504. get updating() {
  505. return !this._strategy || this._strategy.updating;
  506. }
  507. attach() {
  508. const { layer: t6 } = this, e4 = () => {
  509. this._loadImagery = (e5, i4, r5, o3, s4) => x(t6, e5, i4, r5, o3, s4), this._updateVisualization();
  510. };
  511. "multidimensionalDefinition" in t6 ? this.handles.add(l(() => t6.multidimensionalDefinition, e4)) : this.handles.add([l(() => t6.mosaicRule, e4), l(() => t6.renderingRule, e4), l(() => t6.definitionExpression, e4)]), this.container = new t5(), this._strategy = new f7({ flowContainer: this.container }), this._updateVisualization();
  512. }
  513. detach() {
  514. this._strategy.destroy(), this.container.removeAllChildren(), this.container = null, this.handles.removeAll();
  515. }
  516. update(t6) {
  517. t6.stationary ? this._strategy.update(t6) : this.layerView.requestUpdate();
  518. }
  519. hitTest(t6) {
  520. return new g({ attributes: {}, geometry: t6.clone(), layer: this.layer });
  521. }
  522. moveEnd() {
  523. }
  524. async doRefresh() {
  525. }
  526. _updateVisualization() {
  527. const { renderer: t6 } = this.layer;
  528. if ("flow" !== t6.type)
  529. return;
  530. const e4 = w4(t6, { loadImagery: this._loadImagery, createFlowMesh: this._createFlowMesh, timeExtent: this.timeExtent });
  531. this.container.flowStyle = e4, this.layerView.requestUpdate();
  532. }
  533. };
  534. e([y()], h5.prototype, "_strategy", void 0), e([y()], h5.prototype, "attached", void 0), e([y()], h5.prototype, "container", void 0), e([y()], h5.prototype, "layer", void 0), e([y()], h5.prototype, "layerView", void 0), e([y()], h5.prototype, "type", void 0), e([y()], h5.prototype, "updating", null), e([y()], h5.prototype, "timeExtent", void 0), h5 = e([n("esri.views.2d.engine.flow.FlowView2D")], h5);
  535. var d5 = h5;
  536. // node_modules/@arcgis/core/views/2d/engine/imagery/RasterVFDisplayObject.js
  537. var y4 = class extends r3 {
  538. constructor(t6 = null) {
  539. super(), this._source = null, this._symbolizerParameters = null, this._vaoInvalidated = true, this.coordScale = [1, 1], this.height = null, this.stencilRef = 0, this.resolution = null, this.pixelRatio = 1, this.x = 0, this.y = 0, this.rotation = 0, this.rawPixelData = null, this.width = null, this.source = t6;
  540. }
  541. destroy() {
  542. var _a, _b;
  543. r(this.vaoData) && ((_a = this.vaoData.magdir) == null ? void 0 : _a.vao.dispose(), (_b = this.vaoData.scalar) == null ? void 0 : _b.vao.dispose(), this.vaoData = null);
  544. }
  545. get symbolizerParameters() {
  546. return this._symbolizerParameters;
  547. }
  548. set symbolizerParameters(t6) {
  549. JSON.stringify(this._symbolizerParameters) !== JSON.stringify(t6) && (this._symbolizerParameters = t6, this.invalidateVAO());
  550. }
  551. get source() {
  552. return this._source;
  553. }
  554. set source(t6) {
  555. this._source = t6, this.invalidateVAO();
  556. }
  557. invalidateVAO() {
  558. var _a, _b;
  559. !this._vaoInvalidated && r(this.vaoData) && ((_a = this.vaoData.magdir) == null ? void 0 : _a.vao.dispose(), (_b = this.vaoData.scalar) == null ? void 0 : _b.vao.dispose(), this.vaoData = null, this._vaoInvalidated = true, this.requestRender());
  560. }
  561. updateVectorFieldVAO(s4) {
  562. if (this._vaoInvalidated) {
  563. if (this._vaoInvalidated = false, r(this.source) && t(this.vaoData)) {
  564. const { style: t6 } = this.symbolizerParameters;
  565. switch (t6) {
  566. case "beaufort_ft":
  567. case "beaufort_km":
  568. case "beaufort_kn":
  569. case "beaufort_m":
  570. case "beaufort_mi":
  571. case "classified_arrow":
  572. case "ocean_current_kn":
  573. case "ocean_current_m":
  574. case "single_arrow":
  575. {
  576. const t7 = F2(this.source, this.symbolizerParameters), e4 = this._createVectorFieldVAO(s4.context, t7);
  577. this.vaoData = { magdir: e4 };
  578. }
  579. break;
  580. case "simple_scalar":
  581. {
  582. const t7 = D2(this.source, this.symbolizerParameters), e4 = this._createVectorFieldVAO(s4.context, t7);
  583. this.vaoData = { scalar: e4 };
  584. }
  585. break;
  586. case "wind_speed": {
  587. const t7 = F2(this.source, this.symbolizerParameters), e4 = this._createVectorFieldVAO(s4.context, t7), a3 = D2(this.source, this.symbolizerParameters), r5 = this._createVectorFieldVAO(s4.context, a3);
  588. this.vaoData = { magdir: e4, scalar: r5 };
  589. }
  590. }
  591. }
  592. this.ready(), this.requestRender();
  593. }
  594. }
  595. _createTransforms() {
  596. return { dvs: e2() };
  597. }
  598. setTransform(t6) {
  599. const e4 = r2(this.transforms.dvs), [n3, l6] = t6.toScreenNoRotation([0, 0], [this.x, this.y]), h6 = this.resolution / this.pixelRatio / t6.resolution, m5 = h6 * this.width, u6 = h6 * this.height, d6 = Math.PI * this.rotation / 180;
  600. M(e4, e4, t3(n3, l6)), M(e4, e4, t3(m5 / 2, u6 / 2)), h(e4, e4, -d6), M(e4, e4, t3(-m5 / 2, -u6 / 2)), b(e4, e4, t3(m5, u6)), i(this.transforms.dvs, t6.displayViewMat3, e4);
  601. }
  602. onAttach() {
  603. this.invalidateVAO();
  604. }
  605. onDetach() {
  606. this.invalidateVAO();
  607. }
  608. _createVectorFieldVAO(t6, e4) {
  609. const { vertexData: s4, indexData: a3 } = e4, r5 = E3.createVertex(t6, F.STATIC_DRAW, new Float32Array(s4)), i4 = E3.createIndex(t6, F.STATIC_DRAW, new Uint32Array(a3)), o3 = ge("vector-field", { geometry: [{ location: 0, name: "a_pos", count: 2, type: C.FLOAT, normalized: false }, { location: 1, name: "a_offset", count: 2, type: C.FLOAT, normalized: false }, { location: 2, name: "a_vv", count: 2, type: C.FLOAT, normalized: false }] });
  610. return { vao: new a(t6, o3.attributes, o3.bufferLayouts, { geometry: r5 }, i4), elementCount: a3.length };
  611. }
  612. };
  613. export {
  614. d5 as d,
  615. y4 as y
  616. };
  617. //# sourceMappingURL=chunk-XNVWGZWL.js.map