import { n } from "./chunk-C7742RNZ.js"; import { e, u } from "./chunk-UVVU4UUO.js"; import { a } from "./chunk-RYY6632W.js"; import { j } from "./chunk-YAEIHDJH.js"; // node_modules/@arcgis/core/renderers/support/heatmapUtils.js var a2 = 2.4; function i(t) { return e(t * a2); } function c(t) { return u(t) / a2; } function f(r, n2, e2, a3) { let { color: i2, ratio: c2 } = n2, { color: f2, ratio: u3 } = e2; if (u3 === c2) { const t = 1e-6; 1 === u3 ? c2 -= t : u3 += t; } const s2 = a((a3 - c2) / (u3 - c2), 0, 1); j(r, i2.toArray(), f2.toArray(), s2); } function u2(t) { const r = 512, n2 = new Uint8ClampedArray(4 * r); if (t = t.filter(({ ratio: t2 }) => t2 >= 0 && t2 <= 1).sort((t2, r2) => t2.ratio - r2.ratio).map(({ color: t2, ratio: r2 }) => ({ color: t2, ratio: Math.max(r2, 1e-3) })), t.length < 1) return n2; let o = t[0], a3 = t[0], i2 = 1; const c2 = n(); for (let e2 = 0; e2 < r; e2++) { const u3 = (e2 + 0.5) / r; for (; u3 > a3.ratio && i2 < t.length; ) o = a3, a3 = t[i2++]; f(c2, o, a3, u3), n2.set(c2, 4 * e2); } return n2; } function s(t, r, o, e2) { const { radius: a3, fieldOffset: i2, field: c2 } = r, f2 = Math.round(u(a3)), u3 = new Float64Array(o * e2); let s2, l2 = Number.NEGATIVE_INFINITY; const h2 = d(c2, i2), y2 = /* @__PURE__ */ new Set(); for (const n2 of t) { const t2 = n2.getCursor(); for (; t2.next(); ) { const r2 = t2.getObjectId(); if (y2.has(r2)) continue; y2.add(r2); const n3 = t2.readLegacyPointGeometry(), a4 = 128; if (n3.x < -a4 || n3.x >= o + a4 || n3.y < -a4 || n3.y > e2 + a4) continue; const i3 = +h2(t2), c3 = Math.max(0, Math.round(n3.x) - f2), d2 = Math.max(0, Math.round(n3.y) - f2), g = Math.min(e2, Math.round(n3.y) + f2), A = Math.min(o, Math.round(n3.x) + f2); for (let t3 = d2; t3 < g; t3++) for (let r3 = c3; r3 < A; r3++) { const e3 = t3 * o + r3, a5 = m(n3.x - r3, n3.y - t3, f2); s2 = u3[e3] += a5 * i3, s2 > l2 && (l2 = s2); } } } return { matrix: u3.buffer, max: l2 }; } function l(t, r, n2, o, e2, a3) { t.canvas.width = t.canvas.height = r, t.clearRect(0, 0, r, r); const i2 = t.getImageData(0, 0, r, r); n2 && o && i2.data.set(new Uint8ClampedArray(h(r, n2, o, e2, a3))), t.putImageData(i2, 0, 0); } function h(r, n2, o, e2, a3) { const i2 = new Uint32Array(r * r), c2 = "buffer" in n2 ? n2 : new Float64Array(n2), f2 = "buffer" in o ? new Uint32Array(o.buffer) : new Uint32Array(new Uint8Array(o).buffer), u3 = f2.length / (a3 - e2); for (let s2 = 0; s2 < c2.length; s2++) { const r2 = c2[s2], n3 = Math.floor((r2 - e2) * u3); i2[s2] = f2[a(n3, 0, f2.length - 1)]; } return i2.buffer; } function m(t, r, n2) { const o = Math.sqrt(t ** 2 + r ** 2) / n2; return o > 1 ? 0 : 3 / (Math.PI * n2 ** 2) * (1 - o ** 2) ** 2; } function y(t, r) { return "function" == typeof t ? t : t ? "string" == typeof r ? (r2) => -1 * +r2[t] : (n2) => +n2[t] + r : () => 1; } function d(t, r) { return null != t ? "string" == typeof r ? (r2) => -1 * +r2.readAttribute(t) : (n2) => +n2.readAttribute(t) + r : (t2) => 1; } export { a2 as a, i, c, u2 as u, s, l, m, y }; //# sourceMappingURL=chunk-PJNBFKPF.js.map