@galacean/engine-shader-compiler 2.0.0-alpha.53 → 2.0.0-alpha.54
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.js +1 -1
- package/dist/browser.min.js +1 -1
- package/dist/main.js +1 -1
- package/dist/module.js +1 -1
- package/package.json +5 -5
package/dist/browser.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@galacean/engine-core"),require("@galacean/engine-math")):"function"==typeof define&&define.amd?define(["exports","@galacean/engine-core","@galacean/engine-math"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).Galacean=e.Galacean||{},e.Galacean.ShaderCompiler={}),e.Galacean,e.Galacean)}(this,function(e,t,r){"use strict";function n(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function i(){return(i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function o(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return a(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return a(e,void 0)}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,c,u,l,h,d,p,f,_,v,m,g,y={"||":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"<":7,"<=":7,">":7,">=":7,"<<":8,">>":8,"+":9,"-":9,"*":10,"/":10,"%":10};function S(e){return new T(e).parse()}function b(e,t){for(var r=O(e),n=[],i=0;i<r.length-1;i++){var a=r[i];if("identifier"!==a.kind||"defined"!==a.text){n.push(a.text);continue}var o=r[i+1],s=(null==o?void 0:o.text)==="(",c=r[i+(s?2:1)],u=s?r[i+3]:c;if((null==c?void 0:c.kind)!=="identifier"||"defined"===c.text||s&&(null==u?void 0:u.text)!==")"){n.push(a.text);continue}var l=t(c.text);void 0===l?(n.push("defined"),s&&n.push("("),n.push(c.text),s&&n.push(")")):n.push(l?"1":"0"),i+=s?3:1}return n.join(" ")}function x(e){var t=R(e);return"number"==typeof t?t:void 0}var E="Division by zero in active preprocessor expression.",C="Modulo by zero in active preprocessor expression.",A="Shift count must be between 0 and 31 in active preprocessor expression.",T=/*#__PURE__*/function(){function e(e){this._index=0,this._sawExpandableIdentifier=!1,this._rightEdgeExpandable=!1,this._nestingDepth=0,this._tokens=O(e)}var t=e.prototype;return t.parse=function(){var e=this._parseRoot(),t=this._invalidResult();if(t)return t;var r=this._sawExpandableIdentifier?void 0:R(e);return i({ok:!0,condition:e,hasExpandableIdentifier:this._sawExpandableIdentifier},"string"==typeof r?{evaluationError:r}:void 0)},t._parseRoot=function(){var e=this._parseBinary(1);if(!this._failure){var t=this._current();if("end"!==t.kind){var r="identifier"===t.kind&&"defined"!==t.text;this._sawExpandableIdentifier||(this._sawExpandableIdentifier=r);var n="?"===t.text||":"===t.text||!this._rightEdgeExpandable&&!r&&!(")"===t.text&&this._sawExpandableIdentifier);this._fail("Unexpected token '"+t.text+"' in preprocessor expression.",t,n)}}return e},t._invalidResult=function(){if(this._failure)for(var e=this._index;e<this._tokens.length;e++){var t=this._tokens[e];if("identifier"===t.kind&&"defined"!==t.text){this._sawExpandableIdentifier=!0;break}}return this._failure?{ok:!1,error:this._failure,hasExpandableIdentifier:this._sawExpandableIdentifier}:void 0},t._parseBinary=function(e){var t=this._parseUnary();if(!this._failure&&t)for(;;){var r=this._current(),n=y[r.text];if(void 0===n||n<e)return t;this._index++;var i=this._parseBinary(n+1);if(this._failure||!i)return;t="&&"===r.text?{t:"and",l:t,r:i}:"||"===r.text?{t:"or",l:t,r:i}:{t:"binary",op:r.text,l:t,r:i}}},t._parseUnary=function(){var e=this._current();if("operator"===e.kind&&("+"===e.text||"-"===e.text||"!"===e.text||"~"===e.text)){if(!this._enterNesting(e))return;this._index++;var t=this._parseUnary();if(this._nestingDepth--,!t)return;return"!"===e.text?{t:"not",c:t}:{t:"unary",op:e.text,c:t}}return this._parsePrimary()},t._parsePrimary=function(){var e=this._current();if("number"===e.kind){this._index++,this._rightEdgeExpandable=!1;var t=function(e){for(var t,r=e.length;r>0&&N(e.charCodeAt(r-1));)r--;if(48===e.charCodeAt(0)){var n=e.charCodeAt(1);t=88===n||120===n?parseInt(e.slice(2,r),16):r>1?parseInt(e.slice(0,r),8):0}else t=Number(e.slice(0,r));return t<=0xffffffff?0|t:void 0}(e.text);if(void 0===t){this._fail("Integer literal exceeds 32 bits in preprocessor expression.",e,!0);return}return{t:"num",v:t}}if("identifier"===e.kind)return"defined"===e.text?this._parseDefined():(this._sawExpandableIdentifier=!0,this._rightEdgeExpandable=!0,this._index++,{t:"id",m:e.text});if(this._consume("(")){if(!this._enterNesting(e))return;var r=this._parseBinary(1);return this._failure||this._consume(")")||this._fail("Expected ')' in preprocessor expression.",this._current(),!1),this._failure||(this._rightEdgeExpandable=!1),this._nestingDepth--,r}"end"===e.kind?this._fail("Expected an operand before the end of the preprocessor expression.",e,!0):this._fail("Expected an operand, found '"+e.text+"'.",e,!0)},t._parseDefined=function(){this._index++,this._rightEdgeExpandable=!1;var e=this._consume("("),t=this._current();if("identifier"!==t.kind||"defined"===t.text){this._fail("Expected a macro name after 'defined'.",t,!0);return}if(this._index++,e&&!this._consume(")")){this._fail("Expected ')' after the macro name in 'defined(...)'.",this._current(),!0);return}return{t:"def",m:t.text}},t._consume=function(e){return this._current().text===e&&(this._index++,!0)},t._enterNesting=function(e){return this._nestingDepth>=256?(this._fail("Preprocessor expression nesting exceeds the supported depth of 256.",e,!0),!1):(this._nestingDepth++,!0)},t._current=function(){return this._tokens[this._index]},t._fail=function(e,t,r){null!=this._failure||(this._failure={message:e,start:t.start,end:Math.max(t.end,t.start+1),certain:r})},e}();function O(e){for(var t=[],r=0;r<e.length;){var n,i=e.charCodeAt(r);if(32===i||i>=9&&i<=13){r++;continue}if(47===i&&47===e.charCodeAt(r+1))break;if(47===i&&42===e.charCodeAt(r+1)){var a=e.indexOf("*/",r+2);a<0?(t.push({kind:"invalid",text:e.slice(r),start:r,end:e.length}),r=e.length):r=a+2;continue}if(D(i)){for(var o=r++;r<e.length&&L(e.charCodeAt(r));)r++;t.push({kind:"identifier",text:e.slice(o,r),start:o,end:r});continue}if(i>=48&&i<=57){var s,c=r;if(48===i&&(88===e.charCodeAt(r+1)||120===e.charCodeAt(r+1))){for(var u,l=r+=2;r<e.length&&((u=e.charCodeAt(r))>=48&&u<=57||u>=65&&u<=70||u>=97&&u<=102);)r++;if(r===l){t.push({kind:"invalid",text:e.slice(c,r),start:c,end:r});continue}}else if(48===i)for(r++;r<e.length&&e.charCodeAt(r)>=48&&55>=e.charCodeAt(r);)r++;else for(r++;r<e.length&&e.charCodeAt(r)>=48&&57>=e.charCodeAt(r);)r++;for(var h=r;N(e.charCodeAt(r));)r++;if(!(""===(s=e.slice(h,r))||"u"===s||"U"===s)||D(e.charCodeAt(r))){for(;L(e.charCodeAt(r));)r++;t.push({kind:"invalid",text:e.slice(c,r),start:c,end:r});continue}t.push({kind:"number",text:e.slice(c,r),start:c,end:r});continue}if(n=e.charCodeAt(r+1),124===i&&124===n||38===i&&38===n||(33===i||61===i)&&61===n||(60===i||62===i)&&(61===n||n===i)){t.push({kind:"operator",text:e.slice(r,r+2),start:r,end:r+2}),r+=2;continue}if(33===i||37===i||38===i||40===i||41===i||42===i||43===i||45===i||47===i||58===i||60===i||62===i||63===i||94===i||124===i||126===i){t.push({kind:"operator",text:e[r],start:r,end:r+1}),r++;continue}t.push({kind:"invalid",text:e[r],start:r,end:r+1}),r++}return t.push({kind:"end",text:"",start:r,end:r}),t}function I(e,t,r){switch(t){case"||":return 0!==e||0!==r?1:0;case"&&":return 0!==e&&0!==r?1:0;case"|":return e|r;case"^":return e^r;case"&":return e&r;case"==":return e===r?1:0;case"!=":return e!==r?1:0;case"<":return e<r?1:0;case"<=":return e<=r?1:0;case">":return e>r?1:0;case">=":return e>=r?1:0;case"<<":if(r<0||r>31)return A;return e<<r;case">>":if(r<0||r>31)return A;return e>>>r|0;case"+":return e+r|0;case"-":return e-r|0;case"*":return Math.imul(e,r);case"/":if(0===r)return E;if(-0x80000000===e&&-1===r)return 0x7fffffff;return 0|Math.trunc(e/r);case"%":if(0===r)return C;return e%r|0;default:throw Error("Unsupported preprocessor operator '"+t+"'.")}}function R(e,t){switch(e.t){case"and":var r=R(e.l,t);if("string"==typeof r)return r;if(0===r)return 0;var n=R(e.r,t);if("string"==typeof n)return void 0===r?void 0:n;if(0===n)return 0;return void 0===r||void 0===n?void 0:1;case"or":var i=R(e.l,t);if("string"==typeof i)return i;if(void 0!==i&&0!==i)return 1;var a=R(e.r,t);if("string"==typeof a)return void 0===i?void 0:a;if(void 0!==a&&0!==a)return 1;return void 0===i||void 0===a?void 0:0;case"binary":var o,s=R(e.l,t),c=R(e.r,t);if("string"==typeof s)return s;if("string"==typeof c)return c;var u=("/"===(o=e.op)||"%"===o)&&0===c?"/"===o?E:C:("<<"===o||">>"===o)&&void 0!==c&&(c<0||c>31)?A:void 0;if(u)return u;if(void 0===s||void 0===c)return t?function(e,t,r){if(P(e.op)){if("id"===e.l.t&&void 0===t&&void 0!==r)return M(e.op,r);if("id"===e.r.t&&void 0===r&&void 0!==t)return M(function(e){switch(e){case"<":return">";case"<=":return">=";case">":return"<";case">=":return"<=";default:return e}}(e.op),t)}}(e,s,c):void 0;return I(s,e.op,c);case"not":var l=R(e.c,t);if("string"==typeof l)return l;return void 0===l?void 0:0===l?1:0;case"unary":var h=R(e.c,t);if("string"==typeof h)return h;if(void 0===h)return;return"+"===e.op?0|h:"-"===e.op?0|-h:~h;case"bool":return e.v?1:0;case"num":return e.v;case"def":var d=null==t?void 0:t.isDefined(e.m);return void 0===d?void 0:d?1:0;case"ndef":var p=null==t?void 0:t.isDefined(e.m);return void 0===p?void 0:p?0:1;case"cmp":var f=null==t?void 0:t.resolveIdentifier(e.m);if(null==f?void 0:f.error)return f.error;var _=null==f?void 0:f.value;if(void 0===_)return t?M(e.op,e.v):void 0;var v=I(_,e.op,e.v);return"string"==typeof v?void 0:v;case"id":var m=null==t?void 0:t.resolveIdentifier(e.m);return(null==m?void 0:m.error)?m.error:null==m?void 0:m.value;case"deferred":return}}function M(e,t){if(P(e)&&"=="!==e&&"!="!==e){var r=I(-0x80000000,e,t),n=I(0x7fffffff,e,t);return"number"==typeof r&&r===n?r:void 0}}function P(e){return"=="===e||"!="===e||"<"===e||"<="===e||">"===e||">="===e}function D(e){return e>=65&&e<=90||e>=97&&e<=122||95===e}function L(e){return D(e)||e>=48&&e<=57}function N(e){return 85===e||117===e}var k="shaders://root/",V=/^[A-Za-z][A-Za-z\d+.-]*:/;function F(e){var t=e.trim().replace(/\\/g,"/");if(!t)throw Error("Shader include key cannot be empty.");if(t.startsWith(k)){var r=new URL(t).href.slice(k.length);if(!r)throw Error("Shader include key cannot be the virtual shader root.");return r}return V.test(t)?new URL(t).href:new URL(t.replace(/^\/+/,""),k).href.slice(k.length)}var w=function(){function e(){}return e.prototype.set=function(e,t){this.start=e,this.end=t},e}(),G=function(){function e(){}return e.prototype.set=function(e,t,r){this.index=e,this.line=t,this.column=r},e}(),B=((s={})[s.ID=1e3]="ID",s[s.FLOAT_CONSTANT=1001]="FLOAT_CONSTANT",s[s.INT_CONSTANT=1002]="INT_CONSTANT",s[s.STRING_CONST=1003]="STRING_CONST",s[s.LEFT_OP=1004]="LEFT_OP",s[s.RIGHT_OP=1005]="RIGHT_OP",s[s.INC_OP=1006]="INC_OP",s[s.DEC_OP=1007]="DEC_OP",s[s.LE_OP=1008]="LE_OP",s[s.GE_OP=1009]="GE_OP",s[s.EQ_OP=1010]="EQ_OP",s[s.NE_OP=1011]="NE_OP",s[s.AND_OP=1012]="AND_OP",s[s.OR_OP=1013]="OR_OP",s[s.XOR_OP=1014]="XOR_OP",s[s.MUL_ASSIGN=1015]="MUL_ASSIGN",s[s.DIV_ASSIGN=1016]="DIV_ASSIGN",s[s.ADD_ASSIGN=1017]="ADD_ASSIGN",s[s.SUB_ASSIGN=1018]="SUB_ASSIGN",s[s.MOD_ASSIGN=1019]="MOD_ASSIGN",s[s.LEFT_ASSIGN=1020]="LEFT_ASSIGN",s[s.RIGHT_ASSIGN=1021]="RIGHT_ASSIGN",s[s.AND_ASSIGN=1022]="AND_ASSIGN",s[s.XOR_ASSIGN=1023]="XOR_ASSIGN",s[s.OR_ASSIGN=1024]="OR_ASSIGN",s[s.LEFT_PAREN=1025]="LEFT_PAREN",s[s.RIGHT_PAREN=1026]="RIGHT_PAREN",s[s.LEFT_BRACKET=1027]="LEFT_BRACKET",s[s.RIGHT_BRACKET=1028]="RIGHT_BRACKET",s[s.LEFT_BRACE=1029]="LEFT_BRACE",s[s.RIGHT_BRACE=1030]="RIGHT_BRACE",s[s.DOT=1031]="DOT",s[s.COMMA=1032]="COMMA",s[s.COLON=1033]="COLON",s[s.EQUAL=1034]="EQUAL",s[s.SEMICOLON=1035]="SEMICOLON",s[s.BANG=1036]="BANG",s[s.DASH=1037]="DASH",s[s.TILDE=1038]="TILDE",s[s.PLUS=1039]="PLUS",s[s.STAR=1040]="STAR",s[s.SLASH=1041]="SLASH",s[s.PERCENT=1042]="PERCENT",s[s.LEFT_ANGLE=1043]="LEFT_ANGLE",s[s.RIGHT_ANGLE=1044]="RIGHT_ANGLE",s[s.VERTICAL_BAR=1045]="VERTICAL_BAR",s[s.CARET=1046]="CARET",s[s.AMPERSAND=1047]="AMPERSAND",s[s.QUESTION=1048]="QUESTION",s[s.NotWord=1049]="NotWord",s[s.EPSILON=1998]="EPSILON",s[s.EOF=1999]="EOF",s),U=((c={})[c.CONST=0]="CONST",c[c.BOOL=1]="BOOL",c[c.FLOAT=2]="FLOAT",c[c.DOUBLE=3]="DOUBLE",c[c.INT=4]="INT",c[c.UINT=5]="UINT",c[c.BREAK=6]="BREAK",c[c.CONTINUE=7]="CONTINUE",c[c.DO=8]="DO",c[c.ELSE=9]="ELSE",c[c.FOR=10]="FOR",c[c.IF=11]="IF",c[c.WHILE=12]="WHILE",c[c.DISCARD=13]="DISCARD",c[c.RETURN=14]="RETURN",c[c.BVEC2=15]="BVEC2",c[c.BVEC3=16]="BVEC3",c[c.BVEC4=17]="BVEC4",c[c.IVEC2=18]="IVEC2",c[c.IVEC3=19]="IVEC3",c[c.IVEC4=20]="IVEC4",c[c.UVEC2=21]="UVEC2",c[c.UVEC3=22]="UVEC3",c[c.UVEC4=23]="UVEC4",c[c.VEC2=24]="VEC2",c[c.VEC3=25]="VEC3",c[c.VEC4=26]="VEC4",c[c.VEC4_ARRAY=27]="VEC4_ARRAY",c[c.MAT2=28]="MAT2",c[c.MAT3=29]="MAT3",c[c.MAT4=30]="MAT4",c[c.MAT2X3=31]="MAT2X3",c[c.MAT2X4=32]="MAT2X4",c[c.MAT3X2=33]="MAT3X2",c[c.MAT3X4=34]="MAT3X4",c[c.MAT4X2=35]="MAT4X2",c[c.MAT4X3=36]="MAT4X3",c[c.IN=37]="IN",c[c.OUT=38]="OUT",c[c.INOUT=39]="INOUT",c[c.CENTROID=40]="CENTROID",c[c.SAMPLER2D=41]="SAMPLER2D",c[c.SAMPLER3D=42]="SAMPLER3D",c[c.SAMPLER_CUBE=43]="SAMPLER_CUBE",c[c.SAMPLER2D_SHADOW=44]="SAMPLER2D_SHADOW",c[c.SAMPLER_CUBE_SHADOW=45]="SAMPLER_CUBE_SHADOW",c[c.SAMPLER2D_ARRAY=46]="SAMPLER2D_ARRAY",c[c.SAMPLER2D_ARRAY_SHADOW=47]="SAMPLER2D_ARRAY_SHADOW",c[c.I_SAMPLER2D=48]="I_SAMPLER2D",c[c.I_SAMPLER3D=49]="I_SAMPLER3D",c[c.I_SAMPLER_CUBE=50]="I_SAMPLER_CUBE",c[c.I_SAMPLER2D_ARRAY=51]="I_SAMPLER2D_ARRAY",c[c.U_SAMPLER2D=52]="U_SAMPLER2D",c[c.U_SAMPLER3D=53]="U_SAMPLER3D",c[c.U_SAMPLER_CUBE=54]="U_SAMPLER_CUBE",c[c.U_SAMPLER2D_ARRAY=55]="U_SAMPLER2D_ARRAY",c[c.STRUCT=56]="STRUCT",c[c.LAYOUT=57]="LAYOUT",c[c.LOCATION=58]="LOCATION",c[c.VOID=59]="VOID",c[c.PRECISION=60]="PRECISION",c[c.PRECISE=61]="PRECISE",c[c.HIGHP=62]="HIGHP",c[c.MEDIUMP=63]="MEDIUMP",c[c.LOWP=64]="LOWP",c[c.INVARIANT=65]="INVARIANT",c[c.SMOOTH=66]="SMOOTH",c[c.FLAT=67]="FLAT",c[c.NOPERSPECTIVE=68]="NOPERSPECTIVE",c[c.True=69]="True",c[c.False=70]="False",c[c.LeftBrace=71]="LeftBrace",c[c.RightBrace=72]="RightBrace",c[c.Equal=73]="Equal",c[c.BitwiseOr=74]="BitwiseOr",c[c.GSRenderQueueType=75]="GSRenderQueueType",c[c.GSBlendState=76]="GSBlendState",c[c.GSDepthState=77]="GSDepthState",c[c.GSStencilState=78]="GSStencilState",c[c.GSRasterState=79]="GSRasterState",c[c.GSEditorProperties=80]="GSEditorProperties",c[c.GSEditorMacros=81]="GSEditorMacros",c[c.GSEditor=82]="GSEditor",c[c.GSTags=83]="GSTags",c[c.GSVertexShader=84]="GSVertexShader",c[c.GSFragmentShader=85]="GSFragmentShader",c[c.GSSubShader=86]="GSSubShader",c[c.GSPass=87]="GSPass",c[c.GSBlendFactor=88]="GSBlendFactor",c[c.GSBlendOperation=89]="GSBlendOperation",c[c.GSBool=90]="GSBool",c[c.GSNumber=91]="GSNumber",c[c.GSColor=92]="GSColor",c[c.GSCompareFunction=93]="GSCompareFunction",c[c.GSStencilOperation=94]="GSStencilOperation",c[c.GSCullMode=95]="GSCullMode",c[c.GSColorWriteMask=96]="GSColorWriteMask",c[c.GSUsePass=97]="GSUsePass",c[c.MACRO_IF=98]="MACRO_IF",c[c.MACRO_IFDEF=99]="MACRO_IFDEF",c[c.MACRO_IFNDEF=100]="MACRO_IFNDEF",c[c.MACRO_ELSE=101]="MACRO_ELSE",c[c.MACRO_ELIF=102]="MACRO_ELIF",c[c.MACRO_ENDIF=103]="MACRO_ENDIF",c[c.MACRO_UNDEF=104]="MACRO_UNDEF",c[c.MACRO_DEFINE_EXPRESSION=105]="MACRO_DEFINE_EXPRESSION",c[c.MACRO_CONDITIONAL_EXPRESSION=106]="MACRO_CONDITIONAL_EXPRESSION",c[c.MACRO_CALL=107]="MACRO_CALL",c[c.MACRO_DEFINE=108]="MACRO_DEFINE",c[c.MACRO_DEFINE_END=109]="MACRO_DEFINE_END",c[c.MACRO_DEFINE_PARAMS=110]="MACRO_DEFINE_PARAMS",c);function z(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):n(e,t)}function W(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function j(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return W(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return W(e,void 0)}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function q(e,t){for(var r=0;r<e.length;r++){var n,i=e[r];if((null==(n=i.sourceArm)?void 0:n.value)!==!0){var a=i.conditionalGroup;if(void 0===a)return!1;for(var o=!1,s=0;s<t.length;s++){var c=t[s];if(c.conditionalGroup===a){if(c.conditionalArm!==i.conditionalArm)return!1;o=!0;break}}if(!o)return!1}}return!0}function H(e,t){return!function e(t,r,n){var i=function(t){var r;return void 0!==h&&t!==h||(null==(r=o.conditionalReachableArms)?void 0:r[t])===!1?"continue":e(c.filter(function(e){return e.every(function(e){return e.conditionalGroup!==l||e.conditionalArm===t})}).map(function(e){return e.filter(function(e){return e.conditionalGroup!==l})}),d,n)?void 0:{v:!1}};if(t.some(function(e){return q(e,r)}))return!0;if(--n.remaining<0)return!1;for(var a,o,s,c=t.filter(function(e){return"exclusive"!==X(e,r)}),u=j(c);!(s=u()).done&&!(o=s.value.find(function(e){return e.conditionalComplete&&void 0!==e.conditionalGroup&&e.conditionalArmCount})););if(!o)return!1;for(var l=o.conditionalGroup,h=null==(a=r.find(function(e){return e.conditionalGroup===l}))?void 0:a.conditionalArm,d=r.filter(function(e){return e.conditionalGroup!==l}),p=0;p<o.conditionalArmCount;p++){var f=i(p);if("object"==(f&&"undefined"!=typeof Symbol&&f.constructor===Symbol?"symbol":typeof f))return f.v}return!0}(e,t,{remaining:256})?"unknown":"covered"}function X(e,t){for(var r,n=j(e);!(r=n()).done;)for(var i,a=r.value,o=j(t);!(i=o()).done;){var s=i.value;if(void 0!==a.conditionalGroup&&a.conditionalGroup===s.conditionalGroup&&a.conditionalArm!==s.conditionalArm)return"exclusive"}for(var c,u=j(e);!(c=u()).done;)if(void 0!==c.value.condition)return"unknown";for(var l,h=j(t);!(l=h()).done;)if(void 0!==l.value.condition)return"unknown";return"coexist"}function Q(e,t){return e&&t?e.kind===t.kind&&("constant"===e.kind?"constant"===t.kind&&e.value===t.value:"constant"!==t.kind&&("expression"===e.kind?"expression"===t.kind&&function(e,t){if(e.expression!==t.expression||e.opaque!==t.opaque||e.names.length!==t.names.length)return!1;for(var r=0,n=e.names.length;r<n;r++)if(e.names[r]!==t.names[r]||e.versions[r]!==t.versions[r])return!1;return!0}(e,t)&&e.negated===t.negated:"expression"!==t.kind&&e.name===t.name&&e.version===t.version&&("defined"===e.kind&&"defined"===t.kind?e.defined===t.defined:"comparison"===e.kind&&"comparison"===t.kind&&e.operator===t.operator&&e.value===t.value))):e===t}var K=Object.freeze([]),Y=function(){function e(e){this._objectPool=e,this.branch=K,this.inMacroDefinition=!1}return e.prototype.set=function(e,t,r){if(this.type=e,this.lexeme=t,this.branch=K,this.inMacroDefinition=!1,z(r,w))this.location=r;else{var n=this._objectPool?this._objectPool.createPosition(r.index+t.length,r.line,r.column+t.length):J(r.index+t.length,r.line,r.column+t.length);this.location=this._objectPool?this._objectPool.createRange(r,n):Z(r,n)}},e}();function J(e,t,r){var n=new G;return n.set(e,t,r),n}function Z(e,t){var r=new w;return r.set(e,t),r}var $=new Y,ee=J(0,0,0);function et(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function er(e,t,r){return t&&et(e.prototype,t),r&&et(e,r),e}function en(e,t){return(en=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ei(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&en(e,t)}function ea(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(ea=function(){return!!e})()}function eo(e,t,r){return(eo=ea()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var i=new(Function.bind.apply(e,n));return r&&en(i,r.prototype),i}).apply(null,arguments)}function es(e){return(es=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ec(e){var t="function"==typeof Map?new Map:void 0;return(ec=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return eo(e,arguments,es(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),en(r,e)})(e)}$.set(B.EOF,"/EOF",Z(ee,ee));var eu=function(e){function t(t,r,n,i,a,o){var s;return(s=e.call(this,r)||this).location=n,s.source=i,s.file=a,s.code=o,s.name=t,s}return ei(t,e),t.prototype.toString=function(){var e=this.location;return function(e,t,r,n){if(void 0===n&&(n=5),!e)return r;for(var i=e.split("\n"),a=t.start,o=t.end,s=Math.max(0,a.line-n),c=Math.min(i.length-1,o.line+n),u=String(c+1).length,l=" ".repeat(u),h=r+"\n",d=s;d<=c;d++)if(h+=String(d+1).padStart(u)+" | "+i[d]+"\n",a.line<=d&&d<=o.line){var p=d===a.line?a.column:0,f=d===o.line?o.column:i[d].length;h+=l+" | "+" ".repeat(p)+"^".repeat(Math.max(f-p,1))+"\n"}return h}(this.source||void 0,"start"in e?e:{start:e,end:e},this.name+": "+this.message)},t}(ec(Error)),el=((u={}).PreprocessorError="PreprocessorError",u.CompilationError="CompilationError",u.ScannerError="ScannerError",u.CompilationWarn="CompilationWarning",u),eh=function(){function e(){}return e.createPosition=function(e,t,r){void 0===t&&(t=0),void 0===r&&(r=0);var n=new G;return n.set(e,t,r),n},e.createRange=function(e,t){var r=new w;return r.set(e,t),r},e.createGSError=function(e,t,r,n,i,a){return new eu(t,e,n,r,a,i)},e}(),ed=function(){function e(e,t){this._objectPool=t,this._currentIndex=0,this._column=0,this._line=0,this.setSource(null!=e?e:"")}var t=e.prototype;return t.setSource=function(e){this._source=e,this._currentIndex=0,this._line=this._column=0},t.getShaderPosition=function(e){void 0===e&&(e=0);var t=this._currentIndex-e;return this._createPosition(t,this._line,this._column-e)},t._createPosition=function(e,t,r){return this._objectPool?this._objectPool.createPosition(e,t,r):eh.createPosition(e,t,r)},t._createToken=function(){return this._objectPool?this._objectPool.createToken():new Y},t._createEOFToken=function(){var e=this.getShaderPosition(),t=this._createToken();return t.set(B.EOF,"/EOF",this._createRange(e,e)),t},t._createRange=function(e,t){return this._objectPool?this._objectPool.createRange(e,t):eh.createRange(e,t)},t.isEnd=function(){return this._currentIndex>=this._source.length},t.getCurChar=function(){return this._source[this._currentIndex]},t.getCurCharCode=function(){return this._source.charCodeAt(this._currentIndex)},t.advance=function(e){for(var t=this._source,r=this._currentIndex,n=0;n<e;n++)10===t.charCodeAt(r+n)?(this._line+=1,this._column=0):this._column+=1;this._currentIndex+=e},t.skipSpace=function(t){for(;e.isWhiteSpaceChar(this.getCurCharCode(),t);)this.advance(1)},t.skipCommentsAndSpace=function(){for(var t=this._source,r=t.length,n=this._currentIndex;n<r;){for(;n<r&&e.isWhiteSpaceChar(t.charCodeAt(n),!0);)n++;var i=e._skipBlockComment(t,n,r);if(i!==n){n=i;continue}var a=e._skipLineComment(t,n,r);if(a!==n){n=a;continue}break}this.advance(n-this._currentIndex)},t.peek=function(e){var t=this._currentIndex;return this._source.substring(t,t+e)},t.scanLexeme=function(e){this.skipCommentsAndSpace();var t=e.length,r=this.peek(t);r!==e&&this.throwError(this.getShaderPosition(0),'Expect lexeme "'+e+'", but got "'+r+'"'),this.advance(t)},t.scanTwoExpectedLexemes=function(e,t){return(this.skipCommentsAndSpace(),this.peek(e.length)===e)?(this.advance(e.length),e):this.peek(t.length)===t?(this.advance(t.length),t):null},t.throwError=function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];throw eh.createGSError(r.join(" "),el.ScannerError,this._source,e)},t.scanPairedChar=function(e,t,r,n){n||this.scanLexeme(e);var i=this._currentIndex,a=this._source,o=a.length,s=this._currentIndex;if(r)for(var c=1;s<o;){var u=a[s];if(u===t&&0==--c)break;u===e&&c++,s++}else for(;s<o&&a[s]!==t;)s++;return s===o&&this.throwError(this.getShaderPosition(),'Expect closing character "'+t+'" before end of source.'),this.advance(s+1-this._currentIndex),a.substring(i,s)},e.isDigit=function(e){return e>=48&&e<=57},e.isHexDigit=function(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102},e.isAlpha=function(e){return 95===e||e>=65&&e<=90||e>=97&&e<=122},e.isAlnum=function(t){return e.isAlpha(t)||e.isDigit(t)},e.isPreprocessorStartChar=function(e){return 35===e},e._skipBlockComment=function(e,t,r){if(47!==e.charCodeAt(t)||t+1>=r||42!==e.charCodeAt(t+1))return t;for(var n=t+2;n+1<r;){if(42===e.charCodeAt(n)&&47===e.charCodeAt(n+1))return n+2;n++}return r},e._skipLineComment=function(e,t,r){if(47!==e.charCodeAt(t)||t+1>=r||47!==e.charCodeAt(t+1))return t;for(var n=t+2;n<r;){var i=e.charCodeAt(n);if(10===i||13===i)break;n++}return n},e.isWhiteSpaceChar=function(e,t){return 32===e||9===e||t&&(10===e||13===e)},er(e,[{key:"currentIndex",get:function(){return this._currentIndex}},{key:"source",get:function(){return this._source}},{key:"line",get:function(){return this._line}},{key:"column",get:function(){return this._column}}]),e}();function ep(){return(ep=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}var ef=[-0x80000000,0x7fffffff],e_=[0,1];function ev(e,t){return void 0===t&&(t=new WeakMap),em(e,t)}function em(e,t){if(t.has(e))return t.get(e);var r=function(e,t){switch(e.t){case"num":return[e.v,e.v];case"bool":return[Number(e.v),Number(e.v)];case"def":case"ndef":return e_;case"not":var r=em(e.c,t);return r&&(eO(r)?[0,0]:r[0]===r[1]?[1,1]:e_);case"and":case"or":var n=em(e.l,t);if(!n)return;var i="and"===e.t;if(i&&0===n[0]&&0===n[1])return[0,0];if(!i&&eO(n))return[1,1];var a=em(e.r,t);if(!a)return;if(i&&0===a[0]&&0===a[1])return[0,0];if(!i&&eO(a)||eO(n)&&eO(a))return[1,1];if(0===n[0]&&0===n[1]&&0===a[0]&&0===a[1])return[0,0];return e_;case"unary":var o=em(e.c,t);if(!o)return;if(o[0]===o[1])return eT(ep({},e,{c:eI(o[0])}));if("+"===e.op)return o;if("~"===e.op)return[~o[1],~o[0]];return -0x80000000===o[0]?ef:[-o[1],-o[0]];case"binary":var s=em(e.l,t),c=em(e.r,t);if(!s||!c)return;if(s[0]===s[1]&&c[0]===c[1])return eT(ep({},e,{l:eI(s[0]),r:eI(c[0])}));if(eM(e.op))return e_;switch(e.op){case"+":return eA(s[0]+c[0],s[1]+c[1]);case"-":return eA(s[0]-c[1],s[1]-c[0]);case"*":var u,l,h=[s[0]*c[0],s[0]*c[1],s[1]*c[0],s[1]*c[1]];return eA((u=Math).min.apply(u,[].concat(h)),(l=Math).max.apply(l,[].concat(h)));case"/":case"%":return eO(c)?ef:void 0;case"<<":case">>":return c[0]>=0&&c[1]<=31?ef:void 0;default:return s[0]>=0&&s[1]<=1&&c[0]>=0&&c[1]<=1?e_:ef}default:return}}(e,t);return t.set(e,r),r}function eg(e,t){var r,n=em(e,t);if(!n)return e;if(eO(n))return eR(!0);if(0===n[0]&&0===n[1])return eR(!1);switch(e.t){case"not":return eE(eg(e.c,t));case"and":case"or":return ex(e.t,eg(e.l,t),eg(e.r,t));case"binary":if(eM(e.op)){var i=em(e.l,t),a=em(e.r,t);if(a[0]===a[1])return eS(e.l,e.op,a[0],t);if(i[0]===i[1])return eS(e.r,function(e){switch(e){case"<":return">";case"<=":return">=";case">":return"<";case">=":return"<=";default:return e}}(e.op),i[0],t)}}return null!=(r=ey(e,t))?r:e}function ey(e,t){if("def"===e.t||"ndef"===e.t)return e;if("unary"===e.t&&"~"!==e.op)return eg(e.c,t);if("binary"===e.t){var r=em(e.l,t),n=em(e.r,t);if("+"===e.op&&eC(r,n)&&(r[0]>=0&&n[0]>=0||r[1]<=0&&n[1]<=0)||"|"===e.op)return ex("or",eg(e.l,t),eg(e.r,t));if("&"===e.op&&r[0]>=0&&r[1]<=1&&n[0]>=0&&n[1]<=1)return ex("and",eg(e.l,t),eg(e.r,t))}}function eS(e,t,r,n){switch(t){case"<":return eb(e,r,n);case"<=":return eb(e,r+1,n);case">":return eE(eb(e,r+1,n));case">=":return eE(eb(e,r,n));case"==":return ex("and",eE(eb(e,r,n)),eb(e,r+1,n));case"!=":return ex("or",eb(e,r,n),eE(eb(e,r+1,n)))}}function eb(e,t,r){var n=em(e,r);if(n[1]<t)return eR(!0);if(n[0]>=t)return eR(!1);if(0===n[0]&&1===t||0===n[1]&&0===t){var i=ey(e,r);if(i)return 0===n[0]?eE(i):i}if(t===n[0]+1||t===n[1]){var a=t===n[1],o=function(e,t,r){if("binary"===e.t&&"+"===e.op){var n=em(e.l,r),i=em(e.r,r);if(eC(n,i)){var a=t?1:0;return ex("and",eS(e.l,"==",n[a],r),eS(e.r,"==",i[a],r))}}}(e,a,r);if(o)return a?eE(o):o}return{t:"binary",op:"<",l:e,r:eI(t)}}function ex(e,t,r){return"bool"===t.t?t.v===("and"===e)?r:t:"bool"===r.t?r.v===("and"===e)?t:r:{t:e,l:t,r:r}}function eE(e){switch(e.t){case"bool":return eR(!e.v);case"def":return{t:"ndef",m:e.m};case"ndef":return{t:"def",m:e.m};case"not":return e.c;case"and":case"or":return ex("and"===e.t?"or":"and",eE(e.l),eE(e.r));default:return{t:"not",c:e}}}function eC(e,t){return e[0]+t[0]>=-0x80000000&&e[1]+t[1]<=0x7fffffff}function eA(e,t){return e>=-0x80000000&&t<=0x7fffffff?[e,t]:ef}function eT(e){var t=x(e);return void 0===t?void 0:[t,t]}function eO(e){return e[0]>0||e[1]<0}function eI(e){return{t:"num",v:e}}function eR(e){return{t:"bool",v:e}}function eM(e){return["<","<=",">",">=","==","!="].includes(e)}var eP=Symbol("condition diagram budget"),eD=function(){function e(){this._nodes=[],this._constants=new Map,this._variables=new Map,this._opaqueVariables=new Set,this._branches=new Map,this._operations=new Map,this._expressions=new Map,this._remaining=16384}var t=e.prototype;return t.coverage=function(e){for(var t=[{id:e,opaque:!1}],r=[new Set,new Set],n=!1;t.length;){var i=t.pop(),a=i.id,o=i.opaque,s=r[Number(o)];if(!s.has(a)){s.add(a),this._spend();var c=this._nodes[a];if(c.variable!==1/0){var u=o||this._opaqueVariables.has(c.variable);t.push({id:c.low,opaque:u},{id:c.high,opaque:u})}else if(0===c.value){if(!o)return!1;n=!0}else void 0===c.value&&(n=!0)}}return!n||void 0},t.constant=function(e){var t=this._constants.get(e);return void 0===t&&(this._spend(),t=this._nodes.length,this._nodes.push({variable:1/0,low:0,high:0,value:e}),this._constants.set(e,t)),t},t.predicates=function(e){if("boolean"==typeof e)return this.constant(Number(e));for(var t,r=this.constant(1),n=j(e);!(t=n()).done;){var i=t.value,a=i.condition,o=i.negated,s="opaque"===a.kind?this._variable("opaque:"+a.identity,!0):this._expression(a.expression,a);r=this.apply("and",r,this.apply(o?"not":"truth",s))}return r},t.apply=function(e,t,r){void 0===r&&(r=t);var n,i=e+":"+t+":"+r,a=this._operations.get(i);if(void 0!==a)return a;this._spend();var o=this._nodes[t],s=this._nodes[r];if(o.variable===1/0&&void 0===o.value)n=t;else if(o.variable===1/0&&"and"===e&&0===o.value)n=this.constant(0);else if(o.variable===1/0&&"or"===e&&0!==o.value)n=this.constant(1);else if(o.variable===1/0&&s.variable===1/0)n=this._evaluate(e,o.value,s.value);else{var c=Math.min(o.variable,s.variable);n=this._branch(c,this.apply(e,o.variable===c?o.low:t,s.variable===c?s.low:r),this.apply(e,o.variable===c?o.high:t,s.variable===c?s.high:r))}return this._operations.set(i,n),n},t._expression=function(e,t){var r,n=this._expressions.get(t);n||this._expressions.set(t,n=new Map);var i=n.get(e);if(void 0!==i)return i;switch(e.t){case"bool":r=this.constant(Number(e.v));break;case"num":r=this.constant(e.v);break;case"def":case"ndef":r=this._variable("defined:"+e.m+":"+t.versions[e.m]),"ndef"===e.t&&(r=this.apply("not",r));break;case"not":r=this.apply("not",this._expression(e.c,t));break;case"unary":r=this.apply("+"===e.op?"positive":"-"===e.op?"negative":"complement",this._expression(e.c,t));break;case"and":case"or":case"binary":var a="binary"===e.t?e.op:e.t;r=["and","or","+","*","&","|","^"].includes(a)?this._associativeExpression(e,t,a):this.apply(a,this._expression(e.l,t),this._expression(e.r,t));break;default:r=this.constant()}return n.set(e,r),r},t._associativeExpression=function(e,t,r){for(var n=[e],i=[];n.length;){var a=n.pop();"binary"===a.t&&a.op===r||("and"===a.t||"or"===a.t)&&a.t===r?n.push(a.r,a.l):i.push(this._expression(a,t))}for(;i.length>1;){for(var o=0,s=0;s<i.length;s+=2)i[o++]=s+1<i.length?this.apply(r,i[s],i[s+1]):i[s];i.length=o}return i[0]},t._variable=function(e,t){void 0===t&&(t=!1);var r=this._variables.get(e);return void 0===r&&this._variables.set(e,r=this._variables.size),t&&this._opaqueVariables.add(r),this._branch(r,this.constant(0),this.constant(1))},t._branch=function(e,t,r){if(t===r)return t;var n=e+":"+t+":"+r,i=this._branches.get(n);return void 0===i&&(this._spend(),i=this._nodes.length,this._nodes.push({variable:e,low:t,high:r}),this._branches.set(n,i)),i},t._evaluate=function(e,t,r){if("truth"===e)return this.constant(Number(0!==t));if("not"===e)return this.constant(Number(0===t));var n,i,a={t:"num",v:t};if("positive"===e||"negative"===e||"complement"===e)n={t:"unary",op:"positive"===e?"+":"negative"===e?"-":"~",c:a};else{if(void 0===r)return this.constant();var o={t:"num",v:r};n="and"===e||"or"===e?{t:e,l:a,r:o}:{t:"binary",op:e,l:a,r:o}}try{i=x(n)}catch(e){i=void 0}return this.constant(i)},t._spend=function(){if(--this._remaining<0)throw eP},e}();function eL(e,t){for(var r=Object.create(null),n=[e];n.length;){var i,a=n.pop();switch(a.t){case"def":case"ndef":r[a.m]=null!=(i=t[a.m])?i:0;break;case"not":case"unary":n.push(a.c);break;case"and":case"or":case"binary":n.push(a.l,a.r)}}return{kind:"expression",expression:e,versions:r}}function eN(e,t){return!0===ek(e,t)}function ek(e,t){var r=eV(t),n=e.map(eV);if(n.includes(!0)||!1===r)return!0;if(void 0!==r){var i=n.filter(function(e){return void 0!==e}),a=new Map;i=i.map(c),r=c(r);var o=new WeakMap;if(i.some(function(e){return function(e,t,r){var n=new Set,i=new Map,a=new Map,o=new Map,s=function(e){return ev(e,r)},c=!1===t;function u(e){var t=o.get(e);return void 0===t&&o.set(e,t=o.size+1),t}function l(e,t){var r=a.get(t);r||a.set(t,r=new Map);var n=r.get(e);return void 0===n&&(n=function(e,t,r,n,i){var a=n(e);if(a&&a[0]===a[1])return i("num:"+a[0]);switch(e.t){case"def":case"ndef":return i(e.t+":"+("defined:"+e.m+":")+t[e.m]);case"not":return i("not("+r(e.c)+")");case"unary":return i(e.op+"("+r(e.c)+")");case"and":case"or":case"binary":var o="binary"===e.t?e.op:e.t,s=["+","*","&","|","^"].includes(o);if(s||("and"===o||"or"===o)&&a){var c,u=[],l=function(e){if("binary"===e.t&&e.op===o||("and"===e.t||"or"===e.t)&&e.t===o)l(e.l),l(e.r);else{var t=n(e);s&&t&&t[0]===t[1]?c=void 0===c?t[0]:x({t:"binary",op:o,l:{t:"num",v:c},r:{t:"num",v:t[0]}}):u.push(r(e))}};l(e);var h="*"===o?1:"&"===o?-1:0;return s&&void 0!==c&&(c!==h||!u.length)&&u.push(i("num:"+c)),u.sort(function(e,t){return e-t}),1===u.length?u[0]:i(o+"("+u.join(",")+")")}return i(o+"("+r(e.l)+","+r(e.r)+")");default:return i(JSON.stringify(e))}}(e,"expression"===t.kind?t.versions:{},function(e){return l(e,t)},s,u),r.set(e,n)),n}function h(e,t,r,a){if("opaque"===e.kind){var o,d=(r?-1:1)*u("opaque:"+e.identity);return a&&n.add(d),n.has(d)}if(!t)return!1;if("not"===t.t)return h(e,t.c,!r,a);if("bool"===t.t||"num"===t.t){var p=!!t.v!==r;return a&&!p&&(c=!0),p}var f=(r?-1:1)*l(t,e);if(a)n.add(f);else if(n.has(f))return!0;if("and"===t.t||"or"===t.t){if(!s(t))return!1;var _="and"===t.t!==r;if(a&&!_)return!1;var v=h(e,t.l,r,a),m=h(e,t.r,r,a);return _?v&&m:v||m}var g=function(e,t,r){var n,i=e;if("binary"===e.t&&"<"===e.op&&"num"===e.r.t)i=e.l,n=t?[e.r.v,0x7fffffff]:[-0x80000000,e.r.v-1];else if(t)n=[0,0];else{var a=s(i);if(!a||a[0]<0&&a[1]>0)return;n=a[0]>=0?[1,0x7fffffff]:[-0x80000000,-1]}var o=s(i);if(o)return{key:l(i,r),domain:o,allowed:[Math.max(o[0],n[0]),Math.min(o[1],n[1])]}}(t,r,e);if(!g)return!1;var y=null!=(o=i.get(g.key))?o:g.domain,S=g.allowed;if(a){var b=[Math.max(y[0],S[0]),Math.min(y[1],S[1])];return b[0]>b[1]&&(c=!0),i.set(g.key,b),!0}return y[0]>=S[0]&&y[1]<=S[1]}if("boolean"!=typeof t)for(var d,p=j(t);!(d=p()).done;){var f=d.value,_=f.condition,v=f.negated;h(_,"expression"===_.kind?_.expression:void 0,v,!0)}return c||("boolean"==typeof e?e:e.every(function(e){var t=e.condition,r=e.negated;return h(t,"expression"===t.kind?t.expression:void 0,r,!1)}))}(e,r,o)}))return!0;var s=function(e,t){var r=new eD;try{for(var n,i=r.predicates(t),a=r.constant(0),o=j(e);!(n=o()).done;){var s=n.value;a=r.apply("or",a,r.predicates(s))}return r.coverage(r.apply("or",r.apply("not",i),a))}catch(e){if(e!==eP)throw e;return}}(i,r);return!1===s&&n.includes(void 0)?void 0:s}function c(e){return"boolean"==typeof e?e:e.map(function(e){var t=e.condition,r=e.negated,n=a.get(t);return n||(n="opaque"===t.kind?t:ep({},t,{expression:eg(t.expression,new WeakMap)}),a.set(t,n)),{condition:n,negated:r}})}}function eV(e){for(var t,r=[],n=j(e);!(t=n()).done;){var i=t.value.sourceArm;if((null==i?void 0:i.value)!==!0){if((null==i?void 0:i.value)===!1)return!1;if(!(null==i?void 0:i.predicates))return;r.push.apply(r,[].concat(i.predicates))}}return!r.length||r}var eF=function(){function e(){this._table=new Map}var t=e.prototype;return t.insert=function(e,t,r,n){void 0===t&&(t=!1),void 0===r&&(r=K),e.isInMacroBranch=t,e.branchSignature=r;var i=null!=(s=this._table.get(e.ident))?s:[],a=null!=(c=e.sourceScope)?c:0;if(a>0)for(var o=i.length-1;o>=0;o--){var s,c,u,l=i[o],h=null!=(d=l.sourceScope)?d:0;if(l.equal(e)&&!(h>=a)){for(var d,p,f=[r],_=j(i);!(p=_()).done;){var v,m,g=p.value;(null!=(v=g.sourceScope)?v:0)>h&&g.equal(e)&&f.push(null!=(m=g.branchSignature)?m:K)}eN(f,null!=(u=l.branchSignature)?u:K)&&i.splice(o,1)}}if(!n)return this._insertWithoutBranchAnalysis(i,e);for(var y="none",S=0,b=i.length;S<b;S++){var x,E,C=i[S];if(C.equal(e)&&!((null!=(x=C.sourceScope)?x:0)<a)){var A=null!=(E=C.branchSignature)?E:K;if(0===A.length&&0===r.length)return i[S]=e,"coexist";var T=n.getDeclarationCoexistence(A,r);"coexist"===T?y="coexist":"unknown"===T&&"none"===y&&(y="unknown")}}return i.push(e),this._table.set(e.ident,i),y},t._insertWithoutBranchAnalysis=function(e,t){for(var r,n,i=0,a=e.length;i<a;i++)if(!e[i].isInMacroBranch&&(null!=(r=e[i].sourceScope)?r:0)===(null!=(n=t.sourceScope)?n:0)&&e[i].equal(t))return e[i]=t,"coexist";return e.push(t),this._table.set(t.ident,e),"none"},t.getInheritedConflict=function(e,t,r){var n=this._table.get(e.ident);if(!(null==n?void 0:n.includes(e)))return"none";for(var i,a="none",o=j(n);!(i=o()).done;){var s,c,u,l,h=i.value;if(!((null!=(s=h.sourceScope)?s:0)>=(null!=(c=e.sourceScope)?c:0))&&h.equal(e)&&(null==r||!r(h,e))){var d=t.getDeclarationCoexistence(null!=(u=h.branchSignature)?u:K,null!=(l=e.branchSignature)?l:K);if("coexist"===d)return"coexist";"unknown"===d&&(a="unknown")}}return a},t.getSymbol=function(e,t,r,n){void 0===t&&(t=!1);var i=this._table.get(e.ident);if(i)for(var a=i.length-1;a>=0;a--){var o,s=i[a],c=t||!s.isInMacroBranch;if(n&&void 0!==r&&(c=n.isBranchVisibleFrom(null!=(o=s.branchSignature)?o:K,r)),c&&s.equal(e))return s}},t.getSymbols=function(e,t,r){return void 0===t&&(t=!1),r.length=0,this._getSymbols(e,t,r),r},t.hasSymbol=function(e){var t=this._table.get(e.ident);if(!t)return!1;for(var r=0,n=t.length;r<n;r++)if(t[r].equal(e))return!0;return!1},t._getSymbols=function(e,t,r,n,i){void 0===t&&(t=!1);var a=this._table.get(e.ident);if(a)for(var o=a.length-1;o>=0;o--){var s,c,u=a[o],l=t||!u.isInMacroBranch;void 0!==n&&(l=i?i.canBranchesOverlap(null!=(s=u.branchSignature)?s:K,n):"exclusive"!==X(null!=(c=u.branchSignature)?c:K,n)),l&&u.equal(e)&&r.push(u)}return r},t.forEach=function(e){for(var t,r=j(this._table.values());!(t=r()).done;)for(var n=t.value,i=0,a=n.length;i<a;i++)e(n[i])},e}(),ew=function(){function e(){this.stack=[],this._macroLevel=0,this._currentBranch=K}var t=e.prototype;return t.pushScope=function(e){this.stack.push(e)},t.clear=function(){this.stack.length=0,this._macroLevel=0,this._currentBranch=K},t.popScope=function(){return this.stack.pop()},t.insert=function(e,t){return void 0===t&&(t=this._currentBranch),this.scope.insert(e,this.isInMacroBranch,t,this.branchSemantics)},t.lookup=function(e,t,r){void 0===t&&(t=!1);for(var n=this.stack.length-1;n>=0;n--){var i=this.stack[n].getSymbol(e,t,r,this.branchSemantics);if(i)return i}},t.hasSymbol=function(e){for(var t=this.stack.length-1;t>=0;t--)if(this.stack[t].hasSymbol(e))return!0;return!1},t.lookupAll=function(e,t,r,n){void 0===t&&(t=!1),r.length=0;for(var i=this.stack.length-1;i>=0&&(this.stack[i]._getSymbols(e,t,r,n,this.branchSemantics),!(r.length>0));i--);return r},t.lookupAllWithRuntimeFallbacks=function(e,t,r,n,i){r.length=0,n.length=0;for(var a=this.stack.length-1;a>=0;a--)if(r.length){var o=n.length;if(this.stack[a]._getSymbols(e,t,n,i,this.branchSemantics),n.length>o&&this._runtimeCandidatesCoverCallsite(n,i))break}else{if(this.stack[a]._getSymbols(e,t,r,i,this.branchSemantics),!r.length)continue;if(this._runtimeCandidatesCoverCallsite(r,i))break}return r},t._runtimeCandidatesCoverCallsite=function(e,t){for(var r=0;r<e.length;r++){var n,i=e[r];if(!i.isInMacroBranch||t&&q(null!=(n=i.branchSignature)?n:K,t))return!0}return!1},er(e,[{key:"scope",get:function(){return this.stack[this.stack.length-1]}},{key:"isInMacroBranch",get:function(){return this._macroLevel>0}}]),e}(),eG=((l={})[l.VERTEX=0]="VERTEX",l[l.FRAGMENT=1]="FRAGMENT",l[l.ALL=2]="ALL",l);function eB(e,t,r,n){var i,a,o=arguments.length,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if(("undefined"==typeof Reflect?"undefined":(i=Reflect)&&"undefined"!=typeof Symbol&&i.constructor===Symbol?"symbol":typeof i)=="object"&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,n);else for(var c=e.length-1;c>=0;c--)(a=e[c])&&(s=(o<3?a(s):o>3?a(t,r,s):a(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s}function eU(e,t){var r,n,i,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(c){return function(s){if(r)throw TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(i=2&s[0]?n.return:s[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,s[1])).done)return i;switch(n=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===s[0]||2===s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){a.label=s[1];break}if(6===s[0]&&a.label<i[1]){a.label=i[1],i=s;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(s);break}i[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}"function"==typeof SuppressedError&&SuppressedError;var ez=function(e){function t(t,r,n,i){var a;return(a=e.call(this,t,n)||this).macroDefineList=r,a._conditionalArms=i,a.preprocessorExpressions=new Map,a._needScanMacroConditionExpression=!1,a._inMacroDefineValue=!1,a._macroDefineExpectsNameToken=!1,a._macroDefineExpectsParamsToken=!1,a._currentMacroName="",a._currentMacroParamsLexeme=void 0,a._currentMacroValueStart=-1,a._branchStack=[],a._branchSnapshot=K,a._conditionalGroup=0,a._pendingBranchPushDefined=null,a._pendingCodegenConditional=null,a._codegenConditionalFrames=[],a}ei(t,e);var r=t.prototype;return r.tokenize=function(){return eU(this,function(e){switch(e.label){case 0:return[5,function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(this._tokenizeForCodegen())];case 1:return e.sent(),[2,this._createEOFToken()]}})},r._tokenizeForCodegen=function(){var e,t,r,n,i,a,o,s,c,u,l,h,d,p,f,_,v,m,g,y,S,b,x,E,C,A,T,O;return eU(this,function(I){switch(I.label){case 0:if(this.isEnd())return[3,2];switch(e=this.scanToken(),this._pendingCodegenConditional&&e.type===U.MACRO_CONDITIONAL_EXPRESSION&&(t=this._parseCodegenConstantCondition(e.lexeme),"push"===this._pendingCodegenConditional?(n={name:"__if_"+(r=++this._conditionalGroup),defined:!0,sourceArm:this._pendingCodegenArm,conditionalGroup:r,conditionalArm:0,condition:t},this._branchStack.push(n),this._codegenConditionalFrames.push({arms:[n],definitelyMatched:(null==t?void 0:t.kind)==="constant"&&t.value})):(i=this._branchStack.length-1,(a=this._branchStack[i])&&(c=(s=(o=this._codegenConditionalFrames[i]).definitelyMatched)?{kind:"constant",value:!1}:t,this._branchStack[i]={name:a.name,defined:!0,conditionalGroup:a.conditionalGroup,conditionalArm:(null!=(u=a.conditionalArm)?u:0)+1,sourceArm:this._pendingCodegenArm,condition:c},o.arms.push(this._branchStack[i]),!s&&(null==t?void 0:t.kind)==="constant"&&t.value&&(o.definitelyMatched=!0))),this._pendingCodegenConditional=null),l=e.type===B.ID||e.type===U.MACRO_CALL,null!==this._pendingBranchPushDefined&&l&&(h=++this._conditionalGroup,d={name:e.lexeme,defined:this._pendingBranchPushDefined,sourceArm:this._pendingCodegenArm,conditionalGroup:h,conditionalArm:0},this._branchStack.push(d),this._codegenConditionalFrames.push({arms:[d],definitelyMatched:!1}),this._pendingBranchPushDefined=null),this._branchStack.length>0&&(e.branch=this._captureBranchSignature()),e.type){case U.MACRO_IFDEF:this._pendingCodegenArm=null==(p=this._conditionalArms)?void 0:p.get(e.location.start.index),this._pendingBranchPushDefined=!0;break;case U.MACRO_IFNDEF:this._pendingCodegenArm=null==(f=this._conditionalArms)?void 0:f.get(e.location.start.index),this._pendingBranchPushDefined=!1;break;case U.MACRO_IF:this._pendingCodegenArm=null==(_=this._conditionalArms)?void 0:_.get(e.location.start.index),this._pendingCodegenConditional="push";break;case U.MACRO_ELIF:this._pendingCodegenArm=null==(v=this._conditionalArms)?void 0:v.get(e.location.start.index),this._pendingCodegenConditional="advance";break;case U.MACRO_ELSE:m=this._branchStack.length-1,(g=this._branchStack[m])&&(b=(S=this._codegenConditionalFrames[m]).definitelyMatched?{kind:"constant",value:!1}:void 0,this._branchStack[m]={name:g.name,defined:!g.defined,sourceArm:null==(y=this._conditionalArms)?void 0:y.get(e.location.start.index),conditionalGroup:g.conditionalGroup,conditionalArm:(null!=(x=g.conditionalArm)?x:0)+1,condition:b},S.arms.push(this._branchStack[m]),S.definitelyMatched=!0);break;case U.MACRO_ENDIF:if(this._branchStack.pop(),null==(E=this._codegenConditionalFrames.pop())?void 0:E.definitelyMatched)for(C=E.arms.map(function(e){var t;return(null==(t=e.condition)?void 0:t.kind)!=="constant"||e.condition.value}),A=j(E.arms);!(T=A()).done;)(O=T.value).conditionalComplete=!0,O.conditionalArmCount=E.arms.length,O.conditionalReachableArms=C}return[4,e];case 1:return I.sent(),[3,0];case 2:return[2,this._createEOFToken()]}})},r._parseCodegenConstantCondition=function(e){var t=this.preprocessorExpressions.get(e.trim()),r=(null==t?void 0:t.ok)&&!t.hasExpandableIdentifier?x(t.condition):void 0;return void 0===r?void 0:{kind:"constant",value:0!==r}},r._isBranchReachable=function(e){return t._isCodegenBranchReachable(e)},r._sameDefinitionBranch=function(e,r){return t._sameCodegenBranch(e,r)},r._branchesOverlap=function(e,t){return"exclusive"!==X(e,t)},r.scanToken=function(){if(this._inMacroDefineValue){if(this._skipInlineSpaceAndComments(),this.isEnd()||this._isAtLineBreak())return this._emitMacroDefineEnd();if(this._macroDefineExpectsParamsToken&&(this._macroDefineExpectsParamsToken=!1,"("===this.getCurChar()))return this._scanMacroDefineParams()}else if(this.skipCommentsAndSpace(),this.isEnd())return this._createEOFToken();if(this._needScanMacroConditionExpression)return this._needScanMacroConditionExpression=!1,this._scanMacroConditionExpression();var e,t=this.getCurCharCode();if(ed.isPreprocessorStartChar(t))return this._scanDirectives();if(ed.isAlpha(t))return this._scanWord();if(ed.isDigit(t))return this._scanNum();var r=this.getShaderPosition(),n=this._createToken();switch(this.getCurChar()){case"<":if(this.advance(1),"<"===(e=this.getCurChar())){if(this.advance(1),"="===this.getCurChar()){this.advance(1),n.set(B.LEFT_ASSIGN,"<<=",r);break}n.set(B.LEFT_OP,"<<",r);break}if("="===e){this.advance(1),n.set(B.LE_OP,"<=",r);break}n.set(B.LEFT_ANGLE,"<",r);break;case">":if(this.advance(1),">"===(e=this.getCurChar())){if(this.advance(1),"="===this.getCurChar()){this.advance(1),n.set(B.RIGHT_ASSIGN,">>=",r);break}n.set(B.RIGHT_OP,">>",r);break}if("="===e){this.advance(1),n.set(B.GE_OP,">=",r);break}n.set(B.RIGHT_ANGLE,">",r);break;case"+":if(this.advance(1),"+"===(e=this.getCurChar())){this.advance(1),n.set(B.INC_OP,"++",r);break}if("="===e){this.advance(1),n.set(B.ADD_ASSIGN,"+=",r);break}n.set(B.PLUS,"+",r);break;case"-":if(this.advance(1),"-"===(e=this.getCurChar())){this.advance(1),n.set(B.DEC_OP,"--",r);break}if("="===e){this.advance(1),n.set(B.SUB_ASSIGN,"-=",r);break}n.set(B.DASH,"-",r);break;case"=":if(this.advance(1),"="===this.getCurChar()){this.advance(1),n.set(B.EQ_OP,"==",r);break}n.set(B.EQUAL,"=",r);break;case"!":if(this.advance(1),"="===this.getCurChar()){this.advance(1),n.set(B.NE_OP,"!=",r);break}n.set(B.BANG,"!",r);break;case"&":if(this.advance(1),"&"===(e=this.getCurChar())){this.advance(1),n.set(B.AND_OP,"&&",r);break}if("="===e){this.advance(1),n.set(B.AND_ASSIGN,"&=",r);break}n.set(B.AMPERSAND,"&",r);break;case"|":if(this.advance(1),"|"===(e=this.getCurChar())){this.advance(1),n.set(B.OR_OP,"||",r);break}if("="===e){this.advance(1),n.set(B.OR_ASSIGN,"|=",r);break}n.set(B.VERTICAL_BAR,"|",r);break;case"^":if(this.advance(1),"^"===(e=this.getCurChar())){this.advance(1),n.set(B.XOR_OP,"^^",r);break}if("="===e){this.advance(1),n.set(B.XOR_ASSIGN,"^=",r);break}n.set(B.CARET,"^",r);break;case"*":if(this.advance(1),"="===this.getCurChar()){this.advance(1),n.set(B.MUL_ASSIGN,"*=",r);break}n.set(B.STAR,"*",r);break;case"/":if(this.advance(1),"="===this.getCurChar()){this.advance(1),n.set(B.DIV_ASSIGN,"/=",r);break}n.set(B.SLASH,"/",r);break;case"%":if(this.advance(1),"="===this.getCurChar()){this.advance(1),n.set(B.MOD_ASSIGN,"%=",r);break}n.set(B.PERCENT,"%",r);break;case"(":this.advance(1),n.set(B.LEFT_PAREN,"(",r);break;case")":this.advance(1),n.set(B.RIGHT_PAREN,")",r);break;case"{":this.advance(1),n.set(B.LEFT_BRACE,"{",r);break;case"}":this.advance(1),n.set(B.RIGHT_BRACE,"}",r);break;case"[":this.advance(1),n.set(B.LEFT_BRACKET,"[",r);break;case"]":this.advance(1),n.set(B.RIGHT_BRACKET,"]",r);break;case".":if(this.advance(1),ed.isDigit(this.getCurCharCode()))return this._scanNumAfterDot();n.set(B.DOT,".",r);break;case",":this.advance(1),n.set(B.COMMA,",",r);break;case":":this.advance(1),n.set(B.COLON,":",r);break;case";":this.advance(1),n.set(B.SEMICOLON,";",r);break;case"~":this.advance(1),n.set(B.TILDE,"~",r);break;case"?":this.advance(1),n.set(B.QUESTION,"?",r);break;case'"':return this.advance(1),this._scanStringConst();default:this.throwError(this.getShaderPosition(0),"Unexpected character "+this.getCurChar())}return n},r._scanStringConst=function(){for(var e=this.getShaderPosition(),t=[];'"'!==this.getCurChar();){if(this.isEnd()){var r=this._createPosition(e.index-1,e.line,e.column-1);this.throwError(this._createRange(r,e),"Unterminated string literal.")}t.push(this.getCurChar()),this.advance(1)}this.advance(1);var n=this._createRange(e,this.getShaderPosition()),i=this._createToken();return i.set(B.STRING_CONST,t.join(""),n),i},r._scanNumAfterDot=function(){for(var e=["."];ed.isDigit(this.getCurCharCode());)e.push(this.getCurChar()),this.advance(1);this._scanFloatSuffix(e);var t=this._createToken();return t.set(B.FLOAT_CONSTANT,e.join(""),this.getShaderPosition(e.length)),t},r._scanUtilBreakLine=function(e){for(var r=this._source,n=r.length;!this.isEnd();){var i=t._skipLineContinuation(r,this._currentIndex,n);if(i!==this._currentIndex){this.advance(i-this._currentIndex);continue}if(10===r.charCodeAt(this._currentIndex))break;e.push(r[this._currentIndex]),this.advance(1)}},r._scanDirectives=function(){var e=[this.getCurChar()],r=this.getShaderPosition();for(this.advance(1),this.skipSpace(!1);ed.isAlpha(this.getCurCharCode());)e.push(this.getCurChar()),this.advance(1);var n=this._createToken(),i=e.join("");if("#define"===i){if(!this._isBranchReachable(this._branchStack))return this._scanUtilBreakLine(e),n.set(U.MACRO_DEFINE_EXPRESSION,"\n"+e.join("")+"\n",r),n;var a=this._peekMacroDefine();if(a&&a.isExpression)this._inMacroDefineValue=!0,this._macroDefineExpectsNameToken=!0,n.set(U.MACRO_DEFINE,"#define",r);else{this._scanUtilBreakLine(e);var o="\n"+e.join("")+"\n";a&&this._registerMacroDefine(a.name,a.paramsLexeme,a.valueStart,a.valueEnd),n.set(U.MACRO_DEFINE_EXPRESSION,o,r)}}else{var s=t._lexemeTable[i];n.set(null!=s?s:B.ID,i,r),("#if"===i||"#elif"===i)&&(this._needScanMacroConditionExpression=!0)}return n},r._isAtLineBreak=function(){var e=this.getCurChar();return"\n"===e||"\r"===e},r._peekMacroDefine=function(){var e,r=this._source,n=r.length,i=t._skipNonSemantic(r,this._currentIndex,n);if(!(i<n&&ed.isAlpha(r.charCodeAt(i))))return null;for(var a=i;i<n&&ed.isAlnum(r.charCodeAt(i));)i++;var o=r.slice(a,i);if(i<n&&40===r.charCodeAt(i)){var s=i,c=1;for(i++;i<n&&c>0&&!((i=t._skipNonSemantic(r,i,n))>=n);){var u=r.charCodeAt(i);if(10===u||13===u)return{name:o,paramsLexeme:void 0,valueStart:i,valueEnd:i,isExpression:!1};40===u?c++:41===u&&c--,i++}e=r.slice(s,i)}for(var l=i,h=0,d=0,p=-1,f=-1,_=!1,v=-1;i<n;){var m=t._skipNonSemantic(r,i,n);if(m!==i){i=m;continue}var g=r.charCodeAt(i);if(10===g||13===g)break;if(-1===p&&(p=i,ed.isAlpha(g))){for(;i<n&&ed.isAlnum(r.charCodeAt(i));)i++;f=i;var y=t._skipNonSemantic(r,i,n);_=y<n&&40===r.charCodeAt(y),v=f-1;continue}40===g?h++:41===g?h--:91===g?d++:93===g&&d--,0===h&&0===d&&(v=i),i++}var S={name:o,paramsLexeme:e,valueStart:l,valueEnd:i,isExpression:!1};if(-1===p||-1!==f&&!_&&t._isNonExpressionLeadingKeyword(r.slice(p,f)))return S;var b=r.charCodeAt(p),x=v>=0?r.charCodeAt(v):0,E=!ed.isAlnum(b)&&40!==b&&46!==b&&45!==b&&43!==b&&33!==b&&126!==b,C=!ed.isAlnum(x)&&41!==x&&93!==x;return 0!==h||0!==d||E||C||(S.isExpression=!0),S},r._skipInlineSpaceAndComments=function(){var e=t._skipNonSemantic(this._source,this._currentIndex,this._source.length);e>this._currentIndex&&this.advance(e-this._currentIndex)},r._scanMacroDefineParams=function(){for(var e=this.getShaderPosition(),r=this._source,n=r.length,i=[],a=0;this._currentIndex<n;){var o=t._skipLineContinuation(r,this._currentIndex,n);if(o!==this._currentIndex){this.advance(o-this._currentIndex);continue}var s=r[this._currentIndex];if(i.push(s),"("===s)a++;else if(")"===s){if(a--,this.advance(1),0===a)break;continue}this.advance(1)}var c=this._createToken(),u=i.join("");return this._currentMacroParamsLexeme=u,this._currentMacroValueStart=this._currentIndex,c.set(U.MACRO_DEFINE_PARAMS,u,e),c},r._emitMacroDefineEnd=function(){var e=this.getShaderPosition(),t=this._currentIndex,r=this._source;if(this._currentIndex<r.length){var n=r.charCodeAt(this._currentIndex);13===n&&10===r.charCodeAt(this._currentIndex+1)?this.advance(2):(10===n||13===n)&&this.advance(1)}this._registerMacroDefine(this._currentMacroName,this._currentMacroParamsLexeme,this._currentMacroValueStart,t),this._inMacroDefineValue=!1;var i=this._createToken();return i.set(U.MACRO_DEFINE_END,"\n",e),i},r._registerMacroDefine=function(e,r,n,i){var a=r?r.slice(1,-1).split(",").map(function(e){return e.trim()}).filter(Boolean):[],o=(null!=r?r:"")+"="+t._normalizeValueText(this._source,n,i),s={isFunction:void 0!==r,params:a,dedupKey:o,branch:this._captureBranchSignature()},c=this.macroDefineList[e];if(c){for(var u=!1,l=0,h=c.length;l<h;l++){var d=c[l];if(d.dedupKey===o&&this._sameDefinitionBranch(d.branch,s.branch)){u=!0;break}}u||c.push(s)}else this.macroDefineList[e]=[s]},r._captureBranchSignature=function(){var e=this._branchStack,t=this._branchSnapshot;if(e.length===t.length){for(var r=!0,n=0;n<e.length;n++)if(e[n]!==t[n]){r=!1;break}if(r)return t}return this._branchSnapshot=0===e.length?K:e.slice()},r._scanMacroConditionExpression=function(){for(var e=[],r=this.getShaderPosition(),n=this._source;!this.isEnd();){var i=t._skipLineContinuation(n,this._currentIndex,n.length);if(i!==this._currentIndex){for(;this._currentIndex<i;){var a=n[this._currentIndex];e.push("\\"===a?" ":a),this.advance(1)}continue}if(10===n.charCodeAt(this._currentIndex))break;e.push(n[this._currentIndex]),this.advance(1)}var o=e.join(""),s=S(o),c=o.replace(/[\r\n]/g," ");this.preprocessorExpressions.set(c.trim(),s);var u=this._createToken();return u.set(U.MACRO_CONDITIONAL_EXPRESSION,c,r),u},r._scanWord=function(){var e=[this.getCurChar()],r=this.getShaderPosition();for(this.advance(1);ed.isAlnum(this.getCurCharCode());)e.push(this.getCurChar()),this.advance(1);var n=this._createToken(),i=e.join(""),a=t._lexemeTable[i];return this._macroDefineExpectsNameToken?(this._macroDefineExpectsNameToken=!1,this._currentMacroName=i,this._currentMacroParamsLexeme=void 0,this._inMacroDefineValue&&(this._macroDefineExpectsParamsToken="("===this.getCurChar(),this._currentMacroValueStart=this._currentIndex),n.set(B.ID,i,r)):this._isVisibleMacro(i)?n.set(U.MACRO_CALL,i,r):n.set(null!=a?a:B.ID,i,r),n},r._isVisibleMacro=function(e){var t=this.macroDefineList[e];if(!t||0===t.length)return!1;for(var r=this._branchStack,n=0,i=t.length;n<i;n++)if(this._branchesOverlap(t[n].branch,r))return!0;return!1},r._scanNum=function(){var e=[];if("0"===this.getCurChar()){var t=this._source.charCodeAt(this._currentIndex+1);if(120===t||88===t){for(e.push(this.getCurChar()),this.advance(1),e.push(this.getCurChar()),this.advance(1);ed.isHexDigit(this.getCurCharCode());)e.push(this.getCurChar()),this.advance(1);2===e.length&&this.throwError(this.getShaderPosition(0),"lexing error, hex literal needs at least one digit."),this._scanIntegerSuffix(e);var r=this._createToken();return r.set(B.INT_CONSTANT,e.join(""),this.getShaderPosition(e.length)),r}}for(;ed.isDigit(this.getCurCharCode());)e.push(this.getCurChar()),this.advance(1);var n=this.getCurChar();if("."===n){for(e.push(n),this.advance(1);ed.isDigit(this.getCurCharCode());)e.push(this.getCurChar()),this.advance(1);this._scanFloatSuffix(e);var i=this._createToken();return i.set(B.FLOAT_CONSTANT,e.join(""),this.getShaderPosition(e.length)),i}if("e"===n||"E"===n){this._scanFloatSuffix(e);var a=this._createToken();return a.set(B.FLOAT_CONSTANT,e.join(""),this.getShaderPosition(e.length)),a}if("f"===n||"F"===n){e.push(n),this.advance(1);var o=this._createToken();return o.set(B.FLOAT_CONSTANT,e.join(""),this.getShaderPosition(e.length)),o}this._scanIntegerSuffix(e);var s=this._createToken();return s.set(B.INT_CONSTANT,e.join(""),this.getShaderPosition(e.length)),s},r._scanFloatSuffix=function(e){var t=this.getCurChar();if("e"===t||"E"===t){e.push(t),this.advance(1),("+"===(t=this.getCurChar())||"-"===t)&&(e.push(t),this.advance(1),t=this.getCurChar()),ed.isDigit(this.getCurCharCode())||this.throwError(this.getShaderPosition(0),"lexing error, invalid exponent suffix.");do e.push(t),this.advance(1),t=this.getCurChar();while(ed.isDigit(this.getCurCharCode()))}("f"===t||"F"===t)&&(e.push(t),this.advance(1))},r._scanIntegerSuffix=function(e){var t=this.getCurChar();("u"===t||"U"===t)&&(e.push(t),this.advance(1))},t._isCodegenBranchReachable=function(e){for(var t=0;t<e.length;t++){var r=e[t].condition;if((null==r?void 0:r.kind)==="constant"&&!r.value)return!1}return!0},t._isNonExpressionLeadingKeyword=function(e){var r=t._lexemeTable[e];return void 0!==r&&r!==U.True&&r!==U.False&&!e.startsWith("#")},t._skipLineContinuation=function(e,t,r){if(92!==e.charCodeAt(t)||t+1>=r)return t;var n=e.charCodeAt(t+1);return 10===n?t+2:13===n?t+2<r&&10===e.charCodeAt(t+2)?t+3:t+2:t},t._skipNonSemantic=function(e,r,n){for(var i=r;i<n;){var a=e.charCodeAt(i);if(32===a||9===a){i++;continue}var o=t._skipLineContinuation(e,i,n);if(o!==i){i=o;continue}var s=t._skipBlockComment(e,i,n);if(s!==i){i=s;continue}var c=t._skipLineComment(e,i,n);if(c!==i){i=c;continue}break}return i},t._normalizeValueText=function(e,r,n){for(var i="",a=r,o=!1;a<n;){var s=t._skipNonSemantic(e,a,n);if(s!==a){o=i.length>0,a=s;continue}var c=e.charCodeAt(a);if(32===c||9===c){o=i.length>0,a++;continue}o&&(i+=" ",o=!1),i+=e[a],a++}return i},t._sameCodegenBranch=function(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(e[r].conditionalGroup!==t[r].conditionalGroup||e[r].conditionalArm!==t[r].conditionalArm)return!1;return!0},t}(ed);ez._lexemeTable={const:U.CONST,bool:U.BOOL,float:U.FLOAT,double:U.DOUBLE,int:U.INT,uint:U.UINT,break:U.BREAK,continue:U.CONTINUE,do:U.DO,else:U.ELSE,for:U.FOR,if:U.IF,while:U.WHILE,discard:U.DISCARD,return:U.RETURN,bvec2:U.BVEC2,bvec3:U.BVEC3,bvec4:U.BVEC4,ivec2:U.IVEC2,ivec3:U.IVEC3,ivec4:U.IVEC4,uvec2:U.UVEC2,uvec3:U.UVEC3,uvec4:U.UVEC4,vec2:U.VEC2,vec3:U.VEC3,vec4:U.VEC4,mat2:U.MAT2,mat3:U.MAT3,mat4:U.MAT4,mat2x3:U.MAT2X3,mat2x4:U.MAT2X4,mat3x2:U.MAT3X2,mat3x4:U.MAT3X4,mat4x2:U.MAT4X2,mat4x3:U.MAT4X3,in:U.IN,out:U.OUT,inout:U.INOUT,sampler2D:U.SAMPLER2D,samplerCube:U.SAMPLER_CUBE,sampler3D:U.SAMPLER3D,sampler2DShadow:U.SAMPLER2D_SHADOW,samplerCubeShadow:U.SAMPLER_CUBE_SHADOW,sampler2DArray:U.SAMPLER2D_ARRAY,sampler2DArrayShadow:U.SAMPLER2D_ARRAY_SHADOW,isampler2D:U.I_SAMPLER2D,isampler3D:U.I_SAMPLER3D,isamplerCube:U.I_SAMPLER_CUBE,isampler2DArray:U.I_SAMPLER2D_ARRAY,usampler2D:U.U_SAMPLER2D,usampler3D:U.U_SAMPLER3D,usamplerCube:U.U_SAMPLER_CUBE,usampler2DArray:U.U_SAMPLER2D_ARRAY,struct:U.STRUCT,void:U.VOID,true:U.True,false:U.False,precision:U.PRECISION,precise:U.PRECISE,highp:U.HIGHP,mediump:U.MEDIUMP,lowp:U.LOWP,invariant:U.INVARIANT,flat:U.FLAT,smooth:U.SMOOTH,noperspective:U.NOPERSPECTIVE,centroid:U.CENTROID,layout:U.LAYOUT,location:U.LOCATION,"#if":U.MACRO_IF,"#ifdef":U.MACRO_IFDEF,"#ifndef":U.MACRO_IFNDEF,"#else":U.MACRO_ELSE,"#elif":U.MACRO_ELIF,"#endif":U.MACRO_ENDIF,"#undef":U.MACRO_UNDEF};var eW=((h={})[h.START=2e3]="START",h[h.gs_shader_program=2001]="gs_shader_program",h[h.global_declaration=2002]="global_declaration",h[h.variable_declaration=2003]="variable_declaration",h[h.variable_declaration_list=2004]="variable_declaration_list",h[h.variable_declaration_statement=2005]="variable_declaration_statement",h[h.array_specifier_list=2006]="array_specifier_list",h[h.array_specifier=2007]="array_specifier",h[h.ext_builtin_type_specifier_nonarray=2008]="ext_builtin_type_specifier_nonarray",h[h.precision_specifier=2009]="precision_specifier",h[h.variable_identifier=2010]="variable_identifier",h[h.variable_identifier_node=2011]="variable_identifier_node",h[h.primary_expression=2012]="primary_expression",h[h.postfix_expression=2013]="postfix_expression",h[h.integer_expression=2014]="integer_expression",h[h.function_call=2015]="function_call",h[h.function_call_generic=2016]="function_call_generic",h[h.function_call_header_no_parameters=2017]="function_call_header_no_parameters",h[h.function_call_header_with_parameters=2018]="function_call_header_with_parameters",h[h.function_call_parameter_list=2019]="function_call_parameter_list",h[h.function_call_header=2020]="function_call_header",h[h.function_identifier=2021]="function_identifier",h[h.constructor_identifier=2022]="constructor_identifier",h[h.unary_expression=2023]="unary_expression",h[h.unary_operator=2024]="unary_operator",h[h.multiplicative_expression=2025]="multiplicative_expression",h[h.additive_expression=2026]="additive_expression",h[h.shift_expression=2027]="shift_expression",h[h.relational_expression=2028]="relational_expression",h[h.equality_expression=2029]="equality_expression",h[h.and_expression=2030]="and_expression",h[h.inclusive_or_expression=2031]="inclusive_or_expression",h[h.exclusive_or_expression=2032]="exclusive_or_expression",h[h.logical_and_expression=2033]="logical_and_expression",h[h.logical_xor_expression=2034]="logical_xor_expression",h[h.logical_or_expression=2035]="logical_or_expression",h[h.conditional_expression=2036]="conditional_expression",h[h.assignment_expression=2037]="assignment_expression",h[h.assignment_operator=2038]="assignment_operator",h[h.expression=2039]="expression",h[h.integer_constant_expression=2040]="integer_constant_expression",h[h.integer_constant_expression_operator=2041]="integer_constant_expression_operator",h[h.declaration=2042]="declaration",h[h.function_prototype=2043]="function_prototype",h[h.function_declarator=2044]="function_declarator",h[h.function_header_with_parameters=2045]="function_header_with_parameters",h[h.function_header=2046]="function_header",h[h.function_parameter_list=2047]="function_parameter_list",h[h.parameter_declarator=2048]="parameter_declarator",h[h.parameter_declaration=2049]="parameter_declaration",h[h.parameter_qualifier=2050]="parameter_qualifier",h[h.parameter_type_specifier=2051]="parameter_type_specifier",h[h.init_declarator_list=2052]="init_declarator_list",h[h.single_declaration=2053]="single_declaration",h[h.fully_specified_type=2054]="fully_specified_type",h[h.type_qualifier=2055]="type_qualifier",h[h.single_type_qualifier=2056]="single_type_qualifier",h[h.storage_qualifier=2057]="storage_qualifier",h[h.precision_qualifier=2058]="precision_qualifier",h[h.interpolation_qualifier=2059]="interpolation_qualifier",h[h.invariant_qualifier=2060]="invariant_qualifier",h[h.type_specifier=2061]="type_specifier",h[h.type_specifier_nonarray=2062]="type_specifier_nonarray",h[h.type_specifier_no_prec=2063]="type_specifier_no_prec",h[h.basic_type=2064]="basic_type",h[h.struct_specifier=2065]="struct_specifier",h[h.struct_declaration_list=2066]="struct_declaration_list",h[h.struct_declaration=2067]="struct_declaration",h[h.layout_qualifier=2068]="layout_qualifier",h[h.struct_declarator_list=2069]="struct_declarator_list",h[h.struct_declarator=2070]="struct_declarator",h[h.identifier_list=2071]="identifier_list",h[h.decl_identifier=2072]="decl_identifier",h[h.initializer=2073]="initializer",h[h.initializer_list=2074]="initializer_list",h[h.declaration_statement=2075]="declaration_statement",h[h.simple_statement=2076]="simple_statement",h[h.compound_statement_no_scope=2077]="compound_statement_no_scope",h[h.statement_with_scope=2078]="statement_with_scope",h[h.compound_statement=2079]="compound_statement",h[h.statement=2080]="statement",h[h.statement_list=2081]="statement_list",h[h.iteration_statement_no_new_scope=2082]="iteration_statement_no_new_scope",h[h.expression_statement=2083]="expression_statement",h[h.selection_statement=2084]="selection_statement",h[h.selection_rest_statement=2085]="selection_rest_statement",h[h.condition=2086]="condition",h[h.conditionopt=2087]="conditionopt",h[h.iteration_statement=2088]="iteration_statement",h[h.for_init_statement=2089]="for_init_statement",h[h.for_rest_statement=2090]="for_rest_statement",h[h.jump_statement=2091]="jump_statement",h[h.external_declaration=2092]="external_declaration",h[h.function_definition=2093]="function_definition",h[h.field_selection=2094]="field_selection",h[h.bool_constant=2095]="bool_constant",h[h.function_identifier_node=2096]="function_identifier_node",h[h.typename_identifier_node=2097]="typename_identifier_node",h[h.scope_brace=2098]="scope_brace",h[h.scope_end_brace=2099]="scope_end_brace",h[h.macro_undef=2100]="macro_undef",h[h.macro_push_context=2101]="macro_push_context",h[h.macro_pop_context=2102]="macro_pop_context",h[h.macro_elif_expression=2103]="macro_elif_expression",h[h.macro_else_expression=2104]="macro_else_expression",h[h.global_macro_if_statement=2105]="global_macro_if_statement",h[h.global_macro_declaration=2106]="global_macro_declaration",h[h.global_macro_branch=2107]="global_macro_branch",h[h.macro_struct_declaration=2108]="macro_struct_declaration",h[h.macro_struct_branch=2109]="macro_struct_branch",h[h.macro_if_statement=2110]="macro_if_statement",h[h.macro_branch=2111]="macro_branch",h[h.macro_param_case_list=2112]="macro_param_case_list",h[h.macro_param_block=2113]="macro_param_block",h[h.macro_parameter_branch=2114]="macro_parameter_branch",h[h.macro_call_arg_case_list=2115]="macro_call_arg_case_list",h[h.macro_call_arg_block=2116]="macro_call_arg_block",h[h.macro_call_arg_branch=2117]="macro_call_arg_branch",h[h.macro_call_symbol=2118]="macro_call_symbol",h[h.macro_call_function=2119]="macro_call_function",h[h.macro_define=2120]="macro_define",h[h._ignore=2121]="_ignore",h),ej=function e(t,r){this.goal=t,this.derivation=r,this.id=e._id++,e.pool.set(this.id,this)};ej._id=0,ej.pool=new Map,(d={})[d.GenType=200]="GenType",d[d.GenIntType=201]="GenIntType",d[d.GenUintType=202]="GenUintType",d[d.GenBoolType=203]="GenBoolType",d[d.Mat=204]="Mat",d[d.BoolVec=205]="BoolVec",d[d.IntVec=206]="IntVec",d[d.UintVec=207]="UintVec",d[d.Vec=208]="Vec",d[d.GVec4=209]="GVec4",d[d.GSampler2D=210]="GSampler2D",d[d.GSampler3D=211]="GSampler3D",d[d.GSamplerCube=212]="GSamplerCube",d[d.GSampler2DArray=213]="GSampler2DArray";var eq=((m={})[200]={dimension:0,members:[U.FLOAT,U.VEC2,U.VEC3,U.VEC4]},m[201]={dimension:0,members:[U.INT,U.IVEC2,U.IVEC3,U.IVEC4]},m[202]={dimension:0,members:[U.UINT,U.UVEC2,U.UVEC3,U.UVEC4]},m[203]={dimension:0,members:[U.BOOL,U.BVEC2,U.BVEC3,U.BVEC4]},m[208]={dimension:0,members:[U.VEC2,U.VEC3,U.VEC4]},m[206]={dimension:0,members:[U.IVEC2,U.IVEC3,U.IVEC4]},m[207]={dimension:0,members:[U.UVEC2,U.UVEC3,U.UVEC4]},m[205]={dimension:0,members:[U.BVEC2,U.BVEC3,U.BVEC4]},m[204]={dimension:0,members:[U.MAT2,U.MAT3,U.MAT4]},m[210]={dimension:1,members:[U.SAMPLER2D,U.I_SAMPLER2D,U.U_SAMPLER2D]},m[211]={dimension:1,members:[U.SAMPLER3D,U.I_SAMPLER3D,U.U_SAMPLER3D]},m[212]={dimension:1,members:[U.SAMPLER_CUBE,U.I_SAMPLER_CUBE,U.U_SAMPLER_CUBE]},m[213]={dimension:1,members:[U.SAMPLER2D_ARRAY,U.I_SAMPLER2D_ARRAY,U.U_SAMPLER2D_ARRAY]},m[209]={dimension:1,members:[U.VEC4,U.IVEC4,U.UVEC4]},m),eH=new Map,eX=function(){function e(e,t,r){for(var n=arguments.length,i=Array(n>3?n-3:0),a=3;a<n;a++)i[a-3]=arguments[a];this.ident=e,this._returnType=t,this.args=i,this.scope=r}return e._create=function(t,r){for(var n,i=arguments.length,a=Array(i>2?i-2:0),o=2;o<i;o++)a[o-2]=arguments[o];var s=eo(e,[].concat([t,r,eG.ALL],a)),c=null!=(n=eH.get(t))?n:[];c.push(s),eH.set(t,c)},e._createWithScope=function(t,r,n){for(var i,a=arguments.length,o=Array(a>3?a-3:0),s=3;s<a;s++)o[s-3]=arguments[s];var c=eo(e,[].concat([t,r,n],o)),u=null!=(i=eH.get(t))?i:[];u.push(c),eH.set(t,u)},e.resolveOverload=function(e,t){var r,n=eH.get(e);if(n)for(var i=null!=(r=null==t?void 0:t.length)?r:0,a=0,o=n.length;a<o;a++){var s=n[a],c=s.args;if(c.length===i){for(var u=-1,l=-1,h=!0,d=!1,p=!1,f=0;f<i;f++){var _=c[f],v=t[f],m=eq[_];if(3e3===v){m&&(0===m.dimension?d=!0:p=!0);continue}if(m){var g=m.members.indexOf(v);if(-1===g){h=!1;break}if(0===m.dimension){if(-1===u)u=g;else if(u!==g){h=!1;break}}else if(-1===l)l=g;else if(l!==g){h=!1;break}}else if(_!==v){h=!1;break}}if(h){var y=eq[s._returnType];if(!y)return s._realReturnType=s._returnType,s;var S=0===y.dimension,b=S?d:p,x=S?u:l;return s._realReturnType=-1===x||b?3e3:y.members[x],s}}}},e.isExist=function(e){return eH.has(e)},er(e,[{key:"realReturnType",get:function(){return this._realReturnType}}]),e}();eX._create("radians",200,200),eX._create("degrees",200,200),eX._create("sin",200,200),eX._create("cos",200,200),eX._create("tan",200,200),eX._create("asin",200,200),eX._create("acos",200,200),eX._create("atan",200,200,200),eX._create("atan",200,200),eX._create("sinh",200,200),eX._create("cosh",200,200),eX._create("tanh",200,200),eX._create("asinh",200,200),eX._create("acosh",200,200),eX._create("atanh",200,200),eX._create("pow",200,200,200),eX._create("exp",200,200),eX._create("log",200,200),eX._create("exp2",200,200),eX._create("log2",200,200),eX._create("sqrt",200,200),eX._create("inversesqrt",200,200),eX._create("abs",200,200),eX._create("abs",201,201),eX._create("sign",200,200),eX._create("sign",201,201),eX._create("floor",200,200),eX._create("trunc",200,200),eX._create("round",200,200),eX._create("roundEven",200,200),eX._create("ceil",200,200),eX._create("fract",200,200),eX._create("mod",200,200,U.FLOAT),eX._create("mod",200,200,200),eX._create("min",200,200,200),eX._create("min",200,200,U.FLOAT),eX._create("min",201,201,201),eX._create("min",201,201,U.INT),eX._create("min",202,202,202),eX._create("min",202,202,U.UINT),eX._create("max",200,200,200),eX._create("max",200,200,U.FLOAT),eX._create("max",201,201,201),eX._create("max",201,201,U.INT),eX._create("clamp",200,200,200,200),eX._create("clamp",200,200,U.FLOAT,U.FLOAT),eX._create("clamp",201,201,201,201),eX._create("clamp",201,201,U.INT,U.INT),eX._create("clamp",202,202,202,202),eX._create("clamp",202,202,U.UINT,U.UINT),eX._create("mix",200,200,200,200),eX._create("mix",200,200,200,U.FLOAT),eX._create("mix",200,200,200,203),eX._create("step",200,200,200),eX._create("step",200,U.FLOAT,200),eX._create("smoothstep",200,200,200,200),eX._create("smoothstep",200,U.FLOAT,U.FLOAT,200),eX._create("isnan",203,200),eX._create("isinf",203,200),eX._create("floatBitsToInt",200,200),eX._create("floatBitsToUint",202,200),eX._create("intBitsToFloat",200,201),eX._create("uintBitsToFloat",200,202),eX._create("packSnorm2x16",U.UINT,U.VEC2),eX._create("unpackSnorm2x16",U.VEC2,U.UINT),eX._create("packUnorm2x16",U.UINT,U.VEC2),eX._create("unpackUnorm2x16",U.VEC2,U.UINT),eX._create("packHalf2x16",U.UINT,U.VEC2),eX._create("unpackHalf2x16",U.VEC2,U.UINT),eX._create("length",U.FLOAT,200),eX._create("distance",U.FLOAT,200,200),eX._create("dot",U.FLOAT,200,200),eX._create("cross",U.VEC3,U.VEC3,U.VEC3),eX._create("normalize",200,200),eX._create("faceforward",200,200,200,200),eX._create("reflect",200,200,200),eX._create("refract",200,200,200,U.FLOAT),eX._create("matrixCompMult",204,204,204),eX._create("outerProduct",U.MAT2,U.VEC2,U.VEC2),eX._create("outerProduct",U.MAT3,U.VEC3,U.VEC3),eX._create("outerProduct",U.MAT4,U.VEC4,U.VEC4),eX._create("outerProduct",U.MAT2X3,U.VEC3,U.VEC2),eX._create("outerProduct",U.MAT3X2,U.VEC2,U.VEC3),eX._create("outerProduct",U.MAT2X4,U.VEC4,U.VEC2),eX._create("outerProduct",U.MAT4X2,U.VEC2,U.VEC4),eX._create("outerProduct",U.MAT3X4,U.VEC4,U.VEC3),eX._create("outerProduct",U.MAT4X3,U.VEC3,U.VEC4),eX._create("transpose",U.MAT2,U.MAT2),eX._create("transpose",U.MAT3,U.MAT3),eX._create("transpose",U.MAT4,U.MAT4),eX._create("transpose",U.MAT2X3,U.MAT3X2),eX._create("transpose",U.MAT3X2,U.MAT2X3),eX._create("transpose",U.MAT4X2,U.MAT2X4),eX._create("transpose",U.MAT2X4,U.MAT4X2),eX._create("transpose",U.MAT3X4,U.MAT4X3),eX._create("transpose",U.MAT4X3,U.MAT3X4),eX._create("determinant",U.FLOAT,U.MAT2),eX._create("determinant",U.FLOAT,U.MAT3),eX._create("determinant",U.FLOAT,U.MAT4),eX._create("inverse",U.MAT2,U.MAT2),eX._create("inverse",U.MAT3,U.MAT3),eX._create("inverse",U.MAT4,U.MAT4),eX._create("lessThan",205,208,208),eX._create("lessThan",205,206,206),eX._create("lessThan",205,207,207),eX._create("lessThanEqual",205,208,208),eX._create("lessThanEqual",205,206,206),eX._create("lessThanEqual",205,207,207),eX._create("greaterThan",205,208,208),eX._create("greaterThan",205,206,206),eX._create("greaterThan",205,207,207),eX._create("greaterThanEqual",205,208,208),eX._create("greaterThanEqual",205,206,206),eX._create("greaterThanEqual",205,207,207),eX._create("equal",205,208,208),eX._create("equal",205,206,206),eX._create("equal",205,207,207),eX._create("equal",205,205,205),eX._create("notEqual",205,208,208),eX._create("notEqual",205,206,206),eX._create("notEqual",205,207,207),eX._create("notEqual",205,205,205),eX._create("any",U.BOOL,205),eX._create("all",U.BOOL,205),eX._create("not",205,205),eX._create("textureSize",U.IVEC2,210,U.INT),eX._create("textureSize",U.IVEC3,211,U.INT),eX._create("textureSize",U.IVEC2,212,U.INT),eX._create("textureSize",U.IVEC2,U.SAMPLER2D_SHADOW,U.INT),eX._create("textureSize",U.IVEC2,U.SAMPLER_CUBE_SHADOW,U.INT),eX._create("textureSize",U.IVEC3,213,U.INT),eX._create("textureSize",U.IVEC3,U.SAMPLER2D_ARRAY_SHADOW,U.INT),eX._create("texture2D",209,210,U.VEC2),eX._create("texture2D",209,210,U.VEC2,U.FLOAT),eX._create("texture",209,210,U.VEC2,U.FLOAT),eX._create("texture",209,210,U.VEC2),eX._create("texture",209,211,U.VEC3,U.FLOAT),eX._create("texture",209,211,U.VEC3),eX._create("texture",209,212,U.VEC3,U.FLOAT),eX._create("texture",209,212,U.VEC3),eX._create("texture",U.FLOAT,U.SAMPLER2D_SHADOW,U.VEC3,U.FLOAT),eX._create("texture",U.FLOAT,U.SAMPLER2D_SHADOW,U.VEC3),eX._create("texture",U.FLOAT,U.SAMPLER_CUBE_SHADOW,U.VEC4,U.FLOAT),eX._create("texture",U.FLOAT,U.SAMPLER_CUBE_SHADOW,U.VEC4),eX._create("texture",209,U.SAMPLER2D_ARRAY,U.VEC3,U.FLOAT),eX._create("texture",209,U.SAMPLER2D_ARRAY,U.VEC3),eX._create("texture",U.FLOAT,U.SAMPLER2D_ARRAY_SHADOW,U.VEC4),eX._create("textureProj",209,210,U.VEC3,U.FLOAT),eX._create("textureProj",209,210,U.VEC3),eX._create("textureProj",209,210,U.VEC4,U.FLOAT),eX._create("textureProj",209,210,U.VEC4),eX._create("textureProj",209,211,U.VEC4,U.FLOAT),eX._create("textureProj",209,211,U.VEC4),eX._create("textureProj",U.FLOAT,U.SAMPLER2D_SHADOW,U.VEC4,U.FLOAT),eX._create("textureProj",U.FLOAT,U.SAMPLER2D_SHADOW,U.VEC4),eX._create("textureLod",209,210,U.VEC2,U.FLOAT),eX._create("textureLod",209,211,U.VEC3,U.FLOAT),eX._create("textureLod",209,212,U.VEC3,U.FLOAT),eX._create("textureLod",U.FLOAT,U.SAMPLER2D_SHADOW,U.VEC3,U.FLOAT),eX._create("textureLod",209,213,U.VEC3,U.FLOAT),eX._create("texture2DLod",209,210,U.VEC2,U.FLOAT),eX._create("texture2DLodEXT",209,210,U.VEC2,U.FLOAT),eX._create("texture2DLodEXT",209,211,U.VEC3,U.FLOAT),eX._create("textureCube",209,212,U.VEC3),eX._create("textureCube",209,212,U.VEC3,U.FLOAT),eX._create("textureCubeLod",209,212,U.VEC3,U.FLOAT),eX._create("textureCubeLodEXT",209,212,U.VEC3,U.FLOAT),eX._create("textureOffset",209,210,U.VEC2,U.IVEC2,U.FLOAT),eX._create("textureOffset",209,210,U.VEC2,U.IVEC2),eX._create("textureOffset",209,211,U.VEC3,U.IVEC3,U.FLOAT),eX._create("textureOffset",209,211,U.VEC3,U.IVEC3),eX._create("textureOffset",U.FLOAT,U.SAMPLER2D_SHADOW,U.VEC3,U.IVEC2,U.FLOAT),eX._create("textureOffset",U.FLOAT,U.SAMPLER2D_SHADOW,U.VEC3,U.IVEC2),eX._create("textureOffset",209,213,U.VEC3,U.IVEC2,U.FLOAT),eX._create("textureOffset",209,213,U.VEC3,U.IVEC2),eX._create("texelFetch",209,210,U.IVEC2,U.INT),eX._create("texelFetch",209,211,U.IVEC3,U.INT),eX._create("texelFetch",209,213,U.IVEC3,U.INT),eX._create("texelFetchOffset",209,210,U.IVEC2,U.INT,U.IVEC2),eX._create("texelFetchOffset",209,211,U.IVEC3,U.INT,U.IVEC3),eX._create("texelFetchOffset",209,213,U.IVEC3,U.INT,U.IVEC2),eX._create("textureProjOffset",209,210,U.VEC3,U.IVEC2,U.FLOAT),eX._create("textureProjOffset",209,210,U.VEC3,U.IVEC2),eX._create("textureProjOffset",209,210,U.VEC4,U.IVEC2,U.FLOAT),eX._create("textureProjOffset",209,210,U.VEC4,U.IVEC2),eX._create("textureProjOffset",209,211,U.VEC4,U.IVEC3,U.FLOAT),eX._create("textureProjOffset",209,211,U.VEC4,U.IVEC3),eX._create("textureProjOffset",U.FLOAT,U.SAMPLER2D_SHADOW,U.VEC4,U.IVEC2,U.FLOAT),eX._create("textureProjOffset",U.FLOAT,U.SAMPLER2D_SHADOW,U.VEC4,U.IVEC2),eX._create("textureLodOffset",209,210,U.VEC2,U.FLOAT,U.IVEC2),eX._create("textureLodOffset",209,211,U.VEC3,U.FLOAT,U.IVEC3),eX._create("textureLodOffset",U.FLOAT,U.SAMPLER2D_SHADOW,U.VEC3,U.FLOAT,U.IVEC2),eX._create("textureLodOffset",209,213,U.VEC3,U.FLOAT,U.IVEC2),eX._create("textureProjLod",209,210,U.VEC3,U.FLOAT),eX._create("textureProjLod",209,210,U.VEC4,U.FLOAT),eX._create("textureProjLod",209,211,U.VEC4,U.FLOAT),eX._create("textureProjLod",U.FLOAT,U.SAMPLER2D_SHADOW,U.VEC4,U.FLOAT),eX._create("textureProjLodOffset",209,210,U.VEC3,U.FLOAT,U.IVEC2),eX._create("textureProjLodOffset",209,210,U.VEC4,U.FLOAT,U.IVEC2),eX._create("textureProjLodOffset",209,211,U.VEC4,U.FLOAT,U.IVEC3),eX._create("textureProjLodOffset",U.FLOAT,U.SAMPLER2D_SHADOW,U.VEC4,U.FLOAT,U.IVEC2),eX._create("textureGrad",209,210,U.VEC2,U.VEC2,U.VEC2),eX._create("textureGrad",209,211,U.VEC3,U.VEC3,U.VEC3),eX._create("textureGrad",209,212,U.VEC3,U.VEC3,U.VEC3),eX._create("textureGrad",U.FLOAT,U.SAMPLER2D_SHADOW,U.VEC3,U.VEC2,U.VEC2),eX._create("textureGrad",U.FLOAT,U.SAMPLER_CUBE_SHADOW,U.VEC4,U.VEC3,U.VEC3),eX._create("textureGrad",209,213,U.VEC3,U.VEC2,U.VEC2),eX._create("textureGrad",U.FLOAT,U.SAMPLER2D_ARRAY_SHADOW,U.VEC4,U.VEC2,U.VEC2),eX._create("textureGradOffset",209,210,U.VEC2,U.VEC2,U.VEC2,U.IVEC2),eX._create("textureGradOffset",209,211,U.VEC3,U.VEC3,U.VEC3,U.IVEC3),eX._create("textureGradOffset",U.FLOAT,U.SAMPLER2D_SHADOW,U.VEC3,U.VEC2,U.VEC2,U.IVEC2),eX._create("textureGradOffset",209,213,U.VEC3,U.VEC2,U.VEC2,U.IVEC2),eX._create("textureGradOffset",U.FLOAT,U.SAMPLER2D_ARRAY_SHADOW,U.VEC3,U.VEC2,U.VEC2,U.IVEC2),eX._create("textureProjGrad",209,210,U.VEC3,U.VEC2,U.VEC2),eX._create("textureProjGrad",209,210,U.VEC4,U.VEC2,U.VEC2),eX._create("textureProjGrad",209,211,U.VEC4,U.VEC3,U.VEC3),eX._create("textureProjGrad",U.FLOAT,U.SAMPLER2D_SHADOW,U.VEC4,U.VEC2,U.VEC2),eX._create("textureProjGradOffset",209,210,U.VEC3,U.VEC2,U.VEC2,U.IVEC2),eX._create("textureProjGradOffset",209,210,U.VEC4,U.VEC2,U.VEC2,U.IVEC2),eX._create("textureProjGradOffset",209,211,U.VEC4,U.VEC3,U.VEC3,U.IVEC3),eX._create("textureProjGradOffset",U.FLOAT,U.SAMPLER2D_SHADOW,U.VEC4,U.VEC2,U.VEC2,U.IVEC2),eX._createWithScope("dFdx",200,eG.FRAGMENT,200),eX._createWithScope("dFdy",200,eG.FRAGMENT,200),eX._createWithScope("fwidth",200,eG.FRAGMENT,200);var eQ=((p={}).VertexPosition="vertex-position",p.FragmentOutput0="fragment-output-0",p.FragmentOutputArray="fragment-output-array",p.FragmentDepth="fragment-depth",p),eK=new Map,eY=function(){function e(e,t,r,n){this.type=e,this.lexeme=t,this.scope=r,this.semantic=n}return e.createVariable=function(t,r,n,i){void 0===n&&(n=eG.ALL);var a=new e(r,t,n,i);eK.set(t,a)},e.getVar=function(e){return eK.get(e)},e}();eY.createVariable("gl_VertexID",U.INT,eG.VERTEX),eY.createVariable("gl_InstanceID",U.INT,eG.VERTEX),eY.createVariable("gl_Position",U.VEC4,eG.VERTEX,eQ.VertexPosition),eY.createVariable("gl_PointSize",U.FLOAT,eG.VERTEX),eY.createVariable("gl_FragCoord",U.VEC4,eG.FRAGMENT),eY.createVariable("gl_FrontFacing",U.BOOL,eG.FRAGMENT),eY.createVariable("gl_FragDepth",U.FLOAT,eG.FRAGMENT,eQ.FragmentDepth),eY.createVariable("gl_FragDepthEXT",U.FLOAT,eG.FRAGMENT,eQ.FragmentDepth),eY.createVariable("gl_PointCoord",U.VEC2,eG.FRAGMENT),eY.createVariable("gl_FragColor",U.VEC4,eG.FRAGMENT,eQ.FragmentOutput0),eY.createVariable("gl_FragData",U.VEC4_ARRAY,eG.FRAGMENT,eQ.FragmentOutputArray),eY.createVariable("gl_MaxVertexAttribs",U.INT),eY.createVariable("gl_MaxVertexUniformVectors",U.INT),eY.createVariable("gl_MaxVertexOutputVectors",U.INT),eY.createVariable("gl_MaxFragmentInputVectors",U.INT),eY.createVariable("gl_MaxVertexTextureImageUnits",U.INT),eY.createVariable("gl_MaxCombinedTextureImageUnits",U.INT),eY.createVariable("gl_MaxTextureImageUnits",U.INT),eY.createVariable("gl_MaxFragmentUniformVectors",U.INT),eY.createVariable("gl_MaxDrawBuffers",U.INT),eY.createVariable("gl_MinProgramTexelOffset",U.INT),eY.createVariable("gl_MaxProgramTexelOffset",U.INT);var eJ=function(e,t,r,n){void 0===n&&(n=[]),this.type=e,this.typeLexeme=t,this.arraySpecifier=r,this.structDeclarations=n},eZ=((f={})[f.VAR=0]="VAR",f[f.FN=1]="FN",f[f.STRUCT=2]="STRUCT",f[f.Any=3]="Any",f),e$=function(){function e(e,t,r,n,i,a){void 0===a&&(a=!1),this.ident=e,this.type=t,this.astNode=r,this.dataType=n,this.paramSignature=i,this.isInMacroBranch=a,this.sourceScope=0,this.branchSignature=K}var t=e.prototype;return t.set=function(e,t,r,n,i){this.ident=e,this.type=t,this.astNode=r,this.dataType=n,this.paramSignature=i},t.equal=function(e){if(3!==e.type&&this.type!==e.type)return!1;if(1===this.type){if(!e.astNode&&!e.paramSignature)return!0;var t,r=this.astNode.protoType.paramSig,n=null!=(t=e.paramSignature)?t:e.astNode.protoType.paramSig,i=null==r?void 0:r.length;if(i!==(null==n?void 0:n.length))return!1;for(var a=0;a<i;a++){var o=r[a],s=n[a];if(3e3!==o&&3e3!==s&&o!==s)return!1}}return!0},e}(),e0=function(e){function t(t,r,n,i){void 0===n&&(n=[]),void 0===i&&(i=[]);var a,o=new eJ(r.protoType.returnType.type,r.protoType.returnType.typeSpecifier.lexeme,void 0,r.protoType.returnType.typeSpecifier.structDeclarations);return(a=e.call(this,t,eZ.FN,r,o)||this).localVariables=n.slice(),a.calledFunctions=i.slice(),a}return ei(t,e),t}(e$),e1=function(e){function t(t,r){return e.call(this,t,eZ.STRUCT,r)||this}return ei(t,e),t}(e$),e2=function(e){function t(t,r,n,i,a,o){var s;return void 0===a&&(a=!1),void 0===o&&(o=!1),(s=e.call(this,t,eZ.VAR,i,r)||this).isGlobalVariable=n,s.isConst=a,s.isUniform=o,s}return ei(t,e),t}(e$),e3=function(){function e(){}return e.isAssignable=function(e,t){return void 0==e||void 0==t||3e3===e||3e3===t||e===t},e.typeName=function(e){var t;return"string"==typeof e?e:void 0==e?"unknown":(null!=(t=U[e])?t:String(e)).toLowerCase()},e.isSamplerType=function(e){switch(e){case U.SAMPLER2D:case U.SAMPLER3D:case U.SAMPLER_CUBE:case U.SAMPLER2D_SHADOW:case U.SAMPLER_CUBE_SHADOW:case U.SAMPLER2D_ARRAY:case U.SAMPLER2D_ARRAY_SHADOW:case U.I_SAMPLER2D:case U.I_SAMPLER3D:case U.I_SAMPLER_CUBE:case U.I_SAMPLER2D_ARRAY:case U.U_SAMPLER2D:case U.U_SAMPLER3D:case U.U_SAMPLER_CUBE:case U.U_SAMPLER2D_ARRAY:return!0;default:return!1}},e.isBoolType=function(e){return e===U.BOOL||e===U.BVEC2||e===U.BVEC3||e===U.BVEC4},e.isIntegerType=function(e){switch(e){case U.INT:case U.UINT:case U.IVEC2:case U.IVEC3:case U.IVEC4:case U.UVEC2:case U.UVEC3:case U.UVEC4:return!0;default:return!1}},e.nonArithmeticOperand=function(e){return void 0!=e&&3e3!==e&&(this.isBoolType(e)||this.isSamplerType(e)||"string"==typeof e)},e.isScalarType=function(e){return e===U.FLOAT||e===U.INT||e===U.UINT||e===U.BOOL},e.arithmeticOperation=function(e,t,r){if(void 0==e||void 0==t||3e3===e||3e3===t)return{resultType:3e3,valid:void 0};var n=this._arithmeticFamily(e),i=this._arithmeticFamily(t);if(!n||!i)return{resultType:3e3,valid:!1,reason:"non-arithmetic"};if(n!==i)return{resultType:3e3,valid:!1,reason:"family-mismatch"};if("%"===r&&"float"===n)return{resultType:3e3,valid:!1,reason:"integer-required"};var a=this.isScalarType(e),o=this.isScalarType(t);if(a||o)return{resultType:a?t:e,valid:!0};var s=this.vectorComponentCount(e),c=this.vectorComponentCount(t),u=this.matrixDimensions(e),l=this.matrixDimensions(t);return s&&c?s===c?{resultType:e,valid:!0}:{resultType:3e3,valid:!1,reason:"shape-mismatch"}:u&&l?"*"===r?u.columns===l.rows?{resultType:this._matrixType(l.columns,u.rows),valid:!0}:{resultType:3e3,valid:!1,reason:"shape-mismatch"}:u.columns===l.columns&&u.rows===l.rows?{resultType:e,valid:!0}:{resultType:3e3,valid:!1,reason:"shape-mismatch"}:"*"===r&&u&&c?u.columns===c?{resultType:this._vectorType(u.rows),valid:!0}:{resultType:3e3,valid:!1,reason:"shape-mismatch"}:"*"===r&&s&&l&&s===l.rows?{resultType:this._vectorType(l.columns),valid:!0}:{resultType:3e3,valid:!1,reason:"shape-mismatch"}},e.arithmeticResultType=function(e,t,r){return void 0===r&&(r="+"),this.arithmeticOperation(e,t,r).resultType},e._arithmeticFamily=function(e){if(!("string"==typeof e||this.isBoolType(e)||this.isSamplerType(e))){if(this.matrixDimensions(e))return"float";switch(e){case U.FLOAT:case U.VEC2:case U.VEC3:case U.VEC4:return"float";case U.INT:case U.IVEC2:case U.IVEC3:case U.IVEC4:return"int";case U.UINT:case U.UVEC2:case U.UVEC3:case U.UVEC4:return"uint";default:return}}},e._vectorType=function(e){return 2===e?U.VEC2:3===e?U.VEC3:4===e?U.VEC4:3e3},e._matrixType=function(e,t){var r;return null!=(r=U["MAT"+e+(e===t?"":"X"+t)])?r:3e3},e.vectorComponentCount=function(e){switch(e){case U.VEC2:case U.IVEC2:case U.UVEC2:case U.BVEC2:return 2;case U.VEC3:case U.IVEC3:case U.UVEC3:case U.BVEC3:return 3;case U.VEC4:case U.IVEC4:case U.UVEC4:case U.BVEC4:return 4;default:return 0}},e.matrixComponentCount=function(e){var t=this.matrixDimensions(e);return t?t.columns*t.rows:0},e.matrixDimensions=function(e){switch(e){case U.MAT2:return{columns:2,rows:2};case U.MAT3:return{columns:3,rows:3};case U.MAT4:return{columns:4,rows:4};case U.MAT2X3:return{columns:2,rows:3};case U.MAT3X2:return{columns:3,rows:2};case U.MAT2X4:return{columns:2,rows:4};case U.MAT4X2:return{columns:4,rows:2};case U.MAT3X4:return{columns:3,rows:4};case U.MAT4X3:return{columns:4,rows:3};default:return}},e}(),e4=function(){function e(){}return e.unwrapNodeByType=function(t,r){var n=t.children[0];if(!z(n,Y))return n.nt===r?n:e.unwrapNodeByType(n,r)},e.parseMacroParamList=function(e){var t=e.replace(/^\s*\(\s*|\s*\)\s*$/g,"");return t?t.split(",").map(function(e){return e.trim()}).filter(Boolean):[]},e.unwrapBareIdentifier=function(e,t){for(var r=e;;){if(z(r,tn.VariableIdentifier))return r;if(t.allowParens&&z(r,tn.PrimaryExpression)&&3===r.children.length){var n=r.children[1];if(!z(n,tr))return;r=n;continue}if(z(r,tn.ExpressionAstNode)&&1===r.children.length){var i=r.children[0];if(!z(i,tr))return;r=i;continue}return}},e.extractDirectIdentLexeme=function(t){var r=e.unwrapBareIdentifier(t,{allowParens:!0});if(!r)return null;var n=r.children[0];return z(n,Y)?n.lexeme:null},e.lastStatement=function(t){if(z(t,tn.Statement)||z(t,tn.SimpleStatement)||z(t,tn.CompoundStatement)||z(t,tn.CompoundStatementNoScope)){if(2===t.children.length)return;for(var r,n=j(t.children);!(r=n()).done;){var i=r.value;if(z(i,tr)){var a=e.lastStatement(i);if(a)return a}}return}if(z(t,tn.StatementList)){for(var o=t.children.length-1;o>=0;o--){var s=t.children[o];if(z(s,tr)){var c=e.lastStatement(s);if(c)return c}}return}return t},e.swizzleError=function(t,r,n){if(void 0===n&&(n=e3.vectorComponentCount(t)),0===n)return null;if(r.length<1||r.length>4)return'Invalid swizzle ".'+r+'": a vector swizzle selects 1-4 components.';for(var i,a=e._swizzleSets,o=-1,s=j(r);!(i=s()).done;){for(var c=i.value,u=!1,l=0;l<a.length;l++){var h=a[l].indexOf(c);if(-1!==h){if(-1===o)o=l;else if(o!==l)return'Invalid swizzle ".'+r+'": components must come from one set (xyzw, rgba, or stpq).';if(h>=n)return'Invalid swizzle ".'+r+"\": component '"+c+"' is out of range for a "+n+"-component vector.";u=!0;break}}if(!u)return'Invalid swizzle ".'+r+"\": '"+c+"' is not a vector component."}return null},e.constNumericValue=function(e){for(var t=e;;){if(z(t,tn.PrimaryExpression)){if(3===t.children.length){var r=t.children[1];if(!z(r,tr))return;t=r;continue}var n=t.children[0];if(z(n,Y)&&(n.type===B.INT_CONSTANT||n.type===B.FLOAT_CONSTANT)){var i=Number(n.lexeme);return Number.isNaN(i)?void 0:i}return}if(z(t,tn.ExpressionAstNode)&&1===t.children.length){var a=t.children[0];if(!z(a,tr))return;t=a;continue}return}},e.constIntegerValue=function(t){return e._constIntegerValue(t,new Set)},e._constIntegerValue=function(t,r){if(z(t,tn.PrimaryExpression)){if(3===t.children.length){var n=t.children[1];return z(n,tr)?e._constIntegerValue(n,r):void 0}var i=t.children[0];if(z(i,Y)&&i.type===B.INT_CONSTANT){var a=Number(i.lexeme.replace(/[uU]$/,""));return Number.isSafeInteger(a)?e._normalizeInteger(a,t.type):void 0}}var o=e.unwrapBareIdentifier(t,{allowParens:!0});if(o){if(!z(o.children[0],Y))return;var s=o.resolvedSymbols();if(!s.length)return;for(var c,u,l=j(s);!(u=l()).done;){var h=u.value;if(!z(h,e2)||!h.isConst||r.has(h))return;var d=e._constInitializer(h);if(!d)return;r.add(h);var p=e._constIntegerValue(d,r);if(r.delete(h),void 0===p||void 0!==c&&c!==p)return;c=p}return c}if(z(t,tn.FunctionCallGeneric)){var f=t.children[0];if("int"!==f.ident&&"uint"!==f.ident)return;var _=t.children[2];if(!z(_,tn.FunctionCallParameterList)||1!==_.paramNodes.length)return;var v=e._constIntegerValue(_.paramNodes[0],r);return void 0===v?void 0:e._normalizeInteger(v,t.type)}var m=t.children,g=z(t,tn.ExpressionAstNode)?t.type:void 0;if(1===m.length){var y=m[0];return z(y,tr)?e._constIntegerValue(y,r):void 0}if(z(t,tn.ConditionalExpression)&&5===m.length){var S=m[0],b=m[2],x=m[4];if(!z(S,tr)||!z(b,tr)||!z(x,tr))return;var E=e._constIntegerValue(S,r);return void 0===E?void 0:e._constIntegerValue(0!==E?b:x,r)}if(2===m.length&&z(m[1],tr)){var C,A=e._operatorLexeme(m[0]),T=e._constIntegerValue(m[1],r);if(void 0===A||void 0===T)return;if("+"===A)C=T;else if("-"===A)C=-T;else if("~"===A)C=~T;else{if("!"!==A)return;C=0===T?1:0}return e._normalizeInteger(C,g)}if(3===m.length&&z(m[0],tr)&&z(m[2],tr)){if(z(t,tn.AssignmentExpression))return;var O,I=e._operatorLexeme(m[1]),R=e._constIntegerValue(m[0],r),M=e._constIntegerValue(m[2],r);if(void 0===I||void 0===R||void 0===M)return;switch(I){case"+":O=R+M;break;case"-":O=R-M;break;case"*":O=R*M;break;case"/":if(0===M)return;O=Math.trunc(R/M);break;case"%":if(0===M)return;O=R%M;break;case"<<":O=R<<M;break;case">>":O=g===U.UINT?R>>>M:R>>M;break;case"&":O=R&M;break;case"^":O=R^M;break;case"|":O=R|M;break;case"&&":O=0!==R&&0!==M?1:0;break;case"^^":O=0!==R!=(0!==M)?1:0;break;case"||":O=0!==R||0!==M?1:0;break;case"<":O=R<M?1:0;break;case">":O=R>M?1:0;break;case"<=":O=R<=M?1:0;break;case">=":O=R>=M?1:0;break;case"==":O=R===M?1:0;break;case"!=":O=R!==M?1:0;break;default:return}return e._normalizeInteger(O,g)}},e._constInitializer=function(e){var t,r=e.astNode;return z(r,tn.InitDeclaratorList)||z(r,tn.VariableDeclaration)?null==(t=r.declarator)?void 0:t.initializer:z(r,tr)?r:void 0},e._operatorLexeme=function(t){if(z(t,Y))return t.lexeme;if(z(t,tr))for(var r,n=j(t.children);!(r=n()).done;){var i=r.value,a=e._operatorLexeme(i);if(void 0!==a)return a}},e._normalizeInteger=function(e,t){return t===U.UINT?e>>>0:0|e},e.hasQualifier=function(t,r){for(var n,i=j(t.children);!(n=i()).done;){var a=n.value;if(z(a,Y)){if(a.type===r)return!0}else if(z(a,tr)&&e.hasQualifier(a,r))return!0}return!1},e.isConstExpr=function(t){if(void 0!==e.constNumericValue(t)||e._isBooleanLiteral(t))return!0;var r=e.unwrapBareIdentifier(t,{allowParens:!0});if(r){var n=r.children[0];if(z(n,tn.MacroCallSymbol)||z(n,tn.MacroCallFunction))return!0;if(!z(n,Y))return!1;var i=r.resolvedSymbols();return i.length>0&&i.every(function(e){return z(e,e2)&&e.isConst})}if(z(t,tn.FunctionCallGeneric)){var a=t.children[0],o=a.isBuiltin,s="string"==typeof a.ident&&eX.isExist(a.ident);if(!o&&!s)return!1;var c=t.children[2];if(!z(c,tn.FunctionCallParameterList))return!0;for(var u,l=j(c.paramNodes);!(u=l()).done;){var h=u.value;if(z(h,tr)&&!e.isConstExpr(h))return!1}return!0}if(z(t,tn.ExpressionAstNode)){for(var d,p=!1,f=j(t.children);!(d=f()).done;){var _=d.value;if(z(_,tn.ExpressionAstNode)&&(p=!0,!e.isConstExpr(_)))return!1}return p}return!1},e._isBooleanLiteral=function(e){for(var t=e;;){if(z(t,tn.PrimaryExpression)){if(3===t.children.length){var r=t.children[1];if(!z(r,tr))return!1;t=r;continue}var n=t.children[0];return z(n,Y)&&(n.type===U.True||n.type===U.False)}if(z(t,tn.ExpressionAstNode)&&1===t.children.length){var i=t.children[0];if(!z(i,tr))return!1;t=i;continue}return!1}},e.firstNonArithmeticOperand=function(e,t){for(var r=0,n=[e,t];r<n.length;r++){var i=n[r];if(z(i,tn.ExpressionAstNode)&&e3.nonArithmeticOperand(i.type))return i}},e.toString=function(e){if(this.isTerminal(e)){var t;return null!=(t=B[e])?t:U[e]}return eW[e]},e.isTerminal=function(e){return e<eW.START},e}();e4._swizzleSets=["xyzw","rgba","stpq"];var e9=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t}(eJ),e5=function(e,t,r,n,i){void 0===n&&(n=!1),void 0===i&&(i=!1),this.typeInfo=e,this.ident=t,this.mrtIndex=r,this.isInMacroBranch=n,this.isFlat=i},e6=new Set(["texture","texture2D","texture2DLod","texture2DLodEXT","textureCube","textureCubeLod","textureCubeLodEXT","textureLod","textureOffset","textureProj","textureProjLod","textureProjOffset","textureSize","texelFetch"]),e8=Object.freeze([]),e7=Object.freeze([]),te=Object.freeze([]);function tt(e){return function(t){t.prototype.nt=e}}var tr=function(){function e(){this._branch=K,this._inMacroDefinition=!1}var t=e.prototype;return t.set=function(t,r){this._location=t,this._children=r,this._parent=void 0;for(var n,i=K,a=!1,o=!1,s=j(r);!(n=s()).done;){var c=n.value;z(c,e)?(c._parent=this,a||(i=c._branch,o=c._inMacroDefinition,a=!0)):!a&&z(c,Y)&&(i=c.branch,o=c.inMacroDefinition,a=!0)}this._branch=i,this._inMacroDefinition=o,this.init()},t.init=function(){},t.codeGen=function(e){return e.cache(this,e.defaultCodeGen(this.children))},t.semanticAnalyze=function(e){},er(e,[{key:"parent",get:function(){return this._parent}},{key:"children",get:function(){return this._children}},{key:"location",get:function(){return this._location}}]),e}();!function(e){function t(e,t){if(!e.length)return t;if(!t.length)return e;for(var r,n=e.slice(),i=j(t);!(r=i()).done;){var a=r.value;-1===n.indexOf(a)&&n.push(a)}return n}function r(e,t){var r=e.find(function(e){return e.name===t.name&&e.formalParameterIndex===t.formalParameterIndex&&e.unresolved===t.unresolved&&e.branch.length===t.branch.length&&e.branch.every(function(e,r){return e===t.branch[r]})&&e.replacementMemberOwner===t.replacementMemberOwner&&e.requiresRuntimeOwnerExpansion===t.requiresRuntimeOwnerExpansion});r?t.isValueIdentity&&(r.isValueIdentity=!0):e.push(t)}e._unwrapToken=function(e){if(z(e,Y))return e;throw"not token"},e.get=function(e,t,r,n){var i=t.objectPool?t.objectPool.createNode(e):new e;if(i.set(r,n),!t.diagnosticsEnabled){i.semanticAnalyze(t),t.semanticStack.push(i);return}var a=t.symbolTableStack._currentBranch,o=t.inMacroDefinition;t.symbolTableStack._currentBranch=i._branch,t.inMacroDefinition=i._inMacroDefinition,i.semanticAnalyze(t),t.symbolTableStack._currentBranch=a,t.inMacroDefinition=o,t.semanticStack.push(i)};var n=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t}(tr);e.TrivialNode=n,n=eB([tt(eW._ignore)],n);var i=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.semanticAnalyze=function(e){e.pushScope()},t}(tr);e.ScopeBrace=i,i=eB([tt(eW.scope_brace)],i);var a=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.semanticAnalyze=function(e){e.popScope()},t}(tr);e.ScopeEndBrace=a,a=eB([tt(eW.scope_end_brace)],a);var o=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.codeGen=function(e){return e.cache(this,e.visitJumpStatement(this))},t}(tr);e.JumpStatement=o,o=eB([tt(eW.jump_statement)],o);var s=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t}(tr);e.ConditionOpt=s,s=eB([tt(eW.conditionopt)],s);var c=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t}(tr);e.ForRestStatement=c,c=eB([tt(eW.for_rest_statement)],c);var u=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t}(tr);e.Condition=u,u=eB([tt(eW.condition)],u);var l=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t}(tr);e.ForInitStatement=l,l=eB([tt(eW.for_init_statement)],l);var h=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.semanticAnalyze=function(e){e.diagnosticsEnabled&&e.popScope()},t}(tr);e.IterationStatement=h,h=eB([tt(eW.iteration_statement)],h);var d=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t}(tr);e.SelectionStatement=d,d=eB([tt(eW.selection_statement)],d);var p=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t}(tr);e.ExpressionStatement=p,p=eB([tt(eW.expression_statement)],p);var f=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.init=function(){this._type=void 0},er(t,[{key:"type",get:function(){var e;return null!=(e=this._type)?e:3e3},set:function(e){this._type=e}}]),t}(tr);e.ExpressionAstNode=f;var _=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.semanticAnalyze=function(e){var t=this.children[0];this.type=t.type},t}(f);e.InitializerList=_,_=eB([tt(eW.initializer_list)],_);var v=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.semanticAnalyze=function(e){1===this.children.length?this.type=this.children[0].type:this.type=this.children[1].type},t}(f);e.Initializer=v,v=eB([tt(eW.initializer)],v);var m=function(e){function t(){return e.apply(this,arguments)||this}ei(t,e);var r=t.prototype;return r.init=function(){this.typeSpecifier=void 0,this.arraySpecifier=void 0,this.isConst=!1,this.declarator=void 0},r.semanticAnalyze=function(e){var t,r,n=this.children,i=n.length,a=n[0],o=a.typeSpecifier;this.typeSpecifier=o,this.arraySpecifier=o.arraySpecifier;var s=n[1],c=a.isConst;if(this.isConst=c,2===i||4===i)t=new e9(a.type,o.lexeme,this.arraySpecifier,o.structDeclarations),r=n[3];else{var u=n[2];this.arraySpecifier=u,t=new e9(a.type,o.lexeme,this.arraySpecifier,o.structDeclarations),r=n[4]}var l=e.assignSourceScope(new e2(s.lexeme,t,!1,r,c),s.location);this.declarator={identifier:s,typeInfo:t,initializer:r,isConst:c,isGlobal:!1,symbol:l},e.recordFunctionVariable(l);var h=e.symbolTableStack.insert(l,s.branch);e.reportRedefinition(s.location,l,h)},r.codeGen=function(e){return e.cache(this,e.visitSingleDeclaration(this))},t}(tr);e.SingleDeclaration=m,m=eB([tt(eW.single_declaration)],m);var g=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.semanticAnalyze=function(e){var t=this.children;this.isConst=2===t.length&&e4.hasQualifier(t[0],U.CONST),this.typeSpecifier=1===t.length?t[0]:t[1],this.type=this.typeSpecifier.type},t}(tr);e.FullySpecifiedType=g,g=eB([tt(eW.fully_specified_type)],g);var y=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t}(tr);e.TypeQualifier=y,y=eB([tt(eW.type_qualifier)],y);var S=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.semanticAnalyze=function(e){var t=this.children[0];z(t,Y)?this.qualifier=t.type:this.qualifier=t.qualifier,this.lexeme=t.lexeme},t}(tr);e.SingleTypeQualifier=S,S=eB([tt(eW.single_type_qualifier)],S);var b=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.semanticAnalyze=function(e){var t=this.children[0];this.qualifier=t.type,this.lexeme=t.lexeme},t}(tr),x=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t}(b);e.StorageQualifier=x,x=eB([tt(eW.storage_qualifier)],x);var E=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t}(b);e.PrecisionQualifier=E,E=eB([tt(eW.precision_qualifier)],E);var C=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t}(b);e.InterpolationQualifier=C,C=eB([tt(eW.interpolation_qualifier)],C);var A=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t}(b);e.InvariantQualifier=A,A=eB([tt(eW.invariant_qualifier)],A);var T=function(e){function t(){return e.apply(this,arguments)||this}ei(t,e);var r=t.prototype;return r.init=function(){this.arraySize=void 0,this.structDeclarations=e7,this.structDependencies=e7},r.semanticAnalyze=function(e){var t=this.children,r=t[0];if(this.type=r.type,this.lexeme=r.lexeme,this.arraySize=null==t?void 0:null==(a=t[1])?void 0:a.size,this.isCustom="string"==typeof this.type,this.isCustom){var n=e.lookupSymbol;n.set(this.lexeme,eZ.STRUCT);var i=e.symbolTableStack.lookupAll(n,!0,e.structScratch,this._branch);this.structDeclarations=i.length?i.map(function(e){return e.astNode}):e7,this.structDependencies=this.structDeclarations}else if(z(r.children[0],tu)){for(var a,o,s=[],c=j(r.children[0].referenceSymbols);!(o=c()).done;){var u=o.value;if(u.name){e.lookupSymbol.set(u.name,eZ.STRUCT);for(var l,h=e.symbolTableStack.lookupAll(e.lookupSymbol,!0,e.structScratch,u.branch),d=j(h);!(l=d()).done;){var p=l.value.astNode;s.includes(p)||s.push(p)}}}s.length&&(this.structDependencies=s)}},r.codeGen=function(e){return e.cache(this,e.visitTypeSpecifier(this))},er(t,[{key:"arraySpecifier",get:function(){return this.children[1]}}]),t}(tr);e.TypeSpecifier=T,T=eB([tt(eW.type_specifier)],T);var O=function(e){function t(){return e.apply(this,arguments)||this}ei(t,e);var r=t.prototype;return r.init=function(){this.size=void 0},r.semanticAnalyze=function(e){var t=this.children[1];if(z(t,R)){this.size=t.value;var r=t.children;if(void 0===this.size&&1===r.length&&z(r[0],ej)){var n=r[0].children[0];if(z(n,Y)&&!e.macroDefineList[n.lexeme]){var i=e.lookupSymbol;i.set(n.lexeme,eZ.VAR);var a=e.symbolTableStack.lookupAll(i,!0,e.arraySymbolScratch,this._branch);if(!a.length)return;var o=a[0].isConst;a.some(function(e){return e.isConst!==o})?e.reportBranchAmbiguity(r[0].location,n.lexeme,"const-qualification",n.lexeme):o||e.reportNonConstArraySize(r[0].location)}}}},t}(tr);e.ArraySpecifier=O,O=eB([tt(eW.array_specifier)],O);var I=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.semanticAnalyze=function(e){var t=this.children[0];switch(this.lexeme=t.lexeme,t.type){case B.PLUS:this.compute=function(e,t){return e+t};break;case B.DASH:this.compute=function(e,t){return e-t};break;case B.STAR:this.compute=function(e,t){return e*t};break;case B.SLASH:this.compute=function(e,t){return e/t};break;case B.PERCENT:this.compute=function(e,t){return e%t}}},t}(tr);e.IntegerConstantExpressionOperator=I,I=eB([tt(eW.integer_constant_expression_operator)],I);var R=function(e){function t(){return e.apply(this,arguments)||this}ei(t,e);var r=t.prototype;return r.init=function(){this.value=void 0},r.semanticAnalyze=function(e){if(1===this.children.length){var t=this.children[0];z(t,Y)&&(this.value=Number(t.lexeme))}},t}(tr);e.IntegerConstantExpression=R,R=eB([tt(eW.integer_constant_expression)],R);var M=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.init=function(){var e=this.children[0];z(e,Y)?(this.type=e.lexeme,this.lexeme=e.lexeme):z(e,tu)?(this.type=3e3,this.lexeme=e.macroName):(this.type=e.type,this.lexeme=e.lexeme)},t}(tr);e.TypeSpecifierNonArray=M,M=eB([tt(eW.type_specifier_nonarray)],M);var P=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.init=function(){var e=this.children[0];this.type=e.type,this.lexeme=e.lexeme},t}(tr);e.ExtBuiltinTypeSpecifierNonArray=P,P=eB([tt(eW.ext_builtin_type_specifier_nonarray)],P);var D=function(e){function t(){return e.apply(this,arguments)||this}ei(t,e);var r=t.prototype;return r.init=function(){this.isConst=!1,this.declarator=void 0},r.semanticAnalyze=function(e){var t,r=this.children,n=r.length;if(1===n){var i=r[0],a=i.typeSpecifier,o=i.arraySpecifier,s=i.isConst;this.typeInfo=new e9(a.type,a.lexeme,o,a.structDeclarations),this.isConst=s}else{var c=r[0];this.typeInfo=c.typeInfo,this.isConst=c.isConst}if(3===n||5===n){var u=r[2],l=5===n?r[4]:void 0,h=new e9(this.typeInfo.type,this.typeInfo.typeLexeme,void 0,this.typeInfo.structDeclarations);t=e.assignSourceScope(new e2(u.lexeme,h,!1,this,this.isConst),u.location),this.declarator={identifier:u,typeInfo:h,initializer:l,isConst:this.isConst,isGlobal:!1,symbol:t},e.recordFunctionVariable(t);var d=e.symbolTableStack.insert(t,u.branch);e.reportRedefinition(u.location,t,d)}else if(4===n||6===n){var p=new e9(this.typeInfo.type,this.typeInfo.typeLexeme,void 0,this.typeInfo.structDeclarations),f=this.children[3];p.arraySpecifier=f;var _=r[2],v=6===n?r[5]:void 0;t=e.assignSourceScope(new e2(_.lexeme,p,!1,this,this.isConst),_.location),this.declarator={identifier:_,typeInfo:p,initializer:v,isConst:this.isConst,isGlobal:!1,symbol:t},e.recordFunctionVariable(t);var m=e.symbolTableStack.insert(t,_.branch);e.reportRedefinition(_.location,t,m)}},t}(tr);e.InitDeclaratorList=D,D=eB([tt(eW.init_declarator_list)],D);var L=function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.idList=[],t}ei(t,e);var r=t.prototype;return r.init=function(){this.idList.length=0},r.semanticAnalyze=function(e){var t=this.children,r=this.idList;if(2===t.length)r.push(t[1]);else{var n=t[0],i=t[2],a=n.idList.length;r.length=a+1;for(var o=0;o<a;o++)r[o]=n.idList[o];r[a]=i}},t}(tr);e.IdentifierList=L,L=eB([tt(eW.identifier_list)],L);var N=function(e){function t(){return e.apply(this,arguments)||this}ei(t,e);var r=t.prototype;return r.semanticAnalyze=function(e){z(this.children[0],k)&&(e.popScope(),e.endFunction())},r.codeGen=function(e){return e.cache(this,e.visitDeclaration(this))},t}(tr);e.Declaration=N,N=eB([tt(eW.declaration)],N);var k=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.semanticAnalyze=function(e){var t=this.children[0];this.ident=t.ident,this.returnType=t.returnType,this.parameterList=t.parameterInfoList,this.paramSig=t.paramSig},t}(tr);e.FunctionProtoType=k,k=eB([tt(eW.function_prototype)],k);var V=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.semanticAnalyze=function(e){var t=this.children,r=t[0],n=t[1];this.ident=r.ident,this.returnType=r.returnType,this.parameterInfoList=null==n?void 0:n.parameterInfoList,this.paramSig=null==n?void 0:n.paramSig,e.beginFunction(this)},t}(tr);e.FunctionDeclarator=V,V=eB([tt(eW.function_declarator)],V);var F=function(e){function t(){return e.apply(this,arguments)||this}ei(t,e);var r=t.prototype;return r.semanticAnalyze=function(e){e.pushScope();var t=this.children;this.ident=t[1],this.returnType=t[0]},r.codeGen=function(e){return e.cache(this,e.visitFunctionHeader(this))},t}(tr);e.FunctionHeader=F,F=eB([tt(eW.function_header)],F);var w=function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.parameterInfoList=[],t.paramSig=[],t}ei(t,e);var r=t.prototype;return r.init=function(){this.parameterInfoList.length=0,this.paramSig.length=0},r.semanticAnalyze=function(e){var r=this.children,n=this.parameterInfoList,i=this.paramSig;if(z(r[0],H)){var a,o,s=r[0];n.push({ident:s.ident,typeInfo:s.typeInfo,astNode:s}),i.push(null!=(o=null==(a=s.typeInfo)?void 0:a.type)?o:3e3)}else if(z(r[2],H)){var c,u,l=r[0],h=r[2];n.push.apply(n,[].concat(l.parameterInfoList,[{ident:h.ident,typeInfo:h.typeInfo,astNode:h}])),i.push.apply(i,[].concat(l.paramSig,[null!=(u=null==(c=h.typeInfo)?void 0:c.type)?u:3e3]))}else z(r[0],t)&&z(r[1],W)?(n.push.apply(n,[].concat(r[0].parameterInfoList,[{astNode:r[1]}])),i.push.apply(i,[].concat(r[0].paramSig,[3e3]))):z(r[0],W)&&(n.push({astNode:r[0]}),i.push(3e3))},r.codeGen=function(e){return e.cache(this,e.visitFunctionParameterList(this))},t}(tr);e.FunctionParameterList=w,w=eB([tt(eW.function_parameter_list)],w);var G=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t}(tr);e.MacroParamCaseList=G,G=eB([tt(eW.macro_param_case_list)],G);var W=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t}(tr);e.MacroParamBlock=W,W=eB([tt(eW.macro_param_block)],W);var q=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t}(tr);e.MacroParameterBranch=q,q=eB([tt(eW.macro_parameter_branch)],q);var H=function(e){function t(){return e.apply(this,arguments)||this}ei(t,e);var r=t.prototype;return r.init=function(){this.typeInfo=void 0,this.ident=void 0,this.symbol=void 0},r.semanticAnalyze=function(e){var t,r=this.children;if(z(r[0],X)?t=r[0]:z(r[1],X)&&(t=r[1]),t){this.typeInfo=t.typeInfo,this.ident=t.ident;var n=new e2(t.ident.lexeme,t.typeInfo,!1,t);this.symbol=n,e.symbolTableStack.insert(n,t.ident.branch)}},t}(tr);e.ParameterDeclaration=H,H=eB([tt(eW.parameter_declaration)],H);var X=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.semanticAnalyze=function(e){var t=this.children;this.ident=t[1];var r=t[0],n=t[2];this.typeInfo=new e9(r.type,r.lexeme,n,r.structDeclarations)},t}(tr);e.ParameterDeclarator=X,X=eB([tt(eW.parameter_declarator)],X);var J=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t}(tr);e.SimpleStatement=J,J=eB([tt(eW.simple_statement)],J);var Z=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t}(tr);e.CompoundStatement=Z,Z=eB([tt(eW.compound_statement)],Z);var $=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t}(tr);e.CompoundStatementNoScope=$,$=eB([tt(eW.compound_statement_no_scope)],$);var ee=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t}(tr);e.Statement=ee,ee=eB([tt(eW.statement)],ee);var et=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.codeGen=function(e){return e.cache(this,e.visitStatementList(this))},t}(tr);e.StatementList=et,et=eB([tt(eW.statement_list)],et);var en=function(e){function t(){return e.apply(this,arguments)||this}ei(t,e);var r=t.prototype;return r.semanticAnalyze=function(e){var t=this.children;this.protoType=t[0],this.statements=t[1],e.popScope();var r=e.endFunction(),n=e.assignSourceScope(new e0(this.protoType.ident.lexeme,this,r.localVariables,r.calledFunctions),this.protoType.ident.location),i=0===this.protoType.ident.branch.length?e.symbolTableStack.lookup(n):void 0,a=i&&i.sourceScope===n.sourceScope?"coexist":e.symbolTableStack.insert(n,this.protoType.ident.branch);e.reportRedefinition(this.protoType.ident.location,n,a),this.isInMacroBranch=e.symbolTableStack.isInMacroBranch},r.codeGen=function(e){return e.cache(this,e.visitFunctionDefinition(this))},t}(tr);e.FunctionDefinition=en,en=eB([tt(eW.function_definition)],en);var ea=function(e){function t(){return e.apply(this,arguments)||this}ei(t,e);var r=t.prototype;return r.semanticAnalyze=function(e){this.type=this.children[0].type},r.codeGen=function(e){return e.cache(this,e.visitFunctionCall(this))},t}(f);e.FunctionCall=ea,ea=eB([tt(eW.function_call)],ea);var eo=function(e){function t(){return e.apply(this,arguments)||this}ei(t,e);var r=t.prototype;return r.init=function(){e.prototype.init.call(this),this.fnSymbol=void 0,this.fnSymbols=void 0},r.semanticAnalyze=function(e){var r=this.children[0];if(r.isBuiltin)this.type=r.ident;else{var n=r.ident;if(4===this.children.length){var i=this.children[2];z(i,es)&&(s=i.paramSig)}if(e.diagnosticsEnabled){var a=e.currentFunctionHeader;if((null==a?void 0:null==(c=a.ident)?void 0:c.lexeme)===n){var o,s,c,u,l,h=null!=(l=a.paramSig)?l:[],d=null!=s?s:[];if(h.length===d.length&&h.every(function(e,t){return e===d[t]}))return}if(e6.has(n)){var p=null==s?void 0:s[0];if(void 0!==p&&3e3!==p&&!e3.isSamplerType(p)){e.reportExpectedSampler(this.location,n,p);return}}var f=eX.resolveOverload(n,s);if(f){this.type=f.realReturnType;return}var _=e.lookupSymbol;_.set(n,eZ.FN,void 0,void 0,s);var v=e.overloadScratch;e.symbolTableStack.lookupAll(_,!0,v,this._branch);var m=e.getBranchCoverage(v.map(function(e){var t;return null!=(t=e.branchSignature)?t:K}),this._branch),g="covered"===m||t._hasConflictingBranches(e,v)?v[0]:void 0,y=!1;if(g&&(null==s?void 0:s.some(function(e){return 3e3===e}))&&v.length>1){var S,b=null==(S=v[0].dataType)?void 0:S.type;y=v.some(function(e){var t;return(null==(t=e.dataType)?void 0:t.type)!==b})}if(!g){var x=e.symbolTableStack.lookup(_,!0);if(x&&(this.fnSymbol=x,e.recordFunctionCall(x)),v.length){e.reportBranchAvailability(this.location,"Function",n,m);return}_.set(n,eZ.FN),(e.symbolTableStack.lookupAll(_,!0,v,this._branch).length>0||eX.isExist(n))&&e.reportNoMatchingOverload(this.location,n);return}if(this.type=y?3e3:null==g?void 0:null==(u=g.dataType)?void 0:u.type,this.fnSymbol=g,v.length>1){var E=v[0];this.fnSymbols=v.every(function(e){return t._hasSameParameterSignature(E,e)})?v.slice():e8}if(void 0!==this.fnSymbols)for(var C,A=j(this.fnSymbols);!(C=A()).done;){var T=C.value;e.recordFunctionCall(T)}else z(g,e0)&&e.recordFunctionCall(g);return}var O=e.lookupSymbol;O.set(n,eZ.FN,void 0,void 0,s);var I=e.symbolTableStack.lookup(O,!0);if(!I)return;this.type=null==(o=I.dataType)?void 0:o.type,this.fnSymbol=I,z(I,e0)&&e.recordFunctionCall(I)}},t._hasConflictingBranches=function(e,r){for(var n=0,i=r.length;n<i;n++)for(var a=n+1;a<i;a++){var o,s,c=r[n],u=r[a];if(t._hasSameParameterSignature(c,u)&&e.canDeclarationsCoexist(null!=(o=c.branchSignature)?o:K,null!=(s=u.branchSignature)?s:K))return!0}return!1},t._hasSameParameterSignature=function(e,t){var r,n,i=null!=(r=e.astNode.protoType.paramSig)?r:[],a=null!=(n=t.astNode.protoType.paramSig)?n:[];return i.length===a.length&&i.every(function(e,t){return e===a[t]})},t}(f);e.FunctionCallGeneric=eo,eo=eB([tt(eW.function_call_generic)],eo);var es=function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.paramSig=[],t.paramNodes=[],t}ei(t,e);var r=t.prototype;return r.init=function(){this.paramSig.length=0,this.paramNodes.length=0},r.semanticAnalyze=function(e){var r=this.children,n=this.paramSig,i=this.paramNodes;if(z(r[0],ep)){var a=r[0];n.push(a.type),i.push(a)}else if(z(r[2],ep)){var o=r[0],s=r[2];n.push.apply(n,[].concat(o.paramSig,[s.type])),i.push.apply(i,[].concat(o.paramNodes,[s]))}else z(r[0],t)&&z(r[1],eu)?(n.push.apply(n,[].concat(r[0].paramSig,[3e3])),i.push.apply(i,[].concat(r[0].paramNodes,[r[1]]))):z(r[0],eu)&&(n.push(3e3),i.push(r[0]))},t}(tr);e.FunctionCallParameterList=es,es=eB([tt(eW.function_call_parameter_list)],es);var ec=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t}(tr);e.MacroCallArgCaseList=ec,ec=eB([tt(eW.macro_call_arg_case_list)],ec);var eu=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t}(tr);e.MacroCallArgBlock=eu,eu=eB([tt(eW.macro_call_arg_block)],eu);var el=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t}(tr);e.MacroCallArgBranch=el,el=eB([tt(eW.macro_call_arg_branch)],el);var eh=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.semanticAnalyze=function(e){e.symbolTableStack.isInMacroBranch||e.shaderData.globalPrecisions.push(this)},t}(tr);e.PrecisionSpecifier=eh,eh=eB([tt(eW.precision_specifier)],eh);var ed=function(e){function t(){return e.apply(this,arguments)||this}ei(t,e);var r=t.prototype;return r.semanticAnalyze=function(e){var t=this.children[0];this.ident=t.type,this.lexeme=t.lexeme,this.isBuiltin="string"!=typeof this.ident},r.codeGen=function(e){return e.cache(this,e.visitFunctionIdentifier(this))},t}(tr);e.FunctionIdentifier=ed,ed=eB([tt(eW.function_identifier)],ed);var ep=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.semanticAnalyze=function(e){if(1===this.children.length){var t,r=this.children[0];this.type=null!=(t=r.type)?t:3e3}else{var n,i=this.children[2];this.type=null!=(n=i.type)?n:3e3}},t}(f);e.AssignmentExpression=ep,ep=eB([tt(eW.assignment_expression)],ep);var ef=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t}(tr);e.AssignmentOperator=ef,ef=eB([tt(eW.assignment_operator)],ef);var e_=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.semanticAnalyze=function(e){if(1===this.children.length){var t=this.children[0];this.type=t.type}else{var r=this.children[2];this.type=r.type}},t}(f);e.Expression=e_,e_=eB([tt(eW.expression)],e_);var ev=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.semanticAnalyze=function(e){if(1===this.children.length){var t,r=this.children[0];if(z(r,ej))this.type=null!=(t=r.typeInfo)?t:3e3;else switch(r.type){case B.INT_CONSTANT:this._type=U.INT;break;case B.FLOAT_CONSTANT:this.type=U.FLOAT;break;case U.True:case U.False:this.type=U.BOOL}}else{var n=this.children[1];this.type=n.type}},t}(f);e.PrimaryExpression=ev,ev=eB([tt(eW.primary_expression)],ev);var em=function(e){function t(){return e.apply(this,arguments)||this}ei(t,e);var r=t.prototype;return r.init=function(){if(e.prototype.init.call(this),1===this.children.length){var t=this.children[0];this.type=t.type}},r.semanticAnalyze=function(e){var r=this.children;if(3===r.length&&z(r[2],Y)){var n=r[0];if(!this._inMacroDefinition){var i=e4.unwrapBareIdentifier(n,{allowParens:!0});i&&e.shaderData.directMemberOwnerReferences.push(i)}"string"==typeof n.type&&t._checkStructField(e,n.type,r[2],this._branch)}},r.codeGen=function(e){return e.cache(this,e.visitPostfixExpression(this))},t._checkStructField=function(e,t,r,n){var i=e.lookupSymbol;i.set(t,eZ.STRUCT);var a=e.symbolTableStack.lookupAll(i,!0,e.structScratch,n);if(a.length){var o=e.getBranchCoverage(a.map(function(e){var t;return null!=(t=e.branchSignature)?t:K}),n);if("covered"!==o){e.reportBranchAvailability(r.location,"Struct",t,o);return}for(var s=a[0].astNode.propList.find(function(e){return e.ident.lexeme===r.lexeme}),c=!1,u=!1,l=1;l<a.length;l++){var h=a[l].astNode.propList.find(function(e){return e.ident.lexeme===r.lexeme});if(!!h!=!!s){c=!0;break}if(h&&s){var d=s.typeInfo.arraySpecifier,p=h.typeInfo.arraySpecifier;if(h.typeInfo.type!==s.typeInfo.type||!!p!=!!d||(null==p?void 0:p.size)!==(null==d?void 0:d.size)){u=!0;break}}}if(c){e.reportBranchAmbiguity(r.location,t+"."+r.lexeme,"struct-member-presence",r.lexeme,t);return}!u&&(s||e.reportUndeclaredStructMember(r.location,t,r.lexeme))}},t}(f);e.PostfixExpression=em,em=eB([tt(eW.postfix_expression)],em);var eg=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t}(tr);e.UnaryOperator=eg,eg=eB([tt(eW.unary_operator)],eg);var ey=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.init=function(){this.type=this.children[0].type},t}(f);e.UnaryExpression=ey,ey=eB([tt(eW.unary_expression)],ey);var eS=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.init=function(){e.prototype.init.call(this),1===this.children.length?this.type=this.children[0].type:this.type=e3.arithmeticResultType(this.children[0].type,this.children[2].type,this.children[1].lexeme)},t}(f);e.MultiplicativeExpression=eS,eS=eB([tt(eW.multiplicative_expression)],eS);var eb=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.init=function(){e.prototype.init.call(this),1===this.children.length?this.type=this.children[0].type:this.type=e3.arithmeticResultType(this.children[0].type,this.children[2].type,this.children[1].lexeme)},t}(f);e.AdditiveExpression=eb,eb=eB([tt(eW.additive_expression)],eb);var ex=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.semanticAnalyze=function(e){var t=this.children[0];this.type=t.type},t}(f);e.ShiftExpression=ex,ex=eB([tt(eW.shift_expression)],ex);var eE=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.semanticAnalyze=function(e){1===this.children.length?this.type=this.children[0].type:this.type=U.BOOL},t}(f);e.RelationalExpression=eE,eE=eB([tt(eW.relational_expression)],eE);var eC=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.semanticAnalyze=function(e){1===this.children.length?this.type=this.children[0].type:this.type=U.BOOL},t}(f);e.EqualityExpression=eC,eC=eB([tt(eW.equality_expression)],eC);var eA=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.semanticAnalyze=function(e){1===this.children.length?this.type=this.children[0].type:this.type=U.UINT},t}(f);e.AndExpression=eA,eA=eB([tt(eW.and_expression)],eA);var eT=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.semanticAnalyze=function(e){1===this.children.length?this.type=this.children[0].type:this.type=U.UINT},t}(f);e.ExclusiveOrExpression=eT,eT=eB([tt(eW.exclusive_or_expression)],eT);var eO=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.semanticAnalyze=function(e){1===this.children.length?this.type=this.children[0].type:this.type=U.UINT},t}(f);e.InclusiveOrExpression=eO,eO=eB([tt(eW.inclusive_or_expression)],eO);var eI=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.semanticAnalyze=function(e){1===this.children.length?this.type=this.children[0].type:this.type=U.BOOL},t}(f);e.LogicalAndExpression=eI,eI=eB([tt(eW.logical_and_expression)],eI);var eR=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.semanticAnalyze=function(e){1===this.children.length?this.type=this.children[0].type:this.type=U.BOOL},t}(f);e.LogicalXorExpression=eR,eR=eB([tt(eW.logical_xor_expression)],eR);var eM=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.semanticAnalyze=function(e){1===this.children.length?this.type=this.children[0].type:this.type=U.BOOL},t}(f);e.LogicalOrExpression=eM,eM=eB([tt(eW.logical_or_expression)],eM);var eP=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.semanticAnalyze=function(e){1===this.children.length&&(this.type=this.children[0].type)},t}(f);e.ConditionalExpression=eP,eP=eB([tt(eW.conditional_expression)],eP);var eD=function(e){function t(){return e.apply(this,arguments)||this}ei(t,e);var r=t.prototype;return r.init=function(){this.ident=void 0},r.semanticAnalyze=function(e){var t=this.children;if(this.isInMacroBranch=e.symbolTableStack.isInMacroBranch,6===t.length){this.ident=t[1];var r=e.assignSourceScope(new e1(this.ident.lexeme,this),this.ident.location),n=e.symbolTableStack.insert(r,this.ident.branch);e.reportRedefinition(this.ident.location,r,n),this.propList=t[3].propList,this.macroExpressions=t[3].macroExpressions}else this.propList=t[2].propList,this.macroExpressions=t[2].macroExpressions},r.codeGen=function(e){return e.cache(this,e.visitStructSpecifier(this))},t}(tr);e.StructSpecifier=eD,eD=eB([tt(eW.struct_specifier)],eD);var eL=function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.propList=[],t.macroExpressions=[],t}ei(t,e);var r=t.prototype;return r.init=function(){this.propList.length=0,this.macroExpressions.length=0},r.semanticAnalyze=function(e){var t=this.children,r=this.propList,n=this.macroExpressions;1===t.length?(r.push.apply(r,[].concat(t[0].props)),n.push.apply(n,[].concat(t[0].macroExpressions))):(r.push.apply(r,[].concat(t[0].propList)),r.push.apply(r,[].concat(t[1].props)),n.push.apply(n,[].concat(t[0].macroExpressions)),n.push.apply(n,[].concat(t[1].macroExpressions)))},t}(tr);e.StructDeclarationList=eL,eL=eB([tt(eW.struct_declaration_list)],eL);var eN=function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.props=[],t.macroExpressions=[],t}ei(t,e);var r=t.prototype;return r.init=function(){this._typeSpecifier=void 0,this._declaratorList=void 0,this.props.length=0,this.macroExpressions.length=0},r.semanticAnalyze=function(e){var t=this.children,r=this.props,n=this.macroExpressions;if(1===t.length){for(var i=t[0],a=i.props,o=0,s=a.length;o<s;o++)a[o].isInMacroBranch=!0,r.push(a[o]);n.push.apply(n,[].concat(i.macroExpressions));return}3===t.length?(this._typeSpecifier=t[0],this._declaratorList=t[1]):(this._typeSpecifier=t[1],this._declaratorList=t[2]);var c=t[0],u=this._typeSpecifier,l=u.type,h=u.lexeme,d=e.symbolTableStack.isInMacroBranch;if(z(c,eF)){var p=t[2],f=new e5(new e9(l,h,void 0,this._typeSpecifier.structDeclarations),p.ident,c.index,d);r.push(f)}else{var _=4===t.length&&e4.hasQualifier(t[0],U.FLAT),v=this._declaratorList.declaratorList,m=v.length;r.length=m;for(var g=0;g<m;g++){var y=v[g],S=new e5(new e9(l,h,y.arraySpecifier,this._typeSpecifier.structDeclarations),y.ident,void 0,d,_);r[g]=S}}},t}(tr);e.StructDeclaration=eN,eN=eB([tt(eW.struct_declaration)],eN);var ek=function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.props=[],t.macroExpressions=[],t}ei(t,e);var r=t.prototype;return r.init=function(){this.props.length=0,this.macroExpressions.length=0},r.semanticAnalyze=function(){var e,t,r,n,i,a,o=this.children;this.macroExpressions.push(o[0]),3===o.length?((e=this.props).push.apply(e,[].concat(o[1].propList)),(t=this.props).push.apply(t,[].concat(o[2].props)),(r=this.macroExpressions).push.apply(r,[].concat(o[1].macroExpressions)),(n=this.macroExpressions).push.apply(n,[].concat(o[2].macroExpressions))):((i=this.props).push.apply(i,[].concat(o[1].props)),(a=this.macroExpressions).push.apply(a,[].concat(o[1].macroExpressions)))},t}(tr);e.MacroStructDeclaration=ek,ek=eB([tt(eW.macro_struct_declaration)],ek);var eV=function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.props=[],t.macroExpressions=[],t}ei(t,e);var r=t.prototype;return r.init=function(){this.props.length=0,this.macroExpressions.length=0},r.semanticAnalyze=function(){var e,r,n,i,a=this.children,o=a[a.length-1];this.macroExpressions.push(a[0]),z(a[1],eL)&&((e=this.props).push.apply(e,[].concat(a[1].propList)),(r=this.macroExpressions).push.apply(r,[].concat(a[1].macroExpressions))),z(o,t)&&((n=this.props).push.apply(n,[].concat(o.props)),(i=this.macroExpressions).push.apply(i,[].concat(o.macroExpressions))),a.length>1&&z(o,eJ)&&this.macroExpressions.push(o)},t}(tr);e.MacroStructBranch=eV,eV=eB([tt(eW.macro_struct_branch)],eV);var eF=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.semanticAnalyze=function(e){this.index=Number(this.children[4].lexeme)},t}(tr);e.LayoutQualifier=eF,eF=eB([tt(eW.layout_qualifier)],eF);var ew=function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.declaratorList=[],t}ei(t,e);var r=t.prototype;return r.init=function(){this.declaratorList.length=0},r.semanticAnalyze=function(e){var t=this.children,r=this.declaratorList;if(1===t.length)r.push(t[0]);else{var n=t[0],i=t[1],a=n.declaratorList.length;r.length=a+1;for(var o=0;o<a;o++)r[o]=n.declaratorList[o];r[a]=i}},t}(tr);e.StructDeclaratorList=ew,ew=eB([tt(eW.struct_declarator_list)],ew);var eG=function(e){function t(){return e.apply(this,arguments)||this}ei(t,e);var r=t.prototype;return r.init=function(){this.arraySpecifier=void 0},r.semanticAnalyze=function(e){var t=this.children;this.ident=t[0],this.arraySpecifier=t[1]},t}(tr);e.StructDeclarator=eG,eG=eB([tt(eW.struct_declarator)],eG);var eU=function(e){function t(){return e.apply(this,arguments)||this}ei(t,e);var r=t.prototype;return r.init=function(){this.isStatic=!1,this.declarator=void 0},r.semanticAnalyze=function(e){var t=this.children,r=t[0],n=t[1];this.type=r;var i=4===t.length,a=3===t.length?t[2]:void 0,o=i?t[3]:void 0,s=new e9(r.type,r.typeSpecifier.lexeme,a,r.typeSpecifier.structDeclarations),c=e.assignSourceScope(new e2(n.lexeme,s,!0,this,r.isConst,!i&&!r.isConst),n.location);this.declarator={identifier:n,typeInfo:s,initializer:o,isConst:r.isConst,isGlobal:!0,symbol:c};var u=e.symbolTableStack.insert(c,n.branch);e.reportRedefinition(n.location,c,u),4===t.length&&(this.isStatic=!0)},r.codeGen=function(t){return this.isStatic?e.prototype.codeGen.call(this,t):t.cache(this,t.visitGlobalVariableDeclaration(this))},t}(tr);e.VariableDeclaration=eU,eU=eB([tt(eW.variable_declaration)],eU);var ez=function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.variableDeclarations=[],t}ei(t,e);var r=t.prototype;return r.init=function(){this.variableDeclarations.length=0},r.semanticAnalyze=function(e){var t=this.children,r=t.length,n=t[0],i=n.type;if(this.type=i,z(n,eU))this.variableDeclarations.push(n);else{(a=this.variableDeclarations).push.apply(a,[].concat(n.variableDeclarations));var a,o=t[2],s=e.objectPool?e.objectPool.createNode(eU):new eU;3===r?s.set(o.location,[i,o]):s.set(o.location,[i,o,t[3]]),s.semanticAnalyze(e),this.variableDeclarations.push(s)}},t}(tr);e.VariableDeclarationList=ez,ez=eB([tt(eW.variable_declaration_list)],ez);var ej=function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.referenceGlobalSymbolNames=[],t._symbols=[],t}ei(t,e);var r=t.prototype;return r.resolvedSymbols=function(){return this._symbols},r.resolvedValueSymbols=function(){var e,t=this.children[0];return z(t,tu)||z(t,tl)?null!=(e=this._valueSymbols)?e:te:this._symbols},r.init=function(){this.typeInfo=3e3,this.builtinSemantic=void 0,this.isArray=!1,this.arraySize=void 0,this.referenceGlobalSymbolNames.length=0,this._symbols.length=0,this._valueSymbols&&(this._valueSymbols.length=0)},r.semanticAnalyze=function(e){if(e.diagnosticsEnabled){var r=this.children[0],n=this.referenceGlobalSymbolNames,i=this._symbols,a=z(r,Y)?[{name:r.lexeme,branch:this._branch}]:r.referenceSymbols,o=[];if(!z(r,Y))for(var s,c,u=j(a);!(c=u()).done;){var l=c.value,h=void 0===l.name?void 0:eY.getVar(l.name);if(!l.isValueIdentity||l.unresolved||!h||void 0!==s&&s!==h.type){s=void 0;break}s=h.type}for(var d=0;d<a.length;d++){var p=a[d],f=p.name,_=p.branch,v=p.isValueIdentity,m=p.replacementMemberOwner,g=p.requiresRuntimeOwnerExpansion;if(p.unresolved){this._registerUnresolvedReferenceResolution(e,_,m,g,v);continue}if(void 0!==f){if(o.push(f),e.macroDefineList[f]){(m||v)&&this._registerUnresolvedReferenceResolution(e,_,m,g,v);continue}if(!z(r,Y)&&eX.isExist(f))continue;var y=eY.getVar(f);if(y){this.typeInfo=z(r,Y)?y.type:null!=s?s:3e3,z(r,Y)&&(this.builtinSemantic=y.semantic);continue}var S=t._lookupAndMarkGlobalReference(e,f,i,n,this.location,_,this,!1,!z(r,Y)&&(void 0!==m||!0===v),m,g,v);if(v&&this._appendValueSymbols(i),S&&(z(r,Y)||!r.visibleHasAstValue)){var b=i[0],x=null==(I=b.dataType)?void 0:I.type,E=!!(null==(R=b.dataType)?void 0:R.arraySpecifier),C=null==(P=b.dataType)?void 0:null==(M=P.arraySpecifier)?void 0:M.size,A=!1,T=!1;if(i.length>1)for(var O=1;O<i.length;O++){var I,R,M,P,D,L=i[O].dataType;if((null==L?void 0:L.type)!==x||!!(null==L?void 0:L.arraySpecifier)!==E){A=!0;break}(null==L?void 0:null==(D=L.arraySpecifier)?void 0:D.size)!==C&&(T=!0)}A?(this.typeInfo=3e3,this.isArray=!1,this.arraySize=void 0):(this.typeInfo=x,this.isArray=E,this.arraySize=T?void 0:C)}}}z(r,Y)||t._probeCrossArmShadowing(e,r,o,i,n);return}this._semanticAnalyzeForCodegen(e)},r._semanticAnalyzeForCodegen=function(e){var t=this,r=this.children[0];if(z(r,Y)){var n=r.lexeme;if(e.macroDefineList[n])return;var i=eY.getVar(n);if(i){this.typeInfo=i.type,this.builtinSemantic=i.semantic;return}this._resolveCodegenReference(e,n,!0,this._branch);return}for(var a=r.referenceSymbols.length?r.referenceSymbols:r.referenceSymbolNames.map(function(e){return{name:e,branch:t._branch}}),o=0;o<a.length;o++){var s=a[o],c=s.name,u=s.branch,l=s.isValueIdentity,h=s.replacementMemberOwner,d=s.requiresRuntimeOwnerExpansion;if(s.unresolved){this._registerUnresolvedReferenceResolution(e,u,h,d,l);continue}if(void 0!==c){if(e.macroDefineList[c]){(h||l)&&this._registerUnresolvedReferenceResolution(e,u,h,d,l);continue}if(!eX.isExist(c)){var p=eY.getVar(c);if(p){this.typeInfo=p.type;continue}this._resolveCodegenReference(e,c,!r.hasAstValue,u,void 0!==h||!0===l,h,d,l)}}}var f=r.macroName;if(!(!f||eX.isExist(f)||eY.getVar(f))){for(var _=0;_<a.length;_++)if(a[_].name===f)return;var v=e.lookupSymbol;v.set(f,eZ.Any),e.symbolTableStack.lookupAllWithRuntimeFallbacks(v,!0,e.runtimeLookupScratch,e.runtimeFallbackScratch,this._branch),this._markCodegenReference(f,e.runtimeLookupScratch),this._markCodegenReference(f,e.runtimeFallbackScratch)}},r._resolveCodegenReference=function(e,t,r,n,i,a,o,s){void 0===i&&(i=!1);var c=e.lookupSymbol;c.set(t,eZ.Any);var u=this._symbols,l=e.runtimeFallbackScratch;if(e.symbolTableStack.lookupAllWithRuntimeFallbacks(c,!0,u,l,n),!u.length){i&&(a||s)&&this._registerUnresolvedReferenceResolution(e,n,a,o,s);return}if(this._appendCodegenRuntimeFallbacks(e,u,l,n,i,a,o,s),this._markCodegenReference(t,u),s&&this._appendValueSymbols(u),r){for(var h=u[0].dataType,d=!1,p=1;p<u.length;p++){var f,_,v=u[p].dataType;if((null==v?void 0:v.type)!==(null==h?void 0:h.type)||!!(null==v?void 0:v.arraySpecifier)!=!!(null==h?void 0:h.arraySpecifier))return;(null==v?void 0:null==(f=v.arraySpecifier)?void 0:f.size)!==(null==h?void 0:null==(_=h.arraySpecifier)?void 0:_.size)&&(d=!0)}this._setCodegenType(h,d)}},r._appendCodegenRuntimeFallbacks=function(e,t,r,n,i,a,o,s){for(var c=t.length,u=0,l=r.length;u<l;u++){var h=r[u];(z(h,e2)||z(h,e0))&&-1===t.indexOf(h)&&t.push(h)}this._registerReferenceResolution(e,c,n,i,a,o,s)},r._appendValueSymbols=function(e){if(e.length)for(var t,r,n=null!=(t=this._valueSymbols)?t:this._valueSymbols=[],i=j(e);!(r=i()).done;){var a=r.value;-1===n.indexOf(a)&&n.push(a)}},r._markCodegenReference=function(e,t){for(var r=0;r<t.length;r++){var n=t[r];if(z(n,e0)||z(n,e2)&&n.isGlobalVariable){-1===this.referenceGlobalSymbolNames.indexOf(e)&&this.referenceGlobalSymbolNames.push(e);return}}},r._setCodegenType=function(e,t){var r;void 0===t&&(t=!1),this.typeInfo=null==e?void 0:e.type,this.isArray=!!(null==e?void 0:e.arraySpecifier),this.arraySize=t?void 0:null==e?void 0:null==(r=e.arraySpecifier)?void 0:r.size},r._registerReferenceResolution=function(e,t,r,n,i,a,o){var s=n&&(void 0!==i||!0===o);(this._symbols.length||s)&&(n||!(t>=this._symbols.length))&&e.shaderData.referenceResolutionSnapshots.push({reference:this,symbols:this._symbols.slice(),fallbackStart:t,callSiteBranch:r,replacementMemberOwner:i,requiresRuntimeOwnerExpansion:a,isValueIdentity:o})},r._registerUnresolvedReferenceResolution=function(e,t,r,n,i){e.shaderData.referenceResolutionSnapshots.push({reference:this,symbols:te,fallbackStart:0,callSiteBranch:t,replacementMemberOwner:r,requiresRuntimeOwnerExpansion:n,isValueIdentity:i})},r.codeGen=function(e){return e.cache(this,e.visitVariableIdentifier(this))},r.getLexeme=function(e){var t=this.children[0];return z(t,Y)?t.lexeme:t.codeGen(e)},t._probeCrossArmShadowing=function(e,r,n,i,a){var o=r.macroName;o&&-1===n.indexOf(o)&&(eX.isExist(o)||eY.getVar(o)||t._lookupAndMarkGlobalReference(e,o,i,a,null,K,void 0,!0))},t._lookupAndMarkGlobalReference=function(e,r,n,i,a,o,s,c,u,l,h,d){void 0===c&&(c=!1),void 0===u&&(u=!1);var p=e.lookupSymbol;p.set(r,eZ.Any);var f=e.runtimeFallbackScratch;e.symbolTableStack.lookupAllWithRuntimeFallbacks(p,!0,n,f,o);for(var _=0,v=0,m=n.length;v<m;v++){var g,y=n[v];e.isBranchVisibleFrom(null!=(g=y.branchSignature)?g:K,o)&&(n[_++]=y)}_&&(n.length=_);for(var S=n.length,b=0,x=f.length;b<x;b++){var E=f[b];(z(E,e2)||z(E,e0))&&-1===n.indexOf(E)&&n.push(E)}if(null==s||s._registerReferenceResolution(e,S,o,u,l,h,d),!n.length)return a&&e.symbolTableStack.hasSymbol(p)&&(e.symbolTableStack.lookupAll(p,!0,n),e.reportBranchAvailability(a,"Identifier",r,e.getBranchCoverage(n.map(function(e){var t;return null!=(t=e.branchSignature)?t:K}),o)),n.length=0),!1;var C=e.getBranchCoverage(n.map(function(e){var t;return null!=(t=e.branchSignature)?t:K}),o);return(t._containsGlobalSymbol(n)||t._containsGlobalSymbol(f))&&-1===i.indexOf(r)&&i.push(r),!!(c||"covered"===C||t._hasConflictingGlobalBranches(e,n))||(a&&e.reportBranchAvailability(a,"Identifier",r,C),!1)},t._hasConflictingGlobalBranches=function(e,t){for(var r=0,n=t.length;r<n;r++){var i=t[r];if(z(i,e0)||i.isGlobalVariable)for(var a=r+1;a<n;a++){var o,s,c=t[a];if((z(c,e0)||c.isGlobalVariable)&&e.canDeclarationsCoexist(null!=(o=i.branchSignature)?o:K,null!=(s=c.branchSignature)?s:K))return!0}}return!1},t._containsGlobalSymbol=function(e){for(var t=0;t<e.length;t++){var r=e[t];if(z(r,e0)||z(r,e2)&&r.isGlobalVariable)return!0}return!1},t}(tr);e.VariableIdentifier=ej,ej=eB([tt(eW.variable_identifier)],ej);var eq=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.semanticAnalyze=function(e){this.shaderData=e.shaderData,this.shaderData.symbolTable=e.symbolTableStack.scope},t}(tr);e.GLShaderProgram=eq,eq=eB([tt(eW.gs_shader_program)],eq);var eH=function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.macroExpressions=[],t}ei(t,e);var r=t.prototype;return r.init=function(){this.macroExpressions.length=0},r.semanticAnalyze=function(e){var t,r=this.children[0];(z(r,eQ)||z(r,ta)||z(r,th)||z(r,Y))&&(e.shaderData.globalMacroDeclarations.push(this),z(r,ta)?(t=this.macroExpressions).push.apply(t,[].concat(r.macroExpressions)):this.macroExpressions.push(r))},t}(tr);e.GlobalDeclaration=eH,eH=eB([tt(eW.global_declaration)],eH);var eQ=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.codeGen=function(t){return t.cache(this,e.prototype.codeGen.call(this,t)+"\n")},t}(tr);e.MacroUndef=eQ,eQ=eB([tt(eW.macro_undef)],eQ);var eK=function(e){function t(){return e.apply(this,arguments)||this}ei(t,e);var r=t.prototype;return r.semanticAnalyze=function(e){e.symbolTableStack._macroLevel++},r.codeGen=function(t){return t.cache(this,"\n"+e.prototype.codeGen.call(this,t)+"\n")},t}(tr);e.MacroPushContext=eK,eK=eB([tt(eW.macro_push_context)],eK);var eJ=function(e){function t(){return e.apply(this,arguments)||this}ei(t,e);var r=t.prototype;return r.semanticAnalyze=function(e){e.symbolTableStack._macroLevel--},r.codeGen=function(t){return t.cache(this,"\n"+e.prototype.codeGen.call(this,t)+"\n")},t}(tr);e.MacroPopContext=eJ,eJ=eB([tt(eW.macro_pop_context)],eJ);var e$=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.codeGen=function(t){return t.cache(this,"\n"+e.prototype.codeGen.call(this,t)+"\n")},t}(tr);e.MacroElifExpression=e$,e$=eB([tt(eW.macro_elif_expression)],e$);var tn=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.codeGen=function(t){return t.cache(this,"\n"+e.prototype.codeGen.call(this,t)+"\n")},t}(tr);e.MacroElseExpression=tn,tn=eB([tt(eW.macro_else_expression)],tn);var ti=function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.macroExpressions=[],t}ei(t,e);var r=t.prototype;return r.init=function(){this.macroExpressions.length=0},r.semanticAnalyze=function(e){var t=this.children,r=this.macroExpressions;1===t.length?r.push.apply(r,[].concat(t[0].macroExpressions)):(r.push.apply(r,[].concat(t[0].macroExpressions)),r.push.apply(r,[].concat(t[1].macroExpressions)))},r.codeGen=function(e){var t=this.children;return 1===t.length?e.cache(this,t[0].codeGen(e)):e.cache(this,t[0].codeGen(e)+"\n"+t[1].codeGen(e))},t}(tr);e.GlobalMacroDeclaration=ti,ti=eB([tt(eW.global_macro_declaration)],ti);var ta=function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.macroExpressions=[],t}ei(t,e);var r=t.prototype;return r.init=function(){this.macroExpressions.length=0},r.semanticAnalyze=function(e){var t=this.children,r=this.macroExpressions;3===t.length?(r.push(t[0]),r.push.apply(r,[].concat(t[1].macroExpressions)),r.push.apply(r,[].concat(t[2].macroExpressions))):(r.push(t[0]),r.push.apply(r,[].concat(t[1].macroExpressions)))},t}(tr);e.GlobalMacroIfStatement=ta,ta=eB([tt(eW.global_macro_if_statement)],ta);var to=function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.macroExpressions=[],t}ei(t,e);var r=t.prototype;return r.init=function(){this.macroExpressions.length=0},r.semanticAnalyze=function(e){var r=this.children,n=r[r.length-1],i=this.macroExpressions;i.push(r[0]),z(r[1],ti)&&i.push.apply(i,[].concat(r[1].macroExpressions)),z(n,t)&&i.push.apply(i,[].concat(n.macroExpressions)),r.length>1&&z(n,eJ)&&i.push(n)},t}(tr);e.GlobalMacroBranch=to,to=eB([tt(eW.global_macro_branch)],to);var ts=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t}(tr);e.MacroIfStatement=ts,ts=eB([tt(eW.macro_if_statement)],ts);var tc=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t}(tr);e.MacroBranch=tc,tc=eB([tt(eW.macro_branch)],tc);var tu=function(e){function n(){var t;return t=e.apply(this,arguments)||this,t.referenceSymbolNames=[],t.referenceSymbols=[],t.hasAstValue=!1,t.visibleHasAstValue=!1,t.isFunctionLikeMacro=!1,t.aliasesNonBuiltinIdent=!1,t}ei(n,e);var i=n.prototype;return i.init=function(){this.expandedSyntax=void 0,this.referenceSymbolNames.length=0,this.referenceSymbols.length=0,this.hasAstValue=!1,this.visibleHasAstValue=!1,this.isFunctionLikeMacro=!1,this.aliasesNonBuiltinIdent=!1},i.semanticAnalyze=function(e){var i,a,o=this.children[0],s=o.lexeme;this.macroName=s;var c=e.macroDefineList[s],u=this.referenceSymbolNames;u.length=0,this.referenceSymbols.length=0,this._analyzeForCodegen(c,u);var l=o.branch,h=this.referenceSymbols,d=0,p=!0;if(c)for(var f=0,_=c.length;f<_;f++){var v=c[f];e.canBranchesOverlap(v.branch,l)&&(d++,null==v.valueAst?(p=!1,r(h,{unresolved:!0,branch:t(l,v.branch),isValueIdentity:!0})):n._collectIdentifierRefs(v.valueAst,v.params,u,h,l,void 0,e4.unwrapBareIdentifier(v.valueAst,{allowParens:!0})))}this.visibleHasAstValue=d>0&&p,e.diagnosticsEnabled&&(this.expandedSyntax=null==(a=e.semanticDiagnostics)?void 0:null==(i=a.macroExpansion)?void 0:i.call(a,this,e))},i._analyzeForCodegen=function(e,t){for(var r,i=!0,a=!1,o=!0,s=null!=(r=null==e?void 0:e.length)?r:0,c=0;c<s;c++){var u=e[c];if(u.valueAst||(i=!1),u.isFunction&&(a=!0),u.valueAst&&n._collectIdentifierRefs(u.valueAst,u.params,t),u.isFunction||!u.valueAst)o=!1;else{var l=e4.unwrapBareIdentifier(u.valueAst,{allowParens:!1}),h=null==l?void 0:l.children[0],d=z(h,Y)?h.lexeme:void 0;(!d||eX.isExist(d))&&(o=!1)}}this.hasAstValue=s>0&&i,this.isFunctionLikeMacro=a,this.aliasesNonBuiltinIdent=s>0&&o},n._collectIdentifierRefs=function(e,i,a,o,s,c,u){if(void 0===s&&(s=K),z(e,em)&&3===e.children.length&&z(e.children[2],Y)){var l=e.children[0];if(z(l,tr)){var h=e4.unwrapBareIdentifier(l,{allowParens:!0});if(h){n._collectIdentifierRefs(l,i,a,o,s,h,u);return}}}if(z(e,ej)){var d=e.children[0],p=u===e,f=c===e?e:void 0,_=t(s,e._branch);if(z(d,Y)){var v=d.lexeme,m=i.indexOf(v);-1===m?(-1===a.indexOf(v)&&a.push(v),o&&r(o,{name:v,branch:_,isValueIdentity:p,replacementMemberOwner:f})):o&&(f||p)&&r(o,{formalParameterIndex:m,branch:_,isValueIdentity:p,replacementMemberOwner:f,requiresRuntimeOwnerExpansion:!!f||void 0})}else if(z(d,n)||z(d,tl)){for(var g,y=d.referenceSymbols,S=j(y);!(g=S()).done;){var b=g.value;if(b.unresolved){o&&(f||p)&&r(o,{unresolved:!0,branch:t(_,b.branch),isValueIdentity:p,replacementMemberOwner:f,requiresRuntimeOwnerExpansion:!!f||void 0});continue}var x=b.name,E=b.formalParameterIndex;if(void 0!==x){var C=i.indexOf(x);-1===C?-1===a.indexOf(x)&&a.push(x):(x=void 0,E=C)}if(o){var A=t(_,b.branch),T=null!=f?f:b.replacementMemberOwner,O=p&&b.isValueIdentity,I=void 0!==f||b.requiresRuntimeOwnerExpansion;void 0!==x?r(o,{name:x,branch:A,isValueIdentity:O,replacementMemberOwner:T,requiresRuntimeOwnerExpansion:I}):void 0!==E&&r(o,{formalParameterIndex:E,branch:A,isValueIdentity:O,replacementMemberOwner:T,requiresRuntimeOwnerExpansion:I})}}var R=y.some(function(e){return e.isValueIdentity});o&&d.macroName&&(!y.length&&f||p&&!R&&!d.visibleHasAstValue)&&(r(o,{name:d.macroName,branch:_,isValueIdentity:p,replacementMemberOwner:f,requiresRuntimeOwnerExpansion:!0}),-1===a.indexOf(d.macroName)&&a.push(d.macroName))}return}var M=e.children;if(M)for(var P=0,D=M.length;P<D;P++){var L=M[P];z(L,tr)&&n._collectIdentifierRefs(L,i,a,o,s,c,u)}},n}(tr);e.MacroCallSymbol=tu,tu=eB([tt(eW.macro_call_symbol)],tu);var tl=function(e){function n(){var t;return t=e.apply(this,arguments)||this,t.referenceSymbolNames=[],t.referenceSymbols=[],t.macroName="",t.hasAstValue=!1,t.visibleHasAstValue=!1,t.isFunctionLikeMacro=!1,t.aliasesNonBuiltinIdent=!1,t}ei(n,e);var i=n.prototype;return i.init=function(){this.expandedSyntax=void 0,this.referenceSymbolNames.length=0,this.referenceSymbols.length=0,this.macroName="",this.hasAstValue=!1,this.visibleHasAstValue=!1,this.isFunctionLikeMacro=!1,this.aliasesNonBuiltinIdent=!1},i.semanticAnalyze=function(e){for(var n,i,a,o=this.children[0],s=this.children[2],c=z(s,es)?s.paramNodes:void 0,u=j(o.referenceSymbols);!(a=u()).done;){var l=a.value,h=l.formalParameterIndex;if(void 0===h){r(this.referenceSymbols,l),void 0!==l.name&&-1===this.referenceSymbolNames.indexOf(l.name)&&this.referenceSymbolNames.push(l.name);continue}var d=null==c?void 0:c[h];z(d,tr)&&function e(n,i,a,o){if(i.isValueIdentity){!function(e,n,i,a){var o=e4.unwrapBareIdentifier(e,{allowParens:!0});if(o){var s=o.children[0];if(z(s,Y)){r(i,{name:s.lexeme,branch:t(n.branch,o._branch),isValueIdentity:!0}),-1===a.indexOf(s.lexeme)&&a.push(s.lexeme);return}if(z(s,tu)||z(s,tl)){for(var c,u=!1,l=j(s.referenceSymbols);!(c=l()).done;){var h=c.value;if(h.isValueIdentity){if(h.unresolved){r(i,{unresolved:!0,branch:t(n.branch,h.branch),isValueIdentity:!0}),u=!0;continue}void 0!==h.name&&(r(i,{name:h.name,branch:t(n.branch,h.branch),isValueIdentity:!0}),-1===a.indexOf(h.name)&&a.push(h.name),u=!0)}}u||s.visibleHasAstValue||!s.macroName||(r(i,{name:s.macroName,branch:t(n.branch,o._branch),isValueIdentity:!0}),-1===a.indexOf(s.macroName)&&a.push(s.macroName))}}}(n,i,a,o);return}if(z(n,ej)){var s=n.children[0];if(z(s,Y))r(a,{name:s.lexeme,branch:t(i.branch,n._branch),replacementMemberOwner:i.replacementMemberOwner,requiresRuntimeOwnerExpansion:!0}),-1===o.indexOf(s.lexeme)&&o.push(s.lexeme);else if(z(s,tu)||z(s,tl)){for(var c,u=s.referenceSymbols,l=j(u);!(c=l()).done;){var h=c.value;if(h.unresolved){r(a,{unresolved:!0,branch:t(i.branch,h.branch),replacementMemberOwner:i.replacementMemberOwner,requiresRuntimeOwnerExpansion:!0});continue}void 0!==h.name&&(r(a,{name:h.name,branch:t(i.branch,h.branch),replacementMemberOwner:i.replacementMemberOwner,requiresRuntimeOwnerExpansion:!0}),-1===o.indexOf(h.name)&&o.push(h.name))}!u.length&&s.macroName&&(r(a,{name:s.macroName,branch:t(i.branch,n._branch),replacementMemberOwner:i.replacementMemberOwner,requiresRuntimeOwnerExpansion:!0}),-1===o.indexOf(s.macroName)&&o.push(s.macroName))}return}for(var d,p=j(n.children);!(d=p()).done;){var f=d.value;z(f,tr)&&e(f,i,a,o)}}(d,l,this.referenceSymbols,this.referenceSymbolNames)}this.macroName=o.macroName,this.hasAstValue=o.hasAstValue,this.visibleHasAstValue=o.visibleHasAstValue,this.isFunctionLikeMacro=o.isFunctionLikeMacro,this.aliasesNonBuiltinIdent=o.aliasesNonBuiltinIdent,e.diagnosticsEnabled&&(this.expandedSyntax=null==(i=e.semanticDiagnostics)?void 0:null==(n=i.macroExpansion)?void 0:n.call(i,this,e))},i.codeGen=function(e){return e.cache(this,e.visitMacroCallFunction(this))},n}(tr);e.MacroCallFunction=tl,tl=eB([tt(eW.macro_call_function)],tl);var th=function(e){function t(){return e.apply(this,arguments)||this}ei(t,e);var r=t.prototype;return r.init=function(){this.macroName="",this.isFunction=!1,this.valueExpression=void 0},r.semanticAnalyze=function(e){var t=this,r=this.children;this.macroName=r[1].lexeme;var n=[],i=2;z(r[2],Y)&&r[2].type===U.MACRO_DEFINE_PARAMS&&(this.isFunction=!0,n=e4.parseMacroParamList(r[2].lexeme),i=3),z(r[i],e_)&&(this.valueExpression=r[i]);var a=r[1].branch,o=e.macroDefineList,s=o[this.macroName],c=null==s?void 0:s.find(function(e){var r;return!e.valueAst&&(r=e).isFunction===t.isFunction&&r.params.length===n.length&&r.params.every(function(e,t){return e===n[t]})&&function(e,t){if(e.length!==t.length)return!1;for(var r=0,n=e.length;r<n;r++){var i,a,o,s=e[r],c=t[r];if(s.name!==c.name||s.defined!==c.defined||!Q(s.condition,c.condition))return!1;var u=s.precedingConditions,l=c.precedingConditions;if((null!=(i=null==u?void 0:u.length)?i:0)!==(null!=(a=null==l?void 0:l.length)?a:0))return!1;for(var h=0,d=null!=(o=null==u?void 0:u.length)?o:0;h<d;h++)if(!Q(u[h],l[h]))return!1}return!0}(e.branch,a)});if(c)c.valueAst=this.valueExpression;else{var u={isFunction:this.isFunction,params:n,valueAst:this.valueExpression,dedupKey:this.macroName+"#ast/"+(this.isFunction?n.join(","):""),branch:a};s?s.push(u):o[this.macroName]=[u]}this.isFunction&&e.popScope()},r.codeGen=function(e){return e.cache(this,e.visitMacroDefine(this))},t}(tr);e.MacroDefine=th,th=eB([tt(eW.macro_define)],th)}(g||(g={}));var tn=g,ti=((_={})[_.Shift=0]="Shift",_[_.Reduce=1]="Reduce",_[_.Accept=2]="Accept",_),ta=function(){function e(){}return e.isTerminal=function(e){return e<eW.START},e.toString=function(e){if(this.isTerminal(e)){var t;return null!=(t=B[e])?t:U[e]}return eW[e]},e.createProductionWithOptions=function(e,t,r){return this._createProductionWithOptions(e,t,r,r)},e.createAnalyzerProductionWithOptions=function(e,t,r){return this._createProductionWithOptions(e,t,void 0,r)},e._createProductionWithOptions=function(t,r,n,i){for(var a,o=null!=n?n:tn.TrivialNode,s=null!=i?i:tn.TrivialNode,c=[],u=j(r);!(a=u()).done;)!function(){var r=a.value,u=!n&&1===r.length&&!e.isTerminal(r[0]),l=!i&&1===r.length&&!e.isTerminal(r[0]);c.push([[].concat([t],r),function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];if(r[0]){var i=e.diagnosticsEnabled;if(i?l:u)e.semanticStack.push(r[0]);else{var a=r[0].location.start,c=r[r.length-1].location.end,h=e.objectPool?e.objectPool.createRange(a,c):eh.createRange(a,c);tn.get(i?s:o,e,h,r)}}}])}();return c},e.addMapSetItem=function(e,t,r){var n,i=null!=(n=e.get(t))?n:new Set;i.add(r),e.set(t,i)},e.isSubSet=function(e,t){for(var r,n=j(e);!(r=n()).done;){var i=r.value;if(!t.has(i))return!1}return!0},e.isActionEqual=function(e,t){return e.action===t.action&&e.target===t.target},e.printAction=function(e){var t=ej.pool.get(e.target);return"<Action: "+ti[e.action]+" -> "+this.printProduction(t)+">"},e.printProduction=function(t){var r=t.derivation.map(function(t){return e.toString(t)}).join("|");return eW[t.goal]+" :=> "+r},e}(),to=function(){function e(t,r,n){this._needReInfer=!0,this.production=t,this.position=r,this.lookaheadSet=new Set;for(var i,a=j(n);!(i=a()).done;){var o=i.value;this.lookaheadSet.add(o)}this.id=e._id++}var t=e.prototype;return t.addLookahead=function(e){for(var t,r=j(e);!(t=r()).done;){var n=t.value;this.lookaheadSet.has(n)||(this.lookaheadSet.add(n),this.needReInfer=!0)}},t.symbolByOffset=function(e){return this.production.derivation[this.position+e]},t.canReduce=function(){if(this.position>this.production.derivation.length-1)return!0;for(var e=this.position;e<this.production.derivation.length;e++)if(this.production.derivation[e]!==B.EPSILON)return!1;return!0},t.advance=function(){if(this.canReduce())throw"Error: advance reduce-able parsing state item";return new e(this.production,this.position+1,this.lookaheadSet)},t.toString=function(){var e,t=this.production.derivation.map(function(e){return ta.toString(e)});return t[this.position]="."+(null!=(e=t[this.position])?e:""),eW[this.production.goal]+" :=> "+t.join("|")+" ;"+Array.from(this.lookaheadSet).map(function(e){return ta.toString(e)}).join("/")},er(e,[{key:"needReInfer",get:function(){return this._needReInfer},set:function(e){this._needReInfer=e}},{key:"curSymbol",get:function(){return this.production.derivation[this.position]}},{key:"nextSymbol",get:function(){return this.production.derivation[this.position+1]}}]),e}();to._id=0;var ts=function(){function e(t){this.closured=!1,this._stateItemPool=new Map,this.id=e._id++,this._items=new Set([].concat(t)),this.cores=new Set([].concat(t));for(var r,n=j(t);!(r=n()).done;){var i=r.value,a=this.getStateItemMapKey(i.production,i.position);this._stateItemPool.set(a,i)}e.pool.set(this.id,this)}var t=e.prototype;return t.getStateItemMapKey=function(e,t){return e.id+","+t},t.createStateItem=function(e,t,r){void 0===r&&(r=new Set);var n=this.getStateItemMapKey(e,t),i=this._stateItemPool.get(n);if(i){for(var a,o=j(r);!(a=o()).done;){var s=a.value;i.lookaheadSet.has(s)||(i.lookaheadSet.add(s),i.needReInfer=!0)}return i}var c=new to(e,t,r);return this._stateItemPool.set(n,c),c},e.create=function(t){var r=this.getMapKey(t),n=this.closureMap.get(r);if(n){for(var i,a=j(t);!(i=a()).done;){var o=i.value;n.createStateItem(o.production,o.position,o.lookaheadSet)}return n}var s=new e(t);return this.closureMap.set(r,s),s},e.getMapKey=function(e){return e.map(function(e){return e.production.id+","+e.position}).join(";")},er(e,[{key:"items",get:function(){return this._items}},{key:"needReInfer",get:function(){for(var e,t=j(this.cores);!(e=t()).done;)if(e.value.needReInfer)return!0;return!1}}]),e}();ts.closureMap=new Map,ts.pool=new Map,ts._id=0;var tc=function(){function e(e){this.firstSetMap=new Map,this.followSetMap=new Map,this.actionTable=new Map,this.gotoTable=new Map,this._firstSetNTStack=[],this.grammar=e}var r=e.prototype;return r.generate=function(){this.computeFirstSet(),this.buildStateTable()},r.buildStateTable=function(){var e=[new to(this.grammar.productions[0],0,[B.EOF])],t=ts.create(e);this._extendState(t)},r._extendState=function(e){if(e.needReInfer){this._closure(e);for(var t,r=this._inferNextState(e),n=j(r);!(t=n()).done;){var i=t.value;this._extendState(i)}}},r._closure=function(e){for(var t,r=j(e.cores);!(t=r()).done;){var n=t.value;n.canReduce()||this._extendStateItem(e,n)}return e.closured=!0,e},r._extendStateItem=function(e,t){if(!ta.isTerminal(t.curSymbol)){var r=this.grammar.getProductionList(t.curSymbol);if(void 0!==t.nextSymbol){for(var n=new Set,i=!1,a=1,o=t.symbolByOffset(1);void 0!==o;o=t.symbolByOffset(++a)){if(ta.isTerminal(o)){n.add(o),i=!0;break}s=this.firstSetMap.get(o);for(var s,c,u=j(s);!(c=u()).done;){var l=c.value;n.add(l)}if(!s.has(B.EPSILON))break}if(!i&&(null==s?void 0:s.has(B.EPSILON)))for(var h,d=j(t.lookaheadSet);!(h=d()).done;){var p=h.value;n.add(p)}for(var f,_=j(r);!(f=_()).done;){var v=f.value,m=e.createStateItem(v,0);e.items.has(m)&&ta.isSubSet(n,m.lookaheadSet)||(e.items.add(m),m.addLookahead(n),this._extendStateItem(e,m))}}else for(var g,y=j(r);!(g=y()).done;){var S=g.value,b=e.createStateItem(S,0);e.items.has(b)&&ta.isSubSet(t.lookaheadSet,b.lookaheadSet)||(e.items.add(b),b.addLookahead(t.lookaheadSet),this._extendStateItem(e,b))}}},r._inferNextState=function(e){var t=new Map,r=null!=(i=this.actionTable.get(e.id))?i:new Map,n=null!=(a=this.gotoTable.get(e.id))?a:new Map;this.actionTable.set(e.id,r),this.gotoTable.set(e.id,n);for(var i,a,o,s=j(e.items);!(o=s()).done;){var c=o.value;if(c.canReduce()){var u=void 0;u=c.production.goal!==eW.START?{action:ti.Reduce,target:c.production.id}:{action:ti.Accept};for(var l,h=j(c.lookaheadSet);!(l=h()).done;){var d=l.value;this._addAction(r,d,u)}}else{var p=c.advance();ta.addMapSetItem(t,c.curSymbol,p)}c.needReInfer=!1}for(var f,_=new Set,v=j(t.entries());!(f=v()).done;){var m=f.value,g=m[0],y=m[1],S=ts.create(Array.from(y));ta.isTerminal(g)?this._addAction(r,g,{action:ti.Shift,target:S.id}):n.set(g,S.id),_.add(S)}return _},r._addAction=function(r,n,i){var a=r.get(n);if(a&&!ta.isActionEqual(a,i)){if(e._isKnownShiftPreferred(n,a,i)){if(a.action===ti.Shift&&i.action===ti.Reduce)return}else t.Logger.warn("conflict detect: <Terminal "+ta.toString(n)+"> \n",ta.printAction(a),"\n",ta.printAction(i))}r.set(n,i)},r.computeFirstSet=function(){for(var e,t=j(this.grammar.productions.slice(1));!(e=t()).done;){var r=e.value;this._computeFirstSetForNT(r.goal)}},r._computeFirstSetForNT=function(e){var t=this._firstSetNTStack.findIndex(function(t){return t===e});if(-1!==t){for(var r=this.firstSetMap.get(e),n=this._firstSetNTStack.length,i=n-1;i>t;i--){var a=this._firstSetNTStack[i];this.firstSetMap.set(a,r)}return r}this._firstSetNTStack.push(e);var o=this.grammar.getProductionList(e),s=new Set;this.firstSetMap.set(e,s),this.grammar.isNullableNT(e)&&s.add(B.EPSILON);for(var c,u=j(o);!(c=u()).done;){for(var l=c.value,h=0;h<l.derivation.length;h++){var d=l.derivation[h];if(ta.isTerminal(d)){s.add(d);break}for(var p,f=this._computeFirstSetForNT(d),_=j(f);!(p=_()).done;){var v=p.value;v!==B.EPSILON&&s.add(v)}if(!this.grammar.isNullableNT(d))break}h===l.derivation.length&&s.add(B.EPSILON)}return this._firstSetNTStack.pop(),s},e._isKnownShiftPreferred=function(e,t,r){if(e===U.ELSE)return!0;if(e!==B.LEFT_PAREN)return!1;var n=t.action===ti.Reduce?t:r.action===ti.Reduce?r:null;if(!n)return!1;var i=ej.pool.get(n.target);return!!i&&i.goal===eW.type_specifier_nonarray&&1===i.derivation.length&&i.derivation[0]===eW.macro_call_symbol},e}(),tu=function(){function e(e,t){this.startSymbol=e,t.unshift(new ej(eW.START,[e])),this.productions=t}var t=e.prototype;return t.getProductionList=function(e){return this.productions.filter(function(t){return t.goal===e})},t.isNullableNT=function(e){return this.productions.find(function(t){return t.goal===e&&t.derivation[0]===B.EPSILON})},t.getProductionByID=function(e){return ej.pool.get(e)},e.create=function(t,r){return new e(t,r.map(function(e){return new ej(e[0],e.slice(1))}))},e}(),tl=[].concat(ta.createProductionWithOptions(eW.gs_shader_program,[[eW.global_declaration],[eW.gs_shader_program,eW.global_declaration]],tn.GLShaderProgram),ta.createProductionWithOptions(eW.global_declaration,[[eW.precision_specifier],[eW.variable_declaration_statement],[eW.struct_specifier],[eW.function_definition],[eW.global_macro_if_statement],[eW.macro_undef],[eW.macro_define],[U.MACRO_DEFINE_EXPRESSION]],tn.GlobalDeclaration),ta.createProductionWithOptions(eW.macro_define,[[U.MACRO_DEFINE,B.ID,eW.expression,U.MACRO_DEFINE_END],[U.MACRO_DEFINE,B.ID,U.MACRO_DEFINE_PARAMS,eW.expression,U.MACRO_DEFINE_END]],tn.MacroDefine),ta.createProductionWithOptions(eW.macro_call_symbol,[[U.MACRO_CALL]],tn.MacroCallSymbol),ta.createProductionWithOptions(eW.macro_call_function,[[eW.macro_call_symbol,B.LEFT_PAREN,B.RIGHT_PAREN],[eW.macro_call_symbol,B.LEFT_PAREN,eW.function_call_parameter_list,B.RIGHT_PAREN]],tn.MacroCallFunction),ta.createProductionWithOptions(eW.macro_undef,[[U.MACRO_UNDEF,B.ID],[U.MACRO_UNDEF,U.MACRO_CALL]],tn.MacroUndef),ta.createProductionWithOptions(eW.macro_push_context,[[U.MACRO_IF,U.MACRO_CONDITIONAL_EXPRESSION],[U.MACRO_IFDEF,B.ID],[U.MACRO_IFNDEF,B.ID],[U.MACRO_IFDEF,eW.macro_call_symbol],[U.MACRO_IFNDEF,eW.macro_call_symbol]],tn.MacroPushContext),ta.createProductionWithOptions(eW.macro_pop_context,[[U.MACRO_ENDIF]],tn.MacroPopContext),ta.createProductionWithOptions(eW.macro_elif_expression,[[U.MACRO_ELIF,U.MACRO_CONDITIONAL_EXPRESSION]],tn.MacroElifExpression),ta.createProductionWithOptions(eW.macro_else_expression,[[U.MACRO_ELSE]],tn.MacroElseExpression),ta.createProductionWithOptions(eW.global_macro_declaration,[[eW.global_declaration],[eW.global_macro_declaration,eW.global_declaration]],tn.GlobalMacroDeclaration),ta.createProductionWithOptions(eW.global_macro_if_statement,[[eW.macro_push_context,eW.global_macro_declaration,eW.global_macro_branch],[eW.macro_push_context,eW.global_macro_branch]],tn.GlobalMacroIfStatement),ta.createProductionWithOptions(eW.global_macro_branch,[[eW.macro_pop_context],[eW.macro_elif_expression,eW.global_macro_declaration,eW.global_macro_branch],[eW.macro_else_expression,eW.global_macro_declaration,eW.macro_pop_context],[eW.macro_elif_expression,eW.global_macro_branch],[eW.macro_else_expression,eW.macro_pop_context]],tn.GlobalMacroBranch),ta.createProductionWithOptions(eW.variable_declaration,[[eW.fully_specified_type,B.ID],[eW.fully_specified_type,B.ID,eW.array_specifier],[eW.fully_specified_type,B.ID,B.EQUAL,eW.initializer]],tn.VariableDeclaration),ta.createProductionWithOptions(eW.variable_declaration_list,[[eW.variable_declaration],[eW.variable_declaration_list,B.COMMA,B.ID],[eW.variable_declaration_list,B.COMMA,B.ID,eW.array_specifier]],tn.VariableDeclarationList),ta.createProductionWithOptions(eW.variable_declaration_statement,[[eW.variable_declaration_list,B.SEMICOLON]]),ta.createProductionWithOptions(eW.ext_builtin_type_specifier_nonarray,[[U.VOID],[U.FLOAT],[U.BOOL],[U.INT],[U.UINT],[U.VEC2],[U.VEC3],[U.VEC4],[U.BVEC2],[U.BVEC3],[U.BVEC4],[U.IVEC2],[U.IVEC3],[U.IVEC4],[U.UVEC2],[U.UVEC3],[U.UVEC4],[U.MAT2],[U.MAT3],[U.MAT4],[U.MAT2X3],[U.MAT2X4],[U.MAT3X2],[U.MAT3X4],[U.MAT4X2],[U.MAT4X3],[U.SAMPLER2D],[U.SAMPLER3D],[U.SAMPLER_CUBE],[U.SAMPLER2D_SHADOW],[U.SAMPLER_CUBE_SHADOW],[U.SAMPLER2D_ARRAY],[U.SAMPLER2D_ARRAY_SHADOW],[U.I_SAMPLER2D],[U.I_SAMPLER3D],[U.I_SAMPLER_CUBE],[U.I_SAMPLER2D_ARRAY],[U.U_SAMPLER2D],[U.U_SAMPLER3D],[U.U_SAMPLER_CUBE],[U.U_SAMPLER2D_ARRAY]],tn.ExtBuiltinTypeSpecifierNonArray),ta.createProductionWithOptions(eW.type_specifier_nonarray,[[B.ID],[eW.ext_builtin_type_specifier_nonarray],[eW.macro_call_symbol]],tn.TypeSpecifierNonArray),ta.createProductionWithOptions(eW.fully_specified_type,[[eW.type_specifier],[eW.type_qualifier,eW.type_specifier]],tn.FullySpecifiedType),ta.createProductionWithOptions(eW.type_specifier,[[eW.type_specifier_nonarray],[eW.ext_builtin_type_specifier_nonarray,eW.array_specifier]],tn.TypeSpecifier),ta.createProductionWithOptions(eW.type_qualifier,[[eW.single_type_qualifier],[eW.type_qualifier,eW.single_type_qualifier]],tn.TypeQualifier),ta.createProductionWithOptions(eW.single_type_qualifier,[[eW.storage_qualifier],[eW.precision_qualifier],[eW.interpolation_qualifier],[eW.invariant_qualifier],[U.PRECISE]],tn.SingleTypeQualifier),ta.createAnalyzerProductionWithOptions(eW.storage_qualifier,[[U.CONST],[U.IN],[U.INOUT],[U.OUT],[U.CENTROID]],tn.StorageQualifier),ta.createAnalyzerProductionWithOptions(eW.interpolation_qualifier,[[U.SMOOTH],[U.FLAT]],tn.InterpolationQualifier),ta.createAnalyzerProductionWithOptions(eW.invariant_qualifier,[[U.INVARIANT]],tn.InvariantQualifier),ta.createAnalyzerProductionWithOptions(eW.precision_qualifier,[[U.HIGHP],[U.MEDIUMP],[U.LOWP]],tn.PrecisionQualifier),ta.createProductionWithOptions(eW.struct_specifier,[[U.STRUCT,B.ID,B.LEFT_BRACE,eW.struct_declaration_list,B.RIGHT_BRACE,B.SEMICOLON],[U.STRUCT,B.LEFT_BRACE,eW.struct_declaration_list,B.RIGHT_BRACE,B.SEMICOLON]],tn.StructSpecifier),ta.createProductionWithOptions(eW.struct_declaration_list,[[eW.struct_declaration],[eW.struct_declaration_list,eW.struct_declaration]],tn.StructDeclarationList),ta.createProductionWithOptions(eW.struct_declaration,[[eW.type_specifier,eW.struct_declarator_list,B.SEMICOLON],[eW.type_qualifier,eW.type_specifier,eW.struct_declarator_list,B.SEMICOLON],[eW.layout_qualifier,eW.type_specifier,eW.struct_declarator,B.SEMICOLON],[eW.macro_struct_declaration]],tn.StructDeclaration),ta.createProductionWithOptions(eW.macro_struct_declaration,[[eW.macro_push_context,eW.struct_declaration_list,eW.macro_struct_branch],[eW.macro_push_context,eW.macro_struct_branch]],tn.MacroStructDeclaration),ta.createProductionWithOptions(eW.macro_struct_branch,[[eW.macro_pop_context],[eW.macro_elif_expression,eW.struct_declaration_list,eW.macro_struct_branch],[eW.macro_else_expression,eW.struct_declaration_list,eW.macro_pop_context],[eW.macro_elif_expression,eW.macro_struct_branch],[eW.macro_else_expression,eW.macro_pop_context]],tn.MacroStructBranch),ta.createProductionWithOptions(eW.layout_qualifier,[[U.LAYOUT,B.LEFT_PAREN,U.LOCATION,B.EQUAL,B.INT_CONSTANT,B.RIGHT_PAREN]],tn.LayoutQualifier),ta.createProductionWithOptions(eW.struct_declarator_list,[[eW.struct_declarator],[eW.struct_declarator_list,B.COMMA,eW.struct_declarator]],tn.StructDeclaratorList),ta.createProductionWithOptions(eW.struct_declarator,[[B.ID],[B.ID,eW.array_specifier]],tn.StructDeclarator),ta.createProductionWithOptions(eW.array_specifier,[[B.LEFT_BRACKET,B.RIGHT_BRACKET],[B.LEFT_BRACKET,eW.integer_constant_expression,B.RIGHT_BRACKET]],tn.ArraySpecifier),ta.createProductionWithOptions(eW.integer_constant_expression_operator,[[B.PLUS],[B.DASH],[B.STAR],[B.SLASH],[B.PERCENT]],tn.IntegerConstantExpressionOperator),ta.createProductionWithOptions(eW.integer_constant_expression,[[eW.variable_identifier],[B.INT_CONSTANT],[eW.integer_constant_expression,eW.integer_constant_expression_operator,B.INT_CONSTANT],[eW.integer_constant_expression,eW.integer_constant_expression_operator,eW.variable_identifier]],tn.IntegerConstantExpression),ta.createAnalyzerProductionWithOptions(eW.conditional_expression,[[eW.logical_or_expression],[eW.logical_or_expression,B.QUESTION,eW.expression,B.COLON,eW.assignment_expression]],tn.ConditionalExpression),ta.createAnalyzerProductionWithOptions(eW.logical_or_expression,[[eW.logical_xor_expression],[eW.logical_or_expression,B.OR_OP,eW.logical_xor_expression]],tn.LogicalOrExpression),ta.createAnalyzerProductionWithOptions(eW.logical_xor_expression,[[eW.logical_and_expression],[eW.logical_xor_expression,B.XOR_OP,eW.logical_and_expression]],tn.LogicalXorExpression),ta.createAnalyzerProductionWithOptions(eW.logical_and_expression,[[eW.inclusive_or_expression],[eW.logical_and_expression,B.AND_OP,eW.inclusive_or_expression]],tn.LogicalAndExpression),ta.createAnalyzerProductionWithOptions(eW.inclusive_or_expression,[[eW.exclusive_or_expression],[eW.inclusive_or_expression,B.VERTICAL_BAR,eW.exclusive_or_expression]],tn.InclusiveOrExpression),ta.createAnalyzerProductionWithOptions(eW.exclusive_or_expression,[[eW.and_expression],[eW.exclusive_or_expression,B.CARET,eW.and_expression]],tn.ExclusiveOrExpression),ta.createAnalyzerProductionWithOptions(eW.and_expression,[[eW.equality_expression],[eW.and_expression,B.AMPERSAND,eW.equality_expression]],tn.AndExpression),ta.createAnalyzerProductionWithOptions(eW.equality_expression,[[eW.relational_expression],[eW.equality_expression,B.EQ_OP,eW.relational_expression],[eW.equality_expression,B.NE_OP,eW.relational_expression]],tn.EqualityExpression),ta.createAnalyzerProductionWithOptions(eW.relational_expression,[[eW.shift_expression],[eW.relational_expression,B.LEFT_ANGLE,eW.shift_expression],[eW.relational_expression,B.RIGHT_ANGLE,eW.shift_expression],[eW.relational_expression,B.LE_OP,eW.shift_expression],[eW.relational_expression,B.GE_OP,eW.shift_expression]],tn.RelationalExpression),ta.createAnalyzerProductionWithOptions(eW.shift_expression,[[eW.additive_expression],[eW.shift_expression,B.LEFT_OP,eW.additive_expression],[eW.shift_expression,B.RIGHT_OP,eW.additive_expression]],tn.ShiftExpression),ta.createAnalyzerProductionWithOptions(eW.additive_expression,[[eW.multiplicative_expression],[eW.additive_expression,B.PLUS,eW.multiplicative_expression],[eW.additive_expression,B.DASH,eW.multiplicative_expression]],tn.AdditiveExpression),ta.createAnalyzerProductionWithOptions(eW.multiplicative_expression,[[eW.unary_expression],[eW.multiplicative_expression,B.STAR,eW.unary_expression],[eW.multiplicative_expression,B.SLASH,eW.unary_expression],[eW.multiplicative_expression,B.PERCENT,eW.unary_expression]],tn.MultiplicativeExpression),ta.createAnalyzerProductionWithOptions(eW.unary_expression,[[eW.postfix_expression],[B.INC_OP,eW.unary_expression],[B.DEC_OP,eW.unary_expression],[eW.unary_operator,eW.unary_expression]],tn.UnaryExpression),ta.createAnalyzerProductionWithOptions(eW.unary_operator,[[B.PLUS],[B.DASH],[B.BANG],[B.TILDE]],tn.UnaryOperator),ta.createProductionWithOptions(eW.postfix_expression,[[eW.primary_expression],[eW.postfix_expression,B.LEFT_BRACKET,eW.expression,B.RIGHT_BRACKET],[eW.function_call],[eW.postfix_expression,B.DOT,B.ID],[eW.postfix_expression,B.DOT,eW.function_call],[eW.postfix_expression,B.INC_OP],[eW.postfix_expression,B.DEC_OP]],tn.PostfixExpression),ta.createProductionWithOptions(eW.primary_expression,[[eW.variable_identifier],[B.INT_CONSTANT],[B.FLOAT_CONSTANT],[U.True],[U.False],[B.LEFT_PAREN,eW.expression,B.RIGHT_PAREN]],tn.PrimaryExpression),ta.createProductionWithOptions(eW.expression,[[eW.assignment_expression],[eW.expression,B.COMMA,eW.assignment_expression]],tn.Expression),ta.createProductionWithOptions(eW.assignment_expression,[[eW.conditional_expression],[eW.unary_expression,eW.assignment_operator,eW.assignment_expression]],tn.AssignmentExpression),ta.createAnalyzerProductionWithOptions(eW.assignment_operator,[[B.EQUAL],[B.MUL_ASSIGN],[B.DIV_ASSIGN],[B.MOD_ASSIGN],[B.ADD_ASSIGN],[B.SUB_ASSIGN],[B.LEFT_ASSIGN],[B.RIGHT_ASSIGN],[B.AND_ASSIGN],[B.XOR_ASSIGN],[B.OR_ASSIGN]],tn.AssignmentOperator),ta.createProductionWithOptions(eW.function_call,[[eW.function_call_generic]],tn.FunctionCall),ta.createProductionWithOptions(eW.function_call_generic,[[eW.function_identifier,B.LEFT_PAREN,eW.function_call_parameter_list,B.RIGHT_PAREN],[eW.function_identifier,B.LEFT_PAREN,B.RIGHT_PAREN],[eW.function_identifier,U.VOID,B.RIGHT_PAREN]],tn.FunctionCallGeneric),ta.createProductionWithOptions(eW.function_call_parameter_list,[[eW.assignment_expression],[eW.function_call_parameter_list,B.COMMA,eW.assignment_expression],[eW.macro_call_arg_block],[eW.function_call_parameter_list,eW.macro_call_arg_block]],tn.FunctionCallParameterList),ta.createProductionWithOptions(eW.macro_call_arg_case_list,[[eW.assignment_expression],[B.COMMA,eW.assignment_expression],[eW.macro_call_arg_block],[eW.macro_call_arg_case_list,eW.macro_call_arg_block],[eW.macro_call_arg_case_list,B.COMMA,eW.assignment_expression]],tn.MacroCallArgCaseList),ta.createProductionWithOptions(eW.macro_call_arg_block,[[eW.macro_push_context,eW.macro_call_arg_branch],[eW.macro_push_context,eW.macro_call_arg_case_list,eW.macro_call_arg_branch]],tn.MacroCallArgBlock),ta.createProductionWithOptions(eW.macro_call_arg_branch,[[eW.macro_pop_context],[eW.macro_elif_expression,eW.macro_call_arg_case_list,eW.macro_call_arg_branch],[eW.macro_else_expression,eW.macro_call_arg_case_list,eW.macro_pop_context],[eW.macro_elif_expression,eW.macro_call_arg_branch],[eW.macro_else_expression,eW.macro_pop_context]],tn.MacroCallArgBranch),ta.createProductionWithOptions(eW.function_identifier,[[eW.type_specifier]],tn.FunctionIdentifier),ta.createProductionWithOptions(eW.function_definition,[[eW.function_prototype,eW.compound_statement_no_scope]],tn.FunctionDefinition),ta.createProductionWithOptions(eW.function_prototype,[[eW.function_declarator,B.RIGHT_PAREN]],tn.FunctionProtoType),ta.createProductionWithOptions(eW.function_declarator,[[eW.function_header],[eW.function_header,eW.function_parameter_list]],tn.FunctionDeclarator),ta.createProductionWithOptions(eW.function_header,[[eW.fully_specified_type,B.ID,B.LEFT_PAREN]],tn.FunctionHeader),ta.createProductionWithOptions(eW.function_parameter_list,[[eW.parameter_declaration],[eW.function_parameter_list,B.COMMA,eW.parameter_declaration],[eW.macro_param_block],[eW.function_parameter_list,eW.macro_param_block]],tn.FunctionParameterList),ta.createProductionWithOptions(eW.macro_param_case_list,[[eW.parameter_declaration],[B.COMMA,eW.parameter_declaration],[eW.macro_param_block],[eW.macro_param_case_list,eW.macro_param_block],[eW.macro_param_case_list,B.COMMA,eW.parameter_declaration]],tn.MacroParamCaseList),ta.createProductionWithOptions(eW.macro_param_block,[[eW.macro_push_context,eW.macro_parameter_branch],[eW.macro_push_context,eW.macro_param_case_list,eW.macro_parameter_branch]],tn.MacroParamBlock),ta.createProductionWithOptions(eW.macro_parameter_branch,[[eW.macro_pop_context],[eW.macro_elif_expression,eW.macro_param_case_list,eW.macro_parameter_branch],[eW.macro_else_expression,eW.macro_param_case_list,eW.macro_pop_context],[eW.macro_elif_expression,eW.macro_parameter_branch],[eW.macro_else_expression,eW.macro_pop_context]],tn.MacroParameterBranch),ta.createProductionWithOptions(eW.parameter_declaration,[[eW.type_qualifier,eW.parameter_declarator],[eW.parameter_declarator],[eW.macro_call_symbol],[eW.macro_call_function]],tn.ParameterDeclaration),ta.createProductionWithOptions(eW.parameter_declarator,[[eW.type_specifier,B.ID],[eW.type_specifier,B.ID,eW.array_specifier]],tn.ParameterDeclarator),ta.createProductionWithOptions(eW.statement_list,[[eW.statement],[eW.statement_list,eW.statement]],tn.StatementList),ta.createAnalyzerProductionWithOptions(eW.statement,[[eW.compound_statement],[eW.simple_statement]],tn.Statement),ta.createProductionWithOptions(eW.compound_statement_no_scope,[[B.LEFT_BRACE,B.RIGHT_BRACE],[B.LEFT_BRACE,eW.statement_list,B.RIGHT_BRACE]],tn.CompoundStatementNoScope),ta.createAnalyzerProductionWithOptions(eW.compound_statement,[[B.LEFT_BRACE,B.RIGHT_BRACE],[eW.scope_brace,eW.statement_list,eW.scope_end_brace]],tn.CompoundStatement),ta.createAnalyzerProductionWithOptions(eW.simple_statement,[[eW.declaration],[eW.expression_statement],[eW.selection_statement],[eW.iteration_statement],[eW.jump_statement],[eW.macro_if_statement],[eW.macro_undef],[eW.macro_define],[U.MACRO_DEFINE_EXPRESSION]],tn.SimpleStatement),ta.createProductionWithOptions(eW.declaration,[[eW.function_prototype,B.SEMICOLON],[eW.init_declarator_list,B.SEMICOLON],[U.PRECISION,eW.precision_qualifier,eW.ext_builtin_type_specifier_nonarray,B.SEMICOLON],[eW.type_qualifier,B.ID,B.SEMICOLON],[eW.type_qualifier,B.ID,eW.identifier_list,B.SEMICOLON]],tn.Declaration),ta.createProductionWithOptions(eW.identifier_list,[[B.COMMA,B.ID],[eW.identifier_list,B.COMMA,B.ID]],tn.IdentifierList),ta.createProductionWithOptions(eW.init_declarator_list,[[eW.single_declaration],[eW.init_declarator_list,B.COMMA,B.ID],[eW.init_declarator_list,B.COMMA,B.ID,eW.array_specifier],[eW.init_declarator_list,B.COMMA,B.ID,eW.array_specifier,B.EQUAL,eW.initializer],[eW.init_declarator_list,B.COMMA,B.ID,B.EQUAL,eW.initializer]],tn.InitDeclaratorList),ta.createProductionWithOptions(eW.single_declaration,[[eW.fully_specified_type,B.ID],[eW.fully_specified_type,B.ID,eW.array_specifier],[eW.fully_specified_type,B.ID,eW.array_specifier,B.EQUAL,eW.initializer],[eW.fully_specified_type,B.ID,B.EQUAL,eW.initializer],[eW.fully_specified_type,U.MACRO_CALL],[eW.fully_specified_type,U.MACRO_CALL,B.EQUAL,eW.initializer]],tn.SingleDeclaration),ta.createAnalyzerProductionWithOptions(eW.initializer,[[eW.assignment_expression],[B.LEFT_BRACE,eW.initializer_list,B.RIGHT_BRACE]],tn.Initializer),ta.createAnalyzerProductionWithOptions(eW.initializer_list,[[eW.initializer],[eW.initializer_list,B.COMMA,eW.initializer]],tn.InitializerList),ta.createAnalyzerProductionWithOptions(eW.expression_statement,[[B.SEMICOLON],[eW.expression,B.SEMICOLON]],tn.ExpressionStatement),ta.createAnalyzerProductionWithOptions(eW.selection_statement,[[U.IF,B.LEFT_PAREN,eW.expression,B.RIGHT_PAREN,eW.statement],[U.IF,B.LEFT_PAREN,eW.expression,B.RIGHT_PAREN,eW.statement,U.ELSE,eW.statement]],tn.SelectionStatement),ta.createAnalyzerProductionWithOptions(eW.iteration_statement,[[U.WHILE,B.LEFT_PAREN,eW.condition,B.RIGHT_PAREN,eW.statement],[U.FOR,B.LEFT_PAREN,eW.for_init_statement,eW.for_rest_statement,B.RIGHT_PAREN,eW.statement]],tn.IterationStatement),ta.createProductionWithOptions(eW.precision_specifier,[[U.PRECISION,eW.precision_qualifier,eW.ext_builtin_type_specifier_nonarray,B.SEMICOLON]],tn.PrecisionSpecifier),ta.createAnalyzerProductionWithOptions(eW.for_init_statement,[[eW.expression_statement],[eW.declaration]],tn.ForInitStatement),ta.createAnalyzerProductionWithOptions(eW.condition,[[eW.expression],[eW.fully_specified_type,B.ID,B.EQUAL,eW.initializer]],tn.Condition),ta.createAnalyzerProductionWithOptions(eW.for_rest_statement,[[eW.conditionopt,B.SEMICOLON],[eW.conditionopt,B.SEMICOLON,eW.expression]],tn.ForRestStatement),ta.createAnalyzerProductionWithOptions(eW.conditionopt,[[B.EPSILON],[eW.condition]],tn.ConditionOpt),ta.createProductionWithOptions(eW.jump_statement,[[U.CONTINUE,B.SEMICOLON],[U.BREAK,B.SEMICOLON],[U.RETURN,B.SEMICOLON],[U.RETURN,eW.expression,B.SEMICOLON],[U.DISCARD,B.SEMICOLON]],tn.JumpStatement),ta.createProductionWithOptions(eW.scope_brace,[[B.LEFT_BRACE]],tn.ScopeBrace),ta.createProductionWithOptions(eW.scope_end_brace,[[B.RIGHT_BRACE]],tn.ScopeEndBrace),ta.createProductionWithOptions(eW.variable_identifier,[[B.ID],[eW.macro_call_symbol],[eW.macro_call_function]],tn.VariableIdentifier),ta.createProductionWithOptions(eW.macro_if_statement,[[eW.macro_push_context,eW.statement_list,eW.macro_branch],[eW.macro_push_context,eW.macro_branch]],tn.MacroIfStatement),ta.createProductionWithOptions(eW.macro_branch,[[eW.macro_pop_context],[eW.macro_elif_expression,eW.statement_list,eW.macro_branch],[eW.macro_else_expression,eW.statement_list,eW.macro_pop_context],[eW.macro_elif_expression,eW.macro_branch],[eW.macro_else_expression,eW.macro_pop_context]],tn.MacroBranch)),th=tl.map(function(e){return e[1]}),td=function(e){e.setTranslationRules(th)},tp=function(){function e(){this.globalPrecisions=[],this.globalMacroDeclarations=[],this.directMemberOwnerReferences=[],this.referenceResolutionSnapshots=[]}return e.prototype.getOuterGlobalMacroDeclarations=function(){return this.globalMacroDeclarations.filter(function(e){return z(e.parent,tn.GLShaderProgram)})},e}();function tf(e,t,r){if(t.sourceScope===r.sourceScope)return!1;var n,i,a=null==(n=e.declarations.get(t))?void 0:n.group;if(void 0===a||(null==(i=e.declarations.get(r))?void 0:i.group)!==a)return!1;var o=t.sourceScope<r.sourceScope?t:r;return e.coverage.has(o)&&void 0===e.coverage.get(o)}var t_=function(){function e(e,t,r,n){void 0===n&&(n=void 0!==t),this.branchSemantics=e,this.semanticDiagnostics=t,this.objectPool=r,this.lookupSymbol=new e$("",null),this.arraySymbolScratch=[],this.overloadScratch=[],this.structScratch=[],this.runtimeLookupScratch=[],this.runtimeFallbackScratch=[],this.semanticStack=[],this.acceptRule=void 0,this.symbolTableStack=new ew,this._functionCaptures=[],this._shaderData=new tp,this._translationRules=[],this._sourceScopes=[],this._inheritedDeclarations=[],this.errors=[],this.inMacroDefinition=!1,this._ambiguousReported=new Set,this.diagnosticsEnabled=n,this.symbolTableStack.branchSemantics=e,this.pushScope()}var t=e.prototype;return t.reset=function(e){this._macroDefineList=e,this.semanticStack.length=0,this._shaderData=new tp,this.symbolTableStack.clear(),this.pushScope(),this.errors.length=0,this.inMacroDefinition=!1,this._ambiguousReported.clear(),this._inheritedDeclarations.length=0,this._functionCaptures.length=0,this.runtimeLookupScratch.length=0,this.runtimeFallbackScratch.length=0},t.pushScope=function(){this.symbolTableStack.pushScope(new eF)},t.popScope=function(){return this.symbolTableStack.popScope()},t.setTranslationRules=function(e){this._translationRules=e},t.setSourceScopes=function(e){this._sourceScopes=e},t.assignSourceScope=function(e,t){for(var r=t.start.index,n=this._sourceScopes,i=0,a=n.length-1;i<=a;){var o,s=i+a>>>1,c=n[s];if(r<c.generatedStart)a=s-1;else{if(!(r>=c.generatedEnd))return e.sourceScope=null!=(o=c.sourceScope)?o:0,e;i=s+1}}return e.sourceScope=0,e},t.getTranslationRule=function(e){return this._translationRules[e]},t.beginFunction=function(e){this._functionCaptures.push({header:e,localVariables:[],calledFunctions:[]})},t.endFunction=function(){return this._functionCaptures.pop()},t.recordFunctionVariable=function(e){var t;null==(t=this._functionCaptures[this._functionCaptures.length-1])||t.localVariables.push(e)},t.recordFunctionCall=function(e){var t;null==(t=this._functionCaptures[this._functionCaptures.length-1])||t.calledFunctions.push(e)},t.reportRedefinition=function(e,t,r){var n;this._report(null==(n=this.semanticDiagnostics)?void 0:n.redefinition(e,t.ident,r,t.branchSignature)),this.semanticDiagnostics&&t.sourceScope>0&&1===this.symbolTableStack.stack.length&&!this.inMacroDefinition&&this._isCurrentBranchReachable()&&this._inheritedDeclarations.push({symbol:t,location:e})},t.finalizeInheritance=function(){var e=this._shaderData.declarationOwnership=function(e){var t=new Map,r=new Map,n=new Map;e.forEach(function(e){if(e.astNode){var i,a,o=JSON.stringify([e.type,e.ident]),s=null!=(i=r.get(o))?i:[];s.push(e),r.set(o,s);var c=function(e){if(e.type!==eZ.FN)return JSON.stringify([e.type,e.ident]);if(z(e,e0)){for(var t,r,n=null!=(t=e.astNode.protoType.parameterList)?t:[],i=[],a=j(n);!(r=a()).done;){var o=r.value.typeInfo;if(!o||3e3===o.type)return;if(o.type!==U.VOID||1!==n.length||o.arraySpecifier){var s=o.arraySpecifier,c=null;if(s){if(s.children.some(function(e){return z(e,tn.ArraySpecifier)}))return;if(2===s.children.length)c="unsized";else{if(void 0===s.size)return;c=s.size}}i.push([o.type,c])}}return JSON.stringify([e.type,e.ident,i])}}(e);if(n.set(e,c),void 0!==c){var u=null!=(a=t.get(c))?a:[];u.push(e),t.set(c,u)}}});for(var i,a=new Map,o=new Map,s=new Set,c=0,u=j(t.values());!(i=u()).done;){for(var l,h=i.value,d=!1,p=j(h);!(l=p()).done;)!function(){var e=l.value,t=h.filter(function(t){return t.sourceScope>e.sourceScope});if(t.length){var r=ek(t.map(function(e){return e.branchSignature}),e.branchSignature);o.set(e,r),d||(d=void 0===r)}}();if(d){c++;for(var f,_=j(h);!(f=_()).done;){var v=f.value;if(a.set(v,{id:a.size+1,group:c,sourceScope:v.sourceScope}),!1===o.get(v))for(var m,g=j(h);!(m=g()).done;){var y=m.value;y.sourceScope<=v.sourceScope||!1!==ek([],v.branchSignature.concat(y.branchSignature))||(s.add(v),s.add(y))}}}}for(var S,b=j(r.values());!(S=b()).done;){var x=S.value;if(x.some(function(e){return void 0===n.get(e)}))for(var E,C=j(x);!(E=C()).done;)!function(){var e=E.value,t=x.filter(function(t){return t.sourceScope>e.sourceScope&&t.equal(e)});if(!(!t.length||void 0!==n.get(e)&&t.every(function(e){return n.get(e)}))&&void 0===ek(t.map(function(e){return e.branchSignature}),e.branchSignature)){s.add(e);for(var r,i=j(t);!(r=i()).done;){var a=r.value;s.add(a)}}}()}return{declarations:a,unsupported:Array.from(s),coverage:o}}(this.symbolTableStack.scope);if(this.branchSemantics&&this.semanticDiagnostics){for(var t,r=j(this._inheritedDeclarations);!(t=r()).done;){var n=t.value,i=n.symbol,a=n.location,o=this.symbolTableStack.scope.getInheritedConflict(i,this.branchSemantics,function(t,r){return tf(e,t,r)}),s=this.semanticDiagnostics.redefinition(a,i.ident,o,i.branchSignature);s&&this.errors.push(s)}this._inheritedDeclarations.length=0}},t.reportBranchAvailability=function(e,t,r,n){var i;this._report(null==(i=this.semanticDiagnostics)?void 0:i.branchAvailability(e,t,r,n))},t.reportBranchAmbiguity=function(e,t,r,n,i){var a,o=null==(a=this.semanticDiagnostics)?void 0:a.branchAmbiguity;if(o){var s=r+":"+t;if(!this._ambiguousReported.has(s)){var c=o.call(this.semanticDiagnostics,e,r,n,i);c&&(this._ambiguousReported.add(s),this._report(c))}}},t.reportNonConstArraySize=function(e){var t,r;this._report(null==(r=this.semanticDiagnostics)?void 0:null==(t=r.nonConstArraySize)?void 0:t.call(r,e))},t.reportExpectedSampler=function(e,t,r){var n,i;this._report(null==(i=this.semanticDiagnostics)?void 0:null==(n=i.expectedSampler)?void 0:n.call(i,e,t,r))},t.reportNoMatchingOverload=function(e,t){var r,n;this._report(null==(n=this.semanticDiagnostics)?void 0:null==(r=n.noMatchingOverload)?void 0:r.call(n,e,t))},t.reportUndeclaredStructMember=function(e,t,r){var n,i;this._report(null==(i=this.semanticDiagnostics)?void 0:null==(n=i.undeclaredStructMember)?void 0:n.call(i,e,t,r))},t.canBranchesOverlap=function(e,t){var r,n;return null!=(n=null==(r=this.branchSemantics)?void 0:r.canBranchesOverlap(e,t))?n:"exclusive"!==X(e,t)},t.canDeclarationsCoexist=function(e,t){var r,n;return null==(n=null==(r=this.branchSemantics)?void 0:r.canDeclarationsCoexist(e,t))||n},t.getBranchCoverage=function(e,t){var r,n;return null!=(n=null==(r=this.branchSemantics)?void 0:r.getBranchCoverage(e,t))?n:"covered"},t.isBranchVisibleFrom=function(e,t){var r,n;return null==(n=null==(r=this.branchSemantics)?void 0:r.isBranchVisibleFrom(e,t))||n},t._report=function(e){e&&!this.inMacroDefinition&&this._isCurrentBranchReachable()&&this.errors.push(e)},t._isCurrentBranchReachable=function(){var e,t;return null==(t=null==(e=this.branchSemantics)?void 0:e.isBranchReachable(this.symbolTableStack._currentBranch))||t},er(e,[{key:"shaderData",get:function(){return this._shaderData}},{key:"macroDefineList",get:function(){return this._macroDefineList}},{key:"currentFunctionHeader",get:function(){var e;return null==(e=this._functionCaptures[this._functionCaptures.length-1])?void 0:e.header}}]),e}(),tv=function(){function e(e,t,r,n,i,a,o,s,c){void 0===s&&(s=!1),void 0===c&&(c=void 0!==i),this._source=a,this.semanticErrorsBlockCodegen=s,this.blockingErrors=[],this._traceBackStack=[],this.actionTable=e,this.gotoTable=t,this.grammar=r,this.semanticAnalyzer=new t_(n,i,o,c)}var t=e.prototype;return t.setSource=function(e){var t,r;this._source=e,null==(r=this.semanticAnalyzer.semanticDiagnostics)||null==(t=r.setSource)||t.call(r,e)},t.setSourceScopes=function(e){this.semanticAnalyzer.setSourceScopes(e)},t.parse=function(e,t){this.semanticAnalyzer.reset(t),this.blockingErrors.length=0;var r=this._traceBackStack,n=this.semanticAnalyzer;r.length=0,r.push(0);try{for(var i=e.next();;){var a=i.value,o=this.stateActionTable.get(a.type);if((null==o?void 0:o.action)===ti.Shift){if(r.push(a,o.target),a.type===U.MACRO_DEFINE_PARAMS){n.pushScope();for(var s,c=j(e4.parseMacroParamList(a.lexeme));!(s=c()).done;){var u=s.value;n.symbolTableStack.insert(new e$(u,eZ.VAR))}}n.semanticDiagnostics&&(a.type===U.FOR||a.type===U.WHILE)&&n.pushScope(),i=e.next()}else if((null==o?void 0:o.action)===ti.Accept)return null==n.acceptRule||n.acceptRule.call(n,n),n.finalizeInheritance(),n.semanticStack.pop();else if((null==o?void 0:o.action)===ti.Reduce){for(var l=o.target,h=this.grammar.getProductionByID(l),d=n.getTranslationRule(h.id),p=[],f=h.derivation.length-1;f>=0;f--)if(h.derivation[f]!==B.EPSILON){r.pop();var _=r.pop();if(z(_,Y))p.unshift(_);else{var v=n.semanticStack.pop();p.unshift(v)}}null==d||d.apply(void 0,[].concat([n],p)),n.semanticDiagnostics&&!n.diagnosticsEnabled&&h.goal===eW.iteration_statement&&n.popScope();var m=this.stateGotoTable;r.push(h.goal);var g=m.get(h.goal);r.push(g);continue}else{var y=eh.createGSError("Unexpected token "+a.lexeme,el.CompilationError,this._source,a.location);return this.semanticAnalyzer.errors.push(y),this.blockingErrors.push(y),null}}}catch(e){if(!z(e,eu)||e.name!==el.ScannerError)throw e;return this.semanticAnalyzer.errors.push(e),this.blockingErrors.push(e),null}},e.create=function(t,r,n,i,a,o){void 0===a&&(a=!1),void 0===o&&(o=void 0!==r);var s=this._tables;if(!s){var c=tu.create(eW.gs_shader_program,tl.map(function(e){return e[0]})),u=new tc(c);u.generate(),s=this._tables={actionTable:u.actionTable,gotoTable:u.gotoTable,grammar:c}}var l=new e(s.actionTable,s.gotoTable,s.grammar,t,r,n,i,a,o);return td(l.semanticAnalyzer),l},er(e,[{key:"curState",get:function(){return this._traceBackStack[this._traceBackStack.length-1]}},{key:"stateActionTable",get:function(){return this.actionTable.get(this.curState)}},{key:"stateGotoTable",get:function(){return this.gotoTable.get(this.curState)}},{key:"errors",get:function(){return this.semanticAnalyzer.errors}}]),e}(),tm=new WeakMap,tg="shaders://root/",ty=/^[A-Za-z][A-Za-z\d+.-]*:/,tS=function(){function e(){this._states=Object.create(null),this._versions=Object.create(null),this._frames=[],this._expressionContext={resolveIdentifier:function(){return{}},isDefined:function(){}},this.reachable=!0}var t=e.prototype;return t.processDirective=function(e,t){switch(e){case"if":var r=this.reachable?this._evaluate(t):{value:void 0};return{keep:this._openConditional(r),arm:this._arm(r.value,[],r),error:r.error,errorStart:r.errorStart,errorEnd:r.errorEnd};case"ifdef":var n=this._definedCondition(t,!0);return{keep:this._openConditional(n),arm:this._arm(n.value,[],n),error:n.error};case"ifndef":var i=this._definedCondition(t,!1);return{keep:this._openConditional(i),arm:this._arm(i.value,[],i),error:i.error};case"elif":return this._advanceConditional(t);case"else":return this._advanceElse();case"endif":return{keep:this._closeConditional()};case"define":var a=this.reachable;return a&&this._define(t),{keep:a};case"undef":var o=this.reachable;return o&&this._undef(t),{keep:o};default:return{keep:this.reachable}}},t.captureSnapshot=function(){return{states:e._cloneStates(this._states),versions:Object.assign(Object.create(null),this._versions)}},t.createCachedState=function(e){for(var t,r=new Set([].concat(Object.keys(e.states),Object.keys(this._states))),n=[],i=j(r);!(t=i()).done;){var a,o,s=t.value;(null!=(a=e.versions[s])?a:0)!==(null!=(o=this._versions[s])?o:0)&&n.push(s)}return{snapshot:this.captureSnapshot(),mutatedNames:n}},t.applyCachedState=function(t){for(var r,n=j(t.mutatedNames);!(r=n()).done;)for(var i,a=r.value,o=j(this._frames);!(i=o()).done;)i.value.mutatedNames.add(a);this._states=e._cloneStates(t.snapshot.states),this._versions=Object.assign(Object.create(null),t.snapshot.versions),this._versionKey=void 0},t.cacheKey=function(){for(var e=Object.keys(this._states).sort(),t="",r=0,n=e.length;r<n;r++){var i,a=e[r],o=this._states[a],s=void 0===o.defined?"?":o.defined?"1":"0",c=o.replacementKey;t+=a.length+":"+a+s+(o.functionParams?"f":"v")+(null!=(i=null==c?void 0:c.length)?i:"?")+":"+(null!=c?c:"")}return t+"\0"+this._macroVersionKey()},t._openConditional=function(t){var r=this.reachable,n=e._cloneStates(this._states),i=e._cloneStates(n);return r&&void 0===t.value&&(this._applyAssumption(this._states,t.trueAssumption),this._applyAssumption(i,t.falseAssumption)),this._frames.push({parentReachable:r,remainderReachable:r&&!0!==t.value,remainderValue:void 0===t.value?void 0:!t.value,remainderConditions:this._appendCondition([],t,!0),hasElse:!1,entryState:n,remainderState:i,armStates:[],mutatedNames:new Set}),this.reachable=r&&!1!==t.value,r},t._advanceConditional=function(t){var r=this._frames[this._frames.length-1];if(!r)return{keep:this.reachable};if(this._finishCurrentArm(r),this._states=e._cloneStates(r.remainderState),r.hasElse)return this.reachable=!1,{keep:r.parentReachable};if(!r.remainderReachable)return this.reachable=!1,{keep:!1};var n=this._evaluate(t),i=e._and(r.remainderValue,n.value),a=this._arm(i,r.remainderConditions,n);return r.remainderConditions=this._appendCondition(r.remainderConditions,n,!0),r.remainderValue=e._and(r.remainderValue,void 0===n.value?void 0:!n.value),r.remainderState=e._cloneStates(this._states),void 0===n.value&&(this._applyAssumption(this._states,n.trueAssumption),this._applyAssumption(r.remainderState,n.falseAssumption)),this.reachable=!1!==n.value,!0===n.value&&(r.remainderReachable=!1),{keep:!0,arm:a,error:n.error,errorStart:n.errorStart,errorEnd:n.errorEnd}},t._advanceElse=function(){var t=this._frames[this._frames.length-1];if(!t)return{keep:this.reachable};this._finishCurrentArm(t),this._states=e._cloneStates(t.remainderState);var r=!t.hasElse&&t.remainderReachable,n=!t.hasElse&&t.remainderValue;return this.reachable=r,t.remainderReachable=!1,t.remainderValue=!1,t.hasElse=!0,{keep:r,arm:{value:n,predicates:t.remainderConditions}}},t._closeConditional=function(){var t=this._frames.pop();return t?(this._finishCurrentArm(t),!t.hasElse&&t.remainderReachable&&t.armStates.push(e._cloneStates(t.remainderState)),this._states=this._mergeStates(t),this.reachable=t.parentReachable,t.parentReachable):this.reachable},t._finishCurrentArm=function(t){this.reachable&&t.armStates.push(e._cloneStates(this._states))},t._mergeStates=function(t){for(var r,n,i=this,a=e._cloneStates(t.entryState),o=j(t.mutatedNames);!(n=o()).done;)r=this,function(){var o,s=n.value,c=t.armStates.map(function(e){return i._stateFrom(e,s)}),u=null!=(o=c[0])?o:r._stateFrom(t.entryState,s);if(c.every(function(t){return e._sameState(u,t)}))return a[s]=u;var l=!!c.every(function(e){return!0===e.defined})||!c.every(function(e){return!1===e.defined})&&void 0;a[s]={defined:l}}();return a},t._define=function(e){var t=/^[ \t]*([A-Za-z_]\w*)([\s\S]*)$/.exec(e);if(t){var r=t[1],n=t[2];this._markMutation(r);var i=n.trim();if("("===n[0]){var a=n.indexOf(")");if(a<0){this._states[r]={defined:!0,replacementKey:i};return}var o=n.slice(1,a).split(",").map(function(e){return e.trim()}).filter(Boolean);this._states[r]={defined:!0,replacementKey:i,functionParams:o,functionBody:n.slice(a+1).trim()};return}this._states[r]={defined:!0,replacementKey:i}}},t._undef=function(e){var t,r=null==(t=/^[ \t]*([A-Za-z_]\w*)/.exec(e))?void 0:t[1];r&&(this._markMutation(r),this._states[r]={defined:!1})},t._markMutation=function(e){var t;this._versions[e]=(null!=(t=this._versions[e])?t:0)+1,this._versionKey=void 0;for(var r=0,n=this._frames.length;r<n;r++)this._frames[r].mutatedNames.add(e)},t._evaluate=function(t){var r,n,a,s=this,c=t.trim(),u=S(c),l=b(c,function(e){return s._state(e).defined}),h=(r=function(e){return!1===s._state(e).defined?{body:"0"}:s._macro(e)},"string"==typeof(n=function e(t,r,n,a,s,c){for(var u=t.slice(),l=[],h=0;h<u.length;){var d=u[h];if(a&&"defined"===d.text){l.push(d);for(var p,f,_,v=(null==(_=u[++h])?void 0:_.text)==="("?3:1,m=0;m<v&&h<u.length;m++)l.push(u[h++]);continue}var g="identifier"!==d.kind||(null==(p=d.disabledMacros)?void 0:p.has(d.text))?void 0:r(d.text),y=h+1;if(null==g?void 0:g.parameters)for(;(null==(A=u[y])?void 0:A.kind)==="trivia";)y++;if(!g||g.parameters&&(null==(f=u[y])?void 0:f.text)!=="("){l.push(d),h++;continue}var S=Math.max(s,null!=(T=d.expansionDepth)?T:0)+1;if(S>256)return"Preprocessor macro expansion exceeds 256 nested replacements.";var b=h,x=[],E=new Set(d.disabledMacros);if(g.parameters){var C=function(e,t){for(var r=[[]],n=1,a=t+1;a<e.length;a++){var s=e[a];if("("===s.text)n++,r[r.length-1].push(s);else if(")"===s.text){if(0==--n){for(var c,u=o(r);!(c=u()).done;)(function(e){for(var t=0,r=[!1,!0];t<r.length;t++)for(var n=r[t];e.length;){var a=n?e.length-1:0,o=e[a];if("trivia"!==o.kind)break;var s=o.text.replace(n?/[ \t\v\f]+$/:/^[ \t\v\f]+/,"");if(s===o.text)break;if(s){e[a]=i({},o,{text:s});break}n?e.pop():e.shift()}})(c.value);return{arguments:r,end:a}}r[r.length-1].push(s)}else","===s.text&&1===n?r.push([]):r[r.length-1].push(s)}}(u,y);if(!C||(x=C.arguments,0===g.parameters.length&&1===x.length&&x[0].every(function(e){return"trivia"===e.kind})&&(x=[]),x.length!==g.parameters.length)){l.push(d),h++;continue}for(var A,T,O,I=u[b=C.end].disabledMacros,R=o(E);!(O=R()).done;){var M=O.value;(null==I?void 0:I.has(M))||E.delete(M)}}E.add(d.text);for(var P,D=[],L=new Map,N=o(n(g.body).slice(0,-1));!(P=N()).done;){var k=P.value,V="identifier"===k.kind&&null!=(U=null==(B=g.parameters)?void 0:B.indexOf(k.text))?U:-1,F=[k];if(V>=0){var w=L.get(V);if(!w){var G=e(x[V],r,n,a,S,c);if("string"==typeof G)return G;L.set(V,w=G)}F=w}for(var B,U,z,W=o(F);!(z=W()).done;){var j=function(){var e,t,r=z.value;if(--c.remaining<0)return{v:"Preprocessor macro expansion exceeds 65536 replacement tokens."};if("identifier"!==r.kind&&")"!==r.text)return D.push(r),"continue";var n=E;(null==(e=r.disabledMacros)?void 0:e.size)&&(n=new Set(E),r.disabledMacros.forEach(function(e){return n.add(e)})),D.push(i({},r,{disabledMacros:n,expansionDepth:Math.max(S,null!=(t=r.expansionDepth)?t:0)}))}();if("object"==(j&&"undefined"!=typeof Symbol&&j.constructor===Symbol?"symbol":typeof j))return j.v}}u.splice.apply(u,[].concat([h,b-h+1],D))}return l}(O(l).slice(0,-1),r,O,!0,0,{remaining:65536}))?{expression:"",error:n}:{expression:n.map(function(e){return e.text}).join(" ")});if(h.error)return{value:void 0,error:h.error,errorStart:0,errorEnd:c.length};var d=b(h.expression,function(e){return s._state(e).defined}),p=S(d);if("error"in p)return"error"in u&&u.error.certain?{value:void 0,error:u.error.message,errorStart:u.error.start,errorEnd:u.error.end}:{value:void 0,error:p.error.certain||!p.hasExpandableIdentifier?d===l?p.error.message:"Invalid preprocessor expression after expanding source macros: "+p.error.message:void 0,errorStart:0,errorEnd:c.length};var f=p.hasExpandableIdentifier?{value:void 0,error:void 0}:"number"==typeof(a=R(p.condition,this._expressionContext))?{value:a}:"string"==typeof a?{error:a}:{},_=void 0===f.value||ev(p.condition)?f.value:void 0,v=e._conditionAssumptions(p.condition);return{value:void 0===_?void 0:0!==_,condition:void 0!==_?void 0:p.hasExpandableIdentifier?{kind:"opaque",identity:JSON.stringify([d,this._macroVersionKey()])}:eL(p.condition,this._versions),error:f.error,errorStart:f.error?0:void 0,errorEnd:f.error?c.length:void 0,trueAssumption:null==v?void 0:v.trueAssumption,falseAssumption:null==v?void 0:v.falseAssumption}},t._definedCondition=function(e,t){var r,n=null==(r=/^[ \t]*([A-Za-z_]\w*)/.exec(e))?void 0:r[1];if(!n||!this.reachable)return{value:void 0};var i=this._state(n).defined;return{value:void 0===i?void 0:i===t,condition:eL({t:t?"def":"ndef",m:n},this._versions),trueAssumption:{name:n,defined:t},falseAssumption:{name:n,defined:!t}}},t._arm=function(e,t,r){return{value:e,predicates:!0===e?[]:this._appendCondition(t,r)}},t._appendCondition=function(e,t,r){return(void 0===r&&(r=!1),e)?void 0!==t.value?t.value!==r?e:void 0:t.condition?[].concat(e,[{condition:t.condition,negated:r}]):void 0:void 0},t._macroVersionKey=function(){var e,t=this;return null!=(e=this._versionKey)?e:this._versionKey=JSON.stringify(Object.keys(this._versions).sort().map(function(e){return[e,t._versions[e]]}))},t._applyAssumption=function(e,t){if(t){var r=this._stateFrom(e,t.name);e[t.name]=t.defined?ep({},r,{defined:!0}):{defined:!1}}},t._macro=function(e){var t,r=this._state(e);if(!0===r.defined&&void 0!==r.replacementKey)return r.functionParams?{body:null!=(t=r.functionBody)?t:"",parameters:r.functionParams}:{body:r.replacementKey}},t._state=function(e){return this._stateFrom(this._states,e)},t._stateFrom=function(e,t){var r;return null!=(r=e[t])?r:{defined:void 0}},e._cloneStates=function(e){var t=Object.create(null);for(var r in e)t[r]=e[r];return t},e._sameState=function(e,t){return e.defined===t.defined&&e.replacementKey===t.replacementKey&&!!e.functionParams==!!t.functionParams},e._and=function(e,t){return!1!==e&&!1!==t&&(!0===e&&!0===t||void 0)},e._conditionAssumptions=function(e){if("def"===e.t)return{trueAssumption:{name:e.m,defined:!0},falseAssumption:{name:e.m,defined:!1}};if("ndef"===e.t)return{trueAssumption:{name:e.m,defined:!1},falseAssumption:{name:e.m,defined:!0}};if("not"===e.t){var t=this._conditionAssumptions(e.c);return t?{trueAssumption:t.falseAssumption,falseAssumption:t.trueAssumption}:void 0}},e}(),tb="shaders://root/",tx=/^[A-Za-z][A-Za-z\d+.-]*:/,tE=new WeakMap,tC=new WeakMap,tA=function(){function e(){}return e.parse=function(e,r,n,i,a,o){for(var s,c=this.parseWithErrors(e,r,n,i,a,!0,o),u=j(c.errors);!(s=u()).done;){var l=s.value;t.Logger.error(l.toString())}return c.content},e.parseWithErrors=function(e,t,r,n,i,a,o){void 0===a&&(a=!0);try{return this._expand(e,t,r,n,new Set,i,a,new tS,o,0)}catch(e){if(!z(e,eu)||e.name!==el.PreprocessorError)throw e;return{content:"",errors:[e],sourceMap:[],sourceScopes:[],conditionalArms:new Map}}},e._expand=function(e,t,r,n,i,a,o,s,c,u){var l=this,h=[],d=0,p=e.replace(/\\(?:\r\n|\n|\r)/g,function(e,t){return h.push({offset:t-d,length:e.length,removed:d+e.length}),d+=e.length,""});h.length&&(c=null==c?void 0:c.map(function(e){for(var t,r=0,n=j(h);!(t=n()).done;){var i=t.value;r+=Math.min(i.length,Math.max(0,e-i.offset-r))}return e-r}));var f=e;e=p;var _=[],v=[],m=[],g=new Map,y=[],S=0,b=0,x=0,E=this._maskDirectiveTrivia(e),C=new RegExp(this._directiveReg.source,this._directiveReg.flags),A=function(e,t){throw l._createPreprocessorError(f,l._physicalOffset(e,h),t,a)},T=function(e,t,r){b+e>8388608&&A(r,"Expanded shader source exceeds 8388608 characters."),x+t>65536&&A(r,"Shader include expansion exceeds 65536 source segments."),x+=t};T(0,h.length,0);for(var O=function(e,t){(null==c?void 0:c.length)&&e&&((null==N?void 0:N.sourceScope)===t?N.generatedEnd=b+e:(N={generatedStart:b,generatedEnd:b+e,sourceScope:t},m.push(N)))},I=function(t,r,n){for(;t<r;){var i=l._nextSourceScopeStart(t,r,c),s=null!=i?i:r,h=e.slice(t,s),d=n?h:l._maskText(h),p=l._sourceScopeAt(t,c,u);T(d.length,1,t),y.push(d),O(d.length,p),o&&v.push({generatedStart:b,generatedEnd:b+d.length,sourceStart:t,source:e,sourceFile:a,sourceScope:p}),b+=d.length,t=s}};L=C.exec(E);){I(S,L.index,s.reachable);var R=L[1],M=null!=(V=L[2])?V:"";if("include"!==R){var P=s.processDirective(R,this._stripLineComment(M));if(P.keep&&P.arm){var D=E.indexOf("#",L.index)-L.index;g.set(b+D,P.arm)}if(P.error){var L,N,k,V,F,w,G=M.length-M.trimStart().length,B=M.trim().length,U=C.lastIndex-M.length+G,z=U+Math.min(null!=(F=P.errorStart)?F:0,B),W=U+Math.min(null!=(w=P.errorEnd)?w:B,B);_.push(this._createPreprocessorError(e,z,P.error,a,W))}I(L.index,C.lastIndex,P.keep),S=C.lastIndex;continue}if(!s.reachable){I(L.index,C.lastIndex,!1),S=C.lastIndex;continue}var q=null==(k=this._includePathReg.exec(M))?void 0:k[1];if(!q){_.push(this._createPreprocessorError(e,L.index,"Invalid shader include directive.",a)),S=C.lastIndex;continue}var H=this._resolveIncludePath(q,t);if(!H){_.push(this._createPreprocessorError(e,L.index,'Invalid shader include path "'+q+'".',a)),S=C.lastIndex;continue}var X=r[H];if(void 0===X){_.push(this._createPreprocessorError(e,L.index,'Shader include "'+H+'" was not found.',a)),S=C.lastIndex;continue}if(i.has(H)){_.push(this._createPreprocessorError(e,L.index,'Shader include cycle detected at "'+H+'".',a)),S=C.lastIndex;continue}i.size>=128&&A(L.index,"Shader include nesting exceeds 128 levels.");var Q=s.captureSnapshot(),K=this._sourceScopeAt(L.index,c,u),Y=(o?1:0)+"\0"+H+"\0"+s.cacheKey(),J=n.get(Y),Z=J&&tE.get(J);J&&Z?s.applyCachedState(Z):(i.add(H),J=this._expand(X,this._canonicalIncludeURL(H),r,n,i,H,o,s,void 0,K),i.delete(H),tE.set(J,s.createCachedState(Q)),n.set(Y,J)),T(J.content.length,null!=($=tC.get(J))?$:1,L.index);for(var $,ee,et=j(J.conditionalArms);!(ee=et()).done;){var er=ee.value,en=er[0],ei=er[1];g.set(b+en,ei)}if(y.push(J.content),O(J.content.length,K),o)for(var ea,eo=j(J.sourceMap);!(ea=eo()).done;){var es=ea.value;v.push({generatedStart:b+es.generatedStart,generatedEnd:b+es.generatedEnd,sourceStart:es.sourceStart,source:es.source,sourceFile:es.sourceFile,sourceScope:K})}b+=J.content.length,_.push.apply(_,[].concat(J.errors)),S=C.lastIndex}I(S,e.length,s.reachable);var ec={content:y.join(""),errors:_,sourceMap:v,sourceScopes:m,conditionalArms:g};return h.length&&this._restoreSplicedSource(ec,e,f,a,h),tC.set(ec,x),ec},e._restoreSplicedSource=function(e,t,r,n,i){for(var a,o=this,s=[],c=0,u=j(e.sourceMap);!(a=u()).done;)!function(){var e=a.value;if(e.source!==t||e.sourceFile!==n)return s.push(e);for(var u=e.sourceStart,l=u+e.generatedEnd-e.generatedStart,h=function(t){t<=u||(s.push(ep({},e,{generatedStart:e.generatedStart+u-e.sourceStart,generatedEnd:e.generatedStart+t-e.sourceStart,sourceStart:o._physicalOffset(u,i),source:r})),u=t)};c<i.length&&i[c].offset<=u;)c++;for(;c<i.length&&i[c].offset<l;)h(i[c++].offset);h(l)}();return e.sourceMap=s,e.errors=e.errors.map(function(e){if(e.source!==t||e.file!==n)return e;var a=e.location,s="start"in a?a.start.index:a.index,c="end"in a?a.end.index:s;return o._createPreprocessorError(r,o._physicalOffset(s,i),e.message,n,o._physicalOffset(c,i,c>s))}),e},e._physicalOffset=function(e,t,r){void 0===r&&(r=!1);for(var n=0,i=t.length;n<i;){var a=n+i>>>1,o=t[a].offset;o<e||!r&&o===e?n=a+1:i=a}return e+(n?t[n-1].removed:0)},e._sourceScopeAt=function(e,t,r){if(!(null==t?void 0:t.length))return r;for(var n=0,i=1;i<t.length&&t[i]<=e;i++)n=i;return n},e._nextSourceScopeStart=function(e,t,r){if(r)for(var n,i=j(r);!(n=i()).done;){var a=n.value;if(a>e&&a<t)return a}},e._maskDirectiveTrivia=function(e){return e.replace(/\/\/[^\r\n]*|"[^"\r\n]*"|\/\*[\s\S]*?\*\//g,function(e){return e.startsWith("/*")?e.replace(/[^\r\n]/g," "):e})},e._stripLineComment=function(e){return e.replace(/\/\/.*$/,"")},e._maskText=function(e){return e.replace(/[^\r\n]/g," ")},e._resolveIncludePath=function(e,t){var r="."===e[0]&&t||tb;if(!tx.test(e)&&r.startsWith(tb))return F(new URL(e,r).href);try{var n=new URL(e,r);return F(n.href)}catch(e){return}},e._canonicalIncludeURL=function(e){return tx.test(e)?new URL(e).href:new URL(e,tb).href},e._createPreprocessorError=function(e,t,r,n,i){void 0===i&&(i=t);var a=this._positionAt(e,t);if(i<=t)return new eu(el.PreprocessorError,r,a,e,n);var o=new w;return o.set(a,this._positionAt(e,i)),new eu(el.PreprocessorError,r,o,e,n)},e._positionAt=function(e,t){for(var r=0,n=-1,i=0;i<t;i++){var a=e.charCodeAt(i);10===a?(r++,n=i):13===a&&(n=i)}var o=new G;return o.set(t,r,t-n-1),o},e}();tA._includePathReg=/^[ \t]*"([^"\r\n]+)"[ \t]*(?:(?:\/\/.*)|(?:\/\*.*\*\/[ \t]*))?$/,tA._directiveReg=/^[ \t]*#[ \t]*(include|define|undef|if|ifdef|ifndef|elif|else|endif)\b([^\r\n]*)/gm;var tT=function(e,t,r){void 0===r&&(r=[]),this.program=e,this.source=t,this.sourceMap=r,this.shaderData=e.shaderData},tO=((v={}).Varying="varying",v.Attribute="attribute",v.Mrt="mrt",v),tI=function(){function e(e,t,r,n,i){this.getDeclarationCoexistence=n,this.getBranchCoverage=i;var a,o=e.shaderData.symbolTable,s=e.shaderData.declarationOwnership;this.deferredDeclarationOwnership=s.declarations;var c=tR(o,t),u=tR(o,r);this.vertexEntry=tM(eG.VERTEX,t,c,n,s),this.fragmentEntry=tM(eG.FRAGMENT,r,u,n,s);var l={attributeStructs:[],attributeList:[],varyingStructs:[],varyingList:[],mrtStructs:[],mrtList:[],structVariableRoles:new Map,vertexStructVariableRoles:new Map,fragmentStructVariableRoles:new Map};(function(e,t,r){for(var n,i=new Set,a=new Set,o=new Set,s=j(e);!(n=s()).done;){var c,u,l=n.value.astNode.protoType;"string"==typeof l.returnType.type&&tP(l.returnType.typeSpecifier.structDeclarations,r.varyingStructs,r.varyingList,a),"string"==typeof(null==(u=l.parameterList)?void 0:null==(c=u[0])?void 0:c.typeInfo.type)&&tP(l.parameterList[0].typeInfo.structDeclarations,r.attributeStructs,r.attributeList,i)}for(var h,d=j(t);!(h=d()).done;){var p=h.value;"string"==typeof p.astNode.protoType.returnType.type&&tP(p.astNode.protoType.returnType.typeSpecifier.structDeclarations,r.mrtStructs,r.mrtList,o)}})(c,u,l),this.roleConflicts=function(e){var t=new Map,r=function(e,r){for(var n,i=j(e);!(n=i()).done;){var a,o=n.value,s=null!=(a=t.get(o))?a:[];-1===s.indexOf(r)&&s.push(r),t.set(o,s)}};r(e.attributeStructs,"attribute"),r(e.varyingStructs,"varying"),r(e.mrtStructs,"mrt");var n=[],i=new Set;if(t.forEach(function(e,t){e.length>1&&(n.push({struct:t,roles:e}),i.add(t))}),!i.size)return n;var a=new Set,o=function(e){for(var t=e.length-1;t>=0;t--)if(i.has(e[t])){for(var r,n=j(e[t].propList);!(r=n()).done;){var o=r.value;a.add(o)}e.splice(t,1)}};o(e.attributeStructs),o(e.varyingStructs),o(e.mrtStructs);var s=function(e){for(var t=e.length-1;t>=0;t--)a.has(e[t])&&e.splice(t,1)};return s(e.attributeList),s(e.varyingList),s(e.mrtList),n}(l);var h=new Map;tL(h,l.attributeStructs,"attribute"),tL(h,l.varyingStructs,"varying"),tL(h,l.mrtStructs,"mrt"),this.unsupportedDeferredDeclarations=s.unsupported.concat(function(e,t,r,n){var i=new Map,a=!1;if(e.declarations.forEach(function(e,t){z(t,e1)&&(a=!0);var r,n=null!=(r=i.get(e.group))?r:[];n.push(t),i.set(e.group,n)}),!a)return[];for(var o,s=new Map,c=j(n);!(o=c()).done;){var u,l=o.value,h=l.replacementMemberOwner;if(h){for(;h&&!(z(h,tn.PostfixExpression)&&3===h.children.length);)h=h.parent;var d=null==h?void 0:h.children[2];if(z(d,Y)){for(var p,f,_,v=[],m=j(l.symbols);!(_=m()).done;){var g=_.value;v.push.apply(v,[].concat(null!=(f=null==(p=g.dataType)?void 0:p.structDeclarations)?f:[]))}var y=null!=(u=s.get(l.reference))?u:[];y.push({declarations:v,field:d,branch:l.callSiteBranch}),s.set(l.reference,y)}}}for(var S,b=new Set,x=new Map,E=function(e){var t=x.get(e);return t||(t=function(e,t){for(var r=new Set(z(e,e0)?e.calledFunctions:[]),n=new Set,i=[],a=[e.astNode],o=new Set;a.length;){var s=a.pop();if(!o.has(s)){if(o.add(s),z(s,tn.TypeSpecifier))for(var c,u=j(s.structDeclarations);!(c=u()).done;){var l=c.value;n.add(l),a.push(l)}else if(z(s,tn.VariableIdentifier)){i.push.apply(i,[].concat(null!=(h=t.get(s))?h:[]));for(var h,d,p=j(s.resolvedSymbols());!(d=p()).done;){var f=d.value;(z(f,e0)||f.isGlobalVariable)&&r.add(f)}}else if(z(s,tn.PostfixExpression)&&3===s.children.length&&z(s.children[2],Y)){var _=function e(t){if(z(t,tn.VariableIdentifier)){for(var r,n,i,a=[],o=j(t.resolvedValueSymbols());!(i=o()).done;){var s=i.value;a.push.apply(a,[].concat(null!=(n=null==(r=s.dataType)?void 0:r.structDeclarations)?n:[]))}return a}if(z(t,tn.FunctionCallGeneric)){for(var c,u,l=[],h=j(null!=(c=t.fnSymbols)?c:t.fnSymbol?[t.fnSymbol]:[]);!(u=h()).done;){var d,p,f=u.value;l.push.apply(l,[].concat(null!=(p=null==(d=f.dataType)?void 0:d.structDeclarations)?p:[]))}return l}if(z(t,tn.PostfixExpression)&&3===t.children.length&&z(t.children[2],Y)){for(var _,v=[],m=j(e(t.children[0]));!(_=m()).done;)for(var g,y=_.value,S=j(y.propList);!(g=S()).done;){var b=g.value;b.ident.lexeme===t.children[2].lexeme&&v.push.apply(v,[].concat(b.typeInfo.structDeclarations))}return v}var x=t.children[z(t.children[0],Y)?1:0];return z(x,tr)?e(x):[]}(s.children[0]);_.length&&i.push({declarations:_,field:s.children[2],branch:s._branch})}for(var v,m=j(s.children);!(v=m()).done;){var g=v.value;z(g,tr)&&a.push(g)}}}return{symbols:Array.from(r),types:Array.from(n),members:i}}(e,s),x.set(e,t)),t},C=j(i.values());!(S=C()).done;)!function(){var n=S.value;if(z(n[0],e1))for(var a,o=new Set(n.map(function(e){return e.astNode})),s=j(n);!(a=s()).done;)!function(){for(var n=a.value,s=n.astNode,c=r.get(s),u=new Set,l=t.slice(),h=[],d=!1;l.length;)!function(){var t=l.pop();if(!u.has(t)&&t.astNode){u.add(t);var a=n.branchSignature.concat(t.branchSignature);if(!0!==ek([],a)){var p=e.declarations.get(t),f=(p?i.get(p.group):[t]).filter(function(e){return e.sourceScope>t.sourceScope});if(!f.length||!0!==ek(f.map(function(e){return e.branchSignature}),a)){for(var _,v=E(t),m=j(v.symbols);!(_=m()).done;){var g=_.value,y=e.declarations.get(g);l.push.apply(l,[].concat(y?i.get(y.group):[g]))}v.types.some(function(e){return o.has(e)&&!r.has(e)})&&(d=!0);for(var S,b=j(v.members);!(S=b()).done;)!function(){var e=S.value;if(!0!==ek([],n.branchSignature.concat(e.branch))){var t=e.declarations.filter(function(e){return o.has(e)});t.length&&(h.push({declarations:t,field:e.field,branch:e.branch}),c&&t.some(function(e){return r.get(e)===c})&&s.propList.some(function(t){return t.ident.lexeme===e.field.lexeme})&&(d=!0))}}()}}}}();if(d)for(var p,f=j(h);!(p=f()).done;)!function(){for(var e,t=p.value,i=t.declarations,a=t.field,o=t.branch,u=j(i);!(e=u()).done;){var l=e.value;if(l!==s)for(var h,d=l.propList.filter(function(e){return e.ident.lexeme===a.lexeme}),f=j(d);!(h=f()).done;)!function(){var e=h.value,t=s.propList.filter(function(t){return function(e,t){if(e.ident.lexeme!==t.ident.lexeme||e.typeInfo.type!==t.typeInfo.type||e.isFlat!==t.isFlat||e.mrtIndex!==t.mrtIndex)return!1;var r=e.typeInfo.arraySpecifier,n=t.typeInfo.arraySpecifier;return r&&n?r===n||void 0!==r.size&&r.size===n.size:r===n}(e,t)});(r.get(l)!==c||!0!==ek(t.map(function(e){return e.ident.branch}),n.branchSignature.concat(o,e.ident.branch)))&&b.add(n)}()}}()}()}();return Array.from(b)}(s,c.concat(u),h,e.shaderData.referenceResolutionSnapshots)),a=new Map,o.forEach(function(e){z(e,e0)?a.set(e,function(e,t,r){var n=[],i=[],a=function(e){var i=tk(e,t);i&&(n.push({variable:e,role:i}),r.set(e,i))},o=e.astNode.protoType.parameterList;if(o)for(var s,c=j(o);!(s=c()).done;){var u=s.value.astNode;z(u,tn.ParameterDeclaration)&&u.symbol&&a(u.symbol)}for(var l,h=j(e.localVariables);!(l=h()).done;)a(l.value);return i.push.apply(i,[].concat(e.calledFunctions)),{variables:n,callees:i}}(e,h,l.structVariableRoles)):z(e,e2)&&e.isGlobalVariable&&(tN(l.structVariableRoles,e,h),tN(l.vertexStructVariableRoles,e,h),tN(l.fragmentStructVariableRoles,e,h))}),tD(l.vertexStructVariableRoles,c,a),tD(l.fragmentStructVariableRoles,u,a),this.io=l,this.outerGlobalMacroDeclarations=e.shaderData.getOuterGlobalMacroDeclarations()}return e.create=function(t,r,n,i,a){return void 0===i&&(i=X),void 0===a&&(a=H),new e(t,r,n,i,a)},e}();function tR(e,t){var r=new e$("",null);r.set(t,eZ.FN);var n=e.getSymbols(r,!0,[]);return n.sort(function(e,t){return e.astNode.location.start.index-t.astNode.location.start.index}),n}function tM(e,t,r,n,i){for(var a=!1,o=0,s=r.length;o<s&&!a;o++)for(var c=o+1;c<s;c++)if(!tf(i,r[o],r[c])&&"coexist"===n(r[o].branchSignature,r[c].branchSignature)){a=!0;break}return{stage:e,name:t,functions:r,hasDefiniteAmbiguity:a}}function tP(e,t,r,n){for(var i,a=j(e);!(i=a()).done;){var o=i.value;n.has(o)||(n.add(o),t.push(o),r.push.apply(r,[].concat(o.propList)))}}function tD(e,t,r){for(var n=new Set,i=t.slice();i.length;){var a=i.pop();if(!n.has(a)){n.add(a);var o=r.get(a);if(o){for(var s,c=j(o.variables);!(s=c()).done;){var u=s.value,l=u.variable,h=u.role;e.set(l,h)}i.push.apply(i,[].concat(o.callees))}}}}function tL(e,t,r){for(var n,i=j(t);!(n=i()).done;){var a=n.value;e.set(a,r)}}function tN(e,t,r){var n=tk(t,r);n&&e.set(t,n)}function tk(e,t){for(var r,n,i,a,o=j(null!=(i=null==(r=e.dataType)?void 0:r.structDeclarations)?i:[]);!(a=o()).done;){var s=a.value,c=t.get(s);if(!c||n&&n!==c)return;n=c}return n}function tV(e,t,r){if(!z(e,eu)||e.source!==t)return e;var n,i=e.location,a="start"in i?i:{start:i,end:i},o=function(e,t,r){var n=tF(e,r,!1);if(n){var i=tF(t,r,!0),a=n.sourceStart+e-n.generatedStart,o=(null==i?void 0:i.source)===n.source&&i.sourceFile===n.sourceFile?i.sourceStart+t-i.generatedStart:a;return{source:n.source,sourceFile:n.sourceFile,start:tw(n.source,a),end:tw(n.source,o)}}}(a.start.index,a.end.index,r);if(!o)return e;var s=new w;return s.set(o.start,o.end),new eu(e.name,e.message,s,o.source,null!=(n=o.sourceFile)?n:e.file,e.code)}function tF(e,t,r){for(var n,i=j(t);!(n=i()).done;){var a=n.value;if(e>=a.generatedStart&&(r?e<=a.generatedEnd&&e>a.generatedStart:e<a.generatedEnd))return a}var o=t[t.length-1];return o&&e===o.generatedEnd?o:void 0}function tw(e,t){for(var r=0,n=0,i=0;i<t;i++)10===e.charCodeAt(i)?(r++,n=0):n++;var a=new G;return a.set(t,r,n),a}Object.freeze([]);var tG=Object.freeze([]),tB=Object.freeze([]),tU=new Map;function tz(e){return tv.create(void 0,void 0,void 0,e)}function tW(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];for(var n,i=0,a=j(t);!(n=a()).done;)i+=n.value.length;if(0===i)return tG;for(var o,s=[],c=j(t);!(o=c()).done;){var u=o.value;s.push.apply(s,[].concat(u))}return Object.freeze(s)}var tj=function(){function e(){}return e.createRenderStates=function(){return{constantMap:{},variableMap:{}}},e.createShaderSource=function(e){return{name:e,subShaders:[],pendingContents:[],renderStates:this.createRenderStates()}},e.createSubShaderSource=function(e){return{name:e,passes:[],pendingContents:[],tags:{},renderStates:this.createRenderStates()}},e.createShaderPassSource=function(e){return{name:e,pendingContents:[],contentScopeStarts:[],isUsePass:!1,tags:{},renderStates:this.createRenderStates(),contents:"",vertexEntry:"",fragmentEntry:""}},e.createUsePass=function(e){return{name:e,pendingContents:[],contentScopeStarts:[],isUsePass:!0,tags:{},renderStates:this.createRenderStates(),contents:"",vertexEntry:"",fragmentEntry:""}},e}(),tq=function(){function e(e,t,r){this.ident=e,this.type=t,this.value=r,this.isInMacroBranch=!1,this.branchSignature=K}var t=e.prototype;return t.set=function(e,t,r){this.ident=e,this.type=t,this.value=r},t.equal=function(e){return this.type===e.type},e}(),tH=function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.hasPendingContent=!1,t}ei(t,e);var n=t.prototype;return n.setSource=function(t){e.prototype.setSource.call(this,t),this.hasPendingContent=!1},n.scanNumber=function(){this.skipCommentsAndSpace();var e=this._currentIndex,r=this._source,n=this._currentIndex;return n=t._scanDigits(r,n),"."===r[n]&&(n=t._scanDigits(r,n+1)),this.advance(n-this._currentIndex),Number(r.substring(e,n))},n.scanColor=function(){this.scanLexeme("(");var e=this.scanNumber(),t=0,n=0,i=1;return this.skipCommentsAndSpace(),")"!==this.peek(1)&&(this.scanLexeme(","),t=this.scanNumber(),this.skipCommentsAndSpace(),")"!==this.peek(1)&&(this.scanLexeme(","),n=this.scanNumber(),this.skipCommentsAndSpace(),")"!==this.peek(1)&&(this.scanLexeme(","),i=this.scanNumber(),this.skipCommentsAndSpace()))),this.scanLexeme(")"),new r.Color(e,t,n,i)},n.scanToken=function(){for(;;){if(this.skipCommentsAndSpace(),this.isEnd())return this._createEOFToken();var e=this.getShaderPosition(0);if(ed.isAlpha(this.getCurCharCode())){var r=this._scanWord(e);if(null!==r)return r;this.hasPendingContent=!0;continue}var n=this.getCurChar(),i=t._symbolLexemeTable[n];if(void 0!==i){this.advance(1);var a=this._createToken();return a.set(i,n,e),a}this.advance(1)}},n.scanToCharacter=function(e){for(;this.getCurChar()!==e&&"}"!==this.getCurChar()&&!this.isEnd();)this.advance(1);return this.getCurChar()===e&&(this.advance(1),!0)},n.createCompileError=function(e,t,r){return eh.createGSError(e,el.CompilationError,this.source,null!=t?t:this.getShaderPosition(0),r)},n._scanWord=function(e){for(;ed.isAlnum(this.getCurCharCode())&&!this.isEnd();)this.advance(1);var r,n=this.getShaderPosition(0);if(!this._validateWordBoundaries(e.index,n.index))return null;var i=this._source.substring(e.index,n.index),a=null!=(r=t._keywordLexemeTable[i])?r:B.ID,o=this._createRange(e,n),s=this._createToken();return s.set(a,i,o),s},n._validateWordBoundaries=function(e,t){var r=this._source;if(e>0){var n=r.charCodeAt(e-1);if(!this._isValidWordBoundary(n))return!1}if(t<r.length){var i=r.charCodeAt(t);if(!this._isValidWordBoundary(i))return!1}return!0},n._isValidWordBoundary=function(e){return ed.isWhiteSpaceChar(e,!0)||t._isWordSeparatorChar(e)},t._isWordSeparatorChar=function(e){return 123===e||125===e||61===e||59===e||46===e||91===e||40===e||124===e},t._scanDigits=function(e,t){for(var r=t;r<e.length;){var n=e.charCodeAt(r);if(ed.isDigit(n))r++;else break}return r},t}(ed);tH._keywordLexemeTable={RenderQueueType:U.GSRenderQueueType,BlendState:U.GSBlendState,DepthState:U.GSDepthState,StencilState:U.GSStencilState,RasterState:U.GSRasterState,EditorProperties:U.GSEditorProperties,EditorMacros:U.GSEditorMacros,Editor:U.GSEditor,Tags:U.GSTags,VertexShader:U.GSVertexShader,FragmentShader:U.GSFragmentShader,SubShader:U.GSSubShader,Pass:U.GSPass,BlendFactor:U.GSBlendFactor,BlendOperation:U.GSBlendOperation,Bool:U.GSBool,Number:U.GSNumber,Color:U.GSColor,CompareFunction:U.GSCompareFunction,StencilOperation:U.GSStencilOperation,CullMode:U.GSCullMode,ColorWriteMask:U.GSColorWriteMask,UsePass:U.GSUsePass,true:U.True,false:U.False},tH._symbolLexemeTable={"{":U.LeftBrace,"}":U.RightBrace,"=":U.Equal,"|":U.BitwiseOr};var tX={RenderQueueType:t.RenderQueueType,CompareFunction:t.CompareFunction,StencilOperation:t.StencilOperation,BlendOperation:t.BlendOperation,BlendFactor:t.BlendFactor,CullMode:t.CullMode,ColorWriteMask:t.ColorWriteMask},tQ=function(){function e(){}return e.parse=function(e){return new tK().parse(e).shaderSource},e.parseStrict=function(e,t){return new tK(t).parse(e)},e.parseWithErrors=function(e){return new tK().parseWithErrors(e)},e}(),tK=function(){function e(e){this._objectPool=e,this._errors=[],this._symbolTableStack=new ew,this._lookupSymbol=new tq("",null),this._shaderSource=tj.createShaderSource(""),this._reportedUnexpectedEnd=!1,this._lexer=new tH(void 0,this._objectPool)}var r=e.prototype;return r.parseWithErrors=function(e){try{return this.parse(e)}catch(e){if(!z(e,eu))throw e;return this._errors.push(e),{shaderSource:this._shaderSource,errors:Object.freeze(this._errors.slice())}}},r.parse=function(e){null==(t=this._objectPool)||t.reset(),this._pushScope();var t,r=this._lexer;r.setSource(e);for(var n=this._parseShader(r),i=n.pendingContents,a=n.renderStates,o=0,s=n.subShaders.length;o<s;o++){var c=n.subShaders[o],u={constantMap:ep({},a.constantMap),variableMap:ep({},a.variableMap)};this._mergeRenderStates(u,c.renderStates);for(var l=0,h=c.passes.length;l<h;l++){var d=c.passes[l],p={constantMap:ep({},u.constantMap),variableMap:ep({},u.variableMap)};if(this._mergeRenderStates(p,d.renderStates),d.renderStates=p,!d.isUsePass){var f=this._composePassContents([i,c.pendingContents,d.pendingContents]);d.contents=f.contents,d.contentScopeStarts=f.scopeStarts}}}return{shaderSource:n,errors:Object.freeze(this._errors.slice())}},r._composePassContents=function(e){for(var t,r=[],n=[],i=0,a=j(e);!(t=a()).done;){var o=t.value;n.push(i);for(var s,c=j(o);!(s=c()).done;){var u=s.value;r.length&&i++,r.push(u.content),i+=u.content.length}}return{contents:r.join("\n"),scopeStarts:Object.freeze(n)}},r._parseShader=function(e){e.scanLexeme("Shader");var t=e.scanPairedChar('"','"',!1,!1),r=tj.createShaderSource(t);this._shaderSource=r,e.scanLexeme("{");var n=1;e.skipCommentsAndSpace();for(var i=e.getShaderPosition(0),a=r.pendingContents;;){var o=e.scanToken();switch(o.type){case B.EOF:return this._addPendingContents(i,0,a),this._reportUnexpectedEnd(o,"Shader"),this._popScope(),r;case U.GSSubShader:this._addPendingContents(i,o.lexeme.length,a);var s=this._parseSubShader();r.subShaders.push(s),i=e.getShaderPosition(0);break;case U.GSEditorProperties:case U.GSEditorMacros:case U.GSEditor:this._addPendingContents(i,o.lexeme.length,a),e.scanPairedChar("{","}",!0,!1),i=e.getShaderPosition(0);break;case U.LeftBrace:++n;break;case U.RightBrace:if(0==--n)return this._addPendingContents(i,o.lexeme.length,a),this._popScope(),r;break;default:i=this._parseRenderState(o,i,a,r.renderStates)}}},r._parseRenderStateDeclarationOrAssignment=function(e,t){var r=this._lexer,n=r.scanToken();if(n.type===B.ID){r.scanLexeme("{");var i=this._parseRenderStateProperties(t.lexeme),a=new tq(n.lexeme,t.type,i);this._symbolTableStack.insert(a)}else if("="===n.lexeme){var o,s=r.scanToken();if(s.type===B.EOF)return;if("{"===s.lexeme)o=this._parseRenderStateProperties(t.lexeme);else{r.scanLexeme(";");var c=this._lookupSymbol;c.set(s.lexeme,t.type);var u=this._symbolTableStack.lookup(c);if(!(null==u?void 0:u.value)){this._createCompileError('Invalid "'+t.lexeme+'" variable: '+s.lexeme+" — property will not be applied.",s.location,"InvalidRenderStateVariable");return}o=u.value}this._mergeRenderStates(e,o)}},r._mergeRenderStates=function(e,t){var r=e.constantMap,n=e.variableMap,i=t.constantMap,a=t.variableMap;for(var o in i)delete n[o],r[o]=i[o];for(var s in a)delete r[s],n[s]=a[s]},r._parseVariableDeclaration=function(){var e=this._lexer,t=e.scanToken();e.scanLexeme(";");var r=new tq(t.lexeme,t.type);this._symbolTableStack.insert(r)},r._pushScope=function(){var e=new eF;this._symbolTableStack.pushScope(e)},r._popScope=function(){this._symbolTableStack.popScope()},r._parseRenderStateProperties=function(e){for(var t=this._lexer,r=tj.createRenderStates();"}"!==t.getCurChar()&&!t.isEnd();)this._parseRenderStateProperty(e,r),t.skipCommentsAndSpace();return"}"===t.getCurChar()&&t.advance(1),r},r._createCompileError=function(e,t,r){var n=this._lexer.createCompileError(e,t,r);this._errors.push(n)},r._scanEnumConstValue=function(e){var t,r=this._lexer;r.advance(1);var n=r.scanToken(),i=null==(t=tX[e])?void 0:t[n.lexeme];return void 0==i&&(this._createCompileError("Invalid engine constant: "+e+"."+n.lexeme+" — property will not be applied.",n.location,"InvalidEnumValue"),r.scanToCharacter(";")),i},r._parseRenderStateProperty=function(e,r){var n,i=this._lexer,a=i.scanToken(),o=a.lexeme,s=o;if("BlendState"===e&&"BlendColor"!==o&&"AlphaToCoverage"!==o){var c=0,u=i.scanTwoExpectedLexemes("[","=");if("["===u)c=i.scanNumber(),i.scanLexeme("]"),i.scanLexeme("=");else if("="!==u){this._createCompileError("Invalid syntax, expect '[' or '=', but got unexpected token",void 0,"SyntaxError"),i.scanToCharacter(";");return}s+=c}else i.scanLexeme("=");var l=t.RenderStateElementKey[e+s];if(void 0===l){this._createCompileError("Invalid render state property "+o+" — property will not be applied.",a.location,"InvalidRenderStateProperty"),i.scanToCharacter(";");return}i.skipCommentsAndSpace();var h=i.getCurCharCode();if(ed.isDigit(h)||46===h)n=i.scanNumber();else{var d=i.scanToken(),p=d.type;if(p===B.EOF)return;if(p===U.True)n=!0;else if(p===U.False)n=!1;else if(p===U.GSColor)n=i.scanColor();else if("."===i.getCurChar()){if(void 0==(n=this._scanEnumConstValue(d.lexeme)))return;if(i.skipCommentsAndSpace(),"|"===i.getCurChar()){if("ColorWriteMask"!==d.lexeme){this._createCompileError("Bitwise OR '|' is not supported for '"+d.lexeme+"', only bitmask enums like 'ColorWriteMask' support this — property will not be applied.",d.location,"BitwiseOrOnNonBitmask"),i.scanToCharacter(";");return}for(;"|"===i.getCurChar();){i.advance(1);var f=i.scanToken();if(void 0==f||"."!==i.getCurChar()){this._createCompileError("Invalid syntax after '|', expect 'EnumType.Value'",null==f?void 0:f.location,"SyntaxError"),i.scanToCharacter(";");return}if(f.lexeme!==d.lexeme){this._createCompileError("Cannot mix enum types in bitwise OR: expected '"+d.lexeme+"' but got '"+f.lexeme+"' — property will not be applied.",f.location,"MixedEnumTypes"),i.scanToCharacter(";");return}var _=this._scanEnumConstValue(f.lexeme);if(void 0==_)return;n|=_,i.skipCommentsAndSpace()}}}else{n=d.lexeme;var v=this._lookupSymbol;if(v.set(d.lexeme,B.ID),!this._symbolTableStack.lookup(v)){this._createCompileError("Invalid "+e+" variable: "+d.lexeme+" — property will not be applied.",d.location,"InvalidRenderStateVariable"),i.scanToCharacter(";");return}}}i.scanLexeme(";"),"string"==typeof n?r.variableMap[l]=n:r.constantMap[l]=n},r._parseRenderQueueDeclarationOrAssignment=function(e){var r=this._lexer,n=r.scanToken();if(n.type===B.ID){r.scanLexeme(";");var i=new tq(n.lexeme,U.GSRenderQueueType);this._symbolTableStack.insert(i);return}if("="!==n.lexeme){this._createCompileError("Invalid syntax, expect character '=', but got "+n.lexeme,n.location,"SyntaxError");return}var a=r.scanToken();r.scanLexeme(";");var o=tX.RenderQueueType[a.lexeme],s=t.RenderStateElementKey.RenderQueueType;if(void 0==o){var c=this._lookupSymbol;if(c.set(a.lexeme,U.GSRenderQueueType),!this._symbolTableStack.lookup(c)){this._createCompileError("Invalid RenderQueueType variable: "+a.lexeme+" — property will not be applied at runtime.",a.location,"InvalidRenderQueueVariable");return}e.variableMap[s]=a.lexeme}else e.constantMap[s]=o},r._addPendingContents=function(e,t,r){var n=this._lexer;if(n.hasPendingContent){var i=n.currentIndex-t;r.push({range:{start:e,end:ep({},n.getShaderPosition(0),{index:i-1})},content:n.source.substring(e.index,i-1)}),n.hasPendingContent=!1}},r._parseSubShader=function(){var e=this._lexer;this._pushScope();var t=1,r=e.scanPairedChar('"','"',!1,!1),n=tj.createSubShaderSource(r);e.scanLexeme("{"),e.skipCommentsAndSpace();for(var i=e.getShaderPosition(0);;){var a=e.scanToken();switch(a.type){case B.EOF:return this._addPendingContents(i,0,n.pendingContents),this._reportUnexpectedEnd(a,"SubShader"),this._popScope(),n;case U.GSPass:this._addPendingContents(i,a.lexeme.length,n.pendingContents);var o=this._parsePass(this._retainRange(a.location));n.passes.push(o),i=e.getShaderPosition(0);break;case U.GSUsePass:this._addPendingContents(i,a.lexeme.length,n.pendingContents);var s=e.scanPairedChar('"','"',!1,!1);n.passes.push(tj.createUsePass(s)),i=e.getShaderPosition(0);break;case U.LeftBrace:++t;break;case U.RightBrace:if(0==--t)return this._addPendingContents(i,a.lexeme.length,n.pendingContents),this._popScope(),n;break;default:i=this._parseRenderStateAndTags(a,i,n.pendingContents,n.renderStates,n.tags)}}},r._parseTags=function(e){var t=this._lexer;for(t.scanLexeme("{");;){var r=t.scanToken();t.scanLexeme("=");var n=t.scanPairedChar('"','"',!1,!1);if(t.skipCommentsAndSpace(),e[r.lexeme]=n,"}"===t.peek(1)){t.advance(1);return}t.scanLexeme(",")}},r._parsePass=function(e){this._pushScope();var t=this._lexer,r=t.scanPairedChar('"','"',!1,!1),n=tj.createShaderPassSource(r);t.scanLexeme("{");var i=1;t.skipCommentsAndSpace();for(var a=t.getShaderPosition(0);;){var o=t.scanToken();switch(o.type){case B.EOF:return this._addPendingContents(a,0,n.pendingContents),this._reportUnexpectedEnd(o,"Pass"),this._popScope(),n;case U.GSVertexShader:case U.GSFragmentShader:this._addPendingContents(a,o.lexeme.length,n.pendingContents),t.scanLexeme("=");var s=t.scanToken(),c=o.type===U.GSVertexShader,u=c?"vertexEntry":"fragmentEntry";if(n[u]){this._createCompileError("Reassignment of "+(c?"VertexShader":"FragmentShader")+" entry — the first binding is kept.",s.location,"DuplicateEntryAssignment"),t.scanLexeme(";"),a=t.getShaderPosition(0);break}n[u]=s.lexeme,n[c?"vertexEntryLocation":"fragmentEntryLocation"]=this._retainRange(s.location),t.scanLexeme(";"),a=t.getShaderPosition(0);break;case U.LeftBrace:++i;break;case U.RightBrace:if(0==--i)return this._addPendingContents(a,o.lexeme.length,n.pendingContents),n.vertexEntry&&n.fragmentEntry||this._createCompileError("Pass must bind both VertexShader and FragmentShader entries.",e,"MissingEntry"),this._popScope(),n;break;default:a=this._parseRenderStateAndTags(o,a,n.pendingContents,n.renderStates,n.tags)}}},r._reportUnexpectedEnd=function(e,t){this._reportedUnexpectedEnd||(this._reportedUnexpectedEnd=!0,this._createCompileError("Unexpected end of source while parsing "+t+".",e.location,"SyntaxError"))},r._retainRange=function(e){if(!this._objectPool)return e;var t=new G;t.set(e.start.index,e.start.line,e.start.column);var r=new G;r.set(e.end.index,e.end.line,e.end.column);var n=new w;return n.set(t,r),n},r._parseRenderStateAndTags=function(e,t,r,n,i){return e.type===U.GSTags?(this._addPendingContents(t,e.lexeme.length,r),this._parseTags(i),t=this._lexer.getShaderPosition(0)):t=this._parseRenderState(e,t,r,n),t},r._parseRenderState=function(e,t,r,n){switch(e.type){case U.GSBlendState:case U.GSDepthState:case U.GSRasterState:case U.GSStencilState:this._addPendingContents(t,e.lexeme.length,r),this._parseRenderStateDeclarationOrAssignment(n,e),t=this._lexer.getShaderPosition(0);break;case U.GSBlendFactor:case U.GSBlendOperation:case U.GSBool:case U.GSNumber:case U.GSColor:case U.GSCompareFunction:case U.GSStencilOperation:case U.GSCullMode:case U.GSColorWriteMask:this._addPendingContents(t,e.lexeme.length,r),this._parseVariableDeclaration(),t=this._lexer.getShaderPosition(0);break;case U.GSRenderQueueType:this._addPendingContents(t,e.lexeme.length,r),this._parseRenderQueueDeclarationOrAssignment(n),t=this._lexer.getShaderPosition(0);break;default:this._lexer.hasPendingContent=!0}return t},e}(),tY=0,tJ=function(){function e(){this._tokens={values:[],used:0},this._positions={values:[],used:0},this._ranges={values:[],used:0},this._nodes=[]}var t=e.prototype;return t.reset=function(){this._tokens.used=0,this._positions.used=0,this._ranges.used=0;for(var e,t=j(this._nodes);!(e=t()).done;){var r=e.value;r&&(r.used=0)}},t.createToken=function(){var e,t=this._tokens,r=t.used++;return null!=(e=t.values[r])?e:t.values[r]=new Y(this)},t.createPosition=function(e,t,r){var n,i=this._positions,a=i.used++,o=null!=(n=i.values[a])?n:i.values[a]=new G;return o.set(e,t,r),o},t.createRange=function(e,t){var r,n=this._ranges,i=n.used++,a=null!=(r=n.values[i])?r:n.values[i]=new w;return a.set(e,t),a},t.createNode=function(e){var t,r,n=null!=(t=e.__parserObjectPoolId)?t:e.__parserObjectPoolId=tY++,i=this._nodes[n];i||(i={values:[],used:0},this._nodes[n]=i);var a=i.used++;return null!=(r=i.values[a])?r:i.values[a]=new e},e}(),tZ=function(e,t){var r=t.io,n=t.vertexEntry,i=t.fragmentEntry,a=t.getDeclarationCoexistence,o=t.getBranchCoverage;this.mrtOutputIssues=function(e,t){for(var r,n=[],i=new Map,a=j(e);!(r=a()).done;)!function(){var e=r.value;e.typeInfo.type!==U.VEC4&&n.push({prop:e,kind:"invalid-type"});var a=e.mrtIndex;if(void 0===a)n.push({prop:e,kind:"missing-location"});else if(!Number.isInteger(a)||a<0)n.push({prop:e,kind:"invalid-location"});else if(null==(o=i.get(a))?void 0:o.some(function(r){return"coexist"===t(r.ident.branch,e.ident.branch)}))n.push({prop:e,kind:"duplicate-location"});else{var o,s,c=null!=(s=i.get(a))?s:[];c.push(e),i.set(a,c)}}();return n}(r.mrtList,a),this.invalidMrtReturnLocations=t4(i.functions,r.mrtStructs,!1),this.invalidVaryingReturnLocations=t4(n.functions,r.varyingStructs,!0),this.structMemberOwnerIssues=function(e,t,r,n,i){for(var a=new Set,o=new Set,s=e.slice();s.length;){var c=s.pop();a.has(c)||(a.add(c),o.add(c.astNode),s.push.apply(s,[].concat(c.calledFunctions)))}for(var u,l=new Map,h=j(r);!(u=h()).done;){var d=u.value,p=l.get(d.reference);p||l.set(d.reference,p=[]),p.push(d)}for(var f,_=new Map,v=j(t);!(f=v()).done;)!function(){var e,t=f.value;if(t$(t,o)){var r=t.children[0],a=null==(e=l.get(t))?void 0:e.filter(function(e){return void 0===e.replacementMemberOwner&&(z(r,Y)||e.isValueIdentity)}),s=void 0;if(z(r,Y)){var c=t.resolvedValueSymbols();s=(null==a?void 0:a.length)?a:[{symbols:c,fallbackStart:c.length,callSiteBranch:t._branch}]}else(z(r,tn.MacroCallSymbol)||z(r,tn.MacroCallFunction))&&(s=a);if(null==s?void 0:s.length){var u=!z(r,Y)&&s.some(function(e){return 0===e.symbols.length});u&&t3(_,t,"unresolved-owner","unknown");var h=z(r,Y)||u?void 0:function(e){for(var t=e.parent;t;){if(z(t,tn.PostfixExpression)&&3===t.children.length){var r=t.children[0],n=t.children[2];if(z(r,tr)&&z(n,Y)&&e4.unwrapBareIdentifier(r,{allowParens:!0})===e)return n}t=t.parent}}(t);h&&t3(_,t,"incompatible-io-member",function(e,t,r,n){for(var i,a,o=j(t);!(a=o()).done;)for(var s,c=a.value,u=c.symbols.slice(0,c.fallbackStart),l="covered"===n(u.map(function(e){var t;return null!=(t=e.branchSignature)?t:K}),c.callSiteBranch)?u:c.symbols,h=j(l);!(s=h()).done;){var d=s.value;if(z(d,e2)&&r.has(d)){for(var p,f,_,v,m=t0(c.callSiteBranch,null!=(f=d.branchSignature)?f:K),g=[],y=j(null!=(_=null==(p=d.dataType)?void 0:p.structDeclarations)?_:[]);!(v=y()).done;)for(var S,b=v.value,x=j(b.propList);!(S=x()).done;){var E=S.value;E.ident.lexeme===e.lexeme&&g.push(t0(m,b._branch,E.ident.branch))}var C=n(g,m);if(!g.length||"uncovered"===C)return"definite";"unknown"===C&&(i="unknown")}}return i}(h,s,n,i)),t3(_,t,"mixed-owner-roles",t1(t,s,n,i))}}}();for(var m,g=new Map,y=j(r);!(m=y()).done;){var S=m.value,b=S.replacementMemberOwner;if(void 0!==b&&t$(S.reference,o)){var x=g.get(S.reference);x||g.set(S.reference,x=new Map);var E=x.get(b);E||x.set(b,E=[]),E.push(S)}}for(var C,A=j(g);!(C=A()).done;)for(var T,O=C.value,I=O[0],R=O[1],M=j(R.values());!(T=M()).done;){var P=T.value;P.some(function(e){return 0===e.symbols.length})&&t3(_,I,"unresolved-owner","unknown"),P.some(function(e){return e.requiresRuntimeOwnerExpansion})&&t3(_,I,"runtime-expanded-io-owner",function(e,t,r){for(var n,i=!1,a=j(e);!(n=a()).done;){var o=n.value,s=o.symbols.slice(0,o.fallbackStart),c=r(s.map(function(e){var t;return null!=(t=e.branchSignature)?t:K}),o.callSiteBranch),u="covered"===c?s:o.symbols;if(function(e,t){return e.some(function(e){return z(e,e2)&&t.has(e)})}(u,t)){if("covered"===("covered"===c?c:r(u.map(function(e){var t;return null!=(t=e.branchSignature)?t:K}),o.callSiteBranch)))return"definite";i=!0}}return i?"unknown":void 0}(P,n,i)),t3(_,I,"mixed-owner-roles",t1(I,P,n,i))}return Array.from(_,function(e){var t=e[0],r=e[1];return ep({location:t.location},r)})}([].concat(n.functions,i.functions),e.shaderData.directMemberOwnerReferences,e.shaderData.referenceResolutionSnapshots,r.structVariableRoles,o)};function t$(e,t){for(var r=e.parent;r;){if(z(r,tn.FunctionDefinition))return t.has(r);r=r.parent}return!1}function t0(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];for(var n,i=[],a=j(t);!(n=a()).done;)for(var o,s=n.value,c=j(s);!(o=c()).done;){var u=o.value;-1===i.indexOf(u)&&i.push(u)}return i}function t1(e,t,r,n){for(var i,a=[],o=!1,s=j(t);!(i=s()).done;){for(var c=i.value,u=[],l=0;l<c.fallbackStart;l++)u.push(null!=(f=c.symbols[l].branchSignature)?f:K);var h=n(u,c.callSiteBranch),d=t2(c.symbols,r,c.fallbackStart),p="covered"===h?d:t2(c.symbols,r);if(p.size>1){if(d.size>1&&"covered"===h||d.size<=1&&"uncovered"===h)return"definite";o=!0}for(var f,_,v=j(p);!(_=v()).done;){var m=_.value;-1===a.indexOf(m)&&a.push(m)}}return o?"unknown":a.length<=1?void 0:"covered"===n(t.map(function(e){return e.callSiteBranch}),e._branch)?"definite":"unknown"}function t2(e,t,r){void 0===r&&(r=e.length);for(var n=new Set,i=0;i<r;i++){var a,o=e[i];z(o,e2)&&n.add(null!=(a=t.get(o))?a:"ordinary")}return n}function t3(e,t,r,n){if(n){var i=e.get(t);i&&("unknown"!==i.certainty||"definite"!==n)||e.set(t,{kind:r,certainty:n})}}function t4(e,t,r){for(var n,i=[],a=j(e);!(n=a()).done;){var o=n.value,s=o.astNode.protoType.returnType.typeSpecifier.structDeclarations;s.some(function(e){return t.includes(e)})&&function e(t,r,n,i){if(z(t,tn.JumpStatement)&&3===t.children.length){var a=t.children[1];z(a,tr)&&function(e,t,r){var n,i,a=e4.unwrapBareIdentifier(e,{allowParens:!0}),o=null!=(i=null==a?void 0:a.resolvedValueSymbols())?i:[];if(o.length>0&&o.every(function(e){var r;return z(e,e2)&&(null==(r=e.dataType)?void 0:r.structDeclarations.some(function(e){return t.includes(e)}))}))return!0;if(!r)return!1;var s=e4.unwrapNodeByType(e,eW.function_call),c=null==s?void 0:s.children[0];return z(null==c?void 0:c.fnSymbol,e0)&&(null==(n=c.fnSymbol.dataType)?void 0:n.structDeclarations.some(function(e){return t.includes(e)}))===!0}(a,r,n)||i.push(t.location);return}for(var o,s=j(t.children);!(o=s()).done;){var c=o.value;z(c,tr)&&e(c,r,n,i)}}(o.astNode.statements,s,r,i)}return i}function t9(e,t){return(t9=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function t5(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&t9(e,t)}function t6(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(t6=function(){return!!e})()}function t8(e,t,r){return(t8=t6()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var i=new(Function.bind.apply(e,n));return r&&t9(i,r.prototype),i}).apply(null,arguments)}function t7(e){return(t7=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function re(e){var t="function"==typeof Map?new Map:void 0;return(re=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return t8(e,arguments,t7(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),t9(r,e)})(e)}function rt(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function rr(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return rt(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return rt(e,void 0)}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var rn=/*#__PURE__*/function(){function e(){this._lookupSymbol=new e$("",null),this._structRoles=new Map,this._vertexUnresolvedVariableRoles=new Map,this._fragmentUnresolvedVariableRoles=new Map,this._vertexAmbiguousVariableNames=new Set,this._fragmentAmbiguousVariableNames=new Set,this.attributeStructs=[],this.attributeList=[],this.varyingStructs=[],this.varyingList=[],this.mrtStructs=[],this.mrtList=[],this._referencedGlobalSymbols=new Set,this._referencedGlobalMacroASTs=[],this._structVariableRoles=new Map,this.codeCache=new Map,this.fragmentReturnModes=new Map,this.terminalInterfaceReturns=new Set,this.reset()}var t=e.prototype;return t.reset=function(e){void 0===e&&(e=!0),this.codeCache.clear(),this.fragmentReturnModes.clear(),this.terminalInterfaceReturns.clear(),e&&(this.attributeStructs.length=0,this.attributeList.length=0,this.varyingStructs.length=0,this.varyingList.length=0,this.mrtStructs.length=0,this.mrtList.length=0,this._structRoles.clear(),this._vertexUnresolvedVariableRoles.clear(),this._fragmentUnresolvedVariableRoles.clear(),this._vertexAmbiguousVariableNames.clear(),this._fragmentAmbiguousVariableNames.clear()),this._referencedAttributeList=Object.create(null),this._referencedVaryingList=Object.create(null),this._referencedMRTList=Object.create(null),this._referencedGlobals=Object.create(null),this._referencedGlobalSymbols.clear(),this._globalSymbolQueries=Object.create(null),this._referencedGlobalMacroASTs.length=0,e&&(this._structVariableRoles.clear(),this._passSymbolTable=void 0)},t.getStructRole=function(e){for(var t,r,n=rr(e);!(r=n()).done;){var i=r.value,a=this._structRoles.get(i);if(!a||t&&t!==a)return;t=a}return t},t.hasStructRole=function(e,t){return this._structRoles.get(e)===t},t.registerStructTypes=function(e,t){for(var r,n=rr(t);!(r=n()).done;){var i=r.value;this._structRoles.set(i,e)}},t.registerStructVar=function(e,t,r){if(this._structVariableRoles.set(e,t),void 0!==r){var n=r===eG.VERTEX?this._vertexUnresolvedVariableRoles:this._fragmentUnresolvedVariableRoles,i=r===eG.VERTEX?this._vertexAmbiguousVariableNames:this._fragmentAmbiguousVariableNames,a=e.ident;if(!i.has(a)){var o=n.get(a);o&&o!==t?(n.delete(a),i.add(a)):n.set(a,t)}}},t.getUnresolvedStructVarRole=function(e){var t=this.stage===eG.VERTEX?this._vertexUnresolvedVariableRoles:this._fragmentUnresolvedVariableRoles;return(this.stage===eG.VERTEX?this._vertexAmbiguousVariableNames:this._fragmentAmbiguousVariableNames).has(e)?void 0:t.get(e)},t.getStructVarRole=function(e){for(var t,r,i=rr(e);!(r=i()).done;){var a=r.value;if(!n(a,e2))return;var o=this._structVariableRoles.get(a);if(!o||t&&t!==o)return;t=o}return t},t.registerFragmentReturn=function(e,t){this.fragmentReturnModes.set(e,t)},t.getFragmentReturnMode=function(e){return this.fragmentReturnModes.get(e)},t.registerTerminalInterfaceReturn=function(e){this.terminalInterfaceReturns.add(e)},t.isTerminalInterfaceReturn=function(e){return this.terminalInterfaceReturns.has(e)},t.referenceAttribute=function(e){this._referenceProp(e.lexeme,this.attributeList,this._referencedAttributeList)},t.referenceVarying=function(e){this._referenceProp(e.lexeme,this.varyingList,this._referencedVaryingList)},t.referenceMRTProp=function(e){this._referenceProp(e.lexeme,this.mrtList,this._referencedMRTList)},t.referenceGlobal=function(e,t){var r=null!=(a=(i=this._globalSymbolQueries)[e])?a:i[e]=Object.create(null),n=r[t];if(!n){this._lookupSymbol.set(e,t),n=r[t]=this._passSymbolTable.getSymbols(this._lookupSymbol,!0,[]);for(var i,a,o,s,c,u=null!=(s=(o=this._referencedGlobals)[e])?s:o[e]=[],l=rr(n);!(c=l()).done;){var h=c.value;this._referencedGlobalSymbols.has(h)||(this._referencedGlobalSymbols.add(h),u.push(h))}}null==this.onReferenceGlobal||this.onReferenceGlobal.call(this,n)},t._referenceProp=function(e,t,r){r[e]||(r[e]=t.filter(function(t){return t.ident.lexeme===e})),null==this.onReferenceStructProps||this.onReferenceStructProps.call(this,r[e])},e}(),ri=/*#__PURE__*/function(){function e(){this.array=[]}return e.prototype.dispose=function(){this.array.length=0},e}(),ra=/*#__PURE__*/function(){function e(){this.context=new rn}var t=e.prototype;return t.cache=function(e,t){return this.context.codeCache.set(e,t),t},t.getCachedCode=function(e){return this.context.codeCache.get(e)},t.defaultCodeGen=function(t){var r=e._tmpArrayPool,i=r.get();i.dispose();for(var a,o=rr(t);!(a=o()).done;){var s=a.value;n(s,Y)?i.array.push(s.lexeme):i.array.push(s.codeGen(this))}var c=i.array.join(" ");return i.dispose(),r.return(i),c},t.visitPostfixExpression=function(e){var t=e.children,r=t.length,i=this.context;if(3===r){var a=t[0],o=t[2];if(!n(o,Y))return a.codeGen(this)+"."+o.codeGen(this);var s,c=e4.unwrapBareIdentifier(a,{allowParens:!0});if(c){var u=c.resolvedValueSymbols(),l=e4.extractDirectIdentLexeme(a);s=u.length?i.getStructVarRole(u):l?i.getUnresolvedStructVarRole(l):void 0}return s?(s===tO.Attribute?i.referenceAttribute(o):s===tO.Varying?i.referenceVarying(o):i.referenceMRTProp(o),o.lexeme):a.codeGen(this)+"."+o.lexeme}if(4===r){var h=t[0],d=t[2];return h.codeGen(this)+"["+d.codeGen(this)+"]"}return this.defaultCodeGen(e.children)},t.visitVariableIdentifier=function(e){for(var t,r=rr(e.referenceGlobalSymbolNames);!(t=r()).done;){var i=t.value;this.context.referenceGlobal(i,eZ.Any)}for(var a,o=rr(e.resolvedSymbols());!(a=o()).done;){var s=a.value;n(s,e0)&&this.referenceFunction(s,e.location.start.index,e._branch)}return e.getLexeme(this)},t.referenceFunction=function(e,t,r){this.context.referenceGlobal(e.ident,eZ.FN)},t.visitFunctionCall=function(e){var t=e.children[0];if(n(t.fnSymbol,e0)){for(var r,i,a=rr((null==(r=t.fnSymbols)?void 0:r.length)?t.fnSymbols:[t.fnSymbol]);!(i=a()).done;){var o=i.value;this.referenceFunction(o,e.location.start.index,e._branch)}var s=t.children[2];if(n(s,tn.FunctionCallParameterList)){for(var c=s.paramNodes,u=this.context._referencedGlobals[t.fnSymbol.ident].find(function(e){return n(e,e0)&&e.equal(t.fnSymbol)}),l=(null!=u?u:t.fnSymbol).astNode.protoType.parameterList,h=this.context,d=c.filter(function(e,t){var r,i=null==l?void 0:null==(r=l[t])?void 0:r.astNode;return!n(i,tn.ParameterDeclaration)||!i.symbol||!h.getStructVarRole([i.symbol])}),p="",f=0,_=d.length;f<_;f++){var v=d[f],m=v.codeGen(this);n(v,tn.MacroCallArgBlock)||0===f?p+=m:p+=", "+m}return t.fnSymbol.ident+"("+p+")"}}return this.defaultCodeGen(e.children)},t.visitMacroCallFunction=function(e){var t=e.children[2];if(!n(t,tn.FunctionCallParameterList))return this.defaultCodeGen(e.children);var r,i=t.paramNodes,a=this.context;r=e.isFunctionLikeMacro||!e.aliasesNonBuiltinIdent?i:i.filter(function(e){if(n(e,tn.AssignmentExpression)){var t=e4.unwrapBareIdentifier(e,{allowParens:!1});if(t&&a.getStructVarRole(t.resolvedValueSymbols()))return!1}return!0});for(var o="",s=0,c=r.length;s<c;s++){var u=r[s],l=u.codeGen(this);n(u,tn.MacroCallArgBlock)||0===s?o+=l:o+=", "+l}return e.macroName+"("+o+")"},t.visitStatementList=function(e){var t=e.children;return 1===t.length?t[0].codeGen(this):t[0].codeGen(this)+"\n"+t[1].codeGen(this)},t.visitMacroDefine=function(e){var t="";if(e.isFunction){var r=e.children[2];n(r,Y)&&(t=r.lexeme)}var i=e.valueExpression?e.valueExpression.codeGen(this):"";return"\n#define "+e.macroName+t+(i?" "+i:"")+"\n"},t.visitSingleDeclaration=function(e){return this.defaultCodeGen(e.children)},t.visitGlobalVariableDeclaration=function(e){var t=e.children,r=t[0];if(n(r,tn.FullySpecifiedType)&&r.typeSpecifier.isCustom){var i=this.context;if(i.getStructVarRole([e.declarator.symbol]))return"";i.referenceGlobal(r.type,eZ.STRUCT)}return"uniform "+this.defaultCodeGen(t)},t.visitDeclaration=function(e){var t=this.context,r=e.children,i=r[0];if(n(i,tn.InitDeclaratorList)){var a,o=i.children[0],s=null!=(a=i.declarator)?a:n(o,tn.SingleDeclaration)?o.declarator:void 0,c=s&&t.getStructVarRole([s.symbol]);if(c===tO.Varying||c===tO.Mrt)return""}return this.defaultCodeGen(r)},t.visitFunctionParameterList=function(e){for(var t=this.context,r=e.parameterInfoList.filter(function(e){var r=e.astNode;return!n(r,tn.ParameterDeclaration)||!r.symbol||!t.getStructVarRole([r.symbol])}),i="",a=0,o=r.length;a<o;a++){var s=r[a].astNode,c=s.codeGen(this);n(s,tn.MacroParamBlock)||0===a?i+=c:i+=", "+c}return i},t.visitFunctionHeader=function(e){var t=e.returnType.typeSpecifier;return this.context.getStructRole(t.structDeclarations)===tO.Varying?"void "+e.ident.lexeme+"(":this.defaultCodeGen(e.children)},t.visitJumpStatement=function(e){var t=e.children;if(t[0].type===U.RETURN){var r=t[1];if(n(r,tn.Expression)){var i=e4.unwrapNodeByType(r,eW.variable_identifier);if(i&&this.context.getStructVarRole(i.resolvedValueSymbols())===tO.Varying)return this.context.isTerminalInterfaceReturn(e)?"":"return;";var a=e4.unwrapNodeByType(r,eW.function_call),o=null==a?void 0:a.children[0],s=n(null==o?void 0:o.fnSymbol,e0)?o.fnSymbol.astNode.protoType.returnType.typeSpecifier.structDeclarations:[];if(this.context.getStructRole(s)===tO.Varying){var c=""+r.codeGen(this)+";";return this.context.isTerminalInterfaceReturn(e)?c:"{ "+c+" return; }"}}}return this.defaultCodeGen(t)},t.visitFunctionIdentifier=function(e){return this.defaultCodeGen(e.children)},t.visitTypeSpecifier=function(e){return this.defaultCodeGen(e.children)},t.visitStructSpecifier=function(e){var t=this,r=this.context,i=r.varyingStructs,a=r.attributeStructs,o=r.mrtStructs,s=-1!==i.indexOf(e),c=-1!==a.indexOf(e),u=-1!==o.indexOf(e);if(!s&&!c&&!u)return this.defaultCodeGen(e.children);var l=[];l.push.apply(l,[].concat(e.macroExpressions.map(function(e){return{text:n(e,Y)?e.lexeme:e.codeGen(t),index:e.location.start.index}})));for(var h,d=rr(e.propList);!(h=d()).done;){var p,f,_,v=h.value,m=v.ident.lexeme;s&&(null==(p=r._referencedVaryingList[m])?void 0:p.indexOf(v))>=0?l.push({text:""+this.getVaryingProp(v)+"\n",index:v.ident.location.start.index}):c&&(null==(f=r._referencedAttributeList[m])?void 0:f.indexOf(v))>=0?l.push({text:""+this.getAttributeProp(v)+"\n",index:v.ident.location.start.index}):u&&(null==(_=r._referencedMRTList[m])?void 0:_.indexOf(v))>=0&&l.push({text:""+this.getMRTProp(v)+"\n",index:v.ident.location.start.index})}return l.sort(function(e,t){return e.index-t.index}).map(function(e){return e.text}).join("")},t.visitFunctionDefinition=function(e){var t=e.protoType.ident.lexeme,r=this.context,i=e4.lastStatement(e.statements);return(n(i,tn.JumpStatement)&&r.registerTerminalInterfaceReturn(i),t==r.stageEntry)?"void main() "+e.statements.codeGen(this):this.defaultCodeGen(e.children)},e}();ra._tmpArrayPool=new t.ReturnableObjectPool(ri,10);var ro=/*#__PURE__*/function(){function e(){}return e.declaration=function(e,t,r){if(void 0===r&&(r=!0),!t)return e;var n=r?"\0D"+t.id+","+t.group+","+t.sourceScope+"\0\n":"";return e?n+"\0T"+t.id+"\0\n"+e+"\n\0E\0\n":n},e.sharedDeclaration=function(e,t){return e?"\0T"+t.map(function(e){return e.id}).join(",")+"\0\n"+e+"\n\0E\0\n":""},e.reference=function(e,t){return"\0R"+e+","+t+"\0\n"},e.source=function(e){return 0>e.indexOf("\0")?e:e.replace(/\0[^\0]*\0\n?/g,"")},e.parse=function(r,n){for(var i,a=[],o=r.length,s=0,c=[];s<o;){var u=e._findDirectiveStart(r,s,o);if(-1===u){e._pushText(a,r,s,o,i);break}u>s&&e._pushText(a,r,s,u,i);var l=e._findLogicalLineEnd(r,u,o),h=r.substring(u,l).replace(/\\(?:\r\n|\n|\r)/g,"");if(s=l<o?l+1:o,0===h.charCodeAt(0)){var d=h.charAt(1);if("D"===d){var p=h.slice(2,-1).split(",").map(Number);a.push([t.ShaderPreprocessorDirective.Declaration,p[0],p[1],p[2]])}else if("R"===d){var f=h.slice(2,-1).split(",").map(Number);a.push([t.ShaderPreprocessorDirective.Reference,f[0],f[1]])}else{var _=h.slice(2,-1);i="T"===d?_?_.split(",").map(Number):[]:void 0}continue}var v=e._DIRECTIVE_RE.exec(h);if(!v){var m=l<o?h+"\n":h;e._pushText(a,m,0,m.length,i);continue}var g=v[1],y=v[2].trim();switch(g){case"ifdef":var S=a.length;a.push([t.ShaderPreprocessorDirective.IfDef,y,-1]),c.push([S]);break;case"ifndef":var b=a.length;a.push([t.ShaderPreprocessorDirective.IfNdef,y,-1]),c.push([b]);break;case"if":var x=e._parseCondition(y,n),E=a.length;e._pushConditionInstruction(a,x),c.push([E]);break;case"elif":var C=c[c.length-1],A=C[C.length-1],T=a.length;a.push([t.ShaderPreprocessorDirective.Else,-1]),C.push(T),e._backfillJump(a[A],a.length);var O=e._parseCondition(y,n),I=a.length;e._pushConditionInstruction(a,O),C.push(I);break;case"else":var R=c[c.length-1],M=R[R.length-1],P=a.length;a.push([t.ShaderPreprocessorDirective.Else,-1]),R.push(P),e._backfillJump(a[M],a.length);break;case"endif":var D=a.length;a.push([t.ShaderPreprocessorDirective.Endif]);var L=c.pop();if(L)for(var N=D+1,k=0;k<L.length;k++){var V=a[L[k]];V[0]===t.ShaderPreprocessorDirective.Else?V[1]=N:e._backfillJump(V,N,!0)}break;case"define":var F=e._FUNC_MACRO_RE.exec(y);if(F){var w=F[2].split(",").map(function(e){return e.trim()}).filter(function(e){return e.length>0});a.push([t.ShaderPreprocessorDirective.DefineFunc,F[1],w,e._stripLineComment(F[3].trim())])}else{var G=e._findInlineWhitespace(y);G===y.length?a.push([t.ShaderPreprocessorDirective.Define,y]):a.push([t.ShaderPreprocessorDirective.DefineVal,y.substring(0,G),e._stripLineComment(y.substring(G+1).trim())])}break;case"undef":a.push([t.ShaderPreprocessorDirective.Undef,y])}}return a},e._pushConditionInstruction=function(e,r){"def"===r.t?e.push([t.ShaderPreprocessorDirective.IfDef,r.m,-1]):"ndef"===r.t?e.push([t.ShaderPreprocessorDirective.IfNdef,r.m,-1]):"cmp"===r.t?e.push([t.ShaderPreprocessorDirective.IfCmp,r.m,r.op,r.v,-1]):e.push([t.ShaderPreprocessorDirective.IfExpr,r,-1])},e._parseCondition=function(e,t){var r,n=null!=(r=null==t?void 0:t.get(e))?r:S(e);if("error"in n){if(!n.error.certain&&n.hasExpandableIdentifier)return{t:"deferred",e:e};throw Error(n.error.message)}if(n.evaluationError)throw Error(n.evaluationError);var i=function e(t){switch(t.t){case"def":case"bool":case"cmp":return t;case"and":var r=e(t.l),n=e(t.r);return r&&n?{t:"and",l:r,r:n}:void 0;case"or":var i=e(t.l),a=e(t.r);return i&&a?{t:"or",l:i,r:a}:void 0;case"not":var o=e(t.c);return o?{t:"not",c:o}:void 0;case"id":return{t:"cmp",m:t.m,op:"!=",v:0};case"binary":return function(e){var t;if("=="===(t=e.op)||"!="===t||">"===t||">="===t||"<"===t||"<="===t){var r,n=x(e.r);if("id"===e.l.t&&void 0!==n)return{t:"cmp",m:e.l.m,op:e.op,v:n};var i=x(e.l);return"id"===e.r.t&&void 0!==i?{t:"cmp",m:e.r.m,op:function(e){switch(e){case"<":return">";case"<=":return">=";case">":return"<";case">=":return"<=";default:return e}}(e.op),v:i}:void 0===(r=x(e))?void 0:{t:"bool",v:0!==r}}}(t);case"num":return{t:"bool",v:0!==t.v};case"ndef":return{t:"not",c:{t:"def",m:t.m}};case"unary":case"deferred":return}}(n.condition);return i&&!n.hasExpandableIdentifier?i:n.hasExpandableIdentifier?{t:"deferred",e:e}:n.condition},e._findDirectiveStart=function(e,t,r){for(var n=t;n<r;){for(var i=n;i<r;){var a=e.charCodeAt(i);if(32===a||9===a)i++;else break}if(i<r&&(35===e.charCodeAt(i)||0===e.charCodeAt(i)))return n;var o=e.indexOf("\n",n);if(-1===o)break;n=o+1}return -1},e._findLogicalLineEnd=function(e,t,r){for(var n=e.indexOf("\n",t);-1!==n;){var i=13===e.charCodeAt(n-1)?n-2:n-1;if(i<t||92!==e.charCodeAt(i))return n;n=e.indexOf("\n",n+1)}return r},e._findInlineWhitespace=function(e){for(var t=0;t<e.length;){var r=e.charCodeAt(t);if(32===r||9===r)break;t++}return t},e._pushText=function(e,r,n,i,a){if(!(n>=i)){var o=e.length>0?e[e.length-1]:null,s=void 0===a?t.ShaderPreprocessorDirective.Text:t.ShaderPreprocessorDirective.OwnedText;o&&o[0]===s&&(void 0===a||o.length===a.length+2&&a.every(function(e,t){return o[t+2]===e}))?o[1]+=r.substring(n,i):e.push(void 0===a?[s,r.substring(n,i)]:[].concat([s,r.substring(n,i)],a))}},e._backfillJump=function(e,r,n){void 0===n&&(n=!1);var i=e[0];i===t.ShaderPreprocessorDirective.IfDef||i===t.ShaderPreprocessorDirective.IfNdef?n&&-1!==e[2]||(e[2]=r):i===t.ShaderPreprocessorDirective.IfCmp?n&&-1!==e[4]||(e[4]=r):i!==t.ShaderPreprocessorDirective.IfExpr||n&&-1!==e[2]||(e[2]=r)},e._stripLineComment=function(e){var t=e.indexOf("//");return t>=0?e.substring(0,t).trimEnd():e},e}();ro._DIRECTIVE_RE=/^[ \t]*#[ \t]*(if|ifdef|ifndef|elif|else|endif|define|undef)\b(.*)/,ro._FUNC_MACRO_RE=/^(\w+)\(([^)]*)\)\s*(.*)/;var rs=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t._globalCodeArray=[],t._forwardFunctionDeclarations=new Map,t._forwardStructIndices=new Map,t._structCodeSegments=new Map,t._forwardVariableIndices=new Map,t._variableCodeSegments=new Map,t._declarationOwners=new Map,t._deferredPrototypes=new Map,t._declarationReferences=new Map,t._outerMacroDeclarations=[],t}t5(t,e);var r,i=t.prototype;return i.reset=function(){this._globalCodeArray.length=0,this._forwardFunctionDeclarations.clear(),this._forwardStructIndices.clear(),this._structCodeSegments.clear(),this._forwardVariableIndices.clear(),this._variableCodeSegments.clear(),this._deferredPrototypes.clear(),this._declarationReferences.clear(),this._currentDeclaration=void 0},i.dispose=function(){this.context.reset(),this.reset()},i.getOtherGlobal=function(e,t){for(var r,n=rr(e.globalPrecisions);!(r=n()).done;){var i=r.value;t.push({text:i.codeGen(this),index:i.location.start.index})}},i.generate=function(e,t){var r=this;this.context.reset(),this.reset();var n=e.program.shaderData,i=this.context;i._passSymbolTable=n.symbolTable;var a=t.outerGlobalMacroDeclarations,o=t.io;(u=i.attributeStructs).push.apply(u,[].concat(o.attributeStructs)),(l=i.attributeList).push.apply(l,[].concat(o.attributeList)),(h=i.varyingStructs).push.apply(h,[].concat(o.varyingStructs)),(d=i.varyingList).push.apply(d,[].concat(o.varyingList)),(p=i.mrtStructs).push.apply(p,[].concat(o.mrtStructs)),(f=i.mrtList).push.apply(f,[].concat(o.mrtList)),i.registerStructTypes(tO.Attribute,o.attributeStructs),i.registerStructTypes(tO.Varying,o.varyingStructs),i.registerStructTypes(tO.Mrt,o.mrtStructs),o.structVariableRoles.forEach(function(e,t){return i.registerStructVar(t,e)}),o.vertexStructVariableRoles.forEach(function(e,t){i.registerStructVar(t,e,eG.VERTEX)}),o.fragmentStructVariableRoles.forEach(function(e,t){i.registerStructVar(t,e,eG.FRAGMENT)}),this._sourceIR=e,this._outerMacroDeclarations=a;try{if(t.deferredDeclarationOwnership.forEach(function(e,t){return r._declarationOwners.set(t.astNode,e)}),this._declarationOwners.size){var s=0,c=0;this._declarationOwners.forEach(function(e){s=Math.max(s,e.id),c=Math.max(c,e.group)}),n.symbolTable.forEach(function(e){e.astNode&&!r._declarationOwners.has(e.astNode)&&r._declarationOwners.set(e.astNode,{id:++s,group:++c,sourceScope:e.sourceScope})}),i.onReferenceGlobal=function(e){for(var t,n,i,a=null!=(n=null==(t=r.currentDeclarationOwner)?void 0:t.id)?n:0,o=rr(e);!(i=o()).done;){var s=i.value;r._referenceDeclaration(a,s.astNode)}};for(var u,l,h,d,p,f,_,v=new Map,m=rr([].concat(o.attributeStructs,o.varyingStructs,o.mrtStructs));!(_=m()).done;)for(var g,y=_.value,S=rr(y.propList);!(g=S()).done;){var b=g.value;v.set(b,y)}i.onReferenceStructProps=function(e){for(var t,n,i,a=null!=(n=null==(t=r.currentDeclarationOwner)?void 0:t.id)?n:0,o=rr(e);!(i=o()).done;){var s=i.value;r._referenceDeclaration(a,v.get(s))}}}if(t.unsupportedDeferredDeclarations.length)throw tV(new eu(el.CompilationError,"Deferred inheritance requires exact signatures and cannot resolve a known partial-coverage conflict.",t.unsupportedDeferredDeclarations[0].astNode.location,e.source,void 0,"UnsupportedDeferredDeclaration"),e.source,e.sourceMap);return{vertex:this._vertexMain(t.vertexEntry,n,a),fragment:this._fragmentMain(t.fragmentEntry,n,a)}}finally{this._sourceIR=void 0,this._outerMacroDeclarations=[],this._declarationOwners.clear(),i.onReferenceGlobal=void 0,i.onReferenceStructProps=void 0}},i._vertexMain=function(e,t,r){var n=this.context;n.stage=eG.VERTEX,n.stageEntry=e.name,this._preRegisterGlobalMacroRefs(r);var i=this._globalCodeArray;n.referenceGlobal(e.name,eZ.FN),this._getGlobalSymbol(i),this._getCustomStruct(n.attributeStructs,i),this._getCustomStruct(n.varyingStructs,i),this._getGlobalMacroDeclarations(r,i),this.getOtherGlobal(t,i),this._emitDeclarationReferences(i);var a=i.sort(function(e,t){return e.index-t.index}).map(function(e){return e.text}).join("\n");return n.reset(!1),this.reset(),a},i._fragmentMain=function(e,t,r){var n=this,i=this.context;i.stage=eG.FRAGMENT,i.stageEntry=e.name,this.prepareFragment(e,r),e.functions.forEach(function(e){var t=e.astNode.protoType.returnType,r=t.type===U.VEC4?"color":t.typeSpecifier.structDeclarations.some(function(e){return i.hasStructRole(e,tO.Mrt)})?"mrt":void 0;if(r){var a=e.astNode.statements;n._registerFragmentReturns(a,r,e4.lastStatement(a))}}),this._preRegisterGlobalMacroRefs(r);var a=this._globalCodeArray;i.referenceGlobal(e.name,eZ.FN),this._getGlobalSymbol(a),this._getCustomStruct(i.varyingStructs,a),this._getCustomStruct(i.mrtStructs,a),this._getGlobalMacroDeclarations(r,a),this.getOtherGlobal(t,a),this._emitDeclarationReferences(a);var o=a.sort(function(e,t){return e.index-t.index}).map(function(e){return e.text}).join("\n");return i.reset(),this.reset(),o},i.prepareFragment=function(e,t){},i._preRegisterGlobalMacroRefs=function(e){for(var t,r=rr(e);!(t=r()).done;){var n=t.value;this._walkMacroDefineTokens(n.children)}},i._walkMacroDefineTokens=function(e){for(var t,r=rr(e);!(t=r()).done;){var i=t.value;if(n(i,tn.MacroDefine))i.valueExpression&&i.valueExpression.codeGen(this);else if(n(i,tr)){var a=this._currentDeclaration;n(i,tn.FunctionDefinition)&&(this._currentDeclaration=i),this._walkMacroDefineTokens(i.children),this._currentDeclaration=a}}},i._registerFragmentReturns=function(e,t,r){if(n(e,tn.JumpStatement)&&3===e.children.length){this.context.registerFragmentReturn(e,t),e===r&&this.context.registerTerminalInterfaceReturn(e);return}for(var i,a=rr(e.children);!(i=a()).done;){var o=i.value;n(o,tr)&&this._registerFragmentReturns(o,t,r)}},i._getGlobalSymbol=function(e){for(var t,r=this.context,i=rr(r._referencedGlobalSymbols);!(t=i()).done;){var a=t.value;this._currentDeclaration=a.astNode;var o=a.astNode.codeGen(this);if(this._currentDeclaration=void 0,o){var s=o+(a.type===eZ.VAR?";":"");if(!a.isInMacroBranch){var c={text:this._declaration(s,a.astNode),index:a.astNode.location.start.index};e.push(c),n(a.astNode,tn.StructSpecifier)&&this._structCodeSegments.set(a.astNode,c),n(a.astNode,tn.VariableDeclaration)&&this._variableCodeSegments.set(a.astNode,c)}}}this._getForwardDeclarations(e);for(var u,l=rr(this._deferredPrototypes.values());!(u=l()).done;){var h=u.value;e.push(h)}for(var d,p=rr(this._forwardFunctionDeclarations);!(d=p()).done;){var f=d.value,_=f[0],v=f[1];_.isInMacroBranch||e.push({text:v,index:_.location.start.index})}},i.referenceFunction=function(t,r,i){var a=this;e.prototype.referenceFunction.call(this,t,r,i);var o=t.astNode,s=this._forwardFunctionDeclarations;if(t.ident!==this.context.stageEntry){var c=this.context._referencedGlobals[t.ident].filter(function(e){return n(e,e0)&&e.equal(t)}),u=this._declarationOwners.get(o);if(u){for(var l,h,d=rr(c);!(h=d()).done;)l=this,function(){var e=h.value.astNode,t=l._declarationOwners.get(e);if(t&&t.group===u.group&&!(t.sourceScope<=u.sourceScope)&&!(e.location.start.index<=r)){var n=e.protoType,i=o.location.start.index,a=l._deferredPrototypes.get(e);if(!a||!(a.index<=i)){(!l._isContextIndependent(n)||l._hasDeclarationContextBarrier(i,n.location.start.index,!1))&&l._unsupportedForwardDeclaration(n);var s=l._outerMacroDeclarations.find(function(e){return e.location.start.index<=i&&e.location.end.index>=o.location.end.index}),c=null!=(d=null==s?void 0:s.location.start.index)?d:i;l._prepareForwardTypes(n.returnType.typeSpecifier.structDeclarations,i,c);for(var d,p,f,_=rr(null!=(p=n.parameterList)?p:[]);!(f=_()).done;){var v,m,g=f.value;l._prepareForwardTypes(null!=(m=null==(v=g.typeInfo)?void 0:v.structDeclarations)?m:[],i,c)}l._deferredPrototypes.set(e,{text:l._declaration(""+n.codeGen(l)+";",e,!1),index:c})}}}();return}if(!c.some(function(e){return e.astNode===o})){var p=c.filter(function(e){return a._canBranchesOverlap(e.branchSignature,i)});if(!eN(p.filter(function(e){return e.astNode.location.start.index<r}).map(function(e){return e.branchSignature}),i)){var f=p.find(function(e){return e.astNode.location.start.index>r});if(f){for(var _,v=f.astNode.protoType,m=o.location.start.index,g=""+v.codeGen(this)+";",y=this._getForwardSignature(v),S=rr(c);!(_=S()).done;){var b=_.value;this._canBranchesOverlap(b.branchSignature,t.branchSignature)&&this._getForwardSignature(b.astNode.protoType)!==y&&this._unsupportedForwardDeclaration(b.astNode.protoType)}if(s.has(o))return;(!this._isContextIndependent(v)||this._hasDeclarationContextBarrier(m,v.location.start.index,!1))&&this._unsupportedForwardDeclaration(v);var x=this._outerMacroDeclarations.find(function(e){return e.location.start.index<=m&&e.location.end.index>=o.location.end.index}),E=null!=(C=null==x?void 0:x.location.start.index)?C:m;this._prepareForwardTypes(v.returnType.typeSpecifier.structDeclarations,m,E);for(var C,A,T,O=rr(null!=(A=v.parameterList)?A:[]);!(T=O()).done;){var I,R,M=T.value;n(M.astNode,tn.ParameterDeclaration)&&M.astNode.symbol&&this.context.getStructVarRole([M.astNode.symbol])||this._prepareForwardTypes(null!=(R=null==(I=M.typeInfo)?void 0:I.structDeclarations)?R:[],m,E)}s.set(o,g)}}}}},i._getForwardSignature=function(e){for(var t,r,i,a=[],o=rr(null!=(r=e.parameterList)?r:[]);!(i=o()).done;)t=this,function(){var e=i.value,r=e.astNode;if(!(n(r,tn.ParameterDeclaration)&&r.symbol&&t.context.getStructVarRole([r.symbol]))){var o=[],s=function(t){n(t,Y)?t!==e.ident&&t.type!==U.IN&&o.push(t.lexeme):t.children.forEach(s)};s(r);var c=o.join(" ");"void"!==c&&a.push(c)}}();return e.returnType.codeGen(this)+"("+a.join(",")+")"},i._canBranchesOverlap=function(e,t){return"exclusive"!==X(e,t)&&!eN([],[].concat(e,t))},i.visitVariableIdentifier=function(t){for(var r,i,a=e.prototype.visitVariableIdentifier.call(this,t),o=rr(t.resolvedSymbols());!(i=o()).done;)r=this,function(){var e=i.value;if(n(e,e2)&&e.isUniform){var a=null==(c=r.context._referencedGlobals[e.ident])?void 0:c.filter(function(e){return n(e,e2)}),o=r._declarationOwners.get(e.astNode);if(!(!a||!o&&a.includes(e))){var s=a.filter(function(e){return e.astNode.location.start.index<t.location.start.index});if(!(!o&&eN(s.map(function(e){return e.branchSignature}),t._branch)))for(var c,u,l,h=r._outerMacroDeclarations.find(function(t){return t.location.start.index<=e.astNode.location.start.index&&t.location.end.index>=e.astNode.location.end.index}),d=null!=(u=null==h?void 0:h.location.start.index)?u:e.astNode.location.start.index,p=rr(a);!(l=p()).done;)(function(){var e,i,a=l.value;if(!(a.astNode.location.start.index<=t.location.start.index)){if(o){var s=r._declarationOwners.get(a.astNode);if(!s||s.group!==o.group||s.sourceScope<=o.sourceScope)return}var c=a.astNode;n(a,e2)&&a.isUniform&&n(c,tn.VariableDeclaration)||r._unsupportedForwardDeclaration(c);var u=r._outerMacroDeclarations.find(function(e){return e.location.start.index<=c.location.start.index&&e.location.end.index>=c.location.end.index});(!r._isContextIndependent(c)||r._hasDeclarationContextBarrier(d,null!=(e=null==u?void 0:u.location.end.index)?e:c.location.end.index,!0))&&r._unsupportedForwardDeclaration(c),r._prepareForwardTypes(a.dataType.structDeclarations,d),r._forwardVariableIndices.set(c,Math.min(null!=(i=r._forwardVariableIndices.get(c))?i:1/0,d))}})()}}}();return a},i._getForwardDeclarations=function(e){for(var t,r,i=this,a=new Map,o=Array.from(this._forwardStructIndices),s=rr(this._forwardVariableIndices);!(r=s()).done;){var c=r.value;o.push(c)}for(var u,l=function(e){return i._declaration(e.codeGen(i)+(n(e,tn.VariableDeclaration)?";":""),e,!1)},h=rr(o);!(u=h()).done;)t=this,function(){var r=u.value,i=r[0],o=r[1],s=t._declarationOwners.get(i),c=t._outerMacroDeclarations.find(function(e){return e.location.start.index<=i.location.start.index&&e.location.end.index>=i.location.end.index});if(c){if(s)e.push({text:l(i),index:o});else{var h=a.get(c);h||a.set(c,h={index:o,declarations:[]}),h.index=Math.min(h.index,o),h.declarations.push(i)}}else{var d=n(i,tn.StructSpecifier)?t._structCodeSegments.get(i):t._variableCodeSegments.get(i);d&&(s?d.text=t._declaration("",i):e.splice(e.indexOf(d),1)),e.push({text:l(i),index:o})}}();for(var d,p=rr(a);!(d=p()).done;){for(var f,_=d.value,v=_[0],m=_[1],g=v.macroExpressions.map(function(e){return{text:n(e,Y)?e.lexeme:e.codeGen(i),index:e.location.start.index}}),y=rr(m.declarations);!(f=y()).done;){var S=f.value;g.push({text:l(S),index:S.location.start.index})}e.push({text:g.sort(function(e,t){return e.index-t.index}).map(function(e){return e.text}).join("\n"),index:m.index})}},i.visitTypeSpecifier=function(t){var r=this,i=n(t.parent,tn.FunctionIdentifier)?t.parent.parent:void 0;if(n(i,tn.FunctionCallGeneric)&&n(i.fnSymbol,e0))return e.prototype.visitTypeSpecifier.call(this,t);for(var a,o,s=rr(t.structDependencies);!(o=s()).done;)a=this,function(){var e,t=o.value;if(!(!t.ident||a.context.getStructRole([t]))){for(var i=t.parent;i&&!n(i,tn.GlobalDeclaration)&&!n(i,tn.FunctionDefinition);)i=i.parent;if(!n(i,tn.FunctionDefinition)){a.context.referenceGlobal(t.ident.lexeme,eZ.STRUCT);var s=a.context._referencedGlobals[t.ident.lexeme],c=a._declarationOwners.get(t);if(!(!c&&s.some(function(e){return e.astNode===t}))){var u=a._outerMacroDeclarations.find(function(e){return e.location.start.index<=t.location.start.index&&e.location.end.index>=t.location.end.index});a._prepareForwardTypes(s.filter(function(e){if(!c)return!0;var t=r._declarationOwners.get(e.astNode);return(null==t?void 0:t.group)===c.group&&t.sourceScope>c.sourceScope}).map(function(e){return e.astNode}).filter(function(e){return n(e,tn.StructSpecifier)}),null!=(e=null==u?void 0:u.location.start.index)?e:t.location.start.index)}}}}();return e.prototype.visitTypeSpecifier.call(this,t)},i._prepareForwardTypes=function(e,t,r){var i;if(void 0===r&&(r=t),!this.context.getStructRole(e))for(var a,o=rr(e);!(a=o()).done;)i=this,function(){var e=a.value;if(!((null!=(u=i._forwardStructIndices.get(e))?u:1/0)<=t)){if(e.ident){i.context.referenceGlobal(e.ident.lexeme,eZ.STRUCT);var o=i.context._referencedGlobals[e.ident.lexeme];if(!o.some(function(t){return t.astNode===e}))return i._prepareForwardTypes(o.map(function(e){return e.astNode}).filter(function(e){return n(e,tn.StructSpecifier)}),t,r)}var s=e.location.start.index>t,c=i._outerMacroDeclarations.find(function(t){return t.location.start.index<=e.location.start.index&&t.location.end.index>=e.location.end.index});s&&(!i._isContextIndependent(e)||i._hasDeclarationContextBarrier(r,null!=(l=null==c?void 0:c.location.end.index)?l:e.location.end.index,!0))&&i._unsupportedForwardDeclaration(e);for(var u,l,h,d=s?r:e.location.start.index,p=rr(e.propList);!(h=p()).done;){var f=h.value;i._prepareForwardTypes(f.typeInfo.structDeclarations,d)}s&&i._forwardStructIndices.set(e,r)}}()},i._isContextIndependent=function(e){var t=this;return!(n(e,tn.VariableIdentifier)||n(e,tn.MacroCallSymbol)||n(e,tn.MacroCallFunction)||n(e,tn.TypeSpecifier)&&e.isCustom&&!e.structDeclarations.length)&&e.children.every(function(e){return n(e,tr)?t._isContextIndependent(e):e.type<U.MACRO_IF||e.type>U.MACRO_DEFINE_PARAMS})},i._hasDeclarationContextBarrier=function(e,t,r){var i=function(a,o){return void 0===o&&(o=!1),!(a.location.end.index<=e)&&!(a.location.start.index>=t)&&(!!(n(a,tn.PrecisionSpecifier)&&!o||r&&n(a,tn.MacroDefine))||(o||(o=n(a,tn.FunctionDefinition)),a.children.some(function(a){return n(a,tr)?i(a,o):r&&a.location.start.index>e&&a.location.start.index<t&&(a.type===U.MACRO_UNDEF||a.type===U.MACRO_DEFINE_EXPRESSION)})))};return i(this._sourceIR.program)},i._unsupportedForwardDeclaration=function(e){var t=this._sourceIR;throw tV(new eu(el.CompilationError,"Inherited declarations require incompatible forward signatures or depend on a later macro or precision context.",e.location,t.source,void 0,"UnsupportedForwardDeclaration"),t.source,t.sourceMap)},i._getCustomStruct=function(e,t){for(var r,n=rr(e);!(r=n()).done;){var i=r.value,a=i.codeGen(this);i.isInMacroBranch||t.push({text:this._declaration(a,i),index:i.location.start.index})}},i._getGlobalMacroDeclarations=function(e,t){var r=this,i=this.context,a=i._referencedGlobalMacroASTs;a.length=0;for(var o,s=rr(i._referencedGlobalSymbols);!(o=s()).done;){var c=o.value;c.isInMacroBranch&&a.push(c.astNode)}for(var u,l=rr(e);!(u=l()).done;){var h=u.value,d=void 0,p=h.children[0];if(n(p,tn.GlobalMacroIfStatement)){var f=[];f.push.apply(f,[].concat(h.macroExpressions.map(function(e){return{text:n(e,Y)?e.lexeme:e.codeGen(r),index:e.location.start.index}}))),this._visitGlobalMacroIfStatement(p,f),d=f.sort(function(e,t){return e.index-t.index}).map(function(e){return e.text}).join("\n")}else d=n(p,Y)&&p.type===U.MACRO_DEFINE_EXPRESSION?p.lexeme:h.codeGen(this);t.push({text:d,index:h.location.start.index})}},i._visitGlobalMacroIfStatement=function(e,t){for(var r=e.children,i=0;i<r.length;i++){var a=r[i];if(n(a,tn.PrecisionSpecifier))t.push({text:a.codeGen(this),index:a.location.start.index});else if(n(a,tn.FunctionDefinition)){var o=-1!==this.context._referencedGlobalMacroASTs.indexOf(a)?this.getCachedCode(a):this._forwardFunctionDeclarations.get(a);void 0!==o&&t.push({text:this._declaration(o,a),index:a.location.start.index})}else if(n(a,tn.StructSpecifier)){if(this._forwardStructIndices.has(a)){var s,c=this._declaration("",a);c&&t.push({text:c,index:a.location.start.index});continue}var u=this.context,l=u.stage;(-1!==u._referencedGlobalMacroASTs.indexOf(a)||(l===eG.VERTEX?u.hasStructRole(a,tO.Attribute)||u.hasStructRole(a,tO.Varying):u.hasStructRole(a,tO.Varying)||u.hasStructRole(a,tO.Mrt)))&&t.push({text:this._declaration(null!=(s=this.getCachedCode(a))?s:"",a),index:a.location.start.index})}else if(n(a,tn.VariableDeclarationList))for(var h=a.variableDeclarations,d=0;d<h.length;d++){var p,f=h[d];-1!==this.context._referencedGlobalMacroASTs.indexOf(f)&&t.push({text:this._declaration(this._forwardVariableIndices.has(f)?"":""+(null!=(p=this.getCachedCode(f))?p:"")+";",f),index:f.location.start.index})}n(a,tr)&&this._visitGlobalMacroIfStatement(a,t)}},i._referenceDeclaration=function(e,t){var r=this._declarationOwners.get(t);if(r){var n=this._declarationReferences.get(e);n||this._declarationReferences.set(e,n=new Set),n.add(r.id)}},i._emitDeclarationReferences=function(e){for(var t,r=rr(this._declarationReferences);!(t=r()).done;)for(var n,i=t.value,a=i[0],o=i[1],s=rr(o);!(n=s()).done;){var c=n.value;e.push({text:ro.reference(a,c),index:-1})}},i._declaration=function(e,t,r){return void 0===r&&(r=!0),ro.declaration(e,this._declarationOwners.get(t),r)},r=[{key:"currentDeclarationOwner",get:function(){return this._currentDeclaration&&this._declarationOwners.get(this._currentDeclaration)}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,r),t}(ra),rc=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}t5(t,e);var r=t.prototype;return r.getAttributeProp=function(e){return"attribute "+e.typeInfo.typeLexeme+" "+e.ident.lexeme+";"},r.getVaryingProp=function(e){return"varying "+e.typeInfo.typeLexeme+" "+e.ident.lexeme+";"},r.getMRTProp=function(){return""},r.visitPostfixExpression=function(t){var r,i=t.children,a=i[0],o=this.context,s=n(a,tn.PostfixExpression)?e4.unwrapBareIdentifier(a,{allowParens:!0}):void 0,c=null!=(r=null==s?void 0:s.resolvedValueSymbols())?r:[],u=n(a,tn.PostfixExpression)?e4.extractDirectIdentLexeme(a):null;if((s?c.length?o.getStructVarRole(c):u?o.getUnresolvedStructVarRole(u):void 0:void 0)===tO.Mrt){var l=i[2],h=o.mrtList.find(function(e){return e.ident.lexeme===l.lexeme});return h?"gl_FragData["+h.mrtIndex+"]":""}return e.prototype.visitPostfixExpression.call(this,t)},r.visitJumpStatement=function(t){var r=this.context.getFragmentReturnMode(t),n=this.context.isTerminalInterfaceReturn(t);if("mrt"===r)return n?"":"return;";if("color"===r){var i="gl_FragColor = "+t.children[1].codeGen(this)+";";return n?i:"{ "+i+" return; }"}return e.prototype.visitJumpStatement.call(this,t)},t}(rs),ru="GS_glFragColor",rl="GS_glFragData",rh=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t._outputDeclarations=new Map,t._fragDataArrayRequired=!1,t._fragDataIndices=new Map,t._scannedFragmentFunctions=new Set,t}t5(t,e);var r=t.prototype;return r.reset=function(){e.prototype.reset.call(this),this._outputDeclarations.clear(),this._fragDataArrayRequired=!1,this._fragDataIndices.clear(),this._scannedFragmentFunctions.clear()},r.getOtherGlobal=function(t,r){e.prototype.getOtherGlobal.call(this,t,r);for(var n,i=rr(this._outputDeclarations.values());!(n=i()).done;){var a=n.value;r.push({text:a.unconditional?a.text:ro.sharedDeclaration(a.text,Array.from(a.owners.values())),index:-1})}},r.getAttributeProp=function(e){return"in "+e.typeInfo.typeLexeme+" "+e.ident.lexeme+";"},r.getVaryingProp=function(e){return(this.context.stage===eG.FRAGMENT?"in":"out")+" "+e.typeInfo.typeLexeme+" "+e.ident.lexeme+";"},r.getMRTProp=function(e){return"layout(location = "+e.mrtIndex+") out vec4 "+e.ident.lexeme+";"},r.visitFunctionIdentifier=function(t){var r=t.children[0];if(1!==r.children.length||r.structDependencies.length)return e.prototype.visitFunctionIdentifier.call(this,t);var n=t.lexeme;switch(t.ident){case"texture2D":case"textureCube":n="texture";break;case"texture2DProj":n="textureProj";break;case"texture2DLodEXT":case"textureCubeLodEXT":n="textureLod";break;case"texture2DGradEXT":case"textureCubeGradEXT":n="textureGrad";break;case"texture2DProjLodEXT":n="textureProjLod";break;case"texture2DProjGradEXT":n="textureProjGrad"}return n},r.visitVariableIdentifier=function(t){var r=this.context;return r.stage===eG.FRAGMENT&&t.builtinSemantic===eQ.FragmentOutput0?(this._registerFragColorVariable(),ru):r.stage===eG.FRAGMENT&&t.builtinSemantic===eQ.FragmentDepth?"gl_FragDepth":r.stage===eG.FRAGMENT&&t.builtinSemantic===eQ.FragmentOutputArray?(this._registerFragDataArray(),rl):e.prototype.visitVariableIdentifier.call(this,t)},r.visitPostfixExpression=function(t){if(!this._fragDataArrayRequired){var r=this._fragDataIndices.get(t);if(void 0!==r)return this._registerFragDataVariable(r)}return e.prototype.visitPostfixExpression.call(this,t)},r.visitJumpStatement=function(t){var r=this.context.getFragmentReturnMode(t),n=this.context.isTerminalInterfaceReturn(t);if("mrt"===r)return n?"":"return;";if("color"===r){this._registerFragColorVariable();var i=ru+" = "+t.children[1].codeGen(this)+";";return n?i:"{ "+i+" return; }"}return e.prototype.visitJumpStatement.call(this,t)},r._registerFragColorVariable=function(){this._registerOutput(ru,"out vec4 "+ru+";")},r._registerOutput=function(e,t){var r=this._outputDeclarations.get(e);r||this._outputDeclarations.set(e,r={text:t,owners:new Map,unconditional:!1});var n=this.currentDeclarationOwner;n?r.owners.set(n.id,n):r.unconditional=!0},r.prepareFragment=function(e,t){for(var r=e.functions.slice();r.length;){var n=r.pop();this._scannedFragmentFunctions.has(n)||(this._scannedFragmentFunctions.add(n),this._scanFragmentOutputs(n.astNode),r.push.apply(r,[].concat(n.calledFunctions)))}for(var i,a=rr(t);!(i=a()).done;){var o=i.value;this._scanFragmentOutputs(o)}},r._scanFragmentOutputs=function(e){if(n(e,tn.PostfixExpression)&&4===e.children.length){var t,r=e.children[0],i=e.children[2];if(n(r,tr)&&n(i,tr)&&(null==(t=e4.unwrapBareIdentifier(r,{allowParens:!0}))?void 0:t.builtinSemantic)===eQ.FragmentOutputArray){var a=e4.constIntegerValue(i);void 0===a||a<0?this._fragDataArrayRequired=!0:this._fragDataIndices.set(e,a),this._scanFragmentOutputs(i);return}}if(n(e,tn.VariableIdentifier)&&e.builtinSemantic===eQ.FragmentOutputArray){this._fragDataArrayRequired=!0;return}for(var o,s=rr(e.children);!(o=s()).done;){var c=o.value;n(c,tr)&&this._scanFragmentOutputs(c)}},r._registerFragDataArray=function(){this._registerOutput(rl,"layout(location = 0) out vec4 "+rl+"[gl_MaxDrawBuffers];")},r._registerFragDataVariable=function(e){var t=""+rl+e;return this._registerOutput(t,"layout(location = "+e+") out vec4 "+t+";"),t},t}(rs),rd=/*#__PURE__*/function(){function e(){}return e.generate=function(r,n,i){var a=new tZ(r,n);if(a.mrtOutputIssues.length||a.invalidMrtReturnLocations.length){t.Logger.error("MRT outputs require unique non-negative locations, vec4 members, and returns through an assigned struct variable.");return}if(a.invalidVaryingReturnLocations.length){t.Logger.error("Varying vertex entries must return a struct variable or same-type function result.");return}if(a.structMemberOwnerIssues.length){t.Logger.error("A struct member reference cannot be lowered safely across runtime macro expansion.");return}return i===t.ShaderLanguage.GLSLES100?e._generateWithPool(e._gles100VisitorPool,r,n):e._generateWithPool(e._gles300VisitorPool,r,n)},e._generateWithPool=function(e,r,i){var a=e.get();try{return a.generate(r,i)}catch(e){if(a.dispose(),!n(e,eu))throw e;t.Logger.error((e.file?""+e.file+": ":"")+(e.code?""+e.code+": ":"")+e.toString());return}finally{e.return(a)}},e}();rd._gles100VisitorPool=new t.ReturnableObjectPool(rc),rd._gles300VisitorPool=new t.ReturnableObjectPool(rh);var rp=/*#__PURE__*/function(e){function t(t){var r;return(r=e.call(this,t.map(function(e){return e.toString()}).join("\n"))||this).errors=t,r.name="ShaderSourceParseError",r}return t5(t,e),t}(re(Error));function rf(e,r,n,i,a){if(e.blockingErrors.length){for(var o,s=rr(e.blockingErrors);!(o=s()).done;){var c=o.value;t.Logger.error(c.toString())}return}if(e.ir){var u=null!=a?a:tI.create(e.ir,r,n);return function(e,r,n,i){if(!r.vertexEntry.functions.length){t.Logger.error("Vertex entry function '"+r.vertexEntry.name+"' not found.");return}if(!r.fragmentEntry.functions.length){t.Logger.error("Fragment entry function '"+r.fragmentEntry.name+"' not found.");return}if(r.vertexEntry.hasDefiniteAmbiguity){t.Logger.error("Vertex entry function '"+r.vertexEntry.name+"' resolves to multiple declarations.");return}if(r.fragmentEntry.hasDefiniteAmbiguity){t.Logger.error("Fragment entry function '"+r.fragmentEntry.name+"' resolves to multiple declarations.");return}if(r.roleConflicts.length){t.Logger.error("A shader IO struct cannot serve multiple stage-interface roles.");return}var a=rd.generate(e,r,n);return a&&(a.vertexShaderInstructions=ro.parse(a.vertex,i),a.fragmentShaderInstructions=ro.parse(a.fragment,i),a.vertex=ro.source(a.vertex),a.fragment=ro.source(a.fragment)),a}(e.ir,u,i,e.preprocessorExpressions)}}var r_=/*#__PURE__*/function(){function e(){this._includeMap={},this._chunkOutputCache=new Map,this._sourceParserObjectPool=new tJ,this._parserObjectPool=new tJ,this._runtimeParser=tz(this._parserObjectPool)}var t=e.prototype;return t._setIncludeMap=function(e){this._includeMap=function(e){if(!e)return Object.create(null);for(var t,r=Object.create(null),n=j(Object.keys(e));!(t=n()).done;){var i=t.value,a=F(i);if(Object.prototype.hasOwnProperty.call(r,a))throw Error('Shader include key collision after normalization: "'+i+'" resolves to "'+a+'".');r[a]=i}return new Proxy(Object.create(null),{get:function(t,n){if("string"==typeof n){var i=r[n];if(void 0!==i){var a=e[i];return"string"==typeof a?a:void 0}var o=e[n];return"string"==typeof o?o:void 0}}})}(e),this._chunkOutputCache.clear()},t._parseShaderSource=function(e){return this._chunkOutputCache.clear(),function(e){if(e.errors.length)throw new rp(e.errors);return e.shaderSource}(tQ.parseStrict(e,this._sourceParserObjectPool))},t._parseShaderPass=function(e,t,r,n,i,a){return rf(function(e,t,r,n,i,a,o){null==i||i.reset(),(null==o?void 0:o.some(function(e){return e>0}))||(o=void 0);var s=function(e){if(e){var t=e.trim().replace(/\\/g,"/");if(t)return t.startsWith(tg)?t===tg?void 0:F(t):ty.test(t)?new URL(t).href:F(t)}}(n),c=tA.parseWithErrors(e,s?ty.test(s)?new URL(s).href:new URL(s,tg).href:"",t,r,s,!1,o),u=c.content;if(c.errors.length){var l=tW(c.errors);return Object.freeze({ir:null,expandedSource:u,sourceMap:tB,preprocessorExpressions:tU,errors:l,blockingErrors:l})}var h={},d=new ez(u,h,i,c.conditionalArms),p=null!=a?a:tz(i);p.setSource(u),p.setSourceScopes(c.sourceScopes);var f=p.parse(d.tokenize(),h),_=tW(p.errors),v=tW(p.blockingErrors);return Object.freeze({ir:f?Object.freeze(new tT(f,u,tB)):null,expandedSource:u,sourceMap:tB,preprocessorExpressions:d.preprocessorExpressions,errors:_,blockingErrors:v})}(e,this._includeMap,this._chunkOutputCache,i,this._parserObjectPool,this._runtimeParser,a),t,r,n)},t.generate=function(e,t){var r=function(e){var t=tm.get(e);if(!t)throw TypeError("Invalid parsed shader pass handle.");return t}(e);return rf(r.data,r.vertexEntry,r.fragmentEntry,t,r.coreInfo)},e}(),rv="2.0.0-alpha.53";t.Logger.info("Galacean Engine Shader Compiler Version: "+rv),e.GSError=eu,e.GSErrorName=el,e.ShaderCompiler=r_,e.version=rv,Object.defineProperty(e,"__esModule",{value:!0})});
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@galacean/engine-core"),require("@galacean/engine-math")):"function"==typeof define&&define.amd?define(["exports","@galacean/engine-core","@galacean/engine-math"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).Galacean=e.Galacean||{},e.Galacean.ShaderCompiler={}),e.Galacean,e.Galacean)}(this,function(e,t,r){"use strict";function n(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function i(){return(i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function o(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return a(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return a(e,void 0)}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,c,u,l,h,d,p,f,_,v,m,g,y={"||":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"<":7,"<=":7,">":7,">=":7,"<<":8,">>":8,"+":9,"-":9,"*":10,"/":10,"%":10};function S(e){return new T(e).parse()}function b(e,t){for(var r=O(e),n=[],i=0;i<r.length-1;i++){var a=r[i];if("identifier"!==a.kind||"defined"!==a.text){n.push(a.text);continue}var o=r[i+1],s=(null==o?void 0:o.text)==="(",c=r[i+(s?2:1)],u=s?r[i+3]:c;if((null==c?void 0:c.kind)!=="identifier"||"defined"===c.text||s&&(null==u?void 0:u.text)!==")"){n.push(a.text);continue}var l=t(c.text);void 0===l?(n.push("defined"),s&&n.push("("),n.push(c.text),s&&n.push(")")):n.push(l?"1":"0"),i+=s?3:1}return n.join(" ")}function x(e){var t=R(e);return"number"==typeof t?t:void 0}var E="Division by zero in active preprocessor expression.",C="Modulo by zero in active preprocessor expression.",A="Shift count must be between 0 and 31 in active preprocessor expression.",T=/*#__PURE__*/function(){function e(e){this._index=0,this._sawExpandableIdentifier=!1,this._rightEdgeExpandable=!1,this._nestingDepth=0,this._tokens=O(e)}var t=e.prototype;return t.parse=function(){var e=this._parseRoot(),t=this._invalidResult();if(t)return t;var r=this._sawExpandableIdentifier?void 0:R(e);return i({ok:!0,condition:e,hasExpandableIdentifier:this._sawExpandableIdentifier},"string"==typeof r?{evaluationError:r}:void 0)},t._parseRoot=function(){var e=this._parseBinary(1);if(!this._failure){var t=this._current();if("end"!==t.kind){var r="identifier"===t.kind&&"defined"!==t.text;this._sawExpandableIdentifier||(this._sawExpandableIdentifier=r);var n="?"===t.text||":"===t.text||!this._rightEdgeExpandable&&!r&&!(")"===t.text&&this._sawExpandableIdentifier);this._fail("Unexpected token '"+t.text+"' in preprocessor expression.",t,n)}}return e},t._invalidResult=function(){if(this._failure)for(var e=this._index;e<this._tokens.length;e++){var t=this._tokens[e];if("identifier"===t.kind&&"defined"!==t.text){this._sawExpandableIdentifier=!0;break}}return this._failure?{ok:!1,error:this._failure,hasExpandableIdentifier:this._sawExpandableIdentifier}:void 0},t._parseBinary=function(e){var t=this._parseUnary();if(!this._failure&&t)for(;;){var r=this._current(),n=y[r.text];if(void 0===n||n<e)return t;this._index++;var i=this._parseBinary(n+1);if(this._failure||!i)return;t="&&"===r.text?{t:"and",l:t,r:i}:"||"===r.text?{t:"or",l:t,r:i}:{t:"binary",op:r.text,l:t,r:i}}},t._parseUnary=function(){var e=this._current();if("operator"===e.kind&&("+"===e.text||"-"===e.text||"!"===e.text||"~"===e.text)){if(!this._enterNesting(e))return;this._index++;var t=this._parseUnary();if(this._nestingDepth--,!t)return;return"!"===e.text?{t:"not",c:t}:{t:"unary",op:e.text,c:t}}return this._parsePrimary()},t._parsePrimary=function(){var e=this._current();if("number"===e.kind){this._index++,this._rightEdgeExpandable=!1;var t=function(e){for(var t,r=e.length;r>0&&N(e.charCodeAt(r-1));)r--;if(48===e.charCodeAt(0)){var n=e.charCodeAt(1);t=88===n||120===n?parseInt(e.slice(2,r),16):r>1?parseInt(e.slice(0,r),8):0}else t=Number(e.slice(0,r));return t<=0xffffffff?0|t:void 0}(e.text);if(void 0===t){this._fail("Integer literal exceeds 32 bits in preprocessor expression.",e,!0);return}return{t:"num",v:t}}if("identifier"===e.kind)return"defined"===e.text?this._parseDefined():(this._sawExpandableIdentifier=!0,this._rightEdgeExpandable=!0,this._index++,{t:"id",m:e.text});if(this._consume("(")){if(!this._enterNesting(e))return;var r=this._parseBinary(1);return this._failure||this._consume(")")||this._fail("Expected ')' in preprocessor expression.",this._current(),!1),this._failure||(this._rightEdgeExpandable=!1),this._nestingDepth--,r}"end"===e.kind?this._fail("Expected an operand before the end of the preprocessor expression.",e,!0):this._fail("Expected an operand, found '"+e.text+"'.",e,!0)},t._parseDefined=function(){this._index++,this._rightEdgeExpandable=!1;var e=this._consume("("),t=this._current();if("identifier"!==t.kind||"defined"===t.text){this._fail("Expected a macro name after 'defined'.",t,!0);return}if(this._index++,e&&!this._consume(")")){this._fail("Expected ')' after the macro name in 'defined(...)'.",this._current(),!0);return}return{t:"def",m:t.text}},t._consume=function(e){return this._current().text===e&&(this._index++,!0)},t._enterNesting=function(e){return this._nestingDepth>=256?(this._fail("Preprocessor expression nesting exceeds the supported depth of 256.",e,!0),!1):(this._nestingDepth++,!0)},t._current=function(){return this._tokens[this._index]},t._fail=function(e,t,r){null!=this._failure||(this._failure={message:e,start:t.start,end:Math.max(t.end,t.start+1),certain:r})},e}();function O(e){for(var t=[],r=0;r<e.length;){var n,i=e.charCodeAt(r);if(32===i||i>=9&&i<=13){r++;continue}if(47===i&&47===e.charCodeAt(r+1))break;if(47===i&&42===e.charCodeAt(r+1)){var a=e.indexOf("*/",r+2);a<0?(t.push({kind:"invalid",text:e.slice(r),start:r,end:e.length}),r=e.length):r=a+2;continue}if(D(i)){for(var o=r++;r<e.length&&L(e.charCodeAt(r));)r++;t.push({kind:"identifier",text:e.slice(o,r),start:o,end:r});continue}if(i>=48&&i<=57){var s,c=r;if(48===i&&(88===e.charCodeAt(r+1)||120===e.charCodeAt(r+1))){for(var u,l=r+=2;r<e.length&&((u=e.charCodeAt(r))>=48&&u<=57||u>=65&&u<=70||u>=97&&u<=102);)r++;if(r===l){t.push({kind:"invalid",text:e.slice(c,r),start:c,end:r});continue}}else if(48===i)for(r++;r<e.length&&e.charCodeAt(r)>=48&&55>=e.charCodeAt(r);)r++;else for(r++;r<e.length&&e.charCodeAt(r)>=48&&57>=e.charCodeAt(r);)r++;for(var h=r;N(e.charCodeAt(r));)r++;if(!(""===(s=e.slice(h,r))||"u"===s||"U"===s)||D(e.charCodeAt(r))){for(;L(e.charCodeAt(r));)r++;t.push({kind:"invalid",text:e.slice(c,r),start:c,end:r});continue}t.push({kind:"number",text:e.slice(c,r),start:c,end:r});continue}if(n=e.charCodeAt(r+1),124===i&&124===n||38===i&&38===n||(33===i||61===i)&&61===n||(60===i||62===i)&&(61===n||n===i)){t.push({kind:"operator",text:e.slice(r,r+2),start:r,end:r+2}),r+=2;continue}if(33===i||37===i||38===i||40===i||41===i||42===i||43===i||45===i||47===i||58===i||60===i||62===i||63===i||94===i||124===i||126===i){t.push({kind:"operator",text:e[r],start:r,end:r+1}),r++;continue}t.push({kind:"invalid",text:e[r],start:r,end:r+1}),r++}return t.push({kind:"end",text:"",start:r,end:r}),t}function I(e,t,r){switch(t){case"||":return 0!==e||0!==r?1:0;case"&&":return 0!==e&&0!==r?1:0;case"|":return e|r;case"^":return e^r;case"&":return e&r;case"==":return e===r?1:0;case"!=":return e!==r?1:0;case"<":return e<r?1:0;case"<=":return e<=r?1:0;case">":return e>r?1:0;case">=":return e>=r?1:0;case"<<":if(r<0||r>31)return A;return e<<r;case">>":if(r<0||r>31)return A;return e>>>r|0;case"+":return e+r|0;case"-":return e-r|0;case"*":return Math.imul(e,r);case"/":if(0===r)return E;if(-0x80000000===e&&-1===r)return 0x7fffffff;return 0|Math.trunc(e/r);case"%":if(0===r)return C;return e%r|0;default:throw Error("Unsupported preprocessor operator '"+t+"'.")}}function R(e,t){switch(e.t){case"and":var r=R(e.l,t);if("string"==typeof r)return r;if(0===r)return 0;var n=R(e.r,t);if("string"==typeof n)return void 0===r?void 0:n;if(0===n)return 0;return void 0===r||void 0===n?void 0:1;case"or":var i=R(e.l,t);if("string"==typeof i)return i;if(void 0!==i&&0!==i)return 1;var a=R(e.r,t);if("string"==typeof a)return void 0===i?void 0:a;if(void 0!==a&&0!==a)return 1;return void 0===i||void 0===a?void 0:0;case"binary":var o,s=R(e.l,t),c=R(e.r,t);if("string"==typeof s)return s;if("string"==typeof c)return c;var u=("/"===(o=e.op)||"%"===o)&&0===c?"/"===o?E:C:("<<"===o||">>"===o)&&void 0!==c&&(c<0||c>31)?A:void 0;if(u)return u;if(void 0===s||void 0===c)return t?function(e,t,r){if(P(e.op)){if("id"===e.l.t&&void 0===t&&void 0!==r)return M(e.op,r);if("id"===e.r.t&&void 0===r&&void 0!==t)return M(function(e){switch(e){case"<":return">";case"<=":return">=";case">":return"<";case">=":return"<=";default:return e}}(e.op),t)}}(e,s,c):void 0;return I(s,e.op,c);case"not":var l=R(e.c,t);if("string"==typeof l)return l;return void 0===l?void 0:0===l?1:0;case"unary":var h=R(e.c,t);if("string"==typeof h)return h;if(void 0===h)return;return"+"===e.op?0|h:"-"===e.op?0|-h:~h;case"bool":return e.v?1:0;case"num":return e.v;case"def":var d=null==t?void 0:t.isDefined(e.m);return void 0===d?void 0:d?1:0;case"ndef":var p=null==t?void 0:t.isDefined(e.m);return void 0===p?void 0:p?0:1;case"cmp":var f=null==t?void 0:t.resolveIdentifier(e.m);if(null==f?void 0:f.error)return f.error;var _=null==f?void 0:f.value;if(void 0===_)return t?M(e.op,e.v):void 0;var v=I(_,e.op,e.v);return"string"==typeof v?void 0:v;case"id":var m=null==t?void 0:t.resolveIdentifier(e.m);return(null==m?void 0:m.error)?m.error:null==m?void 0:m.value;case"deferred":return}}function M(e,t){if(P(e)&&"=="!==e&&"!="!==e){var r=I(-0x80000000,e,t),n=I(0x7fffffff,e,t);return"number"==typeof r&&r===n?r:void 0}}function P(e){return"=="===e||"!="===e||"<"===e||"<="===e||">"===e||">="===e}function D(e){return e>=65&&e<=90||e>=97&&e<=122||95===e}function L(e){return D(e)||e>=48&&e<=57}function N(e){return 85===e||117===e}var k="shaders://root/",V=/^[A-Za-z][A-Za-z\d+.-]*:/;function F(e){var t=e.trim().replace(/\\/g,"/");if(!t)throw Error("Shader include key cannot be empty.");if(t.startsWith(k)){var r=new URL(t).href.slice(k.length);if(!r)throw Error("Shader include key cannot be the virtual shader root.");return r}return V.test(t)?new URL(t).href:new URL(t.replace(/^\/+/,""),k).href.slice(k.length)}var w=function(){function e(){}return e.prototype.set=function(e,t){this.start=e,this.end=t},e}(),G=function(){function e(){}return e.prototype.set=function(e,t,r){this.index=e,this.line=t,this.column=r},e}(),B=((s={})[s.ID=1e3]="ID",s[s.FLOAT_CONSTANT=1001]="FLOAT_CONSTANT",s[s.INT_CONSTANT=1002]="INT_CONSTANT",s[s.STRING_CONST=1003]="STRING_CONST",s[s.LEFT_OP=1004]="LEFT_OP",s[s.RIGHT_OP=1005]="RIGHT_OP",s[s.INC_OP=1006]="INC_OP",s[s.DEC_OP=1007]="DEC_OP",s[s.LE_OP=1008]="LE_OP",s[s.GE_OP=1009]="GE_OP",s[s.EQ_OP=1010]="EQ_OP",s[s.NE_OP=1011]="NE_OP",s[s.AND_OP=1012]="AND_OP",s[s.OR_OP=1013]="OR_OP",s[s.XOR_OP=1014]="XOR_OP",s[s.MUL_ASSIGN=1015]="MUL_ASSIGN",s[s.DIV_ASSIGN=1016]="DIV_ASSIGN",s[s.ADD_ASSIGN=1017]="ADD_ASSIGN",s[s.SUB_ASSIGN=1018]="SUB_ASSIGN",s[s.MOD_ASSIGN=1019]="MOD_ASSIGN",s[s.LEFT_ASSIGN=1020]="LEFT_ASSIGN",s[s.RIGHT_ASSIGN=1021]="RIGHT_ASSIGN",s[s.AND_ASSIGN=1022]="AND_ASSIGN",s[s.XOR_ASSIGN=1023]="XOR_ASSIGN",s[s.OR_ASSIGN=1024]="OR_ASSIGN",s[s.LEFT_PAREN=1025]="LEFT_PAREN",s[s.RIGHT_PAREN=1026]="RIGHT_PAREN",s[s.LEFT_BRACKET=1027]="LEFT_BRACKET",s[s.RIGHT_BRACKET=1028]="RIGHT_BRACKET",s[s.LEFT_BRACE=1029]="LEFT_BRACE",s[s.RIGHT_BRACE=1030]="RIGHT_BRACE",s[s.DOT=1031]="DOT",s[s.COMMA=1032]="COMMA",s[s.COLON=1033]="COLON",s[s.EQUAL=1034]="EQUAL",s[s.SEMICOLON=1035]="SEMICOLON",s[s.BANG=1036]="BANG",s[s.DASH=1037]="DASH",s[s.TILDE=1038]="TILDE",s[s.PLUS=1039]="PLUS",s[s.STAR=1040]="STAR",s[s.SLASH=1041]="SLASH",s[s.PERCENT=1042]="PERCENT",s[s.LEFT_ANGLE=1043]="LEFT_ANGLE",s[s.RIGHT_ANGLE=1044]="RIGHT_ANGLE",s[s.VERTICAL_BAR=1045]="VERTICAL_BAR",s[s.CARET=1046]="CARET",s[s.AMPERSAND=1047]="AMPERSAND",s[s.QUESTION=1048]="QUESTION",s[s.NotWord=1049]="NotWord",s[s.EPSILON=1998]="EPSILON",s[s.EOF=1999]="EOF",s),U=((c={})[c.CONST=0]="CONST",c[c.BOOL=1]="BOOL",c[c.FLOAT=2]="FLOAT",c[c.DOUBLE=3]="DOUBLE",c[c.INT=4]="INT",c[c.UINT=5]="UINT",c[c.BREAK=6]="BREAK",c[c.CONTINUE=7]="CONTINUE",c[c.DO=8]="DO",c[c.ELSE=9]="ELSE",c[c.FOR=10]="FOR",c[c.IF=11]="IF",c[c.WHILE=12]="WHILE",c[c.DISCARD=13]="DISCARD",c[c.RETURN=14]="RETURN",c[c.BVEC2=15]="BVEC2",c[c.BVEC3=16]="BVEC3",c[c.BVEC4=17]="BVEC4",c[c.IVEC2=18]="IVEC2",c[c.IVEC3=19]="IVEC3",c[c.IVEC4=20]="IVEC4",c[c.UVEC2=21]="UVEC2",c[c.UVEC3=22]="UVEC3",c[c.UVEC4=23]="UVEC4",c[c.VEC2=24]="VEC2",c[c.VEC3=25]="VEC3",c[c.VEC4=26]="VEC4",c[c.VEC4_ARRAY=27]="VEC4_ARRAY",c[c.MAT2=28]="MAT2",c[c.MAT3=29]="MAT3",c[c.MAT4=30]="MAT4",c[c.MAT2X3=31]="MAT2X3",c[c.MAT2X4=32]="MAT2X4",c[c.MAT3X2=33]="MAT3X2",c[c.MAT3X4=34]="MAT3X4",c[c.MAT4X2=35]="MAT4X2",c[c.MAT4X3=36]="MAT4X3",c[c.IN=37]="IN",c[c.OUT=38]="OUT",c[c.INOUT=39]="INOUT",c[c.CENTROID=40]="CENTROID",c[c.SAMPLER2D=41]="SAMPLER2D",c[c.SAMPLER3D=42]="SAMPLER3D",c[c.SAMPLER_CUBE=43]="SAMPLER_CUBE",c[c.SAMPLER2D_SHADOW=44]="SAMPLER2D_SHADOW",c[c.SAMPLER_CUBE_SHADOW=45]="SAMPLER_CUBE_SHADOW",c[c.SAMPLER2D_ARRAY=46]="SAMPLER2D_ARRAY",c[c.SAMPLER2D_ARRAY_SHADOW=47]="SAMPLER2D_ARRAY_SHADOW",c[c.I_SAMPLER2D=48]="I_SAMPLER2D",c[c.I_SAMPLER3D=49]="I_SAMPLER3D",c[c.I_SAMPLER_CUBE=50]="I_SAMPLER_CUBE",c[c.I_SAMPLER2D_ARRAY=51]="I_SAMPLER2D_ARRAY",c[c.U_SAMPLER2D=52]="U_SAMPLER2D",c[c.U_SAMPLER3D=53]="U_SAMPLER3D",c[c.U_SAMPLER_CUBE=54]="U_SAMPLER_CUBE",c[c.U_SAMPLER2D_ARRAY=55]="U_SAMPLER2D_ARRAY",c[c.STRUCT=56]="STRUCT",c[c.LAYOUT=57]="LAYOUT",c[c.LOCATION=58]="LOCATION",c[c.VOID=59]="VOID",c[c.PRECISION=60]="PRECISION",c[c.PRECISE=61]="PRECISE",c[c.HIGHP=62]="HIGHP",c[c.MEDIUMP=63]="MEDIUMP",c[c.LOWP=64]="LOWP",c[c.INVARIANT=65]="INVARIANT",c[c.SMOOTH=66]="SMOOTH",c[c.FLAT=67]="FLAT",c[c.NOPERSPECTIVE=68]="NOPERSPECTIVE",c[c.True=69]="True",c[c.False=70]="False",c[c.LeftBrace=71]="LeftBrace",c[c.RightBrace=72]="RightBrace",c[c.Equal=73]="Equal",c[c.BitwiseOr=74]="BitwiseOr",c[c.GSRenderQueueType=75]="GSRenderQueueType",c[c.GSBlendState=76]="GSBlendState",c[c.GSDepthState=77]="GSDepthState",c[c.GSStencilState=78]="GSStencilState",c[c.GSRasterState=79]="GSRasterState",c[c.GSEditorProperties=80]="GSEditorProperties",c[c.GSEditorMacros=81]="GSEditorMacros",c[c.GSEditor=82]="GSEditor",c[c.GSTags=83]="GSTags",c[c.GSVertexShader=84]="GSVertexShader",c[c.GSFragmentShader=85]="GSFragmentShader",c[c.GSSubShader=86]="GSSubShader",c[c.GSPass=87]="GSPass",c[c.GSBlendFactor=88]="GSBlendFactor",c[c.GSBlendOperation=89]="GSBlendOperation",c[c.GSBool=90]="GSBool",c[c.GSNumber=91]="GSNumber",c[c.GSColor=92]="GSColor",c[c.GSCompareFunction=93]="GSCompareFunction",c[c.GSStencilOperation=94]="GSStencilOperation",c[c.GSCullMode=95]="GSCullMode",c[c.GSColorWriteMask=96]="GSColorWriteMask",c[c.GSUsePass=97]="GSUsePass",c[c.MACRO_IF=98]="MACRO_IF",c[c.MACRO_IFDEF=99]="MACRO_IFDEF",c[c.MACRO_IFNDEF=100]="MACRO_IFNDEF",c[c.MACRO_ELSE=101]="MACRO_ELSE",c[c.MACRO_ELIF=102]="MACRO_ELIF",c[c.MACRO_ENDIF=103]="MACRO_ENDIF",c[c.MACRO_UNDEF=104]="MACRO_UNDEF",c[c.MACRO_DEFINE_EXPRESSION=105]="MACRO_DEFINE_EXPRESSION",c[c.MACRO_CONDITIONAL_EXPRESSION=106]="MACRO_CONDITIONAL_EXPRESSION",c[c.MACRO_CALL=107]="MACRO_CALL",c[c.MACRO_DEFINE=108]="MACRO_DEFINE",c[c.MACRO_DEFINE_END=109]="MACRO_DEFINE_END",c[c.MACRO_DEFINE_PARAMS=110]="MACRO_DEFINE_PARAMS",c);function z(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):n(e,t)}function W(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function j(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return W(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return W(e,void 0)}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function q(e,t){for(var r=0;r<e.length;r++){var n,i=e[r];if((null==(n=i.sourceArm)?void 0:n.value)!==!0){var a=i.conditionalGroup;if(void 0===a)return!1;for(var o=!1,s=0;s<t.length;s++){var c=t[s];if(c.conditionalGroup===a){if(c.conditionalArm!==i.conditionalArm)return!1;o=!0;break}}if(!o)return!1}}return!0}function H(e,t){return!function e(t,r,n){var i=function(t){var r;return void 0!==h&&t!==h||(null==(r=o.conditionalReachableArms)?void 0:r[t])===!1?"continue":e(c.filter(function(e){return e.every(function(e){return e.conditionalGroup!==l||e.conditionalArm===t})}).map(function(e){return e.filter(function(e){return e.conditionalGroup!==l})}),d,n)?void 0:{v:!1}};if(t.some(function(e){return q(e,r)}))return!0;if(--n.remaining<0)return!1;for(var a,o,s,c=t.filter(function(e){return"exclusive"!==X(e,r)}),u=j(c);!(s=u()).done&&!(o=s.value.find(function(e){return e.conditionalComplete&&void 0!==e.conditionalGroup&&e.conditionalArmCount})););if(!o)return!1;for(var l=o.conditionalGroup,h=null==(a=r.find(function(e){return e.conditionalGroup===l}))?void 0:a.conditionalArm,d=r.filter(function(e){return e.conditionalGroup!==l}),p=0;p<o.conditionalArmCount;p++){var f=i(p);if("object"==(f&&"undefined"!=typeof Symbol&&f.constructor===Symbol?"symbol":typeof f))return f.v}return!0}(e,t,{remaining:256})?"unknown":"covered"}function X(e,t){for(var r,n=j(e);!(r=n()).done;)for(var i,a=r.value,o=j(t);!(i=o()).done;){var s=i.value;if(void 0!==a.conditionalGroup&&a.conditionalGroup===s.conditionalGroup&&a.conditionalArm!==s.conditionalArm)return"exclusive"}for(var c,u=j(e);!(c=u()).done;)if(void 0!==c.value.condition)return"unknown";for(var l,h=j(t);!(l=h()).done;)if(void 0!==l.value.condition)return"unknown";return"coexist"}function Q(e,t){return e&&t?e.kind===t.kind&&("constant"===e.kind?"constant"===t.kind&&e.value===t.value:"constant"!==t.kind&&("expression"===e.kind?"expression"===t.kind&&function(e,t){if(e.expression!==t.expression||e.opaque!==t.opaque||e.names.length!==t.names.length)return!1;for(var r=0,n=e.names.length;r<n;r++)if(e.names[r]!==t.names[r]||e.versions[r]!==t.versions[r])return!1;return!0}(e,t)&&e.negated===t.negated:"expression"!==t.kind&&e.name===t.name&&e.version===t.version&&("defined"===e.kind&&"defined"===t.kind?e.defined===t.defined:"comparison"===e.kind&&"comparison"===t.kind&&e.operator===t.operator&&e.value===t.value))):e===t}var K=Object.freeze([]),Y=function(){function e(e){this._objectPool=e,this.branch=K,this.inMacroDefinition=!1}return e.prototype.set=function(e,t,r){if(this.type=e,this.lexeme=t,this.branch=K,this.inMacroDefinition=!1,z(r,w))this.location=r;else{var n=this._objectPool?this._objectPool.createPosition(r.index+t.length,r.line,r.column+t.length):J(r.index+t.length,r.line,r.column+t.length);this.location=this._objectPool?this._objectPool.createRange(r,n):Z(r,n)}},e}();function J(e,t,r){var n=new G;return n.set(e,t,r),n}function Z(e,t){var r=new w;return r.set(e,t),r}var $=new Y,ee=J(0,0,0);function et(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function er(e,t,r){return t&&et(e.prototype,t),r&&et(e,r),e}function en(e,t){return(en=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ei(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&en(e,t)}function ea(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(ea=function(){return!!e})()}function eo(e,t,r){return(eo=ea()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var i=new(Function.bind.apply(e,n));return r&&en(i,r.prototype),i}).apply(null,arguments)}function es(e){return(es=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ec(e){var t="function"==typeof Map?new Map:void 0;return(ec=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return eo(e,arguments,es(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),en(r,e)})(e)}$.set(B.EOF,"/EOF",Z(ee,ee));var eu=function(e){function t(t,r,n,i,a,o){var s;return(s=e.call(this,r)||this).location=n,s.source=i,s.file=a,s.code=o,s.name=t,s}return ei(t,e),t.prototype.toString=function(){var e=this.location;return function(e,t,r,n){if(void 0===n&&(n=5),!e)return r;for(var i=e.split("\n"),a=t.start,o=t.end,s=Math.max(0,a.line-n),c=Math.min(i.length-1,o.line+n),u=String(c+1).length,l=" ".repeat(u),h=r+"\n",d=s;d<=c;d++)if(h+=String(d+1).padStart(u)+" | "+i[d]+"\n",a.line<=d&&d<=o.line){var p=d===a.line?a.column:0,f=d===o.line?o.column:i[d].length;h+=l+" | "+" ".repeat(p)+"^".repeat(Math.max(f-p,1))+"\n"}return h}(this.source||void 0,"start"in e?e:{start:e,end:e},this.name+": "+this.message)},t}(ec(Error)),el=((u={}).PreprocessorError="PreprocessorError",u.CompilationError="CompilationError",u.ScannerError="ScannerError",u.CompilationWarn="CompilationWarning",u),eh=function(){function e(){}return e.createPosition=function(e,t,r){void 0===t&&(t=0),void 0===r&&(r=0);var n=new G;return n.set(e,t,r),n},e.createRange=function(e,t){var r=new w;return r.set(e,t),r},e.createGSError=function(e,t,r,n,i,a){return new eu(t,e,n,r,a,i)},e}(),ed=function(){function e(e,t){this._objectPool=t,this._currentIndex=0,this._column=0,this._line=0,this.setSource(null!=e?e:"")}var t=e.prototype;return t.setSource=function(e){this._source=e,this._currentIndex=0,this._line=this._column=0},t.getShaderPosition=function(e){void 0===e&&(e=0);var t=this._currentIndex-e;return this._createPosition(t,this._line,this._column-e)},t._createPosition=function(e,t,r){return this._objectPool?this._objectPool.createPosition(e,t,r):eh.createPosition(e,t,r)},t._createToken=function(){return this._objectPool?this._objectPool.createToken():new Y},t._createEOFToken=function(){var e=this.getShaderPosition(),t=this._createToken();return t.set(B.EOF,"/EOF",this._createRange(e,e)),t},t._createRange=function(e,t){return this._objectPool?this._objectPool.createRange(e,t):eh.createRange(e,t)},t.isEnd=function(){return this._currentIndex>=this._source.length},t.getCurChar=function(){return this._source[this._currentIndex]},t.getCurCharCode=function(){return this._source.charCodeAt(this._currentIndex)},t.advance=function(e){for(var t=this._source,r=this._currentIndex,n=0;n<e;n++)10===t.charCodeAt(r+n)?(this._line+=1,this._column=0):this._column+=1;this._currentIndex+=e},t.skipSpace=function(t){for(;e.isWhiteSpaceChar(this.getCurCharCode(),t);)this.advance(1)},t.skipCommentsAndSpace=function(){for(var t=this._source,r=t.length,n=this._currentIndex;n<r;){for(;n<r&&e.isWhiteSpaceChar(t.charCodeAt(n),!0);)n++;var i=e._skipBlockComment(t,n,r);if(i!==n){n=i;continue}var a=e._skipLineComment(t,n,r);if(a!==n){n=a;continue}break}this.advance(n-this._currentIndex)},t.peek=function(e){var t=this._currentIndex;return this._source.substring(t,t+e)},t.scanLexeme=function(e){this.skipCommentsAndSpace();var t=e.length,r=this.peek(t);r!==e&&this.throwError(this.getShaderPosition(0),'Expect lexeme "'+e+'", but got "'+r+'"'),this.advance(t)},t.scanTwoExpectedLexemes=function(e,t){return(this.skipCommentsAndSpace(),this.peek(e.length)===e)?(this.advance(e.length),e):this.peek(t.length)===t?(this.advance(t.length),t):null},t.throwError=function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];throw eh.createGSError(r.join(" "),el.ScannerError,this._source,e)},t.scanPairedChar=function(e,t,r,n){n||this.scanLexeme(e);var i=this._currentIndex,a=this._source,o=a.length,s=this._currentIndex;if(r)for(var c=1;s<o;){var u=a[s];if(u===t&&0==--c)break;u===e&&c++,s++}else for(;s<o&&a[s]!==t;)s++;return s===o&&this.throwError(this.getShaderPosition(),'Expect closing character "'+t+'" before end of source.'),this.advance(s+1-this._currentIndex),a.substring(i,s)},e.isDigit=function(e){return e>=48&&e<=57},e.isHexDigit=function(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102},e.isAlpha=function(e){return 95===e||e>=65&&e<=90||e>=97&&e<=122},e.isAlnum=function(t){return e.isAlpha(t)||e.isDigit(t)},e.isPreprocessorStartChar=function(e){return 35===e},e._skipBlockComment=function(e,t,r){if(47!==e.charCodeAt(t)||t+1>=r||42!==e.charCodeAt(t+1))return t;for(var n=t+2;n+1<r;){if(42===e.charCodeAt(n)&&47===e.charCodeAt(n+1))return n+2;n++}return r},e._skipLineComment=function(e,t,r){if(47!==e.charCodeAt(t)||t+1>=r||47!==e.charCodeAt(t+1))return t;for(var n=t+2;n<r;){var i=e.charCodeAt(n);if(10===i||13===i)break;n++}return n},e.isWhiteSpaceChar=function(e,t){return 32===e||9===e||t&&(10===e||13===e)},er(e,[{key:"currentIndex",get:function(){return this._currentIndex}},{key:"source",get:function(){return this._source}},{key:"line",get:function(){return this._line}},{key:"column",get:function(){return this._column}}]),e}();function ep(){return(ep=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}var ef=[-0x80000000,0x7fffffff],e_=[0,1];function ev(e,t){return void 0===t&&(t=new WeakMap),em(e,t)}function em(e,t){if(t.has(e))return t.get(e);var r=function(e,t){switch(e.t){case"num":return[e.v,e.v];case"bool":return[Number(e.v),Number(e.v)];case"def":case"ndef":return e_;case"not":var r=em(e.c,t);return r&&(eO(r)?[0,0]:r[0]===r[1]?[1,1]:e_);case"and":case"or":var n=em(e.l,t);if(!n)return;var i="and"===e.t;if(i&&0===n[0]&&0===n[1])return[0,0];if(!i&&eO(n))return[1,1];var a=em(e.r,t);if(!a)return;if(i&&0===a[0]&&0===a[1])return[0,0];if(!i&&eO(a)||eO(n)&&eO(a))return[1,1];if(0===n[0]&&0===n[1]&&0===a[0]&&0===a[1])return[0,0];return e_;case"unary":var o=em(e.c,t);if(!o)return;if(o[0]===o[1])return eT(ep({},e,{c:eI(o[0])}));if("+"===e.op)return o;if("~"===e.op)return[~o[1],~o[0]];return -0x80000000===o[0]?ef:[-o[1],-o[0]];case"binary":var s=em(e.l,t),c=em(e.r,t);if(!s||!c)return;if(s[0]===s[1]&&c[0]===c[1])return eT(ep({},e,{l:eI(s[0]),r:eI(c[0])}));if(eM(e.op))return e_;switch(e.op){case"+":return eA(s[0]+c[0],s[1]+c[1]);case"-":return eA(s[0]-c[1],s[1]-c[0]);case"*":var u,l,h=[s[0]*c[0],s[0]*c[1],s[1]*c[0],s[1]*c[1]];return eA((u=Math).min.apply(u,[].concat(h)),(l=Math).max.apply(l,[].concat(h)));case"/":case"%":return eO(c)?ef:void 0;case"<<":case">>":return c[0]>=0&&c[1]<=31?ef:void 0;default:return s[0]>=0&&s[1]<=1&&c[0]>=0&&c[1]<=1?e_:ef}default:return}}(e,t);return t.set(e,r),r}function eg(e,t){var r,n=em(e,t);if(!n)return e;if(eO(n))return eR(!0);if(0===n[0]&&0===n[1])return eR(!1);switch(e.t){case"not":return eE(eg(e.c,t));case"and":case"or":return ex(e.t,eg(e.l,t),eg(e.r,t));case"binary":if(eM(e.op)){var i=em(e.l,t),a=em(e.r,t);if(a[0]===a[1])return eS(e.l,e.op,a[0],t);if(i[0]===i[1])return eS(e.r,function(e){switch(e){case"<":return">";case"<=":return">=";case">":return"<";case">=":return"<=";default:return e}}(e.op),i[0],t)}}return null!=(r=ey(e,t))?r:e}function ey(e,t){if("def"===e.t||"ndef"===e.t)return e;if("unary"===e.t&&"~"!==e.op)return eg(e.c,t);if("binary"===e.t){var r=em(e.l,t),n=em(e.r,t);if("+"===e.op&&eC(r,n)&&(r[0]>=0&&n[0]>=0||r[1]<=0&&n[1]<=0)||"|"===e.op)return ex("or",eg(e.l,t),eg(e.r,t));if("&"===e.op&&r[0]>=0&&r[1]<=1&&n[0]>=0&&n[1]<=1)return ex("and",eg(e.l,t),eg(e.r,t))}}function eS(e,t,r,n){switch(t){case"<":return eb(e,r,n);case"<=":return eb(e,r+1,n);case">":return eE(eb(e,r+1,n));case">=":return eE(eb(e,r,n));case"==":return ex("and",eE(eb(e,r,n)),eb(e,r+1,n));case"!=":return ex("or",eb(e,r,n),eE(eb(e,r+1,n)))}}function eb(e,t,r){var n=em(e,r);if(n[1]<t)return eR(!0);if(n[0]>=t)return eR(!1);if(0===n[0]&&1===t||0===n[1]&&0===t){var i=ey(e,r);if(i)return 0===n[0]?eE(i):i}if(t===n[0]+1||t===n[1]){var a=t===n[1],o=function(e,t,r){if("binary"===e.t&&"+"===e.op){var n=em(e.l,r),i=em(e.r,r);if(eC(n,i)){var a=t?1:0;return ex("and",eS(e.l,"==",n[a],r),eS(e.r,"==",i[a],r))}}}(e,a,r);if(o)return a?eE(o):o}return{t:"binary",op:"<",l:e,r:eI(t)}}function ex(e,t,r){return"bool"===t.t?t.v===("and"===e)?r:t:"bool"===r.t?r.v===("and"===e)?t:r:{t:e,l:t,r:r}}function eE(e){switch(e.t){case"bool":return eR(!e.v);case"def":return{t:"ndef",m:e.m};case"ndef":return{t:"def",m:e.m};case"not":return e.c;case"and":case"or":return ex("and"===e.t?"or":"and",eE(e.l),eE(e.r));default:return{t:"not",c:e}}}function eC(e,t){return e[0]+t[0]>=-0x80000000&&e[1]+t[1]<=0x7fffffff}function eA(e,t){return e>=-0x80000000&&t<=0x7fffffff?[e,t]:ef}function eT(e){var t=x(e);return void 0===t?void 0:[t,t]}function eO(e){return e[0]>0||e[1]<0}function eI(e){return{t:"num",v:e}}function eR(e){return{t:"bool",v:e}}function eM(e){return["<","<=",">",">=","==","!="].includes(e)}var eP=Symbol("condition diagram budget"),eD=function(){function e(){this._nodes=[],this._constants=new Map,this._variables=new Map,this._opaqueVariables=new Set,this._branches=new Map,this._operations=new Map,this._expressions=new Map,this._remaining=16384}var t=e.prototype;return t.coverage=function(e){for(var t=[{id:e,opaque:!1}],r=[new Set,new Set],n=!1;t.length;){var i=t.pop(),a=i.id,o=i.opaque,s=r[Number(o)];if(!s.has(a)){s.add(a),this._spend();var c=this._nodes[a];if(c.variable!==1/0){var u=o||this._opaqueVariables.has(c.variable);t.push({id:c.low,opaque:u},{id:c.high,opaque:u})}else if(0===c.value){if(!o)return!1;n=!0}else void 0===c.value&&(n=!0)}}return!n||void 0},t.constant=function(e){var t=this._constants.get(e);return void 0===t&&(this._spend(),t=this._nodes.length,this._nodes.push({variable:1/0,low:0,high:0,value:e}),this._constants.set(e,t)),t},t.predicates=function(e){if("boolean"==typeof e)return this.constant(Number(e));for(var t,r=this.constant(1),n=j(e);!(t=n()).done;){var i=t.value,a=i.condition,o=i.negated,s="opaque"===a.kind?this._variable("opaque:"+a.identity,!0):this._expression(a.expression,a);r=this.apply("and",r,this.apply(o?"not":"truth",s))}return r},t.apply=function(e,t,r){void 0===r&&(r=t);var n,i=e+":"+t+":"+r,a=this._operations.get(i);if(void 0!==a)return a;this._spend();var o=this._nodes[t],s=this._nodes[r];if(o.variable===1/0&&void 0===o.value)n=t;else if(o.variable===1/0&&"and"===e&&0===o.value)n=this.constant(0);else if(o.variable===1/0&&"or"===e&&0!==o.value)n=this.constant(1);else if(o.variable===1/0&&s.variable===1/0)n=this._evaluate(e,o.value,s.value);else{var c=Math.min(o.variable,s.variable);n=this._branch(c,this.apply(e,o.variable===c?o.low:t,s.variable===c?s.low:r),this.apply(e,o.variable===c?o.high:t,s.variable===c?s.high:r))}return this._operations.set(i,n),n},t._expression=function(e,t){var r,n=this._expressions.get(t);n||this._expressions.set(t,n=new Map);var i=n.get(e);if(void 0!==i)return i;switch(e.t){case"bool":r=this.constant(Number(e.v));break;case"num":r=this.constant(e.v);break;case"def":case"ndef":r=this._variable("defined:"+e.m+":"+t.versions[e.m]),"ndef"===e.t&&(r=this.apply("not",r));break;case"not":r=this.apply("not",this._expression(e.c,t));break;case"unary":r=this.apply("+"===e.op?"positive":"-"===e.op?"negative":"complement",this._expression(e.c,t));break;case"and":case"or":case"binary":var a="binary"===e.t?e.op:e.t;r=["and","or","+","*","&","|","^"].includes(a)?this._associativeExpression(e,t,a):this.apply(a,this._expression(e.l,t),this._expression(e.r,t));break;default:r=this.constant()}return n.set(e,r),r},t._associativeExpression=function(e,t,r){for(var n=[e],i=[];n.length;){var a=n.pop();"binary"===a.t&&a.op===r||("and"===a.t||"or"===a.t)&&a.t===r?n.push(a.r,a.l):i.push(this._expression(a,t))}for(;i.length>1;){for(var o=0,s=0;s<i.length;s+=2)i[o++]=s+1<i.length?this.apply(r,i[s],i[s+1]):i[s];i.length=o}return i[0]},t._variable=function(e,t){void 0===t&&(t=!1);var r=this._variables.get(e);return void 0===r&&this._variables.set(e,r=this._variables.size),t&&this._opaqueVariables.add(r),this._branch(r,this.constant(0),this.constant(1))},t._branch=function(e,t,r){if(t===r)return t;var n=e+":"+t+":"+r,i=this._branches.get(n);return void 0===i&&(this._spend(),i=this._nodes.length,this._nodes.push({variable:e,low:t,high:r}),this._branches.set(n,i)),i},t._evaluate=function(e,t,r){if("truth"===e)return this.constant(Number(0!==t));if("not"===e)return this.constant(Number(0===t));var n,i,a={t:"num",v:t};if("positive"===e||"negative"===e||"complement"===e)n={t:"unary",op:"positive"===e?"+":"negative"===e?"-":"~",c:a};else{if(void 0===r)return this.constant();var o={t:"num",v:r};n="and"===e||"or"===e?{t:e,l:a,r:o}:{t:"binary",op:e,l:a,r:o}}try{i=x(n)}catch(e){i=void 0}return this.constant(i)},t._spend=function(){if(--this._remaining<0)throw eP},e}();function eL(e,t){for(var r=Object.create(null),n=[e];n.length;){var i,a=n.pop();switch(a.t){case"def":case"ndef":r[a.m]=null!=(i=t[a.m])?i:0;break;case"not":case"unary":n.push(a.c);break;case"and":case"or":case"binary":n.push(a.l,a.r)}}return{kind:"expression",expression:e,versions:r}}function eN(e,t){return!0===ek(e,t)}function ek(e,t){var r=eV(t),n=e.map(eV);if(n.includes(!0)||!1===r)return!0;if(void 0!==r){var i=n.filter(function(e){return void 0!==e}),a=new Map;i=i.map(c),r=c(r);var o=new WeakMap;if(i.some(function(e){return function(e,t,r){var n=new Set,i=new Map,a=new Map,o=new Map,s=function(e){return ev(e,r)},c=!1===t;function u(e){var t=o.get(e);return void 0===t&&o.set(e,t=o.size+1),t}function l(e,t){var r=a.get(t);r||a.set(t,r=new Map);var n=r.get(e);return void 0===n&&(n=function(e,t,r,n,i){var a=n(e);if(a&&a[0]===a[1])return i("num:"+a[0]);switch(e.t){case"def":case"ndef":return i(e.t+":"+("defined:"+e.m+":")+t[e.m]);case"not":return i("not("+r(e.c)+")");case"unary":return i(e.op+"("+r(e.c)+")");case"and":case"or":case"binary":var o="binary"===e.t?e.op:e.t,s=["+","*","&","|","^"].includes(o);if(s||("and"===o||"or"===o)&&a){var c,u=[],l=function(e){if("binary"===e.t&&e.op===o||("and"===e.t||"or"===e.t)&&e.t===o)l(e.l),l(e.r);else{var t=n(e);s&&t&&t[0]===t[1]?c=void 0===c?t[0]:x({t:"binary",op:o,l:{t:"num",v:c},r:{t:"num",v:t[0]}}):u.push(r(e))}};l(e);var h="*"===o?1:"&"===o?-1:0;return s&&void 0!==c&&(c!==h||!u.length)&&u.push(i("num:"+c)),u.sort(function(e,t){return e-t}),1===u.length?u[0]:i(o+"("+u.join(",")+")")}return i(o+"("+r(e.l)+","+r(e.r)+")");default:return i(JSON.stringify(e))}}(e,"expression"===t.kind?t.versions:{},function(e){return l(e,t)},s,u),r.set(e,n)),n}function h(e,t,r,a){if("opaque"===e.kind){var o,d=(r?-1:1)*u("opaque:"+e.identity);return a&&n.add(d),n.has(d)}if(!t)return!1;if("not"===t.t)return h(e,t.c,!r,a);if("bool"===t.t||"num"===t.t){var p=!!t.v!==r;return a&&!p&&(c=!0),p}var f=(r?-1:1)*l(t,e);if(a)n.add(f);else if(n.has(f))return!0;if("and"===t.t||"or"===t.t){if(!s(t))return!1;var _="and"===t.t!==r;if(a&&!_)return!1;var v=h(e,t.l,r,a),m=h(e,t.r,r,a);return _?v&&m:v||m}var g=function(e,t,r){var n,i=e;if("binary"===e.t&&"<"===e.op&&"num"===e.r.t)i=e.l,n=t?[e.r.v,0x7fffffff]:[-0x80000000,e.r.v-1];else if(t)n=[0,0];else{var a=s(i);if(!a||a[0]<0&&a[1]>0)return;n=a[0]>=0?[1,0x7fffffff]:[-0x80000000,-1]}var o=s(i);if(o)return{key:l(i,r),domain:o,allowed:[Math.max(o[0],n[0]),Math.min(o[1],n[1])]}}(t,r,e);if(!g)return!1;var y=null!=(o=i.get(g.key))?o:g.domain,S=g.allowed;if(a){var b=[Math.max(y[0],S[0]),Math.min(y[1],S[1])];return b[0]>b[1]&&(c=!0),i.set(g.key,b),!0}return y[0]>=S[0]&&y[1]<=S[1]}if("boolean"!=typeof t)for(var d,p=j(t);!(d=p()).done;){var f=d.value,_=f.condition,v=f.negated;h(_,"expression"===_.kind?_.expression:void 0,v,!0)}return c||("boolean"==typeof e?e:e.every(function(e){var t=e.condition,r=e.negated;return h(t,"expression"===t.kind?t.expression:void 0,r,!1)}))}(e,r,o)}))return!0;var s=function(e,t){var r=new eD;try{for(var n,i=r.predicates(t),a=r.constant(0),o=j(e);!(n=o()).done;){var s=n.value;a=r.apply("or",a,r.predicates(s))}return r.coverage(r.apply("or",r.apply("not",i),a))}catch(e){if(e!==eP)throw e;return}}(i,r);return!1===s&&n.includes(void 0)?void 0:s}function c(e){return"boolean"==typeof e?e:e.map(function(e){var t=e.condition,r=e.negated,n=a.get(t);return n||(n="opaque"===t.kind?t:ep({},t,{expression:eg(t.expression,new WeakMap)}),a.set(t,n)),{condition:n,negated:r}})}}function eV(e){for(var t,r=[],n=j(e);!(t=n()).done;){var i=t.value.sourceArm;if((null==i?void 0:i.value)!==!0){if((null==i?void 0:i.value)===!1)return!1;if(!(null==i?void 0:i.predicates))return;r.push.apply(r,[].concat(i.predicates))}}return!r.length||r}var eF=function(){function e(){this._table=new Map}var t=e.prototype;return t.insert=function(e,t,r,n){void 0===t&&(t=!1),void 0===r&&(r=K),e.isInMacroBranch=t,e.branchSignature=r;var i=null!=(s=this._table.get(e.ident))?s:[],a=null!=(c=e.sourceScope)?c:0;if(a>0)for(var o=i.length-1;o>=0;o--){var s,c,u,l=i[o],h=null!=(d=l.sourceScope)?d:0;if(l.equal(e)&&!(h>=a)){for(var d,p,f=[r],_=j(i);!(p=_()).done;){var v,m,g=p.value;(null!=(v=g.sourceScope)?v:0)>h&&g.equal(e)&&f.push(null!=(m=g.branchSignature)?m:K)}eN(f,null!=(u=l.branchSignature)?u:K)&&i.splice(o,1)}}if(!n)return this._insertWithoutBranchAnalysis(i,e);for(var y="none",S=0,b=i.length;S<b;S++){var x,E,C=i[S];if(C.equal(e)&&!((null!=(x=C.sourceScope)?x:0)<a)){var A=null!=(E=C.branchSignature)?E:K;if(0===A.length&&0===r.length)return i[S]=e,"coexist";var T=n.getDeclarationCoexistence(A,r);"coexist"===T?y="coexist":"unknown"===T&&"none"===y&&(y="unknown")}}return i.push(e),this._table.set(e.ident,i),y},t._insertWithoutBranchAnalysis=function(e,t){for(var r,n,i=0,a=e.length;i<a;i++)if(!e[i].isInMacroBranch&&(null!=(r=e[i].sourceScope)?r:0)===(null!=(n=t.sourceScope)?n:0)&&e[i].equal(t))return e[i]=t,"coexist";return e.push(t),this._table.set(t.ident,e),"none"},t.getInheritedConflict=function(e,t,r){var n=this._table.get(e.ident);if(!(null==n?void 0:n.includes(e)))return"none";for(var i,a="none",o=j(n);!(i=o()).done;){var s,c,u,l,h=i.value;if(!((null!=(s=h.sourceScope)?s:0)>=(null!=(c=e.sourceScope)?c:0))&&h.equal(e)&&(null==r||!r(h,e))){var d=t.getDeclarationCoexistence(null!=(u=h.branchSignature)?u:K,null!=(l=e.branchSignature)?l:K);if("coexist"===d)return"coexist";"unknown"===d&&(a="unknown")}}return a},t.getSymbol=function(e,t,r,n){void 0===t&&(t=!1);var i=this._table.get(e.ident);if(i)for(var a=i.length-1;a>=0;a--){var o,s=i[a],c=t||!s.isInMacroBranch;if(n&&void 0!==r&&(c=n.isBranchVisibleFrom(null!=(o=s.branchSignature)?o:K,r)),c&&s.equal(e))return s}},t.getSymbols=function(e,t,r){return void 0===t&&(t=!1),r.length=0,this._getSymbols(e,t,r),r},t.hasSymbol=function(e){var t=this._table.get(e.ident);if(!t)return!1;for(var r=0,n=t.length;r<n;r++)if(t[r].equal(e))return!0;return!1},t._getSymbols=function(e,t,r,n,i){void 0===t&&(t=!1);var a=this._table.get(e.ident);if(a)for(var o=a.length-1;o>=0;o--){var s,c,u=a[o],l=t||!u.isInMacroBranch;void 0!==n&&(l=i?i.canBranchesOverlap(null!=(s=u.branchSignature)?s:K,n):"exclusive"!==X(null!=(c=u.branchSignature)?c:K,n)),l&&u.equal(e)&&r.push(u)}return r},t.forEach=function(e){for(var t,r=j(this._table.values());!(t=r()).done;)for(var n=t.value,i=0,a=n.length;i<a;i++)e(n[i])},e}(),ew=function(){function e(){this.stack=[],this._macroLevel=0,this._currentBranch=K}var t=e.prototype;return t.pushScope=function(e){this.stack.push(e)},t.clear=function(){this.stack.length=0,this._macroLevel=0,this._currentBranch=K},t.popScope=function(){return this.stack.pop()},t.insert=function(e,t){return void 0===t&&(t=this._currentBranch),this.scope.insert(e,this.isInMacroBranch,t,this.branchSemantics)},t.lookup=function(e,t,r){void 0===t&&(t=!1);for(var n=this.stack.length-1;n>=0;n--){var i=this.stack[n].getSymbol(e,t,r,this.branchSemantics);if(i)return i}},t.hasSymbol=function(e){for(var t=this.stack.length-1;t>=0;t--)if(this.stack[t].hasSymbol(e))return!0;return!1},t.lookupAll=function(e,t,r,n){void 0===t&&(t=!1),r.length=0;for(var i=this.stack.length-1;i>=0&&(this.stack[i]._getSymbols(e,t,r,n,this.branchSemantics),!(r.length>0));i--);return r},t.lookupAllWithRuntimeFallbacks=function(e,t,r,n,i){r.length=0,n.length=0;for(var a=this.stack.length-1;a>=0;a--)if(r.length){var o=n.length;if(this.stack[a]._getSymbols(e,t,n,i,this.branchSemantics),n.length>o&&this._runtimeCandidatesCoverCallsite(n,i))break}else{if(this.stack[a]._getSymbols(e,t,r,i,this.branchSemantics),!r.length)continue;if(this._runtimeCandidatesCoverCallsite(r,i))break}return r},t._runtimeCandidatesCoverCallsite=function(e,t){for(var r=0;r<e.length;r++){var n,i=e[r];if(!i.isInMacroBranch||t&&q(null!=(n=i.branchSignature)?n:K,t))return!0}return!1},er(e,[{key:"scope",get:function(){return this.stack[this.stack.length-1]}},{key:"isInMacroBranch",get:function(){return this._macroLevel>0}}]),e}(),eG=((l={})[l.VERTEX=0]="VERTEX",l[l.FRAGMENT=1]="FRAGMENT",l[l.ALL=2]="ALL",l);function eB(e,t,r,n){var i,a,o=arguments.length,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if(("undefined"==typeof Reflect?"undefined":(i=Reflect)&&"undefined"!=typeof Symbol&&i.constructor===Symbol?"symbol":typeof i)=="object"&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,n);else for(var c=e.length-1;c>=0;c--)(a=e[c])&&(s=(o<3?a(s):o>3?a(t,r,s):a(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s}function eU(e,t){var r,n,i,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(c){return function(s){if(r)throw TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(i=2&s[0]?n.return:s[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,s[1])).done)return i;switch(n=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===s[0]||2===s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){a.label=s[1];break}if(6===s[0]&&a.label<i[1]){a.label=i[1],i=s;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(s);break}i[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}"function"==typeof SuppressedError&&SuppressedError;var ez=function(e){function t(t,r,n,i){var a;return(a=e.call(this,t,n)||this).macroDefineList=r,a._conditionalArms=i,a.preprocessorExpressions=new Map,a._needScanMacroConditionExpression=!1,a._inMacroDefineValue=!1,a._macroDefineExpectsNameToken=!1,a._macroDefineExpectsParamsToken=!1,a._currentMacroName="",a._currentMacroParamsLexeme=void 0,a._currentMacroValueStart=-1,a._branchStack=[],a._branchSnapshot=K,a._conditionalGroup=0,a._pendingBranchPushDefined=null,a._pendingCodegenConditional=null,a._codegenConditionalFrames=[],a}ei(t,e);var r=t.prototype;return r.tokenize=function(){return eU(this,function(e){switch(e.label){case 0:return[5,function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(this._tokenizeForCodegen())];case 1:return e.sent(),[2,this._createEOFToken()]}})},r._tokenizeForCodegen=function(){var e,t,r,n,i,a,o,s,c,u,l,h,d,p,f,_,v,m,g,y,S,b,x,E,C,A,T,O;return eU(this,function(I){switch(I.label){case 0:if(this.isEnd())return[3,2];switch(e=this.scanToken(),this._pendingCodegenConditional&&e.type===U.MACRO_CONDITIONAL_EXPRESSION&&(t=this._parseCodegenConstantCondition(e.lexeme),"push"===this._pendingCodegenConditional?(n={name:"__if_"+(r=++this._conditionalGroup),defined:!0,sourceArm:this._pendingCodegenArm,conditionalGroup:r,conditionalArm:0,condition:t},this._branchStack.push(n),this._codegenConditionalFrames.push({arms:[n],definitelyMatched:(null==t?void 0:t.kind)==="constant"&&t.value})):(i=this._branchStack.length-1,(a=this._branchStack[i])&&(c=(s=(o=this._codegenConditionalFrames[i]).definitelyMatched)?{kind:"constant",value:!1}:t,this._branchStack[i]={name:a.name,defined:!0,conditionalGroup:a.conditionalGroup,conditionalArm:(null!=(u=a.conditionalArm)?u:0)+1,sourceArm:this._pendingCodegenArm,condition:c},o.arms.push(this._branchStack[i]),!s&&(null==t?void 0:t.kind)==="constant"&&t.value&&(o.definitelyMatched=!0))),this._pendingCodegenConditional=null),l=e.type===B.ID||e.type===U.MACRO_CALL,null!==this._pendingBranchPushDefined&&l&&(h=++this._conditionalGroup,d={name:e.lexeme,defined:this._pendingBranchPushDefined,sourceArm:this._pendingCodegenArm,conditionalGroup:h,conditionalArm:0},this._branchStack.push(d),this._codegenConditionalFrames.push({arms:[d],definitelyMatched:!1}),this._pendingBranchPushDefined=null),this._branchStack.length>0&&(e.branch=this._captureBranchSignature()),e.type){case U.MACRO_IFDEF:this._pendingCodegenArm=null==(p=this._conditionalArms)?void 0:p.get(e.location.start.index),this._pendingBranchPushDefined=!0;break;case U.MACRO_IFNDEF:this._pendingCodegenArm=null==(f=this._conditionalArms)?void 0:f.get(e.location.start.index),this._pendingBranchPushDefined=!1;break;case U.MACRO_IF:this._pendingCodegenArm=null==(_=this._conditionalArms)?void 0:_.get(e.location.start.index),this._pendingCodegenConditional="push";break;case U.MACRO_ELIF:this._pendingCodegenArm=null==(v=this._conditionalArms)?void 0:v.get(e.location.start.index),this._pendingCodegenConditional="advance";break;case U.MACRO_ELSE:m=this._branchStack.length-1,(g=this._branchStack[m])&&(b=(S=this._codegenConditionalFrames[m]).definitelyMatched?{kind:"constant",value:!1}:void 0,this._branchStack[m]={name:g.name,defined:!g.defined,sourceArm:null==(y=this._conditionalArms)?void 0:y.get(e.location.start.index),conditionalGroup:g.conditionalGroup,conditionalArm:(null!=(x=g.conditionalArm)?x:0)+1,condition:b},S.arms.push(this._branchStack[m]),S.definitelyMatched=!0);break;case U.MACRO_ENDIF:if(this._branchStack.pop(),null==(E=this._codegenConditionalFrames.pop())?void 0:E.definitelyMatched)for(C=E.arms.map(function(e){var t;return(null==(t=e.condition)?void 0:t.kind)!=="constant"||e.condition.value}),A=j(E.arms);!(T=A()).done;)(O=T.value).conditionalComplete=!0,O.conditionalArmCount=E.arms.length,O.conditionalReachableArms=C}return[4,e];case 1:return I.sent(),[3,0];case 2:return[2,this._createEOFToken()]}})},r._parseCodegenConstantCondition=function(e){var t=this.preprocessorExpressions.get(e.trim()),r=(null==t?void 0:t.ok)&&!t.hasExpandableIdentifier?x(t.condition):void 0;return void 0===r?void 0:{kind:"constant",value:0!==r}},r._isBranchReachable=function(e){return t._isCodegenBranchReachable(e)},r._sameDefinitionBranch=function(e,r){return t._sameCodegenBranch(e,r)},r._branchesOverlap=function(e,t){return"exclusive"!==X(e,t)},r.scanToken=function(){if(this._inMacroDefineValue){if(this._skipInlineSpaceAndComments(),this.isEnd()||this._isAtLineBreak())return this._emitMacroDefineEnd();if(this._macroDefineExpectsParamsToken&&(this._macroDefineExpectsParamsToken=!1,"("===this.getCurChar()))return this._scanMacroDefineParams()}else if(this.skipCommentsAndSpace(),this.isEnd())return this._createEOFToken();if(this._needScanMacroConditionExpression)return this._needScanMacroConditionExpression=!1,this._scanMacroConditionExpression();var e,t=this.getCurCharCode();if(ed.isPreprocessorStartChar(t))return this._scanDirectives();if(ed.isAlpha(t))return this._scanWord();if(ed.isDigit(t))return this._scanNum();var r=this.getShaderPosition(),n=this._createToken();switch(this.getCurChar()){case"<":if(this.advance(1),"<"===(e=this.getCurChar())){if(this.advance(1),"="===this.getCurChar()){this.advance(1),n.set(B.LEFT_ASSIGN,"<<=",r);break}n.set(B.LEFT_OP,"<<",r);break}if("="===e){this.advance(1),n.set(B.LE_OP,"<=",r);break}n.set(B.LEFT_ANGLE,"<",r);break;case">":if(this.advance(1),">"===(e=this.getCurChar())){if(this.advance(1),"="===this.getCurChar()){this.advance(1),n.set(B.RIGHT_ASSIGN,">>=",r);break}n.set(B.RIGHT_OP,">>",r);break}if("="===e){this.advance(1),n.set(B.GE_OP,">=",r);break}n.set(B.RIGHT_ANGLE,">",r);break;case"+":if(this.advance(1),"+"===(e=this.getCurChar())){this.advance(1),n.set(B.INC_OP,"++",r);break}if("="===e){this.advance(1),n.set(B.ADD_ASSIGN,"+=",r);break}n.set(B.PLUS,"+",r);break;case"-":if(this.advance(1),"-"===(e=this.getCurChar())){this.advance(1),n.set(B.DEC_OP,"--",r);break}if("="===e){this.advance(1),n.set(B.SUB_ASSIGN,"-=",r);break}n.set(B.DASH,"-",r);break;case"=":if(this.advance(1),"="===this.getCurChar()){this.advance(1),n.set(B.EQ_OP,"==",r);break}n.set(B.EQUAL,"=",r);break;case"!":if(this.advance(1),"="===this.getCurChar()){this.advance(1),n.set(B.NE_OP,"!=",r);break}n.set(B.BANG,"!",r);break;case"&":if(this.advance(1),"&"===(e=this.getCurChar())){this.advance(1),n.set(B.AND_OP,"&&",r);break}if("="===e){this.advance(1),n.set(B.AND_ASSIGN,"&=",r);break}n.set(B.AMPERSAND,"&",r);break;case"|":if(this.advance(1),"|"===(e=this.getCurChar())){this.advance(1),n.set(B.OR_OP,"||",r);break}if("="===e){this.advance(1),n.set(B.OR_ASSIGN,"|=",r);break}n.set(B.VERTICAL_BAR,"|",r);break;case"^":if(this.advance(1),"^"===(e=this.getCurChar())){this.advance(1),n.set(B.XOR_OP,"^^",r);break}if("="===e){this.advance(1),n.set(B.XOR_ASSIGN,"^=",r);break}n.set(B.CARET,"^",r);break;case"*":if(this.advance(1),"="===this.getCurChar()){this.advance(1),n.set(B.MUL_ASSIGN,"*=",r);break}n.set(B.STAR,"*",r);break;case"/":if(this.advance(1),"="===this.getCurChar()){this.advance(1),n.set(B.DIV_ASSIGN,"/=",r);break}n.set(B.SLASH,"/",r);break;case"%":if(this.advance(1),"="===this.getCurChar()){this.advance(1),n.set(B.MOD_ASSIGN,"%=",r);break}n.set(B.PERCENT,"%",r);break;case"(":this.advance(1),n.set(B.LEFT_PAREN,"(",r);break;case")":this.advance(1),n.set(B.RIGHT_PAREN,")",r);break;case"{":this.advance(1),n.set(B.LEFT_BRACE,"{",r);break;case"}":this.advance(1),n.set(B.RIGHT_BRACE,"}",r);break;case"[":this.advance(1),n.set(B.LEFT_BRACKET,"[",r);break;case"]":this.advance(1),n.set(B.RIGHT_BRACKET,"]",r);break;case".":if(this.advance(1),ed.isDigit(this.getCurCharCode()))return this._scanNumAfterDot();n.set(B.DOT,".",r);break;case",":this.advance(1),n.set(B.COMMA,",",r);break;case":":this.advance(1),n.set(B.COLON,":",r);break;case";":this.advance(1),n.set(B.SEMICOLON,";",r);break;case"~":this.advance(1),n.set(B.TILDE,"~",r);break;case"?":this.advance(1),n.set(B.QUESTION,"?",r);break;case'"':return this.advance(1),this._scanStringConst();default:this.throwError(this.getShaderPosition(0),"Unexpected character "+this.getCurChar())}return n},r._scanStringConst=function(){for(var e=this.getShaderPosition(),t=[];'"'!==this.getCurChar();){if(this.isEnd()){var r=this._createPosition(e.index-1,e.line,e.column-1);this.throwError(this._createRange(r,e),"Unterminated string literal.")}t.push(this.getCurChar()),this.advance(1)}this.advance(1);var n=this._createRange(e,this.getShaderPosition()),i=this._createToken();return i.set(B.STRING_CONST,t.join(""),n),i},r._scanNumAfterDot=function(){for(var e=["."];ed.isDigit(this.getCurCharCode());)e.push(this.getCurChar()),this.advance(1);this._scanFloatSuffix(e);var t=this._createToken();return t.set(B.FLOAT_CONSTANT,e.join(""),this.getShaderPosition(e.length)),t},r._scanUtilBreakLine=function(e){for(var r=this._source,n=r.length;!this.isEnd();){var i=t._skipLineContinuation(r,this._currentIndex,n);if(i!==this._currentIndex){this.advance(i-this._currentIndex);continue}if(10===r.charCodeAt(this._currentIndex))break;e.push(r[this._currentIndex]),this.advance(1)}},r._scanDirectives=function(){var e=[this.getCurChar()],r=this.getShaderPosition();for(this.advance(1),this.skipSpace(!1);ed.isAlpha(this.getCurCharCode());)e.push(this.getCurChar()),this.advance(1);var n=this._createToken(),i=e.join("");if("#define"===i){if(!this._isBranchReachable(this._branchStack))return this._scanUtilBreakLine(e),n.set(U.MACRO_DEFINE_EXPRESSION,"\n"+e.join("")+"\n",r),n;var a=this._peekMacroDefine();if(a&&a.isExpression)this._inMacroDefineValue=!0,this._macroDefineExpectsNameToken=!0,n.set(U.MACRO_DEFINE,"#define",r);else{this._scanUtilBreakLine(e);var o="\n"+e.join("")+"\n";a&&this._registerMacroDefine(a.name,a.paramsLexeme,a.valueStart,a.valueEnd),n.set(U.MACRO_DEFINE_EXPRESSION,o,r)}}else{var s=t._lexemeTable[i];n.set(null!=s?s:B.ID,i,r),("#if"===i||"#elif"===i)&&(this._needScanMacroConditionExpression=!0)}return n},r._isAtLineBreak=function(){var e=this.getCurChar();return"\n"===e||"\r"===e},r._peekMacroDefine=function(){var e,r=this._source,n=r.length,i=t._skipNonSemantic(r,this._currentIndex,n);if(!(i<n&&ed.isAlpha(r.charCodeAt(i))))return null;for(var a=i;i<n&&ed.isAlnum(r.charCodeAt(i));)i++;var o=r.slice(a,i);if(i<n&&40===r.charCodeAt(i)){var s=i,c=1;for(i++;i<n&&c>0&&!((i=t._skipNonSemantic(r,i,n))>=n);){var u=r.charCodeAt(i);if(10===u||13===u)return{name:o,paramsLexeme:void 0,valueStart:i,valueEnd:i,isExpression:!1};40===u?c++:41===u&&c--,i++}e=r.slice(s,i)}for(var l=i,h=0,d=0,p=-1,f=-1,_=!1,v=-1;i<n;){var m=t._skipNonSemantic(r,i,n);if(m!==i){i=m;continue}var g=r.charCodeAt(i);if(10===g||13===g)break;if(-1===p&&(p=i,ed.isAlpha(g))){for(;i<n&&ed.isAlnum(r.charCodeAt(i));)i++;f=i;var y=t._skipNonSemantic(r,i,n);_=y<n&&40===r.charCodeAt(y),v=f-1;continue}40===g?h++:41===g?h--:91===g?d++:93===g&&d--,0===h&&0===d&&(v=i),i++}var S={name:o,paramsLexeme:e,valueStart:l,valueEnd:i,isExpression:!1};if(-1===p||-1!==f&&!_&&t._isNonExpressionLeadingKeyword(r.slice(p,f)))return S;var b=r.charCodeAt(p),x=v>=0?r.charCodeAt(v):0,E=!ed.isAlnum(b)&&40!==b&&46!==b&&45!==b&&43!==b&&33!==b&&126!==b,C=!ed.isAlnum(x)&&41!==x&&93!==x;return 0!==h||0!==d||E||C||(S.isExpression=!0),S},r._skipInlineSpaceAndComments=function(){var e=t._skipNonSemantic(this._source,this._currentIndex,this._source.length);e>this._currentIndex&&this.advance(e-this._currentIndex)},r._scanMacroDefineParams=function(){for(var e=this.getShaderPosition(),r=this._source,n=r.length,i=[],a=0;this._currentIndex<n;){var o=t._skipLineContinuation(r,this._currentIndex,n);if(o!==this._currentIndex){this.advance(o-this._currentIndex);continue}var s=r[this._currentIndex];if(i.push(s),"("===s)a++;else if(")"===s){if(a--,this.advance(1),0===a)break;continue}this.advance(1)}var c=this._createToken(),u=i.join("");return this._currentMacroParamsLexeme=u,this._currentMacroValueStart=this._currentIndex,c.set(U.MACRO_DEFINE_PARAMS,u,e),c},r._emitMacroDefineEnd=function(){var e=this.getShaderPosition(),t=this._currentIndex,r=this._source;if(this._currentIndex<r.length){var n=r.charCodeAt(this._currentIndex);13===n&&10===r.charCodeAt(this._currentIndex+1)?this.advance(2):(10===n||13===n)&&this.advance(1)}this._registerMacroDefine(this._currentMacroName,this._currentMacroParamsLexeme,this._currentMacroValueStart,t),this._inMacroDefineValue=!1;var i=this._createToken();return i.set(U.MACRO_DEFINE_END,"\n",e),i},r._registerMacroDefine=function(e,r,n,i){var a=r?r.slice(1,-1).split(",").map(function(e){return e.trim()}).filter(Boolean):[],o=(null!=r?r:"")+"="+t._normalizeValueText(this._source,n,i),s={isFunction:void 0!==r,params:a,dedupKey:o,branch:this._captureBranchSignature()},c=this.macroDefineList[e];if(c){for(var u=!1,l=0,h=c.length;l<h;l++){var d=c[l];if(d.dedupKey===o&&this._sameDefinitionBranch(d.branch,s.branch)){u=!0;break}}u||c.push(s)}else this.macroDefineList[e]=[s]},r._captureBranchSignature=function(){var e=this._branchStack,t=this._branchSnapshot;if(e.length===t.length){for(var r=!0,n=0;n<e.length;n++)if(e[n]!==t[n]){r=!1;break}if(r)return t}return this._branchSnapshot=0===e.length?K:e.slice()},r._scanMacroConditionExpression=function(){for(var e=[],r=this.getShaderPosition(),n=this._source;!this.isEnd();){var i=t._skipLineContinuation(n,this._currentIndex,n.length);if(i!==this._currentIndex){for(;this._currentIndex<i;){var a=n[this._currentIndex];e.push("\\"===a?" ":a),this.advance(1)}continue}if(10===n.charCodeAt(this._currentIndex))break;e.push(n[this._currentIndex]),this.advance(1)}var o=e.join(""),s=S(o),c=o.replace(/[\r\n]/g," ");this.preprocessorExpressions.set(c.trim(),s);var u=this._createToken();return u.set(U.MACRO_CONDITIONAL_EXPRESSION,c,r),u},r._scanWord=function(){var e=[this.getCurChar()],r=this.getShaderPosition();for(this.advance(1);ed.isAlnum(this.getCurCharCode());)e.push(this.getCurChar()),this.advance(1);var n=this._createToken(),i=e.join(""),a=t._lexemeTable[i];return this._macroDefineExpectsNameToken?(this._macroDefineExpectsNameToken=!1,this._currentMacroName=i,this._currentMacroParamsLexeme=void 0,this._inMacroDefineValue&&(this._macroDefineExpectsParamsToken="("===this.getCurChar(),this._currentMacroValueStart=this._currentIndex),n.set(B.ID,i,r)):this._isVisibleMacro(i)?n.set(U.MACRO_CALL,i,r):n.set(null!=a?a:B.ID,i,r),n},r._isVisibleMacro=function(e){var t=this.macroDefineList[e];if(!t||0===t.length)return!1;for(var r=this._branchStack,n=0,i=t.length;n<i;n++)if(this._branchesOverlap(t[n].branch,r))return!0;return!1},r._scanNum=function(){var e=[];if("0"===this.getCurChar()){var t=this._source.charCodeAt(this._currentIndex+1);if(120===t||88===t){for(e.push(this.getCurChar()),this.advance(1),e.push(this.getCurChar()),this.advance(1);ed.isHexDigit(this.getCurCharCode());)e.push(this.getCurChar()),this.advance(1);2===e.length&&this.throwError(this.getShaderPosition(0),"lexing error, hex literal needs at least one digit."),this._scanIntegerSuffix(e);var r=this._createToken();return r.set(B.INT_CONSTANT,e.join(""),this.getShaderPosition(e.length)),r}}for(;ed.isDigit(this.getCurCharCode());)e.push(this.getCurChar()),this.advance(1);var n=this.getCurChar();if("."===n){for(e.push(n),this.advance(1);ed.isDigit(this.getCurCharCode());)e.push(this.getCurChar()),this.advance(1);this._scanFloatSuffix(e);var i=this._createToken();return i.set(B.FLOAT_CONSTANT,e.join(""),this.getShaderPosition(e.length)),i}if("e"===n||"E"===n){this._scanFloatSuffix(e);var a=this._createToken();return a.set(B.FLOAT_CONSTANT,e.join(""),this.getShaderPosition(e.length)),a}if("f"===n||"F"===n){e.push(n),this.advance(1);var o=this._createToken();return o.set(B.FLOAT_CONSTANT,e.join(""),this.getShaderPosition(e.length)),o}this._scanIntegerSuffix(e);var s=this._createToken();return s.set(B.INT_CONSTANT,e.join(""),this.getShaderPosition(e.length)),s},r._scanFloatSuffix=function(e){var t=this.getCurChar();if("e"===t||"E"===t){e.push(t),this.advance(1),("+"===(t=this.getCurChar())||"-"===t)&&(e.push(t),this.advance(1),t=this.getCurChar()),ed.isDigit(this.getCurCharCode())||this.throwError(this.getShaderPosition(0),"lexing error, invalid exponent suffix.");do e.push(t),this.advance(1),t=this.getCurChar();while(ed.isDigit(this.getCurCharCode()))}("f"===t||"F"===t)&&(e.push(t),this.advance(1))},r._scanIntegerSuffix=function(e){var t=this.getCurChar();("u"===t||"U"===t)&&(e.push(t),this.advance(1))},t._isCodegenBranchReachable=function(e){for(var t=0;t<e.length;t++){var r=e[t].condition;if((null==r?void 0:r.kind)==="constant"&&!r.value)return!1}return!0},t._isNonExpressionLeadingKeyword=function(e){var r=t._lexemeTable[e];return void 0!==r&&r!==U.True&&r!==U.False&&!e.startsWith("#")},t._skipLineContinuation=function(e,t,r){if(92!==e.charCodeAt(t)||t+1>=r)return t;var n=e.charCodeAt(t+1);return 10===n?t+2:13===n?t+2<r&&10===e.charCodeAt(t+2)?t+3:t+2:t},t._skipNonSemantic=function(e,r,n){for(var i=r;i<n;){var a=e.charCodeAt(i);if(32===a||9===a){i++;continue}var o=t._skipLineContinuation(e,i,n);if(o!==i){i=o;continue}var s=t._skipBlockComment(e,i,n);if(s!==i){i=s;continue}var c=t._skipLineComment(e,i,n);if(c!==i){i=c;continue}break}return i},t._normalizeValueText=function(e,r,n){for(var i="",a=r,o=!1;a<n;){var s=t._skipNonSemantic(e,a,n);if(s!==a){o=i.length>0,a=s;continue}var c=e.charCodeAt(a);if(32===c||9===c){o=i.length>0,a++;continue}o&&(i+=" ",o=!1),i+=e[a],a++}return i},t._sameCodegenBranch=function(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(e[r].conditionalGroup!==t[r].conditionalGroup||e[r].conditionalArm!==t[r].conditionalArm)return!1;return!0},t}(ed);ez._lexemeTable={const:U.CONST,bool:U.BOOL,float:U.FLOAT,double:U.DOUBLE,int:U.INT,uint:U.UINT,break:U.BREAK,continue:U.CONTINUE,do:U.DO,else:U.ELSE,for:U.FOR,if:U.IF,while:U.WHILE,discard:U.DISCARD,return:U.RETURN,bvec2:U.BVEC2,bvec3:U.BVEC3,bvec4:U.BVEC4,ivec2:U.IVEC2,ivec3:U.IVEC3,ivec4:U.IVEC4,uvec2:U.UVEC2,uvec3:U.UVEC3,uvec4:U.UVEC4,vec2:U.VEC2,vec3:U.VEC3,vec4:U.VEC4,mat2:U.MAT2,mat3:U.MAT3,mat4:U.MAT4,mat2x3:U.MAT2X3,mat2x4:U.MAT2X4,mat3x2:U.MAT3X2,mat3x4:U.MAT3X4,mat4x2:U.MAT4X2,mat4x3:U.MAT4X3,in:U.IN,out:U.OUT,inout:U.INOUT,sampler2D:U.SAMPLER2D,samplerCube:U.SAMPLER_CUBE,sampler3D:U.SAMPLER3D,sampler2DShadow:U.SAMPLER2D_SHADOW,samplerCubeShadow:U.SAMPLER_CUBE_SHADOW,sampler2DArray:U.SAMPLER2D_ARRAY,sampler2DArrayShadow:U.SAMPLER2D_ARRAY_SHADOW,isampler2D:U.I_SAMPLER2D,isampler3D:U.I_SAMPLER3D,isamplerCube:U.I_SAMPLER_CUBE,isampler2DArray:U.I_SAMPLER2D_ARRAY,usampler2D:U.U_SAMPLER2D,usampler3D:U.U_SAMPLER3D,usamplerCube:U.U_SAMPLER_CUBE,usampler2DArray:U.U_SAMPLER2D_ARRAY,struct:U.STRUCT,void:U.VOID,true:U.True,false:U.False,precision:U.PRECISION,precise:U.PRECISE,highp:U.HIGHP,mediump:U.MEDIUMP,lowp:U.LOWP,invariant:U.INVARIANT,flat:U.FLAT,smooth:U.SMOOTH,noperspective:U.NOPERSPECTIVE,centroid:U.CENTROID,layout:U.LAYOUT,location:U.LOCATION,"#if":U.MACRO_IF,"#ifdef":U.MACRO_IFDEF,"#ifndef":U.MACRO_IFNDEF,"#else":U.MACRO_ELSE,"#elif":U.MACRO_ELIF,"#endif":U.MACRO_ENDIF,"#undef":U.MACRO_UNDEF};var eW=((h={})[h.START=2e3]="START",h[h.gs_shader_program=2001]="gs_shader_program",h[h.global_declaration=2002]="global_declaration",h[h.variable_declaration=2003]="variable_declaration",h[h.variable_declaration_list=2004]="variable_declaration_list",h[h.variable_declaration_statement=2005]="variable_declaration_statement",h[h.array_specifier_list=2006]="array_specifier_list",h[h.array_specifier=2007]="array_specifier",h[h.ext_builtin_type_specifier_nonarray=2008]="ext_builtin_type_specifier_nonarray",h[h.precision_specifier=2009]="precision_specifier",h[h.variable_identifier=2010]="variable_identifier",h[h.variable_identifier_node=2011]="variable_identifier_node",h[h.primary_expression=2012]="primary_expression",h[h.postfix_expression=2013]="postfix_expression",h[h.integer_expression=2014]="integer_expression",h[h.function_call=2015]="function_call",h[h.function_call_generic=2016]="function_call_generic",h[h.function_call_header_no_parameters=2017]="function_call_header_no_parameters",h[h.function_call_header_with_parameters=2018]="function_call_header_with_parameters",h[h.function_call_parameter_list=2019]="function_call_parameter_list",h[h.function_call_header=2020]="function_call_header",h[h.function_identifier=2021]="function_identifier",h[h.constructor_identifier=2022]="constructor_identifier",h[h.unary_expression=2023]="unary_expression",h[h.unary_operator=2024]="unary_operator",h[h.multiplicative_expression=2025]="multiplicative_expression",h[h.additive_expression=2026]="additive_expression",h[h.shift_expression=2027]="shift_expression",h[h.relational_expression=2028]="relational_expression",h[h.equality_expression=2029]="equality_expression",h[h.and_expression=2030]="and_expression",h[h.inclusive_or_expression=2031]="inclusive_or_expression",h[h.exclusive_or_expression=2032]="exclusive_or_expression",h[h.logical_and_expression=2033]="logical_and_expression",h[h.logical_xor_expression=2034]="logical_xor_expression",h[h.logical_or_expression=2035]="logical_or_expression",h[h.conditional_expression=2036]="conditional_expression",h[h.assignment_expression=2037]="assignment_expression",h[h.assignment_operator=2038]="assignment_operator",h[h.expression=2039]="expression",h[h.integer_constant_expression=2040]="integer_constant_expression",h[h.integer_constant_expression_operator=2041]="integer_constant_expression_operator",h[h.declaration=2042]="declaration",h[h.function_prototype=2043]="function_prototype",h[h.function_declarator=2044]="function_declarator",h[h.function_header_with_parameters=2045]="function_header_with_parameters",h[h.function_header=2046]="function_header",h[h.function_parameter_list=2047]="function_parameter_list",h[h.parameter_declarator=2048]="parameter_declarator",h[h.parameter_declaration=2049]="parameter_declaration",h[h.parameter_qualifier=2050]="parameter_qualifier",h[h.parameter_type_specifier=2051]="parameter_type_specifier",h[h.init_declarator_list=2052]="init_declarator_list",h[h.single_declaration=2053]="single_declaration",h[h.fully_specified_type=2054]="fully_specified_type",h[h.type_qualifier=2055]="type_qualifier",h[h.single_type_qualifier=2056]="single_type_qualifier",h[h.storage_qualifier=2057]="storage_qualifier",h[h.precision_qualifier=2058]="precision_qualifier",h[h.interpolation_qualifier=2059]="interpolation_qualifier",h[h.invariant_qualifier=2060]="invariant_qualifier",h[h.type_specifier=2061]="type_specifier",h[h.type_specifier_nonarray=2062]="type_specifier_nonarray",h[h.type_specifier_no_prec=2063]="type_specifier_no_prec",h[h.basic_type=2064]="basic_type",h[h.struct_specifier=2065]="struct_specifier",h[h.struct_declaration_list=2066]="struct_declaration_list",h[h.struct_declaration=2067]="struct_declaration",h[h.layout_qualifier=2068]="layout_qualifier",h[h.struct_declarator_list=2069]="struct_declarator_list",h[h.struct_declarator=2070]="struct_declarator",h[h.identifier_list=2071]="identifier_list",h[h.decl_identifier=2072]="decl_identifier",h[h.initializer=2073]="initializer",h[h.initializer_list=2074]="initializer_list",h[h.declaration_statement=2075]="declaration_statement",h[h.simple_statement=2076]="simple_statement",h[h.compound_statement_no_scope=2077]="compound_statement_no_scope",h[h.statement_with_scope=2078]="statement_with_scope",h[h.compound_statement=2079]="compound_statement",h[h.statement=2080]="statement",h[h.statement_list=2081]="statement_list",h[h.iteration_statement_no_new_scope=2082]="iteration_statement_no_new_scope",h[h.expression_statement=2083]="expression_statement",h[h.selection_statement=2084]="selection_statement",h[h.selection_rest_statement=2085]="selection_rest_statement",h[h.condition=2086]="condition",h[h.conditionopt=2087]="conditionopt",h[h.iteration_statement=2088]="iteration_statement",h[h.for_init_statement=2089]="for_init_statement",h[h.for_rest_statement=2090]="for_rest_statement",h[h.jump_statement=2091]="jump_statement",h[h.external_declaration=2092]="external_declaration",h[h.function_definition=2093]="function_definition",h[h.field_selection=2094]="field_selection",h[h.bool_constant=2095]="bool_constant",h[h.function_identifier_node=2096]="function_identifier_node",h[h.typename_identifier_node=2097]="typename_identifier_node",h[h.scope_brace=2098]="scope_brace",h[h.scope_end_brace=2099]="scope_end_brace",h[h.macro_undef=2100]="macro_undef",h[h.macro_push_context=2101]="macro_push_context",h[h.macro_pop_context=2102]="macro_pop_context",h[h.macro_elif_expression=2103]="macro_elif_expression",h[h.macro_else_expression=2104]="macro_else_expression",h[h.global_macro_if_statement=2105]="global_macro_if_statement",h[h.global_macro_declaration=2106]="global_macro_declaration",h[h.global_macro_branch=2107]="global_macro_branch",h[h.macro_struct_declaration=2108]="macro_struct_declaration",h[h.macro_struct_branch=2109]="macro_struct_branch",h[h.macro_if_statement=2110]="macro_if_statement",h[h.macro_branch=2111]="macro_branch",h[h.macro_param_case_list=2112]="macro_param_case_list",h[h.macro_param_block=2113]="macro_param_block",h[h.macro_parameter_branch=2114]="macro_parameter_branch",h[h.macro_call_arg_case_list=2115]="macro_call_arg_case_list",h[h.macro_call_arg_block=2116]="macro_call_arg_block",h[h.macro_call_arg_branch=2117]="macro_call_arg_branch",h[h.macro_call_symbol=2118]="macro_call_symbol",h[h.macro_call_function=2119]="macro_call_function",h[h.macro_define=2120]="macro_define",h[h._ignore=2121]="_ignore",h),ej=function e(t,r){this.goal=t,this.derivation=r,this.id=e._id++,e.pool.set(this.id,this)};ej._id=0,ej.pool=new Map,(d={})[d.GenType=200]="GenType",d[d.GenIntType=201]="GenIntType",d[d.GenUintType=202]="GenUintType",d[d.GenBoolType=203]="GenBoolType",d[d.Mat=204]="Mat",d[d.BoolVec=205]="BoolVec",d[d.IntVec=206]="IntVec",d[d.UintVec=207]="UintVec",d[d.Vec=208]="Vec",d[d.GVec4=209]="GVec4",d[d.GSampler2D=210]="GSampler2D",d[d.GSampler3D=211]="GSampler3D",d[d.GSamplerCube=212]="GSamplerCube",d[d.GSampler2DArray=213]="GSampler2DArray";var eq=((m={})[200]={dimension:0,members:[U.FLOAT,U.VEC2,U.VEC3,U.VEC4]},m[201]={dimension:0,members:[U.INT,U.IVEC2,U.IVEC3,U.IVEC4]},m[202]={dimension:0,members:[U.UINT,U.UVEC2,U.UVEC3,U.UVEC4]},m[203]={dimension:0,members:[U.BOOL,U.BVEC2,U.BVEC3,U.BVEC4]},m[208]={dimension:0,members:[U.VEC2,U.VEC3,U.VEC4]},m[206]={dimension:0,members:[U.IVEC2,U.IVEC3,U.IVEC4]},m[207]={dimension:0,members:[U.UVEC2,U.UVEC3,U.UVEC4]},m[205]={dimension:0,members:[U.BVEC2,U.BVEC3,U.BVEC4]},m[204]={dimension:0,members:[U.MAT2,U.MAT3,U.MAT4]},m[210]={dimension:1,members:[U.SAMPLER2D,U.I_SAMPLER2D,U.U_SAMPLER2D]},m[211]={dimension:1,members:[U.SAMPLER3D,U.I_SAMPLER3D,U.U_SAMPLER3D]},m[212]={dimension:1,members:[U.SAMPLER_CUBE,U.I_SAMPLER_CUBE,U.U_SAMPLER_CUBE]},m[213]={dimension:1,members:[U.SAMPLER2D_ARRAY,U.I_SAMPLER2D_ARRAY,U.U_SAMPLER2D_ARRAY]},m[209]={dimension:1,members:[U.VEC4,U.IVEC4,U.UVEC4]},m),eH=new Map,eX=function(){function e(e,t,r){for(var n=arguments.length,i=Array(n>3?n-3:0),a=3;a<n;a++)i[a-3]=arguments[a];this.ident=e,this._returnType=t,this.args=i,this.scope=r}return e._create=function(t,r){for(var n,i=arguments.length,a=Array(i>2?i-2:0),o=2;o<i;o++)a[o-2]=arguments[o];var s=eo(e,[].concat([t,r,eG.ALL],a)),c=null!=(n=eH.get(t))?n:[];c.push(s),eH.set(t,c)},e._createWithScope=function(t,r,n){for(var i,a=arguments.length,o=Array(a>3?a-3:0),s=3;s<a;s++)o[s-3]=arguments[s];var c=eo(e,[].concat([t,r,n],o)),u=null!=(i=eH.get(t))?i:[];u.push(c),eH.set(t,u)},e.resolveOverload=function(e,t){var r,n=eH.get(e);if(n)for(var i=null!=(r=null==t?void 0:t.length)?r:0,a=0,o=n.length;a<o;a++){var s=n[a],c=s.args;if(c.length===i){for(var u=-1,l=-1,h=!0,d=!1,p=!1,f=0;f<i;f++){var _=c[f],v=t[f],m=eq[_];if(3e3===v){m&&(0===m.dimension?d=!0:p=!0);continue}if(m){var g=m.members.indexOf(v);if(-1===g){h=!1;break}if(0===m.dimension){if(-1===u)u=g;else if(u!==g){h=!1;break}}else if(-1===l)l=g;else if(l!==g){h=!1;break}}else if(_!==v){h=!1;break}}if(h){var y=eq[s._returnType];if(!y)return s._realReturnType=s._returnType,s;var S=0===y.dimension,b=S?d:p,x=S?u:l;return s._realReturnType=-1===x||b?3e3:y.members[x],s}}}},e.isExist=function(e){return eH.has(e)},er(e,[{key:"realReturnType",get:function(){return this._realReturnType}}]),e}();eX._create("radians",200,200),eX._create("degrees",200,200),eX._create("sin",200,200),eX._create("cos",200,200),eX._create("tan",200,200),eX._create("asin",200,200),eX._create("acos",200,200),eX._create("atan",200,200,200),eX._create("atan",200,200),eX._create("sinh",200,200),eX._create("cosh",200,200),eX._create("tanh",200,200),eX._create("asinh",200,200),eX._create("acosh",200,200),eX._create("atanh",200,200),eX._create("pow",200,200,200),eX._create("exp",200,200),eX._create("log",200,200),eX._create("exp2",200,200),eX._create("log2",200,200),eX._create("sqrt",200,200),eX._create("inversesqrt",200,200),eX._create("abs",200,200),eX._create("abs",201,201),eX._create("sign",200,200),eX._create("sign",201,201),eX._create("floor",200,200),eX._create("trunc",200,200),eX._create("round",200,200),eX._create("roundEven",200,200),eX._create("ceil",200,200),eX._create("fract",200,200),eX._create("mod",200,200,U.FLOAT),eX._create("mod",200,200,200),eX._create("min",200,200,200),eX._create("min",200,200,U.FLOAT),eX._create("min",201,201,201),eX._create("min",201,201,U.INT),eX._create("min",202,202,202),eX._create("min",202,202,U.UINT),eX._create("max",200,200,200),eX._create("max",200,200,U.FLOAT),eX._create("max",201,201,201),eX._create("max",201,201,U.INT),eX._create("clamp",200,200,200,200),eX._create("clamp",200,200,U.FLOAT,U.FLOAT),eX._create("clamp",201,201,201,201),eX._create("clamp",201,201,U.INT,U.INT),eX._create("clamp",202,202,202,202),eX._create("clamp",202,202,U.UINT,U.UINT),eX._create("mix",200,200,200,200),eX._create("mix",200,200,200,U.FLOAT),eX._create("mix",200,200,200,203),eX._create("step",200,200,200),eX._create("step",200,U.FLOAT,200),eX._create("smoothstep",200,200,200,200),eX._create("smoothstep",200,U.FLOAT,U.FLOAT,200),eX._create("isnan",203,200),eX._create("isinf",203,200),eX._create("floatBitsToInt",200,200),eX._create("floatBitsToUint",202,200),eX._create("intBitsToFloat",200,201),eX._create("uintBitsToFloat",200,202),eX._create("packSnorm2x16",U.UINT,U.VEC2),eX._create("unpackSnorm2x16",U.VEC2,U.UINT),eX._create("packUnorm2x16",U.UINT,U.VEC2),eX._create("unpackUnorm2x16",U.VEC2,U.UINT),eX._create("packHalf2x16",U.UINT,U.VEC2),eX._create("unpackHalf2x16",U.VEC2,U.UINT),eX._create("length",U.FLOAT,200),eX._create("distance",U.FLOAT,200,200),eX._create("dot",U.FLOAT,200,200),eX._create("cross",U.VEC3,U.VEC3,U.VEC3),eX._create("normalize",200,200),eX._create("faceforward",200,200,200,200),eX._create("reflect",200,200,200),eX._create("refract",200,200,200,U.FLOAT),eX._create("matrixCompMult",204,204,204),eX._create("outerProduct",U.MAT2,U.VEC2,U.VEC2),eX._create("outerProduct",U.MAT3,U.VEC3,U.VEC3),eX._create("outerProduct",U.MAT4,U.VEC4,U.VEC4),eX._create("outerProduct",U.MAT2X3,U.VEC3,U.VEC2),eX._create("outerProduct",U.MAT3X2,U.VEC2,U.VEC3),eX._create("outerProduct",U.MAT2X4,U.VEC4,U.VEC2),eX._create("outerProduct",U.MAT4X2,U.VEC2,U.VEC4),eX._create("outerProduct",U.MAT3X4,U.VEC4,U.VEC3),eX._create("outerProduct",U.MAT4X3,U.VEC3,U.VEC4),eX._create("transpose",U.MAT2,U.MAT2),eX._create("transpose",U.MAT3,U.MAT3),eX._create("transpose",U.MAT4,U.MAT4),eX._create("transpose",U.MAT2X3,U.MAT3X2),eX._create("transpose",U.MAT3X2,U.MAT2X3),eX._create("transpose",U.MAT4X2,U.MAT2X4),eX._create("transpose",U.MAT2X4,U.MAT4X2),eX._create("transpose",U.MAT3X4,U.MAT4X3),eX._create("transpose",U.MAT4X3,U.MAT3X4),eX._create("determinant",U.FLOAT,U.MAT2),eX._create("determinant",U.FLOAT,U.MAT3),eX._create("determinant",U.FLOAT,U.MAT4),eX._create("inverse",U.MAT2,U.MAT2),eX._create("inverse",U.MAT3,U.MAT3),eX._create("inverse",U.MAT4,U.MAT4),eX._create("lessThan",205,208,208),eX._create("lessThan",205,206,206),eX._create("lessThan",205,207,207),eX._create("lessThanEqual",205,208,208),eX._create("lessThanEqual",205,206,206),eX._create("lessThanEqual",205,207,207),eX._create("greaterThan",205,208,208),eX._create("greaterThan",205,206,206),eX._create("greaterThan",205,207,207),eX._create("greaterThanEqual",205,208,208),eX._create("greaterThanEqual",205,206,206),eX._create("greaterThanEqual",205,207,207),eX._create("equal",205,208,208),eX._create("equal",205,206,206),eX._create("equal",205,207,207),eX._create("equal",205,205,205),eX._create("notEqual",205,208,208),eX._create("notEqual",205,206,206),eX._create("notEqual",205,207,207),eX._create("notEqual",205,205,205),eX._create("any",U.BOOL,205),eX._create("all",U.BOOL,205),eX._create("not",205,205),eX._create("textureSize",U.IVEC2,210,U.INT),eX._create("textureSize",U.IVEC3,211,U.INT),eX._create("textureSize",U.IVEC2,212,U.INT),eX._create("textureSize",U.IVEC2,U.SAMPLER2D_SHADOW,U.INT),eX._create("textureSize",U.IVEC2,U.SAMPLER_CUBE_SHADOW,U.INT),eX._create("textureSize",U.IVEC3,213,U.INT),eX._create("textureSize",U.IVEC3,U.SAMPLER2D_ARRAY_SHADOW,U.INT),eX._create("texture2D",209,210,U.VEC2),eX._create("texture2D",209,210,U.VEC2,U.FLOAT),eX._create("texture",209,210,U.VEC2,U.FLOAT),eX._create("texture",209,210,U.VEC2),eX._create("texture",209,211,U.VEC3,U.FLOAT),eX._create("texture",209,211,U.VEC3),eX._create("texture",209,212,U.VEC3,U.FLOAT),eX._create("texture",209,212,U.VEC3),eX._create("texture",U.FLOAT,U.SAMPLER2D_SHADOW,U.VEC3,U.FLOAT),eX._create("texture",U.FLOAT,U.SAMPLER2D_SHADOW,U.VEC3),eX._create("texture",U.FLOAT,U.SAMPLER_CUBE_SHADOW,U.VEC4,U.FLOAT),eX._create("texture",U.FLOAT,U.SAMPLER_CUBE_SHADOW,U.VEC4),eX._create("texture",209,U.SAMPLER2D_ARRAY,U.VEC3,U.FLOAT),eX._create("texture",209,U.SAMPLER2D_ARRAY,U.VEC3),eX._create("texture",U.FLOAT,U.SAMPLER2D_ARRAY_SHADOW,U.VEC4),eX._create("textureProj",209,210,U.VEC3,U.FLOAT),eX._create("textureProj",209,210,U.VEC3),eX._create("textureProj",209,210,U.VEC4,U.FLOAT),eX._create("textureProj",209,210,U.VEC4),eX._create("textureProj",209,211,U.VEC4,U.FLOAT),eX._create("textureProj",209,211,U.VEC4),eX._create("textureProj",U.FLOAT,U.SAMPLER2D_SHADOW,U.VEC4,U.FLOAT),eX._create("textureProj",U.FLOAT,U.SAMPLER2D_SHADOW,U.VEC4),eX._create("textureLod",209,210,U.VEC2,U.FLOAT),eX._create("textureLod",209,211,U.VEC3,U.FLOAT),eX._create("textureLod",209,212,U.VEC3,U.FLOAT),eX._create("textureLod",U.FLOAT,U.SAMPLER2D_SHADOW,U.VEC3,U.FLOAT),eX._create("textureLod",209,213,U.VEC3,U.FLOAT),eX._create("texture2DLod",209,210,U.VEC2,U.FLOAT),eX._create("texture2DLodEXT",209,210,U.VEC2,U.FLOAT),eX._create("texture2DLodEXT",209,211,U.VEC3,U.FLOAT),eX._create("textureCube",209,212,U.VEC3),eX._create("textureCube",209,212,U.VEC3,U.FLOAT),eX._create("textureCubeLod",209,212,U.VEC3,U.FLOAT),eX._create("textureCubeLodEXT",209,212,U.VEC3,U.FLOAT),eX._create("textureOffset",209,210,U.VEC2,U.IVEC2,U.FLOAT),eX._create("textureOffset",209,210,U.VEC2,U.IVEC2),eX._create("textureOffset",209,211,U.VEC3,U.IVEC3,U.FLOAT),eX._create("textureOffset",209,211,U.VEC3,U.IVEC3),eX._create("textureOffset",U.FLOAT,U.SAMPLER2D_SHADOW,U.VEC3,U.IVEC2,U.FLOAT),eX._create("textureOffset",U.FLOAT,U.SAMPLER2D_SHADOW,U.VEC3,U.IVEC2),eX._create("textureOffset",209,213,U.VEC3,U.IVEC2,U.FLOAT),eX._create("textureOffset",209,213,U.VEC3,U.IVEC2),eX._create("texelFetch",209,210,U.IVEC2,U.INT),eX._create("texelFetch",209,211,U.IVEC3,U.INT),eX._create("texelFetch",209,213,U.IVEC3,U.INT),eX._create("texelFetchOffset",209,210,U.IVEC2,U.INT,U.IVEC2),eX._create("texelFetchOffset",209,211,U.IVEC3,U.INT,U.IVEC3),eX._create("texelFetchOffset",209,213,U.IVEC3,U.INT,U.IVEC2),eX._create("textureProjOffset",209,210,U.VEC3,U.IVEC2,U.FLOAT),eX._create("textureProjOffset",209,210,U.VEC3,U.IVEC2),eX._create("textureProjOffset",209,210,U.VEC4,U.IVEC2,U.FLOAT),eX._create("textureProjOffset",209,210,U.VEC4,U.IVEC2),eX._create("textureProjOffset",209,211,U.VEC4,U.IVEC3,U.FLOAT),eX._create("textureProjOffset",209,211,U.VEC4,U.IVEC3),eX._create("textureProjOffset",U.FLOAT,U.SAMPLER2D_SHADOW,U.VEC4,U.IVEC2,U.FLOAT),eX._create("textureProjOffset",U.FLOAT,U.SAMPLER2D_SHADOW,U.VEC4,U.IVEC2),eX._create("textureLodOffset",209,210,U.VEC2,U.FLOAT,U.IVEC2),eX._create("textureLodOffset",209,211,U.VEC3,U.FLOAT,U.IVEC3),eX._create("textureLodOffset",U.FLOAT,U.SAMPLER2D_SHADOW,U.VEC3,U.FLOAT,U.IVEC2),eX._create("textureLodOffset",209,213,U.VEC3,U.FLOAT,U.IVEC2),eX._create("textureProjLod",209,210,U.VEC3,U.FLOAT),eX._create("textureProjLod",209,210,U.VEC4,U.FLOAT),eX._create("textureProjLod",209,211,U.VEC4,U.FLOAT),eX._create("textureProjLod",U.FLOAT,U.SAMPLER2D_SHADOW,U.VEC4,U.FLOAT),eX._create("textureProjLodOffset",209,210,U.VEC3,U.FLOAT,U.IVEC2),eX._create("textureProjLodOffset",209,210,U.VEC4,U.FLOAT,U.IVEC2),eX._create("textureProjLodOffset",209,211,U.VEC4,U.FLOAT,U.IVEC3),eX._create("textureProjLodOffset",U.FLOAT,U.SAMPLER2D_SHADOW,U.VEC4,U.FLOAT,U.IVEC2),eX._create("textureGrad",209,210,U.VEC2,U.VEC2,U.VEC2),eX._create("textureGrad",209,211,U.VEC3,U.VEC3,U.VEC3),eX._create("textureGrad",209,212,U.VEC3,U.VEC3,U.VEC3),eX._create("textureGrad",U.FLOAT,U.SAMPLER2D_SHADOW,U.VEC3,U.VEC2,U.VEC2),eX._create("textureGrad",U.FLOAT,U.SAMPLER_CUBE_SHADOW,U.VEC4,U.VEC3,U.VEC3),eX._create("textureGrad",209,213,U.VEC3,U.VEC2,U.VEC2),eX._create("textureGrad",U.FLOAT,U.SAMPLER2D_ARRAY_SHADOW,U.VEC4,U.VEC2,U.VEC2),eX._create("textureGradOffset",209,210,U.VEC2,U.VEC2,U.VEC2,U.IVEC2),eX._create("textureGradOffset",209,211,U.VEC3,U.VEC3,U.VEC3,U.IVEC3),eX._create("textureGradOffset",U.FLOAT,U.SAMPLER2D_SHADOW,U.VEC3,U.VEC2,U.VEC2,U.IVEC2),eX._create("textureGradOffset",209,213,U.VEC3,U.VEC2,U.VEC2,U.IVEC2),eX._create("textureGradOffset",U.FLOAT,U.SAMPLER2D_ARRAY_SHADOW,U.VEC3,U.VEC2,U.VEC2,U.IVEC2),eX._create("textureProjGrad",209,210,U.VEC3,U.VEC2,U.VEC2),eX._create("textureProjGrad",209,210,U.VEC4,U.VEC2,U.VEC2),eX._create("textureProjGrad",209,211,U.VEC4,U.VEC3,U.VEC3),eX._create("textureProjGrad",U.FLOAT,U.SAMPLER2D_SHADOW,U.VEC4,U.VEC2,U.VEC2),eX._create("textureProjGradOffset",209,210,U.VEC3,U.VEC2,U.VEC2,U.IVEC2),eX._create("textureProjGradOffset",209,210,U.VEC4,U.VEC2,U.VEC2,U.IVEC2),eX._create("textureProjGradOffset",209,211,U.VEC4,U.VEC3,U.VEC3,U.IVEC3),eX._create("textureProjGradOffset",U.FLOAT,U.SAMPLER2D_SHADOW,U.VEC4,U.VEC2,U.VEC2,U.IVEC2),eX._createWithScope("dFdx",200,eG.FRAGMENT,200),eX._createWithScope("dFdy",200,eG.FRAGMENT,200),eX._createWithScope("fwidth",200,eG.FRAGMENT,200);var eQ=((p={}).VertexPosition="vertex-position",p.FragmentOutput0="fragment-output-0",p.FragmentOutputArray="fragment-output-array",p.FragmentDepth="fragment-depth",p),eK=new Map,eY=function(){function e(e,t,r,n){this.type=e,this.lexeme=t,this.scope=r,this.semantic=n}return e.createVariable=function(t,r,n,i){void 0===n&&(n=eG.ALL);var a=new e(r,t,n,i);eK.set(t,a)},e.getVar=function(e){return eK.get(e)},e}();eY.createVariable("gl_VertexID",U.INT,eG.VERTEX),eY.createVariable("gl_InstanceID",U.INT,eG.VERTEX),eY.createVariable("gl_Position",U.VEC4,eG.VERTEX,eQ.VertexPosition),eY.createVariable("gl_PointSize",U.FLOAT,eG.VERTEX),eY.createVariable("gl_FragCoord",U.VEC4,eG.FRAGMENT),eY.createVariable("gl_FrontFacing",U.BOOL,eG.FRAGMENT),eY.createVariable("gl_FragDepth",U.FLOAT,eG.FRAGMENT,eQ.FragmentDepth),eY.createVariable("gl_FragDepthEXT",U.FLOAT,eG.FRAGMENT,eQ.FragmentDepth),eY.createVariable("gl_PointCoord",U.VEC2,eG.FRAGMENT),eY.createVariable("gl_FragColor",U.VEC4,eG.FRAGMENT,eQ.FragmentOutput0),eY.createVariable("gl_FragData",U.VEC4_ARRAY,eG.FRAGMENT,eQ.FragmentOutputArray),eY.createVariable("gl_MaxVertexAttribs",U.INT),eY.createVariable("gl_MaxVertexUniformVectors",U.INT),eY.createVariable("gl_MaxVertexOutputVectors",U.INT),eY.createVariable("gl_MaxFragmentInputVectors",U.INT),eY.createVariable("gl_MaxVertexTextureImageUnits",U.INT),eY.createVariable("gl_MaxCombinedTextureImageUnits",U.INT),eY.createVariable("gl_MaxTextureImageUnits",U.INT),eY.createVariable("gl_MaxFragmentUniformVectors",U.INT),eY.createVariable("gl_MaxDrawBuffers",U.INT),eY.createVariable("gl_MinProgramTexelOffset",U.INT),eY.createVariable("gl_MaxProgramTexelOffset",U.INT);var eJ=function(e,t,r,n){void 0===n&&(n=[]),this.type=e,this.typeLexeme=t,this.arraySpecifier=r,this.structDeclarations=n},eZ=((f={})[f.VAR=0]="VAR",f[f.FN=1]="FN",f[f.STRUCT=2]="STRUCT",f[f.Any=3]="Any",f),e$=function(){function e(e,t,r,n,i,a){void 0===a&&(a=!1),this.ident=e,this.type=t,this.astNode=r,this.dataType=n,this.paramSignature=i,this.isInMacroBranch=a,this.sourceScope=0,this.branchSignature=K}var t=e.prototype;return t.set=function(e,t,r,n,i){this.ident=e,this.type=t,this.astNode=r,this.dataType=n,this.paramSignature=i},t.equal=function(e){if(3!==e.type&&this.type!==e.type)return!1;if(1===this.type){if(!e.astNode&&!e.paramSignature)return!0;var t,r=this.astNode.protoType.paramSig,n=null!=(t=e.paramSignature)?t:e.astNode.protoType.paramSig,i=null==r?void 0:r.length;if(i!==(null==n?void 0:n.length))return!1;for(var a=0;a<i;a++){var o=r[a],s=n[a];if(3e3!==o&&3e3!==s&&o!==s)return!1}}return!0},e}(),e0=function(e){function t(t,r,n,i){void 0===n&&(n=[]),void 0===i&&(i=[]);var a,o=new eJ(r.protoType.returnType.type,r.protoType.returnType.typeSpecifier.lexeme,void 0,r.protoType.returnType.typeSpecifier.structDeclarations);return(a=e.call(this,t,eZ.FN,r,o)||this).localVariables=n.slice(),a.calledFunctions=i.slice(),a}return ei(t,e),t}(e$),e1=function(e){function t(t,r){return e.call(this,t,eZ.STRUCT,r)||this}return ei(t,e),t}(e$),e2=function(e){function t(t,r,n,i,a,o){var s;return void 0===a&&(a=!1),void 0===o&&(o=!1),(s=e.call(this,t,eZ.VAR,i,r)||this).isGlobalVariable=n,s.isConst=a,s.isUniform=o,s}return ei(t,e),t}(e$),e3=function(){function e(){}return e.isAssignable=function(e,t){return void 0==e||void 0==t||3e3===e||3e3===t||e===t},e.typeName=function(e){var t;return"string"==typeof e?e:void 0==e?"unknown":(null!=(t=U[e])?t:String(e)).toLowerCase()},e.isSamplerType=function(e){switch(e){case U.SAMPLER2D:case U.SAMPLER3D:case U.SAMPLER_CUBE:case U.SAMPLER2D_SHADOW:case U.SAMPLER_CUBE_SHADOW:case U.SAMPLER2D_ARRAY:case U.SAMPLER2D_ARRAY_SHADOW:case U.I_SAMPLER2D:case U.I_SAMPLER3D:case U.I_SAMPLER_CUBE:case U.I_SAMPLER2D_ARRAY:case U.U_SAMPLER2D:case U.U_SAMPLER3D:case U.U_SAMPLER_CUBE:case U.U_SAMPLER2D_ARRAY:return!0;default:return!1}},e.isBoolType=function(e){return e===U.BOOL||e===U.BVEC2||e===U.BVEC3||e===U.BVEC4},e.isIntegerType=function(e){switch(e){case U.INT:case U.UINT:case U.IVEC2:case U.IVEC3:case U.IVEC4:case U.UVEC2:case U.UVEC3:case U.UVEC4:return!0;default:return!1}},e.nonArithmeticOperand=function(e){return void 0!=e&&3e3!==e&&(this.isBoolType(e)||this.isSamplerType(e)||"string"==typeof e)},e.isScalarType=function(e){return e===U.FLOAT||e===U.INT||e===U.UINT||e===U.BOOL},e.arithmeticOperation=function(e,t,r){if(void 0==e||void 0==t||3e3===e||3e3===t)return{resultType:3e3,valid:void 0};var n=this._arithmeticFamily(e),i=this._arithmeticFamily(t);if(!n||!i)return{resultType:3e3,valid:!1,reason:"non-arithmetic"};if(n!==i)return{resultType:3e3,valid:!1,reason:"family-mismatch"};if("%"===r&&"float"===n)return{resultType:3e3,valid:!1,reason:"integer-required"};var a=this.isScalarType(e),o=this.isScalarType(t);if(a||o)return{resultType:a?t:e,valid:!0};var s=this.vectorComponentCount(e),c=this.vectorComponentCount(t),u=this.matrixDimensions(e),l=this.matrixDimensions(t);return s&&c?s===c?{resultType:e,valid:!0}:{resultType:3e3,valid:!1,reason:"shape-mismatch"}:u&&l?"*"===r?u.columns===l.rows?{resultType:this._matrixType(l.columns,u.rows),valid:!0}:{resultType:3e3,valid:!1,reason:"shape-mismatch"}:u.columns===l.columns&&u.rows===l.rows?{resultType:e,valid:!0}:{resultType:3e3,valid:!1,reason:"shape-mismatch"}:"*"===r&&u&&c?u.columns===c?{resultType:this._vectorType(u.rows),valid:!0}:{resultType:3e3,valid:!1,reason:"shape-mismatch"}:"*"===r&&s&&l&&s===l.rows?{resultType:this._vectorType(l.columns),valid:!0}:{resultType:3e3,valid:!1,reason:"shape-mismatch"}},e.arithmeticResultType=function(e,t,r){return void 0===r&&(r="+"),this.arithmeticOperation(e,t,r).resultType},e._arithmeticFamily=function(e){if(!("string"==typeof e||this.isBoolType(e)||this.isSamplerType(e))){if(this.matrixDimensions(e))return"float";switch(e){case U.FLOAT:case U.VEC2:case U.VEC3:case U.VEC4:return"float";case U.INT:case U.IVEC2:case U.IVEC3:case U.IVEC4:return"int";case U.UINT:case U.UVEC2:case U.UVEC3:case U.UVEC4:return"uint";default:return}}},e._vectorType=function(e){return 2===e?U.VEC2:3===e?U.VEC3:4===e?U.VEC4:3e3},e._matrixType=function(e,t){var r;return null!=(r=U["MAT"+e+(e===t?"":"X"+t)])?r:3e3},e.vectorComponentCount=function(e){switch(e){case U.VEC2:case U.IVEC2:case U.UVEC2:case U.BVEC2:return 2;case U.VEC3:case U.IVEC3:case U.UVEC3:case U.BVEC3:return 3;case U.VEC4:case U.IVEC4:case U.UVEC4:case U.BVEC4:return 4;default:return 0}},e.matrixComponentCount=function(e){var t=this.matrixDimensions(e);return t?t.columns*t.rows:0},e.matrixDimensions=function(e){switch(e){case U.MAT2:return{columns:2,rows:2};case U.MAT3:return{columns:3,rows:3};case U.MAT4:return{columns:4,rows:4};case U.MAT2X3:return{columns:2,rows:3};case U.MAT3X2:return{columns:3,rows:2};case U.MAT2X4:return{columns:2,rows:4};case U.MAT4X2:return{columns:4,rows:2};case U.MAT3X4:return{columns:3,rows:4};case U.MAT4X3:return{columns:4,rows:3};default:return}},e}(),e4=function(){function e(){}return e.unwrapNodeByType=function(t,r){var n=t.children[0];if(!z(n,Y))return n.nt===r?n:e.unwrapNodeByType(n,r)},e.parseMacroParamList=function(e){var t=e.replace(/^\s*\(\s*|\s*\)\s*$/g,"");return t?t.split(",").map(function(e){return e.trim()}).filter(Boolean):[]},e.unwrapBareIdentifier=function(e,t){for(var r=e;;){if(z(r,tn.VariableIdentifier))return r;if(t.allowParens&&z(r,tn.PrimaryExpression)&&3===r.children.length){var n=r.children[1];if(!z(n,tr))return;r=n;continue}if(z(r,tn.ExpressionAstNode)&&1===r.children.length){var i=r.children[0];if(!z(i,tr))return;r=i;continue}return}},e.extractDirectIdentLexeme=function(t){var r=e.unwrapBareIdentifier(t,{allowParens:!0});if(!r)return null;var n=r.children[0];return z(n,Y)?n.lexeme:null},e.lastStatement=function(t){if(z(t,tn.Statement)||z(t,tn.SimpleStatement)||z(t,tn.CompoundStatement)||z(t,tn.CompoundStatementNoScope)){if(2===t.children.length)return;for(var r,n=j(t.children);!(r=n()).done;){var i=r.value;if(z(i,tr)){var a=e.lastStatement(i);if(a)return a}}return}if(z(t,tn.StatementList)){for(var o=t.children.length-1;o>=0;o--){var s=t.children[o];if(z(s,tr)){var c=e.lastStatement(s);if(c)return c}}return}return t},e.swizzleError=function(t,r,n){if(void 0===n&&(n=e3.vectorComponentCount(t)),0===n)return null;if(r.length<1||r.length>4)return'Invalid swizzle ".'+r+'": a vector swizzle selects 1-4 components.';for(var i,a=e._swizzleSets,o=-1,s=j(r);!(i=s()).done;){for(var c=i.value,u=!1,l=0;l<a.length;l++){var h=a[l].indexOf(c);if(-1!==h){if(-1===o)o=l;else if(o!==l)return'Invalid swizzle ".'+r+'": components must come from one set (xyzw, rgba, or stpq).';if(h>=n)return'Invalid swizzle ".'+r+"\": component '"+c+"' is out of range for a "+n+"-component vector.";u=!0;break}}if(!u)return'Invalid swizzle ".'+r+"\": '"+c+"' is not a vector component."}return null},e.constNumericValue=function(e){for(var t=e;;){if(z(t,tn.PrimaryExpression)){if(3===t.children.length){var r=t.children[1];if(!z(r,tr))return;t=r;continue}var n=t.children[0];if(z(n,Y)&&(n.type===B.INT_CONSTANT||n.type===B.FLOAT_CONSTANT)){var i=Number(n.lexeme);return Number.isNaN(i)?void 0:i}return}if(z(t,tn.ExpressionAstNode)&&1===t.children.length){var a=t.children[0];if(!z(a,tr))return;t=a;continue}return}},e.constIntegerValue=function(t){return e._constIntegerValue(t,new Set)},e._constIntegerValue=function(t,r){if(z(t,tn.PrimaryExpression)){if(3===t.children.length){var n=t.children[1];return z(n,tr)?e._constIntegerValue(n,r):void 0}var i=t.children[0];if(z(i,Y)&&i.type===B.INT_CONSTANT){var a=Number(i.lexeme.replace(/[uU]$/,""));return Number.isSafeInteger(a)?e._normalizeInteger(a,t.type):void 0}}var o=e.unwrapBareIdentifier(t,{allowParens:!0});if(o){if(!z(o.children[0],Y))return;var s=o.resolvedSymbols();if(!s.length)return;for(var c,u,l=j(s);!(u=l()).done;){var h=u.value;if(!z(h,e2)||!h.isConst||r.has(h))return;var d=e._constInitializer(h);if(!d)return;r.add(h);var p=e._constIntegerValue(d,r);if(r.delete(h),void 0===p||void 0!==c&&c!==p)return;c=p}return c}if(z(t,tn.FunctionCallGeneric)){var f=t.children[0];if("int"!==f.ident&&"uint"!==f.ident)return;var _=t.children[2];if(!z(_,tn.FunctionCallParameterList)||1!==_.paramNodes.length)return;var v=e._constIntegerValue(_.paramNodes[0],r);return void 0===v?void 0:e._normalizeInteger(v,t.type)}var m=t.children,g=z(t,tn.ExpressionAstNode)?t.type:void 0;if(1===m.length){var y=m[0];return z(y,tr)?e._constIntegerValue(y,r):void 0}if(z(t,tn.ConditionalExpression)&&5===m.length){var S=m[0],b=m[2],x=m[4];if(!z(S,tr)||!z(b,tr)||!z(x,tr))return;var E=e._constIntegerValue(S,r);return void 0===E?void 0:e._constIntegerValue(0!==E?b:x,r)}if(2===m.length&&z(m[1],tr)){var C,A=e._operatorLexeme(m[0]),T=e._constIntegerValue(m[1],r);if(void 0===A||void 0===T)return;if("+"===A)C=T;else if("-"===A)C=-T;else if("~"===A)C=~T;else{if("!"!==A)return;C=0===T?1:0}return e._normalizeInteger(C,g)}if(3===m.length&&z(m[0],tr)&&z(m[2],tr)){if(z(t,tn.AssignmentExpression))return;var O,I=e._operatorLexeme(m[1]),R=e._constIntegerValue(m[0],r),M=e._constIntegerValue(m[2],r);if(void 0===I||void 0===R||void 0===M)return;switch(I){case"+":O=R+M;break;case"-":O=R-M;break;case"*":O=R*M;break;case"/":if(0===M)return;O=Math.trunc(R/M);break;case"%":if(0===M)return;O=R%M;break;case"<<":O=R<<M;break;case">>":O=g===U.UINT?R>>>M:R>>M;break;case"&":O=R&M;break;case"^":O=R^M;break;case"|":O=R|M;break;case"&&":O=0!==R&&0!==M?1:0;break;case"^^":O=0!==R!=(0!==M)?1:0;break;case"||":O=0!==R||0!==M?1:0;break;case"<":O=R<M?1:0;break;case">":O=R>M?1:0;break;case"<=":O=R<=M?1:0;break;case">=":O=R>=M?1:0;break;case"==":O=R===M?1:0;break;case"!=":O=R!==M?1:0;break;default:return}return e._normalizeInteger(O,g)}},e._constInitializer=function(e){var t,r=e.astNode;return z(r,tn.InitDeclaratorList)||z(r,tn.VariableDeclaration)?null==(t=r.declarator)?void 0:t.initializer:z(r,tr)?r:void 0},e._operatorLexeme=function(t){if(z(t,Y))return t.lexeme;if(z(t,tr))for(var r,n=j(t.children);!(r=n()).done;){var i=r.value,a=e._operatorLexeme(i);if(void 0!==a)return a}},e._normalizeInteger=function(e,t){return t===U.UINT?e>>>0:0|e},e.hasQualifier=function(t,r){for(var n,i=j(t.children);!(n=i()).done;){var a=n.value;if(z(a,Y)){if(a.type===r)return!0}else if(z(a,tr)&&e.hasQualifier(a,r))return!0}return!1},e.isConstExpr=function(t){if(void 0!==e.constNumericValue(t)||e._isBooleanLiteral(t))return!0;var r=e.unwrapBareIdentifier(t,{allowParens:!0});if(r){var n=r.children[0];if(z(n,tn.MacroCallSymbol)||z(n,tn.MacroCallFunction))return!0;if(!z(n,Y))return!1;var i=r.resolvedSymbols();return i.length>0&&i.every(function(e){return z(e,e2)&&e.isConst})}if(z(t,tn.FunctionCallGeneric)){var a=t.children[0],o=a.isBuiltin,s="string"==typeof a.ident&&eX.isExist(a.ident);if(!o&&!s)return!1;var c=t.children[2];if(!z(c,tn.FunctionCallParameterList))return!0;for(var u,l=j(c.paramNodes);!(u=l()).done;){var h=u.value;if(z(h,tr)&&!e.isConstExpr(h))return!1}return!0}if(z(t,tn.ExpressionAstNode)){for(var d,p=!1,f=j(t.children);!(d=f()).done;){var _=d.value;if(z(_,tn.ExpressionAstNode)&&(p=!0,!e.isConstExpr(_)))return!1}return p}return!1},e._isBooleanLiteral=function(e){for(var t=e;;){if(z(t,tn.PrimaryExpression)){if(3===t.children.length){var r=t.children[1];if(!z(r,tr))return!1;t=r;continue}var n=t.children[0];return z(n,Y)&&(n.type===U.True||n.type===U.False)}if(z(t,tn.ExpressionAstNode)&&1===t.children.length){var i=t.children[0];if(!z(i,tr))return!1;t=i;continue}return!1}},e.firstNonArithmeticOperand=function(e,t){for(var r=0,n=[e,t];r<n.length;r++){var i=n[r];if(z(i,tn.ExpressionAstNode)&&e3.nonArithmeticOperand(i.type))return i}},e.toString=function(e){if(this.isTerminal(e)){var t;return null!=(t=B[e])?t:U[e]}return eW[e]},e.isTerminal=function(e){return e<eW.START},e}();e4._swizzleSets=["xyzw","rgba","stpq"];var e9=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t}(eJ),e5=function(e,t,r,n,i){void 0===n&&(n=!1),void 0===i&&(i=!1),this.typeInfo=e,this.ident=t,this.mrtIndex=r,this.isInMacroBranch=n,this.isFlat=i},e6=new Set(["texture","texture2D","texture2DLod","texture2DLodEXT","textureCube","textureCubeLod","textureCubeLodEXT","textureLod","textureOffset","textureProj","textureProjLod","textureProjOffset","textureSize","texelFetch"]),e8=Object.freeze([]),e7=Object.freeze([]),te=Object.freeze([]);function tt(e){return function(t){t.prototype.nt=e}}var tr=function(){function e(){this._branch=K,this._inMacroDefinition=!1}var t=e.prototype;return t.set=function(t,r){this._location=t,this._children=r,this._parent=void 0;for(var n,i=K,a=!1,o=!1,s=j(r);!(n=s()).done;){var c=n.value;z(c,e)?(c._parent=this,a||(i=c._branch,o=c._inMacroDefinition,a=!0)):!a&&z(c,Y)&&(i=c.branch,o=c.inMacroDefinition,a=!0)}this._branch=i,this._inMacroDefinition=o,this.init()},t.init=function(){},t.codeGen=function(e){return e.cache(this,e.defaultCodeGen(this.children))},t.semanticAnalyze=function(e){},er(e,[{key:"parent",get:function(){return this._parent}},{key:"children",get:function(){return this._children}},{key:"location",get:function(){return this._location}}]),e}();!function(e){function t(e,t){if(!e.length)return t;if(!t.length)return e;for(var r,n=e.slice(),i=j(t);!(r=i()).done;){var a=r.value;-1===n.indexOf(a)&&n.push(a)}return n}function r(e,t){var r=e.find(function(e){return e.name===t.name&&e.formalParameterIndex===t.formalParameterIndex&&e.unresolved===t.unresolved&&e.branch.length===t.branch.length&&e.branch.every(function(e,r){return e===t.branch[r]})&&e.replacementMemberOwner===t.replacementMemberOwner&&e.requiresRuntimeOwnerExpansion===t.requiresRuntimeOwnerExpansion});r?t.isValueIdentity&&(r.isValueIdentity=!0):e.push(t)}e._unwrapToken=function(e){if(z(e,Y))return e;throw"not token"},e.get=function(e,t,r,n){var i=t.objectPool?t.objectPool.createNode(e):new e;if(i.set(r,n),!t.diagnosticsEnabled){i.semanticAnalyze(t),t.semanticStack.push(i);return}var a=t.symbolTableStack._currentBranch,o=t.inMacroDefinition;t.symbolTableStack._currentBranch=i._branch,t.inMacroDefinition=i._inMacroDefinition,i.semanticAnalyze(t),t.symbolTableStack._currentBranch=a,t.inMacroDefinition=o,t.semanticStack.push(i)};var n=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t}(tr);e.TrivialNode=n,n=eB([tt(eW._ignore)],n);var i=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.semanticAnalyze=function(e){e.pushScope()},t}(tr);e.ScopeBrace=i,i=eB([tt(eW.scope_brace)],i);var a=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.semanticAnalyze=function(e){e.popScope()},t}(tr);e.ScopeEndBrace=a,a=eB([tt(eW.scope_end_brace)],a);var o=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.codeGen=function(e){return e.cache(this,e.visitJumpStatement(this))},t}(tr);e.JumpStatement=o,o=eB([tt(eW.jump_statement)],o);var s=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t}(tr);e.ConditionOpt=s,s=eB([tt(eW.conditionopt)],s);var c=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t}(tr);e.ForRestStatement=c,c=eB([tt(eW.for_rest_statement)],c);var u=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t}(tr);e.Condition=u,u=eB([tt(eW.condition)],u);var l=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t}(tr);e.ForInitStatement=l,l=eB([tt(eW.for_init_statement)],l);var h=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.semanticAnalyze=function(e){e.diagnosticsEnabled&&e.popScope()},t}(tr);e.IterationStatement=h,h=eB([tt(eW.iteration_statement)],h);var d=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t}(tr);e.SelectionStatement=d,d=eB([tt(eW.selection_statement)],d);var p=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t}(tr);e.ExpressionStatement=p,p=eB([tt(eW.expression_statement)],p);var f=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.init=function(){this._type=void 0},er(t,[{key:"type",get:function(){var e;return null!=(e=this._type)?e:3e3},set:function(e){this._type=e}}]),t}(tr);e.ExpressionAstNode=f;var _=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.semanticAnalyze=function(e){var t=this.children[0];this.type=t.type},t}(f);e.InitializerList=_,_=eB([tt(eW.initializer_list)],_);var v=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.semanticAnalyze=function(e){1===this.children.length?this.type=this.children[0].type:this.type=this.children[1].type},t}(f);e.Initializer=v,v=eB([tt(eW.initializer)],v);var m=function(e){function t(){return e.apply(this,arguments)||this}ei(t,e);var r=t.prototype;return r.init=function(){this.typeSpecifier=void 0,this.arraySpecifier=void 0,this.isConst=!1,this.declarator=void 0},r.semanticAnalyze=function(e){var t,r,n=this.children,i=n.length,a=n[0],o=a.typeSpecifier;this.typeSpecifier=o,this.arraySpecifier=o.arraySpecifier;var s=n[1],c=a.isConst;if(this.isConst=c,2===i||4===i)t=new e9(a.type,o.lexeme,this.arraySpecifier,o.structDeclarations),r=n[3];else{var u=n[2];this.arraySpecifier=u,t=new e9(a.type,o.lexeme,this.arraySpecifier,o.structDeclarations),r=n[4]}var l=e.assignSourceScope(new e2(s.lexeme,t,!1,r,c),s.location);this.declarator={identifier:s,typeInfo:t,initializer:r,isConst:c,isGlobal:!1,symbol:l},e.recordFunctionVariable(l);var h=e.symbolTableStack.insert(l,s.branch);e.reportRedefinition(s.location,l,h)},r.codeGen=function(e){return e.cache(this,e.visitSingleDeclaration(this))},t}(tr);e.SingleDeclaration=m,m=eB([tt(eW.single_declaration)],m);var g=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.semanticAnalyze=function(e){var t=this.children;this.isConst=2===t.length&&e4.hasQualifier(t[0],U.CONST),this.typeSpecifier=1===t.length?t[0]:t[1],this.type=this.typeSpecifier.type},t}(tr);e.FullySpecifiedType=g,g=eB([tt(eW.fully_specified_type)],g);var y=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t}(tr);e.TypeQualifier=y,y=eB([tt(eW.type_qualifier)],y);var S=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.semanticAnalyze=function(e){var t=this.children[0];z(t,Y)?this.qualifier=t.type:this.qualifier=t.qualifier,this.lexeme=t.lexeme},t}(tr);e.SingleTypeQualifier=S,S=eB([tt(eW.single_type_qualifier)],S);var b=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.semanticAnalyze=function(e){var t=this.children[0];this.qualifier=t.type,this.lexeme=t.lexeme},t}(tr),x=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t}(b);e.StorageQualifier=x,x=eB([tt(eW.storage_qualifier)],x);var E=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t}(b);e.PrecisionQualifier=E,E=eB([tt(eW.precision_qualifier)],E);var C=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t}(b);e.InterpolationQualifier=C,C=eB([tt(eW.interpolation_qualifier)],C);var A=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t}(b);e.InvariantQualifier=A,A=eB([tt(eW.invariant_qualifier)],A);var T=function(e){function t(){return e.apply(this,arguments)||this}ei(t,e);var r=t.prototype;return r.init=function(){this.arraySize=void 0,this.structDeclarations=e7,this.structDependencies=e7},r.semanticAnalyze=function(e){var t=this.children,r=t[0];if(this.type=r.type,this.lexeme=r.lexeme,this.arraySize=null==t?void 0:null==(a=t[1])?void 0:a.size,this.isCustom="string"==typeof this.type,this.isCustom){var n=e.lookupSymbol;n.set(this.lexeme,eZ.STRUCT);var i=e.symbolTableStack.lookupAll(n,!0,e.structScratch,this._branch);this.structDeclarations=i.length?i.map(function(e){return e.astNode}):e7,this.structDependencies=this.structDeclarations}else if(z(r.children[0],tu)){for(var a,o,s=[],c=j(r.children[0].referenceSymbols);!(o=c()).done;){var u=o.value;if(u.name){e.lookupSymbol.set(u.name,eZ.STRUCT);for(var l,h=e.symbolTableStack.lookupAll(e.lookupSymbol,!0,e.structScratch,u.branch),d=j(h);!(l=d()).done;){var p=l.value.astNode;s.includes(p)||s.push(p)}}}s.length&&(this.structDependencies=s)}},r.codeGen=function(e){return e.cache(this,e.visitTypeSpecifier(this))},er(t,[{key:"arraySpecifier",get:function(){return this.children[1]}}]),t}(tr);e.TypeSpecifier=T,T=eB([tt(eW.type_specifier)],T);var O=function(e){function t(){return e.apply(this,arguments)||this}ei(t,e);var r=t.prototype;return r.init=function(){this.size=void 0},r.semanticAnalyze=function(e){var t=this.children[1];if(z(t,R)){this.size=t.value;var r=t.children;if(void 0===this.size&&1===r.length&&z(r[0],ej)){var n=r[0].children[0];if(z(n,Y)&&!e.macroDefineList[n.lexeme]){var i=e.lookupSymbol;i.set(n.lexeme,eZ.VAR);var a=e.symbolTableStack.lookupAll(i,!0,e.arraySymbolScratch,this._branch);if(!a.length)return;var o=a[0].isConst;a.some(function(e){return e.isConst!==o})?e.reportBranchAmbiguity(r[0].location,n.lexeme,"const-qualification",n.lexeme):o||e.reportNonConstArraySize(r[0].location)}}}},t}(tr);e.ArraySpecifier=O,O=eB([tt(eW.array_specifier)],O);var I=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.semanticAnalyze=function(e){var t=this.children[0];switch(this.lexeme=t.lexeme,t.type){case B.PLUS:this.compute=function(e,t){return e+t};break;case B.DASH:this.compute=function(e,t){return e-t};break;case B.STAR:this.compute=function(e,t){return e*t};break;case B.SLASH:this.compute=function(e,t){return e/t};break;case B.PERCENT:this.compute=function(e,t){return e%t}}},t}(tr);e.IntegerConstantExpressionOperator=I,I=eB([tt(eW.integer_constant_expression_operator)],I);var R=function(e){function t(){return e.apply(this,arguments)||this}ei(t,e);var r=t.prototype;return r.init=function(){this.value=void 0},r.semanticAnalyze=function(e){if(1===this.children.length){var t=this.children[0];z(t,Y)&&(this.value=Number(t.lexeme))}},t}(tr);e.IntegerConstantExpression=R,R=eB([tt(eW.integer_constant_expression)],R);var M=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.init=function(){var e=this.children[0];z(e,Y)?(this.type=e.lexeme,this.lexeme=e.lexeme):z(e,tu)?(this.type=3e3,this.lexeme=e.macroName):(this.type=e.type,this.lexeme=e.lexeme)},t}(tr);e.TypeSpecifierNonArray=M,M=eB([tt(eW.type_specifier_nonarray)],M);var P=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.init=function(){var e=this.children[0];this.type=e.type,this.lexeme=e.lexeme},t}(tr);e.ExtBuiltinTypeSpecifierNonArray=P,P=eB([tt(eW.ext_builtin_type_specifier_nonarray)],P);var D=function(e){function t(){return e.apply(this,arguments)||this}ei(t,e);var r=t.prototype;return r.init=function(){this.isConst=!1,this.declarator=void 0},r.semanticAnalyze=function(e){var t,r=this.children,n=r.length;if(1===n){var i=r[0],a=i.typeSpecifier,o=i.arraySpecifier,s=i.isConst;this.typeInfo=new e9(a.type,a.lexeme,o,a.structDeclarations),this.isConst=s}else{var c=r[0];this.typeInfo=c.typeInfo,this.isConst=c.isConst}if(3===n||5===n){var u=r[2],l=5===n?r[4]:void 0,h=new e9(this.typeInfo.type,this.typeInfo.typeLexeme,void 0,this.typeInfo.structDeclarations);t=e.assignSourceScope(new e2(u.lexeme,h,!1,this,this.isConst),u.location),this.declarator={identifier:u,typeInfo:h,initializer:l,isConst:this.isConst,isGlobal:!1,symbol:t},e.recordFunctionVariable(t);var d=e.symbolTableStack.insert(t,u.branch);e.reportRedefinition(u.location,t,d)}else if(4===n||6===n){var p=new e9(this.typeInfo.type,this.typeInfo.typeLexeme,void 0,this.typeInfo.structDeclarations),f=this.children[3];p.arraySpecifier=f;var _=r[2],v=6===n?r[5]:void 0;t=e.assignSourceScope(new e2(_.lexeme,p,!1,this,this.isConst),_.location),this.declarator={identifier:_,typeInfo:p,initializer:v,isConst:this.isConst,isGlobal:!1,symbol:t},e.recordFunctionVariable(t);var m=e.symbolTableStack.insert(t,_.branch);e.reportRedefinition(_.location,t,m)}},t}(tr);e.InitDeclaratorList=D,D=eB([tt(eW.init_declarator_list)],D);var L=function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.idList=[],t}ei(t,e);var r=t.prototype;return r.init=function(){this.idList.length=0},r.semanticAnalyze=function(e){var t=this.children,r=this.idList;if(2===t.length)r.push(t[1]);else{var n=t[0],i=t[2],a=n.idList.length;r.length=a+1;for(var o=0;o<a;o++)r[o]=n.idList[o];r[a]=i}},t}(tr);e.IdentifierList=L,L=eB([tt(eW.identifier_list)],L);var N=function(e){function t(){return e.apply(this,arguments)||this}ei(t,e);var r=t.prototype;return r.semanticAnalyze=function(e){z(this.children[0],k)&&(e.popScope(),e.endFunction())},r.codeGen=function(e){return e.cache(this,e.visitDeclaration(this))},t}(tr);e.Declaration=N,N=eB([tt(eW.declaration)],N);var k=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.semanticAnalyze=function(e){var t=this.children[0];this.ident=t.ident,this.returnType=t.returnType,this.parameterList=t.parameterInfoList,this.paramSig=t.paramSig},t}(tr);e.FunctionProtoType=k,k=eB([tt(eW.function_prototype)],k);var V=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.semanticAnalyze=function(e){var t=this.children,r=t[0],n=t[1];this.ident=r.ident,this.returnType=r.returnType,this.parameterInfoList=null==n?void 0:n.parameterInfoList,this.paramSig=null==n?void 0:n.paramSig,e.beginFunction(this)},t}(tr);e.FunctionDeclarator=V,V=eB([tt(eW.function_declarator)],V);var F=function(e){function t(){return e.apply(this,arguments)||this}ei(t,e);var r=t.prototype;return r.semanticAnalyze=function(e){e.pushScope();var t=this.children;this.ident=t[1],this.returnType=t[0]},r.codeGen=function(e){return e.cache(this,e.visitFunctionHeader(this))},t}(tr);e.FunctionHeader=F,F=eB([tt(eW.function_header)],F);var w=function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.parameterInfoList=[],t.paramSig=[],t}ei(t,e);var r=t.prototype;return r.init=function(){this.parameterInfoList.length=0,this.paramSig.length=0},r.semanticAnalyze=function(e){var r=this.children,n=this.parameterInfoList,i=this.paramSig;if(z(r[0],H)){var a,o,s=r[0];n.push({ident:s.ident,typeInfo:s.typeInfo,astNode:s}),i.push(null!=(o=null==(a=s.typeInfo)?void 0:a.type)?o:3e3)}else if(z(r[2],H)){var c,u,l=r[0],h=r[2];n.push.apply(n,[].concat(l.parameterInfoList,[{ident:h.ident,typeInfo:h.typeInfo,astNode:h}])),i.push.apply(i,[].concat(l.paramSig,[null!=(u=null==(c=h.typeInfo)?void 0:c.type)?u:3e3]))}else z(r[0],t)&&z(r[1],W)?(n.push.apply(n,[].concat(r[0].parameterInfoList,[{astNode:r[1]}])),i.push.apply(i,[].concat(r[0].paramSig,[3e3]))):z(r[0],W)&&(n.push({astNode:r[0]}),i.push(3e3))},r.codeGen=function(e){return e.cache(this,e.visitFunctionParameterList(this))},t}(tr);e.FunctionParameterList=w,w=eB([tt(eW.function_parameter_list)],w);var G=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t}(tr);e.MacroParamCaseList=G,G=eB([tt(eW.macro_param_case_list)],G);var W=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t}(tr);e.MacroParamBlock=W,W=eB([tt(eW.macro_param_block)],W);var q=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t}(tr);e.MacroParameterBranch=q,q=eB([tt(eW.macro_parameter_branch)],q);var H=function(e){function t(){return e.apply(this,arguments)||this}ei(t,e);var r=t.prototype;return r.init=function(){this.typeInfo=void 0,this.ident=void 0,this.symbol=void 0},r.semanticAnalyze=function(e){var t,r=this.children;if(z(r[0],X)?t=r[0]:z(r[1],X)&&(t=r[1]),t){this.typeInfo=t.typeInfo,this.ident=t.ident;var n=new e2(t.ident.lexeme,t.typeInfo,!1,t);this.symbol=n,e.symbolTableStack.insert(n,t.ident.branch)}},t}(tr);e.ParameterDeclaration=H,H=eB([tt(eW.parameter_declaration)],H);var X=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.semanticAnalyze=function(e){var t=this.children;this.ident=t[1];var r=t[0],n=t[2];this.typeInfo=new e9(r.type,r.lexeme,n,r.structDeclarations)},t}(tr);e.ParameterDeclarator=X,X=eB([tt(eW.parameter_declarator)],X);var J=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t}(tr);e.SimpleStatement=J,J=eB([tt(eW.simple_statement)],J);var Z=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t}(tr);e.CompoundStatement=Z,Z=eB([tt(eW.compound_statement)],Z);var $=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t}(tr);e.CompoundStatementNoScope=$,$=eB([tt(eW.compound_statement_no_scope)],$);var ee=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t}(tr);e.Statement=ee,ee=eB([tt(eW.statement)],ee);var et=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.codeGen=function(e){return e.cache(this,e.visitStatementList(this))},t}(tr);e.StatementList=et,et=eB([tt(eW.statement_list)],et);var en=function(e){function t(){return e.apply(this,arguments)||this}ei(t,e);var r=t.prototype;return r.semanticAnalyze=function(e){var t=this.children;this.protoType=t[0],this.statements=t[1],e.popScope();var r=e.endFunction(),n=e.assignSourceScope(new e0(this.protoType.ident.lexeme,this,r.localVariables,r.calledFunctions),this.protoType.ident.location),i=0===this.protoType.ident.branch.length?e.symbolTableStack.lookup(n):void 0,a=i&&i.sourceScope===n.sourceScope?"coexist":e.symbolTableStack.insert(n,this.protoType.ident.branch);e.reportRedefinition(this.protoType.ident.location,n,a),this.isInMacroBranch=e.symbolTableStack.isInMacroBranch},r.codeGen=function(e){return e.cache(this,e.visitFunctionDefinition(this))},t}(tr);e.FunctionDefinition=en,en=eB([tt(eW.function_definition)],en);var ea=function(e){function t(){return e.apply(this,arguments)||this}ei(t,e);var r=t.prototype;return r.semanticAnalyze=function(e){this.type=this.children[0].type},r.codeGen=function(e){return e.cache(this,e.visitFunctionCall(this))},t}(f);e.FunctionCall=ea,ea=eB([tt(eW.function_call)],ea);var eo=function(e){function t(){return e.apply(this,arguments)||this}ei(t,e);var r=t.prototype;return r.init=function(){e.prototype.init.call(this),this.fnSymbol=void 0,this.fnSymbols=void 0},r.semanticAnalyze=function(e){var r=this.children[0];if(r.isBuiltin)this.type=r.ident;else{var n=r.ident;if(4===this.children.length){var i=this.children[2];z(i,es)&&(s=i.paramSig)}if(e.diagnosticsEnabled){var a=e.currentFunctionHeader;if((null==a?void 0:null==(c=a.ident)?void 0:c.lexeme)===n){var o,s,c,u,l,h=null!=(l=a.paramSig)?l:[],d=null!=s?s:[];if(h.length===d.length&&h.every(function(e,t){return e===d[t]}))return}if(e6.has(n)){var p=null==s?void 0:s[0];if(void 0!==p&&3e3!==p&&!e3.isSamplerType(p)){e.reportExpectedSampler(this.location,n,p);return}}var f=eX.resolveOverload(n,s);if(f){this.type=f.realReturnType;return}var _=e.lookupSymbol;_.set(n,eZ.FN,void 0,void 0,s);var v=e.overloadScratch;e.symbolTableStack.lookupAll(_,!0,v,this._branch);var m=e.getBranchCoverage(v.map(function(e){var t;return null!=(t=e.branchSignature)?t:K}),this._branch),g="covered"===m||t._hasConflictingBranches(e,v)?v[0]:void 0,y=!1;if(g&&(null==s?void 0:s.some(function(e){return 3e3===e}))&&v.length>1){var S,b=null==(S=v[0].dataType)?void 0:S.type;y=v.some(function(e){var t;return(null==(t=e.dataType)?void 0:t.type)!==b})}if(!g){var x=e.symbolTableStack.lookup(_,!0);if(x&&(this.fnSymbol=x,e.recordFunctionCall(x)),v.length){e.reportBranchAvailability(this.location,"Function",n,m);return}_.set(n,eZ.FN),(e.symbolTableStack.lookupAll(_,!0,v,this._branch).length>0||eX.isExist(n))&&e.reportNoMatchingOverload(this.location,n);return}if(this.type=y?3e3:null==g?void 0:null==(u=g.dataType)?void 0:u.type,this.fnSymbol=g,v.length>1){var E=v[0];this.fnSymbols=v.every(function(e){return t._hasSameParameterSignature(E,e)})?v.slice():e8}if(void 0!==this.fnSymbols)for(var C,A=j(this.fnSymbols);!(C=A()).done;){var T=C.value;e.recordFunctionCall(T)}else z(g,e0)&&e.recordFunctionCall(g);return}var O=e.lookupSymbol;O.set(n,eZ.FN,void 0,void 0,s);var I=e.symbolTableStack.lookup(O,!0);if(!I)return;this.type=null==(o=I.dataType)?void 0:o.type,this.fnSymbol=I,z(I,e0)&&e.recordFunctionCall(I)}},t._hasConflictingBranches=function(e,r){for(var n=0,i=r.length;n<i;n++)for(var a=n+1;a<i;a++){var o,s,c=r[n],u=r[a];if(t._hasSameParameterSignature(c,u)&&e.canDeclarationsCoexist(null!=(o=c.branchSignature)?o:K,null!=(s=u.branchSignature)?s:K))return!0}return!1},t._hasSameParameterSignature=function(e,t){var r,n,i=null!=(r=e.astNode.protoType.paramSig)?r:[],a=null!=(n=t.astNode.protoType.paramSig)?n:[];return i.length===a.length&&i.every(function(e,t){return e===a[t]})},t}(f);e.FunctionCallGeneric=eo,eo=eB([tt(eW.function_call_generic)],eo);var es=function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.paramSig=[],t.paramNodes=[],t}ei(t,e);var r=t.prototype;return r.init=function(){this.paramSig.length=0,this.paramNodes.length=0},r.semanticAnalyze=function(e){var r=this.children,n=this.paramSig,i=this.paramNodes;if(z(r[0],ep)){var a=r[0];n.push(a.type),i.push(a)}else if(z(r[2],ep)){var o=r[0],s=r[2];n.push.apply(n,[].concat(o.paramSig,[s.type])),i.push.apply(i,[].concat(o.paramNodes,[s]))}else z(r[0],t)&&z(r[1],eu)?(n.push.apply(n,[].concat(r[0].paramSig,[3e3])),i.push.apply(i,[].concat(r[0].paramNodes,[r[1]]))):z(r[0],eu)&&(n.push(3e3),i.push(r[0]))},t}(tr);e.FunctionCallParameterList=es,es=eB([tt(eW.function_call_parameter_list)],es);var ec=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t}(tr);e.MacroCallArgCaseList=ec,ec=eB([tt(eW.macro_call_arg_case_list)],ec);var eu=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t}(tr);e.MacroCallArgBlock=eu,eu=eB([tt(eW.macro_call_arg_block)],eu);var el=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t}(tr);e.MacroCallArgBranch=el,el=eB([tt(eW.macro_call_arg_branch)],el);var eh=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.semanticAnalyze=function(e){e.symbolTableStack.isInMacroBranch||e.shaderData.globalPrecisions.push(this)},t}(tr);e.PrecisionSpecifier=eh,eh=eB([tt(eW.precision_specifier)],eh);var ed=function(e){function t(){return e.apply(this,arguments)||this}ei(t,e);var r=t.prototype;return r.semanticAnalyze=function(e){var t=this.children[0];this.ident=t.type,this.lexeme=t.lexeme,this.isBuiltin="string"!=typeof this.ident},r.codeGen=function(e){return e.cache(this,e.visitFunctionIdentifier(this))},t}(tr);e.FunctionIdentifier=ed,ed=eB([tt(eW.function_identifier)],ed);var ep=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.semanticAnalyze=function(e){if(1===this.children.length){var t,r=this.children[0];this.type=null!=(t=r.type)?t:3e3}else{var n,i=this.children[2];this.type=null!=(n=i.type)?n:3e3}},t}(f);e.AssignmentExpression=ep,ep=eB([tt(eW.assignment_expression)],ep);var ef=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t}(tr);e.AssignmentOperator=ef,ef=eB([tt(eW.assignment_operator)],ef);var e_=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.semanticAnalyze=function(e){if(1===this.children.length){var t=this.children[0];this.type=t.type}else{var r=this.children[2];this.type=r.type}},t}(f);e.Expression=e_,e_=eB([tt(eW.expression)],e_);var ev=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.semanticAnalyze=function(e){if(1===this.children.length){var t,r=this.children[0];if(z(r,ej))this.type=null!=(t=r.typeInfo)?t:3e3;else switch(r.type){case B.INT_CONSTANT:this._type=U.INT;break;case B.FLOAT_CONSTANT:this.type=U.FLOAT;break;case U.True:case U.False:this.type=U.BOOL}}else{var n=this.children[1];this.type=n.type}},t}(f);e.PrimaryExpression=ev,ev=eB([tt(eW.primary_expression)],ev);var em=function(e){function t(){return e.apply(this,arguments)||this}ei(t,e);var r=t.prototype;return r.init=function(){if(e.prototype.init.call(this),1===this.children.length){var t=this.children[0];this.type=t.type}},r.semanticAnalyze=function(e){var r=this.children;if(3===r.length&&z(r[2],Y)){var n=r[0];if(!this._inMacroDefinition){var i=e4.unwrapBareIdentifier(n,{allowParens:!0});i&&e.shaderData.directMemberOwnerReferences.push(i)}"string"==typeof n.type&&t._checkStructField(e,n.type,r[2],this._branch)}},r.codeGen=function(e){return e.cache(this,e.visitPostfixExpression(this))},t._checkStructField=function(e,t,r,n){var i=e.lookupSymbol;i.set(t,eZ.STRUCT);var a=e.symbolTableStack.lookupAll(i,!0,e.structScratch,n);if(a.length){var o=e.getBranchCoverage(a.map(function(e){var t;return null!=(t=e.branchSignature)?t:K}),n);if("covered"!==o){e.reportBranchAvailability(r.location,"Struct",t,o);return}for(var s=a[0].astNode.propList.find(function(e){return e.ident.lexeme===r.lexeme}),c=!1,u=!1,l=1;l<a.length;l++){var h=a[l].astNode.propList.find(function(e){return e.ident.lexeme===r.lexeme});if(!!h!=!!s){c=!0;break}if(h&&s){var d=s.typeInfo.arraySpecifier,p=h.typeInfo.arraySpecifier;if(h.typeInfo.type!==s.typeInfo.type||!!p!=!!d||(null==p?void 0:p.size)!==(null==d?void 0:d.size)){u=!0;break}}}if(c){e.reportBranchAmbiguity(r.location,t+"."+r.lexeme,"struct-member-presence",r.lexeme,t);return}!u&&(s||e.reportUndeclaredStructMember(r.location,t,r.lexeme))}},t}(f);e.PostfixExpression=em,em=eB([tt(eW.postfix_expression)],em);var eg=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t}(tr);e.UnaryOperator=eg,eg=eB([tt(eW.unary_operator)],eg);var ey=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.init=function(){this.type=this.children[0].type},t}(f);e.UnaryExpression=ey,ey=eB([tt(eW.unary_expression)],ey);var eS=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.init=function(){e.prototype.init.call(this),1===this.children.length?this.type=this.children[0].type:this.type=e3.arithmeticResultType(this.children[0].type,this.children[2].type,this.children[1].lexeme)},t}(f);e.MultiplicativeExpression=eS,eS=eB([tt(eW.multiplicative_expression)],eS);var eb=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.init=function(){e.prototype.init.call(this),1===this.children.length?this.type=this.children[0].type:this.type=e3.arithmeticResultType(this.children[0].type,this.children[2].type,this.children[1].lexeme)},t}(f);e.AdditiveExpression=eb,eb=eB([tt(eW.additive_expression)],eb);var ex=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.semanticAnalyze=function(e){var t=this.children[0];this.type=t.type},t}(f);e.ShiftExpression=ex,ex=eB([tt(eW.shift_expression)],ex);var eE=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.semanticAnalyze=function(e){1===this.children.length?this.type=this.children[0].type:this.type=U.BOOL},t}(f);e.RelationalExpression=eE,eE=eB([tt(eW.relational_expression)],eE);var eC=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.semanticAnalyze=function(e){1===this.children.length?this.type=this.children[0].type:this.type=U.BOOL},t}(f);e.EqualityExpression=eC,eC=eB([tt(eW.equality_expression)],eC);var eA=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.semanticAnalyze=function(e){1===this.children.length?this.type=this.children[0].type:this.type=U.UINT},t}(f);e.AndExpression=eA,eA=eB([tt(eW.and_expression)],eA);var eT=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.semanticAnalyze=function(e){1===this.children.length?this.type=this.children[0].type:this.type=U.UINT},t}(f);e.ExclusiveOrExpression=eT,eT=eB([tt(eW.exclusive_or_expression)],eT);var eO=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.semanticAnalyze=function(e){1===this.children.length?this.type=this.children[0].type:this.type=U.UINT},t}(f);e.InclusiveOrExpression=eO,eO=eB([tt(eW.inclusive_or_expression)],eO);var eI=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.semanticAnalyze=function(e){1===this.children.length?this.type=this.children[0].type:this.type=U.BOOL},t}(f);e.LogicalAndExpression=eI,eI=eB([tt(eW.logical_and_expression)],eI);var eR=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.semanticAnalyze=function(e){1===this.children.length?this.type=this.children[0].type:this.type=U.BOOL},t}(f);e.LogicalXorExpression=eR,eR=eB([tt(eW.logical_xor_expression)],eR);var eM=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.semanticAnalyze=function(e){1===this.children.length?this.type=this.children[0].type:this.type=U.BOOL},t}(f);e.LogicalOrExpression=eM,eM=eB([tt(eW.logical_or_expression)],eM);var eP=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.semanticAnalyze=function(e){1===this.children.length&&(this.type=this.children[0].type)},t}(f);e.ConditionalExpression=eP,eP=eB([tt(eW.conditional_expression)],eP);var eD=function(e){function t(){return e.apply(this,arguments)||this}ei(t,e);var r=t.prototype;return r.init=function(){this.ident=void 0},r.semanticAnalyze=function(e){var t=this.children;if(this.isInMacroBranch=e.symbolTableStack.isInMacroBranch,6===t.length){this.ident=t[1];var r=e.assignSourceScope(new e1(this.ident.lexeme,this),this.ident.location),n=e.symbolTableStack.insert(r,this.ident.branch);e.reportRedefinition(this.ident.location,r,n),this.propList=t[3].propList,this.macroExpressions=t[3].macroExpressions}else this.propList=t[2].propList,this.macroExpressions=t[2].macroExpressions},r.codeGen=function(e){return e.cache(this,e.visitStructSpecifier(this))},t}(tr);e.StructSpecifier=eD,eD=eB([tt(eW.struct_specifier)],eD);var eL=function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.propList=[],t.macroExpressions=[],t}ei(t,e);var r=t.prototype;return r.init=function(){this.propList.length=0,this.macroExpressions.length=0},r.semanticAnalyze=function(e){var t=this.children,r=this.propList,n=this.macroExpressions;1===t.length?(r.push.apply(r,[].concat(t[0].props)),n.push.apply(n,[].concat(t[0].macroExpressions))):(r.push.apply(r,[].concat(t[0].propList)),r.push.apply(r,[].concat(t[1].props)),n.push.apply(n,[].concat(t[0].macroExpressions)),n.push.apply(n,[].concat(t[1].macroExpressions)))},t}(tr);e.StructDeclarationList=eL,eL=eB([tt(eW.struct_declaration_list)],eL);var eN=function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.props=[],t.macroExpressions=[],t}ei(t,e);var r=t.prototype;return r.init=function(){this._typeSpecifier=void 0,this._declaratorList=void 0,this.props.length=0,this.macroExpressions.length=0},r.semanticAnalyze=function(e){var t=this.children,r=this.props,n=this.macroExpressions;if(1===t.length){for(var i=t[0],a=i.props,o=0,s=a.length;o<s;o++)a[o].isInMacroBranch=!0,r.push(a[o]);n.push.apply(n,[].concat(i.macroExpressions));return}3===t.length?(this._typeSpecifier=t[0],this._declaratorList=t[1]):(this._typeSpecifier=t[1],this._declaratorList=t[2]);var c=t[0],u=this._typeSpecifier,l=u.type,h=u.lexeme,d=e.symbolTableStack.isInMacroBranch;if(z(c,eF)){var p=t[2],f=new e5(new e9(l,h,void 0,this._typeSpecifier.structDeclarations),p.ident,c.index,d);r.push(f)}else{var _=4===t.length&&e4.hasQualifier(t[0],U.FLAT),v=this._declaratorList.declaratorList,m=v.length;r.length=m;for(var g=0;g<m;g++){var y=v[g],S=new e5(new e9(l,h,y.arraySpecifier,this._typeSpecifier.structDeclarations),y.ident,void 0,d,_);r[g]=S}}},t}(tr);e.StructDeclaration=eN,eN=eB([tt(eW.struct_declaration)],eN);var ek=function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.props=[],t.macroExpressions=[],t}ei(t,e);var r=t.prototype;return r.init=function(){this.props.length=0,this.macroExpressions.length=0},r.semanticAnalyze=function(){var e,t,r,n,i,a,o=this.children;this.macroExpressions.push(o[0]),3===o.length?((e=this.props).push.apply(e,[].concat(o[1].propList)),(t=this.props).push.apply(t,[].concat(o[2].props)),(r=this.macroExpressions).push.apply(r,[].concat(o[1].macroExpressions)),(n=this.macroExpressions).push.apply(n,[].concat(o[2].macroExpressions))):((i=this.props).push.apply(i,[].concat(o[1].props)),(a=this.macroExpressions).push.apply(a,[].concat(o[1].macroExpressions)))},t}(tr);e.MacroStructDeclaration=ek,ek=eB([tt(eW.macro_struct_declaration)],ek);var eV=function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.props=[],t.macroExpressions=[],t}ei(t,e);var r=t.prototype;return r.init=function(){this.props.length=0,this.macroExpressions.length=0},r.semanticAnalyze=function(){var e,r,n,i,a=this.children,o=a[a.length-1];this.macroExpressions.push(a[0]),z(a[1],eL)&&((e=this.props).push.apply(e,[].concat(a[1].propList)),(r=this.macroExpressions).push.apply(r,[].concat(a[1].macroExpressions))),z(o,t)&&((n=this.props).push.apply(n,[].concat(o.props)),(i=this.macroExpressions).push.apply(i,[].concat(o.macroExpressions))),a.length>1&&z(o,eJ)&&this.macroExpressions.push(o)},t}(tr);e.MacroStructBranch=eV,eV=eB([tt(eW.macro_struct_branch)],eV);var eF=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.semanticAnalyze=function(e){this.index=Number(this.children[4].lexeme)},t}(tr);e.LayoutQualifier=eF,eF=eB([tt(eW.layout_qualifier)],eF);var ew=function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.declaratorList=[],t}ei(t,e);var r=t.prototype;return r.init=function(){this.declaratorList.length=0},r.semanticAnalyze=function(e){var t=this.children,r=this.declaratorList;if(1===t.length)r.push(t[0]);else{var n=t[0],i=t[1],a=n.declaratorList.length;r.length=a+1;for(var o=0;o<a;o++)r[o]=n.declaratorList[o];r[a]=i}},t}(tr);e.StructDeclaratorList=ew,ew=eB([tt(eW.struct_declarator_list)],ew);var eG=function(e){function t(){return e.apply(this,arguments)||this}ei(t,e);var r=t.prototype;return r.init=function(){this.arraySpecifier=void 0},r.semanticAnalyze=function(e){var t=this.children;this.ident=t[0],this.arraySpecifier=t[1]},t}(tr);e.StructDeclarator=eG,eG=eB([tt(eW.struct_declarator)],eG);var eU=function(e){function t(){return e.apply(this,arguments)||this}ei(t,e);var r=t.prototype;return r.init=function(){this.isStatic=!1,this.declarator=void 0},r.semanticAnalyze=function(e){var t=this.children,r=t[0],n=t[1];this.type=r;var i=4===t.length,a=3===t.length?t[2]:void 0,o=i?t[3]:void 0,s=new e9(r.type,r.typeSpecifier.lexeme,a,r.typeSpecifier.structDeclarations),c=e.assignSourceScope(new e2(n.lexeme,s,!0,this,r.isConst,!i&&!r.isConst),n.location);this.declarator={identifier:n,typeInfo:s,initializer:o,isConst:r.isConst,isGlobal:!0,symbol:c};var u=e.symbolTableStack.insert(c,n.branch);e.reportRedefinition(n.location,c,u),4===t.length&&(this.isStatic=!0)},r.codeGen=function(t){return this.isStatic?e.prototype.codeGen.call(this,t):t.cache(this,t.visitGlobalVariableDeclaration(this))},t}(tr);e.VariableDeclaration=eU,eU=eB([tt(eW.variable_declaration)],eU);var ez=function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.variableDeclarations=[],t}ei(t,e);var r=t.prototype;return r.init=function(){this.variableDeclarations.length=0},r.semanticAnalyze=function(e){var t=this.children,r=t.length,n=t[0],i=n.type;if(this.type=i,z(n,eU))this.variableDeclarations.push(n);else{(a=this.variableDeclarations).push.apply(a,[].concat(n.variableDeclarations));var a,o=t[2],s=e.objectPool?e.objectPool.createNode(eU):new eU;3===r?s.set(o.location,[i,o]):s.set(o.location,[i,o,t[3]]),s.semanticAnalyze(e),this.variableDeclarations.push(s)}},t}(tr);e.VariableDeclarationList=ez,ez=eB([tt(eW.variable_declaration_list)],ez);var ej=function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.referenceGlobalSymbolNames=[],t._symbols=[],t}ei(t,e);var r=t.prototype;return r.resolvedSymbols=function(){return this._symbols},r.resolvedValueSymbols=function(){var e,t=this.children[0];return z(t,tu)||z(t,tl)?null!=(e=this._valueSymbols)?e:te:this._symbols},r.init=function(){this.typeInfo=3e3,this.builtinSemantic=void 0,this.isArray=!1,this.arraySize=void 0,this.referenceGlobalSymbolNames.length=0,this._symbols.length=0,this._valueSymbols&&(this._valueSymbols.length=0)},r.semanticAnalyze=function(e){if(e.diagnosticsEnabled){var r=this.children[0],n=this.referenceGlobalSymbolNames,i=this._symbols,a=z(r,Y)?[{name:r.lexeme,branch:this._branch}]:r.referenceSymbols,o=[];if(!z(r,Y))for(var s,c,u=j(a);!(c=u()).done;){var l=c.value,h=void 0===l.name?void 0:eY.getVar(l.name);if(!l.isValueIdentity||l.unresolved||!h||void 0!==s&&s!==h.type){s=void 0;break}s=h.type}for(var d=0;d<a.length;d++){var p=a[d],f=p.name,_=p.branch,v=p.isValueIdentity,m=p.replacementMemberOwner,g=p.requiresRuntimeOwnerExpansion;if(p.unresolved){this._registerUnresolvedReferenceResolution(e,_,m,g,v);continue}if(void 0!==f){if(o.push(f),e.macroDefineList[f]){(m||v)&&this._registerUnresolvedReferenceResolution(e,_,m,g,v);continue}if(!z(r,Y)&&eX.isExist(f))continue;var y=eY.getVar(f);if(y){this.typeInfo=z(r,Y)?y.type:null!=s?s:3e3,z(r,Y)&&(this.builtinSemantic=y.semantic);continue}var S=t._lookupAndMarkGlobalReference(e,f,i,n,this.location,_,this,!1,!z(r,Y)&&(void 0!==m||!0===v),m,g,v);if(v&&this._appendValueSymbols(i),S&&(z(r,Y)||!r.visibleHasAstValue)){var b=i[0],x=null==(I=b.dataType)?void 0:I.type,E=!!(null==(R=b.dataType)?void 0:R.arraySpecifier),C=null==(P=b.dataType)?void 0:null==(M=P.arraySpecifier)?void 0:M.size,A=!1,T=!1;if(i.length>1)for(var O=1;O<i.length;O++){var I,R,M,P,D,L=i[O].dataType;if((null==L?void 0:L.type)!==x||!!(null==L?void 0:L.arraySpecifier)!==E){A=!0;break}(null==L?void 0:null==(D=L.arraySpecifier)?void 0:D.size)!==C&&(T=!0)}A?(this.typeInfo=3e3,this.isArray=!1,this.arraySize=void 0):(this.typeInfo=x,this.isArray=E,this.arraySize=T?void 0:C)}}}z(r,Y)||t._probeCrossArmShadowing(e,r,o,i,n);return}this._semanticAnalyzeForCodegen(e)},r._semanticAnalyzeForCodegen=function(e){var t=this,r=this.children[0];if(z(r,Y)){var n=r.lexeme;if(e.macroDefineList[n])return;var i=eY.getVar(n);if(i){this.typeInfo=i.type,this.builtinSemantic=i.semantic;return}this._resolveCodegenReference(e,n,!0,this._branch);return}for(var a=r.referenceSymbols.length?r.referenceSymbols:r.referenceSymbolNames.map(function(e){return{name:e,branch:t._branch}}),o=0;o<a.length;o++){var s=a[o],c=s.name,u=s.branch,l=s.isValueIdentity,h=s.replacementMemberOwner,d=s.requiresRuntimeOwnerExpansion;if(s.unresolved){this._registerUnresolvedReferenceResolution(e,u,h,d,l);continue}if(void 0!==c){if(e.macroDefineList[c]){(h||l)&&this._registerUnresolvedReferenceResolution(e,u,h,d,l);continue}if(!eX.isExist(c)){var p=eY.getVar(c);if(p){this.typeInfo=p.type;continue}this._resolveCodegenReference(e,c,!r.hasAstValue,u,void 0!==h||!0===l,h,d,l)}}}var f=r.macroName;if(!(!f||eX.isExist(f)||eY.getVar(f))){for(var _=0;_<a.length;_++)if(a[_].name===f)return;var v=e.lookupSymbol;v.set(f,eZ.Any),e.symbolTableStack.lookupAllWithRuntimeFallbacks(v,!0,e.runtimeLookupScratch,e.runtimeFallbackScratch,this._branch),this._markCodegenReference(f,e.runtimeLookupScratch),this._markCodegenReference(f,e.runtimeFallbackScratch)}},r._resolveCodegenReference=function(e,t,r,n,i,a,o,s){void 0===i&&(i=!1);var c=e.lookupSymbol;c.set(t,eZ.Any);var u=this._symbols,l=e.runtimeFallbackScratch;if(e.symbolTableStack.lookupAllWithRuntimeFallbacks(c,!0,u,l,n),!u.length){i&&(a||s)&&this._registerUnresolvedReferenceResolution(e,n,a,o,s);return}if(this._appendCodegenRuntimeFallbacks(e,u,l,n,i,a,o,s),this._markCodegenReference(t,u),s&&this._appendValueSymbols(u),r){for(var h=u[0].dataType,d=!1,p=1;p<u.length;p++){var f,_,v=u[p].dataType;if((null==v?void 0:v.type)!==(null==h?void 0:h.type)||!!(null==v?void 0:v.arraySpecifier)!=!!(null==h?void 0:h.arraySpecifier))return;(null==v?void 0:null==(f=v.arraySpecifier)?void 0:f.size)!==(null==h?void 0:null==(_=h.arraySpecifier)?void 0:_.size)&&(d=!0)}this._setCodegenType(h,d)}},r._appendCodegenRuntimeFallbacks=function(e,t,r,n,i,a,o,s){for(var c=t.length,u=0,l=r.length;u<l;u++){var h=r[u];(z(h,e2)||z(h,e0))&&-1===t.indexOf(h)&&t.push(h)}this._registerReferenceResolution(e,c,n,i,a,o,s)},r._appendValueSymbols=function(e){if(e.length)for(var t,r,n=null!=(t=this._valueSymbols)?t:this._valueSymbols=[],i=j(e);!(r=i()).done;){var a=r.value;-1===n.indexOf(a)&&n.push(a)}},r._markCodegenReference=function(e,t){for(var r=0;r<t.length;r++){var n=t[r];if(z(n,e0)||z(n,e2)&&n.isGlobalVariable){-1===this.referenceGlobalSymbolNames.indexOf(e)&&this.referenceGlobalSymbolNames.push(e);return}}},r._setCodegenType=function(e,t){var r;void 0===t&&(t=!1),this.typeInfo=null==e?void 0:e.type,this.isArray=!!(null==e?void 0:e.arraySpecifier),this.arraySize=t?void 0:null==e?void 0:null==(r=e.arraySpecifier)?void 0:r.size},r._registerReferenceResolution=function(e,t,r,n,i,a,o){var s=n&&(void 0!==i||!0===o);(this._symbols.length||s)&&(n||!(t>=this._symbols.length))&&e.shaderData.referenceResolutionSnapshots.push({reference:this,symbols:this._symbols.slice(),fallbackStart:t,callSiteBranch:r,replacementMemberOwner:i,requiresRuntimeOwnerExpansion:a,isValueIdentity:o})},r._registerUnresolvedReferenceResolution=function(e,t,r,n,i){e.shaderData.referenceResolutionSnapshots.push({reference:this,symbols:te,fallbackStart:0,callSiteBranch:t,replacementMemberOwner:r,requiresRuntimeOwnerExpansion:n,isValueIdentity:i})},r.codeGen=function(e){return e.cache(this,e.visitVariableIdentifier(this))},r.getLexeme=function(e){var t=this.children[0];return z(t,Y)?t.lexeme:t.codeGen(e)},t._probeCrossArmShadowing=function(e,r,n,i,a){var o=r.macroName;o&&-1===n.indexOf(o)&&(eX.isExist(o)||eY.getVar(o)||t._lookupAndMarkGlobalReference(e,o,i,a,null,K,void 0,!0))},t._lookupAndMarkGlobalReference=function(e,r,n,i,a,o,s,c,u,l,h,d){void 0===c&&(c=!1),void 0===u&&(u=!1);var p=e.lookupSymbol;p.set(r,eZ.Any);var f=e.runtimeFallbackScratch;e.symbolTableStack.lookupAllWithRuntimeFallbacks(p,!0,n,f,o);for(var _=0,v=0,m=n.length;v<m;v++){var g,y=n[v];e.isBranchVisibleFrom(null!=(g=y.branchSignature)?g:K,o)&&(n[_++]=y)}_&&(n.length=_);for(var S=n.length,b=0,x=f.length;b<x;b++){var E=f[b];(z(E,e2)||z(E,e0))&&-1===n.indexOf(E)&&n.push(E)}if(null==s||s._registerReferenceResolution(e,S,o,u,l,h,d),!n.length)return a&&e.symbolTableStack.hasSymbol(p)&&(e.symbolTableStack.lookupAll(p,!0,n),e.reportBranchAvailability(a,"Identifier",r,e.getBranchCoverage(n.map(function(e){var t;return null!=(t=e.branchSignature)?t:K}),o)),n.length=0),!1;var C=e.getBranchCoverage(n.map(function(e){var t;return null!=(t=e.branchSignature)?t:K}),o);return(t._containsGlobalSymbol(n)||t._containsGlobalSymbol(f))&&-1===i.indexOf(r)&&i.push(r),!!(c||"covered"===C||t._hasConflictingGlobalBranches(e,n))||(a&&e.reportBranchAvailability(a,"Identifier",r,C),!1)},t._hasConflictingGlobalBranches=function(e,t){for(var r=0,n=t.length;r<n;r++){var i=t[r];if(z(i,e0)||i.isGlobalVariable)for(var a=r+1;a<n;a++){var o,s,c=t[a];if((z(c,e0)||c.isGlobalVariable)&&e.canDeclarationsCoexist(null!=(o=i.branchSignature)?o:K,null!=(s=c.branchSignature)?s:K))return!0}}return!1},t._containsGlobalSymbol=function(e){for(var t=0;t<e.length;t++){var r=e[t];if(z(r,e0)||z(r,e2)&&r.isGlobalVariable)return!0}return!1},t}(tr);e.VariableIdentifier=ej,ej=eB([tt(eW.variable_identifier)],ej);var eq=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.semanticAnalyze=function(e){this.shaderData=e.shaderData,this.shaderData.symbolTable=e.symbolTableStack.scope},t}(tr);e.GLShaderProgram=eq,eq=eB([tt(eW.gs_shader_program)],eq);var eH=function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.macroExpressions=[],t}ei(t,e);var r=t.prototype;return r.init=function(){this.macroExpressions.length=0},r.semanticAnalyze=function(e){var t,r=this.children[0];(z(r,eQ)||z(r,ta)||z(r,th)||z(r,Y))&&(e.shaderData.globalMacroDeclarations.push(this),z(r,ta)?(t=this.macroExpressions).push.apply(t,[].concat(r.macroExpressions)):this.macroExpressions.push(r))},t}(tr);e.GlobalDeclaration=eH,eH=eB([tt(eW.global_declaration)],eH);var eQ=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.codeGen=function(t){return t.cache(this,e.prototype.codeGen.call(this,t)+"\n")},t}(tr);e.MacroUndef=eQ,eQ=eB([tt(eW.macro_undef)],eQ);var eK=function(e){function t(){return e.apply(this,arguments)||this}ei(t,e);var r=t.prototype;return r.semanticAnalyze=function(e){e.symbolTableStack._macroLevel++},r.codeGen=function(t){return t.cache(this,"\n"+e.prototype.codeGen.call(this,t)+"\n")},t}(tr);e.MacroPushContext=eK,eK=eB([tt(eW.macro_push_context)],eK);var eJ=function(e){function t(){return e.apply(this,arguments)||this}ei(t,e);var r=t.prototype;return r.semanticAnalyze=function(e){e.symbolTableStack._macroLevel--},r.codeGen=function(t){return t.cache(this,"\n"+e.prototype.codeGen.call(this,t)+"\n")},t}(tr);e.MacroPopContext=eJ,eJ=eB([tt(eW.macro_pop_context)],eJ);var e$=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.codeGen=function(t){return t.cache(this,"\n"+e.prototype.codeGen.call(this,t)+"\n")},t}(tr);e.MacroElifExpression=e$,e$=eB([tt(eW.macro_elif_expression)],e$);var tn=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t.prototype.codeGen=function(t){return t.cache(this,"\n"+e.prototype.codeGen.call(this,t)+"\n")},t}(tr);e.MacroElseExpression=tn,tn=eB([tt(eW.macro_else_expression)],tn);var ti=function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.macroExpressions=[],t}ei(t,e);var r=t.prototype;return r.init=function(){this.macroExpressions.length=0},r.semanticAnalyze=function(e){var t=this.children,r=this.macroExpressions;1===t.length?r.push.apply(r,[].concat(t[0].macroExpressions)):(r.push.apply(r,[].concat(t[0].macroExpressions)),r.push.apply(r,[].concat(t[1].macroExpressions)))},r.codeGen=function(e){var t=this.children;return 1===t.length?e.cache(this,t[0].codeGen(e)):e.cache(this,t[0].codeGen(e)+"\n"+t[1].codeGen(e))},t}(tr);e.GlobalMacroDeclaration=ti,ti=eB([tt(eW.global_macro_declaration)],ti);var ta=function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.macroExpressions=[],t}ei(t,e);var r=t.prototype;return r.init=function(){this.macroExpressions.length=0},r.semanticAnalyze=function(e){var t=this.children,r=this.macroExpressions;3===t.length?(r.push(t[0]),r.push.apply(r,[].concat(t[1].macroExpressions)),r.push.apply(r,[].concat(t[2].macroExpressions))):(r.push(t[0]),r.push.apply(r,[].concat(t[1].macroExpressions)))},t}(tr);e.GlobalMacroIfStatement=ta,ta=eB([tt(eW.global_macro_if_statement)],ta);var to=function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.macroExpressions=[],t}ei(t,e);var r=t.prototype;return r.init=function(){this.macroExpressions.length=0},r.semanticAnalyze=function(e){var r=this.children,n=r[r.length-1],i=this.macroExpressions;i.push(r[0]),z(r[1],ti)&&i.push.apply(i,[].concat(r[1].macroExpressions)),z(n,t)&&i.push.apply(i,[].concat(n.macroExpressions)),r.length>1&&z(n,eJ)&&i.push(n)},t}(tr);e.GlobalMacroBranch=to,to=eB([tt(eW.global_macro_branch)],to);var ts=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t}(tr);e.MacroIfStatement=ts,ts=eB([tt(eW.macro_if_statement)],ts);var tc=function(e){function t(){return e.apply(this,arguments)||this}return ei(t,e),t}(tr);e.MacroBranch=tc,tc=eB([tt(eW.macro_branch)],tc);var tu=function(e){function n(){var t;return t=e.apply(this,arguments)||this,t.referenceSymbolNames=[],t.referenceSymbols=[],t.hasAstValue=!1,t.visibleHasAstValue=!1,t.isFunctionLikeMacro=!1,t.aliasesNonBuiltinIdent=!1,t}ei(n,e);var i=n.prototype;return i.init=function(){this.expandedSyntax=void 0,this.referenceSymbolNames.length=0,this.referenceSymbols.length=0,this.hasAstValue=!1,this.visibleHasAstValue=!1,this.isFunctionLikeMacro=!1,this.aliasesNonBuiltinIdent=!1},i.semanticAnalyze=function(e){var i,a,o=this.children[0],s=o.lexeme;this.macroName=s;var c=e.macroDefineList[s],u=this.referenceSymbolNames;u.length=0,this.referenceSymbols.length=0,this._analyzeForCodegen(c,u);var l=o.branch,h=this.referenceSymbols,d=0,p=!0;if(c)for(var f=0,_=c.length;f<_;f++){var v=c[f];e.canBranchesOverlap(v.branch,l)&&(d++,null==v.valueAst?(p=!1,r(h,{unresolved:!0,branch:t(l,v.branch),isValueIdentity:!0})):n._collectIdentifierRefs(v.valueAst,v.params,u,h,l,void 0,e4.unwrapBareIdentifier(v.valueAst,{allowParens:!0})))}this.visibleHasAstValue=d>0&&p,e.diagnosticsEnabled&&(this.expandedSyntax=null==(a=e.semanticDiagnostics)?void 0:null==(i=a.macroExpansion)?void 0:i.call(a,this,e))},i._analyzeForCodegen=function(e,t){for(var r,i=!0,a=!1,o=!0,s=null!=(r=null==e?void 0:e.length)?r:0,c=0;c<s;c++){var u=e[c];if(u.valueAst||(i=!1),u.isFunction&&(a=!0),u.valueAst&&n._collectIdentifierRefs(u.valueAst,u.params,t),u.isFunction||!u.valueAst)o=!1;else{var l=e4.unwrapBareIdentifier(u.valueAst,{allowParens:!1}),h=null==l?void 0:l.children[0],d=z(h,Y)?h.lexeme:void 0;(!d||eX.isExist(d))&&(o=!1)}}this.hasAstValue=s>0&&i,this.isFunctionLikeMacro=a,this.aliasesNonBuiltinIdent=s>0&&o},n._collectIdentifierRefs=function(e,i,a,o,s,c,u){if(void 0===s&&(s=K),z(e,em)&&3===e.children.length&&z(e.children[2],Y)){var l=e.children[0];if(z(l,tr)){var h=e4.unwrapBareIdentifier(l,{allowParens:!0});if(h){n._collectIdentifierRefs(l,i,a,o,s,h,u);return}}}if(z(e,ej)){var d=e.children[0],p=u===e,f=c===e?e:void 0,_=t(s,e._branch);if(z(d,Y)){var v=d.lexeme,m=i.indexOf(v);-1===m?(-1===a.indexOf(v)&&a.push(v),o&&r(o,{name:v,branch:_,isValueIdentity:p,replacementMemberOwner:f})):o&&(f||p)&&r(o,{formalParameterIndex:m,branch:_,isValueIdentity:p,replacementMemberOwner:f,requiresRuntimeOwnerExpansion:!!f||void 0})}else if(z(d,n)||z(d,tl)){for(var g,y=d.referenceSymbols,S=j(y);!(g=S()).done;){var b=g.value;if(b.unresolved){o&&(f||p)&&r(o,{unresolved:!0,branch:t(_,b.branch),isValueIdentity:p,replacementMemberOwner:f,requiresRuntimeOwnerExpansion:!!f||void 0});continue}var x=b.name,E=b.formalParameterIndex;if(void 0!==x){var C=i.indexOf(x);-1===C?-1===a.indexOf(x)&&a.push(x):(x=void 0,E=C)}if(o){var A=t(_,b.branch),T=null!=f?f:b.replacementMemberOwner,O=p&&b.isValueIdentity,I=void 0!==f||b.requiresRuntimeOwnerExpansion;void 0!==x?r(o,{name:x,branch:A,isValueIdentity:O,replacementMemberOwner:T,requiresRuntimeOwnerExpansion:I}):void 0!==E&&r(o,{formalParameterIndex:E,branch:A,isValueIdentity:O,replacementMemberOwner:T,requiresRuntimeOwnerExpansion:I})}}var R=y.some(function(e){return e.isValueIdentity});o&&d.macroName&&(!y.length&&f||p&&!R&&!d.visibleHasAstValue)&&(r(o,{name:d.macroName,branch:_,isValueIdentity:p,replacementMemberOwner:f,requiresRuntimeOwnerExpansion:!0}),-1===a.indexOf(d.macroName)&&a.push(d.macroName))}return}var M=e.children;if(M)for(var P=0,D=M.length;P<D;P++){var L=M[P];z(L,tr)&&n._collectIdentifierRefs(L,i,a,o,s,c,u)}},n}(tr);e.MacroCallSymbol=tu,tu=eB([tt(eW.macro_call_symbol)],tu);var tl=function(e){function n(){var t;return t=e.apply(this,arguments)||this,t.referenceSymbolNames=[],t.referenceSymbols=[],t.macroName="",t.hasAstValue=!1,t.visibleHasAstValue=!1,t.isFunctionLikeMacro=!1,t.aliasesNonBuiltinIdent=!1,t}ei(n,e);var i=n.prototype;return i.init=function(){this.expandedSyntax=void 0,this.referenceSymbolNames.length=0,this.referenceSymbols.length=0,this.macroName="",this.hasAstValue=!1,this.visibleHasAstValue=!1,this.isFunctionLikeMacro=!1,this.aliasesNonBuiltinIdent=!1},i.semanticAnalyze=function(e){for(var n,i,a,o=this.children[0],s=this.children[2],c=z(s,es)?s.paramNodes:void 0,u=j(o.referenceSymbols);!(a=u()).done;){var l=a.value,h=l.formalParameterIndex;if(void 0===h){r(this.referenceSymbols,l),void 0!==l.name&&-1===this.referenceSymbolNames.indexOf(l.name)&&this.referenceSymbolNames.push(l.name);continue}var d=null==c?void 0:c[h];z(d,tr)&&function e(n,i,a,o){if(i.isValueIdentity){!function(e,n,i,a){var o=e4.unwrapBareIdentifier(e,{allowParens:!0});if(o){var s=o.children[0];if(z(s,Y)){r(i,{name:s.lexeme,branch:t(n.branch,o._branch),isValueIdentity:!0}),-1===a.indexOf(s.lexeme)&&a.push(s.lexeme);return}if(z(s,tu)||z(s,tl)){for(var c,u=!1,l=j(s.referenceSymbols);!(c=l()).done;){var h=c.value;if(h.isValueIdentity){if(h.unresolved){r(i,{unresolved:!0,branch:t(n.branch,h.branch),isValueIdentity:!0}),u=!0;continue}void 0!==h.name&&(r(i,{name:h.name,branch:t(n.branch,h.branch),isValueIdentity:!0}),-1===a.indexOf(h.name)&&a.push(h.name),u=!0)}}u||s.visibleHasAstValue||!s.macroName||(r(i,{name:s.macroName,branch:t(n.branch,o._branch),isValueIdentity:!0}),-1===a.indexOf(s.macroName)&&a.push(s.macroName))}}}(n,i,a,o);return}if(z(n,ej)){var s=n.children[0];if(z(s,Y))r(a,{name:s.lexeme,branch:t(i.branch,n._branch),replacementMemberOwner:i.replacementMemberOwner,requiresRuntimeOwnerExpansion:!0}),-1===o.indexOf(s.lexeme)&&o.push(s.lexeme);else if(z(s,tu)||z(s,tl)){for(var c,u=s.referenceSymbols,l=j(u);!(c=l()).done;){var h=c.value;if(h.unresolved){r(a,{unresolved:!0,branch:t(i.branch,h.branch),replacementMemberOwner:i.replacementMemberOwner,requiresRuntimeOwnerExpansion:!0});continue}void 0!==h.name&&(r(a,{name:h.name,branch:t(i.branch,h.branch),replacementMemberOwner:i.replacementMemberOwner,requiresRuntimeOwnerExpansion:!0}),-1===o.indexOf(h.name)&&o.push(h.name))}!u.length&&s.macroName&&(r(a,{name:s.macroName,branch:t(i.branch,n._branch),replacementMemberOwner:i.replacementMemberOwner,requiresRuntimeOwnerExpansion:!0}),-1===o.indexOf(s.macroName)&&o.push(s.macroName))}return}for(var d,p=j(n.children);!(d=p()).done;){var f=d.value;z(f,tr)&&e(f,i,a,o)}}(d,l,this.referenceSymbols,this.referenceSymbolNames)}this.macroName=o.macroName,this.hasAstValue=o.hasAstValue,this.visibleHasAstValue=o.visibleHasAstValue,this.isFunctionLikeMacro=o.isFunctionLikeMacro,this.aliasesNonBuiltinIdent=o.aliasesNonBuiltinIdent,e.diagnosticsEnabled&&(this.expandedSyntax=null==(i=e.semanticDiagnostics)?void 0:null==(n=i.macroExpansion)?void 0:n.call(i,this,e))},i.codeGen=function(e){return e.cache(this,e.visitMacroCallFunction(this))},n}(tr);e.MacroCallFunction=tl,tl=eB([tt(eW.macro_call_function)],tl);var th=function(e){function t(){return e.apply(this,arguments)||this}ei(t,e);var r=t.prototype;return r.init=function(){this.macroName="",this.isFunction=!1,this.valueExpression=void 0},r.semanticAnalyze=function(e){var t=this,r=this.children;this.macroName=r[1].lexeme;var n=[],i=2;z(r[2],Y)&&r[2].type===U.MACRO_DEFINE_PARAMS&&(this.isFunction=!0,n=e4.parseMacroParamList(r[2].lexeme),i=3),z(r[i],e_)&&(this.valueExpression=r[i]);var a=r[1].branch,o=e.macroDefineList,s=o[this.macroName],c=null==s?void 0:s.find(function(e){var r;return!e.valueAst&&(r=e).isFunction===t.isFunction&&r.params.length===n.length&&r.params.every(function(e,t){return e===n[t]})&&function(e,t){if(e.length!==t.length)return!1;for(var r=0,n=e.length;r<n;r++){var i,a,o,s=e[r],c=t[r];if(s.name!==c.name||s.defined!==c.defined||!Q(s.condition,c.condition))return!1;var u=s.precedingConditions,l=c.precedingConditions;if((null!=(i=null==u?void 0:u.length)?i:0)!==(null!=(a=null==l?void 0:l.length)?a:0))return!1;for(var h=0,d=null!=(o=null==u?void 0:u.length)?o:0;h<d;h++)if(!Q(u[h],l[h]))return!1}return!0}(e.branch,a)});if(c)c.valueAst=this.valueExpression;else{var u={isFunction:this.isFunction,params:n,valueAst:this.valueExpression,dedupKey:this.macroName+"#ast/"+(this.isFunction?n.join(","):""),branch:a};s?s.push(u):o[this.macroName]=[u]}this.isFunction&&e.popScope()},r.codeGen=function(e){return e.cache(this,e.visitMacroDefine(this))},t}(tr);e.MacroDefine=th,th=eB([tt(eW.macro_define)],th)}(g||(g={}));var tn=g,ti=((_={})[_.Shift=0]="Shift",_[_.Reduce=1]="Reduce",_[_.Accept=2]="Accept",_),ta=function(){function e(){}return e.isTerminal=function(e){return e<eW.START},e.toString=function(e){if(this.isTerminal(e)){var t;return null!=(t=B[e])?t:U[e]}return eW[e]},e.createProductionWithOptions=function(e,t,r){return this._createProductionWithOptions(e,t,r,r)},e.createAnalyzerProductionWithOptions=function(e,t,r){return this._createProductionWithOptions(e,t,void 0,r)},e._createProductionWithOptions=function(t,r,n,i){for(var a,o=null!=n?n:tn.TrivialNode,s=null!=i?i:tn.TrivialNode,c=[],u=j(r);!(a=u()).done;)!function(){var r=a.value,u=!n&&1===r.length&&!e.isTerminal(r[0]),l=!i&&1===r.length&&!e.isTerminal(r[0]);c.push([[].concat([t],r),function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];if(r[0]){var i=e.diagnosticsEnabled;if(i?l:u)e.semanticStack.push(r[0]);else{var a=r[0].location.start,c=r[r.length-1].location.end,h=e.objectPool?e.objectPool.createRange(a,c):eh.createRange(a,c);tn.get(i?s:o,e,h,r)}}}])}();return c},e.addMapSetItem=function(e,t,r){var n,i=null!=(n=e.get(t))?n:new Set;i.add(r),e.set(t,i)},e.isSubSet=function(e,t){for(var r,n=j(e);!(r=n()).done;){var i=r.value;if(!t.has(i))return!1}return!0},e.isActionEqual=function(e,t){return e.action===t.action&&e.target===t.target},e.printAction=function(e){var t=ej.pool.get(e.target);return"<Action: "+ti[e.action]+" -> "+this.printProduction(t)+">"},e.printProduction=function(t){var r=t.derivation.map(function(t){return e.toString(t)}).join("|");return eW[t.goal]+" :=> "+r},e}(),to=function(){function e(t,r,n){this._needReInfer=!0,this.production=t,this.position=r,this.lookaheadSet=new Set;for(var i,a=j(n);!(i=a()).done;){var o=i.value;this.lookaheadSet.add(o)}this.id=e._id++}var t=e.prototype;return t.addLookahead=function(e){for(var t,r=j(e);!(t=r()).done;){var n=t.value;this.lookaheadSet.has(n)||(this.lookaheadSet.add(n),this.needReInfer=!0)}},t.symbolByOffset=function(e){return this.production.derivation[this.position+e]},t.canReduce=function(){if(this.position>this.production.derivation.length-1)return!0;for(var e=this.position;e<this.production.derivation.length;e++)if(this.production.derivation[e]!==B.EPSILON)return!1;return!0},t.advance=function(){if(this.canReduce())throw"Error: advance reduce-able parsing state item";return new e(this.production,this.position+1,this.lookaheadSet)},t.toString=function(){var e,t=this.production.derivation.map(function(e){return ta.toString(e)});return t[this.position]="."+(null!=(e=t[this.position])?e:""),eW[this.production.goal]+" :=> "+t.join("|")+" ;"+Array.from(this.lookaheadSet).map(function(e){return ta.toString(e)}).join("/")},er(e,[{key:"needReInfer",get:function(){return this._needReInfer},set:function(e){this._needReInfer=e}},{key:"curSymbol",get:function(){return this.production.derivation[this.position]}},{key:"nextSymbol",get:function(){return this.production.derivation[this.position+1]}}]),e}();to._id=0;var ts=function(){function e(t){this.closured=!1,this._stateItemPool=new Map,this.id=e._id++,this._items=new Set([].concat(t)),this.cores=new Set([].concat(t));for(var r,n=j(t);!(r=n()).done;){var i=r.value,a=this.getStateItemMapKey(i.production,i.position);this._stateItemPool.set(a,i)}e.pool.set(this.id,this)}var t=e.prototype;return t.getStateItemMapKey=function(e,t){return e.id+","+t},t.createStateItem=function(e,t,r){void 0===r&&(r=new Set);var n=this.getStateItemMapKey(e,t),i=this._stateItemPool.get(n);if(i){for(var a,o=j(r);!(a=o()).done;){var s=a.value;i.lookaheadSet.has(s)||(i.lookaheadSet.add(s),i.needReInfer=!0)}return i}var c=new to(e,t,r);return this._stateItemPool.set(n,c),c},e.create=function(t){var r=this.getMapKey(t),n=this.closureMap.get(r);if(n){for(var i,a=j(t);!(i=a()).done;){var o=i.value;n.createStateItem(o.production,o.position,o.lookaheadSet)}return n}var s=new e(t);return this.closureMap.set(r,s),s},e.getMapKey=function(e){return e.map(function(e){return e.production.id+","+e.position}).join(";")},er(e,[{key:"items",get:function(){return this._items}},{key:"needReInfer",get:function(){for(var e,t=j(this.cores);!(e=t()).done;)if(e.value.needReInfer)return!0;return!1}}]),e}();ts.closureMap=new Map,ts.pool=new Map,ts._id=0;var tc=function(){function e(e){this.firstSetMap=new Map,this.followSetMap=new Map,this.actionTable=new Map,this.gotoTable=new Map,this._firstSetNTStack=[],this.grammar=e}var r=e.prototype;return r.generate=function(){this.computeFirstSet(),this.buildStateTable()},r.buildStateTable=function(){var e=[new to(this.grammar.productions[0],0,[B.EOF])],t=ts.create(e);this._extendState(t)},r._extendState=function(e){if(e.needReInfer){this._closure(e);for(var t,r=this._inferNextState(e),n=j(r);!(t=n()).done;){var i=t.value;this._extendState(i)}}},r._closure=function(e){for(var t,r=j(e.cores);!(t=r()).done;){var n=t.value;n.canReduce()||this._extendStateItem(e,n)}return e.closured=!0,e},r._extendStateItem=function(e,t){if(!ta.isTerminal(t.curSymbol)){var r=this.grammar.getProductionList(t.curSymbol);if(void 0!==t.nextSymbol){for(var n=new Set,i=!1,a=1,o=t.symbolByOffset(1);void 0!==o;o=t.symbolByOffset(++a)){if(ta.isTerminal(o)){n.add(o),i=!0;break}s=this.firstSetMap.get(o);for(var s,c,u=j(s);!(c=u()).done;){var l=c.value;n.add(l)}if(!s.has(B.EPSILON))break}if(!i&&(null==s?void 0:s.has(B.EPSILON)))for(var h,d=j(t.lookaheadSet);!(h=d()).done;){var p=h.value;n.add(p)}for(var f,_=j(r);!(f=_()).done;){var v=f.value,m=e.createStateItem(v,0);e.items.has(m)&&ta.isSubSet(n,m.lookaheadSet)||(e.items.add(m),m.addLookahead(n),this._extendStateItem(e,m))}}else for(var g,y=j(r);!(g=y()).done;){var S=g.value,b=e.createStateItem(S,0);e.items.has(b)&&ta.isSubSet(t.lookaheadSet,b.lookaheadSet)||(e.items.add(b),b.addLookahead(t.lookaheadSet),this._extendStateItem(e,b))}}},r._inferNextState=function(e){var t=new Map,r=null!=(i=this.actionTable.get(e.id))?i:new Map,n=null!=(a=this.gotoTable.get(e.id))?a:new Map;this.actionTable.set(e.id,r),this.gotoTable.set(e.id,n);for(var i,a,o,s=j(e.items);!(o=s()).done;){var c=o.value;if(c.canReduce()){var u=void 0;u=c.production.goal!==eW.START?{action:ti.Reduce,target:c.production.id}:{action:ti.Accept};for(var l,h=j(c.lookaheadSet);!(l=h()).done;){var d=l.value;this._addAction(r,d,u)}}else{var p=c.advance();ta.addMapSetItem(t,c.curSymbol,p)}c.needReInfer=!1}for(var f,_=new Set,v=j(t.entries());!(f=v()).done;){var m=f.value,g=m[0],y=m[1],S=ts.create(Array.from(y));ta.isTerminal(g)?this._addAction(r,g,{action:ti.Shift,target:S.id}):n.set(g,S.id),_.add(S)}return _},r._addAction=function(r,n,i){var a=r.get(n);if(a&&!ta.isActionEqual(a,i)){if(e._isKnownShiftPreferred(n,a,i)){if(a.action===ti.Shift&&i.action===ti.Reduce)return}else t.Logger.warn("conflict detect: <Terminal "+ta.toString(n)+"> \n",ta.printAction(a),"\n",ta.printAction(i))}r.set(n,i)},r.computeFirstSet=function(){for(var e,t=j(this.grammar.productions.slice(1));!(e=t()).done;){var r=e.value;this._computeFirstSetForNT(r.goal)}},r._computeFirstSetForNT=function(e){var t=this._firstSetNTStack.findIndex(function(t){return t===e});if(-1!==t){for(var r=this.firstSetMap.get(e),n=this._firstSetNTStack.length,i=n-1;i>t;i--){var a=this._firstSetNTStack[i];this.firstSetMap.set(a,r)}return r}this._firstSetNTStack.push(e);var o=this.grammar.getProductionList(e),s=new Set;this.firstSetMap.set(e,s),this.grammar.isNullableNT(e)&&s.add(B.EPSILON);for(var c,u=j(o);!(c=u()).done;){for(var l=c.value,h=0;h<l.derivation.length;h++){var d=l.derivation[h];if(ta.isTerminal(d)){s.add(d);break}for(var p,f=this._computeFirstSetForNT(d),_=j(f);!(p=_()).done;){var v=p.value;v!==B.EPSILON&&s.add(v)}if(!this.grammar.isNullableNT(d))break}h===l.derivation.length&&s.add(B.EPSILON)}return this._firstSetNTStack.pop(),s},e._isKnownShiftPreferred=function(e,t,r){if(e===U.ELSE)return!0;if(e!==B.LEFT_PAREN)return!1;var n=t.action===ti.Reduce?t:r.action===ti.Reduce?r:null;if(!n)return!1;var i=ej.pool.get(n.target);return!!i&&i.goal===eW.type_specifier_nonarray&&1===i.derivation.length&&i.derivation[0]===eW.macro_call_symbol},e}(),tu=function(){function e(e,t){this.startSymbol=e,t.unshift(new ej(eW.START,[e])),this.productions=t}var t=e.prototype;return t.getProductionList=function(e){return this.productions.filter(function(t){return t.goal===e})},t.isNullableNT=function(e){return this.productions.find(function(t){return t.goal===e&&t.derivation[0]===B.EPSILON})},t.getProductionByID=function(e){return ej.pool.get(e)},e.create=function(t,r){return new e(t,r.map(function(e){return new ej(e[0],e.slice(1))}))},e}(),tl=[].concat(ta.createProductionWithOptions(eW.gs_shader_program,[[eW.global_declaration],[eW.gs_shader_program,eW.global_declaration]],tn.GLShaderProgram),ta.createProductionWithOptions(eW.global_declaration,[[eW.precision_specifier],[eW.variable_declaration_statement],[eW.struct_specifier],[eW.function_definition],[eW.global_macro_if_statement],[eW.macro_undef],[eW.macro_define],[U.MACRO_DEFINE_EXPRESSION]],tn.GlobalDeclaration),ta.createProductionWithOptions(eW.macro_define,[[U.MACRO_DEFINE,B.ID,eW.expression,U.MACRO_DEFINE_END],[U.MACRO_DEFINE,B.ID,U.MACRO_DEFINE_PARAMS,eW.expression,U.MACRO_DEFINE_END]],tn.MacroDefine),ta.createProductionWithOptions(eW.macro_call_symbol,[[U.MACRO_CALL]],tn.MacroCallSymbol),ta.createProductionWithOptions(eW.macro_call_function,[[eW.macro_call_symbol,B.LEFT_PAREN,B.RIGHT_PAREN],[eW.macro_call_symbol,B.LEFT_PAREN,eW.function_call_parameter_list,B.RIGHT_PAREN]],tn.MacroCallFunction),ta.createProductionWithOptions(eW.macro_undef,[[U.MACRO_UNDEF,B.ID],[U.MACRO_UNDEF,U.MACRO_CALL]],tn.MacroUndef),ta.createProductionWithOptions(eW.macro_push_context,[[U.MACRO_IF,U.MACRO_CONDITIONAL_EXPRESSION],[U.MACRO_IFDEF,B.ID],[U.MACRO_IFNDEF,B.ID],[U.MACRO_IFDEF,eW.macro_call_symbol],[U.MACRO_IFNDEF,eW.macro_call_symbol]],tn.MacroPushContext),ta.createProductionWithOptions(eW.macro_pop_context,[[U.MACRO_ENDIF]],tn.MacroPopContext),ta.createProductionWithOptions(eW.macro_elif_expression,[[U.MACRO_ELIF,U.MACRO_CONDITIONAL_EXPRESSION]],tn.MacroElifExpression),ta.createProductionWithOptions(eW.macro_else_expression,[[U.MACRO_ELSE]],tn.MacroElseExpression),ta.createProductionWithOptions(eW.global_macro_declaration,[[eW.global_declaration],[eW.global_macro_declaration,eW.global_declaration]],tn.GlobalMacroDeclaration),ta.createProductionWithOptions(eW.global_macro_if_statement,[[eW.macro_push_context,eW.global_macro_declaration,eW.global_macro_branch],[eW.macro_push_context,eW.global_macro_branch]],tn.GlobalMacroIfStatement),ta.createProductionWithOptions(eW.global_macro_branch,[[eW.macro_pop_context],[eW.macro_elif_expression,eW.global_macro_declaration,eW.global_macro_branch],[eW.macro_else_expression,eW.global_macro_declaration,eW.macro_pop_context],[eW.macro_elif_expression,eW.global_macro_branch],[eW.macro_else_expression,eW.macro_pop_context]],tn.GlobalMacroBranch),ta.createProductionWithOptions(eW.variable_declaration,[[eW.fully_specified_type,B.ID],[eW.fully_specified_type,B.ID,eW.array_specifier],[eW.fully_specified_type,B.ID,B.EQUAL,eW.initializer]],tn.VariableDeclaration),ta.createProductionWithOptions(eW.variable_declaration_list,[[eW.variable_declaration],[eW.variable_declaration_list,B.COMMA,B.ID],[eW.variable_declaration_list,B.COMMA,B.ID,eW.array_specifier]],tn.VariableDeclarationList),ta.createProductionWithOptions(eW.variable_declaration_statement,[[eW.variable_declaration_list,B.SEMICOLON]]),ta.createProductionWithOptions(eW.ext_builtin_type_specifier_nonarray,[[U.VOID],[U.FLOAT],[U.BOOL],[U.INT],[U.UINT],[U.VEC2],[U.VEC3],[U.VEC4],[U.BVEC2],[U.BVEC3],[U.BVEC4],[U.IVEC2],[U.IVEC3],[U.IVEC4],[U.UVEC2],[U.UVEC3],[U.UVEC4],[U.MAT2],[U.MAT3],[U.MAT4],[U.MAT2X3],[U.MAT2X4],[U.MAT3X2],[U.MAT3X4],[U.MAT4X2],[U.MAT4X3],[U.SAMPLER2D],[U.SAMPLER3D],[U.SAMPLER_CUBE],[U.SAMPLER2D_SHADOW],[U.SAMPLER_CUBE_SHADOW],[U.SAMPLER2D_ARRAY],[U.SAMPLER2D_ARRAY_SHADOW],[U.I_SAMPLER2D],[U.I_SAMPLER3D],[U.I_SAMPLER_CUBE],[U.I_SAMPLER2D_ARRAY],[U.U_SAMPLER2D],[U.U_SAMPLER3D],[U.U_SAMPLER_CUBE],[U.U_SAMPLER2D_ARRAY]],tn.ExtBuiltinTypeSpecifierNonArray),ta.createProductionWithOptions(eW.type_specifier_nonarray,[[B.ID],[eW.ext_builtin_type_specifier_nonarray],[eW.macro_call_symbol]],tn.TypeSpecifierNonArray),ta.createProductionWithOptions(eW.fully_specified_type,[[eW.type_specifier],[eW.type_qualifier,eW.type_specifier]],tn.FullySpecifiedType),ta.createProductionWithOptions(eW.type_specifier,[[eW.type_specifier_nonarray],[eW.ext_builtin_type_specifier_nonarray,eW.array_specifier]],tn.TypeSpecifier),ta.createProductionWithOptions(eW.type_qualifier,[[eW.single_type_qualifier],[eW.type_qualifier,eW.single_type_qualifier]],tn.TypeQualifier),ta.createProductionWithOptions(eW.single_type_qualifier,[[eW.storage_qualifier],[eW.precision_qualifier],[eW.interpolation_qualifier],[eW.invariant_qualifier],[U.PRECISE]],tn.SingleTypeQualifier),ta.createAnalyzerProductionWithOptions(eW.storage_qualifier,[[U.CONST],[U.IN],[U.INOUT],[U.OUT],[U.CENTROID]],tn.StorageQualifier),ta.createAnalyzerProductionWithOptions(eW.interpolation_qualifier,[[U.SMOOTH],[U.FLAT]],tn.InterpolationQualifier),ta.createAnalyzerProductionWithOptions(eW.invariant_qualifier,[[U.INVARIANT]],tn.InvariantQualifier),ta.createAnalyzerProductionWithOptions(eW.precision_qualifier,[[U.HIGHP],[U.MEDIUMP],[U.LOWP]],tn.PrecisionQualifier),ta.createProductionWithOptions(eW.struct_specifier,[[U.STRUCT,B.ID,B.LEFT_BRACE,eW.struct_declaration_list,B.RIGHT_BRACE,B.SEMICOLON],[U.STRUCT,B.LEFT_BRACE,eW.struct_declaration_list,B.RIGHT_BRACE,B.SEMICOLON]],tn.StructSpecifier),ta.createProductionWithOptions(eW.struct_declaration_list,[[eW.struct_declaration],[eW.struct_declaration_list,eW.struct_declaration]],tn.StructDeclarationList),ta.createProductionWithOptions(eW.struct_declaration,[[eW.type_specifier,eW.struct_declarator_list,B.SEMICOLON],[eW.type_qualifier,eW.type_specifier,eW.struct_declarator_list,B.SEMICOLON],[eW.layout_qualifier,eW.type_specifier,eW.struct_declarator,B.SEMICOLON],[eW.macro_struct_declaration]],tn.StructDeclaration),ta.createProductionWithOptions(eW.macro_struct_declaration,[[eW.macro_push_context,eW.struct_declaration_list,eW.macro_struct_branch],[eW.macro_push_context,eW.macro_struct_branch]],tn.MacroStructDeclaration),ta.createProductionWithOptions(eW.macro_struct_branch,[[eW.macro_pop_context],[eW.macro_elif_expression,eW.struct_declaration_list,eW.macro_struct_branch],[eW.macro_else_expression,eW.struct_declaration_list,eW.macro_pop_context],[eW.macro_elif_expression,eW.macro_struct_branch],[eW.macro_else_expression,eW.macro_pop_context]],tn.MacroStructBranch),ta.createProductionWithOptions(eW.layout_qualifier,[[U.LAYOUT,B.LEFT_PAREN,U.LOCATION,B.EQUAL,B.INT_CONSTANT,B.RIGHT_PAREN]],tn.LayoutQualifier),ta.createProductionWithOptions(eW.struct_declarator_list,[[eW.struct_declarator],[eW.struct_declarator_list,B.COMMA,eW.struct_declarator]],tn.StructDeclaratorList),ta.createProductionWithOptions(eW.struct_declarator,[[B.ID],[B.ID,eW.array_specifier]],tn.StructDeclarator),ta.createProductionWithOptions(eW.array_specifier,[[B.LEFT_BRACKET,B.RIGHT_BRACKET],[B.LEFT_BRACKET,eW.integer_constant_expression,B.RIGHT_BRACKET]],tn.ArraySpecifier),ta.createProductionWithOptions(eW.integer_constant_expression_operator,[[B.PLUS],[B.DASH],[B.STAR],[B.SLASH],[B.PERCENT]],tn.IntegerConstantExpressionOperator),ta.createProductionWithOptions(eW.integer_constant_expression,[[eW.variable_identifier],[B.INT_CONSTANT],[eW.integer_constant_expression,eW.integer_constant_expression_operator,B.INT_CONSTANT],[eW.integer_constant_expression,eW.integer_constant_expression_operator,eW.variable_identifier]],tn.IntegerConstantExpression),ta.createAnalyzerProductionWithOptions(eW.conditional_expression,[[eW.logical_or_expression],[eW.logical_or_expression,B.QUESTION,eW.expression,B.COLON,eW.assignment_expression]],tn.ConditionalExpression),ta.createAnalyzerProductionWithOptions(eW.logical_or_expression,[[eW.logical_xor_expression],[eW.logical_or_expression,B.OR_OP,eW.logical_xor_expression]],tn.LogicalOrExpression),ta.createAnalyzerProductionWithOptions(eW.logical_xor_expression,[[eW.logical_and_expression],[eW.logical_xor_expression,B.XOR_OP,eW.logical_and_expression]],tn.LogicalXorExpression),ta.createAnalyzerProductionWithOptions(eW.logical_and_expression,[[eW.inclusive_or_expression],[eW.logical_and_expression,B.AND_OP,eW.inclusive_or_expression]],tn.LogicalAndExpression),ta.createAnalyzerProductionWithOptions(eW.inclusive_or_expression,[[eW.exclusive_or_expression],[eW.inclusive_or_expression,B.VERTICAL_BAR,eW.exclusive_or_expression]],tn.InclusiveOrExpression),ta.createAnalyzerProductionWithOptions(eW.exclusive_or_expression,[[eW.and_expression],[eW.exclusive_or_expression,B.CARET,eW.and_expression]],tn.ExclusiveOrExpression),ta.createAnalyzerProductionWithOptions(eW.and_expression,[[eW.equality_expression],[eW.and_expression,B.AMPERSAND,eW.equality_expression]],tn.AndExpression),ta.createAnalyzerProductionWithOptions(eW.equality_expression,[[eW.relational_expression],[eW.equality_expression,B.EQ_OP,eW.relational_expression],[eW.equality_expression,B.NE_OP,eW.relational_expression]],tn.EqualityExpression),ta.createAnalyzerProductionWithOptions(eW.relational_expression,[[eW.shift_expression],[eW.relational_expression,B.LEFT_ANGLE,eW.shift_expression],[eW.relational_expression,B.RIGHT_ANGLE,eW.shift_expression],[eW.relational_expression,B.LE_OP,eW.shift_expression],[eW.relational_expression,B.GE_OP,eW.shift_expression]],tn.RelationalExpression),ta.createAnalyzerProductionWithOptions(eW.shift_expression,[[eW.additive_expression],[eW.shift_expression,B.LEFT_OP,eW.additive_expression],[eW.shift_expression,B.RIGHT_OP,eW.additive_expression]],tn.ShiftExpression),ta.createAnalyzerProductionWithOptions(eW.additive_expression,[[eW.multiplicative_expression],[eW.additive_expression,B.PLUS,eW.multiplicative_expression],[eW.additive_expression,B.DASH,eW.multiplicative_expression]],tn.AdditiveExpression),ta.createAnalyzerProductionWithOptions(eW.multiplicative_expression,[[eW.unary_expression],[eW.multiplicative_expression,B.STAR,eW.unary_expression],[eW.multiplicative_expression,B.SLASH,eW.unary_expression],[eW.multiplicative_expression,B.PERCENT,eW.unary_expression]],tn.MultiplicativeExpression),ta.createAnalyzerProductionWithOptions(eW.unary_expression,[[eW.postfix_expression],[B.INC_OP,eW.unary_expression],[B.DEC_OP,eW.unary_expression],[eW.unary_operator,eW.unary_expression]],tn.UnaryExpression),ta.createAnalyzerProductionWithOptions(eW.unary_operator,[[B.PLUS],[B.DASH],[B.BANG],[B.TILDE]],tn.UnaryOperator),ta.createProductionWithOptions(eW.postfix_expression,[[eW.primary_expression],[eW.postfix_expression,B.LEFT_BRACKET,eW.expression,B.RIGHT_BRACKET],[eW.function_call],[eW.postfix_expression,B.DOT,B.ID],[eW.postfix_expression,B.DOT,eW.function_call],[eW.postfix_expression,B.INC_OP],[eW.postfix_expression,B.DEC_OP]],tn.PostfixExpression),ta.createProductionWithOptions(eW.primary_expression,[[eW.variable_identifier],[B.INT_CONSTANT],[B.FLOAT_CONSTANT],[U.True],[U.False],[B.LEFT_PAREN,eW.expression,B.RIGHT_PAREN]],tn.PrimaryExpression),ta.createProductionWithOptions(eW.expression,[[eW.assignment_expression],[eW.expression,B.COMMA,eW.assignment_expression]],tn.Expression),ta.createProductionWithOptions(eW.assignment_expression,[[eW.conditional_expression],[eW.unary_expression,eW.assignment_operator,eW.assignment_expression]],tn.AssignmentExpression),ta.createAnalyzerProductionWithOptions(eW.assignment_operator,[[B.EQUAL],[B.MUL_ASSIGN],[B.DIV_ASSIGN],[B.MOD_ASSIGN],[B.ADD_ASSIGN],[B.SUB_ASSIGN],[B.LEFT_ASSIGN],[B.RIGHT_ASSIGN],[B.AND_ASSIGN],[B.XOR_ASSIGN],[B.OR_ASSIGN]],tn.AssignmentOperator),ta.createProductionWithOptions(eW.function_call,[[eW.function_call_generic]],tn.FunctionCall),ta.createProductionWithOptions(eW.function_call_generic,[[eW.function_identifier,B.LEFT_PAREN,eW.function_call_parameter_list,B.RIGHT_PAREN],[eW.function_identifier,B.LEFT_PAREN,B.RIGHT_PAREN],[eW.function_identifier,U.VOID,B.RIGHT_PAREN]],tn.FunctionCallGeneric),ta.createProductionWithOptions(eW.function_call_parameter_list,[[eW.assignment_expression],[eW.function_call_parameter_list,B.COMMA,eW.assignment_expression],[eW.macro_call_arg_block],[eW.function_call_parameter_list,eW.macro_call_arg_block]],tn.FunctionCallParameterList),ta.createProductionWithOptions(eW.macro_call_arg_case_list,[[eW.assignment_expression],[B.COMMA,eW.assignment_expression],[eW.macro_call_arg_block],[eW.macro_call_arg_case_list,eW.macro_call_arg_block],[eW.macro_call_arg_case_list,B.COMMA,eW.assignment_expression]],tn.MacroCallArgCaseList),ta.createProductionWithOptions(eW.macro_call_arg_block,[[eW.macro_push_context,eW.macro_call_arg_branch],[eW.macro_push_context,eW.macro_call_arg_case_list,eW.macro_call_arg_branch]],tn.MacroCallArgBlock),ta.createProductionWithOptions(eW.macro_call_arg_branch,[[eW.macro_pop_context],[eW.macro_elif_expression,eW.macro_call_arg_case_list,eW.macro_call_arg_branch],[eW.macro_else_expression,eW.macro_call_arg_case_list,eW.macro_pop_context],[eW.macro_elif_expression,eW.macro_call_arg_branch],[eW.macro_else_expression,eW.macro_pop_context]],tn.MacroCallArgBranch),ta.createProductionWithOptions(eW.function_identifier,[[eW.type_specifier]],tn.FunctionIdentifier),ta.createProductionWithOptions(eW.function_definition,[[eW.function_prototype,eW.compound_statement_no_scope]],tn.FunctionDefinition),ta.createProductionWithOptions(eW.function_prototype,[[eW.function_declarator,B.RIGHT_PAREN]],tn.FunctionProtoType),ta.createProductionWithOptions(eW.function_declarator,[[eW.function_header],[eW.function_header,eW.function_parameter_list]],tn.FunctionDeclarator),ta.createProductionWithOptions(eW.function_header,[[eW.fully_specified_type,B.ID,B.LEFT_PAREN]],tn.FunctionHeader),ta.createProductionWithOptions(eW.function_parameter_list,[[eW.parameter_declaration],[eW.function_parameter_list,B.COMMA,eW.parameter_declaration],[eW.macro_param_block],[eW.function_parameter_list,eW.macro_param_block]],tn.FunctionParameterList),ta.createProductionWithOptions(eW.macro_param_case_list,[[eW.parameter_declaration],[B.COMMA,eW.parameter_declaration],[eW.macro_param_block],[eW.macro_param_case_list,eW.macro_param_block],[eW.macro_param_case_list,B.COMMA,eW.parameter_declaration]],tn.MacroParamCaseList),ta.createProductionWithOptions(eW.macro_param_block,[[eW.macro_push_context,eW.macro_parameter_branch],[eW.macro_push_context,eW.macro_param_case_list,eW.macro_parameter_branch]],tn.MacroParamBlock),ta.createProductionWithOptions(eW.macro_parameter_branch,[[eW.macro_pop_context],[eW.macro_elif_expression,eW.macro_param_case_list,eW.macro_parameter_branch],[eW.macro_else_expression,eW.macro_param_case_list,eW.macro_pop_context],[eW.macro_elif_expression,eW.macro_parameter_branch],[eW.macro_else_expression,eW.macro_pop_context]],tn.MacroParameterBranch),ta.createProductionWithOptions(eW.parameter_declaration,[[eW.type_qualifier,eW.parameter_declarator],[eW.parameter_declarator],[eW.macro_call_symbol],[eW.macro_call_function]],tn.ParameterDeclaration),ta.createProductionWithOptions(eW.parameter_declarator,[[eW.type_specifier,B.ID],[eW.type_specifier,B.ID,eW.array_specifier]],tn.ParameterDeclarator),ta.createProductionWithOptions(eW.statement_list,[[eW.statement],[eW.statement_list,eW.statement]],tn.StatementList),ta.createAnalyzerProductionWithOptions(eW.statement,[[eW.compound_statement],[eW.simple_statement]],tn.Statement),ta.createProductionWithOptions(eW.compound_statement_no_scope,[[B.LEFT_BRACE,B.RIGHT_BRACE],[B.LEFT_BRACE,eW.statement_list,B.RIGHT_BRACE]],tn.CompoundStatementNoScope),ta.createAnalyzerProductionWithOptions(eW.compound_statement,[[B.LEFT_BRACE,B.RIGHT_BRACE],[eW.scope_brace,eW.statement_list,eW.scope_end_brace]],tn.CompoundStatement),ta.createAnalyzerProductionWithOptions(eW.simple_statement,[[eW.declaration],[eW.expression_statement],[eW.selection_statement],[eW.iteration_statement],[eW.jump_statement],[eW.macro_if_statement],[eW.macro_undef],[eW.macro_define],[U.MACRO_DEFINE_EXPRESSION]],tn.SimpleStatement),ta.createProductionWithOptions(eW.declaration,[[eW.function_prototype,B.SEMICOLON],[eW.init_declarator_list,B.SEMICOLON],[U.PRECISION,eW.precision_qualifier,eW.ext_builtin_type_specifier_nonarray,B.SEMICOLON],[eW.type_qualifier,B.ID,B.SEMICOLON],[eW.type_qualifier,B.ID,eW.identifier_list,B.SEMICOLON]],tn.Declaration),ta.createProductionWithOptions(eW.identifier_list,[[B.COMMA,B.ID],[eW.identifier_list,B.COMMA,B.ID]],tn.IdentifierList),ta.createProductionWithOptions(eW.init_declarator_list,[[eW.single_declaration],[eW.init_declarator_list,B.COMMA,B.ID],[eW.init_declarator_list,B.COMMA,B.ID,eW.array_specifier],[eW.init_declarator_list,B.COMMA,B.ID,eW.array_specifier,B.EQUAL,eW.initializer],[eW.init_declarator_list,B.COMMA,B.ID,B.EQUAL,eW.initializer]],tn.InitDeclaratorList),ta.createProductionWithOptions(eW.single_declaration,[[eW.fully_specified_type,B.ID],[eW.fully_specified_type,B.ID,eW.array_specifier],[eW.fully_specified_type,B.ID,eW.array_specifier,B.EQUAL,eW.initializer],[eW.fully_specified_type,B.ID,B.EQUAL,eW.initializer],[eW.fully_specified_type,U.MACRO_CALL],[eW.fully_specified_type,U.MACRO_CALL,B.EQUAL,eW.initializer]],tn.SingleDeclaration),ta.createAnalyzerProductionWithOptions(eW.initializer,[[eW.assignment_expression],[B.LEFT_BRACE,eW.initializer_list,B.RIGHT_BRACE]],tn.Initializer),ta.createAnalyzerProductionWithOptions(eW.initializer_list,[[eW.initializer],[eW.initializer_list,B.COMMA,eW.initializer]],tn.InitializerList),ta.createAnalyzerProductionWithOptions(eW.expression_statement,[[B.SEMICOLON],[eW.expression,B.SEMICOLON]],tn.ExpressionStatement),ta.createAnalyzerProductionWithOptions(eW.selection_statement,[[U.IF,B.LEFT_PAREN,eW.expression,B.RIGHT_PAREN,eW.statement],[U.IF,B.LEFT_PAREN,eW.expression,B.RIGHT_PAREN,eW.statement,U.ELSE,eW.statement]],tn.SelectionStatement),ta.createAnalyzerProductionWithOptions(eW.iteration_statement,[[U.WHILE,B.LEFT_PAREN,eW.condition,B.RIGHT_PAREN,eW.statement],[U.FOR,B.LEFT_PAREN,eW.for_init_statement,eW.for_rest_statement,B.RIGHT_PAREN,eW.statement]],tn.IterationStatement),ta.createProductionWithOptions(eW.precision_specifier,[[U.PRECISION,eW.precision_qualifier,eW.ext_builtin_type_specifier_nonarray,B.SEMICOLON]],tn.PrecisionSpecifier),ta.createAnalyzerProductionWithOptions(eW.for_init_statement,[[eW.expression_statement],[eW.declaration]],tn.ForInitStatement),ta.createAnalyzerProductionWithOptions(eW.condition,[[eW.expression],[eW.fully_specified_type,B.ID,B.EQUAL,eW.initializer]],tn.Condition),ta.createAnalyzerProductionWithOptions(eW.for_rest_statement,[[eW.conditionopt,B.SEMICOLON],[eW.conditionopt,B.SEMICOLON,eW.expression]],tn.ForRestStatement),ta.createAnalyzerProductionWithOptions(eW.conditionopt,[[B.EPSILON],[eW.condition]],tn.ConditionOpt),ta.createProductionWithOptions(eW.jump_statement,[[U.CONTINUE,B.SEMICOLON],[U.BREAK,B.SEMICOLON],[U.RETURN,B.SEMICOLON],[U.RETURN,eW.expression,B.SEMICOLON],[U.DISCARD,B.SEMICOLON]],tn.JumpStatement),ta.createProductionWithOptions(eW.scope_brace,[[B.LEFT_BRACE]],tn.ScopeBrace),ta.createProductionWithOptions(eW.scope_end_brace,[[B.RIGHT_BRACE]],tn.ScopeEndBrace),ta.createProductionWithOptions(eW.variable_identifier,[[B.ID],[eW.macro_call_symbol],[eW.macro_call_function]],tn.VariableIdentifier),ta.createProductionWithOptions(eW.macro_if_statement,[[eW.macro_push_context,eW.statement_list,eW.macro_branch],[eW.macro_push_context,eW.macro_branch]],tn.MacroIfStatement),ta.createProductionWithOptions(eW.macro_branch,[[eW.macro_pop_context],[eW.macro_elif_expression,eW.statement_list,eW.macro_branch],[eW.macro_else_expression,eW.statement_list,eW.macro_pop_context],[eW.macro_elif_expression,eW.macro_branch],[eW.macro_else_expression,eW.macro_pop_context]],tn.MacroBranch)),th=tl.map(function(e){return e[1]}),td=function(e){e.setTranslationRules(th)},tp=function(){function e(){this.globalPrecisions=[],this.globalMacroDeclarations=[],this.directMemberOwnerReferences=[],this.referenceResolutionSnapshots=[]}return e.prototype.getOuterGlobalMacroDeclarations=function(){return this.globalMacroDeclarations.filter(function(e){return z(e.parent,tn.GLShaderProgram)})},e}();function tf(e,t,r){if(t.sourceScope===r.sourceScope)return!1;var n,i,a=null==(n=e.declarations.get(t))?void 0:n.group;if(void 0===a||(null==(i=e.declarations.get(r))?void 0:i.group)!==a)return!1;var o=t.sourceScope<r.sourceScope?t:r;return e.coverage.has(o)&&void 0===e.coverage.get(o)}var t_=function(){function e(e,t,r,n){void 0===n&&(n=void 0!==t),this.branchSemantics=e,this.semanticDiagnostics=t,this.objectPool=r,this.lookupSymbol=new e$("",null),this.arraySymbolScratch=[],this.overloadScratch=[],this.structScratch=[],this.runtimeLookupScratch=[],this.runtimeFallbackScratch=[],this.semanticStack=[],this.acceptRule=void 0,this.symbolTableStack=new ew,this._functionCaptures=[],this._shaderData=new tp,this._translationRules=[],this._sourceScopes=[],this._inheritedDeclarations=[],this.errors=[],this.inMacroDefinition=!1,this._ambiguousReported=new Set,this.diagnosticsEnabled=n,this.symbolTableStack.branchSemantics=e,this.pushScope()}var t=e.prototype;return t.reset=function(e){this._macroDefineList=e,this.semanticStack.length=0,this._shaderData=new tp,this.symbolTableStack.clear(),this.pushScope(),this.errors.length=0,this.inMacroDefinition=!1,this._ambiguousReported.clear(),this._inheritedDeclarations.length=0,this._functionCaptures.length=0,this.runtimeLookupScratch.length=0,this.runtimeFallbackScratch.length=0},t.pushScope=function(){this.symbolTableStack.pushScope(new eF)},t.popScope=function(){return this.symbolTableStack.popScope()},t.setTranslationRules=function(e){this._translationRules=e},t.setSourceScopes=function(e){this._sourceScopes=e},t.assignSourceScope=function(e,t){for(var r=t.start.index,n=this._sourceScopes,i=0,a=n.length-1;i<=a;){var o,s=i+a>>>1,c=n[s];if(r<c.generatedStart)a=s-1;else{if(!(r>=c.generatedEnd))return e.sourceScope=null!=(o=c.sourceScope)?o:0,e;i=s+1}}return e.sourceScope=0,e},t.getTranslationRule=function(e){return this._translationRules[e]},t.beginFunction=function(e){this._functionCaptures.push({header:e,localVariables:[],calledFunctions:[]})},t.endFunction=function(){return this._functionCaptures.pop()},t.recordFunctionVariable=function(e){var t;null==(t=this._functionCaptures[this._functionCaptures.length-1])||t.localVariables.push(e)},t.recordFunctionCall=function(e){var t;null==(t=this._functionCaptures[this._functionCaptures.length-1])||t.calledFunctions.push(e)},t.reportRedefinition=function(e,t,r){var n;this._report(null==(n=this.semanticDiagnostics)?void 0:n.redefinition(e,t.ident,r,t.branchSignature)),this.semanticDiagnostics&&t.sourceScope>0&&1===this.symbolTableStack.stack.length&&!this.inMacroDefinition&&this._isCurrentBranchReachable()&&this._inheritedDeclarations.push({symbol:t,location:e})},t.finalizeInheritance=function(){var e=this._shaderData.declarationOwnership=function(e){var t=new Map,r=new Map,n=new Map;e.forEach(function(e){if(e.astNode){var i,a,o=JSON.stringify([e.type,e.ident]),s=null!=(i=r.get(o))?i:[];s.push(e),r.set(o,s);var c=function(e){if(e.type!==eZ.FN)return JSON.stringify([e.type,e.ident]);if(z(e,e0)){for(var t,r,n=null!=(t=e.astNode.protoType.parameterList)?t:[],i=[],a=j(n);!(r=a()).done;){var o=r.value.typeInfo;if(!o||3e3===o.type)return;if(o.type!==U.VOID||1!==n.length||o.arraySpecifier){var s=o.arraySpecifier,c=null;if(s){if(s.children.some(function(e){return z(e,tn.ArraySpecifier)}))return;if(2===s.children.length)c="unsized";else{if(void 0===s.size)return;c=s.size}}i.push([o.type,c])}}return JSON.stringify([e.type,e.ident,i])}}(e);if(n.set(e,c),void 0!==c){var u=null!=(a=t.get(c))?a:[];u.push(e),t.set(c,u)}}});for(var i,a=new Map,o=new Map,s=new Set,c=0,u=j(t.values());!(i=u()).done;){for(var l,h=i.value,d=!1,p=j(h);!(l=p()).done;)!function(){var e=l.value,t=h.filter(function(t){return t.sourceScope>e.sourceScope});if(t.length){var r=ek(t.map(function(e){return e.branchSignature}),e.branchSignature);o.set(e,r),d||(d=void 0===r)}}();if(d){c++;for(var f,_=j(h);!(f=_()).done;){var v=f.value;if(a.set(v,{id:a.size+1,group:c,sourceScope:v.sourceScope}),!1===o.get(v))for(var m,g=j(h);!(m=g()).done;){var y=m.value;y.sourceScope<=v.sourceScope||!1!==ek([],v.branchSignature.concat(y.branchSignature))||(s.add(v),s.add(y))}}}}for(var S,b=j(r.values());!(S=b()).done;){var x=S.value;if(x.some(function(e){return void 0===n.get(e)}))for(var E,C=j(x);!(E=C()).done;)!function(){var e=E.value,t=x.filter(function(t){return t.sourceScope>e.sourceScope&&t.equal(e)});if(!(!t.length||void 0!==n.get(e)&&t.every(function(e){return n.get(e)}))&&void 0===ek(t.map(function(e){return e.branchSignature}),e.branchSignature)){s.add(e);for(var r,i=j(t);!(r=i()).done;){var a=r.value;s.add(a)}}}()}return{declarations:a,unsupported:Array.from(s),coverage:o}}(this.symbolTableStack.scope);if(this.branchSemantics&&this.semanticDiagnostics){for(var t,r=j(this._inheritedDeclarations);!(t=r()).done;){var n=t.value,i=n.symbol,a=n.location,o=this.symbolTableStack.scope.getInheritedConflict(i,this.branchSemantics,function(t,r){return tf(e,t,r)}),s=this.semanticDiagnostics.redefinition(a,i.ident,o,i.branchSignature);s&&this.errors.push(s)}this._inheritedDeclarations.length=0}},t.reportBranchAvailability=function(e,t,r,n){var i;this._report(null==(i=this.semanticDiagnostics)?void 0:i.branchAvailability(e,t,r,n))},t.reportBranchAmbiguity=function(e,t,r,n,i){var a,o=null==(a=this.semanticDiagnostics)?void 0:a.branchAmbiguity;if(o){var s=r+":"+t;if(!this._ambiguousReported.has(s)){var c=o.call(this.semanticDiagnostics,e,r,n,i);c&&(this._ambiguousReported.add(s),this._report(c))}}},t.reportNonConstArraySize=function(e){var t,r;this._report(null==(r=this.semanticDiagnostics)?void 0:null==(t=r.nonConstArraySize)?void 0:t.call(r,e))},t.reportExpectedSampler=function(e,t,r){var n,i;this._report(null==(i=this.semanticDiagnostics)?void 0:null==(n=i.expectedSampler)?void 0:n.call(i,e,t,r))},t.reportNoMatchingOverload=function(e,t){var r,n;this._report(null==(n=this.semanticDiagnostics)?void 0:null==(r=n.noMatchingOverload)?void 0:r.call(n,e,t))},t.reportUndeclaredStructMember=function(e,t,r){var n,i;this._report(null==(i=this.semanticDiagnostics)?void 0:null==(n=i.undeclaredStructMember)?void 0:n.call(i,e,t,r))},t.canBranchesOverlap=function(e,t){var r,n;return null!=(n=null==(r=this.branchSemantics)?void 0:r.canBranchesOverlap(e,t))?n:"exclusive"!==X(e,t)},t.canDeclarationsCoexist=function(e,t){var r,n;return null==(n=null==(r=this.branchSemantics)?void 0:r.canDeclarationsCoexist(e,t))||n},t.getBranchCoverage=function(e,t){var r,n;return null!=(n=null==(r=this.branchSemantics)?void 0:r.getBranchCoverage(e,t))?n:"covered"},t.isBranchVisibleFrom=function(e,t){var r,n;return null==(n=null==(r=this.branchSemantics)?void 0:r.isBranchVisibleFrom(e,t))||n},t._report=function(e){e&&!this.inMacroDefinition&&this._isCurrentBranchReachable()&&this.errors.push(e)},t._isCurrentBranchReachable=function(){var e,t;return null==(t=null==(e=this.branchSemantics)?void 0:e.isBranchReachable(this.symbolTableStack._currentBranch))||t},er(e,[{key:"shaderData",get:function(){return this._shaderData}},{key:"macroDefineList",get:function(){return this._macroDefineList}},{key:"currentFunctionHeader",get:function(){var e;return null==(e=this._functionCaptures[this._functionCaptures.length-1])?void 0:e.header}}]),e}(),tv=function(){function e(e,t,r,n,i,a,o,s,c){void 0===s&&(s=!1),void 0===c&&(c=void 0!==i),this._source=a,this.semanticErrorsBlockCodegen=s,this.blockingErrors=[],this._traceBackStack=[],this.actionTable=e,this.gotoTable=t,this.grammar=r,this.semanticAnalyzer=new t_(n,i,o,c)}var t=e.prototype;return t.setSource=function(e){var t,r;this._source=e,null==(r=this.semanticAnalyzer.semanticDiagnostics)||null==(t=r.setSource)||t.call(r,e)},t.setSourceScopes=function(e){this.semanticAnalyzer.setSourceScopes(e)},t.parse=function(e,t){this.semanticAnalyzer.reset(t),this.blockingErrors.length=0;var r=this._traceBackStack,n=this.semanticAnalyzer;r.length=0,r.push(0);try{for(var i=e.next();;){var a=i.value,o=this.stateActionTable.get(a.type);if((null==o?void 0:o.action)===ti.Shift){if(r.push(a,o.target),a.type===U.MACRO_DEFINE_PARAMS){n.pushScope();for(var s,c=j(e4.parseMacroParamList(a.lexeme));!(s=c()).done;){var u=s.value;n.symbolTableStack.insert(new e$(u,eZ.VAR))}}n.semanticDiagnostics&&(a.type===U.FOR||a.type===U.WHILE)&&n.pushScope(),i=e.next()}else if((null==o?void 0:o.action)===ti.Accept)return null==n.acceptRule||n.acceptRule.call(n,n),n.finalizeInheritance(),n.semanticStack.pop();else if((null==o?void 0:o.action)===ti.Reduce){for(var l=o.target,h=this.grammar.getProductionByID(l),d=n.getTranslationRule(h.id),p=[],f=h.derivation.length-1;f>=0;f--)if(h.derivation[f]!==B.EPSILON){r.pop();var _=r.pop();if(z(_,Y))p.unshift(_);else{var v=n.semanticStack.pop();p.unshift(v)}}null==d||d.apply(void 0,[].concat([n],p)),n.semanticDiagnostics&&!n.diagnosticsEnabled&&h.goal===eW.iteration_statement&&n.popScope();var m=this.stateGotoTable;r.push(h.goal);var g=m.get(h.goal);r.push(g);continue}else{var y=eh.createGSError("Unexpected token "+a.lexeme,el.CompilationError,this._source,a.location);return this.semanticAnalyzer.errors.push(y),this.blockingErrors.push(y),null}}}catch(e){if(!z(e,eu)||e.name!==el.ScannerError)throw e;return this.semanticAnalyzer.errors.push(e),this.blockingErrors.push(e),null}},e.create=function(t,r,n,i,a,o){void 0===a&&(a=!1),void 0===o&&(o=void 0!==r);var s=this._tables;if(!s){var c=tu.create(eW.gs_shader_program,tl.map(function(e){return e[0]})),u=new tc(c);u.generate(),s=this._tables={actionTable:u.actionTable,gotoTable:u.gotoTable,grammar:c}}var l=new e(s.actionTable,s.gotoTable,s.grammar,t,r,n,i,a,o);return td(l.semanticAnalyzer),l},er(e,[{key:"curState",get:function(){return this._traceBackStack[this._traceBackStack.length-1]}},{key:"stateActionTable",get:function(){return this.actionTable.get(this.curState)}},{key:"stateGotoTable",get:function(){return this.gotoTable.get(this.curState)}},{key:"errors",get:function(){return this.semanticAnalyzer.errors}}]),e}(),tm=new WeakMap,tg="shaders://root/",ty=/^[A-Za-z][A-Za-z\d+.-]*:/,tS=function(){function e(){this._states=Object.create(null),this._versions=Object.create(null),this._frames=[],this._expressionContext={resolveIdentifier:function(){return{}},isDefined:function(){}},this.reachable=!0}var t=e.prototype;return t.processDirective=function(e,t){switch(e){case"if":var r=this.reachable?this._evaluate(t):{value:void 0};return{keep:this._openConditional(r),arm:this._arm(r.value,[],r),error:r.error,errorStart:r.errorStart,errorEnd:r.errorEnd};case"ifdef":var n=this._definedCondition(t,!0);return{keep:this._openConditional(n),arm:this._arm(n.value,[],n),error:n.error};case"ifndef":var i=this._definedCondition(t,!1);return{keep:this._openConditional(i),arm:this._arm(i.value,[],i),error:i.error};case"elif":return this._advanceConditional(t);case"else":return this._advanceElse();case"endif":return{keep:this._closeConditional()};case"define":var a=this.reachable;return a&&this._define(t),{keep:a};case"undef":var o=this.reachable;return o&&this._undef(t),{keep:o};default:return{keep:this.reachable}}},t.captureSnapshot=function(){return{states:e._cloneStates(this._states),versions:Object.assign(Object.create(null),this._versions)}},t.createCachedState=function(e){for(var t,r=new Set([].concat(Object.keys(e.states),Object.keys(this._states))),n=[],i=j(r);!(t=i()).done;){var a,o,s=t.value;(null!=(a=e.versions[s])?a:0)!==(null!=(o=this._versions[s])?o:0)&&n.push(s)}return{snapshot:this.captureSnapshot(),mutatedNames:n}},t.applyCachedState=function(t){for(var r,n=j(t.mutatedNames);!(r=n()).done;)for(var i,a=r.value,o=j(this._frames);!(i=o()).done;)i.value.mutatedNames.add(a);this._states=e._cloneStates(t.snapshot.states),this._versions=Object.assign(Object.create(null),t.snapshot.versions),this._versionKey=void 0},t.cacheKey=function(){for(var e=Object.keys(this._states).sort(),t="",r=0,n=e.length;r<n;r++){var i,a=e[r],o=this._states[a],s=void 0===o.defined?"?":o.defined?"1":"0",c=o.replacementKey;t+=a.length+":"+a+s+(o.functionParams?"f":"v")+(null!=(i=null==c?void 0:c.length)?i:"?")+":"+(null!=c?c:"")}return t+"\0"+this._macroVersionKey()},t._openConditional=function(t){var r=this.reachable,n=e._cloneStates(this._states),i=e._cloneStates(n);return r&&void 0===t.value&&(this._applyAssumption(this._states,t.trueAssumption),this._applyAssumption(i,t.falseAssumption)),this._frames.push({parentReachable:r,remainderReachable:r&&!0!==t.value,remainderValue:void 0===t.value?void 0:!t.value,remainderConditions:this._appendCondition([],t,!0),hasElse:!1,entryState:n,remainderState:i,armStates:[],mutatedNames:new Set}),this.reachable=r&&!1!==t.value,r},t._advanceConditional=function(t){var r=this._frames[this._frames.length-1];if(!r)return{keep:this.reachable};if(this._finishCurrentArm(r),this._states=e._cloneStates(r.remainderState),r.hasElse)return this.reachable=!1,{keep:r.parentReachable};if(!r.remainderReachable)return this.reachable=!1,{keep:!1};var n=this._evaluate(t),i=e._and(r.remainderValue,n.value),a=this._arm(i,r.remainderConditions,n);return r.remainderConditions=this._appendCondition(r.remainderConditions,n,!0),r.remainderValue=e._and(r.remainderValue,void 0===n.value?void 0:!n.value),r.remainderState=e._cloneStates(this._states),void 0===n.value&&(this._applyAssumption(this._states,n.trueAssumption),this._applyAssumption(r.remainderState,n.falseAssumption)),this.reachable=!1!==n.value,!0===n.value&&(r.remainderReachable=!1),{keep:!0,arm:a,error:n.error,errorStart:n.errorStart,errorEnd:n.errorEnd}},t._advanceElse=function(){var t=this._frames[this._frames.length-1];if(!t)return{keep:this.reachable};this._finishCurrentArm(t),this._states=e._cloneStates(t.remainderState);var r=!t.hasElse&&t.remainderReachable,n=!t.hasElse&&t.remainderValue;return this.reachable=r,t.remainderReachable=!1,t.remainderValue=!1,t.hasElse=!0,{keep:r,arm:{value:n,predicates:t.remainderConditions}}},t._closeConditional=function(){var t=this._frames.pop();return t?(this._finishCurrentArm(t),!t.hasElse&&t.remainderReachable&&t.armStates.push(e._cloneStates(t.remainderState)),this._states=this._mergeStates(t),this.reachable=t.parentReachable,t.parentReachable):this.reachable},t._finishCurrentArm=function(t){this.reachable&&t.armStates.push(e._cloneStates(this._states))},t._mergeStates=function(t){for(var r,n,i=this,a=e._cloneStates(t.entryState),o=j(t.mutatedNames);!(n=o()).done;)r=this,function(){var o,s=n.value,c=t.armStates.map(function(e){return i._stateFrom(e,s)}),u=null!=(o=c[0])?o:r._stateFrom(t.entryState,s);if(c.every(function(t){return e._sameState(u,t)}))return a[s]=u;var l=!!c.every(function(e){return!0===e.defined})||!c.every(function(e){return!1===e.defined})&&void 0;a[s]={defined:l}}();return a},t._define=function(e){var t=/^[ \t]*([A-Za-z_]\w*)([\s\S]*)$/.exec(e);if(t){var r=t[1],n=t[2];this._markMutation(r);var i=n.trim();if("("===n[0]){var a=n.indexOf(")");if(a<0){this._states[r]={defined:!0,replacementKey:i};return}var o=n.slice(1,a).split(",").map(function(e){return e.trim()}).filter(Boolean);this._states[r]={defined:!0,replacementKey:i,functionParams:o,functionBody:n.slice(a+1).trim()};return}this._states[r]={defined:!0,replacementKey:i}}},t._undef=function(e){var t,r=null==(t=/^[ \t]*([A-Za-z_]\w*)/.exec(e))?void 0:t[1];r&&(this._markMutation(r),this._states[r]={defined:!1})},t._markMutation=function(e){var t;this._versions[e]=(null!=(t=this._versions[e])?t:0)+1,this._versionKey=void 0;for(var r=0,n=this._frames.length;r<n;r++)this._frames[r].mutatedNames.add(e)},t._evaluate=function(t){var r,n,a,s=this,c=t.trim(),u=S(c),l=b(c,function(e){return s._state(e).defined}),h=(r=function(e){return!1===s._state(e).defined?{body:"0"}:s._macro(e)},"string"==typeof(n=function e(t,r,n,a,s,c){for(var u=t.slice(),l=[],h=0;h<u.length;){var d=u[h];if(a&&"defined"===d.text){l.push(d);for(var p,f,_,v=(null==(_=u[++h])?void 0:_.text)==="("?3:1,m=0;m<v&&h<u.length;m++)l.push(u[h++]);continue}var g="identifier"!==d.kind||(null==(p=d.disabledMacros)?void 0:p.has(d.text))?void 0:r(d.text),y=h+1;if(null==g?void 0:g.parameters)for(;(null==(A=u[y])?void 0:A.kind)==="trivia";)y++;if(!g||g.parameters&&(null==(f=u[y])?void 0:f.text)!=="("){l.push(d),h++;continue}var S=Math.max(s,null!=(T=d.expansionDepth)?T:0)+1;if(S>256)return"Preprocessor macro expansion exceeds 256 nested replacements.";var b=h,x=[],E=new Set(d.disabledMacros);if(g.parameters){var C=function(e,t){for(var r=[[]],n=1,a=t+1;a<e.length;a++){var s=e[a];if("("===s.text)n++,r[r.length-1].push(s);else if(")"===s.text){if(0==--n){for(var c,u=o(r);!(c=u()).done;)(function(e){for(var t=0,r=[!1,!0];t<r.length;t++)for(var n=r[t];e.length;){var a=n?e.length-1:0,o=e[a];if("trivia"!==o.kind)break;var s=o.text.replace(n?/[ \t\v\f]+$/:/^[ \t\v\f]+/,"");if(s===o.text)break;if(s){e[a]=i({},o,{text:s});break}n?e.pop():e.shift()}})(c.value);return{arguments:r,end:a}}r[r.length-1].push(s)}else","===s.text&&1===n?r.push([]):r[r.length-1].push(s)}}(u,y);if(!C||(x=C.arguments,0===g.parameters.length&&1===x.length&&x[0].every(function(e){return"trivia"===e.kind})&&(x=[]),x.length!==g.parameters.length)){l.push(d),h++;continue}for(var A,T,O,I=u[b=C.end].disabledMacros,R=o(E);!(O=R()).done;){var M=O.value;(null==I?void 0:I.has(M))||E.delete(M)}}E.add(d.text);for(var P,D=[],L=new Map,N=o(n(g.body).slice(0,-1));!(P=N()).done;){var k=P.value,V="identifier"===k.kind&&null!=(U=null==(B=g.parameters)?void 0:B.indexOf(k.text))?U:-1,F=[k];if(V>=0){var w=L.get(V);if(!w){var G=e(x[V],r,n,a,S,c);if("string"==typeof G)return G;L.set(V,w=G)}F=w}for(var B,U,z,W=o(F);!(z=W()).done;){var j=function(){var e,t,r=z.value;if(--c.remaining<0)return{v:"Preprocessor macro expansion exceeds 65536 replacement tokens."};if("identifier"!==r.kind&&")"!==r.text)return D.push(r),"continue";var n=E;(null==(e=r.disabledMacros)?void 0:e.size)&&(n=new Set(E),r.disabledMacros.forEach(function(e){return n.add(e)})),D.push(i({},r,{disabledMacros:n,expansionDepth:Math.max(S,null!=(t=r.expansionDepth)?t:0)}))}();if("object"==(j&&"undefined"!=typeof Symbol&&j.constructor===Symbol?"symbol":typeof j))return j.v}}u.splice.apply(u,[].concat([h,b-h+1],D))}return l}(O(l).slice(0,-1),r,O,!0,0,{remaining:65536}))?{expression:"",error:n}:{expression:n.map(function(e){return e.text}).join(" ")});if(h.error)return{value:void 0,error:h.error,errorStart:0,errorEnd:c.length};var d=b(h.expression,function(e){return s._state(e).defined}),p=S(d);if("error"in p)return"error"in u&&u.error.certain?{value:void 0,error:u.error.message,errorStart:u.error.start,errorEnd:u.error.end}:{value:void 0,error:p.error.certain||!p.hasExpandableIdentifier?d===l?p.error.message:"Invalid preprocessor expression after expanding source macros: "+p.error.message:void 0,errorStart:0,errorEnd:c.length};var f=p.hasExpandableIdentifier?{value:void 0,error:void 0}:"number"==typeof(a=R(p.condition,this._expressionContext))?{value:a}:"string"==typeof a?{error:a}:{},_=void 0===f.value||ev(p.condition)?f.value:void 0,v=e._conditionAssumptions(p.condition);return{value:void 0===_?void 0:0!==_,condition:void 0!==_?void 0:p.hasExpandableIdentifier?{kind:"opaque",identity:JSON.stringify([d,this._macroVersionKey()])}:eL(p.condition,this._versions),error:f.error,errorStart:f.error?0:void 0,errorEnd:f.error?c.length:void 0,trueAssumption:null==v?void 0:v.trueAssumption,falseAssumption:null==v?void 0:v.falseAssumption}},t._definedCondition=function(e,t){var r,n=null==(r=/^[ \t]*([A-Za-z_]\w*)/.exec(e))?void 0:r[1];if(!n||!this.reachable)return{value:void 0};var i=this._state(n).defined;return{value:void 0===i?void 0:i===t,condition:eL({t:t?"def":"ndef",m:n},this._versions),trueAssumption:{name:n,defined:t},falseAssumption:{name:n,defined:!t}}},t._arm=function(e,t,r){return{value:e,predicates:!0===e?[]:this._appendCondition(t,r)}},t._appendCondition=function(e,t,r){return(void 0===r&&(r=!1),e)?void 0!==t.value?t.value!==r?e:void 0:t.condition?[].concat(e,[{condition:t.condition,negated:r}]):void 0:void 0},t._macroVersionKey=function(){var e,t=this;return null!=(e=this._versionKey)?e:this._versionKey=JSON.stringify(Object.keys(this._versions).sort().map(function(e){return[e,t._versions[e]]}))},t._applyAssumption=function(e,t){if(t){var r=this._stateFrom(e,t.name);e[t.name]=t.defined?ep({},r,{defined:!0}):{defined:!1}}},t._macro=function(e){var t,r=this._state(e);if(!0===r.defined&&void 0!==r.replacementKey)return r.functionParams?{body:null!=(t=r.functionBody)?t:"",parameters:r.functionParams}:{body:r.replacementKey}},t._state=function(e){return this._stateFrom(this._states,e)},t._stateFrom=function(e,t){var r;return null!=(r=e[t])?r:{defined:void 0}},e._cloneStates=function(e){var t=Object.create(null);for(var r in e)t[r]=e[r];return t},e._sameState=function(e,t){return e.defined===t.defined&&e.replacementKey===t.replacementKey&&!!e.functionParams==!!t.functionParams},e._and=function(e,t){return!1!==e&&!1!==t&&(!0===e&&!0===t||void 0)},e._conditionAssumptions=function(e){if("def"===e.t)return{trueAssumption:{name:e.m,defined:!0},falseAssumption:{name:e.m,defined:!1}};if("ndef"===e.t)return{trueAssumption:{name:e.m,defined:!1},falseAssumption:{name:e.m,defined:!0}};if("not"===e.t){var t=this._conditionAssumptions(e.c);return t?{trueAssumption:t.falseAssumption,falseAssumption:t.trueAssumption}:void 0}},e}(),tb="shaders://root/",tx=/^[A-Za-z][A-Za-z\d+.-]*:/,tE=new WeakMap,tC=new WeakMap,tA=function(){function e(){}return e.parse=function(e,r,n,i,a,o){for(var s,c=this.parseWithErrors(e,r,n,i,a,!0,o),u=j(c.errors);!(s=u()).done;){var l=s.value;t.Logger.error(l.toString())}return c.content},e.parseWithErrors=function(e,t,r,n,i,a,o){void 0===a&&(a=!0);try{return this._expand(e,t,r,n,new Set,i,a,new tS,o,0)}catch(e){if(!z(e,eu)||e.name!==el.PreprocessorError)throw e;return{content:"",errors:[e],sourceMap:[],sourceScopes:[],conditionalArms:new Map}}},e._expand=function(e,t,r,n,i,a,o,s,c,u){var l=this,h=[],d=0,p=e.replace(/\\(?:\r\n|\n|\r)/g,function(e,t){return h.push({offset:t-d,length:e.length,removed:d+e.length}),d+=e.length,""});h.length&&(c=null==c?void 0:c.map(function(e){for(var t,r=0,n=j(h);!(t=n()).done;){var i=t.value;r+=Math.min(i.length,Math.max(0,e-i.offset-r))}return e-r}));var f=e;e=p;var _=[],v=[],m=[],g=new Map,y=[],S=0,b=0,x=0,E=this._maskDirectiveTrivia(e),C=new RegExp(this._directiveReg.source,this._directiveReg.flags),A=function(e,t){throw l._createPreprocessorError(f,l._physicalOffset(e,h),t,a)},T=function(e,t,r){b+e>8388608&&A(r,"Expanded shader source exceeds 8388608 characters."),x+t>65536&&A(r,"Shader include expansion exceeds 65536 source segments."),x+=t};T(0,h.length,0);for(var O=function(e,t){(null==c?void 0:c.length)&&e&&((null==N?void 0:N.sourceScope)===t?N.generatedEnd=b+e:(N={generatedStart:b,generatedEnd:b+e,sourceScope:t},m.push(N)))},I=function(t,r,n){for(;t<r;){var i=l._nextSourceScopeStart(t,r,c),s=null!=i?i:r,h=e.slice(t,s),d=n?h:l._maskText(h),p=l._sourceScopeAt(t,c,u);T(d.length,1,t),y.push(d),O(d.length,p),o&&v.push({generatedStart:b,generatedEnd:b+d.length,sourceStart:t,source:e,sourceFile:a,sourceScope:p}),b+=d.length,t=s}};L=C.exec(E);){I(S,L.index,s.reachable);var R=L[1],M=null!=(V=L[2])?V:"";if("include"!==R){var P=s.processDirective(R,this._stripLineComment(M));if(P.keep&&P.arm){var D=E.indexOf("#",L.index)-L.index;g.set(b+D,P.arm)}if(P.error){var L,N,k,V,F,w,G=M.length-M.trimStart().length,B=M.trim().length,U=C.lastIndex-M.length+G,z=U+Math.min(null!=(F=P.errorStart)?F:0,B),W=U+Math.min(null!=(w=P.errorEnd)?w:B,B);_.push(this._createPreprocessorError(e,z,P.error,a,W))}I(L.index,C.lastIndex,P.keep),S=C.lastIndex;continue}if(!s.reachable){I(L.index,C.lastIndex,!1),S=C.lastIndex;continue}var q=null==(k=this._includePathReg.exec(M))?void 0:k[1];if(!q){_.push(this._createPreprocessorError(e,L.index,"Invalid shader include directive.",a)),S=C.lastIndex;continue}var H=this._resolveIncludePath(q,t);if(!H){_.push(this._createPreprocessorError(e,L.index,'Invalid shader include path "'+q+'".',a)),S=C.lastIndex;continue}var X=r[H];if(void 0===X){_.push(this._createPreprocessorError(e,L.index,'Shader include "'+H+'" was not found.',a)),S=C.lastIndex;continue}if(i.has(H)){_.push(this._createPreprocessorError(e,L.index,'Shader include cycle detected at "'+H+'".',a)),S=C.lastIndex;continue}i.size>=128&&A(L.index,"Shader include nesting exceeds 128 levels.");var Q=s.captureSnapshot(),K=this._sourceScopeAt(L.index,c,u),Y=(o?1:0)+"\0"+H+"\0"+s.cacheKey(),J=n.get(Y),Z=J&&tE.get(J);J&&Z?s.applyCachedState(Z):(i.add(H),J=this._expand(X,this._canonicalIncludeURL(H),r,n,i,H,o,s,void 0,K),i.delete(H),tE.set(J,s.createCachedState(Q)),n.set(Y,J)),T(J.content.length,null!=($=tC.get(J))?$:1,L.index);for(var $,ee,et=j(J.conditionalArms);!(ee=et()).done;){var er=ee.value,en=er[0],ei=er[1];g.set(b+en,ei)}if(y.push(J.content),O(J.content.length,K),o)for(var ea,eo=j(J.sourceMap);!(ea=eo()).done;){var es=ea.value;v.push({generatedStart:b+es.generatedStart,generatedEnd:b+es.generatedEnd,sourceStart:es.sourceStart,source:es.source,sourceFile:es.sourceFile,sourceScope:K})}b+=J.content.length,_.push.apply(_,[].concat(J.errors)),S=C.lastIndex}I(S,e.length,s.reachable);var ec={content:y.join(""),errors:_,sourceMap:v,sourceScopes:m,conditionalArms:g};return h.length&&this._restoreSplicedSource(ec,e,f,a,h),tC.set(ec,x),ec},e._restoreSplicedSource=function(e,t,r,n,i){for(var a,o=this,s=[],c=0,u=j(e.sourceMap);!(a=u()).done;)!function(){var e=a.value;if(e.source!==t||e.sourceFile!==n)return s.push(e);for(var u=e.sourceStart,l=u+e.generatedEnd-e.generatedStart,h=function(t){t<=u||(s.push(ep({},e,{generatedStart:e.generatedStart+u-e.sourceStart,generatedEnd:e.generatedStart+t-e.sourceStart,sourceStart:o._physicalOffset(u,i),source:r})),u=t)};c<i.length&&i[c].offset<=u;)c++;for(;c<i.length&&i[c].offset<l;)h(i[c++].offset);h(l)}();return e.sourceMap=s,e.errors=e.errors.map(function(e){if(e.source!==t||e.file!==n)return e;var a=e.location,s="start"in a?a.start.index:a.index,c="end"in a?a.end.index:s;return o._createPreprocessorError(r,o._physicalOffset(s,i),e.message,n,o._physicalOffset(c,i,c>s))}),e},e._physicalOffset=function(e,t,r){void 0===r&&(r=!1);for(var n=0,i=t.length;n<i;){var a=n+i>>>1,o=t[a].offset;o<e||!r&&o===e?n=a+1:i=a}return e+(n?t[n-1].removed:0)},e._sourceScopeAt=function(e,t,r){if(!(null==t?void 0:t.length))return r;for(var n=0,i=1;i<t.length&&t[i]<=e;i++)n=i;return n},e._nextSourceScopeStart=function(e,t,r){if(r)for(var n,i=j(r);!(n=i()).done;){var a=n.value;if(a>e&&a<t)return a}},e._maskDirectiveTrivia=function(e){return e.replace(/\/\/[^\r\n]*|"[^"\r\n]*"|\/\*[\s\S]*?\*\//g,function(e){return e.startsWith("/*")?e.replace(/[^\r\n]/g," "):e})},e._stripLineComment=function(e){return e.replace(/\/\/.*$/,"")},e._maskText=function(e){return e.replace(/[^\r\n]/g," ")},e._resolveIncludePath=function(e,t){var r="."===e[0]&&t||tb;if(!tx.test(e)&&r.startsWith(tb))return F(new URL(e,r).href);try{var n=new URL(e,r);return F(n.href)}catch(e){return}},e._canonicalIncludeURL=function(e){return tx.test(e)?new URL(e).href:new URL(e,tb).href},e._createPreprocessorError=function(e,t,r,n,i){void 0===i&&(i=t);var a=this._positionAt(e,t);if(i<=t)return new eu(el.PreprocessorError,r,a,e,n);var o=new w;return o.set(a,this._positionAt(e,i)),new eu(el.PreprocessorError,r,o,e,n)},e._positionAt=function(e,t){for(var r=0,n=-1,i=0;i<t;i++){var a=e.charCodeAt(i);10===a?(r++,n=i):13===a&&(n=i)}var o=new G;return o.set(t,r,t-n-1),o},e}();tA._includePathReg=/^[ \t]*"([^"\r\n]+)"[ \t]*(?:(?:\/\/.*)|(?:\/\*.*\*\/[ \t]*))?$/,tA._directiveReg=/^[ \t]*#[ \t]*(include|define|undef|if|ifdef|ifndef|elif|else|endif)\b([^\r\n]*)/gm;var tT=function(e,t,r){void 0===r&&(r=[]),this.program=e,this.source=t,this.sourceMap=r,this.shaderData=e.shaderData},tO=((v={}).Varying="varying",v.Attribute="attribute",v.Mrt="mrt",v),tI=function(){function e(e,t,r,n,i){this.getDeclarationCoexistence=n,this.getBranchCoverage=i;var a,o=e.shaderData.symbolTable,s=e.shaderData.declarationOwnership;this.deferredDeclarationOwnership=s.declarations;var c=tR(o,t),u=tR(o,r);this.vertexEntry=tM(eG.VERTEX,t,c,n,s),this.fragmentEntry=tM(eG.FRAGMENT,r,u,n,s);var l={attributeStructs:[],attributeList:[],varyingStructs:[],varyingList:[],mrtStructs:[],mrtList:[],structVariableRoles:new Map,vertexStructVariableRoles:new Map,fragmentStructVariableRoles:new Map};(function(e,t,r){for(var n,i=new Set,a=new Set,o=new Set,s=j(e);!(n=s()).done;){var c,u,l=n.value.astNode.protoType;"string"==typeof l.returnType.type&&tP(l.returnType.typeSpecifier.structDeclarations,r.varyingStructs,r.varyingList,a),"string"==typeof(null==(u=l.parameterList)?void 0:null==(c=u[0])?void 0:c.typeInfo.type)&&tP(l.parameterList[0].typeInfo.structDeclarations,r.attributeStructs,r.attributeList,i)}for(var h,d=j(t);!(h=d()).done;){var p=h.value;"string"==typeof p.astNode.protoType.returnType.type&&tP(p.astNode.protoType.returnType.typeSpecifier.structDeclarations,r.mrtStructs,r.mrtList,o)}})(c,u,l),this.roleConflicts=function(e){var t=new Map,r=function(e,r){for(var n,i=j(e);!(n=i()).done;){var a,o=n.value,s=null!=(a=t.get(o))?a:[];-1===s.indexOf(r)&&s.push(r),t.set(o,s)}};r(e.attributeStructs,"attribute"),r(e.varyingStructs,"varying"),r(e.mrtStructs,"mrt");var n=[],i=new Set;if(t.forEach(function(e,t){e.length>1&&(n.push({struct:t,roles:e}),i.add(t))}),!i.size)return n;var a=new Set,o=function(e){for(var t=e.length-1;t>=0;t--)if(i.has(e[t])){for(var r,n=j(e[t].propList);!(r=n()).done;){var o=r.value;a.add(o)}e.splice(t,1)}};o(e.attributeStructs),o(e.varyingStructs),o(e.mrtStructs);var s=function(e){for(var t=e.length-1;t>=0;t--)a.has(e[t])&&e.splice(t,1)};return s(e.attributeList),s(e.varyingList),s(e.mrtList),n}(l);var h=new Map;tL(h,l.attributeStructs,"attribute"),tL(h,l.varyingStructs,"varying"),tL(h,l.mrtStructs,"mrt"),this.unsupportedDeferredDeclarations=s.unsupported.concat(function(e,t,r,n){var i=new Map,a=!1;if(e.declarations.forEach(function(e,t){z(t,e1)&&(a=!0);var r,n=null!=(r=i.get(e.group))?r:[];n.push(t),i.set(e.group,n)}),!a)return[];for(var o,s=new Map,c=j(n);!(o=c()).done;){var u,l=o.value,h=l.replacementMemberOwner;if(h){for(;h&&!(z(h,tn.PostfixExpression)&&3===h.children.length);)h=h.parent;var d=null==h?void 0:h.children[2];if(z(d,Y)){for(var p,f,_,v=[],m=j(l.symbols);!(_=m()).done;){var g=_.value;v.push.apply(v,[].concat(null!=(f=null==(p=g.dataType)?void 0:p.structDeclarations)?f:[]))}var y=null!=(u=s.get(l.reference))?u:[];y.push({declarations:v,field:d,branch:l.callSiteBranch}),s.set(l.reference,y)}}}for(var S,b=new Set,x=new Map,E=function(e){var t=x.get(e);return t||(t=function(e,t){for(var r=new Set(z(e,e0)?e.calledFunctions:[]),n=new Set,i=[],a=[e.astNode],o=new Set;a.length;){var s=a.pop();if(!o.has(s)){if(o.add(s),z(s,tn.TypeSpecifier))for(var c,u=j(s.structDeclarations);!(c=u()).done;){var l=c.value;n.add(l),a.push(l)}else if(z(s,tn.VariableIdentifier)){i.push.apply(i,[].concat(null!=(h=t.get(s))?h:[]));for(var h,d,p=j(s.resolvedSymbols());!(d=p()).done;){var f=d.value;(z(f,e0)||f.isGlobalVariable)&&r.add(f)}}else if(z(s,tn.PostfixExpression)&&3===s.children.length&&z(s.children[2],Y)){var _=function e(t){if(z(t,tn.VariableIdentifier)){for(var r,n,i,a=[],o=j(t.resolvedValueSymbols());!(i=o()).done;){var s=i.value;a.push.apply(a,[].concat(null!=(n=null==(r=s.dataType)?void 0:r.structDeclarations)?n:[]))}return a}if(z(t,tn.FunctionCallGeneric)){for(var c,u,l=[],h=j(null!=(c=t.fnSymbols)?c:t.fnSymbol?[t.fnSymbol]:[]);!(u=h()).done;){var d,p,f=u.value;l.push.apply(l,[].concat(null!=(p=null==(d=f.dataType)?void 0:d.structDeclarations)?p:[]))}return l}if(z(t,tn.PostfixExpression)&&3===t.children.length&&z(t.children[2],Y)){for(var _,v=[],m=j(e(t.children[0]));!(_=m()).done;)for(var g,y=_.value,S=j(y.propList);!(g=S()).done;){var b=g.value;b.ident.lexeme===t.children[2].lexeme&&v.push.apply(v,[].concat(b.typeInfo.structDeclarations))}return v}var x=t.children[z(t.children[0],Y)?1:0];return z(x,tr)?e(x):[]}(s.children[0]);_.length&&i.push({declarations:_,field:s.children[2],branch:s._branch})}for(var v,m=j(s.children);!(v=m()).done;){var g=v.value;z(g,tr)&&a.push(g)}}}return{symbols:Array.from(r),types:Array.from(n),members:i}}(e,s),x.set(e,t)),t},C=j(i.values());!(S=C()).done;)!function(){var n=S.value;if(z(n[0],e1))for(var a,o=new Set(n.map(function(e){return e.astNode})),s=j(n);!(a=s()).done;)!function(){for(var n=a.value,s=n.astNode,c=r.get(s),u=new Set,l=t.slice(),h=[],d=!1;l.length;)!function(){var t=l.pop();if(!u.has(t)&&t.astNode){u.add(t);var a=n.branchSignature.concat(t.branchSignature);if(!0!==ek([],a)){var p=e.declarations.get(t),f=(p?i.get(p.group):[t]).filter(function(e){return e.sourceScope>t.sourceScope});if(!f.length||!0!==ek(f.map(function(e){return e.branchSignature}),a)){for(var _,v=E(t),m=j(v.symbols);!(_=m()).done;){var g=_.value,y=e.declarations.get(g);l.push.apply(l,[].concat(y?i.get(y.group):[g]))}v.types.some(function(e){return o.has(e)&&!r.has(e)})&&(d=!0);for(var S,b=j(v.members);!(S=b()).done;)!function(){var e=S.value;if(!0!==ek([],n.branchSignature.concat(e.branch))){var t=e.declarations.filter(function(e){return o.has(e)});t.length&&(h.push({declarations:t,field:e.field,branch:e.branch}),c&&t.some(function(e){return r.get(e)===c})&&s.propList.some(function(t){return t.ident.lexeme===e.field.lexeme})&&(d=!0))}}()}}}}();if(d)for(var p,f=j(h);!(p=f()).done;)!function(){for(var e,t=p.value,i=t.declarations,a=t.field,o=t.branch,u=j(i);!(e=u()).done;){var l=e.value;if(l!==s)for(var h,d=l.propList.filter(function(e){return e.ident.lexeme===a.lexeme}),f=j(d);!(h=f()).done;)!function(){var e=h.value,t=s.propList.filter(function(t){return function(e,t){if(e.ident.lexeme!==t.ident.lexeme||e.typeInfo.type!==t.typeInfo.type||e.isFlat!==t.isFlat||e.mrtIndex!==t.mrtIndex)return!1;var r=e.typeInfo.arraySpecifier,n=t.typeInfo.arraySpecifier;return r&&n?r===n||void 0!==r.size&&r.size===n.size:r===n}(e,t)});(r.get(l)!==c||!0!==ek(t.map(function(e){return e.ident.branch}),n.branchSignature.concat(o,e.ident.branch)))&&b.add(n)}()}}()}()}();return Array.from(b)}(s,c.concat(u),h,e.shaderData.referenceResolutionSnapshots)),a=new Map,o.forEach(function(e){z(e,e0)?a.set(e,function(e,t,r){var n=[],i=[],a=function(e){var i=tk(e,t);i&&(n.push({variable:e,role:i}),r.set(e,i))},o=e.astNode.protoType.parameterList;if(o)for(var s,c=j(o);!(s=c()).done;){var u=s.value.astNode;z(u,tn.ParameterDeclaration)&&u.symbol&&a(u.symbol)}for(var l,h=j(e.localVariables);!(l=h()).done;)a(l.value);return i.push.apply(i,[].concat(e.calledFunctions)),{variables:n,callees:i}}(e,h,l.structVariableRoles)):z(e,e2)&&e.isGlobalVariable&&(tN(l.structVariableRoles,e,h),tN(l.vertexStructVariableRoles,e,h),tN(l.fragmentStructVariableRoles,e,h))}),tD(l.vertexStructVariableRoles,c,a),tD(l.fragmentStructVariableRoles,u,a),this.io=l,this.outerGlobalMacroDeclarations=e.shaderData.getOuterGlobalMacroDeclarations()}return e.create=function(t,r,n,i,a){return void 0===i&&(i=X),void 0===a&&(a=H),new e(t,r,n,i,a)},e}();function tR(e,t){var r=new e$("",null);r.set(t,eZ.FN);var n=e.getSymbols(r,!0,[]);return n.sort(function(e,t){return e.astNode.location.start.index-t.astNode.location.start.index}),n}function tM(e,t,r,n,i){for(var a=!1,o=0,s=r.length;o<s&&!a;o++)for(var c=o+1;c<s;c++)if(!tf(i,r[o],r[c])&&"coexist"===n(r[o].branchSignature,r[c].branchSignature)){a=!0;break}return{stage:e,name:t,functions:r,hasDefiniteAmbiguity:a}}function tP(e,t,r,n){for(var i,a=j(e);!(i=a()).done;){var o=i.value;n.has(o)||(n.add(o),t.push(o),r.push.apply(r,[].concat(o.propList)))}}function tD(e,t,r){for(var n=new Set,i=t.slice();i.length;){var a=i.pop();if(!n.has(a)){n.add(a);var o=r.get(a);if(o){for(var s,c=j(o.variables);!(s=c()).done;){var u=s.value,l=u.variable,h=u.role;e.set(l,h)}i.push.apply(i,[].concat(o.callees))}}}}function tL(e,t,r){for(var n,i=j(t);!(n=i()).done;){var a=n.value;e.set(a,r)}}function tN(e,t,r){var n=tk(t,r);n&&e.set(t,n)}function tk(e,t){for(var r,n,i,a,o=j(null!=(i=null==(r=e.dataType)?void 0:r.structDeclarations)?i:[]);!(a=o()).done;){var s=a.value,c=t.get(s);if(!c||n&&n!==c)return;n=c}return n}function tV(e,t,r){if(!z(e,eu)||e.source!==t)return e;var n,i=e.location,a="start"in i?i:{start:i,end:i},o=function(e,t,r){var n=tF(e,r,!1);if(n){var i=tF(t,r,!0),a=n.sourceStart+e-n.generatedStart,o=(null==i?void 0:i.source)===n.source&&i.sourceFile===n.sourceFile?i.sourceStart+t-i.generatedStart:a;return{source:n.source,sourceFile:n.sourceFile,start:tw(n.source,a),end:tw(n.source,o)}}}(a.start.index,a.end.index,r);if(!o)return e;var s=new w;return s.set(o.start,o.end),new eu(e.name,e.message,s,o.source,null!=(n=o.sourceFile)?n:e.file,e.code)}function tF(e,t,r){for(var n,i=j(t);!(n=i()).done;){var a=n.value;if(e>=a.generatedStart&&(r?e<=a.generatedEnd&&e>a.generatedStart:e<a.generatedEnd))return a}var o=t[t.length-1];return o&&e===o.generatedEnd?o:void 0}function tw(e,t){for(var r=0,n=0,i=0;i<t;i++)10===e.charCodeAt(i)?(r++,n=0):n++;var a=new G;return a.set(t,r,n),a}Object.freeze([]);var tG=Object.freeze([]),tB=Object.freeze([]),tU=new Map;function tz(e){return tv.create(void 0,void 0,void 0,e)}function tW(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];for(var n,i=0,a=j(t);!(n=a()).done;)i+=n.value.length;if(0===i)return tG;for(var o,s=[],c=j(t);!(o=c()).done;){var u=o.value;s.push.apply(s,[].concat(u))}return Object.freeze(s)}var tj=function(){function e(){}return e.createRenderStates=function(){return{constantMap:{},variableMap:{}}},e.createShaderSource=function(e){return{name:e,subShaders:[],pendingContents:[],renderStates:this.createRenderStates()}},e.createSubShaderSource=function(e){return{name:e,passes:[],pendingContents:[],tags:{},renderStates:this.createRenderStates()}},e.createShaderPassSource=function(e){return{name:e,pendingContents:[],contentScopeStarts:[],isUsePass:!1,tags:{},renderStates:this.createRenderStates(),contents:"",vertexEntry:"",fragmentEntry:""}},e.createUsePass=function(e){return{name:e,pendingContents:[],contentScopeStarts:[],isUsePass:!0,tags:{},renderStates:this.createRenderStates(),contents:"",vertexEntry:"",fragmentEntry:""}},e}(),tq=function(){function e(e,t,r){this.ident=e,this.type=t,this.value=r,this.isInMacroBranch=!1,this.branchSignature=K}var t=e.prototype;return t.set=function(e,t,r){this.ident=e,this.type=t,this.value=r},t.equal=function(e){return this.type===e.type},e}(),tH=function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.hasPendingContent=!1,t}ei(t,e);var n=t.prototype;return n.setSource=function(t){e.prototype.setSource.call(this,t),this.hasPendingContent=!1},n.scanNumber=function(){this.skipCommentsAndSpace();var e=this._currentIndex,r=this._source,n=this._currentIndex;return n=t._scanDigits(r,n),"."===r[n]&&(n=t._scanDigits(r,n+1)),this.advance(n-this._currentIndex),Number(r.substring(e,n))},n.scanColor=function(){this.scanLexeme("(");var e=this.scanNumber(),t=0,n=0,i=1;return this.skipCommentsAndSpace(),")"!==this.peek(1)&&(this.scanLexeme(","),t=this.scanNumber(),this.skipCommentsAndSpace(),")"!==this.peek(1)&&(this.scanLexeme(","),n=this.scanNumber(),this.skipCommentsAndSpace(),")"!==this.peek(1)&&(this.scanLexeme(","),i=this.scanNumber(),this.skipCommentsAndSpace()))),this.scanLexeme(")"),new r.Color(e,t,n,i)},n.scanToken=function(){for(;;){if(this.skipCommentsAndSpace(),this.isEnd())return this._createEOFToken();var e=this.getShaderPosition(0);if(ed.isAlpha(this.getCurCharCode())){var r=this._scanWord(e);if(null!==r)return r;this.hasPendingContent=!0;continue}var n=this.getCurChar(),i=t._symbolLexemeTable[n];if(void 0!==i){this.advance(1);var a=this._createToken();return a.set(i,n,e),a}this.advance(1)}},n.scanToCharacter=function(e){for(;this.getCurChar()!==e&&"}"!==this.getCurChar()&&!this.isEnd();)this.advance(1);return this.getCurChar()===e&&(this.advance(1),!0)},n.createCompileError=function(e,t,r){return eh.createGSError(e,el.CompilationError,this.source,null!=t?t:this.getShaderPosition(0),r)},n._scanWord=function(e){for(;ed.isAlnum(this.getCurCharCode())&&!this.isEnd();)this.advance(1);var r,n=this.getShaderPosition(0);if(!this._validateWordBoundaries(e.index,n.index))return null;var i=this._source.substring(e.index,n.index),a=null!=(r=t._keywordLexemeTable[i])?r:B.ID,o=this._createRange(e,n),s=this._createToken();return s.set(a,i,o),s},n._validateWordBoundaries=function(e,t){var r=this._source;if(e>0){var n=r.charCodeAt(e-1);if(!this._isValidWordBoundary(n))return!1}if(t<r.length){var i=r.charCodeAt(t);if(!this._isValidWordBoundary(i))return!1}return!0},n._isValidWordBoundary=function(e){return ed.isWhiteSpaceChar(e,!0)||t._isWordSeparatorChar(e)},t._isWordSeparatorChar=function(e){return 123===e||125===e||61===e||59===e||46===e||91===e||40===e||124===e},t._scanDigits=function(e,t){for(var r=t;r<e.length;){var n=e.charCodeAt(r);if(ed.isDigit(n))r++;else break}return r},t}(ed);tH._keywordLexemeTable={RenderQueueType:U.GSRenderQueueType,BlendState:U.GSBlendState,DepthState:U.GSDepthState,StencilState:U.GSStencilState,RasterState:U.GSRasterState,EditorProperties:U.GSEditorProperties,EditorMacros:U.GSEditorMacros,Editor:U.GSEditor,Tags:U.GSTags,VertexShader:U.GSVertexShader,FragmentShader:U.GSFragmentShader,SubShader:U.GSSubShader,Pass:U.GSPass,BlendFactor:U.GSBlendFactor,BlendOperation:U.GSBlendOperation,Bool:U.GSBool,Number:U.GSNumber,Color:U.GSColor,CompareFunction:U.GSCompareFunction,StencilOperation:U.GSStencilOperation,CullMode:U.GSCullMode,ColorWriteMask:U.GSColorWriteMask,UsePass:U.GSUsePass,true:U.True,false:U.False},tH._symbolLexemeTable={"{":U.LeftBrace,"}":U.RightBrace,"=":U.Equal,"|":U.BitwiseOr};var tX={RenderQueueType:t.RenderQueueType,CompareFunction:t.CompareFunction,StencilOperation:t.StencilOperation,BlendOperation:t.BlendOperation,BlendFactor:t.BlendFactor,CullMode:t.CullMode,ColorWriteMask:t.ColorWriteMask},tQ=function(){function e(){}return e.parse=function(e){return new tK().parse(e).shaderSource},e.parseStrict=function(e,t){return new tK(t).parse(e)},e.parseWithErrors=function(e){return new tK().parseWithErrors(e)},e}(),tK=function(){function e(e){this._objectPool=e,this._errors=[],this._symbolTableStack=new ew,this._lookupSymbol=new tq("",null),this._shaderSource=tj.createShaderSource(""),this._reportedUnexpectedEnd=!1,this._lexer=new tH(void 0,this._objectPool)}var r=e.prototype;return r.parseWithErrors=function(e){try{return this.parse(e)}catch(e){if(!z(e,eu))throw e;return this._errors.push(e),{shaderSource:this._shaderSource,errors:Object.freeze(this._errors.slice())}}},r.parse=function(e){null==(t=this._objectPool)||t.reset(),this._pushScope();var t,r=this._lexer;r.setSource(e);for(var n=this._parseShader(r),i=n.pendingContents,a=n.renderStates,o=0,s=n.subShaders.length;o<s;o++){var c=n.subShaders[o],u={constantMap:ep({},a.constantMap),variableMap:ep({},a.variableMap)};this._mergeRenderStates(u,c.renderStates);for(var l=0,h=c.passes.length;l<h;l++){var d=c.passes[l],p={constantMap:ep({},u.constantMap),variableMap:ep({},u.variableMap)};if(this._mergeRenderStates(p,d.renderStates),d.renderStates=p,!d.isUsePass){var f=this._composePassContents([i,c.pendingContents,d.pendingContents]);d.contents=f.contents,d.contentScopeStarts=f.scopeStarts}}}return{shaderSource:n,errors:Object.freeze(this._errors.slice())}},r._composePassContents=function(e){for(var t,r=[],n=[],i=0,a=j(e);!(t=a()).done;){var o=t.value;n.push(i);for(var s,c=j(o);!(s=c()).done;){var u=s.value;r.length&&i++,r.push(u.content),i+=u.content.length}}return{contents:r.join("\n"),scopeStarts:Object.freeze(n)}},r._parseShader=function(e){e.scanLexeme("Shader");var t=e.scanPairedChar('"','"',!1,!1),r=tj.createShaderSource(t);this._shaderSource=r,e.scanLexeme("{");var n=1;e.skipCommentsAndSpace();for(var i=e.getShaderPosition(0),a=r.pendingContents;;){var o=e.scanToken();switch(o.type){case B.EOF:return this._addPendingContents(i,0,a),this._reportUnexpectedEnd(o,"Shader"),this._popScope(),r;case U.GSSubShader:this._addPendingContents(i,o.lexeme.length,a);var s=this._parseSubShader();r.subShaders.push(s),i=e.getShaderPosition(0);break;case U.GSEditorProperties:case U.GSEditorMacros:case U.GSEditor:this._addPendingContents(i,o.lexeme.length,a),e.scanPairedChar("{","}",!0,!1),i=e.getShaderPosition(0);break;case U.LeftBrace:++n;break;case U.RightBrace:if(0==--n)return this._addPendingContents(i,o.lexeme.length,a),this._popScope(),r;break;default:i=this._parseRenderState(o,i,a,r.renderStates)}}},r._parseRenderStateDeclarationOrAssignment=function(e,t){var r=this._lexer,n=r.scanToken();if(n.type===B.ID){r.scanLexeme("{");var i=this._parseRenderStateProperties(t.lexeme),a=new tq(n.lexeme,t.type,i);this._symbolTableStack.insert(a)}else if("="===n.lexeme){var o,s=r.scanToken();if(s.type===B.EOF)return;if("{"===s.lexeme)o=this._parseRenderStateProperties(t.lexeme);else{r.scanLexeme(";");var c=this._lookupSymbol;c.set(s.lexeme,t.type);var u=this._symbolTableStack.lookup(c);if(!(null==u?void 0:u.value)){this._createCompileError('Invalid "'+t.lexeme+'" variable: '+s.lexeme+" — property will not be applied.",s.location,"InvalidRenderStateVariable");return}o=u.value}this._mergeRenderStates(e,o)}},r._mergeRenderStates=function(e,t){var r=e.constantMap,n=e.variableMap,i=t.constantMap,a=t.variableMap;for(var o in i)delete n[o],r[o]=i[o];for(var s in a)delete r[s],n[s]=a[s]},r._parseVariableDeclaration=function(){var e=this._lexer,t=e.scanToken();e.scanLexeme(";");var r=new tq(t.lexeme,t.type);this._symbolTableStack.insert(r)},r._pushScope=function(){var e=new eF;this._symbolTableStack.pushScope(e)},r._popScope=function(){this._symbolTableStack.popScope()},r._parseRenderStateProperties=function(e){for(var t=this._lexer,r=tj.createRenderStates();"}"!==t.getCurChar()&&!t.isEnd();)this._parseRenderStateProperty(e,r),t.skipCommentsAndSpace();return"}"===t.getCurChar()&&t.advance(1),r},r._createCompileError=function(e,t,r){var n=this._lexer.createCompileError(e,t,r);this._errors.push(n)},r._scanEnumConstValue=function(e){var t,r=this._lexer;r.advance(1);var n=r.scanToken(),i=null==(t=tX[e])?void 0:t[n.lexeme];return void 0==i&&(this._createCompileError("Invalid engine constant: "+e+"."+n.lexeme+" — property will not be applied.",n.location,"InvalidEnumValue"),r.scanToCharacter(";")),i},r._parseRenderStateProperty=function(e,r){var n,i=this._lexer,a=i.scanToken(),o=a.lexeme,s=o;if("BlendState"===e&&"BlendColor"!==o&&"AlphaToCoverage"!==o){var c=0,u=i.scanTwoExpectedLexemes("[","=");if("["===u)c=i.scanNumber(),i.scanLexeme("]"),i.scanLexeme("=");else if("="!==u){this._createCompileError("Invalid syntax, expect '[' or '=', but got unexpected token",void 0,"SyntaxError"),i.scanToCharacter(";");return}s+=c}else i.scanLexeme("=");var l=t.RenderStateElementKey[e+s];if(void 0===l){this._createCompileError("Invalid render state property "+o+" — property will not be applied.",a.location,"InvalidRenderStateProperty"),i.scanToCharacter(";");return}i.skipCommentsAndSpace();var h=i.getCurCharCode();if(ed.isDigit(h)||46===h)n=i.scanNumber();else{var d=i.scanToken(),p=d.type;if(p===B.EOF)return;if(p===U.True)n=!0;else if(p===U.False)n=!1;else if(p===U.GSColor)n=i.scanColor();else if("."===i.getCurChar()){if(void 0==(n=this._scanEnumConstValue(d.lexeme)))return;if(i.skipCommentsAndSpace(),"|"===i.getCurChar()){if("ColorWriteMask"!==d.lexeme){this._createCompileError("Bitwise OR '|' is not supported for '"+d.lexeme+"', only bitmask enums like 'ColorWriteMask' support this — property will not be applied.",d.location,"BitwiseOrOnNonBitmask"),i.scanToCharacter(";");return}for(;"|"===i.getCurChar();){i.advance(1);var f=i.scanToken();if(void 0==f||"."!==i.getCurChar()){this._createCompileError("Invalid syntax after '|', expect 'EnumType.Value'",null==f?void 0:f.location,"SyntaxError"),i.scanToCharacter(";");return}if(f.lexeme!==d.lexeme){this._createCompileError("Cannot mix enum types in bitwise OR: expected '"+d.lexeme+"' but got '"+f.lexeme+"' — property will not be applied.",f.location,"MixedEnumTypes"),i.scanToCharacter(";");return}var _=this._scanEnumConstValue(f.lexeme);if(void 0==_)return;n|=_,i.skipCommentsAndSpace()}}}else{n=d.lexeme;var v=this._lookupSymbol;if(v.set(d.lexeme,B.ID),!this._symbolTableStack.lookup(v)){this._createCompileError("Invalid "+e+" variable: "+d.lexeme+" — property will not be applied.",d.location,"InvalidRenderStateVariable"),i.scanToCharacter(";");return}}}i.scanLexeme(";"),"string"==typeof n?r.variableMap[l]=n:r.constantMap[l]=n},r._parseRenderQueueDeclarationOrAssignment=function(e){var r=this._lexer,n=r.scanToken();if(n.type===B.ID){r.scanLexeme(";");var i=new tq(n.lexeme,U.GSRenderQueueType);this._symbolTableStack.insert(i);return}if("="!==n.lexeme){this._createCompileError("Invalid syntax, expect character '=', but got "+n.lexeme,n.location,"SyntaxError");return}var a=r.scanToken();r.scanLexeme(";");var o=tX.RenderQueueType[a.lexeme],s=t.RenderStateElementKey.RenderQueueType;if(void 0==o){var c=this._lookupSymbol;if(c.set(a.lexeme,U.GSRenderQueueType),!this._symbolTableStack.lookup(c)){this._createCompileError("Invalid RenderQueueType variable: "+a.lexeme+" — property will not be applied at runtime.",a.location,"InvalidRenderQueueVariable");return}e.variableMap[s]=a.lexeme}else e.constantMap[s]=o},r._addPendingContents=function(e,t,r){var n=this._lexer;if(n.hasPendingContent){var i=n.currentIndex-t;r.push({range:{start:e,end:ep({},n.getShaderPosition(0),{index:i-1})},content:n.source.substring(e.index,i-1)}),n.hasPendingContent=!1}},r._parseSubShader=function(){var e=this._lexer;this._pushScope();var t=1,r=e.scanPairedChar('"','"',!1,!1),n=tj.createSubShaderSource(r);e.scanLexeme("{"),e.skipCommentsAndSpace();for(var i=e.getShaderPosition(0);;){var a=e.scanToken();switch(a.type){case B.EOF:return this._addPendingContents(i,0,n.pendingContents),this._reportUnexpectedEnd(a,"SubShader"),this._popScope(),n;case U.GSPass:this._addPendingContents(i,a.lexeme.length,n.pendingContents);var o=this._parsePass(this._retainRange(a.location));n.passes.push(o),i=e.getShaderPosition(0);break;case U.GSUsePass:this._addPendingContents(i,a.lexeme.length,n.pendingContents);var s=e.scanPairedChar('"','"',!1,!1);n.passes.push(tj.createUsePass(s)),i=e.getShaderPosition(0);break;case U.LeftBrace:++t;break;case U.RightBrace:if(0==--t)return this._addPendingContents(i,a.lexeme.length,n.pendingContents),this._popScope(),n;break;default:i=this._parseRenderStateAndTags(a,i,n.pendingContents,n.renderStates,n.tags)}}},r._parseTags=function(e){var t=this._lexer;for(t.scanLexeme("{");;){var r=t.scanToken();t.scanLexeme("=");var n=t.scanPairedChar('"','"',!1,!1);if(t.skipCommentsAndSpace(),e[r.lexeme]=n,"}"===t.peek(1)){t.advance(1);return}t.scanLexeme(",")}},r._parsePass=function(e){this._pushScope();var t=this._lexer,r=t.scanPairedChar('"','"',!1,!1),n=tj.createShaderPassSource(r);t.scanLexeme("{");var i=1;t.skipCommentsAndSpace();for(var a=t.getShaderPosition(0);;){var o=t.scanToken();switch(o.type){case B.EOF:return this._addPendingContents(a,0,n.pendingContents),this._reportUnexpectedEnd(o,"Pass"),this._popScope(),n;case U.GSVertexShader:case U.GSFragmentShader:this._addPendingContents(a,o.lexeme.length,n.pendingContents),t.scanLexeme("=");var s=t.scanToken(),c=o.type===U.GSVertexShader,u=c?"vertexEntry":"fragmentEntry";if(n[u]){this._createCompileError("Reassignment of "+(c?"VertexShader":"FragmentShader")+" entry — the first binding is kept.",s.location,"DuplicateEntryAssignment"),t.scanLexeme(";"),a=t.getShaderPosition(0);break}n[u]=s.lexeme,n[c?"vertexEntryLocation":"fragmentEntryLocation"]=this._retainRange(s.location),t.scanLexeme(";"),a=t.getShaderPosition(0);break;case U.LeftBrace:++i;break;case U.RightBrace:if(0==--i)return this._addPendingContents(a,o.lexeme.length,n.pendingContents),n.vertexEntry&&n.fragmentEntry||this._createCompileError("Pass must bind both VertexShader and FragmentShader entries.",e,"MissingEntry"),this._popScope(),n;break;default:a=this._parseRenderStateAndTags(o,a,n.pendingContents,n.renderStates,n.tags)}}},r._reportUnexpectedEnd=function(e,t){this._reportedUnexpectedEnd||(this._reportedUnexpectedEnd=!0,this._createCompileError("Unexpected end of source while parsing "+t+".",e.location,"SyntaxError"))},r._retainRange=function(e){if(!this._objectPool)return e;var t=new G;t.set(e.start.index,e.start.line,e.start.column);var r=new G;r.set(e.end.index,e.end.line,e.end.column);var n=new w;return n.set(t,r),n},r._parseRenderStateAndTags=function(e,t,r,n,i){return e.type===U.GSTags?(this._addPendingContents(t,e.lexeme.length,r),this._parseTags(i),t=this._lexer.getShaderPosition(0)):t=this._parseRenderState(e,t,r,n),t},r._parseRenderState=function(e,t,r,n){switch(e.type){case U.GSBlendState:case U.GSDepthState:case U.GSRasterState:case U.GSStencilState:this._addPendingContents(t,e.lexeme.length,r),this._parseRenderStateDeclarationOrAssignment(n,e),t=this._lexer.getShaderPosition(0);break;case U.GSBlendFactor:case U.GSBlendOperation:case U.GSBool:case U.GSNumber:case U.GSColor:case U.GSCompareFunction:case U.GSStencilOperation:case U.GSCullMode:case U.GSColorWriteMask:this._addPendingContents(t,e.lexeme.length,r),this._parseVariableDeclaration(),t=this._lexer.getShaderPosition(0);break;case U.GSRenderQueueType:this._addPendingContents(t,e.lexeme.length,r),this._parseRenderQueueDeclarationOrAssignment(n),t=this._lexer.getShaderPosition(0);break;default:this._lexer.hasPendingContent=!0}return t},e}(),tY=0,tJ=function(){function e(){this._tokens={values:[],used:0},this._positions={values:[],used:0},this._ranges={values:[],used:0},this._nodes=[]}var t=e.prototype;return t.reset=function(){this._tokens.used=0,this._positions.used=0,this._ranges.used=0;for(var e,t=j(this._nodes);!(e=t()).done;){var r=e.value;r&&(r.used=0)}},t.createToken=function(){var e,t=this._tokens,r=t.used++;return null!=(e=t.values[r])?e:t.values[r]=new Y(this)},t.createPosition=function(e,t,r){var n,i=this._positions,a=i.used++,o=null!=(n=i.values[a])?n:i.values[a]=new G;return o.set(e,t,r),o},t.createRange=function(e,t){var r,n=this._ranges,i=n.used++,a=null!=(r=n.values[i])?r:n.values[i]=new w;return a.set(e,t),a},t.createNode=function(e){var t,r,n=null!=(t=e.__parserObjectPoolId)?t:e.__parserObjectPoolId=tY++,i=this._nodes[n];i||(i={values:[],used:0},this._nodes[n]=i);var a=i.used++;return null!=(r=i.values[a])?r:i.values[a]=new e},e}(),tZ=function(e,t){var r=t.io,n=t.vertexEntry,i=t.fragmentEntry,a=t.getDeclarationCoexistence,o=t.getBranchCoverage;this.mrtOutputIssues=function(e,t){for(var r,n=[],i=new Map,a=j(e);!(r=a()).done;)!function(){var e=r.value;e.typeInfo.type!==U.VEC4&&n.push({prop:e,kind:"invalid-type"});var a=e.mrtIndex;if(void 0===a)n.push({prop:e,kind:"missing-location"});else if(!Number.isInteger(a)||a<0)n.push({prop:e,kind:"invalid-location"});else if(null==(o=i.get(a))?void 0:o.some(function(r){return"coexist"===t(r.ident.branch,e.ident.branch)}))n.push({prop:e,kind:"duplicate-location"});else{var o,s,c=null!=(s=i.get(a))?s:[];c.push(e),i.set(a,c)}}();return n}(r.mrtList,a),this.invalidMrtReturnLocations=t4(i.functions,r.mrtStructs,!1),this.invalidVaryingReturnLocations=t4(n.functions,r.varyingStructs,!0),this.structMemberOwnerIssues=function(e,t,r,n,i){for(var a=new Set,o=new Set,s=e.slice();s.length;){var c=s.pop();a.has(c)||(a.add(c),o.add(c.astNode),s.push.apply(s,[].concat(c.calledFunctions)))}for(var u,l=new Map,h=j(r);!(u=h()).done;){var d=u.value,p=l.get(d.reference);p||l.set(d.reference,p=[]),p.push(d)}for(var f,_=new Map,v=j(t);!(f=v()).done;)!function(){var e,t=f.value;if(t$(t,o)){var r=t.children[0],a=null==(e=l.get(t))?void 0:e.filter(function(e){return void 0===e.replacementMemberOwner&&(z(r,Y)||e.isValueIdentity)}),s=void 0;if(z(r,Y)){var c=t.resolvedValueSymbols();s=(null==a?void 0:a.length)?a:[{symbols:c,fallbackStart:c.length,callSiteBranch:t._branch}]}else(z(r,tn.MacroCallSymbol)||z(r,tn.MacroCallFunction))&&(s=a);if(null==s?void 0:s.length){var u=!z(r,Y)&&s.some(function(e){return 0===e.symbols.length});u&&t3(_,t,"unresolved-owner","unknown");var h=z(r,Y)||u?void 0:function(e){for(var t=e.parent;t;){if(z(t,tn.PostfixExpression)&&3===t.children.length){var r=t.children[0],n=t.children[2];if(z(r,tr)&&z(n,Y)&&e4.unwrapBareIdentifier(r,{allowParens:!0})===e)return n}t=t.parent}}(t);h&&t3(_,t,"incompatible-io-member",function(e,t,r,n){for(var i,a,o=j(t);!(a=o()).done;)for(var s,c=a.value,u=c.symbols.slice(0,c.fallbackStart),l="covered"===n(u.map(function(e){var t;return null!=(t=e.branchSignature)?t:K}),c.callSiteBranch)?u:c.symbols,h=j(l);!(s=h()).done;){var d=s.value;if(z(d,e2)&&r.has(d)){for(var p,f,_,v,m=t0(c.callSiteBranch,null!=(f=d.branchSignature)?f:K),g=[],y=j(null!=(_=null==(p=d.dataType)?void 0:p.structDeclarations)?_:[]);!(v=y()).done;)for(var S,b=v.value,x=j(b.propList);!(S=x()).done;){var E=S.value;E.ident.lexeme===e.lexeme&&g.push(t0(m,b._branch,E.ident.branch))}var C=n(g,m);if(!g.length||"uncovered"===C)return"definite";"unknown"===C&&(i="unknown")}}return i}(h,s,n,i)),t3(_,t,"mixed-owner-roles",t1(t,s,n,i))}}}();for(var m,g=new Map,y=j(r);!(m=y()).done;){var S=m.value,b=S.replacementMemberOwner;if(void 0!==b&&t$(S.reference,o)){var x=g.get(S.reference);x||g.set(S.reference,x=new Map);var E=x.get(b);E||x.set(b,E=[]),E.push(S)}}for(var C,A=j(g);!(C=A()).done;)for(var T,O=C.value,I=O[0],R=O[1],M=j(R.values());!(T=M()).done;){var P=T.value;P.some(function(e){return 0===e.symbols.length})&&t3(_,I,"unresolved-owner","unknown"),P.some(function(e){return e.requiresRuntimeOwnerExpansion})&&t3(_,I,"runtime-expanded-io-owner",function(e,t,r){for(var n,i=!1,a=j(e);!(n=a()).done;){var o=n.value,s=o.symbols.slice(0,o.fallbackStart),c=r(s.map(function(e){var t;return null!=(t=e.branchSignature)?t:K}),o.callSiteBranch),u="covered"===c?s:o.symbols;if(function(e,t){return e.some(function(e){return z(e,e2)&&t.has(e)})}(u,t)){if("covered"===("covered"===c?c:r(u.map(function(e){var t;return null!=(t=e.branchSignature)?t:K}),o.callSiteBranch)))return"definite";i=!0}}return i?"unknown":void 0}(P,n,i)),t3(_,I,"mixed-owner-roles",t1(I,P,n,i))}return Array.from(_,function(e){var t=e[0],r=e[1];return ep({location:t.location},r)})}([].concat(n.functions,i.functions),e.shaderData.directMemberOwnerReferences,e.shaderData.referenceResolutionSnapshots,r.structVariableRoles,o)};function t$(e,t){for(var r=e.parent;r;){if(z(r,tn.FunctionDefinition))return t.has(r);r=r.parent}return!1}function t0(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];for(var n,i=[],a=j(t);!(n=a()).done;)for(var o,s=n.value,c=j(s);!(o=c()).done;){var u=o.value;-1===i.indexOf(u)&&i.push(u)}return i}function t1(e,t,r,n){for(var i,a=[],o=!1,s=j(t);!(i=s()).done;){for(var c=i.value,u=[],l=0;l<c.fallbackStart;l++)u.push(null!=(f=c.symbols[l].branchSignature)?f:K);var h=n(u,c.callSiteBranch),d=t2(c.symbols,r,c.fallbackStart),p="covered"===h?d:t2(c.symbols,r);if(p.size>1){if(d.size>1&&"covered"===h||d.size<=1&&"uncovered"===h)return"definite";o=!0}for(var f,_,v=j(p);!(_=v()).done;){var m=_.value;-1===a.indexOf(m)&&a.push(m)}}return o?"unknown":a.length<=1?void 0:"covered"===n(t.map(function(e){return e.callSiteBranch}),e._branch)?"definite":"unknown"}function t2(e,t,r){void 0===r&&(r=e.length);for(var n=new Set,i=0;i<r;i++){var a,o=e[i];z(o,e2)&&n.add(null!=(a=t.get(o))?a:"ordinary")}return n}function t3(e,t,r,n){if(n){var i=e.get(t);i&&("unknown"!==i.certainty||"definite"!==n)||e.set(t,{kind:r,certainty:n})}}function t4(e,t,r){for(var n,i=[],a=j(e);!(n=a()).done;){var o=n.value,s=o.astNode.protoType.returnType.typeSpecifier.structDeclarations;s.some(function(e){return t.includes(e)})&&function e(t,r,n,i){if(z(t,tn.JumpStatement)&&3===t.children.length){var a=t.children[1];z(a,tr)&&function(e,t,r){var n,i,a=e4.unwrapBareIdentifier(e,{allowParens:!0}),o=null!=(i=null==a?void 0:a.resolvedValueSymbols())?i:[];if(o.length>0&&o.every(function(e){var r;return z(e,e2)&&(null==(r=e.dataType)?void 0:r.structDeclarations.some(function(e){return t.includes(e)}))}))return!0;if(!r)return!1;var s=e4.unwrapNodeByType(e,eW.function_call),c=null==s?void 0:s.children[0];return z(null==c?void 0:c.fnSymbol,e0)&&(null==(n=c.fnSymbol.dataType)?void 0:n.structDeclarations.some(function(e){return t.includes(e)}))===!0}(a,r,n)||i.push(t.location);return}for(var o,s=j(t.children);!(o=s()).done;){var c=o.value;z(c,tr)&&e(c,r,n,i)}}(o.astNode.statements,s,r,i)}return i}function t9(e,t){return(t9=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function t5(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&t9(e,t)}function t6(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(t6=function(){return!!e})()}function t8(e,t,r){return(t8=t6()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var i=new(Function.bind.apply(e,n));return r&&t9(i,r.prototype),i}).apply(null,arguments)}function t7(e){return(t7=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function re(e){var t="function"==typeof Map?new Map:void 0;return(re=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return t8(e,arguments,t7(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),t9(r,e)})(e)}function rt(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function rr(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return rt(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return rt(e,void 0)}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var rn=/*#__PURE__*/function(){function e(){this._lookupSymbol=new e$("",null),this._structRoles=new Map,this._vertexUnresolvedVariableRoles=new Map,this._fragmentUnresolvedVariableRoles=new Map,this._vertexAmbiguousVariableNames=new Set,this._fragmentAmbiguousVariableNames=new Set,this.attributeStructs=[],this.attributeList=[],this.varyingStructs=[],this.varyingList=[],this.mrtStructs=[],this.mrtList=[],this._referencedGlobalSymbols=new Set,this._referencedGlobalMacroASTs=[],this._structVariableRoles=new Map,this.codeCache=new Map,this.fragmentReturnModes=new Map,this.terminalInterfaceReturns=new Set,this.reset()}var t=e.prototype;return t.reset=function(e){void 0===e&&(e=!0),this.codeCache.clear(),this.fragmentReturnModes.clear(),this.terminalInterfaceReturns.clear(),e&&(this.attributeStructs.length=0,this.attributeList.length=0,this.varyingStructs.length=0,this.varyingList.length=0,this.mrtStructs.length=0,this.mrtList.length=0,this._structRoles.clear(),this._vertexUnresolvedVariableRoles.clear(),this._fragmentUnresolvedVariableRoles.clear(),this._vertexAmbiguousVariableNames.clear(),this._fragmentAmbiguousVariableNames.clear()),this._referencedAttributeList=Object.create(null),this._referencedVaryingList=Object.create(null),this._referencedMRTList=Object.create(null),this._referencedGlobals=Object.create(null),this._referencedGlobalSymbols.clear(),this._globalSymbolQueries=Object.create(null),this._referencedGlobalMacroASTs.length=0,e&&(this._structVariableRoles.clear(),this._passSymbolTable=void 0)},t.getStructRole=function(e){for(var t,r,n=rr(e);!(r=n()).done;){var i=r.value,a=this._structRoles.get(i);if(!a||t&&t!==a)return;t=a}return t},t.hasStructRole=function(e,t){return this._structRoles.get(e)===t},t.registerStructTypes=function(e,t){for(var r,n=rr(t);!(r=n()).done;){var i=r.value;this._structRoles.set(i,e)}},t.registerStructVar=function(e,t,r){if(this._structVariableRoles.set(e,t),void 0!==r){var n=r===eG.VERTEX?this._vertexUnresolvedVariableRoles:this._fragmentUnresolvedVariableRoles,i=r===eG.VERTEX?this._vertexAmbiguousVariableNames:this._fragmentAmbiguousVariableNames,a=e.ident;if(!i.has(a)){var o=n.get(a);o&&o!==t?(n.delete(a),i.add(a)):n.set(a,t)}}},t.getUnresolvedStructVarRole=function(e){var t=this.stage===eG.VERTEX?this._vertexUnresolvedVariableRoles:this._fragmentUnresolvedVariableRoles;return(this.stage===eG.VERTEX?this._vertexAmbiguousVariableNames:this._fragmentAmbiguousVariableNames).has(e)?void 0:t.get(e)},t.getStructVarRole=function(e){for(var t,r,i=rr(e);!(r=i()).done;){var a=r.value;if(!n(a,e2))return;var o=this._structVariableRoles.get(a);if(!o||t&&t!==o)return;t=o}return t},t.registerFragmentReturn=function(e,t){this.fragmentReturnModes.set(e,t)},t.getFragmentReturnMode=function(e){return this.fragmentReturnModes.get(e)},t.registerTerminalInterfaceReturn=function(e){this.terminalInterfaceReturns.add(e)},t.isTerminalInterfaceReturn=function(e){return this.terminalInterfaceReturns.has(e)},t.referenceAttribute=function(e){this._referenceProp(e.lexeme,this.attributeList,this._referencedAttributeList)},t.referenceVarying=function(e){this._referenceProp(e.lexeme,this.varyingList,this._referencedVaryingList)},t.referenceMRTProp=function(e){this._referenceProp(e.lexeme,this.mrtList,this._referencedMRTList)},t.referenceGlobal=function(e,t){var r=null!=(a=(i=this._globalSymbolQueries)[e])?a:i[e]=Object.create(null),n=r[t];if(!n){this._lookupSymbol.set(e,t),n=r[t]=this._passSymbolTable.getSymbols(this._lookupSymbol,!0,[]);for(var i,a,o,s,c,u=null!=(s=(o=this._referencedGlobals)[e])?s:o[e]=[],l=rr(n);!(c=l()).done;){var h=c.value;this._referencedGlobalSymbols.has(h)||(this._referencedGlobalSymbols.add(h),u.push(h))}}null==this.onReferenceGlobal||this.onReferenceGlobal.call(this,n)},t._referenceProp=function(e,t,r){r[e]||(r[e]=t.filter(function(t){return t.ident.lexeme===e})),null==this.onReferenceStructProps||this.onReferenceStructProps.call(this,r[e])},e}(),ri=/*#__PURE__*/function(){function e(){this.array=[]}return e.prototype.dispose=function(){this.array.length=0},e}(),ra=/*#__PURE__*/function(){function e(){this.context=new rn}var t=e.prototype;return t.cache=function(e,t){return this.context.codeCache.set(e,t),t},t.getCachedCode=function(e){return this.context.codeCache.get(e)},t.defaultCodeGen=function(t){var r=e._tmpArrayPool,i=r.get();i.dispose();for(var a,o=rr(t);!(a=o()).done;){var s=a.value;n(s,Y)?i.array.push(s.lexeme):i.array.push(s.codeGen(this))}var c=i.array.join(" ");return i.dispose(),r.return(i),c},t.visitPostfixExpression=function(e){var t=e.children,r=t.length,i=this.context;if(3===r){var a=t[0],o=t[2];if(!n(o,Y))return a.codeGen(this)+"."+o.codeGen(this);var s,c=e4.unwrapBareIdentifier(a,{allowParens:!0});if(c){var u=c.resolvedValueSymbols(),l=e4.extractDirectIdentLexeme(a);s=u.length?i.getStructVarRole(u):l?i.getUnresolvedStructVarRole(l):void 0}return s?(s===tO.Attribute?i.referenceAttribute(o):s===tO.Varying?i.referenceVarying(o):i.referenceMRTProp(o),o.lexeme):a.codeGen(this)+"."+o.lexeme}if(4===r){var h=t[0],d=t[2];return h.codeGen(this)+"["+d.codeGen(this)+"]"}return this.defaultCodeGen(e.children)},t.visitVariableIdentifier=function(e){for(var t,r=rr(e.referenceGlobalSymbolNames);!(t=r()).done;){var i=t.value;this.context.referenceGlobal(i,eZ.Any)}for(var a,o=rr(e.resolvedSymbols());!(a=o()).done;){var s=a.value;n(s,e0)&&this.referenceFunction(s,e.location.start.index,e._branch)}return e.getLexeme(this)},t.referenceFunction=function(e,t,r){this.context.referenceGlobal(e.ident,eZ.FN)},t.visitFunctionCall=function(e){var t=e.children[0];if(n(t.fnSymbol,e0)){for(var r,i,a=rr((null==(r=t.fnSymbols)?void 0:r.length)?t.fnSymbols:[t.fnSymbol]);!(i=a()).done;){var o=i.value;this.referenceFunction(o,e.location.start.index,e._branch)}var s=t.children[2];if(n(s,tn.FunctionCallParameterList)){for(var c=s.paramNodes,u=this.context._referencedGlobals[t.fnSymbol.ident].find(function(e){return n(e,e0)&&e.equal(t.fnSymbol)}),l=(null!=u?u:t.fnSymbol).astNode.protoType.parameterList,h=this.context,d=c.filter(function(e,t){var r,i=null==l?void 0:null==(r=l[t])?void 0:r.astNode;return!n(i,tn.ParameterDeclaration)||!i.symbol||!h.getStructVarRole([i.symbol])}),p="",f=0,_=d.length;f<_;f++){var v=d[f],m=v.codeGen(this);n(v,tn.MacroCallArgBlock)||0===f?p+=m:p+=", "+m}return t.fnSymbol.ident+"("+p+")"}}return this.defaultCodeGen(e.children)},t.visitMacroCallFunction=function(e){var t=e.children[2];if(!n(t,tn.FunctionCallParameterList))return this.defaultCodeGen(e.children);var r,i=t.paramNodes,a=this.context;r=e.isFunctionLikeMacro||!e.aliasesNonBuiltinIdent?i:i.filter(function(e){if(n(e,tn.AssignmentExpression)){var t=e4.unwrapBareIdentifier(e,{allowParens:!1});if(t&&a.getStructVarRole(t.resolvedValueSymbols()))return!1}return!0});for(var o="",s=0,c=r.length;s<c;s++){var u=r[s],l=u.codeGen(this);n(u,tn.MacroCallArgBlock)||0===s?o+=l:o+=", "+l}return e.macroName+"("+o+")"},t.visitStatementList=function(e){var t=e.children;return 1===t.length?t[0].codeGen(this):t[0].codeGen(this)+"\n"+t[1].codeGen(this)},t.visitMacroDefine=function(e){var t="";if(e.isFunction){var r=e.children[2];n(r,Y)&&(t=r.lexeme)}var i=e.valueExpression?e.valueExpression.codeGen(this):"";return"\n#define "+e.macroName+t+(i?" "+i:"")+"\n"},t.visitSingleDeclaration=function(e){return this.defaultCodeGen(e.children)},t.visitGlobalVariableDeclaration=function(e){var t=e.children,r=t[0];if(n(r,tn.FullySpecifiedType)&&r.typeSpecifier.isCustom){var i=this.context;if(i.getStructVarRole([e.declarator.symbol]))return"";i.referenceGlobal(r.type,eZ.STRUCT)}return"uniform "+this.defaultCodeGen(t)},t.visitDeclaration=function(e){var t=this.context,r=e.children,i=r[0];if(n(i,tn.InitDeclaratorList)){var a,o=i.children[0],s=null!=(a=i.declarator)?a:n(o,tn.SingleDeclaration)?o.declarator:void 0,c=s&&t.getStructVarRole([s.symbol]);if(c===tO.Varying||c===tO.Mrt)return""}return this.defaultCodeGen(r)},t.visitFunctionParameterList=function(e){for(var t=this.context,r=e.parameterInfoList.filter(function(e){var r=e.astNode;return!n(r,tn.ParameterDeclaration)||!r.symbol||!t.getStructVarRole([r.symbol])}),i="",a=0,o=r.length;a<o;a++){var s=r[a].astNode,c=s.codeGen(this);n(s,tn.MacroParamBlock)||0===a?i+=c:i+=", "+c}return i},t.visitFunctionHeader=function(e){var t=e.returnType.typeSpecifier;return this.context.getStructRole(t.structDeclarations)===tO.Varying?"void "+e.ident.lexeme+"(":this.defaultCodeGen(e.children)},t.visitJumpStatement=function(e){var t=e.children;if(t[0].type===U.RETURN){var r=t[1];if(n(r,tn.Expression)){var i=e4.unwrapNodeByType(r,eW.variable_identifier);if(i&&this.context.getStructVarRole(i.resolvedValueSymbols())===tO.Varying)return this.context.isTerminalInterfaceReturn(e)?"":"return;";var a=e4.unwrapNodeByType(r,eW.function_call),o=null==a?void 0:a.children[0],s=n(null==o?void 0:o.fnSymbol,e0)?o.fnSymbol.astNode.protoType.returnType.typeSpecifier.structDeclarations:[];if(this.context.getStructRole(s)===tO.Varying){var c=""+r.codeGen(this)+";";return this.context.isTerminalInterfaceReturn(e)?c:"{ "+c+" return; }"}}}return this.defaultCodeGen(t)},t.visitFunctionIdentifier=function(e){return this.defaultCodeGen(e.children)},t.visitTypeSpecifier=function(e){return this.defaultCodeGen(e.children)},t.visitStructSpecifier=function(e){var t=this,r=this.context,i=r.varyingStructs,a=r.attributeStructs,o=r.mrtStructs,s=-1!==i.indexOf(e),c=-1!==a.indexOf(e),u=-1!==o.indexOf(e);if(!s&&!c&&!u)return this.defaultCodeGen(e.children);var l=[];l.push.apply(l,[].concat(e.macroExpressions.map(function(e){return{text:n(e,Y)?e.lexeme:e.codeGen(t),index:e.location.start.index}})));for(var h,d=rr(e.propList);!(h=d()).done;){var p,f,_,v=h.value,m=v.ident.lexeme;s&&(null==(p=r._referencedVaryingList[m])?void 0:p.indexOf(v))>=0?l.push({text:""+this.getVaryingProp(v)+"\n",index:v.ident.location.start.index}):c&&(null==(f=r._referencedAttributeList[m])?void 0:f.indexOf(v))>=0?l.push({text:""+this.getAttributeProp(v)+"\n",index:v.ident.location.start.index}):u&&(null==(_=r._referencedMRTList[m])?void 0:_.indexOf(v))>=0&&l.push({text:""+this.getMRTProp(v)+"\n",index:v.ident.location.start.index})}return l.sort(function(e,t){return e.index-t.index}).map(function(e){return e.text}).join("")},t.visitFunctionDefinition=function(e){var t=e.protoType.ident.lexeme,r=this.context,i=e4.lastStatement(e.statements);return(n(i,tn.JumpStatement)&&r.registerTerminalInterfaceReturn(i),t==r.stageEntry)?"void main() "+e.statements.codeGen(this):this.defaultCodeGen(e.children)},e}();ra._tmpArrayPool=new t.ReturnableObjectPool(ri,10);var ro=/*#__PURE__*/function(){function e(){}return e.declaration=function(e,t,r){if(void 0===r&&(r=!0),!t)return e;var n=r?"\0D"+t.id+","+t.group+","+t.sourceScope+"\0\n":"";return e?n+"\0T"+t.id+"\0\n"+e+"\n\0E\0\n":n},e.sharedDeclaration=function(e,t){return e?"\0T"+t.map(function(e){return e.id}).join(",")+"\0\n"+e+"\n\0E\0\n":""},e.reference=function(e,t){return"\0R"+e+","+t+"\0\n"},e.source=function(e){return 0>e.indexOf("\0")?e:e.replace(/\0[^\0]*\0\n?/g,"")},e.parse=function(r,n){for(var i,a=[],o=r.length,s=0,c=[];s<o;){var u=e._findDirectiveStart(r,s,o);if(-1===u){e._pushText(a,r,s,o,i);break}u>s&&e._pushText(a,r,s,u,i);var l=e._findLogicalLineEnd(r,u,o),h=r.substring(u,l).replace(/\\(?:\r\n|\n|\r)/g,"");if(s=l<o?l+1:o,0===h.charCodeAt(0)){var d=h.charAt(1);if("D"===d){var p=h.slice(2,-1).split(",").map(Number);a.push([t.ShaderPreprocessorDirective.Declaration,p[0],p[1],p[2]])}else if("R"===d){var f=h.slice(2,-1).split(",").map(Number);a.push([t.ShaderPreprocessorDirective.Reference,f[0],f[1]])}else{var _=h.slice(2,-1);i="T"===d?_?_.split(",").map(Number):[]:void 0}continue}var v=e._DIRECTIVE_RE.exec(h);if(!v){var m=l<o?h+"\n":h;e._pushText(a,m,0,m.length,i);continue}var g=v[1],y=v[2].trim();switch(g){case"ifdef":var S=a.length;a.push([t.ShaderPreprocessorDirective.IfDef,y,-1]),c.push([S]);break;case"ifndef":var b=a.length;a.push([t.ShaderPreprocessorDirective.IfNdef,y,-1]),c.push([b]);break;case"if":var x=e._parseCondition(y,n),E=a.length;e._pushConditionInstruction(a,x),c.push([E]);break;case"elif":var C=c[c.length-1],A=C[C.length-1],T=a.length;a.push([t.ShaderPreprocessorDirective.Else,-1]),C.push(T),e._backfillJump(a[A],a.length);var O=e._parseCondition(y,n),I=a.length;e._pushConditionInstruction(a,O),C.push(I);break;case"else":var R=c[c.length-1],M=R[R.length-1],P=a.length;a.push([t.ShaderPreprocessorDirective.Else,-1]),R.push(P),e._backfillJump(a[M],a.length);break;case"endif":var D=a.length;a.push([t.ShaderPreprocessorDirective.Endif]);var L=c.pop();if(L)for(var N=D+1,k=0;k<L.length;k++){var V=a[L[k]];V[0]===t.ShaderPreprocessorDirective.Else?V[1]=N:e._backfillJump(V,N,!0)}break;case"define":var F=e._FUNC_MACRO_RE.exec(y);if(F){var w=F[2].split(",").map(function(e){return e.trim()}).filter(function(e){return e.length>0});a.push([t.ShaderPreprocessorDirective.DefineFunc,F[1],w,e._stripLineComment(F[3].trim())])}else{var G=e._findInlineWhitespace(y);G===y.length?a.push([t.ShaderPreprocessorDirective.Define,y]):a.push([t.ShaderPreprocessorDirective.DefineVal,y.substring(0,G),e._stripLineComment(y.substring(G+1).trim())])}break;case"undef":a.push([t.ShaderPreprocessorDirective.Undef,y])}}return a},e._pushConditionInstruction=function(e,r){"def"===r.t?e.push([t.ShaderPreprocessorDirective.IfDef,r.m,-1]):"ndef"===r.t?e.push([t.ShaderPreprocessorDirective.IfNdef,r.m,-1]):"cmp"===r.t?e.push([t.ShaderPreprocessorDirective.IfCmp,r.m,r.op,r.v,-1]):e.push([t.ShaderPreprocessorDirective.IfExpr,r,-1])},e._parseCondition=function(e,t){var r,n=null!=(r=null==t?void 0:t.get(e))?r:S(e);if("error"in n){if(!n.error.certain&&n.hasExpandableIdentifier)return{t:"deferred",e:e};throw Error(n.error.message)}if(n.evaluationError)throw Error(n.evaluationError);var i=function e(t){switch(t.t){case"def":case"bool":case"cmp":return t;case"and":var r=e(t.l),n=e(t.r);return r&&n?{t:"and",l:r,r:n}:void 0;case"or":var i=e(t.l),a=e(t.r);return i&&a?{t:"or",l:i,r:a}:void 0;case"not":var o=e(t.c);return o?{t:"not",c:o}:void 0;case"id":return{t:"cmp",m:t.m,op:"!=",v:0};case"binary":return function(e){var t;if("=="===(t=e.op)||"!="===t||">"===t||">="===t||"<"===t||"<="===t){var r,n=x(e.r);if("id"===e.l.t&&void 0!==n)return{t:"cmp",m:e.l.m,op:e.op,v:n};var i=x(e.l);return"id"===e.r.t&&void 0!==i?{t:"cmp",m:e.r.m,op:function(e){switch(e){case"<":return">";case"<=":return">=";case">":return"<";case">=":return"<=";default:return e}}(e.op),v:i}:void 0===(r=x(e))?void 0:{t:"bool",v:0!==r}}}(t);case"num":return{t:"bool",v:0!==t.v};case"ndef":return{t:"not",c:{t:"def",m:t.m}};case"unary":case"deferred":return}}(n.condition);return i&&!n.hasExpandableIdentifier?i:n.hasExpandableIdentifier?{t:"deferred",e:e}:n.condition},e._findDirectiveStart=function(e,t,r){for(var n=t;n<r;){for(var i=n;i<r;){var a=e.charCodeAt(i);if(32===a||9===a)i++;else break}if(i<r&&(35===e.charCodeAt(i)||0===e.charCodeAt(i)))return n;var o=e.indexOf("\n",n);if(-1===o)break;n=o+1}return -1},e._findLogicalLineEnd=function(e,t,r){for(var n=e.indexOf("\n",t);-1!==n;){var i=13===e.charCodeAt(n-1)?n-2:n-1;if(i<t||92!==e.charCodeAt(i))return n;n=e.indexOf("\n",n+1)}return r},e._findInlineWhitespace=function(e){for(var t=0;t<e.length;){var r=e.charCodeAt(t);if(32===r||9===r)break;t++}return t},e._pushText=function(e,r,n,i,a){if(!(n>=i)){var o=e.length>0?e[e.length-1]:null,s=void 0===a?t.ShaderPreprocessorDirective.Text:t.ShaderPreprocessorDirective.OwnedText;o&&o[0]===s&&(void 0===a||o.length===a.length+2&&a.every(function(e,t){return o[t+2]===e}))?o[1]+=r.substring(n,i):e.push(void 0===a?[s,r.substring(n,i)]:[].concat([s,r.substring(n,i)],a))}},e._backfillJump=function(e,r,n){void 0===n&&(n=!1);var i=e[0];i===t.ShaderPreprocessorDirective.IfDef||i===t.ShaderPreprocessorDirective.IfNdef?n&&-1!==e[2]||(e[2]=r):i===t.ShaderPreprocessorDirective.IfCmp?n&&-1!==e[4]||(e[4]=r):i!==t.ShaderPreprocessorDirective.IfExpr||n&&-1!==e[2]||(e[2]=r)},e._stripLineComment=function(e){var t=e.indexOf("//");return t>=0?e.substring(0,t).trimEnd():e},e}();ro._DIRECTIVE_RE=/^[ \t]*#[ \t]*(if|ifdef|ifndef|elif|else|endif|define|undef)\b(.*)/,ro._FUNC_MACRO_RE=/^(\w+)\(([^)]*)\)\s*(.*)/;var rs=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t._globalCodeArray=[],t._forwardFunctionDeclarations=new Map,t._forwardStructIndices=new Map,t._structCodeSegments=new Map,t._forwardVariableIndices=new Map,t._variableCodeSegments=new Map,t._declarationOwners=new Map,t._deferredPrototypes=new Map,t._declarationReferences=new Map,t._outerMacroDeclarations=[],t}t5(t,e);var r,i=t.prototype;return i.reset=function(){this._globalCodeArray.length=0,this._forwardFunctionDeclarations.clear(),this._forwardStructIndices.clear(),this._structCodeSegments.clear(),this._forwardVariableIndices.clear(),this._variableCodeSegments.clear(),this._deferredPrototypes.clear(),this._declarationReferences.clear(),this._currentDeclaration=void 0},i.dispose=function(){this.context.reset(),this.reset()},i.getOtherGlobal=function(e,t){for(var r,n=rr(e.globalPrecisions);!(r=n()).done;){var i=r.value;t.push({text:i.codeGen(this),index:i.location.start.index})}},i.generate=function(e,t){var r=this;this.context.reset(),this.reset();var n=e.program.shaderData,i=this.context;i._passSymbolTable=n.symbolTable;var a=t.outerGlobalMacroDeclarations,o=t.io;(u=i.attributeStructs).push.apply(u,[].concat(o.attributeStructs)),(l=i.attributeList).push.apply(l,[].concat(o.attributeList)),(h=i.varyingStructs).push.apply(h,[].concat(o.varyingStructs)),(d=i.varyingList).push.apply(d,[].concat(o.varyingList)),(p=i.mrtStructs).push.apply(p,[].concat(o.mrtStructs)),(f=i.mrtList).push.apply(f,[].concat(o.mrtList)),i.registerStructTypes(tO.Attribute,o.attributeStructs),i.registerStructTypes(tO.Varying,o.varyingStructs),i.registerStructTypes(tO.Mrt,o.mrtStructs),o.structVariableRoles.forEach(function(e,t){return i.registerStructVar(t,e)}),o.vertexStructVariableRoles.forEach(function(e,t){i.registerStructVar(t,e,eG.VERTEX)}),o.fragmentStructVariableRoles.forEach(function(e,t){i.registerStructVar(t,e,eG.FRAGMENT)}),this._sourceIR=e,this._outerMacroDeclarations=a;try{if(t.deferredDeclarationOwnership.forEach(function(e,t){return r._declarationOwners.set(t.astNode,e)}),this._declarationOwners.size){var s=0,c=0;this._declarationOwners.forEach(function(e){s=Math.max(s,e.id),c=Math.max(c,e.group)}),n.symbolTable.forEach(function(e){e.astNode&&!r._declarationOwners.has(e.astNode)&&r._declarationOwners.set(e.astNode,{id:++s,group:++c,sourceScope:e.sourceScope})}),i.onReferenceGlobal=function(e){for(var t,n,i,a=null!=(n=null==(t=r.currentDeclarationOwner)?void 0:t.id)?n:0,o=rr(e);!(i=o()).done;){var s=i.value;r._referenceDeclaration(a,s.astNode)}};for(var u,l,h,d,p,f,_,v=new Map,m=rr([].concat(o.attributeStructs,o.varyingStructs,o.mrtStructs));!(_=m()).done;)for(var g,y=_.value,S=rr(y.propList);!(g=S()).done;){var b=g.value;v.set(b,y)}i.onReferenceStructProps=function(e){for(var t,n,i,a=null!=(n=null==(t=r.currentDeclarationOwner)?void 0:t.id)?n:0,o=rr(e);!(i=o()).done;){var s=i.value;r._referenceDeclaration(a,v.get(s))}}}if(t.unsupportedDeferredDeclarations.length)throw tV(new eu(el.CompilationError,"Deferred inheritance requires exact signatures and cannot resolve a known partial-coverage conflict.",t.unsupportedDeferredDeclarations[0].astNode.location,e.source,void 0,"UnsupportedDeferredDeclaration"),e.source,e.sourceMap);return{vertex:this._vertexMain(t.vertexEntry,n,a),fragment:this._fragmentMain(t.fragmentEntry,n,a)}}finally{this._sourceIR=void 0,this._outerMacroDeclarations=[],this._declarationOwners.clear(),i.onReferenceGlobal=void 0,i.onReferenceStructProps=void 0}},i._vertexMain=function(e,t,r){var n=this.context;n.stage=eG.VERTEX,n.stageEntry=e.name,this._preRegisterGlobalMacroRefs(r);var i=this._globalCodeArray;n.referenceGlobal(e.name,eZ.FN),this._getGlobalSymbol(i),this._getCustomStruct(n.attributeStructs,i),this._getCustomStruct(n.varyingStructs,i),this._getGlobalMacroDeclarations(r,i),this.getOtherGlobal(t,i),this._emitDeclarationReferences(i);var a=i.sort(function(e,t){return e.index-t.index}).map(function(e){return e.text}).join("\n");return n.reset(!1),this.reset(),a},i._fragmentMain=function(e,t,r){var n=this,i=this.context;i.stage=eG.FRAGMENT,i.stageEntry=e.name,this.prepareFragment(e,r),e.functions.forEach(function(e){var t=e.astNode.protoType.returnType,r=t.type===U.VEC4?"color":t.typeSpecifier.structDeclarations.some(function(e){return i.hasStructRole(e,tO.Mrt)})?"mrt":void 0;if(r){var a=e.astNode.statements;n._registerFragmentReturns(a,r,e4.lastStatement(a))}}),this._preRegisterGlobalMacroRefs(r);var a=this._globalCodeArray;i.referenceGlobal(e.name,eZ.FN),this._getGlobalSymbol(a),this._getCustomStruct(i.varyingStructs,a),this._getCustomStruct(i.mrtStructs,a),this._getGlobalMacroDeclarations(r,a),this.getOtherGlobal(t,a),this._emitDeclarationReferences(a);var o=a.sort(function(e,t){return e.index-t.index}).map(function(e){return e.text}).join("\n");return i.reset(),this.reset(),o},i.prepareFragment=function(e,t){},i._preRegisterGlobalMacroRefs=function(e){for(var t,r=rr(e);!(t=r()).done;){var n=t.value;this._walkMacroDefineTokens(n.children)}},i._walkMacroDefineTokens=function(e){for(var t,r=rr(e);!(t=r()).done;){var i=t.value;if(n(i,tn.MacroDefine))i.valueExpression&&i.valueExpression.codeGen(this);else if(n(i,tr)){var a=this._currentDeclaration;n(i,tn.FunctionDefinition)&&(this._currentDeclaration=i),this._walkMacroDefineTokens(i.children),this._currentDeclaration=a}}},i._registerFragmentReturns=function(e,t,r){if(n(e,tn.JumpStatement)&&3===e.children.length){this.context.registerFragmentReturn(e,t),e===r&&this.context.registerTerminalInterfaceReturn(e);return}for(var i,a=rr(e.children);!(i=a()).done;){var o=i.value;n(o,tr)&&this._registerFragmentReturns(o,t,r)}},i._getGlobalSymbol=function(e){for(var t,r=this.context,i=rr(r._referencedGlobalSymbols);!(t=i()).done;){var a=t.value;this._currentDeclaration=a.astNode;var o=a.astNode.codeGen(this);if(this._currentDeclaration=void 0,o){var s=o+(a.type===eZ.VAR?";":"");if(!a.isInMacroBranch){var c={text:this._declaration(s,a.astNode),index:a.astNode.location.start.index};e.push(c),n(a.astNode,tn.StructSpecifier)&&this._structCodeSegments.set(a.astNode,c),n(a.astNode,tn.VariableDeclaration)&&this._variableCodeSegments.set(a.astNode,c)}}}this._getForwardDeclarations(e);for(var u,l=rr(this._deferredPrototypes.values());!(u=l()).done;){var h=u.value;e.push(h)}for(var d,p=rr(this._forwardFunctionDeclarations);!(d=p()).done;){var f=d.value,_=f[0],v=f[1];_.isInMacroBranch||e.push({text:v,index:_.location.start.index})}},i.referenceFunction=function(t,r,i){var a=this;e.prototype.referenceFunction.call(this,t,r,i);var o=t.astNode,s=this._forwardFunctionDeclarations;if(t.ident!==this.context.stageEntry){var c=this.context._referencedGlobals[t.ident].filter(function(e){return n(e,e0)&&e.equal(t)}),u=this._declarationOwners.get(o);if(u){for(var l,h,d=rr(c);!(h=d()).done;)l=this,function(){var e=h.value.astNode,t=l._declarationOwners.get(e);if(t&&t.group===u.group&&!(t.sourceScope<=u.sourceScope)&&!(e.location.start.index<=r)){var n=e.protoType,i=o.location.start.index,a=l._deferredPrototypes.get(e);if(!a||!(a.index<=i)){(!l._isContextIndependent(n)||l._hasDeclarationContextBarrier(i,n.location.start.index,!1))&&l._unsupportedForwardDeclaration(n);var s=l._outerMacroDeclarations.find(function(e){return e.location.start.index<=i&&e.location.end.index>=o.location.end.index}),c=null!=(d=null==s?void 0:s.location.start.index)?d:i;l._prepareForwardTypes(n.returnType.typeSpecifier.structDeclarations,i,c);for(var d,p,f,_=rr(null!=(p=n.parameterList)?p:[]);!(f=_()).done;){var v,m,g=f.value;l._prepareForwardTypes(null!=(m=null==(v=g.typeInfo)?void 0:v.structDeclarations)?m:[],i,c)}l._deferredPrototypes.set(e,{text:l._declaration(""+n.codeGen(l)+";",e,!1),index:c})}}}();return}if(!c.some(function(e){return e.astNode===o})){var p=c.filter(function(e){return a._canBranchesOverlap(e.branchSignature,i)});if(!eN(p.filter(function(e){return e.astNode.location.start.index<r}).map(function(e){return e.branchSignature}),i)){var f=p.find(function(e){return e.astNode.location.start.index>r});if(f){for(var _,v=f.astNode.protoType,m=o.location.start.index,g=""+v.codeGen(this)+";",y=this._getForwardSignature(v),S=rr(c);!(_=S()).done;){var b=_.value;this._canBranchesOverlap(b.branchSignature,t.branchSignature)&&this._getForwardSignature(b.astNode.protoType)!==y&&this._unsupportedForwardDeclaration(b.astNode.protoType)}if(s.has(o))return;(!this._isContextIndependent(v)||this._hasDeclarationContextBarrier(m,v.location.start.index,!1))&&this._unsupportedForwardDeclaration(v);var x=this._outerMacroDeclarations.find(function(e){return e.location.start.index<=m&&e.location.end.index>=o.location.end.index}),E=null!=(C=null==x?void 0:x.location.start.index)?C:m;this._prepareForwardTypes(v.returnType.typeSpecifier.structDeclarations,m,E);for(var C,A,T,O=rr(null!=(A=v.parameterList)?A:[]);!(T=O()).done;){var I,R,M=T.value;n(M.astNode,tn.ParameterDeclaration)&&M.astNode.symbol&&this.context.getStructVarRole([M.astNode.symbol])||this._prepareForwardTypes(null!=(R=null==(I=M.typeInfo)?void 0:I.structDeclarations)?R:[],m,E)}s.set(o,g)}}}}},i._getForwardSignature=function(e){for(var t,r,i,a=[],o=rr(null!=(r=e.parameterList)?r:[]);!(i=o()).done;)t=this,function(){var e=i.value,r=e.astNode;if(!(n(r,tn.ParameterDeclaration)&&r.symbol&&t.context.getStructVarRole([r.symbol]))){var o=[],s=function(t){n(t,Y)?t!==e.ident&&t.type!==U.IN&&o.push(t.lexeme):t.children.forEach(s)};s(r);var c=o.join(" ");"void"!==c&&a.push(c)}}();return e.returnType.codeGen(this)+"("+a.join(",")+")"},i._canBranchesOverlap=function(e,t){return"exclusive"!==X(e,t)&&!eN([],[].concat(e,t))},i.visitVariableIdentifier=function(t){for(var r,i,a=e.prototype.visitVariableIdentifier.call(this,t),o=rr(t.resolvedSymbols());!(i=o()).done;)r=this,function(){var e=i.value;if(n(e,e2)&&e.isUniform){var a=null==(c=r.context._referencedGlobals[e.ident])?void 0:c.filter(function(e){return n(e,e2)}),o=r._declarationOwners.get(e.astNode);if(!(!a||!o&&a.includes(e))){var s=a.filter(function(e){return e.astNode.location.start.index<t.location.start.index});if(!(!o&&eN(s.map(function(e){return e.branchSignature}),t._branch)))for(var c,u,l,h=r._outerMacroDeclarations.find(function(t){return t.location.start.index<=e.astNode.location.start.index&&t.location.end.index>=e.astNode.location.end.index}),d=null!=(u=null==h?void 0:h.location.start.index)?u:e.astNode.location.start.index,p=rr(a);!(l=p()).done;)(function(){var e,i,a=l.value;if(!(a.astNode.location.start.index<=t.location.start.index)){if(o){var s=r._declarationOwners.get(a.astNode);if(!s||s.group!==o.group||s.sourceScope<=o.sourceScope)return}var c=a.astNode;n(a,e2)&&a.isUniform&&n(c,tn.VariableDeclaration)||r._unsupportedForwardDeclaration(c);var u=r._outerMacroDeclarations.find(function(e){return e.location.start.index<=c.location.start.index&&e.location.end.index>=c.location.end.index});(!r._isContextIndependent(c)||r._hasDeclarationContextBarrier(d,null!=(e=null==u?void 0:u.location.end.index)?e:c.location.end.index,!0))&&r._unsupportedForwardDeclaration(c),r._prepareForwardTypes(a.dataType.structDeclarations,d),r._forwardVariableIndices.set(c,Math.min(null!=(i=r._forwardVariableIndices.get(c))?i:1/0,d))}})()}}}();return a},i._getForwardDeclarations=function(e){for(var t,r,i=this,a=new Map,o=Array.from(this._forwardStructIndices),s=rr(this._forwardVariableIndices);!(r=s()).done;){var c=r.value;o.push(c)}for(var u,l=function(e){return i._declaration(e.codeGen(i)+(n(e,tn.VariableDeclaration)?";":""),e,!1)},h=rr(o);!(u=h()).done;)t=this,function(){var r=u.value,i=r[0],o=r[1],s=t._declarationOwners.get(i),c=t._outerMacroDeclarations.find(function(e){return e.location.start.index<=i.location.start.index&&e.location.end.index>=i.location.end.index});if(c){if(s)e.push({text:l(i),index:o});else{var h=a.get(c);h||a.set(c,h={index:o,declarations:[]}),h.index=Math.min(h.index,o),h.declarations.push(i)}}else{var d=n(i,tn.StructSpecifier)?t._structCodeSegments.get(i):t._variableCodeSegments.get(i);d&&(s?d.text=t._declaration("",i):e.splice(e.indexOf(d),1)),e.push({text:l(i),index:o})}}();for(var d,p=rr(a);!(d=p()).done;){for(var f,_=d.value,v=_[0],m=_[1],g=v.macroExpressions.map(function(e){return{text:n(e,Y)?e.lexeme:e.codeGen(i),index:e.location.start.index}}),y=rr(m.declarations);!(f=y()).done;){var S=f.value;g.push({text:l(S),index:S.location.start.index})}e.push({text:g.sort(function(e,t){return e.index-t.index}).map(function(e){return e.text}).join("\n"),index:m.index})}},i.visitTypeSpecifier=function(t){var r=this,i=n(t.parent,tn.FunctionIdentifier)?t.parent.parent:void 0;if(n(i,tn.FunctionCallGeneric)&&n(i.fnSymbol,e0))return e.prototype.visitTypeSpecifier.call(this,t);for(var a,o,s=rr(t.structDependencies);!(o=s()).done;)a=this,function(){var e,t=o.value;if(!(!t.ident||a.context.getStructRole([t]))){for(var i=t.parent;i&&!n(i,tn.GlobalDeclaration)&&!n(i,tn.FunctionDefinition);)i=i.parent;if(!n(i,tn.FunctionDefinition)){a.context.referenceGlobal(t.ident.lexeme,eZ.STRUCT);var s=a.context._referencedGlobals[t.ident.lexeme],c=a._declarationOwners.get(t);if(!(!c&&s.some(function(e){return e.astNode===t}))){var u=a._outerMacroDeclarations.find(function(e){return e.location.start.index<=t.location.start.index&&e.location.end.index>=t.location.end.index});a._prepareForwardTypes(s.filter(function(e){if(!c)return!0;var t=r._declarationOwners.get(e.astNode);return(null==t?void 0:t.group)===c.group&&t.sourceScope>c.sourceScope}).map(function(e){return e.astNode}).filter(function(e){return n(e,tn.StructSpecifier)}),null!=(e=null==u?void 0:u.location.start.index)?e:t.location.start.index)}}}}();return e.prototype.visitTypeSpecifier.call(this,t)},i._prepareForwardTypes=function(e,t,r){var i;if(void 0===r&&(r=t),!this.context.getStructRole(e))for(var a,o=rr(e);!(a=o()).done;)i=this,function(){var e=a.value;if(!((null!=(u=i._forwardStructIndices.get(e))?u:1/0)<=t)){if(e.ident){i.context.referenceGlobal(e.ident.lexeme,eZ.STRUCT);var o=i.context._referencedGlobals[e.ident.lexeme];if(!o.some(function(t){return t.astNode===e}))return i._prepareForwardTypes(o.map(function(e){return e.astNode}).filter(function(e){return n(e,tn.StructSpecifier)}),t,r)}var s=e.location.start.index>t,c=i._outerMacroDeclarations.find(function(t){return t.location.start.index<=e.location.start.index&&t.location.end.index>=e.location.end.index});s&&(!i._isContextIndependent(e)||i._hasDeclarationContextBarrier(r,null!=(l=null==c?void 0:c.location.end.index)?l:e.location.end.index,!0))&&i._unsupportedForwardDeclaration(e);for(var u,l,h,d=s?r:e.location.start.index,p=rr(e.propList);!(h=p()).done;){var f=h.value;i._prepareForwardTypes(f.typeInfo.structDeclarations,d)}s&&i._forwardStructIndices.set(e,r)}}()},i._isContextIndependent=function(e){var t=this;return!(n(e,tn.VariableIdentifier)||n(e,tn.MacroCallSymbol)||n(e,tn.MacroCallFunction)||n(e,tn.TypeSpecifier)&&e.isCustom&&!e.structDeclarations.length)&&e.children.every(function(e){return n(e,tr)?t._isContextIndependent(e):e.type<U.MACRO_IF||e.type>U.MACRO_DEFINE_PARAMS})},i._hasDeclarationContextBarrier=function(e,t,r){var i=function(a,o){return void 0===o&&(o=!1),!(a.location.end.index<=e)&&!(a.location.start.index>=t)&&(!!(n(a,tn.PrecisionSpecifier)&&!o||r&&n(a,tn.MacroDefine))||(o||(o=n(a,tn.FunctionDefinition)),a.children.some(function(a){return n(a,tr)?i(a,o):r&&a.location.start.index>e&&a.location.start.index<t&&(a.type===U.MACRO_UNDEF||a.type===U.MACRO_DEFINE_EXPRESSION)})))};return i(this._sourceIR.program)},i._unsupportedForwardDeclaration=function(e){var t=this._sourceIR;throw tV(new eu(el.CompilationError,"Inherited declarations require incompatible forward signatures or depend on a later macro or precision context.",e.location,t.source,void 0,"UnsupportedForwardDeclaration"),t.source,t.sourceMap)},i._getCustomStruct=function(e,t){for(var r,n=rr(e);!(r=n()).done;){var i=r.value,a=i.codeGen(this);i.isInMacroBranch||t.push({text:this._declaration(a,i),index:i.location.start.index})}},i._getGlobalMacroDeclarations=function(e,t){var r=this,i=this.context,a=i._referencedGlobalMacroASTs;a.length=0;for(var o,s=rr(i._referencedGlobalSymbols);!(o=s()).done;){var c=o.value;c.isInMacroBranch&&a.push(c.astNode)}for(var u,l=rr(e);!(u=l()).done;){var h=u.value,d=void 0,p=h.children[0];if(n(p,tn.GlobalMacroIfStatement)){var f=[];f.push.apply(f,[].concat(h.macroExpressions.map(function(e){return{text:n(e,Y)?e.lexeme:e.codeGen(r),index:e.location.start.index}}))),this._visitGlobalMacroIfStatement(p,f),d=f.sort(function(e,t){return e.index-t.index}).map(function(e){return e.text}).join("\n")}else d=n(p,Y)&&p.type===U.MACRO_DEFINE_EXPRESSION?p.lexeme:h.codeGen(this);t.push({text:d,index:h.location.start.index})}},i._visitGlobalMacroIfStatement=function(e,t){for(var r=e.children,i=0;i<r.length;i++){var a=r[i];if(n(a,tn.PrecisionSpecifier))t.push({text:a.codeGen(this),index:a.location.start.index});else if(n(a,tn.FunctionDefinition)){var o=-1!==this.context._referencedGlobalMacroASTs.indexOf(a)?this.getCachedCode(a):this._forwardFunctionDeclarations.get(a);void 0!==o&&t.push({text:this._declaration(o,a),index:a.location.start.index})}else if(n(a,tn.StructSpecifier)){if(this._forwardStructIndices.has(a)){var s,c=this._declaration("",a);c&&t.push({text:c,index:a.location.start.index});continue}var u=this.context,l=u.stage;(-1!==u._referencedGlobalMacroASTs.indexOf(a)||(l===eG.VERTEX?u.hasStructRole(a,tO.Attribute)||u.hasStructRole(a,tO.Varying):u.hasStructRole(a,tO.Varying)||u.hasStructRole(a,tO.Mrt)))&&t.push({text:this._declaration(null!=(s=this.getCachedCode(a))?s:"",a),index:a.location.start.index})}else if(n(a,tn.VariableDeclarationList))for(var h=a.variableDeclarations,d=0;d<h.length;d++){var p,f=h[d];-1!==this.context._referencedGlobalMacroASTs.indexOf(f)&&t.push({text:this._declaration(this._forwardVariableIndices.has(f)?"":""+(null!=(p=this.getCachedCode(f))?p:"")+";",f),index:f.location.start.index})}n(a,tr)&&this._visitGlobalMacroIfStatement(a,t)}},i._referenceDeclaration=function(e,t){var r=this._declarationOwners.get(t);if(r){var n=this._declarationReferences.get(e);n||this._declarationReferences.set(e,n=new Set),n.add(r.id)}},i._emitDeclarationReferences=function(e){for(var t,r=rr(this._declarationReferences);!(t=r()).done;)for(var n,i=t.value,a=i[0],o=i[1],s=rr(o);!(n=s()).done;){var c=n.value;e.push({text:ro.reference(a,c),index:-1})}},i._declaration=function(e,t,r){return void 0===r&&(r=!0),ro.declaration(e,this._declarationOwners.get(t),r)},r=[{key:"currentDeclarationOwner",get:function(){return this._currentDeclaration&&this._declarationOwners.get(this._currentDeclaration)}}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,r),t}(ra),rc=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}t5(t,e);var r=t.prototype;return r.getAttributeProp=function(e){return"attribute "+e.typeInfo.typeLexeme+" "+e.ident.lexeme+";"},r.getVaryingProp=function(e){return"varying "+e.typeInfo.typeLexeme+" "+e.ident.lexeme+";"},r.getMRTProp=function(){return""},r.visitPostfixExpression=function(t){var r,i=t.children,a=i[0],o=this.context,s=n(a,tn.PostfixExpression)?e4.unwrapBareIdentifier(a,{allowParens:!0}):void 0,c=null!=(r=null==s?void 0:s.resolvedValueSymbols())?r:[],u=n(a,tn.PostfixExpression)?e4.extractDirectIdentLexeme(a):null;if((s?c.length?o.getStructVarRole(c):u?o.getUnresolvedStructVarRole(u):void 0:void 0)===tO.Mrt){var l=i[2],h=o.mrtList.find(function(e){return e.ident.lexeme===l.lexeme});return h?"gl_FragData["+h.mrtIndex+"]":""}return e.prototype.visitPostfixExpression.call(this,t)},r.visitJumpStatement=function(t){var r=this.context.getFragmentReturnMode(t),n=this.context.isTerminalInterfaceReturn(t);if("mrt"===r)return n?"":"return;";if("color"===r){var i="gl_FragColor = "+t.children[1].codeGen(this)+";";return n?i:"{ "+i+" return; }"}return e.prototype.visitJumpStatement.call(this,t)},t}(rs),ru="GS_glFragColor",rl="GS_glFragData",rh=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t._outputDeclarations=new Map,t._fragDataArrayRequired=!1,t._fragDataIndices=new Map,t._scannedFragmentFunctions=new Set,t}t5(t,e);var r=t.prototype;return r.reset=function(){e.prototype.reset.call(this),this._outputDeclarations.clear(),this._fragDataArrayRequired=!1,this._fragDataIndices.clear(),this._scannedFragmentFunctions.clear()},r.getOtherGlobal=function(t,r){e.prototype.getOtherGlobal.call(this,t,r);for(var n,i=rr(this._outputDeclarations.values());!(n=i()).done;){var a=n.value;r.push({text:a.unconditional?a.text:ro.sharedDeclaration(a.text,Array.from(a.owners.values())),index:-1})}},r.getAttributeProp=function(e){return"in "+e.typeInfo.typeLexeme+" "+e.ident.lexeme+";"},r.getVaryingProp=function(e){return(this.context.stage===eG.FRAGMENT?"in":"out")+" "+e.typeInfo.typeLexeme+" "+e.ident.lexeme+";"},r.getMRTProp=function(e){return"layout(location = "+e.mrtIndex+") out vec4 "+e.ident.lexeme+";"},r.visitFunctionIdentifier=function(t){var r=t.children[0];if(1!==r.children.length||r.structDependencies.length)return e.prototype.visitFunctionIdentifier.call(this,t);var n=t.lexeme;switch(t.ident){case"texture2D":case"textureCube":n="texture";break;case"texture2DProj":n="textureProj";break;case"texture2DLodEXT":case"textureCubeLodEXT":n="textureLod";break;case"texture2DGradEXT":case"textureCubeGradEXT":n="textureGrad";break;case"texture2DProjLodEXT":n="textureProjLod";break;case"texture2DProjGradEXT":n="textureProjGrad"}return n},r.visitVariableIdentifier=function(t){var r=this.context;return r.stage===eG.FRAGMENT&&t.builtinSemantic===eQ.FragmentOutput0?(this._registerFragColorVariable(),ru):r.stage===eG.FRAGMENT&&t.builtinSemantic===eQ.FragmentDepth?"gl_FragDepth":r.stage===eG.FRAGMENT&&t.builtinSemantic===eQ.FragmentOutputArray?(this._registerFragDataArray(),rl):e.prototype.visitVariableIdentifier.call(this,t)},r.visitPostfixExpression=function(t){if(!this._fragDataArrayRequired){var r=this._fragDataIndices.get(t);if(void 0!==r)return this._registerFragDataVariable(r)}return e.prototype.visitPostfixExpression.call(this,t)},r.visitJumpStatement=function(t){var r=this.context.getFragmentReturnMode(t),n=this.context.isTerminalInterfaceReturn(t);if("mrt"===r)return n?"":"return;";if("color"===r){this._registerFragColorVariable();var i=ru+" = "+t.children[1].codeGen(this)+";";return n?i:"{ "+i+" return; }"}return e.prototype.visitJumpStatement.call(this,t)},r._registerFragColorVariable=function(){this._registerOutput(ru,"out vec4 "+ru+";")},r._registerOutput=function(e,t){var r=this._outputDeclarations.get(e);r||this._outputDeclarations.set(e,r={text:t,owners:new Map,unconditional:!1});var n=this.currentDeclarationOwner;n?r.owners.set(n.id,n):r.unconditional=!0},r.prepareFragment=function(e,t){for(var r=e.functions.slice();r.length;){var n=r.pop();this._scannedFragmentFunctions.has(n)||(this._scannedFragmentFunctions.add(n),this._scanFragmentOutputs(n.astNode),r.push.apply(r,[].concat(n.calledFunctions)))}for(var i,a=rr(t);!(i=a()).done;){var o=i.value;this._scanFragmentOutputs(o)}},r._scanFragmentOutputs=function(e){if(n(e,tn.PostfixExpression)&&4===e.children.length){var t,r=e.children[0],i=e.children[2];if(n(r,tr)&&n(i,tr)&&(null==(t=e4.unwrapBareIdentifier(r,{allowParens:!0}))?void 0:t.builtinSemantic)===eQ.FragmentOutputArray){var a=e4.constIntegerValue(i);void 0===a||a<0?this._fragDataArrayRequired=!0:this._fragDataIndices.set(e,a),this._scanFragmentOutputs(i);return}}if(n(e,tn.VariableIdentifier)&&e.builtinSemantic===eQ.FragmentOutputArray){this._fragDataArrayRequired=!0;return}for(var o,s=rr(e.children);!(o=s()).done;){var c=o.value;n(c,tr)&&this._scanFragmentOutputs(c)}},r._registerFragDataArray=function(){this._registerOutput(rl,"layout(location = 0) out vec4 "+rl+"[gl_MaxDrawBuffers];")},r._registerFragDataVariable=function(e){var t=""+rl+e;return this._registerOutput(t,"layout(location = "+e+") out vec4 "+t+";"),t},t}(rs),rd=/*#__PURE__*/function(){function e(){}return e.generate=function(r,n,i){var a=new tZ(r,n);if(a.mrtOutputIssues.length||a.invalidMrtReturnLocations.length){t.Logger.error("MRT outputs require unique non-negative locations, vec4 members, and returns through an assigned struct variable.");return}if(a.invalidVaryingReturnLocations.length){t.Logger.error("Varying vertex entries must return a struct variable or same-type function result.");return}if(a.structMemberOwnerIssues.length){t.Logger.error("A struct member reference cannot be lowered safely across runtime macro expansion.");return}return i===t.ShaderLanguage.GLSLES100?e._generateWithPool(e._gles100VisitorPool,r,n):e._generateWithPool(e._gles300VisitorPool,r,n)},e._generateWithPool=function(e,r,i){var a=e.get();try{return a.generate(r,i)}catch(e){if(a.dispose(),!n(e,eu))throw e;t.Logger.error((e.file?""+e.file+": ":"")+(e.code?""+e.code+": ":"")+e.toString());return}finally{e.return(a)}},e}();rd._gles100VisitorPool=new t.ReturnableObjectPool(rc),rd._gles300VisitorPool=new t.ReturnableObjectPool(rh);var rp=/*#__PURE__*/function(e){function t(t){var r;return(r=e.call(this,t.map(function(e){return e.toString()}).join("\n"))||this).errors=t,r.name="ShaderSourceParseError",r}return t5(t,e),t}(re(Error));function rf(e,r,n,i,a){if(e.blockingErrors.length){for(var o,s=rr(e.blockingErrors);!(o=s()).done;){var c=o.value;t.Logger.error(c.toString())}return}if(e.ir){var u=null!=a?a:tI.create(e.ir,r,n);return function(e,r,n,i){if(!r.vertexEntry.functions.length){t.Logger.error("Vertex entry function '"+r.vertexEntry.name+"' not found.");return}if(!r.fragmentEntry.functions.length){t.Logger.error("Fragment entry function '"+r.fragmentEntry.name+"' not found.");return}if(r.vertexEntry.hasDefiniteAmbiguity){t.Logger.error("Vertex entry function '"+r.vertexEntry.name+"' resolves to multiple declarations.");return}if(r.fragmentEntry.hasDefiniteAmbiguity){t.Logger.error("Fragment entry function '"+r.fragmentEntry.name+"' resolves to multiple declarations.");return}if(r.roleConflicts.length){t.Logger.error("A shader IO struct cannot serve multiple stage-interface roles.");return}var a=rd.generate(e,r,n);return a&&(a.vertexShaderInstructions=ro.parse(a.vertex,i),a.fragmentShaderInstructions=ro.parse(a.fragment,i),a.vertex=ro.source(a.vertex),a.fragment=ro.source(a.fragment)),a}(e.ir,u,i,e.preprocessorExpressions)}}var r_=/*#__PURE__*/function(){function e(){this._includeMap={},this._chunkOutputCache=new Map,this._sourceParserObjectPool=new tJ,this._parserObjectPool=new tJ,this._runtimeParser=tz(this._parserObjectPool)}var t=e.prototype;return t._setIncludeMap=function(e){this._includeMap=function(e){if(!e)return Object.create(null);for(var t,r=Object.create(null),n=j(Object.keys(e));!(t=n()).done;){var i=t.value,a=F(i);if(Object.prototype.hasOwnProperty.call(r,a))throw Error('Shader include key collision after normalization: "'+i+'" resolves to "'+a+'".');r[a]=i}return new Proxy(Object.create(null),{get:function(t,n){if("string"==typeof n){var i=r[n];if(void 0!==i){var a=e[i];return"string"==typeof a?a:void 0}var o=e[n];return"string"==typeof o?o:void 0}}})}(e),this._chunkOutputCache.clear()},t._parseShaderSource=function(e){return this._chunkOutputCache.clear(),function(e){if(e.errors.length)throw new rp(e.errors);return e.shaderSource}(tQ.parseStrict(e,this._sourceParserObjectPool))},t._parseShaderPass=function(e,t,r,n,i,a){return rf(function(e,t,r,n,i,a,o){null==i||i.reset(),(null==o?void 0:o.some(function(e){return e>0}))||(o=void 0);var s=function(e){if(e){var t=e.trim().replace(/\\/g,"/");if(t)return t.startsWith(tg)?t===tg?void 0:F(t):ty.test(t)?new URL(t).href:F(t)}}(n),c=tA.parseWithErrors(e,s?ty.test(s)?new URL(s).href:new URL(s,tg).href:"",t,r,s,!1,o),u=c.content;if(c.errors.length){var l=tW(c.errors);return Object.freeze({ir:null,expandedSource:u,sourceMap:tB,preprocessorExpressions:tU,errors:l,blockingErrors:l})}var h={},d=new ez(u,h,i,c.conditionalArms),p=null!=a?a:tz(i);p.setSource(u),p.setSourceScopes(c.sourceScopes);var f=p.parse(d.tokenize(),h),_=tW(p.errors),v=tW(p.blockingErrors);return Object.freeze({ir:f?Object.freeze(new tT(f,u,tB)):null,expandedSource:u,sourceMap:tB,preprocessorExpressions:d.preprocessorExpressions,errors:_,blockingErrors:v})}(e,this._includeMap,this._chunkOutputCache,i,this._parserObjectPool,this._runtimeParser,a),t,r,n)},t.generate=function(e,t){var r=function(e){var t=tm.get(e);if(!t)throw TypeError("Invalid parsed shader pass handle.");return t}(e);return rf(r.data,r.vertexEntry,r.fragmentEntry,t,r.coreInfo)},e}(),rv="2.0.0-alpha.54";t.Logger.info("Galacean Engine Shader Compiler Version: "+rv),e.GSError=eu,e.GSErrorName=el,e.ShaderCompiler=r_,e.version=rv,Object.defineProperty(e,"__esModule",{value:!0})});
|
|
2
2
|
//# sourceMappingURL=browser.min.js.map
|