import { t as __commonJSMin } from "../rolldown-runtime.mjs";

//#region node_modules/detect-gpu/dist/detect-gpu.umd.js
var require_detect_gpu_umd = /* @__PURE__ */ __commonJSMin(((exports, module) => {
	(function(e, r) {
		"object" == typeof exports && "undefined" != typeof module ? r(exports) : "function" == typeof define && define.amd ? define(["exports"], r) : r((e = "undefined" != typeof globalThis ? globalThis : e || self).DetectGPU = {});
	})(exports, (function(e) {
		"use strict";
		var r = function(e$1, n$1) {
			return (r = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e$2, r$1) {
				e$2.__proto__ = r$1;
			} || function(e$2, r$1) {
				for (var n$2 in r$1) Object.prototype.hasOwnProperty.call(r$1, n$2) && (e$2[n$2] = r$1[n$2]);
			})(e$1, n$1);
		};
		function n(e$1, r$1, n$1, t$1) {
			return new (n$1 || (n$1 = Promise))((function(o$1, a$1) {
				function i$1(e$2) {
					try {
						u$1(t$1.next(e$2));
					} catch (e$3) {
						a$1(e$3);
					}
				}
				function c$1(e$2) {
					try {
						u$1(t$1.throw(e$2));
					} catch (e$3) {
						a$1(e$3);
					}
				}
				function u$1(e$2) {
					var r$2;
					e$2.done ? o$1(e$2.value) : (r$2 = e$2.value, r$2 instanceof n$1 ? r$2 : new n$1((function(e$3) {
						e$3(r$2);
					}))).then(i$1, c$1);
				}
				u$1((t$1 = t$1.apply(e$1, r$1 || [])).next());
			}));
		}
		function t(e$1, r$1) {
			var n$1, t$1, o$1, a$1, i$1 = {
				label: 0,
				sent: function() {
					if (1 & o$1[0]) throw o$1[1];
					return o$1[1];
				},
				trys: [],
				ops: []
			};
			return a$1 = {
				next: c$1(0),
				throw: c$1(1),
				return: c$1(2)
			}, "function" == typeof Symbol && (a$1[Symbol.iterator] = function() {
				return this;
			}), a$1;
			function c$1(c$2) {
				return function(u$1) {
					return function(c$3) {
						if (n$1) throw new TypeError("Generator is already executing.");
						for (; a$1 && (a$1 = 0, c$3[0] && (i$1 = 0)), i$1;) try {
							if (n$1 = 1, t$1 && (o$1 = 2 & c$3[0] ? t$1.return : c$3[0] ? t$1.throw || ((o$1 = t$1.return) && o$1.call(t$1), 0) : t$1.next) && !(o$1 = o$1.call(t$1, c$3[1])).done) return o$1;
							switch (t$1 = 0, o$1 && (c$3 = [2 & c$3[0], o$1.value]), c$3[0]) {
								case 0:
								case 1:
									o$1 = c$3;
									break;
								case 4: return i$1.label++, {
									value: c$3[1],
									done: !1
								};
								case 5:
									i$1.label++, t$1 = c$3[1], c$3 = [0];
									continue;
								case 7:
									c$3 = i$1.ops.pop(), i$1.trys.pop();
									continue;
								default:
									if (!(o$1 = i$1.trys, (o$1 = o$1.length > 0 && o$1[o$1.length - 1]) || 6 !== c$3[0] && 2 !== c$3[0])) {
										i$1 = 0;
										continue;
									}
									if (3 === c$3[0] && (!o$1 || c$3[1] > o$1[0] && c$3[1] < o$1[3])) {
										i$1.label = c$3[1];
										break;
									}
									if (6 === c$3[0] && i$1.label < o$1[1]) {
										i$1.label = o$1[1], o$1 = c$3;
										break;
									}
									if (o$1 && i$1.label < o$1[2]) {
										i$1.label = o$1[2], i$1.ops.push(c$3);
										break;
									}
									o$1[2] && i$1.ops.pop(), i$1.trys.pop();
									continue;
							}
							c$3 = r$1.call(e$1, i$1);
						} catch (e$2) {
							c$3 = [6, e$2], t$1 = 0;
						} finally {
							n$1 = o$1 = 0;
						}
						if (5 & c$3[0]) throw c$3[1];
						return {
							value: c$3[0] ? c$3[1] : void 0,
							done: !0
						};
					}([c$2, u$1]);
				};
			}
		}
		var o = [
			"geforce 320m",
			"geforce 8600",
			"geforce 8600m gt",
			"geforce 8800 gs",
			"geforce 8800 gt",
			"geforce 9400",
			"geforce 9400m g",
			"geforce 9400m",
			"geforce 9600m gt",
			"geforce 9600m",
			"geforce fx go5200",
			"geforce gt 120",
			"geforce gt 130",
			"geforce gt 330m",
			"geforce gtx 285",
			"google swiftshader",
			"intel g41",
			"intel g45",
			"intel gma 4500mhd",
			"intel gma x3100",
			"intel hd 3000",
			"intel q45",
			"legacy",
			"mali-2",
			"mali-3",
			"mali-4",
			"quadro fx 1500",
			"quadro fx 4",
			"quadro fx 5",
			"radeon hd 2400",
			"radeon hd 2600",
			"radeon hd 4670",
			"radeon hd 4850",
			"radeon hd 4870",
			"radeon hd 5670",
			"radeon hd 5750",
			"radeon hd 6290",
			"radeon hd 6300",
			"radeon hd 6310",
			"radeon hd 6320",
			"radeon hd 6490m",
			"radeon hd 6630m",
			"radeon hd 6750m",
			"radeon hd 6770m",
			"radeon hd 6970m",
			"sgx 543",
			"sgx543"
		];
		function a(e$1) {
			return e$1 = e$1.toLowerCase().replace(/.*angle ?\((.+)\)(?: on vulkan [0-9.]+)?$/i, "$1").replace(/\s(\d{1,2}gb|direct3d.+$)|\(r\)| \([^)]+\)$/g, "").replace(/(?:vulkan|opengl) \d+\.\d+(?:\.\d+)?(?: \((.*)\))?/, "$1");
		}
		const i = 34962;
		var c = "undefined" == typeof window, u = function() {
			if (!c) {
				var e$1 = window.navigator, r$1 = e$1.userAgent, n$1 = e$1.platform, t$1 = e$1.maxTouchPoints, o$1 = /(iphone|ipod|ipad)/i.test(r$1), a$1 = "iPad" === n$1 || "MacIntel" === n$1 && t$1 > 0 && !window.MSStream;
				return {
					isIpad: a$1,
					isMobile: /android/i.test(r$1) || o$1 || a$1,
					isSafari12: /Version\/12.+Safari/.test(r$1),
					isFirefox: /Firefox/.test(r$1)
				};
			}
		}();
		function l(e$1, r$1, n$1) {
			if (!n$1) return [r$1];
			var t$1, o$1 = function(e$2) {
				var r$2 = "\n    precision highp float;\n    attribute vec3 aPosition;\n    varying float vvv;\n    void main() {\n      vvv = 0.31622776601683794;\n      gl_Position = vec4(aPosition, 1.0);\n    }\n  ", n$2 = "\n    precision highp float;\n    varying float vvv;\n    void main() {\n      vec4 enc = vec4(1.0, 255.0, 65025.0, 16581375.0) * vvv;\n      enc = fract(enc);\n      enc -= enc.yzww * vec4(1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0, 0.0);\n      gl_FragColor = enc;\n    }\n  ", t$2 = e$2.createShader(35633), o$2 = e$2.createShader(35632), a$2 = e$2.createProgram();
				if (!(o$2 && t$2 && a$2)) return;
				e$2.shaderSource(t$2, r$2), e$2.shaderSource(o$2, n$2), e$2.compileShader(t$2), e$2.compileShader(o$2), e$2.attachShader(a$2, t$2), e$2.attachShader(a$2, o$2), e$2.linkProgram(a$2), e$2.detachShader(a$2, t$2), e$2.detachShader(a$2, o$2), e$2.deleteShader(t$2), e$2.deleteShader(o$2), e$2.useProgram(a$2);
				var c$2 = e$2.createBuffer();
				e$2.bindBuffer(i, c$2), e$2.bufferData(i, new Float32Array([
					-1,
					-1,
					0,
					3,
					-1,
					0,
					-1,
					3,
					0
				]), 35044);
				var u$1 = e$2.getAttribLocation(a$2, "aPosition");
				e$2.vertexAttribPointer(u$1, 3, 5126, !1, 0, 0), e$2.enableVertexAttribArray(u$1), e$2.clearColor(1, 1, 1, 1), e$2.clear(16384), e$2.viewport(0, 0, 1, 1), e$2.drawArrays(4, 0, 3);
				var l$2 = new Uint8Array(4);
				return e$2.readPixels(0, 0, 1, 1, 6408, 5121, l$2), e$2.deleteProgram(a$2), e$2.deleteBuffer(c$2), l$2.join("");
			}(e$1), a$1 = "801621810", c$1 = "8016218135", l$1 = "80162181161", f$1 = (null == u ? void 0 : u.isIpad) ? [
				[
					"a7",
					l$1,
					12
				],
				[
					"a8",
					c$1,
					15
				],
				[
					"a8x",
					c$1,
					15
				],
				[
					"a9",
					c$1,
					15
				],
				[
					"a9x",
					c$1,
					15
				],
				[
					"a10",
					c$1,
					15
				],
				[
					"a10x",
					c$1,
					15
				],
				[
					"a12",
					a$1,
					15
				],
				[
					"a12x",
					a$1,
					15
				],
				[
					"a12z",
					a$1,
					15
				],
				[
					"a14",
					a$1,
					15
				],
				[
					"a15",
					a$1,
					15
				],
				[
					"m1",
					a$1,
					15
				],
				[
					"m2",
					a$1,
					15
				]
			] : [
				[
					"a7",
					l$1,
					12
				],
				[
					"a8",
					c$1,
					12
				],
				[
					"a9",
					c$1,
					15
				],
				[
					"a10",
					c$1,
					15
				],
				[
					"a11",
					a$1,
					15
				],
				[
					"a12",
					a$1,
					15
				],
				[
					"a13",
					a$1,
					15
				],
				[
					"a14",
					a$1,
					15
				],
				[
					"a15",
					a$1,
					15
				],
				[
					"a16",
					a$1,
					15
				],
				[
					"a17",
					a$1,
					15
				]
			];
			return "80162181255" === o$1 ? t$1 = f$1.filter((function(e$2) {
				return e$2[2] >= 14;
			})) : (t$1 = f$1.filter((function(e$2) {
				return e$2[1] === o$1;
			}))).length || (t$1 = f$1), t$1.map((function(e$2) {
				var r$2 = e$2[0];
				return "apple ".concat(r$2, " gpu");
			}));
		}
		var f = function(e$1) {
			function n$1(r$1) {
				var n$2 = this.constructor, t$1 = e$1.call(this, r$1) || this;
				return Object.setPrototypeOf(t$1, n$2.prototype), t$1;
			}
			return function(e$2, n$2) {
				if ("function" != typeof n$2 && null !== n$2) throw new TypeError("Class extends value " + String(n$2) + " is not a constructor or null");
				function t$1() {
					this.constructor = e$2;
				}
				r(e$2, n$2), e$2.prototype = null === n$2 ? Object.create(n$2) : (t$1.prototype = n$2.prototype, new t$1());
			}(n$1, e$1), n$1;
		}(Error);
		var d = [], s = [];
		function h(e$1, r$1) {
			if (e$1 === r$1) return 0;
			var n$1 = e$1;
			e$1.length > r$1.length && (e$1 = r$1, r$1 = n$1);
			for (var t$1 = e$1.length, o$1 = r$1.length; t$1 > 0 && e$1.charCodeAt(~-t$1) === r$1.charCodeAt(~-o$1);) t$1--, o$1--;
			for (var a$1, i$1 = 0; i$1 < t$1 && e$1.charCodeAt(i$1) === r$1.charCodeAt(i$1);) i$1++;
			if (o$1 -= i$1, 0 === (t$1 -= i$1)) return o$1;
			for (var c$1, u$1, l$1 = 0, f$1 = 0, h$1 = 0; f$1 < t$1;) s[f$1] = e$1.charCodeAt(i$1 + f$1), d[f$1] = ++f$1;
			for (; h$1 < o$1;) for (a$1 = r$1.charCodeAt(i$1 + h$1), c$1 = h$1++, l$1 = h$1, f$1 = 0; f$1 < t$1; f$1++) u$1 = a$1 === s[f$1] ? c$1 : c$1 + 1, c$1 = d[f$1], l$1 = d[f$1] = c$1 > l$1 ? u$1 > l$1 ? l$1 + 1 : u$1 : u$1 > c$1 ? c$1 + 1 : u$1;
			return l$1;
		}
		function v(e$1) {
			return null != e$1;
		}
		e.getGPUTier = function(e$1) {
			var r$1 = void 0 === e$1 ? {} : e$1, i$1 = r$1.mobileTiers, d$1 = void 0 === i$1 ? [
				0,
				15,
				30,
				60
			] : i$1, s$1 = r$1.desktopTiers, p = void 0 === s$1 ? [
				0,
				15,
				30,
				60
			] : s$1, g = r$1.override, m = void 0 === g ? {} : g, b = r$1.glContext, w = r$1.failIfMajorPerformanceCaveat, y = void 0 !== w && w, x = r$1.benchmarksURL, P = void 0 === x ? "https://unpkg.com/detect-gpu@".concat("5.0.56", "/dist/benchmarks") : x;
			return n(void 0, void 0, void 0, (function() {
				function e$2(e$3) {
					var o$1;
					return n(this, void 0, void 0, (function() {
						var n$1, a$1, i$3, c$1, u$1, l$1, d$2, v$1, p$1, g$2, m$1, b$1, y$1, x$2, P$1, A$1, C$1, L$1, M$1, k$1, j$1, B$1, R$1, T$1, U$1, I$1;
						return t(this, (function(t$1) {
							switch (t$1.label) {
								case 0:
									if (!(n$1 = _(e$3))) return [2];
									a$1 = "".concat(w$1 ? "m" : "d", "-").concat(n$1).concat(s$2 ? "-ipad" : "", ".json"), i$3 = r$2[a$1] = null !== (o$1 = r$2[a$1]) && void 0 !== o$1 ? o$1 : E(a$1), t$1.label = 1;
								case 1: return t$1.trys.push([
									1,
									3,
									,
									4
								]), [4, i$3];
								case 2: return c$1 = t$1.sent(), [3, 4];
								case 3:
									if ((u$1 = t$1.sent()) instanceof f) throw u$1;
									return [2];
								case 4:
									if (l$1 = function(e$4) {
										var r$3, n$2 = (e$4 = e$4.replace(/\([^)]+\)/, "")).match(/\d+/) || e$4.match(/(\W|^)([A-Za-z]{1,3})(\W|$)/g);
										return null !== (r$3 = null == n$2 ? void 0 : n$2.join("").replace(/\W|amd/g, "")) && void 0 !== r$3 ? r$3 : "";
									}(e$3), (d$2 = c$1.filter((function(e$4) {
										return e$4[1] === l$1;
									}))).length || (d$2 = c$1.filter((function(r$3) {
										return r$3[0].includes(e$3);
									}))), 0 === (v$1 = d$2.length)) return [2];
									for (p$1 = e$3.split(/[.,()\[\]/\s]/g).sort().filter((function(e$4, r$3, n$2) {
										return 0 === r$3 || e$4 !== n$2[r$3 - 1];
									})).join(" "), g$2 = v$1 > 1 ? d$2.map((function(e$4) {
										return [e$4, h(p$1, e$4[2])];
									})).sort((function(e$4, r$3) {
										return e$4[1] - r$3[1];
									}))[0][0] : d$2[0], m$1 = g$2[0], b$1 = g$2[4], y$1 = Number.MAX_VALUE, P$1 = window.devicePixelRatio, A$1 = S.width * P$1 * S.height * P$1, C$1 = 0, L$1 = b$1; C$1 < L$1.length; C$1++) M$1 = L$1[C$1], k$1 = M$1[0], j$1 = M$1[1], B$1 = k$1 * j$1, (R$1 = Math.abs(A$1 - B$1)) < y$1 && (y$1 = R$1, x$2 = M$1);
									return x$2 ? (U$1 = (T$1 = x$2)[2], I$1 = T$1[3], [2, [
										y$1,
										U$1,
										m$1,
										I$1
									]]) : [2];
							}
						}));
					}));
				}
				var r$2, i$2, s$2, g$1, w$1, x$1, S, A, E, C, _, L, M, k, j, B, R, T, U, I, O, D, N, F, G;
				return t(this, (function(h$1) {
					switch (h$1.label) {
						case 0:
							if (r$2 = {}, c) return [2, {
								tier: 0,
								type: "SSR"
							}];
							if (i$2 = m.isIpad, s$2 = void 0 === i$2 ? !!(null == u ? void 0 : u.isIpad) : i$2, g$1 = m.isMobile, w$1 = void 0 === g$1 ? !!(null == u ? void 0 : u.isMobile) : g$1, x$1 = m.screenSize, S = void 0 === x$1 ? window.screen : x$1, A = m.loadBenchmarks, E = void 0 === A ? function(e$3) {
								return n(void 0, void 0, void 0, (function() {
									var r$3;
									return t(this, (function(n$1) {
										switch (n$1.label) {
											case 0: return [4, fetch("".concat(P, "/").concat(e$3)).then((function(e$4) {
												return e$4.json();
											}))];
											case 1:
												if (r$3 = n$1.sent(), parseInt(r$3.shift().split(".")[0], 10) < 4) throw new f("Detect GPU benchmark data is out of date. Please update to version 4x");
												return [2, r$3];
										}
									}));
								}));
							} : A, C = m.renderer, _ = function(e$3) {
								for (var r$3 = 0, n$1 = w$1 ? [
									"adreno",
									"apple",
									"mali-t",
									"mali",
									"nvidia",
									"powervr",
									"samsung"
								] : [
									"intel",
									"apple",
									"amd",
									"radeon",
									"nvidia",
									"geforce",
									"adreno"
								]; r$3 < n$1.length; r$3++) {
									var t$1 = n$1[r$3];
									if (e$3.includes(t$1)) return t$1;
								}
							}, L = function(e$3, r$3, n$1, t$1, o$1) {
								return {
									device: o$1,
									fps: t$1,
									gpu: n$1,
									isMobile: w$1,
									tier: e$3,
									type: r$3
								};
							}, k = "", C) C = a(C), M = [C];
							else {
								if (!(j = b || function(e$3, r$3) {
									void 0 === r$3 && (r$3 = !1);
									var n$1 = {
										alpha: !1,
										antialias: !1,
										depth: !1,
										failIfMajorPerformanceCaveat: r$3,
										powerPreference: "high-performance",
										stencil: !1
									};
									e$3 && delete n$1.powerPreference;
									var t$1 = window.document.createElement("canvas"), o$1 = t$1.getContext("webgl", n$1) || t$1.getContext("experimental-webgl", n$1);
									return null != o$1 ? o$1 : void 0;
								}(null == u ? void 0 : u.isSafari12, y))) return [2, L(0, "WEBGL_UNSUPPORTED")];
								if (B = (null == u ? void 0 : u.isFirefox) ? null : j.getExtension("WEBGL_debug_renderer_info"), !(C = B ? j.getParameter(B.UNMASKED_RENDERER_WEBGL) : j.getParameter(j.RENDERER))) return [2, L(1, "FALLBACK")];
								k = C, C = a(C), M = function(e$3, r$3, n$1) {
									return "apple gpu" === r$3 ? l(e$3, r$3, n$1) : [r$3];
								}(j, C, w$1);
							}
							return [4, Promise.all(M.map(e$2))];
						case 1:
							if (!(R = h$1.sent().filter(v).sort((function(e$3, r$3) {
								var n$1 = e$3[0], t$1 = void 0 === n$1 ? Number.MAX_VALUE : n$1, o$1 = e$3[1], a$1 = r$3[0], i$3 = void 0 === a$1 ? Number.MAX_VALUE : a$1, c$1 = r$3[1];
								return t$1 === i$3 ? o$1 - c$1 : t$1 - i$3;
							}))).length) return [2, (T = o.find((function(e$3) {
								return C.includes(e$3);
							}))) ? L(0, "BLOCKLISTED", T) : L(1, "FALLBACK", "".concat(C, " (").concat(k, ")"))];
							if (U = R[0], I = U[1], O = U[2], D = U[3], -1 === I) return [2, L(0, "BLOCKLISTED", O, I, D)];
							for (N = w$1 ? d$1 : p, F = 0, G = 0; G < N.length; G++) I >= N[G] && (F = G);
							return [2, L(F, "BENCHMARK", O, I, D)];
					}
				}));
			}));
		};
	}));
}));

//#endregion
export { require_detect_gpu_umd as t };