chunk-SBZKLPXX.js 69 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190
  1. import {
  2. m,
  3. n2 as n5
  4. } from "./chunk-264YGWEE.js";
  5. import {
  6. n as n4,
  7. s as s3
  8. } from "./chunk-WCLXPK5D.js";
  9. import {
  10. s as s2
  11. } from "./chunk-KHMWUB3W.js";
  12. import {
  13. M as M2,
  14. W as W2,
  15. t2 as t4
  16. } from "./chunk-LDMWL65U.js";
  17. import {
  18. E as E3,
  19. a as a2,
  20. i as i2,
  21. x
  22. } from "./chunk-WBWQJQK4.js";
  23. import {
  24. r as r5
  25. } from "./chunk-WPDBODJM.js";
  26. import {
  27. E as E2,
  28. a,
  29. n as n3
  30. } from "./chunk-H2VOWDMO.js";
  31. import {
  32. t as t3
  33. } from "./chunk-4OM3EX6P.js";
  34. import {
  35. A,
  36. C,
  37. D,
  38. E,
  39. F,
  40. G,
  41. I,
  42. L,
  43. M,
  44. N,
  45. O,
  46. P,
  47. R,
  48. S,
  49. T,
  50. U as U2,
  51. V,
  52. W,
  53. X,
  54. Y,
  55. _,
  56. f,
  57. n as n2,
  58. r as r3,
  59. t as t2
  60. } from "./chunk-3OFVLRSL.js";
  61. import {
  62. r as r4
  63. } from "./chunk-RWQH5X3O.js";
  64. import {
  65. r as r2
  66. } from "./chunk-TJNOJH33.js";
  67. import {
  68. n4 as n
  69. } from "./chunk-2Z2TG5CU.js";
  70. import {
  71. U
  72. } from "./chunk-V6P2MAQQ.js";
  73. import {
  74. s2 as s
  75. } from "./chunk-E5O6P5I2.js";
  76. import {
  77. i,
  78. o,
  79. r,
  80. t
  81. } from "./chunk-YXWMMD76.js";
  82. // node_modules/@arcgis/core/views/2d/engine/webgl/shaders/MaterialPrograms.js
  83. var e = (r9) => {
  84. let t6 = "";
  85. t6 += r9[0].toUpperCase();
  86. for (let e5 = 1; e5 < r9.length; e5++) {
  87. const s6 = r9[e5];
  88. s6 === s6.toUpperCase() ? (t6 += "_", t6 += s6) : t6 += s6.toUpperCase();
  89. }
  90. return t6;
  91. };
  92. var s4 = (r9) => {
  93. const s6 = {};
  94. for (const t6 in r9) {
  95. s6[e(t6)] = r9[t6];
  96. }
  97. return n4(s6);
  98. };
  99. var o2 = (t6, e5, o6, n7) => {
  100. const a3 = t6 + t6.substring(t6.lastIndexOf("/")), p = e5 + e5.substring(e5.lastIndexOf("/")), f3 = s4(n7);
  101. return { attributes: o6, shaders: { vertexShader: f3 + n5(`${a3}.vert`), fragmentShader: f3 + n5(`${p}.frag`) } };
  102. };
  103. // node_modules/@arcgis/core/views/webgl/ContextState.js
  104. var h = class {
  105. constructor() {
  106. this.blend = false, this.blendColor = { r: 0, g: 0, b: 0, a: 0 }, this.blendFunction = { srcRGB: R.ONE, dstRGB: R.ZERO, srcAlpha: R.ONE, dstAlpha: R.ZERO }, this.blendEquation = { mode: T.ADD, modeAlpha: T.ADD }, this.colorMask = { r: true, g: true, b: true, a: true }, this.faceCulling = false, this.cullFace = N.BACK, this.frontFace = S.CCW, this.scissorTest = false, this.scissorRect = { x: 0, y: 0, width: 0, height: 0 }, this.depthTest = false, this.depthFunction = I.LESS, this.clearDepth = 1, this.depthWrite = true, this.depthRange = { zNear: 0, zFar: 1 }, this.viewport = null, this.stencilTest = false, this.polygonOffsetFill = false, this.polygonOffset = [0, 0], this.stencilFunction = { face: N.FRONT_AND_BACK, func: I.ALWAYS, ref: 0, mask: 1 }, this.clearStencil = 0, this.stencilWriteMask = 1, this.stencilOperation = { face: N.FRONT_AND_BACK, fail: O.KEEP, zFail: O.KEEP, zPass: O.KEEP }, this.clearColor = { r: 0, g: 0, b: 0, a: 0 }, this.program = null, this.vertexBuffer = null, this.indexBuffer = null, this.uniformBuffer = null, this.pixelPackBuffer = null, this.pixelUnpackBuffer = null, this.copyReadBuffer = null, this.copyWriteBuffer = null, this.uniformBufferBindingPoints = new Array(), this.readFramebuffer = null, this.drawFramebuffer = null, this.renderbuffer = null, this.activeTexture = 0, this.textureUnitMap = new Array(), this.vertexArrayObject = null;
  107. }
  108. };
  109. // node_modules/@arcgis/core/views/support/AllocationTracer.js
  110. var o3 = class {
  111. constructor(o6) {
  112. this._allocations = /* @__PURE__ */ new Map(), o6 ? Error.stackTraceLimit = 1 / 0 : (this.add = () => {
  113. }, this.remove = () => {
  114. });
  115. }
  116. add(o6) {
  117. this._allocations.set(o6, new Error().stack);
  118. }
  119. remove(o6) {
  120. this._allocations.delete(o6);
  121. }
  122. print() {
  123. if (this._allocations.size > 0) {
  124. console.log(`${this._allocations.size} live object allocations:`);
  125. const o6 = /* @__PURE__ */ new Map();
  126. this._allocations.forEach((s6) => {
  127. var _a;
  128. o6.set(s6, ((_a = o6.get(s6)) != null ? _a : 0) + 1);
  129. }), o6.forEach((o7, s6) => {
  130. const t6 = s6.split("\n");
  131. t6.shift(), t6.shift(), console.log(`${o7}: ${t6.shift()}`), t6.forEach((o8) => console.log(" ", o8));
  132. });
  133. }
  134. }
  135. };
  136. // node_modules/@arcgis/core/views/webgl/InstanceCounter.js
  137. var e2 = { RECORD_ALLOCATIONS: false };
  138. var s5 = class {
  139. constructor() {
  140. for (this._current = new Array(), this._max = new Array(), this._allocations = new o3(e2.RECORD_ALLOCATIONS); this._current.length < t2.COUNT; )
  141. this._current.push(0), this._max.push(0);
  142. }
  143. resetMax() {
  144. for (this._max.length = 0; this._max.length < this._current.length; )
  145. this._max.push(0);
  146. }
  147. increment(t6, r9) {
  148. const e5 = ++this._current[t6];
  149. this._max[t6] = Math.max(e5, this._max[t6]), this._allocations.add(r9);
  150. }
  151. decrement(t6, r9) {
  152. --this._current[t6], this._allocations.remove(r9);
  153. }
  154. get max() {
  155. return this._max;
  156. }
  157. get current() {
  158. return this._current;
  159. }
  160. get total() {
  161. return this.current.reduce((t6, r9) => t6 + r9, 0);
  162. }
  163. printResourceCount() {
  164. if (this.total > 0) {
  165. console.log("Live objects:");
  166. for (let t6 = 0; t6 < t2.COUNT; ++t6) {
  167. const e5 = this._current[t6];
  168. e5 > 0 && console.log(`${t2[t6]}: ${e5}`);
  169. }
  170. }
  171. this._allocations.print();
  172. }
  173. };
  174. // node_modules/@arcgis/core/views/webgl/testDoublePrecisionArithmetic.js
  175. function d(t6, d2) {
  176. t6.resetState();
  177. const B = new x(t6, { colorTarget: Y.TEXTURE, depthStencilTarget: V.NONE }, { target: M.TEXTURE_2D, wrapMode: D.CLAMP_TO_EDGE, pixelFormat: P.RGBA, dataType: G.UNSIGNED_BYTE, samplingMode: L.NEAREST, width: 1, height: 1 }), E6 = E3.createVertex(t6, F.STATIC_DRAW, new Uint16Array([0, 0, 1, 0, 0, 1, 1, 1])), g = new a2(t6, /* @__PURE__ */ new Map([["position", 0]]), { geometry: [new t3("position", 2, C.UNSIGNED_SHORT, 0, 4)] }, { geometry: E6 }), T4 = r2(5633261287538229e-9, 2626832878767164e-9, 1.4349880495278358e6), b = r2(563327146742708e-8, 2.6268736381334523e6, 1434963231608387e-9), F3 = _2(t6, T4, b, d2);
  178. t6.bindFramebuffer(B), t6.setViewport(0, 0, 1, 1), t6.bindVAO(g), t6.drawArrays(E.TRIANGLE_STRIP, 0, 4);
  179. const U3 = new Uint8Array(4);
  180. B.readPixels(0, 0, 1, 1, P.RGBA, G.UNSIGNED_BYTE, U3), F3.dispose(), g.dispose(false), E6.dispose(), B.dispose();
  181. const w2 = (T4[2] - b[2]) / 25, O2 = r5(U3);
  182. return Math.abs(w2 - O2);
  183. }
  184. function _2(n7, e5, o6, r9) {
  185. const i3 = `
  186. precision highp float;
  187. attribute vec2 position;
  188. uniform vec3 u_highA;
  189. uniform vec3 u_lowA;
  190. uniform vec3 u_highB;
  191. uniform vec3 u_lowB;
  192. varying vec4 v_color;
  193. ${r9 ? "#define DOUBLE_PRECISION_REQUIRES_OBFUSCATION" : ""}
  194. #ifdef DOUBLE_PRECISION_REQUIRES_OBFUSCATION
  195. vec3 dpPlusFrc(vec3 a, vec3 b) {
  196. return mix(a, a + b, vec3(notEqual(b, vec3(0))));
  197. }
  198. vec3 dpMinusFrc(vec3 a, vec3 b) {
  199. return mix(vec3(0), a - b, vec3(notEqual(a, b)));
  200. }
  201. vec3 dpAdd(vec3 hiA, vec3 loA, vec3 hiB, vec3 loB) {
  202. vec3 t1 = dpPlusFrc(hiA, hiB);
  203. vec3 e = dpMinusFrc(t1, hiA);
  204. vec3 t2 = dpMinusFrc(hiB, e) + dpMinusFrc(hiA, dpMinusFrc(t1, e)) + loA + loB;
  205. return t1 + t2;
  206. }
  207. #else
  208. vec3 dpAdd(vec3 hiA, vec3 loA, vec3 hiB, vec3 loB) {
  209. vec3 t1 = hiA + hiB;
  210. vec3 e = t1 - hiA;
  211. vec3 t2 = ((hiB - e) + (hiA - (t1 - e))) + loA + loB;
  212. return t1 + t2;
  213. }
  214. #endif
  215. const float MAX_RGBA_FLOAT =
  216. 255.0 / 256.0 +
  217. 255.0 / 256.0 / 256.0 +
  218. 255.0 / 256.0 / 256.0 / 256.0 +
  219. 255.0 / 256.0 / 256.0 / 256.0 / 256.0;
  220. const vec4 FIXED_POINT_FACTORS = vec4(1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0);
  221. vec4 float2rgba(const float value) {
  222. // Make sure value is in the domain we can represent
  223. float valueInValidDomain = clamp(value, 0.0, MAX_RGBA_FLOAT);
  224. // Decompose value in 32bit fixed point parts represented as
  225. // uint8 rgba components. Decomposition uses the fractional part after multiplying
  226. // by a power of 256 (this removes the bits that are represented in the previous
  227. // component) and then converts the fractional part to 8bits.
  228. vec4 fixedPointU8 = floor(fract(valueInValidDomain * FIXED_POINT_FACTORS) * 256.0);
  229. // Convert uint8 values (from 0 to 255) to floating point representation for
  230. // the shader
  231. const float toU8AsFloat = 1.0 / 255.0;
  232. return fixedPointU8 * toU8AsFloat;
  233. }
  234. void main() {
  235. vec3 val = dpAdd(u_highA, u_lowA, -u_highB, -u_lowB);
  236. v_color = float2rgba(val.z / 25.0);
  237. gl_Position = vec4(position * 2.0 - 1.0, 0.0, 1.0);
  238. }
  239. `, a3 = "\n precision highp float;\n\n varying vec4 v_color;\n\n void main() {\n gl_FragColor = v_color;\n }\n ", c = n7.programCache.acquire(i3, a3, /* @__PURE__ */ new Map([["position", 0]])), s6 = new Float32Array(6);
  240. t4(e5, s6, 3);
  241. const l2 = new Float32Array(6);
  242. return t4(o6, l2, 3), n7.useProgram(c), c.setUniform3f("u_highA", s6[0], s6[2], s6[4]), c.setUniform3f("u_lowA", s6[1], s6[3], s6[5]), c.setUniform3f("u_highB", l2[0], l2[2], l2[4]), c.setUniform3f("u_lowB", l2[1], l2[3], l2[5]), c;
  243. }
  244. // node_modules/@arcgis/core/views/webgl/testFloatBufferBlend.js
  245. var T2;
  246. var _3;
  247. var F2;
  248. var x2 = { exports: {} };
  249. function A2(T4) {
  250. var _a, _b, _c, _d, _e;
  251. if (!T4.gl)
  252. return false;
  253. if (T4.type === r4.WEBGL1)
  254. return !(!((_a = T4.capabilities.textureFloat) == null ? void 0 : _a.textureFloat) || !((_b = T4.capabilities.colorBufferFloat) == null ? void 0 : _b.textureFloat));
  255. if (!(((_c = T4.capabilities.textureFloat) == null ? void 0 : _c.textureFloat) && ((_d = T4.capabilities.colorBufferFloat) == null ? void 0 : _d.textureFloat) && ((_e = T4.capabilities.colorBufferFloat) == null ? void 0 : _e.floatBlend)))
  256. return false;
  257. const _5 = new x(T4, { colorTarget: Y.TEXTURE, depthStencilTarget: V.NONE }, { target: M.TEXTURE_2D, wrapMode: D.CLAMP_TO_EDGE, pixelFormat: P.RGBA, dataType: G.FLOAT, internalFormat: U2.RGBA32F, samplingMode: L.NEAREST, width: 1, height: 1 }), F3 = E3.createVertex(T4, F.STATIC_DRAW, new Uint16Array([0, 0, 1, 0, 0, 1, 1, 1])), A4 = new a2(T4, /* @__PURE__ */ new Map([["a_pos", 0]]), { geometry: [new t3("a_pos", 2, C.UNSIGNED_SHORT, 0, 4)] }, { geometry: F3 }), R3 = "\n precision highp float;\n attribute vec2 a_pos;\n\n void main() {\n gl_Position = vec4(a_pos * 2.0 - 1.0, 0.0, 1.0);\n }\n ", v2 = "\n precision highp float;\n\n void main() {\n gl_FragColor = vec4(0.5, 0.5, 0.5, 0.5);\n }\n ", S2 = T4.programCache.acquire(R3, v2, /* @__PURE__ */ new Map([["a_pos", 0]]));
  258. T4.useProgram(S2);
  259. const h2 = T4.getBoundFramebufferObject(), { x: P2, y: L2, width: B, height: C2 } = T4.getViewport();
  260. T4.bindFramebuffer(_5), T4.setViewport(0, 0, 1, 1), T4.bindVAO(A4), T4.drawArrays(E.TRIANGLE_STRIP, 0, 4);
  261. const w2 = W2({ blending: s2 });
  262. T4.setPipelineState(w2), T4.drawArrays(E.TRIANGLE_STRIP, 0, 4), x2.exports.init(T4);
  263. const O2 = T4.gl.getError();
  264. return T4.setViewport(P2, L2, B, C2), T4.bindFramebuffer(h2), S2.dispose(), A4.dispose(false), F3.dispose(), _5.dispose(), 1282 !== O2 || (console.warn("Device claims support for WebGL extension EXT_float_blend but does not support it. Using fall back."), false);
  265. }
  266. T2 = x2, _3 = function() {
  267. var e5 = function(e6) {
  268. window.console && window.console.log && window.console.log(e6);
  269. }, t6 = function(t7) {
  270. window.console && window.console.error ? window.console.error(t7) : e5(t7);
  271. }, r9 = { enable: { 1: { 0: true } }, disable: { 1: { 0: true } }, getParameter: { 1: { 0: true } }, drawArrays: { 3: { 0: true } }, drawElements: { 4: { 0: true, 2: true } }, createShader: { 1: { 0: true } }, getShaderParameter: { 2: { 1: true } }, getProgramParameter: { 2: { 1: true } }, getShaderPrecisionFormat: { 2: { 0: true, 1: true } }, getVertexAttrib: { 2: { 1: true } }, vertexAttribPointer: { 6: { 2: true } }, bindTexture: { 2: { 0: true } }, activeTexture: { 1: { 0: true } }, getTexParameter: { 2: { 0: true, 1: true } }, texParameterf: { 3: { 0: true, 1: true } }, texParameteri: { 3: { 0: true, 1: true, 2: true } }, texImage2D: { 9: { 0: true, 2: true, 6: true, 7: true }, 6: { 0: true, 2: true, 3: true, 4: true } }, texSubImage2D: { 9: { 0: true, 6: true, 7: true }, 7: { 0: true, 4: true, 5: true } }, copyTexImage2D: { 8: { 0: true, 2: true } }, copyTexSubImage2D: { 8: { 0: true } }, generateMipmap: { 1: { 0: true } }, compressedTexImage2D: { 7: { 0: true, 2: true } }, compressedTexSubImage2D: { 8: { 0: true, 6: true } }, bindBuffer: { 2: { 0: true } }, bufferData: { 3: { 0: true, 2: true } }, bufferSubData: { 3: { 0: true } }, getBufferParameter: { 2: { 0: true, 1: true } }, pixelStorei: { 2: { 0: true, 1: true } }, readPixels: { 7: { 4: true, 5: true } }, bindRenderbuffer: { 2: { 0: true } }, bindFramebuffer: { 2: { 0: true } }, checkFramebufferStatus: { 1: { 0: true } }, framebufferRenderbuffer: { 4: { 0: true, 1: true, 2: true } }, framebufferTexture2D: { 5: { 0: true, 1: true, 2: true } }, getFramebufferAttachmentParameter: { 3: { 0: true, 1: true, 2: true } }, getRenderbufferParameter: { 2: { 0: true, 1: true } }, renderbufferStorage: { 4: { 0: true, 1: true } }, clear: { 1: { 0: { enumBitwiseOr: ["COLOR_BUFFER_BIT", "DEPTH_BUFFER_BIT", "STENCIL_BUFFER_BIT"] } } }, depthFunc: { 1: { 0: true } }, blendFunc: { 2: { 0: true, 1: true } }, blendFuncSeparate: { 4: { 0: true, 1: true, 2: true, 3: true } }, blendEquation: { 1: { 0: true } }, blendEquationSeparate: { 2: { 0: true, 1: true } }, stencilFunc: { 3: { 0: true } }, stencilFuncSeparate: { 4: { 0: true, 1: true } }, stencilMaskSeparate: { 2: { 0: true } }, stencilOp: { 3: { 0: true, 1: true, 2: true } }, stencilOpSeparate: { 4: { 0: true, 1: true, 2: true, 3: true } }, cullFace: { 1: { 0: true } }, frontFace: { 1: { 0: true } }, drawArraysInstancedANGLE: { 4: { 0: true } }, drawElementsInstancedANGLE: { 5: { 0: true, 2: true } }, blendEquationEXT: { 1: { 0: true } } }, n7 = null, o6 = null;
  272. function a3(e6) {
  273. if (null == n7)
  274. for (var t7 in n7 = {}, o6 = {}, e6)
  275. "number" == typeof e6[t7] && (n7[e6[t7]] = t7, o6[t7] = e6[t7]);
  276. }
  277. function i3() {
  278. if (null == n7)
  279. throw "WebGLDebugUtils.init(ctx) not called";
  280. }
  281. function f3(e6) {
  282. return i3(), void 0 !== n7[e6];
  283. }
  284. function u(e6) {
  285. i3();
  286. var t7 = n7[e6];
  287. return void 0 !== t7 ? "gl." + t7 : "/*UNKNOWN WebGL ENUM*/ 0x" + e6.toString(16);
  288. }
  289. function l2(e6, t7, n8, a4) {
  290. var i4;
  291. if (void 0 !== (i4 = r9[e6]) && void 0 !== (i4 = i4[t7]) && i4[n8]) {
  292. if ("object" == typeof i4[n8] && void 0 !== i4[n8].enumBitwiseOr) {
  293. for (var f4 = i4[n8].enumBitwiseOr, l3 = 0, c2 = [], s7 = 0; s7 < f4.length; ++s7) {
  294. var d3 = o6[f4[s7]];
  295. 0 != (a4 & d3) && (l3 |= d3, c2.push(u(d3)));
  296. }
  297. return l3 === a4 ? c2.join(" | ") : u(a4);
  298. }
  299. return u(a4);
  300. }
  301. return null === a4 ? "null" : void 0 === a4 ? "undefined" : a4.toString();
  302. }
  303. function c(e6, t7) {
  304. for (var r10 = "", n8 = t7.length, o7 = 0; o7 < n8; ++o7)
  305. r10 += (0 == o7 ? "" : ", ") + l2(e6, n8, o7, t7[o7]);
  306. return r10;
  307. }
  308. function s6(e6, t7, r10) {
  309. e6.__defineGetter__(r10, function() {
  310. return t7[r10];
  311. }), e6.__defineSetter__(r10, function(e7) {
  312. t7[r10] = e7;
  313. });
  314. }
  315. function d2(e6, r10, n8, o7) {
  316. o7 = o7 || e6, a3(e6), r10 = r10 || function(e7, r11, n9) {
  317. for (var o8 = "", a4 = n9.length, i5 = 0; i5 < a4; ++i5)
  318. o8 += (0 == i5 ? "" : ", ") + l2(r11, a4, i5, n9[i5]);
  319. t6("WebGL error " + u(e7) + " in " + r11 + "(" + o8 + ")");
  320. };
  321. var i4 = {};
  322. function f4(e7, t7) {
  323. return function() {
  324. n8 && n8(t7, arguments);
  325. var a4 = e7[t7].apply(e7, arguments), f5 = o7.getError();
  326. return 0 != f5 && (i4[f5] = true, r10(f5, t7, arguments)), a4;
  327. };
  328. }
  329. var c2 = {};
  330. for (var g2 in e6)
  331. if ("function" == typeof e6[g2])
  332. if ("getExtension" != g2)
  333. c2[g2] = f4(e6, g2);
  334. else {
  335. var b2 = f4(e6, g2);
  336. c2[g2] = function() {
  337. return d2(b2.apply(e6, arguments), r10, n8, o7);
  338. };
  339. }
  340. else
  341. s6(c2, e6, g2);
  342. return c2.getError = function() {
  343. for (var t7 in i4)
  344. if (i4.hasOwnProperty(t7) && i4[t7])
  345. return i4[t7] = false, t7;
  346. return e6.NO_ERROR;
  347. }, c2;
  348. }
  349. function g(e6) {
  350. var t7 = e6.getParameter(e6.MAX_VERTEX_ATTRIBS), r10 = e6.createBuffer();
  351. e6.bindBuffer(e6.ARRAY_BUFFER, r10);
  352. for (var n8 = 0; n8 < t7; ++n8)
  353. e6.disableVertexAttribArray(n8), e6.vertexAttribPointer(n8, 4, e6.FLOAT, false, 0, 0), e6.vertexAttrib1f(n8, 0);
  354. e6.deleteBuffer(r10);
  355. var o7 = e6.getParameter(e6.MAX_TEXTURE_IMAGE_UNITS);
  356. for (n8 = 0; n8 < o7; ++n8)
  357. e6.activeTexture(e6.TEXTURE0 + n8), e6.bindTexture(e6.TEXTURE_CUBE_MAP, null), e6.bindTexture(e6.TEXTURE_2D, null);
  358. for (e6.activeTexture(e6.TEXTURE0), e6.useProgram(null), e6.bindBuffer(e6.ARRAY_BUFFER, null), e6.bindBuffer(e6.ELEMENT_ARRAY_BUFFER, null), e6.bindFramebuffer(e6.FRAMEBUFFER, null), e6.bindRenderbuffer(e6.RENDERBUFFER, null), e6.disable(e6.BLEND), e6.disable(e6.CULL_FACE), e6.disable(e6.DEPTH_TEST), e6.disable(e6.DITHER), e6.disable(e6.SCISSOR_TEST), e6.blendColor(0, 0, 0, 0), e6.blendEquation(e6.FUNC_ADD), e6.blendFunc(e6.ONE, e6.ZERO), e6.clearColor(0, 0, 0, 0), e6.clearDepth(1), e6.clearStencil(-1), e6.colorMask(true, true, true, true), e6.cullFace(e6.BACK), e6.depthFunc(e6.LESS), e6.depthMask(true), e6.depthRange(0, 1), e6.frontFace(e6.CCW), e6.hint(e6.GENERATE_MIPMAP_HINT, e6.DONT_CARE), e6.lineWidth(1), e6.pixelStorei(e6.PACK_ALIGNMENT, 4), e6.pixelStorei(e6.UNPACK_ALIGNMENT, 4), e6.pixelStorei(e6.UNPACK_FLIP_Y_WEBGL, false), e6.pixelStorei(e6.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false), e6.UNPACK_COLORSPACE_CONVERSION_WEBGL && e6.pixelStorei(e6.UNPACK_COLORSPACE_CONVERSION_WEBGL, e6.BROWSER_DEFAULT_WEBGL), e6.polygonOffset(0, 0), e6.sampleCoverage(1, false), e6.scissor(0, 0, e6.canvas.width, e6.canvas.height), e6.stencilFunc(e6.ALWAYS, 0, 4294967295), e6.stencilMask(4294967295), e6.stencilOp(e6.KEEP, e6.KEEP, e6.KEEP), e6.viewport(0, 0, e6.canvas.width, e6.canvas.height), e6.clear(e6.COLOR_BUFFER_BIT | e6.DEPTH_BUFFER_BIT | e6.STENCIL_BUFFER_BIT); e6.getError(); )
  359. ;
  360. }
  361. function b(e6) {
  362. var t7, r10, n8 = [], o7 = [], a4 = {}, i4 = 1, f4 = false, u2 = [], l3 = 0, c2 = 0, d3 = false, b2 = 0, E6 = {};
  363. function p(e7) {
  364. return "function" == typeof e7 ? e7 : function(t8) {
  365. e7.handleEvent(t8);
  366. };
  367. }
  368. e6.getContext = (r10 = e6.getContext, function() {
  369. var n9 = r10.apply(e6, arguments);
  370. if (n9 instanceof WebGLRenderingContext) {
  371. if (n9 != t7) {
  372. if (t7)
  373. throw "got different context";
  374. a4 = S2(t7 = n9);
  375. }
  376. return a4;
  377. }
  378. return n9;
  379. });
  380. var m2 = function(e7) {
  381. n8.push(p(e7));
  382. }, T4 = function(e7) {
  383. o7.push(p(e7));
  384. };
  385. function _5(e7) {
  386. var t8 = e7.addEventListener;
  387. e7.addEventListener = function(r11, n9, o8) {
  388. switch (r11) {
  389. case "webglcontextlost":
  390. m2(n9);
  391. break;
  392. case "webglcontextrestored":
  393. T4(n9);
  394. break;
  395. default:
  396. t8.apply(e7, arguments);
  397. }
  398. };
  399. }
  400. function F3() {
  401. for (var e7 = Object.keys(E6), t8 = 0; t8 < e7.length; ++t8)
  402. delete E6[e7];
  403. }
  404. function x4() {
  405. ++c2, f4 || l3 == c2 && e6.loseContext();
  406. }
  407. function A4(e7, t8) {
  408. var r11 = e7[t8];
  409. return function() {
  410. if (x4(), !f4)
  411. return r11.apply(e7, arguments);
  412. };
  413. }
  414. function R3() {
  415. for (var e7 = 0; e7 < u2.length; ++e7) {
  416. var r11 = u2[e7];
  417. r11 instanceof WebGLBuffer ? t7.deleteBuffer(r11) : r11 instanceof WebGLFramebuffer ? t7.deleteFramebuffer(r11) : r11 instanceof WebGLProgram ? t7.deleteProgram(r11) : r11 instanceof WebGLRenderbuffer ? t7.deleteRenderbuffer(r11) : r11 instanceof WebGLShader ? t7.deleteShader(r11) : r11 instanceof WebGLTexture && t7.deleteTexture(r11);
  418. }
  419. }
  420. function v2(e7) {
  421. return { statusMessage: e7, preventDefault: function() {
  422. d3 = true;
  423. } };
  424. }
  425. return _5(e6), e6.loseContext = function() {
  426. if (!f4) {
  427. for (f4 = true, l3 = 0, ++i4; t7.getError(); )
  428. ;
  429. F3(), E6[t7.CONTEXT_LOST_WEBGL] = true;
  430. var r11 = v2("context lost"), o8 = n8.slice();
  431. setTimeout(function() {
  432. for (var t8 = 0; t8 < o8.length; ++t8)
  433. o8[t8](r11);
  434. b2 >= 0 && setTimeout(function() {
  435. e6.restoreContext();
  436. }, b2);
  437. }, 0);
  438. }
  439. }, e6.restoreContext = function() {
  440. f4 && o7.length && setTimeout(function() {
  441. if (!d3)
  442. throw "can not restore. webglcontestlost listener did not call event.preventDefault";
  443. R3(), g(t7), f4 = false, c2 = 0, d3 = false;
  444. for (var e7 = o7.slice(), r11 = v2("context restored"), n9 = 0; n9 < e7.length; ++n9)
  445. e7[n9](r11);
  446. }, 0);
  447. }, e6.loseContextInNCalls = function(e7) {
  448. if (f4)
  449. throw "You can not ask a lost contet to be lost";
  450. l3 = c2 + e7;
  451. }, e6.getNumCalls = function() {
  452. return c2;
  453. }, e6.setRestoreTimeout = function(e7) {
  454. b2 = e7;
  455. }, e6;
  456. function S2(e7) {
  457. for (var r11 in e7)
  458. "function" == typeof e7[r11] ? a4[r11] = A4(e7, r11) : s6(a4, e7, r11);
  459. a4.getError = function() {
  460. if (x4(), !f4)
  461. for (; e8 = t7.getError(); )
  462. E6[e8] = true;
  463. for (var e8 in E6)
  464. if (E6[e8])
  465. return delete E6[e8], e8;
  466. return a4.NO_ERROR;
  467. };
  468. for (var n9 = ["createBuffer", "createFramebuffer", "createProgram", "createRenderbuffer", "createShader", "createTexture"], o8 = 0; o8 < n9.length; ++o8) {
  469. var l4 = n9[o8];
  470. a4[l4] = function(t8) {
  471. return function() {
  472. if (x4(), f4)
  473. return null;
  474. var r12 = t8.apply(e7, arguments);
  475. return r12.__webglDebugContextLostId__ = i4, u2.push(r12), r12;
  476. };
  477. }(e7[l4]);
  478. }
  479. var c3 = ["getActiveAttrib", "getActiveUniform", "getBufferParameter", "getContextAttributes", "getAttachedShaders", "getFramebufferAttachmentParameter", "getParameter", "getProgramParameter", "getProgramInfoLog", "getRenderbufferParameter", "getShaderParameter", "getShaderInfoLog", "getShaderSource", "getTexParameter", "getUniform", "getUniformLocation", "getVertexAttrib"];
  480. for (o8 = 0; o8 < c3.length; ++o8)
  481. l4 = c3[o8], a4[l4] = function(t8) {
  482. return function() {
  483. return x4(), f4 ? null : t8.apply(e7, arguments);
  484. };
  485. }(a4[l4]);
  486. var d4 = ["isBuffer", "isEnabled", "isFramebuffer", "isProgram", "isRenderbuffer", "isShader", "isTexture"];
  487. for (o8 = 0; o8 < d4.length; ++o8)
  488. l4 = d4[o8], a4[l4] = function(t8) {
  489. return function() {
  490. return x4(), !f4 && t8.apply(e7, arguments);
  491. };
  492. }(a4[l4]);
  493. return a4.checkFramebufferStatus = function(t8) {
  494. return function() {
  495. return x4(), f4 ? a4.FRAMEBUFFER_UNSUPPORTED : t8.apply(e7, arguments);
  496. };
  497. }(a4.checkFramebufferStatus), a4.getAttribLocation = function(t8) {
  498. return function() {
  499. return x4(), f4 ? -1 : t8.apply(e7, arguments);
  500. };
  501. }(a4.getAttribLocation), a4.getVertexAttribOffset = function(t8) {
  502. return function() {
  503. return x4(), f4 ? 0 : t8.apply(e7, arguments);
  504. };
  505. }(a4.getVertexAttribOffset), a4.isContextLost = function() {
  506. return f4;
  507. }, a4;
  508. }
  509. }
  510. return { init: a3, mightBeEnum: f3, glEnumToString: u, glFunctionArgToString: l2, glFunctionArgsToString: c, makeDebugContext: d2, makeLostContextSimulatingCanvas: b, resetToInitialState: g };
  511. }, void 0 !== (F2 = _3()) && (T2.exports = F2);
  512. // node_modules/@arcgis/core/views/webgl/testSamplerPrecision.js
  513. function w(w2) {
  514. const h2 = new x(w2, { colorTarget: Y.TEXTURE, depthStencilTarget: V.NONE }, { target: M.TEXTURE_2D, wrapMode: D.CLAMP_TO_EDGE, pixelFormat: P.RGBA, dataType: G.UNSIGNED_BYTE, samplingMode: L.NEAREST, width: 1, height: 1 }), _5 = "\nprecision highp float;\nattribute vec2 a_pos;\nuniform highp sampler2D u_texture;\nvarying vec4 v_color;\n\nfloat getBit(in float bitset, in int bitIndex) {\n float offset = pow(2.0, float(bitIndex));\n return mod(floor(bitset / offset), 2.0);\n}\n\nvoid main() {\n vec4 value = texture2D(u_texture, vec2(0.0));\n float bit = getBit(value.x * 255.0, 1);\n\n v_color = bit * vec4(1.0);\n gl_Position = vec4(a_pos * 2.0 - 1.0, 0.0, 1.0);\n}\n", T4 = "\nprecision highp float;\nvarying vec4 v_color;\n\nvoid main() {\n gl_FragColor = v_color;\n}\n", b = new Uint8Array(4), v2 = E3.createVertex(w2, F.STATIC_DRAW, new Uint16Array([0, 0, 1, 0, 0, 1, 1, 1])), E6 = new a2(w2, /* @__PURE__ */ new Map([["a_position", 0]]), { geometry: [new t3("a_position", 2, C.SHORT, 0, 4)] }, { geometry: v2 }), A4 = w2.programCache.acquire(_5, T4, /* @__PURE__ */ new Map([["a_pos", 0]]));
  515. w2.useProgram(A4);
  516. const x4 = new E2(w2, { target: M.TEXTURE_2D, wrapMode: D.CLAMP_TO_EDGE, pixelFormat: P.RGBA, dataType: G.UNSIGNED_BYTE, samplingMode: L.NEAREST, width: 1, height: 1 }, new Uint8Array([2, 255, 0, 0]));
  517. A4.setUniform1i("u_texture", 0), w2.bindTexture(x4, 0);
  518. const y2 = w2.getBoundFramebufferObject();
  519. w2.bindFramebuffer(h2), w2.useProgram(A4);
  520. const { x: R3, y: j, width: D2, height: N2 } = w2.getViewport();
  521. w2.setViewport(0, 0, 1, 1), w2.bindVAO(E6), w2.drawArrays(E.TRIANGLE_STRIP, 0, 4), w2.setViewport(R3, j, D2, N2), h2.readPixels(0, 0, 1, 1, P.RGBA, G.UNSIGNED_BYTE, b), A4.dispose(), E6.dispose(false), v2.dispose(), h2.dispose();
  522. const B = 255 !== b[0] || 255 !== b[1] || 255 !== b[2] || 255 !== b[3];
  523. return B && s.getLogger("esri.views.webgl.testSamplerPrecision").warn(`A problem was detected with your graphics driver. Your driver does not appear to honor sampler precision specifiers, which may result in rendering issues due to numerical instability. We recommend ensuring that your drivers have been updated to the latest version. Applying lowp sampler workaround. [${b[0]}.${b[1]}.${b[2]}.${b[3]}]`), w2.bindFramebuffer(y2), B;
  524. }
  525. // node_modules/@arcgis/core/views/webgl/testSVGPremultipliedAlpha.js
  526. async function f2(f3) {
  527. const w2 = new Image();
  528. if (w2.src = "data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg width='5' height='5' version='1.1' viewBox='0 0 5 5' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='5' height='5' fill='%23f00' fill-opacity='.5'/%3E%3C/svg%3E%0A", w2.width = 5, w2.height = 5, await w2.decode(), !f3.gl)
  529. return true;
  530. const _5 = new x(f3, { colorTarget: Y.TEXTURE, depthStencilTarget: V.NONE }, { target: M.TEXTURE_2D, wrapMode: D.CLAMP_TO_EDGE, pixelFormat: P.RGBA, dataType: G.UNSIGNED_BYTE, samplingMode: L.NEAREST, width: 1, height: 1 }), E6 = E3.createVertex(f3, F.STATIC_DRAW, new Uint16Array([0, 0, 1, 0, 0, 1, 1, 1])), h2 = new a2(f3, /* @__PURE__ */ new Map([["a_pos", 0]]), m, { geometry: E6 }), v2 = "\n precision highp float;\n\n attribute vec2 a_pos;\n varying vec2 v_uv;\n\n void main() {\n v_uv = a_pos;\n gl_Position = vec4(a_pos * 2.0 - 1.0, 0.0, 1.0);\n }\n ", T4 = "\n precision highp float;\n\n varying vec2 v_uv;\n uniform sampler2D u_texture;\n\n void main() {\n gl_FragColor = texture2D(u_texture, v_uv);\n }\n ", x4 = f3.programCache.acquire(v2, T4, /* @__PURE__ */ new Map([["a_pos", 0]]));
  531. f3.useProgram(x4);
  532. const A4 = new E2(f3, { dataType: G.UNSIGNED_BYTE, pixelFormat: P.RGBA, preMultiplyAlpha: false, wrapMode: D.CLAMP_TO_EDGE, samplingMode: L.LINEAR }, w2);
  533. f3.bindTexture(A4, 0), x4.setUniform1i("u_texture", 0);
  534. const b = f3.getBoundFramebufferObject(), { x: y2, y: B, width: C2, height: F3 } = f3.getViewport();
  535. f3.bindFramebuffer(_5), f3.setViewport(0, 0, 1, 1), f3.setClearColor(0, 0, 0, 0), f3.setBlendingEnabled(false), f3.clearSafe(_.COLOR_BUFFER_BIT), f3.bindVAO(h2), f3.drawArrays(E.TRIANGLE_STRIP, 0, 4);
  536. const R3 = new Uint8Array(4);
  537. return _5.readPixels(0, 0, 1, 1, P.RGBA, G.UNSIGNED_BYTE, R3), x4.dispose(), h2.dispose(false), E6.dispose(), _5.dispose(), A4.dispose(), f3.setViewport(y2, B, C2, F3), f3.bindFramebuffer(b), w2.src = "", 255 === R3[0];
  538. }
  539. // node_modules/@arcgis/core/views/webgl/WebGLDriverTest.js
  540. var o4 = class {
  541. constructor(e5) {
  542. this.context = e5, this._floatBufferBlendWorking = A2(e5), f2(e5).then((e6) => this._svgAlwaysPremultipliesAlpha = !e6);
  543. }
  544. get floatBufferBlendWorking() {
  545. if (t(this._floatBufferBlendWorking))
  546. throw new Error("floatBufferBlendWorking test not yet available");
  547. return this._floatBufferBlendWorking;
  548. }
  549. get svgAlwaysPremultipliesAlpha() {
  550. if (t(this._svgAlwaysPremultipliesAlpha))
  551. throw new Error("svgAlwaysPremultipliesAlpha test not yet available");
  552. return this._svgAlwaysPremultipliesAlpha;
  553. }
  554. get doublePrecisionRequiresObfuscation() {
  555. if (t(this._doublePrecisionRequiresObfuscation)) {
  556. const e5 = d(this.context, false), i3 = d(this.context, true);
  557. this._doublePrecisionRequiresObfuscation = 0 !== e5 && (0 === i3 || e5 / i3 > 5);
  558. }
  559. return this._doublePrecisionRequiresObfuscation;
  560. }
  561. get ignoresSamplerPrecision() {
  562. return t(this._ignoresSamplerPrecision) && (this._ignoresSamplerPrecision = w(this.context)), this._ignoresSamplerPrecision;
  563. }
  564. };
  565. // node_modules/@arcgis/core/views/webgl/capabilities/DisjointTimerQuery.js
  566. var t5 = class {
  567. constructor(e5, t6, E6, T4, r9, _5, i3, u, s6) {
  568. this.createQuery = e5, this.deleteQuery = t6, this.resultAvailable = E6, this.getResult = T4, this.disjoint = r9, this.beginTimeElapsed = _5, this.endTimeElapsed = i3, this.createTimestamp = u, this.timestampBits = s6;
  569. }
  570. };
  571. var E4 = false;
  572. function T3(T4, r9) {
  573. if (r9.disjointTimerQuery)
  574. return null;
  575. let _5 = T4.getExtension("EXT_disjoint_timer_query_webgl2");
  576. return _5 && n3(T4) ? new t5(() => T4.createQuery(), (e5) => {
  577. T4.deleteQuery(e5), E4 = false;
  578. }, (e5) => T4.getQueryParameter(e5, T4.QUERY_RESULT_AVAILABLE), (e5) => T4.getQueryParameter(e5, T4.QUERY_RESULT), () => T4.getParameter(_5.GPU_DISJOINT_EXT), (e5) => {
  579. E4 || (E4 = true, T4.beginQuery(_5.TIME_ELAPSED_EXT, e5));
  580. }, () => {
  581. T4.endQuery(_5.TIME_ELAPSED_EXT), E4 = false;
  582. }, (e5) => _5.queryCounterEXT(e5, _5.TIMESTAMP_EXT), () => T4.getQuery(_5.TIMESTAMP_EXT, _5.QUERY_COUNTER_BITS_EXT)) : (_5 = T4.getExtension("EXT_disjoint_timer_query"), _5 ? new t5(() => _5.createQueryEXT(), (e5) => {
  583. _5.deleteQueryEXT(e5), E4 = false;
  584. }, (e5) => _5.getQueryObjectEXT(e5, _5.QUERY_RESULT_AVAILABLE_EXT), (e5) => _5.getQueryObjectEXT(e5, _5.QUERY_RESULT_EXT), () => T4.getParameter(_5.GPU_DISJOINT_EXT), (e5) => {
  585. E4 || (E4 = true, _5.beginQueryEXT(_5.TIME_ELAPSED_EXT, e5));
  586. }, () => {
  587. _5.endQueryEXT(_5.TIME_ELAPSED_EXT), E4 = false;
  588. }, (e5) => _5.queryCounterEXT(e5, _5.TIMESTAMP_EXT), () => _5.getQueryEXT(_5.TIMESTAMP_EXT, _5.QUERY_COUNTER_BITS_EXT)) : null);
  589. }
  590. // node_modules/@arcgis/core/views/webgl/capabilities/DrawBuffers.js
  591. function A3(A4, _5) {
  592. if (_5.disjointTimerQuery)
  593. return null;
  594. if (n3(A4))
  595. return { drawBuffers: A4.drawBuffers.bind(A4), MAX_DRAW_BUFFERS: A4.MAX_DRAW_BUFFERS, MAX_COLOR_ATTACHMENTS: A4.MAX_COLOR_ATTACHMENTS };
  596. if (_5.drawBuffers)
  597. return null;
  598. const e5 = A4.getExtension("WEBGL_draw_buffers");
  599. return e5 ? { drawBuffers: e5.drawBuffersWEBGL.bind(e5), MAX_DRAW_BUFFERS: e5.MAX_DRAW_BUFFERS_WEBGL, MAX_COLOR_ATTACHMENTS: e5.MAX_COLOR_ATTACHMENTS_WEBGL } : null;
  600. }
  601. // node_modules/@arcgis/core/views/webgl/capabilities/Instancing.js
  602. function r6(r9) {
  603. if (n3(r9))
  604. return r9;
  605. const t6 = r9.getExtension("ANGLE_instanced_arrays");
  606. return t6 ? { drawArraysInstanced: t6.drawArraysInstancedANGLE.bind(t6), drawElementsInstanced: t6.drawElementsInstancedANGLE.bind(t6), vertexAttribDivisor: t6.vertexAttribDivisorANGLE.bind(t6) } : null;
  607. }
  608. // node_modules/@arcgis/core/views/webgl/capabilities/load.js
  609. function _4(t6, _5) {
  610. if (_5.compressedTextureETC)
  611. return null;
  612. const e5 = t6.getExtension("WEBGL_compressed_texture_etc");
  613. return e5 ? { COMPRESSED_R11_EAC: e5.COMPRESSED_R11_EAC, COMPRESSED_SIGNED_R11_EAC: e5.COMPRESSED_SIGNED_R11_EAC, COMPRESSED_RG11_EAC: e5.COMPRESSED_RG11_EAC, COMPRESSED_SIGNED_RG11_EAC: e5.COMPRESSED_SIGNED_RG11_EAC, COMPRESSED_RGB8_ETC2: e5.COMPRESSED_RGB8_ETC2, COMPRESSED_SRGB8_ETC2: e5.COMPRESSED_SRGB8_ETC2, COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2: e5.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2: e5.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, COMPRESSED_RGBA8_ETC2_EAC: e5.COMPRESSED_RGBA8_ETC2_EAC, COMPRESSED_SRGB8_ALPHA8_ETC2_EAC: e5.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC } : null;
  614. }
  615. function e3(t6, _5) {
  616. if (_5.compressedTextureS3TC)
  617. return null;
  618. const e5 = t6.getExtension("WEBGL_compressed_texture_s3tc");
  619. return e5 ? { COMPRESSED_RGB_S3TC_DXT1: e5.COMPRESSED_RGB_S3TC_DXT1_EXT, COMPRESSED_RGBA_S3TC_DXT1: e5.COMPRESSED_RGBA_S3TC_DXT1_EXT, COMPRESSED_RGBA_S3TC_DXT3: e5.COMPRESSED_RGBA_S3TC_DXT3_EXT, COMPRESSED_RGBA_S3TC_DXT5: e5.COMPRESSED_RGBA_S3TC_DXT5_EXT } : null;
  620. }
  621. function E5(_5, e5) {
  622. if (n3(_5))
  623. return { MIN: _5.MIN, MAX: _5.MAX };
  624. if (e5.blendMinMax)
  625. return null;
  626. {
  627. const t6 = _5.getExtension("EXT_blend_minmax");
  628. return t6 ? { MIN: t6.MIN_EXT, MAX: t6.MAX_EXT } : null;
  629. }
  630. }
  631. function n6(t6, _5) {
  632. if (_5.textureFilterAnisotropic)
  633. return null;
  634. const e5 = t6.getExtension("EXT_texture_filter_anisotropic") || t6.getExtension("MOZ_EXT_texture_filter_anisotropic") || t6.getExtension("WEBKIT_EXT_texture_filter_anisotropic");
  635. return e5 ? { MAX_TEXTURE_MAX_ANISOTROPY: e5.MAX_TEXTURE_MAX_ANISOTROPY_EXT, TEXTURE_MAX_ANISOTROPY: e5.TEXTURE_MAX_ANISOTROPY_EXT } : null;
  636. }
  637. function R2(_5, e5) {
  638. if (n3(_5))
  639. return { textureFloat: true, textureFloatLinear: !e5.textureFloatLinear && !!_5.getExtension("OES_texture_float_linear"), textureHalfFloat: true, textureHalfFloatLinear: true, HALF_FLOAT: _5.HALF_FLOAT, R16F: _5.R16F, RG16F: _5.RG16F, RGBA16F: _5.RGBA16F, R32F: _5.R32F, RG32F: _5.RG32F, RGBA32F: _5.RGBA32F, R11F_G11F_B10F: _5.R11F_G11F_B10F, RGB16F: _5.RGB16F };
  640. if (_5 instanceof WebGLRenderingContext) {
  641. const t6 = !e5.textureHalfFloat && _5.getExtension("OES_texture_half_float");
  642. return { textureFloat: !e5.textureFloat && !!_5.getExtension("OES_texture_float"), textureFloatLinear: !e5.textureFloatLinear && !!_5.getExtension("OES_texture_float_linear"), textureHalfFloat: !!t6, textureHalfFloatLinear: !e5.textureHalfFloatLinear && !!_5.getExtension("OES_texture_half_float_linear"), HALF_FLOAT: t6 ? t6.HALF_FLOAT_OES : void 0 };
  643. }
  644. return null;
  645. }
  646. function r7(_5, e5) {
  647. if (n3(_5)) {
  648. const t6 = !e5.colorBufferHalfFloat && _5.getExtension("EXT_color_buffer_half_float") || !e5.colorBufferFloat && _5.getExtension("EXT_color_buffer_float"), E6 = !e5.colorBufferFloat && _5.getExtension("EXT_color_buffer_float"), n7 = !e5.floatBlend && !e5.colorBufferFloat && _5.getExtension("EXT_float_blend");
  649. return t6 || E6 || n7 ? { textureFloat: !!E6, textureHalfFloat: !!t6, floatBlend: !!n7, R16F: _5.R16F, RG16F: _5.RG16F, RGBA16F: _5.RGBA16F, R32F: _5.R32F, RG32F: _5.RG32F, RGBA32F: _5.RGBA32F, R11F_G11F_B10F: _5.R11F_G11F_B10F, RGB16F: _5.RGB16F } : null;
  650. }
  651. if (_5 instanceof WebGLRenderingContext) {
  652. const t6 = !e5.colorBufferHalfFloat && _5.getExtension("EXT_color_buffer_half_float"), E6 = !e5.colorBufferFloat && _5.getExtension("WEBGL_color_buffer_float"), n7 = !e5.floatBlend && !e5.colorBufferFloat && _5.getExtension("EXT_float_blend");
  653. return t6 || E6 || n7 ? { textureFloat: !!E6, textureHalfFloat: !!t6, floatBlend: !!n7, RGBA16F: t6 ? t6.RGBA16F_EXT : void 0, RGB16F: t6 ? t6.RGB16F_EXT : void 0, RGBA32F: E6 ? E6.RGBA32F_EXT : void 0 } : null;
  654. }
  655. return null;
  656. }
  657. function o5(_5, e5, E6, n7, R3) {
  658. if (n7 && n3(_5))
  659. return true;
  660. if (e5[E6])
  661. return false;
  662. for (const t6 of R3)
  663. if (_5.getExtension(t6))
  664. return true;
  665. return false;
  666. }
  667. function l(_5, e5) {
  668. if (!n3(_5))
  669. return null;
  670. if (e5.textureNorm16)
  671. return null;
  672. const E6 = _5.getExtension("EXT_texture_norm16");
  673. return E6 ? { R16: E6.R16_EXT, RG16: E6.RG16_EXT, RGB16: E6.RGB16_EXT, RGBA16: E6.RGBA16_EXT, R16_SNORM: E6.R16_SNORM_EXT, RG16_SNORM: E6.RG16_SNORM_EXT, RGB16_SNORM: E6.RGB16_SNORM_EXT, RGBA16_SNORM: E6.RGBA16_SNORM_EXT } : null;
  674. }
  675. // node_modules/@arcgis/core/views/webgl/capabilities/LoseContext.js
  676. function e4(e5, t6) {
  677. const n7 = t6.loseContext && e5.getExtension("WEBGL_lose_context");
  678. return n7 ? { loseRenderingContext: () => n7.loseContext() } : null;
  679. }
  680. // node_modules/@arcgis/core/views/webgl/capabilities/VertexArrayObjects.js
  681. function r8(r9, t6) {
  682. if (n3(r9))
  683. return { createVertexArray: r9.createVertexArray.bind(r9), deleteVertexArray: r9.deleteVertexArray.bind(r9), bindVertexArray: r9.bindVertexArray.bind(r9) };
  684. if (t6.vao)
  685. return null;
  686. const n7 = r9.getExtension("OES_vertex_array_object") || r9.getExtension("MOZ_OES_vertex_array_object") || r9.getExtension("WEBKIT_OES_vertex_array_object");
  687. return n7 ? { createVertexArray: n7.createVertexArrayOES.bind(n7), deleteVertexArray: n7.deleteVertexArrayOES.bind(n7), bindVertexArray: n7.bindVertexArrayOES.bind(n7) } : null;
  688. }
  689. // node_modules/@arcgis/core/views/webgl/capabilities/Capabilities.js
  690. var x3 = class {
  691. constructor(t6, e5) {
  692. this._gl = t6, this._instancing = null, this._vertexArrayObject = null, this._compressedTextureETC = null, this._compressedTextureS3TC = null, this._textureFilterAnisotropic = null, this._textureFloat = null, this._colorBufferFloat = null, this._minMaxBlending = null, this._loseContext = null, this._drawBuffers = null, this._textureNorm16 = null, this._depthTexture = null, this._standardDerivatives = null, this._shaderTextureLOD = null, this._fragDepth = null, this._textureFloatLinear = null, this._disabledExtensions = e5.disabledExtensions || {}, this._debugWebGLExtensions = e5.debugWebGLExtensions || {};
  693. }
  694. get drawBuffers() {
  695. return this._drawBuffers || (this._drawBuffers = A3(this._gl, this._disabledExtensions)), this._drawBuffers;
  696. }
  697. get instancing() {
  698. return this._instancing || (this._instancing = r6(this._gl)), this._instancing;
  699. }
  700. get vao() {
  701. return this._vertexArrayObject || (this._vertexArrayObject = r8(this._gl, this._disabledExtensions)), this._vertexArrayObject;
  702. }
  703. get compressedTextureETC() {
  704. return this._compressedTextureETC || (this._compressedTextureETC = _4(this._gl, this._disabledExtensions)), this._compressedTextureETC;
  705. }
  706. get compressedTextureS3TC() {
  707. return this._compressedTextureS3TC || (this._compressedTextureS3TC = e3(this._gl, this._disabledExtensions)), this._compressedTextureS3TC;
  708. }
  709. get textureFilterAnisotropic() {
  710. return this._textureFilterAnisotropic || (this._textureFilterAnisotropic = n6(this._gl, this._disabledExtensions)), this._textureFilterAnisotropic;
  711. }
  712. get disjointTimerQuery() {
  713. return this._disjointTimerQuery || (this._disjointTimerQuery = T3(this._gl, this._disabledExtensions)), this._disjointTimerQuery;
  714. }
  715. get textureFloat() {
  716. return this._textureFloat || (this._textureFloat = R2(this._gl, this._disabledExtensions)), this._textureFloat;
  717. }
  718. get colorBufferFloat() {
  719. return this._colorBufferFloat || (this._colorBufferFloat = r7(this._gl, this._disabledExtensions)), this._colorBufferFloat;
  720. }
  721. get blendMinMax() {
  722. return this._minMaxBlending || (this._minMaxBlending = E5(this._gl, this._disabledExtensions)), this._minMaxBlending;
  723. }
  724. get depthTexture() {
  725. return null === this._depthTexture && (this._depthTexture = o5(this._gl, this._disabledExtensions, "depthTexture", true, ["WEBGL_depth_texture", "MOZ_WEBGL_depth_texture", "WEBKIT_WEBGL_depth_texture"])), this._depthTexture;
  726. }
  727. get standardDerivatives() {
  728. return null === this._standardDerivatives && (this._standardDerivatives = o5(this._gl, this._disabledExtensions, "standardDerivatives", true, ["OES_standard_derivatives"])), this._standardDerivatives;
  729. }
  730. get shaderTextureLOD() {
  731. return null === this._shaderTextureLOD && (this._shaderTextureLOD = o5(this._gl, this._disabledExtensions, "shaderTextureLOD", true, ["EXT_shader_texture_lod"])), this._shaderTextureLOD;
  732. }
  733. get fragDepth() {
  734. return null === this._fragDepth && (this._fragDepth = o5(this._gl, this._disabledExtensions, "fragDepth", true, ["EXT_frag_depth"])), this._fragDepth;
  735. }
  736. get loseContext() {
  737. return this._loseContext || (this._loseContext = e4(this._gl, this._debugWebGLExtensions)), this._loseContext;
  738. }
  739. get textureNorm16() {
  740. return this._textureNorm16 || (this._textureNorm16 = l(this._gl, this._disabledExtensions)), this._textureNorm16;
  741. }
  742. get textureFloatLinear() {
  743. return null === this._textureFloatLinear && (this._textureFloatLinear = o5(this._gl, this._disabledExtensions, "textureFloatLinear", false, ["OES_texture_float_linear"])), this._textureFloatLinear;
  744. }
  745. enable(t6) {
  746. return this[t6];
  747. }
  748. };
  749. // node_modules/@arcgis/core/views/webgl/RenderingContext.js
  750. var y = class {
  751. constructor(t6, e5) {
  752. this.gl = t6, this.instanceCounter = new s5(), this.programCache = new s3(this), this._state = new h(), this._numOfDrawCalls = 0, this._numOfTriangles = 0, this.type = n3(t6) ? r4.WEBGL2 : r4.WEBGL1, this._loadExtensions(), this.configure(e5);
  753. }
  754. configure(t6) {
  755. this._capabilities = new x3(this.gl, t6), this._parameters = this._loadParameters(t6);
  756. const e5 = this.gl.getParameter(this.gl.VIEWPORT);
  757. this._state = new h(), this._state.viewport = { x: e5[0], y: e5[1], width: e5[2], height: e5[3] }, this._stateTracker = new M2({ setBlending: (t7) => {
  758. if (t7) {
  759. this.setBlendingEnabled(true), this.setBlendEquationSeparate(t7.opRgb, t7.opAlpha), this.setBlendFunctionSeparate(t7.srcRgb, t7.dstRgb, t7.srcAlpha, t7.dstAlpha);
  760. const e6 = t7.color;
  761. this.setBlendColor(e6.r, e6.g, e6.b, e6.a);
  762. } else
  763. this.setBlendingEnabled(false);
  764. }, setCulling: (t7) => {
  765. t7 ? (this.setFaceCullingEnabled(true), this.setCullFace(t7.face), this.setFrontFace(t7.mode)) : this.setFaceCullingEnabled(false);
  766. }, setPolygonOffset: (t7) => {
  767. t7 ? (this.setPolygonOffsetFillEnabled(true), this.setPolygonOffset(t7.factor, t7.units)) : this.setPolygonOffsetFillEnabled(false);
  768. }, setDepthTest: (t7) => {
  769. t7 ? (this.setDepthTestEnabled(true), this.setDepthFunction(t7.func)) : this.setDepthTestEnabled(false);
  770. }, setStencilTest: (t7) => {
  771. if (t7) {
  772. this.setStencilTestEnabled(true);
  773. const e6 = t7.function;
  774. this.setStencilFunction(e6.func, e6.ref, e6.mask);
  775. const s6 = t7.operation;
  776. this.setStencilOp(s6.fail, s6.zFail, s6.zPass);
  777. } else
  778. this.setStencilTestEnabled(false);
  779. }, setDepthWrite: (t7) => {
  780. t7 ? (this.setDepthWriteEnabled(true), this.setDepthRange(t7.zNear, t7.zFar)) : this.setDepthWriteEnabled(false);
  781. }, setColorWrite: (t7) => {
  782. t7 ? this.setColorMask(t7.r, t7.g, t7.b, t7.a) : this.setColorMask(false, false, false, false);
  783. }, setStencilWrite: (t7) => {
  784. t7 ? this.setStencilWriteMask(t7.mask) : this.setStencilWriteMask(0);
  785. } }), this.enforceState(), this._driverTest = new o4(this);
  786. }
  787. get driverTest() {
  788. return this._driverTest;
  789. }
  790. get contextAttributes() {
  791. return this.gl.getContextAttributes();
  792. }
  793. get parameters() {
  794. return this._parameters;
  795. }
  796. dispose() {
  797. this.programCache.dispose(), this.bindVAO(null), this.unbindBuffer(A.ARRAY_BUFFER), this.unbindBuffer(A.ELEMENT_ARRAY_BUFFER), n3(this.gl) && (this.unbindBuffer(A.UNIFORM_BUFFER), this._state.uniformBufferBindingPoints.length = 0, this.unbindBuffer(A.PIXEL_PACK_BUFFER), this.unbindBuffer(A.PIXEL_UNPACK_BUFFER), this.unbindBuffer(A.COPY_READ_BUFFER), this.unbindBuffer(A.COPY_WRITE_BUFFER)), this._state.textureUnitMap.length = 0, a() && this.instanceCounter.printResourceCount();
  798. }
  799. setPipelineState(t6) {
  800. this._stateTracker.setPipeline(t6);
  801. }
  802. setBlendingEnabled(t6) {
  803. this._state.blend !== t6 && (true === t6 ? this.gl.enable(this.gl.BLEND) : this.gl.disable(this.gl.BLEND), this._state.blend = t6, this._stateTracker.invalidateBlending());
  804. }
  805. externalProgramUpdate() {
  806. var _a;
  807. (_a = this._state.program) == null ? void 0 : _a.stop(), this._state.program = null;
  808. }
  809. externalTextureUnitUpdate(t6, e5) {
  810. for (let s6 = 0; s6 < t6.length; ++s6)
  811. this._state.textureUnitMap[t6[s6]] = null;
  812. e5 >= 0 && (this._state.activeTexture = e5);
  813. }
  814. externalVertexArrayObjectUpdate() {
  815. const t6 = this.capabilities.vao;
  816. t6 && (t6.bindVertexArray(null), this._state.vertexArrayObject = null), this._state.vertexBuffer = null, this._state.indexBuffer = null;
  817. }
  818. externalVertexBufferUpdate() {
  819. this._state.vertexBuffer = null;
  820. }
  821. externalIndexBufferUpdate() {
  822. this._state.indexBuffer = null;
  823. }
  824. setBlendColor(t6, e5, s6, i3) {
  825. t6 === this._state.blendColor.r && e5 === this._state.blendColor.g && s6 === this._state.blendColor.b && i3 === this._state.blendColor.a || (this.gl.blendColor(t6, e5, s6, i3), this._state.blendColor.r = t6, this._state.blendColor.g = e5, this._state.blendColor.b = s6, this._state.blendColor.a = i3, this._stateTracker.invalidateBlending());
  826. }
  827. setBlendFunction(t6, e5) {
  828. t6 === this._state.blendFunction.srcRGB && e5 === this._state.blendFunction.dstRGB || (this.gl.blendFunc(t6, e5), this._state.blendFunction.srcRGB = t6, this._state.blendFunction.srcAlpha = t6, this._state.blendFunction.dstRGB = e5, this._state.blendFunction.dstAlpha = e5, this._stateTracker.invalidateBlending());
  829. }
  830. setBlendFunctionSeparate(t6, e5, s6, i3) {
  831. this._state.blendFunction.srcRGB === t6 && this._state.blendFunction.srcAlpha === s6 && this._state.blendFunction.dstRGB === e5 && this._state.blendFunction.dstAlpha === i3 || (this.gl.blendFuncSeparate(t6, e5, s6, i3), this._state.blendFunction.srcRGB = t6, this._state.blendFunction.srcAlpha = s6, this._state.blendFunction.dstRGB = e5, this._state.blendFunction.dstAlpha = i3, this._stateTracker.invalidateBlending());
  832. }
  833. setBlendEquation(t6) {
  834. this._state.blendEquation.mode !== t6 && (this.gl.blendEquation(t6), this._state.blendEquation.mode = t6, this._state.blendEquation.modeAlpha = t6, this._stateTracker.invalidateBlending());
  835. }
  836. setBlendEquationSeparate(t6, e5) {
  837. this._state.blendEquation.mode === t6 && this._state.blendEquation.modeAlpha === e5 || (this.gl.blendEquationSeparate(t6, e5), this._state.blendEquation.mode = t6, this._state.blendEquation.modeAlpha = e5, this._stateTracker.invalidateBlending());
  838. }
  839. setColorMask(t6, e5, s6, i3) {
  840. this._state.colorMask.r === t6 && this._state.colorMask.g === e5 && this._state.colorMask.b === s6 && this._state.colorMask.a === i3 || (this.gl.colorMask(t6, e5, s6, i3), this._state.colorMask.r = t6, this._state.colorMask.g = e5, this._state.colorMask.b = s6, this._state.colorMask.a = i3, this._stateTracker.invalidateColorWrite());
  841. }
  842. setClearColor(t6, e5, s6, i3) {
  843. this._state.clearColor.r === t6 && this._state.clearColor.g === e5 && this._state.clearColor.b === s6 && this._state.clearColor.a === i3 || (this.gl.clearColor(t6, e5, s6, i3), this._state.clearColor.r = t6, this._state.clearColor.g = e5, this._state.clearColor.b = s6, this._state.clearColor.a = i3);
  844. }
  845. setFaceCullingEnabled(t6) {
  846. this._state.faceCulling !== t6 && (true === t6 ? this.gl.enable(this.gl.CULL_FACE) : this.gl.disable(this.gl.CULL_FACE), this._state.faceCulling = t6, this._stateTracker.invalidateCulling());
  847. }
  848. setPolygonOffsetFillEnabled(t6) {
  849. this._state.polygonOffsetFill !== t6 && (true === t6 ? this.gl.enable(this.gl.POLYGON_OFFSET_FILL) : this.gl.disable(this.gl.POLYGON_OFFSET_FILL), this._state.polygonOffsetFill = t6, this._stateTracker.invalidatePolygonOffset());
  850. }
  851. setPolygonOffset(t6, e5) {
  852. this._state.polygonOffset[0] === t6 && this._state.polygonOffset[1] === e5 || (this._state.polygonOffset[0] = t6, this._state.polygonOffset[1] = e5, this.gl.polygonOffset(t6, e5), this._stateTracker.invalidatePolygonOffset());
  853. }
  854. setCullFace(t6) {
  855. this._state.cullFace !== t6 && (this.gl.cullFace(t6), this._state.cullFace = t6, this._stateTracker.invalidateCulling());
  856. }
  857. setFrontFace(t6) {
  858. this._state.frontFace !== t6 && (this.gl.frontFace(t6), this._state.frontFace = t6, this._stateTracker.invalidateCulling());
  859. }
  860. setScissorTestEnabled(t6) {
  861. this._state.scissorTest !== t6 && (true === t6 ? this.gl.enable(this.gl.SCISSOR_TEST) : this.gl.disable(this.gl.SCISSOR_TEST), this._state.scissorTest = t6);
  862. }
  863. setScissorRect(t6, e5, s6, i3) {
  864. this._state.scissorRect.x === t6 && this._state.scissorRect.y === e5 && this._state.scissorRect.width === s6 && this._state.scissorRect.height === i3 || (this.gl.scissor(t6, e5, s6, i3), this._state.scissorRect.x = t6, this._state.scissorRect.y = e5, this._state.scissorRect.width = s6, this._state.scissorRect.height = i3);
  865. }
  866. setDepthTestEnabled(t6) {
  867. this._state.depthTest !== t6 && (true === t6 ? this.gl.enable(this.gl.DEPTH_TEST) : this.gl.disable(this.gl.DEPTH_TEST), this._state.depthTest = t6, this._stateTracker.invalidateDepthTest());
  868. }
  869. setClearDepth(t6) {
  870. this._state.clearDepth !== t6 && (this.gl.clearDepth(t6), this._state.clearDepth = t6);
  871. }
  872. setDepthFunction(t6) {
  873. this._state.depthFunction !== t6 && (this.gl.depthFunc(t6), this._state.depthFunction = t6, this._stateTracker.invalidateDepthTest());
  874. }
  875. setDepthWriteEnabled(t6) {
  876. this._state.depthWrite !== t6 && (this.gl.depthMask(t6), this._state.depthWrite = t6, this._stateTracker.invalidateDepthWrite());
  877. }
  878. setDepthRange(t6, e5) {
  879. this._state.depthRange.zNear === t6 && this._state.depthRange.zFar === e5 || (this.gl.depthRange(t6, e5), this._state.depthRange.zNear = t6, this._state.depthRange.zFar = e5, this._stateTracker.invalidateDepthWrite());
  880. }
  881. setStencilTestEnabled(t6) {
  882. this._state.stencilTest !== t6 && (true === t6 ? this.gl.enable(this.gl.STENCIL_TEST) : this.gl.disable(this.gl.STENCIL_TEST), this._state.stencilTest = t6, this._stateTracker.invalidateStencilTest());
  883. }
  884. setClearStencil(t6) {
  885. t6 !== this._state.clearStencil && (this.gl.clearStencil(t6), this._state.clearStencil = t6);
  886. }
  887. setStencilFunction(t6, e5, s6) {
  888. this._state.stencilFunction.func === t6 && this._state.stencilFunction.ref === e5 && this._state.stencilFunction.mask === s6 || (this.gl.stencilFunc(t6, e5, s6), this._state.stencilFunction.face = N.FRONT_AND_BACK, this._state.stencilFunction.func = t6, this._state.stencilFunction.ref = e5, this._state.stencilFunction.mask = s6, this._stateTracker.invalidateStencilTest());
  889. }
  890. setStencilFunctionSeparate(t6, e5, s6, i3) {
  891. this._state.stencilFunction.face === t6 && this._state.stencilFunction.func === e5 && this._state.stencilFunction.ref === s6 && this._state.stencilFunction.mask === i3 || (this.gl.stencilFuncSeparate(t6, e5, s6, i3), this._state.stencilFunction.face = t6, this._state.stencilFunction.func = e5, this._state.stencilFunction.ref = s6, this._state.stencilFunction.mask = i3, this._stateTracker.invalidateStencilTest());
  892. }
  893. setStencilWriteMask(t6) {
  894. this._state.stencilWriteMask !== t6 && (this.gl.stencilMask(t6), this._state.stencilWriteMask = t6, this._stateTracker.invalidateStencilWrite());
  895. }
  896. setStencilOp(t6, e5, s6) {
  897. this._state.stencilOperation.face === N.FRONT_AND_BACK && this._state.stencilOperation.fail === t6 && this._state.stencilOperation.zFail === e5 && this._state.stencilOperation.zPass === s6 || (this.gl.stencilOp(t6, e5, s6), this._state.stencilOperation.face = N.FRONT_AND_BACK, this._state.stencilOperation.fail = t6, this._state.stencilOperation.zFail = e5, this._state.stencilOperation.zPass = s6, this._stateTracker.invalidateStencilTest());
  898. }
  899. setStencilOpSeparate(t6, e5, s6, i3) {
  900. this._state.stencilOperation.face === t6 && this._state.stencilOperation.fail === e5 && this._state.stencilOperation.zFail === s6 && this._state.stencilOperation.zPass === i3 || (this.gl.stencilOpSeparate(t6, e5, s6, i3), this._state.stencilOperation.face = t6, this._state.stencilOperation.fail = e5, this._state.stencilOperation.zFail = s6, this._state.stencilOperation.zPass = i3, this._stateTracker.invalidateStencilTest());
  901. }
  902. setActiveTexture(t6, e5 = false) {
  903. const s6 = this._state.activeTexture;
  904. return t6 >= 0 && (e5 || t6 !== this._state.activeTexture) && (this.gl.activeTexture(X + t6), this._state.activeTexture = t6), s6;
  905. }
  906. clear(t6) {
  907. t6 && this.gl.clear(t6);
  908. }
  909. clearSafe(t6, e5 = 255) {
  910. t6 && (t6 & _.COLOR_BUFFER_BIT && this.setColorMask(true, true, true, true), t6 & _.DEPTH_BUFFER_BIT && this.setDepthWriteEnabled(true), t6 & _.STENCIL_BUFFER_BIT && this.setStencilWriteMask(e5), this.gl.clear(t6));
  911. }
  912. drawArrays(t6, e5, s6) {
  913. if (a() && (this._numOfDrawCalls++, this._numOfTriangles += v(t6, s6)), this.gl.drawArrays(t6, e5, s6), a()) {
  914. const t7 = i2(this);
  915. t7 && console.error("drawArrays:", t7);
  916. }
  917. }
  918. drawElements(e5, s6, i3, a3) {
  919. var _a;
  920. if (a() && (this._numOfDrawCalls++, this._numOfTriangles += v(e5, s6)), this.gl.drawElements(e5, s6, i3, a3), a()) {
  921. const r9 = i2(this);
  922. if (r9) {
  923. const n7 = this.getBoundVAO(), l2 = n7 == null ? void 0 : n7.indexBuffer, h2 = n7 == null ? void 0 : n7.vertexBuffers, f3 = { indexBuffer: l2, vertexBuffers: h2 }, o6 = { mode: e5, count: s6, type: i3, offset: a3 }, _5 = (_a = o(l2, (t6) => t6.size)) != null ? _a : 0, u = a3 + s6, c = _5 < u ? `. Buffer is too small. Attempted to draw index ${u} of ${_5}` : "";
  924. console.error(`drawElements: ${r9}${c}`, { args: o6, vao: f3 });
  925. }
  926. }
  927. }
  928. logInfo() {
  929. a() && console.log(`DrawCalls: ${this._numOfDrawCalls}, Triangles: ${this._numOfTriangles}`);
  930. }
  931. resetInfo() {
  932. a() && (this._numOfDrawCalls = 0, this._numOfTriangles = 0);
  933. }
  934. get capabilities() {
  935. return this._capabilities;
  936. }
  937. setViewport(t6, e5, s6, i3) {
  938. s6 = Math.max(Math.round(s6), 1), i3 = Math.max(Math.round(i3), 1);
  939. const a3 = this._state.viewport;
  940. a3.x === t6 && a3.y === e5 && a3.width === s6 && a3.height === i3 || (a3.x = t6, a3.y = e5, a3.width = s6, a3.height = i3, this.gl.viewport(t6, e5, s6, i3));
  941. }
  942. getViewport() {
  943. const t6 = this._state.viewport;
  944. return { x: t6.x, y: t6.y, width: t6.width, height: t6.height };
  945. }
  946. useProgram(t6) {
  947. var _a, _b;
  948. this._state.program !== t6 && ((_a = this._state.program) == null ? void 0 : _a.stop(), this._state.program = t6, this.gl.useProgram((_b = t6 == null ? void 0 : t6.glName) != null ? _b : null));
  949. }
  950. bindTexture(t6, i3, a3 = false) {
  951. (i3 >= this.parameters.maxTextureImageUnits || i3 < 0) && console.error("Input texture unit is out of range of available units!");
  952. const r9 = this._state.textureUnitMap[i3];
  953. return t(t6) || null == t6.glName ? (r(r9) && (this.setActiveTexture(i3, a3), this.gl.bindTexture(r9.descriptor.target, null)), this._state.textureUnitMap[i3] = null, r9) : a3 || r9 !== t6 ? (this.setActiveTexture(i3, a3), this.gl.bindTexture(t6.descriptor.target, t6.glName), t6.applyChanges(), this._state.textureUnitMap[i3] = t6, r9) : (t6.isDirty && (this.setActiveTexture(i3, a3), t6.applyChanges()), r9);
  954. }
  955. unbindTexture(t6) {
  956. if (!t(t6))
  957. for (let e5 = 0; e5 < this.parameters.maxTextureImageUnits; e5++)
  958. this._state.textureUnitMap[e5] === t6 && (this.bindTexture(null, e5), this._state.textureUnitMap[e5] = null);
  959. }
  960. bindFramebuffer(t6, s6 = false) {
  961. if (s6 || this._state.readFramebuffer !== t6 || this._state.drawFramebuffer !== t6) {
  962. if (t(t6))
  963. return this.gl.bindFramebuffer(n2.FRAMEBUFFER, null), this._state.readFramebuffer = null, void (this._state.drawFramebuffer = null);
  964. t6.initializeAndBind(n2.FRAMEBUFFER), this._state.readFramebuffer = t6, this._state.drawFramebuffer = t6;
  965. }
  966. }
  967. bindFramebufferSeparate(t6, s6, a3 = false) {
  968. const r9 = s6 === n2.READ_FRAMEBUFFER, n7 = r9 ? this._state.readFramebuffer : this._state.drawFramebuffer;
  969. (a3 || n7 !== t6) && (t(t6) ? this.gl.bindFramebuffer(s6, null) : t6.initializeAndBind(s6), r9 ? this._state.readFramebuffer = i(t6, null) : this._state.drawFramebuffer = i(t6, null));
  970. }
  971. blitFramebuffer(t6, e5, s6 = 0, i3 = 0, a3 = t6.width, r9 = t6.height, n7 = 0, l2 = 0, h2 = e5.width, f3 = e5.height, o6 = _.COLOR_BUFFER_BIT, _5 = L.NEAREST) {
  972. this.bindFramebufferSeparate(t6, n2.READ_FRAMEBUFFER), this.bindFramebufferSeparate(e5, n2.DRAW_FRAMEBUFFER);
  973. this.gl.blitFramebuffer(s6, i3, a3, r9, n7, l2, h2, f3, o6, _5);
  974. }
  975. bindBuffer(t6, e5) {
  976. if (t6)
  977. switch (e5 != null ? e5 : e5 = t6.bufferType, e5) {
  978. case A.ARRAY_BUFFER:
  979. this._state.vertexBuffer = I2(this.gl, t6, e5, this._state.vertexBuffer);
  980. break;
  981. case A.ELEMENT_ARRAY_BUFFER:
  982. this._state.indexBuffer = I2(this.gl, t6, e5, this._state.indexBuffer);
  983. break;
  984. case A.UNIFORM_BUFFER:
  985. this._state.uniformBuffer = I2(this.gl, t6, e5, this._state.uniformBuffer);
  986. break;
  987. case A.PIXEL_PACK_BUFFER:
  988. this._state.pixelPackBuffer = I2(this.gl, t6, e5, this._state.pixelPackBuffer);
  989. break;
  990. case A.PIXEL_UNPACK_BUFFER:
  991. this._state.pixelUnpackBuffer = I2(this.gl, t6, e5, this._state.pixelUnpackBuffer);
  992. break;
  993. case A.COPY_READ_BUFFER:
  994. this._state.copyReadBuffer = I2(this.gl, t6, e5, this._state.copyReadBuffer);
  995. break;
  996. case A.COPY_WRITE_BUFFER:
  997. this._state.copyWriteBuffer = I2(this.gl, t6, e5, this._state.copyWriteBuffer);
  998. }
  999. }
  1000. bindRenderbuffer(t6) {
  1001. const e5 = this.gl;
  1002. t6 || (e5.bindRenderbuffer(e5.RENDERBUFFER, null), this._state.renderbuffer = null), this._state.renderbuffer !== t6 && (e5.bindRenderbuffer(e5.RENDERBUFFER, t6.glName), this._state.renderbuffer = t6);
  1003. }
  1004. _getBufferBinding(t6, s6) {
  1005. if (s6 >= this.parameters.maxUniformBufferBindings || s6 < 0)
  1006. return console.error("Uniform buffer binding point is out of range!"), null;
  1007. const i3 = this._state.uniformBufferBindingPoints;
  1008. let a3 = i3[s6];
  1009. return t(a3) && (a3 = { buffer: null, offset: 0, size: 0 }, i3[s6] = a3), a3;
  1010. }
  1011. bindBufferBase(t6, s6, i3) {
  1012. const a3 = this._getBufferBinding(t6, s6);
  1013. if (t(a3))
  1014. return;
  1015. if (a3.buffer === i3 && 0 === a3.offset && 0 === a3.size)
  1016. return;
  1017. this.gl.bindBufferBase(t6, s6, i3 ? i3.glName : null), a3.buffer = i3, a3.offset = 0, a3.size = 0;
  1018. }
  1019. bindBufferRange(t6, s6, i3, a3, r9) {
  1020. const n7 = this._getBufferBinding(t6, s6);
  1021. if (t(n7))
  1022. return;
  1023. if (n7.buffer === i3 && n7.offset === a3 && n7.size === r9)
  1024. return;
  1025. if (a3 % this._parameters.uniformBufferOffsetAlignment != 0)
  1026. return void console.error("Uniform buffer binding offset is not a multiple of the context offset alignment");
  1027. this.gl.bindBufferRange(t6, s6, i3.glName, a3, r9), n7.buffer = i3, n7.offset = a3, n7.size = r9;
  1028. }
  1029. bindUBO(t6, s6, i3, a3) {
  1030. t(s6) ? this.bindBufferBase(A.UNIFORM_BUFFER, t6, null) : (a() && (a3 != null ? a3 : s6.byteLength) > this._parameters.maxUniformBlockSize && console.error("Attempting to bind more data than the maximum uniform block size"), s6.initialize(), void 0 !== i3 && void 0 !== a3 ? this.bindBufferRange(A.UNIFORM_BUFFER, t6, s6.buffer, i3, a3) : this.bindBufferBase(A.UNIFORM_BUFFER, t6, s6.buffer));
  1031. }
  1032. unbindUBO(t6) {
  1033. for (let e5 = 0, i3 = this._state.uniformBufferBindingPoints.length; e5 < i3; e5++) {
  1034. const i4 = this._state.uniformBufferBindingPoints[e5];
  1035. r(i4) && i4.buffer === t6.buffer && this.bindBufferBase(A.UNIFORM_BUFFER, e5, null);
  1036. }
  1037. }
  1038. unbindBuffer(t6) {
  1039. switch (t6) {
  1040. case A.ARRAY_BUFFER:
  1041. this._state.vertexBuffer = I2(this.gl, null, t6, this._state.vertexBuffer);
  1042. break;
  1043. case A.ELEMENT_ARRAY_BUFFER:
  1044. this._state.indexBuffer = I2(this.gl, null, t6, this._state.indexBuffer);
  1045. break;
  1046. case A.UNIFORM_BUFFER:
  1047. this._state.uniformBuffer = I2(this.gl, null, t6, this._state.uniformBuffer);
  1048. break;
  1049. case A.PIXEL_PACK_BUFFER:
  1050. this._state.pixelPackBuffer = I2(this.gl, null, t6, this._state.pixelPackBuffer);
  1051. break;
  1052. case A.PIXEL_UNPACK_BUFFER:
  1053. this._state.pixelUnpackBuffer = I2(this.gl, null, t6, this._state.pixelUnpackBuffer);
  1054. break;
  1055. case A.COPY_READ_BUFFER:
  1056. this._state.copyReadBuffer = I2(this.gl, null, t6, this._state.copyReadBuffer);
  1057. break;
  1058. case A.COPY_WRITE_BUFFER:
  1059. this._state.copyWriteBuffer = I2(this.gl, null, t6, this._state.copyWriteBuffer);
  1060. }
  1061. }
  1062. bindVAO(t6 = null) {
  1063. t(t6) ? this._state.vertexArrayObject && (this._state.vertexArrayObject.unbind(), this._state.vertexArrayObject = null) : this._state.vertexArrayObject !== t6 && (t6.bind(), this._state.vertexArrayObject = t6);
  1064. }
  1065. async clientWaitAsync(t6 = n(10)) {
  1066. const e5 = this.gl, s6 = e5.fenceSync(W.SYNC_GPU_COMMANDS_COMPLETE, 0);
  1067. if (!s6)
  1068. throw new Error("Client wait failed, could not create sync object");
  1069. let i3;
  1070. this.instanceCounter.increment(t2.Sync, s6), e5.flush();
  1071. do {
  1072. await U(t6), i3 = e5.clientWaitSync(s6, 0, 0);
  1073. } while (i3 === r3.TIMEOUT_EXPIRED);
  1074. if (this.instanceCounter.decrement(t2.Sync, s6), e5.deleteSync(s6), i3 === r3.WAIT_FAILED)
  1075. throw new Error("Client wait failed");
  1076. }
  1077. getBoundFramebufferObject(t6 = n2.FRAMEBUFFER) {
  1078. return t6 === n2.READ_FRAMEBUFFER ? this._state.readFramebuffer : this._state.drawFramebuffer;
  1079. }
  1080. getBoundVAO() {
  1081. return this._state.vertexArrayObject;
  1082. }
  1083. resetState() {
  1084. this.useProgram(null), this.bindVAO(null), this.bindFramebuffer(null, true), this.unbindBuffer(A.ARRAY_BUFFER), this.unbindBuffer(A.ELEMENT_ARRAY_BUFFER), n3(this.gl) && (this.unbindBuffer(A.UNIFORM_BUFFER), this._state.uniformBufferBindingPoints.length = 0, this.unbindBuffer(A.PIXEL_PACK_BUFFER), this.unbindBuffer(A.PIXEL_UNPACK_BUFFER), this.unbindBuffer(A.COPY_READ_BUFFER), this.unbindBuffer(A.COPY_WRITE_BUFFER));
  1085. for (let t6 = 0; t6 < this.parameters.maxTextureImageUnits; ++t6)
  1086. this.bindTexture(null, t6);
  1087. this.setBlendingEnabled(false), this.setBlendFunction(R.ONE, R.ZERO), this.setBlendEquation(T.ADD), this.setBlendColor(0, 0, 0, 0), this.setFaceCullingEnabled(false), this.setCullFace(N.BACK), this.setFrontFace(S.CCW), this.setPolygonOffsetFillEnabled(false), this.setPolygonOffset(0, 0), this.setScissorTestEnabled(false), this.setScissorRect(0, 0, this.gl.canvas.width, this.gl.canvas.height), this.setDepthTestEnabled(false), this.setDepthFunction(I.LESS), this.setDepthRange(0, 1), this.setStencilTestEnabled(false), this.setStencilFunction(I.ALWAYS, 0, 0), this.setStencilOp(O.KEEP, O.KEEP, O.KEEP), this.setClearColor(0, 0, 0, 0), this.setClearDepth(1), this.setClearStencil(0), this.setColorMask(true, true, true, true), this.setStencilWriteMask(4294967295), this.setDepthWriteEnabled(true), this.setViewport(0, 0, this.gl.canvas.width, this.gl.canvas.height);
  1088. }
  1089. enforceState() {
  1090. var _a, _b, _c, _d, _e, _f;
  1091. const t6 = this.gl, e5 = this.capabilities.vao;
  1092. e5 && e5.bindVertexArray(null);
  1093. for (let s6 = 0; s6 < this.parameters.maxVertexAttributes; s6++)
  1094. t6.disableVertexAttribArray(s6);
  1095. if (this._state.vertexBuffer ? t6.bindBuffer(this._state.vertexBuffer.bufferType, this._state.vertexBuffer.glName) : t6.bindBuffer(A.ARRAY_BUFFER, null), this._state.indexBuffer ? t6.bindBuffer(this._state.indexBuffer.bufferType, this._state.indexBuffer.glName) : t6.bindBuffer(A.ELEMENT_ARRAY_BUFFER, null), n3(t6)) {
  1096. this._state.uniformBuffer ? t6.bindBuffer(this._state.uniformBuffer.bufferType, this._state.uniformBuffer.glName) : t6.bindBuffer(A.UNIFORM_BUFFER, null);
  1097. for (let e6 = 0; e6 < this._parameters.maxUniformBufferBindings; e6++) {
  1098. const i4 = this._state.uniformBufferBindingPoints[e6];
  1099. if (r(i4)) {
  1100. const { buffer: s6, offset: a3, size: r9 } = i4;
  1101. null !== s6 ? 0 === a3 && 0 === r9 ? t6.bindBufferBase(A.UNIFORM_BUFFER, e6, s6.glName) : t6.bindBufferRange(A.UNIFORM_BUFFER, e6, s6.glName, a3, r9) : t6.bindBufferBase(A.UNIFORM_BUFFER, e6, null);
  1102. }
  1103. }
  1104. this._state.pixelPackBuffer ? t6.bindBuffer(this._state.pixelPackBuffer.bufferType, this._state.pixelPackBuffer.glName) : t6.bindBuffer(A.PIXEL_PACK_BUFFER, null), this._state.pixelUnpackBuffer ? t6.bindBuffer(this._state.pixelUnpackBuffer.bufferType, this._state.pixelUnpackBuffer.glName) : t6.bindBuffer(A.PIXEL_UNPACK_BUFFER, null), this._state.copyReadBuffer ? t6.bindBuffer(this._state.copyReadBuffer.bufferType, this._state.copyReadBuffer.glName) : t6.bindBuffer(A.COPY_READ_BUFFER, null), this._state.copyWriteBuffer ? t6.bindBuffer(this._state.copyWriteBuffer.bufferType, this._state.copyWriteBuffer.glName) : t6.bindBuffer(A.COPY_WRITE_BUFFER, null), t6.bindFramebuffer(n2.READ_FRAMEBUFFER, null), t6.readBuffer(t6.BACK), this._state.readFramebuffer && (t6.bindFramebuffer(n2.READ_FRAMEBUFFER, this._state.readFramebuffer.glName), t6.readBuffer(f.COLOR_ATTACHMENT0)), t6.bindFramebuffer(n2.DRAW_FRAMEBUFFER, (_b = (_a = this._state.drawFramebuffer) == null ? void 0 : _a.glName) != null ? _b : null);
  1105. } else
  1106. this._state.readFramebuffer = this._state.drawFramebuffer, t6.bindFramebuffer(n2.FRAMEBUFFER, (_d = (_c = this._state.drawFramebuffer) == null ? void 0 : _c.glName) != null ? _d : null);
  1107. if (e5 && this._state.vertexArrayObject) {
  1108. const t7 = this._state.vertexArrayObject;
  1109. this._state.vertexArrayObject && (this._state.vertexArrayObject.unbind(), this._state.vertexArrayObject = null), this.bindVAO(t7);
  1110. }
  1111. t6.useProgram((_f = (_e = this._state.program) == null ? void 0 : _e.glName) != null ? _f : null), t6.blendColor(this._state.blendColor.r, this._state.blendColor.g, this._state.blendColor.b, this._state.blendColor.a), t6.bindRenderbuffer(t6.RENDERBUFFER, this._state.renderbuffer ? this._state.renderbuffer.glName : null), true === this._state.blend ? t6.enable(this.gl.BLEND) : t6.disable(this.gl.BLEND), t6.blendEquationSeparate(this._state.blendEquation.mode, this._state.blendEquation.modeAlpha), t6.blendFuncSeparate(this._state.blendFunction.srcRGB, this._state.blendFunction.dstRGB, this._state.blendFunction.srcAlpha, this._state.blendFunction.dstAlpha), t6.clearColor(this._state.clearColor.r, this._state.clearColor.g, this._state.clearColor.b, this._state.clearColor.a), t6.clearDepth(this._state.clearDepth), t6.clearStencil(this._state.clearStencil), t6.colorMask(this._state.colorMask.r, this._state.colorMask.g, this._state.colorMask.b, this._state.colorMask.a), t6.cullFace(this._state.cullFace), t6.depthFunc(this._state.depthFunction), t6.depthRange(this._state.depthRange.zNear, this._state.depthRange.zFar), true === this._state.depthTest ? t6.enable(t6.DEPTH_TEST) : t6.disable(t6.DEPTH_TEST), t6.depthMask(this._state.depthWrite), t6.frontFace(this._state.frontFace), t6.lineWidth(1), true === this._state.faceCulling ? t6.enable(t6.CULL_FACE) : t6.disable(t6.CULL_FACE), t6.polygonOffset(this._state.polygonOffset[0], this._state.polygonOffset[1]), true === this._state.polygonOffsetFill ? t6.enable(t6.POLYGON_OFFSET_FILL) : t6.disable(t6.POLYGON_OFFSET_FILL), t6.scissor(this._state.scissorRect.x, this._state.scissorRect.y, this._state.scissorRect.width, this._state.scissorRect.height), true === this._state.scissorTest ? t6.enable(t6.SCISSOR_TEST) : t6.disable(t6.SCISSOR_TEST), t6.stencilFunc(this._state.stencilFunction.func, this._state.stencilFunction.ref, this._state.stencilFunction.mask), t6.stencilOpSeparate(this._state.stencilOperation.face, this._state.stencilOperation.fail, this._state.stencilOperation.zFail, this._state.stencilOperation.zPass), true === this._state.stencilTest ? t6.enable(t6.STENCIL_TEST) : t6.disable(t6.STENCIL_TEST), t6.stencilMask(this._state.stencilWriteMask);
  1112. for (let a3 = 0; a3 < this.parameters.maxTextureImageUnits; a3++) {
  1113. t6.activeTexture(X + a3), t6.bindTexture(M.TEXTURE_2D, null), t6.bindTexture(M.TEXTURE_CUBE_MAP, null), n3(t6) && (t6.bindTexture(M.TEXTURE_3D, null), t6.bindTexture(M.TEXTURE_2D_ARRAY, null));
  1114. const e6 = this._state.textureUnitMap[a3];
  1115. r(e6) && t6.bindTexture(e6.descriptor.target, e6.glName);
  1116. }
  1117. t6.activeTexture(X + this._state.activeTexture);
  1118. const i3 = this._state.viewport;
  1119. t6.viewport(i3.x, i3.y, i3.width, i3.height), this.resetInfo();
  1120. }
  1121. _loadExtensions() {
  1122. this.type === r4.WEBGL1 && this.gl.getExtension("OES_element_index_uint"), this.gl.getExtension("KHR_parallel_shader_compile");
  1123. }
  1124. _loadParameters(t6) {
  1125. var _a;
  1126. const e5 = this.capabilities.textureFilterAnisotropic, s6 = (_a = t6.maxAnisotropy) != null ? _a : 1 / 0, i3 = n3(this.gl), a3 = this.gl, r9 = { versionString: this.gl.getParameter(this.gl.VERSION), maxVertexTextureImageUnits: this.gl.getParameter(this.gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS), maxVertexAttributes: this.gl.getParameter(this.gl.MAX_VERTEX_ATTRIBS), maxMaxAnisotropy: e5 ? Math.min(this.gl.getParameter(e5.MAX_TEXTURE_MAX_ANISOTROPY), s6) : 1, maxTextureImageUnits: this.gl.getParameter(this.gl.MAX_TEXTURE_IMAGE_UNITS), maxTextureSize: this.gl.getParameter(this.gl.MAX_TEXTURE_SIZE), maxUniformBufferBindings: i3 ? a3.getParameter(a3.MAX_UNIFORM_BUFFER_BINDINGS) : 0, maxVertexUniformBlocks: i3 ? a3.getParameter(a3.MAX_VERTEX_UNIFORM_BLOCKS) : 0, maxFragmentUniformBlocks: i3 ? a3.getParameter(a3.MAX_FRAGMENT_UNIFORM_BLOCKS) : 0, maxUniformBlockSize: i3 ? a3.getParameter(a3.MAX_UNIFORM_BLOCK_SIZE) : 0, uniformBufferOffsetAlignment: i3 ? a3.getParameter(a3.UNIFORM_BUFFER_OFFSET_ALIGNMENT) : 1, maxArrayTextureLayers: i3 ? a3.getParameter(a3.MAX_ARRAY_TEXTURE_LAYERS) : 1, maxSamples: i3 ? a3.getParameter(a3.MAX_SAMPLES) : 1 };
  1127. return E2.TEXTURE_UNIT_FOR_UPDATES = r9.maxTextureImageUnits - 1, r9;
  1128. }
  1129. };
  1130. function I2(t6, e5, s6, i3) {
  1131. return e5 ? i3 !== e5 && t6.bindBuffer(s6, e5.glName) : t6.bindBuffer(s6, null), e5;
  1132. }
  1133. function v(t6, e5) {
  1134. switch (t6) {
  1135. case E.POINTS:
  1136. return 2 * e5;
  1137. case E.TRIANGLES:
  1138. return e5 / 3;
  1139. case E.TRIANGLE_STRIP:
  1140. case E.TRIANGLE_FAN:
  1141. return e5 - 2;
  1142. default:
  1143. return 0;
  1144. }
  1145. }
  1146. export {
  1147. o2 as o,
  1148. T3 as T,
  1149. y
  1150. };
  1151. //# sourceMappingURL=chunk-SBZKLPXX.js.map