import { o2 as o } from "./chunk-XNLG7T2T.js"; import { t } from "./chunk-GZT4BVFP.js"; // node_modules/@arcgis/core/views/support/screenshotUtils.js function r(t2, i, h) { const { ctx: e, canvas: n } = g(t2, h), o2 = e.getImageData(0, 0, t2.width, t2.height), a = c(n, i); return u(n), { dataUrl: a, data: o2 }; } function l(t2, i) { const { ctx: h, canvas: e } = g(t2, i), n = h.getImageData(0, 0, t2.width, t2.height); return u(e), n; } function g(t2, i) { const h = f(); i.premultipliedAlpha && E(t2), h.width = t2.width, h.height = t2.height; const e = h.getContext("2d"); return e.putImageData(t2, 0, 0), i.flipY && B(e), { ctx: e, canvas: h }; } function u(t2) { t2.width = 0, t2.height = 0; } function f() { return t(d) && (d = document.createElement("canvas")), d; } var d = null; function c(t2, i) { const h = R[i.format], e = i.quality / 100; return t2.toDataURL(h, e); } function s(i, h) { const e = k(i), n = W[e]; return { format: e, quality: o(h != null ? h : n, 0, 100) }; } function w(t2, i) { return i / Math.max(t2[0], t2[1]); } function m(t2, i, h) { if (!t2 || !i) throw new Error("Cannot construct image data without dimensions"); if (j) try { return new ImageData(t2, i); } catch (e) { j = false; } return x(t2, i, h); } function M(t2, i, h, e) { if (!i || !h) throw new Error("Cannot construct image data without dimensions"); if (j) try { return new ImageData(t2, i, h); } catch (o2) { j = false; } const n = x(i, h, e); return n.data.set(t2, 0), n; } function p(t2, i, h, e = 0, n = 0, o2 = t2.width - e, a = t2.height - n, r2 = false) { const { data: l2 } = t2, { width: g2, height: u2, data: f2 } = i, d2 = o2 / g2, c2 = a / u2, s2 = Math.ceil(d2 / 2), w2 = Math.ceil(c2 / 2), m2 = t2.width; for (let M2 = 0; M2 < u2; M2++) for (let t3 = 0; t3 < g2; t3++) { const i2 = 4 * (t3 + (r2 ? u2 - M2 - 1 : M2) * g2); let o3 = 0, a2 = 0, p2 = 0, y = 0, x2 = 0, b2 = 0; const j2 = (M2 + 0.5) * c2; for (let r3 = Math.floor(M2 * c2); r3 < (M2 + 1) * c2; r3++) { const i3 = Math.abs(j2 - (r3 + 0.5)) / w2, g3 = (t3 + 0.5) * d2, u3 = i3 * i3; for (let f3 = Math.floor(t3 * d2); f3 < (t3 + 1) * d2; f3++) { const t4 = Math.abs(g3 - (f3 + 0.5)) / s2, i4 = Math.sqrt(u3 + t4 * t4); if (i4 >= 1) continue; let d3 = 2 * i4 * i4 * i4 - 3 * i4 * i4 + 1; const c3 = 4 * (e + f3 + (n + r3) * m2); b2 += d3 * l2[c3 + 3], a2 += d3, !h && l2[c3 + 3] < 255 && (d3 = d3 * l2[c3 + 3] / 255), p2 += d3 * l2[c3], y += d3 * l2[c3 + 1], x2 += d3 * l2[c3 + 2], o3 += d3; } } f2[i2] = p2 / o3, f2[i2 + 1] = y / o3, f2[i2 + 2] = x2 / o3, f2[i2 + 3] = b2 / a2; } return i; } function x(t2, i, h) { return h || (h = D()), h.getContext("2d").createImageData(t2, i); } var b = null; var j = true; function D() { return b || (b = document.createElement("canvas"), b.width = 1, b.height = 1), b; } function k(t2) { switch (t2) { case "png": case "jpg": case "jpeg": return t2; default: return U; } } function B(t2) { t2.save(), t2.globalCompositeOperation = "copy", t2.scale(1, -1), t2.translate(0, -t2.canvas.height), t2.drawImage(t2.canvas, 0, 0), t2.restore(); } function E(t2) { const i = t2.data, h = i.length; for (let e = 0; e < h; e += 4) { const t3 = i[e + 3]; if (t3 !== 255 && t3 > 0) { const h2 = 255 / t3; i[e + 0] = i[e + 0] * h2, i[e + 1] = i[e + 1] * h2, i[e + 2] = i[e + 2] * h2; } } } var R = { png: "image/png", jpg: "image/jpeg", jpeg: "image/jpeg" }; var H = 98; var U = "png"; var W = { png: 100, jpg: H, jpeg: H }; export { r, l, s, w, m, M, p }; //# sourceMappingURL=chunk-5JK4DCPE.js.map