import { i, l, o } from "./chunk-LGW7TID4.js"; import { r, t } from "./chunk-GZT4BVFP.js"; // node_modules/@arcgis/core/views/webgl/capabilities.js var n; var a; function l2(t2) { const e = i(t2); for (; e.length > 1; ) { const t3 = u(e.shift()); if (t3.available) return t3; } return u(e.shift()); } function u(t2) { switch (t2) { case o.WEBGL1: return i2(); case o.WEBGL2: return p(); } } function i2() { return n || (n = x()), n; } function p() { return a || (a = d()), a; } var f = class { constructor() { this.available = false, this.majorPerformanceCaveat = false, this.maxTextureSize = 0, this.supportsVertexShaderSamplers = false, this.supportsHighPrecisionFragment = false, this.supportsElementIndexUint = false, this.supportsStandardDerivatives = false, this.supportsInstancedArrays = false, this.supportsTextureFloat = false, this.supportsTextureHalfFloat = false, this.supportsColorBufferFloat = false, this.supportsColorBufferFloatBlend = false, this.supportsColorBufferHalfFloat = false; } }; var c = class extends f { constructor() { super(...arguments), this.type = o.WEBGL1; } }; var E = class extends f { constructor() { super(...arguments), this.type = o.WEBGL2, this.supportsElementIndexUint = true, this.supportsStandardDerivatives = true, this.supportsInstancedArrays = true, this.supportsTextureFloat = true, this.supportsTextureHalfFloat = true; } }; function _(r2, n2) { if (r2 === o.WEBGL1 && typeof WebGLRenderingContext === void 0 || r2 === o.WEBGL2 && typeof WebGL2RenderingContext === void 0) return null; const a2 = document.createElement("canvas"); if (!a2) return null; let l3 = l(a2, r2, { failIfMajorPerformanceCaveat: true }); if (t(l3) && (l3 = l(a2, r2), r(l3) && (n2.majorPerformanceCaveat = true)), t(l3)) return l3; if (r2 === o.WEBGL1) { const t2 = l3.getParameter(l3.VERSION)?.match(/^WebGL\s+([\d.]*)/); if (t2) { const e = parseFloat(t2[1]); n2.available = e >= 0.94; } } else n2.available = true; n2.maxTextureSize = l3.getParameter(l3.MAX_TEXTURE_SIZE), n2.supportsVertexShaderSamplers = l3.getParameter(l3.MAX_VERTEX_TEXTURE_IMAGE_UNITS) > 0; const u2 = l3.getShaderPrecisionFormat(l3.FRAGMENT_SHADER, l3.HIGH_FLOAT); return u2 && (n2.supportsHighPrecisionFragment = u2.precision > 0), l3; } function x() { const e = new c(), r2 = _(o.WEBGL1, e); return t(r2) || (e.supportsElementIndexUint = r2.getExtension("OES_element_index_uint") !== null, e.supportsStandardDerivatives = r2.getExtension("OES_standard_derivatives") !== null, e.supportsInstancedArrays = r2.getExtension("ANGLE_instanced_arrays") !== null, e.supportsTextureFloat = r2.getExtension("OES_texture_float") !== null, e.supportsTextureHalfFloat = r2.getExtension("OES_texture_half_float") !== null, e.supportsColorBufferFloat = r2.getExtension("WEBGL_color_buffer_float") !== null, e.supportsColorBufferFloatBlend = r2.getExtension("EXT_float_blend") !== null, e.supportsColorBufferHalfFloat = r2.getExtension("EXT_color_buffer_half_float") !== null), e; } function d() { const e = new E(), r2 = _(o.WEBGL2, e); return t(r2) || (e.supportsColorBufferFloat = r2.getExtension("EXT_color_buffer_float") !== null, e.supportsColorBufferFloatBlend = r2.getExtension("EXT_float_blend") !== null, e.supportsColorBufferHalfFloat = e.supportsColorBufferFloat || r2.getExtension("EXT_color_buffer_half_float") !== null), e; } export { l2 as l }; //# sourceMappingURL=chunk-4E6K4P67.js.map