chunk-JH3PLIM6.js 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486
  1. import {
  2. c as c2
  3. } from "./chunk-QXZVBSBH.js";
  4. import {
  5. H,
  6. t as t2
  7. } from "./chunk-MI7HWWFL.js";
  8. import {
  9. o
  10. } from "./chunk-LGW7TID4.js";
  11. import {
  12. c2 as c,
  13. r,
  14. t
  15. } from "./chunk-GZT4BVFP.js";
  16. // node_modules/@arcgis/core/views/webgl/reservedWordsGLSL3.js
  17. var e = ["layout", "centroid", "smooth", "case", "mat2x2", "mat2x3", "mat2x4", "mat3x2", "mat3x3", "mat3x4", "mat4x2", "mat4x3", "mat4x4", "uint", "uvec2", "uvec3", "uvec4", "samplerCubeShadow", "sampler2DArray", "sampler2DArrayShadow", "isampler2D", "isampler3D", "isamplerCube", "isampler2DArray", "usampler2D", "usampler3D", "usamplerCube", "usampler2DArray", "coherent", "restrict", "readonly", "writeonly", "resource", "atomic_uint", "noperspective", "patch", "sample", "subroutine", "common", "partition", "active", "filter", "image1D", "image2D", "image3D", "imageCube", "iimage1D", "iimage2D", "iimage3D", "iimageCube", "uimage1D", "uimage2D", "uimage3D", "uimageCube", "image1DArray", "image2DArray", "iimage1DArray", "iimage2DArray", "uimage1DArray", "uimage2DArray", "image1DShadow", "image2DShadow", "image1DArrayShadow", "image2DArrayShadow", "imageBuffer", "iimageBuffer", "uimageBuffer", "sampler1DArray", "sampler1DArrayShadow", "isampler1D", "isampler1DArray", "usampler1D", "usampler1DArray", "isampler2DRect", "usampler2DRect", "samplerBuffer", "isamplerBuffer", "usamplerBuffer", "sampler2DMS", "isampler2DMS", "usampler2DMS", "sampler2DMSArray", "isampler2DMSArray", "usampler2DMSArray", "trunc", "round", "roundEven", "isnan", "isinf", "floatBitsToInt", "floatBitsToUint", "intBitsToFloat", "uintBitsToFloat", "packSnorm2x16", "unpackSnorm2x16", "packUnorm2x16", "unpackUnorm2x16", "packHalf2x16", "unpackHalf2x16", "outerProduct", "transpose", "determinant", "inverse", "texture", "textureSize", "textureProj", "textureLod", "textureOffset", "texelFetch", "texelFetchOffset", "textureProjOffset", "textureLodOffset", "textureProjLod", "textureProjLodOffset", "textureGrad", "textureGradOffset", "textureProjGrad", "textureProjGradOffset"];
  18. // node_modules/@arcgis/core/views/webgl/testUtils.js
  19. var e2 = { enableCache: false };
  20. // node_modules/@arcgis/core/views/webgl/ShaderTranspiler.js
  21. var o2;
  22. var n = { exports: {} };
  23. (o2 = ["precision", "highp", "mediump", "lowp", "attribute", "const", "uniform", "varying", "break", "continue", "do", "for", "while", "if", "else", "in", "out", "inout", "float", "int", "void", "bool", "true", "false", "discard", "return", "mat2", "mat3", "mat4", "vec2", "vec3", "vec4", "ivec2", "ivec3", "ivec4", "bvec2", "bvec3", "bvec4", "sampler1D", "sampler2D", "sampler3D", "samplerCube", "sampler1DShadow", "sampler2DShadow", "struct", "asm", "class", "union", "enum", "typedef", "template", "this", "packed", "goto", "switch", "default", "inline", "noinline", "volatile", "public", "static", "extern", "external", "interface", "long", "short", "double", "half", "fixed", "unsigned", "input", "output", "hvec2", "hvec3", "hvec4", "dvec2", "dvec3", "dvec4", "fvec2", "fvec3", "fvec4", "sampler2DRect", "sampler3DRect", "sampler2DRectShadow", "sizeof", "cast", "namespace", "using"]) !== void 0 && (n.exports = o2);
  24. var i = n.exports;
  25. var l;
  26. var s = { exports: {} };
  27. l = s, function(e5) {
  28. var t3 = ["<<=", ">>=", "++", "--", "<<", ">>", "<=", ">=", "==", "!=", "&&", "||", "+=", "-=", "*=", "/=", "%=", "&=", "^^", "^=", "|=", "(", ")", "[", "]", ".", "!", "~", "*", "/", "%", "+", "-", "<", ">", "&", "^", "|", "?", ":", "=", ",", ";", "{", "}"];
  29. t3 !== void 0 && (l.exports = t3);
  30. }();
  31. var c3 = s.exports;
  32. var d = { exports: {} };
  33. !function(e5) {
  34. !function(t3) {
  35. var r2 = function() {
  36. return ["abs", "acos", "all", "any", "asin", "atan", "ceil", "clamp", "cos", "cross", "dFdx", "dFdy", "degrees", "distance", "dot", "equal", "exp", "exp2", "faceforward", "floor", "fract", "gl_BackColor", "gl_BackLightModelProduct", "gl_BackLightProduct", "gl_BackMaterial", "gl_BackSecondaryColor", "gl_ClipPlane", "gl_ClipVertex", "gl_Color", "gl_DepthRange", "gl_DepthRangeParameters", "gl_EyePlaneQ", "gl_EyePlaneR", "gl_EyePlaneS", "gl_EyePlaneT", "gl_Fog", "gl_FogCoord", "gl_FogFragCoord", "gl_FogParameters", "gl_FragColor", "gl_FragCoord", "gl_FragData", "gl_FragDepth", "gl_FragDepthEXT", "gl_FrontColor", "gl_FrontFacing", "gl_FrontLightModelProduct", "gl_FrontLightProduct", "gl_FrontMaterial", "gl_FrontSecondaryColor", "gl_LightModel", "gl_LightModelParameters", "gl_LightModelProducts", "gl_LightProducts", "gl_LightSource", "gl_LightSourceParameters", "gl_MaterialParameters", "gl_MaxClipPlanes", "gl_MaxCombinedTextureImageUnits", "gl_MaxDrawBuffers", "gl_MaxFragmentUniformComponents", "gl_MaxLights", "gl_MaxTextureCoords", "gl_MaxTextureImageUnits", "gl_MaxTextureUnits", "gl_MaxVaryingFloats", "gl_MaxVertexAttribs", "gl_MaxVertexTextureImageUnits", "gl_MaxVertexUniformComponents", "gl_ModelViewMatrix", "gl_ModelViewMatrixInverse", "gl_ModelViewMatrixInverseTranspose", "gl_ModelViewMatrixTranspose", "gl_ModelViewProjectionMatrix", "gl_ModelViewProjectionMatrixInverse", "gl_ModelViewProjectionMatrixInverseTranspose", "gl_ModelViewProjectionMatrixTranspose", "gl_MultiTexCoord0", "gl_MultiTexCoord1", "gl_MultiTexCoord2", "gl_MultiTexCoord3", "gl_MultiTexCoord4", "gl_MultiTexCoord5", "gl_MultiTexCoord6", "gl_MultiTexCoord7", "gl_Normal", "gl_NormalMatrix", "gl_NormalScale", "gl_ObjectPlaneQ", "gl_ObjectPlaneR", "gl_ObjectPlaneS", "gl_ObjectPlaneT", "gl_Point", "gl_PointCoord", "gl_PointParameters", "gl_PointSize", "gl_Position", "gl_ProjectionMatrix", "gl_ProjectionMatrixInverse", "gl_ProjectionMatrixInverseTranspose", "gl_ProjectionMatrixTranspose", "gl_SecondaryColor", "gl_TexCoord", "gl_TextureEnvColor", "gl_TextureMatrix", "gl_TextureMatrixInverse", "gl_TextureMatrixInverseTranspose", "gl_TextureMatrixTranspose", "gl_Vertex", "greaterThan", "greaterThanEqual", "inversesqrt", "length", "lessThan", "lessThanEqual", "log", "log2", "matrixCompMult", "max", "min", "mix", "mod", "normalize", "not", "notEqual", "pow", "radians", "reflect", "refract", "sign", "sin", "smoothstep", "sqrt", "step", "tan", "texture2D", "texture2DLod", "texture2DProj", "texture2DProjLod", "textureCube", "textureCubeLod", "texture2DLodEXT", "texture2DProjLodEXT", "textureCubeLodEXT", "texture2DGradEXT", "texture2DProjGradEXT", "textureCubeGradEXT"];
  37. }();
  38. r2 !== void 0 && (e5.exports = r2);
  39. }();
  40. }(d);
  41. var u = d.exports;
  42. var g = 999;
  43. var p = 9999;
  44. var f = 0;
  45. var _ = 1;
  46. var h = 2;
  47. var x = 3;
  48. var m = 4;
  49. var y = 5;
  50. var w = 6;
  51. var M = 7;
  52. var v = 8;
  53. var T = 9;
  54. var b = 10;
  55. var P = 11;
  56. var E = ["block-comment", "line-comment", "preprocessor", "operator", "integer", "float", "ident", "builtin", "keyword", "whitespace", "eof", "integer"];
  57. function C() {
  58. var e5, t3, r2, a2 = 0, o3 = 0, n2 = g, l3 = [], s2 = [], d2 = 1, C2 = 0, k2 = 0, j2 = false, D2 = false, F2 = "";
  59. return function(e6) {
  60. return s2 = [], e6 !== null ? S2(e6.replace ? e6.replace(/\r\n/g, "\n") : e6) : R2();
  61. };
  62. function L2(e6) {
  63. e6.length && s2.push({ type: E[n2], data: e6, position: k2, line: d2, column: C2 });
  64. }
  65. function S2(t4) {
  66. var i2;
  67. for (a2 = 0, r2 = (F2 += t4).length; e5 = F2[a2], a2 < r2; ) {
  68. switch (i2 = a2, n2) {
  69. case f:
  70. a2 = I2();
  71. break;
  72. case _:
  73. a2 = G2();
  74. break;
  75. case h:
  76. a2 = A2();
  77. break;
  78. case x:
  79. a2 = O2();
  80. break;
  81. case m:
  82. a2 = B();
  83. break;
  84. case P:
  85. a2 = q2();
  86. break;
  87. case y:
  88. a2 = H2();
  89. break;
  90. case p:
  91. a2 = N();
  92. break;
  93. case T:
  94. a2 = X2();
  95. break;
  96. case g:
  97. a2 = V2();
  98. }
  99. if (i2 !== a2)
  100. if (F2[i2] === "\n")
  101. C2 = 0, ++d2;
  102. else
  103. ++C2;
  104. }
  105. return o3 += a2, F2 = F2.slice(a2), s2;
  106. }
  107. function R2(e6) {
  108. return l3.length && L2(l3.join("")), n2 = b, L2("(eof)"), s2;
  109. }
  110. function V2() {
  111. return l3 = l3.length ? [] : l3, t3 === "/" && e5 === "*" ? (k2 = o3 + a2 - 1, n2 = f, t3 = e5, a2 + 1) : t3 === "/" && e5 === "/" ? (k2 = o3 + a2 - 1, n2 = _, t3 = e5, a2 + 1) : e5 === "#" ? (n2 = h, k2 = o3 + a2, a2) : /\s/.test(e5) ? (n2 = T, k2 = o3 + a2, a2) : (j2 = /\d/.test(e5), D2 = /[^\w_]/.test(e5), k2 = o3 + a2, n2 = j2 ? m : D2 ? x : p, a2);
  112. }
  113. function X2() {
  114. return /[^\s]/g.test(e5) ? (L2(l3.join("")), n2 = g, a2) : (l3.push(e5), t3 = e5, a2 + 1);
  115. }
  116. function A2() {
  117. return e5 !== "\r" && e5 !== "\n" || t3 === "\\" ? (l3.push(e5), t3 = e5, a2 + 1) : (L2(l3.join("")), n2 = g, a2);
  118. }
  119. function G2() {
  120. return A2();
  121. }
  122. function I2() {
  123. return e5 === "/" && t3 === "*" ? (l3.push(e5), L2(l3.join("")), n2 = g, a2 + 1) : (l3.push(e5), t3 = e5, a2 + 1);
  124. }
  125. function O2() {
  126. if (t3 === "." && /\d/.test(e5))
  127. return n2 = y, a2;
  128. if (t3 === "/" && e5 === "*")
  129. return n2 = f, a2;
  130. if (t3 === "/" && e5 === "/")
  131. return n2 = _, a2;
  132. if (e5 === "." && l3.length) {
  133. for (; U2(l3); )
  134. ;
  135. return n2 = y, a2;
  136. }
  137. if (e5 === ";" || e5 === ")" || e5 === "(") {
  138. if (l3.length)
  139. for (; U2(l3); )
  140. ;
  141. return L2(e5), n2 = g, a2 + 1;
  142. }
  143. var r3 = l3.length === 2 && e5 !== "=";
  144. if (/[\w_\d\s]/.test(e5) || r3) {
  145. for (; U2(l3); )
  146. ;
  147. return n2 = g, a2;
  148. }
  149. return l3.push(e5), t3 = e5, a2 + 1;
  150. }
  151. function U2(e6) {
  152. for (var t4, r3, a3 = 0; ; ) {
  153. if (t4 = c3.indexOf(e6.slice(0, e6.length + a3).join("")), r3 = c3[t4], t4 === -1) {
  154. if (a3-- + e6.length > 0)
  155. continue;
  156. r3 = e6.slice(0, 1).join("");
  157. }
  158. return L2(r3), k2 += r3.length, (l3 = l3.slice(r3.length)).length;
  159. }
  160. }
  161. function q2() {
  162. return /[^a-fA-F0-9]/.test(e5) ? (L2(l3.join("")), n2 = g, a2) : (l3.push(e5), t3 = e5, a2 + 1);
  163. }
  164. function B() {
  165. return e5 === "." || /[eE]/.test(e5) ? (l3.push(e5), n2 = y, t3 = e5, a2 + 1) : e5 === "x" && l3.length === 1 && l3[0] === "0" ? (n2 = P, l3.push(e5), t3 = e5, a2 + 1) : /[^\d]/.test(e5) ? (L2(l3.join("")), n2 = g, a2) : (l3.push(e5), t3 = e5, a2 + 1);
  166. }
  167. function H2() {
  168. return e5 === "f" && (l3.push(e5), t3 = e5, a2 += 1), /[eE]/.test(e5) || e5 === "-" && /[eE]/.test(t3) ? (l3.push(e5), t3 = e5, a2 + 1) : /[^\d]/.test(e5) ? (L2(l3.join("")), n2 = g, a2) : (l3.push(e5), t3 = e5, a2 + 1);
  169. }
  170. function N() {
  171. if (/[^\d\w_]/.test(e5)) {
  172. var r3 = l3.join("");
  173. return n2 = i.indexOf(r3) > -1 ? v : u.indexOf(r3) > -1 ? M : w, L2(l3.join("")), n2 = g, a2;
  174. }
  175. return l3.push(e5), t3 = e5, a2 + 1;
  176. }
  177. }
  178. function k(e5) {
  179. var t3 = C(), r2 = [];
  180. return r2 = (r2 = r2.concat(t3(e5))).concat(t3(null));
  181. }
  182. function j(e5) {
  183. return k(e5);
  184. }
  185. function D(e5) {
  186. return e5.map((e6) => e6.type !== "eof" ? e6.data : "").join("");
  187. }
  188. var F = ["GL_OES_standard_derivatives", "GL_EXT_frag_depth", "GL_EXT_draw_buffers", "GL_EXT_shader_texture_lod"];
  189. function L(e5, t3 = "100", r2 = "300 es") {
  190. const a2 = /^\s*\#version\s+([0-9]+(\s+[a-zA-Z]+)?)\s*/;
  191. for (const o3 of e5)
  192. if (o3.type === "preprocessor") {
  193. const e6 = a2.exec(o3.data);
  194. if (e6) {
  195. const a3 = e6[1].replace(/\s\s+/g, " ");
  196. if (a3 === r2)
  197. return a3;
  198. if (a3 === t3)
  199. return o3.data = "#version " + r2, t3;
  200. throw new Error("unknown glsl version: " + a3);
  201. }
  202. }
  203. return e5.splice(0, 0, { type: "preprocessor", data: "#version " + r2 }, { type: "whitespace", data: "\n" }), null;
  204. }
  205. function S(e5, t3) {
  206. for (let r2 = t3 - 1; r2 >= 0; r2--) {
  207. const t4 = e5[r2];
  208. if (t4.type !== "whitespace" && t4.type !== "block-comment") {
  209. if (t4.type !== "keyword")
  210. break;
  211. if (t4.data === "attribute" || t4.data === "in")
  212. return true;
  213. }
  214. }
  215. return false;
  216. }
  217. function R(e5, t3, r2, a2) {
  218. a2 = a2 || r2;
  219. for (const o3 of e5)
  220. if (o3.type === "ident" && o3.data === r2) {
  221. a2 in t3 ? t3[a2]++ : t3[a2] = 0;
  222. return R(e5, t3, a2 + "_" + t3[a2], a2);
  223. }
  224. return r2;
  225. }
  226. function V(e5, t3, r2 = "afterVersion") {
  227. function a2(e6, t4) {
  228. for (let r3 = t4; r3 < e6.length; r3++) {
  229. const t5 = e6[r3];
  230. if (t5.type === "operator" && t5.data === ";")
  231. return r3;
  232. }
  233. return null;
  234. }
  235. function o3(e6) {
  236. let t4 = -1, o4 = 0, n3 = -1;
  237. for (let i3 = 0; i3 < e6.length; i3++) {
  238. const l4 = e6[i3];
  239. if (l4.type === "preprocessor" && (l4.data.match(/\#(if|ifdef|ifndef)\s+.+/) ? ++o4 : l4.data.match(/\#endif\s*.*/) && --o4), r2 !== "afterVersion" && r2 !== "afterPrecision" || l4.type === "preprocessor" && /^#version/.test(l4.data) && (n3 = Math.max(n3, i3)), r2 === "afterPrecision" && l4.type === "keyword" && l4.data === "precision") {
  240. const t5 = a2(e6, i3);
  241. if (t5 === null)
  242. throw new Error("precision statement not followed by any semicolons!");
  243. n3 = Math.max(n3, t5);
  244. }
  245. t4 < n3 && o4 === 0 && (t4 = i3);
  246. }
  247. return t4 + 1;
  248. }
  249. const n2 = { data: "\n", type: "whitespace" }, i2 = (t4) => t4 < e5.length && /[^\r\n]$/.test(e5[t4].data);
  250. let l3 = o3(e5);
  251. i2(l3 - 1) && e5.splice(l3++, 0, n2);
  252. for (const s2 of t3)
  253. e5.splice(l3++, 0, s2);
  254. i2(l3 - 1) && i2(l3) && e5.splice(l3, 0, n2);
  255. }
  256. function X(e5, t3, r2, a2 = "lowp") {
  257. V(e5, [{ type: "keyword", data: "out" }, { type: "whitespace", data: " " }, { type: "keyword", data: a2 }, { type: "whitespace", data: " " }, { type: "keyword", data: r2 }, { type: "whitespace", data: " " }, { type: "ident", data: t3 }, { type: "operator", data: ";" }], "afterPrecision");
  258. }
  259. function A(e5, t3, r2, a2, o3 = "lowp") {
  260. V(e5, [{ type: "keyword", data: "layout" }, { type: "operator", data: "(" }, { type: "keyword", data: "location" }, { type: "whitespace", data: " " }, { type: "operator", data: "=" }, { type: "whitespace", data: " " }, { type: "integer", data: a2.toString() }, { type: "operator", data: ")" }, { type: "whitespace", data: " " }, { type: "keyword", data: "out" }, { type: "whitespace", data: " " }, { type: "keyword", data: o3 }, { type: "whitespace", data: " " }, { type: "keyword", data: r2 }, { type: "whitespace", data: " " }, { type: "ident", data: t3 }, { type: "operator", data: ";" }], "afterPrecision");
  261. }
  262. function G(e5, t3) {
  263. let r2, a2, o3 = -1;
  264. for (let n2 = t3; n2 < e5.length; n2++) {
  265. const t4 = e5[n2];
  266. if (t4.type === "operator" && (t4.data === "[" && (r2 = n2), t4.data === "]")) {
  267. a2 = n2;
  268. break;
  269. }
  270. t4.type === "integer" && (o3 = parseInt(t4.data, 10));
  271. }
  272. return r2 && a2 && e5.splice(r2, a2 - r2 + 1), o3;
  273. }
  274. function I(a2, o3) {
  275. const n2 = U(a2);
  276. if (r(n2))
  277. return n2;
  278. const i2 = j(a2);
  279. if (L(i2, "100", "300 es") === "300 es")
  280. return a2;
  281. let l3 = null, s2 = null;
  282. const c5 = {}, d2 = {};
  283. for (let e5 = 0; e5 < i2.length; ++e5) {
  284. const a3 = i2[e5];
  285. switch (a3.type) {
  286. case "keyword":
  287. o3 === H.VERTEX_SHADER && a3.data === "attribute" ? a3.data = "in" : a3.data === "varying" && (a3.data = o3 === H.VERTEX_SHADER ? "out" : "in");
  288. break;
  289. case "builtin":
  290. if (/^texture(2D|Cube)(Proj)?(Lod|Grad)?(EXT)?$/.test(a3.data.trim()) && (a3.data = a3.data.replace(/(2D|Cube|EXT)/g, "")), o3 === H.FRAGMENT_SHADER && a3.data === "gl_FragColor" && (l3 || (l3 = R(i2, c5, "fragColor"), X(i2, l3, "vec4")), a3.data = l3), o3 === H.FRAGMENT_SHADER && a3.data === "gl_FragData") {
  291. const t3 = G(i2, e5 + 1), r2 = R(i2, c5, "fragData");
  292. A(i2, r2, "vec4", t3, "mediump"), a3.data = r2;
  293. } else
  294. o3 === H.FRAGMENT_SHADER && a3.data === "gl_FragDepthEXT" && (s2 || (s2 = R(i2, c5, "gl_FragDepth")), a3.data = s2);
  295. break;
  296. case "ident":
  297. if (e.includes(a3.data)) {
  298. if (o3 === H.VERTEX_SHADER && S(i2, e5))
  299. throw new Error("attribute in vertex shader uses a name that is a reserved word in glsl 300 es");
  300. a3.data in d2 || (d2[a3.data] = R(i2, c5, a3.data)), a3.data = d2[a3.data];
  301. }
  302. }
  303. }
  304. for (let e5 = i2.length - 1; e5 >= 0; --e5) {
  305. const t3 = i2[e5];
  306. if (t3.type === "preprocessor") {
  307. const r2 = t3.data.match(/\#extension\s+(.*)\:/);
  308. if (r2 && r2[1] && F.includes(r2[1].trim())) {
  309. const t4 = i2[e5 + 1];
  310. i2.splice(e5, t4 && t4.type === "whitespace" ? 2 : 1);
  311. }
  312. const a3 = t3.data.match(/\#ifdef\s+(.*)/);
  313. a3 && a3[1] && F.includes(a3[1].trim()) && (t3.data = "#if 1");
  314. const o4 = t3.data.match(/\#ifndef\s+(.*)/);
  315. o4 && o4[1] && F.includes(o4[1].trim()) && (t3.data = "#if 0");
  316. }
  317. }
  318. return q(a2, D(i2));
  319. }
  320. var O = new Map();
  321. function U(e5) {
  322. return e2.enableCache ? O.get(e5) : null;
  323. }
  324. function q(e5, t3) {
  325. return e2.enableCache && O.set(e5, t3), t3;
  326. }
  327. // node_modules/@arcgis/core/views/webgl/Program.js
  328. var a = 4294967295;
  329. var h2 = class {
  330. constructor(t3, o3, i2, a2, h3 = new Map()) {
  331. this._context = t3, this._locations = a2, this._uniformBlockBindings = h3, this._refCount = 1, this._compiled = false, this._nameToUniformLocation = {}, this._nameToUniform1 = {}, this._nameToUniform1v = new Map(), this._nameToUniform2 = new Map(), this._nameToUniform3 = new Map(), this._nameToUniform4 = new Map(), this._nameToUniformMatrix3 = new Map(), this._nameToUniformMatrix4 = new Map(), t3 || console.error("RenderingContext isn't initialized!"), o3.length === 0 && console.error("Shaders source should not be empty!"), this._context.type === o.WEBGL2 && (o3 = I(o3, H.VERTEX_SHADER), i2 = I(i2, H.FRAGMENT_SHADER)), this._vShader = f2(this._context, H.VERTEX_SHADER, o3), this._fShader = f2(this._context, H.FRAGMENT_SHADER, i2), this._vShader && this._fShader || console.error("Error loading shaders!"), this._context.instanceCounter.increment(t2.Shader, this), c2() && (this.vertexShader = o3, this.fragmentShader = i2);
  332. }
  333. get glName() {
  334. if (r(this._glName))
  335. return this._glName;
  336. if (t(this._vShader))
  337. return null;
  338. const t3 = this._context.gl, r2 = t3.createProgram();
  339. if (t3.attachShader(r2, this._vShader), t3.attachShader(r2, this._fShader), this._locations.forEach((o3, i2) => t3.bindAttribLocation(r2, o3, i2)), t3.linkProgram(r2), c2() && !t3.getProgramParameter(r2, t3.LINK_STATUS) && console.error(`Could not link shader
  340. validated: ${t3.getProgramParameter(r2, t3.VALIDATE_STATUS)}, gl error ${t3.getError()}, vertex: ${t3.getShaderParameter(this._vShader, t3.COMPILE_STATUS)}, fragment: ${t3.getShaderParameter(this._fShader, t3.COMPILE_STATUS)}, info log: ${t3.getProgramInfoLog(r2)}, vertex source: ${this.vertexShader}, fragment source: ${this.fragmentShader}`), this._context.type === o.WEBGL2) {
  341. const o3 = t3;
  342. for (const [t4, i2] of this._uniformBlockBindings) {
  343. const e5 = o3.getUniformBlockIndex(r2, t4);
  344. e5 < a && o3.uniformBlockBinding(r2, e5, i2);
  345. }
  346. }
  347. return this._glName = r2, this._context.instanceCounter.increment(t2.Program, this), r2;
  348. }
  349. get hasGLName() {
  350. return r(this._glName);
  351. }
  352. get isCompiled() {
  353. if (this._compiled)
  354. return true;
  355. const t3 = this._context.gl.getExtension("KHR_parallel_shader_compile");
  356. return t3 == null ? (this._compiled = true, true) : (this._compiled = !!this._context.gl.getProgramParameter(this.glName, t3.COMPLETION_STATUS_KHR), this._compiled);
  357. }
  358. dispose() {
  359. if (--this._refCount > 0)
  360. return;
  361. const t3 = this._context.gl;
  362. this._vShader && (t3.deleteShader(this._vShader), this._vShader = null, this._context.instanceCounter.decrement(t2.Shader, this)), this._fShader && (t3.deleteShader(this._fShader), this._fShader = null), this._glName && (t3.deleteProgram(this._glName), this._glName = null, this._context.instanceCounter.decrement(t2.Program, this));
  363. }
  364. ref() {
  365. ++this._refCount;
  366. }
  367. _getUniformLocation(t3) {
  368. return this._nameToUniformLocation[t3] === void 0 && (++l2.numUniforms, this._nameToUniformLocation[t3] = this._context.gl.getUniformLocation(this.glName, t3)), this._nameToUniformLocation[t3];
  369. }
  370. hasUniform(t3) {
  371. return this._getUniformLocation(t3) !== null;
  372. }
  373. setUniform1i(t3, o3) {
  374. const i2 = this._nameToUniform1[t3];
  375. i2 !== void 0 && o3 === i2 || (this._context.gl.uniform1i(this._getUniformLocation(t3), o3), this._nameToUniform1[t3] = o3);
  376. }
  377. setUniform1iv(t3, o3) {
  378. g2(this._nameToUniform1v, t3, o3) && this._context.gl.uniform1iv(this._getUniformLocation(t3), o3);
  379. }
  380. setUniform2iv(t3, o3) {
  381. g2(this._nameToUniform2, t3, o3) && this._context.gl.uniform2iv(this._getUniformLocation(t3), o3);
  382. }
  383. setUniform3iv(t3, o3) {
  384. g2(this._nameToUniform3, t3, o3) && this._context.gl.uniform3iv(this._getUniformLocation(t3), o3);
  385. }
  386. setUniform4iv(t3, o3) {
  387. g2(this._nameToUniform4, t3, o3) && this._context.gl.uniform4iv(this._getUniformLocation(t3), o3);
  388. }
  389. setUniform1f(t3, o3) {
  390. const i2 = this._nameToUniform1[t3];
  391. i2 !== void 0 && o3 === i2 || (this._context.gl.uniform1f(this._getUniformLocation(t3), o3), this._nameToUniform1[t3] = o3);
  392. }
  393. setUniform1fv(t3, o3) {
  394. g2(this._nameToUniform1v, t3, o3) && this._context.gl.uniform1fv(this._getUniformLocation(t3), o3);
  395. }
  396. setUniform2f(t3, o3, i2) {
  397. const e5 = this._nameToUniform2.get(t3);
  398. e5 === void 0 ? (this._context.gl.uniform2f(this._getUniformLocation(t3), o3, i2), this._nameToUniform2.set(t3, [o3, i2])) : o3 === e5[0] && i2 === e5[1] || (this._context.gl.uniform2f(this._getUniformLocation(t3), o3, i2), e5[0] = o3, e5[1] = i2);
  399. }
  400. setUniform2fv(t3, o3) {
  401. g2(this._nameToUniform2, t3, o3) && this._context.gl.uniform2fv(this._getUniformLocation(t3), o3);
  402. }
  403. setUniform3f(t3, o3, i2, e5) {
  404. const n2 = this._nameToUniform3.get(t3);
  405. n2 === void 0 ? (this._context.gl.uniform3f(this._getUniformLocation(t3), o3, i2, e5), this._nameToUniform3[t3] = [o3, i2, e5]) : o3 === n2[0] && i2 === n2[1] && e5 === n2[2] || (this._context.gl.uniform3f(this._getUniformLocation(t3), o3, i2, e5), n2[0] = o3, n2[1] = i2, n2[2] = e5);
  406. }
  407. setUniform3fv(t3, o3) {
  408. g2(this._nameToUniform3, t3, o3) && this._context.gl.uniform3fv(this._getUniformLocation(t3), o3);
  409. }
  410. setUniform4f(t3, o3, i2, e5, n2) {
  411. const r2 = this._nameToUniform4.get(t3);
  412. r2 === void 0 ? (this._context.gl.uniform4f(this._getUniformLocation(t3), o3, i2, e5, n2), this._nameToUniform4.set(t3, [o3, i2, e5, n2])) : r2 !== void 0 && o3 === r2[0] && i2 === r2[1] && e5 === r2[2] && n2 === r2[3] || (this._context.gl.uniform4f(this._getUniformLocation(t3), o3, i2, e5, n2), r2[0] = o3, r2[1] = i2, r2[2] = e5, r2[3] = n2);
  413. }
  414. setUniform4fv(t3, o3) {
  415. g2(this._nameToUniform4, t3, o3) && this._context.gl.uniform4fv(this._getUniformLocation(t3), o3);
  416. }
  417. setUniformMatrix3fv(t3, o3, i2 = false) {
  418. g2(this._nameToUniformMatrix3, t3, o3) && this._context.gl.uniformMatrix3fv(this._getUniformLocation(t3), i2, o3);
  419. }
  420. setUniformMatrix4fv(t3, o3, i2 = false) {
  421. g2(this._nameToUniformMatrix4, t3, o3) && this._context.gl.uniformMatrix4fv(this._getUniformLocation(t3), i2, o3);
  422. }
  423. stop() {
  424. }
  425. };
  426. function f2(t3, o3, i2) {
  427. const n2 = t3.gl, s2 = n2.createShader(o3);
  428. return n2.shaderSource(s2, i2), n2.compileShader(s2), c2() && !n2.getShaderParameter(s2, n2.COMPILE_STATUS) && (console.error("Compile error in ".concat(o3 === H.VERTEX_SHADER ? "vertex" : "fragment", " shader")), console.error(n2.getShaderInfoLog(s2)), console.error(_2(i2))), l2.enabled && (l2.compiledLOC += i2.match(/\n/g).length + 1), s2;
  429. }
  430. function _2(t3) {
  431. let o3 = 2;
  432. return t3.replace(/\n/g, () => "\n" + c4(o3++) + ":");
  433. }
  434. function c4(t3) {
  435. return t3 >= 1e3 ? t3.toString() : (" " + t3).slice(-3);
  436. }
  437. function g2(o3, i2, e5) {
  438. const n2 = o3.get(i2);
  439. return n2 ? c(n2, e5) : (o3.set(i2, Array.from(e5)), true);
  440. }
  441. var l2 = { compiledLOC: 0, numUniforms: 0, enabled: false };
  442. // node_modules/@arcgis/core/views/webgl/ShaderCompiler.js
  443. var e3 = class {
  444. constructor(e5) {
  445. this.readFile = e5;
  446. }
  447. resolveIncludes(e5) {
  448. return this._resolve(e5);
  449. }
  450. _resolve(e5, t3 = new Map()) {
  451. if (t3.has(e5))
  452. return t3.get(e5);
  453. const r2 = this._read(e5);
  454. if (!r2)
  455. throw new Error(`cannot find shader file ${e5}`);
  456. const s2 = /^[^\S\n]*#include\s+<(\S+)>[^\S\n]?/gm;
  457. let n2 = s2.exec(r2);
  458. const l3 = [];
  459. for (; n2 != null; )
  460. l3.push({ path: n2[1], start: n2.index, length: n2[0].length }), n2 = s2.exec(r2);
  461. let a2 = 0, h3 = "";
  462. return l3.forEach((e6) => {
  463. h3 += r2.slice(a2, e6.start), h3 += t3.has(e6.path) ? "" : this._resolve(e6.path, t3), a2 = e6.start + e6.length;
  464. }), h3 += r2.slice(a2), t3.set(e5, h3), h3;
  465. }
  466. _read(e5) {
  467. return this.readFile(e5);
  468. }
  469. };
  470. // node_modules/@arcgis/core/views/webgl/ProgramTemplate.js
  471. function e4(e5, t3, a2 = "") {
  472. return new h2(e5, a2 + t3.shaders.vertexShader, a2 + t3.shaders.fragmentShader, t3.attributes);
  473. }
  474. export {
  475. h2 as h,
  476. e3 as e,
  477. e4 as e2
  478. };
  479. //# sourceMappingURL=chunk-JH3PLIM6.js.map