@galacean/engine-shader-compiler 2.0.0-alpha.40 → 2.0.0-alpha.41
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/browser.verbose.js +1 -1
- package/dist/browser.verbose.min.js +1 -1
- package/dist/main.js +1 -1
- package/dist/main.verbose.js +1 -1
- package/dist/module.js +1 -1
- package/dist/module.verbose.js +1 -1
- package/package.json +4 -4
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-math"),require("@galacean/engine-core")):"function"==typeof define&&define.amd?define(["exports","@galacean/engine-math","@galacean/engine-core"],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(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function a(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&&i(e,t)}function o(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 s(e,t,r){return t&&o(e.prototype,t),r&&o(e,r),e}function c(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 l(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 c(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 c(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 u(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o}"function"==typeof SuppressedError&&SuppressedError;var p,h,_,f,d,m,S,v,E,C,g,y,A,x,b,T,O,I,L,R,P,M,N,D,V,k,G,F,B,W,U,w,H,j,z,q,X,Q,K,Y,J,$,Z,ee,et,er,en,ei,ea,eo,es,ec,el,eu,ep,eh,e_,ef,ed,em,eS,ev,eE,eC,eg,ey,eA,ex,eb,eT,eO,eI,eL,eR,eP,eM,eN,eD,eV=/*#__PURE__*/function(){function e(){}var t=e.prototype;return t.set=function(e,t){this.start=e,this.end=t},t.dispose=function(){this.start.dispose(),this.end.dispose()},e}(),ek=/*#__PURE__*/function(){function e(){}var t=e.prototype;return t.set=function(e){this.index=e},t.dispose=function(){this.index=0},e}(),eG=((p={})[p.ID=1e3]="ID",p[p.FLOAT_CONSTANT=1001]="FLOAT_CONSTANT",p[p.INT_CONSTANT=1002]="INT_CONSTANT",p[p.STRING_CONST=1003]="STRING_CONST",p[p.LEFT_OP=1004]="LEFT_OP",p[p.RIGHT_OP=1005]="RIGHT_OP",p[p.INC_OP=1006]="INC_OP",p[p.DEC_OP=1007]="DEC_OP",p[p.LE_OP=1008]="LE_OP",p[p.GE_OP=1009]="GE_OP",p[p.EQ_OP=1010]="EQ_OP",p[p.NE_OP=1011]="NE_OP",p[p.AND_OP=1012]="AND_OP",p[p.OR_OP=1013]="OR_OP",p[p.XOR_OP=1014]="XOR_OP",p[p.MUL_ASSIGN=1015]="MUL_ASSIGN",p[p.DIV_ASSIGN=1016]="DIV_ASSIGN",p[p.ADD_ASSIGN=1017]="ADD_ASSIGN",p[p.SUB_ASSIGN=1018]="SUB_ASSIGN",p[p.MOD_ASSIGN=1019]="MOD_ASSIGN",p[p.LEFT_ASSIGN=1020]="LEFT_ASSIGN",p[p.RIGHT_ASSIGN=1021]="RIGHT_ASSIGN",p[p.AND_ASSIGN=1022]="AND_ASSIGN",p[p.XOR_ASSIGN=1023]="XOR_ASSIGN",p[p.OR_ASSIGN=1024]="OR_ASSIGN",p[p.LEFT_PAREN=1025]="LEFT_PAREN",p[p.RIGHT_PAREN=1026]="RIGHT_PAREN",p[p.LEFT_BRACKET=1027]="LEFT_BRACKET",p[p.RIGHT_BRACKET=1028]="RIGHT_BRACKET",p[p.LEFT_BRACE=1029]="LEFT_BRACE",p[p.RIGHT_BRACE=1030]="RIGHT_BRACE",p[p.DOT=1031]="DOT",p[p.COMMA=1032]="COMMA",p[p.COLON=1033]="COLON",p[p.EQUAL=1034]="EQUAL",p[p.SEMICOLON=1035]="SEMICOLON",p[p.BANG=1036]="BANG",p[p.DASH=1037]="DASH",p[p.TILDE=1038]="TILDE",p[p.PLUS=1039]="PLUS",p[p.STAR=1040]="STAR",p[p.SLASH=1041]="SLASH",p[p.PERCENT=1042]="PERCENT",p[p.LEFT_ANGLE=1043]="LEFT_ANGLE",p[p.RIGHT_ANGLE=1044]="RIGHT_ANGLE",p[p.VERTICAL_BAR=1045]="VERTICAL_BAR",p[p.CARET=1046]="CARET",p[p.AMPERSAND=1047]="AMPERSAND",p[p.QUESTION=1048]="QUESTION",p[p.NotWord=1049]="NotWord",p[p.EPSILON=1998]="EPSILON",p[p.EOF=1999]="EOF",p),eF=((h={})[h.CONST=0]="CONST",h[h.BOOL=1]="BOOL",h[h.FLOAT=2]="FLOAT",h[h.DOUBLE=3]="DOUBLE",h[h.INT=4]="INT",h[h.UINT=5]="UINT",h[h.BREAK=6]="BREAK",h[h.CONTINUE=7]="CONTINUE",h[h.DO=8]="DO",h[h.ELSE=9]="ELSE",h[h.FOR=10]="FOR",h[h.IF=11]="IF",h[h.WHILE=12]="WHILE",h[h.DISCARD=13]="DISCARD",h[h.RETURN=14]="RETURN",h[h.BVEC2=15]="BVEC2",h[h.BVEC3=16]="BVEC3",h[h.BVEC4=17]="BVEC4",h[h.IVEC2=18]="IVEC2",h[h.IVEC3=19]="IVEC3",h[h.IVEC4=20]="IVEC4",h[h.UVEC2=21]="UVEC2",h[h.UVEC3=22]="UVEC3",h[h.UVEC4=23]="UVEC4",h[h.VEC2=24]="VEC2",h[h.VEC3=25]="VEC3",h[h.VEC4=26]="VEC4",h[h.VEC4_ARRAY=27]="VEC4_ARRAY",h[h.MAT2=28]="MAT2",h[h.MAT3=29]="MAT3",h[h.MAT4=30]="MAT4",h[h.MAT2X3=31]="MAT2X3",h[h.MAT2X4=32]="MAT2X4",h[h.MAT3X2=33]="MAT3X2",h[h.MAT3X4=34]="MAT3X4",h[h.MAT4X2=35]="MAT4X2",h[h.MAT4X3=36]="MAT4X3",h[h.IN=37]="IN",h[h.OUT=38]="OUT",h[h.INOUT=39]="INOUT",h[h.CENTROID=40]="CENTROID",h[h.SAMPLER2D=41]="SAMPLER2D",h[h.SAMPLER3D=42]="SAMPLER3D",h[h.SAMPLER_CUBE=43]="SAMPLER_CUBE",h[h.SAMPLER2D_SHADOW=44]="SAMPLER2D_SHADOW",h[h.SAMPLER_CUBE_SHADOW=45]="SAMPLER_CUBE_SHADOW",h[h.SAMPLER2D_ARRAY=46]="SAMPLER2D_ARRAY",h[h.SAMPLER2D_ARRAY_SHADOW=47]="SAMPLER2D_ARRAY_SHADOW",h[h.I_SAMPLER2D=48]="I_SAMPLER2D",h[h.I_SAMPLER3D=49]="I_SAMPLER3D",h[h.I_SAMPLER_CUBE=50]="I_SAMPLER_CUBE",h[h.I_SAMPLER2D_ARRAY=51]="I_SAMPLER2D_ARRAY",h[h.U_SAMPLER2D=52]="U_SAMPLER2D",h[h.U_SAMPLER3D=53]="U_SAMPLER3D",h[h.U_SAMPLER_CUBE=54]="U_SAMPLER_CUBE",h[h.U_SAMPLER2D_ARRAY=55]="U_SAMPLER2D_ARRAY",h[h.STRUCT=56]="STRUCT",h[h.LAYOUT=57]="LAYOUT",h[h.LOCATION=58]="LOCATION",h[h.VOID=59]="VOID",h[h.PRECISION=60]="PRECISION",h[h.PRECISE=61]="PRECISE",h[h.HIGHP=62]="HIGHP",h[h.MEDIUMP=63]="MEDIUMP",h[h.LOWP=64]="LOWP",h[h.INVARIANT=65]="INVARIANT",h[h.SMOOTH=66]="SMOOTH",h[h.FLAT=67]="FLAT",h[h.NOPERSPECTIVE=68]="NOPERSPECTIVE",h[h.True=69]="True",h[h.False=70]="False",h[h.LeftBrace=71]="LeftBrace",h[h.RightBrace=72]="RightBrace",h[h.Equal=73]="Equal",h[h.BitwiseOr=74]="BitwiseOr",h[h.GSRenderQueueType=75]="GSRenderQueueType",h[h.GSBlendState=76]="GSBlendState",h[h.GSDepthState=77]="GSDepthState",h[h.GSStencilState=78]="GSStencilState",h[h.GSRasterState=79]="GSRasterState",h[h.GSEditorProperties=80]="GSEditorProperties",h[h.GSEditorMacros=81]="GSEditorMacros",h[h.GSEditor=82]="GSEditor",h[h.GSTags=83]="GSTags",h[h.GSVertexShader=84]="GSVertexShader",h[h.GSFragmentShader=85]="GSFragmentShader",h[h.GSSubShader=86]="GSSubShader",h[h.GSPass=87]="GSPass",h[h.GSBlendFactor=88]="GSBlendFactor",h[h.GSBlendOperation=89]="GSBlendOperation",h[h.GSBool=90]="GSBool",h[h.GSNumber=91]="GSNumber",h[h.GSColor=92]="GSColor",h[h.GSCompareFunction=93]="GSCompareFunction",h[h.GSStencilOperation=94]="GSStencilOperation",h[h.GSCullMode=95]="GSCullMode",h[h.GSColorWriteMask=96]="GSColorWriteMask",h[h.GSUsePass=97]="GSUsePass",h[h.MACRO_IF=98]="MACRO_IF",h[h.MACRO_IFDEF=99]="MACRO_IFDEF",h[h.MACRO_IFNDEF=100]="MACRO_IFNDEF",h[h.MACRO_ELSE=101]="MACRO_ELSE",h[h.MACRO_ELIF=102]="MACRO_ELIF",h[h.MACRO_ENDIF=103]="MACRO_ENDIF",h[h.MACRO_UNDEF=104]="MACRO_UNDEF",h[h.MACRO_DEFINE_EXPRESSION=105]="MACRO_DEFINE_EXPRESSION",h[h.MACRO_CONDITIONAL_EXPRESSION=106]="MACRO_CONDITIONAL_EXPRESSION",h[h.MACRO_CALL=107]="MACRO_CALL",h[h.MACRO_DEFINE=108]="MACRO_DEFINE",h[h.MACRO_DEFINE_END=109]="MACRO_DEFINE_END",h[h.MACRO_DEFINE_PARAMS=110]="MACRO_DEFINE_PARAMS",h),eB=/*#__PURE__*/function(){function e(){}return e.createObjectPool=function(t){var n=new r.ClearableObjectPool(t);return e._shaderCompilerObjectPoolSet.push(n),n},e.clearAllShaderCompilerObjectPool=function(){for(var t=0,r=e._shaderCompilerObjectPoolSet.length;t<r;t++)e._shaderCompilerObjectPoolSet[t].clear()},e.createGSError=function(e,t,r,n,i){console.error(e);var a=Error(e);return a.name=t,a},e}();eB._shaderCompilerObjectPoolSet=[];var eW=[],eU=/*#__PURE__*/function(){function e(){this.branch=eW}var t=e.prototype;return t.set=function(e,t,r){if(this.type=e,this.lexeme=t,this.branch=eW,r){if(n(r,eV))this.location=r;else{var i=tD.createPosition(r.index+t.length);this.location=tD.createRange(r,i)}}},t.dispose=function(){},e}();eU.pool=eB.createObjectPool(eU);var ew=new eU;ew.set(eG.EOF,"/EOF");var eH=((_={})[_.START=2e3]="START",_[_.gs_shader_program=2001]="gs_shader_program",_[_.global_declaration=2002]="global_declaration",_[_.variable_declaration=2003]="variable_declaration",_[_.variable_declaration_list=2004]="variable_declaration_list",_[_.variable_declaration_statement=2005]="variable_declaration_statement",_[_.array_specifier_list=2006]="array_specifier_list",_[_.array_specifier=2007]="array_specifier",_[_.ext_builtin_type_specifier_nonarray=2008]="ext_builtin_type_specifier_nonarray",_[_.precision_specifier=2009]="precision_specifier",_[_.variable_identifier=2010]="variable_identifier",_[_.variable_identifier_node=2011]="variable_identifier_node",_[_.primary_expression=2012]="primary_expression",_[_.postfix_expression=2013]="postfix_expression",_[_.integer_expression=2014]="integer_expression",_[_.function_call=2015]="function_call",_[_.function_call_generic=2016]="function_call_generic",_[_.function_call_header_no_parameters=2017]="function_call_header_no_parameters",_[_.function_call_header_with_parameters=2018]="function_call_header_with_parameters",_[_.function_call_parameter_list=2019]="function_call_parameter_list",_[_.function_call_header=2020]="function_call_header",_[_.function_identifier=2021]="function_identifier",_[_.constructor_identifier=2022]="constructor_identifier",_[_.unary_expression=2023]="unary_expression",_[_.unary_operator=2024]="unary_operator",_[_.multiplicative_expression=2025]="multiplicative_expression",_[_.additive_expression=2026]="additive_expression",_[_.shift_expression=2027]="shift_expression",_[_.relational_expression=2028]="relational_expression",_[_.equality_expression=2029]="equality_expression",_[_.and_expression=2030]="and_expression",_[_.inclusive_or_expression=2031]="inclusive_or_expression",_[_.exclusive_or_expression=2032]="exclusive_or_expression",_[_.logical_and_expression=2033]="logical_and_expression",_[_.logical_xor_expression=2034]="logical_xor_expression",_[_.logical_or_expression=2035]="logical_or_expression",_[_.conditional_expression=2036]="conditional_expression",_[_.assignment_expression=2037]="assignment_expression",_[_.assignment_operator=2038]="assignment_operator",_[_.expression=2039]="expression",_[_.integer_constant_expression=2040]="integer_constant_expression",_[_.integer_constant_expression_operator=2041]="integer_constant_expression_operator",_[_.declaration=2042]="declaration",_[_.function_prototype=2043]="function_prototype",_[_.function_declarator=2044]="function_declarator",_[_.function_header_with_parameters=2045]="function_header_with_parameters",_[_.function_header=2046]="function_header",_[_.function_parameter_list=2047]="function_parameter_list",_[_.parameter_declarator=2048]="parameter_declarator",_[_.parameter_declaration=2049]="parameter_declaration",_[_.parameter_qualifier=2050]="parameter_qualifier",_[_.parameter_type_specifier=2051]="parameter_type_specifier",_[_.init_declarator_list=2052]="init_declarator_list",_[_.single_declaration=2053]="single_declaration",_[_.fully_specified_type=2054]="fully_specified_type",_[_.type_qualifier=2055]="type_qualifier",_[_.single_type_qualifier=2056]="single_type_qualifier",_[_.storage_qualifier=2057]="storage_qualifier",_[_.precision_qualifier=2058]="precision_qualifier",_[_.interpolation_qualifier=2059]="interpolation_qualifier",_[_.invariant_qualifier=2060]="invariant_qualifier",_[_.type_specifier=2061]="type_specifier",_[_.type_specifier_nonarray=2062]="type_specifier_nonarray",_[_.type_specifier_no_prec=2063]="type_specifier_no_prec",_[_.basic_type=2064]="basic_type",_[_.struct_specifier=2065]="struct_specifier",_[_.struct_declaration_list=2066]="struct_declaration_list",_[_.struct_declaration=2067]="struct_declaration",_[_.layout_qualifier=2068]="layout_qualifier",_[_.struct_declarator_list=2069]="struct_declarator_list",_[_.struct_declarator=2070]="struct_declarator",_[_.identifier_list=2071]="identifier_list",_[_.decl_identifier=2072]="decl_identifier",_[_.initializer=2073]="initializer",_[_.initializer_list=2074]="initializer_list",_[_.declaration_statement=2075]="declaration_statement",_[_.simple_statement=2076]="simple_statement",_[_.compound_statement_no_scope=2077]="compound_statement_no_scope",_[_.statement_with_scope=2078]="statement_with_scope",_[_.compound_statement=2079]="compound_statement",_[_.statement=2080]="statement",_[_.statement_list=2081]="statement_list",_[_.iteration_statement_no_new_scope=2082]="iteration_statement_no_new_scope",_[_.expression_statement=2083]="expression_statement",_[_.selection_statement=2084]="selection_statement",_[_.selection_rest_statement=2085]="selection_rest_statement",_[_.condition=2086]="condition",_[_.conditionopt=2087]="conditionopt",_[_.iteration_statement=2088]="iteration_statement",_[_.for_init_statement=2089]="for_init_statement",_[_.for_rest_statement=2090]="for_rest_statement",_[_.jump_statement=2091]="jump_statement",_[_.external_declaration=2092]="external_declaration",_[_.function_definition=2093]="function_definition",_[_.field_selection=2094]="field_selection",_[_.bool_constant=2095]="bool_constant",_[_.function_identifier_node=2096]="function_identifier_node",_[_.typename_identifier_node=2097]="typename_identifier_node",_[_.scope_brace=2098]="scope_brace",_[_.scope_end_brace=2099]="scope_end_brace",_[_.macro_undef=2100]="macro_undef",_[_.macro_push_context=2101]="macro_push_context",_[_.macro_pop_context=2102]="macro_pop_context",_[_.macro_elif_expression=2103]="macro_elif_expression",_[_.macro_else_expression=2104]="macro_else_expression",_[_.global_macro_if_statement=2105]="global_macro_if_statement",_[_.global_macro_declaration=2106]="global_macro_declaration",_[_.global_macro_branch=2107]="global_macro_branch",_[_.macro_struct_declaration=2108]="macro_struct_declaration",_[_.macro_struct_branch=2109]="macro_struct_branch",_[_.macro_if_statement=2110]="macro_if_statement",_[_.macro_branch=2111]="macro_branch",_[_.macro_param_case_list=2112]="macro_param_case_list",_[_.macro_param_block=2113]="macro_param_block",_[_.macro_parameter_branch=2114]="macro_parameter_branch",_[_.macro_call_arg_case_list=2115]="macro_call_arg_case_list",_[_.macro_call_arg_block=2116]="macro_call_arg_block",_[_.macro_call_arg_branch=2117]="macro_call_arg_branch",_[_.macro_call_symbol=2118]="macro_call_symbol",_[_.macro_call_function=2119]="macro_call_function",_[_.macro_define=2120]="macro_define",_[_._ignore=2121]="_ignore",_),ej=/*#__PURE__*/function(){function e(){}return e.unwrapNodeByType=function(t,r){var i=t.children[0];if(!n(i,eU))return i.nt===r?i:e.unwrapNodeByType(i,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(n(r,eD.VariableIdentifier))return r;if(t.allowParens&&n(r,eD.PrimaryExpression)&&3===r.children.length){var i=r.children[1];if(!n(i,tc))return;r=i;continue}if(n(r,eD.ExpressionAstNode)&&1===r.children.length){var a=r.children[0];if(!n(a,tc))return;r=a;continue}return}},e.extractDirectIdentLexeme=function(t){var r=e.unwrapBareIdentifier(t,{allowParens:!0});if(!r)return null;var i=r.children[0];return n(i,eU)?i.lexeme:null},e.isTerminal=function(e){return e<eH.START},e}();function ez(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(ez=function(){return!!e})()}function eq(e,t,r){return(eq=ez()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var a=new(Function.bind.apply(e,n));return r&&i(a,r.prototype),a}).apply(null,arguments)}function eX(e){return(eX=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function eQ(e){var t="function"==typeof Map?new Map:void 0;return(eQ=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 eq(e,arguments,eX(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),i(r,e)})(e)}var eK=/*#__PURE__*/function(e){function t(t,r,n,i,a){var o;return(o=e.call(this,r)||this).location=n,o.source=i,o.file=a,o.name=t,o}return a(t,e),t.prototype.toString=function(){var e=this.message,t=this.location,r=this.source;return r?(n(t,ek)||(t.start,t.end),r.split("\n"),this.name+": "+e+"\n\n"):e},t}(eQ(Error));eK.wrappingLineCount=2;var eY=((f={}).PreprocessorError="PreprocessorError",f.CompilationError="CompilationError",f.ScannerError="ScannerError",f.CompilationWarn="CompilationWarning",f),eJ=/*#__PURE__*/function(){function e(e){this._currentIndex=0,this._source=e}var t=e.prototype;return t.setSource=function(e){this._source=e,this._currentIndex=0},t.getShaderPosition=function(e){return void 0===e&&(e=0),tD.createPosition(this._currentIndex-e)},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){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 eB.createGSError(r.join(" "),eY.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 l=a[s];if(l===t&&0==--c)break;l===e&&c++,s++}else for(;s<o&&a[s]!==t;)s++;return 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)},s(e,[{key:"currentIndex",get:function(){return this._currentIndex}},{key:"source",get:function(){return this._source}}]),e}(),e$=/*#__PURE__*/function(e){function t(t,r){var n;return(n=e.call(this,t)||this).macroDefineList=r,n._needScanMacroConditionExpression=!1,n._inMacroDefineValue=!1,n._macroDefineExpectsNameToken=!1,n._macroDefineExpectsParamsToken=!1,n._currentMacroName="",n._currentMacroParamsLexeme=void 0,n._currentMacroValueStart=-1,n._branchStack=[],n._pendingBranchPushDefined=null,n}a(t,e);var r=t.prototype;return r.tokenize=function(){var e,r;return function(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])}}}(this,function(n){switch(n.label){case 0:if(this.isEnd())return[3,2];switch(e=this.scanToken(),null!==this._pendingBranchPushDefined&&(e.type===eG.ID||e.type===eF.MACRO_CALL)&&(this._branchStack.push({name:e.lexeme,defined:this._pendingBranchPushDefined}),this._pendingBranchPushDefined=null),this._branchStack.length>0&&(e.branch=this._branchStack.slice()),e.type){case eF.MACRO_IFDEF:this._pendingBranchPushDefined=!0;break;case eF.MACRO_IFNDEF:this._pendingBranchPushDefined=!1;break;case eF.MACRO_IF:this._branchStack.push({name:"__if_"+ ++t._ifCounter,defined:!0});break;case eF.MACRO_ELIF:this._branchStack.length>0&&(this._branchStack[this._branchStack.length-1]={name:"__if_"+ ++t._ifCounter,defined:!0});break;case eF.MACRO_ELSE:(r=this._branchStack[this._branchStack.length-1])&&(this._branchStack[this._branchStack.length-1]={name:r.name,defined:!r.defined});break;case eF.MACRO_ENDIF:this._branchStack.pop()}return[4,e];case 1:return n.sent(),[3,0];case 2:return[2,ew]}})},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 ew;if(this._needScanMacroConditionExpression)return this._needScanMacroConditionExpression=!1,this._scanMacroConditionExpression();var e,t=this.getCurCharCode();if(eJ.isPreprocessorStartChar(t))return this._scanDirectives();if(eJ.isAlpha(t))return this._scanWord();if(eJ.isDigit(t))return this._scanNum();var r=this.getShaderPosition(),n=eU.pool.get();switch(this.getCurChar()){case"<":if(this.advance(1),"<"===(e=this.getCurChar())){if(this.advance(1),"="===this.getCurChar()){this.advance(1),n.set(eG.LEFT_ASSIGN,"<<=",r);break}n.set(eG.LEFT_OP,"<<",r);break}if("="===e){this.advance(1),n.set(eG.LE_OP,"<=",r);break}n.set(eG.LEFT_ANGLE,"<",r);break;case">":if(this.advance(1),">"===(e=this.getCurChar())){if(this.advance(1),"="===this.getCurChar()){this.advance(1),n.set(eG.RIGHT_ASSIGN,">>=",r);break}n.set(eG.RIGHT_OP,">>",r);break}if("="===e){this.advance(1),n.set(eG.GE_OP,">=",r);break}n.set(eG.RIGHT_ANGLE,">",r);break;case"+":if(this.advance(1),"+"===(e=this.getCurChar())){this.advance(1),n.set(eG.INC_OP,"++",r);break}if("="===e){this.advance(1),n.set(eG.ADD_ASSIGN,"+=",r);break}n.set(eG.PLUS,"+",r);break;case"-":if(this.advance(1),"-"===(e=this.getCurChar())){this.advance(1),n.set(eG.DEC_OP,"--",r);break}if("="===e){this.advance(1),n.set(eG.SUB_ASSIGN,"-=",r);break}n.set(eG.DASH,"-",r);break;case"=":if(this.advance(1),"="===this.getCurChar()){this.advance(1),n.set(eG.EQ_OP,"==",r);break}n.set(eG.EQUAL,"=",r);break;case"!":if(this.advance(1),"="===this.getCurChar()){this.advance(1),n.set(eG.NE_OP,"!=",r);break}n.set(eG.BANG,"!",r);break;case"&":if(this.advance(1),"&"===(e=this.getCurChar())){this.advance(1),n.set(eG.AND_OP,"&&",r);break}if("="===e){this.advance(1),n.set(eG.AND_ASSIGN,"&=",r);break}n.set(eG.AMPERSAND,"&",r);break;case"|":if(this.advance(1),"|"===(e=this.getCurChar())){this.advance(1),n.set(eG.OR_OP,"||",r);break}if("="===e){this.advance(1),n.set(eG.OR_ASSIGN,"|=",r);break}n.set(eG.VERTICAL_BAR,"|",r);break;case"^":if(this.advance(1),"^"===(e=this.getCurChar())){this.advance(1),n.set(eG.XOR_OP,"^^",r);break}if("="===e){this.advance(1),n.set(eG.XOR_ASSIGN,"^=",r);break}n.set(eG.CARET,"^",r);break;case"*":if(this.advance(1),"="===this.getCurChar()){this.advance(1),n.set(eG.MUL_ASSIGN,"*=",r);break}n.set(eG.STAR,"*",r);break;case"/":if(this.advance(1),"="===this.getCurChar()){this.advance(1),n.set(eG.DIV_ASSIGN,"/=",r);break}n.set(eG.SLASH,"/",r);break;case"%":if(this.advance(1),"="===this.getCurChar()){this.advance(1),n.set(eG.MOD_ASSIGN,"%=",r);break}n.set(eG.PERCENT,"%",r);break;case"(":this.advance(1),n.set(eG.LEFT_PAREN,"(",r);break;case")":this.advance(1),n.set(eG.RIGHT_PAREN,")",r);break;case"{":this.advance(1),n.set(eG.LEFT_BRACE,"{",r);break;case"}":this.advance(1),n.set(eG.RIGHT_BRACE,"}",r);break;case"[":this.advance(1),n.set(eG.LEFT_BRACKET,"[",r);break;case"]":this.advance(1),n.set(eG.RIGHT_BRACKET,"]",r);break;case".":if(this.advance(1),eJ.isDigit(this.getCurCharCode()))return this._scanNumAfterDot();n.set(eG.DOT,".",r);break;case",":this.advance(1),n.set(eG.COMMA,",",r);break;case":":this.advance(1),n.set(eG.COLON,":",r);break;case";":this.advance(1),n.set(eG.SEMICOLON,";",r);break;case"~":this.advance(1),n.set(eG.TILDE,"~",r);break;case"?":this.advance(1),n.set(eG.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();)t.push(this.getCurChar()),this.advance(1);this.advance(1);var r=tD.createRange(e,this.getShaderPosition()),n=eU.pool.get();return n.set(eG.STRING_CONST,t.join(""),r),n},r._scanNumAfterDot=function(){for(var e=["."];eJ.isDigit(this.getCurCharCode());)e.push(this.getCurChar()),this.advance(1);this._scanFloatSuffix(e);var t=eU.pool.get();return t.set(eG.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);eJ.isAlpha(this.getCurCharCode());)e.push(this.getCurChar()),this.advance(1);var n=eU.pool.get(),i=e.join("");if("#define"===i){var a=this._peekMacroDefine();if(a&&a.isExpression)this._inMacroDefineValue=!0,this._macroDefineExpectsNameToken=!0,n.set(eF.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(eF.MACRO_DEFINE_EXPRESSION,o,r)}}else{var s=t._lexemeTable[i];n.set(null!=s?s:eG.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&&eJ.isAlpha(r.charCodeAt(i))))return null;for(var a=i;i<n&&eJ.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 l=r.charCodeAt(i);if(10===l||13===l)return{name:o,paramsLexeme:void 0,valueStart:i,valueEnd:i,cursor:i,isExpression:!1};40===l?c++:41===l&&c--,i++}e=r.slice(s,i)}for(var u=i,p=0,h=0,_=-1,f=-1,d=!1,m=-1;i<n;){var S=t._skipNonSemantic(r,i,n);if(S!==i){i=S;continue}var v=r.charCodeAt(i);if(10===v||13===v)break;if(-1===_&&(_=i,eJ.isAlpha(v))){for(;i<n&&eJ.isAlnum(r.charCodeAt(i));)i++;f=i;var E=t._skipNonSemantic(r,i,n);d=E<n&&40===r.charCodeAt(E),m=f-1;continue}40===v?p++:41===v?p--:91===v?h++:93===v&&h--,0===p&&0===h&&(m=i),i++}var C={name:o,paramsLexeme:e,valueStart:u,valueEnd:i,cursor:i,isExpression:!1};if(-1===_||-1!==f&&!d&&t._isNonExpressionLeadingKeyword(r.slice(_,f)))return C;var g=r.charCodeAt(_),y=m>=0?r.charCodeAt(m):0,A=!eJ.isAlnum(g)&&40!==g&&46!==g&&45!==g&&43!==g&&33!==g&&126!==g,x=!eJ.isAlnum(y)&&41!==y&&93!==y;if(0!==p||0!==h||A||x){var b=r.slice(_,i).replace(/\s+/g," ").trim();this.throwError(this.getShaderPosition(0),"#define "+o+': invalid replacement list — not a valid GLSL expression ("'+b+'")')}return C.isExpression=!0,C},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=eU.pool.get(),l=i.join("");return this._currentMacroParamsLexeme=l,this._currentMacroValueStart=this._currentIndex,c.set(eF.MACRO_DEFINE_PARAMS,l,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=eU.pool.get();return i.set(eF.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:0===this._branchStack.length?eW:this._branchStack.slice()},c=this.macroDefineList[e];if(!c){this.macroDefineList[e]=[s];return}for(var l=0,u=c.length;l<u;l++){var p=c[l];if(p.dedupKey===o&&t.sameBranch(p.branch,s.branch))return}c.push(s)},r._scanMacroConditionExpression=function(){var e=[],t=this.getShaderPosition();this._scanUtilBreakLine(e);var r=e.join(""),n=eU.pool.get();return n.set(eF.MACRO_CONDITIONAL_EXPRESSION,r,t),n},r._scanWord=function(){var e=[this.getCurChar()],r=this.getShaderPosition();for(this.advance(1);eJ.isAlnum(this.getCurCharCode());)e.push(this.getCurChar()),this.advance(1);var n=eU.pool.get(),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(eG.ID,i,r)):this._isVisibleMacro(i)?n.set(eF.MACRO_CALL,i,r):n.set(null!=a?a:eG.ID,i,r),n},r._isVisibleMacro=function(e){var r=this.macroDefineList[e];if(!r||0===r.length)return!1;for(var n=this._branchStack,i=0,a=r.length;i<a;i++)if(t.isVisibleFrom(r[i].branch,n))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);eJ.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=eU.pool.get();return r.set(eG.INT_CONSTANT,e.join(""),this.getShaderPosition(e.length)),r}}for(;eJ.isDigit(this.getCurCharCode());)e.push(this.getCurChar()),this.advance(1);var n=this.getCurChar();if("."===n){for(e.push(n),this.advance(1);eJ.isDigit(this.getCurCharCode());)e.push(this.getCurChar()),this.advance(1);this._scanFloatSuffix(e);var i=eU.pool.get();return i.set(eG.FLOAT_CONSTANT,e.join(""),this.getShaderPosition(e.length)),i}if("e"===n||"E"===n){this._scanFloatSuffix(e);var a=eU.pool.get();return a.set(eG.FLOAT_CONSTANT,e.join(""),this.getShaderPosition(e.length)),a}if("f"===n||"F"===n){e.push(n),this.advance(1);var o=eU.pool.get();return o.set(eG.FLOAT_CONSTANT,e.join(""),this.getShaderPosition(e.length)),o}this._scanIntegerSuffix(e);var s=eU.pool.get();return s.set(eG.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()),eJ.isDigit(this.getCurCharCode())||this.throwError(this.getShaderPosition(0),"lexing error, invalid exponent suffix.");do e.push(t),this.advance(1),t=this.getCurChar();while(eJ.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.sameBranch=function(e,t){if(e.length!==t.length)return!1;for(var r=0,n=e.length;r<n;r++)if(e[r].name!==t[r].name||e[r].defined!==t[r].defined)return!1;return!0},t.isVisibleFrom=function(e,t){for(var r=0,n=e.length;r<n;r++)for(var i=e[r],a=0,o=t.length;a<o;a++){var s=t[a];if(i.name===s.name&&i.defined!==s.defined)return!1}return!0},t._isNonExpressionLeadingKeyword=function(e){var r=t._lexemeTable[e];return void 0!==r&&r!==eF.True&&r!==eF.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}(eJ);e$._lexemeTable={const:eF.CONST,bool:eF.BOOL,float:eF.FLOAT,double:eF.DOUBLE,int:eF.INT,uint:eF.UINT,break:eF.BREAK,continue:eF.CONTINUE,do:eF.DO,else:eF.ELSE,for:eF.FOR,if:eF.IF,while:eF.WHILE,discard:eF.DISCARD,return:eF.RETURN,bvec2:eF.BVEC2,bvec3:eF.BVEC3,bvec4:eF.BVEC4,ivec2:eF.IVEC2,ivec3:eF.IVEC3,ivec4:eF.IVEC4,uvec2:eF.UVEC2,uvec3:eF.UVEC3,uvec4:eF.UVEC4,vec2:eF.VEC2,vec3:eF.VEC3,vec4:eF.VEC4,mat2:eF.MAT2,mat3:eF.MAT3,mat4:eF.MAT4,in:eF.IN,out:eF.OUT,inout:eF.INOUT,sampler2D:eF.SAMPLER2D,samplerCube:eF.SAMPLER_CUBE,sampler3D:eF.SAMPLER3D,sampler2DShadow:eF.SAMPLER2D_SHADOW,samplerCubeShadow:eF.SAMPLER_CUBE_SHADOW,sampler2DArray:eF.SAMPLER2D_ARRAY,sampler2DArrayShadow:eF.SAMPLER2D_ARRAY_SHADOW,isampler2D:eF.I_SAMPLER2D,isampler3D:eF.I_SAMPLER3D,isamplerCube:eF.I_SAMPLER_CUBE,isampler2DArray:eF.I_SAMPLER2D_ARRAY,usampler2D:eF.U_SAMPLER2D,usampler3D:eF.U_SAMPLER3D,usamplerCube:eF.U_SAMPLER_CUBE,usampler2DArray:eF.U_SAMPLER2D_ARRAY,struct:eF.STRUCT,void:eF.VOID,true:eF.True,false:eF.False,precision:eF.PRECISION,precise:eF.PRECISE,highp:eF.HIGHP,mediump:eF.MEDIUMP,lowp:eF.LOWP,invariant:eF.INVARIANT,flat:eF.FLAT,smooth:eF.SMOOTH,noperspective:eF.NOPERSPECTIVE,centroid:eF.CENTROID,layout:eF.LAYOUT,location:eF.LOCATION,"#if":eF.MACRO_IF,"#ifdef":eF.MACRO_IFDEF,"#ifndef":eF.MACRO_IFNDEF,"#else":eF.MACRO_ELSE,"#elif":eF.MACRO_ELIF,"#endif":eF.MACRO_ENDIF,"#undef":eF.MACRO_UNDEF},e$._ifCounter=0;var eZ=((d={})[d.VERTEX=0]="VERTEX",d[d.FRAGMENT=1]="FRAGMENT",d[d.ALL=2]="ALL",d),e0=((eN={})[200]={dimension:0,members:[eF.FLOAT,eF.VEC2,eF.VEC3,eF.VEC4]},eN[201]={dimension:0,members:[eF.INT,eF.IVEC2,eF.IVEC3,eF.IVEC4]},eN[202]={dimension:0,members:[eF.UINT,eF.UVEC2,eF.UVEC3,eF.UVEC4]},eN[203]={dimension:0,members:[eF.BOOL,eF.BVEC2,eF.BVEC3,eF.BVEC4]},eN[208]={dimension:0,members:[eF.VEC2,eF.VEC3,eF.VEC4]},eN[206]={dimension:0,members:[eF.IVEC2,eF.IVEC3,eF.IVEC4]},eN[207]={dimension:0,members:[eF.UVEC2,eF.UVEC3,eF.UVEC4]},eN[205]={dimension:0,members:[eF.BVEC2,eF.BVEC3,eF.BVEC4]},eN[204]={dimension:0,members:[eF.MAT2,eF.MAT3,eF.MAT4]},eN[210]={dimension:1,members:[eF.SAMPLER2D,eF.I_SAMPLER2D,eF.U_SAMPLER2D]},eN[211]={dimension:1,members:[eF.SAMPLER3D,eF.I_SAMPLER3D,eF.U_SAMPLER3D]},eN[212]={dimension:1,members:[eF.SAMPLER_CUBE,eF.I_SAMPLER_CUBE,eF.U_SAMPLER_CUBE]},eN[213]={dimension:1,members:[eF.SAMPLER2D_ARRAY,eF.I_SAMPLER2D_ARRAY,eF.U_SAMPLER2D_ARRAY]},eN[209]={dimension:1,members:[eF.VEC4,eF.IVEC4,eF.UVEC4]},eN),e2=new Map,e1=/*#__PURE__*/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=eq(e,[].concat([t,r,eZ.ALL],a)),c=null!=(n=e2.get(t))?n:[];c.push(s),e2.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=eq(e,[].concat([t,r,n],o)),l=null!=(i=e2.get(t))?i:[];l.push(c),e2.set(t,l)},e.resolveOverload=function(e,t){var r,n=e2.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 l=-1,u=-1,p=!0,h=0;h<i;h++){var _=c[h],f=t[h];if(3e3!==f){var d=e0[_];if(d){var m=d.members.indexOf(f);if(-1===m){p=!1;break}if(0===d.dimension){if(-1===l)l=m;else if(l!==m){p=!1;break}}else if(-1===u)u=m;else if(u!==m){p=!1;break}}else if(_!==f){p=!1;break}}}if(p){var S=e0[s._returnType];if(!S)return s._realReturnType=s._returnType,s;var v=0===S.dimension?l:u;return s._realReturnType=-1===v?3e3:S.members[v],s}}}},e.isExist=function(e){return e2.has(e)},s(e,[{key:"realReturnType",get:function(){return this._realReturnType}}]),e}();e1._create("radians",200,200),e1._create("degrees",200,200),e1._create("sin",200,200),e1._create("cos",200,200),e1._create("tan",200,200),e1._create("asin",200,200),e1._create("acos",200,200),e1._create("atan",200,200,200),e1._create("atan",200,200),e1._create("sinh",200,200),e1._create("cosh",200,200),e1._create("tanh",200,200),e1._create("asinh",200,200),e1._create("acosh",200,200),e1._create("atanh",200,200),e1._create("pow",200,200,200),e1._create("exp",200,200),e1._create("log",200,200),e1._create("exp2",200,200),e1._create("log2",200,200),e1._create("sqrt",200,200),e1._create("inversesqrt",200,200),e1._create("abs",200,200),e1._create("abs",201,201),e1._create("sign",200,200),e1._create("sign",201,201),e1._create("floor",200,200),e1._create("trunc",200,200),e1._create("round",200,200),e1._create("roundEven",200,200),e1._create("ceil",200,200),e1._create("fract",200,200),e1._create("mod",200,200,eF.FLOAT),e1._create("mod",200,200,200),e1._create("min",200,200,200),e1._create("min",200,200,eF.FLOAT),e1._create("min",201,201,201),e1._create("min",201,201,eF.INT),e1._create("min",202,202,202),e1._create("min",202,202,eF.UINT),e1._create("max",200,200,200),e1._create("max",200,200,eF.FLOAT),e1._create("max",201,201,201),e1._create("max",201,201,eF.INT),e1._create("clamp",200,200,200,200),e1._create("clamp",200,200,eF.FLOAT,eF.FLOAT),e1._create("clamp",201,201,201,201),e1._create("clamp",201,201,eF.INT,eF.INT),e1._create("clamp",202,202,202,202),e1._create("clamp",202,202,eF.UINT,eF.UINT),e1._create("mix",200,200,200,200),e1._create("mix",200,200,200,eF.FLOAT),e1._create("mix",200,200,200,203),e1._create("step",200,200,200),e1._create("step",200,eF.FLOAT,200),e1._create("smoothstep",200,200,200,200),e1._create("smoothstep",200,eF.FLOAT,eF.FLOAT,200),e1._create("isnan",203,200),e1._create("isinf",203,200),e1._create("floatBitsToInt",200,200),e1._create("floatBitsToUint",202,200),e1._create("intBitsToFloat",200,201),e1._create("uintBitsToFloat",200,202),e1._create("packSnorm2x16",eF.UINT,eF.VEC2),e1._create("unpackSnorm2x16",eF.VEC2,eF.UINT),e1._create("packUnorm2x16",eF.UINT,eF.VEC2),e1._create("unpackUnorm2x16",eF.VEC2,eF.UINT),e1._create("packHalf2x16",eF.UINT,eF.VEC2),e1._create("unpackHalf2x16",eF.VEC2,eF.UINT),e1._create("length",eF.FLOAT,200),e1._create("distance",eF.FLOAT,200,200),e1._create("dot",eF.FLOAT,200,200),e1._create("cross",eF.VEC3,eF.VEC3,eF.VEC3),e1._create("normalize",200,200),e1._create("faceforward",200,200,200,200),e1._create("reflect",200,200,200),e1._create("refract",200,200,200,eF.FLOAT),e1._create("matrixCompMult",204,204,204),e1._create("outerProduct",eF.MAT2,eF.VEC2,eF.VEC2),e1._create("outerProduct",eF.MAT3,eF.VEC3,eF.VEC3),e1._create("outerProduct",eF.MAT4,eF.VEC4,eF.VEC4),e1._create("outerProduct",eF.MAT2X3,eF.VEC3,eF.VEC2),e1._create("outerProduct",eF.MAT3X2,eF.VEC2,eF.VEC3),e1._create("outerProduct",eF.MAT2X4,eF.VEC4,eF.VEC2),e1._create("outerProduct",eF.MAT4X2,eF.VEC2,eF.VEC4),e1._create("outerProduct",eF.MAT3X4,eF.VEC4,eF.VEC3),e1._create("outerProduct",eF.MAT4X3,eF.VEC3,eF.VEC4),e1._create("transpose",eF.MAT2,eF.MAT2),e1._create("transpose",eF.MAT3,eF.MAT3),e1._create("transpose",eF.MAT4,eF.MAT4),e1._create("transpose",eF.MAT2X3,eF.MAT3X2),e1._create("transpose",eF.MAT3X2,eF.MAT2X3),e1._create("transpose",eF.MAT4X2,eF.MAT2X4),e1._create("transpose",eF.MAT2X4,eF.MAT4X2),e1._create("transpose",eF.MAT3X4,eF.MAT4X3),e1._create("transpose",eF.MAT4X3,eF.MAT3X4),e1._create("determinant",eF.FLOAT,eF.MAT2),e1._create("determinant",eF.FLOAT,eF.MAT3),e1._create("determinant",eF.FLOAT,eF.MAT4),e1._create("inverse",eF.MAT2,eF.MAT2),e1._create("inverse",eF.MAT3,eF.MAT3),e1._create("inverse",eF.MAT4,eF.MAT4),e1._create("lessThan",205,208,208),e1._create("lessThan",205,206,206),e1._create("lessThan",205,207,207),e1._create("lessThanEqual",205,208,208),e1._create("lessThanEqual",205,206,206),e1._create("lessThanEqual",205,207,207),e1._create("greaterThan",205,208,208),e1._create("greaterThan",205,206,206),e1._create("greaterThan",205,207,207),e1._create("greaterThanEqual",205,208,208),e1._create("greaterThanEqual",205,206,206),e1._create("greaterThanEqual",205,207,207),e1._create("equal",205,208,208),e1._create("equal",205,206,206),e1._create("equal",205,207,207),e1._create("equal",205,205,205),e1._create("notEqual",205,208,208),e1._create("notEqual",205,206,206),e1._create("notEqual",205,207,207),e1._create("notEqual",205,205,205),e1._create("any",eF.BOOL,205),e1._create("all",eF.BOOL,205),e1._create("not",205,205),e1._create("textureSize",eF.IVEC2,210,eF.INT),e1._create("textureSize",eF.IVEC3,211,eF.INT),e1._create("textureSize",eF.IVEC2,212,eF.INT),e1._create("textureSize",eF.IVEC2,eF.SAMPLER2D_SHADOW,eF.INT),e1._create("textureSize",eF.IVEC2,eF.SAMPLER_CUBE_SHADOW,eF.INT),e1._create("textureSize",eF.IVEC3,213,eF.INT),e1._create("textureSize",eF.IVEC3,eF.SAMPLER2D_ARRAY_SHADOW,eF.INT),e1._create("texture2D",209,210,eF.VEC2),e1._create("texture2D",209,210,eF.VEC2,eF.FLOAT),e1._create("texture",209,210,eF.VEC2,eF.FLOAT),e1._create("texture",209,210,eF.VEC2),e1._create("texture",209,211,eF.VEC3,eF.FLOAT),e1._create("texture",209,211,eF.VEC3),e1._create("texture",209,212,eF.VEC3,eF.FLOAT),e1._create("texture",209,212,eF.VEC3),e1._create("texture",eF.FLOAT,eF.SAMPLER2D_SHADOW,eF.VEC3,eF.FLOAT),e1._create("texture",eF.FLOAT,eF.SAMPLER2D_SHADOW,eF.VEC3),e1._create("texture",eF.FLOAT,eF.SAMPLER_CUBE_SHADOW,eF.VEC4,eF.FLOAT),e1._create("texture",eF.FLOAT,eF.SAMPLER_CUBE_SHADOW,eF.VEC4),e1._create("texture",209,eF.SAMPLER2D_ARRAY,eF.VEC3,eF.FLOAT),e1._create("texture",209,eF.SAMPLER2D_ARRAY,eF.VEC3),e1._create("texture",eF.FLOAT,eF.SAMPLER2D_ARRAY_SHADOW,eF.VEC4),e1._create("textureProj",209,210,eF.VEC3,eF.FLOAT),e1._create("textureProj",209,210,eF.VEC3),e1._create("textureProj",209,210,eF.VEC4,eF.FLOAT),e1._create("textureProj",209,210,eF.VEC4),e1._create("textureProj",209,211,eF.VEC4,eF.FLOAT),e1._create("textureProj",209,211,eF.VEC4),e1._create("textureProj",eF.FLOAT,eF.SAMPLER2D_SHADOW,eF.VEC4,eF.FLOAT),e1._create("textureProj",eF.FLOAT,eF.SAMPLER2D_SHADOW,eF.VEC4),e1._create("textureLod",209,210,eF.VEC2,eF.FLOAT),e1._create("textureLod",209,211,eF.VEC3,eF.FLOAT),e1._create("textureLod",209,212,eF.VEC3,eF.FLOAT),e1._create("textureLod",eF.FLOAT,eF.SAMPLER2D_SHADOW,eF.VEC3,eF.FLOAT),e1._create("textureLod",209,213,eF.VEC3,eF.FLOAT),e1._create("texture2DLod",209,210,eF.VEC2,eF.FLOAT),e1._create("texture2DLodEXT",209,210,eF.VEC2,eF.FLOAT),e1._create("texture2DLodEXT",209,211,eF.VEC3,eF.FLOAT),e1._create("textureCube",209,212,eF.VEC3),e1._create("textureCube",209,212,eF.VEC3,eF.FLOAT),e1._create("textureCubeLod",209,212,eF.VEC3,eF.FLOAT),e1._create("textureCubeLodEXT",209,212,eF.VEC3,eF.FLOAT),e1._create("textureOffset",209,210,eF.VEC2,eF.IVEC2,eF.FLOAT),e1._create("textureOffset",209,210,eF.VEC2,eF.IVEC2),e1._create("textureOffset",209,211,eF.VEC3,eF.IVEC3,eF.FLOAT),e1._create("textureOffset",209,211,eF.VEC3,eF.IVEC3),e1._create("textureOffset",eF.FLOAT,eF.SAMPLER2D_SHADOW,eF.VEC3,eF.IVEC2,eF.FLOAT),e1._create("textureOffset",eF.FLOAT,eF.SAMPLER2D_SHADOW,eF.VEC3,eF.IVEC2),e1._create("textureOffset",209,213,eF.VEC3,eF.IVEC2,eF.FLOAT),e1._create("textureOffset",209,213,eF.VEC3,eF.IVEC2),e1._create("texelFetch",209,210,eF.IVEC2,eF.INT),e1._create("texelFetch",209,211,eF.IVEC3,eF.INT),e1._create("texelFetch",209,213,eF.IVEC3,eF.INT),e1._create("texelFetchOffset",209,210,eF.IVEC2,eF.INT,eF.IVEC2),e1._create("texelFetchOffset",209,211,eF.IVEC3,eF.INT,eF.IVEC3),e1._create("texelFetchOffset",209,213,eF.IVEC3,eF.INT,eF.IVEC2),e1._create("textureProjOffset",209,210,eF.VEC3,eF.IVEC2,eF.FLOAT),e1._create("textureProjOffset",209,210,eF.VEC3,eF.IVEC2),e1._create("textureProjOffset",209,210,eF.VEC4,eF.IVEC2,eF.FLOAT),e1._create("textureProjOffset",209,210,eF.VEC4,eF.IVEC2),e1._create("textureProjOffset",209,211,eF.VEC4,eF.IVEC3,eF.FLOAT),e1._create("textureProjOffset",209,211,eF.VEC4,eF.IVEC3),e1._create("textureProjOffset",eF.FLOAT,eF.SAMPLER2D_SHADOW,eF.VEC4,eF.IVEC2,eF.FLOAT),e1._create("textureProjOffset",eF.FLOAT,eF.SAMPLER2D_SHADOW,eF.VEC4,eF.IVEC2),e1._create("textureLodOffset",209,210,eF.VEC2,eF.FLOAT,eF.IVEC2),e1._create("textureLodOffset",209,211,eF.VEC3,eF.FLOAT,eF.IVEC3),e1._create("textureLodOffset",eF.FLOAT,eF.SAMPLER2D_SHADOW,eF.VEC3,eF.FLOAT,eF.IVEC2),e1._create("textureLodOffset",209,213,eF.VEC3,eF.FLOAT,eF.IVEC2),e1._create("textureProjLod",209,210,eF.VEC3,eF.FLOAT),e1._create("textureProjLod",209,210,eF.VEC4,eF.FLOAT),e1._create("textureProjLod",209,211,eF.VEC4,eF.FLOAT),e1._create("textureProjLod",eF.FLOAT,eF.SAMPLER2D_SHADOW,eF.VEC4,eF.FLOAT),e1._create("textureProjLodOffset",209,210,eF.VEC3,eF.FLOAT,eF.IVEC2),e1._create("textureProjLodOffset",209,210,eF.VEC4,eF.FLOAT,eF.IVEC2),e1._create("textureProjLodOffset",209,211,eF.VEC4,eF.FLOAT,eF.IVEC3),e1._create("textureProjLodOffset",eF.FLOAT,eF.SAMPLER2D_SHADOW,eF.VEC4,eF.FLOAT,eF.IVEC2),e1._create("textureGrad",209,210,eF.VEC2,eF.VEC2,eF.VEC2),e1._create("textureGrad",209,211,eF.VEC3,eF.VEC3,eF.VEC3),e1._create("textureGrad",209,212,eF.VEC3,eF.VEC3,eF.VEC3),e1._create("textureGrad",eF.FLOAT,eF.SAMPLER2D_SHADOW,eF.VEC3,eF.VEC2,eF.VEC2),e1._create("textureGrad",eF.FLOAT,eF.SAMPLER_CUBE_SHADOW,eF.VEC4,eF.VEC3,eF.VEC3),e1._create("textureGrad",209,213,eF.VEC3,eF.VEC2,eF.VEC2),e1._create("textureGrad",eF.FLOAT,eF.SAMPLER2D_ARRAY_SHADOW,eF.VEC4,eF.VEC2,eF.VEC2),e1._create("textureGradOffset",209,210,eF.VEC2,eF.VEC2,eF.VEC2,eF.IVEC2),e1._create("textureGradOffset",209,211,eF.VEC3,eF.VEC3,eF.VEC3,eF.IVEC3),e1._create("textureGradOffset",eF.FLOAT,eF.SAMPLER2D_SHADOW,eF.VEC3,eF.VEC2,eF.VEC2,eF.IVEC2),e1._create("textureGradOffset",209,213,eF.VEC3,eF.VEC2,eF.VEC2,eF.IVEC2),e1._create("textureGradOffset",eF.FLOAT,eF.SAMPLER2D_ARRAY_SHADOW,eF.VEC3,eF.VEC2,eF.VEC2,eF.IVEC2),e1._create("textureProjGrad",209,210,eF.VEC3,eF.VEC2,eF.VEC2),e1._create("textureProjGrad",209,210,eF.VEC4,eF.VEC2,eF.VEC2),e1._create("textureProjGrad",209,211,eF.VEC4,eF.VEC3,eF.VEC3),e1._create("textureProjGrad",eF.FLOAT,eF.SAMPLER2D_SHADOW,eF.VEC4,eF.VEC2,eF.VEC2),e1._create("textureProjGradOffset",209,210,eF.VEC3,eF.VEC2,eF.VEC2,eF.IVEC2),e1._create("textureProjGradOffset",209,210,eF.VEC4,eF.VEC2,eF.VEC2,eF.IVEC2),e1._create("textureProjGradOffset",209,211,eF.VEC4,eF.VEC3,eF.VEC3,eF.IVEC3),e1._create("textureProjGradOffset",eF.FLOAT,eF.SAMPLER2D_SHADOW,eF.VEC4,eF.VEC2,eF.VEC2,eF.IVEC2),e1._createWithScope("dFdx",200,eZ.FRAGMENT,200),e1._createWithScope("dFdy",200,eZ.FRAGMENT,200),e1._createWithScope("fwidth",200,eZ.FRAGMENT,200);var e3=new Map,e4=/*#__PURE__*/function(){function e(e,t,r){this.type=e,this.lexeme=t,this.scope=r}return e.createVariable=function(t,r,n){void 0===n&&(n=eZ.ALL);var i=new e(r,t,n);e3.set(t,i)},e.getVar=function(e){return e3.get(e)},e}();e4.createVariable("gl_VertexID",eF.INT,eZ.VERTEX),e4.createVariable("gl_InstanceID",eF.INT,eZ.VERTEX),e4.createVariable("gl_Position",eF.VEC4,eZ.VERTEX),e4.createVariable("gl_PointSize",eF.FLOAT,eZ.VERTEX),e4.createVariable("gl_FragCoord",eF.VEC4,eZ.FRAGMENT),e4.createVariable("gl_FrontFacing",eF.BOOL,eZ.FRAGMENT),e4.createVariable("gl_FragDepth",eF.FLOAT,eZ.FRAGMENT),e4.createVariable("gl_PointCoord",eF.VEC2,eZ.FRAGMENT),e4.createVariable("gl_FragColor",eF.VEC4,eZ.FRAGMENT),e4.createVariable("gl_FragData",eF.VEC4_ARRAY,eZ.FRAGMENT),e4.createVariable("gl_MaxVertexAttribs",eF.INT),e4.createVariable("gl_MaxVertexUniformVectors",eF.INT),e4.createVariable("gl_MaxVertexOutputVectors",eF.INT),e4.createVariable("gl_MaxFragmentInputVectors",eF.INT),e4.createVariable("gl_MaxVertexTextureImageUnits",eF.INT),e4.createVariable("gl_MaxCombinedTextureImageUnits",eF.INT),e4.createVariable("gl_MaxTextureImageUnits",eF.INT),e4.createVariable("gl_MaxFragmentUniformVectors",eF.INT),e4.createVariable("gl_MaxDrawBuffers",eF.INT),e4.createVariable("gl_MinProgramTexelOffset",eF.INT),e4.createVariable("gl_MaxProgramTexelOffset",eF.INT);var e9=/*#__PURE__*/function(){function e(){this._table=new Map}var t=e.prototype;return t.insert=function(e,t){void 0===t&&(t=!1),e.isInMacroBranch=t;for(var n,i=null!=(n=this._table.get(e.ident))?n:[],a=0,o=i.length;a<o;a++)if(!i[a].isInMacroBranch&&i[a].equal(e)){r.Logger.warn("Replace symbol:",e.ident),i[a]=e;return}i.push(e),this._table.set(e.ident,i)},t.getSymbol=function(e,t){void 0===t&&(t=!1);var r=this._table.get(e.ident);if(r)for(var n=r.length-1;n>=0;n--){var i=r[n];if((t||!i.isInMacroBranch)&&i.equal(e))return i}},t.getSymbols=function(e,t,r){return void 0===t&&(t=!1),r.length=0,this._getSymbols(e,t,r),r},t._getSymbols=function(e,t,r){void 0===t&&(t=!1);var n=this._table.get(e.ident);if(n)for(var i=n.length-1;i>=0;i--){var a=n[i];(t||!a.isInMacroBranch)&&a.equal(e)&&r.push(a)}return r},t.forEach=function(e){for(var t,r=l(this._table.values());!(t=r()).done;)for(var n=t.value,i=0,a=n.length;i<a;i++)e(n[i])},e}(),e5=/*#__PURE__*/function(){function e(){this.stack=[],this._macroLevel=0}var t=e.prototype;return t.pushScope=function(e){this.stack.push(e)},t.clear=function(){this.stack.length=0},t.popScope=function(){return this.stack.pop()},t.insert=function(e){this.scope.insert(e,this.isInMacroBranch)},t.lookup=function(e,t){void 0===t&&(t=!1);for(var r=this.stack.length-1;r>=0;r--){var n=this.stack[r].getSymbol(e,t);if(n)return n}},t.lookupAll=function(e,t,r){void 0===t&&(t=!1),r.length=0;for(var n=this.stack.length-1;n>=0;n--)this.stack[n]._getSymbols(e,t,r);return r},s(e,[{key:"scope",get:function(){return this.stack[this.stack.length-1]}},{key:"isInMacroBranch",get:function(){return this._macroLevel>0}}]),e}(),e6=function(e,t,r){this.type=e,this.typeLexeme=t,this.arraySpecifier=r},e7=((m={})[m.VAR=0]="VAR",m[m.FN=1]="FN",m[m.STRUCT=2]="STRUCT",m[m.Any=3]="Any",m),e8=/*#__PURE__*/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}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}(),te=/*#__PURE__*/function(e){function t(t,r){var n=new e6(r.protoType.returnType.type,r.protoType.returnType.typeSpecifier.lexeme);return e.call(this,t,e7.FN,r,n)||this}return a(t,e),t}(e8),tt=/*#__PURE__*/function(e){function t(t,r){return e.call(this,t,e7.STRUCT,r)||this}return a(t,e),t}(e8),tr=/*#__PURE__*/function(e){function t(t,r,n,i){var a;return(a=e.call(this,t,e7.VAR,i,r)||this).isGlobalVariable=n,a}return a(t,e),t}(e8),tn=/*#__PURE__*/function(){function e(){this.globalPrecisions=[],this.globalMacroDeclarations=[]}return e.prototype.getOuterGlobalMacroDeclarations=function(){return this.globalMacroDeclarations.filter(function(e){return n(e.parent,eD.GLShaderProgram)})},e}(),ti=/*#__PURE__*/function(){function e(){this.semanticStack=[],this.acceptRule=void 0,this.symbolTableStack=new e5,this.curFunctionInfo={},this._shaderData=new tn,this._translationRuleTable=new Map,this.pushScope()}var t=e.prototype;return t.reset=function(e){this._macroDefineList=e,this.semanticStack.length=0,this._shaderData=new tn,this.symbolTableStack.clear(),this.pushScope()},t.pushScope=function(){this.symbolTableStack.pushScope(new e9)},t.popScope=function(){return this.symbolTableStack.popScope()},t.addTranslationRule=function(e,t){this._translationRuleTable.set(e,t)},t.getTranslationRule=function(e){return this._translationRuleTable.get(e)},t.reportError=function(e,t){console.error(t)},t.reportWarning=function(e,t){r.Logger.warn(new eK(eY.CompilationWarn,t,e,tD._processingPassText).toString())},s(e,[{key:"shaderData",get:function(){return this._shaderData}},{key:"macroDefineList",get:function(){return this._macroDefineList}}]),e}();ti._lookupSymbol=new e8("",null);var ta=function(e,t,r){this.type=e,this.typeLexeme=t,this.arraySpecifier=r},to=function(e,t,r,n){void 0===n&&(n=!1),this.typeInfo=e,this.ident=t,this.mrtIndex=r,this.isInMacroBranch=n};function ts(e){return function(t){t.prototype.nt=e,t.pool=eB.createObjectPool(t)}}var tc=/*#__PURE__*/function(){function e(){}var t=e.prototype;return t.set=function(t,r){this._location=t,this._children=r;for(var i,a=l(r);!(i=a()).done;){var o=i.value;n(o,e)&&(o._parent=this)}this.init()},t.init=function(){},t.dispose=function(){},t.setCache=function(e){return this._codeCache=e,e},t.getCache=function(){return this._codeCache},t.codeGen=function(e){var t=e.defaultCodeGen(this.children);return this.setCache(t),t},t.semanticAnalyze=function(e){},s(e,[{key:"parent",get:function(){return this._parent}},{key:"children",get:function(){return this._children}},{key:"location",get:function(){return this._location}}]),e}();(S=eD||(eD={}))._unwrapToken=function(e){if(n(e,eU))return e;throw"not token"},S.get=function(e,t,r,n){var i=e.get();i.set(r,n),i.semanticAnalyze(t),t.semanticStack.push(i)},v=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(tc),S.TrivialNode=v,v=u([ts(eH._ignore)],v),E=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){e.pushScope()},t}(tc),S.ScopeBrace=E,E=u([ts(eH.scope_brace)],E),C=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){e.popScope()},t}(tc),S.ScopeEndBrace=C,C=u([ts(eH.scope_end_brace)],C),g=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(t,e);var r=t.prototype;return r.init=function(){this.isFragReturnStatement=!1},r.semanticAnalyze=function(e){S._unwrapToken(this.children[0]).type===eF.RETURN&&(e.curFunctionInfo.returnStatement=this)},r.codeGen=function(e){return this.setCache(e.visitJumpStatement(this))},t}(tc),S.JumpStatement=g,g=u([ts(eH.jump_statement)],g),y=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.init=function(){this._type=void 0},s(t,[{key:"type",get:function(){var e;return null!=(e=this._type)?e:3e3},set:function(e){this._type=e}}]),t}(tc),S.ExpressionAstNode=y,A=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(t,e);var r=t.prototype;return r.init=function(){this.typeSpecifier=void 0,this.arraySpecifier=void 0},r.semanticAnalyze=function(e){var t,r=this.children,n=r.length,i=r[0],a=i.typeSpecifier;this.typeSpecifier=a,this.arraySpecifier=a.arraySpecifier;var o=r[1];if(2===n||4===n){var s=new ta(i.type,a.lexeme,this.arraySpecifier),c=r[3];t=new tr(o.lexeme,s,!1,c)}else{var l=r[2];this.arraySpecifier=l;var u=new ta(i.type,a.lexeme,this.arraySpecifier),p=r[4];t=new tr(o.lexeme,u,!1,p)}e.symbolTableStack.insert(t)},r.codeGen=function(e){return this.setCache(e.visitSingleDeclaration(this))},t}(tc),S.SingleDeclaration=A,A=u([ts(eH.single_declaration)],A),x=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){var t=this.children;this.typeSpecifier=1===t.length?t[0]:t[1],this.type=this.typeSpecifier.type},t}(tc),S.FullySpecifiedType=x,x=u([ts(eH.fully_specified_type)],x),b=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(tc),S.TypeQualifier=b,b=u([ts(eH.type_qualifier)],b),T=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){var t=this.children[0];n(t,eU)?this.qualifier=t.type:this.qualifier=t.qualifier,this.lexeme=t.lexeme},t}(tc),S.SingleTypeQualifier=T,T=u([ts(eH.single_type_qualifier)],T),O=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(t,e);var r=t.prototype;return r.init=function(){this.arraySize=void 0},r.semanticAnalyze=function(e){var t,r=this.children,n=r[0];this.type=n.type,this.lexeme=n.lexeme,this.arraySize=null==r?void 0:null==(t=r[1])?void 0:t.size,this.isCustom="string"==typeof this.type},s(t,[{key:"arraySpecifier",get:function(){return this.children[1]}}]),t}(tc),S.TypeSpecifier=O,O=u([ts(eH.type_specifier)],O),I=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){var t=this.children[1];this.size=t.value},t}(tc),S.ArraySpecifier=I,I=u([ts(eH.array_specifier)],I),L=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){var t=this.children[0];switch(this.lexeme=t.lexeme,t.type){case eG.PLUS:this.compute=function(e,t){return e+t};break;case eG.DASH:this.compute=function(e,t){return e-t};break;case eG.STAR:this.compute=function(e,t){return e*t};break;case eG.SLASH:this.compute=function(e,t){return e/t};break;case eG.PERCENT:this.compute=function(e,t){return e%t};break;default:e.reportError(t.location,"not implemented operator "+t.lexeme)}},t}(tc),S.IntegerConstantExpressionOperator=L,L=u([ts(eH.integer_constant_expression_operator)],L),R=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(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];n(t,eU)&&(this.value=Number(t.lexeme))}},t}(tc),S.IntegerConstantExpression=R,R=u([ts(eH.integer_constant_expression)],R),P=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.init=function(){var e=this.children[0];n(e,eU)?(this.type=e.lexeme,this.lexeme=e.lexeme):n(e,eL)?(this.type=3e3,this.lexeme=e.macroName):(this.type=e.type,this.lexeme=e.lexeme)},t}(tc),S.TypeSpecifierNonArray=P,P=u([ts(eH.type_specifier_nonarray)],P),M=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.init=function(){var e=this.children[0];this.type=e.type,this.lexeme=e.lexeme},t}(tc),S.ExtBuiltinTypeSpecifierNonArray=M,M=u([ts(eH.ext_builtin_type_specifier_nonarray)],M),N=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){var t,r=this.children,n=r.length;if(1===n){var i=r[0],a=i.typeSpecifier,o=i.arraySpecifier;this.typeInfo=new ta(a.type,a.lexeme,o)}else{var s=r[0];this.typeInfo=s.typeInfo}if(3===n||5===n)t=new tr(r[2].lexeme,this.typeInfo,!1,this),e.symbolTableStack.insert(t);else if(4===n||6===n){var c=this.typeInfo,l=this.children[3];c.arraySpecifier=l,t=new tr(r[2].lexeme,c,!1,this),e.symbolTableStack.insert(t)}},t}(tc),S.InitDeclaratorList=N,N=u([ts(eH.init_declarator_list)],N),D=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.idList=[],t}a(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}(tc),S.IdentifierList=D,D=u([ts(eH.identifier_list)],D),V=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.codeGen=function(e){return this.setCache(e.visitDeclaration(this))},t}(tc),S.Declaration=V,V=u([ts(eH.declaration)],V),k=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(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}(tc),S.FunctionProtoType=k,k=u([ts(eH.function_prototype)],k),G=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){e.curFunctionInfo.returnStatement=null,e.curFunctionInfo.header=this;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},t}(tc),S.FunctionDeclarator=G,G=u([ts(eH.function_declarator)],G),F=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(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 this.setCache(e.visitFunctionHeader(this))},t}(tc),S.FunctionHeader=F,F=u([ts(eH.function_header)],F),B=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.parameterInfoList=[],t.paramSig=[],t}a(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,i=this.parameterInfoList,a=this.paramSig;if(n(r[0],H)){var o,s,c=r[0];i.push({ident:c.ident,typeInfo:c.typeInfo,astNode:c}),a.push(null!=(s=null==(o=c.typeInfo)?void 0:o.type)?s:3e3)}else if(n(r[2],H)){var l,u,p=r[0],h=r[2];i.push.apply(i,[].concat(p.parameterInfoList,[{ident:h.ident,typeInfo:h.typeInfo,astNode:h}])),a.push.apply(a,[].concat(p.paramSig,[null!=(u=null==(l=h.typeInfo)?void 0:l.type)?u:3e3]))}else n(r[0],t)&&n(r[1],U)?(i.push.apply(i,[].concat(r[0].parameterInfoList,[{astNode:r[1]}])),a.push.apply(a,[].concat(r[0].paramSig,[3e3]))):n(r[0],U)&&(i.push({astNode:r[0]}),a.push(3e3))},r.codeGen=function(e){return this.setCache(e.visitFunctionParameterList(this))},t}(tc),S.FunctionParameterList=B,B=u([ts(eH.function_parameter_list)],B),W=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(tc),S.MacroParamCaseList=W,W=u([ts(eH.macro_param_case_list)],W),U=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(tc),S.MacroParamBlock=U,U=u([ts(eH.macro_param_block)],U),w=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(tc),S.MacroParameterBranch=w,w=u([ts(eH.macro_parameter_branch)],w),H=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(t,e);var r=t.prototype;return r.init=function(){this.typeInfo=void 0,this.ident=void 0},r.semanticAnalyze=function(e){var t,r=this.children;if(n(r[0],j)?t=r[0]:n(r[1],j)&&(t=r[1]),t){this.typeInfo=t.typeInfo,this.ident=t.ident;var i=new tr(t.ident.lexeme,t.typeInfo,!1,t);e.symbolTableStack.insert(i)}},t}(tc),S.ParameterDeclaration=H,H=u([ts(eH.parameter_declaration)],H),j=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(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 ta(r.type,r.lexeme,n)},t}(tc),S.ParameterDeclarator=j,j=u([ts(eH.parameter_declarator)],j),z=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(tc),S.CompoundStatementNoScope=z,z=u([ts(eH.compound_statement_no_scope)],z),q=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.codeGen=function(e){return this.setCache(e.visitStatementList(this))},t}(tc),S.StatementList=q,q=u([ts(eH.statement_list)],q),X=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(t,e);var r=t.prototype;return r.init=function(){this.returnStatement=void 0},r.semanticAnalyze=function(e){var t=this.children;this.protoType=t[0],this.statements=t[1],e.popScope();var r=new te(this.protoType.ident.lexeme,this);e.symbolTableStack.insert(r),this.isInMacroBranch=e.symbolTableStack.isInMacroBranch;var n=e.curFunctionInfo,i=n.header,a=n.returnStatement;i.returnType.type===eF.VOID?a&&e.reportError(i.returnType.location,"Return in void function."):a?this.returnStatement=a:e.reportError(i.returnType.location,"No return statement found."),n.header=void 0,n.returnStatement=void 0},r.codeGen=function(e){return this.setCache(e.visitFunctionDefinition(this))},t}(tc),S.FunctionDefinition=X,X=u([ts(eH.function_definition)],X),Q=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(t,e);var r=t.prototype;return r.semanticAnalyze=function(e){this.type=this.children[0].type},r.codeGen=function(e){return this.setCache(e.visitFunctionCall(this))},t}(y),S.FunctionCall=Q,Q=u([ts(eH.function_call)],Q),K=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(t,e);var r=t.prototype;return r.init=function(){e.prototype.init.call(this),this.fnSymbol=void 0},r.semanticAnalyze=function(e){var t=this.children[0];if(t.isBuiltin)this.type=t.ident;else{var r,i,a=t.ident;if(4===this.children.length){var o=this.children[2];n(o,Y)&&(i=o.paramSig)}var s=ti._lookupSymbol;s.set(a,e7.FN,void 0,void 0,i);var c=e.symbolTableStack.lookup(s,!0);if(!c)return;this.type=null==c?void 0:null==(r=c.dataType)?void 0:r.type,this.fnSymbol=c}},t}(y),S.FunctionCallGeneric=K,K=u([ts(eH.function_call_generic)],K),Y=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.paramSig=[],t.paramNodes=[],t}a(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,i=this.paramSig,a=this.paramNodes;if(n(r[0],er)){var o=r[0];i.push(o.type),a.push(o)}else if(n(r[2],er)){var s=r[0],c=r[2];i.push.apply(i,[].concat(s.paramSig,[c.type])),a.push.apply(a,[].concat(s.paramNodes,[c]))}else n(r[0],t)&&n(r[1],$)?(i.push.apply(i,[].concat(r[0].paramSig,[3e3])),a.push.apply(a,[].concat(r[0].paramNodes,[r[1]]))):n(r[0],$)&&(i.push(3e3),a.push(r[0]))},t}(tc),S.FunctionCallParameterList=Y,Y=u([ts(eH.function_call_parameter_list)],Y),J=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(tc),S.MacroCallArgCaseList=J,J=u([ts(eH.macro_call_arg_case_list)],J),$=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(tc),S.MacroCallArgBlock=$,$=u([ts(eH.macro_call_arg_block)],$),Z=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(tc),S.MacroCallArgBranch=Z,Z=u([ts(eH.macro_call_arg_branch)],Z),ee=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){e.symbolTableStack.isInMacroBranch||e.shaderData.globalPrecisions.push(this)},t}(tc),S.PrecisionSpecifier=ee,ee=u([ts(eH.precision_specifier)],ee),et=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(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 this.setCache(e.visitFunctionIdentifier(this))},t}(tc),S.FunctionIdentifier=et,et=u([ts(eH.function_identifier)],et),er=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(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}(y),S.AssignmentExpression=er,er=u([ts(eH.assignment_expression)],er),en=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(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}(y),S.Expression=en,en=u([ts(eH.expression)],en),ei=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){if(1===this.children.length){var t,r=this.children[0];if(n(r,em))this.type=null!=(t=r.typeInfo)?t:3e3;else switch(r.type){case eG.INT_CONSTANT:this._type=eF.INT;break;case eG.FLOAT_CONSTANT:this.type=eF.FLOAT;break;case eF.True:case eF.False:this.type=eF.BOOL}}else{var i=this.children[1];this.type=i.type}},t}(y),S.PrimaryExpression=ei,ei=u([ts(eH.primary_expression)],ei),ea=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(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.codeGen=function(e){return this.setCache(e.visitPostfixExpression(this))},t}(y),S.PostfixExpression=ea,ea=u([ts(eH.postfix_expression)],ea),eo=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(t,e);var r=t.prototype;return r.init=function(){this.ident=void 0},r.semanticAnalyze=function(e){var t=this.children;this.isInMacroBranch=e.symbolTableStack.isInMacroBranch,6===t.length?(this.ident=t[1],e.symbolTableStack.insert(new tt(this.ident.lexeme,this)),this.propList=t[3].propList,this.macroExpressions=t[3].macroExpressions):(this.propList=t[2].propList,this.macroExpressions=t[2].macroExpressions)},r.codeGen=function(e){return this.setCache(e.visitStructSpecifier(this))},t}(tc),S.StructSpecifier=eo,eo=u([ts(eH.struct_specifier)],eo),es=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.propList=[],t.macroExpressions=[],t}a(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}(tc),S.StructDeclarationList=es,es=u([ts(eH.struct_declaration_list)],es),ec=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.props=[],t.macroExpressions=[],t}a(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,i=this.macroExpressions;if(1===t.length){for(var a=t[0],o=a.props,s=0,c=o.length;s<c;s++)o[s].isInMacroBranch=!0,r.push(o[s]);i.push.apply(i,[].concat(a.macroExpressions));return}3===t.length?(this._typeSpecifier=t[0],this._declaratorList=t[1]):(this._typeSpecifier=t[1],this._declaratorList=t[2]);var l=t[0],u=this._typeSpecifier,p=u.type,h=u.lexeme,_=e.symbolTableStack.isInMacroBranch;if(n(l,ep)){var f=t[2],d=new to(new ta(p,h),f.ident,l.index,_);r.push(d)}else{var m=this._declaratorList.declaratorList,S=m.length;r.length=S;for(var v=0;v<S;v++){var E=m[v],C=new to(new ta(p,h,E.arraySpecifier),E.ident,void 0,_);r[v]=C}}},t}(tc),S.StructDeclaration=ec,ec=u([ts(eH.struct_declaration)],ec),el=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.props=[],t.macroExpressions=[],t}a(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}(tc),S.MacroStructDeclaration=el,el=u([ts(eH.macro_struct_declaration)],el),eu=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.props=[],t.macroExpressions=[],t}a(t,e);var r=t.prototype;return r.init=function(){this.props.length=0,this.macroExpressions.length=0},r.semanticAnalyze=function(){var e,r,i,a,o=this.children,s=o[o.length-1];this.macroExpressions.push(o[0]),n(o[1],es)&&((e=this.props).push.apply(e,[].concat(o[1].propList)),(r=this.macroExpressions).push.apply(r,[].concat(o[1].macroExpressions))),n(s,t)&&((i=this.props).push.apply(i,[].concat(s.props)),(a=this.macroExpressions).push.apply(a,[].concat(s.macroExpressions))),o.length>1&&n(s,eg)&&this.macroExpressions.push(s)},t}(tc),S.MacroStructBranch=eu,eu=u([ts(eH.macro_struct_branch)],eu),ep=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){this.index=Number(this.children[4].lexeme)},t}(tc),S.LayoutQualifier=ep,ep=u([ts(eH.layout_qualifier)],ep),eh=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.declaratorList=[],t}a(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}(tc),S.StructDeclaratorList=eh,eh=u([ts(eH.struct_declarator_list)],eh),e_=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(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}(tc),S.StructDeclarator=e_,e_=u([ts(eH.struct_declarator)],e_),ef=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(t,e);var r=t.prototype;return r.init=function(){this.isStatic=!1},r.semanticAnalyze=function(e){var t=this.children,r=t[0],n=t[1];this.type=r;var i=new tr(n.lexeme,new ta(r.type,r.typeSpecifier.lexeme),!0,this);e.symbolTableStack.insert(i),4===t.length&&(this.isStatic=!0)},r.codeGen=function(t){return this.isStatic?e.prototype.codeGen.call(this,t):this.setCache(t.visitGlobalVariableDeclaration(this))},t}(tc),S.VariableDeclaration=ef,ef=u([ts(eH.variable_declaration)],ef),ed=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.variableDeclarations=[],t}a(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,i=t[0],a=i.type;if(this.type=a,n(i,ef))this.variableDeclarations.push(i);else{(o=this.variableDeclarations).push.apply(o,[].concat(i.variableDeclarations));var o,s=t[2],c=ef.pool.get();3===r?c.set(s.location,[a,s]):c.set(s.location,[a,s,t[3]]),c.semanticAnalyze(e),this.variableDeclarations.push(c)}},t}(tc),S.VariableDeclarationList=ed,ed=u([ts(eH.variable_declaration_list)],ed),em=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.referenceGlobalSymbolNames=[],t._symbols=[],t}a(t,e);var r=t.prototype;return r.init=function(){this.typeInfo=3e3,this.referenceGlobalSymbolNames.length=0,this._symbols.length=0},r.semanticAnalyze=function(e){for(var r=this.children[0],i=this.referenceGlobalSymbolNames,a=this._symbols,o=n(r,eU)?[r.lexeme]:r.referenceSymbolNames,s=0;s<o.length;s++){var c,l=o[s];if(!e.macroDefineList[l]){if(!n(r,eU)&&e1.isExist(l))continue;var u=e4.getVar(l);if(u){this.typeInfo=u.type;continue}t._lookupAndMarkGlobalReference(e,l,a,i,this.location)&&(n(r,eU)||!r.hasAstValue)&&(this.typeInfo=null==(c=a[0].dataType)?void 0:c.type)}}n(r,eU)||t._probeCrossArmShadowing(e,r,o,a,i)},r.codeGen=function(e){return this.setCache(e.visitVariableIdentifier(this))},r.getLexeme=function(e){var t=this.children[0];return n(t,eU)?t.lexeme:t.codeGen(e)},t._probeCrossArmShadowing=function(e,r,n,i,a){var o=r.macroName;o&&-1===n.indexOf(o)&&(e1.isExist(o)||e4.getVar(o)||t._lookupAndMarkGlobalReference(e,o,i,a,null))},t._lookupAndMarkGlobalReference=function(e,t,r,i,a){var o=ti._lookupSymbol;if(o.set(t,e7.Any),e.symbolTableStack.lookupAll(o,!0,r),!r.length)return!1;var s=e.symbolTableStack.scope.getSymbol(o,!0);return(s?n(s,te)||s.isGlobalVariable:r.some(function(e){return n(e,te)||e.isGlobalVariable}))&&-1===i.indexOf(t)&&i.push(t),!0},t}(tc),S.VariableIdentifier=em,em=u([ts(eH.variable_identifier)],em),eS=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){this.shaderData=e.shaderData,this.shaderData.symbolTable=e.symbolTableStack.scope},t}(tc),S.GLShaderProgram=eS,eS=u([ts(eH.gs_shader_program)],eS),ev=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.macroExpressions=[],t}a(t,e);var r=t.prototype;return r.init=function(){this.macroExpressions.length=0},r.semanticAnalyze=function(e){var t,r=this.children[0];(n(r,eE)||n(r,eb)||n(r,eP)||n(r,eU))&&(e.shaderData.globalMacroDeclarations.push(this),n(r,eb)?(t=this.macroExpressions).push.apply(t,[].concat(r.macroExpressions)):this.macroExpressions.push(r))},t}(tc),S.GlobalDeclaration=ev,ev=u([ts(eH.global_declaration)],ev),eE=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.codeGen=function(t){return this.setCache(e.prototype.codeGen.call(this,t)+"\n")},t}(tc),S.MacroUndef=eE,eE=u([ts(eH.macro_undef)],eE),eC=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(t,e);var r=t.prototype;return r.semanticAnalyze=function(e){e.symbolTableStack._macroLevel++},r.codeGen=function(t){return this.setCache("\n"+e.prototype.codeGen.call(this,t)+"\n")},t}(tc),S.MacroPushContext=eC,eC=u([ts(eH.macro_push_context)],eC),eg=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(t,e);var r=t.prototype;return r.semanticAnalyze=function(e){e.symbolTableStack._macroLevel--},r.codeGen=function(t){return this.setCache("\n"+e.prototype.codeGen.call(this,t)+"\n")},t}(tc),S.MacroPopContext=eg,eg=u([ts(eH.macro_pop_context)],eg),ey=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.codeGen=function(t){return this.setCache("\n"+e.prototype.codeGen.call(this,t)+"\n")},t}(tc),S.MacroElifExpression=ey,ey=u([ts(eH.macro_elif_expression)],ey),eA=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.codeGen=function(t){return this.setCache("\n"+e.prototype.codeGen.call(this,t)+"\n")},t}(tc),S.MacroElseExpression=eA,eA=u([ts(eH.macro_else_expression)],eA),ex=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.macroExpressions=[],t}a(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?this.setCache(t[0].codeGen(e)):this.setCache(t[0].codeGen(e)+"\n"+t[1].codeGen(e))},t}(tc),S.GlobalMacroDeclaration=ex,ex=u([ts(eH.global_macro_declaration)],ex),eb=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.macroExpressions=[],t}a(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}(tc),S.GlobalMacroIfStatement=eb,eb=u([ts(eH.global_macro_if_statement)],eb),eT=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.macroExpressions=[],t}a(t,e);var r=t.prototype;return r.init=function(){this.macroExpressions.length=0},r.semanticAnalyze=function(e){var r=this.children,i=r[r.length-1],a=this.macroExpressions;a.push(r[0]),n(r[1],ex)&&a.push.apply(a,[].concat(r[1].macroExpressions)),n(i,t)&&a.push.apply(a,[].concat(i.macroExpressions)),r.length>1&&n(i,eg)&&a.push(i)},t}(tc),S.GlobalMacroBranch=eT,eT=u([ts(eH.global_macro_branch)],eT),eO=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(tc),S.MacroIfStatement=eO,eO=u([ts(eH.macro_if_statement)],eO),eI=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(tc),S.MacroBranch=eI,eI=u([ts(eH.macro_branch)],eI),eL=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.referenceSymbolNames=[],t.hasAstValue=!1,t.isFunctionLikeMacro=!1,t.aliasesNonBuiltinIdent=!1,t}a(t,e);var r=t.prototype;return r.init=function(){this.referenceSymbolNames.length=0,this.hasAstValue=!1,this.isFunctionLikeMacro=!1,this.aliasesNonBuiltinIdent=!1},r.semanticAnalyze=function(e){var r=this.children[0],i=r.lexeme;this.macroName=i;var a=r.branch,o=e.macroDefineList[i],s=this.referenceSymbolNames;s.length=0;var c=0,l=!0,u=!1,p=!0;if(o)for(var h=0,_=o.length;h<_;h++){var f=o[h];if(e$.isVisibleFrom(f.branch,a)){if(c++,null==f.valueAst&&(l=!1),f.isFunction&&(u=!0),f.valueAst&&t._collectIdentifierRefs(f.valueAst,f.params,s),f.isFunction||!f.valueAst)p=!1;else{var d=ej.unwrapBareIdentifier(f.valueAst,{allowParens:!1}),m=null==d?void 0:d.children[0],S=n(m,eU)?m.lexeme:void 0;(!S||e1.isExist(S))&&(p=!1)}}}this.hasAstValue=c>0&&l,this.isFunctionLikeMacro=u,this.aliasesNonBuiltinIdent=c>0&&p},t._collectIdentifierRefs=function(e,r,i){if(n(e,em)){var a=e.children[0];if(n(a,eU)){var o=a.lexeme;-1===r.indexOf(o)&&-1===i.indexOf(o)&&i.push(o)}return}var s=e.children;if(s)for(var c=0,l=s.length;c<l;c++){var u=s[c];n(u,tc)&&t._collectIdentifierRefs(u,r,i)}},t}(tc),S.MacroCallSymbol=eL,eL=u([ts(eH.macro_call_symbol)],eL),eR=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.referenceSymbolNames=[],t.macroName="",t.hasAstValue=!1,t.isFunctionLikeMacro=!1,t.aliasesNonBuiltinIdent=!1,t}a(t,e);var r=t.prototype;return r.init=function(){this.referenceSymbolNames=[],this.macroName="",this.hasAstValue=!1,this.isFunctionLikeMacro=!1,this.aliasesNonBuiltinIdent=!1},r.semanticAnalyze=function(e){var t=this.children[0];this.referenceSymbolNames=t.referenceSymbolNames,this.macroName=t.macroName,this.hasAstValue=t.hasAstValue,this.isFunctionLikeMacro=t.isFunctionLikeMacro,this.aliasesNonBuiltinIdent=t.aliasesNonBuiltinIdent},r.codeGen=function(e){return this.setCache(e.visitMacroCallFunction(this))},t}(tc),S.MacroCallFunction=eR,eR=u([ts(eH.macro_call_function)],eR),eP=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(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 i=[],a=2;n(r[2],eU)&&r[2].type===eF.MACRO_DEFINE_PARAMS&&(this.isFunction=!0,i=ej.parseMacroParamList(r[2].lexeme),a=3),n(r[a],en)&&(this.valueExpression=r[a]);var o=r[1].branch,s=e.macroDefineList,c=s[this.macroName],l=null==c?void 0:c.find(function(e){var r;return!e.valueAst&&(r=e).isFunction===t.isFunction&&r.params.length===i.length&&r.params.every(function(e,t){return e===i[t]})&&e$.sameBranch(e.branch,o)});if(l)l.valueAst=this.valueExpression;else{var u={isFunction:this.isFunction,params:i,valueAst:this.valueExpression,dedupKey:this.macroName+"#ast/"+(this.isFunction?i.join(","):""),branch:o};c?c.push(u):s[this.macroName]=[u]}this.isFunction&&e.popScope()},r.codeGen=function(e){return this.setCache(e.visitMacroDefine(this))},t}(tc),S.MacroDefine=eP,eP=u([ts(eH.macro_define)],eP);var tl=/*#__PURE__*/function(){function e(){this.attributeStructs=[],this.attributeList=[],this.varyingStructs=[],this.varyingList=[],this.mrtStructs=[],this.mrtList=[],this._referencedGlobalMacroASTs=[]}var t=e.prototype;return t.reset=function(e){void 0===e&&(e=!0),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._referencedAttributeList=Object.create(null),this._referencedVaryingList=Object.create(null),this._referencedMRTList=Object.create(null),this._referencedGlobals=Object.create(null),this._referencedGlobalMacroASTs.length=0,e&&(this._structVarMap=Object.create(null))},t.isAttributeStruct=function(e){return -1!==this.attributeStructs.findIndex(function(t){return t.ident.lexeme===e})},t.isVaryingStruct=function(e){return -1!==this.varyingStructs.findIndex(function(t){return t.ident.lexeme===e})},t.isMRTStruct=function(e){return -1!==this.mrtStructs.findIndex(function(t){return t.ident.lexeme===e})},t.getStructRole=function(e){return this.isAttributeStruct(e)?"attribute":this.isVaryingStruct(e)?"varying":this.isMRTStruct(e)?"mrt":void 0},t.registerStructVar=function(e,t){this._structVarMap[e]=t},t.referenceAttribute=function(e){return this._referenceProp("attribute",e.lexeme,this.attributeList,this._referencedAttributeList,e.location)},t.referenceVarying=function(e){return this._referenceProp("varying",e.lexeme,this.varyingList,this._referencedVaryingList,e.location)},t.referenceMRTProp=function(e){return this._referenceProp("mrt",e.lexeme,this.mrtList,this._referencedMRTList,e.location)},t.referenceGlobal=function(t,r){if(!this._referencedGlobals[t]){this._referencedGlobals[t]=[];var n=e._lookupSymbol;n.set(t,r),this._passSymbolTable.getSymbols(n,!0,this._referencedGlobals[t])}},t._referenceProp=function(e,t,r,n,i){if(!n[t]){var a=r.filter(function(e){return e.ident.lexeme===t});if(!a.length)return eB.createGSError("referenced "+e+" not found: "+t,eY.CompilationError,tD._processingPassText,i);n[t]=a}},e.reset=function(){this._singleton||(this._singleton=new e),this._singleton.reset()},s(e,null,[{key:"context",get:function(){return this._singleton}}]),e}();tl._lookupSymbol=new e8("",null);var tu=/*#__PURE__*/function(){function e(){this.array=[]}return e.prototype.dispose=function(){this.array.length=0},e}(),tp=/*#__PURE__*/function(){function e(){}var t=e.prototype;return t.defaultCodeGen=function(t){var r=e._tmpArrayPool,i=r.get();i.dispose();for(var a,o=l(t);!(a=o()).done;){var s=a.value;n(s,eU)?i.array.push(s.lexeme):i.array.push(s.codeGen(this))}return r.return(i),i.array.join(" ")},t.visitPostfixExpression=function(e){var t=e.children,r=t.length,i=tl.context;if(3===r){var a=t[0],o=t[2];if(!n(o,eU))return a.codeGen(this)+"."+o.codeGen(this);var s,c=ej.extractDirectIdentLexeme(a);return(c&&(s=i._structVarMap[c]),s||(s=i.getStructRole(a.type)),s)?("attribute"===s?i.referenceAttribute(o):"varying"===s?i.referenceVarying(o):i.referenceMRTProp(o),o.lexeme):a.codeGen(this)+"."+o.lexeme}if(4===r){var l=t[0],u=t[2],p=l.codeGen(this),h=u.codeGen(this);return"gl_FragData"===p&&this._reportError(l.location,"Please use MRT struct instead of gl_FragData."),p+"["+h+"]"}return this.defaultCodeGen(e.children)},t.visitVariableIdentifier=function(e){for(var t,r=l(e.referenceGlobalSymbolNames);!(t=r()).done;){var n=t.value;tl.context.referenceGlobal(n,e7.Any)}return e.getLexeme(this)},t.visitFunctionCall=function(e){var t=e.children[0];if(n(t.fnSymbol,te)){tl.context.referenceGlobal(t.fnSymbol.ident,e7.FN);var r=t.children[2];if(n(r,eD.FunctionCallParameterList)){for(var i=r.paramNodes,a=t.fnSymbol.astNode.protoType.parameterList,o=tl.context,s=i.filter(function(e,t){var r,n=null==a?void 0:null==(r=a[t])?void 0:r.typeInfo;return!n||!o.getStructRole(n.typeLexeme)}),c="",l=0,u=s.length;l<u;l++){var p=s[l],h=p.codeGen(this);n(p,eD.MacroCallArgBlock)||0===l?c+=h:c+=", "+h}return t.fnSymbol.ident+"("+c+")"}}return this.defaultCodeGen(e.children)},t.visitMacroCallFunction=function(e){var t=e.children[2];if(!n(t,eD.FunctionCallParameterList))return this.defaultCodeGen(e.children);var r,i=t.paramNodes,a=tl.context;r=e.isFunctionLikeMacro||!e.aliasesNonBuiltinIdent?i:i.filter(function(e){if(n(e,eD.AssignmentExpression)){var t=ej.unwrapBareIdentifier(e,{allowParens:!1});if(t&&"string"==typeof t.typeInfo&&a.getStructRole(t.typeInfo))return!1}return!0});for(var o="",s=0,c=r.length;s<c;s++){var l=r[s],u=l.codeGen(this);n(l,eD.MacroCallArgBlock)||0===s?o+=u:o+=", "+u}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,eU)&&(t=r.lexeme)}var i=e.valueExpression?e.valueExpression.codeGen(this):"";return"\n#define "+e.macroName+t+(i?" "+i:"")+"\n"},t.visitSingleDeclaration=function(e){var t=e.typeSpecifier.type;return"string"==typeof t&&tl.context.referenceGlobal(t,e7.STRUCT),this.defaultCodeGen(e.children)},t.visitGlobalVariableDeclaration=function(e){var t=e.children,r=t[0];if(n(r,eD.FullySpecifiedType)&&r.typeSpecifier.isCustom){var i=tl.context;if(i.getStructRole(r.typeSpecifier.lexeme))return"";i.referenceGlobal(r.type,e7.STRUCT)}return"uniform "+this.defaultCodeGen(t)},t.visitDeclaration=function(e){var t=tl.context,r=e.children,i=r[0];if(n(i,eD.InitDeclaratorList)){var a=i.typeInfo.typeLexeme;if(t.isVaryingStruct(a)||t.isMRTStruct(a))return""}return this.defaultCodeGen(r)},t.visitFunctionParameterList=function(e){for(var t=tl.context,r=e.parameterInfoList.filter(function(e){return!e.typeInfo||!t.getStructRole(e.typeInfo.typeLexeme)}),i="",a=0,o=r.length;a<o;a++){var s=r[a].astNode,c=s.codeGen(this);n(s,eD.MacroParamBlock)||0===a?i+=c:i+=", "+c}return i},t.visitFunctionHeader=function(e){var t=e.returnType.typeSpecifier.lexeme;return tl.context.isVaryingStruct(t)?"void "+e.ident.lexeme+"(":this.defaultCodeGen(e.children)},t.visitJumpStatement=function(e){var t=e.children;if(t[0].type===eF.RETURN){var r=t[1];if(n(r,eD.Expression)){var i=ej.unwrapNodeByType(r,eH.variable_identifier);if(tl.context.isVaryingStruct(null==i?void 0:i.typeInfo))return"";var a=ej.unwrapNodeByType(r,eH.function_call);if(tl.context.isVaryingStruct(null==a?void 0:a.type))return""+r.codeGen(this)+";"}}return this.defaultCodeGen(t)},t.visitFunctionIdentifier=function(e){return this.defaultCodeGen(e.children)},t.visitStructSpecifier=function(e){var t=this,r=tl.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&&this._reportError(e.location,"cannot use same struct as Varying and Attribute"),s&&u&&this._reportError(e.location,"cannot use same struct as Varying and MRT"),c&&u&&this._reportError(e.location,"cannot use same struct as Attribute and MRT"),!s&&!c&&!u)return this.defaultCodeGen(e.children);var p=[];p.push.apply(p,[].concat(e.macroExpressions.map(function(e){return{text:n(e,eU)?e.lexeme:e.codeGen(t),index:e.location.start.index}})));for(var h,_=l(e.propList);!(h=_()).done;){var f,d,m,S=h.value,v=S.ident.lexeme;s&&(null==(f=r._referencedVaryingList[v])?void 0:f.indexOf(S))>=0?p.push({text:""+this.getVaryingProp(S)+"\n",index:S.ident.location.start.index}):c&&(null==(d=r._referencedAttributeList[v])?void 0:d.indexOf(S))>=0?p.push({text:""+this.getAttributeProp(S)+"\n",index:S.ident.location.start.index}):u&&(null==(m=r._referencedMRTList[v])?void 0:m.indexOf(S))>=0&&p.push({text:""+this.getMRTProp(S)+"\n",index:S.ident.location.start.index})}return p.sort(function(e,t){return e.index-t.index}).map(function(e){return e.text}).join("")},t.visitFunctionDefinition=function(e){return e.protoType.ident.lexeme==tl.context.stageEntry?"void main() "+e.statements.codeGen(this):this.defaultCodeGen(e.children)},t._reportError=function(e,t){console.error(t)},e}();tp._tmpArrayPool=new r.ReturnableObjectPool(tu,10);var th=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t._globalCodeArray=[],t}a(t,e);var r=t.prototype;return r.reset=function(){this._globalCodeArray.length=0,t._serializedGlobalKey.clear()},r.getOtherGlobal=function(e,t){for(var r,n=l(e.globalPrecisions);!(r=n()).done;){var i=r.value;t.push({text:i.codeGen(this),index:i.location.start.index})}},r.visitShaderProgram=function(e,t,r){tl.reset(),this.reset();var n=e.shaderData;tl.context._passSymbolTable=n.symbolTable;var i=n.getOuterGlobalMacroDeclarations();return this._collectAllStructVars(t,r),{vertex:this._vertexMain(t,n,i),fragment:this._fragmentMain(r,n,i)}},r._collectAllStructVars=function(e,r){for(var i,a=this,o=tl.context,s=t._lookupSymbol,c=o._passSymbolTable,u=Object.create(null),p=function(e,t,r){s.set(e,e7.FN);for(var n,i=c.getSymbols(s,!0,[]),a=l(i);!(n=a()).done;){var o,p,h=n.value.astNode.protoType,_=null==(o=h.parameterList)?void 0:o[0];_&&"string"==typeof(null==(p=_.typeInfo)?void 0:p.type)&&(u[_.typeInfo.typeLexeme]=t),"string"==typeof h.returnType.type&&(u[h.returnType.type]=r)}return i},h=p(e,"attribute","varying").concat(p(r,"varying","mrt")),_=function(e,t){if(e){var r=u[e];r&&o.registerStructVar(t,r)}},f=function(e){for(var t,r=l(e.children);!(t=r()).done;){var i=t.value;if(n(i,eD.InitDeclaratorList)){var s,c=null==(s=i.typeInfo)?void 0:s.typeLexeme;c&&u[c]&&a._extractLocalVarNames(i,o,u[c])}else n(i,tc)&&f(i)}},d=l(h);!(i=d()).done;){var m=i.value,S=m.astNode.protoType;if(S.parameterList)for(var v,E=l(S.parameterList);!(v=E()).done;){var C,g=v.value;g.ident&&"string"==typeof(null==(C=g.typeInfo)?void 0:C.type)&&_(g.typeInfo.typeLexeme,g.ident.lexeme)}f(m.astNode.statements)}c.forEach(function(e){var t;e.type===e7.VAR&&_(null==(t=e.dataType)?void 0:t.typeLexeme,e.ident)})},r._vertexMain=function(e,r,n){var i=this,a=tl.context;a.stage=eZ.VERTEX,a.stageEntry=e;var o=t._lookupSymbol,s=r.symbolTable;o.set(e,e7.FN);var c=s.getSymbols(o,!0,[]);if(!c.length)throw"no entry function found: "+e;var u=a.attributeStructs,p=a.attributeList,h=a.varyingStructs,_=a.varyingList;c.forEach(function(e){var t=e.astNode,r=t.protoType.returnType;if("string"==typeof r.type){o.set(r.type,e7.STRUCT);var n=s.getSymbols(o,!0,[]);if(n.length)for(var a=0;a<n.length;a++){var c=n[a].astNode;h.push(c);for(var f,d=l(c.propList);!(f=d()).done;){var m=f.value;_.push(m)}}else i._reportError(r.location,'invalid varying struct: "'+r.type+'".')}else r.type!==eF.VOID&&i._reportError(r.location,"vertex main entry can only return struct or void.");var S=t.protoType.parameterList,v=null==S?void 0:S[0];if(v){var E=v.typeInfo.type;if("string"==typeof E){o.set(E,e7.STRUCT);var C=s.getSymbols(o,!0,[]);if(C.length)for(var g=0;g<C.length;g++){var y=C[g].astNode;u.push(y);for(var A,x=l(y.propList);!(A=x()).done;){var b=A.value;p.push(b)}}else i._reportError(v.astNode.location,'invalid attribute struct: "'+E+'".')}}}),this._preRegisterGlobalMacroRefs(n);var f=this._globalCodeArray;tl.context.referenceGlobal(e,e7.FN),this._getGlobalSymbol(f),this._getCustomStruct(a.attributeStructs,f),this._getCustomStruct(a.varyingStructs,f),this._getGlobalMacroDeclarations(n,f),this.getOtherGlobal(r,f);var d=f.sort(function(e,t){return e.index-t.index}).map(function(e){return e.text}).join("\n");return tl.context.reset(!1),this.reset(),d},r._fragmentMain=function(e,r,n){var i=this,a=tl.context;a.stage=eZ.FRAGMENT,a.stageEntry=e;var o=t._lookupSymbol,s=r.symbolTable;o.set(e,e7.FN);var c=s.getSymbols(o,!0,[]);if(!(null==c?void 0:c.length))throw"no entry function found: "+e;c.forEach(function(e){var t=e.astNode,r=t.returnStatement;r&&(r.isFragReturnStatement=!0);var n=t.protoType.returnType,c=n.type,u=n.location;if("string"==typeof c){o.set(c,e7.STRUCT);var p=s.getSymbols(o,!0,[]);if(p.length)for(var h=0;h<p.length;h++){var _=p[h].astNode;a.mrtStructs.push(_);for(var f,d=l(_.propList);!(f=d()).done;){var m=f.value;a.mrtList.push(m)}}else i._reportError(u,"invalid mrt struct: "+c)}else c!==eF.VOID&&c!==eF.VEC4&&i._reportError(u,"fragment main entry can only return struct or vec4.")}),this._preRegisterGlobalMacroRefs(n);var u=this._globalCodeArray;tl.context.referenceGlobal(e,e7.FN),this._getGlobalSymbol(u),this._getCustomStruct(a.varyingStructs,u),this._getCustomStruct(a.mrtStructs,u),this._getGlobalMacroDeclarations(n,u),this.getOtherGlobal(r,u);var p=u.sort(function(e,t){return e.index-t.index}).map(function(e){return e.text}).join("\n");return a.reset(),this.reset(),p},r._extractLocalVarNames=function(e,t,r){var i=e.children;if(1===i.length){var a=i[0].children;a.length>=2&&n(a[1],eU)&&t.registerStructVar(a[1].lexeme,r)}else if(i.length>=3){var o=i[0];n(o,eD.InitDeclaratorList)&&this._extractLocalVarNames(o,t,r),n(i[2],eU)&&t.registerStructVar(i[2].lexeme,r)}},r._preRegisterGlobalMacroRefs=function(e){for(var t,r=l(e);!(t=r()).done;){var n=t.value;this._walkMacroDefineTokens(n.children)}},r._walkMacroDefineTokens=function(e){for(var t,r=l(e);!(t=r()).done;){var i=t.value;n(i,eD.MacroDefine)?i.valueExpression&&i.valueExpression.codeGen(this):n(i,tc)&&this._walkMacroDefineTokens(i.children)}},r._getGlobalSymbol=function(e){var r=tl.context._referencedGlobals,n=Object.keys(r).length;if(0!==n){for(var i in r)if(!t._serializedGlobalKey.has(i)){t._serializedGlobalKey.add(i);for(var a=r[i],o=0,s=a.length;o<s;o++){var c=a[o],l=c.astNode.codeGen(this);if(l){var u=l+(c.type===e7.VAR?";":"");c.isInMacroBranch||e.push({text:u,index:c.astNode.location.start.index})}}}Object.keys(r).length!==n&&this._getGlobalSymbol(e)}},r._getCustomStruct=function(e,t){for(var r,n=l(e);!(r=n()).done;){var i=r.value,a=i.codeGen(this);i.isInMacroBranch||t.push({text:a,index:i.location.start.index})}},r._getGlobalMacroDeclarations=function(e,t){var r=this,i=tl.context,a=i._referencedGlobals,o=i._referencedGlobalMacroASTs;o.length=0;for(var s,c=l(Object.values(a));!(s=c()).done;)for(var u,p=s.value,h=l(p);!(u=h()).done;){var _=u.value;_.isInMacroBranch&&o.push(_.astNode)}for(var f,d=l(e);!(f=d()).done;){var m=f.value,S=void 0,v=m.children[0];if(n(v,eD.GlobalMacroIfStatement)){var E=[];E.push.apply(E,[].concat(m.macroExpressions.map(function(e){return{text:n(e,eU)?e.lexeme:e.codeGen(r),index:e.location.start.index}}))),this._visitGlobalMacroIfStatement(v,E),S=E.sort(function(e,t){return e.index-t.index}).map(function(e){return e.text}).join("\n")}else S=n(v,eU)&&v.type===eF.MACRO_DEFINE_EXPRESSION?v.lexeme:m.codeGen(this);t.push({text:S,index:m.location.start.index})}},r._visitGlobalMacroIfStatement=function(e,t){for(var r=e.children,i=0;i<r.length;i++){var a=r[i];if(n(a,eD.PrecisionSpecifier))t.push({text:a.codeGen(this),index:a.location.start.index});else if(n(a,eD.FunctionDefinition))-1!==tl.context._referencedGlobalMacroASTs.indexOf(a)&&t.push({text:a.getCache(),index:a.location.start.index});else if(n(a,eD.StructSpecifier)){var o,s,c,l,u=tl.context,p=u.stage;(-1!==tl.context._referencedGlobalMacroASTs.indexOf(a)||(p===eZ.VERTEX?u.isAttributeStruct(null==(o=a.ident)?void 0:o.lexeme)||u.isVaryingStruct(null==(s=a.ident)?void 0:s.lexeme):u.isVaryingStruct(null==(c=a.ident)?void 0:c.lexeme)||u.isMRTStruct(null==(l=a.ident)?void 0:l.lexeme)))&&t.push({text:a.getCache(),index:a.location.start.index})}else if(n(a,eD.VariableDeclarationList))for(var h=a.variableDeclarations,_=0;_<h.length;_++){var f=h[_];-1!==tl.context._referencedGlobalMacroASTs.indexOf(f)&&t.push({text:f.getCache()+";",index:f.location.start.index})}n(a,tc)&&this._visitGlobalMacroIfStatement(a,t)}},t}(tp);th._lookupSymbol=new e8("",null),th._serializedGlobalKey=new Set;var t_=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(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 null},r.visitPostfixExpression=function(t){var r=t.children,i=r[0],a=tl.context;if(n(i,eD.PostfixExpression)&&a.isMRTStruct(i.type)){var o=r[2],s=a.mrtList.find(function(e){return e.ident.lexeme===o.lexeme});return s?"gl_FragData["+s.mrtIndex+"]":(this._reportError(o.location,"not found mrt property: "+o.lexeme),"")}return e.prototype.visitPostfixExpression.call(this,t)},r.visitJumpStatement=function(t){return t.isFragReturnStatement?tl.context.mrtStructs.length?"":"gl_FragColor = "+t.children[1].codeGen(this)+";":e.prototype.visitJumpStatement.call(this,t)},t.getVisitor=function(){return this._singleton||(this._singleton=new t),this._singleton},t}(th),tf="GS_glFragColor",td=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t._otherCodeArray=[],t._fragColorVariableRegistered=!1,t}a(t,e);var r=t.prototype;return r.reset=function(){e.prototype.reset.call(this),this._otherCodeArray.length=0,this._fragColorVariableRegistered=!1},r.getOtherGlobal=function(t,r){e.prototype.getOtherGlobal.call(this,t,r);for(var n=0,i=this._otherCodeArray.length;n<i;n++)r.push(this._otherCodeArray[n])},r.getAttributeProp=function(e){return"in "+e.typeInfo.typeLexeme+" "+e.ident.lexeme+";"},r.getVaryingProp=function(e){return(tl.context.stage===eZ.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(e){var t=e.children;if(1!==t[0].children.length)return this.defaultCodeGen(t);var r=e.lexeme;switch(e.ident){case"texture2D":case"textureCube":r="texture";break;case"texture2DProj":r="textureProj";break;case"texture2DLodEXT":case"textureCubeLodEXT":r="textureLod";break;case"texture2DGradEXT":case"textureCubeGradEXT":r="textureGrad";break;case"texture2DProjLodEXT":r="textureProjLod";break;case"texture2DProjGradEXT":r="textureProjGrad";break;case"gl_FragDepthEXT":r="gl_FragDepth"}return r},r.visitVariableIdentifier=function(t){var r=tl.context;if(r.stage===eZ.FRAGMENT&&"gl_FragColor"===t.getLexeme(this)){if(r.mrtStructs.length){this._reportError(t.location,"gl_FragColor cannot be used with MRT (Multiple Render Targets).");return}return this._registerFragColorVariable(),tf}return e.prototype.visitVariableIdentifier.call(this,t)},r.visitJumpStatement=function(t){return t.isFragReturnStatement?tl.context.mrtStructs.length?"":(this._registerFragColorVariable(),tf+" = "+t.children[1].codeGen(this)+";"):e.prototype.visitJumpStatement.call(this,t)},r._registerFragColorVariable=function(){this._fragColorVariableRegistered||(this._otherCodeArray.push({text:"out vec4 "+tf+";",index:0}),this._fragColorVariableRegistered=!0)},t.getVisitor=function(){return this._singleton||(this._singleton=new t),this._singleton},t}(th),tm={Text:0,IfDef:1,IfNdef:2,IfCmp:3,IfExpr:4,Else:5,Endif:6,Define:7,DefineVal:8,DefineFunc:9,Undef:10},tS=/*#__PURE__*/function(){function e(){}return e.parse=function(t){for(var r=[],n=t.length,i=0,a=[];i<n;){var o=e._findDirectiveStart(t,i,n);if(-1===o){e._pushText(r,t,i,n);break}o>i&&e._pushText(r,t,i,o);var s=t.indexOf("\n",o);-1===s&&(s=n);var c=t.substring(o,s);i=s<n?s+1:n;var l=e._DIRECTIVE_RE.exec(c);if(!l){var u=r.length>0?r[r.length-1]:null,p=s<n?c+"\n":c;u&&u[0]===tm.Text?u[1]+=p:r.push([tm.Text,p]);continue}var h=l[1],_=l[2].trim();switch(h){case"ifdef":var f=r.length;r.push([tm.IfDef,_,-1]),a.push([f]);break;case"ifndef":var d=r.length;r.push([tm.IfNdef,_,-1]),a.push([d]);break;case"if":var m=e._parseCondition(_),S=r.length;e._pushConditionInstruction(r,m),a.push([S]);break;case"elif":var v=a[a.length-1],E=v[v.length-1],C=r.length;r.push([tm.Else,-1]),v.push(C),e._backfillJump(r[E],r.length);var g=e._parseCondition(_),y=r.length;e._pushConditionInstruction(r,g),v.push(y);break;case"else":var A=a[a.length-1],x=A[A.length-1],b=r.length;r.push([tm.Else,-1]),A.push(b),e._backfillJump(r[x],r.length);break;case"endif":var T=r.length;r.push([tm.Endif]);var O=a.pop();if(O)for(var I=T+1,L=0;L<O.length;L++){var R=r[O[L]];R[0]===tm.Else?R[1]=I:e._backfillJump(R,I,!0)}break;case"define":var P=e._FUNC_MACRO_RE.exec(_);if(P){var M=P[2].split(",").map(function(e){return e.trim()}).filter(function(e){return e.length>0});r.push([tm.DefineFunc,P[1],M,e._stripLineComment(P[3].trim())])}else{var N=_.indexOf(" ");-1===N?r.push([tm.Define,_]):r.push([tm.DefineVal,_.substring(0,N),e._stripLineComment(_.substring(N+1).trim())])}break;case"undef":r.push([tm.Undef,_])}}return r},e._pushConditionInstruction=function(e,t){"def"===t.t?e.push([tm.IfDef,t.m,-1]):"ndef"===t.t?e.push([tm.IfNdef,t.m,-1]):"cmp"===t.t?e.push([tm.IfCmp,t.m,t.op,t.v,-1]):e.push([tm.IfExpr,t,-1])},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))return n;var o=e.indexOf("\n",n);if(-1===o)break;n=o+1}return -1},e._pushText=function(e,t,r,n){if(!(r>=n)){var i=e.length>0?e[e.length-1]:null;i&&i[0]===tm.Text?i[1]+=t.substring(r,n):e.push([tm.Text,t.substring(r,n)])}},e._backfillJump=function(e,t,r){void 0===r&&(r=!1);var n=e[0];n===tm.IfDef||n===tm.IfNdef?r&&-1!==e[2]||(e[2]=t):n===tm.IfCmp?r&&-1!==e[4]||(e[4]=t):n!==tm.IfExpr||r&&-1!==e[2]||(e[2]=t)},e._stripLineComment=function(e){var t=e.indexOf("//");return t>=0?e.substring(0,t).trimEnd():e},e._parseCondition=function(t){var r={s:t.trim(),i:0};return e._parseOr(r)},e._skipWs=function(e){for(;e.i<e.s.length&&(32===e.s.charCodeAt(e.i)||9===e.s.charCodeAt(e.i));)e.i++},e._parseOr=function(t){var r=e._parseAnd(t);for(e._skipWs(t);t.i<t.s.length-1&&124===t.s.charCodeAt(t.i)&&124===t.s.charCodeAt(t.i+1);)t.i+=2,e._skipWs(t),r={t:"or",l:r,r:e._parseAnd(t)},e._skipWs(t);return r},e._parseAnd=function(t){var r=e._parseUnary(t);for(e._skipWs(t);t.i<t.s.length-1&&38===t.s.charCodeAt(t.i)&&38===t.s.charCodeAt(t.i+1);)t.i+=2,e._skipWs(t),r={t:"and",l:r,r:e._parseUnary(t)},e._skipWs(t);return r},e._parseUnary=function(t){return(e._skipWs(t),33===t.s.charCodeAt(t.i))?(t.i++,e._skipWs(t),{t:"not",c:e._parsePrimary(t)}):e._parsePrimary(t)},e._parsePrimary=function(t){e._skipWs(t);var r=t.s;if(40===r.charCodeAt(t.i)){t.i++,e._skipWs(t);var n=e._parseOr(t);return e._skipWs(t),41===r.charCodeAt(t.i)&&t.i++,n}if("defined"===r.substring(t.i,t.i+7)){t.i+=7,e._skipWs(t);var i=40===r.charCodeAt(t.i);i&&t.i++,e._skipWs(t);var a=e._scanIdentifier(t);return e._skipWs(t),i&&41===r.charCodeAt(t.i)&&t.i++,{t:"def",m:a}}if(t.i<r.length&&e._isDigit(r.charCodeAt(t.i))){var o=e._scanNumber(t);e._skipWs(t);var s=e._scanOp(t);return s?(e._skipWs(t),{t:"bool",v:e._evalNumOp(o,s,e._scanNumber(t))}):{t:"bool",v:0!==o}}var c=e._scanIdentifier(t);if(!c)return{t:"bool",v:!1};e._skipWs(t);var l=e._scanOp(t);return l?(e._skipWs(t),{t:"cmp",m:c,op:l,v:e._scanNumber(t)}):{t:"def",m:c}},e._isDigit=function(e){return e>=48&&e<=57},e._isAlnum=function(e){return e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||95===e},e._scanIdentifier=function(t){for(var r=t.i;t.i<t.s.length&&e._isAlnum(t.s.charCodeAt(t.i));)t.i++;return t.s.substring(r,t.i)},e._scanNumber=function(t){var r=t.i;for(45===t.s.charCodeAt(t.i)&&t.i++;t.i<t.s.length&&(e._isDigit(t.s.charCodeAt(t.i))||46===t.s.charCodeAt(t.i));)t.i++;return Number(t.s.substring(r,t.i))||0},e._scanOp=function(e){var t=e.s.charCodeAt(e.i),r=e.i+1<e.s.length?e.s.charCodeAt(e.i+1):0;return 61===t&&61===r?(e.i+=2,"=="):33===t&&61===r?(e.i+=2,"!="):62===t&&61===r?(e.i+=2,">="):60===t&&61===r?(e.i+=2,"<="):62===t?(e.i++,">"):60===t?(e.i++,"<"):""},e._evalNumOp=function(e,t,r){switch(t){case"==":return e===r;case"!=":return e!==r;case">":return e>r;case"<":return e<r;case">=":return e>=r;case"<=":return e<=r;default:return!1}},e}();tS._DIRECTIVE_RE=/^[ \t]*#[ \t]*(if|ifdef|ifndef|elif|else|endif|define|undef)\b(.*)/,tS._FUNC_MACRO_RE=/^(\w+)\(([^)]*)\)\s*(.*)/;var tv=function e(t,r){this.goal=t,this.derivation=r,this.id=e._id++,e.pool.set(this.id,this)};tv._id=0,tv.pool=new Map;var tE=/*#__PURE__*/function(){function e(t,r,n){this._needReInfer=!0,this.production=t,this.position=r,this.lookaheadSet=new Set;for(var i,a=l(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=l(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]!==eG.EPSILON)return!1;return!0},t.advance=function(){return new e(this.production,this.position+1,this.lookaheadSet)},s(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}();tE._id=0;var tC=/*#__PURE__*/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=l(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=l(r);!(a=o()).done;){var s=a.value;i.lookaheadSet.has(s)||(i.lookaheadSet.add(s),i.needReInfer=!0)}return i}var c=new tE(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=l(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(";")},s(e,[{key:"items",get:function(){return this._items}},{key:"needReInfer",get:function(){for(var e,t=l(this.cores);!(e=t()).done;)if(e.value.needReInfer)return!0;return!1}}]),e}();tC.closureMap=new Map,tC.pool=new Map,tC._id=0;var tg=/*#__PURE__*/function(){function e(){}return e.isTerminal=function(e){return e<eH.START},e.toString=function(e){if(this.isTerminal(e)){var t;return null!=(t=eG[e])?t:eF[e]}return eH[e]},e.createProductionWithOptions=function(t,r,n){for(var i,a=null!=n?n:eD.TrivialNode.pool,o=[],s=l(r);!(i=s()).done;)!function(){var r=i.value,s=!n&&1===r.length&&!e.isTerminal(r[0]);o.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]){if(s)e.semanticStack.push(r[0]);else{var i=r[0].location.start,o=r[r.length-1].location.end,c=tD.createRange(i,o);eD.get(a,e,c,r)}}}])}();return o},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=l(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}(),ty=((eM={})[eM.Shift=0]="Shift",eM[eM.Reduce=1]="Reduce",eM[eM.Accept=2]="Accept",eM),tA=/*#__PURE__*/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 t=e.prototype;return t.generate=function(){this.computeFirstSet(),this.buildStateTable()},t.buildStateTable=function(){var e=[new tE(this.grammar.productions[0],0,[eG.EOF])],t=tC.create(e);this._extendState(t)},t._extendState=function(e){if(e.needReInfer){this._closure(e);for(var t,r=this._inferNextState(e),n=l(r);!(t=n()).done;){var i=t.value;this._extendState(i)}}},t._closure=function(e){for(var t,r=l(e.cores);!(t=r()).done;){var n=t.value;n.canReduce()||this._extendStateItem(e,n)}return e.closured=!0,e},t._extendStateItem=function(e,t){if(!tg.isTerminal(t.curSymbol)){var r=this.grammar.getProductionList(t.curSymbol);if(t.nextSymbol){for(var n=new Set,i=!1,a=1,o=t.symbolByOffset(1);o;o=t.symbolByOffset(++a)){if(tg.isTerminal(o)){n.add(o),i=!0;break}s=this.firstSetMap.get(o);for(var s,c,u=l(s);!(c=u()).done;){var p=c.value;n.add(p)}if(!s.has(eG.EPSILON))break}if(!i&&(null==s?void 0:s.has(eG.EPSILON)))for(var h,_=l(t.lookaheadSet);!(h=_()).done;){var f=h.value;n.add(f)}for(var d,m=l(r);!(d=m()).done;){var S=d.value,v=e.createStateItem(S,0);e.items.has(v)&&tg.isSubSet(n,v.lookaheadSet)||(e.items.add(v),v.addLookahead(n),this._extendStateItem(e,v))}}else for(var E,C=l(r);!(E=C()).done;){var g=E.value,y=e.createStateItem(g,0);e.items.has(y)&&tg.isSubSet(t.lookaheadSet,y.lookaheadSet)||(e.items.add(y),y.addLookahead(t.lookaheadSet),this._extendStateItem(e,y))}}},t._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=l(e.items);!(o=s()).done;){var c=o.value;if(c.canReduce()){var u=void 0;u=c.production.goal!==eH.START?{action:ty.Reduce,target:c.production.id}:{action:ty.Accept};for(var p,h=l(c.lookaheadSet);!(p=h()).done;){var _=p.value;this._addAction(r,_,u)}}else{var f=c.advance();tg.addMapSetItem(t,c.curSymbol,f)}c.needReInfer=!1}for(var d,m=new Set,S=l(t.entries());!(d=S()).done;){var v=d.value,E=v[0],C=v[1],g=tC.create(Array.from(C));tg.isTerminal(E)?this._addAction(r,E,{action:ty.Shift,target:g.id}):n.set(E,g.id),m.add(g)}return m},t._addAction=function(t,r,n){var i=t.get(r);i&&!tg.isActionEqual(i,n)&&e._isKnownShiftPreferred(r,i,n)&&i.action===ty.Shift&&n.action===ty.Reduce||t.set(r,n)},t.computeFirstSet=function(){for(var e,t=l(this.grammar.productions.slice(1));!(e=t()).done;){var r=e.value;this._computeFirstSetForNT(r.goal)}},t._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(eG.EPSILON);for(var c,u=l(o);!(c=u()).done;){for(var p=c.value,h=0;h<p.derivation.length;h++){var _=p.derivation[h];if(tg.isTerminal(_)){s.add(_);break}for(var f,d=this._computeFirstSetForNT(_),m=l(d);!(f=m()).done;){var S=f.value;S!==eG.EPSILON&&s.add(S)}if(!this.grammar.isNullableNT(_))break}h===p.derivation.length&&s.add(eG.EPSILON)}return this._firstSetNTStack.pop(),s},e._isKnownShiftPreferred=function(e,t,r){if(e===eF.ELSE)return!0;if(e!==eG.LEFT_PAREN)return!1;var n=t.action===ty.Reduce?t:r.action===ty.Reduce?r:null;if(!n)return!1;var i=tv.pool.get(n.target);return!!i&&i.goal===eH.type_specifier_nonarray&&1===i.derivation.length&&i.derivation[0]===eH.macro_call_symbol},e}(),tx=/*#__PURE__*/function(){function e(e,t){this.startSymbol=e,t.unshift(new tv(eH.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]===eG.EPSILON})},t.getProductionByID=function(e){return tv.pool.get(e)},e.create=function(t,r){return new e(t,r.map(function(e){return new tv(e[0],e.slice(1))}))},e}(),tb=[].concat(tg.createProductionWithOptions(eH.gs_shader_program,[[eH.global_declaration],[eH.gs_shader_program,eH.global_declaration]],eD.GLShaderProgram.pool),tg.createProductionWithOptions(eH.global_declaration,[[eH.precision_specifier],[eH.variable_declaration_statement],[eH.struct_specifier],[eH.function_definition],[eH.global_macro_if_statement],[eH.macro_undef],[eH.macro_define],[eF.MACRO_DEFINE_EXPRESSION]],eD.GlobalDeclaration.pool),tg.createProductionWithOptions(eH.macro_define,[[eF.MACRO_DEFINE,eG.ID,eH.expression,eF.MACRO_DEFINE_END],[eF.MACRO_DEFINE,eG.ID,eF.MACRO_DEFINE_PARAMS,eH.expression,eF.MACRO_DEFINE_END]],eD.MacroDefine.pool),tg.createProductionWithOptions(eH.macro_call_symbol,[[eF.MACRO_CALL]],eD.MacroCallSymbol.pool),tg.createProductionWithOptions(eH.macro_call_function,[[eH.macro_call_symbol,eG.LEFT_PAREN,eG.RIGHT_PAREN],[eH.macro_call_symbol,eG.LEFT_PAREN,eH.function_call_parameter_list,eG.RIGHT_PAREN]],eD.MacroCallFunction.pool),tg.createProductionWithOptions(eH.macro_undef,[[eF.MACRO_UNDEF,eG.ID],[eF.MACRO_UNDEF,eF.MACRO_CALL]],eD.MacroUndef.pool),tg.createProductionWithOptions(eH.macro_push_context,[[eF.MACRO_IF,eF.MACRO_CONDITIONAL_EXPRESSION],[eF.MACRO_IFDEF,eG.ID],[eF.MACRO_IFNDEF,eG.ID],[eF.MACRO_IFDEF,eH.macro_call_symbol],[eF.MACRO_IFNDEF,eH.macro_call_symbol]],eD.MacroPushContext.pool),tg.createProductionWithOptions(eH.macro_pop_context,[[eF.MACRO_ENDIF]],eD.MacroPopContext.pool),tg.createProductionWithOptions(eH.macro_elif_expression,[[eF.MACRO_ELIF,eF.MACRO_CONDITIONAL_EXPRESSION]],eD.MacroElifExpression.pool),tg.createProductionWithOptions(eH.macro_else_expression,[[eF.MACRO_ELSE]],eD.MacroElseExpression.pool),tg.createProductionWithOptions(eH.global_macro_declaration,[[eH.global_declaration],[eH.global_macro_declaration,eH.global_declaration]],eD.GlobalMacroDeclaration.pool),tg.createProductionWithOptions(eH.global_macro_if_statement,[[eH.macro_push_context,eH.global_macro_declaration,eH.global_macro_branch],[eH.macro_push_context,eH.global_macro_branch]],eD.GlobalMacroIfStatement.pool),tg.createProductionWithOptions(eH.global_macro_branch,[[eH.macro_pop_context],[eH.macro_elif_expression,eH.global_macro_declaration,eH.global_macro_branch],[eH.macro_else_expression,eH.global_macro_declaration,eH.macro_pop_context],[eH.macro_elif_expression,eH.global_macro_branch],[eH.macro_else_expression,eH.macro_pop_context]],eD.GlobalMacroBranch.pool),tg.createProductionWithOptions(eH.variable_declaration,[[eH.fully_specified_type,eG.ID],[eH.fully_specified_type,eG.ID,eH.array_specifier],[eH.fully_specified_type,eG.ID,eG.EQUAL,eH.initializer]],eD.VariableDeclaration.pool),tg.createProductionWithOptions(eH.variable_declaration_list,[[eH.variable_declaration],[eH.variable_declaration_list,eG.COMMA,eG.ID],[eH.variable_declaration_list,eG.COMMA,eG.ID,eH.array_specifier]],eD.VariableDeclarationList.pool),tg.createProductionWithOptions(eH.variable_declaration_statement,[[eH.variable_declaration_list,eG.SEMICOLON]]),tg.createProductionWithOptions(eH.ext_builtin_type_specifier_nonarray,[[eF.VOID],[eF.FLOAT],[eF.BOOL],[eF.INT],[eF.UINT],[eF.VEC2],[eF.VEC3],[eF.VEC4],[eF.BVEC2],[eF.BVEC3],[eF.BVEC4],[eF.IVEC2],[eF.IVEC3],[eF.IVEC4],[eF.UVEC2],[eF.UVEC3],[eF.UVEC4],[eF.MAT2],[eF.MAT3],[eF.MAT4],[eF.MAT2X3],[eF.MAT2X4],[eF.MAT3X2],[eF.MAT3X4],[eF.MAT4X2],[eF.MAT4X3],[eF.SAMPLER2D],[eF.SAMPLER3D],[eF.SAMPLER_CUBE],[eF.SAMPLER2D_SHADOW],[eF.SAMPLER_CUBE_SHADOW],[eF.SAMPLER2D_ARRAY],[eF.SAMPLER2D_ARRAY_SHADOW],[eF.I_SAMPLER2D],[eF.I_SAMPLER3D],[eF.I_SAMPLER_CUBE],[eF.I_SAMPLER2D_ARRAY],[eF.U_SAMPLER2D],[eF.U_SAMPLER3D],[eF.U_SAMPLER_CUBE],[eF.U_SAMPLER2D_ARRAY]],eD.ExtBuiltinTypeSpecifierNonArray.pool),tg.createProductionWithOptions(eH.type_specifier_nonarray,[[eG.ID],[eH.ext_builtin_type_specifier_nonarray],[eH.macro_call_symbol]],eD.TypeSpecifierNonArray.pool),tg.createProductionWithOptions(eH.fully_specified_type,[[eH.type_specifier],[eH.type_qualifier,eH.type_specifier]],eD.FullySpecifiedType.pool),tg.createProductionWithOptions(eH.type_specifier,[[eH.type_specifier_nonarray],[eH.ext_builtin_type_specifier_nonarray,eH.array_specifier]],eD.TypeSpecifier.pool),tg.createProductionWithOptions(eH.type_qualifier,[[eH.single_type_qualifier],[eH.type_qualifier,eH.single_type_qualifier]],eD.TypeQualifier.pool),tg.createProductionWithOptions(eH.single_type_qualifier,[[eH.storage_qualifier],[eH.precision_qualifier],[eH.interpolation_qualifier],[eH.invariant_qualifier],[eF.PRECISE]],eD.SingleTypeQualifier.pool),tg.createProductionWithOptions(eH.storage_qualifier,[[eF.CONST],[eF.IN],[eF.INOUT],[eF.OUT],[eF.CENTROID]]),tg.createProductionWithOptions(eH.interpolation_qualifier,[[eF.SMOOTH],[eF.FLAT]]),tg.createProductionWithOptions(eH.invariant_qualifier,[[eF.INVARIANT]]),tg.createProductionWithOptions(eH.precision_qualifier,[[eF.HIGHP],[eF.MEDIUMP],[eF.LOWP]]),tg.createProductionWithOptions(eH.struct_specifier,[[eF.STRUCT,eG.ID,eG.LEFT_BRACE,eH.struct_declaration_list,eG.RIGHT_BRACE,eG.SEMICOLON],[eF.STRUCT,eG.LEFT_BRACE,eH.struct_declaration_list,eG.RIGHT_BRACE,eG.SEMICOLON]],eD.StructSpecifier.pool),tg.createProductionWithOptions(eH.struct_declaration_list,[[eH.struct_declaration],[eH.struct_declaration_list,eH.struct_declaration]],eD.StructDeclarationList.pool),tg.createProductionWithOptions(eH.struct_declaration,[[eH.type_specifier,eH.struct_declarator_list,eG.SEMICOLON],[eH.type_qualifier,eH.type_specifier,eH.struct_declarator_list,eG.SEMICOLON],[eH.layout_qualifier,eH.type_specifier,eH.struct_declarator,eG.SEMICOLON],[eH.macro_struct_declaration]],eD.StructDeclaration.pool),tg.createProductionWithOptions(eH.macro_struct_declaration,[[eH.macro_push_context,eH.struct_declaration_list,eH.macro_struct_branch],[eH.macro_push_context,eH.macro_struct_branch]],eD.MacroStructDeclaration.pool),tg.createProductionWithOptions(eH.macro_struct_branch,[[eH.macro_pop_context],[eH.macro_elif_expression,eH.struct_declaration_list,eH.macro_struct_branch],[eH.macro_else_expression,eH.struct_declaration_list,eH.macro_pop_context],[eH.macro_elif_expression,eH.macro_struct_branch],[eH.macro_else_expression,eH.macro_pop_context]],eD.MacroStructBranch.pool),tg.createProductionWithOptions(eH.layout_qualifier,[[eF.LAYOUT,eG.LEFT_PAREN,eF.LOCATION,eG.EQUAL,eG.INT_CONSTANT,eG.RIGHT_PAREN]],eD.LayoutQualifier.pool),tg.createProductionWithOptions(eH.struct_declarator_list,[[eH.struct_declarator],[eH.struct_declarator_list,eG.COMMA,eH.struct_declarator]],eD.StructDeclaratorList.pool),tg.createProductionWithOptions(eH.struct_declarator,[[eG.ID],[eG.ID,eH.array_specifier]],eD.StructDeclarator.pool),tg.createProductionWithOptions(eH.array_specifier,[[eG.LEFT_BRACKET,eG.RIGHT_BRACKET],[eG.LEFT_BRACKET,eH.integer_constant_expression,eG.RIGHT_BRACKET]],eD.ArraySpecifier.pool),tg.createProductionWithOptions(eH.integer_constant_expression_operator,[[eG.PLUS],[eG.DASH],[eG.STAR],[eG.SLASH],[eG.PERCENT]],eD.IntegerConstantExpressionOperator.pool),tg.createProductionWithOptions(eH.integer_constant_expression,[[eH.variable_identifier],[eG.INT_CONSTANT],[eH.integer_constant_expression,eH.integer_constant_expression_operator,eG.INT_CONSTANT],[eH.integer_constant_expression,eH.integer_constant_expression_operator,eH.variable_identifier]],eD.IntegerConstantExpression.pool),tg.createProductionWithOptions(eH.conditional_expression,[[eH.logical_or_expression],[eH.logical_or_expression,eG.QUESTION,eH.expression,eG.COLON,eH.assignment_expression]]),tg.createProductionWithOptions(eH.logical_or_expression,[[eH.logical_xor_expression],[eH.logical_or_expression,eG.OR_OP,eH.logical_xor_expression]]),tg.createProductionWithOptions(eH.logical_xor_expression,[[eH.logical_and_expression],[eH.logical_xor_expression,eG.XOR_OP,eH.logical_and_expression]]),tg.createProductionWithOptions(eH.logical_and_expression,[[eH.inclusive_or_expression],[eH.logical_and_expression,eG.AND_OP,eH.inclusive_or_expression]]),tg.createProductionWithOptions(eH.inclusive_or_expression,[[eH.exclusive_or_expression],[eH.inclusive_or_expression,eG.VERTICAL_BAR,eH.exclusive_or_expression]]),tg.createProductionWithOptions(eH.exclusive_or_expression,[[eH.and_expression],[eH.exclusive_or_expression,eG.CARET,eH.and_expression]]),tg.createProductionWithOptions(eH.and_expression,[[eH.equality_expression],[eH.and_expression,eG.AMPERSAND,eH.equality_expression]]),tg.createProductionWithOptions(eH.equality_expression,[[eH.relational_expression],[eH.equality_expression,eG.EQ_OP,eH.relational_expression],[eH.equality_expression,eG.NE_OP,eH.relational_expression]]),tg.createProductionWithOptions(eH.relational_expression,[[eH.shift_expression],[eH.relational_expression,eG.LEFT_ANGLE,eH.shift_expression],[eH.relational_expression,eG.RIGHT_ANGLE,eH.shift_expression],[eH.relational_expression,eG.LE_OP,eH.shift_expression],[eH.relational_expression,eG.GE_OP,eH.shift_expression]]),tg.createProductionWithOptions(eH.shift_expression,[[eH.additive_expression],[eH.shift_expression,eG.LEFT_OP,eH.additive_expression],[eH.shift_expression,eG.RIGHT_OP,eH.additive_expression]]),tg.createProductionWithOptions(eH.additive_expression,[[eH.multiplicative_expression],[eH.additive_expression,eG.PLUS,eH.multiplicative_expression],[eH.additive_expression,eG.DASH,eH.multiplicative_expression]]),tg.createProductionWithOptions(eH.multiplicative_expression,[[eH.unary_expression],[eH.multiplicative_expression,eG.STAR,eH.unary_expression],[eH.multiplicative_expression,eG.SLASH,eH.unary_expression],[eH.multiplicative_expression,eG.PERCENT,eH.unary_expression]]),tg.createProductionWithOptions(eH.unary_expression,[[eH.postfix_expression],[eG.INC_OP,eH.unary_expression],[eG.DEC_OP,eH.unary_expression],[eH.unary_operator,eH.unary_expression]]),tg.createProductionWithOptions(eH.unary_operator,[[eG.PLUS],[eG.DASH],[eG.BANG],[eG.TILDE]]),tg.createProductionWithOptions(eH.postfix_expression,[[eH.primary_expression],[eH.postfix_expression,eG.LEFT_BRACKET,eH.expression,eG.RIGHT_BRACKET],[eH.function_call],[eH.postfix_expression,eG.DOT,eG.ID],[eH.postfix_expression,eG.DOT,eH.function_call],[eH.postfix_expression,eG.INC_OP],[eH.postfix_expression,eG.DEC_OP]],eD.PostfixExpression.pool),tg.createProductionWithOptions(eH.primary_expression,[[eH.variable_identifier],[eG.INT_CONSTANT],[eG.FLOAT_CONSTANT],[eF.True],[eF.False],[eG.LEFT_PAREN,eH.expression,eG.RIGHT_PAREN]],eD.PrimaryExpression.pool),tg.createProductionWithOptions(eH.expression,[[eH.assignment_expression],[eH.expression,eG.COMMA,eH.assignment_expression]],eD.Expression.pool),tg.createProductionWithOptions(eH.assignment_expression,[[eH.conditional_expression],[eH.unary_expression,eH.assignment_operator,eH.assignment_expression]],eD.AssignmentExpression.pool),tg.createProductionWithOptions(eH.assignment_operator,[[eG.EQUAL],[eG.MUL_ASSIGN],[eG.DIV_ASSIGN],[eG.MOD_ASSIGN],[eG.ADD_ASSIGN],[eG.SUB_ASSIGN],[eG.LEFT_ASSIGN],[eG.RIGHT_ASSIGN],[eG.AND_ASSIGN],[eG.XOR_ASSIGN],[eG.OR_ASSIGN]]),tg.createProductionWithOptions(eH.function_call,[[eH.function_call_generic]],eD.FunctionCall.pool),tg.createProductionWithOptions(eH.function_call_generic,[[eH.function_identifier,eG.LEFT_PAREN,eH.function_call_parameter_list,eG.RIGHT_PAREN],[eH.function_identifier,eG.LEFT_PAREN,eG.RIGHT_PAREN],[eH.function_identifier,eF.VOID,eG.RIGHT_PAREN]],eD.FunctionCallGeneric.pool),tg.createProductionWithOptions(eH.function_call_parameter_list,[[eH.assignment_expression],[eH.function_call_parameter_list,eG.COMMA,eH.assignment_expression],[eH.macro_call_arg_block],[eH.function_call_parameter_list,eH.macro_call_arg_block]],eD.FunctionCallParameterList.pool),tg.createProductionWithOptions(eH.macro_call_arg_case_list,[[eH.assignment_expression],[eG.COMMA,eH.assignment_expression],[eH.macro_call_arg_block],[eH.macro_call_arg_case_list,eH.macro_call_arg_block],[eH.macro_call_arg_case_list,eG.COMMA,eH.assignment_expression]],eD.MacroCallArgCaseList.pool),tg.createProductionWithOptions(eH.macro_call_arg_block,[[eH.macro_push_context,eH.macro_call_arg_branch],[eH.macro_push_context,eH.macro_call_arg_case_list,eH.macro_call_arg_branch]],eD.MacroCallArgBlock.pool),tg.createProductionWithOptions(eH.macro_call_arg_branch,[[eH.macro_pop_context],[eH.macro_elif_expression,eH.macro_call_arg_case_list,eH.macro_call_arg_branch],[eH.macro_else_expression,eH.macro_call_arg_case_list,eH.macro_pop_context],[eH.macro_elif_expression,eH.macro_call_arg_branch],[eH.macro_else_expression,eH.macro_pop_context]],eD.MacroCallArgBranch.pool),tg.createProductionWithOptions(eH.function_identifier,[[eH.type_specifier]],eD.FunctionIdentifier.pool),tg.createProductionWithOptions(eH.function_definition,[[eH.function_prototype,eH.compound_statement_no_scope]],eD.FunctionDefinition.pool),tg.createProductionWithOptions(eH.function_prototype,[[eH.function_declarator,eG.RIGHT_PAREN]],eD.FunctionProtoType.pool),tg.createProductionWithOptions(eH.function_declarator,[[eH.function_header],[eH.function_header,eH.function_parameter_list]],eD.FunctionDeclarator.pool),tg.createProductionWithOptions(eH.function_header,[[eH.fully_specified_type,eG.ID,eG.LEFT_PAREN]],eD.FunctionHeader.pool),tg.createProductionWithOptions(eH.function_parameter_list,[[eH.parameter_declaration],[eH.function_parameter_list,eG.COMMA,eH.parameter_declaration],[eH.macro_param_block],[eH.function_parameter_list,eH.macro_param_block]],eD.FunctionParameterList.pool),tg.createProductionWithOptions(eH.macro_param_case_list,[[eH.parameter_declaration],[eG.COMMA,eH.parameter_declaration],[eH.macro_param_block],[eH.macro_param_case_list,eH.macro_param_block],[eH.macro_param_case_list,eG.COMMA,eH.parameter_declaration]],eD.MacroParamCaseList.pool),tg.createProductionWithOptions(eH.macro_param_block,[[eH.macro_push_context,eH.macro_parameter_branch],[eH.macro_push_context,eH.macro_param_case_list,eH.macro_parameter_branch]],eD.MacroParamBlock.pool),tg.createProductionWithOptions(eH.macro_parameter_branch,[[eH.macro_pop_context],[eH.macro_elif_expression,eH.macro_param_case_list,eH.macro_parameter_branch],[eH.macro_else_expression,eH.macro_param_case_list,eH.macro_pop_context],[eH.macro_elif_expression,eH.macro_parameter_branch],[eH.macro_else_expression,eH.macro_pop_context]],eD.MacroParameterBranch.pool),tg.createProductionWithOptions(eH.parameter_declaration,[[eH.type_qualifier,eH.parameter_declarator],[eH.parameter_declarator],[eH.macro_call_symbol],[eH.macro_call_function]],eD.ParameterDeclaration.pool),tg.createProductionWithOptions(eH.parameter_declarator,[[eH.type_specifier,eG.ID],[eH.type_specifier,eG.ID,eH.array_specifier]],eD.ParameterDeclarator.pool),tg.createProductionWithOptions(eH.statement_list,[[eH.statement],[eH.statement_list,eH.statement]],eD.StatementList.pool),tg.createProductionWithOptions(eH.statement,[[eH.compound_statement],[eH.simple_statement]]),tg.createProductionWithOptions(eH.compound_statement_no_scope,[[eG.LEFT_BRACE,eG.RIGHT_BRACE],[eG.LEFT_BRACE,eH.statement_list,eG.RIGHT_BRACE]],eD.CompoundStatementNoScope.pool),tg.createProductionWithOptions(eH.compound_statement,[[eG.LEFT_BRACE,eG.RIGHT_BRACE],[eH.scope_brace,eH.statement_list,eH.scope_end_brace]]),tg.createProductionWithOptions(eH.simple_statement,[[eH.declaration],[eH.expression_statement],[eH.selection_statement],[eH.iteration_statement],[eH.jump_statement],[eH.macro_if_statement],[eH.macro_undef],[eH.macro_define],[eF.MACRO_DEFINE_EXPRESSION]]),tg.createProductionWithOptions(eH.declaration,[[eH.function_prototype,eG.SEMICOLON],[eH.init_declarator_list,eG.SEMICOLON],[eF.PRECISION,eH.precision_qualifier,eH.ext_builtin_type_specifier_nonarray,eG.SEMICOLON],[eH.type_qualifier,eG.ID,eG.SEMICOLON],[eH.type_qualifier,eG.ID,eH.identifier_list,eG.SEMICOLON]],eD.Declaration.pool),tg.createProductionWithOptions(eH.identifier_list,[[eG.COMMA,eG.ID],[eH.identifier_list,eG.COMMA,eG.ID]],eD.IdentifierList.pool),tg.createProductionWithOptions(eH.init_declarator_list,[[eH.single_declaration],[eH.init_declarator_list,eG.COMMA,eG.ID],[eH.init_declarator_list,eG.COMMA,eG.ID,eH.array_specifier],[eH.init_declarator_list,eG.COMMA,eG.ID,eH.array_specifier,eG.EQUAL,eH.initializer],[eH.init_declarator_list,eG.COMMA,eG.ID,eG.EQUAL,eH.initializer]],eD.InitDeclaratorList.pool),tg.createProductionWithOptions(eH.single_declaration,[[eH.fully_specified_type,eG.ID],[eH.fully_specified_type,eG.ID,eH.array_specifier],[eH.fully_specified_type,eG.ID,eH.array_specifier,eG.EQUAL,eH.initializer],[eH.fully_specified_type,eG.ID,eG.EQUAL,eH.initializer],[eH.fully_specified_type,eF.MACRO_CALL],[eH.fully_specified_type,eF.MACRO_CALL,eG.EQUAL,eH.initializer]],eD.SingleDeclaration.pool),tg.createProductionWithOptions(eH.initializer,[[eH.assignment_expression],[eG.LEFT_BRACE,eH.initializer_list,eG.RIGHT_BRACE]]),tg.createProductionWithOptions(eH.initializer_list,[[eH.initializer],[eH.initializer_list,eG.COMMA,eH.initializer]]),tg.createProductionWithOptions(eH.expression_statement,[[eG.SEMICOLON],[eH.expression,eG.SEMICOLON]]),tg.createProductionWithOptions(eH.selection_statement,[[eF.IF,eG.LEFT_PAREN,eH.expression,eG.RIGHT_PAREN,eH.statement],[eF.IF,eG.LEFT_PAREN,eH.expression,eG.RIGHT_PAREN,eH.statement,eF.ELSE,eH.statement]]),tg.createProductionWithOptions(eH.iteration_statement,[[eF.WHILE,eG.LEFT_PAREN,eH.condition,eG.RIGHT_PAREN,eH.statement],[eF.FOR,eG.LEFT_PAREN,eH.for_init_statement,eH.for_rest_statement,eG.RIGHT_PAREN,eH.statement]]),tg.createProductionWithOptions(eH.precision_specifier,[[eF.PRECISION,eH.precision_qualifier,eH.ext_builtin_type_specifier_nonarray,eG.SEMICOLON]],eD.PrecisionSpecifier.pool),tg.createProductionWithOptions(eH.for_init_statement,[[eH.expression_statement],[eH.declaration]]),tg.createProductionWithOptions(eH.condition,[[eH.expression],[eH.fully_specified_type,eG.ID,eG.EQUAL,eH.initializer]]),tg.createProductionWithOptions(eH.for_rest_statement,[[eH.conditionopt,eG.SEMICOLON],[eH.conditionopt,eG.SEMICOLON,eH.expression]]),tg.createProductionWithOptions(eH.conditionopt,[[eG.EPSILON],[eH.condition]]),tg.createProductionWithOptions(eH.jump_statement,[[eF.CONTINUE,eG.SEMICOLON],[eF.BREAK,eG.SEMICOLON],[eF.RETURN,eG.SEMICOLON],[eF.RETURN,eH.expression,eG.SEMICOLON],[eF.DISCARD,eG.SEMICOLON]],eD.JumpStatement.pool),tg.createProductionWithOptions(eH.scope_brace,[[eG.LEFT_BRACE]],eD.ScopeBrace.pool),tg.createProductionWithOptions(eH.scope_end_brace,[[eG.RIGHT_BRACE]],eD.ScopeEndBrace.pool),tg.createProductionWithOptions(eH.variable_identifier,[[eG.ID],[eH.macro_call_symbol],[eH.macro_call_function]],eD.VariableIdentifier.pool),tg.createProductionWithOptions(eH.macro_if_statement,[[eH.macro_push_context,eH.statement_list,eH.macro_branch],[eH.macro_push_context,eH.macro_branch]],eD.MacroIfStatement.pool),tg.createProductionWithOptions(eH.macro_branch,[[eH.macro_pop_context],[eH.macro_elif_expression,eH.statement_list,eH.macro_branch],[eH.macro_else_expression,eH.statement_list,eH.macro_pop_context],[eH.macro_elif_expression,eH.macro_branch],[eH.macro_else_expression,eH.macro_pop_context]],eD.MacroBranch.pool)),tT=function(e){for(var t=0;t<tb.length;t++){var r=tb[t][1];r&&e.addTranslationRule(t,r)}},tO=/*#__PURE__*/function(){function e(e,t,r){this._traceBackStack=[],this.actionTable=e,this.gotoTable=t,this.grammar=r,this.sematicAnalyzer=new ti}return e.prototype.parse=function(e,t){this.sematicAnalyzer.reset(t);var r=this._traceBackStack,i=this.sematicAnalyzer;r.push(0);for(var a=e.next();;){var o=a.value,s=this.stateActionTable.get(o.type);if((null==s?void 0:s.action)===ty.Shift){if(r.push(o,s.target),o.type===eF.MACRO_DEFINE_PARAMS){i.pushScope();for(var c,u=l(ej.parseMacroParamList(o.lexeme));!(c=u()).done;){var p=c.value;i.symbolTableStack.insert(new e8(p,e7.VAR))}}a=e.next()}else{if((null==s?void 0:s.action)===ty.Accept)return null==i.acceptRule||i.acceptRule.call(i,i),i.semanticStack.pop();if((null==s?void 0:s.action)!==ty.Reduce)return eB.createGSError("Unexpected token "+o.lexeme,eY.CompilationError,tD._processingPassText,o.location),null;for(var h=s.target,_=this.grammar.getProductionByID(h),f=i.getTranslationRule(_.id),d=[],m=_.derivation.length-1;m>=0;m--)if(_.derivation[m]!==eG.EPSILON){r.pop();var S=r.pop();if(n(S,eU))d.unshift(S);else{var v=i.semanticStack.pop();d.unshift(v)}}null==f||f.apply(void 0,[].concat([i],d));var E=this.stateGotoTable;r.push(_.goal);var C=null==E?void 0:E.get(_.goal);r.push(C);continue}}},e.create=function(){if(!this._singleton){var t=tx.create(eH.gs_shader_program,tb.map(function(e){return e[0]})),r=new tA(t);r.generate(),this._singleton=new e(r.actionTable,r.gotoTable,t),tT(this._singleton.sematicAnalyzer)}return this._singleton},s(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)}}]),e}(),tI=/*#__PURE__*/function(){function e(){}return e.parse=function(e,t,r,n){var i=this;return e.replace(this._includeReg,function(e,a){return a?i._replace(a,t,r,n):e})},e._replace=function(e,t,r,n){var i,a=r[i="."===e[0]?new URL(e,t).href.substring(15):e];if(!a)return console.error('Shader slice "'+i+'" not founded.'),"";var o=n.get(i);return void 0===o&&(o=this.parse(a,t,r,n),n.set(i,o)),o},e}();function tL(){return(tL=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)}tI._includeReg=/\/\*[\s\S]*?\*\/|^[ \t]*#include +"([\w\d./]+)"/gm;var tR=/*#__PURE__*/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:[],tags:{},renderStates:this.createRenderStates()}},e.createUsePass=function(e){return{name:e,pendingContents:[],isUsePass:!0,tags:{},renderStates:this.createRenderStates()}},e}(),tP=/*#__PURE__*/function(){function e(e,t,r){this.ident=e,this.type=t,this.value=r,this.isInMacroBranch=!1}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}(),tM=/*#__PURE__*/function(e){function r(){var t;return t=e.apply(this,arguments)||this,t.hasPendingContent=!1,t}a(r,e);var n=r.prototype;return n.scanNumber=function(){this.skipCommentsAndSpace();var e=this._currentIndex,t=this._source,n=this._currentIndex;return n=r._scanDigits(t,n),"."===t[n]&&(n=r._scanDigits(t,n+1)),this.advance(n-this._currentIndex),Number(t.substring(e,n))},n.scanColor=function(){this.scanLexeme("(");var e=0,r=0,n=0,i=1;return e=this.scanNumber(),this.skipCommentsAndSpace(),")"!==this.peek(1)&&(this.scanLexeme(","),r=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 t.Color(e,r,n,i)},n.scanToken=function(){for(;;){if(this.skipCommentsAndSpace(),this.isEnd())return;var e=this.getShaderPosition(0);if(eJ.isAlpha(this.getCurCharCode())){var t=this._scanWord(e);if(null!==t)return t;this.hasPendingContent=!0;continue}var n=this.getCurChar(),i=r._symbolLexemeTable[n];if(void 0!==i){this.advance(1);var a=eU.pool.get();return a.set(i,n,e),a}this.advance(1)}},n.createCompileError=function(e,t){return eB.createGSError(e,eY.CompilationError,this.source,null!=t?t:this.getShaderPosition(0))},n._scanWord=function(e){for(;eJ.isAlnum(this.getCurCharCode())&&!this.isEnd();)this.advance(1);var t,n=this.getShaderPosition(0);if(!this._validateWordBoundaries(e.index,n.index))return null;var i=this._source.substring(e.index,n.index),a=null!=(t=r._keywordLexemeTable[i])?t:eG.ID,o=tD.createRange(e,n),s=eU.pool.get();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 eJ.isWhiteSpaceChar(e,!0)||r._isWordSeparatorChar(e)},r._isWordSeparatorChar=function(e){return 123===e||125===e||61===e||59===e||46===e||91===e||40===e||124===e},r._scanDigits=function(e,t){for(var r=t;r<e.length;){var n=e.charCodeAt(r);if(eJ.isDigit(n))r++;else break}return r},r}(eJ);tM._keywordLexemeTable={RenderQueueType:eF.GSRenderQueueType,BlendState:eF.GSBlendState,DepthState:eF.GSDepthState,StencilState:eF.GSStencilState,RasterState:eF.GSRasterState,EditorProperties:eF.GSEditorProperties,EditorMacros:eF.GSEditorMacros,Editor:eF.GSEditor,Tags:eF.GSTags,VertexShader:eF.GSVertexShader,FragmentShader:eF.GSFragmentShader,SubShader:eF.GSSubShader,Pass:eF.GSPass,BlendFactor:eF.GSBlendFactor,BlendOperation:eF.GSBlendOperation,Bool:eF.GSBool,Number:eF.GSNumber,Color:eF.GSColor,CompareFunction:eF.GSCompareFunction,StencilOperation:eF.GSStencilOperation,CullMode:eF.GSCullMode,ColorWriteMask:eF.GSColorWriteMask,UsePass:eF.GSUsePass,true:eF.True,false:eF.False},tM._symbolLexemeTable={"{":eF.LeftBrace,"}":eF.RightBrace,"=":eF.Equal,"|":eF.BitwiseOr};var tN=/*#__PURE__*/function(){function e(){}return e.parse=function(e){this.errors.length=0,this._symbolTableStack.clear(),this._pushScope();var t=this._lexer;t.setSource(e);for(var r=this._parseShader(t),n=r.pendingContents,i=r.renderStates,a=0,o=r.subShaders.length;a<o;a++){var s=r.subShaders[a],c=n.concat(s.pendingContents),l={constantMap:tL({},i.constantMap),variableMap:tL({},i.variableMap)};this._mergeRenderStates(l,s.renderStates);for(var u=0,p=s.passes.length;u<p;u++){var h=s.passes[u],_={constantMap:tL({},l.constantMap),variableMap:tL({},l.variableMap)};if(this._mergeRenderStates(_,h.renderStates),h.renderStates=_,!h.isUsePass){var f=c.concat(h.pendingContents);h.contents=f.map(function(e){return e.content}).join("\n")}}}return r},e._parseShader=function(e){e.scanLexeme("Shader");var t=e.scanPairedChar('"','"',!1,!1),r=tR.createShaderSource(t);e.scanLexeme("{");var n=1;e.skipCommentsAndSpace();for(var i=e.getShaderPosition(0),a=r.pendingContents;;){var o=e.scanToken();switch(o.type){case eF.GSSubShader:this._addPendingContents(i,o.lexeme.length,a);var s=this._parseSubShader();r.subShaders.push(s),i=e.getShaderPosition(0);break;case eF.GSEditorProperties:case eF.GSEditorMacros:case eF.GSEditor:this._addPendingContents(i,o.lexeme.length,a),e.scanPairedChar("{","}",!0,!1),i=e.getShaderPosition(0);break;case eF.LeftBrace:++n;break;case eF.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)}}},e._parseRenderStateDeclarationOrAssignment=function(e,t){var r=this._lexer,n=r.scanToken();if(n.type===eG.ID){r.scanLexeme("{");var i=this._parseRenderStateProperties(t.lexeme),a=new tP(n.lexeme,t.type,i);this._symbolTableStack.insert(a)}else if("="===n.lexeme){var o,s=r.scanToken();if("{"===s.lexeme)o=this._parseRenderStateProperties(t.lexeme);else{r.scanLexeme(";");var c=this._lookupSymbol;c.set(s.lexeme,t.type);var l=this._symbolTableStack.lookup(c);(null==l?void 0:l.value)||this._createCompileError('Invalid "'+t.lexeme+'" variable: '+s.lexeme,s.location),o=l.value}this._mergeRenderStates(e,o)}},e._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]},e._parseVariableDeclaration=function(){var e=this._lexer,t=e.scanToken();e.scanLexeme(";");var r=new tP(t.lexeme,t.type);this._symbolTableStack.insert(r)},e._pushScope=function(){var e=new e9;this._symbolTableStack.pushScope(e)},e._popScope=function(){this._symbolTableStack.popScope()},e._parseRenderStateProperties=function(e){for(var t=this._lexer,r=tR.createRenderStates();"}"!==t.getCurChar();)this._parseRenderStateProperty(e,r),t.skipCommentsAndSpace();return t.advance(1),r},e._createCompileError=function(e,t){this._lexer.createCompileError(e,t)},e._scanEnumConstValue=function(e){var t,r=this._lexer;r.advance(1);var n=r.scanToken(),i=null==(t=this._renderStateConstMap[e])?void 0:t[n.lexeme];return void 0==i&&this._createCompileError("Invalid engine constant: "+e+"."+n.lexeme,n.location),i},e._parseRenderStateProperty=function(e,t){var n,i=this._lexer,a=i.scanToken().lexeme,o=a;if("BlendState"===e&&"BlendColor"!==a&&"AlphaToCoverage"!==a){var s=0,c=i.scanTwoExpectedLexemes("[","=");"["===c?(s=i.scanNumber(),i.scanLexeme("]"),i.scanLexeme("=")):"="!==c&&this._createCompileError("Invalid syntax, expect '[' or '=', but got unexpected token"),o+=s}else i.scanLexeme("=");var l=r.RenderStateElementKey[e+o];void 0===l&&this._createCompileError("Invalid render state property "+a),i.skipCommentsAndSpace();var u=i.getCurCharCode();if(eJ.isDigit(u)||46===u)n=i.scanNumber();else{var p=i.scanToken(),h=p.type;if(h===eF.True)n=!0;else if(h===eF.False)n=!1;else if(h===eF.GSColor)n=i.scanColor();else if("."===i.getCurChar()){if(void 0==(n=this._scanEnumConstValue(p.lexeme)))return;if(i.skipCommentsAndSpace(),"|"===i.getCurChar()){if("ColorWriteMask"!==p.lexeme){this._createCompileError("Bitwise OR '|' is not supported for '"+p.lexeme+"', only bitmask enums like 'ColorWriteMask' support this",p.location);return}for(;"|"===i.getCurChar();){i.advance(1);var _=i.scanToken();if(void 0==_||"."!==i.getCurChar()){this._createCompileError("Invalid syntax after '|', expect 'EnumType.Value'",null==_?void 0:_.location);return}if(_.lexeme!==p.lexeme){this._createCompileError("Cannot mix enum types in bitwise OR: expected '"+p.lexeme+"' but got '"+_.lexeme+"'",_.location);return}var f=this._scanEnumConstValue(_.lexeme);if(void 0==f)return;n|=f,i.skipCommentsAndSpace()}}}else{n=p.lexeme;var d=this._lookupSymbol;d.set(p.lexeme,eG.ID),this._symbolTableStack.lookup(d)||this._createCompileError("Invalid "+e+" variable: "+p.lexeme,p.location)}}i.scanLexeme(";"),"string"==typeof n?t.variableMap[l]=n:t.constantMap[l]=n},e._parseRenderQueueDeclarationOrAssignment=function(e){var t=this._lexer,n=t.scanToken();if(n.type===eG.ID){t.scanLexeme(";");var i=new tP(n.lexeme,eF.GSRenderQueueType);this._symbolTableStack.insert(i);return}"="!==n.lexeme&&this._createCompileError("Invalid syntax, expect character '=', but got "+n.lexeme,n.location);var a=t.scanToken();t.scanLexeme(";");var o=this._renderStateConstMap.RenderQueueType[a.lexeme],s=r.RenderStateElementKey.RenderQueueType;if(void 0==o){e.variableMap[s]=a.lexeme;var c=this._lookupSymbol;c.set(a.lexeme,eF.GSRenderQueueType),this._symbolTableStack.lookup(c)||this._createCompileError("Invalid RenderQueueType variable: "+a.lexeme,a.location)}else e.constantMap[s]=o},e._addPendingContents=function(e,t,r){var n=this._lexer;if(n.hasPendingContent){var i=n.currentIndex-t;r.push({range:{start:e,end:tL({},n.getShaderPosition(0),{index:i-1})},content:n.source.substring(e.index,i-1)}),n.hasPendingContent=!1}},e._parseSubShader=function(){var e=this._lexer;this._pushScope();var t=1,r=e.scanPairedChar('"','"',!1,!1),n=tR.createSubShaderSource(r);e.scanLexeme("{"),e.skipCommentsAndSpace();for(var i=e.getShaderPosition(0);;){var a=e.scanToken();switch(a.type){case eF.GSPass:this._addPendingContents(i,a.lexeme.length,n.pendingContents);var o=this._parsePass();n.passes.push(o),i=e.getShaderPosition(0);break;case eF.GSUsePass:this._addPendingContents(i,a.lexeme.length,n.pendingContents);var s=e.scanPairedChar('"','"',!1,!1);n.passes.push(tR.createUsePass(s)),i=e.getShaderPosition(0);break;case eF.LeftBrace:++t;break;case eF.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)}}},e._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(",")}},e._parsePass=function(){this._pushScope();var e=this._lexer,t=e.scanPairedChar('"','"',!1,!1),r=tR.createShaderPassSource(t);e.scanLexeme("{");var n=1;e.skipCommentsAndSpace();for(var i=e.getShaderPosition(0);;){var a=e.scanToken();switch(a.type){case eF.GSVertexShader:case eF.GSFragmentShader:this._addPendingContents(i,a.lexeme.length,r.pendingContents),e.scanLexeme("=");var o=e.scanToken();r[a.lexeme]&&eB.createGSError("Reassign main entry",eY.CompilationError,e.source,e.getShaderPosition(0)),r[a.type===eF.GSVertexShader?"vertexEntry":"fragmentEntry"]=o.lexeme,e.scanLexeme(";"),i=e.getShaderPosition(0);break;case eF.LeftBrace:++n;break;case eF.RightBrace:if(0==--n)return this._addPendingContents(i,a.lexeme.length,r.pendingContents),this._popScope(),r;break;default:i=this._parseRenderStateAndTags(a,i,r.pendingContents,r.renderStates,r.tags)}}},e._parseRenderStateAndTags=function(e,t,r,n,i){return e.type===eF.GSTags?(this._addPendingContents(t,e.lexeme.length,r),this._parseTags(i),t=this._lexer.getShaderPosition(0)):t=this._parseRenderState(e,t,r,n),t},e._parseRenderState=function(e,t,r,n){switch(e.type){case eF.GSBlendState:case eF.GSDepthState:case eF.GSRasterState:case eF.GSStencilState:this._addPendingContents(t,e.lexeme.length,r),this._parseRenderStateDeclarationOrAssignment(n,e),t=this._lexer.getShaderPosition(0);break;case eF.GSBlendFactor:case eF.GSBlendOperation:case eF.GSBool:case eF.GSNumber:case eF.GSColor:case eF.GSCompareFunction:case eF.GSStencilOperation:case eF.GSCullMode:case eF.GSColorWriteMask:this._addPendingContents(t,e.lexeme.length,r),this._parseVariableDeclaration(),t=this._lexer.getShaderPosition(0);break;case eF.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}();tN.errors=[],tN._renderStateConstMap={RenderQueueType:r.RenderQueueType,CompareFunction:r.CompareFunction,StencilOperation:r.StencilOperation,BlendOperation:r.BlendOperation,BlendFactor:r.BlendFactor,CullMode:r.CullMode,ColorWriteMask:r.ColorWriteMask},tN._symbolTableStack=new e5,tN._lexer=new tM,tN._lookupSymbol=new tP("",null);var tD=/*#__PURE__*/function(){function e(){this._includeMap={},this._chunkOutputCache=new Map}var i=e.prototype;return i._setIncludeMap=function(e){this._includeMap=e,this._chunkOutputCache.clear()},i._parseShaderSource=function(e){return eB.clearAllShaderCompilerObjectPool(),tN.parse(e)},i._parseShaderPass=function(t,n,i,a,o){var s={},c=tI.parse(t,o,this._includeMap,this._chunkOutputCache),l=new e$(c,s).tokenize(),u=e._parser;e._processingPassText=c;var p=u.parse(l,s);if(p){var h=(a===r.ShaderLanguage.GLSLES100?t_.getVisitor():td.getVisitor()).visitShaderProgram(p,n,i);return e._processingPassText=void 0,h&&(h.vertexShaderInstructions=tS.parse(h.vertex),h.fragmentShaderInstructions=tS.parse(h.fragment)),h}},i._precompile=function(e,t,r){var n=this,i=this._parseShaderSource(e),a=i.subShaders.map(function(e){return{name:e.name,tags:e.tags,passes:e.passes.map(function(a){if(a.isUsePass)return{name:a.name,isUsePass:!0,tags:a.tags,renderStates:n._serializeRenderStates(a.renderStates)};var o=n._parseShaderPass(a.contents,a.vertexEntry,a.fragmentEntry,t,r);if(!o)throw Error('Shader pass "'+i.name+"."+e.name+"."+a.name+'" precompile failed, please check the shader source code.');return{name:a.name,isUsePass:!1,tags:a.tags,renderStates:n._serializeRenderStates(a.renderStates),vertexShaderInstructions:o.vertexShaderInstructions,fragmentShaderInstructions:o.fragmentShaderInstructions}})}});return{name:i.name,platformTarget:t,subShaders:a}},i._serializeRenderStates=function(e){var r={};for(var i in e.constantMap){var a=e.constantMap[i];n(a,t.Color)?r[i]=[a.r,a.g,a.b,a.a]:r[i]=a}return{constantMap:r,variableMap:e.variableMap}},e.createPosition=function(e,t,r){var n=this._shaderPositionPool.get();return n.set(e),n},e.createRange=function(e,t){var r=this._shaderRangePool.get();return r.set(e,t),r},e}();tD._parser=tO.create(),tD._shaderPositionPool=eB.createObjectPool(ek),tD._shaderRangePool=eB.createObjectPool(eV);var tV="2.0.0-alpha.40";console.log("Galacean Engine Shader Compiler Version: "+tV+" | Mode: Release"),e.GSError=eK,e.GSErrorName=eY,e.ShaderCompiler=tD,e.version=tV,Object.defineProperty(e,"__esModule",{value:!0})});
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@galacean/engine-math"),require("@galacean/engine-core")):"function"==typeof define&&define.amd?define(["exports","@galacean/engine-math","@galacean/engine-core"],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(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function a(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&&i(e,t)}function o(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 s(e,t,r){return t&&o(e.prototype,t),r&&o(e,r),e}function c(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 l(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 c(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 c(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 u(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o}"function"==typeof SuppressedError&&SuppressedError;var p,h,_,f,d,m,S,v,E,C,g,y,A,x,b,T,O,I,L,R,P,M,N,D,V,k,G,F,B,W,U,w,H,j,z,q,X,Q,K,Y,J,$,Z,ee,et,er,en,ei,ea,eo,es,ec,el,eu,ep,eh,e_,ef,ed,em,eS,ev,eE,eC,eg,ey,eA,ex,eb,eT,eO,eI,eL,eR,eP,eM,eN,eD,eV=/*#__PURE__*/function(){function e(){}var t=e.prototype;return t.set=function(e,t){this.start=e,this.end=t},t.dispose=function(){this.start.dispose(),this.end.dispose()},e}(),ek=/*#__PURE__*/function(){function e(){}var t=e.prototype;return t.set=function(e){this.index=e},t.dispose=function(){this.index=0},e}(),eG=((p={})[p.ID=1e3]="ID",p[p.FLOAT_CONSTANT=1001]="FLOAT_CONSTANT",p[p.INT_CONSTANT=1002]="INT_CONSTANT",p[p.STRING_CONST=1003]="STRING_CONST",p[p.LEFT_OP=1004]="LEFT_OP",p[p.RIGHT_OP=1005]="RIGHT_OP",p[p.INC_OP=1006]="INC_OP",p[p.DEC_OP=1007]="DEC_OP",p[p.LE_OP=1008]="LE_OP",p[p.GE_OP=1009]="GE_OP",p[p.EQ_OP=1010]="EQ_OP",p[p.NE_OP=1011]="NE_OP",p[p.AND_OP=1012]="AND_OP",p[p.OR_OP=1013]="OR_OP",p[p.XOR_OP=1014]="XOR_OP",p[p.MUL_ASSIGN=1015]="MUL_ASSIGN",p[p.DIV_ASSIGN=1016]="DIV_ASSIGN",p[p.ADD_ASSIGN=1017]="ADD_ASSIGN",p[p.SUB_ASSIGN=1018]="SUB_ASSIGN",p[p.MOD_ASSIGN=1019]="MOD_ASSIGN",p[p.LEFT_ASSIGN=1020]="LEFT_ASSIGN",p[p.RIGHT_ASSIGN=1021]="RIGHT_ASSIGN",p[p.AND_ASSIGN=1022]="AND_ASSIGN",p[p.XOR_ASSIGN=1023]="XOR_ASSIGN",p[p.OR_ASSIGN=1024]="OR_ASSIGN",p[p.LEFT_PAREN=1025]="LEFT_PAREN",p[p.RIGHT_PAREN=1026]="RIGHT_PAREN",p[p.LEFT_BRACKET=1027]="LEFT_BRACKET",p[p.RIGHT_BRACKET=1028]="RIGHT_BRACKET",p[p.LEFT_BRACE=1029]="LEFT_BRACE",p[p.RIGHT_BRACE=1030]="RIGHT_BRACE",p[p.DOT=1031]="DOT",p[p.COMMA=1032]="COMMA",p[p.COLON=1033]="COLON",p[p.EQUAL=1034]="EQUAL",p[p.SEMICOLON=1035]="SEMICOLON",p[p.BANG=1036]="BANG",p[p.DASH=1037]="DASH",p[p.TILDE=1038]="TILDE",p[p.PLUS=1039]="PLUS",p[p.STAR=1040]="STAR",p[p.SLASH=1041]="SLASH",p[p.PERCENT=1042]="PERCENT",p[p.LEFT_ANGLE=1043]="LEFT_ANGLE",p[p.RIGHT_ANGLE=1044]="RIGHT_ANGLE",p[p.VERTICAL_BAR=1045]="VERTICAL_BAR",p[p.CARET=1046]="CARET",p[p.AMPERSAND=1047]="AMPERSAND",p[p.QUESTION=1048]="QUESTION",p[p.NotWord=1049]="NotWord",p[p.EPSILON=1998]="EPSILON",p[p.EOF=1999]="EOF",p),eF=((h={})[h.CONST=0]="CONST",h[h.BOOL=1]="BOOL",h[h.FLOAT=2]="FLOAT",h[h.DOUBLE=3]="DOUBLE",h[h.INT=4]="INT",h[h.UINT=5]="UINT",h[h.BREAK=6]="BREAK",h[h.CONTINUE=7]="CONTINUE",h[h.DO=8]="DO",h[h.ELSE=9]="ELSE",h[h.FOR=10]="FOR",h[h.IF=11]="IF",h[h.WHILE=12]="WHILE",h[h.DISCARD=13]="DISCARD",h[h.RETURN=14]="RETURN",h[h.BVEC2=15]="BVEC2",h[h.BVEC3=16]="BVEC3",h[h.BVEC4=17]="BVEC4",h[h.IVEC2=18]="IVEC2",h[h.IVEC3=19]="IVEC3",h[h.IVEC4=20]="IVEC4",h[h.UVEC2=21]="UVEC2",h[h.UVEC3=22]="UVEC3",h[h.UVEC4=23]="UVEC4",h[h.VEC2=24]="VEC2",h[h.VEC3=25]="VEC3",h[h.VEC4=26]="VEC4",h[h.VEC4_ARRAY=27]="VEC4_ARRAY",h[h.MAT2=28]="MAT2",h[h.MAT3=29]="MAT3",h[h.MAT4=30]="MAT4",h[h.MAT2X3=31]="MAT2X3",h[h.MAT2X4=32]="MAT2X4",h[h.MAT3X2=33]="MAT3X2",h[h.MAT3X4=34]="MAT3X4",h[h.MAT4X2=35]="MAT4X2",h[h.MAT4X3=36]="MAT4X3",h[h.IN=37]="IN",h[h.OUT=38]="OUT",h[h.INOUT=39]="INOUT",h[h.CENTROID=40]="CENTROID",h[h.SAMPLER2D=41]="SAMPLER2D",h[h.SAMPLER3D=42]="SAMPLER3D",h[h.SAMPLER_CUBE=43]="SAMPLER_CUBE",h[h.SAMPLER2D_SHADOW=44]="SAMPLER2D_SHADOW",h[h.SAMPLER_CUBE_SHADOW=45]="SAMPLER_CUBE_SHADOW",h[h.SAMPLER2D_ARRAY=46]="SAMPLER2D_ARRAY",h[h.SAMPLER2D_ARRAY_SHADOW=47]="SAMPLER2D_ARRAY_SHADOW",h[h.I_SAMPLER2D=48]="I_SAMPLER2D",h[h.I_SAMPLER3D=49]="I_SAMPLER3D",h[h.I_SAMPLER_CUBE=50]="I_SAMPLER_CUBE",h[h.I_SAMPLER2D_ARRAY=51]="I_SAMPLER2D_ARRAY",h[h.U_SAMPLER2D=52]="U_SAMPLER2D",h[h.U_SAMPLER3D=53]="U_SAMPLER3D",h[h.U_SAMPLER_CUBE=54]="U_SAMPLER_CUBE",h[h.U_SAMPLER2D_ARRAY=55]="U_SAMPLER2D_ARRAY",h[h.STRUCT=56]="STRUCT",h[h.LAYOUT=57]="LAYOUT",h[h.LOCATION=58]="LOCATION",h[h.VOID=59]="VOID",h[h.PRECISION=60]="PRECISION",h[h.PRECISE=61]="PRECISE",h[h.HIGHP=62]="HIGHP",h[h.MEDIUMP=63]="MEDIUMP",h[h.LOWP=64]="LOWP",h[h.INVARIANT=65]="INVARIANT",h[h.SMOOTH=66]="SMOOTH",h[h.FLAT=67]="FLAT",h[h.NOPERSPECTIVE=68]="NOPERSPECTIVE",h[h.True=69]="True",h[h.False=70]="False",h[h.LeftBrace=71]="LeftBrace",h[h.RightBrace=72]="RightBrace",h[h.Equal=73]="Equal",h[h.BitwiseOr=74]="BitwiseOr",h[h.GSRenderQueueType=75]="GSRenderQueueType",h[h.GSBlendState=76]="GSBlendState",h[h.GSDepthState=77]="GSDepthState",h[h.GSStencilState=78]="GSStencilState",h[h.GSRasterState=79]="GSRasterState",h[h.GSEditorProperties=80]="GSEditorProperties",h[h.GSEditorMacros=81]="GSEditorMacros",h[h.GSEditor=82]="GSEditor",h[h.GSTags=83]="GSTags",h[h.GSVertexShader=84]="GSVertexShader",h[h.GSFragmentShader=85]="GSFragmentShader",h[h.GSSubShader=86]="GSSubShader",h[h.GSPass=87]="GSPass",h[h.GSBlendFactor=88]="GSBlendFactor",h[h.GSBlendOperation=89]="GSBlendOperation",h[h.GSBool=90]="GSBool",h[h.GSNumber=91]="GSNumber",h[h.GSColor=92]="GSColor",h[h.GSCompareFunction=93]="GSCompareFunction",h[h.GSStencilOperation=94]="GSStencilOperation",h[h.GSCullMode=95]="GSCullMode",h[h.GSColorWriteMask=96]="GSColorWriteMask",h[h.GSUsePass=97]="GSUsePass",h[h.MACRO_IF=98]="MACRO_IF",h[h.MACRO_IFDEF=99]="MACRO_IFDEF",h[h.MACRO_IFNDEF=100]="MACRO_IFNDEF",h[h.MACRO_ELSE=101]="MACRO_ELSE",h[h.MACRO_ELIF=102]="MACRO_ELIF",h[h.MACRO_ENDIF=103]="MACRO_ENDIF",h[h.MACRO_UNDEF=104]="MACRO_UNDEF",h[h.MACRO_DEFINE_EXPRESSION=105]="MACRO_DEFINE_EXPRESSION",h[h.MACRO_CONDITIONAL_EXPRESSION=106]="MACRO_CONDITIONAL_EXPRESSION",h[h.MACRO_CALL=107]="MACRO_CALL",h[h.MACRO_DEFINE=108]="MACRO_DEFINE",h[h.MACRO_DEFINE_END=109]="MACRO_DEFINE_END",h[h.MACRO_DEFINE_PARAMS=110]="MACRO_DEFINE_PARAMS",h),eB=/*#__PURE__*/function(){function e(){}return e.createObjectPool=function(t){var n=new r.ClearableObjectPool(t);return e._shaderCompilerObjectPoolSet.push(n),n},e.clearAllShaderCompilerObjectPool=function(){for(var t=0,r=e._shaderCompilerObjectPoolSet.length;t<r;t++)e._shaderCompilerObjectPoolSet[t].clear()},e.createGSError=function(e,t,r,n,i){console.error(e);var a=Error(e);return a.name=t,a},e}();eB._shaderCompilerObjectPoolSet=[];var eW=[],eU=/*#__PURE__*/function(){function e(){this.branch=eW}var t=e.prototype;return t.set=function(e,t,r){if(this.type=e,this.lexeme=t,this.branch=eW,r){if(n(r,eV))this.location=r;else{var i=tD.createPosition(r.index+t.length);this.location=tD.createRange(r,i)}}},t.dispose=function(){},e}();eU.pool=eB.createObjectPool(eU);var ew=new eU;ew.set(eG.EOF,"/EOF");var eH=((_={})[_.START=2e3]="START",_[_.gs_shader_program=2001]="gs_shader_program",_[_.global_declaration=2002]="global_declaration",_[_.variable_declaration=2003]="variable_declaration",_[_.variable_declaration_list=2004]="variable_declaration_list",_[_.variable_declaration_statement=2005]="variable_declaration_statement",_[_.array_specifier_list=2006]="array_specifier_list",_[_.array_specifier=2007]="array_specifier",_[_.ext_builtin_type_specifier_nonarray=2008]="ext_builtin_type_specifier_nonarray",_[_.precision_specifier=2009]="precision_specifier",_[_.variable_identifier=2010]="variable_identifier",_[_.variable_identifier_node=2011]="variable_identifier_node",_[_.primary_expression=2012]="primary_expression",_[_.postfix_expression=2013]="postfix_expression",_[_.integer_expression=2014]="integer_expression",_[_.function_call=2015]="function_call",_[_.function_call_generic=2016]="function_call_generic",_[_.function_call_header_no_parameters=2017]="function_call_header_no_parameters",_[_.function_call_header_with_parameters=2018]="function_call_header_with_parameters",_[_.function_call_parameter_list=2019]="function_call_parameter_list",_[_.function_call_header=2020]="function_call_header",_[_.function_identifier=2021]="function_identifier",_[_.constructor_identifier=2022]="constructor_identifier",_[_.unary_expression=2023]="unary_expression",_[_.unary_operator=2024]="unary_operator",_[_.multiplicative_expression=2025]="multiplicative_expression",_[_.additive_expression=2026]="additive_expression",_[_.shift_expression=2027]="shift_expression",_[_.relational_expression=2028]="relational_expression",_[_.equality_expression=2029]="equality_expression",_[_.and_expression=2030]="and_expression",_[_.inclusive_or_expression=2031]="inclusive_or_expression",_[_.exclusive_or_expression=2032]="exclusive_or_expression",_[_.logical_and_expression=2033]="logical_and_expression",_[_.logical_xor_expression=2034]="logical_xor_expression",_[_.logical_or_expression=2035]="logical_or_expression",_[_.conditional_expression=2036]="conditional_expression",_[_.assignment_expression=2037]="assignment_expression",_[_.assignment_operator=2038]="assignment_operator",_[_.expression=2039]="expression",_[_.integer_constant_expression=2040]="integer_constant_expression",_[_.integer_constant_expression_operator=2041]="integer_constant_expression_operator",_[_.declaration=2042]="declaration",_[_.function_prototype=2043]="function_prototype",_[_.function_declarator=2044]="function_declarator",_[_.function_header_with_parameters=2045]="function_header_with_parameters",_[_.function_header=2046]="function_header",_[_.function_parameter_list=2047]="function_parameter_list",_[_.parameter_declarator=2048]="parameter_declarator",_[_.parameter_declaration=2049]="parameter_declaration",_[_.parameter_qualifier=2050]="parameter_qualifier",_[_.parameter_type_specifier=2051]="parameter_type_specifier",_[_.init_declarator_list=2052]="init_declarator_list",_[_.single_declaration=2053]="single_declaration",_[_.fully_specified_type=2054]="fully_specified_type",_[_.type_qualifier=2055]="type_qualifier",_[_.single_type_qualifier=2056]="single_type_qualifier",_[_.storage_qualifier=2057]="storage_qualifier",_[_.precision_qualifier=2058]="precision_qualifier",_[_.interpolation_qualifier=2059]="interpolation_qualifier",_[_.invariant_qualifier=2060]="invariant_qualifier",_[_.type_specifier=2061]="type_specifier",_[_.type_specifier_nonarray=2062]="type_specifier_nonarray",_[_.type_specifier_no_prec=2063]="type_specifier_no_prec",_[_.basic_type=2064]="basic_type",_[_.struct_specifier=2065]="struct_specifier",_[_.struct_declaration_list=2066]="struct_declaration_list",_[_.struct_declaration=2067]="struct_declaration",_[_.layout_qualifier=2068]="layout_qualifier",_[_.struct_declarator_list=2069]="struct_declarator_list",_[_.struct_declarator=2070]="struct_declarator",_[_.identifier_list=2071]="identifier_list",_[_.decl_identifier=2072]="decl_identifier",_[_.initializer=2073]="initializer",_[_.initializer_list=2074]="initializer_list",_[_.declaration_statement=2075]="declaration_statement",_[_.simple_statement=2076]="simple_statement",_[_.compound_statement_no_scope=2077]="compound_statement_no_scope",_[_.statement_with_scope=2078]="statement_with_scope",_[_.compound_statement=2079]="compound_statement",_[_.statement=2080]="statement",_[_.statement_list=2081]="statement_list",_[_.iteration_statement_no_new_scope=2082]="iteration_statement_no_new_scope",_[_.expression_statement=2083]="expression_statement",_[_.selection_statement=2084]="selection_statement",_[_.selection_rest_statement=2085]="selection_rest_statement",_[_.condition=2086]="condition",_[_.conditionopt=2087]="conditionopt",_[_.iteration_statement=2088]="iteration_statement",_[_.for_init_statement=2089]="for_init_statement",_[_.for_rest_statement=2090]="for_rest_statement",_[_.jump_statement=2091]="jump_statement",_[_.external_declaration=2092]="external_declaration",_[_.function_definition=2093]="function_definition",_[_.field_selection=2094]="field_selection",_[_.bool_constant=2095]="bool_constant",_[_.function_identifier_node=2096]="function_identifier_node",_[_.typename_identifier_node=2097]="typename_identifier_node",_[_.scope_brace=2098]="scope_brace",_[_.scope_end_brace=2099]="scope_end_brace",_[_.macro_undef=2100]="macro_undef",_[_.macro_push_context=2101]="macro_push_context",_[_.macro_pop_context=2102]="macro_pop_context",_[_.macro_elif_expression=2103]="macro_elif_expression",_[_.macro_else_expression=2104]="macro_else_expression",_[_.global_macro_if_statement=2105]="global_macro_if_statement",_[_.global_macro_declaration=2106]="global_macro_declaration",_[_.global_macro_branch=2107]="global_macro_branch",_[_.macro_struct_declaration=2108]="macro_struct_declaration",_[_.macro_struct_branch=2109]="macro_struct_branch",_[_.macro_if_statement=2110]="macro_if_statement",_[_.macro_branch=2111]="macro_branch",_[_.macro_param_case_list=2112]="macro_param_case_list",_[_.macro_param_block=2113]="macro_param_block",_[_.macro_parameter_branch=2114]="macro_parameter_branch",_[_.macro_call_arg_case_list=2115]="macro_call_arg_case_list",_[_.macro_call_arg_block=2116]="macro_call_arg_block",_[_.macro_call_arg_branch=2117]="macro_call_arg_branch",_[_.macro_call_symbol=2118]="macro_call_symbol",_[_.macro_call_function=2119]="macro_call_function",_[_.macro_define=2120]="macro_define",_[_._ignore=2121]="_ignore",_),ej=/*#__PURE__*/function(){function e(){}return e.unwrapNodeByType=function(t,r){var i=t.children[0];if(!n(i,eU))return i.nt===r?i:e.unwrapNodeByType(i,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(n(r,eD.VariableIdentifier))return r;if(t.allowParens&&n(r,eD.PrimaryExpression)&&3===r.children.length){var i=r.children[1];if(!n(i,tc))return;r=i;continue}if(n(r,eD.ExpressionAstNode)&&1===r.children.length){var a=r.children[0];if(!n(a,tc))return;r=a;continue}return}},e.extractDirectIdentLexeme=function(t){var r=e.unwrapBareIdentifier(t,{allowParens:!0});if(!r)return null;var i=r.children[0];return n(i,eU)?i.lexeme:null},e.isTerminal=function(e){return e<eH.START},e}();function ez(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(ez=function(){return!!e})()}function eq(e,t,r){return(eq=ez()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var a=new(Function.bind.apply(e,n));return r&&i(a,r.prototype),a}).apply(null,arguments)}function eX(e){return(eX=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function eQ(e){var t="function"==typeof Map?new Map:void 0;return(eQ=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 eq(e,arguments,eX(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),i(r,e)})(e)}var eK=/*#__PURE__*/function(e){function t(t,r,n,i,a){var o;return(o=e.call(this,r)||this).location=n,o.source=i,o.file=a,o.name=t,o}return a(t,e),t.prototype.toString=function(){var e=this.message,t=this.location,r=this.source;return r?(n(t,ek)||(t.start,t.end),r.split("\n"),this.name+": "+e+"\n\n"):e},t}(eQ(Error));eK.wrappingLineCount=2;var eY=((f={}).PreprocessorError="PreprocessorError",f.CompilationError="CompilationError",f.ScannerError="ScannerError",f.CompilationWarn="CompilationWarning",f),eJ=/*#__PURE__*/function(){function e(e){this._currentIndex=0,this._source=e}var t=e.prototype;return t.setSource=function(e){this._source=e,this._currentIndex=0},t.getShaderPosition=function(e){return void 0===e&&(e=0),tD.createPosition(this._currentIndex-e)},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){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 eB.createGSError(r.join(" "),eY.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 l=a[s];if(l===t&&0==--c)break;l===e&&c++,s++}else for(;s<o&&a[s]!==t;)s++;return 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)},s(e,[{key:"currentIndex",get:function(){return this._currentIndex}},{key:"source",get:function(){return this._source}}]),e}(),e$=/*#__PURE__*/function(e){function t(t,r){var n;return(n=e.call(this,t)||this).macroDefineList=r,n._needScanMacroConditionExpression=!1,n._inMacroDefineValue=!1,n._macroDefineExpectsNameToken=!1,n._macroDefineExpectsParamsToken=!1,n._currentMacroName="",n._currentMacroParamsLexeme=void 0,n._currentMacroValueStart=-1,n._branchStack=[],n._pendingBranchPushDefined=null,n}a(t,e);var r=t.prototype;return r.tokenize=function(){var e,r;return function(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])}}}(this,function(n){switch(n.label){case 0:if(this.isEnd())return[3,2];switch(e=this.scanToken(),null!==this._pendingBranchPushDefined&&(e.type===eG.ID||e.type===eF.MACRO_CALL)&&(this._branchStack.push({name:e.lexeme,defined:this._pendingBranchPushDefined}),this._pendingBranchPushDefined=null),this._branchStack.length>0&&(e.branch=this._branchStack.slice()),e.type){case eF.MACRO_IFDEF:this._pendingBranchPushDefined=!0;break;case eF.MACRO_IFNDEF:this._pendingBranchPushDefined=!1;break;case eF.MACRO_IF:this._branchStack.push({name:"__if_"+ ++t._ifCounter,defined:!0});break;case eF.MACRO_ELIF:this._branchStack.length>0&&(this._branchStack[this._branchStack.length-1]={name:"__if_"+ ++t._ifCounter,defined:!0});break;case eF.MACRO_ELSE:(r=this._branchStack[this._branchStack.length-1])&&(this._branchStack[this._branchStack.length-1]={name:r.name,defined:!r.defined});break;case eF.MACRO_ENDIF:this._branchStack.pop()}return[4,e];case 1:return n.sent(),[3,0];case 2:return[2,ew]}})},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 ew;if(this._needScanMacroConditionExpression)return this._needScanMacroConditionExpression=!1,this._scanMacroConditionExpression();var e,t=this.getCurCharCode();if(eJ.isPreprocessorStartChar(t))return this._scanDirectives();if(eJ.isAlpha(t))return this._scanWord();if(eJ.isDigit(t))return this._scanNum();var r=this.getShaderPosition(),n=eU.pool.get();switch(this.getCurChar()){case"<":if(this.advance(1),"<"===(e=this.getCurChar())){if(this.advance(1),"="===this.getCurChar()){this.advance(1),n.set(eG.LEFT_ASSIGN,"<<=",r);break}n.set(eG.LEFT_OP,"<<",r);break}if("="===e){this.advance(1),n.set(eG.LE_OP,"<=",r);break}n.set(eG.LEFT_ANGLE,"<",r);break;case">":if(this.advance(1),">"===(e=this.getCurChar())){if(this.advance(1),"="===this.getCurChar()){this.advance(1),n.set(eG.RIGHT_ASSIGN,">>=",r);break}n.set(eG.RIGHT_OP,">>",r);break}if("="===e){this.advance(1),n.set(eG.GE_OP,">=",r);break}n.set(eG.RIGHT_ANGLE,">",r);break;case"+":if(this.advance(1),"+"===(e=this.getCurChar())){this.advance(1),n.set(eG.INC_OP,"++",r);break}if("="===e){this.advance(1),n.set(eG.ADD_ASSIGN,"+=",r);break}n.set(eG.PLUS,"+",r);break;case"-":if(this.advance(1),"-"===(e=this.getCurChar())){this.advance(1),n.set(eG.DEC_OP,"--",r);break}if("="===e){this.advance(1),n.set(eG.SUB_ASSIGN,"-=",r);break}n.set(eG.DASH,"-",r);break;case"=":if(this.advance(1),"="===this.getCurChar()){this.advance(1),n.set(eG.EQ_OP,"==",r);break}n.set(eG.EQUAL,"=",r);break;case"!":if(this.advance(1),"="===this.getCurChar()){this.advance(1),n.set(eG.NE_OP,"!=",r);break}n.set(eG.BANG,"!",r);break;case"&":if(this.advance(1),"&"===(e=this.getCurChar())){this.advance(1),n.set(eG.AND_OP,"&&",r);break}if("="===e){this.advance(1),n.set(eG.AND_ASSIGN,"&=",r);break}n.set(eG.AMPERSAND,"&",r);break;case"|":if(this.advance(1),"|"===(e=this.getCurChar())){this.advance(1),n.set(eG.OR_OP,"||",r);break}if("="===e){this.advance(1),n.set(eG.OR_ASSIGN,"|=",r);break}n.set(eG.VERTICAL_BAR,"|",r);break;case"^":if(this.advance(1),"^"===(e=this.getCurChar())){this.advance(1),n.set(eG.XOR_OP,"^^",r);break}if("="===e){this.advance(1),n.set(eG.XOR_ASSIGN,"^=",r);break}n.set(eG.CARET,"^",r);break;case"*":if(this.advance(1),"="===this.getCurChar()){this.advance(1),n.set(eG.MUL_ASSIGN,"*=",r);break}n.set(eG.STAR,"*",r);break;case"/":if(this.advance(1),"="===this.getCurChar()){this.advance(1),n.set(eG.DIV_ASSIGN,"/=",r);break}n.set(eG.SLASH,"/",r);break;case"%":if(this.advance(1),"="===this.getCurChar()){this.advance(1),n.set(eG.MOD_ASSIGN,"%=",r);break}n.set(eG.PERCENT,"%",r);break;case"(":this.advance(1),n.set(eG.LEFT_PAREN,"(",r);break;case")":this.advance(1),n.set(eG.RIGHT_PAREN,")",r);break;case"{":this.advance(1),n.set(eG.LEFT_BRACE,"{",r);break;case"}":this.advance(1),n.set(eG.RIGHT_BRACE,"}",r);break;case"[":this.advance(1),n.set(eG.LEFT_BRACKET,"[",r);break;case"]":this.advance(1),n.set(eG.RIGHT_BRACKET,"]",r);break;case".":if(this.advance(1),eJ.isDigit(this.getCurCharCode()))return this._scanNumAfterDot();n.set(eG.DOT,".",r);break;case",":this.advance(1),n.set(eG.COMMA,",",r);break;case":":this.advance(1),n.set(eG.COLON,":",r);break;case";":this.advance(1),n.set(eG.SEMICOLON,";",r);break;case"~":this.advance(1),n.set(eG.TILDE,"~",r);break;case"?":this.advance(1),n.set(eG.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();)t.push(this.getCurChar()),this.advance(1);this.advance(1);var r=tD.createRange(e,this.getShaderPosition()),n=eU.pool.get();return n.set(eG.STRING_CONST,t.join(""),r),n},r._scanNumAfterDot=function(){for(var e=["."];eJ.isDigit(this.getCurCharCode());)e.push(this.getCurChar()),this.advance(1);this._scanFloatSuffix(e);var t=eU.pool.get();return t.set(eG.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);eJ.isAlpha(this.getCurCharCode());)e.push(this.getCurChar()),this.advance(1);var n=eU.pool.get(),i=e.join("");if("#define"===i){var a=this._peekMacroDefine();if(a&&a.isExpression)this._inMacroDefineValue=!0,this._macroDefineExpectsNameToken=!0,n.set(eF.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(eF.MACRO_DEFINE_EXPRESSION,o,r)}}else{var s=t._lexemeTable[i];n.set(null!=s?s:eG.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&&eJ.isAlpha(r.charCodeAt(i))))return null;for(var a=i;i<n&&eJ.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 l=r.charCodeAt(i);if(10===l||13===l)return{name:o,paramsLexeme:void 0,valueStart:i,valueEnd:i,cursor:i,isExpression:!1};40===l?c++:41===l&&c--,i++}e=r.slice(s,i)}for(var u=i,p=0,h=0,_=-1,f=-1,d=!1,m=-1;i<n;){var S=t._skipNonSemantic(r,i,n);if(S!==i){i=S;continue}var v=r.charCodeAt(i);if(10===v||13===v)break;if(-1===_&&(_=i,eJ.isAlpha(v))){for(;i<n&&eJ.isAlnum(r.charCodeAt(i));)i++;f=i;var E=t._skipNonSemantic(r,i,n);d=E<n&&40===r.charCodeAt(E),m=f-1;continue}40===v?p++:41===v?p--:91===v?h++:93===v&&h--,0===p&&0===h&&(m=i),i++}var C={name:o,paramsLexeme:e,valueStart:u,valueEnd:i,cursor:i,isExpression:!1};if(-1===_||-1!==f&&!d&&t._isNonExpressionLeadingKeyword(r.slice(_,f)))return C;var g=r.charCodeAt(_),y=m>=0?r.charCodeAt(m):0,A=!eJ.isAlnum(g)&&40!==g&&46!==g&&45!==g&&43!==g&&33!==g&&126!==g,x=!eJ.isAlnum(y)&&41!==y&&93!==y;if(0!==p||0!==h||A||x){var b=r.slice(_,i).replace(/\s+/g," ").trim();this.throwError(this.getShaderPosition(0),"#define "+o+': invalid replacement list — not a valid GLSL expression ("'+b+'")')}return C.isExpression=!0,C},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=eU.pool.get(),l=i.join("");return this._currentMacroParamsLexeme=l,this._currentMacroValueStart=this._currentIndex,c.set(eF.MACRO_DEFINE_PARAMS,l,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=eU.pool.get();return i.set(eF.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:0===this._branchStack.length?eW:this._branchStack.slice()},c=this.macroDefineList[e];if(!c){this.macroDefineList[e]=[s];return}for(var l=0,u=c.length;l<u;l++){var p=c[l];if(p.dedupKey===o&&t.sameBranch(p.branch,s.branch))return}c.push(s)},r._scanMacroConditionExpression=function(){var e=[],t=this.getShaderPosition();this._scanUtilBreakLine(e);var r=e.join(""),n=eU.pool.get();return n.set(eF.MACRO_CONDITIONAL_EXPRESSION,r,t),n},r._scanWord=function(){var e=[this.getCurChar()],r=this.getShaderPosition();for(this.advance(1);eJ.isAlnum(this.getCurCharCode());)e.push(this.getCurChar()),this.advance(1);var n=eU.pool.get(),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(eG.ID,i,r)):this._isVisibleMacro(i)?n.set(eF.MACRO_CALL,i,r):n.set(null!=a?a:eG.ID,i,r),n},r._isVisibleMacro=function(e){var r=this.macroDefineList[e];if(!r||0===r.length)return!1;for(var n=this._branchStack,i=0,a=r.length;i<a;i++)if(t.isVisibleFrom(r[i].branch,n))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);eJ.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=eU.pool.get();return r.set(eG.INT_CONSTANT,e.join(""),this.getShaderPosition(e.length)),r}}for(;eJ.isDigit(this.getCurCharCode());)e.push(this.getCurChar()),this.advance(1);var n=this.getCurChar();if("."===n){for(e.push(n),this.advance(1);eJ.isDigit(this.getCurCharCode());)e.push(this.getCurChar()),this.advance(1);this._scanFloatSuffix(e);var i=eU.pool.get();return i.set(eG.FLOAT_CONSTANT,e.join(""),this.getShaderPosition(e.length)),i}if("e"===n||"E"===n){this._scanFloatSuffix(e);var a=eU.pool.get();return a.set(eG.FLOAT_CONSTANT,e.join(""),this.getShaderPosition(e.length)),a}if("f"===n||"F"===n){e.push(n),this.advance(1);var o=eU.pool.get();return o.set(eG.FLOAT_CONSTANT,e.join(""),this.getShaderPosition(e.length)),o}this._scanIntegerSuffix(e);var s=eU.pool.get();return s.set(eG.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()),eJ.isDigit(this.getCurCharCode())||this.throwError(this.getShaderPosition(0),"lexing error, invalid exponent suffix.");do e.push(t),this.advance(1),t=this.getCurChar();while(eJ.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.sameBranch=function(e,t){if(e.length!==t.length)return!1;for(var r=0,n=e.length;r<n;r++)if(e[r].name!==t[r].name||e[r].defined!==t[r].defined)return!1;return!0},t.isVisibleFrom=function(e,t){for(var r=0,n=e.length;r<n;r++)for(var i=e[r],a=0,o=t.length;a<o;a++){var s=t[a];if(i.name===s.name&&i.defined!==s.defined)return!1}return!0},t._isNonExpressionLeadingKeyword=function(e){var r=t._lexemeTable[e];return void 0!==r&&r!==eF.True&&r!==eF.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}(eJ);e$._lexemeTable={const:eF.CONST,bool:eF.BOOL,float:eF.FLOAT,double:eF.DOUBLE,int:eF.INT,uint:eF.UINT,break:eF.BREAK,continue:eF.CONTINUE,do:eF.DO,else:eF.ELSE,for:eF.FOR,if:eF.IF,while:eF.WHILE,discard:eF.DISCARD,return:eF.RETURN,bvec2:eF.BVEC2,bvec3:eF.BVEC3,bvec4:eF.BVEC4,ivec2:eF.IVEC2,ivec3:eF.IVEC3,ivec4:eF.IVEC4,uvec2:eF.UVEC2,uvec3:eF.UVEC3,uvec4:eF.UVEC4,vec2:eF.VEC2,vec3:eF.VEC3,vec4:eF.VEC4,mat2:eF.MAT2,mat3:eF.MAT3,mat4:eF.MAT4,in:eF.IN,out:eF.OUT,inout:eF.INOUT,sampler2D:eF.SAMPLER2D,samplerCube:eF.SAMPLER_CUBE,sampler3D:eF.SAMPLER3D,sampler2DShadow:eF.SAMPLER2D_SHADOW,samplerCubeShadow:eF.SAMPLER_CUBE_SHADOW,sampler2DArray:eF.SAMPLER2D_ARRAY,sampler2DArrayShadow:eF.SAMPLER2D_ARRAY_SHADOW,isampler2D:eF.I_SAMPLER2D,isampler3D:eF.I_SAMPLER3D,isamplerCube:eF.I_SAMPLER_CUBE,isampler2DArray:eF.I_SAMPLER2D_ARRAY,usampler2D:eF.U_SAMPLER2D,usampler3D:eF.U_SAMPLER3D,usamplerCube:eF.U_SAMPLER_CUBE,usampler2DArray:eF.U_SAMPLER2D_ARRAY,struct:eF.STRUCT,void:eF.VOID,true:eF.True,false:eF.False,precision:eF.PRECISION,precise:eF.PRECISE,highp:eF.HIGHP,mediump:eF.MEDIUMP,lowp:eF.LOWP,invariant:eF.INVARIANT,flat:eF.FLAT,smooth:eF.SMOOTH,noperspective:eF.NOPERSPECTIVE,centroid:eF.CENTROID,layout:eF.LAYOUT,location:eF.LOCATION,"#if":eF.MACRO_IF,"#ifdef":eF.MACRO_IFDEF,"#ifndef":eF.MACRO_IFNDEF,"#else":eF.MACRO_ELSE,"#elif":eF.MACRO_ELIF,"#endif":eF.MACRO_ENDIF,"#undef":eF.MACRO_UNDEF},e$._ifCounter=0;var eZ=((d={})[d.VERTEX=0]="VERTEX",d[d.FRAGMENT=1]="FRAGMENT",d[d.ALL=2]="ALL",d),e0=((eN={})[200]={dimension:0,members:[eF.FLOAT,eF.VEC2,eF.VEC3,eF.VEC4]},eN[201]={dimension:0,members:[eF.INT,eF.IVEC2,eF.IVEC3,eF.IVEC4]},eN[202]={dimension:0,members:[eF.UINT,eF.UVEC2,eF.UVEC3,eF.UVEC4]},eN[203]={dimension:0,members:[eF.BOOL,eF.BVEC2,eF.BVEC3,eF.BVEC4]},eN[208]={dimension:0,members:[eF.VEC2,eF.VEC3,eF.VEC4]},eN[206]={dimension:0,members:[eF.IVEC2,eF.IVEC3,eF.IVEC4]},eN[207]={dimension:0,members:[eF.UVEC2,eF.UVEC3,eF.UVEC4]},eN[205]={dimension:0,members:[eF.BVEC2,eF.BVEC3,eF.BVEC4]},eN[204]={dimension:0,members:[eF.MAT2,eF.MAT3,eF.MAT4]},eN[210]={dimension:1,members:[eF.SAMPLER2D,eF.I_SAMPLER2D,eF.U_SAMPLER2D]},eN[211]={dimension:1,members:[eF.SAMPLER3D,eF.I_SAMPLER3D,eF.U_SAMPLER3D]},eN[212]={dimension:1,members:[eF.SAMPLER_CUBE,eF.I_SAMPLER_CUBE,eF.U_SAMPLER_CUBE]},eN[213]={dimension:1,members:[eF.SAMPLER2D_ARRAY,eF.I_SAMPLER2D_ARRAY,eF.U_SAMPLER2D_ARRAY]},eN[209]={dimension:1,members:[eF.VEC4,eF.IVEC4,eF.UVEC4]},eN),e2=new Map,e1=/*#__PURE__*/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=eq(e,[].concat([t,r,eZ.ALL],a)),c=null!=(n=e2.get(t))?n:[];c.push(s),e2.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=eq(e,[].concat([t,r,n],o)),l=null!=(i=e2.get(t))?i:[];l.push(c),e2.set(t,l)},e.resolveOverload=function(e,t){var r,n=e2.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 l=-1,u=-1,p=!0,h=0;h<i;h++){var _=c[h],f=t[h];if(3e3!==f){var d=e0[_];if(d){var m=d.members.indexOf(f);if(-1===m){p=!1;break}if(0===d.dimension){if(-1===l)l=m;else if(l!==m){p=!1;break}}else if(-1===u)u=m;else if(u!==m){p=!1;break}}else if(_!==f){p=!1;break}}}if(p){var S=e0[s._returnType];if(!S)return s._realReturnType=s._returnType,s;var v=0===S.dimension?l:u;return s._realReturnType=-1===v?3e3:S.members[v],s}}}},e.isExist=function(e){return e2.has(e)},s(e,[{key:"realReturnType",get:function(){return this._realReturnType}}]),e}();e1._create("radians",200,200),e1._create("degrees",200,200),e1._create("sin",200,200),e1._create("cos",200,200),e1._create("tan",200,200),e1._create("asin",200,200),e1._create("acos",200,200),e1._create("atan",200,200,200),e1._create("atan",200,200),e1._create("sinh",200,200),e1._create("cosh",200,200),e1._create("tanh",200,200),e1._create("asinh",200,200),e1._create("acosh",200,200),e1._create("atanh",200,200),e1._create("pow",200,200,200),e1._create("exp",200,200),e1._create("log",200,200),e1._create("exp2",200,200),e1._create("log2",200,200),e1._create("sqrt",200,200),e1._create("inversesqrt",200,200),e1._create("abs",200,200),e1._create("abs",201,201),e1._create("sign",200,200),e1._create("sign",201,201),e1._create("floor",200,200),e1._create("trunc",200,200),e1._create("round",200,200),e1._create("roundEven",200,200),e1._create("ceil",200,200),e1._create("fract",200,200),e1._create("mod",200,200,eF.FLOAT),e1._create("mod",200,200,200),e1._create("min",200,200,200),e1._create("min",200,200,eF.FLOAT),e1._create("min",201,201,201),e1._create("min",201,201,eF.INT),e1._create("min",202,202,202),e1._create("min",202,202,eF.UINT),e1._create("max",200,200,200),e1._create("max",200,200,eF.FLOAT),e1._create("max",201,201,201),e1._create("max",201,201,eF.INT),e1._create("clamp",200,200,200,200),e1._create("clamp",200,200,eF.FLOAT,eF.FLOAT),e1._create("clamp",201,201,201,201),e1._create("clamp",201,201,eF.INT,eF.INT),e1._create("clamp",202,202,202,202),e1._create("clamp",202,202,eF.UINT,eF.UINT),e1._create("mix",200,200,200,200),e1._create("mix",200,200,200,eF.FLOAT),e1._create("mix",200,200,200,203),e1._create("step",200,200,200),e1._create("step",200,eF.FLOAT,200),e1._create("smoothstep",200,200,200,200),e1._create("smoothstep",200,eF.FLOAT,eF.FLOAT,200),e1._create("isnan",203,200),e1._create("isinf",203,200),e1._create("floatBitsToInt",200,200),e1._create("floatBitsToUint",202,200),e1._create("intBitsToFloat",200,201),e1._create("uintBitsToFloat",200,202),e1._create("packSnorm2x16",eF.UINT,eF.VEC2),e1._create("unpackSnorm2x16",eF.VEC2,eF.UINT),e1._create("packUnorm2x16",eF.UINT,eF.VEC2),e1._create("unpackUnorm2x16",eF.VEC2,eF.UINT),e1._create("packHalf2x16",eF.UINT,eF.VEC2),e1._create("unpackHalf2x16",eF.VEC2,eF.UINT),e1._create("length",eF.FLOAT,200),e1._create("distance",eF.FLOAT,200,200),e1._create("dot",eF.FLOAT,200,200),e1._create("cross",eF.VEC3,eF.VEC3,eF.VEC3),e1._create("normalize",200,200),e1._create("faceforward",200,200,200,200),e1._create("reflect",200,200,200),e1._create("refract",200,200,200,eF.FLOAT),e1._create("matrixCompMult",204,204,204),e1._create("outerProduct",eF.MAT2,eF.VEC2,eF.VEC2),e1._create("outerProduct",eF.MAT3,eF.VEC3,eF.VEC3),e1._create("outerProduct",eF.MAT4,eF.VEC4,eF.VEC4),e1._create("outerProduct",eF.MAT2X3,eF.VEC3,eF.VEC2),e1._create("outerProduct",eF.MAT3X2,eF.VEC2,eF.VEC3),e1._create("outerProduct",eF.MAT2X4,eF.VEC4,eF.VEC2),e1._create("outerProduct",eF.MAT4X2,eF.VEC2,eF.VEC4),e1._create("outerProduct",eF.MAT3X4,eF.VEC4,eF.VEC3),e1._create("outerProduct",eF.MAT4X3,eF.VEC3,eF.VEC4),e1._create("transpose",eF.MAT2,eF.MAT2),e1._create("transpose",eF.MAT3,eF.MAT3),e1._create("transpose",eF.MAT4,eF.MAT4),e1._create("transpose",eF.MAT2X3,eF.MAT3X2),e1._create("transpose",eF.MAT3X2,eF.MAT2X3),e1._create("transpose",eF.MAT4X2,eF.MAT2X4),e1._create("transpose",eF.MAT2X4,eF.MAT4X2),e1._create("transpose",eF.MAT3X4,eF.MAT4X3),e1._create("transpose",eF.MAT4X3,eF.MAT3X4),e1._create("determinant",eF.FLOAT,eF.MAT2),e1._create("determinant",eF.FLOAT,eF.MAT3),e1._create("determinant",eF.FLOAT,eF.MAT4),e1._create("inverse",eF.MAT2,eF.MAT2),e1._create("inverse",eF.MAT3,eF.MAT3),e1._create("inverse",eF.MAT4,eF.MAT4),e1._create("lessThan",205,208,208),e1._create("lessThan",205,206,206),e1._create("lessThan",205,207,207),e1._create("lessThanEqual",205,208,208),e1._create("lessThanEqual",205,206,206),e1._create("lessThanEqual",205,207,207),e1._create("greaterThan",205,208,208),e1._create("greaterThan",205,206,206),e1._create("greaterThan",205,207,207),e1._create("greaterThanEqual",205,208,208),e1._create("greaterThanEqual",205,206,206),e1._create("greaterThanEqual",205,207,207),e1._create("equal",205,208,208),e1._create("equal",205,206,206),e1._create("equal",205,207,207),e1._create("equal",205,205,205),e1._create("notEqual",205,208,208),e1._create("notEqual",205,206,206),e1._create("notEqual",205,207,207),e1._create("notEqual",205,205,205),e1._create("any",eF.BOOL,205),e1._create("all",eF.BOOL,205),e1._create("not",205,205),e1._create("textureSize",eF.IVEC2,210,eF.INT),e1._create("textureSize",eF.IVEC3,211,eF.INT),e1._create("textureSize",eF.IVEC2,212,eF.INT),e1._create("textureSize",eF.IVEC2,eF.SAMPLER2D_SHADOW,eF.INT),e1._create("textureSize",eF.IVEC2,eF.SAMPLER_CUBE_SHADOW,eF.INT),e1._create("textureSize",eF.IVEC3,213,eF.INT),e1._create("textureSize",eF.IVEC3,eF.SAMPLER2D_ARRAY_SHADOW,eF.INT),e1._create("texture2D",209,210,eF.VEC2),e1._create("texture2D",209,210,eF.VEC2,eF.FLOAT),e1._create("texture",209,210,eF.VEC2,eF.FLOAT),e1._create("texture",209,210,eF.VEC2),e1._create("texture",209,211,eF.VEC3,eF.FLOAT),e1._create("texture",209,211,eF.VEC3),e1._create("texture",209,212,eF.VEC3,eF.FLOAT),e1._create("texture",209,212,eF.VEC3),e1._create("texture",eF.FLOAT,eF.SAMPLER2D_SHADOW,eF.VEC3,eF.FLOAT),e1._create("texture",eF.FLOAT,eF.SAMPLER2D_SHADOW,eF.VEC3),e1._create("texture",eF.FLOAT,eF.SAMPLER_CUBE_SHADOW,eF.VEC4,eF.FLOAT),e1._create("texture",eF.FLOAT,eF.SAMPLER_CUBE_SHADOW,eF.VEC4),e1._create("texture",209,eF.SAMPLER2D_ARRAY,eF.VEC3,eF.FLOAT),e1._create("texture",209,eF.SAMPLER2D_ARRAY,eF.VEC3),e1._create("texture",eF.FLOAT,eF.SAMPLER2D_ARRAY_SHADOW,eF.VEC4),e1._create("textureProj",209,210,eF.VEC3,eF.FLOAT),e1._create("textureProj",209,210,eF.VEC3),e1._create("textureProj",209,210,eF.VEC4,eF.FLOAT),e1._create("textureProj",209,210,eF.VEC4),e1._create("textureProj",209,211,eF.VEC4,eF.FLOAT),e1._create("textureProj",209,211,eF.VEC4),e1._create("textureProj",eF.FLOAT,eF.SAMPLER2D_SHADOW,eF.VEC4,eF.FLOAT),e1._create("textureProj",eF.FLOAT,eF.SAMPLER2D_SHADOW,eF.VEC4),e1._create("textureLod",209,210,eF.VEC2,eF.FLOAT),e1._create("textureLod",209,211,eF.VEC3,eF.FLOAT),e1._create("textureLod",209,212,eF.VEC3,eF.FLOAT),e1._create("textureLod",eF.FLOAT,eF.SAMPLER2D_SHADOW,eF.VEC3,eF.FLOAT),e1._create("textureLod",209,213,eF.VEC3,eF.FLOAT),e1._create("texture2DLod",209,210,eF.VEC2,eF.FLOAT),e1._create("texture2DLodEXT",209,210,eF.VEC2,eF.FLOAT),e1._create("texture2DLodEXT",209,211,eF.VEC3,eF.FLOAT),e1._create("textureCube",209,212,eF.VEC3),e1._create("textureCube",209,212,eF.VEC3,eF.FLOAT),e1._create("textureCubeLod",209,212,eF.VEC3,eF.FLOAT),e1._create("textureCubeLodEXT",209,212,eF.VEC3,eF.FLOAT),e1._create("textureOffset",209,210,eF.VEC2,eF.IVEC2,eF.FLOAT),e1._create("textureOffset",209,210,eF.VEC2,eF.IVEC2),e1._create("textureOffset",209,211,eF.VEC3,eF.IVEC3,eF.FLOAT),e1._create("textureOffset",209,211,eF.VEC3,eF.IVEC3),e1._create("textureOffset",eF.FLOAT,eF.SAMPLER2D_SHADOW,eF.VEC3,eF.IVEC2,eF.FLOAT),e1._create("textureOffset",eF.FLOAT,eF.SAMPLER2D_SHADOW,eF.VEC3,eF.IVEC2),e1._create("textureOffset",209,213,eF.VEC3,eF.IVEC2,eF.FLOAT),e1._create("textureOffset",209,213,eF.VEC3,eF.IVEC2),e1._create("texelFetch",209,210,eF.IVEC2,eF.INT),e1._create("texelFetch",209,211,eF.IVEC3,eF.INT),e1._create("texelFetch",209,213,eF.IVEC3,eF.INT),e1._create("texelFetchOffset",209,210,eF.IVEC2,eF.INT,eF.IVEC2),e1._create("texelFetchOffset",209,211,eF.IVEC3,eF.INT,eF.IVEC3),e1._create("texelFetchOffset",209,213,eF.IVEC3,eF.INT,eF.IVEC2),e1._create("textureProjOffset",209,210,eF.VEC3,eF.IVEC2,eF.FLOAT),e1._create("textureProjOffset",209,210,eF.VEC3,eF.IVEC2),e1._create("textureProjOffset",209,210,eF.VEC4,eF.IVEC2,eF.FLOAT),e1._create("textureProjOffset",209,210,eF.VEC4,eF.IVEC2),e1._create("textureProjOffset",209,211,eF.VEC4,eF.IVEC3,eF.FLOAT),e1._create("textureProjOffset",209,211,eF.VEC4,eF.IVEC3),e1._create("textureProjOffset",eF.FLOAT,eF.SAMPLER2D_SHADOW,eF.VEC4,eF.IVEC2,eF.FLOAT),e1._create("textureProjOffset",eF.FLOAT,eF.SAMPLER2D_SHADOW,eF.VEC4,eF.IVEC2),e1._create("textureLodOffset",209,210,eF.VEC2,eF.FLOAT,eF.IVEC2),e1._create("textureLodOffset",209,211,eF.VEC3,eF.FLOAT,eF.IVEC3),e1._create("textureLodOffset",eF.FLOAT,eF.SAMPLER2D_SHADOW,eF.VEC3,eF.FLOAT,eF.IVEC2),e1._create("textureLodOffset",209,213,eF.VEC3,eF.FLOAT,eF.IVEC2),e1._create("textureProjLod",209,210,eF.VEC3,eF.FLOAT),e1._create("textureProjLod",209,210,eF.VEC4,eF.FLOAT),e1._create("textureProjLod",209,211,eF.VEC4,eF.FLOAT),e1._create("textureProjLod",eF.FLOAT,eF.SAMPLER2D_SHADOW,eF.VEC4,eF.FLOAT),e1._create("textureProjLodOffset",209,210,eF.VEC3,eF.FLOAT,eF.IVEC2),e1._create("textureProjLodOffset",209,210,eF.VEC4,eF.FLOAT,eF.IVEC2),e1._create("textureProjLodOffset",209,211,eF.VEC4,eF.FLOAT,eF.IVEC3),e1._create("textureProjLodOffset",eF.FLOAT,eF.SAMPLER2D_SHADOW,eF.VEC4,eF.FLOAT,eF.IVEC2),e1._create("textureGrad",209,210,eF.VEC2,eF.VEC2,eF.VEC2),e1._create("textureGrad",209,211,eF.VEC3,eF.VEC3,eF.VEC3),e1._create("textureGrad",209,212,eF.VEC3,eF.VEC3,eF.VEC3),e1._create("textureGrad",eF.FLOAT,eF.SAMPLER2D_SHADOW,eF.VEC3,eF.VEC2,eF.VEC2),e1._create("textureGrad",eF.FLOAT,eF.SAMPLER_CUBE_SHADOW,eF.VEC4,eF.VEC3,eF.VEC3),e1._create("textureGrad",209,213,eF.VEC3,eF.VEC2,eF.VEC2),e1._create("textureGrad",eF.FLOAT,eF.SAMPLER2D_ARRAY_SHADOW,eF.VEC4,eF.VEC2,eF.VEC2),e1._create("textureGradOffset",209,210,eF.VEC2,eF.VEC2,eF.VEC2,eF.IVEC2),e1._create("textureGradOffset",209,211,eF.VEC3,eF.VEC3,eF.VEC3,eF.IVEC3),e1._create("textureGradOffset",eF.FLOAT,eF.SAMPLER2D_SHADOW,eF.VEC3,eF.VEC2,eF.VEC2,eF.IVEC2),e1._create("textureGradOffset",209,213,eF.VEC3,eF.VEC2,eF.VEC2,eF.IVEC2),e1._create("textureGradOffset",eF.FLOAT,eF.SAMPLER2D_ARRAY_SHADOW,eF.VEC3,eF.VEC2,eF.VEC2,eF.IVEC2),e1._create("textureProjGrad",209,210,eF.VEC3,eF.VEC2,eF.VEC2),e1._create("textureProjGrad",209,210,eF.VEC4,eF.VEC2,eF.VEC2),e1._create("textureProjGrad",209,211,eF.VEC4,eF.VEC3,eF.VEC3),e1._create("textureProjGrad",eF.FLOAT,eF.SAMPLER2D_SHADOW,eF.VEC4,eF.VEC2,eF.VEC2),e1._create("textureProjGradOffset",209,210,eF.VEC3,eF.VEC2,eF.VEC2,eF.IVEC2),e1._create("textureProjGradOffset",209,210,eF.VEC4,eF.VEC2,eF.VEC2,eF.IVEC2),e1._create("textureProjGradOffset",209,211,eF.VEC4,eF.VEC3,eF.VEC3,eF.IVEC3),e1._create("textureProjGradOffset",eF.FLOAT,eF.SAMPLER2D_SHADOW,eF.VEC4,eF.VEC2,eF.VEC2,eF.IVEC2),e1._createWithScope("dFdx",200,eZ.FRAGMENT,200),e1._createWithScope("dFdy",200,eZ.FRAGMENT,200),e1._createWithScope("fwidth",200,eZ.FRAGMENT,200);var e3=new Map,e4=/*#__PURE__*/function(){function e(e,t,r){this.type=e,this.lexeme=t,this.scope=r}return e.createVariable=function(t,r,n){void 0===n&&(n=eZ.ALL);var i=new e(r,t,n);e3.set(t,i)},e.getVar=function(e){return e3.get(e)},e}();e4.createVariable("gl_VertexID",eF.INT,eZ.VERTEX),e4.createVariable("gl_InstanceID",eF.INT,eZ.VERTEX),e4.createVariable("gl_Position",eF.VEC4,eZ.VERTEX),e4.createVariable("gl_PointSize",eF.FLOAT,eZ.VERTEX),e4.createVariable("gl_FragCoord",eF.VEC4,eZ.FRAGMENT),e4.createVariable("gl_FrontFacing",eF.BOOL,eZ.FRAGMENT),e4.createVariable("gl_FragDepth",eF.FLOAT,eZ.FRAGMENT),e4.createVariable("gl_PointCoord",eF.VEC2,eZ.FRAGMENT),e4.createVariable("gl_FragColor",eF.VEC4,eZ.FRAGMENT),e4.createVariable("gl_FragData",eF.VEC4_ARRAY,eZ.FRAGMENT),e4.createVariable("gl_MaxVertexAttribs",eF.INT),e4.createVariable("gl_MaxVertexUniformVectors",eF.INT),e4.createVariable("gl_MaxVertexOutputVectors",eF.INT),e4.createVariable("gl_MaxFragmentInputVectors",eF.INT),e4.createVariable("gl_MaxVertexTextureImageUnits",eF.INT),e4.createVariable("gl_MaxCombinedTextureImageUnits",eF.INT),e4.createVariable("gl_MaxTextureImageUnits",eF.INT),e4.createVariable("gl_MaxFragmentUniformVectors",eF.INT),e4.createVariable("gl_MaxDrawBuffers",eF.INT),e4.createVariable("gl_MinProgramTexelOffset",eF.INT),e4.createVariable("gl_MaxProgramTexelOffset",eF.INT);var e9=/*#__PURE__*/function(){function e(){this._table=new Map}var t=e.prototype;return t.insert=function(e,t){void 0===t&&(t=!1),e.isInMacroBranch=t;for(var n,i=null!=(n=this._table.get(e.ident))?n:[],a=0,o=i.length;a<o;a++)if(!i[a].isInMacroBranch&&i[a].equal(e)){r.Logger.warn("Replace symbol:",e.ident),i[a]=e;return}i.push(e),this._table.set(e.ident,i)},t.getSymbol=function(e,t){void 0===t&&(t=!1);var r=this._table.get(e.ident);if(r)for(var n=r.length-1;n>=0;n--){var i=r[n];if((t||!i.isInMacroBranch)&&i.equal(e))return i}},t.getSymbols=function(e,t,r){return void 0===t&&(t=!1),r.length=0,this._getSymbols(e,t,r),r},t._getSymbols=function(e,t,r){void 0===t&&(t=!1);var n=this._table.get(e.ident);if(n)for(var i=n.length-1;i>=0;i--){var a=n[i];(t||!a.isInMacroBranch)&&a.equal(e)&&r.push(a)}return r},t.forEach=function(e){for(var t,r=l(this._table.values());!(t=r()).done;)for(var n=t.value,i=0,a=n.length;i<a;i++)e(n[i])},e}(),e5=/*#__PURE__*/function(){function e(){this.stack=[],this._macroLevel=0}var t=e.prototype;return t.pushScope=function(e){this.stack.push(e)},t.clear=function(){this.stack.length=0},t.popScope=function(){return this.stack.pop()},t.insert=function(e){this.scope.insert(e,this.isInMacroBranch)},t.lookup=function(e,t){void 0===t&&(t=!1);for(var r=this.stack.length-1;r>=0;r--){var n=this.stack[r].getSymbol(e,t);if(n)return n}},t.lookupAll=function(e,t,r){void 0===t&&(t=!1),r.length=0;for(var n=this.stack.length-1;n>=0;n--)this.stack[n]._getSymbols(e,t,r);return r},s(e,[{key:"scope",get:function(){return this.stack[this.stack.length-1]}},{key:"isInMacroBranch",get:function(){return this._macroLevel>0}}]),e}(),e6=function(e,t,r){this.type=e,this.typeLexeme=t,this.arraySpecifier=r},e7=((m={})[m.VAR=0]="VAR",m[m.FN=1]="FN",m[m.STRUCT=2]="STRUCT",m[m.Any=3]="Any",m),e8=/*#__PURE__*/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}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}(),te=/*#__PURE__*/function(e){function t(t,r){var n=new e6(r.protoType.returnType.type,r.protoType.returnType.typeSpecifier.lexeme);return e.call(this,t,e7.FN,r,n)||this}return a(t,e),t}(e8),tt=/*#__PURE__*/function(e){function t(t,r){return e.call(this,t,e7.STRUCT,r)||this}return a(t,e),t}(e8),tr=/*#__PURE__*/function(e){function t(t,r,n,i){var a;return(a=e.call(this,t,e7.VAR,i,r)||this).isGlobalVariable=n,a}return a(t,e),t}(e8),tn=/*#__PURE__*/function(){function e(){this.globalPrecisions=[],this.globalMacroDeclarations=[]}return e.prototype.getOuterGlobalMacroDeclarations=function(){return this.globalMacroDeclarations.filter(function(e){return n(e.parent,eD.GLShaderProgram)})},e}(),ti=/*#__PURE__*/function(){function e(){this.semanticStack=[],this.acceptRule=void 0,this.symbolTableStack=new e5,this.curFunctionInfo={},this._shaderData=new tn,this._translationRuleTable=new Map,this.pushScope()}var t=e.prototype;return t.reset=function(e){this._macroDefineList=e,this.semanticStack.length=0,this._shaderData=new tn,this.symbolTableStack.clear(),this.pushScope()},t.pushScope=function(){this.symbolTableStack.pushScope(new e9)},t.popScope=function(){return this.symbolTableStack.popScope()},t.addTranslationRule=function(e,t){this._translationRuleTable.set(e,t)},t.getTranslationRule=function(e){return this._translationRuleTable.get(e)},t.reportError=function(e,t){console.error(t)},t.reportWarning=function(e,t){r.Logger.warn(new eK(eY.CompilationWarn,t,e,tD._processingPassText).toString())},s(e,[{key:"shaderData",get:function(){return this._shaderData}},{key:"macroDefineList",get:function(){return this._macroDefineList}}]),e}();ti._lookupSymbol=new e8("",null);var ta=function(e,t,r){this.type=e,this.typeLexeme=t,this.arraySpecifier=r},to=function(e,t,r,n){void 0===n&&(n=!1),this.typeInfo=e,this.ident=t,this.mrtIndex=r,this.isInMacroBranch=n};function ts(e){return function(t){t.prototype.nt=e,t.pool=eB.createObjectPool(t)}}var tc=/*#__PURE__*/function(){function e(){}var t=e.prototype;return t.set=function(t,r){this._location=t,this._children=r;for(var i,a=l(r);!(i=a()).done;){var o=i.value;n(o,e)&&(o._parent=this)}this.init()},t.init=function(){},t.dispose=function(){},t.setCache=function(e){return this._codeCache=e,e},t.getCache=function(){return this._codeCache},t.codeGen=function(e){var t=e.defaultCodeGen(this.children);return this.setCache(t),t},t.semanticAnalyze=function(e){},s(e,[{key:"parent",get:function(){return this._parent}},{key:"children",get:function(){return this._children}},{key:"location",get:function(){return this._location}}]),e}();(S=eD||(eD={}))._unwrapToken=function(e){if(n(e,eU))return e;throw"not token"},S.get=function(e,t,r,n){var i=e.get();i.set(r,n),i.semanticAnalyze(t),t.semanticStack.push(i)},v=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(tc),S.TrivialNode=v,v=u([ts(eH._ignore)],v),E=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){e.pushScope()},t}(tc),S.ScopeBrace=E,E=u([ts(eH.scope_brace)],E),C=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){e.popScope()},t}(tc),S.ScopeEndBrace=C,C=u([ts(eH.scope_end_brace)],C),g=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(t,e);var r=t.prototype;return r.init=function(){this.isFragReturnStatement=!1},r.semanticAnalyze=function(e){S._unwrapToken(this.children[0]).type===eF.RETURN&&(e.curFunctionInfo.returnStatement=this)},r.codeGen=function(e){return this.setCache(e.visitJumpStatement(this))},t}(tc),S.JumpStatement=g,g=u([ts(eH.jump_statement)],g),y=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.init=function(){this._type=void 0},s(t,[{key:"type",get:function(){var e;return null!=(e=this._type)?e:3e3},set:function(e){this._type=e}}]),t}(tc),S.ExpressionAstNode=y,A=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(t,e);var r=t.prototype;return r.init=function(){this.typeSpecifier=void 0,this.arraySpecifier=void 0},r.semanticAnalyze=function(e){var t,r=this.children,n=r.length,i=r[0],a=i.typeSpecifier;this.typeSpecifier=a,this.arraySpecifier=a.arraySpecifier;var o=r[1];if(2===n||4===n){var s=new ta(i.type,a.lexeme,this.arraySpecifier),c=r[3];t=new tr(o.lexeme,s,!1,c)}else{var l=r[2];this.arraySpecifier=l;var u=new ta(i.type,a.lexeme,this.arraySpecifier),p=r[4];t=new tr(o.lexeme,u,!1,p)}e.symbolTableStack.insert(t)},r.codeGen=function(e){return this.setCache(e.visitSingleDeclaration(this))},t}(tc),S.SingleDeclaration=A,A=u([ts(eH.single_declaration)],A),x=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){var t=this.children;this.typeSpecifier=1===t.length?t[0]:t[1],this.type=this.typeSpecifier.type},t}(tc),S.FullySpecifiedType=x,x=u([ts(eH.fully_specified_type)],x),b=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(tc),S.TypeQualifier=b,b=u([ts(eH.type_qualifier)],b),T=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){var t=this.children[0];n(t,eU)?this.qualifier=t.type:this.qualifier=t.qualifier,this.lexeme=t.lexeme},t}(tc),S.SingleTypeQualifier=T,T=u([ts(eH.single_type_qualifier)],T),O=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(t,e);var r=t.prototype;return r.init=function(){this.arraySize=void 0},r.semanticAnalyze=function(e){var t,r=this.children,n=r[0];this.type=n.type,this.lexeme=n.lexeme,this.arraySize=null==r?void 0:null==(t=r[1])?void 0:t.size,this.isCustom="string"==typeof this.type},s(t,[{key:"arraySpecifier",get:function(){return this.children[1]}}]),t}(tc),S.TypeSpecifier=O,O=u([ts(eH.type_specifier)],O),I=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){var t=this.children[1];this.size=t.value},t}(tc),S.ArraySpecifier=I,I=u([ts(eH.array_specifier)],I),L=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){var t=this.children[0];switch(this.lexeme=t.lexeme,t.type){case eG.PLUS:this.compute=function(e,t){return e+t};break;case eG.DASH:this.compute=function(e,t){return e-t};break;case eG.STAR:this.compute=function(e,t){return e*t};break;case eG.SLASH:this.compute=function(e,t){return e/t};break;case eG.PERCENT:this.compute=function(e,t){return e%t};break;default:e.reportError(t.location,"not implemented operator "+t.lexeme)}},t}(tc),S.IntegerConstantExpressionOperator=L,L=u([ts(eH.integer_constant_expression_operator)],L),R=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(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];n(t,eU)&&(this.value=Number(t.lexeme))}},t}(tc),S.IntegerConstantExpression=R,R=u([ts(eH.integer_constant_expression)],R),P=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.init=function(){var e=this.children[0];n(e,eU)?(this.type=e.lexeme,this.lexeme=e.lexeme):n(e,eL)?(this.type=3e3,this.lexeme=e.macroName):(this.type=e.type,this.lexeme=e.lexeme)},t}(tc),S.TypeSpecifierNonArray=P,P=u([ts(eH.type_specifier_nonarray)],P),M=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.init=function(){var e=this.children[0];this.type=e.type,this.lexeme=e.lexeme},t}(tc),S.ExtBuiltinTypeSpecifierNonArray=M,M=u([ts(eH.ext_builtin_type_specifier_nonarray)],M),N=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){var t,r=this.children,n=r.length;if(1===n){var i=r[0],a=i.typeSpecifier,o=i.arraySpecifier;this.typeInfo=new ta(a.type,a.lexeme,o)}else{var s=r[0];this.typeInfo=s.typeInfo}if(3===n||5===n)t=new tr(r[2].lexeme,this.typeInfo,!1,this),e.symbolTableStack.insert(t);else if(4===n||6===n){var c=this.typeInfo,l=this.children[3];c.arraySpecifier=l,t=new tr(r[2].lexeme,c,!1,this),e.symbolTableStack.insert(t)}},t}(tc),S.InitDeclaratorList=N,N=u([ts(eH.init_declarator_list)],N),D=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.idList=[],t}a(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}(tc),S.IdentifierList=D,D=u([ts(eH.identifier_list)],D),V=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.codeGen=function(e){return this.setCache(e.visitDeclaration(this))},t}(tc),S.Declaration=V,V=u([ts(eH.declaration)],V),k=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(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}(tc),S.FunctionProtoType=k,k=u([ts(eH.function_prototype)],k),G=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){e.curFunctionInfo.returnStatement=null,e.curFunctionInfo.header=this;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},t}(tc),S.FunctionDeclarator=G,G=u([ts(eH.function_declarator)],G),F=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(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 this.setCache(e.visitFunctionHeader(this))},t}(tc),S.FunctionHeader=F,F=u([ts(eH.function_header)],F),B=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.parameterInfoList=[],t.paramSig=[],t}a(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,i=this.parameterInfoList,a=this.paramSig;if(n(r[0],H)){var o,s,c=r[0];i.push({ident:c.ident,typeInfo:c.typeInfo,astNode:c}),a.push(null!=(s=null==(o=c.typeInfo)?void 0:o.type)?s:3e3)}else if(n(r[2],H)){var l,u,p=r[0],h=r[2];i.push.apply(i,[].concat(p.parameterInfoList,[{ident:h.ident,typeInfo:h.typeInfo,astNode:h}])),a.push.apply(a,[].concat(p.paramSig,[null!=(u=null==(l=h.typeInfo)?void 0:l.type)?u:3e3]))}else n(r[0],t)&&n(r[1],U)?(i.push.apply(i,[].concat(r[0].parameterInfoList,[{astNode:r[1]}])),a.push.apply(a,[].concat(r[0].paramSig,[3e3]))):n(r[0],U)&&(i.push({astNode:r[0]}),a.push(3e3))},r.codeGen=function(e){return this.setCache(e.visitFunctionParameterList(this))},t}(tc),S.FunctionParameterList=B,B=u([ts(eH.function_parameter_list)],B),W=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(tc),S.MacroParamCaseList=W,W=u([ts(eH.macro_param_case_list)],W),U=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(tc),S.MacroParamBlock=U,U=u([ts(eH.macro_param_block)],U),w=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(tc),S.MacroParameterBranch=w,w=u([ts(eH.macro_parameter_branch)],w),H=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(t,e);var r=t.prototype;return r.init=function(){this.typeInfo=void 0,this.ident=void 0},r.semanticAnalyze=function(e){var t,r=this.children;if(n(r[0],j)?t=r[0]:n(r[1],j)&&(t=r[1]),t){this.typeInfo=t.typeInfo,this.ident=t.ident;var i=new tr(t.ident.lexeme,t.typeInfo,!1,t);e.symbolTableStack.insert(i)}},t}(tc),S.ParameterDeclaration=H,H=u([ts(eH.parameter_declaration)],H),j=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(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 ta(r.type,r.lexeme,n)},t}(tc),S.ParameterDeclarator=j,j=u([ts(eH.parameter_declarator)],j),z=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(tc),S.CompoundStatementNoScope=z,z=u([ts(eH.compound_statement_no_scope)],z),q=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.codeGen=function(e){return this.setCache(e.visitStatementList(this))},t}(tc),S.StatementList=q,q=u([ts(eH.statement_list)],q),X=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(t,e);var r=t.prototype;return r.init=function(){this.returnStatement=void 0},r.semanticAnalyze=function(e){var t=this.children;this.protoType=t[0],this.statements=t[1],e.popScope();var r=new te(this.protoType.ident.lexeme,this);e.symbolTableStack.insert(r),this.isInMacroBranch=e.symbolTableStack.isInMacroBranch;var n=e.curFunctionInfo,i=n.header,a=n.returnStatement;i.returnType.type===eF.VOID?a&&e.reportError(i.returnType.location,"Return in void function."):a?this.returnStatement=a:e.reportError(i.returnType.location,"No return statement found."),n.header=void 0,n.returnStatement=void 0},r.codeGen=function(e){return this.setCache(e.visitFunctionDefinition(this))},t}(tc),S.FunctionDefinition=X,X=u([ts(eH.function_definition)],X),Q=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(t,e);var r=t.prototype;return r.semanticAnalyze=function(e){this.type=this.children[0].type},r.codeGen=function(e){return this.setCache(e.visitFunctionCall(this))},t}(y),S.FunctionCall=Q,Q=u([ts(eH.function_call)],Q),K=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(t,e);var r=t.prototype;return r.init=function(){e.prototype.init.call(this),this.fnSymbol=void 0},r.semanticAnalyze=function(e){var t=this.children[0];if(t.isBuiltin)this.type=t.ident;else{var r,i,a=t.ident;if(4===this.children.length){var o=this.children[2];n(o,Y)&&(i=o.paramSig)}var s=ti._lookupSymbol;s.set(a,e7.FN,void 0,void 0,i);var c=e.symbolTableStack.lookup(s,!0);if(!c)return;this.type=null==c?void 0:null==(r=c.dataType)?void 0:r.type,this.fnSymbol=c}},t}(y),S.FunctionCallGeneric=K,K=u([ts(eH.function_call_generic)],K),Y=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.paramSig=[],t.paramNodes=[],t}a(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,i=this.paramSig,a=this.paramNodes;if(n(r[0],er)){var o=r[0];i.push(o.type),a.push(o)}else if(n(r[2],er)){var s=r[0],c=r[2];i.push.apply(i,[].concat(s.paramSig,[c.type])),a.push.apply(a,[].concat(s.paramNodes,[c]))}else n(r[0],t)&&n(r[1],$)?(i.push.apply(i,[].concat(r[0].paramSig,[3e3])),a.push.apply(a,[].concat(r[0].paramNodes,[r[1]]))):n(r[0],$)&&(i.push(3e3),a.push(r[0]))},t}(tc),S.FunctionCallParameterList=Y,Y=u([ts(eH.function_call_parameter_list)],Y),J=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(tc),S.MacroCallArgCaseList=J,J=u([ts(eH.macro_call_arg_case_list)],J),$=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(tc),S.MacroCallArgBlock=$,$=u([ts(eH.macro_call_arg_block)],$),Z=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(tc),S.MacroCallArgBranch=Z,Z=u([ts(eH.macro_call_arg_branch)],Z),ee=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){e.symbolTableStack.isInMacroBranch||e.shaderData.globalPrecisions.push(this)},t}(tc),S.PrecisionSpecifier=ee,ee=u([ts(eH.precision_specifier)],ee),et=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(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 this.setCache(e.visitFunctionIdentifier(this))},t}(tc),S.FunctionIdentifier=et,et=u([ts(eH.function_identifier)],et),er=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(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}(y),S.AssignmentExpression=er,er=u([ts(eH.assignment_expression)],er),en=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(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}(y),S.Expression=en,en=u([ts(eH.expression)],en),ei=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){if(1===this.children.length){var t,r=this.children[0];if(n(r,em))this.type=null!=(t=r.typeInfo)?t:3e3;else switch(r.type){case eG.INT_CONSTANT:this._type=eF.INT;break;case eG.FLOAT_CONSTANT:this.type=eF.FLOAT;break;case eF.True:case eF.False:this.type=eF.BOOL}}else{var i=this.children[1];this.type=i.type}},t}(y),S.PrimaryExpression=ei,ei=u([ts(eH.primary_expression)],ei),ea=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(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.codeGen=function(e){return this.setCache(e.visitPostfixExpression(this))},t}(y),S.PostfixExpression=ea,ea=u([ts(eH.postfix_expression)],ea),eo=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(t,e);var r=t.prototype;return r.init=function(){this.ident=void 0},r.semanticAnalyze=function(e){var t=this.children;this.isInMacroBranch=e.symbolTableStack.isInMacroBranch,6===t.length?(this.ident=t[1],e.symbolTableStack.insert(new tt(this.ident.lexeme,this)),this.propList=t[3].propList,this.macroExpressions=t[3].macroExpressions):(this.propList=t[2].propList,this.macroExpressions=t[2].macroExpressions)},r.codeGen=function(e){return this.setCache(e.visitStructSpecifier(this))},t}(tc),S.StructSpecifier=eo,eo=u([ts(eH.struct_specifier)],eo),es=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.propList=[],t.macroExpressions=[],t}a(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}(tc),S.StructDeclarationList=es,es=u([ts(eH.struct_declaration_list)],es),ec=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.props=[],t.macroExpressions=[],t}a(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,i=this.macroExpressions;if(1===t.length){for(var a=t[0],o=a.props,s=0,c=o.length;s<c;s++)o[s].isInMacroBranch=!0,r.push(o[s]);i.push.apply(i,[].concat(a.macroExpressions));return}3===t.length?(this._typeSpecifier=t[0],this._declaratorList=t[1]):(this._typeSpecifier=t[1],this._declaratorList=t[2]);var l=t[0],u=this._typeSpecifier,p=u.type,h=u.lexeme,_=e.symbolTableStack.isInMacroBranch;if(n(l,ep)){var f=t[2],d=new to(new ta(p,h),f.ident,l.index,_);r.push(d)}else{var m=this._declaratorList.declaratorList,S=m.length;r.length=S;for(var v=0;v<S;v++){var E=m[v],C=new to(new ta(p,h,E.arraySpecifier),E.ident,void 0,_);r[v]=C}}},t}(tc),S.StructDeclaration=ec,ec=u([ts(eH.struct_declaration)],ec),el=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.props=[],t.macroExpressions=[],t}a(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}(tc),S.MacroStructDeclaration=el,el=u([ts(eH.macro_struct_declaration)],el),eu=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.props=[],t.macroExpressions=[],t}a(t,e);var r=t.prototype;return r.init=function(){this.props.length=0,this.macroExpressions.length=0},r.semanticAnalyze=function(){var e,r,i,a,o=this.children,s=o[o.length-1];this.macroExpressions.push(o[0]),n(o[1],es)&&((e=this.props).push.apply(e,[].concat(o[1].propList)),(r=this.macroExpressions).push.apply(r,[].concat(o[1].macroExpressions))),n(s,t)&&((i=this.props).push.apply(i,[].concat(s.props)),(a=this.macroExpressions).push.apply(a,[].concat(s.macroExpressions))),o.length>1&&n(s,eg)&&this.macroExpressions.push(s)},t}(tc),S.MacroStructBranch=eu,eu=u([ts(eH.macro_struct_branch)],eu),ep=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){this.index=Number(this.children[4].lexeme)},t}(tc),S.LayoutQualifier=ep,ep=u([ts(eH.layout_qualifier)],ep),eh=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.declaratorList=[],t}a(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}(tc),S.StructDeclaratorList=eh,eh=u([ts(eH.struct_declarator_list)],eh),e_=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(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}(tc),S.StructDeclarator=e_,e_=u([ts(eH.struct_declarator)],e_),ef=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(t,e);var r=t.prototype;return r.init=function(){this.isStatic=!1},r.semanticAnalyze=function(e){var t=this.children,r=t[0],n=t[1];this.type=r;var i=new tr(n.lexeme,new ta(r.type,r.typeSpecifier.lexeme),!0,this);e.symbolTableStack.insert(i),4===t.length&&(this.isStatic=!0)},r.codeGen=function(t){return this.isStatic?e.prototype.codeGen.call(this,t):this.setCache(t.visitGlobalVariableDeclaration(this))},t}(tc),S.VariableDeclaration=ef,ef=u([ts(eH.variable_declaration)],ef),ed=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.variableDeclarations=[],t}a(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,i=t[0],a=i.type;if(this.type=a,n(i,ef))this.variableDeclarations.push(i);else{(o=this.variableDeclarations).push.apply(o,[].concat(i.variableDeclarations));var o,s=t[2],c=ef.pool.get();3===r?c.set(s.location,[a,s]):c.set(s.location,[a,s,t[3]]),c.semanticAnalyze(e),this.variableDeclarations.push(c)}},t}(tc),S.VariableDeclarationList=ed,ed=u([ts(eH.variable_declaration_list)],ed),em=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.referenceGlobalSymbolNames=[],t._symbols=[],t}a(t,e);var r=t.prototype;return r.init=function(){this.typeInfo=3e3,this.referenceGlobalSymbolNames.length=0,this._symbols.length=0},r.semanticAnalyze=function(e){for(var r=this.children[0],i=this.referenceGlobalSymbolNames,a=this._symbols,o=n(r,eU)?[r.lexeme]:r.referenceSymbolNames,s=0;s<o.length;s++){var c,l=o[s];if(!e.macroDefineList[l]){if(!n(r,eU)&&e1.isExist(l))continue;var u=e4.getVar(l);if(u){this.typeInfo=u.type;continue}t._lookupAndMarkGlobalReference(e,l,a,i,this.location)&&(n(r,eU)||!r.hasAstValue)&&(this.typeInfo=null==(c=a[0].dataType)?void 0:c.type)}}n(r,eU)||t._probeCrossArmShadowing(e,r,o,a,i)},r.codeGen=function(e){return this.setCache(e.visitVariableIdentifier(this))},r.getLexeme=function(e){var t=this.children[0];return n(t,eU)?t.lexeme:t.codeGen(e)},t._probeCrossArmShadowing=function(e,r,n,i,a){var o=r.macroName;o&&-1===n.indexOf(o)&&(e1.isExist(o)||e4.getVar(o)||t._lookupAndMarkGlobalReference(e,o,i,a,null))},t._lookupAndMarkGlobalReference=function(e,t,r,i,a){var o=ti._lookupSymbol;if(o.set(t,e7.Any),e.symbolTableStack.lookupAll(o,!0,r),!r.length)return!1;var s=e.symbolTableStack.scope.getSymbol(o,!0);return(s?n(s,te)||s.isGlobalVariable:r.some(function(e){return n(e,te)||e.isGlobalVariable}))&&-1===i.indexOf(t)&&i.push(t),!0},t}(tc),S.VariableIdentifier=em,em=u([ts(eH.variable_identifier)],em),eS=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.semanticAnalyze=function(e){this.shaderData=e.shaderData,this.shaderData.symbolTable=e.symbolTableStack.scope},t}(tc),S.GLShaderProgram=eS,eS=u([ts(eH.gs_shader_program)],eS),ev=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.macroExpressions=[],t}a(t,e);var r=t.prototype;return r.init=function(){this.macroExpressions.length=0},r.semanticAnalyze=function(e){var t,r=this.children[0];(n(r,eE)||n(r,eb)||n(r,eP)||n(r,eU))&&(e.shaderData.globalMacroDeclarations.push(this),n(r,eb)?(t=this.macroExpressions).push.apply(t,[].concat(r.macroExpressions)):this.macroExpressions.push(r))},t}(tc),S.GlobalDeclaration=ev,ev=u([ts(eH.global_declaration)],ev),eE=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.codeGen=function(t){return this.setCache(e.prototype.codeGen.call(this,t)+"\n")},t}(tc),S.MacroUndef=eE,eE=u([ts(eH.macro_undef)],eE),eC=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(t,e);var r=t.prototype;return r.semanticAnalyze=function(e){e.symbolTableStack._macroLevel++},r.codeGen=function(t){return this.setCache("\n"+e.prototype.codeGen.call(this,t)+"\n")},t}(tc),S.MacroPushContext=eC,eC=u([ts(eH.macro_push_context)],eC),eg=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(t,e);var r=t.prototype;return r.semanticAnalyze=function(e){e.symbolTableStack._macroLevel--},r.codeGen=function(t){return this.setCache("\n"+e.prototype.codeGen.call(this,t)+"\n")},t}(tc),S.MacroPopContext=eg,eg=u([ts(eH.macro_pop_context)],eg),ey=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.codeGen=function(t){return this.setCache("\n"+e.prototype.codeGen.call(this,t)+"\n")},t}(tc),S.MacroElifExpression=ey,ey=u([ts(eH.macro_elif_expression)],ey),eA=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t.prototype.codeGen=function(t){return this.setCache("\n"+e.prototype.codeGen.call(this,t)+"\n")},t}(tc),S.MacroElseExpression=eA,eA=u([ts(eH.macro_else_expression)],eA),ex=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.macroExpressions=[],t}a(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?this.setCache(t[0].codeGen(e)):this.setCache(t[0].codeGen(e)+"\n"+t[1].codeGen(e))},t}(tc),S.GlobalMacroDeclaration=ex,ex=u([ts(eH.global_macro_declaration)],ex),eb=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.macroExpressions=[],t}a(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}(tc),S.GlobalMacroIfStatement=eb,eb=u([ts(eH.global_macro_if_statement)],eb),eT=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.macroExpressions=[],t}a(t,e);var r=t.prototype;return r.init=function(){this.macroExpressions.length=0},r.semanticAnalyze=function(e){var r=this.children,i=r[r.length-1],a=this.macroExpressions;a.push(r[0]),n(r[1],ex)&&a.push.apply(a,[].concat(r[1].macroExpressions)),n(i,t)&&a.push.apply(a,[].concat(i.macroExpressions)),r.length>1&&n(i,eg)&&a.push(i)},t}(tc),S.GlobalMacroBranch=eT,eT=u([ts(eH.global_macro_branch)],eT),eO=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(tc),S.MacroIfStatement=eO,eO=u([ts(eH.macro_if_statement)],eO),eI=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return a(t,e),t}(tc),S.MacroBranch=eI,eI=u([ts(eH.macro_branch)],eI),eL=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.referenceSymbolNames=[],t.hasAstValue=!1,t.isFunctionLikeMacro=!1,t.aliasesNonBuiltinIdent=!1,t}a(t,e);var r=t.prototype;return r.init=function(){this.referenceSymbolNames.length=0,this.hasAstValue=!1,this.isFunctionLikeMacro=!1,this.aliasesNonBuiltinIdent=!1},r.semanticAnalyze=function(e){var r=this.children[0],i=r.lexeme;this.macroName=i;var a=r.branch,o=e.macroDefineList[i],s=this.referenceSymbolNames;s.length=0;var c=0,l=!0,u=!1,p=!0;if(o)for(var h=0,_=o.length;h<_;h++){var f=o[h];if(e$.isVisibleFrom(f.branch,a)){if(c++,null==f.valueAst&&(l=!1),f.isFunction&&(u=!0),f.valueAst&&t._collectIdentifierRefs(f.valueAst,f.params,s),f.isFunction||!f.valueAst)p=!1;else{var d=ej.unwrapBareIdentifier(f.valueAst,{allowParens:!1}),m=null==d?void 0:d.children[0],S=n(m,eU)?m.lexeme:void 0;(!S||e1.isExist(S))&&(p=!1)}}}this.hasAstValue=c>0&&l,this.isFunctionLikeMacro=u,this.aliasesNonBuiltinIdent=c>0&&p},t._collectIdentifierRefs=function(e,r,i){if(n(e,em)){var a=e.children[0];if(n(a,eU)){var o=a.lexeme;-1===r.indexOf(o)&&-1===i.indexOf(o)&&i.push(o)}return}var s=e.children;if(s)for(var c=0,l=s.length;c<l;c++){var u=s[c];n(u,tc)&&t._collectIdentifierRefs(u,r,i)}},t}(tc),S.MacroCallSymbol=eL,eL=u([ts(eH.macro_call_symbol)],eL),eR=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t.referenceSymbolNames=[],t.macroName="",t.hasAstValue=!1,t.isFunctionLikeMacro=!1,t.aliasesNonBuiltinIdent=!1,t}a(t,e);var r=t.prototype;return r.init=function(){this.referenceSymbolNames=[],this.macroName="",this.hasAstValue=!1,this.isFunctionLikeMacro=!1,this.aliasesNonBuiltinIdent=!1},r.semanticAnalyze=function(e){var t=this.children[0];this.referenceSymbolNames=t.referenceSymbolNames,this.macroName=t.macroName,this.hasAstValue=t.hasAstValue,this.isFunctionLikeMacro=t.isFunctionLikeMacro,this.aliasesNonBuiltinIdent=t.aliasesNonBuiltinIdent},r.codeGen=function(e){return this.setCache(e.visitMacroCallFunction(this))},t}(tc),S.MacroCallFunction=eR,eR=u([ts(eH.macro_call_function)],eR),eP=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(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 i=[],a=2;n(r[2],eU)&&r[2].type===eF.MACRO_DEFINE_PARAMS&&(this.isFunction=!0,i=ej.parseMacroParamList(r[2].lexeme),a=3),n(r[a],en)&&(this.valueExpression=r[a]);var o=r[1].branch,s=e.macroDefineList,c=s[this.macroName],l=null==c?void 0:c.find(function(e){var r;return!e.valueAst&&(r=e).isFunction===t.isFunction&&r.params.length===i.length&&r.params.every(function(e,t){return e===i[t]})&&e$.sameBranch(e.branch,o)});if(l)l.valueAst=this.valueExpression;else{var u={isFunction:this.isFunction,params:i,valueAst:this.valueExpression,dedupKey:this.macroName+"#ast/"+(this.isFunction?i.join(","):""),branch:o};c?c.push(u):s[this.macroName]=[u]}this.isFunction&&e.popScope()},r.codeGen=function(e){return this.setCache(e.visitMacroDefine(this))},t}(tc),S.MacroDefine=eP,eP=u([ts(eH.macro_define)],eP);var tl=/*#__PURE__*/function(){function e(){this.attributeStructs=[],this.attributeList=[],this.varyingStructs=[],this.varyingList=[],this.mrtStructs=[],this.mrtList=[],this._referencedGlobalMacroASTs=[]}var t=e.prototype;return t.reset=function(e){void 0===e&&(e=!0),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._referencedAttributeList=Object.create(null),this._referencedVaryingList=Object.create(null),this._referencedMRTList=Object.create(null),this._referencedGlobals=Object.create(null),this._referencedGlobalMacroASTs.length=0,e&&(this._structVarMap=Object.create(null))},t.isAttributeStruct=function(e){return -1!==this.attributeStructs.findIndex(function(t){return t.ident.lexeme===e})},t.isVaryingStruct=function(e){return -1!==this.varyingStructs.findIndex(function(t){return t.ident.lexeme===e})},t.isMRTStruct=function(e){return -1!==this.mrtStructs.findIndex(function(t){return t.ident.lexeme===e})},t.getStructRole=function(e){return this.isAttributeStruct(e)?"attribute":this.isVaryingStruct(e)?"varying":this.isMRTStruct(e)?"mrt":void 0},t.registerStructVar=function(e,t){this._structVarMap[e]=t},t.referenceAttribute=function(e){return this._referenceProp("attribute",e.lexeme,this.attributeList,this._referencedAttributeList,e.location)},t.referenceVarying=function(e){return this._referenceProp("varying",e.lexeme,this.varyingList,this._referencedVaryingList,e.location)},t.referenceMRTProp=function(e){return this._referenceProp("mrt",e.lexeme,this.mrtList,this._referencedMRTList,e.location)},t.referenceGlobal=function(t,r){if(!this._referencedGlobals[t]){this._referencedGlobals[t]=[];var n=e._lookupSymbol;n.set(t,r),this._passSymbolTable.getSymbols(n,!0,this._referencedGlobals[t])}},t._referenceProp=function(e,t,r,n,i){if(!n[t]){var a=r.filter(function(e){return e.ident.lexeme===t});if(!a.length)return eB.createGSError("referenced "+e+" not found: "+t,eY.CompilationError,tD._processingPassText,i);n[t]=a}},e.reset=function(){this._singleton||(this._singleton=new e),this._singleton.reset()},s(e,null,[{key:"context",get:function(){return this._singleton}}]),e}();tl._lookupSymbol=new e8("",null);var tu=/*#__PURE__*/function(){function e(){this.array=[]}return e.prototype.dispose=function(){this.array.length=0},e}(),tp=/*#__PURE__*/function(){function e(){}var t=e.prototype;return t.defaultCodeGen=function(t){var r=e._tmpArrayPool,i=r.get();i.dispose();for(var a,o=l(t);!(a=o()).done;){var s=a.value;n(s,eU)?i.array.push(s.lexeme):i.array.push(s.codeGen(this))}return r.return(i),i.array.join(" ")},t.visitPostfixExpression=function(e){var t=e.children,r=t.length,i=tl.context;if(3===r){var a=t[0],o=t[2];if(!n(o,eU))return a.codeGen(this)+"."+o.codeGen(this);var s,c=ej.extractDirectIdentLexeme(a);return(c&&(s=i._structVarMap[c]),s||(s=i.getStructRole(a.type)),s)?("attribute"===s?i.referenceAttribute(o):"varying"===s?i.referenceVarying(o):i.referenceMRTProp(o),o.lexeme):a.codeGen(this)+"."+o.lexeme}if(4===r){var l=t[0],u=t[2],p=l.codeGen(this),h=u.codeGen(this);return"gl_FragData"===p&&this._reportError(l.location,"Please use MRT struct instead of gl_FragData."),p+"["+h+"]"}return this.defaultCodeGen(e.children)},t.visitVariableIdentifier=function(e){for(var t,r=l(e.referenceGlobalSymbolNames);!(t=r()).done;){var n=t.value;tl.context.referenceGlobal(n,e7.Any)}return e.getLexeme(this)},t.visitFunctionCall=function(e){var t=e.children[0];if(n(t.fnSymbol,te)){tl.context.referenceGlobal(t.fnSymbol.ident,e7.FN);var r=t.children[2];if(n(r,eD.FunctionCallParameterList)){for(var i=r.paramNodes,a=t.fnSymbol.astNode.protoType.parameterList,o=tl.context,s=i.filter(function(e,t){var r,n=null==a?void 0:null==(r=a[t])?void 0:r.typeInfo;return!n||!o.getStructRole(n.typeLexeme)}),c="",l=0,u=s.length;l<u;l++){var p=s[l],h=p.codeGen(this);n(p,eD.MacroCallArgBlock)||0===l?c+=h:c+=", "+h}return t.fnSymbol.ident+"("+c+")"}}return this.defaultCodeGen(e.children)},t.visitMacroCallFunction=function(e){var t=e.children[2];if(!n(t,eD.FunctionCallParameterList))return this.defaultCodeGen(e.children);var r,i=t.paramNodes,a=tl.context;r=e.isFunctionLikeMacro||!e.aliasesNonBuiltinIdent?i:i.filter(function(e){if(n(e,eD.AssignmentExpression)){var t=ej.unwrapBareIdentifier(e,{allowParens:!1});if(t&&"string"==typeof t.typeInfo&&a.getStructRole(t.typeInfo))return!1}return!0});for(var o="",s=0,c=r.length;s<c;s++){var l=r[s],u=l.codeGen(this);n(l,eD.MacroCallArgBlock)||0===s?o+=u:o+=", "+u}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,eU)&&(t=r.lexeme)}var i=e.valueExpression?e.valueExpression.codeGen(this):"";return"\n#define "+e.macroName+t+(i?" "+i:"")+"\n"},t.visitSingleDeclaration=function(e){var t=e.typeSpecifier.type;return"string"==typeof t&&tl.context.referenceGlobal(t,e7.STRUCT),this.defaultCodeGen(e.children)},t.visitGlobalVariableDeclaration=function(e){var t=e.children,r=t[0];if(n(r,eD.FullySpecifiedType)&&r.typeSpecifier.isCustom){var i=tl.context;if(i.getStructRole(r.typeSpecifier.lexeme))return"";i.referenceGlobal(r.type,e7.STRUCT)}return"uniform "+this.defaultCodeGen(t)},t.visitDeclaration=function(e){var t=tl.context,r=e.children,i=r[0];if(n(i,eD.InitDeclaratorList)){var a=i.typeInfo.typeLexeme;if(t.isVaryingStruct(a)||t.isMRTStruct(a))return""}return this.defaultCodeGen(r)},t.visitFunctionParameterList=function(e){for(var t=tl.context,r=e.parameterInfoList.filter(function(e){return!e.typeInfo||!t.getStructRole(e.typeInfo.typeLexeme)}),i="",a=0,o=r.length;a<o;a++){var s=r[a].astNode,c=s.codeGen(this);n(s,eD.MacroParamBlock)||0===a?i+=c:i+=", "+c}return i},t.visitFunctionHeader=function(e){var t=e.returnType.typeSpecifier.lexeme;return tl.context.isVaryingStruct(t)?"void "+e.ident.lexeme+"(":this.defaultCodeGen(e.children)},t.visitJumpStatement=function(e){var t=e.children;if(t[0].type===eF.RETURN){var r=t[1];if(n(r,eD.Expression)){var i=ej.unwrapNodeByType(r,eH.variable_identifier);if(tl.context.isVaryingStruct(null==i?void 0:i.typeInfo))return"";var a=ej.unwrapNodeByType(r,eH.function_call);if(tl.context.isVaryingStruct(null==a?void 0:a.type))return""+r.codeGen(this)+";"}}return this.defaultCodeGen(t)},t.visitFunctionIdentifier=function(e){return this.defaultCodeGen(e.children)},t.visitStructSpecifier=function(e){var t=this,r=tl.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&&this._reportError(e.location,"cannot use same struct as Varying and Attribute"),s&&u&&this._reportError(e.location,"cannot use same struct as Varying and MRT"),c&&u&&this._reportError(e.location,"cannot use same struct as Attribute and MRT"),!s&&!c&&!u)return this.defaultCodeGen(e.children);var p=[];p.push.apply(p,[].concat(e.macroExpressions.map(function(e){return{text:n(e,eU)?e.lexeme:e.codeGen(t),index:e.location.start.index}})));for(var h,_=l(e.propList);!(h=_()).done;){var f,d,m,S=h.value,v=S.ident.lexeme;s&&(null==(f=r._referencedVaryingList[v])?void 0:f.indexOf(S))>=0?p.push({text:""+this.getVaryingProp(S)+"\n",index:S.ident.location.start.index}):c&&(null==(d=r._referencedAttributeList[v])?void 0:d.indexOf(S))>=0?p.push({text:""+this.getAttributeProp(S)+"\n",index:S.ident.location.start.index}):u&&(null==(m=r._referencedMRTList[v])?void 0:m.indexOf(S))>=0&&p.push({text:""+this.getMRTProp(S)+"\n",index:S.ident.location.start.index})}return p.sort(function(e,t){return e.index-t.index}).map(function(e){return e.text}).join("")},t.visitFunctionDefinition=function(e){return e.protoType.ident.lexeme==tl.context.stageEntry?"void main() "+e.statements.codeGen(this):this.defaultCodeGen(e.children)},t._reportError=function(e,t){console.error(t)},e}();tp._tmpArrayPool=new r.ReturnableObjectPool(tu,10);var th=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t._globalCodeArray=[],t}a(t,e);var r=t.prototype;return r.reset=function(){this._globalCodeArray.length=0,t._serializedGlobalKey.clear()},r.getOtherGlobal=function(e,t){for(var r,n=l(e.globalPrecisions);!(r=n()).done;){var i=r.value;t.push({text:i.codeGen(this),index:i.location.start.index})}},r.visitShaderProgram=function(e,t,r){tl.reset(),this.reset();var n=e.shaderData;tl.context._passSymbolTable=n.symbolTable;var i=n.getOuterGlobalMacroDeclarations();return this._collectAllStructVars(t,r),{vertex:this._vertexMain(t,n,i),fragment:this._fragmentMain(r,n,i)}},r._collectAllStructVars=function(e,r){for(var i,a=this,o=tl.context,s=t._lookupSymbol,c=o._passSymbolTable,u=Object.create(null),p=function(e,t,r){s.set(e,e7.FN);for(var n,i=c.getSymbols(s,!0,[]),a=l(i);!(n=a()).done;){var o,p,h=n.value.astNode.protoType,_=null==(o=h.parameterList)?void 0:o[0];_&&"string"==typeof(null==(p=_.typeInfo)?void 0:p.type)&&(u[_.typeInfo.typeLexeme]=t),"string"==typeof h.returnType.type&&(u[h.returnType.type]=r)}return i},h=p(e,"attribute","varying").concat(p(r,"varying","mrt")),_=function(e,t){if(e){var r=u[e];r&&o.registerStructVar(t,r)}},f=function(e){for(var t,r=l(e.children);!(t=r()).done;){var i=t.value;if(n(i,eD.InitDeclaratorList)){var s,c=null==(s=i.typeInfo)?void 0:s.typeLexeme;c&&u[c]&&a._extractLocalVarNames(i,o,u[c])}else n(i,tc)&&f(i)}},d=l(h);!(i=d()).done;){var m=i.value,S=m.astNode.protoType;if(S.parameterList)for(var v,E=l(S.parameterList);!(v=E()).done;){var C,g=v.value;g.ident&&"string"==typeof(null==(C=g.typeInfo)?void 0:C.type)&&_(g.typeInfo.typeLexeme,g.ident.lexeme)}f(m.astNode.statements)}c.forEach(function(e){var t;e.type===e7.VAR&&_(null==(t=e.dataType)?void 0:t.typeLexeme,e.ident)})},r._vertexMain=function(e,r,n){var i=this,a=tl.context;a.stage=eZ.VERTEX,a.stageEntry=e;var o=t._lookupSymbol,s=r.symbolTable;o.set(e,e7.FN);var c=s.getSymbols(o,!0,[]);if(!c.length)throw"no entry function found: "+e;var u=a.attributeStructs,p=a.attributeList,h=a.varyingStructs,_=a.varyingList;c.forEach(function(e){var t=e.astNode,r=t.protoType.returnType;if("string"==typeof r.type){o.set(r.type,e7.STRUCT);var n=s.getSymbols(o,!0,[]);if(n.length)for(var a=0;a<n.length;a++){var c=n[a].astNode;h.push(c);for(var f,d=l(c.propList);!(f=d()).done;){var m=f.value;_.push(m)}}else i._reportError(r.location,'invalid varying struct: "'+r.type+'".')}else r.type!==eF.VOID&&i._reportError(r.location,"vertex main entry can only return struct or void.");var S=t.protoType.parameterList,v=null==S?void 0:S[0];if(v){var E=v.typeInfo.type;if("string"==typeof E){o.set(E,e7.STRUCT);var C=s.getSymbols(o,!0,[]);if(C.length)for(var g=0;g<C.length;g++){var y=C[g].astNode;u.push(y);for(var A,x=l(y.propList);!(A=x()).done;){var b=A.value;p.push(b)}}else i._reportError(v.astNode.location,'invalid attribute struct: "'+E+'".')}}}),this._preRegisterGlobalMacroRefs(n);var f=this._globalCodeArray;tl.context.referenceGlobal(e,e7.FN),this._getGlobalSymbol(f),this._getCustomStruct(a.attributeStructs,f),this._getCustomStruct(a.varyingStructs,f),this._getGlobalMacroDeclarations(n,f),this.getOtherGlobal(r,f);var d=f.sort(function(e,t){return e.index-t.index}).map(function(e){return e.text}).join("\n");return tl.context.reset(!1),this.reset(),d},r._fragmentMain=function(e,r,n){var i=this,a=tl.context;a.stage=eZ.FRAGMENT,a.stageEntry=e;var o=t._lookupSymbol,s=r.symbolTable;o.set(e,e7.FN);var c=s.getSymbols(o,!0,[]);if(!(null==c?void 0:c.length))throw"no entry function found: "+e;c.forEach(function(e){var t=e.astNode,r=t.returnStatement;r&&(r.isFragReturnStatement=!0);var n=t.protoType.returnType,c=n.type,u=n.location;if("string"==typeof c){o.set(c,e7.STRUCT);var p=s.getSymbols(o,!0,[]);if(p.length)for(var h=0;h<p.length;h++){var _=p[h].astNode;a.mrtStructs.push(_);for(var f,d=l(_.propList);!(f=d()).done;){var m=f.value;a.mrtList.push(m)}}else i._reportError(u,"invalid mrt struct: "+c)}else c!==eF.VOID&&c!==eF.VEC4&&i._reportError(u,"fragment main entry can only return struct or vec4.")}),this._preRegisterGlobalMacroRefs(n);var u=this._globalCodeArray;tl.context.referenceGlobal(e,e7.FN),this._getGlobalSymbol(u),this._getCustomStruct(a.varyingStructs,u),this._getCustomStruct(a.mrtStructs,u),this._getGlobalMacroDeclarations(n,u),this.getOtherGlobal(r,u);var p=u.sort(function(e,t){return e.index-t.index}).map(function(e){return e.text}).join("\n");return a.reset(),this.reset(),p},r._extractLocalVarNames=function(e,t,r){var i=e.children;if(1===i.length){var a=i[0].children;a.length>=2&&n(a[1],eU)&&t.registerStructVar(a[1].lexeme,r)}else if(i.length>=3){var o=i[0];n(o,eD.InitDeclaratorList)&&this._extractLocalVarNames(o,t,r),n(i[2],eU)&&t.registerStructVar(i[2].lexeme,r)}},r._preRegisterGlobalMacroRefs=function(e){for(var t,r=l(e);!(t=r()).done;){var n=t.value;this._walkMacroDefineTokens(n.children)}},r._walkMacroDefineTokens=function(e){for(var t,r=l(e);!(t=r()).done;){var i=t.value;n(i,eD.MacroDefine)?i.valueExpression&&i.valueExpression.codeGen(this):n(i,tc)&&this._walkMacroDefineTokens(i.children)}},r._getGlobalSymbol=function(e){var r=tl.context._referencedGlobals,n=Object.keys(r).length;if(0!==n){for(var i in r)if(!t._serializedGlobalKey.has(i)){t._serializedGlobalKey.add(i);for(var a=r[i],o=0,s=a.length;o<s;o++){var c=a[o],l=c.astNode.codeGen(this);if(l){var u=l+(c.type===e7.VAR?";":"");c.isInMacroBranch||e.push({text:u,index:c.astNode.location.start.index})}}}Object.keys(r).length!==n&&this._getGlobalSymbol(e)}},r._getCustomStruct=function(e,t){for(var r,n=l(e);!(r=n()).done;){var i=r.value,a=i.codeGen(this);i.isInMacroBranch||t.push({text:a,index:i.location.start.index})}},r._getGlobalMacroDeclarations=function(e,t){var r=this,i=tl.context,a=i._referencedGlobals,o=i._referencedGlobalMacroASTs;o.length=0;for(var s,c=l(Object.values(a));!(s=c()).done;)for(var u,p=s.value,h=l(p);!(u=h()).done;){var _=u.value;_.isInMacroBranch&&o.push(_.astNode)}for(var f,d=l(e);!(f=d()).done;){var m=f.value,S=void 0,v=m.children[0];if(n(v,eD.GlobalMacroIfStatement)){var E=[];E.push.apply(E,[].concat(m.macroExpressions.map(function(e){return{text:n(e,eU)?e.lexeme:e.codeGen(r),index:e.location.start.index}}))),this._visitGlobalMacroIfStatement(v,E),S=E.sort(function(e,t){return e.index-t.index}).map(function(e){return e.text}).join("\n")}else S=n(v,eU)&&v.type===eF.MACRO_DEFINE_EXPRESSION?v.lexeme:m.codeGen(this);t.push({text:S,index:m.location.start.index})}},r._visitGlobalMacroIfStatement=function(e,t){for(var r=e.children,i=0;i<r.length;i++){var a=r[i];if(n(a,eD.PrecisionSpecifier))t.push({text:a.codeGen(this),index:a.location.start.index});else if(n(a,eD.FunctionDefinition))-1!==tl.context._referencedGlobalMacroASTs.indexOf(a)&&t.push({text:a.getCache(),index:a.location.start.index});else if(n(a,eD.StructSpecifier)){var o,s,c,l,u=tl.context,p=u.stage;(-1!==tl.context._referencedGlobalMacroASTs.indexOf(a)||(p===eZ.VERTEX?u.isAttributeStruct(null==(o=a.ident)?void 0:o.lexeme)||u.isVaryingStruct(null==(s=a.ident)?void 0:s.lexeme):u.isVaryingStruct(null==(c=a.ident)?void 0:c.lexeme)||u.isMRTStruct(null==(l=a.ident)?void 0:l.lexeme)))&&t.push({text:a.getCache(),index:a.location.start.index})}else if(n(a,eD.VariableDeclarationList))for(var h=a.variableDeclarations,_=0;_<h.length;_++){var f=h[_];-1!==tl.context._referencedGlobalMacroASTs.indexOf(f)&&t.push({text:f.getCache()+";",index:f.location.start.index})}n(a,tc)&&this._visitGlobalMacroIfStatement(a,t)}},t}(tp);th._lookupSymbol=new e8("",null),th._serializedGlobalKey=new Set;var t_=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}a(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 null},r.visitPostfixExpression=function(t){var r=t.children,i=r[0],a=tl.context;if(n(i,eD.PostfixExpression)&&a.isMRTStruct(i.type)){var o=r[2],s=a.mrtList.find(function(e){return e.ident.lexeme===o.lexeme});return s?"gl_FragData["+s.mrtIndex+"]":(this._reportError(o.location,"not found mrt property: "+o.lexeme),"")}return e.prototype.visitPostfixExpression.call(this,t)},r.visitJumpStatement=function(t){return t.isFragReturnStatement?tl.context.mrtStructs.length?"":"gl_FragColor = "+t.children[1].codeGen(this)+";":e.prototype.visitJumpStatement.call(this,t)},t.getVisitor=function(){return this._singleton||(this._singleton=new t),this._singleton},t}(th),tf="GS_glFragColor",td=/*#__PURE__*/function(e){function t(){var t;return t=e.apply(this,arguments)||this,t._otherCodeArray=[],t._fragColorVariableRegistered=!1,t}a(t,e);var r=t.prototype;return r.reset=function(){e.prototype.reset.call(this),this._otherCodeArray.length=0,this._fragColorVariableRegistered=!1},r.getOtherGlobal=function(t,r){e.prototype.getOtherGlobal.call(this,t,r);for(var n=0,i=this._otherCodeArray.length;n<i;n++)r.push(this._otherCodeArray[n])},r.getAttributeProp=function(e){return"in "+e.typeInfo.typeLexeme+" "+e.ident.lexeme+";"},r.getVaryingProp=function(e){return(tl.context.stage===eZ.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(e){var t=e.children;if(1!==t[0].children.length)return this.defaultCodeGen(t);var r=e.lexeme;switch(e.ident){case"texture2D":case"textureCube":r="texture";break;case"texture2DProj":r="textureProj";break;case"texture2DLodEXT":case"textureCubeLodEXT":r="textureLod";break;case"texture2DGradEXT":case"textureCubeGradEXT":r="textureGrad";break;case"texture2DProjLodEXT":r="textureProjLod";break;case"texture2DProjGradEXT":r="textureProjGrad";break;case"gl_FragDepthEXT":r="gl_FragDepth"}return r},r.visitVariableIdentifier=function(t){var r=tl.context;if(r.stage===eZ.FRAGMENT&&"gl_FragColor"===t.getLexeme(this)){if(r.mrtStructs.length){this._reportError(t.location,"gl_FragColor cannot be used with MRT (Multiple Render Targets).");return}return this._registerFragColorVariable(),tf}return e.prototype.visitVariableIdentifier.call(this,t)},r.visitJumpStatement=function(t){return t.isFragReturnStatement?tl.context.mrtStructs.length?"":(this._registerFragColorVariable(),tf+" = "+t.children[1].codeGen(this)+";"):e.prototype.visitJumpStatement.call(this,t)},r._registerFragColorVariable=function(){this._fragColorVariableRegistered||(this._otherCodeArray.push({text:"out vec4 "+tf+";",index:0}),this._fragColorVariableRegistered=!0)},t.getVisitor=function(){return this._singleton||(this._singleton=new t),this._singleton},t}(th),tm={Text:0,IfDef:1,IfNdef:2,IfCmp:3,IfExpr:4,Else:5,Endif:6,Define:7,DefineVal:8,DefineFunc:9,Undef:10},tS=/*#__PURE__*/function(){function e(){}return e.parse=function(t){for(var r=[],n=t.length,i=0,a=[];i<n;){var o=e._findDirectiveStart(t,i,n);if(-1===o){e._pushText(r,t,i,n);break}o>i&&e._pushText(r,t,i,o);var s=t.indexOf("\n",o);-1===s&&(s=n);var c=t.substring(o,s);i=s<n?s+1:n;var l=e._DIRECTIVE_RE.exec(c);if(!l){var u=r.length>0?r[r.length-1]:null,p=s<n?c+"\n":c;u&&u[0]===tm.Text?u[1]+=p:r.push([tm.Text,p]);continue}var h=l[1],_=l[2].trim();switch(h){case"ifdef":var f=r.length;r.push([tm.IfDef,_,-1]),a.push([f]);break;case"ifndef":var d=r.length;r.push([tm.IfNdef,_,-1]),a.push([d]);break;case"if":var m=e._parseCondition(_),S=r.length;e._pushConditionInstruction(r,m),a.push([S]);break;case"elif":var v=a[a.length-1],E=v[v.length-1],C=r.length;r.push([tm.Else,-1]),v.push(C),e._backfillJump(r[E],r.length);var g=e._parseCondition(_),y=r.length;e._pushConditionInstruction(r,g),v.push(y);break;case"else":var A=a[a.length-1],x=A[A.length-1],b=r.length;r.push([tm.Else,-1]),A.push(b),e._backfillJump(r[x],r.length);break;case"endif":var T=r.length;r.push([tm.Endif]);var O=a.pop();if(O)for(var I=T+1,L=0;L<O.length;L++){var R=r[O[L]];R[0]===tm.Else?R[1]=I:e._backfillJump(R,I,!0)}break;case"define":var P=e._FUNC_MACRO_RE.exec(_);if(P){var M=P[2].split(",").map(function(e){return e.trim()}).filter(function(e){return e.length>0});r.push([tm.DefineFunc,P[1],M,e._stripLineComment(P[3].trim())])}else{var N=_.indexOf(" ");-1===N?r.push([tm.Define,_]):r.push([tm.DefineVal,_.substring(0,N),e._stripLineComment(_.substring(N+1).trim())])}break;case"undef":r.push([tm.Undef,_])}}return r},e._pushConditionInstruction=function(e,t){"def"===t.t?e.push([tm.IfDef,t.m,-1]):"ndef"===t.t?e.push([tm.IfNdef,t.m,-1]):"cmp"===t.t?e.push([tm.IfCmp,t.m,t.op,t.v,-1]):e.push([tm.IfExpr,t,-1])},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))return n;var o=e.indexOf("\n",n);if(-1===o)break;n=o+1}return -1},e._pushText=function(e,t,r,n){if(!(r>=n)){var i=e.length>0?e[e.length-1]:null;i&&i[0]===tm.Text?i[1]+=t.substring(r,n):e.push([tm.Text,t.substring(r,n)])}},e._backfillJump=function(e,t,r){void 0===r&&(r=!1);var n=e[0];n===tm.IfDef||n===tm.IfNdef?r&&-1!==e[2]||(e[2]=t):n===tm.IfCmp?r&&-1!==e[4]||(e[4]=t):n!==tm.IfExpr||r&&-1!==e[2]||(e[2]=t)},e._stripLineComment=function(e){var t=e.indexOf("//");return t>=0?e.substring(0,t).trimEnd():e},e._parseCondition=function(t){var r={s:t.trim(),i:0};return e._parseOr(r)},e._skipWs=function(e){for(;e.i<e.s.length&&(32===e.s.charCodeAt(e.i)||9===e.s.charCodeAt(e.i));)e.i++},e._parseOr=function(t){var r=e._parseAnd(t);for(e._skipWs(t);t.i<t.s.length-1&&124===t.s.charCodeAt(t.i)&&124===t.s.charCodeAt(t.i+1);)t.i+=2,e._skipWs(t),r={t:"or",l:r,r:e._parseAnd(t)},e._skipWs(t);return r},e._parseAnd=function(t){var r=e._parseUnary(t);for(e._skipWs(t);t.i<t.s.length-1&&38===t.s.charCodeAt(t.i)&&38===t.s.charCodeAt(t.i+1);)t.i+=2,e._skipWs(t),r={t:"and",l:r,r:e._parseUnary(t)},e._skipWs(t);return r},e._parseUnary=function(t){return(e._skipWs(t),33===t.s.charCodeAt(t.i))?(t.i++,e._skipWs(t),{t:"not",c:e._parsePrimary(t)}):e._parsePrimary(t)},e._parsePrimary=function(t){e._skipWs(t);var r=t.s;if(40===r.charCodeAt(t.i)){t.i++,e._skipWs(t);var n=e._parseOr(t);return e._skipWs(t),41===r.charCodeAt(t.i)&&t.i++,n}if("defined"===r.substring(t.i,t.i+7)){t.i+=7,e._skipWs(t);var i=40===r.charCodeAt(t.i);i&&t.i++,e._skipWs(t);var a=e._scanIdentifier(t);return e._skipWs(t),i&&41===r.charCodeAt(t.i)&&t.i++,{t:"def",m:a}}if(t.i<r.length&&e._isDigit(r.charCodeAt(t.i))){var o=e._scanNumber(t);e._skipWs(t);var s=e._scanOp(t);return s?(e._skipWs(t),{t:"bool",v:e._evalNumOp(o,s,e._scanNumber(t))}):{t:"bool",v:0!==o}}var c=e._scanIdentifier(t);if(!c)return{t:"bool",v:!1};e._skipWs(t);var l=e._scanOp(t);return l?(e._skipWs(t),{t:"cmp",m:c,op:l,v:e._scanNumber(t)}):{t:"def",m:c}},e._isDigit=function(e){return e>=48&&e<=57},e._isAlnum=function(e){return e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||95===e},e._scanIdentifier=function(t){for(var r=t.i;t.i<t.s.length&&e._isAlnum(t.s.charCodeAt(t.i));)t.i++;return t.s.substring(r,t.i)},e._scanNumber=function(t){var r=t.i;for(45===t.s.charCodeAt(t.i)&&t.i++;t.i<t.s.length&&(e._isDigit(t.s.charCodeAt(t.i))||46===t.s.charCodeAt(t.i));)t.i++;return Number(t.s.substring(r,t.i))||0},e._scanOp=function(e){var t=e.s.charCodeAt(e.i),r=e.i+1<e.s.length?e.s.charCodeAt(e.i+1):0;return 61===t&&61===r?(e.i+=2,"=="):33===t&&61===r?(e.i+=2,"!="):62===t&&61===r?(e.i+=2,">="):60===t&&61===r?(e.i+=2,"<="):62===t?(e.i++,">"):60===t?(e.i++,"<"):""},e._evalNumOp=function(e,t,r){switch(t){case"==":return e===r;case"!=":return e!==r;case">":return e>r;case"<":return e<r;case">=":return e>=r;case"<=":return e<=r;default:return!1}},e}();tS._DIRECTIVE_RE=/^[ \t]*#[ \t]*(if|ifdef|ifndef|elif|else|endif|define|undef)\b(.*)/,tS._FUNC_MACRO_RE=/^(\w+)\(([^)]*)\)\s*(.*)/;var tv=function e(t,r){this.goal=t,this.derivation=r,this.id=e._id++,e.pool.set(this.id,this)};tv._id=0,tv.pool=new Map;var tE=/*#__PURE__*/function(){function e(t,r,n){this._needReInfer=!0,this.production=t,this.position=r,this.lookaheadSet=new Set;for(var i,a=l(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=l(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]!==eG.EPSILON)return!1;return!0},t.advance=function(){return new e(this.production,this.position+1,this.lookaheadSet)},s(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}();tE._id=0;var tC=/*#__PURE__*/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=l(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=l(r);!(a=o()).done;){var s=a.value;i.lookaheadSet.has(s)||(i.lookaheadSet.add(s),i.needReInfer=!0)}return i}var c=new tE(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=l(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(";")},s(e,[{key:"items",get:function(){return this._items}},{key:"needReInfer",get:function(){for(var e,t=l(this.cores);!(e=t()).done;)if(e.value.needReInfer)return!0;return!1}}]),e}();tC.closureMap=new Map,tC.pool=new Map,tC._id=0;var tg=/*#__PURE__*/function(){function e(){}return e.isTerminal=function(e){return e<eH.START},e.toString=function(e){if(this.isTerminal(e)){var t;return null!=(t=eG[e])?t:eF[e]}return eH[e]},e.createProductionWithOptions=function(t,r,n){for(var i,a=null!=n?n:eD.TrivialNode.pool,o=[],s=l(r);!(i=s()).done;)!function(){var r=i.value,s=!n&&1===r.length&&!e.isTerminal(r[0]);o.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]){if(s)e.semanticStack.push(r[0]);else{var i=r[0].location.start,o=r[r.length-1].location.end,c=tD.createRange(i,o);eD.get(a,e,c,r)}}}])}();return o},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=l(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}(),ty=((eM={})[eM.Shift=0]="Shift",eM[eM.Reduce=1]="Reduce",eM[eM.Accept=2]="Accept",eM),tA=/*#__PURE__*/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 t=e.prototype;return t.generate=function(){this.computeFirstSet(),this.buildStateTable()},t.buildStateTable=function(){var e=[new tE(this.grammar.productions[0],0,[eG.EOF])],t=tC.create(e);this._extendState(t)},t._extendState=function(e){if(e.needReInfer){this._closure(e);for(var t,r=this._inferNextState(e),n=l(r);!(t=n()).done;){var i=t.value;this._extendState(i)}}},t._closure=function(e){for(var t,r=l(e.cores);!(t=r()).done;){var n=t.value;n.canReduce()||this._extendStateItem(e,n)}return e.closured=!0,e},t._extendStateItem=function(e,t){if(!tg.isTerminal(t.curSymbol)){var r=this.grammar.getProductionList(t.curSymbol);if(t.nextSymbol){for(var n=new Set,i=!1,a=1,o=t.symbolByOffset(1);o;o=t.symbolByOffset(++a)){if(tg.isTerminal(o)){n.add(o),i=!0;break}s=this.firstSetMap.get(o);for(var s,c,u=l(s);!(c=u()).done;){var p=c.value;n.add(p)}if(!s.has(eG.EPSILON))break}if(!i&&(null==s?void 0:s.has(eG.EPSILON)))for(var h,_=l(t.lookaheadSet);!(h=_()).done;){var f=h.value;n.add(f)}for(var d,m=l(r);!(d=m()).done;){var S=d.value,v=e.createStateItem(S,0);e.items.has(v)&&tg.isSubSet(n,v.lookaheadSet)||(e.items.add(v),v.addLookahead(n),this._extendStateItem(e,v))}}else for(var E,C=l(r);!(E=C()).done;){var g=E.value,y=e.createStateItem(g,0);e.items.has(y)&&tg.isSubSet(t.lookaheadSet,y.lookaheadSet)||(e.items.add(y),y.addLookahead(t.lookaheadSet),this._extendStateItem(e,y))}}},t._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=l(e.items);!(o=s()).done;){var c=o.value;if(c.canReduce()){var u=void 0;u=c.production.goal!==eH.START?{action:ty.Reduce,target:c.production.id}:{action:ty.Accept};for(var p,h=l(c.lookaheadSet);!(p=h()).done;){var _=p.value;this._addAction(r,_,u)}}else{var f=c.advance();tg.addMapSetItem(t,c.curSymbol,f)}c.needReInfer=!1}for(var d,m=new Set,S=l(t.entries());!(d=S()).done;){var v=d.value,E=v[0],C=v[1],g=tC.create(Array.from(C));tg.isTerminal(E)?this._addAction(r,E,{action:ty.Shift,target:g.id}):n.set(E,g.id),m.add(g)}return m},t._addAction=function(t,r,n){var i=t.get(r);i&&!tg.isActionEqual(i,n)&&e._isKnownShiftPreferred(r,i,n)&&i.action===ty.Shift&&n.action===ty.Reduce||t.set(r,n)},t.computeFirstSet=function(){for(var e,t=l(this.grammar.productions.slice(1));!(e=t()).done;){var r=e.value;this._computeFirstSetForNT(r.goal)}},t._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(eG.EPSILON);for(var c,u=l(o);!(c=u()).done;){for(var p=c.value,h=0;h<p.derivation.length;h++){var _=p.derivation[h];if(tg.isTerminal(_)){s.add(_);break}for(var f,d=this._computeFirstSetForNT(_),m=l(d);!(f=m()).done;){var S=f.value;S!==eG.EPSILON&&s.add(S)}if(!this.grammar.isNullableNT(_))break}h===p.derivation.length&&s.add(eG.EPSILON)}return this._firstSetNTStack.pop(),s},e._isKnownShiftPreferred=function(e,t,r){if(e===eF.ELSE)return!0;if(e!==eG.LEFT_PAREN)return!1;var n=t.action===ty.Reduce?t:r.action===ty.Reduce?r:null;if(!n)return!1;var i=tv.pool.get(n.target);return!!i&&i.goal===eH.type_specifier_nonarray&&1===i.derivation.length&&i.derivation[0]===eH.macro_call_symbol},e}(),tx=/*#__PURE__*/function(){function e(e,t){this.startSymbol=e,t.unshift(new tv(eH.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]===eG.EPSILON})},t.getProductionByID=function(e){return tv.pool.get(e)},e.create=function(t,r){return new e(t,r.map(function(e){return new tv(e[0],e.slice(1))}))},e}(),tb=[].concat(tg.createProductionWithOptions(eH.gs_shader_program,[[eH.global_declaration],[eH.gs_shader_program,eH.global_declaration]],eD.GLShaderProgram.pool),tg.createProductionWithOptions(eH.global_declaration,[[eH.precision_specifier],[eH.variable_declaration_statement],[eH.struct_specifier],[eH.function_definition],[eH.global_macro_if_statement],[eH.macro_undef],[eH.macro_define],[eF.MACRO_DEFINE_EXPRESSION]],eD.GlobalDeclaration.pool),tg.createProductionWithOptions(eH.macro_define,[[eF.MACRO_DEFINE,eG.ID,eH.expression,eF.MACRO_DEFINE_END],[eF.MACRO_DEFINE,eG.ID,eF.MACRO_DEFINE_PARAMS,eH.expression,eF.MACRO_DEFINE_END]],eD.MacroDefine.pool),tg.createProductionWithOptions(eH.macro_call_symbol,[[eF.MACRO_CALL]],eD.MacroCallSymbol.pool),tg.createProductionWithOptions(eH.macro_call_function,[[eH.macro_call_symbol,eG.LEFT_PAREN,eG.RIGHT_PAREN],[eH.macro_call_symbol,eG.LEFT_PAREN,eH.function_call_parameter_list,eG.RIGHT_PAREN]],eD.MacroCallFunction.pool),tg.createProductionWithOptions(eH.macro_undef,[[eF.MACRO_UNDEF,eG.ID],[eF.MACRO_UNDEF,eF.MACRO_CALL]],eD.MacroUndef.pool),tg.createProductionWithOptions(eH.macro_push_context,[[eF.MACRO_IF,eF.MACRO_CONDITIONAL_EXPRESSION],[eF.MACRO_IFDEF,eG.ID],[eF.MACRO_IFNDEF,eG.ID],[eF.MACRO_IFDEF,eH.macro_call_symbol],[eF.MACRO_IFNDEF,eH.macro_call_symbol]],eD.MacroPushContext.pool),tg.createProductionWithOptions(eH.macro_pop_context,[[eF.MACRO_ENDIF]],eD.MacroPopContext.pool),tg.createProductionWithOptions(eH.macro_elif_expression,[[eF.MACRO_ELIF,eF.MACRO_CONDITIONAL_EXPRESSION]],eD.MacroElifExpression.pool),tg.createProductionWithOptions(eH.macro_else_expression,[[eF.MACRO_ELSE]],eD.MacroElseExpression.pool),tg.createProductionWithOptions(eH.global_macro_declaration,[[eH.global_declaration],[eH.global_macro_declaration,eH.global_declaration]],eD.GlobalMacroDeclaration.pool),tg.createProductionWithOptions(eH.global_macro_if_statement,[[eH.macro_push_context,eH.global_macro_declaration,eH.global_macro_branch],[eH.macro_push_context,eH.global_macro_branch]],eD.GlobalMacroIfStatement.pool),tg.createProductionWithOptions(eH.global_macro_branch,[[eH.macro_pop_context],[eH.macro_elif_expression,eH.global_macro_declaration,eH.global_macro_branch],[eH.macro_else_expression,eH.global_macro_declaration,eH.macro_pop_context],[eH.macro_elif_expression,eH.global_macro_branch],[eH.macro_else_expression,eH.macro_pop_context]],eD.GlobalMacroBranch.pool),tg.createProductionWithOptions(eH.variable_declaration,[[eH.fully_specified_type,eG.ID],[eH.fully_specified_type,eG.ID,eH.array_specifier],[eH.fully_specified_type,eG.ID,eG.EQUAL,eH.initializer]],eD.VariableDeclaration.pool),tg.createProductionWithOptions(eH.variable_declaration_list,[[eH.variable_declaration],[eH.variable_declaration_list,eG.COMMA,eG.ID],[eH.variable_declaration_list,eG.COMMA,eG.ID,eH.array_specifier]],eD.VariableDeclarationList.pool),tg.createProductionWithOptions(eH.variable_declaration_statement,[[eH.variable_declaration_list,eG.SEMICOLON]]),tg.createProductionWithOptions(eH.ext_builtin_type_specifier_nonarray,[[eF.VOID],[eF.FLOAT],[eF.BOOL],[eF.INT],[eF.UINT],[eF.VEC2],[eF.VEC3],[eF.VEC4],[eF.BVEC2],[eF.BVEC3],[eF.BVEC4],[eF.IVEC2],[eF.IVEC3],[eF.IVEC4],[eF.UVEC2],[eF.UVEC3],[eF.UVEC4],[eF.MAT2],[eF.MAT3],[eF.MAT4],[eF.MAT2X3],[eF.MAT2X4],[eF.MAT3X2],[eF.MAT3X4],[eF.MAT4X2],[eF.MAT4X3],[eF.SAMPLER2D],[eF.SAMPLER3D],[eF.SAMPLER_CUBE],[eF.SAMPLER2D_SHADOW],[eF.SAMPLER_CUBE_SHADOW],[eF.SAMPLER2D_ARRAY],[eF.SAMPLER2D_ARRAY_SHADOW],[eF.I_SAMPLER2D],[eF.I_SAMPLER3D],[eF.I_SAMPLER_CUBE],[eF.I_SAMPLER2D_ARRAY],[eF.U_SAMPLER2D],[eF.U_SAMPLER3D],[eF.U_SAMPLER_CUBE],[eF.U_SAMPLER2D_ARRAY]],eD.ExtBuiltinTypeSpecifierNonArray.pool),tg.createProductionWithOptions(eH.type_specifier_nonarray,[[eG.ID],[eH.ext_builtin_type_specifier_nonarray],[eH.macro_call_symbol]],eD.TypeSpecifierNonArray.pool),tg.createProductionWithOptions(eH.fully_specified_type,[[eH.type_specifier],[eH.type_qualifier,eH.type_specifier]],eD.FullySpecifiedType.pool),tg.createProductionWithOptions(eH.type_specifier,[[eH.type_specifier_nonarray],[eH.ext_builtin_type_specifier_nonarray,eH.array_specifier]],eD.TypeSpecifier.pool),tg.createProductionWithOptions(eH.type_qualifier,[[eH.single_type_qualifier],[eH.type_qualifier,eH.single_type_qualifier]],eD.TypeQualifier.pool),tg.createProductionWithOptions(eH.single_type_qualifier,[[eH.storage_qualifier],[eH.precision_qualifier],[eH.interpolation_qualifier],[eH.invariant_qualifier],[eF.PRECISE]],eD.SingleTypeQualifier.pool),tg.createProductionWithOptions(eH.storage_qualifier,[[eF.CONST],[eF.IN],[eF.INOUT],[eF.OUT],[eF.CENTROID]]),tg.createProductionWithOptions(eH.interpolation_qualifier,[[eF.SMOOTH],[eF.FLAT]]),tg.createProductionWithOptions(eH.invariant_qualifier,[[eF.INVARIANT]]),tg.createProductionWithOptions(eH.precision_qualifier,[[eF.HIGHP],[eF.MEDIUMP],[eF.LOWP]]),tg.createProductionWithOptions(eH.struct_specifier,[[eF.STRUCT,eG.ID,eG.LEFT_BRACE,eH.struct_declaration_list,eG.RIGHT_BRACE,eG.SEMICOLON],[eF.STRUCT,eG.LEFT_BRACE,eH.struct_declaration_list,eG.RIGHT_BRACE,eG.SEMICOLON]],eD.StructSpecifier.pool),tg.createProductionWithOptions(eH.struct_declaration_list,[[eH.struct_declaration],[eH.struct_declaration_list,eH.struct_declaration]],eD.StructDeclarationList.pool),tg.createProductionWithOptions(eH.struct_declaration,[[eH.type_specifier,eH.struct_declarator_list,eG.SEMICOLON],[eH.type_qualifier,eH.type_specifier,eH.struct_declarator_list,eG.SEMICOLON],[eH.layout_qualifier,eH.type_specifier,eH.struct_declarator,eG.SEMICOLON],[eH.macro_struct_declaration]],eD.StructDeclaration.pool),tg.createProductionWithOptions(eH.macro_struct_declaration,[[eH.macro_push_context,eH.struct_declaration_list,eH.macro_struct_branch],[eH.macro_push_context,eH.macro_struct_branch]],eD.MacroStructDeclaration.pool),tg.createProductionWithOptions(eH.macro_struct_branch,[[eH.macro_pop_context],[eH.macro_elif_expression,eH.struct_declaration_list,eH.macro_struct_branch],[eH.macro_else_expression,eH.struct_declaration_list,eH.macro_pop_context],[eH.macro_elif_expression,eH.macro_struct_branch],[eH.macro_else_expression,eH.macro_pop_context]],eD.MacroStructBranch.pool),tg.createProductionWithOptions(eH.layout_qualifier,[[eF.LAYOUT,eG.LEFT_PAREN,eF.LOCATION,eG.EQUAL,eG.INT_CONSTANT,eG.RIGHT_PAREN]],eD.LayoutQualifier.pool),tg.createProductionWithOptions(eH.struct_declarator_list,[[eH.struct_declarator],[eH.struct_declarator_list,eG.COMMA,eH.struct_declarator]],eD.StructDeclaratorList.pool),tg.createProductionWithOptions(eH.struct_declarator,[[eG.ID],[eG.ID,eH.array_specifier]],eD.StructDeclarator.pool),tg.createProductionWithOptions(eH.array_specifier,[[eG.LEFT_BRACKET,eG.RIGHT_BRACKET],[eG.LEFT_BRACKET,eH.integer_constant_expression,eG.RIGHT_BRACKET]],eD.ArraySpecifier.pool),tg.createProductionWithOptions(eH.integer_constant_expression_operator,[[eG.PLUS],[eG.DASH],[eG.STAR],[eG.SLASH],[eG.PERCENT]],eD.IntegerConstantExpressionOperator.pool),tg.createProductionWithOptions(eH.integer_constant_expression,[[eH.variable_identifier],[eG.INT_CONSTANT],[eH.integer_constant_expression,eH.integer_constant_expression_operator,eG.INT_CONSTANT],[eH.integer_constant_expression,eH.integer_constant_expression_operator,eH.variable_identifier]],eD.IntegerConstantExpression.pool),tg.createProductionWithOptions(eH.conditional_expression,[[eH.logical_or_expression],[eH.logical_or_expression,eG.QUESTION,eH.expression,eG.COLON,eH.assignment_expression]]),tg.createProductionWithOptions(eH.logical_or_expression,[[eH.logical_xor_expression],[eH.logical_or_expression,eG.OR_OP,eH.logical_xor_expression]]),tg.createProductionWithOptions(eH.logical_xor_expression,[[eH.logical_and_expression],[eH.logical_xor_expression,eG.XOR_OP,eH.logical_and_expression]]),tg.createProductionWithOptions(eH.logical_and_expression,[[eH.inclusive_or_expression],[eH.logical_and_expression,eG.AND_OP,eH.inclusive_or_expression]]),tg.createProductionWithOptions(eH.inclusive_or_expression,[[eH.exclusive_or_expression],[eH.inclusive_or_expression,eG.VERTICAL_BAR,eH.exclusive_or_expression]]),tg.createProductionWithOptions(eH.exclusive_or_expression,[[eH.and_expression],[eH.exclusive_or_expression,eG.CARET,eH.and_expression]]),tg.createProductionWithOptions(eH.and_expression,[[eH.equality_expression],[eH.and_expression,eG.AMPERSAND,eH.equality_expression]]),tg.createProductionWithOptions(eH.equality_expression,[[eH.relational_expression],[eH.equality_expression,eG.EQ_OP,eH.relational_expression],[eH.equality_expression,eG.NE_OP,eH.relational_expression]]),tg.createProductionWithOptions(eH.relational_expression,[[eH.shift_expression],[eH.relational_expression,eG.LEFT_ANGLE,eH.shift_expression],[eH.relational_expression,eG.RIGHT_ANGLE,eH.shift_expression],[eH.relational_expression,eG.LE_OP,eH.shift_expression],[eH.relational_expression,eG.GE_OP,eH.shift_expression]]),tg.createProductionWithOptions(eH.shift_expression,[[eH.additive_expression],[eH.shift_expression,eG.LEFT_OP,eH.additive_expression],[eH.shift_expression,eG.RIGHT_OP,eH.additive_expression]]),tg.createProductionWithOptions(eH.additive_expression,[[eH.multiplicative_expression],[eH.additive_expression,eG.PLUS,eH.multiplicative_expression],[eH.additive_expression,eG.DASH,eH.multiplicative_expression]]),tg.createProductionWithOptions(eH.multiplicative_expression,[[eH.unary_expression],[eH.multiplicative_expression,eG.STAR,eH.unary_expression],[eH.multiplicative_expression,eG.SLASH,eH.unary_expression],[eH.multiplicative_expression,eG.PERCENT,eH.unary_expression]]),tg.createProductionWithOptions(eH.unary_expression,[[eH.postfix_expression],[eG.INC_OP,eH.unary_expression],[eG.DEC_OP,eH.unary_expression],[eH.unary_operator,eH.unary_expression]]),tg.createProductionWithOptions(eH.unary_operator,[[eG.PLUS],[eG.DASH],[eG.BANG],[eG.TILDE]]),tg.createProductionWithOptions(eH.postfix_expression,[[eH.primary_expression],[eH.postfix_expression,eG.LEFT_BRACKET,eH.expression,eG.RIGHT_BRACKET],[eH.function_call],[eH.postfix_expression,eG.DOT,eG.ID],[eH.postfix_expression,eG.DOT,eH.function_call],[eH.postfix_expression,eG.INC_OP],[eH.postfix_expression,eG.DEC_OP]],eD.PostfixExpression.pool),tg.createProductionWithOptions(eH.primary_expression,[[eH.variable_identifier],[eG.INT_CONSTANT],[eG.FLOAT_CONSTANT],[eF.True],[eF.False],[eG.LEFT_PAREN,eH.expression,eG.RIGHT_PAREN]],eD.PrimaryExpression.pool),tg.createProductionWithOptions(eH.expression,[[eH.assignment_expression],[eH.expression,eG.COMMA,eH.assignment_expression]],eD.Expression.pool),tg.createProductionWithOptions(eH.assignment_expression,[[eH.conditional_expression],[eH.unary_expression,eH.assignment_operator,eH.assignment_expression]],eD.AssignmentExpression.pool),tg.createProductionWithOptions(eH.assignment_operator,[[eG.EQUAL],[eG.MUL_ASSIGN],[eG.DIV_ASSIGN],[eG.MOD_ASSIGN],[eG.ADD_ASSIGN],[eG.SUB_ASSIGN],[eG.LEFT_ASSIGN],[eG.RIGHT_ASSIGN],[eG.AND_ASSIGN],[eG.XOR_ASSIGN],[eG.OR_ASSIGN]]),tg.createProductionWithOptions(eH.function_call,[[eH.function_call_generic]],eD.FunctionCall.pool),tg.createProductionWithOptions(eH.function_call_generic,[[eH.function_identifier,eG.LEFT_PAREN,eH.function_call_parameter_list,eG.RIGHT_PAREN],[eH.function_identifier,eG.LEFT_PAREN,eG.RIGHT_PAREN],[eH.function_identifier,eF.VOID,eG.RIGHT_PAREN]],eD.FunctionCallGeneric.pool),tg.createProductionWithOptions(eH.function_call_parameter_list,[[eH.assignment_expression],[eH.function_call_parameter_list,eG.COMMA,eH.assignment_expression],[eH.macro_call_arg_block],[eH.function_call_parameter_list,eH.macro_call_arg_block]],eD.FunctionCallParameterList.pool),tg.createProductionWithOptions(eH.macro_call_arg_case_list,[[eH.assignment_expression],[eG.COMMA,eH.assignment_expression],[eH.macro_call_arg_block],[eH.macro_call_arg_case_list,eH.macro_call_arg_block],[eH.macro_call_arg_case_list,eG.COMMA,eH.assignment_expression]],eD.MacroCallArgCaseList.pool),tg.createProductionWithOptions(eH.macro_call_arg_block,[[eH.macro_push_context,eH.macro_call_arg_branch],[eH.macro_push_context,eH.macro_call_arg_case_list,eH.macro_call_arg_branch]],eD.MacroCallArgBlock.pool),tg.createProductionWithOptions(eH.macro_call_arg_branch,[[eH.macro_pop_context],[eH.macro_elif_expression,eH.macro_call_arg_case_list,eH.macro_call_arg_branch],[eH.macro_else_expression,eH.macro_call_arg_case_list,eH.macro_pop_context],[eH.macro_elif_expression,eH.macro_call_arg_branch],[eH.macro_else_expression,eH.macro_pop_context]],eD.MacroCallArgBranch.pool),tg.createProductionWithOptions(eH.function_identifier,[[eH.type_specifier]],eD.FunctionIdentifier.pool),tg.createProductionWithOptions(eH.function_definition,[[eH.function_prototype,eH.compound_statement_no_scope]],eD.FunctionDefinition.pool),tg.createProductionWithOptions(eH.function_prototype,[[eH.function_declarator,eG.RIGHT_PAREN]],eD.FunctionProtoType.pool),tg.createProductionWithOptions(eH.function_declarator,[[eH.function_header],[eH.function_header,eH.function_parameter_list]],eD.FunctionDeclarator.pool),tg.createProductionWithOptions(eH.function_header,[[eH.fully_specified_type,eG.ID,eG.LEFT_PAREN]],eD.FunctionHeader.pool),tg.createProductionWithOptions(eH.function_parameter_list,[[eH.parameter_declaration],[eH.function_parameter_list,eG.COMMA,eH.parameter_declaration],[eH.macro_param_block],[eH.function_parameter_list,eH.macro_param_block]],eD.FunctionParameterList.pool),tg.createProductionWithOptions(eH.macro_param_case_list,[[eH.parameter_declaration],[eG.COMMA,eH.parameter_declaration],[eH.macro_param_block],[eH.macro_param_case_list,eH.macro_param_block],[eH.macro_param_case_list,eG.COMMA,eH.parameter_declaration]],eD.MacroParamCaseList.pool),tg.createProductionWithOptions(eH.macro_param_block,[[eH.macro_push_context,eH.macro_parameter_branch],[eH.macro_push_context,eH.macro_param_case_list,eH.macro_parameter_branch]],eD.MacroParamBlock.pool),tg.createProductionWithOptions(eH.macro_parameter_branch,[[eH.macro_pop_context],[eH.macro_elif_expression,eH.macro_param_case_list,eH.macro_parameter_branch],[eH.macro_else_expression,eH.macro_param_case_list,eH.macro_pop_context],[eH.macro_elif_expression,eH.macro_parameter_branch],[eH.macro_else_expression,eH.macro_pop_context]],eD.MacroParameterBranch.pool),tg.createProductionWithOptions(eH.parameter_declaration,[[eH.type_qualifier,eH.parameter_declarator],[eH.parameter_declarator],[eH.macro_call_symbol],[eH.macro_call_function]],eD.ParameterDeclaration.pool),tg.createProductionWithOptions(eH.parameter_declarator,[[eH.type_specifier,eG.ID],[eH.type_specifier,eG.ID,eH.array_specifier]],eD.ParameterDeclarator.pool),tg.createProductionWithOptions(eH.statement_list,[[eH.statement],[eH.statement_list,eH.statement]],eD.StatementList.pool),tg.createProductionWithOptions(eH.statement,[[eH.compound_statement],[eH.simple_statement]]),tg.createProductionWithOptions(eH.compound_statement_no_scope,[[eG.LEFT_BRACE,eG.RIGHT_BRACE],[eG.LEFT_BRACE,eH.statement_list,eG.RIGHT_BRACE]],eD.CompoundStatementNoScope.pool),tg.createProductionWithOptions(eH.compound_statement,[[eG.LEFT_BRACE,eG.RIGHT_BRACE],[eH.scope_brace,eH.statement_list,eH.scope_end_brace]]),tg.createProductionWithOptions(eH.simple_statement,[[eH.declaration],[eH.expression_statement],[eH.selection_statement],[eH.iteration_statement],[eH.jump_statement],[eH.macro_if_statement],[eH.macro_undef],[eH.macro_define],[eF.MACRO_DEFINE_EXPRESSION]]),tg.createProductionWithOptions(eH.declaration,[[eH.function_prototype,eG.SEMICOLON],[eH.init_declarator_list,eG.SEMICOLON],[eF.PRECISION,eH.precision_qualifier,eH.ext_builtin_type_specifier_nonarray,eG.SEMICOLON],[eH.type_qualifier,eG.ID,eG.SEMICOLON],[eH.type_qualifier,eG.ID,eH.identifier_list,eG.SEMICOLON]],eD.Declaration.pool),tg.createProductionWithOptions(eH.identifier_list,[[eG.COMMA,eG.ID],[eH.identifier_list,eG.COMMA,eG.ID]],eD.IdentifierList.pool),tg.createProductionWithOptions(eH.init_declarator_list,[[eH.single_declaration],[eH.init_declarator_list,eG.COMMA,eG.ID],[eH.init_declarator_list,eG.COMMA,eG.ID,eH.array_specifier],[eH.init_declarator_list,eG.COMMA,eG.ID,eH.array_specifier,eG.EQUAL,eH.initializer],[eH.init_declarator_list,eG.COMMA,eG.ID,eG.EQUAL,eH.initializer]],eD.InitDeclaratorList.pool),tg.createProductionWithOptions(eH.single_declaration,[[eH.fully_specified_type,eG.ID],[eH.fully_specified_type,eG.ID,eH.array_specifier],[eH.fully_specified_type,eG.ID,eH.array_specifier,eG.EQUAL,eH.initializer],[eH.fully_specified_type,eG.ID,eG.EQUAL,eH.initializer],[eH.fully_specified_type,eF.MACRO_CALL],[eH.fully_specified_type,eF.MACRO_CALL,eG.EQUAL,eH.initializer]],eD.SingleDeclaration.pool),tg.createProductionWithOptions(eH.initializer,[[eH.assignment_expression],[eG.LEFT_BRACE,eH.initializer_list,eG.RIGHT_BRACE]]),tg.createProductionWithOptions(eH.initializer_list,[[eH.initializer],[eH.initializer_list,eG.COMMA,eH.initializer]]),tg.createProductionWithOptions(eH.expression_statement,[[eG.SEMICOLON],[eH.expression,eG.SEMICOLON]]),tg.createProductionWithOptions(eH.selection_statement,[[eF.IF,eG.LEFT_PAREN,eH.expression,eG.RIGHT_PAREN,eH.statement],[eF.IF,eG.LEFT_PAREN,eH.expression,eG.RIGHT_PAREN,eH.statement,eF.ELSE,eH.statement]]),tg.createProductionWithOptions(eH.iteration_statement,[[eF.WHILE,eG.LEFT_PAREN,eH.condition,eG.RIGHT_PAREN,eH.statement],[eF.FOR,eG.LEFT_PAREN,eH.for_init_statement,eH.for_rest_statement,eG.RIGHT_PAREN,eH.statement]]),tg.createProductionWithOptions(eH.precision_specifier,[[eF.PRECISION,eH.precision_qualifier,eH.ext_builtin_type_specifier_nonarray,eG.SEMICOLON]],eD.PrecisionSpecifier.pool),tg.createProductionWithOptions(eH.for_init_statement,[[eH.expression_statement],[eH.declaration]]),tg.createProductionWithOptions(eH.condition,[[eH.expression],[eH.fully_specified_type,eG.ID,eG.EQUAL,eH.initializer]]),tg.createProductionWithOptions(eH.for_rest_statement,[[eH.conditionopt,eG.SEMICOLON],[eH.conditionopt,eG.SEMICOLON,eH.expression]]),tg.createProductionWithOptions(eH.conditionopt,[[eG.EPSILON],[eH.condition]]),tg.createProductionWithOptions(eH.jump_statement,[[eF.CONTINUE,eG.SEMICOLON],[eF.BREAK,eG.SEMICOLON],[eF.RETURN,eG.SEMICOLON],[eF.RETURN,eH.expression,eG.SEMICOLON],[eF.DISCARD,eG.SEMICOLON]],eD.JumpStatement.pool),tg.createProductionWithOptions(eH.scope_brace,[[eG.LEFT_BRACE]],eD.ScopeBrace.pool),tg.createProductionWithOptions(eH.scope_end_brace,[[eG.RIGHT_BRACE]],eD.ScopeEndBrace.pool),tg.createProductionWithOptions(eH.variable_identifier,[[eG.ID],[eH.macro_call_symbol],[eH.macro_call_function]],eD.VariableIdentifier.pool),tg.createProductionWithOptions(eH.macro_if_statement,[[eH.macro_push_context,eH.statement_list,eH.macro_branch],[eH.macro_push_context,eH.macro_branch]],eD.MacroIfStatement.pool),tg.createProductionWithOptions(eH.macro_branch,[[eH.macro_pop_context],[eH.macro_elif_expression,eH.statement_list,eH.macro_branch],[eH.macro_else_expression,eH.statement_list,eH.macro_pop_context],[eH.macro_elif_expression,eH.macro_branch],[eH.macro_else_expression,eH.macro_pop_context]],eD.MacroBranch.pool)),tT=function(e){for(var t=0;t<tb.length;t++){var r=tb[t][1];r&&e.addTranslationRule(t,r)}},tO=/*#__PURE__*/function(){function e(e,t,r){this._traceBackStack=[],this.actionTable=e,this.gotoTable=t,this.grammar=r,this.sematicAnalyzer=new ti}return e.prototype.parse=function(e,t){this.sematicAnalyzer.reset(t);var r=this._traceBackStack,i=this.sematicAnalyzer;r.push(0);for(var a=e.next();;){var o=a.value,s=this.stateActionTable.get(o.type);if((null==s?void 0:s.action)===ty.Shift){if(r.push(o,s.target),o.type===eF.MACRO_DEFINE_PARAMS){i.pushScope();for(var c,u=l(ej.parseMacroParamList(o.lexeme));!(c=u()).done;){var p=c.value;i.symbolTableStack.insert(new e8(p,e7.VAR))}}a=e.next()}else{if((null==s?void 0:s.action)===ty.Accept)return null==i.acceptRule||i.acceptRule.call(i,i),i.semanticStack.pop();if((null==s?void 0:s.action)!==ty.Reduce)return eB.createGSError("Unexpected token "+o.lexeme,eY.CompilationError,tD._processingPassText,o.location),null;for(var h=s.target,_=this.grammar.getProductionByID(h),f=i.getTranslationRule(_.id),d=[],m=_.derivation.length-1;m>=0;m--)if(_.derivation[m]!==eG.EPSILON){r.pop();var S=r.pop();if(n(S,eU))d.unshift(S);else{var v=i.semanticStack.pop();d.unshift(v)}}null==f||f.apply(void 0,[].concat([i],d));var E=this.stateGotoTable;r.push(_.goal);var C=null==E?void 0:E.get(_.goal);r.push(C);continue}}},e.create=function(){if(!this._singleton){var t=tx.create(eH.gs_shader_program,tb.map(function(e){return e[0]})),r=new tA(t);r.generate(),this._singleton=new e(r.actionTable,r.gotoTable,t),tT(this._singleton.sematicAnalyzer)}return this._singleton},s(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)}}]),e}(),tI=/*#__PURE__*/function(){function e(){}return e.parse=function(e,t,r,n){var i=this;return e.replace(this._includeReg,function(e,a){return a?i._replace(a,t,r,n):e})},e._replace=function(e,t,r,n){var i,a=r[i="."===e[0]?new URL(e,t).href.substring(15):e];if(!a)return console.error('Shader slice "'+i+'" not founded.'),"";var o=n.get(i);return void 0===o&&(o=this.parse(a,t,r,n),n.set(i,o)),o},e}();function tL(){return(tL=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)}tI._includeReg=/\/\*[\s\S]*?\*\/|^[ \t]*#include +"([\w\d./]+)"/gm;var tR=/*#__PURE__*/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:[],tags:{},renderStates:this.createRenderStates()}},e.createUsePass=function(e){return{name:e,pendingContents:[],isUsePass:!0,tags:{},renderStates:this.createRenderStates()}},e}(),tP=/*#__PURE__*/function(){function e(e,t,r){this.ident=e,this.type=t,this.value=r,this.isInMacroBranch=!1}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}(),tM=/*#__PURE__*/function(e){function r(){var t;return t=e.apply(this,arguments)||this,t.hasPendingContent=!1,t}a(r,e);var n=r.prototype;return n.scanNumber=function(){this.skipCommentsAndSpace();var e=this._currentIndex,t=this._source,n=this._currentIndex;return n=r._scanDigits(t,n),"."===t[n]&&(n=r._scanDigits(t,n+1)),this.advance(n-this._currentIndex),Number(t.substring(e,n))},n.scanColor=function(){this.scanLexeme("(");var e=0,r=0,n=0,i=1;return e=this.scanNumber(),this.skipCommentsAndSpace(),")"!==this.peek(1)&&(this.scanLexeme(","),r=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 t.Color(e,r,n,i)},n.scanToken=function(){for(;;){if(this.skipCommentsAndSpace(),this.isEnd())return;var e=this.getShaderPosition(0);if(eJ.isAlpha(this.getCurCharCode())){var t=this._scanWord(e);if(null!==t)return t;this.hasPendingContent=!0;continue}var n=this.getCurChar(),i=r._symbolLexemeTable[n];if(void 0!==i){this.advance(1);var a=eU.pool.get();return a.set(i,n,e),a}this.advance(1)}},n.createCompileError=function(e,t){return eB.createGSError(e,eY.CompilationError,this.source,null!=t?t:this.getShaderPosition(0))},n._scanWord=function(e){for(;eJ.isAlnum(this.getCurCharCode())&&!this.isEnd();)this.advance(1);var t,n=this.getShaderPosition(0);if(!this._validateWordBoundaries(e.index,n.index))return null;var i=this._source.substring(e.index,n.index),a=null!=(t=r._keywordLexemeTable[i])?t:eG.ID,o=tD.createRange(e,n),s=eU.pool.get();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 eJ.isWhiteSpaceChar(e,!0)||r._isWordSeparatorChar(e)},r._isWordSeparatorChar=function(e){return 123===e||125===e||61===e||59===e||46===e||91===e||40===e||124===e},r._scanDigits=function(e,t){for(var r=t;r<e.length;){var n=e.charCodeAt(r);if(eJ.isDigit(n))r++;else break}return r},r}(eJ);tM._keywordLexemeTable={RenderQueueType:eF.GSRenderQueueType,BlendState:eF.GSBlendState,DepthState:eF.GSDepthState,StencilState:eF.GSStencilState,RasterState:eF.GSRasterState,EditorProperties:eF.GSEditorProperties,EditorMacros:eF.GSEditorMacros,Editor:eF.GSEditor,Tags:eF.GSTags,VertexShader:eF.GSVertexShader,FragmentShader:eF.GSFragmentShader,SubShader:eF.GSSubShader,Pass:eF.GSPass,BlendFactor:eF.GSBlendFactor,BlendOperation:eF.GSBlendOperation,Bool:eF.GSBool,Number:eF.GSNumber,Color:eF.GSColor,CompareFunction:eF.GSCompareFunction,StencilOperation:eF.GSStencilOperation,CullMode:eF.GSCullMode,ColorWriteMask:eF.GSColorWriteMask,UsePass:eF.GSUsePass,true:eF.True,false:eF.False},tM._symbolLexemeTable={"{":eF.LeftBrace,"}":eF.RightBrace,"=":eF.Equal,"|":eF.BitwiseOr};var tN=/*#__PURE__*/function(){function e(){}return e.parse=function(e){this.errors.length=0,this._symbolTableStack.clear(),this._pushScope();var t=this._lexer;t.setSource(e);for(var r=this._parseShader(t),n=r.pendingContents,i=r.renderStates,a=0,o=r.subShaders.length;a<o;a++){var s=r.subShaders[a],c=n.concat(s.pendingContents),l={constantMap:tL({},i.constantMap),variableMap:tL({},i.variableMap)};this._mergeRenderStates(l,s.renderStates);for(var u=0,p=s.passes.length;u<p;u++){var h=s.passes[u],_={constantMap:tL({},l.constantMap),variableMap:tL({},l.variableMap)};if(this._mergeRenderStates(_,h.renderStates),h.renderStates=_,!h.isUsePass){var f=c.concat(h.pendingContents);h.contents=f.map(function(e){return e.content}).join("\n")}}}return r},e._parseShader=function(e){e.scanLexeme("Shader");var t=e.scanPairedChar('"','"',!1,!1),r=tR.createShaderSource(t);e.scanLexeme("{");var n=1;e.skipCommentsAndSpace();for(var i=e.getShaderPosition(0),a=r.pendingContents;;){var o=e.scanToken();switch(o.type){case eF.GSSubShader:this._addPendingContents(i,o.lexeme.length,a);var s=this._parseSubShader();r.subShaders.push(s),i=e.getShaderPosition(0);break;case eF.GSEditorProperties:case eF.GSEditorMacros:case eF.GSEditor:this._addPendingContents(i,o.lexeme.length,a),e.scanPairedChar("{","}",!0,!1),i=e.getShaderPosition(0);break;case eF.LeftBrace:++n;break;case eF.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)}}},e._parseRenderStateDeclarationOrAssignment=function(e,t){var r=this._lexer,n=r.scanToken();if(n.type===eG.ID){r.scanLexeme("{");var i=this._parseRenderStateProperties(t.lexeme),a=new tP(n.lexeme,t.type,i);this._symbolTableStack.insert(a)}else if("="===n.lexeme){var o,s=r.scanToken();if("{"===s.lexeme)o=this._parseRenderStateProperties(t.lexeme);else{r.scanLexeme(";");var c=this._lookupSymbol;c.set(s.lexeme,t.type);var l=this._symbolTableStack.lookup(c);(null==l?void 0:l.value)||this._createCompileError('Invalid "'+t.lexeme+'" variable: '+s.lexeme,s.location),o=l.value}this._mergeRenderStates(e,o)}},e._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]},e._parseVariableDeclaration=function(){var e=this._lexer,t=e.scanToken();e.scanLexeme(";");var r=new tP(t.lexeme,t.type);this._symbolTableStack.insert(r)},e._pushScope=function(){var e=new e9;this._symbolTableStack.pushScope(e)},e._popScope=function(){this._symbolTableStack.popScope()},e._parseRenderStateProperties=function(e){for(var t=this._lexer,r=tR.createRenderStates();"}"!==t.getCurChar();)this._parseRenderStateProperty(e,r),t.skipCommentsAndSpace();return t.advance(1),r},e._createCompileError=function(e,t){this._lexer.createCompileError(e,t)},e._scanEnumConstValue=function(e){var t,r=this._lexer;r.advance(1);var n=r.scanToken(),i=null==(t=this._renderStateConstMap[e])?void 0:t[n.lexeme];return void 0==i&&this._createCompileError("Invalid engine constant: "+e+"."+n.lexeme,n.location),i},e._parseRenderStateProperty=function(e,t){var n,i=this._lexer,a=i.scanToken().lexeme,o=a;if("BlendState"===e&&"BlendColor"!==a&&"AlphaToCoverage"!==a){var s=0,c=i.scanTwoExpectedLexemes("[","=");"["===c?(s=i.scanNumber(),i.scanLexeme("]"),i.scanLexeme("=")):"="!==c&&this._createCompileError("Invalid syntax, expect '[' or '=', but got unexpected token"),o+=s}else i.scanLexeme("=");var l=r.RenderStateElementKey[e+o];void 0===l&&this._createCompileError("Invalid render state property "+a),i.skipCommentsAndSpace();var u=i.getCurCharCode();if(eJ.isDigit(u)||46===u)n=i.scanNumber();else{var p=i.scanToken(),h=p.type;if(h===eF.True)n=!0;else if(h===eF.False)n=!1;else if(h===eF.GSColor)n=i.scanColor();else if("."===i.getCurChar()){if(void 0==(n=this._scanEnumConstValue(p.lexeme)))return;if(i.skipCommentsAndSpace(),"|"===i.getCurChar()){if("ColorWriteMask"!==p.lexeme){this._createCompileError("Bitwise OR '|' is not supported for '"+p.lexeme+"', only bitmask enums like 'ColorWriteMask' support this",p.location);return}for(;"|"===i.getCurChar();){i.advance(1);var _=i.scanToken();if(void 0==_||"."!==i.getCurChar()){this._createCompileError("Invalid syntax after '|', expect 'EnumType.Value'",null==_?void 0:_.location);return}if(_.lexeme!==p.lexeme){this._createCompileError("Cannot mix enum types in bitwise OR: expected '"+p.lexeme+"' but got '"+_.lexeme+"'",_.location);return}var f=this._scanEnumConstValue(_.lexeme);if(void 0==f)return;n|=f,i.skipCommentsAndSpace()}}}else{n=p.lexeme;var d=this._lookupSymbol;d.set(p.lexeme,eG.ID),this._symbolTableStack.lookup(d)||this._createCompileError("Invalid "+e+" variable: "+p.lexeme,p.location)}}i.scanLexeme(";"),"string"==typeof n?t.variableMap[l]=n:t.constantMap[l]=n},e._parseRenderQueueDeclarationOrAssignment=function(e){var t=this._lexer,n=t.scanToken();if(n.type===eG.ID){t.scanLexeme(";");var i=new tP(n.lexeme,eF.GSRenderQueueType);this._symbolTableStack.insert(i);return}"="!==n.lexeme&&this._createCompileError("Invalid syntax, expect character '=', but got "+n.lexeme,n.location);var a=t.scanToken();t.scanLexeme(";");var o=this._renderStateConstMap.RenderQueueType[a.lexeme],s=r.RenderStateElementKey.RenderQueueType;if(void 0==o){e.variableMap[s]=a.lexeme;var c=this._lookupSymbol;c.set(a.lexeme,eF.GSRenderQueueType),this._symbolTableStack.lookup(c)||this._createCompileError("Invalid RenderQueueType variable: "+a.lexeme,a.location)}else e.constantMap[s]=o},e._addPendingContents=function(e,t,r){var n=this._lexer;if(n.hasPendingContent){var i=n.currentIndex-t;r.push({range:{start:e,end:tL({},n.getShaderPosition(0),{index:i-1})},content:n.source.substring(e.index,i-1)}),n.hasPendingContent=!1}},e._parseSubShader=function(){var e=this._lexer;this._pushScope();var t=1,r=e.scanPairedChar('"','"',!1,!1),n=tR.createSubShaderSource(r);e.scanLexeme("{"),e.skipCommentsAndSpace();for(var i=e.getShaderPosition(0);;){var a=e.scanToken();switch(a.type){case eF.GSPass:this._addPendingContents(i,a.lexeme.length,n.pendingContents);var o=this._parsePass();n.passes.push(o),i=e.getShaderPosition(0);break;case eF.GSUsePass:this._addPendingContents(i,a.lexeme.length,n.pendingContents);var s=e.scanPairedChar('"','"',!1,!1);n.passes.push(tR.createUsePass(s)),i=e.getShaderPosition(0);break;case eF.LeftBrace:++t;break;case eF.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)}}},e._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(",")}},e._parsePass=function(){this._pushScope();var e=this._lexer,t=e.scanPairedChar('"','"',!1,!1),r=tR.createShaderPassSource(t);e.scanLexeme("{");var n=1;e.skipCommentsAndSpace();for(var i=e.getShaderPosition(0);;){var a=e.scanToken();switch(a.type){case eF.GSVertexShader:case eF.GSFragmentShader:this._addPendingContents(i,a.lexeme.length,r.pendingContents),e.scanLexeme("=");var o=e.scanToken();r[a.lexeme]&&eB.createGSError("Reassign main entry",eY.CompilationError,e.source,e.getShaderPosition(0)),r[a.type===eF.GSVertexShader?"vertexEntry":"fragmentEntry"]=o.lexeme,e.scanLexeme(";"),i=e.getShaderPosition(0);break;case eF.LeftBrace:++n;break;case eF.RightBrace:if(0==--n)return this._addPendingContents(i,a.lexeme.length,r.pendingContents),this._popScope(),r;break;default:i=this._parseRenderStateAndTags(a,i,r.pendingContents,r.renderStates,r.tags)}}},e._parseRenderStateAndTags=function(e,t,r,n,i){return e.type===eF.GSTags?(this._addPendingContents(t,e.lexeme.length,r),this._parseTags(i),t=this._lexer.getShaderPosition(0)):t=this._parseRenderState(e,t,r,n),t},e._parseRenderState=function(e,t,r,n){switch(e.type){case eF.GSBlendState:case eF.GSDepthState:case eF.GSRasterState:case eF.GSStencilState:this._addPendingContents(t,e.lexeme.length,r),this._parseRenderStateDeclarationOrAssignment(n,e),t=this._lexer.getShaderPosition(0);break;case eF.GSBlendFactor:case eF.GSBlendOperation:case eF.GSBool:case eF.GSNumber:case eF.GSColor:case eF.GSCompareFunction:case eF.GSStencilOperation:case eF.GSCullMode:case eF.GSColorWriteMask:this._addPendingContents(t,e.lexeme.length,r),this._parseVariableDeclaration(),t=this._lexer.getShaderPosition(0);break;case eF.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}();tN.errors=[],tN._renderStateConstMap={RenderQueueType:r.RenderQueueType,CompareFunction:r.CompareFunction,StencilOperation:r.StencilOperation,BlendOperation:r.BlendOperation,BlendFactor:r.BlendFactor,CullMode:r.CullMode,ColorWriteMask:r.ColorWriteMask},tN._symbolTableStack=new e5,tN._lexer=new tM,tN._lookupSymbol=new tP("",null);var tD=/*#__PURE__*/function(){function e(){this._includeMap={},this._chunkOutputCache=new Map}var i=e.prototype;return i._setIncludeMap=function(e){this._includeMap=e,this._chunkOutputCache.clear()},i._parseShaderSource=function(e){return eB.clearAllShaderCompilerObjectPool(),tN.parse(e)},i._parseShaderPass=function(t,n,i,a,o){var s={},c=tI.parse(t,o,this._includeMap,this._chunkOutputCache),l=new e$(c,s).tokenize(),u=e._parser;e._processingPassText=c;var p=u.parse(l,s);if(p){var h=(a===r.ShaderLanguage.GLSLES100?t_.getVisitor():td.getVisitor()).visitShaderProgram(p,n,i);return e._processingPassText=void 0,h&&(h.vertexShaderInstructions=tS.parse(h.vertex),h.fragmentShaderInstructions=tS.parse(h.fragment)),h}},i._precompile=function(e,t,r){var n=this,i=this._parseShaderSource(e),a=i.subShaders.map(function(e){return{name:e.name,tags:e.tags,passes:e.passes.map(function(a){if(a.isUsePass)return{name:a.name,isUsePass:!0,tags:a.tags,renderStates:n._serializeRenderStates(a.renderStates)};var o=n._parseShaderPass(a.contents,a.vertexEntry,a.fragmentEntry,t,r);if(!o)throw Error('Shader pass "'+i.name+"."+e.name+"."+a.name+'" precompile failed, please check the shader source code.');return{name:a.name,isUsePass:!1,tags:a.tags,renderStates:n._serializeRenderStates(a.renderStates),vertexShaderInstructions:o.vertexShaderInstructions,fragmentShaderInstructions:o.fragmentShaderInstructions}})}});return{name:i.name,platformTarget:t,subShaders:a}},i._serializeRenderStates=function(e){var r={};for(var i in e.constantMap){var a=e.constantMap[i];n(a,t.Color)?r[i]=[a.r,a.g,a.b,a.a]:r[i]=a}return{constantMap:r,variableMap:e.variableMap}},e.createPosition=function(e,t,r){var n=this._shaderPositionPool.get();return n.set(e),n},e.createRange=function(e,t){var r=this._shaderRangePool.get();return r.set(e,t),r},e}();tD._parser=tO.create(),tD._shaderPositionPool=eB.createObjectPool(ek),tD._shaderRangePool=eB.createObjectPool(eV);var tV="2.0.0-alpha.41";console.log("Galacean Engine Shader Compiler Version: "+tV+" | Mode: Release"),e.GSError=eK,e.GSErrorName=eY,e.ShaderCompiler=tD,e.version=tV,Object.defineProperty(e,"__esModule",{value:!0})});
|
|
2
2
|
//# sourceMappingURL=browser.min.js.map
|